import { inject as dl, ref as pe, provide as fl, readonly as hp, computed as oe, reactive as La, defineComponent as ze, shallowRef as If, toRef as gp, onBeforeMount as Ef, onMounted as Nn, watchEffect as Ys, onBeforeUnmount as pl, watch as Ye, openBlock as O, createElementBlock as j, normalizeStyle as Ue, normalizeClass as Re, renderSlot as An, createCommentVNode as be, unref as f, getCurrentScope as pp, onScopeDispose as mp, nextTick as Un, toRefs as Cc, Fragment as Oe, renderList as et, createBlock as Ce, mergeProps as vp, withCtx as q, withDirectives as $f, createVNode as _, vShow as Af, createSlots as Mc, createElementVNode as b, createTextVNode as ce, toDisplayString as P, getCurrentInstance as yp, onUnmounted as Fa, useSlots as bp, resolveComponent as ht, resolveDynamicComponent as Nf, withModifiers as Qn, Teleport as xp, toRaw as Lr, h as Gn, toValue as wp } from "vue";
import { merge as Tc } from "lodash-es";
import { defineStore as qu } from "pinia";
import { Modal as jo, ConfigProvider as fu, Drawer as Sp, Input as it, InputNumber as yn, Slider as Fn, Select as tt, Button as ot, Radio as Ro, Space as Bl, Collapse as Bs, Tooltip as Zn, Dropdown as Jo, Menu as Di, Spin as ki, Table as kp, DatePicker as _p, RadioGroup as Cp, Checkbox as Yi, Form as Mp, Tag as Zl, SelectOption as Tp, Switch as oa, Divider as zp, Popover as Dp, Row as Op, Col as Pp, Card as Ip, App as Ep, theme as zc } from "ant-design-vue";
import Dc from "dayjs";
import { isNumber as $p, isString as hu, isBoolean as Ap } from "lodash";
const Np = {
  "common.auto": "Auto",
  "common.all": "All",
  "app.tab.dashboard": "Dashboard",
  "app.tab.scene": "Scene View",
  "app.tab.topology": "Topology",
  "app.tab.logs": "Logs",
  "app.tab.traces": "Traces",
  "app.tab.querybuilder": "Query Builder",
  "app.tab.grafana": "Grafana Data",
  "app.tab.zabbix": "Zabbix",
  "app.theme.toDark": "Switch to Dark",
  "app.theme.toLight": "Switch to Light",
  "time.last1h": "Last 1 hour",
  "time.last3h": "Last 3 hours",
  "time.last6h": "Last 6 hours",
  "time.last24h": "Last 24 hours",
  "time.last7d": "Last 7 days",
  "time.last30d": "Last 30 days",
  "panel.menu.edit": "Edit",
  "panel.menu.clone": "Clone",
  "panel.menu.fullscreen": "Fullscreen",
  "panel.menu.refresh": "Refresh",
  "panel.menu.remove": "Remove",
  "panel.remove.title": 'Remove "{title}"?',
  "panel.remove.content": "This action cannot be undone.",
  "panel.remove.ok": "Remove",
  "panel.remove.cancel": "Cancel",
  "dashboard.edit": "Edit",
  "dashboard.save": "Save",
  "dashboard.cancel": "Cancel",
  "dashboard.cancelConfirmTitle": "Discard unsaved changes?",
  "dashboard.cancelConfirmOk": "Discard changes",
  "dashboard.cancelConfirmCancel": "Keep editing",
  "dashboard.addPanel": "Add Panel",
  "dashboard.clearPanels": "Clear Panels",
  "dashboard.clearConfirmTitle": "Clear all panels?",
  "dashboard.clearConfirmOk": "Clear all",
  "dashboard.export": "Export",
  "dashboard.import": "Import",
  "dashboard.exportSuccess": "Dashboard exported",
  "dashboard.importSuccess": "Dashboard imported",
  "dashboard.importError": "Invalid dashboard JSON",
  "config.section.general": "General",
  "config.section.value": "Stat Style",
  "config.section.style": "Style",
  "config.section.tooltip": "Tooltip",
  "config.section.format": "Formatting",
  "config.section.thresholds": "Thresholds ({n})",
  "config.section.axes": "Axes",
  "config.section.links": "Links ({n})",
  "config.section.gaugeStyle": "Gauge Style",
  "config.section.pieStyle": "Pie Style",
  "config.section.histStyle": "Histogram Style",
  "config.section.tableStyle": "Table Style",
  "config.section.overrides": "Field Overrides",
  "config.type.timeseries": "Time Series",
  "config.type.bar": "Bar Chart",
  "config.type.histogram": "Histogram",
  "config.type.stat": "Stat / Value",
  "config.type.gauge": "Gauge",
  "config.type.table": "Table",
  "config.type.pie": "Pie Chart",
  "panel.type.desc.timeseries": "Line/area chart with time axis",
  "panel.type.desc.bar": "Grouped or stacked bars",
  "panel.type.desc.histogram": "Distribution buckets",
  "panel.type.desc.stat": "Single value with sparkline",
  "panel.type.desc.gauge": "Circular gauge meter",
  "panel.type.desc.table": "Sortable data table",
  "panel.type.desc.pie": "Pie or donut chart",
  "config.field.title": "Title",
  "config.field.description": "Description",
  "config.field.panelType": "Panel Type",
  "config.field.colorScheme": "Color Scheme",
  "config.field.lineWidth": "Line Width",
  "config.field.fillOpacity": "Fill Opacity",
  "config.field.drawStyle": "Style",
  "config.field.interpolation": "Interpolation",
  "config.field.lineStyle": "Line Style",
  "config.field.showPoints": "Show Points",
  "config.field.legendPosition": "Legend Position",
  "config.field.unit": "Unit",
  "config.field.decimals": "Decimals",
  "config.field.min": "Min",
  "config.field.max": "Max",
  "config.field.reducer": "Calculation",
  "config.field.tooltipMode": "Tooltip Mode",
  "config.field.softMin": "Soft Min",
  "config.field.softMax": "Soft Max",
  "config.field.logScale": "Log Scale",
  "config.field.axisPlacement": "Placement",
  "config.field.showGridLines": "Grid Lines",
  "config.field.scaleDistribution": "Scale",
  "config.field.centeredZero": "Centered Zero",
  "config.field.stacked": "Stacked",
  "config.interp.linear": "Linear",
  "config.interp.smooth": "Smooth",
  "config.interp.step": "Step",
  "config.linestyle.solid": "Solid",
  "config.linestyle.dashed": "Dashed",
  "config.linestyle.dotted": "Dotted",
  "config.legend.bottom": "Bottom",
  "config.legend.right": "Right",
  "config.legend.hidden": "Hidden",
  "config.unit.none": "None",
  "config.unit.ms": "Milliseconds (ms)",
  "config.unit.percent": "Percent (0-100)",
  "config.unit.reqps": "Requests/sec",
  "config.threshold.label": "Label",
  "config.threshold.base": "Base",
  "config.threshold.add": "Add Threshold",
  "config.threshold.mode": "Threshold Mode",
  "config.threshold.modeAbsolute": "Absolute",
  "config.threshold.modePercentage": "Percentage",
  "dashboard.refresh": "Refresh",
  "dashboard.empty": "No panels yet",
  "dashboard.emptyHint": 'Click "Edit" then "Add Panel" to get started',
  "variable.modal.placeholder": 'Click "Add Variable" on the left to start',
  "variable.custom.title": "Custom Options",
  "variable.custom.add": "Add Option",
  "variable.custom.allValue": "All Value",
  "variable.custom.allValue.placeholder": "$_all",
  "variable.custom.col.text": "Display text",
  "variable.custom.col.value": "Value",
  "variable.custom.text.placeholder": "Display text",
  "variable.custom.value.placeholder": "Value",
  "variable.custom.addOption": "Add option",
  "variable.custom.allowCustomValue": "Allow custom values",
  "variable.custom.allowClear": "Allow clear",
  "variable.custom.multi": "Multi-value",
  "variable.custom.includeAll": "Include All option",
  "variable.general.label.placeholder": "Display label",
  "variable.general.description": "Description",
  "variable.general.description.placeholder": "Variable description",
  "variable.general.name.required": "Name is required",
  "variable.general.type.required": "Please select a type",
  "variable.general.showOn": "Show on dashboard",
  "variable.general.showOn.labelAndValue": "Label and value",
  "variable.general.showOn.value": "Value only",
  "variable.general.showOn.nothing": "Nothing",
  "variable.textbox.title": "Text box options",
  "variable.textbox.default": "Default value",
  "variable.textbox.default.placeholder": "Default value",
  "variable.textbox.width": "Input width",
  "variable.constant.title": "Constant options",
  "variable.constant.value": "Value",
  "variable.constant.value.required": "Value is required",
  "variable.constant.value.notNumber": "Please enter a valid number",
  "variable.constant.valueType": "Value type",
  "variable.constant.valueType.string": "String",
  "variable.constant.valueType.number": "Number",
  "variable.constant.hideFromList": "Hide from variable list",
  "variable.query.dsUid": "Datasource UID",
  "variable.query.dsUid.placeholder": "Enter datasource UID",
  "variable.query.queryType": "Query type",
  "variable.query.queryType.placeholder": "Select query type",
  "variable.query.queryType.group": "Host group",
  "variable.query.queryType.host": "Host",
  "variable.query.queryType.item": "Item",
  "variable.query.queryType.labelValues": "Label values",
  "variable.query.query": "Query",
  "variable.query.query.placeholder": "Query expression",
  "variable.query.regex": "Regex filter",
  "variable.query.regex.placeholder": "/regex/",
  "variable.query.sort": "Sort",
  "variable.query.sort.disabled": "Disabled",
  "variable.query.sort.alphabetical": "Alphabetical",
  "variable.query.sort.numeric": "Numerical",
  "variable.query.preview": "Preview",
  "variable.query.preview.placeholder": "(Refresh after save)",
  "config.scheme.grafana-classic": "Grafana Classic",
  "config.scheme.green-yellow-red": "Green-Yellow-Red",
  "config.scheme.red-yellow-green": "Red-Yellow-Green",
  "config.scheme.blue-yellow-red": "Blue-Yellow-Red",
  "config.scheme.blue-purple": "Blue-Purple",
  "config.scheme.yellow-blue": "Yellow-Blue",
  "config.scheme.blues": "Blues",
  "config.scheme.reds": "Reds",
  "config.scheme.GrYlRd": "GrYlRd",
  "config.scheme.purple-orange": "Purple-Orange",
  "variable.modal.title": "Variable Config",
  "variable.modal.save": "Save",
  "variable.modal.cancel": "Cancel",
  "variable.modal.delete": "Delete Variable",
  "variable.modal.add": "Add Variable",
  "variable.modal.empty": 'Click "Add Variable" on the left to start',
  "variable.nav.count": "Variables ({n})",
  "variable.nav.unnamed": "(unnamed)",
  "variable.general.title": "General",
  "variable.general.type": "Type",
  "variable.general.name": "Name",
  "variable.general.label": "Label",
  "variable.type.custom": "Custom",
  "variable.type.query": "Query",
  "variable.type.textbox": "Text box",
  "variable.type.datasource": "Data source",
  "variable.type.constant": "Constant",
  "variable.query.title": "Query options",
  "variable.query.multi": "Multi-value",
  "variable.query.includeAll": "Include All option",
  "variable.query.refresh": "Refresh",
  "variable.query.refresh.onLoad": "On dashboard load",
  "variable.query.refresh.onTimeChange": "On time range change",
  "qb.datasource": "Data Source",
  "qb.addQuery": "Add Query",
  "qb.queryOptions": "Query options",
  "qb.pattern": "Pattern",
  "qb.pattern.sine": "Sine wave",
  "qb.pattern.spike": "Spike",
  "qb.pattern.step": "Step",
  "qb.pattern.sawtooth": "Sawtooth",
  "qb.pattern.noise": "Random noise",
  "qb.pattern.trendUp": "Trend up",
  "qb.pattern.trendDown": "Trend down",
  "qb.pattern.plateau": "Plateau",
  "qb.pattern.randomWalk": "Random walk",
  "qb.pattern.live": "Live",
  "qb.seriesCount": "Series Count",
  "qb.liveAmplitude": "Amplitude",
  "qb.functions": "Functions",
  "qb.functions.add": "Add",
  "qb.options": "Options",
  "qb.queryOptions.maxDataPoints": "Max data points",
  "qb.queryOptions.minInterval": "Min interval",
  "qb.queryOptions.minIntervalPlaceholder": "No limit",
  "qb.queryOptions.interval": "Interval",
  "qb.queryOptions.intervalHint": "time range / max data points",
  "qb.queryOptions.relativeTime": "Relative time",
  "qb.queryOptions.timeShift": "Time shift",
  "config.scheme.classic": "Classic",
  "config.scheme.tableau10": "Tableau 10",
  "config.scheme.fixed": "Single Color",
  "config.scheme.thresholds": "From Thresholds",
  "config.trend.up": "Up ↑",
  "config.trend.down": "Down ↓",
  "config.trend.flat": "Flat",
  "config.field.pieType": "Pie Type",
  "config.field.pieSliceSorting": "Slice Sorting",
  "config.pieType.pie": "Pie",
  "config.pieType.donut": "Donut",
  "config.sort.desc": "Descending",
  "config.sort.asc": "Ascending",
  "config.sort.none": "None",
  "config.field.pieLabels": "Slice Labels",
  "config.pieLabel.name": "Name",
  "config.pieLabel.percent": "Percent",
  "config.pieLabel.value": "Value",
  "config.field.pieShow": "Show",
  "config.pieShow.calculate": "Calculate (Reducer)",
  "config.pieShow.all": "All Values",
  "config.field.legendMode": "Legend Mode",
  "config.legendMode.list": "List",
  "config.legendMode.table": "Table",
  "config.field.legendValues": "Legend Values",
  "config.legendValue.min": "Min",
  "config.legendValue.max": "Max",
  "config.legendValue.mean": "Mean",
  "config.legendValue.sum": "Sum",
  "config.legendValue.last": "Last",
  "config.legendValue.first": "First",
  "tooltip.pinned": "Pinned",
  "tooltip.datetimeFormat": "MMM DD HH:mm:ss",
  "config.reducer.lastNotNull": "Last *",
  "config.reducer.last": "Last",
  "config.reducer.firstNotNull": "First *",
  "config.reducer.first": "First",
  "config.reducer.min": "Min",
  "config.reducer.max": "Max",
  "config.reducer.mean": "Mean",
  "config.reducer.sum": "Total",
  "config.reducer.count": "Count",
  "config.reducer.range": "Range",
  "config.reducer.median": "Median",
  "config.reducer.stdDev": "Std Dev",
  "config.reducer.variance": "Variance",
  "config.reducer.delta": "Delta",
  "config.reducer.diff": "Difference",
  "config.reducer.diffperc": "Difference %",
  "config.reducer.step": "Step",
  "config.reducer.logmin": "Min (above zero)",
  "config.reducer.countAll": "Count all",
  "config.reducer.changeCount": "Change Count",
  "config.reducer.distinctCount": "Distinct Count",
  "config.reducer.allIsZero": "All Zeros",
  "config.reducer.allIsNull": "All Nulls",
  "config.drawStyle.lines": "Lines",
  "config.drawStyle.bars": "Bars",
  "config.drawStyle.points": "Points",
  "config.tooltip.single": "Single",
  "config.tooltip.multi": "All",
  "config.tooltip.none": "Hidden",
  "config.tooltip.sortNone": "None",
  "config.tooltip.sortAsc": "Ascending",
  "config.tooltip.sortDesc": "Descending",
  "config.axis.placement.left": "Left",
  "config.axis.placement.right": "Right",
  "config.axis.placement.hidden": "Hidden",
  "config.axis.grid.all": "All",
  "config.axis.grid.hidden": "Hidden",
  "config.axis.scale.linear": "Linear",
  "config.axis.scale.logarithmic": "Logarithmic",
  "config.gauge.fillWidth": "Active Arc Width",
  "config.gauge.trackWidth": "Track Width",
  "config.gauge.trackColor": "Track Color",
  "config.gauge.capRound": "Round Caps",
  "config.gauge.valueVisible": "Show Value",
  "config.gauge.thresholdDisplay": "Show Thresholds",
  "config.gauge.thresholdDisplayNone": "Off",
  "config.gauge.thresholdDisplayMarker": "Threshold Markers",
  "config.gauge.thresholdDisplayTrack": "Track Bands",
  "config.gauge.orientation": "Layout",
  "config.gauge.orientationAuto": "Auto Grid",
  "config.gauge.orientationHorizontal": "Horizontal",
  "config.gauge.orientationVertical": "Vertical",
  "config.gauge.valueOffsetY": "Value Y Offset",
  // Style section - gradient, nulls, points, stacking
  "config.field.gradientMode": "Gradient Mode",
  "config.gradient.none": "None",
  "config.gradient.opacity": "Opacity",
  "config.gradient.hue": "Hue",
  "config.gradient.scheme": "Scheme",
  "config.field.spanNulls": "Connect Null Values",
  "config.field.insertNulls": "Disconnect Values",
  "config.nulls.never": "Never",
  "config.nulls.always": "Always",
  "config.nulls.threshold": "Threshold",
  "config.points.auto": "Auto",
  "config.points.always": "Always",
  "config.points.never": "Never",
  "config.field.stackSeries": "Stack Series",
  "config.stack.none": "None",
  "config.stack.normal": "Normal",
  "config.stack.percent": "100%",
  // General section
  "config.field.colorSingle": "Fixed Color",
  "config.field.colorDistribution": "Color Distribution",
  "config.colorDist.sequential": "Sequential",
  "config.colorDist.distributed": "Distributed",
  "config.link.newTab": "Open in new tab",
  "config.link.add": "Add link",
  // Bar style
  "config.field.barShowValues": "Show Values",
  "config.showValues.auto": "Auto",
  "config.showValues.always": "Always",
  "config.showValues.never": "Never",
  "config.field.barGroupWidth": "Group Width",
  "config.field.barWidth": "Bar Width",
  "config.field.xTickRotation": "Rotate X Labels",
  // Stat style
  "config.field.orientation": "Orientation",
  "config.orientation.vertical": "Auto (Vertical)",
  "config.orientation.horizontal": "Horizontal",
  "config.field.textMode": "Text Mode",
  "config.textMode.valueAndName": "Value and name",
  "config.textMode.value": "Value only",
  "config.textMode.name": "Name only",
  "config.textMode.none": "None",
  "config.field.colorMode": "Color mode",
  "config.colorMode.value": "Value",
  "config.colorMode.backgroundSolid": "Background Solid",
  "config.colorMode.background": "Background Gradient",
  "config.field.percentChange": "Percent Change",
  "config.field.value": "Value",
  "config.field.unitLabel": "Unit Label",
  "config.field.trend": "Trend",
  // Histogram style
  "config.field.histBucketCount": "Bucket Count",
  "config.field.histBucketSize": "Bucket Size",
  "config.field.histBucketOffset": "Bucket Offset",
  "config.field.histCombineSeries": "Combine Series",
  "config.hist.bucketSizePlaceholder": "Auto",
  // Table style
  "config.field.tableFooterEnabled": "Footer Row",
  "config.field.tableFooterReducers": "Footer Calculation",
  "config.field.tableFooterFields": "Fields",
  "config.field.tableFooterFieldsPlaceholder": "All Numeric Fields",
  "config.section.tableColumnOverrides": "Column Overrides",
  // Axes section
  "config.field.axisName": "Name",
  "config.field.axisLabel": "Label",
  "config.field.axisWidth": "Width",
  "config.field.gridColor": "Grid Color",
  "config.field.axisLine": "Tick Labels",
  "config.field.axisLineColor": "Tick Label Color",
  "config.field.axisTickShow": "Tick Marks",
  "config.field.axisBorder": "Border",
  "config.field.axisBorderColor": "Border Color",
  "config.axis.label.placeholder": "Axis label",
  "config.axis.name.placeholder": "Axis name",
  "config.axis.grid.x": "X",
  "config.axis.grid.y": "Y",
  "config.axis.scale.symlog": "Symlog",
  // Tooltip section
  "config.field.tooltipSort": "Tooltip Sort",
  "config.field.tooltipMaxHeight": "List Max Height",
  "config.field.axisPointer": "Axis Pointer",
  // Unit options
  "config.unit.s": "Seconds (s)",
  "config.unit.bytes": "Bytes",
  "config.unit.percentunit": "Percent (0-1)",
  "config.unit.ops": "Ops/sec",
  "config.unit.bps": "Bits/sec",
  "config.unit.Bps": "Bytes/sec",
  // Gauge
  "config.gauge.arcSweep": "Arc Sweep",
  "config.gauge.paddingX": "Horizontal Padding",
  "config.gauge.paddingY": "Vertical Padding",
  "config.gauge.valueColor": "Value Color",
  "config.gauge.valueSize": "Value Size",
  "config.gauge.colorFromScheme": "Color from Scheme",
  "config.gauge.thresholdLabelDisplay": "Threshold Labels",
  "config.gauge.thresholdLabelNone": "Hidden",
  "config.gauge.thresholdLabelLabel": "Label",
  "config.gauge.thresholdLabelValue": "Value",
  "config.gauge.thresholdLabelBoth": "Label + Value",
  // Panel no data
  "panel.noData": "No data",
  // Override editor
  "config.override.addRule": "Add field override",
  "config.override.addProp": "Add override property",
  "config.override.matcher.byName": "Fields with name",
  "config.override.matcher.byType": "Fields with type",
  "config.override.matcher.byRegexp": "Fields matching regex",
  "config.override.matcher.byFrameRefID": "Fields returned by query",
  "config.override.prop.unit": "Unit",
  "config.override.prop.decimals": "Decimals",
  "config.override.prop.displayName": "Display name",
  "config.override.prop.min": "Min",
  "config.override.prop.max": "Max",
  "config.override.prop.noValue": "No value",
  "config.override.prop.filterable": "Filterable",
  "config.override.prop.thresholds": "Thresholds",
  "config.override.prop.displayMode": "Display mode",
  "config.override.prop.width": "Column width",
  "config.override.prop.align": "Alignment",
  "config.override.prop.hidden": "Hide column",
  "config.override.prop.wrapText": "Wrap text",
  "config.override.group.basic": "Standard options",
  "config.override.group.thresholds": "Thresholds",
  "config.override.group.table": "Table",
  "config.override.type.time": "Time",
  "config.override.type.number": "Number",
  "config.override.type.string": "String",
  "config.override.type.boolean": "Boolean",
  // Table column overrides
  "config.field.tableColHidden": "Hide",
  "config.field.tableColLabel": "Label",
  "config.field.tableColWidth": "Width",
  "config.field.tableColAlign": "Alignment",
  "config.field.tableColDisplayMode": "Display Mode",
  "config.field.tableColWrapText": "Wrap text",
  "config.field.tableColAddName": "Column name",
  "config.tableAlign.auto": "Auto",
  "config.tableAlign.left": "Left",
  "config.tableAlign.center": "Center",
  "config.tableAlign.right": "Right",
  "config.tableDisplayMode.auto": "Auto",
  "config.tableDisplayMode.colored-text": "Colored Text",
  "config.tableDisplayMode.colored-background": "Colored Background",
  "config.tableDisplayMode.gauge": "Gauge",
  "config.tableDisplayMode.data-links": "Data Links",
  "config.tableDisplayMode.json-view": "JSON View",
  "config.tableDisplayMode.pill": "Pill",
  // StatsPicker
  "config.reducer.group.standard": "Standard",
  "config.reducer.group.extended": "Extended",
  "config.reducer.group.boolean": "Boolean",
  "config.reducer.group.percentile": "Percentile",
  "config.reducer.choose": "Choose",
  // Pie limit
  "config.field.pieLimit": "Limit",
  // Variable datasource section
  "variable.ds.title": "Data source options",
  "variable.ds.type": "Data source type",
  "variable.ds.type.placeholder": "Select data source type",
  "variable.ds.filterRegex": "Instance filter regex",
  "variable.ds.multi": "Multi-value",
  "variable.ds.includeAll": "Include All option",
  // Editor - VizPicker
  "editor.vizPicker.title": "Visualization",
  // Editor - Overrides
  "editor.overrides.matcherValue": "Match value",
  "editor.overrides.propValue": "Property value",
  "editor.overrides.addProperty": "Add override property",
  "editor.overrides.addOverride": "Add field override",
  // Zabbix QueryEditor — query types
  "qb.queryType": "Query type",
  "qb.queryType.metrics": "Metrics",
  "qb.queryType.text": "Text",
  "qb.queryType.services": "IT Services",
  "qb.queryType.itemid": "Item ID",
  "qb.queryType.triggers": "Triggers",
  "qb.queryType.problems": "Problems",
  "qb.queryType.macros": "Macros",
  "qb.queryType.lld": "LLD",
  // Zabbix QueryEditor — host/group/item fields
  "panel.group": "Host group",
  "panel.group.placeholder": "Select host group",
  "panel.host": "Host",
  "panel.host.placeholder": "Select host",
  "panel.itemTag": "Item tag",
  "panel.itemTag.placeholder": "Filter by tag",
  "panel.items": "Items",
  "panel.items.placeholder": "Select item",
  // Zabbix QueryEditor — query fields
  "qb.textFilter": "Text filter",
  "qb.textFilter.placeholder": "Regex pattern",
  "qb.useCaptureGroups": "Use capture groups",
  "qb.itemIds": "Item IDs",
  "qb.itemIds.placeholder": "Comma-separated IDs",
  "qb.triggerFilter": "Trigger filter",
  "qb.triggerFilter.placeholder": "Trigger name",
  "qb.problemName": "Problem name",
  "qb.problemName.placeholder": "Filter by name",
  "qb.tags": "Tags",
  "qb.tags.placeholder": "tag:value",
  "qb.show": "Show",
  "qb.severity": "Severity",
  "qb.itService": "IT Service",
  "qb.itService.placeholder": "Select IT service",
  "qb.slaProperty": "SLA property",
  "qb.slaInterval": "SLA interval",
  "qb.macroFilter": "Macro filter",
  // Zabbix QueryEditor — LLD
  "qb.lld.rule": "Discovery rule",
  "qb.lld.rule.placeholder": "Select discovery rule",
  "qb.lld.itemKeys": "Item prototype keys",
  "qb.lld.itemKeys.placeholder": "Select prototype keys",
  // Zabbix QueryEditor — options
  "qb.ack.all": "All",
  "qb.ack.unack": "Unacknowledged",
  "qb.ack.ack": "Acknowledged",
  "qb.sort.default": "Default",
  "qb.sort.lastchange": "Last change",
  "qb.sort.severity": "Severity",
  "qb.trends.default": "Default",
  "qb.trends.true": "Use trends",
  "qb.trends.false": "No trends",
  "qb.options.trends": "Trends",
  "qb.options.showDisabled": "Show disabled",
  "qb.options.valueMapping": "Use value mapping",
  "qb.options.disableAlignment": "Disable alignment",
  "qb.options.acknowledged": "Acknowledged",
  "qb.options.sortBy": "Sort by",
  "qb.options.useTimeRange": "Use time range",
  "qb.options.hostsInMaintenance": "Hosts in maintenance",
  "qb.options.hostProxy": "Host proxy",
  "qb.options.limit": "Limit"
}, Rf = {
  "panel.noData": "暂无数据",
  "common.auto": "自动",
  "common.all": "全部",
  "app.tab.dashboard": "仪表盘",
  "app.tab.scene": "场景视图",
  "app.tab.topology": "拓扑",
  "app.tab.logs": "日志",
  "app.tab.traces": "链路追踪",
  "app.tab.querybuilder": "查询构建器",
  "app.tab.grafana": "Grafana 数据",
  "app.tab.zabbix": "Zabbix",
  "app.theme.toDark": "切换深色",
  "app.theme.toLight": "切换浅色",
  "time.last1h": "最近 1 小时",
  "time.last3h": "最近 3 小时",
  "time.last6h": "最近 6 小时",
  "time.last24h": "最近 24 小时",
  "time.last7d": "最近 7 天",
  "time.last30d": "最近 30 天",
  "panel.menu.edit": "编辑",
  "panel.menu.clone": "克隆",
  "panel.menu.fullscreen": "全屏",
  "panel.menu.refresh": "刷新",
  "panel.menu.remove": "删除",
  "panel.remove.title": '删除 "{title}"？',
  "panel.remove.content": "此操作不可撤销。",
  "panel.remove.ok": "删除",
  "panel.remove.cancel": "取消",
  "dashboard.edit": "编辑",
  "dashboard.save": "保存",
  "dashboard.cancel": "取消",
  "dashboard.cancelConfirmTitle": "放弃未保存的更改？",
  "dashboard.cancelConfirmOk": "放弃更改",
  "dashboard.cancelConfirmCancel": "继续编辑",
  "dashboard.addPanel": "添加面板",
  "dashboard.clearPanels": "清空面板",
  "dashboard.clearConfirmTitle": "清空所有面板？",
  "dashboard.clearConfirmOk": "确认清空",
  "dashboard.export": "导出",
  "dashboard.import": "导入",
  "dashboard.exportSuccess": "仪表盘已导出",
  "dashboard.importSuccess": "仪表盘已导入",
  "dashboard.importError": "无效的仪表盘 JSON",
  "config.section.general": "基本信息",
  "config.section.value": "数据设置",
  "config.section.style": "图形样式",
  "config.section.tooltip": "悬浮提示窗",
  "config.section.format": "格式化",
  "config.section.thresholds": "阈值 ({n})",
  "config.section.axes": "坐标轴",
  "config.section.links": "链接 ({n})",
  "config.section.gaugeStyle": "图形样式",
  "config.section.pieStyle": "饼图样式",
  "config.section.histStyle": "直方图样式",
  "config.section.tableStyle": "表格样式",
  "config.section.overrides": "字段覆盖",
  "config.type.timeseries": "时序图",
  "config.type.bar": "柱状图",
  "config.type.histogram": "直方图",
  "config.type.stat": "统计值",
  "config.type.gauge": "仪表盘",
  "config.type.table": "表格",
  "config.type.pie": "饼图",
  "panel.type.desc.timeseries": "带时间轴的折线/面积图",
  "panel.type.desc.bar": "分组或堆叠柱状图",
  "panel.type.desc.histogram": "数值分布直方图",
  "panel.type.desc.stat": "单值统计 + 迷你图",
  "panel.type.desc.gauge": "圆弧仪表盘",
  "panel.type.desc.table": "可排序数据表格",
  "panel.type.desc.pie": "饼图 / 环形图",
  "config.field.title": "标题",
  "config.field.description": "描述",
  "config.field.panelType": "面板类型",
  "config.field.colorScheme": "配色方案",
  "config.field.lineWidth": "线宽",
  "config.field.fillOpacity": "填充透明度",
  "config.field.drawStyle": "图形样式",
  "config.field.interpolation": "插值方式",
  "config.field.lineStyle": "线条样式",
  "config.field.showPoints": "显示数据点",
  "config.field.legendPosition": "图例位置",
  "config.field.unit": "单位",
  "config.field.decimals": "小数位数",
  "config.field.min": "最小值",
  "config.field.max": "最大值",
  "config.field.reducer": "计算方式",
  "config.field.tooltipMode": "浮窗触发模式",
  "config.field.softMin": "软最小值",
  "config.field.softMax": "软最大值",
  "config.field.logScale": "对数刻度",
  "config.field.axisPlacement": "轴位置",
  "config.field.showGridLines": "网格线",
  "config.field.scaleDistribution": "刻度类型",
  "config.field.centeredZero": "零点居中",
  "config.field.stacked": "堆叠",
  "config.interp.linear": "线性",
  "config.interp.smooth": "平滑",
  "config.interp.step": "阶梯",
  "config.linestyle.solid": "实线",
  "config.linestyle.dashed": "虚线",
  "config.linestyle.dotted": "点线",
  "config.legend.bottom": "底部",
  "config.legend.right": "右侧",
  "config.legend.hidden": "隐藏",
  "config.unit.none": "无",
  "config.unit.ms": "毫秒 (ms)",
  "config.unit.percent": "百分比 (0-100)",
  "config.unit.reqps": "请求/秒",
  "config.threshold.label": "标签",
  "config.threshold.base": "基础色",
  "config.threshold.add": "添加阈值",
  "config.threshold.mode": "阈值模式",
  "config.threshold.modeAbsolute": "绝对值",
  "config.threshold.modePercentage": "百分比",
  "dashboard.refresh": "刷新",
  "dashboard.empty": "暂无面板",
  "dashboard.emptyHint": '点击"编辑"后选择"添加面板"开始',
  "variable.modal.placeholder": '点击左侧"新增变量"开始配置',
  "variable.custom.title": "自定义选项",
  "variable.custom.add": "添加选项",
  "variable.custom.allValue": "全部值",
  "variable.custom.allValue.placeholder": "自定义全选值",
  "variable.custom.col.text": "显示文本",
  "variable.custom.col.value": "值",
  "variable.custom.text.placeholder": "显示文本",
  "variable.custom.value.placeholder": "值",
  "variable.custom.addOption": "添加选项",
  "variable.custom.allowCustomValue": "允许输入自定义值",
  "variable.custom.allowClear": "允许清空",
  "variable.custom.multi": "多选",
  "variable.custom.includeAll": "包含全选项",
  "variable.general.label.placeholder": "显示标签",
  "variable.general.description": "描述",
  "variable.general.description.placeholder": "变量描述",
  "variable.general.name.required": "名称不能为空",
  "variable.general.type.required": "请选择类型",
  "variable.general.showOn": "显示方式",
  "variable.general.showOn.labelAndValue": "标签和值",
  "variable.general.showOn.value": "仅值",
  "variable.general.showOn.nothing": "不显示",
  "variable.textbox.title": "文本框选项",
  "variable.textbox.default": "默认值",
  "variable.textbox.default.placeholder": "默认值",
  "variable.textbox.width": "输入框宽度",
  "variable.constant.title": "常量选项",
  "variable.constant.value": "值",
  "variable.constant.value.required": "值不能为空",
  "variable.constant.value.notNumber": "请输入有效数字",
  "variable.constant.valueType": "值类型",
  "variable.constant.valueType.string": "字符串",
  "variable.constant.valueType.number": "数字",
  "variable.constant.hideFromList": "从变量列表隐藏",
  "variable.query.dsUid": "数据源 UID",
  "variable.query.dsUid.placeholder": "输入数据源 UID",
  "variable.query.queryType": "查询类型",
  "variable.query.queryType.placeholder": "选择查询类型",
  "variable.query.queryType.group": "主机组",
  "variable.query.queryType.host": "主机",
  "variable.query.queryType.item": "监控项",
  "variable.query.queryType.labelValues": "标签值",
  "variable.query.query": "查询语句",
  "variable.query.query.placeholder": "查询表达式",
  "variable.query.regex": "提取正则",
  "variable.query.regex.placeholder": "/regex/",
  "variable.query.sort": "排序",
  "variable.query.sort.disabled": "禁用",
  "variable.query.sort.alphabetical": "字母顺序",
  "variable.query.sort.numeric": "数字顺序",
  "variable.query.preview": "预览结果",
  "variable.query.preview.placeholder": "（保存后刷新预览）",
  "config.scheme.grafana-classic": "Grafana 经典",
  "config.scheme.green-yellow-red": "绿黄红",
  "config.scheme.red-yellow-green": "红黄绿",
  "config.scheme.blue-yellow-red": "蓝黄红",
  "config.scheme.blue-purple": "蓝紫",
  "config.scheme.yellow-blue": "黄蓝",
  "config.scheme.blues": "蓝色系",
  "config.scheme.reds": "红色系",
  "config.scheme.GrYlRd": "GrYlRd",
  "config.scheme.purple-orange": "紫橙",
  "variable.modal.title": "变量配置",
  "variable.modal.save": "保存",
  "variable.modal.cancel": "取消",
  "variable.modal.delete": "删除变量",
  "variable.modal.add": "新增变量",
  "variable.modal.empty": '点击左侧"新增变量"开始配置',
  "variable.nav.count": "变量 ({n})",
  "variable.nav.unnamed": "(未命名)",
  "variable.general.title": "基本信息",
  "variable.general.type": "类型",
  "variable.general.name": "名称",
  "variable.general.label": "标签",
  "variable.type.custom": "自定义",
  "variable.type.query": "查询",
  "variable.type.textbox": "文本框",
  "variable.type.datasource": "数据源",
  "variable.type.constant": "常量",
  "variable.query.title": "查询选项",
  "variable.query.multi": "多选",
  "variable.query.includeAll": "包含全选项",
  "variable.query.refresh": "刷新时机",
  "variable.query.refresh.onLoad": "仪表盘加载时",
  "variable.query.refresh.onTimeChange": "时间范围变化时",
  "qb.datasource": "数据源",
  "qb.addQuery": "添加查询",
  "qb.queryOptions": "查询选项",
  "qb.pattern": "数据模式",
  "qb.pattern.sine": "正弦波",
  "qb.pattern.spike": "尖峰",
  "qb.pattern.step": "阶梯",
  "qb.pattern.sawtooth": "锯齿波",
  "qb.pattern.noise": "随机噪声",
  "qb.pattern.trendUp": "上升趋势",
  "qb.pattern.trendDown": "下降趋势",
  "qb.pattern.plateau": "平台",
  "qb.pattern.randomWalk": "随机游走",
  "qb.pattern.live": "实时",
  "qb.seriesCount": "序列数量",
  "qb.liveAmplitude": "振幅",
  "qb.functions": "函数",
  "qb.functions.add": "添加",
  "qb.options": "选项",
  "qb.queryOptions.maxDataPoints": "最大数据点数",
  "qb.queryOptions.minInterval": "最小间隔",
  "qb.queryOptions.minIntervalPlaceholder": "不限制",
  "qb.queryOptions.interval": "间隔",
  "qb.queryOptions.intervalHint": "时间范围 / 最大数据点数",
  "qb.queryOptions.relativeTime": "相对时间",
  "qb.queryOptions.timeShift": "时间偏移",
  "config.scheme.classic": "经典配色",
  "config.scheme.tableau10": "Tableau配色",
  "config.scheme.fixed": "单色",
  "config.scheme.thresholds": "来自阈值",
  "config.trend.up": "上升 ↑",
  "config.trend.down": "下降 ↓",
  "config.trend.flat": "持平",
  "config.field.pieType": "饼图类型",
  "config.field.pieSliceSorting": "扇区排序",
  "config.pieType.pie": "实心饼",
  "config.pieType.donut": "环形图",
  "config.sort.desc": "降序",
  "config.sort.asc": "升序",
  "config.sort.none": "不排序",
  "config.field.pieLabels": "扇区标签",
  "config.pieLabel.name": "名称",
  "config.pieLabel.percent": "百分比",
  "config.pieLabel.value": "数值",
  "config.field.pieShow": "数据聚合",
  "config.pieShow.calculate": "聚合（Reducer）",
  "config.pieShow.all": "全部值",
  "config.field.legendMode": "图例模式",
  "config.legendMode.list": "列表",
  "config.legendMode.table": "表格",
  "config.field.legendValues": "图例统计值",
  "config.legendValue.min": "最小值",
  "config.legendValue.max": "最大值",
  "config.legendValue.mean": "平均值",
  "config.legendValue.sum": "求和",
  "config.legendValue.last": "最后值",
  "config.legendValue.first": "第一个值",
  "tooltip.pinned": "已固定",
  "tooltip.datetimeFormat": "YYYY-MM-DD HH:mm:ss",
  "config.reducer.lastNotNull": "最后非空值",
  "config.reducer.last": "最后值",
  "config.reducer.firstNotNull": "第一个非空值",
  "config.reducer.first": "第一个值",
  "config.reducer.min": "最小值",
  "config.reducer.max": "最大值",
  "config.reducer.mean": "平均值",
  "config.reducer.sum": "求和",
  "config.reducer.count": "计数",
  "config.reducer.range": "范围",
  "config.reducer.median": "中位数",
  "config.reducer.stdDev": "标准差",
  "config.reducer.variance": "方差",
  "config.reducer.delta": "增量",
  "config.reducer.diff": "差值",
  "config.reducer.diffperc": "差值 %",
  "config.reducer.step": "步长",
  "config.reducer.logmin": "最小正值",
  "config.reducer.countAll": "总计数",
  "config.reducer.changeCount": "变化次数",
  "config.reducer.distinctCount": "唯一值数",
  "config.reducer.allIsZero": "全为零",
  "config.reducer.allIsNull": "全为空",
  "config.drawStyle.lines": "折线",
  "config.drawStyle.bars": "柱状",
  "config.drawStyle.points": "散点",
  "config.tooltip.single": "单系列",
  "config.tooltip.multi": "全部",
  "config.tooltip.none": "隐藏",
  "config.tooltip.sortNone": "默认",
  "config.tooltip.sortAsc": "升序",
  "config.tooltip.sortDesc": "降序",
  "config.axis.placement.left": "左侧",
  "config.axis.placement.right": "右侧",
  "config.axis.placement.hidden": "隐藏",
  "config.axis.grid.all": "开启",
  "config.axis.grid.hidden": "隐藏",
  "config.axis.scale.linear": "线性",
  "config.axis.scale.logarithmic": "对数",
  "config.gauge.fillWidth": "激活弧宽度",
  "config.gauge.trackWidth": "轨道宽度",
  "config.gauge.trackColor": "轨道背景色",
  "config.gauge.capRound": "圆角",
  "config.gauge.valueVisible": "显示数值",
  "config.gauge.thresholdDisplay": "显示阈值方式",
  "config.gauge.thresholdDisplayNone": "不显示",
  "config.gauge.thresholdDisplayMarker": "阈值标记条",
  "config.gauge.thresholdDisplayTrack": "轨道阈值条",
  "config.gauge.orientation": "排列方式",
  "config.gauge.orientationAuto": "自动网格",
  "config.gauge.orientationHorizontal": "水平排列",
  "config.gauge.orientationVertical": "垂直排列",
  "config.gauge.valueOffsetY": "数值 Y 偏移",
  // Style section - gradient, nulls, points, stacking
  "config.field.gradientMode": "渐变模式",
  "config.gradient.none": "无",
  "config.gradient.opacity": "透明度",
  "config.gradient.hue": "色相",
  "config.gradient.scheme": "配色",
  "config.field.spanNulls": "连接空值",
  "config.field.insertNulls": "断开空值",
  "config.nulls.never": "从不",
  "config.nulls.always": "始终",
  "config.nulls.threshold": "阈值",
  "config.points.auto": "自动",
  "config.points.always": "始终",
  "config.points.never": "从不",
  "config.field.stackSeries": "堆叠序列",
  "config.stack.none": "无",
  "config.stack.normal": "普通",
  "config.stack.percent": "100%",
  // General section
  "config.field.colorSingle": "固定颜色",
  "config.field.colorDistribution": "颜色分布",
  "config.colorDist.sequential": "顺序",
  "config.colorDist.distributed": "分散",
  "config.link.newTab": "新标签页打开",
  "config.link.add": "添加链接",
  // Bar style
  "config.field.barShowValues": "显示数值",
  "config.showValues.auto": "自动",
  "config.showValues.always": "始终",
  "config.showValues.never": "从不",
  "config.field.barGroupWidth": "组宽度",
  "config.field.barWidth": "柱宽",
  "config.field.xTickRotation": "旋转 X 标签",
  // Stat style
  "config.field.orientation": "方向",
  "config.orientation.vertical": "自动（垂直）",
  "config.orientation.horizontal": "水平",
  "config.field.textMode": "文本模式",
  "config.textMode.valueAndName": "数值和名称",
  "config.textMode.value": "仅数值",
  "config.textMode.name": "仅名称",
  "config.textMode.none": "无",
  "config.field.colorMode": "颜色模式",
  "config.colorMode.value": "数值",
  "config.colorMode.backgroundSolid": "纯色背景",
  "config.colorMode.background": "渐变背景",
  "config.field.percentChange": "百分比变化",
  "config.field.value": "数值",
  "config.field.unitLabel": "单位标签",
  "config.field.trend": "趋势",
  // Histogram style
  "config.field.histBucketCount": "分桶数",
  "config.field.histBucketSize": "桶大小",
  "config.field.histBucketOffset": "桶偏移",
  "config.field.histCombineSeries": "合并序列",
  "config.hist.bucketSizePlaceholder": "自动",
  // Table style
  "config.field.tableFooterEnabled": "底栏行",
  "config.field.tableFooterReducers": "底栏计算",
  "config.field.tableFooterFields": "字段",
  "config.field.tableFooterFieldsPlaceholder": "所有数值字段",
  "config.section.tableColumnOverrides": "列覆盖",
  // Axes section
  "config.field.axisName": "名称",
  "config.field.axisLabel": "标签",
  "config.field.axisWidth": "宽度",
  "config.field.gridColor": "网格颜色",
  "config.field.axisLine": "刻度标签",
  "config.field.axisLineColor": "刻度标签颜色",
  "config.field.axisTickShow": "刻度线",
  "config.field.axisBorder": "边框",
  "config.field.axisBorderColor": "边框颜色",
  "config.axis.label.placeholder": "坐标轴标签",
  "config.axis.name.placeholder": "坐标轴名称",
  "config.axis.grid.x": "X",
  "config.axis.grid.y": "Y",
  "config.axis.scale.symlog": "对称对数",
  // Tooltip section
  "config.field.tooltipSort": "浮窗排序",
  "config.field.tooltipMaxHeight": "列表最大高度",
  "config.field.axisPointer": "坐标轴指针",
  // Unit options
  "config.unit.s": "秒 (s)",
  "config.unit.bytes": "字节",
  "config.unit.percentunit": "百分比 (0-1)",
  "config.unit.ops": "操作/秒",
  "config.unit.bps": "比特/秒",
  "config.unit.Bps": "字节/秒",
  // Gauge
  "config.gauge.arcSweep": "弧度",
  "config.gauge.paddingX": "水平内边距",
  "config.gauge.paddingY": "垂直内边距",
  "config.gauge.valueColor": "数值颜色",
  "config.gauge.valueSize": "数值大小",
  "config.gauge.colorFromScheme": "来自配色方案",
  "config.gauge.thresholdLabelDisplay": "阈值标签",
  "config.gauge.thresholdLabelNone": "隐藏",
  "config.gauge.thresholdLabelLabel": "标签",
  "config.gauge.thresholdLabelValue": "数值",
  "config.gauge.thresholdLabelBoth": "标签 + 数值",
  // Override editor
  "config.override.addRule": "添加字段覆盖",
  "config.override.addProp": "添加覆盖属性",
  "config.override.matcher.byName": "按名称匹配字段",
  "config.override.matcher.byType": "按类型匹配字段",
  "config.override.matcher.byRegexp": "按正则匹配字段",
  "config.override.matcher.byFrameRefID": "按查询返回匹配",
  "config.override.prop.unit": "单位",
  "config.override.prop.decimals": "小数位",
  "config.override.prop.displayName": "显示名称",
  "config.override.prop.min": "最小值",
  "config.override.prop.max": "最大值",
  "config.override.prop.noValue": "无数据文本",
  "config.override.prop.filterable": "可筛选",
  "config.override.prop.thresholds": "阈值",
  "config.override.prop.displayMode": "显示模式",
  "config.override.prop.width": "列宽",
  "config.override.prop.align": "对齐",
  "config.override.prop.hidden": "隐藏列",
  "config.override.prop.wrapText": "自动换行",
  "config.override.group.basic": "标准选项",
  "config.override.group.thresholds": "阈值",
  "config.override.group.table": "表格",
  "config.override.type.time": "时间",
  "config.override.type.number": "数值",
  "config.override.type.string": "字符串",
  "config.override.type.boolean": "布尔",
  // Table column overrides
  "config.field.tableColHidden": "隐藏",
  "config.field.tableColLabel": "标签",
  "config.field.tableColWidth": "宽度",
  "config.field.tableColAlign": "对齐",
  "config.field.tableColDisplayMode": "显示模式",
  "config.field.tableColWrapText": "自动换行",
  "config.field.tableColAddName": "列名",
  "config.tableAlign.auto": "自动",
  "config.tableAlign.left": "左对齐",
  "config.tableAlign.center": "居中",
  "config.tableAlign.right": "右对齐",
  "config.tableDisplayMode.auto": "自动",
  "config.tableDisplayMode.colored-text": "彩色文字",
  "config.tableDisplayMode.colored-background": "彩色背景",
  "config.tableDisplayMode.gauge": "仪表盘",
  "config.tableDisplayMode.data-links": "数据链接",
  "config.tableDisplayMode.json-view": "JSON 视图",
  "config.tableDisplayMode.pill": "标签",
  // StatsPicker
  "config.reducer.group.standard": "标准",
  "config.reducer.group.extended": "扩展",
  "config.reducer.group.boolean": "布尔",
  "config.reducer.group.percentile": "百分位",
  "config.reducer.choose": "选择",
  // Pie limit
  "config.field.pieLimit": "数量限制",
  // Variable datasource section
  "variable.ds.title": "数据源选项",
  "variable.ds.type": "数据源类型",
  "variable.ds.type.placeholder": "选择数据源类型",
  "variable.ds.filterRegex": "实例过滤正则",
  "variable.ds.multi": "多选",
  "variable.ds.includeAll": "包含全选项",
  // Editor - VizPicker
  "editor.vizPicker.title": "可视化类型",
  // Editor - Overrides
  "editor.overrides.matcherValue": "匹配值",
  "editor.overrides.propValue": "属性值",
  "editor.overrides.addProperty": "添加属性覆盖",
  "editor.overrides.addOverride": "添加字段覆盖",
  // Zabbix QueryEditor — query types
  "qb.queryType": "查询类型",
  "qb.queryType.metrics": "指标",
  "qb.queryType.text": "文本",
  "qb.queryType.services": "IT服务",
  "qb.queryType.itemid": "监控项ID",
  "qb.queryType.triggers": "触发器",
  "qb.queryType.problems": "告警",
  "qb.queryType.macros": "宏变量",
  "qb.queryType.lld": "自动发现",
  // Zabbix QueryEditor — host/group/item fields
  "panel.group": "主机组",
  "panel.group.placeholder": "选择主机组",
  "panel.host": "主机",
  "panel.host.placeholder": "选择主机",
  "panel.itemTag": "监控项标签",
  "panel.itemTag.placeholder": "按标签过滤",
  "panel.items": "监控项",
  "panel.items.placeholder": "选择监控项",
  // Zabbix QueryEditor — query fields
  "qb.textFilter": "文本过滤",
  "qb.textFilter.placeholder": "正则表达式",
  "qb.useCaptureGroups": "使用捕获分组",
  "qb.itemIds": "监控项 ID",
  "qb.itemIds.placeholder": "多个 ID 用逗号分隔",
  "qb.triggerFilter": "触发器过滤",
  "qb.triggerFilter.placeholder": "触发器名称",
  "qb.problemName": "告警名称",
  "qb.problemName.placeholder": "告警名称过滤",
  "qb.tags": "标签",
  "qb.tags.placeholder": "tag:value",
  "qb.show": "显示",
  "qb.severity": "严重程度",
  "qb.itService": "IT服务",
  "qb.itService.placeholder": "选择IT服务",
  "qb.slaProperty": "SLA属性",
  "qb.slaInterval": "SLA时间间隔",
  "qb.macroFilter": "宏过滤",
  // Zabbix QueryEditor — LLD
  "qb.lld.rule": "发现规则",
  "qb.lld.rule.placeholder": "选择发现规则",
  "qb.lld.itemKeys": "监控项原型键",
  "qb.lld.itemKeys.placeholder": "选择原型键",
  // Zabbix QueryEditor — options
  "qb.ack.all": "所有",
  "qb.ack.unack": "未确认",
  "qb.ack.ack": "已确认",
  "qb.sort.default": "默认",
  "qb.sort.lastchange": "最后变更",
  "qb.sort.severity": "严重程度",
  "qb.trends.default": "默认",
  "qb.trends.true": "使用趋势",
  "qb.trends.false": "不使用趋势",
  "qb.options.trends": "趋势数据",
  "qb.options.showDisabled": "显示禁用项",
  "qb.options.valueMapping": "使用 Zabbix 值映射",
  "qb.options.disableAlignment": "禁用数据对齐",
  "qb.options.acknowledged": "确认状态",
  "qb.options.sortBy": "排序",
  "qb.options.useTimeRange": "使用时间范围",
  "qb.options.hostsInMaintenance": "维护中主机",
  "qb.options.hostProxy": "Host Proxy",
  "qb.options.limit": "数量限制"
}, Rp = { zh: Rf, en: Np }, Lf = Symbol("lang");
function Lp(e) {
  fl(Lf, e);
}
function st() {
  const e = dl(Lf, pe("zh"));
  function t(n, i) {
    let l = Rp[e.value][n] ?? Rf[n] ?? n;
    if (i)
      for (const [u, r] of Object.entries(i))
        l = l.replace(`{${u}}`, String(r));
    return l;
  }
  return { t, lang: e };
}
const qp = {
  hideHeader: !1,
  canEdit: !0,
  theme: null,
  lang: null,
  isEditing: null,
  initialEditingPanelId: null,
  datasourceConfig: null
}, qf = Symbol("argusBoardConfig");
function Ff(e) {
  return { config: hp(oe(e)) };
}
function Fp(e) {
  const t = Ff(e);
  return fl(qf, t), t;
}
function no() {
  const e = dl(qf);
  return e || Ff(() => qp);
}
async function Vp(e) {
  const t = await fetch(`${e.url}/v5/metrics`, {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      ...e.token ? { Authorization: `Bearer ${e.token}` } : {}
    }
  });
  if (!t.ok)
    throw new Error(`Argus API HTTP error: ${t.status}`);
  return (await t.json()).data?.metrics ?? [];
}
async function Wp(e, t) {
  const n = new URLSearchParams({ signal: t.signal });
  t.metricName && n.set("metricName", t.metricName), t.search && n.set("search", t.search);
  const i = await fetch(`${e.url}/v5/attribute_keys?${n.toString()}`, {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      ...e.token ? { Authorization: `Bearer ${e.token}` } : {}
    }
  });
  if (!i.ok)
    throw new Error(`Argus API HTTP error: ${i.status}`);
  return (await i.json()).data?.attributeKeys ?? [];
}
//! moment.js
//! version : 2.30.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
var Vf;
function Ie() {
  return Vf.apply(null, arguments);
}
function Yp(e) {
  Vf = e;
}
function Oi(e) {
  return e instanceof Array || Object.prototype.toString.call(e) === "[object Array]";
}
function ol(e) {
  return e != null && Object.prototype.toString.call(e) === "[object Object]";
}
function xt(e, t) {
  return Object.prototype.hasOwnProperty.call(e, t);
}
function Fu(e) {
  if (Object.getOwnPropertyNames)
    return Object.getOwnPropertyNames(e).length === 0;
  var t;
  for (t in e)
    if (xt(e, t))
      return !1;
  return !0;
}
function qn(e) {
  return e === void 0;
}
function ga(e) {
  return typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]";
}
function es(e) {
  return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]";
}
function Wf(e, t) {
  var n = [], i, a = e.length;
  for (i = 0; i < a; ++i)
    n.push(t(e[i], i));
  return n;
}
function $a(e, t) {
  for (var n in t)
    xt(t, n) && (e[n] = t[n]);
  return xt(t, "toString") && (e.toString = t.toString), xt(t, "valueOf") && (e.valueOf = t.valueOf), e;
}
function ji(e, t, n, i) {
  return dh(e, t, n, i, !0).utc();
}
function Bp() {
  return {
    empty: !1,
    unusedTokens: [],
    unusedInput: [],
    overflow: -2,
    charsLeftOver: 0,
    nullInput: !1,
    invalidEra: null,
    invalidMonth: null,
    invalidFormat: !1,
    userInvalidated: !1,
    iso: !1,
    parsedDateParts: [],
    era: null,
    meridiem: null,
    rfc2822: !1,
    weekdayMismatch: !1
  };
}
function lt(e) {
  return e._pf == null && (e._pf = Bp()), e._pf;
}
var gu;
Array.prototype.some ? gu = Array.prototype.some : gu = function(e) {
  var t = Object(this), n = t.length >>> 0, i;
  for (i = 0; i < n; i++)
    if (i in t && e.call(this, t[i], i, t))
      return !0;
  return !1;
};
function Vu(e) {
  var t = null, n = !1, i = e._d && !isNaN(e._d.getTime());
  if (i && (t = lt(e), n = gu.call(t.parsedDateParts, function(a) {
    return a != null;
  }), i = t.overflow < 0 && !t.empty && !t.invalidEra && !t.invalidMonth && !t.invalidWeekday && !t.weekdayMismatch && !t.nullInput && !t.invalidFormat && !t.userInvalidated && (!t.meridiem || t.meridiem && n), e._strict && (i = i && t.charsLeftOver === 0 && t.unusedTokens.length === 0 && t.bigHour === void 0)), Object.isFrozen == null || !Object.isFrozen(e))
    e._isValid = i;
  else
    return i;
  return e._isValid;
}
function ir(e) {
  var t = ji(NaN);
  return e != null ? $a(lt(t), e) : lt(t).userInvalidated = !0, t;
}
var Oc = Ie.momentProperties = [], qr = !1;
function Wu(e, t) {
  var n, i, a, l = Oc.length;
  if (qn(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject), qn(t._i) || (e._i = t._i), qn(t._f) || (e._f = t._f), qn(t._l) || (e._l = t._l), qn(t._strict) || (e._strict = t._strict), qn(t._tzm) || (e._tzm = t._tzm), qn(t._isUTC) || (e._isUTC = t._isUTC), qn(t._offset) || (e._offset = t._offset), qn(t._pf) || (e._pf = lt(t)), qn(t._locale) || (e._locale = t._locale), l > 0)
    for (n = 0; n < l; n++)
      i = Oc[n], a = t[i], qn(a) || (e[i] = a);
  return e;
}
function ts(e) {
  Wu(this, e), this._d = new Date(e._d != null ? e._d.getTime() : NaN), this.isValid() || (this._d = /* @__PURE__ */ new Date(NaN)), qr === !1 && (qr = !0, Ie.updateOffset(this), qr = !1);
}
function Pi(e) {
  return e instanceof ts || e != null && e._isAMomentObject != null;
}
function Yf(e) {
  Ie.suppressDeprecationWarnings === !1 && typeof console < "u" && console.warn && console.warn("Deprecation warning: " + e);
}
function hi(e, t) {
  var n = !0;
  return $a(function() {
    if (Ie.deprecationHandler != null && Ie.deprecationHandler(null, e), n) {
      var i = [], a, l, u, r = arguments.length;
      for (l = 0; l < r; l++) {
        if (a = "", typeof arguments[l] == "object") {
          a += `
[` + l + "] ";
          for (u in arguments[0])
            xt(arguments[0], u) && (a += u + ": " + arguments[0][u] + ", ");
          a = a.slice(0, -2);
        } else
          a = arguments[l];
        i.push(a);
      }
      Yf(
        e + `
Arguments: ` + Array.prototype.slice.call(i).join("") + `
` + new Error().stack
      ), n = !1;
    }
    return t.apply(this, arguments);
  }, t);
}
var Pc = {};
function Bf(e, t) {
  Ie.deprecationHandler != null && Ie.deprecationHandler(e, t), Pc[e] || (Yf(t), Pc[e] = !0);
}
Ie.suppressDeprecationWarnings = !1;
Ie.deprecationHandler = null;
function Ui(e) {
  return typeof Function < "u" && e instanceof Function || Object.prototype.toString.call(e) === "[object Function]";
}
function Hp(e) {
  var t, n;
  for (n in e)
    xt(e, n) && (t = e[n], Ui(t) ? this[n] = t : this["_" + n] = t);
  this._config = e, this._dayOfMonthOrdinalParseLenient = new RegExp(
    (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
  );
}
function pu(e, t) {
  var n = $a({}, e), i;
  for (i in t)
    xt(t, i) && (ol(e[i]) && ol(t[i]) ? (n[i] = {}, $a(n[i], e[i]), $a(n[i], t[i])) : t[i] != null ? n[i] = t[i] : delete n[i]);
  for (i in e)
    xt(e, i) && !xt(t, i) && ol(e[i]) && (n[i] = $a({}, n[i]));
  return n;
}
function Yu(e) {
  e != null && this.set(e);
}
var mu;
Object.keys ? mu = Object.keys : mu = function(e) {
  var t, n = [];
  for (t in e)
    xt(e, t) && n.push(t);
  return n;
};
var jp = {
  sameDay: "[Today at] LT",
  nextDay: "[Tomorrow at] LT",
  nextWeek: "dddd [at] LT",
  lastDay: "[Yesterday at] LT",
  lastWeek: "[Last] dddd [at] LT",
  sameElse: "L"
};
function Up(e, t, n) {
  var i = this._calendar[e] || this._calendar.sameElse;
  return Ui(i) ? i.call(t, n) : i;
}
function Bi(e, t, n) {
  var i = "" + Math.abs(e), a = t - i.length, l = e >= 0;
  return (l ? n ? "+" : "" : "-") + Math.pow(10, Math.max(0, a)).toString().substr(1) + i;
}
var Bu = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, Ss = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, Fr = {}, Hl = {};
function je(e, t, n, i) {
  var a = i;
  typeof i == "string" && (a = function() {
    return this[i]();
  }), e && (Hl[e] = a), t && (Hl[t[0]] = function() {
    return Bi(a.apply(this, arguments), t[1], t[2]);
  }), n && (Hl[n] = function() {
    return this.localeData().ordinal(
      a.apply(this, arguments),
      e
    );
  });
}
function Gp(e) {
  return e.match(/\[[\s\S]/) ? e.replace(/^\[|\]$/g, "") : e.replace(/\\/g, "");
}
function Kp(e) {
  var t = e.match(Bu), n, i;
  for (n = 0, i = t.length; n < i; n++)
    Hl[t[n]] ? t[n] = Hl[t[n]] : t[n] = Gp(t[n]);
  return function(a) {
    var l = "", u;
    for (u = 0; u < i; u++)
      l += Ui(t[u]) ? t[u].call(a, e) : t[u];
    return l;
  };
}
function Ns(e, t) {
  return e.isValid() ? (t = Hf(t, e.localeData()), Fr[t] = Fr[t] || Kp(t), Fr[t](e)) : e.localeData().invalidDate();
}
function Hf(e, t) {
  var n = 5;
  function i(a) {
    return t.longDateFormat(a) || a;
  }
  for (Ss.lastIndex = 0; n >= 0 && Ss.test(e); )
    e = e.replace(
      Ss,
      i
    ), Ss.lastIndex = 0, n -= 1;
  return e;
}
var Zp = {
  LTS: "h:mm:ss A",
  LT: "h:mm A",
  L: "MM/DD/YYYY",
  LL: "MMMM D, YYYY",
  LLL: "MMMM D, YYYY h:mm A",
  LLLL: "dddd, MMMM D, YYYY h:mm A"
};
function Qp(e) {
  var t = this._longDateFormat[e], n = this._longDateFormat[e.toUpperCase()];
  return t || !n ? t : (this._longDateFormat[e] = n.match(Bu).map(function(i) {
    return i === "MMMM" || i === "MM" || i === "DD" || i === "dddd" ? i.slice(1) : i;
  }).join(""), this._longDateFormat[e]);
}
var Xp = "Invalid date";
function Jp() {
  return this._invalidDate;
}
var em = "%d", tm = /\d{1,2}/;
function nm(e) {
  return this._ordinal.replace("%d", e);
}
var im = {
  future: "in %s",
  past: "%s ago",
  s: "a few seconds",
  ss: "%d seconds",
  m: "a minute",
  mm: "%d minutes",
  h: "an hour",
  hh: "%d hours",
  d: "a day",
  dd: "%d days",
  w: "a week",
  ww: "%d weeks",
  M: "a month",
  MM: "%d months",
  y: "a year",
  yy: "%d years"
};
function am(e, t, n, i) {
  var a = this._relativeTime[n];
  return Ui(a) ? a(e, t, n, i) : a.replace(/%d/i, e);
}
function lm(e, t) {
  var n = this._relativeTime[e > 0 ? "future" : "past"];
  return Ui(n) ? n(t) : n.replace(/%s/i, t);
}
var Ic = {
  D: "date",
  dates: "date",
  date: "date",
  d: "day",
  days: "day",
  day: "day",
  e: "weekday",
  weekdays: "weekday",
  weekday: "weekday",
  E: "isoWeekday",
  isoweekdays: "isoWeekday",
  isoweekday: "isoWeekday",
  DDD: "dayOfYear",
  dayofyears: "dayOfYear",
  dayofyear: "dayOfYear",
  h: "hour",
  hours: "hour",
  hour: "hour",
  ms: "millisecond",
  milliseconds: "millisecond",
  millisecond: "millisecond",
  m: "minute",
  minutes: "minute",
  minute: "minute",
  M: "month",
  months: "month",
  month: "month",
  Q: "quarter",
  quarters: "quarter",
  quarter: "quarter",
  s: "second",
  seconds: "second",
  second: "second",
  gg: "weekYear",
  weekyears: "weekYear",
  weekyear: "weekYear",
  GG: "isoWeekYear",
  isoweekyears: "isoWeekYear",
  isoweekyear: "isoWeekYear",
  w: "week",
  weeks: "week",
  week: "week",
  W: "isoWeek",
  isoweeks: "isoWeek",
  isoweek: "isoWeek",
  y: "year",
  years: "year",
  year: "year"
};
function gi(e) {
  return typeof e == "string" ? Ic[e] || Ic[e.toLowerCase()] : void 0;
}
function Hu(e) {
  var t = {}, n, i;
  for (i in e)
    xt(e, i) && (n = gi(i), n && (t[n] = e[i]));
  return t;
}
var om = {
  date: 9,
  day: 11,
  weekday: 11,
  isoWeekday: 11,
  dayOfYear: 4,
  hour: 13,
  millisecond: 16,
  minute: 14,
  month: 8,
  quarter: 7,
  second: 15,
  weekYear: 1,
  isoWeekYear: 1,
  week: 5,
  isoWeek: 5,
  year: 1
};
function sm(e) {
  var t = [], n;
  for (n in e)
    xt(e, n) && t.push({ unit: n, priority: om[n] });
  return t.sort(function(i, a) {
    return i.priority - a.priority;
  }), t;
}
var jf = /\d/, Jn = /\d\d/, Uf = /\d{3}/, ju = /\d{4}/, ar = /[+-]?\d{6}/, Yt = /\d\d?/, Gf = /\d\d\d\d?/, Kf = /\d\d\d\d\d\d?/, lr = /\d{1,3}/, Uu = /\d{1,4}/, or = /[+-]?\d{1,6}/, io = /\d+/, sr = /[+-]?\d+/, rm = /Z|[+-]\d\d:?\d\d/gi, rr = /Z|[+-]\d\d(?::?\d\d)?/gi, um = /[+-]?\d+(\.\d{1,3})?/, ns = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, ao = /^[1-9]\d?/, Gu = /^([1-9]\d|\d)/, Hs;
Hs = {};
function Ae(e, t, n) {
  Hs[e] = Ui(t) ? t : function(i, a) {
    return i && n ? n : t;
  };
}
function cm(e, t) {
  return xt(Hs, e) ? Hs[e](t._strict, t._locale) : new RegExp(dm(e));
}
function dm(e) {
  return ca(
    e.replace("\\", "").replace(
      /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
      function(t, n, i, a, l) {
        return n || i || a || l;
      }
    )
  );
}
function ca(e) {
  return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function ci(e) {
  return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
}
function ft(e) {
  var t = +e, n = 0;
  return t !== 0 && isFinite(t) && (n = ci(t)), n;
}
var vu = {};
function Pt(e, t) {
  var n, i = t, a;
  for (typeof e == "string" && (e = [e]), ga(t) && (i = function(l, u) {
    u[t] = ft(l);
  }), a = e.length, n = 0; n < a; n++)
    vu[e[n]] = i;
}
function is(e, t) {
  Pt(e, function(n, i, a, l) {
    a._w = a._w || {}, t(n, a._w, a, l);
  });
}
function fm(e, t, n) {
  t != null && xt(vu, e) && vu[e](t, n._a, n, e);
}
function ur(e) {
  return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0;
}
var zn = 0, ra = 1, Vi = 2, bn = 3, Ti = 4, ua = 5, ll = 6, hm = 7, gm = 8;
je("Y", 0, 0, function() {
  var e = this.year();
  return e <= 9999 ? Bi(e, 4) : "+" + e;
});
je(0, ["YY", 2], 0, function() {
  return this.year() % 100;
});
je(0, ["YYYY", 4], 0, "year");
je(0, ["YYYYY", 5], 0, "year");
je(0, ["YYYYYY", 6, !0], 0, "year");
Ae("Y", sr);
Ae("YY", Yt, Jn);
Ae("YYYY", Uu, ju);
Ae("YYYYY", or, ar);
Ae("YYYYYY", or, ar);
Pt(["YYYYY", "YYYYYY"], zn);
Pt("YYYY", function(e, t) {
  t[zn] = e.length === 2 ? Ie.parseTwoDigitYear(e) : ft(e);
});
Pt("YY", function(e, t) {
  t[zn] = Ie.parseTwoDigitYear(e);
});
Pt("Y", function(e, t) {
  t[zn] = parseInt(e, 10);
});
function Lo(e) {
  return ur(e) ? 366 : 365;
}
Ie.parseTwoDigitYear = function(e) {
  return ft(e) + (ft(e) > 68 ? 1900 : 2e3);
};
var Zf = lo("FullYear", !0);
function pm() {
  return ur(this.year());
}
function lo(e, t) {
  return function(n) {
    return n != null ? (Qf(this, e, n), Ie.updateOffset(this, t), this) : Uo(this, e);
  };
}
function Uo(e, t) {
  if (!e.isValid())
    return NaN;
  var n = e._d, i = e._isUTC;
  switch (t) {
    case "Milliseconds":
      return i ? n.getUTCMilliseconds() : n.getMilliseconds();
    case "Seconds":
      return i ? n.getUTCSeconds() : n.getSeconds();
    case "Minutes":
      return i ? n.getUTCMinutes() : n.getMinutes();
    case "Hours":
      return i ? n.getUTCHours() : n.getHours();
    case "Date":
      return i ? n.getUTCDate() : n.getDate();
    case "Day":
      return i ? n.getUTCDay() : n.getDay();
    case "Month":
      return i ? n.getUTCMonth() : n.getMonth();
    case "FullYear":
      return i ? n.getUTCFullYear() : n.getFullYear();
    default:
      return NaN;
  }
}
function Qf(e, t, n) {
  var i, a, l, u, r;
  if (!(!e.isValid() || isNaN(n))) {
    switch (i = e._d, a = e._isUTC, t) {
      case "Milliseconds":
        return void (a ? i.setUTCMilliseconds(n) : i.setMilliseconds(n));
      case "Seconds":
        return void (a ? i.setUTCSeconds(n) : i.setSeconds(n));
      case "Minutes":
        return void (a ? i.setUTCMinutes(n) : i.setMinutes(n));
      case "Hours":
        return void (a ? i.setUTCHours(n) : i.setHours(n));
      case "Date":
        return void (a ? i.setUTCDate(n) : i.setDate(n));
      // case 'Day': // Not real
      //    return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
      // case 'Month': // Not used because we need to pass two variables
      //     return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
      case "FullYear":
        break;
      // See below ...
      default:
        return;
    }
    l = n, u = e.month(), r = e.date(), r = r === 29 && u === 1 && !ur(l) ? 28 : r, a ? i.setUTCFullYear(l, u, r) : i.setFullYear(l, u, r);
  }
}
function mm(e) {
  return e = gi(e), Ui(this[e]) ? this[e]() : this;
}
function vm(e, t) {
  if (typeof e == "object") {
    e = Hu(e);
    var n = sm(e), i, a = n.length;
    for (i = 0; i < a; i++)
      this[n[i].unit](e[n[i].unit]);
  } else if (e = gi(e), Ui(this[e]))
    return this[e](t);
  return this;
}
function ym(e, t) {
  return (e % t + t) % t;
}
var sn;
Array.prototype.indexOf ? sn = Array.prototype.indexOf : sn = function(e) {
  var t;
  for (t = 0; t < this.length; ++t)
    if (this[t] === e)
      return t;
  return -1;
};
function Ku(e, t) {
  if (isNaN(e) || isNaN(t))
    return NaN;
  var n = ym(t, 12);
  return e += (t - n) / 12, n === 1 ? ur(e) ? 29 : 28 : 31 - n % 7 % 2;
}
je("M", ["MM", 2], "Mo", function() {
  return this.month() + 1;
});
je("MMM", 0, 0, function(e) {
  return this.localeData().monthsShort(this, e);
});
je("MMMM", 0, 0, function(e) {
  return this.localeData().months(this, e);
});
Ae("M", Yt, ao);
Ae("MM", Yt, Jn);
Ae("MMM", function(e, t) {
  return t.monthsShortRegex(e);
});
Ae("MMMM", function(e, t) {
  return t.monthsRegex(e);
});
Pt(["M", "MM"], function(e, t) {
  t[ra] = ft(e) - 1;
});
Pt(["MMM", "MMMM"], function(e, t, n, i) {
  var a = n._locale.monthsParse(e, i, n._strict);
  a != null ? t[ra] = a : lt(n).invalidMonth = e;
});
var bm = "January_February_March_April_May_June_July_August_September_October_November_December".split(
  "_"
), Xf = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), Jf = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, xm = ns, wm = ns;
function Sm(e, t) {
  return e ? Oi(this._months) ? this._months[e.month()] : this._months[(this._months.isFormat || Jf).test(t) ? "format" : "standalone"][e.month()] : Oi(this._months) ? this._months : this._months.standalone;
}
function km(e, t) {
  return e ? Oi(this._monthsShort) ? this._monthsShort[e.month()] : this._monthsShort[Jf.test(t) ? "format" : "standalone"][e.month()] : Oi(this._monthsShort) ? this._monthsShort : this._monthsShort.standalone;
}
function _m(e, t, n) {
  var i, a, l, u = e.toLocaleLowerCase();
  if (!this._monthsParse)
    for (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = [], i = 0; i < 12; ++i)
      l = ji([2e3, i]), this._shortMonthsParse[i] = this.monthsShort(
        l,
        ""
      ).toLocaleLowerCase(), this._longMonthsParse[i] = this.months(l, "").toLocaleLowerCase();
  return n ? t === "MMM" ? (a = sn.call(this._shortMonthsParse, u), a !== -1 ? a : null) : (a = sn.call(this._longMonthsParse, u), a !== -1 ? a : null) : t === "MMM" ? (a = sn.call(this._shortMonthsParse, u), a !== -1 ? a : (a = sn.call(this._longMonthsParse, u), a !== -1 ? a : null)) : (a = sn.call(this._longMonthsParse, u), a !== -1 ? a : (a = sn.call(this._shortMonthsParse, u), a !== -1 ? a : null));
}
function Cm(e, t, n) {
  var i, a, l;
  if (this._monthsParseExact)
    return _m.call(this, e, t, n);
  for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), i = 0; i < 12; i++) {
    if (a = ji([2e3, i]), n && !this._longMonthsParse[i] && (this._longMonthsParse[i] = new RegExp(
      "^" + this.months(a, "").replace(".", "") + "$",
      "i"
    ), this._shortMonthsParse[i] = new RegExp(
      "^" + this.monthsShort(a, "").replace(".", "") + "$",
      "i"
    )), !n && !this._monthsParse[i] && (l = "^" + this.months(a, "") + "|^" + this.monthsShort(a, ""), this._monthsParse[i] = new RegExp(l.replace(".", ""), "i")), n && t === "MMMM" && this._longMonthsParse[i].test(e))
      return i;
    if (n && t === "MMM" && this._shortMonthsParse[i].test(e))
      return i;
    if (!n && this._monthsParse[i].test(e))
      return i;
  }
}
function eh(e, t) {
  if (!e.isValid())
    return e;
  if (typeof t == "string") {
    if (/^\d+$/.test(t))
      t = ft(t);
    else if (t = e.localeData().monthsParse(t), !ga(t))
      return e;
  }
  var n = t, i = e.date();
  return i = i < 29 ? i : Math.min(i, Ku(e.year(), n)), e._isUTC ? e._d.setUTCMonth(n, i) : e._d.setMonth(n, i), e;
}
function th(e) {
  return e != null ? (eh(this, e), Ie.updateOffset(this, !0), this) : Uo(this, "Month");
}
function Mm() {
  return Ku(this.year(), this.month());
}
function Tm(e) {
  return this._monthsParseExact ? (xt(this, "_monthsRegex") || nh.call(this), e ? this._monthsShortStrictRegex : this._monthsShortRegex) : (xt(this, "_monthsShortRegex") || (this._monthsShortRegex = xm), this._monthsShortStrictRegex && e ? this._monthsShortStrictRegex : this._monthsShortRegex);
}
function zm(e) {
  return this._monthsParseExact ? (xt(this, "_monthsRegex") || nh.call(this), e ? this._monthsStrictRegex : this._monthsRegex) : (xt(this, "_monthsRegex") || (this._monthsRegex = wm), this._monthsStrictRegex && e ? this._monthsStrictRegex : this._monthsRegex);
}
function nh() {
  function e(c, g) {
    return g.length - c.length;
  }
  var t = [], n = [], i = [], a, l, u, r;
  for (a = 0; a < 12; a++)
    l = ji([2e3, a]), u = ca(this.monthsShort(l, "")), r = ca(this.months(l, "")), t.push(u), n.push(r), i.push(r), i.push(u);
  t.sort(e), n.sort(e), i.sort(e), this._monthsRegex = new RegExp("^(" + i.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = new RegExp(
    "^(" + n.join("|") + ")",
    "i"
  ), this._monthsShortStrictRegex = new RegExp(
    "^(" + t.join("|") + ")",
    "i"
  );
}
function Dm(e, t, n, i, a, l, u) {
  var r;
  return e < 100 && e >= 0 ? (r = new Date(e + 400, t, n, i, a, l, u), isFinite(r.getFullYear()) && r.setFullYear(e)) : r = new Date(e, t, n, i, a, l, u), r;
}
function Go(e) {
  var t, n;
  return e < 100 && e >= 0 ? (n = Array.prototype.slice.call(arguments), n[0] = e + 400, t = new Date(Date.UTC.apply(null, n)), isFinite(t.getUTCFullYear()) && t.setUTCFullYear(e)) : t = new Date(Date.UTC.apply(null, arguments)), t;
}
function js(e, t, n) {
  var i = 7 + t - n, a = (7 + Go(e, 0, i).getUTCDay() - t) % 7;
  return -a + i - 1;
}
function ih(e, t, n, i, a) {
  var l = (7 + n - i) % 7, u = js(e, i, a), r = 1 + 7 * (t - 1) + l + u, c, g;
  return r <= 0 ? (c = e - 1, g = Lo(c) + r) : r > Lo(e) ? (c = e + 1, g = r - Lo(e)) : (c = e, g = r), {
    year: c,
    dayOfYear: g
  };
}
function Ko(e, t, n) {
  var i = js(e.year(), t, n), a = Math.floor((e.dayOfYear() - i - 1) / 7) + 1, l, u;
  return a < 1 ? (u = e.year() - 1, l = a + da(u, t, n)) : a > da(e.year(), t, n) ? (l = a - da(e.year(), t, n), u = e.year() + 1) : (u = e.year(), l = a), {
    week: l,
    year: u
  };
}
function da(e, t, n) {
  var i = js(e, t, n), a = js(e + 1, t, n);
  return (Lo(e) - i + a) / 7;
}
je("w", ["ww", 2], "wo", "week");
je("W", ["WW", 2], "Wo", "isoWeek");
Ae("w", Yt, ao);
Ae("ww", Yt, Jn);
Ae("W", Yt, ao);
Ae("WW", Yt, Jn);
is(
  ["w", "ww", "W", "WW"],
  function(e, t, n, i) {
    t[i.substr(0, 1)] = ft(e);
  }
);
function Om(e) {
  return Ko(e, this._week.dow, this._week.doy).week;
}
var Pm = {
  dow: 0,
  // Sunday is the first day of the week.
  doy: 6
  // The week that contains Jan 6th is the first week of the year.
};
function Im() {
  return this._week.dow;
}
function Em() {
  return this._week.doy;
}
function $m(e) {
  var t = this.localeData().week(this);
  return e == null ? t : this.add((e - t) * 7, "d");
}
function Am(e) {
  var t = Ko(this, 1, 4).week;
  return e == null ? t : this.add((e - t) * 7, "d");
}
je("d", 0, "do", "day");
je("dd", 0, 0, function(e) {
  return this.localeData().weekdaysMin(this, e);
});
je("ddd", 0, 0, function(e) {
  return this.localeData().weekdaysShort(this, e);
});
je("dddd", 0, 0, function(e) {
  return this.localeData().weekdays(this, e);
});
je("e", 0, 0, "weekday");
je("E", 0, 0, "isoWeekday");
Ae("d", Yt);
Ae("e", Yt);
Ae("E", Yt);
Ae("dd", function(e, t) {
  return t.weekdaysMinRegex(e);
});
Ae("ddd", function(e, t) {
  return t.weekdaysShortRegex(e);
});
Ae("dddd", function(e, t) {
  return t.weekdaysRegex(e);
});
is(["dd", "ddd", "dddd"], function(e, t, n, i) {
  var a = n._locale.weekdaysParse(e, i, n._strict);
  a != null ? t.d = a : lt(n).invalidWeekday = e;
});
is(["d", "e", "E"], function(e, t, n, i) {
  t[i] = ft(e);
});
function Nm(e, t) {
  return typeof e != "string" ? e : isNaN(e) ? (e = t.weekdaysParse(e), typeof e == "number" ? e : null) : parseInt(e, 10);
}
function Rm(e, t) {
  return typeof e == "string" ? t.weekdaysParse(e) % 7 || 7 : isNaN(e) ? null : e;
}
function Zu(e, t) {
  return e.slice(t, 7).concat(e.slice(0, t));
}
var Lm = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), ah = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), qm = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), Fm = ns, Vm = ns, Wm = ns;
function Ym(e, t) {
  var n = Oi(this._weekdays) ? this._weekdays : this._weekdays[e && e !== !0 && this._weekdays.isFormat.test(t) ? "format" : "standalone"];
  return e === !0 ? Zu(n, this._week.dow) : e ? n[e.day()] : n;
}
function Bm(e) {
  return e === !0 ? Zu(this._weekdaysShort, this._week.dow) : e ? this._weekdaysShort[e.day()] : this._weekdaysShort;
}
function Hm(e) {
  return e === !0 ? Zu(this._weekdaysMin, this._week.dow) : e ? this._weekdaysMin[e.day()] : this._weekdaysMin;
}
function jm(e, t, n) {
  var i, a, l, u = e.toLocaleLowerCase();
  if (!this._weekdaysParse)
    for (this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = [], i = 0; i < 7; ++i)
      l = ji([2e3, 1]).day(i), this._minWeekdaysParse[i] = this.weekdaysMin(
        l,
        ""
      ).toLocaleLowerCase(), this._shortWeekdaysParse[i] = this.weekdaysShort(
        l,
        ""
      ).toLocaleLowerCase(), this._weekdaysParse[i] = this.weekdays(l, "").toLocaleLowerCase();
  return n ? t === "dddd" ? (a = sn.call(this._weekdaysParse, u), a !== -1 ? a : null) : t === "ddd" ? (a = sn.call(this._shortWeekdaysParse, u), a !== -1 ? a : null) : (a = sn.call(this._minWeekdaysParse, u), a !== -1 ? a : null) : t === "dddd" ? (a = sn.call(this._weekdaysParse, u), a !== -1 || (a = sn.call(this._shortWeekdaysParse, u), a !== -1) ? a : (a = sn.call(this._minWeekdaysParse, u), a !== -1 ? a : null)) : t === "ddd" ? (a = sn.call(this._shortWeekdaysParse, u), a !== -1 || (a = sn.call(this._weekdaysParse, u), a !== -1) ? a : (a = sn.call(this._minWeekdaysParse, u), a !== -1 ? a : null)) : (a = sn.call(this._minWeekdaysParse, u), a !== -1 || (a = sn.call(this._weekdaysParse, u), a !== -1) ? a : (a = sn.call(this._shortWeekdaysParse, u), a !== -1 ? a : null));
}
function Um(e, t, n) {
  var i, a, l;
  if (this._weekdaysParseExact)
    return jm.call(this, e, t, n);
  for (this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), i = 0; i < 7; i++) {
    if (a = ji([2e3, 1]).day(i), n && !this._fullWeekdaysParse[i] && (this._fullWeekdaysParse[i] = new RegExp(
      "^" + this.weekdays(a, "").replace(".", "\\.?") + "$",
      "i"
    ), this._shortWeekdaysParse[i] = new RegExp(
      "^" + this.weekdaysShort(a, "").replace(".", "\\.?") + "$",
      "i"
    ), this._minWeekdaysParse[i] = new RegExp(
      "^" + this.weekdaysMin(a, "").replace(".", "\\.?") + "$",
      "i"
    )), this._weekdaysParse[i] || (l = "^" + this.weekdays(a, "") + "|^" + this.weekdaysShort(a, "") + "|^" + this.weekdaysMin(a, ""), this._weekdaysParse[i] = new RegExp(l.replace(".", ""), "i")), n && t === "dddd" && this._fullWeekdaysParse[i].test(e))
      return i;
    if (n && t === "ddd" && this._shortWeekdaysParse[i].test(e))
      return i;
    if (n && t === "dd" && this._minWeekdaysParse[i].test(e))
      return i;
    if (!n && this._weekdaysParse[i].test(e))
      return i;
  }
}
function Gm(e) {
  if (!this.isValid())
    return e != null ? this : NaN;
  var t = Uo(this, "Day");
  return e != null ? (e = Nm(e, this.localeData()), this.add(e - t, "d")) : t;
}
function Km(e) {
  if (!this.isValid())
    return e != null ? this : NaN;
  var t = (this.day() + 7 - this.localeData()._week.dow) % 7;
  return e == null ? t : this.add(e - t, "d");
}
function Zm(e) {
  if (!this.isValid())
    return e != null ? this : NaN;
  if (e != null) {
    var t = Rm(e, this.localeData());
    return this.day(this.day() % 7 ? t : t - 7);
  } else
    return this.day() || 7;
}
function Qm(e) {
  return this._weekdaysParseExact ? (xt(this, "_weekdaysRegex") || Qu.call(this), e ? this._weekdaysStrictRegex : this._weekdaysRegex) : (xt(this, "_weekdaysRegex") || (this._weekdaysRegex = Fm), this._weekdaysStrictRegex && e ? this._weekdaysStrictRegex : this._weekdaysRegex);
}
function Xm(e) {
  return this._weekdaysParseExact ? (xt(this, "_weekdaysRegex") || Qu.call(this), e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) : (xt(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = Vm), this._weekdaysShortStrictRegex && e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex);
}
function Jm(e) {
  return this._weekdaysParseExact ? (xt(this, "_weekdaysRegex") || Qu.call(this), e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) : (xt(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = Wm), this._weekdaysMinStrictRegex && e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex);
}
function Qu() {
  function e(y, v) {
    return v.length - y.length;
  }
  var t = [], n = [], i = [], a = [], l, u, r, c, g;
  for (l = 0; l < 7; l++)
    u = ji([2e3, 1]).day(l), r = ca(this.weekdaysMin(u, "")), c = ca(this.weekdaysShort(u, "")), g = ca(this.weekdays(u, "")), t.push(r), n.push(c), i.push(g), a.push(r), a.push(c), a.push(g);
  t.sort(e), n.sort(e), i.sort(e), a.sort(e), this._weekdaysRegex = new RegExp("^(" + a.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp(
    "^(" + i.join("|") + ")",
    "i"
  ), this._weekdaysShortStrictRegex = new RegExp(
    "^(" + n.join("|") + ")",
    "i"
  ), this._weekdaysMinStrictRegex = new RegExp(
    "^(" + t.join("|") + ")",
    "i"
  );
}
function Xu() {
  return this.hours() % 12 || 12;
}
function ev() {
  return this.hours() || 24;
}
je("H", ["HH", 2], 0, "hour");
je("h", ["hh", 2], 0, Xu);
je("k", ["kk", 2], 0, ev);
je("hmm", 0, 0, function() {
  return "" + Xu.apply(this) + Bi(this.minutes(), 2);
});
je("hmmss", 0, 0, function() {
  return "" + Xu.apply(this) + Bi(this.minutes(), 2) + Bi(this.seconds(), 2);
});
je("Hmm", 0, 0, function() {
  return "" + this.hours() + Bi(this.minutes(), 2);
});
je("Hmmss", 0, 0, function() {
  return "" + this.hours() + Bi(this.minutes(), 2) + Bi(this.seconds(), 2);
});
function lh(e, t) {
  je(e, 0, 0, function() {
    return this.localeData().meridiem(
      this.hours(),
      this.minutes(),
      t
    );
  });
}
lh("a", !0);
lh("A", !1);
function oh(e, t) {
  return t._meridiemParse;
}
Ae("a", oh);
Ae("A", oh);
Ae("H", Yt, Gu);
Ae("h", Yt, ao);
Ae("k", Yt, ao);
Ae("HH", Yt, Jn);
Ae("hh", Yt, Jn);
Ae("kk", Yt, Jn);
Ae("hmm", Gf);
Ae("hmmss", Kf);
Ae("Hmm", Gf);
Ae("Hmmss", Kf);
Pt(["H", "HH"], bn);
Pt(["k", "kk"], function(e, t, n) {
  var i = ft(e);
  t[bn] = i === 24 ? 0 : i;
});
Pt(["a", "A"], function(e, t, n) {
  n._isPm = n._locale.isPM(e), n._meridiem = e;
});
Pt(["h", "hh"], function(e, t, n) {
  t[bn] = ft(e), lt(n).bigHour = !0;
});
Pt("hmm", function(e, t, n) {
  var i = e.length - 2;
  t[bn] = ft(e.substr(0, i)), t[Ti] = ft(e.substr(i)), lt(n).bigHour = !0;
});
Pt("hmmss", function(e, t, n) {
  var i = e.length - 4, a = e.length - 2;
  t[bn] = ft(e.substr(0, i)), t[Ti] = ft(e.substr(i, 2)), t[ua] = ft(e.substr(a)), lt(n).bigHour = !0;
});
Pt("Hmm", function(e, t, n) {
  var i = e.length - 2;
  t[bn] = ft(e.substr(0, i)), t[Ti] = ft(e.substr(i));
});
Pt("Hmmss", function(e, t, n) {
  var i = e.length - 4, a = e.length - 2;
  t[bn] = ft(e.substr(0, i)), t[Ti] = ft(e.substr(i, 2)), t[ua] = ft(e.substr(a));
});
function tv(e) {
  return (e + "").toLowerCase().charAt(0) === "p";
}
var nv = /[ap]\.?m?\.?/i, iv = lo("Hours", !0);
function av(e, t, n) {
  return e > 11 ? n ? "pm" : "PM" : n ? "am" : "AM";
}
var sh = {
  calendar: jp,
  longDateFormat: Zp,
  invalidDate: Xp,
  ordinal: em,
  dayOfMonthOrdinalParse: tm,
  relativeTime: im,
  months: bm,
  monthsShort: Xf,
  week: Pm,
  weekdays: Lm,
  weekdaysMin: qm,
  weekdaysShort: ah,
  meridiemParse: nv
}, Gt = {}, Co = {}, Zo;
function lv(e, t) {
  var n, i = Math.min(e.length, t.length);
  for (n = 0; n < i; n += 1)
    if (e[n] !== t[n])
      return n;
  return i;
}
function Ec(e) {
  return e && e.toLowerCase().replace("_", "-");
}
function ov(e) {
  for (var t = 0, n, i, a, l; t < e.length; ) {
    for (l = Ec(e[t]).split("-"), n = l.length, i = Ec(e[t + 1]), i = i ? i.split("-") : null; n > 0; ) {
      if (a = cr(l.slice(0, n).join("-")), a)
        return a;
      if (i && i.length >= n && lv(l, i) >= n - 1)
        break;
      n--;
    }
    t++;
  }
  return Zo;
}
function sv(e) {
  return !!(e && e.match("^[^/\\\\]*$"));
}
function cr(e) {
  var t = null, n;
  if (Gt[e] === void 0 && typeof module < "u" && module && module.exports && sv(e))
    try {
      t = Zo._abbr, n = require, n("./locale/" + e), Na(t);
    } catch {
      Gt[e] = null;
    }
  return Gt[e];
}
function Na(e, t) {
  var n;
  return e && (qn(t) ? n = pa(e) : n = Ju(e, t), n ? Zo = n : typeof console < "u" && console.warn && console.warn(
    "Locale " + e + " not found. Did you forget to load it?"
  )), Zo._abbr;
}
function Ju(e, t) {
  if (t !== null) {
    var n, i = sh;
    if (t.abbr = e, Gt[e] != null)
      Bf(
        "defineLocaleOverride",
        "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
      ), i = Gt[e]._config;
    else if (t.parentLocale != null)
      if (Gt[t.parentLocale] != null)
        i = Gt[t.parentLocale]._config;
      else if (n = cr(t.parentLocale), n != null)
        i = n._config;
      else
        return Co[t.parentLocale] || (Co[t.parentLocale] = []), Co[t.parentLocale].push({
          name: e,
          config: t
        }), null;
    return Gt[e] = new Yu(pu(i, t)), Co[e] && Co[e].forEach(function(a) {
      Ju(a.name, a.config);
    }), Na(e), Gt[e];
  } else
    return delete Gt[e], null;
}
function rv(e, t) {
  if (t != null) {
    var n, i, a = sh;
    Gt[e] != null && Gt[e].parentLocale != null ? Gt[e].set(pu(Gt[e]._config, t)) : (i = cr(e), i != null && (a = i._config), t = pu(a, t), i == null && (t.abbr = e), n = new Yu(t), n.parentLocale = Gt[e], Gt[e] = n), Na(e);
  } else
    Gt[e] != null && (Gt[e].parentLocale != null ? (Gt[e] = Gt[e].parentLocale, e === Na() && Na(e)) : Gt[e] != null && delete Gt[e]);
  return Gt[e];
}
function pa(e) {
  var t;
  if (e && e._locale && e._locale._abbr && (e = e._locale._abbr), !e)
    return Zo;
  if (!Oi(e)) {
    if (t = cr(e), t)
      return t;
    e = [e];
  }
  return ov(e);
}
function uv() {
  return mu(Gt);
}
function ec(e) {
  var t, n = e._a;
  return n && lt(e).overflow === -2 && (t = n[ra] < 0 || n[ra] > 11 ? ra : n[Vi] < 1 || n[Vi] > Ku(n[zn], n[ra]) ? Vi : n[bn] < 0 || n[bn] > 24 || n[bn] === 24 && (n[Ti] !== 0 || n[ua] !== 0 || n[ll] !== 0) ? bn : n[Ti] < 0 || n[Ti] > 59 ? Ti : n[ua] < 0 || n[ua] > 59 ? ua : n[ll] < 0 || n[ll] > 999 ? ll : -1, lt(e)._overflowDayOfYear && (t < zn || t > Vi) && (t = Vi), lt(e)._overflowWeeks && t === -1 && (t = hm), lt(e)._overflowWeekday && t === -1 && (t = gm), lt(e).overflow = t), e;
}
var cv = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, dv = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, fv = /Z|[+-]\d\d(?::?\d\d)?/, ks = [
  ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
  ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
  ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
  ["GGGG-[W]WW", /\d{4}-W\d\d/, !1],
  ["YYYY-DDD", /\d{4}-\d{3}/],
  ["YYYY-MM", /\d{4}-\d\d/, !1],
  ["YYYYYYMMDD", /[+-]\d{10}/],
  ["YYYYMMDD", /\d{8}/],
  ["GGGG[W]WWE", /\d{4}W\d{3}/],
  ["GGGG[W]WW", /\d{4}W\d{2}/, !1],
  ["YYYYDDD", /\d{7}/],
  ["YYYYMM", /\d{6}/, !1],
  ["YYYY", /\d{4}/, !1]
], Vr = [
  ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
  ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
  ["HH:mm:ss", /\d\d:\d\d:\d\d/],
  ["HH:mm", /\d\d:\d\d/],
  ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
  ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
  ["HHmmss", /\d\d\d\d\d\d/],
  ["HHmm", /\d\d\d\d/],
  ["HH", /\d\d/]
], hv = /^\/?Date\((-?\d+)/i, gv = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, pv = {
  UT: 0,
  GMT: 0,
  EDT: -240,
  EST: -300,
  CDT: -300,
  CST: -360,
  MDT: -360,
  MST: -420,
  PDT: -420,
  PST: -480
};
function rh(e) {
  var t, n, i = e._i, a = cv.exec(i) || dv.exec(i), l, u, r, c, g = ks.length, y = Vr.length;
  if (a) {
    for (lt(e).iso = !0, t = 0, n = g; t < n; t++)
      if (ks[t][1].exec(a[1])) {
        u = ks[t][0], l = ks[t][2] !== !1;
        break;
      }
    if (u == null) {
      e._isValid = !1;
      return;
    }
    if (a[3]) {
      for (t = 0, n = y; t < n; t++)
        if (Vr[t][1].exec(a[3])) {
          r = (a[2] || " ") + Vr[t][0];
          break;
        }
      if (r == null) {
        e._isValid = !1;
        return;
      }
    }
    if (!l && r != null) {
      e._isValid = !1;
      return;
    }
    if (a[4])
      if (fv.exec(a[4]))
        c = "Z";
      else {
        e._isValid = !1;
        return;
      }
    e._f = u + (r || "") + (c || ""), nc(e);
  } else
    e._isValid = !1;
}
function mv(e, t, n, i, a, l) {
  var u = [
    vv(e),
    Xf.indexOf(t),
    parseInt(n, 10),
    parseInt(i, 10),
    parseInt(a, 10)
  ];
  return l && u.push(parseInt(l, 10)), u;
}
function vv(e) {
  var t = parseInt(e, 10);
  return t <= 49 ? 2e3 + t : t <= 999 ? 1900 + t : t;
}
function yv(e) {
  return e.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function bv(e, t, n) {
  if (e) {
    var i = ah.indexOf(e), a = new Date(
      t[0],
      t[1],
      t[2]
    ).getDay();
    if (i !== a)
      return lt(n).weekdayMismatch = !0, n._isValid = !1, !1;
  }
  return !0;
}
function xv(e, t, n) {
  if (e)
    return pv[e];
  if (t)
    return 0;
  var i = parseInt(n, 10), a = i % 100, l = (i - a) / 100;
  return l * 60 + a;
}
function uh(e) {
  var t = gv.exec(yv(e._i)), n;
  if (t) {
    if (n = mv(
      t[4],
      t[3],
      t[2],
      t[5],
      t[6],
      t[7]
    ), !bv(t[1], n, e))
      return;
    e._a = n, e._tzm = xv(t[8], t[9], t[10]), e._d = Go.apply(null, e._a), e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), lt(e).rfc2822 = !0;
  } else
    e._isValid = !1;
}
function wv(e) {
  var t = hv.exec(e._i);
  if (t !== null) {
    e._d = /* @__PURE__ */ new Date(+t[1]);
    return;
  }
  if (rh(e), e._isValid === !1)
    delete e._isValid;
  else
    return;
  if (uh(e), e._isValid === !1)
    delete e._isValid;
  else
    return;
  e._strict ? e._isValid = !1 : Ie.createFromInputFallback(e);
}
Ie.createFromInputFallback = hi(
  "value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
  function(e) {
    e._d = /* @__PURE__ */ new Date(e._i + (e._useUTC ? " UTC" : ""));
  }
);
function ql(e, t, n) {
  return e ?? t ?? n;
}
function Sv(e) {
  var t = new Date(Ie.now());
  return e._useUTC ? [
    t.getUTCFullYear(),
    t.getUTCMonth(),
    t.getUTCDate()
  ] : [t.getFullYear(), t.getMonth(), t.getDate()];
}
function tc(e) {
  var t, n, i = [], a, l, u;
  if (!e._d) {
    for (a = Sv(e), e._w && e._a[Vi] == null && e._a[ra] == null && kv(e), e._dayOfYear != null && (u = ql(e._a[zn], a[zn]), (e._dayOfYear > Lo(u) || e._dayOfYear === 0) && (lt(e)._overflowDayOfYear = !0), n = Go(u, 0, e._dayOfYear), e._a[ra] = n.getUTCMonth(), e._a[Vi] = n.getUTCDate()), t = 0; t < 3 && e._a[t] == null; ++t)
      e._a[t] = i[t] = a[t];
    for (; t < 7; t++)
      e._a[t] = i[t] = e._a[t] == null ? t === 2 ? 1 : 0 : e._a[t];
    e._a[bn] === 24 && e._a[Ti] === 0 && e._a[ua] === 0 && e._a[ll] === 0 && (e._nextDay = !0, e._a[bn] = 0), e._d = (e._useUTC ? Go : Dm).apply(
      null,
      i
    ), l = e._useUTC ? e._d.getUTCDay() : e._d.getDay(), e._tzm != null && e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), e._nextDay && (e._a[bn] = 24), e._w && typeof e._w.d < "u" && e._w.d !== l && (lt(e).weekdayMismatch = !0);
  }
}
function kv(e) {
  var t, n, i, a, l, u, r, c, g;
  t = e._w, t.GG != null || t.W != null || t.E != null ? (l = 1, u = 4, n = ql(
    t.GG,
    e._a[zn],
    Ko(Wt(), 1, 4).year
  ), i = ql(t.W, 1), a = ql(t.E, 1), (a < 1 || a > 7) && (c = !0)) : (l = e._locale._week.dow, u = e._locale._week.doy, g = Ko(Wt(), l, u), n = ql(t.gg, e._a[zn], g.year), i = ql(t.w, g.week), t.d != null ? (a = t.d, (a < 0 || a > 6) && (c = !0)) : t.e != null ? (a = t.e + l, (t.e < 0 || t.e > 6) && (c = !0)) : a = l), i < 1 || i > da(n, l, u) ? lt(e)._overflowWeeks = !0 : c != null ? lt(e)._overflowWeekday = !0 : (r = ih(n, i, a, l, u), e._a[zn] = r.year, e._dayOfYear = r.dayOfYear);
}
Ie.ISO_8601 = function() {
};
Ie.RFC_2822 = function() {
};
function nc(e) {
  if (e._f === Ie.ISO_8601) {
    rh(e);
    return;
  }
  if (e._f === Ie.RFC_2822) {
    uh(e);
    return;
  }
  e._a = [], lt(e).empty = !0;
  var t = "" + e._i, n, i, a, l, u, r = t.length, c = 0, g, y;
  for (a = Hf(e._f, e._locale).match(Bu) || [], y = a.length, n = 0; n < y; n++)
    l = a[n], i = (t.match(cm(l, e)) || [])[0], i && (u = t.substr(0, t.indexOf(i)), u.length > 0 && lt(e).unusedInput.push(u), t = t.slice(
      t.indexOf(i) + i.length
    ), c += i.length), Hl[l] ? (i ? lt(e).empty = !1 : lt(e).unusedTokens.push(l), fm(l, i, e)) : e._strict && !i && lt(e).unusedTokens.push(l);
  lt(e).charsLeftOver = r - c, t.length > 0 && lt(e).unusedInput.push(t), e._a[bn] <= 12 && lt(e).bigHour === !0 && e._a[bn] > 0 && (lt(e).bigHour = void 0), lt(e).parsedDateParts = e._a.slice(0), lt(e).meridiem = e._meridiem, e._a[bn] = _v(
    e._locale,
    e._a[bn],
    e._meridiem
  ), g = lt(e).era, g !== null && (e._a[zn] = e._locale.erasConvertYear(g, e._a[zn])), tc(e), ec(e);
}
function _v(e, t, n) {
  var i;
  return n == null ? t : e.meridiemHour != null ? e.meridiemHour(t, n) : (e.isPM != null && (i = e.isPM(n), i && t < 12 && (t += 12), !i && t === 12 && (t = 0)), t);
}
function Cv(e) {
  var t, n, i, a, l, u, r = !1, c = e._f.length;
  if (c === 0) {
    lt(e).invalidFormat = !0, e._d = /* @__PURE__ */ new Date(NaN);
    return;
  }
  for (a = 0; a < c; a++)
    l = 0, u = !1, t = Wu({}, e), e._useUTC != null && (t._useUTC = e._useUTC), t._f = e._f[a], nc(t), Vu(t) && (u = !0), l += lt(t).charsLeftOver, l += lt(t).unusedTokens.length * 10, lt(t).score = l, r ? l < i && (i = l, n = t) : (i == null || l < i || u) && (i = l, n = t, u && (r = !0));
  $a(e, n || t);
}
function Mv(e) {
  if (!e._d) {
    var t = Hu(e._i), n = t.day === void 0 ? t.date : t.day;
    e._a = Wf(
      [t.year, t.month, n, t.hour, t.minute, t.second, t.millisecond],
      function(i) {
        return i && parseInt(i, 10);
      }
    ), tc(e);
  }
}
function Tv(e) {
  var t = new ts(ec(ch(e)));
  return t._nextDay && (t.add(1, "d"), t._nextDay = void 0), t;
}
function ch(e) {
  var t = e._i, n = e._f;
  return e._locale = e._locale || pa(e._l), t === null || n === void 0 && t === "" ? ir({ nullInput: !0 }) : (typeof t == "string" && (e._i = t = e._locale.preparse(t)), Pi(t) ? new ts(ec(t)) : (es(t) ? e._d = t : Oi(n) ? Cv(e) : n ? nc(e) : zv(e), Vu(e) || (e._d = null), e));
}
function zv(e) {
  var t = e._i;
  qn(t) ? e._d = new Date(Ie.now()) : es(t) ? e._d = new Date(t.valueOf()) : typeof t == "string" ? wv(e) : Oi(t) ? (e._a = Wf(t.slice(0), function(n) {
    return parseInt(n, 10);
  }), tc(e)) : ol(t) ? Mv(e) : ga(t) ? e._d = new Date(t) : Ie.createFromInputFallback(e);
}
function dh(e, t, n, i, a) {
  var l = {};
  return (t === !0 || t === !1) && (i = t, t = void 0), (n === !0 || n === !1) && (i = n, n = void 0), (ol(e) && Fu(e) || Oi(e) && e.length === 0) && (e = void 0), l._isAMomentObject = !0, l._useUTC = l._isUTC = a, l._l = n, l._i = e, l._f = t, l._strict = i, Tv(l);
}
function Wt(e, t, n, i) {
  return dh(e, t, n, i, !1);
}
var Dv = hi(
  "moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var e = Wt.apply(null, arguments);
    return this.isValid() && e.isValid() ? e < this ? this : e : ir();
  }
), Ov = hi(
  "moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var e = Wt.apply(null, arguments);
    return this.isValid() && e.isValid() ? e > this ? this : e : ir();
  }
);
function fh(e, t) {
  var n, i;
  if (t.length === 1 && Oi(t[0]) && (t = t[0]), !t.length)
    return Wt();
  for (n = t[0], i = 1; i < t.length; ++i)
    (!t[i].isValid() || t[i][e](n)) && (n = t[i]);
  return n;
}
function Pv() {
  var e = [].slice.call(arguments, 0);
  return fh("isBefore", e);
}
function Iv() {
  var e = [].slice.call(arguments, 0);
  return fh("isAfter", e);
}
var Ev = function() {
  return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
}, Mo = [
  "year",
  "quarter",
  "month",
  "week",
  "day",
  "hour",
  "minute",
  "second",
  "millisecond"
];
function $v(e) {
  var t, n = !1, i, a = Mo.length;
  for (t in e)
    if (xt(e, t) && !(sn.call(Mo, t) !== -1 && (e[t] == null || !isNaN(e[t]))))
      return !1;
  for (i = 0; i < a; ++i)
    if (e[Mo[i]]) {
      if (n)
        return !1;
      parseFloat(e[Mo[i]]) !== ft(e[Mo[i]]) && (n = !0);
    }
  return !0;
}
function Av() {
  return this._isValid;
}
function Nv() {
  return Ii(NaN);
}
function dr(e) {
  var t = Hu(e), n = t.year || 0, i = t.quarter || 0, a = t.month || 0, l = t.week || t.isoWeek || 0, u = t.day || 0, r = t.hour || 0, c = t.minute || 0, g = t.second || 0, y = t.millisecond || 0;
  this._isValid = $v(t), this._milliseconds = +y + g * 1e3 + // 1000
  c * 6e4 + // 1000 * 60
  r * 1e3 * 60 * 60, this._days = +u + l * 7, this._months = +a + i * 3 + n * 12, this._data = {}, this._locale = pa(), this._bubble();
}
function Rs(e) {
  return e instanceof dr;
}
function yu(e) {
  return e < 0 ? Math.round(-1 * e) * -1 : Math.round(e);
}
function Rv(e, t, n) {
  var i = Math.min(e.length, t.length), a = Math.abs(e.length - t.length), l = 0, u;
  for (u = 0; u < i; u++)
    ft(e[u]) !== ft(t[u]) && l++;
  return l + a;
}
function hh(e, t) {
  je(e, 0, 0, function() {
    var n = this.utcOffset(), i = "+";
    return n < 0 && (n = -n, i = "-"), i + Bi(~~(n / 60), 2) + t + Bi(~~n % 60, 2);
  });
}
hh("Z", ":");
hh("ZZ", "");
Ae("Z", rr);
Ae("ZZ", rr);
Pt(["Z", "ZZ"], function(e, t, n) {
  n._useUTC = !0, n._tzm = ic(rr, e);
});
var Lv = /([\+\-]|\d\d)/gi;
function ic(e, t) {
  var n = (t || "").match(e), i, a, l;
  return n === null ? null : (i = n[n.length - 1] || [], a = (i + "").match(Lv) || ["-", 0, 0], l = +(a[1] * 60) + ft(a[2]), l === 0 ? 0 : a[0] === "+" ? l : -l);
}
function ac(e, t) {
  var n, i;
  return t._isUTC ? (n = t.clone(), i = (Pi(e) || es(e) ? e.valueOf() : Wt(e).valueOf()) - n.valueOf(), n._d.setTime(n._d.valueOf() + i), Ie.updateOffset(n, !1), n) : Wt(e).local();
}
function bu(e) {
  return -Math.round(e._d.getTimezoneOffset());
}
Ie.updateOffset = function() {
};
function qv(e, t, n) {
  var i = this._offset || 0, a;
  if (!this.isValid())
    return e != null ? this : NaN;
  if (e != null) {
    if (typeof e == "string") {
      if (e = ic(rr, e), e === null)
        return this;
    } else Math.abs(e) < 16 && !n && (e = e * 60);
    return !this._isUTC && t && (a = bu(this)), this._offset = e, this._isUTC = !0, a != null && this.add(a, "m"), i !== e && (!t || this._changeInProgress ? mh(
      this,
      Ii(e - i, "m"),
      1,
      !1
    ) : this._changeInProgress || (this._changeInProgress = !0, Ie.updateOffset(this, !0), this._changeInProgress = null)), this;
  } else
    return this._isUTC ? i : bu(this);
}
function Fv(e, t) {
  return e != null ? (typeof e != "string" && (e = -e), this.utcOffset(e, t), this) : -this.utcOffset();
}
function Vv(e) {
  return this.utcOffset(0, e);
}
function Wv(e) {
  return this._isUTC && (this.utcOffset(0, e), this._isUTC = !1, e && this.subtract(bu(this), "m")), this;
}
function Yv() {
  if (this._tzm != null)
    this.utcOffset(this._tzm, !1, !0);
  else if (typeof this._i == "string") {
    var e = ic(rm, this._i);
    e != null ? this.utcOffset(e) : this.utcOffset(0, !0);
  }
  return this;
}
function Bv(e) {
  return this.isValid() ? (e = e ? Wt(e).utcOffset() : 0, (this.utcOffset() - e) % 60 === 0) : !1;
}
function Hv() {
  return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
}
function jv() {
  if (!qn(this._isDSTShifted))
    return this._isDSTShifted;
  var e = {}, t;
  return Wu(e, this), e = ch(e), e._a ? (t = e._isUTC ? ji(e._a) : Wt(e._a), this._isDSTShifted = this.isValid() && Rv(e._a, t.toArray()) > 0) : this._isDSTShifted = !1, this._isDSTShifted;
}
function Uv() {
  return this.isValid() ? !this._isUTC : !1;
}
function Gv() {
  return this.isValid() ? this._isUTC : !1;
}
function gh() {
  return this.isValid() ? this._isUTC && this._offset === 0 : !1;
}
var Kv = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, Zv = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function Ii(e, t) {
  var n = e, i = null, a, l, u;
  return Rs(e) ? n = {
    ms: e._milliseconds,
    d: e._days,
    M: e._months
  } : ga(e) || !isNaN(+e) ? (n = {}, t ? n[t] = +e : n.milliseconds = +e) : (i = Kv.exec(e)) ? (a = i[1] === "-" ? -1 : 1, n = {
    y: 0,
    d: ft(i[Vi]) * a,
    h: ft(i[bn]) * a,
    m: ft(i[Ti]) * a,
    s: ft(i[ua]) * a,
    ms: ft(yu(i[ll] * 1e3)) * a
    // the millisecond decimal point is included in the match
  }) : (i = Zv.exec(e)) ? (a = i[1] === "-" ? -1 : 1, n = {
    y: Qa(i[2], a),
    M: Qa(i[3], a),
    w: Qa(i[4], a),
    d: Qa(i[5], a),
    h: Qa(i[6], a),
    m: Qa(i[7], a),
    s: Qa(i[8], a)
  }) : n == null ? n = {} : typeof n == "object" && ("from" in n || "to" in n) && (u = Qv(
    Wt(n.from),
    Wt(n.to)
  ), n = {}, n.ms = u.milliseconds, n.M = u.months), l = new dr(n), Rs(e) && xt(e, "_locale") && (l._locale = e._locale), Rs(e) && xt(e, "_isValid") && (l._isValid = e._isValid), l;
}
Ii.fn = dr.prototype;
Ii.invalid = Nv;
function Qa(e, t) {
  var n = e && parseFloat(e.replace(",", "."));
  return (isNaN(n) ? 0 : n) * t;
}
function $c(e, t) {
  var n = {};
  return n.months = t.month() - e.month() + (t.year() - e.year()) * 12, e.clone().add(n.months, "M").isAfter(t) && --n.months, n.milliseconds = +t - +e.clone().add(n.months, "M"), n;
}
function Qv(e, t) {
  var n;
  return e.isValid() && t.isValid() ? (t = ac(t, e), e.isBefore(t) ? n = $c(e, t) : (n = $c(t, e), n.milliseconds = -n.milliseconds, n.months = -n.months), n) : { milliseconds: 0, months: 0 };
}
function ph(e, t) {
  return function(n, i) {
    var a, l;
    return i !== null && !isNaN(+i) && (Bf(
      t,
      "moment()." + t + "(period, number) is deprecated. Please use moment()." + t + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
    ), l = n, n = i, i = l), a = Ii(n, i), mh(this, a, e), this;
  };
}
function mh(e, t, n, i) {
  var a = t._milliseconds, l = yu(t._days), u = yu(t._months);
  e.isValid() && (i = i ?? !0, u && eh(e, Uo(e, "Month") + u * n), l && Qf(e, "Date", Uo(e, "Date") + l * n), a && e._d.setTime(e._d.valueOf() + a * n), i && Ie.updateOffset(e, l || u));
}
var Xv = ph(1, "add"), Jv = ph(-1, "subtract");
function vh(e) {
  return typeof e == "string" || e instanceof String;
}
function ey(e) {
  return Pi(e) || es(e) || vh(e) || ga(e) || ny(e) || ty(e) || e === null || e === void 0;
}
function ty(e) {
  var t = ol(e) && !Fu(e), n = !1, i = [
    "years",
    "year",
    "y",
    "months",
    "month",
    "M",
    "days",
    "day",
    "d",
    "dates",
    "date",
    "D",
    "hours",
    "hour",
    "h",
    "minutes",
    "minute",
    "m",
    "seconds",
    "second",
    "s",
    "milliseconds",
    "millisecond",
    "ms"
  ], a, l, u = i.length;
  for (a = 0; a < u; a += 1)
    l = i[a], n = n || xt(e, l);
  return t && n;
}
function ny(e) {
  var t = Oi(e), n = !1;
  return t && (n = e.filter(function(i) {
    return !ga(i) && vh(e);
  }).length === 0), t && n;
}
function iy(e) {
  var t = ol(e) && !Fu(e), n = !1, i = [
    "sameDay",
    "nextDay",
    "lastDay",
    "nextWeek",
    "lastWeek",
    "sameElse"
  ], a, l;
  for (a = 0; a < i.length; a += 1)
    l = i[a], n = n || xt(e, l);
  return t && n;
}
function ay(e, t) {
  var n = e.diff(t, "days", !0);
  return n < -6 ? "sameElse" : n < -1 ? "lastWeek" : n < 0 ? "lastDay" : n < 1 ? "sameDay" : n < 2 ? "nextDay" : n < 7 ? "nextWeek" : "sameElse";
}
function ly(e, t) {
  arguments.length === 1 && (arguments[0] ? ey(arguments[0]) ? (e = arguments[0], t = void 0) : iy(arguments[0]) && (t = arguments[0], e = void 0) : (e = void 0, t = void 0));
  var n = e || Wt(), i = ac(n, this).startOf("day"), a = Ie.calendarFormat(this, i) || "sameElse", l = t && (Ui(t[a]) ? t[a].call(this, n) : t[a]);
  return this.format(
    l || this.localeData().calendar(a, this, Wt(n))
  );
}
function oy() {
  return new ts(this);
}
function sy(e, t) {
  var n = Pi(e) ? e : Wt(e);
  return this.isValid() && n.isValid() ? (t = gi(t) || "millisecond", t === "millisecond" ? this.valueOf() > n.valueOf() : n.valueOf() < this.clone().startOf(t).valueOf()) : !1;
}
function ry(e, t) {
  var n = Pi(e) ? e : Wt(e);
  return this.isValid() && n.isValid() ? (t = gi(t) || "millisecond", t === "millisecond" ? this.valueOf() < n.valueOf() : this.clone().endOf(t).valueOf() < n.valueOf()) : !1;
}
function uy(e, t, n, i) {
  var a = Pi(e) ? e : Wt(e), l = Pi(t) ? t : Wt(t);
  return this.isValid() && a.isValid() && l.isValid() ? (i = i || "()", (i[0] === "(" ? this.isAfter(a, n) : !this.isBefore(a, n)) && (i[1] === ")" ? this.isBefore(l, n) : !this.isAfter(l, n))) : !1;
}
function cy(e, t) {
  var n = Pi(e) ? e : Wt(e), i;
  return this.isValid() && n.isValid() ? (t = gi(t) || "millisecond", t === "millisecond" ? this.valueOf() === n.valueOf() : (i = n.valueOf(), this.clone().startOf(t).valueOf() <= i && i <= this.clone().endOf(t).valueOf())) : !1;
}
function dy(e, t) {
  return this.isSame(e, t) || this.isAfter(e, t);
}
function fy(e, t) {
  return this.isSame(e, t) || this.isBefore(e, t);
}
function hy(e, t, n) {
  var i, a, l;
  if (!this.isValid())
    return NaN;
  if (i = ac(e, this), !i.isValid())
    return NaN;
  switch (a = (i.utcOffset() - this.utcOffset()) * 6e4, t = gi(t), t) {
    case "year":
      l = Ls(this, i) / 12;
      break;
    case "month":
      l = Ls(this, i);
      break;
    case "quarter":
      l = Ls(this, i) / 3;
      break;
    case "second":
      l = (this - i) / 1e3;
      break;
    // 1000
    case "minute":
      l = (this - i) / 6e4;
      break;
    // 1000 * 60
    case "hour":
      l = (this - i) / 36e5;
      break;
    // 1000 * 60 * 60
    case "day":
      l = (this - i - a) / 864e5;
      break;
    // 1000 * 60 * 60 * 24, negate dst
    case "week":
      l = (this - i - a) / 6048e5;
      break;
    // 1000 * 60 * 60 * 24 * 7, negate dst
    default:
      l = this - i;
  }
  return n ? l : ci(l);
}
function Ls(e, t) {
  if (e.date() < t.date())
    return -Ls(t, e);
  var n = (t.year() - e.year()) * 12 + (t.month() - e.month()), i = e.clone().add(n, "months"), a, l;
  return t - i < 0 ? (a = e.clone().add(n - 1, "months"), l = (t - i) / (i - a)) : (a = e.clone().add(n + 1, "months"), l = (t - i) / (a - i)), -(n + l) || 0;
}
Ie.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
Ie.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
function gy() {
  return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function py(e) {
  if (!this.isValid())
    return null;
  var t = e !== !0, n = t ? this.clone().utc() : this;
  return n.year() < 0 || n.year() > 9999 ? Ns(
    n,
    t ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"
  ) : Ui(Date.prototype.toISOString) ? t ? this.toDate().toISOString() : new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", Ns(n, "Z")) : Ns(
    n,
    t ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"
  );
}
function my() {
  if (!this.isValid())
    return "moment.invalid(/* " + this._i + " */)";
  var e = "moment", t = "", n, i, a, l;
  return this.isLocal() || (e = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone", t = "Z"), n = "[" + e + '("]', i = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY", a = "-MM-DD[T]HH:mm:ss.SSS", l = t + '[")]', this.format(n + i + a + l);
}
function vy(e) {
  e || (e = this.isUtc() ? Ie.defaultFormatUtc : Ie.defaultFormat);
  var t = Ns(this, e);
  return this.localeData().postformat(t);
}
function yy(e, t) {
  return this.isValid() && (Pi(e) && e.isValid() || Wt(e).isValid()) ? Ii({ to: this, from: e }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate();
}
function by(e) {
  return this.from(Wt(), e);
}
function xy(e, t) {
  return this.isValid() && (Pi(e) && e.isValid() || Wt(e).isValid()) ? Ii({ from: this, to: e }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate();
}
function wy(e) {
  return this.to(Wt(), e);
}
function yh(e) {
  var t;
  return e === void 0 ? this._locale._abbr : (t = pa(e), t != null && (this._locale = t), this);
}
var bh = hi(
  "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
  function(e) {
    return e === void 0 ? this.localeData() : this.locale(e);
  }
);
function xh() {
  return this._locale;
}
var Us = 1e3, jl = 60 * Us, Gs = 60 * jl, wh = (365 * 400 + 97) * 24 * Gs;
function Ul(e, t) {
  return (e % t + t) % t;
}
function Sh(e, t, n) {
  return e < 100 && e >= 0 ? new Date(e + 400, t, n) - wh : new Date(e, t, n).valueOf();
}
function kh(e, t, n) {
  return e < 100 && e >= 0 ? Date.UTC(e + 400, t, n) - wh : Date.UTC(e, t, n);
}
function Sy(e) {
  var t, n;
  if (e = gi(e), e === void 0 || e === "millisecond" || !this.isValid())
    return this;
  switch (n = this._isUTC ? kh : Sh, e) {
    case "year":
      t = n(this.year(), 0, 1);
      break;
    case "quarter":
      t = n(
        this.year(),
        this.month() - this.month() % 3,
        1
      );
      break;
    case "month":
      t = n(this.year(), this.month(), 1);
      break;
    case "week":
      t = n(
        this.year(),
        this.month(),
        this.date() - this.weekday()
      );
      break;
    case "isoWeek":
      t = n(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1)
      );
      break;
    case "day":
    case "date":
      t = n(this.year(), this.month(), this.date());
      break;
    case "hour":
      t = this._d.valueOf(), t -= Ul(
        t + (this._isUTC ? 0 : this.utcOffset() * jl),
        Gs
      );
      break;
    case "minute":
      t = this._d.valueOf(), t -= Ul(t, jl);
      break;
    case "second":
      t = this._d.valueOf(), t -= Ul(t, Us);
      break;
  }
  return this._d.setTime(t), Ie.updateOffset(this, !0), this;
}
function ky(e) {
  var t, n;
  if (e = gi(e), e === void 0 || e === "millisecond" || !this.isValid())
    return this;
  switch (n = this._isUTC ? kh : Sh, e) {
    case "year":
      t = n(this.year() + 1, 0, 1) - 1;
      break;
    case "quarter":
      t = n(
        this.year(),
        this.month() - this.month() % 3 + 3,
        1
      ) - 1;
      break;
    case "month":
      t = n(this.year(), this.month() + 1, 1) - 1;
      break;
    case "week":
      t = n(
        this.year(),
        this.month(),
        this.date() - this.weekday() + 7
      ) - 1;
      break;
    case "isoWeek":
      t = n(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1) + 7
      ) - 1;
      break;
    case "day":
    case "date":
      t = n(this.year(), this.month(), this.date() + 1) - 1;
      break;
    case "hour":
      t = this._d.valueOf(), t += Gs - Ul(
        t + (this._isUTC ? 0 : this.utcOffset() * jl),
        Gs
      ) - 1;
      break;
    case "minute":
      t = this._d.valueOf(), t += jl - Ul(t, jl) - 1;
      break;
    case "second":
      t = this._d.valueOf(), t += Us - Ul(t, Us) - 1;
      break;
  }
  return this._d.setTime(t), Ie.updateOffset(this, !0), this;
}
function _y() {
  return this._d.valueOf() - (this._offset || 0) * 6e4;
}
function Cy() {
  return Math.floor(this.valueOf() / 1e3);
}
function My() {
  return new Date(this.valueOf());
}
function Ty() {
  var e = this;
  return [
    e.year(),
    e.month(),
    e.date(),
    e.hour(),
    e.minute(),
    e.second(),
    e.millisecond()
  ];
}
function zy() {
  var e = this;
  return {
    years: e.year(),
    months: e.month(),
    date: e.date(),
    hours: e.hours(),
    minutes: e.minutes(),
    seconds: e.seconds(),
    milliseconds: e.milliseconds()
  };
}
function Dy() {
  return this.isValid() ? this.toISOString() : null;
}
function Oy() {
  return Vu(this);
}
function Py() {
  return $a({}, lt(this));
}
function Iy() {
  return lt(this).overflow;
}
function Ey() {
  return {
    input: this._i,
    format: this._f,
    locale: this._locale,
    isUTC: this._isUTC,
    strict: this._strict
  };
}
je("N", 0, 0, "eraAbbr");
je("NN", 0, 0, "eraAbbr");
je("NNN", 0, 0, "eraAbbr");
je("NNNN", 0, 0, "eraName");
je("NNNNN", 0, 0, "eraNarrow");
je("y", ["y", 1], "yo", "eraYear");
je("y", ["yy", 2], 0, "eraYear");
je("y", ["yyy", 3], 0, "eraYear");
je("y", ["yyyy", 4], 0, "eraYear");
Ae("N", lc);
Ae("NN", lc);
Ae("NNN", lc);
Ae("NNNN", By);
Ae("NNNNN", Hy);
Pt(
  ["N", "NN", "NNN", "NNNN", "NNNNN"],
  function(e, t, n, i) {
    var a = n._locale.erasParse(e, i, n._strict);
    a ? lt(n).era = a : lt(n).invalidEra = e;
  }
);
Ae("y", io);
Ae("yy", io);
Ae("yyy", io);
Ae("yyyy", io);
Ae("yo", jy);
Pt(["y", "yy", "yyy", "yyyy"], zn);
Pt(["yo"], function(e, t, n, i) {
  var a;
  n._locale._eraYearOrdinalRegex && (a = e.match(n._locale._eraYearOrdinalRegex)), n._locale.eraYearOrdinalParse ? t[zn] = n._locale.eraYearOrdinalParse(e, a) : t[zn] = parseInt(e, 10);
});
function $y(e, t) {
  var n, i, a, l = this._eras || pa("en")._eras;
  for (n = 0, i = l.length; n < i; ++n) {
    switch (typeof l[n].since) {
      case "string":
        a = Ie(l[n].since).startOf("day"), l[n].since = a.valueOf();
        break;
    }
    switch (typeof l[n].until) {
      case "undefined":
        l[n].until = 1 / 0;
        break;
      case "string":
        a = Ie(l[n].until).startOf("day").valueOf(), l[n].until = a.valueOf();
        break;
    }
  }
  return l;
}
function Ay(e, t, n) {
  var i, a, l = this.eras(), u, r, c;
  for (e = e.toUpperCase(), i = 0, a = l.length; i < a; ++i)
    if (u = l[i].name.toUpperCase(), r = l[i].abbr.toUpperCase(), c = l[i].narrow.toUpperCase(), n)
      switch (t) {
        case "N":
        case "NN":
        case "NNN":
          if (r === e)
            return l[i];
          break;
        case "NNNN":
          if (u === e)
            return l[i];
          break;
        case "NNNNN":
          if (c === e)
            return l[i];
          break;
      }
    else if ([u, r, c].indexOf(e) >= 0)
      return l[i];
}
function Ny(e, t) {
  var n = e.since <= e.until ? 1 : -1;
  return t === void 0 ? Ie(e.since).year() : Ie(e.since).year() + (t - e.offset) * n;
}
function Ry() {
  var e, t, n, i = this.localeData().eras();
  for (e = 0, t = i.length; e < t; ++e)
    if (n = this.clone().startOf("day").valueOf(), i[e].since <= n && n <= i[e].until || i[e].until <= n && n <= i[e].since)
      return i[e].name;
  return "";
}
function Ly() {
  var e, t, n, i = this.localeData().eras();
  for (e = 0, t = i.length; e < t; ++e)
    if (n = this.clone().startOf("day").valueOf(), i[e].since <= n && n <= i[e].until || i[e].until <= n && n <= i[e].since)
      return i[e].narrow;
  return "";
}
function qy() {
  var e, t, n, i = this.localeData().eras();
  for (e = 0, t = i.length; e < t; ++e)
    if (n = this.clone().startOf("day").valueOf(), i[e].since <= n && n <= i[e].until || i[e].until <= n && n <= i[e].since)
      return i[e].abbr;
  return "";
}
function Fy() {
  var e, t, n, i, a = this.localeData().eras();
  for (e = 0, t = a.length; e < t; ++e)
    if (n = a[e].since <= a[e].until ? 1 : -1, i = this.clone().startOf("day").valueOf(), a[e].since <= i && i <= a[e].until || a[e].until <= i && i <= a[e].since)
      return (this.year() - Ie(a[e].since).year()) * n + a[e].offset;
  return this.year();
}
function Vy(e) {
  return xt(this, "_erasNameRegex") || oc.call(this), e ? this._erasNameRegex : this._erasRegex;
}
function Wy(e) {
  return xt(this, "_erasAbbrRegex") || oc.call(this), e ? this._erasAbbrRegex : this._erasRegex;
}
function Yy(e) {
  return xt(this, "_erasNarrowRegex") || oc.call(this), e ? this._erasNarrowRegex : this._erasRegex;
}
function lc(e, t) {
  return t.erasAbbrRegex(e);
}
function By(e, t) {
  return t.erasNameRegex(e);
}
function Hy(e, t) {
  return t.erasNarrowRegex(e);
}
function jy(e, t) {
  return t._eraYearOrdinalRegex || io;
}
function oc() {
  var e = [], t = [], n = [], i = [], a, l, u, r, c, g = this.eras();
  for (a = 0, l = g.length; a < l; ++a)
    u = ca(g[a].name), r = ca(g[a].abbr), c = ca(g[a].narrow), t.push(u), e.push(r), n.push(c), i.push(u), i.push(r), i.push(c);
  this._erasRegex = new RegExp("^(" + i.join("|") + ")", "i"), this._erasNameRegex = new RegExp("^(" + t.join("|") + ")", "i"), this._erasAbbrRegex = new RegExp("^(" + e.join("|") + ")", "i"), this._erasNarrowRegex = new RegExp(
    "^(" + n.join("|") + ")",
    "i"
  );
}
je(0, ["gg", 2], 0, function() {
  return this.weekYear() % 100;
});
je(0, ["GG", 2], 0, function() {
  return this.isoWeekYear() % 100;
});
function fr(e, t) {
  je(0, [e, e.length], 0, t);
}
fr("gggg", "weekYear");
fr("ggggg", "weekYear");
fr("GGGG", "isoWeekYear");
fr("GGGGG", "isoWeekYear");
Ae("G", sr);
Ae("g", sr);
Ae("GG", Yt, Jn);
Ae("gg", Yt, Jn);
Ae("GGGG", Uu, ju);
Ae("gggg", Uu, ju);
Ae("GGGGG", or, ar);
Ae("ggggg", or, ar);
is(
  ["gggg", "ggggg", "GGGG", "GGGGG"],
  function(e, t, n, i) {
    t[i.substr(0, 2)] = ft(e);
  }
);
is(["gg", "GG"], function(e, t, n, i) {
  t[i] = Ie.parseTwoDigitYear(e);
});
function Uy(e) {
  return _h.call(
    this,
    e,
    this.week(),
    this.weekday() + this.localeData()._week.dow,
    this.localeData()._week.dow,
    this.localeData()._week.doy
  );
}
function Gy(e) {
  return _h.call(
    this,
    e,
    this.isoWeek(),
    this.isoWeekday(),
    1,
    4
  );
}
function Ky() {
  return da(this.year(), 1, 4);
}
function Zy() {
  return da(this.isoWeekYear(), 1, 4);
}
function Qy() {
  var e = this.localeData()._week;
  return da(this.year(), e.dow, e.doy);
}
function Xy() {
  var e = this.localeData()._week;
  return da(this.weekYear(), e.dow, e.doy);
}
function _h(e, t, n, i, a) {
  var l;
  return e == null ? Ko(this, i, a).year : (l = da(e, i, a), t > l && (t = l), Jy.call(this, e, t, n, i, a));
}
function Jy(e, t, n, i, a) {
  var l = ih(e, t, n, i, a), u = Go(l.year, 0, l.dayOfYear);
  return this.year(u.getUTCFullYear()), this.month(u.getUTCMonth()), this.date(u.getUTCDate()), this;
}
je("Q", 0, "Qo", "quarter");
Ae("Q", jf);
Pt("Q", function(e, t) {
  t[ra] = (ft(e) - 1) * 3;
});
function e0(e) {
  return e == null ? Math.ceil((this.month() + 1) / 3) : this.month((e - 1) * 3 + this.month() % 3);
}
je("D", ["DD", 2], "Do", "date");
Ae("D", Yt, ao);
Ae("DD", Yt, Jn);
Ae("Do", function(e, t) {
  return e ? t._dayOfMonthOrdinalParse || t._ordinalParse : t._dayOfMonthOrdinalParseLenient;
});
Pt(["D", "DD"], Vi);
Pt("Do", function(e, t) {
  t[Vi] = ft(e.match(Yt)[0]);
});
var Ch = lo("Date", !0);
je("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
Ae("DDD", lr);
Ae("DDDD", Uf);
Pt(["DDD", "DDDD"], function(e, t, n) {
  n._dayOfYear = ft(e);
});
function t0(e) {
  var t = Math.round(
    (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
  ) + 1;
  return e == null ? t : this.add(e - t, "d");
}
je("m", ["mm", 2], 0, "minute");
Ae("m", Yt, Gu);
Ae("mm", Yt, Jn);
Pt(["m", "mm"], Ti);
var n0 = lo("Minutes", !1);
je("s", ["ss", 2], 0, "second");
Ae("s", Yt, Gu);
Ae("ss", Yt, Jn);
Pt(["s", "ss"], ua);
var i0 = lo("Seconds", !1);
je("S", 0, 0, function() {
  return ~~(this.millisecond() / 100);
});
je(0, ["SS", 2], 0, function() {
  return ~~(this.millisecond() / 10);
});
je(0, ["SSS", 3], 0, "millisecond");
je(0, ["SSSS", 4], 0, function() {
  return this.millisecond() * 10;
});
je(0, ["SSSSS", 5], 0, function() {
  return this.millisecond() * 100;
});
je(0, ["SSSSSS", 6], 0, function() {
  return this.millisecond() * 1e3;
});
je(0, ["SSSSSSS", 7], 0, function() {
  return this.millisecond() * 1e4;
});
je(0, ["SSSSSSSS", 8], 0, function() {
  return this.millisecond() * 1e5;
});
je(0, ["SSSSSSSSS", 9], 0, function() {
  return this.millisecond() * 1e6;
});
Ae("S", lr, jf);
Ae("SS", lr, Jn);
Ae("SSS", lr, Uf);
var Aa, Mh;
for (Aa = "SSSS"; Aa.length <= 9; Aa += "S")
  Ae(Aa, io);
function a0(e, t) {
  t[ll] = ft(("0." + e) * 1e3);
}
for (Aa = "S"; Aa.length <= 9; Aa += "S")
  Pt(Aa, a0);
Mh = lo("Milliseconds", !1);
je("z", 0, 0, "zoneAbbr");
je("zz", 0, 0, "zoneName");
function l0() {
  return this._isUTC ? "UTC" : "";
}
function o0() {
  return this._isUTC ? "Coordinated Universal Time" : "";
}
var _e = ts.prototype;
_e.add = Xv;
_e.calendar = ly;
_e.clone = oy;
_e.diff = hy;
_e.endOf = ky;
_e.format = vy;
_e.from = yy;
_e.fromNow = by;
_e.to = xy;
_e.toNow = wy;
_e.get = mm;
_e.invalidAt = Iy;
_e.isAfter = sy;
_e.isBefore = ry;
_e.isBetween = uy;
_e.isSame = cy;
_e.isSameOrAfter = dy;
_e.isSameOrBefore = fy;
_e.isValid = Oy;
_e.lang = bh;
_e.locale = yh;
_e.localeData = xh;
_e.max = Ov;
_e.min = Dv;
_e.parsingFlags = Py;
_e.set = vm;
_e.startOf = Sy;
_e.subtract = Jv;
_e.toArray = Ty;
_e.toObject = zy;
_e.toDate = My;
_e.toISOString = py;
_e.inspect = my;
typeof Symbol < "u" && Symbol.for != null && (_e[Symbol.for("nodejs.util.inspect.custom")] = function() {
  return "Moment<" + this.format() + ">";
});
_e.toJSON = Dy;
_e.toString = gy;
_e.unix = Cy;
_e.valueOf = _y;
_e.creationData = Ey;
_e.eraName = Ry;
_e.eraNarrow = Ly;
_e.eraAbbr = qy;
_e.eraYear = Fy;
_e.year = Zf;
_e.isLeapYear = pm;
_e.weekYear = Uy;
_e.isoWeekYear = Gy;
_e.quarter = _e.quarters = e0;
_e.month = th;
_e.daysInMonth = Mm;
_e.week = _e.weeks = $m;
_e.isoWeek = _e.isoWeeks = Am;
_e.weeksInYear = Qy;
_e.weeksInWeekYear = Xy;
_e.isoWeeksInYear = Ky;
_e.isoWeeksInISOWeekYear = Zy;
_e.date = Ch;
_e.day = _e.days = Gm;
_e.weekday = Km;
_e.isoWeekday = Zm;
_e.dayOfYear = t0;
_e.hour = _e.hours = iv;
_e.minute = _e.minutes = n0;
_e.second = _e.seconds = i0;
_e.millisecond = _e.milliseconds = Mh;
_e.utcOffset = qv;
_e.utc = Vv;
_e.local = Wv;
_e.parseZone = Yv;
_e.hasAlignedHourOffset = Bv;
_e.isDST = Hv;
_e.isLocal = Uv;
_e.isUtcOffset = Gv;
_e.isUtc = gh;
_e.isUTC = gh;
_e.zoneAbbr = l0;
_e.zoneName = o0;
_e.dates = hi(
  "dates accessor is deprecated. Use date instead.",
  Ch
);
_e.months = hi(
  "months accessor is deprecated. Use month instead",
  th
);
_e.years = hi(
  "years accessor is deprecated. Use year instead",
  Zf
);
_e.zone = hi(
  "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
  Fv
);
_e.isDSTShifted = hi(
  "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
  jv
);
function s0(e) {
  return Wt(e * 1e3);
}
function r0() {
  return Wt.apply(null, arguments).parseZone();
}
function Th(e) {
  return e;
}
var wt = Yu.prototype;
wt.calendar = Up;
wt.longDateFormat = Qp;
wt.invalidDate = Jp;
wt.ordinal = nm;
wt.preparse = Th;
wt.postformat = Th;
wt.relativeTime = am;
wt.pastFuture = lm;
wt.set = Hp;
wt.eras = $y;
wt.erasParse = Ay;
wt.erasConvertYear = Ny;
wt.erasAbbrRegex = Wy;
wt.erasNameRegex = Vy;
wt.erasNarrowRegex = Yy;
wt.months = Sm;
wt.monthsShort = km;
wt.monthsParse = Cm;
wt.monthsRegex = zm;
wt.monthsShortRegex = Tm;
wt.week = Om;
wt.firstDayOfYear = Em;
wt.firstDayOfWeek = Im;
wt.weekdays = Ym;
wt.weekdaysMin = Hm;
wt.weekdaysShort = Bm;
wt.weekdaysParse = Um;
wt.weekdaysRegex = Qm;
wt.weekdaysShortRegex = Xm;
wt.weekdaysMinRegex = Jm;
wt.isPM = tv;
wt.meridiem = av;
function Ks(e, t, n, i) {
  var a = pa(), l = ji().set(i, t);
  return a[n](l, e);
}
function zh(e, t, n) {
  if (ga(e) && (t = e, e = void 0), e = e || "", t != null)
    return Ks(e, t, n, "month");
  var i, a = [];
  for (i = 0; i < 12; i++)
    a[i] = Ks(e, i, n, "month");
  return a;
}
function sc(e, t, n, i) {
  typeof e == "boolean" ? (ga(t) && (n = t, t = void 0), t = t || "") : (t = e, n = t, e = !1, ga(t) && (n = t, t = void 0), t = t || "");
  var a = pa(), l = e ? a._week.dow : 0, u, r = [];
  if (n != null)
    return Ks(t, (n + l) % 7, i, "day");
  for (u = 0; u < 7; u++)
    r[u] = Ks(t, (u + l) % 7, i, "day");
  return r;
}
function u0(e, t) {
  return zh(e, t, "months");
}
function c0(e, t) {
  return zh(e, t, "monthsShort");
}
function d0(e, t, n) {
  return sc(e, t, n, "weekdays");
}
function f0(e, t, n) {
  return sc(e, t, n, "weekdaysShort");
}
function h0(e, t, n) {
  return sc(e, t, n, "weekdaysMin");
}
Na("en", {
  eras: [
    {
      since: "0001-01-01",
      until: 1 / 0,
      offset: 1,
      name: "Anno Domini",
      narrow: "AD",
      abbr: "AD"
    },
    {
      since: "0000-12-31",
      until: -1 / 0,
      offset: 1,
      name: "Before Christ",
      narrow: "BC",
      abbr: "BC"
    }
  ],
  dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  ordinal: function(e) {
    var t = e % 10, n = ft(e % 100 / 10) === 1 ? "th" : t === 1 ? "st" : t === 2 ? "nd" : t === 3 ? "rd" : "th";
    return e + n;
  }
});
Ie.lang = hi(
  "moment.lang is deprecated. Use moment.locale instead.",
  Na
);
Ie.langData = hi(
  "moment.langData is deprecated. Use moment.localeData instead.",
  pa
);
var ia = Math.abs;
function g0() {
  var e = this._data;
  return this._milliseconds = ia(this._milliseconds), this._days = ia(this._days), this._months = ia(this._months), e.milliseconds = ia(e.milliseconds), e.seconds = ia(e.seconds), e.minutes = ia(e.minutes), e.hours = ia(e.hours), e.months = ia(e.months), e.years = ia(e.years), this;
}
function Dh(e, t, n, i) {
  var a = Ii(t, n);
  return e._milliseconds += i * a._milliseconds, e._days += i * a._days, e._months += i * a._months, e._bubble();
}
function p0(e, t) {
  return Dh(this, e, t, 1);
}
function m0(e, t) {
  return Dh(this, e, t, -1);
}
function Ac(e) {
  return e < 0 ? Math.floor(e) : Math.ceil(e);
}
function v0() {
  var e = this._milliseconds, t = this._days, n = this._months, i = this._data, a, l, u, r, c;
  return e >= 0 && t >= 0 && n >= 0 || e <= 0 && t <= 0 && n <= 0 || (e += Ac(xu(n) + t) * 864e5, t = 0, n = 0), i.milliseconds = e % 1e3, a = ci(e / 1e3), i.seconds = a % 60, l = ci(a / 60), i.minutes = l % 60, u = ci(l / 60), i.hours = u % 24, t += ci(u / 24), c = ci(Oh(t)), n += c, t -= Ac(xu(c)), r = ci(n / 12), n %= 12, i.days = t, i.months = n, i.years = r, this;
}
function Oh(e) {
  return e * 4800 / 146097;
}
function xu(e) {
  return e * 146097 / 4800;
}
function y0(e) {
  if (!this.isValid())
    return NaN;
  var t, n, i = this._milliseconds;
  if (e = gi(e), e === "month" || e === "quarter" || e === "year")
    switch (t = this._days + i / 864e5, n = this._months + Oh(t), e) {
      case "month":
        return n;
      case "quarter":
        return n / 3;
      case "year":
        return n / 12;
    }
  else
    switch (t = this._days + Math.round(xu(this._months)), e) {
      case "week":
        return t / 7 + i / 6048e5;
      case "day":
        return t + i / 864e5;
      case "hour":
        return t * 24 + i / 36e5;
      case "minute":
        return t * 1440 + i / 6e4;
      case "second":
        return t * 86400 + i / 1e3;
      // Math.floor prevents floating point math errors here
      case "millisecond":
        return Math.floor(t * 864e5) + i;
      default:
        throw new Error("Unknown unit " + e);
    }
}
function ma(e) {
  return function() {
    return this.as(e);
  };
}
var Ph = ma("ms"), b0 = ma("s"), x0 = ma("m"), w0 = ma("h"), S0 = ma("d"), k0 = ma("w"), _0 = ma("M"), C0 = ma("Q"), M0 = ma("y"), T0 = Ph;
function z0() {
  return Ii(this);
}
function D0(e) {
  return e = gi(e), this.isValid() ? this[e + "s"]() : NaN;
}
function ml(e) {
  return function() {
    return this.isValid() ? this._data[e] : NaN;
  };
}
var O0 = ml("milliseconds"), P0 = ml("seconds"), I0 = ml("minutes"), E0 = ml("hours"), $0 = ml("days"), A0 = ml("months"), N0 = ml("years");
function R0() {
  return ci(this.days() / 7);
}
var sa = Math.round, Wl = {
  ss: 44,
  // a few seconds to seconds
  s: 45,
  // seconds to minute
  m: 45,
  // minutes to hour
  h: 22,
  // hours to day
  d: 26,
  // days to month/week
  w: null,
  // weeks to month
  M: 11
  // months to year
};
function L0(e, t, n, i, a) {
  return a.relativeTime(t || 1, !!n, e, i);
}
function q0(e, t, n, i) {
  var a = Ii(e).abs(), l = sa(a.as("s")), u = sa(a.as("m")), r = sa(a.as("h")), c = sa(a.as("d")), g = sa(a.as("M")), y = sa(a.as("w")), v = sa(a.as("y")), m = l <= n.ss && ["s", l] || l < n.s && ["ss", l] || u <= 1 && ["m"] || u < n.m && ["mm", u] || r <= 1 && ["h"] || r < n.h && ["hh", r] || c <= 1 && ["d"] || c < n.d && ["dd", c];
  return n.w != null && (m = m || y <= 1 && ["w"] || y < n.w && ["ww", y]), m = m || g <= 1 && ["M"] || g < n.M && ["MM", g] || v <= 1 && ["y"] || ["yy", v], m[2] = t, m[3] = +e > 0, m[4] = i, L0.apply(null, m);
}
function F0(e) {
  return e === void 0 ? sa : typeof e == "function" ? (sa = e, !0) : !1;
}
function V0(e, t) {
  return Wl[e] === void 0 ? !1 : t === void 0 ? Wl[e] : (Wl[e] = t, e === "s" && (Wl.ss = t - 1), !0);
}
function W0(e, t) {
  if (!this.isValid())
    return this.localeData().invalidDate();
  var n = !1, i = Wl, a, l;
  return typeof e == "object" && (t = e, e = !1), typeof e == "boolean" && (n = e), typeof t == "object" && (i = Object.assign({}, Wl, t), t.s != null && t.ss == null && (i.ss = t.s - 1)), a = this.localeData(), l = q0(this, !n, i, a), n && (l = a.pastFuture(+this, l)), a.postformat(l);
}
var Wr = Math.abs;
function El(e) {
  return (e > 0) - (e < 0) || +e;
}
function hr() {
  if (!this.isValid())
    return this.localeData().invalidDate();
  var e = Wr(this._milliseconds) / 1e3, t = Wr(this._days), n = Wr(this._months), i, a, l, u, r = this.asSeconds(), c, g, y, v;
  return r ? (i = ci(e / 60), a = ci(i / 60), e %= 60, i %= 60, l = ci(n / 12), n %= 12, u = e ? e.toFixed(3).replace(/\.?0+$/, "") : "", c = r < 0 ? "-" : "", g = El(this._months) !== El(r) ? "-" : "", y = El(this._days) !== El(r) ? "-" : "", v = El(this._milliseconds) !== El(r) ? "-" : "", c + "P" + (l ? g + l + "Y" : "") + (n ? g + n + "M" : "") + (t ? y + t + "D" : "") + (a || i || e ? "T" : "") + (a ? v + a + "H" : "") + (i ? v + i + "M" : "") + (e ? v + u + "S" : "")) : "P0D";
}
var pt = dr.prototype;
pt.isValid = Av;
pt.abs = g0;
pt.add = p0;
pt.subtract = m0;
pt.as = y0;
pt.asMilliseconds = Ph;
pt.asSeconds = b0;
pt.asMinutes = x0;
pt.asHours = w0;
pt.asDays = S0;
pt.asWeeks = k0;
pt.asMonths = _0;
pt.asQuarters = C0;
pt.asYears = M0;
pt.valueOf = T0;
pt._bubble = v0;
pt.clone = z0;
pt.get = D0;
pt.milliseconds = O0;
pt.seconds = P0;
pt.minutes = I0;
pt.hours = E0;
pt.days = $0;
pt.weeks = R0;
pt.months = A0;
pt.years = N0;
pt.humanize = W0;
pt.toISOString = hr;
pt.toString = hr;
pt.toJSON = hr;
pt.locale = yh;
pt.localeData = xh;
pt.toIsoString = hi(
  "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
  hr
);
pt.lang = bh;
je("X", 0, 0, "unix");
je("x", 0, 0, "valueOf");
Ae("x", sr);
Ae("X", um);
Pt("X", function(e, t, n) {
  n._d = new Date(parseFloat(e) * 1e3);
});
Pt("x", function(e, t, n) {
  n._d = new Date(ft(e));
});
//! moment.js
Ie.version = "2.30.1";
Yp(Wt);
Ie.fn = _e;
Ie.min = Pv;
Ie.max = Iv;
Ie.now = Ev;
Ie.utc = ji;
Ie.unix = s0;
Ie.months = u0;
Ie.isDate = es;
Ie.locale = Na;
Ie.invalid = ir;
Ie.duration = Ii;
Ie.isMoment = Pi;
Ie.weekdays = d0;
Ie.parseZone = r0;
Ie.localeData = pa;
Ie.isDuration = Rs;
Ie.monthsShort = c0;
Ie.weekdaysMin = h0;
Ie.defineLocale = Ju;
Ie.updateLocale = rv;
Ie.locales = uv;
Ie.weekdaysShort = f0;
Ie.normalizeUnits = gi;
Ie.relativeTimeRounding = F0;
Ie.relativeTimeThreshold = V0;
Ie.calendarFormat = ay;
Ie.prototype = _e;
Ie.HTML5_FMT = {
  DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
  // <input type="datetime-local" />
  DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
  // <input type="datetime-local" step="1" />
  DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
  // <input type="datetime-local" step="0.001" />
  DATE: "YYYY-MM-DD",
  // <input type="date" />
  TIME: "HH:mm",
  // <input type="time" />
  TIME_SECONDS: "HH:mm:ss",
  // <input type="time" step="1" />
  TIME_MS: "HH:mm:ss.SSS",
  // <input type="time" step="0.001" />
  WEEK: "GGGG-[W]WW",
  // <input type="week" />
  MONTH: "YYYY-MM"
  // <input type="month" />
};
Ie.ISO_8601;
const Y0 = (e) => Ie.isMoment(e);
var an = /* @__PURE__ */ ((e) => (e.time = "time", e.number = "number", e.string = "string", e.boolean = "boolean", e.trace = "trace", e.geo = "geo", e.enum = "enum", e.other = "other", e.frame = "frame", e.nestedFrames = "nestedFrames", e))(an || {});
const B0 = /^\s*(-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?|NAN)\s*$/i;
function Yl(e) {
  return e instanceof Date || Y0(e) ? an.time : $p(e) ? an.number : hu(e) ? B0.test(e) ? an.number : e === "true" || e === "TRUE" || e === "True" || e === "false" || e === "FALSE" || e === "False" ? an.boolean : an.string : Ap(e) ? an.boolean : an.other;
}
function H0(e) {
  if (e.name) {
    const t = e.name.toLowerCase();
    if (t === "date" || t === "time")
      return an.time;
  }
  for (let t = 0; t < e.values.length; t++) {
    const n = e.values[t];
    if (n != null)
      return Yl(n);
  }
}
function j0(e) {
  return U0(e);
}
function U0(e, t) {
  return {
    fields: (t ? e.fields.filter(t) : e.fields).map((a) => {
      let l = a.values;
      return {
        name: a.name,
        type: a.type,
        config: a.config,
        values: l,
        labels: a.labels
      };
    }),
    refId: e.refId,
    meta: e.meta,
    name: e.name
  };
}
var Nc, Rc;
class G0 {
  constructor() {
    this[Nc] = {};
  }
  // Implement "iterator protocol"
  *iterator() {
    for (let t = 0; t < this.length; t++)
      yield this.get(t);
  }
  set(t, n) {
    throw "unsupported operation";
  }
  add(t) {
    throw "unsupported operation";
  }
  push(...t) {
    for (const n of t)
      this.add(n);
    return this.length;
  }
  // Implement "iterable protocol"
  [(Rc = Symbol.iterator, Nc = Symbol.unscopables, Rc)]() {
    return this.iterator();
  }
  forEach(t) {
    return Br(this).forEach(t);
  }
  map(t) {
    return Br(this).map(t);
  }
  filter(t) {
    return Br(this).filter(t);
  }
  at(t) {
    return this.get(t);
  }
  toArray() {
    const t = new Array(this.length);
    for (let n = 0; n < this.length; n++)
      t[n] = this.get(n);
    return t;
  }
  join(t) {
    return this.toArray().join(t);
  }
  toJSON() {
    return this.toArray();
  }
  pop() {
    throw new Error("Method not implemented.");
  }
  concat(...t) {
    throw new Error("Method not implemented.");
  }
  reverse() {
    throw new Error("Method not implemented.");
  }
  shift() {
    throw new Error("Method not implemented.");
  }
  sort(t) {
    throw new Error("Method not implemented.");
  }
  splice(t, n, ...i) {
    throw new Error("Method not implemented.");
  }
  unshift(...t) {
    throw new Error("Method not implemented.");
  }
  fill(t, n, i) {
    throw new Error("Method not implemented.");
  }
  copyWithin(t, n, i) {
    throw new Error("Method not implemented.");
  }
  //--------------------------------------------------------------------------------
  // Delegated Array function -- these will not be efficient :grimmice:
  //--------------------------------------------------------------------------------
  slice(t, n) {
    return this.toArray().slice(t, n);
  }
  indexOf(t, n) {
    return this.toArray().indexOf(t, n);
  }
  lastIndexOf(t, n) {
    return this.toArray().lastIndexOf(t, n);
  }
  every(t, n) {
    return this.toArray().every(t, n);
  }
  some(t, n) {
    return this.toArray().some(t, n);
  }
  reduce(t, n) {
    throw new Error("Method not implemented.");
  }
  reduceRight(t, n) {
    throw new Error("Method not implemented.");
  }
  find(t, n) {
    return this.toArray().find(t, n);
  }
  findIndex(t, n) {
    return this.toArray().findIndex(t, n);
  }
  entries() {
    return this.toArray().entries();
  }
  keys() {
    return this.toArray().keys();
  }
  values() {
    return this.toArray().values();
  }
  includes(t, n) {
    return this.toArray().includes(t, n);
  }
  flatMap(t, n) {
    return this.toArray().flatMap(t, n);
  }
  flat(t) {
    throw new Error("Method not implemented.");
  }
}
const Yr = [];
function Br(e) {
  return {
    *[Symbol.iterator]() {
      for (let t = 0; t < e.length; t++)
        yield e.get(t);
    },
    forEach(t) {
      for (let n = 0; n < e.length; n++)
        t(e.get(n), n, Yr);
    },
    map(t) {
      const n = [];
      for (let i = 0; i < e.length; i++)
        n.push(t(e.get(i), i, Yr));
      return n;
    },
    /** Add a predicate where you return true if it should *keep* the value */
    filter(t) {
      const n = [];
      let i = 0;
      for (const a of this)
        t(a, i++, Yr) && n.push(a);
      return n;
    }
  };
}
function K0(e, t) {
  return t.type || (t.name === "time" || t.name === "Time" ? t.type = an.time : t.type = Yl(e)), t.type === an.number ? (n) => parseFloat(n) : t.type === an.boolean ? (n) => !(n[0] === "F" || n[0] === "f" || n[0] === "0") : (n) => n;
}
const Hr = void 0;
class Z0 extends G0 {
  constructor(t, n) {
    if (super(), this.fields = [], this.first = [], this.parsers = void 0, this.creator = n || ((i) => i ?? []), t) {
      const { name: i, refId: a, meta: l, fields: u } = t;
      if (i && (this.name = i), a && (this.refId = a), l && (this.meta = l), u)
        for (const r of u)
          this.addField(r);
    }
    Object.defineProperty(this, "length", {
      enumerable: !0,
      get: () => this.first.length
    });
  }
  // Defined for Vector interface
  get length() {
    return this.first.length;
  }
  addFieldFor(t, n) {
    return this.addField({
      name: n || "",
      // Will be filled in
      type: Yl(t)
    });
  }
  addField(t, n) {
    let i;
    t.values && (i = t.values);
    let a = t.type;
    !a && (t.name === "time" || t.name === "Time") ? a = an.time : (!a && i && i.length && (a = Yl(i[0])), a || (a = an.other));
    let l = t.name;
    l || (l = `Field ${this.fields.length + 1}`);
    const u = {
      ...t,
      name: l,
      type: a,
      config: t.config || {},
      values: this.creator(i)
    };
    if (a === an.other && (a = H0(u), a && (u.type = a)), this.fields.push(u), this.first = this.fields[0].values, n)
      for (; u.values.length < n; )
        u.values.push(Hr);
    else
      this.validate();
    return u;
  }
  validate() {
    const t = this.fields.reduce((n, i) => Math.max(n, i.values.length), 0);
    for (const n of this.fields)
      for (; n.values.length !== t; )
        n.values.push(Hr);
  }
  /**
   * @deprecated unclear if this is actually used
   */
  setParser(t, n) {
    return this.parsers || (this.parsers = /* @__PURE__ */ new Map()), this.parsers.set(t, n), n;
  }
  parseValue(t, n) {
    var i;
    let a = (i = this.parsers) == null ? void 0 : i.get(t);
    return a || (a = this.setParser(t, K0(n, t))), a(n);
  }
  /**
   * This will add each value to the corresponding column
   */
  appendRow(t) {
    for (let n = this.fields.length; n < t.length; n++)
      this.addField({
        name: `Field ${n + 1}`,
        type: Yl(t[n])
      });
    if (this.length < 1)
      for (let n = 0; n < this.fields.length; n++) {
        const i = this.fields[n];
        (!i.type || i.type === an.other) && (i.type = Yl(t[n]));
      }
    for (let n = 0; n < this.fields.length; n++) {
      const i = this.fields[n];
      let a = t[n];
      i.type !== an.string && hu(a) && (a = this.parseValue(i, a)), i.values.push(a);
    }
  }
  /** support standard array push syntax */
  push(...t) {
    for (const n of t)
      this.add(n);
    return this.length;
  }
  reverse() {
    for (const t of this.fields)
      t.values.reverse();
    return this;
  }
  /**
   * Add values from an object to corresponding fields. Similar to appendRow but does not create new fields.
   */
  add(t) {
    const n = t;
    for (const i of this.fields) {
      let a = n[i.name];
      i.type !== an.string && hu(a) && (a = this.parseValue(i, a)), a === void 0 && (a = Hr), i.values.push(a);
    }
  }
  set(t, n) {
    if (t > this.length)
      throw new Error("Unable to set value beyond current length");
    const i = n || {};
    for (const a of this.fields)
      a.values[t] = i[a.name];
  }
  /**
   * Get an object with a property for each field in the DataFrame
   */
  get(t) {
    const n = {};
    for (const i of this.fields)
      n[i.name] = i.values[t];
    return n;
  }
  /**
   * The simplified JSON values used in JSON.stringify()
   */
  toJSON() {
    return j0(this);
  }
}
function Q0(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function Zs(e) {
  "@babel/helpers - typeof";
  return Zs = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, Zs(e);
}
var X0 = /^\s+/, J0 = /\s+$/;
function We(e, t) {
  if (e = e || "", t = t || {}, e instanceof We)
    return e;
  if (!(this instanceof We))
    return new We(e, t);
  var n = eb(e);
  this._originalInput = e, this._r = n.r, this._g = n.g, this._b = n.b, this._a = n.a, this._roundA = Math.round(100 * this._a) / 100, this._format = t.format || n.format, this._gradientType = t.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = n.ok;
}
We.prototype = {
  isDark: function() {
    return this.getBrightness() < 128;
  },
  isLight: function() {
    return !this.isDark();
  },
  isValid: function() {
    return this._ok;
  },
  getOriginalInput: function() {
    return this._originalInput;
  },
  getFormat: function() {
    return this._format;
  },
  getAlpha: function() {
    return this._a;
  },
  getBrightness: function() {
    var t = this.toRgb();
    return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
  },
  getLuminance: function() {
    var t = this.toRgb(), n, i, a, l, u, r;
    return n = t.r / 255, i = t.g / 255, a = t.b / 255, n <= 0.03928 ? l = n / 12.92 : l = Math.pow((n + 0.055) / 1.055, 2.4), i <= 0.03928 ? u = i / 12.92 : u = Math.pow((i + 0.055) / 1.055, 2.4), a <= 0.03928 ? r = a / 12.92 : r = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * l + 0.7152 * u + 0.0722 * r;
  },
  setAlpha: function(t) {
    return this._a = Ih(t), this._roundA = Math.round(100 * this._a) / 100, this;
  },
  toHsv: function() {
    var t = qc(this._r, this._g, this._b);
    return {
      h: t.h * 360,
      s: t.s,
      v: t.v,
      a: this._a
    };
  },
  toHsvString: function() {
    var t = qc(this._r, this._g, this._b), n = Math.round(t.h * 360), i = Math.round(t.s * 100), a = Math.round(t.v * 100);
    return this._a == 1 ? "hsv(" + n + ", " + i + "%, " + a + "%)" : "hsva(" + n + ", " + i + "%, " + a + "%, " + this._roundA + ")";
  },
  toHsl: function() {
    var t = Lc(this._r, this._g, this._b);
    return {
      h: t.h * 360,
      s: t.s,
      l: t.l,
      a: this._a
    };
  },
  toHslString: function() {
    var t = Lc(this._r, this._g, this._b), n = Math.round(t.h * 360), i = Math.round(t.s * 100), a = Math.round(t.l * 100);
    return this._a == 1 ? "hsl(" + n + ", " + i + "%, " + a + "%)" : "hsla(" + n + ", " + i + "%, " + a + "%, " + this._roundA + ")";
  },
  toHex: function(t) {
    return Fc(this._r, this._g, this._b, t);
  },
  toHexString: function(t) {
    return "#" + this.toHex(t);
  },
  toHex8: function(t) {
    return ab(this._r, this._g, this._b, this._a, t);
  },
  toHex8String: function(t) {
    return "#" + this.toHex8(t);
  },
  toRgb: function() {
    return {
      r: Math.round(this._r),
      g: Math.round(this._g),
      b: Math.round(this._b),
      a: this._a
    };
  },
  toRgbString: function() {
    return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
  },
  toPercentageRgb: function() {
    return {
      r: Math.round(Kt(this._r, 255) * 100) + "%",
      g: Math.round(Kt(this._g, 255) * 100) + "%",
      b: Math.round(Kt(this._b, 255) * 100) + "%",
      a: this._a
    };
  },
  toPercentageRgbString: function() {
    return this._a == 1 ? "rgb(" + Math.round(Kt(this._r, 255) * 100) + "%, " + Math.round(Kt(this._g, 255) * 100) + "%, " + Math.round(Kt(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(Kt(this._r, 255) * 100) + "%, " + Math.round(Kt(this._g, 255) * 100) + "%, " + Math.round(Kt(this._b, 255) * 100) + "%, " + this._roundA + ")";
  },
  toName: function() {
    return this._a === 0 ? "transparent" : this._a < 1 ? !1 : mb[Fc(this._r, this._g, this._b, !0)] || !1;
  },
  toFilter: function(t) {
    var n = "#" + Vc(this._r, this._g, this._b, this._a), i = n, a = this._gradientType ? "GradientType = 1, " : "";
    if (t) {
      var l = We(t);
      i = "#" + Vc(l._r, l._g, l._b, l._a);
    }
    return "progid:DXImageTransform.Microsoft.gradient(" + a + "startColorstr=" + n + ",endColorstr=" + i + ")";
  },
  toString: function(t) {
    var n = !!t;
    t = t || this._format;
    var i = !1, a = this._a < 1 && this._a >= 0, l = !n && a && (t === "hex" || t === "hex6" || t === "hex3" || t === "hex4" || t === "hex8" || t === "name");
    return l ? t === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (i = this.toRgbString()), t === "prgb" && (i = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (i = this.toHexString()), t === "hex3" && (i = this.toHexString(!0)), t === "hex4" && (i = this.toHex8String(!0)), t === "hex8" && (i = this.toHex8String()), t === "name" && (i = this.toName()), t === "hsl" && (i = this.toHslString()), t === "hsv" && (i = this.toHsvString()), i || this.toHexString());
  },
  clone: function() {
    return We(this.toString());
  },
  _applyModification: function(t, n) {
    var i = t.apply(null, [this].concat([].slice.call(n)));
    return this._r = i._r, this._g = i._g, this._b = i._b, this.setAlpha(i._a), this;
  },
  lighten: function() {
    return this._applyModification(rb, arguments);
  },
  brighten: function() {
    return this._applyModification(ub, arguments);
  },
  darken: function() {
    return this._applyModification(cb, arguments);
  },
  desaturate: function() {
    return this._applyModification(lb, arguments);
  },
  saturate: function() {
    return this._applyModification(ob, arguments);
  },
  greyscale: function() {
    return this._applyModification(sb, arguments);
  },
  spin: function() {
    return this._applyModification(db, arguments);
  },
  _applyCombination: function(t, n) {
    return t.apply(null, [this].concat([].slice.call(n)));
  },
  analogous: function() {
    return this._applyCombination(gb, arguments);
  },
  complement: function() {
    return this._applyCombination(fb, arguments);
  },
  monochromatic: function() {
    return this._applyCombination(pb, arguments);
  },
  splitcomplement: function() {
    return this._applyCombination(hb, arguments);
  },
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
  // polyad: function (number) {
  //   return this._applyCombination(polyad, [number]);
  // },
  triad: function() {
    return this._applyCombination(Wc, [3]);
  },
  tetrad: function() {
    return this._applyCombination(Wc, [4]);
  }
};
We.fromRatio = function(e, t) {
  if (Zs(e) == "object") {
    var n = {};
    for (var i in e)
      e.hasOwnProperty(i) && (i === "a" ? n[i] = e[i] : n[i] = Oo(e[i]));
    e = n;
  }
  return We(e, t);
};
function eb(e) {
  var t = {
    r: 0,
    g: 0,
    b: 0
  }, n = 1, i = null, a = null, l = null, u = !1, r = !1;
  return typeof e == "string" && (e = xb(e)), Zs(e) == "object" && (aa(e.r) && aa(e.g) && aa(e.b) ? (t = tb(e.r, e.g, e.b), u = !0, r = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : aa(e.h) && aa(e.s) && aa(e.v) ? (i = Oo(e.s), a = Oo(e.v), t = ib(e.h, i, a), u = !0, r = "hsv") : aa(e.h) && aa(e.s) && aa(e.l) && (i = Oo(e.s), l = Oo(e.l), t = nb(e.h, i, l), u = !0, r = "hsl"), e.hasOwnProperty("a") && (n = e.a)), n = Ih(n), {
    ok: u,
    format: e.format || r,
    r: Math.min(255, Math.max(t.r, 0)),
    g: Math.min(255, Math.max(t.g, 0)),
    b: Math.min(255, Math.max(t.b, 0)),
    a: n
  };
}
function tb(e, t, n) {
  return {
    r: Kt(e, 255) * 255,
    g: Kt(t, 255) * 255,
    b: Kt(n, 255) * 255
  };
}
function Lc(e, t, n) {
  e = Kt(e, 255), t = Kt(t, 255), n = Kt(n, 255);
  var i = Math.max(e, t, n), a = Math.min(e, t, n), l, u, r = (i + a) / 2;
  if (i == a)
    l = u = 0;
  else {
    var c = i - a;
    switch (u = r > 0.5 ? c / (2 - i - a) : c / (i + a), i) {
      case e:
        l = (t - n) / c + (t < n ? 6 : 0);
        break;
      case t:
        l = (n - e) / c + 2;
        break;
      case n:
        l = (e - t) / c + 4;
        break;
    }
    l /= 6;
  }
  return {
    h: l,
    s: u,
    l: r
  };
}
function nb(e, t, n) {
  var i, a, l;
  e = Kt(e, 360), t = Kt(t, 100), n = Kt(n, 100);
  function u(g, y, v) {
    return v < 0 && (v += 1), v > 1 && (v -= 1), v < 1 / 6 ? g + (y - g) * 6 * v : v < 1 / 2 ? y : v < 2 / 3 ? g + (y - g) * (2 / 3 - v) * 6 : g;
  }
  if (t === 0)
    i = a = l = n;
  else {
    var r = n < 0.5 ? n * (1 + t) : n + t - n * t, c = 2 * n - r;
    i = u(c, r, e + 1 / 3), a = u(c, r, e), l = u(c, r, e - 1 / 3);
  }
  return {
    r: i * 255,
    g: a * 255,
    b: l * 255
  };
}
function qc(e, t, n) {
  e = Kt(e, 255), t = Kt(t, 255), n = Kt(n, 255);
  var i = Math.max(e, t, n), a = Math.min(e, t, n), l, u, r = i, c = i - a;
  if (u = i === 0 ? 0 : c / i, i == a)
    l = 0;
  else {
    switch (i) {
      case e:
        l = (t - n) / c + (t < n ? 6 : 0);
        break;
      case t:
        l = (n - e) / c + 2;
        break;
      case n:
        l = (e - t) / c + 4;
        break;
    }
    l /= 6;
  }
  return {
    h: l,
    s: u,
    v: r
  };
}
function ib(e, t, n) {
  e = Kt(e, 360) * 6, t = Kt(t, 100), n = Kt(n, 100);
  var i = Math.floor(e), a = e - i, l = n * (1 - t), u = n * (1 - a * t), r = n * (1 - (1 - a) * t), c = i % 6, g = [n, u, l, l, r, n][c], y = [r, n, n, u, l, l][c], v = [l, l, r, n, n, u][c];
  return {
    r: g * 255,
    g: y * 255,
    b: v * 255
  };
}
function Fc(e, t, n, i) {
  var a = [zi(Math.round(e).toString(16)), zi(Math.round(t).toString(16)), zi(Math.round(n).toString(16))];
  return i && a[0].charAt(0) == a[0].charAt(1) && a[1].charAt(0) == a[1].charAt(1) && a[2].charAt(0) == a[2].charAt(1) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) : a.join("");
}
function ab(e, t, n, i, a) {
  var l = [zi(Math.round(e).toString(16)), zi(Math.round(t).toString(16)), zi(Math.round(n).toString(16)), zi(Eh(i))];
  return a && l[0].charAt(0) == l[0].charAt(1) && l[1].charAt(0) == l[1].charAt(1) && l[2].charAt(0) == l[2].charAt(1) && l[3].charAt(0) == l[3].charAt(1) ? l[0].charAt(0) + l[1].charAt(0) + l[2].charAt(0) + l[3].charAt(0) : l.join("");
}
function Vc(e, t, n, i) {
  var a = [zi(Eh(i)), zi(Math.round(e).toString(16)), zi(Math.round(t).toString(16)), zi(Math.round(n).toString(16))];
  return a.join("");
}
We.equals = function(e, t) {
  return !e || !t ? !1 : We(e).toRgbString() == We(t).toRgbString();
};
We.random = function() {
  return We.fromRatio({
    r: Math.random(),
    g: Math.random(),
    b: Math.random()
  });
};
function lb(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = We(e).toHsl();
  return n.s -= t / 100, n.s = gr(n.s), We(n);
}
function ob(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = We(e).toHsl();
  return n.s += t / 100, n.s = gr(n.s), We(n);
}
function sb(e) {
  return We(e).desaturate(100);
}
function rb(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = We(e).toHsl();
  return n.l += t / 100, n.l = gr(n.l), We(n);
}
function ub(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = We(e).toRgb();
  return n.r = Math.max(0, Math.min(255, n.r - Math.round(255 * -(t / 100)))), n.g = Math.max(0, Math.min(255, n.g - Math.round(255 * -(t / 100)))), n.b = Math.max(0, Math.min(255, n.b - Math.round(255 * -(t / 100)))), We(n);
}
function cb(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = We(e).toHsl();
  return n.l -= t / 100, n.l = gr(n.l), We(n);
}
function db(e, t) {
  var n = We(e).toHsl(), i = (n.h + t) % 360;
  return n.h = i < 0 ? 360 + i : i, We(n);
}
function fb(e) {
  var t = We(e).toHsl();
  return t.h = (t.h + 180) % 360, We(t);
}
function Wc(e, t) {
  if (isNaN(t) || t <= 0)
    throw new Error("Argument to polyad must be a positive number");
  for (var n = We(e).toHsl(), i = [We(e)], a = 360 / t, l = 1; l < t; l++)
    i.push(We({
      h: (n.h + l * a) % 360,
      s: n.s,
      l: n.l
    }));
  return i;
}
function hb(e) {
  var t = We(e).toHsl(), n = t.h;
  return [We(e), We({
    h: (n + 72) % 360,
    s: t.s,
    l: t.l
  }), We({
    h: (n + 216) % 360,
    s: t.s,
    l: t.l
  })];
}
function gb(e, t, n) {
  t = t || 6, n = n || 30;
  var i = We(e).toHsl(), a = 360 / n, l = [We(e)];
  for (i.h = (i.h - (a * t >> 1) + 720) % 360; --t; )
    i.h = (i.h + a) % 360, l.push(We(i));
  return l;
}
function pb(e, t) {
  t = t || 6;
  for (var n = We(e).toHsv(), i = n.h, a = n.s, l = n.v, u = [], r = 1 / t; t--; )
    u.push(We({
      h: i,
      s: a,
      v: l
    })), l = (l + r) % 1;
  return u;
}
We.mix = function(e, t, n) {
  n = n === 0 ? 0 : n || 50;
  var i = We(e).toRgb(), a = We(t).toRgb(), l = n / 100, u = {
    r: (a.r - i.r) * l + i.r,
    g: (a.g - i.g) * l + i.g,
    b: (a.b - i.b) * l + i.b,
    a: (a.a - i.a) * l + i.a
  };
  return We(u);
};
We.readability = function(e, t) {
  var n = We(e), i = We(t);
  return (Math.max(n.getLuminance(), i.getLuminance()) + 0.05) / (Math.min(n.getLuminance(), i.getLuminance()) + 0.05);
};
We.isReadable = function(e, t, n) {
  var i = We.readability(e, t), a, l;
  switch (l = !1, a = wb(n), a.level + a.size) {
    case "AAsmall":
    case "AAAlarge":
      l = i >= 4.5;
      break;
    case "AAlarge":
      l = i >= 3;
      break;
    case "AAAsmall":
      l = i >= 7;
      break;
  }
  return l;
};
We.mostReadable = function(e, t, n) {
  var i = null, a = 0, l, u, r, c;
  n = n || {}, u = n.includeFallbackColors, r = n.level, c = n.size;
  for (var g = 0; g < t.length; g++)
    l = We.readability(e, t[g]), l > a && (a = l, i = We(t[g]));
  return We.isReadable(e, i, {
    level: r,
    size: c
  }) || !u ? i : (n.includeFallbackColors = !1, We.mostReadable(e, ["#fff", "#000"], n));
};
var wu = We.names = {
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
}, mb = We.hexNames = vb(wu);
function vb(e) {
  var t = {};
  for (var n in e)
    e.hasOwnProperty(n) && (t[e[n]] = n);
  return t;
}
function Ih(e) {
  return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
}
function Kt(e, t) {
  yb(e) && (e = "100%");
  var n = bb(e);
  return e = Math.min(t, Math.max(0, parseFloat(e))), n && (e = parseInt(e * t, 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : e % t / parseFloat(t);
}
function gr(e) {
  return Math.min(1, Math.max(0, e));
}
function Hn(e) {
  return parseInt(e, 16);
}
function yb(e) {
  return typeof e == "string" && e.indexOf(".") != -1 && parseFloat(e) === 1;
}
function bb(e) {
  return typeof e == "string" && e.indexOf("%") != -1;
}
function zi(e) {
  return e.length == 1 ? "0" + e : "" + e;
}
function Oo(e) {
  return e <= 1 && (e = e * 100 + "%"), e;
}
function Eh(e) {
  return Math.round(parseFloat(e) * 255).toString(16);
}
function Yc(e) {
  return Hn(e) / 255;
}
var wi = (function() {
  var e = "[-\\+]?\\d+%?", t = "[-\\+]?\\d*\\.\\d+%?", n = "(?:" + t + ")|(?:" + e + ")", i = "[\\s|\\(]+(" + n + ")[,|\\s]+(" + n + ")[,|\\s]+(" + n + ")\\s*\\)?", a = "[\\s|\\(]+(" + n + ")[,|\\s]+(" + n + ")[,|\\s]+(" + n + ")[,|\\s]+(" + n + ")\\s*\\)?";
  return {
    CSS_UNIT: new RegExp(n),
    rgb: new RegExp("rgb" + i),
    rgba: new RegExp("rgba" + a),
    hsl: new RegExp("hsl" + i),
    hsla: new RegExp("hsla" + a),
    hsv: new RegExp("hsv" + i),
    hsva: new RegExp("hsva" + a),
    hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  };
})();
function aa(e) {
  return !!wi.CSS_UNIT.exec(e);
}
function xb(e) {
  e = e.replace(X0, "").replace(J0, "").toLowerCase();
  var t = !1;
  if (wu[e])
    e = wu[e], t = !0;
  else if (e == "transparent")
    return {
      r: 0,
      g: 0,
      b: 0,
      a: 0,
      format: "name"
    };
  var n;
  return (n = wi.rgb.exec(e)) ? {
    r: n[1],
    g: n[2],
    b: n[3]
  } : (n = wi.rgba.exec(e)) ? {
    r: n[1],
    g: n[2],
    b: n[3],
    a: n[4]
  } : (n = wi.hsl.exec(e)) ? {
    h: n[1],
    s: n[2],
    l: n[3]
  } : (n = wi.hsla.exec(e)) ? {
    h: n[1],
    s: n[2],
    l: n[3],
    a: n[4]
  } : (n = wi.hsv.exec(e)) ? {
    h: n[1],
    s: n[2],
    v: n[3]
  } : (n = wi.hsva.exec(e)) ? {
    h: n[1],
    s: n[2],
    v: n[3],
    a: n[4]
  } : (n = wi.hex8.exec(e)) ? {
    r: Hn(n[1]),
    g: Hn(n[2]),
    b: Hn(n[3]),
    a: Yc(n[4]),
    format: t ? "name" : "hex8"
  } : (n = wi.hex6.exec(e)) ? {
    r: Hn(n[1]),
    g: Hn(n[2]),
    b: Hn(n[3]),
    format: t ? "name" : "hex"
  } : (n = wi.hex4.exec(e)) ? {
    r: Hn(n[1] + "" + n[1]),
    g: Hn(n[2] + "" + n[2]),
    b: Hn(n[3] + "" + n[3]),
    a: Yc(n[4] + "" + n[4]),
    format: t ? "name" : "hex8"
  } : (n = wi.hex3.exec(e)) ? {
    r: Hn(n[1] + "" + n[1]),
    g: Hn(n[2] + "" + n[2]),
    b: Hn(n[3] + "" + n[3]),
    format: t ? "name" : "hex"
  } : !1;
}
function wb(e) {
  var t, n;
  return e = e || {
    level: "AA",
    size: "small"
  }, t = (e.level || "AA").toUpperCase(), n = (e.size || "small").toLowerCase(), t !== "AA" && t !== "AAA" && (t = "AA"), n !== "small" && n !== "large" && (n = "small"), {
    level: t,
    size: n
  };
}
function Sb(e) {
  return {
    name: e.name ?? "",
    refId: e.refId ?? "",
    fields: e.fields.map((t) => ({
      name: t.name,
      type: t.type,
      values: { toArray: () => t.values },
      config: t.config ?? {},
      state: {}
    }))
  };
}
const $h = /* @__PURE__ */ new Map();
function jr(e) {
  $h.set(e.type, e);
}
function Qs(e) {
  return $h.get(e);
}
const Bc = [
  "api-gateway",
  "auth-service",
  "payment-service",
  "user-service",
  "notification-service",
  "order-service",
  "inventory-service",
  "search-service"
];
function Ur(e) {
  let t = e;
  return () => (t = (t * 16807 + 0) % 2147483647, t / 2147483647);
}
function kb(e, t, n, i, a) {
  const l = n ^ Math.floor(Date.now() / 5e3) * 2654435761, u = Ur(n), r = Ur(l);
  if (e === "random-walk") {
    const c = Ur((n + Date.now()) % 2147483647), g = a + i * 0.5, y = a * 0.1, v = a + i * 1.8, m = [g];
    for (let S = 1; S < t; S++) {
      const T = m[S - 1], C = (g - T) * 0.05, E = (c() - 0.5) * i * 0.08 + C;
      m.push(Math.max(y, Math.min(v, T + E)));
    }
    return m;
  }
  return Array.from({ length: t }, (c, g) => {
    const y = g / t;
    let v;
    switch (e) {
      case "sine":
        v = a + Math.sin(y * Math.PI * 4 + n) * i + (u() - 0.5) * i * 0.2;
        break;
      case "spike": {
        const S = [0.2, 0.5, 0.8].reduce(
          (T, C) => T + Math.exp(-((y - C) ** 2) / 1e-3) * i * 2,
          0
        );
        v = a + S + (u() - 0.5) * i * 0.15;
        break;
      }
      case "step":
        v = a + Math.floor(y * 5) % 3 * i * 0.5 + (u() - 0.5) * i * 0.1;
        break;
      case "sawtooth":
        v = a + y * 3 % 1 * i + (u() - 0.5) * i * 0.15;
        break;
      case "noise":
        v = a + u() * i;
        break;
      case "trend-up":
        v = a + y * i * 1.5 + Math.sin(y * 10) * i * 0.2 + (u() - 0.5) * i * 0.1;
        break;
      case "trend-down":
        v = a + (1 - y) * i * 1.5 + Math.sin(y * 8) * i * 0.15 + (u() - 0.5) * i * 0.1;
        break;
      case "plateau": {
        const T = y < 0.3 ? y / 0.3 : y > 0.7 ? (1 - y) / 0.30000000000000004 : 1;
        v = a + T * i + (u() - 0.5) * i * 0.1;
        break;
      }
      case "live": {
        if (y < 0.9)
          v = a + Math.sin(y * Math.PI * 4 + n) * i * 0.6 + (u() - 0.5) * i * 0.1;
        else {
          const S = (y - 0.9) / 0.09999999999999998;
          v = a + Math.sin(0.9 * Math.PI * 4 + n) * i * 0.6 + (r() - 0.5) * i * 0.4 * S * 2;
        }
        break;
      }
      default:
        v = a;
    }
    return Math.max(0, v);
  });
}
function Ah(e, t = 15, n = 3, i = "sine", a) {
  const l = [];
  for (let r = e.from; r <= e.to; r += t)
    l.push(r);
  const u = Array.from({ length: n }, (r, c) => {
    const g = 20 + (c * 37 + 13) % 60, y = 10 + (c * 53 + 7) % 40, v = kb(i, l.length, c * 1e3 + 42, g, y);
    return {
      label: a?.[c] ?? Bc[c % Bc.length],
      values: v
    };
  });
  return { timestamps: l, series: u };
}
function _b(e, t, n, i) {
  const l = ((n + i) / 2 - e) * 0.05, u = (Math.random() - 0.5) * t * 0.08 + l;
  return Math.max(n, Math.min(i, e + u));
}
class Cb {
  type = "mock";
  meta = {
    type: "mock",
    displayName: "Mock",
    icon: "🎲"
  };
  defaultQuery = () => ({
    type: "mock",
    metric: "",
    pattern: "sine",
    seriesCount: 3,
    liveAmplitude: 1
  });
  query(t) {
    const { range: n, targets: i, intervalMs: a, maxDataPoints: l } = t, u = n.to - n.from, r = Math.max(a, Math.ceil(u / (l || 1e3))), c = Math.max(Math.round(r / 1e3), 1), g = i.filter((y) => y).map((y) => {
      const { timestamps: v, series: m } = Ah(
        { from: n.from / 1e3, to: n.to / 1e3 },
        c,
        y.seriesCount,
        y.pattern,
        y.labels
      ), S = v.map((C) => C * 1e3), T = [
        { name: "Time", type: an.time, values: S, config: {} },
        ...m.map((C) => ({
          name: C.label,
          type: an.number,
          values: C.values,
          config: { displayNameFromDS: C.label }
        }))
      ];
      return Sb({ name: y.metric, refId: "A", fields: T });
    });
    return Promise.resolve({ data: g, state: "Done" });
  }
}
const Ra = [
  "#4096ff",
  "#52c41a",
  "#faad14",
  "#ff4d4f",
  "#722ed1",
  "#13c2c2",
  "#eb2f96",
  "#fa8c16",
  "#a0d911",
  "#1677ff",
  "#2f54eb",
  "#f5222d",
  "#fadb14",
  "#7cb305",
  "#08979c",
  "#531dab",
  "#c41d7f",
  "#d4380d",
  "#d48806",
  "#389e0d"
];
function la(e, t) {
  if (e.length < 2 || t < 2)
    return [...e];
  const n = (l) => [
    Number.parseInt(l.slice(1, 3), 16),
    Number.parseInt(l.slice(3, 5), 16),
    Number.parseInt(l.slice(5, 7), 16)
  ], i = (l) => Math.round(Math.max(0, Math.min(255, l))).toString(16).padStart(2, "0"), a = e.length - 1;
  return Array.from({ length: t }, (l, u) => {
    const r = u / (t - 1) * a, c = Math.min(Math.floor(r), a - 1), g = r - c, [y, v, m] = n(e[c]), [S, T, C] = n(e[c + 1]);
    return `#${i(y + (S - y) * g)}${i(v + (T - v) * g)}${i(m + (C - m) * g)}`;
  });
}
const oi = {
  classic: Ra,
  tableau10: [
    "#4e79a7",
    "#f28e2b",
    "#e15759",
    "#76b7b2",
    "#59a14f",
    "#edc948",
    "#b07aa1",
    "#ff9da7",
    "#9c755f",
    "#bab0ac"
  ],
  "grafana-classic": [
    "#7EB26D",
    "#EAB839",
    "#6ED0E0",
    "#EF843C",
    "#E24D42",
    "#1F78C1",
    "#BA43A9",
    "#705DA0",
    "#508642",
    "#CCA300",
    "#447EBC",
    "#C15C17",
    "#890F02",
    "#0A437C",
    "#6D1F62",
    "#584477",
    "#B7DBAB",
    "#F4D598",
    "#70DBED",
    "#F9BA8F"
  ],
  blues: la(["#cfe2f3", "#9fc5e8", "#3d85c8", "#0b5394", "#041d3a"], 16),
  reds: la(["#fce5cd", "#f6b26b", "#e06666", "#cc0000", "#660000"], 16),
  GrYlRd: la(
    ["#37872d", "#96d98d", "#fee520", "#ff780a", "#f2495c", "#8f3bb8"],
    16
  ),
  "purple-orange": la(
    ["#7b2d8b", "#d45087", "#ff7c43", "#ffa600", "#f0e442", "#b3de69"],
    16
  ),
  "green-yellow-red": la(
    ["#1a9850", "#a6d96a", "#fee08b", "#fdae61", "#d73027"],
    16
  ),
  "red-yellow-green": la(
    ["#d73027", "#fdae61", "#fee08b", "#a6d96a", "#1a9850"],
    16
  ),
  "blue-yellow-red": la(
    ["#2166ac", "#92c5de", "#d1e5f0", "#fddbc7", "#f4a582", "#b2182b"],
    16
  ),
  "blue-purple": la(
    ["#045a8d", "#74a9cf", "#ccebc5", "#9ebcda", "#8856a7", "#810f7c"],
    16
  ),
  "yellow-blue": la(["#ffffd9", "#c7e9b4", "#41b6c4", "#225ea8", "#0c2c84"], 16)
};
function Mb(e) {
  return !e || e === "classic" ? Ra : oi[e] ?? Ra;
}
function Nh(e, t, n = "sequential", i) {
  if (t === 0)
    return [];
  if (e === "fixed") {
    const l = i ?? Ra[0];
    return Array.from({ length: t }, () => l);
  }
  if (e === "thresholds")
    return [];
  const a = Mb(e);
  return n === "distributed" && t > 1 ? Array.from({ length: t }, (l, u) => {
    const r = Math.round(u * (a.length - 1) / (t - 1));
    return a[r];
  }) : Array.from({ length: t }, (l, u) => a[u % a.length]);
}
const Nt = {
  min: 0,
  max: 100,
  capRound: !0,
  trackWidth: 28,
  fillWidth: 30,
  trackColor: "#F4F5F5",
  sweepAngle: 270,
  valueColor: "#e6e6e6",
  valueSize: 28,
  valueVisible: !0,
  paddingX: 12,
  paddingY: 12,
  thresholdDisplay: "track",
  thresholdLabelDisplay: "none",
  orientation: "auto",
  colorFromScheme: !1,
  valueOffsetY: 18
};
let Tb = 0;
function Su() {
  return `panel-${Date.now()}-${++Tb}`;
}
function ri(e) {
  return [{ id: "A", enabled: !0, dataSource: e }];
}
const zb = {
  timeseries: {
    queries: ri({
      type: "mock",
      metric: "http_request_duration_seconds",
      pattern: "sine",
      seriesCount: 3
    }),
    lineWidth: 1.5,
    fillOpacity: 1,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "bottom",
    tooltipMode: "multi",
    tooltipSort: "none",
    showAxisPointer: !0,
    unit: "",
    decimals: 1
  },
  bar: {
    queries: ri({
      type: "mock",
      metric: "http_request_duration_seconds",
      pattern: "sine",
      seriesCount: 3,
      labels: ["p50", "p90", "p99"]
    }),
    lineWidth: 1,
    fillOpacity: 80,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "bottom",
    unit: "ms",
    decimals: 0,
    stacked: !1
  },
  histogram: {
    queries: ri({ type: "mock", metric: "request_duration_ms", pattern: "sine", seriesCount: 1 }),
    lineWidth: 1,
    fillOpacity: 60,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "ms",
    decimals: 0
  },
  stat: {
    queries: ri({
      type: "mock",
      metric: "http_requests_total",
      pattern: "trend-up",
      seriesCount: 1
    }),
    lineWidth: 1,
    fillOpacity: 0,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "",
    decimals: 1,
    statValue: 0,
    statUnit: "",
    statTrend: "flat"
  },
  gauge: {
    queries: ri({ type: "mock", metric: "system_cpu_usage", pattern: "sine", seriesCount: 1 }),
    lineWidth: 1,
    fillOpacity: 0,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "%",
    decimals: 1,
    min: 0,
    max: 100
  },
  table: {
    queries: ri({ type: "mock", metric: "http_requests", pattern: "noise", seriesCount: 1 }),
    lineWidth: 1,
    fillOpacity: 0,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "",
    decimals: 0
  },
  pie: {
    queries: ri({
      type: "mock",
      metric: "http_requests_by_service",
      pattern: "noise",
      seriesCount: 5
    }),
    lineWidth: 1,
    fillOpacity: 80,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "bottom",
    unit: "",
    decimals: 1,
    pieType: "pie",
    pieSliceSorting: "desc",
    pieLabels: ["name", "percent"],
    pieShow: "calculate",
    pieCalculation: "lastNotNull"
  }
};
function Rh(e, t) {
  const n = t?.id ?? Su();
  return { ...{
    id: n,
    type: e,
    title: `New ${e} panel`,
    description: "",
    queries: [
      {
        id: "A",
        enabled: !0,
        dataSource: { type: "mock", metric: "", pattern: "sine", seriesCount: 3 }
      }
    ],
    drawStyle: "lines",
    lineWidth: 1.5,
    fillOpacity: 1,
    gradientMode: "none",
    lineInterpolation: "linear",
    lineStyle: "solid",
    spanNulls: !1,
    insertNulls: !1,
    showPoints: !1,
    showPointsMode: "auto",
    stackingMode: "none",
    legendPosition: "bottom",
    unit: "",
    decimals: 1,
    thresholds: [],
    thresholdBaseColor: "#73bf69",
    softMin: null,
    softMax: null,
    logScale: !1,
    stacked: !1,
    min: 0,
    max: 100,
    links: [],
    axisPlacement: "left",
    showGridLines: "all",
    gridColor: "#E8E9EA",
    axisLabel: "all",
    axisLabelColor: "#666666",
    axisTick: "hidden",
    axisBorder: "hidden",
    scaleDistribution: "linear",
    centeredZero: !1
  }, ...zb[e], ...t, id: n };
}
function Lh() {
  const e = {}, t = [], n = [
    {
      id: "s1",
      type: "stat",
      title: "Requests/sec",
      x: 0,
      y: 0,
      w: 2,
      h: 4,
      extra: { statValue: 1247, statUnit: "req/s", statTrend: "up", unit: "reqps" }
    },
    {
      id: "s2",
      type: "stat",
      title: "Error Rate",
      x: 2,
      y: 0,
      w: 2,
      h: 4,
      extra: {
        statValue: 0.32,
        statUnit: "%",
        statTrend: "down",
        thresholds: [
          { value: 0, color: "#52c41a", label: "OK" },
          { value: 1, color: "#faad14", label: "Warn" },
          { value: 5, color: "#ff4d4f", label: "Crit" }
        ]
      }
    },
    {
      id: "s3",
      type: "stat",
      title: "P99 Latency",
      x: 4,
      y: 0,
      w: 2,
      h: 4,
      extra: {
        statValue: 342,
        statUnit: "ms",
        statTrend: "up",
        thresholds: [
          { value: 0, color: "#52c41a", label: "OK" },
          { value: 200, color: "#faad14", label: "Warn" },
          { value: 500, color: "#ff4d4f", label: "Crit" }
        ]
      }
    },
    {
      id: "s4",
      type: "stat",
      title: "Uptime",
      x: 6,
      y: 0,
      w: 2,
      h: 4,
      extra: { statValue: 99.97, statUnit: "%", statTrend: "flat" }
    },
    { id: "g1", type: "gauge", title: "CPU", x: 8, y: 0, w: 2, h: 4, extra: { statValue: 67.3 } },
    {
      id: "g2",
      type: "gauge",
      title: "Memory",
      x: 10,
      y: 0,
      w: 2,
      h: 4,
      extra: {
        statValue: 82.1,
        thresholds: [
          { value: 0, color: "#52c41a", label: "OK" },
          { value: 70, color: "#faad14", label: "Warn" },
          { value: 90, color: "#ff4d4f", label: "Crit" }
        ]
      }
    },
    {
      id: "ts1",
      type: "timeseries",
      title: "CPU Usage",
      x: 0,
      y: 4,
      w: 6,
      h: 8,
      extra: {
        description: "by service",
        queries: ri({
          type: "mock",
          metric: "system_cpu_usage",
          pattern: "sine",
          seriesCount: 4,
          labels: ["api-gateway", "auth-service", "payment-service", "user-service"]
        }),
        unit: "percent"
      }
    },
    {
      id: "ts2",
      type: "timeseries",
      title: "Request Latency",
      x: 6,
      y: 4,
      w: 6,
      h: 8,
      extra: {
        description: "percentiles",
        queries: ri({
          type: "mock",
          metric: "http_request_duration_seconds",
          pattern: "spike",
          seriesCount: 3,
          labels: ["p50", "p90", "p99"]
        }),
        unit: "ms",
        thresholds: [
          { value: 100, color: "#faad14", label: "Warning 100ms" },
          { value: 300, color: "#ff4d4f", label: "Critical 300ms" }
        ]
      }
    },
    {
      id: "ts3",
      type: "timeseries",
      title: "Throughput",
      x: 0,
      y: 12,
      w: 4,
      h: 8,
      extra: {
        description: "req/s",
        queries: ri({
          type: "mock",
          metric: "http_requests_total",
          pattern: "trend-up",
          seriesCount: 3,
          labels: ["api-gateway", "auth-service", "payment-service"]
        })
      }
    },
    {
      id: "b1",
      type: "bar",
      title: "Latency Percentiles",
      x: 4,
      y: 12,
      w: 4,
      h: 8,
      extra: { description: "by bucket" }
    },
    { id: "h1", type: "histogram", title: "Duration Distribution", x: 8, y: 12, w: 4, h: 8 },
    {
      id: "ts4",
      type: "timeseries",
      title: "Error Rate",
      x: 0,
      y: 20,
      w: 6,
      h: 8,
      extra: {
        description: "5xx vs 4xx",
        queries: ri({
          type: "mock",
          metric: "http_errors",
          pattern: "noise",
          seriesCount: 2,
          labels: ["5xx", "4xx"]
        }),
        fillOpacity: 3
      }
    },
    {
      id: "ts5",
      type: "timeseries",
      title: "Network I/O",
      x: 6,
      y: 20,
      w: 6,
      h: 8,
      extra: {
        description: "KB/s",
        queries: ri({
          type: "mock",
          metric: "network_io",
          pattern: "sawtooth",
          seriesCount: 4,
          labels: ["eth0-rx", "eth0-tx", "eth1-rx", "eth1-tx"]
        }),
        unit: "bytes"
      }
    },
    {
      id: "t1",
      type: "table",
      title: "Recent Requests",
      x: 0,
      y: 28,
      w: 12,
      h: 10,
      extra: { description: "last 80 requests" }
    }
  ];
  for (const i of n) {
    const a = Rh(i.type, { id: i.id, title: i.title, ...i.extra });
    e[i.id] = a, t.push({
      i: i.id,
      x: i.x,
      y: i.y,
      w: i.w,
      h: i.h,
      minH: i.type === "stat" || i.type === "gauge" ? 3 : 6
    });
  }
  return { panels: e, layouts: t };
}
function Db() {
  return JSON.stringify(Lh(), null, 2);
}
const qh = /* @__PURE__ */ new Map();
function Xa(e) {
  qh.set(e.meta.type, e);
}
function Ob(e) {
  return qh.get(e);
}
const Pb = {
  meta: { type: "bar", displayNameKey: "config.type.bar", icon: "📊" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "bar-style", labelKey: "config.section.style", Component: null },
    { key: "axes", labelKey: "config.section.axes", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
}, Ib = {
  meta: { type: "gauge", displayNameKey: "config.type.gauge", icon: "🎯" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "gauge-style", labelKey: "config.section.gaugeStyle", Component: null }
  ]
}, Eb = {
  meta: {
    type: "histogram",
    displayNameKey: "config.type.histogram",
    icon: "📉"
  },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "histogram-style", labelKey: "config.section.histStyle", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
}, $b = {
  meta: { type: "pie", displayNameKey: "config.type.pie", icon: "🥧" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "pie-style", labelKey: "config.section.pieStyle", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
}, Ab = {
  meta: { type: "stat", displayNameKey: "config.type.stat", icon: "#" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "stat-style", labelKey: "config.section.gaugeStyle", Component: null }
  ]
}, Nb = {
  meta: { type: "table", displayNameKey: "config.type.table", icon: "📋" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "table-style", labelKey: "config.section.tableStyle", Component: null }
  ]
}, Rb = {
  meta: { type: "timeseries", displayNameKey: "config.type.timeseries", icon: "📈" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "style", labelKey: "config.section.style", Component: null },
    { key: "axes", labelKey: "config.section.axes", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
};
function Lb() {
  Xa(Rb), Xa(Pb), Xa(Eb), Xa(Ab), Xa(Ib), Xa(Nb), Xa($b);
}
function Po(e, t = "lastNotNull", n) {
  const i = e.filter((a) => a !== null);
  switch (t) {
    case "lastNotNull":
      return i.length > 0 ? i[i.length - 1] ?? 0 : 0;
    case "last":
      return e.length > 0 ? e[e.length - 1] ?? 0 : 0;
    case "firstNotNull":
      return i.length > 0 ? i[0] ?? 0 : 0;
    case "first":
      return e.length > 0 ? e[0] ?? 0 : 0;
    case "mean":
      return i.length > 0 ? i.reduce((a, l) => a + l, 0) / i.length : 0;
    case "min":
      return i.length > 0 ? Math.min(...i) : 0;
    case "max":
      return i.length > 0 ? Math.max(...i) : 0;
    case "sum":
      return i.reduce((a, l) => a + l, 0);
    case "count":
      return i.length;
    default:
      return i.length > 0 ? i[i.length - 1] ?? 0 : 0;
  }
}
function _s(e, t) {
  const n = e.filter((a) => a !== null);
  if (n.length < 2)
    return null;
  const i = n[0];
  return i === 0 ? null : (n[n.length - 1] - i) / i;
}
class pr {
  constructor(t) {
    this.props = t;
  }
}
var ku = /* @__PURE__ */ ((e) => (e.LOCAL_STORAGE = "LOCAL_STORAGE", e.IN_MEMORY = "IN_MEMORY", e))(ku || {}), sl = /* @__PURE__ */ ((e) => (e.Linear = "linear", e.Logarithmic = "logarithmic", e.Symlog = "symlog", e))(sl || {}), Wi = /* @__PURE__ */ ((e) => (e.Lines = "lines", e.Bars = "bars", e.Points = "points", e.Histogram = "histogram", e))(Wi || {}), qs = /* @__PURE__ */ ((e) => (e.Linear = "linear", e.Smooth = "smooth", e.StepBefore = "stepBefore", e.StepAfter = "stepAfter", e))(qs || {}), _u = /* @__PURE__ */ ((e) => (e.Solid = "solid", e.Dashed = "dashed", e.Dotted = "dotted", e))(_u || {}), qo = /* @__PURE__ */ ((e) => (e.None = "none", e.Solid = "solid", e.Gradient = "gradient", e))(qo || {}), Fh = /* @__PURE__ */ ((e) => (e[e.Before = -1] = "Before", e[e.Center = 0] = "Center", e[e.After = 1] = "After", e))(Fh || {});
function qb(e, t, n) {
  if (!n || n.length === 0)
    return 0;
  const i = n.reduce((a, l) => l.length > a.length ? l : a, "");
  return i === "" || !t.font?.[0] ? 0 : (e.ctx.font = t.font[0], e.ctx.measureText(i).width / devicePixelRatio);
}
function Fb(e) {
  return (t, n, i, a) => {
    const l = t.axes[i];
    if (a > 1) {
      const r = l._size;
      if (r !== void 0)
        return r;
    }
    let u = (l.ticks?.size ?? 0) + e;
    return u += qb(t, l, n), Math.ceil(u);
  };
}
class Vb extends pr {
  buildGridConfig() {
    const { grid: t, isDarkMode: n, isLogScale: i } = this.props, a = n ? "#444" : "#E8E9EA", l = i ? 0.1 : 0.2;
    return t ? {
      stroke: t.stroke ?? a,
      width: t.width ?? l,
      show: t.show ?? !0
    } : { stroke: a, width: l, show: !0 };
  }
  buildTicksConfig() {
    const { ticks: t } = this.props;
    return t || { width: 0.3, show: !0 };
  }
  buildXAxisValuesFormatter() {
    if (this.props.isTimeAxis !== !1)
      return (t, n) => n.map((i) => {
        if (i == null || Number.isNaN(i))
          return "";
        const a = new Date(i * 1e3);
        return `${a.getHours().toString().padStart(2, "0")}:${a.getMinutes().toString().padStart(2, "0")}`;
      });
  }
  buildYAxisValuesFormatter() {
    const { yAxisUnit: t, decimalPrecision: n } = this.props;
    return (i, a) => a.map((l) => {
      if (l == null || Number.isNaN(l))
        return "";
      const u = l.toFixed(n ?? 1);
      return t ? `${u} ${t}` : u;
    });
  }
  buildValuesFormatter() {
    const { values: t, scaleKey: n } = this.props;
    if (t)
      return t;
    if (n === "x")
      return this.buildXAxisValuesFormatter();
    if (n === "y")
      return this.buildYAxisValuesFormatter();
  }
  buildSizeCalculator() {
    const { size: t, scaleKey: n } = this.props;
    if (t)
      return t;
    if (n === "y")
      return Fb(this.props.gap ?? 5);
  }
  buildStrokeColor() {
    const { stroke: t, isDarkMode: n } = this.props;
    if (t !== void 0)
      return t;
    if (n !== void 0)
      return n ? "white" : "black";
  }
  getConfig() {
    const {
      scaleKey: t,
      label: n,
      show: i = !0,
      side: a = 2,
      space: l,
      gap: u = 5
    } = this.props, r = this.buildGridConfig(), c = this.buildTicksConfig(), g = this.buildValuesFormatter(), y = this.buildSizeCalculator(), v = this.buildStrokeColor(), m = { scale: t, show: i, side: a };
    n && (m.label = n), v && (m.stroke = v), r && (m.grid = r), c && (m.ticks = c), g && (m.values = g), u !== void 0 && (m.gap = u), l !== void 0 && (m.space = l), y && (m.size = y);
    const { border: S } = this.props;
    return S?.show && (m.border = {
      stroke: S.stroke ?? v ?? "#666666",
      width: S.width ?? 1,
      show: !0
    }), m;
  }
  merge(t) {
    this.props = { ...this.props, ...t };
  }
}
const Wb = "#FFFFFF", Vh = 30, Yb = 1e6, Bb = 3, Hb = {
  focus: { alpha: 0.3 },
  legend: { show: !1 },
  padding: [16, 16, 8, 8],
  series: [],
  hooks: {}
}, Gr = {
  drag: { setScale: !0 },
  points: {
    one: !0,
    size: (e, t) => (e.series[t]?.points?.size ?? 0) * 3,
    width: (e, t, n) => n / 4,
    stroke: (e, t) => {
      const n = e.series[t]?.points, i = typeof n?.stroke == "function" ? n.stroke : void 0;
      return `${i !== void 0 ? i(e, t) : typeof n?.stroke == "string" ? n.stroke : ""}90`;
    },
    fill: () => Wb
  },
  focus: { prox: Yb },
  hover: { prox: Vh, bias: 0 }
};
function jb(e, t, n) {
  return e;
}
function Ub(e) {
  const t = [10, 5];
  function n(l, u, r) {
    const c = l.ctx;
    c.save(), c.lineWidth = 2, c.setLineDash(t);
    const g = c.canvas.height * 0.9;
    for (const y of r) {
      const v = y.thresholdColor ?? "red", m = jb(
        y.thresholdValue,
        y.thresholdUnit,
        e.yAxisUnit
      ), S = l.valToPos(Number(m), u, !0), T = Math.round(l.bbox.left), C = Math.round(S), E = Math.round(l.bbox.left + l.bbox.width);
      if (c.strokeStyle = v, c.beginPath(), c.moveTo(T, C), c.lineTo(E, C), c.stroke(), y.thresholdLabel) {
        const X = c.measureText(y.thresholdLabel).width, F = E - X - 20, N = c.canvas.height - C > g ? C + 15 : C - 15;
        c.fillStyle = v, c.fillText(y.thresholdLabel, F, N);
      }
    }
  }
  const { scaleKey: i, thresholds: a } = e;
  return (l) => {
    const u = l.ctx;
    n(l, i, a), u.restore();
  };
}
function Hc({
  seriesShow: e,
  seriesLabel: t,
  visibleStoredLabels: n,
  hiddenStoredLabels: i,
  hasActivePreference: a
}) {
  const l = !!n?.has(t), u = !!i?.has(t);
  return l ? !0 : u || a ? !1 : e ?? !0;
}
const Wh = "series_visibility_";
function Gb(e) {
  try {
    const t = localStorage.getItem(Wh + e);
    return t ? JSON.parse(t) : null;
  } catch {
    return null;
  }
}
function Kb(e, t) {
  try {
    localStorage.setItem(Wh + e, JSON.stringify(t));
  } catch {
  }
}
function Yh({
  uPlotInstance: e,
  stepInterval: t
}) {
  const n = e.scales.x;
  if (n && typeof n.min == "number") {
    const i = n.min, a = i + t, l = e.valToPos(i, "x"), u = e.valToPos(a, "x");
    return Math.abs(u - l);
  }
  return 0;
}
const Zb = !0, xn = "u-", Qb = "uplot", Xb = xn + "hz", Jb = xn + "vt", e1 = xn + "title", t1 = xn + "wrap", n1 = xn + "under", i1 = xn + "over", a1 = xn + "axis", al = xn + "off", l1 = xn + "select", o1 = xn + "cursor-x", s1 = xn + "cursor-y", r1 = xn + "cursor-pt", u1 = xn + "legend", c1 = xn + "live", d1 = xn + "inline", f1 = xn + "series", h1 = xn + "marker", jc = xn + "label", g1 = xn + "value", Io = "width", Eo = "height", To = "top", Uc = "bottom", $l = "left", Kr = "right", rc = "#000", Gc = rc + "0", Kc = "mousemove", Zc = "mousedown", Zr = "mouseup", Qc = "mouseenter", Xc = "mouseleave", Jc = "dblclick", p1 = "resize", m1 = "scroll", ed = "change", Xs = "dppxchange", uc = "--", oo = typeof window < "u", Cu = oo ? document : null, Gl = oo ? window : null, v1 = oo ? navigator : null;
let kt, Cs;
function Mu() {
  let e = devicePixelRatio;
  kt != e && (kt = e, Cs && zu(ed, Cs, Mu), Cs = matchMedia(`(min-resolution: ${kt - 1e-3}dppx) and (max-resolution: ${kt + 1e-3}dppx)`), rl(ed, Cs, Mu), Gl.dispatchEvent(new CustomEvent(Xs)));
}
function jn(e, t) {
  if (t != null) {
    let n = e.classList;
    !n.contains(t) && n.add(t);
  }
}
function Tu(e, t) {
  let n = e.classList;
  n.contains(t) && n.remove(t);
}
function Vt(e, t, n) {
  e.style[t] = n + "px";
}
function Si(e, t, n, i) {
  let a = Cu.createElement(e);
  return t != null && jn(a, t), n?.insertBefore(a, i), a;
}
function si(e, t) {
  return Si("div", e, t);
}
const td = /* @__PURE__ */ new WeakMap();
function qi(e, t, n, i, a) {
  let l = "translate(" + t + "px," + n + "px)", u = td.get(e);
  l != u && (e.style.transform = l, td.set(e, l), t < 0 || n < 0 || t > i || n > a ? jn(e, al) : Tu(e, al));
}
const nd = /* @__PURE__ */ new WeakMap();
function id(e, t, n) {
  let i = t + n, a = nd.get(e);
  i != a && (nd.set(e, i), e.style.background = t, e.style.borderColor = n);
}
const ad = /* @__PURE__ */ new WeakMap();
function ld(e, t, n, i) {
  let a = t + "" + n, l = ad.get(e);
  a != l && (ad.set(e, a), e.style.height = n + "px", e.style.width = t + "px", e.style.marginLeft = i ? -t / 2 + "px" : 0, e.style.marginTop = i ? -n / 2 + "px" : 0);
}
const cc = { passive: !0 }, y1 = { ...cc, capture: !0 };
function rl(e, t, n, i) {
  t.addEventListener(e, n, i ? y1 : cc);
}
function zu(e, t, n, i) {
  t.removeEventListener(e, n, cc);
}
oo && Mu();
function Ci(e, t, n, i) {
  let a;
  n = n || 0, i = i || t.length - 1;
  let l = i <= 2147483647;
  for (; i - n > 1; )
    a = l ? n + i >> 1 : Xn((n + i) / 2), t[a] < e ? n = a : i = a;
  return e - t[n] <= t[i] - e ? n : i;
}
function Ql(e, t, n, i) {
  for (let a = i == 1 ? t : n; a >= t && a <= n; a += i)
    if (e[a] != null)
      return a;
  return -1;
}
function b1(e, t, n, i) {
  let a = dt, l = -dt;
  if (i == 1)
    a = e[t], l = e[n];
  else if (i == -1)
    a = e[n], l = e[t];
  else
    for (let u = t; u <= n; u++) {
      let r = e[u];
      r != null && (r < a && (a = r), r > l && (l = r));
    }
  return [a, l];
}
function x1(e, t, n) {
  let i = dt, a = -dt;
  for (let l = t; l <= n; l++) {
    let u = e[l];
    u != null && u > 0 && (u < i && (i = u), u > a && (a = u));
  }
  return [i, a];
}
function mr(e, t, n, i) {
  let a = rd(e), l = rd(t);
  e == t && (a == -1 ? (e *= n, t /= n) : (e /= n, t *= n));
  let u = n == 10 ? fa : Bh, r = a == 1 ? Xn : ui, c = l == 1 ? ui : Xn, g = r(u(vn(e))), y = c(u(vn(t))), v = Xl(n, g), m = Xl(n, y);
  return n == 10 && (g < 0 && (v = Rt(v, -g)), y < 0 && (m = Rt(m, -y))), i || n == 2 ? (e = v * a, t = m * l) : (e = Uh(e, v), t = vr(t, m)), [e, t];
}
function dc(e, t, n, i) {
  let a = mr(e, t, n, i);
  return e == 0 && (a[0] = 0), t == 0 && (a[1] = 0), a;
}
const fc = 0.1, od = {
  mode: 3,
  pad: fc
}, Fo = {
  pad: 0,
  soft: null,
  mode: 0
}, w1 = {
  min: Fo,
  max: Fo
};
function Js(e, t, n, i) {
  return yr(n) ? sd(e, t, n) : (Fo.pad = n, Fo.soft = i ? 0 : null, Fo.mode = i ? 3 : 0, sd(e, t, w1));
}
function bt(e, t) {
  return e ?? t;
}
function S1(e, t, n) {
  for (t = bt(t, 0), n = bt(n, e.length - 1); t <= n; ) {
    if (e[t] != null)
      return !0;
    t++;
  }
  return !1;
}
function sd(e, t, n) {
  let i = n.min, a = n.max, l = bt(i.pad, 0), u = bt(a.pad, 0), r = bt(i.hard, -dt), c = bt(a.hard, dt), g = bt(i.soft, dt), y = bt(a.soft, -dt), v = bt(i.mode, 0), m = bt(a.mode, 0), S = t - e, T = fa(S), C = Tn(vn(e), vn(t)), E = fa(C), X = vn(E - T);
  (S < 1e-24 || X > 10) && (S = 0, (e == 0 || t == 0) && (S = 1e-24, v == 2 && g != dt && (l = 0), m == 2 && y != -dt && (u = 0)));
  let F = S || C || 1e3, V = fa(F), N = Xl(10, Xn(V)), Y = F * (S == 0 ? e == 0 ? 0.1 : 1 : l), K = Rt(Uh(e - Y, N / 10), 24), M = e >= g && (v == 1 || v == 3 && K <= g || v == 2 && K >= g) ? g : dt, W = Tn(r, K < M && e >= M ? M : di(M, K)), G = F * (S == 0 ? t == 0 ? 0.1 : 1 : u), Z = Rt(vr(t + G, N / 10), 24), A = t <= y && (m == 1 || m == 3 && Z >= y || m == 2 && Z <= y) ? y : -dt, J = di(c, Z > A && t <= A ? A : Tn(A, Z));
  return W == J && W == 0 && (J = 100), [W, J];
}
const k1 = new Intl.NumberFormat(oo ? v1.language : "en-US"), hc = (e) => k1.format(e), ei = Math, Fs = ei.PI, vn = ei.abs, Xn = ei.floor, mn = ei.round, ui = ei.ceil, di = ei.min, Tn = ei.max, Xl = ei.pow, rd = ei.sign, fa = ei.log10, Bh = ei.log2, _1 = (e, t = 1) => ei.sinh(e) * t, Qr = (e, t = 1) => ei.asinh(e / t), dt = 1 / 0;
function ud(e) {
  return (fa((e ^ e >> 31) - (e >> 31)) | 0) + 1;
}
function Du(e, t, n) {
  return di(Tn(e, t), n);
}
function ct(e) {
  return typeof e == "function" ? e : () => e;
}
const C1 = () => {
}, Hh = (e) => e, jh = (e, t) => t, M1 = (e) => null, cd = (e) => !0, dd = (e, t) => e == t, T1 = /\.\d*?(?=9{6,}|0{6,})/gm, hl = (e) => {
  if (Kh(e) || qa.has(e))
    return e;
  const t = `${e}`, n = t.match(T1);
  if (n == null)
    return e;
  let i = n[0].length - 1;
  if (t.indexOf("e-") != -1) {
    let [a, l] = t.split("e");
    return +`${hl(a)}e${l}`;
  }
  return Rt(e, i);
};
function tl(e, t) {
  return hl(Rt(hl(e / t)) * t);
}
function vr(e, t) {
  return hl(ui(hl(e / t)) * t);
}
function Uh(e, t) {
  return hl(Xn(hl(e / t)) * t);
}
function Rt(e, t = 0) {
  if (Kh(e))
    return e;
  let n = 10 ** t, i = e * n * (1 + Number.EPSILON);
  return mn(i) / n;
}
const qa = /* @__PURE__ */ new Map();
function Gh(e) {
  return (("" + e).split(".")[1] || "").length;
}
function Qo(e, t, n, i) {
  let a = [], l = i.map(Gh);
  for (let u = t; u < n; u++) {
    let r = vn(u), c = Rt(Xl(e, u), r);
    for (let g = 0; g < i.length; g++) {
      let y = e == 10 ? +`${i[g]}e${u}` : i[g] * c, v = (u >= 0 ? 0 : r) + (u >= l[g] ? 0 : l[g]), m = e == 10 ? y : Rt(y, v);
      a.push(m), qa.set(m, v);
    }
  }
  return a;
}
const Vo = {}, gc = [], Jl = [null, null], Ia = Array.isArray, Kh = Number.isInteger, z1 = (e) => e === void 0;
function fd(e) {
  return typeof e == "string";
}
function yr(e) {
  let t = !1;
  if (e != null) {
    let n = e.constructor;
    t = n == null || n == Object;
  }
  return t;
}
function D1(e) {
  return e != null && typeof e == "object";
}
const O1 = Object.getPrototypeOf(Uint8Array), Zh = "__proto__";
function eo(e, t = yr) {
  let n;
  if (Ia(e)) {
    let i = e.find((a) => a != null);
    if (Ia(i) || t(i)) {
      n = Array(e.length);
      for (let a = 0; a < e.length; a++)
        n[a] = eo(e[a], t);
    } else
      n = e.slice();
  } else if (e instanceof O1)
    n = e.slice();
  else if (t(e)) {
    n = {};
    for (let i in e)
      i != Zh && (n[i] = eo(e[i], t));
  } else
    n = e;
  return n;
}
function cn(e) {
  let t = arguments;
  for (let n = 1; n < t.length; n++) {
    let i = t[n];
    for (let a in i)
      a != Zh && (yr(e[a]) ? cn(e[a], eo(i[a])) : e[a] = eo(i[a]));
  }
  return e;
}
const P1 = 0, I1 = 1, E1 = 2;
function $1(e, t, n) {
  for (let i = 0, a, l = -1; i < t.length; i++) {
    let u = t[i];
    if (u > l) {
      for (a = u - 1; a >= 0 && e[a] == null; )
        e[a--] = null;
      for (a = u + 1; a < n && e[a] == null; )
        e[l = a++] = null;
    }
  }
}
function A1(e, t) {
  if (L1(e)) {
    let u = e[0].slice();
    for (let r = 1; r < e.length; r++)
      u.push(...e[r].slice(1));
    return q1(u[0]) || (u = R1(u)), u;
  }
  let n = /* @__PURE__ */ new Set();
  for (let u = 0; u < e.length; u++) {
    let c = e[u][0], g = c.length;
    for (let y = 0; y < g; y++)
      n.add(c[y]);
  }
  let i = [Array.from(n).sort((u, r) => u - r)], a = i[0].length, l = /* @__PURE__ */ new Map();
  for (let u = 0; u < a; u++)
    l.set(i[0][u], u);
  for (let u = 0; u < e.length; u++) {
    let r = e[u], c = r[0];
    for (let g = 1; g < r.length; g++) {
      let y = r[g], v = Array(a).fill(void 0), m = t ? t[u][g] : I1, S = [];
      for (let T = 0; T < y.length; T++) {
        let C = y[T], E = l.get(c[T]);
        C === null ? m != P1 && (v[E] = C, m == E1 && S.push(E)) : v[E] = C;
      }
      $1(v, S, a), i.push(v);
    }
  }
  return i;
}
const N1 = typeof queueMicrotask > "u" ? (e) => Promise.resolve().then(e) : queueMicrotask;
function R1(e) {
  let t = e[0], n = t.length, i = Array(n);
  for (let l = 0; l < i.length; l++)
    i[l] = l;
  i.sort((l, u) => t[l] - t[u]);
  let a = [];
  for (let l = 0; l < e.length; l++) {
    let u = e[l], r = Array(n);
    for (let c = 0; c < n; c++)
      r[c] = u[i[c]];
    a.push(r);
  }
  return a;
}
function L1(e) {
  let t = e[0][0], n = t.length;
  for (let i = 1; i < e.length; i++) {
    let a = e[i][0];
    if (a.length != n)
      return !1;
    if (a != t) {
      for (let l = 0; l < n; l++)
        if (a[l] != t[l])
          return !1;
    }
  }
  return !0;
}
function q1(e, t = 100) {
  const n = e.length;
  if (n <= 1)
    return !0;
  let i = 0, a = n - 1;
  for (; i <= a && e[i] == null; )
    i++;
  for (; a >= i && e[a] == null; )
    a--;
  if (a <= i)
    return !0;
  const l = Tn(1, Xn((a - i + 1) / t));
  for (let u = e[i], r = i + l; r <= a; r += l) {
    const c = e[r];
    if (c != null) {
      if (c <= u)
        return !1;
      u = c;
    }
  }
  return !0;
}
const Qh = [
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December"
], Xh = [
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
];
function Jh(e) {
  return e.slice(0, 3);
}
const F1 = Xh.map(Jh), V1 = Qh.map(Jh), W1 = {
  MMMM: Qh,
  MMM: V1,
  WWWW: Xh,
  WWW: F1
};
function zo(e) {
  return (e < 10 ? "0" : "") + e;
}
function Y1(e) {
  return (e < 10 ? "00" : e < 100 ? "0" : "") + e;
}
const B1 = {
  // 2019
  YYYY: (e) => e.getFullYear(),
  // 19
  YY: (e) => (e.getFullYear() + "").slice(2),
  // July
  MMMM: (e, t) => t.MMMM[e.getMonth()],
  // Jul
  MMM: (e, t) => t.MMM[e.getMonth()],
  // 07
  MM: (e) => zo(e.getMonth() + 1),
  // 7
  M: (e) => e.getMonth() + 1,
  // 09
  DD: (e) => zo(e.getDate()),
  // 9
  D: (e) => e.getDate(),
  // Monday
  WWWW: (e, t) => t.WWWW[e.getDay()],
  // Mon
  WWW: (e, t) => t.WWW[e.getDay()],
  // 03
  HH: (e) => zo(e.getHours()),
  // 3
  H: (e) => e.getHours(),
  // 9 (12hr, unpadded)
  h: (e) => {
    let t = e.getHours();
    return t == 0 ? 12 : t > 12 ? t - 12 : t;
  },
  // AM
  AA: (e) => e.getHours() >= 12 ? "PM" : "AM",
  // am
  aa: (e) => e.getHours() >= 12 ? "pm" : "am",
  // a
  a: (e) => e.getHours() >= 12 ? "p" : "a",
  // 09
  mm: (e) => zo(e.getMinutes()),
  // 9
  m: (e) => e.getMinutes(),
  // 09
  ss: (e) => zo(e.getSeconds()),
  // 9
  s: (e) => e.getSeconds(),
  // 374
  fff: (e) => Y1(e.getMilliseconds())
};
function pc(e, t) {
  t = t || W1;
  let n = [], i = /\{([a-z]+)\}|[^{]+/gi, a;
  for (; a = i.exec(e); )
    n.push(a[0][0] == "{" ? B1[a[1]] : a[0]);
  return (l) => {
    let u = "";
    for (let r = 0; r < n.length; r++)
      u += typeof n[r] == "string" ? n[r] : n[r](l, t);
    return u;
  };
}
const H1 = new Intl.DateTimeFormat().resolvedOptions().timeZone;
function j1(e, t) {
  let n;
  return t == "UTC" || t == "Etc/UTC" ? n = new Date(+e + e.getTimezoneOffset() * 6e4) : t == H1 ? n = e : (n = new Date(e.toLocaleString("en-US", { timeZone: t })), n.setMilliseconds(e.getMilliseconds())), n;
}
const eg = (e) => e % 1 == 0, er = [1, 2, 2.5, 5], U1 = Qo(10, -32, 0, er), tg = Qo(10, 0, 32, er), G1 = tg.filter(eg), nl = U1.concat(tg), mc = `
`, ng = "{YYYY}", hd = mc + ng, ig = "{M}/{D}", $o = mc + ig, Ms = $o + "/{YY}", ag = "{aa}", K1 = "{h}:{mm}", Fl = K1 + ag, gd = mc + Fl, pd = ":{ss}", _t = null;
function lg(e) {
  let t = e * 1e3, n = t * 60, i = n * 60, a = i * 24, l = a * 30, u = a * 365, c = (e == 1 ? Qo(10, 0, 3, er).filter(eg) : Qo(10, -3, 0, er)).concat([
    // minute divisors (# of secs)
    t,
    t * 5,
    t * 10,
    t * 15,
    t * 30,
    // hour divisors (# of mins)
    n,
    n * 5,
    n * 10,
    n * 15,
    n * 30,
    // day divisors (# of hrs)
    i,
    i * 2,
    i * 3,
    i * 4,
    i * 6,
    i * 8,
    i * 12,
    // month divisors TODO: need more?
    a,
    a * 2,
    a * 3,
    a * 4,
    a * 5,
    a * 6,
    a * 7,
    a * 8,
    a * 9,
    a * 10,
    a * 15,
    // year divisors (# months, approx)
    l,
    l * 2,
    l * 3,
    l * 4,
    l * 6,
    // century divisors
    u,
    u * 2,
    u * 5,
    u * 10,
    u * 25,
    u * 50,
    u * 100
  ]);
  const g = [
    //   tick incr    default          year                    month   day                   hour    min       sec   mode
    [u, ng, _t, _t, _t, _t, _t, _t, 1],
    [a * 28, "{MMM}", hd, _t, _t, _t, _t, _t, 1],
    [a, ig, hd, _t, _t, _t, _t, _t, 1],
    [i, "{h}" + ag, Ms, _t, $o, _t, _t, _t, 1],
    [n, Fl, Ms, _t, $o, _t, _t, _t, 1],
    [t, pd, Ms + " " + Fl, _t, $o + " " + Fl, _t, gd, _t, 1],
    [e, pd + ".{fff}", Ms + " " + Fl, _t, $o + " " + Fl, _t, gd, _t, 1]
  ];
  function y(v) {
    return (m, S, T, C, E, X) => {
      let F = [], V = E >= u, N = E >= l && E < u, Y = v(T), K = Rt(Y * e, 3), M = Xr(Y.getFullYear(), V ? 0 : Y.getMonth(), N || V ? 1 : Y.getDate()), W = Rt(M * e, 3);
      if (N || V) {
        let G = N ? E / l : 0, Z = V ? E / u : 0, A = K == W ? K : Rt(Xr(M.getFullYear() + Z, M.getMonth() + G, 1) * e, 3), J = new Date(mn(A / e)), ee = J.getFullYear(), I = J.getMonth();
        for (let $ = 0; A <= C; $++) {
          let le = Xr(ee + Z * $, I + G * $, 1), ie = le - v(Rt(le * e, 3));
          A = Rt((+le + ie) * e, 3), A <= C && F.push(A);
        }
      } else {
        let G = E >= a ? a : E, Z = Xn(T) - Xn(K), A = W + Z + vr(K - W, G);
        F.push(A);
        let J = v(A), ee = J.getHours() + J.getMinutes() / n + J.getSeconds() / i, I = E / i, $ = m.axes[S]._space, le = X / $;
        for (; A = Rt(A + E, e == 1 ? 0 : 3), !(A > C); )
          if (I > 1) {
            let ie = Xn(Rt(ee + I, 6)) % 24, he = v(A).getHours() - ie;
            he > 1 && (he = -1), A -= he * i, ee = (ee + I) % 24;
            let ae = F[F.length - 1];
            Rt((A - ae) / E, 3) * le >= 0.7 && F.push(A);
          } else
            F.push(A);
      }
      return F;
    };
  }
  return [
    c,
    g,
    y
  ];
}
const [Z1, Q1, X1] = lg(1), [J1, ex, tx] = lg(1e-3);
Qo(2, -53, 53, [1]);
function md(e, t) {
  return e.map((n) => n.map(
    (i, a) => a == 0 || a == 8 || i == null ? i : t(a == 1 || n[8] == 0 ? i : n[1] + i)
  ));
}
function vd(e, t) {
  return (n, i, a, l, u) => {
    let r = t.find((T) => u >= T[0]) || t[t.length - 1], c, g, y, v, m, S;
    return i.map((T) => {
      let C = e(T), E = C.getFullYear(), X = C.getMonth(), F = C.getDate(), V = C.getHours(), N = C.getMinutes(), Y = C.getSeconds(), K = E != c && r[2] || X != g && r[3] || F != y && r[4] || V != v && r[5] || N != m && r[6] || Y != S && r[7] || r[1];
      return c = E, g = X, y = F, v = V, m = N, S = Y, K(C);
    });
  };
}
function nx(e, t) {
  let n = pc(t);
  return (i, a, l, u, r) => a.map((c) => n(e(c)));
}
function Xr(e, t, n) {
  return new Date(e, t, n);
}
function yd(e, t) {
  return t(e);
}
const ix = "{YYYY}-{MM}-{DD} {h}:{mm}{aa}";
function bd(e, t) {
  return (n, i, a, l) => l == null ? uc : t(e(i));
}
function ax(e, t) {
  let n = e.series[t];
  return n.width ? n.stroke(e, t) : n.points.width ? n.points.stroke(e, t) : null;
}
function lx(e, t) {
  return e.series[t].fill(e, t);
}
const ox = {
  show: !0,
  live: !0,
  isolate: !1,
  mount: C1,
  markers: {
    show: !0,
    width: 2,
    stroke: ax,
    fill: lx,
    dash: "solid"
  },
  idx: null,
  idxs: null,
  values: []
};
function sx(e, t) {
  let n = e.cursor.points, i = si(), a = n.size(e, t);
  Vt(i, Io, a), Vt(i, Eo, a);
  let l = a / -2;
  Vt(i, "marginLeft", l), Vt(i, "marginTop", l);
  let u = n.width(e, t, a);
  return u && Vt(i, "borderWidth", u), i;
}
function rx(e, t) {
  let n = e.series[t].points;
  return n._fill || n._stroke;
}
function ux(e, t) {
  let n = e.series[t].points;
  return n._stroke || n._fill;
}
function cx(e, t) {
  return e.series[t].points.size;
}
const Jr = [0, 0];
function dx(e, t, n) {
  return Jr[0] = t, Jr[1] = n, Jr;
}
function Ts(e, t, n, i = !0) {
  return (a) => {
    a.button == 0 && (!i || a.target == t) && n(a);
  };
}
function eu(e, t, n, i = !0) {
  return (a) => {
    (!i || a.target == t) && n(a);
  };
}
const fx = {
  show: !0,
  x: !0,
  y: !0,
  lock: !1,
  move: dx,
  points: {
    one: !1,
    show: sx,
    size: cx,
    width: 0,
    stroke: ux,
    fill: rx
  },
  bind: {
    mousedown: Ts,
    mouseup: Ts,
    click: Ts,
    // legend clicks, not .u-over clicks
    dblclick: Ts,
    mousemove: eu,
    mouseleave: eu,
    mouseenter: eu
  },
  drag: {
    setScale: !0,
    x: !0,
    y: !1,
    dist: 0,
    uni: null,
    click: (e, t) => {
      t.stopPropagation(), t.stopImmediatePropagation();
    },
    _x: !1,
    _y: !1
  },
  focus: {
    dist: (e, t, n, i, a) => i - a,
    prox: -1,
    bias: 0
  },
  hover: {
    skip: [void 0],
    prox: null,
    bias: 0
  },
  left: -10,
  top: -10,
  idx: null,
  dataIdx: null,
  idxs: null,
  event: null
}, og = {
  show: !0,
  stroke: "rgba(0,0,0,0.07)",
  width: 2
  //	dash: [],
}, vc = cn({}, og, {
  filter: jh
}), sg = cn({}, vc, {
  size: 10
}), rg = cn({}, og, {
  show: !1
}), yc = '12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"', ug = "bold " + yc, cg = 1.5, xd = {
  show: !0,
  scale: "x",
  stroke: rc,
  space: 50,
  gap: 5,
  size: 50,
  labelGap: 0,
  labelSize: 30,
  labelFont: ug,
  side: 2,
  //	class: "x-vals",
  //	incrs: timeIncrs,
  //	values: timeVals,
  //	filter: retArg1,
  grid: vc,
  ticks: sg,
  border: rg,
  font: yc,
  lineGap: cg,
  rotate: 0
}, hx = "Value", gx = "Time", wd = {
  show: !0,
  scale: "x",
  auto: !1,
  sorted: 1,
  //	label: "Time",
  //	value: v => stamp(new Date(v * 1e3)),
  // internal caches
  min: dt,
  max: -dt,
  idxs: []
};
function px(e, t, n, i, a) {
  return t.map((l) => l == null ? "" : hc(l));
}
function mx(e, t, n, i, a, l, u) {
  let r = [], c = qa.get(a) || 0;
  n = u ? n : Rt(vr(n, a), c);
  for (let g = n; g <= i; g = Rt(g + a, c))
    r.push(Object.is(g, -0) ? 0 : g);
  return r;
}
function Ou(e, t, n, i, a, l, u) {
  const r = [], c = e.scales[e.axes[t].scale].log, g = c == 10 ? fa : Bh, y = Xn(g(n));
  a = Xl(c, y), c == 10 && (a = nl[Ci(a, nl)]);
  let v = n, m = a * c;
  c == 10 && (m = nl[Ci(m, nl)]);
  do
    r.push(v), v = v + a, c == 10 && !qa.has(v) && (v = Rt(v, qa.get(a))), v >= m && (a = v, m = a * c, c == 10 && (m = nl[Ci(m, nl)]));
  while (v <= i);
  return r;
}
function vx(e, t, n, i, a, l, u) {
  let c = e.scales[e.axes[t].scale].asinh, g = i > c ? Ou(e, t, Tn(c, n), i, a) : [c], y = i >= 0 && n <= 0 ? [0] : [];
  return (n < -c ? Ou(e, t, Tn(c, -i), -n, a) : [c]).reverse().map((m) => -m).concat(y, g);
}
const dg = /./, yx = /[12357]/, bx = /[125]/, Sd = /1/, Pu = (e, t, n, i) => e.map((a, l) => t == 4 && a == 0 || l % i == 0 && n.test(a.toExponential()[a < 0 ? 1 : 0]) ? a : null);
function xx(e, t, n, i, a) {
  let l = e.axes[n], u = l.scale, r = e.scales[u], c = e.valToPos, g = l._space, y = c(10, u), v = c(9, u) - y >= g ? dg : c(7, u) - y >= g ? yx : c(5, u) - y >= g ? bx : Sd;
  if (v == Sd) {
    let m = vn(c(1, u) - y);
    if (m < g)
      return Pu(t.slice().reverse(), r.distr, v, ui(g / m)).reverse();
  }
  return Pu(t, r.distr, v, 1);
}
function wx(e, t, n, i, a) {
  let l = e.axes[n], u = l.scale, r = l._space, c = e.valToPos, g = vn(c(1, u) - c(2, u));
  return g < r ? Pu(t.slice().reverse(), 3, dg, ui(r / g)).reverse() : t;
}
function Sx(e, t, n, i) {
  return i == null ? uc : t == null ? "" : hc(t);
}
const kd = {
  show: !0,
  scale: "y",
  stroke: rc,
  space: 30,
  gap: 5,
  size: 50,
  labelGap: 0,
  labelSize: 30,
  labelFont: ug,
  side: 3,
  //	class: "y-vals",
  //	incrs: numIncrs,
  //	values: (vals, space) => vals,
  //	filter: retArg1,
  grid: vc,
  ticks: sg,
  border: rg,
  font: yc,
  lineGap: cg,
  rotate: 0
};
function kx(e, t) {
  let n = 3 + (e || 1) * 2;
  return Rt(n * t, 3);
}
function _x(e, t) {
  let { scale: n, idxs: i } = e.series[0], a = e._data[0], l = e.valToPos(a[i[0]], n, !0), u = e.valToPos(a[i[1]], n, !0), r = vn(u - l), c = e.series[t], g = r / (c.points.space * kt);
  return i[1] - i[0] <= g;
}
const _d = {
  scale: null,
  auto: !0,
  sorted: 0,
  // internal caches
  min: dt,
  max: -dt
}, fg = (e, t, n, i, a) => a, Cd = {
  show: !0,
  auto: !0,
  sorted: 0,
  gaps: fg,
  alpha: 1,
  facets: [
    cn({}, _d, { scale: "x" }),
    cn({}, _d, { scale: "y" })
  ]
}, Md = {
  scale: "y",
  auto: !0,
  sorted: 0,
  show: !0,
  spanGaps: !1,
  gaps: fg,
  alpha: 1,
  points: {
    show: _x,
    filter: null
    //  paths:
    //	stroke: "#000",
    //	fill: "#fff",
    //	width: 1,
    //	size: 10,
  },
  //	label: "Value",
  //	value: v => v,
  values: null,
  // internal caches
  min: dt,
  max: -dt,
  idxs: [],
  path: null,
  clip: null
};
function Cx(e, t, n, i, a) {
  return n / 10;
}
const hg = {
  time: Zb,
  auto: !0,
  distr: 1,
  log: 10,
  asinh: 1,
  min: null,
  max: null,
  dir: 1,
  ori: 0
}, Mx = cn({}, hg, {
  time: !1,
  ori: 1
}), Td = {};
function gg(e, t) {
  let n = Td[e];
  return n || (n = {
    key: e,
    plots: [],
    sub(i) {
      n.plots.push(i);
    },
    unsub(i) {
      n.plots = n.plots.filter((a) => a != i);
    },
    pub(i, a, l, u, r, c, g) {
      for (let y = 0; y < n.plots.length; y++)
        n.plots[y] != a && n.plots[y].pub(i, a, l, u, r, c, g);
    }
  }, e != null && (Td[e] = n)), n;
}
const to = 1, Iu = 2;
function vl(e, t, n) {
  const i = e.mode, a = e.series[t], l = i == 2 ? e._data[t] : e._data, u = e.scales, r = e.bbox;
  let c = l[0], g = i == 2 ? l[1] : l[t], y = i == 2 ? u[a.facets[0].scale] : u[e.series[0].scale], v = i == 2 ? u[a.facets[1].scale] : u[a.scale], m = r.left, S = r.top, T = r.width, C = r.height, E = e.valToPosH, X = e.valToPosV;
  return y.ori == 0 ? n(
    a,
    c,
    g,
    y,
    v,
    E,
    X,
    m,
    S,
    T,
    C,
    xr,
    so,
    Sr,
    mg,
    yg
  ) : n(
    a,
    c,
    g,
    y,
    v,
    X,
    E,
    S,
    m,
    C,
    T,
    wr,
    ro,
    wc,
    vg,
    bg
  );
}
function bc(e, t) {
  let n = 0, i = 0, a = bt(e.bands, gc);
  for (let l = 0; l < a.length; l++) {
    let u = a[l];
    u.series[0] == t ? n = u.dir : u.series[1] == t && (u.dir == 1 ? i |= 1 : i |= 2);
  }
  return [
    n,
    i == 1 ? -1 : (
      // neg only
      i == 2 ? 1 : (
        // pos only
        i == 3 ? 2 : (
          // both
          0
        )
      )
    )
  ];
}
function Tx(e, t, n, i, a) {
  let l = e.mode, u = e.series[t], r = l == 2 ? u.facets[1].scale : u.scale, c = e.scales[r];
  return a == -1 ? c.min : a == 1 ? c.max : c.distr == 3 ? c.dir == 1 ? c.min : c.max : 0;
}
function ha(e, t, n, i, a, l) {
  return vl(e, t, (u, r, c, g, y, v, m, S, T, C, E) => {
    let X = u.pxRound;
    const F = g.dir * (g.ori == 0 ? 1 : -1), V = g.ori == 0 ? so : ro;
    let N, Y;
    F == 1 ? (N = n, Y = i) : (N = i, Y = n);
    let K = X(v(r[N], g, C, S)), M = X(m(c[N], y, E, T)), W = X(v(r[Y], g, C, S)), G = X(m(l == 1 ? y.max : y.min, y, E, T)), Z = new Path2D(a);
    return V(Z, W, G), V(Z, K, G), V(Z, K, M), Z;
  });
}
function br(e, t, n, i, a, l) {
  let u = null;
  if (e.length > 0) {
    u = new Path2D();
    const r = t == 0 ? Sr : wc;
    let c = n;
    for (let v = 0; v < e.length; v++) {
      let m = e[v];
      if (m[1] > m[0]) {
        let S = m[0] - c;
        S > 0 && r(u, c, i, S, i + l), c = m[1];
      }
    }
    let g = n + a - c, y = 10;
    g > 0 && r(u, c, i - y / 2, g, i + l + y);
  }
  return u;
}
function zx(e, t, n) {
  let i = e[e.length - 1];
  i && i[0] == t ? i[1] = n : e.push([t, n]);
}
function xc(e, t, n, i, a, l, u) {
  let r = [], c = e.length;
  for (let g = a == 1 ? n : i; g >= n && g <= i; g += a)
    if (t[g] === null) {
      let v = g, m = g;
      if (a == 1)
        for (; ++g <= i && t[g] === null; )
          m = g;
      else
        for (; --g >= n && t[g] === null; )
          m = g;
      let S = l(e[v]), T = m == v ? S : l(e[m]), C = v - a;
      S = u <= 0 && C >= 0 && C < c ? l(e[C]) : S;
      let X = m + a;
      T = u >= 0 && X >= 0 && X < c ? l(e[X]) : T, T >= S && r.push([S, T]);
    }
  return r;
}
function zd(e) {
  return e == 0 ? Hh : e == 1 ? mn : (t) => tl(t, e);
}
function pg(e) {
  let t = e == 0 ? xr : wr, n = e == 0 ? (a, l, u, r, c, g) => {
    a.arcTo(l, u, r, c, g);
  } : (a, l, u, r, c, g) => {
    a.arcTo(u, l, c, r, g);
  }, i = e == 0 ? (a, l, u, r, c) => {
    a.rect(l, u, r, c);
  } : (a, l, u, r, c) => {
    a.rect(u, l, c, r);
  };
  return (a, l, u, r, c, g = 0, y = 0) => {
    g == 0 && y == 0 ? i(a, l, u, r, c) : (g = di(g, r / 2, c / 2), y = di(y, r / 2, c / 2), t(a, l + g, u), n(a, l + r, u, l + r, u + c, g), n(a, l + r, u + c, l, u + c, y), n(a, l, u + c, l, u, y), n(a, l, u, l + r, u, g), a.closePath());
  };
}
const xr = (e, t, n) => {
  e.moveTo(t, n);
}, wr = (e, t, n) => {
  e.moveTo(n, t);
}, so = (e, t, n) => {
  e.lineTo(t, n);
}, ro = (e, t, n) => {
  e.lineTo(n, t);
}, Sr = pg(0), wc = pg(1), mg = (e, t, n, i, a, l) => {
  e.arc(t, n, i, a, l);
}, vg = (e, t, n, i, a, l) => {
  e.arc(n, t, i, a, l);
}, yg = (e, t, n, i, a, l, u) => {
  e.bezierCurveTo(t, n, i, a, l, u);
}, bg = (e, t, n, i, a, l, u) => {
  e.bezierCurveTo(n, t, a, i, u, l);
};
function xg(e) {
  return (t, n, i, a, l) => vl(t, n, (u, r, c, g, y, v, m, S, T, C, E) => {
    let { pxRound: X, points: F } = u, V, N;
    g.ori == 0 ? (V = xr, N = mg) : (V = wr, N = vg);
    const Y = Rt(F.width * kt, 3);
    let K = (F.size - F.width) / 2 * kt, M = Rt(K * 2, 3), W = new Path2D(), G = new Path2D(), { left: Z, top: A, width: J, height: ee } = t.bbox;
    Sr(
      G,
      Z - M,
      A - M,
      J + M * 2,
      ee + M * 2
    );
    const I = ($) => {
      if (c[$] != null) {
        let le = X(v(r[$], g, C, S)), ie = X(m(c[$], y, E, T));
        V(W, le + K, ie), N(W, le, ie, K, 0, Fs * 2);
      }
    };
    if (l)
      l.forEach(I);
    else
      for (let $ = i; $ <= a; $++)
        I($);
    return {
      stroke: Y > 0 ? W : null,
      fill: W,
      clip: G,
      flags: to | Iu
    };
  });
}
function wg(e) {
  return (t, n, i, a, l, u) => {
    i != a && (l != i && u != i && e(t, n, i), l != a && u != a && e(t, n, a), e(t, n, u));
  };
}
const Dx = wg(so), Ox = wg(ro);
function Sg(e) {
  const t = bt(e?.alignGaps, 0);
  return (n, i, a, l) => vl(n, i, (u, r, c, g, y, v, m, S, T, C, E) => {
    let X = u.pxRound, F = (ve) => X(v(ve, g, C, S)), V = (ve) => X(m(ve, y, E, T)), N, Y;
    g.ori == 0 ? (N = so, Y = Dx) : (N = ro, Y = Ox);
    const K = g.dir * (g.ori == 0 ? 1 : -1), M = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null, flags: to }, W = M.stroke;
    let G = dt, Z = -dt, A, J, ee, I = F(r[K == 1 ? a : l]), $ = Ql(c, a, l, 1 * K), le = Ql(c, a, l, -1 * K), ie = F(r[$]), ye = F(r[le]), fe = !1;
    for (let ve = K == 1 ? a : l; ve >= a && ve <= l; ve += K) {
      let Ne = F(r[ve]), we = c[ve];
      Ne == I ? we != null ? (J = V(we), G == dt && (N(W, Ne, J), A = J), G = di(J, G), Z = Tn(J, Z)) : we === null && (fe = !0) : (G != dt && (Y(W, I, G, Z, A, J), ee = I), we != null ? (J = V(we), N(W, Ne, J), G = Z = A = J) : (G = dt, Z = -dt, we === null && (fe = !0)), I = Ne);
    }
    G != dt && G != Z && ee != I && Y(W, I, G, Z, A, J);
    let [he, ae] = bc(n, i);
    if (u.fill != null || he != 0) {
      let ve = M.fill = new Path2D(W), Ne = u.fillTo(n, i, u.min, u.max, he), we = V(Ne);
      N(ve, ye, we), N(ve, ie, we);
    }
    if (!u.spanGaps) {
      let ve = [];
      fe && ve.push(...xc(r, c, a, l, K, F, t)), M.gaps = ve = u.gaps(n, i, a, l, ve), M.clip = br(ve, g.ori, S, T, C, E);
    }
    return ae != 0 && (M.band = ae == 2 ? [
      ha(n, i, a, l, W, -1),
      ha(n, i, a, l, W, 1)
    ] : ha(n, i, a, l, W, ae)), M;
  });
}
function Px(e) {
  const t = bt(e.align, 1), n = bt(e.ascDesc, !1), i = bt(e.alignGaps, 0), a = bt(e.extend, !1);
  return (l, u, r, c) => vl(l, u, (g, y, v, m, S, T, C, E, X, F, V) => {
    let N = g.pxRound, { left: Y, width: K } = l.bbox, M = (he) => N(T(he, m, F, E)), W = (he) => N(C(he, S, V, X)), G = m.ori == 0 ? so : ro;
    const Z = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null, flags: to }, A = Z.stroke, J = m.dir * (m.ori == 0 ? 1 : -1);
    r = Ql(v, r, c, 1), c = Ql(v, r, c, -1);
    let ee = W(v[J == 1 ? r : c]), I = M(y[J == 1 ? r : c]), $ = I, le = I;
    a && t == -1 && (le = Y, G(A, le, ee)), G(A, I, ee);
    for (let he = J == 1 ? r : c; he >= r && he <= c; he += J) {
      let ae = v[he];
      if (ae == null)
        continue;
      let ve = M(y[he]), Ne = W(ae);
      t == 1 ? G(A, ve, ee) : G(A, $, Ne), G(A, ve, Ne), ee = Ne, $ = ve;
    }
    let ie = $;
    a && t == 1 && (ie = Y + K, G(A, ie, ee));
    let [ye, fe] = bc(l, u);
    if (g.fill != null || ye != 0) {
      let he = Z.fill = new Path2D(A), ae = g.fillTo(l, u, g.min, g.max, ye), ve = W(ae);
      G(he, ie, ve), G(he, le, ve);
    }
    if (!g.spanGaps) {
      let he = [];
      he.push(...xc(y, v, r, c, J, M, i));
      let ae = g.width * kt / 2, ve = n || t == 1 ? ae : -ae, Ne = n || t == -1 ? -ae : ae;
      he.forEach((we) => {
        we[0] += ve, we[1] += Ne;
      }), Z.gaps = he = g.gaps(l, u, r, c, he), Z.clip = br(he, m.ori, E, X, F, V);
    }
    return fe != 0 && (Z.band = fe == 2 ? [
      ha(l, u, r, c, A, -1),
      ha(l, u, r, c, A, 1)
    ] : ha(l, u, r, c, A, fe)), Z;
  });
}
function Dd(e, t, n, i, a, l, u = dt) {
  if (e.length > 1) {
    let r = null;
    for (let c = 0, g = 1 / 0; c < e.length; c++)
      if (t[c] !== void 0) {
        if (r != null) {
          let y = vn(e[c] - e[r]);
          y < g && (g = y, u = vn(n(e[c], i, a, l) - n(e[r], i, a, l)));
        }
        r = c;
      }
  }
  return u;
}
function Ix(e) {
  e = e || Vo;
  const t = bt(e.size, [0.6, dt, 1]), n = e.align || 0, i = e.gap || 0;
  let a = e.radius;
  a = // [valueRadius, baselineRadius]
  a == null ? [0, 0] : typeof a == "number" ? [a, 0] : a;
  const l = ct(a), u = 1 - t[0], r = bt(t[1], dt), c = bt(t[2], 1), g = bt(e.disp, Vo), y = bt(e.each, (S) => {
  }), { fill: v, stroke: m } = g;
  return (S, T, C, E) => vl(S, T, (X, F, V, N, Y, K, M, W, G, Z, A) => {
    let J = X.pxRound, ee = n, I = i * kt, $ = r * kt, le = c * kt, ie, ye;
    N.ori == 0 ? [ie, ye] = l(S, T) : [ye, ie] = l(S, T);
    const fe = N.dir * (N.ori == 0 ? 1 : -1);
    let he = N.ori == 0 ? Sr : wc, ae = N.ori == 0 ? y : (Te, Ke, yt, Qe, Fe, at, rt) => {
      y(Te, Ke, yt, Fe, Qe, rt, at);
    }, ve = bt(S.bands, gc).find((Te) => Te.series[0] == T), Ne = ve != null ? ve.dir : 0, we = X.fillTo(S, T, X.min, X.max, Ne), Me = J(M(we, Y, A, G)), ue, se, Pe, xe = Z, qe = J(X.width * kt), nt = !1, Ze = null, Ct = null, Bt = null, mt = null;
    v != null && (qe == 0 || m != null) && (nt = !0, Ze = v.values(S, T, C, E), Ct = /* @__PURE__ */ new Map(), new Set(Ze).forEach((Te) => {
      Te != null && Ct.set(Te, new Path2D());
    }), qe > 0 && (Bt = m.values(S, T, C, E), mt = /* @__PURE__ */ new Map(), new Set(Bt).forEach((Te) => {
      Te != null && mt.set(Te, new Path2D());
    })));
    let { x0: It, size: vt } = g;
    if (It != null && vt != null) {
      ee = 1, F = It.values(S, T, C, E), It.unit == 2 && (F = F.map((yt) => S.posToVal(W + yt * Z, N.key, !0)));
      let Te = vt.values(S, T, C, E);
      vt.unit == 2 ? se = Te[0] * Z : se = K(Te[0], N, Z, W) - K(0, N, Z, W), xe = Dd(F, V, K, N, Z, W, xe), Pe = xe - se + I;
    } else
      xe = Dd(F, V, K, N, Z, W, xe), Pe = xe * u + I, se = xe - Pe;
    Pe < 1 && (Pe = 0), qe >= se / 2 && (qe = 0), Pe < 5 && (J = Hh);
    let Ht = Pe > 0, pi = xe - Pe - (Ht ? qe : 0);
    se = J(Du(pi, le, $)), ue = (ee == 0 ? se / 2 : ee == fe ? 0 : se) - ee * fe * ((ee == 0 ? I / 2 : 0) + (Ht ? qe / 2 : 0));
    const ln = { stroke: null, fill: null, clip: null, band: null, gaps: null, flags: 0 }, wn = nt ? null : new Path2D();
    let He = null;
    if (ve != null)
      He = S.data[ve.series[1]];
    else {
      let { y0: Te, y1: Ke } = g;
      Te != null && Ke != null && (V = Ke.values(S, T, C, E), He = Te.values(S, T, C, E));
    }
    let re = ie * se, $e = ye * se;
    for (let Te = fe == 1 ? C : E; Te >= C && Te <= E; Te += fe) {
      let Ke = V[Te];
      if (Ke == null)
        continue;
      if (He != null) {
        let Zt = He[Te] ?? 0;
        if (Ke - Zt == 0)
          continue;
        Me = M(Zt, Y, A, G);
      }
      let yt = N.distr != 2 || g != null ? F[Te] : Te, Qe = K(yt, N, Z, W), Fe = M(bt(Ke, we), Y, A, G), at = J(Qe - ue), rt = J(Tn(Fe, Me)), ut = J(di(Fe, Me)), Et = rt - ut;
      if (Ke != null) {
        let Zt = Ke < 0 ? $e : re, un = Ke < 0 ? re : $e;
        nt ? (qe > 0 && Bt[Te] != null && he(mt.get(Bt[Te]), at, ut + Xn(qe / 2), se, Tn(0, Et - qe), Zt, un), Ze[Te] != null && he(Ct.get(Ze[Te]), at, ut + Xn(qe / 2), se, Tn(0, Et - qe), Zt, un)) : he(wn, at, ut + Xn(qe / 2), se, Tn(0, Et - qe), Zt, un), ae(
          S,
          T,
          Te,
          at - qe / 2,
          ut,
          se + qe,
          Et
        );
      }
    }
    return qe > 0 ? ln.stroke = nt ? mt : wn : nt || (ln._fill = X.width == 0 ? X._fill : X._stroke ?? X._fill, ln.width = 0), ln.fill = nt ? Ct : wn, ln;
  });
}
function Ex(e, t) {
  const n = bt(t?.alignGaps, 0);
  return (i, a, l, u) => vl(i, a, (r, c, g, y, v, m, S, T, C, E, X) => {
    let F = r.pxRound, V = (ie) => F(m(ie, y, E, T)), N = (ie) => F(S(ie, v, X, C)), Y, K, M;
    y.ori == 0 ? (Y = xr, M = so, K = yg) : (Y = wr, M = ro, K = bg);
    const W = y.dir * (y.ori == 0 ? 1 : -1);
    l = Ql(g, l, u, 1), u = Ql(g, l, u, -1);
    let G = V(c[W == 1 ? l : u]), Z = G, A = [], J = [];
    for (let ie = W == 1 ? l : u; ie >= l && ie <= u; ie += W)
      if (g[ie] != null) {
        let fe = c[ie], he = V(fe);
        A.push(Z = he), J.push(N(g[ie]));
      }
    const ee = { stroke: e(A, J, Y, M, K, F), fill: null, clip: null, band: null, gaps: null, flags: to }, I = ee.stroke;
    let [$, le] = bc(i, a);
    if (r.fill != null || $ != 0) {
      let ie = ee.fill = new Path2D(I), ye = r.fillTo(i, a, r.min, r.max, $), fe = N(ye);
      M(ie, Z, fe), M(ie, G, fe);
    }
    if (!r.spanGaps) {
      let ie = [];
      ie.push(...xc(c, g, l, u, W, V, n)), ee.gaps = ie = r.gaps(i, a, l, u, ie), ee.clip = br(ie, y.ori, T, C, E, X);
    }
    return le != 0 && (ee.band = le == 2 ? [
      ha(i, a, l, u, I, -1),
      ha(i, a, l, u, I, 1)
    ] : ha(i, a, l, u, I, le)), ee;
  });
}
function $x(e) {
  return Ex(Ax, e);
}
function Ax(e, t, n, i, a, l) {
  const u = e.length;
  if (u < 2)
    return null;
  const r = new Path2D();
  if (n(r, e[0], t[0]), u == 2)
    i(r, e[1], t[1]);
  else {
    let c = Array(u), g = Array(u - 1), y = Array(u - 1), v = Array(u - 1);
    for (let m = 0; m < u - 1; m++)
      y[m] = t[m + 1] - t[m], v[m] = e[m + 1] - e[m], g[m] = y[m] / v[m];
    c[0] = g[0];
    for (let m = 1; m < u - 1; m++)
      g[m] === 0 || g[m - 1] === 0 || g[m - 1] > 0 != g[m] > 0 ? c[m] = 0 : (c[m] = 3 * (v[m - 1] + v[m]) / ((2 * v[m] + v[m - 1]) / g[m - 1] + (v[m] + 2 * v[m - 1]) / g[m]), isFinite(c[m]) || (c[m] = 0));
    c[u - 1] = g[u - 2];
    for (let m = 0; m < u - 1; m++)
      a(
        r,
        e[m] + v[m] / 3,
        t[m] + c[m] * v[m] / 3,
        e[m + 1] - v[m] / 3,
        t[m + 1] - c[m + 1] * v[m] / 3,
        e[m + 1],
        t[m + 1]
      );
  }
  return r;
}
const Eu = /* @__PURE__ */ new Set();
function Od() {
  for (let e of Eu)
    e.syncRect(!0);
}
oo && (rl(p1, Gl, Od), rl(m1, Gl, Od, !0), rl(Xs, Gl, () => {
  rn.pxRatio = kt;
}));
const Nx = Sg(), Rx = xg();
function Pd(e, t, n, i) {
  return (i ? [e[0], e[1]].concat(e.slice(2)) : [e[0]].concat(e.slice(1))).map((l, u) => $u(l, u, t, n));
}
function Lx(e, t) {
  return e.map((n, i) => i == 0 ? {} : cn({}, t, n));
}
function $u(e, t, n, i) {
  return cn({}, t == 0 ? n : i, e);
}
function kg(e, t, n) {
  return t == null ? Jl : [t, n];
}
const qx = kg;
function Fx(e, t, n) {
  return t == null ? Jl : Js(t, n, fc, !0);
}
function _g(e, t, n, i) {
  return t == null ? Jl : mr(t, n, e.scales[i].log, !1);
}
const Vx = _g;
function Cg(e, t, n, i) {
  return t == null ? Jl : dc(t, n, e.scales[i].log, !1);
}
const Wx = Cg;
function Yx(e, t, n, i, a) {
  let l = Tn(ud(e), ud(t)), u = t - e, r = Ci(a / i * u, n);
  do {
    let c = n[r], g = i * c / u;
    if (g >= a && l + (c < 5 ? qa.get(c) : 0) <= 17)
      return [c, g];
  } while (++r < n.length);
  return [0, 0];
}
function Id(e) {
  let t, n;
  return e = e.replace(/(\d+)px/, (i, a) => (t = mn((n = +a) * kt)) + "px"), [e, t, n];
}
function Bx(e) {
  e.show && [e.font, e.labelFont].forEach((t) => {
    let n = Rt(t[2] * kt, 1);
    t[0] = t[0].replace(/[0-9.]+px/, n + "px"), t[1] = n;
  });
}
function rn(e, t, n) {
  const i = {
    mode: bt(e.mode, 1)
  }, a = i.mode;
  function l(w, D) {
    return ((D.distr == 3 ? fa(w > 0 ? w : D.clamp(i, w, D.min, D.max, D.key)) : D.distr == 4 ? Qr(w, D.asinh) : D.distr == 100 ? D.fwd(w) : w) - D._min) / (D._max - D._min);
  }
  function u(w, D, B, H) {
    let te = l(w, D);
    return H + B * (D.dir == -1 ? 1 - te : te);
  }
  function r(w, D, B, H) {
    let te = l(w, D);
    return H + B * (D.dir == -1 ? te : 1 - te);
  }
  function c(w, D, B, H) {
    return D.ori == 0 ? u(w, D, B, H) : r(w, D, B, H);
  }
  i.valToPosH = u, i.valToPosV = r;
  let g = !1;
  i.status = 0;
  const y = i.root = si(Qb);
  if (e.id != null && (y.id = e.id), jn(y, e.class), e.title) {
    let w = si(e1, y);
    w.textContent = e.title;
  }
  const v = Si("canvas"), m = i.ctx = v.getContext("2d"), S = si(t1, y);
  rl("click", S, (w) => {
    w.target === C && ($t != ea || Dt != _a) && pn.click(i, w);
  }, !0);
  const T = i.under = si(n1, S);
  S.appendChild(v);
  const C = i.over = si(i1, S);
  e = eo(e);
  const E = +bt(e.pxAlign, 1), X = zd(E);
  (e.plugins || []).forEach((w) => {
    w.opts && (e = w.opts(i, e) || e);
  });
  const F = e.ms || 1e-3, V = i.series = a == 1 ? Pd(e.series || [], wd, Md, !1) : Lx(e.series || [null], Cd), N = i.axes = Pd(e.axes || [], xd, kd, !0), Y = i.scales = {}, K = i.bands = e.bands || [];
  K.forEach((w) => {
    w.fill = ct(w.fill || null), w.dir = bt(w.dir, -1);
  });
  const M = a == 2 ? V[1].facets[0].scale : V[0].scale, W = {
    axes: ds,
    series: Sl
  }, G = (e.drawOrder || ["axes", "series"]).map((w) => W[w]);
  function Z(w) {
    let D = Y[w];
    if (D == null) {
      let B = (e.scales || Vo)[w] || Vo;
      if (B.from != null)
        Z(B.from), Y[w] = cn({}, Y[B.from], B, { key: w });
      else {
        D = Y[w] = cn({}, w == M ? hg : Mx, B), D.key = w;
        let H = D.time, te = D.range, o = Ia(te);
        if ((w != M || a == 2 && !H) && (o && (te[0] == null || te[1] == null) && (te = {
          min: te[0] == null ? od : {
            mode: 1,
            hard: te[0],
            soft: te[0]
          },
          max: te[1] == null ? od : {
            mode: 1,
            hard: te[1],
            soft: te[1]
          }
        }, o = !1), !o && yr(te))) {
          let s = te;
          te = (d, h, p) => h == null ? Jl : Js(h, p, s);
        }
        D.range = ct(te || (H ? qx : w == M ? D.distr == 3 ? Vx : D.distr == 4 ? Wx : kg : D.distr == 3 ? _g : D.distr == 4 ? Cg : Fx)), D.auto = ct(o ? !1 : D.auto), D.clamp = ct(D.clamp || Cx), D._min = D._max = null;
      }
    }
  }
  Z("x"), Z("y"), a == 1 && V.forEach((w) => {
    Z(w.scale);
  }), N.forEach((w) => {
    Z(w.scale);
  });
  for (let w in e.scales)
    Z(w);
  const A = Y[M], J = A.distr;
  let ee, I;
  A.ori == 0 ? (jn(y, Xb), ee = u, I = r) : (jn(y, Jb), ee = r, I = u);
  const $ = {};
  for (let w in Y) {
    let D = Y[w];
    (D.min != null || D.max != null) && ($[w] = { min: D.min, max: D.max }, D.min = D.max = null);
  }
  const le = e.tzDate || ((w) => new Date(mn(w / F))), ie = e.fmtDate || pc, ye = F == 1 ? X1(le) : tx(le), fe = vd(le, md(F == 1 ? Q1 : ex, ie)), he = bd(le, yd(ix, ie)), ae = [], ve = i.legend = cn({}, ox, e.legend), Ne = ve.show, we = ve.markers;
  ve.idxs = ae, we.width = ct(we.width), we.dash = ct(we.dash), we.stroke = ct(we.stroke), we.fill = ct(we.fill);
  let Me, ue, se, Pe = [], xe = [], qe, nt = !1, Ze = {};
  if (ve.live) {
    const w = V[1] ? V[1].values : null;
    nt = w != null, qe = nt ? w(i, 1, 0) : { _: 0 };
    for (let D in qe)
      Ze[D] = uc;
  }
  if (Ne)
    if (Me = Si("table", u1, y), se = Si("tbody", null, Me), ve.mount(i, Me), nt) {
      ue = Si("thead", null, Me, se);
      let w = Si("tr", null, ue);
      Si("th", null, w);
      for (var Ct in qe)
        Si("th", jc, w).textContent = Ct;
    } else
      jn(Me, d1), ve.live && jn(Me, c1);
  const Bt = { show: !0 }, mt = { show: !1 };
  function It(w, D) {
    if (D == 0 && (nt || !ve.live || a == 2))
      return Jl;
    let B = [], H = Si("tr", f1, se, se.childNodes[D]);
    jn(H, w.class), w.show || jn(H, al);
    let te = Si("th", null, H);
    if (we.show) {
      let d = si(h1, te);
      if (D > 0) {
        let h = we.width(i, D);
        h && (d.style.border = h + "px " + we.dash(i, D) + " " + we.stroke(i, D)), d.style.background = we.fill(i, D);
      }
    }
    let o = si(jc, te);
    o.textContent = w.label, D > 0 && (we.show || (o.style.color = w.width > 0 ? we.stroke(i, D) : we.fill(i, D)), Ht("click", te, (d) => {
      if (Le._lock)
        return;
      _n(d);
      let h = V.indexOf(w);
      if ((d.ctrlKey || d.metaKey) != ve.isolate) {
        let p = V.some((x, k) => k > 0 && k != h && x.show);
        V.forEach((x, k) => {
          k > 0 && ni(k, p ? k == h ? Bt : mt : Bt, !0, Xt.setSeries);
        });
      } else
        ni(h, { show: !w.show }, !0, Xt.setSeries);
    }, !1), va && Ht(Qc, te, (d) => {
      Le._lock || (_n(d), ni(V.indexOf(w), Ma, !0, Xt.setSeries));
    }, !1));
    for (var s in qe) {
      let d = Si("td", g1, H);
      d.textContent = "--", B.push(d);
    }
    return [H, B];
  }
  const vt = /* @__PURE__ */ new Map();
  function Ht(w, D, B, H = !0) {
    const te = vt.get(D) || {}, o = Le.bind[w](i, D, B, H);
    o && (rl(w, D, te[w] = o), vt.set(D, te));
  }
  function pi(w, D, B) {
    const H = vt.get(D) || {};
    for (let te in H)
      (w == null || te == w) && (zu(te, D, H[te]), delete H[te]);
    w == null && vt.delete(D);
  }
  let ln = 0, wn = 0, He = 0, re = 0, $e = 0, Te = 0, Ke = $e, yt = Te, Qe = He, Fe = re, at = 0, rt = 0, ut = 0, Et = 0;
  i.bbox = {};
  let Zt = !1, un = !1, Dn = !1, kn = !1, dn = !1, Lt = !1;
  function fn(w, D, B) {
    (B || w != i.width || D != i.height) && Mt(w, D), wa(!1), Dn = !0, un = !0, $i();
  }
  function Mt(w, D) {
    i.width = ln = He = w, i.height = wn = re = D, $e = Te = 0, hn(), Wn();
    let B = i.bbox;
    at = B.left = tl($e * kt, 0.5), rt = B.top = tl(Te * kt, 0.5), ut = B.width = tl(He * kt, 0.5), Et = B.height = tl(re * kt, 0.5);
  }
  const en = 3;
  function zt() {
    let w = !1, D = 0;
    for (; !w; ) {
      D++;
      let B = Cr(D), H = Mr(D);
      w = D == en || B && H, w || (Mt(i.width, i.height), un = !0);
    }
  }
  function qt({ width: w, height: D }) {
    fn(w, D);
  }
  i.setSize = qt;
  function hn() {
    let w = !1, D = !1, B = !1, H = !1;
    N.forEach((te, o) => {
      if (te.show && te._show) {
        let { side: s, _size: d } = te, h = s % 2, p = te.label != null ? te.labelSize : 0, x = d + p;
        x > 0 && (h ? (He -= x, s == 3 ? ($e += x, H = !0) : B = !0) : (re -= x, s == 0 ? (Te += x, w = !0) : D = !0));
      }
    }), Mn[0] = w, Mn[1] = B, Mn[2] = D, Mn[3] = H, He -= Ei[1] + Ei[3], $e += Ei[3], re -= Ei[2] + Ei[0], Te += Ei[0];
  }
  function Wn() {
    let w = $e + He, D = Te + re, B = $e, H = Te;
    function te(o, s) {
      switch (o) {
        case 1:
          return w += s, w - s;
        case 2:
          return D += s, D - s;
        case 3:
          return B -= s, B + s;
        case 0:
          return H -= s, H + s;
      }
    }
    N.forEach((o, s) => {
      if (o.show && o._show) {
        let d = o.side;
        o._pos = te(d, o._size), o.label != null && (o._lpos = te(d, o.labelSize));
      }
    });
  }
  const Le = i.cursor = cn({}, fx, { drag: { y: a == 2 } }, e.cursor);
  if (Le.dataIdx == null) {
    let w = Le.hover, D = w.skip = new Set(w.skip ?? []);
    D.add(void 0);
    let B = w.prox = ct(w.prox), H = w.bias ??= 0;
    Le.dataIdx = (te, o, s, d) => {
      if (o == 0)
        return s;
      let h = s, p = B(te, o, s, d) ?? dt, x = p >= 0 && p < dt, k = A.ori == 0 ? He : re, z = Le.left, R = t[0], U = t[o];
      if (D.has(U[s])) {
        h = null;
        let L = null, Q = null, ne;
        if (H == 0 || H == -1)
          for (ne = s; L == null && ne-- > 0; )
            D.has(U[ne]) || (L = ne);
        if (H == 0 || H == 1)
          for (ne = s; Q == null && ne++ < U.length; )
            D.has(U[ne]) || (Q = ne);
        if (L != null || Q != null)
          if (x) {
            let de = L == null ? -1 / 0 : ee(R[L], A, k, 0), ge = Q == null ? 1 / 0 : ee(R[Q], A, k, 0), me = z - de, Se = ge - z;
            me <= Se ? me <= p && (h = L) : Se <= p && (h = Q);
          } else
            h = Q == null ? L : L == null ? Q : s - L <= Q - s ? L : Q;
      } else x && vn(z - ee(R[s], A, k, 0)) > p && (h = null);
      return h;
    };
  }
  const _n = (w) => {
    Le.event = w;
  };
  Le.idxs = ae, Le._lock = !1;
  let Qt = Le.points;
  Qt.show = ct(Qt.show), Qt.size = ct(Qt.size), Qt.stroke = ct(Qt.stroke), Qt.width = ct(Qt.width), Qt.fill = ct(Qt.fill);
  const On = i.focus = cn({}, e.focus || { alpha: 0.3 }, Le.focus), va = On.prox >= 0, ya = va && Qt.one;
  let Pn = [], Cn = [], Rn = [];
  function ti(w, D) {
    let B = Qt.show(i, D);
    if (B)
      return jn(B, r1), jn(B, w.class), qi(B, -10, -10, He, re), C.insertBefore(B, Pn[D]), B;
  }
  function as(w, D) {
    if (a == 1 || D > 0) {
      let B = a == 1 && Y[w.scale].time, H = w.value;
      w.value = B ? fd(H) ? bd(le, yd(H, ie)) : H || he : H || Sx, w.label = w.label || (B ? gx : hx);
    }
    if (ya || D > 0) {
      w.width = w.width == null ? 1 : w.width, w.paths = w.paths || Nx || M1, w.fillTo = ct(w.fillTo || Tx), w.pxAlign = +bt(w.pxAlign, E), w.pxRound = zd(w.pxAlign), w.stroke = ct(w.stroke || null), w.fill = ct(w.fill || null), w._stroke = w._fill = w._paths = w._focus = null;
      let B = kx(Tn(1, w.width), 1), H = w.points = cn({}, {
        size: B,
        width: Tn(1, B * 0.2),
        stroke: w.stroke,
        space: B * 2,
        paths: Rx,
        _stroke: null,
        _fill: null
      }, w.points);
      H.show = ct(H.show), H.filter = ct(H.filter), H.fill = ct(H.fill), H.stroke = ct(H.stroke), H.paths = ct(H.paths), H.pxAlign = w.pxAlign;
    }
    if (Ne) {
      let B = It(w, D);
      Pe.splice(D, 0, B[0]), xe.splice(D, 0, B[1]), ve.values.push(null);
    }
    if (Le.show) {
      ae.splice(D, 0, null);
      let B = null;
      ya ? D == 0 && (B = ti(w, D)) : D > 0 && (B = ti(w, D)), Pn.splice(D, 0, B), Cn.splice(D, 0, 0), Rn.splice(D, 0, 0);
    }
    Ut("addSeries", D);
  }
  function kr(w, D) {
    D = D ?? V.length, w = a == 1 ? $u(w, D, wd, Md) : $u(w, D, {}, Cd), V.splice(D, 0, w), as(V[D], D);
  }
  i.addSeries = kr;
  function ls(w) {
    if (V.splice(w, 1), Ne) {
      ve.values.splice(w, 1), xe.splice(w, 1);
      let D = Pe.splice(w, 1)[0];
      pi(null, D.firstChild), D.remove();
    }
    Le.show && (ae.splice(w, 1), Pn.splice(w, 1)[0].remove(), Cn.splice(w, 1), Rn.splice(w, 1)), Ut("delSeries", w);
  }
  i.delSeries = ls;
  const Mn = [!1, !1, !1, !1];
  function Xe(w, D) {
    if (w._show = w.show, w.show) {
      let B = w.side % 2, H = Y[w.scale];
      H == null && (w.scale = B ? V[1].scale : M, H = Y[w.scale]);
      let te = H.time;
      w.size = ct(w.size), w.space = ct(w.space), w.rotate = ct(w.rotate), Ia(w.incrs) && w.incrs.forEach((s) => {
        !qa.has(s) && qa.set(s, Gh(s));
      }), w.incrs = ct(w.incrs || (H.distr == 2 ? G1 : te ? F == 1 ? Z1 : J1 : nl)), w.splits = ct(w.splits || (te && H.distr == 1 ? ye : H.distr == 3 ? Ou : H.distr == 4 ? vx : mx)), w.stroke = ct(w.stroke), w.grid.stroke = ct(w.grid.stroke), w.ticks.stroke = ct(w.ticks.stroke), w.border.stroke = ct(w.border.stroke);
      let o = w.values;
      w.values = // static array of tick values
      Ia(o) && !Ia(o[0]) ? ct(o) : (
        // temporal
        te ? (
          // config array of fmtDate string tpls
          Ia(o) ? vd(le, md(o, ie)) : (
            // fmtDate string tpl
            fd(o) ? nx(le, o) : o || fe
          )
        ) : o || px
      ), w.filter = ct(w.filter || (H.distr >= 3 && H.log == 10 ? xx : H.distr == 3 && H.log == 2 ? wx : jh)), w.font = Id(w.font), w.labelFont = Id(w.labelFont), w._size = w.size(i, null, D, 0), w._space = w._rotate = w._incrs = w._found = // foundIncrSpace
      w._splits = w._values = null, w._size > 0 && (Mn[D] = !0, w._el = si(a1, S));
    }
  }
  function ba(w, D, B, H) {
    let [te, o, s, d] = B, h = D % 2, p = 0;
    return h == 0 && (d || o) && (p = D == 0 && !te || D == 2 && !s ? mn(xd.size / 3) : 0), h == 1 && (te || s) && (p = D == 1 && !o || D == 3 && !d ? mn(kd.size / 2) : 0), p;
  }
  const co = i.padding = (e.padding || [ba, ba, ba, ba]).map((w) => ct(bt(w, ba))), Ei = i._padding = co.map((w, D) => w(i, D, Mn, 0));
  let gn, jt = null, tn = null;
  const bl = a == 1 ? V[0].idxs : null;
  let Yn = null, Va = !1;
  function fo(w, D) {
    if (t = w ?? [], i.data = i._data = t, a == 2) {
      gn = 0;
      for (let B = 1; B < V.length; B++)
        gn += t[B][0].length;
    } else {
      t.length == 0 && (i.data = i._data = t = [[]]), Yn = t[0], gn = Yn.length;
      let B = t;
      if (J == 2) {
        B = t.slice();
        let H = B[0] = Array(gn);
        for (let te = 0; te < gn; te++)
          H[te] = te;
      }
      i._data = t = B;
    }
    if (wa(!0), Ut("setData"), J == 2 && (Dn = !0), D !== !1) {
      let B = A;
      B.auto(i, Va) ? ho() : Sn(M, B.min, B.max), kn = kn || Le.left >= 0, Lt = !0, $i();
    }
  }
  i.setData = fo;
  function ho() {
    Va = !0;
    let w, D;
    a == 1 && (gn > 0 ? (jt = bl[0] = 0, tn = bl[1] = gn - 1, w = t[0][jt], D = t[0][tn], J == 2 ? (w = jt, D = tn) : w == D && (J == 3 ? [w, D] = mr(w, w, A.log, !1) : J == 4 ? [w, D] = dc(w, w, A.log, !1) : A.time ? D = w + mn(86400 / F) : [w, D] = Js(w, D, fc, !0))) : (jt = bl[0] = w = null, tn = bl[1] = D = null)), Sn(M, w, D);
  }
  let Wa, Ki, xa, xl, Ya, wl, go, Ba, po, Bn;
  function os(w, D, B, H, te, o) {
    w ??= Gc, B ??= gc, H ??= "butt", te ??= Gc, o ??= "round", w != Wa && (m.strokeStyle = Wa = w), te != Ki && (m.fillStyle = Ki = te), D != xa && (m.lineWidth = xa = D), o != Ya && (m.lineJoin = Ya = o), H != wl && (m.lineCap = wl = H), B != xl && m.setLineDash(xl = B);
  }
  function ss(w, D, B, H) {
    D != Ki && (m.fillStyle = Ki = D), w != go && (m.font = go = w), B != Ba && (m.textAlign = Ba = B), H != po && (m.textBaseline = po = H);
  }
  function mo(w, D, B, H, te = 0) {
    if (H.length > 0 && w.auto(i, Va) && (D == null || D.min == null)) {
      let o = bt(jt, 0), s = bt(tn, H.length - 1), d = B.min == null ? w.distr == 3 ? x1(H, o, s) : b1(H, o, s, te) : [B.min, B.max];
      w.min = di(w.min, B.min = d[0]), w.max = Tn(w.max, B.max = d[1]);
    }
  }
  const rs = { min: null, max: null };
  function _r() {
    for (let H in Y) {
      let te = Y[H];
      $[H] == null && // scales that have never been set (on init)
      (te.min == null || // or auto scales when the x scale was explicitly set
      $[M] != null && te.auto(i, Va)) && ($[H] = rs);
    }
    for (let H in Y) {
      let te = Y[H];
      $[H] == null && te.from != null && $[te.from] != null && ($[H] = rs);
    }
    $[M] != null && wa(!0);
    let w = {};
    for (let H in $) {
      let te = $[H];
      if (te != null) {
        let o = w[H] = eo(Y[H], D1);
        if (te.min != null)
          cn(o, te);
        else if (H != M || a == 2)
          if (gn == 0 && o.from == null) {
            let s = o.range(i, null, null, H);
            o.min = s[0], o.max = s[1];
          } else
            o.min = dt, o.max = -dt;
      }
    }
    if (gn > 0) {
      V.forEach((H, te) => {
        if (a == 1) {
          let o = H.scale, s = $[o];
          if (s == null)
            return;
          let d = w[o];
          if (te == 0) {
            let h = d.range(i, d.min, d.max, o);
            d.min = h[0], d.max = h[1], jt = Ci(d.min, t[0]), tn = Ci(d.max, t[0]), tn - jt > 1 && (t[0][jt] < d.min && jt++, t[0][tn] > d.max && tn--), H.min = Yn[jt], H.max = Yn[tn];
          } else H.show && H.auto && mo(d, s, H, t[te], H.sorted);
          H.idxs[0] = jt, H.idxs[1] = tn;
        } else if (te > 0 && H.show && H.auto) {
          let [o, s] = H.facets, d = o.scale, h = s.scale, [p, x] = t[te], k = w[d], z = w[h];
          k != null && mo(k, $[d], o, p, o.sorted), z != null && mo(z, $[h], s, x, s.sorted), H.min = s.min, H.max = s.max;
        }
      });
      for (let H in w) {
        let te = w[H], o = $[H];
        if (te.from == null && (o == null || o.min == null)) {
          let s = te.range(
            i,
            te.min == dt ? null : te.min,
            te.max == -dt ? null : te.max,
            H
          );
          te.min = s[0], te.max = s[1];
        }
      }
    }
    for (let H in w) {
      let te = w[H];
      if (te.from != null) {
        let o = w[te.from];
        if (o.min == null)
          te.min = te.max = null;
        else {
          let s = te.range(i, o.min, o.max, H);
          te.min = s[0], te.max = s[1];
        }
      }
    }
    let D = {}, B = !1;
    for (let H in w) {
      let te = w[H], o = Y[H];
      if (o.min != te.min || o.max != te.max) {
        o.min = te.min, o.max = te.max;
        let s = o.distr;
        o._min = s == 3 ? fa(o.min) : s == 4 ? Qr(o.min, o.asinh) : s == 100 ? o.fwd(o.min) : o.min, o._max = s == 3 ? fa(o.max) : s == 4 ? Qr(o.max, o.asinh) : s == 100 ? o.fwd(o.max) : o.max, D[H] = B = !0;
      }
    }
    if (B) {
      V.forEach((H, te) => {
        a == 2 ? te > 0 && D.y && (H._paths = null) : D[H.scale] && (H._paths = null);
      });
      for (let H in D)
        Dn = !0, Ut("setScale", H);
      Le.show && Le.left >= 0 && (kn = Lt = !0);
    }
    for (let H in $)
      $[H] = null;
  }
  function us(w) {
    let D = Du(jt - 1, 0, gn - 1), B = Du(tn + 1, 0, gn - 1);
    for (; w[D] == null && D > 0; )
      D--;
    for (; w[B] == null && B < gn - 1; )
      B++;
    return [D, B];
  }
  function Sl() {
    gn > 0 && (V.forEach((w, D) => {
      if (D > 0 && w.show && (Zi(D, !1), Zi(D, !0), w._paths == null)) {
        Bn != w.alpha && (m.globalAlpha = Bn = w.alpha);
        let B = a == 2 ? [0, t[D][0].length - 1] : us(t[D]);
        w._paths = w.paths(i, D, B[0], B[1]), Bn != 1 && (m.globalAlpha = Bn = 1);
      }
    }), V.forEach((w, D) => {
      if (D > 0 && w.show) {
        Bn != w.alpha && (m.globalAlpha = Bn = w.alpha), w._paths != null && kl(D, !1);
        {
          let B = w._paths != null ? w._paths.gaps : null, H = w.points.show(i, D, jt, tn, B), te = w.points.filter(i, D, H, B);
          (H || te) && (w.points._paths = w.points.paths(i, D, jt, tn, te), kl(D, !0));
        }
        Bn != 1 && (m.globalAlpha = Bn = 1), Ut("drawSeries", D);
      }
    }));
  }
  function Zi(w, D) {
    let B = D ? V[w].points : V[w];
    B._stroke = B.stroke(i, w), B._fill = B.fill(i, w);
  }
  function kl(w, D) {
    let B = D ? V[w].points : V[w], {
      stroke: H,
      fill: te,
      clip: o,
      flags: s,
      _stroke: d = B._stroke,
      _fill: h = B._fill,
      _width: p = B.width
    } = B._paths;
    p = Rt(p * kt, 3);
    let x = null, k = p % 2 / 2;
    D && h == null && (h = p > 0 ? "#fff" : d);
    let z = B.pxAlign == 1 && k > 0;
    if (z && m.translate(k, k), !D) {
      let R = at - p / 2, U = rt - p / 2, L = ut + p, Q = Et + p;
      x = new Path2D(), x.rect(R, U, L, Q);
    }
    D ? Qi(d, p, B.dash, B.cap, h, H, te, s, o) : _l(w, d, p, B.dash, B.cap, h, H, te, s, x, o), z && m.translate(-k, -k);
  }
  function _l(w, D, B, H, te, o, s, d, h, p, x) {
    let k = !1;
    h != 0 && K.forEach((z, R) => {
      if (z.series[0] == w) {
        let U = V[z.series[1]], L = t[z.series[1]], Q = (U._paths || Vo).band;
        Ia(Q) && (Q = z.dir == 1 ? Q[0] : Q[1]);
        let ne, de = null;
        U.show && Q && S1(L, jt, tn) ? (de = z.fill(i, R) || o, ne = U._paths.clip) : Q = null, Qi(D, B, H, te, de, s, d, h, p, x, ne, Q), k = !0;
      }
    }), k || Qi(D, B, H, te, o, s, d, h, p, x);
  }
  const mi = to | Iu;
  function Qi(w, D, B, H, te, o, s, d, h, p, x, k) {
    os(w, D, B, H, te), (h || p || k) && (m.save(), h && m.clip(h), p && m.clip(p)), k ? (d & mi) == mi ? (m.clip(k), x && m.clip(x), Ha(te, s), Cl(w, o, D)) : d & Iu ? (Ha(te, s), m.clip(k), Cl(w, o, D)) : d & to && (m.save(), m.clip(k), x && m.clip(x), Ha(te, s), m.restore(), Cl(w, o, D)) : (Ha(te, s), Cl(w, o, D)), (h || p || k) && m.restore();
  }
  function Cl(w, D, B) {
    B > 0 && (D instanceof Map ? D.forEach((H, te) => {
      m.strokeStyle = Wa = te, m.stroke(H);
    }) : D != null && w && m.stroke(D));
  }
  function Ha(w, D) {
    D instanceof Map ? D.forEach((B, H) => {
      m.fillStyle = Ki = H, m.fill(B);
    }) : D != null && w && m.fill(D);
  }
  function cs(w, D, B, H) {
    let te = N[w], o;
    if (H <= 0)
      o = [0, 0];
    else {
      let s = te._space = te.space(i, w, D, B, H), d = te._incrs = te.incrs(i, w, D, B, H, s);
      o = Yx(D, B, d, H, s);
    }
    return te._found = o;
  }
  function ja(w, D, B, H, te, o, s, d, h, p) {
    let x = s % 2 / 2;
    E == 1 && m.translate(x, x), os(d, s, h, p, d), m.beginPath();
    let k, z, R, U, L = te + (H == 0 || H == 3 ? -o : o);
    B == 0 ? (z = te, U = L) : (k = te, R = L);
    for (let Q = 0; Q < w.length; Q++)
      D[Q] != null && (B == 0 ? k = R = w[Q] : z = U = w[Q], m.moveTo(k, z), m.lineTo(R, U));
    m.stroke(), E == 1 && m.translate(-x, -x);
  }
  function Cr(w) {
    let D = !0;
    return N.forEach((B, H) => {
      if (!B.show)
        return;
      let te = Y[B.scale];
      if (te.min == null) {
        B._show && (D = !1, B._show = !1, wa(!1));
        return;
      } else
        B._show || (D = !1, B._show = !0, wa(!1));
      let o = B.side, s = o % 2, { min: d, max: h } = te, [p, x] = cs(H, d, h, s == 0 ? He : re);
      if (x == 0)
        return;
      let k = te.distr == 2, z = B._splits = B.splits(i, H, d, h, p, x, k), R = te.distr == 2 ? z.map((ne) => Yn[ne]) : z, U = te.distr == 2 ? Yn[z[1]] - Yn[z[0]] : p, L = B._values = B.values(i, B.filter(i, R, H, x, U), H, x, U);
      B._rotate = o == 2 ? B.rotate(i, L, H, x) : 0;
      let Q = B._size;
      B._size = ui(B.size(i, L, H, w)), Q != null && B._size != Q && (D = !1);
    }), D;
  }
  function Mr(w) {
    let D = !0;
    return co.forEach((B, H) => {
      let te = B(i, H, Mn, w);
      te != Ei[H] && (D = !1), Ei[H] = te;
    }), D;
  }
  function ds() {
    for (let w = 0; w < N.length; w++) {
      let D = N[w];
      if (!D.show || !D._show)
        continue;
      let B = D.side, H = B % 2, te, o, s = D.stroke(i, w), d = B == 0 || B == 3 ? -1 : 1;
      if (D.label) {
        let At = D.labelGap * d, Jt = mn((D._lpos + At) * kt);
        ss(D.labelFont[0], s, "center", B == 2 ? To : Uc), m.save(), H == 1 ? (te = o = 0, m.translate(
          Jt,
          mn(rt + Et / 2)
        ), m.rotate((B == 3 ? -Fs : Fs) / 2)) : (te = mn(at + ut / 2), o = Jt), m.fillText(D.label, te, o), m.restore();
      }
      let [h, p] = D._found;
      if (p == 0)
        continue;
      let x = Y[D.scale], k = H == 0 ? ut : Et, z = H == 0 ? at : rt, R = mn(D.gap * kt), U = D._splits, L = x.distr == 2 ? U.map((At) => Yn[At]) : U, Q = x.distr == 2 ? Yn[U[1]] - Yn[U[0]] : h, ne = D.ticks, de = D.border, ge = ne.show ? mn(ne.size * kt) : 0, me = D._rotate * -Fs / 180, Se = X(D._pos * kt), ke = (ge + R) * d, Ee = Se + ke;
      o = H == 0 ? Ee : 0, te = H == 1 ? Ee : 0;
      let Be = D.font[0], Je = D.align == 1 ? $l : D.align == 2 ? Kr : me > 0 ? $l : me < 0 ? Kr : H == 0 ? "center" : B == 3 ? Kr : $l, Ve = me || H == 1 ? "middle" : B == 2 ? To : Uc;
      ss(Be, s, Je, Ve);
      let Ge = D.font[1] * D.lineGap, St = U.map((At) => X(c(At, x, k, z))), gt = D._values;
      for (let At = 0; At < gt.length; At++) {
        let Jt = gt[At];
        if (Jt != null) {
          H == 0 ? te = St[At] : o = St[At], Jt = "" + Jt;
          let xi = Jt.indexOf(`
`) == -1 ? [Jt] : Jt.split(/\n/gm);
          for (let Ln = 0; Ln < xi.length; Ln++) {
            let ai = xi[Ln];
            me ? (m.save(), m.translate(te, o + Ln * Ge), m.rotate(me), m.fillText(ai, 0, 0), m.restore()) : m.fillText(ai, te, o + Ln * Ge);
          }
        }
      }
      ne.show && ja(
        St,
        ne.filter(i, L, w, p, Q),
        H,
        B,
        Se,
        ge,
        Rt(ne.width * kt, 3),
        ne.stroke(i, w),
        ne.dash,
        ne.cap
      );
      let Tt = D.grid;
      Tt.show && ja(
        St,
        Tt.filter(i, L, w, p, Q),
        H,
        H == 0 ? 2 : 1,
        H == 0 ? rt : at,
        H == 0 ? Et : ut,
        Rt(Tt.width * kt, 3),
        Tt.stroke(i, w),
        Tt.dash,
        Tt.cap
      ), de.show && ja(
        [Se],
        [1],
        H == 0 ? 1 : 0,
        H == 0 ? 1 : 2,
        H == 1 ? rt : at,
        H == 1 ? Et : ut,
        Rt(de.width * kt, 3),
        de.stroke(i, w),
        de.dash,
        de.cap
      );
    }
    Ut("drawAxes");
  }
  function wa(w) {
    V.forEach((D, B) => {
      B > 0 && (D._paths = null, w && (a == 1 ? (D.min = null, D.max = null) : D.facets.forEach((H) => {
        H.min = null, H.max = null;
      })));
    });
  }
  let Ml = !1, Tl = !1, Sa = [];
  function Tr() {
    Tl = !1;
    for (let w = 0; w < Sa.length; w++)
      Ut(...Sa[w]);
    Sa.length = 0;
  }
  function $i() {
    Ml || (N1(vo), Ml = !0);
  }
  function zr(w, D = !1) {
    Ml = !0, Tl = D, w(i), vo(), D && Sa.length > 0 && queueMicrotask(Tr);
  }
  i.batch = zr;
  function vo() {
    if (Zt && (_r(), Zt = !1), Dn && (zt(), Dn = !1), un) {
      if (Vt(T, $l, $e), Vt(T, To, Te), Vt(T, Io, He), Vt(T, Eo, re), Vt(C, $l, $e), Vt(C, To, Te), Vt(C, Io, He), Vt(C, Eo, re), Vt(S, Io, ln), Vt(S, Eo, wn), v.width = mn(ln * kt), v.height = mn(wn * kt), N.forEach(({ _el: w, _show: D, _size: B, _pos: H, side: te }) => {
        if (w != null)
          if (D) {
            let o = te === 3 || te === 0 ? B : 0, s = te % 2 == 1;
            Vt(w, s ? "left" : "top", H - o), Vt(w, s ? "width" : "height", B), Vt(w, s ? "top" : "left", s ? Te : $e), Vt(w, s ? "height" : "width", s ? re : He), Tu(w, al);
          } else
            jn(w, al);
      }), Wa = Ki = xa = Ya = wl = go = Ba = po = xl = null, Bn = 1, Da(!0), $e != Ke || Te != yt || He != Qe || re != Fe) {
        wa(!1);
        let w = He / Qe, D = re / Fe;
        if (Le.show && !kn && Le.left >= 0) {
          Le.left *= w, Le.top *= D, Xi && qi(Xi, mn(Le.left), 0, He, re), Ji && qi(Ji, 0, mn(Le.top), He, re);
          for (let B = 0; B < Pn.length; B++) {
            let H = Pn[B];
            H != null && (Cn[B] *= w, Rn[B] *= D, qi(H, ui(Cn[B]), ui(Rn[B]), He, re));
          }
        }
        if (Ot.show && !dn && Ot.left >= 0 && Ot.width > 0) {
          Ot.left *= w, Ot.width *= w, Ot.top *= D, Ot.height *= D;
          for (let B in So)
            Vt(Ai, B, Ot[B]);
        }
        Ke = $e, yt = Te, Qe = He, Fe = re;
      }
      Ut("setSize"), un = !1;
    }
    ln > 0 && wn > 0 && (m.clearRect(0, 0, v.width, v.height), Ut("drawClear"), G.forEach((w) => w()), Ut("draw")), Ot.show && dn && (zl(Ot), dn = !1), Le.show && kn && (Li(null, !0, !1), kn = !1), ve.show && ve.live && Lt && (za(), Lt = !1), g || (g = !0, i.status = 1, Ut("ready")), Va = !1, Ml = !1;
  }
  i.redraw = (w, D) => {
    Dn = D || !1, w !== !1 ? Sn(M, A.min, A.max) : $i();
  };
  function yo(w, D) {
    let B = Y[w];
    if (B.from == null) {
      if (gn == 0) {
        let H = B.range(i, D.min, D.max, w);
        D.min = H[0], D.max = H[1];
      }
      if (D.min > D.max) {
        let H = D.min;
        D.min = D.max, D.max = H;
      }
      if (gn > 1 && D.min != null && D.max != null && D.max - D.min < 1e-16)
        return;
      w == M && B.distr == 2 && gn > 0 && (D.min = Ci(D.min, t[0]), D.max = Ci(D.max, t[0]), D.min == D.max && D.max++), $[w] = D, Zt = !0, $i();
    }
  }
  i.setScale = yo;
  let ka, bo, Xi, Ji, fs, xo, ea, _a, Ca, Ua, $t, Dt, vi = !1;
  const pn = Le.drag;
  let nn = pn.x, on = pn.y;
  Le.show && (Le.x && (ka = si(o1, C)), Le.y && (bo = si(s1, C)), A.ori == 0 ? (Xi = ka, Ji = bo) : (Xi = bo, Ji = ka), $t = Le.left, Dt = Le.top);
  const Ot = i.select = cn({
    show: !0,
    over: !0,
    left: 0,
    width: 0,
    top: 0,
    height: 0
  }, e.select), Ai = Ot.show ? si(l1, Ot.over ? C : T) : null;
  function zl(w, D) {
    if (Ot.show) {
      for (let B in w)
        Ot[B] = w[B], B in So && Vt(Ai, B, w[B]);
      D !== !1 && Ut("setSelect");
    }
  }
  i.setSelect = zl;
  function Dr(w, D) {
    let B = V[w], H = Ne ? Pe[w] : null;
    if (B.show)
      H && Tu(H, al);
    else {
      H && jn(H, al);
      let te = ya ? Pn[0] : Pn[w];
      qi(te, -10, -10, He, re);
    }
  }
  function Sn(w, D, B) {
    yo(w, { min: D, max: B });
  }
  function ni(w, D, B, H) {
    D.focus != null && Ir(w), D.show != null && V.forEach((te, o) => {
      o > 0 && (w == o || w == null) && (te.show = D.show, Dr(o, D.show), a == 2 ? (Sn(te.facets[0].scale, null, null), Sn(te.facets[1].scale, null, null)) : Sn(te.scale, null, null), $i());
    }), B !== !1 && Ut("setSeries", w, D), H && Za("setSeries", i, w, D);
  }
  i.setSeries = ni;
  function Or(w, D) {
    cn(K[w], D);
  }
  function Pr(w, D) {
    w.fill = ct(w.fill || null), w.dir = bt(w.dir, -1), D = D ?? K.length, K.splice(D, 0, w);
  }
  function hs(w) {
    w == null ? K.length = 0 : K.splice(w, 1);
  }
  i.addBand = Pr, i.setBand = Or, i.delBand = hs;
  function gs(w, D) {
    V[w].alpha = D, Le.show && Pn[w] && (Pn[w].style.opacity = D), Ne && Pe[w] && (Pe[w].style.opacity = D);
  }
  let Ft, Ni, ta;
  const Ma = { focus: !0 };
  function Ir(w) {
    if (w != ta) {
      let D = w == null, B = On.alpha != 1;
      V.forEach((H, te) => {
        if (a == 1 || te > 0) {
          let o = D || te == 0 || te == w;
          H._focus = D ? null : o, B && gs(te, o ? 1 : On.alpha);
        }
      }), ta = w, B && $i();
    }
  }
  Ne && va && Ht(Xc, Me, (w) => {
    Le._lock || (_n(w), ta != null && ni(null, Ma, !0, Xt.setSeries));
  });
  function ii(w, D, B) {
    let H = Y[D];
    B && (w = w / kt - (H.ori == 1 ? Te : $e));
    let te = He;
    H.ori == 1 && (te = re, w = te - w), H.dir == -1 && (w = te - w);
    let o = H._min, s = H._max, d = w / te, h = o + (s - o) * d, p = H.distr;
    return p == 3 ? Xl(10, h) : p == 4 ? _1(h, H.asinh) : p == 100 ? H.bwd(h) : h;
  }
  function Er(w, D) {
    let B = ii(w, M, D);
    return Ci(B, t[0], jt, tn);
  }
  i.valToIdx = (w) => Ci(w, t[0]), i.posToIdx = Er, i.posToVal = ii, i.valToPos = (w, D, B) => Y[D].ori == 0 ? u(
    w,
    Y[D],
    B ? ut : He,
    B ? at : 0
  ) : r(
    w,
    Y[D],
    B ? Et : re,
    B ? rt : 0
  ), i.setCursor = (w, D, B) => {
    $t = w.left, Dt = w.top, Li(null, D, B);
  };
  function ps(w, D) {
    Vt(Ai, $l, Ot.left = w), Vt(Ai, Io, Ot.width = D);
  }
  function ms(w, D) {
    Vt(Ai, To, Ot.top = w), Vt(Ai, Eo, Ot.height = D);
  }
  let Ta = A.ori == 0 ? ps : ms, Ri = A.ori == 1 ? ps : ms;
  function na() {
    if (Ne && ve.live)
      for (let w = a == 2 ? 1 : 0; w < V.length; w++) {
        if (w == 0 && nt)
          continue;
        let D = ve.values[w], B = 0;
        for (let H in D)
          xe[w][B++].firstChild.nodeValue = D[H];
      }
  }
  function za(w, D) {
    if (w != null && (w.idxs ? w.idxs.forEach((B, H) => {
      ae[H] = B;
    }) : z1(w.idx) || ae.fill(w.idx), ve.idx = ae[0]), Ne && ve.live) {
      for (let B = 0; B < V.length; B++)
        (B > 0 || a == 1 && !nt) && $r(B, ae[B]);
      na();
    }
    Lt = !1, D !== !1 && Ut("setLegend");
  }
  i.setLegend = za;
  function $r(w, D) {
    let B = V[w], H = w == 0 && J == 2 ? Yn : t[w], te;
    nt ? te = B.values(i, w, D) ?? Ze : (te = B.value(i, D == null ? null : H[D], w, D), te = te == null ? Ze : { _: te }), ve.values[w] = te;
  }
  function Li(w, D, B) {
    Ca = $t, Ua = Dt, [$t, Dt] = Le.move(i, $t, Dt), Le.left = $t, Le.top = Dt, Le.show && (Xi && qi(Xi, mn($t), 0, He, re), Ji && qi(Ji, 0, mn(Dt), He, re));
    let H, te = jt > tn;
    Ft = dt, Ni = null;
    let o = A.ori == 0 ? He : re, s = A.ori == 1 ? He : re;
    if ($t < 0 || gn == 0 || te) {
      H = Le.idx = null;
      for (let d = 0; d < V.length; d++) {
        let h = Pn[d];
        h != null && qi(h, -10, -10, He, re);
      }
      va && ni(null, Ma, !0, w == null && Xt.setSeries), ve.live && (ae.fill(H), Lt = !0);
    } else {
      let d, h, p;
      a == 1 && (d = A.ori == 0 ? $t : Dt, h = ii(d, M), H = Le.idx = Ci(h, t[0], jt, tn), p = ee(t[0][H], A, o, 0));
      let x = -10, k = -10, z = 0, R = 0, U = !0, L = "", Q = "";
      for (let ne = a == 2 ? 1 : 0; ne < V.length; ne++) {
        let de = V[ne], ge = ae[ne], me = ge == null ? null : a == 1 ? t[ne][ge] : t[ne][1][ge], Se = Le.dataIdx(i, ne, H, h), ke = Se == null ? null : a == 1 ? t[ne][Se] : t[ne][1][Se];
        Lt = Lt || ke != me || Se != ge, ae[ne] = Se;
        let Ee = Se == H ? p : ee(a == 1 ? t[0][Se] : t[ne][0][Se], A, o, 0);
        if (ne > 0 && de.show) {
          let Be = ke == null ? -10 : I(ke, a == 1 ? Y[de.scale] : Y[de.facets[1].scale], s, 0);
          if (va && ke != null) {
            let Je = A.ori == 1 ? $t : Dt, Ve = vn(On.dist(i, ne, Se, Be, Je));
            if (Ve < Ft) {
              let Ge = On.bias;
              if (Ge != 0) {
                let St = ii(Je, de.scale), gt = ke >= 0 ? 1 : -1, Tt = St >= 0 ? 1 : -1;
                Tt == gt && (Tt == 1 ? Ge == 1 ? ke >= St : ke <= St : (
                  // >= 0
                  Ge == 1 ? ke <= St : ke >= St
                )) && (Ft = Ve, Ni = ne);
              } else
                Ft = Ve, Ni = ne;
            }
          }
          if (Lt || ya) {
            let Je, Ve;
            A.ori == 0 ? (Je = Ee, Ve = Be) : (Je = Be, Ve = Ee);
            let Ge, St, gt, Tt, At, Jt, xi = !0, Ln = Qt.bbox;
            if (Ln != null) {
              xi = !1;
              let ai = Ln(i, ne);
              gt = ai.left, Tt = ai.top, Ge = ai.width, St = ai.height;
            } else
              gt = Je, Tt = Ve, Ge = St = Qt.size(i, ne);
            if (Jt = Qt.fill(i, ne), At = Qt.stroke(i, ne), ya)
              ne == Ni && Ft <= On.prox && (x = gt, k = Tt, z = Ge, R = St, U = xi, L = Jt, Q = At);
            else {
              let ai = Pn[ne];
              ai != null && (Cn[ne] = gt, Rn[ne] = Tt, ld(ai, Ge, St, xi), id(ai, Jt, At), qi(ai, ui(gt), ui(Tt), He, re));
            }
          }
        }
      }
      if (ya) {
        let ne = On.prox, de = ta == null ? Ft <= ne : Ft > ne || Ni != ta;
        if (Lt || de) {
          let ge = Pn[0];
          Cn[0] = x, Rn[0] = k, ld(ge, z, R, U), id(ge, L, Q), qi(ge, ui(x), ui(k), He, re);
        }
      }
    }
    if (Ot.show && vi)
      if (w != null) {
        let [d, h] = Xt.scales, [p, x] = Xt.match, [k, z] = w.cursor.sync.scales, R = w.cursor.drag;
        if (nn = R._x, on = R._y, nn || on) {
          let { left: U, top: L, width: Q, height: ne } = w.select, de = w.scales[k].ori, ge = w.posToVal, me, Se, ke, Ee, Be, Je = d != null && p(d, k), Ve = h != null && x(h, z);
          Je && nn ? (de == 0 ? (me = U, Se = Q) : (me = L, Se = ne), ke = Y[d], Ee = ee(ge(me, k), ke, o, 0), Be = ee(ge(me + Se, k), ke, o, 0), Ta(di(Ee, Be), vn(Be - Ee))) : Ta(0, o), Ve && on ? (de == 1 ? (me = U, Se = Q) : (me = L, Se = ne), ke = Y[h], Ee = I(ge(me, z), ke, s, 0), Be = I(ge(me + Se, z), ke, s, 0), Ri(di(Ee, Be), vn(Be - Ee))) : Ri(0, s);
        } else
          Dl();
      } else {
        let d = vn(Ca - fs), h = vn(Ua - xo);
        if (A.ori == 1) {
          let z = d;
          d = h, h = z;
        }
        nn = pn.x && d >= pn.dist, on = pn.y && h >= pn.dist;
        let p = pn.uni;
        p != null ? nn && on && (nn = d >= p, on = h >= p, !nn && !on && (h > d ? on = !0 : nn = !0)) : pn.x && pn.y && (nn || on) && (nn = on = !0);
        let x, k;
        nn && (A.ori == 0 ? (x = ea, k = $t) : (x = _a, k = Dt), Ta(di(x, k), vn(k - x)), on || Ri(0, s)), on && (A.ori == 1 ? (x = ea, k = $t) : (x = _a, k = Dt), Ri(di(x, k), vn(k - x)), nn || Ta(0, o)), !nn && !on && (Ta(0, 0), Ri(0, 0));
      }
    if (pn._x = nn, pn._y = on, w == null) {
      if (B) {
        if (Il != null) {
          let [d, h] = Xt.scales;
          Xt.values[0] = d != null ? ii(A.ori == 0 ? $t : Dt, d) : null, Xt.values[1] = h != null ? ii(A.ori == 1 ? $t : Dt, h) : null;
        }
        Za(Kc, i, $t, Dt, He, re, H);
      }
      if (va) {
        let d = B && Xt.setSeries, h = On.prox;
        ta == null ? Ft <= h && ni(Ni, Ma, !0, d) : Ft > h ? ni(null, Ma, !0, d) : Ni != ta && ni(Ni, Ma, !0, d);
      }
    }
    Lt && (ve.idx = H, za()), D !== !1 && Ut("setCursor");
  }
  let yi = null;
  Object.defineProperty(i, "rect", {
    get() {
      return yi == null && Da(!1), yi;
    }
  });
  function Da(w = !1) {
    w ? yi = null : (yi = C.getBoundingClientRect(), Ut("syncRect", yi));
  }
  function Oa(w, D, B, H, te, o, s) {
    Le._lock || vi && w != null && w.movementX == 0 && w.movementY == 0 || (wo(w, D, B, H, te, o, s, !1, w != null), w != null ? Li(null, !0, !0) : Li(D, !0, !1));
  }
  function wo(w, D, B, H, te, o, s, d, h) {
    if (yi == null && Da(!1), _n(w), w != null)
      B = w.clientX - yi.left, H = w.clientY - yi.top;
    else {
      if (B < 0 || H < 0) {
        $t = -10, Dt = -10;
        return;
      }
      let [p, x] = Xt.scales, k = D.cursor.sync, [z, R] = k.values, [U, L] = k.scales, [Q, ne] = Xt.match, de = D.axes[0].side % 2 == 1, ge = A.ori == 0 ? He : re, me = A.ori == 1 ? He : re, Se = de ? o : te, ke = de ? te : o, Ee = de ? H : B, Be = de ? B : H;
      if (U != null ? B = Q(p, U) ? c(z, Y[p], ge, 0) : -10 : B = ge * (Ee / Se), L != null ? H = ne(x, L) ? c(R, Y[x], me, 0) : -10 : H = me * (Be / ke), A.ori == 1) {
        let Je = B;
        B = H, H = Je;
      }
    }
    h && ((B <= 1 || B >= He - 1) && (B = tl(B, He)), (H <= 1 || H >= re - 1) && (H = tl(H, re))), d ? (fs = B, xo = H, [ea, _a] = Le.move(i, B, H)) : ($t = B, Dt = H);
  }
  const So = {
    width: 0,
    height: 0,
    left: 0,
    top: 0
  };
  function Dl() {
    zl(So, !1);
  }
  let vs, ys, bs, Ol;
  function xs(w, D, B, H, te, o, s) {
    vi = !0, nn = on = pn._x = pn._y = !1, wo(w, D, B, H, te, o, s, !0, !1), w != null && (Ht(Zr, Cu, Ga, !1), Za(Zc, i, ea, _a, He, re, null));
    let { left: d, top: h, width: p, height: x } = Ot;
    vs = d, ys = h, bs = p, Ol = x, Dl();
  }
  function Ga(w, D, B, H, te, o, s) {
    vi = pn._x = pn._y = !1, wo(w, D, B, H, te, o, s, !1, !0);
    let { left: d, top: h, width: p, height: x } = Ot, k = p > 0 || x > 0, z = vs != d || ys != h || bs != p || Ol != x;
    if (k && z && zl(Ot), pn.setScale && k && z) {
      let R = d, U = p, L = h, Q = x;
      if (A.ori == 1 && (R = h, U = x, L = d, Q = p), nn && Sn(
        M,
        ii(R, M),
        ii(R + U, M)
      ), on)
        for (let ne in Y) {
          let de = Y[ne];
          ne != M && de.from == null && de.min != dt && Sn(
            ne,
            ii(L + Q, ne),
            ii(L, ne)
          );
        }
      Dl();
    } else Le.lock && (Le._lock = !Le._lock, Li(null, !0, !1));
    w != null && (pi(Zr, Cu), Za(Zr, i, $t, Dt, He, re, null));
  }
  function Ar(w, D, B, H, te, o, s) {
    if (Le._lock)
      return;
    _n(w);
    let d = vi;
    if (vi) {
      let h = !0, p = !0, x = 10, k, z;
      A.ori == 0 ? (k = nn, z = on) : (k = on, z = nn), k && z && (h = $t <= x || $t >= He - x, p = Dt <= x || Dt >= re - x), k && h && ($t = $t < ea ? 0 : He), z && p && (Dt = Dt < _a ? 0 : re), Li(null, !0, !0), vi = !1;
    }
    $t = -10, Dt = -10, Li(null, !0, !0), d && (vi = d);
  }
  function Pl(w, D, B, H, te, o, s) {
    Le._lock || (_n(w), ho(), Dl(), w != null && Za(Jc, i, $t, Dt, He, re, null));
  }
  function ws() {
    N.forEach(Bx), fn(i.width, i.height, !0);
  }
  rl(Xs, Gl, ws);
  const Pa = {};
  Pa.mousedown = xs, Pa.mousemove = Oa, Pa.mouseup = Ga, Pa.dblclick = Pl, Pa.setSeries = (w, D, B, H) => {
    let te = Xt.match[2];
    B = te(i, D, B), B != -1 && ni(B, H, !0, !1);
  }, Le.show && (Ht(Zc, C, xs), Ht(Kc, C, Oa), Ht(Qc, C, (w) => {
    _n(w), Da(!1);
  }), Ht(Xc, C, Ar), Ht(Jc, C, Pl), Eu.add(i), i.syncRect = Da);
  const Ka = i.hooks = e.hooks || {};
  function Ut(w, D, B) {
    Tl ? Sa.push([w, D, B]) : w in Ka && Ka[w].forEach((H) => {
      H.call(null, i, D, B);
    });
  }
  (e.plugins || []).forEach((w) => {
    for (let D in w.hooks)
      Ka[D] = (Ka[D] || []).concat(w.hooks[D]);
  });
  const bi = (w, D, B) => B, Xt = cn({
    key: null,
    setSeries: !1,
    filters: {
      pub: cd,
      sub: cd
    },
    scales: [M, V[1] ? V[1].scale : null],
    match: [dd, dd, bi],
    values: [null, null]
  }, Le.sync);
  Xt.match.length == 2 && Xt.match.push(bi), Le.sync = Xt;
  const Il = Xt.key, ko = gg(Il);
  function Za(w, D, B, H, te, o, s) {
    Xt.filters.pub(w, D, B, H, te, o, s) && ko.pub(w, D, B, H, te, o, s);
  }
  ko.sub(i);
  function Nr(w, D, B, H, te, o, s) {
    Xt.filters.sub(w, D, B, H, te, o, s) && Pa[w](null, D, B, H, te, o, s);
  }
  i.pub = Nr;
  function Rr() {
    ko.unsub(i), Eu.delete(i), vt.clear(), zu(Xs, Gl, ws), y.remove(), Me?.remove(), Ut("destroy");
  }
  i.destroy = Rr;
  function _o() {
    Ut("init", e, t), fo(t || e.data, !1), $[M] ? yo(M, $[M]) : ho(), dn = Ot.show && (Ot.width > 0 || Ot.height > 0), kn = Lt = !0, fn(e.width, e.height);
  }
  return V.forEach(as), N.forEach(Xe), n ? n instanceof HTMLElement ? (n.appendChild(y), _o()) : n(i, _o) : _o(), i;
}
rn.assign = cn;
rn.fmtNum = hc;
rn.rangeNum = Js;
rn.rangeLog = mr;
rn.rangeAsinh = dc;
rn.orient = vl;
rn.pxRatio = kt;
rn.join = A1;
rn.fmtDate = pc, rn.tzDate = j1;
rn.sync = gg;
{
  rn.addGap = zx, rn.clipGaps = br;
  let e = rn.paths = {
    points: xg
  };
  e.linear = Sg, e.stepped = Px, e.bars = Ix, e.spline = $x;
}
function Hx(e, t) {
  if (!e || e.length === 0)
    return [null, null];
  let n = null, i = null;
  for (const { thresholdValue: a } of e)
    a !== void 0 && ((n === null || a < n) && (n = a), (i === null || a > i) && (i = a));
  return [n, i];
}
function jx({
  distr: e,
  logBase: t,
  limits: n
}) {
  if (e !== sl.Logarithmic)
    return n;
  const i = t === 2 ? Math.log2 : Math.log10;
  return {
    min: zs(n.min, t, i, Math.floor),
    max: zs(n.max, t, i, Math.ceil),
    softMin: zs(n.softMin, t, i, Math.floor),
    softMax: zs(n.softMax, t, i, Math.ceil)
  };
}
function zs(e, t, n, i) {
  return e == null || e <= 0 ? e : t ** i(n(e));
}
function Ux({
  time: e,
  distr: t,
  logBase: n
}) {
  if (e)
    return {};
  const i = (n ?? 10) === 2 ? 2 : 10;
  return {
    distr: t === sl.Logarithmic ? 3 : t === sl.Symlog ? 2 : 1,
    log: i
  };
}
function Gx(e, t, n, i, a, l) {
  const u = n == null ? 3 : 1, r = i == null ? 3 : 1, c = {
    min: {
      pad: a,
      hard: e ?? -1 / 0,
      soft: n !== null ? n : void 0,
      mode: u
    },
    max: {
      pad: l,
      hard: t ?? 1 / 0,
      soft: i !== null ? i : void 0,
      mode: r
    }
  }, g = n == null && e != null, y = i == null && t != null;
  return { rangeConfig: c, hardMinOnly: g, hardMaxOnly: y, hasFixedRange: g && y };
}
function Kx(e, t, n) {
  return !n && e == null && t == null ? null : [e, t];
}
function Zx(e, t, n, i) {
  const { rangeConfig: a, hardMinOnly: l, hardMaxOnly: u, min: r, max: c } = t, g = l ? r : n, y = u ? c : i;
  return g == null || y == null ? e : rn.rangeNum(g, y, a);
}
function Qx(e, t, n, i, a) {
  const l = t.min ?? n, u = t.max ?? i;
  return l == null || u == null ? e : rn.rangeLog(l, u, a ?? 10, !0);
}
function Xx(e, t, n) {
  let [i, a] = e;
  return i != null && (i = t ** Math.floor(n(i))), a != null && (a = t ** Math.ceil(n(a)), i === a && (a *= t)), [i, a];
}
function Jx(e, t, n) {
  if (n !== 1)
    return e;
  let [i, a] = e;
  return t.hardMinOnly && t.min != null && (i = t.min), t.hardMaxOnly && t.max != null && (a = t.max), [i, a];
}
function ew(e, t) {
  const [n, i] = e;
  return n != null && i != null && n >= i ? [t === 3 ? 1 : 0, 100] : e;
}
function tw(e) {
  return (t, n, i, a) => {
    const l = t.scales[a], u = Kx(n, i, e.hasFixedRange);
    if (!u)
      return [n, i];
    let r = u;
    const c = l.log;
    if (l.distr === 1)
      r = Zx(r, e, n, i);
    else if (l.distr === 3) {
      r = Qx(r, e, n, i, c);
      const g = l.log === 2 ? Math.log2 : Math.log10;
      r = Xx(r, c ?? 10, g);
    }
    return r = Jx(r, e, l.distr ?? 1), ew(r, l.distr ?? 1);
  };
}
function nw(e, t, n, i) {
  if (!n || n.length === 0)
    return { softMin: e, softMax: t };
  const [a, l] = Hx(n);
  if (a === null && l === null)
    return { softMin: e, softMax: t };
  const u = a !== null ? e !== null ? Math.min(e, a) : a : e, r = l !== null ? t !== null ? Math.max(t, l) : l : t;
  return { softMin: u, softMax: r };
}
class iw extends pr {
  softMin;
  softMax;
  min;
  max;
  constructor(t) {
    super(t);
    const n = t.softMin === 0 && t.softMax === 0;
    this.softMin = n ? null : t.softMin ?? null, this.softMax = n ? null : t.softMax ?? null, this.min = t.min ?? null, this.max = t.max ?? null;
  }
  getConfig() {
    const {
      scaleKey: t,
      time: n,
      range: i,
      thresholds: a,
      logBase: l = 10,
      padMinBy: u = 0,
      padMaxBy: r = 0.05
    } = this.props;
    if (n) {
      if (this.min != null && this.max != null) {
        const W = this.min;
        let G = this.max;
        const Z = new Date(G * 1e3);
        return Z.setSeconds(0), Z.setMilliseconds(0), G = Math.floor(Z.getTime() / 1e3) + 60, { [t]: { time: !0, auto: !1, range: [W, G] } };
      }
      return { [t]: { time: !0, auto: !0 } };
    }
    const c = this.props.distribution, g = a?.thresholds, { softMin: y, softMax: v } = nw(
      this.softMin,
      this.softMax,
      g,
      a?.yAxisUnit
    ), { min: m, max: S, softMin: T, softMax: C } = jx({
      distr: c,
      logBase: l,
      limits: {
        min: this.min,
        max: this.max,
        softMin: y,
        softMax: v
      }
    }), E = Ux({ time: n, distr: c, logBase: l }), { rangeConfig: X, hardMinOnly: F, hardMaxOnly: V, hasFixedRange: N } = Gx(
      m,
      S,
      T,
      C,
      u,
      r
    ), Y = tw({
      rangeConfig: X,
      hardMinOnly: F,
      hardMaxOnly: V,
      hasFixedRange: N,
      min: m,
      max: S
    });
    let K = this.props.auto;
    return K ??= !n && !N, {
      [t]: {
        time: n,
        auto: K,
        range: i ?? Y,
        ...E
      }
    };
  }
  merge(t) {
    this.props = { ...this.props, ...t }, t.softMin !== void 0 && (this.softMin = t.softMin ?? null), t.softMax !== void 0 && (this.softMax = t.softMax ?? null), t.min !== void 0 && (this.min = t.min ?? null), t.max !== void 0 && (this.max = t.max ?? null);
  }
}
const tu = {};
let Ed = 0;
const $d = [
  "#4096ff",
  "#52c41a",
  "#faad14",
  "#ff4d4f",
  "#722ed1",
  "#13c2c2",
  "#eb2f96",
  "#fa8c16",
  "#a0d911",
  "#1677ff"
];
function aw(e) {
  if (tu[e])
    return tu[e];
  const t = $d[Ed % $d.length];
  return Ed++, tu[e] = t, t;
}
const Ad = {
  white: "#ffffff",
  black: "#000000"
};
function lw(e, t, n, i = 100) {
  const a = e.ctx.createLinearGradient(0, 0, 0, e.bbox.height), l = Math.round(i / 100 * 112).toString(16).padStart(2, "0"), u = Math.round(i / 100 * 64).toString(16).padStart(2, "0");
  return a.addColorStop(0, `${t}${l}`), a.addColorStop(0.6, `${t}${u}`), a.addColorStop(1, n), a;
}
function ow(e, t) {
  for (let n = 1; n < 100; n++) {
    if (e[t + n] != null)
      return t + n;
    if (e[t - n] != null)
      return t - n;
  }
  return t;
}
function sw(e, t, n) {
  const i = [];
  for (let a = 0; a < e.length; a++) {
    const l = e[a + 1];
    if (l && e[a][1] === l[0]) {
      const u = n.posToIdx(e[a][1], !0);
      i.push(t[u] == null ? ow(t, u) : u);
    }
  }
  return i;
}
function rw(e, t, n, i) {
  if (n || !i || i.length === 0)
    return null;
  const a = e.series[t].idxs;
  if (!a)
    return null;
  const [l, u] = a, r = e.data[0], c = e.data[t], g = Math.round(e.valToPos(r[l], "x", !0)), y = Math.round(e.valToPos(r[u], "x", !0)), v = [];
  return i[0][0] === g && v.push(l), v.push(...sw(i, c, e)), i[i.length - 1][1] === y && v.push(u), v.length ? v : null;
}
const Nd = 2, uw = 2.5;
let $n = null;
class cw extends pr {
  constructor(t) {
    if (super(t), !$n) {
      const n = rn.paths, i = n.linear, a = n.spline, l = n.stepped;
      if (!i || !a || !l)
        throw new Error("Required uPlot path builders are not available");
      $n = {
        linear: i(),
        spline: a(),
        stepBefore: l({ align: -1 }),
        stepAfter: l({ align: 1 })
      };
    }
  }
  getLineColor() {
    const { colorMapping: t, lineColor: n, label: i, isDarkMode: a } = this.props;
    return i ? n ?? t?.[i] ?? aw(i) : n ?? (a ? Ad.white : Ad.black);
  }
  buildLineConfig({ resolvedLineColor: t }) {
    const { lineWidth: n, lineStyle: i, lineCap: a, fillColor: l, fillMode: u, fillOpacity: r } = this.props, c = {
      stroke: t,
      width: n ?? Nd
    }, g = r != null && r > 0 ? Math.round(Math.min(r, 100) / 100 * 255).toString(16).padStart(2, "0") : null;
    i === _u.Dashed && (c.dash = [10, 10]), i === _u.Dotted && (c.dash = [2, 6]), a && (c.cap = a);
    const y = l ?? t;
    return this.props.drawStyle === Wi.Bars ? c.fill = g ? `${y}${g}` : y : this.props.drawStyle === Wi.Histogram ? c.fill = `${y}${g ?? "40"}` : u && u !== qo.None ? u === qo.Solid ? c.fill = g ? `${y}${g}` : y : u === qo.Gradient && (c.fill = (v) => lw(v, y, "rgba(0, 0, 0, 0)", r ?? 100)) : g && (c.fill = `${y}${g}`), c;
  }
  buildPathConfig() {
    const {
      pathBuilder: t,
      drawStyle: n,
      lineInterpolation: i,
      barAlignment: a,
      barMaxWidth: l,
      barWidthFactor: u,
      stepInterval: r
    } = this.props;
    return t ? { paths: t } : n === Wi.Points ? { paths: () => null } : n != null ? {
      paths: (c, g, y, v) => dw({
        drawStyle: n,
        lineInterpolation: i,
        barAlignment: a,
        barMaxWidth: l,
        barWidthFactor: u,
        stepInterval: r
      })(c, g, y, v)
    } : {};
  }
  resolvePointsShow() {
    const { pointsBuilder: t, drawStyle: n, showPoints: i } = this.props;
    return t || (n === Wi.Points ? !0 : !!i);
  }
  shouldApplyIsolatedPointFilter(t) {
    const { drawStyle: n, pointsFilter: i } = this.props;
    return n === Wi.Lines && !i && !t;
  }
  buildPointsConfig({ resolvedLineColor: t }) {
    const { lineWidth: n, pointSize: i, pointsFilter: a } = this.props, l = i ?? (n ?? Nd) * uw, u = {
      stroke: t,
      fill: t,
      size: l,
      filter: a || void 0,
      show: this.resolvePointsShow()
    };
    return this.shouldApplyIsolatedPointFilter(u.show) && (u.filter = rw), u;
  }
  getConfig() {
    const { scaleKey: t, label: n, spanGaps: i, show: a = !0, metric: l } = this.props, u = this.getLineColor(), r = this.buildLineConfig({ resolvedLineColor: u }), c = this.buildPathConfig(), g = this.buildPointsConfig({ resolvedLineColor: u });
    return {
      scale: t,
      label: n,
      spanGaps: typeof i == "number" ? !1 : i ?? !0,
      value: () => "",
      pxAlign: !0,
      show: a,
      metric: l,
      ...r,
      ...c,
      points: Object.keys(g).length > 0 ? g : void 0
    };
  }
  merge(t) {
    this.props = { ...this.props, ...t };
  }
}
function dw({
  drawStyle: e,
  lineInterpolation: t,
  barAlignment: n = Fh.Center,
  barWidthFactor: i = 0.6,
  barMaxWidth: a = 200,
  stepInterval: l
}) {
  if (!$n)
    throw new Error("Required uPlot path builders are not available");
  if (e === Wi.Bars || e === Wi.Histogram) {
    const u = rn.paths;
    return fw({ pathBuilders: u, barAlignment: n, barWidthFactor: i, barMaxWidth: a, stepInterval: l });
  }
  if (e === Wi.Lines) {
    if (t === qs.StepBefore)
      return $n.stepBefore;
    if (t === qs.StepAfter)
      return $n.stepAfter;
    if (t === qs.Linear)
      return $n.linear;
  }
  return $n.spline;
}
function fw({
  pathBuilders: e,
  barAlignment: t,
  barWidthFactor: n,
  barMaxWidth: i,
  stepInterval: a
}) {
  if (!$n)
    throw new Error("Required uPlot path builders are not available");
  const l = e.bars;
  if (typeof a == "number" && a > 0 && l)
    return (r, c, g, y) => {
      let v = i;
      const m = Yh({
        uPlotInstance: r,
        stepInterval: a
      });
      m > 0 && (v = Math.min(v, m));
      const S = `bars|${t}|${n}|${v}`;
      return $n && !$n[S] && ($n[S] = l({
        size: [n, v],
        align: t
      })), $n?.[S]?.(r, c, g, y) ?? null;
    };
  const u = `bars|${t}|${n}|${i}`;
  return !$n[u] && l && ($n[u] = l({
    size: [n, i],
    align: t
  })), $n[u];
}
class Mg extends pr {
  series = [];
  selectionPreferencesSource = ku.IN_MEMORY;
  shouldSaveSelectionPreference = !1;
  axes = {};
  stepInterval;
  scales = [];
  bands = [];
  cursor;
  hooks = {};
  plugins = [];
  padding;
  legend;
  focus;
  select;
  thresholds = {};
  tzDate;
  id;
  onDragSelect;
  constructor(t) {
    super(t);
    const {
      id: n,
      onDragSelect: i,
      tzDate: a,
      selectionPreferencesSource: l,
      shouldSaveSelectionPreference: u,
      stepInterval: r
    } = t ?? {};
    this.id = n, a && (this.tzDate = a), l && (this.selectionPreferencesSource = l), u && (this.shouldSaveSelectionPreference = u), r && (this.stepInterval = r), this.onDragSelect = () => {
    }, i && (this.onDragSelect = i, this.addHook("setSelect", (c) => {
      const g = c.select;
      if (g && g.width > 0) {
        const y = c.posToVal(g.left, "x"), v = c.posToVal(g.left + g.width, "x");
        this.onDragSelect(y * 1e3, v * 1e3);
      }
    }));
  }
  getShouldSaveSelectionPreference() {
    return this.shouldSaveSelectionPreference;
  }
  getId() {
    return this.id;
  }
  addAxis(t) {
    const { scaleKey: n } = t;
    if (this.axes[n]) {
      this.axes[n].merge?.(t);
      return;
    }
    this.axes[n] = new Vb(t);
  }
  addScale(t) {
    const n = this.scales.find((i) => i.props.scaleKey === t.scaleKey);
    if (n) {
      n.merge?.(t);
      return;
    }
    this.scales.push(new iw(t));
  }
  addSeries(t) {
    this.series.push(new cw(t));
  }
  getSeriesSpanGapsOptions() {
    return this.series.map((t) => {
      const { spanGaps: n } = t.props;
      return { spanGaps: n };
    });
  }
  addHook(t, n) {
    return this.hooks[t] || (this.hooks[t] = []), this.hooks[t].push(n), () => {
      const i = this.hooks[t].indexOf(n);
      i !== -1 && this.hooks[t].splice(i, 1);
    };
  }
  addPlugin(t) {
    this.plugins.push(t);
  }
  addThresholds(t) {
    this.thresholds[t.scaleKey] || (this.thresholds[t.scaleKey] = t, this.addHook("draw", Ub(t)));
  }
  setBands(t) {
    this.bands = t;
  }
  setCursor(t) {
    this.cursor = Tc({}, this.cursor, t);
  }
  setPadding(t) {
    this.padding = t;
  }
  setLegend(t) {
    this.legend = t;
  }
  setFocus(t) {
    this.focus = t;
  }
  setSelect(t) {
    this.select = t;
  }
  setTzDate(t) {
    this.tzDate = t;
  }
  getCursorConfig() {
    const t = {
      ...Gr,
      hover: {
        ...Gr.hover,
        prox: this.stepInterval ? (n) => Yh({
          uPlotInstance: n,
          stepInterval: this.stepInterval ?? 0
        }) * Bb : Vh
      }
    };
    return Tc({}, Gr, t, this.cursor);
  }
  getStoredVisibility() {
    return this.id && this.selectionPreferencesSource === ku.LOCAL_STORAGE ? Gb(this.id) : null;
  }
  getVisibilityResolutionState() {
    const t = this.getStoredVisibility();
    if (!t || t.length === 0)
      return {
        visibleStoredLabels: /* @__PURE__ */ new Set(),
        hiddenStoredLabels: /* @__PURE__ */ new Set(),
        hasActivePreference: !1
      };
    const n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
    let a = !1, l = !1;
    for (const { label: v, show: m } of t)
      m ? (a = !0, n.add(v), i.has(v) && i.delete(v)) : (l = !0, n.has(v) || i.add(v));
    const u = a && l, r = this.series.map(
      (v) => v.getConfig().label ?? ""
    ), c = n.size > 0 && r.some((v) => n.has(v)), g = u && c;
    return !u || g ? { visibleStoredLabels: n, hiddenStoredLabels: i, hasActivePreference: g } : {
      visibleStoredLabels: /* @__PURE__ */ new Set(),
      hiddenStoredLabels: /* @__PURE__ */ new Set(),
      hasActivePreference: g
    };
  }
  getLegendItems() {
    const { visibleStoredLabels: t, hiddenStoredLabels: n, hasActivePreference: i } = this.getVisibilityResolutionState();
    return this.series.reduce(
      (a, l, u) => {
        const r = l.getConfig(), c = r.label ?? "", g = u + 1, y = Hc({
          seriesShow: r.show,
          seriesLabel: c,
          visibleStoredLabels: t,
          hiddenStoredLabels: n,
          hasActivePreference: i
        });
        return a[g] = {
          seriesIndex: g,
          color: r.stroke ?? "#ccc",
          label: c,
          show: y,
          yAxis: 1
        }, a;
      },
      {}
    );
  }
  getConfig() {
    const t = { ...Hb }, { visibleStoredLabels: n, hiddenStoredLabels: i, hasActivePreference: a } = this.getVisibilityResolutionState();
    return t.series = [
      { value: () => "", label: "Timestamp" },
      ...this.series.map((l) => {
        const u = l.getConfig(), r = Hc({
          seriesShow: u.show,
          seriesLabel: u.label ?? "",
          visibleStoredLabels: n,
          hiddenStoredLabels: i,
          hasActivePreference: a
        });
        return { ...u, show: r };
      })
    ], t.axes = Object.values(this.axes).map((l) => l.getConfig()), t.scales = this.scales.reduce(
      (l, u) => ({ ...l, ...u.getConfig() }),
      {}
    ), t.hooks = this.hooks, t.select = this.select, t.cursor = this.getCursorConfig(), t.tzDate = this.tzDate, t.plugins = this.plugins.length > 0 ? this.plugins : void 0, t.bands = this.bands.length > 0 ? this.bands : void 0, Array.isArray(this.padding) && (t.padding = this.padding), this.legend && (t.legend = this.legend), this.focus && (t.focus = this.focus), t;
  }
}
function Rd(e, t) {
  return t.some(
    ({ spanGaps: n }) => typeof n == "number" && n > 0 && e > n
  );
}
function hw(e, t) {
  const n = JSON.parse(JSON.stringify(e)), [i, ...a] = n;
  if (!Array.isArray(i) || i.length < 2 || a.length === 0)
    return n;
  const l = i, u = l.length;
  let r = 0;
  for (let m = 0; m < u - 1; m += 1)
    Rd(l[m + 1] - l[m], t) && (r += 1);
  if (r === 0)
    return e;
  const c = u + r, g = Array.from({ length: c }), y = a.map(
    () => Array.from({ length: c })
  );
  let v = 0;
  for (let m = 0; m < u; m += 1) {
    g[v] = l[m];
    for (const [S, T] of a.entries())
      y[S][v] = T[m];
    if (v += 1, m < u - 1 && Rd(l[m + 1] - l[m], t)) {
      g[v] = l[m] + Math.max(1, Math.floor((l[m + 1] - l[m]) / 2));
      for (let S = 0; S < a.length; S += 1)
        y[S][v] = null;
      v += 1;
    }
  }
  return [g, ...y];
}
function gw(e, t) {
  const n = JSON.parse(JSON.stringify(e)), [i, ...a] = n;
  if (!Array.isArray(i) || a.length === 0)
    return n;
  const u = t.some(({ spanGaps: v }) => typeof v == "number") ? hw(n, t) : n;
  if (!t.some(({ spanGaps: v }) => v === !0))
    return u;
  const [c, ...g] = u, y = g.map((v, m) => {
    const { spanGaps: S } = t[m] ?? {};
    return S !== !0 ? v : v.map(
      (T) => T === null ? void 0 : T
    );
  });
  return [c, ...y];
}
const Tg = /\{\{(\w+)(?::(\w+))?\}\}/g;
function pw(e, t) {
  if (typeof e == "number")
    return String(e);
  const n = Array.isArray(e) ? e : [e];
  switch (t) {
    case "csv":
      return n.join(",");
    case "sql":
      return n.map((i) => `'${i.replaceAll("'", "''")}'`).join(",");
    case "pipe":
      return n.join("|");
    case "single":
    default:
      return n[0] ?? "";
  }
}
function Al(e, t) {
  return e.replaceAll(Tg, (n, i, a) => {
    const l = t[i];
    return l == null ? n : pw(l, a || "single");
  });
}
function mw(e) {
  const t = /* @__PURE__ */ new Set();
  let n;
  const i = new RegExp(Tg.source, "g");
  for (; (n = i.exec(e)) !== null; )
    t.add(n[1]);
  return Array.from(t);
}
class vw {
  nodes = /* @__PURE__ */ new Map();
  ensureNode(t) {
    return this.nodes.has(t) || this.nodes.set(t, { name: t, dependsOn: [], dependents: [] }), this.nodes.get(t);
  }
  addVariable(t) {
    const n = t.name, i = this.ensureNode(n);
    for (const a of i.dependsOn) {
      const l = this.nodes.get(a);
      l && (l.dependents = l.dependents.filter((u) => u !== n));
    }
    i.dependsOn = [], t.query && (i.dependsOn = mw(t.query));
    for (const a of i.dependsOn)
      this.ensureNode(a).dependents.push(n);
  }
  removeVariable(t) {
    const n = this.nodes.get(t);
    if (n) {
      for (const i of n.dependsOn) {
        const a = this.nodes.get(i);
        a && (a.dependents = a.dependents.filter((l) => l !== t));
      }
      for (const i of n.dependents) {
        const a = this.nodes.get(i);
        a && (a.dependsOn = a.dependsOn.filter((l) => l !== t));
      }
      this.nodes.delete(t);
    }
  }
  getDependents(t) {
    return this.nodes.get(t)?.dependents ?? [];
  }
  getAllDependents(t) {
    const n = /* @__PURE__ */ new Set(), i = [], a = (l) => {
      if (n.has(l))
        return;
      n.add(l);
      const u = this.getDependents(l);
      for (const r of u)
        i.push(r), a(r);
    };
    return a(t), i;
  }
  detectCycle() {
    const a = /* @__PURE__ */ new Map(), l = [];
    for (const r of this.nodes.keys())
      a.set(r, 0);
    const u = (r) => {
      a.set(r, 1);
      const c = this.nodes.get(r);
      if (c)
        for (const g of c.dependsOn) {
          const y = a.get(g);
          if (y === 1)
            return l.push(g, r), !0;
          if (y === 0 && u(g))
            return l.push(r), !0;
        }
      return a.set(r, 2), !1;
    };
    for (const r of this.nodes.keys())
      if (a.get(r) === 0 && u(r))
        return l.reverse();
    return null;
  }
  topologicalSort() {
    const t = /* @__PURE__ */ new Set(), n = [], i = (a) => {
      if (t.has(a))
        return;
      t.add(a);
      const l = this.nodes.get(a);
      if (l)
        for (const u of l.dependsOn)
          i(u);
      n.push(a);
    };
    for (const a of this.nodes.keys())
      i(a);
    return n;
  }
  clear() {
    this.nodes.clear();
  }
}
function yw(e, t, n, i) {
  const a = /* @__PURE__ */ new Map();
  for (const r of e) {
    const c = Number(r.clock), g = Math.round(c / i) * i, y = Number.parseFloat(r.value);
    a.set(g, Number.isNaN(y) ? null : y);
  }
  const l = [], u = Math.ceil(t / i) * i;
  for (let r = u; r <= n; r += i)
    l.push({ ts: r * 1e3, value: a.get(r) ?? null });
  return l;
}
function bw(e, t) {
  return e.map((n) => n === null ? null : n * t);
}
function xw(e, t) {
  return e.map((n) => n === null ? null : n + t);
}
function ww(e) {
  return e.map((t, n) => {
    if (n === 0)
      return 0;
    const i = e[n - 1];
    return t === null || i === null ? null : t - i;
  });
}
function Sw(e, t) {
  return e.map((n, i) => {
    if (i === 0)
      return 0;
    const a = e[i - 1];
    if (n === null || a === null)
      return null;
    const l = t[i] - t[i - 1];
    return l > 0 ? (n - a) / l : 0;
  });
}
function kw(e, t) {
  return e.map((n, i) => {
    const a = Math.max(0, i - t + 1), l = e.slice(a, i + 1).filter((u) => u !== null);
    return l.length === 0 ? null : l.reduce((u, r) => u + r, 0) / l.length;
  });
}
function _w(e, t) {
  const n = [];
  let i = null;
  for (const a of e)
    if (a === null)
      n.push(null);
    else if (i === null)
      n.push(a), i = a;
    else {
      const l = t * a + (1 - t) * i;
      n.push(l), i = l;
    }
  return n;
}
function Cw(e, t) {
  return e.map((n) => n !== null && n > t ? Number.NaN : n);
}
function Mw(e, t) {
  return e.map((n) => n !== null && n < t ? Number.NaN : n);
}
function Tw(e, t) {
  return e.map((n) => n === null || Number.isNaN(n) ? t : n);
}
function zw(e) {
  if (e.length === 0)
    return e;
  const t = e[0].values.length;
  return [{ label: "sumSeries", values: Array.from({ length: t }, (i, a) => e.every((u) => u.values[a] === null) ? null : e.reduce((u, r) => u + (r.values[a] ?? 0), 0)) }];
}
function Dw(e, t, n) {
  return e.map((a) => {
    const l = a.values.filter((r) => r !== null && !Number.isNaN(r));
    let u = 0;
    return n === "max" ? u = l.reduce((r, c) => Math.max(r, c), -1 / 0) : n === "min" ? u = l.reduce((r, c) => Math.min(r, c), 1 / 0) : u = l.reduce((r, c) => r + c, 0) / (l.length || 1), { s: a, score: u };
  }).sort((a, l) => l.score - a.score).slice(0, t).map((a) => a.s);
}
function Ow(e, t, n) {
  return e.map((a) => {
    const l = a.values.filter((r) => r !== null && !Number.isNaN(r));
    let u = 0;
    return n === "max" ? u = l.reduce((r, c) => Math.max(r, c), -1 / 0) : n === "min" ? u = l.reduce((r, c) => Math.min(r, c), 1 / 0) : u = l.reduce((r, c) => r + c, 0) / (l.length || 1), { s: a, score: u };
  }).sort((a, l) => a.score - l.score).slice(0, t).map((a) => a.s);
}
function Pw(e, t) {
  if (!t || t.length === 0)
    return e;
  const { timestamps: n, series: i } = e;
  let a = i;
  for (const l of t) {
    const u = l.def.name, r = l.params;
    switch (u) {
      case "scale":
        a = a.map((c) => ({ ...c, values: bw(c.values, Number(r[0])) }));
        break;
      case "offset":
        a = a.map((c) => ({ ...c, values: xw(c.values, Number(r[0])) }));
        break;
      case "delta":
        a = a.map((c) => ({ ...c, values: ww(c.values) }));
        break;
      case "rate":
        a = a.map((c) => ({ ...c, values: Sw(c.values, n) }));
        break;
      case "movingAverage":
        a = a.map((c) => ({ ...c, values: kw(c.values, Number(r[0])) }));
        break;
      case "exponentialMovingAverage":
        a = a.map((c) => ({ ...c, values: _w(c.values, Number(r[0])) }));
        break;
      case "removeAboveValue":
        a = a.map((c) => ({ ...c, values: Cw(c.values, Number(r[0])) }));
        break;
      case "removeBelowValue":
        a = a.map((c) => ({ ...c, values: Mw(c.values, Number(r[0])) }));
        break;
      case "transformNull":
        a = a.map((c) => ({ ...c, values: Tw(c.values, Number(r[0])) }));
        break;
      case "sumSeries":
        a = zw(a);
        break;
      case "top":
        a = Dw(a, Number(r[0]), String(r[1] ?? "avg"));
        break;
      case "bottom":
        a = Ow(a, Number(r[0]), String(r[1] ?? "avg"));
        break;
      case "setAlias":
        a = a.map((c) => ({ ...c, label: String(r[0] ?? "") }));
        break;
      case "replaceAlias":
        a = a.map((c) => ({ ...c, label: c.label.replace(new RegExp(String(r[0] ?? "")), String(r[1] ?? "")) }));
        break;
    }
  }
  return { timestamps: n, series: a };
}
function Iw(e, t, n, i) {
  const a = t[0], l = (e.get(a?.itemid ?? "") ?? []).map((r) => r.ts), u = new Z0({ name: "zabbix", refId: i, fields: [] });
  u.addField({ name: "Time", type: an.time, values: l });
  for (const r of t) {
    const g = (e.get(r.itemid) ?? []).map((v) => v.value), y = r.valuemapid ? n.get(r.valuemapid) : void 0;
    u.addField({
      name: r.name.replace(/^[\s:]+/, "").trim(),
      type: an.number,
      values: g,
      labels: { host: r.hostid, item_key: r.key_ },
      config: {
        unit: r.units || void 0,
        displayNameFromDS: r.name.replace(/^[\s:]+/, "").trim(),
        ...y ? {
          mappings: [{
            type: 1,
            // MappingType.ValueToText
            options: Object.fromEntries(
              Object.entries(y).map(([v, m], S) => [v, { text: m, index: S }])
            )
          }]
        } : {}
      }
    });
  }
  return u;
}
let Ew = 1;
async function fi(e, t, n) {
  const { url: i, token: a } = n, l = {
    jsonrpc: "2.0",
    method: e,
    params: t,
    auth: a,
    id: Ew++
  }, u = await fetch(`${i}?_m=${e}`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(l)
  });
  if (!u.ok)
    throw new Error(`Zabbix API HTTP error: ${u.status}`);
  const r = await u.json();
  if (r.error)
    throw new Error(`Zabbix API error [${r.error.code}]: ${r.error.data}`);
  return r.result;
}
function $w(e) {
  return fi(
    "hostgroup.get",
    {
      output: ["groupid", "name"],
      sortfield: "name",
      limit: 200
    },
    e
  );
}
function Aw(e, t, n) {
  return fi(
    "host.get",
    {
      output: ["hostid", "host", "name"],
      ...e?.length ? { groupids: e } : {},
      sortfield: "name",
      limit: 200
    },
    n
  );
}
function zg(e, t, n, i, a) {
  const l = a ? Rw(a) : void 0;
  return fi(
    "item.get",
    {
      output: ["itemid", "hostid", "name", "key_", "value_type", "units", "valuemapid"],
      selectTags: "extend",
      hostids: e,
      filter: { value_type: ["0", "3"] },
      ...l ? { tags: [l], evaltype: 0 } : {},
      sortfield: "name",
      limit: 500
    },
    i
  );
}
function Nw(e, t) {
  return fi(
    "item.get",
    {
      output: ["itemid", "hostid", "name", "key_", "value_type", "units", "valuemapid"],
      itemids: e,
      sortfield: "name"
    },
    t
  );
}
function Rw(e) {
  const t = e.indexOf(":");
  return t > 0 ? { tag: e.slice(0, t).trim(), value: e.slice(t + 1).trim(), operator: 0 } : { tag: e.trim(), value: "", operator: 2 };
}
function Lw(e) {
  return e.value ? `${e.tag}: ${e.value}` : e.tag;
}
function qw(e, t, n) {
  return fi(
    "item.get",
    {
      output: ["itemid", "hostid", "name", "key_", "value_type", "units", "valuemapid"],
      hostids: e,
      filter: { value_type: ["1", "2", "4"] },
      sortfield: "name",
      limit: 500
    },
    n
  );
}
function Fw(e, t) {
  return fi(
    "usermacro.get",
    {
      output: ["hostmacroid", "macro", "value"],
      ...e?.length ? { hostids: e } : {},
      sortfield: "macro",
      limit: 200
    },
    t
  );
}
function Vw(e) {
  return fi(
    "service.get",
    {
      output: ["serviceid", "name"],
      sortfield: "name",
      limit: 200
    },
    e
  );
}
async function Ww(e, t, n, i) {
  return (n - t) / 86400 <= 7 ? fi(
    "history.get",
    {
      output: "extend",
      itemids: e,
      history: 0,
      time_from: t,
      time_till: n,
      sortfield: "clock",
      sortorder: "ASC",
      limit: 1e4
    },
    i
  ) : (await fi(
    "trend.get",
    {
      output: "extend",
      itemids: e,
      time_from: t,
      time_till: n,
      sortfield: "clock",
      sortorder: "ASC",
      limit: 1e4
    },
    i
  )).map((u) => ({
    itemid: u.itemid,
    clock: u.clock,
    value: u.value_avg,
    ns: "0"
  }));
}
function Yw(e) {
  return fi(
    "valuemap.get",
    {
      output: "extend",
      selectMappings: "extend"
    },
    e
  );
}
function Bw(e, t) {
  return fi(
    "discoveryrule.get",
    {
      output: ["itemid", "hostid", "name", "key_"],
      hostids: e,
      sortfield: "name",
      limit: 200
    },
    t
  );
}
function Hw(e, t) {
  return fi(
    "itemprototype.get",
    {
      output: ["itemid", "name", "key_"],
      discoveryids: [e],
      sortfield: "name"
    },
    t
  );
}
function jw(e, t) {
  const n = new Map(t.map((i) => [i, []]));
  for (const i of e)
    n.get(i.itemid)?.push(i);
  return n;
}
function Uw(e, t) {
  if (e.length === 0)
    return 0;
  switch (t) {
    case "avg":
      return e.reduce((n, i) => n + i, 0) / e.length;
    case "sum":
      return e.reduce((n, i) => n + i, 0);
    case "min":
      return e.reduce((n, i) => Math.min(n, i), 1 / 0);
    case "max":
      return e.reduce((n, i) => Math.max(n, i), -1 / 0);
    case "count":
      return e.length;
    case "median": {
      const n = [...e].sort((i, a) => i - a);
      return n[Math.floor(n.length / 2)];
    }
  }
}
function Gw(e, t, n = "avg") {
  if (e.length === 0)
    return [];
  const i = t / 1e3, a = /* @__PURE__ */ new Map();
  for (const u of e) {
    const r = Math.floor(Number(u.clock) / i) * i, c = a.get(r);
    c ? c.push(Number(u.value)) : a.set(r, [Number(u.value)]);
  }
  const l = e[0].itemid;
  return Array.from(a.entries()).sort(([u], [r]) => u - r).map(([u, r]) => ({
    itemid: l,
    clock: String(u),
    value: String(Uw(r, n)),
    ns: "0"
  }));
}
const Kw = [
  "Transform",
  "Aggregate",
  "Filter",
  "Trends",
  "Time",
  "Alias",
  "Special"
], Ld = [
  // Transform
  { name: "groupBy", category: "Transform", params: [{ name: "interval", type: "string" }, { name: "function", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: ["1m", "avg"] },
  { name: "scale", category: "Transform", params: [{ name: "factor", type: "float", options: [100, 0.01, 10, -1] }], defaultParams: [100] },
  { name: "offset", category: "Transform", params: [{ name: "delta", type: "float", options: [-100, 100] }], defaultParams: [100] },
  { name: "delta", category: "Transform", params: [], defaultParams: [] },
  { name: "rate", category: "Transform", params: [], defaultParams: [] },
  { name: "movingAverage", category: "Transform", params: [{ name: "factor", type: "int", options: [6, 10, 60, 100, 600] }], defaultParams: [10] },
  { name: "exponentialMovingAverage", category: "Transform", params: [{ name: "smoothing", type: "float", options: [6, 10, 60, 100, 600] }], defaultParams: [0.2] },
  { name: "percentile", category: "Transform", params: [{ name: "interval", type: "string" }, { name: "percent", type: "float", options: [25, 50, 75, 90, 95, 99, 99.9] }], defaultParams: ["1m", 95] },
  { name: "removeAboveValue", category: "Transform", params: [{ name: "number", type: "float" }], defaultParams: [0] },
  { name: "removeBelowValue", category: "Transform", params: [{ name: "number", type: "float" }], defaultParams: [0] },
  { name: "transformNull", category: "Transform", params: [{ name: "number", type: "float" }], defaultParams: [0] },
  // Aggregate
  { name: "aggregateBy", category: "Aggregate", params: [{ name: "interval", type: "string" }, { name: "function", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: ["1m", "avg"] },
  { name: "sumSeries", category: "Aggregate", params: [], defaultParams: [] },
  { name: "percentileAgg", category: "Aggregate", params: [{ name: "interval", type: "string" }, { name: "percent", type: "float", options: [25, 50, 75, 90, 95, 99, 99.9] }], defaultParams: ["1m", 95] },
  // Filter
  { name: "top", category: "Filter", params: [{ name: "number", type: "int" }, { name: "value", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: [5, "avg"] },
  { name: "bottom", category: "Filter", params: [{ name: "number", type: "int" }, { name: "value", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: [5, "avg"] },
  { name: "sortSeries", category: "Filter", params: [{ name: "direction", type: "string", options: ["asc", "desc"] }], defaultParams: ["asc"] },
  // Trends
  { name: "trendValue", category: "Trends", params: [{ name: "type", type: "string", options: ["avg", "min", "max", "sum", "count"] }], defaultParams: ["avg"] },
  // Time
  { name: "timeShift", category: "Time", params: [{ name: "interval", type: "string", options: ["24h", "7d", "1M", "+24h", "-24h"] }], defaultParams: ["24h"] },
  // Alias
  { name: "setAlias", category: "Alias", params: [{ name: "alias", type: "string" }], defaultParams: [] },
  { name: "setAliasByRegex", category: "Alias", params: [{ name: "aliasByRegex", type: "string" }], defaultParams: [] },
  { name: "replaceAlias", category: "Alias", params: [{ name: "regexp", type: "string" }, { name: "newAlias", type: "string" }], defaultParams: ["/(.*)/", "$1"] },
  // Special
  { name: "consolidateBy", category: "Special", params: [{ name: "type", type: "string", options: ["avg", "min", "max", "sum", "count"] }], defaultParams: ["avg"] }
], Zw = /^\$(\w+)$/;
function nu(e, t, n) {
  if (!e)
    return [];
  const i = Zw.exec(e);
  if (!i)
    return [e];
  const a = i[1], l = t[a];
  if (l == null)
    return [e];
  const u = (Array.isArray(l) ? l : [l]).map(String);
  return u.includes("$__all") ? n[a] ?? [] : u.filter(Boolean);
}
function Qw(e, t, n) {
  const i = {};
  for (const a of Object.values(n))
    i[a.config.name] = a.options.map((l) => l.value).filter((l) => l !== "$__all");
  return {
    ...e,
    hostIds: nu(e.hostId, t, i),
    groupIds: nu(e.groupId, t, i),
    lldRuleIds: nu(e.lldRuleId, t, i),
    itemTagsFilter: Al(e.itemTagsFilter ?? "", t),
    triggerFilter: Al(e.triggerFilter ?? "", t),
    tagsFilter: Al(e.tagsFilter ?? "", t),
    itemids: Al(e.itemids ?? "", t),
    itServiceFilter: Al(e.itServiceFilter ?? "", t),
    macroFilter: Al(e.macroFilter ?? "", t)
  };
}
const Nl = new vw();
function Xw(e) {
  return e.split(",").map((t) => t.trim()).filter(Boolean).map((t) => ({ value: t, label: t }));
}
function Jw(e) {
  return e.map((t) => ({ value: t.value, label: t.text || t.value }));
}
function eS(e, t, n) {
  if (t) {
    const i = e ?? n[0]?.value ?? "";
    return i ? [i] : [];
  }
  return e ?? n[0]?.value ?? "";
}
function tS(e, t) {
  return [{ value: t || "$__all", label: "$__all" }, ...e];
}
function nS(e, t, n) {
  switch (e.type) {
    case "custom": {
      if (e.customOptions && e.customOptions.length > 0)
        return Promise.resolve(Jw(e.customOptions));
      const i = e.customValues ?? "";
      return Promise.resolve(Xw(i));
    }
    case "query": {
      if (!t || !e.query)
        return Promise.resolve([]);
      const i = iS(e.query, n);
      return t(i);
    }
    case "textbox": {
      const i = e.defaultValue ?? "";
      return Promise.resolve(i ? [{ value: i, label: i }] : []);
    }
    case "constant": {
      const i = e.constantValue ?? "";
      return Promise.resolve(i ? [{ value: i, label: i }] : []);
    }
    default:
      return Promise.resolve([]);
  }
}
function iS(e, t) {
  return e.replace(/\{\{(\w+)(?::(\w+))?\}\}/g, (n, i) => {
    const a = t[i];
    return a == null ? n : Array.isArray(a) ? a.join(",") : String(a);
  });
}
const gl = qu("variable", () => {
  const e = pe({}), t = pe(null);
  function n(S) {
    t.value = S;
  }
  function i(S) {
    e.value[S.id] || (Nl.addVariable(S), e.value[S.id] = La({
      config: S,
      options: [],
      current: "",
      loading: !1,
      error: null
    }), r(S.id));
  }
  function a(S) {
    const T = e.value[S];
    T && (Nl.removeVariable(T.config.name), delete e.value[S]);
  }
  function l(S, T) {
    const C = e.value[S];
    C && (C.config = { ...C.config, ...T }, ("name" in T || "query" in T) && Nl.addVariable(C.config), r(S));
  }
  function u(S, T) {
    const C = e.value[S];
    C && (C.current = T);
  }
  async function r(S) {
    const T = e.value[S];
    if (T) {
      T.loading = !0, T.error = null;
      try {
        const C = g(), E = await nS(T.config, t.value, C);
        T.options = T.config.includeAll ? tS(E, T.config.allValue) : E;
        const X = Array.isArray(T.current) ? T.current[0] : T.current;
        (!X || !T.options.some((F) => F.value === X)) && (T.current = eS(T.config.defaultValue, T.config.multi, T.options));
      } catch (C) {
        T.error = C?.message ?? String(C);
      } finally {
        T.loading = !1;
      }
    }
  }
  async function c() {
    const S = Nl.topologicalSort();
    for (const T of S) {
      const C = Object.values(e.value).find((E) => E.config.name === T);
      C && await r(C.config.id);
    }
  }
  function g() {
    const S = {};
    for (const T of Object.values(e.value)) {
      const { name: C } = T.config;
      Array.isArray(T.current) ? S[C] = T.current.length === 1 ? T.current[0] : T.current : S[C] = T.current;
    }
    return S;
  }
  function y(S) {
    return Object.values(e.value).find((T) => T.config.name === S);
  }
  function v(S) {
    return Nl.getAllDependents(S);
  }
  function m() {
    return Nl.detectCycle();
  }
  return {
    variables: e,
    optionsResolver: t,
    setOptionsResolver: n,
    addVariable: i,
    removeVariable: a,
    updateVariable: l,
    setValue: u,
    refreshVariable: r,
    refreshAll: c,
    resolveAll: g,
    getVariable: y,
    getDependents: v,
    detectCycle: m
  };
});
function aS() {
  const e = Date.now();
  return { from: e - 3600 * 1e3, to: e };
}
const Gi = qu("dashboard", () => {
  const e = Lh(), t = pe(""), n = pe(e.panels), i = pe(e.layouts), a = pe(!1), l = pe(null), u = pe(!1), r = pe(aS()), c = pe(0), g = pe(null), y = pe(!1), v = pe({});
  function m(I) {
    const $ = Su(), le = Rh(I, { id: $ }), ie = i.value.reduce((fe, he) => Math.max(fe, he.y + he.h), 0), ye = {
      i: $,
      x: 0,
      y: ie,
      w: I === "stat" || I === "gauge" ? 3 : I === "table" ? 12 : 6,
      h: I === "stat" || I === "gauge" ? 4 : I === "table" ? 10 : 8,
      minH: I === "stat" || I === "gauge" ? 3 : 6
    };
    n.value[$] = le, i.value = [...i.value, ye], l.value = $, u.value = !1, y.value = !0;
  }
  function S(I) {
    const { [I]: $, ...le } = n.value;
    n.value = le, i.value = i.value.filter((ie) => ie.i !== I), l.value === I && (l.value = null), y.value = !0;
  }
  function T(I) {
    const $ = n.value[I];
    if (!$)
      return;
    const le = Su(), ie = { ...$, id: le, title: `${$.title} (copy)` }, ye = i.value.find((he) => he.i === I), fe = i.value.reduce((he, ae) => Math.max(he, ae.y + ae.h), 0);
    n.value[le] = ie, i.value = [
      ...i.value,
      {
        i: le,
        x: ye?.x ?? 0,
        y: fe,
        w: ye?.w ?? 6,
        h: ye?.h ?? 8,
        minH: ye?.minH
      }
    ], y.value = !0;
  }
  function C(I, $) {
    const le = n.value[I];
    le && (n.value[I] = { ...le, ...$ }, y.value = !0);
  }
  function E() {
    n.value = {}, i.value = [], l.value = null, y.value = !0;
  }
  function X(I) {
    i.value = I;
  }
  function F() {
    g.value = {
      title: t.value,
      panels: { ...n.value },
      layouts: [...i.value]
    }, a.value = !0, y.value = !1;
  }
  function V(I) {
    I && I(J()), a.value = !1, g.value = null, y.value = !1;
  }
  function N() {
    const I = g.value;
    I && (t.value = I.title, n.value = I.panels, i.value = I.layouts), a.value = !1, g.value = null, y.value = !1;
  }
  function Y() {
    a.value ? N() : F();
  }
  function K(I) {
    a.value = I;
  }
  function M(I) {
    l.value = I;
  }
  function W(I) {
    r.value = I;
  }
  function G(I) {
    c.value = I;
  }
  function Z() {
    for (const I of Object.keys(n.value))
      v.value[I] = (v.value[I] ?? 0) + 1;
  }
  function A(I) {
    v.value[I] = (v.value[I] ?? 0) + 1;
  }
  function J() {
    const I = gl(), $ = Object.values(I.variables).map((ie) => ie.config), le = {
      title: t.value,
      panels: n.value,
      layouts: i.value,
      variables: $
    };
    return JSON.stringify(le, null, 2);
  }
  function ee(I) {
    try {
      const $ = JSON.parse(I);
      if ($.panels && $.layouts && (t.value = $.title ?? "", n.value = $.panels, i.value = $.layouts, y.value = !0), $.variables && $.variables.length > 0) {
        const le = gl();
        for (const ie of Object.keys(le.variables))
          le.removeVariable(ie);
        for (const ie of $.variables) {
          const ye = {
            ...ie,
            hide: ie.showOnDashboard === "nothing" || !!ie.hideFromVariableList
          };
          le.addVariable(ye);
        }
      }
      return !!($.panels && $.layouts);
    } catch {
      return !1;
    }
  }
  return {
    title: t,
    panels: n,
    layouts: i,
    isEditing: a,
    editingPanelId: l,
    addPanelModalOpen: u,
    timeRange: r,
    autoRefresh: c,
    _editSnapshot: g,
    isDirty: y,
    panelRefreshKeys: v,
    addPanel: m,
    removePanel: S,
    clonePanel: T,
    updatePanel: C,
    clearPanels: E,
    setLayouts: X,
    startEditing: F,
    confirmSave: V,
    discardChanges: N,
    setEditingPanel: M,
    toggleEditing: Y,
    setEditing: K,
    setTimeRange: W,
    setAutoRefresh: G,
    refresh: Z,
    refreshPanel: A,
    exportJSON: J,
    importJSON: ee
  };
}), Hi = qu("theme", () => {
  const e = pe(
    (typeof localStorage < "u" ? localStorage.getItem("argus-theme") : null) || "dark"
  ), t = oe(() => e.value === "dark");
  function n() {
    e.value = e.value === "dark" ? "light" : "dark", typeof document < "u" && (document.documentElement.dataset.theme = e.value), typeof localStorage < "u" && localStorage.setItem("argus-theme", e.value);
  }
  function i(a) {
    e.value = a, typeof document < "u" && (document.documentElement.dataset.theme = a), typeof localStorage < "u" && localStorage.setItem("argus-theme", a);
  }
  return { theme: e, isDark: t, toggle: n, setTheme: i };
}), lS = typeof window < "u";
var qd;
lS && ((qd = window?.navigator) != null && qd.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Kn(e) {
  return e == null;
}
function Dg() {
}
const oS = Object.freeze({
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
});
Object.freeze(new Set(Object.keys(oS)));
function sS() {
  const e = /* @__PURE__ */ new Map();
  return {
    on(t, n) {
      const i = e.get(t);
      i?.add(n) || e.set(t, /* @__PURE__ */ new Set([n]));
    },
    off(t, n) {
      const i = e.get(t);
      i && i.delete(n);
    },
    clear(t) {
      const n = e.get(t);
      n && n.clear();
    },
    clearAll() {
      e.clear();
    },
    emit(t, ...n) {
      const i = e.get(t);
      i && i.forEach((a) => {
        a(...n);
      });
    }
  };
}
function Fd(e, t = 16) {
  if (typeof e != "function")
    return Dg;
  const n = (...l) => {
    e(...l);
  };
  if (t <= 0)
    return Og(n);
  let i = 0, a;
  return function(...l) {
    const u = Date.now(), r = u - i;
    clearTimeout(a), r >= t ? (i = u, n(...l)) : a = setTimeout(
      () => {
        i = Date.now(), n(...l);
      },
      Math.max(0, t - r)
    );
  };
}
function rS(e, t = 100) {
  if (typeof e != "function")
    return Dg;
  const n = (...a) => {
    e(...a);
  };
  if (t <= 0)
    return Og(n);
  let i;
  return function(...a) {
    clearTimeout(i), i = setTimeout(() => {
      n(...a);
    }, t);
  };
}
function Og(e) {
  if (typeof e != "function")
    return e;
  let t = !1, n, i;
  return function(...a) {
    return n = a, t || (t = !0, i = Promise.resolve().then(() => (t = !1, i = void 0, e(...n)))), i;
  };
}
const Wo = /* @__PURE__ */ new Set(), Pg = /* @__PURE__ */ new WeakMap();
function uS() {
  Wo.forEach((e) => {
    e(...Pg.get(e));
  }), Wo.clear();
}
function In(e, ...t) {
  if (typeof e != "function")
    return e;
  Pg.set(e, t), !Wo.has(e) && (Wo.add(e), Wo.size === 1 && Promise.resolve().then(uS));
}
const Ig = Symbol("LAYOUT_KEY"), Eg = Symbol("EMITTER_KEY");
function cS(e) {
  let t = 0, n;
  for (let i = 0, a = e.length; i < a; i++)
    n = e[i].y + e[i].h, n > t && (t = n);
  return t;
}
function Au(e) {
  const t = Array(e.length);
  for (let n = 0, i = e.length; n < i; n++)
    t[n] = dS(e[n]);
  return t;
}
function dS(e) {
  return { ...e };
}
function $g(e, t) {
  return !(e === t || e.x + e.w <= t.x || e.x >= t.x + t.w || e.y + e.h <= t.y || e.y >= t.y + t.h);
}
function Vl(e, t, n) {
  const i = Ng(e), a = Rg(e), l = Array(e.length);
  for (let u = 0, r = a.length; u < r; u++) {
    let c = a[u];
    c.static || (c = fS(i, c, t, n), i.push(c)), l[e.findIndex((g) => g.i === c.i)] = c, c.moved = !1;
  }
  return l;
}
function fS(e, t, n, i) {
  if (n)
    for (; t.y > 0 && !Yo(e, t); )
      t.y--;
  else if (i) {
    const l = i[t.i].y;
    for (; t.y > l && !Yo(e, t); )
      t.y--;
  }
  let a;
  for (; a = Yo(e, t); )
    t.y = a.y + a.h;
  return t;
}
function hS(e, t) {
  const n = Ng(e);
  for (let i = 0, a = e.length; i < a; i++) {
    const l = e[i];
    if (l.x + l.w > t.cols && (l.x = t.cols - l.w), l.x < 0 && (l.x = 0, l.w = t.cols), !l.static) n.push(l);
    else
      for (; Yo(n, l); )
        l.y++;
  }
  return e;
}
function Vd(e, t) {
  for (let n = 0, i = e.length; n < i; n++)
    if (e[n].i === t) return e[n];
}
function Yo(e, t) {
  for (let n = 0, i = e.length; n < i; n++)
    if ($g(e[n], t)) return e[n];
}
function Ag(e, t) {
  return e.filter((n) => $g(n, t));
}
function Ng(e) {
  return e.filter((t) => t.static);
}
function Nu(e, t, n, i, a = !1, l = !1) {
  if (t.static) return e;
  const u = t.x, r = t.y, c = i && t.y > i;
  typeof n == "number" && (t.x = n), typeof i == "number" && (t.y = i), t.moved = !0;
  let g = Rg(e);
  c && (g = g.reverse());
  const y = Ag(g, t);
  if (l && y.length)
    return t.x = u, t.y = r, t.moved = !1, e;
  for (let v = 0, m = y.length; v < m; v++) {
    const S = y[v];
    S.moved || t.y > S.y && t.y - S.y > S.h / 4 || (S.static ? e = Wd(e, S, t, a) : e = Wd(e, t, S, a));
  }
  return e;
}
function Wd(e, t, n, i) {
  if (i) {
    const a = {
      x: n.x,
      y: n.y,
      w: n.w,
      h: n.h
    };
    if (a.y = Math.max(t.y - n.h, 0), !Yo(e, a))
      return Nu(e, n, void 0, a.y, !1);
  }
  return Nu(e, n, void 0, n.y + 1, !1);
}
function gS(e, t, n, i) {
  const a = "translate3d(" + t + "px," + e + "px, 0)";
  return {
    transform: a,
    WebkitTransform: a,
    MozTransform: a,
    msTransform: a,
    OTransform: a,
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function pS(e, t, n, i) {
  const a = "translate3d(" + t * -1 + "px," + e + "px, 0)";
  return {
    transform: a,
    WebkitTransform: a,
    MozTransform: a,
    msTransform: a,
    OTransform: a,
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function mS(e, t, n, i) {
  return {
    top: e + "px",
    left: t + "px",
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function vS(e, t, n, i) {
  return {
    top: e + "px",
    right: t + "px",
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function Rg(e) {
  return Array.from(e).sort(function(t, n) {
    return t.y === n.y && t.x === n.x ? 0 : t.y > n.y || t.y === n.y && t.x > n.x ? 1 : -1;
  });
}
function yS(e, t) {
  t = t || "Layout";
  const n = ["x", "y", "w", "h"], i = [];
  if (!Array.isArray(e)) throw new Error(t + " must be an array!");
  for (let a = 0, l = e.length; a < l; a++) {
    const u = e[a];
    for (let r = 0; r < n.length; r++)
      if (typeof u[n[r]] != "number")
        throw new Error(
          "VueGridLayout: " + t + "[" + a + "]." + n[r] + " must be a number!"
        );
    if (u.i === void 0 || u.i === null)
      throw new Error("VueGridLayout: " + t + "[" + a + "].i cannot be null!");
    if (typeof u.i != "number" && typeof u.i != "string")
      throw new Error("VueGridLayout: " + t + "[" + a + "].i must be a string or number!");
    if (i.indexOf(u.i) >= 0)
      throw new Error("VueGridLayout: " + t + "[" + a + "].i must be unique!");
    if (i.push(u.i), u.static !== void 0 && typeof u.static != "boolean")
      throw new Error("VueGridLayout: " + t + "[" + a + "].static must be a boolean!");
  }
}
function bS(e, t = "vgl") {
  const n = () => `${t}-${e}`;
  return {
    b: n,
    be: (i) => `${n()}__${i}`,
    bm: (i) => `${n()}--${i}`,
    bem: (i, a) => `${n()}__${i}--${a}`
  };
}
function Yd(e) {
  return xS(e);
}
function xS(e) {
  var t;
  const n = ((t = e.target) == null ? void 0 : t.offsetParent) || document.body, i = e.offsetParent === document.body ? { left: 0, top: 0 } : n.getBoundingClientRect(), a = e.clientX + n.scrollLeft - i.left, l = e.clientY + n.scrollTop - i.top;
  return { x: a, y: l };
}
function Bd(e, t, n, i) {
  return wS(e) ? {
    deltaX: n - e,
    deltaY: i - t,
    lastX: e,
    lastY: t,
    x: n,
    y: i
  } : {
    deltaX: 0,
    deltaY: 0,
    lastX: n,
    lastY: i,
    x: n,
    y: i
  };
}
function wS(e) {
  return typeof e == "number" && !Number.isNaN(e);
}
function SS(e, t) {
  const n = qg(e);
  let i = n[0];
  for (let a = 1, l = n.length; a < l; a++) {
    const u = n[a];
    t > e[u] && (i = u);
  }
  return i;
}
function Lg(e, t) {
  if (!t[e])
    throw new Error(
      "ResponsiveGridLayout: `cols` entry for breakpoint " + e + " is missing!"
    );
  return t[e];
}
function kS(e, t, n, i, a, l, u) {
  if (t[i]) return Au(t[i]);
  let r = e;
  const c = qg(n), g = c.slice(c.indexOf(i));
  for (let y = 0, v = g.length; y < v; y++) {
    const m = g[y];
    if (t[m]) {
      r = t[m];
      break;
    }
  }
  return r = Au(r || []), Vl(hS(r, { cols: l }), u);
}
function qg(e) {
  return Object.keys(e).sort((t, n) => e[t] - e[n]);
}
let _S = "auto";
function CS() {
  return typeof document < "u";
}
function Hd() {
  return CS() ? typeof document.dir < "u" ? document.dir : document.getElementsByTagName("html")[0].getAttribute("dir") : _S;
}
var Ao = { exports: {} }, MS = Ao.exports, jd;
function TS() {
  return jd || (jd = 1, (function(e, t) {
    (function(n, i) {
      e.exports = i();
    })(MS, (function() {
      function n(o, s) {
        var d = Object.keys(o);
        if (Object.getOwnPropertySymbols) {
          var h = Object.getOwnPropertySymbols(o);
          s && (h = h.filter((function(p) {
            return Object.getOwnPropertyDescriptor(o, p).enumerable;
          }))), d.push.apply(d, h);
        }
        return d;
      }
      function i(o) {
        for (var s = 1; s < arguments.length; s++) {
          var d = arguments[s] != null ? arguments[s] : {};
          s % 2 ? n(Object(d), !0).forEach((function(h) {
            c(o, h, d[h]);
          })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(d)) : n(Object(d)).forEach((function(h) {
            Object.defineProperty(o, h, Object.getOwnPropertyDescriptor(d, h));
          }));
        }
        return o;
      }
      function a(o) {
        return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
          return typeof s;
        } : function(s) {
          return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
        }, a(o);
      }
      function l(o, s) {
        if (!(o instanceof s)) throw new TypeError("Cannot call a class as a function");
      }
      function u(o, s) {
        for (var d = 0; d < s.length; d++) {
          var h = s[d];
          h.enumerable = h.enumerable || !1, h.configurable = !0, "value" in h && (h.writable = !0), Object.defineProperty(o, C(h.key), h);
        }
      }
      function r(o, s, d) {
        return s && u(o.prototype, s), Object.defineProperty(o, "prototype", { writable: !1 }), o;
      }
      function c(o, s, d) {
        return (s = C(s)) in o ? Object.defineProperty(o, s, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : o[s] = d, o;
      }
      function g(o, s) {
        if (typeof s != "function" && s !== null) throw new TypeError("Super expression must either be null or a function");
        o.prototype = Object.create(s && s.prototype, { constructor: { value: o, writable: !0, configurable: !0 } }), Object.defineProperty(o, "prototype", { writable: !1 }), s && v(o, s);
      }
      function y(o) {
        return y = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(s) {
          return s.__proto__ || Object.getPrototypeOf(s);
        }, y(o);
      }
      function v(o, s) {
        return v = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(d, h) {
          return d.__proto__ = h, d;
        }, v(o, s);
      }
      function m(o) {
        if (o === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return o;
      }
      function S(o) {
        var s = (function() {
          if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
          if (typeof Proxy == "function") return !0;
          try {
            return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {
            }))), !0;
          } catch {
            return !1;
          }
        })();
        return function() {
          var d, h = y(o);
          if (s) {
            var p = y(this).constructor;
            d = Reflect.construct(h, arguments, p);
          } else d = h.apply(this, arguments);
          return (function(x, k) {
            if (k && (typeof k == "object" || typeof k == "function")) return k;
            if (k !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
            return m(x);
          })(this, d);
        };
      }
      function T() {
        return T = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(o, s, d) {
          var h = (function(x, k) {
            for (; !Object.prototype.hasOwnProperty.call(x, k) && (x = y(x)) !== null; ) ;
            return x;
          })(o, s);
          if (h) {
            var p = Object.getOwnPropertyDescriptor(h, s);
            return p.get ? p.get.call(arguments.length < 3 ? o : d) : p.value;
          }
        }, T.apply(this, arguments);
      }
      function C(o) {
        var s = (function(d, h) {
          if (typeof d != "object" || d === null) return d;
          var p = d[Symbol.toPrimitive];
          if (p !== void 0) {
            var x = p.call(d, h);
            if (typeof x != "object") return x;
            throw new TypeError("@@toPrimitive must return a primitive value.");
          }
          return String(d);
        })(o, "string");
        return typeof s == "symbol" ? s : s + "";
      }
      var E = function(o) {
        return !(!o || !o.Window) && o instanceof o.Window;
      }, X = void 0, F = void 0;
      function V(o) {
        X = o;
        var s = o.document.createTextNode("");
        s.ownerDocument !== o.document && typeof o.wrap == "function" && o.wrap(s) === s && (o = o.wrap(o)), F = o;
      }
      function N(o) {
        return E(o) ? o : (o.ownerDocument || o).defaultView || F.window;
      }
      typeof window < "u" && window && V(window);
      var Y = function(o) {
        return !!o && a(o) === "object";
      }, K = function(o) {
        return typeof o == "function";
      }, M = { window: function(o) {
        return o === F || E(o);
      }, docFrag: function(o) {
        return Y(o) && o.nodeType === 11;
      }, object: Y, func: K, number: function(o) {
        return typeof o == "number";
      }, bool: function(o) {
        return typeof o == "boolean";
      }, string: function(o) {
        return typeof o == "string";
      }, element: function(o) {
        if (!o || a(o) !== "object") return !1;
        var s = N(o) || F;
        return /object|function/.test(typeof Element > "u" ? "undefined" : a(Element)) ? o instanceof Element || o instanceof s.Element : o.nodeType === 1 && typeof o.nodeName == "string";
      }, plainObject: function(o) {
        return Y(o) && !!o.constructor && /function Object\b/.test(o.constructor.toString());
      }, array: function(o) {
        return Y(o) && o.length !== void 0 && K(o.splice);
      } };
      function W(o) {
        var s = o.interaction;
        if (s.prepared.name === "drag") {
          var d = s.prepared.axis;
          d === "x" ? (s.coords.cur.page.y = s.coords.start.page.y, s.coords.cur.client.y = s.coords.start.client.y, s.coords.velocity.client.y = 0, s.coords.velocity.page.y = 0) : d === "y" && (s.coords.cur.page.x = s.coords.start.page.x, s.coords.cur.client.x = s.coords.start.client.x, s.coords.velocity.client.x = 0, s.coords.velocity.page.x = 0);
        }
      }
      function G(o) {
        var s = o.iEvent, d = o.interaction;
        if (d.prepared.name === "drag") {
          var h = d.prepared.axis;
          if (h === "x" || h === "y") {
            var p = h === "x" ? "y" : "x";
            s.page[p] = d.coords.start.page[p], s.client[p] = d.coords.start.client[p], s.delta[p] = 0;
          }
        }
      }
      var Z = { id: "actions/drag", install: function(o) {
        var s = o.actions, d = o.Interactable, h = o.defaults;
        d.prototype.draggable = Z.draggable, s.map.drag = Z, s.methodDict.drag = "draggable", h.actions.drag = Z.defaults;
      }, listeners: { "interactions:before-action-move": W, "interactions:action-resume": W, "interactions:action-move": G, "auto-start:check": function(o) {
        var s = o.interaction, d = o.interactable, h = o.buttons, p = d.options.drag;
        if (p && p.enabled && (!s.pointerIsDown || !/mouse|pointer/.test(s.pointerType) || (h & d.options.drag.mouseButtons) != 0)) return o.action = { name: "drag", axis: p.lockAxis === "start" ? p.startAxis : p.lockAxis }, !1;
      } }, draggable: function(o) {
        return M.object(o) ? (this.options.drag.enabled = o.enabled !== !1, this.setPerAction("drag", o), this.setOnEvents("drag", o), /^(xy|x|y|start)$/.test(o.lockAxis) && (this.options.drag.lockAxis = o.lockAxis), /^(xy|x|y)$/.test(o.startAxis) && (this.options.drag.startAxis = o.startAxis), this) : M.bool(o) ? (this.options.drag.enabled = o, this) : this.options.drag;
      }, beforeMove: W, move: G, defaults: { startAxis: "xy", lockAxis: "xy" }, getCursor: function() {
        return "move";
      }, filterEventType: function(o) {
        return o.search("drag") === 0;
      } }, A = Z, J = { init: function(o) {
        var s = o;
        J.document = s.document, J.DocumentFragment = s.DocumentFragment || ee, J.SVGElement = s.SVGElement || ee, J.SVGSVGElement = s.SVGSVGElement || ee, J.SVGElementInstance = s.SVGElementInstance || ee, J.Element = s.Element || ee, J.HTMLElement = s.HTMLElement || J.Element, J.Event = s.Event, J.Touch = s.Touch || ee, J.PointerEvent = s.PointerEvent || s.MSPointerEvent;
      }, document: null, DocumentFragment: null, SVGElement: null, SVGSVGElement: null, SVGElementInstance: null, Element: null, HTMLElement: null, Event: null, Touch: null, PointerEvent: null };
      function ee() {
      }
      var I = J, $ = { init: function(o) {
        var s = I.Element, d = o.navigator || {};
        $.supportsTouch = "ontouchstart" in o || M.func(o.DocumentTouch) && I.document instanceof o.DocumentTouch, $.supportsPointerEvent = d.pointerEnabled !== !1 && !!I.PointerEvent, $.isIOS = /iP(hone|od|ad)/.test(d.platform), $.isIOS7 = /iP(hone|od|ad)/.test(d.platform) && /OS 7[^\d]/.test(d.appVersion), $.isIe9 = /MSIE 9/.test(d.userAgent), $.isOperaMobile = d.appName === "Opera" && $.supportsTouch && /Presto/.test(d.userAgent), $.prefixedMatchesSelector = "matches" in s.prototype ? "matches" : "webkitMatchesSelector" in s.prototype ? "webkitMatchesSelector" : "mozMatchesSelector" in s.prototype ? "mozMatchesSelector" : "oMatchesSelector" in s.prototype ? "oMatchesSelector" : "msMatchesSelector", $.pEventTypes = $.supportsPointerEvent ? I.PointerEvent === o.MSPointerEvent ? { up: "MSPointerUp", down: "MSPointerDown", over: "mouseover", out: "mouseout", move: "MSPointerMove", cancel: "MSPointerCancel" } : { up: "pointerup", down: "pointerdown", over: "pointerover", out: "pointerout", move: "pointermove", cancel: "pointercancel" } : null, $.wheelEvent = I.document && "onmousewheel" in I.document ? "mousewheel" : "wheel";
      }, supportsTouch: null, supportsPointerEvent: null, isIOS7: null, isIOS: null, isIe9: null, isOperaMobile: null, prefixedMatchesSelector: null, pEventTypes: null, wheelEvent: null }, le = $;
      function ie(o, s) {
        if (o.contains) return o.contains(s);
        for (; s; ) {
          if (s === o) return !0;
          s = s.parentNode;
        }
        return !1;
      }
      function ye(o, s) {
        for (; M.element(o); ) {
          if (he(o, s)) return o;
          o = fe(o);
        }
        return null;
      }
      function fe(o) {
        var s = o.parentNode;
        if (M.docFrag(s)) {
          for (; (s = s.host) && M.docFrag(s); ) ;
          return s;
        }
        return s;
      }
      function he(o, s) {
        return F !== X && (s = s.replace(/\/deep\//g, " ")), o[le.prefixedMatchesSelector](s);
      }
      var ae = function(o) {
        return o.parentNode || o.host;
      };
      function ve(o, s) {
        for (var d, h = [], p = o; (d = ae(p)) && p !== s && d !== p.ownerDocument; ) h.unshift(p), p = d;
        return h;
      }
      function Ne(o, s, d) {
        for (; M.element(o); ) {
          if (he(o, s)) return !0;
          if ((o = fe(o)) === d) return he(o, s);
        }
        return !1;
      }
      function we(o) {
        return o.correspondingUseElement || o;
      }
      function Me(o) {
        var s = o instanceof I.SVGElement ? o.getBoundingClientRect() : o.getClientRects()[0];
        return s && { left: s.left, right: s.right, top: s.top, bottom: s.bottom, width: s.width || s.right - s.left, height: s.height || s.bottom - s.top };
      }
      function ue(o) {
        var s, d = Me(o);
        if (!le.isIOS7 && d) {
          var h = { x: (s = (s = N(o)) || F).scrollX || s.document.documentElement.scrollLeft, y: s.scrollY || s.document.documentElement.scrollTop };
          d.left += h.x, d.right += h.x, d.top += h.y, d.bottom += h.y;
        }
        return d;
      }
      function se(o) {
        for (var s = []; o; ) s.push(o), o = fe(o);
        return s;
      }
      function Pe(o) {
        return !!M.string(o) && (I.document.querySelector(o), !0);
      }
      function xe(o, s) {
        for (var d in s) o[d] = s[d];
        return o;
      }
      function qe(o, s, d) {
        return o === "parent" ? fe(d) : o === "self" ? s.getRect(d) : ye(d, o);
      }
      function nt(o, s, d, h) {
        var p = o;
        return M.string(p) ? p = qe(p, s, d) : M.func(p) && (p = p.apply(void 0, h)), M.element(p) && (p = ue(p)), p;
      }
      function Ze(o) {
        return o && { x: "x" in o ? o.x : o.left, y: "y" in o ? o.y : o.top };
      }
      function Ct(o) {
        return !o || "x" in o && "y" in o || ((o = xe({}, o)).x = o.left || 0, o.y = o.top || 0, o.width = o.width || (o.right || 0) - o.x, o.height = o.height || (o.bottom || 0) - o.y), o;
      }
      function Bt(o, s, d) {
        o.left && (s.left += d.x), o.right && (s.right += d.x), o.top && (s.top += d.y), o.bottom && (s.bottom += d.y), s.width = s.right - s.left, s.height = s.bottom - s.top;
      }
      function mt(o, s, d) {
        var h = d && o.options[d];
        return Ze(nt(h && h.origin || o.options.origin, o, s, [o && s])) || { x: 0, y: 0 };
      }
      function It(o, s) {
        var d = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function(R) {
          return !0;
        }, h = arguments.length > 3 ? arguments[3] : void 0;
        if (h = h || {}, M.string(o) && o.search(" ") !== -1 && (o = vt(o)), M.array(o)) return o.forEach((function(R) {
          return It(R, s, d, h);
        })), h;
        if (M.object(o) && (s = o, o = ""), M.func(s) && d(o)) h[o] = h[o] || [], h[o].push(s);
        else if (M.array(s)) for (var p = 0, x = s; p < x.length; p++) {
          var k = x[p];
          It(o, k, d, h);
        }
        else if (M.object(s)) for (var z in s)
          It(vt(z).map((function(R) {
            return "".concat(o).concat(R);
          })), s[z], d, h);
        return h;
      }
      function vt(o) {
        return o.trim().split(/ +/);
      }
      var Ht = function(o, s) {
        return Math.sqrt(o * o + s * s);
      }, pi = ["webkit", "moz"];
      function ln(o, s) {
        o.__set || (o.__set = {});
        var d = function(p) {
          if (pi.some((function(x) {
            return p.indexOf(x) === 0;
          }))) return 1;
          typeof o[p] != "function" && p !== "__set" && Object.defineProperty(o, p, { get: function() {
            return p in o.__set ? o.__set[p] : o.__set[p] = s[p];
          }, set: function(x) {
            o.__set[p] = x;
          }, configurable: !0 });
        };
        for (var h in s) d(h);
        return o;
      }
      function wn(o, s) {
        o.page = o.page || {}, o.page.x = s.page.x, o.page.y = s.page.y, o.client = o.client || {}, o.client.x = s.client.x, o.client.y = s.client.y, o.timeStamp = s.timeStamp;
      }
      function He(o) {
        o.page.x = 0, o.page.y = 0, o.client.x = 0, o.client.y = 0;
      }
      function re(o) {
        return o instanceof I.Event || o instanceof I.Touch;
      }
      function $e(o, s, d) {
        return o = o || "page", (d = d || {}).x = s[o + "X"], d.y = s[o + "Y"], d;
      }
      function Te(o, s) {
        return s = s || { x: 0, y: 0 }, le.isOperaMobile && re(o) ? ($e("screen", o, s), s.x += window.scrollX, s.y += window.scrollY) : $e("page", o, s), s;
      }
      function Ke(o) {
        return M.number(o.pointerId) ? o.pointerId : o.identifier;
      }
      function yt(o, s, d) {
        var h = s.length > 1 ? Fe(s) : s[0];
        Te(h, o.page), (function(p, x) {
          x = x || {}, le.isOperaMobile && re(p) ? $e("screen", p, x) : $e("client", p, x);
        })(h, o.client), o.timeStamp = d;
      }
      function Qe(o) {
        var s = [];
        return M.array(o) ? (s[0] = o[0], s[1] = o[1]) : o.type === "touchend" ? o.touches.length === 1 ? (s[0] = o.touches[0], s[1] = o.changedTouches[0]) : o.touches.length === 0 && (s[0] = o.changedTouches[0], s[1] = o.changedTouches[1]) : (s[0] = o.touches[0], s[1] = o.touches[1]), s;
      }
      function Fe(o) {
        for (var s = { pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0 }, d = 0; d < o.length; d++) {
          var h = o[d];
          for (var p in s) s[p] += h[p];
        }
        for (var x in s) s[x] /= o.length;
        return s;
      }
      function at(o) {
        if (!o.length) return null;
        var s = Qe(o), d = Math.min(s[0].pageX, s[1].pageX), h = Math.min(s[0].pageY, s[1].pageY), p = Math.max(s[0].pageX, s[1].pageX), x = Math.max(s[0].pageY, s[1].pageY);
        return { x: d, y: h, left: d, top: h, right: p, bottom: x, width: p - d, height: x - h };
      }
      function rt(o, s) {
        var d = s + "X", h = s + "Y", p = Qe(o), x = p[0][d] - p[1][d], k = p[0][h] - p[1][h];
        return Ht(x, k);
      }
      function ut(o, s) {
        var d = s + "X", h = s + "Y", p = Qe(o), x = p[1][d] - p[0][d], k = p[1][h] - p[0][h];
        return 180 * Math.atan2(k, x) / Math.PI;
      }
      function Et(o) {
        return M.string(o.pointerType) ? o.pointerType : M.number(o.pointerType) ? [void 0, void 0, "touch", "pen", "mouse"][o.pointerType] : /touch/.test(o.type || "") || o instanceof I.Touch ? "touch" : "mouse";
      }
      function Zt(o) {
        var s = M.func(o.composedPath) ? o.composedPath() : o.path;
        return [we(s ? s[0] : o.target), we(o.currentTarget)];
      }
      var un = (function() {
        function o(s) {
          l(this, o), this.immediatePropagationStopped = !1, this.propagationStopped = !1, this._interaction = s;
        }
        return r(o, [{ key: "preventDefault", value: function() {
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }]), o;
      })();
      Object.defineProperty(un.prototype, "interaction", { get: function() {
        return this._interaction._proxy;
      }, set: function() {
      } });
      var Dn = function(o, s) {
        for (var d = 0; d < s.length; d++) {
          var h = s[d];
          o.push(h);
        }
        return o;
      }, kn = function(o) {
        return Dn([], o);
      }, dn = function(o, s) {
        for (var d = 0; d < o.length; d++) if (s(o[d], d, o)) return d;
        return -1;
      }, Lt = function(o, s) {
        return o[dn(o, s)];
      }, fn = (function(o) {
        g(d, o);
        var s = S(d);
        function d(h, p, x) {
          var k;
          l(this, d), (k = s.call(this, p._interaction)).dropzone = void 0, k.dragEvent = void 0, k.relatedTarget = void 0, k.draggable = void 0, k.propagationStopped = !1, k.immediatePropagationStopped = !1;
          var z = x === "dragleave" ? h.prev : h.cur, R = z.element, U = z.dropzone;
          return k.type = x, k.target = R, k.currentTarget = R, k.dropzone = U, k.dragEvent = p, k.relatedTarget = p.target, k.draggable = p.interactable, k.timeStamp = p.timeStamp, k;
        }
        return r(d, [{ key: "reject", value: function() {
          var h = this, p = this._interaction.dropState;
          if (this.type === "dropactivate" || this.dropzone && p.cur.dropzone === this.dropzone && p.cur.element === this.target) if (p.prev.dropzone = this.dropzone, p.prev.element = this.target, p.rejected = !0, p.events.enter = null, this.stopImmediatePropagation(), this.type === "dropactivate") {
            var x = p.activeDrops, k = dn(x, (function(R) {
              var U = R.dropzone, L = R.element;
              return U === h.dropzone && L === h.target;
            }));
            p.activeDrops.splice(k, 1);
            var z = new d(p, this.dragEvent, "dropdeactivate");
            z.dropzone = this.dropzone, z.target = this.target, this.dropzone.fire(z);
          } else this.dropzone.fire(new d(p, this.dragEvent, "dragleave"));
        } }, { key: "preventDefault", value: function() {
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }]), d;
      })(un);
      function Mt(o, s) {
        for (var d = 0, h = o.slice(); d < h.length; d++) {
          var p = h[d], x = p.dropzone, k = p.element;
          s.dropzone = x, s.target = k, x.fire(s), s.propagationStopped = s.immediatePropagationStopped = !1;
        }
      }
      function en(o, s) {
        for (var d = (function(x, k) {
          for (var z = [], R = 0, U = x.interactables.list; R < U.length; R++) {
            var L = U[R];
            if (L.options.drop.enabled) {
              var Q = L.options.drop.accept;
              if (!(M.element(Q) && Q !== k || M.string(Q) && !he(k, Q) || M.func(Q) && !Q({ dropzone: L, draggableElement: k }))) for (var ne = 0, de = L.getAllElements(); ne < de.length; ne++) {
                var ge = de[ne];
                ge !== k && z.push({ dropzone: L, element: ge, rect: L.getRect(ge) });
              }
            }
          }
          return z;
        })(o, s), h = 0; h < d.length; h++) {
          var p = d[h];
          p.rect = p.dropzone.getRect(p.element);
        }
        return d;
      }
      function zt(o, s, d) {
        for (var h = o.dropState, p = o.interactable, x = o.element, k = [], z = 0, R = h.activeDrops; z < R.length; z++) {
          var U = R[z], L = U.dropzone, Q = U.element, ne = U.rect, de = L.dropCheck(s, d, p, x, Q, ne);
          k.push(de ? Q : null);
        }
        var ge = (function(me) {
          for (var Se, ke, Ee, Be = [], Je = 0; Je < me.length; Je++) {
            var Ve = me[Je], Ge = me[Se];
            if (Ve && Je !== Se) if (Ge) {
              var St = ae(Ve), gt = ae(Ge);
              if (St !== Ve.ownerDocument) if (gt !== Ve.ownerDocument) if (St !== gt) {
                Be = Be.length ? Be : ve(Ge);
                var Tt = void 0;
                if (Ge instanceof I.HTMLElement && Ve instanceof I.SVGElement && !(Ve instanceof I.SVGSVGElement)) {
                  if (Ve === gt) continue;
                  Tt = Ve.ownerSVGElement;
                } else Tt = Ve;
                for (var At = ve(Tt, Ge.ownerDocument), Jt = 0; At[Jt] && At[Jt] === Be[Jt]; ) Jt++;
                var xi = [At[Jt - 1], At[Jt], Be[Jt]];
                if (xi[0]) for (var Ln = xi[0].lastChild; Ln; ) {
                  if (Ln === xi[1]) {
                    Se = Je, Be = At;
                    break;
                  }
                  if (Ln === xi[2]) break;
                  Ln = Ln.previousSibling;
                }
              } else Ee = Ge, (parseInt(N(ke = Ve).getComputedStyle(ke).zIndex, 10) || 0) >= (parseInt(N(Ee).getComputedStyle(Ee).zIndex, 10) || 0) && (Se = Je);
              else Se = Je;
            } else Se = Je;
          }
          return Se;
        })(k);
        return h.activeDrops[ge] || null;
      }
      function qt(o, s, d) {
        var h = o.dropState, p = { enter: null, leave: null, activate: null, deactivate: null, move: null, drop: null };
        return d.type === "dragstart" && (p.activate = new fn(h, d, "dropactivate"), p.activate.target = null, p.activate.dropzone = null), d.type === "dragend" && (p.deactivate = new fn(h, d, "dropdeactivate"), p.deactivate.target = null, p.deactivate.dropzone = null), h.rejected || (h.cur.element !== h.prev.element && (h.prev.dropzone && (p.leave = new fn(h, d, "dragleave"), d.dragLeave = p.leave.target = h.prev.element, d.prevDropzone = p.leave.dropzone = h.prev.dropzone), h.cur.dropzone && (p.enter = new fn(h, d, "dragenter"), d.dragEnter = h.cur.element, d.dropzone = h.cur.dropzone)), d.type === "dragend" && h.cur.dropzone && (p.drop = new fn(h, d, "drop"), d.dropzone = h.cur.dropzone, d.relatedTarget = h.cur.element), d.type === "dragmove" && h.cur.dropzone && (p.move = new fn(h, d, "dropmove"), d.dropzone = h.cur.dropzone)), p;
      }
      function hn(o, s) {
        var d = o.dropState, h = d.activeDrops, p = d.cur, x = d.prev;
        s.leave && x.dropzone.fire(s.leave), s.enter && p.dropzone.fire(s.enter), s.move && p.dropzone.fire(s.move), s.drop && p.dropzone.fire(s.drop), s.deactivate && Mt(h, s.deactivate), d.prev.dropzone = p.dropzone, d.prev.element = p.element;
      }
      function Wn(o, s) {
        var d = o.interaction, h = o.iEvent, p = o.event;
        if (h.type === "dragmove" || h.type === "dragend") {
          var x = d.dropState;
          s.dynamicDrop && (x.activeDrops = en(s, d.element));
          var k = h, z = zt(d, k, p);
          x.rejected = x.rejected && !!z && z.dropzone === x.cur.dropzone && z.element === x.cur.element, x.cur.dropzone = z && z.dropzone, x.cur.element = z && z.element, x.events = qt(d, 0, k);
        }
      }
      var Le = { id: "actions/drop", install: function(o) {
        var s = o.actions, d = o.interactStatic, h = o.Interactable, p = o.defaults;
        o.usePlugin(A), h.prototype.dropzone = function(x) {
          return (function(k, z) {
            if (M.object(z)) {
              if (k.options.drop.enabled = z.enabled !== !1, z.listeners) {
                var R = It(z.listeners), U = Object.keys(R).reduce((function(Q, ne) {
                  return Q[/^(enter|leave)/.test(ne) ? "drag".concat(ne) : /^(activate|deactivate|move)/.test(ne) ? "drop".concat(ne) : ne] = R[ne], Q;
                }), {}), L = k.options.drop.listeners;
                L && k.off(L), k.on(U), k.options.drop.listeners = U;
              }
              return M.func(z.ondrop) && k.on("drop", z.ondrop), M.func(z.ondropactivate) && k.on("dropactivate", z.ondropactivate), M.func(z.ondropdeactivate) && k.on("dropdeactivate", z.ondropdeactivate), M.func(z.ondragenter) && k.on("dragenter", z.ondragenter), M.func(z.ondragleave) && k.on("dragleave", z.ondragleave), M.func(z.ondropmove) && k.on("dropmove", z.ondropmove), /^(pointer|center)$/.test(z.overlap) ? k.options.drop.overlap = z.overlap : M.number(z.overlap) && (k.options.drop.overlap = Math.max(Math.min(1, z.overlap), 0)), "accept" in z && (k.options.drop.accept = z.accept), "checker" in z && (k.options.drop.checker = z.checker), k;
            }
            return M.bool(z) ? (k.options.drop.enabled = z, k) : k.options.drop;
          })(this, x);
        }, h.prototype.dropCheck = function(x, k, z, R, U, L) {
          return (function(Q, ne, de, ge, me, Se, ke) {
            var Ee = !1;
            if (!(ke = ke || Q.getRect(Se))) return !!Q.options.drop.checker && Q.options.drop.checker(ne, de, Ee, Q, Se, ge, me);
            var Be = Q.options.drop.overlap;
            if (Be === "pointer") {
              var Je = mt(ge, me, "drag"), Ve = Te(ne);
              Ve.x += Je.x, Ve.y += Je.y;
              var Ge = Ve.x > ke.left && Ve.x < ke.right, St = Ve.y > ke.top && Ve.y < ke.bottom;
              Ee = Ge && St;
            }
            var gt = ge.getRect(me);
            if (gt && Be === "center") {
              var Tt = gt.left + gt.width / 2, At = gt.top + gt.height / 2;
              Ee = Tt >= ke.left && Tt <= ke.right && At >= ke.top && At <= ke.bottom;
            }
            return gt && M.number(Be) && (Ee = Math.max(0, Math.min(ke.right, gt.right) - Math.max(ke.left, gt.left)) * Math.max(0, Math.min(ke.bottom, gt.bottom) - Math.max(ke.top, gt.top)) / (gt.width * gt.height) >= Be), Q.options.drop.checker && (Ee = Q.options.drop.checker(ne, de, Ee, Q, Se, ge, me)), Ee;
          })(this, x, k, z, R, U, L);
        }, d.dynamicDrop = function(x) {
          return M.bool(x) ? (o.dynamicDrop = x, d) : o.dynamicDrop;
        }, xe(s.phaselessTypes, { dragenter: !0, dragleave: !0, dropactivate: !0, dropdeactivate: !0, dropmove: !0, drop: !0 }), s.methodDict.drop = "dropzone", o.dynamicDrop = !1, p.actions.drop = Le.defaults;
      }, listeners: { "interactions:before-action-start": function(o) {
        var s = o.interaction;
        s.prepared.name === "drag" && (s.dropState = { cur: { dropzone: null, element: null }, prev: { dropzone: null, element: null }, rejected: null, events: null, activeDrops: [] });
      }, "interactions:after-action-start": function(o, s) {
        var d = o.interaction, h = (o.event, o.iEvent);
        if (d.prepared.name === "drag") {
          var p = d.dropState;
          p.activeDrops = [], p.events = {}, p.activeDrops = en(s, d.element), p.events = qt(d, 0, h), p.events.activate && (Mt(p.activeDrops, p.events.activate), s.fire("actions/drop:start", { interaction: d, dragEvent: h }));
        }
      }, "interactions:action-move": Wn, "interactions:after-action-move": function(o, s) {
        var d = o.interaction, h = o.iEvent;
        if (d.prepared.name === "drag") {
          var p = d.dropState;
          hn(d, p.events), s.fire("actions/drop:move", { interaction: d, dragEvent: h }), p.events = {};
        }
      }, "interactions:action-end": function(o, s) {
        if (o.interaction.prepared.name === "drag") {
          var d = o.interaction, h = o.iEvent;
          Wn(o, s), hn(d, d.dropState.events), s.fire("actions/drop:end", { interaction: d, dragEvent: h });
        }
      }, "interactions:stop": function(o) {
        var s = o.interaction;
        if (s.prepared.name === "drag") {
          var d = s.dropState;
          d && (d.activeDrops = null, d.events = null, d.cur.dropzone = null, d.cur.element = null, d.prev.dropzone = null, d.prev.element = null, d.rejected = !1);
        }
      } }, getActiveDrops: en, getDrop: zt, getDropEvents: qt, fireDropEvents: hn, filterEventType: function(o) {
        return o.search("drag") === 0 || o.search("drop") === 0;
      }, defaults: { enabled: !1, accept: null, overlap: "pointer" } }, _n = Le;
      function Qt(o) {
        var s = o.interaction, d = o.iEvent, h = o.phase;
        if (s.prepared.name === "gesture") {
          var p = s.pointers.map((function(U) {
            return U.pointer;
          })), x = h === "start", k = h === "end", z = s.interactable.options.deltaSource;
          if (d.touches = [p[0], p[1]], x) d.distance = rt(p, z), d.box = at(p), d.scale = 1, d.ds = 0, d.angle = ut(p, z), d.da = 0, s.gesture.startDistance = d.distance, s.gesture.startAngle = d.angle;
          else if (k || s.pointers.length < 2) {
            var R = s.prevEvent;
            d.distance = R.distance, d.box = R.box, d.scale = R.scale, d.ds = 0, d.angle = R.angle, d.da = 0;
          } else d.distance = rt(p, z), d.box = at(p), d.scale = d.distance / s.gesture.startDistance, d.angle = ut(p, z), d.ds = d.scale - s.gesture.scale, d.da = d.angle - s.gesture.angle;
          s.gesture.distance = d.distance, s.gesture.angle = d.angle, M.number(d.scale) && d.scale !== 1 / 0 && !isNaN(d.scale) && (s.gesture.scale = d.scale);
        }
      }
      var On = { id: "actions/gesture", before: ["actions/drag", "actions/resize"], install: function(o) {
        var s = o.actions, d = o.Interactable, h = o.defaults;
        d.prototype.gesturable = function(p) {
          return M.object(p) ? (this.options.gesture.enabled = p.enabled !== !1, this.setPerAction("gesture", p), this.setOnEvents("gesture", p), this) : M.bool(p) ? (this.options.gesture.enabled = p, this) : this.options.gesture;
        }, s.map.gesture = On, s.methodDict.gesture = "gesturable", h.actions.gesture = On.defaults;
      }, listeners: { "interactions:action-start": Qt, "interactions:action-move": Qt, "interactions:action-end": Qt, "interactions:new": function(o) {
        o.interaction.gesture = { angle: 0, distance: 0, scale: 1, startAngle: 0, startDistance: 0 };
      }, "auto-start:check": function(o) {
        if (!(o.interaction.pointers.length < 2)) {
          var s = o.interactable.options.gesture;
          if (s && s.enabled) return o.action = { name: "gesture" }, !1;
        }
      } }, defaults: {}, getCursor: function() {
        return "";
      }, filterEventType: function(o) {
        return o.search("gesture") === 0;
      } }, va = On;
      function ya(o, s, d, h, p, x, k) {
        if (!s) return !1;
        if (s === !0) {
          var z = M.number(x.width) ? x.width : x.right - x.left, R = M.number(x.height) ? x.height : x.bottom - x.top;
          if (k = Math.min(k, Math.abs((o === "left" || o === "right" ? z : R) / 2)), z < 0 && (o === "left" ? o = "right" : o === "right" && (o = "left")), R < 0 && (o === "top" ? o = "bottom" : o === "bottom" && (o = "top")), o === "left") {
            var U = z >= 0 ? x.left : x.right;
            return d.x < U + k;
          }
          if (o === "top") {
            var L = R >= 0 ? x.top : x.bottom;
            return d.y < L + k;
          }
          if (o === "right") return d.x > (z >= 0 ? x.right : x.left) - k;
          if (o === "bottom") return d.y > (R >= 0 ? x.bottom : x.top) - k;
        }
        return !!M.element(h) && (M.element(s) ? s === h : Ne(h, s, p));
      }
      function Pn(o) {
        var s = o.iEvent, d = o.interaction;
        if (d.prepared.name === "resize" && d.resizeAxes) {
          var h = s;
          d.interactable.options.resize.square ? (d.resizeAxes === "y" ? h.delta.x = h.delta.y : h.delta.y = h.delta.x, h.axes = "xy") : (h.axes = d.resizeAxes, d.resizeAxes === "x" ? h.delta.y = 0 : d.resizeAxes === "y" && (h.delta.x = 0));
        }
      }
      var Cn, Rn, ti = { id: "actions/resize", before: ["actions/drag"], install: function(o) {
        var s = o.actions, d = o.browser, h = o.Interactable, p = o.defaults;
        ti.cursors = (function(x) {
          return x.isIe9 ? { x: "e-resize", y: "s-resize", xy: "se-resize", top: "n-resize", left: "w-resize", bottom: "s-resize", right: "e-resize", topleft: "se-resize", bottomright: "se-resize", topright: "ne-resize", bottomleft: "ne-resize" } : { x: "ew-resize", y: "ns-resize", xy: "nwse-resize", top: "ns-resize", left: "ew-resize", bottom: "ns-resize", right: "ew-resize", topleft: "nwse-resize", bottomright: "nwse-resize", topright: "nesw-resize", bottomleft: "nesw-resize" };
        })(d), ti.defaultMargin = d.supportsTouch || d.supportsPointerEvent ? 20 : 10, h.prototype.resizable = function(x) {
          return (function(k, z, R) {
            return M.object(z) ? (k.options.resize.enabled = z.enabled !== !1, k.setPerAction("resize", z), k.setOnEvents("resize", z), M.string(z.axis) && /^x$|^y$|^xy$/.test(z.axis) ? k.options.resize.axis = z.axis : z.axis === null && (k.options.resize.axis = R.defaults.actions.resize.axis), M.bool(z.preserveAspectRatio) ? k.options.resize.preserveAspectRatio = z.preserveAspectRatio : M.bool(z.square) && (k.options.resize.square = z.square), k) : M.bool(z) ? (k.options.resize.enabled = z, k) : k.options.resize;
          })(this, x, o);
        }, s.map.resize = ti, s.methodDict.resize = "resizable", p.actions.resize = ti.defaults;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.resizeAxes = "xy";
      }, "interactions:action-start": function(o) {
        (function(s) {
          var d = s.iEvent, h = s.interaction;
          if (h.prepared.name === "resize" && h.prepared.edges) {
            var p = d, x = h.rect;
            h._rects = { start: xe({}, x), corrected: xe({}, x), previous: xe({}, x), delta: { left: 0, right: 0, width: 0, top: 0, bottom: 0, height: 0 } }, p.edges = h.prepared.edges, p.rect = h._rects.corrected, p.deltaRect = h._rects.delta;
          }
        })(o), Pn(o);
      }, "interactions:action-move": function(o) {
        (function(s) {
          var d = s.iEvent, h = s.interaction;
          if (h.prepared.name === "resize" && h.prepared.edges) {
            var p = d, x = h.interactable.options.resize.invert, k = x === "reposition" || x === "negate", z = h.rect, R = h._rects, U = R.start, L = R.corrected, Q = R.delta, ne = R.previous;
            if (xe(ne, L), k) {
              if (xe(L, z), x === "reposition") {
                if (L.top > L.bottom) {
                  var de = L.top;
                  L.top = L.bottom, L.bottom = de;
                }
                if (L.left > L.right) {
                  var ge = L.left;
                  L.left = L.right, L.right = ge;
                }
              }
            } else L.top = Math.min(z.top, U.bottom), L.bottom = Math.max(z.bottom, U.top), L.left = Math.min(z.left, U.right), L.right = Math.max(z.right, U.left);
            for (var me in L.width = L.right - L.left, L.height = L.bottom - L.top, L) Q[me] = L[me] - ne[me];
            p.edges = h.prepared.edges, p.rect = L, p.deltaRect = Q;
          }
        })(o), Pn(o);
      }, "interactions:action-end": function(o) {
        var s = o.iEvent, d = o.interaction;
        if (d.prepared.name === "resize" && d.prepared.edges) {
          var h = s;
          h.edges = d.prepared.edges, h.rect = d._rects.corrected, h.deltaRect = d._rects.delta;
        }
      }, "auto-start:check": function(o) {
        var s = o.interaction, d = o.interactable, h = o.element, p = o.rect, x = o.buttons;
        if (p) {
          var k = xe({}, s.coords.cur.page), z = d.options.resize;
          if (z && z.enabled && (!s.pointerIsDown || !/mouse|pointer/.test(s.pointerType) || (x & z.mouseButtons) != 0)) {
            if (M.object(z.edges)) {
              var R = { left: !1, right: !1, top: !1, bottom: !1 };
              for (var U in R) R[U] = ya(U, z.edges[U], k, s._latestPointer.eventTarget, h, p, z.margin || ti.defaultMargin);
              R.left = R.left && !R.right, R.top = R.top && !R.bottom, (R.left || R.right || R.top || R.bottom) && (o.action = { name: "resize", edges: R });
            } else {
              var L = z.axis !== "y" && k.x > p.right - ti.defaultMargin, Q = z.axis !== "x" && k.y > p.bottom - ti.defaultMargin;
              (L || Q) && (o.action = { name: "resize", axes: (L ? "x" : "") + (Q ? "y" : "") });
            }
            return !o.action && void 0;
          }
        }
      } }, defaults: { square: !1, preserveAspectRatio: !1, axis: "xy", margin: NaN, edges: null, invert: "none" }, cursors: null, getCursor: function(o) {
        var s = o.edges, d = o.axis, h = o.name, p = ti.cursors, x = null;
        if (d) x = p[h + d];
        else if (s) {
          for (var k = "", z = 0, R = ["top", "bottom", "left", "right"]; z < R.length; z++) {
            var U = R[z];
            s[U] && (k += U);
          }
          x = p[k];
        }
        return x;
      }, filterEventType: function(o) {
        return o.search("resize") === 0;
      }, defaultMargin: null }, as = ti, kr = { id: "actions", install: function(o) {
        o.usePlugin(va), o.usePlugin(as), o.usePlugin(A), o.usePlugin(_n);
      } }, ls = 0, Mn = { request: function(o) {
        return Cn(o);
      }, cancel: function(o) {
        return Rn(o);
      }, init: function(o) {
        if (Cn = o.requestAnimationFrame, Rn = o.cancelAnimationFrame, !Cn) for (var s = ["ms", "moz", "webkit", "o"], d = 0; d < s.length; d++) {
          var h = s[d];
          Cn = o["".concat(h, "RequestAnimationFrame")], Rn = o["".concat(h, "CancelAnimationFrame")] || o["".concat(h, "CancelRequestAnimationFrame")];
        }
        Cn = Cn && Cn.bind(o), Rn = Rn && Rn.bind(o), Cn || (Cn = function(p) {
          var x = Date.now(), k = Math.max(0, 16 - (x - ls)), z = o.setTimeout((function() {
            p(x + k);
          }), k);
          return ls = x + k, z;
        }, Rn = function(p) {
          return clearTimeout(p);
        });
      } }, Xe = { defaults: { enabled: !1, margin: 60, container: null, speed: 300 }, now: Date.now, interaction: null, i: 0, x: 0, y: 0, isScrolling: !1, prevTime: 0, margin: 0, speed: 0, start: function(o) {
        Xe.isScrolling = !0, Mn.cancel(Xe.i), o.autoScroll = Xe, Xe.interaction = o, Xe.prevTime = Xe.now(), Xe.i = Mn.request(Xe.scroll);
      }, stop: function() {
        Xe.isScrolling = !1, Xe.interaction && (Xe.interaction.autoScroll = null), Mn.cancel(Xe.i);
      }, scroll: function() {
        var o = Xe.interaction, s = o.interactable, d = o.element, h = o.prepared.name, p = s.options[h].autoScroll, x = ba(p.container, s, d), k = Xe.now(), z = (k - Xe.prevTime) / 1e3, R = p.speed * z;
        if (R >= 1) {
          var U = { x: Xe.x * R, y: Xe.y * R };
          if (U.x || U.y) {
            var L = co(x);
            M.window(x) ? x.scrollBy(U.x, U.y) : x && (x.scrollLeft += U.x, x.scrollTop += U.y);
            var Q = co(x), ne = { x: Q.x - L.x, y: Q.y - L.y };
            (ne.x || ne.y) && s.fire({ type: "autoscroll", target: d, interactable: s, delta: ne, interaction: o, container: x });
          }
          Xe.prevTime = k;
        }
        Xe.isScrolling && (Mn.cancel(Xe.i), Xe.i = Mn.request(Xe.scroll));
      }, check: function(o, s) {
        var d;
        return (d = o.options[s].autoScroll) == null ? void 0 : d.enabled;
      }, onInteractionMove: function(o) {
        var s = o.interaction, d = o.pointer;
        if (s.interacting() && Xe.check(s.interactable, s.prepared.name)) if (s.simulation) Xe.x = Xe.y = 0;
        else {
          var h, p, x, k, z = s.interactable, R = s.element, U = s.prepared.name, L = z.options[U].autoScroll, Q = ba(L.container, z, R);
          if (M.window(Q)) k = d.clientX < Xe.margin, h = d.clientY < Xe.margin, p = d.clientX > Q.innerWidth - Xe.margin, x = d.clientY > Q.innerHeight - Xe.margin;
          else {
            var ne = Me(Q);
            k = d.clientX < ne.left + Xe.margin, h = d.clientY < ne.top + Xe.margin, p = d.clientX > ne.right - Xe.margin, x = d.clientY > ne.bottom - Xe.margin;
          }
          Xe.x = p ? 1 : k ? -1 : 0, Xe.y = x ? 1 : h ? -1 : 0, Xe.isScrolling || (Xe.margin = L.margin, Xe.speed = L.speed, Xe.start(s));
        }
      } };
      function ba(o, s, d) {
        return (M.string(o) ? qe(o, s, d) : o) || N(d);
      }
      function co(o) {
        return M.window(o) && (o = window.document.body), { x: o.scrollLeft, y: o.scrollTop };
      }
      var Ei = { id: "auto-scroll", install: function(o) {
        var s = o.defaults, d = o.actions;
        o.autoScroll = Xe, Xe.now = function() {
          return o.now();
        }, d.phaselessTypes.autoscroll = !0, s.perAction.autoScroll = Xe.defaults;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.autoScroll = null;
      }, "interactions:destroy": function(o) {
        o.interaction.autoScroll = null, Xe.stop(), Xe.interaction && (Xe.interaction = null);
      }, "interactions:stop": Xe.stop, "interactions:action-move": function(o) {
        return Xe.onInteractionMove(o);
      } } }, gn = Ei;
      function jt(o, s) {
        var d = !1;
        return function() {
          return d || (F.console.warn(s), d = !0), o.apply(this, arguments);
        };
      }
      function tn(o, s) {
        return o.name = s.name, o.axis = s.axis, o.edges = s.edges, o;
      }
      function bl(o) {
        return M.bool(o) ? (this.options.styleCursor = o, this) : o === null ? (delete this.options.styleCursor, this) : this.options.styleCursor;
      }
      function Yn(o) {
        return M.func(o) ? (this.options.actionChecker = o, this) : o === null ? (delete this.options.actionChecker, this) : this.options.actionChecker;
      }
      var Va = { id: "auto-start/interactableMethods", install: function(o) {
        var s = o.Interactable;
        s.prototype.getAction = function(d, h, p, x) {
          var k = (function(z, R, U, L, Q) {
            var ne = z.getRect(L), de = R.buttons || { 0: 1, 1: 4, 3: 8, 4: 16 }[R.button], ge = { action: null, interactable: z, interaction: U, element: L, rect: ne, buttons: de };
            return Q.fire("auto-start:check", ge), ge.action;
          })(this, h, p, x, o);
          return this.options.actionChecker ? this.options.actionChecker(d, h, k, this, x, p) : k;
        }, s.prototype.ignoreFrom = jt((function(d) {
          return this._backCompatOption("ignoreFrom", d);
        }), "Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."), s.prototype.allowFrom = jt((function(d) {
          return this._backCompatOption("allowFrom", d);
        }), "Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."), s.prototype.actionChecker = Yn, s.prototype.styleCursor = bl;
      } };
      function fo(o, s, d, h, p) {
        return s.testIgnoreAllow(s.options[o.name], d, h) && s.options[o.name].enabled && xa(s, d, o, p) ? o : null;
      }
      function ho(o, s, d, h, p, x, k) {
        for (var z = 0, R = h.length; z < R; z++) {
          var U = h[z], L = p[z], Q = U.getAction(s, d, o, L);
          if (Q) {
            var ne = fo(Q, U, L, x, k);
            if (ne) return { action: ne, interactable: U, element: L };
          }
        }
        return { action: null, interactable: null, element: null };
      }
      function Wa(o, s, d, h, p) {
        var x = [], k = [], z = h;
        function R(L) {
          x.push(L), k.push(z);
        }
        for (; M.element(z); ) {
          x = [], k = [], p.interactables.forEachMatch(z, R);
          var U = ho(o, s, d, x, k, h, p);
          if (U.action && !U.interactable.options[U.action.name].manualStart) return U;
          z = fe(z);
        }
        return { action: null, interactable: null, element: null };
      }
      function Ki(o, s, d) {
        var h = s.action, p = s.interactable, x = s.element;
        h = h || { name: null }, o.interactable = p, o.element = x, tn(o.prepared, h), o.rect = p && h.name ? p.getRect(x) : null, wl(o, d), d.fire("autoStart:prepared", { interaction: o });
      }
      function xa(o, s, d, h) {
        var p = o.options, x = p[d.name].max, k = p[d.name].maxPerElement, z = h.autoStart.maxInteractions, R = 0, U = 0, L = 0;
        if (!(x && k && z)) return !1;
        for (var Q = 0, ne = h.interactions.list; Q < ne.length; Q++) {
          var de = ne[Q], ge = de.prepared.name;
          if (de.interacting() && (++R >= z || de.interactable === o && ((U += ge === d.name ? 1 : 0) >= x || de.element === s && (L++, ge === d.name && L >= k))))
            return !1;
        }
        return z > 0;
      }
      function xl(o, s) {
        return M.number(o) ? (s.autoStart.maxInteractions = o, this) : s.autoStart.maxInteractions;
      }
      function Ya(o, s, d) {
        var h = d.autoStart.cursorElement;
        h && h !== o && (h.style.cursor = ""), o.ownerDocument.documentElement.style.cursor = s, o.style.cursor = s, d.autoStart.cursorElement = s ? o : null;
      }
      function wl(o, s) {
        var d = o.interactable, h = o.element, p = o.prepared;
        if (o.pointerType === "mouse" && d && d.options.styleCursor) {
          var x = "";
          if (p.name) {
            var k = d.options[p.name].cursorChecker;
            x = M.func(k) ? k(p, d, h, o._interacting) : s.actions.map[p.name].getCursor(p);
          }
          Ya(o.element, x || "", s);
        } else s.autoStart.cursorElement && Ya(s.autoStart.cursorElement, "", s);
      }
      var go = { id: "auto-start/base", before: ["actions"], install: function(o) {
        var s = o.interactStatic, d = o.defaults;
        o.usePlugin(Va), d.base.actionChecker = null, d.base.styleCursor = !0, xe(d.perAction, { manualStart: !1, max: 1 / 0, maxPerElement: 1, allowFrom: null, ignoreFrom: null, mouseButtons: 1 }), s.maxInteractions = function(h) {
          return xl(h, o);
        }, o.autoStart = { maxInteractions: 1 / 0, withinInteractionLimit: xa, cursorElement: null };
      }, listeners: { "interactions:down": function(o, s) {
        var d = o.interaction, h = o.pointer, p = o.event, x = o.eventTarget;
        d.interacting() || Ki(d, Wa(d, h, p, x, s), s);
      }, "interactions:move": function(o, s) {
        (function(d, h) {
          var p = d.interaction, x = d.pointer, k = d.event, z = d.eventTarget;
          p.pointerType !== "mouse" || p.pointerIsDown || p.interacting() || Ki(p, Wa(p, x, k, z, h), h);
        })(o, s), (function(d, h) {
          var p = d.interaction;
          if (p.pointerIsDown && !p.interacting() && p.pointerWasMoved && p.prepared.name) {
            h.fire("autoStart:before-start", d);
            var x = p.interactable, k = p.prepared.name;
            k && x && (x.options[k].manualStart || !xa(x, p.element, p.prepared, h) ? p.stop() : (p.start(p.prepared, x, p.element), wl(p, h)));
          }
        })(o, s);
      }, "interactions:stop": function(o, s) {
        var d = o.interaction, h = d.interactable;
        h && h.options.styleCursor && Ya(d.element, "", s);
      } }, maxInteractions: xl, withinInteractionLimit: xa, validateAction: fo }, Ba = go, po = { id: "auto-start/dragAxis", listeners: { "autoStart:before-start": function(o, s) {
        var d = o.interaction, h = o.eventTarget, p = o.dx, x = o.dy;
        if (d.prepared.name === "drag") {
          var k = Math.abs(p), z = Math.abs(x), R = d.interactable.options.drag, U = R.startAxis, L = k > z ? "x" : k < z ? "y" : "xy";
          if (d.prepared.axis = R.lockAxis === "start" ? L[0] : R.lockAxis, L !== "xy" && U !== "xy" && U !== L) {
            d.prepared.name = null;
            for (var Q = h, ne = function(ge) {
              if (ge !== d.interactable) {
                var me = d.interactable.options.drag;
                if (!me.manualStart && ge.testIgnoreAllow(me, Q, h)) {
                  var Se = ge.getAction(d.downPointer, d.downEvent, d, Q);
                  if (Se && Se.name === "drag" && (function(ke, Ee) {
                    if (!Ee) return !1;
                    var Be = Ee.options.drag.startAxis;
                    return ke === "xy" || Be === "xy" || Be === ke;
                  })(L, ge) && Ba.validateAction(Se, ge, Q, h, s)) return ge;
                }
              }
            }; M.element(Q); ) {
              var de = s.interactables.forEachMatch(Q, ne);
              if (de) {
                d.prepared.name = "drag", d.interactable = de, d.element = Q;
                break;
              }
              Q = fe(Q);
            }
          }
        }
      } } };
      function Bn(o) {
        var s = o.prepared && o.prepared.name;
        if (!s) return null;
        var d = o.interactable.options;
        return d[s].hold || d[s].delay;
      }
      var os = { id: "auto-start/hold", install: function(o) {
        var s = o.defaults;
        o.usePlugin(Ba), s.perAction.hold = 0, s.perAction.delay = 0;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.autoStartHoldTimer = null;
      }, "autoStart:prepared": function(o) {
        var s = o.interaction, d = Bn(s);
        d > 0 && (s.autoStartHoldTimer = setTimeout((function() {
          s.start(s.prepared, s.interactable, s.element);
        }), d));
      }, "interactions:move": function(o) {
        var s = o.interaction, d = o.duplicate;
        s.autoStartHoldTimer && s.pointerWasMoved && !d && (clearTimeout(s.autoStartHoldTimer), s.autoStartHoldTimer = null);
      }, "autoStart:before-start": function(o) {
        var s = o.interaction;
        Bn(s) > 0 && (s.prepared.name = null);
      } }, getHoldDuration: Bn }, ss = os, mo = { id: "auto-start", install: function(o) {
        o.usePlugin(Ba), o.usePlugin(ss), o.usePlugin(po);
      } }, rs = function(o) {
        return /^(always|never|auto)$/.test(o) ? (this.options.preventDefault = o, this) : M.bool(o) ? (this.options.preventDefault = o ? "always" : "never", this) : this.options.preventDefault;
      };
      function _r(o) {
        var s = o.interaction, d = o.event;
        s.interactable && s.interactable.checkAndPreventDefault(d);
      }
      var us = { id: "core/interactablePreventDefault", install: function(o) {
        var s = o.Interactable;
        s.prototype.preventDefault = rs, s.prototype.checkAndPreventDefault = function(d) {
          return (function(h, p, x) {
            var k = h.options.preventDefault;
            if (k !== "never") if (k !== "always") {
              if (p.events.supportsPassive && /^touch(start|move)$/.test(x.type)) {
                var z = N(x.target).document, R = p.getDocOptions(z);
                if (!R || !R.events || R.events.passive !== !1) return;
              }
              /^(mouse|pointer|touch)*(down|start)/i.test(x.type) || M.element(x.target) && he(x.target, "input,select,textarea,[contenteditable=true],[contenteditable=true] *") || x.preventDefault();
            } else x.preventDefault();
          })(this, o, d);
        }, o.interactions.docEvents.push({ type: "dragstart", listener: function(d) {
          for (var h = 0, p = o.interactions.list; h < p.length; h++) {
            var x = p[h];
            if (x.element && (x.element === d.target || ie(x.element, d.target))) return void x.interactable.checkAndPreventDefault(d);
          }
        } });
      }, listeners: ["down", "move", "up", "cancel"].reduce((function(o, s) {
        return o["interactions:".concat(s)] = _r, o;
      }), {}) };
      function Sl(o, s) {
        if (s.phaselessTypes[o]) return !0;
        for (var d in s.map) if (o.indexOf(d) === 0 && o.substr(d.length) in s.phases) return !0;
        return !1;
      }
      function Zi(o) {
        var s = {};
        for (var d in o) {
          var h = o[d];
          M.plainObject(h) ? s[d] = Zi(h) : M.array(h) ? s[d] = kn(h) : s[d] = h;
        }
        return s;
      }
      var kl = (function() {
        function o(s) {
          l(this, o), this.states = [], this.startOffset = { left: 0, right: 0, top: 0, bottom: 0 }, this.startDelta = void 0, this.result = void 0, this.endResult = void 0, this.startEdges = void 0, this.edges = void 0, this.interaction = void 0, this.interaction = s, this.result = _l(), this.edges = { left: !1, right: !1, top: !1, bottom: !1 };
        }
        return r(o, [{ key: "start", value: function(s, d) {
          var h, p, x = s.phase, k = this.interaction, z = (function(U) {
            var L = U.interactable.options[U.prepared.name], Q = L.modifiers;
            return Q && Q.length ? Q : ["snap", "snapSize", "snapEdges", "restrict", "restrictEdges", "restrictSize"].map((function(ne) {
              var de = L[ne];
              return de && de.enabled && { options: de, methods: de._methods };
            })).filter((function(ne) {
              return !!ne;
            }));
          })(k);
          this.prepareStates(z), this.startEdges = xe({}, k.edges), this.edges = xe({}, this.startEdges), this.startOffset = (h = k.rect, p = d, h ? { left: p.x - h.left, top: p.y - h.top, right: h.right - p.x, bottom: h.bottom - p.y } : { left: 0, top: 0, right: 0, bottom: 0 }), this.startDelta = { x: 0, y: 0 };
          var R = this.fillArg({ phase: x, pageCoords: d, preEnd: !1 });
          return this.result = _l(), this.startAll(R), this.result = this.setAll(R);
        } }, { key: "fillArg", value: function(s) {
          var d = this.interaction;
          return s.interaction = d, s.interactable = d.interactable, s.element = d.element, s.rect || (s.rect = d.rect), s.edges || (s.edges = this.startEdges), s.startOffset = this.startOffset, s;
        } }, { key: "startAll", value: function(s) {
          for (var d = 0, h = this.states; d < h.length; d++) {
            var p = h[d];
            p.methods.start && (s.state = p, p.methods.start(s));
          }
        } }, { key: "setAll", value: function(s) {
          var d = s.phase, h = s.preEnd, p = s.skipModifiers, x = s.rect, k = s.edges;
          s.coords = xe({}, s.pageCoords), s.rect = xe({}, x), s.edges = xe({}, k);
          for (var z = p ? this.states.slice(p) : this.states, R = _l(s.coords, s.rect), U = 0; U < z.length; U++) {
            var L, Q = z[U], ne = Q.options, de = xe({}, s.coords), ge = null;
            (L = Q.methods) != null && L.set && this.shouldDo(ne, h, d) && (s.state = Q, ge = Q.methods.set(s), Bt(s.edges, s.rect, { x: s.coords.x - de.x, y: s.coords.y - de.y })), R.eventProps.push(ge);
          }
          xe(this.edges, s.edges), R.delta.x = s.coords.x - s.pageCoords.x, R.delta.y = s.coords.y - s.pageCoords.y, R.rectDelta.left = s.rect.left - x.left, R.rectDelta.right = s.rect.right - x.right, R.rectDelta.top = s.rect.top - x.top, R.rectDelta.bottom = s.rect.bottom - x.bottom;
          var me = this.result.coords, Se = this.result.rect;
          if (me && Se) {
            var ke = R.rect.left !== Se.left || R.rect.right !== Se.right || R.rect.top !== Se.top || R.rect.bottom !== Se.bottom;
            R.changed = ke || me.x !== R.coords.x || me.y !== R.coords.y;
          }
          return R;
        } }, { key: "applyToInteraction", value: function(s) {
          var d = this.interaction, h = s.phase, p = d.coords.cur, x = d.coords.start, k = this.result, z = this.startDelta, R = k.delta;
          h === "start" && xe(this.startDelta, k.delta);
          for (var U = 0, L = [[x, z], [p, R]]; U < L.length; U++) {
            var Q = L[U], ne = Q[0], de = Q[1];
            ne.page.x += de.x, ne.page.y += de.y, ne.client.x += de.x, ne.client.y += de.y;
          }
          var ge = this.result.rectDelta, me = s.rect || d.rect;
          me.left += ge.left, me.right += ge.right, me.top += ge.top, me.bottom += ge.bottom, me.width = me.right - me.left, me.height = me.bottom - me.top;
        } }, { key: "setAndApply", value: function(s) {
          var d = this.interaction, h = s.phase, p = s.preEnd, x = s.skipModifiers, k = this.setAll(this.fillArg({ preEnd: p, phase: h, pageCoords: s.modifiedCoords || d.coords.cur.page }));
          if (this.result = k, !k.changed && (!x || x < this.states.length) && d.interacting()) return !1;
          if (s.modifiedCoords) {
            var z = d.coords.cur.page, R = { x: s.modifiedCoords.x - z.x, y: s.modifiedCoords.y - z.y };
            k.coords.x += R.x, k.coords.y += R.y, k.delta.x += R.x, k.delta.y += R.y;
          }
          this.applyToInteraction(s);
        } }, { key: "beforeEnd", value: function(s) {
          var d = s.interaction, h = s.event, p = this.states;
          if (p && p.length) {
            for (var x = !1, k = 0; k < p.length; k++) {
              var z = p[k];
              s.state = z;
              var R = z.options, U = z.methods, L = U.beforeEnd && U.beforeEnd(s);
              if (L) return this.endResult = L, !1;
              x = x || !x && this.shouldDo(R, !0, s.phase, !0);
            }
            x && d.move({ event: h, preEnd: !0 });
          }
        } }, { key: "stop", value: function(s) {
          var d = s.interaction;
          if (this.states && this.states.length) {
            var h = xe({ states: this.states, interactable: d.interactable, element: d.element, rect: null }, s);
            this.fillArg(h);
            for (var p = 0, x = this.states; p < x.length; p++) {
              var k = x[p];
              h.state = k, k.methods.stop && k.methods.stop(h);
            }
            this.states = null, this.endResult = null;
          }
        } }, { key: "prepareStates", value: function(s) {
          this.states = [];
          for (var d = 0; d < s.length; d++) {
            var h = s[d], p = h.options, x = h.methods, k = h.name;
            this.states.push({ options: p, methods: x, index: d, name: k });
          }
          return this.states;
        } }, { key: "restoreInteractionCoords", value: function(s) {
          var d = s.interaction, h = d.coords, p = d.rect, x = d.modification;
          if (x.result) {
            for (var k = x.startDelta, z = x.result, R = z.delta, U = z.rectDelta, L = 0, Q = [[h.start, k], [h.cur, R]]; L < Q.length; L++) {
              var ne = Q[L], de = ne[0], ge = ne[1];
              de.page.x -= ge.x, de.page.y -= ge.y, de.client.x -= ge.x, de.client.y -= ge.y;
            }
            p.left -= U.left, p.right -= U.right, p.top -= U.top, p.bottom -= U.bottom;
          }
        } }, { key: "shouldDo", value: function(s, d, h, p) {
          return !(!s || s.enabled === !1 || p && !s.endOnly || s.endOnly && !d || h === "start" && !s.setStart);
        } }, { key: "copyFrom", value: function(s) {
          this.startOffset = s.startOffset, this.startDelta = s.startDelta, this.startEdges = s.startEdges, this.edges = s.edges, this.states = s.states.map((function(d) {
            return Zi(d);
          })), this.result = _l(xe({}, s.result.coords), xe({}, s.result.rect));
        } }, { key: "destroy", value: function() {
          for (var s in this) this[s] = null;
        } }]), o;
      })();
      function _l(o, s) {
        return { rect: s, coords: o, delta: { x: 0, y: 0 }, rectDelta: { left: 0, right: 0, top: 0, bottom: 0 }, eventProps: [], changed: !0 };
      }
      function mi(o, s) {
        var d = o.defaults, h = { start: o.start, set: o.set, beforeEnd: o.beforeEnd, stop: o.stop }, p = function(x) {
          var k = x || {};
          for (var z in k.enabled = k.enabled !== !1, d) z in k || (k[z] = d[z]);
          var R = { options: k, methods: h, name: s, enable: function() {
            return k.enabled = !0, R;
          }, disable: function() {
            return k.enabled = !1, R;
          } };
          return R;
        };
        return s && typeof s == "string" && (p._defaults = d, p._methods = h), p;
      }
      function Qi(o) {
        var s = o.iEvent, d = o.interaction.modification.result;
        d && (s.modifiers = d.eventProps);
      }
      var Cl = { id: "modifiers/base", before: ["actions"], install: function(o) {
        o.defaults.perAction.modifiers = [];
      }, listeners: { "interactions:new": function(o) {
        var s = o.interaction;
        s.modification = new kl(s);
      }, "interactions:before-action-start": function(o) {
        var s = o.interaction, d = o.interaction.modification;
        d.start(o, s.coords.start.page), s.edges = d.edges, d.applyToInteraction(o);
      }, "interactions:before-action-move": function(o) {
        var s = o.interaction, d = s.modification, h = d.setAndApply(o);
        return s.edges = d.edges, h;
      }, "interactions:before-action-end": function(o) {
        var s = o.interaction, d = s.modification, h = d.beforeEnd(o);
        return s.edges = d.startEdges, h;
      }, "interactions:action-start": Qi, "interactions:action-move": Qi, "interactions:action-end": Qi, "interactions:after-action-start": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      }, "interactions:after-action-move": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      }, "interactions:stop": function(o) {
        return o.interaction.modification.stop(o);
      } } }, Ha = Cl, cs = { base: { preventDefault: "auto", deltaSource: "page" }, perAction: { enabled: !1, origin: { x: 0, y: 0 } }, actions: {} }, ja = (function(o) {
        g(d, o);
        var s = S(d);
        function d(h, p, x, k, z, R, U) {
          var L;
          l(this, d), (L = s.call(this, h)).relatedTarget = null, L.screenX = void 0, L.screenY = void 0, L.button = void 0, L.buttons = void 0, L.ctrlKey = void 0, L.shiftKey = void 0, L.altKey = void 0, L.metaKey = void 0, L.page = void 0, L.client = void 0, L.delta = void 0, L.rect = void 0, L.x0 = void 0, L.y0 = void 0, L.t0 = void 0, L.dt = void 0, L.duration = void 0, L.clientX0 = void 0, L.clientY0 = void 0, L.velocity = void 0, L.speed = void 0, L.swipe = void 0, L.axes = void 0, L.preEnd = void 0, z = z || h.element;
          var Q = h.interactable, ne = (Q && Q.options || cs).deltaSource, de = mt(Q, z, x), ge = k === "start", me = k === "end", Se = ge ? m(L) : h.prevEvent, ke = ge ? h.coords.start : me ? { page: Se.page, client: Se.client, timeStamp: h.coords.cur.timeStamp } : h.coords.cur;
          return L.page = xe({}, ke.page), L.client = xe({}, ke.client), L.rect = xe({}, h.rect), L.timeStamp = ke.timeStamp, me || (L.page.x -= de.x, L.page.y -= de.y, L.client.x -= de.x, L.client.y -= de.y), L.ctrlKey = p.ctrlKey, L.altKey = p.altKey, L.shiftKey = p.shiftKey, L.metaKey = p.metaKey, L.button = p.button, L.buttons = p.buttons, L.target = z, L.currentTarget = z, L.preEnd = R, L.type = U || x + (k || ""), L.interactable = Q, L.t0 = ge ? h.pointers[h.pointers.length - 1].downTime : Se.t0, L.x0 = h.coords.start.page.x - de.x, L.y0 = h.coords.start.page.y - de.y, L.clientX0 = h.coords.start.client.x - de.x, L.clientY0 = h.coords.start.client.y - de.y, L.delta = ge || me ? { x: 0, y: 0 } : { x: L[ne].x - Se[ne].x, y: L[ne].y - Se[ne].y }, L.dt = h.coords.delta.timeStamp, L.duration = L.timeStamp - L.t0, L.velocity = xe({}, h.coords.velocity[ne]), L.speed = Ht(L.velocity.x, L.velocity.y), L.swipe = me || k === "inertiastart" ? L.getSwipe() : null, L;
        }
        return r(d, [{ key: "getSwipe", value: function() {
          var h = this._interaction;
          if (h.prevEvent.speed < 600 || this.timeStamp - h.prevEvent.timeStamp > 150) return null;
          var p = 180 * Math.atan2(h.prevEvent.velocityY, h.prevEvent.velocityX) / Math.PI;
          p < 0 && (p += 360);
          var x = 112.5 <= p && p < 247.5, k = 202.5 <= p && p < 337.5;
          return { up: k, down: !k && 22.5 <= p && p < 157.5, left: x, right: !x && (292.5 <= p || p < 67.5), angle: p, speed: h.prevEvent.speed, velocity: { x: h.prevEvent.velocityX, y: h.prevEvent.velocityY } };
        } }, { key: "preventDefault", value: function() {
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }]), d;
      })(un);
      Object.defineProperties(ja.prototype, { pageX: { get: function() {
        return this.page.x;
      }, set: function(o) {
        this.page.x = o;
      } }, pageY: { get: function() {
        return this.page.y;
      }, set: function(o) {
        this.page.y = o;
      } }, clientX: { get: function() {
        return this.client.x;
      }, set: function(o) {
        this.client.x = o;
      } }, clientY: { get: function() {
        return this.client.y;
      }, set: function(o) {
        this.client.y = o;
      } }, dx: { get: function() {
        return this.delta.x;
      }, set: function(o) {
        this.delta.x = o;
      } }, dy: { get: function() {
        return this.delta.y;
      }, set: function(o) {
        this.delta.y = o;
      } }, velocityX: { get: function() {
        return this.velocity.x;
      }, set: function(o) {
        this.velocity.x = o;
      } }, velocityY: { get: function() {
        return this.velocity.y;
      }, set: function(o) {
        this.velocity.y = o;
      } } });
      var Cr = r((function o(s, d, h, p, x) {
        l(this, o), this.id = void 0, this.pointer = void 0, this.event = void 0, this.downTime = void 0, this.downTarget = void 0, this.id = s, this.pointer = d, this.event = h, this.downTime = p, this.downTarget = x;
      })), Mr = (function(o) {
        return o.interactable = "", o.element = "", o.prepared = "", o.pointerIsDown = "", o.pointerWasMoved = "", o._proxy = "", o;
      })({}), ds = (function(o) {
        return o.start = "", o.move = "", o.end = "", o.stop = "", o.interacting = "", o;
      })({}), wa = 0, Ml = (function() {
        function o(s) {
          var d = this, h = s.pointerType, p = s.scopeFire;
          l(this, o), this.interactable = null, this.element = null, this.rect = null, this._rects = void 0, this.edges = null, this._scopeFire = void 0, this.prepared = { name: null, axis: null, edges: null }, this.pointerType = void 0, this.pointers = [], this.downEvent = null, this.downPointer = {}, this._latestPointer = { pointer: null, event: null, eventTarget: null }, this.prevEvent = null, this.pointerIsDown = !1, this.pointerWasMoved = !1, this._interacting = !1, this._ending = !1, this._stopped = !0, this._proxy = void 0, this.simulation = null, this.doMove = jt((function(L) {
            this.move(L);
          }), "The interaction.doMove() method has been renamed to interaction.move()"), this.coords = { start: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, prev: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, cur: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, delta: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, velocity: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 } }, this._id = wa++, this._scopeFire = p, this.pointerType = h;
          var x = this;
          this._proxy = {};
          var k = function(L) {
            Object.defineProperty(d._proxy, L, { get: function() {
              return x[L];
            } });
          };
          for (var z in Mr) k(z);
          var R = function(L) {
            Object.defineProperty(d._proxy, L, { value: function() {
              return x[L].apply(x, arguments);
            } });
          };
          for (var U in ds) R(U);
          this._scopeFire("interactions:new", { interaction: this });
        }
        return r(o, [{ key: "pointerMoveTolerance", get: function() {
          return 1;
        } }, { key: "pointerDown", value: function(s, d, h) {
          var p = this.updatePointer(s, d, h, !0), x = this.pointers[p];
          this._scopeFire("interactions:down", { pointer: s, event: d, eventTarget: h, pointerIndex: p, pointerInfo: x, type: "down", interaction: this });
        } }, { key: "start", value: function(s, d, h) {
          return !(this.interacting() || !this.pointerIsDown || this.pointers.length < (s.name === "gesture" ? 2 : 1) || !d.options[s.name].enabled) && (tn(this.prepared, s), this.interactable = d, this.element = h, this.rect = d.getRect(h), this.edges = this.prepared.edges ? xe({}, this.prepared.edges) : { left: !0, right: !0, top: !0, bottom: !0 }, this._stopped = !1, this._interacting = this._doPhase({ interaction: this, event: this.downEvent, phase: "start" }) && !this._stopped, this._interacting);
        } }, { key: "pointerMove", value: function(s, d, h) {
          this.simulation || this.modification && this.modification.endResult || this.updatePointer(s, d, h, !1);
          var p, x, k = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y;
          this.pointerIsDown && !this.pointerWasMoved && (p = this.coords.cur.client.x - this.coords.start.client.x, x = this.coords.cur.client.y - this.coords.start.client.y, this.pointerWasMoved = Ht(p, x) > this.pointerMoveTolerance);
          var z, R, U, L = this.getPointerIndex(s), Q = { pointer: s, pointerIndex: L, pointerInfo: this.pointers[L], event: d, type: "move", eventTarget: h, dx: p, dy: x, duplicate: k, interaction: this };
          k || (z = this.coords.velocity, R = this.coords.delta, U = Math.max(R.timeStamp / 1e3, 1e-3), z.page.x = R.page.x / U, z.page.y = R.page.y / U, z.client.x = R.client.x / U, z.client.y = R.client.y / U, z.timeStamp = U), this._scopeFire("interactions:move", Q), k || this.simulation || (this.interacting() && (Q.type = null, this.move(Q)), this.pointerWasMoved && wn(this.coords.prev, this.coords.cur));
        } }, { key: "move", value: function(s) {
          s && s.event || He(this.coords.delta), (s = xe({ pointer: this._latestPointer.pointer, event: this._latestPointer.event, eventTarget: this._latestPointer.eventTarget, interaction: this }, s || {})).phase = "move", this._doPhase(s);
        } }, { key: "pointerUp", value: function(s, d, h, p) {
          var x = this.getPointerIndex(s);
          x === -1 && (x = this.updatePointer(s, d, h, !1));
          var k = /cancel$/i.test(d.type) ? "cancel" : "up";
          this._scopeFire("interactions:".concat(k), { pointer: s, pointerIndex: x, pointerInfo: this.pointers[x], event: d, eventTarget: h, type: k, curEventTarget: p, interaction: this }), this.simulation || this.end(d), this.removePointer(s, d);
        } }, { key: "documentBlur", value: function(s) {
          this.end(s), this._scopeFire("interactions:blur", { event: s, type: "blur", interaction: this });
        } }, { key: "end", value: function(s) {
          var d;
          this._ending = !0, s = s || this._latestPointer.event, this.interacting() && (d = this._doPhase({ event: s, interaction: this, phase: "end" })), this._ending = !1, d === !0 && this.stop();
        } }, { key: "currentAction", value: function() {
          return this._interacting ? this.prepared.name : null;
        } }, { key: "interacting", value: function() {
          return this._interacting;
        } }, { key: "stop", value: function() {
          this._scopeFire("interactions:stop", { interaction: this }), this.interactable = this.element = null, this._interacting = !1, this._stopped = !0, this.prepared.name = this.prevEvent = null;
        } }, { key: "getPointerIndex", value: function(s) {
          var d = Ke(s);
          return this.pointerType === "mouse" || this.pointerType === "pen" ? this.pointers.length - 1 : dn(this.pointers, (function(h) {
            return h.id === d;
          }));
        } }, { key: "getPointerInfo", value: function(s) {
          return this.pointers[this.getPointerIndex(s)];
        } }, { key: "updatePointer", value: function(s, d, h, p) {
          var x, k, z, R = Ke(s), U = this.getPointerIndex(s), L = this.pointers[U];
          return p = p !== !1 && (p || /(down|start)$/i.test(d.type)), L ? L.pointer = s : (L = new Cr(R, s, d, null, null), U = this.pointers.length, this.pointers.push(L)), yt(this.coords.cur, this.pointers.map((function(Q) {
            return Q.pointer;
          })), this._now()), x = this.coords.delta, k = this.coords.prev, z = this.coords.cur, x.page.x = z.page.x - k.page.x, x.page.y = z.page.y - k.page.y, x.client.x = z.client.x - k.client.x, x.client.y = z.client.y - k.client.y, x.timeStamp = z.timeStamp - k.timeStamp, p && (this.pointerIsDown = !0, L.downTime = this.coords.cur.timeStamp, L.downTarget = h, ln(this.downPointer, s), this.interacting() || (wn(this.coords.start, this.coords.cur), wn(this.coords.prev, this.coords.cur), this.downEvent = d, this.pointerWasMoved = !1)), this._updateLatestPointer(s, d, h), this._scopeFire("interactions:update-pointer", { pointer: s, event: d, eventTarget: h, down: p, pointerInfo: L, pointerIndex: U, interaction: this }), U;
        } }, { key: "removePointer", value: function(s, d) {
          var h = this.getPointerIndex(s);
          if (h !== -1) {
            var p = this.pointers[h];
            this._scopeFire("interactions:remove-pointer", { pointer: s, event: d, eventTarget: null, pointerIndex: h, pointerInfo: p, interaction: this }), this.pointers.splice(h, 1), this.pointerIsDown = !1;
          }
        } }, { key: "_updateLatestPointer", value: function(s, d, h) {
          this._latestPointer.pointer = s, this._latestPointer.event = d, this._latestPointer.eventTarget = h;
        } }, { key: "destroy", value: function() {
          this._latestPointer.pointer = null, this._latestPointer.event = null, this._latestPointer.eventTarget = null;
        } }, { key: "_createPreparedEvent", value: function(s, d, h, p) {
          return new ja(this, s, this.prepared.name, d, this.element, h, p);
        } }, { key: "_fireEvent", value: function(s) {
          var d;
          (d = this.interactable) == null || d.fire(s), (!this.prevEvent || s.timeStamp >= this.prevEvent.timeStamp) && (this.prevEvent = s);
        } }, { key: "_doPhase", value: function(s) {
          var d = s.event, h = s.phase, p = s.preEnd, x = s.type, k = this.rect;
          if (k && h === "move" && (Bt(this.edges, k, this.coords.delta[this.interactable.options.deltaSource]), k.width = k.right - k.left, k.height = k.bottom - k.top), this._scopeFire("interactions:before-action-".concat(h), s) === !1) return !1;
          var z = s.iEvent = this._createPreparedEvent(d, h, p, x);
          return this._scopeFire("interactions:action-".concat(h), s), h === "start" && (this.prevEvent = z), this._fireEvent(z), this._scopeFire("interactions:after-action-".concat(h), s), !0;
        } }, { key: "_now", value: function() {
          return Date.now();
        } }]), o;
      })();
      function Tl(o) {
        Sa(o.interaction);
      }
      function Sa(o) {
        if (!(function(d) {
          return !(!d.offset.pending.x && !d.offset.pending.y);
        })(o)) return !1;
        var s = o.offset.pending;
        return $i(o.coords.cur, s), $i(o.coords.delta, s), Bt(o.edges, o.rect, s), s.x = 0, s.y = 0, !0;
      }
      function Tr(o) {
        var s = o.x, d = o.y;
        this.offset.pending.x += s, this.offset.pending.y += d, this.offset.total.x += s, this.offset.total.y += d;
      }
      function $i(o, s) {
        var d = o.page, h = o.client, p = s.x, x = s.y;
        d.x += p, d.y += x, h.x += p, h.y += x;
      }
      ds.offsetBy = "";
      var zr = { id: "offset", before: ["modifiers", "pointer-events", "actions", "inertia"], install: function(o) {
        o.Interaction.prototype.offsetBy = Tr;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.offset = { total: { x: 0, y: 0 }, pending: { x: 0, y: 0 } };
      }, "interactions:update-pointer": function(o) {
        return (function(s) {
          s.pointerIsDown && ($i(s.coords.cur, s.offset.total), s.offset.pending.x = 0, s.offset.pending.y = 0);
        })(o.interaction);
      }, "interactions:before-action-start": Tl, "interactions:before-action-move": Tl, "interactions:before-action-end": function(o) {
        var s = o.interaction;
        if (Sa(s)) return s.move({ offset: !0 }), s.end(), !1;
      }, "interactions:stop": function(o) {
        var s = o.interaction;
        s.offset.total.x = 0, s.offset.total.y = 0, s.offset.pending.x = 0, s.offset.pending.y = 0;
      } } }, vo = zr, yo = (function() {
        function o(s) {
          l(this, o), this.active = !1, this.isModified = !1, this.smoothEnd = !1, this.allowResume = !1, this.modification = void 0, this.modifierCount = 0, this.modifierArg = void 0, this.startCoords = void 0, this.t0 = 0, this.v0 = 0, this.te = 0, this.targetOffset = void 0, this.modifiedOffset = void 0, this.currentOffset = void 0, this.lambda_v0 = 0, this.one_ve_v0 = 0, this.timeout = void 0, this.interaction = void 0, this.interaction = s;
        }
        return r(o, [{ key: "start", value: function(s) {
          var d = this.interaction, h = ka(d);
          if (!h || !h.enabled) return !1;
          var p = d.coords.velocity.client, x = Ht(p.x, p.y), k = this.modification || (this.modification = new kl(d));
          if (k.copyFrom(d.modification), this.t0 = d._now(), this.allowResume = h.allowResume, this.v0 = x, this.currentOffset = { x: 0, y: 0 }, this.startCoords = d.coords.cur.page, this.modifierArg = k.fillArg({ pageCoords: this.startCoords, preEnd: !0, phase: "inertiastart" }), this.t0 - d.coords.cur.timeStamp < 50 && x > h.minSpeed && x > h.endSpeed) this.startInertia();
          else {
            if (k.result = k.setAll(this.modifierArg), !k.result.changed) return !1;
            this.startSmoothEnd();
          }
          return d.modification.result.rect = null, d.offsetBy(this.targetOffset), d._doPhase({ interaction: d, event: s, phase: "inertiastart" }), d.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y }), d.modification.result.rect = null, this.active = !0, d.simulation = this, !0;
        } }, { key: "startInertia", value: function() {
          var s = this, d = this.interaction.coords.velocity.client, h = ka(this.interaction), p = h.resistance, x = -Math.log(h.endSpeed / this.v0) / p;
          this.targetOffset = { x: (d.x - x) / p, y: (d.y - x) / p }, this.te = x, this.lambda_v0 = p / this.v0, this.one_ve_v0 = 1 - h.endSpeed / this.v0;
          var k = this.modification, z = this.modifierArg;
          z.pageCoords = { x: this.startCoords.x + this.targetOffset.x, y: this.startCoords.y + this.targetOffset.y }, k.result = k.setAll(z), k.result.changed && (this.isModified = !0, this.modifiedOffset = { x: this.targetOffset.x + k.result.delta.x, y: this.targetOffset.y + k.result.delta.y }), this.onNextFrame((function() {
            return s.inertiaTick();
          }));
        } }, { key: "startSmoothEnd", value: function() {
          var s = this;
          this.smoothEnd = !0, this.isModified = !0, this.targetOffset = { x: this.modification.result.delta.x, y: this.modification.result.delta.y }, this.onNextFrame((function() {
            return s.smoothEndTick();
          }));
        } }, { key: "onNextFrame", value: function(s) {
          var d = this;
          this.timeout = Mn.request((function() {
            d.active && s();
          }));
        } }, { key: "inertiaTick", value: function() {
          var s, d, h, p, x, k, z, R = this, U = this.interaction, L = ka(U).resistance, Q = (U._now() - this.t0) / 1e3;
          if (Q < this.te) {
            var ne, de = 1 - (Math.exp(-L * Q) - this.lambda_v0) / this.one_ve_v0;
            this.isModified ? (s = 0, d = 0, h = this.targetOffset.x, p = this.targetOffset.y, x = this.modifiedOffset.x, k = this.modifiedOffset.y, ne = { x: Xi(z = de, s, h, x), y: Xi(z, d, p, k) }) : ne = { x: this.targetOffset.x * de, y: this.targetOffset.y * de };
            var ge = { x: ne.x - this.currentOffset.x, y: ne.y - this.currentOffset.y };
            this.currentOffset.x += ge.x, this.currentOffset.y += ge.y, U.offsetBy(ge), U.move(), this.onNextFrame((function() {
              return R.inertiaTick();
            }));
          } else U.offsetBy({ x: this.modifiedOffset.x - this.currentOffset.x, y: this.modifiedOffset.y - this.currentOffset.y }), this.end();
        } }, { key: "smoothEndTick", value: function() {
          var s = this, d = this.interaction, h = d._now() - this.t0, p = ka(d).smoothEndDuration;
          if (h < p) {
            var x = { x: Ji(h, 0, this.targetOffset.x, p), y: Ji(h, 0, this.targetOffset.y, p) }, k = { x: x.x - this.currentOffset.x, y: x.y - this.currentOffset.y };
            this.currentOffset.x += k.x, this.currentOffset.y += k.y, d.offsetBy(k), d.move({ skipModifiers: this.modifierCount }), this.onNextFrame((function() {
              return s.smoothEndTick();
            }));
          } else d.offsetBy({ x: this.targetOffset.x - this.currentOffset.x, y: this.targetOffset.y - this.currentOffset.y }), this.end();
        } }, { key: "resume", value: function(s) {
          var d = s.pointer, h = s.event, p = s.eventTarget, x = this.interaction;
          x.offsetBy({ x: -this.currentOffset.x, y: -this.currentOffset.y }), x.updatePointer(d, h, p, !0), x._doPhase({ interaction: x, event: h, phase: "resume" }), wn(x.coords.prev, x.coords.cur), this.stop();
        } }, { key: "end", value: function() {
          this.interaction.move(), this.interaction.end(), this.stop();
        } }, { key: "stop", value: function() {
          this.active = this.smoothEnd = !1, this.interaction.simulation = null, Mn.cancel(this.timeout);
        } }]), o;
      })();
      function ka(o) {
        var s = o.interactable, d = o.prepared;
        return s && s.options && d.name && s.options[d.name].inertia;
      }
      var bo = { id: "inertia", before: ["modifiers", "actions"], install: function(o) {
        var s = o.defaults;
        o.usePlugin(vo), o.usePlugin(Ha), o.actions.phases.inertiastart = !0, o.actions.phases.resume = !0, s.perAction.inertia = { enabled: !1, resistance: 10, minSpeed: 100, endSpeed: 10, allowResume: !0, smoothEndDuration: 300 };
      }, listeners: { "interactions:new": function(o) {
        var s = o.interaction;
        s.inertia = new yo(s);
      }, "interactions:before-action-end": function(o) {
        var s = o.interaction, d = o.event;
        return (!s._interacting || s.simulation || !s.inertia.start(d)) && null;
      }, "interactions:down": function(o) {
        var s = o.interaction, d = o.eventTarget, h = s.inertia;
        if (h.active) for (var p = d; M.element(p); ) {
          if (p === s.element) {
            h.resume(o);
            break;
          }
          p = fe(p);
        }
      }, "interactions:stop": function(o) {
        var s = o.interaction.inertia;
        s.active && s.stop();
      }, "interactions:before-action-resume": function(o) {
        var s = o.interaction.modification;
        s.stop(o), s.start(o, o.interaction.coords.cur.page), s.applyToInteraction(o);
      }, "interactions:before-action-inertiastart": function(o) {
        return o.interaction.modification.setAndApply(o);
      }, "interactions:action-resume": Qi, "interactions:action-inertiastart": Qi, "interactions:after-action-inertiastart": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      }, "interactions:after-action-resume": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      } } };
      function Xi(o, s, d, h) {
        var p = 1 - o;
        return p * p * s + 2 * p * o * d + o * o * h;
      }
      function Ji(o, s, d, h) {
        return -d * (o /= h) * (o - 2) + s;
      }
      var fs = bo;
      function xo(o, s) {
        for (var d = 0; d < s.length; d++) {
          var h = s[d];
          if (o.immediatePropagationStopped) break;
          h(o);
        }
      }
      var ea = (function() {
        function o(s) {
          l(this, o), this.options = void 0, this.types = {}, this.propagationStopped = !1, this.immediatePropagationStopped = !1, this.global = void 0, this.options = xe({}, s || {});
        }
        return r(o, [{ key: "fire", value: function(s) {
          var d, h = this.global;
          (d = this.types[s.type]) && xo(s, d), !s.propagationStopped && h && (d = h[s.type]) && xo(s, d);
        } }, { key: "on", value: function(s, d) {
          var h = It(s, d);
          for (s in h) this.types[s] = Dn(this.types[s] || [], h[s]);
        } }, { key: "off", value: function(s, d) {
          var h = It(s, d);
          for (s in h) {
            var p = this.types[s];
            if (p && p.length) for (var x = 0, k = h[s]; x < k.length; x++) {
              var z = k[x], R = p.indexOf(z);
              R !== -1 && p.splice(R, 1);
            }
          }
        } }, { key: "getRect", value: function(s) {
          return null;
        } }]), o;
      })(), _a = (function() {
        function o(s) {
          l(this, o), this.currentTarget = void 0, this.originalEvent = void 0, this.type = void 0, this.originalEvent = s, ln(this, s);
        }
        return r(o, [{ key: "preventOriginalDefault", value: function() {
          this.originalEvent.preventDefault();
        } }, { key: "stopPropagation", value: function() {
          this.originalEvent.stopPropagation();
        } }, { key: "stopImmediatePropagation", value: function() {
          this.originalEvent.stopImmediatePropagation();
        } }]), o;
      })();
      function Ca(o) {
        return M.object(o) ? { capture: !!o.capture, passive: !!o.passive } : { capture: !!o, passive: !1 };
      }
      function Ua(o, s) {
        return o === s || (typeof o == "boolean" ? !!s.capture === o && !s.passive : !!o.capture == !!s.capture && !!o.passive == !!s.passive);
      }
      var $t = { id: "events", install: function(o) {
        var s, d = [], h = {}, p = [], x = { add: k, remove: z, addDelegate: function(L, Q, ne, de, ge) {
          var me = Ca(ge);
          if (!h[ne]) {
            h[ne] = [];
            for (var Se = 0; Se < p.length; Se++) {
              var ke = p[Se];
              k(ke, ne, R), k(ke, ne, U, !0);
            }
          }
          var Ee = h[ne], Be = Lt(Ee, (function(Je) {
            return Je.selector === L && Je.context === Q;
          }));
          Be || (Be = { selector: L, context: Q, listeners: [] }, Ee.push(Be)), Be.listeners.push({ func: de, options: me });
        }, removeDelegate: function(L, Q, ne, de, ge) {
          var me, Se = Ca(ge), ke = h[ne], Ee = !1;
          if (ke)
            for (me = ke.length - 1; me >= 0; me--) {
              var Be = ke[me];
              if (Be.selector === L && Be.context === Q) {
                for (var Je = Be.listeners, Ve = Je.length - 1; Ve >= 0; Ve--) {
                  var Ge = Je[Ve];
                  if (Ge.func === de && Ua(Ge.options, Se)) {
                    Je.splice(Ve, 1), Je.length || (ke.splice(me, 1), z(Q, ne, R), z(Q, ne, U, !0)), Ee = !0;
                    break;
                  }
                }
                if (Ee) break;
              }
            }
        }, delegateListener: R, delegateUseCapture: U, delegatedEvents: h, documents: p, targets: d, supportsOptions: !1, supportsPassive: !1 };
        function k(L, Q, ne, de) {
          if (L.addEventListener) {
            var ge = Ca(de), me = Lt(d, (function(Se) {
              return Se.eventTarget === L;
            }));
            me || (me = { eventTarget: L, events: {} }, d.push(me)), me.events[Q] || (me.events[Q] = []), Lt(me.events[Q], (function(Se) {
              return Se.func === ne && Ua(Se.options, ge);
            })) || (L.addEventListener(Q, ne, x.supportsOptions ? ge : ge.capture), me.events[Q].push({ func: ne, options: ge }));
          }
        }
        function z(L, Q, ne, de) {
          if (L.addEventListener && L.removeEventListener) {
            var ge = dn(d, (function(St) {
              return St.eventTarget === L;
            })), me = d[ge];
            if (me && me.events) if (Q !== "all") {
              var Se = !1, ke = me.events[Q];
              if (ke) {
                if (ne === "all") {
                  for (var Ee = ke.length - 1; Ee >= 0; Ee--) {
                    var Be = ke[Ee];
                    z(L, Q, Be.func, Be.options);
                  }
                  return;
                }
                for (var Je = Ca(de), Ve = 0; Ve < ke.length; Ve++) {
                  var Ge = ke[Ve];
                  if (Ge.func === ne && Ua(Ge.options, Je)) {
                    L.removeEventListener(Q, ne, x.supportsOptions ? Je : Je.capture), ke.splice(Ve, 1), ke.length === 0 && (delete me.events[Q], Se = !0);
                    break;
                  }
                }
              }
              Se && !Object.keys(me.events).length && d.splice(ge, 1);
            } else for (Q in me.events) me.events.hasOwnProperty(Q) && z(L, Q, "all");
          }
        }
        function R(L, Q) {
          for (var ne = Ca(Q), de = new _a(L), ge = h[L.type], me = Zt(L)[0], Se = me; M.element(Se); ) {
            for (var ke = 0; ke < ge.length; ke++) {
              var Ee = ge[ke], Be = Ee.selector, Je = Ee.context;
              if (he(Se, Be) && ie(Je, me) && ie(Je, Se)) {
                var Ve = Ee.listeners;
                de.currentTarget = Se;
                for (var Ge = 0; Ge < Ve.length; Ge++) {
                  var St = Ve[Ge];
                  Ua(St.options, ne) && St.func(de);
                }
              }
            }
            Se = fe(Se);
          }
        }
        function U(L) {
          return R(L, !0);
        }
        return (s = o.document) == null || s.createElement("div").addEventListener("test", null, { get capture() {
          return x.supportsOptions = !0;
        }, get passive() {
          return x.supportsPassive = !0;
        } }), o.events = x, x;
      } }, Dt = { methodOrder: ["simulationResume", "mouseOrPen", "hasPointer", "idle"], search: function(o) {
        for (var s = 0, d = Dt.methodOrder; s < d.length; s++) {
          var h = d[s], p = Dt[h](o);
          if (p) return p;
        }
        return null;
      }, simulationResume: function(o) {
        var s = o.pointerType, d = o.eventType, h = o.eventTarget, p = o.scope;
        if (!/down|start/i.test(d)) return null;
        for (var x = 0, k = p.interactions.list; x < k.length; x++) {
          var z = k[x], R = h;
          if (z.simulation && z.simulation.allowResume && z.pointerType === s) for (; R; ) {
            if (R === z.element) return z;
            R = fe(R);
          }
        }
        return null;
      }, mouseOrPen: function(o) {
        var s, d = o.pointerId, h = o.pointerType, p = o.eventType, x = o.scope;
        if (h !== "mouse" && h !== "pen") return null;
        for (var k = 0, z = x.interactions.list; k < z.length; k++) {
          var R = z[k];
          if (R.pointerType === h) {
            if (R.simulation && !vi(R, d)) continue;
            if (R.interacting()) return R;
            s || (s = R);
          }
        }
        if (s) return s;
        for (var U = 0, L = x.interactions.list; U < L.length; U++) {
          var Q = L[U];
          if (!(Q.pointerType !== h || /down/i.test(p) && Q.simulation)) return Q;
        }
        return null;
      }, hasPointer: function(o) {
        for (var s = o.pointerId, d = 0, h = o.scope.interactions.list; d < h.length; d++) {
          var p = h[d];
          if (vi(p, s)) return p;
        }
        return null;
      }, idle: function(o) {
        for (var s = o.pointerType, d = 0, h = o.scope.interactions.list; d < h.length; d++) {
          var p = h[d];
          if (p.pointers.length === 1) {
            var x = p.interactable;
            if (x && (!x.options.gesture || !x.options.gesture.enabled)) continue;
          } else if (p.pointers.length >= 2) continue;
          if (!p.interacting() && s === p.pointerType) return p;
        }
        return null;
      } };
      function vi(o, s) {
        return o.pointers.some((function(d) {
          return d.id === s;
        }));
      }
      var pn = Dt, nn = ["pointerDown", "pointerMove", "pointerUp", "updatePointer", "removePointer", "windowBlur"];
      function on(o, s) {
        return function(d) {
          var h = s.interactions.list, p = Et(d), x = Zt(d), k = x[0], z = x[1], R = [];
          if (/^touch/.test(d.type)) {
            s.prevTouchTime = s.now();
            for (var U = 0, L = d.changedTouches; U < L.length; U++) {
              var Q = L[U], ne = { pointer: Q, pointerId: Ke(Q), pointerType: p, eventType: d.type, eventTarget: k, curEventTarget: z, scope: s }, de = Ot(ne);
              R.push([ne.pointer, ne.eventTarget, ne.curEventTarget, de]);
            }
          } else {
            var ge = !1;
            if (!le.supportsPointerEvent && /mouse/.test(d.type)) {
              for (var me = 0; me < h.length && !ge; me++) ge = h[me].pointerType !== "mouse" && h[me].pointerIsDown;
              ge = ge || s.now() - s.prevTouchTime < 500 || d.timeStamp === 0;
            }
            if (!ge) {
              var Se = { pointer: d, pointerId: Ke(d), pointerType: p, eventType: d.type, curEventTarget: z, eventTarget: k, scope: s }, ke = Ot(Se);
              R.push([Se.pointer, Se.eventTarget, Se.curEventTarget, ke]);
            }
          }
          for (var Ee = 0; Ee < R.length; Ee++) {
            var Be = R[Ee], Je = Be[0], Ve = Be[1], Ge = Be[2];
            Be[3][o](Je, d, Ve, Ge);
          }
        };
      }
      function Ot(o) {
        var s = o.pointerType, d = o.scope, h = { interaction: pn.search(o), searchDetails: o };
        return d.fire("interactions:find", h), h.interaction || d.interactions.new({ pointerType: s });
      }
      function Ai(o, s) {
        var d = o.doc, h = o.scope, p = o.options, x = h.interactions.docEvents, k = h.events, z = k[s];
        for (var R in h.browser.isIOS && !p.events && (p.events = { passive: !1 }), k.delegatedEvents) z(d, R, k.delegateListener), z(d, R, k.delegateUseCapture, !0);
        for (var U = p && p.events, L = 0; L < x.length; L++) {
          var Q = x[L];
          z(d, Q.type, Q.listener, U);
        }
      }
      var zl = { id: "core/interactions", install: function(o) {
        for (var s = {}, d = 0; d < nn.length; d++) {
          var h = nn[d];
          s[h] = on(h, o);
        }
        var p, x = le.pEventTypes;
        function k() {
          for (var z = 0, R = o.interactions.list; z < R.length; z++) {
            var U = R[z];
            if (U.pointerIsDown && U.pointerType === "touch" && !U._interacting) for (var L = function() {
              var de = ne[Q];
              o.documents.some((function(ge) {
                return ie(ge.doc, de.downTarget);
              })) || U.removePointer(de.pointer, de.event);
            }, Q = 0, ne = U.pointers; Q < ne.length; Q++) L();
          }
        }
        (p = I.PointerEvent ? [{ type: x.down, listener: k }, { type: x.down, listener: s.pointerDown }, { type: x.move, listener: s.pointerMove }, { type: x.up, listener: s.pointerUp }, { type: x.cancel, listener: s.pointerUp }] : [{ type: "mousedown", listener: s.pointerDown }, { type: "mousemove", listener: s.pointerMove }, { type: "mouseup", listener: s.pointerUp }, { type: "touchstart", listener: k }, { type: "touchstart", listener: s.pointerDown }, { type: "touchmove", listener: s.pointerMove }, { type: "touchend", listener: s.pointerUp }, { type: "touchcancel", listener: s.pointerUp }]).push({ type: "blur", listener: function(z) {
          for (var R = 0, U = o.interactions.list; R < U.length; R++)
            U[R].documentBlur(z);
        } }), o.prevTouchTime = 0, o.Interaction = (function(z) {
          g(U, z);
          var R = S(U);
          function U() {
            return l(this, U), R.apply(this, arguments);
          }
          return r(U, [{ key: "pointerMoveTolerance", get: function() {
            return o.interactions.pointerMoveTolerance;
          }, set: function(L) {
            o.interactions.pointerMoveTolerance = L;
          } }, { key: "_now", value: function() {
            return o.now();
          } }]), U;
        })(Ml), o.interactions = { list: [], new: function(z) {
          z.scopeFire = function(U, L) {
            return o.fire(U, L);
          };
          var R = new o.Interaction(z);
          return o.interactions.list.push(R), R;
        }, listeners: s, docEvents: p, pointerMoveTolerance: 1 }, o.usePlugin(us);
      }, listeners: { "scope:add-document": function(o) {
        return Ai(o, "add");
      }, "scope:remove-document": function(o) {
        return Ai(o, "remove");
      }, "interactable:unset": function(o, s) {
        for (var d = o.interactable, h = s.interactions.list.length - 1; h >= 0; h--) {
          var p = s.interactions.list[h];
          p.interactable === d && (p.stop(), s.fire("interactions:destroy", { interaction: p }), p.destroy(), s.interactions.list.length > 2 && s.interactions.list.splice(h, 1));
        }
      } }, onDocSignal: Ai, doOnInteractions: on, methodNames: nn }, Dr = zl, Sn = (function(o) {
        return o[o.On = 0] = "On", o[o.Off = 1] = "Off", o;
      })(Sn || {}), ni = (function() {
        function o(s, d, h, p) {
          l(this, o), this.target = void 0, this.options = void 0, this._actions = void 0, this.events = new ea(), this._context = void 0, this._win = void 0, this._doc = void 0, this._scopeEvents = void 0, this._actions = d.actions, this.target = s, this._context = d.context || h, this._win = N(Pe(s) ? this._context : s), this._doc = this._win.document, this._scopeEvents = p, this.set(d);
        }
        return r(o, [{ key: "_defaults", get: function() {
          return { base: {}, perAction: {}, actions: {} };
        } }, { key: "setOnEvents", value: function(s, d) {
          return M.func(d.onstart) && this.on("".concat(s, "start"), d.onstart), M.func(d.onmove) && this.on("".concat(s, "move"), d.onmove), M.func(d.onend) && this.on("".concat(s, "end"), d.onend), M.func(d.oninertiastart) && this.on("".concat(s, "inertiastart"), d.oninertiastart), this;
        } }, { key: "updatePerActionListeners", value: function(s, d, h) {
          var p, x = this, k = (p = this._actions.map[s]) == null ? void 0 : p.filterEventType, z = function(R) {
            return (k == null || k(R)) && Sl(R, x._actions);
          };
          (M.array(d) || M.object(d)) && this._onOff(Sn.Off, s, d, void 0, z), (M.array(h) || M.object(h)) && this._onOff(Sn.On, s, h, void 0, z);
        } }, { key: "setPerAction", value: function(s, d) {
          var h = this._defaults;
          for (var p in d) {
            var x = p, k = this.options[s], z = d[x];
            x === "listeners" && this.updatePerActionListeners(s, k.listeners, z), M.array(z) ? k[x] = kn(z) : M.plainObject(z) ? (k[x] = xe(k[x] || {}, Zi(z)), M.object(h.perAction[x]) && "enabled" in h.perAction[x] && (k[x].enabled = z.enabled !== !1)) : M.bool(z) && M.object(h.perAction[x]) ? k[x].enabled = z : k[x] = z;
          }
        } }, { key: "getRect", value: function(s) {
          return s = s || (M.element(this.target) ? this.target : null), M.string(this.target) && (s = s || this._context.querySelector(this.target)), ue(s);
        } }, { key: "rectChecker", value: function(s) {
          var d = this;
          return M.func(s) ? (this.getRect = function(h) {
            var p = xe({}, s.apply(d, h));
            return "width" in p || (p.width = p.right - p.left, p.height = p.bottom - p.top), p;
          }, this) : s === null ? (delete this.getRect, this) : this.getRect;
        } }, { key: "_backCompatOption", value: function(s, d) {
          if (Pe(d) || M.object(d)) {
            for (var h in this.options[s] = d, this._actions.map) this.options[h][s] = d;
            return this;
          }
          return this.options[s];
        } }, { key: "origin", value: function(s) {
          return this._backCompatOption("origin", s);
        } }, { key: "deltaSource", value: function(s) {
          return s === "page" || s === "client" ? (this.options.deltaSource = s, this) : this.options.deltaSource;
        } }, { key: "getAllElements", value: function() {
          var s = this.target;
          return M.string(s) ? Array.from(this._context.querySelectorAll(s)) : M.func(s) && s.getAllElements ? s.getAllElements() : M.element(s) ? [s] : [];
        } }, { key: "context", value: function() {
          return this._context;
        } }, { key: "inContext", value: function(s) {
          return this._context === s.ownerDocument || ie(this._context, s);
        } }, { key: "testIgnoreAllow", value: function(s, d, h) {
          return !this.testIgnore(s.ignoreFrom, d, h) && this.testAllow(s.allowFrom, d, h);
        } }, { key: "testAllow", value: function(s, d, h) {
          return !s || !!M.element(h) && (M.string(s) ? Ne(h, s, d) : !!M.element(s) && ie(s, h));
        } }, { key: "testIgnore", value: function(s, d, h) {
          return !(!s || !M.element(h)) && (M.string(s) ? Ne(h, s, d) : !!M.element(s) && ie(s, h));
        } }, { key: "fire", value: function(s) {
          return this.events.fire(s), this;
        } }, { key: "_onOff", value: function(s, d, h, p, x) {
          M.object(d) && !M.array(d) && (p = h, h = null);
          var k = It(d, h, x);
          for (var z in k) {
            z === "wheel" && (z = le.wheelEvent);
            for (var R = 0, U = k[z]; R < U.length; R++) {
              var L = U[R];
              Sl(z, this._actions) ? this.events[s === Sn.On ? "on" : "off"](z, L) : M.string(this.target) ? this._scopeEvents[s === Sn.On ? "addDelegate" : "removeDelegate"](this.target, this._context, z, L, p) : this._scopeEvents[s === Sn.On ? "add" : "remove"](this.target, z, L, p);
            }
          }
          return this;
        } }, { key: "on", value: function(s, d, h) {
          return this._onOff(Sn.On, s, d, h);
        } }, { key: "off", value: function(s, d, h) {
          return this._onOff(Sn.Off, s, d, h);
        } }, { key: "set", value: function(s) {
          var d = this._defaults;
          for (var h in M.object(s) || (s = {}), this.options = Zi(d.base), this._actions.methodDict) {
            var p = h, x = this._actions.methodDict[p];
            this.options[p] = {}, this.setPerAction(p, xe(xe({}, d.perAction), d.actions[p])), this[x](s[p]);
          }
          for (var k in s) k !== "getRect" ? M.func(this[k]) && this[k](s[k]) : this.rectChecker(s.getRect);
          return this;
        } }, { key: "unset", value: function() {
          if (M.string(this.target)) for (var s in this._scopeEvents.delegatedEvents) for (var d = this._scopeEvents.delegatedEvents[s], h = d.length - 1; h >= 0; h--) {
            var p = d[h], x = p.selector, k = p.context, z = p.listeners;
            x === this.target && k === this._context && d.splice(h, 1);
            for (var R = z.length - 1; R >= 0; R--) this._scopeEvents.removeDelegate(this.target, this._context, s, z[R][0], z[R][1]);
          }
          else this._scopeEvents.remove(this.target, "all");
        } }]), o;
      })(), Or = (function() {
        function o(s) {
          var d = this;
          l(this, o), this.list = [], this.selectorMap = {}, this.scope = void 0, this.scope = s, s.addListeners({ "interactable:unset": function(h) {
            var p = h.interactable, x = p.target, k = M.string(x) ? d.selectorMap[x] : x[d.scope.id], z = dn(k, (function(R) {
              return R === p;
            }));
            k.splice(z, 1);
          } });
        }
        return r(o, [{ key: "new", value: function(s, d) {
          d = xe(d || {}, { actions: this.scope.actions });
          var h = new this.scope.Interactable(s, d, this.scope.document, this.scope.events);
          return this.scope.addDocument(h._doc), this.list.push(h), M.string(s) ? (this.selectorMap[s] || (this.selectorMap[s] = []), this.selectorMap[s].push(h)) : (h.target[this.scope.id] || Object.defineProperty(s, this.scope.id, { value: [], configurable: !0 }), s[this.scope.id].push(h)), this.scope.fire("interactable:new", { target: s, options: d, interactable: h, win: this.scope._win }), h;
        } }, { key: "getExisting", value: function(s, d) {
          var h = d && d.context || this.scope.document, p = M.string(s), x = p ? this.selectorMap[s] : s[this.scope.id];
          if (x) return Lt(x, (function(k) {
            return k._context === h && (p || k.inContext(s));
          }));
        } }, { key: "forEachMatch", value: function(s, d) {
          for (var h = 0, p = this.list; h < p.length; h++) {
            var x = p[h], k = void 0;
            if ((M.string(x.target) ? M.element(s) && he(s, x.target) : s === x.target) && x.inContext(s) && (k = d(x)), k !== void 0) return k;
          }
        } }]), o;
      })(), Pr = (function() {
        function o() {
          var s = this;
          l(this, o), this.id = "__interact_scope_".concat(Math.floor(100 * Math.random())), this.isInitialized = !1, this.listenerMaps = [], this.browser = le, this.defaults = Zi(cs), this.Eventable = ea, this.actions = { map: {}, phases: { start: !0, move: !0, end: !0 }, methodDict: {}, phaselessTypes: {} }, this.interactStatic = (function(h) {
            var p = function x(k, z) {
              var R = h.interactables.getExisting(k, z);
              return R || ((R = h.interactables.new(k, z)).events.global = x.globalEvents), R;
            };
            return p.getPointerAverage = Fe, p.getTouchBBox = at, p.getTouchDistance = rt, p.getTouchAngle = ut, p.getElementRect = ue, p.getElementClientRect = Me, p.matchesSelector = he, p.closest = ye, p.globalEvents = {}, p.version = "1.10.27", p.scope = h, p.use = function(x, k) {
              return this.scope.usePlugin(x, k), this;
            }, p.isSet = function(x, k) {
              return !!this.scope.interactables.get(x, k && k.context);
            }, p.on = jt((function(x, k, z) {
              if (M.string(x) && x.search(" ") !== -1 && (x = x.trim().split(/ +/)), M.array(x)) {
                for (var R = 0, U = x; R < U.length; R++) {
                  var L = U[R];
                  this.on(L, k, z);
                }
                return this;
              }
              if (M.object(x)) {
                for (var Q in x) this.on(Q, x[Q], k);
                return this;
              }
              return Sl(x, this.scope.actions) ? this.globalEvents[x] ? this.globalEvents[x].push(k) : this.globalEvents[x] = [k] : this.scope.events.add(this.scope.document, x, k, { options: z }), this;
            }), "The interact.on() method is being deprecated"), p.off = jt((function(x, k, z) {
              if (M.string(x) && x.search(" ") !== -1 && (x = x.trim().split(/ +/)), M.array(x)) {
                for (var R = 0, U = x; R < U.length; R++) {
                  var L = U[R];
                  this.off(L, k, z);
                }
                return this;
              }
              if (M.object(x)) {
                for (var Q in x) this.off(Q, x[Q], k);
                return this;
              }
              var ne;
              return Sl(x, this.scope.actions) ? x in this.globalEvents && (ne = this.globalEvents[x].indexOf(k)) !== -1 && this.globalEvents[x].splice(ne, 1) : this.scope.events.remove(this.scope.document, x, k, z), this;
            }), "The interact.off() method is being deprecated"), p.debug = function() {
              return this.scope;
            }, p.supportsTouch = function() {
              return le.supportsTouch;
            }, p.supportsPointerEvent = function() {
              return le.supportsPointerEvent;
            }, p.stop = function() {
              for (var x = 0, k = this.scope.interactions.list; x < k.length; x++) k[x].stop();
              return this;
            }, p.pointerMoveTolerance = function(x) {
              return M.number(x) ? (this.scope.interactions.pointerMoveTolerance = x, this) : this.scope.interactions.pointerMoveTolerance;
            }, p.addDocument = function(x, k) {
              this.scope.addDocument(x, k);
            }, p.removeDocument = function(x) {
              this.scope.removeDocument(x);
            }, p;
          })(this), this.InteractEvent = ja, this.Interactable = void 0, this.interactables = new Or(this), this._win = void 0, this.document = void 0, this.window = void 0, this.documents = [], this._plugins = { list: [], map: {} }, this.onWindowUnload = function(h) {
            return s.removeDocument(h.target);
          };
          var d = this;
          this.Interactable = (function(h) {
            g(x, h);
            var p = S(x);
            function x() {
              return l(this, x), p.apply(this, arguments);
            }
            return r(x, [{ key: "_defaults", get: function() {
              return d.defaults;
            } }, { key: "set", value: function(k) {
              return T(y(x.prototype), "set", this).call(this, k), d.fire("interactable:set", { options: k, interactable: this }), this;
            } }, { key: "unset", value: function() {
              T(y(x.prototype), "unset", this).call(this);
              var k = d.interactables.list.indexOf(this);
              k < 0 || (d.interactables.list.splice(k, 1), d.fire("interactable:unset", { interactable: this }));
            } }]), x;
          })(ni);
        }
        return r(o, [{ key: "addListeners", value: function(s, d) {
          this.listenerMaps.push({ id: d, map: s });
        } }, { key: "fire", value: function(s, d) {
          for (var h = 0, p = this.listenerMaps; h < p.length; h++) {
            var x = p[h].map[s];
            if (x && x(d, this, s) === !1) return !1;
          }
        } }, { key: "init", value: function(s) {
          return this.isInitialized ? this : (function(d, h) {
            return d.isInitialized = !0, M.window(h) && V(h), I.init(h), le.init(h), Mn.init(h), d.window = h, d.document = h.document, d.usePlugin(Dr), d.usePlugin($t), d;
          })(this, s);
        } }, { key: "pluginIsInstalled", value: function(s) {
          var d = s.id;
          return d ? !!this._plugins.map[d] : this._plugins.list.indexOf(s) !== -1;
        } }, { key: "usePlugin", value: function(s, d) {
          if (!this.isInitialized) return this;
          if (this.pluginIsInstalled(s)) return this;
          if (s.id && (this._plugins.map[s.id] = s), this._plugins.list.push(s), s.install && s.install(this, d), s.listeners && s.before) {
            for (var h = 0, p = this.listenerMaps.length, x = s.before.reduce((function(z, R) {
              return z[R] = !0, z[hs(R)] = !0, z;
            }), {}); h < p; h++) {
              var k = this.listenerMaps[h].id;
              if (k && (x[k] || x[hs(k)])) break;
            }
            this.listenerMaps.splice(h, 0, { id: s.id, map: s.listeners });
          } else s.listeners && this.listenerMaps.push({ id: s.id, map: s.listeners });
          return this;
        } }, { key: "addDocument", value: function(s, d) {
          if (this.getDocIndex(s) !== -1) return !1;
          var h = N(s);
          d = d ? xe({}, d) : {}, this.documents.push({ doc: s, options: d }), this.events.documents.push(s), s !== this.document && this.events.add(h, "unload", this.onWindowUnload), this.fire("scope:add-document", { doc: s, window: h, scope: this, options: d });
        } }, { key: "removeDocument", value: function(s) {
          var d = this.getDocIndex(s), h = N(s), p = this.documents[d].options;
          this.events.remove(h, "unload", this.onWindowUnload), this.documents.splice(d, 1), this.events.documents.splice(d, 1), this.fire("scope:remove-document", { doc: s, window: h, scope: this, options: p });
        } }, { key: "getDocIndex", value: function(s) {
          for (var d = 0; d < this.documents.length; d++) if (this.documents[d].doc === s) return d;
          return -1;
        } }, { key: "getDocOptions", value: function(s) {
          var d = this.getDocIndex(s);
          return d === -1 ? null : this.documents[d].options;
        } }, { key: "now", value: function() {
          return (this.window.Date || Date).now();
        } }]), o;
      })();
      function hs(o) {
        return o && o.replace(/\/.*$/, "");
      }
      var gs = new Pr(), Ft = gs.interactStatic, Ni = typeof globalThis < "u" ? globalThis : window;
      gs.init(Ni);
      var ta = Object.freeze({ __proto__: null, edgeTarget: function() {
      }, elements: function() {
      }, grid: function(o) {
        var s = [["x", "y"], ["left", "top"], ["right", "bottom"], ["width", "height"]].filter((function(h) {
          var p = h[0], x = h[1];
          return p in o || x in o;
        })), d = function(h, p) {
          for (var x = o.range, k = o.limits, z = k === void 0 ? { left: -1 / 0, right: 1 / 0, top: -1 / 0, bottom: 1 / 0 } : k, R = o.offset, U = R === void 0 ? { x: 0, y: 0 } : R, L = { range: x, grid: o, x: null, y: null }, Q = 0; Q < s.length; Q++) {
            var ne = s[Q], de = ne[0], ge = ne[1], me = Math.round((h - U.x) / o[de]), Se = Math.round((p - U.y) / o[ge]);
            L[de] = Math.max(z.left, Math.min(z.right, me * o[de] + U.x)), L[ge] = Math.max(z.top, Math.min(z.bottom, Se * o[ge] + U.y));
          }
          return L;
        };
        return d.grid = o, d.coordFields = s, d;
      } }), Ma = { id: "snappers", install: function(o) {
        var s = o.interactStatic;
        s.snappers = xe(s.snappers || {}, ta), s.createSnapGrid = s.snappers.grid;
      } }, Ir = Ma, ii = { start: function(o) {
        var s = o.state, d = o.rect, h = o.edges, p = o.pageCoords, x = s.options, k = x.ratio, z = x.enabled, R = s.options, U = R.equalDelta, L = R.modifiers;
        k === "preserve" && (k = d.width / d.height), s.startCoords = xe({}, p), s.startRect = xe({}, d), s.ratio = k, s.equalDelta = U;
        var Q = s.linkedEdges = { top: h.top || h.left && !h.bottom, left: h.left || h.top && !h.right, bottom: h.bottom || h.right && !h.top, right: h.right || h.bottom && !h.left };
        if (s.xIsPrimaryAxis = !(!h.left && !h.right), s.equalDelta) {
          var ne = (Q.left ? 1 : -1) * (Q.top ? 1 : -1);
          s.edgeSign = { x: ne, y: ne };
        } else s.edgeSign = { x: Q.left ? -1 : 1, y: Q.top ? -1 : 1 };
        if (z !== !1 && xe(h, Q), L != null && L.length) {
          var de = new kl(o.interaction);
          de.copyFrom(o.interaction.modification), de.prepareStates(L), s.subModification = de, de.startAll(i({}, o));
        }
      }, set: function(o) {
        var s = o.state, d = o.rect, h = o.coords, p = s.linkedEdges, x = xe({}, h), k = s.equalDelta ? Er : ps;
        if (xe(o.edges, p), k(s, s.xIsPrimaryAxis, h, d), !s.subModification) return null;
        var z = xe({}, d);
        Bt(p, z, { x: h.x - x.x, y: h.y - x.y });
        var R = s.subModification.setAll(i(i({}, o), {}, { rect: z, edges: p, pageCoords: h, prevCoords: h, prevRect: z })), U = R.delta;
        return R.changed && (k(s, Math.abs(U.x) > Math.abs(U.y), R.coords, R.rect), xe(h, R.coords)), R.eventProps;
      }, defaults: { ratio: "preserve", equalDelta: !1, modifiers: [], enabled: !1 } };
      function Er(o, s, d) {
        var h = o.startCoords, p = o.edgeSign;
        s ? d.y = h.y + (d.x - h.x) * p.y : d.x = h.x + (d.y - h.y) * p.x;
      }
      function ps(o, s, d, h) {
        var p = o.startRect, x = o.startCoords, k = o.ratio, z = o.edgeSign;
        if (s) {
          var R = h.width / k;
          d.y = x.y + (R - p.height) * z.y;
        } else {
          var U = h.height * k;
          d.x = x.x + (U - p.width) * z.x;
        }
      }
      var ms = mi(ii, "aspectRatio"), Ta = function() {
      };
      Ta._defaults = {};
      var Ri = Ta;
      function na(o, s, d) {
        return M.func(o) ? nt(o, s.interactable, s.element, [d.x, d.y, s]) : nt(o, s.interactable, s.element);
      }
      var za = { start: function(o) {
        var s = o.rect, d = o.startOffset, h = o.state, p = o.interaction, x = o.pageCoords, k = h.options, z = k.elementRect, R = xe({ left: 0, top: 0, right: 0, bottom: 0 }, k.offset || {});
        if (s && z) {
          var U = na(k.restriction, p, x);
          if (U) {
            var L = U.right - U.left - s.width, Q = U.bottom - U.top - s.height;
            L < 0 && (R.left += L, R.right += L), Q < 0 && (R.top += Q, R.bottom += Q);
          }
          R.left += d.left - s.width * z.left, R.top += d.top - s.height * z.top, R.right += d.right - s.width * (1 - z.right), R.bottom += d.bottom - s.height * (1 - z.bottom);
        }
        h.offset = R;
      }, set: function(o) {
        var s = o.coords, d = o.interaction, h = o.state, p = h.options, x = h.offset, k = na(p.restriction, d, s);
        if (k) {
          var z = (function(R) {
            return !R || "left" in R && "top" in R || ((R = xe({}, R)).left = R.x || 0, R.top = R.y || 0, R.right = R.right || R.left + R.width, R.bottom = R.bottom || R.top + R.height), R;
          })(k);
          s.x = Math.max(Math.min(z.right - x.right, s.x), z.left + x.left), s.y = Math.max(Math.min(z.bottom - x.bottom, s.y), z.top + x.top);
        }
      }, defaults: { restriction: null, elementRect: null, offset: null, endOnly: !1, enabled: !1 } }, $r = mi(za, "restrict"), Li = { top: 1 / 0, left: 1 / 0, bottom: -1 / 0, right: -1 / 0 }, yi = { top: -1 / 0, left: -1 / 0, bottom: 1 / 0, right: 1 / 0 };
      function Da(o, s) {
        for (var d = 0, h = ["top", "left", "bottom", "right"]; d < h.length; d++) {
          var p = h[d];
          p in o || (o[p] = s[p]);
        }
        return o;
      }
      var Oa = { noInner: Li, noOuter: yi, start: function(o) {
        var s, d = o.interaction, h = o.startOffset, p = o.state, x = p.options;
        x && (s = Ze(na(x.offset, d, d.coords.start.page))), s = s || { x: 0, y: 0 }, p.offset = { top: s.y + h.top, left: s.x + h.left, bottom: s.y - h.bottom, right: s.x - h.right };
      }, set: function(o) {
        var s = o.coords, d = o.edges, h = o.interaction, p = o.state, x = p.offset, k = p.options;
        if (d) {
          var z = xe({}, s), R = na(k.inner, h, z) || {}, U = na(k.outer, h, z) || {};
          Da(R, Li), Da(U, yi), d.top ? s.y = Math.min(Math.max(U.top + x.top, z.y), R.top + x.top) : d.bottom && (s.y = Math.max(Math.min(U.bottom + x.bottom, z.y), R.bottom + x.bottom)), d.left ? s.x = Math.min(Math.max(U.left + x.left, z.x), R.left + x.left) : d.right && (s.x = Math.max(Math.min(U.right + x.right, z.x), R.right + x.right));
        }
      }, defaults: { inner: null, outer: null, offset: null, endOnly: !1, enabled: !1 } }, wo = mi(Oa, "restrictEdges"), So = xe({ get elementRect() {
        return { top: 0, left: 0, bottom: 1, right: 1 };
      }, set elementRect(o) {
      } }, za.defaults), Dl = mi({ start: za.start, set: za.set, defaults: So }, "restrictRect"), vs = { width: -1 / 0, height: -1 / 0 }, ys = { width: 1 / 0, height: 1 / 0 }, bs = mi({ start: function(o) {
        return Oa.start(o);
      }, set: function(o) {
        var s = o.interaction, d = o.state, h = o.rect, p = o.edges, x = d.options;
        if (p) {
          var k = Ct(na(x.min, s, o.coords)) || vs, z = Ct(na(x.max, s, o.coords)) || ys;
          d.options = { endOnly: x.endOnly, inner: xe({}, Oa.noInner), outer: xe({}, Oa.noOuter) }, p.top ? (d.options.inner.top = h.bottom - k.height, d.options.outer.top = h.bottom - z.height) : p.bottom && (d.options.inner.bottom = h.top + k.height, d.options.outer.bottom = h.top + z.height), p.left ? (d.options.inner.left = h.right - k.width, d.options.outer.left = h.right - z.width) : p.right && (d.options.inner.right = h.left + k.width, d.options.outer.right = h.left + z.width), Oa.set(o), d.options = x;
        }
      }, defaults: { min: null, max: null, endOnly: !1, enabled: !1 } }, "restrictSize"), Ol = { start: function(o) {
        var s, d = o.interaction, h = o.interactable, p = o.element, x = o.rect, k = o.state, z = o.startOffset, R = k.options, U = R.offsetWithOrigin ? (function(ne) {
          var de = ne.interaction.element, ge = Ze(nt(ne.state.options.origin, null, null, [de])), me = ge || mt(ne.interactable, de, ne.interaction.prepared.name);
          return me;
        })(o) : { x: 0, y: 0 };
        if (R.offset === "startCoords") s = { x: d.coords.start.page.x, y: d.coords.start.page.y };
        else {
          var L = nt(R.offset, h, p, [d]);
          (s = Ze(L) || { x: 0, y: 0 }).x += U.x, s.y += U.y;
        }
        var Q = R.relativePoints;
        k.offsets = x && Q && Q.length ? Q.map((function(ne, de) {
          return { index: de, relativePoint: ne, x: z.left - x.width * ne.x + s.x, y: z.top - x.height * ne.y + s.y };
        })) : [{ index: 0, relativePoint: null, x: s.x, y: s.y }];
      }, set: function(o) {
        var s = o.interaction, d = o.coords, h = o.state, p = h.options, x = h.offsets, k = mt(s.interactable, s.element, s.prepared.name), z = xe({}, d), R = [];
        p.offsetWithOrigin || (z.x -= k.x, z.y -= k.y);
        for (var U = 0, L = x; U < L.length; U++) for (var Q = L[U], ne = z.x - Q.x, de = z.y - Q.y, ge = 0, me = p.targets.length; ge < me; ge++) {
          var Se = p.targets[ge], ke = void 0;
          (ke = M.func(Se) ? Se(ne, de, s._proxy, Q, ge) : Se) && R.push({ x: (M.number(ke.x) ? ke.x : ne) + Q.x, y: (M.number(ke.y) ? ke.y : de) + Q.y, range: M.number(ke.range) ? ke.range : p.range, source: Se, index: ge, offset: Q });
        }
        for (var Ee = { target: null, inRange: !1, distance: 0, range: 0, delta: { x: 0, y: 0 } }, Be = 0; Be < R.length; Be++) {
          var Je = R[Be], Ve = Je.range, Ge = Je.x - z.x, St = Je.y - z.y, gt = Ht(Ge, St), Tt = gt <= Ve;
          Ve === 1 / 0 && Ee.inRange && Ee.range !== 1 / 0 && (Tt = !1), Ee.target && !(Tt ? Ee.inRange && Ve !== 1 / 0 ? gt / Ve < Ee.distance / Ee.range : Ve === 1 / 0 && Ee.range !== 1 / 0 || gt < Ee.distance : !Ee.inRange && gt < Ee.distance) || (Ee.target = Je, Ee.distance = gt, Ee.range = Ve, Ee.inRange = Tt, Ee.delta.x = Ge, Ee.delta.y = St);
        }
        return Ee.inRange && (d.x = Ee.target.x, d.y = Ee.target.y), h.closest = Ee, Ee;
      }, defaults: { range: 1 / 0, targets: null, offset: null, offsetWithOrigin: !0, origin: null, relativePoints: null, endOnly: !1, enabled: !1 } }, xs = mi(Ol, "snap"), Ga = { start: function(o) {
        var s = o.state, d = o.edges, h = s.options;
        if (!d) return null;
        o.state = { options: { targets: null, relativePoints: [{ x: d.left ? 0 : 1, y: d.top ? 0 : 1 }], offset: h.offset || "self", origin: { x: 0, y: 0 }, range: h.range } }, s.targetFields = s.targetFields || [["width", "height"], ["x", "y"]], Ol.start(o), s.offsets = o.state.offsets, o.state = s;
      }, set: function(o) {
        var s = o.interaction, d = o.state, h = o.coords, p = d.options, x = d.offsets, k = { x: h.x - x[0].x, y: h.y - x[0].y };
        d.options = xe({}, p), d.options.targets = [];
        for (var z = 0, R = p.targets || []; z < R.length; z++) {
          var U = R[z], L = void 0;
          if (L = M.func(U) ? U(k.x, k.y, s) : U) {
            for (var Q = 0, ne = d.targetFields; Q < ne.length; Q++) {
              var de = ne[Q], ge = de[0], me = de[1];
              if (ge in L || me in L) {
                L.x = L[ge], L.y = L[me];
                break;
              }
            }
            d.options.targets.push(L);
          }
        }
        var Se = Ol.set(o);
        return d.options = p, Se;
      }, defaults: { range: 1 / 0, targets: null, offset: null, endOnly: !1, enabled: !1 } }, Ar = mi(Ga, "snapSize"), Pl = { aspectRatio: ms, restrictEdges: wo, restrict: $r, restrictRect: Dl, restrictSize: bs, snapEdges: mi({ start: function(o) {
        var s = o.edges;
        return s ? (o.state.targetFields = o.state.targetFields || [[s.left ? "left" : "right", s.top ? "top" : "bottom"]], Ga.start(o)) : null;
      }, set: Ga.set, defaults: xe(Zi(Ga.defaults), { targets: void 0, range: void 0, offset: { x: 0, y: 0 } }) }, "snapEdges"), snap: xs, snapSize: Ar, spring: Ri, avoid: Ri, transform: Ri, rubberband: Ri }, ws = { id: "modifiers", install: function(o) {
        var s = o.interactStatic;
        for (var d in o.usePlugin(Ha), o.usePlugin(Ir), s.modifiers = Pl, Pl) {
          var h = Pl[d], p = h._defaults, x = h._methods;
          p._methods = x, o.defaults.perAction[d] = p;
        }
      } }, Pa = ws, Ka = (function(o) {
        g(d, o);
        var s = S(d);
        function d(h, p, x, k, z, R) {
          var U;
          if (l(this, d), ln(m(U = s.call(this, z)), x), x !== p && ln(m(U), p), U.timeStamp = R, U.originalEvent = x, U.type = h, U.pointerId = Ke(p), U.pointerType = Et(p), U.target = k, U.currentTarget = null, h === "tap") {
            var L = z.getPointerIndex(p);
            U.dt = U.timeStamp - z.pointers[L].downTime;
            var Q = U.timeStamp - z.tapTime;
            U.double = !!z.prevTap && z.prevTap.type !== "doubletap" && z.prevTap.target === U.target && Q < 500;
          } else h === "doubletap" && (U.dt = p.timeStamp - z.tapTime, U.double = !0);
          return U;
        }
        return r(d, [{ key: "_subtractOrigin", value: function(h) {
          var p = h.x, x = h.y;
          return this.pageX -= p, this.pageY -= x, this.clientX -= p, this.clientY -= x, this;
        } }, { key: "_addOrigin", value: function(h) {
          var p = h.x, x = h.y;
          return this.pageX += p, this.pageY += x, this.clientX += p, this.clientY += x, this;
        } }, { key: "preventDefault", value: function() {
          this.originalEvent.preventDefault();
        } }]), d;
      })(un), Ut = { id: "pointer-events/base", before: ["inertia", "modifiers", "auto-start", "actions"], install: function(o) {
        o.pointerEvents = Ut, o.defaults.actions.pointerEvents = Ut.defaults, xe(o.actions.phaselessTypes, Ut.types);
      }, listeners: { "interactions:new": function(o) {
        var s = o.interaction;
        s.prevTap = null, s.tapTime = 0;
      }, "interactions:update-pointer": function(o) {
        var s = o.down, d = o.pointerInfo;
        !s && d.hold || (d.hold = { duration: 1 / 0, timeout: null });
      }, "interactions:move": function(o, s) {
        var d = o.interaction, h = o.pointer, p = o.event, x = o.eventTarget;
        o.duplicate || d.pointerIsDown && !d.pointerWasMoved || (d.pointerIsDown && Il(o), bi({ interaction: d, pointer: h, event: p, eventTarget: x, type: "move" }, s));
      }, "interactions:down": function(o, s) {
        (function(d, h) {
          for (var p = d.interaction, x = d.pointer, k = d.event, z = d.eventTarget, R = d.pointerIndex, U = p.pointers[R].hold, L = se(z), Q = { interaction: p, pointer: x, event: k, eventTarget: z, type: "hold", targets: [], path: L, node: null }, ne = 0; ne < L.length; ne++) {
            var de = L[ne];
            Q.node = de, h.fire("pointerEvents:collect-targets", Q);
          }
          if (Q.targets.length) {
            for (var ge = 1 / 0, me = 0, Se = Q.targets; me < Se.length; me++) {
              var ke = Se[me].eventable.options.holdDuration;
              ke < ge && (ge = ke);
            }
            U.duration = ge, U.timeout = setTimeout((function() {
              bi({ interaction: p, eventTarget: z, pointer: x, event: k, type: "hold" }, h);
            }), ge);
          }
        })(o, s), bi(o, s);
      }, "interactions:up": function(o, s) {
        Il(o), bi(o, s), (function(d, h) {
          var p = d.interaction, x = d.pointer, k = d.event, z = d.eventTarget;
          p.pointerWasMoved || bi({ interaction: p, eventTarget: z, pointer: x, event: k, type: "tap" }, h);
        })(o, s);
      }, "interactions:cancel": function(o, s) {
        Il(o), bi(o, s);
      } }, PointerEvent: Ka, fire: bi, collectEventTargets: Xt, defaults: { holdDuration: 600, ignoreFrom: null, allowFrom: null, origin: { x: 0, y: 0 } }, types: { down: !0, move: !0, up: !0, cancel: !0, tap: !0, doubletap: !0, hold: !0 } };
      function bi(o, s) {
        var d = o.interaction, h = o.pointer, p = o.event, x = o.eventTarget, k = o.type, z = o.targets, R = z === void 0 ? Xt(o, s) : z, U = new Ka(k, h, p, x, d, s.now());
        s.fire("pointerEvents:new", { pointerEvent: U });
        for (var L = { interaction: d, pointer: h, event: p, eventTarget: x, targets: R, type: k, pointerEvent: U }, Q = 0; Q < R.length; Q++) {
          var ne = R[Q];
          for (var de in ne.props || {}) U[de] = ne.props[de];
          var ge = mt(ne.eventable, ne.node);
          if (U._subtractOrigin(ge), U.eventable = ne.eventable, U.currentTarget = ne.node, ne.eventable.fire(U), U._addOrigin(ge), U.immediatePropagationStopped || U.propagationStopped && Q + 1 < R.length && R[Q + 1].node !== U.currentTarget) break;
        }
        if (s.fire("pointerEvents:fired", L), k === "tap") {
          var me = U.double ? bi({ interaction: d, pointer: h, event: p, eventTarget: x, type: "doubletap" }, s) : U;
          d.prevTap = me, d.tapTime = me.timeStamp;
        }
        return U;
      }
      function Xt(o, s) {
        var d = o.interaction, h = o.pointer, p = o.event, x = o.eventTarget, k = o.type, z = d.getPointerIndex(h), R = d.pointers[z];
        if (k === "tap" && (d.pointerWasMoved || !R || R.downTarget !== x)) return [];
        for (var U = se(x), L = { interaction: d, pointer: h, event: p, eventTarget: x, type: k, path: U, targets: [], node: null }, Q = 0; Q < U.length; Q++) {
          var ne = U[Q];
          L.node = ne, s.fire("pointerEvents:collect-targets", L);
        }
        return k === "hold" && (L.targets = L.targets.filter((function(de) {
          var ge, me;
          return de.eventable.options.holdDuration === ((ge = d.pointers[z]) == null || (me = ge.hold) == null ? void 0 : me.duration);
        }))), L.targets;
      }
      function Il(o) {
        var s = o.interaction, d = o.pointerIndex, h = s.pointers[d].hold;
        h && h.timeout && (clearTimeout(h.timeout), h.timeout = null);
      }
      var ko = Object.freeze({ __proto__: null, default: Ut });
      function Za(o) {
        var s = o.interaction;
        s.holdIntervalHandle && (clearInterval(s.holdIntervalHandle), s.holdIntervalHandle = null);
      }
      var Nr = { id: "pointer-events/holdRepeat", install: function(o) {
        o.usePlugin(Ut);
        var s = o.pointerEvents;
        s.defaults.holdRepeatInterval = 0, s.types.holdrepeat = o.actions.phaselessTypes.holdrepeat = !0;
      }, listeners: ["move", "up", "cancel", "endall"].reduce((function(o, s) {
        return o["pointerEvents:".concat(s)] = Za, o;
      }), { "pointerEvents:new": function(o) {
        var s = o.pointerEvent;
        s.type === "hold" && (s.count = (s.count || 0) + 1);
      }, "pointerEvents:fired": function(o, s) {
        var d = o.interaction, h = o.pointerEvent, p = o.eventTarget, x = o.targets;
        if (h.type === "hold" && x.length) {
          var k = x[0].eventable.options.holdRepeatInterval;
          k <= 0 || (d.holdIntervalHandle = setTimeout((function() {
            s.pointerEvents.fire({ interaction: d, eventTarget: p, type: "hold", pointer: h, event: h }, s);
          }), k));
        }
      } }) }, Rr = Nr, _o = { id: "pointer-events/interactableTargets", install: function(o) {
        var s = o.Interactable;
        s.prototype.pointerEvents = function(h) {
          return xe(this.events.options, h), this;
        };
        var d = s.prototype._backCompatOption;
        s.prototype._backCompatOption = function(h, p) {
          var x = d.call(this, h, p);
          return x === this && (this.events.options[h] = p), x;
        };
      }, listeners: { "pointerEvents:collect-targets": function(o, s) {
        var d = o.targets, h = o.node, p = o.type, x = o.eventTarget;
        s.interactables.forEachMatch(h, (function(k) {
          var z = k.events, R = z.options;
          z.types[p] && z.types[p].length && k.testIgnoreAllow(R, h, x) && d.push({ node: h, eventable: z, props: { interactable: k } });
        }));
      }, "interactable:new": function(o) {
        var s = o.interactable;
        s.events.getRect = function(d) {
          return s.getRect(d);
        };
      }, "interactable:set": function(o, s) {
        var d = o.interactable, h = o.options;
        xe(d.events.options, s.pointerEvents.defaults), xe(d.events.options, h.pointerEvents || {});
      } } }, w = _o, D = { id: "pointer-events", install: function(o) {
        o.usePlugin(ko), o.usePlugin(Rr), o.usePlugin(w);
      } }, B = D, H = { id: "reflow", install: function(o) {
        var s = o.Interactable;
        o.actions.phases.reflow = !0, s.prototype.reflow = function(d) {
          return (function(h, p, x) {
            for (var k = h.getAllElements(), z = x.window.Promise, R = z ? [] : null, U = function() {
              var Q = k[L], ne = h.getRect(Q);
              if (!ne) return 1;
              var de, ge = Lt(x.interactions.list, (function(ke) {
                return ke.interacting() && ke.interactable === h && ke.element === Q && ke.prepared.name === p.name;
              }));
              if (ge) ge.move(), R && (de = ge._reflowPromise || new z((function(ke) {
                ge._reflowResolve = ke;
              })));
              else {
                var me = Ct(ne), Se = /* @__PURE__ */ (function(ke) {
                  return { coords: ke, get page() {
                    return this.coords.page;
                  }, get client() {
                    return this.coords.client;
                  }, get timeStamp() {
                    return this.coords.timeStamp;
                  }, get pageX() {
                    return this.coords.page.x;
                  }, get pageY() {
                    return this.coords.page.y;
                  }, get clientX() {
                    return this.coords.client.x;
                  }, get clientY() {
                    return this.coords.client.y;
                  }, get pointerId() {
                    return this.coords.pointerId;
                  }, get target() {
                    return this.coords.target;
                  }, get type() {
                    return this.coords.type;
                  }, get pointerType() {
                    return this.coords.pointerType;
                  }, get buttons() {
                    return this.coords.buttons;
                  }, preventDefault: function() {
                  } };
                })({ page: { x: me.x, y: me.y }, client: { x: me.x, y: me.y }, timeStamp: x.now() });
                de = (function(ke, Ee, Be, Je, Ve) {
                  var Ge = ke.interactions.new({ pointerType: "reflow" }), St = { interaction: Ge, event: Ve, pointer: Ve, eventTarget: Be, phase: "reflow" };
                  Ge.interactable = Ee, Ge.element = Be, Ge.prevEvent = Ve, Ge.updatePointer(Ve, Ve, Be, !0), He(Ge.coords.delta), tn(Ge.prepared, Je), Ge._doPhase(St);
                  var gt = ke.window, Tt = gt.Promise, At = Tt ? new Tt((function(Jt) {
                    Ge._reflowResolve = Jt;
                  })) : void 0;
                  return Ge._reflowPromise = At, Ge.start(Je, Ee, Be), Ge._interacting ? (Ge.move(St), Ge.end(Ve)) : (Ge.stop(), Ge._reflowResolve()), Ge.removePointer(Ve, Ve), At;
                })(x, h, Q, p, Se);
              }
              R && R.push(de);
            }, L = 0; L < k.length && !U(); L++) ;
            return R && z.all(R).then((function() {
              return h;
            }));
          })(this, d, o);
        };
      }, listeners: { "interactions:stop": function(o, s) {
        var d = o.interaction;
        d.pointerType === "reflow" && (d._reflowResolve && d._reflowResolve(), (function(h, p) {
          h.splice(h.indexOf(p), 1);
        })(s.interactions.list, d));
      } } }, te = H;
      if (Ft.use(us), Ft.use(vo), Ft.use(B), Ft.use(fs), Ft.use(Pa), Ft.use(mo), Ft.use(kr), Ft.use(gn), Ft.use(te), Ft.default = Ft, a(e) === "object" && e) try {
        e.exports = Ft;
      } catch {
      }
      return Ft.default = Ft, Ft;
    }));
  })(Ao, Ao.exports)), Ao.exports;
}
var zS = /* @__PURE__ */ TS();
const Ud = /* @__PURE__ */ Q0(zS), Gd = /* @__PURE__ */ ze({
  __name: "grid-item",
  props: {
    isDraggable: { type: Boolean, default: void 0 },
    isResizable: { type: Boolean, default: void 0 },
    isBounded: { type: Boolean, default: void 0 },
    static: { type: Boolean, default: !1 },
    minH: { default: 1 },
    minW: { default: 1 },
    maxH: { default: 1 / 0 },
    maxW: { default: 1 / 0 },
    x: {},
    y: {},
    w: {},
    h: {},
    i: {},
    dragIgnoreFrom: { default: "a, button" },
    dragAllowFrom: { default: void 0 },
    resizeIgnoreFrom: { default: "a, button" },
    preserveAspectRatio: { type: Boolean, default: !1 },
    dragOption: { default: () => ({}) },
    resizeOption: { default: () => ({}) }
  },
  emits: ["container-resized", "resize", "resized", "move", "moved"],
  setup(e, { expose: t, emit: n }) {
    const i = e, a = n, l = dl(Ig), u = dl(Eg);
    if (!l)
      throw new Error("[grid-layout-plus]: missing layout store, GridItem must under a GridLayout.");
    const r = If(null), c = La({
      cols: 1,
      containerWidth: 100,
      rowHeight: 30,
      margin: [10, 10],
      maxRows: 1 / 0,
      draggable: void 0,
      resizable: void 0,
      bounded: void 0,
      transformScale: 1,
      useCssTransforms: !0,
      useStyleCursor: !0,
      isDragging: !1,
      dragging: {
        top: -1,
        left: -1
      },
      isResizing: !1,
      resizing: {
        width: -1,
        height: -1
      },
      style: {},
      rtl: !1
    });
    let g = !1, y = !1, v = NaN, m = NaN, S = NaN, T = NaN, C = -1, E = -1, X = -1, F = -1, V = i.x, N = i.y, Y = i.w, K = i.h;
    const M = pe(), W = La({
      i: gp(i, "i"),
      state: c,
      wrapper: M,
      calcXY: nt
    });
    function G(re) {
      It(re);
    }
    function Z() {
      vt();
    }
    function A(re) {
      Kn(i.isDraggable) && (c.draggable = re);
    }
    function J(re) {
      Kn(i.isResizable) && (c.resizable = re);
    }
    function ee(re) {
      Kn(i.isBounded) && (c.bounded = re);
    }
    function I(re) {
      c.transformScale = re;
    }
    function $(re) {
      c.rowHeight = re;
    }
    function le(re) {
      c.maxRows = re;
    }
    function ie() {
      c.rtl = Hd() === "rtl", vt();
    }
    function ye(re) {
      c.cols = Math.floor(re);
    }
    l.increaseItem(W), Ef(() => {
      c.rtl = Hd() === "rtl";
    }), Nn(() => {
      l.responsive && l.lastBreakpoint ? c.cols = Lg(l.lastBreakpoint, l.cols) : c.cols = l.colNum, c.rowHeight = l.rowHeight, c.containerWidth = l.width !== null ? l.width : 100, c.margin = l.margin !== void 0 ? l.margin.map(Number) : [10, 10], c.maxRows = l.maxRows, Kn(i.isDraggable) ? c.draggable = l.isDraggable : c.draggable = i.isDraggable, Kn(i.isResizable) ? c.resizable = l.isResizable : c.resizable = i.isResizable, Kn(i.isBounded) ? c.bounded = l.isBounded : c.bounded = i.isBounded, c.transformScale = l.transformScale, c.useCssTransforms = l.useCssTransforms, c.useStyleCursor = l.useStyleCursor, Ys(() => {
        V = i.x, N = i.y, K = i.h, Y = i.w, In(ue);
      }), u.on("updateWidth", G), u.on("compact", Z), u.on("setDraggable", A), u.on("setResizable", J), u.on("setBounded", ee), u.on("setTransformScale", I), u.on("setRowHeight", $), u.on("setMaxRows", le), u.on("directionchange", ie), u.on("setColNum", ye);
    }), pl(() => {
      u.off("updateWidth", G), u.off("compact", Z), u.off("setDraggable", A), u.off("setResizable", J), u.off("setBounded", ee), u.off("setTransformScale", I), u.off("setRowHeight", $), u.off("setMaxRows", le), u.off("directionchange", ie), u.off("setColNum", ye), r.value && (r.value.unset(), r.value = null), l.decreaseItem(W);
    }), t({ state: c, wrapper: M });
    const fe = typeof navigator < "u" ? navigator.userAgent.toLowerCase().includes("android") : !1, he = oe(() => c.resizable && !i.static), ae = oe(() => l.isMirrored ? !c.rtl : c.rtl), ve = oe(() => (c.draggable || c.resizable) && !i.static), Ne = bS("item"), we = oe(() => ({
      [Ne.b()]: !0,
      [Ne.bm("resizable")]: he.value,
      [Ne.bm("static")]: i.static,
      [Ne.bm("resizing")]: c.isResizing,
      [Ne.bm("dragging")]: c.isDragging,
      [Ne.bm("transform")]: c.useCssTransforms,
      [Ne.bm("rtl")]: ae.value,
      [Ne.bm("no-touch")]: fe && ve.value
    })), Me = oe(() => [Ne.be("resizer"), ae.value && Ne.bem("resizer", "rtl")].filter(Boolean));
    Ye(
      () => i.isDraggable,
      (re) => {
        c.draggable = re;
      }
    ), Ye(
      () => i.static,
      () => {
        In(ln), In(He);
      }
    ), Ye(
      () => c.draggable,
      () => {
        In(ln);
      }
    ), Ye(
      () => i.isResizable,
      (re) => {
        c.resizable = re;
      }
    ), Ye(
      () => i.isBounded,
      (re) => {
        c.bounded = re;
      }
    ), Ye(
      () => c.resizable,
      () => {
        In(He);
      }
    ), Ye(
      () => c.rowHeight,
      () => {
        In(ue), In(se);
      }
    ), Ye([() => c.cols, () => c.containerWidth], () => {
      In(He), In(ue), In(se);
    }), Ye([() => i.minH, () => i.maxH, () => i.minW, () => i.maxW], () => {
      In(He);
    }), Ye(ae, () => {
      In(He), In(ue);
    }), Ye([() => l.margin, () => l.margin[0], () => l.margin[1]], () => {
      const re = l.margin;
      !re || re[0] === c.margin[0] && re[1] === c.margin[1] || (c.margin = re.map(Number), In(ue), In(se));
    });
    function ue() {
      i.x + i.w > c.cols ? (V = 0, Y = i.w > c.cols ? c.cols : i.w) : (V = i.x, Y = i.w);
      const re = qe(V, N, Y, K);
      c.isDragging && (re.top = c.dragging.top, ae.value ? re.right = c.dragging.left : re.left = c.dragging.left), c.isResizing && (re.width = c.resizing.width, re.height = c.resizing.height);
      let $e;
      c.useCssTransforms ? ae.value ? $e = pS(re.top, re.right, re.width, re.height) : $e = gS(re.top, re.left, re.width, re.height) : ae.value ? $e = vS(re.top, re.right, re.width, re.height) : $e = mS(re.top, re.left, re.width, re.height), c.style = $e;
    }
    function se() {
      const re = {};
      for (const $e of ["width", "height"]) {
        const Te = c.style[$e].match(/^(\d+)px$/);
        if (!Te)
          return;
        re[$e] = Te[1];
      }
      a("container-resized", i.i, i.h, i.w, re.height, re.width);
    }
    function Pe(re) {
      if (i.static) return;
      const $e = re.type;
      if ($e === "resizestart" && c.isResizing || $e !== "resizestart" && !c.isResizing)
        return;
      const Te = Yd(re);
      if (Kn(Te)) return;
      const { x: Ke, y: yt } = Te, Qe = { width: 0, height: 0 };
      let Fe;
      switch ($e) {
        case "resizestart": {
          He(), C = Y, E = K, Fe = qe(V, N, Y, K), Qe.width = Fe.width, Qe.height = Fe.height, c.resizing = Qe, c.isResizing = !0;
          break;
        }
        case "resizemove": {
          !re.edges.right && !re.edges.left && (S = Ke), !re.edges.top && !re.edges.bottom && (T = yt);
          const at = Bd(S, T, Ke, yt);
          ae.value ? Qe.width = c.resizing.width - at.deltaX / c.transformScale : Qe.width = c.resizing.width + at.deltaX / c.transformScale, Qe.height = c.resizing.height + at.deltaY / c.transformScale, c.resizing = Qe;
          break;
        }
        case "resizeend": {
          Fe = qe(V, N, Y, K), Qe.width = Fe.width, Qe.height = Fe.height, c.resizing = { width: -1, height: -1 }, c.isResizing = !1;
          break;
        }
      }
      Fe = mt(Qe.height, Qe.width), Fe.w < i.minW && (Fe.w = i.minW), Fe.w > i.maxW && (Fe.w = i.maxW), Fe.h < i.minH && (Fe.h = i.minH), Fe.h > i.maxH && (Fe.h = i.maxH), Fe.h < 1 && (Fe.h = 1), Fe.w < 1 && (Fe.w = 1), S = Ke, T = yt, (Y !== Fe.w || K !== Fe.h) && a("resize", i.i, Fe.h, Fe.w, Qe.height, Qe.width), re.type === "resizeend" && (C !== Y || E !== K) && a("resized", i.i, Fe.h, Fe.w, Qe.height, Qe.width), u.emit("resizeEvent", re.type, i.i, V, N, Fe.h, Fe.w);
    }
    function xe(re) {
      if (i.static || c.isResizing) return;
      const $e = re.type;
      if ($e === "dragstart" && c.isDragging || $e !== "dragstart" && !c.isDragging)
        return;
      const Te = Yd(re);
      if (Kn(Te)) return;
      const { x: Ke, y: yt } = Te, Qe = re.target;
      if (!Qe.offsetParent) return;
      const Fe = { top: 0, left: 0 };
      switch ($e) {
        case "dragstart": {
          X = V, F = N;
          const rt = Qe.offsetParent.getBoundingClientRect(), ut = Qe.getBoundingClientRect(), Et = ut.left / c.transformScale, Zt = rt.left / c.transformScale, un = ut.right / c.transformScale, Dn = rt.right / c.transformScale, kn = ut.top / c.transformScale, dn = rt.top / c.transformScale;
          ae.value ? Fe.left = (un - Dn) * -1 : Fe.left = Et - Zt, Fe.top = kn - dn, c.dragging = Fe, c.isDragging = !0;
          break;
        }
        case "dragmove": {
          const rt = Bd(v, m, Ke, yt);
          if (ae.value ? Fe.left = c.dragging.left - rt.deltaX / c.transformScale : Fe.left = c.dragging.left + rt.deltaX / c.transformScale, Fe.top = c.dragging.top + rt.deltaY / c.transformScale, c.bounded) {
            const ut = Qe.offsetParent.clientHeight - Ct(i.h, c.rowHeight, c.margin[1]);
            Fe.top = Bt(Fe.top, 0, ut);
            const Et = Ze(), Zt = c.containerWidth - Ct(i.w, Et, c.margin[0]);
            Fe.left = Bt(Fe.left, 0, Zt);
          }
          c.dragging = Fe;
          break;
        }
        case "dragend": {
          const rt = Qe.offsetParent.getBoundingClientRect(), ut = Qe.getBoundingClientRect(), Et = ut.left / c.transformScale, Zt = rt.left / c.transformScale, un = ut.right / c.transformScale, Dn = rt.right / c.transformScale, kn = ut.top / c.transformScale, dn = rt.top / c.transformScale;
          ae.value ? Fe.left = (un - Dn) * -1 : Fe.left = Et - Zt, Fe.top = kn - dn, c.dragging = { top: -1, left: -1 }, c.isDragging = !1;
          break;
        }
      }
      let at;
      ae.value, at = nt(Fe.top, Fe.left), v = Ke, m = yt, (V !== at.x || N !== at.y) && a("move", i.i, at.x, at.y), re.type === "dragend" && (X !== V || F !== N) && a("moved", i.i, at.x, at.y), u.emit("dragEvent", re.type, i.i, at.x, at.y, K, Y);
    }
    function qe(re, $e, Te, Ke) {
      const yt = Ze();
      let Qe;
      return ae.value ? Qe = {
        right: Math.round(yt * re + (re + 1) * c.margin[0]),
        top: Math.round(c.rowHeight * $e + ($e + 1) * c.margin[1]),
        // 0 * Infinity === NaN, which causes problems with resize constraints;
        // Fix this if it occurs.
        // Note we do it here rather than later because Math.round(Infinity) causes depot
        width: Te === 1 / 0 ? Te : Math.round(yt * Te + Math.max(0, Te - 1) * c.margin[0]),
        height: Ke === 1 / 0 ? Ke : Math.round(c.rowHeight * Ke + Math.max(0, Ke - 1) * c.margin[1])
      } : Qe = {
        left: Math.round(yt * re + (re + 1) * c.margin[0]),
        top: Math.round(c.rowHeight * $e + ($e + 1) * c.margin[1]),
        // 0 * Infinity === NaN, which causes problems with resize constraints;
        // Fix this if it occurs.
        // Note we do it here rather than later because Math.round(Infinity) causes depot
        width: Te === 1 / 0 ? Te : Math.round(yt * Te + Math.max(0, Te - 1) * c.margin[0]),
        height: Ke === 1 / 0 ? Ke : Math.round(c.rowHeight * Ke + Math.max(0, Ke - 1) * c.margin[1])
      }, Qe;
    }
    function nt(re, $e) {
      const Te = Ze();
      let Ke = Math.round(($e - c.margin[0]) / (Te + c.margin[0])), yt = Math.round((re - c.margin[1]) / (c.rowHeight + c.margin[1]));
      return Ke = Math.max(Math.min(Ke, c.cols - Y), 0), yt = Math.max(Math.min(yt, c.maxRows - K), 0), { x: Ke, y: yt };
    }
    function Ze() {
      return (c.containerWidth - c.margin[0] * (c.cols + 1)) / c.cols;
    }
    function Ct(re, $e, Te) {
      return Number.isFinite(re) ? Math.round($e * re + Math.max(0, re - 1) * Te) : re;
    }
    function Bt(re, $e, Te) {
      return Math.max(Math.min(re, Te), $e);
    }
    function mt(re, $e, Te = !1) {
      const Ke = Ze();
      let yt = Math.round(($e + c.margin[0]) / (Ke + c.margin[0])), Qe = 0;
      return Te ? Qe = Math.ceil((re + c.margin[1]) / (c.rowHeight + c.margin[1])) : Qe = Math.round((re + c.margin[1]) / (c.rowHeight + c.margin[1])), yt = Math.max(Math.min(yt, c.cols - V), 0), Qe = Math.max(Math.min(Qe, c.maxRows - N), 0), { w: yt, h: Qe };
    }
    function It(re, $e) {
      c.containerWidth = re;
    }
    function vt() {
      ue();
    }
    function Ht() {
      !r.value && M.value && (r.value = Ud(M.value), c.useStyleCursor || r.value.styleCursor(!1));
    }
    const pi = Fd(xe);
    function ln() {
      if (Ht(), !!r.value)
        if (c.draggable && !i.static) {
          const re = {
            ignoreFrom: i.dragIgnoreFrom,
            allowFrom: i.dragAllowFrom,
            ...i.dragOption
          };
          r.value.draggable(re), g || (g = !0, r.value.on("dragstart dragmove dragend", ($e) => {
            $e.type === "dragmove" ? pi($e) : xe($e);
          }));
        } else
          r.value.draggable({ enabled: !1 });
    }
    const wn = Fd(Pe);
    function He() {
      if (Ht(), !!r.value)
        if (c.resizable && !i.static) {
          const re = qe(0, 0, i.maxW, i.maxH), $e = qe(0, 0, i.minW, i.minH), Te = {
            edges: {
              left: ae.value ? `.${Me.value[0]}` : !1,
              right: ae.value ? !1 : `.${Me.value[0]}`,
              bottom: `.${Me.value[0]}`,
              top: !1
            },
            ignoreFrom: i.resizeIgnoreFrom,
            restrictSize: {
              min: {
                height: $e.height * c.transformScale,
                width: $e.width * c.transformScale
              },
              max: {
                height: re.height * c.transformScale,
                width: re.width * c.transformScale
              }
            },
            ...i.resizeOption
          };
          i.preserveAspectRatio && (Te.modifiers = [Ud.modifiers.aspectRatio({ ratio: "preserve" })]), r.value.resizable(Te), y || (y = !0, r.value.on("resizestart resizemove resizeend", (Ke) => {
            Ke.type === "resizemove" ? wn(Ke) : Pe(Ke);
          }));
        } else
          r.value.resizable({ enabled: !1 });
    }
    return (re, $e) => (O(), j("section", {
      ref_key: "wrapper",
      ref: M,
      class: Re(we.value),
      style: Ue(c.style)
    }, [
      An(re.$slots, "default"),
      he.value ? (O(), j("span", {
        key: 0,
        class: Re(Me.value)
      }, null, 2)) : be("", !0)
    ], 6));
  }
}), yl = typeof window < "u";
var Kd;
yl && (Kd = window?.navigator) != null && Kd.userAgent && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Zd(e) {
  return e != null;
}
function Qd() {
}
const DS = Object.freeze({
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
});
Object.freeze(new Set(Object.keys(DS)));
const OS = yl && ("ontouchstart" in window || PS() > 0), Xd = OS ? "pointerdown" : "click";
function PS() {
  return typeof navigator < "u" && (navigator.maxTouchPoints || navigator.msMaxTouchPoints) || 0;
}
function IS(e, t, n = window.Event) {
  const { type: i, bubbles: a = !1, cancelable: l = !1, ...u } = t;
  if (!Zd(i) || i === "") return !1;
  let r;
  return Zd(n) ? r = new n(i, { bubbles: a, cancelable: l }) : (r = document.createEvent("HTMLEvents"), r.initEvent(i, a, l)), Object.assign(r, u), e.dispatchEvent(r);
}
const ES = "clickoutside", $S = /* @__PURE__ */ new Set();
let iu = null;
function AS(e, t) {
  return e instanceof Node ? t === e || t.contains(e) || !!t.__transferElement && (t.__transferElement === e || t.__transferElement.contains(e)) : !1;
}
yl && (Xd === "click" && document.addEventListener(
  "pointerdown",
  (e) => {
    iu = e.target;
  },
  !0
), document.addEventListener(
  Xd,
  (e) => {
    const t = iu;
    iu = null, $S.forEach((n) => {
      if (t && AS(t, n))
        return;
      const i = e.target, a = e.composedPath && e.composedPath();
      n !== i && (a ? !a.includes(n) : !n.contains(i)) && (!n.__transferElement || n.__transferElement !== i && !n.__transferElement.contains(i)) && IS(n, { type: ES });
    });
  },
  !0
));
const NS = [
  [
    "requestFullscreen",
    "exitFullscreen",
    "fullscreenElement",
    "fullscreenEnabled",
    "fullscreenchange",
    "fullscreenerror"
  ],
  // New WebKit
  [
    "webkitRequestFullscreen",
    "webkitExitFullscreen",
    "webkitFullscreenElement",
    "webkitFullscreenEnabled",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  // Old WebKit
  [
    "webkitRequestFullScreen",
    "webkitCancelFullScreen",
    "webkitCurrentFullScreenElement",
    "webkitCancelFullScreen",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  [
    "mozRequestFullScreen",
    "mozCancelFullScreen",
    "mozFullScreenElement",
    "mozFullScreenEnabled",
    "mozfullscreenchange",
    "mozfullscreenerror"
  ],
  [
    "msRequestFullscreen",
    "msExitFullscreen",
    "msFullscreenElement",
    "msFullscreenEnabled",
    "MSFullscreenChange",
    "MSFullscreenError"
  ]
];
let Vs;
if (yl) {
  for (const e of NS)
    if (e[1] in document) {
      Vs = e;
      break;
    }
}
oe(() => !1);
const RS = /* @__PURE__ */ new Set(), LS = /* @__PURE__ */ new WeakMap();
if (yl && Vs) {
  const e = Vs[2], t = Vs[4];
  document.addEventListener(
    t,
    () => {
      if (RS.forEach((n) => {
        n.value = !1;
      }), document[e]) {
        const n = LS.get(document[e]);
        n && (n.value = !0);
      }
    },
    !1
  );
}
const Fg = /* @__PURE__ */ new Map();
Fg.set("x", 0);
Fg.set("y", 0);
var ul = [], qS = function() {
  return ul.some(function(e) {
    return e.activeTargets.length > 0;
  });
}, FS = function() {
  return ul.some(function(e) {
    return e.skippedTargets.length > 0;
  });
}, Jd = "ResizeObserver loop completed with undelivered notifications.", VS = function() {
  var e;
  typeof ErrorEvent == "function" ? e = new ErrorEvent("error", {
    message: Jd
  }) : (e = document.createEvent("Event"), e.initEvent("error", !1, !1), e.message = Jd), window.dispatchEvent(e);
}, Xo;
(function(e) {
  e.BORDER_BOX = "border-box", e.CONTENT_BOX = "content-box", e.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
})(Xo || (Xo = {}));
var cl = function(e) {
  return Object.freeze(e);
}, WS = /* @__PURE__ */ (function() {
  function e(t, n) {
    this.inlineSize = t, this.blockSize = n, cl(this);
  }
  return e;
})(), Vg = (function() {
  function e(t, n, i, a) {
    return this.x = t, this.y = n, this.width = i, this.height = a, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, cl(this);
  }
  return e.prototype.toJSON = function() {
    var t = this, n = t.x, i = t.y, a = t.top, l = t.right, u = t.bottom, r = t.left, c = t.width, g = t.height;
    return { x: n, y: i, top: a, right: l, bottom: u, left: r, width: c, height: g };
  }, e.fromRect = function(t) {
    return new e(t.x, t.y, t.width, t.height);
  }, e;
})(), Sc = function(e) {
  return e instanceof SVGElement && "getBBox" in e;
}, Wg = function(e) {
  if (Sc(e)) {
    var t = e.getBBox(), n = t.width, i = t.height;
    return !n && !i;
  }
  var a = e, l = a.offsetWidth, u = a.offsetHeight;
  return !(l || u || e.getClientRects().length);
}, ef = function(e) {
  var t;
  if (e instanceof Element)
    return !0;
  var n = (t = e?.ownerDocument) === null || t === void 0 ? void 0 : t.defaultView;
  return !!(n && e instanceof n.Element);
}, YS = function(e) {
  switch (e.tagName) {
    case "INPUT":
      if (e.type !== "image")
        break;
    case "VIDEO":
    case "AUDIO":
    case "EMBED":
    case "OBJECT":
    case "CANVAS":
    case "IFRAME":
    case "IMG":
      return !0;
  }
  return !1;
}, Bo = typeof window < "u" ? window : {}, Ds = /* @__PURE__ */ new WeakMap(), tf = /auto|scroll/, BS = /^tb|vertical/, HS = /msie|trident/i.test(Bo.navigator && Bo.navigator.userAgent), Fi = function(e) {
  return parseFloat(e || "0");
}, Kl = function(e, t, n) {
  return e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = !1), new WS((n ? t : e) || 0, (n ? e : t) || 0);
}, nf = cl({
  devicePixelContentBoxSize: Kl(),
  borderBoxSize: Kl(),
  contentBoxSize: Kl(),
  contentRect: new Vg(0, 0, 0, 0)
}), Yg = function(e, t) {
  if (t === void 0 && (t = !1), Ds.has(e) && !t)
    return Ds.get(e);
  if (Wg(e))
    return Ds.set(e, nf), nf;
  var n = getComputedStyle(e), i = Sc(e) && e.ownerSVGElement && e.getBBox(), a = !HS && n.boxSizing === "border-box", l = BS.test(n.writingMode || ""), u = !i && tf.test(n.overflowY || ""), r = !i && tf.test(n.overflowX || ""), c = i ? 0 : Fi(n.paddingTop), g = i ? 0 : Fi(n.paddingRight), y = i ? 0 : Fi(n.paddingBottom), v = i ? 0 : Fi(n.paddingLeft), m = i ? 0 : Fi(n.borderTopWidth), S = i ? 0 : Fi(n.borderRightWidth), T = i ? 0 : Fi(n.borderBottomWidth), C = i ? 0 : Fi(n.borderLeftWidth), E = v + g, X = c + y, F = C + S, V = m + T, N = r ? e.offsetHeight - V - e.clientHeight : 0, Y = u ? e.offsetWidth - F - e.clientWidth : 0, K = a ? E + F : 0, M = a ? X + V : 0, W = i ? i.width : Fi(n.width) - K - Y, G = i ? i.height : Fi(n.height) - M - N, Z = W + E + Y + F, A = G + X + N + V, J = cl({
    devicePixelContentBoxSize: Kl(Math.round(W * devicePixelRatio), Math.round(G * devicePixelRatio), l),
    borderBoxSize: Kl(Z, A, l),
    contentBoxSize: Kl(W, G, l),
    contentRect: new Vg(v, c, W, G)
  });
  return Ds.set(e, J), J;
}, Bg = function(e, t, n) {
  var i = Yg(e, n), a = i.borderBoxSize, l = i.contentBoxSize, u = i.devicePixelContentBoxSize;
  switch (t) {
    case Xo.DEVICE_PIXEL_CONTENT_BOX:
      return u;
    case Xo.BORDER_BOX:
      return a;
    default:
      return l;
  }
}, jS = /* @__PURE__ */ (function() {
  function e(t) {
    var n = Yg(t);
    this.target = t, this.contentRect = n.contentRect, this.borderBoxSize = cl([n.borderBoxSize]), this.contentBoxSize = cl([n.contentBoxSize]), this.devicePixelContentBoxSize = cl([n.devicePixelContentBoxSize]);
  }
  return e;
})(), Hg = function(e) {
  if (Wg(e))
    return 1 / 0;
  for (var t = 0, n = e.parentNode; n; )
    t += 1, n = n.parentNode;
  return t;
}, US = function() {
  var e = 1 / 0, t = [];
  ul.forEach(function(l) {
    if (l.activeTargets.length !== 0) {
      var u = [];
      l.activeTargets.forEach(function(r) {
        var c = new jS(r.target), g = Hg(r.target);
        u.push(c), r.lastReportedSize = Bg(r.target, r.observedBox), g < e && (e = g);
      }), t.push(function() {
        l.callback.call(l.observer, u, l.observer);
      }), l.activeTargets.splice(0, l.activeTargets.length);
    }
  });
  for (var n = 0, i = t; n < i.length; n++) {
    var a = i[n];
    a();
  }
  return e;
}, af = function(e) {
  ul.forEach(function(t) {
    t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(n) {
      n.isActive() && (Hg(n.target) > e ? t.activeTargets.push(n) : t.skippedTargets.push(n));
    });
  });
}, GS = function() {
  var e = 0;
  for (af(e); qS(); )
    e = US(), af(e);
  return FS() && VS(), e > 0;
}, au, jg = [], KS = function() {
  return jg.splice(0).forEach(function(e) {
    return e();
  });
}, ZS = function(e) {
  if (!au) {
    var t = 0, n = document.createTextNode(""), i = { characterData: !0 };
    new MutationObserver(function() {
      return KS();
    }).observe(n, i), au = function() {
      n.textContent = "".concat(t ? t-- : t++);
    };
  }
  jg.push(e), au();
}, QS = function(e) {
  ZS(function() {
    requestAnimationFrame(e);
  });
}, Ws = 0, XS = function() {
  return !!Ws;
}, JS = 250, ek = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, lf = [
  "resize",
  "load",
  "transitionend",
  "animationend",
  "animationstart",
  "animationiteration",
  "keyup",
  "keydown",
  "mouseup",
  "mousedown",
  "mouseover",
  "mouseout",
  "blur",
  "focus"
], of = function(e) {
  return e === void 0 && (e = 0), Date.now() + e;
}, lu = !1, tk = (function() {
  function e() {
    var t = this;
    this.stopped = !0, this.listener = function() {
      return t.schedule();
    };
  }
  return e.prototype.run = function(t) {
    var n = this;
    if (t === void 0 && (t = JS), !lu) {
      lu = !0;
      var i = of(t);
      QS(function() {
        var a = !1;
        try {
          a = GS();
        } finally {
          if (lu = !1, t = i - of(), !XS())
            return;
          a ? n.run(1e3) : t > 0 ? n.run(t) : n.start();
        }
      });
    }
  }, e.prototype.schedule = function() {
    this.stop(), this.run();
  }, e.prototype.observe = function() {
    var t = this, n = function() {
      return t.observer && t.observer.observe(document.body, ek);
    };
    document.body ? n() : Bo.addEventListener("DOMContentLoaded", n);
  }, e.prototype.start = function() {
    var t = this;
    this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), lf.forEach(function(n) {
      return Bo.addEventListener(n, t.listener, !0);
    }));
  }, e.prototype.stop = function() {
    var t = this;
    this.stopped || (this.observer && this.observer.disconnect(), lf.forEach(function(n) {
      return Bo.removeEventListener(n, t.listener, !0);
    }), this.stopped = !0);
  }, e;
})(), Ru = new tk(), sf = function(e) {
  !Ws && e > 0 && Ru.start(), Ws += e, !Ws && Ru.stop();
}, nk = function(e) {
  return !Sc(e) && !YS(e) && getComputedStyle(e).display === "inline";
}, ik = (function() {
  function e(t, n) {
    this.target = t, this.observedBox = n || Xo.CONTENT_BOX, this.lastReportedSize = {
      inlineSize: 0,
      blockSize: 0
    };
  }
  return e.prototype.isActive = function() {
    var t = Bg(this.target, this.observedBox, !0);
    return nk(this.target) && (this.lastReportedSize = t), this.lastReportedSize.inlineSize !== t.inlineSize || this.lastReportedSize.blockSize !== t.blockSize;
  }, e;
})(), ak = /* @__PURE__ */ (function() {
  function e(t, n) {
    this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = t, this.callback = n;
  }
  return e;
})(), Os = /* @__PURE__ */ new WeakMap(), rf = function(e, t) {
  for (var n = 0; n < e.length; n += 1)
    if (e[n].target === t)
      return n;
  return -1;
}, Ps = (function() {
  function e() {
  }
  return e.connect = function(t, n) {
    var i = new ak(t, n);
    Os.set(t, i);
  }, e.observe = function(t, n, i) {
    var a = Os.get(t), l = a.observationTargets.length === 0;
    rf(a.observationTargets, n) < 0 && (l && ul.push(a), a.observationTargets.push(new ik(n, i && i.box)), sf(1), Ru.schedule());
  }, e.unobserve = function(t, n) {
    var i = Os.get(t), a = rf(i.observationTargets, n), l = i.observationTargets.length === 1;
    a >= 0 && (l && ul.splice(ul.indexOf(i), 1), i.observationTargets.splice(a, 1), sf(-1));
  }, e.disconnect = function(t) {
    var n = this, i = Os.get(t);
    i.observationTargets.slice().forEach(function(a) {
      return n.unobserve(t, a.target);
    }), i.activeTargets.splice(0, i.activeTargets.length);
  }, e;
})(), lk = (function() {
  function e(t) {
    if (arguments.length === 0)
      throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
    if (typeof t != "function")
      throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
    Ps.connect(this, t);
  }
  return e.prototype.observe = function(t, n) {
    if (arguments.length === 0)
      throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
    if (!ef(t))
      throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
    Ps.observe(this, t, n);
  }, e.prototype.unobserve = function(t) {
    if (arguments.length === 0)
      throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
    if (!ef(t))
      throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
    Ps.unobserve(this, t);
  }, e.prototype.disconnect = function() {
    Ps.disconnect(this);
  }, e.toString = function() {
    return "function ResizeObserver () { [polyfill code] }";
  }, e;
})();
const tr = /* @__PURE__ */ new WeakMap();
function ok(e) {
  var t;
  for (let n = 0, i = e.length; n < i; ++n) {
    const a = e[n], l = tr.get(a.target);
    if (typeof l == "function") {
      const { inlineSize: u, blockSize: r } = ((t = a.borderBoxSize) == null ? void 0 : t[0]) ?? {}, { offsetWidth: c, offsetHeight: g } = a.target;
      l(
        Object.assign(a, {
          offsetWidth: c,
          offsetHeight: g,
          width: u ?? c,
          height: r ?? g
        })
      );
    }
  }
}
const Ug = new (yl && window.ResizeObserver || lk)(
  ok
);
function uf(e, t) {
  tr.set(e, t), Ug.observe(e);
}
function cf(e) {
  tr.has(e) && (Ug.unobserve(e), tr.delete(e));
}
function sk(e = {}) {
  let t = Qd;
  const n = Ye(
    () => f(e.target),
    (a) => {
      t(), !(!a || typeof e.onResize != "function") && (uf(a, e.onResize), t = () => {
        cf(a), t = Qd;
      });
    },
    { immediate: !0 }
  ), i = () => {
    n(), t();
  };
  return pp() && mp(i), {
    /**
     * @deprecated Will be removed in next major version, please directly use `observeResize` from imports.
     */
    observeResize: uf,
    /**
     * @deprecated Will be removed in next major version, please directly use `unobserveResize` from imports.
     */
    unobserveResize: cf,
    unobserve: i
  };
}
const rk = pe(!1);
oe(() => rk.value);
const df = "__theme_style__", ou = "__theme_observer__", ff = La(/* @__PURE__ */ new Map()), hf = /* @__PURE__ */ new Map();
Ye(ff, () => {
  if (!yl) return;
  hf.clear();
  const e = document.head.querySelector(`#${df}`);
  e && document.head.removeChild(e);
  const t = document.createElement("style");
  let n = `.${ou} { width: 1px }`, i = 1;
  for (const [a, [l, u]] of ff.entries())
    n += ` html.${l} .${ou}, .${u} .${ou} { width: ${++i}px }`, hf.set(i, a);
  t.textContent = n, t.id = df, document.head.appendChild(t);
});
const uk = /* @__PURE__ */ ze({
  __name: "grid-layout",
  props: {
    autoSize: { type: Boolean, default: !0 },
    colNum: { default: 12 },
    rowHeight: { default: 150 },
    maxRows: { default: 1 / 0 },
    margin: { default: () => [10, 10] },
    isDraggable: { type: Boolean, default: !0 },
    isResizable: { type: Boolean, default: !0 },
    isMirrored: { type: Boolean, default: !1 },
    isBounded: { type: Boolean, default: !1 },
    useCssTransforms: { type: Boolean, default: !0 },
    verticalCompact: { type: Boolean, default: !0 },
    restoreOnDrag: { type: Boolean, default: !1 },
    layout: {},
    responsive: { type: Boolean, default: !1 },
    responsiveLayouts: { default: () => ({}) },
    transformScale: { default: 1 },
    breakpoints: { default: () => ({ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }) },
    cols: { default: () => ({ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }) },
    preventCollision: { type: Boolean, default: !1 },
    useStyleCursor: { type: Boolean, default: !0 }
  },
  emits: [
    "layout-before-mount",
    "layout-mounted",
    "layout-updated",
    "breakpoint-changed",
    "update:layout",
    "layout-ready"
  ],
  setup(e, { expose: t, emit: n }) {
    const i = e, a = n, l = La({
      width: -1,
      mergedStyle: {},
      lastLayoutLength: 0,
      isDragging: !1,
      placeholder: {
        x: 0,
        y: 0,
        w: 0,
        h: 0,
        i: ""
      },
      layouts: {},
      // array to store all layouts from different breakpoints
      lastBreakpoint: null,
      // store last active breakpoint
      originalLayout: null
      // store original Layout
    }), u = /* @__PURE__ */ new Map(), r = pe(i.layout), c = pe(), { observeResize: g, unobserveResize: y } = sk(), v = sS();
    v.on("resizeEvent", m), v.on("dragEvent", S), Ef(() => {
      a("layout-before-mount", r.value);
    }), Nn(() => {
      a("layout-mounted", r.value), Un(() => {
        yS(r.value), l.originalLayout = r.value, Un(() => {
          G(), c.value && g(c.value, rS(V, 16)), Vl(r.value, i.verticalCompact), a("layout-updated", r.value), F(), V();
        });
      });
    }), pl(() => {
      v.clearAll(), c.value && y(c.value);
    });
    function m(A, J, ee, I, $, le) {
      M(A, J, ee, I, $, le);
    }
    function S(A, J, ee, I, $, le) {
      K(A, J, ee, I, $, le);
    }
    Ye(
      () => l.width,
      (A, J) => {
        Un(() => {
          v.emit("updateWidth", A), J === -1 && Un(() => {
            a("layout-ready", r.value);
          }), F();
        });
      }
    ), Ye(
      () => [i.layout, i.layout.length],
      () => {
        r.value = i.layout, X();
      }
    ), Ye(
      () => i.colNum,
      (A) => {
        v.emit("setColNum", A);
      }
    ), Ye(
      () => i.rowHeight,
      (A) => {
        v.emit("setRowHeight", A);
      }
    ), Ye(
      () => i.isDraggable,
      (A) => {
        v.emit("setDraggable", A);
      }
    ), Ye(
      () => i.isResizable,
      (A) => {
        v.emit("setResizable", A);
      }
    ), Ye(
      () => i.isBounded,
      (A) => {
        v.emit("setBounded", A);
      }
    ), Ye(
      () => i.transformScale,
      (A) => {
        v.emit("setTransformScale", A);
      }
    ), Ye(
      () => i.responsive,
      (A) => {
        A || (a("update:layout", l.originalLayout), v.emit("setColNum", i.colNum)), V();
      }
    ), Ye(
      () => i.maxRows,
      (A) => {
        v.emit("setMaxRows", A);
      }
    ), Ye([() => i.margin, () => i.margin[1]], F), fl(
      Ig,
      La({
        ...Cc(i),
        ...Cc(l),
        increaseItem: T,
        decreaseItem: C
      })
    ), fl(Eg, v), t({ state: l, getItem: E, resizeEvent: M, dragEvent: K, layoutUpdate: X });
    function T(A) {
      u.set(A.i, A);
    }
    function C(A) {
      u.delete(A.i);
    }
    function E(A) {
      return u.get(A);
    }
    function X() {
      if (!Kn(r.value) && !Kn(l.originalLayout)) {
        if (r.value.length !== l.originalLayout.length) {
          const A = Z(r.value, l.originalLayout);
          if (A.length > 0)
            if (r.value.length > l.originalLayout.length)
              l.originalLayout = l.originalLayout.concat(A);
            else {
              const J = new Set(A.map((ee) => ee.i));
              l.originalLayout = l.originalLayout.filter((ee) => !J.has(ee.i));
            }
          l.lastLayoutLength = r.value.length, G();
        }
        Vl(r.value, i.verticalCompact), v.emit("updateWidth", l.width), F(), a("layout-updated", r.value);
      }
    }
    function F() {
      l.mergedStyle = {
        height: N()
      };
    }
    function V() {
      c.value && (l.width = c.value.offsetWidth), v.emit("resizeEvent");
    }
    function N() {
      if (!i.autoSize) return;
      const A = parseFloat(i.margin[1]);
      return cS(r.value) * (i.rowHeight + A) + A + "px";
    }
    let Y;
    function K(A, J, ee, I, $, le) {
      let ie = Vd(r.value, J);
      Kn(ie) && (ie = { h: 0, w: 0, x: 0, y: 0, i: "" }), A === "dragstart" && !i.verticalCompact && (Y = r.value.reduce(
        (ye, { i: fe, x: he, y: ae }) => ({
          ...ye,
          [fe]: { x: he, y: ae }
        }),
        {}
      )), A === "dragmove" || A === "dragstart" ? (l.placeholder.i = J, l.placeholder.x = ie.x, l.placeholder.y = ie.y, l.placeholder.w = le, l.placeholder.h = $, Un(() => {
        l.isDragging = !0;
      }), v.emit("updateWidth", l.width)) : Un(() => {
        l.isDragging = !1;
      }), r.value = Nu(r.value, ie, ee, I, !0, i.preventCollision), i.restoreOnDrag ? (ie.static = !0, Vl(r.value, i.verticalCompact, Y), ie.static = !1) : Vl(r.value, i.verticalCompact), v.emit("compact"), F(), A === "dragend" && (Y = void 0, a("layout-updated", r.value));
    }
    function M(A, J, ee, I, $, le) {
      let ie = Vd(r.value, J);
      Kn(ie) && (ie = { h: 0, w: 0, x: 0, y: 0, i: "" });
      let ye;
      if (i.preventCollision) {
        const fe = Ag(r.value, { ...ie, w: le, h: $ }).filter(
          (he) => he.i !== ie.i
        );
        if (ye = fe.length > 0, ye) {
          let he = 1 / 0, ae = 1 / 0;
          fe.forEach((ve) => {
            ve.x > ie.x && (he = Math.min(he, ve.x)), ve.y > ie.y && (ae = Math.min(ae, ve.y));
          }), Number.isFinite(he) && (ie.w = he - ie.x), Number.isFinite(ae) && (ie.h = ae - ie.y);
        }
      }
      ye || (ie.w = le, ie.h = $), A === "resizestart" || A === "resizemove" ? (l.placeholder.i = J, l.placeholder.x = ee, l.placeholder.y = I, l.placeholder.w = ie.w, l.placeholder.h = ie.h, Un(() => {
        l.isDragging = !0;
      }), v.emit("updateWidth", l.width)) : A && Un(() => {
        l.isDragging = !1;
      }), i.responsive && W(), Vl(r.value, i.verticalCompact), v.emit("compact"), F(), A === "resizeend" && a("layout-updated", r.value);
    }
    function W() {
      const A = SS(i.breakpoints, l.width);
      if (A === l.lastBreakpoint)
        return;
      const J = Lg(A, i.cols);
      !Kn(l.lastBreakpoint) && !l.layouts[l.lastBreakpoint] && (l.layouts[l.lastBreakpoint] = Au(r.value));
      const ee = kS(
        l.originalLayout,
        l.layouts,
        i.breakpoints,
        A,
        l.lastBreakpoint,
        J,
        i.verticalCompact
      );
      l.layouts[A] = ee, l.lastBreakpoint !== A && a("breakpoint-changed", A, ee), r.value = ee, a("update:layout", ee), l.lastBreakpoint = A, v.emit("setColNum", J);
    }
    function G() {
      l.layouts = Object.assign({}, i.responsiveLayouts);
    }
    function Z(A, J) {
      const ee = new Set(J.map((ie) => ie.i)), I = new Set(A.map((ie) => ie.i)), $ = A.filter((ie) => !ee.has(ie.i)), le = J.filter((ie) => !I.has(ie.i));
      return $.concat(le);
    }
    return (A, J) => (O(), j("div", {
      ref_key: "wrapper",
      ref: c,
      class: "vgl-layout",
      style: Ue(l.mergedStyle)
    }, [
      A.$slots.default ? An(A.$slots, "default", { key: 0 }) : (O(!0), j(Oe, { key: 1 }, et(r.value, (ee) => (O(), Ce(Gd, vp({
        key: ee.i,
        ref_for: !0
      }, ee), {
        default: q(() => [
          An(A.$slots, "item", { item: ee })
        ]),
        _: 2
      }, 1040))), 128)),
      $f(_(Gd, {
        class: "vgl-item--placeholder",
        x: l.placeholder.x,
        y: l.placeholder.y,
        w: l.placeholder.w,
        h: l.placeholder.h,
        i: l.placeholder.i
      }, null, 8, ["x", "y", "w", "h", "i"]), [
        [Af, l.isDragging]
      ])
    ], 4));
  }
});
(function() {
  try {
    if (typeof document < "u") {
      var e = document.createElement("style");
      e.appendChild(document.createTextNode('.vgl-layout{--vgl-placeholder-bg: red;--vgl-placeholder-opacity: 20%;--vgl-placeholder-z-index: 2;--vgl-item-resizing-z-index: 3;--vgl-item-resizing-opacity: 60%;--vgl-item-dragging-z-index: 3;--vgl-item-dragging-opacity: 100%;--vgl-resizer-size: 10px;--vgl-resizer-border-color: #444;--vgl-resizer-border-width: 2px;position:relative;box-sizing:border-box;transition:height .2s ease}.vgl-item{position:absolute;box-sizing:border-box;transition:.2s ease;transition-property:left,top,right}.vgl-item--placeholder{z-index:var(--vgl-placeholder-z-index, 2);-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:var(--vgl-placeholder-bg, red);opacity:var(--vgl-placeholder-opacity, 20%);transition-duration:.1s}.vgl-item--no-touch{touch-action:none}.vgl-item--transform{right:auto;left:0;transition-property:transform}.vgl-item--transform.vgl-item--rtl{right:0;left:auto}.vgl-item--resizing{z-index:var(--vgl-item-resizing-z-index, 3);-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--vgl-item-resizing-opacity, 60%)}.vgl-item--dragging{z-index:var(--vgl-item-dragging-z-index, 3);-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--vgl-item-dragging-opacity, 100%);transition:none}.vgl-item__resizer{position:absolute;right:0;bottom:0;box-sizing:border-box;width:var(--vgl-resizer-size);height:var(--vgl-resizer-size);cursor:se-resize}.vgl-item__resizer:before{position:absolute;top:0;right:3px;bottom:3px;left:0;content:"";border:0 solid var(--vgl-resizer-border-color);border-right-width:var(--vgl-resizer-border-width);border-bottom-width:var(--vgl-resizer-border-width)}.vgl-item__resizer--rtl{right:auto;left:0;cursor:sw-resize}.vgl-item__resizer--rtl:before{top:0;right:0;bottom:3px;left:3px;border-right-width:0;border-bottom-width:var(--vgl-resizer-border-width);border-left-width:var(--vgl-resizer-border-width)}')), document.head.appendChild(e);
    }
  } catch (t) {
    console.error("vite-plugin-css-injected-by-js", t);
  }
})();
const ck = {
  class: "px-12px py-15px",
  style: { "border-bottom": "1px solid var(--ant-color-border-secondary)" }
}, dk = {
  class: "flex items-center justify-between px-4 py-3 w-full",
  style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
}, kc = /* @__PURE__ */ ze({
  __name: "AppOverlay",
  props: {
    open: { type: Boolean },
    title: {},
    mode: { default: "modal" },
    width: { default: 520 },
    bodyHeight: {},
    footer: { type: Boolean, default: !0 },
    headerBorder: { type: Boolean, default: !0 },
    footerBorder: { type: Boolean, default: !0 },
    destroyOnClose: { type: Boolean, default: !1 },
    mask: { type: Boolean, default: !0 }
  },
  emits: ["close"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = Hi(), l = oe(() => a.isDark ? "#141414" : "#ffffff"), u = oe(() => a.isDark ? "#303030" : "#e8e8e8");
    function r() {
      let m = 0;
      return document.querySelectorAll("div").forEach((S) => {
        const T = window.getComputedStyle(S);
        if (T.position === "static")
          return;
        const C = Number.parseInt(T.zIndex);
        !Number.isNaN(C) && C > m && (m = C);
      }), m;
    }
    const c = pe(1e3);
    Ye(() => n.open, (m) => {
      m && (c.value = Math.max(r(), 1e3));
    });
    const g = oe(() => ({
      wrapper: { padding: 0 },
      content: { padding: 0, background: l.value },
      header: {
        padding: "10px 16px",
        margin: 0,
        background: l.value,
        ...n.headerBorder ? { borderBottom: `1px solid ${u.value}` } : {}
      },
      body: {
        padding: 0,
        background: l.value,
        display: "flex",
        flexDirection: "column",
        ...n.bodyHeight != null ? { height: n.bodyHeight } : {}
      },
      footer: {
        margin: 0,
        padding: "10px 16px",
        ...n.footerBorder ? { borderTop: `1px solid ${u.value}` } : {}
      }
    })), y = pe();
    function v() {
      return y.value ?? document.body;
    }
    return (m, S) => e.mode === "modal" ? (O(), Ce(f(jo), {
      key: 0,
      "mask-style": { background: "rgba(0, 0, 0, 0.2" },
      open: e.open,
      width: e.width,
      "z-index": c.value,
      styles: g.value,
      "destroy-on-close": e.destroyOnClose,
      footer: e.footer ? void 0 : null,
      class: "no-content-padding-modal",
      "body-style": { padding: 0, display: "flex", height: e.bodyHeight, flexDirection: "column" },
      onCancel: S[0] || (S[0] = (T) => i("close"))
    }, Mc({
      default: q(() => [
        b("div", {
          ref_key: "popupContainerRef",
          ref: y,
          style: { position: "relative", flex: "1", "min-height": "0", display: "flex", "flex-direction": "column" }
        }, [
          _(f(fu), { "get-popup-container": v }, {
            default: q(() => [
              An(m.$slots, "default")
            ]),
            _: 3
          })
        ], 512)
      ]),
      _: 2
    }, [
      m.$slots.title || e.title ? {
        name: "title",
        fn: q(() => [
          b("div", ck, [
            An(m.$slots, "title", {}, () => [
              ce(P(e.title) + " " + P(e.footer), 1)
            ])
          ])
        ]),
        key: "0"
      } : void 0,
      m.$slots.footer ? {
        name: "footer",
        fn: q(() => [
          b("div", dk, [
            An(m.$slots, "footer")
          ])
        ]),
        key: "1"
      } : void 0
    ]), 1032, ["open", "width", "z-index", "styles", "destroy-on-close", "footer", "body-style"])) : (O(), Ce(f(Sp), {
      key: 1,
      open: e.open,
      title: e.title,
      width: e.width,
      "z-index": c.value,
      mask: e.mask,
      "root-style": { zIndex: c.value },
      placement: "right",
      "mask-style": { background: "rgba(0, 0, 0, 0.2)" },
      "body-style": { padding: 0, background: l.value, display: "flex", flexDirection: "column", flex: 1, minHeight: 0 },
      "header-style": { padding: "10px 16px", background: l.value, ...e.headerBorder ? { borderBottom: `1px solid ${u.value}` } : {} },
      "footer-style": { padding: "10px 16px", ...e.footerBorder ? { borderTop: `1px solid ${u.value}` } : {} },
      "destroy-on-close": e.destroyOnClose,
      onClose: S[1] || (S[1] = (T) => i("close"))
    }, Mc({
      default: q(() => [
        b("div", {
          ref_key: "popupContainerRef",
          ref: y,
          style: { position: "relative", flex: "1", "min-height": "0", display: "flex", "flex-direction": "column" }
        }, [
          _(f(fu), { "get-popup-container": v }, {
            default: q(() => [
              An(m.$slots, "default")
            ]),
            _: 3
          })
        ], 512)
      ]),
      _: 2
    }, [
      m.$slots.title ? {
        name: "title",
        fn: q(() => [
          An(m.$slots, "title")
        ]),
        key: "0"
      } : void 0,
      m.$slots.footer && e.footer ? {
        name: "footer",
        fn: q(() => [
          An(m.$slots, "footer")
        ]),
        key: "1"
      } : void 0
    ]), 1032, ["open", "title", "width", "z-index", "mask", "root-style", "body-style", "header-style", "footer-style", "destroy-on-close"]));
  }
});
function Gg(e, t, n = 1e3, i) {
  const a = pe(null), l = pe(!1), u = pe(null), { config: r } = no(), c = gl(), g = oe(() => c.resolveAll()), y = oe(() => {
    const T = e();
    return [
      JSON.stringify(T.map((C) => C.dataSource)),
      JSON.stringify(g.value),
      i?.() ?? 0
    ].join("|");
  });
  let v = !1;
  async function m() {
    const T = e().filter((N) => N.enabled !== !1);
    if (T.length === 0) {
      a.value = null, l.value = !1;
      return;
    }
    const C = t(), E = Math.max(
      Math.ceil((C.to - C.from) / n),
      1e3
    ), X = { from: C.from, to: C.to }, F = r.value.datasourceConfig ?? [], V = new Map(F.map((N) => [N.uid, N]));
    v = !1, l.value = !0, u.value = null;
    try {
      const N = [];
      for (const Y of T) {
        const K = Y.dataSource, M = Qs(K.type);
        if (!M)
          continue;
        const W = "datasourceId" in K ? V.get(K.datasourceId ?? "") : void 0, G = await M.query({
          requestId: Y.id,
          range: X,
          intervalMs: E,
          maxDataPoints: n,
          targets: [K],
          scopedVars: g.value,
          _dsCfg: W,
          _variableStates: c.variables
        });
        N.push(...G.data);
      }
      v || (a.value = { data: N, state: "Done" }, u.value = null);
    } catch (N) {
      v || (u.value = N?.message ?? String(N));
    } finally {
      v || (l.value = !1);
    }
  }
  Ye(y, m, { immediate: !0 }), Ye(
    () => {
      const T = t();
      return `${T.from}|${T.to}`;
    },
    m
  );
  function S() {
    v = !0;
  }
  return { response: a, loading: l, error: u, abort: S };
}
const Kg = Symbol("panelEditor");
function fk(e) {
  fl(Kg, e);
}
function uo() {
  const e = dl(Kg);
  if (!e)
    throw new Error("usePanelEditor must be used within a PanelEditorProvider");
  return e;
}
function hk(e, t, { signal: n, edges: i } = {}) {
  let a, l = null;
  const u = i != null && i.includes("leading"), r = i == null || i.includes("trailing"), c = () => {
    l !== null && (e.apply(a, l), a = void 0, l = null);
  }, g = () => {
    r && c(), S();
  };
  let y = null;
  const v = () => {
    y != null && clearTimeout(y), y = setTimeout(() => {
      y = null, g();
    }, t);
  }, m = () => {
    y !== null && (clearTimeout(y), y = null);
  }, S = () => {
    m(), a = void 0, l = null;
  }, T = () => {
    c();
  }, C = function(...E) {
    if (n?.aborted)
      return;
    a = this, l = E;
    const X = y == null;
    v(), u && X && c();
  };
  return C.schedule = v, C.cancel = S, C.flush = T, n?.addEventListener("abort", S, { once: !0 }), C;
}
function gk() {
}
function _i(e, t, n) {
  return n == null ? Math.min(e, t) : Math.min(Math.max(e, t), n);
}
function gf(e) {
  return Object.getOwnPropertySymbols(e).filter((t) => Object.prototype.propertyIsEnumerable.call(e, t));
}
function pf(e) {
  return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
}
const pk = "[object RegExp]", mk = "[object String]", vk = "[object Number]", yk = "[object Boolean]", mf = "[object Arguments]", bk = "[object Symbol]", xk = "[object Date]", wk = "[object Map]", Sk = "[object Set]", kk = "[object Array]", _k = "[object Function]", Ck = "[object ArrayBuffer]", su = "[object Object]", Mk = "[object Error]", Tk = "[object DataView]", zk = "[object Uint8Array]", Dk = "[object Uint8ClampedArray]", Ok = "[object Uint16Array]", Pk = "[object Uint32Array]", Ik = "[object BigUint64Array]", Ek = "[object Int8Array]", $k = "[object Int16Array]", Ak = "[object Int32Array]", Nk = "[object BigInt64Array]", Rk = "[object Float32Array]", Lk = "[object Float64Array]";
function vf(e) {
  if (!e || typeof e != "object")
    return !1;
  const t = Object.getPrototypeOf(e);
  return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(e) === "[object Object]" : !1;
}
function qk(e, t) {
  return e === t || Number.isNaN(e) && Number.isNaN(t);
}
function Fk(e, t, n) {
  return No(e, t, void 0, void 0, void 0, void 0, n);
}
function No(e, t, n, i, a, l, u) {
  const r = u(e, t, n, i, a, l);
  if (r !== void 0)
    return r;
  if (typeof e == typeof t)
    switch (typeof e) {
      case "bigint":
      case "string":
      case "boolean":
      case "symbol":
      case "undefined":
        return e === t;
      case "number":
        return e === t || Object.is(e, t);
      case "function":
        return e === t;
      case "object":
        return Ho(e, t, l, u);
    }
  return Ho(e, t, l, u);
}
function Ho(e, t, n, i) {
  if (Object.is(e, t))
    return !0;
  let a = pf(e), l = pf(t);
  if (a === mf && (a = su), l === mf && (l = su), a !== l)
    return !1;
  switch (a) {
    case mk:
      return e.toString() === t.toString();
    case vk: {
      const c = e.valueOf(), g = t.valueOf();
      return qk(c, g);
    }
    case yk:
    case xk:
    case bk:
      return Object.is(e.valueOf(), t.valueOf());
    case pk:
      return e.source === t.source && e.flags === t.flags;
    case _k:
      return e === t;
  }
  n = n ?? /* @__PURE__ */ new Map();
  const u = n.get(e), r = n.get(t);
  if (u != null && r != null)
    return u === t;
  n.set(e, t), n.set(t, e);
  try {
    switch (a) {
      case wk: {
        if (e.size !== t.size)
          return !1;
        for (const [c, g] of e.entries())
          if (!t.has(c) || !No(g, t.get(c), c, e, t, n, i))
            return !1;
        return !0;
      }
      case Sk: {
        if (e.size !== t.size)
          return !1;
        const c = Array.from(e.values()), g = Array.from(t.values());
        for (let y = 0; y < c.length; y++) {
          const v = c[y], m = g.findIndex((S) => No(v, S, void 0, e, t, n, i));
          if (m === -1)
            return !1;
          g.splice(m, 1);
        }
        return !0;
      }
      case kk:
      case zk:
      case Dk:
      case Ok:
      case Pk:
      case Ik:
      case Ek:
      case $k:
      case Ak:
      case Nk:
      case Rk:
      case Lk: {
        if (typeof Buffer < "u" && Buffer.isBuffer(e) !== Buffer.isBuffer(t) || e.length !== t.length)
          return !1;
        for (let c = 0; c < e.length; c++)
          if (!No(e[c], t[c], c, e, t, n, i))
            return !1;
        return !0;
      }
      case Ck:
        return e.byteLength !== t.byteLength ? !1 : Ho(new Uint8Array(e), new Uint8Array(t), n, i);
      case Tk:
        return e.byteLength !== t.byteLength || e.byteOffset !== t.byteOffset ? !1 : Ho(new Uint8Array(e), new Uint8Array(t), n, i);
      case Mk:
        return e.name === t.name && e.message === t.message;
      case su: {
        if (!(Ho(e.constructor, t.constructor, n, i) || vf(e) && vf(t)))
          return !1;
        const c = [...Object.keys(e), ...gf(e)], g = [...Object.keys(t), ...gf(t)];
        if (c.length !== g.length)
          return !1;
        for (let y = 0; y < c.length; y++) {
          const v = c[y], m = e[v];
          if (!Object.hasOwn(t, v))
            return !1;
          const S = t[v];
          if (!No(m, S, v, e, t, n, i))
            return !1;
        }
        return !0;
      }
      default:
        return !1;
    }
  } finally {
    n.delete(e), n.delete(t);
  }
}
function Vk(e, t) {
  return Fk(e, t, gk);
}
const Wk = "_splitView_pzp7c_6", Yk = "_sashContainer_pzp7c_13", Bk = "_sash_pzp7c_13", Hk = "_splitViewContainer_pzp7c_24", jk = "_splitViewView_pzp7c_31", Uk = "_vertical_pzp7c_37", Gk = "_horizontal_pzp7c_41", Kk = "_separatorBorder_pzp7c_45", Ea = {
  splitView: Wk,
  sashContainer: Yk,
  sash: Bk,
  splitViewContainer: Hk,
  splitViewView: jk,
  vertical: Uk,
  horizontal: Gk,
  separatorBorder: Kk
};
let Zg = !1, Qg = !1, Do;
typeof navigator == "object" && (Do = navigator.userAgent, Qg = Do.includes("Macintosh"), Zg = (Do.includes("Macintosh") || Do.includes("iPad") || Do.includes("iPhone")) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
const Xg = Zg, Zk = Qg;
class Qk {
  _size;
  getSize() {
    return this._size;
  }
  setSize(t) {
    this._size = t;
  }
}
function Is(e, t) {
  const n = e.length, i = n - t.length;
  return i >= 0 && e.slice(i, n) === t;
}
function Xk(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var yf = { exports: {} }, bf;
function Jk() {
  return bf || (bf = 1, (function(e) {
    var t = Object.prototype.hasOwnProperty, n = "~";
    function i() {
    }
    Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (n = !1));
    function a(c, g, y) {
      this.fn = c, this.context = g, this.once = y || !1;
    }
    function l(c, g, y, v, m) {
      if (typeof y != "function")
        throw new TypeError("The listener must be a function");
      var S = new a(y, v || c, m), T = n ? n + g : g;
      return c._events[T] ? c._events[T].fn ? c._events[T] = [c._events[T], S] : c._events[T].push(S) : (c._events[T] = S, c._eventsCount++), c;
    }
    function u(c, g) {
      --c._eventsCount === 0 ? c._events = new i() : delete c._events[g];
    }
    function r() {
      this._events = new i(), this._eventsCount = 0;
    }
    r.prototype.eventNames = function() {
      var c = [], g, y;
      if (this._eventsCount === 0) return c;
      for (y in g = this._events)
        t.call(g, y) && c.push(n ? y.slice(1) : y);
      return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(g)) : c;
    }, r.prototype.listeners = function(c) {
      var g = n ? n + c : c, y = this._events[g];
      if (!y) return [];
      if (y.fn) return [y.fn];
      for (var v = 0, m = y.length, S = new Array(m); v < m; v++)
        S[v] = y[v].fn;
      return S;
    }, r.prototype.listenerCount = function(c) {
      var g = n ? n + c : c, y = this._events[g];
      return y ? y.fn ? 1 : y.length : 0;
    }, r.prototype.emit = function(c, g, y, v, m, S) {
      var T = n ? n + c : c;
      if (!this._events[T]) return !1;
      var C = this._events[T], E = arguments.length, X, F;
      if (C.fn) {
        switch (C.once && this.removeListener(c, C.fn, void 0, !0), E) {
          case 1:
            return C.fn.call(C.context), !0;
          case 2:
            return C.fn.call(C.context, g), !0;
          case 3:
            return C.fn.call(C.context, g, y), !0;
          case 4:
            return C.fn.call(C.context, g, y, v), !0;
          case 5:
            return C.fn.call(C.context, g, y, v, m), !0;
          case 6:
            return C.fn.call(C.context, g, y, v, m, S), !0;
        }
        for (F = 1, X = new Array(E - 1); F < E; F++)
          X[F - 1] = arguments[F];
        C.fn.apply(C.context, X);
      } else {
        var V = C.length, N;
        for (F = 0; F < V; F++)
          switch (C[F].once && this.removeListener(c, C[F].fn, void 0, !0), E) {
            case 1:
              C[F].fn.call(C[F].context);
              break;
            case 2:
              C[F].fn.call(C[F].context, g);
              break;
            case 3:
              C[F].fn.call(C[F].context, g, y);
              break;
            case 4:
              C[F].fn.call(C[F].context, g, y, v);
              break;
            default:
              if (!X) for (N = 1, X = new Array(E - 1); N < E; N++)
                X[N - 1] = arguments[N];
              C[F].fn.apply(C[F].context, X);
          }
      }
      return !0;
    }, r.prototype.on = function(c, g, y) {
      return l(this, c, g, y, !1);
    }, r.prototype.once = function(c, g, y) {
      return l(this, c, g, y, !0);
    }, r.prototype.removeListener = function(c, g, y, v) {
      var m = n ? n + c : c;
      if (!this._events[m]) return this;
      if (!g)
        return u(this, m), this;
      var S = this._events[m];
      if (S.fn)
        S.fn === g && (!v || S.once) && (!y || S.context === y) && u(this, m);
      else {
        for (var T = 0, C = [], E = S.length; T < E; T++)
          (S[T].fn !== g || v && !S[T].once || y && S[T].context !== y) && C.push(S[T]);
        C.length ? this._events[m] = C.length === 1 ? C[0] : C : u(this, m);
      }
      return this;
    }, r.prototype.removeAllListeners = function(c) {
      var g;
      return c ? (g = n ? n + c : c, this._events[g] && u(this, g)) : (this._events = new i(), this._eventsCount = 0), this;
    }, r.prototype.off = r.prototype.removeListener, r.prototype.addListener = r.prototype.on, r.prefixed = n, r.EventEmitter = r, e.exports = r;
  })(yf)), yf.exports;
}
var e_ = Jk();
const _c = /* @__PURE__ */ Xk(e_);
function xf(e, t) {
  const n = e.indexOf(t);
  n !== -1 && (e.splice(n, 1), e.unshift(t));
}
function ru(e, t) {
  const n = e.indexOf(t);
  n !== -1 && (e.splice(n, 1), e.push(t));
}
function li(e, t, n = 1) {
  const i = Math.max(0, Math.ceil((t - e) / n)), a = Array.from({ length: i });
  let l = -1;
  for (; ++l < i; )
    a[l] = e + l * n;
  return a;
}
const t_ = "_sash_j5cmb_7", n_ = "_disabled_j5cmb_15", i_ = "_mac_j5cmb_19", a_ = "_vertical_j5cmb_19", l_ = "_minimum_j5cmb_23", o_ = "_maximum_j5cmb_27", s_ = "_horizontal_j5cmb_31", r_ = "_hover_j5cmb_126", u_ = "_active_j5cmb_127", En = {
  sash: t_,
  disabled: n_,
  mac: i_,
  vertical: a_,
  minimum: l_,
  maximum: o_,
  horizontal: s_,
  hover: r_,
  active: u_
};
var Mi = /* @__PURE__ */ ((e) => (e[e.Vertical = 0] = "Vertical", e[e.Horizontal = 1] = "Horizontal", e))(Mi || {}), il = /* @__PURE__ */ ((e) => (e[e.Disabled = 0] = "Disabled", e[e.Minimum = 1] = "Minimum", e[e.Maximum = 2] = "Maximum", e[e.Enabled = 3] = "Enabled", e))(il || {});
let Jg = Xg ? 20 : 8;
const ep = new _c();
function c_(e) {
  Jg = e, ep.emit("onDidChangeGlobalSize", e);
}
class wf extends _c {
  el;
  layoutProvider;
  orientation;
  size;
  hoverDelay = 300;
  hoverDelayerFunc = (t) => t.classList.add("sash-hover", En.hover);
  hoverDelayer = hk(
    this.hoverDelayerFunc,
    this.hoverDelay
  );
  _state = 3;
  get state() {
    return this._state;
  }
  /**
   * The state of a sash defines whether it can be interacted with by the user
   * as well as what mouse cursor to use, when hovered.
   */
  set state(t) {
    this._state !== t && (this.el.classList.toggle(
      En.disabled,
      t === 0
      /* Disabled */
    ), this.el.classList.toggle(
      "sash-disabled",
      t === 0
      /* Disabled */
    ), this.el.classList.toggle(
      En.minimum,
      t === 1
      /* Minimum */
    ), this.el.classList.toggle(
      "sash-minimum",
      t === 1
      /* Minimum */
    ), this.el.classList.toggle(
      En.maximum,
      t === 2
      /* Maximum */
    ), this.el.classList.toggle(
      "sash-maximum",
      t === 2
      /* Maximum */
    ), this._state = t, this.emit("enablementChange", t));
  }
  constructor(t, n, i) {
    super(), this.el = document.createElement("div"), this.el.classList.add("sash", En.sash), this.el.dataset.testid = "sash", t.append(this.el), Zk && this.el.classList.add("sash-mac", En.mac), this.el.addEventListener("pointerdown", this.onPointerStart), this.el.addEventListener("dblclick", this.onPointerDoublePress), this.el.addEventListener("mouseenter", this.onMouseEnter), this.el.addEventListener("mouseleave", this.onMouseLeave), typeof i.size == "number" ? (this.size = i.size, i.orientation === 0 ? this.el.style.width = `${this.size}px` : this.el.style.height = `${this.size}px`) : (this.size = Jg, ep.on("onDidChangeGlobalSize", (a) => {
      this.size = a, this.layout();
    })), this.layoutProvider = n, this.orientation = i.orientation ?? 0, this.orientation === 1 ? (this.el.classList.add("sash-horizontal", En.horizontal), this.el.classList.remove("sash-vertical", En.vertical)) : (this.el.classList.remove("sash-horizontal", En.horizontal), this.el.classList.add("sash-vertical", En.vertical)), i.skipInitialLayout || this.layout();
  }
  onPointerStart = (t) => {
    const n = t.pageX, i = t.pageY, a = {
      startX: n,
      currentX: n,
      startY: i,
      currentY: i
    };
    this.el.classList.add("sash-active", En.active), this.emit("start", a), this.el.setPointerCapture(t.pointerId);
    const l = (r) => {
      r.preventDefault();
      const c = {
        startX: n,
        currentX: r.pageX,
        startY: i,
        currentY: r.pageY
      };
      this.emit("change", c);
    }, u = (r) => {
      r.preventDefault(), this.el.classList.remove("sash-active", En.active), this.hoverDelayer.cancel(), this.emit("end"), this.el.releasePointerCapture(r.pointerId), globalThis.removeEventListener("pointermove", l), globalThis.removeEventListener("pointerup", u);
    };
    globalThis.addEventListener("pointermove", l), globalThis.addEventListener("pointerup", u);
  };
  onPointerDoublePress = () => {
    this.emit("reset");
  };
  onMouseEnter = () => {
    this.el.classList.contains(En.active) ? (this.hoverDelayer.cancel(), this.el.classList.add("sash-hover", En.hover)) : this.hoverDelayer(this.el);
  };
  onMouseLeave = () => {
    this.hoverDelayer.cancel(), this.el.classList.remove("sash-hover", En.hover);
  };
  /**
   * Layout the sash. The sash will size and position itself
   * based on its provided {@link SashLayoutProvider layout provider}.
   */
  layout() {
    if (this.orientation === 0) {
      const t = this.layoutProvider;
      this.el.style.left = `${t.getVerticalSashLeft(this) - this.size / 2}px`, t.getVerticalSashTop && (this.el.style.top = `${t.getVerticalSashTop(this)}px`), t.getVerticalSashHeight && (this.el.style.height = `${t.getVerticalSashHeight(this)}px`);
    } else {
      const t = this.layoutProvider;
      this.el.style.top = `${t.getHorizontalSashTop(this) - this.size / 2}px`, t.getHorizontalSashLeft && (this.el.style.left = `${t.getHorizontalSashLeft(this)}px`), t.getHorizontalSashWidth && (this.el.style.width = `${t.getHorizontalSashWidth(this)}px`);
    }
  }
  dispose() {
    this.el.removeEventListener("pointerdown", this.onPointerStart), this.el.removeEventListener("dblclick", this.onPointerDoublePress), this.el.removeEventListener("mouseenter", this.onMouseEnter), this.el.removeEventListener("mouseleave", this.onMouseLeave), this.el.remove();
  }
}
const tp = {
  /**
   * When adding or removing views, distribute the delta space among
   * all other views.
   */
  Distribute: { type: "distribute" },
  /**
   * When adding or removing views, split the delta space with another
   * specific view, indexed by the provided `index`.
   */
  Split: (e) => ({ type: "split", index: e }),
  /**
   * When adding or removing views, assume the view is invisible.
   */
  Invisible: (e) => ({ type: "invisible", cachedVisibleSize: e })
};
var nr = /* @__PURE__ */ ((e) => (e[e.Normal = 0] = "Normal", e[e.Low = 1] = "Low", e[e.High = 2] = "High", e))(nr || {});
class np {
  container;
  view;
  _size;
  _cachedVisibleSize = void 0;
  constructor(t, n, i) {
    this.container = t, this.view = n, this.container.classList.add("split-view-view", Ea.splitViewView), this.container.dataset.testid = "split-view-view", typeof i == "number" ? (this._size = i, this._cachedVisibleSize = void 0, t.classList.add("split-view-view-visible")) : (this._size = 0, this._cachedVisibleSize = i.cachedVisibleSize);
  }
  set size(t) {
    this._size = t;
  }
  get size() {
    return this._size;
  }
  get priority() {
    return this.view.priority;
  }
  get snap() {
    return !!this.view.snap;
  }
  get visible() {
    return this._cachedVisibleSize === void 0;
  }
  setVisible(t, n) {
    t !== this.visible && (t ? (this.size = _i(
      this._cachedVisibleSize ?? 0,
      this.view.minimumSize,
      this.view.maximumSize
    ), this._cachedVisibleSize = void 0) : (this._cachedVisibleSize = typeof n == "number" ? n : this.size, this.size = 0), this.container.classList.toggle("split-view-view-visible", t), this.view.setVisible && this.view.setVisible(t));
  }
  get minimumSize() {
    return this.visible ? this.view.minimumSize : 0;
  }
  get maximumSize() {
    return this.visible ? this.view.maximumSize : 0;
  }
  get cachedVisibleSize() {
    return this._cachedVisibleSize;
  }
}
class d_ extends np {
  layout(t) {
    if (!this.visible) {
      this.container.style.height = "0px", this.container.style.top = `${t}px`, this.container.style.left = "0px", this.container.style.width = "100%";
      return;
    }
    this.container.style.top = `${t}px`, this.container.style.height = `${this.size}px`, this.container.style.left = "0px", this.container.style.width = "100%", this.view.layout(this.size, t);
  }
}
class f_ extends np {
  layout(t) {
    if (!this.visible) {
      this.container.style.width = "0px", this.container.style.left = `${t}px`, this.container.style.top = "0px", this.container.style.height = "100%";
      return;
    }
    this.container.style.left = `${t}px`, this.container.style.width = `${this.size}px`, this.container.style.top = "0px", this.container.style.height = "100%", this.view.layout(this.size, t);
  }
}
class h_ extends _c {
  onDidChange;
  onDidDragStart;
  onDidDragEnd;
  _orientation;
  get orientation() {
    return this._orientation;
  }
  set orientation(t) {
    this._orientation = t;
  }
  sashContainer;
  size = 0;
  contentSize = 0;
  proportions = void 0;
  viewItems = [];
  sashItems = [];
  sashDragState;
  _proportionalLayout;
  get proportionalLayout() {
    return this._proportionalLayout;
  }
  set proportionalLayout(t) {
    this._proportionalLayout = t;
  }
  getSashOrthogonalSize;
  _startSnappingEnabled = !0;
  get startSnappingEnabled() {
    return this._startSnappingEnabled;
  }
  set startSnappingEnabled(t) {
    this._startSnappingEnabled !== t && (this._startSnappingEnabled = t, this.updateSashEnablement());
  }
  _endSnappingEnabled = !0;
  get endSnappingEnabled() {
    return this._endSnappingEnabled;
  }
  set endSnappingEnabled(t) {
    this._endSnappingEnabled !== t && (this._endSnappingEnabled = t, this.updateSashEnablement());
  }
  /** Create a new {@link SplitView} instance. */
  constructor(t, n = {}, i, a, l) {
    if (super(), this._orientation = n.orientation ?? Mi.Vertical, this._proportionalLayout = n.proportionalLayout ?? !0, this.getSashOrthogonalSize = n.getSashOrthogonalSize, i && (this.onDidChange = i), a && (this.onDidDragStart = a), l && (this.onDidDragEnd = l), this.sashContainer = document.createElement("div"), this.sashContainer.classList.add("sash-container", Ea.sashContainer), t.prepend(this.sashContainer), n.descriptor) {
      this.size = n.descriptor.size;
      for (const [u, r] of n.descriptor.views.entries()) {
        const c = r.size, g = r.container, y = r.view;
        this.addView(g, y, c, u, !0);
      }
      this.contentSize = this.viewItems.reduce((u, r) => u + r.size, 0), this.saveProportions();
    }
  }
  addView(t, n, i, a = this.viewItems.length, l) {
    let u;
    typeof i == "number" ? u = i : i.type === "split" ? u = this.getViewSize(i.index) / 2 : i.type === "invisible" ? u = { cachedVisibleSize: i.cachedVisibleSize } : u = n.minimumSize;
    const r = this.orientation === Mi.Vertical ? new d_(t, n, u) : new f_(t, n, u);
    if (this.viewItems.splice(a, 0, r), this.viewItems.length > 1) {
      const c = this.orientation === Mi.Vertical ? new wf(
        this.sashContainer,
        {
          getHorizontalSashTop: (v) => this.getSashPosition(v),
          getHorizontalSashWidth: this.getSashOrthogonalSize
        },
        { orientation: Mi.Horizontal }
      ) : new wf(
        this.sashContainer,
        {
          getVerticalSashLeft: (v) => this.getSashPosition(v),
          getVerticalSashHeight: this.getSashOrthogonalSize
        },
        { orientation: Mi.Vertical }
      ), g = this.orientation === Mi.Vertical ? (v) => ({
        sash: c,
        start: v.startY,
        current: v.currentY
      }) : (v) => ({
        sash: c,
        start: v.startX,
        current: v.currentX
      });
      c.on("start", (v) => {
        this.emit("sashDragStart"), this.onSashStart(g(v));
        const m = this.viewItems.map((S) => S.size);
        this.onDidDragStart?.(m);
      }), c.on("change", (v) => this.onSashChange(g(v))), c.on("end", () => {
        this.emit("sashDragEnd");
        let v = this.sashItems.findIndex((S) => S.sash === c);
        if (v === -1) {
          const S = c.el;
          S && (v = this.sashItems.findIndex((T) => T.sash.el === S));
        }
        this.onSashEnd(v);
        const m = this.viewItems.map((S) => S.size);
        this.onDidDragEnd?.(m);
      }), c.on("reset", () => {
        let v = this.sashItems.findIndex((E) => E.sash === c);
        if (v === -1) {
          const E = c.el;
          E && (v = this.sashItems.findIndex((X) => X.sash.el === E));
        }
        const m = li(v, -1, -1), S = li(v + 1, this.viewItems.length), T = this.findFirstSnapIndex(m), C = this.findFirstSnapIndex(S);
        typeof T == "number" && !this.viewItems[T].visible || typeof C == "number" && !this.viewItems[C].visible || this.emit("sashreset", v);
      });
      const y = { sash: c };
      this.sashItems.splice(a - 1, 0, y);
    }
    l || this.relayout(), !l && typeof i != "number" && i.type === "distribute" && this.distributeViewSizes();
  }
  removeView(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    const i = this.viewItems.splice(t, 1)[0].view;
    if (this.viewItems.length > 0) {
      const a = Math.max(t - 1, 0);
      this.sashItems.splice(a, 1)[0].sash.dispose();
    }
    return this.relayout(), n && n.type === "distribute" && this.distributeViewSizes(), i;
  }
  moveView(t, n, i) {
    const a = this.getViewCachedVisibleSize(n), l = a === void 0 ? this.getViewSize(n) : tp.Invisible(a), u = this.removeView(n);
    this.addView(t, u, l, i);
  }
  getViewCachedVisibleSize(t) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    return this.viewItems[t].cachedVisibleSize;
  }
  layout(t = this.size) {
    if (this.viewItems.length === 0)
      return;
    const n = Math.max(this.size, this.contentSize);
    if (this.size = t, this.proportions)
      for (let i = 0; i < this.viewItems.length; i++) {
        const a = this.viewItems[i];
        a && this.proportions[i] !== void 0 && (a.size = _i(
          Math.round(this.proportions[i] * t),
          a.minimumSize,
          a.maximumSize
        ));
      }
    else {
      const i = li(0, this.viewItems.length), a = i.filter(
        (u) => this.viewItems[u] && this.viewItems[u].priority === 1
        /* Low */
      ), l = i.filter(
        (u) => this.viewItems[u] && this.viewItems[u].priority === 2
        /* High */
      );
      this.resize(
        this.viewItems.length - 1,
        t - n,
        void 0,
        a,
        l
      );
    }
    this.distributeEmptySpace(), this.layoutViews();
  }
  resizeView(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      return;
    const i = li(0, this.viewItems.length).filter((r) => r !== t), a = [
      ...i.filter(
        (r) => this.viewItems[r].priority === 1
        /* Low */
      ),
      t
    ], l = i.filter(
      (r) => this.viewItems[r].priority === 2
      /* High */
    ), u = this.viewItems[t];
    n = Math.round(n), n = _i(n, u.minimumSize, Math.min(u.maximumSize, this.size)), u.size = n, this.relayout(a, l);
  }
  resizeViews(t) {
    for (let [n, i] of t.entries()) {
      const a = this.viewItems[n];
      i = Math.round(i), i = _i(
        i,
        a.minimumSize,
        Math.min(a.maximumSize, this.size)
      ), a.size = i;
    }
    this.contentSize = this.viewItems.reduce((n, i) => n + i.size, 0), this.saveProportions(), this.layout(this.size);
  }
  getViewSize(t) {
    return t < 0 || t >= this.viewItems.length ? -1 : this.viewItems[t].size;
  }
  isViewVisible(t) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    return this.viewItems[t].visible;
  }
  setViewVisible(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    this.viewItems[t].setVisible(n), this.emit("sashchange", t), this.distributeEmptySpace(), this.layoutViews(), this.saveProportions();
  }
  distributeViewSizes() {
    const t = [];
    let n = 0;
    for (const r of this.viewItems)
      r.maximumSize - r.minimumSize > 0 && (t.push(r), n += r.size);
    const i = Math.floor(n / t.length);
    for (const r of t)
      r.size = _i(i, r.minimumSize, r.maximumSize);
    const a = li(0, this.viewItems.length), l = a.filter(
      (r) => this.viewItems[r].priority === 1
      /* Low */
    ), u = a.filter(
      (r) => this.viewItems[r].priority === 2
      /* High */
    );
    this.relayout(l, u);
  }
  dispose() {
    for (const t of this.sashItems) t.sash.dispose();
    this.sashItems = [], this.viewItems = [], this.sashContainer && this.sashContainer.parentElement && this.sashContainer.remove();
  }
  onSashStart({ sash: t, start: n, current: i }) {
    let a = this.sashItems.findIndex((T) => T.sash === t);
    if (a === -1) {
      const T = t.el;
      T && (a = this.sashItems.findIndex((C) => C.sash.el === T));
    }
    const l = this.viewItems.map((T) => T.size), u = li(a, -1, -1), r = li(a + 1, this.viewItems.length), c = this.getMinDelta(u, r, l), g = this.getMaxDelta(u, r, l);
    let y, v;
    const m = this.findFirstSnapIndex(u), S = this.findFirstSnapIndex(r);
    if (typeof m == "number") {
      const T = this.viewItems[m], C = Math.floor(T.minimumSize / 2);
      y = {
        index: m,
        limitDelta: T.visible ? c - C : c + C,
        size: T.size
      };
    }
    if (typeof S == "number") {
      const T = this.viewItems[S], C = Math.floor(T.minimumSize / 2);
      v = {
        index: S,
        limitDelta: T.visible ? g + C : g - C,
        size: T.size
      };
    }
    this.sashDragState = {
      index: a,
      start: n,
      current: i,
      sizes: l,
      minDelta: c,
      maxDelta: g,
      snapBefore: y,
      snapAfter: v
    };
  }
  onSashChange({ current: t }) {
    const { index: n, start: i, sizes: a, minDelta: l, maxDelta: u, snapBefore: r, snapAfter: c } = this.sashDragState, g = t - i;
    this.resize(n, g, a, void 0, void 0, l, u, r, c), this.distributeEmptySpace(), this.layoutViews();
  }
  onSashEnd(t) {
    this.emit("sashchange", t), this.sashDragState = void 0, this.saveProportions();
    const n = this.viewItems.map((i) => i.size);
    this.onDidChange?.(n);
  }
  getMinDelta(t, n, i) {
    const a = t.reduce(
      (u, r) => u + (this.viewItems[r].minimumSize - i[r]),
      0
    ), l = n.reduce(
      (u, r) => u + (i[r] - this.viewItems[r].maximumSize),
      0
    );
    return Math.max(a, l);
  }
  getMaxDelta(t, n, i) {
    const a = t.reduce(
      (u, r) => u + (this.viewItems[r].maximumSize - i[r]),
      0
    ), l = n.reduce(
      (u, r) => u + (i[r] - this.viewItems[r].minimumSize),
      0
    );
    return Math.min(l, a);
  }
  resize(t, n, i, a, l, u = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY, c, g) {
    if (t < 0 || t >= this.viewItems.length || this.viewItems.length === 0)
      return 0;
    const y = li(t, -1, -1), v = li(t + 1, this.viewItems.length);
    if (l)
      for (const W of l)
        xf(y, W), xf(v, W);
    if (a)
      for (const W of a)
        ru(y, W), ru(v, W);
    const m = i ?? this.viewItems.map((W) => W?.size || 0), S = y.map((W) => this.viewItems[W]), T = y.map((W) => m[W]), C = v.map((W) => this.viewItems[W]), E = v.map((W) => m[W]), X = y.reduce(
      (W, G) => W + (this.viewItems[G].minimumSize - m[G]),
      0
    ), F = y.reduce(
      (W, G) => W + (this.viewItems[G].maximumSize - m[G]),
      0
    ), V = v.length === 0 ? Number.POSITIVE_INFINITY : v.reduce(
      (W, G) => W + (m[G] - this.viewItems[G].minimumSize),
      0
    ), N = v.length === 0 ? Number.NEGATIVE_INFINITY : v.reduce(
      (W, G) => W + (m[G] - this.viewItems[G].maximumSize),
      0
    ), Y = Math.max(X, N, u), K = Math.min(V, F, r);
    let M = !1;
    if (c) {
      const W = this.viewItems[c.index], G = n >= c.limitDelta;
      M = G !== W.visible, W.setVisible(G, c.size);
    }
    if (!M && g) {
      const W = this.viewItems[g.index], G = n < g.limitDelta;
      M = G !== W.visible, W.setVisible(G, g.size);
    }
    if (M)
      return this.resize(
        t,
        n,
        i,
        a,
        l,
        u,
        r
      );
    n = _i(n, Y, K);
    for (let W = 0, G = n; W < S.length; W++) {
      const Z = S[W];
      if (!Z)
        continue;
      const A = _i(
        T[W] + G,
        Z.minimumSize,
        Z.maximumSize
      ), J = A - T[W];
      G -= J, Z.size = A;
    }
    for (let W = 0, G = n; W < C.length; W++) {
      const Z = C[W];
      if (!Z)
        continue;
      const A = _i(
        E[W] - G,
        Z.minimumSize,
        Z.maximumSize
      ), J = A - E[W];
      G += J, Z.size = A;
    }
    return n;
  }
  distributeEmptySpace(t) {
    if (this.viewItems.length === 0)
      return;
    const n = this.viewItems.reduce((g, y) => g + y.size, 0);
    let i = this.size - n;
    const a = li(0, this.viewItems.length), l = [], u = a.filter(
      (g) => this.viewItems[g].priority === 1
      /* Low */
    ), r = a.filter(
      (g) => this.viewItems[g].priority === 0
      /* Normal */
    ), c = a.filter(
      (g) => this.viewItems[g].priority === 2
      /* High */
    );
    l.push(
      ...c,
      ...r,
      ...u
    ), typeof t == "number" && ru(l, t);
    for (let g = 0; i !== 0 && g < l.length; g++) {
      const y = this.viewItems[l[g]];
      if (!y)
        continue;
      const v = _i(
        y.size + i,
        y.minimumSize,
        y.maximumSize
      ), m = v - y.size;
      i -= m, y.size = v;
    }
    this.contentSize = this.viewItems.reduce((g, y) => g + y.size, 0);
  }
  layoutViews() {
    this.contentSize = this.viewItems.reduce((n, i) => n + i.size, 0);
    let t = 0;
    for (const n of this.viewItems)
      n && (n.layout(t), t += n.size);
    for (const n of this.sashItems) n.sash.layout();
    this.updateSashEnablement();
  }
  saveProportions() {
    this.proportionalLayout && this.contentSize > 0 && (this.proportions = this.viewItems.map((t) => t.size / this.contentSize));
  }
  relayout(t, n) {
    const i = this.viewItems.reduce((a, l) => a + l.size, 0);
    this.resize(
      this.viewItems.length - 1,
      this.size - i,
      void 0,
      t,
      n,
      Number.NEGATIVE_INFINITY,
      Number.POSITIVE_INFINITY
    ), this.distributeEmptySpace(), this.layoutViews(), this.saveProportions();
  }
  getSashPosition(t) {
    let n = -1;
    for (let a = 0; a < this.sashItems.length; a++)
      if (this.sashItems[a].sash === t) {
        n = a;
        break;
      }
    if (n === -1) {
      const a = t.el || t;
      if (a) {
        for (let l = 0; l < this.sashItems.length; l++)
          if ((this.sashItems[l].sash.el || this.sashItems[l].sash) === a) {
            n = l;
            break;
          }
      }
    }
    if (n === -1)
      return 0;
    let i = 0;
    for (let a = 0; a <= n; a++)
      this.viewItems[a] && (i += this.viewItems[a].size);
    return i;
  }
  findFirstSnapIndex(t) {
    for (const n of t) {
      const i = this.viewItems[n];
      if (i.visible && i.snap)
        return n;
    }
    for (const n of t) {
      const i = this.viewItems[n];
      if (i.visible && i.maximumSize - i.minimumSize > 0)
        return;
      if (!i.visible && i.snap)
        return n;
    }
  }
  updateSashEnablement() {
    let t = !1;
    const n = this.viewItems.map(
      (c) => t = c.size - c.minimumSize > 0 || t
    );
    t = !1;
    const i = this.viewItems.map(
      (c) => t = c.maximumSize - c.size > 0 || t
    ), a = [...this.viewItems].toReversed();
    t = !1;
    const l = a.map((c) => t = c.size - c.minimumSize > 0 || t).toReversed();
    t = !1;
    const u = a.map((c) => t = c.maximumSize - c.size > 0 || t).toReversed();
    let r = 0;
    for (let c = 0; c < this.sashItems.length; c++) {
      const { sash: g } = this.sashItems[c], y = this.viewItems[c];
      r += y.size;
      const v = !(n[c] && u[c + 1]), m = !(i[c] && l[c + 1]);
      if (v && m) {
        const S = li(c, -1, -1), T = li(c + 1, this.viewItems.length), C = this.findFirstSnapIndex(S), E = this.findFirstSnapIndex(T), X = typeof C == "number" && !this.viewItems[C].visible, F = typeof E == "number" && !this.viewItems[E].visible;
        X && l[c] && (r > 0 || this.startSnappingEnabled) ? g.state = il.Minimum : F && n[c] && (r < this.contentSize || this.endSnappingEnabled) ? g.state = il.Maximum : g.state = il.Disabled;
      } else v && !m ? g.state = il.Minimum : !v && m ? g.state = il.Maximum : g.state = il.Enabled;
    }
  }
}
class Rl {
  size;
  constructor(t) {
    this.size = t;
  }
  getPreferredSize() {
    return this.size;
  }
}
class Sf {
  proportion;
  layoutService;
  constructor(t, n) {
    this.proportion = t, this.layoutService = n;
  }
  getPreferredSize() {
    return this.proportion * this.layoutService.getSize();
  }
}
class Es {
  getPreferredSize() {
  }
}
class kf {
  minimumSize = 0;
  maximumSize = Number.POSITIVE_INFINITY;
  element;
  priority;
  snap;
  layoutService;
  layoutStrategy;
  get preferredSize() {
    return this.layoutStrategy.getPreferredSize();
  }
  set preferredSize(t) {
    if (typeof t == "number")
      this.layoutStrategy = new Rl(t);
    else if (typeof t == "string") {
      const n = t.trim();
      if (Is(n, "%")) {
        const i = Number(n.slice(0, -1)) / 100;
        this.layoutStrategy = new Sf(
          i,
          this.layoutService
        );
      } else if (Is(n, "px")) {
        const i = Number(n.slice(0, -2));
        this.layoutStrategy = new Rl(i);
      } else if (typeof Number.parseFloat(n) == "number") {
        const i = Number.parseFloat(n);
        this.layoutStrategy = new Rl(i);
      } else
        this.layoutStrategy = new Es();
    } else
      this.layoutStrategy = new Es();
  }
  constructor(t, n) {
    if (this.layoutService = t, this.element = n.element, this.snap = typeof n.snap == "boolean" ? n.snap : !1, this.minimumSize = this.snap ? 0 : typeof n.minimumSize == "number" ? n.minimumSize : 30, this.maximumSize = typeof n.maximumSize == "number" ? n.maximumSize : Number.POSITIVE_INFINITY, typeof n.preferredSize == "number")
      this.layoutStrategy = new Rl(n.preferredSize);
    else if (typeof n.preferredSize == "string") {
      const i = n.preferredSize.trim();
      if (Is(i, "%")) {
        const a = Number(i.slice(0, -1)) / 100;
        this.layoutStrategy = new Sf(
          a,
          this.layoutService
        );
      } else if (Is(i, "px")) {
        const a = Number(i.slice(0, -2));
        this.layoutStrategy = new Rl(a);
      } else if (typeof Number.parseFloat(i) == "number") {
        const a = Number.parseFloat(i);
        this.layoutStrategy = new Rl(a);
      } else
        this.layoutStrategy = new Es();
    } else
      this.layoutStrategy = new Es();
    this.priority = n.priority ?? nr.Normal;
  }
  layout(t) {
  }
}
function g_(e) {
  const t = _i(e, 4, 20), n = _i(e, 1, 8);
  document.documentElement.style.setProperty("--sash-size", `${t}px`), document.documentElement.style.setProperty(
    "--sash-hover-size",
    `${n}px`
  ), c_(t);
}
const p_ = ["id"], m_ = /* @__PURE__ */ ze({
  __name: "Allotment",
  props: {
    className: { default: "" },
    defaultSizes: {},
    id: {},
    maxSize: { default: 1 / 0 },
    minSize: { default: 30 },
    proportionalLayout: { type: Boolean, default: !0 },
    separator: { type: Boolean, default: !0 },
    snap: { type: Boolean, default: !1 },
    sizes: {},
    vertical: { type: Boolean, default: !1 }
  },
  emits: ["change", "reset", "visibleChange", "dragStart", "dragEnd"],
  setup(e, { expose: t, emit: n }) {
    const i = e, a = n, l = pe(), u = pe(), r = pe(!1), c = pe(null), g = La(/* @__PURE__ */ new Map()), y = La(/* @__PURE__ */ new Map()), v = pe(new Qk()), m = pe([]), S = pe([]), T = pe(null), C = bp();
    fl("allotment", {
      registerPane: (M, W, G) => {
        g.set(M, W), y.set(M, G), r.value && Un(() => {
          Y();
        });
      },
      unregisterPane: (M) => {
        g.delete(M), y.delete(M);
      },
      registerNonPane: (M, W) => {
        g.set(M, W), y.set(M, {});
      }
    });
    const E = oe(() => {
      const M = C.default?.({}) || [], W = (G) => {
        const Z = [];
        for (const A of G)
          Array.isArray(A.children) ? Z.push(...W(A.children)) : A.type && Z.push(A);
        return Z;
      };
      return W(M);
    });
    function X(M) {
      const W = m.value?.[M];
      return typeof W?.preferredSize != "number" ? !1 : (c.value?.resizeView(M, Math.round(W.preferredSize)), !0);
    }
    function F() {
      if (a("reset"), !!c.value) {
        c.value.distributeViewSizes();
        for (let M = 0; M < m.value.length; M++)
          X(M);
      }
    }
    function V(M) {
      c.value?.resizeViews(M);
    }
    t({
      reset: F,
      resize: V
    });
    function N() {
      if (!l.value)
        return;
      let M = !0;
      i.defaultSizes && g.size !== i.defaultSizes.length && (M = !1, console.warn(
        `Expected ${i.defaultSizes.length} children based on defaultSizes but found ${g.size}`
      ));
      const W = i.vertical ? l.value.clientHeight : l.value.clientWidth;
      v.value.setSize(W);
      let G = i.defaultSizes;
      if (!i.defaultSizes && g.size > 0) {
        const A = Math.floor(W / g.size);
        G = Array.from({ length: g.size }, () => A), G[G.length - 1] += W - A * g.size, M = !0, S.value = E.value.map(
          (J) => J.key
        );
      } else if (i.defaultSizes) {
        const A = i.defaultSizes.reduce((J, ee) => J + ee, 0);
        if (W > 0 && A > 0 && Math.abs(W - A) > 1) {
          const J = W / A;
          G = i.defaultSizes.map((ee) => Math.round(ee * J));
        }
        S.value = E.value.map(
          (J) => J.key
        );
      }
      m.value = [];
      const Z = {
        orientation: i.vertical ? Mi.Vertical : Mi.Horizontal,
        proportionalLayout: i.proportionalLayout,
        ...M && G && {
          descriptor: {
            size: G.reduce((A, J) => A + J, 0),
            views: G.map((A, J) => {
              const ee = [...g.keys()][J], I = y.get(ee), $ = new kf(v.value, {
                element: document.createElement("div"),
                minimumSize: I?.minSize ?? i.minSize,
                maximumSize: I?.maxSize ?? i.maxSize,
                priority: I?.priority ?? nr.Normal,
                ...I?.preferredSize && {
                  preferredSize: I?.preferredSize
                },
                snap: I?.snap ?? i.snap
              });
              return m.value.push($), {
                container: [...g.values()][J],
                size: A,
                view: $
              };
            })
          }
        }
      };
      if (c.value = new h_(
        l.value,
        Z,
        (A) => a("change", A),
        (A) => a("dragStart", A),
        (A) => a("dragEnd", A)
      ), c.value.on("sashDragStart", () => {
        l.value?.classList.add("split-view-sash-dragging");
      }), c.value.on("sashDragEnd", () => {
        l.value?.classList.remove("split-view-sash-dragging");
      }), c.value.on("sashchange", (A) => {
        if (c.value) {
          const J = E.value.map((ee) => ee.key);
          for (const [ee, I] of J.entries()) {
            const $ = y.get(I);
            $?.visible !== void 0 && $.visible !== c.value.isViewVisible(ee) && a("visibleChange", ee, c.value.isViewVisible(ee));
          }
        }
      }), c.value?.on("sashreset", (A) => {
        a("reset"), !X(A) && (X(A + 1) || c.value?.distributeViewSizes());
      }), W > 0) {
        c.value.layout(W);
        for (let A = 0; A < m.value.length; A++)
          X(A);
      }
    }
    function Y() {
      if (!r.value || !c.value)
        return;
      const M = E.value.map((J) => J.key), W = [...S.value], G = M.filter((J) => !S.value.includes(J)), Z = M.filter((J) => S.value.includes(J)), A = S.value.map((J, ee) => ({ key: J, index: ee, shouldExit: !M.includes(J) }));
      for (let J = A.length - 1; J >= 0; J--)
        A[J].shouldExit && (c.value.removeView(A[J].index), W.splice(A[J].index, 1), m.value.splice(A[J].index, 1));
      for (const J of G) {
        const ee = y.get(J), I = new kf(v.value, {
          element: document.createElement("div"),
          minimumSize: ee?.minSize ?? i.minSize,
          maximumSize: ee?.maxSize ?? i.maxSize,
          priority: ee?.priority ?? nr.Normal,
          ...ee?.preferredSize && {
            preferredSize: ee?.preferredSize
          },
          snap: ee?.snap ?? i.snap
        }), $ = M.indexOf(J);
        c.value.addView(
          g.get(J),
          I,
          tp.Distribute,
          $
        ), W.splice($, 0, J), m.value.splice($, 0, I);
      }
      for (; !Vk(M, W); )
        for (const [J, ee] of M.entries()) {
          const I = W.indexOf(ee);
          if (I !== J) {
            c.value.moveView(
              g.get(ee),
              I,
              J
            );
            const $ = W[I];
            W.splice(I, 1), W.splice(J, 0, $);
            const le = m.value[I];
            m.value.splice(I, 1), m.value.splice(J, 0, le);
            break;
          }
        }
      for (const J of [...G, ...Z]) {
        const ee = y.get(J), I = M.indexOf(J);
        if (ee) {
          ee.visible !== void 0 && c.value.isViewVisible(I) !== ee.visible && c.value.setViewVisible(I, ee.visible), ee.preferredSize !== void 0 && m.value[I].preferredSize !== ee.preferredSize && (m.value[I].preferredSize = ee.preferredSize, X(I));
          let $ = !1;
          ee.minSize !== void 0 && m.value[I].minimumSize !== ee.minSize && (m.value[I].minimumSize = ee.minSize, $ = !0), ee.maxSize !== void 0 && m.value[I].maximumSize !== ee.maxSize && (m.value[I].maximumSize = ee.maxSize, $ = !0), $ && c.value.layout();
        }
      }
      (G.length > 0 || A.some((J) => J.shouldExit)) && (S.value = M);
    }
    function K() {
      l.value && (T.value = new ResizeObserver(() => {
        if (l.value) {
          const M = i.vertical ? l.value.clientHeight : l.value.clientWidth;
          M > 0 && (c.value?.layout(M), v.value.setSize(M), r.value || (r.value = !0));
        }
      }), T.value.observe(l.value));
    }
    return Nn(() => {
      Xg && g_(20), Un(() => {
        N(), K(), setTimeout(() => {
          if (l.value && c.value) {
            const M = i.vertical ? l.value.clientHeight : l.value.clientWidth;
            M > 0 && c.value.layout(M);
          }
        }, 50);
      });
    }), Ye(E, () => {
      Un(() => {
        Y();
      });
    }, { deep: !0 }), Ye(() => i.vertical, (M) => {
      c.value && (c.value.orientation = M ? Mi.Vertical : Mi.Horizontal, c.value.layout());
    }), Ye(() => i.proportionalLayout, (M) => {
      c.value && (c.value.proportionalLayout = M);
    }), Fa(() => {
      T.value?.disconnect(), c.value?.dispose();
    }), (M, W) => (O(), j("div", {
      id: M.id,
      ref_key: "containerRef",
      ref: l,
      class: Re(["split-view", [
        M.vertical ? "split-view-vertical" : "split-view-horizontal",
        { "split-view-separator-border": M.separator },
        f(Ea).splitView,
        M.vertical ? f(Ea).vertical : f(Ea).horizontal,
        { [f(Ea).separatorBorder]: M.separator },
        M.className
      ]])
    }, [
      b("div", {
        ref_key: "splitViewContainerRef",
        ref: u,
        class: Re(["split-view-container", [f(Ea).splitViewContainer]])
      }, [
        An(M.$slots, "default", {}, void 0, !0)
      ], 2)
    ], 10, p_));
  }
}), v_ = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, a] of t)
    n[i] = a;
  return n;
}, _f = /* @__PURE__ */ v_(m_, [["__scopeId", "data-v-e77a1ca4"]]), $s = /* @__PURE__ */ ze({
  __name: "Pane",
  props: {
    className: { default: "" },
    maxSize: {},
    minSize: {},
    snap: { type: Boolean, default: !1 },
    preferredSize: {},
    priority: {},
    visible: { type: Boolean, default: !0 }
  },
  setup(e, { expose: t }) {
    const n = e, i = pe(), a = yp(), l = dl("allotment");
    function u() {
      return a?.vnode.key || `pane-${Math.random().toString(36).slice(2, 11)}`;
    }
    const r = u();
    return Nn(() => {
      l && i.value && l.registerPane(r, i.value, {
        minSize: n.minSize,
        maxSize: n.maxSize,
        preferredSize: n.preferredSize,
        priority: n.priority,
        snap: n.snap,
        visible: n.visible
      });
    }), Ye(() => n, (c) => {
      l && i.value && l.registerPane(r, i.value, {
        minSize: c.minSize,
        maxSize: c.maxSize,
        preferredSize: c.preferredSize,
        priority: c.priority,
        snap: c.snap,
        visible: c.visible
      });
    }, { deep: !0 }), Fa(() => {
      l && l.unregisterPane(r);
    }), t({
      element: i
    }), (c, g) => (O(), j("div", {
      ref_key: "paneRef",
      ref: i,
      class: Re(["split-view-view", [
        c.visible && "split-view-view-visible",
        f(Ea).splitViewView,
        c.className
      ]])
    }, [
      An(c.$slots, "default")
    ], 2));
  }
}), y_ = { class: "flex flex-col gap-3" }, b_ = { class: "text-xs text-secondary mb-1" }, x_ = { class: "text-xs text-secondary mb-1" }, w_ = { class: "text-xs text-secondary mb-1" }, S_ = { class: "text-xs text-secondary mb-1" }, k_ = { class: "text-xs text-secondary mb-1" }, __ = { class: "text-xs text-secondary mb-1" }, C_ = ["value"], M_ = { class: "text-xs text-secondary mb-1" }, T_ = { class: "text-xs text-secondary mb-1" }, z_ = { class: "text-xs text-secondary mb-1" }, D_ = { class: "text-xs text-secondary mb-1" }, O_ = { class: "text-xs text-secondary mb-1" }, P_ = { class: "text-xs text-secondary mb-1" }, I_ = ["value"], E_ = { class: "text-xs text-secondary mb-1" }, $_ = { class: "text-xs text-secondary mb-1" }, A_ = { key: 0 }, N_ = { class: "text-xs text-secondary mb-1" }, R_ = ["value"], L_ = { class: "text-xs text-secondary mb-1" }, q_ = /* @__PURE__ */ ze({
  __name: "AxesSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = st();
    return (n, i) => {
      const a = ht("a-radio-button"), l = ht("a-radio-group"), u = ht("a-switch");
      return O(), j("div", y_, [
        b("div", null, [
          b("div", b_, P(f(t)("config.field.axisPlacement")), 1),
          _(l, {
            size: "small",
            value: e.panel.axisPlacement ?? "left",
            onChange: i[0] || (i[0] = (r) => e.onChange({ axisPlacement: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "left" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.placement.left")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "right" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.placement.right")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "hidden" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.placement.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", x_, P(f(t)("config.field.axisLabel")), 1),
          _(f(it), {
            size: "small",
            value: e.panel.axisLabel ?? "",
            placeholder: f(t)("config.axis.label.placeholder"),
            onChange: i[1] || (i[1] = (r) => e.onChange({ axisLabel: r.target.value }))
          }, null, 8, ["value", "placeholder"])
        ]),
        b("div", null, [
          b("div", w_, P(f(t)("config.field.axisName")), 1),
          _(f(it), {
            size: "small",
            value: e.panel.axisName ?? "",
            placeholder: f(t)("config.axis.name.placeholder"),
            onChange: i[2] || (i[2] = (r) => e.onChange({ axisName: r.target.value }))
          }, null, 8, ["value", "placeholder"])
        ]),
        b("div", null, [
          b("div", S_, P(f(t)("config.field.axisWidth")), 1),
          _(f(yn), {
            size: "small",
            value: e.panel.axisWidth ?? void 0,
            min: 20,
            max: 300,
            style: { width: "100%" },
            onChange: i[3] || (i[3] = (r) => e.onChange({ axisWidth: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", k_, P(f(t)("config.field.showGridLines")), 1),
          _(l, {
            size: "small",
            value: e.panel.showGridLines ?? "all",
            onChange: i[4] || (i[4] = (r) => e.onChange({ showGridLines: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "all" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "x" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.x")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "y" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.y")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "hidden" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", __, P(f(t)("config.field.gridColor")), 1),
          b("input", {
            type: "color",
            value: e.panel.gridColor ?? "#e8e8e8",
            onInput: i[5] || (i[5] = (r) => e.onChange({ gridColor: r.target.value }))
          }, null, 40, C_)
        ]),
        b("div", null, [
          b("div", M_, P(f(t)("config.field.scaleDistribution")), 1),
          _(l, {
            size: "small",
            value: e.panel.scaleDistribution ?? "linear",
            onChange: i[6] || (i[6] = (r) => e.onChange({ scaleDistribution: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "linear" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.scale.linear")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "logarithmic" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.scale.logarithmic")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", T_, P(f(t)("config.field.softMin")), 1),
          _(f(yn), {
            size: "small",
            value: e.panel.softMin ?? void 0,
            style: { width: "100%" },
            onChange: i[7] || (i[7] = (r) => e.onChange({ softMin: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", z_, P(f(t)("config.field.softMax")), 1),
          _(f(yn), {
            size: "small",
            value: e.panel.softMax ?? void 0,
            style: { width: "100%" },
            onChange: i[8] || (i[8] = (r) => e.onChange({ softMax: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", D_, P(f(t)("config.field.centeredZero")), 1),
          _(u, {
            size: "small",
            checked: e.panel.centeredZero,
            onChange: i[9] || (i[9] = (r) => e.onChange({ centeredZero: r }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", O_, P(f(t)("config.field.axisLine")), 1),
          _(l, {
            size: "small",
            value: e.panel.axisLabel ?? "all",
            onChange: i[10] || (i[10] = (r) => e.onChange({ axisLabel: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "all" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "x" }, {
                default: q(() => [...i[16] || (i[16] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              _(a, { value: "y" }, {
                default: q(() => [...i[17] || (i[17] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              _(a, { value: "hidden" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", P_, P(f(t)("config.field.axisLineColor")), 1),
          b("input", {
            type: "color",
            value: e.panel.axisLabelColor ?? "#666666",
            onInput: i[11] || (i[11] = (r) => e.onChange({ axisLabelColor: r.target.value }))
          }, null, 40, I_)
        ]),
        b("div", null, [
          b("div", E_, P(f(t)("config.field.axisTickShow")), 1),
          _(l, {
            size: "small",
            value: e.panel.axisTick ?? "hidden",
            onChange: i[12] || (i[12] = (r) => e.onChange({ axisTick: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "all" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "x" }, {
                default: q(() => [...i[18] || (i[18] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              _(a, { value: "y" }, {
                default: q(() => [...i[19] || (i[19] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              _(a, { value: "hidden" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", $_, P(f(t)("config.field.axisBorder")), 1),
          _(l, {
            size: "small",
            value: e.panel.axisBorder ?? "hidden",
            onChange: i[13] || (i[13] = (r) => e.onChange({ axisBorder: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "all" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "x" }, {
                default: q(() => [...i[20] || (i[20] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              _(a, { value: "y" }, {
                default: q(() => [...i[21] || (i[21] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              _(a, { value: "hidden" }, {
                default: q(() => [
                  ce(P(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.axisBorder && e.panel.axisBorder !== "hidden" ? (O(), j("div", A_, [
          b("div", N_, P(f(t)("config.field.axisBorderColor")), 1),
          b("input", {
            type: "color",
            value: e.panel.axisBorderColor ?? "#cccccc",
            onInput: i[14] || (i[14] = (r) => e.onChange({ axisBorderColor: r.target.value }))
          }, null, 40, R_)
        ])) : be("", !0),
        b("div", null, [
          b("div", L_, P(f(t)("config.field.logScale")), 1),
          _(u, {
            size: "small",
            checked: e.panel.scaleDistribution === "logarithmic",
            onChange: i[15] || (i[15] = (r) => e.onChange({ scaleDistribution: r ? "logarithmic" : "linear" }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), F_ = { class: "flex flex-col gap-3" }, V_ = { class: "text-xs text-secondary mb-1" }, W_ = { class: "text-xs text-secondary mb-1" }, Y_ = { class: "text-xs text-secondary mb-1" }, B_ = { class: "text-xs text-secondary mb-1" }, H_ = { class: "text-xs text-secondary mb-1" }, j_ = { class: "text-xs text-secondary mb-1" }, U_ = { class: "text-xs text-secondary mb-1" }, G_ = /* @__PURE__ */ ze({
  __name: "BarStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = st();
    return (n, i) => {
      const a = ht("a-radio-button"), l = ht("a-radio-group"), u = ht("a-switch"), r = ht("a-input-number");
      return O(), j("div", F_, [
        b("div", null, [
          b("div", V_, P(f(t)("config.field.barShowValues")), 1),
          _(l, {
            size: "small",
            value: e.panel.barShowValues ?? "auto",
            onChange: i[0] || (i[0] = (c) => e.onChange({ barShowValues: c.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "auto" }, {
                default: q(() => [
                  ce(P(f(t)("config.showValues.auto")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "always" }, {
                default: q(() => [
                  ce(P(f(t)("config.showValues.always")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "never" }, {
                default: q(() => [
                  ce(P(f(t)("config.showValues.never")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", W_, P(f(t)("config.field.barGroupWidth")), 1),
          _(f(Fn), {
            min: 0.1,
            max: 1,
            step: 0.05,
            value: e.panel.barGroupWidth ?? 0.7,
            onChange: i[1] || (i[1] = (c) => e.onChange({ barGroupWidth: c }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", Y_, P(f(t)("config.field.barWidth")), 1),
          _(f(Fn), {
            min: 0.1,
            max: 1,
            step: 0.05,
            value: e.panel.barWidth ?? 1,
            onChange: i[2] || (i[2] = (c) => e.onChange({ barWidth: c }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", B_, P(f(t)("config.field.stacked")), 1),
          _(u, {
            size: "small",
            checked: e.panel.stacked,
            onChange: i[3] || (i[3] = (c) => e.onChange({ stacked: c }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", H_, P(f(t)("config.field.lineWidth")), 1),
          _(r, {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.lineWidth,
            style: { width: "100%" },
            onChange: i[4] || (i[4] = (c) => e.onChange({ lineWidth: c ?? 1 }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", j_, P(f(t)("config.field.fillOpacity")), 1),
          _(f(Fn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: i[5] || (i[5] = (c) => e.onChange({ fillOpacity: c }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", U_, P(f(t)("config.field.xTickRotation")), 1),
          _(u, {
            size: "small",
            checked: e.panel.barXTickRotation ?? !1,
            onChange: i[6] || (i[6] = (c) => e.onChange({ barXTickRotation: c }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), K_ = { class: "flex flex-col gap-3" }, Z_ = { class: "text-xs text-secondary mb-1" }, Q_ = { class: "text-xs text-secondary mb-1" }, X_ = { class: "text-xs text-secondary mb-1" }, J_ = ["value"], eC = { class: "text-xs text-secondary mb-1" }, tC = { class: "text-xs text-secondary mb-1" }, nC = { class: "text-xs text-secondary mb-1" }, iC = { class: "text-xs text-secondary mb-1" }, aC = { class: "text-xs text-secondary mb-1" }, lC = { key: 0 }, oC = { class: "text-xs text-secondary mb-1" }, sC = ["value"], rC = { class: "text-xs text-secondary mb-1" }, uC = { class: "text-xs text-secondary mb-1" }, cC = { class: "text-xs text-secondary mb-1" }, dC = { class: "text-xs text-secondary mb-1" }, fC = { class: "text-xs text-secondary mb-1" }, hC = { class: "text-xs text-secondary mb-1" }, gC = /* @__PURE__ */ ze({
  __name: "GaugeStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = st();
    return (n, i) => {
      const a = ht("a-switch"), l = ht("a-radio-button"), u = ht("a-radio-group");
      return O(), j("div", K_, [
        b("div", null, [
          b("div", Z_, P(f(t)("config.gauge.fillWidth")), 1),
          _(f(Fn), {
            min: 1,
            max: 100,
            value: e.panel.gaugeFillWidth ?? f(Nt).fillWidth,
            onChange: i[0] || (i[0] = (r) => e.onChange({ gaugeFillWidth: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", Q_, P(f(t)("config.gauge.trackWidth")), 1),
          _(f(Fn), {
            min: 1,
            max: 100,
            value: e.panel.gaugeTrackWidth ?? f(Nt).trackWidth,
            onChange: i[1] || (i[1] = (r) => e.onChange({ gaugeTrackWidth: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", X_, P(f(t)("config.gauge.trackColor")), 1),
          b("input", {
            type: "color",
            value: e.panel.gaugeTrackColor ?? "#222222",
            onInput: i[2] || (i[2] = (r) => e.onChange({ gaugeTrackColor: r.target.value }))
          }, null, 40, J_)
        ]),
        b("div", null, [
          b("div", eC, P(f(t)("config.gauge.arcSweep")), 1),
          _(f(Fn), {
            min: 30,
            max: 360,
            value: e.panel.sweepAngle ?? f(Nt).sweepAngle,
            onChange: i[3] || (i[3] = (r) => e.onChange({ sweepAngle: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", tC, P(f(t)("config.gauge.paddingX")), 1),
          _(f(Fn), {
            min: 0,
            max: 0.5,
            step: 0.01,
            value: e.panel.gaugePaddingX ?? 0.05,
            onChange: i[4] || (i[4] = (r) => e.onChange({ gaugePaddingX: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", nC, P(f(t)("config.gauge.paddingY")), 1),
          _(f(Fn), {
            min: 0,
            max: 0.5,
            step: 0.01,
            value: e.panel.gaugePaddingY ?? 0.1,
            onChange: i[5] || (i[5] = (r) => e.onChange({ gaugePaddingY: r }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", iC, P(f(t)("config.gauge.capRound")), 1),
          _(a, {
            size: "small",
            checked: e.panel.gaugeCapRound ?? f(Nt).capRound,
            onChange: i[6] || (i[6] = (r) => e.onChange({ gaugeCapRound: r }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", aC, P(f(t)("config.gauge.valueVisible")), 1),
          _(a, {
            size: "small",
            checked: e.panel.gaugeValueVisible ?? f(Nt).valueVisible,
            onChange: i[7] || (i[7] = (r) => e.onChange({ gaugeValueVisible: r }))
          }, null, 8, ["checked"])
        ]),
        e.panel.gaugeValueVisible !== !1 ? (O(), j("div", lC, [
          b("div", oC, P(f(t)("config.gauge.valueColor")), 1),
          b("input", {
            type: "color",
            value: e.panel.gaugeValueColor ?? "#ffffff",
            onInput: i[8] || (i[8] = (r) => e.onChange({ gaugeValueColor: r.target.value }))
          }, null, 40, sC)
        ])) : be("", !0),
        b("div", null, [
          b("div", rC, P(f(t)("config.gauge.valueSize")), 1),
          _(f(yn), {
            size: "small",
            min: 8,
            max: 80,
            value: e.panel.gaugeValueSize ?? f(Nt).valueSize,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[9] || (i[9] = (r) => e.onChange({ gaugeValueSize: r ?? f(Nt).valueSize }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", uC, P(f(t)("config.gauge.valueOffsetY")), 1),
          _(f(yn), {
            size: "small",
            min: -50,
            max: 50,
            value: e.panel.gaugeValueOffsetY ?? f(Nt).valueOffsetY,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[10] || (i[10] = (r) => e.onChange({ gaugeValueOffsetY: r ?? f(Nt).valueOffsetY }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", cC, P(f(t)("config.gauge.colorFromScheme")), 1),
          _(a, {
            size: "small",
            checked: e.panel.gaugeColorFromScheme ?? !1,
            onChange: i[11] || (i[11] = (r) => e.onChange({ gaugeColorFromScheme: r }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", dC, P(f(t)("config.gauge.thresholdDisplay")), 1),
          _(u, {
            size: "small",
            value: e.panel.gaugeThresholdDisplay ?? f(Nt).thresholdDisplay,
            onChange: i[12] || (i[12] = (r) => e.onChange({ gaugeThresholdDisplay: r.target.value }))
          }, {
            default: q(() => [
              _(l, { value: "none" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdDisplayNone")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "marker" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdDisplayMarker")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "track" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdDisplayTrack")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", fC, P(f(t)("config.gauge.thresholdLabelDisplay")), 1),
          _(u, {
            size: "small",
            value: e.panel.gaugeThresholdLabelDisplay ?? "none",
            onChange: i[13] || (i[13] = (r) => e.onChange({ gaugeThresholdLabelDisplay: r.target.value }))
          }, {
            default: q(() => [
              _(l, { value: "none" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdLabelNone")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "label" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdLabelLabel")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "value" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdLabelValue")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "both" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.thresholdLabelBoth")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", hC, P(f(t)("config.gauge.orientation")), 1),
          _(u, {
            size: "small",
            value: e.panel.gaugeOrientation ?? f(Nt).orientation,
            onChange: i[14] || (i[14] = (r) => e.onChange({ gaugeOrientation: r.target.value }))
          }, {
            default: q(() => [
              _(l, { value: "auto" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.orientationAuto")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "horizontal" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.orientationHorizontal")), 1)
                ]),
                _: 1
              }),
              _(l, { value: "vertical" }, {
                default: q(() => [
                  ce(P(f(t)("config.gauge.orientationVertical")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])
      ]);
    };
  }
}), De = {
  // Actions
  edit: "i-carbon:edit",
  delete: "i-carbon:trash-can",
  clone: "i-carbon:stickies ",
  plus: "i-carbon:add-large",
  save: "i-mdi-content-save",
  cancel: "i-mdi-cancel",
  refresh: "i-carbon:renew",
  download: "i-carbon:download",
  upload: "i-carbon:upload",
  export: "i-carbon:export",
  import: "i-carbon:document-import",
  search: "i-mdi-magnify",
  settings: "i-carbon:settings",
  config: "i-carbon:settings-adjust",
  link: "i-mdi-link",
  // Navigation
  fullscreen: "i-carbon:center-to-fit",
  chevronDown: "i-carbon:chevron-down",
  chevronRight: "i-carbon:chevron-right",
  dotsVertical: "i-mdi-dots-vertical",
  dragVertical: "i-carbon:draggable",
  closeCircle: "i-mdi-close-circle",
  chevronLeft: "i-carbon:chevron-left",
  // Info
  info: "i-carbon:information",
  // view
  view: "i-carbon:view",
  viewOff: "i-carbon:view-off",
  // Theme
  sun: "i-mdi-white-balance-sunny",
  moon: "i-mdi-weather-night",
  // Panel types
  chartLine: "i-mdi-chart-line",
  chartBar: "i-mdi-chart-bar",
  chartArea: "i-mdi-chart-areaspline",
  chartPie: "i-mdi-chart-pie",
  stat: "i-mdi-format-list-numbered",
  gauge: "i-mdi-alarm-panel",
  table: "i-mdi-table",
  databaseOff: "i-mdi-database-off"
}, pC = { class: "inline-flex gap-0.5 items-center" }, mC = /* @__PURE__ */ ze({
  __name: "PaletteSwatches",
  props: {
    colors: {}
  },
  setup(e) {
    return (t, n) => (O(), j("span", pC, [
      (O(!0), j(Oe, null, et(e.colors, (i, a) => (O(), j("span", {
        key: `${i}-${a}`,
        class: "inline-block rounded-sm flex-shrink-0",
        style: Ue({ width: "12px", height: "12px", background: i })
      }, null, 4))), 128))
    ]));
  }
}), vC = [
  { value: "classic", colors: Ra.slice(0, 8) },
  { value: "tableau10", colors: oi.tableau10.slice(0, 8) },
  { value: "grafana-classic", colors: oi["grafana-classic"].slice(0, 8) },
  { value: "green-yellow-red", colors: oi["green-yellow-red"] },
  { value: "red-yellow-green", colors: oi["red-yellow-green"] },
  { value: "blue-yellow-red", colors: oi["blue-yellow-red"] },
  { value: "blue-purple", colors: oi["blue-purple"] },
  { value: "yellow-blue", colors: oi["yellow-blue"] },
  { value: "blues", colors: oi.blues },
  { value: "reds", colors: oi.reds },
  { value: "GrYlRd", colors: oi.GrYlRd },
  { value: "purple-orange", colors: oi["purple-orange"] },
  { value: "fixed", colors: [] },
  { value: "thresholds", colors: [] }
], yC = { class: "flex flex-col gap-3" }, bC = { class: "text-xs text-secondary mb-1" }, xC = { class: "text-xs text-secondary mb-1" }, wC = { class: "text-xs text-secondary mb-1" }, SC = { class: "inline-flex items-center gap-1.5" }, kC = { key: 0 }, _C = { class: "text-xs text-secondary mb-1" }, CC = ["value"], MC = { key: 1 }, TC = { class: "text-xs text-secondary mb-1" }, zC = { class: "text-xs text-secondary mb-1" }, DC = { class: "flex gap-1 items-center" }, OC = { class: "flex items-center gap-1" }, PC = { class: "text-xs text-secondary" }, Cf = /* @__PURE__ */ ze({
  __name: "GeneralSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st(), i = vC.map((r) => ({
      value: r.value,
      label: n(`config.scheme.${r.value}`),
      colors: r.colors
    }));
    function a() {
      const r = [...t.panel.links ?? [], { title: "", url: "", newTab: !0 }];
      t.onChange({ links: r });
    }
    function l(r) {
      const c = (t.panel.links ?? []).filter((g, y) => y !== r);
      t.onChange({ links: c });
    }
    function u(r, c) {
      const g = (t.panel.links ?? []).map((y, v) => v === r ? { ...y, ...c } : y);
      t.onChange({ links: g });
    }
    return (r, c) => {
      const g = ht("a-switch");
      return O(), j("div", yC, [
        b("div", null, [
          b("div", bC, P(f(n)("config.field.title")), 1),
          _(f(it), {
            size: "small",
            value: e.panel.title,
            onChange: c[0] || (c[0] = (y) => e.onChange({ title: y.target.value }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", xC, P(f(n)("config.field.description")), 1),
          _(f(it), {
            size: "small",
            value: e.panel.description,
            onChange: c[1] || (c[1] = (y) => e.onChange({ description: y.target.value }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", wC, P(f(n)("config.field.colorScheme")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.colorScheme ?? "classic",
            "option-label-prop": "children",
            style: { width: "100%" },
            onChange: c[2] || (c[2] = (y) => e.onChange({ colorScheme: y }))
          }, {
            default: q(() => [
              (O(!0), j(Oe, null, et(f(i), (y) => (O(), Ce(f(tt).Option, {
                key: y.value,
                value: y.value
              }, {
                default: q(() => [
                  b("span", SC, [
                    y.colors.length ? (O(), Ce(mC, {
                      key: 0,
                      colors: y.colors
                    }, null, 8, ["colors"])) : be("", !0),
                    b("span", null, P(y.label), 1)
                  ])
                ]),
                _: 2
              }, 1032, ["value"]))), 128))
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.colorScheme === "fixed" ? (O(), j("div", kC, [
          b("div", _C, P(f(n)("config.field.colorSingle")), 1),
          b("input", {
            type: "color",
            value: e.panel.colorSingleValue ?? "#4096ff",
            onInput: c[3] || (c[3] = (y) => e.onChange({ colorSingleValue: y.target.value }))
          }, null, 40, CC)
        ])) : be("", !0),
        e.panel.colorScheme && e.panel.colorScheme !== "fixed" && e.panel.colorScheme !== "thresholds" ? (O(), j("div", MC, [
          b("div", TC, P(f(n)("config.field.colorDistribution")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.colorDistribution ?? "sequential",
            options: [
              { value: "sequential", label: f(n)("config.colorDist.sequential") },
              { value: "distributed", label: f(n)("config.colorDist.distributed") }
            ],
            style: { width: "100%" },
            onChange: c[4] || (c[4] = (y) => e.onChange({ colorDistribution: y }))
          }, null, 8, ["value", "options"])
        ])) : be("", !0),
        b("div", null, [
          b("div", zC, P(f(n)("config.section.links", { n: (e.panel.links ?? []).length })), 1),
          (O(!0), j(Oe, null, et(e.panel.links ?? [], (y, v) => (O(), j("div", {
            key: v,
            class: "mb-2 flex flex-col gap-1"
          }, [
            b("div", DC, [
              _(f(it), {
                size: "small",
                value: y.title,
                placeholder: "Title",
                style: { flex: "1" },
                onChange: (m) => u(v, { title: m.target.value })
              }, null, 8, ["value", "onChange"]),
              _(f(ot), {
                type: "text",
                danger: "",
                size: "small",
                onClick: (m) => l(v)
              }, {
                default: q(() => [
                  b("span", {
                    class: Re(f(De).delete)
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["onClick"])
            ]),
            _(f(it), {
              size: "small",
              value: y.url,
              placeholder: "https://",
              onChange: (m) => u(v, { url: m.target.value })
            }, null, 8, ["value", "onChange"]),
            b("div", OC, [
              _(g, {
                size: "small",
                checked: y.newTab,
                onChange: (m) => u(v, { newTab: m })
              }, null, 8, ["checked", "onChange"]),
              b("span", PC, P(f(n)("config.link.newTab")), 1)
            ])
          ]))), 128)),
          _(f(ot), {
            type: "dashed",
            size: "small",
            block: "",
            onClick: a
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).plus, "mr-1"])
              }, null, 2),
              ce(P(f(n)("config.link.add")), 1)
            ]),
            _: 1
          })
        ])
      ]);
    };
  }
}), IC = { class: "flex flex-col gap-3" }, EC = { class: "text-xs text-secondary mb-1" }, $C = { class: "text-xs text-secondary mb-1" }, AC = { class: "text-xs text-secondary mb-1" }, NC = { class: "text-xs text-secondary mb-1" }, RC = { class: "text-xs text-secondary mb-1" }, LC = { class: "text-xs text-secondary mb-1" }, qC = /* @__PURE__ */ ze({
  __name: "HistogramStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = st();
    return (n, i) => {
      const a = ht("a-input-number"), l = ht("a-switch");
      return O(), j("div", IC, [
        b("div", null, [
          b("div", EC, P(f(t)("config.field.histBucketCount")), 1),
          _(a, {
            size: "small",
            min: 1,
            max: 500,
            value: e.panel.histBucketCount ?? 30,
            style: { width: "100%" },
            onChange: i[0] || (i[0] = (u) => e.onChange({ histBucketCount: u ?? 30 }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", $C, P(f(t)("config.field.histBucketSize")), 1),
          _(a, {
            size: "small",
            min: 0,
            value: e.panel.histBucketSize,
            placeholder: f(t)("config.hist.bucketSizePlaceholder"),
            style: { width: "100%" },
            onChange: i[1] || (i[1] = (u) => e.onChange({ histBucketSize: u }))
          }, null, 8, ["value", "placeholder"])
        ]),
        b("div", null, [
          b("div", AC, P(f(t)("config.field.histBucketOffset")), 1),
          _(a, {
            size: "small",
            min: 0,
            value: e.panel.histBucketOffset ?? 0,
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (u) => e.onChange({ histBucketOffset: u ?? 0 }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", NC, P(f(t)("config.field.histCombineSeries")), 1),
          _(l, {
            size: "small",
            checked: e.panel.histCombineSeries ?? !1,
            onChange: i[3] || (i[3] = (u) => e.onChange({ histCombineSeries: u }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", RC, P(f(t)("config.field.lineWidth")), 1),
          _(a, {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.lineWidth,
            style: { width: "100%" },
            onChange: i[4] || (i[4] = (u) => e.onChange({ lineWidth: u ?? 1 }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", LC, P(f(t)("config.field.fillOpacity")), 1),
          _(f(Fn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: i[5] || (i[5] = (u) => e.onChange({ fillOpacity: u }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
}), FC = { class: "flex flex-col gap-3" }, VC = { class: "override-rule-header" }, WC = { class: "override-props" }, YC = /* @__PURE__ */ ze({
  __name: "OverridesSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st(), i = [
      { value: "byName", label: "Field name" },
      { value: "byType", label: "Field type" },
      { value: "byRegexp", label: "Field name by regex" }
    ], a = [
      { value: "displayName", label: "Display name" },
      { value: "unit", label: "Unit" },
      { value: "decimals", label: "Decimals" },
      { value: "color", label: "Color" },
      { value: "thresholds", label: "Thresholds" },
      { value: "min", label: "Min" },
      { value: "max", label: "Max" },
      { value: "noValue", label: "No value" }
    ], l = oe(() => t.panel.fieldConfigOverrides ?? []);
    function u() {
      const m = {
        id: crypto.randomUUID(),
        matcher: { id: "byName", options: "" },
        properties: []
      };
      t.onChange({ fieldConfigOverrides: [...l.value, m] });
    }
    function r(m) {
      t.onChange({
        fieldConfigOverrides: l.value.filter((S) => S.id !== m)
      });
    }
    function c(m, S) {
      t.onChange({
        fieldConfigOverrides: l.value.map(
          (T) => T.id === m ? { ...T, matcher: { ...T.matcher, ...S } } : T
        )
      });
    }
    function g(m) {
      t.onChange({
        fieldConfigOverrides: l.value.map(
          (S) => S.id === m ? { ...S, properties: [...S.properties, { id: "displayName", value: "" }] } : S
        )
      });
    }
    function y(m, S, T) {
      t.onChange({
        fieldConfigOverrides: l.value.map(
          (C) => C.id === m ? {
            ...C,
            properties: C.properties.map(
              (E, X) => X === S ? { ...E, ...T } : E
            )
          } : C
        )
      });
    }
    function v(m, S) {
      t.onChange({
        fieldConfigOverrides: l.value.map(
          (T) => T.id === m ? { ...T, properties: T.properties.filter((C, E) => E !== S) } : T
        )
      });
    }
    return (m, S) => (O(), j("div", FC, [
      (O(!0), j(Oe, null, et(l.value, (T) => (O(), j("div", {
        key: T.id,
        class: "override-rule"
      }, [
        b("div", VC, [
          _(f(tt), {
            size: "small",
            value: T.matcher.id,
            options: i,
            style: { flex: "1" },
            onChange: (C) => c(T.id, { id: C })
          }, null, 8, ["value", "onChange"]),
          _(f(it), {
            size: "small",
            value: T.matcher.options ?? "",
            placeholder: f(n)("editor.overrides.matcherValue"),
            style: { flex: "1" },
            onChange: (C) => c(T.id, { options: C.target.value })
          }, null, 8, ["value", "placeholder", "onChange"]),
          _(f(ot), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (C) => r(T.id)
          }, {
            default: q(() => [
              b("span", {
                class: Re(f(De).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]),
        b("div", WC, [
          (O(!0), j(Oe, null, et(T.properties, (C, E) => (O(), j("div", {
            key: E,
            class: "override-prop-row"
          }, [
            _(f(tt), {
              size: "small",
              value: C.id,
              options: a,
              style: { width: "140px" },
              onChange: (X) => y(T.id, E, { id: X })
            }, null, 8, ["value", "onChange"]),
            _(f(it), {
              size: "small",
              value: String(C.value ?? ""),
              placeholder: f(n)("editor.overrides.propValue"),
              style: { flex: "1" },
              onChange: (X) => y(T.id, E, { value: X.target.value })
            }, null, 8, ["value", "placeholder", "onChange"]),
            _(f(ot), {
              type: "text",
              danger: "",
              size: "small",
              onClick: (X) => v(T.id, E)
            }, {
              default: q(() => [
                b("span", {
                  class: Re(f(De).closeCircle)
                }, null, 2)
              ]),
              _: 1
            }, 8, ["onClick"])
          ]))), 128)),
          _(f(ot), {
            type: "dashed",
            size: "small",
            style: { width: "100%", "margin-top": "4px" },
            onClick: (C) => g(T.id)
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).plus, "mr-1"])
              }, null, 2),
              ce(" " + P(f(n)("editor.overrides.addProperty")), 1)
            ]),
            _: 1
          }, 8, ["onClick"])
        ])
      ]))), 128)),
      _(f(ot), {
        type: "dashed",
        size: "small",
        style: { width: "100%" },
        onClick: u
      }, {
        default: q(() => [
          b("span", {
            class: Re([f(De).plus, "mr-1"])
          }, null, 2),
          ce(" " + P(f(n)("editor.overrides.addOverride")), 1)
        ]),
        _: 1
      })
    ]));
  }
}), Vn = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, a] of t)
    n[i] = a;
  return n;
}, Mf = /* @__PURE__ */ Vn(YC, [["__scopeId", "data-v-2396374b"]]), BC = { class: "flex flex-col gap-3" }, HC = { class: "text-xs text-secondary mb-1" }, jC = { class: "text-xs text-secondary mb-1" }, UC = { class: "text-xs text-secondary mb-1" }, GC = { class: "flex flex-col gap-1" }, KC = { class: "text-xs" }, ZC = { class: "text-xs text-secondary mb-1" }, QC = { key: 0 }, XC = { class: "text-xs text-secondary mb-1" }, JC = { class: "text-xs text-secondary mb-1" }, eM = { class: "text-xs text-secondary mb-1" }, tM = { class: "flex flex-col gap-1" }, nM = { class: "text-xs" }, iM = /* @__PURE__ */ ze({
  __name: "PieStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st(), i = oe(() => t.panel.pieLabels ?? []), a = oe(() => t.panel.legendValues ?? []);
    function l(r, c) {
      const g = c ? [...i.value, r] : i.value.filter((y) => y !== r);
      t.onChange({ pieLabels: g });
    }
    function u(r, c) {
      const g = c ? [...a.value, r] : a.value.filter((y) => y !== r);
      t.onChange({ legendValues: g });
    }
    return (r, c) => {
      const g = ht("a-radio-button"), y = ht("a-radio-group"), v = ht("a-checkbox");
      return O(), j("div", BC, [
        b("div", null, [
          b("div", HC, P(f(n)("config.field.pieType")), 1),
          _(y, {
            size: "small",
            value: e.panel.pieType ?? "pie",
            onChange: c[0] || (c[0] = (m) => e.onChange({ pieType: m.target.value }))
          }, {
            default: q(() => [
              _(g, { value: "pie" }, {
                default: q(() => [
                  ce(P(f(n)("config.pieType.pie")), 1)
                ]),
                _: 1
              }),
              _(g, { value: "donut" }, {
                default: q(() => [
                  ce(P(f(n)("config.pieType.donut")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", jC, P(f(n)("config.field.pieSliceSorting")), 1),
          _(y, {
            size: "small",
            value: e.panel.pieSliceSorting ?? "desc",
            onChange: c[1] || (c[1] = (m) => e.onChange({ pieSliceSorting: m.target.value }))
          }, {
            default: q(() => [
              _(g, { value: "desc" }, {
                default: q(() => [
                  ce(P(f(n)("config.sort.desc")), 1)
                ]),
                _: 1
              }),
              _(g, { value: "asc" }, {
                default: q(() => [
                  ce(P(f(n)("config.sort.asc")), 1)
                ]),
                _: 1
              }),
              _(g, { value: "none" }, {
                default: q(() => [
                  ce(P(f(n)("config.sort.none")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", UC, P(f(n)("config.field.pieLabels")), 1),
          b("div", GC, [
            (O(), j(Oe, null, et(["name", "percent", "value"], (m) => b("label", {
              key: m,
              class: "flex items-center gap-1"
            }, [
              _(v, {
                checked: i.value.includes(m),
                onChange: (S) => l(m, S.target.checked)
              }, null, 8, ["checked", "onChange"]),
              b("span", KC, P(f(n)(`config.pieLabel.${m}`)), 1)
            ])), 64))
          ])
        ]),
        b("div", null, [
          b("div", ZC, P(f(n)("config.field.pieShow")), 1),
          _(y, {
            size: "small",
            value: e.panel.pieShow ?? "calculate",
            onChange: c[2] || (c[2] = (m) => e.onChange({ pieShow: m.target.value }))
          }, {
            default: q(() => [
              _(g, { value: "calculate" }, {
                default: q(() => [
                  ce(P(f(n)("config.pieShow.calculate")), 1)
                ]),
                _: 1
              }),
              _(g, { value: "all" }, {
                default: q(() => [
                  ce(P(f(n)("config.pieShow.all")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (e.panel.pieShow ?? "calculate") === "calculate" ? (O(), j("div", QC, [
          b("div", XC, P(f(n)("config.field.reducer")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.pieCalculation ?? "lastNotNull",
            options: [
              { value: "lastNotNull", label: f(n)("config.reducer.lastNotNull") },
              { value: "last", label: f(n)("config.reducer.last") },
              { value: "mean", label: f(n)("config.reducer.mean") },
              { value: "min", label: f(n)("config.reducer.min") },
              { value: "max", label: f(n)("config.reducer.max") },
              { value: "sum", label: f(n)("config.reducer.sum") }
            ],
            style: { width: "100%" },
            onChange: c[3] || (c[3] = (m) => e.onChange({ pieCalculation: m }))
          }, null, 8, ["value", "options"])
        ])) : be("", !0),
        b("div", null, [
          b("div", JC, P(f(n)("config.field.legendMode")), 1),
          _(y, {
            size: "small",
            value: e.panel.legendMode ?? "list",
            onChange: c[4] || (c[4] = (m) => e.onChange({ legendMode: m.target.value }))
          }, {
            default: q(() => [
              _(g, { value: "list" }, {
                default: q(() => [
                  ce(P(f(n)("config.legendMode.list")), 1)
                ]),
                _: 1
              }),
              _(g, { value: "table" }, {
                default: q(() => [
                  ce(P(f(n)("config.legendMode.table")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", eM, P(f(n)("config.field.legendValues")), 1),
          b("div", tM, [
            (O(), j(Oe, null, et(["min", "max", "mean", "sum", "last"], (m) => b("label", {
              key: m,
              class: "flex items-center gap-1"
            }, [
              _(v, {
                checked: a.value.includes(m),
                onChange: (S) => u(m, S.target.checked)
              }, null, 8, ["checked", "onChange"]),
              b("span", nM, P(f(n)(`config.legendValue.${m}`)), 1)
            ])), 64))
          ])
        ])
      ]);
    };
  }
}), aM = { class: "flex flex-col gap-3" }, lM = { class: "text-xs text-secondary mb-1" }, oM = { class: "text-xs text-secondary mb-1" }, sM = { class: "text-xs text-secondary mb-1" }, rM = { class: "text-xs text-secondary mb-1" }, uM = /* @__PURE__ */ ze({
  __name: "StatStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = st();
    return (n, i) => {
      const a = ht("a-switch");
      return O(), j("div", aM, [
        b("div", null, [
          b("div", lM, P(f(t)("config.field.orientation")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.statOrientation ?? "vertical",
            options: [
              { value: "vertical", label: f(t)("config.orientation.vertical") },
              { value: "horizontal", label: f(t)("config.orientation.horizontal") }
            ],
            style: { width: "100%" },
            onChange: i[0] || (i[0] = (l) => e.onChange({ statOrientation: l }))
          }, null, 8, ["value", "options"])
        ]),
        b("div", null, [
          b("div", oM, P(f(t)("config.field.textMode")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.statTextMode ?? "value_and_name",
            options: [
              { value: "value_and_name", label: f(t)("config.textMode.valueAndName") },
              { value: "value", label: f(t)("config.textMode.value") },
              { value: "name", label: f(t)("config.textMode.name") },
              { value: "none", label: f(t)("config.textMode.none") }
            ],
            style: { width: "100%" },
            onChange: i[1] || (i[1] = (l) => e.onChange({ statTextMode: l }))
          }, null, 8, ["value", "options"])
        ]),
        b("div", null, [
          b("div", sM, P(f(t)("config.field.colorMode")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.statColorMode ?? "value",
            options: [
              { value: "value", label: f(t)("config.colorMode.value") },
              { value: "background_solid", label: f(t)("config.colorMode.backgroundSolid") },
              { value: "background", label: f(t)("config.colorMode.background") }
            ],
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (l) => e.onChange({ statColorMode: l }))
          }, null, 8, ["value", "options"])
        ]),
        b("div", null, [
          b("div", rM, P(f(t)("config.field.percentChange")), 1),
          _(a, {
            size: "small",
            checked: e.panel.showPercentChange ?? !1,
            onChange: i[3] || (i[3] = (l) => e.onChange({ showPercentChange: l }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), cM = { class: "flex flex-col gap-3" }, dM = { key: 0 }, fM = { class: "text-xs text-secondary mb-1" }, hM = { key: 1 }, gM = { class: "text-xs text-secondary mb-1" }, pM = { key: 2 }, mM = { class: "text-xs text-secondary mb-1" }, vM = { key: 3 }, yM = { class: "text-xs text-secondary mb-1" }, bM = { class: "text-xs text-secondary mb-1" }, xM = { class: "text-xs text-secondary mb-1" }, wM = { class: "text-xs text-secondary mb-1" }, SM = { class: "flex items-center gap-2" }, kM = { class: "text-xs text-secondary mb-1" }, _M = { class: "flex items-center gap-2" }, CM = { key: 5 }, MM = { class: "text-xs text-secondary mb-1" }, TM = { key: 6 }, zM = { class: "text-xs text-secondary mb-1" }, DM = { class: "text-xs text-secondary mb-1" }, OM = { key: 7 }, PM = { class: "text-xs text-secondary mb-1" }, IM = /* @__PURE__ */ ze({
  __name: "StyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st(), i = t.panel.type === "timeseries", a = t.panel.drawStyle ?? "lines", l = a === "lines", u = a === "points", r = t.panel.showPointsMode ?? "auto", c = t.panel.spanNulls ?? !1, g = t.panel.insertNulls ?? !1;
    return (y, v) => {
      const m = ht("a-radio-button"), S = ht("a-radio-group"), T = ht("a-input-number"), C = ht("a-switch");
      return O(), j("div", cM, [
        i ? (O(), j("div", dM, [
          b("div", fM, P(f(n)("config.field.drawStyle")), 1),
          _(S, {
            size: "small",
            value: e.panel.drawStyle ?? "lines",
            onChange: v[0] || (v[0] = (E) => e.onChange({ drawStyle: E.target.value }))
          }, {
            default: q(() => [
              _(m, { value: "lines" }, {
                default: q(() => [
                  ce(P(f(n)("config.drawStyle.lines")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "bars" }, {
                default: q(() => [
                  ce(P(f(n)("config.drawStyle.bars")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "points" }, {
                default: q(() => [
                  ce(P(f(n)("config.drawStyle.points")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : be("", !0),
        u ? be("", !0) : (O(), j("div", hM, [
          b("div", gM, P(f(n)("config.field.lineWidth")), 1),
          _(f(Fn), {
            min: 0.5,
            max: 4,
            step: 0.5,
            value: e.panel.lineWidth,
            onChange: v[1] || (v[1] = (E) => e.onChange({ lineWidth: E }))
          }, null, 8, ["value"])
        ])),
        u ? be("", !0) : (O(), j("div", pM, [
          b("div", mM, P(f(n)("config.field.fillOpacity")), 1),
          _(f(Fn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: v[2] || (v[2] = (E) => e.onChange({ fillOpacity: E }))
          }, null, 8, ["value"])
        ])),
        u ? be("", !0) : (O(), j("div", vM, [
          b("div", yM, P(f(n)("config.field.gradientMode")), 1),
          _(S, {
            size: "small",
            value: e.panel.gradientMode ?? "none",
            onChange: v[3] || (v[3] = (E) => e.onChange({ gradientMode: E.target.value }))
          }, {
            default: q(() => [
              _(m, { value: "none" }, {
                default: q(() => [
                  ce(P(f(n)("config.gradient.none")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "opacity" }, {
                default: q(() => [
                  ce(P(f(n)("config.gradient.opacity")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "hue" }, {
                default: q(() => [
                  ce(P(f(n)("config.gradient.hue")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "scheme" }, {
                default: q(() => [
                  ce(P(f(n)("config.gradient.scheme")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])),
        i && l ? (O(), j(Oe, { key: 4 }, [
          b("div", null, [
            b("div", bM, P(f(n)("config.field.interpolation")), 1),
            _(S, {
              size: "small",
              value: e.panel.lineInterpolation,
              onChange: v[4] || (v[4] = (E) => e.onChange({ lineInterpolation: E.target.value }))
            }, {
              default: q(() => [
                _(m, { value: "linear" }, {
                  default: q(() => [
                    ce(P(f(n)("config.interp.linear")), 1)
                  ]),
                  _: 1
                }),
                _(m, { value: "smooth" }, {
                  default: q(() => [
                    ce(P(f(n)("config.interp.smooth")), 1)
                  ]),
                  _: 1
                }),
                _(m, { value: "step" }, {
                  default: q(() => [
                    ce(P(f(n)("config.interp.step")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          b("div", null, [
            b("div", xM, P(f(n)("config.field.lineStyle")), 1),
            _(S, {
              size: "small",
              value: e.panel.lineStyle,
              onChange: v[5] || (v[5] = (E) => e.onChange({ lineStyle: E.target.value }))
            }, {
              default: q(() => [
                _(m, { value: "solid" }, {
                  default: q(() => [
                    ce(P(f(n)("config.linestyle.solid")), 1)
                  ]),
                  _: 1
                }),
                _(m, { value: "dashed" }, {
                  default: q(() => [
                    ce(P(f(n)("config.linestyle.dashed")), 1)
                  ]),
                  _: 1
                }),
                _(m, { value: "dotted" }, {
                  default: q(() => [
                    ce(P(f(n)("config.linestyle.dotted")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          b("div", null, [
            b("div", wM, P(f(n)("config.field.spanNulls")), 1),
            b("div", SM, [
              _(S, {
                size: "small",
                value: f(c) === !0 ? "always" : typeof f(c) == "number" ? "threshold" : "never",
                onChange: v[6] || (v[6] = (E) => {
                  E.target.value === "never" ? e.onChange({ spanNulls: !1 }) : E.target.value === "always" ? e.onChange({ spanNulls: !0 }) : e.onChange({ spanNulls: 3600 });
                })
              }, {
                default: q(() => [
                  _(m, { value: "never" }, {
                    default: q(() => [
                      ce(P(f(n)("config.nulls.never")), 1)
                    ]),
                    _: 1
                  }),
                  _(m, { value: "always" }, {
                    default: q(() => [
                      ce(P(f(n)("config.nulls.always")), 1)
                    ]),
                    _: 1
                  }),
                  _(m, { value: "threshold" }, {
                    default: q(() => [
                      ce(P(f(n)("config.nulls.threshold")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value"]),
              typeof f(c) == "number" ? (O(), Ce(T, {
                key: 0,
                size: "small",
                min: 1,
                value: f(c),
                suffix: "s",
                style: { width: "90px" },
                onChange: v[7] || (v[7] = (E) => e.onChange({ spanNulls: E ?? 3600 }))
              }, null, 8, ["value"])) : be("", !0)
            ])
          ]),
          b("div", null, [
            b("div", kM, P(f(n)("config.field.insertNulls")), 1),
            b("div", _M, [
              _(S, {
                size: "small",
                value: typeof f(g) == "number" ? "threshold" : "never",
                onChange: v[8] || (v[8] = (E) => {
                  E.target.value === "never" ? e.onChange({ insertNulls: !1 }) : e.onChange({ insertNulls: 3600 });
                })
              }, {
                default: q(() => [
                  _(m, { value: "never" }, {
                    default: q(() => [
                      ce(P(f(n)("config.nulls.never")), 1)
                    ]),
                    _: 1
                  }),
                  _(m, { value: "threshold" }, {
                    default: q(() => [
                      ce(P(f(n)("config.nulls.threshold")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value"]),
              typeof f(g) == "number" ? (O(), Ce(T, {
                key: 0,
                size: "small",
                min: 1,
                value: f(g),
                suffix: "s",
                style: { width: "90px" },
                onChange: v[9] || (v[9] = (E) => e.onChange({ insertNulls: E ?? 3600 }))
              }, null, 8, ["value"])) : be("", !0)
            ])
          ])
        ], 64)) : be("", !0),
        i && !u ? (O(), j("div", CM, [
          b("div", MM, P(f(n)("config.field.showPoints")), 1),
          _(S, {
            size: "small",
            value: f(r),
            onChange: v[10] || (v[10] = (E) => e.onChange({ showPointsMode: E.target.value, showPoints: E.target.value === "always" }))
          }, {
            default: q(() => [
              _(m, { value: "auto" }, {
                default: q(() => [
                  ce(P(f(n)("config.points.auto")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "always" }, {
                default: q(() => [
                  ce(P(f(n)("config.points.always")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "never" }, {
                default: q(() => [
                  ce(P(f(n)("config.points.never")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : be("", !0),
        i ? (O(), j("div", TM, [
          b("div", zM, P(f(n)("config.field.stackSeries")), 1),
          _(S, {
            size: "small",
            value: e.panel.stackingMode ?? "none",
            onChange: v[11] || (v[11] = (E) => e.onChange({ stackingMode: E.target.value }))
          }, {
            default: q(() => [
              _(m, { value: "none" }, {
                default: q(() => [
                  ce(P(f(n)("config.stack.none")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "normal" }, {
                default: q(() => [
                  ce(P(f(n)("config.stack.normal")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "percent" }, {
                default: q(() => [
                  ce(P(f(n)("config.stack.percent")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : be("", !0),
        b("div", null, [
          b("div", DM, P(f(n)("config.field.legendPosition")), 1),
          _(S, {
            size: "small",
            value: e.panel.legendPosition,
            onChange: v[12] || (v[12] = (E) => e.onChange({ legendPosition: E.target.value }))
          }, {
            default: q(() => [
              _(m, { value: "bottom" }, {
                default: q(() => [
                  ce(P(f(n)("config.legend.bottom")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "right" }, {
                default: q(() => [
                  ce(P(f(n)("config.legend.right")), 1)
                ]),
                _: 1
              }),
              _(m, { value: "hidden" }, {
                default: q(() => [
                  ce(P(f(n)("config.legend.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.type === "bar" ? (O(), j("div", OM, [
          b("div", PM, P(f(n)("config.field.stacked")), 1),
          _(C, {
            size: "small",
            checked: e.panel.stacked,
            onChange: v[13] || (v[13] = (E) => e.onChange({ stacked: E }))
          }, null, 8, ["checked"])
        ])) : be("", !0)
      ]);
    };
  }
}), EM = { class: "flex flex-col gap-3" }, $M = { class: "text-xs text-secondary mb-1" }, AM = { class: "text-xs text-secondary mb-1" }, NM = { class: "text-xs text-secondary mb-1" }, RM = { class: "text-xs text-secondary mb-1" }, LM = { class: "text-xs text-secondary mb-1" }, qM = { class: "text-xs text-secondary mb-1" }, FM = { key: 0 }, VM = { class: "text-xs text-secondary mb-1" }, WM = { class: "text-xs text-secondary mb-1" }, YM = { key: 1 }, BM = { class: "text-xs text-secondary mb-1" }, HM = { key: 2 }, jM = { class: "text-xs text-secondary mb-1" }, UM = /* @__PURE__ */ ze({
  __name: "TableStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st();
    function i(a) {
      t.onChange({ tableFooterReducers: a ? [a] : [] });
    }
    return (a, l) => {
      const u = ht("a-switch"), r = ht("a-radio-button"), c = ht("a-radio-group");
      return O(), j("div", EM, [
        b("div", null, [
          b("div", $M, P(f(n)("config.field.tableShowHeader")), 1),
          _(u, {
            size: "small",
            checked: e.panel.tableShowHeader ?? !0,
            onChange: l[0] || (l[0] = (g) => e.onChange({ tableShowHeader: g }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", AM, P(f(n)("config.field.tableCellHeight")), 1),
          _(c, {
            size: "small",
            value: e.panel.tableCellHeight ?? "medium",
            onChange: l[1] || (l[1] = (g) => e.onChange({ tableCellHeight: g.target.value }))
          }, {
            default: q(() => [
              _(r, { value: "small" }, {
                default: q(() => [
                  ce(P(f(n)("config.tableHeight.small")), 1)
                ]),
                _: 1
              }),
              _(r, { value: "medium" }, {
                default: q(() => [
                  ce(P(f(n)("config.tableHeight.medium")), 1)
                ]),
                _: 1
              }),
              _(r, { value: "large" }, {
                default: q(() => [
                  ce(P(f(n)("config.tableHeight.large")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        b("div", null, [
          b("div", NM, P(f(n)("config.field.tableFrozenColumns")), 1),
          _(f(yn), {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.tableFrozenColumns ?? 0,
            style: { width: "100%" },
            onChange: l[2] || (l[2] = (g) => e.onChange({ tableFrozenColumns: g ?? 0 }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", RM, P(f(n)("config.field.tableColumnFilter")), 1),
          _(u, {
            size: "small",
            checked: e.panel.tableColumnFilter ?? !1,
            onChange: l[3] || (l[3] = (g) => e.onChange({ tableColumnFilter: g }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", LM, P(f(n)("config.field.tableWrapText")), 1),
          _(u, {
            size: "small",
            checked: e.panel.tableWrapText ?? !1,
            onChange: l[4] || (l[4] = (g) => e.onChange({ tableWrapText: g }))
          }, null, 8, ["checked"])
        ]),
        b("div", null, [
          b("div", qM, P(f(n)("config.field.tableEnablePagination")), 1),
          _(u, {
            size: "small",
            checked: e.panel.tableEnablePagination ?? !1,
            onChange: l[5] || (l[5] = (g) => e.onChange({ tableEnablePagination: g }))
          }, null, 8, ["checked"])
        ]),
        e.panel.tableEnablePagination ? (O(), j("div", FM, [
          b("div", VM, P(f(n)("config.field.tablePageSize")), 1),
          _(f(yn), {
            size: "small",
            min: 5,
            max: 500,
            value: e.panel.tablePageSize ?? 20,
            style: { width: "100%" },
            onChange: l[6] || (l[6] = (g) => e.onChange({ tablePageSize: g ?? 20 }))
          }, null, 8, ["value"])
        ])) : be("", !0),
        b("div", null, [
          b("div", WM, P(f(n)("config.field.tableFooterEnabled")), 1),
          _(u, {
            size: "small",
            checked: e.panel.tableFooterEnabled ?? !1,
            onChange: l[7] || (l[7] = (g) => e.onChange({ tableFooterEnabled: g }))
          }, null, 8, ["checked"])
        ]),
        e.panel.tableFooterEnabled ? (O(), j("div", YM, [
          b("div", BM, P(f(n)("config.field.tableFooterReducers")), 1),
          _(f(tt), {
            size: "small",
            value: e.panel.tableFooterReducers?.[0],
            options: [
              { value: "min", label: f(n)("config.reducer.min") },
              { value: "max", label: f(n)("config.reducer.max") },
              { value: "mean", label: f(n)("config.reducer.mean") },
              { value: "sum", label: f(n)("config.reducer.sum") },
              { value: "count", label: f(n)("config.reducer.count") }
            ],
            "allow-clear": "",
            style: { width: "100%" },
            onChange: l[8] || (l[8] = (g) => i(g))
          }, null, 8, ["value", "options"])
        ])) : be("", !0),
        e.panel.tableFooterEnabled && e.panel.tableFooterReducers?.[0] ? (O(), j("div", HM, [
          b("div", jM, P(f(n)("config.field.tableFooterFields")), 1),
          _(f(tt), {
            size: "small",
            mode: "multiple",
            "allow-clear": "",
            placeholder: f(n)("config.field.tableFooterFieldsPlaceholder"),
            value: e.panel.tableFooterFields ?? [],
            options: (e.numericFieldNames ?? []).map((g) => ({ value: g, label: g })),
            style: { width: "100%" },
            onChange: l[9] || (l[9] = (g) => e.onChange({ tableFooterFields: g.length > 0 ? g : void 0 }))
          }, null, 8, ["placeholder", "value", "options"])
        ])) : be("", !0)
      ]);
    };
  }
}), GM = { class: "flex flex-col gap-1" }, KM = { class: "mb-2" }, ZM = { class: "text-xs text-secondary mb-1" }, QM = ["value", "onInput"], XM = { class: "flex items-center gap-1.5 mb-1" }, JM = ["value"], e2 = { class: "text-xs text-secondary flex-1" }, t2 = /* @__PURE__ */ ze({
  __name: "ThresholdsEditor",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st(), i = ["#52c41a", "#faad14", "#ff4d4f", "#1677ff", "#722ed1", "#13c2c2", "#fa8c16"], a = pe(t.panel.thresholdMode ?? "absolute"), l = oe(() => a.value === "percentage"), u = oe(() => [...t.panel.thresholds].sort((m, S) => S.value - m.value));
    function r() {
      const m = [t.panel.thresholdBaseColor, ...t.panel.thresholds.map((S) => S.color)];
      return i.find((S) => !m.includes(S)) ?? "#cccccc";
    }
    function c() {
      const m = t.panel.thresholds.length > 0 ? Math.max(...t.panel.thresholds.map((E) => E.value)) : 0, T = { value: l.value ? Math.min(100, m + 20) : m + 10, color: r(), label: "" }, C = [...t.panel.thresholds, T].sort((E, X) => E.value - X.value);
      t.onChange({ thresholds: C });
    }
    function g(m) {
      t.onChange({ thresholds: t.panel.thresholds.filter((S) => S.value !== m) });
    }
    function y(m, S) {
      const T = t.panel.thresholds.map((C) => C.value === m ? { ...C, ...S } : C).sort((C, E) => C.value - E.value);
      t.onChange({ thresholds: T });
    }
    function v(m) {
      a.value = m, t.onChange({ thresholdMode: m });
    }
    return (m, S) => {
      const T = ht("a-input");
      return O(), j("div", GM, [
        b("div", KM, [
          b("div", ZM, P(f(n)("config.threshold.mode")), 1),
          _(f(Ro).Group, {
            size: "small",
            value: a.value,
            onChange: S[0] || (S[0] = (C) => v(C.target.value))
          }, {
            default: q(() => [
              _(f(Ro).Button, { value: "absolute" }, {
                default: q(() => [
                  ce(P(f(n)("config.threshold.modeAbsolute")), 1)
                ]),
                _: 1
              }),
              _(f(Ro).Button, { value: "percentage" }, {
                default: q(() => [
                  ce(P(f(n)("config.threshold.modePercentage")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (O(!0), j(Oe, null, et(u.value, (C) => (O(), j("div", {
          key: C.value,
          class: "flex items-center gap-1.5 mb-1"
        }, [
          b("input", {
            type: "color",
            class: "w-7 h-7 border border-gray-300 rounded cursor-pointer",
            value: C.color,
            onInput: (E) => y(C.value, { color: E.target.value })
          }, null, 40, QM),
          _(f(yn), {
            size: "small",
            value: C.value,
            min: l.value ? 0 : void 0,
            max: l.value ? 100 : void 0,
            style: { width: "80px" },
            onChange: (E) => y(C.value, { value: E ?? 0 })
          }, null, 8, ["value", "min", "max", "onChange"]),
          _(T, {
            size: "small",
            value: C.label,
            placeholder: "Label",
            style: { flex: "1" },
            onChange: (E) => y(C.value, { label: E.target.value })
          }, null, 8, ["value", "onChange"]),
          _(f(ot), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (E) => g(C.value)
          }, {
            default: q(() => [
              b("span", {
                class: Re(f(De).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]))), 128)),
        b("div", XM, [
          b("input", {
            type: "color",
            class: "w-7 h-7 border border-gray-300 rounded cursor-pointer",
            value: e.panel.thresholdBaseColor,
            onInput: S[1] || (S[1] = (C) => e.onChange({ thresholdBaseColor: C.target.value }))
          }, null, 40, JM),
          b("span", e2, P(f(n)("config.threshold.base")), 1)
        ]),
        _(f(ot), {
          type: "dashed",
          size: "small",
          block: "",
          onClick: c
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).plus, "mr-1"])
            }, null, 2),
            ce(" " + P(f(n)("config.threshold.add")), 1)
          ]),
          _: 1
        })
      ]);
    };
  }
}), n2 = { class: "flex flex-col gap-3" }, i2 = { class: "text-xs text-secondary mb-1" }, a2 = { key: 0 }, l2 = { class: "text-xs text-secondary mb-1" }, o2 = { key: 1 }, s2 = { class: "text-xs text-secondary mb-1" }, r2 = { class: "text-xs text-secondary mb-1" }, u2 = /* @__PURE__ */ ze({
  __name: "TooltipSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = st();
    return (n, i) => {
      const a = ht("a-radio-button"), l = ht("a-radio-group"), u = ht("a-switch");
      return O(), j("div", n2, [
        b("div", null, [
          b("div", i2, P(f(t)("config.field.tooltipMode")), 1),
          _(l, {
            size: "small",
            value: e.panel.tooltipMode ?? "multi",
            onChange: i[0] || (i[0] = (r) => e.onChange({ tooltipMode: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "single" }, {
                default: q(() => [
                  ce(P(f(t)("config.tooltip.single")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "multi" }, {
                default: q(() => [
                  ce(P(f(t)("config.tooltip.multi")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "none" }, {
                default: q(() => [
                  ce(P(f(t)("config.tooltip.none")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (e.panel.tooltipMode ?? "multi") === "multi" ? (O(), j("div", a2, [
          b("div", l2, P(f(t)("config.field.tooltipSort")), 1),
          _(l, {
            size: "small",
            value: e.panel.tooltipSort ?? "none",
            onChange: i[1] || (i[1] = (r) => e.onChange({ tooltipSort: r.target.value }))
          }, {
            default: q(() => [
              _(a, { value: "none" }, {
                default: q(() => [
                  ce(P(f(t)("config.tooltip.sortNone")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "asc" }, {
                default: q(() => [
                  ce(P(f(t)("config.tooltip.sortAsc")), 1)
                ]),
                _: 1
              }),
              _(a, { value: "desc" }, {
                default: q(() => [
                  ce(P(f(t)("config.tooltip.sortDesc")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : be("", !0),
        (e.panel.tooltipMode ?? "multi") === "multi" ? (O(), j("div", o2, [
          b("div", s2, P(f(t)("config.field.tooltipMaxHeight")), 1),
          _(f(yn), {
            size: "small",
            min: 50,
            max: 800,
            value: e.panel.tooltipMaxHeight ?? 600,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (r) => e.onChange({ tooltipMaxHeight: r ?? 600 }))
          }, null, 8, ["value"])
        ])) : be("", !0),
        b("div", null, [
          b("div", r2, P(f(t)("config.field.axisPointer")), 1),
          _(u, {
            size: "small",
            checked: e.panel.showAxisPointer ?? !0,
            onChange: i[3] || (i[3] = (r) => e.onChange({ showAxisPointer: r }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), c2 = { class: "flex items-center gap-2" }, d2 = /* @__PURE__ */ ze({
  __name: "SliderInput",
  props: {
    value: {},
    min: {},
    max: {},
    step: { default: 1 },
    shiftMultiplier: { default: 10 },
    unit: {},
    placeholder: {},
    allowClear: { type: Boolean, default: !1 }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = st();
    function l(S) {
      return Math.min(n.max, Math.max(n.min, S));
    }
    const u = oe(() => n.value ?? n.min), r = oe(() => n.placeholder ?? a("common.auto")), c = oe(() => {
      const S = n.value !== void 0 ? n.unit ? `${n.value}${n.unit}` : String(n.value) : r.value;
      try {
        const T = document.createElement("canvas").getContext("2d");
        return T ? (T.font = "14px system-ui, -apple-system, sans-serif", `${Math.ceil(T.measureText(S).width) + 24}px`) : "6ch";
      } catch {
        return "6ch";
      }
    });
    function g(S) {
      typeof S == "number" && i("change", l(S));
    }
    function y(S) {
      S != null && i("change", l(Number(S)));
    }
    function v() {
      i("change", void 0);
    }
    function m(S) {
      const T = S.shiftKey, C = n.step * (T ? n.shiftMultiplier : 1);
      S.key === "ArrowRight" || S.key === "ArrowUp" ? (S.preventDefault(), i("change", l(u.value + C))) : (S.key === "ArrowLeft" || S.key === "ArrowDown") && (S.preventDefault(), i("change", l(u.value - C)));
    }
    return (S, T) => (O(), j("div", c2, [
      _(f(Fn), {
        min: e.min,
        max: e.max,
        step: e.step,
        value: u.value,
        style: { flex: "1" },
        "tooltip-formatter": e.unit ? ((C) => `${C}${e.unit}`) : void 0,
        onChange: g
      }, null, 8, ["min", "max", "step", "value", "tooltip-formatter"]),
      _(f(Bl).Compact, { size: "small" }, {
        default: q(() => [
          _(f(yn), {
            size: "small",
            controls: !1,
            min: e.min,
            max: e.max,
            step: e.step,
            value: e.value ?? void 0,
            placeholder: r.value,
            style: Ue({ width: c.value }),
            suffix: e.unit && e.value !== void 0 ? e.unit : void 0,
            onKeydown: m,
            onChange: y
          }, null, 8, ["min", "max", "step", "value", "placeholder", "style", "suffix"]),
          e.allowClear && e.value !== void 0 ? (O(), Ce(f(ot), {
            key: 0,
            onClick: v
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).closeCircle, "text-xs text-gray-400 cursor-pointer"])
              }, null, 2)
            ]),
            _: 1
          })) : be("", !0)
        ]),
        _: 1
      })
    ]));
  }
}), f2 = { class: "flex flex-col gap-3" }, h2 = { key: 0 }, g2 = { class: "text-xs text-secondary mb-1" }, p2 = { class: "text-xs text-secondary mb-1" }, m2 = { class: "text-xs text-secondary mb-1" }, v2 = { key: 1 }, y2 = { class: "text-xs text-secondary mb-1" }, b2 = { key: 2 }, x2 = { class: "text-xs text-secondary mb-1" }, w2 = /* @__PURE__ */ ze({
  __name: "ValueSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = st(), a = ["", "ms", "s", "bytes", "percent", "percentunit", "reqps", "ops", "bps", "Bps"].map((c) => ({
      value: c,
      label: n(c ? `config.unit.${c}` : "config.unit.none")
    })), l = [
      { value: "lastNotNull", label: n("config.reducer.lastNotNull") },
      { value: "last", label: n("config.reducer.last") },
      { value: "firstNotNull", label: n("config.reducer.firstNotNull") },
      { value: "first", label: n("config.reducer.first") },
      { value: "mean", label: n("config.reducer.mean") },
      { value: "min", label: n("config.reducer.min") },
      { value: "max", label: n("config.reducer.max") },
      { value: "sum", label: n("config.reducer.sum") },
      { value: "count", label: n("config.reducer.count") }
    ], u = t.panel.type === "gauge", r = t.panel.type !== "timeseries";
    return (c, g) => (O(), j("div", f2, [
      r ? (O(), j("div", h2, [
        b("div", g2, P(f(n)("config.field.reducer")), 1),
        _(f(tt), {
          size: "small",
          value: e.panel.statReducer ?? "lastNotNull",
          options: l,
          style: { width: "100%" },
          onChange: g[0] || (g[0] = (y) => e.onChange({ statReducer: y }))
        }, null, 8, ["value"])
      ])) : be("", !0),
      b("div", null, [
        b("div", p2, P(f(n)("config.field.unit")), 1),
        _(f(tt), {
          size: "small",
          value: e.panel.unit || "",
          options: f(a),
          style: { width: "100%" },
          onChange: g[1] || (g[1] = (y) => e.onChange({ unit: y }))
        }, null, 8, ["value", "options"])
      ]),
      b("div", null, [
        b("div", m2, P(f(n)("config.field.decimals")), 1),
        _(d2, {
          min: 0,
          max: 15,
          step: 1,
          value: e.panel.decimals,
          "allow-clear": !0,
          onChange: g[2] || (g[2] = (y) => e.onChange({ decimals: y }))
        }, null, 8, ["value"])
      ]),
      u ? (O(), j("div", v2, [
        b("div", y2, P(f(n)("config.field.min")), 1),
        _(f(yn), {
          size: "small",
          value: e.panel.min,
          style: { width: "100%" },
          onChange: g[3] || (g[3] = (y) => e.onChange({ min: y ?? 0 }))
        }, null, 8, ["value"])
      ])) : be("", !0),
      u ? (O(), j("div", b2, [
        b("div", x2, P(f(n)("config.field.max")), 1),
        _(f(yn), {
          size: "small",
          value: e.panel.max,
          style: { width: "100%" },
          onChange: g[4] || (g[4] = (y) => e.onChange({ max: y ?? 100 }))
        }, null, 8, ["value"])
      ])) : be("", !0)
    ]));
  }
}), S2 = { class: "h-full flex flex-col overflow-hidden" }, k2 = {
  class: "flex-shrink-0 px-2 bg-primary/10 py-1",
  style: { "border-bottom": "1px solid #eee" }
}, _2 = { class: "flex-1 overflow-y-auto" }, C2 = /* @__PURE__ */ ze({
  __name: "OptionsPane",
  setup(e) {
    const t = [
      "timeseries",
      "bar",
      "histogram",
      "stat",
      "gauge",
      "table",
      "pie"
    ], { t: n } = st(), { panel: i, onChange: a, numericFieldNames: l, allFieldNames: u } = uo(), r = oe(
      () => t.map((S) => ({
        value: S,
        label: n(`config.type.${S}`)
      }))
    ), c = pe(""), g = {
      general: Cf,
      style: IM,
      tooltip: u2,
      axes: q_,
      value: w2,
      // timeseries / bar / histogram
      "bar-style": G_,
      "histogram-style": qC,
      // stat
      "stat-style": uM,
      // gauge
      "gauge-style": gC,
      // pie
      "pie-style": iM,
      // table
      "table-style": UM,
      // overrides
      overrides: Mf
    }, y = oe(() => {
      const T = (Ob(i.value.type)?.optionCategories ?? []).map((C) => ({
        key: C.key,
        label: n(C.labelKey),
        component: g[C.key] ?? Cf
      }));
      return T.push({
        key: "thresholds",
        label: n("config.section.thresholds", { n: i.value.thresholds.length }),
        component: t2
      }), T.push({
        key: "overrides",
        label: n("config.section.overrides"),
        component: Mf
      }), T;
    }), v = oe(() => {
      if (!c.value.trim())
        return y.value;
      const S = c.value.toLowerCase();
      return y.value.filter(
        (T) => typeof T.label == "string" && T.label.toLowerCase().includes(S)
      );
    }), m = pe(["general"]);
    return (S, T) => (O(), j("div", S2, [
      b("div", k2, [
        _(f(tt), {
          class: "text-primary",
          bordered: !1,
          value: f(i).type,
          size: "small",
          variant: "filled",
          options: r.value,
          "onUpdate:value": T[0] || (T[0] = (C) => f(a)({ type: C }))
        }, null, 8, ["value", "options"])
      ]),
      b("div", _2, [
        _(f(Bs), {
          "active-key": m.value,
          "onUpdate:activeKey": T[1] || (T[1] = (C) => m.value = C),
          bordered: !1,
          accordion: "",
          size: "small"
        }, {
          default: q(() => [
            (O(!0), j(Oe, null, et(v.value, (C) => (O(), Ce(f(Bs).Panel, {
              key: C.key,
              header: C.label
            }, {
              default: q(() => [
                (O(), Ce(Nf(C.component), {
                  panel: f(i),
                  "on-change": f(a),
                  "numeric-field-names": f(l),
                  "all-field-names": f(u)
                }, null, 40, ["panel", "on-change", "numeric-field-names", "all-field-names"]))
              ]),
              _: 2
            }, 1032, ["header"]))), 128))
          ]),
          _: 1
        }, 8, ["active-key"])
      ])
    ]));
  }
}), ip = /* @__PURE__ */ ze({
  __name: "PanelLinksIcon",
  props: {
    links: {},
    iconColor: {}
  },
  setup(e) {
    const t = e;
    function n(a) {
      a.url && window.open(a.url, a.newTab ? "_blank" : "_self", "noopener,noreferrer");
    }
    const i = oe(() => t.links.filter((a) => a.url));
    return (a, l) => i.value.length === 0 ? (O(), j(Oe, { key: 0 }, [], 64)) : i.value.length === 1 ? (O(), Ce(f(Zn), {
      key: 1,
      title: i.value[0].title || i.value[0].url,
      placement: "bottom"
    }, {
      default: q(() => [
        b("span", {
          class: Re([f(De).link, "flex-shrink-0 cursor-pointer text-xs"]),
          style: Ue({ color: e.iconColor }),
          onClick: l[0] || (l[0] = Qn((u) => n(i.value[0]), ["stop"]))
        }, null, 6)
      ]),
      _: 1
    }, 8, ["title"])) : (O(), Ce(f(Jo), {
      key: 2,
      trigger: ["hover", "click"],
      placement: "bottomLeft"
    }, {
      overlay: q(() => [
        _(f(Di), null, {
          default: q(() => [
            (O(!0), j(Oe, null, et(i.value, (u, r) => (O(), Ce(f(Di).Item, {
              key: r,
              onClick: (c) => n(u)
            }, {
              default: q(() => [
                ce(P(u.title || u.url), 1)
              ]),
              _: 2
            }, 1032, ["onClick"]))), 128))
          ]),
          _: 1
        })
      ]),
      default: q(() => [
        b("span", {
          class: Re([f(De).link, "flex-shrink-0 cursor-pointer text-xs"]),
          style: Ue({ color: e.iconColor }),
          onClick: l[1] || (l[1] = Qn(() => {
          }, ["stop"]))
        }, null, 6)
      ]),
      _: 1
    }));
  }
}), M2 = {
  key: 0,
  class: "legend-search-container"
}, T2 = ["value"], z2 = { class: "legend-table-wrap" }, D2 = { class: "legend-table" }, O2 = ["data-legend-item-id"], P2 = { class: "legend-table-td legend-table-name-col" }, I2 = ["data-legend-tooltip"], E2 = { class: "legend-label" }, $2 = {
  key: 0,
  class: "legend-search-container"
}, A2 = ["value"], N2 = {
  key: 1,
  class: "legend-empty-state"
}, R2 = { class: "virtuoso-grid-list" }, L2 = ["data-legend-item-id"], q2 = ["data-legend-tooltip"], F2 = { class: "legend-label" }, V2 = {
  key: 0,
  class: "legend-item-values"
}, W2 = { class: "legend-item-value-key" }, Y2 = { class: "legend-item-value-num" }, B2 = ["data-legend-tooltip", "onClick"], H2 = {
  key: 0,
  width: "12",
  height: "12",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2"
}, j2 = {
  key: 1,
  width: "12",
  height: "12",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2"
}, U2 = /* @__PURE__ */ ze({
  __name: "ChartLegend",
  props: {
    items: {},
    uPlotInstance: {},
    position: { default: "bottom" },
    mode: { default: "list" },
    unit: {},
    decimals: {},
    averageLegendWidth: { default: 40 },
    values: { default: () => [] },
    data: {}
  },
  setup(e) {
    const t = e, n = pe(null), i = pe(""), a = pe(null), l = pe(!1), u = pe(), r = pe({});
    function c(G) {
      const Z = {};
      G.series.forEach((A, J) => {
        J !== 0 && (Z[J] = A.show ?? !0);
      }), r.value = { ...Z };
    }
    function g(G, Z, A) {
      !Z || typeof A.show != "boolean" || (r.value = { ...r.value, [Z]: A.show });
    }
    Ye(
      () => t.uPlotInstance,
      (G, Z) => {
        if (Z && (Z.hooks.setSeries = (Z.hooks.setSeries ?? []).filter(
          (A) => A.__legendSync !== !0
        )), G) {
          c(G);
          const A = (J, ee, I) => g(J, ee, I);
          A.__legendSync = !0, G.hooks.setSeries = [...G.hooks.setSeries ?? [], A];
        } else
          r.value = {};
      },
      { immediate: !0 }
    );
    const y = {
      last: "Last *",
      first: "First *",
      min: "Min",
      max: "Max",
      mean: "Avg",
      sum: "Sum"
    };
    function v(G) {
      const Z = G.filter(
        (J) => J != null && !Number.isNaN(J)
      );
      if (Z.length === 0)
        return { last: null, first: null, min: null, max: null, mean: null, sum: null };
      const A = Z.reduce((J, ee) => J + ee, 0);
      return {
        last: Z[Z.length - 1],
        first: Z[0],
        min: Math.min(...Z),
        max: Math.max(...Z),
        mean: A / Z.length,
        sum: A
      };
    }
    function m(G, Z) {
      return G === null ? "—" : Math.abs(G) >= 1e6 ? Z !== void 0 ? `${(G / 1e6).toFixed(Z)}M` : `${G / 1e6}M` : Math.abs(G) >= 1e3 ? Z !== void 0 ? `${(G / 1e3).toFixed(Z)}K` : `${G / 1e3}K` : Z !== void 0 ? G.toFixed(Z) : String(G);
    }
    const S = oe(
      () => Object.values(t.items).map((G) => ({
        ...G,
        show: r.value[G.seriesIndex] ?? G.show ?? !0
      }))
    ), T = oe(() => {
      if (t.position !== "right" || !i.value.trim())
        return S.value;
      const G = i.value.trim().toLowerCase();
      return S.value.filter((Z) => Z.label?.toLowerCase().includes(G));
    }), C = oe(() => t.position !== "right" || !i.value.trim() ? !1 : T.value.length === 0), E = oe(() => {
      if (!t.data || t.values.length === 0)
        return {};
      const G = {};
      return S.value.forEach((Z) => {
        const A = t.data[Z.seriesIndex];
        G[Z.seriesIndex] = v(A ?? []);
      }), G;
    }), { onToggleSeriesOnOff: X, onToggleSeriesVisibility: F } = {
      onToggleSeriesOnOff(G) {
        const Z = t.uPlotInstance;
        if (!Z)
          return;
        const A = Z.series[G];
        A && Z.setSeries(G, { show: !A.show });
      },
      onToggleSeriesVisibility(G) {
        const Z = t.uPlotInstance;
        if (!Z)
          return;
        const A = n.value === G;
        Z.series.forEach((J, ee) => {
          ee !== 0 && Z.setSeries(ee, { show: A || ee === G });
        }), n.value = A ? null : G;
      }
    };
    function V(G) {
      const Z = G.target.closest("[data-legend-item-id]");
      if (!Z)
        return null;
      const A = Number(Z.dataset.legendItemId);
      return Number.isNaN(A) ? null : A;
    }
    function N(G) {
      const Z = V(G);
      if (Z === null)
        return;
      if (!!G.target.dataset.isLegendMarker) {
        X(Z);
        return;
      }
      F(Z);
    }
    async function Y(G, Z) {
      try {
        await navigator.clipboard.writeText(Z), a.value = G, setTimeout(() => {
          a.value = null;
        }, 2e3);
      } catch {
      }
    }
    function K(G) {
      const Z = G.target;
      i.value = Z.value;
    }
    function M() {
      if (!u.value || t.position !== "bottom") {
        l.value = !1;
        return;
      }
      const Z = u.value.clientWidth;
      if (Z === 0)
        return;
      const A = S.value.length * (t.averageLegendWidth + 16);
      l.value = Math.ceil(A / Z) <= 1;
    }
    let W = null;
    return Nn(() => {
      M(), u.value && t.position === "bottom" && (W = new ResizeObserver(M), W.observe(u.value));
    }), Fa(() => {
      W && W.disconnect();
    }), Ye([() => t.averageLegendWidth, () => S.value.length, () => t.position], () => {
      M();
    }), (G, Z) => e.mode === "table" && e.values.length > 0 ? (O(), j("div", {
      key: 0,
      ref_key: "legendContainerRef",
      ref: u,
      class: "legend-container legend-table-mode",
      onClick: N
    }, [
      e.position === "right" ? (O(), j("div", M2, [
        b("input", {
          type: "text",
          placeholder: "Search...",
          value: i.value,
          class: "legend-search-input",
          onInput: K
        }, null, 40, T2)
      ])) : be("", !0),
      b("div", z2, [
        b("table", D2, [
          b("thead", null, [
            b("tr", null, [
              Z[0] || (Z[0] = b("th", { class: "legend-table-th legend-table-name-col" }, " Name ", -1)),
              (O(!0), j(Oe, null, et(e.values, (A) => (O(), j("th", {
                key: A,
                class: "legend-table-th legend-table-val-col"
              }, P(y[A]), 1))), 128))
            ])
          ]),
          b("tbody", null, [
            (O(!0), j(Oe, null, et(T.value, (A) => (O(), j("tr", {
              key: A.seriesIndex,
              "data-legend-item-id": A.seriesIndex,
              class: Re(["legend-table-row", [
                A.show ? "" : "legend-item-off",
                n.value === A.seriesIndex ? "legend-item-focused" : ""
              ]])
            }, [
              b("td", P2, [
                b("div", {
                  class: "legend-item-label-trigger",
                  "data-legend-tooltip": A.label
                }, [
                  b("div", {
                    class: "legend-marker",
                    style: Ue({ borderColor: A.color }),
                    "data-is-legend-marker": !0
                  }, null, 4),
                  b("span", E2, P(A.label), 1)
                ], 8, I2)
              ]),
              (O(!0), j(Oe, null, et(e.values, (J) => (O(), j("td", {
                key: J,
                class: "legend-table-td legend-table-val-col"
              }, P(E.value[A.seriesIndex] ? m(E.value[A.seriesIndex][J], e.decimals) : "—"), 1))), 128))
            ], 10, O2))), 128))
          ])
        ])
      ])
    ], 512)) : (O(), j("div", {
      key: 1,
      ref_key: "legendContainerRef",
      ref: u,
      class: Re(["legend-container", [e.position === "bottom" ? "legend-container-bottom" : ""]]),
      style: Ue({ "--legend-average-width": `${e.averageLegendWidth + 16}px` }),
      onClick: N
    }, [
      e.position === "right" ? (O(), j("div", $2, [
        b("input", {
          type: "text",
          placeholder: "Search...",
          value: i.value,
          class: "legend-search-input",
          onInput: K
        }, null, 40, A2)
      ])) : be("", !0),
      C.value ? (O(), j("div", N2, ' No series found matching "' + P(i.value) + '" ', 1)) : (O(), j("div", {
        key: 2,
        class: Re(["legend-virtuoso-container", [
          `legend-virtuoso-container-${e.position}`,
          l.value ? "legend-virtuoso-container-single-row" : ""
        ]])
      }, [
        b("div", R2, [
          (O(!0), j(Oe, null, et(T.value, (A) => (O(), j("div", {
            key: A.seriesIndex,
            class: "virtuoso-grid-item"
          }, [
            b("div", {
              "data-legend-item-id": A.seriesIndex,
              class: Re(["legend-item", [
                `legend-item-${e.position}`,
                A.show ? "" : "legend-item-off",
                n.value === A.seriesIndex ? "legend-item-focused" : ""
              ]])
            }, [
              b("div", {
                class: "legend-item-label-trigger",
                "data-legend-tooltip": A.label
              }, [
                b("div", {
                  class: "legend-marker",
                  style: Ue({ borderColor: A.color }),
                  "data-is-legend-marker": !0
                }, null, 4),
                b("span", F2, P(A.label), 1)
              ], 8, q2),
              E.value[A.seriesIndex] && e.values.length > 0 ? (O(), j("span", V2, [
                (O(!0), j(Oe, null, et(e.values, (J) => (O(), j("span", {
                  key: J,
                  class: "legend-item-value-badge"
                }, [
                  b("span", W2, P(y[J]) + ":", 1),
                  b("span", Y2, P(m(E.value[A.seriesIndex][J], e.decimals)), 1)
                ]))), 128))
              ])) : be("", !0),
              b("button", {
                type: "button",
                class: "legend-copy-button",
                "data-legend-tooltip": a.value === A.seriesIndex ? "Copied" : "Copy",
                onClick: Qn((J) => Y(A.seriesIndex, A.label ?? ""), ["stop"])
              }, [
                a.value === A.seriesIndex ? (O(), j("svg", H2, [...Z[1] || (Z[1] = [
                  b("path", { d: "M20 6L9 17l-5-5" }, null, -1)
                ])])) : (O(), j("svg", j2, [...Z[2] || (Z[2] = [
                  b("rect", {
                    x: "9",
                    y: "9",
                    width: "13",
                    height: "13",
                    rx: "2",
                    ry: "2"
                  }, null, -1),
                  b("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
                ])]))
              ], 8, B2)
            ], 10, L2)
          ]))), 128))
        ])
      ], 2))
    ], 6));
  }
}), ap = /* @__PURE__ */ Vn(U2, [["__scopeId", "data-v-85a1707f"]]), G2 = { class: "footer" }, K2 = {
  key: 0,
  class: "hint"
}, Z2 = { class: "kbd active" }, Q2 = {
  key: 1,
  class: "hint-list"
}, X2 = {
  class: "hint",
  "data-active": "false"
}, J2 = { class: "kbd" }, eT = /* @__PURE__ */ ze({
  __name: "TooltipFooter",
  props: {
    isPinned: { type: Boolean },
    pinKey: { default: "P" }
  },
  emits: ["dismiss"],
  setup(e, { emit: t }) {
    const n = t;
    return (i, a) => (O(), j("div", G2, [
      b("div", null, [
        e.isPinned ? (O(), j("div", K2, [
          a[1] || (a[1] = b("span", null, "按", -1)),
          b("kbd", Z2, P(e.pinKey), 1),
          a[2] || (a[2] = b("span", null, "或", -1)),
          a[3] || (a[3] = b("kbd", { class: "kbd active" }, "Esc", -1)),
          a[4] || (a[4] = b("span", null, "取消固定", -1))
        ])) : (O(), j("div", Q2, [
          b("div", X2, [
            a[5] || (a[5] = b("span", null, "按", -1)),
            b("kbd", J2, P(e.pinKey), 1),
            a[6] || (a[6] = b("span", null, "固定提示框", -1))
          ])
        ]))
      ]),
      e.isPinned ? (O(), j("button", {
        key: 0,
        class: "unpin-btn",
        onClick: a[0] || (a[0] = (l) => n("dismiss"))
      }, [...a[7] || (a[7] = [
        b("svg", {
          width: "10",
          height: "10",
          viewBox: "0 0 24 24",
          fill: "none",
          stroke: "currentColor",
          "stroke-width": "2"
        }, [
          b("path", { d: "M18 6L6 18" }),
          b("path", { d: "M6 6l12 12" })
        ], -1),
        b("span", null, "取消固定", -1)
      ])])) : be("", !0)
    ]));
  }
}), tT = /* @__PURE__ */ Vn(eT, [["__scopeId", "data-v-75c52e2f"]]), nT = ["data-is-active"], iT = { class: "tooltip-item-label" }, aT = /* @__PURE__ */ ze({
  __name: "TooltipItem",
  props: {
    item: {},
    isItemActive: { type: Boolean }
  },
  setup(e) {
    return (t, n) => (O(), j("div", {
      class: "tooltip-item",
      "data-is-active": e.isItemActive
    }, [
      b("div", {
        class: "tooltip-item-marker",
        style: Ue({ borderColor: e.item.color })
      }, null, 4),
      b("div", {
        class: "tooltip-item-content",
        style: Ue({ color: e.item.color })
      }, [
        b("span", iT, P(e.item.label), 1),
        b("span", {
          class: "tooltip-item-separator",
          style: Ue({ borderColor: e.item.color })
        }, null, 4),
        b("span", null, P(e.item.tooltipValue), 1)
      ], 4)
    ], 8, nT));
  }
}), lp = /* @__PURE__ */ Vn(aT, [["__scopeId", "data-v-3b1d92d5"]]), lT = { class: "header-container" }, oT = {
  key: 0,
  class: "header-row"
}, sT = {
  key: 0,
  class: "header-status"
}, rT = {
  key: 1,
  class: "header-pinned-item"
}, uT = /* @__PURE__ */ ze({
  __name: "TooltipHeader",
  props: {
    uPlotInstance: {},
    showTooltipHeader: { type: Boolean },
    isPinned: { type: Boolean },
    activeItem: {},
    headerTitle: {}
  },
  setup(e) {
    return (t, n) => (O(), j("div", lT, [
      e.showTooltipHeader && e.headerTitle ? (O(), j("div", oT, [
        b("span", null, P(e.headerTitle), 1),
        e.isPinned ? (O(), j("div", sT, [...n[0] || (n[0] = [
          b("svg", {
            width: "12",
            height: "12",
            viewBox: "0 0 24 24",
            fill: "none",
            stroke: "currentColor",
            "stroke-width": "2"
          }, [
            b("path", { d: "M12 2v4" }),
            b("path", { d: "M19 10h-7l-5 5v7h10v-7l-5-5z" })
          ], -1),
          b("span", null, "已固定", -1)
        ])])) : be("", !0)
      ])) : be("", !0),
      e.activeItem ? (O(), j("div", rT, [
        _(lp, {
          item: e.activeItem,
          "is-item-active": !0
        }, null, 8, ["item"])
      ])) : be("", !0)
    ]));
  }
}), cT = /* @__PURE__ */ Vn(uT, [["__scopeId", "data-v-efb4cf97"]]), dT = /* @__PURE__ */ ze({
  __name: "TooltipList",
  props: {
    content: {},
    maxHeight: { default: 300 }
  },
  setup(e) {
    return (t, n) => (O(), j("div", {
      class: "tooltip-list",
      style: Ue({ maxHeight: `${e.maxHeight}px`, overflowY: "auto" })
    }, [
      (O(!0), j(Oe, null, et(e.content, (i) => (O(), Ce(lp, {
        key: i.label,
        item: i,
        "is-item-active": !1
      }, null, 8, ["item"]))), 128))
    ], 4));
  }
}), fT = /* @__PURE__ */ Vn(dT, [["__scopeId", "data-v-fa17493a"]]), hT = {
  key: 1,
  class: "tooltip-divider"
}, gT = /* @__PURE__ */ ze({
  __name: "Tooltip",
  props: {
    uPlotInstance: {},
    content: {},
    headerTitle: {},
    isPinned: { type: Boolean },
    canPinTooltip: { type: Boolean, default: !0 },
    showTooltipHeader: { type: Boolean, default: !0 },
    tooltipMaxHeight: { default: 300 }
  },
  emits: ["dismiss"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = oe(() => n.content.find((c) => c.isActive) ?? null), l = oe(() => n.showTooltipHeader || a.value != null), u = oe(() => n.content.length > 1), r = oe(() => u.value && l.value);
    return (c, g) => (O(), j("div", {
      class: Re(["tooltip-container", { pinned: e.isPinned }])
    }, [
      l.value ? (O(), Ce(cT, {
        key: 0,
        "u-plot-instance": e.uPlotInstance,
        "show-tooltip-header": e.showTooltipHeader,
        "is-pinned": e.isPinned,
        "active-item": a.value,
        "header-title": e.headerTitle
      }, null, 8, ["u-plot-instance", "show-tooltip-header", "is-pinned", "active-item", "header-title"])) : be("", !0),
      r.value ? (O(), j("span", hT)) : be("", !0),
      u.value ? (O(), Ce(fT, {
        key: 2,
        content: e.content,
        "max-height": e.tooltipMaxHeight
      }, null, 8, ["content", "max-height"])) : be("", !0),
      e.canPinTooltip ? (O(), Ce(tT, {
        key: 3,
        "is-pinned": e.isPinned,
        style: Ue({ pointerEvents: e.isPinned ? "auto" : "none" }),
        onDismiss: g[0] || (g[0] = (y) => i("dismiss"))
      }, null, 8, ["is-pinned", "style"])) : be("", !0)
    ], 2));
  }
}), pT = /* @__PURE__ */ Vn(gT, [["__scopeId", "data-v-4b92f289"]]), Ll = 14, op = /* @__PURE__ */ ze({
  __name: "ChartTooltip",
  props: {
    uPlotInstance: {},
    unit: { default: "" },
    decimals: {},
    canPinTooltip: { type: Boolean, default: !0 },
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" },
    showTooltipHeader: { type: Boolean, default: !0 },
    tooltipMaxHeight: { default: 300 }
  },
  setup(e) {
    const t = e, n = pe(), i = pe(!1), a = pe(!1), l = pe(""), u = pe([]), r = {
      hoverActive: !1,
      pinned: !1,
      focusedSeriesIndex: null,
      seriesIndexes: [],
      mouseWithinPlot: !1,
      windowWidth: window.innerWidth - 16,
      windowHeight: window.innerHeight - 16,
      tooltipW: 0,
      tooltipH: 0,
      // offset state with memory — mirrors React's horizontalOffset/verticalOffset
      horizontalOffset: 0,
      verticalOffset: 0,
      cursorDrivenBySync: !1
    };
    let c = null;
    function g() {
      c === null && (c = requestAnimationFrame(() => {
        c = null, F();
      }));
    }
    function y($, le, ie) {
      return typeof $ == "function" ? String($(le, ie)) : typeof $ == "string" ? $ : "#cccccc";
    }
    function v($, le, ie) {
      const ye = ie !== void 0 ? $.toFixed(ie) : String(Math.round($ * 1e3) / 1e3);
      return le ? `${ye} ${le}` : ye;
    }
    function m($) {
      if (t.tooltipMode === "none")
        return [];
      const le = $.cursor.idx, ie = [];
      for (let ye = 1; ye < $.series.length; ye++) {
        const fe = $.series[ye];
        if (!fe?.show)
          continue;
        let he = r.seriesIndexes[ye] ?? null;
        if (t.tooltipMode === "single") {
          if (ye !== r.focusedSeriesIndex)
            continue;
          he = le ?? he;
        } else
          he = he ?? le ?? null;
        if (he === null)
          continue;
        const ae = $.data[ye]?.[he];
        ae == null || !Number.isFinite(ae) || ie.push({
          label: String(fe.label ?? `Series ${ye}`),
          value: ae,
          tooltipValue: v(ae, t.unit, t.decimals),
          color: y(fe.stroke, $, ye),
          isActive: ye === r.focusedSeriesIndex
        });
      }
      return t.tooltipSort === "asc" && ie.sort((ye, fe) => ye.value - fe.value), t.tooltipSort === "desc" && ie.sort((ye, fe) => fe.value - ye.value), ie;
    }
    function S($) {
      if (!t.showTooltipHeader)
        return "";
      const le = $.cursor.idx;
      if (le == null)
        return "";
      const ie = $.data[0]?.[le];
      return ie == null ? "" : $.scales.x?.time ? new Date(ie * 1e3).toLocaleString() : String(ie);
    }
    function T($, le, ie) {
      const ye = ie + Ll;
      return $ !== 0 ? le + ye < r.windowWidth || le - ye < 0 ? 0 : $ !== -ye ? -ye : $ : le + ye > r.windowWidth && le - ye >= 0 ? -ye : 0;
    }
    function C($, le, ie) {
      const ye = ie + Ll;
      return $ !== 0 ? le + ye < r.windowHeight || le - ye < 0 ? 0 : $ !== -ye ? -ye : $ : le + ye > r.windowHeight && le - ye >= 0 ? -ye : 0;
    }
    function E($, le, ie, ye) {
      const fe = $ + (ie === 0 ? Ll : -Ll), he = le + (ye === 0 ? Ll : -Ll);
      return `translateX(${fe}px) ${ie === 0 ? "" : "translateX(-100%)"} translateY(${he}px) ${ye === 0 ? "" : "translateY(-100%)"}`;
    }
    function X($) {
      if (r.cursorDrivenBySync = $.cursor.event == null, r.pinned || !r.hoverActive)
        return;
      const le = n.value, { left: ie = -1, top: ye = -1 } = $.cursor;
      if (ie < 0 || ye < 0)
        return;
      const fe = $.rect.left + ie, he = $.rect.top + ye, ae = le ? le.offsetWidth : r.tooltipW, ve = le ? le.offsetHeight : r.tooltipH;
      r.tooltipW = ae, r.tooltipH = ve, r.horizontalOffset = T(r.horizontalOffset, fe, ae), r.verticalOffset = C(r.verticalOffset, he, ve);
      const Ne = E(fe, he, r.horizontalOffset, r.verticalOffset);
      le && (le.style.transform = Ne);
    }
    function F() {
      const $ = t.uPlotInstance;
      if (!$ || !r.hoverActive && !r.pinned) {
        i.value = !1;
        return;
      }
      const le = m($);
      if (le.length === 0) {
        r.pinned || (i.value = !1);
        return;
      }
      if (u.value = le, l.value = S($), a.value = r.pinned, !r.pinned) {
        const ie = n.value, { left: ye = -1, top: fe = -1 } = $.cursor;
        if (ie && ye >= 0 && fe >= 0) {
          const he = $.rect.left + ye, ae = $.rect.top + fe;
          ie.style.transform = E(he, ae, r.horizontalOffset, r.verticalOffset);
        }
      }
      i.value = !0;
    }
    function V($) {
      if (r.pinned)
        return;
      const le = $.cursor.idxs;
      if (!le)
        return;
      const ie = r.cursorDrivenBySync;
      r.cursorDrivenBySync = $.cursor.event == null, r.seriesIndexes = [...le];
      const ye = r.seriesIndexes.some((ae, ve) => ve > 0 && ae != null), fe = r.hoverActive;
      r.hoverActive = r.cursorDrivenBySync ? ye : r.focusedSeriesIndex != null, (r.hoverActive !== fe || r.cursorDrivenBySync !== ie) && g();
    }
    function N($, le, ie) {
      !("focus" in ie) || r.pinned || (r.focusedSeriesIndex = le ?? null, r.cursorDrivenBySync = $.cursor.event == null, r.hoverActive = r.focusedSeriesIndex != null, g());
    }
    function Y() {
      const $ = t.uPlotInstance;
      !$ || !r.hoverActive || (r.pinned = !0, $.cursor._lock = !0, a.value = !0, document.addEventListener("mousedown", M, !0));
    }
    function K() {
      const $ = t.uPlotInstance;
      r.pinned = !1, r.hoverActive = !1, $ && ($.cursor._lock = !1), a.value = !1, i.value = !1, document.removeEventListener("mousedown", M, !0);
    }
    function M($) {
      n.value && !n.value.contains($.target) && K();
    }
    function W($) {
      if ($.key === "Escape") {
        r.pinned && K();
        return;
      }
      $.key.toLowerCase() === "p" && r.mouseWithinPlot && (r.pinned ? K() : Y());
    }
    function G() {
      r.mouseWithinPlot = !0;
    }
    function Z() {
      r.mouseWithinPlot = !1;
    }
    function A() {
      r.windowWidth = window.innerWidth - 16, r.windowHeight = window.innerHeight - 16, r.pinned || (r.hoverActive = !1);
    }
    let J = [];
    function ee($) {
      const le = (fe) => V(fe), ie = (fe, he, ae) => N(fe, he, ae), ye = (fe) => X(fe);
      $.hooks.setLegend = [...$.hooks.setLegend ?? [], le], $.hooks.setSeries = [...$.hooks.setSeries ?? [], ie], $.hooks.setCursor = [...$.hooks.setCursor ?? [], ye], $.root.addEventListener("mouseenter", G), $.root.addEventListener("mouseleave", Z), J = [
        () => {
          $.hooks.setLegend = ($.hooks.setLegend ?? []).filter(
            (fe) => fe !== le
          ), $.hooks.setSeries = ($.hooks.setSeries ?? []).filter(
            (fe) => fe !== ie
          ), $.hooks.setCursor = ($.hooks.setCursor ?? []).filter(
            (fe) => fe !== ye
          ), $.root.removeEventListener("mouseenter", G), $.root.removeEventListener("mouseleave", Z);
        }
      ];
    }
    function I() {
      J.forEach(($) => $()), J = [], document.removeEventListener("mousedown", M, !0), r.hoverActive = !1, r.pinned = !1, r.focusedSeriesIndex = null, r.horizontalOffset = 0, r.verticalOffset = 0, r.cursorDrivenBySync = !1, i.value = !1, a.value = !1, c !== null && (cancelAnimationFrame(c), c = null);
    }
    return Ye(
      () => t.uPlotInstance,
      ($, le) => {
        le && I(), $ && ee($);
      },
      { immediate: !0 }
    ), Nn(() => {
      document.addEventListener("keydown", W, !0), window.addEventListener("resize", A);
    }), Fa(() => {
      I(), document.removeEventListener("keydown", W, !0), window.removeEventListener("resize", A);
    }), ($, le) => (O(), Ce(xp, { to: "body" }, [
      $f(b("div", {
        ref_key: "containerRef",
        ref: n,
        style: { position: "fixed", top: "0", left: "0", "z-index": "1070", "pointer-events": "none" }
      }, [
        e.uPlotInstance ? (O(), Ce(pT, {
          key: 0,
          "u-plot-instance": e.uPlotInstance,
          content: u.value,
          "header-title": l.value,
          "is-pinned": a.value,
          "can-pin-tooltip": e.canPinTooltip,
          "show-tooltip-header": e.showTooltipHeader,
          "tooltip-max-height": e.tooltipMaxHeight,
          onDismiss: K
        }, null, 8, ["u-plot-instance", "content", "header-title", "is-pinned", "can-pin-tooltip", "show-tooltip-header", "tooltip-max-height"])) : be("", !0)
      ], 512), [
        [Af, i.value && e.tooltipMode !== "none"]
      ])
    ]));
  }
}), sp = Symbol("plotContext");
function mT() {
  const e = pe(null), t = pe(""), n = pe(!1);
  let i;
  function a(y) {
    e.value = y.uPlotInstance, y.id !== void 0 && (t.value = y.id), y.shouldSaveSelectionPreference !== void 0 && (n.value = y.shouldSaveSelectionPreference), i = void 0;
  }
  function l() {
    const y = e.value;
    if (!y || !t.value)
      return;
    const v = y.series.map((m) => ({
      label: m.label ?? "",
      show: m.show ?? !0
    }));
    Kb(t.value, v);
  }
  function u(y) {
    const v = e.value;
    if (!v)
      return;
    const m = i === y;
    i = m ? void 0 : y, v.batch(() => {
      v.series.forEach((S, T) => {
        T !== 0 && v.setSeries(T, {
          show: m || T === y
        });
      }), t.value && n.value && l();
    });
  }
  function r(y) {
    const v = e.value;
    if (!v)
      return;
    const m = v.series[y];
    m && (v.setSeries(y, { show: !m.show }), t.value && n.value && l());
  }
  function c(y) {
    const v = e.value;
    v && v.batch(() => {
      v.series.forEach((m, S) => {
        S !== 0 && v.setSeries(S, {
          show: y === null || S === y
        });
      });
    });
  }
  const g = {
    uPlotInstance: e,
    id: t,
    shouldSaveSelectionPreference: n,
    setPlotContextInitialState: a,
    onToggleSeriesVisibility: u,
    onToggleSeriesOnOff: r,
    onFocusSeries: c,
    syncSeriesVisibilityToLocalStorage: l
  };
  return fl(sp, g), g;
}
function GI() {
  const e = dl(sp);
  if (!e)
    throw new Error("usePlotContext must be used within a PlotContextProvider");
  return e;
}
const vT = { style: { position: "relative", overflow: "hidden" } }, rp = /* @__PURE__ */ ze({
  __name: "UPlotChart",
  props: {
    config: {},
    data: {},
    width: {},
    height: {},
    plotRef: {},
    onDestroy: {}
  },
  emits: ["plotReady"],
  setup(e, { expose: t, emit: n }) {
    const i = e, a = n, { setPlotContextInitialState: l } = mT(), u = pe(), r = pe(null), c = pe(""), g = pe(""), y = pe(0), v = pe(0);
    function m() {
      r.value && (i.onDestroy && i.onDestroy(r.value), r.value.destroy(), r.value = null, l({ uPlotInstance: null }), i.plotRef && i.plotRef(null));
    }
    function S(Y) {
      if (Y === null || typeof Y != "object")
        return Y;
      const K = Lr(Y);
      if (K instanceof Date)
        return new Date(K.getTime());
      if (K instanceof RegExp)
        return new RegExp(K.source, K.flags);
      if (typeof K == "function")
        return K;
      if (Array.isArray(K)) {
        const W = [];
        for (let G = 0; G < K.length; G++)
          W.push(S(Lr(K[G])));
        return W;
      }
      const M = {};
      for (const W in K)
        Object.prototype.hasOwnProperty.call(K, W) && (M[W] = S(Lr(K[W])));
      return M;
    }
    function T() {
      if (m(), !u.value || i.width === 0 || i.height === 0)
        return;
      const Y = i.config.getConfig(), M = S({
        ...Y,
        width: Math.floor(i.width),
        height: Math.floor(i.height),
        series: Y.series ?? []
      }), W = E(i.data, i.config), G = new rn(M, W, u.value);
      i.plotRef && i.plotRef(G), l({
        uPlotInstance: G,
        id: i.config.getId(),
        shouldSaveSelectionPreference: i.config.getShouldSaveSelectionPreference()
      }), r.value = G, a("plotReady", G), c.value = JSON.stringify(i.config.getConfig()), g.value = JSON.stringify(i.data), y.value = i.width, v.value = i.height;
    }
    function C(Y) {
      return JSON.parse(JSON.stringify(Y));
    }
    function E(Y, K) {
      const M = C(Y), W = K.getSeriesSpanGapsOptions();
      return W.length > 0 ? gw(M, W) : M;
    }
    function X() {
      return i.width === y.value && i.height === v.value;
    }
    function F() {
      return JSON.stringify(i.data) === g.value;
    }
    function V() {
      return JSON.stringify(i.config.getConfig()) === c.value;
    }
    const N = oe(() => !!(i.data && i.data[0] && i.data[0].length === 0));
    return Ye(N, (Y) => {
      Y && m();
    }), Ys((Y) => {
      if (Y(() => {
        m(), c.value = "", g.value = "", y.value = 0, v.value = 0;
      }), !u.value || i.width === 0 || i.height === 0)
        return;
      if (!c.value) {
        T();
        return;
      }
      const K = !!r.value && (!u.value || r.value.root.parentElement !== u.value);
      if (!X() && r.value && !K && r.value.setSize({
        width: Math.floor(i.width),
        height: Math.floor(i.height)
      }), !V() || K)
        T();
      else if (!F() && r.value) {
        const M = E(i.data, i.config);
        r.value.setData(M);
      }
    }), pl(() => {
      m();
    }), t({ plotInstance: r }), (Y, K) => (O(), j("div", vT, [
      N.value ? (O(), j("div", {
        key: 0,
        class: "flex flex-col items-center justify-center not-found",
        style: Ue({
          width: `${e.width}px`,
          height: `${e.height}px`
        })
      }, [
        b("div", {
          class: Re([f(De).chartLine, "mb-2"]),
          style: { "font-size": "48px" }
        }, null, 2),
        K[0] || (K[0] = b("div", { class: "text-gray-400 text-sm" }, " No Data ", -1))
      ], 4)) : (O(), j("div", {
        key: 1,
        ref_key: "containerRef",
        ref: u,
        class: "w-full h-full"
      }, null, 512)),
      An(Y.$slots, "default")
    ]));
  }
}), yT = {
  key: 0,
  class: "flex items-center justify-center h-full text-gray-400 select-none"
}, up = /* @__PURE__ */ ze({
  __name: "AgChart",
  props: {
    data: {},
    unit: {},
    decimals: {},
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    thresholds: {},
    thresholdBaseColor: {},
    fillOpacity: { default: 10 },
    lineWidth: { default: 1.5 },
    lineInterpolation: { default: "linear" },
    lineStyle: { default: "solid" },
    drawStyle: { default: "lines" },
    gradientMode: { default: "none" },
    spanNulls: { type: [Boolean, Number], default: !1 },
    showPoints: { type: Boolean, default: !1 },
    showPointsMode: { default: "auto" },
    stackingMode: { default: "none" },
    legendPosition: { default: "bottom" },
    legendMode: { default: "list" },
    legendValues: { default: () => [] },
    syncKey: {},
    panelId: {},
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" },
    tooltipMaxHeight: {},
    showAxisPointer: { type: Boolean, default: !0 },
    softMin: {},
    softMax: {},
    axisPlacement: { default: "left" },
    axisName: {},
    axisWidth: {},
    showGridLines: { default: "all" },
    gridColor: {},
    axisLabel: { default: "all" },
    axisLabelColor: {},
    axisTick: { default: "hidden" },
    axisTickColor: {},
    axisBorder: { default: "hidden" },
    axisBorderColor: {},
    scaleDistribution: { default: "linear" },
    centeredZero: { type: Boolean, default: !1 },
    xAxisTime: { type: Boolean, default: !0 },
    barGroupWidth: {},
    barWidth: {}
  },
  setup(e) {
    const t = e, n = pe(), i = pe({ width: 0, height: 0 });
    let a = null;
    function l(E) {
      a = new ResizeObserver((X) => {
        const F = X[0];
        if (F) {
          const { width: V, height: N } = F.contentRect;
          setTimeout(() => {
            i.value = { width: Math.floor(V), height: Math.floor(N) };
          }, 300);
        }
      }), a.observe(E), requestAnimationFrame(() => {
        const { width: X, height: F } = E.getBoundingClientRect();
        i.value = { width: Math.floor(X), height: Math.floor(F) };
      });
    }
    Nn(() => {
      n.value && l(n.value);
    }), Ye(n, (E) => {
      a?.disconnect(), E && l(E);
    }), pl(() => {
      a?.disconnect();
    });
    const u = oe(() => {
      const E = new Mg({ id: t.panelId ?? "chart" }), X = t.scaleDistribution ?? "linear", F = t.stackingMode !== "none";
      E.addScale({ scaleKey: "x", time: t.xAxisTime }), E.addScale({
        scaleKey: "y",
        distribution: X === "logarithmic" ? sl.Logarithmic : X === "symlog" ? sl.Symlog : sl.Linear,
        softMin: F && t.stackingMode === "percent" ? 0 : t.softMin ?? void 0,
        softMax: F && t.stackingMode === "percent" ? 100 : t.softMax ?? void 0,
        ...t.centeredZero ? {
          range: (qe, nt, Ze) => {
            const Ct = Math.max(Math.abs(nt), Math.abs(Ze));
            return [-Ct, Ct];
          }
        } : {}
      });
      const V = t.gridColor ?? "#E8E9EA", N = t.showGridLines === "all" || t.showGridLines === "x", Y = t.showGridLines === "all" || t.showGridLines === "y", K = t.axisLabel === "all" || t.axisLabel === "x", M = t.axisLabel === "all" || t.axisLabel === "y", W = K ? t.axisLabelColor ?? "#666666" : "transparent", G = M ? t.axisLabelColor ?? "#666666" : "transparent", Z = t.axisTick === "all" || t.axisTick === "x", A = t.axisTick === "all" || t.axisTick === "y", J = Z ? t.axisTickColor ?? "#666666" : "transparent", ee = A ? t.axisTickColor ?? "#666666" : "transparent", I = t.axisBorder === "all" || t.axisBorder === "x", $ = t.axisBorder === "all" || t.axisBorder === "y", le = t.axisBorderColor ?? "#666666";
      E.addAxis({
        scaleKey: "x",
        side: 2,
        size: 28,
        stroke: W,
        grid: { show: N, stroke: V },
        ticks: { show: Z, stroke: J, width: 0.5 },
        border: { show: I, stroke: le }
      });
      const ie = t.axisPlacement === "right" ? 1 : 3, ye = t.axisPlacement !== "hidden", fe = (() => {
        if (t.axisWidth !== void 0 && t.axisWidth !== null)
          return t.axisWidth;
        const qe = t.data.series.reduce((mt, It) => mt.concat(It.values.filter((vt) => vt !== null && Number.isFinite(vt))), []);
        if (qe.length === 0)
          return 56;
        const nt = qe.reduce((mt, It) => Math.max(mt, Math.abs(It)), 0), Ze = t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15, Bt = ((mt) => {
          if (Math.abs(mt) >= 1e6) {
            const vt = Ze !== void 0 ? (mt / 1e6).toFixed(Ze) : String(mt / 1e6);
            return t.unit ? `${vt}M ${t.unit}` : `${vt}M`;
          }
          if (Math.abs(mt) >= 1e3) {
            const vt = Ze !== void 0 ? (mt / 1e3).toFixed(Ze) : String(mt / 1e3);
            return t.unit ? `${vt}K ${t.unit}` : `${vt}K`;
          }
          const It = Ze !== void 0 ? mt.toFixed(Ze) : String(Math.round(mt * 100) / 100);
          return t.unit ? `${It} ${t.unit}` : It;
        })(nt);
        try {
          const mt = document.createElement("canvas").getContext("2d");
          if (!mt)
            return 56;
          mt.font = "12px system-ui, sans-serif";
          const It = mt.measureText(Bt).width;
          return Math.ceil(It) + 14;
        } catch {
          return 56;
        }
      })(), he = t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15;
      E.addAxis({
        scaleKey: "y",
        side: ie,
        show: ye,
        label: t.axisName || void 0,
        size: fe,
        stroke: G,
        grid: { show: Y, stroke: V },
        ticks: { show: A, stroke: ee, width: 0.5 },
        border: { show: $, stroke: le },
        isDarkMode: !0,
        yAxisUnit: t.unit,
        decimalPrecision: he,
        isLogScale: X === "logarithmic" || X === "symlog"
      });
      const ae = Nh(
        t.colorScheme,
        t.data.series.length,
        t.colorDistribution ?? "sequential",
        t.colorSingleValue
      ), ve = t.drawStyle === "bars", Ne = t.drawStyle === "points", we = t.data.series.length, Me = t.barGroupWidth ?? 0.7, ue = t.barWidth ?? (t.stackingMode !== "none" ? 1 : 1 / Math.max(we, 1)), se = ve ? Me * ue : void 0, Pe = Ne || t.showPointsMode === "always" ? !0 : t.showPointsMode === "never" ? !1 : t.showPoints, xe = F ? "none" : t.fillOpacity > 0 ? t.gradientMode !== "none" ? "gradient" : "solid" : "none";
      if (t.data.series.forEach((qe, nt) => {
        const Ze = ae[nt] ?? Ra[nt % Ra.length];
        E.addSeries({
          scaleKey: "y",
          label: qe.label,
          drawStyle: ve ? "bars" : Ne ? "points" : "lines",
          lineColor: Ze,
          lineWidth: t.lineWidth,
          lineInterpolation: t.lineInterpolation,
          lineStyle: t.lineStyle,
          fillColor: Ze,
          fillOpacity: t.fillOpacity,
          fillMode: xe,
          showPoints: Pe,
          pointSize: Pe ? 4 : 0,
          spanGaps: t.spanNulls ?? !1,
          ...se !== void 0 ? { barWidthFactor: se } : {}
        });
      }), F && t.data.series.length > 0 && t.fillOpacity > 0) {
        const qe = ae.length > 0 ? ae : [...Ra], nt = Math.round(Math.min(t.fillOpacity, 100) / 100 * 255).toString(16).padStart?.(2, "0") || Math.round(Math.min(t.fillOpacity, 100) / 100 * 255).toString(16), Ze = t.data.series.map((Ct, Bt) => ({
          series: [Bt + 1, Bt],
          fill: `${qe[Bt % qe.length]}${nt}`
        }));
        Ze.length > 0 && (Ze[0] = { series: [1, 0], fill: `${qe[0]}${nt}` }), E.setBands(Ze);
      }
      return t.syncKey && E.setCursor({ sync: { key: t.syncKey, setSeries: !0 } }), t.showAxisPointer || E.setCursor({ x: !1, y: !1 }), E.setCursor({
        drag: { setScale: !0 },
        points: {
          one: !0,
          size: (qe, nt) => (qe.series[nt]?.points?.size ?? 0) * 3,
          width: (qe, nt, Ze) => Ze / 4,
          stroke: (qe, nt) => {
            const Ze = qe.series[nt]?.points, Ct = typeof Ze?.stroke == "function" ? Ze.stroke : void 0;
            return `${Ct !== void 0 ? Ct(qe, nt) : typeof Ze?.stroke == "string" ? Ze.stroke : ""}90`;
          },
          fill: "#fff"
        },
        focus: {
          prox: 30
        },
        hover: {
          prox: 30,
          bias: 0
        }
      }), E;
    }), r = oe(() => {
      const E = t.data?.timestamps ?? [], X = JSON.parse(JSON.stringify(E));
      if (X.length === 0 || !t.data)
        return [[]];
      const F = t.data.series.map((V) => JSON.parse(JSON.stringify(V.values.map((N) => N ?? 0))));
      if (t.stackingMode !== "none" && t.data.series.length > 0) {
        const V = X.length, N = Array.from({ length: V }, () => 0), Y = [];
        for (const K of t.data.series) {
          const M = Array.from({ length: V });
          for (let W = 0; W < V; W++) {
            if (t.stackingMode === "percent") {
              let G = 0;
              for (const Z of t.data.series)
                G += Z.values[W] ?? 0;
              N[W] = N[W] + (K.values[W] ?? 0) / (G || 1) * 100;
            } else
              N[W] = N[W] + (K.values[W] ?? 0);
            M[W] = N[W];
          }
          Y.push(M);
        }
        return [X, ...Y];
      }
      return [X, ...F];
    }), c = oe(() => !t.data || t.data.timestamps.length === 0 || t.data.series.length === 0), g = pe(null);
    function y(E) {
      g.value = E;
    }
    const v = oe(() => t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15), m = oe(() => t.legendPosition === "right"), S = oe(() => t.legendPosition !== "hidden" && t.data.series.length > 0), T = oe(() => m.value && S.value ? Math.max(i.value.width - 160, 100) : i.value.width), C = oe(() => Math.max(i.value.height, 50));
    return (E, X) => (O(), j("div", {
      class: Re(["w-full h-full flex overflow-hidden relative", m.value ? "flex-row" : "flex-col"])
    }, [
      c.value ? (O(), j("div", yT, [...X[0] || (X[0] = [
        b("span", { class: "text-xs" }, "No data", -1)
      ])])) : be("", !0),
      b("div", {
        ref_key: "chartAreaRef",
        ref: n,
        class: "flex-1 min-h-0 min-w-0 relative overflow-hidden"
      }, [
        _(rp, {
          config: u.value,
          data: r.value,
          width: T.value,
          height: C.value,
          onPlotReady: y
        }, {
          default: q(() => [
            _(op, {
              "u-plot-instance": g.value,
              unit: t.unit,
              decimals: v.value,
              "can-pin-tooltip": !0,
              "tooltip-mode": t.tooltipMode,
              "tooltip-sort": t.tooltipSort,
              "tooltip-max-height": t.tooltipMaxHeight
            }, null, 8, ["u-plot-instance", "unit", "decimals", "tooltip-mode", "tooltip-sort", "tooltip-max-height"])
          ]),
          _: 1
        }, 8, ["config", "data", "width", "height"])
      ], 512),
      S.value ? (O(), j("div", {
        key: 1,
        style: Ue(
          m.value ? { width: "160px", flexShrink: 0, height: "100%", padding: "4px 8px", overflow: "auto", zIndex: 10, position: "relative", pointerEvents: "auto" } : { flexShrink: 0, padding: "2px 4px", overflow: "auto", maxHeight: "140px", zIndex: 10, position: "relative", pointerEvents: "auto" }
        )
      }, [
        _(ap, {
          items: u.value.getLegendItems(),
          "u-plot-instance": g.value,
          position: m.value ? "right" : "bottom",
          mode: t.legendMode ?? "list",
          values: t.legendValues ?? [],
          data: r.value,
          decimals: v.value,
          unit: t.unit
        }, null, 8, ["items", "u-plot-instance", "position", "mode", "values", "data", "decimals", "unit"])
      ], 4)) : be("", !0)
    ], 2));
  }
}), bT = /* @__PURE__ */ ze({
  __name: "BarPanel",
  props: {
    data: {},
    stacked: { type: Boolean, default: !1 },
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    barWidth: {},
    barGroupWidth: { default: 0.7 },
    showValues: { default: "auto" },
    unit: {},
    decimals: { default: 0 },
    legendPosition: { default: "bottom" },
    legendMode: { default: "list" },
    legendValues: { default: () => [] },
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" }
  },
  setup(e) {
    return (t, n) => (O(), Ce(up, {
      data: e.data,
      "draw-style": "bars",
      "stacking-mode": e.stacked ? "normal" : "none",
      "color-scheme": e.colorScheme,
      "color-single-value": e.colorSingleValue,
      "color-distribution": e.colorDistribution,
      unit: e.unit,
      decimals: e.decimals,
      "fill-opacity": 80,
      "bar-group-width": e.barGroupWidth,
      "bar-width": e.barWidth,
      "legend-position": e.legendPosition,
      "legend-mode": e.legendMode,
      "legend-values": e.legendValues,
      "tooltip-mode": e.tooltipMode,
      "tooltip-sort": e.tooltipSort
    }, null, 8, ["data", "stacking-mode", "color-scheme", "color-single-value", "color-distribution", "unit", "decimals", "bar-group-width", "bar-width", "legend-position", "legend-mode", "legend-values", "tooltip-mode", "tooltip-sort"]));
  }
}), xT = {
  key: 0,
  style: { "text-align": "center", "font-size": "11px", color: "#888", padding: "2px 4px 4px", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }
}, uu = 2, wT = /* @__PURE__ */ ze({
  __name: "GaugePanel",
  props: {
    series: {},
    value: { default: 0 },
    title: {},
    min: { default: Nt.min },
    max: { default: Nt.max },
    unit: {},
    thresholds: {},
    thresholdBaseColor: {},
    capRound: { type: Boolean, default: Nt.capRound },
    trackWidth: { default: Nt.trackWidth },
    fillWidth: { default: Nt.fillWidth },
    trackColor: { default: Nt.trackColor },
    sweepAngle: { default: Nt.sweepAngle },
    valueColor: { default: Nt.valueColor },
    valueSize: { default: Nt.valueSize },
    valueVisible: { type: Boolean, default: Nt.valueVisible },
    paddingX: { default: Nt.paddingX },
    paddingY: { default: Nt.paddingY },
    activeColorOverride: {},
    thresholdDisplay: { default: Nt.thresholdDisplay },
    thresholdLabelDisplay: { default: Nt.thresholdLabelDisplay },
    valueOffsetY: { default: Nt.valueOffsetY },
    orientation: { default: Nt.orientation }
  },
  setup(e) {
    const t = e, n = pe(), i = pe({ w: 0, h: 0 });
    let a = null;
    function l(F, V, N = 2) {
      const Y = F.toFixed(N);
      return V === "percent" ? `${Y}%` : V === "bytes" ? F >= 1024 * 1024 ? `${(F / 1024 / 1024).toFixed(1)} MB` : F >= 1024 ? `${(F / 1024).toFixed(1)} KB` : `${F} B` : V ? `${Y} ${V}` : Y;
    }
    function u(F, V, N) {
      const Y = [...N].sort((M, W) => M.value - W.value);
      let K = V;
      for (const M of Y)
        F >= M.value && (K = M.color);
      return K;
    }
    function r(F, V) {
      const N = F.match(/^#([0-9a-f]{6})([0-9a-f]{2})?$/i);
      if (N) {
        const K = Number.parseInt(N[1].slice(0, 2), 16), M = Number.parseInt(N[1].slice(2, 4), 16), W = Number.parseInt(N[1].slice(4, 6), 16);
        return `rgba(${K},${M},${W},${V})`;
      }
      const Y = F.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
      return Y ? `rgba(${Y[1]},${Y[2]},${Y[3]},${V})` : F;
    }
    function c(F, V, N, Y, K, M, W, G, Z, A, J, ee, I, $, le, ie, ye, fe, he, ae, ve, Ne) {
      const we = F.getContext("2d");
      if (!we)
        return;
      const Me = window.devicePixelRatio || 1, ue = F.clientWidth, se = F.clientHeight;
      if (ue === 0 || se === 0)
        return;
      F.width = ue * Me, F.height = se * Me, we.scale(Me, Me), we.clearRect(0, 0, ue, se);
      const Pe = ee * Math.PI / 180, xe = (ee + I) * Math.PI / 180;
      let qe, nt, Ze, Ct;
      if (I >= 360)
        qe = -1, nt = 1, Ze = -1, Ct = 1;
      else {
        qe = Math.cos(Pe), nt = Math.cos(Pe), Ze = Math.sin(Pe), Ct = Math.sin(Pe);
        const Mt = (zt) => {
          qe = Math.min(qe, Math.cos(zt)), nt = Math.max(nt, Math.cos(zt)), Ze = Math.min(Ze, Math.sin(zt)), Ct = Math.max(Ct, Math.sin(zt));
        };
        Mt(xe);
        const en = [0, 90, 180, 270, 360, 450, 540].map((zt) => zt * Math.PI / 180);
        for (const zt of en) {
          const qt = (_n) => (_n % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI), hn = qt(Pe), Wn = qt(xe), Le = qt(zt);
          (hn <= Wn ? Le >= hn && Le <= Wn : Le >= hn || Le <= Wn) && Mt(zt);
        }
      }
      const Bt = nt - qe, mt = Ct - Ze, It = Math.min(ue, se), vt = It / 300, Ht = ye * vt, pi = fe * vt, ln = Math.max(0, ue - 2 * Ht), wn = Math.max(0, se - 2 * pi), He = Ht, re = pi, $e = Z * vt, Te = A * vt, Ke = ae === "marker", yt = ae === "track", Qe = Ke ? Math.max(2, It * 0.04) : 0, Fe = Ke ? Math.max($e, Te) / 2 + 2 + Qe : Math.max($e, Te) / 2, at = Math.min((ln - Fe * 2) / Bt, (wn - Fe * 2) / mt);
      if (at < 10)
        return;
      const rt = He + ln / 2 - (qe + nt) / 2 * at, ut = re + wn / 2 - (Ze + Ct) / 2 * at, Et = Y - N || 1, Zt = Math.max(N, Math.min(Y, V)), un = (Zt - N) / Et, Dn = Pe + un * (xe - Pe), kn = he ?? u(Zt, W, M), dn = G ? "round" : "butt";
      we.beginPath(), we.arc(rt, ut, at, Pe, xe), we.strokeStyle = J, we.lineWidth = $e, we.lineCap = dn, we.stroke();
      const Lt = [...M].sort((Mt, en) => Mt.value - en.value), fn = [];
      if (Lt.length === 0)
        fn.push({ from: N, to: Y, color: W });
      else {
        fn.push({ from: N, to: Lt[0].value, color: W });
        for (let Mt = 0; Mt < Lt.length; Mt++)
          fn.push({ from: Lt[Mt].value, to: Mt + 1 < Lt.length ? Lt[Mt + 1].value : Y, color: Lt[Mt].color });
      }
      if (yt) {
        const Mt = (xe - Pe) / (2 * Math.PI), en = we.createConicGradient(Pe, rt, ut);
        for (const zt of fn) {
          const qt = Math.min(1, (Math.max(N, zt.from) - N) / Et * Mt), hn = Math.min(1, (Math.min(Y, zt.to) - N) / Et * Mt);
          en.addColorStop(qt, r(zt.color, 0.25)), en.addColorStop(hn, r(zt.color, 0.25));
        }
        en.addColorStop(1, r(fn[0].color, 0.25)), we.beginPath(), we.arc(rt, ut, at, Pe, xe), we.strokeStyle = en, we.lineWidth = $e, we.lineCap = dn, we.stroke();
      }
      if (un > 0 && (we.beginPath(), we.arc(rt, ut, at, Pe, Dn), we.strokeStyle = kn, we.lineWidth = Te, we.lineCap = dn, we.stroke()), Ke && fn.length > 0) {
        const Mt = at + Math.max($e, Te) / 2 + Qe / 2 + 2, en = (xe - Pe) / (2 * Math.PI), zt = we.createConicGradient(Pe, rt, ut);
        for (const qt of fn) {
          const hn = Math.min(1, (Math.max(N, qt.from) - N) / Et * en), Wn = Math.min(1, (Math.min(Y, qt.to) - N) / Et * en);
          zt.addColorStop(hn, qt.color), zt.addColorStop(Wn, qt.color);
        }
        zt.addColorStop(1, fn[0].color), we.beginPath(), we.arc(rt, ut, Mt, Pe, xe), we.strokeStyle = zt, we.lineWidth = Qe, we.lineCap = dn, we.stroke();
      }
      if (Ne !== "none" && M.length > 0) {
        const Mt = Math.max(8, 11 * vt), en = at + Math.max($e, Te) / 2 + (Ke ? Qe + 4 : 4) + Mt * 0.6, zt = Y - N || 1;
        we.font = `${Mt}px system-ui, sans-serif`, we.textBaseline = "middle";
        for (const qt of M) {
          const hn = (qt.value - N) / zt;
          if (hn < 0 || hn > 1)
            continue;
          const Wn = Pe + hn * (xe - Pe), Le = rt + Math.cos(Wn) * en, _n = ut + Math.sin(Wn) * en, Qt = Le - rt;
          if (we.textAlign = Qt > 1 ? "left" : Qt < -1 ? "right" : "center", we.fillStyle = qt.color, Ne === "label" || Ne === "both") {
            const On = qt.label || String(qt.value);
            Ne === "both" ? (we.fillText(On, Le, _n - Mt * 0.6), we.fillText(l(qt.value, K, 1), Le, _n + Mt * 0.6)) : we.fillText(On, Le, _n);
          } else
            we.fillText(l(qt.value, K, 1), Le, _n);
        }
      }
      if (ie) {
        const Mt = Math.max(4, le * vt), en = l(Zt, K, 2), zt = ut + Ze * at - Te / 2, qt = ut + Ct * at + Te / 2, hn = (zt + qt) / 2;
        we.textAlign = "center", we.textBaseline = "middle", we.fillStyle = $, we.font = `600 ${Mt}px system-ui, sans-serif`, we.fillText(en, rt, hn + ve * vt);
      }
    }
    function g(F, V, N) {
      const Y = Math.ceil(Math.sqrt(N * F / V));
      return Math.floor(Y * V / F) * Y < N ? V / Math.ceil(Y * V / F) : F / Y;
    }
    function y(F, V, N, Y) {
      const K = Math.max(g(F, V, Y), g(V, F, Y));
      let M = Math.max(1, Math.floor(F / K));
      const W = Math.ceil(Y / M);
      return M = Math.ceil(Y / W), { xCount: M, yCount: W, cellW: F / M - N + N / M, cellH: V / W - N + N / W };
    }
    const v = oe(
      () => t.series && t.series.length > 0 ? t.series : [{ label: t.title ?? "", value: t.value ?? 0, activeColorOverride: t.activeColorOverride }]
    ), m = oe(() => v.value.length), S = oe(() => t.thresholds && t.thresholds.length > 0 ? t.thresholds : []), T = oe(() => t.thresholdBaseColor ?? "#52c41a"), C = oe(() => {
      const F = i.value.w, V = i.value.h;
      return F <= 0 || V <= 0 ? { xCount: 1, yCount: 1, cellW: 0, cellH: 0 } : t.orientation === "horizontal" ? { xCount: m.value, yCount: 1, cellW: (F - uu * (m.value - 1)) / m.value, cellH: V } : t.orientation === "vertical" ? { xCount: 1, yCount: m.value, cellW: F, cellH: (V - uu * (m.value - 1)) / m.value } : y(F, V, uu, m.value);
    });
    Nn(() => {
      n.value && (a = new ResizeObserver((F) => {
        const V = F[0].contentRect;
        i.value = { w: V.width, h: V.height };
      }), a.observe(n.value));
    }), Fa(() => {
      a?.disconnect();
    });
    const E = pe({});
    function X() {
      Un(() => {
        for (let F = 0; F < v.value.length; F++) {
          const V = E.value[F];
          if (!V)
            continue;
          const N = v.value[F];
          c(
            V,
            N.value,
            t.min,
            t.max,
            t.unit,
            S.value,
            T.value,
            t.capRound,
            t.trackWidth,
            t.fillWidth,
            t.trackColor,
            270 - t.sweepAngle / 2,
            t.sweepAngle,
            t.valueColor,
            t.valueSize,
            t.valueVisible,
            t.paddingX,
            t.paddingY,
            N.activeColorOverride ?? t.activeColorOverride,
            t.thresholdDisplay,
            t.valueOffsetY,
            t.thresholdLabelDisplay
          );
        }
      });
    }
    return Ye(() => [
      v.value,
      t.min,
      t.max,
      t.unit,
      t.thresholds,
      t.thresholdBaseColor,
      t.capRound,
      t.trackWidth,
      t.fillWidth,
      t.trackColor,
      t.sweepAngle,
      t.valueColor,
      t.valueSize,
      t.valueVisible,
      t.paddingX,
      t.paddingY,
      t.thresholdDisplay,
      t.valueOffsetY,
      t.thresholdLabelDisplay,
      i.value
    ], X, { deep: !0, immediate: !0 }), (F, V) => (O(), j("div", {
      ref_key: "containerRef",
      ref: n,
      style: Ue([{ width: "100%", height: "100%", display: "grid", gap: "2px" }, {
        gridTemplateColumns: `repeat(${C.value.xCount}, 1fr)`,
        gridTemplateRows: `repeat(${C.value.yCount}, 1fr)`
      }])
    }, [
      (O(!0), j(Oe, null, et(v.value, (N, Y) => (O(), j("div", {
        key: `${N.label}-${Y}`,
        style: { width: "100%", height: "100%", display: "flex", "flex-direction": "column", overflow: "hidden" }
      }, [
        b("canvas", {
          ref_for: !0,
          ref: (K) => {
            K && (E.value[Y] = K);
          },
          style: { flex: "1", width: "100%", height: "0", display: "block", "min-height": "0" }
        }, null, 512),
        m.value > 1 && N.label ? (O(), j("div", xT, P(N.label), 1)) : be("", !0)
      ]))), 128))
    ], 4));
  }
}), ST = { class: "w-full h-full flex flex-col overflow-hidden" }, kT = {
  key: 0,
  style: { "flex-shrink": "0", padding: "2px 4px", overflow: "auto", "max-height": "140px" }
}, _T = /* @__PURE__ */ ze({
  __name: "HistogramPanel",
  props: {
    seriesValues: {},
    seriesLabels: {},
    bucketSize: {},
    bucketCount: {},
    bucketOffset: {},
    combineSeries: { type: Boolean, default: !1 },
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    lineWidth: { default: 1 },
    fillOpacity: { default: 80 },
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" },
    unit: { default: "" }
  },
  setup(e) {
    const t = e;
    function n(m, S) {
      const T = m.filter((G) => Number.isFinite(G));
      if (T.length === 0)
        return { bucketStarts: [], counts: [] };
      const C = T.reduce((G, Z) => Math.min(G, Z), 1 / 0), E = T.reduce((G, Z) => Math.max(G, Z), -1 / 0), X = E - C || 1, F = S.bucketOffset ?? 0, V = S.bucketCount ?? 30, N = S.bucketSize ?? X / V, Y = Math.floor((C - F) / N) * N + F, K = [], M = [];
      let W = Y;
      for (; W <= E; )
        K.push(W), M.push(0), W += N;
      for (const G of T) {
        const Z = Math.floor((G - Y) / N), A = Math.min(Z, M.length - 1);
        A >= 0 && M[A]++;
      }
      return { bucketStarts: K, counts: M };
    }
    const i = oe(() => {
      const m = { bucketSize: t.bucketSize, bucketCount: t.bucketCount, bucketOffset: t.bucketOffset };
      if (t.combineSeries || t.seriesValues.length === 0) {
        const { bucketStarts: E, counts: X } = n(t.seriesValues.flat(), m);
        return { bucketStarts: E, countSeries: [X], labels: ["combined"] };
      }
      const { bucketStarts: S } = n(t.seriesValues.flat(), m), T = S.length > 1 ? S[1] - S[0] : void 0, C = t.seriesValues.map((E) => {
        const { counts: X } = n(E, { ...m, bucketSize: T });
        return Array.from({ length: S.length }, (F, V) => X[V] ?? 0);
      });
      return { bucketStarts: S, countSeries: C, labels: t.seriesLabels };
    }), a = oe(() => {
      const { countSeries: m, labels: S } = i.value, T = new Mg({ id: "histogram" });
      T.addScale({ scaleKey: "x", time: !1 }), T.addScale({ scaleKey: "y", auto: !0 }), T.addAxis({
        scaleKey: "x",
        side: 2,
        stroke: "#666",
        grid: { show: !1 },
        isTimeAxis: !1
      }), T.addAxis({
        scaleKey: "y",
        side: 3,
        stroke: "#666",
        grid: { show: !0, stroke: "rgba(128,128,128,0.15)", width: 1 },
        size: 50,
        isDarkMode: !0,
        yAxisUnit: t.unit
      });
      const C = Nh(
        t.colorScheme,
        m.length,
        t.colorDistribution ?? "sequential",
        t.colorSingleValue
      ), E = {};
      S.forEach((F, V) => {
        E[F] = C[V % C.length];
      });
      const X = Math.round(t.fillOpacity / 100 * 255).toString(16).padStart(2, "0");
      return m.forEach((F, V) => {
        const N = C[V % C.length];
        T.addSeries({
          scaleKey: "y",
          label: S[V] ?? `series-${V + 1}`,
          drawStyle: Wi.Histogram,
          lineColor: N,
          lineWidth: t.lineWidth,
          fillColor: `${N}${X}`,
          fillOpacity: t.fillOpacity,
          fillMode: qo.Solid,
          colorMapping: E,
          isDarkMode: !0
        });
      }), T;
    }), l = oe(() => {
      const { bucketStarts: m, countSeries: S } = i.value;
      return [m, ...S];
    }), u = pe(), r = pe({ width: 0, height: 0 }), c = pe(null);
    let g = null;
    Nn(() => {
      const m = u.value;
      m && (g = new ResizeObserver((S) => {
        const { width: T, height: C } = S[0].contentRect;
        T > 0 && C > 0 && (r.value = { width: Math.floor(T), height: Math.floor(C) });
      }), g.observe(m), requestAnimationFrame(() => {
        const { width: S, height: T } = m.getBoundingClientRect();
        S > 0 && T > 0 && (r.value = { width: Math.floor(S), height: Math.floor(T) });
      }));
    }), pl(() => g?.disconnect());
    const y = oe(
      () => !t.combineSeries && i.value.countSeries.length > 1
    ), v = oe(() => Math.max(r.value.height, 50));
    return (m, S) => (O(), j("div", ST, [
      b("div", {
        ref_key: "chartAreaRef",
        ref: u,
        class: "flex-1 min-h-0 min-w-0 relative overflow-hidden"
      }, [
        r.value.width > 0 && r.value.height > 0 ? (O(), Ce(rp, {
          key: 0,
          config: a.value,
          data: l.value,
          width: r.value.width,
          height: v.value,
          onPlotReady: S[0] || (S[0] = (T) => c.value = T)
        }, {
          default: q(() => [
            _(op, {
              "u-plot-instance": c.value,
              unit: e.unit,
              "can-pin-tooltip": !0,
              "tooltip-mode": e.tooltipMode,
              "tooltip-sort": e.tooltipSort
            }, null, 8, ["u-plot-instance", "unit", "tooltip-mode", "tooltip-sort"])
          ]),
          _: 1
        }, 8, ["config", "data", "width", "height"])) : be("", !0)
      ], 512),
      y.value ? (O(), j("div", kT, [
        _(ap, {
          items: a.value.getLegendItems(),
          "u-plot-instance": c.value,
          position: "bottom",
          mode: "list",
          values: [],
          data: l.value,
          unit: e.unit
        }, null, 8, ["items", "u-plot-instance", "data", "unit"])
      ])) : be("", !0)
    ]));
  }
}), CT = ["width", "height"], MT = ["d", "fill", "stroke", "opacity", "onMousemove"], TT = ["x", "y"], zT = ["onClick"], DT = { style: { width: "100%", "border-collapse": "collapse" } }, OT = ["onClick"], PT = { class: "flex items-center gap-1" }, IT = {
  class: "overflow-hidden text-ellipsis whitespace-nowrap",
  style: { "max-width": "80px" }
}, ET = { class: "flex items-center gap-1.5" }, $T = /* @__PURE__ */ ze({
  __name: "PiePanel",
  props: {
    slices: {},
    pieType: { default: "pie" },
    pieLabels: { default: () => [] },
    unit: {},
    decimals: { default: 2 },
    legendPosition: { default: "bottom" },
    legendMode: { default: "list" },
    legendValues: { default: () => [] },
    tooltipMode: { default: "single" },
    tooltipSort: { default: "none" }
  },
  setup(e) {
    const t = e, n = Hi(), i = pe(), a = pe({ width: 0, height: 0 });
    let l = null;
    Nn(() => {
      if (!i.value)
        return;
      l = new ResizeObserver((ae) => {
        const { width: ve, height: Ne } = ae[0].contentRect;
        a.value = { width: Math.floor(ve), height: Math.floor(Ne) };
      }), l.observe(i.value);
      const { width: fe, height: he } = i.value.getBoundingClientRect();
      a.value = { width: Math.floor(fe), height: Math.floor(he) };
    }), pl(() => {
      l?.disconnect();
    });
    const u = oe(() => n.isDark), r = oe(() => u.value ? "#d9d9d9" : "#141414"), c = oe(() => u.value ? "#8c8c8c" : "#595959"), g = oe(() => u.value ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"), y = oe(() => u.value ? "rgba(0,0,0,0.6)" : "rgba(255,255,255,0.8)"), v = oe(() => {
      const fe = t.legendValues.length > 0;
      return t.legendMode === "table" ? fe ? 120 + t.legendValues.length * 64 : 160 : 140;
    }), m = oe(
      () => t.legendPosition === "bottom" ? t.legendMode === "table" ? Math.min(t.slices.length * 24 + 28, 120) : 28 : 0
    ), S = oe(() => t.legendPosition === "right" ? v.value : 0), T = oe(() => Math.max(a.value.width - S.value, 10)), C = oe(() => Math.max(a.value.height - m.value, 10)), E = oe(() => T.value / 2), X = oe(() => C.value / 2), F = oe(() => Math.min(E.value, X.value) * 0.85), V = oe(() => t.pieType === "donut" ? F.value * 0.55 : 0), N = pe(null), Y = pe({ x: 0, y: 0 }), K = pe(/* @__PURE__ */ new Set()), M = oe(() => t.slices.filter((fe) => !K.value.has(fe.label))), W = oe(() => M.value.reduce((fe, he) => fe + he.value, 0));
    function G(fe, he, ae, ve) {
      const Ne = (ve - 90) * Math.PI / 180;
      return { x: fe + ae * Math.cos(Ne), y: he + ae * Math.sin(Ne) };
    }
    function Z(fe, he, ae, ve, Ne, we) {
      const Me = Math.min(we - Ne, 359.9999), ue = Me > 180 ? 1 : 0, se = G(fe, he, ae, Ne), Pe = G(fe, he, ae, Ne + Me);
      if (ve <= 0)
        return [
          `M ${fe} ${he}`,
          `L ${se.x} ${se.y}`,
          `A ${ae} ${ae} 0 ${ue} 1 ${Pe.x} ${Pe.y}`,
          "Z"
        ].join(" ");
      const xe = G(fe, he, ve, Ne + Me), qe = G(fe, he, ve, Ne);
      return [
        `M ${se.x} ${se.y}`,
        `A ${ae} ${ae} 0 ${ue} 1 ${Pe.x} ${Pe.y}`,
        `L ${xe.x} ${xe.y}`,
        `A ${ve} ${ve} 0 ${ue} 0 ${qe.x} ${qe.y}`,
        "Z"
      ].join(" ");
    }
    const A = oe(() => {
      const fe = W.value;
      if (fe === 0 || a.value.width === 0)
        return [];
      let he = 0;
      return M.value.map((ae) => {
        const ve = ae.value / fe * 360, Ne = ae.value / fe * 100, we = he;
        he += ve;
        const Me = he, ue = we + ve / 2, se = (F.value + V.value) / 2 || F.value * 0.65, Pe = G(E.value, X.value, se, ue), xe = Z(E.value, X.value, F.value, V.value, we, Me);
        return { ...ae, angle: ve, pct: Ne, startAngle: we, endAngle: Me, midAngle: ue, labelPos: Pe, path: xe };
      });
    });
    function J(fe) {
      const he = fe.toFixed(t.decimals);
      return t.unit ? `${he} ${t.unit}` : he;
    }
    function ee(fe, he) {
      return fe.rawValues && fe.rawValues.length > 0 ? Po(fe.rawValues, he) : fe.value;
    }
    function I(fe) {
      const he = new Set(K.value);
      if (he.has(fe))
        he.delete(fe);
      else {
        if (t.slices.filter((ve) => !he.has(ve.label)).length <= 1)
          return;
        he.add(fe);
      }
      K.value = he;
    }
    function $(fe, he) {
      N.value = he;
      const ae = i.value?.getBoundingClientRect();
      ae && (Y.value = { x: fe.clientX - ae.left, y: fe.clientY - ae.top });
    }
    function le() {
      N.value = null;
    }
    const ie = oe(() => {
      if (!N.value || t.tooltipMode === "none")
        return [];
      const fe = W.value;
      if (t.tooltipMode === "single") {
        const ae = M.value.find((ve) => ve.label === N.value);
        return ae ? [{ ...ae, percent: fe > 0 ? ae.value / fe * 100 : 0 }] : [];
      }
      let he = M.value.map((ae) => ({ ...ae, percent: fe > 0 ? ae.value / fe * 100 : 0 }));
      return t.tooltipSort === "desc" && (he = [...he].sort((ae, ve) => ve.value - ae.value)), t.tooltipSort === "asc" && (he = [...he].sort((ae, ve) => ae.value - ve.value)), he;
    }), ye = oe(() => {
      const fe = t.tooltipMode === "multi" ? 180 : 140, he = t.tooltipMode === "multi" ? ie.value.length * 22 + 32 : 72, ae = Math.min(Y.value.x + 14, a.value.width - fe - 4), ve = Math.min(Y.value.y - 8, a.value.height - he - 4);
      return { left: Math.max(4, ae), top: Math.max(4, ve) };
    });
    return (fe, he) => (O(), j("div", {
      ref_key: "containerRef",
      ref: i,
      class: "w-full h-full relative overflow-hidden",
      style: Ue({
        display: "flex",
        flexDirection: e.legendPosition === "bottom" ? "column" : "row"
      })
    }, [
      a.value.width > 0 ? (O(), j("svg", {
        key: 0,
        width: T.value,
        height: C.value,
        style: { "flex-shrink": "0" }
      }, [
        (O(!0), j(Oe, null, et(A.value, (ae) => (O(), j("g", {
          key: ae.label
        }, [
          ae.angle > 0.3 ? (O(), j("path", {
            key: 0,
            d: ae.path,
            fill: ae.color,
            stroke: y.value,
            "stroke-width": "1.5",
            opacity: N.value && N.value !== ae.label ? 0.6 : 1,
            style: { cursor: "pointer", transition: "opacity 0.15s" },
            onMousemove: (ve) => $(ve, ae.label),
            onMouseleave: le
          }, null, 40, MT)) : be("", !0),
          e.pieLabels.length > 0 && ae.angle > 20 ? (O(), j("text", {
            key: 1,
            x: ae.labelPos.x,
            y: ae.labelPos.y,
            "text-anchor": "middle",
            "dominant-baseline": "middle",
            fill: "#fff",
            "font-size": "11",
            style: { "pointer-events": "none", "user-select": "none", "text-shadow": "0 1px 2px rgba(0,0,0,0.6)" }
          }, P([
            e.pieLabels.includes("name") ? ae.label : null,
            e.pieLabels.includes("percent") ? `${ae.pct.toFixed(1)}%` : null,
            e.pieLabels.includes("value") ? J(ae.value) : null
          ].filter(Boolean).join(" ")), 9, TT)) : be("", !0)
        ]))), 128))
      ], 8, CT)) : be("", !0),
      e.legendPosition !== "hidden" && e.legendMode === "list" ? (O(), j("div", {
        key: 1,
        style: Ue({
          display: "flex",
          flexDirection: e.legendPosition === "bottom" ? "row" : "column",
          flexWrap: "wrap",
          alignItems: e.legendPosition === "bottom" ? "center" : "flex-start",
          justifyContent: e.legendPosition === "bottom" ? "center" : "flex-start",
          gap: "4px 12px",
          padding: e.legendPosition === "right" ? "8px 4px" : "2px 8px",
          overflowY: e.legendPosition === "right" ? "auto" : "hidden",
          width: e.legendPosition === "right" ? `${S.value}px` : void 0,
          height: e.legendPosition === "bottom" ? `${m.value}px` : void 0
        })
      }, [
        (O(!0), j(Oe, null, et(e.slices, (ae) => (O(), j("div", {
          key: ae.label,
          class: "flex items-center gap-1 text-xs whitespace-nowrap cursor-pointer select-none",
          style: Ue({
            color: r.value,
            opacity: K.value.has(ae.label) ? 0.35 : 1,
            textDecoration: K.value.has(ae.label) ? "line-through" : "none"
          }),
          onClick: (ve) => I(ae.label)
        }, [
          b("span", {
            class: "inline-block w-2 h-2 rounded-sm flex-shrink-0",
            style: Ue({ background: ae.color })
          }, null, 4),
          b("span", null, P(ae.label), 1),
          e.legendValues.length > 0 ? (O(), j("span", {
            key: 0,
            class: "ml-1",
            style: Ue({ color: c.value })
          }, P(e.legendValues.map((ve) => J(ee(ae, ve))).join(" / ")), 5)) : be("", !0)
        ], 12, zT))), 128))
      ], 4)) : be("", !0),
      e.legendPosition !== "hidden" && e.legendMode === "table" ? (O(), j("div", {
        key: 2,
        style: Ue({
          width: e.legendPosition === "right" ? `${S.value}px` : void 0,
          height: e.legendPosition === "bottom" ? `${m.value}px` : void 0,
          overflowY: "auto",
          flexShrink: 0,
          fontSize: "11px"
        })
      }, [
        b("table", DT, [
          b("thead", null, [
            b("tr", null, [
              b("th", {
                style: Ue({ textAlign: "left", padding: "2px 6px", color: c.value, fontWeight: 500, borderBottom: `1px solid ${g.value}` })
              }, " Name ", 4),
              b("th", {
                style: Ue({ textAlign: "right", padding: "2px 6px", color: c.value, fontWeight: 500, borderBottom: `1px solid ${g.value}` })
              }, " Value ", 4),
              (O(!0), j(Oe, null, et(e.legendValues, (ae) => (O(), j("th", {
                key: ae,
                style: Ue({ textAlign: "right", padding: "2px 6px", color: c.value, fontWeight: 500, borderBottom: `1px solid ${g.value}`, minWidth: "56px" })
              }, P(ae.charAt(0).toUpperCase() + ae.slice(1)), 5))), 128))
            ])
          ]),
          b("tbody", null, [
            (O(!0), j(Oe, null, et(e.slices, (ae) => (O(), j("tr", {
              key: ae.label,
              class: "cursor-pointer select-none",
              style: Ue({ opacity: K.value.has(ae.label) ? 0.35 : 1 }),
              onClick: (ve) => I(ae.label)
            }, [
              b("td", {
                style: Ue({ padding: "2px 6px", color: r.value })
              }, [
                b("div", PT, [
                  b("span", {
                    class: "inline-block w-2 h-2 rounded-sm flex-shrink-0",
                    style: Ue({ background: ae.color })
                  }, null, 4),
                  b("span", IT, P(ae.label), 1)
                ])
              ], 4),
              b("td", {
                style: Ue({ textAlign: "right", padding: "2px 6px", color: r.value, fontVariantNumeric: "tabular-nums" })
              }, P(J(ae.value)), 5),
              (O(!0), j(Oe, null, et(e.legendValues, (ve) => (O(), j("td", {
                key: ve,
                style: Ue({ textAlign: "right", padding: "2px 6px", color: c.value, fontVariantNumeric: "tabular-nums" })
              }, P(J(ee(ae, ve))), 5))), 128))
            ], 12, OT))), 128))
          ])
        ])
      ], 4)) : be("", !0),
      N.value && e.tooltipMode !== "none" && ie.value.length > 0 ? (O(), j("div", {
        key: 3,
        class: "absolute z-50 pointer-events-none rounded shadow-lg text-xs",
        style: Ue({
          left: `${ye.value.left}px`,
          top: `${ye.value.top}px`,
          background: u.value ? "#1f1f1f" : "#fff",
          border: u.value ? "1px solid #333" : "1px solid #e8e8e8",
          minWidth: "140px"
        })
      }, [
        b("div", {
          class: "px-2 pt-1.5 pb-0 text-xs font-medium",
          style: Ue({ color: u.value ? "#d9d9d9" : "#141414" })
        }, P(e.tooltipMode === "multi" ? `${J(W.value)} total` : ie.value[0]?.label), 5),
        b("div", {
          class: "border-t my-1",
          style: Ue({ borderColor: u.value ? "#333" : "#e8e8e8" })
        }, null, 4),
        (O(!0), j(Oe, null, et(ie.value, (ae) => (O(), j("div", {
          key: ae.label,
          class: "px-2 py-0.5 flex items-center justify-between gap-2"
        }, [
          b("div", ET, [
            b("span", {
              class: "inline-block w-2 h-2 rounded-sm",
              style: Ue({ background: ae.color })
            }, null, 4),
            b("span", {
              style: Ue({ color: u.value ? "#d9d9d9" : "#141414" })
            }, P(e.tooltipMode === "multi" ? ae.label : `${ae.percent.toFixed(1)}%`), 5)
          ]),
          b("span", {
            class: "font-mono",
            style: Ue({ color: ae.color })
          }, P(J(ae.value)), 5)
        ]))), 128))
      ], 4)) : be("", !0)
    ], 4));
  }
}), As = 36, Ja = 1.2, Tf = 1, AT = /* @__PURE__ */ ze({
  __name: "StatPanel",
  props: {
    title: {},
    unit: {},
    series: {},
    trend: {},
    thresholds: {},
    thresholdBaseColor: {},
    orientation: {},
    textMode: {},
    colorMode: {}
  },
  setup(e) {
    const t = e, n = Hi(), i = pe(), a = pe({ w: 0, h: 0 });
    let l = null;
    const u = ["#1677ff", "#52c41a", "#fa8c16", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#faad14"];
    function r(N) {
      return N >= 1e6 ? `${(N / 1e6).toFixed(1)}M` : N >= 1e3 ? `${(N / 1e3).toFixed(1)}K` : N % 1 === 0 ? String(N) : N.toFixed(1);
    }
    function c(N, Y, K, M) {
      const W = K ?? M ?? u[0];
      if (Y && Y.length > 0) {
        let G = W;
        for (const Z of Y)
          N >= Z.value && (G = Z.color);
        return G;
      }
      return W;
    }
    function g(N, Y) {
      if (N.startsWith("rgb("))
        return N.replace("rgb(", "rgba(").replace(")", `, ${Y})`);
      if (N.startsWith("rgba("))
        return N.replace(/,\s*[\d.]+\)$/, `, ${Y})`);
      const K = N.replace("#", ""), M = K.length === 3 ? K.split("").map((A) => A + A).join("") : K.slice(0, 6), W = Number.parseInt(M.slice(0, 2), 16), G = Number.parseInt(M.slice(2, 4), 16), Z = Number.parseInt(M.slice(4, 6), 16);
      return `rgba(${W}, ${G}, ${Z}, ${Y})`;
    }
    function y(N, Y, K) {
      switch (Y) {
        case "background_solid":
          return We(N).toString();
        case "background": {
          const M = K ? 1 : -0.7, W = We(N).darken(15 * M).spin(8).toRgbString(), G = We(N).darken(5 * M).spin(-8).toRgbString();
          return `linear-gradient(120deg, ${W}, ${G})`;
        }
        default:
          return "transparent";
      }
    }
    function v(N) {
      return We(N).isLight() ? "#1a1a1a" : "#ffffff";
    }
    function m(N, Y, K) {
      if (N === 0 || Y === 0)
        return { isWide: !1, showSparkline: !1, valueFontSize: 24, titleFontSize: 12, chartHeight: 0, padding: 8 };
      const M = Y > 100 ? 12 : 8, W = N - M * 2, G = Y - M * 2, Z = N / Y > 2.5, A = K && (Z ? Y > 50 : Y > 100), J = Math.max(10, Math.min(13, G * (Z ? 0.22 : 0.18)));
      let ee, I = 0;
      if (Z)
        ee = A ? Math.min(G * 0.62, W * 0.42, As) : Math.min(G * 0.7, W * 0.38, As), A && (I = Y * 0.5);
      else {
        const $ = J * Ja;
        ee = Math.min(A ? (G - $) * 0.65 : (G - $) * 0.85, W * 0.9, As), A && (I = Math.max(0, Math.min(Y - J * Ja - ee * Ja - M, Y * 0.5)));
      }
      return {
        isWide: Z,
        showSparkline: A,
        valueFontSize: Math.max(11, ee),
        titleFontSize: J,
        chartHeight: I,
        padding: M
      };
    }
    function S(N, Y, K) {
      const M = Math.ceil(Math.sqrt(K * N / Y));
      return Math.floor(M * Y / N) * M < K ? Y / Math.ceil(M * Y / N) : N / M;
    }
    function T(N, Y, K, M) {
      const W = Math.max(S(N, Y, M), S(Y, N, M));
      let G = Math.max(1, Math.floor(N / W));
      const Z = Math.ceil(M / G);
      return G = Math.ceil(M / Z), {
        xCount: G,
        yCount: Z,
        cellW: N / G - K + K / G,
        cellH: Y / Z - K + K / Z
      };
    }
    function C(N, Y, K) {
      const M = N.getContext("2d");
      if (!M)
        return;
      const W = window.devicePixelRatio || 1, G = N.getBoundingClientRect();
      if (G.width === 0 || G.height === 0)
        return;
      N.width = G.width * W, N.height = G.height * W, M.scale(W, W);
      const Z = G.width, A = G.height, J = Y.reduce((ie, ye) => Math.min(ie, ye), 1 / 0), I = Y.reduce((ie, ye) => Math.max(ie, ye), -1 / 0) - J || 1;
      M.clearRect(0, 0, Z, A);
      const $ = M.createLinearGradient(0, 0, 0, A);
      $.addColorStop(0, g(K, 0.25)), $.addColorStop(1, g(K, 0));
      const le = Y.map((ie, ye) => ({
        x: ye / (Y.length - 1) * Z,
        y: A - 2 - (ie - J) / I * (A - 4)
      }));
      M.beginPath(), le.forEach(({ x: ie, y: ye }, fe) => fe === 0 ? M.moveTo(ie, ye) : M.lineTo(ie, ye)), M.lineTo(Z, A), M.lineTo(0, A), M.fillStyle = $, M.fill(), M.beginPath(), le.forEach(({ x: ie, y: ye }, fe) => fe === 0 ? M.moveTo(ie, ye) : M.lineTo(ie, ye)), M.strokeStyle = K, M.lineWidth = 1.5, M.stroke();
    }
    const E = oe(() => Math.max(t.series.length, 1)), X = oe(() => {
      const N = a.value.w, Y = a.value.h;
      return N <= 0 || Y <= 0 ? { xCount: 1, yCount: 1, cellW: 0, cellH: 0 } : t.orientation === "horizontal" ? { xCount: 1, yCount: E.value, cellW: N, cellH: (Y - Tf * (E.value - 1)) / E.value } : T(N, Y, Tf, E.value);
    }), F = oe(() => n.isDark ? "#303030" : "#fff");
    Nn(() => {
      i.value && (l = new ResizeObserver((N) => {
        const Y = N[0].contentRect;
        (a.value.w !== Y.width || a.value.h !== Y.height) && (a.value = { w: Y.width, h: Y.height });
      }), l.observe(i.value));
    }), Fa(() => {
      l?.disconnect();
    });
    const V = ze({
      props: {
        label: String,
        value: Number,
        unit: String,
        mappedLabel: String,
        sparkline: Array,
        percentChange: [Number, null],
        textMode: { type: String, default: "value_and_name" },
        colorMode: String,
        color: String,
        width: Number,
        height: Number
      },
      setup(N) {
        const Y = pe(), K = Hi();
        function M() {
          Un(() => {
            Y.value && N.sparkline && N.sparkline.length > 1 && C(Y.value, N.sparkline, N.color ?? "#1677ff");
          });
        }
        return Ye(() => [N.sparkline, N.color, N.width, N.height], M, { immediate: !0 }), () => {
          const W = N, G = K.isDark, Z = W.sparkline != null && W.sparkline.length > 1, A = m(W.width ?? 0, W.height ?? 0, Z), J = W.textMode === "value_and_name" || W.textMode === "name", ee = W.textMode === "value_and_name" || W.textMode === "value", I = Math.max(10, A.valueFontSize * 0.44), $ = W.colorMode === "background_solid" || W.colorMode === "background", le = $ ? y(W.color ?? "#1677ff", W.colorMode ?? "value", G) : "transparent", ie = $ ? v(W.color ?? "#1677ff") : W.color ?? "#d9d9d9", ye = $ ? ie : "#888", fe = $ ? ie : "#666", he = W.percentChange != null ? (W.percentChange > 0 ? "+" : "") + W.percentChange.toLocaleString(void 0, { style: "percent", minimumFractionDigits: 1, maximumFractionDigits: 2 }) : null, ae = W.percentChange != null ? W.percentChange > 0 ? "#52c41a" : W.percentChange < 0 ? "#ff4d4f" : "#888" : "", ve = W.percentChange != null ? W.percentChange > 0 ? "↑" : W.percentChange < 0 ? "↓" : "" : "", Ne = W.mappedLabel ?? r(W.value ?? 0), we = [
            Gn("span", {
              style: {
                color: ie,
                fontSize: `${A.valueFontSize}px`,
                fontWeight: 500,
                fontFamily: "monospace",
                lineHeight: Ja
              }
            }, Ne)
          ];
          W.mappedLabel || we.push(Gn("span", {
            style: { color: fe, fontSize: `${I}px`, lineHeight: Ja }
          }, W.unit)), he && we.push(Gn("span", {
            style: { color: ae, fontSize: `${I}px`, marginLeft: "2px", lineHeight: Ja }
          }, `${ve}${he}`));
          const Me = J ? Gn("div", {
            style: {
              color: ye,
              fontSize: `${A.titleFontSize}px`,
              lineHeight: Ja,
              ...A.isWide ? { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } : { marginBottom: "2px" }
            }
          }, W.label) : null, ue = ee ? Gn("div", {
            style: {
              display: "flex",
              alignItems: "baseline",
              gap: A.isWide ? "3px" : "4px",
              flexWrap: "wrap"
            }
          }, we) : null, se = Gn("div", {
            style: A.isWide ? { flex: 1, minWidth: 0, position: "relative", zIndex: 1 } : { position: "relative", zIndex: 1 }
          }, [Me, ue]), Pe = A.showSparkline ? Gn("canvas", {
            ref: (qe) => {
              Y.value = qe;
            },
            style: A.isWide ? { position: "absolute", right: 0, bottom: 0, left: 0, width: "100%", height: `${A.chartHeight}px`, opacity: 0.7 } : { position: "absolute", bottom: 0, left: 0, right: 0, width: "100%", height: `${A.chartHeight}px`, opacity: 0.6 }
          }) : null, xe = A.isWide ? {
            width: "100%",
            height: "100%",
            display: "flex",
            alignItems: "center",
            padding: `0 ${A.padding}px`,
            gap: "8px",
            overflow: "hidden",
            position: "relative",
            background: le
          } : {
            width: "100%",
            height: "100%",
            display: "flex",
            flexDirection: "column",
            justifyContent: "center",
            padding: `${A.padding}px`,
            overflow: "hidden",
            position: "relative",
            background: le
          };
          return Gn("div", { style: xe }, A.isWide ? [Pe, se] : [Pe, se]);
        };
      }
    });
    return (N, Y) => (O(), j("div", {
      ref_key: "containerRef",
      ref: i,
      style: Ue([{ width: "100%", height: "100%", display: "grid", gap: "1px" }, {
        gridTemplateColumns: e.orientation === "horizontal" ? "1fr" : `repeat(${X.value.xCount}, 1fr)`,
        gridTemplateRows: e.orientation === "horizontal" ? `repeat(${E.value}, 1fr)` : `repeat(${X.value.yCount}, 1fr)`,
        background: F.value
      }])
    }, [
      (O(!0), j(Oe, null, et(e.series, (K, M) => (O(), Ce(f(V), {
        key: `${K.label}-${M}`,
        label: E.value === 1 ? e.title : K.label,
        value: K.displayValue ?? (K.values.length > 0 ? K.values[K.values.length - 1] ?? 0 : 0),
        unit: K.units ?? e.unit,
        "mapped-label": K.valueMap !== void 0 ? K.valueMap[String(K.displayValue ?? (K.values.length > 0 ? K.values[K.values.length - 1] ?? 0 : 0))] : void 0,
        sparkline: K.values.length > 1 ? K.values : void 0,
        "percent-change": K.percentChange,
        "text-mode": e.textMode,
        "color-mode": e.colorMode,
        color: c(
          K.displayValue ?? K.values[K.values.length - 1] ?? 0,
          e.thresholds,
          e.thresholdBaseColor,
          u[M % u.length]
        ),
        width: X.value.cellW,
        height: X.value.cellH
      }, null, 8, ["label", "value", "unit", "mapped-label", "sparkline", "percent-change", "text-mode", "color-mode", "color", "width", "height"]))), 128))
    ], 4));
  }
}), NT = {
  key: 0,
  class: "flex-center h-full text-secondary"
}, RT = {
  key: 1,
  class: "flex-center h-full"
}, LT = {
  key: 2,
  class: "flex-center h-full text-red-500 text-xs"
}, qT = {
  key: 3,
  class: "w-full h-full relative"
}, FT = {
  key: 0,
  class: "absolute inset-0 z-10 flex items-center justify-center",
  style: { "backdrop-filter": "blur(1px)", "border-radius": "4px" }
}, VT = {
  key: 0,
  class: "w-full h-full"
}, WT = {
  key: 0,
  class: "w-full h-full overflow-auto"
}, Lu = /* @__PURE__ */ ze({
  __name: "PanelRenderer",
  props: {
    panelId: {},
    panelConfig: { default: void 0 }
  },
  setup(e) {
    const t = e, n = Gi(), { t: i } = st(), a = oe(() => t.panelConfig ?? n.panels[t.panelId]);
    let l = null;
    const u = pe(null), r = ["#1677ff", "#52c41a", "#fa8c16", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#faad14"];
    function c(Y, K) {
      g();
      const M = Y.seriesCount ?? 1, W = Ah(
        { from: K.from / 1e3, to: K.to / 1e3 },
        15,
        M,
        Y.pattern,
        Y.labels
      ), G = Array.from({ length: M }, (A, J) => 20 + (J * 37 + 13) % 60), Z = Array.from({ length: M }, (A, J) => 10 + (J * 53 + 7) % 40);
      u.value = {
        timestamps: [...W.timestamps],
        seriesValues: W.series.map((A) => [...A.values])
      }, l = setInterval(() => {
        const A = u.value;
        if (!A)
          return;
        const J = Math.floor(Date.now() / 1e3), ee = [...A.timestamps.slice(1), J], I = A.seriesValues.map(($, le) => {
          const ie = $[$.length - 1], ye = _b(ie, G[le], Z[le] * 0.1, Z[le] + G[le] * 1.8);
          return [...$.slice(1), ye];
        });
        u.value = { timestamps: ee, seriesValues: I };
      }, 1e3);
    }
    function g() {
      l && (clearInterval(l), l = null), u.value = null;
    }
    Fa(g);
    const y = oe(() => {
      const Y = a.value;
      return Y ? Y.queries.some((K) => K.enabled !== !1 && K.dataSource?.type === "mock" && K.dataSource?.pattern === "live") : !1;
    });
    Ye([a, () => n.timeRange], () => {
      const Y = a.value;
      if (!Y || !y.value) {
        g();
        return;
      }
      const K = Y.queries.find((M) => M.enabled !== !1 && M.dataSource?.type === "mock" && M.dataSource?.pattern === "live");
      K && c(K.dataSource, n.timeRange);
    }, { immediate: !0, deep: !0 });
    const v = oe(() => {
      const Y = a.value;
      return Y ? Y.queries.filter((K) => K.enabled !== !1 && !(K.dataSource?.type === "mock" && K.dataSource?.pattern === "live")) : [];
    }), { response: m, loading: S, error: T } = Gg(
      () => v.value,
      () => n.timeRange,
      1e3,
      () => n.panelRefreshKeys[t.panelId]
    );
    function C(Y) {
      return typeof Y?.toArray == "function" ? Y.toArray() : Array.isArray(Y) ? Y : [];
    }
    function E(Y, K) {
      if (!Y || Y.data.length === 0)
        return null;
      if (K.type === "timeseries" || K.type === "bar") {
        const M = C(Y.data[0].fields[0]?.values), W = Y.data.flatMap(
          (G) => G.fields.filter((Z) => Z.type === "number").map((Z) => ({
            label: Z.config?.displayNameFromDS ?? Z.name,
            values: C(Z.values)
          }))
        );
        return { timestamps: M.map((G) => G / 1e3), series: W };
      }
      if (K.type === "histogram") {
        const M = Y.data.flatMap(
          (G) => G.fields.filter((Z) => Z.type === "number").map((Z) => C(Z.values))
        ), W = Y.data.flatMap(
          (G) => G.fields.filter((Z) => Z.type === "number").map((Z) => Z.config?.displayNameFromDS ?? Z.name)
        );
        return { seriesValues: M, seriesLabels: W };
      }
      if (K.type === "stat" || K.type === "gauge") {
        const M = Y.data.flatMap(
          (W) => W.fields.filter((G) => G.type === "number").map((G) => {
            const Z = C(G.values);
            return {
              label: G.config?.displayNameFromDS ?? G.name,
              values: Z,
              displayValue: Po(Z, K.statReducer ?? "lastNotNull"),
              percentChange: K.showPercentChange ? _s(Z) : void 0
            };
          })
        );
        return {
          series: M,
          value: M[0]?.values[M[0].values.length - 1] ?? 0,
          values: M.map((W) => W.values[W.values.length - 1] ?? 0),
          unit: K.unit ?? K.statUnit ?? "",
          trend: K.statTrend ?? "flat",
          percentChange: K.showPercentChange ? _s(M[0]?.values ?? []) : void 0
        };
      }
      if (K.type === "pie")
        return Y.data.flatMap(
          (M, W) => M.fields.filter((G) => G.type === "number").map((G, Z) => ({
            label: G.config?.displayNameFromDS ?? G.name,
            value: Po(C(G.values), K.statReducer ?? "lastNotNull"),
            color: r[(W + Z) % r.length],
            rawValues: C(G.values)
          }))
        );
      if (K.type === "table") {
        const M = Y.data[0], W = M.fields.map((A) => ({
          key: A.name,
          title: A.config?.displayNameFromDS ?? A.name,
          dataIndex: A.name
        })), G = C(M.fields[0]?.values).length, Z = Array.from({ length: G }, (A, J) => {
          const ee = { key: J };
          return M.fields.forEach((I) => {
            const $ = C(I.values)[J];
            ee[I.name] = I.type === "time" ? new Date($).toLocaleString() : $;
          }), ee;
        });
        return { columns: W, dataSource: Z };
      }
      return null;
    }
    const X = oe(() => {
      const Y = a.value;
      return Y ? E(m.value, Y) : null;
    }), F = oe(() => {
      const Y = u.value, K = a.value;
      return !Y || !K ? null : K.type === "timeseries" ? {
        timestamps: Y.timestamps,
        series: Y.seriesValues.map((M, W) => ({ label: `series-${W + 1}`, values: M }))
      } : K.type === "stat" || K.type === "gauge" ? {
        series: Y.seriesValues.map((W, G) => ({
          label: `series-${G + 1}`,
          values: W,
          displayValue: Po(W, K.statReducer ?? "lastNotNull"),
          percentChange: K.showPercentChange ? _s(W) : void 0
        })),
        value: Y.seriesValues[0]?.[Y.seriesValues[0].length - 1] ?? 0,
        values: Y.seriesValues.map((W) => W[W.length - 1] ?? 0),
        unit: K.statUnit ?? "",
        trend: K.statTrend ?? "flat",
        percentChange: K.showPercentChange ? _s(Y.seriesValues[0] ?? []) : void 0
      } : K.type === "pie" ? Y.seriesValues.map((M, W) => ({
        label: `series-${W + 1}`,
        value: Po(M, K.statReducer ?? "lastNotNull"),
        color: r[W % r.length],
        rawValues: M
      })) : K.type === "histogram" ? {
        seriesValues: Y.seriesValues,
        seriesLabels: Y.seriesValues.map((M, W) => `series-${W + 1}`)
      } : null;
    }), V = oe(() => F.value ?? X.value), N = ze({
      name: "NoDataPlaceholder",
      setup() {
        const { t: Y } = st();
        return () => Gn("div", { class: "flex flex-col items-center justify-center h-full gap-1.5 text-gray-400 select-none" }, [
          Gn("span", { class: [De.databaseOff, "text-7", "opacity-50"] }),
          Gn("span", { class: "text-xs" }, Y("panel.noData"))
        ]);
      }
    });
    return (Y, K) => a.value ? f(S) && !u.value ? (O(), j("div", RT, [
      _(f(ki))
    ])) : f(T) ? (O(), j("div", LT, P(f(T)), 1)) : (O(), j("div", qT, [
      f(S) && u.value ? (O(), j("div", FT, [
        _(f(ki))
      ])) : be("", !0),
      a.value.type === "timeseries" ? (O(), j(Oe, { key: 1 }, [
        V.value && V.value.series?.length > 0 ? (O(), j("div", VT, [
          _(up, {
            data: V.value,
            unit: a.value.unit,
            decimals: a.value.decimals,
            "color-scheme": a.value.colorScheme,
            "color-single-value": a.value.colorSingleValue,
            "color-distribution": a.value.colorDistribution,
            thresholds: a.value.thresholds,
            "threshold-base-color": a.value.thresholdBaseColor,
            "fill-opacity": a.value.fillOpacity,
            "line-width": a.value.lineWidth,
            "line-interpolation": a.value.lineInterpolation,
            "line-style": a.value.lineStyle,
            "draw-style": a.value.drawStyle,
            "gradient-mode": a.value.gradientMode,
            "span-nulls": a.value.spanNulls,
            "show-points": a.value.showPoints,
            "show-points-mode": a.value.showPointsMode,
            "stacking-mode": a.value.stackingMode,
            "legend-position": a.value.legendPosition,
            "legend-mode": a.value.legendMode,
            "legend-values": a.value.legendValues,
            "panel-id": a.value.id,
            "tooltip-mode": a.value.tooltipMode,
            "tooltip-sort": a.value.tooltipSort,
            "tooltip-max-height": a.value.tooltipMaxHeight,
            "show-axis-pointer": a.value.showAxisPointer,
            "soft-min": a.value.softMin,
            "soft-max": a.value.softMax,
            "axis-placement": a.value.axisPlacement,
            "axis-name": a.value.axisName,
            "axis-width": a.value.axisWidth,
            "show-grid-lines": a.value.showGridLines,
            "grid-color": a.value.gridColor,
            "axis-label": a.value.axisLabel,
            "axis-label-color": a.value.axisLabelColor,
            "axis-tick": a.value.axisTick,
            "axis-tick-color": a.value.axisTickColor,
            "axis-border": a.value.axisBorder,
            "axis-border-color": a.value.axisBorderColor,
            "scale-distribution": a.value.scaleDistribution,
            "centered-zero": a.value.centeredZero
          }, null, 8, ["data", "unit", "decimals", "color-scheme", "color-single-value", "color-distribution", "thresholds", "threshold-base-color", "fill-opacity", "line-width", "line-interpolation", "line-style", "draw-style", "gradient-mode", "span-nulls", "show-points", "show-points-mode", "stacking-mode", "legend-position", "legend-mode", "legend-values", "panel-id", "tooltip-mode", "tooltip-sort", "tooltip-max-height", "show-axis-pointer", "soft-min", "soft-max", "axis-placement", "axis-name", "axis-width", "show-grid-lines", "grid-color", "axis-label", "axis-label-color", "axis-tick", "axis-tick-color", "axis-border", "axis-border-color", "scale-distribution", "centered-zero"])
        ])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : a.value.type === "bar" ? (O(), j(Oe, { key: 2 }, [
        V.value && V.value.series?.length > 0 ? (O(), Ce(bT, {
          key: 0,
          data: V.value,
          stacked: a.value.stacked,
          "bar-width": a.value.barWidth,
          "bar-group-width": a.value.barGroupWidth,
          "show-values": a.value.barShowValues,
          unit: a.value.unit,
          decimals: a.value.decimals,
          "color-scheme": a.value.colorScheme,
          "color-single-value": a.value.colorSingleValue,
          "color-distribution": a.value.colorDistribution,
          "legend-position": a.value.legendPosition,
          "legend-mode": a.value.legendMode,
          "legend-values": a.value.legendValues,
          "tooltip-mode": a.value.tooltipMode,
          "tooltip-sort": a.value.tooltipSort
        }, null, 8, ["data", "stacked", "bar-width", "bar-group-width", "show-values", "unit", "decimals", "color-scheme", "color-single-value", "color-distribution", "legend-position", "legend-mode", "legend-values", "tooltip-mode", "tooltip-sort"])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : a.value.type === "stat" ? (O(), j(Oe, { key: 3 }, [
        V.value ? (O(), Ce(AT, {
          key: 0,
          title: a.value.title,
          unit: V.value.unit,
          series: V.value.series,
          trend: V.value.trend,
          thresholds: a.value.thresholds,
          "threshold-base-color": a.value.thresholdBaseColor,
          orientation: a.value.statOrientation,
          "text-mode": a.value.statTextMode,
          "color-mode": a.value.statColorMode
        }, null, 8, ["title", "unit", "series", "trend", "thresholds", "threshold-base-color", "orientation", "text-mode", "color-mode"])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : a.value.type === "gauge" ? (O(), j(Oe, { key: 4 }, [
        V.value ? (O(), Ce(wT, {
          key: 0,
          series: V.value.series?.map((M, W) => ({
            label: M.label,
            value: M.displayValue ?? M.values[M.values.length - 1] ?? 0,
            activeColorOverride: r[W % r.length]
          })),
          title: a.value.title,
          min: a.value.min ?? 0,
          max: a.value.max ?? 100,
          unit: a.value.unit,
          thresholds: a.value.thresholds,
          "threshold-base-color": a.value.thresholdBaseColor,
          "cap-round": a.value.gaugeCapRound,
          "track-width": a.value.gaugeTrackWidth,
          "fill-width": a.value.gaugeFillWidth,
          "track-color": a.value.gaugeTrackColor,
          "sweep-angle": a.value.sweepAngle,
          "value-color": a.value.gaugeValueColor,
          "value-size": a.value.gaugeValueSize,
          "value-visible": a.value.gaugeValueVisible,
          "padding-x": a.value.gaugePaddingX,
          "padding-y": a.value.gaugePaddingY,
          "threshold-display": a.value.gaugeThresholdDisplay,
          "threshold-label-display": a.value.gaugeThresholdLabelDisplay,
          "value-offset-y": a.value.gaugeValueOffsetY,
          orientation: a.value.gaugeOrientation
        }, null, 8, ["series", "title", "min", "max", "unit", "thresholds", "threshold-base-color", "cap-round", "track-width", "fill-width", "track-color", "sweep-angle", "value-color", "value-size", "value-visible", "padding-x", "padding-y", "threshold-display", "threshold-label-display", "value-offset-y", "orientation"])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : a.value.type === "table" ? (O(), j(Oe, { key: 5 }, [
        V.value ? (O(), j("div", WT, [
          _(f(kp), {
            columns: V.value.columns,
            "data-source": V.value.dataSource,
            pagination: { pageSize: a.value.tablePageSize ?? 20 },
            size: "small",
            scroll: { y: "100%" },
            "show-header": a.value.tableShowHeader !== !1
          }, null, 8, ["columns", "data-source", "pagination", "show-header"])
        ])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : a.value.type === "pie" ? (O(), j(Oe, { key: 6 }, [
        V.value && V.value.length > 0 ? (O(), Ce($T, {
          key: 0,
          slices: V.value,
          "pie-type": a.value.pieType,
          "pie-labels": a.value.pieLabels,
          unit: a.value.unit,
          decimals: a.value.decimals,
          "legend-position": a.value.legendPosition,
          "legend-mode": a.value.legendMode,
          "legend-values": a.value.legendValues,
          "tooltip-mode": a.value.tooltipMode,
          "tooltip-sort": a.value.tooltipSort
        }, null, 8, ["slices", "pie-type", "pie-labels", "unit", "decimals", "legend-position", "legend-mode", "legend-values", "tooltip-mode", "tooltip-sort"])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : a.value.type === "histogram" ? (O(), j(Oe, { key: 7 }, [
        V.value && V.value.seriesValues?.length > 0 ? (O(), Ce(_T, {
          key: 0,
          "series-values": V.value.seriesValues,
          "series-labels": V.value.seriesLabels,
          "bucket-size": a.value.histBucketSize,
          "bucket-count": a.value.histBucketCount,
          "bucket-offset": a.value.histBucketOffset,
          "combine-series": a.value.histCombineSeries,
          "line-width": a.value.lineWidth,
          "fill-opacity": a.value.fillOpacity,
          unit: a.value.unit
        }, null, 8, ["series-values", "series-labels", "bucket-size", "bucket-count", "bucket-offset", "combine-series", "line-width", "fill-opacity", "unit"])) : (O(), Ce(f(N), { key: 1 }))
      ], 64)) : be("", !0)
    ])) : (O(), j("div", NT, P(f(i)("panel.noData")), 1));
  }
}), YT = { class: "w-full h-full flex flex-col" }, BT = { class: "flex-1 min-h-0" }, HT = {
  key: 1,
  class: "flex-center h-full text-secondary text-sm"
}, jT = /* @__PURE__ */ ze({
  __name: "ChartPreview",
  setup(e) {
    const { panel: t } = uo(), n = oe(() => {
      const i = t.value;
      return [
        i.type,
        JSON.stringify(i.queries),
        i.colorScheme,
        i.statReducer,
        i.unit,
        i.decimals,
        i.lineWidth,
        i.fillOpacity,
        i.stacked,
        i.thresholds?.length,
        i.sweepAngle
      ].join("|");
    });
    return (i, a) => (O(), j("div", YT, [
      b("div", BT, [
        f(t).id ? (O(), Ce(Lu, {
          key: n.value,
          "panel-id": f(t).id,
          "panel-config": f(t)
        }, null, 8, ["panel-id", "panel-config"])) : (O(), j("div", HT, " No preview available "))
      ])
    ]));
  }
}), UT = { class: "w-full h-full flex flex-col" }, GT = { class: "flex-1 min-h-0" }, KT = /* @__PURE__ */ ze({
  __name: "PanelChrome",
  setup(e) {
    const t = Hi(), { panel: n } = uo(), i = oe(() => t.isDark), a = oe(() => i.value ? "#303030" : "#e8e8e8"), l = oe(() => i.value ? "#d9d9d9" : "#141414"), u = oe(() => i.value ? "#666" : "#bbb");
    return (r, c) => (O(), j("div", UT, [
      b("div", {
        class: "flex items-center px-2.5 py-1.5 flex-shrink-0 gap-1.5 h-32px",
        style: Ue({ borderBottom: `1px solid ${a.value}` })
      }, [
        b("span", {
          class: "text-xs font-medium truncate",
          style: Ue({ color: l.value })
        }, P(f(n).title || "—"), 5),
        f(n).description ? (O(), Ce(f(Zn), {
          key: 0,
          title: f(n).description,
          placement: "bottom"
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).info, "text-xs"]),
              style: Ue({ color: u.value })
            }, null, 6)
          ]),
          _: 1
        }, 8, ["title"])) : be("", !0),
        _(ip, {
          links: f(n).links ?? [],
          "icon-color": u.value
        }, null, 8, ["links", "icon-color"])
      ], 4),
      b("div", GT, [
        _(jT)
      ])
    ]));
  }
}), cp = /* @__PURE__ */ ze({
  __name: "TimeRangePicker",
  setup(e) {
    const { RangePicker: t } = _p, n = Gi(), i = [
      { label: "最近 5 分钟", minutes: 5 },
      { label: "最近 15 分钟", minutes: 15 },
      { label: "最近 30 分钟", minutes: 30 },
      { label: "最近 1 小时", minutes: 60 },
      { label: "最近 3 小时", minutes: 180 },
      { label: "最近 6 小时", minutes: 360 },
      { label: "最近 12 小时", minutes: 720 },
      { label: "最近 24 小时", minutes: 1440 },
      { label: "最近 7 天", minutes: 10080 },
      { label: "最近 30 天", minutes: 43200 },
      { label: "最近 90 天", minutes: 129600 }
    ], a = [
      { label: "关闭", value: 0 },
      { label: "5 秒", value: 5 },
      { label: "10 秒", value: 10 },
      { label: "30 秒", value: 30 },
      { label: "1 分钟", value: 60 },
      { label: "5 分钟", value: 300 }
    ], l = pe(!1), u = Math.round((n.timeRange.to - n.timeRange.from) / 6e4), r = i.find((y) => y.minutes === u);
    function c(y) {
      const v = Date.now();
      n.setTimeRange({ from: v - y * 60 * 1e3, to: v }), l.value = !1;
    }
    function g() {
      const y = Date.now(), v = n.timeRange.to - n.timeRange.from;
      n.setTimeRange({ from: y - v, to: y });
    }
    return (y, v) => (O(), Ce(f(Bl), null, {
      default: q(() => [
        _(f(Bl).Compact, null, {
          default: q(() => [
            l.value ? (O(), Ce(f(t), {
              key: 1,
              "show-time": "",
              "allow-clear": !1,
              style: { width: "320px" },
              value: [f(Dc)(f(n).timeRange.from), f(Dc)(f(n).timeRange.to)],
              onChange: v[1] || (v[1] = (m) => {
                m?.[0] && m?.[1] && f(n).setTimeRange({ from: m[0].valueOf(), to: m[1].valueOf() });
              })
            }, null, 8, ["value"])) : (O(), Ce(f(tt), {
              key: 0,
              value: f(r)?.minutes,
              options: i.map((m) => ({ value: m.minutes, label: m.label })),
              "popup-match-select-width": "false",
              placeholder: "快速选择",
              onChange: v[0] || (v[0] = (m) => c(m))
            }, null, 8, ["value", "options"])),
            _(f(ot), {
              onClick: v[2] || (v[2] = (m) => l.value = !l.value)
            }, {
              default: q(() => [
                ce(P(l.value ? "收起" : "自定义"), 1)
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        _(f(Bl).Compact, null, {
          default: q(() => [
            _(f(ot), { onClick: g }, {
              default: q(() => [
                b("span", {
                  class: Re([f(De).refresh, "mr-1"])
                }, null, 2),
                v[4] || (v[4] = ce(" 刷新 ", -1))
              ]),
              _: 1
            }),
            _(f(tt), {
              value: f(n).autoRefresh,
              options: a,
              "popup-match-select-width": "false",
              onChange: v[3] || (v[3] = (m) => f(n).setAutoRefresh(m))
            }, null, 8, ["value"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
}), ZT = { class: "font-semibold mb-3" }, QT = /* @__PURE__ */ ze({
  __name: "ConstantOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = st(), l = oe(() => n.config.constantValueType ?? "string"), u = oe(() => !n.config.constantValue || l.value === "number" && Number.isNaN(Number(n.config.constantValue)) ? "error" : ""), r = oe(() => n.config.constantValue ? l.value === "number" && Number.isNaN(Number(n.config.constantValue)) ? a("variable.constant.value.notNumber") : "" : a("variable.constant.value.required"));
    return (c, g) => {
      const y = ht("a-form-item");
      return O(), j("div", null, [
        b("div", ZT, P(f(a)("variable.constant.title")), 1),
        _(y, {
          label: f(a)("variable.constant.valueType")
        }, {
          default: q(() => [
            _(f(Cp), {
              value: l.value,
              onChange: g[0] || (g[0] = (v) => i("change", { constantValueType: v.target.value }))
            }, {
              default: q(() => [
                _(f(Ro), { value: "string" }, {
                  default: q(() => [
                    ce(P(f(a)("variable.constant.valueType.string")), 1)
                  ]),
                  _: 1
                }),
                _(f(Ro), { value: "number" }, {
                  default: q(() => [
                    ce(P(f(a)("variable.constant.valueType.number")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(y, {
          label: f(a)("variable.constant.value"),
          required: "",
          "validate-status": u.value,
          help: r.value
        }, {
          default: q(() => [
            _(f(it), {
              value: e.config.constantValue ?? "",
              placeholder: l.value === "number" ? "42" : f(a)("variable.constant.value"),
              onChange: g[1] || (g[1] = (v) => i("change", { constantValue: v.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label", "validate-status", "help"]),
        _(f(Yi), {
          checked: e.config.hideFromVariableList ?? !1,
          onChange: g[2] || (g[2] = (v) => i("change", { hideFromVariableList: v.target.checked }))
        }, {
          default: q(() => [
            ce(P(f(a)("variable.constant.hideFromList")), 1)
          ]),
          _: 1
        }, 8, ["checked"])
      ]);
    };
  }
}), XT = { class: "font-semibold mb-3" }, JT = {
  class: "grid mb-1",
  style: { "grid-template-columns": "1fr 1fr 32px", gap: "4px 8px" }
}, ez = { class: "text-xs text-secondary" }, tz = { class: "text-xs text-secondary" }, nz = { class: "mt-3" }, iz = { class: "mt-1" }, az = { class: "mt-1" }, lz = { class: "mt-1" }, oz = /* @__PURE__ */ ze({
  __name: "CustomOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = st();
    function l(u, r, c) {
      const g = (n.config.customOptions ?? []).map(
        (y, v) => v === u ? { ...y, [r]: c } : y
      );
      i("change", { customOptions: g });
    }
    return (u, r) => {
      const c = ht("a-form-item");
      return O(), j("div", null, [
        b("div", XT, P(f(a)("variable.custom.title")), 1),
        b("div", JT, [
          b("div", ez, P(f(a)("variable.custom.col.text")), 1),
          b("div", tz, P(f(a)("variable.custom.col.value")), 1),
          r[6] || (r[6] = b("div", null, null, -1)),
          (O(!0), j(Oe, null, et(e.config.customOptions ?? [], (g, y) => (O(), j(Oe, { key: y }, [
            _(f(it), {
              size: "small",
              value: g.text,
              placeholder: f(a)("variable.custom.text.placeholder"),
              onChange: (v) => l(y, "text", v.target.value)
            }, null, 8, ["value", "placeholder", "onChange"]),
            _(f(it), {
              size: "small",
              value: g.value,
              placeholder: f(a)("variable.custom.value.placeholder"),
              onChange: (v) => l(y, "value", v.target.value)
            }, null, 8, ["value", "placeholder", "onChange"]),
            _(f(ot), {
              type: "text",
              danger: "",
              size: "small",
              onClick: (v) => i("change", { customOptions: (e.config.customOptions ?? []).filter((m, S) => S !== y) })
            }, {
              default: q(() => [
                b("span", {
                  class: Re(f(De).delete)
                }, null, 2)
              ]),
              _: 1
            }, 8, ["onClick"])
          ], 64))), 128))
        ]),
        _(f(ot), {
          type: "dashed",
          size: "small",
          onClick: r[0] || (r[0] = (g) => i("change", { customOptions: [...e.config.customOptions ?? [], { text: "", value: "" }] }))
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).plus, "mr-1"])
            }, null, 2),
            ce(" " + P(f(a)("variable.custom.addOption")), 1)
          ]),
          _: 1
        }),
        b("div", nz, [
          _(f(Yi), {
            checked: e.config.multi,
            onChange: r[1] || (r[1] = (g) => i("change", { multi: g.target.checked }))
          }, {
            default: q(() => [
              ce(P(f(a)("variable.custom.multi")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        b("div", iz, [
          _(f(Yi), {
            checked: e.config.includeAll,
            onChange: r[2] || (r[2] = (g) => i("change", { includeAll: g.target.checked }))
          }, {
            default: q(() => [
              ce(P(f(a)("variable.custom.includeAll")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        e.config.includeAll ? (O(), Ce(c, {
          key: 0,
          label: f(a)("variable.custom.allValue"),
          class: "mt-3"
        }, {
          default: q(() => [
            _(f(it), {
              value: e.config.allValue ?? "",
              placeholder: f(a)("variable.custom.allValue.placeholder"),
              onChange: r[3] || (r[3] = (g) => i("change", { allValue: g.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"])) : be("", !0),
        b("div", az, [
          _(f(Yi), {
            checked: e.config.allowCustomValue ?? !1,
            onChange: r[4] || (r[4] = (g) => i("change", { allowCustomValue: g.target.checked }))
          }, {
            default: q(() => [
              ce(P(f(a)("variable.custom.allowCustomValue")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        b("div", lz, [
          _(f(Yi), {
            checked: e.config.allowClear ?? !1,
            onChange: r[5] || (r[5] = (g) => i("change", { allowClear: g.target.checked }))
          }, {
            default: q(() => [
              ce(P(f(a)("variable.custom.allowClear")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ])
      ]);
    };
  }
}), sz = { class: "font-semibold mb-3" }, rz = /* @__PURE__ */ ze({
  __name: "DataSourceOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = st(), a = [
      { label: "Zabbix", value: "zabbix" },
      { label: "Prometheus", value: "prometheus" },
      { label: "MySQL", value: "mysql" }
    ];
    return (l, u) => {
      const r = ht("a-form-item");
      return O(), j("div", null, [
        b("div", sz, P(f(i)("variable.ds.title")), 1),
        _(r, {
          label: f(i)("variable.ds.type")
        }, {
          default: q(() => [
            _(f(tt), {
              value: e.config.dsType,
              options: a,
              placeholder: f(i)("variable.ds.type.placeholder"),
              onChange: u[0] || (u[0] = (c) => n("change", { dsType: c }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(r, {
          label: f(i)("variable.ds.filterRegex")
        }, {
          default: q(() => [
            _(f(it), {
              value: e.config.instanceFilterRegex ?? "",
              placeholder: "/regex/",
              onChange: u[1] || (u[1] = (c) => n("change", { instanceFilterRegex: c.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(r, null, {
          default: q(() => [
            _(f(Yi), {
              checked: e.config.multi,
              onChange: u[2] || (u[2] = (c) => n("change", { multi: c.target.checked }))
            }, {
              default: q(() => [
                ce(P(f(i)("variable.ds.multi")), 1)
              ]),
              _: 1
            }, 8, ["checked"])
          ]),
          _: 1
        }),
        _(r, null, {
          default: q(() => [
            _(f(Yi), {
              checked: e.config.includeAll,
              onChange: u[3] || (u[3] = (c) => n("change", { includeAll: c.target.checked }))
            }, {
              default: q(() => [
                ce(P(f(i)("variable.ds.includeAll")), 1)
              ]),
              _: 1
            }, 8, ["checked"])
          ]),
          _: 1
        })
      ]);
    };
  }
}), uz = { class: "font-semibold mb-3" }, cz = { class: "grid grid-cols-2 gap-x-4" }, dz = /* @__PURE__ */ ze({
  __name: "GeneralSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = st(), a = [
      { label: i("variable.type.custom"), value: "custom" },
      { label: i("variable.type.query"), value: "query" },
      { label: i("variable.type.textbox"), value: "textbox" },
      { label: i("variable.type.datasource"), value: "datasource" },
      { label: i("variable.type.constant"), value: "constant" }
    ], l = [
      { label: i("variable.general.showOn.labelAndValue"), value: "label-and-value" },
      { label: i("variable.general.showOn.value"), value: "value" },
      { label: i("variable.general.showOn.nothing"), value: "nothing" }
    ];
    function u(r) {
      n("change", {
        type: r,
        dsType: void 0,
        instanceFilterRegex: void 0,
        targetDsUid: void 0,
        queryType: void 0,
        extractRegex: void 0,
        sortMode: void 0,
        customOptions: void 0,
        allValue: void 0,
        inputWidth: void 0,
        constantValue: void 0,
        hideFromVariableList: void 0
      });
    }
    return (r, c) => {
      const g = ht("a-form-item");
      return O(), j("div", null, [
        b("div", uz, P(f(i)("variable.general.title")), 1),
        b("div", cz, [
          _(g, {
            label: f(i)("variable.general.type"),
            required: "",
            "validate-status": e.config.type ? "" : "error",
            help: e.config.type ? "" : f(i)("variable.general.type.required")
          }, {
            default: q(() => [
              _(f(tt), {
                value: e.config.type,
                options: a,
                style: { width: "100%" },
                onChange: u
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label", "validate-status", "help"]),
          _(g, {
            label: f(i)("variable.general.name"),
            required: "",
            "validate-status": e.config.name ? "" : "error",
            help: e.config.name ? "" : f(i)("variable.general.name.required")
          }, {
            default: q(() => [
              _(f(it), {
                value: e.config.name,
                placeholder: "variable_name",
                onChange: c[0] || (c[0] = (y) => n("change", { name: y.target.value }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label", "validate-status", "help"]),
          _(g, {
            label: f(i)("variable.general.label")
          }, {
            default: q(() => [
              _(f(it), {
                value: e.config.label,
                placeholder: f(i)("variable.general.label.placeholder"),
                onChange: c[1] || (c[1] = (y) => n("change", { label: y.target.value }))
              }, null, 8, ["value", "placeholder"])
            ]),
            _: 1
          }, 8, ["label"]),
          _(g, {
            label: f(i)("variable.general.showOn")
          }, {
            default: q(() => [
              _(f(tt), {
                value: e.config.showOnDashboard ?? "label-and-value",
                options: l,
                style: { width: "100%" },
                onChange: c[2] || (c[2] = (y) => n("change", { showOnDashboard: y }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        _(g, {
          label: f(i)("variable.general.description")
        }, {
          default: q(() => [
            _(f(it), {
              value: e.config.description ?? "",
              placeholder: f(i)("variable.general.description.placeholder"),
              onChange: c[3] || (c[3] = (y) => n("change", { description: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), fz = { class: "font-semibold mb-3" }, hz = { class: "grid grid-cols-2 gap-x-4" }, gz = { class: "mb-2" }, pz = { class: "mb-2" }, mz = {
  class: "p-2 text-xs text-secondary rounded",
  style: { background: "var(--ant-color-fill-tertiary)", border: "1px solid var(--ant-color-border-secondary)", "min-height": "32px" }
}, vz = /* @__PURE__ */ ze({
  __name: "QueryOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = st(), a = [
      { label: i("variable.query.queryType.group"), value: "group" },
      { label: i("variable.query.queryType.host"), value: "host" },
      { label: i("variable.query.queryType.item"), value: "item" },
      { label: i("variable.query.queryType.labelValues"), value: "label_values" }
    ], l = [
      { label: i("variable.query.sort.disabled"), value: "disabled" },
      { label: i("variable.query.sort.alphabetical"), value: "alphabetical" },
      { label: i("variable.query.sort.numeric"), value: "numeric" }
    ], u = [
      { label: i("variable.query.refresh.onLoad"), value: "onLoad" },
      { label: i("variable.query.refresh.onTimeChange"), value: "onTimeChange" }
    ];
    return (r, c) => {
      const g = ht("a-form-item");
      return O(), j("div", null, [
        b("div", fz, P(f(i)("variable.query.title")), 1),
        _(g, {
          label: f(i)("variable.query.dsUid")
        }, {
          default: q(() => [
            _(f(it), {
              size: "small",
              value: e.config.targetDsUid ?? "",
              placeholder: f(i)("variable.query.dsUid.placeholder"),
              onChange: c[0] || (c[0] = (y) => n("change", { targetDsUid: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(g, {
          label: f(i)("variable.query.queryType")
        }, {
          default: q(() => [
            _(f(tt), {
              size: "small",
              value: e.config.queryType,
              options: a,
              style: { width: "100%" },
              placeholder: f(i)("variable.query.queryType.placeholder"),
              onChange: c[1] || (c[1] = (y) => n("change", { queryType: y }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(g, {
          label: f(i)("variable.query.query")
        }, {
          default: q(() => [
            _(f(it), {
              size: "small",
              value: e.config.query ?? "",
              placeholder: f(i)("variable.query.query.placeholder"),
              onChange: c[2] || (c[2] = (y) => n("change", { query: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(g, {
          label: f(i)("variable.query.regex")
        }, {
          default: q(() => [
            _(f(it), {
              size: "small",
              value: e.config.extractRegex ?? "",
              placeholder: f(i)("variable.query.regex.placeholder"),
              onChange: c[3] || (c[3] = (y) => n("change", { extractRegex: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        b("div", hz, [
          _(g, {
            label: f(i)("variable.query.sort")
          }, {
            default: q(() => [
              _(f(tt), {
                size: "small",
                value: e.config.sortMode ?? "disabled",
                options: l,
                style: { width: "100%" },
                onChange: c[4] || (c[4] = (y) => n("change", { sortMode: y }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"]),
          _(g, {
            label: f(i)("variable.query.refresh")
          }, {
            default: q(() => [
              _(f(tt), {
                size: "small",
                value: e.config.refresh,
                options: u,
                style: { width: "100%" },
                onChange: c[5] || (c[5] = (y) => n("change", { refresh: y }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        b("div", gz, [
          _(f(Yi), {
            checked: e.config.multi,
            onChange: c[6] || (c[6] = (y) => n("change", { multi: y.target.checked }))
          }, {
            default: q(() => [
              ce(P(f(i)("variable.query.multi")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        b("div", pz, [
          _(f(Yi), {
            checked: e.config.includeAll,
            onChange: c[7] || (c[7] = (y) => n("change", { includeAll: y.target.checked }))
          }, {
            default: q(() => [
              ce(P(f(i)("variable.query.includeAll")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        _(g, {
          label: f(i)("variable.query.preview")
        }, {
          default: q(() => [
            b("div", mz, P(f(i)("variable.query.preview.placeholder")), 1)
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), yz = { class: "font-semibold mb-3" }, bz = /* @__PURE__ */ ze({
  __name: "TextBoxOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = st();
    return (a, l) => {
      const u = ht("a-form-item");
      return O(), j("div", null, [
        b("div", yz, P(f(i)("variable.textbox.title")), 1),
        _(u, {
          label: f(i)("variable.textbox.default")
        }, {
          default: q(() => [
            _(f(it), {
              value: e.config.defaultValue ?? "",
              placeholder: f(i)("variable.textbox.default.placeholder"),
              onChange: l[0] || (l[0] = (r) => n("change", { defaultValue: r.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        _(u, {
          label: f(i)("variable.textbox.width")
        }, {
          default: q(() => [
            _(f(yn), {
              value: e.config.inputWidth,
              min: 60,
              max: 800,
              placeholder: "e.g. 200",
              onChange: l[1] || (l[1] = (r) => n("change", { inputWidth: r ?? void 0 }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), xz = /* @__PURE__ */ ze({
  __name: "VariableForm",
  props: {
    draft: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t;
    st();
    function i(a) {
      n("change", a);
    }
    return (a, l) => (O(), Ce(f(Mp), {
      layout: "vertical",
      class: "px-5 py-4 overflow-y-auto flex-1"
    }, {
      default: q(() => [
        _(dz, {
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"]),
        l[0] || (l[0] = b("div", {
          class: "my-4",
          style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
        }, null, -1)),
        e.draft.config.type === "query" ? (O(), Ce(vz, {
          key: 0,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : be("", !0),
        e.draft.config.type === "datasource" ? (O(), Ce(rz, {
          key: 1,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : be("", !0),
        e.draft.config.type === "custom" ? (O(), Ce(oz, {
          key: 2,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : be("", !0),
        e.draft.config.type === "textbox" ? (O(), Ce(bz, {
          key: 3,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : be("", !0),
        e.draft.config.type === "constant" ? (O(), Ce(QT, {
          key: 4,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : be("", !0)
      ]),
      _: 1
    }));
  }
}), wz = {
  class: "w-45 flex flex-col h-full",
  style: { "border-right": "1px solid var(--ant-color-border-secondary)" }
}, Sz = {
  class: "px-3 py-2 text-xs text-secondary",
  style: { "border-bottom": "1px solid var(--ant-color-border-secondary)" }
}, kz = { class: "flex-1 overflow-y-auto" }, _z = ["onClick"], Cz = { key: 0 }, Mz = {
  key: 1,
  class: "text-secondary"
}, Tz = {
  class: "p-2",
  style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
}, zz = /* @__PURE__ */ ze({
  __name: "VariableNavList",
  props: {
    drafts: {},
    selectedId: {}
  },
  emits: ["select", "add"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = st();
    return (a, l) => (O(), j("div", wz, [
      b("div", Sz, P(f(i)("variable.nav.count", { n: e.drafts.length })), 1),
      b("div", kz, [
        (O(!0), j(Oe, null, et(e.drafts, (u) => (O(), j("div", {
          key: u.id,
          class: Re(["px-3 py-2 cursor-pointer text-sm transition-colors", u.id === e.selectedId ? "bg-blue-50 dark:bg-blue-900/30 border-l-3 border-primary" : "border-l-3 border-transparent"]),
          onClick: (r) => n("select", u.id)
        }, [
          u.config.name ? (O(), j("span", Cz, P(u.config.name), 1)) : (O(), j("span", Mz, P(f(i)("variable.nav.unnamed")), 1))
        ], 10, _z))), 128))
      ]),
      b("div", Tz, [
        _(f(ot), {
          type: "dashed",
          block: "",
          onClick: l[0] || (l[0] = (u) => n("add"))
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).plus, "mr-1"])
            }, null, 2),
            ce(" " + P(f(i)("variable.modal.add")), 1)
          ]),
          _: 1
        })
      ])
    ]));
  }
}), Dz = { class: "flex flex-1 overflow-hidden" }, Oz = { class: "flex-1 overflow-hidden flex flex-col" }, Pz = {
  key: 1,
  class: "flex-1 flex-center text-secondary text-sm"
}, Iz = { class: "flex items-center justify-between w-full" }, Ez = { class: "flex gap-2" }, $z = /* @__PURE__ */ ze({
  __name: "VariableConfigModal",
  props: {
    open: { type: Boolean }
  },
  emits: ["close"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = gl(), { t: l } = st(), u = pe([]), r = pe(""), c = () => `new-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
    function g(C) {
      return {
        id: "",
        name: C,
        label: "",
        type: "custom",
        hide: !1,
        refresh: "onLoad",
        multi: !1,
        includeAll: !1,
        showOnDashboard: "label-and-value"
      };
    }
    Ye(
      () => n.open,
      (C) => {
        if (C) {
          const E = Object.values(a.variables).map((X) => ({
            id: X.config.id,
            isNew: !1,
            config: JSON.parse(JSON.stringify(X.config))
          }));
          u.value = E, r.value = E[0]?.id ?? "";
        }
      }
    );
    const y = oe(
      () => u.value.find((C) => C.id === r.value) ?? null
    );
    function v() {
      const E = `variable_${u.value.length + 1}`, X = c(), F = {
        id: X,
        isNew: !0,
        config: g(E)
      };
      u.value = [...u.value, F], r.value = X;
    }
    function m() {
      if (!y.value)
        return;
      const C = u.value.findIndex((E) => E.id === r.value);
      u.value = u.value.filter((E) => E.id !== r.value), u.value.length > 0 ? r.value = u.value[Math.min(C, u.value.length - 1)].id : r.value = "";
    }
    function S(C) {
      y.value && (u.value = u.value.map(
        (E) => E.id === r.value ? { ...E, config: { ...E.config, ...C } } : E
      ));
    }
    function T() {
      const C = a.variables, E = new Set(u.value.map((F) => F.id)), X = new Set(Object.keys(C));
      for (const F of X)
        E.has(F) || a.removeVariable(F);
      for (const F of u.value) {
        const V = { ...F.config, id: F.id };
        V.hide = V.showOnDashboard === "nothing" || !!V.hideFromVariableList, V.customOptions && (V.customValues = V.customOptions.map((N) => N.value).join(",")), F.isNew || !X.has(F.id) ? a.addVariable(V) : a.updateVariable(F.id, V);
      }
      i("close");
    }
    return (C, E) => (O(), Ce(kc, {
      mode: "modal",
      open: e.open,
      title: f(l)("variable.modal.title"),
      width: 780,
      "body-height": "480px",
      onClose: E[2] || (E[2] = (X) => i("close"))
    }, {
      footer: q(() => [
        b("div", Iz, [
          _(f(ot), {
            danger: "",
            disabled: !y.value,
            onClick: m
          }, {
            default: q(() => [
              ce(P(f(l)("variable.modal.delete")), 1)
            ]),
            _: 1
          }, 8, ["disabled"]),
          b("div", Ez, [
            _(f(ot), {
              onClick: E[1] || (E[1] = (X) => i("close"))
            }, {
              default: q(() => [
                ce(P(f(l)("variable.modal.cancel")), 1)
              ]),
              _: 1
            }),
            _(f(ot), {
              type: "primary",
              onClick: T
            }, {
              default: q(() => [
                ce(P(f(l)("variable.modal.save")), 1)
              ]),
              _: 1
            })
          ])
        ])
      ]),
      default: q(() => [
        b("div", Dz, [
          _(zz, {
            drafts: u.value,
            "selected-id": r.value,
            onSelect: E[0] || (E[0] = (X) => r.value = X),
            onAdd: v
          }, null, 8, ["drafts", "selected-id"]),
          b("div", Oz, [
            y.value ? (O(), Ce(xz, {
              key: 0,
              draft: y.value,
              onChange: S
            }, null, 8, ["draft"])) : (O(), j("div", Pz, P(f(l)("variable.modal.placeholder")), 1))
          ])
        ])
      ]),
      _: 1
    }, 8, ["open", "title"]));
  }
}), Az = {
  key: 0,
  class: "flex items-center gap-3 flex-wrap",
  style: { padding: "0 8px" }
}, Nz = {
  key: 0,
  class: "flex items-center gap-1"
}, Rz = {
  key: 1,
  class: "flex items-center gap-1"
}, Lz = {
  key: 2,
  class: "flex items-center gap-1"
}, dp = /* @__PURE__ */ ze({
  __name: "VariableBar",
  setup(e) {
    const t = gl(), n = Gi(), i = Hi(), { t: a } = st(), l = pe(!1), u = oe(
      () => Object.entries(t.variables).filter(([, g]) => !g.config.hide).map(([g, y]) => ({ id: g, state: y })).sort((g, y) => g.state.config.name.localeCompare(y.state.config.name))
    ), r = oe(() => i.isDark ? "#888" : "#555");
    function c(g, y) {
      console.warn("var", y), t.setValue(g, y);
      const v = t.variables[g];
      if (v) {
        const m = t.getDependents(v.config.name);
        for (const S of m)
          for (const [T, C] of Object.entries(t.variables))
            if (C.config.name === S) {
              t.refreshVariable(T);
              break;
            }
      }
    }
    return (g, y) => u.value.length > 0 || f(n).isEditing ? (O(), j("div", Az, [
      (O(!0), j(Oe, null, et(u.value, (v) => (O(), j(Oe, {
        key: v.id
      }, [
        v.state.config.type === "textbox" ? (O(), j("div", Nz, [
          b("span", {
            class: "text-sm",
            style: Ue({ color: r.value, whiteSpace: "nowrap" })
          }, P(v.state.config.label), 5),
          _(f(it), {
            size: "small",
            style: { width: "160px" },
            value: Array.isArray(v.state.current) ? v.state.current[0] || "" : v.state.current,
            placeholder: "Enter value...",
            onChange: (m) => c(v.id, m.target.value)
          }, null, 8, ["value", "onChange"])
        ])) : v.state.config.type === "constant" ? (O(), j("div", Rz, [
          v.state.config.label ? (O(), j("span", {
            key: 0,
            class: "text-sm",
            style: Ue({ color: r.value, whiteSpace: "nowrap" })
          }, P(v.state.config.label), 5)) : be("", !0),
          _(f(Zl), { style: { margin: "0", "font-size": "12px" } }, {
            default: q(() => [
              ce(P(v.state.config.constantValue ?? ""), 1)
            ]),
            _: 2
          }, 1024)
        ])) : (O(), j("div", Lz, [
          b("span", {
            class: "text-sm",
            style: Ue({ color: r.value, whiteSpace: "nowrap" })
          }, P(v.state.config.label || v.state.config.name) + ": ", 5),
          _(f(tt), {
            value: v.state.current,
            mode: v.state.config.allowCustomValue ? v.state.config.multi ? "tags" : "SECRET_COMBOBOX_MODE_DO_NOT_USE" : v.state.config.multi ? "multiple" : void 0,
            loading: v.state.loading,
            style: { minWidth: "120px" },
            size: "small",
            "show-search": "",
            "allow-clear": v.state.config.allowClear ?? !1,
            "filter-option": (m, S) => (S?.label ?? "").toLowerCase().includes(m.toLowerCase()),
            placeholder: `Select ${v.state.config.label || v.state.config.name}`,
            onChange: (m) => c(v.id, m)
          }, {
            default: q(() => [
              (O(!0), j(Oe, null, et(v.state.options, (m) => (O(), Ce(f(Tp), {
                key: m.value,
                value: m.value,
                label: m.label === "$__all" ? f(a)("common.all") : m.label
              }, {
                default: q(() => [
                  ce(P(m.label === "$__all" ? f(a)("common.all") : m.label), 1)
                ]),
                _: 2
              }, 1032, ["value", "label"]))), 128))
            ]),
            _: 2
          }, 1032, ["value", "mode", "loading", "allow-clear", "filter-option", "placeholder", "onChange"]),
          v.state.error ? (O(), Ce(f(Zl), {
            key: 0,
            color: "red",
            style: { "font-size": "10px", margin: "0" }
          }, {
            default: q(() => [
              ce(P(v.state.error), 1)
            ]),
            _: 2
          }, 1024)) : be("", !0)
        ]))
      ], 64))), 128)),
      f(n).isEditing ? (O(), Ce(f(ot), {
        key: 0,
        size: "small",
        type: "text",
        class: "ml-auto",
        onClick: y[0] || (y[0] = (v) => l.value = !0)
      }, {
        default: q(() => [
          b("span", {
            class: Re([f(De).settings, "text-base"])
          }, null, 2)
        ]),
        _: 1
      })) : be("", !0),
      _($z, {
        open: l.value,
        onClose: y[1] || (y[1] = (v) => l.value = !1)
      }, null, 8, ["open"])
    ])) : be("", !0);
  }
}), qz = /* @__PURE__ */ ze({
  __name: "DatasourceSelect",
  props: {
    value: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { config: i } = no(), a = oe(() => {
      const r = [{ value: "mock", label: "Mock", type: "mock", uid: "" }], c = i.value.datasourceConfig ?? [];
      return c.filter((g) => g.type === "zabbix").forEach((g, y) => {
        const v = g.uid || String(y);
        r.push({ value: `zabbix:${v}`, label: `${g.name}`, type: "zabbix", uid: v });
      }), c.filter((g) => g.type === "argus").forEach((g, y) => {
        const v = g.uid || String(y);
        r.push({ value: `argus:${v}`, label: `${g.name}`, type: "argus", uid: v });
      }), r;
    }), l = oe(
      () => a.value.map((r) => ({ value: r.value, label: r.label }))
    );
    function u(r) {
      const c = a.value.find((g) => g.value === r);
      c && n("change", c);
    }
    return (r, c) => (O(), Ce(f(tt), {
      size: "small",
      style: { "min-width": "140px" },
      value: e.value,
      options: l.value,
      onChange: u
    }, null, 8, ["value", "options"]));
  }
}), Fz = {
  key: 0,
  class: ""
}, Vz = {
  key: 1,
  class: "pt-2 px-2 text-xs text-secondary"
}, Wz = /* @__PURE__ */ ze({
  __name: "QueryEditorRow",
  props: {
    entry: {},
    index: {},
    isChart: { type: Boolean },
    canDelete: { type: Boolean }
  },
  emits: ["update", "remove"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = oe(() => "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[n.index] ?? String(n.index + 1)), l = oe(() => Qs(n.entry.dataSource.type)), u = oe(() => l.value?.QueryEditor ?? null), r = oe(() => {
      const y = n.entry.dataSource;
      if (y.type === "mock")
        return "mock";
      const v = "datasourceId" in y ? y.datasourceId : "";
      return v ? `${y.type}:${v}` : y.type;
    });
    function c(y) {
      const v = Qs(y.type);
      if (!v?.defaultQuery)
        return;
      const m = { ...v.defaultQuery(), ...y.uid ? { datasourceId: y.uid } : {} };
      i("update", { dataSource: m });
    }
    function g(y) {
      i("update", { dataSource: y });
    }
    return (y, v) => (O(), Ce(f(Bs), {
      size: "small",
      collapsible: "icon",
      bordered: !0,
      "default-active-key": [e.entry.id]
    }, {
      default: q(() => [
        (O(), Ce(f(Bs).Panel, {
          key: e.entry.id
        }, {
          header: q(() => [
            b("div", {
              class: "flex items-center gap-2",
              onClick: v[3] || (v[3] = Qn(() => {
              }, ["stop"]))
            }, [
              _(f(Zl), {
                color: "blue",
                style: { "font-size": "12px", "font-weight": "600", margin: "0", "min-width": "24px", "text-align": "center", "line-height": "20px" }
              }, {
                default: q(() => [
                  ce(P(a.value), 1)
                ]),
                _: 1
              }),
              _(f(oa), {
                size: "small",
                checked: e.entry.enabled,
                onChange: v[0] || (v[0] = (m) => i("update", { enabled: m })),
                onClick: v[1] || (v[1] = Qn(() => {
                }, ["stop"]))
              }, null, 8, ["checked"]),
              v[5] || (v[5] = b("div", { class: "flex-1" }, null, -1)),
              v[6] || (v[6] = b("span", { style: { "font-size": "11px", color: "var(--ant-color-text-secondary)" } }, "数据源", -1)),
              _(qz, {
                value: r.value,
                onClick: v[2] || (v[2] = Qn(() => {
                }, ["stop"])),
                onChange: c
              }, null, 8, ["value"])
            ])
          ]),
          extra: q(() => [
            e.canDelete ? (O(), Ce(f(ot), {
              key: 0,
              type: "text",
              danger: "",
              size: "small",
              onClick: v[4] || (v[4] = Qn((m) => i("remove"), ["stop"]))
            }, {
              default: q(() => [
                b("span", {
                  class: Re(f(De).delete)
                }, null, 2)
              ]),
              _: 1
            })) : be("", !0)
          ]),
          default: q(() => [
            e.entry.enabled && u.value ? (O(), j("div", Fz, [
              (O(), Ce(Nf(u.value), {
                query: e.entry.dataSource,
                "datasource-id": "datasourceId" in e.entry.dataSource ? e.entry.dataSource.datasourceId : "",
                "is-chart": e.isChart,
                onChange: g
              }, null, 40, ["query", "datasource-id", "is-chart"]))
            ])) : e.entry.enabled && !u.value ? (O(), j("div", Vz, " No query editor available for datasource type: " + P(e.entry.dataSource.type), 1)) : be("", !0)
          ]),
          _: 1
        }))
      ]),
      _: 1
    }, 8, ["default-active-key"]));
  }
}), Yz = {
  class: "px-4 py-3 flex flex-col gap-2",
  style: { "min-width": "300px" }
}, Bz = { class: "flex items-center gap-2" }, Hz = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, jz = { class: "flex items-center gap-2" }, Uz = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Gz = { class: "flex items-center gap-2" }, Kz = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Zz = {
  class: "text-xs",
  style: { color: "var(--ant-color-text-quaternary)" }
}, Qz = { class: "flex items-center gap-2" }, Xz = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Jz = { class: "flex items-center gap-2" }, eD = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, zf = 1e3, tD = /* @__PURE__ */ ze({
  __name: "QueryOptionsPanel",
  setup(e) {
    const { t } = st(), { panel: n, onChange: i } = uo(), a = Gi();
    function l(g) {
      return g >= 36e5 ? `${Math.round(g / 36e5)}h` : g >= 6e4 ? `${Math.round(g / 6e4)}m` : g >= 1e3 ? `${Math.round(g / 1e3)}s` : `${g}ms`;
    }
    function u(g) {
      const y = g.trim().match(/^(\d+(?:\.\d+)?)(ms|[smh])?$/i);
      if (!y)
        return;
      const v = Number.parseFloat(y[1]), m = (y[2] ?? "s").toLowerCase();
      return m === "ms" ? v : m === "s" ? v * 1e3 : m === "m" ? v * 6e4 : v * 36e5;
    }
    const r = oe(() => {
      const g = n.value.queryOptions?.maxDataPoints ?? zf, y = a.timeRange, v = y.to - y.from;
      return Math.max(Math.ceil(v / g), 1e3);
    }), c = oe(() => {
      const g = n.value.queryOptions?.minIntervalMs;
      return g != null ? l(g) : "";
    });
    return (g, y) => (O(), j("div", Yz, [
      b("div", Bz, [
        b("span", Hz, [
          _(f(Zn), {
            title: f(t)("qb.queryOptions.maxDataPoints")
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + P(f(t)("qb.queryOptions.maxDataPoints")), 1)
        ]),
        _(f(yn), {
          size: "small",
          style: { width: "100px" },
          min: 1,
          value: f(n).queryOptions?.maxDataPoints,
          placeholder: String(zf),
          onChange: y[0] || (y[0] = (v) => f(i)({ queryOptions: { ...f(n).queryOptions, maxDataPoints: v ?? void 0 } }))
        }, null, 8, ["value", "placeholder"])
      ]),
      b("div", jz, [
        b("span", Uz, [
          _(f(Zn), {
            title: f(t)("qb.queryOptions.minInterval")
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + P(f(t)("qb.queryOptions.minInterval")), 1)
        ]),
        _(f(it), {
          size: "small",
          style: { width: "100px" },
          value: c.value,
          placeholder: f(t)("qb.queryOptions.minIntervalPlaceholder"),
          onChange: y[1] || (y[1] = (v) => {
            const m = v.target.value.trim();
            if (!m) {
              f(i)({ queryOptions: { ...f(n).queryOptions, minIntervalMs: void 0 } });
              return;
            }
            const S = u(m);
            S !== void 0 && f(i)({ queryOptions: { ...f(n).queryOptions, minIntervalMs: S } });
          })
        }, null, 8, ["value", "placeholder"])
      ]),
      b("div", Gz, [
        b("span", Kz, [
          _(f(Zn), {
            title: f(t)("qb.queryOptions.interval")
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + P(f(t)("qb.queryOptions.interval")), 1)
        ]),
        _(f(it), {
          size: "small",
          style: { width: "100px" },
          value: l(r.value),
          readonly: ""
        }, null, 8, ["value"]),
        b("span", Zz, " = " + P(f(t)("qb.queryOptions.intervalHint")), 1)
      ]),
      b("div", Qz, [
        b("span", Xz, [
          _(f(Zn), {
            title: f(t)("qb.queryOptions.relativeTime")
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + P(f(t)("qb.queryOptions.relativeTime")), 1)
        ]),
        _(f(it), {
          size: "small",
          style: { width: "100px" },
          placeholder: "1h",
          value: f(n).queryOptions?.relativeTime ?? "",
          onChange: y[2] || (y[2] = (v) => f(i)({ queryOptions: { ...f(n).queryOptions, relativeTime: v.target.value || void 0 } }))
        }, null, 8, ["value"])
      ]),
      b("div", Jz, [
        b("span", eD, [
          _(f(Zn), {
            title: f(t)("qb.queryOptions.timeShift")
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + P(f(t)("qb.queryOptions.timeShift")), 1)
        ]),
        _(f(it), {
          size: "small",
          style: { width: "100px" },
          placeholder: "1h",
          value: f(n).queryOptions?.timeShift ?? "",
          onChange: y[3] || (y[3] = (v) => f(i)({ queryOptions: { ...f(n).queryOptions, timeShift: v.target.value || void 0 } }))
        }, null, 8, ["value"])
      ])
    ]));
  }
}), nD = { class: "flex flex-col h-full" }, iD = {
  class: "flex items-center gap-2 px-3 py-1.5 flex-shrink-0 flex-wrap",
  style: { "border-bottom": "1px solid var(--ant-color-border-secondary)" }
}, aD = { class: "flex-1 overflow-y-auto px-3 py-2 flex flex-col gap-2" }, lD = {
  key: 0,
  class: "text-center text-secondary text-sm py-8"
}, oD = /* @__PURE__ */ ze({
  __name: "QueryEditorPane",
  setup(e) {
    const { t } = st(), { panel: n, onChange: i } = uo(), a = oe(() => ["timeseries", "bar", "histogram"].includes(n.value.type)), l = oe(() => n.value.queries ?? []), u = pe(!1), r = pe("mock");
    function c(v, m) {
      i({ queries: l.value.map((S, T) => T === v ? { ...S, ...m } : S) });
    }
    function g(v) {
      i({ queries: l.value.filter((m, S) => S !== v) });
    }
    function y() {
      if (l.value.length >= 26)
        return;
      const v = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[l.value.length] ?? String(l.value.length + 1), [m, S = ""] = r.value.split(":"), T = Qs(m);
      if (!T?.defaultQuery)
        return;
      const C = {
        ...T.defaultQuery(),
        ...S ? { datasourceId: S } : {},
        // Non-chart types: each query = 1 series; seriesCount controlled by query count
        ...!a.value && "seriesCount" in T.defaultQuery() ? { seriesCount: 1 } : {}
      };
      i({
        queries: [...l.value, { id: v, enabled: !0, dataSource: C }]
      });
    }
    return (v, m) => (O(), j("div", nD, [
      b("div", iD, [
        _(dp),
        m[1] || (m[1] = b("div", { class: "flex-1" }, null, -1)),
        _(cp),
        _(f(zp), {
          type: "vertical",
          style: { margin: "0" }
        }),
        _(f(Bl).Compact, null, {
          default: q(() => [
            _(f(ot), {
              type: "primary",
              disabled: l.value.length >= 26,
              onClick: y
            }, {
              default: q(() => [
                b("span", {
                  class: Re([f(De).plus, "mr-1"])
                }, null, 2),
                ce(" " + P(f(t)("qb.addQuery")), 1)
              ]),
              _: 1
            }, 8, ["disabled"]),
            _(f(Dp), {
              open: u.value,
              "onUpdate:open": m[0] || (m[0] = (S) => u.value = S),
              trigger: "click",
              placement: "bottomRight",
              "overlay-inner-style": { padding: 0, minWidth: "320px" }
            }, {
              content: q(() => [
                _(tD)
              ]),
              default: q(() => [
                _(f(ot), { class: "text-12px cursor-pointer hover:op-90 active:op-80 underline" }, {
                  default: q(() => [
                    ce(P(f(t)("qb.queryOptions")) + " ", 1),
                    b("span", {
                      class: Re([f(De).chevronDown, ""])
                    }, null, 2)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["open"])
          ]),
          _: 1
        })
      ]),
      b("div", aD, [
        (O(!0), j(Oe, null, et(l.value, (S, T) => (O(), Ce(Wz, {
          key: S.id,
          entry: S,
          index: T,
          "is-chart": a.value,
          "can-delete": l.value.length > 1,
          onUpdate: (C) => c(T, C),
          onRemove: () => g(T)
        }, null, 8, ["entry", "index", "is-chart", "can-delete", "onUpdate", "onRemove"]))), 128)),
        l.value.length === 0 ? (O(), j("div", lD, ' No queries. Click "' + P(f(t)("qb.addQuery")) + '" to start. ', 1)) : be("", !0)
      ])
    ]));
  }
}), sD = { class: "w-full h-full" }, rD = { class: "w-full h-full" }, uD = /* @__PURE__ */ ze({
  __name: "PanelEditorLayout",
  setup(e) {
    const n = Hi().isDark ? "#303030" : "#e8e8e8";
    return (i, a) => (O(), Ce(f(_f), { style: { height: "100%" } }, {
      default: q(() => [
        _(f($s), { "min-size": 200 }, {
          default: q(() => [
            _(f(_f), {
              vertical: "",
              "default-sizes": [100, 200]
            }, {
              default: q(() => [
                _(f($s), { "min-size": 100 }, {
                  default: q(() => [
                    b("div", sD, [
                      _(KT)
                    ])
                  ]),
                  _: 1
                }),
                _(f($s), { "min-size": 60 }, {
                  default: q(() => [
                    b("div", rD, [
                      _(oD)
                    ])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        _(f($s), {
          "preferred-size": "35%",
          "min-size": 200
        }, {
          default: q(() => [
            b("div", {
              class: "w-full h-full overflow-y-auto",
              style: Ue({ borderLeft: `1px solid ${f(n)}` })
            }, [
              _(C2)
            ], 4)
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
}), cD = { class: "font-medium text-sm" }, dD = { class: "flex justify-end gap-2 py-1" }, fD = /* @__PURE__ */ ze({
  __name: "PanelEditorModal",
  setup(e) {
    const t = Gi(), { t: n } = st(), i = pe(null), a = oe(() => {
      const T = t.editingPanelId;
      return T ? t.panels[T] : null;
    }), l = oe(() => i.value ?? a.value), { response: u } = Gg(
      () => l.value?.queries ?? [],
      () => t.timeRange,
      800
    ), r = oe(() => {
      const T = u.value?.data?.[0];
      return T ? T.fields.filter((C) => C.type === "number").map((C) => C.name) : [];
    }), c = oe(() => {
      const T = u.value?.data?.[0];
      return T ? T.fields.map((C) => C.config?.displayNameFromDS ?? C.name) : [];
    });
    function g(T) {
      l.value && (i.value = { ...l.value, ...T });
    }
    function y() {
      i.value && t.editingPanelId && t.updatePanel(t.editingPanelId, i.value), i.value = null, t.setEditingPanel(null);
    }
    function v() {
      i.value = null, t.setEditingPanel(null);
    }
    Ye(() => t.editingPanelId, (T) => {
      T || (i.value = null);
    });
    const m = oe(() => !!t.editingPanelId && !!a.value), S = pe(!1);
    return Ye(m, (T) => {
      T && !S.value && setTimeout(() => {
        S.value = !0;
      }, 0);
    }), fk({
      panel: oe(() => l.value),
      onChange: g,
      previewData: u,
      numericFieldNames: r,
      allFieldNames: c
    }), (T, C) => (O(), Ce(kc, {
      mode: "drawer",
      open: m.value,
      width: "71vw",
      mask: !0,
      "destroy-on-close": !1,
      onClose: v
    }, {
      title: q(() => [
        b("span", cD, "Edit: " + P(l.value?.title ?? ""), 1)
      ]),
      footer: q(() => [
        b("div", dD, [
          _(f(ot), { onClick: v }, {
            default: q(() => [
              ce(P(f(n)("dashboard.cancel")), 1)
            ]),
            _: 1
          }),
          _(f(ot), {
            type: "primary",
            onClick: y
          }, {
            default: q(() => [
              ce(P(f(n)("dashboard.save")), 1)
            ]),
            _: 1
          })
        ])
      ]),
      default: q(() => [
        l.value && S.value ? (O(), Ce(uD, { key: 0 })) : be("", !0)
      ]),
      _: 1
    }, 8, ["open"]));
  }
}), hD = {
  key: 0,
  class: "panel-container w-full h-full flex flex-col rounded overflow-hidden bg-white dark:bg-[#1f1f1f] border border-[#e8e8e8] dark:border-[#303030]"
}, gD = { class: "flex items-center gap-2 min-w-0 lh-1 flex-1 text-[#666] dark:text-[#666]" }, pD = {
  key: 0,
  class: "drag-handle flex-shrink-0 cursor-grab"
}, mD = { class: "text-sm truncate text-[#141414] dark:text-[#d9d9d9]" }, vD = { class: "panel-actions flex items-center gap-10px lh-1 flex-shrink-0 text-[#444] dark:text-[#666]" }, yD = { class: "panel-content flex-1 overflow-hidden" }, bD = { class: "w-full h-full flex flex-col rounded-lg overflow-hidden bg-white dark:bg-[#1f1f1f]" }, xD = { class: "panel-content flex-1 overflow-hidden" }, wD = /* @__PURE__ */ ze({
  __name: "PanelContainer",
  props: {
    panelId: {},
    menuMode: { default: "inline" }
  },
  setup(e) {
    const t = e, n = Gi(), i = Hi(), { t: a } = st(), l = pe(!1), u = pe(!1), r = oe(() => n.panels[t.panelId]), c = oe(() => i.isDark), g = oe(() => c.value ? "#666" : "#bbb"), y = oe(() => {
      const T = (C) => Gn("span", { class: C });
      return n.isEditing ? [
        { key: "edit", label: a("panel.menu.edit"), icon: () => T(De.edit) },
        { key: "clone", label: a("panel.menu.clone"), icon: () => T(De.clone) },
        { key: "fullscreen", label: a("panel.menu.fullscreen"), icon: () => T(De.fullscreen) },
        { type: "divider" },
        { key: "remove", label: a("panel.menu.remove"), icon: () => T(De.delete), danger: !0 }
      ] : [
        { key: "fullscreen", label: a("panel.menu.fullscreen"), icon: () => T(De.fullscreen) }
      ];
    });
    function v(T) {
      switch (T) {
        case "edit":
          n.setEditingPanel(t.panelId);
          break;
        case "clone":
          n.clonePanel(t.panelId);
          break;
        case "remove":
          jo.confirm({
            title: a("panel.remove.title", { title: r.value?.title ?? "" }),
            content: a("panel.remove.content"),
            okText: a("panel.remove.ok"),
            cancelText: a("panel.remove.cancel"),
            maskStyle: { background: "rgba(0, 0, 0, 0.2)" },
            zIndex: 2001,
            okButtonProps: { danger: !0 },
            onOk: () => n.removePanel(t.panelId)
          });
          break;
        case "fullscreen":
          l.value = !0;
          break;
      }
    }
    function m(T) {
      u.value = !1, v(String(T.key));
    }
    function S(T) {
      T.stopPropagation(), n.refreshPanel(t.panelId);
    }
    return (T, C) => (O(), j(Oe, null, [
      r.value && !l.value ? (O(), j("div", hD, [
        b("div", {
          class: "panel-header flex items-center px-3 py-2 flex-shrink-0 border-b border-[#e8e8e8] dark:border-[#303030]",
          onDblclick: C[6] || (C[6] = (E) => f(n).isEditing && f(n).setEditingPanel(t.panelId))
        }, [
          b("div", gD, [
            f(n).isEditing ? (O(), j("span", pD, [
              b("span", {
                class: Re(f(De).dragVertical)
              }, null, 2)
            ])) : be("", !0),
            b("span", mD, P(r.value.title), 1),
            r.value.description ? (O(), Ce(f(Zn), {
              key: 1,
              title: r.value.description,
              placement: "bottom"
            }, {
              default: q(() => [
                b("span", {
                  class: Re([f(De).info, "flex-shrink-0"])
                }, null, 2)
              ]),
              _: 1
            }, 8, ["title"])) : be("", !0),
            _(ip, {
              links: r.value.links ?? [],
              "icon-color": g.value
            }, null, 8, ["links", "icon-color"])
          ]),
          b("div", vD, [
            _(f(Zn), {
              title: f(a)("panel.menu.refresh")
            }, {
              default: q(() => [
                b("span", {
                  class: Re([f(De).refresh, "panel-refresh-btn cursor-pointer"]),
                  onMousedown: C[0] || (C[0] = Qn(() => {
                  }, ["stop"])),
                  onClick: S
                }, null, 34)
              ]),
              _: 1
            }, 8, ["title"]),
            t.menuMode === "inline" ? (O(), j(Oe, { key: 0 }, [
              f(n).isEditing ? (O(), Ce(f(Zn), {
                key: 0,
                title: f(a)("panel.menu.edit")
              }, {
                default: q(() => [
                  b("span", {
                    class: Re([f(De).edit, "cursor-pointer"]),
                    onClick: C[1] || (C[1] = (E) => v("edit"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : be("", !0),
              f(n).isEditing ? (O(), Ce(f(Zn), {
                key: 1,
                title: f(a)("panel.menu.clone")
              }, {
                default: q(() => [
                  b("span", {
                    class: Re([f(De).clone, "cursor-pointer"]),
                    onClick: C[2] || (C[2] = (E) => v("clone"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : be("", !0),
              f(n).isEditing ? (O(), Ce(f(Zn), {
                key: 2,
                title: f(a)("panel.menu.remove")
              }, {
                default: q(() => [
                  b("span", {
                    class: Re([f(De).delete, "cursor-pointer text-red-500"]),
                    onClick: C[3] || (C[3] = (E) => v("remove"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : be("", !0)
            ], 64)) : (O(), Ce(f(Jo), {
              key: 1,
              open: u.value,
              "onUpdate:open": C[5] || (C[5] = (E) => u.value = E),
              trigger: "click"
            }, {
              overlay: q(() => [
                _(f(Di), {
                  items: y.value,
                  onClick: m
                }, null, 8, ["items"])
              ]),
              default: q(() => [
                b("span", {
                  class: "cursor-pointer p-[2px_4px]",
                  onClick: C[4] || (C[4] = Qn(() => {
                  }, ["prevent"]))
                }, [
                  b("span", {
                    class: Re(f(De).dotsVertical)
                  }, null, 2)
                ])
              ]),
              _: 1
            }, 8, ["open"]))
          ])
        ], 32),
        b("div", yD, [
          An(T.$slots, "default", {}, void 0, !0)
        ])
      ])) : be("", !0),
      l.value ? (O(), Ce(f(jo), {
        key: 1,
        open: !0,
        title: r.value?.title,
        footer: null,
        width: "92vw",
        "body-style": { height: "82vh", padding: 0 },
        closable: !1,
        onCancel: C[7] || (C[7] = (E) => l.value = !1)
      }, {
        default: q(() => [
          b("div", bD, [
            b("div", xD, [
              An(T.$slots, "default", {}, void 0, !0)
            ])
          ])
        ]),
        _: 3
      }, 8, ["title"])) : be("", !0)
    ], 64));
  }
}), Df = /* @__PURE__ */ Vn(wD, [["__scopeId", "data-v-548b9131"]]), SD = { class: "font-medium text-sm" }, kD = { class: "text-xs text-secondary mt-1" }, _D = /* @__PURE__ */ ze({
  __name: "AddPanelModal",
  setup(e) {
    const t = Gi(), { t: n } = st(), i = [
      { type: "timeseries", icon: De.chartLine, descKey: "panel.type.desc.timeseries" },
      { type: "bar", icon: De.chartBar, descKey: "panel.type.desc.bar" },
      { type: "histogram", icon: De.chartArea, descKey: "panel.type.desc.histogram" },
      { type: "stat", icon: De.stat, descKey: "panel.type.desc.stat" },
      { type: "gauge", icon: De.gauge, descKey: "panel.type.desc.gauge" },
      { type: "table", icon: De.table, descKey: "panel.type.desc.table" },
      { type: "pie", icon: De.chartPie, descKey: "panel.type.desc.pie" }
    ];
    function a(l) {
      t.addPanel(l);
    }
    return (l, u) => (O(), Ce(kc, {
      open: f(t).addPanelModalOpen,
      title: f(n)("dashboard.addPanel"),
      footer: !1,
      onClose: u[0] || (u[0] = (r) => f(t).addPanelModalOpen = !1)
    }, {
      default: q(() => [
        _(f(Op), {
          gutter: [16, 16],
          class: "mt-4 px-4 pb-4"
        }, {
          default: q(() => [
            (O(), j(Oe, null, et(i, (r) => _(f(Pp), {
              key: r.type,
              span: 8
            }, {
              default: q(() => [
                _(f(Ip), {
                  hoverable: "",
                  class: "text-center cursor-pointer",
                  onClick: (c) => a(r.type)
                }, {
                  default: q(() => [
                    b("div", {
                      class: Re(["text-2xl mb-2 text-blue", r.icon])
                    }, null, 2),
                    b("div", SD, P(f(n)(`config.type.${r.type}`)), 1),
                    b("div", kD, P(f(n)(r.descKey)), 1)
                  ]),
                  _: 2
                }, 1032, ["onClick"])
              ]),
              _: 2
            }, 1024)), 64))
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["open", "title"]));
  }
}), CD = { style: { display: "flex", "align-items": "center", "flex-wrap": "wrap", gap: "8px", padding: "0 4px" } }, MD = { class: "" }, TD = { style: { margin: "0" } }, zD = { style: { margin: "0" } }, DD = /* @__PURE__ */ ze({
  __name: "DashboardHeader",
  setup(e) {
    const t = Gi(), { t: n } = st(), { config: i } = no(), { message: a } = Ep.useApp(), l = pe(!1), u = pe(!1), r = pe(null);
    function c() {
      t.confirmSave(i.value.onSave);
    }
    function g() {
      t.isDirty ? l.value = !0 : t.discardChanges();
    }
    function y() {
      l.value = !1, t.discardChanges();
    }
    function v() {
      const F = t.exportJSON(), V = new Blob([F], { type: "application/json" }), N = URL.createObjectURL(V), Y = document.createElement("a");
      Y.href = N, Y.download = "dashboard.json", Y.click(), URL.revokeObjectURL(N), a.success(n("dashboard.exportSuccess"));
    }
    function m() {
      r.value?.click();
    }
    function S(F) {
      const V = F.target.files?.[0];
      V && (V.text().then((N) => {
        t.importJSON(N) ? a.success(n("dashboard.importSuccess")) : a.error(n("dashboard.importError"));
      }), F.target.value = "");
    }
    function T(F) {
      t.importJSON(F) ? a.success(n("dashboard.importSuccess")) : a.error(n("dashboard.importError"));
    }
    const C = oe(() => {
      const F = Db(), V = (i.value.presets ?? []).map((N) => ({ label: N.label, value: N.config }));
      return [{ label: "内置模板", value: F }, ...V];
    }), E = oe(() => [
      { key: "export", label: n("dashboard.export"), icon: De.export },
      { key: "import", label: n("dashboard.import"), icon: De.import },
      { type: "divider" },
      { key: "clear", label: n("dashboard.clearPanels"), icon: De.delete, danger: !0 }
    ]);
    function X(F) {
      F === "export" ? v() : F === "import" ? m() : F === "clear" && (u.value = !0);
    }
    return (F, V) => (O(), j("div", CD, [
      f(t).isEditing ? (O(), j(Oe, { key: 0 }, [
        _(f(Bl).Compact, null, {
          default: q(() => [
            _(f(ot), {
              onClick: V[0] || (V[0] = (N) => f(t).addPanelModalOpen = !0)
            }, {
              default: q(() => [
                b("span", {
                  class: Re([f(De).plus, "mr-1"])
                }, null, 2),
                ce(" " + P(f(n)("dashboard.addPanel")), 1)
              ]),
              _: 1
            }),
            _(f(tt), {
              placeholder: "预设",
              "popup-match-select-width": !1,
              options: C.value,
              style: { "min-width": "80px" },
              onSelect: V[1] || (V[1] = (N) => T(N))
            }, null, 8, ["options"]),
            b("input", {
              ref_key: "fileInputRef",
              ref: r,
              type: "file",
              accept: ".json",
              style: { display: "none" },
              onChange: S
            }, null, 544),
            _(f(Jo), { trigger: ["click"] }, {
              overlay: q(() => [
                _(f(Di), {
                  onClick: V[2] || (V[2] = ({ key: N }) => X(N))
                }, {
                  default: q(() => [
                    (O(!0), j(Oe, null, et(E.value, (N) => (O(), j(Oe, {
                      key: N.key ?? N.type
                    }, [
                      N.type === "divider" ? (O(), Ce(f(Di).Divider, { key: 0 })) : (O(), Ce(f(Di).Item, {
                        key: N.key,
                        danger: N.danger
                      }, {
                        default: q(() => [
                          b("span", {
                            class: Re([N.icon, "mr-1"])
                          }, null, 2),
                          ce(P(N.label), 1)
                        ]),
                        _: 2
                      }, 1032, ["danger"]))
                    ], 64))), 128))
                  ]),
                  _: 1
                })
              ]),
              default: q(() => [
                _(f(ot), null, {
                  default: q(() => [
                    b("span", {
                      class: Re(f(De).dotsVertical)
                    }, null, 2)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        _(f(ot), {
          type: "primary",
          ghost: "",
          onClick: c
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).save, "mr-1"])
            }, null, 2),
            ce(" " + P(f(n)("dashboard.save")), 1)
          ]),
          _: 1
        }),
        _(f(ot), {
          danger: f(t).isDirty,
          onClick: g
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).cancel, "mr-1"])
            }, null, 2),
            ce(" " + P(f(n)("dashboard.cancel")), 1)
          ]),
          _: 1
        }, 8, ["danger"])
      ], 64)) : (O(), Ce(f(ot), {
        key: 1,
        onClick: f(t).startEditing
      }, {
        default: q(() => [
          b("span", {
            class: Re([f(De).edit, "mr-1"])
          }, null, 2),
          b("span", MD, P(f(n)("dashboard.edit")), 1)
        ]),
        _: 1
      }, 8, ["onClick"])),
      _(f(jo), {
        open: l.value,
        "onUpdate:open": V[3] || (V[3] = (N) => l.value = N),
        title: f(n)("dashboard.cancelConfirmTitle"),
        "ok-text": f(n)("dashboard.cancelConfirmOk"),
        "cancel-text": f(n)("dashboard.cancelConfirmCancel"),
        "ok-button-props": { danger: !0 },
        onOk: y,
        onCancel: V[4] || (V[4] = (N) => l.value = !1)
      }, {
        default: q(() => [
          b("p", TD, P(f(n)("dashboard.cancelConfirmTitle")), 1)
        ]),
        _: 1
      }, 8, ["open", "title", "ok-text", "cancel-text"]),
      _(f(jo), {
        open: u.value,
        "onUpdate:open": V[5] || (V[5] = (N) => u.value = N),
        title: f(n)("dashboard.clearConfirmTitle"),
        "ok-text": f(n)("dashboard.clearConfirmOk"),
        "ok-button-props": { danger: !0 },
        onOk: V[6] || (V[6] = () => {
          f(t).clearPanels(), u.value = !1;
        }),
        onCancel: V[7] || (V[7] = (N) => u.value = !1)
      }, {
        default: q(() => [
          b("p", zD, P(f(n)("dashboard.clearConfirmTitle")), 1)
        ]),
        _: 1
      }, 8, ["open", "title", "ok-text"])
    ]));
  }
}), OD = { class: "w-full h-full flex flex-col" }, PD = {
  key: 1,
  class: "dashboad-content h-full"
}, ID = {
  key: 1,
  class: "flex-center h-full"
}, ED = { class: "text-center text-gray-400" }, $D = { class: "text-14px" }, AD = { class: "mt-2 text-12px text-blue/90" }, ND = 30, cu = 8, RD = 768, LD = /* @__PURE__ */ ze({
  __name: "DashboardPage",
  setup(e) {
    const { t } = st(), n = Gi(), i = Hi(), { config: a } = no(), l = oe(() => a.value.canEdit !== !1), u = If([...n.layouts]);
    Ye(
      () => n.layouts,
      (E) => {
        const X = u.value;
        X.length === E.length && X.every(
          (F, V) => F.i === E[V].i && F.x === E[V].x && F.y === E[V].y && F.w === E[V].w && F.h === E[V].h
        ) || (u.value = [...E]);
      }
    );
    function r(E) {
      u.value = E, n.setLayouts(E);
    }
    const c = pe(), g = pe(0), y = oe(() => g.value > 0 && g.value < RD);
    let v = null;
    Nn(() => {
      c.value && (v = new ResizeObserver((E) => {
        g.value = E[0].contentRect.width;
      }), v.observe(c.value), g.value = c.value.getBoundingClientRect().width);
    }), Fa(() => {
      v?.disconnect();
    });
    let m = null;
    function S() {
      T(), n.autoRefresh > 0 && (m = setInterval(() => {
        n.refresh();
      }, n.autoRefresh * 1e3));
    }
    function T() {
      m && (clearInterval(m), m = null);
    }
    Ye(() => n.autoRefresh, S);
    const C = oe(() => Object.keys(n.panels).length === 0);
    return (E, X) => (O(), j("div", OD, [
      b("div", {
        class: "flex items-center gap-2 flex-wrap px-2 sticky top-0 z-10",
        style: Ue({
          background: f(i).isDark ? "#1a1a1a" : "#f5f5f5",
          border: `1px solid ${f(i).isDark ? "#303030" : "#e8e8e8"}`,
          height: "42px"
        })
      }, [
        _(dp),
        X[0] || (X[0] = b("div", { class: "flex-1" }, null, -1)),
        _(cp),
        l.value ? (O(), Ce(DD, { key: 0 })) : be("", !0)
      ], 4),
      b("div", {
        ref_key: "containerRef",
        ref: c,
        class: "flex-1 overflow-auto"
      }, [
        y.value ? (O(), j("div", {
          key: 0,
          class: "flex flex-col",
          style: Ue({ gap: `${cu}px`, padding: "8px" })
        }, [
          (O(!0), j(Oe, null, et(Object.keys(f(n).panels), (F) => (O(), j("div", { key: F }, [
            _(Df, { "panel-id": F }, {
              default: q(() => [
                _(Lu, { "panel-id": F }, null, 8, ["panel-id"])
              ]),
              _: 2
            }, 1032, ["panel-id"])
          ]))), 128))
        ], 4)) : (O(), j("div", PD, [
          g.value > 0 && !C.value ? (O(), Ce(f(uk), {
            key: 0,
            layout: u.value,
            "col-num": 12,
            "row-height": ND,
            margin: [cu, cu],
            "is-draggable": l.value && f(n).isEditing,
            "is-resizable": l.value && f(n).isEditing,
            "vertical-compact": !0,
            onLayoutUpdated: r
          }, {
            item: q(({ item: F }) => [
              _(Df, {
                "panel-id": String(F.i)
              }, {
                default: q(() => [
                  _(Lu, {
                    "panel-id": String(F.i)
                  }, null, 8, ["panel-id"])
                ]),
                _: 2
              }, 1032, ["panel-id"])
            ]),
            _: 1
          }, 8, ["layout", "margin", "is-draggable", "is-resizable"])) : be("", !0),
          C.value ? (O(), j("div", ID, [
            b("div", ED, [
              X[1] || (X[1] = b("div", { class: "text-4xl mb-4" }, [
                b("div", { class: "i-carbon:chart-combo-stacked" })
              ], -1)),
              b("div", $D, P(f(t)("dashboard.empty")), 1),
              b("div", AD, P(f(t)("dashboard.emptyHint")), 1)
            ])
          ])) : be("", !0)
        ]))
      ], 512),
      _(_D),
      _(fD)
    ]));
  }
}), qD = { class: "flex justify-between items-center gap-2" }, FD = { style: { "font-size": "12px" } }, VD = { style: { "font-size": "10px", color: "var(--ant-color-text-quaternary)" } }, du = /* @__PURE__ */ ze({
  __name: "ArgusGroupBy",
  props: {
    groupBy: {},
    cfg: {},
    signal: {},
    metricName: {},
    disabled: { type: Boolean, default: !1 }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = pe(""), l = pe([]), u = pe(!1), r = pe(!1);
    let c = null;
    Ye(
      [a, r, () => n.cfg?.url, () => n.cfg?.token, () => n.signal, () => n.metricName],
      () => {
        !n.cfg || !r.value || (c && clearTimeout(c), c = setTimeout(async () => {
          u.value = !0;
          try {
            const m = new Set(n.groupBy.map((T) => T.name)), S = await Wp(n.cfg, {
              signal: n.signal,
              metricName: n.metricName,
              search: a.value
            });
            l.value = S.filter((T) => !m.has(T.name));
          } catch {
            l.value = [];
          } finally {
            u.value = !1;
          }
        }, 300));
      }
    );
    const g = oe(() => n.groupBy.map((m) => m.name));
    function y(m) {
      const T = (Array.isArray(m) ? m : [m]).map((C) => {
        const E = l.value.find((F) => F.name === C), X = n.groupBy.find((F) => F.name === C);
        return E ?? X ?? { name: C, fieldDataType: "string", fieldContext: "tag" };
      });
      i("change", T);
    }
    const v = oe(() => u.value ? Gn(ki, { size: "small" }) : null);
    return (m, S) => (O(), Ce(f(tt), {
      mode: "tags",
      size: "small",
      style: { flex: "1", "min-width": "160px" },
      placeholder: "不分组（全量汇总）",
      value: g.value,
      disabled: e.disabled,
      "filter-option": !1,
      "not-found-content": v.value,
      onSearch: S[0] || (S[0] = (T) => a.value = T),
      onFocus: S[1] || (S[1] = () => r.value = !0),
      onBlur: S[2] || (S[2] = () => {
        r.value = !1, a.value = "";
      }),
      onChange: y
    }, {
      default: q(() => [
        (O(!0), j(Oe, null, et(l.value, (T) => (O(), Ce(f(tt).Option, {
          key: T.name,
          value: T.name
        }, {
          default: q(() => [
            b("div", qD, [
              b("span", FD, P(T.name), 1),
              b("span", VD, P([T.fieldContext, T.fieldDataType].filter(Boolean).join(" · ")), 1)
            ])
          ]),
          _: 2
        }, 1032, ["value"]))), 128))
      ]),
      _: 1
    }, 8, ["value", "disabled", "not-found-content"]));
  }
}), WD = { class: "flex flex-wrap gap-1 items-center" }, YD = { class: "font-medium" }, Of = /* @__PURE__ */ ze({
  __name: "ArgusQueryFunctions",
  props: {
    functions: {},
    signal: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = [
      { value: "cutOffMin", label: "Cut Off Min" },
      { value: "cutOffMax", label: "Cut Off Max" },
      { value: "clampMin", label: "Clamp Min" },
      { value: "clampMax", label: "Clamp Max" },
      { value: "absolute", label: "Absolute" },
      { value: "runningDiff", label: "Running Diff" },
      { value: "log2", label: "Log2" },
      { value: "log10", label: "Log10" },
      { value: "cumulativeSum", label: "Cumulative Sum" },
      { value: "ewma3", label: "EWMA 3" },
      { value: "ewma5", label: "EWMA 5" },
      { value: "ewma7", label: "EWMA 7" },
      { value: "median3", label: "Median 3" },
      { value: "median5", label: "Median 5" },
      { value: "median7", label: "Median 7" },
      { value: "timeShift", label: "Time Shift" },
      { value: "fillZero", label: "Fill Zero" }
    ], l = [{ value: "timeShift", label: "Time Shift" }], u = {
      cutOffMin: { showInput: !0, placeholder: "阈值" },
      cutOffMax: { showInput: !0, placeholder: "阈值" },
      clampMin: { showInput: !0, placeholder: "阈值" },
      clampMax: { showInput: !0, placeholder: "阈值" },
      absolute: { showInput: !1 },
      runningDiff: { showInput: !1 },
      log2: { showInput: !1 },
      log10: { showInput: !1 },
      cumulativeSum: { showInput: !1 },
      ewma3: { showInput: !0, placeholder: "Alpha" },
      ewma5: { showInput: !0, placeholder: "Alpha" },
      ewma7: { showInput: !0, placeholder: "Alpha" },
      median3: { showInput: !1 },
      median5: { showInput: !1 },
      median7: { showInput: !1 },
      timeShift: { showInput: !0, placeholder: "如 -1h" },
      fillZero: { showInput: !1 }
    }, r = oe(
      () => n.signal === "logs" || n.signal === "traces" ? l : a
    );
    function c(v) {
      const m = u[v];
      i("change", [...n.functions, { name: v, args: m?.showInput ? [{ value: "" }] : [] }]);
    }
    function g(v) {
      i("change", n.functions.filter((m, S) => S !== v));
    }
    function y(v, m) {
      i("change", n.functions.map((S, T) => T === v ? { ...S, args: [{ value: m }] } : S));
    }
    return (v, m) => (O(), j("div", WD, [
      (O(!0), j(Oe, null, et(e.functions, (S, T) => (O(), j("div", {
        key: T,
        class: "inline-flex items-center gap-1 rounded px-1.5",
        style: { background: "#eee", "font-size": "12px" }
      }, [
        b("span", YD, P(S.name) + "(", 1),
        u[S.name]?.showInput ? (O(), Ce(f(it), {
          key: 0,
          class: "text-center",
          size: "small",
          bordered: !1,
          variant: "borderless",
          style: { width: "40px", padding: "0 2px", height: "20px" },
          placeholder: u[S.name]?.placeholder ?? "value",
          value: S.args[0]?.value ?? "",
          onChange: (C) => y(T, C.target.value)
        }, null, 8, ["placeholder", "value", "onChange"])) : be("", !0),
        m[1] || (m[1] = b("span", null, ")", -1)),
        _(f(ot), {
          class: "p-0!",
          type: "link",
          size: "small",
          danger: "",
          onClick: (C) => g(T)
        }, {
          default: q(() => [
            b("span", {
              class: Re(f(De).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["onClick"])
      ]))), 128)),
      _(f(Jo), { trigger: "click" }, {
        overlay: q(() => [
          _(f(Di), {
            onClick: m[0] || (m[0] = ({ key: S }) => c(String(S)))
          }, {
            default: q(() => [
              (O(!0), j(Oe, null, et(r.value, (S) => (O(), Ce(f(Di).Item, {
                key: S.value
              }, {
                default: q(() => [
                  ce(P(S.label), 1)
                ]),
                _: 2
              }, 1024))), 128))
            ]),
            _: 1
          })
        ]),
        default: q(() => [
          _(f(ot), {
            size: "small",
            type: "dashed"
          }, {
            default: q(() => [
              b("span", {
                class: Re([f(De).plus, "mr-0.5"])
              }, null, 2),
              m[2] || (m[2] = ce("函数 ", -1))
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), BD = {
  class: "bg-white p-2",
  style: { border: "1px solid #eee", "border-radius": "6px", "margin-bottom": "6px" }
}, HD = { class: "flex items-center gap-1 select-none" }, jD = { class: "flex gap-2 ml-1" }, UD = {
  key: 0,
  style: { "border-top": "1px solid var(--ant-color-border)" }
}, GD = {
  key: 0,
  class: "flex flex-col gap-2 p-2"
}, KD = { class: "flex flex-col gap-0.5" }, ZD = { class: "flex items-center gap-1.5" }, QD = { class: "flex flex-col gap-0.5" }, XD = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, JD = { class: "flex flex-col gap-0.5" }, eO = { class: "flex flex-col gap-0.5" }, tO = { class: "flex flex-col gap-0.5" }, nO = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, iO = { class: "flex flex-col gap-0.5" }, aO = { class: "flex items-center gap-1" }, lO = { class: "flex flex-col gap-0.5" }, oO = { class: "flex items-center gap-1" }, sO = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, rO = { class: "flex flex-col gap-0.5" }, uO = { class: "flex flex-col gap-0.5" }, cO = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, dO = { class: "flex flex-col gap-0.5" }, fO = { class: "flex flex-col gap-0.5" }, hO = {
  key: 1,
  class: "flex flex-col gap-2 p-2"
}, gO = { class: "flex flex-col gap-0.5" }, pO = { class: "flex flex-col gap-0.5" }, mO = { class: "flex flex-col gap-1" }, vO = { class: "flex flex-col gap-0.5" }, yO = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, bO = { class: "flex flex-col gap-0.5" }, xO = { class: "flex flex-col gap-0.5" }, wO = { class: "flex flex-col gap-0.5" }, SO = {
  key: 2,
  class: "flex flex-col gap-1.5 p-2"
}, kO = { class: "flex items-center gap-1.5" }, _O = {
  key: 3,
  class: "flex flex-col gap-2 p-2"
}, CO = { class: "flex flex-col gap-0.5" }, MO = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, TO = { class: "flex flex-col gap-0.5" }, zO = { class: "flex flex-col gap-0.5" }, DO = /* @__PURE__ */ ze({
  __name: "QueryItemRow",
  props: {
    item: {},
    cfg: {},
    collapsed: { type: Boolean },
    canDelete: { type: Boolean }
  },
  emits: ["toggleCollapse", "toggleDisabled", "delete", "change"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = oe(() => n.item.type === "builder_formula"), l = oe(() => n.item.spec.disabled), u = oe(() => n.item.spec.name), r = pe(
      n.item.type === "builder_query" ? n.item.queryType ?? "builder" : "builder"
    ), c = [
      { label: "查询构建器", value: "builder" },
      { label: "PromQL", value: "promql" },
      { label: "ClickHouse SQL", value: "clickhouse_sql" }
    ], g = [
      { value: "metrics", label: "指标" },
      { value: "logs", label: "日志" },
      { value: "traces", label: "链路" }
    ];
    function y(ee) {
      i("change", ee);
    }
    function v(ee) {
      if (n.item.type !== "builder_query")
        return;
      const I = ee === "metrics" ? [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }] : [{ expression: "count()" }];
      y({ ...n.item, spec: { ...n.item.spec, signal: ee, aggregations: I } });
    }
    function m(ee) {
      n.item.type === "builder_query" && (r.value = ee, y({ ...n.item, queryType: ee }));
    }
    const S = pe([]), T = pe(!1);
    Ye(
      [() => n.cfg?.url, () => n.cfg?.token],
      async ([ee, I]) => {
        T.value = !0;
        try {
          S.value = await Vp({ url: ee ?? "", token: I ?? "" });
        } catch {
          S.value = [];
        } finally {
          T.value = !1;
        }
      },
      { immediate: !0 }
    );
    const C = oe(
      () => n.item.type === "builder_query" ? n.item.spec : null
    ), E = oe(
      () => C.value?.aggregations?.[0] ?? { metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }
    ), X = oe(
      () => E.value.metricType === "histogram" || E.value.metricType === "exponential_histogram"
    ), F = oe(
      () => X.value ? [{ value: "p50", label: "P50" }, { value: "p75", label: "P75" }, { value: "p90", label: "P90" }, { value: "p95", label: "P95" }, { value: "p99", label: "P99" }] : [{ value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }]
    ), V = oe(() => X.value ? [] : E.value.metricType === "gauge" ? [{ value: "latest", label: "Latest" }, { value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }, { value: "count", label: "Count" }, { value: "count_distinct", label: "Count Distinct" }] : [{ value: "increase", label: "Increase" }, { value: "rate", label: "Rate" }]);
    function N(ee, I) {
      C.value && y({ ...n.item, spec: { ...C.value, [ee]: I } });
    }
    function Y(ee) {
      C.value && N("aggregations", [{ ...E.value, ...ee }]);
    }
    function K(ee) {
      const $ = S.value.find((le) => le.metricName === ee)?.type ?? "";
      Y({
        metricName: ee,
        metricType: $,
        timeAggregation: $ === "" ? "" : $ === "gauge" ? "latest" : "rate",
        spaceAggregation: $ === "histogram" || $ === "exponential_histogram" ? "p99" : "sum"
      });
    }
    const M = oe(
      () => C.value?.aggregations ?? []
    );
    function W() {
      C.value && N("aggregations", [...M.value, { expression: "count()" }]);
    }
    function G(ee) {
      C.value && N("aggregations", M.value.filter((I, $) => $ !== ee));
    }
    function Z(ee, I) {
      C.value && N("aggregations", M.value.map(($, le) => le === ee ? { expression: I } : $));
    }
    function A(ee) {
      if (!ee) {
        N("order", []);
        return;
      }
      const I = ee.split(" "), $ = I[I.length - 1], ie = { key: { name: I.slice(0, -1).join(" ") }, direction: $ };
      N("order", [ie]);
    }
    function J(ee) {
      n.item.type === "builder_formula" && i("change", { ...n.item, spec: { ...n.item.spec, ...ee } });
    }
    return (ee, I) => (O(), j("div", BD, [
      b("div", HD, [
        b("span", {
          class: "flex items-center gap-1.5 flex-1 cursor-pointer",
          onClick: I[2] || (I[2] = ($) => i("toggleCollapse"))
        }, [
          b("span", {
            class: Re([e.collapsed ? f(De).chevronRight : f(De).chevronDown, "text-16px"])
          }, null, 2),
          _(f(Zl), {
            color: a.value ? "purple" : "cyan",
            style: { margin: "0", "font-weight": "600", "font-size": "12px", "line-height": "18px", padding: "0 6px" }
          }, {
            default: q(() => [
              ce(P(u.value), 1)
            ]),
            _: 1
          }, 8, ["color"]),
          a.value ? be("", !0) : (O(), j(Oe, { key: 0 }, [
            b("div", jD, [
              (O(), j(Oe, null, et(c, ($) => _(f(ot), {
                key: $.value,
                size: "small",
                type: r.value === $.value ? "primary" : "default",
                style: { "font-size": "12px", height: "22px" },
                onClick: Qn((le) => m($.value), ["stop"])
              }, {
                default: q(() => [
                  ce(P($.label), 1)
                ]),
                _: 2
              }, 1032, ["type", "onClick"])), 64))
            ]),
            r.value === "builder" ? (O(), Ce(f(tt), {
              key: 0,
              size: "small",
              style: { width: "80px" },
              value: e.item.spec.signal,
              options: g,
              onClick: I[0] || (I[0] = Qn(() => {
              }, ["stop"])),
              onChange: I[1] || (I[1] = ($) => v($))
            }, null, 8, ["value"])) : be("", !0),
            I[32] || (I[32] = b("div", { class: "flex-1" }, null, -1))
          ], 64))
        ]),
        _(f(ot), {
          class: "p-0!",
          size: "small",
          type: "link",
          onClick: I[3] || (I[3] = Qn(($) => i("toggleDisabled"), ["stop"]))
        }, {
          default: q(() => [
            b("span", {
              class: Re(l.value ? f(De).viewOff : f(De).view)
            }, null, 2)
          ]),
          _: 1
        }),
        _(f(ot), {
          class: "p-0!",
          size: "small",
          type: "link",
          danger: "",
          disabled: !e.canDelete,
          onClick: I[4] || (I[4] = ($) => i("delete"))
        }, {
          default: q(() => [
            b("span", {
              class: Re(f(De).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled"])
      ]),
      e.collapsed ? be("", !0) : (O(), j("div", UD, [
        e.item.type === "builder_query" && r.value === "builder" && e.item.spec.signal === "metrics" && C.value ? (O(), j("div", GD, [
          b("div", KD, [
            I[33] || (I[33] = b("span", { class: "text-xs text-secondary" }, "指标名称", -1)),
            b("div", ZD, [
              ce(P(T.value) + " ", 1),
              _(f(tt), {
                "show-search": "",
                "allow-clear": "",
                loading: T.value,
                size: "small",
                style: { flex: "1" },
                placeholder: "指标名称",
                value: E.value.metricName || void 0,
                options: S.value.map(($) => ({
                  value: $.metricName,
                  label: $.metricName
                })),
                "filter-option": ($, le) => String(le?.value ?? "").toLowerCase().includes($.toLowerCase()),
                onChange: I[5] || (I[5] = ($) => K($)),
                onClear: I[6] || (I[6] = () => Y({
                  metricName: "",
                  metricType: "",
                  timeAggregation: "rate",
                  spaceAggregation: "sum"
                }))
              }, null, 8, ["loading", "value", "options", "filter-option"]),
              E.value.metricType ? (O(), Ce(f(Zl), {
                key: 0,
                style: { "font-size": "10px", margin: "0" }
              }, {
                default: q(() => [
                  ce(P(E.value.metricType), 1)
                ]),
                _: 1
              })) : be("", !0)
            ])
          ]),
          b("div", QD, [
            I[34] || (I[34] = b("span", { class: "text-xs text-secondary" }, "源数据筛选", -1)),
            _(f(it), {
              size: "small",
              placeholder: "如 host.name = 'my-host'",
              value: C.value.filter.expression,
              onChange: I[7] || (I[7] = ($) => N("filter", { expression: $.target.value }))
            }, null, 8, ["value"])
          ]),
          X.value ? (O(), j(Oe, { key: 0 }, [
            b("div", XD, [
              b("div", JD, [
                I[35] || (I[35] = b("span", { class: "text-xs text-secondary" }, "跨时序聚合", -1)),
                _(f(tt), {
                  size: "small",
                  value: E.value.spaceAggregation || void 0,
                  options: F.value,
                  disabled: !E.value.metricType,
                  onChange: I[8] || (I[8] = ($) => Y({ spaceAggregation: $ }))
                }, null, 8, ["value", "options", "disabled"])
              ]),
              b("div", eO, [
                I[36] || (I[36] = b("span", { class: "text-xs text-secondary" }, "分组", -1)),
                _(du, {
                  "group-by": C.value.groupBy,
                  cfg: e.cfg,
                  signal: "metrics",
                  "metric-name": E.value.metricName,
                  disabled: !E.value.metricName,
                  onChange: I[9] || (I[9] = ($) => N("groupBy", $))
                }, null, 8, ["group-by", "cfg", "metric-name", "disabled"])
              ])
            ]),
            b("div", tO, [
              I[37] || (I[37] = b("span", { class: "text-xs text-secondary" }, "步长（秒）", -1)),
              _(f(yn), {
                size: "small",
                style: { width: "100%" },
                placeholder: "自动",
                value: C.value.stepInterval ?? void 0,
                min: 1,
                onChange: I[10] || (I[10] = ($) => N("stepInterval", $ ?? null))
              }, null, 8, ["value"])
            ])
          ], 64)) : (O(), j(Oe, { key: 1 }, [
            b("div", nO, [
              b("div", iO, [
                I[40] || (I[40] = b("span", { class: "text-xs text-secondary" }, "时序内聚合", -1)),
                b("div", aO, [
                  _(f(tt), {
                    size: "small",
                    style: { flex: "1" },
                    value: E.value.timeAggregation || void 0,
                    options: V.value,
                    disabled: !E.value.metricType,
                    onChange: I[11] || (I[11] = ($) => Y({ timeAggregation: $ }))
                  }, null, 8, ["value", "options", "disabled"]),
                  I[38] || (I[38] = b("span", { class: "text-xs text-secondary whitespace-nowrap" }, "每隔", -1)),
                  _(f(yn), {
                    size: "small",
                    style: { width: "60px" },
                    placeholder: "自动",
                    value: C.value.stepInterval ?? void 0,
                    min: 1,
                    onChange: I[12] || (I[12] = ($) => N("stepInterval", $ ?? null))
                  }, null, 8, ["value"]),
                  I[39] || (I[39] = b("span", { class: "text-xs text-secondary" }, "秒", -1))
                ])
              ]),
              b("div", lO, [
                I[41] || (I[41] = b("span", { class: "text-xs text-secondary" }, "跨时序聚合", -1)),
                b("div", oO, [
                  _(f(tt), {
                    size: "small",
                    style: { width: "80px" },
                    value: E.value.spaceAggregation || void 0,
                    options: F.value,
                    disabled: !E.value.metricType,
                    onChange: I[13] || (I[13] = ($) => Y({ spaceAggregation: $ }))
                  }, null, 8, ["value", "options", "disabled"]),
                  _(du, {
                    "group-by": C.value.groupBy,
                    cfg: e.cfg,
                    signal: "metrics",
                    "metric-name": E.value.metricName,
                    disabled: !E.value.metricName,
                    onChange: I[14] || (I[14] = ($) => N("groupBy", $))
                  }, null, 8, ["group-by", "cfg", "metric-name", "disabled"])
                ])
              ])
            ]),
            b("div", sO, [
              b("div", rO, [
                I[42] || (I[42] = b("span", { class: "text-xs text-secondary" }, "聚合结果筛选", -1)),
                _(f(it), {
                  size: "small",
                  placeholder: "如 sum > 100",
                  value: C.value.having?.expression ?? "",
                  onChange: I[15] || (I[15] = ($) => N("having", { expression: $.target.value }))
                }, null, 8, ["value"])
              ]),
              b("div", uO, [
                I[43] || (I[43] = b("span", { class: "text-xs text-secondary" }, "条数", -1)),
                _(f(yn), {
                  size: "small",
                  style: { width: "80px" },
                  placeholder: "∞",
                  value: C.value.limit ?? void 0,
                  min: 1,
                  onChange: I[16] || (I[16] = ($) => N("limit", $ ?? void 0))
                }, null, 8, ["value"])
              ])
            ]),
            b("div", cO, [
              b("div", dO, [
                I[44] || (I[44] = b("span", { class: "text-xs text-secondary" }, "排序", -1)),
                _(f(tt), {
                  size: "small",
                  "allow-clear": "",
                  placeholder: "字段 升序/降序",
                  value: C.value.order[0] ? `${C.value.order[0].key.name} ${C.value.order[0].direction}` : void 0,
                  options: [
                    { value: "value asc", label: "值 升序" },
                    { value: "value desc", label: "值 降序" }
                  ],
                  onChange: I[17] || (I[17] = ($) => A($)),
                  onClear: I[18] || (I[18] = () => N("order", []))
                }, null, 8, ["value"])
              ]),
              b("div", fO, [
                I[45] || (I[45] = b("span", { class: "text-xs text-secondary" }, "图例", -1)),
                _(f(it), {
                  size: "small",
                  placeholder: "{{label}}",
                  value: C.value.legend,
                  onChange: I[19] || (I[19] = ($) => N("legend", $.target.value))
                }, null, 8, ["value"])
              ])
            ])
          ], 64)),
          _(Of, {
            functions: C.value.functions,
            signal: C.value.signal,
            onChange: I[20] || (I[20] = ($) => N("functions", $))
          }, null, 8, ["functions", "signal"])
        ])) : e.item.type === "builder_query" && r.value === "builder" && C.value ? (O(), j("div", hO, [
          b("div", gO, [
            I[46] || (I[46] = b("span", { class: "text-xs text-secondary" }, "过滤条件", -1)),
            _(f(it), {
              size: "small",
              placeholder: "过滤表达式",
              value: C.value.filter.expression,
              onChange: I[21] || (I[21] = ($) => N("filter", { expression: $.target.value }))
            }, null, 8, ["value"])
          ]),
          b("div", pO, [
            I[49] || (I[49] = b("span", { class: "text-xs text-secondary" }, "聚合表达式", -1)),
            b("div", mO, [
              (O(!0), j(Oe, null, et(M.value, ($, le) => (O(), j("div", {
                key: le,
                class: "flex items-center gap-1"
              }, [
                _(f(it), {
                  size: "small",
                  style: { flex: "1" },
                  placeholder: "如 count() / avg(body)",
                  value: $.expression,
                  onChange: (ie) => Z(le, ie.target.value)
                }, null, 8, ["value", "onChange"]),
                M.value.length > 1 ? (O(), Ce(f(ot), {
                  key: 0,
                  size: "small",
                  type: "text",
                  danger: "",
                  onClick: (ie) => G(le)
                }, {
                  default: q(() => [...I[47] || (I[47] = [
                    ce(" × ", -1)
                  ])]),
                  _: 1
                }, 8, ["onClick"])) : be("", !0)
              ]))), 128)),
              _(f(ot), {
                size: "small",
                type: "dashed",
                style: { "align-self": "flex-start" },
                onClick: W
              }, {
                default: q(() => [
                  b("span", {
                    class: Re([f(De).plus, "mr-0.5"])
                  }, null, 2),
                  I[48] || (I[48] = ce("添加聚合 ", -1))
                ]),
                _: 1
              })
            ])
          ]),
          b("div", vO, [
            I[50] || (I[50] = b("span", { class: "text-xs text-secondary" }, "分组", -1)),
            _(du, {
              "group-by": C.value.groupBy,
              cfg: e.cfg,
              signal: C.value.signal,
              onChange: I[22] || (I[22] = ($) => N("groupBy", $))
            }, null, 8, ["group-by", "cfg", "signal"])
          ]),
          b("div", yO, [
            b("div", bO, [
              I[51] || (I[51] = b("span", { class: "text-xs text-secondary" }, "聚合结果筛选", -1)),
              _(f(it), {
                size: "small",
                placeholder: "如 count > 100",
                value: C.value.having?.expression ?? "",
                onChange: I[23] || (I[23] = ($) => N("having", { expression: $.target.value }))
              }, null, 8, ["value"])
            ]),
            b("div", xO, [
              I[52] || (I[52] = b("span", { class: "text-xs text-secondary" }, "条数", -1)),
              _(f(yn), {
                size: "small",
                style: { width: "80px" },
                placeholder: "∞",
                value: C.value.limit ?? void 0,
                min: 1,
                onChange: I[24] || (I[24] = ($) => N("limit", $ ?? void 0))
              }, null, 8, ["value"])
            ])
          ]),
          b("div", wO, [
            I[53] || (I[53] = b("span", { class: "text-xs text-secondary" }, "图例", -1)),
            _(f(it), {
              size: "small",
              placeholder: "{{label}}",
              value: C.value.legend,
              onChange: I[25] || (I[25] = ($) => N("legend", $.target.value))
            }, null, 8, ["value"])
          ]),
          _(Of, {
            functions: C.value.functions,
            signal: C.value.signal,
            onChange: I[26] || (I[26] = ($) => N("functions", $))
          }, null, 8, ["functions", "signal"])
        ])) : e.item.type === "builder_query" && r.value !== "builder" ? (O(), j("div", SO, [
          _(f(it).TextArea, {
            rows: 4,
            placeholder: r.value === "promql" ? "输入 PromQL 查询语句…" : "输入 ClickHouse SQL 查询语句…",
            value: e.item.rawQuery ?? "",
            style: { "font-family": "monospace", "font-size": "12px" },
            onChange: I[27] || (I[27] = ($) => i("change", { ...e.item, rawQuery: $.target.value }))
          }, null, 8, ["placeholder", "value"]),
          b("div", kO, [
            I[54] || (I[54] = b("span", { class: "text-xs text-secondary whitespace-nowrap" }, "图例格式", -1)),
            _(f(it), {
              size: "small",
              style: { flex: "1" },
              placeholder: "{{label}}",
              value: e.item.rawLegend ?? "",
              onChange: I[28] || (I[28] = ($) => i("change", { ...e.item, rawLegend: $.target.value }))
            }, null, 8, ["value"])
          ])
        ])) : e.item.type === "builder_formula" ? (O(), j("div", _O, [
          b("div", CO, [
            I[55] || (I[55] = b("span", { class: "text-xs text-secondary" }, "表达式", -1)),
            _(f(it), {
              size: "small",
              placeholder: "如 A + B",
              value: e.item.spec.expression,
              onChange: I[29] || (I[29] = ($) => i("change", {
                ...e.item,
                spec: { ...e.item.spec, expression: $.target.value }
              }))
            }, null, 8, ["value"])
          ]),
          b("div", MO, [
            b("div", TO, [
              I[56] || (I[56] = b("span", { class: "text-xs text-secondary" }, "图例", -1)),
              _(f(it), {
                size: "small",
                placeholder: "图例格式",
                value: e.item.spec.legend,
                onChange: I[30] || (I[30] = ($) => J({ legend: $.target.value }))
              }, null, 8, ["value"])
            ]),
            b("div", zO, [
              I[57] || (I[57] = b("span", { class: "text-xs text-secondary" }, "条数", -1)),
              _(f(yn), {
                size: "small",
                style: { width: "80px" },
                placeholder: "∞",
                value: e.item.spec.limit ?? void 0,
                min: 1,
                onChange: I[31] || (I[31] = ($) => J({ limit: $ ?? void 0 }))
              }, null, 8, ["value"])
            ])
          ])
        ])) : be("", !0)
      ]))
    ]));
  }
}), OO = { class: "flex flex-col gap-2 p-1" }, PO = {
  key: 0,
  class: "flex items-center gap-2 mb-1"
}, IO = { class: "flex gap-1.5 mt-1" }, EO = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", $O = /* @__PURE__ */ ze({
  __name: "ArgusQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { config: a } = no(), l = oe(
      () => (a.value.datasourceConfig ?? []).filter((X) => X.type === "argus")
    ), u = pe(/* @__PURE__ */ new Set());
    function r(X) {
      return {
        name: X,
        signal: "metrics",
        stepInterval: null,
        disabled: !1,
        filter: { expression: "" },
        having: { expression: "" },
        groupBy: [],
        order: [],
        legend: "",
        functions: [],
        aggregations: [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }]
      };
    }
    function c(X) {
      return { name: X, expression: "", disabled: !1, legend: "", order: [] };
    }
    function g(X, F) {
      i("change", { ...n.query, [X]: F });
    }
    function y() {
      const X = n.query.queries.filter((N) => N.type === "builder_query"), F = EO[X.length] ?? `Q${X.length}`, V = { type: "builder_query", spec: r(F) };
      i("change", { ...n.query, queries: [...n.query.queries, V] });
    }
    function v() {
      const F = `F${n.query.queries.filter((N) => N.type === "builder_formula").length + 1}`, V = { type: "builder_formula", spec: c(F) };
      i("change", { ...n.query, queries: [...n.query.queries, V] });
    }
    function m(X) {
      i("change", { ...n.query, queries: n.query.queries.filter((F) => F.spec.name !== X) });
    }
    function S(X) {
      i("change", {
        ...n.query,
        queries: n.query.queries.map((F) => F.spec.name === X.spec.name ? X : F)
      });
    }
    function T(X) {
      const F = new Set(u.value);
      F.has(X) ? F.delete(X) : F.add(X), u.value = F;
    }
    function C(X) {
      S({ ...X, spec: { ...X.spec, disabled: !X.spec.disabled } });
    }
    const E = oe(() => {
      const X = (a.value.datasourceConfig ?? []).filter((V) => V.type === "argus");
      if (!X.length)
        return null;
      const F = X.find((V) => V.uid === n.datasourceId) ?? X.find((V) => V.default) ?? X[0];
      return { url: F.url, token: F.token };
    });
    return (X, F) => (O(), j("div", OO, [
      l.value.length > 1 ? (O(), j("div", PO, [
        F[1] || (F[1] = b("span", { class: "text-xs text-secondary whitespace-nowrap" }, "数据源", -1)),
        _(f(tt), {
          size: "small",
          style: { width: "180px" },
          value: e.query.datasourceId,
          options: l.value.map((V) => ({ value: V.uid, label: V.name })),
          onChange: F[0] || (F[0] = (V) => g("datasourceId", V))
        }, null, 8, ["value", "options"])
      ])) : be("", !0),
      (O(!0), j(Oe, null, et(e.query.queries, (V) => (O(), Ce(DO, {
        key: V.spec.name,
        item: V,
        cfg: E.value,
        collapsed: u.value.has(V.spec.name),
        "can-delete": e.query.queries.length > 1,
        onToggleCollapse: () => T(V.spec.name),
        onToggleDisabled: () => C(V),
        onDelete: () => m(V.spec.name),
        onChange: S
      }, null, 8, ["item", "cfg", "collapsed", "can-delete", "onToggleCollapse", "onToggleDisabled", "onDelete"]))), 128)),
      b("div", IO, [
        _(f(ot), {
          size: "small",
          type: "dashed",
          onClick: y
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).plus, "mr-1"])
            }, null, 2),
            F[2] || (F[2] = ce("基础查询 ", -1))
          ]),
          _: 1
        }),
        _(f(ot), {
          size: "small",
          type: "dashed",
          onClick: v
        }, {
          default: q(() => [
            b("span", {
              class: Re([f(De).plus, "mr-1"])
            }, null, 2),
            F[3] || (F[3] = ce("衍生算式 ", -1))
          ]),
          _: 1
        })
      ])
    ]));
  }
}), AO = { style: { "padding-top": "6px" } }, NO = { class: "inline-flex items-center gap-1.5 mb-2" }, RO = { class: "text-xs text-secondary" }, LO = {
  key: 0,
  class: "inline-flex items-center gap-1.5 mb-0 ml-2"
}, qO = { class: "text-xs text-secondary" }, FO = {
  key: 1,
  class: "inline-flex items-center gap-1.5 mb-0 ml-2"
}, VO = { class: "text-xs text-secondary" }, WO = {
  class: "text-xs text-secondary",
  style: { "min-width": "28px" }
}, YO = /* @__PURE__ */ ze({
  __name: "MockQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = st(), a = oe(() => [
      { value: "sine", label: i("qb.pattern.sine") },
      { value: "spike", label: i("qb.pattern.spike") },
      { value: "step", label: i("qb.pattern.step") },
      { value: "sawtooth", label: i("qb.pattern.sawtooth") },
      { value: "noise", label: i("qb.pattern.noise") },
      { value: "trend-up", label: i("qb.pattern.trendUp") },
      { value: "trend-down", label: i("qb.pattern.trendDown") },
      { value: "plateau", label: i("qb.pattern.plateau") },
      { value: "random-walk", label: i("qb.pattern.randomWalk") },
      { value: "live", label: i("qb.pattern.live") }
    ]);
    return (l, u) => (O(), j("div", AO, [
      b("div", NO, [
        b("span", RO, P(f(i)("qb.pattern")), 1),
        _(f(tt), {
          size: "small",
          style: { width: "140px" },
          value: e.query.pattern,
          options: a.value,
          onChange: u[0] || (u[0] = (r) => n("change", { ...e.query, pattern: r }))
        }, null, 8, ["value", "options"])
      ]),
      e.isChart ? (O(), j("div", LO, [
        b("span", qO, P(f(i)("qb.seriesCount")), 1),
        _(f(Fn), {
          min: 1,
          max: 8,
          value: e.query.seriesCount ?? 1,
          style: { width: "200px" },
          onChange: u[1] || (u[1] = (r) => n("change", { ...e.query, seriesCount: r }))
        }, null, 8, ["value"])
      ])) : be("", !0),
      e.query.pattern === "live" ? (O(), j("div", FO, [
        b("span", VO, P(f(i)("qb.liveAmplitude")), 1),
        _(f(Fn), {
          min: 0.1,
          max: 5,
          step: 0.1,
          value: e.query.liveAmplitude ?? 1,
          style: { width: "160px" },
          onChange: u[2] || (u[2] = (r) => n("change", { ...e.query, liveAmplitude: r }))
        }, null, 8, ["value"]),
        b("span", WO, P((e.query.liveAmplitude ?? 1).toFixed(1)) + "x ", 1)
      ])) : be("", !0)
    ]));
  }
}), el = /* @__PURE__ */ ze({
  __name: "ComboSelect",
  props: {
    value: {},
    displayValue: {},
    placeholder: {},
    groups: {},
    allowCustom: { type: Boolean, default: !0 },
    loading: { type: Boolean, default: !1 },
    disabled: { type: Boolean, default: !1 }
  },
  emits: ["change", "clear"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = pe(n.displayValue ?? n.value ?? "");
    Ye(
      [() => n.value, () => n.displayValue],
      ([c, g]) => {
        a.value = g ?? c ?? "";
      }
    );
    function l(c, g) {
      return c.toLowerCase().includes(g.toLowerCase());
    }
    const u = oe(() => {
      const c = a.value, g = n.groups.flatMap((m) => m.options), y = n.allowCustom && c && !g.some((m) => m.value === c || m.label === c) ? [{ label: "── 自定义 ──", options: [{ value: c, label: c }] }] : [], v = c ? n.groups.map((m) => ({ ...m, options: m.options.filter((S) => l(S.label, c)) })).filter((m) => m.options.length > 0) : n.groups;
      return [...y, ...v];
    }), r = oe(
      () => u.value.map((c) => ({
        label: c.label,
        options: c.options
      }))
    );
    return (c, g) => (O(), Ce(f(tt), {
      size: "small",
      style: { width: "100%" },
      "show-search": "",
      "allow-clear": "",
      "filter-option": !1,
      value: e.value || void 0,
      "search-value": a.value,
      placeholder: e.placeholder,
      loading: e.loading,
      disabled: e.disabled,
      options: r.value,
      onFocus: g[0] || (g[0] = () => {
        a.value = e.displayValue ?? e.value ?? "";
      }),
      onSearch: g[1] || (g[1] = (y) => {
        a.value = y;
      }),
      onChange: g[2] || (g[2] = (y) => {
        a.value = String(y ?? ""), i("change", String(y));
      }),
      onClear: g[3] || (g[3] = () => {
        a.value = "", i("clear");
      })
    }, null, 8, ["value", "search-value", "placeholder", "loading", "disabled", "options"]));
  }
}), BO = { class: "flex flex-wrap items-center gap-1.5 mt-1" }, HO = { class: "text-xs text-secondary" }, jO = { class: "font-medium text-blue lh-1" }, UO = /* @__PURE__ */ ze({
  __name: "FunctionsEditor",
  props: {
    functions: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = st();
    function l(S, T) {
      return T.length === 0 ? `${S.name}()` : `${S.name}(${T.join(", ")})`;
    }
    function u(S) {
      return { def: S, params: [...S.defaultParams], text: l(S, S.defaultParams) };
    }
    function r(S) {
      const T = S.filter((E) => E.def.category === "Alias");
      return [...S.filter((E) => E.def.category !== "Alias"), ...T];
    }
    function c(S) {
      const T = Ld.find((E) => E.name === S);
      if (!T)
        return;
      const C = u(T);
      i("change", r([...n.functions, C]));
    }
    function g(S, T, C) {
      const E = n.functions.map((X, F) => {
        if (F !== S)
          return X;
        const V = [...X.params];
        return V[T] = C, { ...X, params: V, text: l(X.def, V) };
      });
      i("change", E);
    }
    function y(S) {
      i("change", n.functions.filter((T, C) => C !== S));
    }
    function v(S, T) {
      const C = S + T;
      if (C < 0 || C >= n.functions.length)
        return;
      const E = [...n.functions];
      [E[S], E[C]] = [E[C], E[S]], i("change", E);
    }
    const m = oe(
      () => Kw.map((S) => ({
        key: S,
        label: S,
        children: Ld.filter((T) => T.category === S).map((T) => ({ key: T.name, label: T.name }))
      }))
    );
    return (S, T) => (O(), j("div", BO, [
      b("span", HO, P(f(a)("qb.functions")), 1),
      (O(!0), j(Oe, null, et(e.functions, (C, E) => (O(), j("div", {
        key: E,
        class: "inline-flex items-center gap-0.5 rounded px-1",
        style: { background: "#eee", "font-size": "12px" }
      }, [
        _(f(ot), {
          type: "text",
          size: "small",
          class: "p-0!",
          disabled: E === 0,
          onClick: (X) => v(E, -1)
        }, {
          default: q(() => [
            b("span", {
              class: Re(f(De).chevronLeft)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled", "onClick"]),
        b("span", jO, P(C.def.name), 1),
        T[1] || (T[1] = b("span", { class: "text-yellow" }, "(", -1)),
        (O(!0), j(Oe, null, et(C.def.params, (X, F) => (O(), j(Oe, { key: F }, [
          X.options ? (O(), Ce(f(tt), {
            key: 0,
            size: "small",
            value: String(C.params[F] ?? X.options[0]),
            options: X.options.map((V) => ({ value: String(V), label: String(V) })),
            "popup-match-select-width": "false",
            bordered: !1,
            variant: "borderless",
            style: { "min-width": "60px" },
            onChange: (V) => g(E, F, V)
          }, null, 8, ["value", "options", "onChange"])) : (O(), Ce(f(it), {
            key: 1,
            class: "text-green text-center",
            size: "small",
            bordered: !1,
            value: String(C.params[F] ?? ""),
            style: { width: "40px", padding: "0 4px", height: "20px" },
            variant: "borderless",
            onChange: (V) => g(E, F, V.target.value)
          }, null, 8, ["value", "onChange"]))
        ], 64))), 128)),
        T[2] || (T[2] = b("span", { class: "text-yellow font-medium" }, ")", -1)),
        _(f(ot), {
          type: "text",
          size: "small",
          class: "p-0!",
          disabled: E === e.functions.length - 1,
          onClick: (X) => v(E, 1)
        }, {
          default: q(() => [
            b("span", {
              class: Re(f(De).chevronRight)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled", "onClick"]),
        _(f(ot), {
          type: "text",
          size: "small",
          class: "p-0!",
          danger: "",
          onClick: (X) => y(E)
        }, {
          default: q(() => [
            b("span", {
              class: Re(f(De).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["onClick"])
      ]))), 128)),
      _(f(Jo), { trigger: ["click"] }, {
        overlay: q(() => [
          _(f(Di), {
            onClick: T[0] || (T[0] = ({ key: C }) => c(String(C)))
          }, {
            default: q(() => [
              (O(!0), j(Oe, null, et(m.value, (C) => (O(), Ce(f(Di).SubMenu, {
                key: C.key,
                title: C.label
              }, {
                default: q(() => [
                  (O(!0), j(Oe, null, et(C.children, (E) => (O(), Ce(f(Di).Item, {
                    key: E.key
                  }, {
                    default: q(() => [
                      ce(P(E.label), 1)
                    ]),
                    _: 2
                  }, 1024))), 128))
                ]),
                _: 2
              }, 1032, ["title"]))), 128))
            ]),
            _: 1
          })
        ]),
        default: q(() => [
          _(f(ot), {
            size: "small",
            type: "dashed"
          }, {
            default: q(() => [
              ce(" + " + P(f(a)("qb.functions.add")), 1)
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), GO = { class: "flex flex-wrap items-center gap-0 mt-3" }, KO = { class: "text-xs text-secondary font-medium" }, ZO = { class: "text-xs" }, QO = { class: "inline-flex items-center gap-1.5 mr-3" }, XO = { class: "text-xs text-secondary whitespace-nowrap" }, JO = { class: "inline-flex items-center gap-1.5 mr-3" }, eP = { class: "text-xs text-secondary whitespace-nowrap" }, tP = { class: "inline-flex items-center gap-1.5 mr-3" }, nP = { class: "text-xs text-secondary whitespace-nowrap" }, iP = { class: "inline-flex items-center gap-1.5 mr-3" }, aP = { class: "text-xs text-secondary whitespace-nowrap" }, lP = {
  key: 1,
  class: "inline-flex items-center gap-1.5 mr-3"
}, oP = { class: "text-xs text-secondary whitespace-nowrap" }, sP = { class: "inline-flex items-center gap-1.5 mr-3" }, rP = { class: "text-xs text-secondary whitespace-nowrap" }, uP = { class: "inline-flex items-center gap-1.5 mr-3" }, cP = { class: "text-xs text-secondary whitespace-nowrap" }, dP = { class: "inline-flex items-center gap-1.5 mr-3" }, fP = { class: "text-xs text-secondary whitespace-nowrap" }, hP = { class: "inline-flex items-center gap-1.5 mr-3" }, gP = { class: "text-xs text-secondary whitespace-nowrap" }, pP = { class: "inline-flex items-center gap-1.5 mr-3" }, mP = { class: "text-xs text-secondary whitespace-nowrap" }, vP = { class: "inline-flex items-center gap-1.5 mr-3" }, yP = { class: "text-xs text-secondary whitespace-nowrap" }, bP = { class: "inline-flex items-center gap-1.5 mr-3" }, xP = { class: "text-xs text-secondary whitespace-nowrap" }, wP = { class: "inline-flex items-center gap-1.5 mr-3" }, SP = { class: "text-xs text-secondary whitespace-nowrap" }, kP = /* @__PURE__ */ ze({
  __name: "OptionsEditor",
  props: {
    queryType: {},
    options: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = st(), l = pe(!0);
    function u(y) {
      i("change", { ...n.options, ...y });
    }
    const r = [
      { value: 2, label: a("qb.ack.all") },
      { value: 0, label: a("qb.ack.unack") },
      { value: 1, label: a("qb.ack.ack") }
    ], c = [
      { value: "default", label: a("qb.sort.default") },
      { value: "lastchange", label: a("qb.sort.lastchange") },
      { value: "severity", label: a("qb.sort.severity") }
    ], g = [
      { value: "default", label: a("qb.trends.default") },
      { value: "true", label: a("qb.trends.true") },
      { value: "false", label: a("qb.trends.false") }
    ];
    return (y, v) => (O(), j("div", GO, [
      b("div", {
        class: "inline-flex items-center gap-1.5 cursor-pointer py-1 mr-2 select-none flex-shrink-0",
        onClick: v[0] || (v[0] = (m) => l.value = !l.value)
      }, [
        b("span", KO, P(f(a)("qb.options")), 1),
        b("span", ZO, P(l.value ? "▸" : "▾"), 1)
      ]),
      b("div", {
        class: "flex flex-wrap items-center overflow-hidden transition-all",
        style: Ue({ maxHeight: l.value ? "200px" : "0" })
      }, [
        e.queryType === "metrics" || e.queryType === "itemid" || e.queryType === "services" ? (O(), j(Oe, { key: 0 }, [
          b("div", QO, [
            b("span", XO, P(f(a)("qb.options.trends")), 1),
            _(f(tt), {
              size: "small",
              style: { width: "100px" },
              value: e.options.useTrends ?? "default",
              options: g,
              onChange: v[1] || (v[1] = (m) => u({ useTrends: m }))
            }, null, 8, ["value"])
          ]),
          b("div", JO, [
            b("span", eP, P(f(a)("qb.options.showDisabled")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.showDisabledItems,
              onChange: v[2] || (v[2] = (m) => u({ showDisabledItems: m }))
            }, null, 8, ["checked"])
          ]),
          b("div", tP, [
            b("span", nP, P(f(a)("qb.options.valueMapping")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.useZabbixValueMapping,
              onChange: v[3] || (v[3] = (m) => u({ useZabbixValueMapping: m }))
            }, null, 8, ["checked"])
          ]),
          b("div", iP, [
            b("span", aP, P(f(a)("qb.options.disableAlignment")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.disableDataAlignment,
              onChange: v[4] || (v[4] = (m) => u({ disableDataAlignment: m }))
            }, null, 8, ["checked"])
          ])
        ], 64)) : be("", !0),
        e.queryType === "text" ? (O(), j("div", lP, [
          b("span", oP, P(f(a)("qb.options.showDisabled")), 1),
          _(f(oa), {
            size: "small",
            checked: !!e.options.showDisabledItems,
            onChange: v[5] || (v[5] = (m) => u({ showDisabledItems: m }))
          }, null, 8, ["checked"])
        ])) : be("", !0),
        e.queryType === "problems" ? (O(), j(Oe, { key: 2 }, [
          b("div", sP, [
            b("span", rP, P(f(a)("qb.options.acknowledged")), 1),
            _(f(tt), {
              size: "small",
              style: { width: "140px" },
              value: e.options.acknowledged ?? 2,
              options: r,
              onChange: v[6] || (v[6] = (m) => u({ acknowledged: m }))
            }, null, 8, ["value"])
          ]),
          b("div", uP, [
            b("span", cP, P(f(a)("qb.options.sortBy")), 1),
            _(f(tt), {
              size: "small",
              style: { width: "120px" },
              value: e.options.sortProblems ?? "default",
              options: c,
              onChange: v[7] || (v[7] = (m) => u({ sortProblems: m }))
            }, null, 8, ["value"])
          ]),
          b("div", dP, [
            b("span", fP, P(f(a)("qb.options.useTimeRange")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.useTimeRange,
              onChange: v[8] || (v[8] = (m) => u({ useTimeRange: m }))
            }, null, 8, ["checked"])
          ]),
          b("div", hP, [
            b("span", gP, P(f(a)("qb.options.hostsInMaintenance")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.hostsInMaintenance,
              onChange: v[9] || (v[9] = (m) => u({ hostsInMaintenance: m }))
            }, null, 8, ["checked"])
          ]),
          b("div", pP, [
            b("span", mP, P(f(a)("qb.options.hostProxy")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.hostProxy,
              onChange: v[10] || (v[10] = (m) => u({ hostProxy: m }))
            }, null, 8, ["checked"])
          ]),
          b("div", vP, [
            b("span", yP, P(f(a)("qb.options.limit")), 1),
            _(f(it), {
              size: "small",
              type: "number",
              style: { width: "80px" },
              value: e.options.limit ?? 100,
              onChange: v[11] || (v[11] = (m) => u({ limit: Number(m.target.value) }))
            }, null, 8, ["value"])
          ])
        ], 64)) : be("", !0),
        e.queryType === "triggers" ? (O(), j(Oe, { key: 3 }, [
          b("div", bP, [
            b("span", xP, P(f(a)("qb.options.acknowledged")), 1),
            _(f(tt), {
              size: "small",
              style: { width: "140px" },
              value: e.options.acknowledged ?? 2,
              options: r,
              onChange: v[12] || (v[12] = (m) => u({ acknowledged: m }))
            }, null, 8, ["value"])
          ]),
          b("div", wP, [
            b("span", SP, P(f(a)("qb.options.useTimeRange")), 1),
            _(f(oa), {
              size: "small",
              checked: !!e.options.useTimeRange,
              onChange: v[13] || (v[13] = (m) => u({ useTimeRange: m }))
            }, null, 8, ["checked"])
          ])
        ], 64)) : be("", !0)
      ], 4)
    ]));
  }
});
function fp(e) {
  const t = gl();
  return oe(() => {
    const n = e();
    if (!n)
      return [];
    if (!n.startsWith("$"))
      return [n];
    const i = n.slice(1), a = Object.values(t.variables).find(
      (r) => r.config.name === i
    );
    if (!a)
      return [];
    const l = a.current, u = Array.isArray(l) ? l : [l];
    return u.includes("$__all") ? a.options.map((r) => r.value).filter((r) => r !== "$__all") : u.filter(Boolean);
  });
}
function _P(e, t) {
  const n = pe([]), i = pe([]), a = pe(!1), l = pe(!1), u = fp(() => e().groupId);
  return Ye(
    () => ({ url: t().url, token: t().token }),
    async ({ url: r, token: c }) => {
      if (r) {
        a.value = !0, n.value = [];
        try {
          n.value = await $w({ url: r, token: c });
        } catch {
        } finally {
          a.value = !1;
        }
      }
    },
    { immediate: !0, deep: !0 }
  ), Ye(
    [u, () => t().url, () => t().token],
    async ([r, c, g]) => {
      if (!c || r.length === 0) {
        i.value = [];
        return;
      }
      l.value = !0, i.value = [];
      try {
        i.value = await Aw(r, void 0, { url: c, token: g });
      } catch {
      } finally {
        l.value = !1;
      }
    },
    { immediate: !0 }
  ), { groups: n, hosts: i, loadingGroups: a, loadingHosts: l, resolvedGroupIds: u };
}
function CP(e) {
  const { config: t } = no(), n = oe(() => (t.value.datasourceConfig ?? []).filter((u) => u.type === "zabbix").map((u, r) => ({
    uid: u.uid || String(r),
    name: u.name,
    url: u.url,
    token: u.token,
    isDefault: !!u.default
  }))), i = oe(() => {
    const l = wp(e);
    return n.value.find((r) => r.uid === l) ?? n.value[0] ?? { url: "", token: "" };
  }), a = oe(
    () => n.value.find((l) => l.isDefault)?.uid ?? n.value[0]?.uid ?? ""
  );
  return { sources: n, cfg: i, defaultUid: a };
}
const MP = {
  class: "flex flex-col gap-3 p-2",
  style: { "font-size": "12px" }
}, TP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, zP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, DP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, OP = { key: 0 }, PP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, IP = {
  key: 1,
  style: { "max-width": "400px" }
}, EP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, $P = {
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr" }
}, AP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, NP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, RP = { class: "flex items-center gap-2" }, LP = {
  class: "text-secondary",
  style: { "font-size": "11px" }
}, qP = { key: 3 }, FP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, VP = { key: 4 }, WP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, YP = {
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr 1fr" }
}, BP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, HP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, jP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, UP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, GP = { class: "flex flex-wrap gap-1" }, KP = {
  key: 6,
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr 1fr" }
}, ZP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, QP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, XP = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, JP = { key: 7 }, eI = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, tI = {
  key: 8,
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr" }
}, nI = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, iI = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, aI = /* @__PURE__ */ ze({
  __name: "ZabbixQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = st(), { cfg: l } = CP(() => n.datasourceId), u = gl();
    function r(Me) {
      i("change", { ...n.query, ...Me });
    }
    const c = oe(
      () => Object.values(u.variables).map((Me) => ({
        value: `$${Me.config.name}`,
        label: `$${Me.config.name}`
      }))
    );
    function g(Me, ue) {
      const se = [];
      return c.value.length > 0 && se.push({ label: "── 变量 ──", options: c.value }), se.push({ label: Me, options: ue }), se;
    }
    function y(Me) {
      return typeof Me == "string" && Me.startsWith("$");
    }
    const { groups: v, hosts: m, loadingGroups: S, loadingHosts: T } = _P(
      () => n.query,
      () => l.value
    ), C = fp(() => n.query.hostId), E = oe(
      () => v.value.map((Me) => ({ value: Me.groupid, label: Me.name }))
    ), X = oe(
      () => m.value.map((Me) => ({ value: Me.hostid, label: Me.name || Me.host }))
    ), F = pe([]), V = pe(!1);
    Ye(
      [
        C,
        () => l.value.url,
        () => l.value.token,
        () => n.query.queryType
      ],
      async ([Me, ue, se, Pe]) => {
        if (Pe !== "metrics") {
          F.value = [];
          return;
        }
        if (!Me.length || !ue) {
          F.value = [];
          return;
        }
        V.value = !0;
        try {
          F.value = (await Promise.all(
            Me.map(
              (xe) => zg([xe], void 0, void 0, { url: ue, token: se })
            )
          )).flat();
        } catch {
          F.value = [];
        } finally {
          V.value = !1;
        }
      },
      { immediate: !0 }
    );
    const N = oe(() => {
      const Me = /* @__PURE__ */ new Set();
      return F.value.flatMap(
        (ue) => (ue.tags ?? []).map((se) => Lw(se))
      ).filter((ue) => Me.has(ue) ? !1 : (Me.add(ue), !0)).map((ue) => ({ value: ue, label: ue }));
    }), Y = oe(() => {
      if (!n.query.itemTagsFilter)
        return F.value;
      const [Me, ue] = n.query.itemTagsFilter.split(":").map((se) => se.trim());
      return F.value.filter(
        (se) => (se.tags ?? []).some(
          (Pe) => Pe.tag === Me && (ue ? Pe.value === ue : !0)
        )
      );
    }), K = oe(() => {
      const Me = /* @__PURE__ */ new Set();
      return Y.value.map((ue) => ue.name).filter((ue) => Me.has(ue) ? !1 : (Me.add(ue), !0)).map((ue) => ({ value: ue, label: ue }));
    }), M = pe([]), W = pe(!1);
    Ye(
      [
        () => n.query.hostId,
        () => l.value.url,
        () => l.value.token,
        () => n.query.queryType
      ],
      async ([Me, ue, se, Pe]) => {
        if (Pe !== "text" || !Me || !ue) {
          M.value = [];
          return;
        }
        W.value = !0;
        try {
          M.value = await qw([Me], void 0, { url: ue, token: se });
        } catch {
          M.value = [];
        } finally {
          W.value = !1;
        }
      },
      { immediate: !0 }
    );
    const G = oe(() => {
      const Me = /* @__PURE__ */ new Set();
      return M.value.map((ue) => ue.name).filter((ue) => Me.has(ue) ? !1 : (Me.add(ue), !0)).map((ue) => ({ value: ue, label: ue }));
    }), Z = pe([]), A = pe(!1);
    Ye(
      [() => l.value.url, () => l.value.token, () => n.query.queryType],
      async ([Me, ue, se]) => {
        if (!(se !== "services" || !Me)) {
          A.value = !0;
          try {
            Z.value = await Vw({ url: Me, token: ue });
          } catch {
            Z.value = [];
          } finally {
            A.value = !1;
          }
        }
      },
      { immediate: !0 }
    );
    const J = pe([]), ee = pe(!1);
    Ye(
      [
        () => n.query.hostId,
        () => l.value.url,
        () => l.value.token,
        () => n.query.queryType
      ],
      async ([Me, ue, se, Pe]) => {
        if (Pe !== "macros" || !Me || !ue) {
          J.value = [];
          return;
        }
        ee.value = !0;
        try {
          J.value = await Fw([Me], { url: ue, token: se });
        } catch {
          J.value = [];
        } finally {
          ee.value = !1;
        }
      },
      { immediate: !0 }
    );
    const I = pe([]), $ = pe(!1), le = pe([]), ie = pe(!1);
    Ye(
      [
        () => n.query.hostId,
        () => l.value.url,
        () => l.value.token,
        () => n.query.queryType
      ],
      async ([Me, ue, se, Pe]) => {
        if (Pe !== "lld" || !Me || Me.startsWith("$") || !ue) {
          I.value = [];
          return;
        }
        $.value = !0;
        try {
          I.value = await Bw([Me], { url: ue, token: se });
        } catch {
          I.value = [];
        } finally {
          $.value = !1;
        }
      },
      { immediate: !0 }
    ), Ye(
      [() => n.query.lldRuleId, () => l.value.url, () => l.value.token],
      async ([Me, ue, se]) => {
        if (!Me || !ue) {
          le.value = [];
          return;
        }
        ie.value = !0;
        try {
          const Pe = /* @__PURE__ */ new Set();
          le.value = (await Hw(Me, { url: ue, token: se })).map((xe) => {
            const qe = xe.key_.includes("[") ? xe.key_.slice(0, xe.key_.indexOf("[")) : xe.key_;
            return { value: qe, label: `${xe.name} (${qe})` };
          }).filter((xe) => Pe.has(xe.value) ? !1 : (Pe.add(xe.value), !0));
        } catch {
          le.value = [];
        } finally {
          ie.value = !1;
        }
      },
      { immediate: !0 }
    );
    const ye = [
      "metrics",
      "text",
      "services",
      "itemid",
      "triggers",
      "problems",
      "macros",
      "lld"
    ], fe = [
      "problems",
      "recent",
      "history"
    ], he = {
      problems: "Problems",
      recent: "Recent problems",
      history: "History"
    }, ae = [
      { value: 0, label: "Not classified", color: "#97aab3" },
      { value: 1, label: "Information", color: "#7499ff" },
      { value: 2, label: "Warning", color: "#ffc859" },
      { value: 3, label: "Average", color: "#ffa059" },
      { value: 4, label: "High", color: "#e97659" },
      { value: 5, label: "Disaster", color: "#e45959" }
    ], ve = [
      { value: "status", label: "Status" },
      { value: "sli", label: "SLI" },
      { value: "uptime", label: "Uptime" },
      { value: "downtime", label: "Downtime" },
      { value: "error_budget", label: "Error budget" }
    ], Ne = [
      { value: "none", label: "No interval" },
      { value: "auto", label: "Auto" },
      { value: "1h", label: "1 hour" },
      { value: "12h", label: "12 hours" },
      { value: "1d", label: "24 hours" },
      { value: "1w", label: "1 week" },
      { value: "1M", label: "1 month" }
    ], we = oe(
      () => ["metrics", "text", "triggers", "problems", "macros", "lld"].includes(
        n.query.queryType
      )
    );
    return (Me, ue) => (O(), j("div", MP, [
      b("div", null, [
        b("div", TP, P(f(a)("qb.queryType")), 1),
        _(f(tt), {
          size: "small",
          style: { width: "100%" },
          value: e.query.queryType,
          options: ye.map((se) => ({
            value: se,
            label: f(a)(`qb.queryType.${se}`)
          })),
          onChange: ue[0] || (ue[0] = (se) => r({ queryType: se, itemIds: [], itemNames: [], itemids: "" }))
        }, null, 8, ["value", "options"])
      ]),
      we.value ? (O(), j("div", {
        key: 0,
        class: "grid gap-3",
        style: Ue({ gridTemplateColumns: e.query.queryType === "metrics" ? "repeat(3, 1fr)" : "repeat(2, 1fr)" })
      }, [
        b("div", null, [
          b("div", zP, P(f(a)("panel.group")), 1),
          _(f(ki), {
            spinning: f(S),
            size: "small"
          }, {
            default: q(() => [
              _(el, {
                value: e.query.groupId || void 0,
                "display-value": e.query.groupName || void 0,
                placeholder: f(a)("panel.group.placeholder"),
                groups: g("── 主机组 ──", E.value),
                onChange: ue[1] || (ue[1] = (se) => r({ groupId: se, groupName: y(se) ? se : f(v).find((Pe) => Pe.groupid === se)?.name ?? se, hostId: "", hostName: "", itemIds: [], itemNames: [] })),
                onClear: ue[2] || (ue[2] = () => r({ groupId: "", groupName: "", hostId: "", hostName: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "display-value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        b("div", null, [
          b("div", DP, P(f(a)("panel.host")), 1),
          _(f(ki), {
            spinning: f(T),
            size: "small"
          }, {
            default: q(() => [
              _(el, {
                value: e.query.hostId || void 0,
                "display-value": e.query.hostName || void 0,
                placeholder: f(a)("panel.host.placeholder"),
                groups: g("── 主机 ──", X.value),
                onChange: ue[3] || (ue[3] = (se) => r({ hostId: se, hostName: y(se) ? se : f(m).find((Pe) => Pe.hostid === se)?.name ?? se, itemIds: [], itemNames: [] })),
                onClear: ue[4] || (ue[4] = () => r({ hostId: "", hostName: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "display-value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        e.query.queryType === "metrics" ? (O(), j("div", OP, [
          b("div", PP, P(f(a)("panel.itemTag")), 1),
          _(f(ki), {
            spinning: V.value,
            size: "small"
          }, {
            default: q(() => [
              _(el, {
                value: e.query.itemTagsFilter || void 0,
                placeholder: f(a)("panel.itemTag.placeholder"),
                groups: g("── 标签 ──", N.value),
                onChange: ue[5] || (ue[5] = (se) => r({ itemTagsFilter: se ?? "", itemIds: [], itemNames: [] })),
                onClear: ue[6] || (ue[6] = () => r({ itemTagsFilter: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ])) : be("", !0)
      ], 4)) : be("", !0),
      e.query.queryType === "metrics" ? (O(), j("div", IP, [
        b("div", EP, P(f(a)("panel.items")), 1),
        _(el, {
          value: e.query.itemNames[0] || void 0,
          placeholder: f(a)("panel.items.placeholder"),
          groups: g("── 监控项 ──", K.value),
          onChange: ue[7] || (ue[7] = (se) => r({ itemNames: [se], itemIds: [] })),
          onClear: ue[8] || (ue[8] = () => r({ itemNames: [], itemIds: [] }))
        }, null, 8, ["value", "placeholder", "groups"])
      ])) : be("", !0),
      e.query.queryType === "text" ? (O(), j(Oe, { key: 2 }, [
        b("div", $P, [
          b("div", null, [
            b("div", AP, P(f(a)("panel.items")), 1),
            _(f(ki), {
              spinning: W.value,
              size: "small"
            }, {
              default: q(() => [
                _(el, {
                  value: e.query.itemNames[0] || void 0,
                  placeholder: f(a)("panel.items.placeholder"),
                  disabled: !e.query.hostId,
                  groups: g("── 监控项 ──", G.value),
                  onChange: ue[9] || (ue[9] = (se) => r({ itemNames: [se], itemIds: [] })),
                  onClear: ue[10] || (ue[10] = () => r({ itemNames: [], itemIds: [] }))
                }, null, 8, ["value", "placeholder", "disabled", "groups"])
              ]),
              _: 1
            }, 8, ["spinning"])
          ]),
          b("div", null, [
            b("div", NP, P(f(a)("qb.textFilter")), 1),
            _(f(it), {
              size: "small",
              style: { width: "100%" },
              value: e.query.textFilter,
              onChange: ue[11] || (ue[11] = (se) => r({ textFilter: se.target.value }))
            }, null, 8, ["value"])
          ])
        ]),
        b("div", RP, [
          _(f(Yi), {
            checked: e.query.useCaptureGroups,
            onChange: ue[12] || (ue[12] = (se) => r({ useCaptureGroups: se.target.checked }))
          }, null, 8, ["checked"]),
          b("span", LP, P(f(a)("qb.useCaptureGroups")), 1)
        ])
      ], 64)) : be("", !0),
      e.query.queryType === "itemid" ? (O(), j("div", qP, [
        b("div", FP, P(f(a)("qb.itemIds")), 1),
        _(f(it), {
          size: "small",
          style: { width: "100%" },
          value: e.query.itemids,
          placeholder: f(a)("qb.itemIds.placeholder"),
          onChange: ue[13] || (ue[13] = (se) => r({ itemids: se.target.value }))
        }, null, 8, ["value", "placeholder"])
      ])) : be("", !0),
      e.query.queryType === "triggers" ? (O(), j("div", VP, [
        b("div", WP, P(f(a)("qb.triggerFilter")), 1),
        _(f(it), {
          size: "small",
          style: { width: "100%" },
          value: e.query.triggerFilter,
          onChange: ue[14] || (ue[14] = (se) => r({ triggerFilter: se.target.value }))
        }, null, 8, ["value"])
      ])) : be("", !0),
      e.query.queryType === "problems" ? (O(), j(Oe, { key: 5 }, [
        b("div", YP, [
          b("div", null, [
            b("div", BP, P(f(a)("qb.problemName")), 1),
            _(f(it), {
              size: "small",
              style: { width: "100%" },
              value: e.query.triggerFilter,
              onChange: ue[15] || (ue[15] = (se) => r({ triggerFilter: se.target.value }))
            }, null, 8, ["value"])
          ]),
          b("div", null, [
            b("div", HP, P(f(a)("qb.tags")), 1),
            _(f(it), {
              size: "small",
              style: { width: "100%" },
              value: e.query.tagsFilter,
              onChange: ue[16] || (ue[16] = (se) => r({ tagsFilter: se.target.value }))
            }, null, 8, ["value"])
          ]),
          b("div", null, [
            b("div", jP, P(f(a)("qb.show")), 1),
            _(f(tt), {
              size: "small",
              style: { width: "100%" },
              value: e.query.showProblems,
              options: fe.map((se) => ({ value: se, label: he[se] })),
              onChange: ue[17] || (ue[17] = (se) => r({ showProblems: se }))
            }, null, 8, ["value", "options"])
          ])
        ]),
        b("div", null, [
          b("div", UP, P(f(a)("qb.severity")), 1),
          b("div", GP, [
            (O(), j(Oe, null, et(ae, (se) => _(f(Zl), {
              key: se.value,
              color: e.query.severities.includes(se.value) ? se.color : void 0,
              class: "cursor-pointer select-none",
              style: Ue({ opacity: e.query.severities.includes(se.value) ? 1 : 0.4 }),
              onClick: () => r({ severities: e.query.severities.includes(se.value) ? e.query.severities.filter((Pe) => Pe !== se.value) : [...e.query.severities, se.value] })
            }, {
              default: q(() => [
                ce(P(se.label), 1)
              ]),
              _: 2
            }, 1032, ["color", "style", "onClick"])), 64))
          ])
        ])
      ], 64)) : be("", !0),
      e.query.queryType === "services" ? (O(), j("div", KP, [
        b("div", null, [
          b("div", ZP, P(f(a)("qb.itService")), 1),
          _(f(ki), {
            spinning: A.value,
            size: "small"
          }, {
            default: q(() => [
              _(el, {
                value: e.query.itServiceFilter || void 0,
                placeholder: f(a)("qb.itService.placeholder"),
                groups: g("── 服务 ──", Z.value.map((se) => ({ value: se.name, label: se.name }))),
                onChange: ue[18] || (ue[18] = (se) => r({ itServiceFilter: se })),
                onClear: ue[19] || (ue[19] = () => r({ itServiceFilter: "" }))
              }, null, 8, ["value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        b("div", null, [
          b("div", QP, P(f(a)("qb.slaProperty")), 1),
          _(f(tt), {
            size: "small",
            style: { width: "100%" },
            value: e.query.slaProperty,
            options: ve,
            onChange: ue[20] || (ue[20] = (se) => r({ slaProperty: se }))
          }, null, 8, ["value"])
        ]),
        b("div", null, [
          b("div", XP, P(f(a)("qb.slaInterval")), 1),
          _(f(tt), {
            size: "small",
            style: { width: "100%" },
            value: e.query.slaInterval,
            options: Ne,
            onChange: ue[21] || (ue[21] = (se) => r({ slaInterval: se }))
          }, null, 8, ["value"])
        ])
      ])) : be("", !0),
      e.query.queryType === "macros" ? (O(), j("div", JP, [
        b("div", eI, P(f(a)("qb.macroFilter")), 1),
        _(f(ki), {
          spinning: ee.value,
          size: "small"
        }, {
          default: q(() => [
            _(el, {
              value: e.query.macroFilter || void 0,
              placeholder: "{$MACRO_NAME}",
              disabled: !e.query.hostId,
              groups: [{ label: "── 宏 ──", options: J.value.map((se) => ({ value: se.macro, label: `${se.macro} = ${se.value}` })) }],
              onChange: ue[22] || (ue[22] = (se) => r({ macroFilter: se })),
              onClear: ue[23] || (ue[23] = () => r({ macroFilter: "" }))
            }, null, 8, ["value", "disabled", "groups"])
          ]),
          _: 1
        }, 8, ["spinning"])
      ])) : be("", !0),
      e.query.queryType === "lld" ? (O(), j("div", tI, [
        b("div", null, [
          b("div", nI, P(f(a)("qb.lld.rule")), 1),
          _(f(ki), {
            spinning: $.value,
            size: "small"
          }, {
            default: q(() => [
              _(f(tt), {
                size: "small",
                style: { width: "100%" },
                "allow-clear": "",
                "show-search": "",
                value: e.query.lldRuleId || void 0,
                placeholder: f(a)("qb.lld.rule.placeholder"),
                options: I.value.map((se) => ({ value: se.itemid, label: se.name })),
                onChange: ue[24] || (ue[24] = (se) => r({ lldRuleId: se, lldRuleName: I.value.find((Pe) => Pe.itemid === se)?.name ?? se, lldItemKeys: [] })),
                onClear: ue[25] || (ue[25] = () => r({ lldRuleId: "", lldRuleName: "", lldItemKeys: [] }))
              }, null, 8, ["value", "placeholder", "options"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        b("div", null, [
          b("div", iI, P(f(a)("qb.lld.itemKeys")), 1),
          _(f(ki), {
            spinning: ie.value,
            size: "small"
          }, {
            default: q(() => [
              _(f(tt), {
                size: "small",
                style: { width: "100%" },
                mode: "multiple",
                "allow-clear": "",
                value: e.query.lldItemKeys ?? [],
                options: le.value,
                onChange: ue[26] || (ue[26] = (se) => r({ lldItemKeys: se }))
              }, null, 8, ["value", "options"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ])
      ])) : be("", !0),
      ["metrics", "itemid", "services"].includes(e.query.queryType) ? (O(), Ce(UO, {
        key: 9,
        functions: e.query.functions ?? [],
        onChange: ue[27] || (ue[27] = (se) => r({ functions: se }))
      }, null, 8, ["functions"])) : be("", !0),
      ["macros", "lld"].includes(e.query.queryType) ? be("", !0) : (O(), Ce(kP, {
        key: 10,
        "query-type": e.query.queryType,
        options: e.query.options ?? {},
        onChange: ue[28] || (ue[28] = (se) => r({ options: se }))
      }, null, 8, ["query-type", "options"]))
    ]));
  }
});
class lI {
  type = "argus";
  meta = { type: "argus", displayName: "Argus", icon: "📊" };
  QueryEditor = $O;
  defaultQuery = () => ({
    type: "argus",
    datasourceId: "",
    queries: [
      {
        type: "builder_query",
        spec: {
          name: "A",
          signal: "metrics",
          stepInterval: null,
          disabled: !1,
          filter: { expression: "" },
          having: { expression: "" },
          groupBy: [],
          order: [],
          legend: "",
          functions: [],
          aggregations: [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }]
        }
      }
    ]
  });
  async query() {
    return { data: [], state: "Done" };
  }
}
class oI {
  type = "zabbix";
  meta = { type: "zabbix", displayName: "Zabbix", icon: "" };
  QueryEditor = aI;
  defaultQuery = () => ({
    type: "zabbix",
    datasourceId: "",
    queryType: "metrics",
    groupId: "",
    groupName: "",
    hostId: "",
    hostName: "",
    appId: "",
    appName: "",
    itemIds: [],
    itemNames: [],
    textFilter: "",
    useCaptureGroups: !1,
    itemTagsFilter: "",
    itemids: "",
    triggerFilter: "",
    tagsFilter: "",
    showProblems: "problems",
    severities: [],
    itServiceFilter: "",
    slaFilter: "",
    slaProperty: "sli",
    slaInterval: "none",
    macroFilter: "",
    lldRuleId: "",
    lldRuleName: "",
    lldItemKeys: [],
    functions: [],
    options: {
      useTrends: "default",
      showDisabledItems: !1,
      useZabbixValueMapping: !1,
      disableDataAlignment: !1,
      acknowledged: 2,
      sortProblems: "default",
      useTimeRange: !1,
      hostsInMaintenance: !1,
      hostProxy: !1,
      limit: 100
    }
  });
  async query(t) {
    const { range: n, targets: i, maxDataPoints: a, scopedVars: l, _dsCfg: u } = t;
    if (!u)
      return { data: [], state: "Done" };
    const r = { url: u.url, token: u.token }, c = Math.floor(n.from / 1e3), g = Math.ceil(n.to / 1e3), y = l ?? {}, v = t._variableStates ?? {}, m = [];
    for (const S of i) {
      const T = Qw(S, y, v);
      let C = [];
      if (T.queryType === "itemid" && T.itemids?.trim()) {
        const ee = T.itemids.split(",").map((I) => I.trim()).filter(Boolean);
        C = await Nw(ee, r);
      } else if (T.hostIds.length > 0 && S.itemNames.length > 0) {
        const ee = (await Promise.all(
          T.hostIds.map(
            ($) => zg([$], void 0, void 0, r, T.itemTagsFilter || void 0)
          )
        )).flat(), I = new Set(S.itemNames.filter(($) => !$.startsWith("$")));
        C = ee.filter(($) => I.has($.name));
      }
      if (C.length === 0)
        continue;
      const [E, X] = await Promise.all([
        Ww(
          C.map((ee) => ee.itemid),
          c,
          g,
          r
        ),
        S.options?.useZabbixValueMapping ? Yw(r) : Promise.resolve([])
      ]);
      if (E.length === 0)
        continue;
      const F = /* @__PURE__ */ new Map();
      for (const ee of X) {
        const I = {};
        for (const $ of ee.mappings)
          I[$.value] = $.newvalue;
        F.set(ee.valuemapid, I);
      }
      const V = jw(E, C.map((ee) => ee.itemid)), N = Math.max(Math.ceil((g - c) / a), 60), Y = new Map(
        Array.from(V.entries()).map(([ee, I]) => [
          ee,
          I.length > a ? Gw(I, N * 1e3) : I
        ])
      ), K = new Map(
        Array.from(Y.entries()).map(([ee, I]) => [
          ee,
          yw(I, c, g, N)
        ])
      ), M = (K.get(C[0].itemid) ?? []).map((ee) => ee.ts / 1e3), W = {
        timestamps: M,
        series: C.map((ee) => {
          const I = K.get(ee.itemid) ?? [];
          return { label: ee.name, values: I.map(($) => $.value) };
        })
      }, G = Pw(W, S.functions ?? []), Z = /* @__PURE__ */ new Map();
      G.series.forEach((ee, I) => {
        const $ = C[I];
        $ && Z.set(
          $.itemid,
          ee.values.map((le, ie) => ({ ts: M[ie] * 1e3, value: le }))
        );
      });
      const A = C.slice(0, G.series.length), J = Iw(Z, A, F, S.datasourceId || "A");
      G.series.forEach((ee, I) => {
        const $ = J.fields[I + 1];
        $?.config && ($.config.displayNameFromDS = ee.label);
      }), m.push(J);
    }
    return { data: m, state: "Done" };
  }
}
let Pf = !1;
function sI() {
  if (Pf)
    return;
  Pf = !0, Lb();
  const e = new Cb();
  e.QueryEditor = YO, jr(e), jr(new lI()), jr(new oI());
}
const KI = /* @__PURE__ */ ze({
  __name: "ArgusBoard",
  props: {
    hideHeader: { type: Boolean, default: !1 },
    canEdit: { type: Boolean, default: !0 },
    theme: { default: null },
    lang: { default: null },
    isEditing: { type: [Boolean, null], default: null },
    initialEditingPanelId: { default: null },
    datasourceConfig: { default: null },
    initialConfig: {},
    renderDefaultDashboard: { type: Boolean },
    presets: {}
  },
  emits: ["save"],
  setup(e, { emit: t }) {
    const n = e, i = t;
    Nn(() => {
      console.warn(
        "%c ArgusBoard %c v1.0.2 %c 2026/7/8 14:50:29",
        "background:#4096ff;color:#fff;padding:2px 4px;border-radius:3px 0 0 3px;font-weight:bold",
        "background:#1f1f1f;color:#4096ff;padding:2px 4px;font-weight:bold",
        "background:#1f1f1f;color:#888;padding:2px 4px;border-radius:0 3px 3px 0"
      );
    }), sI(), Fp(() => ({
      hideHeader: n.hideHeader,
      canEdit: n.canEdit,
      theme: n.theme ?? null,
      lang: n.lang ?? null,
      isEditing: n.isEditing ?? null,
      initialEditingPanelId: n.initialEditingPanelId ?? null,
      datasourceConfig: n.datasourceConfig ?? null,
      initialConfig: n.initialConfig,
      renderDefaultDashboard: n.renderDefaultDashboard,
      presets: n.presets,
      onSave: (y) => i("save", y)
    }));
    const a = Hi();
    n.theme && a.setTheme(n.theme);
    const l = oe(() => n.theme ?? a.theme);
    Ye(l, (y) => {
      document.documentElement.dataset.theme = y, document.body.dataset.theme = y;
    }, { immediate: !0 });
    const u = pe(n.lang ?? "zh");
    Lp(u), Ye(() => n.lang, (y) => {
      y && (u.value = y);
    });
    const r = Gi();
    function c(y) {
      y ? r.importJSON(
        typeof y == "string" ? y : JSON.stringify(y)
      ) : n.renderDefaultDashboard === !1 && r.importJSON(JSON.stringify({ title: "", panels: {}, layouts: [] }));
    }
    Nn(() => {
      n.canEdit === !1 ? r.setEditing(!1) : n.isEditing !== null && r.setEditing(n.isEditing ?? !0), c(n.initialConfig), n.initialEditingPanelId && r.setEditingPanel(n.initialEditingPanelId);
    }), Ye(() => n.initialConfig, (y) => {
      c(y);
    });
    const g = oe(() => ({
      algorithm: l.value === "dark" ? zc.darkAlgorithm : zc.defaultAlgorithm,
      token: { colorPrimary: "#1677ff", borderRadius: 4 },
      getPopupContainer: () => document.body
    }));
    return (y, v) => (O(), Ce(f(fu), { theme: g.value }, {
      default: q(() => [
        _(LD)
      ]),
      _: 1
    }, 8, ["theme"]));
  }
}), rI = { class: "log-toolbar" }, uI = { class: "log-scroller" }, cI = { class: "log-time" }, dI = { class: "log-message" }, fI = {
  key: 0,
  class: "log-empty"
}, hI = /* @__PURE__ */ ze({
  __name: "LogViewer",
  props: {
    logs: {},
    maxHeight: { default: 400 }
  },
  setup(e) {
    const t = e, n = pe(""), i = pe([]), a = oe(() => t.logs.filter((u) => !(i.value.length > 0 && !i.value.includes(u.level) || n.value && !u.message.toLowerCase().includes(n.value.toLowerCase())))), l = {
      error: "#ff4d4f",
      warn: "#faad14",
      info: "#52c41a",
      debug: "#8c8c8c"
    };
    return (u, r) => {
      const c = ht("a-input"), g = ht("a-select");
      return O(), j("div", {
        class: "log-viewer",
        style: Ue({ maxHeight: `${e.maxHeight}px` })
      }, [
        b("div", rI, [
          _(c, {
            value: n.value,
            "onUpdate:value": r[0] || (r[0] = (y) => n.value = y),
            size: "small",
            placeholder: "Search logs...",
            "allow-clear": "",
            style: { flex: "1" }
          }, null, 8, ["value"]),
          _(g, {
            value: i.value,
            "onUpdate:value": r[1] || (r[1] = (y) => i.value = y),
            mode: "multiple",
            size: "small",
            placeholder: "Level",
            style: { "min-width": "160px" },
            options: [
              { value: "error", label: "Error" },
              { value: "warn", label: "Warn" },
              { value: "info", label: "Info" },
              { value: "debug", label: "Debug" }
            ]
          }, null, 8, ["value"])
        ]),
        b("div", uI, [
          (O(!0), j(Oe, null, et(a.value, (y) => (O(), j("div", {
            key: y.id,
            class: "log-entry"
          }, [
            b("span", cI, P(new Date(y.timestamp).toLocaleTimeString()), 1),
            b("span", {
              class: "log-level",
              style: Ue({ color: l[y.level] })
            }, P(y.level.toUpperCase()), 5),
            b("span", dI, P(y.message), 1)
          ]))), 128))
        ]),
        a.value.length === 0 ? (O(), j("div", fI, " No log entries ")) : be("", !0)
      ], 4);
    };
  }
}), ZI = /* @__PURE__ */ Vn(hI, [["__scopeId", "data-v-22a0d40d"]]), gI = {
  key: 0,
  class: "topology-empty"
}, pI = ["width", "height"], mI = { class: "edges" }, vI = ["x1", "y1", "x2", "y2"], yI = ["cx", "cy", "fill", "stroke"], bI = ["x", "y"], xI = ["x", "y"], wI = /* @__PURE__ */ ze({
  __name: "ServiceTopology",
  props: {
    nodes: { default: () => [] },
    edges: { default: () => [] },
    width: { default: 800 },
    height: { default: 500 }
  },
  setup(e) {
    const t = e, n = pe(), i = pe({});
    function a() {
      if (t.nodes.length === 0)
        return;
      const u = Math.ceil(Math.sqrt(t.nodes.length)), r = t.width / u, c = t.height / Math.ceil(t.nodes.length / u), g = {};
      t.nodes.forEach((y, v) => {
        const m = v % u, S = Math.floor(v / u);
        g[y.id] = {
          x: m * r + r / 2,
          y: S * c + c / 2
        };
      }), i.value = g;
    }
    Nn(a);
    function l(u) {
      return u ? u > 0.05 ? "#ff4d4f" : u > 0.01 ? "#faad14" : "#52c41a" : "#52c41a";
    }
    return (u, r) => (O(), j("div", {
      class: "service-topology",
      style: Ue({ width: `${e.width}px`, height: `${e.height}px` })
    }, [
      e.nodes.length === 0 ? (O(), j("div", gI, " No topology data ")) : (O(), j("svg", {
        key: 1,
        ref_key: "svgRef",
        ref: n,
        width: e.width,
        height: e.height
      }, [
        b("g", mI, [
          (O(!0), j(Oe, null, et(e.edges, (c) => (O(), j("line", {
            key: `${c.source}-${c.target}`,
            x1: i.value[c.source]?.x ?? 0,
            y1: i.value[c.source]?.y ?? 0,
            x2: i.value[c.target]?.x ?? 0,
            y2: i.value[c.target]?.y ?? 0,
            stroke: "var(--ant-color-border)",
            "stroke-width": "1.5",
            "marker-end": "url(#arrowhead)"
          }, null, 8, vI))), 128))
        ]),
        r[0] || (r[0] = b("defs", null, [
          b("marker", {
            id: "arrowhead",
            markerWidth: "10",
            markerHeight: "7",
            refX: "10",
            refY: "3.5",
            orient: "auto"
          }, [
            b("polygon", {
              points: "0 0, 10 3.5, 0 7",
              fill: "var(--ant-color-border)"
            })
          ])
        ], -1)),
        (O(!0), j(Oe, null, et(e.nodes, (c) => (O(), j("g", {
          key: c.id,
          class: "topology-node"
        }, [
          b("circle", {
            cx: i.value[c.id]?.x ?? 0,
            cy: i.value[c.id]?.y ?? 0,
            r: "24",
            fill: l(c.errorRate),
            "fill-opacity": "0.15",
            stroke: l(c.errorRate),
            "stroke-width": "2"
          }, null, 8, yI),
          b("text", {
            x: i.value[c.id]?.x ?? 0,
            y: (i.value[c.id]?.y ?? 0) + 4,
            "text-anchor": "middle",
            "font-size": "10",
            fill: "var(--ant-color-text)"
          }, P(c.name), 9, bI),
          c.latency !== void 0 ? (O(), j("text", {
            key: 0,
            x: i.value[c.id]?.x ?? 0,
            y: (i.value[c.id]?.y ?? 0) + 36,
            "text-anchor": "middle",
            "font-size": "9",
            fill: "var(--ant-color-text-secondary)"
          }, P(c.latency) + "ms ", 9, xI)) : be("", !0)
        ]))), 128))
      ], 8, pI))
    ], 4));
  }
}), QI = /* @__PURE__ */ Vn(wI, [["__scopeId", "data-v-da85d863"]]), SI = { class: "trace-waterfall" }, kI = {
  key: 0,
  class: "trace-empty"
}, _I = { class: "trace-name-col" }, CI = { class: "trace-service" }, MI = { class: "trace-op" }, TI = { class: "trace-bar-col" }, zI = { class: "trace-dur-col" }, DI = /* @__PURE__ */ ze({
  __name: "TraceWaterfall",
  props: {
    spans: { default: () => [] },
    startTime: {},
    endTime: {}
  },
  setup(e) {
    const t = e, n = oe(() => t.startTime ?? Math.min(...t.spans.map((g) => g.startTime))), i = oe(() => t.endTime ?? Math.max(...t.spans.map((g) => g.startTime + g.duration))), a = oe(() => i.value - n.value);
    function l(g) {
      return (g.startTime - n.value) / a.value * 100;
    }
    function u(g) {
      return Math.max(g.duration / a.value * 100, 0.5);
    }
    function r(g) {
      return g >= 1e6 ? `${(g / 1e6).toFixed(2)}s` : g >= 1e3 ? `${(g / 1e3).toFixed(2)}ms` : `${g}μs`;
    }
    const c = {
      ok: "#52c41a",
      error: "#ff4d4f",
      unset: "#1677ff"
    };
    return (g, y) => (O(), j("div", SI, [
      e.spans.length === 0 ? (O(), j("div", kI, " No trace data ")) : (O(), j(Oe, { key: 1 }, [
        y[0] || (y[0] = b("div", { class: "trace-header" }, [
          b("div", { class: "trace-name-col" }, " Operation "),
          b("div", { class: "trace-bar-col" }, " Timeline "),
          b("div", { class: "trace-dur-col" }, " Duration ")
        ], -1)),
        (O(!0), j(Oe, null, et(e.spans, (v) => (O(), j("div", {
          key: v.spanId,
          class: "trace-row"
        }, [
          b("div", _I, [
            b("span", CI, P(v.serviceName), 1),
            b("span", MI, P(v.operationName), 1)
          ]),
          b("div", TI, [
            b("div", {
              class: "trace-bar",
              style: Ue({
                left: `${l(v)}%`,
                width: `${u(v)}%`,
                background: c[v.status ?? "unset"]
              })
            }, null, 4)
          ]),
          b("div", zI, P(r(v.duration)), 1)
        ]))), 128))
      ], 64))
    ]));
  }
}), XI = /* @__PURE__ */ Vn(DI, [["__scopeId", "data-v-0212681c"]]), JI = /* @__PURE__ */ ze({
  __name: "SimpleChart",
  props: {
    options: {},
    data: {}
  },
  setup(e) {
    const t = e, n = pe(), i = pe(null), a = pe({ width: 0, height: 0 });
    let l = null;
    function u() {
      i.value && (i.value.destroy(), i.value = null);
    }
    return pl(() => {
      l?.disconnect(), u();
    }), Ys((r) => {
      n.value && (l = new ResizeObserver((c) => {
        const { width: g, height: y } = c[0].contentRect;
        g > 0 && y > 0 && (a.value = { width: Math.floor(g), height: Math.floor(y) });
      }), l.observe(n.value), a.value = {
        width: Math.floor(n.value.getBoundingClientRect().width),
        height: Math.floor(n.value.getBoundingClientRect().height)
      }, r(() => {
        l?.disconnect();
      }));
    }), Ys((r) => {
      !n.value || a.value.width <= 0 || a.value.height <= 0 || (u(), i.value = new rn(
        { ...t.options, width: a.value.width, height: a.value.height },
        t.data,
        n.value
      ), r(() => {
        u();
      }));
    }), (r, c) => (O(), j("div", {
      ref_key: "containerRef",
      ref: n,
      class: "w-full h-full"
    }, null, 512));
  }
}), OI = { class: "kbd-key" }, PI = /* @__PURE__ */ ze({
  __name: "Kbd",
  props: {
    char: {}
  },
  setup(e) {
    return (t, n) => (O(), j("kbd", OI, [
      An(t.$slots, "default", {}, () => [
        ce(P(e.char), 1)
      ], !0)
    ]));
  }
}), eE = /* @__PURE__ */ Vn(PI, [["__scopeId", "data-v-94fb4749"]]), II = ["href", "target"], EI = {
  key: 1,
  class: "panel-links-icon",
  style: { cursor: "pointer" }
}, $I = { style: { "font-size": "10px", "margin-left": "2px" } }, AI = /* @__PURE__ */ ze({
  __name: "PanelLinksIcon",
  props: {
    panel: {}
  },
  setup(e) {
    return (t, n) => e.panel.links && e.panel.links.length > 0 ? (O(), Ce(f(Zn), {
      key: 0,
      title: e.panel.links.map((i) => i.title ?? i.url).join(", ")
    }, {
      default: q(() => [
        e.panel.links.length === 1 ? (O(), j("a", {
          key: 0,
          href: e.panel.links[0].url,
          target: e.panel.links[0].newTab ? "_blank" : "_self",
          class: "panel-links-icon",
          onClick: n[0] || (n[0] = Qn(() => {
          }, ["stop"]))
        }, [...n[1] || (n[1] = [
          b("span", {
            class: "i-mdi-link",
            style: { "font-size": "14px" }
          }, null, -1)
        ])], 8, II)) : (O(), j("span", EI, [
          n[2] || (n[2] = b("span", {
            class: "i-mdi-link-variant",
            style: { "font-size": "14px" }
          }, null, -1)),
          b("span", $I, P(e.panel.links.length), 1)
        ]))
      ]),
      _: 1
    }, 8, ["title"])) : be("", !0);
  }
}), tE = /* @__PURE__ */ Vn(AI, [["__scopeId", "data-v-6925a5a2"]]), NI = { class: "viz-picker" }, RI = { class: "viz-picker-title" }, LI = { class: "viz-picker-grid" }, qI = ["onClick"], FI = { class: "viz-picker-label" }, VI = /* @__PURE__ */ ze({
  __name: "VizPickerPane",
  setup(e) {
    const { t } = st(), { panel: n, onChange: i } = uo(), a = [
      { type: "timeseries", icon: De.chartLine, labelKey: "config.type.timeseries" },
      { type: "bar", icon: De.chartBar, labelKey: "config.type.bar" },
      { type: "stat", icon: De.stat, labelKey: "config.type.stat" },
      { type: "gauge", icon: De.gauge, labelKey: "config.type.gauge" },
      { type: "pie", icon: De.chartPie, labelKey: "config.type.pie" },
      { type: "table", icon: De.table, labelKey: "config.type.table" },
      { type: "histogram", icon: De.chartArea, labelKey: "config.type.histogram" }
    ];
    return (l, u) => (O(), j("div", NI, [
      b("div", RI, P(f(t)("editor.vizPicker.title")), 1),
      b("div", LI, [
        (O(), j(Oe, null, et(a, (r) => b("button", {
          key: r.type,
          class: Re(["viz-picker-item", { "viz-picker-item--active": f(n).type === r.type }]),
          onClick: (c) => f(i)({ type: r.type })
        }, [
          b("span", {
            class: Re(["viz-picker-icon", [r.icon]])
          }, null, 2),
          b("span", FI, P(f(t)(r.labelKey)), 1)
        ], 10, qI)), 64))
      ])
    ]));
  }
}), nE = /* @__PURE__ */ Vn(VI, [["__scopeId", "data-v-1d0d144f"]]);
export {
  _D as AddPanelModal,
  up as AgChart,
  KI as ArgusBoard,
  $O as ArgusQueryEditor,
  DD as DashboardHeader,
  LD as DashboardPage,
  eE as Kbd,
  ZI as LogViewer,
  YO as MockQueryEditor,
  Df as PanelContainer,
  uD as PanelEditorLayout,
  fD as PanelEditorModal,
  tE as PanelLinksIcon,
  Lu as PanelRenderer,
  QI as ServiceTopology,
  JI as SimpleChart,
  cp as TimeRangePicker,
  XI as TraceWaterfall,
  rp as UPlotChart,
  dp as VariableBar,
  $z as VariableConfigModal,
  nE as VizPickerPane,
  Fp as provideArgusBoardConfig,
  mT as providePlotContext,
  sI as registerAllPlugins,
  no as useArgusBoardConfig,
  GI as usePlotContext
};
