@visuallyjs/browser-ui 1.0.1 → 1.0.2
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 +24 -24
- package/js/visuallyjs.browser-ui.esm.js +28 -28
- package/package.json +1 -1
- package/types/version.d.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var uc=Object.defineProperty,uD=Object.defineProperties,gO=Object.getOwnPropertyDescriptor,pD=Object.getOwnPropertyDescriptors,mD=Object.getOwnPropertyNames,mO=Object.getOwnPropertySymbols;var EO=Object.prototype.hasOwnProperty,gD=Object.prototype.propertyIsEnumerable;var Ky=(i,r,e)=>r in i?uc(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,Ei=(i,r)=>{for(var e in r||(r={}))EO.call(r,e)&&Ky(i,e,r[e]);if(mO)for(var e of mO(r))gD.call(r,e)&&Ky(i,e,r[e]);return i},fO=(i,r)=>uD(i,pD(r));var ED=(i,r)=>{for(var e in r)uc(i,e,{get:r[e],enumerable:!0})},fD=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of mD(r))!EO.call(i,n)&&n!==e&&uc(i,n,{get:()=>r[n],enumerable:!(t=gO(r,n))||t.enumerable});return i};var yD=i=>fD(uc({},"__esModule",{value:!0}),i),Nt=(i,r,e,t)=>{for(var n=t>1?void 0:t?gO(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&&uc(r,e,n),n};var c=(i,r,e)=>(Ky(i,typeof r!="symbol"?r+"":r,e),e);var hB={};ED(hB,{$__proxyEdge:()=>FS,$__unproxyEdge:()=>BS,$_createCircularSvgHandles:()=>gC,$_createRectangularSvgHandles:()=>mC,$_createSvg:()=>Ie,$_setSkeletonPosition:()=>ay,$addOverlay:()=>Gl,$appendAtIndex:()=>ea,$attr:()=>ce,$autoCalculateChartScale:()=>Kh,$calculateChartScaleWithSteps:()=>BP,$createConnection:()=>$S,$createGradient:()=>kS,$createMarker:()=>ac,$defaultOrthogonalPathCompute:()=>YA,$defaultStraightPathCompute:()=>F_,$doImageExport:()=>Yf,$getConnectorPathData:()=>DA,$getMarker:()=>Cm,$getOverlay:()=>Vl,$getOverlays:()=>oR,$hideOverlay:()=>EM,$isCompoundAction:()=>HO,$isGroupSizeChangedAction:()=>ob,$isMoveAction:()=>ib,$isUpdateAction:()=>nb,$makeAndAppendCircularHandle:()=>cv,$makeAndAppendRectangularHandle:()=>dv,$makeCircularHandle:()=>Lf,$makeRectangularHandle:()=>TL,$makeSvgAnchorPlaceholder:()=>OV,$prepareFontSpec:()=>pi,$rewriteOrthogonalConnector:()=>WA,$spaceLabels:()=>UP,$svgNode:()=>$,$updateLabelOverlayFont:()=>TE,ABSOLUTE:()=>je,ACTION_ADD:()=>xS,ACTION_REMOVE:()=>bS,ADD_CLASS_ACTION:()=>PM,ALL_GROUPS_RELAYOUT:()=>yN,ANCHOR_PLACEHOLDER_SELECTOR:()=>Rf,ANIMATION_PHASE_CANCELLED:()=>Ca,ANIMATION_PHASE_FINISHED:()=>Pa,ANIMATION_PHASE_INITIALIZED:()=>bC,ANIMATION_PHASE_TRAVERSING_EDGE:()=>AC,ANIMATION_PHASE_TRAVERSING_END:()=>py,ANIMATION_PHASE_TRAVERSING_START:()=>uy,ANIM_SURFACE_ELEMENT_FLASH:()=>TT,APPEND_TO_CURRENT:()=>St,AStarGrid:()=>Os,ATTRIBUTE_CHART_CATEGORY:()=>zn,ATTRIBUTE_CHART_FILTERED_SERIES:()=>K$,ATTRIBUTE_CHART_SERIES:()=>dt,ATTRIBUTE_CHART_STACK:()=>ym,ATTRIBUTE_CHART_STACK_TOTAL:()=>xm,ATTRIBUTE_CHART_VALUE:()=>bm,ATTRIBUTE_CLASS:()=>Kb,ATTRIBUTE_COLOR_PICKER_MAX_COLORS:()=>b0,ATTRIBUTE_CONTAINER:()=>ZE,ATTRIBUTE_CONTEXT:()=>Wb,ATTRIBUTE_CONTROLS_ORIENTATION:()=>WL,ATTRIBUTE_DATA_SHAPE_ID:()=>Hp,ATTRIBUTE_DEFAULT:()=>Zb,ATTRIBUTE_ELEMENTS_DRAGGABLE:()=>eS,ATTRIBUTE_FILL:()=>UM,ATTRIBUTE_GROUP:()=>QA,ATTRIBUTE_GROUP_COLLAPSED_CONTENT:()=>Vu,ATTRIBUTE_GROUP_CONTENT:()=>JE,ATTRIBUTE_GROUP_EXPANDED_CONTENT:()=>Mu,ATTRIBUTE_ICON_ID:()=>eL,ATTRIBUTE_ICON_KEY:()=>kT,ATTRIBUTE_ICON_SIZE:()=>HT,ATTRIBUTE_IS_GROUP:()=>zl,ATTRIBUTE_LOOKUP:()=>Dg,ATTRIBUTE_MANAGED:()=>Pt,ATTRIBUTE_NOT_DRAGGABLE:()=>_l,ATTRIBUTE_ORIENTATION:()=>QR,ATTRIBUTE_ORIGIN:()=>Qu,ATTRIBUTE_ORIGIN_X:()=>XT,ATTRIBUTE_ORIGIN_Y:()=>jT,ATTRIBUTE_RESET_SELECTION:()=>Nv,ATTRIBUTE_STROKE:()=>kM,ATTRIBUTE_STROKE_DASHARRAY:()=>IE,ATTRIBUTE_STROKE_DASHOFFSET:()=>jM,ATTRIBUTE_STROKE_LINECAP:()=>zM,ATTRIBUTE_STROKE_LINEJOIN:()=>YM,ATTRIBUTE_STROKE_MITERLIMIT:()=>XM,ATTRIBUTE_STROKE_OPACITY:()=>HM,ATTRIBUTE_STROKE_WIDTH:()=>WM,ATTRIBUTE_STYLE:()=>qb,ATTRIBUTE_TABINDEX:()=>gE,ATTRIBUTE_TEXT_ANCHOR:()=>ZM,ATTRIBUTE_TRANSFORM:()=>si,ATTRIBUTE_VALUE_NON_SCALING_STROKE:()=>Au,ATTRIBUTE_VECTOR_EFFECT:()=>bu,ATTRIBUTE_VERSION:()=>BM,ATTRIBUTE_VJS_ALLOW_LOOPBACK:()=>EE,ATTRIBUTE_VJS_EDGE:()=>Ze,ATTRIBUTE_VJS_EDGE_TYPE:()=>eu,ATTRIBUTE_VJS_ENABLED:()=>fr,ATTRIBUTE_VJS_MAGNET:()=>iu,ATTRIBUTE_VJS_MINIVIEW_TYPE:()=>Av,ATTRIBUTE_VJS_NODE_ID:()=>Bf,ATTRIBUTE_VJS_OVERLAY_ID:()=>ou,ATTRIBUTE_VJS_PORT:()=>on,ATTRIBUTE_VJS_PORT_ID:()=>Rl,ATTRIBUTE_VJS_PORT_TYPE:()=>Hr,ATTRIBUTE_VJS_SCOPE:()=>Yl,ATTRIBUTE_VJS_SOURCE:()=>tu,ATTRIBUTE_VJS_SOURCE_PORT:()=>Mo,ATTRIBUTE_VJS_SOURCE_PORT_ID:()=>ru,ATTRIBUTE_VJS_SOURCE_PORT_TYPE:()=>ri,ATTRIBUTE_VJS_TARGET:()=>Io,ATTRIBUTE_VJS_TARGET_PORT:()=>Vo,ATTRIBUTE_VJS_TARGET_PORT_ID:()=>nu,ATTRIBUTE_VJS_TARGET_PORT_TYPE:()=>Gi,ATTRIBUTE_VJS_VERTEX:()=>ee,ATTRIBUTE_XMLNS:()=>FM,ATT_DATA_DIR:()=>va,ATT_VJS_RESIZABLE:()=>oy,ATT_VJS_ROTATABLE:()=>sy,ATT_VJS_X_RESIZE:()=>ny,ATT_VJS_Y_RESIZE:()=>iy,AXIS_POSITION_END:()=>mi,AXIS_POSITION_START:()=>sr,AbsoluteBackedLayout:()=>Hn,AbsoluteLayout:()=>uo,AbstractEntry:()=>Di,AbstractHierarchicalLayout:()=>Ss,AbstractLayout:()=>fn,AbstractLayoutAdapter:()=>vc,AddGroupMemberAction:()=>sd,AnchorLocations:()=>Md,ArcSegmentHandler:()=>Wd,AreaChart:()=>eO,AreaPlot:()=>lc,ArrayBasedSeries:()=>Ia,ArrowOverlay:()=>_r,AssignLayersStage:()=>Ic,AutoSaver:()=>al,AvailableBackgrounds:()=>Ki,BASIC_SHAPES:()=>JT,BLOCK:()=>Pr,BOTTOM:()=>st,BackgroundPlugin:()=>es,BalloonLayout:()=>Dc,BarChart:()=>rO,BarPlot:()=>wr,Base:()=>bc,BaseBrowserUIPlugin:()=>Oe,BaseChart:()=>io,BaseDomUiLayoutAdapter:()=>oa,BaseRouter:()=>xu,BaseSeriesBasedChartDataSource:()=>nc,BezierEditor:()=>di,BezierSegmentHandler:()=>P_,BlankDataSource:()=>Na,BlankScale:()=>sc,BrowserUI:()=>aa,BrowserUIClipboard:()=>ip,BrowserUIModel:()=>Ay,BrowserUiRecado:()=>Zo,BubbleChart:()=>nO,BubbleChartSeries:()=>Hy,CENTER:()=>Rt,CHART_AXIS_TITLE_ALIGN_END:()=>kP,CHART_AXIS_TITLE_ALIGN_MIDDLE:()=>Da,CHART_AXIS_TITLE_ALIGN_START:()=>HP,CHART_TITLE_ALIGN_LEFT:()=>W$,CHART_TITLE_ALIGN_MIDDLE:()=>k$,CHART_TITLE_ALIGN_RIGHT:()=>Z$,CHART_TITLE_PLACEMENT_BOTTOM:()=>rc,CHART_TITLE_PLACEMENT_TOP:()=>Vw,CLASS_ANCHOR_CANDIDATE:()=>PV,CLASS_ANCHOR_PLACEHOLDER:()=>pa,CLASS_AREA_CHART:()=>$P,CLASS_AREA_CHART_AREA:()=>dm,CLASS_BACKGROUND:()=>LL,CLASS_BACKGROUND_BORDER:()=>wL,CLASS_BACKGROUND_GRID:()=>Qo,CLASS_BACKGROUND_GRID_DOT_MAJOR:()=>xp,CLASS_BACKGROUND_GRID_DOT_MINOR:()=>IL,CLASS_BACKGROUND_GRID_MAJOR:()=>NL,CLASS_BACKGROUND_GRID_MINOR:()=>DL,CLASS_BACKGROUND_TILE:()=>PL,CLASS_BAR_CHART:()=>PP,CLASS_BAR_CHART_BAR:()=>OP,CLASS_BEZIER_GUIDELINE:()=>JC,CLASS_BEZIER_HANDLE:()=>Uh,CLASS_BEZIER_HANDLE_CONTROL_POINT:()=>by,CLASS_BEZIER_HANDLE_CONTROL_POINT_1:()=>WC,CLASS_BEZIER_HANDLE_CONTROL_POINT_2:()=>ZC,CLASS_BEZIER_SECONDARY_HANDLE:()=>BG,CLASS_BEZIER_SECONDARY_SOURCE_HANDLE:()=>FG,CLASS_BEZIER_SECONDARY_TARGET_HANDLE:()=>UG,CLASS_BUBBLE_CHART:()=>_P,CLASS_BUBBLE_CHART_DATA_POINT:()=>RP,CLASS_CHART_AXIS:()=>wa,CLASS_CHART_AXIS_LABELS:()=>Oy,CLASS_CHART_AXIS_LINE:()=>_y,CLASS_CHART_AXIS_TITLE:()=>Ry,CLASS_CHART_BACKGROUND:()=>fP,CLASS_CHART_BODY:()=>Wh,CLASS_CHART_CROSSHAIR:()=>Zh,CLASS_CHART_CROSSHAIR_LABEL:()=>Jh,CLASS_CHART_EMPTY:()=>Ly,CLASS_CHART_GRIDLINE:()=>Dy,CLASS_CHART_GRIDLINES:()=>wy,CLASS_CHART_LEGEND:()=>xP,CLASS_CHART_LEGEND_DOT:()=>AP,CLASS_CHART_LEGEND_ITEM:()=>am,CLASS_CHART_LEGEND_LABEL:()=>bP,CLASS_CHART_PLOT_BACKGROUND:()=>La,CLASS_CHART_POINT:()=>pn,CLASS_CHART_POINT_HIT_AREA:()=>cm,CLASS_CHART_SCALE_LABEL:()=>VP,CLASS_CHART_SERIES:()=>yP,CLASS_CHART_SUBTITLE:()=>NP,CLASS_CHART_TITLE:()=>DP,CLASS_CHART_X_AXIS:()=>lm,CLASS_CHART_X_AXIS_TITLE:()=>TP,CLASS_CHART_Y_AXIS:()=>hm,CLASS_CHART_Y_AXIS_TITLE:()=>SP,CLASS_COLOR_PICKER:()=>y0,CLASS_COLOR_PICKER_SWATCH:()=>Yv,CLASS_COLOR_PICKER_SWATCHES:()=>Uv,CLASS_COLUMN_CHART:()=>vP,CLASS_COLUMN_CHART_COLUMN:()=>CP,CLASS_CONNECTED:()=>Ll,CLASS_CONNECTION_EDIT:()=>_f,CLASS_CONNECTOR:()=>Zs,CLASS_CONNECTOR_OUTLINE:()=>rS,CLASS_CONNECTOR_PATH:()=>tS,CLASS_CONNECTOR_SOURCE_DRAG:()=>ji,CLASS_CONNECTOR_TARGET_DRAG:()=>Hi,CLASS_CONNECTOR_TRANSIENT:()=>nS,CLASS_CONNECTOR_TRANSIENT_DRAG:()=>MT,CLASS_CONTROLS:()=>Ap,CLASS_CONTROLS_CLEAR:()=>_v,CLASS_CONTROLS_PAN_MODE:()=>Sv,CLASS_CONTROLS_REDO:()=>Ov,CLASS_CONTROLS_RESET_SELECTION:()=>Lv,CLASS_CONTROLS_SELECT_MODE:()=>Ff,CLASS_CONTROLS_UNDO:()=>Pv,CLASS_CONTROLS_ZOOM_IN:()=>vv,CLASS_CONTROLS_ZOOM_OUT:()=>Cv,CLASS_CONTROLS_ZOOM_TO_FIT:()=>Tv,CLASS_COPY_PASTE_CONTROLS:()=>VV,CLASS_CROSSHAIR_CATEGORY_AXIS:()=>MP,CLASS_CROSSHAIR_VALUE_AXIS:()=>IP,CLASS_DEFAULT_GROUP:()=>gf,CLASS_DEFAULT_NODE:()=>mf,CLASS_DIAGRAM_CELL_TOOL:()=>fy,CLASS_DIAGRAM_CLONE_CELL:()=>NC,CLASS_DIAGRAM_DELETE_CELL:()=>IC,CLASS_DIAGRAM_GROUP:()=>_C,CLASS_DIAGRAM_LINK_CELL:()=>I0,CLASS_DIAGRAM_NODE:()=>OC,CLASS_DRAG_ACTIVE:()=>Kt,CLASS_DRAG_HOVER:()=>qt,CLASS_DRAG_HOVER_CANNOT_DROP:()=>Wo,CLASS_DRAG_ORIGINAL_GROUP:()=>Ef,CLASS_DUMMY_VERTEX:()=>sS,CLASS_EDGE_DELETE_BUTTON:()=>Ks,CLASS_EDGE_DELETE_BUTTON_INTERNAL:()=>au,CLASS_EDGE_GUIDELINE:()=>gp,CLASS_EDGE_RELOCATING:()=>uf,CLASS_EDGE_TYPE_PICKER:()=>S0,CLASS_EDGE_TYPE_PICKER_SELECTED:()=>Ip,CLASS_EDGE_WILL_RELOCATE:()=>Yu,CLASS_ELASTIC_GROUP_RESIZE:()=>VL,CLASS_ELEMENT_DRAGGING:()=>th,CLASS_EXPORT_CANCEL:()=>Cp,CLASS_EXPORT_CONTROLS:()=>Rv,CLASS_EXPORT_DIMENSIONS:()=>Mv,CLASS_EXPORT_DOWNLOAD_TOOLS:()=>Vv,CLASS_EXPORT_OVERLAY:()=>vp,CLASS_EXPORT_UNDERLAY:()=>Tp,CLASS_GAUGE_CHART:()=>rD,CLASS_GAUGE_CHART_LABEL:()=>oD,CLASS_GAUGE_CHART_NEEDLE:()=>sD,CLASS_GAUGE_CHART_NEEDLE_PIVOT:()=>aD,CLASS_GAUGE_CHART_TICK:()=>iD,CLASS_GAUGE_CHART_TRACK:()=>nD,CLASS_GAUGE_CHART_ZONE:()=>iO,CLASS_GROUP:()=>Go,CLASS_GROUP_CHILD_ELEMENT_DRAGGING:()=>df,CLASS_GROUP_COLLAPSED:()=>fE,CLASS_GROUP_EXPANDED:()=>yE,CLASS_HOVER:()=>oh,CLASS_INSPECTOR:()=>f0,CLASS_INSPECTOR_ACTIVE:()=>Bv,CLASS_INSPECTOR_CLOSE:()=>Fv,CLASS_INSPECTOR_INACTIVE:()=>wp,CLASS_LABEL_OVERLAY:()=>iS,CLASS_LASSO:()=>vT,CLASS_LASSO_MASK:()=>nh,CLASS_LASSO_MASK_BOTTOM:()=>_T,CLASS_LASSO_MASK_LEFT:()=>CT,CLASS_LASSO_MASK_RIGHT:()=>OT,CLASS_LASSO_MASK_TOP:()=>PT,CLASS_LINE_CHART:()=>GP,CLASS_MINIVIEW:()=>zu,CLASS_MINIVIEW_CANVAS:()=>RT,CLASS_MINIVIEW_CLICK_TO_CENTER:()=>IT,CLASS_MINIVIEW_COLLAPSE:()=>NT,CLASS_MINIVIEW_COLLAPSED:()=>Xu,CLASS_MINIVIEW_ELEMENT:()=>wT,CLASS_MINIVIEW_GROUP_ELEMENT:()=>DT,CLASS_MINIVIEW_PANNER:()=>LT,CLASS_MINIVIEW_PANNING:()=>pf,CLASS_MOST_RECENTLY_DRAGGED:()=>rh,CLASS_NODE:()=>$i,CLASS_ORTHOGONAL_HANDLE:()=>UC,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE:()=>Kp,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL:()=>zC,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL:()=>YC,CLASS_OVERLAY:()=>Js,CLASS_OVERLAY_HIDE:()=>wl,CLASS_PALETTE:()=>my,CLASS_PALETTE_CURRENT_SHAPE_TYPE:()=>ju,CLASS_PALETTE_ELEMENT_CURRENT:()=>VT,CLASS_PALETTE_SELECTED_ELEMENT:()=>ko,CLASS_PALETTE_SET:()=>jp,CLASS_PALETTE_SET_FILTER:()=>Gh,CLASS_PALETTE_SET_SHAPES:()=>Ey,CLASS_PALETTE_SET_TITLE:()=>SC,CLASS_PALETTE_SHAPE:()=>$h,CLASS_PALETTE_SHAPE_LABEL:()=>gy,CLASS_PALETTE_TAP_MODE_ACTIVE:()=>ih,CLASS_PALETTE_VERTEX_DRAWING_LASSO:()=>TC,CLASS_PAN_ZOOM_CANVAS:()=>fL,CLASS_PAN_ZOOM_VIEWPORT:()=>EL,CLASS_PAPER:()=>lT,CLASS_PAPER_CANVAS:()=>hT,CLASS_PAPER_NODE:()=>V1,CLASS_PIE_CHART:()=>lD,CLASS_PIE_SLICE:()=>Pm,CLASS_PIE_SLICE_SELECTED:()=>aO,CLASS_PORT:()=>oS,CLASS_RESIZE_BORDER:()=>os,CLASS_RESIZE_BORDER_BOTTOM:()=>cC,CLASS_RESIZE_BORDER_LEFT:()=>uC,CLASS_RESIZE_BORDER_RIGHT:()=>pC,CLASS_RESIZE_BORDER_TOP:()=>dC,CLASS_RESIZE_FRAME:()=>hC,CLASS_RESIZE_HANDLE:()=>yt,CLASS_RESIZE_HANDLE_ACTIVE:()=>Wf,CLASS_RESIZE_HANDLE_B:()=>ey,CLASS_RESIZE_HANDLE_BL:()=>Jf,CLASS_RESIZE_HANDLE_BR:()=>qf,CLASS_RESIZE_HANDLE_L:()=>ty,CLASS_RESIZE_HANDLE_R:()=>ry,CLASS_RESIZE_HANDLE_T:()=>Qf,CLASS_RESIZE_HANDLE_TL:()=>Zf,CLASS_RESIZE_HANDLE_TR:()=>Kf,CLASS_RESIZE_SKELETON:()=>sC,CLASS_RESIZE_SKELETON_BORDERS:()=>aC,CLASS_RESIZE_SKELETON_BORDERS_VISIBLE:()=>lC,CLASS_ROTATE_HANDLE:()=>Ih,CLASS_ROTATE_LEADER:()=>Fp,CLASS_SANKEY_CHART:()=>dD,CLASS_SANKEY_EDGE:()=>Wy,CLASS_SANKEY_LABEL:()=>Jy,CLASS_SANKEY_NODE:()=>Zy,CLASS_SANKEY_SELECTED:()=>so,CLASS_SANKEY_UNSELECTED:()=>Qr,CLASS_SCATTER_CHART:()=>LP,CLASS_SCATTER_CHART_DATA_POINT:()=>wP,CLASS_SELECTED_MODE:()=>MV,CLASS_SELECT_DEFEAT:()=>ct,CLASS_SHAPE:()=>hh,CLASS_SHAPE_ICON:()=>ep,CLASS_SHAPE_LABEL:()=>ku,CLASS_SNAPLINE:()=>$p,CLASS_SNAPLINE_ACTIVE:()=>Jv,CLASS_SNAPLINE_ACTIVE_EXACT:()=>Kv,CLASS_SNAPLINE_EXACT:()=>Hf,CLASS_SNAPLINE_HORIZONTAL:()=>Zv,CLASS_SNAPLINE_VERTICAL:()=>Wv,CLASS_SOURCE_HOVER:()=>ff,CLASS_STRAIGHT_CONNECTOR_EDIT:()=>yy,CLASS_STRAIGHT_DELETE_HANDLE:()=>Qp,CLASS_STRAIGHT_DRAG_HANDLE:()=>hs,CLASS_STRAIGHT_EDITOR_GUIDELINE:()=>jC,CLASS_STRAIGHT_HANDLE:()=>Fh,CLASS_STRAIGHT_SPLIT_HANDLE:()=>qp,CLASS_SURFACE:()=>rf,CLASS_SURFACE_CANVAS:()=>of,CLASS_SURFACE_DIRECT:()=>bT,CLASS_SURFACE_EDGE_DRAGGING:()=>In,CLASS_SURFACE_ELEMENT_DRAGGING:()=>cf,CLASS_SURFACE_ELEMENT_FLASH:()=>lf,CLASS_SURFACE_NO_PAN:()=>nf,CLASS_SURFACE_PAN:()=>sf,CLASS_SURFACE_PANNING:()=>hf,CLASS_SURFACE_PAN_ACTIVE:()=>af,CLASS_SURFACE_PAN_BOTTOM:()=>k1,CLASS_SURFACE_PAN_LEFT:()=>X1,CLASS_SURFACE_PAN_RIGHT:()=>H1,CLASS_SURFACE_PAN_TOP:()=>j1,CLASS_SURFACE_POINTER_DEVICE:()=>ST,CLASS_SURFACE_TOUCH_DEVICE:()=>AT,CLASS_TARGET_HOVER:()=>yf,CLASS_TOGGLE_GROUP_COLLAPSE:()=>su,CLASS_TRANSIENT_VERTEX:()=>SL,CLASS_UI_SELECTED_CONNECTION:()=>Dl,CLASS_UI_SELECTED_ELEMENT:()=>Bi,CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE:()=>kf,CLASS_VERTEX_DRAWING_LASSO:()=>qv,CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE:()=>zp,CLASS_VJS_ANIMATE_EDGE_TRAVERSED:()=>dy,CLASS_VJS_ANIMATE_EDGE_TRAVERSING:()=>Vh,CLASS_VJS_ANIMATE_SOURCE:()=>hy,CLASS_VJS_ANIMATE_TARGET:()=>cy,CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE:()=>aG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSED:()=>lG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSING:()=>Fn,CLASS_VJS_TOOLTIP:()=>kw,CLEAR_PATH:()=>s0,CLEAR_VIEW_BOX:()=>o0,COLOR_PICKER_ELEMENT:()=>x0,COMMIT_CURRENT:()=>XO,COMPONENT_TYPE_CONNECTION:()=>wE,CONNECTION:()=>b1,CONNECTOR_TYPE_CUBIC_BEZIER:()=>Oo,CONNECTOR_TYPE_ORTHOGONAL:()=>ks,CONNECTOR_TYPE_QUADRATIC_BEZIER:()=>Xd,CONNECTOR_TYPE_SMOOTH:()=>NA,CONNECTOR_TYPE_STRAIGHT:()=>_n,CONNECT_REASON_API:()=>rl,CONNECT_REASON_COPY_PASTE:()=>Sx,CONNECT_REASON_DATA_LOAD:()=>nl,CONNECT_REASON_TRANSIENT:()=>Ax,CONNECT_REASON_UNDO_REDO:()=>bx,CONNECT_REASON_USER_ACTIVITY:()=>co,CONTAINMENT_NOT_NEGATIVE:()=>Q0,CONTAINMENT_PARENT:()=>ew,CONTAINMENT_PARENT_ENCLOSED:()=>tw,CONTENT_TYPES:()=>ba,CSV:()=>vN,CandidateSorter:()=>zc,CanvasLayoutAdapter:()=>tp,CatchAllEventHandler:()=>qc,CategoryValueChart:()=>Xn,CategoryValueTooltip:()=>Fa,CategoryVsAxisPlot:()=>oo,ChartExporter:()=>gm,ChartLegend:()=>pm,ChartSeries:()=>Sr,CircularLayout:()=>Cc,ClickSplitMode:()=>em,Clipboard:()=>Id,Cluster:()=>mc,CollationSeries:()=>Ma,Collicat:()=>tm,ColumnChart:()=>tO,ColumnLayout:()=>ol,CommentEntry:()=>Fs,Components:()=>we,CompoundAction:()=>An,Connections:()=>kt,Connectors:()=>Ne,ControlsComponent:()=>Sp,ControlsPlugin:()=>wh,CopyData:()=>Nd,CopyPasteControlsComponent:()=>wv,CrossingStage:()=>vs,CsvReader:()=>wg,CustomOverlay:()=>Fl,CustomTag:()=>vd,DEFAULT:()=>xe,DEFAULT_ANCHOR_PLACEHOLDER_SIZE:()=>hv,DEFAULT_ARRAY_SERIES_ID_FIELD:()=>jw,DEFAULT_ARRAY_SERIES_LABEL_FIELD:()=>Xw,DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD:()=>zw,DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD:()=>Yw,DEFAULT_ARRAY_SERIES_RANGE_START_FIELD:()=>Fw,DEFAULT_ARRAY_SERIES_STEP:()=>Bw,DEFAULT_ARRAY_SERIES_VALUES_FIELD:()=>Uw,DEFAULT_AXIS_LINE_SIZE:()=>gi,DEFAULT_BACKGROUND_COLOR:()=>Iw,DEFAULT_BAR_GAP:()=>tD,DEFAULT_BEZIER_CONTROL_POINT_SCALE:()=>xA,DEFAULT_BEZIER_LOOPBACK_DISTANCE:()=>A_,DEFAULT_BORDER_HANDLE_SIZE:()=>tC,DEFAULT_CATEGORY_AXIS_FONT_SIZE:()=>ZP,DEFAULT_CATEGORY_AXIS_FONT_STYLE:()=>JP,DEFAULT_CATEGORY_FILL_RATIO:()=>Qw,DEFAULT_CHART_EMPTY_MESSAGE:()=>zP,DEFAULT_CHART_ERROR_MESSAGE:()=>XP,DEFAULT_COLOR:()=>ZT,DEFAULT_COLOR_PROPERTY:()=>vf,DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE:()=>lv,DEFAULT_CORNER_RADIUS:()=>Am,DEFAULT_DIAGRAM_CELL_HEIGHT:()=>LC,DEFAULT_DIAGRAM_CELL_WIDTH:()=>RC,DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE:()=>N0,DEFAULT_DOT_OVERLAY_RADIUS:()=>bR,DEFAULT_DOWNLOAD_BUTTON_LABEL:()=>Op,DEFAULT_EDGE_NODE_SIZE:()=>dg,DEFAULT_ELLIPSE_OVERLAY_RADIUS_X:()=>TR,DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y:()=>vR,DEFAULT_EXPORT_FILENAME:()=>Pp,DEFAULT_FILL_COLOR:()=>mh,DEFAULT_FILL_PROPERTY:()=>Tf,DEFAULT_FLOWCHART_ARROW_LENGTH:()=>nw,DEFAULT_FLOWCHART_ARROW_WIDTH:()=>rw,DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE:()=>ow,DEFAULT_FLOWCHART_PROPERTY_MARKERS:()=>iw,DEFAULT_GRID:()=>_L,DEFAULT_GRID_LINE_COLOR:()=>jP,DEFAULT_HANDLE_OFFSET:()=>iC,DEFAULT_HEIGHT_ATTRIBUTE:()=>Ix,DEFAULT_HIERARCHICAL_LAYOUT_ALIGN:()=>Vx,DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT:()=>Bx,DEFAULT_HIERARCHICAL_LAYOUT_PADDING:()=>Gx,DEFAULT_HIERARCHICAL_LAYOUT_SPACING:()=>$x,DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT:()=>Nc,DEFAULT_KEY_ALLOW_NESTED_GROUPS:()=>xE,DEFAULT_KEY_ANCHOR:()=>Nl,DEFAULT_KEY_ANCHORS:()=>Il,DEFAULT_KEY_ASTAR_GRID_CELL_SIZE:()=>XI,DEFAULT_KEY_ASTAR_VERTEX_BORDER:()=>aS,DEFAULT_KEY_ASTAR_VERTEX_BUFFER:()=>lS,DEFAULT_KEY_CONNECTOR:()=>lu,DEFAULT_KEY_CSS_CLASS:()=>hS,DEFAULT_KEY_EDGES_DETACHABLE:()=>HI,DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE:()=>cS,DEFAULT_KEY_ENSURE_ANCHORS_IN_WHITESPACE:()=>kI,DEFAULT_KEY_GROUP_SIZE:()=>WI,DEFAULT_KEY_HOVER_CLASS:()=>dS,DEFAULT_KEY_HOVER_PAINT_STYLE:()=>hu,DEFAULT_KEY_MAX_CONNECTIONS:()=>uS,DEFAULT_KEY_NODE_SIZE:()=>ZI,DEFAULT_KEY_OVERLAYS:()=>jI,DEFAULT_KEY_PAINT_STYLE:()=>$o,DEFAULT_KEY_REATTACH_EDGES:()=>JI,DEFAULT_KEY_SCOPE:()=>bE,DEFAULT_LABEL_FILL_RATIO:()=>nL,DEFAULT_LABEL_LOCATION:()=>yR,DEFAULT_LABEL_LOCATION_ATTRIBUTE:()=>vE,DEFAULT_LABEL_PROPERTY:()=>ki,DEFAULT_LEFT_ATTRIBUTE:()=>Lx,DEFAULT_LEGEND_BACKGROUND_COLOR:()=>$w,DEFAULT_LEGEND_OUTLINE_WIDTH:()=>Gw,DEFAULT_LEGEND_PADDING:()=>Lw,DEFAULT_LINE_STROKE:()=>vh,DEFAULT_MARGIN:()=>Mw,DEFAULT_MAXIMUM_BAR_WIDTH:()=>eD,DEFAULT_MINIMUM_HEIGHT:()=>nC,DEFAULT_MINIMUM_WIDTH:()=>rC,DEFAULT_ORTHOGONAL_STUB:()=>IA,DEFAULT_OUTLINE_COLOR:()=>Jo,DEFAULT_OUTLINE_PROPERTY:()=>uh,DEFAULT_OUTLINE_WIDTH:()=>gh,DEFAULT_OUTLINE_WIDTH_PROPERTY:()=>ph,DEFAULT_PALETTE_SELECTOR:()=>O0,DEFAULT_PAPER_MARGIN:()=>cT,DEFAULT_RECTANGLE_OVERLAY_HEIGHT:()=>SR,DEFAULT_RECTANGLE_OVERLAY_WIDTH:()=>AR,DEFAULT_ROTATE_HANDLE_SIZE:()=>eC,DEFAULT_ROTATE_LEADER_LENGTH:()=>Qv,DEFAULT_ROTATION_ATTRIBUTE:()=>Dx,DEFAULT_SET_DESCRIPTION:()=>K1,DEFAULT_SET_NAME:()=>J1,DEFAULT_SHAPE_SETS:()=>wC,DEFAULT_SMOOTHING:()=>U_,DEFAULT_SVG_HANDLE_SIZE:()=>Bp,DEFAULT_TICK_LINE_STROKE:()=>xv,DEFAULT_TICK_MARKS_PER_CELL:()=>RL,DEFAULT_TITLE_PADDING:()=>Uy,DEFAULT_TOP_ATTRIBUTE:()=>wx,DEFAULT_VALUE_AXIS_FONT_SIZE:()=>Sm,DEFAULT_VALUE_AXIS_FONT_STYLE:()=>Tm,DEFAULT_VALUE_AXIS_PADDING:()=>WP,DEFAULT_WIDTH_ATTRIBUTE:()=>Nx,DEFAULT_ZOOM_RANGE:()=>pS,DIAGONAL_AXIS_LR:()=>yn,DIAGONAL_AXIS_RL:()=>kn,DRAG_GROUP_MEMBERSHIP_ADDED:()=>_a,DRAG_GROUP_MEMBERSHIP_ASSIGNED:()=>kv,DataModel:()=>Tc,DataSeriesBasedDataSource:()=>Em,Decorator:()=>lp,Decorators:()=>hp,DefaultRouter:()=>$l,DefaultSearchTokenizer:()=>qO,Diagram:()=>Wp,DiagramCell:()=>Un,DiagramExportComponent:()=>VC,DiagramLink:()=>ci,DiagramPalette:()=>Bh,DiagramToolsPlugin:()=>ls,DialogConstants:()=>Ae,DiamondOverlay:()=>Ou,DotOverlay:()=>_u,Drag:()=>Sy,DragGroupsPlugin:()=>rs,DualValueAxisTooltip:()=>vm,DualValueChart:()=>ja,DualValueChartSeries:()=>Xa,EDGE:()=>vr,EDGE_DRAG_HANDLE:()=>Gn,EDGE_INPUT_METHOD_CLICK:()=>Sh,EDGE_INPUT_METHOD_DRAG:()=>Zi,EDGE_INPUT_STATE_IDLE:()=>Th,EDGE_INPUT_STATE_LOCKED:()=>Of,EDGE_ROUTING_PLUGIN_MODE_DIRECT:()=>bv,EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL:()=>IV,EDGE_SNAP_CENTER:()=>TV,EDGE_SNAP_DEFAULT:()=>tv,EDGE_SNAP_PERIMETER:()=>yL,EDGE_TYPE_PICKER_ELEMENT:()=>T0,EDGE_UPDATE_REASON_UPDATED:()=>Fb,ELEMENT:()=>x1,ELEMENT_CIRCLE:()=>ze,ELEMENT_DEFS:()=>VS,ELEMENT_DIV:()=>He,ELEMENT_ELLIPSE:()=>GS,ELEMENT_G:()=>q,ELEMENT_INCLUDE_ICON:()=>tL,ELEMENT_INCLUDE_ICONS:()=>rL,ELEMENT_PATH:()=>te,ELEMENT_RECT:()=>Z,ELEMENT_SVG:()=>ve,ELEMENT_TEXT:()=>Je,ELEMENT_TSPAN:()=>NE,EMPTY_ASTAR_PATH:()=>gg,EMPTY_BOUNDS:()=>xi,EMPTY_ELEMENT:()=>H_,ENDPOINT:()=>y1,EVENT_ADHOC_LAYOUT:()=>ab,EVENT_AFTER_LAYOUT_REFRESH:()=>Ms,EVENT_BEFORE_START:()=>rP,EVENT_CANVAS_CLICK:()=>xo,EVENT_CANVAS_DBLCLICK:()=>Rb,EVENT_CHANGE:()=>Dp,EVENT_CHART_LOAD:()=>mm,EVENT_CLICK:()=>Ue,EVENT_CONTEXTMENU:()=>gt,EVENT_CONTEXT_UPDATE:()=>ul,EVENT_DATA_APPEND_END:()=>xg,EVENT_DATA_APPEND_START:()=>yg,EVENT_DATA_LOAD_END:()=>Mr,EVENT_DATA_LOAD_START:()=>Eo,EVENT_DATA_UPDATED:()=>bg,EVENT_DBLCLICK:()=>yo,EVENT_DBLTAP:()=>Fr,EVENT_DESELECT:()=>pr,EVENT_DESTROY:()=>Oi,EVENT_DRAG:()=>nP,EVENT_DROP:()=>J0,EVENT_EDGE_ADDED:()=>dr,EVENT_EDGE_CLICK:()=>Tb,EVENT_EDGE_CONTEXTMENU:()=>Ob,EVENT_EDGE_DBLCLICK:()=>vb,EVENT_EDGE_DBLTAP:()=>Cb,EVENT_EDGE_GEOMETRY:()=>Zn,EVENT_EDGE_MOUSEDOWN:()=>ml,EVENT_EDGE_MOUSEOUT:()=>gd,EVENT_EDGE_MOUSEOVER:()=>Ed,EVENT_EDGE_MOUSEUP:()=>Pb,EVENT_EDGE_PATH_EDITED:()=>Jn,EVENT_EDGE_REDRAW:()=>fd,EVENT_EDGE_REMOVED:()=>mt,EVENT_EDGE_SOURCE_CHANGED:()=>nn,EVENT_EDGE_TAP:()=>_b,EVENT_EDGE_TARGET_CHANGED:()=>rn,EVENT_EDGE_TYPE_CHANGED:()=>Xc,EVENT_EDGE_UPDATED:()=>pt,EVENT_ELASTIC_GROUP_FRAME_REMOVE:()=>Gf,EVENT_ELASTIC_GROUP_FRAME_RESIZE:()=>Vf,EVENT_END_NODE_TRAVERSAL:()=>xC,EVENT_END_OVERLAY_ANIMATION:()=>qi,EVENT_FOCUS:()=>cb,EVENT_GRAPH_CHANGED:()=>Wx,EVENT_GRAPH_CLEARED:()=>jt,EVENT_GRAPH_CLEAR_START:()=>bn,EVENT_GROUP_ADDED:()=>Xt,EVENT_GROUP_COLLAPSE:()=>cd,EVENT_GROUP_EXPAND:()=>dd,EVENT_GROUP_MEMBER_ADDED:()=>Pi,EVENT_GROUP_MEMBER_REMOVED:()=>_s,EVENT_GROUP_MOVE:()=>Wc,EVENT_GROUP_MOVE_END:()=>Gr,EVENT_GROUP_MOVE_START:()=>Zx,EVENT_GROUP_RELAYOUT:()=>pl,EVENT_GROUP_REMOVED:()=>Me,EVENT_GROUP_RENDERED:()=>$r,EVENT_GROUP_TYPE_CHANGED:()=>kc,EVENT_GROUP_UPDATED:()=>Re,EVENT_INTERNAL_CONNECTION:()=>sb,EVENT_INTERNAL_GROUP_SIZE_CHANGED:()=>Zc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO:()=>Jc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO:()=>Kc,EVENT_INTERNAL_VERTEX_UPDATED:()=>Vs,EVENT_KEYUP:()=>Mn,EVENT_LASSO_END:()=>Lb,EVENT_MOUSEDOWN:()=>ue,EVENT_MOUSEENTER:()=>Og,EVENT_MOUSEEXIT:()=>_g,EVENT_MOUSELEAVE:()=>db,EVENT_MOUSEMOVE:()=>ie,EVENT_MOUSEOUT:()=>et,EVENT_MOUSEOVER:()=>tt,EVENT_MOUSEUP:()=>oe,EVENT_NODE_ADDED:()=>Ht,EVENT_NODE_MOVE:()=>nr,EVENT_NODE_MOVE_END:()=>Lt,EVENT_NODE_MOVE_START:()=>Rs,EVENT_NODE_REMOVED:()=>Le,EVENT_NODE_RENDERED:()=>Br,EVENT_NODE_TYPE_CHANGED:()=>jc,EVENT_NODE_UPDATED:()=>Ve,EVENT_NODE_VISIBILITY:()=>pd,EVENT_OBJECT_REPAINTED:()=>hb,EVENT_OUT:()=>q0,EVENT_OVER:()=>K0,EVENT_PAN:()=>gl,EVENT_PLUGIN_ADDED:()=>md,EVENT_PLUGIN_REMOVED:()=>lb,EVENT_PORT_ADDED:()=>Wn,EVENT_PORT_REMOVED:()=>Vr,EVENT_PORT_TYPE_CHANGED:()=>Hc,EVENT_PORT_UPDATED:()=>cr,EVENT_REDO:()=>qx,EVENT_RELAYOUT:()=>Tn,EVENT_RENDERER_ADDED:()=>Jx,EVENT_RENDER_END:()=>Sn,EVENT_RENDER_START:()=>ud,EVENT_SELECT:()=>ur,EVENT_SELECTION_CLEARED:()=>Cr,EVENT_START:()=>tP,EVENT_START_NODE_TRAVERSAL:()=>ly,EVENT_START_OVERLAY_ANIMATION:()=>Mh,EVENT_STATE:()=>Yp,EVENT_STOP:()=>iP,EVENT_SURFACE_MODE_CHANGED:()=>vn,EVENT_TAP:()=>W,EVENT_TOUCHEND:()=>pb,EVENT_TOUCHMOVE:()=>mb,EVENT_TOUCHSTART:()=>ub,EVENT_UNDO:()=>Kx,EVENT_UNDOREDO_UPDATE:()=>Ls,EVENT_VERTEX_CLICK:()=>gb,EVENT_VERTEX_CONTEXTMENU:()=>Ab,EVENT_VERTEX_DBLCLICK:()=>Eb,EVENT_VERTEX_DBLTAP:()=>fb,EVENT_VERTEX_MOUSEDOWN:()=>fN,EVENT_VERTEX_MOUSEMOVE:()=>bb,EVENT_VERTEX_MOUSEOUT:()=>yb,EVENT_VERTEX_MOUSEOVER:()=>xb,EVENT_VERTEX_MOUSEUP:()=>EN,EVENT_VERTEX_TAP:()=>Sb,EVENT_ZOOM:()=>fo,EachEntry:()=>Td,Edge:()=>Fe,EdgeGeometryTransformer:()=>np,EdgeHandlerBase:()=>ua,EdgeInputHandler:()=>pp,EdgePathEditor:()=>ma,EdgeRelocateHandler:()=>mp,EdgeRoutingPlugin:()=>Oh,EdgeRoutingStage:()=>Mc,EdgeTypePicker:()=>Mp,EditorBase:()=>Ji,ElasticGroupManager:()=>ya,ElementCluster:()=>hg,ElementDragHandler2:()=>Zp,ElementDragger:()=>aP,ElementEntry:()=>Ur,ElementTypes:()=>Vi,Elements:()=>Qn,EllipseOverlay:()=>Lu,EmptyLayout:()=>As,EmptyRedrawResult:()=>pu,EventGenerator:()=>Km,EventManager:()=>fe,ExportControlsPlugin:()=>Gp,FACE_BOTTOM:()=>Ct,FACE_LEFT:()=>Tt,FACE_RIGHT:()=>vt,FACE_TOP:()=>Et,FALSE:()=>at,FILL:()=>IS,FIXED:()=>mE,FLOWCHART_EDGE_TYPE_BOTH_ARROWS:()=>lw,FLOWCHART_EDGE_TYPE_DASHED:()=>cw,FLOWCHART_EDGE_TYPE_PLAIN:()=>hw,FLOWCHART_EDGE_TYPE_SOURCE_ARROW:()=>sw,FLOWCHART_EDGE_TYPE_TARGET_ARROW:()=>aw,FLOWCHART_SHAPES:()=>cV,FixedLayer:()=>ap,FlowchartBasicEdgeMappings:()=>i$,ForceDirectedLayout:()=>_c,GRID_TYPE_DOTTED:()=>LV,GRID_TYPE_LINES:()=>wV,GROUP_RELAYOUT_ADHOC:()=>wb,GROUP_RELAYOUT_EXISTING_VERTEX_ADDED:()=>Nb,GROUP_RELAYOUT_MEMBER_REMOVED:()=>xN,GROUP_RELAYOUT_NEW_VERTEX_ADDED:()=>Db,GaugeChart:()=>oO,GeneratedGridBackground:()=>Ea,Graph:()=>tl,GridLayout:()=>po,GridProfile:()=>Bl,GridTypes:()=>OL,Group:()=>le,GroupCollapseAction:()=>ld,GroupExpandAction:()=>hd,GroupLayoutAdapter:()=>rp,GroupRemoveAction:()=>td,GroupSizeChangedAction:()=>cl,H:()=>Cx,HEIGHT:()=>De,HIERARCHICAL_JSON_DATATYPE:()=>Zm,HTMLElementOverlay:()=>ql,HeadlessRecado:()=>Hg,HierarchicalLayout:()=>wc,HierarchicalParentRelativePlacementStrategy:()=>Lc,HierarchyLayout:()=>go,HierarchyLayoutModel:()=>Vc,HierarchyLayoutStage:()=>Ts,HilbertCurves:()=>Us,ICONS_ORIENTATION_HORIZONTAL:()=>WT,ICONS_ORIENTATION_VERTICAL:()=>aV,ICON_CIRCLE:()=>UT,ICON_CLONE:()=>Zu,ICON_CROSS:()=>BT,ICON_GEAR:()=>YT,ICON_LINK:()=>Wu,ICON_ORIGIN_CENTER:()=>ah,ICON_ORIGIN_END:()=>lh,ICON_ORIGIN_START:()=>sh,ICON_PLUS:()=>FT,ICON_TRASH:()=>Ju,INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS:()=>v0,INSPECTOR_CONTEXT_RECENT_COLORS:()=>Lh,IconElement:()=>Af,IfEntry:()=>Pd,ImageExportUI:()=>Rh,InBrowserTemplateResolver:()=>bf,Index:()=>kb,Inspector:()=>Np,JSON_DATATYPE:()=>zt,KEY_OVERLAYS:()=>zI,LASSO_PATH:()=>qL,LASSO_VIEW_BOX:()=>KL,LAYOUT_TYPE_ABSOLUTE:()=>RO,LAYOUT_TYPE_COLUMN:()=>ig,LAYOUT_TYPE_GRID:()=>ng,LAYOUT_TYPE_HIERARCHICAL:()=>MO,LAYOUT_TYPE_HIERARCHY:()=>Ux,LAYOUT_TYPE_ROW:()=>og,LEFT:()=>Ye,LEGEND_ALIGN_CENTER:()=>$y,LEGEND_ALIGN_LEFT:()=>Gy,LEGEND_ALIGN_RIGHT:()=>YP,LEGEND_ORIENTATION_HORIZONTAL:()=>Vy,LEGEND_ORIENTATION_VERTICAL:()=>G$,LEGEND_VERTICAL_ALIGN_BOTTOM:()=>By,LEGEND_VERTICAL_ALIGN_MIDDLE:()=>tc,LEGEND_VERTICAL_ALIGN_TOP:()=>ec,LINE_WIDTH:()=>$M,LOCATION_ATTRIBUTE:()=>iR,LabelOverlay:()=>ir,Lasso:()=>ga,LassoPlugin:()=>$n,Layouts:()=>qe,LineChart:()=>sO,LinePlot:()=>hc,MagnetizeProfile:()=>Tu,Magnetizer:()=>Ti,MiniviewPlugin:()=>Bn,ModelSeriesBasedDataSource:()=>ic,MoveAction:()=>Ns,NEGATIVE:()=>_x,NOMINAL_SIZE:()=>Rn,NONE:()=>ht,Node:()=>de,NodeGroupAction:()=>ed,OBJECT_TYPE_ANCHOR:()=>qg,OPPOSITE_FACES:()=>QN,ORIENTATION_OPPOSITE:()=>aE,ORIENTATION_ORTHOGONAL:()=>sE,ORIENTATION_PERPENDICULAR:()=>oE,ORTHOGONAL_AXIS_HORIZONTAL:()=>ne,ORTHOGONAL_AXIS_VERTICAL:()=>he,ORTHOGONAL_FACES:()=>qN,ORTHOGONAL_ROUTER_MODE_BUS:()=>ZN,ORTHOGONAL_ROUTER_MODE_SEPARATE:()=>wd,OVERLAY_VISIBILITY_ALWAYS:()=>cu,OVERLAY_VISIBILITY_HOVER:()=>Fi,OptimisticEventGenerator:()=>It,OrthogonalEditor:()=>eo,Overlay:()=>ni,OverlayFactory:()=>nt,PALETTE_MODE_DRAG:()=>zf,PALETTE_MODE_DRAW:()=>Xf,PALETTE_MODE_TAP:()=>Hv,PAN_PATH:()=>r0,PAN_VIEW_BOX:()=>t0,PAPER_ALIGN_CENTER:()=>Xo,PAPER_ALIGN_END:()=>Kl,PAPER_ALIGN_START:()=>Jl,PATH_CONSTRAIN_DIAGONAL:()=>Oc,PATH_CONSTRAIN_MANHATTAN:()=>Px,PATH_CONSTRAIN_METRO:()=>Ox,PATH_CONSTRAIN_NONE:()=>en,PATH_CONSTRAIN_ORTHOGONAL:()=>tn,PLACEHOLDER_KEY:()=>bl,PLACEHOLDER_VALUE:()=>Ao,POSITION_RELATIVE:()=>qA,PROPERTY_POSITION:()=>KE,PX:()=>jr,Palette:()=>Ta,PalettePlugin:()=>Dh,PanButtonsPlugin:()=>is,PanZoom:()=>da,Paper:()=>zh,ParentRelativePlacementStrategy:()=>$c,PathImpl:()=>il,PathTransport:()=>Up,PathTransportState:()=>yC,PerimeterAnchorShapes:()=>x_,PieChart:()=>lO,PinchListener:()=>sp,PlacementStage:()=>Bc,PlainArrowOverlay:()=>Pu,Port:()=>pe,PortAction:()=>nd,PortAddAction:()=>id,PortRemoveAction:()=>od,PriorityQueue:()=>Es,PropertyMapper:()=>wu,PropertyTracker:()=>Su,QuadraticBezierEditor:()=>ro,REMOVE_CLASS_ACTION:()=>OM,RESET_SELECTION_PATH:()=>i0,RESET_SELECTION_VIEW_BOX:()=>n0,RESIZING_TOOLS_RESIZE_METHOD_BORDERS:()=>oC,RESIZING_TOOLS_RESIZE_METHOD_HANDLES:()=>Nh,RIGHT:()=>ut,ROLLBACK_CURRENT:()=>jO,ROOT_SHAPE_SET:()=>Wi,ROTATION:()=>JD,ROW:()=>vi,RTREE_DEFAULT_MAX_CHILD_ENTRIES:()=>dA,RTree:()=>Ys,RandomColorGenerator:()=>Cs,Recado:()=>To,RecadoTemplateRenderer:()=>op,RecordBasedSeries:()=>Qt,RectangleOverlay:()=>Ru,RemoveGroupMemberAction:()=>ad,ResizingToolsPlugin:()=>as,RowLayout:()=>sl,SEGMENT_TYPE_ARC:()=>Cl,SEGMENT_TYPE_BEZIER:()=>Po,SEGMENT_TYPE_STRAIGHT:()=>On,SELECTION_MODE_EDGES_ONLY:()=>rb,SELECTION_MODE_GROUPS_ONLY:()=>tb,SELECTION_MODE_ISOLATED:()=>Qc,SELECTION_MODE_MIXED:()=>Qx,SELECTION_MODE_NODES_ONLY:()=>eb,SELECTOR_CONNECTOR:()=>Zr,SELECTOR_GROUP:()=>A1,SELECTOR_GROUP_CONTAINER:()=>WS,SELECTOR_MANAGED_ELEMENT:()=>Xl,SELECTOR_OVERLAY:()=>Dn,SELECTOR_TOGGLE_GROUP_COLLAPSE:()=>ZS,SOURCE:()=>Qe,SOURCE_INDEX:()=>UI,STATIC:()=>KA,STRAIGHT_CONNECTOR_AUTO_SPLIT:()=>$G,STRAIGHT_CONNECTOR_CLICK_SPLIT:()=>HC,STROKE:()=>DE,STROKE_WIDTH:()=>MS,SURFACE_MODE_DISABLED:()=>qo,SURFACE_MODE_PAN:()=>xr,SURFACE_MODE_SELECT:()=>li,SURFACE_MODE_VERTEX_DRAWING:()=>Vn,SVGElementOverlay:()=>Fu,SVG_NAMESPACE:()=>Wt,SankeyChart:()=>uO,ScatterChart:()=>pO,Segments:()=>gr,SelectedEdgeHighlightPlugin:()=>fa,SeriesBasedChart:()=>Ga,ShapeLibraryDefaults:()=>Hu,ShapeLibraryImpl:()=>ia,ShapePalette:()=>kp,ShapeTypeInspector:()=>jv,SimpleBackground:()=>fp,SimpleShapeOverlay:()=>Ln,SingleColorGenerator:()=>Uc,SnaplinesPlugin:()=>ns,SourceValueTargetCsvParser:()=>jb,StaticColorGenerator:()=>Yx,Storage:()=>sP,StraightEditor:()=>to,StraightSegmentHandler:()=>Ro,SummingSeries:()=>Va,Surface:()=>Yh,SurfaceAnimator:()=>Xp,SvgComponent:()=>Uu,SvgExportComponent:()=>Sa,SvgExportUI:()=>Rp,SyntheticDecorator:()=>xh,TAG_SHAPE:()=>$T,TARGET:()=>xn,TARGET_INDEX:()=>YI,TILING_STRATEGY_ABSOLUTE:()=>fv,TILING_STRATEGY_LOGARITHMIC:()=>Ev,TOP:()=>Se,TRUE:()=>At,TWO_PI:()=>fi,TYPE_ATTRIBUTE:()=>Qb,TYPE_EACH:()=>qn,TYPE_ELEMENT:()=>Kn,TYPE_IF:()=>xl,TYPE_ITEM_ANCHORS:()=>Eu,TYPE_ITEM_CONNECTOR:()=>RE,TYPE_ITEM_OVERLAY:()=>yS,TYPE_JPG:()=>ts,TYPE_PNG:()=>_h,TYPE_ROOT:()=>Jb,TYPE_SVG:()=>Uf,TYPE_TEXT:()=>Li,TYPE_TMPL:()=>bo,TerminusAddAction:()=>hl,TerminusRemoveAction:()=>ll,TestHarness:()=>sm,TextEntry:()=>Ni,TiledBackground:()=>yp,TmplEntry:()=>So,Tooltip:()=>$a,TooltipRenderer:()=>Ba,UICore:()=>Cu,UIModel:()=>uu,UIPlugins:()=>or,UIState:()=>bp,UNDEFINED:()=>Rx,UiStatesBrowserUIModel:()=>If,UiStatesPlugin:()=>Ph,UndoRedoManager:()=>yd,UpdateAction:()=>Ri,UrlSeriesBasedDataSource:()=>fm,V:()=>Pc,VERTEX:()=>mo,VERTEX_DRAWING_PATH:()=>e0,VERTEX_DRAWING_VIEW_BOX:()=>QL,VERTEX_UPDATE_REASON_ADD_NEW_PORT:()=>WO,VERTEX_UPDATE_REASON_ADD_PORT:()=>kO,VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE:()=>fl,VERTEX_UPDATE_REASON_GROUP_RESIZED:()=>Ub,VERTEX_UPDATE_REASON_LAYOUT:()=>SN,VERTEX_UPDATE_REASON_MAGNETIZER:()=>Yb,VERTEX_UPDATE_REASON_MOVED:()=>Bs,VERTEX_UPDATE_REASON_REMOVE_PORT:()=>ZO,VERTEX_UPDATE_REASON_RESIZED:()=>Xb,VERTEX_UPDATE_REASON_ROTATION:()=>Gs,VERTEX_UPDATE_REASON_SET_POSITION:()=>Ad,VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT:()=>TN,VERTEX_UPDATE_REASON_SNAP_TO_GRID:()=>zb,VERTEX_UPDATE_REASON_UPDATE_GROUP:()=>Bb,VERTEX_UPDATE_REASON_UPDATE_NODE:()=>$b,VERTEX_UPDATE_REASON_UPDATE_PORT:()=>xd,VERTEX_UPDATE_REASON_UPDATE_VERTEX:()=>Lg,VanillaInspector:()=>Vp,Vertex:()=>Ac,VertexDrawingPlugin:()=>hi,VertexSet:()=>Fc,Viewport:()=>mu,VisuallyJsModel:()=>bd,VisuallyJsRendererVertexRemovedAction:()=>dl,VisuallyJsSelection:()=>mr,VisuallyJsTestSupport:()=>ui,VjsContext:()=>Qd,WIDTH:()=>Te,WILDCARD:()=>Er,WhitespaceReplacingTokenizer:()=>ON,X:()=>Q,XHTML_NAMESPACE:()=>KM,XLINK_NAMESPACE:()=>JM,XYChart:()=>Ua,XYPlot:()=>zy,X_AXIS_FACES:()=>JN,Y:()=>Ee,Y_AXIS_FACES:()=>KN,ZOOM_IN_OUT_VIEW_BOX:()=>Iv,ZOOM_IN_PATH:()=>a0,ZOOM_OUT_PATH:()=>l0,ZOOM_TO_FIT_PATH:()=>JL,ZOOM_TO_FIT_VIEW_BOX:()=>ZL,_addBinding:()=>Ig,_addConnectorSegment:()=>zr,_adjustForGap:()=>NS,_applyStyles:()=>WE,_areaIfGrownBy:()=>uA,_bindOneAtt:()=>eA,_calculateSteps:()=>Ny,_clearConnectorSegments:()=>rE,_computeConnector:()=>bI,_computeSingleLocation:()=>yu,_connectorBoundingBoxIntersection:()=>wA,_connectorBoxIntersection:()=>SI,_connectorGradientAtPoint:()=>xI,_connectorLineIntersection:()=>AI,_connectorPointAlongPathFrom:()=>rt,_connectorPointOnPath:()=>Xr,_createAnchor:()=>_E,_createBaseSegment:()=>Xs,_createConnectorBase:()=>Vd,_createContinuousAnchor:()=>ES,_createCubicBezierConnector:()=>D_,_createQuadraticBezierConnector:()=>N_,_createSegment:()=>gA,_defaultGroupHtmlTemplate:()=>oL,_defaultGroupSvgTemplate:()=>aL,_defaultNodeHtmlTemplate:()=>la,_defaultNodeSvgTemplate:()=>ha,_defaultPortHtmlTemplate:()=>iL,_defaultPortSvgTemplate:()=>sL,_defaultSegmentBoundingBoxIntersection:()=>yA,_defaultSegmentBoxIntersection:()=>Sl,_defaultSegmentFindClosestPointOnPath:()=>EA,_defaultSegmentLineIntersection:()=>fA,_emptyRTreeRegion:()=>vo,_findAnchorOrientation:()=>up,_findConnectorSegmentForLocation:()=>tE,_findConnectorSegmentForPoint:()=>LA,_findIdealSteps:()=>_w,_findNextHorizontalSegment:()=>MA,_findNextSegmentOfType:()=>jd,_findNextVerticalSegment:()=>GA,_findPreviousHorizontalSegment:()=>VA,_findPreviousVerticalSegment:()=>$A,_findSourceZones:()=>vV,_findTargetZones:()=>bL,_findZones:()=>rv,_getCurrentAnchorLocation:()=>RS,_getDefaultTemplate:()=>KT,_getLabelOverlay:()=>lR,_getSegmentLength:()=>Qg,_getVertexInfo:()=>cp,_growToFit:()=>Wg,_hasLeafNodes:()=>pA,_hideOverlays:()=>sR,_initialiseDecorators:()=>ev,_internalLabelOverlayClass:()=>AS,_internalLabelOverlayId:()=>Qs,_internalSourceMarkerOverlayId:()=>uM,_internalTargetMarkerOverlayId:()=>pM,_isContinuousAnchor:()=>Uo,_isFaceAvailable:()=>Ml,_isLeaf:()=>Dd,_mapToSpline:()=>dE,_padAnchorPoint:()=>wM,_padPoint:()=>PS,_padPointForFace:()=>RM,_padPointForFace2:()=>LM,_placeAnchorsOnLine:()=>_S,_populateSourceZones:()=>iv,_populateTargetZones:()=>Ah,_populateZones:()=>nv,_prepareCompute:()=>iE,_registerSegmentHandler:()=>zs,_removeAllOverlays:()=>yM,_removeOverlay:()=>Ui,_removeOverlays:()=>xM,_removeShortSegments:()=>Y_,_removeTypeCssHelper:()=>vS,_resetConnectorBounds:()=>RA,_resetConnectorGeometry:()=>Mi,_setAnchorLocation:()=>eE,_setConnectionLabel:()=>bM,_setOrthogonalAnchorOrientation:()=>FI,_setOrthogonalSegmentPosition:()=>ZA,_showOverlay:()=>fM,_showOverlays:()=>aR,_trimOrthogonalConnector:()=>JA,_trimOrthogonalSegments:()=>pE,_trimSegments:()=>uE,_updateConnectorBounds:()=>R_,_updateConnectorSegmentProportions:()=>nE,_updateHoverStyle:()=>fu,_updateRTreeRegionBounds:()=>Zg,_writeSegmentedConnectorSegments:()=>Zd,aSegmentDirections:()=>_o,add:()=>yi,addClass:()=>L,addConnectionClass:()=>Wr,addEntryToEachExecution:()=>Fg,addNewExecutionToEachExecution:()=>sA,addSegment:()=>vl,addToDictionary:()=>lx,addToList:()=>LD,addWheelListener:()=>Wl,addWithFunction:()=>RD,addXYPlotType:()=>Ya,ajax:()=>na,anchorPlacementEquals:()=>lE,apply:()=>$v,applyConnectionType:()=>SS,applyDomainOverrides:()=>Jw,applyRotations:()=>px,applyRotationsXY:()=>mx,areVerticesConnected:()=>xx,arraysEqual:()=>vO,astarFromViewport:()=>DS,att:()=>be,attWithValue:()=>qr,attachDiagramPalette:()=>EG,attemptCoerce:()=>Lp,base64Encode:()=>h0,base64EncodeSvgElement:()=>c0,bezierLineIntersection:()=>Pn,bindDarkModeListener:()=>P1,boundingBoxIntersection:()=>uI,boxIntersection:()=>dI,buildDomainScales:()=>Kw,calculateNestedDepth:()=>Sc,calculatePowerOf10:()=>Rw,calculateSpacingAdjustment:()=>Si,chebyshevDistance:()=>OD,checkValidity:()=>KV,classList:()=>O1,clear:()=>eG,clone:()=>ot,cloneIcon:()=>nV,cls:()=>X,colourDistance:()=>zx,computeBezierConnector:()=>Yd,computeBezierLength:()=>CA,computeDomainScales:()=>KP,computeGroupSize:()=>vu,computeRectangleIntersection:()=>Lm,computeStraightConnector:()=>Kd,connectorSegmentLength:()=>XA,consume:()=>ae,containsPoint:()=>gs,convertToFullOverlaySpec:()=>ii,convertToMultilineText:()=>Iu,createAbstractBezierConnector:()=>Gd,createAndAppendElementNS:()=>Kr,createChartElement:()=>k,createChartTextElement:()=>us,createColorPickerTag:()=>zv,createComponent:()=>CS,createContrastLabel:()=>um,createDiagram:()=>fG,createElement:()=>Jr,createElementNS:()=>ta,createFinderFromAnchorPositions:()=>qs,createGateMap:()=>_d,createPaper:()=>HG,createSurface:()=>xG,createXYPlot:()=>QP,data:()=>Pe,debounce:()=>ra,decodeDragGroupSpec:()=>G0,defaultDataGenerator:()=>P0,defaultExportGeometry:()=>fI,defaultIcons:()=>ch,defaultIdFunction:()=>km,defaultImportGeometry:()=>yI,destroySVGOverlay:()=>tf,diagonalAdjacentCellsFinder:()=>Eg,directRouter:()=>cA,dist:()=>SA,distanceFromCurve:()=>C_,djikstra:()=>pc,each:()=>gN,eachNotEmpty:()=>dx,edgeSortFunctions:()=>OS,editors:()=>Lr,emptyBox:()=>Qh,emptyPaintGeometry:()=>b_,encloses:()=>SD,encodedSvgToDataUrl:()=>d0,ensureSVGContentElements:()=>Ql,ensureSVGLabelElements:()=>jo,euclideanDistance:()=>PD,evaluateExpression:()=>wi,evaluateSingleExpression:()=>Mg,expandRectangle:()=>ix,exportConnectorGeometry:()=>Yr,exportData:()=>Jm,exportImage:()=>_p,exportSVG:()=>My,exportSvg:()=>Aa,extend:()=>Is,extract:()=>qV,extractBounds:()=>wD,extractPoint:()=>rr,extractSize:()=>fs,extractValueFromElement:()=>p0,faceOrientations:()=>Ii,fastTrim:()=>bt,filterEmpty:()=>cx,filterList:()=>pN,filterNull:()=>ND,findAdjacentSegment:()=>kd,findClosestPoint:()=>yc,findParent:()=>Zt,findParents:()=>S1,findSegment:()=>Hd,fixPrecision:()=>gc,flatten:()=>f_,floydWarshall:()=>qy,formatValue:()=>Iy,freeMovementAdjacencies:()=>YO,generateConstrainFunctionFromContainmentType:()=>oP,generateInspectorTemplate:()=>C0,getAbsolutePosition:()=>B1,getAllEdges:()=>CO,getAllSourceEdges:()=>VD,getAllTargetEdges:()=>GD,getAncestors:()=>En,getClass:()=>qS,getClosestMidpoint:()=>hx,getComponentXY:()=>_M,getConnectedVertices:()=>FD,getConnectorElement:()=>WR,getContrastColor:()=>Yc,getDefaultFace:()=>tM,getDescendantEdges:()=>Wm,getDescendants:()=>bs,getDownstreamVertices:()=>$D,getEdges:()=>el,getElementSize:()=>it,getElementType:()=>Gu,getEventSource:()=>zo,getFromSetWithFunction:()=>Mm,getOutlineColor:()=>cN,getPageLocation:()=>DR,getPosition:()=>hn,getPositionOnElement:()=>$u,getRectangleMidpoints:()=>SO,getSelector:()=>QS,getSourceEdges:()=>gx,getSvgTranslatePosition:()=>eh,getTargetEdges:()=>Ex,getTouch:()=>kE,getUpstreamVertices:()=>BD,getsert:()=>ys,gradient:()=>Nr,gradientAtPoint:()=>Bd,gradientAtPointAlongPathFrom:()=>hI,gridBackgroundOptions:()=>DC,hasClass:()=>an,inferAxis:()=>Ps,inferAxisAndDirectionFromOrientation:()=>fg,inferAxisFromSourceAndTargetLocation:()=>Hx,inferDirection:()=>jx,initializeBezierConnectorEditors:()=>KC,initializeOrthogonalConnectorEditors:()=>XC,initializeStraightConnectorEditors:()=>kC,insertRTreeChild:()=>Co,insertSorted:()=>Vm,intersectionOfProjectedLines:()=>ox,isAncestor:()=>We,isArrayLike:()=>T1,isArrayOrNodeList:()=>KS,isAssignableFrom:()=>ax,isBarPlot:()=>tB,isBoolean:()=>lo,isCategoryAxis:()=>FP,isConnection:()=>Fo,isConnector:()=>TI,isCustomOverlay:()=>sn,isDOMElement:()=>Xi,isDate:()=>TO,isDescendantGroup:()=>yx,isEdge:()=>Ke,isEdgeNodeEntry:()=>lt,isEdgeSupported:()=>OE,isElement:()=>eT,isEmpty:()=>qa,isFilterableDataset:()=>Hb,isFullOverlaySpec:()=>mS,isFunction:()=>Tr,isGroup:()=>Y,isHTMLLabelOverlay:()=>dT,isLabelOverlay:()=>kr,isLoopPresent:()=>rA,isMouseDevice:()=>oi,isNamedFunction:()=>DD,isNestedGroup:()=>Hm,isNode:()=>K,isNodeInsideAGroup:()=>jm,isNodeList:()=>Nn,isNodeVertex:()=>fx,isNumber:()=>fc,isObject:()=>hr,isPoint:()=>TA,isPort:()=>H,isSVGElement:()=>Ot,isStackedPlot:()=>za,isString:()=>z,isTextNode:()=>v1,isTouchDevice:()=>wn,isValueAxis:()=>mn,isVertex:()=>bi,isVertexNodeEntry:()=>nN,lightweightPrintfFormatter:()=>aA,lineCalculators:()=>Ol,lineIntersection:()=>wm,lineIntersectsOrIsEnclosedByRectangle:()=>nx,lineLength:()=>Be,lineRectangleIntersection:()=>lr,linesIntersection:()=>xO,linesOverlap:()=>Dm,locationAlongCurveFrom:()=>OA,log:()=>U,logEnabled:()=>AO,makeLightweightAnchorFromArraySpec:()=>gu,makeLightweightAnchorFromSpec:()=>ft,manhattanDistance:()=>Ec,manhattanLineLength:()=>AD,matchesSelector:()=>Mt,merge:()=>gn,mergeDomainExtents:()=>Zw,mergeWithParents:()=>du,minBy:()=>mA,namedContinuousValues:()=>fS,nearestPointOnCurve:()=>vA,newInstance:()=>dn,newRecadoInstance:()=>yr,newTemplates2Renderer:()=>fh,normal:()=>tx,objectsEqual:()=>Qa,octileDistance:()=>_D,offsetRelativeToRoot:()=>zi,orthogonalAdjacencies:()=>zO,orthogonalAdjacentCellsFinder:()=>Xx,orthogonalRouter:()=>hA,pageLocation:()=>me,paintSVGLabelOverlay:()=>mT,paintSimpleShapeOverlay:()=>pT,paintSvgConnector:()=>GT,parallelLineFromPoint:()=>CD,parallelLineTo:()=>Qy,parallelLinesTo:()=>sx,parentAxis:()=>Ir,parentDirection:()=>kx,parse:()=>vx,parseAttributes:()=>Ng,parseAtts:()=>nA,parseExpression:()=>h_,partition:()=>Ka,peek:()=>tA,perpendicularBisectingLine:()=>TD,perpendicularLineTo:()=>tr,perpendicularToPathAt:()=>cI,pointAlongCurveFrom:()=>PA,pointAlongPath:()=>$d,pointOnCurve:()=>Hs,pointOnLine:()=>Ut,pointsEqual:()=>ux,populate:()=>ho,populateRegions:()=>Ld,prefersDarkMode:()=>C1,processExpression:()=>Al,quadrant:()=>ms,ready:()=>o$,recordGetsert:()=>xs,rectanglesIntersect:()=>ke,registerDecorator:()=>yG,registerEdgeTypePickerTag:()=>Xv,registerExporter:()=>XD,registerParser:()=>Tx,registerPlugin:()=>wt,relocateContinuousAnchor:()=>uv,relocateDynamicAnchor:()=>pv,relocateWithPositionFinder:()=>mv,remove:()=>Nm,removeClass:()=>F,removeConnectionClass:()=>Or,removeRTreeChild:()=>Kg,removeWheelListener:()=>Zl,removeWithFunction:()=>_t,renderIcon:()=>Ku,renderNamedIcon:()=>qu,renderPaper:()=>H0,renderSurface:()=>j0,replace:()=>Bm,resolveIfExecution:()=>Yg,resolveNode:()=>jn,resolveNodeId:()=>Xm,resolvePortId:()=>ID,rotateAnchorOrientation:()=>mN,rotatePoint:()=>xt,routerLineIntersects:()=>lA,routerLineSgn:()=>kg,segmentDirections:()=>_I,segmentLineAngle:()=>zA,segmentedConnectorSegmentLength:()=>Ws,setAbsolutePosition:()=>Jt,setElementHeight:()=>xT,setElementRotation:()=>Ho,setElementSize:()=>Rr,setElementWidth:()=>yT,setForceMouseEvents:()=>wR,setForceTouchEvents:()=>LR,setOverlayLocation:()=>AE,setPosition:()=>Ce,setSvgTranslatePosition:()=>ln,setTranslatedPosition:()=>$t,setTranslatedX:()=>M$,setTranslatedY:()=>qh,setXPosition:()=>ET,setYPosition:()=>fT,shortUuid:()=>$m,snapToGrid:()=>se,snapToGridUpperBound:()=>vD,sortAndPlaceEdges:()=>Rd,sourceElementSelector:()=>bh,sourceVertexAvoidance:()=>BA,splitIntoSiblings:()=>Jg,stubCalculators:()=>Pl,stubRelocator:()=>kA,subtract:()=>ex,suggest:()=>Im,supportsPathEditing:()=>aT,svgElementToDataUrl:()=>Gv,targetElementSelector:()=>xL,targetVertexAvoidance:()=>FA,testIntersectingDropTarget:()=>dp,theta:()=>rx,toggleClass:()=>QE,touchCount:()=>HS,touches:()=>Yo,transformAnchorPlacement:()=>js,transformBezierGeometry:()=>zd,transformSegmentedGeometry:()=>qd,translateRect:()=>Gm,updateBezierConnector:()=>Ud,updateClasses:()=>Vt,updateEditedOrthogonalConnector:()=>jA,updateStraightConnector:()=>Jd,uuid:()=>V,valueInRange:()=>Tl,vertexAvoidance:()=>UA,wrap:()=>rd,xml:()=>JS});module.exports=yD(hB);function pc(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={},m=i.strict!==!1,g=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let _=p[C.getFullId()];return u[_.v.id]},x=(C,_)=>{let w,B;if(C.objectType===pe.objectType){for(s[C.getFullId()]=_,w=y(C),B=0;B<w.length;B++)w[B].p!=C&&(s[w[B].p.getFullId()]=_+C.getParent().getInternalEdge(C,w[B].p).cost);m||(s[C.getParent().id]=_)}else for(s[C.id]=_,w=u[C.id],B=0;B<w.length;B++)s[w[B].p.getFullId()]=_},f=C=>n&&!n(C)?1/0:s[g(C)],b=(C,_,w)=>{if(C.objectType===pe.objectType){let B=y(C);for(let D=0;D<B.length;D++)a[B[D].p.getFullId()]=w.node;m||(a[C.getParent().id]=w.node)}a[_]=w.node},A=(C,_,w)=>{if(C.objectType===pe.objectType){let B=y(C);for(let D=0;D<B.length;D++)l[B[D].p.getFullId()]=w;m||(l[C.getParent().id]=w)}l[_]=w},T=(C,_,w,B,D)=>{let M=-1,N=null,G=1/0;for(let J=0;J<C.length;J++)if(!_[J]){let ye=D(C[J]);ye<G?(G=ye,M=J,N=C[J]):ye===G&&C[J].objectType===pe.objectType&&C[J].getParent()===N&&(M=J,N=C[J])}return{node:N,index:M}},S=(C,_)=>{let w=_.getFullId(),B=C[w];return B==null&&(w=_.getParent?_.getParent().id:_.id,B=C[w]),B==null?null:{p:B,id:w}},R=(C,_,w,B,D,M)=>{let N=[],G=B,J=S(_,G);for(;J!=null;)N.splice(0,0,{vertex:G,cost:C[J.id],edge:w[J.id]}),G=J.p,J=S(_,G);return N.splice(0,0,{vertex:G,cost:0,edge:null}),N},v=C=>{for(let _=0;_<C.length;_++){let w=C[_],B=w.getPorts();E.push(w);let D={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let M=0;M<B.length;M++)E.push(B[M]),p[B[M].getFullId()]=D,u[w.id].push({p:B[M],i:E.length-1}),x(B[M],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 O=new Array(r.nodes.length),P=0,I=(C,_,w,B)=>{for(let D=0;D<_.length;D++){let M=_[D];if(w(M)){let N=B(M),G=N.tp||N.tn,J=g(G),ye=f(C.node)+M.getCost(),j=f(G);ye<j&&(x(G,ye),b(G,J,C),A(G,J,M))}}};for(;P<E.length;){let C=T(E,O,s,g,f),_=C.node?g(C.node):null;if(!C.node||f(C.node)==1/0||t&&(_==g(t)||!m&&C.node.objectType===pe.objectType&&C.node.isChildOf(t))&&(h.path=R(s,a,l,t,g),h.pathDistance=h.path[h.path.length-1].cost,!d))break;O[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!m&&w.source.objectType===pe.objectType&&w.source.isChildOf(C.node),w=>{var B=w.source.objectType===pe.objectType?w.source.getParent():w.source,D=w.source.objectType===pe.objectType?w.source:null,M=w.target.objectType===pe.objectType?w.target.getParent():w.target,N=w.target.objectType===pe.objectType?w.target:null;return w.source==C.node||!m&&w.source.objectType===pe.objectType&&w.source.isChildOf(C.node)?{tn:M,tp:N}:{tn:B,tp:D}})}return h}function qy(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 mc=class{constructor(r){c(this,"vertices");c(this,"q");this.vertices=[r],this.q=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.q.add(e))}get edges(){return Array.from(this.q)}};var xD=[null,[1,-1],[1,1],[-1,1],[-1,-1]],bD=[null,[-1,-1],[-1,1],[1,1],[1,-1]],fi=2*Math.PI;function yi(i,r){return{x:i.x+r.x,y:i.y+r.y}}function ex(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 tx(i,r){return-1/Nr(i,r)}function Be(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function AD(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function ms(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function rx(i,r){let e=Nr(i,r),t=Math.atan(e),n=ms(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function ke(i,r){let e=i.x,t=i.x+i.width,n=i.y,o=i.y+i.height,s=r.x,a=r.x+r.width,l=r.y,h=r.y+r.height;return e<=s&&s<=t&&n<=l&&l<=o||e<=a&&a<=t&&n<=l&&l<=o||e<=s&&s<=t&&n<=h&&h<=o||e<=a&&s<=t&&n<=h&&h<=o||s<=e&&e<=a&&l<=n&&n<=h||s<=t&&t<=a&&l<=n&&n<=h||s<=e&&e<=a&&l<=o&&o<=h||s<=t&&e<=a&&l<=o&&o<=h}function Lm(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 yO(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:gc(r*i[0].x+e*i[0].y)}}function gc(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}function wm(i,r){let e=yO(i),t=yO(r),n=e.A*t.B-t.A*e.B;if(n==0)return null;{let o={x:Math.round((t.B*e.C-e.B*t.C)/n),y:Math.round((e.A*t.C-t.A*e.C)/n)},s=Math.floor(Math.min(i[0].x,i[1].x)),a=Math.round(Math.max(i[0].x,i[1].x)),l=Math.floor(Math.min(i[0].y,i[1].y)),h=Math.round(Math.max(i[0].y,i[1].y)),d=Math.floor(Math.min(r[0].x,r[1].x)),u=Math.round(Math.max(r[0].x,r[1].x)),p=Math.floor(Math.min(r[0].y,r[1].y)),m=Math.round(Math.max(r[0].y,r[1].y));return o.x>=s&&o.x<=a&&o.y>=l&&o.y<=h&&o.x>=d&&o.x<=u&&o.y>=p&&o.y<=m?o:null}}function lr(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=wm(i,n);o!=null&&e.push(o)}),e}function nx(i,r){return gs(r,i[0],!0)||gs(r,i[1],!0)||lr(i,r).length>0}function SD(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,m,g,E)=>e?p<=m&&g>=E:p<m&&g>E;return u(t,a,n,l)&&u(o,h,s,d)}function gs(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 Ut(i,r,e){let t=Nr(i,r),n=ms(i,r),o=e>0?xD[n]:bD[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 tr(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 TD(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 se(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 vD(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 xO(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 Dm(i,r,e,t,n=0){let o=xO(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function ix(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 ox(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),m=n+u*(o-n);return{x:p,y:m}}function Qy(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 sx(i,r){return[Qy(i,r),Qy(i,-r)]}function CD(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 Ec=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),PD=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),OD=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),_D=(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};var AO=!0;function U(...i){if(AO&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function ax(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function Nm(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function RD(i,r,e){i.findIndex(e)===-1&&i.push(r)}function lx(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function LD(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function Im(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function Mm(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function _t(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function xt(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 bt(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 Vm(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 xi(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function rr(i){return{x:i.x,y:i.y}}function fs(i){return{width:i.width,height:i.height}}function wD(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function Gm(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Yt=[];for(let i=0;i<256;i++)Yt[i]=(i<16?"0":"")+i.toString(16);function V(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Yt[i&255]+Yt[i>>8&255]+Yt[i>>16&255]+Yt[i>>24&255]+"-"+Yt[r&255]+Yt[r>>8&255]+"-"+Yt[r>>16&15|64]+Yt[r>>24&255]+"-"+Yt[e&63|128]+Yt[e>>8&255]+"-"+Yt[e>>16&255]+Yt[e>>24&255]+Yt[t&255]+Yt[t>>8&255]+Yt[t>>16&255]+Yt[t>>24&255]}function $m(i=6){return V().substring(0,i-1)}function SO(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 hx(i,r){let e=SO(r).map(t=>({p:t,d:Be(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function Pe(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=Pe(i,d[1]);a[bt(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,m=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let g=m(),E=u[3];e==null?s=g[E]:g[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let g=m();o=g[u[3]]||function(){return g[u[3]]={},g[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function Ka(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 cx(i){return i.filter(r=>r!=null&&bt(r).length>0)}function dx(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function yc(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 ys(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function xs(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function fc(i){return Object.prototype.toString.call(i)==="[object Number]"}function z(i){return typeof i=="string"}function lo(i){return typeof i=="boolean"}function hr(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function TO(i){return Object.prototype.toString.call(i)==="[object Date]"}function Tr(i){return Object.prototype.toString.call(i)==="[object Function]"}function DD(i){return Tr(i)&&i.name!=null&&i.name.length>0}function qa(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function Qa(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(!bO(t,n))return!1}return!0}function ND(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function ot(i){if(z(i))return""+i;if(lo(i))return!!i;if(TO(i))return new Date(i.getTime());if(Tr(i))return i;if(Array.isArray(i))return i.map(r=>ot(r));if(hr(i)){let r={};for(let e in i)r[e]=ot(i[e]);return r}else return i}function gn(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=ot(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(z(r[s])||lo(r[s])||Tr(r[s])||fc(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(hr(r[s])){hr(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function bO(i,r){if(i!=null&&r==null)return!1;if((i==null||z(i)||lo(i)||fc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!vO(i,r))return!1}else return!1;else if(hr(i))if(hr(i)){if(!Qa(i,r))return!1}else return!1;return!0}function vO(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(!bO(i[e],r[e]))return!1;return!0}function ux(i,r){return i.x===r.x&&i.y===r.y}function px(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=xt(t,n.c,n.r)}),t}function mx(i,r){return r.forEach(e=>{i=xt(i,e.c,e.r)}),i}function Bm(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 ho(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(z(s))return n(s);if(Tr(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(hr(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var Es=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){Vm(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 Xm(i){return H(i)?i.getParent().id:i.getFullId()}function jn(i){return H(i)?i.getParent():i}function ID(i){return H(i)?i.id:null}function K(i){return i!=null&&i.objectType===de.objectType}function jm(i){return K(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===le.objectType}function Hm(i){return Y(i)&&i.group!=null}function Ke(i){return i!=null&&i.objectType===Fe.objectType}function H(i){return i!=null&&i.objectType===pe.objectType}function fx(i){return i.objectType===de.objectType||i.objectType===le.objectType}function bi(i){return K(i)||Y(i)||H(i)}function km(i){return i.id}var MD=".";function el(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 CO(i,r){let e=el(i,r).slice(0);if(K(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,el(i.ports[t],r));return e}function gx(i){return el(i,r=>r.source==i)}function Ex(i){return el(i,r=>r.target==i)}function VD(i){let r=gx(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,gx(i.ports[e]));return r}function GD(i){let r=Ex(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Ex(i.ports[e]));return r}function Wm(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?CO(l,h):el(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function Sc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function En(i){let r=jn(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function We(i,r){return i==null||r==null?!1:En(i).indexOf(r)!==-1}function yx(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 bs(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function $D(i,r){let t=!(K(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function BD(i,r){let t=!(K(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function FD(i,r){let e=new Set,t=K(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 xx(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var tl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"Le",new Map);c(this,"_r",new Map);c(this,"Fe",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"zt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Ro",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.zt=r.defaultIdFunction||km,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||MD}Qs(r){delete this.Ro[r.id]}ea(r){this.Ro[r.id]=r}mg(){this.Ro={}}getIdFunction(){return this.zt}setIdFunction(r){this.zt=r}setTypeFunction(r){this.typeFunction=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?V():typeof r=="string"?r:(e||this.getIdFunction())(r)||V()}getTopLevelElements(){return this.Ro}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.Le.get(e[0])||this.Fe.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===pe||r.constructor===de||r.constructor===le)return r;let s=r;if(t=this.zt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.Le.has(s))return this.Le.get(s);if(this.Fe.has(s))return this.Fe.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.Le.get(l)||this.Fe.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.Le.clear(),this._r.clear(),this.Fe.clear(),this.mg()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this._r.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 Fe({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._r.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new de(this,r||{},e||this.zt);return this.Le.has(t.id)?null:(this.nodes.push(t),this.Le.set(t.id,t),this.ea(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.zt)}addGroup(r,e){let t=new le(this,r,e||this.zt);return this.Fe.has(t.id)?this.Fe.get(t.id):(this.groups.push(t),this.Fe.set(t.id,t),this.ea(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.Fe.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.Qs(n))}$addMembersToGroup(r,e){for(let t=0;t<r.length;t++)this.$addMemberToGroup(r[t],e)}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.ea(e))}$removeMembersFromGroup(r){for(let e=0;e<r.length;e++)this.$removeMemberFromGroup(r[e])}getGroup(r){return typeof r=="string"?this.Fe.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Fe.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}=Ka(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.Fe.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.Qs(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.Le.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.Qs(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._r.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Fe)return r;let e=r;if(r=this.zt(r),typeof r!="string")return e}return this._r.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._r.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this._r.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 pc({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=pc({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=pc({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,m)=>{let g=u.parents[h][d];if(g.length==0){let E=p.slice();E.unshift(h),m.push(E)}else for(let E=0;E<g.length;E++)if(p.indexOf(g[E][0].id)==-1){let y=p.slice();y.unshift(g[E][0].id),s(h,g[E][0].id,u,y,m)}},a=this.getVertex(r),l=qy({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 m=0;m<u.length;m++){let g=u[m].indexOf(a.id);g>0&&g<u[m].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()+`
|
|
1
|
+
var uc=Object.defineProperty,uD=Object.defineProperties,gO=Object.getOwnPropertyDescriptor,pD=Object.getOwnPropertyDescriptors,mD=Object.getOwnPropertyNames,mO=Object.getOwnPropertySymbols;var EO=Object.prototype.hasOwnProperty,gD=Object.prototype.propertyIsEnumerable;var Jy=(i,r,e)=>r in i?uc(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,gi=(i,r)=>{for(var e in r||(r={}))EO.call(r,e)&&Jy(i,e,r[e]);if(mO)for(var e of mO(r))gD.call(r,e)&&Jy(i,e,r[e]);return i},fO=(i,r)=>uD(i,pD(r));var ED=(i,r)=>{for(var e in r)uc(i,e,{get:r[e],enumerable:!0})},fD=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of mD(r))!EO.call(i,n)&&n!==e&&uc(i,n,{get:()=>r[n],enumerable:!(t=gO(r,n))||t.enumerable});return i};var yD=i=>fD(uc({},"__esModule",{value:!0}),i),Nt=(i,r,e,t)=>{for(var n=t>1?void 0:t?gO(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&&uc(r,e,n),n};var c=(i,r,e)=>(Jy(i,typeof r!="symbol"?r+"":r,e),e);var hB={};ED(hB,{$__proxyEdge:()=>FS,$__unproxyEdge:()=>BS,$_createCircularSvgHandles:()=>gC,$_createRectangularSvgHandles:()=>mC,$_createSvg:()=>Ie,$_setSkeletonPosition:()=>sy,$addOverlay:()=>Gl,$appendAtIndex:()=>ea,$attr:()=>ce,$autoCalculateChartScale:()=>Kh,$calculateChartScaleWithSteps:()=>BP,$createConnection:()=>$S,$createGradient:()=>kS,$createMarker:()=>ac,$defaultOrthogonalPathCompute:()=>UA,$defaultStraightPathCompute:()=>F_,$doImageExport:()=>Uf,$getConnectorPathData:()=>wA,$getMarker:()=>Tm,$getOverlay:()=>Vl,$getOverlays:()=>oR,$hideOverlay:()=>EM,$isCompoundAction:()=>HO,$isGroupSizeChangedAction:()=>ib,$isMoveAction:()=>nb,$isUpdateAction:()=>rb,$makeAndAppendCircularHandle:()=>cv,$makeAndAppendRectangularHandle:()=>dv,$makeCircularHandle:()=>Rf,$makeRectangularHandle:()=>TL,$makeSvgAnchorPlaceholder:()=>OV,$prepareFontSpec:()=>ui,$rewriteOrthogonalConnector:()=>kA,$spaceLabels:()=>UP,$svgNode:()=>$,$updateLabelOverlayFont:()=>SE,ABSOLUTE:()=>je,ACTION_ADD:()=>xS,ACTION_REMOVE:()=>bS,ADD_CLASS_ACTION:()=>PM,ALL_GROUPS_RELAYOUT:()=>yN,ANCHOR_PLACEHOLDER_SELECTOR:()=>_f,ANIMATION_PHASE_CANCELLED:()=>Ca,ANIMATION_PHASE_FINISHED:()=>Pa,ANIMATION_PHASE_INITIALIZED:()=>bC,ANIMATION_PHASE_TRAVERSING_EDGE:()=>AC,ANIMATION_PHASE_TRAVERSING_END:()=>uy,ANIMATION_PHASE_TRAVERSING_START:()=>dy,ANIM_SURFACE_ELEMENT_FLASH:()=>TT,APPEND_TO_CURRENT:()=>St,AStarGrid:()=>Ps,ATTRIBUTE_CHART_CATEGORY:()=>zn,ATTRIBUTE_CHART_FILTERED_SERIES:()=>K$,ATTRIBUTE_CHART_SERIES:()=>dt,ATTRIBUTE_CHART_STACK:()=>Em,ATTRIBUTE_CHART_STACK_TOTAL:()=>fm,ATTRIBUTE_CHART_VALUE:()=>ym,ATTRIBUTE_CLASS:()=>Jb,ATTRIBUTE_COLOR_PICKER_MAX_COLORS:()=>b0,ATTRIBUTE_CONTAINER:()=>WE,ATTRIBUTE_CONTEXT:()=>kb,ATTRIBUTE_CONTROLS_ORIENTATION:()=>WL,ATTRIBUTE_DATA_SHAPE_ID:()=>Xp,ATTRIBUTE_DEFAULT:()=>Wb,ATTRIBUTE_ELEMENTS_DRAGGABLE:()=>QA,ATTRIBUTE_FILL:()=>UM,ATTRIBUTE_GROUP:()=>qA,ATTRIBUTE_GROUP_COLLAPSED_CONTENT:()=>Iu,ATTRIBUTE_GROUP_CONTENT:()=>ZE,ATTRIBUTE_GROUP_EXPANDED_CONTENT:()=>Nu,ATTRIBUTE_ICON_ID:()=>eL,ATTRIBUTE_ICON_KEY:()=>kT,ATTRIBUTE_ICON_SIZE:()=>HT,ATTRIBUTE_IS_GROUP:()=>zl,ATTRIBUTE_LOOKUP:()=>Lg,ATTRIBUTE_MANAGED:()=>Pt,ATTRIBUTE_NOT_DRAGGABLE:()=>_l,ATTRIBUTE_ORIENTATION:()=>QR,ATTRIBUTE_ORIGIN:()=>Ku,ATTRIBUTE_ORIGIN_X:()=>XT,ATTRIBUTE_ORIGIN_Y:()=>jT,ATTRIBUTE_RESET_SELECTION:()=>Nv,ATTRIBUTE_STROKE:()=>kM,ATTRIBUTE_STROKE_DASHARRAY:()=>NE,ATTRIBUTE_STROKE_DASHOFFSET:()=>jM,ATTRIBUTE_STROKE_LINECAP:()=>zM,ATTRIBUTE_STROKE_LINEJOIN:()=>YM,ATTRIBUTE_STROKE_MITERLIMIT:()=>XM,ATTRIBUTE_STROKE_OPACITY:()=>HM,ATTRIBUTE_STROKE_WIDTH:()=>WM,ATTRIBUTE_STYLE:()=>Kb,ATTRIBUTE_TABINDEX:()=>pE,ATTRIBUTE_TEXT_ANCHOR:()=>ZM,ATTRIBUTE_TRANSFORM:()=>oi,ATTRIBUTE_VALUE_NON_SCALING_STROKE:()=>xu,ATTRIBUTE_VECTOR_EFFECT:()=>yu,ATTRIBUTE_VERSION:()=>BM,ATTRIBUTE_VJS_ALLOW_LOOPBACK:()=>mE,ATTRIBUTE_VJS_EDGE:()=>Ze,ATTRIBUTE_VJS_EDGE_TYPE:()=>eu,ATTRIBUTE_VJS_ENABLED:()=>fr,ATTRIBUTE_VJS_MAGNET:()=>ru,ATTRIBUTE_VJS_MINIVIEW_TYPE:()=>Av,ATTRIBUTE_VJS_NODE_ID:()=>$f,ATTRIBUTE_VJS_OVERLAY_ID:()=>nu,ATTRIBUTE_VJS_PORT:()=>on,ATTRIBUTE_VJS_PORT_ID:()=>Rl,ATTRIBUTE_VJS_PORT_TYPE:()=>Hr,ATTRIBUTE_VJS_SCOPE:()=>Yl,ATTRIBUTE_VJS_SOURCE:()=>eS,ATTRIBUTE_VJS_SOURCE_PORT:()=>Ws,ATTRIBUTE_VJS_SOURCE_PORT_ID:()=>gE,ATTRIBUTE_VJS_SOURCE_PORT_TYPE:()=>Vi,ATTRIBUTE_VJS_TARGET:()=>Io,ATTRIBUTE_VJS_TARGET_PORT:()=>Mo,ATTRIBUTE_VJS_TARGET_PORT_ID:()=>tu,ATTRIBUTE_VJS_TARGET_PORT_TYPE:()=>Gi,ATTRIBUTE_VJS_VERTEX:()=>ee,ATTRIBUTE_XMLNS:()=>FM,ATT_DATA_DIR:()=>va,ATT_VJS_RESIZABLE:()=>iy,ATT_VJS_ROTATABLE:()=>oy,ATT_VJS_X_RESIZE:()=>ry,ATT_VJS_Y_RESIZE:()=>ny,AXIS_POSITION_END:()=>pi,AXIS_POSITION_START:()=>sr,AbsoluteBackedLayout:()=>Hn,AbsoluteLayout:()=>uo,AbstractEntry:()=>wi,AbstractHierarchicalLayout:()=>As,AbstractLayout:()=>fn,AbstractLayoutAdapter:()=>vc,AddGroupMemberAction:()=>sd,AnchorLocations:()=>Md,ArcSegmentHandler:()=>Wd,AreaChart:()=>eO,AreaPlot:()=>lc,ArrayBasedSeries:()=>Ia,ArrowOverlay:()=>_r,AssignLayersStage:()=>Ic,AutoSaver:()=>al,AvailableBackgrounds:()=>Ki,BASIC_SHAPES:()=>JT,BLOCK:()=>Pr,BOTTOM:()=>st,BackgroundPlugin:()=>Qo,BalloonLayout:()=>Dc,BarChart:()=>rO,BarPlot:()=>wr,Base:()=>bc,BaseBrowserUIPlugin:()=>Oe,BaseChart:()=>io,BaseDomUiLayoutAdapter:()=>oa,BaseRouter:()=>fu,BaseSeriesBasedChartDataSource:()=>nc,BezierEditor:()=>ci,BezierSegmentHandler:()=>P_,BlankDataSource:()=>Na,BlankScale:()=>sc,BrowserUI:()=>aa,BrowserUIClipboard:()=>rp,BrowserUIModel:()=>by,BrowserUiRecado:()=>Wo,BubbleChart:()=>nO,BubbleChartSeries:()=>jy,CENTER:()=>Rt,CHART_AXIS_TITLE_ALIGN_END:()=>kP,CHART_AXIS_TITLE_ALIGN_MIDDLE:()=>Da,CHART_AXIS_TITLE_ALIGN_START:()=>HP,CHART_TITLE_ALIGN_LEFT:()=>W$,CHART_TITLE_ALIGN_MIDDLE:()=>k$,CHART_TITLE_ALIGN_RIGHT:()=>Z$,CHART_TITLE_PLACEMENT_BOTTOM:()=>rc,CHART_TITLE_PLACEMENT_TOP:()=>Vw,CLASS_ANCHOR_CANDIDATE:()=>PV,CLASS_ANCHOR_PLACEHOLDER:()=>pa,CLASS_AREA_CHART:()=>$P,CLASS_AREA_CHART_AREA:()=>hm,CLASS_BACKGROUND:()=>LL,CLASS_BACKGROUND_BORDER:()=>wL,CLASS_BACKGROUND_GRID:()=>qo,CLASS_BACKGROUND_GRID_DOT_MAJOR:()=>fp,CLASS_BACKGROUND_GRID_DOT_MINOR:()=>IL,CLASS_BACKGROUND_GRID_MAJOR:()=>NL,CLASS_BACKGROUND_GRID_MINOR:()=>DL,CLASS_BACKGROUND_TILE:()=>PL,CLASS_BAR_CHART:()=>PP,CLASS_BAR_CHART_BAR:()=>OP,CLASS_BEZIER_GUIDELINE:()=>JC,CLASS_BEZIER_HANDLE:()=>Uh,CLASS_BEZIER_HANDLE_CONTROL_POINT:()=>xy,CLASS_BEZIER_HANDLE_CONTROL_POINT_1:()=>WC,CLASS_BEZIER_HANDLE_CONTROL_POINT_2:()=>ZC,CLASS_BEZIER_SECONDARY_HANDLE:()=>BG,CLASS_BEZIER_SECONDARY_SOURCE_HANDLE:()=>FG,CLASS_BEZIER_SECONDARY_TARGET_HANDLE:()=>UG,CLASS_BUBBLE_CHART:()=>_P,CLASS_BUBBLE_CHART_DATA_POINT:()=>RP,CLASS_CHART_AXIS:()=>wa,CLASS_CHART_AXIS_LABELS:()=>Py,CLASS_CHART_AXIS_LINE:()=>Oy,CLASS_CHART_AXIS_TITLE:()=>_y,CLASS_CHART_BACKGROUND:()=>fP,CLASS_CHART_BODY:()=>Wh,CLASS_CHART_CROSSHAIR:()=>Zh,CLASS_CHART_CROSSHAIR_LABEL:()=>Jh,CLASS_CHART_EMPTY:()=>Ry,CLASS_CHART_GRIDLINE:()=>wy,CLASS_CHART_GRIDLINES:()=>Ly,CLASS_CHART_LEGEND:()=>xP,CLASS_CHART_LEGEND_DOT:()=>AP,CLASS_CHART_LEGEND_ITEM:()=>om,CLASS_CHART_LEGEND_LABEL:()=>bP,CLASS_CHART_PLOT_BACKGROUND:()=>La,CLASS_CHART_POINT:()=>pn,CLASS_CHART_POINT_HIT_AREA:()=>lm,CLASS_CHART_SCALE_LABEL:()=>VP,CLASS_CHART_SERIES:()=>yP,CLASS_CHART_SUBTITLE:()=>NP,CLASS_CHART_TITLE:()=>DP,CLASS_CHART_X_AXIS:()=>sm,CLASS_CHART_X_AXIS_TITLE:()=>TP,CLASS_CHART_Y_AXIS:()=>am,CLASS_CHART_Y_AXIS_TITLE:()=>SP,CLASS_COLOR_PICKER:()=>y0,CLASS_COLOR_PICKER_SWATCH:()=>Yv,CLASS_COLOR_PICKER_SWATCHES:()=>Uv,CLASS_COLUMN_CHART:()=>vP,CLASS_COLUMN_CHART_COLUMN:()=>CP,CLASS_CONNECTED:()=>Ll,CLASS_CONNECTION_EDIT:()=>Of,CLASS_CONNECTOR:()=>Zs,CLASS_CONNECTOR_OUTLINE:()=>rS,CLASS_CONNECTOR_PATH:()=>tS,CLASS_CONNECTOR_SOURCE_DRAG:()=>ji,CLASS_CONNECTOR_TARGET_DRAG:()=>Hi,CLASS_CONNECTOR_TRANSIENT:()=>nS,CLASS_CONNECTOR_TRANSIENT_DRAG:()=>MT,CLASS_CONTROLS:()=>xp,CLASS_CONTROLS_CLEAR:()=>_v,CLASS_CONTROLS_PAN_MODE:()=>Sv,CLASS_CONTROLS_REDO:()=>Ov,CLASS_CONTROLS_RESET_SELECTION:()=>Lv,CLASS_CONTROLS_SELECT_MODE:()=>Bf,CLASS_CONTROLS_UNDO:()=>Pv,CLASS_CONTROLS_ZOOM_IN:()=>vv,CLASS_CONTROLS_ZOOM_OUT:()=>Cv,CLASS_CONTROLS_ZOOM_TO_FIT:()=>Tv,CLASS_COPY_PASTE_CONTROLS:()=>VV,CLASS_CROSSHAIR_CATEGORY_AXIS:()=>MP,CLASS_CROSSHAIR_VALUE_AXIS:()=>IP,CLASS_DEFAULT_GROUP:()=>mf,CLASS_DEFAULT_NODE:()=>pf,CLASS_DIAGRAM_CELL_TOOL:()=>Ey,CLASS_DIAGRAM_CLONE_CELL:()=>NC,CLASS_DIAGRAM_DELETE_CELL:()=>IC,CLASS_DIAGRAM_GROUP:()=>_C,CLASS_DIAGRAM_LINK_CELL:()=>I0,CLASS_DIAGRAM_NODE:()=>OC,CLASS_DRAG_ACTIVE:()=>Kt,CLASS_DRAG_HOVER:()=>qt,CLASS_DRAG_HOVER_CANNOT_DROP:()=>ko,CLASS_DRAG_ORIGINAL_GROUP:()=>gf,CLASS_DUMMY_VERTEX:()=>sS,CLASS_EDGE_DELETE_BUTTON:()=>Ks,CLASS_EDGE_DELETE_BUTTON_INTERNAL:()=>ou,CLASS_EDGE_GUIDELINE:()=>pp,CLASS_EDGE_RELOCATING:()=>df,CLASS_EDGE_TYPE_PICKER:()=>S0,CLASS_EDGE_TYPE_PICKER_SELECTED:()=>Dp,CLASS_EDGE_WILL_RELOCATE:()=>Fu,CLASS_ELASTIC_GROUP_RESIZE:()=>VL,CLASS_ELEMENT_DRAGGING:()=>th,CLASS_EXPORT_CANCEL:()=>Tp,CLASS_EXPORT_CONTROLS:()=>Rv,CLASS_EXPORT_DIMENSIONS:()=>Mv,CLASS_EXPORT_DOWNLOAD_TOOLS:()=>Vv,CLASS_EXPORT_OVERLAY:()=>Sp,CLASS_EXPORT_UNDERLAY:()=>Ap,CLASS_GAUGE_CHART:()=>rD,CLASS_GAUGE_CHART_LABEL:()=>oD,CLASS_GAUGE_CHART_NEEDLE:()=>sD,CLASS_GAUGE_CHART_NEEDLE_PIVOT:()=>aD,CLASS_GAUGE_CHART_TICK:()=>iD,CLASS_GAUGE_CHART_TRACK:()=>nD,CLASS_GAUGE_CHART_ZONE:()=>iO,CLASS_GROUP:()=>Vo,CLASS_GROUP_CHILD_ELEMENT_DRAGGING:()=>cf,CLASS_GROUP_COLLAPSED:()=>EE,CLASS_GROUP_EXPANDED:()=>fE,CLASS_HOVER:()=>oh,CLASS_INSPECTOR:()=>f0,CLASS_INSPECTOR_ACTIVE:()=>Bv,CLASS_INSPECTOR_CLOSE:()=>Fv,CLASS_INSPECTOR_INACTIVE:()=>Rp,CLASS_LABEL_OVERLAY:()=>iS,CLASS_LASSO:()=>vT,CLASS_LASSO_MASK:()=>nh,CLASS_LASSO_MASK_BOTTOM:()=>_T,CLASS_LASSO_MASK_LEFT:()=>CT,CLASS_LASSO_MASK_RIGHT:()=>OT,CLASS_LASSO_MASK_TOP:()=>PT,CLASS_LINE_CHART:()=>GP,CLASS_MINIVIEW:()=>Uu,CLASS_MINIVIEW_CANVAS:()=>RT,CLASS_MINIVIEW_CLICK_TO_CENTER:()=>IT,CLASS_MINIVIEW_COLLAPSE:()=>NT,CLASS_MINIVIEW_COLLAPSED:()=>Yu,CLASS_MINIVIEW_ELEMENT:()=>wT,CLASS_MINIVIEW_GROUP_ELEMENT:()=>DT,CLASS_MINIVIEW_PANNER:()=>LT,CLASS_MINIVIEW_PANNING:()=>uf,CLASS_MOST_RECENTLY_DRAGGED:()=>rh,CLASS_NODE:()=>$i,CLASS_ORTHOGONAL_HANDLE:()=>UC,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE:()=>Zp,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL:()=>zC,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL:()=>YC,CLASS_OVERLAY:()=>Js,CLASS_OVERLAY_HIDE:()=>wl,CLASS_PALETTE:()=>py,CLASS_PALETTE_CURRENT_SHAPE_TYPE:()=>zu,CLASS_PALETTE_ELEMENT_CURRENT:()=>VT,CLASS_PALETTE_SELECTED_ELEMENT:()=>Ho,CLASS_PALETTE_SET:()=>zp,CLASS_PALETTE_SET_FILTER:()=>Gh,CLASS_PALETTE_SET_SHAPES:()=>gy,CLASS_PALETTE_SET_TITLE:()=>SC,CLASS_PALETTE_SHAPE:()=>$h,CLASS_PALETTE_SHAPE_LABEL:()=>my,CLASS_PALETTE_TAP_MODE_ACTIVE:()=>ih,CLASS_PALETTE_VERTEX_DRAWING_LASSO:()=>TC,CLASS_PAN_ZOOM_CANVAS:()=>fL,CLASS_PAN_ZOOM_VIEWPORT:()=>EL,CLASS_PAPER:()=>lT,CLASS_PAPER_CANVAS:()=>hT,CLASS_PAPER_NODE:()=>V1,CLASS_PIE_CHART:()=>lD,CLASS_PIE_SLICE:()=>vm,CLASS_PIE_SLICE_SELECTED:()=>aO,CLASS_PORT:()=>oS,CLASS_RESIZE_BORDER:()=>is,CLASS_RESIZE_BORDER_BOTTOM:()=>cC,CLASS_RESIZE_BORDER_LEFT:()=>uC,CLASS_RESIZE_BORDER_RIGHT:()=>pC,CLASS_RESIZE_BORDER_TOP:()=>dC,CLASS_RESIZE_FRAME:()=>hC,CLASS_RESIZE_HANDLE:()=>yt,CLASS_RESIZE_HANDLE_ACTIVE:()=>kf,CLASS_RESIZE_HANDLE_B:()=>Qf,CLASS_RESIZE_HANDLE_BL:()=>Zf,CLASS_RESIZE_HANDLE_BR:()=>Kf,CLASS_RESIZE_HANDLE_L:()=>ey,CLASS_RESIZE_HANDLE_R:()=>ty,CLASS_RESIZE_HANDLE_T:()=>qf,CLASS_RESIZE_HANDLE_TL:()=>Wf,CLASS_RESIZE_HANDLE_TR:()=>Jf,CLASS_RESIZE_SKELETON:()=>sC,CLASS_RESIZE_SKELETON_BORDERS:()=>aC,CLASS_RESIZE_SKELETON_BORDERS_VISIBLE:()=>lC,CLASS_ROTATE_HANDLE:()=>Ih,CLASS_ROTATE_LEADER:()=>$p,CLASS_SANKEY_CHART:()=>dD,CLASS_SANKEY_EDGE:()=>ky,CLASS_SANKEY_LABEL:()=>Zy,CLASS_SANKEY_NODE:()=>Wy,CLASS_SANKEY_SELECTED:()=>so,CLASS_SANKEY_UNSELECTED:()=>Qr,CLASS_SCATTER_CHART:()=>LP,CLASS_SCATTER_CHART_DATA_POINT:()=>wP,CLASS_SELECTED_MODE:()=>MV,CLASS_SELECT_DEFEAT:()=>ct,CLASS_SHAPE:()=>hh,CLASS_SHAPE_ICON:()=>qu,CLASS_SHAPE_LABEL:()=>ju,CLASS_SNAPLINE:()=>Vp,CLASS_SNAPLINE_ACTIVE:()=>Jv,CLASS_SNAPLINE_ACTIVE_EXACT:()=>Kv,CLASS_SNAPLINE_EXACT:()=>jf,CLASS_SNAPLINE_HORIZONTAL:()=>Zv,CLASS_SNAPLINE_VERTICAL:()=>Wv,CLASS_SOURCE_HOVER:()=>Ef,CLASS_STRAIGHT_CONNECTOR_EDIT:()=>fy,CLASS_STRAIGHT_DELETE_HANDLE:()=>Kp,CLASS_STRAIGHT_DRAG_HANDLE:()=>ls,CLASS_STRAIGHT_EDITOR_GUIDELINE:()=>jC,CLASS_STRAIGHT_HANDLE:()=>Fh,CLASS_STRAIGHT_SPLIT_HANDLE:()=>Jp,CLASS_SURFACE:()=>tf,CLASS_SURFACE_CANVAS:()=>nf,CLASS_SURFACE_DIRECT:()=>bT,CLASS_SURFACE_EDGE_DRAGGING:()=>In,CLASS_SURFACE_ELEMENT_DRAGGING:()=>hf,CLASS_SURFACE_ELEMENT_FLASH:()=>af,CLASS_SURFACE_NO_PAN:()=>rf,CLASS_SURFACE_PAN:()=>of,CLASS_SURFACE_PANNING:()=>lf,CLASS_SURFACE_PAN_ACTIVE:()=>sf,CLASS_SURFACE_PAN_BOTTOM:()=>k1,CLASS_SURFACE_PAN_LEFT:()=>X1,CLASS_SURFACE_PAN_RIGHT:()=>H1,CLASS_SURFACE_PAN_TOP:()=>j1,CLASS_SURFACE_POINTER_DEVICE:()=>ST,CLASS_SURFACE_TOUCH_DEVICE:()=>AT,CLASS_TARGET_HOVER:()=>ff,CLASS_TOGGLE_GROUP_COLLAPSE:()=>iu,CLASS_TRANSIENT_VERTEX:()=>SL,CLASS_UI_SELECTED_CONNECTION:()=>Dl,CLASS_UI_SELECTED_ELEMENT:()=>Bi,CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE:()=>Hf,CLASS_VERTEX_DRAWING_LASSO:()=>qv,CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE:()=>Up,CLASS_VJS_ANIMATE_EDGE_TRAVERSED:()=>cy,CLASS_VJS_ANIMATE_EDGE_TRAVERSING:()=>Vh,CLASS_VJS_ANIMATE_SOURCE:()=>ly,CLASS_VJS_ANIMATE_TARGET:()=>hy,CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE:()=>aG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSED:()=>lG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSING:()=>Fn,CLASS_VJS_TOOLTIP:()=>kw,CLEAR_PATH:()=>s0,CLEAR_VIEW_BOX:()=>o0,COLOR_PICKER_ELEMENT:()=>x0,COMMIT_CURRENT:()=>XO,COMPONENT_TYPE_CONNECTION:()=>LE,CONNECTION:()=>b1,CONNECTOR_TYPE_CUBIC_BEZIER:()=>Oo,CONNECTOR_TYPE_ORTHOGONAL:()=>Hs,CONNECTOR_TYPE_QUADRATIC_BEZIER:()=>Xd,CONNECTOR_TYPE_SMOOTH:()=>DA,CONNECTOR_TYPE_STRAIGHT:()=>_n,CONNECT_REASON_API:()=>rl,CONNECT_REASON_COPY_PASTE:()=>Ax,CONNECT_REASON_DATA_LOAD:()=>nl,CONNECT_REASON_TRANSIENT:()=>bx,CONNECT_REASON_UNDO_REDO:()=>xx,CONNECT_REASON_USER_ACTIVITY:()=>co,CONTAINMENT_NOT_NEGATIVE:()=>Q0,CONTAINMENT_PARENT:()=>ew,CONTAINMENT_PARENT_ENCLOSED:()=>tw,CONTENT_TYPES:()=>ba,CSV:()=>vN,CandidateSorter:()=>zc,CanvasLayoutAdapter:()=>Qu,CatchAllEventHandler:()=>qc,CategoryValueChart:()=>Xn,CategoryValueTooltip:()=>Fa,CategoryVsAxisPlot:()=>oo,ChartExporter:()=>pm,ChartLegend:()=>dm,ChartSeries:()=>Sr,CircularLayout:()=>Cc,ClickSplitMode:()=>qp,Clipboard:()=>Id,Cluster:()=>mc,CollationSeries:()=>Ma,Collicat:()=>Qp,ColumnChart:()=>tO,ColumnLayout:()=>ol,CommentEntry:()=>Bs,Components:()=>we,CompoundAction:()=>An,Connections:()=>kt,Connectors:()=>Ne,ControlsComponent:()=>bp,ControlsPlugin:()=>wh,CopyData:()=>Nd,CopyPasteControlsComponent:()=>wv,CrossingStage:()=>Ts,CsvReader:()=>Rg,CustomOverlay:()=>Fl,CustomTag:()=>vd,DEFAULT:()=>xe,DEFAULT_ANCHOR_PLACEHOLDER_SIZE:()=>hv,DEFAULT_ARRAY_SERIES_ID_FIELD:()=>jw,DEFAULT_ARRAY_SERIES_LABEL_FIELD:()=>Xw,DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD:()=>zw,DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD:()=>Yw,DEFAULT_ARRAY_SERIES_RANGE_START_FIELD:()=>Fw,DEFAULT_ARRAY_SERIES_STEP:()=>Bw,DEFAULT_ARRAY_SERIES_VALUES_FIELD:()=>Uw,DEFAULT_AXIS_LINE_SIZE:()=>mi,DEFAULT_BACKGROUND_COLOR:()=>Iw,DEFAULT_BAR_GAP:()=>tD,DEFAULT_BEZIER_CONTROL_POINT_SCALE:()=>yA,DEFAULT_BEZIER_LOOPBACK_DISTANCE:()=>A_,DEFAULT_BORDER_HANDLE_SIZE:()=>tC,DEFAULT_CATEGORY_AXIS_FONT_SIZE:()=>ZP,DEFAULT_CATEGORY_AXIS_FONT_STYLE:()=>JP,DEFAULT_CATEGORY_FILL_RATIO:()=>Qw,DEFAULT_CHART_EMPTY_MESSAGE:()=>zP,DEFAULT_CHART_ERROR_MESSAGE:()=>XP,DEFAULT_COLOR:()=>ZT,DEFAULT_COLOR_PROPERTY:()=>Tf,DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE:()=>lv,DEFAULT_CORNER_RADIUS:()=>xm,DEFAULT_DIAGRAM_CELL_HEIGHT:()=>LC,DEFAULT_DIAGRAM_CELL_WIDTH:()=>RC,DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE:()=>N0,DEFAULT_DOT_OVERLAY_RADIUS:()=>bR,DEFAULT_DOWNLOAD_BUTTON_LABEL:()=>Cp,DEFAULT_EDGE_NODE_SIZE:()=>hg,DEFAULT_ELLIPSE_OVERLAY_RADIUS_X:()=>TR,DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y:()=>vR,DEFAULT_EXPORT_FILENAME:()=>vp,DEFAULT_FILL_COLOR:()=>mh,DEFAULT_FILL_PROPERTY:()=>Sf,DEFAULT_FLOWCHART_ARROW_LENGTH:()=>nw,DEFAULT_FLOWCHART_ARROW_WIDTH:()=>rw,DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE:()=>ow,DEFAULT_FLOWCHART_PROPERTY_MARKERS:()=>iw,DEFAULT_GRID:()=>_L,DEFAULT_GRID_LINE_COLOR:()=>jP,DEFAULT_HANDLE_OFFSET:()=>iC,DEFAULT_HEIGHT_ATTRIBUTE:()=>Nx,DEFAULT_HIERARCHICAL_LAYOUT_ALIGN:()=>Mx,DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT:()=>$x,DEFAULT_HIERARCHICAL_LAYOUT_PADDING:()=>Vx,DEFAULT_HIERARCHICAL_LAYOUT_SPACING:()=>Gx,DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT:()=>Nc,DEFAULT_KEY_ALLOW_NESTED_GROUPS:()=>yE,DEFAULT_KEY_ANCHOR:()=>Nl,DEFAULT_KEY_ANCHORS:()=>Il,DEFAULT_KEY_ASTAR_GRID_CELL_SIZE:()=>XI,DEFAULT_KEY_ASTAR_VERTEX_BORDER:()=>aS,DEFAULT_KEY_ASTAR_VERTEX_BUFFER:()=>lS,DEFAULT_KEY_CONNECTOR:()=>su,DEFAULT_KEY_CSS_CLASS:()=>hS,DEFAULT_KEY_EDGES_DETACHABLE:()=>HI,DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE:()=>cS,DEFAULT_KEY_ENSURE_ANCHORS_IN_WHITESPACE:()=>kI,DEFAULT_KEY_GROUP_SIZE:()=>WI,DEFAULT_KEY_HOVER_CLASS:()=>dS,DEFAULT_KEY_HOVER_PAINT_STYLE:()=>au,DEFAULT_KEY_MAX_CONNECTIONS:()=>uS,DEFAULT_KEY_NODE_SIZE:()=>ZI,DEFAULT_KEY_OVERLAYS:()=>jI,DEFAULT_KEY_PAINT_STYLE:()=>Go,DEFAULT_KEY_REATTACH_EDGES:()=>JI,DEFAULT_KEY_SCOPE:()=>xE,DEFAULT_LABEL_FILL_RATIO:()=>nL,DEFAULT_LABEL_LOCATION:()=>yR,DEFAULT_LABEL_LOCATION_ATTRIBUTE:()=>TE,DEFAULT_LABEL_PROPERTY:()=>ki,DEFAULT_LEFT_ATTRIBUTE:()=>Rx,DEFAULT_LEGEND_BACKGROUND_COLOR:()=>$w,DEFAULT_LEGEND_OUTLINE_WIDTH:()=>Gw,DEFAULT_LEGEND_PADDING:()=>Lw,DEFAULT_LINE_STROKE:()=>vh,DEFAULT_MARGIN:()=>Mw,DEFAULT_MAXIMUM_BAR_WIDTH:()=>eD,DEFAULT_MINIMUM_HEIGHT:()=>nC,DEFAULT_MINIMUM_WIDTH:()=>rC,DEFAULT_ORTHOGONAL_STUB:()=>NA,DEFAULT_OUTLINE_COLOR:()=>Zo,DEFAULT_OUTLINE_PROPERTY:()=>uh,DEFAULT_OUTLINE_WIDTH:()=>gh,DEFAULT_OUTLINE_WIDTH_PROPERTY:()=>ph,DEFAULT_PALETTE_SELECTOR:()=>O0,DEFAULT_PAPER_MARGIN:()=>cT,DEFAULT_RECTANGLE_OVERLAY_HEIGHT:()=>SR,DEFAULT_RECTANGLE_OVERLAY_WIDTH:()=>AR,DEFAULT_ROTATE_HANDLE_SIZE:()=>eC,DEFAULT_ROTATE_LEADER_LENGTH:()=>Qv,DEFAULT_ROTATION_ATTRIBUTE:()=>wx,DEFAULT_SET_DESCRIPTION:()=>K1,DEFAULT_SET_NAME:()=>J1,DEFAULT_SHAPE_SETS:()=>wC,DEFAULT_SMOOTHING:()=>U_,DEFAULT_SVG_HANDLE_SIZE:()=>Gp,DEFAULT_TICK_LINE_STROKE:()=>xv,DEFAULT_TICK_MARKS_PER_CELL:()=>RL,DEFAULT_TITLE_PADDING:()=>Fy,DEFAULT_TOP_ATTRIBUTE:()=>Lx,DEFAULT_VALUE_AXIS_FONT_SIZE:()=>bm,DEFAULT_VALUE_AXIS_FONT_STYLE:()=>Am,DEFAULT_VALUE_AXIS_PADDING:()=>WP,DEFAULT_WIDTH_ATTRIBUTE:()=>Dx,DEFAULT_ZOOM_RANGE:()=>pS,DIAGONAL_AXIS_LR:()=>yn,DIAGONAL_AXIS_RL:()=>kn,DRAG_GROUP_MEMBERSHIP_ADDED:()=>_a,DRAG_GROUP_MEMBERSHIP_ASSIGNED:()=>kv,DataModel:()=>Tc,DataSeriesBasedDataSource:()=>mm,Decorator:()=>sp,Decorators:()=>ap,DefaultRouter:()=>$l,DefaultSearchTokenizer:()=>qO,Diagram:()=>Hp,DiagramCell:()=>Un,DiagramExportComponent:()=>VC,DiagramLink:()=>hi,DiagramPalette:()=>Bh,DiagramToolsPlugin:()=>as,DialogConstants:()=>Ae,DiamondOverlay:()=>Cu,DotOverlay:()=>Pu,Drag:()=>Ay,DragGroupsPlugin:()=>ts,DualValueAxisTooltip:()=>Sm,DualValueChart:()=>ja,DualValueChartSeries:()=>Xa,EDGE:()=>vr,EDGE_DRAG_HANDLE:()=>Gn,EDGE_INPUT_METHOD_CLICK:()=>Sh,EDGE_INPUT_METHOD_DRAG:()=>Zi,EDGE_INPUT_STATE_IDLE:()=>Th,EDGE_INPUT_STATE_LOCKED:()=>Pf,EDGE_ROUTING_PLUGIN_MODE_DIRECT:()=>bv,EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL:()=>IV,EDGE_SNAP_CENTER:()=>TV,EDGE_SNAP_DEFAULT:()=>tv,EDGE_SNAP_PERIMETER:()=>yL,EDGE_TYPE_PICKER_ELEMENT:()=>T0,EDGE_UPDATE_REASON_UPDATED:()=>Bb,ELEMENT:()=>x1,ELEMENT_CIRCLE:()=>ze,ELEMENT_DEFS:()=>VS,ELEMENT_DIV:()=>He,ELEMENT_ELLIPSE:()=>GS,ELEMENT_G:()=>q,ELEMENT_INCLUDE_ICON:()=>tL,ELEMENT_INCLUDE_ICONS:()=>rL,ELEMENT_PATH:()=>te,ELEMENT_RECT:()=>Z,ELEMENT_SVG:()=>ve,ELEMENT_TEXT:()=>Je,ELEMENT_TSPAN:()=>DE,EMPTY_ASTAR_PATH:()=>pg,EMPTY_BOUNDS:()=>yi,EMPTY_ELEMENT:()=>H_,ENDPOINT:()=>y1,EVENT_ADHOC_LAYOUT:()=>sb,EVENT_AFTER_LAYOUT_REFRESH:()=>Is,EVENT_BEFORE_START:()=>rP,EVENT_CANVAS_CLICK:()=>xo,EVENT_CANVAS_DBLCLICK:()=>_b,EVENT_CHANGE:()=>Lp,EVENT_CHART_LOAD:()=>um,EVENT_CLICK:()=>Ue,EVENT_CONTEXTMENU:()=>gt,EVENT_CONTEXT_UPDATE:()=>ul,EVENT_DATA_APPEND_END:()=>fg,EVENT_DATA_APPEND_START:()=>Eg,EVENT_DATA_LOAD_END:()=>Mr,EVENT_DATA_LOAD_START:()=>Eo,EVENT_DATA_UPDATED:()=>yg,EVENT_DBLCLICK:()=>yo,EVENT_DBLTAP:()=>Fr,EVENT_DESELECT:()=>pr,EVENT_DESTROY:()=>Pi,EVENT_DRAG:()=>nP,EVENT_DROP:()=>J0,EVENT_EDGE_ADDED:()=>dr,EVENT_EDGE_CLICK:()=>Sb,EVENT_EDGE_CONTEXTMENU:()=>Pb,EVENT_EDGE_DBLCLICK:()=>Tb,EVENT_EDGE_DBLTAP:()=>vb,EVENT_EDGE_GEOMETRY:()=>Zn,EVENT_EDGE_MOUSEDOWN:()=>ml,EVENT_EDGE_MOUSEOUT:()=>gd,EVENT_EDGE_MOUSEOVER:()=>Ed,EVENT_EDGE_MOUSEUP:()=>Cb,EVENT_EDGE_PATH_EDITED:()=>Jn,EVENT_EDGE_REDRAW:()=>fd,EVENT_EDGE_REMOVED:()=>mt,EVENT_EDGE_SOURCE_CHANGED:()=>nn,EVENT_EDGE_TAP:()=>Ob,EVENT_EDGE_TARGET_CHANGED:()=>rn,EVENT_EDGE_TYPE_CHANGED:()=>Xc,EVENT_EDGE_UPDATED:()=>pt,EVENT_ELASTIC_GROUP_FRAME_REMOVE:()=>Vf,EVENT_ELASTIC_GROUP_FRAME_RESIZE:()=>Mf,EVENT_END_NODE_TRAVERSAL:()=>xC,EVENT_END_OVERLAY_ANIMATION:()=>qi,EVENT_FOCUS:()=>hb,EVENT_GRAPH_CHANGED:()=>kx,EVENT_GRAPH_CLEARED:()=>jt,EVENT_GRAPH_CLEAR_START:()=>bn,EVENT_GROUP_ADDED:()=>Xt,EVENT_GROUP_COLLAPSE:()=>cd,EVENT_GROUP_EXPAND:()=>dd,EVENT_GROUP_MEMBER_ADDED:()=>Ci,EVENT_GROUP_MEMBER_REMOVED:()=>Os,EVENT_GROUP_MOVE:()=>Wc,EVENT_GROUP_MOVE_END:()=>Gr,EVENT_GROUP_MOVE_START:()=>Wx,EVENT_GROUP_RELAYOUT:()=>pl,EVENT_GROUP_REMOVED:()=>Me,EVENT_GROUP_RENDERED:()=>$r,EVENT_GROUP_TYPE_CHANGED:()=>kc,EVENT_GROUP_UPDATED:()=>Re,EVENT_INTERNAL_CONNECTION:()=>ob,EVENT_INTERNAL_GROUP_SIZE_CHANGED:()=>Zc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO:()=>Jc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO:()=>Kc,EVENT_INTERNAL_VERTEX_UPDATED:()=>Ms,EVENT_KEYUP:()=>Mn,EVENT_LASSO_END:()=>Rb,EVENT_MOUSEDOWN:()=>ue,EVENT_MOUSEENTER:()=>Cg,EVENT_MOUSEEXIT:()=>Pg,EVENT_MOUSELEAVE:()=>cb,EVENT_MOUSEMOVE:()=>ie,EVENT_MOUSEOUT:()=>et,EVENT_MOUSEOVER:()=>tt,EVENT_MOUSEUP:()=>oe,EVENT_NODE_ADDED:()=>Ht,EVENT_NODE_MOVE:()=>nr,EVENT_NODE_MOVE_END:()=>Lt,EVENT_NODE_MOVE_START:()=>_s,EVENT_NODE_REMOVED:()=>Le,EVENT_NODE_RENDERED:()=>Br,EVENT_NODE_TYPE_CHANGED:()=>jc,EVENT_NODE_UPDATED:()=>Ve,EVENT_NODE_VISIBILITY:()=>pd,EVENT_OBJECT_REPAINTED:()=>lb,EVENT_OUT:()=>q0,EVENT_OVER:()=>K0,EVENT_PAN:()=>gl,EVENT_PLUGIN_ADDED:()=>md,EVENT_PLUGIN_REMOVED:()=>ab,EVENT_PORT_ADDED:()=>Wn,EVENT_PORT_REMOVED:()=>Vr,EVENT_PORT_TYPE_CHANGED:()=>Hc,EVENT_PORT_UPDATED:()=>cr,EVENT_REDO:()=>Kx,EVENT_RELAYOUT:()=>Tn,EVENT_RENDERER_ADDED:()=>Zx,EVENT_RENDER_END:()=>Sn,EVENT_RENDER_START:()=>ud,EVENT_SELECT:()=>ur,EVENT_SELECTION_CLEARED:()=>Cr,EVENT_START:()=>tP,EVENT_START_NODE_TRAVERSAL:()=>ay,EVENT_START_OVERLAY_ANIMATION:()=>Mh,EVENT_STATE:()=>Fp,EVENT_STOP:()=>iP,EVENT_SURFACE_MODE_CHANGED:()=>vn,EVENT_TAP:()=>W,EVENT_TOUCHEND:()=>ub,EVENT_TOUCHMOVE:()=>pb,EVENT_TOUCHSTART:()=>db,EVENT_UNDO:()=>Jx,EVENT_UNDOREDO_UPDATE:()=>Rs,EVENT_VERTEX_CLICK:()=>mb,EVENT_VERTEX_CONTEXTMENU:()=>bb,EVENT_VERTEX_DBLCLICK:()=>gb,EVENT_VERTEX_DBLTAP:()=>Eb,EVENT_VERTEX_MOUSEDOWN:()=>fN,EVENT_VERTEX_MOUSEMOVE:()=>xb,EVENT_VERTEX_MOUSEOUT:()=>fb,EVENT_VERTEX_MOUSEOVER:()=>yb,EVENT_VERTEX_MOUSEUP:()=>EN,EVENT_VERTEX_TAP:()=>Ab,EVENT_ZOOM:()=>fo,EachEntry:()=>Td,Edge:()=>Fe,EdgeGeometryTransformer:()=>tp,EdgeHandlerBase:()=>ua,EdgeInputHandler:()=>dp,EdgePathEditor:()=>ma,EdgeRelocateHandler:()=>up,EdgeRoutingPlugin:()=>Oh,EdgeRoutingStage:()=>Mc,EdgeTypePicker:()=>Np,EditorBase:()=>Ji,ElasticGroupManager:()=>ya,ElementCluster:()=>ag,ElementDragHandler2:()=>kp,ElementDragger:()=>aP,ElementEntry:()=>Ur,ElementTypes:()=>Mi,Elements:()=>Qn,EllipseOverlay:()=>_u,EmptyLayout:()=>bs,EmptyRedrawResult:()=>du,EventGenerator:()=>Zm,EventManager:()=>fe,ExportControlsPlugin:()=>Mp,FACE_BOTTOM:()=>Ct,FACE_LEFT:()=>Tt,FACE_RIGHT:()=>vt,FACE_TOP:()=>Et,FALSE:()=>at,FILL:()=>IS,FIXED:()=>uE,FLOWCHART_EDGE_TYPE_BOTH_ARROWS:()=>lw,FLOWCHART_EDGE_TYPE_DASHED:()=>cw,FLOWCHART_EDGE_TYPE_PLAIN:()=>hw,FLOWCHART_EDGE_TYPE_SOURCE_ARROW:()=>sw,FLOWCHART_EDGE_TYPE_TARGET_ARROW:()=>aw,FLOWCHART_SHAPES:()=>cV,FixedLayer:()=>op,FlowchartBasicEdgeMappings:()=>i$,ForceDirectedLayout:()=>_c,GRID_TYPE_DOTTED:()=>LV,GRID_TYPE_LINES:()=>wV,GROUP_RELAYOUT_ADHOC:()=>Lb,GROUP_RELAYOUT_EXISTING_VERTEX_ADDED:()=>Db,GROUP_RELAYOUT_MEMBER_REMOVED:()=>xN,GROUP_RELAYOUT_NEW_VERTEX_ADDED:()=>wb,GaugeChart:()=>oO,GeneratedGridBackground:()=>Ea,Graph:()=>tl,GridLayout:()=>po,GridProfile:()=>Bl,GridTypes:()=>OL,Group:()=>le,GroupCollapseAction:()=>ld,GroupExpandAction:()=>hd,GroupLayoutAdapter:()=>ep,GroupRemoveAction:()=>td,GroupSizeChangedAction:()=>cl,H:()=>vx,HEIGHT:()=>De,HIERARCHICAL_JSON_DATATYPE:()=>km,HTMLElementOverlay:()=>ql,HeadlessRecado:()=>Xg,HierarchicalLayout:()=>wc,HierarchicalParentRelativePlacementStrategy:()=>Lc,HierarchyLayout:()=>go,HierarchyLayoutModel:()=>Vc,HierarchyLayoutStage:()=>Ss,HilbertCurves:()=>Fs,ICONS_ORIENTATION_HORIZONTAL:()=>WT,ICONS_ORIENTATION_VERTICAL:()=>aV,ICON_CIRCLE:()=>UT,ICON_CLONE:()=>ku,ICON_CROSS:()=>BT,ICON_GEAR:()=>YT,ICON_LINK:()=>Hu,ICON_ORIGIN_CENTER:()=>ah,ICON_ORIGIN_END:()=>lh,ICON_ORIGIN_START:()=>sh,ICON_PLUS:()=>FT,ICON_TRASH:()=>Wu,INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS:()=>v0,INSPECTOR_CONTEXT_RECENT_COLORS:()=>Lh,IconElement:()=>bf,IfEntry:()=>Pd,ImageExportUI:()=>Rh,InBrowserTemplateResolver:()=>xf,Index:()=>Hb,Inspector:()=>wp,JSON_DATATYPE:()=>zt,KEY_OVERLAYS:()=>zI,LASSO_PATH:()=>qL,LASSO_VIEW_BOX:()=>KL,LAYOUT_TYPE_ABSOLUTE:()=>RO,LAYOUT_TYPE_COLUMN:()=>rg,LAYOUT_TYPE_GRID:()=>tg,LAYOUT_TYPE_HIERARCHICAL:()=>MO,LAYOUT_TYPE_HIERARCHY:()=>Fx,LAYOUT_TYPE_ROW:()=>ng,LEFT:()=>Ye,LEGEND_ALIGN_CENTER:()=>Gy,LEGEND_ALIGN_LEFT:()=>Vy,LEGEND_ALIGN_RIGHT:()=>YP,LEGEND_ORIENTATION_HORIZONTAL:()=>My,LEGEND_ORIENTATION_VERTICAL:()=>G$,LEGEND_VERTICAL_ALIGN_BOTTOM:()=>$y,LEGEND_VERTICAL_ALIGN_MIDDLE:()=>tc,LEGEND_VERTICAL_ALIGN_TOP:()=>ec,LINE_WIDTH:()=>$M,LOCATION_ATTRIBUTE:()=>iR,LabelOverlay:()=>ir,Lasso:()=>ga,LassoPlugin:()=>$n,Layouts:()=>qe,LineChart:()=>sO,LinePlot:()=>hc,MagnetizeProfile:()=>Au,Magnetizer:()=>Si,MiniviewPlugin:()=>Bn,ModelSeriesBasedDataSource:()=>ic,MoveAction:()=>Ds,NEGATIVE:()=>Ox,NOMINAL_SIZE:()=>Rn,NONE:()=>ht,Node:()=>de,NodeGroupAction:()=>ed,OBJECT_TYPE_ANCHOR:()=>Jg,OPPOSITE_FACES:()=>QN,ORIENTATION_OPPOSITE:()=>oE,ORIENTATION_ORTHOGONAL:()=>iE,ORIENTATION_PERPENDICULAR:()=>nE,ORTHOGONAL_AXIS_HORIZONTAL:()=>ne,ORTHOGONAL_AXIS_VERTICAL:()=>he,ORTHOGONAL_FACES:()=>qN,ORTHOGONAL_ROUTER_MODE_BUS:()=>ZN,ORTHOGONAL_ROUTER_MODE_SEPARATE:()=>wd,OVERLAY_VISIBILITY_ALWAYS:()=>lu,OVERLAY_VISIBILITY_HOVER:()=>Fi,OptimisticEventGenerator:()=>It,OrthogonalEditor:()=>eo,Overlay:()=>ri,OverlayFactory:()=>nt,PALETTE_MODE_DRAG:()=>Yf,PALETTE_MODE_DRAW:()=>zf,PALETTE_MODE_TAP:()=>Hv,PAN_PATH:()=>r0,PAN_VIEW_BOX:()=>t0,PAPER_ALIGN_CENTER:()=>zo,PAPER_ALIGN_END:()=>Kl,PAPER_ALIGN_START:()=>Jl,PATH_CONSTRAIN_DIAGONAL:()=>Oc,PATH_CONSTRAIN_MANHATTAN:()=>Cx,PATH_CONSTRAIN_METRO:()=>Px,PATH_CONSTRAIN_NONE:()=>en,PATH_CONSTRAIN_ORTHOGONAL:()=>tn,PLACEHOLDER_KEY:()=>bl,PLACEHOLDER_VALUE:()=>Ao,POSITION_RELATIVE:()=>KA,PROPERTY_POSITION:()=>JE,PX:()=>jr,Palette:()=>Ta,PalettePlugin:()=>Dh,PanButtonsPlugin:()=>ns,PanZoom:()=>da,Paper:()=>zh,ParentRelativePlacementStrategy:()=>$c,PathImpl:()=>il,PathTransport:()=>Bp,PathTransportState:()=>yC,PerimeterAnchorShapes:()=>x_,PieChart:()=>lO,PinchListener:()=>ip,PlacementStage:()=>Bc,PlainArrowOverlay:()=>vu,Port:()=>pe,PortAction:()=>nd,PortAddAction:()=>id,PortRemoveAction:()=>od,PriorityQueue:()=>gs,PropertyMapper:()=>Ru,PropertyTracker:()=>bu,QuadraticBezierEditor:()=>ro,REMOVE_CLASS_ACTION:()=>OM,RESET_SELECTION_PATH:()=>i0,RESET_SELECTION_VIEW_BOX:()=>n0,RESIZING_TOOLS_RESIZE_METHOD_BORDERS:()=>oC,RESIZING_TOOLS_RESIZE_METHOD_HANDLES:()=>Nh,RIGHT:()=>ut,ROLLBACK_CURRENT:()=>jO,ROOT_SHAPE_SET:()=>Wi,ROTATION:()=>JD,ROW:()=>Ti,RTREE_DEFAULT_MAX_CHILD_ENTRIES:()=>cA,RTree:()=>Us,RandomColorGenerator:()=>vs,Recado:()=>To,RecadoTemplateRenderer:()=>np,RecordBasedSeries:()=>Qt,RectangleOverlay:()=>Ou,RemoveGroupMemberAction:()=>ad,ResizingToolsPlugin:()=>ss,RowLayout:()=>sl,SEGMENT_TYPE_ARC:()=>Cl,SEGMENT_TYPE_BEZIER:()=>Po,SEGMENT_TYPE_STRAIGHT:()=>On,SELECTION_MODE_EDGES_ONLY:()=>tb,SELECTION_MODE_GROUPS_ONLY:()=>eb,SELECTION_MODE_ISOLATED:()=>Qc,SELECTION_MODE_MIXED:()=>qx,SELECTION_MODE_NODES_ONLY:()=>Qx,SELECTOR_CONNECTOR:()=>Zr,SELECTOR_GROUP:()=>A1,SELECTOR_GROUP_CONTAINER:()=>WS,SELECTOR_MANAGED_ELEMENT:()=>Xl,SELECTOR_OVERLAY:()=>Dn,SELECTOR_TOGGLE_GROUP_COLLAPSE:()=>ZS,SOURCE:()=>Qe,SOURCE_INDEX:()=>UI,STATIC:()=>JA,STRAIGHT_CONNECTOR_AUTO_SPLIT:()=>$G,STRAIGHT_CONNECTOR_CLICK_SPLIT:()=>HC,STROKE:()=>wE,STROKE_WIDTH:()=>MS,SURFACE_MODE_DISABLED:()=>Ko,SURFACE_MODE_PAN:()=>xr,SURFACE_MODE_SELECT:()=>ai,SURFACE_MODE_VERTEX_DRAWING:()=>Vn,SVGElementOverlay:()=>$u,SVG_NAMESPACE:()=>Wt,SankeyChart:()=>uO,ScatterChart:()=>pO,Segments:()=>gr,SelectedEdgeHighlightPlugin:()=>fa,SeriesBasedChart:()=>Ga,ShapeLibraryDefaults:()=>Xu,ShapeLibraryImpl:()=>ia,ShapePalette:()=>jp,ShapeTypeInspector:()=>jv,SimpleBackground:()=>gp,SimpleShapeOverlay:()=>Ln,SingleColorGenerator:()=>Uc,SnaplinesPlugin:()=>rs,SourceValueTargetCsvParser:()=>Xb,StaticColorGenerator:()=>Ux,Storage:()=>sP,StraightEditor:()=>to,StraightSegmentHandler:()=>Ro,SummingSeries:()=>Va,Surface:()=>Yh,SurfaceAnimator:()=>Yp,SvgComponent:()=>Bu,SvgExportComponent:()=>Sa,SvgExportUI:()=>Op,SyntheticDecorator:()=>xh,TAG_SHAPE:()=>$T,TARGET:()=>xn,TARGET_INDEX:()=>YI,TILING_STRATEGY_ABSOLUTE:()=>fv,TILING_STRATEGY_LOGARITHMIC:()=>Ev,TOP:()=>Se,TRUE:()=>At,TWO_PI:()=>Ei,TYPE_ATTRIBUTE:()=>qb,TYPE_EACH:()=>qn,TYPE_ELEMENT:()=>Kn,TYPE_IF:()=>xl,TYPE_ITEM_ANCHORS:()=>mu,TYPE_ITEM_CONNECTOR:()=>_E,TYPE_ITEM_OVERLAY:()=>yS,TYPE_JPG:()=>es,TYPE_PNG:()=>_h,TYPE_ROOT:()=>Zb,TYPE_SVG:()=>Ff,TYPE_TEXT:()=>Ri,TYPE_TMPL:()=>bo,TerminusAddAction:()=>hl,TerminusRemoveAction:()=>ll,TestHarness:()=>im,TextEntry:()=>Di,TiledBackground:()=>Ep,TmplEntry:()=>So,Tooltip:()=>$a,TooltipRenderer:()=>Ba,UICore:()=>Tu,UIModel:()=>cu,UIPlugins:()=>or,UIState:()=>yp,UNDEFINED:()=>_x,UiStatesBrowserUIModel:()=>Nf,UiStatesPlugin:()=>Ph,UndoRedoManager:()=>yd,UpdateAction:()=>_i,UrlSeriesBasedDataSource:()=>gm,V:()=>Pc,VERTEX:()=>mo,VERTEX_DRAWING_PATH:()=>e0,VERTEX_DRAWING_VIEW_BOX:()=>QL,VERTEX_UPDATE_REASON_ADD_NEW_PORT:()=>WO,VERTEX_UPDATE_REASON_ADD_PORT:()=>kO,VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE:()=>fl,VERTEX_UPDATE_REASON_GROUP_RESIZED:()=>Fb,VERTEX_UPDATE_REASON_LAYOUT:()=>SN,VERTEX_UPDATE_REASON_MAGNETIZER:()=>Ub,VERTEX_UPDATE_REASON_MOVED:()=>$s,VERTEX_UPDATE_REASON_REMOVE_PORT:()=>ZO,VERTEX_UPDATE_REASON_RESIZED:()=>zb,VERTEX_UPDATE_REASON_ROTATION:()=>Vs,VERTEX_UPDATE_REASON_SET_POSITION:()=>Ad,VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT:()=>TN,VERTEX_UPDATE_REASON_SNAP_TO_GRID:()=>Yb,VERTEX_UPDATE_REASON_UPDATE_GROUP:()=>$b,VERTEX_UPDATE_REASON_UPDATE_NODE:()=>Gb,VERTEX_UPDATE_REASON_UPDATE_PORT:()=>xd,VERTEX_UPDATE_REASON_UPDATE_VERTEX:()=>_g,VanillaInspector:()=>Ip,Vertex:()=>Ac,VertexDrawingPlugin:()=>li,VertexSet:()=>Fc,Viewport:()=>uu,VisuallyJsModel:()=>bd,VisuallyJsRendererVertexRemovedAction:()=>dl,VisuallyJsSelection:()=>mr,VisuallyJsTestSupport:()=>di,VjsContext:()=>Qd,WIDTH:()=>Te,WILDCARD:()=>Er,WhitespaceReplacingTokenizer:()=>ON,X:()=>Q,XHTML_NAMESPACE:()=>KM,XLINK_NAMESPACE:()=>JM,XYChart:()=>Ua,XYPlot:()=>Yy,X_AXIS_FACES:()=>JN,Y:()=>Ee,Y_AXIS_FACES:()=>KN,ZOOM_IN_OUT_VIEW_BOX:()=>Iv,ZOOM_IN_PATH:()=>a0,ZOOM_OUT_PATH:()=>l0,ZOOM_TO_FIT_PATH:()=>JL,ZOOM_TO_FIT_VIEW_BOX:()=>ZL,_addBinding:()=>Dg,_addConnectorSegment:()=>zr,_adjustForGap:()=>NS,_applyStyles:()=>kE,_areaIfGrownBy:()=>dA,_bindOneAtt:()=>Qb,_calculateSteps:()=>Dy,_clearConnectorSegments:()=>eE,_computeConnector:()=>bI,_computeSingleLocation:()=>Eu,_connectorBoundingBoxIntersection:()=>LA,_connectorBoxIntersection:()=>SI,_connectorGradientAtPoint:()=>xI,_connectorLineIntersection:()=>AI,_connectorPointAlongPathFrom:()=>rt,_connectorPointOnPath:()=>Xr,_createAnchor:()=>OE,_createBaseSegment:()=>zs,_createConnectorBase:()=>Vd,_createContinuousAnchor:()=>ES,_createCubicBezierConnector:()=>D_,_createQuadraticBezierConnector:()=>N_,_createSegment:()=>mA,_defaultGroupHtmlTemplate:()=>oL,_defaultGroupSvgTemplate:()=>aL,_defaultNodeHtmlTemplate:()=>la,_defaultNodeSvgTemplate:()=>ha,_defaultPortHtmlTemplate:()=>iL,_defaultPortSvgTemplate:()=>sL,_defaultSegmentBoundingBoxIntersection:()=>fA,_defaultSegmentBoxIntersection:()=>Sl,_defaultSegmentFindClosestPointOnPath:()=>gA,_defaultSegmentLineIntersection:()=>EA,_emptyRTreeRegion:()=>vo,_findAnchorOrientation:()=>cp,_findConnectorSegmentForLocation:()=>Qg,_findConnectorSegmentForPoint:()=>RA,_findIdealSteps:()=>_w,_findNextHorizontalSegment:()=>IA,_findNextSegmentOfType:()=>jd,_findNextVerticalSegment:()=>VA,_findPreviousHorizontalSegment:()=>MA,_findPreviousVerticalSegment:()=>GA,_findSourceZones:()=>vV,_findTargetZones:()=>bL,_findZones:()=>rv,_getCurrentAnchorLocation:()=>RS,_getDefaultTemplate:()=>KT,_getLabelOverlay:()=>lR,_getSegmentLength:()=>Kg,_getVertexInfo:()=>lp,_growToFit:()=>Hg,_hasLeafNodes:()=>uA,_hideOverlays:()=>sR,_initialiseDecorators:()=>ev,_internalLabelOverlayClass:()=>AS,_internalLabelOverlayId:()=>Qs,_internalSourceMarkerOverlayId:()=>uM,_internalTargetMarkerOverlayId:()=>pM,_isContinuousAnchor:()=>Fo,_isFaceAvailable:()=>Ml,_isLeaf:()=>Dd,_mapToSpline:()=>hE,_padAnchorPoint:()=>wM,_padPoint:()=>PS,_padPointForFace:()=>RM,_padPointForFace2:()=>LM,_placeAnchorsOnLine:()=>_S,_populateSourceZones:()=>iv,_populateTargetZones:()=>Ah,_populateZones:()=>nv,_prepareCompute:()=>rE,_registerSegmentHandler:()=>Ys,_removeAllOverlays:()=>yM,_removeOverlay:()=>Ui,_removeOverlays:()=>xM,_removeShortSegments:()=>Y_,_removeTypeCssHelper:()=>vS,_resetConnectorBounds:()=>_A,_resetConnectorGeometry:()=>Ii,_setAnchorLocation:()=>qg,_setConnectionLabel:()=>bM,_setOrthogonalAnchorOrientation:()=>FI,_setOrthogonalSegmentPosition:()=>WA,_showOverlay:()=>fM,_showOverlays:()=>aR,_trimOrthogonalConnector:()=>ZA,_trimOrthogonalSegments:()=>dE,_trimSegments:()=>cE,_updateConnectorBounds:()=>R_,_updateConnectorSegmentProportions:()=>tE,_updateHoverStyle:()=>gu,_updateRTreeRegionBounds:()=>kg,_writeSegmentedConnectorSegments:()=>Zd,aSegmentDirections:()=>_o,add:()=>fi,addClass:()=>L,addConnectionClass:()=>Wr,addEntryToEachExecution:()=>$g,addNewExecutionToEachExecution:()=>oA,addSegment:()=>vl,addToDictionary:()=>ax,addToList:()=>LD,addWheelListener:()=>Wl,addWithFunction:()=>RD,addXYPlotType:()=>Ya,ajax:()=>na,anchorPlacementEquals:()=>sE,apply:()=>$v,applyConnectionType:()=>SS,applyDomainOverrides:()=>Jw,applyRotations:()=>ux,applyRotationsXY:()=>px,areVerticesConnected:()=>yx,arraysEqual:()=>vO,astarFromViewport:()=>DS,att:()=>be,attWithValue:()=>qr,attachDiagramPalette:()=>EG,attemptCoerce:()=>_p,base64Encode:()=>h0,base64EncodeSvgElement:()=>c0,bezierLineIntersection:()=>Pn,bindDarkModeListener:()=>P1,boundingBoxIntersection:()=>uI,boxIntersection:()=>dI,buildDomainScales:()=>Kw,calculateNestedDepth:()=>Sc,calculatePowerOf10:()=>Rw,calculateSpacingAdjustment:()=>Ai,chebyshevDistance:()=>OD,checkValidity:()=>KV,classList:()=>O1,clear:()=>eG,clone:()=>ot,cloneIcon:()=>nV,cls:()=>X,colourDistance:()=>Yx,computeBezierConnector:()=>Yd,computeBezierLength:()=>vA,computeDomainScales:()=>KP,computeGroupSize:()=>Su,computeRectangleIntersection:()=>_m,computeStraightConnector:()=>Kd,connectorSegmentLength:()=>zA,consume:()=>ae,containsPoint:()=>ms,convertToFullOverlaySpec:()=>ni,convertToMultilineText:()=>Du,createAbstractBezierConnector:()=>Gd,createAndAppendElementNS:()=>Kr,createChartElement:()=>k,createChartTextElement:()=>ds,createColorPickerTag:()=>zv,createComponent:()=>CS,createContrastLabel:()=>cm,createDiagram:()=>fG,createElement:()=>Jr,createElementNS:()=>ta,createFinderFromAnchorPositions:()=>qs,createGateMap:()=>_d,createPaper:()=>HG,createSurface:()=>xG,createXYPlot:()=>QP,data:()=>Pe,debounce:()=>ra,decodeDragGroupSpec:()=>G0,defaultDataGenerator:()=>P0,defaultExportGeometry:()=>fI,defaultIcons:()=>ch,defaultIdFunction:()=>jm,defaultImportGeometry:()=>yI,destroySVGOverlay:()=>ef,diagonalAdjacentCellsFinder:()=>mg,directRouter:()=>hA,dist:()=>AA,distanceFromCurve:()=>C_,djikstra:()=>pc,each:()=>gN,eachNotEmpty:()=>cx,edgeSortFunctions:()=>OS,editors:()=>Lr,emptyBox:()=>Qh,emptyPaintGeometry:()=>b_,encloses:()=>SD,encodedSvgToDataUrl:()=>d0,ensureSVGContentElements:()=>Ql,ensureSVGLabelElements:()=>Xo,euclideanDistance:()=>PD,evaluateExpression:()=>Li,evaluateSingleExpression:()=>Ng,expandRectangle:()=>nx,exportConnectorGeometry:()=>Yr,exportData:()=>Wm,exportImage:()=>Pp,exportSVG:()=>Iy,exportSvg:()=>Aa,extend:()=>Ns,extract:()=>qV,extractBounds:()=>wD,extractPoint:()=>rr,extractSize:()=>Es,extractValueFromElement:()=>p0,faceOrientations:()=>Ni,fastTrim:()=>bt,filterEmpty:()=>hx,filterList:()=>pN,filterNull:()=>ND,findAdjacentSegment:()=>kd,findClosestPoint:()=>yc,findParent:()=>Zt,findParents:()=>S1,findSegment:()=>Hd,fixPrecision:()=>gc,flatten:()=>f_,floydWarshall:()=>Ky,formatValue:()=>Ny,freeMovementAdjacencies:()=>YO,generateConstrainFunctionFromContainmentType:()=>oP,generateInspectorTemplate:()=>C0,getAbsolutePosition:()=>B1,getAllEdges:()=>CO,getAllSourceEdges:()=>VD,getAllTargetEdges:()=>GD,getAncestors:()=>En,getClass:()=>qS,getClosestMidpoint:()=>lx,getComponentXY:()=>_M,getConnectedVertices:()=>FD,getConnectorElement:()=>WR,getContrastColor:()=>Yc,getDefaultFace:()=>tM,getDescendantEdges:()=>Hm,getDescendants:()=>xs,getDownstreamVertices:()=>$D,getEdges:()=>el,getElementSize:()=>it,getElementType:()=>Mu,getEventSource:()=>Yo,getFromSetWithFunction:()=>Nm,getOutlineColor:()=>cN,getPageLocation:()=>DR,getPosition:()=>hn,getPositionOnElement:()=>Vu,getRectangleMidpoints:()=>SO,getSelector:()=>QS,getSourceEdges:()=>mx,getSvgTranslatePosition:()=>eh,getTargetEdges:()=>gx,getTouch:()=>HE,getUpstreamVertices:()=>BD,getsert:()=>fs,gradient:()=>Nr,gradientAtPoint:()=>Bd,gradientAtPointAlongPathFrom:()=>hI,gridBackgroundOptions:()=>DC,hasClass:()=>an,inferAxis:()=>Cs,inferAxisAndDirectionFromOrientation:()=>gg,inferAxisFromSourceAndTargetLocation:()=>jx,inferDirection:()=>Xx,initializeBezierConnectorEditors:()=>KC,initializeOrthogonalConnectorEditors:()=>XC,initializeStraightConnectorEditors:()=>kC,insertRTreeChild:()=>Co,insertSorted:()=>Im,intersectionOfProjectedLines:()=>ix,isAncestor:()=>We,isArrayLike:()=>T1,isArrayOrNodeList:()=>KS,isAssignableFrom:()=>sx,isBarPlot:()=>tB,isBoolean:()=>lo,isCategoryAxis:()=>FP,isConnection:()=>Bo,isConnector:()=>TI,isCustomOverlay:()=>sn,isDOMElement:()=>Xi,isDate:()=>TO,isDescendantGroup:()=>fx,isEdge:()=>Ke,isEdgeNodeEntry:()=>lt,isEdgeSupported:()=>PE,isElement:()=>eT,isEmpty:()=>qa,isFilterableDataset:()=>jb,isFullOverlaySpec:()=>mS,isFunction:()=>Tr,isGroup:()=>Y,isHTMLLabelOverlay:()=>dT,isLabelOverlay:()=>kr,isLoopPresent:()=>tA,isMouseDevice:()=>ii,isNamedFunction:()=>DD,isNestedGroup:()=>Xm,isNode:()=>K,isNodeInsideAGroup:()=>zm,isNodeList:()=>Nn,isNodeVertex:()=>Ex,isNumber:()=>fc,isObject:()=>hr,isPoint:()=>SA,isPort:()=>H,isSVGElement:()=>Ot,isStackedPlot:()=>za,isString:()=>z,isTextNode:()=>v1,isTouchDevice:()=>wn,isValueAxis:()=>mn,isVertex:()=>xi,isVertexNodeEntry:()=>nN,lightweightPrintfFormatter:()=>sA,lineCalculators:()=>Ol,lineIntersection:()=>Rm,lineIntersectsOrIsEnclosedByRectangle:()=>rx,lineLength:()=>Be,lineRectangleIntersection:()=>lr,linesIntersection:()=>xO,linesOverlap:()=>Lm,locationAlongCurveFrom:()=>PA,log:()=>U,logEnabled:()=>AO,makeLightweightAnchorFromArraySpec:()=>pu,makeLightweightAnchorFromSpec:()=>ft,manhattanDistance:()=>Ec,manhattanLineLength:()=>AD,matchesSelector:()=>Mt,merge:()=>gn,mergeDomainExtents:()=>Zw,mergeWithParents:()=>hu,minBy:()=>pA,namedContinuousValues:()=>fS,nearestPointOnCurve:()=>TA,newInstance:()=>dn,newRecadoInstance:()=>yr,newTemplates2Renderer:()=>fh,normal:()=>ex,objectsEqual:()=>Qa,octileDistance:()=>_D,offsetRelativeToRoot:()=>zi,orthogonalAdjacencies:()=>zO,orthogonalAdjacentCellsFinder:()=>zx,orthogonalRouter:()=>lA,pageLocation:()=>me,paintSVGLabelOverlay:()=>mT,paintSimpleShapeOverlay:()=>pT,paintSvgConnector:()=>GT,parallelLineFromPoint:()=>CD,parallelLineTo:()=>qy,parallelLinesTo:()=>ox,parentAxis:()=>Ir,parentDirection:()=>Hx,parse:()=>Tx,parseAttributes:()=>wg,parseAtts:()=>rA,parseExpression:()=>h_,partition:()=>Ka,peek:()=>eA,perpendicularBisectingLine:()=>TD,perpendicularLineTo:()=>tr,perpendicularToPathAt:()=>cI,pointAlongCurveFrom:()=>CA,pointAlongPath:()=>$d,pointOnCurve:()=>js,pointOnLine:()=>Ut,pointsEqual:()=>dx,populate:()=>ho,populateRegions:()=>Ld,prefersDarkMode:()=>C1,processExpression:()=>Al,quadrant:()=>ps,ready:()=>o$,recordGetsert:()=>ys,rectanglesIntersect:()=>ke,registerDecorator:()=>yG,registerEdgeTypePickerTag:()=>Xv,registerExporter:()=>XD,registerParser:()=>Sx,registerPlugin:()=>wt,relocateContinuousAnchor:()=>uv,relocateDynamicAnchor:()=>pv,relocateWithPositionFinder:()=>mv,remove:()=>wm,removeClass:()=>F,removeConnectionClass:()=>Or,removeRTreeChild:()=>Zg,removeWheelListener:()=>Zl,removeWithFunction:()=>_t,renderIcon:()=>Zu,renderNamedIcon:()=>Ju,renderPaper:()=>H0,renderSurface:()=>j0,replace:()=>Gm,resolveIfExecution:()=>Fg,resolveNode:()=>jn,resolveNodeId:()=>Ym,resolvePortId:()=>ID,rotateAnchorOrientation:()=>mN,rotatePoint:()=>xt,routerLineIntersects:()=>aA,routerLineSgn:()=>jg,segmentDirections:()=>_I,segmentLineAngle:()=>YA,segmentedConnectorSegmentLength:()=>ks,setAbsolutePosition:()=>Jt,setElementHeight:()=>xT,setElementRotation:()=>jo,setElementSize:()=>Rr,setElementWidth:()=>yT,setForceMouseEvents:()=>wR,setForceTouchEvents:()=>LR,setOverlayLocation:()=>bE,setPosition:()=>Ce,setSvgTranslatePosition:()=>ln,setTranslatedPosition:()=>$t,setTranslatedX:()=>M$,setTranslatedY:()=>qh,setXPosition:()=>ET,setYPosition:()=>fT,shortUuid:()=>Vm,snapToGrid:()=>se,snapToGridUpperBound:()=>vD,sortAndPlaceEdges:()=>Rd,sourceElementSelector:()=>bh,sourceVertexAvoidance:()=>$A,splitIntoSiblings:()=>Wg,stubCalculators:()=>Pl,stubRelocator:()=>HA,subtract:()=>Qy,suggest:()=>Dm,supportsPathEditing:()=>aT,svgElementToDataUrl:()=>Gv,targetElementSelector:()=>xL,targetVertexAvoidance:()=>BA,testIntersectingDropTarget:()=>hp,theta:()=>tx,toggleClass:()=>qE,touchCount:()=>HS,touches:()=>Uo,transformAnchorPlacement:()=>Xs,transformBezierGeometry:()=>zd,transformSegmentedGeometry:()=>qd,translateRect:()=>Mm,updateBezierConnector:()=>Ud,updateClasses:()=>Vt,updateEditedOrthogonalConnector:()=>XA,updateStraightConnector:()=>Jd,uuid:()=>V,valueInRange:()=>Tl,vertexAvoidance:()=>FA,wrap:()=>rd,xml:()=>JS});module.exports=yD(hB);function pc(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={},m=i.strict!==!1,g=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let _=p[C.getFullId()];return u[_.v.id]},x=(C,_)=>{let w,B;if(C.objectType===pe.objectType){for(s[C.getFullId()]=_,w=y(C),B=0;B<w.length;B++)w[B].p!=C&&(s[w[B].p.getFullId()]=_+C.getParent().getInternalEdge(C,w[B].p).cost);m||(s[C.getParent().id]=_)}else for(s[C.id]=_,w=u[C.id],B=0;B<w.length;B++)s[w[B].p.getFullId()]=_},f=C=>n&&!n(C)?1/0:s[g(C)],b=(C,_,w)=>{if(C.objectType===pe.objectType){let B=y(C);for(let D=0;D<B.length;D++)a[B[D].p.getFullId()]=w.node;m||(a[C.getParent().id]=w.node)}a[_]=w.node},A=(C,_,w)=>{if(C.objectType===pe.objectType){let B=y(C);for(let D=0;D<B.length;D++)l[B[D].p.getFullId()]=w;m||(l[C.getParent().id]=w)}l[_]=w},T=(C,_,w,B,D)=>{let M=-1,N=null,G=1/0;for(let J=0;J<C.length;J++)if(!_[J]){let ye=D(C[J]);ye<G?(G=ye,M=J,N=C[J]):ye===G&&C[J].objectType===pe.objectType&&C[J].getParent()===N&&(M=J,N=C[J])}return{node:N,index:M}},S=(C,_)=>{let w=_.getFullId(),B=C[w];return B==null&&(w=_.getParent?_.getParent().id:_.id,B=C[w]),B==null?null:{p:B,id:w}},R=(C,_,w,B,D,M)=>{let N=[],G=B,J=S(_,G);for(;J!=null;)N.splice(0,0,{vertex:G,cost:C[J.id],edge:w[J.id]}),G=J.p,J=S(_,G);return N.splice(0,0,{vertex:G,cost:0,edge:null}),N},v=C=>{for(let _=0;_<C.length;_++){let w=C[_],B=w.getPorts();E.push(w);let D={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let M=0;M<B.length;M++)E.push(B[M]),p[B[M].getFullId()]=D,u[w.id].push({p:B[M],i:E.length-1}),x(B[M],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 O=new Array(r.nodes.length),P=0,I=(C,_,w,B)=>{for(let D=0;D<_.length;D++){let M=_[D];if(w(M)){let N=B(M),G=N.tp||N.tn,J=g(G),ye=f(C.node)+M.getCost(),j=f(G);ye<j&&(x(G,ye),b(G,J,C),A(G,J,M))}}};for(;P<E.length;){let C=T(E,O,s,g,f),_=C.node?g(C.node):null;if(!C.node||f(C.node)==1/0||t&&(_==g(t)||!m&&C.node.objectType===pe.objectType&&C.node.isChildOf(t))&&(h.path=R(s,a,l,t,g),h.pathDistance=h.path[h.path.length-1].cost,!d))break;O[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!m&&w.source.objectType===pe.objectType&&w.source.isChildOf(C.node),w=>{var B=w.source.objectType===pe.objectType?w.source.getParent():w.source,D=w.source.objectType===pe.objectType?w.source:null,M=w.target.objectType===pe.objectType?w.target.getParent():w.target,N=w.target.objectType===pe.objectType?w.target:null;return w.source==C.node||!m&&w.source.objectType===pe.objectType&&w.source.isChildOf(C.node)?{tn:M,tp:N}:{tn:B,tp:D}})}return h}function Ky(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 mc=class{constructor(r){c(this,"vertices");c(this,"q");this.vertices=[r],this.q=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.q.add(e))}get edges(){return Array.from(this.q)}};var xD=[null,[1,-1],[1,1],[-1,1],[-1,-1]],bD=[null,[-1,-1],[-1,1],[1,1],[1,-1]],Ei=2*Math.PI;function fi(i,r){return{x:i.x+r.x,y:i.y+r.y}}function Qy(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 ex(i,r){return-1/Nr(i,r)}function Be(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function AD(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function ps(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function tx(i,r){let e=Nr(i,r),t=Math.atan(e),n=ps(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function ke(i,r){let e=i.x,t=i.x+i.width,n=i.y,o=i.y+i.height,s=r.x,a=r.x+r.width,l=r.y,h=r.y+r.height;return e<=s&&s<=t&&n<=l&&l<=o||e<=a&&a<=t&&n<=l&&l<=o||e<=s&&s<=t&&n<=h&&h<=o||e<=a&&s<=t&&n<=h&&h<=o||s<=e&&e<=a&&l<=n&&n<=h||s<=t&&t<=a&&l<=n&&n<=h||s<=e&&e<=a&&l<=o&&o<=h||s<=t&&e<=a&&l<=o&&o<=h}function _m(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 yO(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:gc(r*i[0].x+e*i[0].y)}}function gc(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}function Rm(i,r){let e=yO(i),t=yO(r),n=e.A*t.B-t.A*e.B;if(n==0)return null;{let o={x:Math.round((t.B*e.C-e.B*t.C)/n),y:Math.round((e.A*t.C-t.A*e.C)/n)},s=Math.floor(Math.min(i[0].x,i[1].x)),a=Math.round(Math.max(i[0].x,i[1].x)),l=Math.floor(Math.min(i[0].y,i[1].y)),h=Math.round(Math.max(i[0].y,i[1].y)),d=Math.floor(Math.min(r[0].x,r[1].x)),u=Math.round(Math.max(r[0].x,r[1].x)),p=Math.floor(Math.min(r[0].y,r[1].y)),m=Math.round(Math.max(r[0].y,r[1].y));return o.x>=s&&o.x<=a&&o.y>=l&&o.y<=h&&o.x>=d&&o.x<=u&&o.y>=p&&o.y<=m?o:null}}function lr(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=Rm(i,n);o!=null&&e.push(o)}),e}function rx(i,r){return ms(r,i[0],!0)||ms(r,i[1],!0)||lr(i,r).length>0}function SD(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,m,g,E)=>e?p<=m&&g>=E:p<m&&g>E;return u(t,a,n,l)&&u(o,h,s,d)}function ms(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 Ut(i,r,e){let t=Nr(i,r),n=ps(i,r),o=e>0?xD[n]:bD[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 tr(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 TD(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 se(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 vD(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 xO(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 Lm(i,r,e,t,n=0){let o=xO(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function nx(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 ix(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),m=n+u*(o-n);return{x:p,y:m}}function qy(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 ox(i,r){return[qy(i,r),qy(i,-r)]}function CD(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 Ec=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),PD=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),OD=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),_D=(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};var AO=!0;function U(...i){if(AO&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function sx(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function wm(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function RD(i,r,e){i.findIndex(e)===-1&&i.push(r)}function ax(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function LD(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function Dm(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function Nm(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function _t(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function xt(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 bt(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 Im(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 yi(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function rr(i){return{x:i.x,y:i.y}}function Es(i){return{width:i.width,height:i.height}}function wD(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function Mm(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Yt=[];for(let i=0;i<256;i++)Yt[i]=(i<16?"0":"")+i.toString(16);function V(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Yt[i&255]+Yt[i>>8&255]+Yt[i>>16&255]+Yt[i>>24&255]+"-"+Yt[r&255]+Yt[r>>8&255]+"-"+Yt[r>>16&15|64]+Yt[r>>24&255]+"-"+Yt[e&63|128]+Yt[e>>8&255]+"-"+Yt[e>>16&255]+Yt[e>>24&255]+Yt[t&255]+Yt[t>>8&255]+Yt[t>>16&255]+Yt[t>>24&255]}function Vm(i=6){return V().substring(0,i-1)}function SO(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 lx(i,r){let e=SO(r).map(t=>({p:t,d:Be(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function Pe(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=Pe(i,d[1]);a[bt(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,m=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let g=m(),E=u[3];e==null?s=g[E]:g[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let g=m();o=g[u[3]]||function(){return g[u[3]]={},g[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function Ka(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 hx(i){return i.filter(r=>r!=null&&bt(r).length>0)}function cx(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function yc(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 fs(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function ys(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function fc(i){return Object.prototype.toString.call(i)==="[object Number]"}function z(i){return typeof i=="string"}function lo(i){return typeof i=="boolean"}function hr(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function TO(i){return Object.prototype.toString.call(i)==="[object Date]"}function Tr(i){return Object.prototype.toString.call(i)==="[object Function]"}function DD(i){return Tr(i)&&i.name!=null&&i.name.length>0}function qa(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function Qa(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(!bO(t,n))return!1}return!0}function ND(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function ot(i){if(z(i))return""+i;if(lo(i))return!!i;if(TO(i))return new Date(i.getTime());if(Tr(i))return i;if(Array.isArray(i))return i.map(r=>ot(r));if(hr(i)){let r={};for(let e in i)r[e]=ot(i[e]);return r}else return i}function gn(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=ot(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(z(r[s])||lo(r[s])||Tr(r[s])||fc(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(hr(r[s])){hr(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function bO(i,r){if(i!=null&&r==null)return!1;if((i==null||z(i)||lo(i)||fc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!vO(i,r))return!1}else return!1;else if(hr(i))if(hr(i)){if(!Qa(i,r))return!1}else return!1;return!0}function vO(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(!bO(i[e],r[e]))return!1;return!0}function dx(i,r){return i.x===r.x&&i.y===r.y}function ux(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=xt(t,n.c,n.r)}),t}function px(i,r){return r.forEach(e=>{i=xt(i,e.c,e.r)}),i}function Gm(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 ho(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(z(s))return n(s);if(Tr(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(hr(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var gs=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){Im(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 Ym(i){return H(i)?i.getParent().id:i.getFullId()}function jn(i){return H(i)?i.getParent():i}function ID(i){return H(i)?i.id:null}function K(i){return i!=null&&i.objectType===de.objectType}function zm(i){return K(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===le.objectType}function Xm(i){return Y(i)&&i.group!=null}function Ke(i){return i!=null&&i.objectType===Fe.objectType}function H(i){return i!=null&&i.objectType===pe.objectType}function Ex(i){return i.objectType===de.objectType||i.objectType===le.objectType}function xi(i){return K(i)||Y(i)||H(i)}function jm(i){return i.id}var MD=".";function el(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 CO(i,r){let e=el(i,r).slice(0);if(K(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,el(i.ports[t],r));return e}function mx(i){return el(i,r=>r.source==i)}function gx(i){return el(i,r=>r.target==i)}function VD(i){let r=mx(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,mx(i.ports[e]));return r}function GD(i){let r=gx(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,gx(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?CO(l,h):el(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function Sc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function En(i){let r=jn(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function We(i,r){return i==null||r==null?!1:En(i).indexOf(r)!==-1}function fx(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 xs(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function $D(i,r){let t=!(K(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function BD(i,r){let t=!(K(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function FD(i,r){let e=new Set,t=K(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 yx(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var tl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"Le",new Map);c(this,"_r",new Map);c(this,"Fe",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"zt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Ro",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.zt=r.defaultIdFunction||jm,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||MD}Qs(r){delete this.Ro[r.id]}ea(r){this.Ro[r.id]=r}mg(){this.Ro={}}getIdFunction(){return this.zt}setIdFunction(r){this.zt=r}setTypeFunction(r){this.typeFunction=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?V():typeof r=="string"?r:(e||this.getIdFunction())(r)||V()}getTopLevelElements(){return this.Ro}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.Le.get(e[0])||this.Fe.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===pe||r.constructor===de||r.constructor===le)return r;let s=r;if(t=this.zt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.Le.has(s))return this.Le.get(s);if(this.Fe.has(s))return this.Fe.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.Le.get(l)||this.Fe.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.Le.clear(),this._r.clear(),this.Fe.clear(),this.mg()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this._r.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 Fe({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._r.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new de(this,r||{},e||this.zt);return this.Le.has(t.id)?null:(this.nodes.push(t),this.Le.set(t.id,t),this.ea(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.zt)}addGroup(r,e){let t=new le(this,r,e||this.zt);return this.Fe.has(t.id)?this.Fe.get(t.id):(this.groups.push(t),this.Fe.set(t.id,t),this.ea(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.Fe.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.Qs(n))}$addMembersToGroup(r,e){for(let t=0;t<r.length;t++)this.$addMemberToGroup(r[t],e)}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.ea(e))}$removeMembersFromGroup(r){for(let e=0;e<r.length;e++)this.$removeMemberFromGroup(r[e])}getGroup(r){return typeof r=="string"?this.Fe.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Fe.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}=Ka(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.Fe.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.Qs(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.Le.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.Qs(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._r.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Fe)return r;let e=r;if(r=this.zt(r),typeof r!="string")return e}return this._r.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._r.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this._r.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 pc({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=pc({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=pc({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,m)=>{let g=u.parents[h][d];if(g.length==0){let E=p.slice();E.unshift(h),m.push(E)}else for(let E=0;E<g.length;E++)if(p.indexOf(g[E][0].id)==-1){let y=p.slice();y.unshift(g[E][0].id),s(h,g[E][0].id,u,y,m)}},a=this.getVertex(r),l=Ky({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 m=0;m<u.length;m++){let g=u[m].indexOf(a.id);g>0&&g<u[m].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
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===pe.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.ph(this.nodes,this.groups)}getCluster(r){let e=K(r)?[r]:[],t=Y(r)?[r]:[];return this.ph(e,t)[0]}ph(r,e){let t=[],n={},o,s=(a,l)=>{if(a==null||n[a.id])return;l==null?(l=new mc(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}},bc=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 xc(i){return i instanceof pe?i.id:i}var Ac=class extends bc{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,"nestedGraphs",[]);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 tl({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})}$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}},Fm=class Fm extends Ac{constructor(e,t,n){super(e,t,n);c(this,"objectType",Fm.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 pe(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=xc(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=xc(e),o=xc(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=xc(e),a=xc(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(Fm,"objectType","Node");var de=Fm,Um=class Um extends Ac{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",Um.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(Um,"objectType","Port");var pe=Um,Ym=class Ym extends de{constructor(e,t,n){super(e,t,n);c(this,"objectType",Ym.objectType);c(this,"members",[]);c(this,"Lo",{})}$addMember(e){return this.Lo[e.id]!=null?!1:(this.members.push(e),this.Lo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Lo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Lo[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(Ym,"objectType","Group");var le=Ym,zm=class zm extends bc{constructor(e){super(e.graph,e.data);c(this,"objectType",zm.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(zm,"objectType","Edge");var Fe=zm;var bx="undoRedo",co="userActivity",rl="api",nl="dataLoad",Ax="transient",Sx="copyPaste";var UD=(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 m=l.get(p);m!=null&&m.forEach(g=>{h.push(r.addGroup(g).id)}),l.delete(p),m!=null&&m.forEach(g=>{d(g.id)})};for(let p=0;p<o.length;p++){let m=o[p];if(e.groupDecorator&&e.groupDecorator(m),m.group!=null&&h.indexOf(m.group)===-1)ys(l,m.group,()=>[]).push(m);else{let g=r.addGroup(m);a.set(g.id,m),h.push(g.id),d(g.id)}}l.forEach((p,m)=>{if(h.indexOf(m)===-1)throw new Error("Parent group ["+m+"] not found");p.forEach(g=>h.push(r.addGroup(g).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let m=r.addNode(t[p]);s.set(m.id,t[p])}function u(p){return z(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let m=n[p].data||{},g={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:m};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(m,E,y)}n[p].anchors&&(g.anchors=n[p].anchors),n[p].geometry&&(g.geometry=n[p].geometry),r.$_addEdge(g,nl,null)}},YD=(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.group,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===pe.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.group,t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===pe.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},zD=(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},nl,null),t(n.children[s])}};t(i)},zt="json",Zm="hierarchical-json",PO={[zt]:YD},OO={[zt]:UD,[Zm]:zD};function Tx(i,r){OO[i]=r}function XD(i,r){PO[i]=r}function vx(i,r,e,t){let n=OO[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function Jm(i,r,e){let t=PO[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var Km=class{constructor(){c(this,"Ue",{});c(this,"ta",!1);c(this,"ra",!1);c(this,"gg",{ready:!0});c(this,"mh",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.ra)this.mh.unshift(arguments);else{if(this.ra=!0,!this.ta&&this.Ue[r]){let o=this.Ue[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.gg[r])this.Ue[r][s](e,t);else try{n=this.Ue[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.Ue==null||this.Ue[r]==null)&&(a=!0)}}this.ra=!1,this.Eg()}return n}Eg(){let r=this.mh.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.Ue={};else if(arguments.length===1){if(typeof r=="string")delete this.Ue[r];else if(r.Wn){let t;for(let n in r.Wn)t=r.Wn[n],Nm(this.Ue[t]||[],r)}}else arguments.length===2&&Nm(this.Ue[r]||[],e);return this}getListener(r){return this.Ue[r]||[]}isSuspendEvents(){return this.ta}setSuspendEvents(r){this.ta=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=>{lx(this.Ue,o,e,t),e.Wn=e.Wn||{},e.Wn[V()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},It=class extends Km{shouldFireEvent(r,e,t){return!0}};var il=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"gh",[]);c(this,"qr",{});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.gh.push(this.result.path[t].vertex),this.qr[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==pe.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.gh}getVertex(r){return this.qr[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.qr[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}ze(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.ze((e,t)=>{r(e,t)})}eachVertex(r){this.ze((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.ze((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.ze((e,t)=>{K(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.ze((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 Tc=class{constructor(r,e){c(this,"Eh",new Map);c(this,"fh",new Map);c(this,"yh",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Eh.set(s,t[s]);let n=e.groups||{};for(let s in n)this.fh.set(s,n[s]);let o=e.ports||{};for(let s in o)this.yh.set(s,o[s])}}getNodeDefinition(r){return this.Eh.get(r)||{}}getGroupDefinition(r){return this.fh.get(r)||{}}getPortDefinition(r){return this.yh.get(r)||{}}};var fn=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,"Zn");this.Zn=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||{}}Jn(){this.done=!1,this.$vertices.length=0,this.reset()}static fg(){return{padding:{x:0,y:0}}}yg(){let r=Object.assign(i.fg(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return xs(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}xg(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}}xh(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.yg();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,m,g)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,m),s=Math.min(s,g),a=Math.max(a,m+E.width),l=Math.max(l,g+E.height),t[p]={x:m,y:g}},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(m=>p[m.id]=t[m.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.Jn(),r!=null&&(this.parameters=r),this.xh(e)}layout(r){this.done=!1,this.xh(r)}};var vc=class{};var _O={},qe={get:(i,r)=>{let e=_O[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{_O[i]=r}};var qm=class qm extends fn{constructor(e){super(e);c(this,"type",qm.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(qm,"type","Empty");var As=qm;qe.register(As.type,As);function jD(i){return{x:i.data.left,y:i.data.top}}var Hn=class extends fn{constructor(e){super(e);c(this,"bh");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.bh=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.bh||jD)(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)}},RO="Absolute",Qm=class Qm extends Hn{constructor(e){super(e);c(this,"type",Qm.type)}getDefaultParameters(){return{}}};c(Qm,"type",RO);var uo=Qm;qe.register(uo.type,uo);function HD(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var eg=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],tg=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],LO=[null,[eg[0],tg[1]],[eg[0],tg[0]],[eg[1],tg[0]],[eg[1],tg[1]]],kD=(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 HD(r,"x","width",s)?(l=LO[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=LO[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Si(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=ms(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return kD(i,r,n,s,o)}function Ai(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 wO(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 WD={x:20,y:20},ZD=1/0;function DO(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=se(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 Ti=class{constructor(r){c(this,"we");c(this,"$");c(this,"na");c(this,"ht");c(this,"Ah");c(this,"Rr",null);c(this,"Qr");c(this,"F");c(this,"en");c(this,"Sh");c(this,"U",[]);c(this,"ne",new Map);c(this,"wo",new Map);c(this,"rn",new Map);c(this,"nn",new Set);c(this,"Do",!1);c(this,"Th");c(this,"At",new Map);this.en=r.positionGetter,this.Sh=r.positionSetter,this.F=r.getId,this.Qr=r.getSize,this.$=wO(r.elements||[]),this.ht=r.filter||(e=>!0),this.Ah=r.exclude||(e=>!1),this.na=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.$.length>0?(this.Kn((e==null?void 0:e.getSize)||this.Qr,(e==null?void 0:e.getPosition)||this.en,e==null?void 0:e.knownLocations),this.ia(r),this.Rr=null,this.oa(e)):{original:{},current:{}}}executeAtCenter(r){if(this.$.length>0){let e=this.Kn((r==null?void 0:r.getSize)||this.Qr,(r==null?void 0:r.getPosition)||this.en,r==null?void 0:r.knownLocations);return this.ia({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Rr=null,this.oa(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.$.length>0?(this.Kn((e==null?void 0:e.getSize)||this.Qr,(e==null?void 0:e.getPosition)||this.en,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Rr={id:r,bounds:this.ne.get(r),element:this.$.find(t=>t.id===r)},this.ia(this.Rr.bounds.center),this.oa(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.Kn(this.Qr,this.en);for(let t=0;t<this.U.length;t++){let n=this.ne.get(this.U[t].id),{moved:o,pos:s}=DO(this.U[t].bounds,r);o&&(e.original[this.U[t].id]=n,e.current[this.U[t].id]=s)}return this.Ch(e),e}setElements(r){return this.$=wO(r),this}startTracking(r,e,t){return this.setElements(r),this.Kn(this.Qr,this.en),this.Th=t||ZD,this.rn.clear(),this.nn.clear(),this.wo.entries().forEach(n=>{this.rn.set(n[0],Object.assign({},n[1]))}),this.Do=e,this}stopTracking(){this.rn.clear(),this.nn.clear(),this.Do=!1}addElement(r,e){return r!=null&&(e||this.$.indexOf(r)===-1)&&this.$.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.$,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.$.length;t++)if(this.$[t]===r){e=t;break}return e!==-1&&this.$.splice(e,1),this}reset(){this.$.length=0}ia(r){r!=null&&(this.we=r)}Kn(r,e,t,n){return this.U.length=0,this.ne.clear(),this.wo.clear(),this.At.clear(),this.Ag(this.$,r,e,t,n)}Ag(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]),m=this.F(r[d]),g={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.ne.set(m,g),this.wo.set(m,Object.assign({},g)),this.U.push({bounds:g,id:m,element:r[d]}),this.At.set(m,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}}Sg(r,e,t,n){if(this.rn.has(r)){let o=this.rn.get(r),s=this.ne.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Be(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.Th)return null;let p=null,m=0;for(let g=1;g<d;g++){let E={x:a.x+g*h*Math.cos(u),y:a.y+g*h*Math.sin(u)},y=Ai(E,o,{x:0,y:0});DO(y,n);let x=!0;for(let f=0;f<this.U.length;f++){let b=this.U[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=Ai(A.center,A,e);if(ke(y,T)){x=!1;break}}}if(x)m=g,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:m===d-1,positionReached:p}:null}else return null}Tg(r={},e,t,n,o){if((this.Do&&!o||!this.Do&&o)&&this.nn.size>0){let a=!1;for(;!a;){let l=!0;this.nn.forEach(h=>{let d=this.Sg(h,e,t,n);if(d!=null&&d.moved){let u=this.rn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let m=this.ne.get(h);m.x=p.x,m.y=p.y,m.center.x=p.x+u.width/2,m.center.y=p.y+u.height/2,d.reverted&&this.nn.delete(h),l=!1}}),a=l}}}oa(r){let e={};if(this.$.length>1){r=r||{};let n=r.filter||this.ht,o=r.padding||WD,s=r.iterations,a=r.exclude||this.Ah;r.gather&&Object.assign(e,this.vg(o,this.na,n,a)),Object.assign(e,this.Cg(o,this.na,n,s,a,r.grid)),this.Tg(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.wo.get(n),t.current[n]=e[n],this.nn.add(n);return this.Ch(t),t}vg(r,e,t,n){let o={},s=Ai(this.we,{width:0,height:0},r);this.Oh();let a={},l=h=>{let d=[this.we,h],u=[];Array.prototype.push.apply(u,lr(d,s).map(p=>[s,p,null]));for(let p in a){let m=this.ne.get(p);Array.prototype.push.apply(u,lr(d,m).map(g=>[m,g,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.U.length;h++){if(n(this.U[h].id,this.U[h].element))continue;let d=this.U[h].bounds,u=this.U[h].bounds,p=Ai(d.center,u,r);if(t(this.U[h].id,this.U[h].element)){let m=l(d.center);if(m.length>0){m.sort((y,x)=>{let f=Be(y[1],d),b=Be(x[1],d);return f<b?-1:1});let g=m[0][0],E=Si(g,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.U[h].id]=d,a[this.U[h].id]=!0}}}return o}Cg(r,e,t,n,o,s){n=n||2;let a,l;this.Rr!=null?(a=Ai(this.we,this.Rr.bounds,{x:0,y:0}),l=this.Rr.id):a=Ai(this.we,{width:0,height:0},r),this.Oh();let h=1,d=!0,u,p,m={},g=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,m[x]=f},E=(x,f)=>{if(s==null)return f;{let b=yi(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),R=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*R};return ex(v,x)}},y=()=>{let x,f;for(let b=0;b<this.U.length;b++){if(x=this.U[b],o(x.id,x.element))continue;let A=x.bounds,T=Ai(A.center,A,r);x.id!==l&&t(x.id,x.element)&&ke(a,T)&&(u=Si(a,T),u=E(A,u),p=e(x.id,A,u),g(x.id,A,p.x,p.y),T=Ai(A.center,A,r));for(let S=0;S<this.U.length;S++)if(b!==S){if(f=this.U[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let R=f.bounds,v=Ai(R.center,R,r);ke(T,v)&&(d=!0,u=Si(T,v),u=E(R,u),p=e(f.id,R,u),g(f.id,R,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),m}Ch(r){for(let e=0;e<this.$.length;e++){let t=this.F(this.$[e]);r.current[t]&&this.Sh(this.$[e],r.current[t])}}Oh(){let r={};this.U.sort((e,t)=>{let n=r[e.id]||Math.min(Be(e.bounds,this.we),Be(yi(e.bounds,{x:e.bounds.width,y:0}),this.we),Be(yi(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.we),Be(yi(e.bounds,{x:0,y:e.bounds.height}),this.we)),o=r[t.id]||Math.min(Be(t.bounds,this.we),Be(yi(t.bounds,{x:t.bounds.width,y:0}),this.we),Be(yi(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.we),Be(yi(t.bounds,{x:0,y:t.bounds.height}),this.we));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var NO={x:30,y:30},rg=class rg extends fn{constructor(e){super(e);c(this,"Ph");c(this,"type",rg.type);c(this,"padding",NO);this.Ph=e.options.centerRoot===!0,this.padding=e.options.padding||NO}getDefaultParameters(){return{padding:this.padding,locationFunction:this.Zn}}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.Ph&&a.length>0){let E=this.getSize(a[0].id,o);p=Math.max(E.width,E.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let m=2*Math.PI/a.length,g=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m,d>0){let E=a[d-1],y=this.getSize(E.id,o),x=t(E.id),f={x:x.x-s.padding.x,y:x.y-s.padding.y,width:y.width+2*s.padding.x,height:y.height+2*s.padding.y},b=a[d],A=this.getSize(b.id,o),T=t(b.id),S={x:T.x-s.padding.x,y:T.y-s.padding.y,width:A.width+2*s.padding.x,height:A.height+2*s.padding.y},R=Si(f,S),v=[x.x+y.width/2,x.y+y.height/2],O=[T.x+R.x+A.width/2,T.y+R.y+ +(A.height/2)],P=Math.sqrt(Math.pow(v[0]-O[0],2)+Math.pow(v[1]-O[1],2));p=Math.max(p,P/2/Math.sin(m/2))}for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m;this.done=!0}};c(rg,"type","Circular");var Cc=rg;qe.register(Cc.type,Cc);var ng="Grid",ig="Column",og="Row";var Te="width",De="height",JD="rotation",Pc="v",Cx="h",Se="top",Ye="left",ut="right",st="bottom",Rt="center",Q="x",Ee="y",yn="dlr",kn="drl",en="none",tn="orthogonal",Px="manhattan",Oc="diagonal",Ox="metro",_x=-1,he="v",ne="h",Rx="undefined",xe="default",At="true",at="false",Lx="left",wx="top",Dx="rotation",Nx="width",Ix="height",Qe="source",xn="target";var KD={x:30,y:30},vi="row",Mx="column",po=class extends fn{constructor(e){super(e);c(this,"sn",[]);c(this,"sa");c(this,"aa");c(this,"de");c(this,"an");c(this,"ln");c(this,"Lr");c(this,"wr");c(this,"type");this.type=ng,this.de=e.options.orientation||vi,this.padding=e.options.padding||KD,this.sa=e.options.verticalAlignment||Rt,this.aa=e.options.horizontalAlignment||Rt,this.an=e.options.rows||-1,this.ln=e.options.columns||-1}getDefaultParameters(){return{orientation:vi,rows:-1,columns:-1}}begin(e,t,n,o,s){this.sn.length=0;let a,l;if(this.an===-1&&this.ln===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.de===vi?1:0),l=p+(this.de===Mx?1:0)}else this.an!==-1?(a=this.an,l=Math.ceil(this.$vertices.length/a)):this.ln!==-1&&(l=this.ln,a=Math.ceil(this.$vertices.length/l));this.Lr=-1/0,this.wr=-1/0;let h=0,[d,u]=this.de===vi?[a,l]:[l,a];for(let p=0;p<d;p++){this.sn[p]=[];for(let m=0;m<u;m++)if(h=p*u+m,h<this.$vertices.length){let g=this.$vertices[h],E=this.getSize(g.id,o);this.Lr=Math.max(this.Lr,E.width),this.wr=Math.max(this.wr,E.height),this.sn[p][m]={vertex:g,size:E}}}}end(e,t,n,o,s){}reset(){}Og(e){let t=this.de===vi&&this.an===1||this.aa===Ye?0:this.aa===Rt?(this.Lr-e.width)/2:this.Lr-e.width,n=this.de===Mx&&this.ln===1||this.sa===Se?0:this.sa===Rt?(this.wr-e.height)/2:this.wr-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.sn.length;h++){for(let d=0;d<this.sn[h].length;d++){let u=this.sn[h][d],{padX:p,padY:m}=this.Og(u.size);n(u.vertex.id,a+p,l+m),this.de===vi?a+=this.padding.x*2+(this.an===1?u.size.width:this.Lr):l+=this.padding.y*2+(this.ln===1?u.size.height:this.wr)}this.de===vi?(l+=this.padding.y*2+this.wr,a=0):(a+=this.padding.x*2+this.Lr,l=0)}this.done=!0}};c(po,"type",ng),qe.register(po.type,po);var ol=class extends po{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Mx,columns:1})})),this.type=ig}};c(ol,"type",ig),qe.register(ol.type,ol);var sl=class extends po{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:vi,rows:1})})),this.type=og}};c(sl,"type",og),qe.register(sl.type,sl);var sg=class sg extends Hn{constructor(e){super(e);c(this,"No");c(this,"type",sg.type);c(this,"$",new Map);c(this,"qn",new Map);c(this,"Qn");c(this,"St");c(this,"Io",1/0);c(this,"Mo",-1/0);c(this,"Vo",1/0);c(this,"Go",-1/0);c(this,"Tt",[]);c(this,"la",new Map);c(this,"vt");c(this,"ca");this.vt=gn(this.getDefaultParameters(),e.options),this.St=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.Zn}}cn(e,t,n){return t=gc(t),n=gc(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{Pg:t,_g:n}}hn(e){return this.qn.get(e.id)===!0}Rg(e){this.qn.set(e.id,!0)}reset(){super.reset(),this.$.clear(),this.qn.clear(),this.No=0,this.Io=this.Vo=1/0,this.Mo=this.Go=-1/0,this.la.clear()}begin(e,t,n,o,s){this.Tt.length=0,this.$.clear(),this.No=0,this.Io=1/0,this.Mo=-1/0,this.Vo=1/0,this.Go=-1/0,this.ca=this.vt.r,this.St&&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)})}dt(e,t,n){let o=H(e)?e.getParent():e,s=this.$.get(o.id);if(!s){let a=t(o.id)||this.xg(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.$.set(o.id,s),this.la.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}ha(e,t,n){return this.Tt[e]?this.Tt[e]:(this.Tt[e]=this.dt(this.$vertices[e],t,n),this.Tt[e])}step(e,t,n,o,s){let a;for(this.Qn=0,a=0;a<this.$vertices.length;a++){let l=this.ha(a,t,o);if(this.St&&!this.hn(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this._h(l,d.x,d.y),n(l.id,d.x,d.y),this.Rg(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.ha(d,t,o);this.Lg(l,u)}let h=this.la.get(l.id);for(let d=0;d<h.length;d++)this.wg(l,h[d],t,o)}if(this.Qn!==0)for(a=0;a<this.$vertices.length;a++){let l=this.ha(a,t,o);if(!this.hn(l)){let h=l.f[0],d=l.f[1];this._h(l,l.x+h,l.y+d)}l.f[0]=0,l.f[1]=0}this.No++,(this.Qn===0||this.No>=this.vt.iterations)&&(this.Dg(n,o),this.done=!0)}end(e,t,n,o,s){this.qn.clear(),this.$.forEach((a,l)=>{this.qn.set(l,!0)})}_h(e,t,n){let{Pg:o,_g:s}=this.cn(e,t,n);this.Io=Math.min(this.Io,o),this.Vo=Math.min(this.Vo,s),this.Mo=Math.max(this.Mo,o),this.Go=Math.max(this.Go,s)}Dg(e,t){this.$.forEach((n,o)=>{let s=this.$.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}Lg(e,t){let n=this.hn(e),o=this.hn(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(ke(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=lr(d,e)[0],p=lr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h==0&&(h=1,s=1,a=1)}if(h<this.vt.spacing){this.Qn++;let d=this.ca*(this.vt.spacing-h),u=1,p=1,m=u*d*s/h,g=p*d*a/h,E=o?0:(n?2:1)*m,y=o?0:(n?2:1)*g,x=n?0:(o?2:1)*m,f=n?0:(o?2:1)*g;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}wg(e,t,n,o){let s=this.dt(t.target,n,o),a=this.hn(e),l=this.hn(s);if(a&&l)return;this.Qn++;let h,d,u,p,m;if(ke(e,s))p=-2*this.vt.spacing,h=-2*this.vt.spacing,d=-2*this.vt.spacing;else{let y=[e.center,s.center],x=lr(y,e)[0],f=lr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p===0&&(p=1,h=1,d=1)}m=this.ca*(p-this.vt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),m*=Math.log(t.cost)*.5+1;let g=m*h/p,E=m*d/p;s.f[0]-=l?0:(a?2:1)*g,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*g,e.f[1]+=a?0:(l?2:1)*E}};c(sg,"type","ForceDirected");var _c=sg;qe.register(_c.type,_c);function qD(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var Ss=class extends Hn{constructor(e){super(e);c(this,"Rh");c(this,"dn");c(this,"Lh");this.Rh=!!e.options.ignoreLoops,this.Lh=e.options.ignorePorts===!0,this.dn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(fx(n)){let o=n.getTargetEdges();return(o.length===0||qD(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.Rh,s.getRootNode=this.dn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=H(u.target)?u.target.getParent():u.target;(u.source===a||this.Lh!==!0&&H(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 Vx=Rt,Gx={x:60,y:60},$x="auto",Bx=Rt;function Rc(i){return i.parents.length>0?i.parents[0].loc:null}function ag(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 QD(i){return i.parents.length>0?i.parents[0].root===!0:!1}function IO(i){return i.parents.length>0?i.parents[0].childGroup:null}function eN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Lc=class{constructor(r,e){this.dataSource=r;c(this,"Dr");c(this,"Yt");c(this,"ve");c(this,"P",[]);c(this,"Nr",[]);c(this,"ei",{});c(this,"Q");c(this,"J");c(this,"Ct");c(this,"ue");c(this,"ti");c(this,"xe");c(this,"St");c(this,"D");c(this,"un",-1/0);c(this,"pn",1/0);c(this,"ri");c(this,"Ot");c(this,"ni");c(this,"De",[]);c(this,"positions",new Map);c(this,"da",{[Rt]:r=>Rc(r)+ag(r,this.J)/2-(r.size-this.J)/2,start:r=>Rc(r),end:r=>Rc(r)+ag(r,0)-(r.size-this.J)});c(this,"F");c(this,"Pt");c(this,"Xt");c(this,"ii");c(this,"fa",{center:(r,e,t)=>(e+t)/2-ag(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Dr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Yt=e.compress===!0,this.St=e.absoluteBacked===!0,this.F=e.idFunction,this.Pt=e.sizeFunction,this.Xt=e.childVerticesFunction,this.ii=e.absolutePositionFunction,this.ue=e.axisIndex,this.xe=this.ue!==1,this.ti=this.ue===0?1:0,this.ri=this.xe?"y":"x",this.Ot=this.xe?Te:De,this.ni=this.xe?De:Te,this.ve=e.invert===!0,this.D=e.alignment||Bx,this.Q=e.padding,this.J=this.xe?this.Q.x:this.Q.y,this.Ct=this.xe?this.Q.y:this.Q.x}execute(){let r,e,t;for(let n=0;n<this.Dr.length;n++){r=this.Dr[n];let o=this.Pt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.oi(s,0);let l=0,h,d,u=(m,g)=>this.Yt&&m.parents&&m.parents.length>0?this.positions.get(this.F(m.parents[0].node)).position[this.ri]+this.ua(m,this.ti)+this.Ct:g,p=!1;if(a===0&&this.St===!0){let m=this.ii(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.si(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.P.length;e++){for(this.P[e].otherAxis=l,t=0;t<this.P[e].entries.length;t++)h=this.ue===0?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),d=this.ue===1?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),this.si(this.F(this.P[e].entries[t].node),{x:h,y:d},e);this.ve?e<this.P.length-1&&(this.P[e].otherAxisSize=this.De[e+1]+this.Ct,l-=this.P[e].otherAxisSize):(this.P[e].otherAxisSize=this.De[e]+this.Ct,l+=this.P[e].otherAxisSize)}}return this.positions}si(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.Pt(r),o=this.ue===0?e.x+n.width:e.y+n.height;this.un=Math.max(this.un,o),this.pn=Math.min(this.pn,o)}dt(r){let e=this.P[r];return e||(e={entries:[],pointer:0},this.P[r]=e),e}Qe(r,e,t,n,o){let s=this.dt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Ot],children:[]},l=e[this.ni];return this.De[t]==null?this.De[t]=l:this.De[t]=Math.max(this.De[t],l),s.pointer+=e[this.Ot]+this.J,s.entries.push(a),n&&n.children.push(a),a}pa(r,e){let t=this.Nr[e];t||(t=[],this.Nr[e]=t),r.index=t.length,t.push(r)}ma(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.dt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.J)}}ua(r,e){let t=r.parents.map(n=>n.dimensions[e===0?Te:De]);return Math.max.apply(null,t)}ga(r){if(r.size>0){let e=this.da[this.D](r),t=this.Nr[r.depth],n=this.D==="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.D==="end"?u.loc-r.size:u.loc+u.size+this.J}this.D!=="end"&&e>=n||this.D==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.D==="end"?r.nodes.length-1:0,l=this.D==="end"?-1:r.nodes.length,h=this.D==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.J;o!==0&&this.Ea(r),this.pa(r,r.depth)}}ya(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.fa[this.D](r,e,t),o=n-Rc(r);if(this.ma(r,n),!QD(r)){let s=IO(r),a=eN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ea(r){let e=r;for(;e!=null;)this.ya(e),e=IO(e)}oi(r,e){if(this.ei[r.node.id])return;this.ei[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.dt(e+1),l=this.Xt(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.Pt(this.F(h)),u=a.entries.find(p=>this.F(p.node)===this.F(h));if(u!=null){u.parents.push(r);let p=Rc(u),m=ag(u,this.J),g=p+m/2-u.size/2,E=g-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.Qe(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let m=d[this.Ot];t.size+=m+this.J,n.push(p)}s[h.id]=!0}}for(this.ga(t),o=0;o<n.length;o++)this.oi(n[o],e+1);return l.length}};var MO="Hierarchical",lg=class lg extends Ss{constructor(e){super(e);c(this,"type",lg.type);c(this,"de");c(this,"xe");c(this,"ue");c(this,"Yt");c(this,"ve");c(this,"D");c(this,"Dh");c(this,"P",[]);c(this,"Xt");this.ve=e.options.invert,this.Dh=e.options.spacing||$x,this.Yt=this.Dh==="compress",this.D=e.options.align||Vx,this.de=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:Gx,orientation:this.de,locationFunction:this.Zn,align:this.D}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.de=s.orientation,this.xe=this.de==="horizontal",this.ue=this.xe?0:1,this.padding=s.padding,this.P.length=0,this.Xt=s.getChildVertices}step(e,t,n,o,s){new Lc(e,{rootNode:s.rootNode,compress:this.Yt,padding:this.padding,axisIndex:this.ue,invert:this.ve,alignment:this.D,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.Xt(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.P}getOrientation(){return this.de}};c(lg,"type",MO);var wc=lg;qe.register(wc.type,wc);var hg=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"ne",new Map);c(this,"Nh",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=V(),this.group=[r]}setPosition(r,e,t){this.ne.set(r,{x:e,y:t})}getPosition(r){return this.ne.get(r)}getIncidentAngle(r){return this.Nh.get(r)}setIncidentAngle(r,e){this.Nh.set(r,e)}getPositions(){return this.ne}},tN=100,rN={x:50,y:50},cg=class cg extends Ss{constructor(e){super(e);c(this,"type",cg.type);c(this,"Ih");c(this,"et",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||tN,this.padding=e.options.padding||rN,this.clusterMagnetizer=new Ti({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.et[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.Zn,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=H(o.source)?o.source.getParent():o.source,a=H(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.et.length=0,this.Ih=s.getChildEdges}Mh(e,t,n,o,s,a,l){let h=(T,S,R,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:R+2*a.padding.x,height:v+2*a.padding.y}),d,u=new hg(e),p=s?s.position:{x:0,y:0},m=p.x,g=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.Ih(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,R=H(S)?S.getParent():S;u.children.add(R)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(m-x.width/2,g-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.et.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,R=S,v=null;u.children.forEach(D=>{f=y(D.id);let M=h(m+Math.sin(S)*f.width,g+Math.cos(S)*f.height,f.width,f.height),N=Si(b,M),G=Math.sqrt(Math.pow(M.x+N.x-m,2)+Math.pow(M.y+N.y-g,2));if(d=Math.max(d,G),u.setPosition(D.id,M.x+N.x,M.y+N.y),S+=T,v!=null){let J=y(v.id),ye=u.getPosition(v.id),j=h(ye.x,ye.y,J.width,J.height),ge=y(D.id),Ge=u.getPosition(D.id),Xe=h(Ge.x,Ge.y,ge.width,ge.height),Bt=Si(j,Xe),ar={x:ye.x+J.width/2,y:ye.y+J.height/2},er={x:Ge.x+Bt.x+ge.width/2,y:Ge.y+Bt.y+ +(ge.height/2)},Dr=Math.sqrt(Math.pow(ar.x-er.x,2)+Math.pow(ar.y-er.y,2));d=Math.max(d,Dr/2/Math.sin(T/2))}v=D}),S=R,u.children.forEach(D=>{u.setIncidentAngle(D.id,S),u.setPosition(D.id,m+Math.sin(S)*d,g+Math.cos(S)*d),S+=T});let O=u.getPosition(e.id),P=O.x,I=y(e.id),C=P+I.width,_=O.y,w=_+I.height,B;u.children.forEach(D=>{if(!this.Mh(D,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(D.id),position:u.getPosition(D.id)},a,l+1)){B=y(D.id),u.group.push(D);let N=u.getPosition(D.id);P=Math.min(P,N.x),C=Math.max(C,N.x+B.width),_=Math.min(_,N.y),w=Math.max(w,N.y+B.height)}}),u.extents=[P,C,_,w],u.offsets={};for(let D=0;D<u.group.length;D++){let M=u.group[D],N=u.getPosition(M.id);u.offsets[M.id]={x:N.x-u.extents[0],y:N.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.Mh(s.rootNode[0],t,n,o,null,s,0),this.et.length>0){let a=(this.et[0].extents[0]+this.et[0].extents[1])/2,l=(this.et[0].extents[2]+this.et[0].extents[3])/2;this.clusterMagnetizer.setElements(this.et),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.et.length;a++)this.et[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(cg,"type","Balloon");var Dc=cg;qe.register(Dc.type,Dc);var Ts=class{constructor(r){this.model=r}};var vr="edge",mo="vertex",Nc="center",dg=30;function lt(i){return i.type===vr}function nN(i){return i.type===mo}var Ic=class extends Ts{constructor(e,t){super(e);this.vertexSet=t;c(this,"jt",new Map);c(this,"$o",!1);c(this,"kt");c(this,"Ir",[]);c(this,"Vh",new Set);c(this,"ai");this.ai=e.layout.ai}Ng(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.jt.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}Gh(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.Vh.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.jt.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.Ng(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.jt.has(p.id));if(u.length>0){let p=Math.max(...u.map(m=>this.vertexSet.findLayerIndex(m.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let m={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:vr,entries:[]};this.vertexSet.edgeNodes.push(m),this.vertexSet.edgeNodeMap.set(p.id,m)})}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.Ir.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.jt.set(s[a].id,!0),this.Gh(s[a],t+1)}Ig(){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=>!lt(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.jt.clear(),this.$o=!1,this.kt=0,this.Ir.length=0,this.jt.set(e.id,!0);!this.$o;)if(this.Gh(e,this.kt),this.Ir.length>0)if(this.Ir=this.Ir.filter(t=>!this.jt.has(t[0].id)),this.Ir.length>0){let t=this.Ir.splice(0,1)[0];e=t[0],this.kt=t[1],this.jt.set(e.id,!0),this.vertexSet.addToLayer(this.kt,e)}else this.$o=!0;else this.$o=!0;this.ai&&this.Mg(),this.Ig()}Mg(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!lt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.Vh)}};var Fx=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 iN(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var vs=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"li");c(this,"ci");t=t||{},this.li=t.maxIterations||24,this.ci=t.maxIterationsWithoutImprovement||5}Vg(){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.Vg(),e=r,t=0,n=this.$h(r),o=Fx(e);for(let s=0;s<this.li;s++){let a=this.Gg(s,e),l=this.$h(a);if(l.total<n.total)n=l,t=0,o=Fx(a);else if(l.total===n.total){let h=Fx(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.ci)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}$h(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.$g(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}$g(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,m=this.getAdjacentEntries(e,t,u),g=[];for(let E=0;E<m.length;E++){let y=m[E][1];g.push(y)}g.sort(function(E,y){return E-y}),l[p]=g}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 m=u[1]+1;m<a.length;m++)n.push(...a[m])}return n}Gg(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.Bh(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.Bh(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}Bh(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(g=>!lt(g[0])),m=u.filter(g=>lt(g[0]));m.length>0&&(m.sort((g,E)=>g[0].obj.span>E[0].obj.span?-1:E[0].obj.span>g[0].obj.span?1:0),p.push(m[0])),u.length>0?s.push([d,iN(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===mo&&u[0].type===mo?0:d[0].type===vr&&u[0].leaf?-1:u[0].type===vr&&d[0].leaf?1:0),s.map(d=>d[0])}};var VO="xmax",GO="ymax",$O="xmin",BO="ymin",ug="_min",pg="_max",Mc=class{constructor(r,e,t,n,o){this.R=r;this.oe=e;this.axis=t;this.ve=n;this.Bg=o;c(this,"hi",{})}execute(){this.hi={};let r=this.Bg(),e={},t=this.axis===0?{[ug]:$O,[pg]:VO}:{[ug]:BO,[pg]:GO},n=this.axis===1?{[ug]:$O,[pg]:VO}:{[ug]:BO,[pg]:GO},o=null;for(let a=0;a<this.oe.layers.length-1;a++){let l=this.oe.layers[a],h=this.oe.layers[a+1],d=Math.min(l[t.be],h[t.be]),p=Math.max(l[t._t],h[t._t])-d,m=this.ve?n.be:n._t,g=this.ve?n._t:n.be,E=l[m],x=h[g]-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.oe.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.oe.regions.push(S),this.hi[A.id]=S;let R=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,O=this.axis===0?f.top:f.left;if(v<O){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:O-v,height:this.axis===0?O-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.oe.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.Bo(A,T,S,P,!0),R=P}}S.gateDown=this.Bo(A,T,R,f,!0),o!=null&&(S.gateUp=this.Bo(A,T,o,S,!1))}o=f}let s=this.oe.layers[this.oe.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.oe.regions.push(d),this.hi[l.id]=d,o!=null&&(d.gateUp=this.Bo(l,h,o,d,!1))}return this.oe.edgeNodes.forEach(a=>{let l=a.edge,h=H(l.source)?l.source.getParent():l.source,d=H(l.target)?l.target.getParent():l.target,u=this.R.entryMap[h.id],p=this.R.entryMap[d.id],m=this.hi[u.id],g=this.hi[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.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.oe.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.oe.gateMap[T])}E.push(g.gateUp)}else{E.push(m.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.oe.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.oe.gateMap[T])}g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.oe.edgeRoutingMap[l.id]=x,this.oe.edgeRouting.push(x),e[l.id]=E}),e}Bo(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.ve?l+(o?0:h):l+(o?h:0);return this.Fg(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})}Fg(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.oe.gates.push(l),this.oe.gateMap[l.id]=l,l}};function oN(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,m)=>{let g=jn(p.source),y={edge:p,isSource:g===m,sourceVertex:g,targetVertex:jn(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(m=>{(We(m.source,i)&&!We(m.target,i)||We(m.target,i)&&!We(m.source,i))&&u(m,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 m=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[m]||(o[m]={id:m,edges:new Set},e.push(o[m])),o[m].edges.add(h[p].edge),h[p].isSource?(s[m]||(s[m]={id:m,edges:new Set},t.push(s[m])),s[m].edges.add(h[p].edge)):(a[m]||(a[m]={id:m,edges:new Set},n.push(a[m])),a[m].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function sN(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Vc=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"Q");c(this,"qr",{});c(this,"At",{});c(this,"Fo",null);c(this,"Fh",[]);c(this,"Uh",new Map);c(this,"xa");c(this,"Ne");c(this,"di");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,"zh");c(this,"adjacentVertices",{});this.Q=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.zh=e.setPosition,this.xa=e.getSize,this.Fo=e.rootNode,this.Ne=e.edgeNodeSize,this.di=e.edgeFilter}nextRoot(){let r=this.pi.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.qr[r]}setRootNode(r){this.Fo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this.At[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}Yh(){let r={width:50,height:50};return this.axis===0?r.width=this.Ne:r.height=this.Ne,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.Q.x:this.Q.y}getPaddingInOtherAxis(){return this.axis===0?this.Q.x:this.Q.y}initialize(){this.pi.length=0,this.Fh.length=0,this.Uh.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.At[e.id]=this.xa(e.id),this.qr[e.id]=e;let n=oN(e,this.di);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:sN(n),size:this.xa(e.id),type:mo,layer:-1,vertexSet:null};this.pi.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.Fh.push(o),this.Uh.set(e.id,o))}this.pi.sort((t,n)=>{let o=this.Fo?this.Fo.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 lt(r)&&r.obj.edge.source===e.obj||lt(e)&&e.obj.edge.source===r.obj||lt(r)&&r.obj.edge.target===e.obj||lt(e)&&e.obj.edge.target===r.obj||lt(r)&<(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 Gc(i){return i.parents.length>0?i.parents[0].loc:null}function mg(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 aN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function FO(i){return i.parents.length>0?i.parents[0].childGroup:null}function lN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var $c=class{constructor(r,e){this.model=r;c(this,"un",-1/0);c(this,"pn",1/0);c(this,"Dr");c(this,"Yt");c(this,"ve");c(this,"P",[]);c(this,"Nr",[]);c(this,"ei",{});c(this,"Q");c(this,"J");c(this,"Ct");c(this,"ue");c(this,"ti");c(this,"xe");c(this,"St");c(this,"D");c(this,"ri");c(this,"Ot");c(this,"ni");c(this,"De",[]);c(this,"ne",new Map);c(this,"da",{center:r=>Gc(r)+mg(r,this.J)/2-(r.size-this.J)/2,start:r=>Gc(r),end:r=>Gc(r)+mg(r,0)-(r.size-this.J)});c(this,"F");c(this,"Pt");c(this,"Xt");c(this,"ii");c(this,"fa",{center:(r,e,t)=>(e+t)/2-mg(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Dr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Yt=e.compress===!0,this.St=e.absoluteBacked===!0,this.F=e.idFunction,this.Pt=e.sizeFunction,this.Xt=e.childVerticesFunction,this.ii=e.absolutePositionFunction,this.ue=e.axisIndex,this.xe=this.ue!==1,this.ti=this.ue===0?1:0,this.ri=this.xe?Ee:Q,this.Ot=this.xe?Te:De,this.ni=this.xe?De:Te,this.ve=e.invert===!0,this.D=e.alignment||Nc,this.Q=e.padding,this.J=this.xe?this.Q.x:this.Q.y,this.Ct=this.xe?this.Q.y:this.Q.x}execute(){let r,e,t;for(let n=0;n<this.Dr.length;n++){r=this.Dr[n];let o=this.Pt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.oi(s,0);let l=0,h,d,u=(m,g)=>this.Yt&&m.parents&&m.parents.length>0?this.ne.get(this.F(m.parents[0].node)).position[this.ri]+this.ua(m,this.ti)+this.Ct:g,p=!1;if(a===0&&this.St===!0){let m=this.ii(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.si(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.P.length;e++){for(this.P[e].otherAxis=l,t=0;t<this.P[e].entries.length;t++)h=this.ue===0?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),d=this.ue===1?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),this.si(this.F(this.P[e].entries[t].node),{x:h,y:d},e);this.ve?e<this.P.length-1&&(this.P[e].otherAxisSize=this.De[e+1]+this.Ct,l-=this.P[e].otherAxisSize):(this.P[e].otherAxisSize=this.De[e]+this.Ct,l+=this.P[e].otherAxisSize)}}return this.ne}si(r,e,t){this.ne.set(r,{position:e,layer:t});let n=this.Pt(r),o=this.ue===0?e.x+n.width:e.y+n.height,s=this.ue===0?e.x:e.y;this.un=Math.max(this.un,o),this.pn=Math.min(this.pn,s)}dt(r){let e=this.P[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.P[r]=e),e}Qe(r,e,t,n,o){let s=this.dt(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.Ot],children:[]},l=e[this.ni];return this.De[t]==null?this.De[t]=l:this.De[t]=Math.max(this.De[t],l),s.pointer+=e[this.Ot]+(r.type===vr?0:this.J),s.entries.push(a),n&&n.children.push(a),a}pa(r,e){let t=this.Nr[e];t||(t=[],this.Nr[e]=t),r.index=t.length,t.push(r)}ma(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.dt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.J)}}ua(r,e){let t=r.parents.map(n=>n.dimensions[e===0?Te:De]);return Math.max.apply(null,t)}ga(r){if(r.size>0){let e=this.da[this.D](r),t=this.Nr[r.depth],n=this.D==="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.D==="end"?u.loc-r.size:u.loc+u.size+this.J}this.D!=="end"&&e>=n||this.D==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.D==="end"?r.nodes.length-1:0,l=this.D==="end"?-1:r.nodes.length,h=this.D==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.J;o!==0&&this.Ea(r),this.pa(r,r.depth)}}ya(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.fa[this.D](r,e,t),o=n-Gc(r);if(this.ma(r,n),!aN(r)){let s=FO(r),a=lN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ea(r){let e=r;for(;e!=null;)this.ya(e),e=FO(e)}oi(r,e){if(this.ei[r.node.id])return;this.ei[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:V()},n=[],o,s={},a=this.dt(e+1),l=this.Xt(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.Pt(this.F(h)),u=a.entries.find(p=>this.F(p.node)===this.F(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,m=Gc(u),g=mg(u,this.J),E=m+g/2,y=E-p;y>0&&this.Ug(u,y,r)}else{let p=this.Qe(h,d,e+1,r,t);t.nodes.push(p);let m=d[this.Ot];t.size+=m+this.J,n.push(p)}s[h.id]=!0}}for(this.ga(t),o=0;o<n.length;o++)this.oi(n[o],e+1);return l.length}Ug(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 Bc=class extends Ts{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"Ht");c(this,"kt");c(this,"Q");c(this,"mn");c(this,"gn");c(this,"D");c(this,"Ne");c(this,"mi");n=n||{},this.Q=n.padding||{x:50,y:50},this.mn=n.unattachedRootPadding||150,this.Ht=n.lastPlacements,this.gn=n.strategy||"parent",this.Ne=n.edgeNodeSize,this.mi=n.gatherUnattachedRoots,this.D=n.alignment||"center"}zg(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>lt(o)?n+this.Ne: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.Ht?this.Ht.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(g=>this.zg(g.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(g=>g.mainAxis))},m=this.model.getNodeSizeInMainAxis(e);return n=this.gn==="center"?(p.biggestLayer-m)/2:this.gn==="start"?0:p.biggestLayer-m,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.gn==="parent"?this.Yg(p,l):this.Xg(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}Xg(e,t,n,o,s,a,l,h,d){let u=s,p;for(let m=0;m<e.length;m++){this.kt=e[m],t=this.gn==="center"?(o.biggestLayer-l[m].mainAxis)/2:this.gn==="start"?0:o.biggestLayer-l[m].mainAxis,u=s;for(let g=0;g<this.kt.entries.length;g++){p=this.kt.entries[g];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(lt(p)){let b=n===0?this.Ne:y,A=n===0?y:this.Ne;p.loc={x,y:f,w:b,h:A},u+=this.Ne+h}else this.vertexSet.setPosition(p.obj,x,f,m),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),m<e.length-1&&(this.model.invert?a-=l[m+1].otherAxis+2*d:a+=l[m].otherAxis+2*d)}}Yg(e,t){let n=new $c(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.Q,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.D,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let m=[];if(u<this.vertexSet.layers.length-1){let g=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);m.push(...g)}return m},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.un,a=n.pn,l=0,h=0;if(this.mi&&o.size===1&&this.Ht!=null){let d=this.Ht.rootPosition+this.Ht.rootSize+this.mn;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.Ht){let d=this.Ht.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 Fc=class{constructor(r,e){this.R=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,"Xh",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.jh(r),o=lt(e),s;return o?(s={id:V(),obj:e,previous:null,size:this.R.Yh(),next:null,leaf:!1,type:vr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.R.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.R.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.R.assignedVertices.set(e.id,r),this.Xh.push(s),s}findLayerIndex(r){var e;return(e=this.Xh.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.jh(r),o=this.R.Yh();this.R.assignedVertices.set(e.id,r);let s={id:V(),obj:e,size:o,leaf:!1,type:vr,layer:r,vertexSet:this};e.entries.push(s),this.R.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;)lt(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.R.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.R.layout.absoluteBacked)this.En(r,e,t,n);else{let o=this.R.layout.model.getVertex(r),s=this.R.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this.En(r,s.x,s.y,n):this.En(r,e,t,n)}}setPosition(r,e,t,n){if(!this.R.layout.absoluteBacked)this.En(r.id,e,t,n);else{let o=this.R.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this.En(r.id,o.x,o.y,n):this.En(r.id,e,t,n)}}jh(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]}En(r,e,t,n){this.R.zh(r,e,t,n);let o=this.layers[n],s=this.R.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 Ux="Hierarchy",go=class extends Hn{constructor(e){super(e);c(this,"type",Ux);c(this,"axis");c(this,"model");c(this,"mn");c(this,"ci");c(this,"li");c(this,"ve");c(this,"mi");c(this,"kh");c(this,"dn");c(this,"Hh");c(this,"D");c(this,"Wh");c(this,"ai");c(this,"Ne");c(this,"di");c(this,"ba");c(this,"routingInformation");c(this,"resultSets",[]);this.mn=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.ci=e.options.maxIterationsWithoutImprovement||5,this.li=e.options.maxIterations||24,this.Hh=e.options.rootNode,this.dn=e.options.getRootNode,this.Wh=e.options.placementStrategy,this.Ne=e.options.edgeNodeSize||dg,this.ve=e.options.invert===!0,this.mi=e.options.gatherUnattachedRoots===!0,this.D=e.options.alignment||Nc,this.kh=e.options.generateRouting===!0,this.di=e.options.edgeFilter,this.ba=e.options.filteredEdgeProcessor,this.ai=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.dn?this.dn():this.Hh;this.model=new Vc(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.mn,edgeNodeSize:this.Ne,edgeFilter:this.di},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:dg}}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 Fc(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new Ic(this.model,d);u.execute(l),new vs(d,(g,E,y)=>this.model.getAdjacentEntries(g,E,y),{maxIterations:this.li,maxIterationsWithoutImprovement:this.ci}).execute(),h=new Bc(this.model,d,{padding:this.padding,strategy:this.Wh,edgeNodeSize:this.Ne,lastPlacements:h,gatherUnattachedRoots:this.mi,unattachedRootPadding:this.mn,alignment:this.D}).execute(l);let p=[];if(d.layers.flatMap(g=>g.entries.map(E=>{if(lt(E)){p.push(E);let y=this.axis===0?g.ymax-g.ymin:g.xmax-g.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.ba){let g=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.ba(g,this)}let m={};this.kh&&(this.routingInformation=this.model.sets.map(g=>{let E={gates:g.gates,edges:g.edgeRouting,edgeMap:g.edgeRoutingMap,regions:g.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new Mc(this.model,d,this.axis,this.ve,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:m}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(go,"type",Ux),qe.register(go.type,go);var Uc=class{constructor(r){this.color=r}generate(r){return this.color}},Ci=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=hN(r);return i.fromString(e)}}};function hN(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 UO(){return new Ci(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var Cs=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=UO(),s=this.assignedColors.find(a=>zx(a,o)<20);for(;s!=null&&n<10;)o=UO(),s=this.assignedColors.find(a=>zx(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},Yx=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 zx(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 Yc(i){let r=z(i)?Ci.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Ci(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new Ci(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 cN(i){let r=z(i)?Ci.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Ci(0,0,0):new Ci(255,255,255)}var gg="empty",YO=[{dx:0,dy:-1,axis:he,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:he,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1},{dx:-1,dy:-1,axis:yn,directionFromParent:-1},{dx:1,dy:-1,axis:kn,directionFromParent:-1},{dx:1,dy:1,axis:yn,directionFromParent:1},{dx:-1,dy:1,axis:kn,directionFromParent:1}],zO=[{dx:0,dy:-1,axis:he,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:he,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1}],Xx=(i,r,e,t)=>zO.filter(n=>n.axis!==e||n.directionFromParent===t),Eg=(i,r,e,t)=>{let n=[];switch(e){case kn:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case yn: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 he:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return YO.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Os=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"ut",{});c(this,"gi");c(this,"Zh");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.gi={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.Zh=t*(n+o)}Uo(r,e){return{x:Math.floor((r-this.gi.x)/this.gridCellSize),y:Math.floor((e-this.gi.y)/this.gridCellSize)}}jg(r){let e=this.Uo(r.x,r.y),t=this.Uo(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}}kg(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.gi.x+t,s=this.gi.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}Hg(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}Wg(r,e,t,n){let o=this.makeKey(r,e);if(this.ut[o]==null){let s=this.kg(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.Zh),d=[],u=[],p=!1,m=!1;h.forEach(g=>{if(!p&&(this.sourceId===g.id||this.sourceObstacles.indexOf(g.id)!==-1)&&(p=!0),!m&&(this.targetId===g.id||this.targetObstacles.indexOf(g.id)!==-1)&&(m=!0),!this.Hg(g.id)){let E=ix(this.jg(g),this.vertexBorder,this.vertexBorder);u.push(g.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(g.id)}}),this.ut[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:m}}else t&&(this.ut[o].ax=t),n&&(this.ut[o].ay=n);return this.ut[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.Wg(r,e,t,n)}reinitialize(){Object.entries(this.ut).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 Ps(i,r){return i===0&&r===0?void 0:i===0&&r!==0?he:i!==0&&r===0?ne:Math.sign(r)===Math.sign(i)?yn:kn}function jx(i,r,e){return e==null?0:e===ne?i>0?1:-1:e===he?r>0?1:-1:e===yn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function fg(i){let r=Ps(i.ox,i.oy);return{axis:r,direction:jx(i.ox,i.oy,r)}}function Hx(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?ne:he}function Ir(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 Ps(r,e)}}function kx(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=Ps(r,e);return jx(r,e,t)}}function dN(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=Ir(i);return Ir(r)===t?-1:Ir(e)===t?1:0}}var zc=class{constructor(){c(this,"node")}sort(r,e){return dN(this.node,r,e)}};var Xt="group:added",Pi="group:member:added",_s="group:member:removed",Me="group:removed",Eo="dataLoadStart",yg="dataAppendStart",Mr="dataLoadEnd",xg="dataAppendEnd",bg="dataUpdated",bn="graphClearStart",jt="graphCleared",Wx="graphChanged",Re="group:updated",Ve="node:updated",cr="port:updated",pt="edge:updated",dr="edge:added",Ht="node:added",mt="edge:removed",Le="node:removed",Wn="port:added",Vr="port:removed",rn="edge:target",nn="edge:source",ur="select",pr="deselect",Cr="selection:cleared",Zn="edge:geometry",Jn="edge:pathEdited",Xc="edge:typeChanged",jc="node:typeChanged",Hc="port:typeChanged",kc="group:typeChanged",Zx="group:move:start",Wc="group:move",Gr="group:move:end",Zc="internal:group:sizeChanged",Jc="internal:group:sizeChangedRedo",Kc="internal:group:sizeChangedUndo",Jx="renderer:added",Rs="node:move:start",nr="node:move",Lt="node:move:end",Ls="undoredo:update",Kx="undo",qx="redo",Oi="destroy";var uN=[Ht,Wn,dr,Xt,Le,Vr,mt,Me,Ve,cr,pt,Re,Lt,Gr,nn,rn,Pi,_s],ws=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},al=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"zo",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||zt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.zo==null?this.zo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.zo),this.zo=setTimeout(o,e.debounceTimeout))};ws(this,Eo,()=>{n=!0}),ws(this,Mr,()=>{n=!1}),ws(this,bn,()=>{n=!0}),ws(this,jt,()=>{n=!1}),ws(this,bg,s),ws(this,Jn,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},qc=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(bg)};uN.forEach(t=>ws(this,t,e))}};var Qx="mixed",Qc="isolated",eb="nodesOnly",tb="groupsOnly",rb="edgesOnly",Ds=class Ds extends It{constructor(e,t){super();this.instance=e;c(this,"Wt",1/0);c(this,"Jh",1/0);c(this,"Kh",1/0);c(this,"se",[]);c(this,"K",[]);c(this,"q",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ie",{});c(this,"Mr");c(this,"Yo",!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.Mr=t.mode||Qx,this.instance.bind(Le,n=>{this.Rt(n.node)}),this.instance.bind(Me,n=>{this.Rt(n.group)}),this.instance.bind(Vr,n=>{this.Rt(n.port)}),this.instance.bind(mt,n=>{this.Rt(n.edge)}),this.instance.bind(rn,n=>{this.Ie[n.edge.getFullId()]&&this.fire(rn,n)}),this.instance.bind(nn,n=>{this.Ie[n.edge.getFullId()]&&this.fire(nn,n)}),this.instance.bind(Ht,n=>{this.generator&&this.autoFill&&!this.Yo&&this.reload()}),this.instance.bind(Xt,n=>{this.generator&&this.autoFill&&!this.Yo&&this.reload()}),this.instance.bind(Ve,n=>{this.Ie[n.vertex.getFullId()]&&this.fire(Ve,n)}),this.instance.bind(Re,n=>{this.Ie[n.vertex.getFullId()]&&this.fire(Re,n)}),this.instance.bind(pt,n=>{this.Ie[n.edge.getFullId()]&&this.fire(pt,n)}),this.instance.bind(cr,n=>{n.port!=null&&this.Ie[n.port.getFullId()]&&this.fire(cr,n)}),this.instance.bind(jt,()=>{this.clear()}),this.instance.bind(Mr,()=>{this.reload()}),this.setCapacityPolicy(Ds.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.se.length===0&&this.K.length===0&&this.q.length===0}qh(e){return e.objectType===Fe.objectType?this.q:e.objectType===de.objectType?this.se:this.K}setMode(e){this.Mr=e,e===Qc?this.Zg():e===rb?this.Qh():e===eb?(this.Aa(),this.ed()):e===tb&&(this.Aa(),this.td())}Jg(e){let t=[],n=this.qh(e),o=e.objectType===Fe.objectType?this.Jh:e.objectType===de.objectType?this.Wt:this.Kh;if(n.length>=o){if(this.capacityPolicy===Ds.DISCARD_NEW)return!1;t=n.splice(0,1),this.Sa(t[0],":removed"),delete this.Ie[t[0].getFullId()]}return n.push(e),this.Sa(e,":added"),t}Sa(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))}rd(e,t){if(this.Kg(e)&&!this.Ie[e.getFullId()]){let n=this.Jg(e);return n===!1?[[],[]]:(this.Ie[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}Kg(e){return this.Mr===Qx||this.Mr===eb&&e.objectType===de.objectType||this.Mr===tb&&e.objectType===le.objectType||this.Mr===rb&&e.objectType===Fe.objectType?!0:this.Mr===Qc?e.objectType===Fe.objectType?this.se.length===0&&this.K.length===0:this.q.length===0:!1}Rt(e,t){let n=e.getFullId();return _t(this.qh(e),s=>s.getFullId()==n)?(delete this.Ie[e.getFullId()],t&&t(e,!1),this.Sa(e,":removed"),[[],[e]]):[[],[]]}qg(e,t){return this.Ie[e.getFullId()]?this.Rt(e,t):this.rd(e,t)}Ta(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(z(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.ze)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.Ta(e,this.Rt.bind(this),t)}append(e,t){return this.Ta(e,this.rd.bind(this),t)}toggle(e,t){return this.Ta(e,this.qg.bind(this),t)}setMaxNodes(e){this.Wt=e}setMaxGroups(e){this.Kh=e}setMaxEdges(e){this.Jh=e}setCapacityPolicy(e){this.capacityPolicy=e}Aa(){for(let e=this.q.length,t=0;t<e;t++)this.Rt(this.q[0])}td(){for(let e=this.se.length,t=0;t<e;t++)this.Rt(this.se[0])}ed(){for(let e=this.K.length,t=0;t<e;t++)this.Rt(this.K[0])}Qh(){this.td(),this.ed()}Zg(){this.Qh(),this.Aa()}clear(e){this.se.length=0,this.q.length=0,this.K.length=0,this.Ie={},this.fire(bn),e||this.onClear(this)}nd(e){let t=[];for(let n=0;n<e.length;n++)this.Ie[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Yo=!0,this.fire(Eo,{}),this.generator(this,this.instance),this.fire(Mr,{}),this.onReload&&this.onReload(),this.Yo=!1)}ze(e,t){let n=t===Fe.objectType?this.q:t===le.objectType?this.K:this.se;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.ze(e,de.objectType)}eachGroup(e){this.ze(e,le.objectType)}eachVertex(e){this.ze(e,de.objectType),this.ze(e,le.objectType)}eachEdge(e){this.ze(e,Fe.objectType)}getNodeCount(){return this.se.length}getNodeAt(e){return this.se[e]}getNodes(){return this.se}getNode(e){return this.se.find(t=>t.id===e)}getGroupAt(e){return this.K[e]}getGroups(){return this.K}getGroup(e){return this.K.find(t=>t.id===e)}getGroupCount(){return this.K.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.se),Array.prototype.push.apply(e,this.q),Array.prototype.push.apply(e,this.K),e}getAllEdgesFor(e,t){return this.nd(e.getAllEdges(t))}getSourceEdgesFor(e){return this.nd(e.getSourceEdges())}getEdgeCount(){return this.q.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.q[e]}getEdges(){return this.q}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}Qg(e){return new Ds(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.Qg();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(Ds,"DISCARD_EXISTING","discardExisting"),c(Ds,"DISCARD_NEW","discardNew");var mr=Ds;var _i=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,"va");c(this,"Ca");c(this,"Ei");c(this,"od");c(this,"sd");c(this,"ad");c(this,"ld");this.source=r.source.getFullId(),this.target=r.target.getFullId(),H(r.source)&&(this.va=r.source.id,this.source=r.source.getParent().getFullId()),H(r.target)&&(this.Ca=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Ei=r.geometry,r.source.dummy&&(this.od=!0,this.ad={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.sd=!0,this.ld={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.od?this.ad:this.va==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.va}generateTargetIdentifier(){return this.sd?this.ld:this.Ca==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Ca}Qe(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Ei},e=this.instance.$_addEdge(r,bx,null);this.manager.edgeChange(this.edgeId,e)}tt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},Sg=class extends _i{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},Tg=class extends _i{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.Qe()}redo(){this.tt()}hasDeltas(){return this.obj!=null}},Ag=class extends _i{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return bi(this.newVertex)&&bi(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!bi(this.newVertex)&&!bi(this.oldVertex)&&ux(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},vg=class extends Ag{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},Cg=class extends Ag{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var An=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=V()}$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 _i&&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];nb(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):ib(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):ob(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 Ns=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 ed=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===de.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===le.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}cd(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},hl=class extends ed{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.cd()}redo(){this.$add()}},ll=class extends ed{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.cd()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},td=class extends ll{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))}},cl=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.Vr(Jc,this.newGroupSize,this.originalGroupSize)}undo(){this.Vr(Kc,this.originalGroupSize,this.newGroupSize)}Vr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function pN(i,r,e){return i==="*"?!0:i.length>0?i.indexOf(r)!==-1:!e}function Is(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 mN(i,r){let e=xt({x:i[0],y:i[1]},{x:0,y:0},r);return[Math.round(e.x),Math.round(e.y)]}function gN(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function rd(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 Ri=class{constructor(r,e,t,n){this.obj=r;this.instance=t;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=Is({},r.data),this.$od=Is({},e),this.reason=n}hd(r){this.obj.objectType===de.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===le.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===pe.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Fe.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.hd(this.$od)}redo(){this.hd(this.$nd)}hasDeltas(){return!Qa(this.$nd,this.$od)}};var nd=class{constructor(r,e,t){this.obj=r;this.yn=e;this.instance=t}Qe(){this.instance.addPort(this.yn,this.obj.data)}tt(){this.instance.removePort(this.yn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},id=class extends nd{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},od=class extends nd{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.Qe()}redo(){this.tt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var Pg=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},sd=class extends Pg{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.Pa=o;this.Oa=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Oa!=null&&this.renderer.setPosition(this.node.id,this.Oa.x,this.Oa.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Pa!=null&&this.renderer.setPosition(this.node.id,this.Pa.x,this.Pa.y)}},ad=class extends Pg{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ra=o;this._a=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this._a!=null&&this.renderer.setPosition(this.node.id,this._a.x,this._a.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ra!=null&&this.renderer.setPosition(this.node.id,this.Ra.x,this.Ra.y)}},ld=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}},hd=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 dl=class{constructor(r,e,t){this.La=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.La.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var sb="internal.connection",ul="context:update",cd="group:collapse",dd="group:expand",fo="zoom",ud="render:start",Sn="render:end",ab="adhocLayout",Ms="afterLayoutRefresh",pl="group:relayout",$r="group:render",Vs="internal.vertex:updated",Br="node:render",pd="node:visibility",md="plugin:added",lb="plugin:removed",Tn="relayout",hb="objectRepainted",Ue="click",gt="contextmenu",yo="dblclick",Fr="dbltap",cb="focus",ue="mousedown",Og="mouseenter",_g="mouseexit",ie="mousemove",db="mouseleave",oe="mouseup",et="mouseout",tt="mouseover",W="tap",ub="touchstart",pb="touchend",mb="touchmove",gb="vertex:click",Eb="vertex:dblclick",fb="vertex:dbltap",yb="vertex:mouseout",xb="vertex:mouseover",bb="vertex:mousemove",EN="vertex:mouseup",fN="vertex:mousedown",Ab="vertex:contextmenu",Sb="vertex:tap",Tb="edge:click",vb="edge:dblclick",Cb="edge:dbltap",gd="edge:mouseout",Ed="edge:mouseover",Pb="edge:mouseup",ml="edge:mousedown",Ob="edge:contextmenu",_b="edge:tap",xo="canvasClick",Rb="canvasDblClick",fd="edge:redraw",Lb="lasso:end",gl="pan",vn="modeChanged",yN="allGroupsRelayout",wb="groupRelayoutAdhoc",xN="groupMemberRemoved",Db="newVertexAddedToGroup",Nb="existingVertexAddedToGroup";var El=class extends Ri{constructor(e,t,n,o){super(e,t,n,o);this.obj=e;this.instance=n;c(this,"type","vertexUpdate");o===Gs&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var $s=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 Ib=class{constructor(r,e,t,n,o){this.T=r;this.eE=e;this.ud=t;this.Ei=n;this.La=o;c(this,"type","edgePath")}dd(r){this.T.setEdgeGeometry(this.eE,r,null,this.La)}undo(){this.dd(this.ud)}redo(){this.dd(this.Ei)}hasDeltas(){return!Qa(this.ud,this.Ei)}},bN=50,Mb="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",AN="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",yd=class{constructor(r){c(this,"T");c(this,"Xo");c(this,"Lt");c(this,"wa");c(this,"undoStack");c(this,"redoStack");c(this,"jo",[]);c(this,"ae");c(this,"Zt",0);this.T=r.instance,this.Lt=!1,this.undoStack=[],this.redoStack=[],this.Xo=r.maximumSize||bN,this.wa=r.onChange,this.tE()}pd(r){this.Lt=r}dataLoadStart(){this.clear(),this.pd(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.pd(!1)}dataAppendEnd(){this.dataLoadEnd()}tE(){this.T.bind(jt,()=>{this.clear()}),this.T.bind(Ht,r=>{this.command(new hl(r.node,this.T))}),this.T.bind(Le,r=>{this.command(new ll(r.node,this.T))}),this.T.bind(Ve,r=>{qa(r.updates)||this.command(new El(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(Xt,r=>{this.command(new hl(r.group,this.T))}),this.T.bind(Me,r=>{this.command(new td(r,this.T))}),this.T.bind(Re,r=>{qa(r.updates)||this.command(new El(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(Zc,r=>{let e=new cl(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(dr,r=>{this.command(new Sg(r.edge,this.T,this))}),this.T.bind(mt,r=>{this.command(new Tg(r.edge,this.T,this))}),this.T.bind(pt,r=>{qa(r.updates)||this.command(new Ri(r.edge,r.originalData,this.T,r.reason))}),this.T.bind(nn,r=>{this.command(new vg(this.T,this,r.edge,r.old,r.new))}),this.T.bind(rn,r=>{this.command(new Cg(this.T,this,r.edge,r.old,r.new))}),this.T.bind(Jn,r=>{this.command(new Ib(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(Wn,r=>{this.command(new id(r.port,r.vertex,this.T))}),this.T.bind(Vr,r=>{this.command(new od(r.port,r.vertex,this.T))}),this.T.bind(cr,r=>{qa(r.updates)||this.command(new Ri(r.port,r.originalData,this.T,null))}),this.T.bind(Pi,r=>{r.vertexIsNew!==!0&&this.command(new sd(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(_s,r=>{this.command(new ad(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(jc,r=>{this.command(new $s(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Hc,r=>{this.command(new $s(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(kc,r=>{this.command(new $s(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Xc,r=>{this.command(new $s(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Lt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ns(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Gr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ns(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(cd,e=>{this.command(new ld(e.group,r.renderer))}),r.renderer.bind(dd,e=>{this.command(new hd(e.group,r.renderer))}),r.renderer.bind(Le,e=>{this.command(new dl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Me,e=>{this.command(new dl(r.renderer,e.vertex,e.pos))})})}fi(){this.wa&&this.wa(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.Lt){if(!r.hasDeltas())return;HO(r)&&(r=r.compress()),this.ae!=null?this.ae.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.Xo&&this.undoStack.splice(this.undoStack.length-this.Xo-1,this.undoStack.length-this.Xo),this.redoStack.length=0,this.fi())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof _i&&o.edgeId===r?o.edgeChange(e):o instanceof An&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.Lt=!0,this.redoStack.push(r),r.undo(),this.Lt=!1,this.fi())}redo(){let r=this.redoStack.pop();r&&(this.Lt=!0,this.undoStack.push(r),r.redo(),this.Lt=!1,this.fi())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.ae=null,this.Zt=0,this.Lt=!1,this.fi()}transaction(r,e,t){if(this.ae!=null&&e==null)return U(Mb),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.ae;return this.ae=null,this.command(a),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.ae!=null)return this.transaction(r,St);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.rE(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}}rE(r,e){e instanceof An?e.$mergeInto(r):r.addAction(e,!0)}nE(){return this.ae=new An,this.Zt=0,this.ae.id}openTransaction(r){if(!this.Lt){let e=!0;if(this.ae!=null)if(r!=null)if(r===XO)this.commitTransaction();else if(r===jO)this.rollbackTransaction();else if(r===St)e=!1,this.Zt++;else throw new Error(Mb);else throw new Error(Mb);return e&&this.nE(),this.ae.id}return null}rollbackTransaction(){this.ae!=null&&(this.Zt>0?(this.Zt--,U(AN)):(this.ae.undo(),this.ae=null,this.fi(),this.jo.length=0))}commitTransaction(r){if(this.ae!=null)if(r!==!0&&this.Zt>0)this.Zt--;else{let e=this.ae;this.ae=null,this.command(e),this.Zt=0,this.md()}}Ib(r){if(this.undoStack.length===0){let e=new An;e.addAction(r),this.command(e)}else{let e=this.undoStack[this.undoStack.length-1];if(e instanceof An)e.addAction(r);else{this.undoStack.pop();let t=new An;t.addAction(e),t.addAction(r),this.undoStack.push(t)}}}Mb(r){this.iE(r),this.md()}iE(r){this.jo.push(r)}md(){this.ae==null&&(this.jo.forEach(r=>{try{r()}catch(e){}}),this.jo.length=0)}},XO="commitCurrent",jO="rollbackCurrent",St="appendToCurrent";function HO(i){return i instanceof An}function nb(i){return i instanceof Ri||i instanceof El}function ib(i){return i instanceof Ns}function ob(i){return i instanceof cl}var Rg="1.0.1";var Vb="type",Gb="default",Ub="groupResized",kO="addPort",WO="addNewPort",ZO="removePort",xd="updatePort",Bs="moved",SN="layout",Lg="updateVertex",$b="updateNode",Bb="updateGroup",Yb="magnetizer",Ad="setPosition",zb="snapToGrid",TN="sizeGroupToFit",fl="drawingToolsResize",Gs="rotation",Xb="resized",Fb="updated",bd=class extends It{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");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,"Da");c(this,"gd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"portSeparator",".");c(this,"undoRedo");c(this,"Ed");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"pe");c(this,"Jt",new Map);c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new yd({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Ls,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||km,this.typeProperty=e.typeProperty||Vb,this.edgeTypeProperty=e.edgeTypeProperty||Vb,this.portTypeProperty=e.portTypeProperty||Vb,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||Gb),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||Gb),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||Gb),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new Tc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!hr(a)?{}:a,a=ot(a),a.id=a.id||V(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||Lx,this.modelTopAttribute=e.modelTopAttribute||wx,this.modelWidthAttribute=e.modelWidthAttribute||Nx,this.modelHeightAttribute=e.modelHeightAttribute||Ix,this.modelRotationAttribute=e.modelRotationAttribute||Dx,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.gd=e.autoSave&&e.autoSave.enabled!==!1,this.Ed={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],m=u==null?1/0:u,g=p==null?1/0:p;return m-g}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new tl(this.Ed),this.gd&&(this.autoSaver=new al(this,e.autoSave)),new qc(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=H(o)?o.getParent():o,d=H(s)?s.getParent():s,u=H(o)?this.model.getPortDefinition(a):K(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=H(s)?this.model.getPortDefinition(l):K(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),m=K(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),g=K(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?!(m.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||g.allowLoopback===!1):h===d?!(m.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||g.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.pe=this.ko(o=>{this.L(s=>s.$selectionCleared(o)),this.fire(Cr,{selection:o})}),e.selectionMode&&this.pe.setMode(e.selectionMode),e.maxSelectedNodes&&this.pe.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.pe.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.pe.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.pe.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})}oE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}Ho(e,t,n,o){if(z(e))return[this.graph.getVertex(e,!0),!1];if(K(e)||Y(e)||H(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.fd(this.oE(t,{x:a,y:l},n),o),!0]}}ko(e){return new mr(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.ko();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 al(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.Na(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.Na(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},rl,null))),t}clear(){return this.L(e=>e.$graphClearStart()),this.fire(bn),this.graph.clear(),this.$transientVerticesByRenderer={},this.L(e=>e.$graphClearEnd()),this.fire(jt),this}destroy(){this.clear(),delete this.Jt,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()}getDescendants(e){return bs(e)}getAncestors(e){return En(e)}isAncestor(e,t){return We(e,t)}isDescendantGroup(e,t){return yx(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=z(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(K(e)?this.typeFunction:H(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===de.objectType?this.typeProperty:e.objectType===pe.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t)}$dispatchTypeChange(e,t,n){let o,s;K(e)?(o=jc,s=()=>this.L(a=>a.$nodeTypeChanged(e,t,n))):H(e)?(o=Hc,s=()=>this.L(a=>a.$portTypeChanged(e,t,n))):Ke(e)?(o=Xc,s=()=>this.L(a=>a.$edgeTypeChanged(e,t,n))):Y(e)&&(o=kc,s=()=>this.L(a=>a.$groupTypeChanged(e,t,n))),o!=null&&(this.fire(o,{obj:e,previousType:t,newType:n}),s())}resolveFullId(e){if(Ke(e))return e.id;if(K(e))return e.id;if(Y(e))return e.id;if(H(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return H(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=V());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.group!=null)if(o=this.getGroup(e.group),o!=null)o.$addMember(s);else throw new Error("parent group ["+e.group+"] not found");return this.Na(s,o),o!=null&&this.fire(Pi,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}Na(e,t){let n={node:e,parentGroup:t};this.L(o=>o.$nodeAdded(n)),this.fire(Ht,n)}sE(e,t){let n={group:e,parentGroup:t};this.L(o=>o.$groupAdded(n)),this.fire(Xt,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(St);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}yd(e){return xs(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.yd(t);o[n.id]=n,n.transientRenderer=t.id}return n}fd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.L(o=>{o.$renderDummyVertex(n)}),n}Wo(e){this.graph.deleteNode(e),this.L(t=>{t.$nodeRemoved({node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.fd({id:`${e.id}_${n===Qe?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===Qe?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({node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.yd(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:Ax},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(St);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()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=V()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e.group!=null){if(n=this.getGroup(e.group),n==null)throw new Error("Cannot find parent group ["+e.group+"]");n.$addMember(o)}this.sE(o,n),n!=null&&this.fire(Pi,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}$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.group=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.L(p=>{p.$groupMemberAdded(u)}),this.fire(Pi,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.L(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data.group,this.fire(_s,h)}return l}xd(e,t,n,o){e.nestedGroups.forEach(a=>this.xd(a,t,!0,o)),e.nodes.forEach(a=>this.bd(a,!0,o));for(let a=0;a<e.edges.length;a++)this.Ia(e.edges[a]);let s={group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.L(a=>a.$groupRemoved(s)),o||this.fire(Me,s)}bd(e,t,n){for(let s=0;s<e.edges.length;s++)this.Ia(e.edges[s]);let o={node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.L(s=>s.$nodeRemoved(o)),n||this.fire(Le,o)}removeGroup(e,t,n){let o=this.graph.getVertex(z(e)?e:e.id);if(o){this.openTransaction(St);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data.group),this.xd(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(!z(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(z(e)?e:e.id);if(t!=null){this.openTransaction(St);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.bd(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,rl,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.Ho(e.source,s,0,n),[h,d]=this.Ho(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),m={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.L(g=>g.$edgeAdded(m,e.context)),o||this.fire(dr,m,null),p}else return this.debugEnabled&&U("Could not add edge"),null}Ia(e,t){let n={edge:e,source:t};this.L((o,s)=>o.$edgeRemoved(n)),this.fire(mt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&K(n.source)&&this.Wo(n.source),n.target.dummy&&K(n.target)&&this.Wo(n.target),this.Ia(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.Ho(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.Wo(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.L(h=>{h.$edgeTargetChanged(l)}),this.fire(rn,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.Ho(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.Wo(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.L(h=>{h.$edgeSourceChanged(l)}),this.fire(nn,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.Zo(o,WO);let h={vertex:o,data:s,port:l};this.L(d=>d.$portAdded(h)),this.fire(Wn,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.Zo(n,kO);let s={vertex:n,data:t,port:o};return this.L(a=>a.$portAdded(s)),this.fire(Wn,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 H(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(St);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.Zo(n,ZO);let a={vertex:n,port:o,edges:s};return this.L(l=>l.$portRemoved(a)),this.fire(Vr,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&&K(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&Ke(n.obj))this.removeEdge(n.obj);else{for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.Jt)this.Jt.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,Bb,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,$b,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,Lg,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(H(a.obj)?a.obj.getParent():a.obj).objectType===de.objectType?Ve:Re;this.Ad(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||Lg,source:s}))}}updateVertices(e,t){this.aE(e,Lg,!1,t)}aE(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||St)}updatePort(e,t){this.$_updatePort(e,t,xd,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.Ad(s.obj,t,o,cr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||xd}))}updateEdge(e,t){this.$_updateEdge(e,t,Fb,!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 l in t)s.data[l]==null?s.data[l]=t[l]:Bm(s.data,l,t[l]);this.Sd(a,s),this.fire(pt,{edge:s,updates:t||{},originalData:a,reason:n},null)}}update(e,t){this.cn(e,t,null,!1)}cn(e,t,n,o){if(K(e)){let s=n==null?$b:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?Bb:n;this.$_updateVertex(e,t,s,o)}else if(Ke(e)){let s=n==null?Fb:n;this.$_updateEdge(e,t,s,o)}else if(H(e)){let s=n==null?xd:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=ot(n||e.geometry),e.geometry=ot(t),this.fire(Jn,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.L(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new il(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===de||e.constructor===pe||e.constructor===le||e.constructor===Fe?e:z(e)||hr(e)?this.graph.getVertex(e):null}Jo(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.L(l=>{l.$select(a)}),this.fire(ur,a))})}lE(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 m;Ke(h)?m=[h]:m=t(h),e.filter&&(m=m.filter(e.filter));for(let g=0;g<m.length;g++){let E=d&&h===this.graph||m[g].source===h||n&&H(m[g].source)&&m[g].source.getParent()===h,y=u&&h===this.graph||m[g].target===h||n&&H(m[g].target)&&m[g].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(m[g])}}};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}Sd(e,t){let n=t.objectType===Fe.objectType?this.edgeTypeProperty:t.objectType===pe.objectType?this.portTypeProperty:this.typeProperty;if(t.data[n]!=null&&t.data[n]!==e[n]){let o=t.data[n],s=e[n];t.type=o,this.$dispatchTypeChange(t,s,o)}}Ad(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===pe.objectType?e.getFullId():e.id,h=e.objectType===pe.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let p in t)Bm(e.data,p,t[p]);e.objectType===pe.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.Zo(e.getParent(),xd))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.L(p=>p.$vertexUpdated(u)),this.Sd(a,e),this.fire(o,u,null)}}Zo(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.Da)){let o=Y(e)?Re:Ve,s={vertex:e,updates:{},originalData:e.data,reason:t};this.L(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.lE(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(Ke)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.yi(e);this.Jo(t,!1,this.pe,!0)}select(e,t){let n=this.ko(),o=this.yi(e),s=this.Jo(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(K(l||Y(l)||H(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Td(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.Td(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.ko();if(o.obj&&o.obj.objectType===de.objectType){t&&this.Jo(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Td(o.obj,s,n,a)}return s}yi(e){return e instanceof il||e instanceof mr?e:z(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>z(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.yi(e);if(t){let n=this.Jo(t,!0,this.pe,!1);n[1]!=null&&n[1].length>0&&this.xi(!1,n[1]),n[0]!=null&&n[0].length>0&&this.xi(!0,n[0])}}xi(e,t){let n=e?ur:pr;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.pe};this.L(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.yi(e);if(t){let n=[],o=this.pe.toggle(t,(s,a)=>{a||n.push(s)});this.xi(!1,o[1]),this.xi(!1,n),this.xi(!0,o[0])}}removeFromSelection(e){let t=this.yi(e);t&&this.pe.remove(t,n=>{let o={obj:n,selection:this.pe};this.L(s=>{s.$deselect(o)}),this.fire(pr,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.pe.clear()}getSelection(){return this.pe}setMaxSelectedNodes(e){this.pe.setMaxNodes(e)}setMaxSelectedEdges(e){this.pe.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.pe.setCapacityPolicy(e)}cE(e){this.fire(e),this.Da=!1}vd(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(m){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=m=>{e.incremental===!1&&this.clear(),this.Da=!0,t===Eo?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.L(g=>g.$dataLoadStart())):t===yg&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.L(g=>g.$dataAppendStart())),this.fire(t),vx(o,m,this,d),this.cE(n),h&&h(this,m),this.fire(Wx),n===Mr?(this.L(g=>g.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===xg&&(this.L(g=>g.$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 m=o===zt||o===Zm?zt:e.dataType,g=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:m,error:u,headers:g})}return this}load(e){return this.vd(e,Eo,Mr)}append(e){return this.vd(e,yg,xg)}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||{},Jm(e.type||zt,this,e.parameters)}toJSON(){return Jm(zt,this,{})}getRenderer(e){return this.Jt.get(e)}getRenderers(){return this.Jt}L(e,t){this.Jt.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||V(),this.Jt.set(t,e),e.id=t,e.onDestroy(n=>{this.Jt.delete(n.id)}),this.fire(Jx,{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(Kx,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(qx,{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 Rg}$_deriveEdgeId(e){return e==null?V():typeof e=="string"?e:this.edgeIdFunction(e)||V()}};var vN="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 wg=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}Cd(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.Cd(e=>r(e))}readRecords(r){this.Cd(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)})}},jb=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new wg(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 Hb(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function KO(i,r){return r?i:i.toLowerCase()}function CN(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=bt(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 PN=CN;function ON(i){return i=bt(i),[{token:i.replace(/\s/g,"_"),context:i}]}function qO(i){return[{token:bt(i),context:i}]}function _N(i,r){return i.score>r.score?-1:1}var RN=i=>i.id;function LN(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 wN=10,yl=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,"Od",0);c(this,"bi",new Map);c(this,"Gr",[]);c(this,"Ko",0);c(this,"Le",{});r=r||{},this.fields=r.fields,this.root=this.Ma(),this.tokenizer=r.tokenizer||PN,this.searchTokenizer=r.searchTokenizer||qO,this.limit=r.limit||wN,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||RN,this.sorter=r.sorter||_N}Ma(r){return{index:this.Od++,children:{},documentIds:{},key:r}}hE(r,e,t){let n=this.Le[r];n||(n={},this.Le[r]=n),n[e.index]=e}dE(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.Ma(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.hE(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);LN(this.Gr,{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.bi.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.dE(KO(l[h].token,this.caseSensitive),o,l[h].context)}}),this.Ko++};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.Le[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.Gr.length;n++)if(this.idFunction(this.Gr[n].document)===e){o=n;break}o!==-1&&(this.Gr.splice(o,1),this.Ko=this.Gr.length),this.bi.delete(e)}clear(){this.bi.clear(),this.Le={},this.Od=0,this.Gr.length=0,this.Ko=0,this.root=this.Ma()}getDocumentCount(){return this.Ko}getDocumentList(){return this.Gr}getDocument(r){return this.bi.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let m=n[d];m||(m={},n[d]=m,s[d]=0,a[d]=[]),a[d].push(p),m[u]||(m[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let g in d.documentIds)if(d.documentIds.hasOwnProperty(g)){let E=d.documentIds[g];for(let y=0;y<E.length;y++)l(g,p,E[y])}return}let m=p[u];d.children[m]&&h(d.children[m],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,KO(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.bi.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},kb=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new yl(e),this.groupIndex=new yl(e),this.edgeIndex=new yl(e),this.portIndex=new yl(e),r.bind(Ht,t=>{this.Pd(t.node)}),r.bind(Le,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Ve,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(Xt,t=>{this._d(t.group)}),r.bind(Me,t=>{this.groupIndex.remove(t.group.data)}),r.bind(Re,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(dr,t=>{this.Rd(t.edge)}),r.bind(mt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(pt,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(Wn,t=>{this.portIndex.add(t.port.data)}),r.bind(Vr,t=>{this.portIndex.remove(t.port.data)}),r.bind(cr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(jt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.Pd(n)}),this.instance.eachGroup((t,n)=>{this._d(n)}),this.instance.eachEdge((t,n)=>{this.Rd(n)})}Pd(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}_d(r){this.groupIndex.add(r.data)}Rd(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 Wb="context",Dg="lookup",Zb="default",Kn="element",Li="text",bo="tmpl",qn="each",xl="if",Jb="root",Kb="class",qb="style",Ao="$value",bl="$key",Qb="attribute";function Ng(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return cx(e)}}function tA(i){return i.length>0?i[i.length-1]:null}function rA(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 Ig(i,r,e,t,n){let o=V(),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 eA(i,r,e,t,n){e.atts[i]=r,Ig(i,r,e,t,n)}function nA(i,r){let e=Ng(i,r.attributesRe),t={el:bt(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?eA(o,"",t,s,r):eA(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=bt(e[o]);s!=null&&s.length>0&&n(s)}return t}var DN=["*","-","+","/","%"],QO=["==",">","<",">=","<=","===","!=","!==","||"],NN=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Sd="bool",e_="num",t_="group",r_="var",IN="op",iA="comp",n_="exp",i_="string",o_="array",s_="key",a_="value";function MN(i){return i[i.length-1]}function l_(i){return i.t===t_}function VN(i){return i.t===r_}function GN(i){return i.t===n_}function $N(i){return i.t===e_}function BN(i){return i.t===Sd}function FN(i){return i.t===i_}function UN(i){return i.t===o_}function YN(i){return i.t===s_}function zN(i){return i.t===a_}function h_(i){let r=i.match(NN),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=MN(t);if(e==="("){let s={t:t_,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:o_,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:s_,v:null});else if(e.match(/\$value/))o.c.push({t:a_,v:null});else if(e.match(/^#/))o.c.push({t:n_,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:i_,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Sd,v:!0});else if(e.match(/false/))o.c.push({t:Sd,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:e_,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:r_,v:e}):DN.indexOf(e)!==-1?o.c.push({t:IN,v:e}):QO.indexOf(e)!==-1?o.c.push({t:iA,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Sd,v:!1}),o.c.push({t:iA,v:"=="})):(o.c.push({t:Sd,v:!1}),o.c.push({t:iA,v:"!=="})))}return t[0]}function XN(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(QO.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=>(l_(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,m;for(let g=1;g<l.length;g+=2)m=l[g],(m.v==="+"||m.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,m],v:null},h.push(p)):p.c.push(u,m):(p!=null?p.c.push(u):h.push(u),p=null,h.push(m)),u=o(l[g+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 Al(i){let r=h_(i);return XN(r)}function wi(i,r,e,t,n){let o=Mg(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=Mg(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 Mg(i,r,e,t,n){let o=i.map(l=>l_(l)?Mg(l.c,r,e,t,n):VN(l)?r(l.v):GN(l)?e(l.v):UN(l)?r(Ao)[l.index]:YN(l)?r(bl):zN(l)?r(Ao):$N(l)||FN(l)||BN(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 Di=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=V(),r.entries[this.uuid]=this,this.compiledBindings={}}Ld(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:V(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Al(a),once:s,format:l}})})}}};var Vg=class Vg extends Di{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:V(),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.Ld({[Vg.TEXT_BINDING_NAME]:n})}};c(Vg,"TEXT_BINDING_NAME","__element");var Ni=Vg;var Gg=class Gg extends Di{constructor(e,t){super(t);c(this,"type",Gg.type);c(this,"comment");this.comment=e}};c(Gg,"type","comment");var Fs=Gg;var $g=class $g extends Di{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",$g.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.Ld(e.bindings),this.remove=!1}};c($g,"type",Kn);var Ur=$g;var oA={},Qn={construct:(i,r,e,t,n,o)=>{let s=oA[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{oA[i]=r},exists:i=>oA[i]!=null};var Bg=class Bg extends Ur{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",qn);this.context=e.atts.in,this.key=e.atts.key,this.tag=Bg.tag}};c(Bg,"tag","r-each");var Td=Bg;Qn.register(Td.tag,Td);function Fg(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function sA(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];Fg(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[xe]=this.wd(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}wd(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(xe);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[xe];{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.wd(n);return this.Dd(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[xe]}}Dd(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.Dd(r.children[n],e);r.children=t}};function c_(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function jN(i,r){i.el.nodeValue=r}function HN(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...Cd(i,r.children[t]));return e}function Cd(i,r){let e=HN(i,r);return r.type===Kn?(i.removeElement(r.el),e.unshift(r.el)):r.type===Li?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===qn&&(r.entryMap={}),e}function d_(i,r,e,t){for(let n in i.bindings)if(n!==Kb){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=wi(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===Kn?n!==qb?c_(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);c_(i,u,h.substring(d+1),!0)}):i.type===Li&&jN(i,a))}}function u_(){return{added:[],removed:[],elements:[]}}var Ug=class Ug extends Ur{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",Ug.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Al(this.test)}};c(Ug,"tag","r-if");var Pd=Ug;Qn.register(Pd.tag,Pd);function Yg(i,r,e,t,n){return i.resolution=wi(i.entry.expression,o=>Pe(r,o),o=>e(o),t,n),i.resolution}var So=class extends Ur{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[Wb],this.type=bo,this.remove=!0,e.atts[Dg])this.lookup=e.atts[Dg],this.default=e.atts[Zb]||"";else{this.templateId=e.atts.id;let a=rA(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(So,"tag","r-tmpl"),Qn.register(So.tag,So);function p_(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(hr(i)){let e=i;for(let t in e)r(e[t],t)}}var To=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,"Tt",new Map);c(this,"Ai",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,"qo");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.qo=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Nd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.qo[r]!=null?this.qo[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.Tt.clear(),this.Ai.clear()}parseAttributes(r){return Ng(r,this.attributesRe)}Id(r,e){return t=>{let n=e?null:this.Tt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Tt.set(t,n),n}}getTemplate(r){return this.Ai.get(r)}addTemplate(r,e){this.qo[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.Ai.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.Ai.get(r);if(n==null||t===!0){e=this.Id(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=m_(this,o,e,null,[r]);return this.Ai.set(r,s),s}}else return n}data(r,e,t){return Pe(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?Pe(e,t.substring(9)):Pe(r,t)}update(r,e,t){let n=r.$recado,o=u_();return t=t||{},n!=null&&this.xn(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}xn(r,e,t,n,o){if(r.type===Jb)for(let s=0;s<r.children.length;s++)this.xn(r.children[s],e,t,n,o);else if(r.type===Kn||r.type===Li){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),d_(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Si(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.xn(r.children[l],s,t,n,o)}else if(r.type===xl){let s=r,a=s.resolution,l=Yg(s,e,h=>this.Si(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)Cd(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.xn(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===bo){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.xn(r.children[a],s,t,n)}else if(r.type===qn){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)Cd(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=[];p_(a,(u,p)=>{let m=Pe(u,s.entry.key);if(l[m]=u,s.entryMap[m]!=null){let g=s.entryMap[m];for(let E=0;E<g.length;E++)h.push({data:u,key:m,execution:g[E]})}else h.push({data:u,key:m})});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],Cd(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.xn(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(m=>{m.el!=null&&s.placeholder.before(m.el)});else{let m=this.render(r.entry.children,p.data,null,n);sA(s,m,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 m_(this,r,e,t,n)}Si(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:V(),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(`${qn}:${b}`),entryMap:{},type:qn,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${bo}:${b}`),entry:f,id:b,children:[],type:bo};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:V(),entry:b,bindings:A,children:[],el:f,type:Kn};return h.children.push(S),f.$recado=S,S},m=(f,b,A,T)=>{y(f,T);let S={id:V(),el:f,entry:b,bindings:A,children:[],type:Li};return h.children.push(S),f.$recado=S,S},g=(f,b,A)=>{let T=V(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${xl}:${T}`),type:xl,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,R=null;if(f.type===xl){let v=h,O=g(f,A,o);if(h=O,S=Yg(O,b,P=>this.Si(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,O.placeholder,T);h=v,R=O}else if(f.type===qn){let v=f,O=l,P=f.context===Ao?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=V(),_=d(v,C,A);h=_,P!=null&&p_(P,(w,B)=>{let D=v.key&&hr(w)?Pe(w,v.key):B||null;for(let M=0;M<f.children.length;M++){let N=x(f.children[M],w,_.placeholder,B);D!=null&&Fg(_,D,N)}}),l=O,h=I,R=_}else if(f.type===bo){let v=f,O=l,P=h,I=V(),C=u(v,I,A);h=C;let _=f.context==null||f.context.length===0?b:Pe(b,f.context),w=v.lookup!=null?Pe(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 D=0;D<B.length;D++)x(B[D],_,C.placeholder,T);l=O,h=P,R=C}else if(f.type===Kn){let v,O=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let D=Object.assign({},b);Object.assign(D,P.decorator(b,n)||{});let M=this.render(P.getAST(D),D,t,n,P.defaultNamespace);v=M.fragment.childNodes[0];let N=M.children[0].bindings;for(let G in N)I[G]=N[G];C.push(...M.children[0].children)}else if(O.namespace!=null&&this.namespaceHandlers[O.namespace])v=this.namespaceHandlers[O.namespace](f.tag);else{let D=o||this.defaultNamespace;D!=null&&this.namespaceHandlers[D]?v=this.namespaceHandlers[D](`${D}:${f.tag}`):v=this.ce(f.tag)}for(let D in O.atts)if(O.atts.hasOwnProperty(D)){let M=O.atts[D];if(f.compiledBindings[D]!=null){let N=f.compiledBindings[D];I[D]={id:N.id,binding:N,results:[],originalValue:M,type:Qb};for(let G=0;G<N.expressions.length;G++){let J=N.expressions[G],ye=wi(J.expression,j=>j===bl?T:j===Ao?b:this.lookupValueInDataOrContext(b,n,j),j=>this.Si(j,b,n),J.format,this.formatter);M=M.replace(J.source,ye),I[D].results.push({source:J.source,result:ye})}}this.setAttribute(v,D,M)}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 _=l,w=h,B=p(v,O,I,A);B.children.push(...C),h=B,l=v;for(let D=0;D<f.children.length;D++)x(f.children[D],b,null,T);h=w,l=_,R=B}else if(f.type===Li){let v=f.value||"",O={},P=f.compiledBindings[Ni.TEXT_BINDING_NAME];if(P!=null){O[Ni.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:Li};for(let _=0;_<P.expressions.length;_++){let w=P.expressions[_],B=wi(w.expression,D=>D===bl?T:D===Ao?b:this.lookupValueInDataOrContext(b,n,D),D=>this.Si(D,b,n),w.format,this.formatter);v=v.replace(w.source,B),O[Ni.TEXT_BINDING_NAME].results.push({source:w.source,result:B})}}let I=this.ctn(v);R=m(I,f,O,A)}return R};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function kN(i){return Qn.exists(i)}function WN(i,r,e,t,n,o){return Qn.construct(r,e,i,t,n,o)}function m_(i,r,e,t,n){n=n||[],e=i.Id(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},m=(E,y,x,f)=>{let b=nA(E,i);return kN(b.el)?WN(i,b.el,b,x,o,n):new Ur(b,i,x,o,n)},g=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new Fs(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=m(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==So.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=m(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Ni({value:E},f);u(A),E.match(/^[\s]*$/)!=null||Ig(Ni.TEXT_BINDING_NAME,E,A,null,f)}}];if(dx(bt(r).split(i.tokenizerRe),(E,y)=>{let x=bt(y);for(let f=0;f<g.length;f++){let b=a(x,g[f].re);if(b){g[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 aA(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 Od=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}},zg=class extends Od{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)}},Xg=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},jg=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var Hg=class extends To{Nd(){return null}ce(r){return new zg(r)}cf(){return new Od}ctn(r){return new Xg(r)}cc(r){return new jg(r)}removeElement(r){}removeTextNode(r){}};function _d(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function kg(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function lA(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 Rd(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 m=u.edge.pathDirection,g=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=m===1?E+1:E-1,f=g===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=m===1?E-1:E+1,S=g===1?y-1:y+1,R=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,O=l.axis===0?Q:Ee,P=b?b.midpoint[O]:R?R.midpoint[O]:p.edge.sourceCenter[O]!==u.edge.sourceCenter[O]?u.edge.sourceCenter[O]:u.edge.targetCenter[O],I=b?A.midpoint[O]:v?v.midpoint[O]:u.edge.sourceCenter[O]!==p.edge.sourceCenter[O]?p.edge.sourceCenter[O]:p.edge.targetCenter[O];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 Ld(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,m=s.axis===0?l===1?u.height:0:l===1?u.width:0,g=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+g,[x]:p},b={[y]:d.location+E,[x]:m};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var wd="separate",ZN="bus";function hA(i){let r=i.axis,e=i.gates,t=i.gateMap||_d(e),n=i.mode||wd,o=i.regions,s=i.edges,a=i.pad||10,l={};Rd(s,e,t,i.getVertexPosition,i.getVertexSize),Ld(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(lA(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=kg(f,r),T=kg(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,m=r===0?o[h].left:o[h].top,g=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===wd)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]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}],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]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let m=p.edgeMap[d.id];l[d.id].push(...m)})}return l}function cA(i){let r=i.gates,e=_d(r),t=i.regions,n=i.edges,o={};Rd(n,r,e,i.getVertexPosition,i.getVertexSize),Ld(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 dA=4;function g_(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var Us={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=g_(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=g_(s),Us.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),Us.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 E_(i){return i.height*i.width}function Wg(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 Zg(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&&Zg(i.parent)}function uA(i,r){return i.x===1/0?E_(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))-E_(i)}function Jg(i){let r=Math.floor(i.children.length/2),e=vo(),t=vo();return Us.sortRect(i.children).forEach((n,o)=>{o<=r?Co(e,n):Co(t,n)}),i.children.length=0,[e,t]}function vo(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Dd(i){return i.children==null||i.children.length===0}function pA(i){return Dd(i)||Dd(i.children[0])}function Co(i,r){r.parent=i,i.children.push(r),Wg(i,r)}function Kg(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function f_(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(f_(e)):r.concat(e)},[])}function mA(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function y_(i){i.parent&&(Kg(i.parent,i),Zg(i.parent))}var Ys=class{constructor(r){c(this,"Wt");c(this,"ee");c(this,"bn",{});this.Wt=r||dA,this.ee=vo()}search(r,e){let t=[];return this.Md(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.Md(r,(n,o)=>t.push({node:n,overlap:Lm(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}Md(r,e,t){if(this.ee.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(ke(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(ke(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&Lm(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.ee)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{nx(r,o)&&(Dd(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.ee),t}insert(r){let e=n=>{let o=this.ee;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.bn[n.id]=s);!pA(o);)Wg(o,s),o=mA(o.children,a=>uA(a,s));Co(o,s),this.uE(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}uE(r){let e=r;for(;e.parent&&e.parent.children.length>this.Wt;)e=e.parent,e!=this.ee?(Kg(e.parent,e),Jg(e).forEach(t=>{Co(e.parent,t)})):e==this.ee&&Jg(e).forEach(t=>{Co(e,t)})}Vd(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.Wt),n=[],o=0,s;for(let a=0;a<t;a++){s=vo(),o=Math.min(this.Wt,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.bn[h.id]=h),Co(s,h)}n.push(s)}return t>1?this.Vd(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=Us.sortRect(r);this.ee=this.Vd(e)[0]||vo()}}getBounds(){return{x:this.ee.x,y:this.ee.y,width:this.ee.width,height:this.ee.height}}getExtents(){return{xmin:this.ee.x,ymin:this.ee.y,xmax:this.ee.x+this.ee.width,ymax:this.ee.y+this.ee.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.Gd(e),e}Gd(r,e){let t=[],n=r.parent;for(y_(r),r.id!=null&&delete this.bn[r.id];n!=null&&n!==this.ee;)n.children.length<=this.Wt/2&&(y_(n),t.push(...this.pE(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.bn[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.Gd(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.ee=vo(),this.bn={}}getLeafNodes(){return Object.values(this.bn)}pE(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Nd=class i{constructor(r){this.instance=r;c(this,"se",[]);c(this,"K",[]);c(this,"q",[])}static from(r){let e=new i(r.instance);return e.se=r.se.slice(),e.K=r.K.slice(),e.q=r.q.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.mE(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,Sx,null))}),s}mE(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(g){let E=r.getCoordinates(g,!0);u.set(g.id,E),g.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.K.forEach(p),this.se.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 m=(g,E,y)=>{y=y||0;let x=Object.assign({},g.data),f=V();if(o.vertexMap.set(g.getFullId(),f),x.id=f,E==null){let b=u.get(g.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x.group!=null&&delete x.group}else x.group=E.id;return!n&&Y(g)&&g.getMembers().forEach(b=>{let A=m(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.se.forEach(g=>o.nodes.push(m(g,null,0)[0])),this.K.forEach(g=>s.push(m(g,null,0))),s.sort((g,E)=>g[1]<E[1]?-1:1),o.groups=s.map(g=>g[0]),this.q.forEach(g=>{let E,y,x=g.source,f=H(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=g.target,T=H(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 R={source:E,target:y,data:Object.assign({},g.data||{})};if(R.data.id!=null){let v=V();o.edgeMap.set(R.data.id,v),R.data.id=v}g.geometry!=null&&S!=null&&b!=null&&(R.geometry=r.transformGeometry(g,o.transform.x,o.transform.y)),o.edges.push(R)}),o}};var Id=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Nd.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 qg="Anchor",Et="top",Tt="left",vt="right",Ct="bottom",Ii={[Et]:{x:0,y:-1},[Ct]:{x:0,y:1},[vt]:{x:1,y:0},[Tt]:{x:-1,y:0}},JN=[Tt,vt],KN=[Et,Ct],qN={[Et]:[Tt,vt],[Ct]:[Tt,vt],[Tt]:[Ct,Et],[vt]:[Ct,Et]},QN={[Et]:Ct,[Ct]:Et,[Tt]:vt,[vt]:Tt},x_=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(x_||{}),Md=(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))(Md||{});var Cn={};function zs(i,r){Cn[i]=r}var gr={lineIntersection(i,r,e,t,n){return Cn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return Cn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return Cn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return Cn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return Cn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return Cn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return Cn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return Cn[i.type].getPath(i,r)}};function Qg(i){return Cn[i.type].getLength(i)}function gA(i,r){return Cn[i].create(r)}function eI(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function EA(i,r,e){return eI()}function fA(i,r,e,t,n){return[]}function Sl(i,r,e,t,n){let o=[];return o.push.apply(o,gr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,gr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,gr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,gr.lineIntersection(i,r,e+n,r,e)),o}function yA(i,r){return Sl(i,r.x,r.y,r.width,r.height)}function Xs(i){return Object.assign({extents:xi()},i)}function b_(){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:Q,stubs:[0,0]}}function js(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 Vd(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:xi(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:b_()}}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 xA=.45,A_=62;function Gd(i,r,e){let t=Vd(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||A_,isLoopbackCurrently:!1,constrain:en,smooth:!0})}var ei={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})},S_=64,tI=Math.pow(2,-S_-1);function C_(i,r){let e=[],t=rI(i,r),n=r.length-1,o=2*n-1,s=bA(t,o,e,0),a=ei.subtract(i,r[0]),l=ei.square(a),h=0,d;for(let u=0;u<s;u++)a=ei.subtract(i,AA(r,n,e[u],null,null)),d=ei.square(a),d<l&&(l=d,h=e[u]);return a=ei.subtract(i,r[n]),d=ei.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function vA(i,r){let e=C_(i,r);return{point:AA(r,r.length-1,e.location,null,null),location:e.location}}function rI(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]=ei.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=ei.subtract(r[u+1],r[u]),o[u]=ei.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]=ei.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),m=Math.min(u,h);for(let g=p;g<=m;g++){let E=u-g;a[g+E].y+=s[E][g]*l[E][g]}}return a}function bA(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(nI(i,r)){case 0:return 0;case 1:{if(t>=S_)return e[0]=(i[0].x+i[r].x)/2,1;if(iI(i,r))return e[0]=oI(i,r),1;break}}AA(i,r,.5,n,o),s=bA(n,r,l,t+1),a=bA(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 nI(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 iI(i,r){let e,t,n,o,s,a,l,h,d,u,p,m,g,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,m=1,g=0,E=a,y=l,x=h-f,d=p*y-E*m,u=1/d,t=(m*x-y*g)*u,E=a,y=l,x=h-b,d=p*y-E*m,u=1/d,n=(m*x-y*g)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<tI?1:0}function oI(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 AA(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 sI(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(aI(t/i,r));return e}function aI(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 CA(i){let r=0;if(!TA(i)){let t=sI(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=SA(o,s)}}return r}var T_=new Map;function lI(i){let r=T_.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()),T_.set(i,r)}return r}function Hs(i,r){let e=lI(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 SA(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function TA(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function $d(i,r,e){if(TA(i))return{point:i[0],location:r};let t=Hs(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=Hs(i,o),n+=SA(a,t),t=a;return{point:a,location:o}}function PA(i,r,e){return $d(i,r,e).point}function OA(i,r,e){return $d(i,r,e).location}function Bd(i,r){let e=Hs(i,r),t=Hs(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 hI(i,r,e){let t=$d(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Bd(i,t.location)}function cI(i,r,e,t){t=t==null?0:t;let n=$d(i,r,t),o=Bd(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 Pn(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=pI(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=mI.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let m=d[p],g=Math.pow(m,2),E=Math.pow(m,3),y={x:l[0][0]*E+l[0][1]*g+l[0][2]*m+l[0][3],y:l[1][0]*E+l[1][1]*g+l[1][2]*m+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),m>=0&&m<=1&&x>=0&&x<=1&&u.push(y)}return u}function dI(i,r,e,t,n){let o=[];return o.push.apply(o,Pn(i,r,i+e,r,n)),o.push.apply(o,Pn(i+e,r,i+e,r+t,n)),o.push.apply(o,Pn(i+e,r+t,i,r+t,n)),o.push.apply(o,Pn(i,r+t,i,r,n)),o}function uI(i,r){let e=[];return e.push.apply(e,Pn(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Pn(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Pn(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Pn(i.x,i.y+i.height,i.x,i.y,r)),e}function v_(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 pI(i){return[v_(i,"x"),v_(i,"y")]}function mI(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 m=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(m/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((m+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((m+4*Math.PI)/3)-n/3}for(let m=0;m<3;m++)(p[m]<0||p[m]>1)&&(p[m]=-1);return p}var Po="Bezier";function _A(i,r,e){return e&&(r=OA(i,r>0?0:1,r)),r}var P_={create(i){let r=Xs(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:Po})},boundingBoxIntersection(i,r){return yA(i,r)},boxIntersection(i,r,e,t,n){return Sl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=vA({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=CA(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=_A(i.curve,r,e),Bd(i.curve,r)},lineIntersection(i,r,e,t,n){return Pn(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=_A(i.curve,r,t),PA(i.curve,r,e)},pointOnPath(i,r,e){return r=_A(i.curve,r,e),Hs(i.curve,r)}};zs(Po,P_);var Fd={};function gI(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 O_(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 EI(i){return!i.source||!i.target||!O_(i.source)||!O_(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!gI(r))==null}var Yr=i=>ot(i.geometry),Ne={get:(i,r,e)=>{let t=Fd[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{Fd[i]=r},compute:(i,r,e)=>{let t=Fd[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=Fd[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},markEdited(i,r){r=r||Yr(i.connector),i.connector.edited=!0,i.edge.geometry=r,Ne.$_setAnchorsFromGeometry(i,r)},importGeometry(i,r){if(EI(r)){let e=i.connector;e.geometry=ot(r),e.edited=!0,Ne.$_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=Fd[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=ot(r),e||(t.edited=!0,i.edge.geometry=Yr(t))}}};function fI(i){return i.geometry}function yI(i,r){return i.geometry=r,!0}function R_(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 rE(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function zr(i,r,e){if(e.x1===e.x2&&e.y1===e.y2)return;let t=gA(r,e);i.internalSegments.push(t),i.totalLength+=Qg(t),R_(i,t)}function tE(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 Xr(i,r,e){let t=tE(i,r,e);return t.segment&&gr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function xI(i,r,e){let t=tE(i,r,e);return t.segment&&gr.gradientAtPoint(t.segment,t.proportion,!1)||0}function rt(i,r,e,t){let n=tE(i,r,t);return n.segment&&gr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function nE(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=Qg(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function __(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function iE(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),m=Math.abs(o-n),g=!__(r.sourcePos),E=!__(r.targetPos);if(g||E){let S=p>m,R=S?e:n,v=S?t:o,O=R>v?-1:1,P=R>v?1:-1;g&&(l.x=S?O:0,l.y=S?0:O),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:m,quadrant:ms({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?Ee:Q,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function bI(i,r){let e=i.connector;e.paintInfo=iE(e,r),rE(e),Ne.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,nE(e)}function Mi(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 RA(i){i.bounds=xi()}function LA(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=gr.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 AI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,gr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function SI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,gr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function wA(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,gr.boundingBoxIntersection(i.internalSegments[t],r));return e}function TI(i){return i.typeDescriptor==="connector"}function DA(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=gr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function vI(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,m,g;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;m={x:E,y},g={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;m={x:r.sx+x,y:r.sy+f},g={x:r.tx+b,y:r.ty+A}}return[m,g]}function CI(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]=vI(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 L_(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function PI(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,m=(l+d)/2,g=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=OI(p,m,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,g,i.proximityLimit),[u,u]}function OI(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 w_(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function Ud(i,r,e,t,n){let o=i.connector,s,a;o.type===Oo?[s,a]=w_(o):[s,a]=L_(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,Po,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Yd(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===Oo?t.edited?[l,h]=w_(t):[l,h]=CI(t,r,e,n,o,s,a):t.edited?[l,h]=L_(t):[l,h]=PI(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,Po,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function zd(i,r,e){return{source:js(i.source,r,e),target:js(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 Oo="Bezier";function D_(i,r){let e=Gd(Oo,i,r);return Object.assign(e,{scale:r.scale||xA})}Ne.register(Oo,{compute:Yd,update:Ud,create:D_,transformGeometry:zd});var Xd="QuadraticBezier";function N_(i,r){let e=Gd(Xd,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",Vb:{x:0,y:0}})}Ne.register(Xd,{compute:Yd,update:Ud,create:N_,transformGeometry:zd});var oE="perpendicular",sE="orthogonal",aE="opposite",ks="Orthogonal",NA="Smooth",IA=30;function Tl(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 MA(i,r,e){return jd(r,"h",e,1)}function VA(i,r,e){return jd(r,"h",e,-1)}function GA(i,r,e){return jd(r,"v",e,1)}function $A(i,r,e){return jd(r,"v",e,-1)}function jd(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 Hd(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 kd(i,r,e,t){let n=i.indexOf(t),o=Hd(i,r,e,t);return o&&o[1]==n+r?o:null}function _o(i){return{[ne]:Math.sign(i.x2-i.x1),[he]:Math.sign(i.y2-i.y1)}}function _I(i){return[Math.sign(i.x2-i.x1),Math.sign(i.y2-i.y1)]}function lE(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?he:ne;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function BA(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(Tl(t.x2,i[0].x1,i[0].x2)||lr(o,r).length>0){let a=GA(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:he}),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:he}),a.segment.y1=h}}}}else if(t.o===he&&(Tl(t.y2,i[0].y1,i[0].y2)||lr(o,r).length>0)){let a=MA(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 FA(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(Tl(n.x1,a.x1,a.x2)||lr(s,r).length>0){let h=$A(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(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:he}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:he}),h.segment.y2=u}}}}else if(n.o===he&&(Tl(n.y1,a.y1,a.y2)||lr(s,r).length>0)){let h=VA(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(m=>{m.x1=u,m.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(m=>{m.x1=u,m.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 UA(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=FA(r,t,i.targetStub),s=BA(r,e,i.sourceStub)):(s=BA(r,e,i.sourceStub),o=FA(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var On="Straight";function ti(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function hE(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function cE(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var Ro={create(i){let r=Xs(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:On})},boundingBoxIntersection(i,r){return Ro.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,Ro.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,Ro.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,Ro.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,Ro.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=hE(i.x1,i.x2,r)?r:cE(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=hE(i.y1,i.y2,e)?e:cE(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=hE(i.x1,i.x2,a)?a:cE(i.x1,i.x2,a),t.y=hE(i.y1,i.y2,l)?l:cE(i.y1,i.y2,l)}let n=Be({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Be({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)ti(r,i.x1,i.x2)&&ti(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)ti(e,i.y1,i.y2)&&ti(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,ti(d,i.x1,i.x2)&&(u=s*r+a,ti(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,ti(u,i.y1,i.y2)&&(d=(e-a)/s,ti(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,ti(d,i.x1,i.x2)&&ti(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=Ro.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),Ut(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 Ut({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};zs(On,Ro);var I_=1e-10;function M_(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<I_?r:e-i<I_?e:i}var Cl="Arc";function V_(i,r,e,t){return rx({x:i,y:r},{x:e,y:t})}function RI(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+fi:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+fi:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var Wd={create(i){let r=Xs(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=V_(e,t,r.x1,r.y1),a=V_(e,t,r.x2,r.y2)),a<0&&(a+=fi),s<0&&(s+=fi);let l=a<s?a+fi:a,h=Math.abs(l-s);o&&(h=fi-h);let d=2*Math.PI*n,u=h/fi,p=d*u,m={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:m,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:Cl})},boundingBoxIntersection(i,r){return Wd.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return Sl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return EA(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=Wd.pointOnPath(i,r,e),n=tx({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 fA(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=Wd.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=RI(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:M_(n),y:M_(o),theta:t}}};zs(Cl,Wd);var G_={x:[Q,Ee],y:[Ee,Q]};function $_(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var Pl=new Map;Pl.set(oE,$_),Pl.set(sE,$_),Pl.set(aE,(i,r)=>{let e=i,t=e.sourceAxis,n={[Q]: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)},[Ee]: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]()?{[Q]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[Ee]:[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 Ol=new Map;Ol.set(oE,(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}]},m={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},g={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=G_[e][0],f=G_[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],R=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]&&R<S)return m[e];if(i.quadrant===v[2]&&R>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return g[e]}),Ol.set(sE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[Ee]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[Q]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[Ee]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),Ol.set(aE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:Ee,[Ee]:Q}[e],u=e===Q?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[Q]:De,[Ee]:Te}[e],m=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[Q]:[{x:t,y:m},{x:o,y:m}],[Ee]:[{x:m,y:t},{x:m,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[Q]:[{x:t,y:l},{x:o,y:l}],[Ee]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[Q]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[Ee]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function YA(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=Pl.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===Q?0:1,l=r.sourceAxis===Q?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 m=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,g=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=Ol.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,m,g,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 Zd(i,r){let e=r;return i.smooth===!0&&e.length>=2?DI(i,e).map(n=>zr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?LI(i,e):e.map(t=>zr(i,On,t)),i.$pathSegments=e,e}function zA(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function XA(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function LI(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=zA(e),o=zA(t),i.cornerRadius>0&&n!==o){let a=Math.min(XA(e),XA(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=tr({x:e.x1,y:e.y1},h,1e4),m=tr({x:t.x1,y:t.y1},d,1e4),g=wm(p,m),E=g!=null?Be(g,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,zr(i,On,Object.assign({},e)),i.slightlyWonky?zr(i,Cl,Object.assign({r:l,cx:g.x,cy:g.y,ac:u>0},e)):zr(i,Cl,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:g.x,cy:g.y,ac:u>0})):zr(i,On,Object.assign({},e))}else zr(i,On,Object.assign({},e));e=t}t!=null&&zr(i,On,Object.assign({},e))}var wI=(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)}},B_=(i,r,e,t,n)=>{let a=wI(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 dE(i,r){let e=[];for(let t=1;t<i.length;t++){let n=B_(i[t-1],i[t-2],i[t],r),o=B_(i[t],i[t-1],i[t+1],r,!0);e.push({type:Po,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 DI(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}),dE(e,i.smoothing)}function F_(i,r,e){return uE([{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 Jd(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===tn?jA(s,a,o,r,e,t,n):NI(s,a,o,r.quadrant,t,n),Zd(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function Kd(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===tn?t.$pathSegments=YA(t,r,e):t.$pathSegments=F_(t,r,e),Zd(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function NI(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 qd(i,r,e){return{source:js(i.source,r,e),target:js(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 uE(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var U_=.15,_n="Straight";function Ws(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}Ne.register(_n,{compute:Kd,update:Jd,create:HA,transformGeometry:qd});function II(i,r){let e=Object.assign(r,{constrain:tn});return HA(i,e)}Ne.register(ks,{compute:Kd,update:Jd,create:II,transformGeometry:qd});function MI(i,r){let e=Object.assign(r,{constrain:en,smooth:!0});return HA(i,e)}Ne.register(NA,{compute:Kd,update:Jd,create:MI,transformGeometry:qd});function VI(i){return i==null?null:i===Px?tn:i===Ox?Oc:i}function HA(i,r){let e=VI(r.constrain);r.stub=r.stub==null?e===tn?IA:null:r.stub;let t=Vd(_n,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?U_:r.smoothing,geometry:{segments:[]},constrain:e==null?en:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function WA(i,r,e){kA(1,i,r,e),kA(0,i,r,e)}var Lo="x2",wo="x1",Do="y1",No="y2";function GI(i,r,e){let t=e===i.x1?{value:i.x2,coord:Lo,prev:!0}:{value:i.x1,coord:wo,prev:!0},n=e===r.x1?{value:r.x2,coord:Lo,prev:!1}:{value:r.x1,coord:wo,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 $I(i,r,e){let t=e===i.y1?{value:i.y2,coord:No,prev:!0}:{value:i.y1,coord:Do,prev:!0},n=e===r.y1?{value:r.y2,coord:No,prev:!1}:{value:r.y1,coord:Do,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 Y_(i,r){if(r.length<5)return r;function e(d,u,p){let m=p===d.x1?d.x2:d.x1,g=p===u.x1?u.x2:u.x1;if(m>u.x1&&u.x2>m||m>u.x2&&u.x1>m)return m;if(g>d.x1&&d.x2>g||g>d.x2&&d.x1>g)return g}function t(d,u,p){let m=p===d.y1?d.y2:d.y1,g=p===u.y1?u.y2:u.y1;if(m>u.y1&&u.y2>m||m>u.y2&&u.y1>m)return m;if(g>d.y1&&d.y2>g||g>d.y2&&d.y1>g)return g}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=_o(n)[n.o],o.o!==n.o)if(Ws(o)<a){let p=r[d+1];if(_o(p)[p.o]!==s){let g=Object.assign({},o);if(o.o===he){let E=GI(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(g.x1=y,g.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,g]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[g,x]})}n=p,d+=1}else n=o}else if(o.o===ne){let E=$I(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(g.y1=y,g.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,g]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[g,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?pE(h):h}function kA(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?Lo:wo,p=i===1?No:Do,m=i===1?wo:Lo,g=i===1?Do:No,E=1,y=n.length-2,x=1,f=n[1];o[m]=l+a*d.x,o[g]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=_o(o),A=o.o,T=o.o===ne?he:ne,S=o.o===ne?[Lo,wo]:[No,Do],R=o.o===ne?[wo,Lo]:[Do,No],v=o.o===ne?[No,Do]:[Lo,wo],O=o.o===ne?[Do,No]:[wo,Lo],P=S[i],I=R[i],C=v[i],_=O[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[_]=o[C];let B=_o(f)[A],D=kd(n,x,T,f);if(B!==b[A]){if(D!=null){let M=kd(n,x,A,D[0]);if(M!=null)n.splice(E,1),M[0][I]=o[P],D[0][P]=o[P],D[0][I]=o[P],D[0][_]=o[C];else{let N=(D[0][C]+D[0][_])/2;D[0][_]=N,f[C]=f[_]=N;let G={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[_]:o[C],[I]:o[P]};n.splice(E,0,G)}}}else f[C]=f[_]=o[C],D!=null&&(D[0][_]=o[C])}else{f[_]=o[C],f[P]=f[I]=o[P];let B=kd(n,x,A,f);if(B!=null){let D=_o(B[0])[A];B[0][I]=o[P];let M=_o(B[0])[A];if(D!==M&&B[1]===y){n.splice(B[1],1);let N=(f[C]+f[_])/2;f[_]=N,f[P]=f[I]=s[I];let G={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[_]:N,[I]:o[P]};n.splice(E,0,G);let J={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[_]:o[C],[I]:o[P]};n.splice(E,0,J)}}else{let D=(f[C]+f[_])/2;f[_]=D,f[P]=f[I]=s[I];let M={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[_]:D,[I]:o[P]};n.splice(E,0,M);let N={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[_]:o[C],[I]:o[P]};n.splice(E,0,N)}}let w=Y_(r,n);i===1&&w.reverse(),r.$pathSegments=w}function jA(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(m=>{let g=Object.assign({},m);g.x1+=l,g.x2+=l,g.y1+=h,g.y2+=h,p.push(g)}),e.$pathSegments=p;return}WA(e,t,n)}}function BI(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?Hd(i,-1,n,o):null,right:e?Hd(i,1,n,o):null}}else return null}function ZA(i,r,e,t,n){let o=BI(r.$pathSegments,e);if(o!=null){o.axis===he?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===he,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 m={o:ne,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),l++}else if(d.y1!==r.$pathSegments[0].y2){let m={o:he,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),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 m={o:ne,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}else if(d.y2!==p.y1){let m={o:he,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}if(n!==!0){let m=i.instance.getElement(i.sourceId),g=i.instance.getElement(i.targetId);UA(r,r.$pathSegments,m,g,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function pE(i){let r=[ot(i[0])],e=ot(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>Ws(s)>0).map(ot);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?he:ne,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===ne?he: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 JA(i){let r=pE(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}function FI(i,r,e){if(i.$pathSegments.length>=2){let t=r===0?i.$pathSegments[0]:i.$pathSegments[i.$pathSegments.length-1],n=e[0]===0?he:ne;t.o=n,i.edited=!0}}var Qd=class extends It{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(ul,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(ul,{key:e,value:t})}};var Vi=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Vi||{});var jr="px",Rn="50px",Pr="block",ht="none",UI=0,YI=1,je="absolute",mE="fixed",KA="static",qA="relative",QA="data-vjs-group",Pt="data-vjs-managed",_l="data-vjs-not-draggable",eS="data-vjs-elements-draggable",gE="tabindex",zI="overlays",ee="data-vjs-vertex",on="data-vjs-port",Rl="data-vjs-port-id",Hr="data-vjs-port-type",eu="data-vjs-edge-type",tu="data-vjs-source",Io="data-vjs-target",EE="data-vjs-allow-loopback",ru="data-vjs-source-port-id",nu="data-vjs-target-port-id",Mo="data-vjs-source-port",Vo="data-vjs-target-port",ri="data-vjs-source-port-type",Gi="data-vjs-target-port-type",iu="data-vjs-magnet",Ze="data-vjs-edge",ou="data-vjs-overlay-id",Er="*";var Zs="vjs-connector",tS="vjs-connector-path",rS="vjs-connector-outline",nS="vjs-connector-transient",Ll="vjs-connected",fE="vjs-group-collapsed",yE="vjs-group-expanded",su="vjs-toggle-group-collapse",Js="vjs-overlay",wl="vjs-overlay-hide",iS="vjs-label-overlay",$i="vjs-node",oS="vjs-port",Go="vjs-group",sS="vjs-dummy-vertex",Dl="vjs-selected-connection",Bi="vjs-selected-element",Ks="vjs-edge-delete",au="vjs-edge-delete-i";var xE="allowNestedGroups",Nl="anchor",Il="anchors",XI="astarGridCellSize",aS="astarVertexBorder",lS="astarVertexBuffer",jI="overlays",HI="edgesDetachable",lu="connector",hS="cssClass",cS="edgeRelocateHandleSize",kI="ensureAnchorsInWhitespace",WI="groupSize",dS="hoverClass",hu="hoverPaintStyle",uS="maxConnections",ZI="nodeSize",$o="paintStyle",JI="reattachEdges",bE="scope",pS=[.05,3];function mS(i){return i.type!=null&&i.options!=null}function ii(i){let r=null;return z(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||V(),r}var cu="always",Fi="hover";function AE(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 ni=class{constructor(r,e){this.component=r;c(this,"id");c(this,"cssClass");c(this,"Qo");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||V(),this.cssClass=e.cssClass||"",AE(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.Qo=r.instance.$isTouchDevice()?cu:e.visibility||cu,this.Qo===Fi&&(this.visible=!1)}},Ln=class extends ni{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 z_={},nt={get:(i,r,e,t)=>{let n=z_[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{z_[i]=r}};var SE=class SE extends ni{constructor(e,t,n){super(t,n);this.instance=e;this.component=t;c(this,"label");c(this,"type",SE.type);c(this,"useHTMLElement");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)}getLabel(){return Tr(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&&AE(this,e.location),TE(this,t)}};c(SE,"type","Label");var ir=SE;function kr(i){return i.type===ir.type}nt.register(ir.type,ir);function TE(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 vE="labelLocation",KI=[Nl,Il,"cssClass",lu,$o,hu],qI="parent";function du(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[qI],p;if(Array.isArray(u)?p=u:p=[u],p.find(g=>d.indexOf(g)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(g=>e(g)).filter(g=>g!=null)}},n=(h,d,u)=>{let p=KI.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let m=gn(h,d,[],p);return o(t(h,u),m,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let m=0;m<h.length;m++)p=n(h[m],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 qs(i){return(r,e,t)=>{let n=yc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function gS(i){i.anchorPositions!=null&&(i.anchorPositionFinder=qs(i.anchorPositions))}var uu=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.component,edge:d.overlay.component.edge,model:d.overlay.component.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(mS(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=du([r,xe],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:ir.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||vE;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||Ks)+" "+au,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:ir.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===Fi?Fi:cu}})})}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=du([r,xe],this.nodes);return delete e.parent,gS(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=du([r,xe],this.ports);return delete e.parent,gS(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=du([r,xe],this.groups);return delete e.parent,gS(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(K(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(H(r))return this.getPortDefinition(e)}};function pu(){return{c:new Set,e:new Set}}var X_=class{constructor(){c(this,"affectedElements",new Set)}};function H_(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 QI(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)=>xt({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),m=d(r+t,e+n),g=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,m.x,g.x),x=Math.max(u.x,p.x,m.x,g.x),f=Math.min(u.y,p.y,m.y,g.y),b=Math.max(u.y,p.y,m.y,g.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 CE=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},j_=(i,r)=>CE(i,r)*-1;function PE(i,r,e,t,n){Vm({id:i,value:r,otherBound:e},t,CE,n)}function Bo(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var mu=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"$d",null);c(this,"rtree");c(this,"Ye",!1);c(this,"Va",!0);c(this,"O",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"N",{});c(this,"Ga",{});c(this,"Xe",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Ys(4)}setSuspended(r){this.Ye=r,this.Ye||(this.recomputeBounds(),this.gE())}getExtents(){return Object.assign({},this.Xe)}EE(r,e,t){e!=null&&(Bo(r,this.O.xmin),Bo(r,this.O.xmax),Bo(r,this.O.ymin),Bo(r,this.O.ymax),PE(r,e.t.x,e.t.x2,this.O.xmin,!1),PE(r,e.t.x2,e.t.x,this.O.xmax,!0),PE(r,e.t.y,e.t.y2,this.O.ymin,!1),PE(r,e.t.y2,e.t.y,this.O.ymax,!0),t!==!0&&this.es())}es(){this.Xe.xmin=this.O.xmin.length>0?this.O.xmin[0].value:0,this.Xe.xmax=this.O.xmax.length>0?this.O.xmax[0].value:0,this.Xe.ymin=this.O.ymin.length>0?this.O.ymin[0].value:0,this.Xe.ymax=this.O.ymax.length>0?this.O.ymax[0].value:0}recomputeBounds(){if(this.Va){this.Va=!1,this.O.xmin.length=0,this.O.xmax.length=0,this.O.ymin.length=0,this.O.ymax.length=0;for(let r in this.N){let e=this.N[r];this.O.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.O.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.O.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.O.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.O.xmin.sort(CE),this.O.ymin.sort(CE),this.O.xmax.sort(j_),this.O.ymax.sort(j_),this.es()}}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.O.xmin.length;a++){let l=this.O.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.N[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.N[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.O.xmin.length;a++){let l=this.O.xmin[a];if(n.indexOf(l.id)===-1&&Dm(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.N[l.id];if(Dm(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.N[d]),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=sx(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}fE(r,e,t){e.t=QI(r,e.x,e.y,e.width,e.height,e.r),this.Ga[r]=e.t,this.Va=!0,t!==!0&&(this.Ye||this.EE(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Ye||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=xs(this.N,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=e==null&&h.x==null||t==null&&h.y==null||n==null&&h.width==null||o==null&&h.height==null,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=xt({x:h.x,y:h.y},h.c,h.r),this.$d==null?this.fE(r,h,l):this.$d.affectedElements.add(r)),h}$forEachElement(r){for(let e in this.N)r(this.N[e])}$refreshEveryElement(){for(let r in this.N)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.N[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t||this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s.el,a);return(isNaN(l.x)||isNaN(l.y))&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s.el)),this.updateElement(r,l.x,l.y,a.width,a.height,o,null,e)}else return null}yE(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.Xe.xmax-this.Xe.xmin}getBoundsHeight(){return this.Xe.ymax-this.Xe.ymin}getX(){return this.Xe.xmin}getY(){return this.Xe.ymin}setSize(r,e,t){if(this.N[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.N[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.N[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.O.xmin.length=0,this.O.xmax.length=0,this.O.ymin.length=0,this.O.ymax.length=0,this.N={},this.Ga={},this.rtree.clear(),this.es()}remove(r){Bo(r,this.O.xmin),Bo(r,this.O.xmax),Bo(r,this.O.ymin),Bo(r,this.O.ymax),delete this.N[r],delete this.Ga[r],this.rtree!=null&&this.rtree.removeById(r),this.es()}$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,m,g,E;let u=this.getElement(d);if(u!=null){let y=((p=n[u.id])==null?void 0:p.x)||u.x,x=((m=n[u.id])==null?void 0:m.y)||u.y,f=((g=o[u.id])==null?void 0:g.width)||u.width,b=((E=o[u.id])==null?void 0:E.height)||u.height;s=Math.min(s,y-e),l=Math.min(l,x-t),a=Math.max(a,y-e+f),h=Math.max(h,x-t+b)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}gE(){this.rtree.clear();let r=Object.values(this.N).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.N[r]}getElements(){return this.N}isEmpty(){return Object.keys(this.N).length===0}getElement(r){let e=this.N[r];if(e)return e.dirty?this.$refreshElement(r,!1):e}getElementPosition(r){return this.N[r]!=null?rr(this.N[r]):null}getElementSize(r){return this.N[r]!=null?fs(this.N[r]):null}getElementBounds(r){return this.N[r]!=null?Object.assign(rr(this.N[r]),fs(this.N[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=H_(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.N[r]=l,Y(t)){let m=a;m.collapsed=!1,m.enabled=!0,m.contentArea=this.instance.$getGroupContentAreaElement(e),m.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(m.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}};var eM="currentFace",k_={[Et]:Ct,[vt]:Tt,[Tt]:vt,[Ct]:Et},W_={[Et]:vt,[vt]:Ct,[Tt]:Et,[Ct]:Tt},Z_={[Et]:Tt,[vt]:Et,[Tt]:Ct,[Ct]:vt};function tM(i){return i.faces.length===0?Et:i.faces[0]}function Ml(i,r){return i.faces.indexOf(r)!==-1}function rM(i,r){return(i.clockwise?W_:Z_)[r]}function nM(i,r){return(i.clockwise?Z_:W_)[r]}function OE(i,r,e){let t=()=>Ml(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function iM(i,r){if(Ml(i,r))return r;if(Ml(i,k_[r]))return k_[r];{let e=rM(i,r);if(Ml(i,e))return e;{let t=nM(i,r);if(Ml(i,t))return t}}return r}function ES(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:V(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,Bd:null};return Object.defineProperty(t,eM,{get(){return this.Bd},set(n){this.Bd=iM(this,n)}}),t}var fS={Continuous:{faces:[Et,Tt,Ct,vt]},ContinuousTop:{faces:[Et]},ContinuousRight:{faces:[vt]},ContinuousBottom:{faces:[Ct]},ContinuousLeft:{faces:[Tt]},ContinuousLeftRight:{faces:[Tt,vt]},ContinuousTopBottom:{faces:[Et,Ct]}};function oM(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 J_={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},K_={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},q_={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},Q_={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},sM={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},aM={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},lM={x:0,y:1,ox:0,oy:1,offx:0,offy:0},hM={x:1,y:1,ox:0,oy:1,offx:0,offy:0},cM={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},eR={Top:[J_],Bottom:[K_],Left:[q_],Right:[Q_],TopLeft:[sM],TopRight:[aM],BottomLeft:[lM],BottomRight:[hM],Center:[cM],AutoDefault:[J_,q_,K_,Q_]};function tR(i,r){r=r||{};let e=eR[i];if(e!=null)return _E(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=fS[i];if(t!=null)return ES(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function _E(i,r,e,t){return{objectType:qg,type:i,locations:r,currentLocation:0,id:V(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function rR(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function gu(i,r,e){let t=ft(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&oM(t,e),t}function dM(i){return i.objectType===qg}function ft(i,r){if(dM(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)),z(i)){let e=tR(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(rR(i))return _E(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(z(t)){let n=eR[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(rR(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 _E("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return tR(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var uM="___sourceMarker",pM="___targetMarker",Qs="__label",AS="vjs-default-label",yS="overlay",iR="labelLocation";function mM(i,r){let e={cssClass:r.cssClass,id:Qs,component:i},t=Object.assign(e,r);return new ir(i.instance,i,t)}function gM(i,r){let e=null;if(z(r))e=nt.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=nt.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||V(),we.cacheTypeItem(i,yS,e,e.id),i.overlays[e.id]=e,e}function Gl(i,r){let e=gM(i,r);if(e.type===ir.type&&!z(r)){let t=e,o=r.options.labelLocationAttribute||iR,s=i.edge.data[o];s&&(t.location=s),TE(t,i.edge.data)}return e}function Vl(i,r){return i.overlays[r]}function oR(i){return i.overlays}function EM(i,r){let e=Vl(i,r);e&&i.instance.setOverlayVisible(e,!1)}function sR(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 fM(i,r){let e=Vl(i,r);e&&i.instance.setOverlayVisible(e,!0)}function aR(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 yM(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions=null,i.overlayPlacements={}}function Ui(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 xM(i,...r){for(let e=0,t=r.length;e<t;e++)Ui(i,r[e])}function lR(i){return Vl(i,Qs)}function bM(i,r){let e=lR(i);if(e)if(z(r)||Tr(r))e.setLabel(r);else{let t=r;t.label&&e.setLabel(t.label),t.location&&(e.location=t.location)}else{let t=z(r)||Tr(r)?{label:r}:r;e=mM(i,t),i.overlays[Qs]=e}}var xS="add",bS="remove",Eu="anchors",RE="connector";function nR(i,r,e){for(let t in i.overlays)r===xS?i.instance.$addOverlayClass(i.overlays[t],e):r===bS&&i.instance.$removeOverlayClass(i.overlays[t],e)}function SS(i,r,e){let t=null;r.connector!=null&&(t=we.getCachedTypeItem(i,RE,e.connector),t==null&&(t=kt.Fd(i,r.connector,e.connector),we.cacheTypeItem(i,RE,t,e.connector)),kt.setPreparedConnector(i,t)),we.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=we.getCachedTypeItem(i,yS,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.Qo!==Fi&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=Gl(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&&Ui(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=we.getCachedTypeItem(i,Eu,e.anchor),s==null&&(s=[ft(r.anchor),ft(r.anchor)],we.cacheTypeItem(i,Eu,s,e.anchor))):r.anchors&&(s=we.getCachedTypeItem(i,Eu,e.anchors),s==null&&(s=[ft(r.anchors[0]),ft(r.anchors[1])],we.cacheTypeItem(i,Eu,s,e.anchors))),s!=null&&i.instance.router.setConnectionAnchors(i,s);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Wr(i,r){we.addClass(i,r),nR(i,xS,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function Or(i,r){we.removeClass(i,r),nR(i,bS,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var kt={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&&we.cacheTypeItem(i,RE,r,n),Wr(i,s),o!=null){let a=oR(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,we.destroy(i)},setVisible(i,r){we.setVisible(i,r),r?aR(i):sR(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},Fd(i,r,e){let t={},n;if(z(r))n=Ne.get(i,r,t);else{let o=r;n=Ne.get(i,o.type,gn(o.options||{},t))}return e!=null&&(n.typeId=e),n},Ud(i,r,e,t,n){let o=kt.Fd(i,r,n);kt.setPreparedConnector(i,o,e,t,n)}};function TS(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function hR(i,r,e){for(let t in r)i[t]=e}var AM="connector",SM="override",TM="cssClass",cR="__default",vM="anchor",CM="anchors";function LE(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return hR(e,t,cR),i.$types.forEach(o=>{if(o!==cR){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([AM,vM,CM]);if(s.mergeStrategy===SM)for(let l in s)a.add(l);n=gn(n,s,[TM],Array.from(a)),hR(e,s,o)}}}),r&&(n=ho(n,r,"_")),Fo(i)&&SS(i,n,e),e}function Fo(i){return i.objectType===wE}var wE="connection";function vS(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&Fo(i)&&Or(i,e.cssClass)}function fu(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var PM="add",OM="remove";function _M(i){if(Fo(i))return{x:i.connector.x,y:i.connector.y}}function CS(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||V(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var we={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=TS(r),n=!1,o=s=>i.$types.has(s)?(vS(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&&LE(i,e)}},addType(i,r,e){let t=TS(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&&LE(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,fu(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,fu(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{vS(i,e)}),i.$types.clear(),LE(i,r)},setType(i,r,e){return we.clearTypes(i),(TS(r)||[]).forEach(i.$types.add,i.$types),LE(i,e)},applyType(i,r,e){we.setPaintStyle(i,r.paintStyle),we.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 dR(i,r){return r.theta-i.theta}function uR(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 OS={[Et]:uR,[vt]:dR,[Ct]:dR,[Tt]:uR};function _S(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,m=i.x+p,g=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=xt({x:m,y},i.c,i.r);m=f.x,y=f.y}a.push({x:m,y,xLoc:g,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Uo(i){return!i.isFixed&&i.isContinuous===!0}function RS(i){return[i.currentLocation,i.locations[i.currentLocation]]}function RM(i,r,e){let t=Ii[r].x,n=Ii[r].y;return PS(i,t,n,e,e/3)}function LM(i,r,e){let t=Ii[r].x,n=Ii[r].y,o=t===0?i.x-e:i.x+t*e*2,s=t===0?i.x+e:i.x,a=n===0?i.y-e:i.y+n*e*2,l=n===0?i.y+e:i.y,h=Math.min(o,s),d=Math.min(a,l),u=Math.max(o,s),p=Math.max(a,l);return{x:h,y:d,width:u-h,height:p-d}}function PS(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=tr(i,o,n),a=tr(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 wM(i,r,e,t){if(t.connector!=null){let n=2*Math.max(t.connector.sourceStub,t.connector.targetStub);return PS(i,r,e,n,n/3)}else return{x:i.x,y:i.y,width:1,height:1}}function yu(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:0,oy:0};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=xt(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}var DM=10;function NM(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=px([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 xu=class{constructor(r,e){this.instance=r;c(this,"anchorLists",new Map);c(this,"zd");c(this,"Ti");c(this,"vi");c(this,"Ci");c(this,"ut");c(this,"rs",new Map);c(this,"Yd",null);e=e||{},this.Ti=e.gridCellSize||DM,this.zd=e.avoidVertices===!0,this.vi=e.vertexBuffer||2,this.Ci=e.vertexBorder||2}$connectionRemoved(r){Uo(r.connection.anchors.source)&&this.$_removeAnchorFromAnchorLists(r.connection.sourceId,r.connection.anchors.source),Uo(r.connection.anchors.target)&&this.$_removeAnchorFromAnchorLists(r.connection.targetId,r.connection.anchors.target)}elementRemoved(r){r!=null&&this.anchorLists.delete(r.id)}xE(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;_t(o.top,s),_t(o.left,s),_t(o.bottom,s),_t(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)}$connectionDetachedFromElement(r,e){this.xE(r,e)}$setCurrentLocation(r,e,t){r.currentLocation=e}bE(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=yu(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=RS(r);if(r.locations.length===1||s==null||a==null)t=yu(h,n,o,e);else{let[d,u]=this.AE(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&this.$setCurrentLocation(r,d,e.connection),t=yu(u,n,o,e)}}return r.computedPosition=t,t}SE(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(OS[o]),p=o===ut||o===Se,m=_S(t,u,l,h,p);for(let g=0;g<m.length;g++)m[g].a.locations[0]={x:m[g].xLoc,y:m[g].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},m[g].a.currentLocation=0}};n(st,t,e.bottom,!0,1,{x:0,y:1}),n(Se,t,e.top,!0,0,{x:0,y:-1}),n(Ye,t,e.left,!1,0,{x:-1,y:0}),n(ut,t,e.right,!1,1,{x:1,y:0})}ts(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,m=-1,g={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]=g;else{let f=l?m!==-1?m:0:E.length;E.splice(f,0,g)}e.currentFace=h}$_removeAnchorFromAnchorLists(r,e){let t=this.anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;_t(o.top,a),_t(o.left,a),_t(o.bottom,a),_t(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)}computeAnchorLocation(r,e){let t=this.bE(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=this.computeAnchorLocation(r.anchors.source,{xy:t,wh:t,elementId:t.id,timestamp:e,rotation:this.instance.$getRotations(r.sourceId),txy:n,twh:n}),a=this.computeAnchorLocation(r.anchors.target,{xy:n,wh:n,elementId:n.id,timestamp:e,rotation:this.instance.$getRotations(r.targetId),txy:t,twh:t});RA(r.connector);let l={sourcePos:s,targetPos:a,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=iE(o,l),rE(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let h=o.geometry==null||o.geometry.source==null?!1:!lE(s,o.geometry.source),d=o.geometry==null||o.geometry.target==null?!1:!lE(a,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(h||d)&&Mi(r),o.edited){let u=this.TE(r,o,l,e,h,d);Ne.setGeometry(r,u,!1)}else{let u=this.vE(r,o,l,e);Ne.setGeometry(r,u,!0)}nE(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}prepareAnchor(r){return ft(r)}Gb(r){let e=Math.max(r.sourceStub,r.targetStub);return Math.max(this.instance.$_vertexBuffer,e)}CE(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.Yd){let v=this.rs.get(p);if(v!=null)return v}else this.rs.clear();this.Yd=u;let m={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:m.IDENTITY,a:[Se,Se]};let g=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,O)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[Ye]:{x:O[P][0].x,y:O[P][0].c.y},[ut]:{x:O[P][0].x+O[P][0].width,y:O[P][0].c.y},[Se]:{x:O[P][0].c.x,y:O[P][0].y},[st]:{x:O[P][0].c.x,y:O[P][0].y+O[P][0].height}},O[P][1]!=null&&O[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=mx(x[v[P]][I],O[P][1])})([Qe,xn],[[t,a],[n,l]]);let f=[Se,Ye,ut,st];for(let v=0;v<f.length;v++)for(let O=0;O<f.length;O++)y.push({source:f[v],target:f[O],dist:Math.round(Be(x.source[f[v]],x.target[f[O]]))});y.sort(function(v,O){if(v.dist<O.dist)return-1;if(O.dist<v.dist)return 1;{let P={[Ye]:0,[Se]:1,[ut]:2,[st]:3},I=P[v.source],C=P[O.source],_=P[v.target],w=P[O.target];return I<C?-1:C<I?1:_<w?-1:w<_?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let O=y[v];if(!Uo(o)||OE(o,O.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=Ii[P],_=this.Ti*(this.Ci+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(_*C.x)),height:Math.max(1,Math.abs(_*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Uo(s)||OE(s,O.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=Ii[P],_=this.Ti*(this.Ci+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(_*C.x)),height:Math.max(1,Math.abs(_*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 R={a:[b,A],theta:g,theta2:E};return this.rs.set(p,R),R}$redrawEveryConnection(){let r=V();return this.$a(Object.values(this.instance.$_connMap),r)}$redrawConnection(r,e){return this.$a([this.instance.$_connMap[r.id]],e)}$redraw(r,e){return this.$a(r.connections||[],e)}$a(r,e){let t=new Set,n=new Set;if(!this.instance.pt){e=e||V();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=Uo(a.anchors.source),u=Uo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),m=(a.anchors.target.faces||[]).join("-"),g=[l,p,h,m].join("-"),E=o[g];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.ts(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Se,t),this.ts(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Se,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.CE(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,g),o[g]=E),d&&this.ts(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.ts(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.SE(s,this.anchorLists.get(s))}),t.forEach(s=>{this.instance.$paintConnection(s,{timestamp:e})})}return{c:t}}reset(){this.anchorLists.clear(),this.rs.clear()}setConnectionAnchors(r,e){r.anchors.source=e[0],r.anchors.target=e[1]}AE(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,m)=>{let g=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:g,y:E,idx:m}}),d=l.locations.map((p,m)=>{let g=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:m,x:g,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let m=0;m<d.length;m++){let g=Math.round(Be(h[p],d[m]));u.push({d:g,idx:p,idx2:m})}return u.sort((p,m)=>p.d-m.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,m)=>({d:NM(p,h,d,r,e,o,s),idx:m}));return u.sort((p,m)=>p.d-m.d),[u[0].idx,a[u[0].idx]]}}};function pR(i,r,e,t,n,o,s,a){let l=Ir(r),h=kx(r),d=s(e,t,l,h);d.sort((p,m)=>{let g=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=m.axis===l&&m.directionFromParent===r.directionFromParent,x=m.axis===l&&m.directionFromParent!==r.directionFromParent;return g||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let m=d[p],g=e+m.dx,E=t+m.dy,y=m.axis,x=m.directionFromParent,f=r.ax+m.dx*n,b=r.ay+m.dy*n,A=i.getCell(g,E,null,null),T=A===a,S={cx:g,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(g-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 LS(i){let r=[],e=Ir(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Ir(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:Ir(i),length:o}}function IM(i){return i.axis===yn||i.axis===kn}function MM(i){return i.axis===he&&i.source.ax===i.target.ax||i.axis===ne&&i.source.ay===i.target.ay}function mR(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 VM(i,r,e){if(IM(i)||MM(i))mR(i,r,e);else{let t=i.axis===ne?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===he?(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===he?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===he?ne:he,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 gR(i,r,e){if(e===ne)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===he)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===yn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===kn)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function wS(i,r,e,t,n,o){let s=i,a=[];n=n||V();let l=LS(s);if(l.isFirstSegment)t===en?mR(l,a,n):VM(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,m=LS(l.target);for(;!p&&m!=null;){let g=gR(d,u,l.axis),E;E=gR(m.isFirstSegment?m.target.ax:m.target.cx,m.isFirstSegment?m.target.ay:m.target.cy,m.axis);let y=ox(g,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=m),m.isFirstSegment?p=!0:m=LS(m.target)}m!=null&&a.push({ax1:m.target.ax,ay1:m.target.ay,ax2:d,ay2:u,pathId:n,axis:m.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function ER(i,r,e,t,n,o){let s=wS(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},m=u+1,g=!1;for(;!g;){let E=s.segments[m];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:m-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[m-1].ax2,ay2:s.segments[m-1].ay2},finished:E==null};m++}}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 fR(i,r,e,t,n,o,s,a,l,h,d,u,p,m,g,E,y){E==null?E=new Os(i,r,s,h,d,u):E.reinitialize();let x=E.Uo(i.x,i.y),f=E.Uo(r.x,r.y),b=fg(n);b.axis==null&&(b.axis=Hx(i,r));let A=fg(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:gg,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let R=T,v=S,O=()=>a===en?ER(v,R,E,a,g,y):wS(v,R,E,a,y,!0),P=new zc,I=new Es(P.sort.bind(P),T),C,_,w=Ec(T.x,T.y,S.x,S.y)*100,B=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,_=Ir(C),B++,B>w)throw`too many iterations ${B} `;if(C===S)return O();P.node=C;let D=pR(E,C,C.x,C.y,s,u,m,S);for(let M=0,N=D.length;M<N;M++){let G=D[M];if(G.isTarget)return G.obj.parent=C,O();if(G.obj.closed||G.obj===T||G.obj===S||G.obstacles.length>0||G.buffers.length>0)continue;let J=0;G.axis!==_&&(J=.5),(!G.obj.opened||G.g<G.obj.g)&&(G.obj.g=G.g,G.obj.h=l(G.cx,G.cy,S.x,S.y)+J,G.obj.f=G.obj.g+G.obj.h,G.obj.parent=C,G.obj.ax=G.ax,G.obj.ay=G.ay,G.obj.opened?I.update(G.obj):(I.add(G.obj),G.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:gg,isEmpty:!0}}function DS(i,r,e,t,n,o,s,a,l,h,d,u,p,m){return fR(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(g,E,y,x)=>{if(l===en||l==null)return Eg(g,E,y,x);if(l===Oc)return Eg(g,E,y,x);if(l===tn)return Xx(g,E,y,x)},(g,E)=>{let y=a*d;return s.hasLineOfSight(E,y,g.sourceAndTargetObstacles)},p,m)}function NS(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 $l=class extends xu{constructor(e,t){super(e,t);this.instance=e;c(this,"Xd")}vE(e,t,n,o){return this.zd||e.avoidVertices?this.OE(e,t,n,o):this.is(e,t,n)}TE(e,t,n,o,s,a){return Ne.update(e,t.paintInfo,n,s,a)}is(e,t,n){return Ne.compute(e,t.paintInfo,n)}OE(e,t,n,o){if(t.edited)this.is(e,t,n);else{let s=t,a=NS(n.sourcePos,t.sourceGap),l=NS(n.targetPos,t.targetGap),h={x:a.curX+t.sourceStub*a.ox,y:a.curY+t.sourceStub*a.oy},d={x:l.curX+t.targetStub*l.ox,y:l.curY+t.targetStub*l.oy},u=Math.min(h.x,d.x),p=Math.max(h.x,d.x),m=Math.min(h.y,d.y),g=Math.max(h.y,d.y),E={x:u,y:m,width:Math.max(p-u,10),height:Math.max(g-m,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(E,0,[],!1))return this.is(e,t,n);(this.ut==null||o!==this.Xd)&&(this.ut=new Os(h,d,this.Ti,this.Ci,this.vi,(y,x,f)=>this.instance.viewport.findVerticesAtPoint(y,x,f))),this.Xd=o;try{let y=e.edge?e.edge.id:e.id,x=DS(h,d,e.sourceId,e.targetId,a,l,this.instance.viewport,this.Ti,s.constrain,Ec,this.Ci,this.vi,this.ut,y);if(x.isEmpty)Ne.compute(e,t.paintInfo,n);else{x.segments.unshift({ax1:a.curX,ay1:a.curY,ax2:h.x,ay2:h.y,axis:Ps(a.ox,a.oy),pathId:y}),x.segments.push({ax1:d.x,ay1:d.y,ax2:l.curX,ay2:l.curY,axis:Ps(l.ox,l.oy),pathId:y});let f=uE(x.segments.map(A=>Object.assign({x1:A.ax1,y1:A.ay1,x2:A.ax2,y2:A.ay2,o:A.axis||GM(A)},A)));return Zd(e.connector,f),{segments:s.$pathSegments,source:n.sourcePos,target:n.targetPos,quadrant:t.paintInfo.quadrant}}}catch(y){return this.is(e,t,n)}}}};c($l,"type",xe);function GM(i){return i.axis!=null?i.axis:i.ax1===i.ax2?he:i.ay1===i.ay2?ne:null}var IS="fill",DE="stroke",MS="stroke-width",$M="strokeWidth",ve="svg",VS="defs",te="path",ze="circle",GS="ellipse",Je="text",NE="tspan",Z="rect",q="g",BM="version",FM="xmlns",UM="fill",IE="stroke-dasharray",YM="stroke-linejoin",zM="stroke-linecap",XM="stroke-miterlimit",jM="stroke-dashoffset",HM="stroke-opacity",kM="stroke",WM="stroke-width",bu="vector-effect",Au="non-scaling-stroke",ZM="text-anchor",Wt="http://www.w3.org/2000/svg",JM="http://www.w3.org/1999/xlink",KM="http://www.w3.org/1999/xhtml";var Su=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Ve,Re],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 yR=.5;function $S(i,r){var b,A;let e=CS(i,wE,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=ii(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[Qs]={type:ir.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||yR,id:Qs,cssClass:AS}}),r.sourceMarker){let T=ii(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=ii(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=ft(l,d),m=ft(h,u),g=i.$_edgesDetachable;r.detachable===!1&&(g=!1);let E=i.$_reattachEdges===!0,y=Is({},r.paintStyle||i.defaults.paintStyle);we.appendToDefaultType(e,{detachable:g,reattach:E,paintStyle:y,hoverPaintStyle:Is({},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:m},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:g,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[Qe]:[],[xn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});kt.Ud(x,r.connector||i.$defaultConnector,!0);let f=[xe,r.type].join(" ");return/[^\s]/.test(f)&&we.addType(x,f,r.data),x}var Bl=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 Tu=class{constructor(r,e){this.gridProfile=e;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 xR={},or={get:i=>{let r=xR[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{xR[i]=r}};function wt(i){return function(r){or.register(i,r)}}function vu(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 m=(isFinite(i.xmax)?i.xmax:0)+u+l,g=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||m,m),y=Math.min((a==null?void 0:a.height)||g,g);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 BS(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=ft(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===Qe?n.anchors.source=l:n.anchors.target=l,kt.setVisible(n,o.originallyVisible),s}return null}function FS(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=ft(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=ft(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=tA(o.proxies[e]),l=a!=null?a.originalElement.id:e===Qe?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===Qe?o.anchors.source:o.anchors.target;e===Qe?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}),kt.setVisible(o,!0),i.$revalidateElementById(t.id)}}var qM=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function ME(i,r,e){r!=null&&(Im(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,Ll)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(Im(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,Ll))}function VE(i,r,e){if(r!=null){let t=r.connections.length;_t(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,Ll)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&_t(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,Ll)}}var QM=2,e1=2,Cu=class extends It{constructor(e,t,n,o,s){var l,h,d,u,p,m,g,E,y,x,f,b,A,T;super();c(this,"Ba",[]);c(this,"Fa",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Oi",{});c(this,"hoverSuspended",!1);c(this,"pt",!1);c(this,"jd",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"connectorClass",Zs);c(this,"connectorOutlineClass",rS);c(this,"connectorPathClass",tS);c(this,"overlayClass",Js);c(this,"labelOverlayClass",iS);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"os");c(this,"viewport",new mu(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"Ua",new Map);c(this,"me");c(this,"za",new Set);c(this,"kd");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"Hd");c(this,"Wd");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,"j",1);c(this,"$collapsedGroupSizeCalculator");c(this,"Zd");c(this,"Ya");c(this,"Xa");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,"PE");c(this,"ss");c(this,"rootElement");c(this,"wt",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||V(),this.gridProfile=new Bl(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)||_n,this.Hd=(h=o.edges)==null?void 0:h.sourceMarker,this.Wd=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>ii(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((m=o.edges)==null?void 0:m.anchors)||[null,null],this.defaults={[hu]:null,[uS]:1,[$o]:{strokeWidth:2,stroke:"#000000"},[bE]:"vjs_defaultscope",[xE]:!0,[cS]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Oi,this.defaults),this.Oi[$o]!=null&&(this.Oi[$o].strokeWidth=this.Oi[$o].strokeWidth||2),this.kd=this.defaults[bE],this.allowNestedGroups=this.Oi[xE]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[lS]:QM,this.$_vertexBorder=o.edges?o.edges[aS]:e1,this.os=((g=o.edges)==null?void 0:g.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=new $l(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.os}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Tu(o.magnetizer||{},this.gridProfile),this.magnetizer=new Ti({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,R)=>{}}),this.ss=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.ss=!1),this.setContainer(n),this.$setView(o.view),this.ja(pt,S=>{let R=this.$_connMap[S.edge.getId()];if(R){let v=this.dataSource.getEdgeType(S.edge.data),O=[...new Set([xe,v])];if(this.$_setConnectionType(R,O.join(" "),S.edge.data),this.ss===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(R,P,!0)}this.le(P=>{P.$edgeUpdated(S.edge,R)})}}),this.ja(Kc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=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(R),this.le(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.ja(Jc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=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(R),this.le(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=qe.get(As.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:uo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.Zd=o.defaultCollapsedGroupSize||{width:200,height:150},this.Ya=o.canCollapseGroup,this.Xa=o.canExpandGroup}get defaultScope(){return this.kd}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.j}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&&H(t.target)&&(s=this.Jd(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this._E(n,s,!bi(e.old))):(delete this.$_connMap[t.getId()],this.ka(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(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,Bi)}else if(Ke(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,Dl)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,Bi)}}setSuspendRendering(e,t){}$deselect(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,Bi)}else if(Ke(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,Dl)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,Bi)}}$selectionCleared(e){this.$getSelector(this.me,"."+Dl).forEach(t=>this.$removeClassFromElement(t,Dl)),this.$getSelector(this.me,"."+Bi).forEach(t=>this.$removeClassFromElement(t,Bi))}Jd(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&&H(t.source)&&(s=this.Jd(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.RE(n,s,!bi(e.old)):(delete this.$_connMap[t.getId()],this.ka(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(Oi,e)}ja(e,t){this.Ba.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(ud)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=V();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.router.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(Sn)}}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=ot(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.as(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},St),h}}Kd(){let e,t,n,o,s,a=!1,l=V();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.qd(h[e],nl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.wt.length!==0}LE(e,t,n,o){let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(H(o.source)?null:this.$getAttribute(e,ri)||this.$getAttribute(e,Hr)),h=n.targetPortType||(H(o.target)?null:this.$getAttribute(e,Gi)||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 qM.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}wE(e,t,n,o){var R,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=H(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=H(s.target)?s.target.getParent():s.target,m=this.getElement(p.id),{sourceDef:g,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.LE(u.el,m.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.Hd,targetMarker:h.targetMarker||this.Wd};[lu,hS,dS].forEach(O=>{h.hasOwnProperty(O)&&(f[O]=h[O])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(O,P,I,C,_)=>{if(C&&C[I]){let w=O[P]||[C[I],C[I]];w[_]=C[I],O[P]=w}};g!=null&&A(f,Il,Nl,g,0),E!=null&&A(f,Il,Nl,E,1);let T=f;if(T.avoidVertices=this.os||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,ho(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(R=s.anchors)!=null&&R.source)f.anchors[0]=ft(s.anchors.source);else{let O=a.positionOnSource||{x:0,y:0},P=g.anchorPositions||y.anchorPositions,I=g.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=gu(P.slice(),null,O);else if(I!=null){let C=I(u.el,O,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]=ft(s.anchors.target);else{let O=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=gu([a.targetAnchor]);else if(P!=null)f.anchors[1]=gu(P.slice(),null,O);else if(I!=null){let C=I(m.el,O,s.target,E);f.anchors[1]=C}}this.ss===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=$S(this,f);if(S!=null){ME(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(Ne.importGeometry(S,T.geometry),this.$revalidateElementById(S.sourceId,o),this.$revalidateElementById(S.targetId,o)),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.PE&&this.refresh(),(m.visible===!1||u.visible===!1)&&this.ls(s,!1),T.geometry||this.$revalidateElementById(S.sourceId,o);let O={connection:S,edge:s,reason:e.reason};this.fire(sb,O)}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.Jn(),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.le(o=>{o.$groupRemoved(t)})),t}qd(e,t,n,o,s,a){this.wt.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.wt.length,n=[];if(t>0){let o=[];for(let s=0;s<this.wt.length;s++)this.DE(this.wt[s],e)==null?o.push(this.wt[s]):n.push(this.wt[s].edge);this.wt=o}return n}DE(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.wE(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.qd(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.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.ka(n,{fireEvent:!1,force:!0}),this.le(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?Ne.importGeometry(o,t):Mi(o),this.$revalidateElementById(e.source.getFullId()),this.fire(Zn,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:Yr(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(V()))}$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.le(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.Qd(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===Bs&&this.os){let d=this.model.getAllEdges().filter(u=>jn(u.source).id!==e.vertex.id&&jn(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===Ad?this.NE(this.getElement(t.id),e.originalData):this.fire(Vs,this.getElement(t.id)),this.le(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}NE(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)?Gr:Lt;this.fire(s,o)}IE(e){this.fire(Le,e)}getLayoutFor(e){return jm(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,Nb),this.le(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.le(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.le(o=>{o.$nodeRemoved(t)}),this.IE(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,Rl),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&&kt.Ud(o,s.connector),we.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=K(e),a=Y(e);this.$setAttribute(t,ee,e.getFullId());let l=s?$i:a?Go:H(e)?oS:"";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,Pt,this.$getAttribute(h.el,Pt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,Bi)),K(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let g=this.eu(e.group);this.$appendElement(t,g)}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 m=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.Qd(e,p,!this.$_dataLoading,!1),K(e)){if(!d){let g={el:t,id:e.id,vertex:e,size:u};this.fire(Br,g)}}else if(Y(e)){let g={el:t,vertex:e,id:e.id,size:u},E=m,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:uo.type};this.layoutMap.set(e.id,this.tu(x,e)),this.fire($r,g),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}if(this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender())this.$dataLoadEnd(!1);else if(!this.$_dataLoading){d&&this.le(y=>{y.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})});let g=V(),E=this.$flushUnrenderedEdges(null);this.$unrenderedVertices.size===0&&this.refresh(),E.forEach(y=>{this.viewport.$refreshElement(y.source.getFullId()),this.viewport.$refreshElement(y.target.getFullId()),this.router.$redrawConnection(y,g)})}}ls(e,t,n){let o=this.$_connMap[e.id];o&&kt.setVisible(o,t)}isVisible(e){return this.ru(e,t=>{switch(t.type){case Fe.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case de.objectType:case le.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Fe.objectType:this.ls(s.obj,t,n);break;case de.objectType:case le.objectType:this.ME(s,t,n);break;case pe.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.ru(e,o)}ME(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.$b=t,e.managedElement.visible=t,this.fire(pd,{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.ls(o[s],t,n);else{let a=jn(o[s].source),l=jn(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.ls(o[s],t,n)}}}ru(e,t){let n;if(Hb(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=K(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.me}setZoom(e,t){return this.j=e,e}F(e){if(e==null)return null;let t=this.$getAttribute(e,Pt);return(!t||t==="undefined")&&(t=`vjs-${V()}`,this.$setAttribute(e,Pt,t)),t}setContainer(e){this.me=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}RE(e,t,n){VE(e,this.getElement(e.sourceId)),this.$revalidateManagedElement(this.getElement(e.sourceId));let o=this.nu(e,t,0,n);ME(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$revalidateManagedElement(this.getElement(o.newSourceId))}_E(e,t,n){VE(e,this.getElement(e.targetId)),this.$revalidateManagedElement(this.getElement(e.targetId));let o=this.nu(e,t,1,n);ME(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$revalidateManagedElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=we.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.pt;return this.pt=e,e?this.jd=""+new Date().getTime():this.jd=null,this.pt||(this.autoSizeGroups(Array.from(this.za.keys()).map(o=>o.modelObject)),this.za.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.pt===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}An(e){let t=e.elId;return e.recalc?this.viewport.$refreshElement(t,!1,e.pos,e.size):this.viewport.getPosition(t)}VE(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}ka(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.VE(e)===!0)?(VE(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:rl,edge:e.edge}),delete this.$_connMap[e.id],kt.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,Pt)==null&&this.$setAttribute(e,Pt,l);let h=this.getElement(l);return h==null?(h=this.viewport.addElement(l,e,t,n,o,s),this.pt||this.An({elId:l,recalc:!0,pos:n,size:o,rotation:s})):a&&this.An({elId:l,timestamp:null,recalc:!0}),h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.F(s),l=this.getElement(a);this.router.elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,Pt),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},Gs,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},Xb,!1)},St)}Qd(e,t,n,o){let s=z(e)?e:e.id;if(this.getElement(s)){this.viewport.yE(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.le(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$revalidateElementById(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((K(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&&(t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.F(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.An({elId:e.id,recalc:!0,timestamp:t}),this.$repaintUIElement(e)):pu()}repaintEverything(e){let t=V();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}repaint(e,t){let n=this.getObjectInfo(e,!1);n!=null&&(t&&this.$setViewportElementPosition(n.managedElement,n.managedElement),this.$repaintUIElement(n.managedElement))}$repaintUIElement(e,t,n){let o=pu(),s=a=>{a.c.forEach(l=>o.c.add(l))};if(!this.pt&&e!=null){let a=this.$getAssociatedElements(e.el).map(l=>this.getElement(this.F(l))).filter(l=>l!=null);if(t==null&&(t=V()),!n)for(let l=0;l<a.length;l++)this.An({elId:a[l].id,recalc:!0,timestamp:t});if(s(this.router.$redraw(e,t,null)),a.length>0)for(let l=0;l<a.length;l++)s(this.router.$redraw(a[l],t,null))}return o}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.reset(),this.wt.length=0,this.$unrenderedVertices.clear(),this.za.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(K)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.Fa.length;e++)this.off(this.me,this.Fa[e][0],this.Fa[e][1]);this.reset(),this.unbind(),this.Ua.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.Ua.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=ii(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=ii(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=ii(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.Ua.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===Qe?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===xn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),VE(n,h,d),ME(n,a,l))}Ha(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=En(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.Wa(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,m=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||m<0)){let g=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let g=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=z(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.Xa?this.Xa(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.iu(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[yE],[fE]);let l=new Set,h=new Set,d=new Set;this.ou(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 m in p)this.model.updateVertex(m,p[m])}this.Ha(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.le(p=>{p.$groupExpanded(n)}),this.fire(dd,{group:t})}}},St,!0)}$_proxyEdge(e,t,n,o){FS(this,e,t,n,o)}$_unproxyEdge(e,t,n){return BS(this,e,t,n)}ou(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=Wm(e.modelObject,!0,!0);this.An({elId:e.id,recalc:!0}),a.forEach(d=>{this.An({elId:d,recalc:!0})});let h=Ka(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?xn:Qe})}),h.right.forEach(d=>{o.add(d)}),this.su(e).forEach(d=>{this.ou(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(z(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=z(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.Ya==null?null:this.Ya(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.iu(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[fE],[yE]);let h=new Set,d=new Set;this.au(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 m in p)this.model.updateVertex(m,p[m])}this.Ha(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.le(p=>{p.$groupCollapsed(n)}),this.fire(cd,{group:t})}}},St,!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.Zd}su(e){return e.modelObject.members.filter(t=>t.objectType===le.objectType).map(t=>this.viewport.getGroupElement(t.id))}au(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=Wm(e.modelObject,!0,!0);if(e.proxied!==!1){let a=Ka(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?xn:Qe})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.su(e).forEach(a=>{this.au(a,t,n)})}GE(){return this.lu(this.dataSource.getGroups().filter(this.objectFilter))}lu(e){let t=[];return e.forEach(n=>{let o=En(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===Db&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=pu();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.$E(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).c.forEach(l=>o.c.add(l))}),o}relayout(e,t){this.cu(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},Tn,t)}refresh(e){this.cu(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Ms,e)}cu(e,t,n,o){if(!this.pt){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let g in l)p.push(this.dataSource.getVertex(g));this.magnetizer.setElements(p);let m=this.magnetizer.executeAtCenter({getPosition:g=>l[g.id],getSize:g=>a.sizes[g.id]});for(let g in m.current)l[g]=m.current[g]}let h=this.BE(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(g,E)=>h.info[g].positions[E]||this.getElementPosition(E),m=(g,E)=>a.sizes[E]||h.info[g].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(g=>{let E=xi();g.group.members.forEach(x=>{let f=p(g.group.id,x.id),b=m(g.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.Wa(g.group,l,a.sizes,E,!1);if(y!=null&&(s[g.group.id]={group:g.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[g.group.id]!=null&&(l[g.group.id]=y.position),u[g.group.id]=this.$_getGroupContentAreaInfo(g.group.id),a.sizes[g.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[g.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 m=p.group.id,g=h.info[m],E=l[m]||rr(g.element),y=u[m]||this.$_getGroupContentAreaInfo(m);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:g.positions,sizes:g.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=V();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.pt&&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,kt.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)}}e.lastPaintedAt=n}}$addOverlay(e,t,n){let o=Gl(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$revalidateElementById(e.sourceId)),o}$removeOverlay(e,t){Ui(e,t),this.$revalidateElementById(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),fu(e),n&&this.$paintConnection(e)}$setView(e){this.view=new uu(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};return(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(s=>{let a=K(s.modelObject),l=a&&jm(s.modelObject),h=Y(s.modelObject),d=h&&Hm(s.modelObject),u=e.dontIncludeNodes===!0&&a,p=e.dontIncludeGroups===!0&&h,m=e.dontIncludeNodesInsideGroups&&l,g=e.dontIncludeNestedGroups&&d;return!(u||p||m||g)}).map(s=>({enclosed:e.enclosed,id:s.id,r:s,v:s.modelObject,el:s.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}eu(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(Fo(e)){let n=e.edge;return{obj:n,id:n.id,type:Fe.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.F(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===Fe.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)}}Za(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}FE(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 g=this.getObjectInfo(e,!1);if(g.obj)if(!l)p.focus=g.obj.id;else{let E=this.getElement(g.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===g.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let m=this.getGrid();return m&&(p.grid=m),p}cs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.Za());let p=this.FE(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)}as(e,t,n,o,s,a,l,h,d){let u=this.cs(e,t,n,o,s,null,a,l,h,d);this.hs(u,Yb)}magnetize(e,t){this.as(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.cs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.cs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.as(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.as(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.Za(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}hu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}UE(e,t){let n=this.hu(t);this.model.updateVertex(e,n)}hs(e,t,n){this.model.openTransaction(St);try{for(let o in e.current){let s=this.hu(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)),Pe(l.data,s,n.x),Pe(l.data,a,n.y)),n}$E(e,t){let n=z(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),Pe(n.data,this.$modelWidthAttribute,t.width),Pe(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.zE(a.obj,t,n,o,s===!1,!1,!1,!1);this.hs(l,Ad)}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.hs({original:{},current:u},Ad,()=>{this.Ha(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,wb),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))}zE(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.cs(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.YE()&&(d=se(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);Pe(l.data,n,h.x),Pe(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 Bl({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}YE(){return this.gridProfile!=null&&this.gridProfile.snap}Bb(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=se({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.Za());let o=this.magnetizer.snapToGrid(t);return this.hs(o,zb),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.lu(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.XE(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}XE(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.Wa(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}BE(){let e={orderedGroups:this.GE(),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(Zc,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.le(l=>{l.$groupResized(n)}),this.model.fire(Re,{vertex:o,updates:s,originalData:o.data,reason:Ub},null)}}}Wa(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),m=this.$_getGroupContentAreaInfo(e.id),g=m.contentArea,E=0,y=0,x,f,b=p(e.id),A=m.isGroupElement?p(e.id):this.$getSize(g),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),R=Object.assign({},u(e.id)),v,O=null;if(O!=null)E=O.layoutShiftX,y=O.layoutShiftY,x=O.width,f=O.height,v={x:R.x-E,y:R.y-y};else{let P=vu(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:R.x-E,y:R.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(g,x,f),!m.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,_=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),_<0&&(this.$setElementHeight(g,S-m.internalOffset.y),_=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),_>0&&(this.$setElementHeight(g,S-m.internalOffset.y),_=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)}du(e){let t={container:this.me,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:Pe(n.data,this.$modelLeftAttribute),y:Pe(n.data,this.$modelTopAttribute)})),qe.get(e.type,t)}tu(e,t){let n=this.eu(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:Pe(s.data,this.$modelLeftAttribute),y:Pe(s.data,this.$modelTopAttribute)};return z(a.x)&&(a.x=parseInt(a.x,10)),z(a.y)&&(a.y=parseInt(a.y,10)),a}),qe.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.du(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.du(e).layout(n=>{for(let o in n.positions)this.UE(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,{},[$i,sS].join(" "),{[ee]: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}uu(e){(e.plugins||[]).forEach(n=>{this.pu(n,!0)})}addPlugin(e){return this.pu(e,!0)}pu(e,t){let n=z(e)?e:e.type,o=z(e)?{}:e.options||{},s=or.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),t&&this.fire(md,s),s}getPlugin(e){return this.pluginMap.get(e)}le(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.j};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!z(e)&&Array.isArray(e)}};var t1=20,r1=20,GE=class GE extends Ln{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",GE.type);c(this,"contentTags",[te]);n=n||{},this.width=n.width||t1,this.length=n.length||r1,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 g=this.location<0?1:0;o=rt(e,g,this.location,!1),s=rt(e,g,this.location-this.direction*this.length/2,!1),a=Ut(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=rt(e,this.location,-this.length),a=Ut(o,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=rt(e,this.location,this.length),o=Ut(a,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else o=rt(e,this.location,this.direction*this.length/2),s=Xr(e,this.location),a=Ut(o,s,this.length);l=tr(o,a,this.width),h=Ut(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(GE,"type","Arrow");var _r=GE;nt.register(_r.type,_r);var $E=class $E extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",$E.type);this.foldback=1}};c($E,"type","PlainArrow");var Pu=$E;nt.register(Pu.type,Pu);var BE=class BE extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",BE.type);this.length=this.length/2,this.foldback=2}};c(BE,"type","Diamond");var Ou=BE;nt.register(Ou.type,Ou);var FE=class FE extends ni{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"type",FE.type);this.create=n.create}updateFrom(e,t){}};c(FE,"type","Custom");var Fl=FE;function sn(i){return i.type===Fl.type}nt.register(Fl.type,Fl);var bR=5,UE=class UE extends Ln{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Ce");c(this,"$r");c(this,"type",UE.type);c(this,"contentTags",[ze]);n=n||{},this.Ce=n.radius||bR,this.$r=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.$r==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=rt(e,this.location,this.Ce);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=rt(e,this.location,this.Ce);l=Ut(d,u,this.Ce),h=rt(e,this.location,2*this.Ce)}else if(this.location===1)if(this.$r==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=rt(e,this.location,-this.Ce);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=rt(e,this.location,-this.Ce);l=Ut(d,u,this.Ce),h=rt(e,this.location,-2*this.Ce)}else l=Xr(e,this.location),h=rt(e,this.location,this.Ce);return{atts:[{cx:l.x,cy:l.y,r:this.Ce,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Ce,xmax:l.x+this.Ce,ymin:l.y-this.Ce,ymax:l.y+this.Ce,tail:h}}};c(UE,"type","Dot");var _u=UE;nt.register(_u.type,_u);var AR=10,SR=10,YE=class YE extends Ln{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"mu");c(this,"$r");c(this,"type",YE.type);c(this,"contentTags",[te]);n=n||{},this.width=n.width||AR,this.height=n.height||SR,this.mu=n.rotate===!0,this.$r=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;if(this.mu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},O,P;this.$r==="center"?(P=rt(e,this.location,this.width/2),O=Ut(P,v,this.width)):(O=v,P=rt(e,this.location,this.width)),S=tr(P,O,this.height),R=tr(O,P,this.height),m=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},O,P;this.$r==="center"?(P=rt(e,this.location,-this.width/2),O=Ut(P,v,this.width)):(O=v,P=rt(e,this.location,-this.width)),S=tr(O,P,this.height),R=tr(P,O,this.height),m=P}else{let v=rt(e,this.location,this.width/2),O=Xr(e,this.location),P=Ut(v,O,this.width);S=tr(v,P,this.height),R=tr(P,v,this.height),m=P}g=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=R[1].x,b=R[1].y,A=R[0].x,T=R[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=Xr(e,this.location),m=v,g=v.x-this.width/2,E=v.y-this.height/2,y=g+this.width,x=E,f=y,b=E+this.height,A=g,T=E+this.height}return h=Math.min(g,y,f,A),d=Math.max(g,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${g} ${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:m}}};c(YE,"type","Rectangle");var Ru=YE;nt.register(Ru.type,Ru);var TR=8,vR=5,zE=class zE extends Ln{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",zE.type);c(this,"contentTags",[GS]);n=n||{},this.rx=n.rx||TR,this.ry=n.ry||vR}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=Xr(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:rt(e,this.location,(this.ry+this.rx)/2)}}};c(zE,"type","Ellipse");var Lu=zE;nt.register(Lu.type,Lu);var wu=class{constructor(r,e){this.surface=r;c(this,"Kt");c(this,"gu");e=e||{edgeMappings:[]},this.Kt=e.edgeMappings||[],this.gu=this.surface.model.edgeTypeFunction,this.jE()}computeTypes(r){let e=[this.gu(r)];for(let t=0;t<this.Kt.length;t++){let n=this.Kt[t].property,o=this.Kt[t].mappings;if(z(n)){if(r[n]!=null){let s=z(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[Er]!=null&&r[n]!=null&&e.push(`${n}_${Er}`)}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(" ")}jE(){for(let r=0;r<this.Kt.length;r++){let e=this.Kt[r].property,t=this.Kt[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=z(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.Kt}};function n1(i,r,e,t,n,o,s){return new Touch({target:i,identifier:V(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function i1(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function o1(i,r,e,t,n,o,s){return i1(n1(i,r,e,t,n,o,s))}function Ul(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 Du(i){return i.srcElement||i.target}function US(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 s1(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 a1=1,CR=!1,PR=!1;function wn(){return CR||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function oi(){return PR||"onmousedown"in document.documentElement}function LR(i){CR=i}function wR(i){PR=i}var Yi={[ue]:ub,[oe]:pb,[ie]:mb};function YS(i,r){if(i==null)return{x:0,y:0};let e=Yo(i),t=kE(e,0);return r(t)}function me(i){return YS(i,r=>({x:r.pageX,y:r.pageY}))}function l1(i){return YS(i,r=>({x:r.screenX,y:r.screenY}))}function h1(i){return YS(i,r=>({x:r.clientX,y:r.clientY}))}function kE(i,r){return i.item?i.item(r):i[r]}function Yo(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 HS(i){return Yo(i).length}function DR(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=Yo(i),e=kE(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function XE(i,r,e,t,n){_R(i,r,e),t.qt=e.qt,i.addEventListener&&i.addEventListener(r,e,!1,n)}function Nu(i,r,e){e!=null&&OR(i,t=>{c1(t,r,e),e.qt!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),wn()&&Yi[r]&&t.removeEventListener(Yi[r],e,!1)),e.Eu&&Nu(i,e.Eu[1],e.Eu[0])})}function OR(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 _R(i,r,e){let t=a1++;return i.Br=i.Br||{},i.Br[r]=i.Br[r]||{},i.Br[r][t]=e,e.qt=t,t}function c1(i,r,e){if(i.Br&&i.Br[r]&&delete i.Br[r][e.qt],e.Fr){for(let t=0;t<e.Fr.length;t++)Nu(i,e.Fr[t][0],e.Fr[t][1]);e.Fr.length=0}e.Ja&&e.Ja()}var d1=/:not\(([^)]+)\)/;function jE(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(d1);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(Er);let a=l=>{a.qt=e.qt;let h=Du(l),d=!1,u=h,p=US(l,h,r,i!=null);if(p.end!=-1)for(let m=0;!d&&m<p.end;m++){u=p.path[m];for(let g=0;g<s.length;g++)if(Ul(u,s[g],r))return;for(let g=0;!d&&g<o.length;g++)if(Ul(u,o[g],r)){e.apply(u,[l,u]),d=!0;break}}};return u1(e,t,a),a}}function u1(i,r,e){i.Fr=i.Fr||[],i.Fr.push([r,e])}var HE=(i,r,e,t,n)=>{if(wn()&&Yi[r]){let o=jE(t,i,e,Yi[r]);XE(i,Yi[r],o,e,n)}r===cb&&i.getAttribute(gE)==null&&i.setAttribute(gE,"1"),XE(i,r,jE(t,i,e,r),e,n)},zS={[W]:{touches:1,taps:1},[Fr]:{touches:1,taps:2},[gt]:{touches:2,taps:1}};function RR(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var XS=class{static generate(r,e){return(t,n,o,s)=>{if(n==gt&&oi())HE(t,n,o,s);else{if(t.je==null){let a=t.je={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let m=Du(p),g=US(p,m,t,s!=null),E=!1;for(let y=0;y<g.end;y++){if(E)return;m=g.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||Ul(m,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let m=Du(p),g,E;a.taps++;let y=HS(p);for(let x in zS)if(zS.hasOwnProperty(x)){let f=zS[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=US(p,m,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(g=E.path[A],a[x][b][1]==null||Ul(g,a[x][b][1],t)){a[x][b][0].apply(g,[p,g]);break}}}}};t.je.downHandler=d,t.je.upHandler=u,HE(t,ue,d),HE(t,oe,u)}t.je.downSelectors.push(s),t.je[n].push([o,s]),o.Ja=function(){t.je!=null&&(_t(t.je.downSelectors,a=>a===s),s1(t.je[n],o),t.je.downSelectors.length===0&&(Nu(t,ue,t.je.downHandler),Nu(t,oe,t.je.upHandler),delete t.je))}}}}},jS=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=Du(l);(o==null&&h==e&&!e.Me.over||Ul(h,o,e)&&(h.Me==null||!h.Me.over))&&(RR(Og,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=Du(l);for(let d=0;d<r.length;d++)h==r[d]&&!Ul(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),RR(_g,l,e,h))};XE(e,tt,jE(o,e,s,tt),s),XE(e,et,jE(o,e,a,et),a)}n.Ja=function(){delete e.Me[t][n.qt]},_R(e,t,n),e.Me[t][n.qt]=n}}},fe=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=jS.generate(),this.tapHandler=XS.generate(this.clickThreshold,this.dblClickThreshold)}kE(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Fr||e===gt?this.tapHandler(s,e,t,n,o):e===Og||e==_g?this.mouseEnterExitHandler(s,e,t,n,o):HE(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.kE(r,e,a,s,o),this}off(r,e,t){return Nu(r,e,t),this}trigger(r,e,t,n,o){let s=oi()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=wn()&&!oi()&&Yi[e]?Yi[e]:e,l=!(wn()&&!oi()&&Yi[e]),h=me(t),d=l1(t),u=h1(t);return OR(r,p=>{let m;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let g=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=o1(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&&wn()&&Yi[e],x=y?"TouchEvent":"MouseEvents";m=document.createEvent(x),E[x](m),g(m),p.dispatchEvent(m)}),this}};var p1=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function ce(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 $(i,r,e,t){return r=r||{},ta(Wt,i,e,t,r)}function NR(i,r){let e=r.map(t=>$("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function m1(i,r){i.gradient==null&&(i.gradient=$("linearGradient",{id:$m(),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}`),NR(i.gradient,r)}function kS(i,r,e){let t=$m(),n=$("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return NR(n,e),{id:t,g:n}}function WE(i,r,e,t){r.setAttribute(IS,e.fill?e.fill:ht),!t&&e.gradient?(m1(i,e.gradient),r.setAttribute(DE,`url(#${i.gradient.id})`)):r.setAttribute(DE,e.stroke?e.stroke:ht),e.strokeWidth&&r.setAttribute(MS,e.strokeWidth),e.dashArray?r.setAttribute(IE,e.dashArray):r.removeAttribute(IE),p1.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function ea(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function g1(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...E1(o,r,e))}),t}function E1(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=$(NE);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 f1(i,r,e){return g1(i,r,e).map(t=>{let n=$(NE);return n.innerHTML=t,n})}function Iu(i,r,e){let n=i.getAttribute(Q)||"50%",o=f1(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(Q,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 ZE="data-vjs-container",JE="data-vjs-group-content",Mu="data-vjs-expanded-content",Vu="data-vjs-collapsed-content",fr="data-vjs-enabled",Yl="data-vjs-scope",zl="data-vjs-is-group",y1="endpoint",x1="element",b1="connection",He="div",KE="position",Zr=X(Zs),A1=be(QA),WS=be(JE),Dn=X(Js),ZS=X(su);function Mt(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 ae(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Zt(i,r,e,t){if(t&&Mt(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if(Mt(i,r))return i;i=i.parentNode}}function S1(i,r,e){e=e||document.body;let t=[],n=Zt(i,r,e,!1);for(;n!=null;)t.push(n),n=Zt(n,r,e,!1);return t}function zo(i){return i.srcElement||i.target}function IR(i,r){r=bt(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function qE(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function MR(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=qE(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),IR(i,s.join(" "))}function Nn(i){return!z(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function T1(i){return!z(i)&&(Array.isArray(i)||Nn(i))}function KS(i){return!z(i)&&(Array.isArray(i)||Nn(i))}function qS(i){return qE(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?bt(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):MR(t,n))};Nn(i)?i.forEach(t=>e(t,r)):e(i,r)}function an(i,r){return i.classList?i.classList.contains(r):qE(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?bt(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):MR(t,null,n))};Nn(i)?i.forEach(t=>e(t,r)):e(i,r)}function QE(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):an(t,n)?F(t,n):L(t,n))};Nn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Vt(i,r=[],e=[]){let n=qE(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),IR(i,n.join(" "))}function QS(i,r){let e=null;if(arguments.length===1){if(!z(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 ta(null,i,r,e,t)}function ta(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),ce(o,n||{}),o}function Kr(i,r,e,t,n,o,s){let a=ta(i,r||He,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function zi(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 Gu(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function Ot(i){return Gu(i)==="SVG"}function Xi(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var JS=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 ra(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function na(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===zt?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 $u(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 eT(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function v1(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function qr(i,r){return"["+i+"='"+r+"']"}function C1(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function P1(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function X(...i){return i.map(r=>"."+r).join(",")}function O1(...i){return i.join(" ")}function be(...i){return i.map(r=>"["+r+"]").join(",")}var Xl=be(Pt);function jl(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var VR="deltaY",GR="deltaX",_1="wheelDeltaY",R1="wheelDeltaX",ef="webkit",Hl="mac",Bu="win",tT="ie",rT="safari",nT="firefox",iT="default";function $R(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function BR(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var oT={[ef]:{[Hl]:jl(VR,120),[Bu]:jl(VR,100)},[rT]:jl(_1,120,!0),[nT]:{[Hl]:$R,[Bu]:$R},[tT]:function(i){return i.wheelDelta/120},[iT]:function(i){return i.deltaY||i.wheelDelta}},sT={[ef]:{[Hl]:jl(GR,120),[Bu]:jl(GR,100)},[rT]:jl(R1,120,!0),[nT]:{[Hl]:BR,[Bu]:BR},[tT]:function(i){return i.wheelDelta/120},[iT]:function(i){return i.deltaX||i.wheelDelta}},FR=typeof navigator!="undefined",UR=FR?/Mac/.test(navigator.userAgent)?Hl:Bu:Hl,kl=FR?navigator.userAgent.indexOf("Firefox")!==-1?nT:/Chrome/.test(navigator.userAgent)?ef:/Safari/.test(navigator.userAgent)?rT:/WebKit/.test(navigator.userAgent)?ef:/Trident/.test(navigator.userAgent)?tT:"default":iT,L1=typeof oT[kl]=="function"?oT[kl]:oT[kl][UR],w1=typeof sT[kl]=="function"?sT[kl]:sT[kl][UR],D1=function(i){return L1(i||event)},N1=function(i){return w1(i||event)},I1=function(i,r,e){let t=n=>{let o=D1(n),s=N1(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.HE=t,t},M1=typeof document!="undefined",YR=M1?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function Wl(i,r,e,t){let n=I1(r,e,t);return i.addEventListener?i.addEventListener(YR,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function Zl(i,r){let e=r.HE;e!=null&&(i.removeEventListener?i.removeEventListener(YR,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function aT(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var lT="vjs-paper",hT="vjs-paper-canvas",cT=20,V1="vjs-paper-node",Jl="start",Xo="center",Kl="end";function dT(i){return kr(i)&&i.useHTMLElement===!0}var ql=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(He,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(Ze,t.edge.id),e.contentElement.setAttribute(ou,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=je,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,wl),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 uT(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[ou]:r.id},r.attributes);e.forEach(n=>{let o=$(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.component)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&ea(n,t,-1)}}),r.contentElements}function pT(i,r,e,t){let n=r;uT(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);ce(a,d)})}function Ql(i,r){return uT(i,r,r.contentTags)}function jo(i,r){return uT(i,r,[q]),r.bgElement==null&&(r.bgElement=$(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=$(Je),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function mT(i,r,e,t){jo(i,r);let n=Tr(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:"translate("+o[0]+","+o[1]+")"};r.font&&r.font.size&&(s["font-size"]=r.font.size),r.font&&r.font.style&&(s["font-style"]=r.font.style),r.font&&r.font.family&&(s["font-family"]=r.font.family),ce(r.textElement,s),r.textElement.textContent=n;let a=r.textElement.getBBox(),l=i.currentZoom,h=a.width/l,d=a.height/l,u=5,p={transform:"translate("+o[0]+","+o[1]+")",x:s.x-u-h/2,y:s.y-u-d/2,width:h+2*u,height:d+2*u,fill:n==null||n.length===0?"none":"white"};ce(r.bgElement,p)}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 Fu=class extends ni{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var si="transform",gT=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,zR=/rotate\(([-0-9\.]+)\)/;function it(i){let r=i;return r.width&&r.width.baseVal?Y1(r):r.getBBox?z1(r):G1(i)}function hn(i,r){let e=i;return Ot(i.parentElement)?eh(e,r):e.x&&e.x.baseVal?F1(e):$1(e)}function Ce(i,r){let e=i;Ot(i.parentElement)?ln(e,r):(e.x&&e.x.baseVal&&U1(e,r),Jt(e,r))}function XR(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=eh(o);s[n]=r,ln(o,s)}}function ET(i,r){XR(i,r,Ye,Q,Q)}function fT(i,r){XR(i,r,Se,Ee,Ee)}function Rr(i,r,e){let t=i;t instanceof HTMLElement?jR(i,r,e):t.width&&t.width.baseVal&&(jR(i,r,e),i.setAttribute(Te,`${r}`),i.setAttribute(De,`${e}`))}function yT(i,r){let e=i;e instanceof HTMLElement?HR(i,r):e.width&&e.width.baseVal&&(HR(i,r),i.setAttribute(Te,`${r}`))}function xT(i,r){let e=i;e instanceof HTMLElement?kR(i,r):e.height&&e.height.baseVal&&(kR(i,r),i.setAttribute(De,`${r}`))}function G1(i){return{width:i.offsetWidth,height:i.offsetHeight}}function $1(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function B1(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function Jt(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function jR(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function HR(i,r){i.style.width=`${r}px`}function kR(i,r){i.style.height=`${r}px`}function F1(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function U1(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function Y1(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function z1(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function eh(i,r){let e,t,n,o,s;if(e=i.getAttribute(si),e!=null){if(t=e.match(gT),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(zR),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=xt(h,{x:o,y:s},a),u=xt({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(gT);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function Ho(i,r){if(Ot(i.parentElement)){let t=(i.getAttribute(si)||"").match(gT);i.setAttribute(si,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else i.style.transform=r==0?"":"rotate("+r+"deg)",i.style.transformOrigin="center center"}function ln(i,r){let t=(i.getAttribute(si)||"").match(zR);i.setAttribute(si,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}var Uu=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[Te]:""+(n[0]||0),[De]:""+(n[1]||0)};ce(r.canvas,o),Ce(r.canvas,r)}}}};var rf="vjs-surface",bT="vjs-surface-direct-render",AT="vjs-surface-touch-device",ST="vjs-surface-pointer-device",nf="vjs-surface-nopan",of="vjs-surface-canvas",sf="vjs-surface-pan",X1="vjs-surface-pan-left",j1="vjs-surface-pan-top",H1="vjs-surface-pan-right",k1="vjs-surface-pan-bottom",af="vjs-surface-pan-active",lf="vjs-surface-flash",TT="vjs-flash-vertex",hf="vjs-surface-panning",cf="vjs-surface-element-dragging",th="vjs-element-dragging",df="vjs-group-child-element-dragging",rh="vjs-most-recently-dragged",In="vjs-surface-edge-dragging",uf="vjs-edge-relocating",Yu="vjs-edge-will-relocate",vT="vjs-lasso",nh="vjs-lasso-mask",CT="vjs-lasso-mask-left",PT="vjs-lasso-mask-top",OT="vjs-lasso-mask-right",_T="vjs-lasso-mask-bottom",zu="vjs-miniview",RT="vjs-miniview-canvas",LT="vjs-miniview-panner",wT="vjs-miniview-element",DT="vjs-miniview-group-element",pf="vjs-miniview-panning",NT="vjs-miniview-collapse",Xu="vjs-miniview-collapsed",IT="vjs-miniview-click-to-center",ct="vjs-drag-select-defeat",mf="vjs-default-node",gf="vjs-default-group",ji="vjs-connector-source-drag",Hi="vjs-connector-target-drag",MT="vjs-connector-transient-drag",ko="vjs-palette-selected-element",ih="vjs-palette-tap-mode-active",VT="vjs-palette-current",ju="vjs-palette-current-shape-type",Wo="vjs-drag-hover-cannot-drop",Ef="vjs-drag-original-group",Kt="vjs-drag-active",qt="vjs-drag-hover",ff="vjs-source-hover",yf="vjs-target-hover",oh="vjs-hover";function W1(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 GT(i,r,e){WR(i,r);let t=r.connector;Uu.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=DA(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[Ze]:r.edge.id},a=W1(i,e);a!=null&&(t.bgPath==null?(t.bgPath=$(te,s),L(t.bgPath,i.connectorOutlineClass),ea(t.canvas,t.bgPath,0)):ce(t.bgPath,s),WE(t,t.bgPath,a,!0)),t.path==null?(t.path=$(te,s),ea(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&&ea(t.canvas,t.path,a!=null?1:0),ce(t.path,s)),WE(t,t.path,e,!1),r.detachable&&Z1(r,o,i.defaults.edgeRelocateHandleSize)}}function Z1(i,r,e){if(i.detachable){let t=i.connector,n=t.internalSegments[0].x1,o=t.internalSegments[0].y1,s={width:e,height:e,transform:`translate(${r.x-e/2},${r.y-e/2})`,"pointer-events":"fill",cursor:"move"},a=Object.assign(s,{x:n,y:o});t.sourceZone==null?(t.sourceZone=$(Z,a),L(t.sourceZone,ji),t.canvas.appendChild(t.sourceZone)):ce(t.sourceZone,a);let l=t.internalSegments[t.internalSegments.length-1].x2,h=t.internalSegments[t.internalSegments.length-1].y2,d=Object.assign(s,{x:l,y:h});t.targetZone==null?(t.targetZone=$(Z,d),L(t.targetZone,Hi),t.canvas.appendChild(t.targetZone)):ce(t.targetZone,d)}}function WR(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?$(ve,{[Te]:"0",[De]:"0",style:{"pointer-events":ht,position:je},[Ze]:r.edge.id}):$(q,{[Ze]: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 xf=class{constructor(r,e){this.container=r;c(this,"Qt",!0);c(this,"ge");c(this,"Ka");c(this,"Pi");c(this,"qa");c(this,"ke");c(this,"fu");c(this,"rt");c(this,"er");c(this,"rr",{});c(this,"Sn",[]);c(this,"H");c(this,"Ur");c(this,"_i");c(this,"Ri");c(this,"Li");c(this,"Qa");e=e||{init:null},this.ge=new fe,this.Ka=this.WE.bind(this),this.ge.on(r,ue,"*",this.Ka),this.Pi=this.ZE.bind(this),this.qa=this.JE.bind(this),this.Li=e.translate||(t=>Object.assign({},t)),this.Qa=e.init}$enable(){this.Qt=!0}$disable(){this.Qt=!1}addHandler(r){let e=this.rr[r.selector];e==null&&(this.rr[r.selector]=[],e=this.rr[r.selector],this.Sn.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.rr[r.selector];e!=null&&(this.rr[r.selector]=e.filter(t=>t!==r),this.rr[r.selector].length===0&&(delete this.rr[r.selector],this.Sn=this.Sn.filter(t=>t!==r.selector)))}WE(r){if(!this.Qt||r.KE===!0)return;let e=!1;this.rt=r.target;let t=()=>{e||(e=!0,this.Qa&&this.Qa(r),this.er=it(this.rt),this.ke=null,this.H=me(r),this._i=this.Li(this.H),this.Ur=Object.assign({},this.H),this.Ri=Object.assign({},this._i))};for(let n=0;n<this.Sn.length;n++)if(Mt(this.rt,this.Sn[n],this.container)){let o=this.rr[this.Sn[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.rt,l=this.er;if(o[s].target){if(a=this.rt.closest(o[s].target),a==null)continue;l=it(a)}if(this.fu=o[s].start({pagePosition:this.H,e:r,el:a,size:l,translatedPosition:this._i}),this.fu!==!1){this.rt=a,this.er=l,this.ke=o[s],ae(r),r.KE=!0;break}}}}this.ke!=null&&(this.ge.on(document,ie,this.Pi),this.ge.on(document,oe,this.qa))}ZE(r){if(!this.Qt)return;let e=me(r),t=this.Li(e);this.ke!=null&&(this.ke.constrainFunction&&(this.ke.usesPageCoordinates?(e=this.ke.constrainFunction(e,this.rt,{width:0,height:0},this.er,this.Ur,r),t=this.Li(e)):t=this.ke.constrainFunction(t,this.rt,{width:0,height:0},this.er,this.Ri,r)),this.ke.drag({e:r,el:this.rt,pagePosition:e,size:this.er,originalPagePosition:this.H,translatedPosition:t,originalTranslatedPosition:this._i}),this.Ur=e,this.Ri={x:t.x,y:t.y})}JE(r){this.Ur=me(r),this.Ri=this.Li(this.Ur),this.ke!=null&&this.ke.stop({e:r,el:this.rt,pagePosition:this.Ur,size:this.er,originalPagePosition:this.H,translatedPosition:this.Ri,originalTranslatedPosition:this._i}),this.ie()}ie(){this.ge.off(document,ie,this.Pi),this.ge.off(document,oe,this.qa),this.ke=null,this.rt=null,this.er=null,this.H=null,this.Ur=null}destroy(){this.ge.off(this.container,ue,this.Ka),this.ie()}};var Hu={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},sh="start",ah="center",lh="end",J1="Default",K1="Default shapes",$T="vjs-shape",ku="vjs-shape-label",hh="vjs-shape";var q1="http://www.w3.org/2000/svg",Q1="http://www.w3.org/1999/xlink",eV="svg",tV="xlink",rV="html";function bf(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var Zo=class extends To{constructor(r){super(r),this.namespaceHandlers[eV]=e=>document.createElementNS(q1,e.split(":")[1]),this.namespaceHandlers[rV]=e=>document.createElement(e.split(":")[1]),this.namespaces[tV]=Q1}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Nd(){return bf}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function yr(i){return new Zo(i||{})}var Wu="link",Zu="clone",Ju="trash",BT="cross",FT="plus",UT="circle",YT="gear",ZR={x:0,y:0,width:32,height:32},ch={[Zu]:{id:Zu,viewBox:ZR,shapes:[{tag:te,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"}}]},[Wu]:{id:Wu,viewBox:ZR,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:ze,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:te,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:te,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[Ju]:{id:Ju,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:te,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:te,atts:{d:"M 12 26 L 10 8"}},{tag:te,atts:{d:"M 20 26 L 22 8"}},{tag:te,atts:{d:"M 16 26 L 16 8.5"}}]},[BT]:{id:BT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:te,atts:{d:"M 2 2 L 30 30"}},{tag:te,atts:{d:"M 30 2 L 2 30"}}]},[FT]:{id:FT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:te,atts:{d:"M 16 2 L 16 30"}},{tag:te,atts:{d:"M 2 16 L 30 16"}}]},[UT]:{id:UT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ze,atts:{cx:16,cy:16,r:15}}]},[YT]:{id:YT,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:te,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 nV(i,r){let e=typeof i=="string"?ch[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function Ku(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=$(ve,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=$(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function qu(i,r,e,t,n,o,s){return Ku(ch[i],r,e,t,n,o,s)}var iV={x:0,y:0,width:32,height:32},oV={stroke:"currentColor",fill:"none"},Af=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return ch[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)||ch[r];if(!n){this.innerHTML="";return}let o=n.viewBox||iV,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=Ei(Ei({},oV),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",Af);var sV="label",JR="transform",KR="x",qR="y",Qu="origin",XT="originX",jT="originY",QR="orientation",HT="size",kT="key",eL="iconId",dh="middle",zT="type",Sf="category",WT="horizontal",aV="vertical",ep="vjs-shape-icon",tL="vjs-include-icon",rL="vjs-include-icons",lV="category",hV="type",Wi="__vjsRootSet",ki=sV,Tf="fill",uh="outline",ph="outlineWidth",vf="color",mh="#FFFFFF",Jo="#000000",gh=2,ZT="#000000",nL=.8,ia=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="${ep}" 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||hV,this.categoryParameter=e.categoryParameter||lV,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||nL,this.labelPosition=e.labelPosition||"center",this.qE(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:xe,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.QE(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||ki)}qE(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=ys(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,Wi),parent:null,id:Wi,name:Wi,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}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.ef()):t.template}getCompiledShape(r,e){let t=this.tf(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)}rf(r){r.setAttribute&&r.setAttribute(bu,Au),r.hasChildNodes&&r.childNodes.forEach(e=>this.rf(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||ki;let l=$(Je,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":dh,"dominant-baseline":dh,class:ku,"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}tf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}nf(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:dh,dominantBaseline:dh},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:dh,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:dh,dominantBaseline:"auto"}}[r]}of(r,e,t=ki){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:m,y:g,transform:E,textAnchor:y,dominantBaseline:x}=this.nf(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${Mu}>${s.template}</svg:g><svg:g ${Vu}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${m}" y="${g}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${ku}" 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[`${xe}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=ki,s=mh,a=Jo,l=Jo,h=gh){return e=e||h,{template:r?`<svg:g class="${hh}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
|
|
5
|
-
<r-fragment key="${
|
|
4
|
+
`;return e+="]}",e}isChildOf(e){return!1}},$m=class $m extends Ac{constructor(e,t,n){super(e,t,n);c(this,"objectType",$m.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 pe(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=xc(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=xc(e),o=xc(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=xc(e),a=xc(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c($m,"objectType","Node");var de=$m,Bm=class Bm extends Ac{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",Bm.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(Bm,"objectType","Port");var pe=Bm,Fm=class Fm extends de{constructor(e,t,n){super(e,t,n);c(this,"objectType",Fm.objectType);c(this,"members",[]);c(this,"Lo",{})}$addMember(e){return this.Lo[e.id]!=null?!1:(this.members.push(e),this.Lo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Lo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Lo[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(Fm,"objectType","Group");var le=Fm,Um=class Um extends bc{constructor(e){super(e.graph,e.data);c(this,"objectType",Um.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(Um,"objectType","Edge");var Fe=Um;var xx="undoRedo",co="userActivity",rl="api",nl="dataLoad",bx="transient",Ax="copyPaste";var UD=(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 m=l.get(p);m!=null&&m.forEach(g=>{h.push(r.addGroup(g).id)}),l.delete(p),m!=null&&m.forEach(g=>{d(g.id)})};for(let p=0;p<o.length;p++){let m=o[p];if(e.groupDecorator&&e.groupDecorator(m),m.group!=null&&h.indexOf(m.group)===-1)fs(l,m.group,()=>[]).push(m);else{let g=r.addGroup(m);a.set(g.id,m),h.push(g.id),d(g.id)}}l.forEach((p,m)=>{if(h.indexOf(m)===-1)throw new Error("Parent group ["+m+"] not found");p.forEach(g=>h.push(r.addGroup(g).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let m=r.addNode(t[p]);s.set(m.id,t[p])}function u(p){return z(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let m=n[p].data||{},g={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:m};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(m,E,y)}n[p].anchors&&(g.anchors=n[p].anchors),n[p].geometry&&(g.geometry=n[p].geometry),r.$_addEdge(g,nl,null)}},YD=(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.group,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===pe.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.group,t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===pe.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},zD=(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},nl,null),t(n.children[s])}};t(i)},zt="json",km="hierarchical-json",PO={[zt]:YD},OO={[zt]:UD,[km]:zD};function Sx(i,r){OO[i]=r}function XD(i,r){PO[i]=r}function Tx(i,r,e,t){let n=OO[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function Wm(i,r,e){let t=PO[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var Zm=class{constructor(){c(this,"Ue",{});c(this,"ta",!1);c(this,"ra",!1);c(this,"gg",{ready:!0});c(this,"mh",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.ra)this.mh.unshift(arguments);else{if(this.ra=!0,!this.ta&&this.Ue[r]){let o=this.Ue[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.gg[r])this.Ue[r][s](e,t);else try{n=this.Ue[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.Ue==null||this.Ue[r]==null)&&(a=!0)}}this.ra=!1,this.Eg()}return n}Eg(){let r=this.mh.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.Ue={};else if(arguments.length===1){if(typeof r=="string")delete this.Ue[r];else if(r.Wn){let t;for(let n in r.Wn)t=r.Wn[n],wm(this.Ue[t]||[],r)}}else arguments.length===2&&wm(this.Ue[r]||[],e);return this}getListener(r){return this.Ue[r]||[]}isSuspendEvents(){return this.ta}setSuspendEvents(r){this.ta=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=>{ax(this.Ue,o,e,t),e.Wn=e.Wn||{},e.Wn[V()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},It=class extends Zm{shouldFireEvent(r,e,t){return!0}};var il=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"gh",[]);c(this,"qr",{});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.gh.push(this.result.path[t].vertex),this.qr[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==pe.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.gh}getVertex(r){return this.qr[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.qr[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}ze(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.ze((e,t)=>{r(e,t)})}eachVertex(r){this.ze((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.ze((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.ze((e,t)=>{K(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.ze((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 Tc=class{constructor(r,e){c(this,"Eh",new Map);c(this,"fh",new Map);c(this,"yh",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Eh.set(s,t[s]);let n=e.groups||{};for(let s in n)this.fh.set(s,n[s]);let o=e.ports||{};for(let s in o)this.yh.set(s,o[s])}}getNodeDefinition(r){return this.Eh.get(r)||{}}getGroupDefinition(r){return this.fh.get(r)||{}}getPortDefinition(r){return this.yh.get(r)||{}}};var fn=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,"Zn");this.Zn=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||{}}Jn(){this.done=!1,this.$vertices.length=0,this.reset()}static fg(){return{padding:{x:0,y:0}}}yg(){let r=Object.assign(i.fg(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return ys(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}xg(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}}xh(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.yg();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,m,g)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,m),s=Math.min(s,g),a=Math.max(a,m+E.width),l=Math.max(l,g+E.height),t[p]={x:m,y:g}},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(m=>p[m.id]=t[m.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.Jn(),r!=null&&(this.parameters=r),this.xh(e)}layout(r){this.done=!1,this.xh(r)}};var vc=class{};var _O={},qe={get:(i,r)=>{let e=_O[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{_O[i]=r}};var Jm=class Jm extends fn{constructor(e){super(e);c(this,"type",Jm.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(Jm,"type","Empty");var bs=Jm;qe.register(bs.type,bs);function jD(i){return{x:i.data.left,y:i.data.top}}var Hn=class extends fn{constructor(e){super(e);c(this,"bh");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.bh=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.bh||jD)(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)}},RO="Absolute",Km=class Km extends Hn{constructor(e){super(e);c(this,"type",Km.type)}getDefaultParameters(){return{}}};c(Km,"type",RO);var uo=Km;qe.register(uo.type,uo);function HD(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var qm=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],Qm=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],LO=[null,[qm[0],Qm[1]],[qm[0],Qm[0]],[qm[1],Qm[0]],[qm[1],Qm[1]]],kD=(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 HD(r,"x","width",s)?(l=LO[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=LO[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Ai(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=ps(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return kD(i,r,n,s,o)}function bi(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 wO(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 WD={x:20,y:20},ZD=1/0;function DO(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=se(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 Si=class{constructor(r){c(this,"we");c(this,"$");c(this,"na");c(this,"ht");c(this,"Ah");c(this,"Rr",null);c(this,"Qr");c(this,"F");c(this,"en");c(this,"Sh");c(this,"U",[]);c(this,"ne",new Map);c(this,"wo",new Map);c(this,"rn",new Map);c(this,"nn",new Set);c(this,"Do",!1);c(this,"Th");c(this,"At",new Map);this.en=r.positionGetter,this.Sh=r.positionSetter,this.F=r.getId,this.Qr=r.getSize,this.$=wO(r.elements||[]),this.ht=r.filter||(e=>!0),this.Ah=r.exclude||(e=>!1),this.na=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.$.length>0?(this.Kn((e==null?void 0:e.getSize)||this.Qr,(e==null?void 0:e.getPosition)||this.en,e==null?void 0:e.knownLocations),this.ia(r),this.Rr=null,this.oa(e)):{original:{},current:{}}}executeAtCenter(r){if(this.$.length>0){let e=this.Kn((r==null?void 0:r.getSize)||this.Qr,(r==null?void 0:r.getPosition)||this.en,r==null?void 0:r.knownLocations);return this.ia({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Rr=null,this.oa(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.$.length>0?(this.Kn((e==null?void 0:e.getSize)||this.Qr,(e==null?void 0:e.getPosition)||this.en,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Rr={id:r,bounds:this.ne.get(r),element:this.$.find(t=>t.id===r)},this.ia(this.Rr.bounds.center),this.oa(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.Kn(this.Qr,this.en);for(let t=0;t<this.U.length;t++){let n=this.ne.get(this.U[t].id),{moved:o,pos:s}=DO(this.U[t].bounds,r);o&&(e.original[this.U[t].id]=n,e.current[this.U[t].id]=s)}return this.Ch(e),e}setElements(r){return this.$=wO(r),this}startTracking(r,e,t){return this.setElements(r),this.Kn(this.Qr,this.en),this.Th=t||ZD,this.rn.clear(),this.nn.clear(),this.wo.entries().forEach(n=>{this.rn.set(n[0],Object.assign({},n[1]))}),this.Do=e,this}stopTracking(){this.rn.clear(),this.nn.clear(),this.Do=!1}addElement(r,e){return r!=null&&(e||this.$.indexOf(r)===-1)&&this.$.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.$,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.$.length;t++)if(this.$[t]===r){e=t;break}return e!==-1&&this.$.splice(e,1),this}reset(){this.$.length=0}ia(r){r!=null&&(this.we=r)}Kn(r,e,t,n){return this.U.length=0,this.ne.clear(),this.wo.clear(),this.At.clear(),this.Ag(this.$,r,e,t,n)}Ag(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]),m=this.F(r[d]),g={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.ne.set(m,g),this.wo.set(m,Object.assign({},g)),this.U.push({bounds:g,id:m,element:r[d]}),this.At.set(m,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}}Sg(r,e,t,n){if(this.rn.has(r)){let o=this.rn.get(r),s=this.ne.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Be(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.Th)return null;let p=null,m=0;for(let g=1;g<d;g++){let E={x:a.x+g*h*Math.cos(u),y:a.y+g*h*Math.sin(u)},y=bi(E,o,{x:0,y:0});DO(y,n);let x=!0;for(let f=0;f<this.U.length;f++){let b=this.U[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=bi(A.center,A,e);if(ke(y,T)){x=!1;break}}}if(x)m=g,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:m===d-1,positionReached:p}:null}else return null}Tg(r={},e,t,n,o){if((this.Do&&!o||!this.Do&&o)&&this.nn.size>0){let a=!1;for(;!a;){let l=!0;this.nn.forEach(h=>{let d=this.Sg(h,e,t,n);if(d!=null&&d.moved){let u=this.rn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let m=this.ne.get(h);m.x=p.x,m.y=p.y,m.center.x=p.x+u.width/2,m.center.y=p.y+u.height/2,d.reverted&&this.nn.delete(h),l=!1}}),a=l}}}oa(r){let e={};if(this.$.length>1){r=r||{};let n=r.filter||this.ht,o=r.padding||WD,s=r.iterations,a=r.exclude||this.Ah;r.gather&&Object.assign(e,this.vg(o,this.na,n,a)),Object.assign(e,this.Cg(o,this.na,n,s,a,r.grid)),this.Tg(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.wo.get(n),t.current[n]=e[n],this.nn.add(n);return this.Ch(t),t}vg(r,e,t,n){let o={},s=bi(this.we,{width:0,height:0},r);this.Oh();let a={},l=h=>{let d=[this.we,h],u=[];Array.prototype.push.apply(u,lr(d,s).map(p=>[s,p,null]));for(let p in a){let m=this.ne.get(p);Array.prototype.push.apply(u,lr(d,m).map(g=>[m,g,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.U.length;h++){if(n(this.U[h].id,this.U[h].element))continue;let d=this.U[h].bounds,u=this.U[h].bounds,p=bi(d.center,u,r);if(t(this.U[h].id,this.U[h].element)){let m=l(d.center);if(m.length>0){m.sort((y,x)=>{let f=Be(y[1],d),b=Be(x[1],d);return f<b?-1:1});let g=m[0][0],E=Ai(g,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.U[h].id]=d,a[this.U[h].id]=!0}}}return o}Cg(r,e,t,n,o,s){n=n||2;let a,l;this.Rr!=null?(a=bi(this.we,this.Rr.bounds,{x:0,y:0}),l=this.Rr.id):a=bi(this.we,{width:0,height:0},r),this.Oh();let h=1,d=!0,u,p,m={},g=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,m[x]=f},E=(x,f)=>{if(s==null)return f;{let b=fi(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),R=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*R};return Qy(v,x)}},y=()=>{let x,f;for(let b=0;b<this.U.length;b++){if(x=this.U[b],o(x.id,x.element))continue;let A=x.bounds,T=bi(A.center,A,r);x.id!==l&&t(x.id,x.element)&&ke(a,T)&&(u=Ai(a,T),u=E(A,u),p=e(x.id,A,u),g(x.id,A,p.x,p.y),T=bi(A.center,A,r));for(let S=0;S<this.U.length;S++)if(b!==S){if(f=this.U[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let R=f.bounds,v=bi(R.center,R,r);ke(T,v)&&(d=!0,u=Ai(T,v),u=E(R,u),p=e(f.id,R,u),g(f.id,R,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),m}Ch(r){for(let e=0;e<this.$.length;e++){let t=this.F(this.$[e]);r.current[t]&&this.Sh(this.$[e],r.current[t])}}Oh(){let r={};this.U.sort((e,t)=>{let n=r[e.id]||Math.min(Be(e.bounds,this.we),Be(fi(e.bounds,{x:e.bounds.width,y:0}),this.we),Be(fi(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.we),Be(fi(e.bounds,{x:0,y:e.bounds.height}),this.we)),o=r[t.id]||Math.min(Be(t.bounds,this.we),Be(fi(t.bounds,{x:t.bounds.width,y:0}),this.we),Be(fi(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.we),Be(fi(t.bounds,{x:0,y:t.bounds.height}),this.we));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var NO={x:30,y:30},eg=class eg extends fn{constructor(e){super(e);c(this,"Ph");c(this,"type",eg.type);c(this,"padding",NO);this.Ph=e.options.centerRoot===!0,this.padding=e.options.padding||NO}getDefaultParameters(){return{padding:this.padding,locationFunction:this.Zn}}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.Ph&&a.length>0){let E=this.getSize(a[0].id,o);p=Math.max(E.width,E.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let m=2*Math.PI/a.length,g=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m,d>0){let E=a[d-1],y=this.getSize(E.id,o),x=t(E.id),f={x:x.x-s.padding.x,y:x.y-s.padding.y,width:y.width+2*s.padding.x,height:y.height+2*s.padding.y},b=a[d],A=this.getSize(b.id,o),T=t(b.id),S={x:T.x-s.padding.x,y:T.y-s.padding.y,width:A.width+2*s.padding.x,height:A.height+2*s.padding.y},R=Ai(f,S),v=[x.x+y.width/2,x.y+y.height/2],O=[T.x+R.x+A.width/2,T.y+R.y+ +(A.height/2)],P=Math.sqrt(Math.pow(v[0]-O[0],2)+Math.pow(v[1]-O[1],2));p=Math.max(p,P/2/Math.sin(m/2))}for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m;this.done=!0}};c(eg,"type","Circular");var Cc=eg;qe.register(Cc.type,Cc);var tg="Grid",rg="Column",ng="Row";var Te="width",De="height",JD="rotation",Pc="v",vx="h",Se="top",Ye="left",ut="right",st="bottom",Rt="center",Q="x",Ee="y",yn="dlr",kn="drl",en="none",tn="orthogonal",Cx="manhattan",Oc="diagonal",Px="metro",Ox=-1,he="v",ne="h",_x="undefined",xe="default",At="true",at="false",Rx="left",Lx="top",wx="rotation",Dx="width",Nx="height",Qe="source",xn="target";var KD={x:30,y:30},Ti="row",Ix="column",po=class extends fn{constructor(e){super(e);c(this,"sn",[]);c(this,"sa");c(this,"aa");c(this,"de");c(this,"an");c(this,"ln");c(this,"Lr");c(this,"wr");c(this,"type");this.type=tg,this.de=e.options.orientation||Ti,this.padding=e.options.padding||KD,this.sa=e.options.verticalAlignment||Rt,this.aa=e.options.horizontalAlignment||Rt,this.an=e.options.rows||-1,this.ln=e.options.columns||-1}getDefaultParameters(){return{orientation:Ti,rows:-1,columns:-1}}begin(e,t,n,o,s){this.sn.length=0;let a,l;if(this.an===-1&&this.ln===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.de===Ti?1:0),l=p+(this.de===Ix?1:0)}else this.an!==-1?(a=this.an,l=Math.ceil(this.$vertices.length/a)):this.ln!==-1&&(l=this.ln,a=Math.ceil(this.$vertices.length/l));this.Lr=-1/0,this.wr=-1/0;let h=0,[d,u]=this.de===Ti?[a,l]:[l,a];for(let p=0;p<d;p++){this.sn[p]=[];for(let m=0;m<u;m++)if(h=p*u+m,h<this.$vertices.length){let g=this.$vertices[h],E=this.getSize(g.id,o);this.Lr=Math.max(this.Lr,E.width),this.wr=Math.max(this.wr,E.height),this.sn[p][m]={vertex:g,size:E}}}}end(e,t,n,o,s){}reset(){}Og(e){let t=this.de===Ti&&this.an===1||this.aa===Ye?0:this.aa===Rt?(this.Lr-e.width)/2:this.Lr-e.width,n=this.de===Ix&&this.ln===1||this.sa===Se?0:this.sa===Rt?(this.wr-e.height)/2:this.wr-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.sn.length;h++){for(let d=0;d<this.sn[h].length;d++){let u=this.sn[h][d],{padX:p,padY:m}=this.Og(u.size);n(u.vertex.id,a+p,l+m),this.de===Ti?a+=this.padding.x*2+(this.an===1?u.size.width:this.Lr):l+=this.padding.y*2+(this.ln===1?u.size.height:this.wr)}this.de===Ti?(l+=this.padding.y*2+this.wr,a=0):(a+=this.padding.x*2+this.Lr,l=0)}this.done=!0}};c(po,"type",tg),qe.register(po.type,po);var ol=class extends po{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Ix,columns:1})})),this.type=rg}};c(ol,"type",rg),qe.register(ol.type,ol);var sl=class extends po{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Ti,rows:1})})),this.type=ng}};c(sl,"type",ng),qe.register(sl.type,sl);var ig=class ig extends Hn{constructor(e){super(e);c(this,"No");c(this,"type",ig.type);c(this,"$",new Map);c(this,"qn",new Map);c(this,"Qn");c(this,"St");c(this,"Io",1/0);c(this,"Mo",-1/0);c(this,"Vo",1/0);c(this,"Go",-1/0);c(this,"Tt",[]);c(this,"la",new Map);c(this,"vt");c(this,"ca");this.vt=gn(this.getDefaultParameters(),e.options),this.St=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.Zn}}cn(e,t,n){return t=gc(t),n=gc(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{Pg:t,_g:n}}hn(e){return this.qn.get(e.id)===!0}Rg(e){this.qn.set(e.id,!0)}reset(){super.reset(),this.$.clear(),this.qn.clear(),this.No=0,this.Io=this.Vo=1/0,this.Mo=this.Go=-1/0,this.la.clear()}begin(e,t,n,o,s){this.Tt.length=0,this.$.clear(),this.No=0,this.Io=1/0,this.Mo=-1/0,this.Vo=1/0,this.Go=-1/0,this.ca=this.vt.r,this.St&&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)})}dt(e,t,n){let o=H(e)?e.getParent():e,s=this.$.get(o.id);if(!s){let a=t(o.id)||this.xg(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.$.set(o.id,s),this.la.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}ha(e,t,n){return this.Tt[e]?this.Tt[e]:(this.Tt[e]=this.dt(this.$vertices[e],t,n),this.Tt[e])}step(e,t,n,o,s){let a;for(this.Qn=0,a=0;a<this.$vertices.length;a++){let l=this.ha(a,t,o);if(this.St&&!this.hn(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this._h(l,d.x,d.y),n(l.id,d.x,d.y),this.Rg(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.ha(d,t,o);this.Lg(l,u)}let h=this.la.get(l.id);for(let d=0;d<h.length;d++)this.wg(l,h[d],t,o)}if(this.Qn!==0)for(a=0;a<this.$vertices.length;a++){let l=this.ha(a,t,o);if(!this.hn(l)){let h=l.f[0],d=l.f[1];this._h(l,l.x+h,l.y+d)}l.f[0]=0,l.f[1]=0}this.No++,(this.Qn===0||this.No>=this.vt.iterations)&&(this.Dg(n,o),this.done=!0)}end(e,t,n,o,s){this.qn.clear(),this.$.forEach((a,l)=>{this.qn.set(l,!0)})}_h(e,t,n){let{Pg:o,_g:s}=this.cn(e,t,n);this.Io=Math.min(this.Io,o),this.Vo=Math.min(this.Vo,s),this.Mo=Math.max(this.Mo,o),this.Go=Math.max(this.Go,s)}Dg(e,t){this.$.forEach((n,o)=>{let s=this.$.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}Lg(e,t){let n=this.hn(e),o=this.hn(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(ke(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=lr(d,e)[0],p=lr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h==0&&(h=1,s=1,a=1)}if(h<this.vt.spacing){this.Qn++;let d=this.ca*(this.vt.spacing-h),u=1,p=1,m=u*d*s/h,g=p*d*a/h,E=o?0:(n?2:1)*m,y=o?0:(n?2:1)*g,x=n?0:(o?2:1)*m,f=n?0:(o?2:1)*g;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}wg(e,t,n,o){let s=this.dt(t.target,n,o),a=this.hn(e),l=this.hn(s);if(a&&l)return;this.Qn++;let h,d,u,p,m;if(ke(e,s))p=-2*this.vt.spacing,h=-2*this.vt.spacing,d=-2*this.vt.spacing;else{let y=[e.center,s.center],x=lr(y,e)[0],f=lr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p===0&&(p=1,h=1,d=1)}m=this.ca*(p-this.vt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),m*=Math.log(t.cost)*.5+1;let g=m*h/p,E=m*d/p;s.f[0]-=l?0:(a?2:1)*g,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*g,e.f[1]+=a?0:(l?2:1)*E}};c(ig,"type","ForceDirected");var _c=ig;qe.register(_c.type,_c);function qD(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var As=class extends Hn{constructor(e){super(e);c(this,"Rh");c(this,"dn");c(this,"Lh");this.Rh=!!e.options.ignoreLoops,this.Lh=e.options.ignorePorts===!0,this.dn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(Ex(n)){let o=n.getTargetEdges();return(o.length===0||qD(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.Rh,s.getRootNode=this.dn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=H(u.target)?u.target.getParent():u.target;(u.source===a||this.Lh!==!0&&H(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 Mx=Rt,Vx={x:60,y:60},Gx="auto",$x=Rt;function Rc(i){return i.parents.length>0?i.parents[0].loc:null}function og(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 QD(i){return i.parents.length>0?i.parents[0].root===!0:!1}function IO(i){return i.parents.length>0?i.parents[0].childGroup:null}function eN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Lc=class{constructor(r,e){this.dataSource=r;c(this,"Dr");c(this,"Yt");c(this,"ve");c(this,"P",[]);c(this,"Nr",[]);c(this,"ei",{});c(this,"Q");c(this,"J");c(this,"Ct");c(this,"ue");c(this,"ti");c(this,"xe");c(this,"St");c(this,"D");c(this,"un",-1/0);c(this,"pn",1/0);c(this,"ri");c(this,"Ot");c(this,"ni");c(this,"De",[]);c(this,"positions",new Map);c(this,"da",{[Rt]:r=>Rc(r)+og(r,this.J)/2-(r.size-this.J)/2,start:r=>Rc(r),end:r=>Rc(r)+og(r,0)-(r.size-this.J)});c(this,"F");c(this,"Pt");c(this,"Xt");c(this,"ii");c(this,"fa",{center:(r,e,t)=>(e+t)/2-og(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Dr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Yt=e.compress===!0,this.St=e.absoluteBacked===!0,this.F=e.idFunction,this.Pt=e.sizeFunction,this.Xt=e.childVerticesFunction,this.ii=e.absolutePositionFunction,this.ue=e.axisIndex,this.xe=this.ue!==1,this.ti=this.ue===0?1:0,this.ri=this.xe?"y":"x",this.Ot=this.xe?Te:De,this.ni=this.xe?De:Te,this.ve=e.invert===!0,this.D=e.alignment||$x,this.Q=e.padding,this.J=this.xe?this.Q.x:this.Q.y,this.Ct=this.xe?this.Q.y:this.Q.x}execute(){let r,e,t;for(let n=0;n<this.Dr.length;n++){r=this.Dr[n];let o=this.Pt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.oi(s,0);let l=0,h,d,u=(m,g)=>this.Yt&&m.parents&&m.parents.length>0?this.positions.get(this.F(m.parents[0].node)).position[this.ri]+this.ua(m,this.ti)+this.Ct:g,p=!1;if(a===0&&this.St===!0){let m=this.ii(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.si(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.P.length;e++){for(this.P[e].otherAxis=l,t=0;t<this.P[e].entries.length;t++)h=this.ue===0?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),d=this.ue===1?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),this.si(this.F(this.P[e].entries[t].node),{x:h,y:d},e);this.ve?e<this.P.length-1&&(this.P[e].otherAxisSize=this.De[e+1]+this.Ct,l-=this.P[e].otherAxisSize):(this.P[e].otherAxisSize=this.De[e]+this.Ct,l+=this.P[e].otherAxisSize)}}return this.positions}si(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.Pt(r),o=this.ue===0?e.x+n.width:e.y+n.height;this.un=Math.max(this.un,o),this.pn=Math.min(this.pn,o)}dt(r){let e=this.P[r];return e||(e={entries:[],pointer:0},this.P[r]=e),e}Qe(r,e,t,n,o){let s=this.dt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Ot],children:[]},l=e[this.ni];return this.De[t]==null?this.De[t]=l:this.De[t]=Math.max(this.De[t],l),s.pointer+=e[this.Ot]+this.J,s.entries.push(a),n&&n.children.push(a),a}pa(r,e){let t=this.Nr[e];t||(t=[],this.Nr[e]=t),r.index=t.length,t.push(r)}ma(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.dt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.J)}}ua(r,e){let t=r.parents.map(n=>n.dimensions[e===0?Te:De]);return Math.max.apply(null,t)}ga(r){if(r.size>0){let e=this.da[this.D](r),t=this.Nr[r.depth],n=this.D==="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.D==="end"?u.loc-r.size:u.loc+u.size+this.J}this.D!=="end"&&e>=n||this.D==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.D==="end"?r.nodes.length-1:0,l=this.D==="end"?-1:r.nodes.length,h=this.D==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.J;o!==0&&this.Ea(r),this.pa(r,r.depth)}}ya(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.fa[this.D](r,e,t),o=n-Rc(r);if(this.ma(r,n),!QD(r)){let s=IO(r),a=eN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ea(r){let e=r;for(;e!=null;)this.ya(e),e=IO(e)}oi(r,e){if(this.ei[r.node.id])return;this.ei[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.dt(e+1),l=this.Xt(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.Pt(this.F(h)),u=a.entries.find(p=>this.F(p.node)===this.F(h));if(u!=null){u.parents.push(r);let p=Rc(u),m=og(u,this.J),g=p+m/2-u.size/2,E=g-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.Qe(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let m=d[this.Ot];t.size+=m+this.J,n.push(p)}s[h.id]=!0}}for(this.ga(t),o=0;o<n.length;o++)this.oi(n[o],e+1);return l.length}};var MO="Hierarchical",sg=class sg extends As{constructor(e){super(e);c(this,"type",sg.type);c(this,"de");c(this,"xe");c(this,"ue");c(this,"Yt");c(this,"ve");c(this,"D");c(this,"Dh");c(this,"P",[]);c(this,"Xt");this.ve=e.options.invert,this.Dh=e.options.spacing||Gx,this.Yt=this.Dh==="compress",this.D=e.options.align||Mx,this.de=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:Vx,orientation:this.de,locationFunction:this.Zn,align:this.D}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.de=s.orientation,this.xe=this.de==="horizontal",this.ue=this.xe?0:1,this.padding=s.padding,this.P.length=0,this.Xt=s.getChildVertices}step(e,t,n,o,s){new Lc(e,{rootNode:s.rootNode,compress:this.Yt,padding:this.padding,axisIndex:this.ue,invert:this.ve,alignment:this.D,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.Xt(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.P}getOrientation(){return this.de}};c(sg,"type",MO);var wc=sg;qe.register(wc.type,wc);var ag=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"ne",new Map);c(this,"Nh",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=V(),this.group=[r]}setPosition(r,e,t){this.ne.set(r,{x:e,y:t})}getPosition(r){return this.ne.get(r)}getIncidentAngle(r){return this.Nh.get(r)}setIncidentAngle(r,e){this.Nh.set(r,e)}getPositions(){return this.ne}},tN=100,rN={x:50,y:50},lg=class lg extends As{constructor(e){super(e);c(this,"type",lg.type);c(this,"Ih");c(this,"et",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||tN,this.padding=e.options.padding||rN,this.clusterMagnetizer=new Si({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.et[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.Zn,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=H(o.source)?o.source.getParent():o.source,a=H(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.et.length=0,this.Ih=s.getChildEdges}Mh(e,t,n,o,s,a,l){let h=(T,S,R,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:R+2*a.padding.x,height:v+2*a.padding.y}),d,u=new ag(e),p=s?s.position:{x:0,y:0},m=p.x,g=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.Ih(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,R=H(S)?S.getParent():S;u.children.add(R)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(m-x.width/2,g-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.et.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,R=S,v=null;u.children.forEach(D=>{f=y(D.id);let M=h(m+Math.sin(S)*f.width,g+Math.cos(S)*f.height,f.width,f.height),N=Ai(b,M),G=Math.sqrt(Math.pow(M.x+N.x-m,2)+Math.pow(M.y+N.y-g,2));if(d=Math.max(d,G),u.setPosition(D.id,M.x+N.x,M.y+N.y),S+=T,v!=null){let J=y(v.id),ye=u.getPosition(v.id),j=h(ye.x,ye.y,J.width,J.height),ge=y(D.id),Ge=u.getPosition(D.id),Xe=h(Ge.x,Ge.y,ge.width,ge.height),Bt=Ai(j,Xe),ar={x:ye.x+J.width/2,y:ye.y+J.height/2},er={x:Ge.x+Bt.x+ge.width/2,y:Ge.y+Bt.y+ +(ge.height/2)},Dr=Math.sqrt(Math.pow(ar.x-er.x,2)+Math.pow(ar.y-er.y,2));d=Math.max(d,Dr/2/Math.sin(T/2))}v=D}),S=R,u.children.forEach(D=>{u.setIncidentAngle(D.id,S),u.setPosition(D.id,m+Math.sin(S)*d,g+Math.cos(S)*d),S+=T});let O=u.getPosition(e.id),P=O.x,I=y(e.id),C=P+I.width,_=O.y,w=_+I.height,B;u.children.forEach(D=>{if(!this.Mh(D,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(D.id),position:u.getPosition(D.id)},a,l+1)){B=y(D.id),u.group.push(D);let N=u.getPosition(D.id);P=Math.min(P,N.x),C=Math.max(C,N.x+B.width),_=Math.min(_,N.y),w=Math.max(w,N.y+B.height)}}),u.extents=[P,C,_,w],u.offsets={};for(let D=0;D<u.group.length;D++){let M=u.group[D],N=u.getPosition(M.id);u.offsets[M.id]={x:N.x-u.extents[0],y:N.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.Mh(s.rootNode[0],t,n,o,null,s,0),this.et.length>0){let a=(this.et[0].extents[0]+this.et[0].extents[1])/2,l=(this.et[0].extents[2]+this.et[0].extents[3])/2;this.clusterMagnetizer.setElements(this.et),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.et.length;a++)this.et[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(lg,"type","Balloon");var Dc=lg;qe.register(Dc.type,Dc);var Ss=class{constructor(r){this.model=r}};var vr="edge",mo="vertex",Nc="center",hg=30;function lt(i){return i.type===vr}function nN(i){return i.type===mo}var Ic=class extends Ss{constructor(e,t){super(e);this.vertexSet=t;c(this,"jt",new Map);c(this,"$o",!1);c(this,"kt");c(this,"Ir",[]);c(this,"Vh",new Set);c(this,"ai");this.ai=e.layout.ai}Ng(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.jt.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}Gh(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.Vh.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.jt.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.Ng(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.jt.has(p.id));if(u.length>0){let p=Math.max(...u.map(m=>this.vertexSet.findLayerIndex(m.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let m={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:vr,entries:[]};this.vertexSet.edgeNodes.push(m),this.vertexSet.edgeNodeMap.set(p.id,m)})}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.Ir.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.jt.set(s[a].id,!0),this.Gh(s[a],t+1)}Ig(){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=>!lt(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.jt.clear(),this.$o=!1,this.kt=0,this.Ir.length=0,this.jt.set(e.id,!0);!this.$o;)if(this.Gh(e,this.kt),this.Ir.length>0)if(this.Ir=this.Ir.filter(t=>!this.jt.has(t[0].id)),this.Ir.length>0){let t=this.Ir.splice(0,1)[0];e=t[0],this.kt=t[1],this.jt.set(e.id,!0),this.vertexSet.addToLayer(this.kt,e)}else this.$o=!0;else this.$o=!0;this.ai&&this.Mg(),this.Ig()}Mg(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!lt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.Vh)}};var Bx=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 iN(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var Ts=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"li");c(this,"ci");t=t||{},this.li=t.maxIterations||24,this.ci=t.maxIterationsWithoutImprovement||5}Vg(){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.Vg(),e=r,t=0,n=this.$h(r),o=Bx(e);for(let s=0;s<this.li;s++){let a=this.Gg(s,e),l=this.$h(a);if(l.total<n.total)n=l,t=0,o=Bx(a);else if(l.total===n.total){let h=Bx(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.ci)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}$h(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.$g(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}$g(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,m=this.getAdjacentEntries(e,t,u),g=[];for(let E=0;E<m.length;E++){let y=m[E][1];g.push(y)}g.sort(function(E,y){return E-y}),l[p]=g}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 m=u[1]+1;m<a.length;m++)n.push(...a[m])}return n}Gg(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.Bh(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.Bh(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}Bh(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(g=>!lt(g[0])),m=u.filter(g=>lt(g[0]));m.length>0&&(m.sort((g,E)=>g[0].obj.span>E[0].obj.span?-1:E[0].obj.span>g[0].obj.span?1:0),p.push(m[0])),u.length>0?s.push([d,iN(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===mo&&u[0].type===mo?0:d[0].type===vr&&u[0].leaf?-1:u[0].type===vr&&d[0].leaf?1:0),s.map(d=>d[0])}};var VO="xmax",GO="ymax",$O="xmin",BO="ymin",cg="_min",dg="_max",Mc=class{constructor(r,e,t,n,o){this.R=r;this.oe=e;this.axis=t;this.ve=n;this.Bg=o;c(this,"hi",{})}execute(){this.hi={};let r=this.Bg(),e={},t=this.axis===0?{[cg]:$O,[dg]:VO}:{[cg]:BO,[dg]:GO},n=this.axis===1?{[cg]:$O,[dg]:VO}:{[cg]:BO,[dg]:GO},o=null;for(let a=0;a<this.oe.layers.length-1;a++){let l=this.oe.layers[a],h=this.oe.layers[a+1],d=Math.min(l[t.be],h[t.be]),p=Math.max(l[t._t],h[t._t])-d,m=this.ve?n.be:n._t,g=this.ve?n._t:n.be,E=l[m],x=h[g]-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.oe.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.oe.regions.push(S),this.hi[A.id]=S;let R=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,O=this.axis===0?f.top:f.left;if(v<O){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:O-v,height:this.axis===0?O-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.oe.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.Bo(A,T,S,P,!0),R=P}}S.gateDown=this.Bo(A,T,R,f,!0),o!=null&&(S.gateUp=this.Bo(A,T,o,S,!1))}o=f}let s=this.oe.layers[this.oe.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.oe.regions.push(d),this.hi[l.id]=d,o!=null&&(d.gateUp=this.Bo(l,h,o,d,!1))}return this.oe.edgeNodes.forEach(a=>{let l=a.edge,h=H(l.source)?l.source.getParent():l.source,d=H(l.target)?l.target.getParent():l.target,u=this.R.entryMap[h.id],p=this.R.entryMap[d.id],m=this.hi[u.id],g=this.hi[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.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.oe.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.oe.gateMap[T])}E.push(g.gateUp)}else{E.push(m.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.oe.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.oe.gateMap[T])}g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.oe.edgeRoutingMap[l.id]=x,this.oe.edgeRouting.push(x),e[l.id]=E}),e}Bo(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.ve?l+(o?0:h):l+(o?h:0);return this.Fg(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})}Fg(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.oe.gates.push(l),this.oe.gateMap[l.id]=l,l}};function oN(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,m)=>{let g=jn(p.source),y={edge:p,isSource:g===m,sourceVertex:g,targetVertex:jn(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(m=>{(We(m.source,i)&&!We(m.target,i)||We(m.target,i)&&!We(m.source,i))&&u(m,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 m=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[m]||(o[m]={id:m,edges:new Set},e.push(o[m])),o[m].edges.add(h[p].edge),h[p].isSource?(s[m]||(s[m]={id:m,edges:new Set},t.push(s[m])),s[m].edges.add(h[p].edge)):(a[m]||(a[m]={id:m,edges:new Set},n.push(a[m])),a[m].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function sN(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Vc=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"Q");c(this,"qr",{});c(this,"At",{});c(this,"Fo",null);c(this,"Fh",[]);c(this,"Uh",new Map);c(this,"xa");c(this,"Ne");c(this,"di");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,"zh");c(this,"adjacentVertices",{});this.Q=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.zh=e.setPosition,this.xa=e.getSize,this.Fo=e.rootNode,this.Ne=e.edgeNodeSize,this.di=e.edgeFilter}nextRoot(){let r=this.pi.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.qr[r]}setRootNode(r){this.Fo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this.At[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}Yh(){let r={width:50,height:50};return this.axis===0?r.width=this.Ne:r.height=this.Ne,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.Q.x:this.Q.y}getPaddingInOtherAxis(){return this.axis===0?this.Q.x:this.Q.y}initialize(){this.pi.length=0,this.Fh.length=0,this.Uh.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.At[e.id]=this.xa(e.id),this.qr[e.id]=e;let n=oN(e,this.di);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:sN(n),size:this.xa(e.id),type:mo,layer:-1,vertexSet:null};this.pi.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.Fh.push(o),this.Uh.set(e.id,o))}this.pi.sort((t,n)=>{let o=this.Fo?this.Fo.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 lt(r)&&r.obj.edge.source===e.obj||lt(e)&&e.obj.edge.source===r.obj||lt(r)&&r.obj.edge.target===e.obj||lt(e)&&e.obj.edge.target===r.obj||lt(r)&<(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 Gc(i){return i.parents.length>0?i.parents[0].loc:null}function ug(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 aN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function FO(i){return i.parents.length>0?i.parents[0].childGroup:null}function lN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var $c=class{constructor(r,e){this.model=r;c(this,"un",-1/0);c(this,"pn",1/0);c(this,"Dr");c(this,"Yt");c(this,"ve");c(this,"P",[]);c(this,"Nr",[]);c(this,"ei",{});c(this,"Q");c(this,"J");c(this,"Ct");c(this,"ue");c(this,"ti");c(this,"xe");c(this,"St");c(this,"D");c(this,"ri");c(this,"Ot");c(this,"ni");c(this,"De",[]);c(this,"ne",new Map);c(this,"da",{center:r=>Gc(r)+ug(r,this.J)/2-(r.size-this.J)/2,start:r=>Gc(r),end:r=>Gc(r)+ug(r,0)-(r.size-this.J)});c(this,"F");c(this,"Pt");c(this,"Xt");c(this,"ii");c(this,"fa",{center:(r,e,t)=>(e+t)/2-ug(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Dr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Yt=e.compress===!0,this.St=e.absoluteBacked===!0,this.F=e.idFunction,this.Pt=e.sizeFunction,this.Xt=e.childVerticesFunction,this.ii=e.absolutePositionFunction,this.ue=e.axisIndex,this.xe=this.ue!==1,this.ti=this.ue===0?1:0,this.ri=this.xe?Ee:Q,this.Ot=this.xe?Te:De,this.ni=this.xe?De:Te,this.ve=e.invert===!0,this.D=e.alignment||Nc,this.Q=e.padding,this.J=this.xe?this.Q.x:this.Q.y,this.Ct=this.xe?this.Q.y:this.Q.x}execute(){let r,e,t;for(let n=0;n<this.Dr.length;n++){r=this.Dr[n];let o=this.Pt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.oi(s,0);let l=0,h,d,u=(m,g)=>this.Yt&&m.parents&&m.parents.length>0?this.ne.get(this.F(m.parents[0].node)).position[this.ri]+this.ua(m,this.ti)+this.Ct:g,p=!1;if(a===0&&this.St===!0){let m=this.ii(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.si(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.P.length;e++){for(this.P[e].otherAxis=l,t=0;t<this.P[e].entries.length;t++)h=this.ue===0?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),d=this.ue===1?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),this.si(this.F(this.P[e].entries[t].node),{x:h,y:d},e);this.ve?e<this.P.length-1&&(this.P[e].otherAxisSize=this.De[e+1]+this.Ct,l-=this.P[e].otherAxisSize):(this.P[e].otherAxisSize=this.De[e]+this.Ct,l+=this.P[e].otherAxisSize)}}return this.ne}si(r,e,t){this.ne.set(r,{position:e,layer:t});let n=this.Pt(r),o=this.ue===0?e.x+n.width:e.y+n.height,s=this.ue===0?e.x:e.y;this.un=Math.max(this.un,o),this.pn=Math.min(this.pn,s)}dt(r){let e=this.P[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.P[r]=e),e}Qe(r,e,t,n,o){let s=this.dt(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.Ot],children:[]},l=e[this.ni];return this.De[t]==null?this.De[t]=l:this.De[t]=Math.max(this.De[t],l),s.pointer+=e[this.Ot]+(r.type===vr?0:this.J),s.entries.push(a),n&&n.children.push(a),a}pa(r,e){let t=this.Nr[e];t||(t=[],this.Nr[e]=t),r.index=t.length,t.push(r)}ma(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.dt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.J)}}ua(r,e){let t=r.parents.map(n=>n.dimensions[e===0?Te:De]);return Math.max.apply(null,t)}ga(r){if(r.size>0){let e=this.da[this.D](r),t=this.Nr[r.depth],n=this.D==="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.D==="end"?u.loc-r.size:u.loc+u.size+this.J}this.D!=="end"&&e>=n||this.D==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.D==="end"?r.nodes.length-1:0,l=this.D==="end"?-1:r.nodes.length,h=this.D==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.J;o!==0&&this.Ea(r),this.pa(r,r.depth)}}ya(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.fa[this.D](r,e,t),o=n-Gc(r);if(this.ma(r,n),!aN(r)){let s=FO(r),a=lN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ea(r){let e=r;for(;e!=null;)this.ya(e),e=FO(e)}oi(r,e){if(this.ei[r.node.id])return;this.ei[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:V()},n=[],o,s={},a=this.dt(e+1),l=this.Xt(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.Pt(this.F(h)),u=a.entries.find(p=>this.F(p.node)===this.F(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,m=Gc(u),g=ug(u,this.J),E=m+g/2,y=E-p;y>0&&this.Ug(u,y,r)}else{let p=this.Qe(h,d,e+1,r,t);t.nodes.push(p);let m=d[this.Ot];t.size+=m+this.J,n.push(p)}s[h.id]=!0}}for(this.ga(t),o=0;o<n.length;o++)this.oi(n[o],e+1);return l.length}Ug(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 Bc=class extends Ss{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"Ht");c(this,"kt");c(this,"Q");c(this,"mn");c(this,"gn");c(this,"D");c(this,"Ne");c(this,"mi");n=n||{},this.Q=n.padding||{x:50,y:50},this.mn=n.unattachedRootPadding||150,this.Ht=n.lastPlacements,this.gn=n.strategy||"parent",this.Ne=n.edgeNodeSize,this.mi=n.gatherUnattachedRoots,this.D=n.alignment||"center"}zg(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>lt(o)?n+this.Ne: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.Ht?this.Ht.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(g=>this.zg(g.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(g=>g.mainAxis))},m=this.model.getNodeSizeInMainAxis(e);return n=this.gn==="center"?(p.biggestLayer-m)/2:this.gn==="start"?0:p.biggestLayer-m,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.gn==="parent"?this.Yg(p,l):this.Xg(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}Xg(e,t,n,o,s,a,l,h,d){let u=s,p;for(let m=0;m<e.length;m++){this.kt=e[m],t=this.gn==="center"?(o.biggestLayer-l[m].mainAxis)/2:this.gn==="start"?0:o.biggestLayer-l[m].mainAxis,u=s;for(let g=0;g<this.kt.entries.length;g++){p=this.kt.entries[g];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(lt(p)){let b=n===0?this.Ne:y,A=n===0?y:this.Ne;p.loc={x,y:f,w:b,h:A},u+=this.Ne+h}else this.vertexSet.setPosition(p.obj,x,f,m),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),m<e.length-1&&(this.model.invert?a-=l[m+1].otherAxis+2*d:a+=l[m].otherAxis+2*d)}}Yg(e,t){let n=new $c(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.Q,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.D,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let m=[];if(u<this.vertexSet.layers.length-1){let g=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);m.push(...g)}return m},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.un,a=n.pn,l=0,h=0;if(this.mi&&o.size===1&&this.Ht!=null){let d=this.Ht.rootPosition+this.Ht.rootSize+this.mn;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.Ht){let d=this.Ht.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 Fc=class{constructor(r,e){this.R=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,"Xh",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.jh(r),o=lt(e),s;return o?(s={id:V(),obj:e,previous:null,size:this.R.Yh(),next:null,leaf:!1,type:vr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.R.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.R.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.R.assignedVertices.set(e.id,r),this.Xh.push(s),s}findLayerIndex(r){var e;return(e=this.Xh.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.jh(r),o=this.R.Yh();this.R.assignedVertices.set(e.id,r);let s={id:V(),obj:e,size:o,leaf:!1,type:vr,layer:r,vertexSet:this};e.entries.push(s),this.R.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;)lt(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.R.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.R.layout.absoluteBacked)this.En(r,e,t,n);else{let o=this.R.layout.model.getVertex(r),s=this.R.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this.En(r,s.x,s.y,n):this.En(r,e,t,n)}}setPosition(r,e,t,n){if(!this.R.layout.absoluteBacked)this.En(r.id,e,t,n);else{let o=this.R.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this.En(r.id,o.x,o.y,n):this.En(r.id,e,t,n)}}jh(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]}En(r,e,t,n){this.R.zh(r,e,t,n);let o=this.layers[n],s=this.R.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 Fx="Hierarchy",go=class extends Hn{constructor(e){super(e);c(this,"type",Fx);c(this,"axis");c(this,"model");c(this,"mn");c(this,"ci");c(this,"li");c(this,"ve");c(this,"mi");c(this,"kh");c(this,"dn");c(this,"Hh");c(this,"D");c(this,"Wh");c(this,"ai");c(this,"Ne");c(this,"di");c(this,"ba");c(this,"routingInformation");c(this,"resultSets",[]);this.mn=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.ci=e.options.maxIterationsWithoutImprovement||5,this.li=e.options.maxIterations||24,this.Hh=e.options.rootNode,this.dn=e.options.getRootNode,this.Wh=e.options.placementStrategy,this.Ne=e.options.edgeNodeSize||hg,this.ve=e.options.invert===!0,this.mi=e.options.gatherUnattachedRoots===!0,this.D=e.options.alignment||Nc,this.kh=e.options.generateRouting===!0,this.di=e.options.edgeFilter,this.ba=e.options.filteredEdgeProcessor,this.ai=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.dn?this.dn():this.Hh;this.model=new Vc(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.mn,edgeNodeSize:this.Ne,edgeFilter:this.di},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:hg}}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 Fc(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new Ic(this.model,d);u.execute(l),new Ts(d,(g,E,y)=>this.model.getAdjacentEntries(g,E,y),{maxIterations:this.li,maxIterationsWithoutImprovement:this.ci}).execute(),h=new Bc(this.model,d,{padding:this.padding,strategy:this.Wh,edgeNodeSize:this.Ne,lastPlacements:h,gatherUnattachedRoots:this.mi,unattachedRootPadding:this.mn,alignment:this.D}).execute(l);let p=[];if(d.layers.flatMap(g=>g.entries.map(E=>{if(lt(E)){p.push(E);let y=this.axis===0?g.ymax-g.ymin:g.xmax-g.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.ba){let g=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.ba(g,this)}let m={};this.kh&&(this.routingInformation=this.model.sets.map(g=>{let E={gates:g.gates,edges:g.edgeRouting,edgeMap:g.edgeRoutingMap,regions:g.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new Mc(this.model,d,this.axis,this.ve,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:m}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(go,"type",Fx),qe.register(go.type,go);var Uc=class{constructor(r){this.color=r}generate(r){return this.color}},vi=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=hN(r);return i.fromString(e)}}};function hN(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 UO(){return new vi(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var vs=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=UO(),s=this.assignedColors.find(a=>Yx(a,o)<20);for(;s!=null&&n<10;)o=UO(),s=this.assignedColors.find(a=>Yx(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},Ux=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 Yx(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 Yc(i){let r=z(i)?vi.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new vi(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new vi(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 cN(i){let r=z(i)?vi.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new vi(0,0,0):new vi(255,255,255)}var pg="empty",YO=[{dx:0,dy:-1,axis:he,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:he,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1},{dx:-1,dy:-1,axis:yn,directionFromParent:-1},{dx:1,dy:-1,axis:kn,directionFromParent:-1},{dx:1,dy:1,axis:yn,directionFromParent:1},{dx:-1,dy:1,axis:kn,directionFromParent:1}],zO=[{dx:0,dy:-1,axis:he,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:he,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1}],zx=(i,r,e,t)=>zO.filter(n=>n.axis!==e||n.directionFromParent===t),mg=(i,r,e,t)=>{let n=[];switch(e){case kn:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case yn: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 he:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return YO.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Ps=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"ut",{});c(this,"gi");c(this,"Zh");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.gi={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.Zh=t*(n+o)}Uo(r,e){return{x:Math.floor((r-this.gi.x)/this.gridCellSize),y:Math.floor((e-this.gi.y)/this.gridCellSize)}}jg(r){let e=this.Uo(r.x,r.y),t=this.Uo(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}}kg(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.gi.x+t,s=this.gi.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}Hg(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}Wg(r,e,t,n){let o=this.makeKey(r,e);if(this.ut[o]==null){let s=this.kg(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.Zh),d=[],u=[],p=!1,m=!1;h.forEach(g=>{if(!p&&(this.sourceId===g.id||this.sourceObstacles.indexOf(g.id)!==-1)&&(p=!0),!m&&(this.targetId===g.id||this.targetObstacles.indexOf(g.id)!==-1)&&(m=!0),!this.Hg(g.id)){let E=nx(this.jg(g),this.vertexBorder,this.vertexBorder);u.push(g.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(g.id)}}),this.ut[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:m}}else t&&(this.ut[o].ax=t),n&&(this.ut[o].ay=n);return this.ut[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.Wg(r,e,t,n)}reinitialize(){Object.entries(this.ut).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 Cs(i,r){return i===0&&r===0?void 0:i===0&&r!==0?he:i!==0&&r===0?ne:Math.sign(r)===Math.sign(i)?yn:kn}function Xx(i,r,e){return e==null?0:e===ne?i>0?1:-1:e===he?r>0?1:-1:e===yn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function gg(i){let r=Cs(i.ox,i.oy);return{axis:r,direction:Xx(i.ox,i.oy,r)}}function jx(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?ne:he}function Ir(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 Cs(r,e)}}function Hx(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=Cs(r,e);return Xx(r,e,t)}}function dN(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=Ir(i);return Ir(r)===t?-1:Ir(e)===t?1:0}}var zc=class{constructor(){c(this,"node")}sort(r,e){return dN(this.node,r,e)}};var Xt="group:added",Ci="group:member:added",Os="group:member:removed",Me="group:removed",Eo="dataLoadStart",Eg="dataAppendStart",Mr="dataLoadEnd",fg="dataAppendEnd",yg="dataUpdated",bn="graphClearStart",jt="graphCleared",kx="graphChanged",Re="group:updated",Ve="node:updated",cr="port:updated",pt="edge:updated",dr="edge:added",Ht="node:added",mt="edge:removed",Le="node:removed",Wn="port:added",Vr="port:removed",rn="edge:target",nn="edge:source",ur="select",pr="deselect",Cr="selection:cleared",Zn="edge:geometry",Jn="edge:pathEdited",Xc="edge:typeChanged",jc="node:typeChanged",Hc="port:typeChanged",kc="group:typeChanged",Wx="group:move:start",Wc="group:move",Gr="group:move:end",Zc="internal:group:sizeChanged",Jc="internal:group:sizeChangedRedo",Kc="internal:group:sizeChangedUndo",Zx="renderer:added",_s="node:move:start",nr="node:move",Lt="node:move:end",Rs="undoredo:update",Jx="undo",Kx="redo",Pi="destroy";var uN=[Ht,Wn,dr,Xt,Le,Vr,mt,Me,Ve,cr,pt,Re,Lt,Gr,nn,rn,Ci,Os],Ls=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},al=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"zo",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||zt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.zo==null?this.zo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.zo),this.zo=setTimeout(o,e.debounceTimeout))};Ls(this,Eo,()=>{n=!0}),Ls(this,Mr,()=>{n=!1}),Ls(this,bn,()=>{n=!0}),Ls(this,jt,()=>{n=!1}),Ls(this,yg,s),Ls(this,Jn,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},qc=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(yg)};uN.forEach(t=>Ls(this,t,e))}};var qx="mixed",Qc="isolated",Qx="nodesOnly",eb="groupsOnly",tb="edgesOnly",ws=class ws extends It{constructor(e,t){super();this.instance=e;c(this,"Wt",1/0);c(this,"Jh",1/0);c(this,"Kh",1/0);c(this,"se",[]);c(this,"K",[]);c(this,"q",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ie",{});c(this,"Mr");c(this,"Yo",!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.Mr=t.mode||qx,this.instance.bind(Le,n=>{this.Rt(n.node)}),this.instance.bind(Me,n=>{this.Rt(n.group)}),this.instance.bind(Vr,n=>{this.Rt(n.port)}),this.instance.bind(mt,n=>{this.Rt(n.edge)}),this.instance.bind(rn,n=>{this.Ie[n.edge.getFullId()]&&this.fire(rn,n)}),this.instance.bind(nn,n=>{this.Ie[n.edge.getFullId()]&&this.fire(nn,n)}),this.instance.bind(Ht,n=>{this.generator&&this.autoFill&&!this.Yo&&this.reload()}),this.instance.bind(Xt,n=>{this.generator&&this.autoFill&&!this.Yo&&this.reload()}),this.instance.bind(Ve,n=>{this.Ie[n.vertex.getFullId()]&&this.fire(Ve,n)}),this.instance.bind(Re,n=>{this.Ie[n.vertex.getFullId()]&&this.fire(Re,n)}),this.instance.bind(pt,n=>{this.Ie[n.edge.getFullId()]&&this.fire(pt,n)}),this.instance.bind(cr,n=>{n.port!=null&&this.Ie[n.port.getFullId()]&&this.fire(cr,n)}),this.instance.bind(jt,()=>{this.clear()}),this.instance.bind(Mr,()=>{this.reload()}),this.setCapacityPolicy(ws.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.se.length===0&&this.K.length===0&&this.q.length===0}qh(e){return e.objectType===Fe.objectType?this.q:e.objectType===de.objectType?this.se:this.K}setMode(e){this.Mr=e,e===Qc?this.Zg():e===tb?this.Qh():e===Qx?(this.Aa(),this.ed()):e===eb&&(this.Aa(),this.td())}Jg(e){let t=[],n=this.qh(e),o=e.objectType===Fe.objectType?this.Jh:e.objectType===de.objectType?this.Wt:this.Kh;if(n.length>=o){if(this.capacityPolicy===ws.DISCARD_NEW)return!1;t=n.splice(0,1),this.Sa(t[0],":removed"),delete this.Ie[t[0].getFullId()]}return n.push(e),this.Sa(e,":added"),t}Sa(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))}rd(e,t){if(this.Kg(e)&&!this.Ie[e.getFullId()]){let n=this.Jg(e);return n===!1?[[],[]]:(this.Ie[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}Kg(e){return this.Mr===qx||this.Mr===Qx&&e.objectType===de.objectType||this.Mr===eb&&e.objectType===le.objectType||this.Mr===tb&&e.objectType===Fe.objectType?!0:this.Mr===Qc?e.objectType===Fe.objectType?this.se.length===0&&this.K.length===0:this.q.length===0:!1}Rt(e,t){let n=e.getFullId();return _t(this.qh(e),s=>s.getFullId()==n)?(delete this.Ie[e.getFullId()],t&&t(e,!1),this.Sa(e,":removed"),[[],[e]]):[[],[]]}qg(e,t){return this.Ie[e.getFullId()]?this.Rt(e,t):this.rd(e,t)}Ta(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(z(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.ze)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.Ta(e,this.Rt.bind(this),t)}append(e,t){return this.Ta(e,this.rd.bind(this),t)}toggle(e,t){return this.Ta(e,this.qg.bind(this),t)}setMaxNodes(e){this.Wt=e}setMaxGroups(e){this.Kh=e}setMaxEdges(e){this.Jh=e}setCapacityPolicy(e){this.capacityPolicy=e}Aa(){for(let e=this.q.length,t=0;t<e;t++)this.Rt(this.q[0])}td(){for(let e=this.se.length,t=0;t<e;t++)this.Rt(this.se[0])}ed(){for(let e=this.K.length,t=0;t<e;t++)this.Rt(this.K[0])}Qh(){this.td(),this.ed()}Zg(){this.Qh(),this.Aa()}clear(e){this.se.length=0,this.q.length=0,this.K.length=0,this.Ie={},this.fire(bn),e||this.onClear(this)}nd(e){let t=[];for(let n=0;n<e.length;n++)this.Ie[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Yo=!0,this.fire(Eo,{}),this.generator(this,this.instance),this.fire(Mr,{}),this.onReload&&this.onReload(),this.Yo=!1)}ze(e,t){let n=t===Fe.objectType?this.q:t===le.objectType?this.K:this.se;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.ze(e,de.objectType)}eachGroup(e){this.ze(e,le.objectType)}eachVertex(e){this.ze(e,de.objectType),this.ze(e,le.objectType)}eachEdge(e){this.ze(e,Fe.objectType)}getNodeCount(){return this.se.length}getNodeAt(e){return this.se[e]}getNodes(){return this.se}getNode(e){return this.se.find(t=>t.id===e)}getGroupAt(e){return this.K[e]}getGroups(){return this.K}getGroup(e){return this.K.find(t=>t.id===e)}getGroupCount(){return this.K.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.se),Array.prototype.push.apply(e,this.q),Array.prototype.push.apply(e,this.K),e}getAllEdgesFor(e,t){return this.nd(e.getAllEdges(t))}getSourceEdgesFor(e){return this.nd(e.getSourceEdges())}getEdgeCount(){return this.q.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.q[e]}getEdges(){return this.q}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}Qg(e){return new ws(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.Qg();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(ws,"DISCARD_EXISTING","discardExisting"),c(ws,"DISCARD_NEW","discardNew");var mr=ws;var Oi=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,"va");c(this,"Ca");c(this,"Ei");c(this,"od");c(this,"sd");c(this,"ad");c(this,"ld");this.source=r.source.getFullId(),this.target=r.target.getFullId(),H(r.source)&&(this.va=r.source.id,this.source=r.source.getParent().getFullId()),H(r.target)&&(this.Ca=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Ei=r.geometry,r.source.dummy&&(this.od=!0,this.ad={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.sd=!0,this.ld={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.od?this.ad:this.va==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.va}generateTargetIdentifier(){return this.sd?this.ld:this.Ca==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Ca}Qe(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Ei},e=this.instance.$_addEdge(r,xx,null);this.manager.edgeChange(this.edgeId,e)}tt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},bg=class extends Oi{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},Ag=class extends Oi{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.Qe()}redo(){this.tt()}hasDeltas(){return this.obj!=null}},xg=class extends Oi{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return xi(this.newVertex)&&xi(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!xi(this.newVertex)&&!xi(this.oldVertex)&&dx(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},Sg=class extends xg{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},Tg=class extends xg{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var An=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=V()}$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 Oi&&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];rb(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):nb(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):ib(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 Ds=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 ed=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===de.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===le.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}cd(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},hl=class extends ed{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.cd()}redo(){this.$add()}},ll=class extends ed{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.cd()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},td=class extends ll{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))}},cl=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.Vr(Jc,this.newGroupSize,this.originalGroupSize)}undo(){this.Vr(Kc,this.originalGroupSize,this.newGroupSize)}Vr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function pN(i,r,e){return i==="*"?!0:i.length>0?i.indexOf(r)!==-1:!e}function Ns(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 mN(i,r){let e=xt({x:i[0],y:i[1]},{x:0,y:0},r);return[Math.round(e.x),Math.round(e.y)]}function gN(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function rd(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 _i=class{constructor(r,e,t,n){this.obj=r;this.instance=t;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=Ns({},r.data),this.$od=Ns({},e),this.reason=n}hd(r){this.obj.objectType===de.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===le.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===pe.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Fe.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.hd(this.$od)}redo(){this.hd(this.$nd)}hasDeltas(){return!Qa(this.$nd,this.$od)}};var nd=class{constructor(r,e,t){this.obj=r;this.yn=e;this.instance=t}Qe(){this.instance.addPort(this.yn,this.obj.data)}tt(){this.instance.removePort(this.yn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},id=class extends nd{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},od=class extends nd{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.Qe()}redo(){this.tt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var vg=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},sd=class extends vg{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.Pa=o;this.Oa=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Oa!=null&&this.renderer.setPosition(this.node.id,this.Oa.x,this.Oa.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Pa!=null&&this.renderer.setPosition(this.node.id,this.Pa.x,this.Pa.y)}},ad=class extends vg{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ra=o;this._a=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this._a!=null&&this.renderer.setPosition(this.node.id,this._a.x,this._a.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ra!=null&&this.renderer.setPosition(this.node.id,this.Ra.x,this.Ra.y)}},ld=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}},hd=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 dl=class{constructor(r,e,t){this.La=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.La.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var ob="internal.connection",ul="context:update",cd="group:collapse",dd="group:expand",fo="zoom",ud="render:start",Sn="render:end",sb="adhocLayout",Is="afterLayoutRefresh",pl="group:relayout",$r="group:render",Ms="internal.vertex:updated",Br="node:render",pd="node:visibility",md="plugin:added",ab="plugin:removed",Tn="relayout",lb="objectRepainted",Ue="click",gt="contextmenu",yo="dblclick",Fr="dbltap",hb="focus",ue="mousedown",Cg="mouseenter",Pg="mouseexit",ie="mousemove",cb="mouseleave",oe="mouseup",et="mouseout",tt="mouseover",W="tap",db="touchstart",ub="touchend",pb="touchmove",mb="vertex:click",gb="vertex:dblclick",Eb="vertex:dbltap",fb="vertex:mouseout",yb="vertex:mouseover",xb="vertex:mousemove",EN="vertex:mouseup",fN="vertex:mousedown",bb="vertex:contextmenu",Ab="vertex:tap",Sb="edge:click",Tb="edge:dblclick",vb="edge:dbltap",gd="edge:mouseout",Ed="edge:mouseover",Cb="edge:mouseup",ml="edge:mousedown",Pb="edge:contextmenu",Ob="edge:tap",xo="canvasClick",_b="canvasDblClick",fd="edge:redraw",Rb="lasso:end",gl="pan",vn="modeChanged",yN="allGroupsRelayout",Lb="groupRelayoutAdhoc",xN="groupMemberRemoved",wb="newVertexAddedToGroup",Db="existingVertexAddedToGroup";var El=class extends _i{constructor(e,t,n,o){super(e,t,n,o);this.obj=e;this.instance=n;c(this,"type","vertexUpdate");o===Vs&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var Gs=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 Nb=class{constructor(r,e,t,n,o){this.T=r;this.eE=e;this.ud=t;this.Ei=n;this.La=o;c(this,"type","edgePath")}dd(r){this.T.setEdgeGeometry(this.eE,r,null,this.La)}undo(){this.dd(this.ud)}redo(){this.dd(this.Ei)}hasDeltas(){return!Qa(this.ud,this.Ei)}},bN=50,Ib="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",AN="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",yd=class{constructor(r){c(this,"T");c(this,"Xo");c(this,"Lt");c(this,"wa");c(this,"undoStack");c(this,"redoStack");c(this,"jo",[]);c(this,"ae");c(this,"Zt",0);this.T=r.instance,this.Lt=!1,this.undoStack=[],this.redoStack=[],this.Xo=r.maximumSize||bN,this.wa=r.onChange,this.tE()}pd(r){this.Lt=r}dataLoadStart(){this.clear(),this.pd(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.pd(!1)}dataAppendEnd(){this.dataLoadEnd()}tE(){this.T.bind(jt,()=>{this.clear()}),this.T.bind(Ht,r=>{this.command(new hl(r.node,this.T))}),this.T.bind(Le,r=>{this.command(new ll(r.node,this.T))}),this.T.bind(Ve,r=>{qa(r.updates)||this.command(new El(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(Xt,r=>{this.command(new hl(r.group,this.T))}),this.T.bind(Me,r=>{this.command(new td(r,this.T))}),this.T.bind(Re,r=>{qa(r.updates)||this.command(new El(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(Zc,r=>{let e=new cl(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(dr,r=>{this.command(new bg(r.edge,this.T,this))}),this.T.bind(mt,r=>{this.command(new Ag(r.edge,this.T,this))}),this.T.bind(pt,r=>{qa(r.updates)||this.command(new _i(r.edge,r.originalData,this.T,r.reason))}),this.T.bind(nn,r=>{this.command(new Sg(this.T,this,r.edge,r.old,r.new))}),this.T.bind(rn,r=>{this.command(new Tg(this.T,this,r.edge,r.old,r.new))}),this.T.bind(Jn,r=>{this.command(new Nb(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(Wn,r=>{this.command(new id(r.port,r.vertex,this.T))}),this.T.bind(Vr,r=>{this.command(new od(r.port,r.vertex,this.T))}),this.T.bind(cr,r=>{qa(r.updates)||this.command(new _i(r.port,r.originalData,this.T,null))}),this.T.bind(Ci,r=>{r.vertexIsNew!==!0&&this.command(new sd(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(Os,r=>{this.command(new ad(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(jc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Hc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(kc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Xc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Lt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ds(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Gr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ds(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(cd,e=>{this.command(new ld(e.group,r.renderer))}),r.renderer.bind(dd,e=>{this.command(new hd(e.group,r.renderer))}),r.renderer.bind(Le,e=>{this.command(new dl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Me,e=>{this.command(new dl(r.renderer,e.vertex,e.pos))})})}fi(){this.wa&&this.wa(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.Lt){if(!r.hasDeltas())return;HO(r)&&(r=r.compress()),this.ae!=null?this.ae.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.Xo&&this.undoStack.splice(this.undoStack.length-this.Xo-1,this.undoStack.length-this.Xo),this.redoStack.length=0,this.fi())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof Oi&&o.edgeId===r?o.edgeChange(e):o instanceof An&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.Lt=!0,this.redoStack.push(r),r.undo(),this.Lt=!1,this.fi())}redo(){let r=this.redoStack.pop();r&&(this.Lt=!0,this.undoStack.push(r),r.redo(),this.Lt=!1,this.fi())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.ae=null,this.Zt=0,this.Lt=!1,this.fi()}transaction(r,e,t){if(this.ae!=null&&e==null)return U(Ib),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.ae;return this.ae=null,this.command(a),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.ae!=null)return this.transaction(r,St);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.rE(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}}rE(r,e){e instanceof An?e.$mergeInto(r):r.addAction(e,!0)}nE(){return this.ae=new An,this.Zt=0,this.ae.id}openTransaction(r){if(!this.Lt){let e=!0;if(this.ae!=null)if(r!=null)if(r===XO)this.commitTransaction();else if(r===jO)this.rollbackTransaction();else if(r===St)e=!1,this.Zt++;else throw new Error(Ib);else throw new Error(Ib);return e&&this.nE(),this.ae.id}return null}rollbackTransaction(){this.ae!=null&&(this.Zt>0?(this.Zt--,U(AN)):(this.ae.undo(),this.ae=null,this.fi(),this.jo.length=0))}commitTransaction(r){if(this.ae!=null)if(r!==!0&&this.Zt>0)this.Zt--;else{let e=this.ae;this.ae=null,this.command(e),this.Zt=0,this.md()}}Ib(r){if(this.undoStack.length===0){let e=new An;e.addAction(r),this.command(e)}else{let e=this.undoStack[this.undoStack.length-1];if(e instanceof An)e.addAction(r);else{this.undoStack.pop();let t=new An;t.addAction(e),t.addAction(r),this.undoStack.push(t)}}}Mb(r){this.iE(r),this.md()}iE(r){this.jo.push(r)}md(){this.ae==null&&(this.jo.forEach(r=>{try{r()}catch(e){}}),this.jo.length=0)}},XO="commitCurrent",jO="rollbackCurrent",St="appendToCurrent";function HO(i){return i instanceof An}function rb(i){return i instanceof _i||i instanceof El}function nb(i){return i instanceof Ds}function ib(i){return i instanceof cl}var Og="1.0.2";var Mb="type",Vb="default",Fb="groupResized",kO="addPort",WO="addNewPort",ZO="removePort",xd="updatePort",$s="moved",SN="layout",_g="updateVertex",Gb="updateNode",$b="updateGroup",Ub="magnetizer",Ad="setPosition",Yb="snapToGrid",TN="sizeGroupToFit",fl="drawingToolsResize",Vs="rotation",zb="resized",Bb="updated",bd=class extends It{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");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,"Da");c(this,"gd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"portSeparator",".");c(this,"undoRedo");c(this,"Ed");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"pe");c(this,"Jt",new Map);c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new yd({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Rs,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||jm,this.typeProperty=e.typeProperty||Mb,this.edgeTypeProperty=e.edgeTypeProperty||Mb,this.portTypeProperty=e.portTypeProperty||Mb,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||Vb),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||Vb),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||Vb),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new Tc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!hr(a)?{}:a,a=ot(a),a.id=a.id||V(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||Rx,this.modelTopAttribute=e.modelTopAttribute||Lx,this.modelWidthAttribute=e.modelWidthAttribute||Dx,this.modelHeightAttribute=e.modelHeightAttribute||Nx,this.modelRotationAttribute=e.modelRotationAttribute||wx,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.gd=e.autoSave&&e.autoSave.enabled!==!1,this.Ed={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],m=u==null?1/0:u,g=p==null?1/0:p;return m-g}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new tl(this.Ed),this.gd&&(this.autoSaver=new al(this,e.autoSave)),new qc(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=H(o)?o.getParent():o,d=H(s)?s.getParent():s,u=H(o)?this.model.getPortDefinition(a):K(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=H(s)?this.model.getPortDefinition(l):K(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),m=K(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),g=K(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?!(m.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||g.allowLoopback===!1):h===d?!(m.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||g.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.pe=this.ko(o=>{this.L(s=>s.$selectionCleared(o)),this.fire(Cr,{selection:o})}),e.selectionMode&&this.pe.setMode(e.selectionMode),e.maxSelectedNodes&&this.pe.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.pe.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.pe.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.pe.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})}oE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}Ho(e,t,n,o){if(z(e))return[this.graph.getVertex(e,!0),!1];if(K(e)||Y(e)||H(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.fd(this.oE(t,{x:a,y:l},n),o),!0]}}ko(e){return new mr(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.ko();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 al(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.Na(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.Na(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},rl,null))),t}clear(){return this.L(e=>e.$graphClearStart()),this.fire(bn),this.graph.clear(),this.$transientVerticesByRenderer={},this.L(e=>e.$graphClearEnd()),this.fire(jt),this}destroy(){this.clear(),delete this.Jt,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()}getDescendants(e){return xs(e)}getAncestors(e){return En(e)}isAncestor(e,t){return We(e,t)}isDescendantGroup(e,t){return fx(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=z(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(K(e)?this.typeFunction:H(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===de.objectType?this.typeProperty:e.objectType===pe.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t)}$dispatchTypeChange(e,t,n){let o,s;K(e)?(o=jc,s=()=>this.L(a=>a.$nodeTypeChanged(e,t,n))):H(e)?(o=Hc,s=()=>this.L(a=>a.$portTypeChanged(e,t,n))):Ke(e)?(o=Xc,s=()=>this.L(a=>a.$edgeTypeChanged(e,t,n))):Y(e)&&(o=kc,s=()=>this.L(a=>a.$groupTypeChanged(e,t,n))),o!=null&&(this.fire(o,{obj:e,previousType:t,newType:n}),s())}resolveFullId(e){if(Ke(e))return e.id;if(K(e))return e.id;if(Y(e))return e.id;if(H(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return H(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=V());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.group!=null)if(o=this.getGroup(e.group),o!=null)o.$addMember(s);else throw new Error("parent group ["+e.group+"] not found");return this.Na(s,o),o!=null&&this.fire(Ci,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}Na(e,t){let n={node:e,parentGroup:t};this.L(o=>o.$nodeAdded(n)),this.fire(Ht,n)}sE(e,t){let n={group:e,parentGroup:t};this.L(o=>o.$groupAdded(n)),this.fire(Xt,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(St);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}yd(e){return ys(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.yd(t);o[n.id]=n,n.transientRenderer=t.id}return n}fd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.L(o=>{o.$renderDummyVertex(n)}),n}Wo(e){this.graph.deleteNode(e),this.L(t=>{t.$nodeRemoved({node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.fd({id:`${e.id}_${n===Qe?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===Qe?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({node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.yd(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:bx},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(St);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()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=V()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e.group!=null){if(n=this.getGroup(e.group),n==null)throw new Error("Cannot find parent group ["+e.group+"]");n.$addMember(o)}this.sE(o,n),n!=null&&this.fire(Ci,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}$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.group=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.L(p=>{p.$groupMemberAdded(u)}),this.fire(Ci,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.L(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data.group,this.fire(Os,h)}return l}xd(e,t,n,o){e.nestedGroups.forEach(a=>this.xd(a,t,!0,o)),e.nodes.forEach(a=>this.bd(a,!0,o));for(let a=0;a<e.edges.length;a++)this.Ia(e.edges[a]);let s={group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.L(a=>a.$groupRemoved(s)),o||this.fire(Me,s)}bd(e,t,n){for(let s=0;s<e.edges.length;s++)this.Ia(e.edges[s]);let o={node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.L(s=>s.$nodeRemoved(o)),n||this.fire(Le,o)}removeGroup(e,t,n){let o=this.graph.getVertex(z(e)?e:e.id);if(o){this.openTransaction(St);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data.group),this.xd(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(!z(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(z(e)?e:e.id);if(t!=null){this.openTransaction(St);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.bd(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,rl,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.Ho(e.source,s,0,n),[h,d]=this.Ho(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),m={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.L(g=>g.$edgeAdded(m,e.context)),o||this.fire(dr,m,null),p}else return this.debugEnabled&&U("Could not add edge"),null}Ia(e,t){let n={edge:e,source:t};this.L((o,s)=>o.$edgeRemoved(n)),this.fire(mt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&K(n.source)&&this.Wo(n.source),n.target.dummy&&K(n.target)&&this.Wo(n.target),this.Ia(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.Ho(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.Wo(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.L(h=>{h.$edgeTargetChanged(l)}),this.fire(rn,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.Ho(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.Wo(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.L(h=>{h.$edgeSourceChanged(l)}),this.fire(nn,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.Zo(o,WO);let h={vertex:o,data:s,port:l};this.L(d=>d.$portAdded(h)),this.fire(Wn,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.Zo(n,kO);let s={vertex:n,data:t,port:o};return this.L(a=>a.$portAdded(s)),this.fire(Wn,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 H(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(St);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.Zo(n,ZO);let a={vertex:n,port:o,edges:s};return this.L(l=>l.$portRemoved(a)),this.fire(Vr,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&&K(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&Ke(n.obj))this.removeEdge(n.obj);else{for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.Jt)this.Jt.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,$b,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,Gb,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,_g,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(H(a.obj)?a.obj.getParent():a.obj).objectType===de.objectType?Ve:Re;this.Ad(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||_g,source:s}))}}updateVertices(e,t){this.aE(e,_g,!1,t)}aE(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||St)}updatePort(e,t){this.$_updatePort(e,t,xd,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.Ad(s.obj,t,o,cr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||xd}))}updateEdge(e,t){this.$_updateEdge(e,t,Bb,!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 l in t)s.data[l]==null?s.data[l]=t[l]:Gm(s.data,l,t[l]);this.Sd(a,s),this.fire(pt,{edge:s,updates:t||{},originalData:a,reason:n},null)}}update(e,t){this.cn(e,t,null,!1)}cn(e,t,n,o){if(K(e)){let s=n==null?Gb:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?$b:n;this.$_updateVertex(e,t,s,o)}else if(Ke(e)){let s=n==null?Bb:n;this.$_updateEdge(e,t,s,o)}else if(H(e)){let s=n==null?xd:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=ot(n||e.geometry),e.geometry=ot(t),this.fire(Jn,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.L(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new il(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===de||e.constructor===pe||e.constructor===le||e.constructor===Fe?e:z(e)||hr(e)?this.graph.getVertex(e):null}Jo(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.L(l=>{l.$select(a)}),this.fire(ur,a))})}lE(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 m;Ke(h)?m=[h]:m=t(h),e.filter&&(m=m.filter(e.filter));for(let g=0;g<m.length;g++){let E=d&&h===this.graph||m[g].source===h||n&&H(m[g].source)&&m[g].source.getParent()===h,y=u&&h===this.graph||m[g].target===h||n&&H(m[g].target)&&m[g].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(m[g])}}};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}Sd(e,t){let n=t.objectType===Fe.objectType?this.edgeTypeProperty:t.objectType===pe.objectType?this.portTypeProperty:this.typeProperty;if(t.data[n]!=null&&t.data[n]!==e[n]){let o=t.data[n],s=e[n];t.type=o,this.$dispatchTypeChange(t,s,o)}}Ad(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===pe.objectType?e.getFullId():e.id,h=e.objectType===pe.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let p in t)Gm(e.data,p,t[p]);e.objectType===pe.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.Zo(e.getParent(),xd))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.L(p=>p.$vertexUpdated(u)),this.Sd(a,e),this.fire(o,u,null)}}Zo(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.Da)){let o=Y(e)?Re:Ve,s={vertex:e,updates:{},originalData:e.data,reason:t};this.L(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.lE(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(Ke)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.yi(e);this.Jo(t,!1,this.pe,!0)}select(e,t){let n=this.ko(),o=this.yi(e),s=this.Jo(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(K(l||Y(l)||H(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Td(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.Td(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.ko();if(o.obj&&o.obj.objectType===de.objectType){t&&this.Jo(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Td(o.obj,s,n,a)}return s}yi(e){return e instanceof il||e instanceof mr?e:z(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>z(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.yi(e);if(t){let n=this.Jo(t,!0,this.pe,!1);n[1]!=null&&n[1].length>0&&this.xi(!1,n[1]),n[0]!=null&&n[0].length>0&&this.xi(!0,n[0])}}xi(e,t){let n=e?ur:pr;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.pe};this.L(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.yi(e);if(t){let n=[],o=this.pe.toggle(t,(s,a)=>{a||n.push(s)});this.xi(!1,o[1]),this.xi(!1,n),this.xi(!0,o[0])}}removeFromSelection(e){let t=this.yi(e);t&&this.pe.remove(t,n=>{let o={obj:n,selection:this.pe};this.L(s=>{s.$deselect(o)}),this.fire(pr,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.pe.clear()}getSelection(){return this.pe}setMaxSelectedNodes(e){this.pe.setMaxNodes(e)}setMaxSelectedEdges(e){this.pe.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.pe.setCapacityPolicy(e)}cE(e){this.fire(e),this.Da=!1}vd(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(m){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=m=>{e.incremental===!1&&this.clear(),this.Da=!0,t===Eo?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.L(g=>g.$dataLoadStart())):t===Eg&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.L(g=>g.$dataAppendStart())),this.fire(t),Tx(o,m,this,d),this.cE(n),h&&h(this,m),this.fire(kx),n===Mr?(this.L(g=>g.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===fg&&(this.L(g=>g.$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 m=o===zt||o===km?zt:e.dataType,g=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:m,error:u,headers:g})}return this}load(e){return this.vd(e,Eo,Mr)}append(e){return this.vd(e,Eg,fg)}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||{},Wm(e.type||zt,this,e.parameters)}toJSON(){return Wm(zt,this,{})}getRenderer(e){return this.Jt.get(e)}getRenderers(){return this.Jt}L(e,t){this.Jt.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||V(),this.Jt.set(t,e),e.id=t,e.onDestroy(n=>{this.Jt.delete(n.id)}),this.fire(Zx,{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(Jx,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(Kx,{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 Og}$_deriveEdgeId(e){return e==null?V():typeof e=="string"?e:this.edgeIdFunction(e)||V()}};var vN="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 Rg=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}Cd(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.Cd(e=>r(e))}readRecords(r){this.Cd(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)})}},Xb=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new Rg(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 jb(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function KO(i,r){return r?i:i.toLowerCase()}function CN(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=bt(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 PN=CN;function ON(i){return i=bt(i),[{token:i.replace(/\s/g,"_"),context:i}]}function qO(i){return[{token:bt(i),context:i}]}function _N(i,r){return i.score>r.score?-1:1}var RN=i=>i.id;function LN(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 wN=10,yl=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,"Od",0);c(this,"bi",new Map);c(this,"Gr",[]);c(this,"Ko",0);c(this,"Le",{});r=r||{},this.fields=r.fields,this.root=this.Ma(),this.tokenizer=r.tokenizer||PN,this.searchTokenizer=r.searchTokenizer||qO,this.limit=r.limit||wN,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||RN,this.sorter=r.sorter||_N}Ma(r){return{index:this.Od++,children:{},documentIds:{},key:r}}hE(r,e,t){let n=this.Le[r];n||(n={},this.Le[r]=n),n[e.index]=e}dE(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.Ma(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.hE(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);LN(this.Gr,{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.bi.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.dE(KO(l[h].token,this.caseSensitive),o,l[h].context)}}),this.Ko++};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.Le[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.Gr.length;n++)if(this.idFunction(this.Gr[n].document)===e){o=n;break}o!==-1&&(this.Gr.splice(o,1),this.Ko=this.Gr.length),this.bi.delete(e)}clear(){this.bi.clear(),this.Le={},this.Od=0,this.Gr.length=0,this.Ko=0,this.root=this.Ma()}getDocumentCount(){return this.Ko}getDocumentList(){return this.Gr}getDocument(r){return this.bi.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let m=n[d];m||(m={},n[d]=m,s[d]=0,a[d]=[]),a[d].push(p),m[u]||(m[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let g in d.documentIds)if(d.documentIds.hasOwnProperty(g)){let E=d.documentIds[g];for(let y=0;y<E.length;y++)l(g,p,E[y])}return}let m=p[u];d.children[m]&&h(d.children[m],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,KO(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.bi.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},Hb=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new yl(e),this.groupIndex=new yl(e),this.edgeIndex=new yl(e),this.portIndex=new yl(e),r.bind(Ht,t=>{this.Pd(t.node)}),r.bind(Le,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Ve,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(Xt,t=>{this._d(t.group)}),r.bind(Me,t=>{this.groupIndex.remove(t.group.data)}),r.bind(Re,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(dr,t=>{this.Rd(t.edge)}),r.bind(mt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(pt,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(Wn,t=>{this.portIndex.add(t.port.data)}),r.bind(Vr,t=>{this.portIndex.remove(t.port.data)}),r.bind(cr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(jt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.Pd(n)}),this.instance.eachGroup((t,n)=>{this._d(n)}),this.instance.eachEdge((t,n)=>{this.Rd(n)})}Pd(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}_d(r){this.groupIndex.add(r.data)}Rd(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 kb="context",Lg="lookup",Wb="default",Kn="element",Ri="text",bo="tmpl",qn="each",xl="if",Zb="root",Jb="class",Kb="style",Ao="$value",bl="$key",qb="attribute";function wg(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return hx(e)}}function eA(i){return i.length>0?i[i.length-1]:null}function tA(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 Dg(i,r,e,t,n){let o=V(),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 Qb(i,r,e,t,n){e.atts[i]=r,Dg(i,r,e,t,n)}function rA(i,r){let e=wg(i,r.attributesRe),t={el:bt(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?Qb(o,"",t,s,r):Qb(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=bt(e[o]);s!=null&&s.length>0&&n(s)}return t}var DN=["*","-","+","/","%"],QO=["==",">","<",">=","<=","===","!=","!==","||"],NN=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Sd="bool",e_="num",t_="group",r_="var",IN="op",nA="comp",n_="exp",i_="string",o_="array",s_="key",a_="value";function MN(i){return i[i.length-1]}function l_(i){return i.t===t_}function VN(i){return i.t===r_}function GN(i){return i.t===n_}function $N(i){return i.t===e_}function BN(i){return i.t===Sd}function FN(i){return i.t===i_}function UN(i){return i.t===o_}function YN(i){return i.t===s_}function zN(i){return i.t===a_}function h_(i){let r=i.match(NN),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=MN(t);if(e==="("){let s={t:t_,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:o_,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:s_,v:null});else if(e.match(/\$value/))o.c.push({t:a_,v:null});else if(e.match(/^#/))o.c.push({t:n_,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:i_,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Sd,v:!0});else if(e.match(/false/))o.c.push({t:Sd,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:e_,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:r_,v:e}):DN.indexOf(e)!==-1?o.c.push({t:IN,v:e}):QO.indexOf(e)!==-1?o.c.push({t:nA,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Sd,v:!1}),o.c.push({t:nA,v:"=="})):(o.c.push({t:Sd,v:!1}),o.c.push({t:nA,v:"!=="})))}return t[0]}function XN(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(QO.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=>(l_(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,m;for(let g=1;g<l.length;g+=2)m=l[g],(m.v==="+"||m.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,m],v:null},h.push(p)):p.c.push(u,m):(p!=null?p.c.push(u):h.push(u),p=null,h.push(m)),u=o(l[g+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 Al(i){let r=h_(i);return XN(r)}function Li(i,r,e,t,n){let o=Ng(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=Ng(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 Ng(i,r,e,t,n){let o=i.map(l=>l_(l)?Ng(l.c,r,e,t,n):VN(l)?r(l.v):GN(l)?e(l.v):UN(l)?r(Ao)[l.index]:YN(l)?r(bl):zN(l)?r(Ao):$N(l)||FN(l)||BN(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 wi=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=V(),r.entries[this.uuid]=this,this.compiledBindings={}}Ld(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:V(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Al(a),once:s,format:l}})})}}};var Ig=class Ig extends wi{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:V(),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.Ld({[Ig.TEXT_BINDING_NAME]:n})}};c(Ig,"TEXT_BINDING_NAME","__element");var Di=Ig;var Mg=class Mg extends wi{constructor(e,t){super(t);c(this,"type",Mg.type);c(this,"comment");this.comment=e}};c(Mg,"type","comment");var Bs=Mg;var Vg=class Vg extends wi{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",Vg.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.Ld(e.bindings),this.remove=!1}};c(Vg,"type",Kn);var Ur=Vg;var iA={},Qn={construct:(i,r,e,t,n,o)=>{let s=iA[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{iA[i]=r},exists:i=>iA[i]!=null};var Gg=class Gg extends Ur{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",qn);this.context=e.atts.in,this.key=e.atts.key,this.tag=Gg.tag}};c(Gg,"tag","r-each");var Td=Gg;Qn.register(Td.tag,Td);function $g(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function oA(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];$g(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[xe]=this.wd(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}wd(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(xe);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[xe];{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.wd(n);return this.Dd(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[xe]}}Dd(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.Dd(r.children[n],e);r.children=t}};function c_(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function jN(i,r){i.el.nodeValue=r}function HN(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...Cd(i,r.children[t]));return e}function Cd(i,r){let e=HN(i,r);return r.type===Kn?(i.removeElement(r.el),e.unshift(r.el)):r.type===Ri?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===qn&&(r.entryMap={}),e}function d_(i,r,e,t){for(let n in i.bindings)if(n!==Jb){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=Li(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===Kn?n!==Kb?c_(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);c_(i,u,h.substring(d+1),!0)}):i.type===Ri&&jN(i,a))}}function u_(){return{added:[],removed:[],elements:[]}}var Bg=class Bg extends Ur{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",Bg.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Al(this.test)}};c(Bg,"tag","r-if");var Pd=Bg;Qn.register(Pd.tag,Pd);function Fg(i,r,e,t,n){return i.resolution=Li(i.entry.expression,o=>Pe(r,o),o=>e(o),t,n),i.resolution}var So=class extends Ur{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[kb],this.type=bo,this.remove=!0,e.atts[Lg])this.lookup=e.atts[Lg],this.default=e.atts[Wb]||"";else{this.templateId=e.atts.id;let a=tA(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(So,"tag","r-tmpl"),Qn.register(So.tag,So);function p_(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(hr(i)){let e=i;for(let t in e)r(e[t],t)}}var To=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,"Tt",new Map);c(this,"Ai",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,"qo");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.qo=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Nd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.qo[r]!=null?this.qo[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.Tt.clear(),this.Ai.clear()}parseAttributes(r){return wg(r,this.attributesRe)}Id(r,e){return t=>{let n=e?null:this.Tt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Tt.set(t,n),n}}getTemplate(r){return this.Ai.get(r)}addTemplate(r,e){this.qo[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.Ai.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.Ai.get(r);if(n==null||t===!0){e=this.Id(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=m_(this,o,e,null,[r]);return this.Ai.set(r,s),s}}else return n}data(r,e,t){return Pe(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?Pe(e,t.substring(9)):Pe(r,t)}update(r,e,t){let n=r.$recado,o=u_();return t=t||{},n!=null&&this.xn(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}xn(r,e,t,n,o){if(r.type===Zb)for(let s=0;s<r.children.length;s++)this.xn(r.children[s],e,t,n,o);else if(r.type===Kn||r.type===Ri){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),d_(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Si(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.xn(r.children[l],s,t,n,o)}else if(r.type===xl){let s=r,a=s.resolution,l=Fg(s,e,h=>this.Si(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)Cd(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.xn(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===bo){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.xn(r.children[a],s,t,n)}else if(r.type===qn){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)Cd(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=[];p_(a,(u,p)=>{let m=Pe(u,s.entry.key);if(l[m]=u,s.entryMap[m]!=null){let g=s.entryMap[m];for(let E=0;E<g.length;E++)h.push({data:u,key:m,execution:g[E]})}else h.push({data:u,key:m})});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],Cd(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.xn(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(m=>{m.el!=null&&s.placeholder.before(m.el)});else{let m=this.render(r.entry.children,p.data,null,n);oA(s,m,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 m_(this,r,e,t,n)}Si(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:V(),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(`${qn}:${b}`),entryMap:{},type:qn,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${bo}:${b}`),entry:f,id:b,children:[],type:bo};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:V(),entry:b,bindings:A,children:[],el:f,type:Kn};return h.children.push(S),f.$recado=S,S},m=(f,b,A,T)=>{y(f,T);let S={id:V(),el:f,entry:b,bindings:A,children:[],type:Ri};return h.children.push(S),f.$recado=S,S},g=(f,b,A)=>{let T=V(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${xl}:${T}`),type:xl,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,R=null;if(f.type===xl){let v=h,O=g(f,A,o);if(h=O,S=Fg(O,b,P=>this.Si(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,O.placeholder,T);h=v,R=O}else if(f.type===qn){let v=f,O=l,P=f.context===Ao?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=V(),_=d(v,C,A);h=_,P!=null&&p_(P,(w,B)=>{let D=v.key&&hr(w)?Pe(w,v.key):B||null;for(let M=0;M<f.children.length;M++){let N=x(f.children[M],w,_.placeholder,B);D!=null&&$g(_,D,N)}}),l=O,h=I,R=_}else if(f.type===bo){let v=f,O=l,P=h,I=V(),C=u(v,I,A);h=C;let _=f.context==null||f.context.length===0?b:Pe(b,f.context),w=v.lookup!=null?Pe(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 D=0;D<B.length;D++)x(B[D],_,C.placeholder,T);l=O,h=P,R=C}else if(f.type===Kn){let v,O=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let D=Object.assign({},b);Object.assign(D,P.decorator(b,n)||{});let M=this.render(P.getAST(D),D,t,n,P.defaultNamespace);v=M.fragment.childNodes[0];let N=M.children[0].bindings;for(let G in N)I[G]=N[G];C.push(...M.children[0].children)}else if(O.namespace!=null&&this.namespaceHandlers[O.namespace])v=this.namespaceHandlers[O.namespace](f.tag);else{let D=o||this.defaultNamespace;D!=null&&this.namespaceHandlers[D]?v=this.namespaceHandlers[D](`${D}:${f.tag}`):v=this.ce(f.tag)}for(let D in O.atts)if(O.atts.hasOwnProperty(D)){let M=O.atts[D];if(f.compiledBindings[D]!=null){let N=f.compiledBindings[D];I[D]={id:N.id,binding:N,results:[],originalValue:M,type:qb};for(let G=0;G<N.expressions.length;G++){let J=N.expressions[G],ye=Li(J.expression,j=>j===bl?T:j===Ao?b:this.lookupValueInDataOrContext(b,n,j),j=>this.Si(j,b,n),J.format,this.formatter);M=M.replace(J.source,ye),I[D].results.push({source:J.source,result:ye})}}this.setAttribute(v,D,M)}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 _=l,w=h,B=p(v,O,I,A);B.children.push(...C),h=B,l=v;for(let D=0;D<f.children.length;D++)x(f.children[D],b,null,T);h=w,l=_,R=B}else if(f.type===Ri){let v=f.value||"",O={},P=f.compiledBindings[Di.TEXT_BINDING_NAME];if(P!=null){O[Di.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:Ri};for(let _=0;_<P.expressions.length;_++){let w=P.expressions[_],B=Li(w.expression,D=>D===bl?T:D===Ao?b:this.lookupValueInDataOrContext(b,n,D),D=>this.Si(D,b,n),w.format,this.formatter);v=v.replace(w.source,B),O[Di.TEXT_BINDING_NAME].results.push({source:w.source,result:B})}}let I=this.ctn(v);R=m(I,f,O,A)}return R};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function kN(i){return Qn.exists(i)}function WN(i,r,e,t,n,o){return Qn.construct(r,e,i,t,n,o)}function m_(i,r,e,t,n){n=n||[],e=i.Id(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},m=(E,y,x,f)=>{let b=rA(E,i);return kN(b.el)?WN(i,b.el,b,x,o,n):new Ur(b,i,x,o,n)},g=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new Bs(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=m(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==So.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=m(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Di({value:E},f);u(A),E.match(/^[\s]*$/)!=null||Dg(Di.TEXT_BINDING_NAME,E,A,null,f)}}];if(cx(bt(r).split(i.tokenizerRe),(E,y)=>{let x=bt(y);for(let f=0;f<g.length;f++){let b=a(x,g[f].re);if(b){g[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 sA(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 Od=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}},Ug=class extends Od{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)}},Yg=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},zg=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var Xg=class extends To{Nd(){return null}ce(r){return new Ug(r)}cf(){return new Od}ctn(r){return new Yg(r)}cc(r){return new zg(r)}removeElement(r){}removeTextNode(r){}};function _d(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function jg(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function aA(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 Rd(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 m=u.edge.pathDirection,g=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=m===1?E+1:E-1,f=g===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=m===1?E-1:E+1,S=g===1?y-1:y+1,R=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,O=l.axis===0?Q:Ee,P=b?b.midpoint[O]:R?R.midpoint[O]:p.edge.sourceCenter[O]!==u.edge.sourceCenter[O]?u.edge.sourceCenter[O]:u.edge.targetCenter[O],I=b?A.midpoint[O]:v?v.midpoint[O]:u.edge.sourceCenter[O]!==p.edge.sourceCenter[O]?p.edge.sourceCenter[O]:p.edge.targetCenter[O];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 Ld(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,m=s.axis===0?l===1?u.height:0:l===1?u.width:0,g=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+g,[x]:p},b={[y]:d.location+E,[x]:m};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var wd="separate",ZN="bus";function lA(i){let r=i.axis,e=i.gates,t=i.gateMap||_d(e),n=i.mode||wd,o=i.regions,s=i.edges,a=i.pad||10,l={};Rd(s,e,t,i.getVertexPosition,i.getVertexSize),Ld(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(aA(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=jg(f,r),T=jg(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,m=r===0?o[h].left:o[h].top,g=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===wd)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]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}],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]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let m=p.edgeMap[d.id];l[d.id].push(...m)})}return l}function hA(i){let r=i.gates,e=_d(r),t=i.regions,n=i.edges,o={};Rd(n,r,e,i.getVertexPosition,i.getVertexSize),Ld(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 cA=4;function g_(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var Fs={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=g_(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=g_(s),Fs.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),Fs.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 E_(i){return i.height*i.width}function Hg(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 kg(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&&kg(i.parent)}function dA(i,r){return i.x===1/0?E_(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))-E_(i)}function Wg(i){let r=Math.floor(i.children.length/2),e=vo(),t=vo();return Fs.sortRect(i.children).forEach((n,o)=>{o<=r?Co(e,n):Co(t,n)}),i.children.length=0,[e,t]}function vo(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Dd(i){return i.children==null||i.children.length===0}function uA(i){return Dd(i)||Dd(i.children[0])}function Co(i,r){r.parent=i,i.children.push(r),Hg(i,r)}function Zg(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function f_(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(f_(e)):r.concat(e)},[])}function pA(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function y_(i){i.parent&&(Zg(i.parent,i),kg(i.parent))}var Us=class{constructor(r){c(this,"Wt");c(this,"ee");c(this,"bn",{});this.Wt=r||cA,this.ee=vo()}search(r,e){let t=[];return this.Md(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.Md(r,(n,o)=>t.push({node:n,overlap:_m(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}Md(r,e,t){if(this.ee.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(ke(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(ke(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&_m(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.ee)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{rx(r,o)&&(Dd(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.ee),t}insert(r){let e=n=>{let o=this.ee;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.bn[n.id]=s);!uA(o);)Hg(o,s),o=pA(o.children,a=>dA(a,s));Co(o,s),this.uE(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}uE(r){let e=r;for(;e.parent&&e.parent.children.length>this.Wt;)e=e.parent,e!=this.ee?(Zg(e.parent,e),Wg(e).forEach(t=>{Co(e.parent,t)})):e==this.ee&&Wg(e).forEach(t=>{Co(e,t)})}Vd(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.Wt),n=[],o=0,s;for(let a=0;a<t;a++){s=vo(),o=Math.min(this.Wt,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.bn[h.id]=h),Co(s,h)}n.push(s)}return t>1?this.Vd(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=Fs.sortRect(r);this.ee=this.Vd(e)[0]||vo()}}getBounds(){return{x:this.ee.x,y:this.ee.y,width:this.ee.width,height:this.ee.height}}getExtents(){return{xmin:this.ee.x,ymin:this.ee.y,xmax:this.ee.x+this.ee.width,ymax:this.ee.y+this.ee.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.Gd(e),e}Gd(r,e){let t=[],n=r.parent;for(y_(r),r.id!=null&&delete this.bn[r.id];n!=null&&n!==this.ee;)n.children.length<=this.Wt/2&&(y_(n),t.push(...this.pE(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.bn[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.Gd(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.ee=vo(),this.bn={}}getLeafNodes(){return Object.values(this.bn)}pE(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Nd=class i{constructor(r){this.instance=r;c(this,"se",[]);c(this,"K",[]);c(this,"q",[])}static from(r){let e=new i(r.instance);return e.se=r.se.slice(),e.K=r.K.slice(),e.q=r.q.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.mE(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,Ax,null))}),s}mE(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(g){let E=r.getCoordinates(g,!0);u.set(g.id,E),g.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.K.forEach(p),this.se.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 m=(g,E,y)=>{y=y||0;let x=Object.assign({},g.data),f=V();if(o.vertexMap.set(g.getFullId(),f),x.id=f,E==null){let b=u.get(g.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x.group!=null&&delete x.group}else x.group=E.id;return!n&&Y(g)&&g.getMembers().forEach(b=>{let A=m(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.se.forEach(g=>o.nodes.push(m(g,null,0)[0])),this.K.forEach(g=>s.push(m(g,null,0))),s.sort((g,E)=>g[1]<E[1]?-1:1),o.groups=s.map(g=>g[0]),this.q.forEach(g=>{let E,y,x=g.source,f=H(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=g.target,T=H(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 R={source:E,target:y,data:Object.assign({},g.data||{})};if(R.data.id!=null){let v=V();o.edgeMap.set(R.data.id,v),R.data.id=v}g.geometry!=null&&S!=null&&b!=null&&(R.geometry=r.transformGeometry(g,o.transform.x,o.transform.y)),o.edges.push(R)}),o}};var Id=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Nd.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 Jg="Anchor",Et="top",Tt="left",vt="right",Ct="bottom",Ni={[Et]:{x:0,y:-1},[Ct]:{x:0,y:1},[vt]:{x:1,y:0},[Tt]:{x:-1,y:0}},JN=[Tt,vt],KN=[Et,Ct],qN={[Et]:[Tt,vt],[Ct]:[Tt,vt],[Tt]:[Ct,Et],[vt]:[Ct,Et]},QN={[Et]:Ct,[Ct]:Et,[Tt]:vt,[vt]:Tt},x_=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(x_||{}),Md=(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))(Md||{});var Cn={};function Ys(i,r){Cn[i]=r}var gr={lineIntersection(i,r,e,t,n){return Cn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return Cn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return Cn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return Cn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return Cn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return Cn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return Cn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return Cn[i.type].getPath(i,r)}};function Kg(i){return Cn[i.type].getLength(i)}function mA(i,r){return Cn[i].create(r)}function eI(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function gA(i,r,e){return eI()}function EA(i,r,e,t,n){return[]}function Sl(i,r,e,t,n){let o=[];return o.push.apply(o,gr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,gr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,gr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,gr.lineIntersection(i,r,e+n,r,e)),o}function fA(i,r){return Sl(i,r.x,r.y,r.width,r.height)}function zs(i){return Object.assign({extents:yi()},i)}function b_(){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:Q,stubs:[0,0]}}function Xs(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 Vd(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:yi(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:b_()}}function qg(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 yA=.45,A_=62;function Gd(i,r,e){let t=Vd(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||A_,isLoopbackCurrently:!1,constrain:en,smooth:!0})}var ei={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})},S_=64,tI=Math.pow(2,-S_-1);function C_(i,r){let e=[],t=rI(i,r),n=r.length-1,o=2*n-1,s=xA(t,o,e,0),a=ei.subtract(i,r[0]),l=ei.square(a),h=0,d;for(let u=0;u<s;u++)a=ei.subtract(i,bA(r,n,e[u],null,null)),d=ei.square(a),d<l&&(l=d,h=e[u]);return a=ei.subtract(i,r[n]),d=ei.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function TA(i,r){let e=C_(i,r);return{point:bA(r,r.length-1,e.location,null,null),location:e.location}}function rI(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]=ei.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=ei.subtract(r[u+1],r[u]),o[u]=ei.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]=ei.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),m=Math.min(u,h);for(let g=p;g<=m;g++){let E=u-g;a[g+E].y+=s[E][g]*l[E][g]}}return a}function xA(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(nI(i,r)){case 0:return 0;case 1:{if(t>=S_)return e[0]=(i[0].x+i[r].x)/2,1;if(iI(i,r))return e[0]=oI(i,r),1;break}}bA(i,r,.5,n,o),s=xA(n,r,l,t+1),a=xA(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 nI(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 iI(i,r){let e,t,n,o,s,a,l,h,d,u,p,m,g,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,m=1,g=0,E=a,y=l,x=h-f,d=p*y-E*m,u=1/d,t=(m*x-y*g)*u,E=a,y=l,x=h-b,d=p*y-E*m,u=1/d,n=(m*x-y*g)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<tI?1:0}function oI(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 bA(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 sI(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(aI(t/i,r));return e}function aI(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 vA(i){let r=0;if(!SA(i)){let t=sI(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=AA(o,s)}}return r}var T_=new Map;function lI(i){let r=T_.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()),T_.set(i,r)}return r}function js(i,r){let e=lI(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 AA(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function SA(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function $d(i,r,e){if(SA(i))return{point:i[0],location:r};let t=js(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=js(i,o),n+=AA(a,t),t=a;return{point:a,location:o}}function CA(i,r,e){return $d(i,r,e).point}function PA(i,r,e){return $d(i,r,e).location}function Bd(i,r){let e=js(i,r),t=js(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 hI(i,r,e){let t=$d(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Bd(i,t.location)}function cI(i,r,e,t){t=t==null?0:t;let n=$d(i,r,t),o=Bd(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 Pn(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=pI(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=mI.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let m=d[p],g=Math.pow(m,2),E=Math.pow(m,3),y={x:l[0][0]*E+l[0][1]*g+l[0][2]*m+l[0][3],y:l[1][0]*E+l[1][1]*g+l[1][2]*m+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),m>=0&&m<=1&&x>=0&&x<=1&&u.push(y)}return u}function dI(i,r,e,t,n){let o=[];return o.push.apply(o,Pn(i,r,i+e,r,n)),o.push.apply(o,Pn(i+e,r,i+e,r+t,n)),o.push.apply(o,Pn(i+e,r+t,i,r+t,n)),o.push.apply(o,Pn(i,r+t,i,r,n)),o}function uI(i,r){let e=[];return e.push.apply(e,Pn(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Pn(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Pn(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Pn(i.x,i.y+i.height,i.x,i.y,r)),e}function v_(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 pI(i){return[v_(i,"x"),v_(i,"y")]}function mI(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 m=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(m/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((m+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((m+4*Math.PI)/3)-n/3}for(let m=0;m<3;m++)(p[m]<0||p[m]>1)&&(p[m]=-1);return p}var Po="Bezier";function OA(i,r,e){return e&&(r=PA(i,r>0?0:1,r)),r}var P_={create(i){let r=zs(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:Po})},boundingBoxIntersection(i,r){return fA(i,r)},boxIntersection(i,r,e,t,n){return Sl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=TA({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=vA(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=OA(i.curve,r,e),Bd(i.curve,r)},lineIntersection(i,r,e,t,n){return Pn(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=OA(i.curve,r,t),CA(i.curve,r,e)},pointOnPath(i,r,e){return r=OA(i.curve,r,e),js(i.curve,r)}};Ys(Po,P_);var Fd={};function gI(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 O_(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 EI(i){return!i.source||!i.target||!O_(i.source)||!O_(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!gI(r))==null}var Yr=i=>ot(i.geometry),Ne={get:(i,r,e)=>{let t=Fd[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{Fd[i]=r},compute:(i,r,e)=>{let t=Fd[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=Fd[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},markEdited(i,r){r=r||Yr(i.connector),i.connector.edited=!0,i.edge.geometry=r,Ne.$_setAnchorsFromGeometry(i,r)},importGeometry(i,r){if(EI(r)){let e=i.connector;e.geometry=ot(r),e.edited=!0,Ne.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){qg(r.source,i,0),qg(r.target,i,1)},transformGeometry(i,r,e,t){let n=Fd[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=ot(r),e||(t.edited=!0,i.edge.geometry=Yr(t))}}};function fI(i){return i.geometry}function yI(i,r){return i.geometry=r,!0}function R_(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 eE(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function zr(i,r,e){if(e.x1===e.x2&&e.y1===e.y2)return;let t=mA(r,e);i.internalSegments.push(t),i.totalLength+=Kg(t),R_(i,t)}function Qg(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 Xr(i,r,e){let t=Qg(i,r,e);return t.segment&&gr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function xI(i,r,e){let t=Qg(i,r,e);return t.segment&&gr.gradientAtPoint(t.segment,t.proportion,!1)||0}function rt(i,r,e,t){let n=Qg(i,r,t);return n.segment&&gr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function tE(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=Kg(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function __(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function rE(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),m=Math.abs(o-n),g=!__(r.sourcePos),E=!__(r.targetPos);if(g||E){let S=p>m,R=S?e:n,v=S?t:o,O=R>v?-1:1,P=R>v?1:-1;g&&(l.x=S?O:0,l.y=S?0:O),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:m,quadrant:ps({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?Ee:Q,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function bI(i,r){let e=i.connector;e.paintInfo=rE(e,r),eE(e),Ne.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,tE(e)}function Ii(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 _A(i){i.bounds=yi()}function RA(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=gr.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 AI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,gr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function SI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,gr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function LA(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,gr.boundingBoxIntersection(i.internalSegments[t],r));return e}function TI(i){return i.typeDescriptor==="connector"}function wA(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=gr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function vI(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,m,g;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;m={x:E,y},g={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;m={x:r.sx+x,y:r.sy+f},g={x:r.tx+b,y:r.ty+A}}return[m,g]}function CI(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]=vI(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 L_(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function PI(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,m=(l+d)/2,g=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=OI(p,m,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,g,i.proximityLimit),[u,u]}function OI(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 w_(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function Ud(i,r,e,t,n){let o=i.connector,s,a;o.type===Oo?[s,a]=w_(o):[s,a]=L_(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,Po,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Yd(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===Oo?t.edited?[l,h]=w_(t):[l,h]=CI(t,r,e,n,o,s,a):t.edited?[l,h]=L_(t):[l,h]=PI(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,Po,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function zd(i,r,e){return{source:Xs(i.source,r,e),target:Xs(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 Oo="Bezier";function D_(i,r){let e=Gd(Oo,i,r);return Object.assign(e,{scale:r.scale||yA})}Ne.register(Oo,{compute:Yd,update:Ud,create:D_,transformGeometry:zd});var Xd="QuadraticBezier";function N_(i,r){let e=Gd(Xd,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",Vb:{x:0,y:0}})}Ne.register(Xd,{compute:Yd,update:Ud,create:N_,transformGeometry:zd});var nE="perpendicular",iE="orthogonal",oE="opposite",Hs="Orthogonal",DA="Smooth",NA=30;function Tl(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 IA(i,r,e){return jd(r,"h",e,1)}function MA(i,r,e){return jd(r,"h",e,-1)}function VA(i,r,e){return jd(r,"v",e,1)}function GA(i,r,e){return jd(r,"v",e,-1)}function jd(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 Hd(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 kd(i,r,e,t){let n=i.indexOf(t),o=Hd(i,r,e,t);return o&&o[1]==n+r?o:null}function _o(i){return{[ne]:Math.sign(i.x2-i.x1),[he]:Math.sign(i.y2-i.y1)}}function _I(i){return[Math.sign(i.x2-i.x1),Math.sign(i.y2-i.y1)]}function sE(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?he:ne;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function $A(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(Tl(t.x2,i[0].x1,i[0].x2)||lr(o,r).length>0){let a=VA(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:he}),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:he}),a.segment.y1=h}}}}else if(t.o===he&&(Tl(t.y2,i[0].y1,i[0].y2)||lr(o,r).length>0)){let a=IA(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 BA(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(Tl(n.x1,a.x1,a.x2)||lr(s,r).length>0){let h=GA(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(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:he}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:he}),h.segment.y2=u}}}}else if(n.o===he&&(Tl(n.y1,a.y1,a.y2)||lr(s,r).length>0)){let h=MA(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(m=>{m.x1=u,m.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(m=>{m.x1=u,m.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 FA(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=BA(r,t,i.targetStub),s=$A(r,e,i.sourceStub)):(s=$A(r,e,i.sourceStub),o=BA(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var On="Straight";function ti(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function aE(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function lE(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var Ro={create(i){let r=zs(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:On})},boundingBoxIntersection(i,r){return Ro.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,Ro.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,Ro.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,Ro.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,Ro.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=aE(i.x1,i.x2,r)?r:lE(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=aE(i.y1,i.y2,e)?e:lE(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=aE(i.x1,i.x2,a)?a:lE(i.x1,i.x2,a),t.y=aE(i.y1,i.y2,l)?l:lE(i.y1,i.y2,l)}let n=Be({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Be({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)ti(r,i.x1,i.x2)&&ti(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)ti(e,i.y1,i.y2)&&ti(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,ti(d,i.x1,i.x2)&&(u=s*r+a,ti(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,ti(u,i.y1,i.y2)&&(d=(e-a)/s,ti(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,ti(d,i.x1,i.x2)&&ti(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=Ro.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),Ut(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 Ut({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};Ys(On,Ro);var I_=1e-10;function M_(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<I_?r:e-i<I_?e:i}var Cl="Arc";function V_(i,r,e,t){return tx({x:i,y:r},{x:e,y:t})}function RI(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+Ei:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+Ei:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var Wd={create(i){let r=zs(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=V_(e,t,r.x1,r.y1),a=V_(e,t,r.x2,r.y2)),a<0&&(a+=Ei),s<0&&(s+=Ei);let l=a<s?a+Ei:a,h=Math.abs(l-s);o&&(h=Ei-h);let d=2*Math.PI*n,u=h/Ei,p=d*u,m={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:m,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:Cl})},boundingBoxIntersection(i,r){return Wd.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return Sl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return gA(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=Wd.pointOnPath(i,r,e),n=ex({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 EA(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=Wd.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=RI(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:M_(n),y:M_(o),theta:t}}};Ys(Cl,Wd);var G_={x:[Q,Ee],y:[Ee,Q]};function $_(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var Pl=new Map;Pl.set(nE,$_),Pl.set(iE,$_),Pl.set(oE,(i,r)=>{let e=i,t=e.sourceAxis,n={[Q]: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)},[Ee]: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]()?{[Q]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[Ee]:[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 Ol=new Map;Ol.set(nE,(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}]},m={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},g={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=G_[e][0],f=G_[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],R=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]&&R<S)return m[e];if(i.quadrant===v[2]&&R>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return g[e]}),Ol.set(iE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[Ee]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[Q]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[Ee]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),Ol.set(oE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:Ee,[Ee]:Q}[e],u=e===Q?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[Q]:De,[Ee]:Te}[e],m=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[Q]:[{x:t,y:m},{x:o,y:m}],[Ee]:[{x:m,y:t},{x:m,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[Q]:[{x:t,y:l},{x:o,y:l}],[Ee]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[Q]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[Ee]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function UA(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=Pl.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===Q?0:1,l=r.sourceAxis===Q?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 m=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,g=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=Ol.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,m,g,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 Zd(i,r){let e=r;return i.smooth===!0&&e.length>=2?DI(i,e).map(n=>zr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?LI(i,e):e.map(t=>zr(i,On,t)),i.$pathSegments=e,e}function YA(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function zA(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function LI(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=YA(e),o=YA(t),i.cornerRadius>0&&n!==o){let a=Math.min(zA(e),zA(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=tr({x:e.x1,y:e.y1},h,1e4),m=tr({x:t.x1,y:t.y1},d,1e4),g=Rm(p,m),E=g!=null?Be(g,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,zr(i,On,Object.assign({},e)),i.slightlyWonky?zr(i,Cl,Object.assign({r:l,cx:g.x,cy:g.y,ac:u>0},e)):zr(i,Cl,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:g.x,cy:g.y,ac:u>0})):zr(i,On,Object.assign({},e))}else zr(i,On,Object.assign({},e));e=t}t!=null&&zr(i,On,Object.assign({},e))}var wI=(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)}},B_=(i,r,e,t,n)=>{let a=wI(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 hE(i,r){let e=[];for(let t=1;t<i.length;t++){let n=B_(i[t-1],i[t-2],i[t],r),o=B_(i[t],i[t-1],i[t+1],r,!0);e.push({type:Po,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 DI(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}),hE(e,i.smoothing)}function F_(i,r,e){return cE([{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 Jd(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===tn?XA(s,a,o,r,e,t,n):NI(s,a,o,r.quadrant,t,n),Zd(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function Kd(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===tn?t.$pathSegments=UA(t,r,e):t.$pathSegments=F_(t,r,e),Zd(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function NI(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 qd(i,r,e){return{source:Xs(i.source,r,e),target:Xs(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 cE(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var U_=.15,_n="Straight";function ks(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}Ne.register(_n,{compute:Kd,update:Jd,create:jA,transformGeometry:qd});function II(i,r){let e=Object.assign(r,{constrain:tn});return jA(i,e)}Ne.register(Hs,{compute:Kd,update:Jd,create:II,transformGeometry:qd});function MI(i,r){let e=Object.assign(r,{constrain:en,smooth:!0});return jA(i,e)}Ne.register(DA,{compute:Kd,update:Jd,create:MI,transformGeometry:qd});function VI(i){return i==null?null:i===Cx?tn:i===Px?Oc:i}function jA(i,r){let e=VI(r.constrain);r.stub=r.stub==null?e===tn?NA:null:r.stub;let t=Vd(_n,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?U_:r.smoothing,geometry:{segments:[]},constrain:e==null?en:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function kA(i,r,e){HA(1,i,r,e),HA(0,i,r,e)}var Lo="x2",wo="x1",Do="y1",No="y2";function GI(i,r,e){let t=e===i.x1?{value:i.x2,coord:Lo,prev:!0}:{value:i.x1,coord:wo,prev:!0},n=e===r.x1?{value:r.x2,coord:Lo,prev:!1}:{value:r.x1,coord:wo,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 $I(i,r,e){let t=e===i.y1?{value:i.y2,coord:No,prev:!0}:{value:i.y1,coord:Do,prev:!0},n=e===r.y1?{value:r.y2,coord:No,prev:!1}:{value:r.y1,coord:Do,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 Y_(i,r){if(r.length<5)return r;function e(d,u,p){let m=p===d.x1?d.x2:d.x1,g=p===u.x1?u.x2:u.x1;if(m>u.x1&&u.x2>m||m>u.x2&&u.x1>m)return m;if(g>d.x1&&d.x2>g||g>d.x2&&d.x1>g)return g}function t(d,u,p){let m=p===d.y1?d.y2:d.y1,g=p===u.y1?u.y2:u.y1;if(m>u.y1&&u.y2>m||m>u.y2&&u.y1>m)return m;if(g>d.y1&&d.y2>g||g>d.y2&&d.y1>g)return g}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=_o(n)[n.o],o.o!==n.o)if(ks(o)<a){let p=r[d+1];if(_o(p)[p.o]!==s){let g=Object.assign({},o);if(o.o===he){let E=GI(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(g.x1=y,g.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,g]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[g,x]})}n=p,d+=1}else n=o}else if(o.o===ne){let E=$I(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(g.y1=y,g.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,g]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[g,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?dE(h):h}function HA(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?Lo:wo,p=i===1?No:Do,m=i===1?wo:Lo,g=i===1?Do:No,E=1,y=n.length-2,x=1,f=n[1];o[m]=l+a*d.x,o[g]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=_o(o),A=o.o,T=o.o===ne?he:ne,S=o.o===ne?[Lo,wo]:[No,Do],R=o.o===ne?[wo,Lo]:[Do,No],v=o.o===ne?[No,Do]:[Lo,wo],O=o.o===ne?[Do,No]:[wo,Lo],P=S[i],I=R[i],C=v[i],_=O[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[_]=o[C];let B=_o(f)[A],D=kd(n,x,T,f);if(B!==b[A]){if(D!=null){let M=kd(n,x,A,D[0]);if(M!=null)n.splice(E,1),M[0][I]=o[P],D[0][P]=o[P],D[0][I]=o[P],D[0][_]=o[C];else{let N=(D[0][C]+D[0][_])/2;D[0][_]=N,f[C]=f[_]=N;let G={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[_]:o[C],[I]:o[P]};n.splice(E,0,G)}}}else f[C]=f[_]=o[C],D!=null&&(D[0][_]=o[C])}else{f[_]=o[C],f[P]=f[I]=o[P];let B=kd(n,x,A,f);if(B!=null){let D=_o(B[0])[A];B[0][I]=o[P];let M=_o(B[0])[A];if(D!==M&&B[1]===y){n.splice(B[1],1);let N=(f[C]+f[_])/2;f[_]=N,f[P]=f[I]=s[I];let G={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[_]:N,[I]:o[P]};n.splice(E,0,G);let J={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[_]:o[C],[I]:o[P]};n.splice(E,0,J)}}else{let D=(f[C]+f[_])/2;f[_]=D,f[P]=f[I]=s[I];let M={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[_]:D,[I]:o[P]};n.splice(E,0,M);let N={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[_]:o[C],[I]:o[P]};n.splice(E,0,N)}}let w=Y_(r,n);i===1&&w.reverse(),r.$pathSegments=w}function XA(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(m=>{let g=Object.assign({},m);g.x1+=l,g.x2+=l,g.y1+=h,g.y2+=h,p.push(g)}),e.$pathSegments=p;return}kA(e,t,n)}}function BI(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?Hd(i,-1,n,o):null,right:e?Hd(i,1,n,o):null}}else return null}function WA(i,r,e,t,n){let o=BI(r.$pathSegments,e);if(o!=null){o.axis===he?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===he,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 m={o:ne,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),l++}else if(d.y1!==r.$pathSegments[0].y2){let m={o:he,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),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 m={o:ne,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}else if(d.y2!==p.y1){let m={o:he,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}if(n!==!0){let m=i.instance.getElement(i.sourceId),g=i.instance.getElement(i.targetId);FA(r,r.$pathSegments,m,g,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function dE(i){let r=[ot(i[0])],e=ot(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>ks(s)>0).map(ot);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?he:ne,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===ne?he: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 ZA(i){let r=dE(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}function FI(i,r,e){if(i.$pathSegments.length>=2){let t=r===0?i.$pathSegments[0]:i.$pathSegments[i.$pathSegments.length-1],n=e[0]===0?he:ne;t.o=n,i.edited=!0}}var Qd=class extends It{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(ul,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(ul,{key:e,value:t})}};var Mi=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Mi||{});var jr="px",Rn="50px",Pr="block",ht="none",UI=0,YI=1,je="absolute",uE="fixed",JA="static",KA="relative",qA="data-vjs-group",Pt="data-vjs-managed",_l="data-vjs-not-draggable",QA="data-vjs-elements-draggable",pE="tabindex",zI="overlays",ee="data-vjs-vertex",on="data-vjs-port",Rl="data-vjs-port-id",Hr="data-vjs-port-type",eu="data-vjs-edge-type",eS="data-vjs-source",Io="data-vjs-target",mE="data-vjs-allow-loopback",gE="data-vjs-source-port-id",tu="data-vjs-target-port-id",Ws="data-vjs-source-port",Mo="data-vjs-target-port",Vi="data-vjs-source-port-type",Gi="data-vjs-target-port-type",ru="data-vjs-magnet",Ze="data-vjs-edge",nu="data-vjs-overlay-id",Er="*";var Zs="vjs-connector",tS="vjs-connector-path",rS="vjs-connector-outline",nS="vjs-connector-transient",Ll="vjs-connected",EE="vjs-group-collapsed",fE="vjs-group-expanded",iu="vjs-toggle-group-collapse",Js="vjs-overlay",wl="vjs-overlay-hide",iS="vjs-label-overlay",$i="vjs-node",oS="vjs-port",Vo="vjs-group",sS="vjs-dummy-vertex",Dl="vjs-selected-connection",Bi="vjs-selected-element",Ks="vjs-edge-delete",ou="vjs-edge-delete-i";var yE="allowNestedGroups",Nl="anchor",Il="anchors",XI="astarGridCellSize",aS="astarVertexBorder",lS="astarVertexBuffer",jI="overlays",HI="edgesDetachable",su="connector",hS="cssClass",cS="edgeRelocateHandleSize",kI="ensureAnchorsInWhitespace",WI="groupSize",dS="hoverClass",au="hoverPaintStyle",uS="maxConnections",ZI="nodeSize",Go="paintStyle",JI="reattachEdges",xE="scope",pS=[.05,3];function mS(i){return i.type!=null&&i.options!=null}function ni(i){let r=null;return z(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||V(),r}var lu="always",Fi="hover";function bE(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 ri=class{constructor(r,e){this.component=r;c(this,"id");c(this,"cssClass");c(this,"Qo");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||V(),this.cssClass=e.cssClass||"",bE(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.Qo=r.instance.$isTouchDevice()?lu:e.visibility||lu,this.Qo===Fi&&(this.visible=!1)}},Ln=class extends ri{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 z_={},nt={get:(i,r,e,t)=>{let n=z_[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{z_[i]=r}};var AE=class AE extends ri{constructor(e,t,n){super(t,n);this.instance=e;this.component=t;c(this,"label");c(this,"type",AE.type);c(this,"useHTMLElement");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)}getLabel(){return Tr(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&&bE(this,e.location),SE(this,t)}};c(AE,"type","Label");var ir=AE;function kr(i){return i.type===ir.type}nt.register(ir.type,ir);function SE(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 TE="labelLocation",KI=[Nl,Il,"cssClass",su,Go,au],qI="parent";function hu(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[qI],p;if(Array.isArray(u)?p=u:p=[u],p.find(g=>d.indexOf(g)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(g=>e(g)).filter(g=>g!=null)}},n=(h,d,u)=>{let p=KI.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let m=gn(h,d,[],p);return o(t(h,u),m,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let m=0;m<h.length;m++)p=n(h[m],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 qs(i){return(r,e,t)=>{let n=yc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function gS(i){i.anchorPositions!=null&&(i.anchorPositionFinder=qs(i.anchorPositions))}var cu=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.component,edge:d.overlay.component.edge,model:d.overlay.component.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(mS(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=hu([r,xe],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:ir.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||TE;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||Ks)+" "+ou,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:ir.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===Fi?Fi:lu}})})}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=hu([r,xe],this.nodes);return delete e.parent,gS(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=hu([r,xe],this.ports);return delete e.parent,gS(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=hu([r,xe],this.groups);return delete e.parent,gS(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(K(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(H(r))return this.getPortDefinition(e)}};function du(){return{c:new Set,e:new Set}}var X_=class{constructor(){c(this,"affectedElements",new Set)}};function H_(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 QI(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)=>xt({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),m=d(r+t,e+n),g=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,m.x,g.x),x=Math.max(u.x,p.x,m.x,g.x),f=Math.min(u.y,p.y,m.y,g.y),b=Math.max(u.y,p.y,m.y,g.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 vE=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},j_=(i,r)=>vE(i,r)*-1;function CE(i,r,e,t,n){Im({id:i,value:r,otherBound:e},t,vE,n)}function $o(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var uu=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"$d",null);c(this,"rtree");c(this,"Ye",!1);c(this,"Va",!0);c(this,"O",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"N",{});c(this,"Ga",{});c(this,"Xe",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Us(4)}setSuspended(r){this.Ye=r,this.Ye||(this.recomputeBounds(),this.gE())}getExtents(){return Object.assign({},this.Xe)}EE(r,e,t){e!=null&&($o(r,this.O.xmin),$o(r,this.O.xmax),$o(r,this.O.ymin),$o(r,this.O.ymax),CE(r,e.t.x,e.t.x2,this.O.xmin,!1),CE(r,e.t.x2,e.t.x,this.O.xmax,!0),CE(r,e.t.y,e.t.y2,this.O.ymin,!1),CE(r,e.t.y2,e.t.y,this.O.ymax,!0),t!==!0&&this.es())}es(){this.Xe.xmin=this.O.xmin.length>0?this.O.xmin[0].value:0,this.Xe.xmax=this.O.xmax.length>0?this.O.xmax[0].value:0,this.Xe.ymin=this.O.ymin.length>0?this.O.ymin[0].value:0,this.Xe.ymax=this.O.ymax.length>0?this.O.ymax[0].value:0}recomputeBounds(){if(this.Va){this.Va=!1,this.O.xmin.length=0,this.O.xmax.length=0,this.O.ymin.length=0,this.O.ymax.length=0;for(let r in this.N){let e=this.N[r];this.O.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.O.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.O.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.O.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.O.xmin.sort(vE),this.O.ymin.sort(vE),this.O.xmax.sort(j_),this.O.ymax.sort(j_),this.es()}}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.O.xmin.length;a++){let l=this.O.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.N[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.N[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.O.xmin.length;a++){let l=this.O.xmin[a];if(n.indexOf(l.id)===-1&&Lm(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.N[l.id];if(Lm(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.N[d]),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=ox(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}fE(r,e,t){e.t=QI(r,e.x,e.y,e.width,e.height,e.r),this.Ga[r]=e.t,this.Va=!0,t!==!0&&(this.Ye||this.EE(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Ye||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=ys(this.N,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=e==null&&h.x==null||t==null&&h.y==null||n==null&&h.width==null||o==null&&h.height==null,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=xt({x:h.x,y:h.y},h.c,h.r),this.$d==null?this.fE(r,h,l):this.$d.affectedElements.add(r)),h}$forEachElement(r){for(let e in this.N)r(this.N[e])}$refreshEveryElement(){for(let r in this.N)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.N[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t||this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s.el,a);return(isNaN(l.x)||isNaN(l.y))&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s.el)),this.updateElement(r,l.x,l.y,a.width,a.height,o,null,e)}else return null}yE(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.Xe.xmax-this.Xe.xmin}getBoundsHeight(){return this.Xe.ymax-this.Xe.ymin}getX(){return this.Xe.xmin}getY(){return this.Xe.ymin}setSize(r,e,t){if(this.N[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.N[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.N[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.O.xmin.length=0,this.O.xmax.length=0,this.O.ymin.length=0,this.O.ymax.length=0,this.N={},this.Ga={},this.rtree.clear(),this.es()}remove(r){$o(r,this.O.xmin),$o(r,this.O.xmax),$o(r,this.O.ymin),$o(r,this.O.ymax),delete this.N[r],delete this.Ga[r],this.rtree!=null&&this.rtree.removeById(r),this.es()}$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,m,g,E;let u=this.getElement(d);if(u!=null){let y=((p=n[u.id])==null?void 0:p.x)||u.x,x=((m=n[u.id])==null?void 0:m.y)||u.y,f=((g=o[u.id])==null?void 0:g.width)||u.width,b=((E=o[u.id])==null?void 0:E.height)||u.height;s=Math.min(s,y-e),l=Math.min(l,x-t),a=Math.max(a,y-e+f),h=Math.max(h,x-t+b)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}gE(){this.rtree.clear();let r=Object.values(this.N).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.N[r]}getElements(){return this.N}isEmpty(){return Object.keys(this.N).length===0}getElement(r){let e=this.N[r];if(e)return e.dirty?this.$refreshElement(r,!1):e}getElementPosition(r){return this.N[r]!=null?rr(this.N[r]):null}getElementSize(r){return this.N[r]!=null?Es(this.N[r]):null}getElementBounds(r){return this.N[r]!=null?Object.assign(rr(this.N[r]),Es(this.N[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=H_(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.N[r]=l,Y(t)){let m=a;m.collapsed=!1,m.enabled=!0,m.contentArea=this.instance.$getGroupContentAreaElement(e),m.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(m.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}};var eM="currentFace",k_={[Et]:Ct,[vt]:Tt,[Tt]:vt,[Ct]:Et},W_={[Et]:vt,[vt]:Ct,[Tt]:Et,[Ct]:Tt},Z_={[Et]:Tt,[vt]:Et,[Tt]:Ct,[Ct]:vt};function tM(i){return i.faces.length===0?Et:i.faces[0]}function Ml(i,r){return i.faces.indexOf(r)!==-1}function rM(i,r){return(i.clockwise?W_:Z_)[r]}function nM(i,r){return(i.clockwise?Z_:W_)[r]}function PE(i,r,e){let t=()=>Ml(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function iM(i,r){if(Ml(i,r))return r;if(Ml(i,k_[r]))return k_[r];{let e=rM(i,r);if(Ml(i,e))return e;{let t=nM(i,r);if(Ml(i,t))return t}}return r}function ES(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:V(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,Bd:null};return Object.defineProperty(t,eM,{get(){return this.Bd},set(n){this.Bd=iM(this,n)}}),t}var fS={Continuous:{faces:[Et,Tt,Ct,vt]},ContinuousTop:{faces:[Et]},ContinuousRight:{faces:[vt]},ContinuousBottom:{faces:[Ct]},ContinuousLeft:{faces:[Tt]},ContinuousLeftRight:{faces:[Tt,vt]},ContinuousTopBottom:{faces:[Et,Ct]}};function oM(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 J_={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},K_={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},q_={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},Q_={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},sM={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},aM={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},lM={x:0,y:1,ox:0,oy:1,offx:0,offy:0},hM={x:1,y:1,ox:0,oy:1,offx:0,offy:0},cM={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},eR={Top:[J_],Bottom:[K_],Left:[q_],Right:[Q_],TopLeft:[sM],TopRight:[aM],BottomLeft:[lM],BottomRight:[hM],Center:[cM],AutoDefault:[J_,q_,K_,Q_]};function tR(i,r){r=r||{};let e=eR[i];if(e!=null)return OE(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=fS[i];if(t!=null)return ES(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function OE(i,r,e,t){return{objectType:Jg,type:i,locations:r,currentLocation:0,id:V(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function rR(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function pu(i,r,e){let t=ft(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&oM(t,e),t}function dM(i){return i.objectType===Jg}function ft(i,r){if(dM(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)),z(i)){let e=tR(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(rR(i))return OE(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(z(t)){let n=eR[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(rR(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 OE("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return tR(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var uM="___sourceMarker",pM="___targetMarker",Qs="__label",AS="vjs-default-label",yS="overlay",iR="labelLocation";function mM(i,r){let e={cssClass:r.cssClass,id:Qs,component:i},t=Object.assign(e,r);return new ir(i.instance,i,t)}function gM(i,r){let e=null;if(z(r))e=nt.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=nt.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||V(),we.cacheTypeItem(i,yS,e,e.id),i.overlays[e.id]=e,e}function Gl(i,r){let e=gM(i,r);if(e.type===ir.type&&!z(r)){let t=e,o=r.options.labelLocationAttribute||iR,s=i.edge.data[o];s&&(t.location=s),SE(t,i.edge.data)}return e}function Vl(i,r){return i.overlays[r]}function oR(i){return i.overlays}function EM(i,r){let e=Vl(i,r);e&&i.instance.setOverlayVisible(e,!1)}function sR(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 fM(i,r){let e=Vl(i,r);e&&i.instance.setOverlayVisible(e,!0)}function aR(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 yM(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions=null,i.overlayPlacements={}}function Ui(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 xM(i,...r){for(let e=0,t=r.length;e<t;e++)Ui(i,r[e])}function lR(i){return Vl(i,Qs)}function bM(i,r){let e=lR(i);if(e)if(z(r)||Tr(r))e.setLabel(r);else{let t=r;t.label&&e.setLabel(t.label),t.location&&(e.location=t.location)}else{let t=z(r)||Tr(r)?{label:r}:r;e=mM(i,t),i.overlays[Qs]=e}}var xS="add",bS="remove",mu="anchors",_E="connector";function nR(i,r,e){for(let t in i.overlays)r===xS?i.instance.$addOverlayClass(i.overlays[t],e):r===bS&&i.instance.$removeOverlayClass(i.overlays[t],e)}function SS(i,r,e){let t=null;r.connector!=null&&(t=we.getCachedTypeItem(i,_E,e.connector),t==null&&(t=kt.Fd(i,r.connector,e.connector),we.cacheTypeItem(i,_E,t,e.connector)),kt.setPreparedConnector(i,t)),we.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=we.getCachedTypeItem(i,yS,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.Qo!==Fi&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=Gl(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&&Ui(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=we.getCachedTypeItem(i,mu,e.anchor),s==null&&(s=[ft(r.anchor),ft(r.anchor)],we.cacheTypeItem(i,mu,s,e.anchor))):r.anchors&&(s=we.getCachedTypeItem(i,mu,e.anchors),s==null&&(s=[ft(r.anchors[0]),ft(r.anchors[1])],we.cacheTypeItem(i,mu,s,e.anchors))),s!=null&&i.instance.router.setConnectionAnchors(i,s);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Wr(i,r){we.addClass(i,r),nR(i,xS,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function Or(i,r){we.removeClass(i,r),nR(i,bS,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var kt={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&&we.cacheTypeItem(i,_E,r,n),Wr(i,s),o!=null){let a=oR(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,we.destroy(i)},setVisible(i,r){we.setVisible(i,r),r?aR(i):sR(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},Fd(i,r,e){let t={},n;if(z(r))n=Ne.get(i,r,t);else{let o=r;n=Ne.get(i,o.type,gn(o.options||{},t))}return e!=null&&(n.typeId=e),n},Ud(i,r,e,t,n){let o=kt.Fd(i,r,n);kt.setPreparedConnector(i,o,e,t,n)}};function TS(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function hR(i,r,e){for(let t in r)i[t]=e}var AM="connector",SM="override",TM="cssClass",cR="__default",vM="anchor",CM="anchors";function RE(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return hR(e,t,cR),i.$types.forEach(o=>{if(o!==cR){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([AM,vM,CM]);if(s.mergeStrategy===SM)for(let l in s)a.add(l);n=gn(n,s,[TM],Array.from(a)),hR(e,s,o)}}}),r&&(n=ho(n,r,"_")),Bo(i)&&SS(i,n,e),e}function Bo(i){return i.objectType===LE}var LE="connection";function vS(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&Bo(i)&&Or(i,e.cssClass)}function gu(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var PM="add",OM="remove";function _M(i){if(Bo(i))return{x:i.connector.x,y:i.connector.y}}function CS(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||V(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var we={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=TS(r),n=!1,o=s=>i.$types.has(s)?(vS(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&&RE(i,e)}},addType(i,r,e){let t=TS(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&&RE(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,gu(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,gu(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{vS(i,e)}),i.$types.clear(),RE(i,r)},setType(i,r,e){return we.clearTypes(i),(TS(r)||[]).forEach(i.$types.add,i.$types),RE(i,e)},applyType(i,r,e){we.setPaintStyle(i,r.paintStyle),we.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 dR(i,r){return r.theta-i.theta}function uR(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 OS={[Et]:uR,[vt]:dR,[Ct]:dR,[Tt]:uR};function _S(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,m=i.x+p,g=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=xt({x:m,y},i.c,i.r);m=f.x,y=f.y}a.push({x:m,y,xLoc:g,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Fo(i){return!i.isFixed&&i.isContinuous===!0}function RS(i){return[i.currentLocation,i.locations[i.currentLocation]]}function RM(i,r,e){let t=Ni[r].x,n=Ni[r].y;return PS(i,t,n,e,e/3)}function LM(i,r,e){let t=Ni[r].x,n=Ni[r].y,o=t===0?i.x-e:i.x+t*e*2,s=t===0?i.x+e:i.x,a=n===0?i.y-e:i.y+n*e*2,l=n===0?i.y+e:i.y,h=Math.min(o,s),d=Math.min(a,l),u=Math.max(o,s),p=Math.max(a,l);return{x:h,y:d,width:u-h,height:p-d}}function PS(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=tr(i,o,n),a=tr(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 wM(i,r,e,t){if(t.connector!=null){let n=2*Math.max(t.connector.sourceStub,t.connector.targetStub);return PS(i,r,e,n,n/3)}else return{x:i.x,y:i.y,width:1,height:1}}function Eu(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:0,oy:0};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=xt(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}var DM=10;function NM(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=ux([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 fu=class{constructor(r,e){this.instance=r;c(this,"anchorLists",new Map);c(this,"zd");c(this,"Ti");c(this,"vi");c(this,"Ci");c(this,"ut");c(this,"rs",new Map);c(this,"Yd",null);e=e||{},this.Ti=e.gridCellSize||DM,this.zd=e.avoidVertices===!0,this.vi=e.vertexBuffer||2,this.Ci=e.vertexBorder||2}$connectionRemoved(r){Fo(r.connection.anchors.source)&&this.$_removeAnchorFromAnchorLists(r.connection.sourceId,r.connection.anchors.source),Fo(r.connection.anchors.target)&&this.$_removeAnchorFromAnchorLists(r.connection.targetId,r.connection.anchors.target)}elementRemoved(r){r!=null&&this.anchorLists.delete(r.id)}xE(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;_t(o.top,s),_t(o.left,s),_t(o.bottom,s),_t(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)}$connectionDetachedFromElement(r,e){this.xE(r,e)}$setCurrentLocation(r,e,t){r.currentLocation=e}bE(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=Eu(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=RS(r);if(r.locations.length===1||s==null||a==null)t=Eu(h,n,o,e);else{let[d,u]=this.AE(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&this.$setCurrentLocation(r,d,e.connection),t=Eu(u,n,o,e)}}return r.computedPosition=t,t}SE(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(OS[o]),p=o===ut||o===Se,m=_S(t,u,l,h,p);for(let g=0;g<m.length;g++)m[g].a.locations[0]={x:m[g].xLoc,y:m[g].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},m[g].a.currentLocation=0}};n(st,t,e.bottom,!0,1,{x:0,y:1}),n(Se,t,e.top,!0,0,{x:0,y:-1}),n(Ye,t,e.left,!1,0,{x:-1,y:0}),n(ut,t,e.right,!1,1,{x:1,y:0})}ts(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,m=-1,g={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]=g;else{let f=l?m!==-1?m:0:E.length;E.splice(f,0,g)}e.currentFace=h}$_removeAnchorFromAnchorLists(r,e){let t=this.anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;_t(o.top,a),_t(o.left,a),_t(o.bottom,a),_t(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)}computeAnchorLocation(r,e){let t=this.bE(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=this.computeAnchorLocation(r.anchors.source,{xy:t,wh:t,elementId:t.id,timestamp:e,rotation:this.instance.$getRotations(r.sourceId),txy:n,twh:n}),a=this.computeAnchorLocation(r.anchors.target,{xy:n,wh:n,elementId:n.id,timestamp:e,rotation:this.instance.$getRotations(r.targetId),txy:t,twh:t});_A(r.connector);let l={sourcePos:s,targetPos:a,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=rE(o,l),eE(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let h=o.geometry==null||o.geometry.source==null?!1:!sE(s,o.geometry.source),d=o.geometry==null||o.geometry.target==null?!1:!sE(a,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(h||d)&&Ii(r),o.edited){let u=this.TE(r,o,l,e,h,d);Ne.setGeometry(r,u,!1)}else{let u=this.vE(r,o,l,e);Ne.setGeometry(r,u,!0)}tE(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}prepareAnchor(r){return ft(r)}Gb(r){let e=Math.max(r.sourceStub,r.targetStub);return Math.max(this.instance.$_vertexBuffer,e)}CE(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.Yd){let v=this.rs.get(p);if(v!=null)return v}else this.rs.clear();this.Yd=u;let m={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:m.IDENTITY,a:[Se,Se]};let g=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,O)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[Ye]:{x:O[P][0].x,y:O[P][0].c.y},[ut]:{x:O[P][0].x+O[P][0].width,y:O[P][0].c.y},[Se]:{x:O[P][0].c.x,y:O[P][0].y},[st]:{x:O[P][0].c.x,y:O[P][0].y+O[P][0].height}},O[P][1]!=null&&O[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=px(x[v[P]][I],O[P][1])})([Qe,xn],[[t,a],[n,l]]);let f=[Se,Ye,ut,st];for(let v=0;v<f.length;v++)for(let O=0;O<f.length;O++)y.push({source:f[v],target:f[O],dist:Math.round(Be(x.source[f[v]],x.target[f[O]]))});y.sort(function(v,O){if(v.dist<O.dist)return-1;if(O.dist<v.dist)return 1;{let P={[Ye]:0,[Se]:1,[ut]:2,[st]:3},I=P[v.source],C=P[O.source],_=P[v.target],w=P[O.target];return I<C?-1:C<I?1:_<w?-1:w<_?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let O=y[v];if(!Fo(o)||PE(o,O.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=Ni[P],_=this.Ti*(this.Ci+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(_*C.x)),height:Math.max(1,Math.abs(_*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Fo(s)||PE(s,O.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=Ni[P],_=this.Ti*(this.Ci+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(_*C.x)),height:Math.max(1,Math.abs(_*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 R={a:[b,A],theta:g,theta2:E};return this.rs.set(p,R),R}$redrawEveryConnection(){let r=V();return this.$a(Object.values(this.instance.$_connMap),r)}$redrawConnection(r,e){return this.$a([this.instance.$_connMap[r.id]],e)}$redraw(r,e){return this.$a(r.connections||[],e)}$a(r,e){let t=new Set,n=new Set;if(!this.instance.pt){e=e||V();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=Fo(a.anchors.source),u=Fo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),m=(a.anchors.target.faces||[]).join("-"),g=[l,p,h,m].join("-"),E=o[g];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.ts(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Se,t),this.ts(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Se,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.CE(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,g),o[g]=E),d&&this.ts(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.ts(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.SE(s,this.anchorLists.get(s))}),t.forEach(s=>{this.instance.$paintConnection(s,{timestamp:e})})}return{c:t}}reset(){this.anchorLists.clear(),this.rs.clear()}setConnectionAnchors(r,e){r.anchors.source=e[0],r.anchors.target=e[1]}AE(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,m)=>{let g=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:g,y:E,idx:m}}),d=l.locations.map((p,m)=>{let g=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:m,x:g,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let m=0;m<d.length;m++){let g=Math.round(Be(h[p],d[m]));u.push({d:g,idx:p,idx2:m})}return u.sort((p,m)=>p.d-m.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,m)=>({d:NM(p,h,d,r,e,o,s),idx:m}));return u.sort((p,m)=>p.d-m.d),[u[0].idx,a[u[0].idx]]}}};function pR(i,r,e,t,n,o,s,a){let l=Ir(r),h=Hx(r),d=s(e,t,l,h);d.sort((p,m)=>{let g=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=m.axis===l&&m.directionFromParent===r.directionFromParent,x=m.axis===l&&m.directionFromParent!==r.directionFromParent;return g||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let m=d[p],g=e+m.dx,E=t+m.dy,y=m.axis,x=m.directionFromParent,f=r.ax+m.dx*n,b=r.ay+m.dy*n,A=i.getCell(g,E,null,null),T=A===a,S={cx:g,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(g-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 LS(i){let r=[],e=Ir(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Ir(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:Ir(i),length:o}}function IM(i){return i.axis===yn||i.axis===kn}function MM(i){return i.axis===he&&i.source.ax===i.target.ax||i.axis===ne&&i.source.ay===i.target.ay}function mR(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 VM(i,r,e){if(IM(i)||MM(i))mR(i,r,e);else{let t=i.axis===ne?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===he?(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===he?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===he?ne:he,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 gR(i,r,e){if(e===ne)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===he)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===yn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===kn)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function wS(i,r,e,t,n,o){let s=i,a=[];n=n||V();let l=LS(s);if(l.isFirstSegment)t===en?mR(l,a,n):VM(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,m=LS(l.target);for(;!p&&m!=null;){let g=gR(d,u,l.axis),E;E=gR(m.isFirstSegment?m.target.ax:m.target.cx,m.isFirstSegment?m.target.ay:m.target.cy,m.axis);let y=ix(g,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=m),m.isFirstSegment?p=!0:m=LS(m.target)}m!=null&&a.push({ax1:m.target.ax,ay1:m.target.ay,ax2:d,ay2:u,pathId:n,axis:m.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function ER(i,r,e,t,n,o){let s=wS(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},m=u+1,g=!1;for(;!g;){let E=s.segments[m];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:m-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[m-1].ax2,ay2:s.segments[m-1].ay2},finished:E==null};m++}}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 fR(i,r,e,t,n,o,s,a,l,h,d,u,p,m,g,E,y){E==null?E=new Ps(i,r,s,h,d,u):E.reinitialize();let x=E.Uo(i.x,i.y),f=E.Uo(r.x,r.y),b=gg(n);b.axis==null&&(b.axis=jx(i,r));let A=gg(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:pg,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let R=T,v=S,O=()=>a===en?ER(v,R,E,a,g,y):wS(v,R,E,a,y,!0),P=new zc,I=new gs(P.sort.bind(P),T),C,_,w=Ec(T.x,T.y,S.x,S.y)*100,B=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,_=Ir(C),B++,B>w)throw`too many iterations ${B} `;if(C===S)return O();P.node=C;let D=pR(E,C,C.x,C.y,s,u,m,S);for(let M=0,N=D.length;M<N;M++){let G=D[M];if(G.isTarget)return G.obj.parent=C,O();if(G.obj.closed||G.obj===T||G.obj===S||G.obstacles.length>0||G.buffers.length>0)continue;let J=0;G.axis!==_&&(J=.5),(!G.obj.opened||G.g<G.obj.g)&&(G.obj.g=G.g,G.obj.h=l(G.cx,G.cy,S.x,S.y)+J,G.obj.f=G.obj.g+G.obj.h,G.obj.parent=C,G.obj.ax=G.ax,G.obj.ay=G.ay,G.obj.opened?I.update(G.obj):(I.add(G.obj),G.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:pg,isEmpty:!0}}function DS(i,r,e,t,n,o,s,a,l,h,d,u,p,m){return fR(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(g,E,y,x)=>{if(l===en||l==null)return mg(g,E,y,x);if(l===Oc)return mg(g,E,y,x);if(l===tn)return zx(g,E,y,x)},(g,E)=>{let y=a*d;return s.hasLineOfSight(E,y,g.sourceAndTargetObstacles)},p,m)}function NS(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 $l=class extends fu{constructor(e,t){super(e,t);this.instance=e;c(this,"Xd")}vE(e,t,n,o){return this.zd||e.avoidVertices?this.OE(e,t,n,o):this.is(e,t,n)}TE(e,t,n,o,s,a){return Ne.update(e,t.paintInfo,n,s,a)}is(e,t,n){return Ne.compute(e,t.paintInfo,n)}OE(e,t,n,o){if(t.edited)this.is(e,t,n);else{let s=t,a=NS(n.sourcePos,t.sourceGap),l=NS(n.targetPos,t.targetGap),h={x:a.curX+t.sourceStub*a.ox,y:a.curY+t.sourceStub*a.oy},d={x:l.curX+t.targetStub*l.ox,y:l.curY+t.targetStub*l.oy},u=Math.min(h.x,d.x),p=Math.max(h.x,d.x),m=Math.min(h.y,d.y),g=Math.max(h.y,d.y),E={x:u,y:m,width:Math.max(p-u,10),height:Math.max(g-m,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(E,0,[],!1))return this.is(e,t,n);(this.ut==null||o!==this.Xd)&&(this.ut=new Ps(h,d,this.Ti,this.Ci,this.vi,(y,x,f)=>this.instance.viewport.findVerticesAtPoint(y,x,f))),this.Xd=o;try{let y=e.edge?e.edge.id:e.id,x=DS(h,d,e.sourceId,e.targetId,a,l,this.instance.viewport,this.Ti,s.constrain,Ec,this.Ci,this.vi,this.ut,y);if(x.isEmpty)Ne.compute(e,t.paintInfo,n);else{x.segments.unshift({ax1:a.curX,ay1:a.curY,ax2:h.x,ay2:h.y,axis:Cs(a.ox,a.oy),pathId:y}),x.segments.push({ax1:d.x,ay1:d.y,ax2:l.curX,ay2:l.curY,axis:Cs(l.ox,l.oy),pathId:y});let f=cE(x.segments.map(A=>Object.assign({x1:A.ax1,y1:A.ay1,x2:A.ax2,y2:A.ay2,o:A.axis||GM(A)},A)));return Zd(e.connector,f),{segments:s.$pathSegments,source:n.sourcePos,target:n.targetPos,quadrant:t.paintInfo.quadrant}}}catch(y){return this.is(e,t,n)}}}};c($l,"type",xe);function GM(i){return i.axis!=null?i.axis:i.ax1===i.ax2?he:i.ay1===i.ay2?ne:null}var IS="fill",wE="stroke",MS="stroke-width",$M="strokeWidth",ve="svg",VS="defs",te="path",ze="circle",GS="ellipse",Je="text",DE="tspan",Z="rect",q="g",BM="version",FM="xmlns",UM="fill",NE="stroke-dasharray",YM="stroke-linejoin",zM="stroke-linecap",XM="stroke-miterlimit",jM="stroke-dashoffset",HM="stroke-opacity",kM="stroke",WM="stroke-width",yu="vector-effect",xu="non-scaling-stroke",ZM="text-anchor",Wt="http://www.w3.org/2000/svg",JM="http://www.w3.org/1999/xlink",KM="http://www.w3.org/1999/xhtml";var bu=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Ve,Re],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 yR=.5;function $S(i,r){var b,A;let e=CS(i,LE,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=ni(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[Qs]={type:ir.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||yR,id:Qs,cssClass:AS}}),r.sourceMarker){let T=ni(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=ni(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=ft(l,d),m=ft(h,u),g=i.$_edgesDetachable;r.detachable===!1&&(g=!1);let E=i.$_reattachEdges===!0,y=Ns({},r.paintStyle||i.defaults.paintStyle);we.appendToDefaultType(e,{detachable:g,reattach:E,paintStyle:y,hoverPaintStyle:Ns({},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:m},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:g,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[Qe]:[],[xn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});kt.Ud(x,r.connector||i.$defaultConnector,!0);let f=[xe,r.type].join(" ");return/[^\s]/.test(f)&&we.addType(x,f,r.data),x}var Bl=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 Au=class{constructor(r,e){this.gridProfile=e;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 xR={},or={get:i=>{let r=xR[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{xR[i]=r}};function wt(i){return function(r){or.register(i,r)}}function Su(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 m=(isFinite(i.xmax)?i.xmax:0)+u+l,g=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||m,m),y=Math.min((a==null?void 0:a.height)||g,g);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 BS(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=ft(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===Qe?n.anchors.source=l:n.anchors.target=l,kt.setVisible(n,o.originallyVisible),s}return null}function FS(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=ft(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=ft(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=eA(o.proxies[e]),l=a!=null?a.originalElement.id:e===Qe?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===Qe?o.anchors.source:o.anchors.target;e===Qe?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}),kt.setVisible(o,!0),i.$revalidateElementById(t.id)}}var qM=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function IE(i,r,e){r!=null&&(Dm(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,Ll)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(Dm(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,Ll))}function ME(i,r,e){if(r!=null){let t=r.connections.length;_t(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,Ll)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&_t(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,Ll)}}var QM=2,e1=2,Tu=class extends It{constructor(e,t,n,o,s){var l,h,d,u,p,m,g,E,y,x,f,b,A,T;super();c(this,"Ba",[]);c(this,"Fa",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Oi",{});c(this,"hoverSuspended",!1);c(this,"pt",!1);c(this,"jd",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"connectorClass",Zs);c(this,"connectorOutlineClass",rS);c(this,"connectorPathClass",tS);c(this,"overlayClass",Js);c(this,"labelOverlayClass",iS);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"os");c(this,"viewport",new uu(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"Ua",new Map);c(this,"me");c(this,"za",new Set);c(this,"kd");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"Hd");c(this,"Wd");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,"j",1);c(this,"$collapsedGroupSizeCalculator");c(this,"Zd");c(this,"Ya");c(this,"Xa");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,"PE");c(this,"ss");c(this,"rootElement");c(this,"wt",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||V(),this.gridProfile=new Bl(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)||_n,this.Hd=(h=o.edges)==null?void 0:h.sourceMarker,this.Wd=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>ni(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((m=o.edges)==null?void 0:m.anchors)||[null,null],this.defaults={[au]:null,[uS]:1,[Go]:{strokeWidth:2,stroke:"#000000"},[xE]:"vjs_defaultscope",[yE]:!0,[cS]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Oi,this.defaults),this.Oi[Go]!=null&&(this.Oi[Go].strokeWidth=this.Oi[Go].strokeWidth||2),this.kd=this.defaults[xE],this.allowNestedGroups=this.Oi[yE]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[lS]:QM,this.$_vertexBorder=o.edges?o.edges[aS]:e1,this.os=((g=o.edges)==null?void 0:g.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=new $l(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.os}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Au(o.magnetizer||{},this.gridProfile),this.magnetizer=new Si({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,R)=>{}}),this.ss=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.ss=!1),this.setContainer(n),this.$setView(o.view),this.ja(pt,S=>{let R=this.$_connMap[S.edge.getId()];if(R){let v=this.dataSource.getEdgeType(S.edge.data),O=[...new Set([xe,v])];if(this.$_setConnectionType(R,O.join(" "),S.edge.data),this.ss===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(R,P,!0)}this.le(P=>{P.$edgeUpdated(S.edge,R)})}}),this.ja(Kc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=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(R),this.le(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.ja(Jc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=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(R),this.le(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=qe.get(bs.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:uo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.Zd=o.defaultCollapsedGroupSize||{width:200,height:150},this.Ya=o.canCollapseGroup,this.Xa=o.canExpandGroup}get defaultScope(){return this.kd}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.j}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&&H(t.target)&&(s=this.Jd(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this._E(n,s,!xi(e.old))):(delete this.$_connMap[t.getId()],this.ka(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(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,Bi)}else if(Ke(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,Dl)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,Bi)}}setSuspendRendering(e,t){}$deselect(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,Bi)}else if(Ke(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,Dl)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,Bi)}}$selectionCleared(e){this.$getSelector(this.me,"."+Dl).forEach(t=>this.$removeClassFromElement(t,Dl)),this.$getSelector(this.me,"."+Bi).forEach(t=>this.$removeClassFromElement(t,Bi))}Jd(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&&H(t.source)&&(s=this.Jd(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.RE(n,s,!xi(e.old)):(delete this.$_connMap[t.getId()],this.ka(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(Pi,e)}ja(e,t){this.Ba.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(ud)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=V();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.router.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(Sn)}}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=ot(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.as(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},St),h}}Kd(){let e,t,n,o,s,a=!1,l=V();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.qd(h[e],nl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.wt.length!==0}LE(e,t,n,o){let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(H(o.source)?null:this.$getAttribute(e,Vi)||this.$getAttribute(e,Hr)),h=n.targetPortType||(H(o.target)?null:this.$getAttribute(e,Gi)||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 qM.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}wE(e,t,n,o){var R,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=H(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=H(s.target)?s.target.getParent():s.target,m=this.getElement(p.id),{sourceDef:g,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.LE(u.el,m.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.Hd,targetMarker:h.targetMarker||this.Wd};[su,hS,dS].forEach(O=>{h.hasOwnProperty(O)&&(f[O]=h[O])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(O,P,I,C,_)=>{if(C&&C[I]){let w=O[P]||[C[I],C[I]];w[_]=C[I],O[P]=w}};g!=null&&A(f,Il,Nl,g,0),E!=null&&A(f,Il,Nl,E,1);let T=f;if(T.avoidVertices=this.os||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,ho(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(R=s.anchors)!=null&&R.source)f.anchors[0]=ft(s.anchors.source);else{let O=a.positionOnSource||{x:0,y:0},P=g.anchorPositions||y.anchorPositions,I=g.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=pu(P.slice(),null,O);else if(I!=null){let C=I(u.el,O,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]=ft(s.anchors.target);else{let O=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,O);else if(I!=null){let C=I(m.el,O,s.target,E);f.anchors[1]=C}}this.ss===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=$S(this,f);if(S!=null){IE(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(Ne.importGeometry(S,T.geometry),this.$revalidateElementById(S.sourceId,o),this.$revalidateElementById(S.targetId,o)),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.PE&&this.refresh(),(m.visible===!1||u.visible===!1)&&this.ls(s,!1),T.geometry||this.$revalidateElementById(S.sourceId,o);let O={connection:S,edge:s,reason:e.reason};this.fire(ob,O)}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.Jn(),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.le(o=>{o.$groupRemoved(t)})),t}qd(e,t,n,o,s,a){this.wt.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.wt.length,n=[];if(t>0){let o=[];for(let s=0;s<this.wt.length;s++)this.DE(this.wt[s],e)==null?o.push(this.wt[s]):n.push(this.wt[s].edge);this.wt=o}return n}DE(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.wE(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.qd(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.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.ka(n,{fireEvent:!1,force:!0}),this.le(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?Ne.importGeometry(o,t):Ii(o),this.$revalidateElementById(e.source.getFullId()),this.fire(Zn,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:Yr(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(V()))}$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.le(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.Qd(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===$s&&this.os){let d=this.model.getAllEdges().filter(u=>jn(u.source).id!==e.vertex.id&&jn(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===Ad?this.NE(this.getElement(t.id),e.originalData):this.fire(Ms,this.getElement(t.id)),this.le(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}NE(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)?Gr:Lt;this.fire(s,o)}IE(e){this.fire(Le,e)}getLayoutFor(e){return zm(e)||Xm(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,Db),this.le(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.le(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.le(o=>{o.$nodeRemoved(t)}),this.IE(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,Rl),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&&kt.Ud(o,s.connector),we.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=K(e),a=Y(e);this.$setAttribute(t,ee,e.getFullId());let l=s?$i:a?Vo:H(e)?oS:"";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,Pt,this.$getAttribute(h.el,Pt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,Bi)),K(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let g=this.eu(e.group);this.$appendElement(t,g)}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 m=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.Qd(e,p,!this.$_dataLoading,!1),K(e)){if(!d){let g={el:t,id:e.id,vertex:e,size:u};this.fire(Br,g)}}else if(Y(e)){let g={el:t,vertex:e,id:e.id,size:u},E=m,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:uo.type};this.layoutMap.set(e.id,this.tu(x,e)),this.fire($r,g),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}if(this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender())this.$dataLoadEnd(!1);else if(!this.$_dataLoading){d&&this.le(y=>{y.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})});let g=V(),E=this.$flushUnrenderedEdges(null);this.$unrenderedVertices.size===0&&this.refresh(),E.forEach(y=>{this.viewport.$refreshElement(y.source.getFullId()),this.viewport.$refreshElement(y.target.getFullId()),this.router.$redrawConnection(y,g)})}}ls(e,t,n){let o=this.$_connMap[e.id];o&&kt.setVisible(o,t)}isVisible(e){return this.ru(e,t=>{switch(t.type){case Fe.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case de.objectType:case le.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Fe.objectType:this.ls(s.obj,t,n);break;case de.objectType:case le.objectType:this.ME(s,t,n);break;case pe.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.ru(e,o)}ME(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.$b=t,e.managedElement.visible=t,this.fire(pd,{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.ls(o[s],t,n);else{let a=jn(o[s].source),l=jn(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.ls(o[s],t,n)}}}ru(e,t){let n;if(jb(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=K(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.me}setZoom(e,t){return this.j=e,e}F(e){if(e==null)return null;let t=this.$getAttribute(e,Pt);return(!t||t==="undefined")&&(t=`vjs-${V()}`,this.$setAttribute(e,Pt,t)),t}setContainer(e){this.me=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}RE(e,t,n){ME(e,this.getElement(e.sourceId)),this.$revalidateManagedElement(this.getElement(e.sourceId));let o=this.nu(e,t,0,n);IE(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$revalidateManagedElement(this.getElement(o.newSourceId))}_E(e,t,n){ME(e,this.getElement(e.targetId)),this.$revalidateManagedElement(this.getElement(e.targetId));let o=this.nu(e,t,1,n);IE(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$revalidateManagedElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=we.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.pt;return this.pt=e,e?this.jd=""+new Date().getTime():this.jd=null,this.pt||(this.autoSizeGroups(Array.from(this.za.keys()).map(o=>o.modelObject)),this.za.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.pt===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}An(e){let t=e.elId;return e.recalc?this.viewport.$refreshElement(t,!1,e.pos,e.size):this.viewport.getPosition(t)}VE(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}ka(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.VE(e)===!0)?(ME(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:rl,edge:e.edge}),delete this.$_connMap[e.id],kt.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,Pt)==null&&this.$setAttribute(e,Pt,l);let h=this.getElement(l);return h==null?(h=this.viewport.addElement(l,e,t,n,o,s),this.pt||this.An({elId:l,recalc:!0,pos:n,size:o,rotation:s})):a&&this.An({elId:l,timestamp:null,recalc:!0}),h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.F(s),l=this.getElement(a);this.router.elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,Pt),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},Vs,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},zb,!1)},St)}Qd(e,t,n,o){let s=z(e)?e:e.id;if(this.getElement(s)){this.viewport.yE(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.le(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$revalidateElementById(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((K(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&&(t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.F(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.An({elId:e.id,recalc:!0,timestamp:t}),this.$repaintUIElement(e)):du()}repaintEverything(e){let t=V();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}repaint(e,t){let n=this.getObjectInfo(e,!1);n!=null&&(t&&this.$setViewportElementPosition(n.managedElement,n.managedElement),this.$repaintUIElement(n.managedElement))}$repaintUIElement(e,t,n){let o=du(),s=a=>{a.c.forEach(l=>o.c.add(l))};if(!this.pt&&e!=null){let a=this.$getAssociatedElements(e.el).map(l=>this.getElement(this.F(l))).filter(l=>l!=null);if(t==null&&(t=V()),!n)for(let l=0;l<a.length;l++)this.An({elId:a[l].id,recalc:!0,timestamp:t});if(s(this.router.$redraw(e,t,null)),a.length>0)for(let l=0;l<a.length;l++)s(this.router.$redraw(a[l],t,null))}return o}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.reset(),this.wt.length=0,this.$unrenderedVertices.clear(),this.za.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(K)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.Fa.length;e++)this.off(this.me,this.Fa[e][0],this.Fa[e][1]);this.reset(),this.unbind(),this.Ua.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.Ua.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=ni(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=ni(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=ni(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.Ua.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===Qe?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===xn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),ME(n,h,d),IE(n,a,l))}Ha(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=En(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.Wa(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,m=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||m<0)){let g=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let g=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=z(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.Xa?this.Xa(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.iu(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[fE],[EE]);let l=new Set,h=new Set,d=new Set;this.ou(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 m in p)this.model.updateVertex(m,p[m])}this.Ha(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.le(p=>{p.$groupExpanded(n)}),this.fire(dd,{group:t})}}},St,!0)}$_proxyEdge(e,t,n,o){FS(this,e,t,n,o)}$_unproxyEdge(e,t,n){return BS(this,e,t,n)}ou(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=Hm(e.modelObject,!0,!0);this.An({elId:e.id,recalc:!0}),a.forEach(d=>{this.An({elId:d,recalc:!0})});let h=Ka(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?xn:Qe})}),h.right.forEach(d=>{o.add(d)}),this.su(e).forEach(d=>{this.ou(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(z(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=z(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.Ya==null?null:this.Ya(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.iu(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[EE],[fE]);let h=new Set,d=new Set;this.au(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 m in p)this.model.updateVertex(m,p[m])}this.Ha(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.le(p=>{p.$groupCollapsed(n)}),this.fire(cd,{group:t})}}},St,!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.Zd}su(e){return e.modelObject.members.filter(t=>t.objectType===le.objectType).map(t=>this.viewport.getGroupElement(t.id))}au(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=Hm(e.modelObject,!0,!0);if(e.proxied!==!1){let a=Ka(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?xn:Qe})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.su(e).forEach(a=>{this.au(a,t,n)})}GE(){return this.lu(this.dataSource.getGroups().filter(this.objectFilter))}lu(e){let t=[];return e.forEach(n=>{let o=En(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===wb&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=du();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.$E(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).c.forEach(l=>o.c.add(l))}),o}relayout(e,t){this.cu(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},Tn,t)}refresh(e){this.cu(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Is,e)}cu(e,t,n,o){if(!this.pt){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let g in l)p.push(this.dataSource.getVertex(g));this.magnetizer.setElements(p);let m=this.magnetizer.executeAtCenter({getPosition:g=>l[g.id],getSize:g=>a.sizes[g.id]});for(let g in m.current)l[g]=m.current[g]}let h=this.BE(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(g,E)=>h.info[g].positions[E]||this.getElementPosition(E),m=(g,E)=>a.sizes[E]||h.info[g].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(g=>{let E=yi();g.group.members.forEach(x=>{let f=p(g.group.id,x.id),b=m(g.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.Wa(g.group,l,a.sizes,E,!1);if(y!=null&&(s[g.group.id]={group:g.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[g.group.id]!=null&&(l[g.group.id]=y.position),u[g.group.id]=this.$_getGroupContentAreaInfo(g.group.id),a.sizes[g.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[g.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 m=p.group.id,g=h.info[m],E=l[m]||rr(g.element),y=u[m]||this.$_getGroupContentAreaInfo(m);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:g.positions,sizes:g.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=V();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.pt&&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,kt.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)}}e.lastPaintedAt=n}}$addOverlay(e,t,n){let o=Gl(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$revalidateElementById(e.sourceId)),o}$removeOverlay(e,t){Ui(e,t),this.$revalidateElementById(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),gu(e),n&&this.$paintConnection(e)}$setView(e){this.view=new cu(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};return(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(s=>{let a=K(s.modelObject),l=a&&zm(s.modelObject),h=Y(s.modelObject),d=h&&Xm(s.modelObject),u=e.dontIncludeNodes===!0&&a,p=e.dontIncludeGroups===!0&&h,m=e.dontIncludeNodesInsideGroups&&l,g=e.dontIncludeNestedGroups&&d;return!(u||p||m||g)}).map(s=>({enclosed:e.enclosed,id:s.id,r:s,v:s.modelObject,el:s.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}eu(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(Bo(e)){let n=e.edge;return{obj:n,id:n.id,type:Fe.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.F(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===Fe.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)}}Za(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}FE(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 g=this.getObjectInfo(e,!1);if(g.obj)if(!l)p.focus=g.obj.id;else{let E=this.getElement(g.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===g.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let m=this.getGrid();return m&&(p.grid=m),p}cs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.Za());let p=this.FE(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)}as(e,t,n,o,s,a,l,h,d){let u=this.cs(e,t,n,o,s,null,a,l,h,d);this.hs(u,Ub)}magnetize(e,t){this.as(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.cs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.cs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.as(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.as(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.Za(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}hu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}UE(e,t){let n=this.hu(t);this.model.updateVertex(e,n)}hs(e,t,n){this.model.openTransaction(St);try{for(let o in e.current){let s=this.hu(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)),Pe(l.data,s,n.x),Pe(l.data,a,n.y)),n}$E(e,t){let n=z(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),Pe(n.data,this.$modelWidthAttribute,t.width),Pe(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.zE(a.obj,t,n,o,s===!1,!1,!1,!1);this.hs(l,Ad)}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.hs({original:{},current:u},Ad,()=>{this.Ha(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,Lb),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))}zE(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.cs(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.YE()&&(d=se(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);Pe(l.data,n,h.x),Pe(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 Bl({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}YE(){return this.gridProfile!=null&&this.gridProfile.snap}Bb(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=se({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.Za());let o=this.magnetizer.snapToGrid(t);return this.hs(o,Yb),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.lu(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.XE(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}XE(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.Wa(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}BE(){let e={orderedGroups:this.GE(),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(Zc,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.le(l=>{l.$groupResized(n)}),this.model.fire(Re,{vertex:o,updates:s,originalData:o.data,reason:Fb},null)}}}Wa(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),m=this.$_getGroupContentAreaInfo(e.id),g=m.contentArea,E=0,y=0,x,f,b=p(e.id),A=m.isGroupElement?p(e.id):this.$getSize(g),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),R=Object.assign({},u(e.id)),v,O=null;if(O!=null)E=O.layoutShiftX,y=O.layoutShiftY,x=O.width,f=O.height,v={x:R.x-E,y:R.y-y};else{let P=Su(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:R.x-E,y:R.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(g,x,f),!m.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,_=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),_<0&&(this.$setElementHeight(g,S-m.internalOffset.y),_=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),_>0&&(this.$setElementHeight(g,S-m.internalOffset.y),_=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)}du(e){let t={container:this.me,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:Pe(n.data,this.$modelLeftAttribute),y:Pe(n.data,this.$modelTopAttribute)})),qe.get(e.type,t)}tu(e,t){let n=this.eu(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:Pe(s.data,this.$modelLeftAttribute),y:Pe(s.data,this.$modelTopAttribute)};return z(a.x)&&(a.x=parseInt(a.x,10)),z(a.y)&&(a.y=parseInt(a.y,10)),a}),qe.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.du(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.du(e).layout(n=>{for(let o in n.positions)this.UE(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,{},[$i,sS].join(" "),{[ee]: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}uu(e){(e.plugins||[]).forEach(n=>{this.pu(n,!0)})}addPlugin(e){return this.pu(e,!0)}pu(e,t){let n=z(e)?e:e.type,o=z(e)?{}:e.options||{},s=or.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),t&&this.fire(md,s),s}getPlugin(e){return this.pluginMap.get(e)}le(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.j};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!z(e)&&Array.isArray(e)}};var t1=20,r1=20,VE=class VE extends Ln{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",VE.type);c(this,"contentTags",[te]);n=n||{},this.width=n.width||t1,this.length=n.length||r1,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 g=this.location<0?1:0;o=rt(e,g,this.location,!1),s=rt(e,g,this.location-this.direction*this.length/2,!1),a=Ut(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=rt(e,this.location,-this.length),a=Ut(o,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=rt(e,this.location,this.length),o=Ut(a,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else o=rt(e,this.location,this.direction*this.length/2),s=Xr(e,this.location),a=Ut(o,s,this.length);l=tr(o,a,this.width),h=Ut(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(VE,"type","Arrow");var _r=VE;nt.register(_r.type,_r);var GE=class GE extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",GE.type);this.foldback=1}};c(GE,"type","PlainArrow");var vu=GE;nt.register(vu.type,vu);var $E=class $E extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",$E.type);this.length=this.length/2,this.foldback=2}};c($E,"type","Diamond");var Cu=$E;nt.register(Cu.type,Cu);var BE=class BE extends ri{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"type",BE.type);this.create=n.create}updateFrom(e,t){}};c(BE,"type","Custom");var Fl=BE;function sn(i){return i.type===Fl.type}nt.register(Fl.type,Fl);var bR=5,FE=class FE extends Ln{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Ce");c(this,"$r");c(this,"type",FE.type);c(this,"contentTags",[ze]);n=n||{},this.Ce=n.radius||bR,this.$r=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.$r==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=rt(e,this.location,this.Ce);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=rt(e,this.location,this.Ce);l=Ut(d,u,this.Ce),h=rt(e,this.location,2*this.Ce)}else if(this.location===1)if(this.$r==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=rt(e,this.location,-this.Ce);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=rt(e,this.location,-this.Ce);l=Ut(d,u,this.Ce),h=rt(e,this.location,-2*this.Ce)}else l=Xr(e,this.location),h=rt(e,this.location,this.Ce);return{atts:[{cx:l.x,cy:l.y,r:this.Ce,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Ce,xmax:l.x+this.Ce,ymin:l.y-this.Ce,ymax:l.y+this.Ce,tail:h}}};c(FE,"type","Dot");var Pu=FE;nt.register(Pu.type,Pu);var AR=10,SR=10,UE=class UE extends Ln{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"mu");c(this,"$r");c(this,"type",UE.type);c(this,"contentTags",[te]);n=n||{},this.width=n.width||AR,this.height=n.height||SR,this.mu=n.rotate===!0,this.$r=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;if(this.mu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},O,P;this.$r==="center"?(P=rt(e,this.location,this.width/2),O=Ut(P,v,this.width)):(O=v,P=rt(e,this.location,this.width)),S=tr(P,O,this.height),R=tr(O,P,this.height),m=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},O,P;this.$r==="center"?(P=rt(e,this.location,-this.width/2),O=Ut(P,v,this.width)):(O=v,P=rt(e,this.location,-this.width)),S=tr(O,P,this.height),R=tr(P,O,this.height),m=P}else{let v=rt(e,this.location,this.width/2),O=Xr(e,this.location),P=Ut(v,O,this.width);S=tr(v,P,this.height),R=tr(P,v,this.height),m=P}g=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=R[1].x,b=R[1].y,A=R[0].x,T=R[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=Xr(e,this.location),m=v,g=v.x-this.width/2,E=v.y-this.height/2,y=g+this.width,x=E,f=y,b=E+this.height,A=g,T=E+this.height}return h=Math.min(g,y,f,A),d=Math.max(g,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${g} ${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:m}}};c(UE,"type","Rectangle");var Ou=UE;nt.register(Ou.type,Ou);var TR=8,vR=5,YE=class YE extends Ln{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",YE.type);c(this,"contentTags",[GS]);n=n||{},this.rx=n.rx||TR,this.ry=n.ry||vR}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=Xr(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:rt(e,this.location,(this.ry+this.rx)/2)}}};c(YE,"type","Ellipse");var _u=YE;nt.register(_u.type,_u);var Ru=class{constructor(r,e){this.surface=r;c(this,"Kt");c(this,"gu");e=e||{edgeMappings:[]},this.Kt=e.edgeMappings||[],this.gu=this.surface.model.edgeTypeFunction,this.jE()}computeTypes(r){let e=[this.gu(r)];for(let t=0;t<this.Kt.length;t++){let n=this.Kt[t].property,o=this.Kt[t].mappings;if(z(n)){if(r[n]!=null){let s=z(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[Er]!=null&&r[n]!=null&&e.push(`${n}_${Er}`)}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(" ")}jE(){for(let r=0;r<this.Kt.length;r++){let e=this.Kt[r].property,t=this.Kt[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=z(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.Kt}};function n1(i,r,e,t,n,o,s){return new Touch({target:i,identifier:V(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function i1(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function o1(i,r,e,t,n,o,s){return i1(n1(i,r,e,t,n,o,s))}function Ul(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 Lu(i){return i.srcElement||i.target}function US(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 s1(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 a1=1,CR=!1,PR=!1;function wn(){return CR||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function ii(){return PR||"onmousedown"in document.documentElement}function LR(i){CR=i}function wR(i){PR=i}var Yi={[ue]:db,[oe]:ub,[ie]:pb};function YS(i,r){if(i==null)return{x:0,y:0};let e=Uo(i),t=HE(e,0);return r(t)}function me(i){return YS(i,r=>({x:r.pageX,y:r.pageY}))}function l1(i){return YS(i,r=>({x:r.screenX,y:r.screenY}))}function h1(i){return YS(i,r=>({x:r.clientX,y:r.clientY}))}function HE(i,r){return i.item?i.item(r):i[r]}function Uo(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 HS(i){return Uo(i).length}function DR(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=Uo(i),e=HE(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function zE(i,r,e,t,n){_R(i,r,e),t.qt=e.qt,i.addEventListener&&i.addEventListener(r,e,!1,n)}function wu(i,r,e){e!=null&&OR(i,t=>{c1(t,r,e),e.qt!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),wn()&&Yi[r]&&t.removeEventListener(Yi[r],e,!1)),e.Eu&&wu(i,e.Eu[1],e.Eu[0])})}function OR(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 _R(i,r,e){let t=a1++;return i.Br=i.Br||{},i.Br[r]=i.Br[r]||{},i.Br[r][t]=e,e.qt=t,t}function c1(i,r,e){if(i.Br&&i.Br[r]&&delete i.Br[r][e.qt],e.Fr){for(let t=0;t<e.Fr.length;t++)wu(i,e.Fr[t][0],e.Fr[t][1]);e.Fr.length=0}e.Ja&&e.Ja()}var d1=/:not\(([^)]+)\)/;function XE(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(d1);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(Er);let a=l=>{a.qt=e.qt;let h=Lu(l),d=!1,u=h,p=US(l,h,r,i!=null);if(p.end!=-1)for(let m=0;!d&&m<p.end;m++){u=p.path[m];for(let g=0;g<s.length;g++)if(Ul(u,s[g],r))return;for(let g=0;!d&&g<o.length;g++)if(Ul(u,o[g],r)){e.apply(u,[l,u]),d=!0;break}}};return u1(e,t,a),a}}function u1(i,r,e){i.Fr=i.Fr||[],i.Fr.push([r,e])}var jE=(i,r,e,t,n)=>{if(wn()&&Yi[r]){let o=XE(t,i,e,Yi[r]);zE(i,Yi[r],o,e,n)}r===hb&&i.getAttribute(pE)==null&&i.setAttribute(pE,"1"),zE(i,r,XE(t,i,e,r),e,n)},zS={[W]:{touches:1,taps:1},[Fr]:{touches:1,taps:2},[gt]:{touches:2,taps:1}};function RR(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var XS=class{static generate(r,e){return(t,n,o,s)=>{if(n==gt&&ii())jE(t,n,o,s);else{if(t.je==null){let a=t.je={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let m=Lu(p),g=US(p,m,t,s!=null),E=!1;for(let y=0;y<g.end;y++){if(E)return;m=g.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||Ul(m,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let m=Lu(p),g,E;a.taps++;let y=HS(p);for(let x in zS)if(zS.hasOwnProperty(x)){let f=zS[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=US(p,m,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(g=E.path[A],a[x][b][1]==null||Ul(g,a[x][b][1],t)){a[x][b][0].apply(g,[p,g]);break}}}}};t.je.downHandler=d,t.je.upHandler=u,jE(t,ue,d),jE(t,oe,u)}t.je.downSelectors.push(s),t.je[n].push([o,s]),o.Ja=function(){t.je!=null&&(_t(t.je.downSelectors,a=>a===s),s1(t.je[n],o),t.je.downSelectors.length===0&&(wu(t,ue,t.je.downHandler),wu(t,oe,t.je.upHandler),delete t.je))}}}}},jS=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=Lu(l);(o==null&&h==e&&!e.Me.over||Ul(h,o,e)&&(h.Me==null||!h.Me.over))&&(RR(Cg,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=Lu(l);for(let d=0;d<r.length;d++)h==r[d]&&!Ul(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),RR(Pg,l,e,h))};zE(e,tt,XE(o,e,s,tt),s),zE(e,et,XE(o,e,a,et),a)}n.Ja=function(){delete e.Me[t][n.qt]},_R(e,t,n),e.Me[t][n.qt]=n}}},fe=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=jS.generate(),this.tapHandler=XS.generate(this.clickThreshold,this.dblClickThreshold)}kE(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Fr||e===gt?this.tapHandler(s,e,t,n,o):e===Cg||e==Pg?this.mouseEnterExitHandler(s,e,t,n,o):jE(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.kE(r,e,a,s,o),this}off(r,e,t){return wu(r,e,t),this}trigger(r,e,t,n,o){let s=ii()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=wn()&&!ii()&&Yi[e]?Yi[e]:e,l=!(wn()&&!ii()&&Yi[e]),h=me(t),d=l1(t),u=h1(t);return OR(r,p=>{let m;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let g=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=o1(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&&wn()&&Yi[e],x=y?"TouchEvent":"MouseEvents";m=document.createEvent(x),E[x](m),g(m),p.dispatchEvent(m)}),this}};var p1=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function ce(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 $(i,r,e,t){return r=r||{},ta(Wt,i,e,t,r)}function NR(i,r){let e=r.map(t=>$("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function m1(i,r){i.gradient==null&&(i.gradient=$("linearGradient",{id:Vm(),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}`),NR(i.gradient,r)}function kS(i,r,e){let t=Vm(),n=$("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return NR(n,e),{id:t,g:n}}function kE(i,r,e,t){r.setAttribute(IS,e.fill?e.fill:ht),!t&&e.gradient?(m1(i,e.gradient),r.setAttribute(wE,`url(#${i.gradient.id})`)):r.setAttribute(wE,e.stroke?e.stroke:ht),e.strokeWidth&&r.setAttribute(MS,e.strokeWidth),e.dashArray?r.setAttribute(NE,e.dashArray):r.removeAttribute(NE),p1.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function ea(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function g1(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...E1(o,r,e))}),t}function E1(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=$(DE);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 f1(i,r,e){return g1(i,r,e).map(t=>{let n=$(DE);return n.innerHTML=t,n})}function Du(i,r,e){let n=i.getAttribute(Q)||"50%",o=f1(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(Q,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 WE="data-vjs-container",ZE="data-vjs-group-content",Nu="data-vjs-expanded-content",Iu="data-vjs-collapsed-content",fr="data-vjs-enabled",Yl="data-vjs-scope",zl="data-vjs-is-group",y1="endpoint",x1="element",b1="connection",He="div",JE="position",Zr=X(Zs),A1=be(qA),WS=be(ZE),Dn=X(Js),ZS=X(iu);function Mt(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 ae(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Zt(i,r,e,t){if(t&&Mt(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if(Mt(i,r))return i;i=i.parentNode}}function S1(i,r,e){e=e||document.body;let t=[],n=Zt(i,r,e,!1);for(;n!=null;)t.push(n),n=Zt(n,r,e,!1);return t}function Yo(i){return i.srcElement||i.target}function IR(i,r){r=bt(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function KE(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function MR(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=KE(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),IR(i,s.join(" "))}function Nn(i){return!z(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function T1(i){return!z(i)&&(Array.isArray(i)||Nn(i))}function KS(i){return!z(i)&&(Array.isArray(i)||Nn(i))}function qS(i){return KE(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?bt(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):MR(t,n))};Nn(i)?i.forEach(t=>e(t,r)):e(i,r)}function an(i,r){return i.classList?i.classList.contains(r):KE(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?bt(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):MR(t,null,n))};Nn(i)?i.forEach(t=>e(t,r)):e(i,r)}function qE(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):an(t,n)?F(t,n):L(t,n))};Nn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Vt(i,r=[],e=[]){let n=KE(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),IR(i,n.join(" "))}function QS(i,r){let e=null;if(arguments.length===1){if(!z(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 ta(null,i,r,e,t)}function ta(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),ce(o,n||{}),o}function Kr(i,r,e,t,n,o,s){let a=ta(i,r||He,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function zi(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 Mu(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function Ot(i){return Mu(i)==="SVG"}function Xi(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var JS=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 ra(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function na(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===zt?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 Vu(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 eT(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function v1(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function qr(i,r){return"["+i+"='"+r+"']"}function C1(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function P1(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function X(...i){return i.map(r=>"."+r).join(",")}function O1(...i){return i.join(" ")}function be(...i){return i.map(r=>"["+r+"]").join(",")}var Xl=be(Pt);function jl(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var VR="deltaY",GR="deltaX",_1="wheelDeltaY",R1="wheelDeltaX",QE="webkit",Hl="mac",Gu="win",tT="ie",rT="safari",nT="firefox",iT="default";function $R(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function BR(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var oT={[QE]:{[Hl]:jl(VR,120),[Gu]:jl(VR,100)},[rT]:jl(_1,120,!0),[nT]:{[Hl]:$R,[Gu]:$R},[tT]:function(i){return i.wheelDelta/120},[iT]:function(i){return i.deltaY||i.wheelDelta}},sT={[QE]:{[Hl]:jl(GR,120),[Gu]:jl(GR,100)},[rT]:jl(R1,120,!0),[nT]:{[Hl]:BR,[Gu]:BR},[tT]:function(i){return i.wheelDelta/120},[iT]:function(i){return i.deltaX||i.wheelDelta}},FR=typeof navigator!="undefined",UR=FR?/Mac/.test(navigator.userAgent)?Hl:Gu:Hl,kl=FR?navigator.userAgent.indexOf("Firefox")!==-1?nT:/Chrome/.test(navigator.userAgent)?QE:/Safari/.test(navigator.userAgent)?rT:/WebKit/.test(navigator.userAgent)?QE:/Trident/.test(navigator.userAgent)?tT:"default":iT,L1=typeof oT[kl]=="function"?oT[kl]:oT[kl][UR],w1=typeof sT[kl]=="function"?sT[kl]:sT[kl][UR],D1=function(i){return L1(i||event)},N1=function(i){return w1(i||event)},I1=function(i,r,e){let t=n=>{let o=D1(n),s=N1(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.HE=t,t},M1=typeof document!="undefined",YR=M1?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function Wl(i,r,e,t){let n=I1(r,e,t);return i.addEventListener?i.addEventListener(YR,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function Zl(i,r){let e=r.HE;e!=null&&(i.removeEventListener?i.removeEventListener(YR,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function aT(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var lT="vjs-paper",hT="vjs-paper-canvas",cT=20,V1="vjs-paper-node",Jl="start",zo="center",Kl="end";function dT(i){return kr(i)&&i.useHTMLElement===!0}var ql=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(He,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(Ze,t.edge.id),e.contentElement.setAttribute(nu,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=je,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,wl),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 uT(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[nu]:r.id},r.attributes);e.forEach(n=>{let o=$(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.component)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&ea(n,t,-1)}}),r.contentElements}function pT(i,r,e,t){let n=r;uT(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);ce(a,d)})}function Ql(i,r){return uT(i,r,r.contentTags)}function Xo(i,r){return uT(i,r,[q]),r.bgElement==null&&(r.bgElement=$(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=$(Je),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function mT(i,r,e,t){Xo(i,r);let n=Tr(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:"translate("+o[0]+","+o[1]+")"};r.font&&r.font.size&&(s["font-size"]=r.font.size),r.font&&r.font.style&&(s["font-style"]=r.font.style),r.font&&r.font.family&&(s["font-family"]=r.font.family),ce(r.textElement,s),r.textElement.textContent=n;let a=r.textElement.getBBox(),l=i.currentZoom,h=a.width/l,d=a.height/l,u=5,p={transform:"translate("+o[0]+","+o[1]+")",x:s.x-u-h/2,y:s.y-u-d/2,width:h+2*u,height:d+2*u,fill:n==null||n.length===0?"none":"white"};ce(r.bgElement,p)}function ef(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 $u=class extends ri{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var oi="transform",gT=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,zR=/rotate\(([-0-9\.]+)\)/;function it(i){let r=i;return r.width&&r.width.baseVal?Y1(r):r.getBBox?z1(r):G1(i)}function hn(i,r){let e=i;return Ot(i.parentElement)?eh(e,r):e.x&&e.x.baseVal?F1(e):$1(e)}function Ce(i,r){let e=i;Ot(i.parentElement)?ln(e,r):(e.x&&e.x.baseVal&&U1(e,r),Jt(e,r))}function XR(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=eh(o);s[n]=r,ln(o,s)}}function ET(i,r){XR(i,r,Ye,Q,Q)}function fT(i,r){XR(i,r,Se,Ee,Ee)}function Rr(i,r,e){let t=i;t instanceof HTMLElement?jR(i,r,e):t.width&&t.width.baseVal&&(jR(i,r,e),i.setAttribute(Te,`${r}`),i.setAttribute(De,`${e}`))}function yT(i,r){let e=i;e instanceof HTMLElement?HR(i,r):e.width&&e.width.baseVal&&(HR(i,r),i.setAttribute(Te,`${r}`))}function xT(i,r){let e=i;e instanceof HTMLElement?kR(i,r):e.height&&e.height.baseVal&&(kR(i,r),i.setAttribute(De,`${r}`))}function G1(i){return{width:i.offsetWidth,height:i.offsetHeight}}function $1(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function B1(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function Jt(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function jR(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function HR(i,r){i.style.width=`${r}px`}function kR(i,r){i.style.height=`${r}px`}function F1(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function U1(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function Y1(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function z1(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function eh(i,r){let e,t,n,o,s;if(e=i.getAttribute(oi),e!=null){if(t=e.match(gT),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(zR),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=xt(h,{x:o,y:s},a),u=xt({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(gT);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function jo(i,r){if(Ot(i.parentElement)){let t=(i.getAttribute(oi)||"").match(gT);i.setAttribute(oi,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else i.style.transform=r==0?"":"rotate("+r+"deg)",i.style.transformOrigin="center center"}function ln(i,r){let t=(i.getAttribute(oi)||"").match(zR);i.setAttribute(oi,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}var Bu=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[Te]:""+(n[0]||0),[De]:""+(n[1]||0)};ce(r.canvas,o),Ce(r.canvas,r)}}}};var tf="vjs-surface",bT="vjs-surface-direct-render",AT="vjs-surface-touch-device",ST="vjs-surface-pointer-device",rf="vjs-surface-nopan",nf="vjs-surface-canvas",of="vjs-surface-pan",X1="vjs-surface-pan-left",j1="vjs-surface-pan-top",H1="vjs-surface-pan-right",k1="vjs-surface-pan-bottom",sf="vjs-surface-pan-active",af="vjs-surface-flash",TT="vjs-flash-vertex",lf="vjs-surface-panning",hf="vjs-surface-element-dragging",th="vjs-element-dragging",cf="vjs-group-child-element-dragging",rh="vjs-most-recently-dragged",In="vjs-surface-edge-dragging",df="vjs-edge-relocating",Fu="vjs-edge-will-relocate",vT="vjs-lasso",nh="vjs-lasso-mask",CT="vjs-lasso-mask-left",PT="vjs-lasso-mask-top",OT="vjs-lasso-mask-right",_T="vjs-lasso-mask-bottom",Uu="vjs-miniview",RT="vjs-miniview-canvas",LT="vjs-miniview-panner",wT="vjs-miniview-element",DT="vjs-miniview-group-element",uf="vjs-miniview-panning",NT="vjs-miniview-collapse",Yu="vjs-miniview-collapsed",IT="vjs-miniview-click-to-center",ct="vjs-drag-select-defeat",pf="vjs-default-node",mf="vjs-default-group",ji="vjs-connector-source-drag",Hi="vjs-connector-target-drag",MT="vjs-connector-transient-drag",Ho="vjs-palette-selected-element",ih="vjs-palette-tap-mode-active",VT="vjs-palette-current",zu="vjs-palette-current-shape-type",ko="vjs-drag-hover-cannot-drop",gf="vjs-drag-original-group",Kt="vjs-drag-active",qt="vjs-drag-hover",Ef="vjs-source-hover",ff="vjs-target-hover",oh="vjs-hover";function W1(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 GT(i,r,e){WR(i,r);let t=r.connector;Bu.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=wA(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[Ze]:r.edge.id},a=W1(i,e);a!=null&&(t.bgPath==null?(t.bgPath=$(te,s),L(t.bgPath,i.connectorOutlineClass),ea(t.canvas,t.bgPath,0)):ce(t.bgPath,s),kE(t,t.bgPath,a,!0)),t.path==null?(t.path=$(te,s),ea(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&&ea(t.canvas,t.path,a!=null?1:0),ce(t.path,s)),kE(t,t.path,e,!1),r.detachable&&Z1(r,o,i.defaults.edgeRelocateHandleSize)}}function Z1(i,r,e){if(i.detachable){let t=i.connector,n=t.internalSegments[0].x1,o=t.internalSegments[0].y1,s={width:e,height:e,transform:`translate(${r.x-e/2},${r.y-e/2})`,"pointer-events":"fill",cursor:"move"},a=Object.assign(s,{x:n,y:o});t.sourceZone==null?(t.sourceZone=$(Z,a),L(t.sourceZone,ji),t.canvas.appendChild(t.sourceZone)):ce(t.sourceZone,a);let l=t.internalSegments[t.internalSegments.length-1].x2,h=t.internalSegments[t.internalSegments.length-1].y2,d=Object.assign(s,{x:l,y:h});t.targetZone==null?(t.targetZone=$(Z,d),L(t.targetZone,Hi),t.canvas.appendChild(t.targetZone)):ce(t.targetZone,d)}}function WR(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?$(ve,{[Te]:"0",[De]:"0",style:{"pointer-events":ht,position:je},[Ze]:r.edge.id}):$(q,{[Ze]: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 yf=class{constructor(r,e){this.container=r;c(this,"Qt",!0);c(this,"ge");c(this,"Ka");c(this,"Pi");c(this,"qa");c(this,"ke");c(this,"fu");c(this,"rt");c(this,"er");c(this,"rr",{});c(this,"Sn",[]);c(this,"H");c(this,"Ur");c(this,"_i");c(this,"Ri");c(this,"Li");c(this,"Qa");e=e||{init:null},this.ge=new fe,this.Ka=this.WE.bind(this),this.ge.on(r,ue,"*",this.Ka),this.Pi=this.ZE.bind(this),this.qa=this.JE.bind(this),this.Li=e.translate||(t=>Object.assign({},t)),this.Qa=e.init}$enable(){this.Qt=!0}$disable(){this.Qt=!1}addHandler(r){let e=this.rr[r.selector];e==null&&(this.rr[r.selector]=[],e=this.rr[r.selector],this.Sn.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.rr[r.selector];e!=null&&(this.rr[r.selector]=e.filter(t=>t!==r),this.rr[r.selector].length===0&&(delete this.rr[r.selector],this.Sn=this.Sn.filter(t=>t!==r.selector)))}WE(r){if(!this.Qt||r.KE===!0)return;let e=!1;this.rt=r.target;let t=()=>{e||(e=!0,this.Qa&&this.Qa(r),this.er=it(this.rt),this.ke=null,this.H=me(r),this._i=this.Li(this.H),this.Ur=Object.assign({},this.H),this.Ri=Object.assign({},this._i))};for(let n=0;n<this.Sn.length;n++)if(Mt(this.rt,this.Sn[n],this.container)){let o=this.rr[this.Sn[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.rt,l=this.er;if(o[s].target){if(a=this.rt.closest(o[s].target),a==null)continue;l=it(a)}if(this.fu=o[s].start({pagePosition:this.H,e:r,el:a,size:l,translatedPosition:this._i}),this.fu!==!1){this.rt=a,this.er=l,this.ke=o[s],ae(r),r.KE=!0;break}}}}this.ke!=null&&(this.ge.on(document,ie,this.Pi),this.ge.on(document,oe,this.qa))}ZE(r){if(!this.Qt)return;let e=me(r),t=this.Li(e);this.ke!=null&&(this.ke.constrainFunction&&(this.ke.usesPageCoordinates?(e=this.ke.constrainFunction(e,this.rt,{width:0,height:0},this.er,this.Ur,r),t=this.Li(e)):t=this.ke.constrainFunction(t,this.rt,{width:0,height:0},this.er,this.Ri,r)),this.ke.drag({e:r,el:this.rt,pagePosition:e,size:this.er,originalPagePosition:this.H,translatedPosition:t,originalTranslatedPosition:this._i}),this.Ur=e,this.Ri={x:t.x,y:t.y})}JE(r){this.Ur=me(r),this.Ri=this.Li(this.Ur),this.ke!=null&&this.ke.stop({e:r,el:this.rt,pagePosition:this.Ur,size:this.er,originalPagePosition:this.H,translatedPosition:this.Ri,originalTranslatedPosition:this._i}),this.ie()}ie(){this.ge.off(document,ie,this.Pi),this.ge.off(document,oe,this.qa),this.ke=null,this.rt=null,this.er=null,this.H=null,this.Ur=null}destroy(){this.ge.off(this.container,ue,this.Ka),this.ie()}};var Xu={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},sh="start",ah="center",lh="end",J1="Default",K1="Default shapes",$T="vjs-shape",ju="vjs-shape-label",hh="vjs-shape";var q1="http://www.w3.org/2000/svg",Q1="http://www.w3.org/1999/xlink",eV="svg",tV="xlink",rV="html";function xf(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var Wo=class extends To{constructor(r){super(r),this.namespaceHandlers[eV]=e=>document.createElementNS(q1,e.split(":")[1]),this.namespaceHandlers[rV]=e=>document.createElement(e.split(":")[1]),this.namespaces[tV]=Q1}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Nd(){return xf}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function yr(i){return new Wo(i||{})}var Hu="link",ku="clone",Wu="trash",BT="cross",FT="plus",UT="circle",YT="gear",ZR={x:0,y:0,width:32,height:32},ch={[ku]:{id:ku,viewBox:ZR,shapes:[{tag:te,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"}}]},[Hu]:{id:Hu,viewBox:ZR,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:ze,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:te,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:te,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[Wu]:{id:Wu,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:te,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:te,atts:{d:"M 12 26 L 10 8"}},{tag:te,atts:{d:"M 20 26 L 22 8"}},{tag:te,atts:{d:"M 16 26 L 16 8.5"}}]},[BT]:{id:BT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:te,atts:{d:"M 2 2 L 30 30"}},{tag:te,atts:{d:"M 30 2 L 2 30"}}]},[FT]:{id:FT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:te,atts:{d:"M 16 2 L 16 30"}},{tag:te,atts:{d:"M 2 16 L 30 16"}}]},[UT]:{id:UT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ze,atts:{cx:16,cy:16,r:15}}]},[YT]:{id:YT,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:te,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 nV(i,r){let e=typeof i=="string"?ch[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function Zu(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=$(ve,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=$(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function Ju(i,r,e,t,n,o,s){return Zu(ch[i],r,e,t,n,o,s)}var iV={x:0,y:0,width:32,height:32},oV={stroke:"currentColor",fill:"none"},bf=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return ch[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)||ch[r];if(!n){this.innerHTML="";return}let o=n.viewBox||iV,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=gi(gi({},oV),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",bf);var sV="label",JR="transform",KR="x",qR="y",Ku="origin",XT="originX",jT="originY",QR="orientation",HT="size",kT="key",eL="iconId",dh="middle",zT="type",Af="category",WT="horizontal",aV="vertical",qu="vjs-shape-icon",tL="vjs-include-icon",rL="vjs-include-icons",lV="category",hV="type",Wi="__vjsRootSet",ki=sV,Sf="fill",uh="outline",ph="outlineWidth",Tf="color",mh="#FFFFFF",Zo="#000000",gh=2,ZT="#000000",nL=.8,ia=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="${qu}" 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||hV,this.categoryParameter=e.categoryParameter||lV,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||nL,this.labelPosition=e.labelPosition||"center",this.qE(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:xe,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.QE(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||ki)}qE(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=fs(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,Wi),parent:null,id:Wi,name:Wi,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}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.ef()):t.template}getCompiledShape(r,e){let t=this.tf(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)}rf(r){r.setAttribute&&r.setAttribute(yu,xu),r.hasChildNodes&&r.childNodes.forEach(e=>this.rf(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||ki;let l=$(Je,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":dh,"dominant-baseline":dh,class:ju,"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}tf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}nf(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:dh,dominantBaseline:dh},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:dh,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:dh,dominantBaseline:"auto"}}[r]}of(r,e,t=ki){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:m,y:g,transform:E,textAnchor:y,dominantBaseline:x}=this.nf(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${Nu}>${s.template}</svg:g><svg:g ${Iu}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${m}" y="${g}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${ju}" 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[`${xe}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=ki,s=mh,a=Zo,l=Zo,h=gh){return e=e||h,{template:r?`<svg:g class="${hh}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
|
|
5
|
+
<r-fragment key="${Af}:${zT}"/>
|
|
6
6
|
</svg:g>`:`<svg:svg class="${hh}" fill="{{fill}}" stroke="{{outline}}" viewBox="0 0 {{width}} {{height}}" preserveAspectRatio="none" stroke-width="{{outlineWidth}}">
|
|
7
|
-
<r-fragment key="${
|
|
8
|
-
</svg:svg>`,fragments:{[`${
|
|
7
|
+
<r-fragment key="${Af}:${zT}"/>
|
|
8
|
+
</svg:svg>`,fragments:{[`${Af}:${zT}`]:this.of(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:[Af],rendered:(d,u,p,m)=>{this.refresh(d,u,o)},updated:(d,u,p)=>{this.refresh(d,u,o)},mounted:(d,u,p,m)=>{this.$applyMultilineLabel(d.querySelector(X(ju)),u,o)}}}ef(){return'<svg:rect x="0" y="0" width="{{width}}" height="{{height}}"/>'}yu(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;Du(r,e[t],s)}}}QE(r,e){Array.from(r.querySelectorAll(`svg.${qu}:not(:scope .vjs-group *, :scope .vjs-node *)`)).forEach(t=>t.parentNode.removeChild(t)),Array.from(r.querySelectorAll(tL)).forEach(t=>{let n=t.getAttribute(kT),o=n!=null?e[n]:t.getAttribute(eL);if(o!=null){let s=this.yu(o,e.category);if(s!=null){let a=parseFloat(t.getAttribute(KR))*e.width,l=parseFloat(t.getAttribute(qR))*e.height,h=Math.min(e.width,e.height),d=parseFloat(t.getAttribute(HT))*h,u=t.getAttribute(XT)||t.getAttribute(Ku)||sh,p=t.getAttribute(jT)||t.getAttribute(Ku)||sh,m=Zu(s,d,d,[qu],{[yu]:xu,x:a,y:l},r),g=u===ah?-d/2:u===lh?-d:0,E=p===ah?-d/2:p===lh?-d:0;m.setAttribute(JR,`translate(${g}, ${E})`)}}}),Array.from(r.querySelectorAll(rL)).forEach(t=>{let n=t.getAttribute(kT),o=e[n];if(o!=null&&o.length>0){let s=Math.min(e.width,e.height),a=parseFloat(t.getAttribute(HT))*s,l=t.getAttribute(XT)||t.getAttribute(Ku)||sh,h=t.getAttribute(jT)||t.getAttribute(Ku)||sh,d=$(q),u=(t.getAttribute(QR)||WT)===WT;r.appendChild(d);let p=0,m=5,g=0;o.forEach(T=>{let S=this.yu(T,e.category);S!=null&&(Zu(S,a,a,[qu],{[yu]:xu,x:p,y:g},d),u?p+=a+m:g+=a+m)});let E=parseFloat(t.getAttribute(KR))*e.width,y=parseFloat(t.getAttribute(qR))*e.height,x=u?p-m:0,f=u?0:g-m,b=l===ah?-x/2:l===lh?-x:0,A=h===ah?-f/2:h===lh?-f:0;d.setAttribute(JR,`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=$(ve),e=$(VS);return r.appendChild(e),this.getDefsElements().forEach(t=>{e.appendChild(t)}),r}};var cV={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}}"/>
|
|
@@ -40,12 +40,12 @@ var uc=Object.defineProperty,uD=Object.defineProperties,gO=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 oa=class extends vc{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var tp=class extends oa{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 rp=class extends oa{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||K(e))&&e.group==this.group}};var np=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?Ne.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 ip=class extends Id{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new np(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function ai(i){return kr(i)&&i.useHTMLElement!==!0}function Ko(i){return i.isSimpleShape}function uV(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function pV(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function sa(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=ql.getElement(r,i,i.component);return L(e,r.labelOverlayClass),e}else return jo(r,i),i.textElement}function Eh(i,r){return ql.getElement(r,i,i.component,e=>{let t=i.create(e);return L(t,r.overlayClass),t})}var aa=class extends Cu{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);this.model=e;c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"I");c(this,"nl");c(this,"xu");c(this,"Tn");c(this,"nr");c(this,"Ve");c(this,"ir");c(this,"bu");c(this,"ge");c(this,"il");c(this,"Au",new Set([_l,tu,Io,Mo,ru,ri,Vo,nu,Gi,iu]));c(this,"nt",null);c(this,"Di",[]);if(o=o||{},a=a||{},this.ge=new fe,this.clipboard=new ip(this),this.I=s,this.containerType=Gu(this.getContainer()),this.bu=a.hoverEvents!==!1,this.ir=Xl,this.nl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.xu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.il=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new wu(this,{edgeMappings:o.edges.propertyMappings})),this.Tn=[],this.Su(),this.on(n,"animationend",X($i,Go),h=>{let d=h.target;d.style.animation=null,F(d,lf)}),a.resizeObserver!==!1)try{this.Ve=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,Pt);if(p!=null){let m={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},g=this.viewport.getElement(p);g!=null&&(g.width!==m.width||g.height!==m.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u))}})})}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 ia(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||$T,h),this.sf()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((K(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(Ot(n.parentElement)){let s=xt(e,e.c,e.r);o(s),ln(n,s),Ho(n,e.r)}else{Ho(n,e.r);let s=rr(e);o(s),Ce(n,s)}t&&(this.$repaintUIElement(e),this.le(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.Au.add(t))}$enableVertexDrag(){this.nr.$enable()}$disableVertexDrag(){this.nr.$disable()}$canDrop(e,t,n){return this.il!=null?this.il(e,t,n):!0}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.I.usesWrapperElement&&t.firstElementChild!=null&&this.Au.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new tp(this)}$createGroupLayoutAdapter(e){return new rp(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.")}sf(){this.nt=this.getShapeLibrary().getSvgDefsElement(),this.nt.style.position="absolute",this.nt.style.width="1px",this.nt.style.height="1px",this.nt.style.left="-10000px",this.nt.style.top="-10000px",this.getContainer().appendChild(this.nt)}af(e,t,n){let s=["edge",t].join(":");if(n.lf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.wi(t,s,e.component,n,e)}$isAsynchronousRender(){return this.I.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:ht}$doVertexUpdated(e){this.I.reactive===!1&&this.I.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.I.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.me,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.me,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(Xl);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return qS(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return an(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){QE(e,t)}$updateElementClasses(e,t,n){Vt(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.ge.on(a,t,n):this.ge.on(a,t,n,o)};return Nn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Nn(e)?e.forEach(o=>this.ge.off(o,t,n)):this.ge.off(e,t,n),this}trigger(e,t,n,o,s){this.ge.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return zi(e)}hf(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=hn(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,o=this.getContainer(),s=hn(n,t);if(this.hf(n,s,o),o!=null&&!isNaN(o.scrollTop)&&!isNaN(o.scrollLeft)&&(o.scrollTop>0||o.scrollLeft>0)){let a=n.offsetParent!=null?this.$getStyle(n.offsetParent,KE):KA,l=this.$getStyle(n,KE);l!==je&&l!==mE&&a!==je&&a!==mE&&(s.x-=o.scrollLeft,s.y-=o.scrollTop)}return s}$setElementSizeInUI(e,t,n){Rr(e,t,n)}$setElementWidth(e,t){yT(e,t)}$setElementHeight(e,t){xT(e,t)}$getSize(e){return it(e)}$setElementRotation(e,t){Ho(e,t)}$getElementPositionInUIRelativeToParent(e){return hn(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==Rx?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,WS);return t&&t.length>0?t[0]:this.I.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return QS.apply(null,arguments)}$setViewportElementPosition(e,t){if(e.r!==0)if(Ot(e.el.parentElement)){let n={x:t.x+e.width/2,y:t.y+e.height/2},o=xt(t,n,e.r);ln(e.el,o),Ho(e.el,e.r)}else Ce(e.el,t);else Ce(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,At))}isDraggable(e){let t=this.$getAttribute(e,_l);return t==null||t===at}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}wi(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||vE}ds(e,t){let o=Zt(zo(t),Dn,this.getContainer(),!0).jtk.overlay;o&&this.af(o,e,t)}df(e){this.ds(Ue,e)}uf(e){this.ds(yo,e)}pf(e){this.ds(W,e)}mf(e){this.ds(Fr,e)}us(e,t,n){if(!n.defaultPrevented&&n.lf==null){let o=Zt(zo(n),Zr,this.getContainer(),!0);this.wi(e,t,o.jtk.connection,n,null)}}gf(e){this.us(Ue,Tb,e)}Ef(e){this.us(yo,vb,e)}ff(e){this.us(W,_b,e)}yf(e){this.us(Fr,Cb,e)}Tu(e,t){let o=Zt(zo(t),Dn,this.getContainer(),!0).jtk.overlay;o&&this.vu(o.component,e,t)}xf(e){this.Tu(!0,e)}bf(e){this.Tu(!1,e)}vu(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(Ze)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(Ze)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(Ze)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Vt(e.sourceElement,[ff]),Vt(e.targetElement,[yf])):(Vt(e.sourceElement,[],[ff]),Vt(e.targetElement,[],[yf]));let a=t?tt:et,l=t?Ed:gd;this.wi(a,l,e,n,null)}}Cu(e,t){var o;let n=zo(t).parentNode;this.vu((o=n.jtk)==null?void 0:o.connection,e,t)}Af(e){this.Cu(!0,e)}Sf(e){this.Cu(!1,e)}Ou(e,t){let n=zo(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(ji)&&!o.classList.contains(Hi)){let s=e?oe:ue,a=e?Pb:ml;this.wi(s,a,n.jtk.connection,t,null)}}}Tf(e){this.Ou(!0,e)}vf(e){this.Ou(!1,e)}Cf(e){let t=zo(e).parentNode;t.jtk&&t.jtk.connection&&this.wi(gt,Ob,t.jtk.connection,e,null)}Of(e){let t=this.getModelObjectFromElement(e.target,!0,!1);if(t!=null)return{el:t.el,obj:t.obj,e,model:this.model,ui:this}}or(e,t,n){if(!e.defaultPrevented){let o=this.Of(e);if(o!=null){let s=K(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):H(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}Pf(e){this.or(e,Ue,gb)}_f(e){this.or(e,yo,Eb)}Rf(e){this.or(e,W,Sb)}Lf(e){this.or(e,Fr,fb)}wf(e){this.or(e,gt,Ab)}Df(e){this.or(e,et,yb)}Nf(e){this.or(e,tt,xb)}If(e){this.or(e,ie,bb)}Mf(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}Vf(e,t,n){let o=n.bind(this);this.Tn.push({eventName:e,handler:o}),this.ge.on(this.getContainer(),e,t,o)}addDragHandler(e){this.nr==null?this.Di.push(e):this.nr.addHandler(e)}Gf(){this.nr!=null&&this.nr.destroy(),this.Di=this.Di||[],this.nr=new xf(this.me,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.Pu(e)}),this.Di.forEach(e=>this.nr.addHandler(e)),this.Di.length=0}Pu(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=se(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.ps(de.objectType,this.getContainer())}$getGroupsInViewport(){return this.ps(le.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return wn()}$isArrayLike(e){return super.$isArrayLike(e)||Nn(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(),ke(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}Su(){if(this.Tn!=null){this.ol();let e=[[Ue,Dn,this.df],[yo,Dn,this.uf],[W,Dn,this.pf],[Fr,Dn,this.mf],[Ue,Zr,this.gf],[yo,Zr,this.Ef],[W,Zr,this.ff],[Fr,Zr,this.yf],[Ue,this.ir,this.Pf],[yo,this.ir,this._f],[W,this.ir,this.Rf],[Fr,this.ir,this.Lf],[W,ZS,this.Mf],[gt,Zr,this.Cf],[oe,Zr,this.Tf],[ue,Zr,this.vf],[gt,Xl,this.wf]];this.bu===!0&&e.push.apply(e,[[tt,Zr,this.Af],[et,Zr,this.Sf],[tt,Dn,this.xf],[et,Dn,this.bf],[et,this.ir,this.Df],[tt,this.ir,this.Nf],[ie,this.ir,this.If]]),e.forEach(t=>{this.Vf(t[0],t[1],t[2])})}}ol(){let e=this.getContainer();e&&this.Tn!=null&&(this.Tn.forEach(t=>{this.ge.off(e,t.eventName,t.handler)}),this.Tn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.ol(),this.$setAttribute(e,ZE,V().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(ZE),Array.from(t.childNodes).filter(o=>o!=null&&(an(o,Zs)||an(o,Js)||o.getAttribute&&o.getAttribute(Pt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=Gu(e),this.ge!=null&&(this.Gf(),this.Su())}reset(){super.reset(),this.Ve&&this.Ve.disconnect(),this.getContainer().querySelectorAll([Xl,Zr,Dn].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.nt!=null&&this.nt.parentNode!=null&&this.nt.parentNode.removeChild(this.nt),this.ol(),super.destroy()}$__unmanage(e,t,n){this.Ve!=null&&this.Ve.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(Ko(e))Ql(this,e).map(n=>L(n,t));else if(ai(e))jo(this,e).map(n=>L(n,t));else if(kr(e))L(sa(e,this),t);else if(sn(e))L(Eh(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(Ko(e))Ql(this,e).map(n=>F(n,t));else if(ai(e))jo(this,e).map(n=>F(n,t));else if(kr(e))F(sa(e,this),t);else if(sn(e))F(Eh(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.sl(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.sl(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.sl(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(H(e))return this.getPortDefinition(e);if(K(e))return this.getNodeDefinition(e)}sl(e){return e!=null&&e.template&&e.templateId==null&&this.I.addTemplate&&(e.templateId=V(),this.I.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.I.recado!=null&&this.I.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),m=a,g;m=Object.assign({},l?l.parameters||{}:{}),Object.assign(m,a);let E={};for(g in m)m.hasOwnProperty(g)&&m[g]!=null&&(m[g].constructor==Function?E[g]=m[g](a):E[g]=m[g]);if(m=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);m[this.$modelWidthAttribute]=x.width,m[this.$modelHeightAttribute]=x.height}d?this.I.rerender(y,m,this.model,e,this,l,s,h,u):this.I.render(y,m,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.nl(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.nl(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.xu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(Ko(e))pT(this,e,t,n);else if(ai(e))mT(this,e,t,n);else if(kr(e)){sa(e,this);let o=t,s=e;s.contentElement.style.left=o.d.minx+jr,s.contentElement.style.top=o.d.miny+jr}else if(sn(e)){let o=Eh(e,this),s=t,a=e;if(e.location===0||e.location===1){let h=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(o,{"data-anchor-x":`${h.x}`,"data-anchor-y":`${h.y}`,"data-anchor-ox":`${h.ox}`,"data-anchor-oy":`${h.oy}`})}a.contentElement.style.left=s.d.minx+jr,a.contentElement.style.top=s.d.miny+jr}else throw"Could not paint overlay of type ["+e.type+"]"}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,wl):L(o,wl))}if(Ko(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else ai(e)?e.contentElements&&e.contentElements.forEach(n):kr(e)?n(sa(e,this)):sn(e)&&n(Eh(e,this))}$reattachOverlay(e,t){Ko(e)?Ql(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):ai(e)?jo(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):kr(e)?this.$appendElement(sa(e,this),this.getContainer()):sn(e)&&this.$appendElement(Eh(e,this),this.getContainer())}$setOverlayHover(e,t){let n;Ko(e)?n=Ql(this,e):ai(e)?n=jo(this,e):kr(e)?n=[sa(e,this)]:sn(e)&&(n=[Eh(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Vt(o,t?[oh]:[],t?[]:[oh])}),this.$setHover(e.component,t))}destroyOverlay(e){Ko(e)&&e instanceof Fu?tf(e):ai(e)?tf(e):dT(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):sn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(Ko(e))return e.draw(t,n,o);if(ai(e)){let s=Xr(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth;return{d:{loc:s},"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)||sn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let h=e.location,d=!1;(z(e.location)||e.location<0||e.location>1)&&(h=parseInt(""+e.location,10),d=!0),s=Xr(t,h,d)}let a=s.x,l=s.y;return{d:{minx:a,miny:l,cxy:s},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=sa(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){GT(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&&Vt(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Vt(o,t?[oh]:[],t?[]:[oh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.Qo===Fi&&this.setOverlayVisible(s,t)}),this.pt||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&pV(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){uV(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.I.cleanupVertex(e.node.id,t.el),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.I.cleanupVertex(e.group.id,t.el),t}addClass(e,t){e.constructor===mr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.al(e,t,L)}removeClass(e,t){e.constructor===mr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.al(e,t,F)}toggleClass(e,t){e.constructor===mr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.al(e,t,QE)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?an(n.el,t):Xi(e)?an(e,t):!1}}al(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):Xi(s)&&n(s,t)};e!=null&&(Nn(e)?n(e,t):KS(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){kt.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!Ot(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.Ve!=null&&this.Ve.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Zt(e,be(on),this.getContainer(),!0)||Zt(e,be(ee),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!Ke(h.obj)){l=h.obj;let u=h.missingPortCreated,p=H(l)?l.getParent():l,m={},g=t?ri:Gi;if(o=e.getAttribute(g)||e.getAttribute(Hr),!H(l)){let E=t?[Mo,ru]:[Vo,nu];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(on)||e.getAttribute(Rl),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return H(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?m=this.view.getPortDefinition(o):m=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:m,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return Xi(e)}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.component.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(ee);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(on)||s.getAttribute(Mo)||s.getAttribute(Vo);if(h!=null){let d=Zt(s,be(Pt),this.me,!1);if(d!=null){let u=d.getAttribute(Pt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let m=s.getAttribute(Hr)||s.getAttribute(ri)||s.getAttribute(Gi)||xe;return{obj:p.$addPort({id:h,type:m}),el:s,missingPortCreated:!0}}else{let m=p.getPort(h);return m==null?null:{obj:m,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.me?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(H(e)?e.getFullId():e).split("."),o=this.getRenderedElement(n[0]);return o?o.querySelector(qr(on,n[1]))||o.querySelector(qr(Vo,n[1]))||o.querySelector(qr(Mo,n[1]))||o:null}$isSupportedElement(e){return Xi(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=$(ve,a,o,s);return Rr(l,t.width,t.height),this.containerType==="SVG"?ln(l,e):Ce(l,e),l}getRenderedElement(e){var s;if(e==null)return null;let n=(z(e)?e:e.getFullId()).split(this.model.portSeparator),o=(s=this.$getManagedElement(n[0]))==null?void 0:s.el;if(o&&n.length>1){let a=o.querySelector(qr(on,n[1]))||o.querySelector(qr(Mo,n[1]))||o.querySelector(qr(Vo,n[1]));if(a==null){if(this.logicalPorts===!0||o.getAttribute(on)===n[1]||o.getAttribute(Mo)===n[1]||o.getAttribute(Vo)===n[1]||o.getAttribute(Rl)===n[1]||o.getAttribute(ru)===n[1]||o.getAttribute(nu)===n[1])return o}else return a}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)),m=Math.max(d,Math.abs(n.y-t.y)),g=$(ve,{viewBox:`0 0 ${p} ${m}`});g.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:m,x=t.x>n.x?0:p,f=t.y>n.y?0:m,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:m},type:On,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=(R,v,O)=>{let[P,I]=z(R)?[R,{}]:[R.type,R.options],C=ho(I,l,"_");C.location=v,C.direction=O;let _=nt.get(this,P,{instance:this},C),w=this.$drawOverlay(_,A,{stroke:u,fill:u});if(_.isSimpleShape){let B=_,D=w;B.contentTags.forEach((M,N)=>{let G=$(M,D.atts[N]);g.appendChild(G)})}else if(ai(_)){let B=_,D=w;B.contentElements.forEach(M=>{ln(M,D.d.loc),g.appendChild(M)})}else if(sn(_)){let B=_,D=w;B.contentElements.forEach(M=>{ln(M,D.d.loc),g.appendChild(M)})}return w};if(s!=null){let R=T(s,0,-1);E=R.tail.x,y=R.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let R=T(a,1,1);x=R.tail.x,f=R.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=$(te,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return g.appendChild(S),o.forEach(R=>{let[v,O]=z(R)?[R,{}]:[R.type,R.options],P=ho(O,l,"_"),I=nt.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let _=I,w=C;_.contentTags.forEach((B,D)=>{let M=$(B,w.atts[D]);g.appendChild(M)})}else if(ai(I)){let _=I,w=C;_.contentElements.forEach(B=>{ln(B,w.d.loc),g.appendChild(B)})}else if(kr(I))if(I.useHTMLElement){let _=C,w=I.contentElement;h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}else{let _=$(te,C.atts[0]);g.appendChild(_)}else if(sn(I)){let _=C,w=I.create(null);w.style.position=je,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}}),h.appendChild(g),h}toBack(e,t){let n=this.getObjectInfo(e,!1);n.el&&n.el.parentElement&&(n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),t&&n.obj.group!=null&&this.toBack(n.obj.group))}toFront(e,t){let n=this.getObjectInfo(e,!1);n.el&&n.el.parentElement&&(t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null))}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(Ot(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&&Xi(o)&&(t?o.removeAttribute(fr):o.setAttribute(fr,at)),t}flashVertex(e,t=1e3,n=TT){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,lf))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof mr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var la=`<div data-vjs-vertex="{{id}}" class="${$i} ${mf}">{{label}}</div>`,iL="<div/>",oL=`<div data-vjs-vertex="{{id}}" class="${Go} ${gf}">{{label}}</div>`,ha=`<svg:rect data-vjs-vertex="{{id}}" class="${$i} ${mf}" x="0" y="0" width="80" height="60"/>`,sL='<svg:rect x="0" y="0" width="100%" height="30"/>',aL=`<svg:rect data-vjs-vertex="{{id}}" class="${Go} ${gf}" x="0" y="0" width="300" height="250"/>`,mV={html:{"vjs-node-default":la,"vjs-group-default":oL,"vjs-port-default":iL},svg:{"vjs-node-default":ha,"vjs-group-default":aL,"vjs-port-default":sL}},KT=(i,r)=>mV[i][r],op=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}),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.ie(h),this.render(r,e,t,n,o,s,a,l)}ie(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.ie(e)}cleanupPort(r,e){this.ie(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.ie(r)}};function fh(i,r,e){let t=n=>KT(r?"svg":"html",n)||bf(n)||i;return new op(i,t,e)}var gV="pointerdown",EV="pointermove",fV="pointerup",yV="touchstart",lL="touchmove",hL="touchend";function cL(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var sp=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=cL(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.Vr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this._u())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.Vr(this.onPinch))};this.bind(r.el,gV,a,{passive:!1}),this.bind(document,fV,l,{passive:!1}),this.bind(document,EV,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 cL(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,lL,h),this.bind(document,hL,l),ae(d),this.Vr(this.onPinchStart))},l=d=>{s=!1,ae(d),this.unbind(document,lL,h),this.unbind(document,hL,l),this._u()},h=d=>{if(s){let u=e(d);u.length===2&&(ae(d),this.radius=n(u),this.center=o(u),this.Vr(this.onPinch))}};this.bind(r.el,yV,a)}});this.eventManager=new fe,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)}Vr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}_u(){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 ap=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}$f(r,e){if(e===Q){let t=r.pos[e];if(r.alignX===ut){let n=it(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===st){let n=it(r.el);return t-n.height}return t}}ll(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.$f(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(Ye,"x",(a,l)=>{ET(a,l),o.currentPosition.x=l}),s(Se,"y",(a,l)=>{fT(a,l),o.currentPosition.y=l})}}pan(){this.ll()}append(r,e,t,n,o){if(r==null)return;let s=r;if(Ot(this.panZoom.canvasElement)&&!Ot(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||Ye,alignY:t.alignY||Se,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},Ot(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.ll(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.ll())}destroy(){this.panZoom=null,this.fixedElements=null}};var xV="transformOrigin",dL="transform",uL="translateX",pL="translateY",mL="scale",yh="px",bV="width",AV="height",EL="vjs-pan-zoom",fL="vjs-pan-zoom-canvas";function ca(){}function gL(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 da=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"Ru");c(this,"Dt");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,"cl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"hl");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"zr");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,"wheelFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"dl");c(this,"ul");c(this,"Ni");c(this,"pl");c(this,"ml");c(this,"viewport");c(this,"ms");c(this,"Ve");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"getOffset");c(this,"getOffsetRelativeToRoot");c(this,"getSize");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"Ii",{});c(this,"gl",!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.Hf===!0}else return!1})(r)&&(this.xl(),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.zr=this.$_getViewportSize(),this.ar(),this.Sl(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.kf(r)&&(this.zr=this.$_getViewportSize(),this.ar(),this.panning=!0,this.aboutToPan=!0,this.downAt=me(r),this.canvasAtPanStart=Object.assign({},this.position),ae(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.Tl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){ae(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=me(r),t=(o.x-this.downAt.x)/this.ms,n=(o.y-this.downAt.y)/this.ms;let s=this.it({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(),ae(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.zr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,ie,this.dl),this.eventManager.off(document,oe,this.ul),this.eventManager.on(document,ie,this.Ni),this.onMouseUp(r,this))},[gt]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||pS,this.cl=r.zoomStep||.25,this.fixedLayer=new ap(this,r.elementPositionSetter),this.eventManager=new fe,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ve=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.ar()})}),this.Ve.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.it({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,EL),L(this.canvasElement,fL),this.idFunction=r.idFunction,this.getOffset=r.getOffset,this.getOffsetRelativeToRoot=r.getOffsetRelativeToRoot,this.getSize=r.getSize,this.onZoom=r.events.zoom||ca,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||ca,this.onPanStart=r.events.panStart||ca,this.onMouseDown=r.events.mousedown||ca,this.onMouseUp=r.events.mouseup||ca,this.onMouseMove=r.events.mousemove||ca,this.onSetTransformOrigin=r.events.transformOrigin||ca,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.hl=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let e=r.wheel||{};this.enableWheelZoom=e.zoom!==!1,this.wheelFilter=e.filter||(()=>!0),this.wheelZoomRequiresMetaKey=e.useMetaKey===!0,this.wheelDirection=e.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(e.sensitivity||10),this.wheelPan=e.pan===!0,this.wheelPanAxis=e.axis||"both",this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.dl=function(t){this.El("move",t)}.bind(this),this.ul=function(t){this.El("end",t)}.bind(this),this.Ni=function(t){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.Dt=(t,n,o,s)=>this.wheelPanOrZoom(t,n,o,s),Wl(this.viewportElement,this.Dt,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new sp({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(t,n,o,s)=>{this.j(s*this.zoomAtZoomStart);let a=t.x-this.downAt.x,l=t.y-this.downAt.y;this.it({x:this.canvasAtPanStart.x+a,y:this.canvasAtPanStart.y+l,animate:!1})},onPinchStart:(t,n)=>{this.pinchZooming=!0,this.downAt=t,this.distanceAtZoomStart=this.lastDistance=n,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.j(this.zoom,null,!1,!1,!0),this.yl(),this.background=new qT,r.background&&this.background.addBackground(r.background),this.pl=t=>{this.start(t)},this.eventManager.on(this.viewportElement,ue,this.pl),this.eventManager.on(document,ie,this.Ni),this.ml=t=>{this.El(gt,t)},this.eventManager.on(this.viewportElement,gt,this.ml),this.ar(),this.xl()}getCompoundZoom(){return this.ms}xl(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.ms=e.width/r.width}$_getViewportSize(){return this.zr=this.getSize(this.viewportElement),this.zr}ar(){return this.vn=this.getSize(this.canvasElement),this.vn}Bf(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=m=>{u||(u=m);let g=m-u,E=g/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)`,g<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}it(r){let e=this.Lu(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.wu(r.zoom);this.Bf(t,e.x,e.y,r.animationDuration)}else this.position=e,this.Du(null,r.onComplete);else this.position=e,this.Al(),r.onComplete&&r.onComplete(this.position);return this.position}Nu(r,e,t,n,o){let s=this.position;return this.it({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}Ff(r,e,t,n){n||this.pan(-e*100,-t*100)}Uf(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.Sl(r),this.zoomingWithWheel=!0),this.Tl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.Uf(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===Q?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===Ee?t:0,this.Ff(r,e,t,n)))}zf(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)})}Iu(){return`${mL}(${this.zoom}) ${uL}(${this.position.x/this.zoom}${yh}) ${pL}(${this.position.y/this.zoom}${yh})`}Al(){this.canvasElement.style[dL]=this.Iu()}Du(r,e){if(this.canvasElement.animate!=null){let t={[dL]:this.Iu()};this.zf(t,r,e)}else this.Al()}Yf(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}yl(){this.canvasElement.style[xV]=this.Yf()}Xf(r,e){let t=this.fromPageLocation(r,e),n=this.vn||this.ar();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}}}Mu(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.yl(),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.Nu(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}fl(r,e){if(this.fixedTransformOrigin==null){let t=this.Xf(r,e);this.Mu(t.o,t.width,t.height)}}Sl(r){if(this.fixedTransformOrigin==null){let e=me(r);this.fl(e.x,e.y)}}gs(r,e){if(this.fixedTransformOrigin==null){let t=this.vn||this.ar();this.Mu({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}wu(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}j(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.wu(r);let s=this.zoom,a=l=>{if(!this.gl&&(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.Lu(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.it({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.gs(l.x,l.y),this.zoom=r,this.Du(null,a)}else this.zoom=r,this.Al(),a(this.position);return this.zoom}Tl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.jf(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}jf(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.j(h,o,s)}Lu(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.zr||this.$_getViewportSize(),o=this.He(),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 g=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,g),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,m=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),m>l.vh&&(a-=m-l.vh),{x:s,y:a}}}He(){let r=this.vn||this.ar(),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)}}kf(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.hl!=null?this.hl(e)!==!1:!0}El(r,e){r===gt&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=Yo(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,ie,this.Ni),this.eventManager.on(document,ie,this.dl),this.eventManager.on(document,oe,this.ul),this.handlers.start(r,Yo(r)))}getBoundsInfo(r,e){let t=this.zr||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.getBoundsWidth(),o=this.viewport.getBoundsHeight(),s=t.width/((n+r*2)/e),a=t.height/((o+r*2)/e),l=Math.min(s,a);return{width:n,height:o,x:this.viewport.getX(),y:this.viewport.getY(),vw:t.width,vh:t.height,minimumFill:l,zoom:this.zoom}}isPinchZooming(){return this.pinchZooming}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.Ii[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.Ii[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.Ii[e]}remove(r){let e=this.idFunction(r);delete this.Ii[e]}reset(){this.Ii={},this.it({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.j(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.j(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.j(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.j(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]||Ye,o=t[1]||Se,s=this.getBoundsInfo(),a=n===Ye?0:s.vw-this.background.getWidth()*this.zoom,l=o===Se?0:s.vh-this.background.getHeight()*this.zoom,h=this.He();this.it({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}positionElementAt(r,e,t,n,o,s){n=n||0,o=o||0;let a=this.He(),l=this.position,h=r.parentNode,d=this.getOffset(h),u=this.getOffset(this.viewportElement),p=u.x-d.x+(l.x+a.x)+e*this.zoom+n,m=u.y-d.y+(l.y+a.y)+t*this.zoom+o;s&&p<0&&(p=0),s&&m<0&&(m=0),r.style.left=p+"px",r.style.top=m+"px"}positionElementAtPageLocation(r,e,t,n,o){let s=this.fromPageLocation(e,t);this.positionElementAt(r,s.x,s.y,n,o)}positionElementAtEventLocation(r,e,t,n){let o=this.mapEventLocation(e);this.positionElementAt(r,o.x,o.y,t,n)}zoomToEvent(r,e){this.Sl(r),this.j(this.zoom+e,r)}$relayout(r){if(this.enablePan===!1){let e=r.xmax-r.xmin,t=r.ymax-r.ymin,n=window.getComputedStyle(this.viewportElement),o=parseInt(n.getPropertyValue(bV),10),s=parseInt(n.getPropertyValue(AV),10),a=o/e,l=s/t,h=Math.min(a,l);this.canvasElement.style.width=o+yh,this.canvasElement.style.height=s+yh,this.canvasElement.style.left="0",this.canvasElement.style.top="0";let d=-r.xmin,u=-r.ymin;this.canvasElement.style.transform=`${uL}(${d*h}${yh}) ${pL}(${u*h}${yh}) ${mL}(${h})`,this.setTransformOrigin(0,0)}}nudgeZoom(r,e){let t=this.getOffsetRelativeToRoot(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.fl(o,s),this.j(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Tl(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.ar(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.He(),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,m=this.position.x,g=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?g:r.alignY===st?y:r.alignY===Rt?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?m:r.alignX===ut?b:r.alignX===Rt?d-a.x:f*this.zoom;this.it({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.gl||(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=Se,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=st,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=Ye,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=ut,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:Rt,r.alignY=r.vertical===!1?null:Rt,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.gs(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.gs(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.He(),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.He(),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.it({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.j(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.j(this.zoom+this.cl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.j(this.zoom-this.cl,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.j(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.Nu(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.it({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.Ru=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.Ru)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.yl()}fromPageLocation(r,e,t){let n=this.He(),o=this.position,s=gL(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.He(),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.He(),n=this.position,o=gL(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}}mapEventLocation(r){let e=me(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}showElementAt(r,e,t){let n=r.parentNode,o=this.getOffset(n),s=this.getOffset(this.viewportElement),a=this.He(),l=o.x-s.x+a.x+e,h=o.y-s.y+a.y+t;r.style.left=l+"px",r.style.top=h+"px"}getApparentCanvasLocation(){let r=this.He(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.He(),n=this.it({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.Ve!=null&&(this.Ve.disconnect(),this.Ve=null),this.Dt!=null&&Zl(this.viewportElement,this.Dt),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,ie,this.Ni),this.eventManager.off(this.viewportElement,ue,this.pl),this.eventManager.off(this.viewportElement,gt,this.ml),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.gl=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},qT=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}Nt(r){this.backgrounds.forEach(e=>e.Nt(r))}};function BTe(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),m=o+(e-o)*p;i.setZoom(m);let g={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(g.x,g.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var QT={},lp=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=hn(s.el),l=it(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()}},xh=class extends lp{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 SV(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new xh(s,e,t,n,o,s.incremental)}}var hp={get:(i,r,e,t,n)=>{let o=QT[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{ax(r,lp)?QT[i]=r:QT[i]=SV(r)}};function ev(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=V()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||V()),s!=null&&a!=null)l=hp.get(s,a,r,e,h);else{let u=o;h=u.id||V(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new xh(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 Cf=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)=>{Or(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var tv="default",TV="center",yL="perimeter",bh=qr(tu,At),xL=qr(Io,At);function bL(i){return rv(i,xL)}function vV(i){return rv(i,bh)}function rv(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 cp(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function dp(i,r,e,t){let n=null,o=i.getEffectiveVisibleZoom();for(let s=0;s<r.length;s++)if(ke(e,r[s].r)){n=r[s];let a=r[s].modelInfo.typeDef,l=r[s].modelInfo.objEl,h=$u(t,l,o);r[s].positionOnElement=h,a.anchorPositionFinder!=null?r[s].anchor=a.anchorPositionFinder(l,h,n.modelInfo.vertex,a):r[s].anchor=null;break}return n}function CV(i,r,e,t,n){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let o=n?e.obj:t,s=n?t:e.obj;if(i.model.beforeConnect(o,s)===!1)return!1}return!0}function Ah(i,r,e,t,n){return nv(i,r,e,!1,t,n)}function iv(i,r,e,t,n){return nv(i,r,e,!0,t,n)}function nv(i,r,e,t,n,o){let s=[],a=[];return bL(i).forEach(h=>{if(h.getAttribute(fr)!==at){if(o!=null&&h.getAttribute(Yl)!==o)return;let d=cp(i,h,!1);if(!n&&d.obj===e)return;if(CV(i,r,d,e,t)){let u=h.getBoundingClientRect();s.push({modelInfo:d,isGroup:Y(d.obj),r:u,targetEl:h,targetPortType:h.getAttribute(Hr)||h.getAttribute(Gi),magnet:h.getAttribute(iu)===At}),L(h,Kt)}else r&&(h.setAttribute(fr,at),a.push(h))}}),s.sort((h,d)=>{if(h.isGroup&&!d.isGroup)return 1;if(!h.isGroup&&d.isGroup)return-1;if(h.isGroup&&d.isGroup){if(We(h.modelInfo.vertex,d.modelInfo.obj))return-1;if(We(d.modelInfo.vertex,h.modelInfo.obj))return-1}else return 0}),{dropTargets:s,disabledDropTargets:a}}var ua=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,"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||tv,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.rtree=new Ys}Vu(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=Be(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Be(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),gs(o[0],r,!0)?r:n===yL||n===tv&&(o[0].width>t||o[0].height>t)?hx(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function up(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,Be(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 SL="vjs-transient-vertex",AL="vjs-edge-click-entry-method",Mn="keyup",Zi="drag",Sh="click",Th="idle",RCe="dragging",Pf="awaitingClick",Of="locked",pp=class extends ua{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",Zi);c(this,"currentState",Th);c(this,"vl");c(this,"Cl");c(this,"Ol");c(this,"Pl");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"he");this.currentMethod=e.method||Zi,this.vl=e.vl,this.Cl=e.Cl,this.Ol=e.Ol,this.Pl=e.Pl,this.tapHandler=this.Wf.bind(this),this.mousemoveHandler=this.Pi.bind(this),this.canvasTapHandler=this.Zf.bind(this),this.documentKeypressHandler=this._l.bind(this),this.surface.addDragHandler({selector:bh,start:t=>this.Rl(t),drag:t=>this.Ll(t),stop:t=>{this.wl(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h={x:t.x-this.scrollAtPageDown.x,y:t.y-this.scrollAtPageDown.y},d=this.surface.getEffectiveVisibleZoom(),u=this.Vu(h,this.edgeSnapThreshold*d,this.edgeSnapSizeThreshold*d,this.edgeSnapType);return{x:u.x+this.scrollAtPageDown.x,y:u.y+this.scrollAtPageDown.y}}else return t}}),this.surface.on(this.container,W,bh,this.tapHandler),this.surface.addDragSelectorFilter(bh)}ie(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,Kt),H(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(fr)}),this.disabledDropTargets.length=0,F(document.body,ct),F(document.body,AL),F(this.surface.rootElement,In),this.surface.off(document,ie,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Mn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,qt),this.currentDropTarget=null),this.transientInfo!=null&&(this.he&&this.he.unobserve(this.transientInfo.el.el),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Th}Gu(e,t,n,o){var h;let s=n.getAttribute(eu)||((h=e.typeDef)==null?void 0:h.edgeType),a=me(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:je,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},SL);let l=Object.assign({},o||{});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,In),this.he&&this.he.observe(this.transientInfo.el.el)}$u(e){return this.currentPagePosition={x:e.x,y:e.y},this.Jf()}Jf(){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{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}Bu(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:lo(t)?{}:t}}Rl(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===Zi){let t=e.el;if(t.getAttribute(fr)!==at){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=cp(this.surface,t,!0);if(n!=null){let o=this.Bu(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(ri),this.u.edgeType=t.getAttribute(eu)||"";let s=t.getAttribute(Yl);this.u.scope=s,this.Gu(n,e.e,t,o.payload),L(document.body,ct);let a=n.typeDef.allowLoopback===!0||t.getAttribute(EE)===At||this.allowLoopbackEdges,l=Ah(this.surface,this.activeFiltering,n.obj,a,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.dropTargets.forEach(h=>{(!this.edgeSnapRequiresMagnets||h.magnet)&&this.rtree.insert({x:h.r.x,y:h.r.y,width:h.r.width,height:h.r.height,children:[],id:V()})}),this.surface.$startMotion(),!0}}}}return!1}Dl(e){if(this.transientEdge!=null){ae(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=$u(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?H(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):(Y(n)||K(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=me(e);n=this.surface.fromPageLocation(s.x,s.y)}this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},co,null)},()=>{})}}wl(e){this.surface.$stopMotion(),this.Dl(e.e)}Fu(e,t){this.Kf();let n=e();if(this.currentMethod===Sh&&this.currentState==Pf){let s=me(t);this.$u(s)}let o=dp(this.surface,this.dropTargets,n,t);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,qt),o!=null){if(L(o.targetEl,qt),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=up(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}Pi(e){let t=me(e);this.Fu(()=>({x:t.x,y:t.y,width:5,height:5}),e)}Ll(e){this.Fu(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.$u(t);else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}Kf(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}Wf(e){if(this.currentMethod===Sh&&this.currentState!==Of){let t=e.target||e.srcElement;if(t.getAttribute(fr)!==at){let n=cp(this.surface,t,!0);if(n!=null){if(this.currentState===Th){ae(e),this.pageDownAt=me(e),this.u={};let o=this.Bu(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(ri),this.u.edgeType=t.getAttribute(eu);let s=t.getAttribute(Yl);this.u.scope=s,this.currentSource=n.obj,L(document.body,AL),this.Gu(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(EE)===At||this.allowLoopbackEdges,l=Ah(this.surface,this.activeFiltering,n.obj,a,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=Pf,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,ie,this.mousemoveHandler),document.addEventListener(Mn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===Pf){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.Dl(e)}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.ie()}Zf(e){if(!e.defaultPrevented&&this.currentMethod===Sh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=me(e);for(let n=0;n<this.dropTargets.length;n++)gs(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.Dl(e),this.$_exitTapMode())}}_l(e){this.currentState===Pf&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var ov="primed",sv="idle",av="active",mp=class extends ua{constructor(e){super(e);c(this,"Nl");c(this,"Il");c(this,"It");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"Oe");c(this,"he");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"Es",!1);c(this,"Yr");c(this,"Cn");this.Nl=e.inputHandler,this.Il=e.method||Zi,this.It=sv,this.documentKeypressHandler=this._l.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.It===ov){this.Yr=ft({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.Yr),this.Cn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,In),Vt(a,[uf],[Yu]),this.Es=!0,this.It=av,this.Nl.currentState=Of}if(ae(n),this.currentPagePosition=me(n),this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom();this.currentPagePosition=this.Vu(this.currentPagePosition,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.qf();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=dp(this.surface,this.dropTargets,o,n);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,qt),s!=null){if(L(s.targetEl,qt),s.anchor!=null)this.Yr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.Yr.isFixed=!0;else if(s.positionOnElement!=null){let a=up(s.positionOnElement);this.Yr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.Yr.isFixed=!0}}this.currentDropTarget=s}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(ae(n),this.Es)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===Qe?s:o.source,a===Qe?o.target:s,o)===!1?this.Ml():(this.ie(this.currentDropTarget.anchor),a===Qe?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Cn.dummy===!0?(this.surface.model.updateVertex(this.Cn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.ie()):this.Ml();else(this.Il===Zi||this.It===av)&&this.ie();else this.ie()};let t=n=>o=>{if(!o.defaultPrevented){let s=Zt(o.target,be(Ze),this.container,!1);s!=null&&(this.currentEdge=this.surface.model.getEdge(s.getAttribute(Ze)),this.currentEdge.transient?(this.currentEdge=null,this.It=sv):(this.Cn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),(this.currentConnection.detachable||this.Cn.dummy===!0)&&(this.Es=!1,this.currentIndex=n,ae(o),this.Oe={x:0,y:0},this.currentPagePosition=me(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,ie,this.mouseMoveHandler),this.surface.on(document,oe,this.mouseUpHandler),this.It=ov,this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},MT),this.he&&this.he.observe(this.transientVertex.el.el),this.Qf(),L(this.currentConnection.connector.canvas,Yu),this.Il===Sh&&document.addEventListener(Mn,this.documentKeypressHandler),this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge))))}};this.surface.on(this.container,ue,X(ji),t(Qe)),this.surface.on(this.container,ue,X(Hi),t(xn))}qf(){let e={x:this.currentPosition.x+this.Oe.x,y:this.currentPosition.y+this.Oe.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(fd,this.currentEdge)}Ml(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.$revalidateElementById(this.currentEdge.source.id),this.ie();else{let n=this.currentEdge.id;this.ie(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.Oe.x,y:this.currentPosition.y+this.Oe.y},this.currentIndex):this.surface.model.removeEdge(n)}}ie(e){if(this.rtree.clear(),this.Yr=null,this.dropTargets.forEach(t=>{F(t.targetEl,Kt)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(fr)}),this.disabledDropTargets.length=0,F(document.body,ct),F(this.surface.rootElement,In),Vt(this.currentConnection.connector.canvas,[],[uf,Yu]),document.removeEventListener(Mn,this.documentKeypressHandler),this.surface.off(document,ie,this.mouseMoveHandler),this.surface.off(document,oe,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,qt),this.currentDropTarget=null),this.transientVertex!=null&&(this.he&&this.he.unobserve(this.transientVertex.el.el),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.$revalidateManagedElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this.Es=!1,this.It=sv,this.Nl.currentState=Th,this.Cn=null}Qf(){if(this.currentIndex===Qe){let e=iv(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=Ah(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.dropTargets.forEach(e=>{(!this.edgeSnapRequiresMagnets||e.magnet)&&this.rtree.insert({x:e.r.x,y:e.r.y,width:e.r.width,height:e.r.height,children:[],id:V()})})}_l(e){(this.It===av||this.It===ov)&&(e.keyCode===27||e.key==="Escape")&&this.Ml(!0)}};var xr="pan",li="select",qo="disabled",Vn="vertexDrawing";var pa="vjs-anchor-placeholder",PV="vjs-anchor-candidate",_f="vjs-connection-edit",gp="vjs-edge-guideline",Gn="vjs-edge-handle";var Rf=X(pa),lv=12,hv=15;function Lf(i,r,e,t){let n=$(q,e||{});L(n,r),t||(n.style.display=ht);let o=$(ze,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function TL(i,r,e,t,n,o,s){let a=$(q);L(a,n),s||(a.style.display=ht);let l=$(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function OV(i,r,e,t,n,o,s,a){let l=it(r),h=l.width*e,d=l.height*t,u=$(ve);L(u,s),u.style.position=je;let p=$(Z,{x:"0",y:"0",width:n,height:o,"pointer-events":"none"});u.appendChild(p);let m={x:h-n/2,y:d-o/2};return r.appendChild(u),Ce(u,m),u}function cv(i,r,e,t,n,o,s){let a=Lf(t,n,o,s);return i.$appendElementToToolsLayer(a),Ce(a,{x:r,y:e}),a}function dv(i,r,e,t,n,o,s,a,l,h){let d=TL(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),Ce(d,{x:r,y:e}),d}function uv(i,r,e){let t=i.faces,n=[{face:Ye,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:ut,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:Se,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:st,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(Se,[0,-1]),o.set(st,[0,1]),o.set(Ye,[-1,0]),o.set(ut,[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 pv(i,r,e){let t=yc(r,e,i.locations);return vL(t.p,e)}function mv(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 vL(d,o)}}function vL(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 Ji=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"Uu");c(this,"ey");c(this,"$currentEdgeFrame");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"zu",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"lr");c(this,"hr");c(this,"Vl");c(this,"dr");c(this,"fs");c(this,"buttonSize");c(this,"Yu");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"Gl");c(this,"ur");c(this,"ny",{});c(this,"pr",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||lv,this.Yu=e.anchorPlaceholderSize||hv,this.dr=!1,this.ui.model.bind(bn,()=>{this.deactivate()}),this.ui.bind(Zn,l=>{l.edge==this.currentEdge&&this.Xu()}),this.eventManager=new fe,this.$addDragHandler({selector:Rf+" *",target:Rf,constrainFunction:(l,h,d,u,p,m)=>{let g=h.ys.anchor,E={x:l.x,y:l.y},y=!1,x=this.ur.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.pr.rotation!==0&&(y=!0,E=xt(l,this.pr.center,-this.pr.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.Gl!=null)A=mv(g,this.Gl,x.el,b,this.ur.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(g.isContinuous){let[T,S]=uv(g,E,f);A=T,S!=null&&(g.currentFace=S),this.$hasEdits=!0}else A=pv(g,l,f),this.$hasEdits=!0;return g.fixedLocation=A,g.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x),y&&(l=xt(l,this.pr.center,this.pr.rotation)),l},start:l=>{let d=l.el.ys.vertex;if(this.ur=this.ui.getObjectInfo(d,!1),this.zu.length=0,this.ur.obj!=null)this.Vl=this.$cloneCurrentGeometry(),this.Gl=this.currentEdge.source.id===this.ur.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.pr.rotation=this.ui.$getRotation(d.id),this.pr.rotation!==0&&(this.pr.center={x:this.ur.managedElement.t.c.x,y:this.ur.managedElement.t.c.y});else return!1},stop:l=>{this.zu.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Vl),this.Vl=null,this.ur=null},drag:l=>{this.Xu()}});let t=(l,h)=>{this.iy(l)?h(l):Y(l)&&(We(this.currentEdge.source,l)?h(this.currentEdge.source):We(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.dr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.ly(d)})}),this.$repaint())},o=l=>{this.dr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.hy(d))})};this.ui.bind(Lt,l=>{o(l)}),this.ui.bind(nr,l=>{n(l)}),this.ui.bind(Gr,l=>{o(l)}),this.ui.bind(Wc,l=>{n(l)});let s=l=>{this.dr&&this.currentEdge&&t(l.vertex,h=>this.Vi())};this.ui.model.bind(Ve,s),this.ui.model.bind(Re,s);let a=l=>{this.dr&&this.currentEdge&&l.id===this.currentEdge.id&&(this.$repaint(),this.Mi())};this.ui.bind(fd,l=>{a(l)}),this.ui.model.bind(nn,l=>{a(l.edge)}),this.ui.model.bind(rn,l=>{a(l.edge)})}isBusy(){return this.fs}Xu(){this.Mi(),this.$repaint()}$cloneCurrentGeometry(){return ot(this.currentConnector.geometry)}ju(r){return this.ui.view.getTypeDefinition(r).anchorPositions}ku(r,e){let t={type:e.type,options:Object.assign(e.options,{id:V()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}uy(r,e){this.Hu(),e.forEach(t=>{this.ku(r,t)})}Hu(){this.currentOverlays.forEach(r=>{Ui(this.current,r.id)})}py(r){let e=r.deleteButtonClass||Ks,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.ku(this.current,{type:ir.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){this.current&&(this.ui.$paintConnection(this.current,r),this.Vi(r))}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Vi(r){this.current&&(this.Mi(),this.$repaint&&this.$repaint(r))}Mi(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=e===0?this.current.sourceElement:this.current.targetElement;if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),l=this.ui.$getElementPositionInUIRelativeToCanvasOrigin(o),[h,d]=[a.curX-l.x,a.curY-l.y],u;t!=null?u=t:(u=Lf(this.Yu,pa,{[Ze]:this.currentEdge.id},!0),u.ys={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(u);let p=this.ui.$getSize(u),m={x:l.x+(h-p.width/2),y:l.y+(d-p.height/2)};return Ce(u,m),[[l.x,l.y],u]}else return[[0,0],null]};this.ui.$removeElement(this.lr),this.currentEdge.source.dummy||([this.sourceDimensions,this.lr]=r(0,this.lr)),this.ui.$removeElement(this.hr),this.currentEdge.target.dummy||([this.targetDimensions,this.hr]=r(1,this.hr))}}my(){this.current&&(this.lr&&(this.lr.parentNode.removeChild(this.lr),delete this.lr.ys),this.hr&&(this.hr.parentNode.removeChild(this.hr),delete this.hr.ys)),this.lr=null,this.hr=null,this.sourceDimensions=null,this.targetDimensions=null}gy(){this.current&&Mi(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.gy(),this.$clearHandles(),this.ui.$revalidateElementById(this.current.sourceId),this.ui.$revalidateElementById(this.current.targetId)}isActive(){return this.dr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;Ce(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.Uu=this.ui.model.getEdgeType(r.data),this.ey=this.ui.view.getEdgeDefinition(this.Uu),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=qs(t.anchorPositions),this.targetAnchorPositionFinder=qs(t.anchorPositions);else{let n=this.ju(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=qs(n));let o=this.ju(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=qs(o))}this.$activate(e,t),t.overlays&&this.uy(e,t.overlays),t.deleteButton===!0&&this.py(t),this.Mi(),Wr(this.current,_f),this.dr=!0}}deactivate(r){this.current!=null&&(this.Hu(),Or(this.current,_f),this.my()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.dr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.fs=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=cv(this.ui,r,e,t,o,{[Ze]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=dv(this.ui,r,e,t,n,o,s,a,{[Ze]: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=$(Je,{x:`${t/2}`,y:`${n/2}`,[Ze]: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.fs=!0),t},drag:e=>r.drag(e),stop:e=>{this.fs=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.ny[r.selector]=r}ly(r){this.Mi(),this.$elementDragging(r)}hy(r){this.$elementDragged(r)}iy(r){return this.currentEdge==null?!1:r.id===Xm(this.currentEdge.source)||r.id===Xm(this.currentEdge.target)}};var Lr=new Map;function _V(i,r,e){let t=Lr.get(i);return new t(r,e)}function RV(i){return i.type===_n&&i.constrain===tn?ks:i.type}var ma=class{constructor(r,e){this.ui=r;this.xs=e;c(this,"$l",new Map);c(this,"Wu");c(this,"Ye",!1);c(this,"On");c(this,"ot");r.bind(Oi,()=>(this.destroy(),!0)),this.xs=this.xs||{},this.Wu=this.xs.hoverMode===!0,this.ui.model.bind(mt,t=>{this.On&&this.On.id===t.edge.id&&this.stopEditing()}),this.Wu&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.On&&this.On.id===t.id&&(this.Ye=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Ye=!1}),oi()&&(this.ui.bind(Ed,t=>{t.obj.transient||(!this.ot||!this.ot.isBusy()&&this.ot.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(gd,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Ye){let t=this.Zu(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=RV(t.connector);if(Lr.has(o)){if(this.ot=this.$l.get(o),this.ot==null){let s=Object.assign({},this.xs||{});this.ot=_V(o,this.ui,s),this.$l.set(o,this.ot)}this.On=n,this.ot.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.ot&&this.ot.deactivate(),this.On=null,this.ot=null}clearEdits(r){let e=this.Zu(r);return e!=null?(Mi(e),!0):!1}Zu(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):Fo(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.$l.clear()}};function gv(){}function Ep(i){let r=document.createElement("div");return L(r,i.join(" ")),document.body.appendChild(r),r}var ga=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"bs");c(this,"el");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});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,"ht");c(this,"eventManager");c(this,"Bl");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",ue);c(this,"upEvent",oe);c(this,"moveEvent",ie);c(this,"enabled",!1);c(this,"Ju");this.surface=r.surface,this.onStart=r.onStart||gv,this.onEnd=r.onEnd||gv,this.onSelect=r.onSelect||gv,this.onClick=r.onClick||null,this.bs=r.generateLassoContent,this.Bl=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.Xr.bind(this),this.upListener=this.mr.bind(this),this.moveListener=this.jr.bind(this),this.eventManager=new fe,this.Ey(r.filter),this.invert?this.fy():this.el=Ep([vT,r.cssClass||""]),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(xo,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)})}Ey(r){r==null?this.ht=function(){return!1}:z(r)?this.ht=e=>{let t=e.srcElement||e.target;return Mt(t,r)}:this.ht=r}Ku(r,e){if(this.visibleOrigin=r,this.size=e,!this.invert)Jt(this.el,r),Rr(this.el,e.width,e.height);else{let t=window.innerWidth,n=window.innerHeight,o=window.pageXOffset,s=window.pageYOffset,a=n-r.y+s,l=n-a+e.height,h=t-r.x+o,d=t-h+e.width;this.masks.top.style.bottom=a+"px",this.masks.bottom.style.top=l+"px",this.masks.left.style.right=h+"px",this.masks.right.style.left=d+"px",this.masks.top.style.left=t-h+"px",this.masks.top.style.right=t-d+"px",this.masks.bottom.style.left=t-h+"px",this.masks.bottom.style.right=t-d+"px"}}Nt(r){let e=r?Pr:ht;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,ct):this.surface.removeClass(document.body,ct)}qu(r){return this.Bl==null?r:this.Bl(r)}Xr(r){if(this.enabled&&!this.ht(r)){if(ae(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.hasMoved=!1,this.origin=this.qu(me(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),!this.invert&&this.bs){let e=this.bs(this.origin,r);e!=null?(this.Ju=e,this.el.replaceChildren(e)):this.el.innerHTML=""}this.Ku(this.origin,{width:1,height:1}),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r)}}jr(r){if(this.down){this.moving||(this.Nt(!0),this.moving=!0),ae(r);let e=this.qu(me(r)),t=this.surface.fromPageLocation(e.x,e.y),n={width:Math.abs(e.x-this.origin.x),height:Math.abs(e.y-this.origin.y)},o={x:Math.min(this.origin.x,e.x),y:Math.min(this.origin.y,e.y)},s={width:Math.abs(t.x-this.canvasOrigin.x),height:Math.abs(t.y-this.canvasOrigin.y)},a={x:Math.min(this.canvasOrigin.x,t.x),y:Math.min(this.canvasOrigin.y,t.y)};s.width>0&&s.height>0&&(this.hasMoved=!0,this.Ku(o,n),this.onSelect(o,n,a,s,[this.origin.x<e.x,this.origin.y<e.y],r.shiftKey,this.Ju))}}mr(r){if(this.down){let e=this.moving;this.down=!1,this.moving=!1,ae(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.Nt(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.bs&&(this.el.innerHTML="")}}fy(){this.masks.top=Ep([nh,PT]),this.masks.bottom=Ep([nh,_T]),this.masks.left=Ep([nh,CT]),this.masks.right=Ep([nh,OT])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Oe=class{$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){}};var Ev="logarithmic",fv="absolute";var CL={},Ki={get:i=>{let r=CL[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{CL[i]=r}};var wf=class wf{constructor(r){c(this,"type",wf.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.Pn(r.options)}Pn(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}Nt(r){}};c(wf,"type","simple");var fp=wf;Ki.register(fp.type,fp);var PL="vjs-background-tile",yv=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,"Mt",[]);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.Mt[s]=this.Mt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.yy=!0,l.className=PL,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.Mt[s][a]=[l,new Image,!1]}}}by(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}Ay(r,e,t){return this.urlGenerator==null?this.by(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}Sy(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.Ay(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.Mt[o]!=null&&this.Mt[o][s]!=null&&(this.Mt[o][s][2]||(this.Sy(this.Mt[o][s][0],this.Mt[o][s][1],o,s),this.Mt[o][s][2]=!0))}},Df=class Df{constructor(r){c(this,"type",Df.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"zoomWidget");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,"Qu");c(this,"ep");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||Ev,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.Qu=this.debounce(this.rp,this.zoomDebounceTimeout),this.ep=this.debounce(this.np,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new yv(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Ty(){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}vy(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}np(){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)}}rp(){this.vy(this.Ty()),this.np()}setZoom(r,e){this.widgetZoom=r,e?this.rp():this.Qu()}pan(){this.ep()}owns(r){return r===this.canvas||r.yy===!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===fv?this.Cy(r):this.Oy(r)}Cy(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}}Oy(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}}Nt(r){}};c(Df,"type","tiled");var yp=Df;Ki.register(yp.type,yp);var OL=(e=>(e.dotted="dotted",e.lines="lines",e))(OL||{}),LV="dotted",wV="lines",_L={width:50,height:50},RL=2,xv="#ddd",vh="#ddd",DV=2,NV=1,LL="vjs-background",wL="vjs-background-border",Qo="vjs-background-grid",DL="vjs-background-grid-minor",NL="vjs-background-grid-major",xp="vjs-background-grid-dotted-major",IL="vjs-background-grid-dotted-minor",Nf=class Nf{constructor(r){c(this,"Ye",!1);c(this,"type",Nf.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,"As");c(this,"Gi");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.As=`p${V().substring(0,8)}`,this.Gi=`p${V().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=$(ve),this.backgroundContainer.style.position=je,L(this.backgroundContainer,LL),this.Nt(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Lt,e=>{this.gr()}),this.ui.bind(nr,e=>{this.gr()}),this.ui.bind(ud,()=>{this.Ye=!0}),this.ui.bind(Sn,()=>{this.Ye=!1,this.gr()}),this.ui.bind(Br,e=>{this.gr()}),this.ui.bind($r,e=>{this.gr()}),this.ui.model.bind(Le,e=>{this.gr()}),this.ui.model.bind(Me,e=>{this.gr()}),this.grid=r.options.grid||this.ui.getGrid()||_L,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||RL,this.dotRadius=r.options.dotRadius||DV,this.tickDotRadius=r.options.tickDotRadius||NV,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.gr()}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}gr(){this.Ye||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 o=-this.minWidth/2;o<r&&(t+=r-o,r=o);let s=this.minWidth/2;s>r+t&&(t+=s-(r+t))}if(this.minHeight!=null){let o=-this.minHeight/2;o<e&&(n+=e-o,e=o);let s=this.minHeight/2;s>e+n&&(n+=s-(e+n))}if(this.maxWidth!=null){let o=-this.maxWidth/2;o>r&&(t-=o-r,r=o);let s=this.maxWidth/2;s<r+t&&(t-=r+t-s)}if(this.maxHeight!=null){let o=-this.maxHeight/2;o>e&&(n-=o-e,e=o);let s=this.maxHeight/2;s<e+n&&(n-=e+n-s)}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),Ce(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=""})}Py(r,e){return`<pattern id="${this.Gi}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
|
|
44
|
-
<path d="M ${r} 0 L 0 0 0 ${e}" class="${
|
|
45
|
-
</pattern>`}_y(){return`<pattern id="${this.As}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Gi})"/>`:"")+`<path d="M ${this.grid.width} 0 L 0 0 0 ${this.grid.height}" class="${
|
|
46
|
-
<circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${
|
|
47
|
-
<circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${
|
|
48
|
-
<circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${Qo} ${xp}" fill="${vh}" stroke="none"/></pattern>`}wy(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.Py(r,e):this.Ry(r,e),n=()=>this.gridType==="lines"?this._y():this.Ly();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.wy(),e=this.showBorder?`<rect class="${wL}" x="0" y="0" width="100%" height="100%" fill="${ht}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.As})" stroke="${ht}"/>`;return r+e+t}Nt(r){this.backgroundContainer.style.display=r?Pr:ht}};c(Nf,"type","grid");var Ea=Nf;Ki.register(Ea.type,Ea);var es=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Ss",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=Ki.get(n);return this.Ss=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.Ss}),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.Ss)}setVisible(e){this.Ss=e,this.background.Nt(e)}};c(es,"type","background"),or.register(es.type,es);var Ch="c-state",bp=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===Er?`${Ch}-${r}`:`${Ch}-${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?`${Ch}-${this.id}-${a}`:null;l&&we.addType(s,l,o.data),this.state[Er]&&we.addType(s,`${Ch}-${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[Er]&&L(l,this.state[Er].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Ch}-${this.id}-${a}`:null;l&&we.removeType(s,l,o.data),this.state[Er]&&we.removeType(s,`${Ch}-${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[Er].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[Er]&&F(l,this.state[Er].cssClass)})}};var If=class{constructor(r){this.ui=r;c(this,"ip",{});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.ip[e]=new bp(e,this.viewOptions.states[e],r)}getState(r){return this.ip[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.op(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.op(e),t.deactivate(e,this.ui,this.ui.dataSource),_t(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}op(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}},Ph=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new If(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Ph,"type","ui-states"),or.register(Ph.type,Ph);var bv="direct",IV="orthogonal",Oh=class extends Oe{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,"sp");c(this,"ne");c(this,"At")}destroy(){}Dy(){let e=this.ui.getLayout();if(e.type!==go.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.sp.forEach(n=>{let o=this.mode===bv?cA(n):hA(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!==_n){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),m=this.ne[p.source.id],g=this.ne[p.target.id],E=this.At[p.source.id],y=this.At[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}),Ne.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-m.x)/E.width,y:(u[0].y-m.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-g.x)/y.width,y:(u[u.length-1].y-g.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||bv,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||wd,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.sp=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.ne=Object.assign({},n.positions),this.At=Object.assign({},n.sizes),this.Dy()}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(Tn,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(Tn,this.layoutListener)}};c(Oh,"type","edgeRouting"),or.register(Oh.type,Oh);var ML="vjs-selected-edge-highlight",Mf=class Mf extends Oe{constructor(){super(...arguments);c(this,"id",Mf.type);c(this,"Er",new Map);c(this,"ap",ML);c(this,"$i");c(this,"S");c(this,"lp",e=>{Ke(e.obj)&&(this.Ny(e.obj),this.Iy())});c(this,"hp",e=>{Ke(e.obj)&&(this.Fl(e.obj.getId()),this.cp())});c(this,"dp",e=>{this.reset()});c(this,"Ts",e=>{e.edge&&this.Bi(e.edge)});c(this,"pp",e=>{e.edge&&this.Bi(e.edge)});c(this,"mp",e=>{e.dragGroup.forEach(t=>this.gp(t.vertex))})}initialise(e,t){return this.S=e,this.ap=t&&t.className||ML,this.$i=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(ur,this.lp),!0}destroy(){this.reset(),this.S.model.unbind(ur,this.lp)}reset(){this.Er.forEach(e=>{this.S.$removeElement(e)}),this.Er.clear(),this.cp()}Iy(){this.S.model.bind(pr,this.hp),this.S.model.bind(Cr,this.dp),this.S.model.bind(Zn,this.Ts),this.S.model.bind(Jn,this.pp),this.S.bind(nr,this.mp),this.S.bind(Zn,this.Ts)}cp(){this.S.model.unbind(pr,this.hp),this.S.model.unbind(Cr,this.dp),this.S.model.unbind(Zn,this.Ts),this.S.model.unbind(Jn,this.pp),this.S.unbind(nr,this.mp),this.S.unbind(Zn,this.Ts)}$edgeRemoved(e){this.Fl(e.getId())}$edgeUpdated(e){this.Bi(e)}$vertexUpdated(e,t){this.gp(e.modelObject)}gp(e){this.Er.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Bi(o)})}Ny(e){var s;let t=e.getId();if(this.Er.has(t)){this.Bi(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=$(Z,{fill:this.$i.fill||"none",stroke:this.$i.stroke||"var(--vjs-color-edit)","stroke-width":this.$i.strokeWidth||2,"stroke-dasharray":this.$i.dashArray,"pointer-events":"none",rx:2},{},this.ap);this.Ep(o,n),this.S.$appendElementToToolsLayer(o),this.Er.set(t,o)}Bi(e){var s;let t=e.getId(),n=this.Er.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.Fl(t);return}this.Ep(n,o)}Fl(e){let t=this.Er.get(e);t&&(this.S.$removeElement(t),this.Er.delete(e))}Ep(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;ce(e,{x:s,y:a,width:o.width,height:o.height})}};c(Mf,"type","selected-edge-highlight");var fa=Mf;or.register(fa.type,fa);var $n=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",li);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[])}destroy(){}initialise(e,t){return e.bind(vn,n=>{this.lasso.enabled=n===li}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new ga({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,onStart:(n,o,s,a)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,this.onStart&&this.onStart()},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]}),m=p.length,g={};for(u=0;u<m;u++)p[u].v.group==null&&(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),g[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,m=d.length,t.includeEdges){let E={};for(u=0;u<m;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===pe.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===pe.objectType?y[f].target.getParent().id:y[f].target.id;g[b]&&g[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d)},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==qo&&e.setMode(xr),e.fireUnchecked(Lb),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c($n,"type","lasso"),$n=Nt([wt("lasso")],$n);var VL="vjs-surface-elastic-group-resize",Vf="elasticGroupFrame:resize",Gf="elasticGroupFrame:remove",ya=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,"My");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),Ot(this.uiGroupContentArea)?this.frame=$(Z):(this.frame=$(ve),this.frame.appendChild($(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,VL),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=Gm(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=Gm(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.Vy(),this.My=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Vy(){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.Gy(e,t)}Gy(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=vu(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),Ce(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(Vf,{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(Gf,{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}Ul(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.Ul(r,e),{movedElements:r,resizedGroups:e}}};var GL="resize";function $f(i,r,e){let t={width:i.width,height:i.height,position:i.position||je},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=ta(i.ns,i.type||He,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var Bf="vjs-node-id",Av="vjs-miniview-type",$L="miniview",Bn=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"uiBounds");c(this,"suspended");c(this,"zl");c(this,"typeFunction");c(this,"fr");c(this,"vs");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,"clickToCenter");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"Yl");c(this,"uiBindings",[]);c(this,"Xl");c(this,"viewport");c(this,"Dt");c(this,"Xr");c(this,"jr");c(this,"mr");c(this,"jl")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,ue,this.Xr),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.eventManager.off(window,GL,this.jl),F(this.containerElement,zu),F(this.containerElement,Xu),this.zl&&(this.eventManager.off(this.fr,Ue,this.Xl),this.fr.parentNode.removeChild(this.fr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Mr,this.Yl),this.Dt&&Zl(this.containerElement,this.Dt),this.panzoom=null}$y(e){}By(e){}Ee(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.clickToCenter=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.Xr=this.downListener.bind(this),this.jr=this.moveListener.bind(this),this.mr=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=$f({position:je,width:Rn,height:Rn,left:0,top:0,clazz:LT},this.containerElement),this.canvasElement=$f({position:qA,width:Rn,height:Rn,left:0,top:0,clazz:RT},this.containerElement),this.suspended=t.suspended===!0,this.zl=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.fr=null,this.vs=!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 fe,L(this.containerElement,zu),this.Xl=this.toggleCollapsed.bind(this),this.zl&&(this.fr=$f({type:"div"}),this.fr.className=NT,this.containerElement.appendChild(this.fr),this.ui.on(this.fr,Ue,this.Xl)),this.viewport=this.ui.viewport,this.panzoom=new da({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,getOffset:o=>o.viewportEntry||this.ui.$getElementPositionInUIRelativeToCanvasOrigin(o),getOffsetRelativeToRoot:o=>this.ui.$getOffsetRelativeToRoot(o),getSize:o=>o.viewportEntry||o.vertex?this.$__getSize(o.vertex.id):this.ui.$getSize(o),elementPositionSetter:(o,s)=>Ce(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.F(o),events:{pan:()=>{this.fp()},mousedown:()=>{L(this.pannerElement,pf)},mouseup:()=>{F(this.pannerElement,pf)}},zoomRange:[-1/0,1/0]}),this.jl=ra(()=>{this.Ge()},100),this.eventManager.on(window,GL,this.jl),this.enableWheelZoom!==!1&&(this.Dt=this.wheelZoom.bind(this),Wl(this.containerElement,this.Dt)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,zu),this.eventManager.on(this.pannerElement,ue,this.Xr),this.Yl=()=>{this.Ge(),this.st(!0),setTimeout(()=>{this.Ge(),this.st(!0)},0)},this.Ee(Sn,this.Yl),this.setVisible(this.visible),this.Ee(gl,this.Ge),this.Ee(fo,this.Ge),this.Ee(Lt,this.Cs),this.Ee(nr,o=>{this.activeTracking&&this.Cs(o)}),this.Ee(Br,this.kl),this.Ee(pl,this.Fy),this.Ee(Tn,this.Uy),this.Ee($r,this.yp),this.Ee(Gr,this.Cs),this.Ee(Wc,o=>{this.activeTracking&&this.Cs(o)});let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&Jt(l,a)}this.st(!0)};return this.Ee(Tn,n),this.Ee(Ms,n),this.Ee(hb,this._n),this.Ee(pd,this.zy),this.Ee(Vf,this.$y),this.Ee(Gf,this.By),this.Yy(),this.clickToCenter&&(L(this.containerElement,IT),this.eventManager.on(this.canvasElement,W,be(Bf),o=>{let s=o.target.getAttribute(Bf);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.Xy(),this.panzoom.setZoom(1),this.panzoom.reset(),this.Ge()}xp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=rr(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}}Yy(){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.yp({el:s,id:n[o].id,vertex:n[o],pos:this.xp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.kl({el:s,id:t[o].id,vertex:t[o],pos:this.xp(t[o])})}(n.length>0||t.length>0)&&this.st(!0)}yp(e){this.kl(e,DT)}$groupCollapsed(e){this.bp(e.modelObject,!1),this._n({id:e.id})}$groupExpanded(e){this.bp(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&&Rr(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.Os(e),this.st(!0))}downListener(e){this.panning=!0,this.downAt=me(e),this.pannerAtMouseDown=hn(this.pannerElement),this.eventManager.on(document,oe,this.mr),this.eventManager.on(document,ie,this.jr),ae(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.fp(s),Jt(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,oe,this.mr),this.eventManager.off(document,ie,this.jr)}wheelZoom(e){ae(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.gs(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.vs=!this.vs,this.vs?L(this.containerElement,Xu):F(this.containerElement,Xu),this.st(!0)}st(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.Ge,doNotFirePanEvent:e})}Cs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.Os(t.element)}),this.st(!0)}Fy(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);Jt(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Rr(s,a.width,a.height)}});let n=rr(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)}Jt(t,n),Rr(t,e.element.width,e.element.height),this.Ge()}Uy(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&Jt(o,n)}this.st(!0)}jy(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)}}kl(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=$f({position:je,width:a.width+jr,height:a.height+jr,left:s.x,top:s.y,clazz:wT+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(Av,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(Bf,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.jy(e.vertex,l),this.ui.$_dataLoading||(this.st(!0),this.Ge())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Pr:ht}getPan(){return this.panzoom.getPan()}bp(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+jr,t.style.height=n.height+jr,this.Ge(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(Av,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.Ge()}Ap(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.st(!0)),t||this.Ge()}$nodeRemoved(e){this.Ap(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.Ap(e,!1)}$groupResized(e){this._n({id:e.element.id,size:e.newGroupSize}),this.st(!0)}Os(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);Jt(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.Os(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.Os(e))}}Xy(){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.Ge()}zy(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}Ge(){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+jr,this.pannerElement.style.height=this.uiBounds.vh+jr,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},Jt(this.pannerElement,this.pannerPos)}}fp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||hn(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(Bn,"type",$L),Bn=Nt([wt($L)],Bn);var Sv="vjs-pan-mode",Tv="vjs-zoom-to-fit",vv="vjs-zoom-in",Cv="vjs-zoom-out",Ff="vjs-select-mode",Pv="vjs-undo",Ov="vjs-redo",_v="vjs-clear-dataset",MV="vjs-selected-mode",Ap="vjs-controls",Rv="vjs-export-controls",Lv="vjs-controls-reset-selection",VV="vjs-copy-paste-controls";var wv=class{constructor(r){c(this,"ui");this.ui=r.ui}};var GV="Clear dataset?",Dv="vjs-selected-mode",BL="vjs-controls-has-selection",FL="can-undo",UL="can-redo",YL="data-undo",zL="data-redo",xa="data-mode",XL="data-reset",jL="data-clear",HL="data-zoom-in",kL="data-zoom-out",Nv="data-reset-selection",WL="data-vjs-orientation",ZL="0 0 32 30",JL="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",KL="0 0 24 24",qL="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",QL="0 0 24 24",e0="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",t0="0 0 24 24",r0="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",n0="0 0 24 24",i0="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",o0="0 0 24 24",s0="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",Iv="0 0 32 32",a0="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",l0="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 $V(){return`<i class="${Sv}" ${Dv} ${xa}="${xr}" title="Pan Mode">
|
|
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 oa=class extends vc{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var Qu=class extends oa{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 ep=class extends oa{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||K(e))&&e.group==this.group}};var tp=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?Ne.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 rp=class extends Id{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new tp(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function si(i){return kr(i)&&i.useHTMLElement!==!0}function Jo(i){return i.isSimpleShape}function uV(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function pV(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function sa(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=ql.getElement(r,i,i.component);return L(e,r.labelOverlayClass),e}else return Xo(r,i),i.textElement}function Eh(i,r){return ql.getElement(r,i,i.component,e=>{let t=i.create(e);return L(t,r.overlayClass),t})}var aa=class extends Tu{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);this.model=e;c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"I");c(this,"nl");c(this,"xu");c(this,"Tn");c(this,"nr");c(this,"Ve");c(this,"ir");c(this,"bu");c(this,"ge");c(this,"il");c(this,"Au",new Set([_l,Io,Mo,tu,Gi,ru]));c(this,"nt",null);c(this,"Di",[]);if(o=o||{},a=a||{},this.ge=new fe,this.clipboard=new rp(this),this.I=s,this.containerType=Mu(this.getContainer()),this.bu=a.hoverEvents!==!1,this.ir=Xl,this.nl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.xu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.il=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new Ru(this,{edgeMappings:o.edges.propertyMappings})),this.Tn=[],this.Su(),this.on(n,"animationend",X($i,Vo),h=>{let d=h.target;d.style.animation=null,F(d,af)}),a.resizeObserver!==!1)try{this.Ve=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,Pt);if(p!=null){let m={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},g=this.viewport.getElement(p);g!=null&&(g.width!==m.width||g.height!==m.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u))}})})}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 ia(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||$T,h),this.sf()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((K(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(Ot(n.parentElement)){let s=xt(e,e.c,e.r);o(s),ln(n,s),jo(n,e.r)}else{jo(n,e.r);let s=rr(e);o(s),Ce(n,s)}t&&(this.$repaintUIElement(e),this.le(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.Au.add(t))}$enableVertexDrag(){this.nr.$enable()}$disableVertexDrag(){this.nr.$disable()}$canDrop(e,t,n){return this.il!=null?this.il(e,t,n):!0}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.I.usesWrapperElement&&t.firstElementChild!=null&&this.Au.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new Qu(this)}$createGroupLayoutAdapter(e){return new ep(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.")}sf(){this.nt=this.getShapeLibrary().getSvgDefsElement(),this.nt.style.position="absolute",this.nt.style.width="1px",this.nt.style.height="1px",this.nt.style.left="-10000px",this.nt.style.top="-10000px",this.getContainer().appendChild(this.nt)}af(e,t,n){let s=["edge",t].join(":");if(n.lf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.wi(t,s,e.component,n,e)}$isAsynchronousRender(){return this.I.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:ht}$doVertexUpdated(e){this.I.reactive===!1&&this.I.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.I.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.me,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.me,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(Xl);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return qS(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return an(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){qE(e,t)}$updateElementClasses(e,t,n){Vt(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.ge.on(a,t,n):this.ge.on(a,t,n,o)};return Nn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Nn(e)?e.forEach(o=>this.ge.off(o,t,n)):this.ge.off(e,t,n),this}trigger(e,t,n,o,s){this.ge.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return zi(e)}hf(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=hn(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,o=this.getContainer(),s=hn(n,t);if(this.hf(n,s,o),o!=null&&!isNaN(o.scrollTop)&&!isNaN(o.scrollLeft)&&(o.scrollTop>0||o.scrollLeft>0)){let a=n.offsetParent!=null?this.$getStyle(n.offsetParent,JE):JA,l=this.$getStyle(n,JE);l!==je&&l!==uE&&a!==je&&a!==uE&&(s.x-=o.scrollLeft,s.y-=o.scrollTop)}return s}$setElementSizeInUI(e,t,n){Rr(e,t,n)}$setElementWidth(e,t){yT(e,t)}$setElementHeight(e,t){xT(e,t)}$getSize(e){return it(e)}$setElementRotation(e,t){jo(e,t)}$getElementPositionInUIRelativeToParent(e){return hn(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==_x?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,WS);return t&&t.length>0?t[0]:this.I.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return QS.apply(null,arguments)}$setViewportElementPosition(e,t){if(e.r!==0)if(Ot(e.el.parentElement)){let n={x:t.x+e.width/2,y:t.y+e.height/2},o=xt(t,n,e.r);ln(e.el,o),jo(e.el,e.r)}else Ce(e.el,t);else Ce(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,At))}isDraggable(e){let t=this.$getAttribute(e,_l);return t==null||t===at}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}wi(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||TE}ds(e,t){let o=Zt(Yo(t),Dn,this.getContainer(),!0).jtk.overlay;o&&this.af(o,e,t)}df(e){this.ds(Ue,e)}uf(e){this.ds(yo,e)}pf(e){this.ds(W,e)}mf(e){this.ds(Fr,e)}us(e,t,n){if(!n.defaultPrevented&&n.lf==null){let o=Zt(Yo(n),Zr,this.getContainer(),!0);this.wi(e,t,o.jtk.connection,n,null)}}gf(e){this.us(Ue,Sb,e)}Ef(e){this.us(yo,Tb,e)}ff(e){this.us(W,Ob,e)}yf(e){this.us(Fr,vb,e)}Tu(e,t){let o=Zt(Yo(t),Dn,this.getContainer(),!0).jtk.overlay;o&&this.vu(o.component,e,t)}xf(e){this.Tu(!0,e)}bf(e){this.Tu(!1,e)}vu(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(Ze)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(Ze)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(Ze)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Vt(e.sourceElement,[Ef]),Vt(e.targetElement,[ff])):(Vt(e.sourceElement,[],[Ef]),Vt(e.targetElement,[],[ff]));let a=t?tt:et,l=t?Ed:gd;this.wi(a,l,e,n,null)}}Cu(e,t){var o;let n=Yo(t).parentNode;this.vu((o=n.jtk)==null?void 0:o.connection,e,t)}Af(e){this.Cu(!0,e)}Sf(e){this.Cu(!1,e)}Ou(e,t){let n=Yo(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(ji)&&!o.classList.contains(Hi)){let s=e?oe:ue,a=e?Cb:ml;this.wi(s,a,n.jtk.connection,t,null)}}}Tf(e){this.Ou(!0,e)}vf(e){this.Ou(!1,e)}Cf(e){let t=Yo(e).parentNode;t.jtk&&t.jtk.connection&&this.wi(gt,Pb,t.jtk.connection,e,null)}Of(e){let t=this.getModelObjectFromElement(e.target,!0,!1);if(t!=null)return{el:t.el,obj:t.obj,e,model:this.model,ui:this}}or(e,t,n){if(!e.defaultPrevented){let o=this.Of(e);if(o!=null){let s=K(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):H(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}Pf(e){this.or(e,Ue,mb)}_f(e){this.or(e,yo,gb)}Rf(e){this.or(e,W,Ab)}Lf(e){this.or(e,Fr,Eb)}wf(e){this.or(e,gt,bb)}Df(e){this.or(e,et,fb)}Nf(e){this.or(e,tt,yb)}If(e){this.or(e,ie,xb)}Mf(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}Vf(e,t,n){let o=n.bind(this);this.Tn.push({eventName:e,handler:o}),this.ge.on(this.getContainer(),e,t,o)}addDragHandler(e){this.nr==null?this.Di.push(e):this.nr.addHandler(e)}Gf(){this.nr!=null&&this.nr.destroy(),this.Di=this.Di||[],this.nr=new yf(this.me,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.Pu(e)}),this.Di.forEach(e=>this.nr.addHandler(e)),this.Di.length=0}Pu(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=se(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.ps(de.objectType,this.getContainer())}$getGroupsInViewport(){return this.ps(le.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return wn()}$isArrayLike(e){return super.$isArrayLike(e)||Nn(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(),ke(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}Su(){if(this.Tn!=null){this.ol();let e=[[Ue,Dn,this.df],[yo,Dn,this.uf],[W,Dn,this.pf],[Fr,Dn,this.mf],[Ue,Zr,this.gf],[yo,Zr,this.Ef],[W,Zr,this.ff],[Fr,Zr,this.yf],[Ue,this.ir,this.Pf],[yo,this.ir,this._f],[W,this.ir,this.Rf],[Fr,this.ir,this.Lf],[W,ZS,this.Mf],[gt,Zr,this.Cf],[oe,Zr,this.Tf],[ue,Zr,this.vf],[gt,Xl,this.wf]];this.bu===!0&&e.push.apply(e,[[tt,Zr,this.Af],[et,Zr,this.Sf],[tt,Dn,this.xf],[et,Dn,this.bf],[et,this.ir,this.Df],[tt,this.ir,this.Nf],[ie,this.ir,this.If]]),e.forEach(t=>{this.Vf(t[0],t[1],t[2])})}}ol(){let e=this.getContainer();e&&this.Tn!=null&&(this.Tn.forEach(t=>{this.ge.off(e,t.eventName,t.handler)}),this.Tn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.ol(),this.$setAttribute(e,WE,V().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(WE),Array.from(t.childNodes).filter(o=>o!=null&&(an(o,Zs)||an(o,Js)||o.getAttribute&&o.getAttribute(Pt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=Mu(e),this.ge!=null&&(this.Gf(),this.Su())}reset(){super.reset(),this.Ve&&this.Ve.disconnect(),this.getContainer().querySelectorAll([Xl,Zr,Dn].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.nt!=null&&this.nt.parentNode!=null&&this.nt.parentNode.removeChild(this.nt),this.ol(),super.destroy()}$__unmanage(e,t,n){this.Ve!=null&&this.Ve.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(Jo(e))Ql(this,e).map(n=>L(n,t));else if(si(e))Xo(this,e).map(n=>L(n,t));else if(kr(e))L(sa(e,this),t);else if(sn(e))L(Eh(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(Jo(e))Ql(this,e).map(n=>F(n,t));else if(si(e))Xo(this,e).map(n=>F(n,t));else if(kr(e))F(sa(e,this),t);else if(sn(e))F(Eh(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.sl(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.sl(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.sl(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(H(e))return this.getPortDefinition(e);if(K(e))return this.getNodeDefinition(e)}sl(e){return e!=null&&e.template&&e.templateId==null&&this.I.addTemplate&&(e.templateId=V(),this.I.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.I.recado!=null&&this.I.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),m=a,g;m=Object.assign({},l?l.parameters||{}:{}),Object.assign(m,a);let E={};for(g in m)m.hasOwnProperty(g)&&m[g]!=null&&(m[g].constructor==Function?E[g]=m[g](a):E[g]=m[g]);if(m=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);m[this.$modelWidthAttribute]=x.width,m[this.$modelHeightAttribute]=x.height}d?this.I.rerender(y,m,this.model,e,this,l,s,h,u):this.I.render(y,m,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.nl(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.nl(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.xu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(Jo(e))pT(this,e,t,n);else if(si(e))mT(this,e,t,n);else if(kr(e)){sa(e,this);let o=t,s=e;s.contentElement.style.left=o.d.minx+jr,s.contentElement.style.top=o.d.miny+jr}else if(sn(e)){let o=Eh(e,this),s=t,a=e;if(e.location===0||e.location===1){let h=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(o,{"data-anchor-x":`${h.x}`,"data-anchor-y":`${h.y}`,"data-anchor-ox":`${h.ox}`,"data-anchor-oy":`${h.oy}`})}a.contentElement.style.left=s.d.minx+jr,a.contentElement.style.top=s.d.miny+jr}else throw"Could not paint overlay of type ["+e.type+"]"}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,wl):L(o,wl))}if(Jo(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else si(e)?e.contentElements&&e.contentElements.forEach(n):kr(e)?n(sa(e,this)):sn(e)&&n(Eh(e,this))}$reattachOverlay(e,t){Jo(e)?Ql(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):si(e)?Xo(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):kr(e)?this.$appendElement(sa(e,this),this.getContainer()):sn(e)&&this.$appendElement(Eh(e,this),this.getContainer())}$setOverlayHover(e,t){let n;Jo(e)?n=Ql(this,e):si(e)?n=Xo(this,e):kr(e)?n=[sa(e,this)]:sn(e)&&(n=[Eh(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Vt(o,t?[oh]:[],t?[]:[oh])}),this.$setHover(e.component,t))}destroyOverlay(e){Jo(e)&&e instanceof $u?ef(e):si(e)?ef(e):dT(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):sn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(Jo(e))return e.draw(t,n,o);if(si(e)){let s=Xr(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth;return{d:{loc:s},"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)||sn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let h=e.location,d=!1;(z(e.location)||e.location<0||e.location>1)&&(h=parseInt(""+e.location,10),d=!0),s=Xr(t,h,d)}let a=s.x,l=s.y;return{d:{minx:a,miny:l,cxy:s},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=sa(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){GT(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&&Vt(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Vt(o,t?[oh]:[],t?[]:[oh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.Qo===Fi&&this.setOverlayVisible(s,t)}),this.pt||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&pV(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){uV(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.I.cleanupVertex(e.node.id,t.el),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.I.cleanupVertex(e.group.id,t.el),t}addClass(e,t){e.constructor===mr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.al(e,t,L)}removeClass(e,t){e.constructor===mr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.al(e,t,F)}toggleClass(e,t){e.constructor===mr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.al(e,t,qE)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?an(n.el,t):Xi(e)?an(e,t):!1}}al(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):Xi(s)&&n(s,t)};e!=null&&(Nn(e)?n(e,t):KS(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){kt.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!Ot(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.Ve!=null&&this.Ve.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Zt(e,be(on),this.getContainer(),!0)||Zt(e,be(ee),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!Ke(h.obj)){l=h.obj;let u=h.missingPortCreated,p=H(l)?l.getParent():l,m={},g=t?Vi:Gi;if(o=e.getAttribute(g)||e.getAttribute(Hr),!H(l)){let E=t?[Ws,gE]:[Mo,tu];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(on)||e.getAttribute(Rl),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return H(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?m=this.view.getPortDefinition(o):m=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:m,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return Xi(e)}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.component.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(ee);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(on)||s.getAttribute(Ws)||s.getAttribute(Mo);if(h!=null){let d=Zt(s,be(Pt),this.me,!1);if(d!=null){let u=d.getAttribute(Pt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let m=s.getAttribute(Hr)||s.getAttribute(Vi)||s.getAttribute(Gi)||xe;return{obj:p.$addPort({id:h,type:m}),el:s,missingPortCreated:!0}}else{let m=p.getPort(h);return m==null?null:{obj:m,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.me?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(H(e)?e.getFullId():e).split("."),o=this.getRenderedElement(n[0]);return o?o.querySelector(qr(on,n[1]))||o.querySelector(qr(Mo,n[1]))||o.querySelector(qr(Ws,n[1]))||o:null}$isSupportedElement(e){return Xi(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=$(ve,a,o,s);return Rr(l,t.width,t.height),this.containerType==="SVG"?ln(l,e):Ce(l,e),l}getRenderedElement(e){var s;if(e==null)return null;let n=(z(e)?e:e.getFullId()).split(this.model.portSeparator),o=(s=this.$getManagedElement(n[0]))==null?void 0:s.el;if(o&&n.length>1){let a=o.querySelector(qr(on,n[1]))||o.querySelector(qr(Ws,n[1]))||o.querySelector(qr(Mo,n[1]));if(a==null){if(this.logicalPorts===!0||o.getAttribute(on)===n[1]||o.getAttribute(Ws)===n[1]||o.getAttribute(Mo)===n[1]||o.getAttribute(Rl)===n[1]||o.getAttribute(gE)===n[1]||o.getAttribute(tu)===n[1])return o}else return a}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)),m=Math.max(d,Math.abs(n.y-t.y)),g=$(ve,{viewBox:`0 0 ${p} ${m}`});g.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:m,x=t.x>n.x?0:p,f=t.y>n.y?0:m,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:m},type:On,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=(R,v,O)=>{let[P,I]=z(R)?[R,{}]:[R.type,R.options],C=ho(I,l,"_");C.location=v,C.direction=O;let _=nt.get(this,P,{instance:this},C),w=this.$drawOverlay(_,A,{stroke:u,fill:u});if(_.isSimpleShape){let B=_,D=w;B.contentTags.forEach((M,N)=>{let G=$(M,D.atts[N]);g.appendChild(G)})}else if(si(_)){let B=_,D=w;B.contentElements.forEach(M=>{ln(M,D.d.loc),g.appendChild(M)})}else if(sn(_)){let B=_,D=w;B.contentElements.forEach(M=>{ln(M,D.d.loc),g.appendChild(M)})}return w};if(s!=null){let R=T(s,0,-1);E=R.tail.x,y=R.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let R=T(a,1,1);x=R.tail.x,f=R.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=$(te,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return g.appendChild(S),o.forEach(R=>{let[v,O]=z(R)?[R,{}]:[R.type,R.options],P=ho(O,l,"_"),I=nt.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let _=I,w=C;_.contentTags.forEach((B,D)=>{let M=$(B,w.atts[D]);g.appendChild(M)})}else if(si(I)){let _=I,w=C;_.contentElements.forEach(B=>{ln(B,w.d.loc),g.appendChild(B)})}else if(kr(I))if(I.useHTMLElement){let _=C,w=I.contentElement;h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}else{let _=$(te,C.atts[0]);g.appendChild(_)}else if(sn(I)){let _=C,w=I.create(null);w.style.position=je,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}}),h.appendChild(g),h}toBack(e,t){let n=this.getObjectInfo(e,!1);n.el&&n.el.parentElement&&(n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),t&&n.obj.group!=null&&this.toBack(n.obj.group))}toFront(e,t){let n=this.getObjectInfo(e,!1);n.el&&n.el.parentElement&&(t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null))}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(Ot(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&&Xi(o)&&(t?o.removeAttribute(fr):o.setAttribute(fr,at)),t}flashVertex(e,t=1e3,n=TT){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,af))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof mr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var la=`<div data-vjs-vertex="{{id}}" class="${$i} ${pf}">{{label}}</div>`,iL="<div/>",oL=`<div data-vjs-vertex="{{id}}" class="${Vo} ${mf}">{{label}}</div>`,ha=`<svg:rect data-vjs-vertex="{{id}}" class="${$i} ${pf}" x="0" y="0" width="80" height="60"/>`,sL='<svg:rect x="0" y="0" width="100%" height="30"/>',aL=`<svg:rect data-vjs-vertex="{{id}}" class="${Vo} ${mf}" x="0" y="0" width="300" height="250"/>`,mV={html:{"vjs-node-default":la,"vjs-group-default":oL,"vjs-port-default":iL},svg:{"vjs-node-default":ha,"vjs-group-default":aL,"vjs-port-default":sL}},KT=(i,r)=>mV[i][r],np=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}),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.ie(h),this.render(r,e,t,n,o,s,a,l)}ie(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.ie(e)}cleanupPort(r,e){this.ie(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.ie(r)}};function fh(i,r,e){let t=n=>KT(r?"svg":"html",n)||xf(n)||i;return new np(i,t,e)}var gV="pointerdown",EV="pointermove",fV="pointerup",yV="touchstart",lL="touchmove",hL="touchend";function cL(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var ip=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=cL(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.Vr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this._u())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.Vr(this.onPinch))};this.bind(r.el,gV,a,{passive:!1}),this.bind(document,fV,l,{passive:!1}),this.bind(document,EV,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 cL(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,lL,h),this.bind(document,hL,l),ae(d),this.Vr(this.onPinchStart))},l=d=>{s=!1,ae(d),this.unbind(document,lL,h),this.unbind(document,hL,l),this._u()},h=d=>{if(s){let u=e(d);u.length===2&&(ae(d),this.radius=n(u),this.center=o(u),this.Vr(this.onPinch))}};this.bind(r.el,yV,a)}});this.eventManager=new fe,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)}Vr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}_u(){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 op=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}$f(r,e){if(e===Q){let t=r.pos[e];if(r.alignX===ut){let n=it(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===st){let n=it(r.el);return t-n.height}return t}}ll(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.$f(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(Ye,"x",(a,l)=>{ET(a,l),o.currentPosition.x=l}),s(Se,"y",(a,l)=>{fT(a,l),o.currentPosition.y=l})}}pan(){this.ll()}append(r,e,t,n,o){if(r==null)return;let s=r;if(Ot(this.panZoom.canvasElement)&&!Ot(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||Ye,alignY:t.alignY||Se,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},Ot(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.ll(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.ll())}destroy(){this.panZoom=null,this.fixedElements=null}};var xV="transformOrigin",dL="transform",uL="translateX",pL="translateY",mL="scale",yh="px",bV="width",AV="height",EL="vjs-pan-zoom",fL="vjs-pan-zoom-canvas";function ca(){}function gL(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 da=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"Ru");c(this,"Dt");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,"cl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"hl");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"zr");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,"wheelFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"dl");c(this,"ul");c(this,"Ni");c(this,"pl");c(this,"ml");c(this,"viewport");c(this,"ms");c(this,"Ve");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"getOffset");c(this,"getOffsetRelativeToRoot");c(this,"getSize");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"Ii",{});c(this,"gl",!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.Hf===!0}else return!1})(r)&&(this.xl(),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.zr=this.$_getViewportSize(),this.ar(),this.Sl(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.kf(r)&&(this.zr=this.$_getViewportSize(),this.ar(),this.panning=!0,this.aboutToPan=!0,this.downAt=me(r),this.canvasAtPanStart=Object.assign({},this.position),ae(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.Tl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){ae(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=me(r),t=(o.x-this.downAt.x)/this.ms,n=(o.y-this.downAt.y)/this.ms;let s=this.it({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(),ae(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.zr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,ie,this.dl),this.eventManager.off(document,oe,this.ul),this.eventManager.on(document,ie,this.Ni),this.onMouseUp(r,this))},[gt]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||pS,this.cl=r.zoomStep||.25,this.fixedLayer=new op(this,r.elementPositionSetter),this.eventManager=new fe,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ve=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.ar()})}),this.Ve.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.it({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,EL),L(this.canvasElement,fL),this.idFunction=r.idFunction,this.getOffset=r.getOffset,this.getOffsetRelativeToRoot=r.getOffsetRelativeToRoot,this.getSize=r.getSize,this.onZoom=r.events.zoom||ca,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||ca,this.onPanStart=r.events.panStart||ca,this.onMouseDown=r.events.mousedown||ca,this.onMouseUp=r.events.mouseup||ca,this.onMouseMove=r.events.mousemove||ca,this.onSetTransformOrigin=r.events.transformOrigin||ca,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.hl=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let e=r.wheel||{};this.enableWheelZoom=e.zoom!==!1,this.wheelFilter=e.filter||(()=>!0),this.wheelZoomRequiresMetaKey=e.useMetaKey===!0,this.wheelDirection=e.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(e.sensitivity||10),this.wheelPan=e.pan===!0,this.wheelPanAxis=e.axis||"both",this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.dl=function(t){this.El("move",t)}.bind(this),this.ul=function(t){this.El("end",t)}.bind(this),this.Ni=function(t){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.Dt=(t,n,o,s)=>this.wheelPanOrZoom(t,n,o,s),Wl(this.viewportElement,this.Dt,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new ip({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(t,n,o,s)=>{this.j(s*this.zoomAtZoomStart);let a=t.x-this.downAt.x,l=t.y-this.downAt.y;this.it({x:this.canvasAtPanStart.x+a,y:this.canvasAtPanStart.y+l,animate:!1})},onPinchStart:(t,n)=>{this.pinchZooming=!0,this.downAt=t,this.distanceAtZoomStart=this.lastDistance=n,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.j(this.zoom,null,!1,!1,!0),this.yl(),this.background=new qT,r.background&&this.background.addBackground(r.background),this.pl=t=>{this.start(t)},this.eventManager.on(this.viewportElement,ue,this.pl),this.eventManager.on(document,ie,this.Ni),this.ml=t=>{this.El(gt,t)},this.eventManager.on(this.viewportElement,gt,this.ml),this.ar(),this.xl()}getCompoundZoom(){return this.ms}xl(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.ms=e.width/r.width}$_getViewportSize(){return this.zr=this.getSize(this.viewportElement),this.zr}ar(){return this.vn=this.getSize(this.canvasElement),this.vn}Bf(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=m=>{u||(u=m);let g=m-u,E=g/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)`,g<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}it(r){let e=this.Lu(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.wu(r.zoom);this.Bf(t,e.x,e.y,r.animationDuration)}else this.position=e,this.Du(null,r.onComplete);else this.position=e,this.Al(),r.onComplete&&r.onComplete(this.position);return this.position}Nu(r,e,t,n,o){let s=this.position;return this.it({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}Ff(r,e,t,n){n||this.pan(-e*100,-t*100)}Uf(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.Sl(r),this.zoomingWithWheel=!0),this.Tl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.Uf(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===Q?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===Ee?t:0,this.Ff(r,e,t,n)))}zf(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)})}Iu(){return`${mL}(${this.zoom}) ${uL}(${this.position.x/this.zoom}${yh}) ${pL}(${this.position.y/this.zoom}${yh})`}Al(){this.canvasElement.style[dL]=this.Iu()}Du(r,e){if(this.canvasElement.animate!=null){let t={[dL]:this.Iu()};this.zf(t,r,e)}else this.Al()}Yf(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}yl(){this.canvasElement.style[xV]=this.Yf()}Xf(r,e){let t=this.fromPageLocation(r,e),n=this.vn||this.ar();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}}}Mu(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.yl(),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.Nu(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}fl(r,e){if(this.fixedTransformOrigin==null){let t=this.Xf(r,e);this.Mu(t.o,t.width,t.height)}}Sl(r){if(this.fixedTransformOrigin==null){let e=me(r);this.fl(e.x,e.y)}}gs(r,e){if(this.fixedTransformOrigin==null){let t=this.vn||this.ar();this.Mu({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}wu(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}j(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.wu(r);let s=this.zoom,a=l=>{if(!this.gl&&(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.Lu(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.it({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.gs(l.x,l.y),this.zoom=r,this.Du(null,a)}else this.zoom=r,this.Al(),a(this.position);return this.zoom}Tl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.jf(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}jf(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.j(h,o,s)}Lu(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.zr||this.$_getViewportSize(),o=this.He(),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 g=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,g),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,m=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),m>l.vh&&(a-=m-l.vh),{x:s,y:a}}}He(){let r=this.vn||this.ar(),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)}}kf(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.hl!=null?this.hl(e)!==!1:!0}El(r,e){r===gt&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=Uo(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,ie,this.Ni),this.eventManager.on(document,ie,this.dl),this.eventManager.on(document,oe,this.ul),this.handlers.start(r,Uo(r)))}getBoundsInfo(r,e){let t=this.zr||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.getBoundsWidth(),o=this.viewport.getBoundsHeight(),s=t.width/((n+r*2)/e),a=t.height/((o+r*2)/e),l=Math.min(s,a);return{width:n,height:o,x:this.viewport.getX(),y:this.viewport.getY(),vw:t.width,vh:t.height,minimumFill:l,zoom:this.zoom}}isPinchZooming(){return this.pinchZooming}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.Ii[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.Ii[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.Ii[e]}remove(r){let e=this.idFunction(r);delete this.Ii[e]}reset(){this.Ii={},this.it({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.j(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.j(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.j(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.j(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]||Ye,o=t[1]||Se,s=this.getBoundsInfo(),a=n===Ye?0:s.vw-this.background.getWidth()*this.zoom,l=o===Se?0:s.vh-this.background.getHeight()*this.zoom,h=this.He();this.it({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}positionElementAt(r,e,t,n,o,s){n=n||0,o=o||0;let a=this.He(),l=this.position,h=r.parentNode,d=this.getOffset(h),u=this.getOffset(this.viewportElement),p=u.x-d.x+(l.x+a.x)+e*this.zoom+n,m=u.y-d.y+(l.y+a.y)+t*this.zoom+o;s&&p<0&&(p=0),s&&m<0&&(m=0),r.style.left=p+"px",r.style.top=m+"px"}positionElementAtPageLocation(r,e,t,n,o){let s=this.fromPageLocation(e,t);this.positionElementAt(r,s.x,s.y,n,o)}positionElementAtEventLocation(r,e,t,n){let o=this.mapEventLocation(e);this.positionElementAt(r,o.x,o.y,t,n)}zoomToEvent(r,e){this.Sl(r),this.j(this.zoom+e,r)}$relayout(r){if(this.enablePan===!1){let e=r.xmax-r.xmin,t=r.ymax-r.ymin,n=window.getComputedStyle(this.viewportElement),o=parseInt(n.getPropertyValue(bV),10),s=parseInt(n.getPropertyValue(AV),10),a=o/e,l=s/t,h=Math.min(a,l);this.canvasElement.style.width=o+yh,this.canvasElement.style.height=s+yh,this.canvasElement.style.left="0",this.canvasElement.style.top="0";let d=-r.xmin,u=-r.ymin;this.canvasElement.style.transform=`${uL}(${d*h}${yh}) ${pL}(${u*h}${yh}) ${mL}(${h})`,this.setTransformOrigin(0,0)}}nudgeZoom(r,e){let t=this.getOffsetRelativeToRoot(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.fl(o,s),this.j(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Tl(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.ar(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.He(),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,m=this.position.x,g=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?g:r.alignY===st?y:r.alignY===Rt?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?m:r.alignX===ut?b:r.alignX===Rt?d-a.x:f*this.zoom;this.it({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.gl||(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=Se,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=st,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=Ye,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=ut,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:Rt,r.alignY=r.vertical===!1?null:Rt,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.gs(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.gs(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.He(),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.He(),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.it({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.j(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.j(this.zoom+this.cl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.j(this.zoom-this.cl,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.j(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.Nu(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.it({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.Ru=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.Ru)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.yl()}fromPageLocation(r,e,t){let n=this.He(),o=this.position,s=gL(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.He(),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.He(),n=this.position,o=gL(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}}mapEventLocation(r){let e=me(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}showElementAt(r,e,t){let n=r.parentNode,o=this.getOffset(n),s=this.getOffset(this.viewportElement),a=this.He(),l=o.x-s.x+a.x+e,h=o.y-s.y+a.y+t;r.style.left=l+"px",r.style.top=h+"px"}getApparentCanvasLocation(){let r=this.He(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.He(),n=this.it({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.Ve!=null&&(this.Ve.disconnect(),this.Ve=null),this.Dt!=null&&Zl(this.viewportElement,this.Dt),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,ie,this.Ni),this.eventManager.off(this.viewportElement,ue,this.pl),this.eventManager.off(this.viewportElement,gt,this.ml),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.gl=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},qT=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}Nt(r){this.backgrounds.forEach(e=>e.Nt(r))}};function BTe(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),m=o+(e-o)*p;i.setZoom(m);let g={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(g.x,g.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var QT={},sp=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=hn(s.el),l=it(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()}},xh=class extends sp{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 SV(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new xh(s,e,t,n,o,s.incremental)}}var ap={get:(i,r,e,t,n)=>{let o=QT[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{sx(r,sp)?QT[i]=r:QT[i]=SV(r)}};function ev(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=V()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||V()),s!=null&&a!=null)l=ap.get(s,a,r,e,h);else{let u=o;h=u.id||V(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new xh(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 vf=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)=>{Or(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var tv="default",TV="center",yL="perimeter",bh=qr(eS,At),xL=qr(Io,At);function bL(i){return rv(i,xL)}function vV(i){return rv(i,bh)}function rv(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 lp(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function hp(i,r,e,t){let n=null,o=i.getEffectiveVisibleZoom();for(let s=0;s<r.length;s++)if(ke(e,r[s].r)){n=r[s];let a=r[s].modelInfo.typeDef,l=r[s].modelInfo.objEl,h=Vu(t,l,o);r[s].positionOnElement=h,a.anchorPositionFinder!=null?r[s].anchor=a.anchorPositionFinder(l,h,n.modelInfo.vertex,a):r[s].anchor=null;break}return n}function CV(i,r,e,t,n){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let o=n?e.obj:t,s=n?t:e.obj;if(i.model.beforeConnect(o,s)===!1)return!1}return!0}function Ah(i,r,e,t,n){return nv(i,r,e,!1,t,n)}function iv(i,r,e,t,n){return nv(i,r,e,!0,t,n)}function nv(i,r,e,t,n,o){let s=[],a=[];return bL(i).forEach(h=>{if(h.getAttribute(fr)!==at){if(o!=null&&h.getAttribute(Yl)!==o)return;let d=lp(i,h,!1);if(!n&&d.obj===e)return;if(CV(i,r,d,e,t)){let u=h.getBoundingClientRect();s.push({modelInfo:d,isGroup:Y(d.obj),r:u,targetEl:h,targetPortType:h.getAttribute(Hr)||h.getAttribute(Gi),magnet:h.getAttribute(ru)===At}),L(h,Kt)}else r&&(h.setAttribute(fr,at),a.push(h))}}),s.sort((h,d)=>{if(h.isGroup&&!d.isGroup)return 1;if(!h.isGroup&&d.isGroup)return-1;if(h.isGroup&&d.isGroup){if(We(h.modelInfo.vertex,d.modelInfo.obj))return-1;if(We(d.modelInfo.vertex,h.modelInfo.obj))return-1}else return 0}),{dropTargets:s,disabledDropTargets:a}}var ua=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,"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||tv,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.rtree=new Us}Vu(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=Be(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Be(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),ms(o[0],r,!0)?r:n===yL||n===tv&&(o[0].width>t||o[0].height>t)?lx(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,Be(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 SL="vjs-transient-vertex",AL="vjs-edge-click-entry-method",Mn="keyup",Zi="drag",Sh="click",Th="idle",RCe="dragging",Cf="awaitingClick",Pf="locked",dp=class extends ua{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",Zi);c(this,"currentState",Th);c(this,"vl");c(this,"Cl");c(this,"Ol");c(this,"Pl");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"he");this.currentMethod=e.method||Zi,this.vl=e.vl,this.Cl=e.Cl,this.Ol=e.Ol,this.Pl=e.Pl,this.tapHandler=this.Wf.bind(this),this.mousemoveHandler=this.Pi.bind(this),this.canvasTapHandler=this.Zf.bind(this),this.documentKeypressHandler=this._l.bind(this),this.surface.addDragHandler({selector:bh,start:t=>this.Rl(t),drag:t=>this.Ll(t),stop:t=>{this.wl(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h={x:t.x-this.scrollAtPageDown.x,y:t.y-this.scrollAtPageDown.y},d=this.surface.getEffectiveVisibleZoom(),u=this.Vu(h,this.edgeSnapThreshold*d,this.edgeSnapSizeThreshold*d,this.edgeSnapType);return{x:u.x+this.scrollAtPageDown.x,y:u.y+this.scrollAtPageDown.y}}else return t}}),this.surface.on(this.container,W,bh,this.tapHandler),this.surface.addDragSelectorFilter(bh)}ie(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,Kt),H(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(fr)}),this.disabledDropTargets.length=0,F(document.body,ct),F(document.body,AL),F(this.surface.rootElement,In),this.surface.off(document,ie,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Mn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,qt),this.currentDropTarget=null),this.transientInfo!=null&&(this.he&&this.he.unobserve(this.transientInfo.el.el),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Th}Gu(e,t,n,o){var h;let s=n.getAttribute(eu)||((h=e.typeDef)==null?void 0:h.edgeType),a=me(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:je,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},SL);let l=Object.assign({},o||{});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,In),this.he&&this.he.observe(this.transientInfo.el.el)}$u(e){return this.currentPagePosition={x:e.x,y:e.y},this.Jf()}Jf(){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{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}Bu(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:lo(t)?{}:t}}Rl(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===Zi){let t=e.el;if(t.getAttribute(fr)!==at){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=lp(this.surface,t,!0);if(n!=null){let o=this.Bu(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(Vi),this.u.edgeType=t.getAttribute(eu)||"";let s=t.getAttribute(Yl);this.u.scope=s,this.Gu(n,e.e,t,o.payload),L(document.body,ct);let a=n.typeDef.allowLoopback===!0||t.getAttribute(mE)===At||this.allowLoopbackEdges,l=Ah(this.surface,this.activeFiltering,n.obj,a,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.dropTargets.forEach(h=>{(!this.edgeSnapRequiresMagnets||h.magnet)&&this.rtree.insert({x:h.r.x,y:h.r.y,width:h.r.width,height:h.r.height,children:[],id:V()})}),this.surface.$startMotion(),!0}}}}return!1}Dl(e){if(this.transientEdge!=null){ae(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=Vu(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?H(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):(Y(n)||K(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=me(e);n=this.surface.fromPageLocation(s.x,s.y)}this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},co,null)},()=>{})}}wl(e){this.surface.$stopMotion(),this.Dl(e.e)}Fu(e,t){this.Kf();let n=e();if(this.currentMethod===Sh&&this.currentState==Cf){let s=me(t);this.$u(s)}let o=hp(this.surface,this.dropTargets,n,t);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,qt),o!=null){if(L(o.targetEl,qt),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}Pi(e){let t=me(e);this.Fu(()=>({x:t.x,y:t.y,width:5,height:5}),e)}Ll(e){this.Fu(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.$u(t);else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}Kf(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}Wf(e){if(this.currentMethod===Sh&&this.currentState!==Pf){let t=e.target||e.srcElement;if(t.getAttribute(fr)!==at){let n=lp(this.surface,t,!0);if(n!=null){if(this.currentState===Th){ae(e),this.pageDownAt=me(e),this.u={};let o=this.Bu(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(Vi),this.u.edgeType=t.getAttribute(eu);let s=t.getAttribute(Yl);this.u.scope=s,this.currentSource=n.obj,L(document.body,AL),this.Gu(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(mE)===At||this.allowLoopbackEdges,l=Ah(this.surface,this.activeFiltering,n.obj,a,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=Cf,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,ie,this.mousemoveHandler),document.addEventListener(Mn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===Cf){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.Dl(e)}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.ie()}Zf(e){if(!e.defaultPrevented&&this.currentMethod===Sh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=me(e);for(let n=0;n<this.dropTargets.length;n++)ms(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.Dl(e),this.$_exitTapMode())}}_l(e){this.currentState===Cf&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var ov="primed",sv="idle",av="active",up=class extends ua{constructor(e){super(e);c(this,"Nl");c(this,"Il");c(this,"It");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"Oe");c(this,"he");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"Es",!1);c(this,"Yr");c(this,"Cn");this.Nl=e.inputHandler,this.Il=e.method||Zi,this.It=sv,this.documentKeypressHandler=this._l.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.It===ov){this.Yr=ft({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.Yr),this.Cn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,In),Vt(a,[df],[Fu]),this.Es=!0,this.It=av,this.Nl.currentState=Pf}if(ae(n),this.currentPagePosition=me(n),this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom();this.currentPagePosition=this.Vu(this.currentPagePosition,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.qf();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=hp(this.surface,this.dropTargets,o,n);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,qt),s!=null){if(L(s.targetEl,qt),s.anchor!=null)this.Yr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.Yr.isFixed=!0;else if(s.positionOnElement!=null){let a=cp(s.positionOnElement);this.Yr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.Yr.isFixed=!0}}this.currentDropTarget=s}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(ae(n),this.Es)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===Qe?s:o.source,a===Qe?o.target:s,o)===!1?this.Ml():(this.ie(this.currentDropTarget.anchor),a===Qe?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Cn.dummy===!0?(this.surface.model.updateVertex(this.Cn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.ie()):this.Ml();else(this.Il===Zi||this.It===av)&&this.ie();else this.ie()};let t=n=>o=>{if(!o.defaultPrevented){let s=Zt(o.target,be(Ze),this.container,!1);s!=null&&(this.currentEdge=this.surface.model.getEdge(s.getAttribute(Ze)),this.currentEdge.transient?(this.currentEdge=null,this.It=sv):(this.Cn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),(this.currentConnection.detachable||this.Cn.dummy===!0)&&(this.Es=!1,this.currentIndex=n,ae(o),this.Oe={x:0,y:0},this.currentPagePosition=me(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,ie,this.mouseMoveHandler),this.surface.on(document,oe,this.mouseUpHandler),this.It=ov,this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},MT),this.he&&this.he.observe(this.transientVertex.el.el),this.Qf(),L(this.currentConnection.connector.canvas,Fu),this.Il===Sh&&document.addEventListener(Mn,this.documentKeypressHandler),this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge))))}};this.surface.on(this.container,ue,X(ji),t(Qe)),this.surface.on(this.container,ue,X(Hi),t(xn))}qf(){let e={x:this.currentPosition.x+this.Oe.x,y:this.currentPosition.y+this.Oe.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(fd,this.currentEdge)}Ml(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.$revalidateElementById(this.currentEdge.source.id),this.ie();else{let n=this.currentEdge.id;this.ie(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.Oe.x,y:this.currentPosition.y+this.Oe.y},this.currentIndex):this.surface.model.removeEdge(n)}}ie(e){if(this.rtree.clear(),this.Yr=null,this.dropTargets.forEach(t=>{F(t.targetEl,Kt)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(fr)}),this.disabledDropTargets.length=0,F(document.body,ct),F(this.surface.rootElement,In),Vt(this.currentConnection.connector.canvas,[],[df,Fu]),document.removeEventListener(Mn,this.documentKeypressHandler),this.surface.off(document,ie,this.mouseMoveHandler),this.surface.off(document,oe,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,qt),this.currentDropTarget=null),this.transientVertex!=null&&(this.he&&this.he.unobserve(this.transientVertex.el.el),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.$revalidateManagedElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this.Es=!1,this.It=sv,this.Nl.currentState=Th,this.Cn=null}Qf(){if(this.currentIndex===Qe){let e=iv(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=Ah(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.dropTargets.forEach(e=>{(!this.edgeSnapRequiresMagnets||e.magnet)&&this.rtree.insert({x:e.r.x,y:e.r.y,width:e.r.width,height:e.r.height,children:[],id:V()})})}_l(e){(this.It===av||this.It===ov)&&(e.keyCode===27||e.key==="Escape")&&this.Ml(!0)}};var xr="pan",ai="select",Ko="disabled",Vn="vertexDrawing";var pa="vjs-anchor-placeholder",PV="vjs-anchor-candidate",Of="vjs-connection-edit",pp="vjs-edge-guideline",Gn="vjs-edge-handle";var _f=X(pa),lv=12,hv=15;function Rf(i,r,e,t){let n=$(q,e||{});L(n,r),t||(n.style.display=ht);let o=$(ze,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function TL(i,r,e,t,n,o,s){let a=$(q);L(a,n),s||(a.style.display=ht);let l=$(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function OV(i,r,e,t,n,o,s,a){let l=it(r),h=l.width*e,d=l.height*t,u=$(ve);L(u,s),u.style.position=je;let p=$(Z,{x:"0",y:"0",width:n,height:o,"pointer-events":"none"});u.appendChild(p);let m={x:h-n/2,y:d-o/2};return r.appendChild(u),Ce(u,m),u}function cv(i,r,e,t,n,o,s){let a=Rf(t,n,o,s);return i.$appendElementToToolsLayer(a),Ce(a,{x:r,y:e}),a}function dv(i,r,e,t,n,o,s,a,l,h){let d=TL(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),Ce(d,{x:r,y:e}),d}function uv(i,r,e){let t=i.faces,n=[{face:Ye,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:ut,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:Se,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:st,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(Se,[0,-1]),o.set(st,[0,1]),o.set(Ye,[-1,0]),o.set(ut,[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 pv(i,r,e){let t=yc(r,e,i.locations);return vL(t.p,e)}function mv(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 vL(d,o)}}function vL(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 Ji=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"Uu");c(this,"ey");c(this,"$currentEdgeFrame");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"zu",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"lr");c(this,"hr");c(this,"Vl");c(this,"dr");c(this,"fs");c(this,"buttonSize");c(this,"Yu");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"Gl");c(this,"ur");c(this,"ny",{});c(this,"pr",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||lv,this.Yu=e.anchorPlaceholderSize||hv,this.dr=!1,this.ui.model.bind(bn,()=>{this.deactivate()}),this.ui.bind(Zn,l=>{l.edge==this.currentEdge&&this.Xu()}),this.eventManager=new fe,this.$addDragHandler({selector:_f+" *",target:_f,constrainFunction:(l,h,d,u,p,m)=>{let g=h.ys.anchor,E={x:l.x,y:l.y},y=!1,x=this.ur.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.pr.rotation!==0&&(y=!0,E=xt(l,this.pr.center,-this.pr.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.Gl!=null)A=mv(g,this.Gl,x.el,b,this.ur.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(g.isContinuous){let[T,S]=uv(g,E,f);A=T,S!=null&&(g.currentFace=S),this.$hasEdits=!0}else A=pv(g,l,f),this.$hasEdits=!0;return g.fixedLocation=A,g.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x),y&&(l=xt(l,this.pr.center,this.pr.rotation)),l},start:l=>{let d=l.el.ys.vertex;if(this.ur=this.ui.getObjectInfo(d,!1),this.zu.length=0,this.ur.obj!=null)this.Vl=this.$cloneCurrentGeometry(),this.Gl=this.currentEdge.source.id===this.ur.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.pr.rotation=this.ui.$getRotation(d.id),this.pr.rotation!==0&&(this.pr.center={x:this.ur.managedElement.t.c.x,y:this.ur.managedElement.t.c.y});else return!1},stop:l=>{this.zu.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Vl),this.Vl=null,this.ur=null},drag:l=>{this.Xu()}});let t=(l,h)=>{this.iy(l)?h(l):Y(l)&&(We(this.currentEdge.source,l)?h(this.currentEdge.source):We(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.dr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.ly(d)})}),this.$repaint())},o=l=>{this.dr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.hy(d))})};this.ui.bind(Lt,l=>{o(l)}),this.ui.bind(nr,l=>{n(l)}),this.ui.bind(Gr,l=>{o(l)}),this.ui.bind(Wc,l=>{n(l)});let s=l=>{this.dr&&this.currentEdge&&t(l.vertex,h=>this.Vi())};this.ui.model.bind(Ve,s),this.ui.model.bind(Re,s);let a=l=>{this.dr&&this.currentEdge&&l.id===this.currentEdge.id&&(this.$repaint(),this.Mi())};this.ui.bind(fd,l=>{a(l)}),this.ui.model.bind(nn,l=>{a(l.edge)}),this.ui.model.bind(rn,l=>{a(l.edge)})}isBusy(){return this.fs}Xu(){this.Mi(),this.$repaint()}$cloneCurrentGeometry(){return ot(this.currentConnector.geometry)}ju(r){return this.ui.view.getTypeDefinition(r).anchorPositions}ku(r,e){let t={type:e.type,options:Object.assign(e.options,{id:V()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}uy(r,e){this.Hu(),e.forEach(t=>{this.ku(r,t)})}Hu(){this.currentOverlays.forEach(r=>{Ui(this.current,r.id)})}py(r){let e=r.deleteButtonClass||Ks,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.ku(this.current,{type:ir.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){this.current&&(this.ui.$paintConnection(this.current,r),this.Vi(r))}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Vi(r){this.current&&(this.Mi(),this.$repaint&&this.$repaint(r))}Mi(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=e===0?this.current.sourceElement:this.current.targetElement;if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),l=this.ui.$getElementPositionInUIRelativeToCanvasOrigin(o),[h,d]=[a.curX-l.x,a.curY-l.y],u;t!=null?u=t:(u=Rf(this.Yu,pa,{[Ze]:this.currentEdge.id},!0),u.ys={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(u);let p=this.ui.$getSize(u),m={x:l.x+(h-p.width/2),y:l.y+(d-p.height/2)};return Ce(u,m),[[l.x,l.y],u]}else return[[0,0],null]};this.ui.$removeElement(this.lr),this.currentEdge.source.dummy||([this.sourceDimensions,this.lr]=r(0,this.lr)),this.ui.$removeElement(this.hr),this.currentEdge.target.dummy||([this.targetDimensions,this.hr]=r(1,this.hr))}}my(){this.current&&(this.lr&&(this.lr.parentNode.removeChild(this.lr),delete this.lr.ys),this.hr&&(this.hr.parentNode.removeChild(this.hr),delete this.hr.ys)),this.lr=null,this.hr=null,this.sourceDimensions=null,this.targetDimensions=null}gy(){this.current&&Ii(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.gy(),this.$clearHandles(),this.ui.$revalidateElementById(this.current.sourceId),this.ui.$revalidateElementById(this.current.targetId)}isActive(){return this.dr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;Ce(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.Uu=this.ui.model.getEdgeType(r.data),this.ey=this.ui.view.getEdgeDefinition(this.Uu),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=qs(t.anchorPositions),this.targetAnchorPositionFinder=qs(t.anchorPositions);else{let n=this.ju(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=qs(n));let o=this.ju(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=qs(o))}this.$activate(e,t),t.overlays&&this.uy(e,t.overlays),t.deleteButton===!0&&this.py(t),this.Mi(),Wr(this.current,Of),this.dr=!0}}deactivate(r){this.current!=null&&(this.Hu(),Or(this.current,Of),this.my()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.dr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.fs=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=cv(this.ui,r,e,t,o,{[Ze]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=dv(this.ui,r,e,t,n,o,s,a,{[Ze]: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=$(Je,{x:`${t/2}`,y:`${n/2}`,[Ze]: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.fs=!0),t},drag:e=>r.drag(e),stop:e=>{this.fs=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.ny[r.selector]=r}ly(r){this.Mi(),this.$elementDragging(r)}hy(r){this.$elementDragged(r)}iy(r){return this.currentEdge==null?!1:r.id===Ym(this.currentEdge.source)||r.id===Ym(this.currentEdge.target)}};var Lr=new Map;function _V(i,r,e){let t=Lr.get(i);return new t(r,e)}function RV(i){return i.type===_n&&i.constrain===tn?Hs:i.type}var ma=class{constructor(r,e){this.ui=r;this.xs=e;c(this,"$l",new Map);c(this,"Wu");c(this,"Ye",!1);c(this,"On");c(this,"ot");r.bind(Pi,()=>(this.destroy(),!0)),this.xs=this.xs||{},this.Wu=this.xs.hoverMode===!0,this.ui.model.bind(mt,t=>{this.On&&this.On.id===t.edge.id&&this.stopEditing()}),this.Wu&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.On&&this.On.id===t.id&&(this.Ye=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Ye=!1}),ii()&&(this.ui.bind(Ed,t=>{t.obj.transient||(!this.ot||!this.ot.isBusy()&&this.ot.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(gd,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Ye){let t=this.Zu(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=RV(t.connector);if(Lr.has(o)){if(this.ot=this.$l.get(o),this.ot==null){let s=Object.assign({},this.xs||{});this.ot=_V(o,this.ui,s),this.$l.set(o,this.ot)}this.On=n,this.ot.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.ot&&this.ot.deactivate(),this.On=null,this.ot=null}clearEdits(r){let e=this.Zu(r);return e!=null?(Ii(e),!0):!1}Zu(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):Bo(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.$l.clear()}};function gv(){}function mp(i){let r=document.createElement("div");return L(r,i.join(" ")),document.body.appendChild(r),r}var ga=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"bs");c(this,"el");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});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,"ht");c(this,"eventManager");c(this,"Bl");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",ue);c(this,"upEvent",oe);c(this,"moveEvent",ie);c(this,"enabled",!1);c(this,"Ju");this.surface=r.surface,this.onStart=r.onStart||gv,this.onEnd=r.onEnd||gv,this.onSelect=r.onSelect||gv,this.onClick=r.onClick||null,this.bs=r.generateLassoContent,this.Bl=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.Xr.bind(this),this.upListener=this.mr.bind(this),this.moveListener=this.jr.bind(this),this.eventManager=new fe,this.Ey(r.filter),this.invert?this.fy():this.el=mp([vT,r.cssClass||""]),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(xo,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)})}Ey(r){r==null?this.ht=function(){return!1}:z(r)?this.ht=e=>{let t=e.srcElement||e.target;return Mt(t,r)}:this.ht=r}Ku(r,e){if(this.visibleOrigin=r,this.size=e,!this.invert)Jt(this.el,r),Rr(this.el,e.width,e.height);else{let t=window.innerWidth,n=window.innerHeight,o=window.pageXOffset,s=window.pageYOffset,a=n-r.y+s,l=n-a+e.height,h=t-r.x+o,d=t-h+e.width;this.masks.top.style.bottom=a+"px",this.masks.bottom.style.top=l+"px",this.masks.left.style.right=h+"px",this.masks.right.style.left=d+"px",this.masks.top.style.left=t-h+"px",this.masks.top.style.right=t-d+"px",this.masks.bottom.style.left=t-h+"px",this.masks.bottom.style.right=t-d+"px"}}Nt(r){let e=r?Pr:ht;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,ct):this.surface.removeClass(document.body,ct)}qu(r){return this.Bl==null?r:this.Bl(r)}Xr(r){if(this.enabled&&!this.ht(r)){if(ae(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.hasMoved=!1,this.origin=this.qu(me(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),!this.invert&&this.bs){let e=this.bs(this.origin,r);e!=null?(this.Ju=e,this.el.replaceChildren(e)):this.el.innerHTML=""}this.Ku(this.origin,{width:1,height:1}),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r)}}jr(r){if(this.down){this.moving||(this.Nt(!0),this.moving=!0),ae(r);let e=this.qu(me(r)),t=this.surface.fromPageLocation(e.x,e.y),n={width:Math.abs(e.x-this.origin.x),height:Math.abs(e.y-this.origin.y)},o={x:Math.min(this.origin.x,e.x),y:Math.min(this.origin.y,e.y)},s={width:Math.abs(t.x-this.canvasOrigin.x),height:Math.abs(t.y-this.canvasOrigin.y)},a={x:Math.min(this.canvasOrigin.x,t.x),y:Math.min(this.canvasOrigin.y,t.y)};s.width>0&&s.height>0&&(this.hasMoved=!0,this.Ku(o,n),this.onSelect(o,n,a,s,[this.origin.x<e.x,this.origin.y<e.y],r.shiftKey,this.Ju))}}mr(r){if(this.down){let e=this.moving;this.down=!1,this.moving=!1,ae(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.Nt(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.bs&&(this.el.innerHTML="")}}fy(){this.masks.top=mp([nh,PT]),this.masks.bottom=mp([nh,_T]),this.masks.left=mp([nh,CT]),this.masks.right=mp([nh,OT])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Oe=class{$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){}};var Ev="logarithmic",fv="absolute";var CL={},Ki={get:i=>{let r=CL[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{CL[i]=r}};var Lf=class Lf{constructor(r){c(this,"type",Lf.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.Pn(r.options)}Pn(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}Nt(r){}};c(Lf,"type","simple");var gp=Lf;Ki.register(gp.type,gp);var PL="vjs-background-tile",yv=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,"Mt",[]);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.Mt[s]=this.Mt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.yy=!0,l.className=PL,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.Mt[s][a]=[l,new Image,!1]}}}by(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}Ay(r,e,t){return this.urlGenerator==null?this.by(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}Sy(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.Ay(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.Mt[o]!=null&&this.Mt[o][s]!=null&&(this.Mt[o][s][2]||(this.Sy(this.Mt[o][s][0],this.Mt[o][s][1],o,s),this.Mt[o][s][2]=!0))}},wf=class wf{constructor(r){c(this,"type",wf.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"zoomWidget");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,"Qu");c(this,"ep");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||Ev,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.Qu=this.debounce(this.rp,this.zoomDebounceTimeout),this.ep=this.debounce(this.np,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new yv(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Ty(){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}vy(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}np(){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)}}rp(){this.vy(this.Ty()),this.np()}setZoom(r,e){this.widgetZoom=r,e?this.rp():this.Qu()}pan(){this.ep()}owns(r){return r===this.canvas||r.yy===!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===fv?this.Cy(r):this.Oy(r)}Cy(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}}Oy(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}}Nt(r){}};c(wf,"type","tiled");var Ep=wf;Ki.register(Ep.type,Ep);var OL=(e=>(e.dotted="dotted",e.lines="lines",e))(OL||{}),LV="dotted",wV="lines",_L={width:50,height:50},RL=2,xv="#ddd",vh="#ddd",DV=2,NV=1,LL="vjs-background",wL="vjs-background-border",qo="vjs-background-grid",DL="vjs-background-grid-minor",NL="vjs-background-grid-major",fp="vjs-background-grid-dotted-major",IL="vjs-background-grid-dotted-minor",Df=class Df{constructor(r){c(this,"Ye",!1);c(this,"type",Df.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,"As");c(this,"Gi");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.As=`p${V().substring(0,8)}`,this.Gi=`p${V().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=$(ve),this.backgroundContainer.style.position=je,L(this.backgroundContainer,LL),this.Nt(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Lt,e=>{this.gr()}),this.ui.bind(nr,e=>{this.gr()}),this.ui.bind(ud,()=>{this.Ye=!0}),this.ui.bind(Sn,()=>{this.Ye=!1,this.gr()}),this.ui.bind(Br,e=>{this.gr()}),this.ui.bind($r,e=>{this.gr()}),this.ui.model.bind(Le,e=>{this.gr()}),this.ui.model.bind(Me,e=>{this.gr()}),this.grid=r.options.grid||this.ui.getGrid()||_L,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||RL,this.dotRadius=r.options.dotRadius||DV,this.tickDotRadius=r.options.tickDotRadius||NV,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.gr()}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}gr(){this.Ye||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 o=-this.minWidth/2;o<r&&(t+=r-o,r=o);let s=this.minWidth/2;s>r+t&&(t+=s-(r+t))}if(this.minHeight!=null){let o=-this.minHeight/2;o<e&&(n+=e-o,e=o);let s=this.minHeight/2;s>e+n&&(n+=s-(e+n))}if(this.maxWidth!=null){let o=-this.maxWidth/2;o>r&&(t-=o-r,r=o);let s=this.maxWidth/2;s<r+t&&(t-=r+t-s)}if(this.maxHeight!=null){let o=-this.maxHeight/2;o>e&&(n-=o-e,e=o);let s=this.maxHeight/2;s<e+n&&(n-=e+n-s)}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),Ce(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=""})}Py(r,e){return`<pattern id="${this.Gi}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
|
|
44
|
+
<path d="M ${r} 0 L 0 0 0 ${e}" class="${qo} ${DL}" fill="none" stroke="${xv}" stroke-width="1"/>
|
|
45
|
+
</pattern>`}_y(){return`<pattern id="${this.As}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Gi})"/>`:"")+`<path d="M ${this.grid.width} 0 L 0 0 0 ${this.grid.height}" class="${qo} ${NL}" fill="none" stroke="${vh}" stroke-width="1.5"/></pattern>`}Ry(r,e){let t=`<pattern id="${this.Gi}" 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="${qo} ${IL}" fill="${xv}" stroke="none"/>`}}return t+"</pattern>`"}Ly(){return`<pattern id="${this.As}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Gi})"/>`:"")+`<circle cx="0" cy="0" r="${this.dotRadius}" class="${qo} ${fp}" fill="${vh}" stroke="none"/>
|
|
46
|
+
<circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${qo} ${fp}" fill="${vh}" stroke="none"/>
|
|
47
|
+
<circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${qo} ${fp}" fill="${vh}" stroke="none"/>
|
|
48
|
+
<circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${qo} ${fp}" fill="${vh}" stroke="none"/></pattern>`}wy(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.Py(r,e):this.Ry(r,e),n=()=>this.gridType==="lines"?this._y():this.Ly();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.wy(),e=this.showBorder?`<rect class="${wL}" x="0" y="0" width="100%" height="100%" fill="${ht}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.As})" stroke="${ht}"/>`;return r+e+t}Nt(r){this.backgroundContainer.style.display=r?Pr:ht}};c(Df,"type","grid");var Ea=Df;Ki.register(Ea.type,Ea);var Qo=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Ss",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=Ki.get(n);return this.Ss=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.Ss}),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.Ss)}setVisible(e){this.Ss=e,this.background.Nt(e)}};c(Qo,"type","background"),or.register(Qo.type,Qo);var Ch="c-state",yp=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===Er?`${Ch}-${r}`:`${Ch}-${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?`${Ch}-${this.id}-${a}`:null;l&&we.addType(s,l,o.data),this.state[Er]&&we.addType(s,`${Ch}-${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[Er]&&L(l,this.state[Er].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Ch}-${this.id}-${a}`:null;l&&we.removeType(s,l,o.data),this.state[Er]&&we.removeType(s,`${Ch}-${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[Er].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[Er]&&F(l,this.state[Er].cssClass)})}};var Nf=class{constructor(r){this.ui=r;c(this,"ip",{});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.ip[e]=new yp(e,this.viewOptions.states[e],r)}getState(r){return this.ip[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.op(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.op(e),t.deactivate(e,this.ui,this.ui.dataSource),_t(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}op(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}},Ph=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new Nf(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Ph,"type","ui-states"),or.register(Ph.type,Ph);var bv="direct",IV="orthogonal",Oh=class extends Oe{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,"sp");c(this,"ne");c(this,"At")}destroy(){}Dy(){let e=this.ui.getLayout();if(e.type!==go.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.sp.forEach(n=>{let o=this.mode===bv?hA(n):lA(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!==_n){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),m=this.ne[p.source.id],g=this.ne[p.target.id],E=this.At[p.source.id],y=this.At[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}),Ne.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-m.x)/E.width,y:(u[0].y-m.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-g.x)/y.width,y:(u[u.length-1].y-g.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||bv,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||wd,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.sp=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.ne=Object.assign({},n.positions),this.At=Object.assign({},n.sizes),this.Dy()}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(Tn,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(Tn,this.layoutListener)}};c(Oh,"type","edgeRouting"),or.register(Oh.type,Oh);var ML="vjs-selected-edge-highlight",If=class If extends Oe{constructor(){super(...arguments);c(this,"id",If.type);c(this,"Er",new Map);c(this,"ap",ML);c(this,"$i");c(this,"S");c(this,"lp",e=>{Ke(e.obj)&&(this.Ny(e.obj),this.Iy())});c(this,"hp",e=>{Ke(e.obj)&&(this.Fl(e.obj.getId()),this.cp())});c(this,"dp",e=>{this.reset()});c(this,"Ts",e=>{e.edge&&this.Bi(e.edge)});c(this,"pp",e=>{e.edge&&this.Bi(e.edge)});c(this,"mp",e=>{e.dragGroup.forEach(t=>this.gp(t.vertex))})}initialise(e,t){return this.S=e,this.ap=t&&t.className||ML,this.$i=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(ur,this.lp),!0}destroy(){this.reset(),this.S.model.unbind(ur,this.lp)}reset(){this.Er.forEach(e=>{this.S.$removeElement(e)}),this.Er.clear(),this.cp()}Iy(){this.S.model.bind(pr,this.hp),this.S.model.bind(Cr,this.dp),this.S.model.bind(Zn,this.Ts),this.S.model.bind(Jn,this.pp),this.S.bind(nr,this.mp),this.S.bind(Zn,this.Ts)}cp(){this.S.model.unbind(pr,this.hp),this.S.model.unbind(Cr,this.dp),this.S.model.unbind(Zn,this.Ts),this.S.model.unbind(Jn,this.pp),this.S.unbind(nr,this.mp),this.S.unbind(Zn,this.Ts)}$edgeRemoved(e){this.Fl(e.getId())}$edgeUpdated(e){this.Bi(e)}$vertexUpdated(e,t){this.gp(e.modelObject)}gp(e){this.Er.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Bi(o)})}Ny(e){var s;let t=e.getId();if(this.Er.has(t)){this.Bi(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=$(Z,{fill:this.$i.fill||"none",stroke:this.$i.stroke||"var(--vjs-color-edit)","stroke-width":this.$i.strokeWidth||2,"stroke-dasharray":this.$i.dashArray,"pointer-events":"none",rx:2},{},this.ap);this.Ep(o,n),this.S.$appendElementToToolsLayer(o),this.Er.set(t,o)}Bi(e){var s;let t=e.getId(),n=this.Er.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.Fl(t);return}this.Ep(n,o)}Fl(e){let t=this.Er.get(e);t&&(this.S.$removeElement(t),this.Er.delete(e))}Ep(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;ce(e,{x:s,y:a,width:o.width,height:o.height})}};c(If,"type","selected-edge-highlight");var fa=If;or.register(fa.type,fa);var $n=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",ai);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[])}destroy(){}initialise(e,t){return e.bind(vn,n=>{this.lasso.enabled=n===ai}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new ga({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,onStart:(n,o,s,a)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,this.onStart&&this.onStart()},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]}),m=p.length,g={};for(u=0;u<m;u++)p[u].v.group==null&&(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),g[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,m=d.length,t.includeEdges){let E={};for(u=0;u<m;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===pe.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===pe.objectType?y[f].target.getParent().id:y[f].target.id;g[b]&&g[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d)},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==Ko&&e.setMode(xr),e.fireUnchecked(Rb),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c($n,"type","lasso"),$n=Nt([wt("lasso")],$n);var VL="vjs-surface-elastic-group-resize",Mf="elasticGroupFrame:resize",Vf="elasticGroupFrame:remove",ya=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,"My");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),Ot(this.uiGroupContentArea)?this.frame=$(Z):(this.frame=$(ve),this.frame.appendChild($(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,VL),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=Mm(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=Mm(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.Vy(),this.My=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Vy(){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.Gy(e,t)}Gy(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=Su(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),Ce(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(Mf,{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(Vf,{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}Ul(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.Ul(r,e),{movedElements:r,resizedGroups:e}}};var GL="resize";function Gf(i,r,e){let t={width:i.width,height:i.height,position:i.position||je},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=ta(i.ns,i.type||He,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var $f="vjs-node-id",Av="vjs-miniview-type",$L="miniview",Bn=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"uiBounds");c(this,"suspended");c(this,"zl");c(this,"typeFunction");c(this,"fr");c(this,"vs");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,"clickToCenter");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"Yl");c(this,"uiBindings",[]);c(this,"Xl");c(this,"viewport");c(this,"Dt");c(this,"Xr");c(this,"jr");c(this,"mr");c(this,"jl")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,ue,this.Xr),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.eventManager.off(window,GL,this.jl),F(this.containerElement,Uu),F(this.containerElement,Yu),this.zl&&(this.eventManager.off(this.fr,Ue,this.Xl),this.fr.parentNode.removeChild(this.fr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Mr,this.Yl),this.Dt&&Zl(this.containerElement,this.Dt),this.panzoom=null}$y(e){}By(e){}Ee(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.clickToCenter=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.Xr=this.downListener.bind(this),this.jr=this.moveListener.bind(this),this.mr=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Gf({position:je,width:Rn,height:Rn,left:0,top:0,clazz:LT},this.containerElement),this.canvasElement=Gf({position:KA,width:Rn,height:Rn,left:0,top:0,clazz:RT},this.containerElement),this.suspended=t.suspended===!0,this.zl=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.fr=null,this.vs=!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 fe,L(this.containerElement,Uu),this.Xl=this.toggleCollapsed.bind(this),this.zl&&(this.fr=Gf({type:"div"}),this.fr.className=NT,this.containerElement.appendChild(this.fr),this.ui.on(this.fr,Ue,this.Xl)),this.viewport=this.ui.viewport,this.panzoom=new da({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,getOffset:o=>o.viewportEntry||this.ui.$getElementPositionInUIRelativeToCanvasOrigin(o),getOffsetRelativeToRoot:o=>this.ui.$getOffsetRelativeToRoot(o),getSize:o=>o.viewportEntry||o.vertex?this.$__getSize(o.vertex.id):this.ui.$getSize(o),elementPositionSetter:(o,s)=>Ce(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.F(o),events:{pan:()=>{this.fp()},mousedown:()=>{L(this.pannerElement,uf)},mouseup:()=>{F(this.pannerElement,uf)}},zoomRange:[-1/0,1/0]}),this.jl=ra(()=>{this.Ge()},100),this.eventManager.on(window,GL,this.jl),this.enableWheelZoom!==!1&&(this.Dt=this.wheelZoom.bind(this),Wl(this.containerElement,this.Dt)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,Uu),this.eventManager.on(this.pannerElement,ue,this.Xr),this.Yl=()=>{this.Ge(),this.st(!0),setTimeout(()=>{this.Ge(),this.st(!0)},0)},this.Ee(Sn,this.Yl),this.setVisible(this.visible),this.Ee(gl,this.Ge),this.Ee(fo,this.Ge),this.Ee(Lt,this.Cs),this.Ee(nr,o=>{this.activeTracking&&this.Cs(o)}),this.Ee(Br,this.kl),this.Ee(pl,this.Fy),this.Ee(Tn,this.Uy),this.Ee($r,this.yp),this.Ee(Gr,this.Cs),this.Ee(Wc,o=>{this.activeTracking&&this.Cs(o)});let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&Jt(l,a)}this.st(!0)};return this.Ee(Tn,n),this.Ee(Is,n),this.Ee(lb,this._n),this.Ee(pd,this.zy),this.Ee(Mf,this.$y),this.Ee(Vf,this.By),this.Yy(),this.clickToCenter&&(L(this.containerElement,IT),this.eventManager.on(this.canvasElement,W,be($f),o=>{let s=o.target.getAttribute($f);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.Xy(),this.panzoom.setZoom(1),this.panzoom.reset(),this.Ge()}xp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=rr(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}}Yy(){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.yp({el:s,id:n[o].id,vertex:n[o],pos:this.xp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.kl({el:s,id:t[o].id,vertex:t[o],pos:this.xp(t[o])})}(n.length>0||t.length>0)&&this.st(!0)}yp(e){this.kl(e,DT)}$groupCollapsed(e){this.bp(e.modelObject,!1),this._n({id:e.id})}$groupExpanded(e){this.bp(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&&Rr(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.Os(e),this.st(!0))}downListener(e){this.panning=!0,this.downAt=me(e),this.pannerAtMouseDown=hn(this.pannerElement),this.eventManager.on(document,oe,this.mr),this.eventManager.on(document,ie,this.jr),ae(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.fp(s),Jt(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,oe,this.mr),this.eventManager.off(document,ie,this.jr)}wheelZoom(e){ae(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.gs(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.vs=!this.vs,this.vs?L(this.containerElement,Yu):F(this.containerElement,Yu),this.st(!0)}st(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.Ge,doNotFirePanEvent:e})}Cs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.Os(t.element)}),this.st(!0)}Fy(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);Jt(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Rr(s,a.width,a.height)}});let n=rr(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)}Jt(t,n),Rr(t,e.element.width,e.element.height),this.Ge()}Uy(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&Jt(o,n)}this.st(!0)}jy(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)}}kl(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=Gf({position:je,width:a.width+jr,height:a.height+jr,left:s.x,top:s.y,clazz:wT+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(Av,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute($f,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.jy(e.vertex,l),this.ui.$_dataLoading||(this.st(!0),this.Ge())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Pr:ht}getPan(){return this.panzoom.getPan()}bp(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+jr,t.style.height=n.height+jr,this.Ge(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(Av,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.Ge()}Ap(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.st(!0)),t||this.Ge()}$nodeRemoved(e){this.Ap(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.Ap(e,!1)}$groupResized(e){this._n({id:e.element.id,size:e.newGroupSize}),this.st(!0)}Os(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);Jt(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.Os(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.Os(e))}}Xy(){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.Ge()}zy(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}Ge(){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+jr,this.pannerElement.style.height=this.uiBounds.vh+jr,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},Jt(this.pannerElement,this.pannerPos)}}fp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||hn(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(Bn,"type",$L),Bn=Nt([wt($L)],Bn);var Sv="vjs-pan-mode",Tv="vjs-zoom-to-fit",vv="vjs-zoom-in",Cv="vjs-zoom-out",Bf="vjs-select-mode",Pv="vjs-undo",Ov="vjs-redo",_v="vjs-clear-dataset",MV="vjs-selected-mode",xp="vjs-controls",Rv="vjs-export-controls",Lv="vjs-controls-reset-selection",VV="vjs-copy-paste-controls";var wv=class{constructor(r){c(this,"ui");this.ui=r.ui}};var GV="Clear dataset?",Dv="vjs-selected-mode",BL="vjs-controls-has-selection",FL="can-undo",UL="can-redo",YL="data-undo",zL="data-redo",xa="data-mode",XL="data-reset",jL="data-clear",HL="data-zoom-in",kL="data-zoom-out",Nv="data-reset-selection",WL="data-vjs-orientation",ZL="0 0 32 30",JL="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",KL="0 0 24 24",qL="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",QL="0 0 24 24",e0="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",t0="0 0 24 24",r0="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",n0="0 0 24 24",i0="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",o0="0 0 24 24",s0="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",Iv="0 0 32 32",a0="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",l0="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 $V(){return`<i class="${Sv}" ${Dv} ${xa}="${xr}" title="Pan Mode">
|
|
49
49
|
<svg:svg viewBox="${t0}" stroke="currentColor" fill="none"><svg:path d="${r0}"/></svg:svg>
|
|
50
50
|
</i>`}function BV(){return`<i class="${Tv}" ${XL} title="Zoom To Fit">
|
|
51
51
|
<svg:svg viewBox="${ZL}" stroke="currentColor" fill="currentColor"><svg:path d="${JL}"/></svg:svg>
|
|
@@ -61,21 +61,21 @@ var uc=Object.defineProperty,uD=Object.defineProperties,gO=Object.getOwnProperty
|
|
|
61
61
|
<svg:svg viewBox="${n0}" stroke="currentColor" fill="currentColor"><svg:path d="${i0}"/></svg:svg>
|
|
62
62
|
</i>`}function zV(i){return`<i class="${_v}" ${jL} title="${i}">
|
|
63
63
|
<svg:svg viewBox="${o0}" stroke="currentColor" fill="currentColor"><svg:path d="${s0}"/></svg:svg>
|
|
64
|
-
</i>`}function XV(){return`<i class="${
|
|
64
|
+
</i>`}function XV(){return`<i class="${Bf}" ${xa}="${ai}" title="Select Mode">
|
|
65
65
|
<svg:svg fill="currentColor" viewBox="${KL}" stroke="currentColor"><svg:path d="${qL}"/></svg:svg>
|
|
66
|
-
</i>`}function jV(){return`<i class="${
|
|
66
|
+
</i>`}function jV(){return`<i class="${Bf}" ${xa}="${Vn}" title="Vertex Drawing Mode">
|
|
67
67
|
<svg:svg fill="currentColor" viewBox="${QL}" stroke="currentColor"><svg:path d="${e0}"/></svg:svg>
|
|
68
|
-
</i>`}var HV=(i,r,e)=>{let t=`<div ${WL}="${r.orientation}" class="${
|
|
68
|
+
</i>`}var HV=(i,r,e)=>{let t=`<div ${WL}="${r.orientation}" class="${xp}" ${FL}="false" ${UL}="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?$V():"",a=(r.hasLasso?XV():"")+(r.hasVertexDrawing?jV():""),l=(r.showZoomToExtentsButton?BV():"")+(r.showZoomButtons?FV()+UV():"")+(r.showUndoRedoButtons?`<i class="${Pv}" ${YL} title="Undo last action"></i><i class="${Ov}" ${zL} title="Redo last action"></i>`:"")+YV()+(r.showClearButton?zV(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},bp=class{constructor(r,e,t){this.container=r;c(this,"I");c(this,"Ze");c(this,"Hl");c(this,"S");c(this,"Wl");c(this,"de");c(this,"Sp");c(this,"Tp");c(this,"vp");c(this,"Cp");this.S=e,this.Wl=(t==null?void 0:t.clearMessage)||GV,this.Sp=(t==null?void 0:t.clear)!==!1,this.Tp=(t==null?void 0:t.undoRedo)!==!1,this.vp=(t==null?void 0:t.zoomToExtents)!==!1,this.Cp=(t==null?void 0:t.zoom)===!0,this.de=(t==null?void 0:t.orientation)||"row",this.Hl=(t==null?void 0:t.buttons)||[],this.I=yr({}),this.Zl(),this.ky()}Zl(){let r=this.S.getPlugin($n.type)!=null,e=this.S.getPlugin(li.type)!=null,t=HV(this.Wl,{orientation:this.de,showClearButton:this.Sp,showUndoRedoButtons:this.Tp,hasLasso:r,hasVertexDrawing:e,showZoomToExtentsButton:this.vp,showZoomButtons:this.Cp},this.Hl);this.Ze=this.I.template(V(),{},()=>t).childNodes[0],this.container.replaceChildren(this.Ze)}ky(){this.S.bind(md,e=>{this.Zl()}),this.S.bind(ab,e=>{this.Zl()}),this.S.model.bind(Rs,e=>{this.Ze.setAttribute(FL,e.undoCount>0?At:at),this.Ze.setAttribute(UL,e.redoCount>0?At:at)});let r=()=>{this.S.model.getSelection().isEmpty()?this.Ze.removeAttribute(BL):this.Ze.setAttribute(BL,"true")};this.S.model.bind(ur,r),this.S.model.bind(pr,r),this.S.model.bind(Cr,r),this.S.on(this.container,W,be(YL),()=>{this.S.model.undo()}),this.S.on(this.container,W,be(zL),()=>{this.S.model.redo()}),this.S.bind(vn,e=>{Array.from(this.Ze.querySelectorAll(be(xa))).forEach(t=>{this.S.removeClass(t,Dv)}),this.S.addClass(this.S.$getSelector(this.Ze,`[${xa}='${e}']`),Dv)}),this.S.on(this.container,W,be(xa),(e,t)=>{this.S.setMode(t.getAttribute(xa))}),this.S.on(this.container,W,be(XL),(e,t)=>{this.S.model.clearSelection(),this.S.zoomToFit()}),this.S.on(this.container,W,be(HL),(e,t)=>{this.S.zoomIn()}),this.S.on(this.container,W,be(kL),(e,t)=>{this.S.zoomOut()}),this.S.on(this.container,W,be(Nv),()=>{this.S.model.clearSelection(),aT(this.S)&&this.S.stopEditingPath()}),this.S.on(this.container,W,be(jL),(e,t)=>{(this.S.model.getNodeCount()+this.S.model.getGroupCount()===0||confirm(this.Wl))&&this.S.model.clear()}),this.Hl.forEach(e=>{this.S.on(this.container,W,X(e.class),(t,n)=>{e.handler&&e.handler(t,e.id)})})}};var Ap="vjs-export-underlay",Sp="vjs-export-overlay",Tp="vjs-export-cancel",Mv="vjs-export-dimensions",Vv="vjs-export-download-tools",vp="visuallyjs-export",Cp="Download",ba={png:"image/png",svg:"image/svg+xml",jpeg:"image/jpeg"},Ff="svg",_h="png",es="jpg";function kV(i){if(i!=null){if(z(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 Aa(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",Wt),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){bs(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(JE);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(Mu);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(Vu);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(Ze);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},m=o.querySelector(".vjs-background");if(m!=null)if(t===!1)m.parentNode.removeChild(m);else{let f=i.getGrid();if(f!=null){let b=se(p,f);p.x=b.x,p.y=b.y;let A=se({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}m.setAttribute(Q,`${p.x}`),m.setAttribute(Ee,`${p.y}`),m.setAttribute(Te,`${p.width}`),m.setAttribute(De,`${p.height}`),m.removeAttribute("transform"),m.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let g=o.querySelector(".vjs-vertex-layer");o.removeChild(g);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([X(ji),X(Hi)].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(Te,`${r.width}`),r.height&&o.setAttribute(De,`${r.height}`),r.style!=null){let f=$("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=kV(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function WV(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 h0(i){let r=new TextEncoder().encode(i);return WV(r)}function c0(i){return h0(i.outerHTML)}function Gv(i){let r=c0(i);return d0(r)}function d0(i){return`data:image/svg+xml;base64,${i}`}function _p(i,r,e){let t=Aa(i,r);Yf(t,r,e)}function Yf(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(Te,`${l}`),i.element.setAttribute(De,`${h}`),d.src=Gv(i.element)}var Rp=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=Tp,this.underlay.addEventListener(Ue,e=>{e.target===this.underlay&&this.Fi()}),this.overlay=document.createElement("div"),this.overlay.className=vp,this.closeButton=document.createElement("div"),this.closeButton.className=Cp,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ue,()=>{this.Fi()})}Fi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=Aa(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:ba.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||Pp,o.innerHTML=r.downloadButtonLabel||Op,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var Rh=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(He),this.underlay.className=Tp,this.underlay.addEventListener(Ue,e=>{e.target===this.underlay&&this.Fi()}),this.overlay=document.createElement(He),this.overlay.className=vp,this.closeButton=document.createElement(He),this.closeButton.className=Cp,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ue,()=>{this.Fi()})}Fi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Hy(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.Op(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=Vv,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||Pp,o.innerHTML=r.downloadButtonLabel||Op,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=Mv,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(Te,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(Te),10);this.Op(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.Hy(r)}Op(r,e,t){t&&(r.width=t,delete r.height),_p(this.ui,r,e)}};var ZV=(i,r,e,t,n)=>{let o=`<div class="${Ap} ${Rv}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${Uf}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${_h}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${ts}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},Sa=class{constructor(r,e,t){this.ui=e;c(this,"I");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=ZV(n,o,s,a,l);this.I=yr({templates:{component:h}}),this.Ze=this.I.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,m,g,E,y,x;switch(u){case Uf:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),m=new Rp(this.ui),m.export(p);break;case _h:g=t.imageOptions||{},t.margins!=null&&g.margins==null&&Object.assign(g,t.margins),y=new Rh(this.ui),y.export(g);break;case ts:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new Rh(this.ui),x.export(E);break}})}};var Lh="recentColors";var Ae={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",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:Se,BOTTOM:st,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 cn=Ae.Attributes,u0=Ae.Events,_e=Ae.Elements,JV={[_e.TEXT]:i=>i.value,[_e.NUMBER]:i=>i.value,[_e.RADIO]:i=>{if(i.checked)return i.value},[_e.CHECKBOX]:i=>{if(i.checked)return!0},[_e.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(cn.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},[_e.TEXTAREA]:i=>i.value,[_e.COLOR]:i=>i.value,[_e.HIDDEN]:i=>i.value};function KV(i){let r=i.querySelectorAll(be(cn.VJS)),e;for(let t=0;t<r.length;t++)if(e=r[t],e.checkValidity!=null&&!e.checkValidity())return!1;return!0}function qV(i,r){let e=i.querySelectorAll(be(cn.VJS)),t={};for(let n=0;n<e.length;n++){let o=p0(e[n],r);if(o!=null){let s=e[n].getAttribute(cn.VJS),a=Pe(t,s);a!=null?(Array.isArray(a)||(a=[a],Pe(t,s,a)),a.push(o)):Pe(t,s,o)}}return t}var QV={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function Lp(i,r){if(r==null)return i;try{return QV[r](i)}catch(e){return i}}function p0(i,r){let e=i.tagName.toUpperCase(),t=e===_e.INPUT?(i.getAttribute(cn.TYPE)||_e.TEXT).toUpperCase():e,n=JV[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(cn.DATATYPE);s!=null&&(o=Lp(o,s))}}else r!=null&&(o=r(i));return o}function $v(i,r,e,t){let n=r.querySelectorAll(be(cn.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=s===_e.INPUT?(n[o].getAttribute(cn.TYPE)||_e.TEXT).toUpperCase():s,l=n[o].getAttribute(cn.VJS),h=Pe(i,l),d=tG[a];if(d!=null)d(n[o],h);else{t!=null&&t(n[o],h);continue}e!=null&&n[o].getAttribute(cn.VJS_COMMIT)&&(s===_e.INPUT?n[o].addEventListener(u0.KEYUP,u=>{(u.keyCode===10||u.keyCode===13)&&e(n[o])}):s===_e.TEXTAREA&&n[o].addEventListener(u0.KEYUP,u=>{u.ctrlKey&&(u.keyCode===10||u.keyCode===13)&&e(n[o])}))}}function eG(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===_e.INPUT?(i[e].getAttribute(cn.TYPE)||_e.TEXT).toUpperCase():t,o=rG[n];o&&o(i[e])}}var tG={[_e.TEXT]:(i,r)=>{i.value=r||""},[_e.NUMBER]:(i,r)=>{i.value=r||""},[_e.RADIO]:(i,r)=>{i.checked=i.value==r},[_e.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[_e.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(cn.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}}},[_e.TEXTAREA]:(i,r)=>{i.value=r||""},[_e.COLOR]:(i,r)=>{i.value=r||""},[_e.HIDDEN]:(i,r)=>{i.value=r||""}},rG={[_e.TEXT]:i=>{i.value=""},[_e.RADIO]:i=>{i.checked=!1},[_e.CHECKBOX]:i=>{i.checked=!1},[_e.SELECT]:i=>{i.selectedIndex=-1},[_e.TEXTAREA]:i=>{i.value=""},[_e.COLOR]:i=>{i.value=""},[_e.HIDDEN]:i=>{i.value=""}};var m0="input",g0="blur",E0="keypress",Bv="vjs-inspector-active",wp="vjs-inspector-inactive",f0="vjs-inspector",Fv="vjs-inspector-close",Dp="change",Np=class extends Qd{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"Pp");c(this,"_p",[]);c(this,"yr",{});c(this,"Jl");c(this,"Kl");c(this,"Rp");c(this,"Vi");c(this,"ql");c(this,"xr",!1);c(this,"mt",new Map);c(this,"current",[]);c(this,"gt",{});c(this,"ht");c(this,"$getDefaultValue");c(this,"Ql");c(this,"$eventManager");c(this,"Dp",()=>{this.$_recomputeCommonData(),$v(this.gt,this.container);let e=this.container.querySelectorAll(be(Ae.Attributes.FOCUS))[0];e!=null&&e.focus(),this.Ql&&this.wp(),this.fire(Dp,this.gt)});this.$eventManager=new fe,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new fe,this.Pp=e.multipleSelections!==!1,this.ql=e.afterUpdate,this.Rp=e.renderEmptyContainer,this.Vi=e.refresh,this.Jl=e.autoCommit!==!1,this.Kl=e.doNotWriteBlankNewValues!==!1,this.ht=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.Ql=e.showCloseButton===!0,this.ensureContext(Lh,()=>[]),this.container.classList.add(f0),this.container.classList.add(wp),this.Wy(),this.$ui.registerDataHook({load:t=>{let n=Pe(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Lh,n.recentColors.slice())},save:t=>{Pe(t,"inspectorContext",this.$context)}})}Wy(){this.model.bind(ur,h=>{this.isSuspendEvents()||this.ec(h.obj)}),this.model.bind(pr,h=>{this.tt(h.obj)}),this.model.bind(Le,h=>{this.tt(h.node)}),this.model.bind(Me,h=>{this.tt(h.group)}),this.model.bind(Vr,h=>{this.tt(h.port)}),this.model.bind(mt,h=>{this.tt(h.edge)}),this.model.bind(Cr,()=>{this.Jl&&Array.from(this.mt.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Ls,h=>{this.isSuspendEvents()||(this.xr=!0,this.ec(),this.xr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Ve,e),this.model.bind(Re,e),this.model.bind(cr,t),this.model.bind(pt,n);let o=h=>{this.xr||setTimeout(()=>{let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let p=this.mt.get(u);if(p!=null&&(!p.common||p.edited)){let m=d.value;this.setValue(u,m),p.edited=!1,delete p.editedValue}}},0)};this.container.addEventListener(g0,o,!0);let s=h=>{if(!this.xr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(Ae.Attributes.VJS);if(p!=null)if(u===Ae.Elements.CHECKBOX){let m=this.gt[p],g=this.container.querySelectorAll(`input[type='checkbox'][${Ae.Attributes.VJS}='${p}']`);if(Array.isArray(m)||m==null&&g.length>1){let y=[];g.forEach(x=>{x.checked&&y.push(x.value)}),this.setValue(p,y)}else this.setValue(p,d.checked===!0)}else if(u===Ae.Elements.RADIO)d.checked&&this.setValue(p,Lp(d.value,d.getAttribute(Ae.Attributes.DATATYPE)));else if(u===Ae.Elements.COLOR||u===Ae.Elements.NUMBER||u===Ae.Elements.RANGE)this.setValue(p,d.value);else if(u===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA){let m=this.mt.get(p);m.edited=!0,m.editedValue=d.value}else d.tagName.toUpperCase()===Ae.Elements.SELECT&&this.setValue(p,Lp(d.value,d.getAttribute(Ae.Attributes.DATATYPE)))}};this.container.addEventListener(Dp,s,!0);let a=h=>{if(!this.xr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.mt.get(u);p.edited=!0,p.editedValue=d.value}}};this.container.addEventListener(m0,a,!0);let l=h=>{if(!this.xr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.mt.get(u);p.edited=!0,this.setValue(u,d.value)}}};this.container.addEventListener(E0,l,!0),this.$ui.bind(Oi,()=>{this.container.removeEventListener(E0,l),this.container.removeEventListener(Dp,s),this.container.removeEventListener(g0,o),this.container.removeEventListener(m0,a),this.model.unbind(Ve,e),this.model.unbind(Re,e),this.model.unbind(cr,e),this.model.unbind(pt,n),this.Zy()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.ec(e))}}$_recomputeCommonData(){this.gt={};let e={},t=new Set;this.current.forEach(n=>Object.keys(n.data).forEach(o=>t.add(o))),this.mt.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n];t.forEach(s=>{if(!e[s]){let a=o.data[s];a==null&&this.$getDefaultValue!=null&&(a=this.$getDefaultValue(o.data,s)),this.gt[s]==null?this.gt[s]=a:this.gt[s]!==a&&(e[s]=!0,this.gt[s]="")}})}for(let n in e){let o=this.mt.get(n);o!=null&&(o.common=!0,o.commonValue=this.gt[n])}}Jy(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}Lp(e){this.setSuspendEvents(!0);let t=this.Kl?new Map(Object.entries(e).filter(o=>typeof o[1]=="string"&&o[1].length===0)):null,n=0;try{this.model.openTransaction();try{this.current.forEach((o,s)=>{if(this.Kl){let a=this.Jy(e,o.data,t);Object.keys(a).length>0&&(this.model.update(o,a),n++)}else this.model.update(o,e),n++})}catch(o){U("WARN: error occurred updating item from inspector")}n>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.ql&&this.ql()}finally{this.setSuspendEvents(!1)}}Ky(e){this.Jl?this.Lp(e):Object.assign(this.yr,e)}reset(e){try{this.xr=!0,this.yr={},this.container.classList.remove(Bv),this.container.classList.add(wp),e||(this.Rp(),this.current.length=0,this.Ql&&this.wp())}finally{this.xr=!1}}Zy(){this.current.length=0,this.yr={},this.mt.clear(),this.container.innerHTML=""}tt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(K(e)||Y(e))&&(t=this.current.findIndex(n=>H(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}wp(){if(!this.container.querySelector(X(Fv))){let e=document.createElement(He);e.classList.add(Fv),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}ec(e){if(e!=null&&!this.ht(e))return;let t=!this.Pp||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(wp),this.container.classList.add(Bv),this.yr={},this.current.push(e),t?this.Vi(e,()=>this.$refresh()):this.Dp()):this.container.classList.add(wp)}$refresh(){this.mt.clear(),this.container.querySelectorAll(be(Ae.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(Ae.Attributes.VJS);this.mt.set(n,{field:t,edited:!1,common:!1,commonValue:null,attribute:n})}),this.Dp()}addValueListener(e){this._p.push(e)}setValue(e,t,n){this.Ky({[e]:t}),this._p.forEach(o=>o(e,t)),n&&this.redraw()}qy(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.gt[e]}onChange(e){this.bind(Dp,e)}persist(){let e=Object.keys(this.yr).length;return e>0&&(this.Lp(this.yr),this.yr={}),e}hasPendingChanges(){return Object.keys(this.yr).length>0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var y0="vjs-color-picker",Uv="vjs-color-picker-swatches",Yv="vjs-color-picker-swatch",x0="vjs-color",b0="vjs-max-colors";function zv(i,r=Lh){i.registerTag(x0,{template:`<div class="${y0}">
|
|
71
|
+
`}return e}}else return null}function Aa(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",Wt),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){xs(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(ZE);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(Nu);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(Iu);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(Ze);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},m=o.querySelector(".vjs-background");if(m!=null)if(t===!1)m.parentNode.removeChild(m);else{let f=i.getGrid();if(f!=null){let b=se(p,f);p.x=b.x,p.y=b.y;let A=se({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}m.setAttribute(Q,`${p.x}`),m.setAttribute(Ee,`${p.y}`),m.setAttribute(Te,`${p.width}`),m.setAttribute(De,`${p.height}`),m.removeAttribute("transform"),m.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let g=o.querySelector(".vjs-vertex-layer");o.removeChild(g);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([X(ji),X(Hi)].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(Te,`${r.width}`),r.height&&o.setAttribute(De,`${r.height}`),r.style!=null){let f=$("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=kV(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function WV(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 h0(i){let r=new TextEncoder().encode(i);return WV(r)}function c0(i){return h0(i.outerHTML)}function Gv(i){let r=c0(i);return d0(r)}function d0(i){return`data:image/svg+xml;base64,${i}`}function Pp(i,r,e){let t=Aa(i,r);Uf(t,r,e)}function Uf(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(Te,`${l}`),i.element.setAttribute(De,`${h}`),d.src=Gv(i.element)}var Op=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=Ap,this.underlay.addEventListener(Ue,e=>{e.target===this.underlay&&this.Fi()}),this.overlay=document.createElement("div"),this.overlay.className=Sp,this.closeButton=document.createElement("div"),this.closeButton.className=Tp,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ue,()=>{this.Fi()})}Fi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=Aa(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:ba.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||vp,o.innerHTML=r.downloadButtonLabel||Cp,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var Rh=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(He),this.underlay.className=Ap,this.underlay.addEventListener(Ue,e=>{e.target===this.underlay&&this.Fi()}),this.overlay=document.createElement(He),this.overlay.className=Sp,this.closeButton=document.createElement(He),this.closeButton.className=Tp,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ue,()=>{this.Fi()})}Fi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Hy(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.Op(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=Vv,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||vp,o.innerHTML=r.downloadButtonLabel||Cp,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=Mv,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(Te,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(Te),10);this.Op(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.Hy(r)}Op(r,e,t){t&&(r.width=t,delete r.height),Pp(this.ui,r,e)}};var ZV=(i,r,e,t,n)=>{let o=`<div class="${xp} ${Rv}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${Ff}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${_h}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${es}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},Sa=class{constructor(r,e,t){this.ui=e;c(this,"I");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=ZV(n,o,s,a,l);this.I=yr({templates:{component:h}}),this.Ze=this.I.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,m,g,E,y,x;switch(u){case Ff:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),m=new Op(this.ui),m.export(p);break;case _h:g=t.imageOptions||{},t.margins!=null&&g.margins==null&&Object.assign(g,t.margins),y=new Rh(this.ui),y.export(g);break;case es:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new Rh(this.ui),x.export(E);break}})}};var Lh="recentColors";var Ae={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",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:Se,BOTTOM:st,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 cn=Ae.Attributes,u0=Ae.Events,_e=Ae.Elements,JV={[_e.TEXT]:i=>i.value,[_e.NUMBER]:i=>i.value,[_e.RADIO]:i=>{if(i.checked)return i.value},[_e.CHECKBOX]:i=>{if(i.checked)return!0},[_e.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(cn.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},[_e.TEXTAREA]:i=>i.value,[_e.COLOR]:i=>i.value,[_e.HIDDEN]:i=>i.value};function KV(i){let r=i.querySelectorAll(be(cn.VJS)),e;for(let t=0;t<r.length;t++)if(e=r[t],e.checkValidity!=null&&!e.checkValidity())return!1;return!0}function qV(i,r){let e=i.querySelectorAll(be(cn.VJS)),t={};for(let n=0;n<e.length;n++){let o=p0(e[n],r);if(o!=null){let s=e[n].getAttribute(cn.VJS),a=Pe(t,s);a!=null?(Array.isArray(a)||(a=[a],Pe(t,s,a)),a.push(o)):Pe(t,s,o)}}return t}var QV={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function _p(i,r){if(r==null)return i;try{return QV[r](i)}catch(e){return i}}function p0(i,r){let e=i.tagName.toUpperCase(),t=e===_e.INPUT?(i.getAttribute(cn.TYPE)||_e.TEXT).toUpperCase():e,n=JV[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(cn.DATATYPE);s!=null&&(o=_p(o,s))}}else r!=null&&(o=r(i));return o}function $v(i,r,e,t){let n=r.querySelectorAll(be(cn.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=s===_e.INPUT?(n[o].getAttribute(cn.TYPE)||_e.TEXT).toUpperCase():s,l=n[o].getAttribute(cn.VJS),h=Pe(i,l),d=tG[a];if(d!=null)d(n[o],h);else{t!=null&&t(n[o],h);continue}e!=null&&n[o].getAttribute(cn.VJS_COMMIT)&&(s===_e.INPUT?n[o].addEventListener(u0.KEYUP,u=>{(u.keyCode===10||u.keyCode===13)&&e(n[o])}):s===_e.TEXTAREA&&n[o].addEventListener(u0.KEYUP,u=>{u.ctrlKey&&(u.keyCode===10||u.keyCode===13)&&e(n[o])}))}}function eG(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===_e.INPUT?(i[e].getAttribute(cn.TYPE)||_e.TEXT).toUpperCase():t,o=rG[n];o&&o(i[e])}}var tG={[_e.TEXT]:(i,r)=>{i.value=r||""},[_e.NUMBER]:(i,r)=>{i.value=r||""},[_e.RADIO]:(i,r)=>{i.checked=i.value==r},[_e.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[_e.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(cn.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}}},[_e.TEXTAREA]:(i,r)=>{i.value=r||""},[_e.COLOR]:(i,r)=>{i.value=r||""},[_e.HIDDEN]:(i,r)=>{i.value=r||""}},rG={[_e.TEXT]:i=>{i.value=""},[_e.RADIO]:i=>{i.checked=!1},[_e.CHECKBOX]:i=>{i.checked=!1},[_e.SELECT]:i=>{i.selectedIndex=-1},[_e.TEXTAREA]:i=>{i.value=""},[_e.COLOR]:i=>{i.value=""},[_e.HIDDEN]:i=>{i.value=""}};var m0="input",g0="blur",E0="keypress",Bv="vjs-inspector-active",Rp="vjs-inspector-inactive",f0="vjs-inspector",Fv="vjs-inspector-close",Lp="change",wp=class extends Qd{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"Pp");c(this,"_p",[]);c(this,"yr",{});c(this,"Jl");c(this,"Kl");c(this,"Rp");c(this,"Vi");c(this,"ql");c(this,"xr",!1);c(this,"mt",new Map);c(this,"current",[]);c(this,"gt",{});c(this,"ht");c(this,"$getDefaultValue");c(this,"Ql");c(this,"$eventManager");c(this,"Dp",()=>{this.$_recomputeCommonData(),$v(this.gt,this.container);let e=this.container.querySelectorAll(be(Ae.Attributes.FOCUS))[0];e!=null&&e.focus(),this.Ql&&this.wp(),this.fire(Lp,this.gt)});this.$eventManager=new fe,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new fe,this.Pp=e.multipleSelections!==!1,this.ql=e.afterUpdate,this.Rp=e.renderEmptyContainer,this.Vi=e.refresh,this.Jl=e.autoCommit!==!1,this.Kl=e.doNotWriteBlankNewValues!==!1,this.ht=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.Ql=e.showCloseButton===!0,this.ensureContext(Lh,()=>[]),this.container.classList.add(f0),this.container.classList.add(Rp),this.Wy(),this.$ui.registerDataHook({load:t=>{let n=Pe(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Lh,n.recentColors.slice())},save:t=>{Pe(t,"inspectorContext",this.$context)}})}Wy(){this.model.bind(ur,h=>{this.isSuspendEvents()||this.ec(h.obj)}),this.model.bind(pr,h=>{this.tt(h.obj)}),this.model.bind(Le,h=>{this.tt(h.node)}),this.model.bind(Me,h=>{this.tt(h.group)}),this.model.bind(Vr,h=>{this.tt(h.port)}),this.model.bind(mt,h=>{this.tt(h.edge)}),this.model.bind(Cr,()=>{this.Jl&&Array.from(this.mt.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Rs,h=>{this.isSuspendEvents()||(this.xr=!0,this.ec(),this.xr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Ve,e),this.model.bind(Re,e),this.model.bind(cr,t),this.model.bind(pt,n);let o=h=>{this.xr||setTimeout(()=>{let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let p=this.mt.get(u);if(p!=null&&(!p.common||p.edited)){let m=d.value;this.setValue(u,m),p.edited=!1,delete p.editedValue}}},0)};this.container.addEventListener(g0,o,!0);let s=h=>{if(!this.xr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(Ae.Attributes.VJS);if(p!=null)if(u===Ae.Elements.CHECKBOX){let m=this.gt[p],g=this.container.querySelectorAll(`input[type='checkbox'][${Ae.Attributes.VJS}='${p}']`);if(Array.isArray(m)||m==null&&g.length>1){let y=[];g.forEach(x=>{x.checked&&y.push(x.value)}),this.setValue(p,y)}else this.setValue(p,d.checked===!0)}else if(u===Ae.Elements.RADIO)d.checked&&this.setValue(p,_p(d.value,d.getAttribute(Ae.Attributes.DATATYPE)));else if(u===Ae.Elements.COLOR||u===Ae.Elements.NUMBER||u===Ae.Elements.RANGE)this.setValue(p,d.value);else if(u===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA){let m=this.mt.get(p);m.edited=!0,m.editedValue=d.value}else d.tagName.toUpperCase()===Ae.Elements.SELECT&&this.setValue(p,_p(d.value,d.getAttribute(Ae.Attributes.DATATYPE)))}};this.container.addEventListener(Lp,s,!0);let a=h=>{if(!this.xr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.mt.get(u);p.edited=!0,p.editedValue=d.value}}};this.container.addEventListener(m0,a,!0);let l=h=>{if(!this.xr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.mt.get(u);p.edited=!0,this.setValue(u,d.value)}}};this.container.addEventListener(E0,l,!0),this.$ui.bind(Pi,()=>{this.container.removeEventListener(E0,l),this.container.removeEventListener(Lp,s),this.container.removeEventListener(g0,o),this.container.removeEventListener(m0,a),this.model.unbind(Ve,e),this.model.unbind(Re,e),this.model.unbind(cr,e),this.model.unbind(pt,n),this.Zy()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.ec(e))}}$_recomputeCommonData(){this.gt={};let e={},t=new Set;this.current.forEach(n=>Object.keys(n.data).forEach(o=>t.add(o))),this.mt.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n];t.forEach(s=>{if(!e[s]){let a=o.data[s];a==null&&this.$getDefaultValue!=null&&(a=this.$getDefaultValue(o.data,s)),this.gt[s]==null?this.gt[s]=a:this.gt[s]!==a&&(e[s]=!0,this.gt[s]="")}})}for(let n in e){let o=this.mt.get(n);o!=null&&(o.common=!0,o.commonValue=this.gt[n])}}Jy(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}Lp(e){this.setSuspendEvents(!0);let t=this.Kl?new Map(Object.entries(e).filter(o=>typeof o[1]=="string"&&o[1].length===0)):null,n=0;try{this.model.openTransaction();try{this.current.forEach((o,s)=>{if(this.Kl){let a=this.Jy(e,o.data,t);Object.keys(a).length>0&&(this.model.update(o,a),n++)}else this.model.update(o,e),n++})}catch(o){U("WARN: error occurred updating item from inspector")}n>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.ql&&this.ql()}finally{this.setSuspendEvents(!1)}}Ky(e){this.Jl?this.Lp(e):Object.assign(this.yr,e)}reset(e){try{this.xr=!0,this.yr={},this.container.classList.remove(Bv),this.container.classList.add(Rp),e||(this.Rp(),this.current.length=0,this.Ql&&this.wp())}finally{this.xr=!1}}Zy(){this.current.length=0,this.yr={},this.mt.clear(),this.container.innerHTML=""}tt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(K(e)||Y(e))&&(t=this.current.findIndex(n=>H(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}wp(){if(!this.container.querySelector(X(Fv))){let e=document.createElement(He);e.classList.add(Fv),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}ec(e){if(e!=null&&!this.ht(e))return;let t=!this.Pp||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(Rp),this.container.classList.add(Bv),this.yr={},this.current.push(e),t?this.Vi(e,()=>this.$refresh()):this.Dp()):this.container.classList.add(Rp)}$refresh(){this.mt.clear(),this.container.querySelectorAll(be(Ae.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(Ae.Attributes.VJS);this.mt.set(n,{field:t,edited:!1,common:!1,commonValue:null,attribute:n})}),this.Dp()}addValueListener(e){this._p.push(e)}setValue(e,t,n){this.Ky({[e]:t}),this._p.forEach(o=>o(e,t)),n&&this.redraw()}qy(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.gt[e]}onChange(e){this.bind(Lp,e)}persist(){let e=Object.keys(this.yr).length;return e>0&&(this.Lp(this.yr),this.yr={}),e}hasPendingChanges(){return Object.keys(this.yr).length>0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var y0="vjs-color-picker",Uv="vjs-color-picker-swatches",Yv="vjs-color-picker-swatch",x0="vjs-color",b0="vjs-max-colors";function zv(i,r=Lh){i.registerTag(x0,{template:`<div class="${y0}">
|
|
72
72
|
<input type="color"/>
|
|
73
73
|
<div class="${Uv}">
|
|
74
74
|
<r-each in="$context.${r}">
|
|
75
75
|
<div class="${Yv}" style="background-color:{{$value}};" data-color="{{$value}}"/>
|
|
76
76
|
</r-each>
|
|
77
77
|
</div>
|
|
78
|
-
</div>`,rendered:(e,t,n,o,s)=>{function a(m){let g=s[r];if(g!=null&&g.find(E=>E===m)==null){let E=g.slice();return E.unshift(m),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(Ae.Attributes.VJS),h=new fe,d=e.querySelector("[type='color']"),u=e.getAttribute(b0)||10;i.bind(ul,m=>{let g=e.querySelector(X(Uv));g.innerHTML="",m.value.forEach(E=>{let y=document.createElement(He);y.className=Yv,y.style.backgroundColor=E,y.setAttribute("data-color",E),g.appendChild(y)})});let p=t[l];p==null&&(p=i.qy(t,l)),p&&(d.value=p,a(p)),d.onchange=m=>{let g=d.value;a(g),i.setValue(l,g,!0)},h.on(e,W,"[data-color]",m=>{let g=m.target.getAttribute("data-color");i.setValue(l,g),d.value=g}),i.addValueListener((m,g)=>{m===l&&(a(g),d.value=g)})}})}var A0="data-value",S0="vjs-edge-type-picker",
|
|
78
|
+
</div>`,rendered:(e,t,n,o,s)=>{function a(m){let g=s[r];if(g!=null&&g.find(E=>E===m)==null){let E=g.slice();return E.unshift(m),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(Ae.Attributes.VJS),h=new fe,d=e.querySelector("[type='color']"),u=e.getAttribute(b0)||10;i.bind(ul,m=>{let g=e.querySelector(X(Uv));g.innerHTML="",m.value.forEach(E=>{let y=document.createElement(He);y.className=Yv,y.style.backgroundColor=E,y.setAttribute("data-color",E),g.appendChild(y)})});let p=t[l];p==null&&(p=i.qy(t,l)),p&&(d.value=p,a(p)),d.onchange=m=>{let g=d.value;a(g),i.setValue(l,g,!0)},h.on(e,W,"[data-color]",m=>{let g=m.target.getAttribute("data-color");i.setValue(l,g),d.value=g}),i.addValueListener((m,g)=>{m===l&&(a(g),d.value=g)})}})}var A0="data-value",S0="vjs-edge-type-picker",Dp="vjs-edge-type-picker-selected",Np=class{constructor(r,e,t,n,o){this.ui=r;this.me=e;this.Qy=t;this.Np=n;this.Ip=o;c(this,"entryMap",new Map);this.me.classList.add(S0)}render(r,e){this.me.innerHTML="";let t=this.Qy.find(n=>n.property===r);if(t!=null)for(let n in t.mappings){let o=t.mappings[n],s=document.createElement(He);s.setAttribute(A0,n),n===this.Np&&s.classList.add(Dp);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.me.appendChild(s),this.ui.on(s,W,l=>{this.select(r,n)})}}select(r,e){let t=this.entryMap.get(e);if(t){this.Np=e,this.me.setAttribute(A0,e);let n=this.me.querySelector(X(Dp));n&&n.classList.remove(Dp),t.classList.add(Dp),this.Ip&&this.Ip(r,e)}}};var T0="vjs-edge-type",v0="edgeMappings";function nG(i){return i.getFromContext(v0)||i.$ui.$getEdgePropertyMappings()}function Xv(i){i.registerTag(T0,{template:"<div/>",rendered:(r,e)=>{let t=r.getAttribute(Ae.Attributes.VJS),n=e[t]||"";new Np(i.$ui,r,nG(i),n,(o,s)=>{i.setValue(o,s)}).render(t,e)}})}var iG="<div/>",Ip=class extends wp{constructor(e){super(Object.assign(e,{refresh:(t,n)=>{this.container.replaceChildren(this.ex(t,this.$context)),n()},renderEmptyContainer:()=>{let t=this.I.render(this.Ui).fragment;this.container.replaceChildren(t)}}));c(this,"T");c(this,"I",yr());c(this,"Ui");c(this,"Ps");c(this,"Mp",new Map);c(this,"Vp",new Map);c(this,"Gp",new Map);c(this,"_s");this.T=e.ui.model,this._s=e.cacheTemplates!==!1,this.Ps=e.templateResolver,this.Ui=this.I.parse(e.emptyTemplate||iG),zv(this),Xv(this)}registerTag(e,t){this.I.registerTag(e,t)}nx(e){let t=this.T.getPortType(e.data),n=this.Gp.get(t);if(n==null){let o=this.Ps(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for port of type ${t}`),this.Ui;n=this.I.parse(o),this._s&&this.Gp.set(t,n)}return n}$p(e){let t=this.T.getNodeType(e.data),n=this.Mp.get(t);if(n==null){let o=this.Ps(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for vertex of type ${t}`),this.Ui;n=this.I.parse(o),this._s&&this.Mp.set(t,n)}return n}ix(e){return this.$p(e)}lx(e){let t=this.T.getEdgeType(e.data),n=this.Vp.get(t);if(n==null){let o=this.Ps(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for edge of type ${t}`),this.Ui;n=this.I.parse(o),this._s&&this.Vp.set(t,n)}return n}ex(e,t){let n;return K(e)?n=this.$p(e):Y(e)?n=this.ix(e):H(e)?n=this.nx(e):Ke(e)&&(n=this.lx(e)),this.I.render(n,e.data,null,t).fragment}};function C0(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;">
|
|
@@ -99,9 +99,9 @@ var uc=Object.defineProperty,uD=Object.defineProperties,gO=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 jv=class extends Vp{constructor(e){super(Object.assign(e,{templateResolver:t=>this.hx(t),getDefaultValue:(t,n)=>{let o=this.Up(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Rn");c(this,"Rs");c(this,"Bp");c(this,"Fp");this.Rn=e.ui.getShapeLibrary(),this.Rs=e.properties,this.Bp=e.propertyMode||"override",this.Fp=e.noPropertiesMessage||"No configurable properties for this shape."}Up(e){if(this.Bp==="override"&&this.Rs!=null)return this.Rs;let t=this.Rn.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Rn.getShapeSet(e.category||this.Rn.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Rn.getShapeSet(e.category||this.Rn.defaultCategoryId);n=o?o.properties:null}return n==null?this.Rs||[]:n}hx(e){if(K(e)||Y(e)){let t=this.Up(e.data);return t?C0(t,this.Fp):null}else return null}};var zf="drag",Hv="tap",Xf="draw";var jf=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Pn(e)}Pn(r){this.templateRenderer=new Zo({templates:{tp:r}})}setData(r,e){e&&this.Pn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function P0(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=xe),r}var O0="[data-vjs-type]";function sG(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 Ta=class{constructor(r,e){this.ui=r;c(this,"zi");c(this,"source");c(this,"Ln");c(this,"zp");c(this,"Vt");c(this,"Gt");c(this,"Yp");c(this,"kr");c(this,"tc");c(this,"Yi");c(this,"rc");c(this,"nc");c(this,"ic");c(this,"onDrag");c(this,"Ar");c(this,"oc");c(this,"Qt");c(this,"sc");c(this,"Ls");c(this,"lc");c(this,"Xi");c(this,"hc");c(this,"dc");c(this,"ji");c(this,"ws");c(this,"Xp");c(this,"Je");c(this,"ki",[]);c(this,"Hi",[]);c(this,"wn",[]);c(this,"$e");c(this,"M");c(this,"Dn");c(this,"Sr");c(this,"k");c(this,"Nn");c(this,"jp");c(this,"uc");c(this,"kp");c(this,"Ds");c(this,"Hp");c(this,"pc");c(this,"Wp");c(this,"Hr");c(this,"mc");c(this,"Ae");c(this,"gc");c(this,"Ec");c(this,"Wi");this.zi=e.mode||zf,this.Je=new fe,this.Ar=e.ignoreZoom===!0,this.zp=e.ignoreGrid===!0,this.Hr=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.ic=e.canvasDropFilter||(t=>!0),this.oc=e.elementGenerator,this.tc=e.dataGenerator||P0,this.rc=e.typeGenerator||(t=>t.type),this.nc=e.groupIdentifier||((t,n)=>n.getAttribute(zl)===At),this.Yi=e.dragSizeGenerator,this.Qt=e.enabled!==!1,this.source=e.source,this.Ln=e.selector||O0,this.Ec=new jf(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.Ec.setData(e.data),this.Vt=e.dragActiveClass||Kt,this.Gt=e.dragHoverClass||qt,this.Yp=e.dragElementClass||VT,this.kr=e.dragHoverCannotDropClass||Wo,this.mc=e.dragSize,this.Ds=e.allowDropOnNode===!0,this.Hp=e.ignoreDropOnNode===!0,this.pc=e.allowDropOnGroup!==!1,this.Wp=e.allowDropOnEdge===!0,this.kp=e.allowDropOnCanvas!==!1,this.sc=e.onVertexAdded,this.onDrag=e.onDrag,this.Ls=e.selectAfterAdd===!0,this.Wi=function(t){t.key==="Escape"&&(this.zi===Xf?this.Ae!=null&&this.ui.setMode(xr):(this.Zp(),this.Jn()))}.bind(this),this.ui.bind(vn,t=>{t===Vn&&this.Ae==null?this.gc!=null&&this.Jp(this.gc.el):t!==Vn&&this.Ae!=null&&(F(this.Ae.el,ko),F(this.ui.rootElement,ih),this.gc=this.Ae,this.Ae=null,document.removeEventListener(Mn,this.Wi))}),this.zi===zf?this.ux():this.zi===Xf?this.px(e):this.zi===Hv&&this.mx()}setEnabled(r){this.Qt=r}setData(r,e){this.Ec.setData(r,e)}Jp(r){let e=Zt(r,this.Ln,this.source,!0);if(this.Ae!=null){if(F(this.Ae.el,ko),this.Ae.el===e){this.ui.setMode(xr);return}}else document.addEventListener(Mn,this.Wi);let t=this.tc(e);this.Nn=this.Yi?this.Yi(this.$e,e):this.mc,this.Ae={el:e,data:t,objectType:e.getAttribute(zl)===At?le.objectType:de.objectType,type:this.rc(t)},L(this.Ae.el,ko),L(this.ui.rootElement,ih),this.ui.setMode(Vn)}Kp(r,e){this.lc=t=>{if(this.Qt){let n=t.target,o=Zt(n,this.Ln,this.source,!0);if(this.uc=this.Ar?1:this.ui.getEffectiveVisibleZoom(),this.$e=this.tc(o),this.ic&&!this.ic(this.$e))return;if(this.Nn=this.Yi?this.Yi(this.$e,o):this.mc,this.k=this.oc?this.oc(o,t,this.$e):r(o),this.k.removeAttribute("id"),L(this.k,this.Yp),this.k.style.position=je,this.k.style.margin="0",this.jp=this.nc(this.$e,o)?le.objectType:de.objectType,this.Dn=this.jp===le.objectType?new le(this.ui.model.graph,this.$e):new de(this.ui.model.graph,this.$e),Jt(this.k,{x:t.pageX,y:t.pageY}),!this.Ar){let s=-50/this.uc;this.k.style.transform=`scale(${this.uc}) translate(${s}%,${s}%)`}e(o,this.k),document.body.appendChild(this.k),this.ji=!1,this.ws=this.kp===!1?!1:this.Hr!=null?this.Hr(this.Dn,null,!0):!0,this.Xp=this.ui.getVisibleCanvasBounds(),this.dc=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,ct),L(this.ui.rootElement,this.Vt),this.Je.on(document,ie,this.hc),this.ki.length=0,this.wn.length=0,!this.Hp&&this.Ds&&this.ui.$getNodesInViewport().forEach(s=>{let a=s.el.el;this.ki.push({element:s.el.el,cssElement:a,r:s.el,managedElement:s.el,canDrop:this.Hr?this.Hr(this.Dn,s.el.modelObject,!1):this.Ds,vertex:s.el.modelObject,id:s.el.id,objectType:de.objectType,modelObject:s.el.modelObject}),this.Ds&&L(a,this.Vt)}),this.ui.$getGroupsInViewport().forEach(s=>{let a=this.ui.getGroupDefinition(s.el.modelObject);if(a.canDrop==null||a.canDrop(this.Dn)){let l=this.ui.$_getGroupContentAreaInfo(s.el.id),h=this.ui.containerType==="SVG"?s.el.el:l.contentArea;this.Hi.push({element:l.contentArea,canDrop:this.pc===!1?!1:this.Hr?this.Hr(this.Dn,s.el.modelObject,!1):!0,vertex:s.el.modelObject,managedElement:s.el,cssElement:h,id:s.el.id,objectType:le.objectType,modelObject:s.el.modelObject,depth:Sc(s.el.modelObject),r:{x:s.el.x+l.internalOffset.x,y:s.el.y+l.internalOffset.y,width:s.el.width-l.internalOffset.x,height:s.el.height-l.internalOffset.y}}),this.pc&&L(h,this.Vt)}}),this.Hi.sort((s,a)=>a.depth-s.depth),this.Wp&&this.ui.model.getAllEdges().forEach(s=>{let a=this.ui.getRenderedConnection(s.id),l=a.connector.canvas,h=l;this.wn.push({edge:s,connection:a,connector:a.connector,element:l,cssElement:h,id:s.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(l),objectType:Fe.objectType,modelObject:s}),L(h,this.Vt)}),this.Je.on(document,Mn,this.Wi)}}}Zp(){this.Je.off(document,ie,this.hc),this.Je.off(document,W,this.Xi),this.Je.off(document,oe,this.Xi),F(document.body,ct),F(this.ui.rootElement,this.kr),F(this.ui.rootElement,this.Vt),F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,ih),this.Je.off(document,Mn,this.Wi),this.ki.forEach(r=>{F(r.cssElement,this.Vt)}),this.Hi.forEach(r=>{F(r.cssElement,this.Vt)}),this.wn.forEach(r=>{F(r.cssElement,this.Vt)}),this.M!=null&&(F(this.M.cssElement,this.Gt),F(this.M.cssElement,this.kr))}qp(r){this.Xi=e=>{this.Zp(),this.ji&&(this.M!=null?this.M.objectType===de.objectType&&this.M.canDrop?this.Qp(e,this.M.vertex):this.M.objectType===le.objectType&&this.M.canDrop?this.gx(e):this.M.objectType===Fe.objectType&&this.M.canDrop&&this.Ex(e):this.ws&&this.Qp(e,null)),this.Jn()}}em(){this.hc=r=>{Jt(this.k,{x:r.pageX,y:r.pageY}),this.Nn&&Rr(this.k,this.Nn.width,this.Nn.height);let e=this.ui.$getElementPositionInWindow(this.k);if(ke(this.dc,e)){if(!this.zp&&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.k.style.left=`${s.x+e.width/2}px`,this.k.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.k)}this.M!=null&&(F(this.M.cssElement,this.Gt),F(this.M.cssElement,this.kr),this.M=null),this.Sr=sG(this.Xp,this.dc,e);let t=[],n=!1;if(this.ki.forEach(o=>{ke(this.Sr,o.r)&&(t.push(o),n=o.canDrop)}),this.Hi.forEach(o=>{ke(this.Sr,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(We(o.vertex,s.vertex))return-1;if(We(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,this.kr),this.M=t[0],this.M.canDrop&&L(this.M.cssElement,this.Gt)),!n){for(let o=0;o<this.wn.length;o++){let s=this.wn[o],a=s.r,l=s.connector;if(ke(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(wA(l,u).length>0){this.M=s,L(this.M.cssElement,this.Gt);break}}}this.M==null&&(this.ws?L(this.ui.rootElement,this.Gt):L(this.ui.rootElement,this.kr))}this.ji=!0}else F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,this.kr),this.ji=!1;this.onDrag&&this.onDrag(this.$e,this.k,r)}}ux(){this.em(),this.qp(oe),this.Kp(r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,oe,this.Xi)}),this.Je.on(this.source,ue,this.Ln,this.lc)}mx(){this.em(),this.qp(W),this.Kp(r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.Xi),e},(r,e)=>{L(e,"vjs-palette-tap-mode-placeholder"),L(r,ko),L(this.ui.rootElement,ih)}),this.Je.on(this.source,W,this.Ln,this.lc)}Ex(r){if(this.M.objectType===Fe.objectType){let e=this.M.edge;this.ui.model.transaction(()=>{this.fc(this.$e,this.Sr,this.k,r,this.M.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},co,null),this.ui.model.$_addEdge({source:t,target:a,data:l},co,null)})},St)}}gx(r){this.M.objectType===le.objectType&&(this.Sr.x-=this.M.r.x,this.Sr.y-=this.M.r.y,this.fc(this.$e,this.Sr,this.k,r,this.M.vertex),this.ui.relayoutGroup(this.M.id))}Qp(r,e){this.fc(this.$e,this.Sr,this.k,r,e)}fx(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===Ye?t[n.x]=r[o]:o===Se?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}fc(r,e,t,n,o,s){let a=this.rc(r),l=this.nc(r,t),h=this.fx({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(h.group=o.id);let d=null;if(o!=null){let p=this.ui.viewport.getElementBounds(o.id);p!=null&&(d={vertex:o,pos:{x:p.x,y:p.y},size:{width:p.width,height:p.height}})}let u=this.ui.getModelPositionAttributes();l?this.ui.model.addFactoryGroup(a,h,p=>{let m=p.data[u.x]==null?e.x:p.data[u.x],g=p.data[u.y]==null?e.y:p.data[u.y];this.ui.setPosition(p,m,g),s&&s(p,m,g),this.yc(this.ui.model.getGroup(p.id),d),this.Ls&&this.ui.model.setSelection(this.ui.model.getGroup(p.id))},null,!1):this.ui.model.addFactoryNode(a,h,p=>{let m=p.data[u.x]==null?e.x:p.data[u.x],g=p.data[u.y]==null?e.y:p.data[u.y];this.ui.setPosition(p,m,g),s&&s(p,m,g),this.yc(this.ui.model.getNode(p.id),d),this.Ls&&this.ui.model.setSelection(this.ui.model.getNode(p.id))},null,!1)}yc(r,e){this.sc&&this.sc({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")}})})}})}Jn(){Array.from(this.source.querySelectorAll(`.${ko}`)).forEach(r=>{F(r,ko)}),this.Dn=null,this.$e=null,this.ki.length=0,this.Hi.length=0,this.wn.length=0,this.k&&this.k.parentElement.removeChild(this.k),this.k=null,this.Nn=null,this.ji=!1,this.ws=!1}px(r){this.Je.on(this.source,W,this.Ln,n=>{let o=n.target;this.Jp(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.Ae),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.yc(n),this.Ls&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.Ae.objectType,this.Ae.type,this.Ae.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.Ae.data)}),this.ui.addPlugin({type:hi.type,options:t})}};var wh=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new Sp(t.container,e,t),!0}destroy(){}reset(){}};c(wh,"type","controls"),wh=Nt([wt("controls")],wh);var Gp=class extends Oe{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new Sa(t.container,e,t),!0}destroy(){}reset(){}};Gp=Nt([wt("exportControls")],Gp);var rs=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"Zi",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.Zi=[],this.dragGroupAssigner=t.assignDragGroup,e.bind(Br,n=>{this.Ji(n.el,n.vertex)}),e.bind($r,n=>{this.Ji(n.el,n.vertex)}),e.bind(Sn,n=>{this.yx()}),e.bind(Vs,n=>{this.Ji(n.el,n.modelObject)}),!0}destroy(){}reset(){this.Zi.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.Ji(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))}Ji(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.Zi.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:kv}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}yx(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.Zi.length;e++)this.Ji.apply(this,this.Zi[e])}};c(rs,"type","dragGroups"),rs=Nt([wt("dragGroups")],rs);var $p="vjs-snapline",Wv="vjs-snapline-vertical",Zv="vjs-snapline-horizontal",Hf="vjs-snapline-exact",Jv="vjs-snapline-active",Kv="vjs-snapline-active-exact",ns=class extends Oe{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){return 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(Rs,n=>{if(this.enabled&&n.dragGroup.length>0){let o=n.dragGroup[0],s=this.surface.viewport.getElements();this.focus=o.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let a in s)if(a!==this.focus.id){let l=s[a].t,h=l.width,d=l.height;this.showEdges&&(this.horizontalRanges.push({position:Ye,start:l.x-this.tolerance,end:l.x+this.tolerance,objId:a,line:this.xc(l.x),el:s[a].el,orientation:"v"}),this.horizontalRanges.push({position:ut,start:l.x+h-this.tolerance,end:l.x+h+this.tolerance,objId:a,line:this.xc(l.x+h),el:s[a].el,orientation:"v"}),this.verticalRanges.push({position:Se,start:l.y-this.tolerance,end:l.y+this.tolerance,objId:a,line:this.bc(l.y),el:s[a].el,orientation:"h"}),this.verticalRanges.push({position:st,start:l.y+l.height-this.tolerance,end:l.y+l.height+this.tolerance,objId:a,line:this.bc(l.y+d),el:s[a].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:Rt,start:l.x+h/2-this.tolerance,end:l.x+h/2+this.tolerance,objId:a,line:this.xc(l.x+h/2),el:s[a].el,orientation:"v"}),this.verticalRanges.push({position:Rt,start:l.y+d/2-this.tolerance,end:l.y+d/2+this.tolerance,objId:a,line:this.bc(l.y+d/2),el:s[a].el,orientation:"h"}))}}}),this.surface.bind(nr,n=>{if(this.enabled&&n.dragGroup.length>0){this.Ns();let o=n.dragGroup[0],s=o.pos.x,a=s+this.focus.width/2,l=s+this.focus.width,h=o.pos.y,d=h+this.focus.height/2,u=h+this.focus.height,p={};for(let m=0;m<this.horizontalRanges.length;m++){let g=this.horizontalRanges[m];p[g.objId]||(g.start<=a&&g.end>=a?(p[g.objId]=!0,this.In(g,a)):g.start<=s&&g.end>=s?(p[g.objId]=!0,this.In(g,s)):g.start<=l&&g.end>=l&&(p[g.objId]=!0,this.In(g,l)))}for(let m=0;m<this.verticalRanges.length;m++){let g=this.verticalRanges[m];p[g.objId]||(g.start<=d&&g.end>=d?(p[g.objId]=!0,this.In(g,d)):g.start<=h&&g.end>=h?(p[g.objId]=!0,this.In(g,h)):g.start<=u&&g.end>=u&&(p[g.objId]=!0,this.In(g,u)))}}}),this.surface.bind(Lt,n=>{this.enabled&&(this.Ns(),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)}),!0}In(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(`${Hf}`):e.line.classList.remove(`${Hf}`);let s={x:e.orientation===Cx?-5e4:n,y:e.orientation===Pc?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${Jv}`),o&&L(e.el,`${Kv}`)}Ns(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${Hf}`),this.surface.unfixElement(e.line),F(e.el,`${Jv}`),F(e.el,`${Kv}`)})}bc(e){if(this.surface.containerType==="SVG")return Kr(Wt,Z,{y:`${e}px`},`${$p} ${Zv}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(He);return t.className=`${$p} ${Zv}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}xc(e){if(this.surface.containerType==="SVG")return Kr(Wt,Z,{x:`${e}px`},`${$p} ${Wv}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(He);return t.className=`${$p} ${Wv}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.Ns()}reset(){this.Ns()}};c(ns,"type","snaplines"),ns=Nt([wt("snaplines")],ns);var Dh=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Ta(e,t),!0}reset(){}};c(Dh,"type","palette"),Dh=Nt([wt("palette")],Dh);var is=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"Ki",[]);c(this,"tm",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"rm",!1);c(this,"Ac");c(this,"nm")}initialise(e,t){return this.eventManager=new fe,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.Ac=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.tm),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,af),this.currentPanButton=null,this.eventManager.off(document,oe,this.Ac)},this.nm=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Se,{left:"0px",top:"0px"},0,-1,"↑"),this.makePanButton(st,{left:"0px",bottom:"0px"},0,1,"↓"),this.makePanButton(Ye,{left:"0px",top:"0px"},-1,0,"←"),this.makePanButton(ut,{right:"0px",top:"0px"},1,0,"→"),!0}curryPanButton(e,t){return n=>{this.rm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.rm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,af),this.eventManager.on(document,oe,this.Ac),this.tm=window.setTimeout(()=>{this.eventManager.on(document,oe,this.nm),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(He);return a.innerHTML=s||"",a.style.position=je,Object.assign(a.style,t),a.className=`${sf} ${sf}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Ue,this.curryPanButton(n,o)),this.eventManager.on(a,ue,this.startPanTimer(n,o,a)),this.Ki.push(a),a}destroy(){for(let e=0;e<this.Ki.length;e++)this.Ki[e].parentNode.removeChild(this.Ki[e]);this.Ki.length=0}reset(){}};c(is,"type","panButtons"),or.register(is.type,is);var qv="vjs-vertex-drawing-lasso",kf="vjs-group-candidate-child";var hi=class extends Oe{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,"im");c(this,"Sc");c(this,"Mn");c(this,"Vn");c(this,"Is");c(this,"Ms");c(this,"$onVertexAdded");c(this,"Tc");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}xx(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Vn=o.objectType,this.Is=o.type,this.Ms=o.data||{}}else this.nodeType!=null?(this.Vn=de.objectType,this.Is=this.nodeType,this.Ms={}):(this.Vn=le.objectType,this.Is=this.groupType||xe,this.Ms={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.Mn=n.obj:this.Mn=null}initialise(e,t){this.surface=e,this.Tc=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.Sc=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.im=this.Sc||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=`${qv} ${t.lassoClass||""}`;e.bind(vn,s=>{this.lasso.enabled=s===Vn}),this.vertexSelection=new mr(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=se(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.xx(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Vn===le.objectType){this.vertexSelection.clear(),this.om();let m=[],g,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(g=0;g<y;g++)m.push(E[g].v),x[E[g].id]=!0,this.vertexSelection.append(E[g].v),L(E[g].el,kf),this.selectedElements.push(E[g].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.om(),this.autoExit&&e.mode!==qo&&e.setMode(xr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.sm(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!==qo&&e.setMode(xr),this.im){let l=this.Vn===le.objectType?this.defaultGroupSize:this.defaultNodeSize;this.sm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new ga(o),this.Sc&&this.lasso.setEnabled(!1),!0}sm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.Tc.width||t.height>=this.Tc.height)&&(this.Vn===le.objectType?this.bx(this.surface,n,t):this.Ax(this.surface,n,t))}am(e,t){return Object.assign(this.Ms,{id:V(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Is})}Sx(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>We(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>We(o,s))==null&&n.groups.push(o)}),n}bx(e,t,n){let o;e.model.transaction(()=>{let s=this.am(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.Sx();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.Mn!=null&&e.model.addToGroup(o,this.Mn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Ax(e,t,n){let o;e.setSuspendRendering(!0);let s=this.am(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.Mn!=null&&e.model.addToGroup(o,this.Mn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}om(){this.selectedElements.forEach(e=>F(e,kf)),this.selectedElements.length=0}reset(){}activated(){this.lasso.enabled=!0}deactivated(){this.lasso.enabled=!1}};c(hi,"type","vertexDrawing"),or.register(hi.type,hi);var Bp=12,Qv=40,eC=16,tC=6,rC=30,nC=30,iC=5,oC="borders",Nh="handles",sC="vjs-resize-skeleton",aC="vjs-resize-skeleton-borders",lC="vjs-resize-skeleton-borders-visible",hC="vjs-resize-frame",yt="vjs-resize-handle",Wf="vjs-resize-handle-active",Zf="vjs-resize-handle-tl",Jf="vjs-resize-handle-bl",Kf="vjs-resize-handle-tr",qf="vjs-resize-handle-br",Qf="vjs-resize-handle-t",ey="vjs-resize-handle-b",ty="vjs-resize-handle-l",ry="vjs-resize-handle-r",os="vjs-resize-border",cC="vjs-resize-border-b",dC="vjs-resize-border-t",uC="vjs-resize-border-l",pC="vjs-resize-border-r",Ih="vjs-rotate-handle",Fp="vjs-rotate-leader",ny="data-vjs-x-resize",iy="data-vjs-y-resize",oy="data-vjs-resizable",sy="data-vjs-rotatable",va="data-dir";function Ie(i,r,e,t){let n=$(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function ay(i,r){Ce(i,r.ro),r.r!=null&&Ho(i,r.r)}var ss=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function mC(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=Ie(Z,[yt,Zf],n,{"data-dir":"tl",[ee]:e.id,width:i,height:i,x:l-o,y:h-o,transform:ss(i,t)}),p.tr=Ie(Z,[yt,Kf],n,{"data-dir":"tr",[ee]:e.id,width:i,height:i,x:d+o,y:h-o,transform:ss(i,t)}),p.bl=Ie(Z,[yt,Jf],n,{"data-dir":"bl",[ee]:e.id,width:i,height:i,x:l-o,y:u+o,transform:ss(i,t)}),p.br=Ie(Z,[yt,qf],n,{"data-dir":"br",[ee]:e.id,width:i,height:i,x:d+o,y:u+o,transform:ss(i,t)})),a&&(p.t=Ie(Z,[yt,Qf],n,{"data-dir":"t",[ee]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:ss(i,t)}),p.b=Ie(Z,[yt,ey],n,{"data-dir":"b",[ee]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:ss(i,t)})),s&&(p.l=Ie(Z,[yt,ty],n,{"data-dir":"l",[ee]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:ss(i,t)}),p.r=Ie(Z,[yt,ry],n,{"data-dir":"r",[ee]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:ss(i,t)})),p}function gC(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=Ie(ze,[yt,Zf],n,{"data-dir":"tl",[ee]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ie(ze,[yt,Kf],n,{"data-dir":"tr",[ee]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ie(ze,[yt,Jf],n,{"data-dir":"bl",[ee]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ie(ze,[yt,qf],n,{"data-dir":"br",[ee]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ie(ze,[yt,Qf],n,{"data-dir":"t",[ee]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ie(ze,[yt,ey],n,{"data-dir":"b",[ee]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ie(ze,[yt,ty],n,{"data-dir":"l",[ee]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ie(ze,[yt,ry],n,{"data-dir":"r",[ee]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function _0(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=se({x:t,y:n},i.grid);t=h.x,n=h.y;let d=se({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=se({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=se({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=se({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=se({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=se({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=se({x:t,y:n},i.grid).y,s=se({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=se({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=se({x:t,y:n},i.grid).x,o=se({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=se({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function R0(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=se({x:t,y:n},i.grid);t=l.x,n=l.y;let h=se({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=se({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=se({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=se({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=se({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=se({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 EC(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 fC(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 as=class extends Oe{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,"Wr");c(this,"Tr");c(this,"qi");c(this,"vc");c(this,"Cc");c(this,"lm");c(this,"Oc");c(this,"skeletons");c(this,"at");c(this,"vr");c(this,"Vs");c(this,"Qi");c(this,"Gs");c(this,"te");c(this,"Cr");c(this,"downAt");c(this,"Pc");c(this,"handler");c(this,"toolkitDragObject");c(this,"$s");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"_c");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"cm");c(this,"hm");c(this,"Rc");c(this,"Et",!1);c(this,"Lc",!1);c(this,"Bs",!1);c(this,"$handleOffset");c(this,"wc");c(this,"Dc");c(this,"ft");c(this,"Nc");c(this,"Zr");c(this,"Se");c(this,"lt");c(this,"um");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"pm");c(this,"mm")}dm(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.Et=e,this.dm(e)}set $rotating(e){this.Lc=e,this.dm(e)}get $busy(){return this.Et||this.Lc}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||iC,this.wc=t.modelUpdater,this.Dc=t.handlerFactory,this.pm=_0(this),this.mm=R0(this),e.$addTransferrableVertexAttributes([oy,iy,ny,sy]),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:rC,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:nC,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.hm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.ft=t.handleSize||Bp,this.Nc=t.handleShape||"circle",this.Zr=t.rotateLeaderLength||Qv,this.Se=t.rotateHandleSize||eC,this.lt=t.borderHandleSize||tC,this.resizeMethod=t.resizeMethod||Nh,this.bordersVisible=this.resizeMethod===oC&&t.bordersVisible!==!1,this.cm=t.rotatable===!0,this.Rc=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[yt,Ih,Fp,os].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.um=t.payloadGenerator||((a,l)=>l),this.instance.bind(Cr,()=>{this.reset()}),this.instance.bind(ur,a=>{this.onDemand!==!0&&this.Ic(a.obj)}),this.instance.bind(pr,a=>{this.onDemand!==!0&&this.Gn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(nr,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Ve,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(Re,a=>{n(a.vertex)}),this.instance.bind(Le,a=>{this.Gn(a.node)}),this.instance.bind(Me,a=>{this.Gn(a.group),a.group.getMembers().forEach(l=>this.Gn(l))});let o=a=>{this.Et||this.instance.openTransaction(),this.$moving=!0,ae(a);let l=this.surface.mapEventLocation(a);this.Lc?this.Tx(l):this.vx(l)},s=a=>{if(this.$busy){if(ae(a),this.Bs&&this.at!=null){let l=new Set;if(this.te!=null){let h={},d={},u={},{movedElements:p,resizedGroups:m}=this.te.Ul();Object.assign(u,m);for(let g in p)h[g]=p[g].current,d[g]=p[g].current;for(let g in h){let E={[this.surface.$modelLeftAttribute]:h[g].x,[this.surface.$modelTopAttribute]:h[g].y};u[g]!=null&&(E[this.surface.$modelWidthAttribute]=u[g].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[g].newGroupSize.height),this.surface.model.$_updateVertex(g,E,Bs,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let g in u){let E=u[g].newGroupSize;this.surface.viewport.updateElement(g,null,null,E.width,E.height,null,null,!1)}}else l.add(this.at);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.$s&&F(this.$s,Wf),this.surface.$removeClassFromElement(document.body,ct),this.surface.off(document,ie,o),this.surface.off(document,oe,s),this.te&&this.te.cleanup(),this.te=null,this.at=null,this.Vs=!1,this.Qi=null,this.Gs=null,this.vr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.Bs=!1}};return this.surface.on(this.surface.getContainer(),ue,X(yt),a=>{this.gm(a,this.pm,o,s)}),this.surface.on(this.surface.getContainer(),ue,X(os),a=>{this.gm(a,this.mm,o,s)}),this.surface.on(this.surface.getContainer(),ue,X(Ih),a=>{ae(a),this.Tr=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(ee)),this.toolkitDragObject!=null&&(this.Cr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Tr=this.Cr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this._c={x:this.Cr.c.x,y:this.Cr.c.y},this.Em(a),this.surface.$addClassToElement(document.body,ct),this.surface.on(document,ie,o),this.surface.on(document,oe,s))}),!1}Em(e){this.toolkitDragObject!=null&&(this.at=this.toolkitDragObject.group,this.Vs=!1,this.at!=null&&(this.Qi=this.surface.getGroupDefinition(this.at),this.Gs=this.surface.$_getGroupContentAreaInfo(this.at.id),this.vr=this.surface.viewport.getGroupElement(this.at.id),this.Vs=this.Qi.elastic===!0&&e.shiftKey!==!0,this.Vs&&(this.te=new ya(this.surface,this.toolkitDragObject,this.at,this.Qi))))}gm(e,t,n,o){ae(e);let s=e.target,a=s.getAttribute(ee);this.Wr=s.getAttribute(va),this.$s=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.Cr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Em(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.Cx(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.Tr=this.fm(),this.qi={x:l.x,y:l.y},this.Oc={width:l.width,height:l.height},this.vc=this.$x2-this.$x1,this.Cc=this.$y2-this.$y1,this.lm={x:this.$x1+this.vc/2,y:this.$y1+this.Cc/2},this.Pc=fC(this.downAt.x,this.downAt.y,this.Tr,{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.hm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),m=p.xmax+u.internalOffset.x,g=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,m),this.currentMinimumHeight=Math.max(this.minimumHeight,g)}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=se({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.Wr]),this.Dc!=null){let h=this.Dc(this.surface,this.toolkitDragObject,this.Wr,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.$s,Wf),this.surface.$addClassToElement(document.body,ct),this.surface.on(document,ie,n),this.surface.on(document,oe,o)}fm(){if(this.Cr==null)return 0;{let t=(this.Cr.r==null?0:this.Cr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Ox(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.fm();return t?EC(e.x,e.y,o,n):fC(e.x,e.y,o,n)}Cx(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.Px();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}Fs(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}Gn(e){this.Fs(e.id)}Ic(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.Gn(e),Y(t.modelObject)&&t.collapsed||En(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(ny)!==at&&this.resizeX!==!1,s=t.el.getAttribute(iy)!==at&&this.resizeY!==!1;if(t.el.getAttribute(oy)===at||!o&&!s)return;this.Mc(t,e,o,s)}}Mc(e,t,n,o){let s=e,a=this.resizeMethod==Nh?[sC]:[aC];this.bordersVisible&&a.push(lC);let l=Ie(q,a,null,{transform:`translate(${e.x}, ${e.y})`,[ee]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ie(Z,[hC],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(sy)===at?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.cm,m=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===Nh){if(p){m.rl=Ie(te,[Fp],l,{[ee]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.Zr+this.$handleOffset}`,"stroke-width":2}),m.rh=$(q,{transform:`translate(${s.width/2-this.Se/2}, ${-this.Zr-this.$handleOffset-this.Se/2})`}),l.appendChild(m.rh),Ie(ze,[Ih],m.rh,{[ee]:t.id,cx:this.Se/2,cy:this.Se/2,r:this.Se/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let g=$(Je,{x:`${this.Se/2}`,y:`${this.Se/2}`,"font-size":Math.floor(this.Se*.75)});g.innerHTML="\u21BA",m.rh.appendChild(g)}u&&(m.handles=this.Nc==="rectangle"?mC(this.ft,s,t,d,l,this.$handleOffset,n,o):gC(this.ft,s,t,d,l,this.$handleOffset,n,o))}else p&&(m.rl=Ie(te,[Fp],l,{[ee]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.Zr+this.$handleOffset}`,"stroke-width":2}),m.rh=$(q,{transform:`translate(${s.width/2-this.Se/2}, ${-this.Zr-this.$handleOffset-this.Se/2})`}),l.appendChild(m.rh),Ie(ze,[Ih],m.rh,{[ee]:t.id,cx:this.Se/2,cy:this.Se/2,r:this.Se/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),m.borders={t:null,b:null,l:null,r:null},u&&(o&&(m.borders.t=Ie(Z,[os,dC],l,{[va]:"t",[ee]:t.id,width:s.width,height:this.lt,x:0,y:-this.lt/2}),m.borders.b=Ie(Z,[os,cC],l,{[va]:"b",[ee]:t.id,width:s.width,height:this.lt,x:0,y:s.height-this.lt/2})),n&&(m.borders.r=Ie(Z,[os,pC],l,{[va]:"r",[ee]:t.id,width:this.lt,height:s.height,x:s.width-this.lt/2,y:0}),m.borders.l=Ie(Z,[os,uC],l,{[va]:"l",[ee]:t.id,width:this.lt,height:s.height,x:-(this.lt/2),y:0})));return ay(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return ay(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Se/2}, ${-this.Zr-this.$handleOffset-this.Se/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.Zr+this.$handleOffset}`),!0}return!1}_x(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}Tx(e){let t=e.x-this._c.x,n=e.y-this._c.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Rc!=null){let s=360/this.Rc;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},Gs,!1),this.Tr=o}vx(e){let t,n,o=this.Ox(e);if(t=o.x-this.Pc.x,n=o.y-this.Pc.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.Wr==="l"||this.Wr==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.Wr==="t"||this.Wr==="b")&&(t=0),this.Bs||t!=0||n!=0){this.Bs=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.at!=null&&(this.te!=null?this.te.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.Qi.constrain&&(s+l>this.vr.width&&(l=this.vr.width-s),a+h>this.vr.height&&(h=this.vr.height-a)))),this.ym(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.vc,y:this.$y1+this.handler.anchor[1]*this.Cc},p=EC(u.x,u.y,this.Tr,this.lm),m={x:s+l/2,y:a+h/2},g={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=EC(g.x,g.y,this.Tr,m),y=E.x-p.x,x=E.y-p.y,f={x:m.x-y,y:m.y-x},b=fC(p.x,p.y,this.Tr,f);this.qi={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Oc={width:l,height:h};let A=this._x(this.qi.x,this.qi.y,l,h),T=this.um(this.toolkitDragObject,A)||{},S=Object.assign(T,A),R;if(this.wc!=null&&(R=this.wc(this.toolkitDragObject,this.qi,this.Oc)),this.instance.$_updateVertex(this.toolkitDragObject,S,fl,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],fl,!1);if(R!=null)for(let v in R)this.instance.$_updateVertex(v,R[v],fl,!1)}}Px(){return this.at==null?{x:0,y:0}:{x:this.vr.x+this.Gs.internalOffset.x,y:this.vr.y+this.Gs.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Fs(e.id),setTimeout(()=>{this.Ic(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==fl&&this.skeletons[e.id]!=null&&(this.Fs(e.id),setTimeout(()=>{this.Ic(e.modelObject)}))}ym(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(ce(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===Nh?this.Nc==="rectangle"?(o.handles.tr&&ce(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&ce(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&ce(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&ce(o.handles.t,{x:e/2}),o.handles.b&&ce(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&ce(o.handles.l,{y:t/2}),o.handles.r&&ce(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&ce(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&ce(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&ce(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&ce(o.handles.t,{cx:e/2}),o.handles.b&&ce(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&ce(o.handles.l,{cy:t/2}),o.handles.r&&ce(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&ce(o.borders.t,{width:e}),o.borders.b&&ce(o.borders.b,{width:e,y:t-this.lt/2}),o.borders.r&&ce(o.borders.r,{height:t,x:e-this.lt/2}),o.borders.l&&ce(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.ym(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.Gn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{We(n.mel.modelObject,e.modelObject)&&this.Fs(n.mel.id)})}};c(as,"type","resizingTools"),as=Nt([wt("resizingTools")],as);var yC=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(yC||{}),Yp="state",Up=class extends It{constructor(e,t){super();this.components=e;this.params=t;c(this,"pathExists");c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===At?"paused":"playing"}setState(e){this.state=e,this.fire(Yp,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 Mh="startOverlayAnimation",qi="endOverlayAnimation",ly="startNodeTraversal",xC="endNodeTraversal",hy="vjs-animate-source",cy="vjs-animate-target",Fn="vjs-animate-node-traversing",Vh="vjs-animate-edge-traversing",aG="vjs-animate-node-traversable",zp="vjs-animate-edge-traversable",lG="vjs-animate-node-traversed",dy="vjs-animate-edge-traversed";var bC="INITIALIZED",uy="TRAVERSING_START",AC="TRAVERSING_EDGE",py="TRAVERSING_END",Ca="CANCELLED",Pa="FINISHED";function L0(i,r,e,t){let n=new It,o=r.connector.totalLength;t=t||{};let s=V(),a=t.events||{};for(let G in a)n.bind(G,a[G]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,m=o/p*1e3,g=m/d,E=1/g*(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,R=h?r.targetElement:r.sourceElement,v,O=t.paused===!0,P=!1,I=!1,C=bC;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 _=G=>{I=!1,Ui(r,s),window.clearInterval(b),y?G?(C=Ca,i.surface.removeClass(S,Fn),i.surface.removeClass(R,Fn),Or(r,Vh)):(C=py,i.surface.addClass(R,Fn),window.setTimeout(function(){M()},u)):(i.surface.removeClass(S,Fn),i.surface.removeClass(R,Fn),Or(r,Vh),G?C=Ca:(C=Pa,Wr(r,dy),n.fire(qi,{connection:r,harness:l})))},w=()=>{f+=E,T()?_(!1):(A.location=f,r.instance.$revalidateElementById(r.sourceId))},B=()=>{C=AC,n.fire(Mh,{connection:r,harness:l}),A=Gl(r,v),b=window.setInterval(w,d)},D=()=>{!I&&C!==Pa&&C!==Ca&&(i.surface.removeClass(S,Fn),n.fire(xC,{connection:r,element:S,harness:l}),B())},M=()=>{!I&&C!==Pa&&C!==Ca&&(C=Pa,i.surface.removeClass(S,Fn),i.surface.removeClass(R,Fn),Or(r,Vh),n.fire(qi,{connection:r,harness:l}))},N=()=>{P=!0,I=!1,n.fire(ly,{connection:r,element:S,harness:l}),i.surface.addClass(S,Fn),Wr(r,Vh),C=uy,window.setTimeout(()=>{D()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===uy?D():C===py?M():b=window.setInterval(w,d)):N()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==Pa&&C!==Ca&&(window.clearInterval(b),_(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(qi,N):O||N(),l}var Xp=class extends It{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=rd(o.start,()=>{this.surface.model.openTransaction(St)}),o.step=rd(o.step,()=>{}),o.complete=rd(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,m=u/d*l,g=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+m*(E+1),a.y+g*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=z(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Wr(n,zp),L0(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[qi]:()=>e.complete&&e.complete(),[Mh]:()=>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=(m,g)=>{this.fire(m,{edge:g.edge,connection:g,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,hy),this.surface.addClass(u,cy),t.eachEdge((m,g)=>{Wr(this.surface.$_connMap[g.id],zp)});for(let m=1;m<l;m++){let g=t.result.path[m].vertex.id,E=t.result.previous[g],y=!0,x=t.result.path[m].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=L0(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:m===l-1,forwards:y,paused:!0,events:{[ly]:f=>{h.currentlyAnimatingConnection=f.harness},[qi]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((m,g)=>{let E=this.surface.$_connMap[g.id];Or(E,[dy,zp].join(" "))}),this.surface.removeClass(d,hy),this.surface.removeClass(u,cy),n(qi,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(Mh,()=>{n(Mh,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(qi,p),h=new Up(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(Yp,e.listener),h.fire(Yp,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var jp="vjs-shape-library-palette-set",my="vjs-shape-library-palette",Gh="vjs-shape-library-palette-filter",$h="vjs-shape-library-palette-shape",gy="vjs-shape-library-palette-label",SC="vjs-shape-library-palette-set-title",Ey="vjs-shape-library-palette-set-shapes",TC="vjs-shape-library-palette-lasso";var hG=150,cG=100,dG="data-visible",Qi="data-category",Hp="data-shape-id",vC="data-show-all",CC="data-vjs-type",uG="shape-icon",w0="mainTemplate",D0="preparedTemplate",PC="setTemplate",Oa="__vjsALL";function pG(i="Show all"){return{[PC]:`<div class="${jp}" data-category="{{id}}">
|
|
102
|
+
</div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var jv=class extends Ip{constructor(e){super(Object.assign(e,{templateResolver:t=>this.hx(t),getDefaultValue:(t,n)=>{let o=this.Up(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Rn");c(this,"Rs");c(this,"Bp");c(this,"Fp");this.Rn=e.ui.getShapeLibrary(),this.Rs=e.properties,this.Bp=e.propertyMode||"override",this.Fp=e.noPropertiesMessage||"No configurable properties for this shape."}Up(e){if(this.Bp==="override"&&this.Rs!=null)return this.Rs;let t=this.Rn.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Rn.getShapeSet(e.category||this.Rn.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Rn.getShapeSet(e.category||this.Rn.defaultCategoryId);n=o?o.properties:null}return n==null?this.Rs||[]:n}hx(e){if(K(e)||Y(e)){let t=this.Up(e.data);return t?C0(t,this.Fp):null}else return null}};var Yf="drag",Hv="tap",zf="draw";var Xf=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Pn(e)}Pn(r){this.templateRenderer=new Wo({templates:{tp:r}})}setData(r,e){e&&this.Pn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function P0(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=xe),r}var O0="[data-vjs-type]";function sG(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 Ta=class{constructor(r,e){this.ui=r;c(this,"zi");c(this,"source");c(this,"Ln");c(this,"zp");c(this,"Vt");c(this,"Gt");c(this,"Yp");c(this,"kr");c(this,"tc");c(this,"Yi");c(this,"rc");c(this,"nc");c(this,"ic");c(this,"onDrag");c(this,"Ar");c(this,"oc");c(this,"Qt");c(this,"sc");c(this,"Ls");c(this,"lc");c(this,"Xi");c(this,"hc");c(this,"dc");c(this,"ji");c(this,"ws");c(this,"Xp");c(this,"Je");c(this,"ki",[]);c(this,"Hi",[]);c(this,"wn",[]);c(this,"$e");c(this,"M");c(this,"Dn");c(this,"Sr");c(this,"k");c(this,"Nn");c(this,"jp");c(this,"uc");c(this,"kp");c(this,"Ds");c(this,"Hp");c(this,"pc");c(this,"Wp");c(this,"Hr");c(this,"mc");c(this,"Ae");c(this,"gc");c(this,"Ec");c(this,"Wi");this.zi=e.mode||Yf,this.Je=new fe,this.Ar=e.ignoreZoom===!0,this.zp=e.ignoreGrid===!0,this.Hr=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.ic=e.canvasDropFilter||(t=>!0),this.oc=e.elementGenerator,this.tc=e.dataGenerator||P0,this.rc=e.typeGenerator||(t=>t.type),this.nc=e.groupIdentifier||((t,n)=>n.getAttribute(zl)===At),this.Yi=e.dragSizeGenerator,this.Qt=e.enabled!==!1,this.source=e.source,this.Ln=e.selector||O0,this.Ec=new Xf(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.Ec.setData(e.data),this.Vt=e.dragActiveClass||Kt,this.Gt=e.dragHoverClass||qt,this.Yp=e.dragElementClass||VT,this.kr=e.dragHoverCannotDropClass||ko,this.mc=e.dragSize,this.Ds=e.allowDropOnNode===!0,this.Hp=e.ignoreDropOnNode===!0,this.pc=e.allowDropOnGroup!==!1,this.Wp=e.allowDropOnEdge===!0,this.kp=e.allowDropOnCanvas!==!1,this.sc=e.onVertexAdded,this.onDrag=e.onDrag,this.Ls=e.selectAfterAdd===!0,this.Wi=function(t){t.key==="Escape"&&(this.zi===zf?this.Ae!=null&&this.ui.setMode(xr):(this.Zp(),this.Jn()))}.bind(this),this.ui.bind(vn,t=>{t===Vn&&this.Ae==null?this.gc!=null&&this.Jp(this.gc.el):t!==Vn&&this.Ae!=null&&(F(this.Ae.el,Ho),F(this.ui.rootElement,ih),this.gc=this.Ae,this.Ae=null,document.removeEventListener(Mn,this.Wi))}),this.zi===Yf?this.ux():this.zi===zf?this.px(e):this.zi===Hv&&this.mx()}setEnabled(r){this.Qt=r}setData(r,e){this.Ec.setData(r,e)}Jp(r){let e=Zt(r,this.Ln,this.source,!0);if(this.Ae!=null){if(F(this.Ae.el,Ho),this.Ae.el===e){this.ui.setMode(xr);return}}else document.addEventListener(Mn,this.Wi);let t=this.tc(e);this.Nn=this.Yi?this.Yi(this.$e,e):this.mc,this.Ae={el:e,data:t,objectType:e.getAttribute(zl)===At?le.objectType:de.objectType,type:this.rc(t)},L(this.Ae.el,Ho),L(this.ui.rootElement,ih),this.ui.setMode(Vn)}Kp(r,e){this.lc=t=>{if(this.Qt){let n=t.target,o=Zt(n,this.Ln,this.source,!0);if(this.uc=this.Ar?1:this.ui.getEffectiveVisibleZoom(),this.$e=this.tc(o),this.ic&&!this.ic(this.$e))return;if(this.Nn=this.Yi?this.Yi(this.$e,o):this.mc,this.k=this.oc?this.oc(o,t,this.$e):r(o),this.k.removeAttribute("id"),L(this.k,this.Yp),this.k.style.position=je,this.k.style.margin="0",this.jp=this.nc(this.$e,o)?le.objectType:de.objectType,this.Dn=this.jp===le.objectType?new le(this.ui.model.graph,this.$e):new de(this.ui.model.graph,this.$e),Jt(this.k,{x:t.pageX,y:t.pageY}),!this.Ar){let s=-50/this.uc;this.k.style.transform=`scale(${this.uc}) translate(${s}%,${s}%)`}e(o,this.k),document.body.appendChild(this.k),this.ji=!1,this.ws=this.kp===!1?!1:this.Hr!=null?this.Hr(this.Dn,null,!0):!0,this.Xp=this.ui.getVisibleCanvasBounds(),this.dc=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,ct),L(this.ui.rootElement,this.Vt),this.Je.on(document,ie,this.hc),this.ki.length=0,this.wn.length=0,!this.Hp&&this.Ds&&this.ui.$getNodesInViewport().forEach(s=>{let a=s.el.el;this.ki.push({element:s.el.el,cssElement:a,r:s.el,managedElement:s.el,canDrop:this.Hr?this.Hr(this.Dn,s.el.modelObject,!1):this.Ds,vertex:s.el.modelObject,id:s.el.id,objectType:de.objectType,modelObject:s.el.modelObject}),this.Ds&&L(a,this.Vt)}),this.ui.$getGroupsInViewport().forEach(s=>{let a=this.ui.getGroupDefinition(s.el.modelObject);if(a.canDrop==null||a.canDrop(this.Dn)){let l=this.ui.$_getGroupContentAreaInfo(s.el.id),h=this.ui.containerType==="SVG"?s.el.el:l.contentArea;this.Hi.push({element:l.contentArea,canDrop:this.pc===!1?!1:this.Hr?this.Hr(this.Dn,s.el.modelObject,!1):!0,vertex:s.el.modelObject,managedElement:s.el,cssElement:h,id:s.el.id,objectType:le.objectType,modelObject:s.el.modelObject,depth:Sc(s.el.modelObject),r:{x:s.el.x+l.internalOffset.x,y:s.el.y+l.internalOffset.y,width:s.el.width-l.internalOffset.x,height:s.el.height-l.internalOffset.y}}),this.pc&&L(h,this.Vt)}}),this.Hi.sort((s,a)=>a.depth-s.depth),this.Wp&&this.ui.model.getAllEdges().forEach(s=>{let a=this.ui.getRenderedConnection(s.id),l=a.connector.canvas,h=l;this.wn.push({edge:s,connection:a,connector:a.connector,element:l,cssElement:h,id:s.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(l),objectType:Fe.objectType,modelObject:s}),L(h,this.Vt)}),this.Je.on(document,Mn,this.Wi)}}}Zp(){this.Je.off(document,ie,this.hc),this.Je.off(document,W,this.Xi),this.Je.off(document,oe,this.Xi),F(document.body,ct),F(this.ui.rootElement,this.kr),F(this.ui.rootElement,this.Vt),F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,ih),this.Je.off(document,Mn,this.Wi),this.ki.forEach(r=>{F(r.cssElement,this.Vt)}),this.Hi.forEach(r=>{F(r.cssElement,this.Vt)}),this.wn.forEach(r=>{F(r.cssElement,this.Vt)}),this.M!=null&&(F(this.M.cssElement,this.Gt),F(this.M.cssElement,this.kr))}qp(r){this.Xi=e=>{this.Zp(),this.ji&&(this.M!=null?this.M.objectType===de.objectType&&this.M.canDrop?this.Qp(e,this.M.vertex):this.M.objectType===le.objectType&&this.M.canDrop?this.gx(e):this.M.objectType===Fe.objectType&&this.M.canDrop&&this.Ex(e):this.ws&&this.Qp(e,null)),this.Jn()}}em(){this.hc=r=>{Jt(this.k,{x:r.pageX,y:r.pageY}),this.Nn&&Rr(this.k,this.Nn.width,this.Nn.height);let e=this.ui.$getElementPositionInWindow(this.k);if(ke(this.dc,e)){if(!this.zp&&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.k.style.left=`${s.x+e.width/2}px`,this.k.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.k)}this.M!=null&&(F(this.M.cssElement,this.Gt),F(this.M.cssElement,this.kr),this.M=null),this.Sr=sG(this.Xp,this.dc,e);let t=[],n=!1;if(this.ki.forEach(o=>{ke(this.Sr,o.r)&&(t.push(o),n=o.canDrop)}),this.Hi.forEach(o=>{ke(this.Sr,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(We(o.vertex,s.vertex))return-1;if(We(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,this.kr),this.M=t[0],this.M.canDrop&&L(this.M.cssElement,this.Gt)),!n){for(let o=0;o<this.wn.length;o++){let s=this.wn[o],a=s.r,l=s.connector;if(ke(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(LA(l,u).length>0){this.M=s,L(this.M.cssElement,this.Gt);break}}}this.M==null&&(this.ws?L(this.ui.rootElement,this.Gt):L(this.ui.rootElement,this.kr))}this.ji=!0}else F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,this.kr),this.ji=!1;this.onDrag&&this.onDrag(this.$e,this.k,r)}}ux(){this.em(),this.qp(oe),this.Kp(r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,oe,this.Xi)}),this.Je.on(this.source,ue,this.Ln,this.lc)}mx(){this.em(),this.qp(W),this.Kp(r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.Xi),e},(r,e)=>{L(e,"vjs-palette-tap-mode-placeholder"),L(r,Ho),L(this.ui.rootElement,ih)}),this.Je.on(this.source,W,this.Ln,this.lc)}Ex(r){if(this.M.objectType===Fe.objectType){let e=this.M.edge;this.ui.model.transaction(()=>{this.fc(this.$e,this.Sr,this.k,r,this.M.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},co,null),this.ui.model.$_addEdge({source:t,target:a,data:l},co,null)})},St)}}gx(r){this.M.objectType===le.objectType&&(this.Sr.x-=this.M.r.x,this.Sr.y-=this.M.r.y,this.fc(this.$e,this.Sr,this.k,r,this.M.vertex),this.ui.relayoutGroup(this.M.id))}Qp(r,e){this.fc(this.$e,this.Sr,this.k,r,e)}fx(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===Ye?t[n.x]=r[o]:o===Se?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}fc(r,e,t,n,o,s){let a=this.rc(r),l=this.nc(r,t),h=this.fx({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(h.group=o.id);let d=null;if(o!=null){let p=this.ui.viewport.getElementBounds(o.id);p!=null&&(d={vertex:o,pos:{x:p.x,y:p.y},size:{width:p.width,height:p.height}})}let u=this.ui.getModelPositionAttributes();l?this.ui.model.addFactoryGroup(a,h,p=>{let m=p.data[u.x]==null?e.x:p.data[u.x],g=p.data[u.y]==null?e.y:p.data[u.y];this.ui.setPosition(p,m,g),s&&s(p,m,g),this.yc(this.ui.model.getGroup(p.id),d),this.Ls&&this.ui.model.setSelection(this.ui.model.getGroup(p.id))},null,!1):this.ui.model.addFactoryNode(a,h,p=>{let m=p.data[u.x]==null?e.x:p.data[u.x],g=p.data[u.y]==null?e.y:p.data[u.y];this.ui.setPosition(p,m,g),s&&s(p,m,g),this.yc(this.ui.model.getNode(p.id),d),this.Ls&&this.ui.model.setSelection(this.ui.model.getNode(p.id))},null,!1)}yc(r,e){this.sc&&this.sc({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")}})})}})}Jn(){Array.from(this.source.querySelectorAll(`.${Ho}`)).forEach(r=>{F(r,Ho)}),this.Dn=null,this.$e=null,this.ki.length=0,this.Hi.length=0,this.wn.length=0,this.k&&this.k.parentElement.removeChild(this.k),this.k=null,this.Nn=null,this.ji=!1,this.ws=!1}px(r){this.Je.on(this.source,W,this.Ln,n=>{let o=n.target;this.Jp(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.Ae),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.yc(n),this.Ls&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.Ae.objectType,this.Ae.type,this.Ae.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.Ae.data)}),this.ui.addPlugin({type:li.type,options:t})}};var wh=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new bp(t.container,e,t),!0}destroy(){}reset(){}};c(wh,"type","controls"),wh=Nt([wt("controls")],wh);var Mp=class extends Oe{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new Sa(t.container,e,t),!0}destroy(){}reset(){}};Mp=Nt([wt("exportControls")],Mp);var ts=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"Zi",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.Zi=[],this.dragGroupAssigner=t.assignDragGroup,e.bind(Br,n=>{this.Ji(n.el,n.vertex)}),e.bind($r,n=>{this.Ji(n.el,n.vertex)}),e.bind(Sn,n=>{this.yx()}),e.bind(Ms,n=>{this.Ji(n.el,n.modelObject)}),!0}destroy(){}reset(){this.Zi.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.Ji(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))}Ji(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.Zi.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:kv}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}yx(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.Zi.length;e++)this.Ji.apply(this,this.Zi[e])}};c(ts,"type","dragGroups"),ts=Nt([wt("dragGroups")],ts);var Vp="vjs-snapline",Wv="vjs-snapline-vertical",Zv="vjs-snapline-horizontal",jf="vjs-snapline-exact",Jv="vjs-snapline-active",Kv="vjs-snapline-active-exact",rs=class extends Oe{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){return 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(_s,n=>{if(this.enabled&&n.dragGroup.length>0){let o=n.dragGroup[0],s=this.surface.viewport.getElements();this.focus=o.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let a in s)if(a!==this.focus.id){let l=s[a].t,h=l.width,d=l.height;this.showEdges&&(this.horizontalRanges.push({position:Ye,start:l.x-this.tolerance,end:l.x+this.tolerance,objId:a,line:this.xc(l.x),el:s[a].el,orientation:"v"}),this.horizontalRanges.push({position:ut,start:l.x+h-this.tolerance,end:l.x+h+this.tolerance,objId:a,line:this.xc(l.x+h),el:s[a].el,orientation:"v"}),this.verticalRanges.push({position:Se,start:l.y-this.tolerance,end:l.y+this.tolerance,objId:a,line:this.bc(l.y),el:s[a].el,orientation:"h"}),this.verticalRanges.push({position:st,start:l.y+l.height-this.tolerance,end:l.y+l.height+this.tolerance,objId:a,line:this.bc(l.y+d),el:s[a].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:Rt,start:l.x+h/2-this.tolerance,end:l.x+h/2+this.tolerance,objId:a,line:this.xc(l.x+h/2),el:s[a].el,orientation:"v"}),this.verticalRanges.push({position:Rt,start:l.y+d/2-this.tolerance,end:l.y+d/2+this.tolerance,objId:a,line:this.bc(l.y+d/2),el:s[a].el,orientation:"h"}))}}}),this.surface.bind(nr,n=>{if(this.enabled&&n.dragGroup.length>0){this.Ns();let o=n.dragGroup[0],s=o.pos.x,a=s+this.focus.width/2,l=s+this.focus.width,h=o.pos.y,d=h+this.focus.height/2,u=h+this.focus.height,p={};for(let m=0;m<this.horizontalRanges.length;m++){let g=this.horizontalRanges[m];p[g.objId]||(g.start<=a&&g.end>=a?(p[g.objId]=!0,this.In(g,a)):g.start<=s&&g.end>=s?(p[g.objId]=!0,this.In(g,s)):g.start<=l&&g.end>=l&&(p[g.objId]=!0,this.In(g,l)))}for(let m=0;m<this.verticalRanges.length;m++){let g=this.verticalRanges[m];p[g.objId]||(g.start<=d&&g.end>=d?(p[g.objId]=!0,this.In(g,d)):g.start<=h&&g.end>=h?(p[g.objId]=!0,this.In(g,h)):g.start<=u&&g.end>=u&&(p[g.objId]=!0,this.In(g,u)))}}}),this.surface.bind(Lt,n=>{this.enabled&&(this.Ns(),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)}),!0}In(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(`${jf}`):e.line.classList.remove(`${jf}`);let s={x:e.orientation===vx?-5e4:n,y:e.orientation===Pc?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${Jv}`),o&&L(e.el,`${Kv}`)}Ns(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${jf}`),this.surface.unfixElement(e.line),F(e.el,`${Jv}`),F(e.el,`${Kv}`)})}bc(e){if(this.surface.containerType==="SVG")return Kr(Wt,Z,{y:`${e}px`},`${Vp} ${Zv}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(He);return t.className=`${Vp} ${Zv}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}xc(e){if(this.surface.containerType==="SVG")return Kr(Wt,Z,{x:`${e}px`},`${Vp} ${Wv}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(He);return t.className=`${Vp} ${Wv}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.Ns()}reset(){this.Ns()}};c(rs,"type","snaplines"),rs=Nt([wt("snaplines")],rs);var Dh=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Ta(e,t),!0}reset(){}};c(Dh,"type","palette"),Dh=Nt([wt("palette")],Dh);var ns=class extends Oe{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"Ki",[]);c(this,"tm",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"rm",!1);c(this,"Ac");c(this,"nm")}initialise(e,t){return this.eventManager=new fe,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.Ac=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.tm),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,sf),this.currentPanButton=null,this.eventManager.off(document,oe,this.Ac)},this.nm=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Se,{left:"0px",top:"0px"},0,-1,"↑"),this.makePanButton(st,{left:"0px",bottom:"0px"},0,1,"↓"),this.makePanButton(Ye,{left:"0px",top:"0px"},-1,0,"←"),this.makePanButton(ut,{right:"0px",top:"0px"},1,0,"→"),!0}curryPanButton(e,t){return n=>{this.rm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.rm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,sf),this.eventManager.on(document,oe,this.Ac),this.tm=window.setTimeout(()=>{this.eventManager.on(document,oe,this.nm),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(He);return a.innerHTML=s||"",a.style.position=je,Object.assign(a.style,t),a.className=`${of} ${of}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Ue,this.curryPanButton(n,o)),this.eventManager.on(a,ue,this.startPanTimer(n,o,a)),this.Ki.push(a),a}destroy(){for(let e=0;e<this.Ki.length;e++)this.Ki[e].parentNode.removeChild(this.Ki[e]);this.Ki.length=0}reset(){}};c(ns,"type","panButtons"),or.register(ns.type,ns);var qv="vjs-vertex-drawing-lasso",Hf="vjs-group-candidate-child";var li=class extends Oe{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,"im");c(this,"Sc");c(this,"Mn");c(this,"Vn");c(this,"Is");c(this,"Ms");c(this,"$onVertexAdded");c(this,"Tc");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}xx(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Vn=o.objectType,this.Is=o.type,this.Ms=o.data||{}}else this.nodeType!=null?(this.Vn=de.objectType,this.Is=this.nodeType,this.Ms={}):(this.Vn=le.objectType,this.Is=this.groupType||xe,this.Ms={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.Mn=n.obj:this.Mn=null}initialise(e,t){this.surface=e,this.Tc=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.Sc=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.im=this.Sc||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=`${qv} ${t.lassoClass||""}`;e.bind(vn,s=>{this.lasso.enabled=s===Vn}),this.vertexSelection=new mr(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=se(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.xx(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Vn===le.objectType){this.vertexSelection.clear(),this.om();let m=[],g,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(g=0;g<y;g++)m.push(E[g].v),x[E[g].id]=!0,this.vertexSelection.append(E[g].v),L(E[g].el,Hf),this.selectedElements.push(E[g].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.om(),this.autoExit&&e.mode!==Ko&&e.setMode(xr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.sm(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!==Ko&&e.setMode(xr),this.im){let l=this.Vn===le.objectType?this.defaultGroupSize:this.defaultNodeSize;this.sm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new ga(o),this.Sc&&this.lasso.setEnabled(!1),!0}sm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.Tc.width||t.height>=this.Tc.height)&&(this.Vn===le.objectType?this.bx(this.surface,n,t):this.Ax(this.surface,n,t))}am(e,t){return Object.assign(this.Ms,{id:V(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Is})}Sx(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>We(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>We(o,s))==null&&n.groups.push(o)}),n}bx(e,t,n){let o;e.model.transaction(()=>{let s=this.am(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.Sx();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.Mn!=null&&e.model.addToGroup(o,this.Mn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Ax(e,t,n){let o;e.setSuspendRendering(!0);let s=this.am(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.Mn!=null&&e.model.addToGroup(o,this.Mn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}om(){this.selectedElements.forEach(e=>F(e,Hf)),this.selectedElements.length=0}reset(){}activated(){this.lasso.enabled=!0}deactivated(){this.lasso.enabled=!1}};c(li,"type","vertexDrawing"),or.register(li.type,li);var Gp=12,Qv=40,eC=16,tC=6,rC=30,nC=30,iC=5,oC="borders",Nh="handles",sC="vjs-resize-skeleton",aC="vjs-resize-skeleton-borders",lC="vjs-resize-skeleton-borders-visible",hC="vjs-resize-frame",yt="vjs-resize-handle",kf="vjs-resize-handle-active",Wf="vjs-resize-handle-tl",Zf="vjs-resize-handle-bl",Jf="vjs-resize-handle-tr",Kf="vjs-resize-handle-br",qf="vjs-resize-handle-t",Qf="vjs-resize-handle-b",ey="vjs-resize-handle-l",ty="vjs-resize-handle-r",is="vjs-resize-border",cC="vjs-resize-border-b",dC="vjs-resize-border-t",uC="vjs-resize-border-l",pC="vjs-resize-border-r",Ih="vjs-rotate-handle",$p="vjs-rotate-leader",ry="data-vjs-x-resize",ny="data-vjs-y-resize",iy="data-vjs-resizable",oy="data-vjs-rotatable",va="data-dir";function Ie(i,r,e,t){let n=$(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function sy(i,r){Ce(i,r.ro),r.r!=null&&jo(i,r.r)}var os=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function mC(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=Ie(Z,[yt,Wf],n,{"data-dir":"tl",[ee]:e.id,width:i,height:i,x:l-o,y:h-o,transform:os(i,t)}),p.tr=Ie(Z,[yt,Jf],n,{"data-dir":"tr",[ee]:e.id,width:i,height:i,x:d+o,y:h-o,transform:os(i,t)}),p.bl=Ie(Z,[yt,Zf],n,{"data-dir":"bl",[ee]:e.id,width:i,height:i,x:l-o,y:u+o,transform:os(i,t)}),p.br=Ie(Z,[yt,Kf],n,{"data-dir":"br",[ee]:e.id,width:i,height:i,x:d+o,y:u+o,transform:os(i,t)})),a&&(p.t=Ie(Z,[yt,qf],n,{"data-dir":"t",[ee]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:os(i,t)}),p.b=Ie(Z,[yt,Qf],n,{"data-dir":"b",[ee]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:os(i,t)})),s&&(p.l=Ie(Z,[yt,ey],n,{"data-dir":"l",[ee]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:os(i,t)}),p.r=Ie(Z,[yt,ty],n,{"data-dir":"r",[ee]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:os(i,t)})),p}function gC(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=Ie(ze,[yt,Wf],n,{"data-dir":"tl",[ee]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ie(ze,[yt,Jf],n,{"data-dir":"tr",[ee]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ie(ze,[yt,Zf],n,{"data-dir":"bl",[ee]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ie(ze,[yt,Kf],n,{"data-dir":"br",[ee]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ie(ze,[yt,qf],n,{"data-dir":"t",[ee]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ie(ze,[yt,Qf],n,{"data-dir":"b",[ee]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ie(ze,[yt,ey],n,{"data-dir":"l",[ee]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ie(ze,[yt,ty],n,{"data-dir":"r",[ee]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function _0(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=se({x:t,y:n},i.grid);t=h.x,n=h.y;let d=se({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=se({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=se({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=se({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=se({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=se({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=se({x:t,y:n},i.grid).y,s=se({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=se({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=se({x:t,y:n},i.grid).x,o=se({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=se({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function R0(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=se({x:t,y:n},i.grid);t=l.x,n=l.y;let h=se({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=se({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=se({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=se({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=se({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=se({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 EC(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 fC(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 ss=class extends Oe{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,"Wr");c(this,"Tr");c(this,"qi");c(this,"vc");c(this,"Cc");c(this,"lm");c(this,"Oc");c(this,"skeletons");c(this,"at");c(this,"vr");c(this,"Vs");c(this,"Qi");c(this,"Gs");c(this,"te");c(this,"Cr");c(this,"downAt");c(this,"Pc");c(this,"handler");c(this,"toolkitDragObject");c(this,"$s");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"_c");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"cm");c(this,"hm");c(this,"Rc");c(this,"Et",!1);c(this,"Lc",!1);c(this,"Bs",!1);c(this,"$handleOffset");c(this,"wc");c(this,"Dc");c(this,"ft");c(this,"Nc");c(this,"Zr");c(this,"Se");c(this,"lt");c(this,"um");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"pm");c(this,"mm")}dm(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.Et=e,this.dm(e)}set $rotating(e){this.Lc=e,this.dm(e)}get $busy(){return this.Et||this.Lc}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||iC,this.wc=t.modelUpdater,this.Dc=t.handlerFactory,this.pm=_0(this),this.mm=R0(this),e.$addTransferrableVertexAttributes([iy,ny,ry,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:rC,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:nC,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.hm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.ft=t.handleSize||Gp,this.Nc=t.handleShape||"circle",this.Zr=t.rotateLeaderLength||Qv,this.Se=t.rotateHandleSize||eC,this.lt=t.borderHandleSize||tC,this.resizeMethod=t.resizeMethod||Nh,this.bordersVisible=this.resizeMethod===oC&&t.bordersVisible!==!1,this.cm=t.rotatable===!0,this.Rc=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[yt,Ih,$p,is].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.um=t.payloadGenerator||((a,l)=>l),this.instance.bind(Cr,()=>{this.reset()}),this.instance.bind(ur,a=>{this.onDemand!==!0&&this.Ic(a.obj)}),this.instance.bind(pr,a=>{this.onDemand!==!0&&this.Gn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(nr,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Ve,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(Re,a=>{n(a.vertex)}),this.instance.bind(Le,a=>{this.Gn(a.node)}),this.instance.bind(Me,a=>{this.Gn(a.group),a.group.getMembers().forEach(l=>this.Gn(l))});let o=a=>{this.Et||this.instance.openTransaction(),this.$moving=!0,ae(a);let l=this.surface.mapEventLocation(a);this.Lc?this.Tx(l):this.vx(l)},s=a=>{if(this.$busy){if(ae(a),this.Bs&&this.at!=null){let l=new Set;if(this.te!=null){let h={},d={},u={},{movedElements:p,resizedGroups:m}=this.te.Ul();Object.assign(u,m);for(let g in p)h[g]=p[g].current,d[g]=p[g].current;for(let g in h){let E={[this.surface.$modelLeftAttribute]:h[g].x,[this.surface.$modelTopAttribute]:h[g].y};u[g]!=null&&(E[this.surface.$modelWidthAttribute]=u[g].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[g].newGroupSize.height),this.surface.model.$_updateVertex(g,E,$s,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let g in u){let E=u[g].newGroupSize;this.surface.viewport.updateElement(g,null,null,E.width,E.height,null,null,!1)}}else l.add(this.at);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.$s&&F(this.$s,kf),this.surface.$removeClassFromElement(document.body,ct),this.surface.off(document,ie,o),this.surface.off(document,oe,s),this.te&&this.te.cleanup(),this.te=null,this.at=null,this.Vs=!1,this.Qi=null,this.Gs=null,this.vr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.Bs=!1}};return this.surface.on(this.surface.getContainer(),ue,X(yt),a=>{this.gm(a,this.pm,o,s)}),this.surface.on(this.surface.getContainer(),ue,X(is),a=>{this.gm(a,this.mm,o,s)}),this.surface.on(this.surface.getContainer(),ue,X(Ih),a=>{ae(a),this.Tr=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(ee)),this.toolkitDragObject!=null&&(this.Cr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Tr=this.Cr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this._c={x:this.Cr.c.x,y:this.Cr.c.y},this.Em(a),this.surface.$addClassToElement(document.body,ct),this.surface.on(document,ie,o),this.surface.on(document,oe,s))}),!1}Em(e){this.toolkitDragObject!=null&&(this.at=this.toolkitDragObject.group,this.Vs=!1,this.at!=null&&(this.Qi=this.surface.getGroupDefinition(this.at),this.Gs=this.surface.$_getGroupContentAreaInfo(this.at.id),this.vr=this.surface.viewport.getGroupElement(this.at.id),this.Vs=this.Qi.elastic===!0&&e.shiftKey!==!0,this.Vs&&(this.te=new ya(this.surface,this.toolkitDragObject,this.at,this.Qi))))}gm(e,t,n,o){ae(e);let s=e.target,a=s.getAttribute(ee);this.Wr=s.getAttribute(va),this.$s=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.Cr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Em(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.Cx(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.Tr=this.fm(),this.qi={x:l.x,y:l.y},this.Oc={width:l.width,height:l.height},this.vc=this.$x2-this.$x1,this.Cc=this.$y2-this.$y1,this.lm={x:this.$x1+this.vc/2,y:this.$y1+this.Cc/2},this.Pc=fC(this.downAt.x,this.downAt.y,this.Tr,{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.hm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),m=p.xmax+u.internalOffset.x,g=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,m),this.currentMinimumHeight=Math.max(this.minimumHeight,g)}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=se({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.Wr]),this.Dc!=null){let h=this.Dc(this.surface,this.toolkitDragObject,this.Wr,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.$s,kf),this.surface.$addClassToElement(document.body,ct),this.surface.on(document,ie,n),this.surface.on(document,oe,o)}fm(){if(this.Cr==null)return 0;{let t=(this.Cr.r==null?0:this.Cr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Ox(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.fm();return t?EC(e.x,e.y,o,n):fC(e.x,e.y,o,n)}Cx(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.Px();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}Fs(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}Gn(e){this.Fs(e.id)}Ic(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.Gn(e),Y(t.modelObject)&&t.collapsed||En(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(ry)!==at&&this.resizeX!==!1,s=t.el.getAttribute(ny)!==at&&this.resizeY!==!1;if(t.el.getAttribute(iy)===at||!o&&!s)return;this.Mc(t,e,o,s)}}Mc(e,t,n,o){let s=e,a=this.resizeMethod==Nh?[sC]:[aC];this.bordersVisible&&a.push(lC);let l=Ie(q,a,null,{transform:`translate(${e.x}, ${e.y})`,[ee]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ie(Z,[hC],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)===at?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.cm,m=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===Nh){if(p){m.rl=Ie(te,[$p],l,{[ee]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.Zr+this.$handleOffset}`,"stroke-width":2}),m.rh=$(q,{transform:`translate(${s.width/2-this.Se/2}, ${-this.Zr-this.$handleOffset-this.Se/2})`}),l.appendChild(m.rh),Ie(ze,[Ih],m.rh,{[ee]:t.id,cx:this.Se/2,cy:this.Se/2,r:this.Se/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let g=$(Je,{x:`${this.Se/2}`,y:`${this.Se/2}`,"font-size":Math.floor(this.Se*.75)});g.innerHTML="\u21BA",m.rh.appendChild(g)}u&&(m.handles=this.Nc==="rectangle"?mC(this.ft,s,t,d,l,this.$handleOffset,n,o):gC(this.ft,s,t,d,l,this.$handleOffset,n,o))}else p&&(m.rl=Ie(te,[$p],l,{[ee]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.Zr+this.$handleOffset}`,"stroke-width":2}),m.rh=$(q,{transform:`translate(${s.width/2-this.Se/2}, ${-this.Zr-this.$handleOffset-this.Se/2})`}),l.appendChild(m.rh),Ie(ze,[Ih],m.rh,{[ee]:t.id,cx:this.Se/2,cy:this.Se/2,r:this.Se/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),m.borders={t:null,b:null,l:null,r:null},u&&(o&&(m.borders.t=Ie(Z,[is,dC],l,{[va]:"t",[ee]:t.id,width:s.width,height:this.lt,x:0,y:-this.lt/2}),m.borders.b=Ie(Z,[is,cC],l,{[va]:"b",[ee]:t.id,width:s.width,height:this.lt,x:0,y:s.height-this.lt/2})),n&&(m.borders.r=Ie(Z,[is,pC],l,{[va]:"r",[ee]:t.id,width:this.lt,height:s.height,x:s.width-this.lt/2,y:0}),m.borders.l=Ie(Z,[is,uC],l,{[va]:"l",[ee]:t.id,width:this.lt,height:s.height,x:-(this.lt/2),y:0})));return sy(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return sy(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Se/2}, ${-this.Zr-this.$handleOffset-this.Se/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.Zr+this.$handleOffset}`),!0}return!1}_x(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}Tx(e){let t=e.x-this._c.x,n=e.y-this._c.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Rc!=null){let s=360/this.Rc;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},Vs,!1),this.Tr=o}vx(e){let t,n,o=this.Ox(e);if(t=o.x-this.Pc.x,n=o.y-this.Pc.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.Wr==="l"||this.Wr==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.Wr==="t"||this.Wr==="b")&&(t=0),this.Bs||t!=0||n!=0){this.Bs=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.at!=null&&(this.te!=null?this.te.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.Qi.constrain&&(s+l>this.vr.width&&(l=this.vr.width-s),a+h>this.vr.height&&(h=this.vr.height-a)))),this.ym(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.vc,y:this.$y1+this.handler.anchor[1]*this.Cc},p=EC(u.x,u.y,this.Tr,this.lm),m={x:s+l/2,y:a+h/2},g={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=EC(g.x,g.y,this.Tr,m),y=E.x-p.x,x=E.y-p.y,f={x:m.x-y,y:m.y-x},b=fC(p.x,p.y,this.Tr,f);this.qi={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Oc={width:l,height:h};let A=this._x(this.qi.x,this.qi.y,l,h),T=this.um(this.toolkitDragObject,A)||{},S=Object.assign(T,A),R;if(this.wc!=null&&(R=this.wc(this.toolkitDragObject,this.qi,this.Oc)),this.instance.$_updateVertex(this.toolkitDragObject,S,fl,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],fl,!1);if(R!=null)for(let v in R)this.instance.$_updateVertex(v,R[v],fl,!1)}}Px(){return this.at==null?{x:0,y:0}:{x:this.vr.x+this.Gs.internalOffset.x,y:this.vr.y+this.Gs.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Fs(e.id),setTimeout(()=>{this.Ic(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==fl&&this.skeletons[e.id]!=null&&(this.Fs(e.id),setTimeout(()=>{this.Ic(e.modelObject)}))}ym(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(ce(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===Nh?this.Nc==="rectangle"?(o.handles.tr&&ce(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&ce(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&ce(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&ce(o.handles.t,{x:e/2}),o.handles.b&&ce(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&ce(o.handles.l,{y:t/2}),o.handles.r&&ce(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&ce(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&ce(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&ce(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&ce(o.handles.t,{cx:e/2}),o.handles.b&&ce(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&ce(o.handles.l,{cy:t/2}),o.handles.r&&ce(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&ce(o.borders.t,{width:e}),o.borders.b&&ce(o.borders.b,{width:e,y:t-this.lt/2}),o.borders.r&&ce(o.borders.r,{height:t,x:e-this.lt/2}),o.borders.l&&ce(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.ym(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.Gn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{We(n.mel.modelObject,e.modelObject)&&this.Fs(n.mel.id)})}};c(ss,"type","resizingTools"),ss=Nt([wt("resizingTools")],ss);var yC=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(yC||{}),Fp="state",Bp=class extends It{constructor(e,t){super();this.components=e;this.params=t;c(this,"pathExists");c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===At?"paused":"playing"}setState(e){this.state=e,this.fire(Fp,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 Mh="startOverlayAnimation",qi="endOverlayAnimation",ay="startNodeTraversal",xC="endNodeTraversal",ly="vjs-animate-source",hy="vjs-animate-target",Fn="vjs-animate-node-traversing",Vh="vjs-animate-edge-traversing",aG="vjs-animate-node-traversable",Up="vjs-animate-edge-traversable",lG="vjs-animate-node-traversed",cy="vjs-animate-edge-traversed";var bC="INITIALIZED",dy="TRAVERSING_START",AC="TRAVERSING_EDGE",uy="TRAVERSING_END",Ca="CANCELLED",Pa="FINISHED";function L0(i,r,e,t){let n=new It,o=r.connector.totalLength;t=t||{};let s=V(),a=t.events||{};for(let G in a)n.bind(G,a[G]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,m=o/p*1e3,g=m/d,E=1/g*(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,R=h?r.targetElement:r.sourceElement,v,O=t.paused===!0,P=!1,I=!1,C=bC;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 _=G=>{I=!1,Ui(r,s),window.clearInterval(b),y?G?(C=Ca,i.surface.removeClass(S,Fn),i.surface.removeClass(R,Fn),Or(r,Vh)):(C=uy,i.surface.addClass(R,Fn),window.setTimeout(function(){M()},u)):(i.surface.removeClass(S,Fn),i.surface.removeClass(R,Fn),Or(r,Vh),G?C=Ca:(C=Pa,Wr(r,cy),n.fire(qi,{connection:r,harness:l})))},w=()=>{f+=E,T()?_(!1):(A.location=f,r.instance.$revalidateElementById(r.sourceId))},B=()=>{C=AC,n.fire(Mh,{connection:r,harness:l}),A=Gl(r,v),b=window.setInterval(w,d)},D=()=>{!I&&C!==Pa&&C!==Ca&&(i.surface.removeClass(S,Fn),n.fire(xC,{connection:r,element:S,harness:l}),B())},M=()=>{!I&&C!==Pa&&C!==Ca&&(C=Pa,i.surface.removeClass(S,Fn),i.surface.removeClass(R,Fn),Or(r,Vh),n.fire(qi,{connection:r,harness:l}))},N=()=>{P=!0,I=!1,n.fire(ay,{connection:r,element:S,harness:l}),i.surface.addClass(S,Fn),Wr(r,Vh),C=dy,window.setTimeout(()=>{D()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===dy?D():C===uy?M():b=window.setInterval(w,d)):N()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==Pa&&C!==Ca&&(window.clearInterval(b),_(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(qi,N):O||N(),l}var Yp=class extends It{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=rd(o.start,()=>{this.surface.model.openTransaction(St)}),o.step=rd(o.step,()=>{}),o.complete=rd(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,m=u/d*l,g=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+m*(E+1),a.y+g*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=z(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Wr(n,Up),L0(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[qi]:()=>e.complete&&e.complete(),[Mh]:()=>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=(m,g)=>{this.fire(m,{edge:g.edge,connection:g,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,ly),this.surface.addClass(u,hy),t.eachEdge((m,g)=>{Wr(this.surface.$_connMap[g.id],Up)});for(let m=1;m<l;m++){let g=t.result.path[m].vertex.id,E=t.result.previous[g],y=!0,x=t.result.path[m].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=L0(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:m===l-1,forwards:y,paused:!0,events:{[ay]:f=>{h.currentlyAnimatingConnection=f.harness},[qi]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((m,g)=>{let E=this.surface.$_connMap[g.id];Or(E,[cy,Up].join(" "))}),this.surface.removeClass(d,ly),this.surface.removeClass(u,hy),n(qi,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(Mh,()=>{n(Mh,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(qi,p),h=new Bp(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(Fp,e.listener),h.fire(Fp,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var zp="vjs-shape-library-palette-set",py="vjs-shape-library-palette",Gh="vjs-shape-library-palette-filter",$h="vjs-shape-library-palette-shape",my="vjs-shape-library-palette-label",SC="vjs-shape-library-palette-set-title",gy="vjs-shape-library-palette-set-shapes",TC="vjs-shape-library-palette-lasso";var hG=150,cG=100,dG="data-visible",Qi="data-category",Xp="data-shape-id",vC="data-show-all",CC="data-vjs-type",uG="shape-icon",w0="mainTemplate",D0="preparedTemplate",PC="setTemplate",Oa="__vjsALL";function pG(i="Show all"){return{[PC]:`<div class="${zp}" data-category="{{id}}">
|
|
103
103
|
<div class="${SC}" data-category="{{id}}">{{name}}</div>
|
|
104
|
-
<div class="${
|
|
104
|
+
<div class="${gy}" data-category="{{id}}">
|
|
105
105
|
<r-each in="shapes"><shape-icon/></r-each>
|
|
106
106
|
</div>
|
|
107
107
|
<r-if test="children.length > 0">
|
|
@@ -115,11 +115,11 @@ var uc=Object.defineProperty,uD=Object.defineProperties,gO=Object.getOwnProperty
|
|
|
115
115
|
<r-tmpl id="${PC}"/>
|
|
116
116
|
</r-each>
|
|
117
117
|
</r-if>
|
|
118
|
-
</div>`,[D0]:`<div class="${
|
|
119
|
-
<div class="${
|
|
118
|
+
</div>`,[D0]:`<div class="${py}">
|
|
119
|
+
<div class="${gy}">
|
|
120
120
|
<r-each in="shapes"><shape-icon/></r-each>
|
|
121
121
|
</div>
|
|
122
|
-
</div>`,[w0]:`<div class="${
|
|
122
|
+
</div>`,[w0]:`<div class="${py}" data-show-all="{{showAll}}">
|
|
123
123
|
<r-if test="sets.length > 1">
|
|
124
124
|
<select class="${Gh}" data-category="${Wi}" data-show-all="{{showAll}}">
|
|
125
125
|
<option value="${Oa}">${i}</option>
|
|
@@ -131,13 +131,13 @@ var uc=Object.defineProperty,uD=Object.defineProperties,gO=Object.getOwnProperty
|
|
|
131
131
|
<r-each in="sets">
|
|
132
132
|
<r-tmpl id="${PC}"/>
|
|
133
133
|
</r-each>
|
|
134
|
-
</div>`}}var mG=1.25,kp=class{constructor(r,e){this.ui=r;c(this,"$n");c(this,"Rx");c(this,"Vc");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||mG,o=e.iconSize||{width:hG,height:cG};this.onVertexAdded=e.onVertexAdded,this.Vc=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||Hu.FILL,a=e.outline||Hu.STROKE,l=e.outlineWidth||Hu.STROKE_WIDTH;this.$n=yr({templates:pG(e.showAllMessage)});let h=`<div class="${$h}" 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.$n.registerTag(uG,{template:h,rendered:(p,m,g,E)=>{var T,S,R;let y=m.type,x=null,f=E.getAttribute(Qi)||m.category;f!=null&&p.setAttribute(Qi,f);let b=m.shapeId;b!=null&&(p.setAttribute(Hp,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",m.label||""),m.objectType===le.objectType&&p.setAttribute(zl,At);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){let v=A.previewData||{},O=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((R=A.initialSize)==null?void 0:R.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${O} ${P}`),A.icon){let C=this.$n.parse(A.icon),_=this.$n.render(C,v).fragment;I.appendChild(_)}else{let C=fO(Ei({},v),{type:y,category:f,width:O,height:P}),_=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let D=Math.min(O,P),M=(O-D)/2,N=(P-D)/2;_.setAttribute("transform",`translate(${M}, ${N})`)}I.appendChild(_);let B={fill:s,stroke:a,"stroke-width":n};if(x!=null){let D=x.properties||{};for(let M in D){let N=M===uh?"stroke":M===ph?"stroke-width":M;I.setAttribute(N,D[M]),delete B[N]}}for(let D in B)I.setAttribute(D,B[D])}}},updated:(p,m,g)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(m=>Object.assign({},this.$shapeLibrary.getShapeDefinition(m.type,m.category),{shapeId:m.shapeId,properties:m.properties,category:m.category,label:m.label,size:m.size}));this.$preparedShapes=p,d=this.$n.template(D0,{shapes:p})}else d=this.$n.template(w0,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.Rx=new Ta(r,{source:this.palette,selector:X($h),dragSize:e.dragSize,dragSizeGenerator:(p,m)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:TC,elementGenerator:(p,m)=>{let g=p.cloneNode(!0),E=g.querySelector(X(gy));return E&&E.parentNode.removeChild(E),g},vertexPreviewGenerator:(p,m,g,E,y)=>{let x=Object.assign(g,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:g.outlineWidth||1}),f=$(ve,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(hh);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,m,g,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:g.width,[r.$modelHeightAttribute]:g.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${g.width} ${g.height}`)},dataGenerator:p=>{var C,_,w,B,D;let m=this.Vc?this.Vc(p)||{}:{},g=p.getAttribute(CC),E=p.getAttribute(Qi),y=p.getAttribute(Hp),x=this.$shapeLibrary.getShapeDefinition(g,E),f=m.fill,b=m.outline,A=m.outlineWidth,T=m.color,S=(C=this.$preparedShapes)==null?void 0:C.find(M=>M.shapeId===y),R=(S==null?void 0:S.properties)||{},v=(_=S==null?void 0:S.size)==null?void 0:_.width,O=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||m.width||((B=x.initialSize)==null?void 0:B.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=O||m.height||((D=x.initialSize)==null?void 0:D.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(m,{type:g,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},R),f!=null&&(m.fill=f),b!=null&&(m.outline=b),A!=null&&(m.outlineWidth=A),T!=null&&(m.color=T),x.payload&&Object.assign(m,x.payload),m},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(X(Gh))).forEach(p=>{p.addEventListener("change",m=>{let g=p.options[p.selectedIndex].value,E=p.getAttribute(Qi);p.setAttribute(vC,`${g===Oa}`),this.xm(g,E)})}),e.inspector!==!1){r.model.bind(ur,g=>{m()}),r.model.bind(pr,g=>{m()});let p=()=>{Array.from(this.palette.querySelectorAll(X(ju))).forEach(E=>{F(E,ju)})},m=()=>{p();let g=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>g.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),g.size===1){let[E,y]=Array.from(g)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${Qi}='${y}'][${CC}='${E}']`);f!=null&&L(f,ju)}}};r.model.bind(Cr,()=>{p()}),r.on(this.palette,W,X($h),g=>{let E=g.target.closest(X($h)),y=E.getAttribute(Qi),x=E.getAttribute(CC),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||de.objectType,A=this.bm();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([Ve,Re],g=>{this.bm().containsVertex(g.vertex.id)&&m()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}bm(){return this.ui.model.getSelection().filter(r=>K(r)||Y(r))}Lx(r){return this.palette.querySelector(`${X(Gh)}[${Qi}='${r}']`)}xm(r,e){let t=e==Wi?this.palette:this.palette.querySelector(`${X(jp)}[${Qi}='${e}']`);t.setAttribute(vC,`${r==Oa}`),Array.from(t.querySelectorAll(X(jp))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(dG,`${r===Oa||r===o.getAttribute(Qi)}`)})}Am(r,e){this.xm(r,e);let t=this.Lx(e);t!=null&&(t.value=r,t.setAttribute(vC,`${r===Oa}`))}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!==Wi;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.Am(o[0],o[1])})}}else this.Am(Oa,Wi)}};var OC="vjs-diagram-node",_C="vjs-diagram-group",RC=100,LC=80,wC=[JT];var Un=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,{[Tf]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[uh]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[ph]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[vf]:r})}get label(){return this.vertex.data[ki]}get fill(){return this.vertex.data[Tf]||mh}get outline(){return this.vertex.data[uh]||Jo}get outlineWidth(){return this.vertex.data[ph]||gh}get color(){return this.vertex.data[vf]||ZT}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 ci=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return 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 Un?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof Un?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 DC(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Ea.type}}var N0=15,fy="vjs-cell-tool",NC="vjs-clone-cell",IC="vjs-delete-cell",I0="vjs-link-cell",ls=class extends as{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||N0,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.ft/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,X(NC),n=>{let s=n.target.closest(`[${ee}]`).getAttribute(ee);s!=null&&(ae(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,X(IC),n=>{let o=n.target.closest(`[${ee}]`),s=o.getAttribute(ee);if(s!=null){ae(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}Mc(e,t,n,o){let s=super.Mc(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=$(q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),qu(Zu,this.$buttonSize,this.$buttonSize,[NC,fy],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=$(q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),qu(Ju,this.$buttonSize,this.$buttonSize,[IC,fy],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=$(q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),qu(Wu,this.$buttonSize,this.$buttonSize,[I0,fy],{title:"Click and drag to link","data-vjs-source":!0,[ee]: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(si,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(si,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(si,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(ls,"type","diagramTools"),ls=Nt([wt("diagramTools")],ls);var Bh=class extends kp{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(Hp);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function MC(i){return i.startEditingPath!==void 0}function M0(i){return i.isEmpty()?0:i.head().zIndex}function gG(i){return i.isEmpty()?0:i.peek().zIndex}var Wp=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,"G");var a,l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R,v,O,P,I,C,_,w,B,D,M,N,G,J,ye,j,ge,Ge,Xe,Bt,ar,er,Dr,ao,Ha,ka,Wa,Za,Ja,Om,_m,cc,Rm,dc;t=t||{},this.G=t.mediator,this.$_cellList=new Es((re,$e)=>re.zIndex<$e.zIndex?-1:re.zIndex>$e.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||ki,this.$shapeLibrary=new ia(t.shapes||wC,{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 Su(this.model,{fill:t.defaultFillColor||mh,outline:t.defaultOutlineColor||Jo,outlineWidth:t.defaultOutlineWidth||gh,color:t.defaultColor||Jo}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||RC,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||LC,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:ls.type,options:{rotationStops:(m=t.cells)==null?void 0:m.rotationStops,canResizeFilter:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.resizable)!==!1&&this.wx(re,$e)!==!1},canRotateFilter:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.rotatable)!==!1&&this.Dx(re,$e)!==!1},canShowLinkButton:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.linkable)!==!1&&this.Nx(re,$e)!==!1},canDelete:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.deletable)!==!1&&this.Ix(re,$e)!==!1},canClone:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.clonable)!==!1&&this.Mx(re,$e)!==!1},handleShape:(E=(g=t.cells)==null?void 0:g.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=(R=t.cells)==null?void 0:R.resize)==null?void 0:v.method,bordersVisible:(P=(O=t.cells)==null?void 0:O.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(_=t.cells)==null?void 0:_.resize)==null?void 0:w.resizeX,resizeY:(D=(B=t.cells)==null?void 0:B.resize)==null?void 0:D.resizeY}}),t.snapLines!=null){let re=t.snapLines===!0?{}:t.snapLines;n.push({type:ns.type,options:re})}if(t.panButtons!=null){let re=t.panButtons===!0?{}:t.panButtons;n.push({type:is.type,options:re})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:es.type,options:DC()}),t.lasso!=null&&(lo(t.lasso)?n.push($n.type):n.push({type:$n.type,options:t.lasso})),t.miniview!=null&&n.push({type:Bn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:rs.type,options:t.dragGroups}),((M=t.edges)==null?void 0:M.highlightSelected)!==!1&&n.push({type:fa.type,options:{paintStyle:(N=t.edges)==null?void 0:N.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(G=t.cells)==null?void 0:G.magnetizer,getCollapsedGroupSize:(J=t.cells)==null?void 0:J.getCollapsedGroupSize,canCollapseGroup:(re,$e)=>this.G!=null&&this.G.canCollapse!=null?this.G.canCollapse(re,$e):!0,canExpandGroup:(re,$e)=>this.G!=null&&this.G.canExpand!=null?this.G.canExpand(re,$e):!0,elementsDraggable:this.$editable!==!1&&((ye=t.cells)==null?void 0:ye.draggable)!==!1,defaults:o,view:this.Vx(t),shapes:{library:this.$shapeLibrary,showLabels:((j=t.cells)==null?void 0:j.showLabels)!==!1,strokeWidth:(ge=t.cells)==null?void 0:ge.outlineWidth,labelAttribute:(Ge=t.cells)==null?void 0:Ge.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Xe=t.cells)==null?void 0:Xe.font},edges:{editable:t.editable!==!1&&((Bt=t.edges)==null?void 0:Bt.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(ar=t.edges)==null?void 0:ar.propertyMappings,avoidVertices:(er=t.edges)==null?void 0:er.avoidVertices,allowUnattached:((Dr=t.edges)==null?void 0:Dr.allowUnattached)!==!1,connector:(ao=t.edges)==null?void 0:ao.connector,layerIndex:(Ha=t.edges)==null?void 0:Ha.layerIndex,sourceMarker:(ka=t.edges)==null?void 0:ka.sourceMarker,targetMarker:(Wa=t.edges)==null?void 0:Wa.targetMarker,overlays:(Za=t.edges)==null?void 0:Za.overlays,anchor:(Ja=t.edges)==null?void 0:Ja.anchor,anchors:(Om=t.edges)==null?void 0:Om.anchors,inputMethod:(_m=t.edges)==null?void 0:_m.inputMethod,reattach:((cc=t.edges)==null?void 0:cc.reattach)===!0,detachable:(Rm=t.edges)==null?void 0:Rm.detachable},edgeSnap:(dc=t.edges)==null?void 0:dc.snap,plugins:n,events:{[xo]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Rs]:re=>{if(this.$editable){let $e=this.$_cellMap.get(re.dragGroup[0].vertex.id);$e!=null&&this.toFront($e)}},[Zx]:re=>{if(this.$editable){let $e=this.$_cellMap.get(re.dragGroup[0].vertex.id);$e!=null&&this.toFront($e)}}},dragOptions:{filter:re=>this.G&&this.G.canDrag?this.G.canDrag(re.vertex,this.Bn(re.vertex),re.el):!0,canDrop:(re,$e,Dt)=>this.G&&this.G.canDrop?this.G.canDrop(re,$e,Dt):!0,autoPan:t.autoPan!==!1}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind(Br,re=>{this.Sm(re.vertex,re.el)}),this.$ui.bind($r,re=>{this.Sm(re.vertex,re.el)}),this.model.bind(Le,re=>{this.Tm(re.node)}),this.model.bind(Me,re=>{this.Tm(re.group)}),this.model.bind(jt,()=>{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}Vx(r){var h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;let e=(h=r.edges)!=null&&h.events?r.edges.events[Ue]:null,t={events:{[Ue]:v=>{let O=v.e.srcElement||v.e.target;if(an(O,Ks)){ae(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().q.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:(m=r.edges)==null?void 0:m.deleteButton,deleteButtonClass:(g=r.edges)==null?void 0:g.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)}if(r.edges.events)for(let v in r.edges.events)v!==Ue&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>O=>{this.$editable&&this.toFront(this.$_cellMap.get(O.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||O.model.getSelection().se.length<1||O.e.shiftKey!==!0?O.model.setSelection(O.obj):O.model.addToSelection(O.obj)),v&&v(O)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={template:`<svg:g ${Io}="${this.$editable}" class="${_C}"><vjs-shape/></svg:g>`,events:n};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(s,v)}let a={template:`<svg:g ${Io}="${this.$editable}" class="${OC}"><vjs-shape/></svg:g>`,events:n};if((S=r.cells)!=null&&S.nodes){let v=(R=r.cells)==null?void 0:R.nodes,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}Sm(r,e){r.data.z==null&&(r.data.z=M0(this.$_cellList)+1);let t=new Un(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}Tm(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}Dx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canRotate?this.G.canRotate(r,t,e):!0}Nx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canLink?this.G.canLink(r,t,e):!0}Mx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canClone?this.G.canClone(r,t,e):!0}wx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canResize?this.G.canResize(r,t,e):!0}Ix(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canDelete?this.G.canDelete(r,t,e):!0}Bn(r){let e=r.data.type,t=r.data.cateory;return this.$shapeLibrary.getShapeDefinition(e,t)}$destroy(){this.$ui.destroy()}Gx(r){return z(r)?r:r.id}Gc(r){return z(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 Un(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 ci(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof Un&&(e.source=e.source.id),e.target instanceof Un&&(e.target=e.target.id);let t=this.model.addEdge(e);return new ci(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return Aa(this.$ui,r).svg}exportImage(r,e){_p(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.Gx(r))}toFront(r){if(!(r instanceof ci)){let e=this.Gc(r),t=M0(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 ci)){let e=this.Gc(r),t=gG(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.Gc(r);this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(z(r)?r:r.id);this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof ci?r.edge:r;MC(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){MC(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(MC(this.$ui)){let e=r instanceof ci?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:Bn.type,options:r})}attachPalette(r,e){return new Bh(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function EG(i,r,e){return new Bh(r,i,e)}function fG(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)||Te,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||De,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||Q,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||Ee,selectionMode:Qc});let o=dn(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var VC=class extends Sa{constructor(r,e,t){super(r,e.$ui,t)}};function yG(i,r){hp.register(i,r)}function xG(i,r,e){return dn(e||{}).render(i,r)}var bG=function(i,r,e){let t=i.srcElement||i.target;return!Mt(t,e||V0,r)},AG=(e=>(e.idle="idle",e.dragging="dragging",e))(AG||{}),kv="assigned",_a="added";function G0(i){return z(i)?{id:i,active:!0,membership:_a}:{id:i.id,active:i.active,membership:i.membership}}function SG(i,r){let e=Mm(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var TG=["input","textarea","select","button","option"],V0=TG.join(","),Zp=class{constructor(r){c(this,"inputFilterSelector");c(this,"Or",{});c(this,"$c",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"Bc");c(this,"Oe");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"Fc");c(this,"eo");c(this,"u");c(this,"_");c(this,"fe");c(this,"Pr");c(this,"Us");c(this,"Uc");c(this,"te");c(this,"zs",[]);c(this,"Ys");c(this,"no");c(this,"$t",[]);c(this,"currentState","idle");c(this,"he");c(this,"Jr",{});c(this,"zc",{});c(this,"Bt",null);c(this,"Te",new Map);c(this,"io",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||V0;let e=`${be(ee)}, ${be(ee)} *`;if(this.draggableInstance.addDragHandler({selector:e,start:t=>this.Rl(t),drag:t=>this.Ll(t),stop:t=>{this.wl(t)},constrainFunction:(t,n,o,s,a,l)=>t}),this.ui.bind(fo,t=>{this.currentState==="dragging"&&(this.eo=this.eo*(t.zoom/this.Fc),this.Fc=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&typeof IntersectionObserver!="undefined"){let t=this.draggableInstance.dragOptions.autoPanDelta||5,n=this.draggableInstance.dragOptions.autoPanRepeat||15;this.he=new IntersectionObserver((o,s)=>{this.Bc||o.forEach(a=>{if(a.isIntersecting)this.draggableInstance.$stopPanRepeat();else{let l=a.boundingClientRect.y<a.rootBounds.y?1:a.boundingClientRect.y+a.boundingClientRect.height>a.rootBounds.y+a.rootBounds.height?-1:0,h=a.boundingClientRect.x<a.rootBounds.x?1:a.boundingClientRect.x+a.boundingClientRect.width>a.rootBounds.x+a.rootBounds.width?-1:0;this.draggableInstance.$startPanRepeat(h,l,t,t,n,d=>{let u=this.draggableInstance.getEffectiveVisibleZoom();this.Oe.x+=d.x/u,this.Oe.y+=d.y/u,this.newPosition!=null&&this.vm(!1)})}})},{root:this.draggableInstance.$getDragViewportContainer(),rootMargin:"0px",threshold:.99})}}Yc(r){for(let e in this.Or){let t=this.Or[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&Tr(r)){r.oo=e||V();let n=r.oo;this.Or[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.oo:r;delete this.Or[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return Mt(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(bt).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return an(l,o)};s.$x=o,this.addDragFilter(s,t,e)})}))}Bx(r){for(let e in this.Or)if(this.Or[e].$x===r){delete this.Or[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(bt).forEach(n=>{this.Bx(n)})}))}clearAllFilters(){this.Or={}}ie(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.te&&this.te.cleanup(),this.te=null,this.Uc=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,ct),F(this.ui.rootElement,cf),this.no||(F(this.ui.rootElement,Wo),F(this.ui.rootElement,Kt),F(this.ui.rootElement,qt)),this._!=null&&F(this._.el,df),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll("."+rh)).forEach(r=>{F(r,rh)}),L(this.u.el,rh),F(this.u.el,th),this.Te.forEach(r=>{F(r.managedElement.el,th),L(r.managedElement.el,rh)})),this.currentState="idle",this.u=null,this._=null,this.Cm(),this.zs.forEach(r=>{this.Om(r.managedElement,Kt,Ef,Wo)}),this.zs.length=0,this.io.clear(),this.Te.clear(),this.Bt=null}Cm(){this.$t.forEach(r=>{this.Om(r.managedElement,qt)}),this.$t.length=0}Fx(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Pm(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}Rl(r){if(r.e.Ux==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(fr)!==at)if(this.Yc(r.e)&&bG(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Zt(r.el,be(Pt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!Ke(t.obj)&&!H(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.Te.clear(),this.Ys=!0,r.e.Ux=!0,this.u=this.Fx(t.obj,r.e),this.u==null)return r.e.Hf=!0,!1;this.Us=!1,this.fe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.Oe={x:0,y:0},this.Bc=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this.Pr=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Pr=this.ui.getGroupDefinition(this._.modelObject),this.Pr.elementsDraggable===!1)return!1;s=this.Pr.elastic===!0&&r.e.shiftKey!==!0,this.Uc=r.e.shiftKey===!0,this.fe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,df),this.Ys=this.ui.$canDrop(this.u.modelObject,null,!0),this.Ys,s||(F(this.ui.rootElement,Kt),L(this.ui.rootElement,Wo))}this.no=o||s,this.no||L(this.ui.rootElement,Kt),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!We(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),m=this.ui.$_getGroupContentAreaInfo(l.id),g={droppable:u,managedElement:p,depth:Sc(l),contentAreaInfo:m,contentArea:p.contentArea,contentBox:{x:p.x+m.internalOffset.x,y:p.y+m.internalOffset.y,width:p.width-m.internalOffset.x,height:p.height-m.internalOffset.y},isCurrentGroup:d,group:l,id:l.id};this.zs.push(g),u?(d||this.Fn(p,Kt),d&&this.Fn(p,Ef)):this.Fn(p,Wo)}}):s&&(this.te=new ya(this.ui,this.u.modelObject,this.u.modelObject.group,this.Pr)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.zx(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.Fc=this.draggableInstance.getZoom(),this.eo=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,ct),L(this.ui.rootElement,cf),L(this.u.el,th),this.currentState="dragging",this.he&&this.he.observe(this.u.el),this.Bt=this.Jr[this.u.modelObject.id],this.Bt&&!SG(this.Bt,this.u.modelObject.id)&&(this.Bt=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.io.clear(),this.Te.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:fs(this.u),originalPosition:rr(this.u),position:rr(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.Bt!=null){let l=(Y(this.u.modelObject)?bs(this.u.modelObject):[]).map(d=>d.id),h=En(this.u.modelObject).map(d=>d.id);Array.from(this.Bt.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.Te.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:fs(d.el),originalPosition:rr(d.el),position:rr(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.he&&this.he.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,th),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(Rs,a),!0}else return!1;else return!1}else return!1;else return!1}}Yx(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.he!=null&&(this.he.unobserve(this.u.el),this.Te&&this.Te.forEach(r=>{this.he.unobserve(r.managedElement.el)}))}Fn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}Om(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}wl(r){var e;if(this.Yx(),this.u!=null&&this.newPosition!=null){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.Oe.x,y:this.newPosition.y-this.Oe.y},d=Object.assign({},h);if(this.$t.length>0&&(o=this.$t[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.Uc&&t.delete(o.group))),o==null){if(!this.Ys)return this._m();this._!=null&&this.te==null&&(d.x+=this._.x+this.fe.internalOffset.x,d.y+=this._.y+this.fe.internalOffset.y),n[this.u.id]={x:d.x,y:d.y},Array.from(this.Te.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._m();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 m=d.x+(this._.x+this.fe.internalOffset.x),g=d.y+(this._.y+this.fe.internalOffset.y);d.x=m-(o.managedElement.x+p.internalOffset.x),d.y=g-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d.x-=o.managedElement.x+p.internalOffset.x,d.y-=o.managedElement.y+p.internalOffset.y,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.Bt!=null){let m=this.Xx(d,o.managedElement,p);for(let g in m.current){let E={x:Math.floor(m.current[g].x),y:Math.floor(m.current[g].y)};n[g]=E;let y=this.Te.get(g),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.io.forEach((p,m)=>{n[m]=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 m in p.current)n[m]=p.current[m]}this.ui.model.transaction(()=>{if(a)this.Te.forEach((p,m)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},m={};if(o==null)if(this.te==null)Array.from(this.Te.values()).forEach(g=>{g.parentGroup!=null&&(t.add(g.parentGroup.modelObject),this.ui.model.$removeFromGroup(g.modelObject,null,{x:this.relativePositionAtDown.x+g.offset.x,y:this.relativePositionAtDown.y+g.offset.y},g.position,this.ui))});else{let{movedElements:g,resizedGroups:E}=this.te.Ul();Object.assign(m,E);for(let y in g)n[y]=g[y].current,p[y]=g[y].current}else l.forEach(g=>{this.ui.model.$addToGroup(g.vertex,o.group,g.originalParent,g.originalPosition,g.positionInGroup,this.ui)});for(let g in n){let E={[this.ui.$modelLeftAttribute]:n[g].x,[this.ui.$modelTopAttribute]:n[g].y};m[g]!=null&&(E[this.ui.$modelWidthAttribute]=m[g].newGroupSize.width,E[this.ui.$modelHeightAttribute]=m[g].newGroupSize.height),this.ui.model.$_updateVertex(g,E,Bs,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(m)}});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.Te.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let m=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:m.el,vertex:p.modelObject,element:m})}}),this.ui.$stopMotion(),this.ui.fire(Lt,u)}this.ie()}Xx(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.Bt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.Te.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.Te.get(h.id).size;return new Ti({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}_m(){this.ui.$stopMotion(),Array.from(this.Te.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.io.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.ie()}jx(r){return this._==null||r.id===this._.id}vm(r){let e={x:this.newPosition.x-this.Oe.x,y:this.newPosition.y-this.Oe.y};this.Cm();let t={x:e.x+this.fe.pageOrigin.x,y:e.y+this.fe.pageOrigin.y,width:this.u.width,height:this.u.height};if(this.zs.forEach(l=>{ke(l.contentBox,t)&&this.$t.push(l)}),this.$t.length>0){this.$t.sort((h,d)=>h.depth>d.depth?-1:1);let l=!this.jx(this.$t[0].managedElement);(this._==null||this.Us||l)&&this.Fn(this.$t[0].managedElement,qt),this._!=null&&!l&&(this.Us=!0,this.Fn(this._,Kt)),this.no||F(this.ui.rootElement,qt)}else this._!=null&&!this.Pr.elastic&&(this.Us=!0,this.Fn(this._,Kt)),this.no||L(this.ui.rootElement,qt);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.Te.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=se(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.Oe.x,y:this.newPosition.y-this.Oe.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.io.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.fe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(nr,s),{redrawResult:a,positions:n}}Ll(r){if(this.currentState==="dragging"){ae(r.e),this.Bc=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.eo,n=(e.y-this.downAt.y)/this.eo,o={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(o.x-=this.fe.pageOrigin.x,o.y-=this.fe.pageOrigin.y,!this.Pr.elastic&&this.Pr.constrain&&(o.x+this.u.width>this._.width-this.fe.internalOffset.x&&(o.x=this._.width-this.u.width-this.fe.internalOffset.x),o.y+this.u.height>this._.height-this.fe.internalOffset.y&&(o.y=this._.height-this.u.height-this.fe.internalOffset.y),o.x<0&&(o.x=0),o.y<0&&(o.y=0))),this.activeGrid!=null&&(o=se(o,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(o=this.draggableInstance.dragOptions.constrainFunction(o,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=o;let s=this.vm(r.e.shiftKey);return this.te!=null&&this.te.focusVertex.id===this.u.id&&this.kx(r.e,s.positions[this.u.id]),s.redrawResult}else return null}zx(){let r=this._?this._.x+this.fe.internalOffset.x:0,e=this._?this._.y+this.fe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}Rm(r,...e){let t=[],n=G0(r),o=this.zc[n.id];if(o==null)o={id:n.id,members:new Set},this.zc[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!==_a)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Pm(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.Jr[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.Jr[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.Jr[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.Jr[t.id];if(n!=null){let o=Mm(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.zc[r];e!=null&&(e.members.forEach(t=>{delete this.Jr[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.Jr[r]}kx(r,e){this.te!=null&&e!=null&&this.te.setFocusPosition(e,!0,r)}Pm(r,e){for(let t=0;t<this.$c.length;t++)if(!this.$c[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.$c.push(r)}};var br=i=>i.map(r=>String.fromCharCode(r)).join(""),vG=new Date().getFullYear(),CG=br([67,111,112,121,114,105,103,104,116,32])+vG+br([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),GC=br([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),$0=new Array(50).fill("-").join(""),PG=br([86,105,115,117,97,108,108,121,74,115,32])+Rg,OG=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]),_G=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]),RG=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]),Ra=br([10,10]),B0=$0+Ra+PG+Ra+CG+Ra+GC+Ra+OG+Ra+_G+Ra+RG+Ra+$0,F0=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]),LG=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]),U0=br([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),wG=["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"],DG=U0+'<path d="'+wG.join('"/><path d="')+'"/></g>',NG=["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"],IG=U0+'<path d="'+NG.join('"/><path d="')+'"/></g>',Y0=LG+DG+"<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])+IG+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]),MG=br([60,97,32,104,114,101,102,61,34])+GC+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])+F0+'">'+Y0+"</a>",$C=null;function Jp(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),Jp(i,!0,s)};r||console.log(B0),$C&&window.clearInterval($C),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(MG,"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",GC),s.setAttribute("target","_blank"),s.setAttribute("title",F0),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),$C=window.setInterval(()=>a(),25e3)}}var BC=null;function FC(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),FC(i,!0,n)};r||console.log(B0),BC&&window.clearInterval(BC),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(Y0,"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((m,g)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),BC=window.setInterval(()=>u(),25e3)}}var UC="vjs-orthogonal-handle",Kp="vjs-orthogonal-segment-drag",YC="vjs-orthogonal-segment-drag-ns",zC="vjs-orthogonal-segment-drag-ew";var VG=10,GG=20,eo=class extends Ji{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:"."+Kp+" *",target:"."+Kp,drag:n=>{let o=n.el.Ft,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=ZA(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.Ft,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.Lm(!0),this.$updateModel(Yr(n.el.Ft.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=Yr(n.el.Ft.connection.connector)}})}wm(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;Ce(e.el,{x:o,y:s})}$repaint(e){this.cn(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],Ws(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.wm(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.cn(),this.currentConnector.edited=!0}$elementDragged(e){this.Lm(!0)}$elementDragging(e){this.$repaint()}cn(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=ot(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===Pc,d=this.$makeOrthogonalHandle(h,a,l,GG,VG,[Gn,UC,Kp,h?zC:YC].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Ft=u,this.segmentHandles.push(u),this.wm(u,s)}else o===n&&this.segmentHandles.push(t)}}Lm(e){this.current&&this.$hasEdits&&(JA(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(eo,"type",ks);Lr.set(eo.type,eo);function XC(){Lr.set(eo.type,eo)}var Fh="vjs-straight-handle",hs="vjs-straight-segment-drag",qp="vjs-straight-segment-split",Qp="vjs-straight-segment-delete",jC="vjs-straight-editor-guideline";var em=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(X(qp)).Ft;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(X(Qp)).Ft;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,X(qp),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,X(Qp),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,[Gn,Fh,qp].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,[Gn,Fh,Qp].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var yy="vjs-straight-connector-edit",HC="click",$G="auto";var xy=class{constructor(r){this.editor=r;c(this,"Xc");c(this,"jc");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);ae(e.e);let o=LA(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.jc=(e=>{let t=e.target.closest(X(hs)).Ft;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Wr(r,yy),this.editor.ui.bind(ml,this.Xc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${X(hs)} *`,this.jc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(ml,this.Xc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.jc),this.editor.current!=null&&Or(this.editor.current,yy)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],ue,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var to=class extends Ji{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===HC?new em(this):new xy(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+hs+" *",target:"."+hs,drag:n=>{let o=n.el.Ft,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(Yr(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=Yr(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(Yr(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(Yr(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,[Gn,Fh,hs].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.Ft=l),this.segmentHandles.push(l)}this.Hx()}this.$mode.$repaintEnded()}Hx(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=$(ve,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[jC,gp].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=$(te,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(to,"type",_n);Lr.set(to.type,to);function kC(){Lr.set(to.type,to)}var Uh="vjs-bezier-handle",by="vjs-bezier-handle-control-point",WC="vjs-bezier-handle-control-point-1",ZC="vjs-bezier-handle-control-point-2",BG="vjs-bezier-handle-secondary",FG="vjs-bezier-handle-secondary-source",UG="vjs-bezier-handle-secondary-target",JC="vjs-bezier-guideline";var di=class extends Ji{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,"ft");c(this,"Be");c(this,"Ut");c(this,"kc");c(this,"Hc");c(this,"Dm",{x:0,y:0});c(this,"Nm",{x:0,y:0});this.ft=t.handleSize||Bp,this.$addDragHandler({selector:"."+Uh+" *",target:"."+Uh,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.Be:this.Ut,h=a===0?this.Dm:this.Nm;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.Dm=Object.assign({},this.Be),this.Nm=Object.assign({},this.Ut),!0)})}$activate(e,t){this.Im(),this.Mm(),this.Wx((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.Im(),this.Mm(),this.Vm(),this.Zx()}Wx(e){this.h1=this.$makeAndAppendCircularHandle(this.Be.x,this.Be.y,this.ft,this.ft,[Gn,Uh,by,WC].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Ut.x,this.Ut.y,this.ft,this.ft,[Gn,Uh,by,ZC].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Pr,this.lockHandles||(this.h2.style.display=Pr),this.l1=this.Gm(this.kc,this.Be.x,this.Be.y),this.l2=this.Gm(this.Hc,this.Ut.x,this.Ut.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Pr:ht,this.l2.style.display=e?Pr:ht,this.Vm()}Vm(){this.$setElementPosition(this.h1,this.Be.x,this.Be.y);let e=this.lockHandles?this.Be:this.Ut;this.$setElementPosition(this.h2,e.x,e.y)}Gm(e,t,n){let o=$(ve,{width:5,height:5}),s=$(te,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,JC),this.ui.$addClassToElement(o,gp),this.Wc(e,o,t,n),o}Zx(){this.Wc(this.kc,this.l1,this.Be.x,this.Be.y);let e=this.lockHandles?this.Be:this.Ut;this.Wc(this.Hc,this.l2,e.x,e.y)}Wc(e,t,n,o){ln(t,e);let s=n-e.x,a=o-e.y;ce(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}Mm(){this.currentConnector&&(this.Be=this.currentConnector.geometry.segments[0].cp1,this.Ut=this.currentConnector.geometry.segments[0].cp2)}Im(){this.current&&(this.kc={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.Hc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(di,"type",Oo);var ro=class extends di{constructor(r,e){super(r,e),this.lockHandles=!0}};c(ro,"type",Xd);Lr.set(di.type,di),Lr.set(ro.type,ro);function KC(){Lr.set(di.type,di),Lr.set(ro.type,ro)}var z0="selected-vertices",Yh=class extends aa{constructor(e,t,n,o,s){var h,d,u,p,m,g,E,y,x;super(e,t,n,o,s,gn(o.defaults||{},{managedElementsSelector:be(Pt,on)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"Un");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"Zc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"$m");c(this,"mode",xr);if(this.Un=ev(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.Fb=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Kr(Wt,ve,{position:"absolute",left:"0",top:"0"},of,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Kr(Wt,ve,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Kr(Wt,q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Kr(Wt,q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Kr(Wt,q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Kr(null,He,{position:"relative",width:Rn,height:Rn},of,{},this.rootElement,!0),this.vertexLayer=Kr(null,He,{left:0,top:0,position:"absolute",width:Rn,height:Rn},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Kr(Wt,ve,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),Jp(this.rootElement,!1),this.Zc=o.elementsDraggable!==!1,this.Zc===!1&&this.canvasElement.setAttribute(eS,at),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new Zp({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new ma(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(pa),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||Zi),this.$m=new pp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering,edgeSnap:o.edgeSnap,vl:f=>{L(this.rootElement,In)},Pl:f=>{F(this.rootElement,In)},Cl:f=>{},Ol:f=>{F(this.rootElement,In)}}),new mp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.$m}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(su),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,rf),wn()&&L(this.rootElement,AT),oi()&&L(this.rootElement,ST),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,nf);let a=(f,b,A)=>{let T=S=>{let R=S.srcElement||S.target;if(R===this.rootElement||R===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(R)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===xo&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,xo,gt),a(Fr,Rb),this.panZoom=new da({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,getOffset:f=>this.$getElementPositionInUIRelativeToCanvasOrigin(f),getOffsetRelativeToRoot:f=>zi(f),getSize:f=>this.$getSize(f),elementPositionSetter:(f,b)=>Ce(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.F(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(m=o.pan)==null?void 0:m.useMetaKey,wheel:this.Jx(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(g=o.pan)==null?void 0:g.filter,events:{panStart:()=>{L(this.rootElement,hf),L(document.body,ct)},[gl]:(f,b,A,T,S)=>{this.fire(gl,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[fo]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire(fo,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[oe]:()=>{F(this.rootElement,hf),F(document.body,ct)}},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,X(au),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.uu(o),this.$dataLoadStart();let l=this.Kd();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)}Kx(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{Ce(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===ut&&(d=d||it(n),l-=d.width),s&&s.alignY&&s.alignY===st&&(d=d||it(n),h-=d.height),Ce(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.Un.length;t++)this.Kx(this.Un[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}Pu(e){this.panZoom.xl()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.Zc!==!1&&(this.mode===xr||this.mode===li)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.ps(de.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.ps(le.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}Jx(e){var a,l,h,d;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=e.wheel?e.wheel.cssFilter:null;return{filter:s?u=>{let p=u.srcElement||u.target;return!Mt(p,s)}:(d=e.wheel)==null?void 0:d.filter,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.Un.length;e++)this.Un[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.le(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,XC(),kC(),KC()}$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.Rm(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),K(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.Rm({id:z0,active:!0,membership:_a},t)}}$deselect(e){if(super.$deselect(e),K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(z0)}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)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addToDragGroup(e,...t){let n=z(e)?{id:e,active:!0,membership:_a}:Object.assign(e,{membership:_a});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:Bn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}positionElementAt(e,t,n,o,s,a){this.panZoom.positionElementAt(e,t,n,o,s,a)}positionElementAtEventLocation(e,t,n,o){this.panZoom.positionElementAtEventLocation(e,t,n,o)}positionElementAtPageLocation(e,t,n,o,s){this.panZoom.positionElementAtPageLocation(e,t,n,o,s)}destroy(){let e;for(let t=0;t<this.Ba.length;t++)try{e=this.Ba[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,rf),F(this.rootElement,bT),F(this.rootElement,nf),this.le(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire(Oi,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=z(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)}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 Cf(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}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.Un.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)}centerOnAndZoom(e,t,n){let o=this.getObjectInfo(e,!1);o.el!=null&&this.panZoom.centerOnAndZoom({bounds:this.viewport.getElementBounds(o.id),fillRatio:t,doNotAnimate:n})}centerOn(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOn({bounds:this.viewport.getElementBounds(t.id)})}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)}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)}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.Bm=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.Bm!=null&&this.off(this.vertexLayer,e,t.Bm)}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=je,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)},[li]:()=>{this.panZoom.setEnabled(!1)},[qo]:()=>{this.panZoom.setEnabled(!1)},[Vn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===li&&!t&&this.model.clearSelection(),this.fire(vn,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(Yh,"type","Surface");var Ay=class extends bd{fetchUrl(r){na(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?ha:la,o=t||fh(n,e==null?void 0:e.useSvgContainer,e);return j0(this,r,o,e)}renderDiagram(r,e){return new Wp(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?ha:la,s=n||fh(o,e==null?void 0:e.useSvgContainer,{});return H0(this,r,s,e,t)}};function dn(i){return i=i||{},new Ay(i)}function YG(i,r){i.bind(Ht,e=>{r.$nodeAdded(e)}),i.bind(Xt,e=>{r.$groupAdded(e)}),i.bind(Le,e=>{r.$nodeRemoved(e)}),i.bind(Me,e=>{r.$groupRemoved(e)}),i.bind(dr,e=>{r.$edgeAdded(e)}),i.bind(mt,e=>{r.$edgeRemoved(e)}),i.bind(bn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function j0(i,r,e,t){return X0(i,r,e,(n,o,s,a,l)=>new Yh(n,s||n,a,o,l),t)}function X0(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 mr(i,{generator:s.selection}));let a=s.id||V(),l=t(i,s,o,r,e);return o!=null&&YG(o,l),i.$addRenderer(l,a),l}function H0(i,r,e,t,n){return X0(i,r,e,(o,s,a,l,h)=>new zh(o,a||o,l,s,h,n),t)}var zG=i=>i.map(r=>String.fromCodePoint(r)).join(""),XG=[99,114,101,97,116,101,69,108,101,109,101,110,116];function jG(){return document}var k0=i=>jG()[zG(XG)](i);var zh=class extends aa{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");this.id=o.id||V(),this.$margin=o.margin||cT,this.$horizontalAlign=o.horizontalAlign||o.align||Xo,this.$verticalAlign=o.verticalAlign||o.align||Xo,o.useSvgContainer?this.$canvas=$(ve,{width:"100%",height:"100%"}):(this.$canvas=k0("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,lT),L(this.$canvas,hT),n.appendChild(this.$canvas),this.setContainer(this.$canvas),Jp(this.rootElement,!1),this.bindAll([Sn,Vs,Lt,Gr,Le,Me,Br,$r,Tn,ab,Ms],()=>{this.syncView()}),this.uu(o),this.$dataLoadStart();let h=this.Kd();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.Xe,t=it(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(Ot(this.$canvas)){let m=0,g=0;switch(this.$horizontalAlign){case Xo:break;case Jl:m-=(s-d*n)/2;break;case Kl:m+=(s-d*n)/2;break}switch(this.$verticalAlign){case Xo:break;case Jl:g-=(a-d*o)/2;break;case Kl:g+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${m}, ${g})`),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 m=(-e.xmin+this.$margin)*d,g=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case Jl:break;case Xo:m+=(s-u)/2;break;case Kl:m+=s-u;break}switch(this.$verticalAlign){case Jl:break;case Xo:g+=(a-p)/2;break;case Kl:g+=a-p;break}let E=`translateX(${m}px) translateY(${g}px) scale(${d})`;this.$canvas.style.transform=E}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return console.log("toPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromPageLocation(e,t,n){return console.log("fromPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromWindowLocation(e,t,n){return console.log("fromWindowLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}mapEventLocation(e){return console.log("mapEventLocation not necessarily correct - implement in base browser ui"),this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=it(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}}getApparentCanvasLocation(){return console.log("paper get aparent canvas loc - is it correct to return 0,0?"),{x:0,y:0}}addBackground(e){console.log("add background to paper - what needs to happen?")}removeBackground(e){console.log("remove background from paper - what needs to happen?")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function HG(i,r,e,t){let n=dn(e||{}),o=r!=null&&r.useSvgContainer?ha:la,s=fh(o,r==null?void 0:r.useSvgContainer,{}),a=new zh(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function kG(i,r,e){if(Mt(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if(Mt(t,e,i))return t;t=t.parentNode}}}function WG(i){return typeof i=="function"?(i.oo=V(),i.oo):i}function ZG(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=kG(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=Mt(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var tP="start",rP="beforeStart",nP="drag",J0="drop",K0="over",q0="out",iP="stop",W0="katavorio-draggable",JG=W0,KG=10,qG=10,qC=function(){return!0},QG=function(){return!1},QC={delegatedDraggable:"katavorio-delegated-draggable",draggable:JG,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},Z0=[iP,tP,nP,J0,K0,q0,rP],e$=function(){},Xh=function(i,r){if(i!=null){i=!z(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},t$=function(i,r,e){let t=i.srcElement||i.target;return!Mt(t,e.getInputFilterSelector(),r)},eP=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",V());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={};Xh(this.scopes,t=>{e[t]=!0}),Xh(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={};Xh(this.scopes,t=>{e[t]=!0}),Xh(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={};Xh(this.scopes,t=>{e[t]=!0}),Xh(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)}},Q0="notNegative",ew="parent",tw="parentEnclosed";function oP(i,r){let e=null;switch(i){case Q0:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case ew:{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 tw:{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 Sy=class extends eP{constructor(e,t,n){super(e,n);c(this,"Fm");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"H");c(this,"Pe");c(this,"Et");c(this,"Xs");c(this,"js",{x:0,y:0});c(this,"ao",{x:0,y:0});c(this,"Ke");c(this,"ks");c(this,"Hs");c(this,"E");c(this,"Jc");c(this,"lo");c(this,"co");c(this,"zn",!1);c(this,"Ws");c(this,"Yn");c(this,"Kc");c(this,"V");c(this,"ho",[]);c(this,"Um");c(this,"zm");c(this,"yn");c(this,"Ar");c(this,"qc");c(this,"uo",{});c(this,"Zs");c(this,"ye");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.Fm=this.manager.css.draggable,L(this.el,this.Fm),this.downListener=this.Xr.bind(this),this.upListener=this.mr.bind(this),this.moveListener=this.jr.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.Um=t.canDrag||qC,this.zm=t.consumeFilteredEvents,this.yn=t.parent,this.Ar=t.ignoreZoom===!0,this.Ws=t.ghostProxyParent,this.qc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.qx.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.Yn=qC:t.ghostProxy&&typeof t.ghostProxy=="function"?this.Yn=t.ghostProxy:this.Yn=(o,s)=>this.V&&this.V.useGhostProxy?this.V.useGhostProxy(o,s):!1,t.makeGhostProxy?this.Kc=t.makeGhostProxy:this.Kc=o=>this.V&&this.V.makeGhostProxy?this.V.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(W0);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.ho.push(t)}this.eventManager.on(this.el,ue,this.downListener)}qx(e){if(this.Et){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.js.x,o=t.y-this.js.y,s={x:n+this.Xs.x,y:o+this.Xs.y},a=s.x-this.H.x,l=s.y-this.H.y,h=this.Ar?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.ao.x,l+=this.E.parentNode.scrollTop-this.ao.y),a/=h,l/=h,this.moveBy(a,l,e),this.Xs=s,this.js=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}}mr(e){this.H&&(this.H=null,this.eventManager.off(document,ie,this.moveListener),this.eventManager.off(document,oe,this.upListener),this.unmark(e),this.stop(e),this.Et=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.V&&this.V.revertFunction&&this.V.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this.Pe))}Xr(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Um())if(this.Yc(e)&&t$(e,this.el,this.manager)){this.V=null,this.ye=null,this.ho.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=ZG(this.ho,this.el,o);if(s!=null&&(this.V=s[0],this.ye=s[1]),this.V==null||this.ye==null)return;let a=this.V.dragInit?this.V.dragInit(this.ye,e):null;a!=null&&(this.ye=a);let l=1;if(this.clone)if(this.E=this.ye.cloneNode(!0),L(this.E,QC.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.yn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.yn.appendChild(this.E)}else{let h=zi(this.ye,!0),d=this.ye.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.qc&&!this.Ar&&(l=this.qc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.ye;this.consumeStartEvent&&ae(e),this.H=me(e),this.E&&this.E.parentNode&&(this.ao={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this.Pe=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),this.Ke.width=this.Ke.width*l,this.Ke.height=this.Ke.height*l,this.eventManager.on(document,ie,this.moveListener),this.eventManager.on(document,oe,this.upListener),this.Js(rP,{el:this.el,pos:this.Pe,e,drag:this,size:this.Ke})}else this.zm&&ae(e)}jr(e){if(this.H){if(!this.Et){let t=this.Js(tP,{el:this.el,pos:this.Pe,e,drag:this,size:this.Ke});if(t!==!1){if(!this.H)return;this.mark(t),this.Et=!0}else this.abort()}if(this.H){let t=me(e),n=t.x-this.H.x,o=t.y-this.H.y,s=this.Ar?1:this.manager.zoom;this.Xs={x:t.x,y:t.y},this.js={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.ao.x,o+=this.E.parentNode.scrollTop-this.ao.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this.Pe!=null&&this.H!=null?{x:this.H.x-this.Pe.x,y:this.H.y-this.Pe.y}:{x:0,y:0}}mark(e){this.Pe=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.Zs=this.manager.getParentConstrainingRectangle(this.E),this.lo=0,this.co=0}unmark(e){this.zn&&this.Yn(this.ye,this.E)?(this.Jc={x:this.E.offsetLeft-this.lo,y:this.E.offsetTop-this.co},this.E.parentNode.removeChild(this.E),this.E=this.ye):this.Jc=null,F(this.E,this.manager.css.drag),this.zn=!1}moveBy(e,t,n){let o=this.toGrid({x:this.Pe.x+e,y:this.Pe.y+t}),s=this.Qx(o,this.E,this.Zs,this.Ke,{x:this.Pe.x,y:this.Pe.y},n);if(s!=null){if(this.Yn(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.zn){let a=this.Kc(this.ye);L(a,QC.ghostProxy),this.Ws?(this.Ws.appendChild(a),this.ks=zi(this.ye.parentNode),this.Hs=zi(this.Ws),this.lo=this.ks.x-this.Hs.x,this.co=this.ks.y-this.Hs.y):this.ye.parentNode.appendChild(a),this.E=a,this.zn=!0}s=o}else this.zn&&(this.E.parentNode.removeChild(this.E),this.E=this.ye,this.zn=!1,this.ks=null,this.Hs=null,this.lo=0,this.co=0);this.manager.positionSetter(this.E,{x:s.x+this.lo,y:s.y+this.co}),this.Js(nP,{el:this.el,pos:s,e:n,drag:this,size:this.Ke,originalPos:this.Pe,viewport:this.Zs})}}abort(){this.H!=null&&this.mr()}getDragElement(e){return e?this.ye||this.el:this.E||this.el}stop(e,t){if(t||this.Et){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.Ke]),this.Js(iP,{el:this.E,pos:this.Jc||o,finalPos:o,e,drag:this,selection:n,size:this.Ke,originalPos:{x:this.Pe.x,y:this.Pe.y},viewport:this.Zs})}else this.Et||this.V.dragAbort&&this.V.dragAbort(this.ye)}Js(e,t){let n=null;if(this.V&&this.V[e])n=this.V[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:KG/2,thresholdY:qG/2};return this.V!=null&&this.V.grid!=null&&(e.grid=this.V.grid,this.V.snapThreshold!=null&&(e.thresholdX=this.V.snapThreshold,e.thresholdY=this.V.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 se(e,t,s,a)}}setUseGhostProxy(e){this.Yn=e?qC:QG}Qx(e,t,n,o,s,a){return this.V!=null&&this.V.constrainFunction&&typeof this.V.constrainFunction=="function"?this.V.constrainFunction(e,t,n,o,s,a):e}Yc(e){for(let t in this.uo){let n=this.uo[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=WG(e);this.uo[n]=[o=>{let s=o.srcElement||o.target,a;return z(e)?a=Mt(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.oo:e;delete this.uo[t]}clearAllFilters(){this.uo={}}addSelector(e,t){e.selector&&(t?this.ho.unshift(e):this.ho.push(e))}destroy(){this.eventManager.off(this.el,ue,this.downListener),this.eventManager.off(document,ie,this.moveListener),this.eventManager.off(document,oe,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"],n$=r$.join(","),tm=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 fe,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}}}eb(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<Z0.length;t++){let n=Z0[t];e.events[n]=r[n]||e$}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.po==null){let t=this.eb(e),n=new Sy(r,t,this);return L(r,QC.delegatedDraggable),r.po=n,n}else return r.po}destroyDraggable(r){r.po&&(r.po.destroy(),delete r.po)}};var rw=15,nw=10,iw="markers",ow="lineStyle",sw="sourceArrow",aw="targetArrow",lw="bothArrows",hw="plain",cw="dashed";function i$(i){let r=(i==null?void 0:i.arrowWidth)||rw,e=(i==null?void 0:i.arrowLength)||nw,t=(i==null?void 0:i.lineStyleProperty)||ow,n=(i==null?void 0:i.markersProperty)||iw;return[{property:t,mappings:{[hw]:{},[cw]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[sw]:{overlays:[{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]},[aw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}}]},[lw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}},{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var sP={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.");sP.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(sP.get(i))}};var aP=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new tm({positionGetter:o=>hn(o),positionSetter:(o,s)=>Jt(o,s),getSize:o=>it(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=oP(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 o$(i){dw?i():lP.push(i)}var lP=[],dw=!1,Ty=()=>{dw=!0;for(let i=0;i<lP.length;i++)lP[i]()},hP=class{constructor(r){this.templateHolder=r;c(this,"c",0)}Ym(){this.c--,this.c<=0&&Ty()}add(r){this.c++,na({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.Ym()},error:e=>{this.Ym()}})}ensureNotEmpty(){this.c<=0&&Ty()}},uw="_vjs_templates",s$=()=>{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(uw);if(r)Ty();else{r=document.createElement("div"),r.style.display="none",r.id=uw,document.body.appendChild(r);let e=new hP(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 Ty()};i()};s$();var pw="vjs-test-support-container",a$=1e-11;function mw(){let i=document.getElementById(pw);return i==null&&(i=document.createElement("div"),i.id=pw,document.body.appendChild(i)),i}var rm=[],l$=[];function vy(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):mw().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",rm.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function h$(i,r){for(let e=0;e<i.length;e++)vy(i[e],r)}function c$(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 nm(i){c$(document.querySelectorAll(i))}function d$(){for(let i=0;i<rm.length;i++)rm[i].el.parentNode.removeChild(rm[i].el);rm.length=0,nm("circle"),nm(".vjs-node"),nm(".vjs-surface-canvas"),nm("svg"),nm(".vjs-lasso"),mw().innerHTML=""}function u$(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 cs(i){return i.connector.canvas}function Gt(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 cP(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 gw(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 Ew={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function p$(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return Ar(i,r)}function fw(i,r,e){let t=i;e=e||{},e.start&&e.start(),un(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=p$();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",Ew),e.up&&e.up()}function yw(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);un(i,s);let a=Ew;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 xw(i,r,e,t){let n=vy("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 m$(i,r,e,t){let n=dn(i),o,s;if(r!=null){let l=xw(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return l$.push(a),a}function g$(i,r){let e=i.surface.getRenderedConnection(r),t=cs(e),n=Gt(t);i.surface.trigger(t.querySelector("path"),"click",n)}function E$(i,r){let e=i.surface.getRenderedConnection(r),t=cs(e),n=Gt(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function f$(i,r){let e=i.surface.getRenderedConnection(r),t=cs(e),n=Gt(t);var o=t.querySelector("path");i.surface.trigger(o,ue,n),i.surface.trigger(o,"mouseup",n)}function y$(i,r){let e=i.surface.getRenderedConnection(r),t=cs(e),n=Gt(t);var o=t.querySelector("path");i.surface.trigger(o,ue,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,ue,n),i.surface.trigger(o,"mouseup",n)}function im(i,r,e){let t=i.surface.getRenderedConnection(r),n=cs(t),o=Gt(n);i.surface.trigger(n.querySelector("path"),e,o)}function dP(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jh(i.surface,t,1,1)}function om(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);un(i.surface,t,1),Hh(i.surface,t,1)}function x$(i,r,e){Cy(i,r,Yn,1,e)}function b$(i,r,e){Cy(i,r,"mouseover",1,e)}function A$(i,r,e){Cy(i,r,"mouseout",1,e)}function Cy(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);kh(i.surface,s,e,t,n)}function jh(i,r,e=1,t=1){let n=Gt(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 bw(i,r,e=1){let t=Gt(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 un(i,r,e=1,t){kh(i,r,ds,e,t)}function Hh(i,r,e=1,t){kh(i,r,no,e,t)}function kh(i,r,e,t=1,n){let o=Gt(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 uP(i,r,e,t,n=1){let o=Ar(t.x,t.y),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,n||1,null),r.dispatchEvent(s)}function S$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jh(i.surface,t,2,1)}function T$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);bw(i.surface,t,1)}function v$(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+"]");jh(i.surface,o,1,1)}function C$(i,r){jh(i.surface,r,1,1)}function P$(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+"]");bw(i.surface,o,1)}function Aw(i,r){un(i.surface,r),Hh(i.surface,r)}function O$(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+"]");Aw(i,o)}function _$(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+"]");un(i.surface,o),Hh(i.surface,o),un(i.surface,o),Hh(i.surface,o)}function R$(i,r,e){let t=i.surface.getRenderedConnection(r),n=Vl(t,e||"lbl");jh(i.surface,n.contentElements[0],1,1)}function L$(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(qr(on,e));o&&jh(i.surface,o,1,1)}function pP(i,r,e,t,n){t=t||{};let o=i,s;Xi(e)?s=Gt(e,null,n):s=cP(i.$getCanvasElement(),e.x,e.y);let a=i.model.getAllEdges().length;t.start&&t.start(),un(i,r),t.down&&t.down();let l=Object.values(i.$_connMap).find(u=>u.edge.transient);if(l!=null&&o.trigger(cs(l).childNodes[0],tt,s),o.trigger(document,Yn,s),t.move){let u=i.model.getAllEdges().filter(m=>m.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}o.trigger(document,no,s);let h=i.model.getAllEdges()[a],d=h?i.getRenderedConnection(h.id):null;return t.up&&t.up(d),d}function Sw(i,r,e,t,n,o){let s=i.getObjectInfo(t,!1);if(s.el){n=n||{};let a=i.getRenderedConnection(r.id),l=e?".vjs-connector-source-drag":".vjs-connector-target-drag",h=a.connector.canvas.querySelector(l);n.start&&n.start(),un(i,h),n.down&&n.down();let d=Gt(s.el,null,o);i.trigger(document,"mousemove",d),n.move&&n.move(),i.trigger(document,"mouseup",d),n.up&&n.up(a)}else throw`Cannot resolve drag element ${t}`}function mP(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Gt(r);o.trigger(r,ds,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,oe,l),n.afterUp&&n.afterUp()}function gP(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Gt(r,o);s.trigger(r,ds,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,Yn,gw(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,no,null),n&&n.afterUp&&n.afterUp()}function Tw(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=Gt(r,s);a.trigger(r,ds,p),o&&o.afterDown&&o.afterDown();for(let m=0;m<n;m++)a.trigger(document,Yn,gw(p,d,u,s)),o&&o.afterMove&&o.afterMove(m),d+=l,u+=h;a.trigger(document,no),o&&o.afterUp&&o.afterUp()}var w$=typeof document!="undefined",Py=w$?"ontouchstart"in document.documentElement:!1,ds=Py?"touchstart":"mousedown",Yn=Py?"touchmove":"mousemove",no=Py?"touchend":"mouseup";function Ar(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function vw(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function Cw(i,r,e,t){let n=i.vertexLayer;EP(i,n.parentElement.parentElement,r,e,t)}function EP(i,r,e,t,n){n&&n.start&&n.start();let o=i.toPageLocation(e.x,e.y),s=i.toPageLocation(t.x,t.y);o.x-=window.scrollX,s.x-=window.scrollX,o.y-=window.scrollY,s.y-=window.scrollY,uP(i,r,ds,o),n&&n.down&&n.down(),uP(i,document,Yn,s),n&&n.move&&n.move(),uP(i,document,no,s),n&&n.up&&n.up()}var ui={addDiv:vy,addDivs:h$,cleanup:d$,delta:u$,DOWN_EVENT:ds,UP_EVENT:no,MOVE_EVENT:Yn,isTouchDevice:Py,makeEvent:Gt,makeEventAt:Ar,nudgeEvent:vw,getEdgeCanvas:cs,defaultEventManager:new fe,dragElementBy:(i,r,e,t)=>{gP(ui.defaultEventManager,i,r,e,t)},attachToSurface:i=>new sm(i.model,i),create:(i,r,e,t)=>{let n=m$(i,r,e,t);return new sm(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:Cw,lassoOnElement:EP,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=ui);function Pw(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(),un(i,r),o.down&&o.down(),i.trigger(document,Yn,l),o.move&&o.move(),i.trigger(document,no,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var sm=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"Qc");c(this,"consoleOutput","");this.eventManager=new fe,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.Qc==null&&(this.Qc=new ma(this.surface)),this.Qc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=xw(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){fw(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){fw(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return cs(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;mP(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;mP(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)mP(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)gP(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){gP(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){Tw(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)Tw(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||co,null)}mo(r){let e;if(eT(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}Xm(r,e){return{sourceEl:this.mo(r),targetEl:this.mo(e)}}dragConnection(r,e,t,n){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:o,targetEl:s}=this.Xm(r,e);return pP(this.surface,o,s,t,n)}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.Xm(r,e);return Pw(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.mo(r);return pP(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.mo(e);return pP(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.mo(e);return Pw(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return yw(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return yw(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n){Sw(this.surface,r,!1,e,t,n)}relocateEdgeSource(r,e,t,n){Sw(this.surface,r,!0,e,t,n)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Gt(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?cP(r,n,o,t):Gt(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=cP(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=Gt(n.el);return e||t?vw(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){dP(this,r)}clickOnNode(r){dP(this,r)}clickOnVertex(r){dP(this,r)}dblClickOnVertex(r){T$(this,r)}rightClickOnVertex(r){S$(this,r)}tapOnVertex(r){om(this,r)}tapOnNode(r){om(this,r)}tapOnGroup(r){om(this,r)}dblTapOnVertex(r){om(this,r),om(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){x$(this,r,e)}mouseoverOnVertex(r,e){b$(this,r,e)}mouseoutOnVertex(r,e){A$(this,r,e)}contextmenuOnVertex(r,e){Cy(this,r,gt,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)un(this.surface,this.canvas,e),Hh(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){un(this.surface,this.canvas,t,{x:r,y:e}),Hh(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){kh(this.surface,this.canvas,Yn,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){kh(this.surface,this.canvas.parentNode,ds,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){kh(this.surface,this.canvas,no,1,{x:r,y:e})}lasso(r,e,t){Cw(this.surface,r,e,t)}lassoOnElement(r,e,t,n){EP(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){C$(this,r)}clickOnElementInsideVertex(r,e){v$(this,r,e)}dblClickOnElementInsideVertex(r,e){P$(this,r,e)}tapOnElement(r){Aw(this,r)}tapOnElementInsideVertex(r,e){O$(this,r,e)}dblTapOnElementInsideVertex(r,e){_$(this,r,e)}mousedownOnElement(r){un(this.surface,r)}clickOnEdge(r){g$(this,r)}dblClickOnEdge(r){E$(this,r)}tapOnEdge(r){let e=Ke(r)?r.id:r;f$(this,e)}dblTapOnEdge(r){let e=Ke(r)?r.id:r;y$(this,e)}jm(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(),m=p.x,g=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(m+13)*s,f=(g+13)*s,b=m+a*s+u.width/2,A=g+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=Ar(E,y);this.surface.trigger(h,ui.DOWN_EVENT,T),t&&this.surface.trigger(h,ui.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,ui.MOVE_EVENT,Ar(x,f));let S=Ar(b,A);if(this.surface.trigger(d,ui.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let R=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(R,ui.DOWN_EVENT,S),this.surface.trigger(R,ui.UP_EVENT,S)}else this.surface.trigger(d,ui.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.jm(r,e,!1,t)}tapFromPalette(r,e,t){this.jm(r,e,!0,t)}mousedownOnEdge(r){im(this,r,ue)}mouseupOnEdge(r){im(this,r,oe)}mouseoverOnEdge(r){im(this,r,tt)}mouseoutOnEdge(r){im(this,r,et)}contextmenuOnEdge(r){im(this,r,gt)}clickOnOverlay(r,e){R$(this,r,e)}clickOnPort(r,e){L$(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=Gt(r);this.eventManager.trigger(r,ds,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,no,Ar(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=vy("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 Xp(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<a$,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var fP="vjs-chart-background",La="vjs-chart-plot-background",Wh="vjs-chart-body",yP="vjs-chart-series",xP="vjs-chart-legend",am="vjs-chart-legend-item",bP="vjs-chart-legend-label",AP="vjs-chart-legend-dot",wa="vjs-chart-axis",lm="vjs-chart-x-axis",hm="vjs-chart-y-axis",Oy="vjs-chart-axis-labels",_y="vjs-chart-axis-line",Ry="vjs-chart-axis-title",SP="vjs-chart-y-axis-title",TP="vjs-chart-x-axis-title",vP="vjs-column-chart",CP="vjs-column-chart-column",PP="vjs-bar-chart",OP="vjs-bar-chart-bar",pn="vjs-chart-point",cm="vjs-chart-point-hit-area",_P="vjs-bubble-chart",RP="vjs-bubble-chart-point",LP="vjs-scatter-chart",wP="vjs-scatter-chart-point",dm="vjs-area-chart-area",DP="vjs-chart-title",NP="vjs-chart-subtitle",Zh="vjs-chart-crosshair",Jh="vjs-chart-crosshair-label",IP="vjs-chart-crosshair-value-axis",MP="vjs-chart-crosshair-category-axis",Ly="vjs-chart-empty",VP="vjs-chart-axis-scale-label",wy="vjs-chart-gridlines",Dy="vjs-chart-gridline",GP="vjs-line-chart",$P="vjs-area-chart";var D$=6;function Ny(i,r,e){let t=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),n=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);t<r&&(t+=e),n>i&&(n-=e);let o=(t-n)/e;return{maxScale:t,minScale:n,stepCount:o,step:e}}function N$(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function I$(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function _w(i,r,e,t){let n=Ny(i,r,e),o=n.stepCount-t,s=Math.abs(o);if(o>0){let l=N$(n.step),h=Ny(i,r,l);Math.abs(h.stepCount-t)<s&&(n=h)}else if(o<0){let l=I$(n.step),h=Ny(i,r,l);Math.abs(h.stepCount-t)<s&&(n=h)}let a=[];for(let l=n.minScale;l<=n.maxScale;l+=n.step)a.push(l);return Object.assign(n,{steps:a,range:n.maxScale-n.minScale,dataMin:i,dataMax:r})}function Kh(i,r,e=D$){let t=r-i,n=Rw(t);return _w(i,r,n,e)}function BP(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 Rw(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function pi(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=$(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function us(i,r,e,t){let n=k(Je,r,e,t);return n.innerHTML=i,n}function M$(i,r){let e=eh(i);$t(i,r,e.y)}function qh(i,r){let e=eh(i);$t(i,e.x,r)}function $t(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function mn(i){return i.type==="value"}function FP(i){return i.type==="category"}function Qh(){return{x:0,y:0,width:0,height:0}}function Iy(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 UP(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(ke(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end");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 Ow(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 um(i,r,e,t,n,o){let s=$(Je,{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=$("tspan",{fill:Ow(t),stroke:Ow(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=$("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="​",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function My(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",Wt),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}`),V$(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${Zh}, .${Jh}`).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("*")),m=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(m),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 V$(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var G$="vertical",Vy="horizontal",Lw=10,Gy="left",$y="center",YP="right",ec="top",tc="middle",By="bottom",pm=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||Lw,this.orientation=r.orientation||Vy,this.align=r.align||$y,this.valign=r.valign||By,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=pi(12,"normal","normal","sans-serif",r.font)}};var mm="chart:load",zP="No data",XP="Could not draw chart";var ww="vjs-chart-exporter-hamburger",$$="vjs-chart-exporter-menu",B$="vjs-chart-exporter-menu-item",Dw="vjs-chart-exporter-hamburger-open",gm=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"go",!1);this.eventManager=new fe,this.eventManager.on(r.container,W,X(ww),t=>{t.stopPropagation(),this.go?this.eh():this.tb()})}rb(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"},ww),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"},$$),[{label:"Download JPG",type:ts},{label:"Download PNG",type:_h},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=Jr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},B$);a.innerText=s.label,this.eventManager.on(a,Ue,()=>{this.nb(s.type),this.eh()}),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.go&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.go&&(n(),this.hideTimeout=setTimeout(()=>{this.eh(),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()})}tb(){this.menu.style.display="block",this.go=!0,L(this.hamburger,Dw);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`}eh(){this.menu.style.display="none",this.go=!1,F(this.hamburger,Dw)}nb(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:ba.svg});this.km(n,`${e}.svg`)}else{let t=r===ts?ba.jpeg:ba.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===ts?"jpg":"png";this.km(n.url,`${e}.${o}`,!0)})}}km(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 F$="0 0 32 30",U$="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",Nw="0 0 32 32",Y$="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",z$="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",X$="vjs-chart-zoom-controls",j$="vjs-chart-zoom-button",Fy=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new fe}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},X$),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:Y$,viewBox:Nw,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:z$,viewBox:Nw,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:U$,viewBox:F$,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"},j$);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
|
|
134
|
+
</div>`}}var mG=1.25,jp=class{constructor(r,e){this.ui=r;c(this,"$n");c(this,"Rx");c(this,"Vc");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||mG,o=e.iconSize||{width:hG,height:cG};this.onVertexAdded=e.onVertexAdded,this.Vc=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||Xu.FILL,a=e.outline||Xu.STROKE,l=e.outlineWidth||Xu.STROKE_WIDTH;this.$n=yr({templates:pG(e.showAllMessage)});let h=`<div class="${$h}" 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.$n.registerTag(uG,{template:h,rendered:(p,m,g,E)=>{var T,S,R;let y=m.type,x=null,f=E.getAttribute(Qi)||m.category;f!=null&&p.setAttribute(Qi,f);let b=m.shapeId;b!=null&&(p.setAttribute(Xp,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",m.label||""),m.objectType===le.objectType&&p.setAttribute(zl,At);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){let v=A.previewData||{},O=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((R=A.initialSize)==null?void 0:R.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${O} ${P}`),A.icon){let C=this.$n.parse(A.icon),_=this.$n.render(C,v).fragment;I.appendChild(_)}else{let C=fO(gi({},v),{type:y,category:f,width:O,height:P}),_=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let D=Math.min(O,P),M=(O-D)/2,N=(P-D)/2;_.setAttribute("transform",`translate(${M}, ${N})`)}I.appendChild(_);let B={fill:s,stroke:a,"stroke-width":n};if(x!=null){let D=x.properties||{};for(let M in D){let N=M===uh?"stroke":M===ph?"stroke-width":M;I.setAttribute(N,D[M]),delete B[N]}}for(let D in B)I.setAttribute(D,B[D])}}},updated:(p,m,g)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(m=>Object.assign({},this.$shapeLibrary.getShapeDefinition(m.type,m.category),{shapeId:m.shapeId,properties:m.properties,category:m.category,label:m.label,size:m.size}));this.$preparedShapes=p,d=this.$n.template(D0,{shapes:p})}else d=this.$n.template(w0,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.Rx=new Ta(r,{source:this.palette,selector:X($h),dragSize:e.dragSize,dragSizeGenerator:(p,m)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:TC,elementGenerator:(p,m)=>{let g=p.cloneNode(!0),E=g.querySelector(X(my));return E&&E.parentNode.removeChild(E),g},vertexPreviewGenerator:(p,m,g,E,y)=>{let x=Object.assign(g,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:g.outlineWidth||1}),f=$(ve,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(hh);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,m,g,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:g.width,[r.$modelHeightAttribute]:g.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${g.width} ${g.height}`)},dataGenerator:p=>{var C,_,w,B,D;let m=this.Vc?this.Vc(p)||{}:{},g=p.getAttribute(CC),E=p.getAttribute(Qi),y=p.getAttribute(Xp),x=this.$shapeLibrary.getShapeDefinition(g,E),f=m.fill,b=m.outline,A=m.outlineWidth,T=m.color,S=(C=this.$preparedShapes)==null?void 0:C.find(M=>M.shapeId===y),R=(S==null?void 0:S.properties)||{},v=(_=S==null?void 0:S.size)==null?void 0:_.width,O=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||m.width||((B=x.initialSize)==null?void 0:B.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=O||m.height||((D=x.initialSize)==null?void 0:D.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(m,{type:g,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},R),f!=null&&(m.fill=f),b!=null&&(m.outline=b),A!=null&&(m.outlineWidth=A),T!=null&&(m.color=T),x.payload&&Object.assign(m,x.payload),m},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(X(Gh))).forEach(p=>{p.addEventListener("change",m=>{let g=p.options[p.selectedIndex].value,E=p.getAttribute(Qi);p.setAttribute(vC,`${g===Oa}`),this.xm(g,E)})}),e.inspector!==!1){r.model.bind(ur,g=>{m()}),r.model.bind(pr,g=>{m()});let p=()=>{Array.from(this.palette.querySelectorAll(X(zu))).forEach(E=>{F(E,zu)})},m=()=>{p();let g=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>g.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),g.size===1){let[E,y]=Array.from(g)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${Qi}='${y}'][${CC}='${E}']`);f!=null&&L(f,zu)}}};r.model.bind(Cr,()=>{p()}),r.on(this.palette,W,X($h),g=>{let E=g.target.closest(X($h)),y=E.getAttribute(Qi),x=E.getAttribute(CC),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||de.objectType,A=this.bm();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([Ve,Re],g=>{this.bm().containsVertex(g.vertex.id)&&m()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}bm(){return this.ui.model.getSelection().filter(r=>K(r)||Y(r))}Lx(r){return this.palette.querySelector(`${X(Gh)}[${Qi}='${r}']`)}xm(r,e){let t=e==Wi?this.palette:this.palette.querySelector(`${X(zp)}[${Qi}='${e}']`);t.setAttribute(vC,`${r==Oa}`),Array.from(t.querySelectorAll(X(zp))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(dG,`${r===Oa||r===o.getAttribute(Qi)}`)})}Am(r,e){this.xm(r,e);let t=this.Lx(e);t!=null&&(t.value=r,t.setAttribute(vC,`${r===Oa}`))}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!==Wi;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.Am(o[0],o[1])})}}else this.Am(Oa,Wi)}};var OC="vjs-diagram-node",_C="vjs-diagram-group",RC=100,LC=80,wC=[JT];var Un=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,{[Sf]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[uh]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[ph]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Tf]:r})}get label(){return this.vertex.data[ki]}get fill(){return this.vertex.data[Sf]||mh}get outline(){return this.vertex.data[uh]||Zo}get outlineWidth(){return this.vertex.data[ph]||gh}get color(){return this.vertex.data[Tf]||ZT}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 hi=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return 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 Un?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof Un?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 DC(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Ea.type}}var N0=15,Ey="vjs-cell-tool",NC="vjs-clone-cell",IC="vjs-delete-cell",I0="vjs-link-cell",as=class extends ss{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||N0,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.ft/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,X(NC),n=>{let s=n.target.closest(`[${ee}]`).getAttribute(ee);s!=null&&(ae(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,X(IC),n=>{let o=n.target.closest(`[${ee}]`),s=o.getAttribute(ee);if(s!=null){ae(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}Mc(e,t,n,o){let s=super.Mc(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=$(q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),Ju(ku,this.$buttonSize,this.$buttonSize,[NC,Ey],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=$(q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),Ju(Wu,this.$buttonSize,this.$buttonSize,[IC,Ey],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=$(q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),Ju(Hu,this.$buttonSize,this.$buttonSize,[I0,Ey],{title:"Click and drag to link","data-vjs-source":!0,[ee]: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(oi,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(oi,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(oi,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(as,"type","diagramTools"),as=Nt([wt("diagramTools")],as);var Bh=class extends jp{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(Xp);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function MC(i){return i.startEditingPath!==void 0}function M0(i){return i.isEmpty()?0:i.head().zIndex}function gG(i){return i.isEmpty()?0:i.peek().zIndex}var Hp=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,"G");var a,l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R,v,O,P,I,C,_,w,B,D,M,N,G,J,ye,j,ge,Ge,Xe,Bt,ar,er,Dr,ao,Ha,ka,Wa,Za,Ja,Cm,Pm,cc,Om,dc;t=t||{},this.G=t.mediator,this.$_cellList=new gs((re,$e)=>re.zIndex<$e.zIndex?-1:re.zIndex>$e.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||ki,this.$shapeLibrary=new ia(t.shapes||wC,{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 bu(this.model,{fill:t.defaultFillColor||mh,outline:t.defaultOutlineColor||Zo,outlineWidth:t.defaultOutlineWidth||gh,color:t.defaultColor||Zo}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||RC,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||LC,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:as.type,options:{rotationStops:(m=t.cells)==null?void 0:m.rotationStops,canResizeFilter:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.resizable)!==!1&&this.wx(re,$e)!==!1},canRotateFilter:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.rotatable)!==!1&&this.Dx(re,$e)!==!1},canShowLinkButton:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.linkable)!==!1&&this.Nx(re,$e)!==!1},canDelete:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.deletable)!==!1&&this.Ix(re,$e)!==!1},canClone:(re,$e)=>{var Dt,Ft;return((Dt=t.cells)==null?void 0:Dt.editable)!==!1&&((Ft=t.cells)==null?void 0:Ft.clonable)!==!1&&this.Mx(re,$e)!==!1},handleShape:(E=(g=t.cells)==null?void 0:g.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=(R=t.cells)==null?void 0:R.resize)==null?void 0:v.method,bordersVisible:(P=(O=t.cells)==null?void 0:O.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(_=t.cells)==null?void 0:_.resize)==null?void 0:w.resizeX,resizeY:(D=(B=t.cells)==null?void 0:B.resize)==null?void 0:D.resizeY}}),t.snapLines!=null){let re=t.snapLines===!0?{}:t.snapLines;n.push({type:rs.type,options:re})}if(t.panButtons!=null){let re=t.panButtons===!0?{}:t.panButtons;n.push({type:ns.type,options:re})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:Qo.type,options:DC()}),t.lasso!=null&&(lo(t.lasso)?n.push($n.type):n.push({type:$n.type,options:t.lasso})),t.miniview!=null&&n.push({type:Bn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:ts.type,options:t.dragGroups}),((M=t.edges)==null?void 0:M.highlightSelected)!==!1&&n.push({type:fa.type,options:{paintStyle:(N=t.edges)==null?void 0:N.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(G=t.cells)==null?void 0:G.magnetizer,getCollapsedGroupSize:(J=t.cells)==null?void 0:J.getCollapsedGroupSize,canCollapseGroup:(re,$e)=>this.G!=null&&this.G.canCollapse!=null?this.G.canCollapse(re,$e):!0,canExpandGroup:(re,$e)=>this.G!=null&&this.G.canExpand!=null?this.G.canExpand(re,$e):!0,elementsDraggable:this.$editable!==!1&&((ye=t.cells)==null?void 0:ye.draggable)!==!1,defaults:o,view:this.Vx(t),shapes:{library:this.$shapeLibrary,showLabels:((j=t.cells)==null?void 0:j.showLabels)!==!1,strokeWidth:(ge=t.cells)==null?void 0:ge.outlineWidth,labelAttribute:(Ge=t.cells)==null?void 0:Ge.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Xe=t.cells)==null?void 0:Xe.font},edges:{editable:t.editable!==!1&&((Bt=t.edges)==null?void 0:Bt.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(ar=t.edges)==null?void 0:ar.propertyMappings,avoidVertices:(er=t.edges)==null?void 0:er.avoidVertices,allowUnattached:((Dr=t.edges)==null?void 0:Dr.allowUnattached)!==!1,connector:(ao=t.edges)==null?void 0:ao.connector,layerIndex:(Ha=t.edges)==null?void 0:Ha.layerIndex,sourceMarker:(ka=t.edges)==null?void 0:ka.sourceMarker,targetMarker:(Wa=t.edges)==null?void 0:Wa.targetMarker,overlays:(Za=t.edges)==null?void 0:Za.overlays,anchor:(Ja=t.edges)==null?void 0:Ja.anchor,anchors:(Cm=t.edges)==null?void 0:Cm.anchors,inputMethod:(Pm=t.edges)==null?void 0:Pm.inputMethod,reattach:((cc=t.edges)==null?void 0:cc.reattach)===!0,detachable:(Om=t.edges)==null?void 0:Om.detachable},edgeSnap:(dc=t.edges)==null?void 0:dc.snap,plugins:n,events:{[xo]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[_s]:re=>{if(this.$editable){let $e=this.$_cellMap.get(re.dragGroup[0].vertex.id);$e!=null&&this.toFront($e)}},[Wx]:re=>{if(this.$editable){let $e=this.$_cellMap.get(re.dragGroup[0].vertex.id);$e!=null&&this.toFront($e)}}},dragOptions:{filter:re=>this.G&&this.G.canDrag?this.G.canDrag(re.vertex,this.Bn(re.vertex),re.el):!0,canDrop:(re,$e,Dt)=>this.G&&this.G.canDrop?this.G.canDrop(re,$e,Dt):!0,autoPan:t.autoPan!==!1}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind(Br,re=>{this.Sm(re.vertex,re.el)}),this.$ui.bind($r,re=>{this.Sm(re.vertex,re.el)}),this.model.bind(Le,re=>{this.Tm(re.node)}),this.model.bind(Me,re=>{this.Tm(re.group)}),this.model.bind(jt,()=>{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}Vx(r){var h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;let e=(h=r.edges)!=null&&h.events?r.edges.events[Ue]:null,t={events:{[Ue]:v=>{let O=v.e.srcElement||v.e.target;if(an(O,Ks)){ae(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().q.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:(m=r.edges)==null?void 0:m.deleteButton,deleteButtonClass:(g=r.edges)==null?void 0:g.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)}if(r.edges.events)for(let v in r.edges.events)v!==Ue&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>O=>{this.$editable&&this.toFront(this.$_cellMap.get(O.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||O.model.getSelection().se.length<1||O.e.shiftKey!==!0?O.model.setSelection(O.obj):O.model.addToSelection(O.obj)),v&&v(O)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={template:`<svg:g ${Io}="${this.$editable}" class="${_C}"><vjs-shape/></svg:g>`,events:n};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(s,v)}let a={template:`<svg:g ${Io}="${this.$editable}" class="${OC}"><vjs-shape/></svg:g>`,events:n};if((S=r.cells)!=null&&S.nodes){let v=(R=r.cells)==null?void 0:R.nodes,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}Sm(r,e){r.data.z==null&&(r.data.z=M0(this.$_cellList)+1);let t=new Un(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}Tm(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}Dx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canRotate?this.G.canRotate(r,t,e):!0}Nx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canLink?this.G.canLink(r,t,e):!0}Mx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canClone?this.G.canClone(r,t,e):!0}wx(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canResize?this.G.canResize(r,t,e):!0}Ix(r,e){let t=this.Bn(r);return t==null?!0:this.G&&this.G.canDelete?this.G.canDelete(r,t,e):!0}Bn(r){let e=r.data.type,t=r.data.cateory;return this.$shapeLibrary.getShapeDefinition(e,t)}$destroy(){this.$ui.destroy()}Gx(r){return z(r)?r:r.id}Gc(r){return z(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 Un(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 hi(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof Un&&(e.source=e.source.id),e.target instanceof Un&&(e.target=e.target.id);let t=this.model.addEdge(e);return new hi(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return Aa(this.$ui,r).svg}exportImage(r,e){Pp(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.Gx(r))}toFront(r){if(!(r instanceof hi)){let e=this.Gc(r),t=M0(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 hi)){let e=this.Gc(r),t=gG(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.Gc(r);this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(z(r)?r:r.id);this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof hi?r.edge:r;MC(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){MC(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(MC(this.$ui)){let e=r instanceof hi?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:Bn.type,options:r})}attachPalette(r,e){return new Bh(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function EG(i,r,e){return new Bh(r,i,e)}function fG(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)||Te,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||De,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||Q,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||Ee,selectionMode:Qc});let o=dn(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var VC=class extends Sa{constructor(r,e,t){super(r,e.$ui,t)}};function yG(i,r){ap.register(i,r)}function xG(i,r,e){return dn(e||{}).render(i,r)}var bG=function(i,r,e){let t=i.srcElement||i.target;return!Mt(t,e||V0,r)},AG=(e=>(e.idle="idle",e.dragging="dragging",e))(AG||{}),kv="assigned",_a="added";function G0(i){return z(i)?{id:i,active:!0,membership:_a}:{id:i.id,active:i.active,membership:i.membership}}function SG(i,r){let e=Nm(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var TG=["input","textarea","select","button","option"],V0=TG.join(","),kp=class{constructor(r){c(this,"inputFilterSelector");c(this,"Or",{});c(this,"$c",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"Bc");c(this,"Oe");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"Fc");c(this,"eo");c(this,"u");c(this,"_");c(this,"fe");c(this,"Pr");c(this,"Us");c(this,"Uc");c(this,"te");c(this,"zs",[]);c(this,"Ys");c(this,"no");c(this,"$t",[]);c(this,"currentState","idle");c(this,"he");c(this,"Jr",{});c(this,"zc",{});c(this,"Bt",null);c(this,"Te",new Map);c(this,"io",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||V0;let e=`${be(ee)}, ${be(ee)} *`;if(this.draggableInstance.addDragHandler({selector:e,start:t=>this.Rl(t),drag:t=>this.Ll(t),stop:t=>{this.wl(t)},constrainFunction:(t,n,o,s,a,l)=>t}),this.ui.bind(fo,t=>{this.currentState==="dragging"&&(this.eo=this.eo*(t.zoom/this.Fc),this.Fc=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&typeof IntersectionObserver!="undefined"){let t=this.draggableInstance.dragOptions.autoPanDelta||5,n=this.draggableInstance.dragOptions.autoPanRepeat||15;this.he=new IntersectionObserver((o,s)=>{this.Bc||o.forEach(a=>{if(a.isIntersecting)this.draggableInstance.$stopPanRepeat();else{let l=a.boundingClientRect.y<a.rootBounds.y?1:a.boundingClientRect.y+a.boundingClientRect.height>a.rootBounds.y+a.rootBounds.height?-1:0,h=a.boundingClientRect.x<a.rootBounds.x?1:a.boundingClientRect.x+a.boundingClientRect.width>a.rootBounds.x+a.rootBounds.width?-1:0;this.draggableInstance.$startPanRepeat(h,l,t,t,n,d=>{let u=this.draggableInstance.getEffectiveVisibleZoom();this.Oe.x+=d.x/u,this.Oe.y+=d.y/u,this.newPosition!=null&&this.vm(!1)})}})},{root:this.draggableInstance.$getDragViewportContainer(),rootMargin:"0px",threshold:.99})}}Yc(r){for(let e in this.Or){let t=this.Or[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&Tr(r)){r.oo=e||V();let n=r.oo;this.Or[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.oo:r;delete this.Or[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return Mt(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(bt).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return an(l,o)};s.$x=o,this.addDragFilter(s,t,e)})}))}Bx(r){for(let e in this.Or)if(this.Or[e].$x===r){delete this.Or[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(bt).forEach(n=>{this.Bx(n)})}))}clearAllFilters(){this.Or={}}ie(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.te&&this.te.cleanup(),this.te=null,this.Uc=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,ct),F(this.ui.rootElement,hf),this.no||(F(this.ui.rootElement,ko),F(this.ui.rootElement,Kt),F(this.ui.rootElement,qt)),this._!=null&&F(this._.el,cf),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll("."+rh)).forEach(r=>{F(r,rh)}),L(this.u.el,rh),F(this.u.el,th),this.Te.forEach(r=>{F(r.managedElement.el,th),L(r.managedElement.el,rh)})),this.currentState="idle",this.u=null,this._=null,this.Cm(),this.zs.forEach(r=>{this.Om(r.managedElement,Kt,gf,ko)}),this.zs.length=0,this.io.clear(),this.Te.clear(),this.Bt=null}Cm(){this.$t.forEach(r=>{this.Om(r.managedElement,qt)}),this.$t.length=0}Fx(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Pm(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}Rl(r){if(r.e.Ux==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(fr)!==at)if(this.Yc(r.e)&&bG(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Zt(r.el,be(Pt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!Ke(t.obj)&&!H(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.Te.clear(),this.Ys=!0,r.e.Ux=!0,this.u=this.Fx(t.obj,r.e),this.u==null)return r.e.Hf=!0,!1;this.Us=!1,this.fe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.Oe={x:0,y:0},this.Bc=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this.Pr=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Pr=this.ui.getGroupDefinition(this._.modelObject),this.Pr.elementsDraggable===!1)return!1;s=this.Pr.elastic===!0&&r.e.shiftKey!==!0,this.Uc=r.e.shiftKey===!0,this.fe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,cf),this.Ys=this.ui.$canDrop(this.u.modelObject,null,!0),this.Ys,s||(F(this.ui.rootElement,Kt),L(this.ui.rootElement,ko))}this.no=o||s,this.no||L(this.ui.rootElement,Kt),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!We(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),m=this.ui.$_getGroupContentAreaInfo(l.id),g={droppable:u,managedElement:p,depth:Sc(l),contentAreaInfo:m,contentArea:p.contentArea,contentBox:{x:p.x+m.internalOffset.x,y:p.y+m.internalOffset.y,width:p.width-m.internalOffset.x,height:p.height-m.internalOffset.y},isCurrentGroup:d,group:l,id:l.id};this.zs.push(g),u?(d||this.Fn(p,Kt),d&&this.Fn(p,gf)):this.Fn(p,ko)}}):s&&(this.te=new ya(this.ui,this.u.modelObject,this.u.modelObject.group,this.Pr)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.zx(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.Fc=this.draggableInstance.getZoom(),this.eo=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,ct),L(this.ui.rootElement,hf),L(this.u.el,th),this.currentState="dragging",this.he&&this.he.observe(this.u.el),this.Bt=this.Jr[this.u.modelObject.id],this.Bt&&!SG(this.Bt,this.u.modelObject.id)&&(this.Bt=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.io.clear(),this.Te.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:Es(this.u),originalPosition:rr(this.u),position:rr(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.Bt!=null){let l=(Y(this.u.modelObject)?xs(this.u.modelObject):[]).map(d=>d.id),h=En(this.u.modelObject).map(d=>d.id);Array.from(this.Bt.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.Te.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:Es(d.el),originalPosition:rr(d.el),position:rr(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.he&&this.he.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,th),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(_s,a),!0}else return!1;else return!1}else return!1;else return!1}}Yx(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.he!=null&&(this.he.unobserve(this.u.el),this.Te&&this.Te.forEach(r=>{this.he.unobserve(r.managedElement.el)}))}Fn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}Om(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}wl(r){var e;if(this.Yx(),this.u!=null&&this.newPosition!=null){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.Oe.x,y:this.newPosition.y-this.Oe.y},d=Object.assign({},h);if(this.$t.length>0&&(o=this.$t[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.Uc&&t.delete(o.group))),o==null){if(!this.Ys)return this._m();this._!=null&&this.te==null&&(d.x+=this._.x+this.fe.internalOffset.x,d.y+=this._.y+this.fe.internalOffset.y),n[this.u.id]={x:d.x,y:d.y},Array.from(this.Te.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._m();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 m=d.x+(this._.x+this.fe.internalOffset.x),g=d.y+(this._.y+this.fe.internalOffset.y);d.x=m-(o.managedElement.x+p.internalOffset.x),d.y=g-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d.x-=o.managedElement.x+p.internalOffset.x,d.y-=o.managedElement.y+p.internalOffset.y,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.Bt!=null){let m=this.Xx(d,o.managedElement,p);for(let g in m.current){let E={x:Math.floor(m.current[g].x),y:Math.floor(m.current[g].y)};n[g]=E;let y=this.Te.get(g),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.io.forEach((p,m)=>{n[m]=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 m in p.current)n[m]=p.current[m]}this.ui.model.transaction(()=>{if(a)this.Te.forEach((p,m)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},m={};if(o==null)if(this.te==null)Array.from(this.Te.values()).forEach(g=>{g.parentGroup!=null&&(t.add(g.parentGroup.modelObject),this.ui.model.$removeFromGroup(g.modelObject,null,{x:this.relativePositionAtDown.x+g.offset.x,y:this.relativePositionAtDown.y+g.offset.y},g.position,this.ui))});else{let{movedElements:g,resizedGroups:E}=this.te.Ul();Object.assign(m,E);for(let y in g)n[y]=g[y].current,p[y]=g[y].current}else l.forEach(g=>{this.ui.model.$addToGroup(g.vertex,o.group,g.originalParent,g.originalPosition,g.positionInGroup,this.ui)});for(let g in n){let E={[this.ui.$modelLeftAttribute]:n[g].x,[this.ui.$modelTopAttribute]:n[g].y};m[g]!=null&&(E[this.ui.$modelWidthAttribute]=m[g].newGroupSize.width,E[this.ui.$modelHeightAttribute]=m[g].newGroupSize.height),this.ui.model.$_updateVertex(g,E,$s,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(m)}});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.Te.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let m=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:m.el,vertex:p.modelObject,element:m})}}),this.ui.$stopMotion(),this.ui.fire(Lt,u)}this.ie()}Xx(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.Bt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.Te.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.Te.get(h.id).size;return new Si({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}_m(){this.ui.$stopMotion(),Array.from(this.Te.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.io.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.ie()}jx(r){return this._==null||r.id===this._.id}vm(r){let e={x:this.newPosition.x-this.Oe.x,y:this.newPosition.y-this.Oe.y};this.Cm();let t={x:e.x+this.fe.pageOrigin.x,y:e.y+this.fe.pageOrigin.y,width:this.u.width,height:this.u.height};if(this.zs.forEach(l=>{ke(l.contentBox,t)&&this.$t.push(l)}),this.$t.length>0){this.$t.sort((h,d)=>h.depth>d.depth?-1:1);let l=!this.jx(this.$t[0].managedElement);(this._==null||this.Us||l)&&this.Fn(this.$t[0].managedElement,qt),this._!=null&&!l&&(this.Us=!0,this.Fn(this._,Kt)),this.no||F(this.ui.rootElement,qt)}else this._!=null&&!this.Pr.elastic&&(this.Us=!0,this.Fn(this._,Kt)),this.no||L(this.ui.rootElement,qt);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.Te.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=se(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.Oe.x,y:this.newPosition.y-this.Oe.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.io.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.fe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(nr,s),{redrawResult:a,positions:n}}Ll(r){if(this.currentState==="dragging"){ae(r.e),this.Bc=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.eo,n=(e.y-this.downAt.y)/this.eo,o={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(o.x-=this.fe.pageOrigin.x,o.y-=this.fe.pageOrigin.y,!this.Pr.elastic&&this.Pr.constrain&&(o.x+this.u.width>this._.width-this.fe.internalOffset.x&&(o.x=this._.width-this.u.width-this.fe.internalOffset.x),o.y+this.u.height>this._.height-this.fe.internalOffset.y&&(o.y=this._.height-this.u.height-this.fe.internalOffset.y),o.x<0&&(o.x=0),o.y<0&&(o.y=0))),this.activeGrid!=null&&(o=se(o,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(o=this.draggableInstance.dragOptions.constrainFunction(o,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=o;let s=this.vm(r.e.shiftKey);return this.te!=null&&this.te.focusVertex.id===this.u.id&&this.kx(r.e,s.positions[this.u.id]),s.redrawResult}else return null}zx(){let r=this._?this._.x+this.fe.internalOffset.x:0,e=this._?this._.y+this.fe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}Rm(r,...e){let t=[],n=G0(r),o=this.zc[n.id];if(o==null)o={id:n.id,members:new Set},this.zc[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!==_a)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Pm(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.Jr[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.Jr[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.Jr[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.Jr[t.id];if(n!=null){let o=Nm(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.zc[r];e!=null&&(e.members.forEach(t=>{delete this.Jr[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.Jr[r]}kx(r,e){this.te!=null&&e!=null&&this.te.setFocusPosition(e,!0,r)}Pm(r,e){for(let t=0;t<this.$c.length;t++)if(!this.$c[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.$c.push(r)}};var br=i=>i.map(r=>String.fromCharCode(r)).join(""),vG=new Date().getFullYear(),CG=br([67,111,112,121,114,105,103,104,116,32])+vG+br([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),GC=br([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),$0=new Array(50).fill("-").join(""),PG=br([86,105,115,117,97,108,108,121,74,115,32])+Og,OG=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]),_G=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]),RG=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]),Ra=br([10,10]),B0=$0+Ra+PG+Ra+CG+Ra+GC+Ra+OG+Ra+_G+Ra+RG+Ra+$0,F0=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]),LG=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]),U0=br([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),wG=["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"],DG=U0+'<path d="'+wG.join('"/><path d="')+'"/></g>',NG=["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"],IG=U0+'<path d="'+NG.join('"/><path d="')+'"/></g>',Y0=LG+DG+"<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])+IG+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]),MG=br([60,97,32,104,114,101,102,61,34])+GC+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])+F0+'">'+Y0+"</a>",$C=null;function Wp(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),Wp(i,!0,s)};r||console.log(B0),$C&&window.clearInterval($C),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(MG,"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",GC),s.setAttribute("target","_blank"),s.setAttribute("title",F0),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),$C=window.setInterval(()=>a(),25e3)}}var BC=null;function FC(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),FC(i,!0,n)};r||console.log(B0),BC&&window.clearInterval(BC),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(Y0,"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((m,g)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),BC=window.setInterval(()=>u(),25e3)}}var UC="vjs-orthogonal-handle",Zp="vjs-orthogonal-segment-drag",YC="vjs-orthogonal-segment-drag-ns",zC="vjs-orthogonal-segment-drag-ew";var VG=10,GG=20,eo=class extends Ji{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:"."+Zp+" *",target:"."+Zp,drag:n=>{let o=n.el.Ft,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=WA(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.Ft,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.Lm(!0),this.$updateModel(Yr(n.el.Ft.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=Yr(n.el.Ft.connection.connector)}})}wm(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;Ce(e.el,{x:o,y:s})}$repaint(e){this.cn(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],ks(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.wm(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.cn(),this.currentConnector.edited=!0}$elementDragged(e){this.Lm(!0)}$elementDragging(e){this.$repaint()}cn(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=ot(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===Pc,d=this.$makeOrthogonalHandle(h,a,l,GG,VG,[Gn,UC,Zp,h?zC:YC].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Ft=u,this.segmentHandles.push(u),this.wm(u,s)}else o===n&&this.segmentHandles.push(t)}}Lm(e){this.current&&this.$hasEdits&&(ZA(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(eo,"type",Hs);Lr.set(eo.type,eo);function XC(){Lr.set(eo.type,eo)}var Fh="vjs-straight-handle",ls="vjs-straight-segment-drag",Jp="vjs-straight-segment-split",Kp="vjs-straight-segment-delete",jC="vjs-straight-editor-guideline";var qp=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(X(Jp)).Ft;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(X(Kp)).Ft;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,X(Jp),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,X(Kp),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,[Gn,Fh,Jp].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,[Gn,Fh,Kp].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var fy="vjs-straight-connector-edit",HC="click",$G="auto";var yy=class{constructor(r){this.editor=r;c(this,"Xc");c(this,"jc");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);ae(e.e);let o=RA(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.jc=(e=>{let t=e.target.closest(X(ls)).Ft;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Wr(r,fy),this.editor.ui.bind(ml,this.Xc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${X(ls)} *`,this.jc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(ml,this.Xc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.jc),this.editor.current!=null&&Or(this.editor.current,fy)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],ue,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var to=class extends Ji{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===HC?new qp(this):new yy(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+ls+" *",target:"."+ls,drag:n=>{let o=n.el.Ft,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(Yr(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=Yr(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(Yr(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(Yr(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,[Gn,Fh,ls].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.Ft=l),this.segmentHandles.push(l)}this.Hx()}this.$mode.$repaintEnded()}Hx(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=$(ve,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[jC,pp].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=$(te,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(to,"type",_n);Lr.set(to.type,to);function kC(){Lr.set(to.type,to)}var Uh="vjs-bezier-handle",xy="vjs-bezier-handle-control-point",WC="vjs-bezier-handle-control-point-1",ZC="vjs-bezier-handle-control-point-2",BG="vjs-bezier-handle-secondary",FG="vjs-bezier-handle-secondary-source",UG="vjs-bezier-handle-secondary-target",JC="vjs-bezier-guideline";var ci=class extends Ji{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,"ft");c(this,"Be");c(this,"Ut");c(this,"kc");c(this,"Hc");c(this,"Dm",{x:0,y:0});c(this,"Nm",{x:0,y:0});this.ft=t.handleSize||Gp,this.$addDragHandler({selector:"."+Uh+" *",target:"."+Uh,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.Be:this.Ut,h=a===0?this.Dm:this.Nm;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.Dm=Object.assign({},this.Be),this.Nm=Object.assign({},this.Ut),!0)})}$activate(e,t){this.Im(),this.Mm(),this.Wx((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.Im(),this.Mm(),this.Vm(),this.Zx()}Wx(e){this.h1=this.$makeAndAppendCircularHandle(this.Be.x,this.Be.y,this.ft,this.ft,[Gn,Uh,xy,WC].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Ut.x,this.Ut.y,this.ft,this.ft,[Gn,Uh,xy,ZC].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Pr,this.lockHandles||(this.h2.style.display=Pr),this.l1=this.Gm(this.kc,this.Be.x,this.Be.y),this.l2=this.Gm(this.Hc,this.Ut.x,this.Ut.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Pr:ht,this.l2.style.display=e?Pr:ht,this.Vm()}Vm(){this.$setElementPosition(this.h1,this.Be.x,this.Be.y);let e=this.lockHandles?this.Be:this.Ut;this.$setElementPosition(this.h2,e.x,e.y)}Gm(e,t,n){let o=$(ve,{width:5,height:5}),s=$(te,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,JC),this.ui.$addClassToElement(o,pp),this.Wc(e,o,t,n),o}Zx(){this.Wc(this.kc,this.l1,this.Be.x,this.Be.y);let e=this.lockHandles?this.Be:this.Ut;this.Wc(this.Hc,this.l2,e.x,e.y)}Wc(e,t,n,o){ln(t,e);let s=n-e.x,a=o-e.y;ce(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}Mm(){this.currentConnector&&(this.Be=this.currentConnector.geometry.segments[0].cp1,this.Ut=this.currentConnector.geometry.segments[0].cp2)}Im(){this.current&&(this.kc={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.Hc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(ci,"type",Oo);var ro=class extends ci{constructor(r,e){super(r,e),this.lockHandles=!0}};c(ro,"type",Xd);Lr.set(ci.type,ci),Lr.set(ro.type,ro);function KC(){Lr.set(ci.type,ci),Lr.set(ro.type,ro)}var z0="selected-vertices",Yh=class extends aa{constructor(e,t,n,o,s){var h,d,u,p,m,g,E,y,x;super(e,t,n,o,s,gn(o.defaults||{},{managedElementsSelector:be(Pt,on)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"Un");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"Zc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"$m");c(this,"mode",xr);if(this.Un=ev(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.Fb=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Kr(Wt,ve,{position:"absolute",left:"0",top:"0"},nf,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Kr(Wt,ve,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Kr(Wt,q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Kr(Wt,q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Kr(Wt,q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Kr(null,He,{position:"relative",width:Rn,height:Rn},nf,{},this.rootElement,!0),this.vertexLayer=Kr(null,He,{left:0,top:0,position:"absolute",width:Rn,height:Rn},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Kr(Wt,ve,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),Wp(this.rootElement,!1),this.Zc=o.elementsDraggable!==!1,this.Zc===!1&&this.canvasElement.setAttribute(QA,at),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new kp({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new ma(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(pa),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||Zi),this.$m=new dp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering,edgeSnap:o.edgeSnap,vl:f=>{L(this.rootElement,In)},Pl:f=>{F(this.rootElement,In)},Cl:f=>{},Ol:f=>{F(this.rootElement,In)}}),new up({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.$m}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(iu),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,tf),wn()&&L(this.rootElement,AT),ii()&&L(this.rootElement,ST),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,rf);let a=(f,b,A)=>{let T=S=>{let R=S.srcElement||S.target;if(R===this.rootElement||R===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(R)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===xo&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,xo,gt),a(Fr,_b),this.panZoom=new da({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,getOffset:f=>this.$getElementPositionInUIRelativeToCanvasOrigin(f),getOffsetRelativeToRoot:f=>zi(f),getSize:f=>this.$getSize(f),elementPositionSetter:(f,b)=>Ce(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.F(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(m=o.pan)==null?void 0:m.useMetaKey,wheel:this.Jx(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(g=o.pan)==null?void 0:g.filter,events:{panStart:()=>{L(this.rootElement,lf),L(document.body,ct)},[gl]:(f,b,A,T,S)=>{this.fire(gl,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[fo]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire(fo,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[oe]:()=>{F(this.rootElement,lf),F(document.body,ct)}},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,X(ou),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.uu(o),this.$dataLoadStart();let l=this.Kd();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)}Kx(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{Ce(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===ut&&(d=d||it(n),l-=d.width),s&&s.alignY&&s.alignY===st&&(d=d||it(n),h-=d.height),Ce(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.Un.length;t++)this.Kx(this.Un[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}Pu(e){this.panZoom.xl()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.Zc!==!1&&(this.mode===xr||this.mode===ai)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.ps(de.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.ps(le.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}Jx(e){var a,l,h,d;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=e.wheel?e.wheel.cssFilter:null;return{filter:s?u=>{let p=u.srcElement||u.target;return!Mt(p,s)}:(d=e.wheel)==null?void 0:d.filter,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.Un.length;e++)this.Un[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.le(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,XC(),kC(),KC()}$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.Rm(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),K(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.Rm({id:z0,active:!0,membership:_a},t)}}$deselect(e){if(super.$deselect(e),K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(z0)}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)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addToDragGroup(e,...t){let n=z(e)?{id:e,active:!0,membership:_a}:Object.assign(e,{membership:_a});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:Bn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}positionElementAt(e,t,n,o,s,a){this.panZoom.positionElementAt(e,t,n,o,s,a)}positionElementAtEventLocation(e,t,n,o){this.panZoom.positionElementAtEventLocation(e,t,n,o)}positionElementAtPageLocation(e,t,n,o,s){this.panZoom.positionElementAtPageLocation(e,t,n,o,s)}destroy(){let e;for(let t=0;t<this.Ba.length;t++)try{e=this.Ba[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,tf),F(this.rootElement,bT),F(this.rootElement,rf),this.le(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire(Pi,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=z(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)}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 vf(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}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.Un.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)}centerOnAndZoom(e,t,n){let o=this.getObjectInfo(e,!1);o.el!=null&&this.panZoom.centerOnAndZoom({bounds:this.viewport.getElementBounds(o.id),fillRatio:t,doNotAnimate:n})}centerOn(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOn({bounds:this.viewport.getElementBounds(t.id)})}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)}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)}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.Bm=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.Bm!=null&&this.off(this.vertexLayer,e,t.Bm)}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=je,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)},[ai]:()=>{this.panZoom.setEnabled(!1)},[Ko]:()=>{this.panZoom.setEnabled(!1)},[Vn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===ai&&!t&&this.model.clearSelection(),this.fire(vn,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(Yh,"type","Surface");var by=class extends bd{fetchUrl(r){na(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?ha:la,o=t||fh(n,e==null?void 0:e.useSvgContainer,e);return j0(this,r,o,e)}renderDiagram(r,e){return new Hp(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?ha:la,s=n||fh(o,e==null?void 0:e.useSvgContainer,{});return H0(this,r,s,e,t)}};function dn(i){return i=i||{},new by(i)}function YG(i,r){i.bind(Ht,e=>{r.$nodeAdded(e)}),i.bind(Xt,e=>{r.$groupAdded(e)}),i.bind(Le,e=>{r.$nodeRemoved(e)}),i.bind(Me,e=>{r.$groupRemoved(e)}),i.bind(dr,e=>{r.$edgeAdded(e)}),i.bind(mt,e=>{r.$edgeRemoved(e)}),i.bind(bn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function j0(i,r,e,t){return X0(i,r,e,(n,o,s,a,l)=>new Yh(n,s||n,a,o,l),t)}function X0(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 mr(i,{generator:s.selection}));let a=s.id||V(),l=t(i,s,o,r,e);return o!=null&&YG(o,l),i.$addRenderer(l,a),l}function H0(i,r,e,t,n){return X0(i,r,e,(o,s,a,l,h)=>new zh(o,a||o,l,s,h,n),t)}var zG=i=>i.map(r=>String.fromCodePoint(r)).join(""),XG=[99,114,101,97,116,101,69,108,101,109,101,110,116];function jG(){return document}var k0=i=>jG()[zG(XG)](i);var zh=class extends aa{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");this.id=o.id||V(),this.$margin=o.margin||cT,this.$horizontalAlign=o.horizontalAlign||o.align||zo,this.$verticalAlign=o.verticalAlign||o.align||zo,o.useSvgContainer?this.$canvas=$(ve,{width:"100%",height:"100%"}):(this.$canvas=k0("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,lT),L(this.$canvas,hT),n.appendChild(this.$canvas),this.setContainer(this.$canvas),Wp(this.rootElement,!1),this.bindAll([Sn,Ms,Lt,Gr,Le,Me,Br,$r,Tn,sb,Is],()=>{this.syncView()}),this.uu(o),this.$dataLoadStart();let h=this.Kd();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.Xe,t=it(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(Ot(this.$canvas)){let m=0,g=0;switch(this.$horizontalAlign){case zo:break;case Jl:m-=(s-d*n)/2;break;case Kl:m+=(s-d*n)/2;break}switch(this.$verticalAlign){case zo:break;case Jl:g-=(a-d*o)/2;break;case Kl:g+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${m}, ${g})`),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 m=(-e.xmin+this.$margin)*d,g=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case Jl:break;case zo:m+=(s-u)/2;break;case Kl:m+=s-u;break}switch(this.$verticalAlign){case Jl:break;case zo:g+=(a-p)/2;break;case Kl:g+=a-p;break}let E=`translateX(${m}px) translateY(${g}px) scale(${d})`;this.$canvas.style.transform=E}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return console.log("toPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromPageLocation(e,t,n){return console.log("fromPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromWindowLocation(e,t,n){return console.log("fromWindowLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}mapEventLocation(e){return console.log("mapEventLocation not necessarily correct - implement in base browser ui"),this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=it(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}}getApparentCanvasLocation(){return console.log("paper get aparent canvas loc - is it correct to return 0,0?"),{x:0,y:0}}addBackground(e){console.log("add background to paper - what needs to happen?")}removeBackground(e){console.log("remove background from paper - what needs to happen?")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function HG(i,r,e,t){let n=dn(e||{}),o=r!=null&&r.useSvgContainer?ha:la,s=fh(o,r==null?void 0:r.useSvgContainer,{}),a=new zh(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function kG(i,r,e){if(Mt(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if(Mt(t,e,i))return t;t=t.parentNode}}}function WG(i){return typeof i=="function"?(i.oo=V(),i.oo):i}function ZG(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=kG(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=Mt(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var tP="start",rP="beforeStart",nP="drag",J0="drop",K0="over",q0="out",iP="stop",W0="katavorio-draggable",JG=W0,KG=10,qG=10,qC=function(){return!0},QG=function(){return!1},QC={delegatedDraggable:"katavorio-delegated-draggable",draggable:JG,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},Z0=[iP,tP,nP,J0,K0,q0,rP],e$=function(){},Xh=function(i,r){if(i!=null){i=!z(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},t$=function(i,r,e){let t=i.srcElement||i.target;return!Mt(t,e.getInputFilterSelector(),r)},eP=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",V());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={};Xh(this.scopes,t=>{e[t]=!0}),Xh(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={};Xh(this.scopes,t=>{e[t]=!0}),Xh(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={};Xh(this.scopes,t=>{e[t]=!0}),Xh(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)}},Q0="notNegative",ew="parent",tw="parentEnclosed";function oP(i,r){let e=null;switch(i){case Q0:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case ew:{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 tw:{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 Ay=class extends eP{constructor(e,t,n){super(e,n);c(this,"Fm");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"H");c(this,"Pe");c(this,"Et");c(this,"Xs");c(this,"js",{x:0,y:0});c(this,"ao",{x:0,y:0});c(this,"Ke");c(this,"ks");c(this,"Hs");c(this,"E");c(this,"Jc");c(this,"lo");c(this,"co");c(this,"zn",!1);c(this,"Ws");c(this,"Yn");c(this,"Kc");c(this,"V");c(this,"ho",[]);c(this,"Um");c(this,"zm");c(this,"yn");c(this,"Ar");c(this,"qc");c(this,"uo",{});c(this,"Zs");c(this,"ye");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.Fm=this.manager.css.draggable,L(this.el,this.Fm),this.downListener=this.Xr.bind(this),this.upListener=this.mr.bind(this),this.moveListener=this.jr.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.Um=t.canDrag||qC,this.zm=t.consumeFilteredEvents,this.yn=t.parent,this.Ar=t.ignoreZoom===!0,this.Ws=t.ghostProxyParent,this.qc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.qx.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.Yn=qC:t.ghostProxy&&typeof t.ghostProxy=="function"?this.Yn=t.ghostProxy:this.Yn=(o,s)=>this.V&&this.V.useGhostProxy?this.V.useGhostProxy(o,s):!1,t.makeGhostProxy?this.Kc=t.makeGhostProxy:this.Kc=o=>this.V&&this.V.makeGhostProxy?this.V.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(W0);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.ho.push(t)}this.eventManager.on(this.el,ue,this.downListener)}qx(e){if(this.Et){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.js.x,o=t.y-this.js.y,s={x:n+this.Xs.x,y:o+this.Xs.y},a=s.x-this.H.x,l=s.y-this.H.y,h=this.Ar?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.ao.x,l+=this.E.parentNode.scrollTop-this.ao.y),a/=h,l/=h,this.moveBy(a,l,e),this.Xs=s,this.js=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}}mr(e){this.H&&(this.H=null,this.eventManager.off(document,ie,this.moveListener),this.eventManager.off(document,oe,this.upListener),this.unmark(e),this.stop(e),this.Et=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.V&&this.V.revertFunction&&this.V.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this.Pe))}Xr(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Um())if(this.Yc(e)&&t$(e,this.el,this.manager)){this.V=null,this.ye=null,this.ho.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=ZG(this.ho,this.el,o);if(s!=null&&(this.V=s[0],this.ye=s[1]),this.V==null||this.ye==null)return;let a=this.V.dragInit?this.V.dragInit(this.ye,e):null;a!=null&&(this.ye=a);let l=1;if(this.clone)if(this.E=this.ye.cloneNode(!0),L(this.E,QC.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.yn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.yn.appendChild(this.E)}else{let h=zi(this.ye,!0),d=this.ye.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.qc&&!this.Ar&&(l=this.qc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.ye;this.consumeStartEvent&&ae(e),this.H=me(e),this.E&&this.E.parentNode&&(this.ao={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this.Pe=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),this.Ke.width=this.Ke.width*l,this.Ke.height=this.Ke.height*l,this.eventManager.on(document,ie,this.moveListener),this.eventManager.on(document,oe,this.upListener),this.Js(rP,{el:this.el,pos:this.Pe,e,drag:this,size:this.Ke})}else this.zm&&ae(e)}jr(e){if(this.H){if(!this.Et){let t=this.Js(tP,{el:this.el,pos:this.Pe,e,drag:this,size:this.Ke});if(t!==!1){if(!this.H)return;this.mark(t),this.Et=!0}else this.abort()}if(this.H){let t=me(e),n=t.x-this.H.x,o=t.y-this.H.y,s=this.Ar?1:this.manager.zoom;this.Xs={x:t.x,y:t.y},this.js={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.ao.x,o+=this.E.parentNode.scrollTop-this.ao.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this.Pe!=null&&this.H!=null?{x:this.H.x-this.Pe.x,y:this.H.y-this.Pe.y}:{x:0,y:0}}mark(e){this.Pe=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.Zs=this.manager.getParentConstrainingRectangle(this.E),this.lo=0,this.co=0}unmark(e){this.zn&&this.Yn(this.ye,this.E)?(this.Jc={x:this.E.offsetLeft-this.lo,y:this.E.offsetTop-this.co},this.E.parentNode.removeChild(this.E),this.E=this.ye):this.Jc=null,F(this.E,this.manager.css.drag),this.zn=!1}moveBy(e,t,n){let o=this.toGrid({x:this.Pe.x+e,y:this.Pe.y+t}),s=this.Qx(o,this.E,this.Zs,this.Ke,{x:this.Pe.x,y:this.Pe.y},n);if(s!=null){if(this.Yn(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.zn){let a=this.Kc(this.ye);L(a,QC.ghostProxy),this.Ws?(this.Ws.appendChild(a),this.ks=zi(this.ye.parentNode),this.Hs=zi(this.Ws),this.lo=this.ks.x-this.Hs.x,this.co=this.ks.y-this.Hs.y):this.ye.parentNode.appendChild(a),this.E=a,this.zn=!0}s=o}else this.zn&&(this.E.parentNode.removeChild(this.E),this.E=this.ye,this.zn=!1,this.ks=null,this.Hs=null,this.lo=0,this.co=0);this.manager.positionSetter(this.E,{x:s.x+this.lo,y:s.y+this.co}),this.Js(nP,{el:this.el,pos:s,e:n,drag:this,size:this.Ke,originalPos:this.Pe,viewport:this.Zs})}}abort(){this.H!=null&&this.mr()}getDragElement(e){return e?this.ye||this.el:this.E||this.el}stop(e,t){if(t||this.Et){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.Ke]),this.Js(iP,{el:this.E,pos:this.Jc||o,finalPos:o,e,drag:this,selection:n,size:this.Ke,originalPos:{x:this.Pe.x,y:this.Pe.y},viewport:this.Zs})}else this.Et||this.V.dragAbort&&this.V.dragAbort(this.ye)}Js(e,t){let n=null;if(this.V&&this.V[e])n=this.V[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:KG/2,thresholdY:qG/2};return this.V!=null&&this.V.grid!=null&&(e.grid=this.V.grid,this.V.snapThreshold!=null&&(e.thresholdX=this.V.snapThreshold,e.thresholdY=this.V.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 se(e,t,s,a)}}setUseGhostProxy(e){this.Yn=e?qC:QG}Qx(e,t,n,o,s,a){return this.V!=null&&this.V.constrainFunction&&typeof this.V.constrainFunction=="function"?this.V.constrainFunction(e,t,n,o,s,a):e}Yc(e){for(let t in this.uo){let n=this.uo[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=WG(e);this.uo[n]=[o=>{let s=o.srcElement||o.target,a;return z(e)?a=Mt(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.oo:e;delete this.uo[t]}clearAllFilters(){this.uo={}}addSelector(e,t){e.selector&&(t?this.ho.unshift(e):this.ho.push(e))}destroy(){this.eventManager.off(this.el,ue,this.downListener),this.eventManager.off(document,ie,this.moveListener),this.eventManager.off(document,oe,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"],n$=r$.join(","),Qp=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 fe,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}}}eb(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<Z0.length;t++){let n=Z0[t];e.events[n]=r[n]||e$}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.po==null){let t=this.eb(e),n=new Ay(r,t,this);return L(r,QC.delegatedDraggable),r.po=n,n}else return r.po}destroyDraggable(r){r.po&&(r.po.destroy(),delete r.po)}};var rw=15,nw=10,iw="markers",ow="lineStyle",sw="sourceArrow",aw="targetArrow",lw="bothArrows",hw="plain",cw="dashed";function i$(i){let r=(i==null?void 0:i.arrowWidth)||rw,e=(i==null?void 0:i.arrowLength)||nw,t=(i==null?void 0:i.lineStyleProperty)||ow,n=(i==null?void 0:i.markersProperty)||iw;return[{property:t,mappings:{[hw]:{},[cw]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[sw]:{overlays:[{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]},[aw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}}]},[lw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}},{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var sP={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.");sP.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(sP.get(i))}};var aP=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new Qp({positionGetter:o=>hn(o),positionSetter:(o,s)=>Jt(o,s),getSize:o=>it(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=oP(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 o$(i){dw?i():lP.push(i)}var lP=[],dw=!1,Sy=()=>{dw=!0;for(let i=0;i<lP.length;i++)lP[i]()},hP=class{constructor(r){this.templateHolder=r;c(this,"c",0)}Ym(){this.c--,this.c<=0&&Sy()}add(r){this.c++,na({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.Ym()},error:e=>{this.Ym()}})}ensureNotEmpty(){this.c<=0&&Sy()}},uw="_vjs_templates",s$=()=>{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(uw);if(r)Sy();else{r=document.createElement("div"),r.style.display="none",r.id=uw,document.body.appendChild(r);let e=new hP(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 Sy()};i()};s$();var pw="vjs-test-support-container",a$=1e-11;function mw(){let i=document.getElementById(pw);return i==null&&(i=document.createElement("div"),i.id=pw,document.body.appendChild(i)),i}var em=[],l$=[];function Ty(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):mw().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",em.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function h$(i,r){for(let e=0;e<i.length;e++)Ty(i[e],r)}function c$(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 tm(i){c$(document.querySelectorAll(i))}function d$(){for(let i=0;i<em.length;i++)em[i].el.parentNode.removeChild(em[i].el);em.length=0,tm("circle"),tm(".vjs-node"),tm(".vjs-surface-canvas"),tm("svg"),tm(".vjs-lasso"),mw().innerHTML=""}function u$(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 hs(i){return i.connector.canvas}function Gt(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 cP(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 gw(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 Ew={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function p$(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return Ar(i,r)}function fw(i,r,e){let t=i;e=e||{},e.start&&e.start(),un(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=p$();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",Ew),e.up&&e.up()}function yw(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);un(i,s);let a=Ew;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 xw(i,r,e,t){let n=Ty("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 m$(i,r,e,t){let n=dn(i),o,s;if(r!=null){let l=xw(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return l$.push(a),a}function g$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Gt(t);i.surface.trigger(t.querySelector("path"),"click",n)}function E$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Gt(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function f$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Gt(t);var o=t.querySelector("path");i.surface.trigger(o,ue,n),i.surface.trigger(o,"mouseup",n)}function y$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Gt(t);var o=t.querySelector("path");i.surface.trigger(o,ue,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,ue,n),i.surface.trigger(o,"mouseup",n)}function rm(i,r,e){let t=i.surface.getRenderedConnection(r),n=hs(t),o=Gt(n);i.surface.trigger(n.querySelector("path"),e,o)}function dP(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jh(i.surface,t,1,1)}function nm(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);un(i.surface,t,1),Hh(i.surface,t,1)}function x$(i,r,e){vy(i,r,Yn,1,e)}function b$(i,r,e){vy(i,r,"mouseover",1,e)}function A$(i,r,e){vy(i,r,"mouseout",1,e)}function vy(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);kh(i.surface,s,e,t,n)}function jh(i,r,e=1,t=1){let n=Gt(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 bw(i,r,e=1){let t=Gt(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 un(i,r,e=1,t){kh(i,r,cs,e,t)}function Hh(i,r,e=1,t){kh(i,r,no,e,t)}function kh(i,r,e,t=1,n){let o=Gt(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 uP(i,r,e,t,n=1){let o=Ar(t.x,t.y),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,n||1,null),r.dispatchEvent(s)}function S$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jh(i.surface,t,2,1)}function T$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);bw(i.surface,t,1)}function v$(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+"]");jh(i.surface,o,1,1)}function C$(i,r){jh(i.surface,r,1,1)}function P$(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+"]");bw(i.surface,o,1)}function Aw(i,r){un(i.surface,r),Hh(i.surface,r)}function O$(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+"]");Aw(i,o)}function _$(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+"]");un(i.surface,o),Hh(i.surface,o),un(i.surface,o),Hh(i.surface,o)}function R$(i,r,e){let t=i.surface.getRenderedConnection(r),n=Vl(t,e||"lbl");jh(i.surface,n.contentElements[0],1,1)}function L$(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(qr(on,e));o&&jh(i.surface,o,1,1)}function pP(i,r,e,t,n){t=t||{};let o=i,s;Xi(e)?s=Gt(e,null,n):s=cP(i.$getCanvasElement(),e.x,e.y);let a=i.model.getAllEdges().length;t.start&&t.start(),un(i,r),t.down&&t.down();let l=Object.values(i.$_connMap).find(u=>u.edge.transient);if(l!=null&&o.trigger(hs(l).childNodes[0],tt,s),o.trigger(document,Yn,s),t.move){let u=i.model.getAllEdges().filter(m=>m.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}o.trigger(document,no,s);let h=i.model.getAllEdges()[a],d=h?i.getRenderedConnection(h.id):null;return t.up&&t.up(d),d}function Sw(i,r,e,t,n,o){let s=i.getObjectInfo(t,!1);if(s.el){n=n||{};let a=i.getRenderedConnection(r.id),l=e?".vjs-connector-source-drag":".vjs-connector-target-drag",h=a.connector.canvas.querySelector(l);n.start&&n.start(),un(i,h),n.down&&n.down();let d=Gt(s.el,null,o);i.trigger(document,"mousemove",d),n.move&&n.move(),i.trigger(document,"mouseup",d),n.up&&n.up(a)}else throw`Cannot resolve drag element ${t}`}function mP(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Gt(r);o.trigger(r,cs,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,oe,l),n.afterUp&&n.afterUp()}function gP(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Gt(r,o);s.trigger(r,cs,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,Yn,gw(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,no,null),n&&n.afterUp&&n.afterUp()}function Tw(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=Gt(r,s);a.trigger(r,cs,p),o&&o.afterDown&&o.afterDown();for(let m=0;m<n;m++)a.trigger(document,Yn,gw(p,d,u,s)),o&&o.afterMove&&o.afterMove(m),d+=l,u+=h;a.trigger(document,no),o&&o.afterUp&&o.afterUp()}var w$=typeof document!="undefined",Cy=w$?"ontouchstart"in document.documentElement:!1,cs=Cy?"touchstart":"mousedown",Yn=Cy?"touchmove":"mousemove",no=Cy?"touchend":"mouseup";function Ar(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function vw(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function Cw(i,r,e,t){let n=i.vertexLayer;EP(i,n.parentElement.parentElement,r,e,t)}function EP(i,r,e,t,n){n&&n.start&&n.start();let o=i.toPageLocation(e.x,e.y),s=i.toPageLocation(t.x,t.y);o.x-=window.scrollX,s.x-=window.scrollX,o.y-=window.scrollY,s.y-=window.scrollY,uP(i,r,cs,o),n&&n.down&&n.down(),uP(i,document,Yn,s),n&&n.move&&n.move(),uP(i,document,no,s),n&&n.up&&n.up()}var di={addDiv:Ty,addDivs:h$,cleanup:d$,delta:u$,DOWN_EVENT:cs,UP_EVENT:no,MOVE_EVENT:Yn,isTouchDevice:Cy,makeEvent:Gt,makeEventAt:Ar,nudgeEvent:vw,getEdgeCanvas:hs,defaultEventManager:new fe,dragElementBy:(i,r,e,t)=>{gP(di.defaultEventManager,i,r,e,t)},attachToSurface:i=>new im(i.model,i),create:(i,r,e,t)=>{let n=m$(i,r,e,t);return new im(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:Cw,lassoOnElement:EP,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=di);function Pw(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(),un(i,r),o.down&&o.down(),i.trigger(document,Yn,l),o.move&&o.move(),i.trigger(document,no,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var im=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"Qc");c(this,"consoleOutput","");this.eventManager=new fe,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.Qc==null&&(this.Qc=new ma(this.surface)),this.Qc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=xw(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){fw(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){fw(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return hs(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;mP(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;mP(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)mP(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)gP(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){gP(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){Tw(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)Tw(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||co,null)}mo(r){let e;if(eT(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}Xm(r,e){return{sourceEl:this.mo(r),targetEl:this.mo(e)}}dragConnection(r,e,t,n){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:o,targetEl:s}=this.Xm(r,e);return pP(this.surface,o,s,t,n)}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.Xm(r,e);return Pw(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.mo(r);return pP(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.mo(e);return pP(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.mo(e);return Pw(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return yw(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return yw(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n){Sw(this.surface,r,!1,e,t,n)}relocateEdgeSource(r,e,t,n){Sw(this.surface,r,!0,e,t,n)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Gt(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?cP(r,n,o,t):Gt(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=cP(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=Gt(n.el);return e||t?vw(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){dP(this,r)}clickOnNode(r){dP(this,r)}clickOnVertex(r){dP(this,r)}dblClickOnVertex(r){T$(this,r)}rightClickOnVertex(r){S$(this,r)}tapOnVertex(r){nm(this,r)}tapOnNode(r){nm(this,r)}tapOnGroup(r){nm(this,r)}dblTapOnVertex(r){nm(this,r),nm(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){x$(this,r,e)}mouseoverOnVertex(r,e){b$(this,r,e)}mouseoutOnVertex(r,e){A$(this,r,e)}contextmenuOnVertex(r,e){vy(this,r,gt,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)un(this.surface,this.canvas,e),Hh(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){un(this.surface,this.canvas,t,{x:r,y:e}),Hh(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){kh(this.surface,this.canvas,Yn,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){kh(this.surface,this.canvas.parentNode,cs,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){kh(this.surface,this.canvas,no,1,{x:r,y:e})}lasso(r,e,t){Cw(this.surface,r,e,t)}lassoOnElement(r,e,t,n){EP(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){C$(this,r)}clickOnElementInsideVertex(r,e){v$(this,r,e)}dblClickOnElementInsideVertex(r,e){P$(this,r,e)}tapOnElement(r){Aw(this,r)}tapOnElementInsideVertex(r,e){O$(this,r,e)}dblTapOnElementInsideVertex(r,e){_$(this,r,e)}mousedownOnElement(r){un(this.surface,r)}clickOnEdge(r){g$(this,r)}dblClickOnEdge(r){E$(this,r)}tapOnEdge(r){let e=Ke(r)?r.id:r;f$(this,e)}dblTapOnEdge(r){let e=Ke(r)?r.id:r;y$(this,e)}jm(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(),m=p.x,g=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(m+13)*s,f=(g+13)*s,b=m+a*s+u.width/2,A=g+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=Ar(E,y);this.surface.trigger(h,di.DOWN_EVENT,T),t&&this.surface.trigger(h,di.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,di.MOVE_EVENT,Ar(x,f));let S=Ar(b,A);if(this.surface.trigger(d,di.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let R=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(R,di.DOWN_EVENT,S),this.surface.trigger(R,di.UP_EVENT,S)}else this.surface.trigger(d,di.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.jm(r,e,!1,t)}tapFromPalette(r,e,t){this.jm(r,e,!0,t)}mousedownOnEdge(r){rm(this,r,ue)}mouseupOnEdge(r){rm(this,r,oe)}mouseoverOnEdge(r){rm(this,r,tt)}mouseoutOnEdge(r){rm(this,r,et)}contextmenuOnEdge(r){rm(this,r,gt)}clickOnOverlay(r,e){R$(this,r,e)}clickOnPort(r,e){L$(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=Gt(r);this.eventManager.trigger(r,cs,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,no,Ar(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=Ty("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 Yp(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<a$,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var fP="vjs-chart-background",La="vjs-chart-plot-background",Wh="vjs-chart-body",yP="vjs-chart-series",xP="vjs-chart-legend",om="vjs-chart-legend-item",bP="vjs-chart-legend-label",AP="vjs-chart-legend-dot",wa="vjs-chart-axis",sm="vjs-chart-x-axis",am="vjs-chart-y-axis",Py="vjs-chart-axis-labels",Oy="vjs-chart-axis-line",_y="vjs-chart-axis-title",SP="vjs-chart-y-axis-title",TP="vjs-chart-x-axis-title",vP="vjs-column-chart",CP="vjs-column-chart-column",PP="vjs-bar-chart",OP="vjs-bar-chart-bar",pn="vjs-chart-point",lm="vjs-chart-point-hit-area",_P="vjs-bubble-chart",RP="vjs-bubble-chart-point",LP="vjs-scatter-chart",wP="vjs-scatter-chart-point",hm="vjs-area-chart-area",DP="vjs-chart-title",NP="vjs-chart-subtitle",Zh="vjs-chart-crosshair",Jh="vjs-chart-crosshair-label",IP="vjs-chart-crosshair-value-axis",MP="vjs-chart-crosshair-category-axis",Ry="vjs-chart-empty",VP="vjs-chart-axis-scale-label",Ly="vjs-chart-gridlines",wy="vjs-chart-gridline",GP="vjs-line-chart",$P="vjs-area-chart";var D$=6;function Dy(i,r,e){let t=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),n=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);t<r&&(t+=e),n>i&&(n-=e);let o=(t-n)/e;return{maxScale:t,minScale:n,stepCount:o,step:e}}function N$(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function I$(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function _w(i,r,e,t){let n=Dy(i,r,e),o=n.stepCount-t,s=Math.abs(o);if(o>0){let l=N$(n.step),h=Dy(i,r,l);Math.abs(h.stepCount-t)<s&&(n=h)}else if(o<0){let l=I$(n.step),h=Dy(i,r,l);Math.abs(h.stepCount-t)<s&&(n=h)}let a=[];for(let l=n.minScale;l<=n.maxScale;l+=n.step)a.push(l);return Object.assign(n,{steps:a,range:n.maxScale-n.minScale,dataMin:i,dataMax:r})}function Kh(i,r,e=D$){let t=r-i,n=Rw(t);return _w(i,r,n,e)}function BP(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 Rw(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function ui(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=$(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function ds(i,r,e,t){let n=k(Je,r,e,t);return n.innerHTML=i,n}function M$(i,r){let e=eh(i);$t(i,r,e.y)}function qh(i,r){let e=eh(i);$t(i,e.x,r)}function $t(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function mn(i){return i.type==="value"}function FP(i){return i.type==="category"}function Qh(){return{x:0,y:0,width:0,height:0}}function Ny(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 UP(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(ke(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end");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 Ow(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 cm(i,r,e,t,n,o){let s=$(Je,{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=$("tspan",{fill:Ow(t),stroke:Ow(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=$("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="​",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function Iy(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",Wt),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}`),V$(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${Zh}, .${Jh}`).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("*")),m=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(m),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 V$(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var G$="vertical",My="horizontal",Lw=10,Vy="left",Gy="center",YP="right",ec="top",tc="middle",$y="bottom",dm=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||Lw,this.orientation=r.orientation||My,this.align=r.align||Gy,this.valign=r.valign||$y,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=ui(12,"normal","normal","sans-serif",r.font)}};var um="chart:load",zP="No data",XP="Could not draw chart";var ww="vjs-chart-exporter-hamburger",$$="vjs-chart-exporter-menu",B$="vjs-chart-exporter-menu-item",Dw="vjs-chart-exporter-hamburger-open",pm=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"go",!1);this.eventManager=new fe,this.eventManager.on(r.container,W,X(ww),t=>{t.stopPropagation(),this.go?this.eh():this.tb()})}rb(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"},ww),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"},$$),[{label:"Download JPG",type:es},{label:"Download PNG",type:_h},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=Jr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},B$);a.innerText=s.label,this.eventManager.on(a,Ue,()=>{this.nb(s.type),this.eh()}),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.go&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.go&&(n(),this.hideTimeout=setTimeout(()=>{this.eh(),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()})}tb(){this.menu.style.display="block",this.go=!0,L(this.hamburger,Dw);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`}eh(){this.menu.style.display="none",this.go=!1,F(this.hamburger,Dw)}nb(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:ba.svg});this.km(n,`${e}.svg`)}else{let t=r===es?ba.jpeg:ba.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===es?"jpg":"png";this.km(n.url,`${e}.${o}`,!0)})}}km(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 F$="0 0 32 30",U$="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",Nw="0 0 32 32",Y$="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",z$="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",X$="vjs-chart-zoom-controls",j$="vjs-chart-zoom-button",By=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new fe}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},X$),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:Y$,viewBox:Nw,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:z$,viewBox:Nw,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:U$,viewBox:F$,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"},j$);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,Ue,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 Iw="#FFFFFF",H$=15,Mw=15,k$="middle",W$="left",Z$="right",Vw="top",rc="bottom",Da="middle",HP="start",kP="end",jP="#AAAAAA",Gw=1,$w="#FFFFFFCC";function J$(i){return i=i||{},{gridLineColor:i.gridLineColor||jP,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||jP,legendOutlineWidth:i.legendOutlineWidth||Gw,legendBackgroundColor:i.legendBackgroundColor||$w}}var io=class extends It{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"j",1);c(this,"th",[.5,3]);c(this,"Hm",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"Wm");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,"nh");c(this,"ih");c(this,"Zm",!1);c(this,"Ks");c(this,"Xn");c(this,"yt");t=t||{},this.nh=t.width,this.ih=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new Cs:new Uc(this.$defaultColor),this.style=J$(t.style),this.Wm=t.backgroundColor||Iw;let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=hr(n)?n:{};this.Ks=new gm(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||zP,this.$errorMessage=XP,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Zm&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||Mw,this.$eventManager=new fe,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||Vw):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||H$;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new pm(o),t.zoom&&t.zoom.enabled!==!1&&(this.Hm=!0,this.th=t.zoom.range||[.05,3],this.j=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.Xn=new Fy(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return My(this,e,t).svg}exportImage(e,t){let n=My(this,e.width,e.height);Yf(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.Xn&&this.Xn.destroy(),this.yt&&this.yt.parentElement&&this.yt.parentElement.removeChild(this.yt)}$draw(){this.Zm=!0,this.container.innerHTML="";let e=this.nh,t=this.ih;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=$(ve,{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"},fP,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])}),FC(n,!0),this.ib()}}ib(){if(this.Ks||this.Xn){let e="row";this.yt==null?this.yt=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.yt.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.yt),this.Xn&&this.Xn.render(this.yt,e),this.Ks&&this.Ks.rb(this.yt)}}$drawEmptyMessage(e,t,n,o){let s=k(Je,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Ly,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(Je,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Ly,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(Je,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},DP,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Iu(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($t(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(g=>g.getBBox().width),m=Math.max(...p);u.forEach((g,E)=>{g.setAttribute("x",`${(m-p[E])/2}`)})}if(this.$showSubtitle){let u=k(Je,{y:s.height+10,x:0,"dominant-baseline":"hanging"},NP,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),m=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;$t(u,m,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);$t(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.Wm}$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.j}setZoom(e){return this.Hm&&(this.j=Math.max(this.th[0],Math.min(this.th[1],e)),this.ob()),this.j}ob(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.j})`))}};var Na=class{load(r){r()}hasData(){return!1}},nc=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()}},Em=class extends nc{constructor(e,t){super(e);this.chart=e;this.data=t}},fm=class extends nc{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){na({url:this.url,dataType:zt,success:t=>{this.data=t,super.load(e)}})}},ic=class extends nc{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=ra(()=>{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(Ve,o),t.bind(Le,o),t.bind(Ht,o),t.bind(Re,o),t.bind(Me,o),t.bind(Xt,o),t.bind(pt,o),t.bind(mt,o),t.bind(dr,o),t.bind(jt,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 Qt=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,"Jm");c(this,"K");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.Jm=n,this.K=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.Jm];t!=null&&ys(this.K,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(Qt,"type","record");var Bw=1,Fw="rangeStart",Uw="values",Yw="minValues",zw="maxValues",Xw="label",jw="id",Ia=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?Bw:e.step,this.rangeStartField=e.rangeStartField||Fw,this.$valuesField=e.valuesField||Uw,this.$minValuesField=e.minValuesField||Yw,this.$maxValuesField=e.maxValuesField||zw,this.$labelField=e.labelField||Xw,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||jw,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]||V(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new Qt(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.Km(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.sb(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}sb(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.Km(e)}Km(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(Ia,"type","array");var Ma=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 Qt({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Ma,"type","collation");var Va=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 Qt({valueField:"value",id:V(),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(Va,"type","summing");var oc=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 Qt({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(oc,"type","summing-collation");var Ga=class extends io{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,"qm");this.dataSource=new Na,this.qm=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.qm.forEach(e=>{if(e.type==null||e.type===Qt.type){let t=new Qt(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===Ia.type){let t=new Ia(e,this);this.$__series.push(t)}else if(e.type===Ma.type){let t=new Ma(e);this.$__series.push(t)}else if(e.type===oc.type){let t=new oc(e);this.$__series.push(t)}else if(e.type===Va.type){let t=new Va(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new Em(this,e.data):e.dataSource?this.dataSource=new ic(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new fm(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof ic&&(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(mm,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var zn="data-vjs-chart-category",dt="data-vjs-chart-series",ym="data-vjs-chart-stack",xm="data-vjs-chart-stack-total",bm="data-vjs-chart-value",K$="data-vjs-filter",sr="start",mi="end",gi=2,Am=5,WP=10,Uy=20,Sm=14,ZP=14,Tm="normal",JP="normal";var Hw=["b","br","em","strong"],kw="vjs-tooltip",Ba=class extends Zo{constructor(e){super({formatter:(t,n)=>fc(t)?aA(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Ur.type&&Hw.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${Hw.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==Fs.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=$("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=$("tspan");return n.style.fontStyle="italic",n;case"br":let o=$("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},$a=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,"oh");c(this,"Qm");var n,o,s,a;if(this.$parser=new Ba(e),this.$valueSuffix=e.valueSuffix,this.oh=e.timeout==null?2500:e.timeout,this.g=$(q,{"pointer-events":"none"},{},kw),Ot(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=$("defs"),l.insertBefore(h,l.childNodes[0]));let d=$("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=$("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=$(ve),this.root.appendChild(this.g);this.bg=$(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=$(Je,t),this.g.appendChild(this.text),r.appendChild(this.root)}eg(){this.oh!==-1&&(clearTimeout(this.Qm),this.Qm=setTimeout(()=>this.hide(),this.oh))}$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=it(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};Ce(this.root,h),this.eg()}}showAtPageLocation(r,e,t){this.$renderTooltip(t);let n=this.g.parentElement.getBoundingClientRect(),o={x:r.x-n.x,y:r.y-n.y};Ce(this.root,o),this.eg()}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},Fa=class extends $a{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)}},vm=class extends $a{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var sc=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",[])}},Ua=class extends Ga{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,"Kr");c(this,"$tooltip");c(this,"$maxLabelSize");this.Kr=t.tooltip,this.axisLineSize=t.axisLineSize||gi,this.yAxisPadding=t.yAxisPadding||WP,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||Am,this.dataSource=new Na,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(tt,X(pn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(dt),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(et,X(pn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(tt,X(am),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(dt),10);this.setFocusedSeries(s)}),this.$bind(et,X(am),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}ab(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},_y,t)),e.titleElement=k(q,{},"",t),e.title!=null&&($t(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),us(e.title,{"text-anchor":this.tg(e),"dominant-baseline":"hanging",y:this.legend.padding},[Ry,TP].join(" "),e.titleElement))}tg(e){return e.titleAlign===HP?"start":e.titleAlign===kP?"end":"middle"}lb(e,t){e.titleElement=k(Je,{y:0,x:0,"text-anchor":this.tg(e)},[Ry,SP].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(Q,`${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===sr)s.forEach(u=>u[0].setAttribute(Q,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(Q,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(Q,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(Ee,`${l}`);let h=e.position===sr?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(Q)}, ${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},_y,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},xP,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((m,g)=>{let E=k(q,{[dt]:g},am,s),y=k(Je,{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"},bP,E);y.innerHTML=m.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:m.color,x:l,y:d},AP,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===Vy?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(Te,`${u.width+2*p}`),a.setAttribute(De,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let m=this.legend.align===$y?t/2-u.width/2:this.legend.align===Gy?this.margin:t-u.width-this.margin,g=this.legend.valign===By?n-u.height-this.margin:this.legend.valign===ec?o:(n-u.height)/2;$t(s,m,g)}}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 mn(e)?this.cb(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.Kr&&(this.$tooltip=this.$createTooltip(e,this.Kr)),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.$getBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a=k(q,{},Wh,e),l=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,a);l.addEventListener(ie,h=>{let d=this.$fromEventLocation(h);this.$onMouseMove(d)}),l.addEventListener(db,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(a,!0,MP,h=>!mn(h)),this.seriesElements=this.$realisedSeries.map((h,d)=>k(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[dt]:`${d}`},yP,a)),this.$drawCrosshairs(a,!1,IP,h=>mn(h))}$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,`${Zh} ${n}`,e),p;if(l.showLabel!==!1&&mn(s)){let m={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&&(m["font-style"]=l.labelFont.style),p=us("",m,Jh,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,`${Zh} ${n}`,e),p;if(l.showLabel!==!1&&mn(s)){let m={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&&(m["font-style"]=l.labelFont.style),p=us("",m,Jh,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:m,xAxesAtEnd:g}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===rc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?Qh():b.getBBox(),T=(N,G)=>{let J=0;for(let ye=0;ye<N.length;ye++){let j=N[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style},[wa,lm].join(" "),G),j.labelsElement=k(q,{},Oy,j.element),j.labels=this.$getAxisLabels(j,!0),this.ab(j,j.element);let ge=j.element.getBBox();j.dim=ge,J+=ge.height+this.yAxisPadding}};T(m,a),T(g,l);let S=this.$titlePlacement===rc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===ec?A.height:0):x+y.height+this.titlePadding,R=()=>{let N=a.getBBox(),G=l.getBBox(),J=n-this.margin-y.height-this.titlePadding-N.height-this.yAxisPadding-this.yAxisPadding-G.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===tc?0:A.height)-this.margin,ye=(this.$titlePlacement===rc?this.margin:S)+N.height+this.yAxisPadding+(this.legend.valign===ec?A.height:0);return{chartHeight:J,chartY:ye}},{chartHeight:v,chartY:O}=R(),P=(N,G)=>{let J=0;for(let ye=0;ye<N.length;ye++){let j=N[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style},[wa,hm].join(" "),G),j.labelsElement=k(q,{},Oy,j.element),j.labels=this.$getAxisLabels(j,!1),this.lb(j,{y:O,height:v});let ge=j.element.getBBox();$t(j.element,J-ge.x,0),j.dim=ge,J+=ge.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===tc&&this.legend.align===Gy?this.legend.padding+A.width:0);$t(o,C,0);let _=C+I.width+this.yAxisPadding,w=t-_-(this.legend.visible&&!this.legend.floating&&this.legend.valign===tc&&this.legend.align===YP?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let N=s.getBBox();$t(s,_+w+this.yAxisPadding-N.width,0),w-=this.margin+this.yAxisPadding+N.width}p.forEach(N=>{N.lineElement!=null&&N.lineElement.setAttribute(Te,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let B=_+w,D=O+v,M={chartWidth:w,chartHeight:v,chartX:_,chartY:O,chartEndX:B,chartEndY:D,width:t,height:n};if(this.$titlePlacement===rc){let N=l.getBBox(),G=this.legend.visible&&!this.legend.floating&&this.legend.valign!==ec&&this.legend.valign!==tc?A.height+this.legend.padding:0;if(G>0){let ye=M.chartY+M.chartHeight+this.yAxisPadding+N.height+this.legend.padding;qh(b,ye)}let J=M.chartY+M.chartHeight+this.yAxisPadding+N.height+G+this.titlePadding-this.margin;$t(E,0,J)}for(let N=0;N<p.length;N++){let G=p[N].titleAlign==="start"?0:p[N].titleAlign==="end"?w:w/2;$t(p[N].titleElement,G,p[N].title!=null?p[N].titlePadding:0),mn(p[N])?this.hb(M,p[N]):this.db(M,p[N].labels);let J=this.$maxLabelSize*M.height;if(UP(p[N].labels,J,"height","width")){let j=p[N].labelsElement.getBBox();p[N].titleElement&&qh(p[N].titleElement,j.y+j.height+this.yAxisPadding);let{chartHeight:ge,chartY:Ge}=R();M.chartHeight=ge,M.chartY=Ge,M.chartEndY=Ge+ge}}$t(a,M.chartX,S),$t(l,M.chartX,M.chartY+M.chartHeight+this.yAxisPadding),qh(o,M.chartY),qh(s,M.chartY);for(let N=0;N<h.length;N++)h[N].lineElement&&h[N].lineElement.setAttribute(De,`${M.chartHeight}`),mn(h[N])?this.ub(M,h[N].labels,h[N]):this.pb(M,h[N].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let N=0;N<p.length;N++){let G=p[N];G.showGrid&&this.mb(e,M,G)}if(this.$getYAxisType()==="value")for(let N=0;N<h.length;N++){let G=h[N];G.showGrid&&this.gb(e,M,G)}}if(this.legend.visible&&this.legend.floating){let N=M.chartX+M.chartWidth-b.getBBox().width,G=M.chartY;$t(b,N,G)}return M}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}db(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Q,`${o*n+n/2}`)}hb(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(Q,`${n[o]}`)}pb(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Ee,`${o*n+n/2}`)}cb(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=us(this.$computeScaleLabel(s,e),l,VP,e.labelsElement);n.push(h)}),n}ub(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(Ee,`${o[s]}`)}mb(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},wy,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},Dy,s)}gb(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},wy,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},Dy,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(mn(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(Q,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?Iy(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ba({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d+g.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-g.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+g.height/2:y=this.dim.chartY+this.dim.chartHeight-5-g.height/2,a.setAttribute(Q,`${E}`),a.setAttribute(Ee,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(Te,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(Q,`${this.dim.chartX+u*d}`)}s.setAttribute(Ee,`${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(mn(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(Ee,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?Iy(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ba({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d-g.height-5>this.dim.chartY?d-5:d+g.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-g.width/2:y=this.dim.chartX+5+g.width/2,a.setAttribute(Q,`${y}`),a.setAttribute(Ee,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(De,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(Ee,`${this.dim.chartY+u*d}`)}s.setAttribute(Q,`${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(mn(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 Yy(i){return typeof i=="number"&&Number.isFinite(i)}function Ww(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Yy(e)||!Yy(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function Zw(i){let r={};for(let e of i)if(e!=null)for(let[t,n]of Object.entries(e)){let o=Ww(t,n);if(o==null)continue;let s=r[t];s==null?r[t]={min:o.min,max:o.max,stepCount:n.stepCount}:r[t]={min:Math.min(s.min,o.min),max:Math.max(s.max,o.max),stepCount:s.stepCount}}return r}function Jw(i,r){if(r==null)return i;let e=Ei({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Yy(n.min),a=Yy(n.max);if(!s&&!a)continue;let l=o!=null?{min:o.min,max:o.max}:{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(l.min=n.min),a&&(l.max=n.max),e[t]=l.min<=l.max?l:{min:l.max,max:l.min}}return e}function Kw(i){let r={};for(let[e,t]of Object.entries(i)){let n=Ww(e,t);n!=null&&(t.stepCount!=null?r[e]=BP(n.min,n.max,t.stepCount):r[e]=Kh(n.min,n.max))}return r}function KP(i){let r=Zw(i.extentsList),e=Jw(r,i.overrides),t=Kw(e);return{extents:e,scales:t}}var zy=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||xe}getDomainExtents(){return{}}},oo=class extends zy{get $inverted(){return this.chart.$getXAxisType()!=="value"}},qP=new Map;function Ya(i,r){qP.set(i,r)}function QP(i,r,e){if(qP.has(i))return qP.get(i)(r,e)}function za(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var Xa=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 q$(i){return{position:i,showLine:!1,showGrid:!0,id:xe}}function Q$(i){return{position:i,id:xe}}var Xn=class extends Ua{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"Eo");c(this,"fo");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"rg");this.Eo=t.valueAxis,this.fo=t.categoryAxis,this.$inverted=t.inverted===!0,this.rg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=QP(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}Eb(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=us(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return FP(e)?this.Eb(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}fb(){var t,n,o;this.$categoryAxes=[];let e=this.fo==null?[Q$(this.$inverted?mi:sr)]:Array.isArray(this.fo)?this.fo:[this.fo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:V(),h={showLine:a.showLine===!0,lineSize:a.lineSize||gi,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Da,titlePadding:((o=a.title)==null?void 0:o.padding)||Uy,position:a.position||(this.$inverted?mi:sr),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:pi(ZP,JP,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}yb(){if(this.$realisedSeries.length>0){let e=new Cs,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 Qt(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.K.has(u);t.forEach(g=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:g[0],min:E[g[2]],max:E[g[3]]}):d.addValue({id:g[0],value:E[g[1]]}))});let m=d;p&&(m.stack=u),a.push(m)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.rg)&&this.yb(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){var s,a;this.fb(),this.xb();let e=this.$plots.map(l=>l.getDomainExtents()),t=(a=(s=this.$valueAxes)==null?void 0:s[0])==null?void 0:a.domain,n={};(this.$valueAxesMin!=null||this.$valueAxesMax!=null)&&(n[t]={min:this.$valueAxesMin,max:this.$valueAxesMax});let{scales:o}=KP({extentsList:e,overrides:n});this.$valueAxes.forEach(l=>{l.scale=o[l.domain],l.stackedScale=l.stackedDomain!=null&&o[l.stackedDomain]!=null?o[l.stackedDomain]:l.scale})}xb(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.Eo==null?[q$(this.$inverted?sr:mi)]:Array.isArray(this.Eo)?this.Eo:[this.Eo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:V(),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",min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||gi,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||gi,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Da,titlePadding:((o=a.title)==null?void 0:o.padding)||Uy,position:a.position||(this.$inverted?sr:mi),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:pi(Sm,Tm,"normal","sans-serif",a.font),scale:new sc,stackedScale:new sc,crosshair:a.crosshair,isPercent:d,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===sr),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===mi)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===sr),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===mi)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===sr),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===mi)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===sr),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===mi)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}Ab(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.Ab(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(zn),10),a=e.getAttribute(ym),l=e.getAttribute(xm),h=e.getAttribute(bm);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],m=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:m,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new Fa(e,t)}};var eB=yr(),qw={square:(i,r,e)=>$(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>$(ze,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>$(te,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function Cm(i,r,e,t,n,o){let s=i.markerType||"circle",l=(qw[s]||qw.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function ac(i,r,e,t){let o=eB.template(V(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var ja=class extends Ua{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,"W");c(this,"Z");c(this,"ng");c(this,"ig");this.axisFont=pi(Sm,Tm,"normal","sans-serif",t.axisFont),this.W=t.xAxis||{},this.Z=t.yAxis||{},this.ng=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.ig=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(tt,X(cm),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(dt)),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},m={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(m,{x:.5,y:1.1},a,h)}}),this.$bind(et,X(cm),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new vm(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new Xa(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.W.min!==void 0?this.W.min:1/0,max:this.W.max!==void 0?this.W.max:-1/0},this.$yAxisDimensions={min:this.Z.min!==void 0?this.Z.min:1/0,max:this.Z.max!==void 0?this.Z.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.nh||500,o=this.ih||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,m=p/n*e,g=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-m),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+m),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-g),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+g)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.Z.inverted===!0,min:this.Z.min,max:this.Z.max,showLine:this.Z.showLine===!0,lineSize:this.Z.lineSize||gi,dim:Qh(),element:k(q,{},[wa,hm].join(" "),e),id:this.Z.id||V(),position:this.Z.position||sr,titleAlign:((t=this.Z.title)==null?void 0:t.align)||Da,title:(n=this.Z.title)==null?void 0:n.text,titlePadding:((o=this.Z.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.Z.showGrid!==!1,gridLineSize:this.Z.lineSize||2,useSeriesTotal:!1,font:((s=this.Z)==null?void 0:s.font)||this.axisFont,scale:Kh(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.Z.crosshair,labelPrefix:this.Z.labelPrefix,labelSuffix:this.Z.labelSuffix,labelFormatter:this.Z.labelFormatter},this.xAxis={domain:"x",inverted:this.W.inverted===!0,min:this.W.min,max:this.W.max,showLine:this.W.showLine===!0,lineSize:this.W.lineSize||gi,dim:Qh(),element:k(q,{},[wa,lm].join(" "),e),id:this.W.id||V(),position:this.W.position||sr,titleAlign:((a=this.W.title)==null?void 0:a.align)||Da,title:((l=this.W.title)==null?void 0:l.text)||"",titlePadding:((h=this.W.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.W.showGrid!==!1,gridLineSize:this.W.lineSize||2,useSeriesTotal:!1,font:((d=this.W)==null?void 0:d.font)||this.axisFont,scale:Kh(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.W.crosshair,labelPrefix:this.W.labelPrefix,labelSuffix:this.W.labelSuffix,labelFormatter:this.W.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,m=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(m=1-m);let g=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=m*this.dim.chartHeight,x;if(n.marker)x=ac(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:g});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=ac(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:g,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=Cm(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:g});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Yc(g).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(dt,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(pn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push($(ze,{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(),[dt]:o.toString(),"data-idx":l.toString()},null,cm))}}),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.ig,Math.max(this.ng,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 Qw=.8,eD=50,tD=10;function tB(i){return i.type===wr.type}var Xy=class Xy extends oo{constructor(e,t){super(e,t,Xy.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 m=p.stack||"default",g=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof g=="number"&&Number.isFinite(g)&&(u[m]+=g)}),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?tD: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?Qw:this.options.fillRatio)*s,d=this.options.maxBarSize==null?eD: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=[],m=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),m+=y});let g=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+g)/m,f=g/m,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:m,value:E[1]})}else{let x=(E[1]+g)/m,f=g/m,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:m,value:E[1]})}g+=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=[],m=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),m+=x});let g=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+g)/E.range,b=g/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:m,value:y[1]})}else{let f=(y[1]+g)/E.range,b=g/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:m,value:y[1]})}g+=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 m=s[p],g=n==null?m.values[h].min:Math.max(n,m.values[h].min),E=o==null?m.values[h].max:Math.min(m.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(g-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:m.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(g-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:m.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?[CP,pn].join(" "):[OP,pn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[zn]:`${d.category}`,[dt]:`${d.series}`};d.stackId!=null&&(u[ym]=d.stackId),d.stackTotal!=null&&(u[xm]=`${d.stackTotal}`),d.value!=null&&(u[bm]=`${d.value}`),rB(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;um(a,l,h,n.color,{size:11},t)}}};c(Xy,"type","bar");var wr=Xy;Ya(wr.type,(i,r)=>new wr(i,r));function rB(i,r,e,t,n,o,s,a){let l,h=a||Am;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(te,Object.assign({d:l},e),t,n)}var eO=class extends Xn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:lc.type,options:e.plotOptions||{}}})),L(r,$P),this.$bind(ie,X(Wh),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(ie,X(dm),t=>{let n=t.target,o=parseInt(n.getAttribute(dt),10);this.setFocusedSeries(o)}),this.$bind(et,X(dm,Wh),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},jy=class jy extends oo{constructor(e,t){var n,o;super(e,t,jy.type);this.chart=e;c(this,"stacked");c(this,"sh");c(this,"og");c(this,"ah");c(this,"xt",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.sh=((n=t.marker)==null?void 0:n.enabled)!==!1,this.og=((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 m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.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.xt.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.xt[h]=this.xt[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.xt[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.xt[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.xt[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.xt[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.xt.length;l++){let h=s[l].color,d=`M ${this.xt[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(te,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[dt]:`${l}`},dm,this.chart.seriesElements[l])}this.ah=k(ze,{cx:"0",cy:"0",r:this.og/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.sh!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.xt[s][e];return ce(this.ah,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Yc(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.sh!==!1&&ce(this.ah,{visibility:"hidden"})}};c(jy,"type","area");var lc=jy;Ya(lc.type,(i,r)=>new lc(i,r));var tO=class extends Xn{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,vP)}};var rO=class extends Xn{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,PP)}};var Hy=class extends Xa{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))}},nO=class extends ja{constructor(e,t){super(e,t);this.options=t;L(e,_P)}$dualValueInit(e){e.series.forEach(t=>{let n=new Hy(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,m=n+Math.sqrt(p)*(d-n);return Math.max(n,m)}$getDataPointCssClass(){return RP}};var rD="vjs-gauge-chart",nD="vjs-gauge-track",iO="vjs-gauge-zone",iD="vjs-gauge-tick",oD="vjs-gauge-label",sD="vjs-gauge-needle",aD="vjs-gauge-needle-pivot",oO=class extends io{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"bt");c(this,"yo");c(this,"_e");c(this,"be");c(this,"_t");c(this,"lh");this.bt=(n=t.startAngle)!=null?n:-135,this.yo=(o=t.endAngle)!=null?o:135,this._e=(s=t.innerRadius)!=null?s:.8,this.be=(a=t.min)!=null?a:0,this._t=(l=t.max)!=null?l:100,this.lh=(h=t.value)!=null?h:this.be,L(e,rD),this.$draw()}getValue(){return this.lh}setValue(e){this.lh=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 ye;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.$getBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a=j=>(j-90)*Math.PI/180,l=a(this.bt),h=a(this.yo),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),m=Math.sin(l),g=[h];for(let j=-180;j<=270;j+=90){let ge=a(j);j>=this.bt&&j<=this.yo&&g.push(ge)}g.forEach(j=>{d=Math.min(d,Math.cos(j)),u=Math.max(u,Math.cos(j)),p=Math.min(p,Math.sin(j)),m=Math.max(m,Math.sin(j))});let E=.9,y=u-d,x=m-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*(m+p)/2,T=f*this._e,S=b+f*Math.cos(l),R=A+f*Math.sin(l),v=b+f*Math.cos(h),O=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),_=A+T*Math.sin(l),w=this.yo-this.bt<=180?0:1,B=[`M ${S} ${R}`,`A ${f} ${f} 0 ${w} 1 ${v} ${O}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${_}`,"Z"].join(" ");k(te,{d:B,fill:"#EEE",stroke:"#CCC","stroke-width":1},nD,e);let D=(ye=this.getValue())!=null?ye:this.be,M=Math.max(this.be,Math.min(this._t,D)),N=this._t-this.be,G=this.yo-this.bt,J=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((j,ge)=>{let Ge=j.from,Xe=j.to;if(!J){if(M<=Ge)return;Xe=Math.min(Xe,M)}let Bt=this.bt+(Ge-this.be)/N*G,ar=this.bt+(Xe-this.be)/N*G,er=a(Bt),Dr=a(ar),ao=b+f*Math.cos(er),Ha=A+f*Math.sin(er),ka=b+f*Math.cos(Dr),Wa=A+f*Math.sin(Dr),Za=b+T*Math.cos(Dr),Ja=A+T*Math.sin(Dr),Om=b+T*Math.cos(er),_m=A+T*Math.sin(er),cc=ar-Bt<=180?0:1,Rm=[`M ${ao} ${Ha}`,`A ${f} ${f} 0 ${cc} 1 ${ka} ${Wa}`,`L ${Za} ${Ja}`,`A ${T} ${T} 0 ${cc} 0 ${Om} ${_m}`,"Z"].join(" "),dc=j.color;if(j.gradient){let re=e.querySelector("defs");re||(re=k("defs",{},"",e),e.insertBefore(re,e.firstChild));let $e=`vjs-gauge-gradient-${ge}-${Math.round(Math.random()*1e6)}`,Dt=k("linearGradient",{id:$e,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",re);j.gradient.stops.forEach(Ft=>{k("stop",{offset:`${Ft.offset}%`,"stop-color":Ft.color},"",Dt)}),dc=`url(#${$e})`}k(te,{d:Rm,fill:dc,stroke:"none"},`${iO} ${iO}-${ge}`,e)}),this.options.ticks){let j=[];if(this.options.ticks.values)j=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let ge=this.be;ge<=this._t;ge+=this.options.ticks.interval)j.push(ge);j.forEach(ge=>{let Ge=this.bt+(ge-this.be)/N*G,Xe=a(Ge),Bt=f*.95,ar=b+f*Math.cos(Xe),er=A+f*Math.sin(Xe),Dr=b+Bt*Math.cos(Xe),ao=A+Bt*Math.sin(Xe);k(te,{d:`M ${ar} ${er} L ${Dr} ${ao}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},iD,e)})}if(this.options.labels){let j=[];if(this.options.labels.values)j=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Ge=this.be;Ge<=this._t;Ge+=this.options.labels.interval)j.push(Ge);let ge=f+(this.options.labels.distance||0);j.forEach(Ge=>{let Xe=this.bt+(Ge-this.be)/N*G,Bt=a(Xe),ar=b+ge*Math.cos(Bt),er=A+ge*Math.sin(Bt);k("text",{x:ar,y:er,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},oD,e).textContent=Ge.toString()})}if(J){let j=this.bt+(M-this.be)/N*G,ge=a(j),Ge=f*.9,Xe=f*.05,Bt=ge-Math.PI/2,ar=ge+Math.PI/2,er=b+Ge*Math.cos(ge),Dr=A+Ge*Math.sin(ge),ao=b+Xe*Math.cos(Bt),Ha=A+Xe*Math.sin(Bt),ka=b+Xe*Math.cos(ar),Wa=A+Xe*Math.sin(ar),Za=`M ${ao} ${Ha} L ${er} ${Dr} L ${ka} ${Wa} Z`;k(te,{d:Za,fill:"#333",stroke:"#000","stroke-width":1},sD,e);let Ja=Xe*1.5;k("circle",{cx:b,cy:A,r:Ja,fill:"#333",stroke:"#666","stroke-width":1},aD,e)}}};var sO=class extends Xn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:hc.type,options:t.plotOptions||{}}}));this.options=t;L(e,GP)}},ky=class ky extends oo{constructor(e,t){super(e,t,ky.type);this.chart=e;c(this,"sg");c(this,"ag");this.sg=t.stacked===!0,this.ag=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.sg&&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 m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.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)}}Sb(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=dE(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}Tb(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 m,g;return this.$inverted?(g=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,m=u):(m=t.chartWidth*((p-a.minScale)/a.range),g=u),{cx:m,cy:g}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let m=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let g=s[p],E=g.values[u].max,{cx:y,cy:x}=d(m,E);if(E!=null&&this.lg(s[p],y,x,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),g.isRangeSeries()){let{cx:f,cy:b}=d(m,g.values[u].min);g.values[u].min!=null&&this.lg(s[p],f,b,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:g.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,m=l[u].findIndex(E=>E.hasValue),g=this.ag?this.Sb(l[u],m):this.Tb(l[u],m);k(te,{stroke:p,"stroke-width":"1",d:g,fill:"none",[dt]:`${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 m=h[u].findIndex(E=>E.hasValue),g=`M ${h[u].slice(m).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(te,{stroke:p,"stroke-width":"1",d:g,fill:"none",[dt]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}lg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=ac(e.marker,null,{[zn]:`${l}`,[dt]:`${h}`},[pn].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=Cm(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[zn]:`${l}`,[dt]:`${h}`},[pn].join(" "));return d.appendChild(u),u}}};c(ky,"type","line");var hc=ky;Ya(hc.type,(i,r)=>new hc(i,r));var lD="vjs-pie-chart",Pm="vjs-pie-slice",aO="vjs-pie-slice-selected",lO=class extends Ga{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"xo");c(this,"bo");c(this,"ch");c(this,"jn");c(this,"_e");c(this,"$realisedSeries",[]);c(this,"Kr");this.xo=t.selectedCategory,this.ch=t.selectedSliceOffset||10,this.jn=t.interactive===!0,this._e=t.innerRadius,this.Kr=t.tooltip,this.$init(),this.load(t),this.$bind(tt,X(Pm),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.cg(o),p=this.$dataPoints[d],m=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},m,p.label,{value:p.value})}}),this.$bind(et,X(Pm),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,X(Pm),n=>{if(this.jn){let o=n.target,{category:s,series:a}=this.cg(o);this.vb(s,a,o)}}),L(e,lD)}cg(e){let t=parseInt(e.getAttribute(zn),10),n=parseInt(e.parentNode.getAttribute(dt),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.Kr&&(this.$tooltip=new Fa(e,this.Kr)),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.$getBackgroundColor(),"data-z-index":"0"},La,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,m)=>{let g=$(q,{"data-name":p.label,"data-category":m});e.appendChild(g);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,R="";if(p.p>=1)if(this._e!=null){let G=this._e*h;R=`M ${a.x+h} ${a.y}
|
|
136
|
+
</svg>`,this.eventManager.on(s,Ue,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 Iw="#FFFFFF",H$=15,Mw=15,k$="middle",W$="left",Z$="right",Vw="top",rc="bottom",Da="middle",HP="start",kP="end",jP="#AAAAAA",Gw=1,$w="#FFFFFFCC";function J$(i){return i=i||{},{gridLineColor:i.gridLineColor||jP,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||jP,legendOutlineWidth:i.legendOutlineWidth||Gw,legendBackgroundColor:i.legendBackgroundColor||$w}}var io=class extends It{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"j",1);c(this,"th",[.5,3]);c(this,"Hm",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"Wm");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,"nh");c(this,"ih");c(this,"Zm",!1);c(this,"Ks");c(this,"Xn");c(this,"yt");t=t||{},this.nh=t.width,this.ih=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new vs:new Uc(this.$defaultColor),this.style=J$(t.style),this.Wm=t.backgroundColor||Iw;let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=hr(n)?n:{};this.Ks=new pm(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||zP,this.$errorMessage=XP,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Zm&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||Mw,this.$eventManager=new fe,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||Vw):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||H$;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new dm(o),t.zoom&&t.zoom.enabled!==!1&&(this.Hm=!0,this.th=t.zoom.range||[.05,3],this.j=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.Xn=new By(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return Iy(this,e,t).svg}exportImage(e,t){let n=Iy(this,e.width,e.height);Uf(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.Xn&&this.Xn.destroy(),this.yt&&this.yt.parentElement&&this.yt.parentElement.removeChild(this.yt)}$draw(){this.Zm=!0,this.container.innerHTML="";let e=this.nh,t=this.ih;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=$(ve,{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"},fP,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])}),FC(n,!0),this.ib()}}ib(){if(this.Ks||this.Xn){let e="row";this.yt==null?this.yt=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.yt.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.yt),this.Xn&&this.Xn.render(this.yt,e),this.Ks&&this.Ks.rb(this.yt)}}$drawEmptyMessage(e,t,n,o){let s=k(Je,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Ry,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(Je,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Ry,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(Je,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},DP,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Du(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($t(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(g=>g.getBBox().width),m=Math.max(...p);u.forEach((g,E)=>{g.setAttribute("x",`${(m-p[E])/2}`)})}if(this.$showSubtitle){let u=k(Je,{y:s.height+10,x:0,"dominant-baseline":"hanging"},NP,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),m=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;$t(u,m,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);$t(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.Wm}$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.j}setZoom(e){return this.Hm&&(this.j=Math.max(this.th[0],Math.min(this.th[1],e)),this.ob()),this.j}ob(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.j})`))}};var Na=class{load(r){r()}hasData(){return!1}},nc=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()}},mm=class extends nc{constructor(e,t){super(e);this.chart=e;this.data=t}},gm=class extends nc{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){na({url:this.url,dataType:zt,success:t=>{this.data=t,super.load(e)}})}},ic=class extends nc{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=ra(()=>{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(Ve,o),t.bind(Le,o),t.bind(Ht,o),t.bind(Re,o),t.bind(Me,o),t.bind(Xt,o),t.bind(pt,o),t.bind(mt,o),t.bind(dr,o),t.bind(jt,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 Qt=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,"Jm");c(this,"K");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.Jm=n,this.K=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.Jm];t!=null&&fs(this.K,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(Qt,"type","record");var Bw=1,Fw="rangeStart",Uw="values",Yw="minValues",zw="maxValues",Xw="label",jw="id",Ia=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?Bw:e.step,this.rangeStartField=e.rangeStartField||Fw,this.$valuesField=e.valuesField||Uw,this.$minValuesField=e.minValuesField||Yw,this.$maxValuesField=e.maxValuesField||zw,this.$labelField=e.labelField||Xw,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||jw,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]||V(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new Qt(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.Km(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.sb(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}sb(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.Km(e)}Km(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(Ia,"type","array");var Ma=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 Qt({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Ma,"type","collation");var Va=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 Qt({valueField:"value",id:V(),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(Va,"type","summing");var oc=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 Qt({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(oc,"type","summing-collation");var Ga=class extends io{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,"qm");this.dataSource=new Na,this.qm=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.qm.forEach(e=>{if(e.type==null||e.type===Qt.type){let t=new Qt(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===Ia.type){let t=new Ia(e,this);this.$__series.push(t)}else if(e.type===Ma.type){let t=new Ma(e);this.$__series.push(t)}else if(e.type===oc.type){let t=new oc(e);this.$__series.push(t)}else if(e.type===Va.type){let t=new Va(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new mm(this,e.data):e.dataSource?this.dataSource=new ic(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new gm(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof ic&&(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(um,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var zn="data-vjs-chart-category",dt="data-vjs-chart-series",Em="data-vjs-chart-stack",fm="data-vjs-chart-stack-total",ym="data-vjs-chart-value",K$="data-vjs-filter",sr="start",pi="end",mi=2,xm=5,WP=10,Fy=20,bm=14,ZP=14,Am="normal",JP="normal";var Hw=["b","br","em","strong"],kw="vjs-tooltip",Ba=class extends Wo{constructor(e){super({formatter:(t,n)=>fc(t)?sA(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Ur.type&&Hw.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${Hw.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==Bs.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=$("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=$("tspan");return n.style.fontStyle="italic",n;case"br":let o=$("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},$a=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,"oh");c(this,"Qm");var n,o,s,a;if(this.$parser=new Ba(e),this.$valueSuffix=e.valueSuffix,this.oh=e.timeout==null?2500:e.timeout,this.g=$(q,{"pointer-events":"none"},{},kw),Ot(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=$("defs"),l.insertBefore(h,l.childNodes[0]));let d=$("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=$("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=$(ve),this.root.appendChild(this.g);this.bg=$(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=$(Je,t),this.g.appendChild(this.text),r.appendChild(this.root)}eg(){this.oh!==-1&&(clearTimeout(this.Qm),this.Qm=setTimeout(()=>this.hide(),this.oh))}$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=it(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};Ce(this.root,h),this.eg()}}showAtPageLocation(r,e,t){this.$renderTooltip(t);let n=this.g.parentElement.getBoundingClientRect(),o={x:r.x-n.x,y:r.y-n.y};Ce(this.root,o),this.eg()}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},Fa=class extends $a{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)}},Sm=class extends $a{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var sc=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",[])}},Ua=class extends Ga{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,"Kr");c(this,"$tooltip");c(this,"$maxLabelSize");this.Kr=t.tooltip,this.axisLineSize=t.axisLineSize||mi,this.yAxisPadding=t.yAxisPadding||WP,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||xm,this.dataSource=new Na,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(tt,X(pn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(dt),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(et,X(pn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(tt,X(om),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(dt),10);this.setFocusedSeries(s)}),this.$bind(et,X(om),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}ab(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},Oy,t)),e.titleElement=k(q,{},"",t),e.title!=null&&($t(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),ds(e.title,{"text-anchor":this.tg(e),"dominant-baseline":"hanging",y:this.legend.padding},[_y,TP].join(" "),e.titleElement))}tg(e){return e.titleAlign===HP?"start":e.titleAlign===kP?"end":"middle"}lb(e,t){e.titleElement=k(Je,{y:0,x:0,"text-anchor":this.tg(e)},[_y,SP].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(Q,`${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===sr)s.forEach(u=>u[0].setAttribute(Q,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(Q,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(Q,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(Ee,`${l}`);let h=e.position===sr?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(Q)}, ${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},Oy,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},xP,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((m,g)=>{let E=k(q,{[dt]:g},om,s),y=k(Je,{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"},bP,E);y.innerHTML=m.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:m.color,x:l,y:d},AP,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===My?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(Te,`${u.width+2*p}`),a.setAttribute(De,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let m=this.legend.align===Gy?t/2-u.width/2:this.legend.align===Vy?this.margin:t-u.width-this.margin,g=this.legend.valign===$y?n-u.height-this.margin:this.legend.valign===ec?o:(n-u.height)/2;$t(s,m,g)}}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 mn(e)?this.cb(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.Kr&&(this.$tooltip=this.$createTooltip(e,this.Kr)),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.$getBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a=k(q,{},Wh,e),l=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,a);l.addEventListener(ie,h=>{let d=this.$fromEventLocation(h);this.$onMouseMove(d)}),l.addEventListener(cb,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(a,!0,MP,h=>!mn(h)),this.seriesElements=this.$realisedSeries.map((h,d)=>k(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[dt]:`${d}`},yP,a)),this.$drawCrosshairs(a,!1,IP,h=>mn(h))}$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,`${Zh} ${n}`,e),p;if(l.showLabel!==!1&&mn(s)){let m={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&&(m["font-style"]=l.labelFont.style),p=ds("",m,Jh,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,`${Zh} ${n}`,e),p;if(l.showLabel!==!1&&mn(s)){let m={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&&(m["font-style"]=l.labelFont.style),p=ds("",m,Jh,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:m,xAxesAtEnd:g}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===rc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?Qh():b.getBBox(),T=(N,G)=>{let J=0;for(let ye=0;ye<N.length;ye++){let j=N[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style},[wa,sm].join(" "),G),j.labelsElement=k(q,{},Py,j.element),j.labels=this.$getAxisLabels(j,!0),this.ab(j,j.element);let ge=j.element.getBBox();j.dim=ge,J+=ge.height+this.yAxisPadding}};T(m,a),T(g,l);let S=this.$titlePlacement===rc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===ec?A.height:0):x+y.height+this.titlePadding,R=()=>{let N=a.getBBox(),G=l.getBBox(),J=n-this.margin-y.height-this.titlePadding-N.height-this.yAxisPadding-this.yAxisPadding-G.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===tc?0:A.height)-this.margin,ye=(this.$titlePlacement===rc?this.margin:S)+N.height+this.yAxisPadding+(this.legend.valign===ec?A.height:0);return{chartHeight:J,chartY:ye}},{chartHeight:v,chartY:O}=R(),P=(N,G)=>{let J=0;for(let ye=0;ye<N.length;ye++){let j=N[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style},[wa,am].join(" "),G),j.labelsElement=k(q,{},Py,j.element),j.labels=this.$getAxisLabels(j,!1),this.lb(j,{y:O,height:v});let ge=j.element.getBBox();$t(j.element,J-ge.x,0),j.dim=ge,J+=ge.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===tc&&this.legend.align===Vy?this.legend.padding+A.width:0);$t(o,C,0);let _=C+I.width+this.yAxisPadding,w=t-_-(this.legend.visible&&!this.legend.floating&&this.legend.valign===tc&&this.legend.align===YP?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let N=s.getBBox();$t(s,_+w+this.yAxisPadding-N.width,0),w-=this.margin+this.yAxisPadding+N.width}p.forEach(N=>{N.lineElement!=null&&N.lineElement.setAttribute(Te,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let B=_+w,D=O+v,M={chartWidth:w,chartHeight:v,chartX:_,chartY:O,chartEndX:B,chartEndY:D,width:t,height:n};if(this.$titlePlacement===rc){let N=l.getBBox(),G=this.legend.visible&&!this.legend.floating&&this.legend.valign!==ec&&this.legend.valign!==tc?A.height+this.legend.padding:0;if(G>0){let ye=M.chartY+M.chartHeight+this.yAxisPadding+N.height+this.legend.padding;qh(b,ye)}let J=M.chartY+M.chartHeight+this.yAxisPadding+N.height+G+this.titlePadding-this.margin;$t(E,0,J)}for(let N=0;N<p.length;N++){let G=p[N].titleAlign==="start"?0:p[N].titleAlign==="end"?w:w/2;$t(p[N].titleElement,G,p[N].title!=null?p[N].titlePadding:0),mn(p[N])?this.hb(M,p[N]):this.db(M,p[N].labels);let J=this.$maxLabelSize*M.height;if(UP(p[N].labels,J,"height","width")){let j=p[N].labelsElement.getBBox();p[N].titleElement&&qh(p[N].titleElement,j.y+j.height+this.yAxisPadding);let{chartHeight:ge,chartY:Ge}=R();M.chartHeight=ge,M.chartY=Ge,M.chartEndY=Ge+ge}}$t(a,M.chartX,S),$t(l,M.chartX,M.chartY+M.chartHeight+this.yAxisPadding),qh(o,M.chartY),qh(s,M.chartY);for(let N=0;N<h.length;N++)h[N].lineElement&&h[N].lineElement.setAttribute(De,`${M.chartHeight}`),mn(h[N])?this.ub(M,h[N].labels,h[N]):this.pb(M,h[N].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let N=0;N<p.length;N++){let G=p[N];G.showGrid&&this.mb(e,M,G)}if(this.$getYAxisType()==="value")for(let N=0;N<h.length;N++){let G=h[N];G.showGrid&&this.gb(e,M,G)}}if(this.legend.visible&&this.legend.floating){let N=M.chartX+M.chartWidth-b.getBBox().width,G=M.chartY;$t(b,N,G)}return M}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}db(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Q,`${o*n+n/2}`)}hb(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(Q,`${n[o]}`)}pb(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Ee,`${o*n+n/2}`)}cb(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=ds(this.$computeScaleLabel(s,e),l,VP,e.labelsElement);n.push(h)}),n}ub(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(Ee,`${o[s]}`)}mb(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},Ly,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},wy,s)}gb(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},Ly,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},wy,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(mn(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(Q,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?Ny(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ba({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d+g.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-g.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+g.height/2:y=this.dim.chartY+this.dim.chartHeight-5-g.height/2,a.setAttribute(Q,`${E}`),a.setAttribute(Ee,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(Te,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(Q,`${this.dim.chartX+u*d}`)}s.setAttribute(Ee,`${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(mn(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(Ee,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?Ny(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ba({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d-g.height-5>this.dim.chartY?d-5:d+g.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-g.width/2:y=this.dim.chartX+5+g.width/2,a.setAttribute(Q,`${y}`),a.setAttribute(Ee,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(De,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(Ee,`${this.dim.chartY+u*d}`)}s.setAttribute(Q,`${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(mn(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 Uy(i){return typeof i=="number"&&Number.isFinite(i)}function Ww(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Uy(e)||!Uy(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function Zw(i){let r={};for(let e of i)if(e!=null)for(let[t,n]of Object.entries(e)){let o=Ww(t,n);if(o==null)continue;let s=r[t];s==null?r[t]={min:o.min,max:o.max,stepCount:n.stepCount}:r[t]={min:Math.min(s.min,o.min),max:Math.max(s.max,o.max),stepCount:s.stepCount}}return r}function Jw(i,r){if(r==null)return i;let e=gi({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Uy(n.min),a=Uy(n.max);if(!s&&!a)continue;let l=o!=null?{min:o.min,max:o.max}:{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(l.min=n.min),a&&(l.max=n.max),e[t]=l.min<=l.max?l:{min:l.max,max:l.min}}return e}function Kw(i){let r={};for(let[e,t]of Object.entries(i)){let n=Ww(e,t);n!=null&&(t.stepCount!=null?r[e]=BP(n.min,n.max,t.stepCount):r[e]=Kh(n.min,n.max))}return r}function KP(i){let r=Zw(i.extentsList),e=Jw(r,i.overrides),t=Kw(e);return{extents:e,scales:t}}var Yy=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||xe}getDomainExtents(){return{}}},oo=class extends Yy{get $inverted(){return this.chart.$getXAxisType()!=="value"}},qP=new Map;function Ya(i,r){qP.set(i,r)}function QP(i,r,e){if(qP.has(i))return qP.get(i)(r,e)}function za(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var Xa=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 q$(i){return{position:i,showLine:!1,showGrid:!0,id:xe}}function Q$(i){return{position:i,id:xe}}var Xn=class extends Ua{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"Eo");c(this,"fo");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"rg");this.Eo=t.valueAxis,this.fo=t.categoryAxis,this.$inverted=t.inverted===!0,this.rg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=QP(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}Eb(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=ds(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return FP(e)?this.Eb(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}fb(){var t,n,o;this.$categoryAxes=[];let e=this.fo==null?[Q$(this.$inverted?pi:sr)]:Array.isArray(this.fo)?this.fo:[this.fo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:V(),h={showLine:a.showLine===!0,lineSize:a.lineSize||mi,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Da,titlePadding:((o=a.title)==null?void 0:o.padding)||Fy,position:a.position||(this.$inverted?pi:sr),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:ui(ZP,JP,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}yb(){if(this.$realisedSeries.length>0){let e=new vs,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 Qt(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.K.has(u);t.forEach(g=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:g[0],min:E[g[2]],max:E[g[3]]}):d.addValue({id:g[0],value:E[g[1]]}))});let m=d;p&&(m.stack=u),a.push(m)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.rg)&&this.yb(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){var s,a;this.fb(),this.xb();let e=this.$plots.map(l=>l.getDomainExtents()),t=(a=(s=this.$valueAxes)==null?void 0:s[0])==null?void 0:a.domain,n={};(this.$valueAxesMin!=null||this.$valueAxesMax!=null)&&(n[t]={min:this.$valueAxesMin,max:this.$valueAxesMax});let{scales:o}=KP({extentsList:e,overrides:n});this.$valueAxes.forEach(l=>{l.scale=o[l.domain],l.stackedScale=l.stackedDomain!=null&&o[l.stackedDomain]!=null?o[l.stackedDomain]:l.scale})}xb(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.Eo==null?[q$(this.$inverted?sr:pi)]:Array.isArray(this.Eo)?this.Eo:[this.Eo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:V(),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",min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||mi,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||mi,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Da,titlePadding:((o=a.title)==null?void 0:o.padding)||Fy,position:a.position||(this.$inverted?sr:pi),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:ui(bm,Am,"normal","sans-serif",a.font),scale:new sc,stackedScale:new sc,crosshair:a.crosshair,isPercent:d,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===sr),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===pi)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===sr),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===pi)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===sr),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===pi)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===sr),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===pi)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}Ab(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.Ab(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(zn),10),a=e.getAttribute(Em),l=e.getAttribute(fm),h=e.getAttribute(ym);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],m=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:m,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new Fa(e,t)}};var eB=yr(),qw={square:(i,r,e)=>$(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>$(ze,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>$(te,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function Tm(i,r,e,t,n,o){let s=i.markerType||"circle",l=(qw[s]||qw.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function ac(i,r,e,t){let o=eB.template(V(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var ja=class extends Ua{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,"W");c(this,"Z");c(this,"ng");c(this,"ig");this.axisFont=ui(bm,Am,"normal","sans-serif",t.axisFont),this.W=t.xAxis||{},this.Z=t.yAxis||{},this.ng=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.ig=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(tt,X(lm),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(dt)),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},m={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(m,{x:.5,y:1.1},a,h)}}),this.$bind(et,X(lm),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new Sm(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new Xa(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.W.min!==void 0?this.W.min:1/0,max:this.W.max!==void 0?this.W.max:-1/0},this.$yAxisDimensions={min:this.Z.min!==void 0?this.Z.min:1/0,max:this.Z.max!==void 0?this.Z.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.nh||500,o=this.ih||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,m=p/n*e,g=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-m),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+m),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-g),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+g)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.Z.inverted===!0,min:this.Z.min,max:this.Z.max,showLine:this.Z.showLine===!0,lineSize:this.Z.lineSize||mi,dim:Qh(),element:k(q,{},[wa,am].join(" "),e),id:this.Z.id||V(),position:this.Z.position||sr,titleAlign:((t=this.Z.title)==null?void 0:t.align)||Da,title:(n=this.Z.title)==null?void 0:n.text,titlePadding:((o=this.Z.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.Z.showGrid!==!1,gridLineSize:this.Z.lineSize||2,useSeriesTotal:!1,font:((s=this.Z)==null?void 0:s.font)||this.axisFont,scale:Kh(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.Z.crosshair,labelPrefix:this.Z.labelPrefix,labelSuffix:this.Z.labelSuffix,labelFormatter:this.Z.labelFormatter},this.xAxis={domain:"x",inverted:this.W.inverted===!0,min:this.W.min,max:this.W.max,showLine:this.W.showLine===!0,lineSize:this.W.lineSize||mi,dim:Qh(),element:k(q,{},[wa,sm].join(" "),e),id:this.W.id||V(),position:this.W.position||sr,titleAlign:((a=this.W.title)==null?void 0:a.align)||Da,title:((l=this.W.title)==null?void 0:l.text)||"",titlePadding:((h=this.W.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.W.showGrid!==!1,gridLineSize:this.W.lineSize||2,useSeriesTotal:!1,font:((d=this.W)==null?void 0:d.font)||this.axisFont,scale:Kh(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.W.crosshair,labelPrefix:this.W.labelPrefix,labelSuffix:this.W.labelSuffix,labelFormatter:this.W.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,m=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(m=1-m);let g=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=m*this.dim.chartHeight,x;if(n.marker)x=ac(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:g});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=ac(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:g,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=Tm(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:g});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Yc(g).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(dt,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(pn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push($(ze,{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(),[dt]:o.toString(),"data-idx":l.toString()},null,lm))}}),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.ig,Math.max(this.ng,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 Qw=.8,eD=50,tD=10;function tB(i){return i.type===wr.type}var zy=class zy extends oo{constructor(e,t){super(e,t,zy.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 m=p.stack||"default",g=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof g=="number"&&Number.isFinite(g)&&(u[m]+=g)}),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?tD: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?Qw:this.options.fillRatio)*s,d=this.options.maxBarSize==null?eD: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=[],m=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),m+=y});let g=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+g)/m,f=g/m,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:m,value:E[1]})}else{let x=(E[1]+g)/m,f=g/m,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:m,value:E[1]})}g+=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=[],m=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),m+=x});let g=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+g)/E.range,b=g/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:m,value:y[1]})}else{let f=(y[1]+g)/E.range,b=g/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:m,value:y[1]})}g+=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 m=s[p],g=n==null?m.values[h].min:Math.max(n,m.values[h].min),E=o==null?m.values[h].max:Math.min(m.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(g-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:m.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(g-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:m.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?[CP,pn].join(" "):[OP,pn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[zn]:`${d.category}`,[dt]:`${d.series}`};d.stackId!=null&&(u[Em]=d.stackId),d.stackTotal!=null&&(u[fm]=`${d.stackTotal}`),d.value!=null&&(u[ym]=`${d.value}`),rB(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;cm(a,l,h,n.color,{size:11},t)}}};c(zy,"type","bar");var wr=zy;Ya(wr.type,(i,r)=>new wr(i,r));function rB(i,r,e,t,n,o,s,a){let l,h=a||xm;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(te,Object.assign({d:l},e),t,n)}var eO=class extends Xn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:lc.type,options:e.plotOptions||{}}})),L(r,$P),this.$bind(ie,X(Wh),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(ie,X(hm),t=>{let n=t.target,o=parseInt(n.getAttribute(dt),10);this.setFocusedSeries(o)}),this.$bind(et,X(hm,Wh),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},Xy=class Xy extends oo{constructor(e,t){var n,o;super(e,t,Xy.type);this.chart=e;c(this,"stacked");c(this,"sh");c(this,"og");c(this,"ah");c(this,"xt",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.sh=((n=t.marker)==null?void 0:n.enabled)!==!1,this.og=((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 m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.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.xt.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.xt[h]=this.xt[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.xt[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.xt[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.xt[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.xt[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.xt.length;l++){let h=s[l].color,d=`M ${this.xt[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(te,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[dt]:`${l}`},hm,this.chart.seriesElements[l])}this.ah=k(ze,{cx:"0",cy:"0",r:this.og/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.sh!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.xt[s][e];return ce(this.ah,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Yc(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.sh!==!1&&ce(this.ah,{visibility:"hidden"})}};c(Xy,"type","area");var lc=Xy;Ya(lc.type,(i,r)=>new lc(i,r));var tO=class extends Xn{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,vP)}};var rO=class extends Xn{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,PP)}};var jy=class extends Xa{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))}},nO=class extends ja{constructor(e,t){super(e,t);this.options=t;L(e,_P)}$dualValueInit(e){e.series.forEach(t=>{let n=new jy(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,m=n+Math.sqrt(p)*(d-n);return Math.max(n,m)}$getDataPointCssClass(){return RP}};var rD="vjs-gauge-chart",nD="vjs-gauge-track",iO="vjs-gauge-zone",iD="vjs-gauge-tick",oD="vjs-gauge-label",sD="vjs-gauge-needle",aD="vjs-gauge-needle-pivot",oO=class extends io{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"bt");c(this,"yo");c(this,"_e");c(this,"be");c(this,"_t");c(this,"lh");this.bt=(n=t.startAngle)!=null?n:-135,this.yo=(o=t.endAngle)!=null?o:135,this._e=(s=t.innerRadius)!=null?s:.8,this.be=(a=t.min)!=null?a:0,this._t=(l=t.max)!=null?l:100,this.lh=(h=t.value)!=null?h:this.be,L(e,rD),this.$draw()}getValue(){return this.lh}setValue(e){this.lh=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 ye;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.$getBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a=j=>(j-90)*Math.PI/180,l=a(this.bt),h=a(this.yo),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),m=Math.sin(l),g=[h];for(let j=-180;j<=270;j+=90){let ge=a(j);j>=this.bt&&j<=this.yo&&g.push(ge)}g.forEach(j=>{d=Math.min(d,Math.cos(j)),u=Math.max(u,Math.cos(j)),p=Math.min(p,Math.sin(j)),m=Math.max(m,Math.sin(j))});let E=.9,y=u-d,x=m-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*(m+p)/2,T=f*this._e,S=b+f*Math.cos(l),R=A+f*Math.sin(l),v=b+f*Math.cos(h),O=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),_=A+T*Math.sin(l),w=this.yo-this.bt<=180?0:1,B=[`M ${S} ${R}`,`A ${f} ${f} 0 ${w} 1 ${v} ${O}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${_}`,"Z"].join(" ");k(te,{d:B,fill:"#EEE",stroke:"#CCC","stroke-width":1},nD,e);let D=(ye=this.getValue())!=null?ye:this.be,M=Math.max(this.be,Math.min(this._t,D)),N=this._t-this.be,G=this.yo-this.bt,J=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((j,ge)=>{let Ge=j.from,Xe=j.to;if(!J){if(M<=Ge)return;Xe=Math.min(Xe,M)}let Bt=this.bt+(Ge-this.be)/N*G,ar=this.bt+(Xe-this.be)/N*G,er=a(Bt),Dr=a(ar),ao=b+f*Math.cos(er),Ha=A+f*Math.sin(er),ka=b+f*Math.cos(Dr),Wa=A+f*Math.sin(Dr),Za=b+T*Math.cos(Dr),Ja=A+T*Math.sin(Dr),Cm=b+T*Math.cos(er),Pm=A+T*Math.sin(er),cc=ar-Bt<=180?0:1,Om=[`M ${ao} ${Ha}`,`A ${f} ${f} 0 ${cc} 1 ${ka} ${Wa}`,`L ${Za} ${Ja}`,`A ${T} ${T} 0 ${cc} 0 ${Cm} ${Pm}`,"Z"].join(" "),dc=j.color;if(j.gradient){let re=e.querySelector("defs");re||(re=k("defs",{},"",e),e.insertBefore(re,e.firstChild));let $e=`vjs-gauge-gradient-${ge}-${Math.round(Math.random()*1e6)}`,Dt=k("linearGradient",{id:$e,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",re);j.gradient.stops.forEach(Ft=>{k("stop",{offset:`${Ft.offset}%`,"stop-color":Ft.color},"",Dt)}),dc=`url(#${$e})`}k(te,{d:Om,fill:dc,stroke:"none"},`${iO} ${iO}-${ge}`,e)}),this.options.ticks){let j=[];if(this.options.ticks.values)j=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let ge=this.be;ge<=this._t;ge+=this.options.ticks.interval)j.push(ge);j.forEach(ge=>{let Ge=this.bt+(ge-this.be)/N*G,Xe=a(Ge),Bt=f*.95,ar=b+f*Math.cos(Xe),er=A+f*Math.sin(Xe),Dr=b+Bt*Math.cos(Xe),ao=A+Bt*Math.sin(Xe);k(te,{d:`M ${ar} ${er} L ${Dr} ${ao}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},iD,e)})}if(this.options.labels){let j=[];if(this.options.labels.values)j=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Ge=this.be;Ge<=this._t;Ge+=this.options.labels.interval)j.push(Ge);let ge=f+(this.options.labels.distance||0);j.forEach(Ge=>{let Xe=this.bt+(Ge-this.be)/N*G,Bt=a(Xe),ar=b+ge*Math.cos(Bt),er=A+ge*Math.sin(Bt);k("text",{x:ar,y:er,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},oD,e).textContent=Ge.toString()})}if(J){let j=this.bt+(M-this.be)/N*G,ge=a(j),Ge=f*.9,Xe=f*.05,Bt=ge-Math.PI/2,ar=ge+Math.PI/2,er=b+Ge*Math.cos(ge),Dr=A+Ge*Math.sin(ge),ao=b+Xe*Math.cos(Bt),Ha=A+Xe*Math.sin(Bt),ka=b+Xe*Math.cos(ar),Wa=A+Xe*Math.sin(ar),Za=`M ${ao} ${Ha} L ${er} ${Dr} L ${ka} ${Wa} Z`;k(te,{d:Za,fill:"#333",stroke:"#000","stroke-width":1},sD,e);let Ja=Xe*1.5;k("circle",{cx:b,cy:A,r:Ja,fill:"#333",stroke:"#666","stroke-width":1},aD,e)}}};var sO=class extends Xn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:hc.type,options:t.plotOptions||{}}}));this.options=t;L(e,GP)}},Hy=class Hy extends oo{constructor(e,t){super(e,t,Hy.type);this.chart=e;c(this,"sg");c(this,"ag");this.sg=t.stacked===!0,this.ag=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.sg&&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 m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.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)}}Sb(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=hE(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}Tb(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 m,g;return this.$inverted?(g=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,m=u):(m=t.chartWidth*((p-a.minScale)/a.range),g=u),{cx:m,cy:g}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let m=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let g=s[p],E=g.values[u].max,{cx:y,cy:x}=d(m,E);if(E!=null&&this.lg(s[p],y,x,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),g.isRangeSeries()){let{cx:f,cy:b}=d(m,g.values[u].min);g.values[u].min!=null&&this.lg(s[p],f,b,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:g.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,m=l[u].findIndex(E=>E.hasValue),g=this.ag?this.Sb(l[u],m):this.Tb(l[u],m);k(te,{stroke:p,"stroke-width":"1",d:g,fill:"none",[dt]:`${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 m=h[u].findIndex(E=>E.hasValue),g=`M ${h[u].slice(m).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(te,{stroke:p,"stroke-width":"1",d:g,fill:"none",[dt]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}lg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=ac(e.marker,null,{[zn]:`${l}`,[dt]:`${h}`},[pn].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=Tm(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[zn]:`${l}`,[dt]:`${h}`},[pn].join(" "));return d.appendChild(u),u}}};c(Hy,"type","line");var hc=Hy;Ya(hc.type,(i,r)=>new hc(i,r));var lD="vjs-pie-chart",vm="vjs-pie-slice",aO="vjs-pie-slice-selected",lO=class extends Ga{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"xo");c(this,"bo");c(this,"ch");c(this,"jn");c(this,"_e");c(this,"$realisedSeries",[]);c(this,"Kr");this.xo=t.selectedCategory,this.ch=t.selectedSliceOffset||10,this.jn=t.interactive===!0,this._e=t.innerRadius,this.Kr=t.tooltip,this.$init(),this.load(t),this.$bind(tt,X(vm),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.cg(o),p=this.$dataPoints[d],m=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},m,p.label,{value:p.value})}}),this.$bind(et,X(vm),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,X(vm),n=>{if(this.jn){let o=n.target,{category:s,series:a}=this.cg(o);this.vb(s,a,o)}}),L(e,lD)}cg(e){let t=parseInt(e.getAttribute(zn),10),n=parseInt(e.parentNode.getAttribute(dt),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.Kr&&(this.$tooltip=new Fa(e,this.Kr)),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.$getBackgroundColor(),"data-z-index":"0"},La,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,m)=>{let g=$(q,{"data-name":p.label,"data-category":m});e.appendChild(g);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,R="";if(p.p>=1)if(this._e!=null){let G=this._e*h;R=`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+G} ${a.y}
|
|
140
140
|
A ${G} ${G} 0 1 0 ${a.x-G} ${a.y}
|
|
141
141
|
A ${G} ${G} 0 1 0 ${a.x+G} ${a.y} Z`}else R=`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(R=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this._e!=null){let G=a.x+this._e*h*Math.cos(E),J=a.y+this._e*h*Math.sin(E),ye=a.x+this._e*h*Math.cos(y),j=a.y+this._e*h*Math.sin(y);R=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${ye} ${j} A ${this._e*h} ${this._e*h} 0 ${S} 0 ${G} ${J} Z `}let v={x:this.ch*Math.cos(x),y:this.ch*Math.sin(x)},O=$(te,{fill:u||(d?d[m%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:R,"data-t":`translate(${v.x}, ${v.y})`,[zn]:`${m}`});L(O,Pm),m===this.xo&&this.hg(O),g.appendChild(O);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,_,w,B;if(p.p>=1)if(I&&this._e!=null)_=a.x,w=a.y,B="middle";else{let G=-Math.PI/2;_=a.x+C*Math.cos(G),w=a.y+C*Math.sin(G),B="middle"}else _=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),B=_<a.x?"end":"start";let D=$("text",{"text-anchor":B,"dominant-baseline":"central",x:_,y:w});this.options.labelFont&&(this.options.labelFont.size&&D.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&D.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&D.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&D.setAttribute("font-style",this.options.labelFont.style));let M=p.label,N=this.options.showLabels||"label";if(N==="value"?M=`${p.value}`:N==="percentage"?M=`${Math.round(p.p*100)}%`:N==="label-value"?M=`${p.label}: ${p.value}`:N==="label-percentage"&&(M=`${p.label}: ${Math.round(p.p*100)}%`),D.innerHTML=M,g.appendChild(D),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let J=p.p<3&&m%2===0?h*.4:h*.5,ye=a.x+J*Math.cos(x),j=a.y+J*Math.sin(x),ge=u||(d?d[m%d.length]:this.colorGenerator.generate(p)),Ge=this.options.labelFont||{size:12,weight:"bold"},Xe="";this.options.dataLabels==="percentage"?Xe=`${Math.round(p.p*100)}%`:Xe=`${p.value}`,um(Xe,ye,j,ge,Ge,g)}})}Cb(){this.bo!=null&&(this.Ob(this.bo),this.bo=null)}hg(e){this.bo=e,this.Pb(this.bo)}vb(e,t,n){this.Cb(),this.xo===e?this.xo=null:(this.xo=e,this.hg(n))}Pb(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,aO)}Ob(e){e.removeAttribute("transform"),F(e,aO)}};function ps(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function hD(i,r,e){return r.reduce((t,n)=>t+ps(n,e),0)}function nB(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function iB(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function oB(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function sB(i,r,e,t,n,o){aB(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>nB(s),s=>iB(s),o)}function aB(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),m=hD(u,p,h);return u.data.height=m,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:m},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(m=>{a(m.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(m=>{let g=hD(m,o(m),h);m.data.height=g,m.data.width=n,p.push({offset:0,obj:m,size:{width:n,height:g},id:m.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(m.id,!0)}),r(p),d=p}}function hO(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=oB(T,e),R=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:R})}sB(d,u,s,a,r,o),new vs({layers:d},(T,S,R)=>{let v=[];for(let O=0;O<d[S].entries.length;O++)xx(d[S].entries[O].obj,R.obj)&&v.push([d[S].entries[O],O]);return v},null).execute();let m=d[h],E=e*(m.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],R=S.size*y,v=E*y-R,O=S.entries.length-1,P=O>0?Math.max(e,v/(O+2)):e,C=(E*y-(R+P*O))/2;S.entries.forEach(_=>{let w=_.obj.getSourceEdges().length===0;_.size.height*=y,_.obj.data.height*=y,_.obj.data.left=f,_.obj.data.top=C,_.obj.data.layer=T,_.obj.data.isTerminus=w,_.obj.data.isSource=T===0,_.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=_.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++)cD(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)cD(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(R=>{let v=R.size.height/y,O=0,P=Array.from(R.obj.getSourceEdges());P.sort((C,_)=>{let w=C.target.data.top+C.target.data.height/2,B=_.target.data.top+_.target.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<P.length;C++){let _=ps(P[C],o);P[C].data.lineWidth=_*y;let w=O+_/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},O+=_}O=0;let I=Array.from(R.obj.getTargetEdges());I.sort((C,_)=>{let w=C.source.data.top+C.source.data.height/2,B=_.source.data.top+_.source.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<I.length;C++){let _=ps(I[C],o),w=O+_/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},O+=_}});return{layers:d,scale:y}}function cD(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,m=ps(u,r);d+=(p.data.top+p.data.height/2)*m,h+=m}),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 cO="sankey-csv",Wy="vjs-sankey-edge",Qr="vjs-sankey-unselected",so="vjs-sankey-selected",dD="vjs-sankey",Zy="vjs-sankey-node",Jy="vjs-sankey-label",uO=class extends io{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"hh");c(this,"dh");c(this,"dg");c(this,"R");c(this,"qe");c(this,"jn");c(this,"Re");c(this,"So");c(this,"qs");c(this,"To");c(this,"vo",[]);c(this,"kn");c(this,"Co",{});c(this,"Hn",{});c(this,"Oo",{});c(this,"Po",{});c(this,"_o",[]);c(this,"Ao",null);c(this,"ct");c(this,"$tooltip");L(e,dD),Tx("sankey-csv",jb),this.Ao=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.qs=t.labelProperty||"label",this.So=t.valueProperty||"value",this.dg=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.hh=t.nodeWidth||15,this.dh=t.nodePadding||10,this.jn=t.interactive!==!1;let n=t.labels||{};this.ct={font:pi(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.Rb(),this.Pn(t)}get currentModel(){return this.Ao!=null?this.qe:this.R}_b(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.R==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=$(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=hO(this.R,this.hh,this.dh,t,n,this.So);if(this.Ao){if(this.qe.getNodes().length===0){let b=lB(a,this.Ao,this.So,this.qs);this.Lb(b)}a=hO(this.qe,this.hh,this.dh,t,n,this.So).layers}this._o=a;let l=$(q);s.appendChild(l);let h=$(q);s.appendChild(h);let d=$(q);if(s.appendChild(d),this._o.length===0||this._o[0].entries.length===0)return;this.jn&&(this.$tooltip=new dO(e,{format:"{{content}}",valueSuffix:this.dg||""},this.So,this.qs));let u=0,p=0,m=1/0,g=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),m=Math.min(m,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),g=Math.min(g,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=$(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[ee]:b.id},{},Zy);this.Hn[b.id]=A,h.appendChild(A),E(A);let T=$(q),S=b.data[this.qs]||b.getFullId(),R=$(Je,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.ct.padding:b.data.labelAlign==="start"&&b.data.layer===this._o.length-1?b.data.left+b.data.width+this.ct.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.ct.font.size,"font-style":this.ct.font.style,[ee]:b.id},{},Jy);if(R.innerHTML=S,this.Oo[b.id]=R,T.appendChild(R),d.appendChild(T),this.ct.backgroundColor!=="transparent"){let v=R.getBBox(),O=$(Z,{rx:"3",x:v.x-this.ct.padding,y:v.y-this.ct.padding,width:v.width+this.ct.padding*2,height:v.height+this.ct.padding*2,fill:this.ct.backgroundColor,[ee]:b.id});this.Po[b.id]=O,T.insertBefore(O,R)}E(R)}});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,R=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},O={x:R.left,y:R.top+T.y*R.height},P=.25*(O.x-v.x),I=b.data.lineWidth/2,C=v.y-I,_=v.y+I,w=O.y-I,B=O.y+I,M={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${O.x-P} ${w}, ${O.x} ${w}`,`L ${O.x} ${B}`,`C ${O.x-P} ${B}, ${v.x+P} ${_}, ${v.x} ${_}`,"Z"].join(" "),opacity:.3,stroke:"none",[Ze]:b.id};if(b.data.color)M.fill=b.data.color;else if(b.data.gradient){let{id:G,g:J}=kS(v.x,O.x,b.data.gradient);l.appendChild(J),M.fill=`url(#${G})`}let N=$(te,M,{},Wy);this.Co[b.id]=N,l.appendChild(N),E(N)}),t=u+this.dim.chartX-m,n=p+this.dim.chartY,e.setAttribute("viewBox",`${m} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${m}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${g}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-m,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:m,y:0,width:t,height:n},this.fire(mm)}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._b(t,n))}Pn(e){if(this.R=dn(),this.qe=dn(),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.Re=e.dataSource;let t=ra(()=>{this.ug()},150);this.Re.bind(Ve,t),this.Re.bind(Le,t),this.Re.bind(Ht,t),this.Re.bind(Re,t),this.Re.bind(Me,t),this.Re.bind(Xt,t),this.Re.bind(pt,t),this.Re.bind(mt,t),this.Re.bind(dr,t),this.Re.bind(jt,t),this.Re.bind(Mr,t),this.ug()}}Lb(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)})})}ug(){this.R.clear(),this.qe.clear(),this.Re.getNodes().forEach(e=>{this.R.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Re.getAllEdges().forEach(e=>{let t=this.R.getVertex(e.source.id),n=this.R.getVertex(e.target.id);this.R.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e){this.qe.clear(),this.R.clear();function t(){return e.dataType!=null?e.dataType:e.csvData!=null?cO:e.jsonData!=null?zt:e.url!=null&&e.url.indexOf(".json")!==-1?zt:cO}this.R.load({type:t(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.R!=null&&this.R.getNodes().length>0}destroy(){super.destroy()}wb(){this.To!=null&&(this.kn.vertices.forEach(e=>{F(this.Hn[e.id],so),F(this.Oo[e.id],so);let t=this.Po[e.id];t&&F(t,so)}),this.vo.forEach(e=>F(e[1],so)),Object.values(this.Co).forEach(e=>F(e,Qr)),Object.values(this.Hn).forEach(e=>F(e,Qr)),Object.values(this.Oo).forEach(e=>F(e,Qr)),Object.values(this.Po).forEach(e=>F(e,Qr))),this.To=null,this.kn=null,this.vo.length=0}pg(e){return this._o.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}Db(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())}Nb(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.pg(s);this.Db(s).forEach(d=>{t.has(d[0])||this.pg(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)}}uh(e){this.wb(),e!=null&&(this.To=this.currentModel.getNode(e),Object.values(this.Hn).forEach(n=>L(n,Qr)),Object.values(this.Oo).forEach(n=>L(n,Qr)),Object.values(this.Po).forEach(n=>L(n,Qr)),Object.values(this.Co).forEach(n=>L(n,Qr)),this.kn=this.Nb(this.To),this.kn.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.vo=this.kn.edges.map(n=>[n,this.Co[n.id]]),this.kn.vertices.forEach(n=>{Vt(this.Hn[n.id],[so],[Qr]),Vt(this.Oo[n.id],[so],[Qr]);let o=this.Po[n.id];o&&Vt(o,[so],[Qr])}),this.vo.forEach(n=>{Vt(n[1],[so],[Qr])}),this.fire("sankey:hover",{vertex:this.To,edges:this.vo}))}Rb(){this.jn&&(this.$eventManager.on(this.container,tt,X(Zy,Jy),e=>{let n=e.target.getAttribute(ee);this.uh(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.Hn[n])}),this.$eventManager.on(this.container,et,X(Zy,Jy,Wy),e=>{this.uh(null)}),this.$eventManager.on(this.container,tt,X(Wy),e=>{let n=e.target.getAttribute(Ze);this.uh(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.Co[n])}))}pivot(e){this.Ao=e!=null&&e.length>0?e:null,this.qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},dO=class extends $a{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=>ps(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>ps(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 lB(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(Ei({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(m=>{let g=m.target.id,E=m.data[r]||"Unspecified",y=ps(m,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(g,(b.get(g)||0)+y)})}),h.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:`v_${a}_${g}`,data:{[r]:g,[e]:m}})})}),d.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:g,data:{[r]:p.split("_").pop(),[e]:m}})})})}return{nodes:n,edges:o}}var pO=class extends ja{constructor(e,t){super(e,t);this.options=t;L(e,LP)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return wP}};
|
|
143
|
+
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(R=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this._e!=null){let G=a.x+this._e*h*Math.cos(E),J=a.y+this._e*h*Math.sin(E),ye=a.x+this._e*h*Math.cos(y),j=a.y+this._e*h*Math.sin(y);R=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${ye} ${j} A ${this._e*h} ${this._e*h} 0 ${S} 0 ${G} ${J} Z `}let v={x:this.ch*Math.cos(x),y:this.ch*Math.sin(x)},O=$(te,{fill:u||(d?d[m%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:R,"data-t":`translate(${v.x}, ${v.y})`,[zn]:`${m}`});L(O,vm),m===this.xo&&this.hg(O),g.appendChild(O);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,_,w,B;if(p.p>=1)if(I&&this._e!=null)_=a.x,w=a.y,B="middle";else{let G=-Math.PI/2;_=a.x+C*Math.cos(G),w=a.y+C*Math.sin(G),B="middle"}else _=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),B=_<a.x?"end":"start";let D=$("text",{"text-anchor":B,"dominant-baseline":"central",x:_,y:w});this.options.labelFont&&(this.options.labelFont.size&&D.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&D.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&D.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&D.setAttribute("font-style",this.options.labelFont.style));let M=p.label,N=this.options.showLabels||"label";if(N==="value"?M=`${p.value}`:N==="percentage"?M=`${Math.round(p.p*100)}%`:N==="label-value"?M=`${p.label}: ${p.value}`:N==="label-percentage"&&(M=`${p.label}: ${Math.round(p.p*100)}%`),D.innerHTML=M,g.appendChild(D),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let J=p.p<3&&m%2===0?h*.4:h*.5,ye=a.x+J*Math.cos(x),j=a.y+J*Math.sin(x),ge=u||(d?d[m%d.length]:this.colorGenerator.generate(p)),Ge=this.options.labelFont||{size:12,weight:"bold"},Xe="";this.options.dataLabels==="percentage"?Xe=`${Math.round(p.p*100)}%`:Xe=`${p.value}`,cm(Xe,ye,j,ge,Ge,g)}})}Cb(){this.bo!=null&&(this.Ob(this.bo),this.bo=null)}hg(e){this.bo=e,this.Pb(this.bo)}vb(e,t,n){this.Cb(),this.xo===e?this.xo=null:(this.xo=e,this.hg(n))}Pb(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,aO)}Ob(e){e.removeAttribute("transform"),F(e,aO)}};function us(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function hD(i,r,e){return r.reduce((t,n)=>t+us(n,e),0)}function nB(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function iB(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function oB(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function sB(i,r,e,t,n,o){aB(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>nB(s),s=>iB(s),o)}function aB(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),m=hD(u,p,h);return u.data.height=m,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:m},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(m=>{a(m.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(m=>{let g=hD(m,o(m),h);m.data.height=g,m.data.width=n,p.push({offset:0,obj:m,size:{width:n,height:g},id:m.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(m.id,!0)}),r(p),d=p}}function hO(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=oB(T,e),R=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:R})}sB(d,u,s,a,r,o),new Ts({layers:d},(T,S,R)=>{let v=[];for(let O=0;O<d[S].entries.length;O++)yx(d[S].entries[O].obj,R.obj)&&v.push([d[S].entries[O],O]);return v},null).execute();let m=d[h],E=e*(m.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],R=S.size*y,v=E*y-R,O=S.entries.length-1,P=O>0?Math.max(e,v/(O+2)):e,C=(E*y-(R+P*O))/2;S.entries.forEach(_=>{let w=_.obj.getSourceEdges().length===0;_.size.height*=y,_.obj.data.height*=y,_.obj.data.left=f,_.obj.data.top=C,_.obj.data.layer=T,_.obj.data.isTerminus=w,_.obj.data.isSource=T===0,_.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=_.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++)cD(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)cD(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(R=>{let v=R.size.height/y,O=0,P=Array.from(R.obj.getSourceEdges());P.sort((C,_)=>{let w=C.target.data.top+C.target.data.height/2,B=_.target.data.top+_.target.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<P.length;C++){let _=us(P[C],o);P[C].data.lineWidth=_*y;let w=O+_/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},O+=_}O=0;let I=Array.from(R.obj.getTargetEdges());I.sort((C,_)=>{let w=C.source.data.top+C.source.data.height/2,B=_.source.data.top+_.source.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<I.length;C++){let _=us(I[C],o),w=O+_/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},O+=_}});return{layers:d,scale:y}}function cD(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,m=us(u,r);d+=(p.data.top+p.data.height/2)*m,h+=m}),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 cO="sankey-csv",ky="vjs-sankey-edge",Qr="vjs-sankey-unselected",so="vjs-sankey-selected",dD="vjs-sankey",Wy="vjs-sankey-node",Zy="vjs-sankey-label",uO=class extends io{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"hh");c(this,"dh");c(this,"dg");c(this,"R");c(this,"qe");c(this,"jn");c(this,"Re");c(this,"So");c(this,"qs");c(this,"To");c(this,"vo",[]);c(this,"kn");c(this,"Co",{});c(this,"Hn",{});c(this,"Oo",{});c(this,"Po",{});c(this,"_o",[]);c(this,"Ao",null);c(this,"ct");c(this,"$tooltip");L(e,dD),Sx("sankey-csv",Xb),this.Ao=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.qs=t.labelProperty||"label",this.So=t.valueProperty||"value",this.dg=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.hh=t.nodeWidth||15,this.dh=t.nodePadding||10,this.jn=t.interactive!==!1;let n=t.labels||{};this.ct={font:ui(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.Rb(),this.Pn(t)}get currentModel(){return this.Ao!=null?this.qe:this.R}_b(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.R==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=$(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=hO(this.R,this.hh,this.dh,t,n,this.So);if(this.Ao){if(this.qe.getNodes().length===0){let b=lB(a,this.Ao,this.So,this.qs);this.Lb(b)}a=hO(this.qe,this.hh,this.dh,t,n,this.So).layers}this._o=a;let l=$(q);s.appendChild(l);let h=$(q);s.appendChild(h);let d=$(q);if(s.appendChild(d),this._o.length===0||this._o[0].entries.length===0)return;this.jn&&(this.$tooltip=new dO(e,{format:"{{content}}",valueSuffix:this.dg||""},this.So,this.qs));let u=0,p=0,m=1/0,g=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),m=Math.min(m,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),g=Math.min(g,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=$(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[ee]:b.id},{},Wy);this.Hn[b.id]=A,h.appendChild(A),E(A);let T=$(q),S=b.data[this.qs]||b.getFullId(),R=$(Je,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.ct.padding:b.data.labelAlign==="start"&&b.data.layer===this._o.length-1?b.data.left+b.data.width+this.ct.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.ct.font.size,"font-style":this.ct.font.style,[ee]:b.id},{},Zy);if(R.innerHTML=S,this.Oo[b.id]=R,T.appendChild(R),d.appendChild(T),this.ct.backgroundColor!=="transparent"){let v=R.getBBox(),O=$(Z,{rx:"3",x:v.x-this.ct.padding,y:v.y-this.ct.padding,width:v.width+this.ct.padding*2,height:v.height+this.ct.padding*2,fill:this.ct.backgroundColor,[ee]:b.id});this.Po[b.id]=O,T.insertBefore(O,R)}E(R)}});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,R=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},O={x:R.left,y:R.top+T.y*R.height},P=.25*(O.x-v.x),I=b.data.lineWidth/2,C=v.y-I,_=v.y+I,w=O.y-I,B=O.y+I,M={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${O.x-P} ${w}, ${O.x} ${w}`,`L ${O.x} ${B}`,`C ${O.x-P} ${B}, ${v.x+P} ${_}, ${v.x} ${_}`,"Z"].join(" "),opacity:.3,stroke:"none",[Ze]:b.id};if(b.data.color)M.fill=b.data.color;else if(b.data.gradient){let{id:G,g:J}=kS(v.x,O.x,b.data.gradient);l.appendChild(J),M.fill=`url(#${G})`}let N=$(te,M,{},ky);this.Co[b.id]=N,l.appendChild(N),E(N)}),t=u+this.dim.chartX-m,n=p+this.dim.chartY,e.setAttribute("viewBox",`${m} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${m}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${g}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-m,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:m,y:0,width:t,height:n},this.fire(um)}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._b(t,n))}Pn(e){if(this.R=dn(),this.qe=dn(),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.Re=e.dataSource;let t=ra(()=>{this.ug()},150);this.Re.bind(Ve,t),this.Re.bind(Le,t),this.Re.bind(Ht,t),this.Re.bind(Re,t),this.Re.bind(Me,t),this.Re.bind(Xt,t),this.Re.bind(pt,t),this.Re.bind(mt,t),this.Re.bind(dr,t),this.Re.bind(jt,t),this.Re.bind(Mr,t),this.ug()}}Lb(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)})})}ug(){this.R.clear(),this.qe.clear(),this.Re.getNodes().forEach(e=>{this.R.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Re.getAllEdges().forEach(e=>{let t=this.R.getVertex(e.source.id),n=this.R.getVertex(e.target.id);this.R.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e){this.qe.clear(),this.R.clear();function t(){return e.dataType!=null?e.dataType:e.csvData!=null?cO:e.jsonData!=null?zt:e.url!=null&&e.url.indexOf(".json")!==-1?zt:cO}this.R.load({type:t(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.R!=null&&this.R.getNodes().length>0}destroy(){super.destroy()}wb(){this.To!=null&&(this.kn.vertices.forEach(e=>{F(this.Hn[e.id],so),F(this.Oo[e.id],so);let t=this.Po[e.id];t&&F(t,so)}),this.vo.forEach(e=>F(e[1],so)),Object.values(this.Co).forEach(e=>F(e,Qr)),Object.values(this.Hn).forEach(e=>F(e,Qr)),Object.values(this.Oo).forEach(e=>F(e,Qr)),Object.values(this.Po).forEach(e=>F(e,Qr))),this.To=null,this.kn=null,this.vo.length=0}pg(e){return this._o.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}Db(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())}Nb(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.pg(s);this.Db(s).forEach(d=>{t.has(d[0])||this.pg(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)}}uh(e){this.wb(),e!=null&&(this.To=this.currentModel.getNode(e),Object.values(this.Hn).forEach(n=>L(n,Qr)),Object.values(this.Oo).forEach(n=>L(n,Qr)),Object.values(this.Po).forEach(n=>L(n,Qr)),Object.values(this.Co).forEach(n=>L(n,Qr)),this.kn=this.Nb(this.To),this.kn.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.vo=this.kn.edges.map(n=>[n,this.Co[n.id]]),this.kn.vertices.forEach(n=>{Vt(this.Hn[n.id],[so],[Qr]),Vt(this.Oo[n.id],[so],[Qr]);let o=this.Po[n.id];o&&Vt(o,[so],[Qr])}),this.vo.forEach(n=>{Vt(n[1],[so],[Qr])}),this.fire("sankey:hover",{vertex:this.To,edges:this.vo}))}Rb(){this.jn&&(this.$eventManager.on(this.container,tt,X(Wy,Zy),e=>{let n=e.target.getAttribute(ee);this.uh(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.Hn[n])}),this.$eventManager.on(this.container,et,X(Wy,Zy,ky),e=>{this.uh(null)}),this.$eventManager.on(this.container,tt,X(ky),e=>{let n=e.target.getAttribute(Ze);this.uh(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.Co[n])}))}pivot(e){this.Ao=e!=null&&e.length>0?e:null,this.qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},dO=class extends $a{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=>us(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>us(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 lB(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(gi({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(m=>{let g=m.target.id,E=m.data[r]||"Unspecified",y=us(m,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(g,(b.get(g)||0)+y)})}),h.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:`v_${a}_${g}`,data:{[r]:g,[e]:m}})})}),d.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:g,data:{[r]:p.split("_").pop(),[e]:m}})})})}return{nodes:n,edges:o}}var pO=class extends ja{constructor(e,t){super(e,t);this.options=t;L(e,LP)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return wP}};
|