import { inject as vl, ref as fe, provide as yl, readonly as Md, computed as re, defineComponent as ze, shallowRef as Ku, reactive as bl, toRef as Td, onBeforeMount as Xu, onMounted as In, watchEffect as wa, onBeforeUnmount as no, watch as Fe, openBlock as E, createElementBlock as B, normalizeStyle as He, normalizeClass as Ae, renderSlot as zi, createCommentVNode as ye, unref as d, getCurrentScope as Pd, onScopeDispose as $d, nextTick as zn, toRefs as ir, Fragment as Pe, renderList as Xe, createBlock as Ce, mergeProps as Ed, withCtx as R, withDirectives as Qu, createVNode as k, vShow as Ju, getCurrentInstance as Id, onUnmounted as Ui, useSlots as Ad, createElementVNode as m, resolveComponent as lt, toDisplayString as I, createTextVNode as ce, resolveDynamicComponent as Zu, withModifiers as $n, Teleport as Od, toRaw as Za, h as Mn, toValue as Dd } from "vue";
import { merge as qd } from "lodash-es";
import { defineStore as Ns } from "pinia";
import { Input as Ze, InputNumber as on, Slider as bn, Select as Qe, Button as tt, Radio as es, Space as Wl, Collapse as Sa, Tooltip as Pn, Dropdown as Vo, Menu as ii, Spin as Jn, DatePicker as Ld, Checkbox as Gi, Form as Rd, Modal as Ul, Tag as Kl, Switch as ki, Divider as Nd, Popover as Vd, Drawer as Fd, Row as Bd, Col as Hd, Card as Wd, App as ec, theme as lr, ConfigProvider as jd, Layout as or } from "ant-design-vue";
import ar from "dayjs";
const Gd = {
  "common.auto": "Auto",
  "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",
  "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",
  "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",
  "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.general.description": "Description",
  "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"
}, tc = {
  "panel.noData": "暂无数据",
  "common.auto": "自动",
  "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": "删除",
  "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": "刷新",
  "variable.modal.placeholder": '点击左侧"新增变量"开始配置',
  "variable.custom.title": "自定义选项",
  "variable.custom.add": "添加选项",
  "variable.custom.allValue": "全部值",
  "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.general.description": "描述",
  "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": "数量限制"
}, Yd = { zh: tc, en: Gd }, nc = Symbol("lang");
function Ud(e) {
  yl(nc, e);
}
function ot() {
  const e = vl(nc, fe("zh"));
  function t(n, i) {
    let r = Yd[e.value][n] ?? tc[n] ?? n;
    if (i)
      for (const [f, u] of Object.entries(i))
        r = r.replace(`{${f}}`, String(u));
    return r;
  }
  return { t, lang: e };
}
const Kd = {
  hideHeader: !1,
  canEdit: !0,
  theme: null,
  lang: null,
  isEditing: null,
  initialEditingPanelId: null,
  datasourceConfig: null
}, ic = Symbol("argusBoardConfig");
function lc(e) {
  return { config: Md(fe(e)) };
}
function Xd(e) {
  const t = lc(e);
  return yl(ic, t), t;
}
function Fo() {
  const e = vl(ic);
  return e || lc(Kd);
}
async function Qd(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 Jd(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 ?? [];
}
var bs = /* @__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))(bs || {});
function Zd(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function ka(e) {
  "@babel/helpers - typeof";
  return ka = 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;
  }, ka(e);
}
var ef = /^\s+/, tf = /\s+$/;
function Ne(e, t) {
  if (e = e || "", t = t || {}, e instanceof Ne)
    return e;
  if (!(this instanceof Ne))
    return new Ne(e, t);
  var n = nf(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;
}
Ne.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, r, f, u;
    return n = t.r / 255, i = t.g / 255, a = t.b / 255, n <= 0.03928 ? r = n / 12.92 : r = Math.pow((n + 0.055) / 1.055, 2.4), i <= 0.03928 ? f = i / 12.92 : f = Math.pow((i + 0.055) / 1.055, 2.4), a <= 0.03928 ? u = a / 12.92 : u = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * r + 0.7152 * f + 0.0722 * u;
  },
  setAlpha: function(t) {
    return this._a = oc(t), this._roundA = Math.round(100 * this._a) / 100, this;
  },
  toHsv: function() {
    var t = rr(this._r, this._g, this._b);
    return {
      h: t.h * 360,
      s: t.s,
      v: t.v,
      a: this._a
    };
  },
  toHsvString: function() {
    var t = rr(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 = sr(this._r, this._g, this._b);
    return {
      h: t.h * 360,
      s: t.s,
      l: t.l,
      a: this._a
    };
  },
  toHslString: function() {
    var t = sr(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 ur(this._r, this._g, this._b, t);
  },
  toHexString: function(t) {
    return "#" + this.toHex(t);
  },
  toHex8: function(t) {
    return sf(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(qt(this._r, 255) * 100) + "%",
      g: Math.round(qt(this._g, 255) * 100) + "%",
      b: Math.round(qt(this._b, 255) * 100) + "%",
      a: this._a
    };
  },
  toPercentageRgbString: function() {
    return this._a == 1 ? "rgb(" + Math.round(qt(this._r, 255) * 100) + "%, " + Math.round(qt(this._g, 255) * 100) + "%, " + Math.round(qt(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(qt(this._r, 255) * 100) + "%, " + Math.round(qt(this._g, 255) * 100) + "%, " + Math.round(qt(this._b, 255) * 100) + "%, " + this._roundA + ")";
  },
  toName: function() {
    return this._a === 0 ? "transparent" : this._a < 1 ? !1 : bf[ur(this._r, this._g, this._b, !0)] || !1;
  },
  toFilter: function(t) {
    var n = "#" + cr(this._r, this._g, this._b, this._a), i = n, a = this._gradientType ? "GradientType = 1, " : "";
    if (t) {
      var r = Ne(t);
      i = "#" + cr(r._r, r._g, r._b, r._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, r = !n && a && (t === "hex" || t === "hex6" || t === "hex3" || t === "hex4" || t === "hex8" || t === "name");
    return r ? 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 Ne(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(df, arguments);
  },
  brighten: function() {
    return this._applyModification(ff, arguments);
  },
  darken: function() {
    return this._applyModification(hf, arguments);
  },
  desaturate: function() {
    return this._applyModification(rf, arguments);
  },
  saturate: function() {
    return this._applyModification(uf, arguments);
  },
  greyscale: function() {
    return this._applyModification(cf, arguments);
  },
  spin: function() {
    return this._applyModification(gf, arguments);
  },
  _applyCombination: function(t, n) {
    return t.apply(null, [this].concat([].slice.call(n)));
  },
  analogous: function() {
    return this._applyCombination(vf, arguments);
  },
  complement: function() {
    return this._applyCombination(pf, arguments);
  },
  monochromatic: function() {
    return this._applyCombination(yf, arguments);
  },
  splitcomplement: function() {
    return this._applyCombination(mf, arguments);
  },
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
  // polyad: function (number) {
  //   return this._applyCombination(polyad, [number]);
  // },
  triad: function() {
    return this._applyCombination(dr, [3]);
  },
  tetrad: function() {
    return this._applyCombination(dr, [4]);
  }
};
Ne.fromRatio = function(e, t) {
  if (ka(e) == "object") {
    var n = {};
    for (var i in e)
      e.hasOwnProperty(i) && (i === "a" ? n[i] = e[i] : n[i] = _o(e[i]));
    e = n;
  }
  return Ne(e, t);
};
function nf(e) {
  var t = {
    r: 0,
    g: 0,
    b: 0
  }, n = 1, i = null, a = null, r = null, f = !1, u = !1;
  return typeof e == "string" && (e = kf(e)), ka(e) == "object" && (wi(e.r) && wi(e.g) && wi(e.b) ? (t = lf(e.r, e.g, e.b), f = !0, u = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : wi(e.h) && wi(e.s) && wi(e.v) ? (i = _o(e.s), a = _o(e.v), t = af(e.h, i, a), f = !0, u = "hsv") : wi(e.h) && wi(e.s) && wi(e.l) && (i = _o(e.s), r = _o(e.l), t = of(e.h, i, r), f = !0, u = "hsl"), e.hasOwnProperty("a") && (n = e.a)), n = oc(n), {
    ok: f,
    format: e.format || u,
    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 lf(e, t, n) {
  return {
    r: qt(e, 255) * 255,
    g: qt(t, 255) * 255,
    b: qt(n, 255) * 255
  };
}
function sr(e, t, n) {
  e = qt(e, 255), t = qt(t, 255), n = qt(n, 255);
  var i = Math.max(e, t, n), a = Math.min(e, t, n), r, f, u = (i + a) / 2;
  if (i == a)
    r = f = 0;
  else {
    var c = i - a;
    switch (f = u > 0.5 ? c / (2 - i - a) : c / (i + a), i) {
      case e:
        r = (t - n) / c + (t < n ? 6 : 0);
        break;
      case t:
        r = (n - e) / c + 2;
        break;
      case n:
        r = (e - t) / c + 4;
        break;
    }
    r /= 6;
  }
  return {
    h: r,
    s: f,
    l: u
  };
}
function of(e, t, n) {
  var i, a, r;
  e = qt(e, 360), t = qt(t, 100), n = qt(n, 100);
  function f(p, y, b) {
    return b < 0 && (b += 1), b > 1 && (b -= 1), b < 1 / 6 ? p + (y - p) * 6 * b : b < 1 / 2 ? y : b < 2 / 3 ? p + (y - p) * (2 / 3 - b) * 6 : p;
  }
  if (t === 0)
    i = a = r = n;
  else {
    var u = n < 0.5 ? n * (1 + t) : n + t - n * t, c = 2 * n - u;
    i = f(c, u, e + 1 / 3), a = f(c, u, e), r = f(c, u, e - 1 / 3);
  }
  return {
    r: i * 255,
    g: a * 255,
    b: r * 255
  };
}
function rr(e, t, n) {
  e = qt(e, 255), t = qt(t, 255), n = qt(n, 255);
  var i = Math.max(e, t, n), a = Math.min(e, t, n), r, f, u = i, c = i - a;
  if (f = i === 0 ? 0 : c / i, i == a)
    r = 0;
  else {
    switch (i) {
      case e:
        r = (t - n) / c + (t < n ? 6 : 0);
        break;
      case t:
        r = (n - e) / c + 2;
        break;
      case n:
        r = (e - t) / c + 4;
        break;
    }
    r /= 6;
  }
  return {
    h: r,
    s: f,
    v: u
  };
}
function af(e, t, n) {
  e = qt(e, 360) * 6, t = qt(t, 100), n = qt(n, 100);
  var i = Math.floor(e), a = e - i, r = n * (1 - t), f = n * (1 - a * t), u = n * (1 - (1 - a) * t), c = i % 6, p = [n, f, r, r, u, n][c], y = [u, n, n, f, r, r][c], b = [r, r, u, n, n, f][c];
  return {
    r: p * 255,
    g: y * 255,
    b: b * 255
  };
}
function ur(e, t, n, i) {
  var a = [ni(Math.round(e).toString(16)), ni(Math.round(t).toString(16)), ni(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 sf(e, t, n, i, a) {
  var r = [ni(Math.round(e).toString(16)), ni(Math.round(t).toString(16)), ni(Math.round(n).toString(16)), ni(ac(i))];
  return a && r[0].charAt(0) == r[0].charAt(1) && r[1].charAt(0) == r[1].charAt(1) && r[2].charAt(0) == r[2].charAt(1) && r[3].charAt(0) == r[3].charAt(1) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) + r[3].charAt(0) : r.join("");
}
function cr(e, t, n, i) {
  var a = [ni(ac(i)), ni(Math.round(e).toString(16)), ni(Math.round(t).toString(16)), ni(Math.round(n).toString(16))];
  return a.join("");
}
Ne.equals = function(e, t) {
  return !e || !t ? !1 : Ne(e).toRgbString() == Ne(t).toRgbString();
};
Ne.random = function() {
  return Ne.fromRatio({
    r: Math.random(),
    g: Math.random(),
    b: Math.random()
  });
};
function rf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.s -= t / 100, n.s = Pa(n.s), Ne(n);
}
function uf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.s += t / 100, n.s = Pa(n.s), Ne(n);
}
function cf(e) {
  return Ne(e).desaturate(100);
}
function df(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.l += t / 100, n.l = Pa(n.l), Ne(n);
}
function ff(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(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)))), Ne(n);
}
function hf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.l -= t / 100, n.l = Pa(n.l), Ne(n);
}
function gf(e, t) {
  var n = Ne(e).toHsl(), i = (n.h + t) % 360;
  return n.h = i < 0 ? 360 + i : i, Ne(n);
}
function pf(e) {
  var t = Ne(e).toHsl();
  return t.h = (t.h + 180) % 360, Ne(t);
}
function dr(e, t) {
  if (isNaN(t) || t <= 0)
    throw new Error("Argument to polyad must be a positive number");
  for (var n = Ne(e).toHsl(), i = [Ne(e)], a = 360 / t, r = 1; r < t; r++)
    i.push(Ne({
      h: (n.h + r * a) % 360,
      s: n.s,
      l: n.l
    }));
  return i;
}
function mf(e) {
  var t = Ne(e).toHsl(), n = t.h;
  return [Ne(e), Ne({
    h: (n + 72) % 360,
    s: t.s,
    l: t.l
  }), Ne({
    h: (n + 216) % 360,
    s: t.s,
    l: t.l
  })];
}
function vf(e, t, n) {
  t = t || 6, n = n || 30;
  var i = Ne(e).toHsl(), a = 360 / n, r = [Ne(e)];
  for (i.h = (i.h - (a * t >> 1) + 720) % 360; --t; )
    i.h = (i.h + a) % 360, r.push(Ne(i));
  return r;
}
function yf(e, t) {
  t = t || 6;
  for (var n = Ne(e).toHsv(), i = n.h, a = n.s, r = n.v, f = [], u = 1 / t; t--; )
    f.push(Ne({
      h: i,
      s: a,
      v: r
    })), r = (r + u) % 1;
  return f;
}
Ne.mix = function(e, t, n) {
  n = n === 0 ? 0 : n || 50;
  var i = Ne(e).toRgb(), a = Ne(t).toRgb(), r = n / 100, f = {
    r: (a.r - i.r) * r + i.r,
    g: (a.g - i.g) * r + i.g,
    b: (a.b - i.b) * r + i.b,
    a: (a.a - i.a) * r + i.a
  };
  return Ne(f);
};
Ne.readability = function(e, t) {
  var n = Ne(e), i = Ne(t);
  return (Math.max(n.getLuminance(), i.getLuminance()) + 0.05) / (Math.min(n.getLuminance(), i.getLuminance()) + 0.05);
};
Ne.isReadable = function(e, t, n) {
  var i = Ne.readability(e, t), a, r;
  switch (r = !1, a = Cf(n), a.level + a.size) {
    case "AAsmall":
    case "AAAlarge":
      r = i >= 4.5;
      break;
    case "AAlarge":
      r = i >= 3;
      break;
    case "AAAsmall":
      r = i >= 7;
      break;
  }
  return r;
};
Ne.mostReadable = function(e, t, n) {
  var i = null, a = 0, r, f, u, c;
  n = n || {}, f = n.includeFallbackColors, u = n.level, c = n.size;
  for (var p = 0; p < t.length; p++)
    r = Ne.readability(e, t[p]), r > a && (a = r, i = Ne(t[p]));
  return Ne.isReadable(e, i, {
    level: u,
    size: c
  }) || !f ? i : (n.includeFallbackColors = !1, Ne.mostReadable(e, ["#fff", "#000"], n));
};
var xs = Ne.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"
}, bf = Ne.hexNames = xf(xs);
function xf(e) {
  var t = {};
  for (var n in e)
    e.hasOwnProperty(n) && (t[e[n]] = n);
  return t;
}
function oc(e) {
  return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
}
function qt(e, t) {
  wf(e) && (e = "100%");
  var n = Sf(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 Pa(e) {
  return Math.min(1, Math.max(0, e));
}
function Cn(e) {
  return parseInt(e, 16);
}
function wf(e) {
  return typeof e == "string" && e.indexOf(".") != -1 && parseFloat(e) === 1;
}
function Sf(e) {
  return typeof e == "string" && e.indexOf("%") != -1;
}
function ni(e) {
  return e.length == 1 ? "0" + e : "" + e;
}
function _o(e) {
  return e <= 1 && (e = e * 100 + "%"), e;
}
function ac(e) {
  return Math.round(parseFloat(e) * 255).toString(16);
}
function fr(e) {
  return Cn(e) / 255;
}
var Xn = (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 wi(e) {
  return !!Xn.CSS_UNIT.exec(e);
}
function kf(e) {
  e = e.replace(ef, "").replace(tf, "").toLowerCase();
  var t = !1;
  if (xs[e])
    e = xs[e], t = !0;
  else if (e == "transparent")
    return {
      r: 0,
      g: 0,
      b: 0,
      a: 0,
      format: "name"
    };
  var n;
  return (n = Xn.rgb.exec(e)) ? {
    r: n[1],
    g: n[2],
    b: n[3]
  } : (n = Xn.rgba.exec(e)) ? {
    r: n[1],
    g: n[2],
    b: n[3],
    a: n[4]
  } : (n = Xn.hsl.exec(e)) ? {
    h: n[1],
    s: n[2],
    l: n[3]
  } : (n = Xn.hsla.exec(e)) ? {
    h: n[1],
    s: n[2],
    l: n[3],
    a: n[4]
  } : (n = Xn.hsv.exec(e)) ? {
    h: n[1],
    s: n[2],
    v: n[3]
  } : (n = Xn.hsva.exec(e)) ? {
    h: n[1],
    s: n[2],
    v: n[3],
    a: n[4]
  } : (n = Xn.hex8.exec(e)) ? {
    r: Cn(n[1]),
    g: Cn(n[2]),
    b: Cn(n[3]),
    a: fr(n[4]),
    format: t ? "name" : "hex8"
  } : (n = Xn.hex6.exec(e)) ? {
    r: Cn(n[1]),
    g: Cn(n[2]),
    b: Cn(n[3]),
    format: t ? "name" : "hex"
  } : (n = Xn.hex4.exec(e)) ? {
    r: Cn(n[1] + "" + n[1]),
    g: Cn(n[2] + "" + n[2]),
    b: Cn(n[3] + "" + n[3]),
    a: fr(n[4] + "" + n[4]),
    format: t ? "name" : "hex8"
  } : (n = Xn.hex3.exec(e)) ? {
    r: Cn(n[1] + "" + n[1]),
    g: Cn(n[2] + "" + n[2]),
    b: Cn(n[3] + "" + n[3]),
    format: t ? "name" : "hex"
  } : !1;
}
function Cf(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 _f(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 sc = /* @__PURE__ */ new Map();
function ts(e) {
  sc.set(e.type, e);
}
function ws(e) {
  return sc.get(e);
}
const hr = [
  "api-gateway",
  "auth-service",
  "payment-service",
  "user-service",
  "notification-service",
  "order-service",
  "inventory-service",
  "search-service"
];
function ns(e) {
  let t = e;
  return () => (t = (t * 16807 + 0) % 2147483647, t / 2147483647);
}
function zf(e, t, n, i, a) {
  const r = n ^ Math.floor(Date.now() / 5e3) * 2654435761, f = ns(n), u = ns(r);
  if (e === "random-walk") {
    const c = ns((n + Date.now()) % 2147483647), p = a + i * 0.5, y = a * 0.1, b = a + i * 1.8, v = [p];
    for (let C = 1; C < t; C++) {
      const z = v[C - 1], T = (p - z) * 0.05, q = (c() - 0.5) * i * 0.08 + T;
      v.push(Math.max(y, Math.min(b, z + q)));
    }
    return v;
  }
  return Array.from({ length: t }, (c, p) => {
    const y = p / t;
    let b;
    switch (e) {
      case "sine":
        b = a + Math.sin(y * Math.PI * 4 + n) * i + (f() - 0.5) * i * 0.2;
        break;
      case "spike": {
        const C = [0.2, 0.5, 0.8].reduce(
          (z, T) => z + Math.exp(-((y - T) ** 2) / 1e-3) * i * 2,
          0
        );
        b = a + C + (f() - 0.5) * i * 0.15;
        break;
      }
      case "step":
        b = a + Math.floor(y * 5) % 3 * i * 0.5 + (f() - 0.5) * i * 0.1;
        break;
      case "sawtooth":
        b = a + y * 3 % 1 * i + (f() - 0.5) * i * 0.15;
        break;
      case "noise":
        b = a + f() * i;
        break;
      case "trend-up":
        b = a + y * i * 1.5 + Math.sin(y * 10) * i * 0.2 + (f() - 0.5) * i * 0.1;
        break;
      case "trend-down":
        b = a + (1 - y) * i * 1.5 + Math.sin(y * 8) * i * 0.15 + (f() - 0.5) * i * 0.1;
        break;
      case "plateau": {
        const z = y < 0.3 ? y / 0.3 : y > 0.7 ? (1 - y) / 0.30000000000000004 : 1;
        b = a + z * i + (f() - 0.5) * i * 0.1;
        break;
      }
      case "live": {
        if (y < 0.9)
          b = a + Math.sin(y * Math.PI * 4 + n) * i * 0.6 + (f() - 0.5) * i * 0.1;
        else {
          const C = (y - 0.9) / 0.09999999999999998;
          b = a + Math.sin(0.9 * Math.PI * 4 + n) * i * 0.6 + (u() - 0.5) * i * 0.4 * C * 2;
        }
        break;
      }
      default:
        b = a;
    }
    return Math.max(0, b);
  });
}
function Vl(e, t = 15, n = 3, i = "sine", a) {
  const r = [];
  for (let u = e.from; u <= e.to; u += t)
    r.push(u);
  const f = Array.from({ length: n }, (u, c) => {
    const p = 20 + (c * 37 + 13) % 60, y = 10 + (c * 53 + 7) % 40, b = zf(i, r.length, c * 1e3 + 42, p, y);
    return {
      label: a?.[c] ?? hr[c % hr.length],
      values: b
    };
  });
  return { timestamps: r, series: f };
}
function Mf(e, t, n, i) {
  const r = ((n + i) / 2 - e) * 0.05, f = (Math.random() - 0.5) * t * 0.08 + r;
  return Math.max(n, Math.min(i, e + f));
}
class Tf {
  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 } = t, a = i.filter((r) => r).map((r) => {
      const { timestamps: f, series: u } = Vl(
        { from: n.from / 1e3, to: n.to / 1e3 },
        15,
        r.seriesCount,
        r.pattern,
        r.labels
      ), c = f.map((y) => y * 1e3), p = [
        { name: "Time", type: bs.time, values: c, config: {} },
        ...u.map((y) => ({
          name: y.label,
          type: bs.number,
          values: y.values,
          config: { displayNameFromDS: y.label }
        }))
      ];
      return _f({ name: r.metric, refId: "A", fields: p });
    });
    return Promise.resolve({ data: a, state: "Done" });
  }
}
const ji = [
  "#4096ff",
  "#52c41a",
  "#faad14",
  "#ff4d4f",
  "#722ed1",
  "#13c2c2",
  "#eb2f96",
  "#fa8c16",
  "#a0d911",
  "#1677ff",
  "#2f54eb",
  "#f5222d",
  "#fadb14",
  "#7cb305",
  "#08979c",
  "#531dab",
  "#c41d7f",
  "#d4380d",
  "#d48806",
  "#389e0d"
];
function Si(e, t) {
  if (e.length < 2 || t < 2)
    return [...e];
  const n = (r) => [
    Number.parseInt(r.slice(1, 3), 16),
    Number.parseInt(r.slice(3, 5), 16),
    Number.parseInt(r.slice(5, 7), 16)
  ], i = (r) => Math.round(Math.max(0, Math.min(255, r))).toString(16).padStart(2, "0"), a = e.length - 1;
  return Array.from({ length: t }, (r, f) => {
    const u = f / (t - 1) * a, c = Math.min(Math.floor(u), a - 1), p = u - c, [y, b, v] = n(e[c]), [C, z, T] = n(e[c + 1]);
    return `#${i(y + (C - y) * p)}${i(b + (z - b) * p)}${i(v + (T - v) * p)}`;
  });
}
const Nn = {
  classic: ji,
  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: Si(["#cfe2f3", "#9fc5e8", "#3d85c8", "#0b5394", "#041d3a"], 16),
  reds: Si(["#fce5cd", "#f6b26b", "#e06666", "#cc0000", "#660000"], 16),
  GrYlRd: Si(
    ["#37872d", "#96d98d", "#fee520", "#ff780a", "#f2495c", "#8f3bb8"],
    16
  ),
  "purple-orange": Si(
    ["#7b2d8b", "#d45087", "#ff7c43", "#ffa600", "#f0e442", "#b3de69"],
    16
  ),
  "green-yellow-red": Si(
    ["#1a9850", "#a6d96a", "#fee08b", "#fdae61", "#d73027"],
    16
  ),
  "red-yellow-green": Si(
    ["#d73027", "#fdae61", "#fee08b", "#a6d96a", "#1a9850"],
    16
  ),
  "blue-yellow-red": Si(
    ["#2166ac", "#92c5de", "#d1e5f0", "#fddbc7", "#f4a582", "#b2182b"],
    16
  ),
  "blue-purple": Si(
    ["#045a8d", "#74a9cf", "#ccebc5", "#9ebcda", "#8856a7", "#810f7c"],
    16
  ),
  "yellow-blue": Si(["#ffffd9", "#c7e9b4", "#41b6c4", "#225ea8", "#0c2c84"], 16)
};
function Pf(e) {
  return !e || e === "classic" ? ji : Nn[e] ?? ji;
}
function $f(e, t, n = "sequential", i) {
  if (t === 0)
    return [];
  if (e === "fixed") {
    const r = i ?? ji[0];
    return Array.from({ length: t }, () => r);
  }
  if (e === "thresholds")
    return [];
  const a = Pf(e);
  return n === "distributed" && t > 1 ? Array.from({ length: t }, (r, f) => {
    const u = Math.round(f * (a.length - 1) / (t - 1));
    return a[u];
  }) : Array.from({ length: t }, (r, f) => a[f % a.length]);
}
const _t = {
  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 Ef = 0;
function Ss() {
  return `panel-${Date.now()}-${++Ef}`;
}
function Fn(e) {
  return [{ id: "A", enabled: !0, dataSource: e }];
}
const If = {
  timeseries: {
    queries: Fn({
      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: Fn({
      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: Fn({ 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: Fn({
      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: Fn({ 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: Fn({ 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: Fn({
      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 rc(e, t) {
  const n = t?.id ?? Ss();
  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
  }, ...If[e], ...t, id: n };
}
function uc() {
  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: Fn({
          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: Fn({
          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: Fn({
          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: Fn({
          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: Fn({
          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 = rc(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 Af() {
  return JSON.stringify(uc(), null, 2);
}
const cc = /* @__PURE__ */ new Map();
function al(e) {
  cc.set(e.meta.type, e);
}
function Of(e) {
  return cc.get(e);
}
const Df = {
  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 }
  ]
}, qf = {
  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 }
  ]
}, Lf = {
  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 }
  ]
}, Rf = {
  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 }
  ]
}, Nf = {
  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 }
  ]
}, Vf = {
  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 }
  ]
}, Ff = {
  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 Bf() {
  al(Ff), al(Df), al(Lf), al(Nf), al(qf), al(Vf), al(Rf);
}
function zo(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, r) => a + r, 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, r) => a + r, 0);
    case "count":
      return i.length;
    default:
      return i.length > 0 ? i[i.length - 1] ?? 0 : 0;
  }
}
function aa(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 $a {
  constructor(t) {
    this.props = t;
  }
}
var dc = /* @__PURE__ */ ((e) => (e.LOCAL_STORAGE = "LOCAL_STORAGE", e.IN_MEMORY = "IN_MEMORY", e))(dc || {}), jl = /* @__PURE__ */ ((e) => (e.Linear = "linear", e.Logarithmic = "logarithmic", e.Symlog = "symlog", e))(jl || {}), Fl = /* @__PURE__ */ ((e) => (e.Lines = "lines", e.Bars = "bars", e.Points = "points", e.Histogram = "histogram", e))(Fl || {}), va = /* @__PURE__ */ ((e) => (e.Linear = "linear", e.Smooth = "smooth", e.StepBefore = "stepBefore", e.StepAfter = "stepAfter", e))(va || {}), ks = /* @__PURE__ */ ((e) => (e.Solid = "solid", e.Dashed = "dashed", e.Dotted = "dotted", e))(ks || {}), Cs = /* @__PURE__ */ ((e) => (e.None = "none", e.Solid = "solid", e.Gradient = "gradient", e))(Cs || {});
class Hf extends $a {
  getConfig() {
    const {
      scaleKey: t,
      label: n,
      show: i = !0,
      side: a = 2,
      space: r,
      gap: f = 5
    } = this.props, u = this.buildGridConfig(), c = this.buildTicksConfig(), p = this.buildValuesFormatter(), y = this.buildStrokeColor(), b = {
      scale: t,
      show: i,
      side: a
    };
    return n && (b.label = n), y && (b.stroke = y), u && (b.grid = u), c && (b.ticks = c), p && (b.values = p), f !== void 0 && (b.gap = f), r !== void 0 && (b.space = r), b;
  }
  buildGridConfig() {
    const { grid: t, isDarkMode: n, isLogScale: i } = this.props, a = n ? "#444" : "#E8E9EA", r = i ? 0.1 : 0.2;
    return t ? {
      stroke: t.stroke ?? a,
      width: t.width ?? r,
      show: t.show ?? !0
    } : {
      stroke: a,
      width: r,
      show: !0
    };
  }
  buildTicksConfig() {
    const { ticks: t } = this.props;
    return t || { width: 0.3, show: !0 };
  }
  buildValuesFormatter() {
    const { values: t, scaleKey: n, yAxisUnit: i, decimalPrecision: a } = this.props;
    if (t)
      return t;
    if (n === "x")
      return this.props.isTimeAxis === !1 ? void 0 : (r, f) => f.map((u) => {
        if (u == null || Number.isNaN(u))
          return "";
        const c = new Date(u * 1e3);
        return `${c.getHours().toString().padStart(2, "0")}:${c.getMinutes().toString().padStart(2, "0")}`;
      });
    if (n === "y" && i)
      return (r, f) => f.map((u) => u == null || Number.isNaN(u) ? "" : u.toFixed(a ?? 1));
  }
  buildStrokeColor() {
    const { stroke: t, isDarkMode: n } = this.props;
    if (t !== void 0)
      return t;
    if (n !== void 0)
      return n ? "white" : "black";
  }
  merge(t) {
    this.props = { ...this.props, ...t };
  }
}
class Wf extends $a {
  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,
      logBase: a = 10,
      padMinBy: r = 0,
      padMaxBy: f = 0.05
    } = this.props;
    if (n) {
      if (this.min != null && this.max != null) {
        const T = this.min;
        let q = this.max;
        const Q = new Date(q * 1e3);
        return Q.setSeconds(0), Q.setMilliseconds(0), q = Math.floor(Q.getTime() / 1e3) + 60, {
          [t]: {
            time: !0,
            auto: !1,
            range: [T, q]
          }
        };
      }
      return {
        [t]: {
          time: !0,
          auto: !0
        }
      };
    }
    const u = this.props.distribution, c = u === jl.Logarithmic ? { distr: 2, log: a } : u === jl.Symlog ? { distr: 3, log: a } : {}, p = this.min != null || this.max != null, y = this.softMin, b = this.softMax;
    let v;
    p ? v = () => [
      this.min ?? y ?? 0,
      this.max ?? b ?? 100
    ] : v = (z, T, q) => {
      const Q = y != null ? Math.min(y, T) : T, F = b != null ? Math.max(b, q) : q, U = (F - Q) * f;
      return [Q - r * (F - Q), F + U];
    };
    let C = this.props.auto;
    return C ??= !n && !p, {
      [t]: {
        time: n,
        auto: C,
        range: i ?? v,
        ...c
      }
    };
  }
  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 jf = !0, nn = "u-", Gf = "uplot", Yf = nn + "hz", Uf = nn + "vt", Kf = nn + "title", Xf = nn + "wrap", Qf = nn + "under", Jf = nn + "over", Zf = nn + "axis", hl = nn + "off", eh = nn + "select", th = nn + "cursor-x", nh = nn + "cursor-y", ih = nn + "cursor-pt", lh = nn + "legend", oh = nn + "live", ah = nn + "inline", sh = nn + "series", rh = nn + "marker", gr = nn + "label", uh = nn + "value", Mo = "width", To = "height", So = "top", pr = "bottom", Ll = "left", is = "right", Vs = "#000", mr = Vs + "0", vr = "mousemove", yr = "mousedown", ls = "mouseup", br = "mouseenter", xr = "mouseleave", wr = "dblclick", ch = "resize", dh = "scroll", Sr = "change", Ca = "dppxchange", Fs = "--", io = typeof window < "u", _s = io ? document : null, Gl = io ? window : null, fh = io ? navigator : null;
let gt, sa;
function zs() {
  let e = devicePixelRatio;
  gt != e && (gt = e, sa && Ts(Sr, sa, zs), sa = matchMedia(`(min-resolution: ${gt - 1e-3}dppx) and (max-resolution: ${gt + 1e-3}dppx)`), gl(Sr, sa, zs), Gl.dispatchEvent(new CustomEvent(Ca)));
}
function _n(e, t) {
  if (t != null) {
    let n = e.classList;
    !n.contains(t) && n.add(t);
  }
}
function Ms(e, t) {
  let n = e.classList;
  n.contains(t) && n.remove(t);
}
function Et(e, t, n) {
  e.style[t] = n + "px";
}
function Qn(e, t, n, i) {
  let a = _s.createElement(e);
  return t != null && _n(a, t), n?.insertBefore(a, i), a;
}
function Vn(e, t) {
  return Qn("div", e, t);
}
const kr = /* @__PURE__ */ new WeakMap();
function ci(e, t, n, i, a) {
  let r = "translate(" + t + "px," + n + "px)", f = kr.get(e);
  r != f && (e.style.transform = r, kr.set(e, r), t < 0 || n < 0 || t > i || n > a ? _n(e, hl) : Ms(e, hl));
}
const Cr = /* @__PURE__ */ new WeakMap();
function _r(e, t, n) {
  let i = t + n, a = Cr.get(e);
  i != a && (Cr.set(e, i), e.style.background = t, e.style.borderColor = n);
}
const zr = /* @__PURE__ */ new WeakMap();
function Mr(e, t, n, i) {
  let a = t + "" + n, r = zr.get(e);
  a != r && (zr.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 Bs = { passive: !0 }, hh = { ...Bs, capture: !0 };
function gl(e, t, n, i) {
  t.addEventListener(e, n, i ? hh : Bs);
}
function Ts(e, t, n, i) {
  t.removeEventListener(e, n, Bs);
}
io && zs();
function ei(e, t, n, i) {
  let a;
  n = n || 0, i = i || t.length - 1;
  let r = i <= 2147483647;
  for (; i - n > 1; )
    a = r ? n + i >> 1 : En((n + i) / 2), t[a] < e ? n = a : i = a;
  return e - t[n] <= t[i] - e ? n : i;
}
function Xl(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 gh(e, t, n, i) {
  let a = st, r = -st;
  if (i == 1)
    a = e[t], r = e[n];
  else if (i == -1)
    a = e[n], r = e[t];
  else
    for (let f = t; f <= n; f++) {
      let u = e[f];
      u != null && (u < a && (a = u), u > r && (r = u));
    }
  return [a, r];
}
function ph(e, t, n) {
  let i = st, a = -st;
  for (let r = t; r <= n; r++) {
    let f = e[r];
    f != null && f > 0 && (f < i && (i = f), f > a && (a = f));
  }
  return [i, a];
}
function Ea(e, t, n, i) {
  let a = $r(e), r = $r(t);
  e == t && (a == -1 ? (e *= n, t /= n) : (e /= n, t *= n));
  let f = n == 10 ? Ci : fc, u = a == 1 ? En : Bn, c = r == 1 ? Bn : En, p = u(f(en(e))), y = c(f(en(t))), b = Ql(n, p), v = Ql(n, y);
  return n == 10 && (p < 0 && (b = zt(b, -p)), y < 0 && (v = zt(v, -y))), i || n == 2 ? (e = b * a, t = v * r) : (e = pc(e, b), t = Ia(t, v)), [e, t];
}
function Hs(e, t, n, i) {
  let a = Ea(e, t, n, i);
  return e == 0 && (a[0] = 0), t == 0 && (a[1] = 0), a;
}
const Ws = 0.1, Tr = {
  mode: 3,
  pad: Ws
}, Io = {
  pad: 0,
  soft: null,
  mode: 0
}, mh = {
  min: Io,
  max: Io
};
function _a(e, t, n, i) {
  return Aa(n) ? Pr(e, t, n) : (Io.pad = n, Io.soft = i ? 0 : null, Io.mode = i ? 3 : 0, Pr(e, t, mh));
}
function dt(e, t) {
  return e ?? t;
}
function vh(e, t, n) {
  for (t = dt(t, 0), n = dt(n, e.length - 1); t <= n; ) {
    if (e[t] != null)
      return !0;
    t++;
  }
  return !1;
}
function Pr(e, t, n) {
  let i = n.min, a = n.max, r = dt(i.pad, 0), f = dt(a.pad, 0), u = dt(i.hard, -st), c = dt(a.hard, st), p = dt(i.soft, st), y = dt(a.soft, -st), b = dt(i.mode, 0), v = dt(a.mode, 0), C = t - e, z = Ci(C), T = dn(en(e), en(t)), q = Ci(T), Q = en(q - z);
  (C < 1e-24 || Q > 10) && (C = 0, (e == 0 || t == 0) && (C = 1e-24, b == 2 && p != st && (r = 0), v == 2 && y != -st && (f = 0)));
  let F = C || T || 1e3, U = Ci(F), O = Ql(10, En(U)), W = F * (C == 0 ? e == 0 ? 0.1 : 1 : r), te = zt(pc(e - W, O / 10), 24), M = e >= p && (b == 1 || b == 3 && te <= p || b == 2 && te >= p) ? p : st, G = dn(u, te < M && e >= M ? M : Hn(M, te)), J = F * (C == 0 ? t == 0 ? 0.1 : 1 : f), K = zt(Ia(t + J, O / 10), 24), A = t <= y && (v == 1 || v == 3 && K >= y || v == 2 && K <= y) ? y : -st, Z = Hn(c, K > A && t <= A ? A : dn(A, K));
  return G == Z && G == 0 && (Z = 100), [G, Z];
}
const yh = new Intl.NumberFormat(io ? fh.language : "en-US"), js = (e) => yh.format(e), An = Math, ya = An.PI, en = An.abs, En = An.floor, Zt = An.round, Bn = An.ceil, Hn = An.min, dn = An.max, Ql = An.pow, $r = An.sign, Ci = An.log10, fc = An.log2, bh = (e, t = 1) => An.sinh(e) * t, os = (e, t = 1) => An.asinh(e / t), st = 1 / 0;
function Er(e) {
  return (Ci((e ^ e >> 31) - (e >> 31)) | 0) + 1;
}
function Ps(e, t, n) {
  return Hn(dn(e, t), n);
}
function at(e) {
  return typeof e == "function" ? e : () => e;
}
const xh = () => {
}, hc = (e) => e, gc = (e, t) => t, wh = (e) => null, Ir = (e) => !0, Ar = (e, t) => e == t, Sh = /\.\d*?(?=9{6,}|0{6,})/gm, xl = (e) => {
  if (vc(e) || Yi.has(e))
    return e;
  const t = `${e}`, n = t.match(Sh);
  if (n == null)
    return e;
  let i = n[0].length - 1;
  if (t.indexOf("e-") != -1) {
    let [a, r] = t.split("e");
    return +`${xl(a)}e${r}`;
  }
  return zt(e, i);
};
function cl(e, t) {
  return xl(zt(xl(e / t)) * t);
}
function Ia(e, t) {
  return xl(Bn(xl(e / t)) * t);
}
function pc(e, t) {
  return xl(En(xl(e / t)) * t);
}
function zt(e, t = 0) {
  if (vc(e))
    return e;
  let n = 10 ** t, i = e * n * (1 + Number.EPSILON);
  return Zt(i) / n;
}
const Yi = /* @__PURE__ */ new Map();
function mc(e) {
  return (("" + e).split(".")[1] || "").length;
}
function Ro(e, t, n, i) {
  let a = [], r = i.map(mc);
  for (let f = t; f < n; f++) {
    let u = en(f), c = zt(Ql(e, f), u);
    for (let p = 0; p < i.length; p++) {
      let y = e == 10 ? +`${i[p]}e${f}` : i[p] * c, b = (f >= 0 ? 0 : u) + (f >= r[p] ? 0 : r[p]), v = e == 10 ? y : zt(y, b);
      a.push(v), Yi.set(v, b);
    }
  }
  return a;
}
const Ao = {}, Gs = [], Jl = [null, null], Hi = Array.isArray, vc = Number.isInteger, kh = (e) => e === void 0;
function Or(e) {
  return typeof e == "string";
}
function Aa(e) {
  let t = !1;
  if (e != null) {
    let n = e.constructor;
    t = n == null || n == Object;
  }
  return t;
}
function Ch(e) {
  return e != null && typeof e == "object";
}
const _h = Object.getPrototypeOf(Uint8Array), yc = "__proto__";
function Zl(e, t = Aa) {
  let n;
  if (Hi(e)) {
    let i = e.find((a) => a != null);
    if (Hi(i) || t(i)) {
      n = Array(e.length);
      for (let a = 0; a < e.length; a++)
        n[a] = Zl(e[a], t);
    } else
      n = e.slice();
  } else if (e instanceof _h)
    n = e.slice();
  else if (t(e)) {
    n = {};
    for (let i in e)
      i != yc && (n[i] = Zl(e[i], t));
  } else
    n = e;
  return n;
}
function Yt(e) {
  let t = arguments;
  for (let n = 1; n < t.length; n++) {
    let i = t[n];
    for (let a in i)
      a != yc && (Aa(e[a]) ? Yt(e[a], Zl(i[a])) : e[a] = Zl(i[a]));
  }
  return e;
}
const zh = 0, Mh = 1, Th = 2;
function Ph(e, t, n) {
  for (let i = 0, a, r = -1; i < t.length; i++) {
    let f = t[i];
    if (f > r) {
      for (a = f - 1; a >= 0 && e[a] == null; )
        e[a--] = null;
      for (a = f + 1; a < n && e[a] == null; )
        e[r = a++] = null;
    }
  }
}
function $h(e, t) {
  if (Ah(e)) {
    let f = e[0].slice();
    for (let u = 1; u < e.length; u++)
      f.push(...e[u].slice(1));
    return Oh(f[0]) || (f = Ih(f)), f;
  }
  let n = /* @__PURE__ */ new Set();
  for (let f = 0; f < e.length; f++) {
    let c = e[f][0], p = c.length;
    for (let y = 0; y < p; y++)
      n.add(c[y]);
  }
  let i = [Array.from(n).sort((f, u) => f - u)], a = i[0].length, r = /* @__PURE__ */ new Map();
  for (let f = 0; f < a; f++)
    r.set(i[0][f], f);
  for (let f = 0; f < e.length; f++) {
    let u = e[f], c = u[0];
    for (let p = 1; p < u.length; p++) {
      let y = u[p], b = Array(a).fill(void 0), v = t ? t[f][p] : Mh, C = [];
      for (let z = 0; z < y.length; z++) {
        let T = y[z], q = r.get(c[z]);
        T === null ? v != zh && (b[q] = T, v == Th && C.push(q)) : b[q] = T;
      }
      Ph(b, C, a), i.push(b);
    }
  }
  return i;
}
const Eh = typeof queueMicrotask > "u" ? (e) => Promise.resolve().then(e) : queueMicrotask;
function Ih(e) {
  let t = e[0], n = t.length, i = Array(n);
  for (let r = 0; r < i.length; r++)
    i[r] = r;
  i.sort((r, f) => t[r] - t[f]);
  let a = [];
  for (let r = 0; r < e.length; r++) {
    let f = e[r], u = Array(n);
    for (let c = 0; c < n; c++)
      u[c] = f[i[c]];
    a.push(u);
  }
  return a;
}
function Ah(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 r = 0; r < n; r++)
        if (a[r] != t[r])
          return !1;
    }
  }
  return !0;
}
function Oh(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 r = dn(1, En((a - i + 1) / t));
  for (let f = e[i], u = i + r; u <= a; u += r) {
    const c = e[u];
    if (c != null) {
      if (c <= f)
        return !1;
      f = c;
    }
  }
  return !0;
}
const bc = [
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December"
], xc = [
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
];
function wc(e) {
  return e.slice(0, 3);
}
const Dh = xc.map(wc), qh = bc.map(wc), Lh = {
  MMMM: bc,
  MMM: qh,
  WWWW: xc,
  WWW: Dh
};
function ko(e) {
  return (e < 10 ? "0" : "") + e;
}
function Rh(e) {
  return (e < 10 ? "00" : e < 100 ? "0" : "") + e;
}
const Nh = {
  // 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) => ko(e.getMonth() + 1),
  // 7
  M: (e) => e.getMonth() + 1,
  // 09
  DD: (e) => ko(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) => ko(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) => ko(e.getMinutes()),
  // 9
  m: (e) => e.getMinutes(),
  // 09
  ss: (e) => ko(e.getSeconds()),
  // 9
  s: (e) => e.getSeconds(),
  // 374
  fff: (e) => Rh(e.getMilliseconds())
};
function Ys(e, t) {
  t = t || Lh;
  let n = [], i = /\{([a-z]+)\}|[^{]+/gi, a;
  for (; a = i.exec(e); )
    n.push(a[0][0] == "{" ? Nh[a[1]] : a[0]);
  return (r) => {
    let f = "";
    for (let u = 0; u < n.length; u++)
      f += typeof n[u] == "string" ? n[u] : n[u](r, t);
    return f;
  };
}
const Vh = new Intl.DateTimeFormat().resolvedOptions().timeZone;
function Fh(e, t) {
  let n;
  return t == "UTC" || t == "Etc/UTC" ? n = new Date(+e + e.getTimezoneOffset() * 6e4) : t == Vh ? n = e : (n = new Date(e.toLocaleString("en-US", { timeZone: t })), n.setMilliseconds(e.getMilliseconds())), n;
}
const Sc = (e) => e % 1 == 0, za = [1, 2, 2.5, 5], Bh = Ro(10, -32, 0, za), kc = Ro(10, 0, 32, za), Hh = kc.filter(Sc), dl = Bh.concat(kc), Us = `
`, Cc = "{YYYY}", Dr = Us + Cc, _c = "{M}/{D}", Po = Us + _c, ra = Po + "/{YY}", zc = "{aa}", Wh = "{h}:{mm}", Bl = Wh + zc, qr = Us + Bl, Lr = ":{ss}", pt = null;
function Mc(e) {
  let t = e * 1e3, n = t * 60, i = n * 60, a = i * 24, r = a * 30, f = a * 365, c = (e == 1 ? Ro(10, 0, 3, za).filter(Sc) : Ro(10, -3, 0, za)).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)
    r,
    r * 2,
    r * 3,
    r * 4,
    r * 6,
    // century divisors
    f,
    f * 2,
    f * 5,
    f * 10,
    f * 25,
    f * 50,
    f * 100
  ]);
  const p = [
    //   tick incr    default          year                    month   day                   hour    min       sec   mode
    [f, Cc, pt, pt, pt, pt, pt, pt, 1],
    [a * 28, "{MMM}", Dr, pt, pt, pt, pt, pt, 1],
    [a, _c, Dr, pt, pt, pt, pt, pt, 1],
    [i, "{h}" + zc, ra, pt, Po, pt, pt, pt, 1],
    [n, Bl, ra, pt, Po, pt, pt, pt, 1],
    [t, Lr, ra + " " + Bl, pt, Po + " " + Bl, pt, qr, pt, 1],
    [e, Lr + ".{fff}", ra + " " + Bl, pt, Po + " " + Bl, pt, qr, pt, 1]
  ];
  function y(b) {
    return (v, C, z, T, q, Q) => {
      let F = [], U = q >= f, O = q >= r && q < f, W = b(z), te = zt(W * e, 3), M = as(W.getFullYear(), U ? 0 : W.getMonth(), O || U ? 1 : W.getDate()), G = zt(M * e, 3);
      if (O || U) {
        let J = O ? q / r : 0, K = U ? q / f : 0, A = te == G ? te : zt(as(M.getFullYear() + K, M.getMonth() + J, 1) * e, 3), Z = new Date(Zt(A / e)), Y = Z.getFullYear(), $ = Z.getMonth();
        for (let j = 0; A <= T; j++) {
          let ue = as(Y + K * j, $ + J * j, 1), ie = ue - b(zt(ue * e, 3));
          A = zt((+ue + ie) * e, 3), A <= T && F.push(A);
        }
      } else {
        let J = q >= a ? a : q, K = En(z) - En(te), A = G + K + Ia(te - G, J);
        F.push(A);
        let Z = b(A), Y = Z.getHours() + Z.getMinutes() / n + Z.getSeconds() / i, $ = q / i, j = v.axes[C]._space, ue = Q / j;
        for (; A = zt(A + q, e == 1 ? 0 : 3), !(A > T); )
          if ($ > 1) {
            let ie = En(zt(Y + $, 6)) % 24, ge = b(A).getHours() - ie;
            ge > 1 && (ge = -1), A -= ge * i, Y = (Y + $) % 24;
            let le = F[F.length - 1];
            zt((A - le) / q, 3) * ue >= 0.7 && F.push(A);
          } else
            F.push(A);
      }
      return F;
    };
  }
  return [
    c,
    p,
    y
  ];
}
const [jh, Gh, Yh] = Mc(1), [Uh, Kh, Xh] = Mc(1e-3);
Ro(2, -53, 53, [1]);
function Rr(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 Nr(e, t) {
  return (n, i, a, r, f) => {
    let u = t.find((z) => f >= z[0]) || t[t.length - 1], c, p, y, b, v, C;
    return i.map((z) => {
      let T = e(z), q = T.getFullYear(), Q = T.getMonth(), F = T.getDate(), U = T.getHours(), O = T.getMinutes(), W = T.getSeconds(), te = q != c && u[2] || Q != p && u[3] || F != y && u[4] || U != b && u[5] || O != v && u[6] || W != C && u[7] || u[1];
      return c = q, p = Q, y = F, b = U, v = O, C = W, te(T);
    });
  };
}
function Qh(e, t) {
  let n = Ys(t);
  return (i, a, r, f, u) => a.map((c) => n(e(c)));
}
function as(e, t, n) {
  return new Date(e, t, n);
}
function Vr(e, t) {
  return t(e);
}
const Jh = "{YYYY}-{MM}-{DD} {h}:{mm}{aa}";
function Fr(e, t) {
  return (n, i, a, r) => r == null ? Fs : t(e(i));
}
function Zh(e, t) {
  let n = e.series[t];
  return n.width ? n.stroke(e, t) : n.points.width ? n.points.stroke(e, t) : null;
}
function eg(e, t) {
  return e.series[t].fill(e, t);
}
const tg = {
  show: !0,
  live: !0,
  isolate: !1,
  mount: xh,
  markers: {
    show: !0,
    width: 2,
    stroke: Zh,
    fill: eg,
    dash: "solid"
  },
  idx: null,
  idxs: null,
  values: []
};
function ng(e, t) {
  let n = e.cursor.points, i = Vn(), a = n.size(e, t);
  Et(i, Mo, a), Et(i, To, a);
  let r = a / -2;
  Et(i, "marginLeft", r), Et(i, "marginTop", r);
  let f = n.width(e, t, a);
  return f && Et(i, "borderWidth", f), i;
}
function ig(e, t) {
  let n = e.series[t].points;
  return n._fill || n._stroke;
}
function lg(e, t) {
  let n = e.series[t].points;
  return n._stroke || n._fill;
}
function og(e, t) {
  return e.series[t].points.size;
}
const ss = [0, 0];
function ag(e, t, n) {
  return ss[0] = t, ss[1] = n, ss;
}
function ua(e, t, n, i = !0) {
  return (a) => {
    a.button == 0 && (!i || a.target == t) && n(a);
  };
}
function rs(e, t, n, i = !0) {
  return (a) => {
    (!i || a.target == t) && n(a);
  };
}
const sg = {
  show: !0,
  x: !0,
  y: !0,
  lock: !1,
  move: ag,
  points: {
    one: !1,
    show: ng,
    size: og,
    width: 0,
    stroke: lg,
    fill: ig
  },
  bind: {
    mousedown: ua,
    mouseup: ua,
    click: ua,
    // legend clicks, not .u-over clicks
    dblclick: ua,
    mousemove: rs,
    mouseleave: rs,
    mouseenter: rs
  },
  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
}, Tc = {
  show: !0,
  stroke: "rgba(0,0,0,0.07)",
  width: 2
  //	dash: [],
}, Ks = Yt({}, Tc, {
  filter: gc
}), Pc = Yt({}, Ks, {
  size: 10
}), $c = Yt({}, Tc, {
  show: !1
}), Xs = '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"', Ec = "bold " + Xs, Ic = 1.5, Br = {
  show: !0,
  scale: "x",
  stroke: Vs,
  space: 50,
  gap: 5,
  size: 50,
  labelGap: 0,
  labelSize: 30,
  labelFont: Ec,
  side: 2,
  //	class: "x-vals",
  //	incrs: timeIncrs,
  //	values: timeVals,
  //	filter: retArg1,
  grid: Ks,
  ticks: Pc,
  border: $c,
  font: Xs,
  lineGap: Ic,
  rotate: 0
}, rg = "Value", ug = "Time", Hr = {
  show: !0,
  scale: "x",
  auto: !1,
  sorted: 1,
  //	label: "Time",
  //	value: v => stamp(new Date(v * 1e3)),
  // internal caches
  min: st,
  max: -st,
  idxs: []
};
function cg(e, t, n, i, a) {
  return t.map((r) => r == null ? "" : js(r));
}
function dg(e, t, n, i, a, r, f) {
  let u = [], c = Yi.get(a) || 0;
  n = f ? n : zt(Ia(n, a), c);
  for (let p = n; p <= i; p = zt(p + a, c))
    u.push(Object.is(p, -0) ? 0 : p);
  return u;
}
function $s(e, t, n, i, a, r, f) {
  const u = [], c = e.scales[e.axes[t].scale].log, p = c == 10 ? Ci : fc, y = En(p(n));
  a = Ql(c, y), c == 10 && (a = dl[ei(a, dl)]);
  let b = n, v = a * c;
  c == 10 && (v = dl[ei(v, dl)]);
  do
    u.push(b), b = b + a, c == 10 && !Yi.has(b) && (b = zt(b, Yi.get(a))), b >= v && (a = b, v = a * c, c == 10 && (v = dl[ei(v, dl)]));
  while (b <= i);
  return u;
}
function fg(e, t, n, i, a, r, f) {
  let c = e.scales[e.axes[t].scale].asinh, p = i > c ? $s(e, t, dn(c, n), i, a) : [c], y = i >= 0 && n <= 0 ? [0] : [];
  return (n < -c ? $s(e, t, dn(c, -i), -n, a) : [c]).reverse().map((v) => -v).concat(y, p);
}
const Ac = /./, hg = /[12357]/, gg = /[125]/, Wr = /1/, Es = (e, t, n, i) => e.map((a, r) => t == 4 && a == 0 || r % i == 0 && n.test(a.toExponential()[a < 0 ? 1 : 0]) ? a : null);
function pg(e, t, n, i, a) {
  let r = e.axes[n], f = r.scale, u = e.scales[f], c = e.valToPos, p = r._space, y = c(10, f), b = c(9, f) - y >= p ? Ac : c(7, f) - y >= p ? hg : c(5, f) - y >= p ? gg : Wr;
  if (b == Wr) {
    let v = en(c(1, f) - y);
    if (v < p)
      return Es(t.slice().reverse(), u.distr, b, Bn(p / v)).reverse();
  }
  return Es(t, u.distr, b, 1);
}
function mg(e, t, n, i, a) {
  let r = e.axes[n], f = r.scale, u = r._space, c = e.valToPos, p = en(c(1, f) - c(2, f));
  return p < u ? Es(t.slice().reverse(), 3, Ac, Bn(u / p)).reverse() : t;
}
function vg(e, t, n, i) {
  return i == null ? Fs : t == null ? "" : js(t);
}
const jr = {
  show: !0,
  scale: "y",
  stroke: Vs,
  space: 30,
  gap: 5,
  size: 50,
  labelGap: 0,
  labelSize: 30,
  labelFont: Ec,
  side: 3,
  //	class: "y-vals",
  //	incrs: numIncrs,
  //	values: (vals, space) => vals,
  //	filter: retArg1,
  grid: Ks,
  ticks: Pc,
  border: $c,
  font: Xs,
  lineGap: Ic,
  rotate: 0
};
function yg(e, t) {
  let n = 3 + (e || 1) * 2;
  return zt(n * t, 3);
}
function bg(e, t) {
  let { scale: n, idxs: i } = e.series[0], a = e._data[0], r = e.valToPos(a[i[0]], n, !0), f = e.valToPos(a[i[1]], n, !0), u = en(f - r), c = e.series[t], p = u / (c.points.space * gt);
  return i[1] - i[0] <= p;
}
const Gr = {
  scale: null,
  auto: !0,
  sorted: 0,
  // internal caches
  min: st,
  max: -st
}, Oc = (e, t, n, i, a) => a, Yr = {
  show: !0,
  auto: !0,
  sorted: 0,
  gaps: Oc,
  alpha: 1,
  facets: [
    Yt({}, Gr, { scale: "x" }),
    Yt({}, Gr, { scale: "y" })
  ]
}, Ur = {
  scale: "y",
  auto: !0,
  sorted: 0,
  show: !0,
  spanGaps: !1,
  gaps: Oc,
  alpha: 1,
  points: {
    show: bg,
    filter: null
    //  paths:
    //	stroke: "#000",
    //	fill: "#fff",
    //	width: 1,
    //	size: 10,
  },
  //	label: "Value",
  //	value: v => v,
  values: null,
  // internal caches
  min: st,
  max: -st,
  idxs: [],
  path: null,
  clip: null
};
function xg(e, t, n, i, a) {
  return n / 10;
}
const Dc = {
  time: jf,
  auto: !0,
  distr: 1,
  log: 10,
  asinh: 1,
  min: null,
  max: null,
  dir: 1,
  ori: 0
}, wg = Yt({}, Dc, {
  time: !1,
  ori: 1
}), Kr = {};
function qc(e, t) {
  let n = Kr[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, r, f, u, c, p) {
      for (let y = 0; y < n.plots.length; y++)
        n.plots[y] != a && n.plots[y].pub(i, a, r, f, u, c, p);
    }
  }, e != null && (Kr[e] = n)), n;
}
const eo = 1, Is = 2;
function wl(e, t, n) {
  const i = e.mode, a = e.series[t], r = i == 2 ? e._data[t] : e._data, f = e.scales, u = e.bbox;
  let c = r[0], p = i == 2 ? r[1] : r[t], y = i == 2 ? f[a.facets[0].scale] : f[e.series[0].scale], b = i == 2 ? f[a.facets[1].scale] : f[a.scale], v = u.left, C = u.top, z = u.width, T = u.height, q = e.valToPosH, Q = e.valToPosV;
  return y.ori == 0 ? n(
    a,
    c,
    p,
    y,
    b,
    q,
    Q,
    v,
    C,
    z,
    T,
    Da,
    lo,
    La,
    Rc,
    Vc
  ) : n(
    a,
    c,
    p,
    y,
    b,
    Q,
    q,
    C,
    v,
    T,
    z,
    qa,
    oo,
    Zs,
    Nc,
    Fc
  );
}
function Qs(e, t) {
  let n = 0, i = 0, a = dt(e.bands, Gs);
  for (let r = 0; r < a.length; r++) {
    let f = a[r];
    f.series[0] == t ? n = f.dir : f.series[1] == t && (f.dir == 1 ? i |= 1 : i |= 2);
  }
  return [
    n,
    i == 1 ? -1 : (
      // neg only
      i == 2 ? 1 : (
        // pos only
        i == 3 ? 2 : (
          // both
          0
        )
      )
    )
  ];
}
function Sg(e, t, n, i, a) {
  let r = e.mode, f = e.series[t], u = r == 2 ? f.facets[1].scale : f.scale, c = e.scales[u];
  return a == -1 ? c.min : a == 1 ? c.max : c.distr == 3 ? c.dir == 1 ? c.min : c.max : 0;
}
function _i(e, t, n, i, a, r) {
  return wl(e, t, (f, u, c, p, y, b, v, C, z, T, q) => {
    let Q = f.pxRound;
    const F = p.dir * (p.ori == 0 ? 1 : -1), U = p.ori == 0 ? lo : oo;
    let O, W;
    F == 1 ? (O = n, W = i) : (O = i, W = n);
    let te = Q(b(u[O], p, T, C)), M = Q(v(c[O], y, q, z)), G = Q(b(u[W], p, T, C)), J = Q(v(r == 1 ? y.max : y.min, y, q, z)), K = new Path2D(a);
    return U(K, G, J), U(K, te, J), U(K, te, M), K;
  });
}
function Oa(e, t, n, i, a, r) {
  let f = null;
  if (e.length > 0) {
    f = new Path2D();
    const u = t == 0 ? La : Zs;
    let c = n;
    for (let b = 0; b < e.length; b++) {
      let v = e[b];
      if (v[1] > v[0]) {
        let C = v[0] - c;
        C > 0 && u(f, c, i, C, i + r), c = v[1];
      }
    }
    let p = n + a - c, y = 10;
    p > 0 && u(f, c, i - y / 2, p, i + r + y);
  }
  return f;
}
function kg(e, t, n) {
  let i = e[e.length - 1];
  i && i[0] == t ? i[1] = n : e.push([t, n]);
}
function Js(e, t, n, i, a, r, f) {
  let u = [], c = e.length;
  for (let p = a == 1 ? n : i; p >= n && p <= i; p += a)
    if (t[p] === null) {
      let b = p, v = p;
      if (a == 1)
        for (; ++p <= i && t[p] === null; )
          v = p;
      else
        for (; --p >= n && t[p] === null; )
          v = p;
      let C = r(e[b]), z = v == b ? C : r(e[v]), T = b - a;
      C = f <= 0 && T >= 0 && T < c ? r(e[T]) : C;
      let Q = v + a;
      z = f >= 0 && Q >= 0 && Q < c ? r(e[Q]) : z, z >= C && u.push([C, z]);
    }
  return u;
}
function Xr(e) {
  return e == 0 ? hc : e == 1 ? Zt : (t) => cl(t, e);
}
function Lc(e) {
  let t = e == 0 ? Da : qa, n = e == 0 ? (a, r, f, u, c, p) => {
    a.arcTo(r, f, u, c, p);
  } : (a, r, f, u, c, p) => {
    a.arcTo(f, r, c, u, p);
  }, i = e == 0 ? (a, r, f, u, c) => {
    a.rect(r, f, u, c);
  } : (a, r, f, u, c) => {
    a.rect(f, r, c, u);
  };
  return (a, r, f, u, c, p = 0, y = 0) => {
    p == 0 && y == 0 ? i(a, r, f, u, c) : (p = Hn(p, u / 2, c / 2), y = Hn(y, u / 2, c / 2), t(a, r + p, f), n(a, r + u, f, r + u, f + c, p), n(a, r + u, f + c, r, f + c, y), n(a, r, f + c, r, f, y), n(a, r, f, r + u, f, p), a.closePath());
  };
}
const Da = (e, t, n) => {
  e.moveTo(t, n);
}, qa = (e, t, n) => {
  e.moveTo(n, t);
}, lo = (e, t, n) => {
  e.lineTo(t, n);
}, oo = (e, t, n) => {
  e.lineTo(n, t);
}, La = Lc(0), Zs = Lc(1), Rc = (e, t, n, i, a, r) => {
  e.arc(t, n, i, a, r);
}, Nc = (e, t, n, i, a, r) => {
  e.arc(n, t, i, a, r);
}, Vc = (e, t, n, i, a, r, f) => {
  e.bezierCurveTo(t, n, i, a, r, f);
}, Fc = (e, t, n, i, a, r, f) => {
  e.bezierCurveTo(n, t, a, i, f, r);
};
function Bc(e) {
  return (t, n, i, a, r) => wl(t, n, (f, u, c, p, y, b, v, C, z, T, q) => {
    let { pxRound: Q, points: F } = f, U, O;
    p.ori == 0 ? (U = Da, O = Rc) : (U = qa, O = Nc);
    const W = zt(F.width * gt, 3);
    let te = (F.size - F.width) / 2 * gt, M = zt(te * 2, 3), G = new Path2D(), J = new Path2D(), { left: K, top: A, width: Z, height: Y } = t.bbox;
    La(
      J,
      K - M,
      A - M,
      Z + M * 2,
      Y + M * 2
    );
    const $ = (j) => {
      if (c[j] != null) {
        let ue = Q(b(u[j], p, T, C)), ie = Q(v(c[j], y, q, z));
        U(G, ue + te, ie), O(G, ue, ie, te, 0, ya * 2);
      }
    };
    if (r)
      r.forEach($);
    else
      for (let j = i; j <= a; j++)
        $(j);
    return {
      stroke: W > 0 ? G : null,
      fill: G,
      clip: J,
      flags: eo | Is
    };
  });
}
function Hc(e) {
  return (t, n, i, a, r, f) => {
    i != a && (r != i && f != i && e(t, n, i), r != a && f != a && e(t, n, a), e(t, n, f));
  };
}
const Cg = Hc(lo), _g = Hc(oo);
function Wc(e) {
  const t = dt(e?.alignGaps, 0);
  return (n, i, a, r) => wl(n, i, (f, u, c, p, y, b, v, C, z, T, q) => {
    let Q = f.pxRound, F = (ve) => Q(b(ve, p, T, C)), U = (ve) => Q(v(ve, y, q, z)), O, W;
    p.ori == 0 ? (O = lo, W = Cg) : (O = oo, W = _g);
    const te = p.dir * (p.ori == 0 ? 1 : -1), M = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null, flags: eo }, G = M.stroke;
    let J = st, K = -st, A, Z, Y, $ = F(u[te == 1 ? a : r]), j = Xl(c, a, r, 1 * te), ue = Xl(c, a, r, -1 * te), ie = F(u[j]), Ee = F(u[ue]), me = !1;
    for (let ve = te == 1 ? a : r; ve >= a && ve <= r; ve += te) {
      let Oe = F(u[ve]), xe = c[ve];
      Oe == $ ? xe != null ? (Z = U(xe), J == st && (O(G, Oe, Z), A = Z), J = Hn(Z, J), K = dn(Z, K)) : xe === null && (me = !0) : (J != st && (W(G, $, J, K, A, Z), Y = $), xe != null ? (Z = U(xe), O(G, Oe, Z), J = K = A = Z) : (J = st, K = -st, xe === null && (me = !0)), $ = Oe);
    }
    J != st && J != K && Y != $ && W(G, $, J, K, A, Z);
    let [ge, le] = Qs(n, i);
    if (f.fill != null || ge != 0) {
      let ve = M.fill = new Path2D(G), Oe = f.fillTo(n, i, f.min, f.max, ge), xe = U(Oe);
      O(ve, Ee, xe), O(ve, ie, xe);
    }
    if (!f.spanGaps) {
      let ve = [];
      me && ve.push(...Js(u, c, a, r, te, F, t)), M.gaps = ve = f.gaps(n, i, a, r, ve), M.clip = Oa(ve, p.ori, C, z, T, q);
    }
    return le != 0 && (M.band = le == 2 ? [
      _i(n, i, a, r, G, -1),
      _i(n, i, a, r, G, 1)
    ] : _i(n, i, a, r, G, le)), M;
  });
}
function zg(e) {
  const t = dt(e.align, 1), n = dt(e.ascDesc, !1), i = dt(e.alignGaps, 0), a = dt(e.extend, !1);
  return (r, f, u, c) => wl(r, f, (p, y, b, v, C, z, T, q, Q, F, U) => {
    let O = p.pxRound, { left: W, width: te } = r.bbox, M = (ge) => O(z(ge, v, F, q)), G = (ge) => O(T(ge, C, U, Q)), J = v.ori == 0 ? lo : oo;
    const K = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null, flags: eo }, A = K.stroke, Z = v.dir * (v.ori == 0 ? 1 : -1);
    u = Xl(b, u, c, 1), c = Xl(b, u, c, -1);
    let Y = G(b[Z == 1 ? u : c]), $ = M(y[Z == 1 ? u : c]), j = $, ue = $;
    a && t == -1 && (ue = W, J(A, ue, Y)), J(A, $, Y);
    for (let ge = Z == 1 ? u : c; ge >= u && ge <= c; ge += Z) {
      let le = b[ge];
      if (le == null)
        continue;
      let ve = M(y[ge]), Oe = G(le);
      t == 1 ? J(A, ve, Y) : J(A, j, Oe), J(A, ve, Oe), Y = Oe, j = ve;
    }
    let ie = j;
    a && t == 1 && (ie = W + te, J(A, ie, Y));
    let [Ee, me] = Qs(r, f);
    if (p.fill != null || Ee != 0) {
      let ge = K.fill = new Path2D(A), le = p.fillTo(r, f, p.min, p.max, Ee), ve = G(le);
      J(ge, ie, ve), J(ge, ue, ve);
    }
    if (!p.spanGaps) {
      let ge = [];
      ge.push(...Js(y, b, u, c, Z, M, i));
      let le = p.width * gt / 2, ve = n || t == 1 ? le : -le, Oe = n || t == -1 ? -le : le;
      ge.forEach((xe) => {
        xe[0] += ve, xe[1] += Oe;
      }), K.gaps = ge = p.gaps(r, f, u, c, ge), K.clip = Oa(ge, v.ori, q, Q, F, U);
    }
    return me != 0 && (K.band = me == 2 ? [
      _i(r, f, u, c, A, -1),
      _i(r, f, u, c, A, 1)
    ] : _i(r, f, u, c, A, me)), K;
  });
}
function Qr(e, t, n, i, a, r, f = st) {
  if (e.length > 1) {
    let u = null;
    for (let c = 0, p = 1 / 0; c < e.length; c++)
      if (t[c] !== void 0) {
        if (u != null) {
          let y = en(e[c] - e[u]);
          y < p && (p = y, f = en(n(e[c], i, a, r) - n(e[u], i, a, r)));
        }
        u = c;
      }
  }
  return f;
}
function Mg(e) {
  e = e || Ao;
  const t = dt(e.size, [0.6, st, 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 r = at(a), f = 1 - t[0], u = dt(t[1], st), c = dt(t[2], 1), p = dt(e.disp, Ao), y = dt(e.each, (C) => {
  }), { fill: b, stroke: v } = p;
  return (C, z, T, q) => wl(C, z, (Q, F, U, O, W, te, M, G, J, K, A) => {
    let Z = Q.pxRound, Y = n, $ = i * gt, j = u * gt, ue = c * gt, ie, Ee;
    O.ori == 0 ? [ie, Ee] = r(C, z) : [Ee, ie] = r(C, z);
    const me = O.dir * (O.ori == 0 ? 1 : -1);
    let ge = O.ori == 0 ? La : Zs, le = O.ori == 0 ? y : (_e, je, ct, Ye, Le, et, nt) => {
      y(_e, je, ct, Le, Ye, nt, et);
    }, ve = dt(C.bands, Gs).find((_e) => _e.series[0] == z), Oe = ve != null ? ve.dir : 0, xe = Q.fillTo(C, z, Q.min, Q.max, Oe), ke = Z(M(xe, W, A, J)), se, oe, Te, be = K, qe = Z(Q.width * gt), Je = !1, Ge = null, mt = null, It = null, ft = null;
    b != null && (qe == 0 || v != null) && (Je = !0, Ge = b.values(C, z, T, q), mt = /* @__PURE__ */ new Map(), new Set(Ge).forEach((_e) => {
      _e != null && mt.set(_e, new Path2D());
    }), qe > 0 && (It = v.values(C, z, T, q), ft = /* @__PURE__ */ new Map(), new Set(It).forEach((_e) => {
      _e != null && ft.set(_e, new Path2D());
    })));
    let { x0: Tt, size: ut } = p;
    if (Tt != null && ut != null) {
      Y = 1, F = Tt.values(C, z, T, q), Tt.unit == 2 && (F = F.map((ct) => C.posToVal(G + ct * K, O.key, !0)));
      let _e = ut.values(C, z, T, q);
      ut.unit == 2 ? oe = _e[0] * K : oe = te(_e[0], O, K, G) - te(0, O, K, G), be = Qr(F, U, te, O, K, G, be), Te = be - oe + $;
    } else
      be = Qr(F, U, te, O, K, G, be), Te = be * f + $, oe = be - Te;
    Te < 1 && (Te = 0), qe >= oe / 2 && (qe = 0), Te < 5 && (Z = hc);
    let At = Te > 0, Wn = be - Te - (At ? qe : 0);
    oe = Z(Ps(Wn, ue, j)), se = (Y == 0 ? oe / 2 : Y == me ? 0 : oe) - Y * me * ((Y == 0 ? $ / 2 : 0) + (At ? qe / 2 : 0));
    const Wt = { stroke: null, fill: null, clip: null, band: null, gaps: null, flags: 0 }, ln = Je ? null : new Path2D();
    let Be = null;
    if (ve != null)
      Be = C.data[ve.series[1]];
    else {
      let { y0: _e, y1: je } = p;
      _e != null && je != null && (U = je.values(C, z, T, q), Be = _e.values(C, z, T, q));
    }
    let ae = ie * oe, Ie = Ee * oe;
    for (let _e = me == 1 ? T : q; _e >= T && _e <= q; _e += me) {
      let je = U[_e];
      if (je == null)
        continue;
      if (Be != null) {
        let Lt = Be[_e] ?? 0;
        if (je - Lt == 0)
          continue;
        ke = M(Lt, W, A, J);
      }
      let ct = O.distr != 2 || p != null ? F[_e] : _e, Ye = te(ct, O, K, G), Le = M(dt(je, xe), W, A, J), et = Z(Ye - se), nt = Z(dn(Le, ke)), it = Z(Hn(Le, ke)), St = nt - it;
      if (je != null) {
        let Lt = je < 0 ? Ie : ae, Gt = je < 0 ? ae : Ie;
        Je ? (qe > 0 && It[_e] != null && ge(ft.get(It[_e]), et, it + En(qe / 2), oe, dn(0, St - qe), Lt, Gt), Ge[_e] != null && ge(mt.get(Ge[_e]), et, it + En(qe / 2), oe, dn(0, St - qe), Lt, Gt)) : ge(ln, et, it + En(qe / 2), oe, dn(0, St - qe), Lt, Gt), le(
          C,
          z,
          _e,
          et - qe / 2,
          it,
          oe + qe,
          St
        );
      }
    }
    return qe > 0 ? Wt.stroke = Je ? ft : ln : Je || (Wt._fill = Q.width == 0 ? Q._fill : Q._stroke ?? Q._fill, Wt.width = 0), Wt.fill = Je ? mt : ln, Wt;
  });
}
function Tg(e, t) {
  const n = dt(t?.alignGaps, 0);
  return (i, a, r, f) => wl(i, a, (u, c, p, y, b, v, C, z, T, q, Q) => {
    let F = u.pxRound, U = (ie) => F(v(ie, y, q, z)), O = (ie) => F(C(ie, b, Q, T)), W, te, M;
    y.ori == 0 ? (W = Da, M = lo, te = Vc) : (W = qa, M = oo, te = Fc);
    const G = y.dir * (y.ori == 0 ? 1 : -1);
    r = Xl(p, r, f, 1), f = Xl(p, r, f, -1);
    let J = U(c[G == 1 ? r : f]), K = J, A = [], Z = [];
    for (let ie = G == 1 ? r : f; ie >= r && ie <= f; ie += G)
      if (p[ie] != null) {
        let me = c[ie], ge = U(me);
        A.push(K = ge), Z.push(O(p[ie]));
      }
    const Y = { stroke: e(A, Z, W, M, te, F), fill: null, clip: null, band: null, gaps: null, flags: eo }, $ = Y.stroke;
    let [j, ue] = Qs(i, a);
    if (u.fill != null || j != 0) {
      let ie = Y.fill = new Path2D($), Ee = u.fillTo(i, a, u.min, u.max, j), me = O(Ee);
      M(ie, K, me), M(ie, J, me);
    }
    if (!u.spanGaps) {
      let ie = [];
      ie.push(...Js(c, p, r, f, G, U, n)), Y.gaps = ie = u.gaps(i, a, r, f, ie), Y.clip = Oa(ie, y.ori, z, T, q, Q);
    }
    return ue != 0 && (Y.band = ue == 2 ? [
      _i(i, a, r, f, $, -1),
      _i(i, a, r, f, $, 1)
    ] : _i(i, a, r, f, $, ue)), Y;
  });
}
function Pg(e) {
  return Tg($g, e);
}
function $g(e, t, n, i, a, r) {
  const f = e.length;
  if (f < 2)
    return null;
  const u = new Path2D();
  if (n(u, e[0], t[0]), f == 2)
    i(u, e[1], t[1]);
  else {
    let c = Array(f), p = Array(f - 1), y = Array(f - 1), b = Array(f - 1);
    for (let v = 0; v < f - 1; v++)
      y[v] = t[v + 1] - t[v], b[v] = e[v + 1] - e[v], p[v] = y[v] / b[v];
    c[0] = p[0];
    for (let v = 1; v < f - 1; v++)
      p[v] === 0 || p[v - 1] === 0 || p[v - 1] > 0 != p[v] > 0 ? c[v] = 0 : (c[v] = 3 * (b[v - 1] + b[v]) / ((2 * b[v] + b[v - 1]) / p[v - 1] + (b[v] + 2 * b[v - 1]) / p[v]), isFinite(c[v]) || (c[v] = 0));
    c[f - 1] = p[f - 2];
    for (let v = 0; v < f - 1; v++)
      a(
        u,
        e[v] + b[v] / 3,
        t[v] + c[v] * b[v] / 3,
        e[v + 1] - b[v] / 3,
        t[v + 1] - c[v + 1] * b[v] / 3,
        e[v + 1],
        t[v + 1]
      );
  }
  return u;
}
const As = /* @__PURE__ */ new Set();
function Jr() {
  for (let e of As)
    e.syncRect(!0);
}
io && (gl(ch, Gl, Jr), gl(dh, Gl, Jr, !0), gl(Ca, Gl, () => {
  tn.pxRatio = gt;
}));
const Eg = Wc(), Ig = Bc();
function Zr(e, t, n, i) {
  return (i ? [e[0], e[1]].concat(e.slice(2)) : [e[0]].concat(e.slice(1))).map((r, f) => Os(r, f, t, n));
}
function Ag(e, t) {
  return e.map((n, i) => i == 0 ? {} : Yt({}, t, n));
}
function Os(e, t, n, i) {
  return Yt({}, t == 0 ? n : i, e);
}
function jc(e, t, n) {
  return t == null ? Jl : [t, n];
}
const Og = jc;
function Dg(e, t, n) {
  return t == null ? Jl : _a(t, n, Ws, !0);
}
function Gc(e, t, n, i) {
  return t == null ? Jl : Ea(t, n, e.scales[i].log, !1);
}
const qg = Gc;
function Yc(e, t, n, i) {
  return t == null ? Jl : Hs(t, n, e.scales[i].log, !1);
}
const Lg = Yc;
function Rg(e, t, n, i, a) {
  let r = dn(Er(e), Er(t)), f = t - e, u = ei(a / i * f, n);
  do {
    let c = n[u], p = i * c / f;
    if (p >= a && r + (c < 5 ? Yi.get(c) : 0) <= 17)
      return [c, p];
  } while (++u < n.length);
  return [0, 0];
}
function eu(e) {
  let t, n;
  return e = e.replace(/(\d+)px/, (i, a) => (t = Zt((n = +a) * gt)) + "px"), [e, t, n];
}
function Ng(e) {
  e.show && [e.font, e.labelFont].forEach((t) => {
    let n = zt(t[2] * gt, 1);
    t[0] = t[0].replace(/[0-9.]+px/, n + "px"), t[1] = n;
  });
}
function tn(e, t, n) {
  const i = {
    mode: dt(e.mode, 1)
  }, a = i.mode;
  function r(w, P) {
    return ((P.distr == 3 ? Ci(w > 0 ? w : P.clamp(i, w, P.min, P.max, P.key)) : P.distr == 4 ? os(w, P.asinh) : P.distr == 100 ? P.fwd(w) : w) - P._min) / (P._max - P._min);
  }
  function f(w, P, N, V) {
    let ee = r(w, P);
    return V + N * (P.dir == -1 ? 1 - ee : ee);
  }
  function u(w, P, N, V) {
    let ee = r(w, P);
    return V + N * (P.dir == -1 ? ee : 1 - ee);
  }
  function c(w, P, N, V) {
    return P.ori == 0 ? f(w, P, N, V) : u(w, P, N, V);
  }
  i.valToPosH = f, i.valToPosV = u;
  let p = !1;
  i.status = 0;
  const y = i.root = Vn(Gf);
  if (e.id != null && (y.id = e.id), _n(y, e.class), e.title) {
    let w = Vn(Kf, y);
    w.textContent = e.title;
  }
  const b = Qn("canvas"), v = i.ctx = b.getContext("2d"), C = Vn(Xf, y);
  gl("click", C, (w) => {
    w.target === T && (kt != yi || xt != Di) && Jt.click(i, w);
  }, !0);
  const z = i.under = Vn(Qf, C);
  C.appendChild(b);
  const T = i.over = Vn(Jf, C);
  e = Zl(e);
  const q = +dt(e.pxAlign, 1), Q = Xr(q);
  (e.plugins || []).forEach((w) => {
    w.opts && (e = w.opts(i, e) || e);
  });
  const F = e.ms || 1e-3, U = i.series = a == 1 ? Zr(e.series || [], Hr, Ur, !1) : Ag(e.series || [null], Yr), O = i.axes = Zr(e.axes || [], Br, jr, !0), W = i.scales = {}, te = i.bands = e.bands || [];
  te.forEach((w) => {
    w.fill = at(w.fill || null), w.dir = dt(w.dir, -1);
  });
  const M = a == 2 ? U[1].facets[0].scale : U[0].scale, G = {
    axes: Ko,
    series: zl
  }, J = (e.drawOrder || ["axes", "series"]).map((w) => G[w]);
  function K(w) {
    let P = W[w];
    if (P == null) {
      let N = (e.scales || Ao)[w] || Ao;
      if (N.from != null)
        K(N.from), W[w] = Yt({}, W[N.from], N, { key: w });
      else {
        P = W[w] = Yt({}, w == M ? Dc : wg, N), P.key = w;
        let V = P.time, ee = P.range, l = Hi(ee);
        if ((w != M || a == 2 && !V) && (l && (ee[0] == null || ee[1] == null) && (ee = {
          min: ee[0] == null ? Tr : {
            mode: 1,
            hard: ee[0],
            soft: ee[0]
          },
          max: ee[1] == null ? Tr : {
            mode: 1,
            hard: ee[1],
            soft: ee[1]
          }
        }, l = !1), !l && Aa(ee))) {
          let o = ee;
          ee = (s, h, g) => h == null ? Jl : _a(h, g, o);
        }
        P.range = at(ee || (V ? Og : w == M ? P.distr == 3 ? qg : P.distr == 4 ? Lg : jc : P.distr == 3 ? Gc : P.distr == 4 ? Yc : Dg)), P.auto = at(l ? !1 : P.auto), P.clamp = at(P.clamp || xg), P._min = P._max = null;
      }
    }
  }
  K("x"), K("y"), a == 1 && U.forEach((w) => {
    K(w.scale);
  }), O.forEach((w) => {
    K(w.scale);
  });
  for (let w in e.scales)
    K(w);
  const A = W[M], Z = A.distr;
  let Y, $;
  A.ori == 0 ? (_n(y, Yf), Y = f, $ = u) : (_n(y, Uf), Y = u, $ = f);
  const j = {};
  for (let w in W) {
    let P = W[w];
    (P.min != null || P.max != null) && (j[w] = { min: P.min, max: P.max }, P.min = P.max = null);
  }
  const ue = e.tzDate || ((w) => new Date(Zt(w / F))), ie = e.fmtDate || Ys, Ee = F == 1 ? Yh(ue) : Xh(ue), me = Nr(ue, Rr(F == 1 ? Gh : Kh, ie)), ge = Fr(ue, Vr(Jh, ie)), le = [], ve = i.legend = Yt({}, tg, e.legend), Oe = ve.show, xe = ve.markers;
  ve.idxs = le, xe.width = at(xe.width), xe.dash = at(xe.dash), xe.stroke = at(xe.stroke), xe.fill = at(xe.fill);
  let ke, se, oe, Te = [], be = [], qe, Je = !1, Ge = {};
  if (ve.live) {
    const w = U[1] ? U[1].values : null;
    Je = w != null, qe = Je ? w(i, 1, 0) : { _: 0 };
    for (let P in qe)
      Ge[P] = Fs;
  }
  if (Oe)
    if (ke = Qn("table", lh, y), oe = Qn("tbody", null, ke), ve.mount(i, ke), Je) {
      se = Qn("thead", null, ke, oe);
      let w = Qn("tr", null, se);
      Qn("th", null, w);
      for (var mt in qe)
        Qn("th", gr, w).textContent = mt;
    } else
      _n(ke, ah), ve.live && _n(ke, oh);
  const It = { show: !0 }, ft = { show: !1 };
  function Tt(w, P) {
    if (P == 0 && (Je || !ve.live || a == 2))
      return Jl;
    let N = [], V = Qn("tr", sh, oe, oe.childNodes[P]);
    _n(V, w.class), w.show || _n(V, hl);
    let ee = Qn("th", null, V);
    if (xe.show) {
      let s = Vn(rh, ee);
      if (P > 0) {
        let h = xe.width(i, P);
        h && (s.style.border = h + "px " + xe.dash(i, P) + " " + xe.stroke(i, P)), s.style.background = xe.fill(i, P);
      }
    }
    let l = Vn(gr, ee);
    l.textContent = w.label, P > 0 && (xe.show || (l.style.color = w.width > 0 ? xe.stroke(i, P) : xe.fill(i, P)), At("click", ee, (s) => {
      if (De._lock)
        return;
      rn(s);
      let h = U.indexOf(w);
      if ((s.ctrlKey || s.metaKey) != ve.isolate) {
        let g = U.some((x, S) => S > 0 && S != h && x.show);
        U.forEach((x, S) => {
          S > 0 && Dn(S, g ? S == h ? It : ft : It, !0, Nt.setSeries);
        });
      } else
        Dn(h, { show: !w.show }, !0, Nt.setSeries);
    }, !1), Ti && At(br, ee, (s) => {
      De._lock || (rn(s), Dn(U.indexOf(w), Li, !0, Nt.setSeries));
    }, !1));
    for (var o in qe) {
      let s = Qn("td", uh, V);
      s.textContent = "--", N.push(s);
    }
    return [V, N];
  }
  const ut = /* @__PURE__ */ new Map();
  function At(w, P, N, V = !0) {
    const ee = ut.get(P) || {}, l = De.bind[w](i, P, N, V);
    l && (gl(w, P, ee[w] = l), ut.set(P, ee));
  }
  function Wn(w, P, N) {
    const V = ut.get(P) || {};
    for (let ee in V)
      (w == null || ee == w) && (Ts(ee, P, V[ee]), delete V[ee]);
    w == null && ut.delete(P);
  }
  let Wt = 0, ln = 0, Be = 0, ae = 0, Ie = 0, _e = 0, je = Ie, ct = _e, Ye = Be, Le = ae, et = 0, nt = 0, it = 0, St = 0;
  i.bbox = {};
  let Lt = !1, Gt = !1, fn = !1, sn = !1, Ut = !1, Mt = !1;
  function Kt(w, P, N) {
    (N || w != i.width || P != i.height) && vt(w, P), Ii(!1), fn = !0, Gt = !0, oi();
  }
  function vt(w, P) {
    i.width = Wt = Be = w, i.height = ln = ae = P, Ie = _e = 0, Xt(), wn();
    let N = i.bbox;
    et = N.left = cl(Ie * gt, 0.5), nt = N.top = cl(_e * gt, 0.5), it = N.width = cl(Be * gt, 0.5), St = N.height = cl(ae * gt, 0.5);
  }
  const Ft = 3;
  function bt() {
    let w = !1, P = 0;
    for (; !w; ) {
      P++;
      let N = Va(P), V = Fa(P);
      w = P == Ft || N && V, w || (vt(i.width, i.height), Gt = !0);
    }
  }
  function Pt({ width: w, height: P }) {
    Kt(w, P);
  }
  i.setSize = Pt;
  function Xt() {
    let w = !1, P = !1, N = !1, V = !1;
    O.forEach((ee, l) => {
      if (ee.show && ee._show) {
        let { side: o, _size: s } = ee, h = o % 2, g = ee.label != null ? ee.labelSize : 0, x = s + g;
        x > 0 && (h ? (Be -= x, o == 3 ? (Ie += x, V = !0) : N = !0) : (ae -= x, o == 0 ? (_e += x, w = !0) : P = !0));
      }
    }), cn[0] = w, cn[1] = N, cn[2] = P, cn[3] = V, Be -= li[1] + li[3], Ie += li[3], ae -= li[2] + li[0], _e += li[0];
  }
  function wn() {
    let w = Ie + Be, P = _e + ae, N = Ie, V = _e;
    function ee(l, o) {
      switch (l) {
        case 1:
          return w += o, w - o;
        case 2:
          return P += o, P - o;
        case 3:
          return N -= o, N + o;
        case 0:
          return V -= o, V + o;
      }
    }
    O.forEach((l, o) => {
      if (l.show && l._show) {
        let s = l.side;
        l._pos = ee(s, l._size), l.label != null && (l._lpos = ee(s, l.labelSize));
      }
    });
  }
  const De = i.cursor = Yt({}, sg, { drag: { y: a == 2 } }, e.cursor);
  if (De.dataIdx == null) {
    let w = De.hover, P = w.skip = new Set(w.skip ?? []);
    P.add(void 0);
    let N = w.prox = at(w.prox), V = w.bias ??= 0;
    De.dataIdx = (ee, l, o, s) => {
      if (l == 0)
        return o;
      let h = o, g = N(ee, l, o, s) ?? st, x = g >= 0 && g < st, S = A.ori == 0 ? Be : ae, _ = De.left, D = t[0], H = t[l];
      if (P.has(H[o])) {
        h = null;
        let L = null, X = null, ne;
        if (V == 0 || V == -1)
          for (ne = o; L == null && ne-- > 0; )
            P.has(H[ne]) || (L = ne);
        if (V == 0 || V == 1)
          for (ne = o; X == null && ne++ < H.length; )
            P.has(H[ne]) || (X = ne);
        if (L != null || X != null)
          if (x) {
            let de = L == null ? -1 / 0 : Y(D[L], A, S, 0), he = X == null ? 1 / 0 : Y(D[X], A, S, 0), pe = _ - de, we = he - _;
            pe <= we ? pe <= g && (h = L) : we <= g && (h = X);
          } else
            h = X == null ? L : L == null ? X : o - L <= X - o ? L : X;
      } else x && en(_ - Y(D[o], A, S, 0)) > g && (h = null);
      return h;
    };
  }
  const rn = (w) => {
    De.event = w;
  };
  De.idxs = le, De._lock = !1;
  let Rt = De.points;
  Rt.show = at(Rt.show), Rt.size = at(Rt.size), Rt.stroke = at(Rt.stroke), Rt.width = at(Rt.width), Rt.fill = at(Rt.fill);
  const hn = i.focus = Yt({}, e.focus || { alpha: 0.3 }, De.focus), Ti = hn.prox >= 0, Pi = Ti && Rt.one;
  let gn = [], un = [], vn = [];
  function On(w, P) {
    let N = Rt.show(i, P);
    if (N)
      return _n(N, ih), _n(N, w.class), ci(N, -10, -10, Be, ae), T.insertBefore(N, gn[P]), N;
  }
  function Bo(w, P) {
    if (a == 1 || P > 0) {
      let N = a == 1 && W[w.scale].time, V = w.value;
      w.value = N ? Or(V) ? Fr(ue, Vr(V, ie)) : V || ge : V || vg, w.label = w.label || (N ? ug : rg);
    }
    if (Pi || P > 0) {
      w.width = w.width == null ? 1 : w.width, w.paths = w.paths || Eg || wh, w.fillTo = at(w.fillTo || Sg), w.pxAlign = +dt(w.pxAlign, q), w.pxRound = Xr(w.pxAlign), w.stroke = at(w.stroke || null), w.fill = at(w.fill || null), w._stroke = w._fill = w._paths = w._focus = null;
      let N = yg(dn(1, w.width), 1), V = w.points = Yt({}, {
        size: N,
        width: dn(1, N * 0.2),
        stroke: w.stroke,
        space: N * 2,
        paths: Ig,
        _stroke: null,
        _fill: null
      }, w.points);
      V.show = at(V.show), V.filter = at(V.filter), V.fill = at(V.fill), V.stroke = at(V.stroke), V.paths = at(V.paths), V.pxAlign = w.pxAlign;
    }
    if (Oe) {
      let N = Tt(w, P);
      Te.splice(P, 0, N[0]), be.splice(P, 0, N[1]), ve.values.push(null);
    }
    if (De.show) {
      le.splice(P, 0, null);
      let N = null;
      Pi ? P == 0 && (N = On(w, P)) : P > 0 && (N = On(w, P)), gn.splice(P, 0, N), un.splice(P, 0, 0), vn.splice(P, 0, 0);
    }
    Dt("addSeries", P);
  }
  function Ra(w, P) {
    P = P ?? U.length, w = a == 1 ? Os(w, P, Hr, Ur) : Os(w, P, {}, Yr), U.splice(P, 0, w), Bo(U[P], P);
  }
  i.addSeries = Ra;
  function Ho(w) {
    if (U.splice(w, 1), Oe) {
      ve.values.splice(w, 1), be.splice(w, 1);
      let P = Te.splice(w, 1)[0];
      Wn(null, P.firstChild), P.remove();
    }
    De.show && (le.splice(w, 1), gn.splice(w, 1)[0].remove(), un.splice(w, 1), vn.splice(w, 1)), Dt("delSeries", w);
  }
  i.delSeries = Ho;
  const cn = [!1, !1, !1, !1];
  function Ue(w, P) {
    if (w._show = w.show, w.show) {
      let N = w.side % 2, V = W[w.scale];
      V == null && (w.scale = N ? U[1].scale : M, V = W[w.scale]);
      let ee = V.time;
      w.size = at(w.size), w.space = at(w.space), w.rotate = at(w.rotate), Hi(w.incrs) && w.incrs.forEach((o) => {
        !Yi.has(o) && Yi.set(o, mc(o));
      }), w.incrs = at(w.incrs || (V.distr == 2 ? Hh : ee ? F == 1 ? jh : Uh : dl)), w.splits = at(w.splits || (ee && V.distr == 1 ? Ee : V.distr == 3 ? $s : V.distr == 4 ? fg : dg)), w.stroke = at(w.stroke), w.grid.stroke = at(w.grid.stroke), w.ticks.stroke = at(w.ticks.stroke), w.border.stroke = at(w.border.stroke);
      let l = w.values;
      w.values = // static array of tick values
      Hi(l) && !Hi(l[0]) ? at(l) : (
        // temporal
        ee ? (
          // config array of fmtDate string tpls
          Hi(l) ? Nr(ue, Rr(l, ie)) : (
            // fmtDate string tpl
            Or(l) ? Qh(ue, l) : l || me
          )
        ) : l || cg
      ), w.filter = at(w.filter || (V.distr >= 3 && V.log == 10 ? pg : V.distr == 3 && V.log == 2 ? mg : gc)), w.font = eu(w.font), w.labelFont = eu(w.labelFont), w._size = w.size(i, null, P, 0), w._space = w._rotate = w._incrs = w._found = // foundIncrSpace
      w._splits = w._values = null, w._size > 0 && (cn[P] = !0, w._el = Vn(Zf, C));
    }
  }
  function $i(w, P, N, V) {
    let [ee, l, o, s] = N, h = P % 2, g = 0;
    return h == 0 && (s || l) && (g = P == 0 && !ee || P == 2 && !o ? Zt(Br.size / 3) : 0), h == 1 && (ee || o) && (g = P == 1 && !l || P == 3 && !s ? Zt(jr.size / 2) : 0), g;
  }
  const so = i.padding = (e.padding || [$i, $i, $i, $i]).map((w) => at(dt(w, $i))), li = i._padding = so.map((w, P) => w(i, P, cn, 0));
  let Qt, Ot = null, Bt = null;
  const kl = a == 1 ? U[0].idxs : null;
  let Sn = null, Xi = !1;
  function ro(w, P) {
    if (t = w ?? [], i.data = i._data = t, a == 2) {
      Qt = 0;
      for (let N = 1; N < U.length; N++)
        Qt += t[N][0].length;
    } else {
      t.length == 0 && (i.data = i._data = t = [[]]), Sn = t[0], Qt = Sn.length;
      let N = t;
      if (Z == 2) {
        N = t.slice();
        let V = N[0] = Array(Qt);
        for (let ee = 0; ee < Qt; ee++)
          V[ee] = ee;
      }
      i._data = t = N;
    }
    if (Ii(!0), Dt("setData"), Z == 2 && (fn = !0), P !== !1) {
      let N = A;
      N.auto(i, Xi) ? uo() : an(M, N.min, N.max), sn = sn || De.left >= 0, Mt = !0, oi();
    }
  }
  i.setData = ro;
  function uo() {
    Xi = !0;
    let w, P;
    a == 1 && (Qt > 0 ? (Ot = kl[0] = 0, Bt = kl[1] = Qt - 1, w = t[0][Ot], P = t[0][Bt], Z == 2 ? (w = Ot, P = Bt) : w == P && (Z == 3 ? [w, P] = Ea(w, w, A.log, !1) : Z == 4 ? [w, P] = Hs(w, w, A.log, !1) : A.time ? P = w + Zt(86400 / F) : [w, P] = _a(w, P, Ws, !0))) : (Ot = kl[0] = w = null, Bt = kl[1] = P = null)), an(M, w, P);
  }
  let Qi, hi, Ei, Cl, Ji, _l, co, Zi, fo, kn;
  function Wo(w, P, N, V, ee, l) {
    w ??= mr, N ??= Gs, V ??= "butt", ee ??= mr, l ??= "round", w != Qi && (v.strokeStyle = Qi = w), ee != hi && (v.fillStyle = hi = ee), P != Ei && (v.lineWidth = Ei = P), l != Ji && (v.lineJoin = Ji = l), V != _l && (v.lineCap = _l = V), N != Cl && v.setLineDash(Cl = N);
  }
  function jo(w, P, N, V) {
    P != hi && (v.fillStyle = hi = P), w != co && (v.font = co = w), N != Zi && (v.textAlign = Zi = N), V != fo && (v.textBaseline = fo = V);
  }
  function ho(w, P, N, V, ee = 0) {
    if (V.length > 0 && w.auto(i, Xi) && (P == null || P.min == null)) {
      let l = dt(Ot, 0), o = dt(Bt, V.length - 1), s = N.min == null ? w.distr == 3 ? ph(V, l, o) : gh(V, l, o, ee) : [N.min, N.max];
      w.min = Hn(w.min, N.min = s[0]), w.max = dn(w.max, N.max = s[1]);
    }
  }
  const Go = { min: null, max: null };
  function Na() {
    for (let V in W) {
      let ee = W[V];
      j[V] == null && // scales that have never been set (on init)
      (ee.min == null || // or auto scales when the x scale was explicitly set
      j[M] != null && ee.auto(i, Xi)) && (j[V] = Go);
    }
    for (let V in W) {
      let ee = W[V];
      j[V] == null && ee.from != null && j[ee.from] != null && (j[V] = Go);
    }
    j[M] != null && Ii(!0);
    let w = {};
    for (let V in j) {
      let ee = j[V];
      if (ee != null) {
        let l = w[V] = Zl(W[V], Ch);
        if (ee.min != null)
          Yt(l, ee);
        else if (V != M || a == 2)
          if (Qt == 0 && l.from == null) {
            let o = l.range(i, null, null, V);
            l.min = o[0], l.max = o[1];
          } else
            l.min = st, l.max = -st;
      }
    }
    if (Qt > 0) {
      U.forEach((V, ee) => {
        if (a == 1) {
          let l = V.scale, o = j[l];
          if (o == null)
            return;
          let s = w[l];
          if (ee == 0) {
            let h = s.range(i, s.min, s.max, l);
            s.min = h[0], s.max = h[1], Ot = ei(s.min, t[0]), Bt = ei(s.max, t[0]), Bt - Ot > 1 && (t[0][Ot] < s.min && Ot++, t[0][Bt] > s.max && Bt--), V.min = Sn[Ot], V.max = Sn[Bt];
          } else V.show && V.auto && ho(s, o, V, t[ee], V.sorted);
          V.idxs[0] = Ot, V.idxs[1] = Bt;
        } else if (ee > 0 && V.show && V.auto) {
          let [l, o] = V.facets, s = l.scale, h = o.scale, [g, x] = t[ee], S = w[s], _ = w[h];
          S != null && ho(S, j[s], l, g, l.sorted), _ != null && ho(_, j[h], o, x, o.sorted), V.min = o.min, V.max = o.max;
        }
      });
      for (let V in w) {
        let ee = w[V], l = j[V];
        if (ee.from == null && (l == null || l.min == null)) {
          let o = ee.range(
            i,
            ee.min == st ? null : ee.min,
            ee.max == -st ? null : ee.max,
            V
          );
          ee.min = o[0], ee.max = o[1];
        }
      }
    }
    for (let V in w) {
      let ee = w[V];
      if (ee.from != null) {
        let l = w[ee.from];
        if (l.min == null)
          ee.min = ee.max = null;
        else {
          let o = ee.range(i, l.min, l.max, V);
          ee.min = o[0], ee.max = o[1];
        }
      }
    }
    let P = {}, N = !1;
    for (let V in w) {
      let ee = w[V], l = W[V];
      if (l.min != ee.min || l.max != ee.max) {
        l.min = ee.min, l.max = ee.max;
        let o = l.distr;
        l._min = o == 3 ? Ci(l.min) : o == 4 ? os(l.min, l.asinh) : o == 100 ? l.fwd(l.min) : l.min, l._max = o == 3 ? Ci(l.max) : o == 4 ? os(l.max, l.asinh) : o == 100 ? l.fwd(l.max) : l.max, P[V] = N = !0;
      }
    }
    if (N) {
      U.forEach((V, ee) => {
        a == 2 ? ee > 0 && P.y && (V._paths = null) : P[V.scale] && (V._paths = null);
      });
      for (let V in P)
        fn = !0, Dt("setScale", V);
      De.show && De.left >= 0 && (sn = Mt = !0);
    }
    for (let V in j)
      j[V] = null;
  }
  function Yo(w) {
    let P = Ps(Ot - 1, 0, Qt - 1), N = Ps(Bt + 1, 0, Qt - 1);
    for (; w[P] == null && P > 0; )
      P--;
    for (; w[N] == null && N < Qt - 1; )
      N++;
    return [P, N];
  }
  function zl() {
    Qt > 0 && (U.forEach((w, P) => {
      if (P > 0 && w.show && (gi(P, !1), gi(P, !0), w._paths == null)) {
        kn != w.alpha && (v.globalAlpha = kn = w.alpha);
        let N = a == 2 ? [0, t[P][0].length - 1] : Yo(t[P]);
        w._paths = w.paths(i, P, N[0], N[1]), kn != 1 && (v.globalAlpha = kn = 1);
      }
    }), U.forEach((w, P) => {
      if (P > 0 && w.show) {
        kn != w.alpha && (v.globalAlpha = kn = w.alpha), w._paths != null && Ml(P, !1);
        {
          let N = w._paths != null ? w._paths.gaps : null, V = w.points.show(i, P, Ot, Bt, N), ee = w.points.filter(i, P, V, N);
          (V || ee) && (w.points._paths = w.points.paths(i, P, Ot, Bt, ee), Ml(P, !0));
        }
        kn != 1 && (v.globalAlpha = kn = 1), Dt("drawSeries", P);
      }
    }));
  }
  function gi(w, P) {
    let N = P ? U[w].points : U[w];
    N._stroke = N.stroke(i, w), N._fill = N.fill(i, w);
  }
  function Ml(w, P) {
    let N = P ? U[w].points : U[w], {
      stroke: V,
      fill: ee,
      clip: l,
      flags: o,
      _stroke: s = N._stroke,
      _fill: h = N._fill,
      _width: g = N.width
    } = N._paths;
    g = zt(g * gt, 3);
    let x = null, S = g % 2 / 2;
    P && h == null && (h = g > 0 ? "#fff" : s);
    let _ = N.pxAlign == 1 && S > 0;
    if (_ && v.translate(S, S), !P) {
      let D = et - g / 2, H = nt - g / 2, L = it + g, X = St + g;
      x = new Path2D(), x.rect(D, H, L, X);
    }
    P ? pi(s, g, N.dash, N.cap, h, V, ee, o, l) : Tl(w, s, g, N.dash, N.cap, h, V, ee, o, x, l), _ && v.translate(-S, -S);
  }
  function Tl(w, P, N, V, ee, l, o, s, h, g, x) {
    let S = !1;
    h != 0 && te.forEach((_, D) => {
      if (_.series[0] == w) {
        let H = U[_.series[1]], L = t[_.series[1]], X = (H._paths || Ao).band;
        Hi(X) && (X = _.dir == 1 ? X[0] : X[1]);
        let ne, de = null;
        H.show && X && vh(L, Ot, Bt) ? (de = _.fill(i, D) || l, ne = H._paths.clip) : X = null, pi(P, N, V, ee, de, o, s, h, g, x, ne, X), S = !0;
      }
    }), S || pi(P, N, V, ee, l, o, s, h, g, x);
  }
  const jn = eo | Is;
  function pi(w, P, N, V, ee, l, o, s, h, g, x, S) {
    Wo(w, P, N, V, ee), (h || g || S) && (v.save(), h && v.clip(h), g && v.clip(g)), S ? (s & jn) == jn ? (v.clip(S), x && v.clip(x), el(ee, o), Pl(w, l, P)) : s & Is ? (el(ee, o), v.clip(S), Pl(w, l, P)) : s & eo && (v.save(), v.clip(S), x && v.clip(x), el(ee, o), v.restore(), Pl(w, l, P)) : (el(ee, o), Pl(w, l, P)), (h || g || S) && v.restore();
  }
  function Pl(w, P, N) {
    N > 0 && (P instanceof Map ? P.forEach((V, ee) => {
      v.strokeStyle = Qi = ee, v.stroke(V);
    }) : P != null && w && v.stroke(P));
  }
  function el(w, P) {
    P instanceof Map ? P.forEach((N, V) => {
      v.fillStyle = hi = V, v.fill(N);
    }) : P != null && w && v.fill(P);
  }
  function Uo(w, P, N, V) {
    let ee = O[w], l;
    if (V <= 0)
      l = [0, 0];
    else {
      let o = ee._space = ee.space(i, w, P, N, V), s = ee._incrs = ee.incrs(i, w, P, N, V, o);
      l = Rg(P, N, s, V, o);
    }
    return ee._found = l;
  }
  function tl(w, P, N, V, ee, l, o, s, h, g) {
    let x = o % 2 / 2;
    q == 1 && v.translate(x, x), Wo(s, o, h, g, s), v.beginPath();
    let S, _, D, H, L = ee + (V == 0 || V == 3 ? -l : l);
    N == 0 ? (_ = ee, H = L) : (S = ee, D = L);
    for (let X = 0; X < w.length; X++)
      P[X] != null && (N == 0 ? S = D = w[X] : _ = H = w[X], v.moveTo(S, _), v.lineTo(D, H));
    v.stroke(), q == 1 && v.translate(-x, -x);
  }
  function Va(w) {
    let P = !0;
    return O.forEach((N, V) => {
      if (!N.show)
        return;
      let ee = W[N.scale];
      if (ee.min == null) {
        N._show && (P = !1, N._show = !1, Ii(!1));
        return;
      } else
        N._show || (P = !1, N._show = !0, Ii(!1));
      let l = N.side, o = l % 2, { min: s, max: h } = ee, [g, x] = Uo(V, s, h, o == 0 ? Be : ae);
      if (x == 0)
        return;
      let S = ee.distr == 2, _ = N._splits = N.splits(i, V, s, h, g, x, S), D = ee.distr == 2 ? _.map((ne) => Sn[ne]) : _, H = ee.distr == 2 ? Sn[_[1]] - Sn[_[0]] : g, L = N._values = N.values(i, N.filter(i, D, V, x, H), V, x, H);
      N._rotate = l == 2 ? N.rotate(i, L, V, x) : 0;
      let X = N._size;
      N._size = Bn(N.size(i, L, V, w)), X != null && N._size != X && (P = !1);
    }), P;
  }
  function Fa(w) {
    let P = !0;
    return so.forEach((N, V) => {
      let ee = N(i, V, cn, w);
      ee != li[V] && (P = !1), li[V] = ee;
    }), P;
  }
  function Ko() {
    for (let w = 0; w < O.length; w++) {
      let P = O[w];
      if (!P.show || !P._show)
        continue;
      let N = P.side, V = N % 2, ee, l, o = P.stroke(i, w), s = N == 0 || N == 3 ? -1 : 1;
      if (P.label) {
        let Ct = P.labelGap * s, Vt = Zt((P._lpos + Ct) * gt);
        jo(P.labelFont[0], o, "center", N == 2 ? So : pr), v.save(), V == 1 ? (ee = l = 0, v.translate(
          Vt,
          Zt(nt + St / 2)
        ), v.rotate((N == 3 ? -ya : ya) / 2)) : (ee = Zt(et + it / 2), l = Vt), v.fillText(P.label, ee, l), v.restore();
      }
      let [h, g] = P._found;
      if (g == 0)
        continue;
      let x = W[P.scale], S = V == 0 ? it : St, _ = V == 0 ? et : nt, D = Zt(P.gap * gt), H = P._splits, L = x.distr == 2 ? H.map((Ct) => Sn[Ct]) : H, X = x.distr == 2 ? Sn[H[1]] - Sn[H[0]] : h, ne = P.ticks, de = P.border, he = ne.show ? Zt(ne.size * gt) : 0, pe = P._rotate * -ya / 180, we = Q(P._pos * gt), Se = (he + D) * s, $e = we + Se;
      l = V == 0 ? $e : 0, ee = V == 1 ? $e : 0;
      let Ve = P.font[0], Ke = P.align == 1 ? Ll : P.align == 2 ? is : pe > 0 ? Ll : pe < 0 ? is : V == 0 ? "center" : N == 3 ? is : Ll, Re = pe || V == 1 ? "middle" : N == 2 ? So : pr;
      jo(Ve, o, Ke, Re);
      let We = P.font[1] * P.lineGap, ht = H.map((Ct) => Q(c(Ct, x, S, _))), rt = P._values;
      for (let Ct = 0; Ct < rt.length; Ct++) {
        let Vt = rt[Ct];
        if (Vt != null) {
          V == 0 ? ee = ht[Ct] : l = ht[Ct], Vt = "" + Vt;
          let Kn = Vt.indexOf(`
`) == -1 ? [Vt] : Vt.split(/\n/gm);
          for (let yn = 0; yn < Kn.length; yn++) {
            let Ln = Kn[yn];
            pe ? (v.save(), v.translate(ee, l + yn * We), v.rotate(pe), v.fillText(Ln, 0, 0), v.restore()) : v.fillText(Ln, ee, l + yn * We);
          }
        }
      }
      ne.show && tl(
        ht,
        ne.filter(i, L, w, g, X),
        V,
        N,
        we,
        he,
        zt(ne.width * gt, 3),
        ne.stroke(i, w),
        ne.dash,
        ne.cap
      );
      let yt = P.grid;
      yt.show && tl(
        ht,
        yt.filter(i, L, w, g, X),
        V,
        V == 0 ? 2 : 1,
        V == 0 ? nt : et,
        V == 0 ? St : it,
        zt(yt.width * gt, 3),
        yt.stroke(i, w),
        yt.dash,
        yt.cap
      ), de.show && tl(
        [we],
        [1],
        V == 0 ? 1 : 0,
        V == 0 ? 1 : 2,
        V == 1 ? nt : et,
        V == 1 ? St : it,
        zt(de.width * gt, 3),
        de.stroke(i, w),
        de.dash,
        de.cap
      );
    }
    Dt("drawAxes");
  }
  function Ii(w) {
    U.forEach((P, N) => {
      N > 0 && (P._paths = null, w && (a == 1 ? (P.min = null, P.max = null) : P.facets.forEach((V) => {
        V.min = null, V.max = null;
      })));
    });
  }
  let $l = !1, El = !1, Ai = [];
  function Ba() {
    El = !1;
    for (let w = 0; w < Ai.length; w++)
      Dt(...Ai[w]);
    Ai.length = 0;
  }
  function oi() {
    $l || (Eh(go), $l = !0);
  }
  function Ha(w, P = !1) {
    $l = !0, El = P, w(i), go(), P && Ai.length > 0 && queueMicrotask(Ba);
  }
  i.batch = Ha;
  function go() {
    if (Lt && (Na(), Lt = !1), fn && (bt(), fn = !1), Gt) {
      if (Et(z, Ll, Ie), Et(z, So, _e), Et(z, Mo, Be), Et(z, To, ae), Et(T, Ll, Ie), Et(T, So, _e), Et(T, Mo, Be), Et(T, To, ae), Et(C, Mo, Wt), Et(C, To, ln), b.width = Zt(Wt * gt), b.height = Zt(ln * gt), O.forEach(({ _el: w, _show: P, _size: N, _pos: V, side: ee }) => {
        if (w != null)
          if (P) {
            let l = ee === 3 || ee === 0 ? N : 0, o = ee % 2 == 1;
            Et(w, o ? "left" : "top", V - l), Et(w, o ? "width" : "height", N), Et(w, o ? "top" : "left", o ? _e : Ie), Et(w, o ? "height" : "width", o ? ae : Be), Ms(w, hl);
          } else
            _n(w, hl);
      }), Qi = hi = Ei = Ji = _l = co = Zi = fo = Cl = null, kn = 1, Vi(!0), Ie != je || _e != ct || Be != Ye || ae != Le) {
        Ii(!1);
        let w = Be / Ye, P = ae / Le;
        if (De.show && !sn && De.left >= 0) {
          De.left *= w, De.top *= P, mi && ci(mi, Zt(De.left), 0, Be, ae), vi && ci(vi, 0, Zt(De.top), Be, ae);
          for (let N = 0; N < gn.length; N++) {
            let V = gn[N];
            V != null && (un[N] *= w, vn[N] *= P, ci(V, Bn(un[N]), Bn(vn[N]), Be, ae));
          }
        }
        if (wt.show && !Ut && wt.left >= 0 && wt.width > 0) {
          wt.left *= w, wt.width *= w, wt.top *= P, wt.height *= P;
          for (let N in bo)
            Et(ai, N, wt[N]);
        }
        je = Ie, ct = _e, Ye = Be, Le = ae;
      }
      Dt("setSize"), Gt = !1;
    }
    Wt > 0 && ln > 0 && (v.clearRect(0, 0, b.width, b.height), Dt("drawClear"), J.forEach((w) => w()), Dt("draw")), wt.show && Ut && (Il(wt), Ut = !1), De.show && sn && (ui(null, !0, !1), sn = !1), ve.show && ve.live && Mt && (Ni(), Mt = !1), p || (p = !0, i.status = 1, Dt("ready")), Xi = !1, $l = !1;
  }
  i.redraw = (w, P) => {
    fn = P || !1, w !== !1 ? an(M, A.min, A.max) : oi();
  };
  function po(w, P) {
    let N = W[w];
    if (N.from == null) {
      if (Qt == 0) {
        let V = N.range(i, P.min, P.max, w);
        P.min = V[0], P.max = V[1];
      }
      if (P.min > P.max) {
        let V = P.min;
        P.min = P.max, P.max = V;
      }
      if (Qt > 1 && P.min != null && P.max != null && P.max - P.min < 1e-16)
        return;
      w == M && N.distr == 2 && Qt > 0 && (P.min = ei(P.min, t[0]), P.max = ei(P.max, t[0]), P.min == P.max && P.max++), j[w] = P, Lt = !0, oi();
    }
  }
  i.setScale = po;
  let Oi, mo, mi, vi, Xo, vo, yi, Di, qi, nl, kt, xt, Gn = !1;
  const Jt = De.drag;
  let Ht = Jt.x, jt = Jt.y;
  De.show && (De.x && (Oi = Vn(th, T)), De.y && (mo = Vn(nh, T)), A.ori == 0 ? (mi = Oi, vi = mo) : (mi = mo, vi = Oi), kt = De.left, xt = De.top);
  const wt = i.select = Yt({
    show: !0,
    over: !0,
    left: 0,
    width: 0,
    top: 0,
    height: 0
  }, e.select), ai = wt.show ? Vn(eh, wt.over ? T : z) : null;
  function Il(w, P) {
    if (wt.show) {
      for (let N in w)
        wt[N] = w[N], N in bo && Et(ai, N, w[N]);
      P !== !1 && Dt("setSelect");
    }
  }
  i.setSelect = Il;
  function Wa(w, P) {
    let N = U[w], V = Oe ? Te[w] : null;
    if (N.show)
      V && Ms(V, hl);
    else {
      V && _n(V, hl);
      let ee = Pi ? gn[0] : gn[w];
      ci(ee, -10, -10, Be, ae);
    }
  }
  function an(w, P, N) {
    po(w, { min: P, max: N });
  }
  function Dn(w, P, N, V) {
    P.focus != null && Ya(w), P.show != null && U.forEach((ee, l) => {
      l > 0 && (w == l || w == null) && (ee.show = P.show, Wa(l, P.show), a == 2 ? (an(ee.facets[0].scale, null, null), an(ee.facets[1].scale, null, null)) : an(ee.scale, null, null), oi());
    }), N !== !1 && Dt("setSeries", w, P), V && ol("setSeries", i, w, P);
  }
  i.setSeries = Dn;
  function ja(w, P) {
    Yt(te[w], P);
  }
  function Ga(w, P) {
    w.fill = at(w.fill || null), w.dir = dt(w.dir, -1), P = P ?? te.length, te.splice(P, 0, w);
  }
  function Qo(w) {
    w == null ? te.length = 0 : te.splice(w, 1);
  }
  i.addBand = Ga, i.setBand = ja, i.delBand = Qo;
  function Jo(w, P) {
    U[w].alpha = P, De.show && gn[w] && (gn[w].style.opacity = P), Oe && Te[w] && (Te[w].style.opacity = P);
  }
  let $t, si, bi;
  const Li = { focus: !0 };
  function Ya(w) {
    if (w != bi) {
      let P = w == null, N = hn.alpha != 1;
      U.forEach((V, ee) => {
        if (a == 1 || ee > 0) {
          let l = P || ee == 0 || ee == w;
          V._focus = P ? null : l, N && Jo(ee, l ? 1 : hn.alpha);
        }
      }), bi = w, N && oi();
    }
  }
  Oe && Ti && At(xr, ke, (w) => {
    De._lock || (rn(w), bi != null && Dn(null, Li, !0, Nt.setSeries));
  });
  function qn(w, P, N) {
    let V = W[P];
    N && (w = w / gt - (V.ori == 1 ? _e : Ie));
    let ee = Be;
    V.ori == 1 && (ee = ae, w = ee - w), V.dir == -1 && (w = ee - w);
    let l = V._min, o = V._max, s = w / ee, h = l + (o - l) * s, g = V.distr;
    return g == 3 ? Ql(10, h) : g == 4 ? bh(h, V.asinh) : g == 100 ? V.bwd(h) : h;
  }
  function Ua(w, P) {
    let N = qn(w, M, P);
    return ei(N, t[0], Ot, Bt);
  }
  i.valToIdx = (w) => ei(w, t[0]), i.posToIdx = Ua, i.posToVal = qn, i.valToPos = (w, P, N) => W[P].ori == 0 ? f(
    w,
    W[P],
    N ? it : Be,
    N ? et : 0
  ) : u(
    w,
    W[P],
    N ? St : ae,
    N ? nt : 0
  ), i.setCursor = (w, P, N) => {
    kt = w.left, xt = w.top, ui(null, P, N);
  };
  function Zo(w, P) {
    Et(ai, Ll, wt.left = w), Et(ai, Mo, wt.width = P);
  }
  function ea(w, P) {
    Et(ai, So, wt.top = w), Et(ai, To, wt.height = P);
  }
  let Ri = A.ori == 0 ? Zo : ea, ri = A.ori == 1 ? Zo : ea;
  function xi() {
    if (Oe && ve.live)
      for (let w = a == 2 ? 1 : 0; w < U.length; w++) {
        if (w == 0 && Je)
          continue;
        let P = ve.values[w], N = 0;
        for (let V in P)
          be[w][N++].firstChild.nodeValue = P[V];
      }
  }
  function Ni(w, P) {
    if (w != null && (w.idxs ? w.idxs.forEach((N, V) => {
      le[V] = N;
    }) : kh(w.idx) || le.fill(w.idx), ve.idx = le[0]), Oe && ve.live) {
      for (let N = 0; N < U.length; N++)
        (N > 0 || a == 1 && !Je) && Ka(N, le[N]);
      xi();
    }
    Mt = !1, P !== !1 && Dt("setLegend");
  }
  i.setLegend = Ni;
  function Ka(w, P) {
    let N = U[w], V = w == 0 && Z == 2 ? Sn : t[w], ee;
    Je ? ee = N.values(i, w, P) ?? Ge : (ee = N.value(i, P == null ? null : V[P], w, P), ee = ee == null ? Ge : { _: ee }), ve.values[w] = ee;
  }
  function ui(w, P, N) {
    qi = kt, nl = xt, [kt, xt] = De.move(i, kt, xt), De.left = kt, De.top = xt, De.show && (mi && ci(mi, Zt(kt), 0, Be, ae), vi && ci(vi, 0, Zt(xt), Be, ae));
    let V, ee = Ot > Bt;
    $t = st, si = null;
    let l = A.ori == 0 ? Be : ae, o = A.ori == 1 ? Be : ae;
    if (kt < 0 || Qt == 0 || ee) {
      V = De.idx = null;
      for (let s = 0; s < U.length; s++) {
        let h = gn[s];
        h != null && ci(h, -10, -10, Be, ae);
      }
      Ti && Dn(null, Li, !0, w == null && Nt.setSeries), ve.live && (le.fill(V), Mt = !0);
    } else {
      let s, h, g;
      a == 1 && (s = A.ori == 0 ? kt : xt, h = qn(s, M), V = De.idx = ei(h, t[0], Ot, Bt), g = Y(t[0][V], A, l, 0));
      let x = -10, S = -10, _ = 0, D = 0, H = !0, L = "", X = "";
      for (let ne = a == 2 ? 1 : 0; ne < U.length; ne++) {
        let de = U[ne], he = le[ne], pe = he == null ? null : a == 1 ? t[ne][he] : t[ne][1][he], we = De.dataIdx(i, ne, V, h), Se = we == null ? null : a == 1 ? t[ne][we] : t[ne][1][we];
        Mt = Mt || Se != pe || we != he, le[ne] = we;
        let $e = we == V ? g : Y(a == 1 ? t[0][we] : t[ne][0][we], A, l, 0);
        if (ne > 0 && de.show) {
          let Ve = Se == null ? -10 : $(Se, a == 1 ? W[de.scale] : W[de.facets[1].scale], o, 0);
          if (Ti && Se != null) {
            let Ke = A.ori == 1 ? kt : xt, Re = en(hn.dist(i, ne, we, Ve, Ke));
            if (Re < $t) {
              let We = hn.bias;
              if (We != 0) {
                let ht = qn(Ke, de.scale), rt = Se >= 0 ? 1 : -1, yt = ht >= 0 ? 1 : -1;
                yt == rt && (yt == 1 ? We == 1 ? Se >= ht : Se <= ht : (
                  // >= 0
                  We == 1 ? Se <= ht : Se >= ht
                )) && ($t = Re, si = ne);
              } else
                $t = Re, si = ne;
            }
          }
          if (Mt || Pi) {
            let Ke, Re;
            A.ori == 0 ? (Ke = $e, Re = Ve) : (Ke = Ve, Re = $e);
            let We, ht, rt, yt, Ct, Vt, Kn = !0, yn = Rt.bbox;
            if (yn != null) {
              Kn = !1;
              let Ln = yn(i, ne);
              rt = Ln.left, yt = Ln.top, We = Ln.width, ht = Ln.height;
            } else
              rt = Ke, yt = Re, We = ht = Rt.size(i, ne);
            if (Vt = Rt.fill(i, ne), Ct = Rt.stroke(i, ne), Pi)
              ne == si && $t <= hn.prox && (x = rt, S = yt, _ = We, D = ht, H = Kn, L = Vt, X = Ct);
            else {
              let Ln = gn[ne];
              Ln != null && (un[ne] = rt, vn[ne] = yt, Mr(Ln, We, ht, Kn), _r(Ln, Vt, Ct), ci(Ln, Bn(rt), Bn(yt), Be, ae));
            }
          }
        }
      }
      if (Pi) {
        let ne = hn.prox, de = bi == null ? $t <= ne : $t > ne || si != bi;
        if (Mt || de) {
          let he = gn[0];
          un[0] = x, vn[0] = S, Mr(he, _, D, H), _r(he, L, X), ci(he, Bn(x), Bn(S), Be, ae);
        }
      }
    }
    if (wt.show && Gn)
      if (w != null) {
        let [s, h] = Nt.scales, [g, x] = Nt.match, [S, _] = w.cursor.sync.scales, D = w.cursor.drag;
        if (Ht = D._x, jt = D._y, Ht || jt) {
          let { left: H, top: L, width: X, height: ne } = w.select, de = w.scales[S].ori, he = w.posToVal, pe, we, Se, $e, Ve, Ke = s != null && g(s, S), Re = h != null && x(h, _);
          Ke && Ht ? (de == 0 ? (pe = H, we = X) : (pe = L, we = ne), Se = W[s], $e = Y(he(pe, S), Se, l, 0), Ve = Y(he(pe + we, S), Se, l, 0), Ri(Hn($e, Ve), en(Ve - $e))) : Ri(0, l), Re && jt ? (de == 1 ? (pe = H, we = X) : (pe = L, we = ne), Se = W[h], $e = $(he(pe, _), Se, o, 0), Ve = $(he(pe + we, _), Se, o, 0), ri(Hn($e, Ve), en(Ve - $e))) : ri(0, o);
        } else
          Al();
      } else {
        let s = en(qi - Xo), h = en(nl - vo);
        if (A.ori == 1) {
          let _ = s;
          s = h, h = _;
        }
        Ht = Jt.x && s >= Jt.dist, jt = Jt.y && h >= Jt.dist;
        let g = Jt.uni;
        g != null ? Ht && jt && (Ht = s >= g, jt = h >= g, !Ht && !jt && (h > s ? jt = !0 : Ht = !0)) : Jt.x && Jt.y && (Ht || jt) && (Ht = jt = !0);
        let x, S;
        Ht && (A.ori == 0 ? (x = yi, S = kt) : (x = Di, S = xt), Ri(Hn(x, S), en(S - x)), jt || ri(0, o)), jt && (A.ori == 1 ? (x = yi, S = kt) : (x = Di, S = xt), ri(Hn(x, S), en(S - x)), Ht || Ri(0, l)), !Ht && !jt && (Ri(0, 0), ri(0, 0));
      }
    if (Jt._x = Ht, Jt._y = jt, w == null) {
      if (N) {
        if (ql != null) {
          let [s, h] = Nt.scales;
          Nt.values[0] = s != null ? qn(A.ori == 0 ? kt : xt, s) : null, Nt.values[1] = h != null ? qn(A.ori == 1 ? kt : xt, h) : null;
        }
        ol(vr, i, kt, xt, Be, ae, V);
      }
      if (Ti) {
        let s = N && Nt.setSeries, h = hn.prox;
        bi == null ? $t <= h && Dn(si, Li, !0, s) : $t > h ? Dn(null, Li, !0, s) : si != bi && Dn(si, Li, !0, s);
      }
    }
    Mt && (ve.idx = V, Ni()), P !== !1 && Dt("setCursor");
  }
  let Yn = null;
  Object.defineProperty(i, "rect", {
    get() {
      return Yn == null && Vi(!1), Yn;
    }
  });
  function Vi(w = !1) {
    w ? Yn = null : (Yn = T.getBoundingClientRect(), Dt("syncRect", Yn));
  }
  function Fi(w, P, N, V, ee, l, o) {
    De._lock || Gn && w != null && w.movementX == 0 && w.movementY == 0 || (yo(w, P, N, V, ee, l, o, !1, w != null), w != null ? ui(null, !0, !0) : ui(P, !0, !1));
  }
  function yo(w, P, N, V, ee, l, o, s, h) {
    if (Yn == null && Vi(!1), rn(w), w != null)
      N = w.clientX - Yn.left, V = w.clientY - Yn.top;
    else {
      if (N < 0 || V < 0) {
        kt = -10, xt = -10;
        return;
      }
      let [g, x] = Nt.scales, S = P.cursor.sync, [_, D] = S.values, [H, L] = S.scales, [X, ne] = Nt.match, de = P.axes[0].side % 2 == 1, he = A.ori == 0 ? Be : ae, pe = A.ori == 1 ? Be : ae, we = de ? l : ee, Se = de ? ee : l, $e = de ? V : N, Ve = de ? N : V;
      if (H != null ? N = X(g, H) ? c(_, W[g], he, 0) : -10 : N = he * ($e / we), L != null ? V = ne(x, L) ? c(D, W[x], pe, 0) : -10 : V = pe * (Ve / Se), A.ori == 1) {
        let Ke = N;
        N = V, V = Ke;
      }
    }
    h && ((N <= 1 || N >= Be - 1) && (N = cl(N, Be)), (V <= 1 || V >= ae - 1) && (V = cl(V, ae))), s ? (Xo = N, vo = V, [yi, Di] = De.move(i, N, V)) : (kt = N, xt = V);
  }
  const bo = {
    width: 0,
    height: 0,
    left: 0,
    top: 0
  };
  function Al() {
    Il(bo, !1);
  }
  let ta, na, ia, Ol;
  function la(w, P, N, V, ee, l, o) {
    Gn = !0, Ht = jt = Jt._x = Jt._y = !1, yo(w, P, N, V, ee, l, o, !0, !1), w != null && (At(ls, _s, il, !1), ol(yr, i, yi, Di, Be, ae, null));
    let { left: s, top: h, width: g, height: x } = wt;
    ta = s, na = h, ia = g, Ol = x, Al();
  }
  function il(w, P, N, V, ee, l, o) {
    Gn = Jt._x = Jt._y = !1, yo(w, P, N, V, ee, l, o, !1, !0);
    let { left: s, top: h, width: g, height: x } = wt, S = g > 0 || x > 0, _ = ta != s || na != h || ia != g || Ol != x;
    if (S && _ && Il(wt), Jt.setScale && S && _) {
      let D = s, H = g, L = h, X = x;
      if (A.ori == 1 && (D = h, H = x, L = s, X = g), Ht && an(
        M,
        qn(D, M),
        qn(D + H, M)
      ), jt)
        for (let ne in W) {
          let de = W[ne];
          ne != M && de.from == null && de.min != st && an(
            ne,
            qn(L + X, ne),
            qn(L, ne)
          );
        }
      Al();
    } else De.lock && (De._lock = !De._lock, ui(null, !0, !1));
    w != null && (Wn(ls, _s), ol(ls, i, kt, xt, Be, ae, null));
  }
  function Xa(w, P, N, V, ee, l, o) {
    if (De._lock)
      return;
    rn(w);
    let s = Gn;
    if (Gn) {
      let h = !0, g = !0, x = 10, S, _;
      A.ori == 0 ? (S = Ht, _ = jt) : (S = jt, _ = Ht), S && _ && (h = kt <= x || kt >= Be - x, g = xt <= x || xt >= ae - x), S && h && (kt = kt < yi ? 0 : Be), _ && g && (xt = xt < Di ? 0 : ae), ui(null, !0, !0), Gn = !1;
    }
    kt = -10, xt = -10, ui(null, !0, !0), s && (Gn = s);
  }
  function Dl(w, P, N, V, ee, l, o) {
    De._lock || (rn(w), uo(), Al(), w != null && ol(wr, i, kt, xt, Be, ae, null));
  }
  function oa() {
    O.forEach(Ng), Kt(i.width, i.height, !0);
  }
  gl(Ca, Gl, oa);
  const Bi = {};
  Bi.mousedown = la, Bi.mousemove = Fi, Bi.mouseup = il, Bi.dblclick = Dl, Bi.setSeries = (w, P, N, V) => {
    let ee = Nt.match[2];
    N = ee(i, P, N), N != -1 && Dn(N, V, !0, !1);
  }, De.show && (At(yr, T, la), At(vr, T, Fi), At(br, T, (w) => {
    rn(w), Vi(!1);
  }), At(xr, T, Xa), At(wr, T, Dl), As.add(i), i.syncRect = Vi);
  const ll = i.hooks = e.hooks || {};
  function Dt(w, P, N) {
    El ? Ai.push([w, P, N]) : w in ll && ll[w].forEach((V) => {
      V.call(null, i, P, N);
    });
  }
  (e.plugins || []).forEach((w) => {
    for (let P in w.hooks)
      ll[P] = (ll[P] || []).concat(w.hooks[P]);
  });
  const Un = (w, P, N) => N, Nt = Yt({
    key: null,
    setSeries: !1,
    filters: {
      pub: Ir,
      sub: Ir
    },
    scales: [M, U[1] ? U[1].scale : null],
    match: [Ar, Ar, Un],
    values: [null, null]
  }, De.sync);
  Nt.match.length == 2 && Nt.match.push(Un), De.sync = Nt;
  const ql = Nt.key, xo = qc(ql);
  function ol(w, P, N, V, ee, l, o) {
    Nt.filters.pub(w, P, N, V, ee, l, o) && xo.pub(w, P, N, V, ee, l, o);
  }
  xo.sub(i);
  function Qa(w, P, N, V, ee, l, o) {
    Nt.filters.sub(w, P, N, V, ee, l, o) && Bi[w](null, P, N, V, ee, l, o);
  }
  i.pub = Qa;
  function Ja() {
    xo.unsub(i), As.delete(i), ut.clear(), Ts(Ca, Gl, oa), y.remove(), ke?.remove(), Dt("destroy");
  }
  i.destroy = Ja;
  function wo() {
    Dt("init", e, t), ro(t || e.data, !1), j[M] ? po(M, j[M]) : uo(), Ut = wt.show && (wt.width > 0 || wt.height > 0), sn = Mt = !0, Kt(e.width, e.height);
  }
  return U.forEach(Bo), O.forEach(Ue), n ? n instanceof HTMLElement ? (n.appendChild(y), wo()) : n(i, wo) : wo(), i;
}
tn.assign = Yt;
tn.fmtNum = js;
tn.rangeNum = _a;
tn.rangeLog = Ea;
tn.rangeAsinh = Hs;
tn.orient = wl;
tn.pxRatio = gt;
tn.join = $h;
tn.fmtDate = Ys, tn.tzDate = Fh;
tn.sync = qc;
{
  tn.addGap = kg, tn.clipGaps = Oa;
  let e = tn.paths = {
    points: Bc
  };
  e.linear = Wc, e.stepped = zg, e.bars = Mg, e.spline = Pg;
}
const us = 2, Vg = 2.5;
let sl = null;
class Fg extends $a {
  constructor(t) {
    if (super(t), !sl) {
      const n = tn.paths, i = n.linear, a = n.spline, r = n.stepped;
      i && a && r && (sl = {
        linear: i(),
        spline: a(),
        stepBefore: r({ align: -1 }),
        stepAfter: r({ align: 1 })
      });
    }
  }
  getConfig() {
    const { color: t = "#4096ff", lineColor: n, label: i, lineWidth: a } = this.props, r = n ?? t, f = this.buildLineConfig(r), u = this.buildPathConfig(), c = this.buildPointsConfig(r);
    return {
      stroke: r,
      width: a ?? us,
      show: !0,
      label: i,
      ...f,
      ...u,
      points: c
    };
  }
  buildLineConfig(t) {
    const { lineWidth: n, lineStyle: i, lineCap: a, fillColor: r, fillMode: f, fillOpacity: u } = this.props, c = {
      stroke: t,
      width: n ?? us
    }, p = u != null && u > 0 ? Math.round(Math.min(u, 100) / 100 * 255).toString(16).padStart(2, "0") : null;
    i === ks.Dashed && (c.dash = [10, 10]), i === ks.Dotted && (c.dash = [2, 6]), a && (c.cap = a);
    const y = r ?? t;
    return this.props.drawStyle === Fl.Bars ? c.fill = p ? `${y}${p}` : y : this.props.drawStyle === Fl.Histogram ? c.fill = `${y}${p ?? "40"}` : f && f !== Cs.None ? f === Cs.Solid && (c.fill = p ? `${y}${p}` : y) : p && (c.fill = `${y}${p}`), c;
  }
  buildPathConfig() {
    const { pathBuilder: t, drawStyle: n, lineInterpolation: i, barWidthFactor: a, barMaxWidth: r } = this.props;
    return t ? { paths: t } : n === Fl.Points ? { paths: () => null } : n != null && sl ? {
      paths: (f, u, c, p) => {
        let y = sl.linear;
        if (i === va.Smooth ? y = sl.spline : i === va.StepBefore ? y = sl.stepBefore : i === va.StepAfter && (y = sl.stepAfter), n === Fl.Bars || n === Fl.Histogram) {
          const b = a ?? 0.6, v = r ?? 100, C = tn.paths.bars?.({ size: [b, v] });
          if (C)
            return C(f, u, c, p);
        }
        return y(f, u, c, p);
      }
    } : {};
  }
  buildPointsConfig(t) {
    const { lineWidth: n, pointSize: i, showPoints: a } = this.props, r = i ?? (n ?? us) * Vg;
    return {
      stroke: t,
      fill: t,
      size: r,
      show: !!a
    };
  }
  merge(t) {
    this.props = { ...this.props, ...t };
  }
}
class Bg extends $a {
  series = [];
  selectionPreferencesSource = dc.IN_MEMORY;
  shouldSaveSelectionPreference = !1;
  axes = {};
  stepInterval;
  scales = [];
  bands = [];
  cursor;
  hooks = {};
  plugins = [];
  padding;
  legend;
  focus;
  select;
  tzDate;
  id;
  onDragSelect;
  constructor(t) {
    super(t);
    const {
      id: n,
      onDragSelect: i,
      tzDate: a,
      selectionPreferencesSource: r,
      shouldSaveSelectionPreference: f,
      stepInterval: u
    } = t ?? {};
    this.id = n, a && (this.tzDate = a), r && (this.selectionPreferencesSource = r), f && (this.shouldSaveSelectionPreference = f), u && (this.stepInterval = u), this.onDragSelect = () => {
    }, i && (this.onDragSelect = i, this.addHook("setSelect", (c) => {
      const p = c.select;
      if (p && p.width > 0) {
        const y = c.posToVal(p.left, "x"), b = c.posToVal(p.left + p.width, "x");
        this.onDragSelect(y * 1e3, b * 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 Hf(t);
  }
  addScale(t) {
    const n = this.scales.find((i) => i.props.scaleKey === t.scaleKey);
    if (n) {
      n.merge?.(t);
      return;
    }
    this.scales.push(new Wf(t));
  }
  addSeries(t) {
    this.series.push(new Fg(t));
  }
  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);
  }
  setBands(t) {
    this.bands = t;
  }
  setCursor(t) {
    this.cursor = qd({}, 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;
  }
  getConfig() {
    const t = Object.values(this.axes).map((r) => r.getConfig()), n = {};
    for (const r of this.scales)
      Object.assign(n, r.getConfig());
    const i = [{}];
    for (const r of this.series)
      i.push(r.getConfig());
    const a = {
      axes: t,
      scales: n,
      series: i
    };
    return this.bands.length > 0 && (a.bands = this.bands), this.cursor && (a.cursor = this.cursor), this.hooks && Object.keys(this.hooks).length > 0 && (a.hooks = this.hooks), this.plugins.length > 0 && (a.plugins = this.plugins), this.padding && (a.padding = this.padding), this.legend && (a.legend = this.legend), this.focus && (a.focus = this.focus), this.select && (a.select = this.select), this.tzDate && (a.tzDate = this.tzDate), a;
  }
  /**
   * Get per-series spanGaps options for data preprocessing
   */
  getSeriesSpanGapsOptions() {
    return this.series.map((t) => {
      const { spanGaps: n } = t.props;
      return { spanGaps: n };
    });
  }
  /**
   * Build legend items from series data
   */
  getLegendItems() {
    return this.series.reduce(
      (t, n, i) => {
        const a = n.getConfig(), r = a.label ?? "", f = i + 1;
        return t[f] = {
          seriesIndex: f,
          color: String(a.stroke ?? "#ccc"),
          label: r,
          show: a.show ?? !0,
          yAxis: 1
        }, t;
      },
      {}
    );
  }
}
function tu(e, t) {
  return t.some(
    ({ spanGaps: n }) => typeof n == "number" && n > 0 && e > n
  );
}
function Hg(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 r = i, f = r.length;
  let u = 0;
  for (let v = 0; v < f - 1; v += 1)
    tu(r[v + 1] - r[v], t) && (u += 1);
  if (u === 0)
    return e;
  const c = f + u, p = Array.from({ length: c }), y = a.map(
    () => Array.from({ length: c })
  );
  let b = 0;
  for (let v = 0; v < f; v += 1) {
    p[b] = r[v];
    for (const [C, z] of a.entries())
      y[C][b] = z[v];
    if (b += 1, v < f - 1 && tu(r[v + 1] - r[v], t)) {
      p[b] = r[v] + Math.max(1, Math.floor((r[v + 1] - r[v]) / 2));
      for (let C = 0; C < a.length; C += 1)
        y[C][b] = null;
      b += 1;
    }
  }
  return [p, ...y];
}
function Wg(e, t) {
  const n = JSON.parse(JSON.stringify(e)), [i, ...a] = n;
  if (!Array.isArray(i) || a.length === 0)
    return n;
  const f = t.some(({ spanGaps: b }) => typeof b == "number") ? Hg(n, t) : n;
  if (!t.some(({ spanGaps: b }) => b === !0))
    return f;
  const [c, ...p] = f, y = p.map((b, v) => {
    const { spanGaps: C } = t[v] ?? {};
    return C !== !0 ? b : b.map(
      (z) => z === null ? void 0 : z
    );
  });
  return [c, ...y];
}
const jg = "series_visibility_";
function Gg(e, t) {
  try {
    localStorage.setItem(jg + e, JSON.stringify(t));
  } catch {
  }
}
const Yg = /\{\{(\w+)(?::(\w+))?\}\}/g;
function Ug(e) {
  const t = /* @__PURE__ */ new Set();
  let n;
  const i = new RegExp(Yg.source, "g");
  for (; (n = i.exec(e)) !== null; )
    t.add(n[1]);
  return Array.from(t);
}
class Kg {
  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 r = this.nodes.get(a);
      r && (r.dependents = r.dependents.filter((f) => f !== n));
    }
    i.dependsOn = [], t.query && (i.dependsOn = Ug(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((r) => r !== t));
      }
      for (const i of n.dependents) {
        const a = this.nodes.get(i);
        a && (a.dependsOn = a.dependsOn.filter((r) => r !== t));
      }
      this.nodes.delete(t);
    }
  }
  getDependents(t) {
    return this.nodes.get(t)?.dependents ?? [];
  }
  getAllDependents(t) {
    const n = /* @__PURE__ */ new Set(), i = [], a = (r) => {
      if (n.has(r))
        return;
      n.add(r);
      const f = this.getDependents(r);
      for (const u of f)
        i.push(u), a(u);
    };
    return a(t), i;
  }
  detectCycle() {
    const a = /* @__PURE__ */ new Map(), r = [];
    for (const u of this.nodes.keys())
      a.set(u, 0);
    const f = (u) => {
      a.set(u, 1);
      const c = this.nodes.get(u);
      if (c)
        for (const p of c.dependsOn) {
          const y = a.get(p);
          if (y === 1)
            return r.push(p, u), !0;
          if (y === 0 && f(p))
            return r.push(u), !0;
        }
      return a.set(u, 2), !1;
    };
    for (const u of this.nodes.keys())
      if (a.get(u) === 0 && f(u))
        return r.reverse();
    return null;
  }
  topologicalSort() {
    const t = /* @__PURE__ */ new Set(), n = [], i = (a) => {
      if (t.has(a))
        return;
      t.add(a);
      const r = this.nodes.get(a);
      if (r)
        for (const f of r.dependsOn)
          i(f);
      n.push(a);
    };
    for (const a of this.nodes.keys())
      i(a);
    return n;
  }
  clear() {
    this.nodes.clear();
  }
}
let Xg = 1;
async function Ki(e, t, n) {
  const { url: i, token: a } = n, r = {
    jsonrpc: "2.0",
    method: e,
    params: t,
    auth: a,
    id: Xg++
  }, f = await fetch(`${i}?_m=${e}`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(r)
  });
  if (!f.ok)
    throw new Error(`Zabbix API HTTP error: ${f.status}`);
  const u = await f.json();
  if (u.error)
    throw new Error(`Zabbix API error [${u.error.code}]: ${u.error.data}`);
  return u.result;
}
function Qg(e) {
  return Ki(
    "hostgroup.get",
    {
      output: ["groupid", "name"],
      sortfield: "name",
      limit: 200
    },
    e
  );
}
function Jg(e, t, n) {
  return Ki(
    "host.get",
    {
      output: ["hostid", "host", "name"],
      ...e?.length ? { groupids: e } : {},
      sortfield: "name",
      limit: 200
    },
    n
  );
}
function Zg(e, t, n, i, a) {
  return Ki(
    "item.get",
    {
      output: ["itemid", "hostid", "name", "key_", "value_type", "units", "valuemapid"],
      selectTags: "extend",
      hostids: e,
      filter: { value_type: ["0", "3"] },
      sortfield: "name",
      limit: 500
    },
    i
  );
}
function ep(e) {
  return e.value ? `${e.tag}: ${e.value}` : e.tag;
}
function tp(e, t, n) {
  return Ki(
    "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 np(e, t) {
  return Ki(
    "usermacro.get",
    {
      output: ["hostmacroid", "macro", "value"],
      ...e?.length ? { hostids: e } : {},
      sortfield: "macro",
      limit: 200
    },
    t
  );
}
function ip(e) {
  return Ki(
    "service.get",
    {
      output: ["serviceid", "name"],
      sortfield: "name",
      limit: 200
    },
    e
  );
}
function lp(e, t) {
  return Ki(
    "discoveryrule.get",
    {
      output: ["itemid", "hostid", "name", "key_"],
      hostids: e,
      sortfield: "name",
      limit: 200
    },
    t
  );
}
function op(e, t) {
  return Ki(
    "itemprototype.get",
    {
      output: ["itemid", "name", "key_"],
      discoveryids: [e],
      sortfield: "name"
    },
    t
  );
}
const ap = [
  "Transform",
  "Aggregate",
  "Filter",
  "Trends",
  "Time",
  "Alias",
  "Special"
], nu = [
  // 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"] }
], Rl = new Kg();
function sp(e) {
  return e.split(",").map((t) => t.trim()).filter(Boolean).map((t) => ({ value: t, label: t }));
}
function rp(e, t, n) {
  if (t) {
    const i = e ?? n[0]?.value ?? "";
    return i ? [i] : [];
  }
  return e ?? n[0]?.value ?? "";
}
function up(e) {
  return [{ value: "$__all", label: "All" }, ...e];
}
function cp(e, t, n) {
  switch (e.type) {
    case "custom": {
      const i = e.customValues ?? "";
      return Promise.resolve(sp(i));
    }
    case "query": {
      if (!t || !e.query)
        return Promise.resolve([]);
      const i = dp(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 dp(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 to = Ns("variable", () => {
  const e = fe({}), t = fe(null);
  function n(C) {
    t.value = C;
  }
  function i(C) {
    e.value[C.id] || (Rl.addVariable(C), e.value[C.id] = {
      config: C,
      options: [],
      current: "",
      loading: !1,
      error: null
    });
  }
  function a(C) {
    const z = e.value[C];
    z && (Rl.removeVariable(z.config.name), delete e.value[C]);
  }
  function r(C, z) {
    const T = e.value[C];
    T && (T.config = { ...T.config, ...z }, ("name" in z || "query" in z) && Rl.addVariable(T.config));
  }
  function f(C, z) {
    const T = e.value[C];
    T && (T.current = z);
  }
  async function u(C) {
    const z = e.value[C];
    if (z) {
      z.loading = !0, z.error = null;
      try {
        const T = p(), q = await cp(z.config, t.value, T);
        z.options = z.config.includeAll ? up(q) : q;
        const Q = Array.isArray(z.current) ? z.current[0] : z.current;
        (!Q || !z.options.some((F) => F.value === Q)) && (z.current = rp(z.config.defaultValue, z.config.multi, z.options));
      } catch (T) {
        z.error = T?.message ?? String(T);
      } finally {
        z.loading = !1;
      }
    }
  }
  async function c() {
    const C = Rl.topologicalSort();
    for (const z of C) {
      const T = Object.values(e.value).find((q) => q.config.name === z);
      T && await u(T.config.id);
    }
  }
  function p() {
    const C = {};
    for (const z of Object.values(e.value)) {
      const { name: T } = z.config;
      Array.isArray(z.current) ? C[T] = z.current.length === 1 ? z.current[0] : z.current : C[T] = z.current;
    }
    return C;
  }
  function y(C) {
    return Object.values(e.value).find((z) => z.config.name === C);
  }
  function b(C) {
    return Rl.getAllDependents(C);
  }
  function v() {
    return Rl.detectCycle();
  }
  return {
    variables: e,
    optionsResolver: t,
    setOptionsResolver: n,
    addVariable: i,
    removeVariable: a,
    updateVariable: r,
    setValue: f,
    refreshVariable: u,
    refreshAll: c,
    resolveAll: p,
    getVariable: y,
    getDependents: b,
    detectCycle: v
  };
});
function fp() {
  const e = Date.now();
  return { from: e - 3600 * 1e3, to: e };
}
const fi = Ns("dashboard", () => {
  const e = uc(), t = fe(""), n = fe(e.panels), i = fe(e.layouts), a = fe(!1), r = fe(null), f = fe(!1), u = fe(fp()), c = fe(0), p = fe(null), y = fe(!1), b = fe({});
  function v($) {
    const j = Ss(), ue = rc($, { id: j }), ie = i.value.reduce((me, ge) => Math.max(me, ge.y + ge.h), 0), Ee = {
      i: j,
      x: 0,
      y: ie,
      w: $ === "stat" || $ === "gauge" ? 3 : $ === "table" ? 12 : 6,
      h: $ === "stat" || $ === "gauge" ? 4 : $ === "table" ? 10 : 8,
      minH: $ === "stat" || $ === "gauge" ? 3 : 6
    };
    n.value[j] = ue, i.value = [...i.value, Ee], r.value = j, f.value = !1, y.value = !0;
  }
  function C($) {
    const { [$]: j, ...ue } = n.value;
    n.value = ue, i.value = i.value.filter((ie) => ie.i !== $), r.value === $ && (r.value = null), y.value = !0;
  }
  function z($) {
    const j = n.value[$];
    if (!j)
      return;
    const ue = Ss(), ie = { ...j, id: ue, title: `${j.title} (copy)` }, Ee = i.value.find((ge) => ge.i === $), me = i.value.reduce((ge, le) => Math.max(ge, le.y + le.h), 0);
    n.value[ue] = ie, i.value = [
      ...i.value,
      {
        i: ue,
        x: Ee?.x ?? 0,
        y: me,
        w: Ee?.w ?? 6,
        h: Ee?.h ?? 8,
        minH: Ee?.minH
      }
    ], y.value = !0;
  }
  function T($, j) {
    const ue = n.value[$];
    ue && (n.value[$] = { ...ue, ...j }, y.value = !0);
  }
  function q() {
    n.value = {}, i.value = [], r.value = null, y.value = !0;
  }
  function Q($) {
    i.value = $;
  }
  function F() {
    p.value = {
      title: t.value,
      panels: { ...n.value },
      layouts: [...i.value]
    }, a.value = !0, y.value = !1;
  }
  function U($) {
    $ && $(Z()), a.value = !1, p.value = null, y.value = !1;
  }
  function O() {
    const $ = p.value;
    $ && (t.value = $.title, n.value = $.panels, i.value = $.layouts), a.value = !1, p.value = null, y.value = !1;
  }
  function W() {
    a.value ? O() : F();
  }
  function te($) {
    a.value = $;
  }
  function M($) {
    r.value = $;
  }
  function G($) {
    u.value = $;
  }
  function J($) {
    c.value = $;
  }
  function K() {
    for (const $ of Object.keys(n.value))
      b.value[$] = (b.value[$] ?? 0) + 1;
  }
  function A($) {
    b.value[$] = (b.value[$] ?? 0) + 1;
  }
  function Z() {
    const $ = to(), j = Object.values($.variables).map((ie) => ie.config), ue = {
      title: t.value,
      panels: n.value,
      layouts: i.value,
      variables: j
    };
    return JSON.stringify(ue, null, 2);
  }
  function Y($) {
    try {
      const j = JSON.parse($);
      if (j.panels && j.layouts && (t.value = j.title ?? "", n.value = j.panels, i.value = j.layouts, y.value = !0), j.variables && j.variables.length > 0) {
        const ue = to();
        for (const ie of Object.keys(ue.variables))
          ue.removeVariable(ie);
        for (const ie of j.variables) {
          const Ee = {
            ...ie,
            hide: ie.showOnDashboard === "nothing" || !!ie.hideFromVariableList
          };
          ue.addVariable(Ee);
        }
      }
      return !!(j.panels && j.layouts);
    } catch {
      return !1;
    }
  }
  return {
    title: t,
    panels: n,
    layouts: i,
    isEditing: a,
    editingPanelId: r,
    addPanelModalOpen: f,
    timeRange: u,
    autoRefresh: c,
    _editSnapshot: p,
    isDirty: y,
    panelRefreshKeys: b,
    addPanel: v,
    removePanel: C,
    clonePanel: z,
    updatePanel: T,
    clearPanels: q,
    setLayouts: Q,
    startEditing: F,
    confirmSave: U,
    discardChanges: O,
    setEditingPanel: M,
    toggleEditing: W,
    setEditing: te,
    setTimeRange: G,
    setAutoRefresh: J,
    refresh: K,
    refreshPanel: A,
    exportJSON: Z,
    importJSON: Y
  };
}), Mi = Ns("theme", () => {
  const e = fe(
    (typeof localStorage < "u" ? localStorage.getItem("argus-theme") : null) || "dark"
  ), t = re(() => 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 };
}), hp = typeof window < "u";
var iu;
hp && ((iu = window?.navigator) != null && iu.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Tn(e) {
  return e == null;
}
function Uc() {
}
const gp = 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(gp)));
function pp() {
  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 lu(e, t = 16) {
  if (typeof e != "function")
    return Uc;
  const n = (...r) => {
    e(...r);
  };
  if (t <= 0)
    return Kc(n);
  let i = 0, a;
  return function(...r) {
    const f = Date.now(), u = f - i;
    clearTimeout(a), u >= t ? (i = f, n(...r)) : a = setTimeout(
      () => {
        i = Date.now(), n(...r);
      },
      Math.max(0, t - u)
    );
  };
}
function mp(e, t = 100) {
  if (typeof e != "function")
    return Uc;
  const n = (...a) => {
    e(...a);
  };
  if (t <= 0)
    return Kc(n);
  let i;
  return function(...a) {
    clearTimeout(i), i = setTimeout(() => {
      n(...a);
    }, t);
  };
}
function Kc(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 Oo = /* @__PURE__ */ new Set(), Xc = /* @__PURE__ */ new WeakMap();
function vp() {
  Oo.forEach((e) => {
    e(...Xc.get(e));
  }), Oo.clear();
}
function pn(e, ...t) {
  if (typeof e != "function")
    return e;
  Xc.set(e, t), !Oo.has(e) && (Oo.add(e), Oo.size === 1 && Promise.resolve().then(vp));
}
const Qc = Symbol("LAYOUT_KEY"), Jc = Symbol("EMITTER_KEY");
function yp(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 Ds(e) {
  const t = Array(e.length);
  for (let n = 0, i = e.length; n < i; n++)
    t[n] = bp(e[n]);
  return t;
}
function bp(e) {
  return { ...e };
}
function Zc(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 Hl(e, t, n) {
  const i = td(e), a = nd(e), r = Array(e.length);
  for (let f = 0, u = a.length; f < u; f++) {
    let c = a[f];
    c.static || (c = xp(i, c, t, n), i.push(c)), r[e.findIndex((p) => p.i === c.i)] = c, c.moved = !1;
  }
  return r;
}
function xp(e, t, n, i) {
  if (n)
    for (; t.y > 0 && !Do(e, t); )
      t.y--;
  else if (i) {
    const r = i[t.i].y;
    for (; t.y > r && !Do(e, t); )
      t.y--;
  }
  let a;
  for (; a = Do(e, t); )
    t.y = a.y + a.h;
  return t;
}
function wp(e, t) {
  const n = td(e);
  for (let i = 0, a = e.length; i < a; i++) {
    const r = e[i];
    if (r.x + r.w > t.cols && (r.x = t.cols - r.w), r.x < 0 && (r.x = 0, r.w = t.cols), !r.static) n.push(r);
    else
      for (; Do(n, r); )
        r.y++;
  }
  return e;
}
function ou(e, t) {
  for (let n = 0, i = e.length; n < i; n++)
    if (e[n].i === t) return e[n];
}
function Do(e, t) {
  for (let n = 0, i = e.length; n < i; n++)
    if (Zc(e[n], t)) return e[n];
}
function ed(e, t) {
  return e.filter((n) => Zc(n, t));
}
function td(e) {
  return e.filter((t) => t.static);
}
function qs(e, t, n, i, a = !1, r = !1) {
  if (t.static) return e;
  const f = t.x, u = t.y, c = i && t.y > i;
  typeof n == "number" && (t.x = n), typeof i == "number" && (t.y = i), t.moved = !0;
  let p = nd(e);
  c && (p = p.reverse());
  const y = ed(p, t);
  if (r && y.length)
    return t.x = f, t.y = u, t.moved = !1, e;
  for (let b = 0, v = y.length; b < v; b++) {
    const C = y[b];
    C.moved || t.y > C.y && t.y - C.y > C.h / 4 || (C.static ? e = au(e, C, t, a) : e = au(e, t, C, a));
  }
  return e;
}
function au(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), !Do(e, a))
      return qs(e, n, void 0, a.y, !1);
  }
  return qs(e, n, void 0, n.y + 1, !1);
}
function Sp(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 kp(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 Cp(e, t, n, i) {
  return {
    top: e + "px",
    left: t + "px",
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function _p(e, t, n, i) {
  return {
    top: e + "px",
    right: t + "px",
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function nd(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 zp(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, r = e.length; a < r; a++) {
    const f = e[a];
    for (let u = 0; u < n.length; u++)
      if (typeof f[n[u]] != "number")
        throw new Error(
          "VueGridLayout: " + t + "[" + a + "]." + n[u] + " must be a number!"
        );
    if (f.i === void 0 || f.i === null)
      throw new Error("VueGridLayout: " + t + "[" + a + "].i cannot be null!");
    if (typeof f.i != "number" && typeof f.i != "string")
      throw new Error("VueGridLayout: " + t + "[" + a + "].i must be a string or number!");
    if (i.indexOf(f.i) >= 0)
      throw new Error("VueGridLayout: " + t + "[" + a + "].i must be unique!");
    if (i.push(f.i), f.static !== void 0 && typeof f.static != "boolean")
      throw new Error("VueGridLayout: " + t + "[" + a + "].static must be a boolean!");
  }
}
function Mp(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 su(e) {
  return Tp(e);
}
function Tp(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, r = e.clientY + n.scrollTop - i.top;
  return { x: a, y: r };
}
function ru(e, t, n, i) {
  return Pp(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 Pp(e) {
  return typeof e == "number" && !Number.isNaN(e);
}
function $p(e, t) {
  const n = ld(e);
  let i = n[0];
  for (let a = 1, r = n.length; a < r; a++) {
    const f = n[a];
    t > e[f] && (i = f);
  }
  return i;
}
function id(e, t) {
  if (!t[e])
    throw new Error(
      "ResponsiveGridLayout: `cols` entry for breakpoint " + e + " is missing!"
    );
  return t[e];
}
function Ep(e, t, n, i, a, r, f) {
  if (t[i]) return Ds(t[i]);
  let u = e;
  const c = ld(n), p = c.slice(c.indexOf(i));
  for (let y = 0, b = p.length; y < b; y++) {
    const v = p[y];
    if (t[v]) {
      u = t[v];
      break;
    }
  }
  return u = Ds(u || []), Hl(wp(u, { cols: r }), f);
}
function ld(e) {
  return Object.keys(e).sort((t, n) => e[t] - e[n]);
}
let Ip = "auto";
function Ap() {
  return typeof document < "u";
}
function uu() {
  return Ap() ? typeof document.dir < "u" ? document.dir : document.getElementsByTagName("html")[0].getAttribute("dir") : Ip;
}
var $o = { exports: {} }, Op = $o.exports, cu;
function Dp() {
  return cu || (cu = 1, (function(e, t) {
    (function(n, i) {
      e.exports = i();
    })(Op, (function() {
      function n(l, o) {
        var s = Object.keys(l);
        if (Object.getOwnPropertySymbols) {
          var h = Object.getOwnPropertySymbols(l);
          o && (h = h.filter((function(g) {
            return Object.getOwnPropertyDescriptor(l, g).enumerable;
          }))), s.push.apply(s, h);
        }
        return s;
      }
      function i(l) {
        for (var o = 1; o < arguments.length; o++) {
          var s = arguments[o] != null ? arguments[o] : {};
          o % 2 ? n(Object(s), !0).forEach((function(h) {
            c(l, h, s[h]);
          })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(l, Object.getOwnPropertyDescriptors(s)) : n(Object(s)).forEach((function(h) {
            Object.defineProperty(l, h, Object.getOwnPropertyDescriptor(s, h));
          }));
        }
        return l;
      }
      function a(l) {
        return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
          return typeof o;
        } : function(o) {
          return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
        }, a(l);
      }
      function r(l, o) {
        if (!(l instanceof o)) throw new TypeError("Cannot call a class as a function");
      }
      function f(l, o) {
        for (var s = 0; s < o.length; s++) {
          var h = o[s];
          h.enumerable = h.enumerable || !1, h.configurable = !0, "value" in h && (h.writable = !0), Object.defineProperty(l, T(h.key), h);
        }
      }
      function u(l, o, s) {
        return o && f(l.prototype, o), Object.defineProperty(l, "prototype", { writable: !1 }), l;
      }
      function c(l, o, s) {
        return (o = T(o)) in l ? Object.defineProperty(l, o, { value: s, enumerable: !0, configurable: !0, writable: !0 }) : l[o] = s, l;
      }
      function p(l, o) {
        if (typeof o != "function" && o !== null) throw new TypeError("Super expression must either be null or a function");
        l.prototype = Object.create(o && o.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), o && b(l, o);
      }
      function y(l) {
        return y = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) {
          return o.__proto__ || Object.getPrototypeOf(o);
        }, y(l);
      }
      function b(l, o) {
        return b = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(s, h) {
          return s.__proto__ = h, s;
        }, b(l, o);
      }
      function v(l) {
        if (l === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return l;
      }
      function C(l) {
        var o = (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 s, h = y(l);
          if (o) {
            var g = y(this).constructor;
            s = Reflect.construct(h, arguments, g);
          } else s = h.apply(this, arguments);
          return (function(x, S) {
            if (S && (typeof S == "object" || typeof S == "function")) return S;
            if (S !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
            return v(x);
          })(this, s);
        };
      }
      function z() {
        return z = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(l, o, s) {
          var h = (function(x, S) {
            for (; !Object.prototype.hasOwnProperty.call(x, S) && (x = y(x)) !== null; ) ;
            return x;
          })(l, o);
          if (h) {
            var g = Object.getOwnPropertyDescriptor(h, o);
            return g.get ? g.get.call(arguments.length < 3 ? l : s) : g.value;
          }
        }, z.apply(this, arguments);
      }
      function T(l) {
        var o = (function(s, h) {
          if (typeof s != "object" || s === null) return s;
          var g = s[Symbol.toPrimitive];
          if (g !== void 0) {
            var x = g.call(s, h);
            if (typeof x != "object") return x;
            throw new TypeError("@@toPrimitive must return a primitive value.");
          }
          return String(s);
        })(l, "string");
        return typeof o == "symbol" ? o : o + "";
      }
      var q = function(l) {
        return !(!l || !l.Window) && l instanceof l.Window;
      }, Q = void 0, F = void 0;
      function U(l) {
        Q = l;
        var o = l.document.createTextNode("");
        o.ownerDocument !== l.document && typeof l.wrap == "function" && l.wrap(o) === o && (l = l.wrap(l)), F = l;
      }
      function O(l) {
        return q(l) ? l : (l.ownerDocument || l).defaultView || F.window;
      }
      typeof window < "u" && window && U(window);
      var W = function(l) {
        return !!l && a(l) === "object";
      }, te = function(l) {
        return typeof l == "function";
      }, M = { window: function(l) {
        return l === F || q(l);
      }, docFrag: function(l) {
        return W(l) && l.nodeType === 11;
      }, object: W, func: te, number: function(l) {
        return typeof l == "number";
      }, bool: function(l) {
        return typeof l == "boolean";
      }, string: function(l) {
        return typeof l == "string";
      }, element: function(l) {
        if (!l || a(l) !== "object") return !1;
        var o = O(l) || F;
        return /object|function/.test(typeof Element > "u" ? "undefined" : a(Element)) ? l instanceof Element || l instanceof o.Element : l.nodeType === 1 && typeof l.nodeName == "string";
      }, plainObject: function(l) {
        return W(l) && !!l.constructor && /function Object\b/.test(l.constructor.toString());
      }, array: function(l) {
        return W(l) && l.length !== void 0 && te(l.splice);
      } };
      function G(l) {
        var o = l.interaction;
        if (o.prepared.name === "drag") {
          var s = o.prepared.axis;
          s === "x" ? (o.coords.cur.page.y = o.coords.start.page.y, o.coords.cur.client.y = o.coords.start.client.y, o.coords.velocity.client.y = 0, o.coords.velocity.page.y = 0) : s === "y" && (o.coords.cur.page.x = o.coords.start.page.x, o.coords.cur.client.x = o.coords.start.client.x, o.coords.velocity.client.x = 0, o.coords.velocity.page.x = 0);
        }
      }
      function J(l) {
        var o = l.iEvent, s = l.interaction;
        if (s.prepared.name === "drag") {
          var h = s.prepared.axis;
          if (h === "x" || h === "y") {
            var g = h === "x" ? "y" : "x";
            o.page[g] = s.coords.start.page[g], o.client[g] = s.coords.start.client[g], o.delta[g] = 0;
          }
        }
      }
      var K = { id: "actions/drag", install: function(l) {
        var o = l.actions, s = l.Interactable, h = l.defaults;
        s.prototype.draggable = K.draggable, o.map.drag = K, o.methodDict.drag = "draggable", h.actions.drag = K.defaults;
      }, listeners: { "interactions:before-action-move": G, "interactions:action-resume": G, "interactions:action-move": J, "auto-start:check": function(l) {
        var o = l.interaction, s = l.interactable, h = l.buttons, g = s.options.drag;
        if (g && g.enabled && (!o.pointerIsDown || !/mouse|pointer/.test(o.pointerType) || (h & s.options.drag.mouseButtons) != 0)) return l.action = { name: "drag", axis: g.lockAxis === "start" ? g.startAxis : g.lockAxis }, !1;
      } }, draggable: function(l) {
        return M.object(l) ? (this.options.drag.enabled = l.enabled !== !1, this.setPerAction("drag", l), this.setOnEvents("drag", l), /^(xy|x|y|start)$/.test(l.lockAxis) && (this.options.drag.lockAxis = l.lockAxis), /^(xy|x|y)$/.test(l.startAxis) && (this.options.drag.startAxis = l.startAxis), this) : M.bool(l) ? (this.options.drag.enabled = l, this) : this.options.drag;
      }, beforeMove: G, move: J, defaults: { startAxis: "xy", lockAxis: "xy" }, getCursor: function() {
        return "move";
      }, filterEventType: function(l) {
        return l.search("drag") === 0;
      } }, A = K, Z = { init: function(l) {
        var o = l;
        Z.document = o.document, Z.DocumentFragment = o.DocumentFragment || Y, Z.SVGElement = o.SVGElement || Y, Z.SVGSVGElement = o.SVGSVGElement || Y, Z.SVGElementInstance = o.SVGElementInstance || Y, Z.Element = o.Element || Y, Z.HTMLElement = o.HTMLElement || Z.Element, Z.Event = o.Event, Z.Touch = o.Touch || Y, Z.PointerEvent = o.PointerEvent || o.MSPointerEvent;
      }, document: null, DocumentFragment: null, SVGElement: null, SVGSVGElement: null, SVGElementInstance: null, Element: null, HTMLElement: null, Event: null, Touch: null, PointerEvent: null };
      function Y() {
      }
      var $ = Z, j = { init: function(l) {
        var o = $.Element, s = l.navigator || {};
        j.supportsTouch = "ontouchstart" in l || M.func(l.DocumentTouch) && $.document instanceof l.DocumentTouch, j.supportsPointerEvent = s.pointerEnabled !== !1 && !!$.PointerEvent, j.isIOS = /iP(hone|od|ad)/.test(s.platform), j.isIOS7 = /iP(hone|od|ad)/.test(s.platform) && /OS 7[^\d]/.test(s.appVersion), j.isIe9 = /MSIE 9/.test(s.userAgent), j.isOperaMobile = s.appName === "Opera" && j.supportsTouch && /Presto/.test(s.userAgent), j.prefixedMatchesSelector = "matches" in o.prototype ? "matches" : "webkitMatchesSelector" in o.prototype ? "webkitMatchesSelector" : "mozMatchesSelector" in o.prototype ? "mozMatchesSelector" : "oMatchesSelector" in o.prototype ? "oMatchesSelector" : "msMatchesSelector", j.pEventTypes = j.supportsPointerEvent ? $.PointerEvent === l.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, j.wheelEvent = $.document && "onmousewheel" in $.document ? "mousewheel" : "wheel";
      }, supportsTouch: null, supportsPointerEvent: null, isIOS7: null, isIOS: null, isIe9: null, isOperaMobile: null, prefixedMatchesSelector: null, pEventTypes: null, wheelEvent: null }, ue = j;
      function ie(l, o) {
        if (l.contains) return l.contains(o);
        for (; o; ) {
          if (o === l) return !0;
          o = o.parentNode;
        }
        return !1;
      }
      function Ee(l, o) {
        for (; M.element(l); ) {
          if (ge(l, o)) return l;
          l = me(l);
        }
        return null;
      }
      function me(l) {
        var o = l.parentNode;
        if (M.docFrag(o)) {
          for (; (o = o.host) && M.docFrag(o); ) ;
          return o;
        }
        return o;
      }
      function ge(l, o) {
        return F !== Q && (o = o.replace(/\/deep\//g, " ")), l[ue.prefixedMatchesSelector](o);
      }
      var le = function(l) {
        return l.parentNode || l.host;
      };
      function ve(l, o) {
        for (var s, h = [], g = l; (s = le(g)) && g !== o && s !== g.ownerDocument; ) h.unshift(g), g = s;
        return h;
      }
      function Oe(l, o, s) {
        for (; M.element(l); ) {
          if (ge(l, o)) return !0;
          if ((l = me(l)) === s) return ge(l, o);
        }
        return !1;
      }
      function xe(l) {
        return l.correspondingUseElement || l;
      }
      function ke(l) {
        var o = l instanceof $.SVGElement ? l.getBoundingClientRect() : l.getClientRects()[0];
        return o && { left: o.left, right: o.right, top: o.top, bottom: o.bottom, width: o.width || o.right - o.left, height: o.height || o.bottom - o.top };
      }
      function se(l) {
        var o, s = ke(l);
        if (!ue.isIOS7 && s) {
          var h = { x: (o = (o = O(l)) || F).scrollX || o.document.documentElement.scrollLeft, y: o.scrollY || o.document.documentElement.scrollTop };
          s.left += h.x, s.right += h.x, s.top += h.y, s.bottom += h.y;
        }
        return s;
      }
      function oe(l) {
        for (var o = []; l; ) o.push(l), l = me(l);
        return o;
      }
      function Te(l) {
        return !!M.string(l) && ($.document.querySelector(l), !0);
      }
      function be(l, o) {
        for (var s in o) l[s] = o[s];
        return l;
      }
      function qe(l, o, s) {
        return l === "parent" ? me(s) : l === "self" ? o.getRect(s) : Ee(s, l);
      }
      function Je(l, o, s, h) {
        var g = l;
        return M.string(g) ? g = qe(g, o, s) : M.func(g) && (g = g.apply(void 0, h)), M.element(g) && (g = se(g)), g;
      }
      function Ge(l) {
        return l && { x: "x" in l ? l.x : l.left, y: "y" in l ? l.y : l.top };
      }
      function mt(l) {
        return !l || "x" in l && "y" in l || ((l = be({}, l)).x = l.left || 0, l.y = l.top || 0, l.width = l.width || (l.right || 0) - l.x, l.height = l.height || (l.bottom || 0) - l.y), l;
      }
      function It(l, o, s) {
        l.left && (o.left += s.x), l.right && (o.right += s.x), l.top && (o.top += s.y), l.bottom && (o.bottom += s.y), o.width = o.right - o.left, o.height = o.bottom - o.top;
      }
      function ft(l, o, s) {
        var h = s && l.options[s];
        return Ge(Je(h && h.origin || l.options.origin, l, o, [l && o])) || { x: 0, y: 0 };
      }
      function Tt(l, o) {
        var s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function(D) {
          return !0;
        }, h = arguments.length > 3 ? arguments[3] : void 0;
        if (h = h || {}, M.string(l) && l.search(" ") !== -1 && (l = ut(l)), M.array(l)) return l.forEach((function(D) {
          return Tt(D, o, s, h);
        })), h;
        if (M.object(l) && (o = l, l = ""), M.func(o) && s(l)) h[l] = h[l] || [], h[l].push(o);
        else if (M.array(o)) for (var g = 0, x = o; g < x.length; g++) {
          var S = x[g];
          Tt(l, S, s, h);
        }
        else if (M.object(o)) for (var _ in o)
          Tt(ut(_).map((function(D) {
            return "".concat(l).concat(D);
          })), o[_], s, h);
        return h;
      }
      function ut(l) {
        return l.trim().split(/ +/);
      }
      var At = function(l, o) {
        return Math.sqrt(l * l + o * o);
      }, Wn = ["webkit", "moz"];
      function Wt(l, o) {
        l.__set || (l.__set = {});
        var s = function(g) {
          if (Wn.some((function(x) {
            return g.indexOf(x) === 0;
          }))) return 1;
          typeof l[g] != "function" && g !== "__set" && Object.defineProperty(l, g, { get: function() {
            return g in l.__set ? l.__set[g] : l.__set[g] = o[g];
          }, set: function(x) {
            l.__set[g] = x;
          }, configurable: !0 });
        };
        for (var h in o) s(h);
        return l;
      }
      function ln(l, o) {
        l.page = l.page || {}, l.page.x = o.page.x, l.page.y = o.page.y, l.client = l.client || {}, l.client.x = o.client.x, l.client.y = o.client.y, l.timeStamp = o.timeStamp;
      }
      function Be(l) {
        l.page.x = 0, l.page.y = 0, l.client.x = 0, l.client.y = 0;
      }
      function ae(l) {
        return l instanceof $.Event || l instanceof $.Touch;
      }
      function Ie(l, o, s) {
        return l = l || "page", (s = s || {}).x = o[l + "X"], s.y = o[l + "Y"], s;
      }
      function _e(l, o) {
        return o = o || { x: 0, y: 0 }, ue.isOperaMobile && ae(l) ? (Ie("screen", l, o), o.x += window.scrollX, o.y += window.scrollY) : Ie("page", l, o), o;
      }
      function je(l) {
        return M.number(l.pointerId) ? l.pointerId : l.identifier;
      }
      function ct(l, o, s) {
        var h = o.length > 1 ? Le(o) : o[0];
        _e(h, l.page), (function(g, x) {
          x = x || {}, ue.isOperaMobile && ae(g) ? Ie("screen", g, x) : Ie("client", g, x);
        })(h, l.client), l.timeStamp = s;
      }
      function Ye(l) {
        var o = [];
        return M.array(l) ? (o[0] = l[0], o[1] = l[1]) : l.type === "touchend" ? l.touches.length === 1 ? (o[0] = l.touches[0], o[1] = l.changedTouches[0]) : l.touches.length === 0 && (o[0] = l.changedTouches[0], o[1] = l.changedTouches[1]) : (o[0] = l.touches[0], o[1] = l.touches[1]), o;
      }
      function Le(l) {
        for (var o = { pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0 }, s = 0; s < l.length; s++) {
          var h = l[s];
          for (var g in o) o[g] += h[g];
        }
        for (var x in o) o[x] /= l.length;
        return o;
      }
      function et(l) {
        if (!l.length) return null;
        var o = Ye(l), s = Math.min(o[0].pageX, o[1].pageX), h = Math.min(o[0].pageY, o[1].pageY), g = Math.max(o[0].pageX, o[1].pageX), x = Math.max(o[0].pageY, o[1].pageY);
        return { x: s, y: h, left: s, top: h, right: g, bottom: x, width: g - s, height: x - h };
      }
      function nt(l, o) {
        var s = o + "X", h = o + "Y", g = Ye(l), x = g[0][s] - g[1][s], S = g[0][h] - g[1][h];
        return At(x, S);
      }
      function it(l, o) {
        var s = o + "X", h = o + "Y", g = Ye(l), x = g[1][s] - g[0][s], S = g[1][h] - g[0][h];
        return 180 * Math.atan2(S, x) / Math.PI;
      }
      function St(l) {
        return M.string(l.pointerType) ? l.pointerType : M.number(l.pointerType) ? [void 0, void 0, "touch", "pen", "mouse"][l.pointerType] : /touch/.test(l.type || "") || l instanceof $.Touch ? "touch" : "mouse";
      }
      function Lt(l) {
        var o = M.func(l.composedPath) ? l.composedPath() : l.path;
        return [xe(o ? o[0] : l.target), xe(l.currentTarget)];
      }
      var Gt = (function() {
        function l(o) {
          r(this, l), this.immediatePropagationStopped = !1, this.propagationStopped = !1, this._interaction = o;
        }
        return u(l, [{ key: "preventDefault", value: function() {
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }]), l;
      })();
      Object.defineProperty(Gt.prototype, "interaction", { get: function() {
        return this._interaction._proxy;
      }, set: function() {
      } });
      var fn = function(l, o) {
        for (var s = 0; s < o.length; s++) {
          var h = o[s];
          l.push(h);
        }
        return l;
      }, sn = function(l) {
        return fn([], l);
      }, Ut = function(l, o) {
        for (var s = 0; s < l.length; s++) if (o(l[s], s, l)) return s;
        return -1;
      }, Mt = function(l, o) {
        return l[Ut(l, o)];
      }, Kt = (function(l) {
        p(s, l);
        var o = C(s);
        function s(h, g, x) {
          var S;
          r(this, s), (S = o.call(this, g._interaction)).dropzone = void 0, S.dragEvent = void 0, S.relatedTarget = void 0, S.draggable = void 0, S.propagationStopped = !1, S.immediatePropagationStopped = !1;
          var _ = x === "dragleave" ? h.prev : h.cur, D = _.element, H = _.dropzone;
          return S.type = x, S.target = D, S.currentTarget = D, S.dropzone = H, S.dragEvent = g, S.relatedTarget = g.target, S.draggable = g.interactable, S.timeStamp = g.timeStamp, S;
        }
        return u(s, [{ key: "reject", value: function() {
          var h = this, g = this._interaction.dropState;
          if (this.type === "dropactivate" || this.dropzone && g.cur.dropzone === this.dropzone && g.cur.element === this.target) if (g.prev.dropzone = this.dropzone, g.prev.element = this.target, g.rejected = !0, g.events.enter = null, this.stopImmediatePropagation(), this.type === "dropactivate") {
            var x = g.activeDrops, S = Ut(x, (function(D) {
              var H = D.dropzone, L = D.element;
              return H === h.dropzone && L === h.target;
            }));
            g.activeDrops.splice(S, 1);
            var _ = new s(g, this.dragEvent, "dropdeactivate");
            _.dropzone = this.dropzone, _.target = this.target, this.dropzone.fire(_);
          } else this.dropzone.fire(new s(g, this.dragEvent, "dragleave"));
        } }, { key: "preventDefault", value: function() {
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }]), s;
      })(Gt);
      function vt(l, o) {
        for (var s = 0, h = l.slice(); s < h.length; s++) {
          var g = h[s], x = g.dropzone, S = g.element;
          o.dropzone = x, o.target = S, x.fire(o), o.propagationStopped = o.immediatePropagationStopped = !1;
        }
      }
      function Ft(l, o) {
        for (var s = (function(x, S) {
          for (var _ = [], D = 0, H = x.interactables.list; D < H.length; D++) {
            var L = H[D];
            if (L.options.drop.enabled) {
              var X = L.options.drop.accept;
              if (!(M.element(X) && X !== S || M.string(X) && !ge(S, X) || M.func(X) && !X({ dropzone: L, draggableElement: S }))) for (var ne = 0, de = L.getAllElements(); ne < de.length; ne++) {
                var he = de[ne];
                he !== S && _.push({ dropzone: L, element: he, rect: L.getRect(he) });
              }
            }
          }
          return _;
        })(l, o), h = 0; h < s.length; h++) {
          var g = s[h];
          g.rect = g.dropzone.getRect(g.element);
        }
        return s;
      }
      function bt(l, o, s) {
        for (var h = l.dropState, g = l.interactable, x = l.element, S = [], _ = 0, D = h.activeDrops; _ < D.length; _++) {
          var H = D[_], L = H.dropzone, X = H.element, ne = H.rect, de = L.dropCheck(o, s, g, x, X, ne);
          S.push(de ? X : null);
        }
        var he = (function(pe) {
          for (var we, Se, $e, Ve = [], Ke = 0; Ke < pe.length; Ke++) {
            var Re = pe[Ke], We = pe[we];
            if (Re && Ke !== we) if (We) {
              var ht = le(Re), rt = le(We);
              if (ht !== Re.ownerDocument) if (rt !== Re.ownerDocument) if (ht !== rt) {
                Ve = Ve.length ? Ve : ve(We);
                var yt = void 0;
                if (We instanceof $.HTMLElement && Re instanceof $.SVGElement && !(Re instanceof $.SVGSVGElement)) {
                  if (Re === rt) continue;
                  yt = Re.ownerSVGElement;
                } else yt = Re;
                for (var Ct = ve(yt, We.ownerDocument), Vt = 0; Ct[Vt] && Ct[Vt] === Ve[Vt]; ) Vt++;
                var Kn = [Ct[Vt - 1], Ct[Vt], Ve[Vt]];
                if (Kn[0]) for (var yn = Kn[0].lastChild; yn; ) {
                  if (yn === Kn[1]) {
                    we = Ke, Ve = Ct;
                    break;
                  }
                  if (yn === Kn[2]) break;
                  yn = yn.previousSibling;
                }
              } else $e = We, (parseInt(O(Se = Re).getComputedStyle(Se).zIndex, 10) || 0) >= (parseInt(O($e).getComputedStyle($e).zIndex, 10) || 0) && (we = Ke);
              else we = Ke;
            } else we = Ke;
          }
          return we;
        })(S);
        return h.activeDrops[he] || null;
      }
      function Pt(l, o, s) {
        var h = l.dropState, g = { enter: null, leave: null, activate: null, deactivate: null, move: null, drop: null };
        return s.type === "dragstart" && (g.activate = new Kt(h, s, "dropactivate"), g.activate.target = null, g.activate.dropzone = null), s.type === "dragend" && (g.deactivate = new Kt(h, s, "dropdeactivate"), g.deactivate.target = null, g.deactivate.dropzone = null), h.rejected || (h.cur.element !== h.prev.element && (h.prev.dropzone && (g.leave = new Kt(h, s, "dragleave"), s.dragLeave = g.leave.target = h.prev.element, s.prevDropzone = g.leave.dropzone = h.prev.dropzone), h.cur.dropzone && (g.enter = new Kt(h, s, "dragenter"), s.dragEnter = h.cur.element, s.dropzone = h.cur.dropzone)), s.type === "dragend" && h.cur.dropzone && (g.drop = new Kt(h, s, "drop"), s.dropzone = h.cur.dropzone, s.relatedTarget = h.cur.element), s.type === "dragmove" && h.cur.dropzone && (g.move = new Kt(h, s, "dropmove"), s.dropzone = h.cur.dropzone)), g;
      }
      function Xt(l, o) {
        var s = l.dropState, h = s.activeDrops, g = s.cur, x = s.prev;
        o.leave && x.dropzone.fire(o.leave), o.enter && g.dropzone.fire(o.enter), o.move && g.dropzone.fire(o.move), o.drop && g.dropzone.fire(o.drop), o.deactivate && vt(h, o.deactivate), s.prev.dropzone = g.dropzone, s.prev.element = g.element;
      }
      function wn(l, o) {
        var s = l.interaction, h = l.iEvent, g = l.event;
        if (h.type === "dragmove" || h.type === "dragend") {
          var x = s.dropState;
          o.dynamicDrop && (x.activeDrops = Ft(o, s.element));
          var S = h, _ = bt(s, S, g);
          x.rejected = x.rejected && !!_ && _.dropzone === x.cur.dropzone && _.element === x.cur.element, x.cur.dropzone = _ && _.dropzone, x.cur.element = _ && _.element, x.events = Pt(s, 0, S);
        }
      }
      var De = { id: "actions/drop", install: function(l) {
        var o = l.actions, s = l.interactStatic, h = l.Interactable, g = l.defaults;
        l.usePlugin(A), h.prototype.dropzone = function(x) {
          return (function(S, _) {
            if (M.object(_)) {
              if (S.options.drop.enabled = _.enabled !== !1, _.listeners) {
                var D = Tt(_.listeners), H = Object.keys(D).reduce((function(X, ne) {
                  return X[/^(enter|leave)/.test(ne) ? "drag".concat(ne) : /^(activate|deactivate|move)/.test(ne) ? "drop".concat(ne) : ne] = D[ne], X;
                }), {}), L = S.options.drop.listeners;
                L && S.off(L), S.on(H), S.options.drop.listeners = H;
              }
              return M.func(_.ondrop) && S.on("drop", _.ondrop), M.func(_.ondropactivate) && S.on("dropactivate", _.ondropactivate), M.func(_.ondropdeactivate) && S.on("dropdeactivate", _.ondropdeactivate), M.func(_.ondragenter) && S.on("dragenter", _.ondragenter), M.func(_.ondragleave) && S.on("dragleave", _.ondragleave), M.func(_.ondropmove) && S.on("dropmove", _.ondropmove), /^(pointer|center)$/.test(_.overlap) ? S.options.drop.overlap = _.overlap : M.number(_.overlap) && (S.options.drop.overlap = Math.max(Math.min(1, _.overlap), 0)), "accept" in _ && (S.options.drop.accept = _.accept), "checker" in _ && (S.options.drop.checker = _.checker), S;
            }
            return M.bool(_) ? (S.options.drop.enabled = _, S) : S.options.drop;
          })(this, x);
        }, h.prototype.dropCheck = function(x, S, _, D, H, L) {
          return (function(X, ne, de, he, pe, we, Se) {
            var $e = !1;
            if (!(Se = Se || X.getRect(we))) return !!X.options.drop.checker && X.options.drop.checker(ne, de, $e, X, we, he, pe);
            var Ve = X.options.drop.overlap;
            if (Ve === "pointer") {
              var Ke = ft(he, pe, "drag"), Re = _e(ne);
              Re.x += Ke.x, Re.y += Ke.y;
              var We = Re.x > Se.left && Re.x < Se.right, ht = Re.y > Se.top && Re.y < Se.bottom;
              $e = We && ht;
            }
            var rt = he.getRect(pe);
            if (rt && Ve === "center") {
              var yt = rt.left + rt.width / 2, Ct = rt.top + rt.height / 2;
              $e = yt >= Se.left && yt <= Se.right && Ct >= Se.top && Ct <= Se.bottom;
            }
            return rt && M.number(Ve) && ($e = Math.max(0, Math.min(Se.right, rt.right) - Math.max(Se.left, rt.left)) * Math.max(0, Math.min(Se.bottom, rt.bottom) - Math.max(Se.top, rt.top)) / (rt.width * rt.height) >= Ve), X.options.drop.checker && ($e = X.options.drop.checker(ne, de, $e, X, we, he, pe)), $e;
          })(this, x, S, _, D, H, L);
        }, s.dynamicDrop = function(x) {
          return M.bool(x) ? (l.dynamicDrop = x, s) : l.dynamicDrop;
        }, be(o.phaselessTypes, { dragenter: !0, dragleave: !0, dropactivate: !0, dropdeactivate: !0, dropmove: !0, drop: !0 }), o.methodDict.drop = "dropzone", l.dynamicDrop = !1, g.actions.drop = De.defaults;
      }, listeners: { "interactions:before-action-start": function(l) {
        var o = l.interaction;
        o.prepared.name === "drag" && (o.dropState = { cur: { dropzone: null, element: null }, prev: { dropzone: null, element: null }, rejected: null, events: null, activeDrops: [] });
      }, "interactions:after-action-start": function(l, o) {
        var s = l.interaction, h = (l.event, l.iEvent);
        if (s.prepared.name === "drag") {
          var g = s.dropState;
          g.activeDrops = [], g.events = {}, g.activeDrops = Ft(o, s.element), g.events = Pt(s, 0, h), g.events.activate && (vt(g.activeDrops, g.events.activate), o.fire("actions/drop:start", { interaction: s, dragEvent: h }));
        }
      }, "interactions:action-move": wn, "interactions:after-action-move": function(l, o) {
        var s = l.interaction, h = l.iEvent;
        if (s.prepared.name === "drag") {
          var g = s.dropState;
          Xt(s, g.events), o.fire("actions/drop:move", { interaction: s, dragEvent: h }), g.events = {};
        }
      }, "interactions:action-end": function(l, o) {
        if (l.interaction.prepared.name === "drag") {
          var s = l.interaction, h = l.iEvent;
          wn(l, o), Xt(s, s.dropState.events), o.fire("actions/drop:end", { interaction: s, dragEvent: h });
        }
      }, "interactions:stop": function(l) {
        var o = l.interaction;
        if (o.prepared.name === "drag") {
          var s = o.dropState;
          s && (s.activeDrops = null, s.events = null, s.cur.dropzone = null, s.cur.element = null, s.prev.dropzone = null, s.prev.element = null, s.rejected = !1);
        }
      } }, getActiveDrops: Ft, getDrop: bt, getDropEvents: Pt, fireDropEvents: Xt, filterEventType: function(l) {
        return l.search("drag") === 0 || l.search("drop") === 0;
      }, defaults: { enabled: !1, accept: null, overlap: "pointer" } }, rn = De;
      function Rt(l) {
        var o = l.interaction, s = l.iEvent, h = l.phase;
        if (o.prepared.name === "gesture") {
          var g = o.pointers.map((function(H) {
            return H.pointer;
          })), x = h === "start", S = h === "end", _ = o.interactable.options.deltaSource;
          if (s.touches = [g[0], g[1]], x) s.distance = nt(g, _), s.box = et(g), s.scale = 1, s.ds = 0, s.angle = it(g, _), s.da = 0, o.gesture.startDistance = s.distance, o.gesture.startAngle = s.angle;
          else if (S || o.pointers.length < 2) {
            var D = o.prevEvent;
            s.distance = D.distance, s.box = D.box, s.scale = D.scale, s.ds = 0, s.angle = D.angle, s.da = 0;
          } else s.distance = nt(g, _), s.box = et(g), s.scale = s.distance / o.gesture.startDistance, s.angle = it(g, _), s.ds = s.scale - o.gesture.scale, s.da = s.angle - o.gesture.angle;
          o.gesture.distance = s.distance, o.gesture.angle = s.angle, M.number(s.scale) && s.scale !== 1 / 0 && !isNaN(s.scale) && (o.gesture.scale = s.scale);
        }
      }
      var hn = { id: "actions/gesture", before: ["actions/drag", "actions/resize"], install: function(l) {
        var o = l.actions, s = l.Interactable, h = l.defaults;
        s.prototype.gesturable = function(g) {
          return M.object(g) ? (this.options.gesture.enabled = g.enabled !== !1, this.setPerAction("gesture", g), this.setOnEvents("gesture", g), this) : M.bool(g) ? (this.options.gesture.enabled = g, this) : this.options.gesture;
        }, o.map.gesture = hn, o.methodDict.gesture = "gesturable", h.actions.gesture = hn.defaults;
      }, listeners: { "interactions:action-start": Rt, "interactions:action-move": Rt, "interactions:action-end": Rt, "interactions:new": function(l) {
        l.interaction.gesture = { angle: 0, distance: 0, scale: 1, startAngle: 0, startDistance: 0 };
      }, "auto-start:check": function(l) {
        if (!(l.interaction.pointers.length < 2)) {
          var o = l.interactable.options.gesture;
          if (o && o.enabled) return l.action = { name: "gesture" }, !1;
        }
      } }, defaults: {}, getCursor: function() {
        return "";
      }, filterEventType: function(l) {
        return l.search("gesture") === 0;
      } }, Ti = hn;
      function Pi(l, o, s, h, g, x, S) {
        if (!o) return !1;
        if (o === !0) {
          var _ = M.number(x.width) ? x.width : x.right - x.left, D = M.number(x.height) ? x.height : x.bottom - x.top;
          if (S = Math.min(S, Math.abs((l === "left" || l === "right" ? _ : D) / 2)), _ < 0 && (l === "left" ? l = "right" : l === "right" && (l = "left")), D < 0 && (l === "top" ? l = "bottom" : l === "bottom" && (l = "top")), l === "left") {
            var H = _ >= 0 ? x.left : x.right;
            return s.x < H + S;
          }
          if (l === "top") {
            var L = D >= 0 ? x.top : x.bottom;
            return s.y < L + S;
          }
          if (l === "right") return s.x > (_ >= 0 ? x.right : x.left) - S;
          if (l === "bottom") return s.y > (D >= 0 ? x.bottom : x.top) - S;
        }
        return !!M.element(h) && (M.element(o) ? o === h : Oe(h, o, g));
      }
      function gn(l) {
        var o = l.iEvent, s = l.interaction;
        if (s.prepared.name === "resize" && s.resizeAxes) {
          var h = o;
          s.interactable.options.resize.square ? (s.resizeAxes === "y" ? h.delta.x = h.delta.y : h.delta.y = h.delta.x, h.axes = "xy") : (h.axes = s.resizeAxes, s.resizeAxes === "x" ? h.delta.y = 0 : s.resizeAxes === "y" && (h.delta.x = 0));
        }
      }
      var un, vn, On = { id: "actions/resize", before: ["actions/drag"], install: function(l) {
        var o = l.actions, s = l.browser, h = l.Interactable, g = l.defaults;
        On.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" };
        })(s), On.defaultMargin = s.supportsTouch || s.supportsPointerEvent ? 20 : 10, h.prototype.resizable = function(x) {
          return (function(S, _, D) {
            return M.object(_) ? (S.options.resize.enabled = _.enabled !== !1, S.setPerAction("resize", _), S.setOnEvents("resize", _), M.string(_.axis) && /^x$|^y$|^xy$/.test(_.axis) ? S.options.resize.axis = _.axis : _.axis === null && (S.options.resize.axis = D.defaults.actions.resize.axis), M.bool(_.preserveAspectRatio) ? S.options.resize.preserveAspectRatio = _.preserveAspectRatio : M.bool(_.square) && (S.options.resize.square = _.square), S) : M.bool(_) ? (S.options.resize.enabled = _, S) : S.options.resize;
          })(this, x, l);
        }, o.map.resize = On, o.methodDict.resize = "resizable", g.actions.resize = On.defaults;
      }, listeners: { "interactions:new": function(l) {
        l.interaction.resizeAxes = "xy";
      }, "interactions:action-start": function(l) {
        (function(o) {
          var s = o.iEvent, h = o.interaction;
          if (h.prepared.name === "resize" && h.prepared.edges) {
            var g = s, x = h.rect;
            h._rects = { start: be({}, x), corrected: be({}, x), previous: be({}, x), delta: { left: 0, right: 0, width: 0, top: 0, bottom: 0, height: 0 } }, g.edges = h.prepared.edges, g.rect = h._rects.corrected, g.deltaRect = h._rects.delta;
          }
        })(l), gn(l);
      }, "interactions:action-move": function(l) {
        (function(o) {
          var s = o.iEvent, h = o.interaction;
          if (h.prepared.name === "resize" && h.prepared.edges) {
            var g = s, x = h.interactable.options.resize.invert, S = x === "reposition" || x === "negate", _ = h.rect, D = h._rects, H = D.start, L = D.corrected, X = D.delta, ne = D.previous;
            if (be(ne, L), S) {
              if (be(L, _), x === "reposition") {
                if (L.top > L.bottom) {
                  var de = L.top;
                  L.top = L.bottom, L.bottom = de;
                }
                if (L.left > L.right) {
                  var he = L.left;
                  L.left = L.right, L.right = he;
                }
              }
            } else L.top = Math.min(_.top, H.bottom), L.bottom = Math.max(_.bottom, H.top), L.left = Math.min(_.left, H.right), L.right = Math.max(_.right, H.left);
            for (var pe in L.width = L.right - L.left, L.height = L.bottom - L.top, L) X[pe] = L[pe] - ne[pe];
            g.edges = h.prepared.edges, g.rect = L, g.deltaRect = X;
          }
        })(l), gn(l);
      }, "interactions:action-end": function(l) {
        var o = l.iEvent, s = l.interaction;
        if (s.prepared.name === "resize" && s.prepared.edges) {
          var h = o;
          h.edges = s.prepared.edges, h.rect = s._rects.corrected, h.deltaRect = s._rects.delta;
        }
      }, "auto-start:check": function(l) {
        var o = l.interaction, s = l.interactable, h = l.element, g = l.rect, x = l.buttons;
        if (g) {
          var S = be({}, o.coords.cur.page), _ = s.options.resize;
          if (_ && _.enabled && (!o.pointerIsDown || !/mouse|pointer/.test(o.pointerType) || (x & _.mouseButtons) != 0)) {
            if (M.object(_.edges)) {
              var D = { left: !1, right: !1, top: !1, bottom: !1 };
              for (var H in D) D[H] = Pi(H, _.edges[H], S, o._latestPointer.eventTarget, h, g, _.margin || On.defaultMargin);
              D.left = D.left && !D.right, D.top = D.top && !D.bottom, (D.left || D.right || D.top || D.bottom) && (l.action = { name: "resize", edges: D });
            } else {
              var L = _.axis !== "y" && S.x > g.right - On.defaultMargin, X = _.axis !== "x" && S.y > g.bottom - On.defaultMargin;
              (L || X) && (l.action = { name: "resize", axes: (L ? "x" : "") + (X ? "y" : "") });
            }
            return !l.action && void 0;
          }
        }
      } }, defaults: { square: !1, preserveAspectRatio: !1, axis: "xy", margin: NaN, edges: null, invert: "none" }, cursors: null, getCursor: function(l) {
        var o = l.edges, s = l.axis, h = l.name, g = On.cursors, x = null;
        if (s) x = g[h + s];
        else if (o) {
          for (var S = "", _ = 0, D = ["top", "bottom", "left", "right"]; _ < D.length; _++) {
            var H = D[_];
            o[H] && (S += H);
          }
          x = g[S];
        }
        return x;
      }, filterEventType: function(l) {
        return l.search("resize") === 0;
      }, defaultMargin: null }, Bo = On, Ra = { id: "actions", install: function(l) {
        l.usePlugin(Ti), l.usePlugin(Bo), l.usePlugin(A), l.usePlugin(rn);
      } }, Ho = 0, cn = { request: function(l) {
        return un(l);
      }, cancel: function(l) {
        return vn(l);
      }, init: function(l) {
        if (un = l.requestAnimationFrame, vn = l.cancelAnimationFrame, !un) for (var o = ["ms", "moz", "webkit", "o"], s = 0; s < o.length; s++) {
          var h = o[s];
          un = l["".concat(h, "RequestAnimationFrame")], vn = l["".concat(h, "CancelAnimationFrame")] || l["".concat(h, "CancelRequestAnimationFrame")];
        }
        un = un && un.bind(l), vn = vn && vn.bind(l), un || (un = function(g) {
          var x = Date.now(), S = Math.max(0, 16 - (x - Ho)), _ = l.setTimeout((function() {
            g(x + S);
          }), S);
          return Ho = x + S, _;
        }, vn = function(g) {
          return clearTimeout(g);
        });
      } }, Ue = { 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(l) {
        Ue.isScrolling = !0, cn.cancel(Ue.i), l.autoScroll = Ue, Ue.interaction = l, Ue.prevTime = Ue.now(), Ue.i = cn.request(Ue.scroll);
      }, stop: function() {
        Ue.isScrolling = !1, Ue.interaction && (Ue.interaction.autoScroll = null), cn.cancel(Ue.i);
      }, scroll: function() {
        var l = Ue.interaction, o = l.interactable, s = l.element, h = l.prepared.name, g = o.options[h].autoScroll, x = $i(g.container, o, s), S = Ue.now(), _ = (S - Ue.prevTime) / 1e3, D = g.speed * _;
        if (D >= 1) {
          var H = { x: Ue.x * D, y: Ue.y * D };
          if (H.x || H.y) {
            var L = so(x);
            M.window(x) ? x.scrollBy(H.x, H.y) : x && (x.scrollLeft += H.x, x.scrollTop += H.y);
            var X = so(x), ne = { x: X.x - L.x, y: X.y - L.y };
            (ne.x || ne.y) && o.fire({ type: "autoscroll", target: s, interactable: o, delta: ne, interaction: l, container: x });
          }
          Ue.prevTime = S;
        }
        Ue.isScrolling && (cn.cancel(Ue.i), Ue.i = cn.request(Ue.scroll));
      }, check: function(l, o) {
        var s;
        return (s = l.options[o].autoScroll) == null ? void 0 : s.enabled;
      }, onInteractionMove: function(l) {
        var o = l.interaction, s = l.pointer;
        if (o.interacting() && Ue.check(o.interactable, o.prepared.name)) if (o.simulation) Ue.x = Ue.y = 0;
        else {
          var h, g, x, S, _ = o.interactable, D = o.element, H = o.prepared.name, L = _.options[H].autoScroll, X = $i(L.container, _, D);
          if (M.window(X)) S = s.clientX < Ue.margin, h = s.clientY < Ue.margin, g = s.clientX > X.innerWidth - Ue.margin, x = s.clientY > X.innerHeight - Ue.margin;
          else {
            var ne = ke(X);
            S = s.clientX < ne.left + Ue.margin, h = s.clientY < ne.top + Ue.margin, g = s.clientX > ne.right - Ue.margin, x = s.clientY > ne.bottom - Ue.margin;
          }
          Ue.x = g ? 1 : S ? -1 : 0, Ue.y = x ? 1 : h ? -1 : 0, Ue.isScrolling || (Ue.margin = L.margin, Ue.speed = L.speed, Ue.start(o));
        }
      } };
      function $i(l, o, s) {
        return (M.string(l) ? qe(l, o, s) : l) || O(s);
      }
      function so(l) {
        return M.window(l) && (l = window.document.body), { x: l.scrollLeft, y: l.scrollTop };
      }
      var li = { id: "auto-scroll", install: function(l) {
        var o = l.defaults, s = l.actions;
        l.autoScroll = Ue, Ue.now = function() {
          return l.now();
        }, s.phaselessTypes.autoscroll = !0, o.perAction.autoScroll = Ue.defaults;
      }, listeners: { "interactions:new": function(l) {
        l.interaction.autoScroll = null;
      }, "interactions:destroy": function(l) {
        l.interaction.autoScroll = null, Ue.stop(), Ue.interaction && (Ue.interaction = null);
      }, "interactions:stop": Ue.stop, "interactions:action-move": function(l) {
        return Ue.onInteractionMove(l);
      } } }, Qt = li;
      function Ot(l, o) {
        var s = !1;
        return function() {
          return s || (F.console.warn(o), s = !0), l.apply(this, arguments);
        };
      }
      function Bt(l, o) {
        return l.name = o.name, l.axis = o.axis, l.edges = o.edges, l;
      }
      function kl(l) {
        return M.bool(l) ? (this.options.styleCursor = l, this) : l === null ? (delete this.options.styleCursor, this) : this.options.styleCursor;
      }
      function Sn(l) {
        return M.func(l) ? (this.options.actionChecker = l, this) : l === null ? (delete this.options.actionChecker, this) : this.options.actionChecker;
      }
      var Xi = { id: "auto-start/interactableMethods", install: function(l) {
        var o = l.Interactable;
        o.prototype.getAction = function(s, h, g, x) {
          var S = (function(_, D, H, L, X) {
            var ne = _.getRect(L), de = D.buttons || { 0: 1, 1: 4, 3: 8, 4: 16 }[D.button], he = { action: null, interactable: _, interaction: H, element: L, rect: ne, buttons: de };
            return X.fire("auto-start:check", he), he.action;
          })(this, h, g, x, l);
          return this.options.actionChecker ? this.options.actionChecker(s, h, S, this, x, g) : S;
        }, o.prototype.ignoreFrom = Ot((function(s) {
          return this._backCompatOption("ignoreFrom", s);
        }), "Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."), o.prototype.allowFrom = Ot((function(s) {
          return this._backCompatOption("allowFrom", s);
        }), "Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."), o.prototype.actionChecker = Sn, o.prototype.styleCursor = kl;
      } };
      function ro(l, o, s, h, g) {
        return o.testIgnoreAllow(o.options[l.name], s, h) && o.options[l.name].enabled && Ei(o, s, l, g) ? l : null;
      }
      function uo(l, o, s, h, g, x, S) {
        for (var _ = 0, D = h.length; _ < D; _++) {
          var H = h[_], L = g[_], X = H.getAction(o, s, l, L);
          if (X) {
            var ne = ro(X, H, L, x, S);
            if (ne) return { action: ne, interactable: H, element: L };
          }
        }
        return { action: null, interactable: null, element: null };
      }
      function Qi(l, o, s, h, g) {
        var x = [], S = [], _ = h;
        function D(L) {
          x.push(L), S.push(_);
        }
        for (; M.element(_); ) {
          x = [], S = [], g.interactables.forEachMatch(_, D);
          var H = uo(l, o, s, x, S, h, g);
          if (H.action && !H.interactable.options[H.action.name].manualStart) return H;
          _ = me(_);
        }
        return { action: null, interactable: null, element: null };
      }
      function hi(l, o, s) {
        var h = o.action, g = o.interactable, x = o.element;
        h = h || { name: null }, l.interactable = g, l.element = x, Bt(l.prepared, h), l.rect = g && h.name ? g.getRect(x) : null, _l(l, s), s.fire("autoStart:prepared", { interaction: l });
      }
      function Ei(l, o, s, h) {
        var g = l.options, x = g[s.name].max, S = g[s.name].maxPerElement, _ = h.autoStart.maxInteractions, D = 0, H = 0, L = 0;
        if (!(x && S && _)) return !1;
        for (var X = 0, ne = h.interactions.list; X < ne.length; X++) {
          var de = ne[X], he = de.prepared.name;
          if (de.interacting() && (++D >= _ || de.interactable === l && ((H += he === s.name ? 1 : 0) >= x || de.element === o && (L++, he === s.name && L >= S))))
            return !1;
        }
        return _ > 0;
      }
      function Cl(l, o) {
        return M.number(l) ? (o.autoStart.maxInteractions = l, this) : o.autoStart.maxInteractions;
      }
      function Ji(l, o, s) {
        var h = s.autoStart.cursorElement;
        h && h !== l && (h.style.cursor = ""), l.ownerDocument.documentElement.style.cursor = o, l.style.cursor = o, s.autoStart.cursorElement = o ? l : null;
      }
      function _l(l, o) {
        var s = l.interactable, h = l.element, g = l.prepared;
        if (l.pointerType === "mouse" && s && s.options.styleCursor) {
          var x = "";
          if (g.name) {
            var S = s.options[g.name].cursorChecker;
            x = M.func(S) ? S(g, s, h, l._interacting) : o.actions.map[g.name].getCursor(g);
          }
          Ji(l.element, x || "", o);
        } else o.autoStart.cursorElement && Ji(o.autoStart.cursorElement, "", o);
      }
      var co = { id: "auto-start/base", before: ["actions"], install: function(l) {
        var o = l.interactStatic, s = l.defaults;
        l.usePlugin(Xi), s.base.actionChecker = null, s.base.styleCursor = !0, be(s.perAction, { manualStart: !1, max: 1 / 0, maxPerElement: 1, allowFrom: null, ignoreFrom: null, mouseButtons: 1 }), o.maxInteractions = function(h) {
          return Cl(h, l);
        }, l.autoStart = { maxInteractions: 1 / 0, withinInteractionLimit: Ei, cursorElement: null };
      }, listeners: { "interactions:down": function(l, o) {
        var s = l.interaction, h = l.pointer, g = l.event, x = l.eventTarget;
        s.interacting() || hi(s, Qi(s, h, g, x, o), o);
      }, "interactions:move": function(l, o) {
        (function(s, h) {
          var g = s.interaction, x = s.pointer, S = s.event, _ = s.eventTarget;
          g.pointerType !== "mouse" || g.pointerIsDown || g.interacting() || hi(g, Qi(g, x, S, _, h), h);
        })(l, o), (function(s, h) {
          var g = s.interaction;
          if (g.pointerIsDown && !g.interacting() && g.pointerWasMoved && g.prepared.name) {
            h.fire("autoStart:before-start", s);
            var x = g.interactable, S = g.prepared.name;
            S && x && (x.options[S].manualStart || !Ei(x, g.element, g.prepared, h) ? g.stop() : (g.start(g.prepared, x, g.element), _l(g, h)));
          }
        })(l, o);
      }, "interactions:stop": function(l, o) {
        var s = l.interaction, h = s.interactable;
        h && h.options.styleCursor && Ji(s.element, "", o);
      } }, maxInteractions: Cl, withinInteractionLimit: Ei, validateAction: ro }, Zi = co, fo = { id: "auto-start/dragAxis", listeners: { "autoStart:before-start": function(l, o) {
        var s = l.interaction, h = l.eventTarget, g = l.dx, x = l.dy;
        if (s.prepared.name === "drag") {
          var S = Math.abs(g), _ = Math.abs(x), D = s.interactable.options.drag, H = D.startAxis, L = S > _ ? "x" : S < _ ? "y" : "xy";
          if (s.prepared.axis = D.lockAxis === "start" ? L[0] : D.lockAxis, L !== "xy" && H !== "xy" && H !== L) {
            s.prepared.name = null;
            for (var X = h, ne = function(he) {
              if (he !== s.interactable) {
                var pe = s.interactable.options.drag;
                if (!pe.manualStart && he.testIgnoreAllow(pe, X, h)) {
                  var we = he.getAction(s.downPointer, s.downEvent, s, X);
                  if (we && we.name === "drag" && (function(Se, $e) {
                    if (!$e) return !1;
                    var Ve = $e.options.drag.startAxis;
                    return Se === "xy" || Ve === "xy" || Ve === Se;
                  })(L, he) && Zi.validateAction(we, he, X, h, o)) return he;
                }
              }
            }; M.element(X); ) {
              var de = o.interactables.forEachMatch(X, ne);
              if (de) {
                s.prepared.name = "drag", s.interactable = de, s.element = X;
                break;
              }
              X = me(X);
            }
          }
        }
      } } };
      function kn(l) {
        var o = l.prepared && l.prepared.name;
        if (!o) return null;
        var s = l.interactable.options;
        return s[o].hold || s[o].delay;
      }
      var Wo = { id: "auto-start/hold", install: function(l) {
        var o = l.defaults;
        l.usePlugin(Zi), o.perAction.hold = 0, o.perAction.delay = 0;
      }, listeners: { "interactions:new": function(l) {
        l.interaction.autoStartHoldTimer = null;
      }, "autoStart:prepared": function(l) {
        var o = l.interaction, s = kn(o);
        s > 0 && (o.autoStartHoldTimer = setTimeout((function() {
          o.start(o.prepared, o.interactable, o.element);
        }), s));
      }, "interactions:move": function(l) {
        var o = l.interaction, s = l.duplicate;
        o.autoStartHoldTimer && o.pointerWasMoved && !s && (clearTimeout(o.autoStartHoldTimer), o.autoStartHoldTimer = null);
      }, "autoStart:before-start": function(l) {
        var o = l.interaction;
        kn(o) > 0 && (o.prepared.name = null);
      } }, getHoldDuration: kn }, jo = Wo, ho = { id: "auto-start", install: function(l) {
        l.usePlugin(Zi), l.usePlugin(jo), l.usePlugin(fo);
      } }, Go = function(l) {
        return /^(always|never|auto)$/.test(l) ? (this.options.preventDefault = l, this) : M.bool(l) ? (this.options.preventDefault = l ? "always" : "never", this) : this.options.preventDefault;
      };
      function Na(l) {
        var o = l.interaction, s = l.event;
        o.interactable && o.interactable.checkAndPreventDefault(s);
      }
      var Yo = { id: "core/interactablePreventDefault", install: function(l) {
        var o = l.Interactable;
        o.prototype.preventDefault = Go, o.prototype.checkAndPreventDefault = function(s) {
          return (function(h, g, x) {
            var S = h.options.preventDefault;
            if (S !== "never") if (S !== "always") {
              if (g.events.supportsPassive && /^touch(start|move)$/.test(x.type)) {
                var _ = O(x.target).document, D = g.getDocOptions(_);
                if (!D || !D.events || D.events.passive !== !1) return;
              }
              /^(mouse|pointer|touch)*(down|start)/i.test(x.type) || M.element(x.target) && ge(x.target, "input,select,textarea,[contenteditable=true],[contenteditable=true] *") || x.preventDefault();
            } else x.preventDefault();
          })(this, l, s);
        }, l.interactions.docEvents.push({ type: "dragstart", listener: function(s) {
          for (var h = 0, g = l.interactions.list; h < g.length; h++) {
            var x = g[h];
            if (x.element && (x.element === s.target || ie(x.element, s.target))) return void x.interactable.checkAndPreventDefault(s);
          }
        } });
      }, listeners: ["down", "move", "up", "cancel"].reduce((function(l, o) {
        return l["interactions:".concat(o)] = Na, l;
      }), {}) };
      function zl(l, o) {
        if (o.phaselessTypes[l]) return !0;
        for (var s in o.map) if (l.indexOf(s) === 0 && l.substr(s.length) in o.phases) return !0;
        return !1;
      }
      function gi(l) {
        var o = {};
        for (var s in l) {
          var h = l[s];
          M.plainObject(h) ? o[s] = gi(h) : M.array(h) ? o[s] = sn(h) : o[s] = h;
        }
        return o;
      }
      var Ml = (function() {
        function l(o) {
          r(this, l), 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 = o, this.result = Tl(), this.edges = { left: !1, right: !1, top: !1, bottom: !1 };
        }
        return u(l, [{ key: "start", value: function(o, s) {
          var h, g, x = o.phase, S = this.interaction, _ = (function(H) {
            var L = H.interactable.options[H.prepared.name], X = L.modifiers;
            return X && X.length ? X : ["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;
            }));
          })(S);
          this.prepareStates(_), this.startEdges = be({}, S.edges), this.edges = be({}, this.startEdges), this.startOffset = (h = S.rect, g = s, h ? { left: g.x - h.left, top: g.y - h.top, right: h.right - g.x, bottom: h.bottom - g.y } : { left: 0, top: 0, right: 0, bottom: 0 }), this.startDelta = { x: 0, y: 0 };
          var D = this.fillArg({ phase: x, pageCoords: s, preEnd: !1 });
          return this.result = Tl(), this.startAll(D), this.result = this.setAll(D);
        } }, { key: "fillArg", value: function(o) {
          var s = this.interaction;
          return o.interaction = s, o.interactable = s.interactable, o.element = s.element, o.rect || (o.rect = s.rect), o.edges || (o.edges = this.startEdges), o.startOffset = this.startOffset, o;
        } }, { key: "startAll", value: function(o) {
          for (var s = 0, h = this.states; s < h.length; s++) {
            var g = h[s];
            g.methods.start && (o.state = g, g.methods.start(o));
          }
        } }, { key: "setAll", value: function(o) {
          var s = o.phase, h = o.preEnd, g = o.skipModifiers, x = o.rect, S = o.edges;
          o.coords = be({}, o.pageCoords), o.rect = be({}, x), o.edges = be({}, S);
          for (var _ = g ? this.states.slice(g) : this.states, D = Tl(o.coords, o.rect), H = 0; H < _.length; H++) {
            var L, X = _[H], ne = X.options, de = be({}, o.coords), he = null;
            (L = X.methods) != null && L.set && this.shouldDo(ne, h, s) && (o.state = X, he = X.methods.set(o), It(o.edges, o.rect, { x: o.coords.x - de.x, y: o.coords.y - de.y })), D.eventProps.push(he);
          }
          be(this.edges, o.edges), D.delta.x = o.coords.x - o.pageCoords.x, D.delta.y = o.coords.y - o.pageCoords.y, D.rectDelta.left = o.rect.left - x.left, D.rectDelta.right = o.rect.right - x.right, D.rectDelta.top = o.rect.top - x.top, D.rectDelta.bottom = o.rect.bottom - x.bottom;
          var pe = this.result.coords, we = this.result.rect;
          if (pe && we) {
            var Se = D.rect.left !== we.left || D.rect.right !== we.right || D.rect.top !== we.top || D.rect.bottom !== we.bottom;
            D.changed = Se || pe.x !== D.coords.x || pe.y !== D.coords.y;
          }
          return D;
        } }, { key: "applyToInteraction", value: function(o) {
          var s = this.interaction, h = o.phase, g = s.coords.cur, x = s.coords.start, S = this.result, _ = this.startDelta, D = S.delta;
          h === "start" && be(this.startDelta, S.delta);
          for (var H = 0, L = [[x, _], [g, D]]; H < L.length; H++) {
            var X = L[H], ne = X[0], de = X[1];
            ne.page.x += de.x, ne.page.y += de.y, ne.client.x += de.x, ne.client.y += de.y;
          }
          var he = this.result.rectDelta, pe = o.rect || s.rect;
          pe.left += he.left, pe.right += he.right, pe.top += he.top, pe.bottom += he.bottom, pe.width = pe.right - pe.left, pe.height = pe.bottom - pe.top;
        } }, { key: "setAndApply", value: function(o) {
          var s = this.interaction, h = o.phase, g = o.preEnd, x = o.skipModifiers, S = this.setAll(this.fillArg({ preEnd: g, phase: h, pageCoords: o.modifiedCoords || s.coords.cur.page }));
          if (this.result = S, !S.changed && (!x || x < this.states.length) && s.interacting()) return !1;
          if (o.modifiedCoords) {
            var _ = s.coords.cur.page, D = { x: o.modifiedCoords.x - _.x, y: o.modifiedCoords.y - _.y };
            S.coords.x += D.x, S.coords.y += D.y, S.delta.x += D.x, S.delta.y += D.y;
          }
          this.applyToInteraction(o);
        } }, { key: "beforeEnd", value: function(o) {
          var s = o.interaction, h = o.event, g = this.states;
          if (g && g.length) {
            for (var x = !1, S = 0; S < g.length; S++) {
              var _ = g[S];
              o.state = _;
              var D = _.options, H = _.methods, L = H.beforeEnd && H.beforeEnd(o);
              if (L) return this.endResult = L, !1;
              x = x || !x && this.shouldDo(D, !0, o.phase, !0);
            }
            x && s.move({ event: h, preEnd: !0 });
          }
        } }, { key: "stop", value: function(o) {
          var s = o.interaction;
          if (this.states && this.states.length) {
            var h = be({ states: this.states, interactable: s.interactable, element: s.element, rect: null }, o);
            this.fillArg(h);
            for (var g = 0, x = this.states; g < x.length; g++) {
              var S = x[g];
              h.state = S, S.methods.stop && S.methods.stop(h);
            }
            this.states = null, this.endResult = null;
          }
        } }, { key: "prepareStates", value: function(o) {
          this.states = [];
          for (var s = 0; s < o.length; s++) {
            var h = o[s], g = h.options, x = h.methods, S = h.name;
            this.states.push({ options: g, methods: x, index: s, name: S });
          }
          return this.states;
        } }, { key: "restoreInteractionCoords", value: function(o) {
          var s = o.interaction, h = s.coords, g = s.rect, x = s.modification;
          if (x.result) {
            for (var S = x.startDelta, _ = x.result, D = _.delta, H = _.rectDelta, L = 0, X = [[h.start, S], [h.cur, D]]; L < X.length; L++) {
              var ne = X[L], de = ne[0], he = ne[1];
              de.page.x -= he.x, de.page.y -= he.y, de.client.x -= he.x, de.client.y -= he.y;
            }
            g.left -= H.left, g.right -= H.right, g.top -= H.top, g.bottom -= H.bottom;
          }
        } }, { key: "shouldDo", value: function(o, s, h, g) {
          return !(!o || o.enabled === !1 || g && !o.endOnly || o.endOnly && !s || h === "start" && !o.setStart);
        } }, { key: "copyFrom", value: function(o) {
          this.startOffset = o.startOffset, this.startDelta = o.startDelta, this.startEdges = o.startEdges, this.edges = o.edges, this.states = o.states.map((function(s) {
            return gi(s);
          })), this.result = Tl(be({}, o.result.coords), be({}, o.result.rect));
        } }, { key: "destroy", value: function() {
          for (var o in this) this[o] = null;
        } }]), l;
      })();
      function Tl(l, o) {
        return { rect: o, coords: l, delta: { x: 0, y: 0 }, rectDelta: { left: 0, right: 0, top: 0, bottom: 0 }, eventProps: [], changed: !0 };
      }
      function jn(l, o) {
        var s = l.defaults, h = { start: l.start, set: l.set, beforeEnd: l.beforeEnd, stop: l.stop }, g = function(x) {
          var S = x || {};
          for (var _ in S.enabled = S.enabled !== !1, s) _ in S || (S[_] = s[_]);
          var D = { options: S, methods: h, name: o, enable: function() {
            return S.enabled = !0, D;
          }, disable: function() {
            return S.enabled = !1, D;
          } };
          return D;
        };
        return o && typeof o == "string" && (g._defaults = s, g._methods = h), g;
      }
      function pi(l) {
        var o = l.iEvent, s = l.interaction.modification.result;
        s && (o.modifiers = s.eventProps);
      }
      var Pl = { id: "modifiers/base", before: ["actions"], install: function(l) {
        l.defaults.perAction.modifiers = [];
      }, listeners: { "interactions:new": function(l) {
        var o = l.interaction;
        o.modification = new Ml(o);
      }, "interactions:before-action-start": function(l) {
        var o = l.interaction, s = l.interaction.modification;
        s.start(l, o.coords.start.page), o.edges = s.edges, s.applyToInteraction(l);
      }, "interactions:before-action-move": function(l) {
        var o = l.interaction, s = o.modification, h = s.setAndApply(l);
        return o.edges = s.edges, h;
      }, "interactions:before-action-end": function(l) {
        var o = l.interaction, s = o.modification, h = s.beforeEnd(l);
        return o.edges = s.startEdges, h;
      }, "interactions:action-start": pi, "interactions:action-move": pi, "interactions:action-end": pi, "interactions:after-action-start": function(l) {
        return l.interaction.modification.restoreInteractionCoords(l);
      }, "interactions:after-action-move": function(l) {
        return l.interaction.modification.restoreInteractionCoords(l);
      }, "interactions:stop": function(l) {
        return l.interaction.modification.stop(l);
      } } }, el = Pl, Uo = { base: { preventDefault: "auto", deltaSource: "page" }, perAction: { enabled: !1, origin: { x: 0, y: 0 } }, actions: {} }, tl = (function(l) {
        p(s, l);
        var o = C(s);
        function s(h, g, x, S, _, D, H) {
          var L;
          r(this, s), (L = o.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, _ = _ || h.element;
          var X = h.interactable, ne = (X && X.options || Uo).deltaSource, de = ft(X, _, x), he = S === "start", pe = S === "end", we = he ? v(L) : h.prevEvent, Se = he ? h.coords.start : pe ? { page: we.page, client: we.client, timeStamp: h.coords.cur.timeStamp } : h.coords.cur;
          return L.page = be({}, Se.page), L.client = be({}, Se.client), L.rect = be({}, h.rect), L.timeStamp = Se.timeStamp, pe || (L.page.x -= de.x, L.page.y -= de.y, L.client.x -= de.x, L.client.y -= de.y), L.ctrlKey = g.ctrlKey, L.altKey = g.altKey, L.shiftKey = g.shiftKey, L.metaKey = g.metaKey, L.button = g.button, L.buttons = g.buttons, L.target = _, L.currentTarget = _, L.preEnd = D, L.type = H || x + (S || ""), L.interactable = X, L.t0 = he ? h.pointers[h.pointers.length - 1].downTime : we.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 = he || pe ? { x: 0, y: 0 } : { x: L[ne].x - we[ne].x, y: L[ne].y - we[ne].y }, L.dt = h.coords.delta.timeStamp, L.duration = L.timeStamp - L.t0, L.velocity = be({}, h.coords.velocity[ne]), L.speed = At(L.velocity.x, L.velocity.y), L.swipe = pe || S === "inertiastart" ? L.getSwipe() : null, L;
        }
        return u(s, [{ key: "getSwipe", value: function() {
          var h = this._interaction;
          if (h.prevEvent.speed < 600 || this.timeStamp - h.prevEvent.timeStamp > 150) return null;
          var g = 180 * Math.atan2(h.prevEvent.velocityY, h.prevEvent.velocityX) / Math.PI;
          g < 0 && (g += 360);
          var x = 112.5 <= g && g < 247.5, S = 202.5 <= g && g < 337.5;
          return { up: S, down: !S && 22.5 <= g && g < 157.5, left: x, right: !x && (292.5 <= g || g < 67.5), angle: g, 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;
        } }]), s;
      })(Gt);
      Object.defineProperties(tl.prototype, { pageX: { get: function() {
        return this.page.x;
      }, set: function(l) {
        this.page.x = l;
      } }, pageY: { get: function() {
        return this.page.y;
      }, set: function(l) {
        this.page.y = l;
      } }, clientX: { get: function() {
        return this.client.x;
      }, set: function(l) {
        this.client.x = l;
      } }, clientY: { get: function() {
        return this.client.y;
      }, set: function(l) {
        this.client.y = l;
      } }, dx: { get: function() {
        return this.delta.x;
      }, set: function(l) {
        this.delta.x = l;
      } }, dy: { get: function() {
        return this.delta.y;
      }, set: function(l) {
        this.delta.y = l;
      } }, velocityX: { get: function() {
        return this.velocity.x;
      }, set: function(l) {
        this.velocity.x = l;
      } }, velocityY: { get: function() {
        return this.velocity.y;
      }, set: function(l) {
        this.velocity.y = l;
      } } });
      var Va = u((function l(o, s, h, g, x) {
        r(this, l), this.id = void 0, this.pointer = void 0, this.event = void 0, this.downTime = void 0, this.downTarget = void 0, this.id = o, this.pointer = s, this.event = h, this.downTime = g, this.downTarget = x;
      })), Fa = (function(l) {
        return l.interactable = "", l.element = "", l.prepared = "", l.pointerIsDown = "", l.pointerWasMoved = "", l._proxy = "", l;
      })({}), Ko = (function(l) {
        return l.start = "", l.move = "", l.end = "", l.stop = "", l.interacting = "", l;
      })({}), Ii = 0, $l = (function() {
        function l(o) {
          var s = this, h = o.pointerType, g = o.scopeFire;
          r(this, l), 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 = Ot((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 = Ii++, this._scopeFire = g, this.pointerType = h;
          var x = this;
          this._proxy = {};
          var S = function(L) {
            Object.defineProperty(s._proxy, L, { get: function() {
              return x[L];
            } });
          };
          for (var _ in Fa) S(_);
          var D = function(L) {
            Object.defineProperty(s._proxy, L, { value: function() {
              return x[L].apply(x, arguments);
            } });
          };
          for (var H in Ko) D(H);
          this._scopeFire("interactions:new", { interaction: this });
        }
        return u(l, [{ key: "pointerMoveTolerance", get: function() {
          return 1;
        } }, { key: "pointerDown", value: function(o, s, h) {
          var g = this.updatePointer(o, s, h, !0), x = this.pointers[g];
          this._scopeFire("interactions:down", { pointer: o, event: s, eventTarget: h, pointerIndex: g, pointerInfo: x, type: "down", interaction: this });
        } }, { key: "start", value: function(o, s, h) {
          return !(this.interacting() || !this.pointerIsDown || this.pointers.length < (o.name === "gesture" ? 2 : 1) || !s.options[o.name].enabled) && (Bt(this.prepared, o), this.interactable = s, this.element = h, this.rect = s.getRect(h), this.edges = this.prepared.edges ? be({}, 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(o, s, h) {
          this.simulation || this.modification && this.modification.endResult || this.updatePointer(o, s, h, !1);
          var g, x, S = 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 && (g = this.coords.cur.client.x - this.coords.start.client.x, x = this.coords.cur.client.y - this.coords.start.client.y, this.pointerWasMoved = At(g, x) > this.pointerMoveTolerance);
          var _, D, H, L = this.getPointerIndex(o), X = { pointer: o, pointerIndex: L, pointerInfo: this.pointers[L], event: s, type: "move", eventTarget: h, dx: g, dy: x, duplicate: S, interaction: this };
          S || (_ = this.coords.velocity, D = this.coords.delta, H = Math.max(D.timeStamp / 1e3, 1e-3), _.page.x = D.page.x / H, _.page.y = D.page.y / H, _.client.x = D.client.x / H, _.client.y = D.client.y / H, _.timeStamp = H), this._scopeFire("interactions:move", X), S || this.simulation || (this.interacting() && (X.type = null, this.move(X)), this.pointerWasMoved && ln(this.coords.prev, this.coords.cur));
        } }, { key: "move", value: function(o) {
          o && o.event || Be(this.coords.delta), (o = be({ pointer: this._latestPointer.pointer, event: this._latestPointer.event, eventTarget: this._latestPointer.eventTarget, interaction: this }, o || {})).phase = "move", this._doPhase(o);
        } }, { key: "pointerUp", value: function(o, s, h, g) {
          var x = this.getPointerIndex(o);
          x === -1 && (x = this.updatePointer(o, s, h, !1));
          var S = /cancel$/i.test(s.type) ? "cancel" : "up";
          this._scopeFire("interactions:".concat(S), { pointer: o, pointerIndex: x, pointerInfo: this.pointers[x], event: s, eventTarget: h, type: S, curEventTarget: g, interaction: this }), this.simulation || this.end(s), this.removePointer(o, s);
        } }, { key: "documentBlur", value: function(o) {
          this.end(o), this._scopeFire("interactions:blur", { event: o, type: "blur", interaction: this });
        } }, { key: "end", value: function(o) {
          var s;
          this._ending = !0, o = o || this._latestPointer.event, this.interacting() && (s = this._doPhase({ event: o, interaction: this, phase: "end" })), this._ending = !1, s === !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(o) {
          var s = je(o);
          return this.pointerType === "mouse" || this.pointerType === "pen" ? this.pointers.length - 1 : Ut(this.pointers, (function(h) {
            return h.id === s;
          }));
        } }, { key: "getPointerInfo", value: function(o) {
          return this.pointers[this.getPointerIndex(o)];
        } }, { key: "updatePointer", value: function(o, s, h, g) {
          var x, S, _, D = je(o), H = this.getPointerIndex(o), L = this.pointers[H];
          return g = g !== !1 && (g || /(down|start)$/i.test(s.type)), L ? L.pointer = o : (L = new Va(D, o, s, null, null), H = this.pointers.length, this.pointers.push(L)), ct(this.coords.cur, this.pointers.map((function(X) {
            return X.pointer;
          })), this._now()), x = this.coords.delta, S = this.coords.prev, _ = this.coords.cur, x.page.x = _.page.x - S.page.x, x.page.y = _.page.y - S.page.y, x.client.x = _.client.x - S.client.x, x.client.y = _.client.y - S.client.y, x.timeStamp = _.timeStamp - S.timeStamp, g && (this.pointerIsDown = !0, L.downTime = this.coords.cur.timeStamp, L.downTarget = h, Wt(this.downPointer, o), this.interacting() || (ln(this.coords.start, this.coords.cur), ln(this.coords.prev, this.coords.cur), this.downEvent = s, this.pointerWasMoved = !1)), this._updateLatestPointer(o, s, h), this._scopeFire("interactions:update-pointer", { pointer: o, event: s, eventTarget: h, down: g, pointerInfo: L, pointerIndex: H, interaction: this }), H;
        } }, { key: "removePointer", value: function(o, s) {
          var h = this.getPointerIndex(o);
          if (h !== -1) {
            var g = this.pointers[h];
            this._scopeFire("interactions:remove-pointer", { pointer: o, event: s, eventTarget: null, pointerIndex: h, pointerInfo: g, interaction: this }), this.pointers.splice(h, 1), this.pointerIsDown = !1;
          }
        } }, { key: "_updateLatestPointer", value: function(o, s, h) {
          this._latestPointer.pointer = o, this._latestPointer.event = s, this._latestPointer.eventTarget = h;
        } }, { key: "destroy", value: function() {
          this._latestPointer.pointer = null, this._latestPointer.event = null, this._latestPointer.eventTarget = null;
        } }, { key: "_createPreparedEvent", value: function(o, s, h, g) {
          return new tl(this, o, this.prepared.name, s, this.element, h, g);
        } }, { key: "_fireEvent", value: function(o) {
          var s;
          (s = this.interactable) == null || s.fire(o), (!this.prevEvent || o.timeStamp >= this.prevEvent.timeStamp) && (this.prevEvent = o);
        } }, { key: "_doPhase", value: function(o) {
          var s = o.event, h = o.phase, g = o.preEnd, x = o.type, S = this.rect;
          if (S && h === "move" && (It(this.edges, S, this.coords.delta[this.interactable.options.deltaSource]), S.width = S.right - S.left, S.height = S.bottom - S.top), this._scopeFire("interactions:before-action-".concat(h), o) === !1) return !1;
          var _ = o.iEvent = this._createPreparedEvent(s, h, g, x);
          return this._scopeFire("interactions:action-".concat(h), o), h === "start" && (this.prevEvent = _), this._fireEvent(_), this._scopeFire("interactions:after-action-".concat(h), o), !0;
        } }, { key: "_now", value: function() {
          return Date.now();
        } }]), l;
      })();
      function El(l) {
        Ai(l.interaction);
      }
      function Ai(l) {
        if (!(function(s) {
          return !(!s.offset.pending.x && !s.offset.pending.y);
        })(l)) return !1;
        var o = l.offset.pending;
        return oi(l.coords.cur, o), oi(l.coords.delta, o), It(l.edges, l.rect, o), o.x = 0, o.y = 0, !0;
      }
      function Ba(l) {
        var o = l.x, s = l.y;
        this.offset.pending.x += o, this.offset.pending.y += s, this.offset.total.x += o, this.offset.total.y += s;
      }
      function oi(l, o) {
        var s = l.page, h = l.client, g = o.x, x = o.y;
        s.x += g, s.y += x, h.x += g, h.y += x;
      }
      Ko.offsetBy = "";
      var Ha = { id: "offset", before: ["modifiers", "pointer-events", "actions", "inertia"], install: function(l) {
        l.Interaction.prototype.offsetBy = Ba;
      }, listeners: { "interactions:new": function(l) {
        l.interaction.offset = { total: { x: 0, y: 0 }, pending: { x: 0, y: 0 } };
      }, "interactions:update-pointer": function(l) {
        return (function(o) {
          o.pointerIsDown && (oi(o.coords.cur, o.offset.total), o.offset.pending.x = 0, o.offset.pending.y = 0);
        })(l.interaction);
      }, "interactions:before-action-start": El, "interactions:before-action-move": El, "interactions:before-action-end": function(l) {
        var o = l.interaction;
        if (Ai(o)) return o.move({ offset: !0 }), o.end(), !1;
      }, "interactions:stop": function(l) {
        var o = l.interaction;
        o.offset.total.x = 0, o.offset.total.y = 0, o.offset.pending.x = 0, o.offset.pending.y = 0;
      } } }, go = Ha, po = (function() {
        function l(o) {
          r(this, l), 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 = o;
        }
        return u(l, [{ key: "start", value: function(o) {
          var s = this.interaction, h = Oi(s);
          if (!h || !h.enabled) return !1;
          var g = s.coords.velocity.client, x = At(g.x, g.y), S = this.modification || (this.modification = new Ml(s));
          if (S.copyFrom(s.modification), this.t0 = s._now(), this.allowResume = h.allowResume, this.v0 = x, this.currentOffset = { x: 0, y: 0 }, this.startCoords = s.coords.cur.page, this.modifierArg = S.fillArg({ pageCoords: this.startCoords, preEnd: !0, phase: "inertiastart" }), this.t0 - s.coords.cur.timeStamp < 50 && x > h.minSpeed && x > h.endSpeed) this.startInertia();
          else {
            if (S.result = S.setAll(this.modifierArg), !S.result.changed) return !1;
            this.startSmoothEnd();
          }
          return s.modification.result.rect = null, s.offsetBy(this.targetOffset), s._doPhase({ interaction: s, event: o, phase: "inertiastart" }), s.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y }), s.modification.result.rect = null, this.active = !0, s.simulation = this, !0;
        } }, { key: "startInertia", value: function() {
          var o = this, s = this.interaction.coords.velocity.client, h = Oi(this.interaction), g = h.resistance, x = -Math.log(h.endSpeed / this.v0) / g;
          this.targetOffset = { x: (s.x - x) / g, y: (s.y - x) / g }, this.te = x, this.lambda_v0 = g / this.v0, this.one_ve_v0 = 1 - h.endSpeed / this.v0;
          var S = this.modification, _ = this.modifierArg;
          _.pageCoords = { x: this.startCoords.x + this.targetOffset.x, y: this.startCoords.y + this.targetOffset.y }, S.result = S.setAll(_), S.result.changed && (this.isModified = !0, this.modifiedOffset = { x: this.targetOffset.x + S.result.delta.x, y: this.targetOffset.y + S.result.delta.y }), this.onNextFrame((function() {
            return o.inertiaTick();
          }));
        } }, { key: "startSmoothEnd", value: function() {
          var o = 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 o.smoothEndTick();
          }));
        } }, { key: "onNextFrame", value: function(o) {
          var s = this;
          this.timeout = cn.request((function() {
            s.active && o();
          }));
        } }, { key: "inertiaTick", value: function() {
          var o, s, h, g, x, S, _, D = this, H = this.interaction, L = Oi(H).resistance, X = (H._now() - this.t0) / 1e3;
          if (X < this.te) {
            var ne, de = 1 - (Math.exp(-L * X) - this.lambda_v0) / this.one_ve_v0;
            this.isModified ? (o = 0, s = 0, h = this.targetOffset.x, g = this.targetOffset.y, x = this.modifiedOffset.x, S = this.modifiedOffset.y, ne = { x: mi(_ = de, o, h, x), y: mi(_, s, g, S) }) : ne = { x: this.targetOffset.x * de, y: this.targetOffset.y * de };
            var he = { x: ne.x - this.currentOffset.x, y: ne.y - this.currentOffset.y };
            this.currentOffset.x += he.x, this.currentOffset.y += he.y, H.offsetBy(he), H.move(), this.onNextFrame((function() {
              return D.inertiaTick();
            }));
          } else H.offsetBy({ x: this.modifiedOffset.x - this.currentOffset.x, y: this.modifiedOffset.y - this.currentOffset.y }), this.end();
        } }, { key: "smoothEndTick", value: function() {
          var o = this, s = this.interaction, h = s._now() - this.t0, g = Oi(s).smoothEndDuration;
          if (h < g) {
            var x = { x: vi(h, 0, this.targetOffset.x, g), y: vi(h, 0, this.targetOffset.y, g) }, S = { x: x.x - this.currentOffset.x, y: x.y - this.currentOffset.y };
            this.currentOffset.x += S.x, this.currentOffset.y += S.y, s.offsetBy(S), s.move({ skipModifiers: this.modifierCount }), this.onNextFrame((function() {
              return o.smoothEndTick();
            }));
          } else s.offsetBy({ x: this.targetOffset.x - this.currentOffset.x, y: this.targetOffset.y - this.currentOffset.y }), this.end();
        } }, { key: "resume", value: function(o) {
          var s = o.pointer, h = o.event, g = o.eventTarget, x = this.interaction;
          x.offsetBy({ x: -this.currentOffset.x, y: -this.currentOffset.y }), x.updatePointer(s, h, g, !0), x._doPhase({ interaction: x, event: h, phase: "resume" }), ln(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, cn.cancel(this.timeout);
        } }]), l;
      })();
      function Oi(l) {
        var o = l.interactable, s = l.prepared;
        return o && o.options && s.name && o.options[s.name].inertia;
      }
      var mo = { id: "inertia", before: ["modifiers", "actions"], install: function(l) {
        var o = l.defaults;
        l.usePlugin(go), l.usePlugin(el), l.actions.phases.inertiastart = !0, l.actions.phases.resume = !0, o.perAction.inertia = { enabled: !1, resistance: 10, minSpeed: 100, endSpeed: 10, allowResume: !0, smoothEndDuration: 300 };
      }, listeners: { "interactions:new": function(l) {
        var o = l.interaction;
        o.inertia = new po(o);
      }, "interactions:before-action-end": function(l) {
        var o = l.interaction, s = l.event;
        return (!o._interacting || o.simulation || !o.inertia.start(s)) && null;
      }, "interactions:down": function(l) {
        var o = l.interaction, s = l.eventTarget, h = o.inertia;
        if (h.active) for (var g = s; M.element(g); ) {
          if (g === o.element) {
            h.resume(l);
            break;
          }
          g = me(g);
        }
      }, "interactions:stop": function(l) {
        var o = l.interaction.inertia;
        o.active && o.stop();
      }, "interactions:before-action-resume": function(l) {
        var o = l.interaction.modification;
        o.stop(l), o.start(l, l.interaction.coords.cur.page), o.applyToInteraction(l);
      }, "interactions:before-action-inertiastart": function(l) {
        return l.interaction.modification.setAndApply(l);
      }, "interactions:action-resume": pi, "interactions:action-inertiastart": pi, "interactions:after-action-inertiastart": function(l) {
        return l.interaction.modification.restoreInteractionCoords(l);
      }, "interactions:after-action-resume": function(l) {
        return l.interaction.modification.restoreInteractionCoords(l);
      } } };
      function mi(l, o, s, h) {
        var g = 1 - l;
        return g * g * o + 2 * g * l * s + l * l * h;
      }
      function vi(l, o, s, h) {
        return -s * (l /= h) * (l - 2) + o;
      }
      var Xo = mo;
      function vo(l, o) {
        for (var s = 0; s < o.length; s++) {
          var h = o[s];
          if (l.immediatePropagationStopped) break;
          h(l);
        }
      }
      var yi = (function() {
        function l(o) {
          r(this, l), this.options = void 0, this.types = {}, this.propagationStopped = !1, this.immediatePropagationStopped = !1, this.global = void 0, this.options = be({}, o || {});
        }
        return u(l, [{ key: "fire", value: function(o) {
          var s, h = this.global;
          (s = this.types[o.type]) && vo(o, s), !o.propagationStopped && h && (s = h[o.type]) && vo(o, s);
        } }, { key: "on", value: function(o, s) {
          var h = Tt(o, s);
          for (o in h) this.types[o] = fn(this.types[o] || [], h[o]);
        } }, { key: "off", value: function(o, s) {
          var h = Tt(o, s);
          for (o in h) {
            var g = this.types[o];
            if (g && g.length) for (var x = 0, S = h[o]; x < S.length; x++) {
              var _ = S[x], D = g.indexOf(_);
              D !== -1 && g.splice(D, 1);
            }
          }
        } }, { key: "getRect", value: function(o) {
          return null;
        } }]), l;
      })(), Di = (function() {
        function l(o) {
          r(this, l), this.currentTarget = void 0, this.originalEvent = void 0, this.type = void 0, this.originalEvent = o, Wt(this, o);
        }
        return u(l, [{ key: "preventOriginalDefault", value: function() {
          this.originalEvent.preventDefault();
        } }, { key: "stopPropagation", value: function() {
          this.originalEvent.stopPropagation();
        } }, { key: "stopImmediatePropagation", value: function() {
          this.originalEvent.stopImmediatePropagation();
        } }]), l;
      })();
      function qi(l) {
        return M.object(l) ? { capture: !!l.capture, passive: !!l.passive } : { capture: !!l, passive: !1 };
      }
      function nl(l, o) {
        return l === o || (typeof l == "boolean" ? !!o.capture === l && !o.passive : !!l.capture == !!o.capture && !!l.passive == !!o.passive);
      }
      var kt = { id: "events", install: function(l) {
        var o, s = [], h = {}, g = [], x = { add: S, remove: _, addDelegate: function(L, X, ne, de, he) {
          var pe = qi(he);
          if (!h[ne]) {
            h[ne] = [];
            for (var we = 0; we < g.length; we++) {
              var Se = g[we];
              S(Se, ne, D), S(Se, ne, H, !0);
            }
          }
          var $e = h[ne], Ve = Mt($e, (function(Ke) {
            return Ke.selector === L && Ke.context === X;
          }));
          Ve || (Ve = { selector: L, context: X, listeners: [] }, $e.push(Ve)), Ve.listeners.push({ func: de, options: pe });
        }, removeDelegate: function(L, X, ne, de, he) {
          var pe, we = qi(he), Se = h[ne], $e = !1;
          if (Se)
            for (pe = Se.length - 1; pe >= 0; pe--) {
              var Ve = Se[pe];
              if (Ve.selector === L && Ve.context === X) {
                for (var Ke = Ve.listeners, Re = Ke.length - 1; Re >= 0; Re--) {
                  var We = Ke[Re];
                  if (We.func === de && nl(We.options, we)) {
                    Ke.splice(Re, 1), Ke.length || (Se.splice(pe, 1), _(X, ne, D), _(X, ne, H, !0)), $e = !0;
                    break;
                  }
                }
                if ($e) break;
              }
            }
        }, delegateListener: D, delegateUseCapture: H, delegatedEvents: h, documents: g, targets: s, supportsOptions: !1, supportsPassive: !1 };
        function S(L, X, ne, de) {
          if (L.addEventListener) {
            var he = qi(de), pe = Mt(s, (function(we) {
              return we.eventTarget === L;
            }));
            pe || (pe = { eventTarget: L, events: {} }, s.push(pe)), pe.events[X] || (pe.events[X] = []), Mt(pe.events[X], (function(we) {
              return we.func === ne && nl(we.options, he);
            })) || (L.addEventListener(X, ne, x.supportsOptions ? he : he.capture), pe.events[X].push({ func: ne, options: he }));
          }
        }
        function _(L, X, ne, de) {
          if (L.addEventListener && L.removeEventListener) {
            var he = Ut(s, (function(ht) {
              return ht.eventTarget === L;
            })), pe = s[he];
            if (pe && pe.events) if (X !== "all") {
              var we = !1, Se = pe.events[X];
              if (Se) {
                if (ne === "all") {
                  for (var $e = Se.length - 1; $e >= 0; $e--) {
                    var Ve = Se[$e];
                    _(L, X, Ve.func, Ve.options);
                  }
                  return;
                }
                for (var Ke = qi(de), Re = 0; Re < Se.length; Re++) {
                  var We = Se[Re];
                  if (We.func === ne && nl(We.options, Ke)) {
                    L.removeEventListener(X, ne, x.supportsOptions ? Ke : Ke.capture), Se.splice(Re, 1), Se.length === 0 && (delete pe.events[X], we = !0);
                    break;
                  }
                }
              }
              we && !Object.keys(pe.events).length && s.splice(he, 1);
            } else for (X in pe.events) pe.events.hasOwnProperty(X) && _(L, X, "all");
          }
        }
        function D(L, X) {
          for (var ne = qi(X), de = new Di(L), he = h[L.type], pe = Lt(L)[0], we = pe; M.element(we); ) {
            for (var Se = 0; Se < he.length; Se++) {
              var $e = he[Se], Ve = $e.selector, Ke = $e.context;
              if (ge(we, Ve) && ie(Ke, pe) && ie(Ke, we)) {
                var Re = $e.listeners;
                de.currentTarget = we;
                for (var We = 0; We < Re.length; We++) {
                  var ht = Re[We];
                  nl(ht.options, ne) && ht.func(de);
                }
              }
            }
            we = me(we);
          }
        }
        function H(L) {
          return D(L, !0);
        }
        return (o = l.document) == null || o.createElement("div").addEventListener("test", null, { get capture() {
          return x.supportsOptions = !0;
        }, get passive() {
          return x.supportsPassive = !0;
        } }), l.events = x, x;
      } }, xt = { methodOrder: ["simulationResume", "mouseOrPen", "hasPointer", "idle"], search: function(l) {
        for (var o = 0, s = xt.methodOrder; o < s.length; o++) {
          var h = s[o], g = xt[h](l);
          if (g) return g;
        }
        return null;
      }, simulationResume: function(l) {
        var o = l.pointerType, s = l.eventType, h = l.eventTarget, g = l.scope;
        if (!/down|start/i.test(s)) return null;
        for (var x = 0, S = g.interactions.list; x < S.length; x++) {
          var _ = S[x], D = h;
          if (_.simulation && _.simulation.allowResume && _.pointerType === o) for (; D; ) {
            if (D === _.element) return _;
            D = me(D);
          }
        }
        return null;
      }, mouseOrPen: function(l) {
        var o, s = l.pointerId, h = l.pointerType, g = l.eventType, x = l.scope;
        if (h !== "mouse" && h !== "pen") return null;
        for (var S = 0, _ = x.interactions.list; S < _.length; S++) {
          var D = _[S];
          if (D.pointerType === h) {
            if (D.simulation && !Gn(D, s)) continue;
            if (D.interacting()) return D;
            o || (o = D);
          }
        }
        if (o) return o;
        for (var H = 0, L = x.interactions.list; H < L.length; H++) {
          var X = L[H];
          if (!(X.pointerType !== h || /down/i.test(g) && X.simulation)) return X;
        }
        return null;
      }, hasPointer: function(l) {
        for (var o = l.pointerId, s = 0, h = l.scope.interactions.list; s < h.length; s++) {
          var g = h[s];
          if (Gn(g, o)) return g;
        }
        return null;
      }, idle: function(l) {
        for (var o = l.pointerType, s = 0, h = l.scope.interactions.list; s < h.length; s++) {
          var g = h[s];
          if (g.pointers.length === 1) {
            var x = g.interactable;
            if (x && (!x.options.gesture || !x.options.gesture.enabled)) continue;
          } else if (g.pointers.length >= 2) continue;
          if (!g.interacting() && o === g.pointerType) return g;
        }
        return null;
      } };
      function Gn(l, o) {
        return l.pointers.some((function(s) {
          return s.id === o;
        }));
      }
      var Jt = xt, Ht = ["pointerDown", "pointerMove", "pointerUp", "updatePointer", "removePointer", "windowBlur"];
      function jt(l, o) {
        return function(s) {
          var h = o.interactions.list, g = St(s), x = Lt(s), S = x[0], _ = x[1], D = [];
          if (/^touch/.test(s.type)) {
            o.prevTouchTime = o.now();
            for (var H = 0, L = s.changedTouches; H < L.length; H++) {
              var X = L[H], ne = { pointer: X, pointerId: je(X), pointerType: g, eventType: s.type, eventTarget: S, curEventTarget: _, scope: o }, de = wt(ne);
              D.push([ne.pointer, ne.eventTarget, ne.curEventTarget, de]);
            }
          } else {
            var he = !1;
            if (!ue.supportsPointerEvent && /mouse/.test(s.type)) {
              for (var pe = 0; pe < h.length && !he; pe++) he = h[pe].pointerType !== "mouse" && h[pe].pointerIsDown;
              he = he || o.now() - o.prevTouchTime < 500 || s.timeStamp === 0;
            }
            if (!he) {
              var we = { pointer: s, pointerId: je(s), pointerType: g, eventType: s.type, curEventTarget: _, eventTarget: S, scope: o }, Se = wt(we);
              D.push([we.pointer, we.eventTarget, we.curEventTarget, Se]);
            }
          }
          for (var $e = 0; $e < D.length; $e++) {
            var Ve = D[$e], Ke = Ve[0], Re = Ve[1], We = Ve[2];
            Ve[3][l](Ke, s, Re, We);
          }
        };
      }
      function wt(l) {
        var o = l.pointerType, s = l.scope, h = { interaction: Jt.search(l), searchDetails: l };
        return s.fire("interactions:find", h), h.interaction || s.interactions.new({ pointerType: o });
      }
      function ai(l, o) {
        var s = l.doc, h = l.scope, g = l.options, x = h.interactions.docEvents, S = h.events, _ = S[o];
        for (var D in h.browser.isIOS && !g.events && (g.events = { passive: !1 }), S.delegatedEvents) _(s, D, S.delegateListener), _(s, D, S.delegateUseCapture, !0);
        for (var H = g && g.events, L = 0; L < x.length; L++) {
          var X = x[L];
          _(s, X.type, X.listener, H);
        }
      }
      var Il = { id: "core/interactions", install: function(l) {
        for (var o = {}, s = 0; s < Ht.length; s++) {
          var h = Ht[s];
          o[h] = jt(h, l);
        }
        var g, x = ue.pEventTypes;
        function S() {
          for (var _ = 0, D = l.interactions.list; _ < D.length; _++) {
            var H = D[_];
            if (H.pointerIsDown && H.pointerType === "touch" && !H._interacting) for (var L = function() {
              var de = ne[X];
              l.documents.some((function(he) {
                return ie(he.doc, de.downTarget);
              })) || H.removePointer(de.pointer, de.event);
            }, X = 0, ne = H.pointers; X < ne.length; X++) L();
          }
        }
        (g = $.PointerEvent ? [{ type: x.down, listener: S }, { type: x.down, listener: o.pointerDown }, { type: x.move, listener: o.pointerMove }, { type: x.up, listener: o.pointerUp }, { type: x.cancel, listener: o.pointerUp }] : [{ type: "mousedown", listener: o.pointerDown }, { type: "mousemove", listener: o.pointerMove }, { type: "mouseup", listener: o.pointerUp }, { type: "touchstart", listener: S }, { type: "touchstart", listener: o.pointerDown }, { type: "touchmove", listener: o.pointerMove }, { type: "touchend", listener: o.pointerUp }, { type: "touchcancel", listener: o.pointerUp }]).push({ type: "blur", listener: function(_) {
          for (var D = 0, H = l.interactions.list; D < H.length; D++)
            H[D].documentBlur(_);
        } }), l.prevTouchTime = 0, l.Interaction = (function(_) {
          p(H, _);
          var D = C(H);
          function H() {
            return r(this, H), D.apply(this, arguments);
          }
          return u(H, [{ key: "pointerMoveTolerance", get: function() {
            return l.interactions.pointerMoveTolerance;
          }, set: function(L) {
            l.interactions.pointerMoveTolerance = L;
          } }, { key: "_now", value: function() {
            return l.now();
          } }]), H;
        })($l), l.interactions = { list: [], new: function(_) {
          _.scopeFire = function(H, L) {
            return l.fire(H, L);
          };
          var D = new l.Interaction(_);
          return l.interactions.list.push(D), D;
        }, listeners: o, docEvents: g, pointerMoveTolerance: 1 }, l.usePlugin(Yo);
      }, listeners: { "scope:add-document": function(l) {
        return ai(l, "add");
      }, "scope:remove-document": function(l) {
        return ai(l, "remove");
      }, "interactable:unset": function(l, o) {
        for (var s = l.interactable, h = o.interactions.list.length - 1; h >= 0; h--) {
          var g = o.interactions.list[h];
          g.interactable === s && (g.stop(), o.fire("interactions:destroy", { interaction: g }), g.destroy(), o.interactions.list.length > 2 && o.interactions.list.splice(h, 1));
        }
      } }, onDocSignal: ai, doOnInteractions: jt, methodNames: Ht }, Wa = Il, an = (function(l) {
        return l[l.On = 0] = "On", l[l.Off = 1] = "Off", l;
      })(an || {}), Dn = (function() {
        function l(o, s, h, g) {
          r(this, l), this.target = void 0, this.options = void 0, this._actions = void 0, this.events = new yi(), this._context = void 0, this._win = void 0, this._doc = void 0, this._scopeEvents = void 0, this._actions = s.actions, this.target = o, this._context = s.context || h, this._win = O(Te(o) ? this._context : o), this._doc = this._win.document, this._scopeEvents = g, this.set(s);
        }
        return u(l, [{ key: "_defaults", get: function() {
          return { base: {}, perAction: {}, actions: {} };
        } }, { key: "setOnEvents", value: function(o, s) {
          return M.func(s.onstart) && this.on("".concat(o, "start"), s.onstart), M.func(s.onmove) && this.on("".concat(o, "move"), s.onmove), M.func(s.onend) && this.on("".concat(o, "end"), s.onend), M.func(s.oninertiastart) && this.on("".concat(o, "inertiastart"), s.oninertiastart), this;
        } }, { key: "updatePerActionListeners", value: function(o, s, h) {
          var g, x = this, S = (g = this._actions.map[o]) == null ? void 0 : g.filterEventType, _ = function(D) {
            return (S == null || S(D)) && zl(D, x._actions);
          };
          (M.array(s) || M.object(s)) && this._onOff(an.Off, o, s, void 0, _), (M.array(h) || M.object(h)) && this._onOff(an.On, o, h, void 0, _);
        } }, { key: "setPerAction", value: function(o, s) {
          var h = this._defaults;
          for (var g in s) {
            var x = g, S = this.options[o], _ = s[x];
            x === "listeners" && this.updatePerActionListeners(o, S.listeners, _), M.array(_) ? S[x] = sn(_) : M.plainObject(_) ? (S[x] = be(S[x] || {}, gi(_)), M.object(h.perAction[x]) && "enabled" in h.perAction[x] && (S[x].enabled = _.enabled !== !1)) : M.bool(_) && M.object(h.perAction[x]) ? S[x].enabled = _ : S[x] = _;
          }
        } }, { key: "getRect", value: function(o) {
          return o = o || (M.element(this.target) ? this.target : null), M.string(this.target) && (o = o || this._context.querySelector(this.target)), se(o);
        } }, { key: "rectChecker", value: function(o) {
          var s = this;
          return M.func(o) ? (this.getRect = function(h) {
            var g = be({}, o.apply(s, h));
            return "width" in g || (g.width = g.right - g.left, g.height = g.bottom - g.top), g;
          }, this) : o === null ? (delete this.getRect, this) : this.getRect;
        } }, { key: "_backCompatOption", value: function(o, s) {
          if (Te(s) || M.object(s)) {
            for (var h in this.options[o] = s, this._actions.map) this.options[h][o] = s;
            return this;
          }
          return this.options[o];
        } }, { key: "origin", value: function(o) {
          return this._backCompatOption("origin", o);
        } }, { key: "deltaSource", value: function(o) {
          return o === "page" || o === "client" ? (this.options.deltaSource = o, this) : this.options.deltaSource;
        } }, { key: "getAllElements", value: function() {
          var o = this.target;
          return M.string(o) ? Array.from(this._context.querySelectorAll(o)) : M.func(o) && o.getAllElements ? o.getAllElements() : M.element(o) ? [o] : [];
        } }, { key: "context", value: function() {
          return this._context;
        } }, { key: "inContext", value: function(o) {
          return this._context === o.ownerDocument || ie(this._context, o);
        } }, { key: "testIgnoreAllow", value: function(o, s, h) {
          return !this.testIgnore(o.ignoreFrom, s, h) && this.testAllow(o.allowFrom, s, h);
        } }, { key: "testAllow", value: function(o, s, h) {
          return !o || !!M.element(h) && (M.string(o) ? Oe(h, o, s) : !!M.element(o) && ie(o, h));
        } }, { key: "testIgnore", value: function(o, s, h) {
          return !(!o || !M.element(h)) && (M.string(o) ? Oe(h, o, s) : !!M.element(o) && ie(o, h));
        } }, { key: "fire", value: function(o) {
          return this.events.fire(o), this;
        } }, { key: "_onOff", value: function(o, s, h, g, x) {
          M.object(s) && !M.array(s) && (g = h, h = null);
          var S = Tt(s, h, x);
          for (var _ in S) {
            _ === "wheel" && (_ = ue.wheelEvent);
            for (var D = 0, H = S[_]; D < H.length; D++) {
              var L = H[D];
              zl(_, this._actions) ? this.events[o === an.On ? "on" : "off"](_, L) : M.string(this.target) ? this._scopeEvents[o === an.On ? "addDelegate" : "removeDelegate"](this.target, this._context, _, L, g) : this._scopeEvents[o === an.On ? "add" : "remove"](this.target, _, L, g);
            }
          }
          return this;
        } }, { key: "on", value: function(o, s, h) {
          return this._onOff(an.On, o, s, h);
        } }, { key: "off", value: function(o, s, h) {
          return this._onOff(an.Off, o, s, h);
        } }, { key: "set", value: function(o) {
          var s = this._defaults;
          for (var h in M.object(o) || (o = {}), this.options = gi(s.base), this._actions.methodDict) {
            var g = h, x = this._actions.methodDict[g];
            this.options[g] = {}, this.setPerAction(g, be(be({}, s.perAction), s.actions[g])), this[x](o[g]);
          }
          for (var S in o) S !== "getRect" ? M.func(this[S]) && this[S](o[S]) : this.rectChecker(o.getRect);
          return this;
        } }, { key: "unset", value: function() {
          if (M.string(this.target)) for (var o in this._scopeEvents.delegatedEvents) for (var s = this._scopeEvents.delegatedEvents[o], h = s.length - 1; h >= 0; h--) {
            var g = s[h], x = g.selector, S = g.context, _ = g.listeners;
            x === this.target && S === this._context && s.splice(h, 1);
            for (var D = _.length - 1; D >= 0; D--) this._scopeEvents.removeDelegate(this.target, this._context, o, _[D][0], _[D][1]);
          }
          else this._scopeEvents.remove(this.target, "all");
        } }]), l;
      })(), ja = (function() {
        function l(o) {
          var s = this;
          r(this, l), this.list = [], this.selectorMap = {}, this.scope = void 0, this.scope = o, o.addListeners({ "interactable:unset": function(h) {
            var g = h.interactable, x = g.target, S = M.string(x) ? s.selectorMap[x] : x[s.scope.id], _ = Ut(S, (function(D) {
              return D === g;
            }));
            S.splice(_, 1);
          } });
        }
        return u(l, [{ key: "new", value: function(o, s) {
          s = be(s || {}, { actions: this.scope.actions });
          var h = new this.scope.Interactable(o, s, this.scope.document, this.scope.events);
          return this.scope.addDocument(h._doc), this.list.push(h), M.string(o) ? (this.selectorMap[o] || (this.selectorMap[o] = []), this.selectorMap[o].push(h)) : (h.target[this.scope.id] || Object.defineProperty(o, this.scope.id, { value: [], configurable: !0 }), o[this.scope.id].push(h)), this.scope.fire("interactable:new", { target: o, options: s, interactable: h, win: this.scope._win }), h;
        } }, { key: "getExisting", value: function(o, s) {
          var h = s && s.context || this.scope.document, g = M.string(o), x = g ? this.selectorMap[o] : o[this.scope.id];
          if (x) return Mt(x, (function(S) {
            return S._context === h && (g || S.inContext(o));
          }));
        } }, { key: "forEachMatch", value: function(o, s) {
          for (var h = 0, g = this.list; h < g.length; h++) {
            var x = g[h], S = void 0;
            if ((M.string(x.target) ? M.element(o) && ge(o, x.target) : o === x.target) && x.inContext(o) && (S = s(x)), S !== void 0) return S;
          }
        } }]), l;
      })(), Ga = (function() {
        function l() {
          var o = this;
          r(this, l), this.id = "__interact_scope_".concat(Math.floor(100 * Math.random())), this.isInitialized = !1, this.listenerMaps = [], this.browser = ue, this.defaults = gi(Uo), this.Eventable = yi, this.actions = { map: {}, phases: { start: !0, move: !0, end: !0 }, methodDict: {}, phaselessTypes: {} }, this.interactStatic = (function(h) {
            var g = function x(S, _) {
              var D = h.interactables.getExisting(S, _);
              return D || ((D = h.interactables.new(S, _)).events.global = x.globalEvents), D;
            };
            return g.getPointerAverage = Le, g.getTouchBBox = et, g.getTouchDistance = nt, g.getTouchAngle = it, g.getElementRect = se, g.getElementClientRect = ke, g.matchesSelector = ge, g.closest = Ee, g.globalEvents = {}, g.version = "1.10.27", g.scope = h, g.use = function(x, S) {
              return this.scope.usePlugin(x, S), this;
            }, g.isSet = function(x, S) {
              return !!this.scope.interactables.get(x, S && S.context);
            }, g.on = Ot((function(x, S, _) {
              if (M.string(x) && x.search(" ") !== -1 && (x = x.trim().split(/ +/)), M.array(x)) {
                for (var D = 0, H = x; D < H.length; D++) {
                  var L = H[D];
                  this.on(L, S, _);
                }
                return this;
              }
              if (M.object(x)) {
                for (var X in x) this.on(X, x[X], S);
                return this;
              }
              return zl(x, this.scope.actions) ? this.globalEvents[x] ? this.globalEvents[x].push(S) : this.globalEvents[x] = [S] : this.scope.events.add(this.scope.document, x, S, { options: _ }), this;
            }), "The interact.on() method is being deprecated"), g.off = Ot((function(x, S, _) {
              if (M.string(x) && x.search(" ") !== -1 && (x = x.trim().split(/ +/)), M.array(x)) {
                for (var D = 0, H = x; D < H.length; D++) {
                  var L = H[D];
                  this.off(L, S, _);
                }
                return this;
              }
              if (M.object(x)) {
                for (var X in x) this.off(X, x[X], S);
                return this;
              }
              var ne;
              return zl(x, this.scope.actions) ? x in this.globalEvents && (ne = this.globalEvents[x].indexOf(S)) !== -1 && this.globalEvents[x].splice(ne, 1) : this.scope.events.remove(this.scope.document, x, S, _), this;
            }), "The interact.off() method is being deprecated"), g.debug = function() {
              return this.scope;
            }, g.supportsTouch = function() {
              return ue.supportsTouch;
            }, g.supportsPointerEvent = function() {
              return ue.supportsPointerEvent;
            }, g.stop = function() {
              for (var x = 0, S = this.scope.interactions.list; x < S.length; x++) S[x].stop();
              return this;
            }, g.pointerMoveTolerance = function(x) {
              return M.number(x) ? (this.scope.interactions.pointerMoveTolerance = x, this) : this.scope.interactions.pointerMoveTolerance;
            }, g.addDocument = function(x, S) {
              this.scope.addDocument(x, S);
            }, g.removeDocument = function(x) {
              this.scope.removeDocument(x);
            }, g;
          })(this), this.InteractEvent = tl, this.Interactable = void 0, this.interactables = new ja(this), this._win = void 0, this.document = void 0, this.window = void 0, this.documents = [], this._plugins = { list: [], map: {} }, this.onWindowUnload = function(h) {
            return o.removeDocument(h.target);
          };
          var s = this;
          this.Interactable = (function(h) {
            p(x, h);
            var g = C(x);
            function x() {
              return r(this, x), g.apply(this, arguments);
            }
            return u(x, [{ key: "_defaults", get: function() {
              return s.defaults;
            } }, { key: "set", value: function(S) {
              return z(y(x.prototype), "set", this).call(this, S), s.fire("interactable:set", { options: S, interactable: this }), this;
            } }, { key: "unset", value: function() {
              z(y(x.prototype), "unset", this).call(this);
              var S = s.interactables.list.indexOf(this);
              S < 0 || (s.interactables.list.splice(S, 1), s.fire("interactable:unset", { interactable: this }));
            } }]), x;
          })(Dn);
        }
        return u(l, [{ key: "addListeners", value: function(o, s) {
          this.listenerMaps.push({ id: s, map: o });
        } }, { key: "fire", value: function(o, s) {
          for (var h = 0, g = this.listenerMaps; h < g.length; h++) {
            var x = g[h].map[o];
            if (x && x(s, this, o) === !1) return !1;
          }
        } }, { key: "init", value: function(o) {
          return this.isInitialized ? this : (function(s, h) {
            return s.isInitialized = !0, M.window(h) && U(h), $.init(h), ue.init(h), cn.init(h), s.window = h, s.document = h.document, s.usePlugin(Wa), s.usePlugin(kt), s;
          })(this, o);
        } }, { key: "pluginIsInstalled", value: function(o) {
          var s = o.id;
          return s ? !!this._plugins.map[s] : this._plugins.list.indexOf(o) !== -1;
        } }, { key: "usePlugin", value: function(o, s) {
          if (!this.isInitialized) return this;
          if (this.pluginIsInstalled(o)) return this;
          if (o.id && (this._plugins.map[o.id] = o), this._plugins.list.push(o), o.install && o.install(this, s), o.listeners && o.before) {
            for (var h = 0, g = this.listenerMaps.length, x = o.before.reduce((function(_, D) {
              return _[D] = !0, _[Qo(D)] = !0, _;
            }), {}); h < g; h++) {
              var S = this.listenerMaps[h].id;
              if (S && (x[S] || x[Qo(S)])) break;
            }
            this.listenerMaps.splice(h, 0, { id: o.id, map: o.listeners });
          } else o.listeners && this.listenerMaps.push({ id: o.id, map: o.listeners });
          return this;
        } }, { key: "addDocument", value: function(o, s) {
          if (this.getDocIndex(o) !== -1) return !1;
          var h = O(o);
          s = s ? be({}, s) : {}, this.documents.push({ doc: o, options: s }), this.events.documents.push(o), o !== this.document && this.events.add(h, "unload", this.onWindowUnload), this.fire("scope:add-document", { doc: o, window: h, scope: this, options: s });
        } }, { key: "removeDocument", value: function(o) {
          var s = this.getDocIndex(o), h = O(o), g = this.documents[s].options;
          this.events.remove(h, "unload", this.onWindowUnload), this.documents.splice(s, 1), this.events.documents.splice(s, 1), this.fire("scope:remove-document", { doc: o, window: h, scope: this, options: g });
        } }, { key: "getDocIndex", value: function(o) {
          for (var s = 0; s < this.documents.length; s++) if (this.documents[s].doc === o) return s;
          return -1;
        } }, { key: "getDocOptions", value: function(o) {
          var s = this.getDocIndex(o);
          return s === -1 ? null : this.documents[s].options;
        } }, { key: "now", value: function() {
          return (this.window.Date || Date).now();
        } }]), l;
      })();
      function Qo(l) {
        return l && l.replace(/\/.*$/, "");
      }
      var Jo = new Ga(), $t = Jo.interactStatic, si = typeof globalThis < "u" ? globalThis : window;
      Jo.init(si);
      var bi = Object.freeze({ __proto__: null, edgeTarget: function() {
      }, elements: function() {
      }, grid: function(l) {
        var o = [["x", "y"], ["left", "top"], ["right", "bottom"], ["width", "height"]].filter((function(h) {
          var g = h[0], x = h[1];
          return g in l || x in l;
        })), s = function(h, g) {
          for (var x = l.range, S = l.limits, _ = S === void 0 ? { left: -1 / 0, right: 1 / 0, top: -1 / 0, bottom: 1 / 0 } : S, D = l.offset, H = D === void 0 ? { x: 0, y: 0 } : D, L = { range: x, grid: l, x: null, y: null }, X = 0; X < o.length; X++) {
            var ne = o[X], de = ne[0], he = ne[1], pe = Math.round((h - H.x) / l[de]), we = Math.round((g - H.y) / l[he]);
            L[de] = Math.max(_.left, Math.min(_.right, pe * l[de] + H.x)), L[he] = Math.max(_.top, Math.min(_.bottom, we * l[he] + H.y));
          }
          return L;
        };
        return s.grid = l, s.coordFields = o, s;
      } }), Li = { id: "snappers", install: function(l) {
        var o = l.interactStatic;
        o.snappers = be(o.snappers || {}, bi), o.createSnapGrid = o.snappers.grid;
      } }, Ya = Li, qn = { start: function(l) {
        var o = l.state, s = l.rect, h = l.edges, g = l.pageCoords, x = o.options, S = x.ratio, _ = x.enabled, D = o.options, H = D.equalDelta, L = D.modifiers;
        S === "preserve" && (S = s.width / s.height), o.startCoords = be({}, g), o.startRect = be({}, s), o.ratio = S, o.equalDelta = H;
        var X = o.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 (o.xIsPrimaryAxis = !(!h.left && !h.right), o.equalDelta) {
          var ne = (X.left ? 1 : -1) * (X.top ? 1 : -1);
          o.edgeSign = { x: ne, y: ne };
        } else o.edgeSign = { x: X.left ? -1 : 1, y: X.top ? -1 : 1 };
        if (_ !== !1 && be(h, X), L != null && L.length) {
          var de = new Ml(l.interaction);
          de.copyFrom(l.interaction.modification), de.prepareStates(L), o.subModification = de, de.startAll(i({}, l));
        }
      }, set: function(l) {
        var o = l.state, s = l.rect, h = l.coords, g = o.linkedEdges, x = be({}, h), S = o.equalDelta ? Ua : Zo;
        if (be(l.edges, g), S(o, o.xIsPrimaryAxis, h, s), !o.subModification) return null;
        var _ = be({}, s);
        It(g, _, { x: h.x - x.x, y: h.y - x.y });
        var D = o.subModification.setAll(i(i({}, l), {}, { rect: _, edges: g, pageCoords: h, prevCoords: h, prevRect: _ })), H = D.delta;
        return D.changed && (S(o, Math.abs(H.x) > Math.abs(H.y), D.coords, D.rect), be(h, D.coords)), D.eventProps;
      }, defaults: { ratio: "preserve", equalDelta: !1, modifiers: [], enabled: !1 } };
      function Ua(l, o, s) {
        var h = l.startCoords, g = l.edgeSign;
        o ? s.y = h.y + (s.x - h.x) * g.y : s.x = h.x + (s.y - h.y) * g.x;
      }
      function Zo(l, o, s, h) {
        var g = l.startRect, x = l.startCoords, S = l.ratio, _ = l.edgeSign;
        if (o) {
          var D = h.width / S;
          s.y = x.y + (D - g.height) * _.y;
        } else {
          var H = h.height * S;
          s.x = x.x + (H - g.width) * _.x;
        }
      }
      var ea = jn(qn, "aspectRatio"), Ri = function() {
      };
      Ri._defaults = {};
      var ri = Ri;
      function xi(l, o, s) {
        return M.func(l) ? Je(l, o.interactable, o.element, [s.x, s.y, o]) : Je(l, o.interactable, o.element);
      }
      var Ni = { start: function(l) {
        var o = l.rect, s = l.startOffset, h = l.state, g = l.interaction, x = l.pageCoords, S = h.options, _ = S.elementRect, D = be({ left: 0, top: 0, right: 0, bottom: 0 }, S.offset || {});
        if (o && _) {
          var H = xi(S.restriction, g, x);
          if (H) {
            var L = H.right - H.left - o.width, X = H.bottom - H.top - o.height;
            L < 0 && (D.left += L, D.right += L), X < 0 && (D.top += X, D.bottom += X);
          }
          D.left += s.left - o.width * _.left, D.top += s.top - o.height * _.top, D.right += s.right - o.width * (1 - _.right), D.bottom += s.bottom - o.height * (1 - _.bottom);
        }
        h.offset = D;
      }, set: function(l) {
        var o = l.coords, s = l.interaction, h = l.state, g = h.options, x = h.offset, S = xi(g.restriction, s, o);
        if (S) {
          var _ = (function(D) {
            return !D || "left" in D && "top" in D || ((D = be({}, D)).left = D.x || 0, D.top = D.y || 0, D.right = D.right || D.left + D.width, D.bottom = D.bottom || D.top + D.height), D;
          })(S);
          o.x = Math.max(Math.min(_.right - x.right, o.x), _.left + x.left), o.y = Math.max(Math.min(_.bottom - x.bottom, o.y), _.top + x.top);
        }
      }, defaults: { restriction: null, elementRect: null, offset: null, endOnly: !1, enabled: !1 } }, Ka = jn(Ni, "restrict"), ui = { top: 1 / 0, left: 1 / 0, bottom: -1 / 0, right: -1 / 0 }, Yn = { top: -1 / 0, left: -1 / 0, bottom: 1 / 0, right: 1 / 0 };
      function Vi(l, o) {
        for (var s = 0, h = ["top", "left", "bottom", "right"]; s < h.length; s++) {
          var g = h[s];
          g in l || (l[g] = o[g]);
        }
        return l;
      }
      var Fi = { noInner: ui, noOuter: Yn, start: function(l) {
        var o, s = l.interaction, h = l.startOffset, g = l.state, x = g.options;
        x && (o = Ge(xi(x.offset, s, s.coords.start.page))), o = o || { x: 0, y: 0 }, g.offset = { top: o.y + h.top, left: o.x + h.left, bottom: o.y - h.bottom, right: o.x - h.right };
      }, set: function(l) {
        var o = l.coords, s = l.edges, h = l.interaction, g = l.state, x = g.offset, S = g.options;
        if (s) {
          var _ = be({}, o), D = xi(S.inner, h, _) || {}, H = xi(S.outer, h, _) || {};
          Vi(D, ui), Vi(H, Yn), s.top ? o.y = Math.min(Math.max(H.top + x.top, _.y), D.top + x.top) : s.bottom && (o.y = Math.max(Math.min(H.bottom + x.bottom, _.y), D.bottom + x.bottom)), s.left ? o.x = Math.min(Math.max(H.left + x.left, _.x), D.left + x.left) : s.right && (o.x = Math.max(Math.min(H.right + x.right, _.x), D.right + x.right));
        }
      }, defaults: { inner: null, outer: null, offset: null, endOnly: !1, enabled: !1 } }, yo = jn(Fi, "restrictEdges"), bo = be({ get elementRect() {
        return { top: 0, left: 0, bottom: 1, right: 1 };
      }, set elementRect(l) {
      } }, Ni.defaults), Al = jn({ start: Ni.start, set: Ni.set, defaults: bo }, "restrictRect"), ta = { width: -1 / 0, height: -1 / 0 }, na = { width: 1 / 0, height: 1 / 0 }, ia = jn({ start: function(l) {
        return Fi.start(l);
      }, set: function(l) {
        var o = l.interaction, s = l.state, h = l.rect, g = l.edges, x = s.options;
        if (g) {
          var S = mt(xi(x.min, o, l.coords)) || ta, _ = mt(xi(x.max, o, l.coords)) || na;
          s.options = { endOnly: x.endOnly, inner: be({}, Fi.noInner), outer: be({}, Fi.noOuter) }, g.top ? (s.options.inner.top = h.bottom - S.height, s.options.outer.top = h.bottom - _.height) : g.bottom && (s.options.inner.bottom = h.top + S.height, s.options.outer.bottom = h.top + _.height), g.left ? (s.options.inner.left = h.right - S.width, s.options.outer.left = h.right - _.width) : g.right && (s.options.inner.right = h.left + S.width, s.options.outer.right = h.left + _.width), Fi.set(l), s.options = x;
        }
      }, defaults: { min: null, max: null, endOnly: !1, enabled: !1 } }, "restrictSize"), Ol = { start: function(l) {
        var o, s = l.interaction, h = l.interactable, g = l.element, x = l.rect, S = l.state, _ = l.startOffset, D = S.options, H = D.offsetWithOrigin ? (function(ne) {
          var de = ne.interaction.element, he = Ge(Je(ne.state.options.origin, null, null, [de])), pe = he || ft(ne.interactable, de, ne.interaction.prepared.name);
          return pe;
        })(l) : { x: 0, y: 0 };
        if (D.offset === "startCoords") o = { x: s.coords.start.page.x, y: s.coords.start.page.y };
        else {
          var L = Je(D.offset, h, g, [s]);
          (o = Ge(L) || { x: 0, y: 0 }).x += H.x, o.y += H.y;
        }
        var X = D.relativePoints;
        S.offsets = x && X && X.length ? X.map((function(ne, de) {
          return { index: de, relativePoint: ne, x: _.left - x.width * ne.x + o.x, y: _.top - x.height * ne.y + o.y };
        })) : [{ index: 0, relativePoint: null, x: o.x, y: o.y }];
      }, set: function(l) {
        var o = l.interaction, s = l.coords, h = l.state, g = h.options, x = h.offsets, S = ft(o.interactable, o.element, o.prepared.name), _ = be({}, s), D = [];
        g.offsetWithOrigin || (_.x -= S.x, _.y -= S.y);
        for (var H = 0, L = x; H < L.length; H++) for (var X = L[H], ne = _.x - X.x, de = _.y - X.y, he = 0, pe = g.targets.length; he < pe; he++) {
          var we = g.targets[he], Se = void 0;
          (Se = M.func(we) ? we(ne, de, o._proxy, X, he) : we) && D.push({ x: (M.number(Se.x) ? Se.x : ne) + X.x, y: (M.number(Se.y) ? Se.y : de) + X.y, range: M.number(Se.range) ? Se.range : g.range, source: we, index: he, offset: X });
        }
        for (var $e = { target: null, inRange: !1, distance: 0, range: 0, delta: { x: 0, y: 0 } }, Ve = 0; Ve < D.length; Ve++) {
          var Ke = D[Ve], Re = Ke.range, We = Ke.x - _.x, ht = Ke.y - _.y, rt = At(We, ht), yt = rt <= Re;
          Re === 1 / 0 && $e.inRange && $e.range !== 1 / 0 && (yt = !1), $e.target && !(yt ? $e.inRange && Re !== 1 / 0 ? rt / Re < $e.distance / $e.range : Re === 1 / 0 && $e.range !== 1 / 0 || rt < $e.distance : !$e.inRange && rt < $e.distance) || ($e.target = Ke, $e.distance = rt, $e.range = Re, $e.inRange = yt, $e.delta.x = We, $e.delta.y = ht);
        }
        return $e.inRange && (s.x = $e.target.x, s.y = $e.target.y), h.closest = $e, $e;
      }, defaults: { range: 1 / 0, targets: null, offset: null, offsetWithOrigin: !0, origin: null, relativePoints: null, endOnly: !1, enabled: !1 } }, la = jn(Ol, "snap"), il = { start: function(l) {
        var o = l.state, s = l.edges, h = o.options;
        if (!s) return null;
        l.state = { options: { targets: null, relativePoints: [{ x: s.left ? 0 : 1, y: s.top ? 0 : 1 }], offset: h.offset || "self", origin: { x: 0, y: 0 }, range: h.range } }, o.targetFields = o.targetFields || [["width", "height"], ["x", "y"]], Ol.start(l), o.offsets = l.state.offsets, l.state = o;
      }, set: function(l) {
        var o = l.interaction, s = l.state, h = l.coords, g = s.options, x = s.offsets, S = { x: h.x - x[0].x, y: h.y - x[0].y };
        s.options = be({}, g), s.options.targets = [];
        for (var _ = 0, D = g.targets || []; _ < D.length; _++) {
          var H = D[_], L = void 0;
          if (L = M.func(H) ? H(S.x, S.y, o) : H) {
            for (var X = 0, ne = s.targetFields; X < ne.length; X++) {
              var de = ne[X], he = de[0], pe = de[1];
              if (he in L || pe in L) {
                L.x = L[he], L.y = L[pe];
                break;
              }
            }
            s.options.targets.push(L);
          }
        }
        var we = Ol.set(l);
        return s.options = g, we;
      }, defaults: { range: 1 / 0, targets: null, offset: null, endOnly: !1, enabled: !1 } }, Xa = jn(il, "snapSize"), Dl = { aspectRatio: ea, restrictEdges: yo, restrict: Ka, restrictRect: Al, restrictSize: ia, snapEdges: jn({ start: function(l) {
        var o = l.edges;
        return o ? (l.state.targetFields = l.state.targetFields || [[o.left ? "left" : "right", o.top ? "top" : "bottom"]], il.start(l)) : null;
      }, set: il.set, defaults: be(gi(il.defaults), { targets: void 0, range: void 0, offset: { x: 0, y: 0 } }) }, "snapEdges"), snap: la, snapSize: Xa, spring: ri, avoid: ri, transform: ri, rubberband: ri }, oa = { id: "modifiers", install: function(l) {
        var o = l.interactStatic;
        for (var s in l.usePlugin(el), l.usePlugin(Ya), o.modifiers = Dl, Dl) {
          var h = Dl[s], g = h._defaults, x = h._methods;
          g._methods = x, l.defaults.perAction[s] = g;
        }
      } }, Bi = oa, ll = (function(l) {
        p(s, l);
        var o = C(s);
        function s(h, g, x, S, _, D) {
          var H;
          if (r(this, s), Wt(v(H = o.call(this, _)), x), x !== g && Wt(v(H), g), H.timeStamp = D, H.originalEvent = x, H.type = h, H.pointerId = je(g), H.pointerType = St(g), H.target = S, H.currentTarget = null, h === "tap") {
            var L = _.getPointerIndex(g);
            H.dt = H.timeStamp - _.pointers[L].downTime;
            var X = H.timeStamp - _.tapTime;
            H.double = !!_.prevTap && _.prevTap.type !== "doubletap" && _.prevTap.target === H.target && X < 500;
          } else h === "doubletap" && (H.dt = g.timeStamp - _.tapTime, H.double = !0);
          return H;
        }
        return u(s, [{ key: "_subtractOrigin", value: function(h) {
          var g = h.x, x = h.y;
          return this.pageX -= g, this.pageY -= x, this.clientX -= g, this.clientY -= x, this;
        } }, { key: "_addOrigin", value: function(h) {
          var g = h.x, x = h.y;
          return this.pageX += g, this.pageY += x, this.clientX += g, this.clientY += x, this;
        } }, { key: "preventDefault", value: function() {
          this.originalEvent.preventDefault();
        } }]), s;
      })(Gt), Dt = { id: "pointer-events/base", before: ["inertia", "modifiers", "auto-start", "actions"], install: function(l) {
        l.pointerEvents = Dt, l.defaults.actions.pointerEvents = Dt.defaults, be(l.actions.phaselessTypes, Dt.types);
      }, listeners: { "interactions:new": function(l) {
        var o = l.interaction;
        o.prevTap = null, o.tapTime = 0;
      }, "interactions:update-pointer": function(l) {
        var o = l.down, s = l.pointerInfo;
        !o && s.hold || (s.hold = { duration: 1 / 0, timeout: null });
      }, "interactions:move": function(l, o) {
        var s = l.interaction, h = l.pointer, g = l.event, x = l.eventTarget;
        l.duplicate || s.pointerIsDown && !s.pointerWasMoved || (s.pointerIsDown && ql(l), Un({ interaction: s, pointer: h, event: g, eventTarget: x, type: "move" }, o));
      }, "interactions:down": function(l, o) {
        (function(s, h) {
          for (var g = s.interaction, x = s.pointer, S = s.event, _ = s.eventTarget, D = s.pointerIndex, H = g.pointers[D].hold, L = oe(_), X = { interaction: g, pointer: x, event: S, eventTarget: _, type: "hold", targets: [], path: L, node: null }, ne = 0; ne < L.length; ne++) {
            var de = L[ne];
            X.node = de, h.fire("pointerEvents:collect-targets", X);
          }
          if (X.targets.length) {
            for (var he = 1 / 0, pe = 0, we = X.targets; pe < we.length; pe++) {
              var Se = we[pe].eventable.options.holdDuration;
              Se < he && (he = Se);
            }
            H.duration = he, H.timeout = setTimeout((function() {
              Un({ interaction: g, eventTarget: _, pointer: x, event: S, type: "hold" }, h);
            }), he);
          }
        })(l, o), Un(l, o);
      }, "interactions:up": function(l, o) {
        ql(l), Un(l, o), (function(s, h) {
          var g = s.interaction, x = s.pointer, S = s.event, _ = s.eventTarget;
          g.pointerWasMoved || Un({ interaction: g, eventTarget: _, pointer: x, event: S, type: "tap" }, h);
        })(l, o);
      }, "interactions:cancel": function(l, o) {
        ql(l), Un(l, o);
      } }, PointerEvent: ll, fire: Un, collectEventTargets: Nt, 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 Un(l, o) {
        var s = l.interaction, h = l.pointer, g = l.event, x = l.eventTarget, S = l.type, _ = l.targets, D = _ === void 0 ? Nt(l, o) : _, H = new ll(S, h, g, x, s, o.now());
        o.fire("pointerEvents:new", { pointerEvent: H });
        for (var L = { interaction: s, pointer: h, event: g, eventTarget: x, targets: D, type: S, pointerEvent: H }, X = 0; X < D.length; X++) {
          var ne = D[X];
          for (var de in ne.props || {}) H[de] = ne.props[de];
          var he = ft(ne.eventable, ne.node);
          if (H._subtractOrigin(he), H.eventable = ne.eventable, H.currentTarget = ne.node, ne.eventable.fire(H), H._addOrigin(he), H.immediatePropagationStopped || H.propagationStopped && X + 1 < D.length && D[X + 1].node !== H.currentTarget) break;
        }
        if (o.fire("pointerEvents:fired", L), S === "tap") {
          var pe = H.double ? Un({ interaction: s, pointer: h, event: g, eventTarget: x, type: "doubletap" }, o) : H;
          s.prevTap = pe, s.tapTime = pe.timeStamp;
        }
        return H;
      }
      function Nt(l, o) {
        var s = l.interaction, h = l.pointer, g = l.event, x = l.eventTarget, S = l.type, _ = s.getPointerIndex(h), D = s.pointers[_];
        if (S === "tap" && (s.pointerWasMoved || !D || D.downTarget !== x)) return [];
        for (var H = oe(x), L = { interaction: s, pointer: h, event: g, eventTarget: x, type: S, path: H, targets: [], node: null }, X = 0; X < H.length; X++) {
          var ne = H[X];
          L.node = ne, o.fire("pointerEvents:collect-targets", L);
        }
        return S === "hold" && (L.targets = L.targets.filter((function(de) {
          var he, pe;
          return de.eventable.options.holdDuration === ((he = s.pointers[_]) == null || (pe = he.hold) == null ? void 0 : pe.duration);
        }))), L.targets;
      }
      function ql(l) {
        var o = l.interaction, s = l.pointerIndex, h = o.pointers[s].hold;
        h && h.timeout && (clearTimeout(h.timeout), h.timeout = null);
      }
      var xo = Object.freeze({ __proto__: null, default: Dt });
      function ol(l) {
        var o = l.interaction;
        o.holdIntervalHandle && (clearInterval(o.holdIntervalHandle), o.holdIntervalHandle = null);
      }
      var Qa = { id: "pointer-events/holdRepeat", install: function(l) {
        l.usePlugin(Dt);
        var o = l.pointerEvents;
        o.defaults.holdRepeatInterval = 0, o.types.holdrepeat = l.actions.phaselessTypes.holdrepeat = !0;
      }, listeners: ["move", "up", "cancel", "endall"].reduce((function(l, o) {
        return l["pointerEvents:".concat(o)] = ol, l;
      }), { "pointerEvents:new": function(l) {
        var o = l.pointerEvent;
        o.type === "hold" && (o.count = (o.count || 0) + 1);
      }, "pointerEvents:fired": function(l, o) {
        var s = l.interaction, h = l.pointerEvent, g = l.eventTarget, x = l.targets;
        if (h.type === "hold" && x.length) {
          var S = x[0].eventable.options.holdRepeatInterval;
          S <= 0 || (s.holdIntervalHandle = setTimeout((function() {
            o.pointerEvents.fire({ interaction: s, eventTarget: g, type: "hold", pointer: h, event: h }, o);
          }), S));
        }
      } }) }, Ja = Qa, wo = { id: "pointer-events/interactableTargets", install: function(l) {
        var o = l.Interactable;
        o.prototype.pointerEvents = function(h) {
          return be(this.events.options, h), this;
        };
        var s = o.prototype._backCompatOption;
        o.prototype._backCompatOption = function(h, g) {
          var x = s.call(this, h, g);
          return x === this && (this.events.options[h] = g), x;
        };
      }, listeners: { "pointerEvents:collect-targets": function(l, o) {
        var s = l.targets, h = l.node, g = l.type, x = l.eventTarget;
        o.interactables.forEachMatch(h, (function(S) {
          var _ = S.events, D = _.options;
          _.types[g] && _.types[g].length && S.testIgnoreAllow(D, h, x) && s.push({ node: h, eventable: _, props: { interactable: S } });
        }));
      }, "interactable:new": function(l) {
        var o = l.interactable;
        o.events.getRect = function(s) {
          return o.getRect(s);
        };
      }, "interactable:set": function(l, o) {
        var s = l.interactable, h = l.options;
        be(s.events.options, o.pointerEvents.defaults), be(s.events.options, h.pointerEvents || {});
      } } }, w = wo, P = { id: "pointer-events", install: function(l) {
        l.usePlugin(xo), l.usePlugin(Ja), l.usePlugin(w);
      } }, N = P, V = { id: "reflow", install: function(l) {
        var o = l.Interactable;
        l.actions.phases.reflow = !0, o.prototype.reflow = function(s) {
          return (function(h, g, x) {
            for (var S = h.getAllElements(), _ = x.window.Promise, D = _ ? [] : null, H = function() {
              var X = S[L], ne = h.getRect(X);
              if (!ne) return 1;
              var de, he = Mt(x.interactions.list, (function(Se) {
                return Se.interacting() && Se.interactable === h && Se.element === X && Se.prepared.name === g.name;
              }));
              if (he) he.move(), D && (de = he._reflowPromise || new _((function(Se) {
                he._reflowResolve = Se;
              })));
              else {
                var pe = mt(ne), we = /* @__PURE__ */ (function(Se) {
                  return { coords: Se, 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: pe.x, y: pe.y }, client: { x: pe.x, y: pe.y }, timeStamp: x.now() });
                de = (function(Se, $e, Ve, Ke, Re) {
                  var We = Se.interactions.new({ pointerType: "reflow" }), ht = { interaction: We, event: Re, pointer: Re, eventTarget: Ve, phase: "reflow" };
                  We.interactable = $e, We.element = Ve, We.prevEvent = Re, We.updatePointer(Re, Re, Ve, !0), Be(We.coords.delta), Bt(We.prepared, Ke), We._doPhase(ht);
                  var rt = Se.window, yt = rt.Promise, Ct = yt ? new yt((function(Vt) {
                    We._reflowResolve = Vt;
                  })) : void 0;
                  return We._reflowPromise = Ct, We.start(Ke, $e, Ve), We._interacting ? (We.move(ht), We.end(Re)) : (We.stop(), We._reflowResolve()), We.removePointer(Re, Re), Ct;
                })(x, h, X, g, we);
              }
              D && D.push(de);
            }, L = 0; L < S.length && !H(); L++) ;
            return D && _.all(D).then((function() {
              return h;
            }));
          })(this, s, l);
        };
      }, listeners: { "interactions:stop": function(l, o) {
        var s = l.interaction;
        s.pointerType === "reflow" && (s._reflowResolve && s._reflowResolve(), (function(h, g) {
          h.splice(h.indexOf(g), 1);
        })(o.interactions.list, s));
      } } }, ee = V;
      if ($t.use(Yo), $t.use(go), $t.use(N), $t.use(Xo), $t.use(Bi), $t.use(ho), $t.use(Ra), $t.use(Qt), $t.use(ee), $t.default = $t, a(e) === "object" && e) try {
        e.exports = $t;
      } catch {
      }
      return $t.default = $t, $t;
    }));
  })($o, $o.exports)), $o.exports;
}
var qp = /* @__PURE__ */ Dp();
const du = /* @__PURE__ */ Zd(qp), fu = /* @__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, r = vl(Qc), f = vl(Jc);
    if (!r)
      throw new Error("[grid-layout-plus]: missing layout store, GridItem must under a GridLayout.");
    const u = Ku(null), c = bl({
      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 p = !1, y = !1, b = NaN, v = NaN, C = NaN, z = NaN, T = -1, q = -1, Q = -1, F = -1, U = i.x, O = i.y, W = i.w, te = i.h;
    const M = fe(), G = bl({
      i: Td(i, "i"),
      state: c,
      wrapper: M,
      calcXY: Je
    });
    function J(ae) {
      Tt(ae);
    }
    function K() {
      ut();
    }
    function A(ae) {
      Tn(i.isDraggable) && (c.draggable = ae);
    }
    function Z(ae) {
      Tn(i.isResizable) && (c.resizable = ae);
    }
    function Y(ae) {
      Tn(i.isBounded) && (c.bounded = ae);
    }
    function $(ae) {
      c.transformScale = ae;
    }
    function j(ae) {
      c.rowHeight = ae;
    }
    function ue(ae) {
      c.maxRows = ae;
    }
    function ie() {
      c.rtl = uu() === "rtl", ut();
    }
    function Ee(ae) {
      c.cols = Math.floor(ae);
    }
    r.increaseItem(G), Xu(() => {
      c.rtl = uu() === "rtl";
    }), In(() => {
      r.responsive && r.lastBreakpoint ? c.cols = id(r.lastBreakpoint, r.cols) : c.cols = r.colNum, c.rowHeight = r.rowHeight, c.containerWidth = r.width !== null ? r.width : 100, c.margin = r.margin !== void 0 ? r.margin.map(Number) : [10, 10], c.maxRows = r.maxRows, Tn(i.isDraggable) ? c.draggable = r.isDraggable : c.draggable = i.isDraggable, Tn(i.isResizable) ? c.resizable = r.isResizable : c.resizable = i.isResizable, Tn(i.isBounded) ? c.bounded = r.isBounded : c.bounded = i.isBounded, c.transformScale = r.transformScale, c.useCssTransforms = r.useCssTransforms, c.useStyleCursor = r.useStyleCursor, wa(() => {
        U = i.x, O = i.y, te = i.h, W = i.w, pn(se);
      }), f.on("updateWidth", J), f.on("compact", K), f.on("setDraggable", A), f.on("setResizable", Z), f.on("setBounded", Y), f.on("setTransformScale", $), f.on("setRowHeight", j), f.on("setMaxRows", ue), f.on("directionchange", ie), f.on("setColNum", Ee);
    }), no(() => {
      f.off("updateWidth", J), f.off("compact", K), f.off("setDraggable", A), f.off("setResizable", Z), f.off("setBounded", Y), f.off("setTransformScale", $), f.off("setRowHeight", j), f.off("setMaxRows", ue), f.off("directionchange", ie), f.off("setColNum", Ee), u.value && (u.value.unset(), u.value = null), r.decreaseItem(G);
    }), t({ state: c, wrapper: M });
    const me = typeof navigator < "u" ? navigator.userAgent.toLowerCase().includes("android") : !1, ge = re(() => c.resizable && !i.static), le = re(() => r.isMirrored ? !c.rtl : c.rtl), ve = re(() => (c.draggable || c.resizable) && !i.static), Oe = Mp("item"), xe = re(() => ({
      [Oe.b()]: !0,
      [Oe.bm("resizable")]: ge.value,
      [Oe.bm("static")]: i.static,
      [Oe.bm("resizing")]: c.isResizing,
      [Oe.bm("dragging")]: c.isDragging,
      [Oe.bm("transform")]: c.useCssTransforms,
      [Oe.bm("rtl")]: le.value,
      [Oe.bm("no-touch")]: me && ve.value
    })), ke = re(() => [Oe.be("resizer"), le.value && Oe.bem("resizer", "rtl")].filter(Boolean));
    Fe(
      () => i.isDraggable,
      (ae) => {
        c.draggable = ae;
      }
    ), Fe(
      () => i.static,
      () => {
        pn(Wt), pn(Be);
      }
    ), Fe(
      () => c.draggable,
      () => {
        pn(Wt);
      }
    ), Fe(
      () => i.isResizable,
      (ae) => {
        c.resizable = ae;
      }
    ), Fe(
      () => i.isBounded,
      (ae) => {
        c.bounded = ae;
      }
    ), Fe(
      () => c.resizable,
      () => {
        pn(Be);
      }
    ), Fe(
      () => c.rowHeight,
      () => {
        pn(se), pn(oe);
      }
    ), Fe([() => c.cols, () => c.containerWidth], () => {
      pn(Be), pn(se), pn(oe);
    }), Fe([() => i.minH, () => i.maxH, () => i.minW, () => i.maxW], () => {
      pn(Be);
    }), Fe(le, () => {
      pn(Be), pn(se);
    }), Fe([() => r.margin, () => r.margin[0], () => r.margin[1]], () => {
      const ae = r.margin;
      !ae || ae[0] === c.margin[0] && ae[1] === c.margin[1] || (c.margin = ae.map(Number), pn(se), pn(oe));
    });
    function se() {
      i.x + i.w > c.cols ? (U = 0, W = i.w > c.cols ? c.cols : i.w) : (U = i.x, W = i.w);
      const ae = qe(U, O, W, te);
      c.isDragging && (ae.top = c.dragging.top, le.value ? ae.right = c.dragging.left : ae.left = c.dragging.left), c.isResizing && (ae.width = c.resizing.width, ae.height = c.resizing.height);
      let Ie;
      c.useCssTransforms ? le.value ? Ie = kp(ae.top, ae.right, ae.width, ae.height) : Ie = Sp(ae.top, ae.left, ae.width, ae.height) : le.value ? Ie = _p(ae.top, ae.right, ae.width, ae.height) : Ie = Cp(ae.top, ae.left, ae.width, ae.height), c.style = Ie;
    }
    function oe() {
      const ae = {};
      for (const Ie of ["width", "height"]) {
        const _e = c.style[Ie].match(/^(\d+)px$/);
        if (!_e)
          return;
        ae[Ie] = _e[1];
      }
      a("container-resized", i.i, i.h, i.w, ae.height, ae.width);
    }
    function Te(ae) {
      if (i.static) return;
      const Ie = ae.type;
      if (Ie === "resizestart" && c.isResizing || Ie !== "resizestart" && !c.isResizing)
        return;
      const _e = su(ae);
      if (Tn(_e)) return;
      const { x: je, y: ct } = _e, Ye = { width: 0, height: 0 };
      let Le;
      switch (Ie) {
        case "resizestart": {
          Be(), T = W, q = te, Le = qe(U, O, W, te), Ye.width = Le.width, Ye.height = Le.height, c.resizing = Ye, c.isResizing = !0;
          break;
        }
        case "resizemove": {
          !ae.edges.right && !ae.edges.left && (C = je), !ae.edges.top && !ae.edges.bottom && (z = ct);
          const et = ru(C, z, je, ct);
          le.value ? Ye.width = c.resizing.width - et.deltaX / c.transformScale : Ye.width = c.resizing.width + et.deltaX / c.transformScale, Ye.height = c.resizing.height + et.deltaY / c.transformScale, c.resizing = Ye;
          break;
        }
        case "resizeend": {
          Le = qe(U, O, W, te), Ye.width = Le.width, Ye.height = Le.height, c.resizing = { width: -1, height: -1 }, c.isResizing = !1;
          break;
        }
      }
      Le = ft(Ye.height, Ye.width), Le.w < i.minW && (Le.w = i.minW), Le.w > i.maxW && (Le.w = i.maxW), Le.h < i.minH && (Le.h = i.minH), Le.h > i.maxH && (Le.h = i.maxH), Le.h < 1 && (Le.h = 1), Le.w < 1 && (Le.w = 1), C = je, z = ct, (W !== Le.w || te !== Le.h) && a("resize", i.i, Le.h, Le.w, Ye.height, Ye.width), ae.type === "resizeend" && (T !== W || q !== te) && a("resized", i.i, Le.h, Le.w, Ye.height, Ye.width), f.emit("resizeEvent", ae.type, i.i, U, O, Le.h, Le.w);
    }
    function be(ae) {
      if (i.static || c.isResizing) return;
      const Ie = ae.type;
      if (Ie === "dragstart" && c.isDragging || Ie !== "dragstart" && !c.isDragging)
        return;
      const _e = su(ae);
      if (Tn(_e)) return;
      const { x: je, y: ct } = _e, Ye = ae.target;
      if (!Ye.offsetParent) return;
      const Le = { top: 0, left: 0 };
      switch (Ie) {
        case "dragstart": {
          Q = U, F = O;
          const nt = Ye.offsetParent.getBoundingClientRect(), it = Ye.getBoundingClientRect(), St = it.left / c.transformScale, Lt = nt.left / c.transformScale, Gt = it.right / c.transformScale, fn = nt.right / c.transformScale, sn = it.top / c.transformScale, Ut = nt.top / c.transformScale;
          le.value ? Le.left = (Gt - fn) * -1 : Le.left = St - Lt, Le.top = sn - Ut, c.dragging = Le, c.isDragging = !0;
          break;
        }
        case "dragmove": {
          const nt = ru(b, v, je, ct);
          if (le.value ? Le.left = c.dragging.left - nt.deltaX / c.transformScale : Le.left = c.dragging.left + nt.deltaX / c.transformScale, Le.top = c.dragging.top + nt.deltaY / c.transformScale, c.bounded) {
            const it = Ye.offsetParent.clientHeight - mt(i.h, c.rowHeight, c.margin[1]);
            Le.top = It(Le.top, 0, it);
            const St = Ge(), Lt = c.containerWidth - mt(i.w, St, c.margin[0]);
            Le.left = It(Le.left, 0, Lt);
          }
          c.dragging = Le;
          break;
        }
        case "dragend": {
          const nt = Ye.offsetParent.getBoundingClientRect(), it = Ye.getBoundingClientRect(), St = it.left / c.transformScale, Lt = nt.left / c.transformScale, Gt = it.right / c.transformScale, fn = nt.right / c.transformScale, sn = it.top / c.transformScale, Ut = nt.top / c.transformScale;
          le.value ? Le.left = (Gt - fn) * -1 : Le.left = St - Lt, Le.top = sn - Ut, c.dragging = { top: -1, left: -1 }, c.isDragging = !1;
          break;
        }
      }
      let et;
      le.value, et = Je(Le.top, Le.left), b = je, v = ct, (U !== et.x || O !== et.y) && a("move", i.i, et.x, et.y), ae.type === "dragend" && (Q !== U || F !== O) && a("moved", i.i, et.x, et.y), f.emit("dragEvent", ae.type, i.i, et.x, et.y, te, W);
    }
    function qe(ae, Ie, _e, je) {
      const ct = Ge();
      let Ye;
      return le.value ? Ye = {
        right: Math.round(ct * ae + (ae + 1) * c.margin[0]),
        top: Math.round(c.rowHeight * Ie + (Ie + 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: _e === 1 / 0 ? _e : Math.round(ct * _e + Math.max(0, _e - 1) * c.margin[0]),
        height: je === 1 / 0 ? je : Math.round(c.rowHeight * je + Math.max(0, je - 1) * c.margin[1])
      } : Ye = {
        left: Math.round(ct * ae + (ae + 1) * c.margin[0]),
        top: Math.round(c.rowHeight * Ie + (Ie + 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: _e === 1 / 0 ? _e : Math.round(ct * _e + Math.max(0, _e - 1) * c.margin[0]),
        height: je === 1 / 0 ? je : Math.round(c.rowHeight * je + Math.max(0, je - 1) * c.margin[1])
      }, Ye;
    }
    function Je(ae, Ie) {
      const _e = Ge();
      let je = Math.round((Ie - c.margin[0]) / (_e + c.margin[0])), ct = Math.round((ae - c.margin[1]) / (c.rowHeight + c.margin[1]));
      return je = Math.max(Math.min(je, c.cols - W), 0), ct = Math.max(Math.min(ct, c.maxRows - te), 0), { x: je, y: ct };
    }
    function Ge() {
      return (c.containerWidth - c.margin[0] * (c.cols + 1)) / c.cols;
    }
    function mt(ae, Ie, _e) {
      return Number.isFinite(ae) ? Math.round(Ie * ae + Math.max(0, ae - 1) * _e) : ae;
    }
    function It(ae, Ie, _e) {
      return Math.max(Math.min(ae, _e), Ie);
    }
    function ft(ae, Ie, _e = !1) {
      const je = Ge();
      let ct = Math.round((Ie + c.margin[0]) / (je + c.margin[0])), Ye = 0;
      return _e ? Ye = Math.ceil((ae + c.margin[1]) / (c.rowHeight + c.margin[1])) : Ye = Math.round((ae + c.margin[1]) / (c.rowHeight + c.margin[1])), ct = Math.max(Math.min(ct, c.cols - U), 0), Ye = Math.max(Math.min(Ye, c.maxRows - O), 0), { w: ct, h: Ye };
    }
    function Tt(ae, Ie) {
      c.containerWidth = ae;
    }
    function ut() {
      se();
    }
    function At() {
      !u.value && M.value && (u.value = du(M.value), c.useStyleCursor || u.value.styleCursor(!1));
    }
    const Wn = lu(be);
    function Wt() {
      if (At(), !!u.value)
        if (c.draggable && !i.static) {
          const ae = {
            ignoreFrom: i.dragIgnoreFrom,
            allowFrom: i.dragAllowFrom,
            ...i.dragOption
          };
          u.value.draggable(ae), p || (p = !0, u.value.on("dragstart dragmove dragend", (Ie) => {
            Ie.type === "dragmove" ? Wn(Ie) : be(Ie);
          }));
        } else
          u.value.draggable({ enabled: !1 });
    }
    const ln = lu(Te);
    function Be() {
      if (At(), !!u.value)
        if (c.resizable && !i.static) {
          const ae = qe(0, 0, i.maxW, i.maxH), Ie = qe(0, 0, i.minW, i.minH), _e = {
            edges: {
              left: le.value ? `.${ke.value[0]}` : !1,
              right: le.value ? !1 : `.${ke.value[0]}`,
              bottom: `.${ke.value[0]}`,
              top: !1
            },
            ignoreFrom: i.resizeIgnoreFrom,
            restrictSize: {
              min: {
                height: Ie.height * c.transformScale,
                width: Ie.width * c.transformScale
              },
              max: {
                height: ae.height * c.transformScale,
                width: ae.width * c.transformScale
              }
            },
            ...i.resizeOption
          };
          i.preserveAspectRatio && (_e.modifiers = [du.modifiers.aspectRatio({ ratio: "preserve" })]), u.value.resizable(_e), y || (y = !0, u.value.on("resizestart resizemove resizeend", (je) => {
            je.type === "resizemove" ? ln(je) : Te(je);
          }));
        } else
          u.value.resizable({ enabled: !1 });
    }
    return (ae, Ie) => (E(), B("section", {
      ref_key: "wrapper",
      ref: M,
      class: Ae(xe.value),
      style: He(c.style)
    }, [
      zi(ae.$slots, "default"),
      ge.value ? (E(), B("span", {
        key: 0,
        class: Ae(ke.value)
      }, null, 2)) : ye("", !0)
    ], 6));
  }
}), Sl = typeof window < "u";
var hu;
Sl && (hu = window?.navigator) != null && hu.userAgent && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function gu(e) {
  return e != null;
}
function pu() {
}
const Lp = 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(Lp)));
const Rp = Sl && ("ontouchstart" in window || Np() > 0), mu = Rp ? "pointerdown" : "click";
function Np() {
  return typeof navigator < "u" && (navigator.maxTouchPoints || navigator.msMaxTouchPoints) || 0;
}
function Vp(e, t, n = window.Event) {
  const { type: i, bubbles: a = !1, cancelable: r = !1, ...f } = t;
  if (!gu(i) || i === "") return !1;
  let u;
  return gu(n) ? u = new n(i, { bubbles: a, cancelable: r }) : (u = document.createEvent("HTMLEvents"), u.initEvent(i, a, r)), Object.assign(u, f), e.dispatchEvent(u);
}
const Fp = "clickoutside", Bp = /* @__PURE__ */ new Set();
let cs = null;
function Hp(e, t) {
  return e instanceof Node ? t === e || t.contains(e) || !!t.__transferElement && (t.__transferElement === e || t.__transferElement.contains(e)) : !1;
}
Sl && (mu === "click" && document.addEventListener(
  "pointerdown",
  (e) => {
    cs = e.target;
  },
  !0
), document.addEventListener(
  mu,
  (e) => {
    const t = cs;
    cs = null, Bp.forEach((n) => {
      if (t && Hp(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)) && Vp(n, { type: Fp });
    });
  },
  !0
));
const Wp = [
  [
    "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 ba;
if (Sl) {
  for (const e of Wp)
    if (e[1] in document) {
      ba = e;
      break;
    }
}
re(() => !1);
const jp = /* @__PURE__ */ new Set(), Gp = /* @__PURE__ */ new WeakMap();
if (Sl && ba) {
  const e = ba[2], t = ba[4];
  document.addEventListener(
    t,
    () => {
      if (jp.forEach((n) => {
        n.value = !1;
      }), document[e]) {
        const n = Gp.get(document[e]);
        n && (n.value = !0);
      }
    },
    !1
  );
}
const od = /* @__PURE__ */ new Map();
od.set("x", 0);
od.set("y", 0);
var pl = [], Yp = function() {
  return pl.some(function(e) {
    return e.activeTargets.length > 0;
  });
}, Up = function() {
  return pl.some(function(e) {
    return e.skippedTargets.length > 0;
  });
}, vu = "ResizeObserver loop completed with undelivered notifications.", Kp = function() {
  var e;
  typeof ErrorEvent == "function" ? e = new ErrorEvent("error", {
    message: vu
  }) : (e = document.createEvent("Event"), e.initEvent("error", !1, !1), e.message = vu), window.dispatchEvent(e);
}, No;
(function(e) {
  e.BORDER_BOX = "border-box", e.CONTENT_BOX = "content-box", e.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
})(No || (No = {}));
var ml = function(e) {
  return Object.freeze(e);
}, Xp = /* @__PURE__ */ (function() {
  function e(t, n) {
    this.inlineSize = t, this.blockSize = n, ml(this);
  }
  return e;
})(), ad = (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, ml(this);
  }
  return e.prototype.toJSON = function() {
    var t = this, n = t.x, i = t.y, a = t.top, r = t.right, f = t.bottom, u = t.left, c = t.width, p = t.height;
    return { x: n, y: i, top: a, right: r, bottom: f, left: u, width: c, height: p };
  }, e.fromRect = function(t) {
    return new e(t.x, t.y, t.width, t.height);
  }, e;
})(), er = function(e) {
  return e instanceof SVGElement && "getBBox" in e;
}, sd = function(e) {
  if (er(e)) {
    var t = e.getBBox(), n = t.width, i = t.height;
    return !n && !i;
  }
  var a = e, r = a.offsetWidth, f = a.offsetHeight;
  return !(r || f || e.getClientRects().length);
}, yu = 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);
}, Qp = 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;
}, qo = typeof window < "u" ? window : {}, ca = /* @__PURE__ */ new WeakMap(), bu = /auto|scroll/, Jp = /^tb|vertical/, Zp = /msie|trident/i.test(qo.navigator && qo.navigator.userAgent), di = function(e) {
  return parseFloat(e || "0");
}, Yl = function(e, t, n) {
  return e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = !1), new Xp((n ? t : e) || 0, (n ? e : t) || 0);
}, xu = ml({
  devicePixelContentBoxSize: Yl(),
  borderBoxSize: Yl(),
  contentBoxSize: Yl(),
  contentRect: new ad(0, 0, 0, 0)
}), rd = function(e, t) {
  if (t === void 0 && (t = !1), ca.has(e) && !t)
    return ca.get(e);
  if (sd(e))
    return ca.set(e, xu), xu;
  var n = getComputedStyle(e), i = er(e) && e.ownerSVGElement && e.getBBox(), a = !Zp && n.boxSizing === "border-box", r = Jp.test(n.writingMode || ""), f = !i && bu.test(n.overflowY || ""), u = !i && bu.test(n.overflowX || ""), c = i ? 0 : di(n.paddingTop), p = i ? 0 : di(n.paddingRight), y = i ? 0 : di(n.paddingBottom), b = i ? 0 : di(n.paddingLeft), v = i ? 0 : di(n.borderTopWidth), C = i ? 0 : di(n.borderRightWidth), z = i ? 0 : di(n.borderBottomWidth), T = i ? 0 : di(n.borderLeftWidth), q = b + p, Q = c + y, F = T + C, U = v + z, O = u ? e.offsetHeight - U - e.clientHeight : 0, W = f ? e.offsetWidth - F - e.clientWidth : 0, te = a ? q + F : 0, M = a ? Q + U : 0, G = i ? i.width : di(n.width) - te - W, J = i ? i.height : di(n.height) - M - O, K = G + q + W + F, A = J + Q + O + U, Z = ml({
    devicePixelContentBoxSize: Yl(Math.round(G * devicePixelRatio), Math.round(J * devicePixelRatio), r),
    borderBoxSize: Yl(K, A, r),
    contentBoxSize: Yl(G, J, r),
    contentRect: new ad(b, c, G, J)
  });
  return ca.set(e, Z), Z;
}, ud = function(e, t, n) {
  var i = rd(e, n), a = i.borderBoxSize, r = i.contentBoxSize, f = i.devicePixelContentBoxSize;
  switch (t) {
    case No.DEVICE_PIXEL_CONTENT_BOX:
      return f;
    case No.BORDER_BOX:
      return a;
    default:
      return r;
  }
}, em = /* @__PURE__ */ (function() {
  function e(t) {
    var n = rd(t);
    this.target = t, this.contentRect = n.contentRect, this.borderBoxSize = ml([n.borderBoxSize]), this.contentBoxSize = ml([n.contentBoxSize]), this.devicePixelContentBoxSize = ml([n.devicePixelContentBoxSize]);
  }
  return e;
})(), cd = function(e) {
  if (sd(e))
    return 1 / 0;
  for (var t = 0, n = e.parentNode; n; )
    t += 1, n = n.parentNode;
  return t;
}, tm = function() {
  var e = 1 / 0, t = [];
  pl.forEach(function(r) {
    if (r.activeTargets.length !== 0) {
      var f = [];
      r.activeTargets.forEach(function(u) {
        var c = new em(u.target), p = cd(u.target);
        f.push(c), u.lastReportedSize = ud(u.target, u.observedBox), p < e && (e = p);
      }), t.push(function() {
        r.callback.call(r.observer, f, r.observer);
      }), r.activeTargets.splice(0, r.activeTargets.length);
    }
  });
  for (var n = 0, i = t; n < i.length; n++) {
    var a = i[n];
    a();
  }
  return e;
}, wu = function(e) {
  pl.forEach(function(t) {
    t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(n) {
      n.isActive() && (cd(n.target) > e ? t.activeTargets.push(n) : t.skippedTargets.push(n));
    });
  });
}, nm = function() {
  var e = 0;
  for (wu(e); Yp(); )
    e = tm(), wu(e);
  return Up() && Kp(), e > 0;
}, ds, dd = [], im = function() {
  return dd.splice(0).forEach(function(e) {
    return e();
  });
}, lm = function(e) {
  if (!ds) {
    var t = 0, n = document.createTextNode(""), i = { characterData: !0 };
    new MutationObserver(function() {
      return im();
    }).observe(n, i), ds = function() {
      n.textContent = "".concat(t ? t-- : t++);
    };
  }
  dd.push(e), ds();
}, om = function(e) {
  lm(function() {
    requestAnimationFrame(e);
  });
}, xa = 0, am = function() {
  return !!xa;
}, sm = 250, rm = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, Su = [
  "resize",
  "load",
  "transitionend",
  "animationend",
  "animationstart",
  "animationiteration",
  "keyup",
  "keydown",
  "mouseup",
  "mousedown",
  "mouseover",
  "mouseout",
  "blur",
  "focus"
], ku = function(e) {
  return e === void 0 && (e = 0), Date.now() + e;
}, fs = !1, um = (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 = sm), !fs) {
      fs = !0;
      var i = ku(t);
      om(function() {
        var a = !1;
        try {
          a = nm();
        } finally {
          if (fs = !1, t = i - ku(), !am())
            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, rm);
    };
    document.body ? n() : qo.addEventListener("DOMContentLoaded", n);
  }, e.prototype.start = function() {
    var t = this;
    this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), Su.forEach(function(n) {
      return qo.addEventListener(n, t.listener, !0);
    }));
  }, e.prototype.stop = function() {
    var t = this;
    this.stopped || (this.observer && this.observer.disconnect(), Su.forEach(function(n) {
      return qo.removeEventListener(n, t.listener, !0);
    }), this.stopped = !0);
  }, e;
})(), Ls = new um(), Cu = function(e) {
  !xa && e > 0 && Ls.start(), xa += e, !xa && Ls.stop();
}, cm = function(e) {
  return !er(e) && !Qp(e) && getComputedStyle(e).display === "inline";
}, dm = (function() {
  function e(t, n) {
    this.target = t, this.observedBox = n || No.CONTENT_BOX, this.lastReportedSize = {
      inlineSize: 0,
      blockSize: 0
    };
  }
  return e.prototype.isActive = function() {
    var t = ud(this.target, this.observedBox, !0);
    return cm(this.target) && (this.lastReportedSize = t), this.lastReportedSize.inlineSize !== t.inlineSize || this.lastReportedSize.blockSize !== t.blockSize;
  }, e;
})(), fm = /* @__PURE__ */ (function() {
  function e(t, n) {
    this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = t, this.callback = n;
  }
  return e;
})(), da = /* @__PURE__ */ new WeakMap(), _u = function(e, t) {
  for (var n = 0; n < e.length; n += 1)
    if (e[n].target === t)
      return n;
  return -1;
}, fa = (function() {
  function e() {
  }
  return e.connect = function(t, n) {
    var i = new fm(t, n);
    da.set(t, i);
  }, e.observe = function(t, n, i) {
    var a = da.get(t), r = a.observationTargets.length === 0;
    _u(a.observationTargets, n) < 0 && (r && pl.push(a), a.observationTargets.push(new dm(n, i && i.box)), Cu(1), Ls.schedule());
  }, e.unobserve = function(t, n) {
    var i = da.get(t), a = _u(i.observationTargets, n), r = i.observationTargets.length === 1;
    a >= 0 && (r && pl.splice(pl.indexOf(i), 1), i.observationTargets.splice(a, 1), Cu(-1));
  }, e.disconnect = function(t) {
    var n = this, i = da.get(t);
    i.observationTargets.slice().forEach(function(a) {
      return n.unobserve(t, a.target);
    }), i.activeTargets.splice(0, i.activeTargets.length);
  }, e;
})(), hm = (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.");
    fa.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 (!yu(t))
      throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
    fa.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 (!yu(t))
      throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
    fa.unobserve(this, t);
  }, e.prototype.disconnect = function() {
    fa.disconnect(this);
  }, e.toString = function() {
    return "function ResizeObserver () { [polyfill code] }";
  }, e;
})();
const Ma = /* @__PURE__ */ new WeakMap();
function gm(e) {
  var t;
  for (let n = 0, i = e.length; n < i; ++n) {
    const a = e[n], r = Ma.get(a.target);
    if (typeof r == "function") {
      const { inlineSize: f, blockSize: u } = ((t = a.borderBoxSize) == null ? void 0 : t[0]) ?? {}, { offsetWidth: c, offsetHeight: p } = a.target;
      r(
        Object.assign(a, {
          offsetWidth: c,
          offsetHeight: p,
          width: f ?? c,
          height: u ?? p
        })
      );
    }
  }
}
const fd = new (Sl && window.ResizeObserver || hm)(
  gm
);
function zu(e, t) {
  Ma.set(e, t), fd.observe(e);
}
function Mu(e) {
  Ma.has(e) && (fd.unobserve(e), Ma.delete(e));
}
function pm(e = {}) {
  let t = pu;
  const n = Fe(
    () => d(e.target),
    (a) => {
      t(), !(!a || typeof e.onResize != "function") && (zu(a, e.onResize), t = () => {
        Mu(a), t = pu;
      });
    },
    { immediate: !0 }
  ), i = () => {
    n(), t();
  };
  return Pd() && $d(i), {
    /**
     * @deprecated Will be removed in next major version, please directly use `observeResize` from imports.
     */
    observeResize: zu,
    /**
     * @deprecated Will be removed in next major version, please directly use `unobserveResize` from imports.
     */
    unobserveResize: Mu,
    unobserve: i
  };
}
const mm = fe(!1);
re(() => mm.value);
const Tu = "__theme_style__", hs = "__theme_observer__", Pu = bl(/* @__PURE__ */ new Map()), $u = /* @__PURE__ */ new Map();
Fe(Pu, () => {
  if (!Sl) return;
  $u.clear();
  const e = document.head.querySelector(`#${Tu}`);
  e && document.head.removeChild(e);
  const t = document.createElement("style");
  let n = `.${hs} { width: 1px }`, i = 1;
  for (const [a, [r, f]] of Pu.entries())
    n += ` html.${r} .${hs}, .${f} .${hs} { width: ${++i}px }`, $u.set(i, a);
  t.textContent = n, t.id = Tu, document.head.appendChild(t);
});
const vm = /* @__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, r = bl({
      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
    }), f = /* @__PURE__ */ new Map(), u = fe(i.layout), c = fe(), { observeResize: p, unobserveResize: y } = pm(), b = pp();
    b.on("resizeEvent", v), b.on("dragEvent", C), Xu(() => {
      a("layout-before-mount", u.value);
    }), In(() => {
      a("layout-mounted", u.value), zn(() => {
        zp(u.value), r.originalLayout = u.value, zn(() => {
          J(), c.value && p(c.value, mp(U, 16)), Hl(u.value, i.verticalCompact), a("layout-updated", u.value), F(), U();
        });
      });
    }), no(() => {
      b.clearAll(), c.value && y(c.value);
    });
    function v(A, Z, Y, $, j, ue) {
      M(A, Z, Y, $, j, ue);
    }
    function C(A, Z, Y, $, j, ue) {
      te(A, Z, Y, $, j, ue);
    }
    Fe(
      () => r.width,
      (A, Z) => {
        zn(() => {
          b.emit("updateWidth", A), Z === -1 && zn(() => {
            a("layout-ready", u.value);
          }), F();
        });
      }
    ), Fe(
      () => [i.layout, i.layout.length],
      () => {
        u.value = i.layout, Q();
      }
    ), Fe(
      () => i.colNum,
      (A) => {
        b.emit("setColNum", A);
      }
    ), Fe(
      () => i.rowHeight,
      (A) => {
        b.emit("setRowHeight", A);
      }
    ), Fe(
      () => i.isDraggable,
      (A) => {
        b.emit("setDraggable", A);
      }
    ), Fe(
      () => i.isResizable,
      (A) => {
        b.emit("setResizable", A);
      }
    ), Fe(
      () => i.isBounded,
      (A) => {
        b.emit("setBounded", A);
      }
    ), Fe(
      () => i.transformScale,
      (A) => {
        b.emit("setTransformScale", A);
      }
    ), Fe(
      () => i.responsive,
      (A) => {
        A || (a("update:layout", r.originalLayout), b.emit("setColNum", i.colNum)), U();
      }
    ), Fe(
      () => i.maxRows,
      (A) => {
        b.emit("setMaxRows", A);
      }
    ), Fe([() => i.margin, () => i.margin[1]], F), yl(
      Qc,
      bl({
        ...ir(i),
        ...ir(r),
        increaseItem: z,
        decreaseItem: T
      })
    ), yl(Jc, b), t({ state: r, getItem: q, resizeEvent: M, dragEvent: te, layoutUpdate: Q });
    function z(A) {
      f.set(A.i, A);
    }
    function T(A) {
      f.delete(A.i);
    }
    function q(A) {
      return f.get(A);
    }
    function Q() {
      if (!Tn(u.value) && !Tn(r.originalLayout)) {
        if (u.value.length !== r.originalLayout.length) {
          const A = K(u.value, r.originalLayout);
          if (A.length > 0)
            if (u.value.length > r.originalLayout.length)
              r.originalLayout = r.originalLayout.concat(A);
            else {
              const Z = new Set(A.map((Y) => Y.i));
              r.originalLayout = r.originalLayout.filter((Y) => !Z.has(Y.i));
            }
          r.lastLayoutLength = u.value.length, J();
        }
        Hl(u.value, i.verticalCompact), b.emit("updateWidth", r.width), F(), a("layout-updated", u.value);
      }
    }
    function F() {
      r.mergedStyle = {
        height: O()
      };
    }
    function U() {
      c.value && (r.width = c.value.offsetWidth), b.emit("resizeEvent");
    }
    function O() {
      if (!i.autoSize) return;
      const A = parseFloat(i.margin[1]);
      return yp(u.value) * (i.rowHeight + A) + A + "px";
    }
    let W;
    function te(A, Z, Y, $, j, ue) {
      let ie = ou(u.value, Z);
      Tn(ie) && (ie = { h: 0, w: 0, x: 0, y: 0, i: "" }), A === "dragstart" && !i.verticalCompact && (W = u.value.reduce(
        (Ee, { i: me, x: ge, y: le }) => ({
          ...Ee,
          [me]: { x: ge, y: le }
        }),
        {}
      )), A === "dragmove" || A === "dragstart" ? (r.placeholder.i = Z, r.placeholder.x = ie.x, r.placeholder.y = ie.y, r.placeholder.w = ue, r.placeholder.h = j, zn(() => {
        r.isDragging = !0;
      }), b.emit("updateWidth", r.width)) : zn(() => {
        r.isDragging = !1;
      }), u.value = qs(u.value, ie, Y, $, !0, i.preventCollision), i.restoreOnDrag ? (ie.static = !0, Hl(u.value, i.verticalCompact, W), ie.static = !1) : Hl(u.value, i.verticalCompact), b.emit("compact"), F(), A === "dragend" && (W = void 0, a("layout-updated", u.value));
    }
    function M(A, Z, Y, $, j, ue) {
      let ie = ou(u.value, Z);
      Tn(ie) && (ie = { h: 0, w: 0, x: 0, y: 0, i: "" });
      let Ee;
      if (i.preventCollision) {
        const me = ed(u.value, { ...ie, w: ue, h: j }).filter(
          (ge) => ge.i !== ie.i
        );
        if (Ee = me.length > 0, Ee) {
          let ge = 1 / 0, le = 1 / 0;
          me.forEach((ve) => {
            ve.x > ie.x && (ge = Math.min(ge, ve.x)), ve.y > ie.y && (le = Math.min(le, ve.y));
          }), Number.isFinite(ge) && (ie.w = ge - ie.x), Number.isFinite(le) && (ie.h = le - ie.y);
        }
      }
      Ee || (ie.w = ue, ie.h = j), A === "resizestart" || A === "resizemove" ? (r.placeholder.i = Z, r.placeholder.x = Y, r.placeholder.y = $, r.placeholder.w = ie.w, r.placeholder.h = ie.h, zn(() => {
        r.isDragging = !0;
      }), b.emit("updateWidth", r.width)) : A && zn(() => {
        r.isDragging = !1;
      }), i.responsive && G(), Hl(u.value, i.verticalCompact), b.emit("compact"), F(), A === "resizeend" && a("layout-updated", u.value);
    }
    function G() {
      const A = $p(i.breakpoints, r.width);
      if (A === r.lastBreakpoint)
        return;
      const Z = id(A, i.cols);
      !Tn(r.lastBreakpoint) && !r.layouts[r.lastBreakpoint] && (r.layouts[r.lastBreakpoint] = Ds(u.value));
      const Y = Ep(
        r.originalLayout,
        r.layouts,
        i.breakpoints,
        A,
        r.lastBreakpoint,
        Z,
        i.verticalCompact
      );
      r.layouts[A] = Y, r.lastBreakpoint !== A && a("breakpoint-changed", A, Y), u.value = Y, a("update:layout", Y), r.lastBreakpoint = A, b.emit("setColNum", Z);
    }
    function J() {
      r.layouts = Object.assign({}, i.responsiveLayouts);
    }
    function K(A, Z) {
      const Y = new Set(Z.map((ie) => ie.i)), $ = new Set(A.map((ie) => ie.i)), j = A.filter((ie) => !Y.has(ie.i)), ue = Z.filter((ie) => !$.has(ie.i));
      return j.concat(ue);
    }
    return (A, Z) => (E(), B("div", {
      ref_key: "wrapper",
      ref: c,
      class: "vgl-layout",
      style: He(r.mergedStyle)
    }, [
      A.$slots.default ? zi(A.$slots, "default", { key: 0 }) : (E(!0), B(Pe, { key: 1 }, Xe(u.value, (Y) => (E(), Ce(fu, Ed({
        key: Y.i,
        ref_for: !0
      }, Y), {
        default: R(() => [
          zi(A.$slots, "item", { item: Y })
        ]),
        _: 2
      }, 1040))), 128)),
      Qu(k(fu, {
        class: "vgl-item--placeholder",
        x: r.placeholder.x,
        y: r.placeholder.y,
        w: r.placeholder.w,
        h: r.placeholder.h,
        i: r.placeholder.i
      }, null, 8, ["x", "y", "w", "h", "i"]), [
        [Ju, r.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 hd = Symbol("panelEditor");
function ym(e) {
  yl(hd, e);
}
function ao() {
  const e = vl(hd);
  if (!e)
    throw new Error("usePanelEditor must be used within a PanelEditorProvider");
  return e;
}
function bm(e, t, { signal: n, edges: i } = {}) {
  let a, r = null;
  const f = i != null && i.includes("leading"), u = i == null || i.includes("trailing"), c = () => {
    r !== null && (e.apply(a, r), a = void 0, r = null);
  }, p = () => {
    u && c(), C();
  };
  let y = null;
  const b = () => {
    y != null && clearTimeout(y), y = setTimeout(() => {
      y = null, p();
    }, t);
  }, v = () => {
    y !== null && (clearTimeout(y), y = null);
  }, C = () => {
    v(), a = void 0, r = null;
  }, z = () => {
    c();
  }, T = function(...q) {
    if (n?.aborted)
      return;
    a = this, r = q;
    const Q = y == null;
    b(), f && Q && c();
  };
  return T.schedule = b, T.cancel = C, T.flush = z, n?.addEventListener("abort", C, { once: !0 }), T;
}
function xm() {
}
function Zn(e, t, n) {
  return n == null ? Math.min(e, t) : Math.min(Math.max(e, t), n);
}
function Eu(e) {
  return Object.getOwnPropertySymbols(e).filter((t) => Object.prototype.propertyIsEnumerable.call(e, t));
}
function Iu(e) {
  return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
}
const wm = "[object RegExp]", Sm = "[object String]", km = "[object Number]", Cm = "[object Boolean]", Au = "[object Arguments]", _m = "[object Symbol]", zm = "[object Date]", Mm = "[object Map]", Tm = "[object Set]", Pm = "[object Array]", $m = "[object Function]", Em = "[object ArrayBuffer]", gs = "[object Object]", Im = "[object Error]", Am = "[object DataView]", Om = "[object Uint8Array]", Dm = "[object Uint8ClampedArray]", qm = "[object Uint16Array]", Lm = "[object Uint32Array]", Rm = "[object BigUint64Array]", Nm = "[object Int8Array]", Vm = "[object Int16Array]", Fm = "[object Int32Array]", Bm = "[object BigInt64Array]", Hm = "[object Float32Array]", Wm = "[object Float64Array]";
function Ou(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 jm(e, t) {
  return e === t || Number.isNaN(e) && Number.isNaN(t);
}
function Gm(e, t, n) {
  return Eo(e, t, void 0, void 0, void 0, void 0, n);
}
function Eo(e, t, n, i, a, r, f) {
  const u = f(e, t, n, i, a, r);
  if (u !== void 0)
    return u;
  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 Lo(e, t, r, f);
    }
  return Lo(e, t, r, f);
}
function Lo(e, t, n, i) {
  if (Object.is(e, t))
    return !0;
  let a = Iu(e), r = Iu(t);
  if (a === Au && (a = gs), r === Au && (r = gs), a !== r)
    return !1;
  switch (a) {
    case Sm:
      return e.toString() === t.toString();
    case km: {
      const c = e.valueOf(), p = t.valueOf();
      return jm(c, p);
    }
    case Cm:
    case zm:
    case _m:
      return Object.is(e.valueOf(), t.valueOf());
    case wm:
      return e.source === t.source && e.flags === t.flags;
    case $m:
      return e === t;
  }
  n = n ?? /* @__PURE__ */ new Map();
  const f = n.get(e), u = n.get(t);
  if (f != null && u != null)
    return f === t;
  n.set(e, t), n.set(t, e);
  try {
    switch (a) {
      case Mm: {
        if (e.size !== t.size)
          return !1;
        for (const [c, p] of e.entries())
          if (!t.has(c) || !Eo(p, t.get(c), c, e, t, n, i))
            return !1;
        return !0;
      }
      case Tm: {
        if (e.size !== t.size)
          return !1;
        const c = Array.from(e.values()), p = Array.from(t.values());
        for (let y = 0; y < c.length; y++) {
          const b = c[y], v = p.findIndex((C) => Eo(b, C, void 0, e, t, n, i));
          if (v === -1)
            return !1;
          p.splice(v, 1);
        }
        return !0;
      }
      case Pm:
      case Om:
      case Dm:
      case qm:
      case Lm:
      case Rm:
      case Nm:
      case Vm:
      case Fm:
      case Bm:
      case Hm:
      case Wm: {
        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 (!Eo(e[c], t[c], c, e, t, n, i))
            return !1;
        return !0;
      }
      case Em:
        return e.byteLength !== t.byteLength ? !1 : Lo(new Uint8Array(e), new Uint8Array(t), n, i);
      case Am:
        return e.byteLength !== t.byteLength || e.byteOffset !== t.byteOffset ? !1 : Lo(new Uint8Array(e), new Uint8Array(t), n, i);
      case Im:
        return e.name === t.name && e.message === t.message;
      case gs: {
        if (!(Lo(e.constructor, t.constructor, n, i) || Ou(e) && Ou(t)))
          return !1;
        const c = [...Object.keys(e), ...Eu(e)], p = [...Object.keys(t), ...Eu(t)];
        if (c.length !== p.length)
          return !1;
        for (let y = 0; y < c.length; y++) {
          const b = c[y], v = e[b];
          if (!Object.hasOwn(t, b))
            return !1;
          const C = t[b];
          if (!Eo(v, C, b, e, t, n, i))
            return !1;
        }
        return !0;
      }
      default:
        return !1;
    }
  } finally {
    n.delete(e), n.delete(t);
  }
}
function Ym(e, t) {
  return Gm(e, t, xm);
}
const Um = "_splitView_pzp7c_6", Km = "_sashContainer_pzp7c_13", Xm = "_sash_pzp7c_13", Qm = "_splitViewContainer_pzp7c_24", Jm = "_splitViewView_pzp7c_31", Zm = "_vertical_pzp7c_37", ev = "_horizontal_pzp7c_41", tv = "_separatorBorder_pzp7c_45", Wi = {
  splitView: Um,
  sashContainer: Km,
  sash: Xm,
  splitViewContainer: Qm,
  splitViewView: Jm,
  vertical: Zm,
  horizontal: ev,
  separatorBorder: tv
};
let gd = !1, pd = !1, Co;
typeof navigator == "object" && (Co = navigator.userAgent, pd = Co.includes("Macintosh"), gd = (Co.includes("Macintosh") || Co.includes("iPad") || Co.includes("iPhone")) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
const md = gd, nv = pd;
class iv {
  _size;
  getSize() {
    return this._size;
  }
  setSize(t) {
    this._size = t;
  }
}
function ha(e, t) {
  const n = e.length, i = n - t.length;
  return i >= 0 && e.slice(i, n) === t;
}
function lv(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Du = { exports: {} }, qu;
function ov() {
  return qu || (qu = 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, p, y) {
      this.fn = c, this.context = p, this.once = y || !1;
    }
    function r(c, p, y, b, v) {
      if (typeof y != "function")
        throw new TypeError("The listener must be a function");
      var C = new a(y, b || c, v), z = n ? n + p : p;
      return c._events[z] ? c._events[z].fn ? c._events[z] = [c._events[z], C] : c._events[z].push(C) : (c._events[z] = C, c._eventsCount++), c;
    }
    function f(c, p) {
      --c._eventsCount === 0 ? c._events = new i() : delete c._events[p];
    }
    function u() {
      this._events = new i(), this._eventsCount = 0;
    }
    u.prototype.eventNames = function() {
      var c = [], p, y;
      if (this._eventsCount === 0) return c;
      for (y in p = this._events)
        t.call(p, y) && c.push(n ? y.slice(1) : y);
      return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(p)) : c;
    }, u.prototype.listeners = function(c) {
      var p = n ? n + c : c, y = this._events[p];
      if (!y) return [];
      if (y.fn) return [y.fn];
      for (var b = 0, v = y.length, C = new Array(v); b < v; b++)
        C[b] = y[b].fn;
      return C;
    }, u.prototype.listenerCount = function(c) {
      var p = n ? n + c : c, y = this._events[p];
      return y ? y.fn ? 1 : y.length : 0;
    }, u.prototype.emit = function(c, p, y, b, v, C) {
      var z = n ? n + c : c;
      if (!this._events[z]) return !1;
      var T = this._events[z], q = arguments.length, Q, F;
      if (T.fn) {
        switch (T.once && this.removeListener(c, T.fn, void 0, !0), q) {
          case 1:
            return T.fn.call(T.context), !0;
          case 2:
            return T.fn.call(T.context, p), !0;
          case 3:
            return T.fn.call(T.context, p, y), !0;
          case 4:
            return T.fn.call(T.context, p, y, b), !0;
          case 5:
            return T.fn.call(T.context, p, y, b, v), !0;
          case 6:
            return T.fn.call(T.context, p, y, b, v, C), !0;
        }
        for (F = 1, Q = new Array(q - 1); F < q; F++)
          Q[F - 1] = arguments[F];
        T.fn.apply(T.context, Q);
      } else {
        var U = T.length, O;
        for (F = 0; F < U; F++)
          switch (T[F].once && this.removeListener(c, T[F].fn, void 0, !0), q) {
            case 1:
              T[F].fn.call(T[F].context);
              break;
            case 2:
              T[F].fn.call(T[F].context, p);
              break;
            case 3:
              T[F].fn.call(T[F].context, p, y);
              break;
            case 4:
              T[F].fn.call(T[F].context, p, y, b);
              break;
            default:
              if (!Q) for (O = 1, Q = new Array(q - 1); O < q; O++)
                Q[O - 1] = arguments[O];
              T[F].fn.apply(T[F].context, Q);
          }
      }
      return !0;
    }, u.prototype.on = function(c, p, y) {
      return r(this, c, p, y, !1);
    }, u.prototype.once = function(c, p, y) {
      return r(this, c, p, y, !0);
    }, u.prototype.removeListener = function(c, p, y, b) {
      var v = n ? n + c : c;
      if (!this._events[v]) return this;
      if (!p)
        return f(this, v), this;
      var C = this._events[v];
      if (C.fn)
        C.fn === p && (!b || C.once) && (!y || C.context === y) && f(this, v);
      else {
        for (var z = 0, T = [], q = C.length; z < q; z++)
          (C[z].fn !== p || b && !C[z].once || y && C[z].context !== y) && T.push(C[z]);
        T.length ? this._events[v] = T.length === 1 ? T[0] : T : f(this, v);
      }
      return this;
    }, u.prototype.removeAllListeners = function(c) {
      var p;
      return c ? (p = n ? n + c : c, this._events[p] && f(this, p)) : (this._events = new i(), this._eventsCount = 0), this;
    }, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u.prefixed = n, u.EventEmitter = u, e.exports = u;
  })(Du)), Du.exports;
}
var av = ov();
const tr = /* @__PURE__ */ lv(av);
function Lu(e, t) {
  const n = e.indexOf(t);
  n !== -1 && (e.splice(n, 1), e.unshift(t));
}
function ps(e, t) {
  const n = e.indexOf(t);
  n !== -1 && (e.splice(n, 1), e.push(t));
}
function Rn(e, t, n = 1) {
  const i = Math.max(0, Math.ceil((t - e) / n)), a = Array.from({ length: i });
  let r = -1;
  for (; ++r < i; )
    a[r] = e + r * n;
  return a;
}
const sv = "_sash_j5cmb_7", rv = "_disabled_j5cmb_15", uv = "_mac_j5cmb_19", cv = "_vertical_j5cmb_19", dv = "_minimum_j5cmb_23", fv = "_maximum_j5cmb_27", hv = "_horizontal_j5cmb_31", gv = "_hover_j5cmb_126", pv = "_active_j5cmb_127", mn = {
  sash: sv,
  disabled: rv,
  mac: uv,
  vertical: cv,
  minimum: dv,
  maximum: fv,
  horizontal: hv,
  hover: gv,
  active: pv
};
var ti = /* @__PURE__ */ ((e) => (e[e.Vertical = 0] = "Vertical", e[e.Horizontal = 1] = "Horizontal", e))(ti || {}), fl = /* @__PURE__ */ ((e) => (e[e.Disabled = 0] = "Disabled", e[e.Minimum = 1] = "Minimum", e[e.Maximum = 2] = "Maximum", e[e.Enabled = 3] = "Enabled", e))(fl || {});
let vd = md ? 20 : 8;
const yd = new tr();
function mv(e) {
  vd = e, yd.emit("onDidChangeGlobalSize", e);
}
class Ru extends tr {
  el;
  layoutProvider;
  orientation;
  size;
  hoverDelay = 300;
  hoverDelayerFunc = (t) => t.classList.add("sash-hover", mn.hover);
  hoverDelayer = bm(
    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(
      mn.disabled,
      t === 0
      /* Disabled */
    ), this.el.classList.toggle(
      "sash-disabled",
      t === 0
      /* Disabled */
    ), this.el.classList.toggle(
      mn.minimum,
      t === 1
      /* Minimum */
    ), this.el.classList.toggle(
      "sash-minimum",
      t === 1
      /* Minimum */
    ), this.el.classList.toggle(
      mn.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", mn.sash), this.el.dataset.testid = "sash", t.append(this.el), nv && this.el.classList.add("sash-mac", mn.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 = vd, yd.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", mn.horizontal), this.el.classList.remove("sash-vertical", mn.vertical)) : (this.el.classList.remove("sash-horizontal", mn.horizontal), this.el.classList.add("sash-vertical", mn.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", mn.active), this.emit("start", a), this.el.setPointerCapture(t.pointerId);
    const r = (u) => {
      u.preventDefault();
      const c = {
        startX: n,
        currentX: u.pageX,
        startY: i,
        currentY: u.pageY
      };
      this.emit("change", c);
    }, f = (u) => {
      u.preventDefault(), this.el.classList.remove("sash-active", mn.active), this.hoverDelayer.cancel(), this.emit("end"), this.el.releasePointerCapture(u.pointerId), globalThis.removeEventListener("pointermove", r), globalThis.removeEventListener("pointerup", f);
    };
    globalThis.addEventListener("pointermove", r), globalThis.addEventListener("pointerup", f);
  };
  onPointerDoublePress = () => {
    this.emit("reset");
  };
  onMouseEnter = () => {
    this.el.classList.contains(mn.active) ? (this.hoverDelayer.cancel(), this.el.classList.add("sash-hover", mn.hover)) : this.hoverDelayer(this.el);
  };
  onMouseLeave = () => {
    this.hoverDelayer.cancel(), this.el.classList.remove("sash-hover", mn.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 bd = {
  /**
   * 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 Ta = /* @__PURE__ */ ((e) => (e[e.Normal = 0] = "Normal", e[e.Low = 1] = "Low", e[e.High = 2] = "High", e))(Ta || {});
class xd {
  container;
  view;
  _size;
  _cachedVisibleSize = void 0;
  constructor(t, n, i) {
    this.container = t, this.view = n, this.container.classList.add("split-view-view", Wi.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 = Zn(
      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 vv extends xd {
  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 yv extends xd {
  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 bv extends tr {
  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, r) {
    if (super(), this._orientation = n.orientation ?? ti.Vertical, this._proportionalLayout = n.proportionalLayout ?? !0, this.getSashOrthogonalSize = n.getSashOrthogonalSize, i && (this.onDidChange = i), a && (this.onDidDragStart = a), r && (this.onDidDragEnd = r), this.sashContainer = document.createElement("div"), this.sashContainer.classList.add("sash-container", Wi.sashContainer), t.prepend(this.sashContainer), n.descriptor) {
      this.size = n.descriptor.size;
      for (const [f, u] of n.descriptor.views.entries()) {
        const c = u.size, p = u.container, y = u.view;
        this.addView(p, y, c, f, !0);
      }
      this.contentSize = this.viewItems.reduce((f, u) => f + u.size, 0), this.saveProportions();
    }
  }
  addView(t, n, i, a = this.viewItems.length, r) {
    let f;
    typeof i == "number" ? f = i : i.type === "split" ? f = this.getViewSize(i.index) / 2 : i.type === "invisible" ? f = { cachedVisibleSize: i.cachedVisibleSize } : f = n.minimumSize;
    const u = this.orientation === ti.Vertical ? new vv(t, n, f) : new yv(t, n, f);
    if (this.viewItems.splice(a, 0, u), this.viewItems.length > 1) {
      const c = this.orientation === ti.Vertical ? new Ru(
        this.sashContainer,
        {
          getHorizontalSashTop: (b) => this.getSashPosition(b),
          getHorizontalSashWidth: this.getSashOrthogonalSize
        },
        { orientation: ti.Horizontal }
      ) : new Ru(
        this.sashContainer,
        {
          getVerticalSashLeft: (b) => this.getSashPosition(b),
          getVerticalSashHeight: this.getSashOrthogonalSize
        },
        { orientation: ti.Vertical }
      ), p = this.orientation === ti.Vertical ? (b) => ({
        sash: c,
        start: b.startY,
        current: b.currentY
      }) : (b) => ({
        sash: c,
        start: b.startX,
        current: b.currentX
      });
      c.on("start", (b) => {
        this.emit("sashDragStart"), this.onSashStart(p(b));
        const v = this.viewItems.map((C) => C.size);
        this.onDidDragStart?.(v);
      }), c.on("change", (b) => this.onSashChange(p(b))), c.on("end", () => {
        this.emit("sashDragEnd");
        let b = this.sashItems.findIndex((C) => C.sash === c);
        if (b === -1) {
          const C = c.el;
          C && (b = this.sashItems.findIndex((z) => z.sash.el === C));
        }
        this.onSashEnd(b);
        const v = this.viewItems.map((C) => C.size);
        this.onDidDragEnd?.(v);
      }), c.on("reset", () => {
        let b = this.sashItems.findIndex((q) => q.sash === c);
        if (b === -1) {
          const q = c.el;
          q && (b = this.sashItems.findIndex((Q) => Q.sash.el === q));
        }
        const v = Rn(b, -1, -1), C = Rn(b + 1, this.viewItems.length), z = this.findFirstSnapIndex(v), T = this.findFirstSnapIndex(C);
        typeof z == "number" && !this.viewItems[z].visible || typeof T == "number" && !this.viewItems[T].visible || this.emit("sashreset", b);
      });
      const y = { sash: c };
      this.sashItems.splice(a - 1, 0, y);
    }
    r || this.relayout(), !r && 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), r = a === void 0 ? this.getViewSize(n) : bd.Invisible(a), f = this.removeView(n);
    this.addView(t, f, r, 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 = Zn(
          Math.round(this.proportions[i] * t),
          a.minimumSize,
          a.maximumSize
        ));
      }
    else {
      const i = Rn(0, this.viewItems.length), a = i.filter(
        (f) => this.viewItems[f] && this.viewItems[f].priority === 1
        /* Low */
      ), r = i.filter(
        (f) => this.viewItems[f] && this.viewItems[f].priority === 2
        /* High */
      );
      this.resize(
        this.viewItems.length - 1,
        t - n,
        void 0,
        a,
        r
      );
    }
    this.distributeEmptySpace(), this.layoutViews();
  }
  resizeView(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      return;
    const i = Rn(0, this.viewItems.length).filter((u) => u !== t), a = [
      ...i.filter(
        (u) => this.viewItems[u].priority === 1
        /* Low */
      ),
      t
    ], r = i.filter(
      (u) => this.viewItems[u].priority === 2
      /* High */
    ), f = this.viewItems[t];
    n = Math.round(n), n = Zn(n, f.minimumSize, Math.min(f.maximumSize, this.size)), f.size = n, this.relayout(a, r);
  }
  resizeViews(t) {
    for (let [n, i] of t.entries()) {
      const a = this.viewItems[n];
      i = Math.round(i), i = Zn(
        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 u of this.viewItems)
      u.maximumSize - u.minimumSize > 0 && (t.push(u), n += u.size);
    const i = Math.floor(n / t.length);
    for (const u of t)
      u.size = Zn(i, u.minimumSize, u.maximumSize);
    const a = Rn(0, this.viewItems.length), r = a.filter(
      (u) => this.viewItems[u].priority === 1
      /* Low */
    ), f = a.filter(
      (u) => this.viewItems[u].priority === 2
      /* High */
    );
    this.relayout(r, f);
  }
  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((z) => z.sash === t);
    if (a === -1) {
      const z = t.el;
      z && (a = this.sashItems.findIndex((T) => T.sash.el === z));
    }
    const r = this.viewItems.map((z) => z.size), f = Rn(a, -1, -1), u = Rn(a + 1, this.viewItems.length), c = this.getMinDelta(f, u, r), p = this.getMaxDelta(f, u, r);
    let y, b;
    const v = this.findFirstSnapIndex(f), C = this.findFirstSnapIndex(u);
    if (typeof v == "number") {
      const z = this.viewItems[v], T = Math.floor(z.minimumSize / 2);
      y = {
        index: v,
        limitDelta: z.visible ? c - T : c + T,
        size: z.size
      };
    }
    if (typeof C == "number") {
      const z = this.viewItems[C], T = Math.floor(z.minimumSize / 2);
      b = {
        index: C,
        limitDelta: z.visible ? p + T : p - T,
        size: z.size
      };
    }
    this.sashDragState = {
      index: a,
      start: n,
      current: i,
      sizes: r,
      minDelta: c,
      maxDelta: p,
      snapBefore: y,
      snapAfter: b
    };
  }
  onSashChange({ current: t }) {
    const { index: n, start: i, sizes: a, minDelta: r, maxDelta: f, snapBefore: u, snapAfter: c } = this.sashDragState, p = t - i;
    this.resize(n, p, a, void 0, void 0, r, f, u, 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(
      (f, u) => f + (this.viewItems[u].minimumSize - i[u]),
      0
    ), r = n.reduce(
      (f, u) => f + (i[u] - this.viewItems[u].maximumSize),
      0
    );
    return Math.max(a, r);
  }
  getMaxDelta(t, n, i) {
    const a = t.reduce(
      (f, u) => f + (this.viewItems[u].maximumSize - i[u]),
      0
    ), r = n.reduce(
      (f, u) => f + (i[u] - this.viewItems[u].minimumSize),
      0
    );
    return Math.min(r, a);
  }
  resize(t, n, i, a, r, f = Number.NEGATIVE_INFINITY, u = Number.POSITIVE_INFINITY, c, p) {
    if (t < 0 || t >= this.viewItems.length || this.viewItems.length === 0)
      return 0;
    const y = Rn(t, -1, -1), b = Rn(t + 1, this.viewItems.length);
    if (r)
      for (const G of r)
        Lu(y, G), Lu(b, G);
    if (a)
      for (const G of a)
        ps(y, G), ps(b, G);
    const v = i ?? this.viewItems.map((G) => G?.size || 0), C = y.map((G) => this.viewItems[G]), z = y.map((G) => v[G]), T = b.map((G) => this.viewItems[G]), q = b.map((G) => v[G]), Q = y.reduce(
      (G, J) => G + (this.viewItems[J].minimumSize - v[J]),
      0
    ), F = y.reduce(
      (G, J) => G + (this.viewItems[J].maximumSize - v[J]),
      0
    ), U = b.length === 0 ? Number.POSITIVE_INFINITY : b.reduce(
      (G, J) => G + (v[J] - this.viewItems[J].minimumSize),
      0
    ), O = b.length === 0 ? Number.NEGATIVE_INFINITY : b.reduce(
      (G, J) => G + (v[J] - this.viewItems[J].maximumSize),
      0
    ), W = Math.max(Q, O, f), te = Math.min(U, F, u);
    let M = !1;
    if (c) {
      const G = this.viewItems[c.index], J = n >= c.limitDelta;
      M = J !== G.visible, G.setVisible(J, c.size);
    }
    if (!M && p) {
      const G = this.viewItems[p.index], J = n < p.limitDelta;
      M = J !== G.visible, G.setVisible(J, p.size);
    }
    if (M)
      return this.resize(
        t,
        n,
        i,
        a,
        r,
        f,
        u
      );
    n = Zn(n, W, te);
    for (let G = 0, J = n; G < C.length; G++) {
      const K = C[G];
      if (!K)
        continue;
      const A = Zn(
        z[G] + J,
        K.minimumSize,
        K.maximumSize
      ), Z = A - z[G];
      J -= Z, K.size = A;
    }
    for (let G = 0, J = n; G < T.length; G++) {
      const K = T[G];
      if (!K)
        continue;
      const A = Zn(
        q[G] - J,
        K.minimumSize,
        K.maximumSize
      ), Z = A - q[G];
      J += Z, K.size = A;
    }
    return n;
  }
  distributeEmptySpace(t) {
    if (this.viewItems.length === 0)
      return;
    const n = this.viewItems.reduce((p, y) => p + y.size, 0);
    let i = this.size - n;
    const a = Rn(0, this.viewItems.length), r = [], f = a.filter(
      (p) => this.viewItems[p].priority === 1
      /* Low */
    ), u = a.filter(
      (p) => this.viewItems[p].priority === 0
      /* Normal */
    ), c = a.filter(
      (p) => this.viewItems[p].priority === 2
      /* High */
    );
    r.push(
      ...c,
      ...u,
      ...f
    ), typeof t == "number" && ps(r, t);
    for (let p = 0; i !== 0 && p < r.length; p++) {
      const y = this.viewItems[r[p]];
      if (!y)
        continue;
      const b = Zn(
        y.size + i,
        y.minimumSize,
        y.maximumSize
      ), v = b - y.size;
      i -= v, y.size = b;
    }
    this.contentSize = this.viewItems.reduce((p, y) => p + 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, r) => a + r.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 r = 0; r < this.sashItems.length; r++)
          if ((this.sashItems[r].sash.el || this.sashItems[r].sash) === a) {
            n = r;
            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 r = a.map((c) => t = c.size - c.minimumSize > 0 || t).toReversed();
    t = !1;
    const f = a.map((c) => t = c.maximumSize - c.size > 0 || t).toReversed();
    let u = 0;
    for (let c = 0; c < this.sashItems.length; c++) {
      const { sash: p } = this.sashItems[c], y = this.viewItems[c];
      u += y.size;
      const b = !(n[c] && f[c + 1]), v = !(i[c] && r[c + 1]);
      if (b && v) {
        const C = Rn(c, -1, -1), z = Rn(c + 1, this.viewItems.length), T = this.findFirstSnapIndex(C), q = this.findFirstSnapIndex(z), Q = typeof T == "number" && !this.viewItems[T].visible, F = typeof q == "number" && !this.viewItems[q].visible;
        Q && r[c] && (u > 0 || this.startSnappingEnabled) ? p.state = fl.Minimum : F && n[c] && (u < this.contentSize || this.endSnappingEnabled) ? p.state = fl.Maximum : p.state = fl.Disabled;
      } else b && !v ? p.state = fl.Minimum : !b && v ? p.state = fl.Maximum : p.state = fl.Enabled;
    }
  }
}
class Nl {
  size;
  constructor(t) {
    this.size = t;
  }
  getPreferredSize() {
    return this.size;
  }
}
class Nu {
  proportion;
  layoutService;
  constructor(t, n) {
    this.proportion = t, this.layoutService = n;
  }
  getPreferredSize() {
    return this.proportion * this.layoutService.getSize();
  }
}
class ga {
  getPreferredSize() {
  }
}
class Vu {
  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 Nl(t);
    else if (typeof t == "string") {
      const n = t.trim();
      if (ha(n, "%")) {
        const i = Number(n.slice(0, -1)) / 100;
        this.layoutStrategy = new Nu(
          i,
          this.layoutService
        );
      } else if (ha(n, "px")) {
        const i = Number(n.slice(0, -2));
        this.layoutStrategy = new Nl(i);
      } else if (typeof Number.parseFloat(n) == "number") {
        const i = Number.parseFloat(n);
        this.layoutStrategy = new Nl(i);
      } else
        this.layoutStrategy = new ga();
    } else
      this.layoutStrategy = new ga();
  }
  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 Nl(n.preferredSize);
    else if (typeof n.preferredSize == "string") {
      const i = n.preferredSize.trim();
      if (ha(i, "%")) {
        const a = Number(i.slice(0, -1)) / 100;
        this.layoutStrategy = new Nu(
          a,
          this.layoutService
        );
      } else if (ha(i, "px")) {
        const a = Number(i.slice(0, -2));
        this.layoutStrategy = new Nl(a);
      } else if (typeof Number.parseFloat(i) == "number") {
        const a = Number.parseFloat(i);
        this.layoutStrategy = new Nl(a);
      } else
        this.layoutStrategy = new ga();
    } else
      this.layoutStrategy = new ga();
    this.priority = n.priority ?? Ta.Normal;
  }
  layout(t) {
  }
}
function xv(e) {
  const t = Zn(e, 4, 20), n = Zn(e, 1, 8);
  document.documentElement.style.setProperty("--sash-size", `${t}px`), document.documentElement.style.setProperty(
    "--sash-hover-size",
    `${n}px`
  ), mv(t);
}
const wv = ["id"], Sv = /* @__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, r = fe(), f = fe(), u = fe(!1), c = fe(null), p = bl(/* @__PURE__ */ new Map()), y = bl(/* @__PURE__ */ new Map()), b = fe(new iv()), v = fe([]), C = fe([]), z = fe(null), T = Ad();
    yl("allotment", {
      registerPane: (M, G, J) => {
        p.set(M, G), y.set(M, J), u.value && zn(() => {
          W();
        });
      },
      unregisterPane: (M) => {
        p.delete(M), y.delete(M);
      },
      registerNonPane: (M, G) => {
        p.set(M, G), y.set(M, {});
      }
    });
    const q = re(() => {
      const M = T.default?.({}) || [], G = (J) => {
        const K = [];
        for (const A of J)
          Array.isArray(A.children) ? K.push(...G(A.children)) : A.type && K.push(A);
        return K;
      };
      return G(M);
    });
    function Q(M) {
      const G = v.value?.[M];
      return typeof G?.preferredSize != "number" ? !1 : (c.value?.resizeView(M, Math.round(G.preferredSize)), !0);
    }
    function F() {
      if (a("reset"), !!c.value) {
        c.value.distributeViewSizes();
        for (let M = 0; M < v.value.length; M++)
          Q(M);
      }
    }
    function U(M) {
      c.value?.resizeViews(M);
    }
    t({
      reset: F,
      resize: U
    });
    function O() {
      if (!r.value)
        return;
      let M = !0;
      i.defaultSizes && p.size !== i.defaultSizes.length && (M = !1, console.warn(
        `Expected ${i.defaultSizes.length} children based on defaultSizes but found ${p.size}`
      ));
      const G = i.vertical ? r.value.clientHeight : r.value.clientWidth;
      b.value.setSize(G);
      let J = i.defaultSizes;
      if (!i.defaultSizes && p.size > 0) {
        const A = Math.floor(G / p.size);
        J = Array.from({ length: p.size }, () => A), J[J.length - 1] += G - A * p.size, M = !0, C.value = q.value.map(
          (Z) => Z.key
        );
      } else if (i.defaultSizes) {
        const A = i.defaultSizes.reduce((Z, Y) => Z + Y, 0);
        if (G > 0 && A > 0 && Math.abs(G - A) > 1) {
          const Z = G / A;
          J = i.defaultSizes.map((Y) => Math.round(Y * Z));
        }
        C.value = q.value.map(
          (Z) => Z.key
        );
      }
      v.value = [];
      const K = {
        orientation: i.vertical ? ti.Vertical : ti.Horizontal,
        proportionalLayout: i.proportionalLayout,
        ...M && J && {
          descriptor: {
            size: J.reduce((A, Z) => A + Z, 0),
            views: J.map((A, Z) => {
              const Y = [...p.keys()][Z], $ = y.get(Y), j = new Vu(b.value, {
                element: document.createElement("div"),
                minimumSize: $?.minSize ?? i.minSize,
                maximumSize: $?.maxSize ?? i.maxSize,
                priority: $?.priority ?? Ta.Normal,
                ...$?.preferredSize && {
                  preferredSize: $?.preferredSize
                },
                snap: $?.snap ?? i.snap
              });
              return v.value.push(j), {
                container: [...p.values()][Z],
                size: A,
                view: j
              };
            })
          }
        }
      };
      if (c.value = new bv(
        r.value,
        K,
        (A) => a("change", A),
        (A) => a("dragStart", A),
        (A) => a("dragEnd", A)
      ), c.value.on("sashDragStart", () => {
        r.value?.classList.add("split-view-sash-dragging");
      }), c.value.on("sashDragEnd", () => {
        r.value?.classList.remove("split-view-sash-dragging");
      }), c.value.on("sashchange", (A) => {
        if (c.value) {
          const Z = q.value.map((Y) => Y.key);
          for (const [Y, $] of Z.entries()) {
            const j = y.get($);
            j?.visible !== void 0 && j.visible !== c.value.isViewVisible(Y) && a("visibleChange", Y, c.value.isViewVisible(Y));
          }
        }
      }), c.value?.on("sashreset", (A) => {
        a("reset"), !Q(A) && (Q(A + 1) || c.value?.distributeViewSizes());
      }), G > 0) {
        c.value.layout(G);
        for (let A = 0; A < v.value.length; A++)
          Q(A);
      }
    }
    function W() {
      if (!u.value || !c.value)
        return;
      const M = q.value.map((Z) => Z.key), G = [...C.value], J = M.filter((Z) => !C.value.includes(Z)), K = M.filter((Z) => C.value.includes(Z)), A = C.value.map((Z, Y) => ({ key: Z, index: Y, shouldExit: !M.includes(Z) }));
      for (let Z = A.length - 1; Z >= 0; Z--)
        A[Z].shouldExit && (c.value.removeView(A[Z].index), G.splice(A[Z].index, 1), v.value.splice(A[Z].index, 1));
      for (const Z of J) {
        const Y = y.get(Z), $ = new Vu(b.value, {
          element: document.createElement("div"),
          minimumSize: Y?.minSize ?? i.minSize,
          maximumSize: Y?.maxSize ?? i.maxSize,
          priority: Y?.priority ?? Ta.Normal,
          ...Y?.preferredSize && {
            preferredSize: Y?.preferredSize
          },
          snap: Y?.snap ?? i.snap
        }), j = M.indexOf(Z);
        c.value.addView(
          p.get(Z),
          $,
          bd.Distribute,
          j
        ), G.splice(j, 0, Z), v.value.splice(j, 0, $);
      }
      for (; !Ym(M, G); )
        for (const [Z, Y] of M.entries()) {
          const $ = G.indexOf(Y);
          if ($ !== Z) {
            c.value.moveView(
              p.get(Y),
              $,
              Z
            );
            const j = G[$];
            G.splice($, 1), G.splice(Z, 0, j);
            const ue = v.value[$];
            v.value.splice($, 1), v.value.splice(Z, 0, ue);
            break;
          }
        }
      for (const Z of [...J, ...K]) {
        const Y = y.get(Z), $ = M.indexOf(Z);
        if (Y) {
          Y.visible !== void 0 && c.value.isViewVisible($) !== Y.visible && c.value.setViewVisible($, Y.visible), Y.preferredSize !== void 0 && v.value[$].preferredSize !== Y.preferredSize && (v.value[$].preferredSize = Y.preferredSize, Q($));
          let j = !1;
          Y.minSize !== void 0 && v.value[$].minimumSize !== Y.minSize && (v.value[$].minimumSize = Y.minSize, j = !0), Y.maxSize !== void 0 && v.value[$].maximumSize !== Y.maxSize && (v.value[$].maximumSize = Y.maxSize, j = !0), j && c.value.layout();
        }
      }
      (J.length > 0 || A.some((Z) => Z.shouldExit)) && (C.value = M);
    }
    function te() {
      r.value && (z.value = new ResizeObserver(() => {
        if (r.value) {
          const M = i.vertical ? r.value.clientHeight : r.value.clientWidth;
          M > 0 && (c.value?.layout(M), b.value.setSize(M), u.value || (u.value = !0));
        }
      }), z.value.observe(r.value));
    }
    return In(() => {
      md && xv(20), zn(() => {
        O(), te(), setTimeout(() => {
          if (r.value && c.value) {
            const M = i.vertical ? r.value.clientHeight : r.value.clientWidth;
            M > 0 && c.value.layout(M);
          }
        }, 50);
      });
    }), Fe(q, () => {
      zn(() => {
        W();
      });
    }, { deep: !0 }), Fe(() => i.vertical, (M) => {
      c.value && (c.value.orientation = M ? ti.Vertical : ti.Horizontal, c.value.layout());
    }), Fe(() => i.proportionalLayout, (M) => {
      c.value && (c.value.proportionalLayout = M);
    }), Ui(() => {
      z.value?.disconnect(), c.value?.dispose();
    }), (M, G) => (E(), B("div", {
      id: M.id,
      ref_key: "containerRef",
      ref: r,
      class: Ae(["split-view", [
        M.vertical ? "split-view-vertical" : "split-view-horizontal",
        { "split-view-separator-border": M.separator },
        d(Wi).splitView,
        M.vertical ? d(Wi).vertical : d(Wi).horizontal,
        { [d(Wi).separatorBorder]: M.separator },
        M.className
      ]])
    }, [
      m("div", {
        ref_key: "splitViewContainerRef",
        ref: f,
        class: Ae(["split-view-container", [d(Wi).splitViewContainer]])
      }, [
        zi(M.$slots, "default", {}, void 0, !0)
      ], 2)
    ], 10, wv));
  }
}), kv = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, a] of t)
    n[i] = a;
  return n;
}, Fu = /* @__PURE__ */ kv(Sv, [["__scopeId", "data-v-e77a1ca4"]]), pa = /* @__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 = fe(), a = Id(), r = vl("allotment");
    function f() {
      return a?.vnode.key || `pane-${Math.random().toString(36).slice(2, 11)}`;
    }
    const u = f();
    return In(() => {
      r && i.value && r.registerPane(u, i.value, {
        minSize: n.minSize,
        maxSize: n.maxSize,
        preferredSize: n.preferredSize,
        priority: n.priority,
        snap: n.snap,
        visible: n.visible
      });
    }), Fe(() => n, (c) => {
      r && i.value && r.registerPane(u, i.value, {
        minSize: c.minSize,
        maxSize: c.maxSize,
        preferredSize: c.preferredSize,
        priority: c.priority,
        snap: c.snap,
        visible: c.visible
      });
    }, { deep: !0 }), Ui(() => {
      r && r.unregisterPane(u);
    }), t({
      element: i
    }), (c, p) => (E(), B("div", {
      ref_key: "paneRef",
      ref: i,
      class: Ae(["split-view-view", [
        c.visible && "split-view-view-visible",
        d(Wi).splitViewView,
        c.className
      ]])
    }, [
      zi(c.$slots, "default")
    ], 2));
  }
}), Cv = { class: "flex flex-col gap-3" }, _v = { class: "text-xs text-secondary mb-1" }, zv = { class: "text-xs text-secondary mb-1" }, Mv = { class: "text-xs text-secondary mb-1" }, Tv = { class: "text-xs text-secondary mb-1" }, Pv = { class: "text-xs text-secondary mb-1" }, $v = { class: "text-xs text-secondary mb-1" }, Ev = ["value"], Iv = { class: "text-xs text-secondary mb-1" }, Av = { class: "text-xs text-secondary mb-1" }, Ov = { class: "text-xs text-secondary mb-1" }, Dv = { class: "text-xs text-secondary mb-1" }, qv = { class: "text-xs text-secondary mb-1" }, Lv = { class: "text-xs text-secondary mb-1" }, Rv = ["value"], Nv = { class: "text-xs text-secondary mb-1" }, Vv = { class: "text-xs text-secondary mb-1" }, Fv = { key: 0 }, Bv = { class: "text-xs text-secondary mb-1" }, Hv = ["value"], Wv = { class: "text-xs text-secondary mb-1" }, jv = /* @__PURE__ */ ze({
  __name: "AxesSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = ot();
    return (n, i) => {
      const a = lt("a-radio-button"), r = lt("a-radio-group"), f = lt("a-switch");
      return E(), B("div", Cv, [
        m("div", null, [
          m("div", _v, I(d(t)("config.field.axisPlacement")), 1),
          k(r, {
            size: "small",
            value: e.panel.axisPlacement ?? "left",
            onChange: i[0] || (i[0] = (u) => e.onChange({ axisPlacement: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "left" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.placement.left")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "right" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.placement.right")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "hidden" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.placement.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", zv, I(d(t)("config.field.axisLabel")), 1),
          k(d(Ze), {
            size: "small",
            value: e.panel.axisLabel ?? "",
            placeholder: d(t)("config.axis.label.placeholder"),
            onChange: i[1] || (i[1] = (u) => e.onChange({ axisLabel: u.target.value }))
          }, null, 8, ["value", "placeholder"])
        ]),
        m("div", null, [
          m("div", Mv, I(d(t)("config.field.axisName")), 1),
          k(d(Ze), {
            size: "small",
            value: e.panel.axisName ?? "",
            placeholder: d(t)("config.axis.name.placeholder"),
            onChange: i[2] || (i[2] = (u) => e.onChange({ axisName: u.target.value }))
          }, null, 8, ["value", "placeholder"])
        ]),
        m("div", null, [
          m("div", Tv, I(d(t)("config.field.axisWidth")), 1),
          k(d(on), {
            size: "small",
            value: e.panel.axisWidth ?? void 0,
            min: 20,
            max: 300,
            style: { width: "100%" },
            onChange: i[3] || (i[3] = (u) => e.onChange({ axisWidth: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Pv, I(d(t)("config.field.showGridLines")), 1),
          k(r, {
            size: "small",
            value: e.panel.showGridLines ?? "all",
            onChange: i[4] || (i[4] = (u) => e.onChange({ showGridLines: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "all" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "x" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.x")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "y" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.y")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "hidden" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", $v, I(d(t)("config.field.gridColor")), 1),
          m("input", {
            type: "color",
            value: e.panel.gridColor ?? "#e8e8e8",
            onInput: i[5] || (i[5] = (u) => e.onChange({ gridColor: u.target.value }))
          }, null, 40, Ev)
        ]),
        m("div", null, [
          m("div", Iv, I(d(t)("config.field.scaleDistribution")), 1),
          k(r, {
            size: "small",
            value: e.panel.scaleDistribution ?? "linear",
            onChange: i[6] || (i[6] = (u) => e.onChange({ scaleDistribution: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "linear" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.scale.linear")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "logarithmic" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.scale.logarithmic")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Av, I(d(t)("config.field.softMin")), 1),
          k(d(on), {
            size: "small",
            value: e.panel.softMin ?? void 0,
            style: { width: "100%" },
            onChange: i[7] || (i[7] = (u) => e.onChange({ softMin: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Ov, I(d(t)("config.field.softMax")), 1),
          k(d(on), {
            size: "small",
            value: e.panel.softMax ?? void 0,
            style: { width: "100%" },
            onChange: i[8] || (i[8] = (u) => e.onChange({ softMax: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Dv, I(d(t)("config.field.centeredZero")), 1),
          k(f, {
            size: "small",
            checked: e.panel.centeredZero,
            onChange: i[9] || (i[9] = (u) => e.onChange({ centeredZero: u }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", qv, I(d(t)("config.field.axisLine")), 1),
          k(r, {
            size: "small",
            value: e.panel.axisLabel ?? "all",
            onChange: i[10] || (i[10] = (u) => e.onChange({ axisLabel: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "all" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "x" }, {
                default: R(() => [...i[16] || (i[16] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              k(a, { value: "y" }, {
                default: R(() => [...i[17] || (i[17] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              k(a, { value: "hidden" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Lv, I(d(t)("config.field.axisLineColor")), 1),
          m("input", {
            type: "color",
            value: e.panel.axisLabelColor ?? "#666666",
            onInput: i[11] || (i[11] = (u) => e.onChange({ axisLabelColor: u.target.value }))
          }, null, 40, Rv)
        ]),
        m("div", null, [
          m("div", Nv, I(d(t)("config.field.axisTickShow")), 1),
          k(r, {
            size: "small",
            value: e.panel.axisTick ?? "hidden",
            onChange: i[12] || (i[12] = (u) => e.onChange({ axisTick: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "all" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "x" }, {
                default: R(() => [...i[18] || (i[18] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              k(a, { value: "y" }, {
                default: R(() => [...i[19] || (i[19] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              k(a, { value: "hidden" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Vv, I(d(t)("config.field.axisBorder")), 1),
          k(r, {
            size: "small",
            value: e.panel.axisBorder ?? "hidden",
            onChange: i[13] || (i[13] = (u) => e.onChange({ axisBorder: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "all" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "x" }, {
                default: R(() => [...i[20] || (i[20] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              k(a, { value: "y" }, {
                default: R(() => [...i[21] || (i[21] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              k(a, { value: "hidden" }, {
                default: R(() => [
                  ce(I(d(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.axisBorder && e.panel.axisBorder !== "hidden" ? (E(), B("div", Fv, [
          m("div", Bv, I(d(t)("config.field.axisBorderColor")), 1),
          m("input", {
            type: "color",
            value: e.panel.axisBorderColor ?? "#cccccc",
            onInput: i[14] || (i[14] = (u) => e.onChange({ axisBorderColor: u.target.value }))
          }, null, 40, Hv)
        ])) : ye("", !0),
        m("div", null, [
          m("div", Wv, I(d(t)("config.field.logScale")), 1),
          k(f, {
            size: "small",
            checked: e.panel.scaleDistribution === "logarithmic",
            onChange: i[15] || (i[15] = (u) => e.onChange({ scaleDistribution: u ? "logarithmic" : "linear" }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), Gv = { class: "flex flex-col gap-3" }, Yv = { class: "text-xs text-secondary mb-1" }, Uv = { class: "text-xs text-secondary mb-1" }, Kv = { class: "text-xs text-secondary mb-1" }, Xv = { class: "text-xs text-secondary mb-1" }, Qv = { class: "text-xs text-secondary mb-1" }, Jv = { class: "text-xs text-secondary mb-1" }, Zv = { class: "text-xs text-secondary mb-1" }, ey = /* @__PURE__ */ ze({
  __name: "BarStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = ot();
    return (n, i) => {
      const a = lt("a-radio-button"), r = lt("a-radio-group"), f = lt("a-switch"), u = lt("a-input-number");
      return E(), B("div", Gv, [
        m("div", null, [
          m("div", Yv, I(d(t)("config.field.barShowValues")), 1),
          k(r, {
            size: "small",
            value: e.panel.barShowValues ?? "auto",
            onChange: i[0] || (i[0] = (c) => e.onChange({ barShowValues: c.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "auto" }, {
                default: R(() => [
                  ce(I(d(t)("config.showValues.auto")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "always" }, {
                default: R(() => [
                  ce(I(d(t)("config.showValues.always")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "never" }, {
                default: R(() => [
                  ce(I(d(t)("config.showValues.never")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Uv, I(d(t)("config.field.barGroupWidth")), 1),
          k(d(bn), {
            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"])
        ]),
        m("div", null, [
          m("div", Kv, I(d(t)("config.field.barWidth")), 1),
          k(d(bn), {
            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"])
        ]),
        m("div", null, [
          m("div", Xv, I(d(t)("config.field.stacked")), 1),
          k(f, {
            size: "small",
            checked: e.panel.stacked,
            onChange: i[3] || (i[3] = (c) => e.onChange({ stacked: c }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", Qv, I(d(t)("config.field.lineWidth")), 1),
          k(u, {
            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"])
        ]),
        m("div", null, [
          m("div", Jv, I(d(t)("config.field.fillOpacity")), 1),
          k(d(bn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: i[5] || (i[5] = (c) => e.onChange({ fillOpacity: c }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Zv, I(d(t)("config.field.xTickRotation")), 1),
          k(f, {
            size: "small",
            checked: e.panel.barXTickRotation ?? !1,
            onChange: i[6] || (i[6] = (c) => e.onChange({ barXTickRotation: c }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), ty = { class: "flex flex-col gap-3" }, ny = { class: "text-xs text-secondary mb-1" }, iy = { class: "text-xs text-secondary mb-1" }, ly = { class: "text-xs text-secondary mb-1" }, oy = ["value"], ay = { class: "text-xs text-secondary mb-1" }, sy = { class: "text-xs text-secondary mb-1" }, ry = { class: "text-xs text-secondary mb-1" }, uy = { class: "text-xs text-secondary mb-1" }, cy = { class: "text-xs text-secondary mb-1" }, dy = { key: 0 }, fy = { class: "text-xs text-secondary mb-1" }, hy = ["value"], gy = { class: "text-xs text-secondary mb-1" }, py = { class: "text-xs text-secondary mb-1" }, my = { class: "text-xs text-secondary mb-1" }, vy = { class: "text-xs text-secondary mb-1" }, yy = { class: "text-xs text-secondary mb-1" }, by = { class: "text-xs text-secondary mb-1" }, xy = /* @__PURE__ */ ze({
  __name: "GaugeStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = ot();
    return (n, i) => {
      const a = lt("a-switch"), r = lt("a-radio-button"), f = lt("a-radio-group");
      return E(), B("div", ty, [
        m("div", null, [
          m("div", ny, I(d(t)("config.gauge.fillWidth")), 1),
          k(d(bn), {
            min: 1,
            max: 100,
            value: e.panel.gaugeFillWidth ?? d(_t).fillWidth,
            onChange: i[0] || (i[0] = (u) => e.onChange({ gaugeFillWidth: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", iy, I(d(t)("config.gauge.trackWidth")), 1),
          k(d(bn), {
            min: 1,
            max: 100,
            value: e.panel.gaugeTrackWidth ?? d(_t).trackWidth,
            onChange: i[1] || (i[1] = (u) => e.onChange({ gaugeTrackWidth: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", ly, I(d(t)("config.gauge.trackColor")), 1),
          m("input", {
            type: "color",
            value: e.panel.gaugeTrackColor ?? "#222222",
            onInput: i[2] || (i[2] = (u) => e.onChange({ gaugeTrackColor: u.target.value }))
          }, null, 40, oy)
        ]),
        m("div", null, [
          m("div", ay, I(d(t)("config.gauge.arcSweep")), 1),
          k(d(bn), {
            min: 30,
            max: 360,
            value: e.panel.sweepAngle ?? d(_t).sweepAngle,
            onChange: i[3] || (i[3] = (u) => e.onChange({ sweepAngle: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", sy, I(d(t)("config.gauge.paddingX")), 1),
          k(d(bn), {
            min: 0,
            max: 0.5,
            step: 0.01,
            value: e.panel.gaugePaddingX ?? 0.05,
            onChange: i[4] || (i[4] = (u) => e.onChange({ gaugePaddingX: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", ry, I(d(t)("config.gauge.paddingY")), 1),
          k(d(bn), {
            min: 0,
            max: 0.5,
            step: 0.01,
            value: e.panel.gaugePaddingY ?? 0.1,
            onChange: i[5] || (i[5] = (u) => e.onChange({ gaugePaddingY: u }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", uy, I(d(t)("config.gauge.capRound")), 1),
          k(a, {
            size: "small",
            checked: e.panel.gaugeCapRound ?? d(_t).capRound,
            onChange: i[6] || (i[6] = (u) => e.onChange({ gaugeCapRound: u }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", cy, I(d(t)("config.gauge.valueVisible")), 1),
          k(a, {
            size: "small",
            checked: e.panel.gaugeValueVisible ?? d(_t).valueVisible,
            onChange: i[7] || (i[7] = (u) => e.onChange({ gaugeValueVisible: u }))
          }, null, 8, ["checked"])
        ]),
        e.panel.gaugeValueVisible !== !1 ? (E(), B("div", dy, [
          m("div", fy, I(d(t)("config.gauge.valueColor")), 1),
          m("input", {
            type: "color",
            value: e.panel.gaugeValueColor ?? "#ffffff",
            onInput: i[8] || (i[8] = (u) => e.onChange({ gaugeValueColor: u.target.value }))
          }, null, 40, hy)
        ])) : ye("", !0),
        m("div", null, [
          m("div", gy, I(d(t)("config.gauge.valueSize")), 1),
          k(d(on), {
            size: "small",
            min: 8,
            max: 80,
            value: e.panel.gaugeValueSize ?? d(_t).valueSize,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[9] || (i[9] = (u) => e.onChange({ gaugeValueSize: u ?? d(_t).valueSize }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", py, I(d(t)("config.gauge.valueOffsetY")), 1),
          k(d(on), {
            size: "small",
            min: -50,
            max: 50,
            value: e.panel.gaugeValueOffsetY ?? d(_t).valueOffsetY,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[10] || (i[10] = (u) => e.onChange({ gaugeValueOffsetY: u ?? d(_t).valueOffsetY }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", my, I(d(t)("config.gauge.colorFromScheme")), 1),
          k(a, {
            size: "small",
            checked: e.panel.gaugeColorFromScheme ?? !1,
            onChange: i[11] || (i[11] = (u) => e.onChange({ gaugeColorFromScheme: u }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", vy, I(d(t)("config.gauge.thresholdDisplay")), 1),
          k(f, {
            size: "small",
            value: e.panel.gaugeThresholdDisplay ?? d(_t).thresholdDisplay,
            onChange: i[12] || (i[12] = (u) => e.onChange({ gaugeThresholdDisplay: u.target.value }))
          }, {
            default: R(() => [
              k(r, { value: "none" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdDisplayNone")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "marker" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdDisplayMarker")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "track" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdDisplayTrack")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", yy, I(d(t)("config.gauge.thresholdLabelDisplay")), 1),
          k(f, {
            size: "small",
            value: e.panel.gaugeThresholdLabelDisplay ?? "none",
            onChange: i[13] || (i[13] = (u) => e.onChange({ gaugeThresholdLabelDisplay: u.target.value }))
          }, {
            default: R(() => [
              k(r, { value: "none" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdLabelNone")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "label" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdLabelLabel")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "value" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdLabelValue")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "both" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.thresholdLabelBoth")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", by, I(d(t)("config.gauge.orientation")), 1),
          k(f, {
            size: "small",
            value: e.panel.gaugeOrientation ?? d(_t).orientation,
            onChange: i[14] || (i[14] = (u) => e.onChange({ gaugeOrientation: u.target.value }))
          }, {
            default: R(() => [
              k(r, { value: "auto" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.orientationAuto")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "horizontal" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.orientationHorizontal")), 1)
                ]),
                _: 1
              }),
              k(r, { value: "vertical" }, {
                default: R(() => [
                  ce(I(d(t)("config.gauge.orientationVertical")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])
      ]);
    };
  }
}), Me = {
  // 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"
}, wy = { class: "inline-flex gap-0.5 items-center" }, Sy = /* @__PURE__ */ ze({
  __name: "PaletteSwatches",
  props: {
    colors: {}
  },
  setup(e) {
    return (t, n) => (E(), B("span", wy, [
      (E(!0), B(Pe, null, Xe(e.colors, (i, a) => (E(), B("span", {
        key: `${i}-${a}`,
        class: "inline-block rounded-sm flex-shrink-0",
        style: He({ width: "12px", height: "12px", background: i })
      }, null, 4))), 128))
    ]));
  }
}), ky = [
  { value: "classic", colors: ji.slice(0, 8) },
  { value: "tableau10", colors: Nn.tableau10.slice(0, 8) },
  { value: "grafana-classic", colors: Nn["grafana-classic"].slice(0, 8) },
  { value: "green-yellow-red", colors: Nn["green-yellow-red"] },
  { value: "red-yellow-green", colors: Nn["red-yellow-green"] },
  { value: "blue-yellow-red", colors: Nn["blue-yellow-red"] },
  { value: "blue-purple", colors: Nn["blue-purple"] },
  { value: "yellow-blue", colors: Nn["yellow-blue"] },
  { value: "blues", colors: Nn.blues },
  { value: "reds", colors: Nn.reds },
  { value: "GrYlRd", colors: Nn.GrYlRd },
  { value: "purple-orange", colors: Nn["purple-orange"] },
  { value: "fixed", colors: [] },
  { value: "thresholds", colors: [] }
], Cy = { class: "flex flex-col gap-3" }, _y = { class: "text-xs text-secondary mb-1" }, zy = { class: "text-xs text-secondary mb-1" }, My = { class: "text-xs text-secondary mb-1" }, Ty = { class: "inline-flex items-center gap-1.5" }, Py = { key: 0 }, $y = { class: "text-xs text-secondary mb-1" }, Ey = ["value"], Iy = { key: 1 }, Ay = { class: "text-xs text-secondary mb-1" }, Oy = { class: "text-xs text-secondary mb-1" }, Dy = { class: "flex gap-1 items-center" }, qy = { class: "flex items-center gap-1" }, Ly = { class: "text-xs text-secondary" }, Bu = /* @__PURE__ */ ze({
  __name: "GeneralSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot(), i = ky.map((u) => ({
      value: u.value,
      label: n(`config.scheme.${u.value}`),
      colors: u.colors
    }));
    function a() {
      const u = [...t.panel.links ?? [], { title: "", url: "", newTab: !0 }];
      t.onChange({ links: u });
    }
    function r(u) {
      const c = (t.panel.links ?? []).filter((p, y) => y !== u);
      t.onChange({ links: c });
    }
    function f(u, c) {
      const p = (t.panel.links ?? []).map((y, b) => b === u ? { ...y, ...c } : y);
      t.onChange({ links: p });
    }
    return (u, c) => {
      const p = lt("a-switch");
      return E(), B("div", Cy, [
        m("div", null, [
          m("div", _y, I(d(n)("config.field.title")), 1),
          k(d(Ze), {
            size: "small",
            value: e.panel.title,
            onChange: c[0] || (c[0] = (y) => e.onChange({ title: y.target.value }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", zy, I(d(n)("config.field.description")), 1),
          k(d(Ze), {
            size: "small",
            value: e.panel.description,
            onChange: c[1] || (c[1] = (y) => e.onChange({ description: y.target.value }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", My, I(d(n)("config.field.colorScheme")), 1),
          k(d(Qe), {
            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: R(() => [
              (E(!0), B(Pe, null, Xe(d(i), (y) => (E(), Ce(d(Qe).Option, {
                key: y.value,
                value: y.value
              }, {
                default: R(() => [
                  m("span", Ty, [
                    y.colors.length ? (E(), Ce(Sy, {
                      key: 0,
                      colors: y.colors
                    }, null, 8, ["colors"])) : ye("", !0),
                    m("span", null, I(y.label), 1)
                  ])
                ]),
                _: 2
              }, 1032, ["value"]))), 128))
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.colorScheme === "fixed" ? (E(), B("div", Py, [
          m("div", $y, I(d(n)("config.field.colorSingle")), 1),
          m("input", {
            type: "color",
            value: e.panel.colorSingleValue ?? "#4096ff",
            onInput: c[3] || (c[3] = (y) => e.onChange({ colorSingleValue: y.target.value }))
          }, null, 40, Ey)
        ])) : ye("", !0),
        e.panel.colorScheme && e.panel.colorScheme !== "fixed" && e.panel.colorScheme !== "thresholds" ? (E(), B("div", Iy, [
          m("div", Ay, I(d(n)("config.field.colorDistribution")), 1),
          k(d(Qe), {
            size: "small",
            value: e.panel.colorDistribution ?? "sequential",
            options: [
              { value: "sequential", label: d(n)("config.colorDist.sequential") },
              { value: "distributed", label: d(n)("config.colorDist.distributed") }
            ],
            style: { width: "100%" },
            onChange: c[4] || (c[4] = (y) => e.onChange({ colorDistribution: y }))
          }, null, 8, ["value", "options"])
        ])) : ye("", !0),
        m("div", null, [
          m("div", Oy, I(d(n)("config.section.links", { n: (e.panel.links ?? []).length })), 1),
          (E(!0), B(Pe, null, Xe(e.panel.links ?? [], (y, b) => (E(), B("div", {
            key: b,
            class: "mb-2 flex flex-col gap-1"
          }, [
            m("div", Dy, [
              k(d(Ze), {
                size: "small",
                value: y.title,
                placeholder: "Title",
                style: { flex: "1" },
                onChange: (v) => f(b, { title: v.target.value })
              }, null, 8, ["value", "onChange"]),
              k(d(tt), {
                type: "text",
                danger: "",
                size: "small",
                onClick: (v) => r(b)
              }, {
                default: R(() => [
                  m("span", {
                    class: Ae(d(Me).delete)
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["onClick"])
            ]),
            k(d(Ze), {
              size: "small",
              value: y.url,
              placeholder: "https://",
              onChange: (v) => f(b, { url: v.target.value })
            }, null, 8, ["value", "onChange"]),
            m("div", qy, [
              k(p, {
                size: "small",
                checked: y.newTab,
                onChange: (v) => f(b, { newTab: v })
              }, null, 8, ["checked", "onChange"]),
              m("span", Ly, I(d(n)("config.link.newTab")), 1)
            ])
          ]))), 128)),
          k(d(tt), {
            type: "dashed",
            size: "small",
            block: "",
            onClick: a
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).plus, "mr-1"])
              }, null, 2),
              ce(I(d(n)("config.link.add")), 1)
            ]),
            _: 1
          })
        ])
      ]);
    };
  }
}), Ry = { class: "flex flex-col gap-3" }, Ny = { class: "text-xs text-secondary mb-1" }, Vy = { class: "text-xs text-secondary mb-1" }, Fy = { class: "text-xs text-secondary mb-1" }, By = { class: "text-xs text-secondary mb-1" }, Hy = { class: "text-xs text-secondary mb-1" }, Wy = { class: "text-xs text-secondary mb-1" }, jy = /* @__PURE__ */ ze({
  __name: "HistogramStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = ot();
    return (n, i) => {
      const a = lt("a-input-number"), r = lt("a-switch");
      return E(), B("div", Ry, [
        m("div", null, [
          m("div", Ny, I(d(t)("config.field.histBucketCount")), 1),
          k(a, {
            size: "small",
            min: 1,
            max: 500,
            value: e.panel.histBucketCount ?? 30,
            style: { width: "100%" },
            onChange: i[0] || (i[0] = (f) => e.onChange({ histBucketCount: f ?? 30 }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Vy, I(d(t)("config.field.histBucketSize")), 1),
          k(a, {
            size: "small",
            min: 0,
            value: e.panel.histBucketSize,
            placeholder: d(t)("config.hist.bucketSizePlaceholder"),
            style: { width: "100%" },
            onChange: i[1] || (i[1] = (f) => e.onChange({ histBucketSize: f }))
          }, null, 8, ["value", "placeholder"])
        ]),
        m("div", null, [
          m("div", Fy, I(d(t)("config.field.histBucketOffset")), 1),
          k(a, {
            size: "small",
            min: 0,
            value: e.panel.histBucketOffset ?? 0,
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (f) => e.onChange({ histBucketOffset: f ?? 0 }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", By, I(d(t)("config.field.histCombineSeries")), 1),
          k(r, {
            size: "small",
            checked: e.panel.histCombineSeries ?? !1,
            onChange: i[3] || (i[3] = (f) => e.onChange({ histCombineSeries: f }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", Hy, I(d(t)("config.field.lineWidth")), 1),
          k(a, {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.lineWidth,
            style: { width: "100%" },
            onChange: i[4] || (i[4] = (f) => e.onChange({ lineWidth: f ?? 1 }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Wy, I(d(t)("config.field.fillOpacity")), 1),
          k(d(bn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: i[5] || (i[5] = (f) => e.onChange({ fillOpacity: f }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
}), Gy = { class: "flex flex-col gap-3" }, Yy = { class: "override-rule-header" }, Uy = { class: "override-props" }, Ky = /* @__PURE__ */ ze({
  __name: "OverridesSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot(), 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" }
    ], r = re(() => t.panel.fieldConfigOverrides ?? []);
    function f() {
      const v = {
        id: crypto.randomUUID(),
        matcher: { id: "byName", options: "" },
        properties: []
      };
      t.onChange({ fieldConfigOverrides: [...r.value, v] });
    }
    function u(v) {
      t.onChange({
        fieldConfigOverrides: r.value.filter((C) => C.id !== v)
      });
    }
    function c(v, C) {
      t.onChange({
        fieldConfigOverrides: r.value.map(
          (z) => z.id === v ? { ...z, matcher: { ...z.matcher, ...C } } : z
        )
      });
    }
    function p(v) {
      t.onChange({
        fieldConfigOverrides: r.value.map(
          (C) => C.id === v ? { ...C, properties: [...C.properties, { id: "displayName", value: "" }] } : C
        )
      });
    }
    function y(v, C, z) {
      t.onChange({
        fieldConfigOverrides: r.value.map(
          (T) => T.id === v ? {
            ...T,
            properties: T.properties.map(
              (q, Q) => Q === C ? { ...q, ...z } : q
            )
          } : T
        )
      });
    }
    function b(v, C) {
      t.onChange({
        fieldConfigOverrides: r.value.map(
          (z) => z.id === v ? { ...z, properties: z.properties.filter((T, q) => q !== C) } : z
        )
      });
    }
    return (v, C) => (E(), B("div", Gy, [
      (E(!0), B(Pe, null, Xe(r.value, (z) => (E(), B("div", {
        key: z.id,
        class: "override-rule"
      }, [
        m("div", Yy, [
          k(d(Qe), {
            size: "small",
            value: z.matcher.id,
            options: i,
            style: { flex: "1" },
            onChange: (T) => c(z.id, { id: T })
          }, null, 8, ["value", "onChange"]),
          k(d(Ze), {
            size: "small",
            value: z.matcher.options ?? "",
            placeholder: d(n)("editor.overrides.matcherValue"),
            style: { flex: "1" },
            onChange: (T) => c(z.id, { options: T.target.value })
          }, null, 8, ["value", "placeholder", "onChange"]),
          k(d(tt), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (T) => u(z.id)
          }, {
            default: R(() => [
              m("span", {
                class: Ae(d(Me).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]),
        m("div", Uy, [
          (E(!0), B(Pe, null, Xe(z.properties, (T, q) => (E(), B("div", {
            key: q,
            class: "override-prop-row"
          }, [
            k(d(Qe), {
              size: "small",
              value: T.id,
              options: a,
              style: { width: "140px" },
              onChange: (Q) => y(z.id, q, { id: Q })
            }, null, 8, ["value", "onChange"]),
            k(d(Ze), {
              size: "small",
              value: String(T.value ?? ""),
              placeholder: d(n)("editor.overrides.propValue"),
              style: { flex: "1" },
              onChange: (Q) => y(z.id, q, { value: Q.target.value })
            }, null, 8, ["value", "placeholder", "onChange"]),
            k(d(tt), {
              type: "text",
              danger: "",
              size: "small",
              onClick: (Q) => b(z.id, q)
            }, {
              default: R(() => [
                m("span", {
                  class: Ae(d(Me).closeCircle)
                }, null, 2)
              ]),
              _: 1
            }, 8, ["onClick"])
          ]))), 128)),
          k(d(tt), {
            type: "dashed",
            size: "small",
            style: { width: "100%", "margin-top": "4px" },
            onClick: (T) => p(z.id)
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).plus, "mr-1"])
              }, null, 2),
              ce(" " + I(d(n)("editor.overrides.addProperty")), 1)
            ]),
            _: 1
          }, 8, ["onClick"])
        ])
      ]))), 128)),
      k(d(tt), {
        type: "dashed",
        size: "small",
        style: { width: "100%" },
        onClick: f
      }, {
        default: R(() => [
          m("span", {
            class: Ae([d(Me).plus, "mr-1"])
          }, null, 2),
          ce(" " + I(d(n)("editor.overrides.addOverride")), 1)
        ]),
        _: 1
      })
    ]));
  }
}), xn = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, a] of t)
    n[i] = a;
  return n;
}, Hu = /* @__PURE__ */ xn(Ky, [["__scopeId", "data-v-2396374b"]]), Xy = { class: "flex flex-col gap-3" }, Qy = { class: "text-xs text-secondary mb-1" }, Jy = { class: "text-xs text-secondary mb-1" }, Zy = { class: "text-xs text-secondary mb-1" }, eb = { class: "flex flex-col gap-1" }, tb = { class: "text-xs" }, nb = { class: "text-xs text-secondary mb-1" }, ib = { key: 0 }, lb = { class: "text-xs text-secondary mb-1" }, ob = { class: "text-xs text-secondary mb-1" }, ab = { class: "text-xs text-secondary mb-1" }, sb = { class: "flex flex-col gap-1" }, rb = { class: "text-xs" }, ub = /* @__PURE__ */ ze({
  __name: "PieStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot(), i = re(() => t.panel.pieLabels ?? []), a = re(() => t.panel.legendValues ?? []);
    function r(u, c) {
      const p = c ? [...i.value, u] : i.value.filter((y) => y !== u);
      t.onChange({ pieLabels: p });
    }
    function f(u, c) {
      const p = c ? [...a.value, u] : a.value.filter((y) => y !== u);
      t.onChange({ legendValues: p });
    }
    return (u, c) => {
      const p = lt("a-radio-button"), y = lt("a-radio-group"), b = lt("a-checkbox");
      return E(), B("div", Xy, [
        m("div", null, [
          m("div", Qy, I(d(n)("config.field.pieType")), 1),
          k(y, {
            size: "small",
            value: e.panel.pieType ?? "pie",
            onChange: c[0] || (c[0] = (v) => e.onChange({ pieType: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "pie" }, {
                default: R(() => [
                  ce(I(d(n)("config.pieType.pie")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "donut" }, {
                default: R(() => [
                  ce(I(d(n)("config.pieType.donut")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Jy, I(d(n)("config.field.pieSliceSorting")), 1),
          k(y, {
            size: "small",
            value: e.panel.pieSliceSorting ?? "desc",
            onChange: c[1] || (c[1] = (v) => e.onChange({ pieSliceSorting: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "desc" }, {
                default: R(() => [
                  ce(I(d(n)("config.sort.desc")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "asc" }, {
                default: R(() => [
                  ce(I(d(n)("config.sort.asc")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "none" }, {
                default: R(() => [
                  ce(I(d(n)("config.sort.none")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Zy, I(d(n)("config.field.pieLabels")), 1),
          m("div", eb, [
            (E(), B(Pe, null, Xe(["name", "percent", "value"], (v) => m("label", {
              key: v,
              class: "flex items-center gap-1"
            }, [
              k(b, {
                checked: i.value.includes(v),
                onChange: (C) => r(v, C.target.checked)
              }, null, 8, ["checked", "onChange"]),
              m("span", tb, I(d(n)(`config.pieLabel.${v}`)), 1)
            ])), 64))
          ])
        ]),
        m("div", null, [
          m("div", nb, I(d(n)("config.field.pieShow")), 1),
          k(y, {
            size: "small",
            value: e.panel.pieShow ?? "calculate",
            onChange: c[2] || (c[2] = (v) => e.onChange({ pieShow: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "calculate" }, {
                default: R(() => [
                  ce(I(d(n)("config.pieShow.calculate")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "all" }, {
                default: R(() => [
                  ce(I(d(n)("config.pieShow.all")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (e.panel.pieShow ?? "calculate") === "calculate" ? (E(), B("div", ib, [
          m("div", lb, I(d(n)("config.field.reducer")), 1),
          k(d(Qe), {
            size: "small",
            value: e.panel.pieCalculation ?? "lastNotNull",
            options: [
              { value: "lastNotNull", label: d(n)("config.reducer.lastNotNull") },
              { value: "last", label: d(n)("config.reducer.last") },
              { value: "mean", label: d(n)("config.reducer.mean") },
              { value: "min", label: d(n)("config.reducer.min") },
              { value: "max", label: d(n)("config.reducer.max") },
              { value: "sum", label: d(n)("config.reducer.sum") }
            ],
            style: { width: "100%" },
            onChange: c[3] || (c[3] = (v) => e.onChange({ pieCalculation: v }))
          }, null, 8, ["value", "options"])
        ])) : ye("", !0),
        m("div", null, [
          m("div", ob, I(d(n)("config.field.legendMode")), 1),
          k(y, {
            size: "small",
            value: e.panel.legendMode ?? "list",
            onChange: c[4] || (c[4] = (v) => e.onChange({ legendMode: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "list" }, {
                default: R(() => [
                  ce(I(d(n)("config.legendMode.list")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "table" }, {
                default: R(() => [
                  ce(I(d(n)("config.legendMode.table")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", ab, I(d(n)("config.field.legendValues")), 1),
          m("div", sb, [
            (E(), B(Pe, null, Xe(["min", "max", "mean", "sum", "last"], (v) => m("label", {
              key: v,
              class: "flex items-center gap-1"
            }, [
              k(b, {
                checked: a.value.includes(v),
                onChange: (C) => f(v, C.target.checked)
              }, null, 8, ["checked", "onChange"]),
              m("span", rb, I(d(n)(`config.legendValue.${v}`)), 1)
            ])), 64))
          ])
        ])
      ]);
    };
  }
}), cb = { class: "flex flex-col gap-3" }, db = { class: "text-xs text-secondary mb-1" }, fb = { class: "text-xs text-secondary mb-1" }, hb = { class: "text-xs text-secondary mb-1" }, gb = { class: "text-xs text-secondary mb-1" }, pb = /* @__PURE__ */ ze({
  __name: "StatStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = ot();
    return (n, i) => {
      const a = lt("a-switch");
      return E(), B("div", cb, [
        m("div", null, [
          m("div", db, I(d(t)("config.field.orientation")), 1),
          k(d(Qe), {
            size: "small",
            value: e.panel.statOrientation ?? "vertical",
            options: [
              { value: "vertical", label: d(t)("config.orientation.vertical") },
              { value: "horizontal", label: d(t)("config.orientation.horizontal") }
            ],
            style: { width: "100%" },
            onChange: i[0] || (i[0] = (r) => e.onChange({ statOrientation: r }))
          }, null, 8, ["value", "options"])
        ]),
        m("div", null, [
          m("div", fb, I(d(t)("config.field.textMode")), 1),
          k(d(Qe), {
            size: "small",
            value: e.panel.statTextMode ?? "value_and_name",
            options: [
              { value: "value_and_name", label: d(t)("config.textMode.valueAndName") },
              { value: "value", label: d(t)("config.textMode.value") },
              { value: "name", label: d(t)("config.textMode.name") },
              { value: "none", label: d(t)("config.textMode.none") }
            ],
            style: { width: "100%" },
            onChange: i[1] || (i[1] = (r) => e.onChange({ statTextMode: r }))
          }, null, 8, ["value", "options"])
        ]),
        m("div", null, [
          m("div", hb, I(d(t)("config.field.colorMode")), 1),
          k(d(Qe), {
            size: "small",
            value: e.panel.statColorMode ?? "value",
            options: [
              { value: "value", label: d(t)("config.colorMode.value") },
              { value: "background_solid", label: d(t)("config.colorMode.backgroundSolid") },
              { value: "background", label: d(t)("config.colorMode.background") }
            ],
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (r) => e.onChange({ statColorMode: r }))
          }, null, 8, ["value", "options"])
        ]),
        m("div", null, [
          m("div", gb, I(d(t)("config.field.percentChange")), 1),
          k(a, {
            size: "small",
            checked: e.panel.showPercentChange ?? !1,
            onChange: i[3] || (i[3] = (r) => e.onChange({ showPercentChange: r }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), mb = { class: "flex flex-col gap-3" }, vb = { key: 0 }, yb = { class: "text-xs text-secondary mb-1" }, bb = { key: 1 }, xb = { class: "text-xs text-secondary mb-1" }, wb = { key: 2 }, Sb = { class: "text-xs text-secondary mb-1" }, kb = { key: 3 }, Cb = { class: "text-xs text-secondary mb-1" }, _b = { class: "text-xs text-secondary mb-1" }, zb = { class: "text-xs text-secondary mb-1" }, Mb = { class: "text-xs text-secondary mb-1" }, Tb = { class: "flex items-center gap-2" }, Pb = { class: "text-xs text-secondary mb-1" }, $b = { class: "flex items-center gap-2" }, Eb = { key: 5 }, Ib = { class: "text-xs text-secondary mb-1" }, Ab = { key: 6 }, Ob = { class: "text-xs text-secondary mb-1" }, Db = { class: "text-xs text-secondary mb-1" }, qb = { key: 7 }, Lb = { class: "text-xs text-secondary mb-1" }, Rb = /* @__PURE__ */ ze({
  __name: "StyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot(), i = t.panel.type === "timeseries", a = t.panel.drawStyle ?? "lines", r = a === "lines", f = a === "points", u = t.panel.showPointsMode ?? "auto", c = t.panel.spanNulls ?? !1, p = t.panel.insertNulls ?? !1;
    return (y, b) => {
      const v = lt("a-radio-button"), C = lt("a-radio-group"), z = lt("a-input-number"), T = lt("a-switch");
      return E(), B("div", mb, [
        i ? (E(), B("div", vb, [
          m("div", yb, I(d(n)("config.field.drawStyle")), 1),
          k(C, {
            size: "small",
            value: e.panel.drawStyle ?? "lines",
            onChange: b[0] || (b[0] = (q) => e.onChange({ drawStyle: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "lines" }, {
                default: R(() => [
                  ce(I(d(n)("config.drawStyle.lines")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "bars" }, {
                default: R(() => [
                  ce(I(d(n)("config.drawStyle.bars")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "points" }, {
                default: R(() => [
                  ce(I(d(n)("config.drawStyle.points")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        f ? ye("", !0) : (E(), B("div", bb, [
          m("div", xb, I(d(n)("config.field.lineWidth")), 1),
          k(d(bn), {
            min: 0.5,
            max: 4,
            step: 0.5,
            value: e.panel.lineWidth,
            onChange: b[1] || (b[1] = (q) => e.onChange({ lineWidth: q }))
          }, null, 8, ["value"])
        ])),
        f ? ye("", !0) : (E(), B("div", wb, [
          m("div", Sb, I(d(n)("config.field.fillOpacity")), 1),
          k(d(bn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: b[2] || (b[2] = (q) => e.onChange({ fillOpacity: q }))
          }, null, 8, ["value"])
        ])),
        f ? ye("", !0) : (E(), B("div", kb, [
          m("div", Cb, I(d(n)("config.field.gradientMode")), 1),
          k(C, {
            size: "small",
            value: e.panel.gradientMode ?? "none",
            onChange: b[3] || (b[3] = (q) => e.onChange({ gradientMode: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "none" }, {
                default: R(() => [
                  ce(I(d(n)("config.gradient.none")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "opacity" }, {
                default: R(() => [
                  ce(I(d(n)("config.gradient.opacity")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "hue" }, {
                default: R(() => [
                  ce(I(d(n)("config.gradient.hue")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "scheme" }, {
                default: R(() => [
                  ce(I(d(n)("config.gradient.scheme")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])),
        i && r ? (E(), B(Pe, { key: 4 }, [
          m("div", null, [
            m("div", _b, I(d(n)("config.field.interpolation")), 1),
            k(C, {
              size: "small",
              value: e.panel.lineInterpolation,
              onChange: b[4] || (b[4] = (q) => e.onChange({ lineInterpolation: q.target.value }))
            }, {
              default: R(() => [
                k(v, { value: "linear" }, {
                  default: R(() => [
                    ce(I(d(n)("config.interp.linear")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "smooth" }, {
                  default: R(() => [
                    ce(I(d(n)("config.interp.smooth")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "step" }, {
                  default: R(() => [
                    ce(I(d(n)("config.interp.step")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          m("div", null, [
            m("div", zb, I(d(n)("config.field.lineStyle")), 1),
            k(C, {
              size: "small",
              value: e.panel.lineStyle,
              onChange: b[5] || (b[5] = (q) => e.onChange({ lineStyle: q.target.value }))
            }, {
              default: R(() => [
                k(v, { value: "solid" }, {
                  default: R(() => [
                    ce(I(d(n)("config.linestyle.solid")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "dashed" }, {
                  default: R(() => [
                    ce(I(d(n)("config.linestyle.dashed")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "dotted" }, {
                  default: R(() => [
                    ce(I(d(n)("config.linestyle.dotted")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          m("div", null, [
            m("div", Mb, I(d(n)("config.field.spanNulls")), 1),
            m("div", Tb, [
              k(C, {
                size: "small",
                value: d(c) === !0 ? "always" : typeof d(c) == "number" ? "threshold" : "never",
                onChange: b[6] || (b[6] = (q) => {
                  q.target.value === "never" ? e.onChange({ spanNulls: !1 }) : q.target.value === "always" ? e.onChange({ spanNulls: !0 }) : e.onChange({ spanNulls: 3600 });
                })
              }, {
                default: R(() => [
                  k(v, { value: "never" }, {
                    default: R(() => [
                      ce(I(d(n)("config.nulls.never")), 1)
                    ]),
                    _: 1
                  }),
                  k(v, { value: "always" }, {
                    default: R(() => [
                      ce(I(d(n)("config.nulls.always")), 1)
                    ]),
                    _: 1
                  }),
                  k(v, { value: "threshold" }, {
                    default: R(() => [
                      ce(I(d(n)("config.nulls.threshold")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value"]),
              typeof d(c) == "number" ? (E(), Ce(z, {
                key: 0,
                size: "small",
                min: 1,
                value: d(c),
                suffix: "s",
                style: { width: "90px" },
                onChange: b[7] || (b[7] = (q) => e.onChange({ spanNulls: q ?? 3600 }))
              }, null, 8, ["value"])) : ye("", !0)
            ])
          ]),
          m("div", null, [
            m("div", Pb, I(d(n)("config.field.insertNulls")), 1),
            m("div", $b, [
              k(C, {
                size: "small",
                value: typeof d(p) == "number" ? "threshold" : "never",
                onChange: b[8] || (b[8] = (q) => {
                  q.target.value === "never" ? e.onChange({ insertNulls: !1 }) : e.onChange({ insertNulls: 3600 });
                })
              }, {
                default: R(() => [
                  k(v, { value: "never" }, {
                    default: R(() => [
                      ce(I(d(n)("config.nulls.never")), 1)
                    ]),
                    _: 1
                  }),
                  k(v, { value: "threshold" }, {
                    default: R(() => [
                      ce(I(d(n)("config.nulls.threshold")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value"]),
              typeof d(p) == "number" ? (E(), Ce(z, {
                key: 0,
                size: "small",
                min: 1,
                value: d(p),
                suffix: "s",
                style: { width: "90px" },
                onChange: b[9] || (b[9] = (q) => e.onChange({ insertNulls: q ?? 3600 }))
              }, null, 8, ["value"])) : ye("", !0)
            ])
          ])
        ], 64)) : ye("", !0),
        i && !f ? (E(), B("div", Eb, [
          m("div", Ib, I(d(n)("config.field.showPoints")), 1),
          k(C, {
            size: "small",
            value: d(u),
            onChange: b[10] || (b[10] = (q) => e.onChange({ showPointsMode: q.target.value, showPoints: q.target.value === "always" }))
          }, {
            default: R(() => [
              k(v, { value: "auto" }, {
                default: R(() => [
                  ce(I(d(n)("config.points.auto")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "always" }, {
                default: R(() => [
                  ce(I(d(n)("config.points.always")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "never" }, {
                default: R(() => [
                  ce(I(d(n)("config.points.never")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        i ? (E(), B("div", Ab, [
          m("div", Ob, I(d(n)("config.field.stackSeries")), 1),
          k(C, {
            size: "small",
            value: e.panel.stackingMode ?? "none",
            onChange: b[11] || (b[11] = (q) => e.onChange({ stackingMode: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "none" }, {
                default: R(() => [
                  ce(I(d(n)("config.stack.none")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "normal" }, {
                default: R(() => [
                  ce(I(d(n)("config.stack.normal")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "percent" }, {
                default: R(() => [
                  ce(I(d(n)("config.stack.percent")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        m("div", null, [
          m("div", Db, I(d(n)("config.field.legendPosition")), 1),
          k(C, {
            size: "small",
            value: e.panel.legendPosition,
            onChange: b[12] || (b[12] = (q) => e.onChange({ legendPosition: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "bottom" }, {
                default: R(() => [
                  ce(I(d(n)("config.legend.bottom")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "right" }, {
                default: R(() => [
                  ce(I(d(n)("config.legend.right")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "hidden" }, {
                default: R(() => [
                  ce(I(d(n)("config.legend.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.type === "bar" ? (E(), B("div", qb, [
          m("div", Lb, I(d(n)("config.field.stacked")), 1),
          k(T, {
            size: "small",
            checked: e.panel.stacked,
            onChange: b[13] || (b[13] = (q) => e.onChange({ stacked: q }))
          }, null, 8, ["checked"])
        ])) : ye("", !0)
      ]);
    };
  }
}), Nb = { class: "flex flex-col gap-3" }, Vb = { class: "text-xs text-secondary mb-1" }, Fb = { class: "text-xs text-secondary mb-1" }, Bb = { class: "text-xs text-secondary mb-1" }, Hb = { class: "text-xs text-secondary mb-1" }, Wb = { class: "text-xs text-secondary mb-1" }, jb = { class: "text-xs text-secondary mb-1" }, Gb = { key: 0 }, Yb = { class: "text-xs text-secondary mb-1" }, Ub = { class: "text-xs text-secondary mb-1" }, Kb = { key: 1 }, Xb = { class: "text-xs text-secondary mb-1" }, Qb = { key: 2 }, Jb = { class: "text-xs text-secondary mb-1" }, Zb = /* @__PURE__ */ ze({
  __name: "TableStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot();
    function i(a) {
      t.onChange({ tableFooterReducers: a ? [a] : [] });
    }
    return (a, r) => {
      const f = lt("a-switch"), u = lt("a-radio-button"), c = lt("a-radio-group");
      return E(), B("div", Nb, [
        m("div", null, [
          m("div", Vb, I(d(n)("config.field.tableShowHeader")), 1),
          k(f, {
            size: "small",
            checked: e.panel.tableShowHeader ?? !0,
            onChange: r[0] || (r[0] = (p) => e.onChange({ tableShowHeader: p }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", Fb, I(d(n)("config.field.tableCellHeight")), 1),
          k(c, {
            size: "small",
            value: e.panel.tableCellHeight ?? "medium",
            onChange: r[1] || (r[1] = (p) => e.onChange({ tableCellHeight: p.target.value }))
          }, {
            default: R(() => [
              k(u, { value: "small" }, {
                default: R(() => [
                  ce(I(d(n)("config.tableHeight.small")), 1)
                ]),
                _: 1
              }),
              k(u, { value: "medium" }, {
                default: R(() => [
                  ce(I(d(n)("config.tableHeight.medium")), 1)
                ]),
                _: 1
              }),
              k(u, { value: "large" }, {
                default: R(() => [
                  ce(I(d(n)("config.tableHeight.large")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Bb, I(d(n)("config.field.tableFrozenColumns")), 1),
          k(d(on), {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.tableFrozenColumns ?? 0,
            style: { width: "100%" },
            onChange: r[2] || (r[2] = (p) => e.onChange({ tableFrozenColumns: p ?? 0 }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", Hb, I(d(n)("config.field.tableColumnFilter")), 1),
          k(f, {
            size: "small",
            checked: e.panel.tableColumnFilter ?? !1,
            onChange: r[3] || (r[3] = (p) => e.onChange({ tableColumnFilter: p }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", Wb, I(d(n)("config.field.tableWrapText")), 1),
          k(f, {
            size: "small",
            checked: e.panel.tableWrapText ?? !1,
            onChange: r[4] || (r[4] = (p) => e.onChange({ tableWrapText: p }))
          }, null, 8, ["checked"])
        ]),
        m("div", null, [
          m("div", jb, I(d(n)("config.field.tableEnablePagination")), 1),
          k(f, {
            size: "small",
            checked: e.panel.tableEnablePagination ?? !1,
            onChange: r[5] || (r[5] = (p) => e.onChange({ tableEnablePagination: p }))
          }, null, 8, ["checked"])
        ]),
        e.panel.tableEnablePagination ? (E(), B("div", Gb, [
          m("div", Yb, I(d(n)("config.field.tablePageSize")), 1),
          k(d(on), {
            size: "small",
            min: 5,
            max: 500,
            value: e.panel.tablePageSize ?? 20,
            style: { width: "100%" },
            onChange: r[6] || (r[6] = (p) => e.onChange({ tablePageSize: p ?? 20 }))
          }, null, 8, ["value"])
        ])) : ye("", !0),
        m("div", null, [
          m("div", Ub, I(d(n)("config.field.tableFooterEnabled")), 1),
          k(f, {
            size: "small",
            checked: e.panel.tableFooterEnabled ?? !1,
            onChange: r[7] || (r[7] = (p) => e.onChange({ tableFooterEnabled: p }))
          }, null, 8, ["checked"])
        ]),
        e.panel.tableFooterEnabled ? (E(), B("div", Kb, [
          m("div", Xb, I(d(n)("config.field.tableFooterReducers")), 1),
          k(d(Qe), {
            size: "small",
            value: e.panel.tableFooterReducers?.[0],
            options: [
              { value: "min", label: d(n)("config.reducer.min") },
              { value: "max", label: d(n)("config.reducer.max") },
              { value: "mean", label: d(n)("config.reducer.mean") },
              { value: "sum", label: d(n)("config.reducer.sum") },
              { value: "count", label: d(n)("config.reducer.count") }
            ],
            "allow-clear": "",
            style: { width: "100%" },
            onChange: r[8] || (r[8] = (p) => i(p))
          }, null, 8, ["value", "options"])
        ])) : ye("", !0),
        e.panel.tableFooterEnabled && e.panel.tableFooterReducers?.[0] ? (E(), B("div", Qb, [
          m("div", Jb, I(d(n)("config.field.tableFooterFields")), 1),
          k(d(Qe), {
            size: "small",
            mode: "multiple",
            "allow-clear": "",
            placeholder: d(n)("config.field.tableFooterFieldsPlaceholder"),
            value: e.panel.tableFooterFields ?? [],
            options: (e.numericFieldNames ?? []).map((p) => ({ value: p, label: p })),
            style: { width: "100%" },
            onChange: r[9] || (r[9] = (p) => e.onChange({ tableFooterFields: p.length > 0 ? p : void 0 }))
          }, null, 8, ["placeholder", "value", "options"])
        ])) : ye("", !0)
      ]);
    };
  }
}), e0 = { class: "flex flex-col gap-1" }, t0 = { class: "mb-2" }, n0 = { class: "text-xs text-secondary mb-1" }, i0 = ["value", "onInput"], l0 = { class: "flex items-center gap-1.5 mb-1" }, o0 = ["value"], a0 = { class: "text-xs text-secondary flex-1" }, s0 = /* @__PURE__ */ ze({
  __name: "ThresholdsEditor",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot(), i = ["#52c41a", "#faad14", "#ff4d4f", "#1677ff", "#722ed1", "#13c2c2", "#fa8c16"], a = fe(t.panel.thresholdMode ?? "absolute"), r = re(() => a.value === "percentage"), f = re(() => [...t.panel.thresholds].sort((v, C) => C.value - v.value));
    function u() {
      const v = [t.panel.thresholdBaseColor, ...t.panel.thresholds.map((C) => C.color)];
      return i.find((C) => !v.includes(C)) ?? "#cccccc";
    }
    function c() {
      const v = t.panel.thresholds.length > 0 ? Math.max(...t.panel.thresholds.map((q) => q.value)) : 0, z = { value: r.value ? Math.min(100, v + 20) : v + 10, color: u(), label: "" }, T = [...t.panel.thresholds, z].sort((q, Q) => q.value - Q.value);
      t.onChange({ thresholds: T });
    }
    function p(v) {
      t.onChange({ thresholds: t.panel.thresholds.filter((C) => C.value !== v) });
    }
    function y(v, C) {
      const z = t.panel.thresholds.map((T) => T.value === v ? { ...T, ...C } : T).sort((T, q) => T.value - q.value);
      t.onChange({ thresholds: z });
    }
    function b(v) {
      a.value = v, t.onChange({ thresholdMode: v });
    }
    return (v, C) => {
      const z = lt("a-input");
      return E(), B("div", e0, [
        m("div", t0, [
          m("div", n0, I(d(n)("config.threshold.mode")), 1),
          k(d(es).Group, {
            size: "small",
            value: a.value,
            onChange: C[0] || (C[0] = (T) => b(T.target.value))
          }, {
            default: R(() => [
              k(d(es).Button, { value: "absolute" }, {
                default: R(() => [
                  ce(I(d(n)("config.threshold.modeAbsolute")), 1)
                ]),
                _: 1
              }),
              k(d(es).Button, { value: "percentage" }, {
                default: R(() => [
                  ce(I(d(n)("config.threshold.modePercentage")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (E(!0), B(Pe, null, Xe(f.value, (T) => (E(), B("div", {
          key: T.value,
          class: "flex items-center gap-1.5 mb-1"
        }, [
          m("input", {
            type: "color",
            class: "w-7 h-7 border border-gray-300 rounded cursor-pointer",
            value: T.color,
            onInput: (q) => y(T.value, { color: q.target.value })
          }, null, 40, i0),
          k(d(on), {
            size: "small",
            value: T.value,
            min: r.value ? 0 : void 0,
            max: r.value ? 100 : void 0,
            style: { width: "80px" },
            onChange: (q) => y(T.value, { value: q ?? 0 })
          }, null, 8, ["value", "min", "max", "onChange"]),
          k(z, {
            size: "small",
            value: T.label,
            placeholder: "Label",
            style: { flex: "1" },
            onChange: (q) => y(T.value, { label: q.target.value })
          }, null, 8, ["value", "onChange"]),
          k(d(tt), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (q) => p(T.value)
          }, {
            default: R(() => [
              m("span", {
                class: Ae(d(Me).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]))), 128)),
        m("div", l0, [
          m("input", {
            type: "color",
            class: "w-7 h-7 border border-gray-300 rounded cursor-pointer",
            value: e.panel.thresholdBaseColor,
            onInput: C[1] || (C[1] = (T) => e.onChange({ thresholdBaseColor: T.target.value }))
          }, null, 40, o0),
          m("span", a0, I(d(n)("config.threshold.base")), 1)
        ]),
        k(d(tt), {
          type: "dashed",
          size: "small",
          block: "",
          onClick: c
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).plus, "mr-1"])
            }, null, 2),
            ce(" " + I(d(n)("config.threshold.add")), 1)
          ]),
          _: 1
        })
      ]);
    };
  }
}), r0 = { class: "flex flex-col gap-3" }, u0 = { class: "text-xs text-secondary mb-1" }, c0 = { key: 0 }, d0 = { class: "text-xs text-secondary mb-1" }, f0 = { key: 1 }, h0 = { class: "text-xs text-secondary mb-1" }, g0 = { class: "text-xs text-secondary mb-1" }, p0 = /* @__PURE__ */ ze({
  __name: "TooltipSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = ot();
    return (n, i) => {
      const a = lt("a-radio-button"), r = lt("a-radio-group"), f = lt("a-switch");
      return E(), B("div", r0, [
        m("div", null, [
          m("div", u0, I(d(t)("config.field.tooltipMode")), 1),
          k(r, {
            size: "small",
            value: e.panel.tooltipMode ?? "multi",
            onChange: i[0] || (i[0] = (u) => e.onChange({ tooltipMode: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "single" }, {
                default: R(() => [
                  ce(I(d(t)("config.tooltip.single")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "multi" }, {
                default: R(() => [
                  ce(I(d(t)("config.tooltip.multi")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "none" }, {
                default: R(() => [
                  ce(I(d(t)("config.tooltip.none")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (e.panel.tooltipMode ?? "multi") === "multi" ? (E(), B("div", c0, [
          m("div", d0, I(d(t)("config.field.tooltipSort")), 1),
          k(r, {
            size: "small",
            value: e.panel.tooltipSort ?? "none",
            onChange: i[1] || (i[1] = (u) => e.onChange({ tooltipSort: u.target.value }))
          }, {
            default: R(() => [
              k(a, { value: "none" }, {
                default: R(() => [
                  ce(I(d(t)("config.tooltip.sortNone")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "asc" }, {
                default: R(() => [
                  ce(I(d(t)("config.tooltip.sortAsc")), 1)
                ]),
                _: 1
              }),
              k(a, { value: "desc" }, {
                default: R(() => [
                  ce(I(d(t)("config.tooltip.sortDesc")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        (e.panel.tooltipMode ?? "multi") === "multi" ? (E(), B("div", f0, [
          m("div", h0, I(d(t)("config.field.tooltipMaxHeight")), 1),
          k(d(on), {
            size: "small",
            min: 50,
            max: 800,
            value: e.panel.tooltipMaxHeight ?? 600,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (u) => e.onChange({ tooltipMaxHeight: u ?? 600 }))
          }, null, 8, ["value"])
        ])) : ye("", !0),
        m("div", null, [
          m("div", g0, I(d(t)("config.field.axisPointer")), 1),
          k(f, {
            size: "small",
            checked: e.panel.showAxisPointer ?? !0,
            onChange: i[3] || (i[3] = (u) => e.onChange({ showAxisPointer: u }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), m0 = { class: "flex items-center gap-2" }, v0 = /* @__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 } = ot();
    function r(C) {
      return Math.min(n.max, Math.max(n.min, C));
    }
    const f = re(() => n.value ?? n.min), u = re(() => n.placeholder ?? a("common.auto")), c = re(() => {
      const C = n.value !== void 0 ? n.unit ? `${n.value}${n.unit}` : String(n.value) : u.value;
      try {
        const z = document.createElement("canvas").getContext("2d");
        return z ? (z.font = "14px system-ui, -apple-system, sans-serif", `${Math.ceil(z.measureText(C).width) + 24}px`) : "6ch";
      } catch {
        return "6ch";
      }
    });
    function p(C) {
      typeof C == "number" && i("change", r(C));
    }
    function y(C) {
      C != null && i("change", r(Number(C)));
    }
    function b() {
      i("change", void 0);
    }
    function v(C) {
      const z = C.shiftKey, T = n.step * (z ? n.shiftMultiplier : 1);
      C.key === "ArrowRight" || C.key === "ArrowUp" ? (C.preventDefault(), i("change", r(f.value + T))) : (C.key === "ArrowLeft" || C.key === "ArrowDown") && (C.preventDefault(), i("change", r(f.value - T)));
    }
    return (C, z) => (E(), B("div", m0, [
      k(d(bn), {
        min: e.min,
        max: e.max,
        step: e.step,
        value: f.value,
        style: { flex: "1" },
        "tooltip-formatter": e.unit ? ((T) => `${T}${e.unit}`) : void 0,
        onChange: p
      }, null, 8, ["min", "max", "step", "value", "tooltip-formatter"]),
      k(d(Wl).Compact, { size: "small" }, {
        default: R(() => [
          k(d(on), {
            size: "small",
            controls: !1,
            min: e.min,
            max: e.max,
            step: e.step,
            value: e.value ?? void 0,
            placeholder: u.value,
            style: He({ width: c.value }),
            suffix: e.unit && e.value !== void 0 ? e.unit : void 0,
            onKeydown: v,
            onChange: y
          }, null, 8, ["min", "max", "step", "value", "placeholder", "style", "suffix"]),
          e.allowClear && e.value !== void 0 ? (E(), Ce(d(tt), {
            key: 0,
            onClick: b
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).closeCircle, "text-xs text-gray-400 cursor-pointer"])
              }, null, 2)
            ]),
            _: 1
          })) : ye("", !0)
        ]),
        _: 1
      })
    ]));
  }
}), y0 = { class: "flex flex-col gap-3" }, b0 = { key: 0 }, x0 = { class: "text-xs text-secondary mb-1" }, w0 = { class: "text-xs text-secondary mb-1" }, S0 = { class: "text-xs text-secondary mb-1" }, k0 = { key: 1 }, C0 = { class: "text-xs text-secondary mb-1" }, _0 = { key: 2 }, z0 = { class: "text-xs text-secondary mb-1" }, M0 = /* @__PURE__ */ ze({
  __name: "ValueSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = ot(), a = ["", "ms", "s", "bytes", "percent", "percentunit", "reqps", "ops", "bps", "Bps"].map((c) => ({
      value: c,
      label: n(c ? `config.unit.${c}` : "config.unit.none")
    })), r = [
      { 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") }
    ], f = t.panel.type === "gauge", u = t.panel.type !== "timeseries";
    return (c, p) => (E(), B("div", y0, [
      u ? (E(), B("div", b0, [
        m("div", x0, I(d(n)("config.field.reducer")), 1),
        k(d(Qe), {
          size: "small",
          value: e.panel.statReducer ?? "lastNotNull",
          options: r,
          style: { width: "100%" },
          onChange: p[0] || (p[0] = (y) => e.onChange({ statReducer: y }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      m("div", null, [
        m("div", w0, I(d(n)("config.field.unit")), 1),
        k(d(Qe), {
          size: "small",
          value: e.panel.unit || "",
          options: d(a),
          style: { width: "100%" },
          onChange: p[1] || (p[1] = (y) => e.onChange({ unit: y }))
        }, null, 8, ["value", "options"])
      ]),
      m("div", null, [
        m("div", S0, I(d(n)("config.field.decimals")), 1),
        k(v0, {
          min: 0,
          max: 15,
          step: 1,
          value: e.panel.decimals,
          "allow-clear": !0,
          onChange: p[2] || (p[2] = (y) => e.onChange({ decimals: y }))
        }, null, 8, ["value"])
      ]),
      f ? (E(), B("div", k0, [
        m("div", C0, I(d(n)("config.field.min")), 1),
        k(d(on), {
          size: "small",
          value: e.panel.min,
          style: { width: "100%" },
          onChange: p[3] || (p[3] = (y) => e.onChange({ min: y ?? 0 }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      f ? (E(), B("div", _0, [
        m("div", z0, I(d(n)("config.field.max")), 1),
        k(d(on), {
          size: "small",
          value: e.panel.max,
          style: { width: "100%" },
          onChange: p[4] || (p[4] = (y) => e.onChange({ max: y ?? 100 }))
        }, null, 8, ["value"])
      ])) : ye("", !0)
    ]));
  }
}), T0 = { class: "h-full flex flex-col overflow-hidden" }, P0 = {
  class: "flex-shrink-0 px-2 bg-primary/10 py-1",
  style: { "border-bottom": "1px solid #eee" }
}, $0 = { class: "flex-1 overflow-y-auto" }, E0 = /* @__PURE__ */ ze({
  __name: "OptionsPane",
  setup(e) {
    const t = [
      "timeseries",
      "bar",
      "histogram",
      "stat",
      "gauge",
      "table",
      "pie"
    ], { t: n } = ot(), { panel: i, onChange: a, numericFieldNames: r, allFieldNames: f } = ao(), u = re(
      () => t.map((C) => ({
        value: C,
        label: n(`config.type.${C}`)
      }))
    ), c = fe(""), p = {
      general: Bu,
      style: Rb,
      tooltip: p0,
      axes: jv,
      value: M0,
      // timeseries / bar / histogram
      "bar-style": ey,
      "histogram-style": jy,
      // stat
      "stat-style": pb,
      // gauge
      "gauge-style": xy,
      // pie
      "pie-style": ub,
      // table
      "table-style": Zb,
      // overrides
      overrides: Hu
    }, y = re(() => {
      const z = (Of(i.value.type)?.optionCategories ?? []).map((T) => ({
        key: T.key,
        label: n(T.labelKey),
        component: p[T.key] ?? Bu
      }));
      return z.push({
        key: "thresholds",
        label: n("config.section.thresholds", { n: i.value.thresholds.length }),
        component: s0
      }), z.push({
        key: "overrides",
        label: n("config.section.overrides"),
        component: Hu
      }), z;
    }), b = re(() => {
      if (!c.value.trim())
        return y.value;
      const C = c.value.toLowerCase();
      return y.value.filter(
        (z) => typeof z.label == "string" && z.label.toLowerCase().includes(C)
      );
    }), v = fe(["general"]);
    return (C, z) => (E(), B("div", T0, [
      m("div", P0, [
        k(d(Qe), {
          class: "text-primary",
          bordered: !1,
          value: d(i).type,
          size: "small",
          variant: "filled",
          options: u.value,
          "onUpdate:value": z[0] || (z[0] = (T) => d(a)({ type: T }))
        }, null, 8, ["value", "options"])
      ]),
      m("div", $0, [
        k(d(Sa), {
          "active-key": v.value,
          "onUpdate:activeKey": z[1] || (z[1] = (T) => v.value = T),
          bordered: !1,
          accordion: "",
          size: "small"
        }, {
          default: R(() => [
            (E(!0), B(Pe, null, Xe(b.value, (T) => (E(), Ce(d(Sa).Panel, {
              key: T.key,
              header: T.label
            }, {
              default: R(() => [
                (E(), Ce(Zu(T.component), {
                  panel: d(i),
                  "on-change": d(a),
                  "numeric-field-names": d(r),
                  "all-field-names": d(f)
                }, null, 40, ["panel", "on-change", "numeric-field-names", "all-field-names"]))
              ]),
              _: 2
            }, 1032, ["header"]))), 128))
          ]),
          _: 1
        }, 8, ["active-key"])
      ])
    ]));
  }
}), wd = /* @__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 = re(() => t.links.filter((a) => a.url));
    return (a, r) => i.value.length === 0 ? (E(), B(Pe, { key: 0 }, [], 64)) : i.value.length === 1 ? (E(), Ce(d(Pn), {
      key: 1,
      title: i.value[0].title || i.value[0].url,
      placement: "bottom"
    }, {
      default: R(() => [
        m("span", {
          class: Ae([d(Me).link, "flex-shrink-0 cursor-pointer text-xs"]),
          style: He({ color: e.iconColor }),
          onClick: r[0] || (r[0] = $n((f) => n(i.value[0]), ["stop"]))
        }, null, 6)
      ]),
      _: 1
    }, 8, ["title"])) : (E(), Ce(d(Vo), {
      key: 2,
      trigger: ["hover", "click"],
      placement: "bottomLeft"
    }, {
      overlay: R(() => [
        k(d(ii), null, {
          default: R(() => [
            (E(!0), B(Pe, null, Xe(i.value, (f, u) => (E(), Ce(d(ii).Item, {
              key: u,
              onClick: (c) => n(f)
            }, {
              default: R(() => [
                ce(I(f.title || f.url), 1)
              ]),
              _: 2
            }, 1032, ["onClick"]))), 128))
          ]),
          _: 1
        })
      ]),
      default: R(() => [
        m("span", {
          class: Ae([d(Me).link, "flex-shrink-0 cursor-pointer text-xs"]),
          style: He({ color: e.iconColor }),
          onClick: r[1] || (r[1] = $n(() => {
          }, ["stop"]))
        }, null, 6)
      ]),
      _: 1
    }));
  }
}), I0 = {
  key: 0,
  class: "legend-search-container"
}, A0 = ["value"], O0 = { class: "legend-table-wrap" }, D0 = { class: "legend-table" }, q0 = ["data-legend-item-id"], L0 = { class: "legend-table-td legend-table-name-col" }, R0 = ["data-legend-tooltip"], N0 = { class: "legend-label" }, V0 = {
  key: 0,
  class: "legend-search-container"
}, F0 = ["value"], B0 = {
  key: 1,
  class: "legend-empty-state"
}, H0 = { class: "virtuoso-grid-list" }, W0 = ["data-legend-item-id"], j0 = ["data-legend-tooltip"], G0 = { class: "legend-label" }, Y0 = {
  key: 0,
  class: "legend-item-values"
}, U0 = { class: "legend-item-value-key" }, K0 = { class: "legend-item-value-num" }, X0 = ["data-legend-tooltip", "onClick"], Q0 = {
  key: 0,
  width: "12",
  height: "12",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2"
}, J0 = {
  key: 1,
  width: "12",
  height: "12",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2"
}, Z0 = /* @__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 = fe(null), i = fe(""), a = fe(null), r = fe(!1), f = fe(), u = fe({});
    function c(J) {
      const K = {};
      J.series.forEach((A, Z) => {
        Z !== 0 && (K[Z] = A.show ?? !0);
      }), u.value = { ...K };
    }
    function p(J, K, A) {
      !K || typeof A.show != "boolean" || (u.value = { ...u.value, [K]: A.show });
    }
    Fe(
      () => t.uPlotInstance,
      (J, K) => {
        if (K && (K.hooks.setSeries = (K.hooks.setSeries ?? []).filter(
          (A) => A.__legendSync !== !0
        )), J) {
          c(J);
          const A = (Z, Y, $) => p(Z, Y, $);
          A.__legendSync = !0, J.hooks.setSeries = [...J.hooks.setSeries ?? [], A];
        } else
          u.value = {};
      },
      { immediate: !0 }
    );
    const y = {
      last: "Last *",
      first: "First *",
      min: "Min",
      max: "Max",
      mean: "Avg",
      sum: "Sum"
    };
    function b(J) {
      const K = J.filter(
        (Z) => Z != null && !Number.isNaN(Z)
      );
      if (K.length === 0)
        return { last: null, first: null, min: null, max: null, mean: null, sum: null };
      const A = K.reduce((Z, Y) => Z + Y, 0);
      return {
        last: K[K.length - 1],
        first: K[0],
        min: Math.min(...K),
        max: Math.max(...K),
        mean: A / K.length,
        sum: A
      };
    }
    function v(J, K) {
      return J === null ? "—" : Math.abs(J) >= 1e6 ? K !== void 0 ? `${(J / 1e6).toFixed(K)}M` : `${J / 1e6}M` : Math.abs(J) >= 1e3 ? K !== void 0 ? `${(J / 1e3).toFixed(K)}K` : `${J / 1e3}K` : K !== void 0 ? J.toFixed(K) : String(J);
    }
    const C = re(
      () => Object.values(t.items).map((J) => ({
        ...J,
        show: u.value[J.seriesIndex] ?? J.show ?? !0
      }))
    ), z = re(() => {
      if (t.position !== "right" || !i.value.trim())
        return C.value;
      const J = i.value.trim().toLowerCase();
      return C.value.filter((K) => K.label?.toLowerCase().includes(J));
    }), T = re(() => t.position !== "right" || !i.value.trim() ? !1 : z.value.length === 0), q = re(() => {
      if (!t.data || t.values.length === 0)
        return {};
      const J = {};
      return C.value.forEach((K) => {
        const A = t.data[K.seriesIndex];
        J[K.seriesIndex] = b(A ?? []);
      }), J;
    }), { onToggleSeriesOnOff: Q, onToggleSeriesVisibility: F } = {
      onToggleSeriesOnOff(J) {
        const K = t.uPlotInstance;
        if (!K)
          return;
        const A = K.series[J];
        A && K.setSeries(J, { show: !A.show });
      },
      onToggleSeriesVisibility(J) {
        const K = t.uPlotInstance;
        if (!K)
          return;
        const A = n.value === J;
        K.series.forEach((Z, Y) => {
          Y !== 0 && K.setSeries(Y, { show: A || Y === J });
        }), n.value = A ? null : J;
      }
    };
    function U(J) {
      const K = J.target.closest("[data-legend-item-id]");
      if (!K)
        return null;
      const A = Number(K.dataset.legendItemId);
      return Number.isNaN(A) ? null : A;
    }
    function O(J) {
      const K = U(J);
      if (K === null)
        return;
      if (!!J.target.dataset.isLegendMarker) {
        Q(K);
        return;
      }
      F(K);
    }
    async function W(J, K) {
      try {
        await navigator.clipboard.writeText(K), a.value = J, setTimeout(() => {
          a.value = null;
        }, 2e3);
      } catch {
      }
    }
    function te(J) {
      const K = J.target;
      i.value = K.value;
    }
    function M() {
      if (!f.value || t.position !== "bottom") {
        r.value = !1;
        return;
      }
      const K = f.value.clientWidth;
      if (K === 0)
        return;
      const A = C.value.length * (t.averageLegendWidth + 16);
      r.value = Math.ceil(A / K) <= 1;
    }
    let G = null;
    return In(() => {
      M(), f.value && t.position === "bottom" && (G = new ResizeObserver(M), G.observe(f.value));
    }), Ui(() => {
      G && G.disconnect();
    }), Fe([() => t.averageLegendWidth, () => C.value.length, () => t.position], () => {
      M();
    }), (J, K) => e.mode === "table" && e.values.length > 0 ? (E(), B("div", {
      key: 0,
      ref_key: "legendContainerRef",
      ref: f,
      class: "legend-container legend-table-mode",
      onClick: O
    }, [
      e.position === "right" ? (E(), B("div", I0, [
        m("input", {
          type: "text",
          placeholder: "Search...",
          value: i.value,
          class: "legend-search-input",
          onInput: te
        }, null, 40, A0)
      ])) : ye("", !0),
      m("div", O0, [
        m("table", D0, [
          m("thead", null, [
            m("tr", null, [
              K[0] || (K[0] = m("th", { class: "legend-table-th legend-table-name-col" }, " Name ", -1)),
              (E(!0), B(Pe, null, Xe(e.values, (A) => (E(), B("th", {
                key: A,
                class: "legend-table-th legend-table-val-col"
              }, I(y[A]), 1))), 128))
            ])
          ]),
          m("tbody", null, [
            (E(!0), B(Pe, null, Xe(z.value, (A) => (E(), B("tr", {
              key: A.seriesIndex,
              "data-legend-item-id": A.seriesIndex,
              class: Ae(["legend-table-row", [
                A.show ? "" : "legend-item-off",
                n.value === A.seriesIndex ? "legend-item-focused" : ""
              ]])
            }, [
              m("td", L0, [
                m("div", {
                  class: "legend-item-label-trigger",
                  "data-legend-tooltip": A.label
                }, [
                  m("div", {
                    class: "legend-marker",
                    style: He({ borderColor: A.color }),
                    "data-is-legend-marker": !0
                  }, null, 4),
                  m("span", N0, I(A.label), 1)
                ], 8, R0)
              ]),
              (E(!0), B(Pe, null, Xe(e.values, (Z) => (E(), B("td", {
                key: Z,
                class: "legend-table-td legend-table-val-col"
              }, I(q.value[A.seriesIndex] ? v(q.value[A.seriesIndex][Z], e.decimals) : "—"), 1))), 128))
            ], 10, q0))), 128))
          ])
        ])
      ])
    ], 512)) : (E(), B("div", {
      key: 1,
      ref_key: "legendContainerRef",
      ref: f,
      class: Ae(["legend-container", [e.position === "bottom" ? "legend-container-bottom" : ""]]),
      style: He({ "--legend-average-width": `${e.averageLegendWidth + 16}px` }),
      onClick: O
    }, [
      e.position === "right" ? (E(), B("div", V0, [
        m("input", {
          type: "text",
          placeholder: "Search...",
          value: i.value,
          class: "legend-search-input",
          onInput: te
        }, null, 40, F0)
      ])) : ye("", !0),
      T.value ? (E(), B("div", B0, ' No series found matching "' + I(i.value) + '" ', 1)) : (E(), B("div", {
        key: 2,
        class: Ae(["legend-virtuoso-container", [
          `legend-virtuoso-container-${e.position}`,
          r.value ? "legend-virtuoso-container-single-row" : ""
        ]])
      }, [
        m("div", H0, [
          (E(!0), B(Pe, null, Xe(z.value, (A) => (E(), B("div", {
            key: A.seriesIndex,
            class: "virtuoso-grid-item"
          }, [
            m("div", {
              "data-legend-item-id": A.seriesIndex,
              class: Ae(["legend-item", [
                `legend-item-${e.position}`,
                A.show ? "" : "legend-item-off",
                n.value === A.seriesIndex ? "legend-item-focused" : ""
              ]])
            }, [
              m("div", {
                class: "legend-item-label-trigger",
                "data-legend-tooltip": A.label
              }, [
                m("div", {
                  class: "legend-marker",
                  style: He({ borderColor: A.color }),
                  "data-is-legend-marker": !0
                }, null, 4),
                m("span", G0, I(A.label), 1)
              ], 8, j0),
              q.value[A.seriesIndex] && e.values.length > 0 ? (E(), B("span", Y0, [
                (E(!0), B(Pe, null, Xe(e.values, (Z) => (E(), B("span", {
                  key: Z,
                  class: "legend-item-value-badge"
                }, [
                  m("span", U0, I(y[Z]) + ":", 1),
                  m("span", K0, I(v(q.value[A.seriesIndex][Z], e.decimals)), 1)
                ]))), 128))
              ])) : ye("", !0),
              m("button", {
                type: "button",
                class: "legend-copy-button",
                "data-legend-tooltip": a.value === A.seriesIndex ? "Copied" : "Copy",
                onClick: $n((Z) => W(A.seriesIndex, A.label ?? ""), ["stop"])
              }, [
                a.value === A.seriesIndex ? (E(), B("svg", Q0, [...K[1] || (K[1] = [
                  m("path", { d: "M20 6L9 17l-5-5" }, null, -1)
                ])])) : (E(), B("svg", J0, [...K[2] || (K[2] = [
                  m("rect", {
                    x: "9",
                    y: "9",
                    width: "13",
                    height: "13",
                    rx: "2",
                    ry: "2"
                  }, null, -1),
                  m("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, X0)
            ], 10, W0)
          ]))), 128))
        ])
      ], 2))
    ], 6));
  }
}), e1 = /* @__PURE__ */ xn(Z0, [["__scopeId", "data-v-85a1707f"]]), t1 = { class: "footer" }, n1 = {
  key: 0,
  class: "hint"
}, i1 = { class: "kbd active" }, l1 = {
  key: 1,
  class: "hint-list"
}, o1 = {
  class: "hint",
  "data-active": "false"
}, a1 = { class: "kbd" }, s1 = /* @__PURE__ */ ze({
  __name: "TooltipFooter",
  props: {
    isPinned: { type: Boolean },
    pinKey: { default: "P" }
  },
  emits: ["dismiss"],
  setup(e, { emit: t }) {
    const n = t;
    return (i, a) => (E(), B("div", t1, [
      m("div", null, [
        e.isPinned ? (E(), B("div", n1, [
          a[1] || (a[1] = m("span", null, "按", -1)),
          m("kbd", i1, I(e.pinKey), 1),
          a[2] || (a[2] = m("span", null, "或", -1)),
          a[3] || (a[3] = m("kbd", { class: "kbd active" }, "Esc", -1)),
          a[4] || (a[4] = m("span", null, "取消固定", -1))
        ])) : (E(), B("div", l1, [
          m("div", o1, [
            a[5] || (a[5] = m("span", null, "按", -1)),
            m("kbd", a1, I(e.pinKey), 1),
            a[6] || (a[6] = m("span", null, "固定提示框", -1))
          ])
        ]))
      ]),
      e.isPinned ? (E(), B("button", {
        key: 0,
        class: "unpin-btn",
        onClick: a[0] || (a[0] = (r) => n("dismiss"))
      }, [...a[7] || (a[7] = [
        m("svg", {
          width: "10",
          height: "10",
          viewBox: "0 0 24 24",
          fill: "none",
          stroke: "currentColor",
          "stroke-width": "2"
        }, [
          m("path", { d: "M18 6L6 18" }),
          m("path", { d: "M6 6l12 12" })
        ], -1),
        m("span", null, "取消固定", -1)
      ])])) : ye("", !0)
    ]));
  }
}), r1 = /* @__PURE__ */ xn(s1, [["__scopeId", "data-v-75c52e2f"]]), u1 = ["data-is-active"], c1 = { class: "tooltip-item-label" }, d1 = /* @__PURE__ */ ze({
  __name: "TooltipItem",
  props: {
    item: {},
    isItemActive: { type: Boolean }
  },
  setup(e) {
    return (t, n) => (E(), B("div", {
      class: "tooltip-item",
      "data-is-active": e.isItemActive
    }, [
      m("div", {
        class: "tooltip-item-marker",
        style: He({ borderColor: e.item.color })
      }, null, 4),
      m("div", {
        class: "tooltip-item-content",
        style: He({ color: e.item.color })
      }, [
        m("span", c1, I(e.item.label), 1),
        m("span", {
          class: "tooltip-item-separator",
          style: He({ borderColor: e.item.color })
        }, null, 4),
        m("span", null, I(e.item.tooltipValue), 1)
      ], 4)
    ], 8, u1));
  }
}), Sd = /* @__PURE__ */ xn(d1, [["__scopeId", "data-v-3b1d92d5"]]), f1 = { class: "header-container" }, h1 = {
  key: 0,
  class: "header-row"
}, g1 = {
  key: 0,
  class: "header-status"
}, p1 = {
  key: 1,
  class: "header-pinned-item"
}, m1 = /* @__PURE__ */ ze({
  __name: "TooltipHeader",
  props: {
    uPlotInstance: {},
    showTooltipHeader: { type: Boolean },
    isPinned: { type: Boolean },
    activeItem: {},
    headerTitle: {}
  },
  setup(e) {
    return (t, n) => (E(), B("div", f1, [
      e.showTooltipHeader && e.headerTitle ? (E(), B("div", h1, [
        m("span", null, I(e.headerTitle), 1),
        e.isPinned ? (E(), B("div", g1, [...n[0] || (n[0] = [
          m("svg", {
            width: "12",
            height: "12",
            viewBox: "0 0 24 24",
            fill: "none",
            stroke: "currentColor",
            "stroke-width": "2"
          }, [
            m("path", { d: "M12 2v4" }),
            m("path", { d: "M19 10h-7l-5 5v7h10v-7l-5-5z" })
          ], -1),
          m("span", null, "已固定", -1)
        ])])) : ye("", !0)
      ])) : ye("", !0),
      e.activeItem ? (E(), B("div", p1, [
        k(Sd, {
          item: e.activeItem,
          "is-item-active": !0
        }, null, 8, ["item"])
      ])) : ye("", !0)
    ]));
  }
}), v1 = /* @__PURE__ */ xn(m1, [["__scopeId", "data-v-efb4cf97"]]), y1 = /* @__PURE__ */ ze({
  __name: "TooltipList",
  props: {
    content: {},
    maxHeight: { default: 300 }
  },
  setup(e) {
    return (t, n) => (E(), B("div", {
      class: "tooltip-list",
      style: He({ maxHeight: `${e.maxHeight}px`, overflowY: "auto" })
    }, [
      (E(!0), B(Pe, null, Xe(e.content, (i) => (E(), Ce(Sd, {
        key: i.label,
        item: i,
        "is-item-active": !1
      }, null, 8, ["item"]))), 128))
    ], 4));
  }
}), b1 = /* @__PURE__ */ xn(y1, [["__scopeId", "data-v-fa17493a"]]), x1 = {
  key: 1,
  class: "tooltip-divider"
}, w1 = /* @__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 = re(() => n.content.find((c) => c.isActive) ?? null), r = re(() => n.showTooltipHeader || a.value != null), f = re(() => n.content.length > 1), u = re(() => f.value && r.value);
    return (c, p) => (E(), B("div", {
      class: Ae(["tooltip-container", { pinned: e.isPinned }])
    }, [
      r.value ? (E(), Ce(v1, {
        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"])) : ye("", !0),
      u.value ? (E(), B("span", x1)) : ye("", !0),
      f.value ? (E(), Ce(b1, {
        key: 2,
        content: e.content,
        "max-height": e.tooltipMaxHeight
      }, null, 8, ["content", "max-height"])) : ye("", !0),
      e.canPinTooltip ? (E(), Ce(r1, {
        key: 3,
        "is-pinned": e.isPinned,
        style: He({ pointerEvents: e.isPinned ? "auto" : "none" }),
        onDismiss: p[0] || (p[0] = (y) => i("dismiss"))
      }, null, 8, ["is-pinned", "style"])) : ye("", !0)
    ], 2));
  }
}), S1 = /* @__PURE__ */ xn(w1, [["__scopeId", "data-v-4b92f289"]]), k1 = /* @__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 = fe(), i = fe(!1), a = fe(!1), r = fe(""), f = fe([]), u = {
      hoverActive: !1,
      pinned: !1,
      focusedSeriesIndex: null,
      seriesIndexes: [],
      mouseWithinPlot: !1,
      windowWidth: window.innerWidth - 16,
      windowHeight: window.innerHeight - 16,
      tooltipW: 0,
      tooltipH: 0
    };
    let c = null;
    function p() {
      c === null && (c = requestAnimationFrame(() => {
        c = null, T();
      }));
    }
    function y(Y, $, j) {
      return typeof Y == "function" ? String(Y($, j)) : typeof Y == "string" ? Y : "#cccccc";
    }
    function b(Y, $, j) {
      const ue = j !== void 0 ? Y.toFixed(j) : String(Math.round(Y * 1e3) / 1e3);
      return $ ? `${ue} ${$}` : ue;
    }
    function v(Y) {
      if (t.tooltipMode === "none")
        return [];
      const $ = Y.cursor.idx, j = [];
      for (let ue = 1; ue < Y.series.length; ue++) {
        const ie = Y.series[ue];
        if (!ie?.show)
          continue;
        let Ee = u.seriesIndexes[ue] ?? null;
        if (t.tooltipMode === "single") {
          if (ue !== u.focusedSeriesIndex)
            continue;
          Ee = $ ?? Ee;
        } else
          Ee = Ee ?? $ ?? null;
        if (Ee === null)
          continue;
        const me = Y.data[ue]?.[Ee];
        me == null || !Number.isFinite(me) || j.push({
          label: String(ie.label ?? `Series ${ue}`),
          value: me,
          tooltipValue: b(me, t.unit, t.decimals),
          color: y(ie.stroke, Y, ue),
          isActive: ue === u.focusedSeriesIndex
        });
      }
      return t.tooltipSort === "asc" && j.sort((ue, ie) => ue.value - ie.value), t.tooltipSort === "desc" && j.sort((ue, ie) => ie.value - ue.value), j;
    }
    function C(Y) {
      if (!t.showTooltipHeader)
        return "";
      const $ = Y.cursor.idx;
      if ($ == null)
        return "";
      const j = Y.data[0]?.[$];
      return j == null ? "" : Y.scales.x?.time ? new Date(j * 1e3).toLocaleString() : String(j);
    }
    function z(Y) {
      const $ = n.value;
      if (!$)
        return;
      const { left: j = -1, top: ue = -1 } = Y.cursor;
      if (j < 0 || ue < 0)
        return;
      const ie = Y.rect.left + j, Ee = Y.rect.top + ue, me = $.offsetWidth, ge = $.offsetHeight;
      u.tooltipW = me, u.tooltipH = ge;
      const le = ie + 14 + me > u.windowWidth ? -(me + 14) : 14, ve = Ee - 8 + ge > u.windowHeight ? -(ge - 8) : -8;
      $.style.transform = `translate(${ie + le}px, ${Ee + ve}px)`;
    }
    function T() {
      const Y = t.uPlotInstance;
      if (!Y || !u.hoverActive && !u.pinned) {
        i.value = !1;
        return;
      }
      const $ = v(Y);
      if ($.length === 0) {
        u.pinned || (i.value = !1);
        return;
      }
      f.value = $, r.value = C(Y), a.value = u.pinned, u.pinned || z(Y), i.value = !0;
    }
    function q(Y) {
      if (u.pinned)
        return;
      const $ = Y.cursor.idxs;
      $ && (u.seriesIndexes = [...$], u.hoverActive = u.seriesIndexes.some((j, ue) => ue > 0 && j != null) && u.focusedSeriesIndex != null, p());
    }
    function Q(Y, $, j) {
      !("focus" in j) || u.pinned || (u.focusedSeriesIndex = $ ?? null, u.hoverActive = u.focusedSeriesIndex != null, p());
    }
    function F(Y) {
      if (u.pinned || !u.hoverActive)
        return;
      const $ = n.value;
      if (!$)
        return;
      const { left: j = -1, top: ue = -1 } = Y.cursor;
      if (j < 0 || ue < 0)
        return;
      const ie = Y.rect.left + j, Ee = Y.rect.top + ue, me = $.offsetWidth, ge = $.offsetHeight;
      u.tooltipW = me, u.tooltipH = ge;
      const le = ie + 14 + me > u.windowWidth ? -(me + 14) : 14, ve = Ee - 8 + ge > u.windowHeight ? -(ge - 8) : -8;
      $.style.transform = `translate(${ie + le}px, ${Ee + ve}px)`;
    }
    function U() {
      const Y = t.uPlotInstance;
      !Y || !u.hoverActive || (u.pinned = !0, Y.cursor._lock = !0, a.value = !0, document.addEventListener("mousedown", W, !0));
    }
    function O() {
      const Y = t.uPlotInstance;
      u.pinned = !1, u.hoverActive = !1, Y && (Y.cursor._lock = !1), a.value = !1, i.value = !1, document.removeEventListener("mousedown", W, !0);
    }
    function W(Y) {
      n.value && !n.value.contains(Y.target) && O();
    }
    function te(Y) {
      if (Y.key === "Escape") {
        u.pinned && O();
        return;
      }
      Y.key.toLowerCase() === "p" && u.mouseWithinPlot && (u.pinned ? O() : U());
    }
    function M() {
      u.mouseWithinPlot = !0;
    }
    function G() {
      u.mouseWithinPlot = !1;
    }
    function J() {
      u.windowWidth = window.innerWidth - 16, u.windowHeight = window.innerHeight - 16, u.pinned || (u.hoverActive = !1);
    }
    let K = [];
    function A(Y) {
      const $ = (ie) => q(ie), j = (ie, Ee, me) => Q(ie, Ee, me), ue = (ie) => F(ie);
      Y.hooks.setLegend = [...Y.hooks.setLegend ?? [], $], Y.hooks.setSeries = [...Y.hooks.setSeries ?? [], j], Y.hooks.setCursor = [...Y.hooks.setCursor ?? [], ue], Y.root.addEventListener("mouseenter", M), Y.root.addEventListener("mouseleave", G), K = [
        () => {
          Y.hooks.setLegend = (Y.hooks.setLegend ?? []).filter(
            (ie) => ie !== $
          ), Y.hooks.setSeries = (Y.hooks.setSeries ?? []).filter(
            (ie) => ie !== j
          ), Y.hooks.setCursor = (Y.hooks.setCursor ?? []).filter(
            (ie) => ie !== ue
          ), Y.root.removeEventListener("mouseenter", M), Y.root.removeEventListener("mouseleave", G);
        }
      ];
    }
    function Z() {
      K.forEach((Y) => Y()), K = [], document.removeEventListener("mousedown", W, !0), u.hoverActive = !1, u.pinned = !1, u.focusedSeriesIndex = null, i.value = !1, a.value = !1, c !== null && (cancelAnimationFrame(c), c = null);
    }
    return Fe(
      () => t.uPlotInstance,
      (Y, $) => {
        $ && Z(), Y && A(Y);
      },
      { immediate: !0 }
    ), In(() => {
      document.addEventListener("keydown", te, !0), window.addEventListener("resize", J);
    }), Ui(() => {
      Z(), document.removeEventListener("keydown", te, !0), window.removeEventListener("resize", J);
    }), (Y, $) => (E(), Ce(Od, { to: "body" }, [
      Qu(m("div", {
        ref_key: "containerRef",
        ref: n,
        style: { position: "fixed", top: "0", left: "0", "z-index": "1070", "pointer-events": "none" }
      }, [
        e.uPlotInstance ? (E(), Ce(S1, {
          key: 0,
          "u-plot-instance": e.uPlotInstance,
          content: f.value,
          "header-title": r.value,
          "is-pinned": a.value,
          "can-pin-tooltip": e.canPinTooltip,
          "show-tooltip-header": e.showTooltipHeader,
          "tooltip-max-height": e.tooltipMaxHeight,
          onDismiss: O
        }, null, 8, ["u-plot-instance", "content", "header-title", "is-pinned", "can-pin-tooltip", "show-tooltip-header", "tooltip-max-height"])) : ye("", !0)
      ], 512), [
        [Ju, i.value && e.tooltipMode !== "none"]
      ])
    ]));
  }
}), kd = Symbol("plotContext");
function C1() {
  const e = fe(null), t = fe(""), n = fe(!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 r() {
    const y = e.value;
    if (!y || !t.value)
      return;
    const b = y.series.map((v) => ({
      label: v.label ?? "",
      show: v.show ?? !0
    }));
    Gg(t.value, b);
  }
  function f(y) {
    const b = e.value;
    if (!b)
      return;
    const v = i === y;
    i = v ? void 0 : y, b.batch(() => {
      b.series.forEach((C, z) => {
        z !== 0 && b.setSeries(z, {
          show: v || z === y
        });
      }), t.value && n.value && r();
    });
  }
  function u(y) {
    const b = e.value;
    if (!b)
      return;
    const v = b.series[y];
    v && (b.setSeries(y, { show: !v.show }), t.value && n.value && r());
  }
  function c(y) {
    const b = e.value;
    b && b.batch(() => {
      b.series.forEach((v, C) => {
        C !== 0 && b.setSeries(C, {
          show: y === null || C === y
        });
      });
    });
  }
  const p = {
    uPlotInstance: e,
    id: t,
    shouldSaveSelectionPreference: n,
    setPlotContextInitialState: a,
    onToggleSeriesVisibility: f,
    onToggleSeriesOnOff: u,
    onFocusSeries: c,
    syncSeriesVisibilityToLocalStorage: r
  };
  return yl(kd, p), p;
}
function XC() {
  const e = vl(kd);
  if (!e)
    throw new Error("usePlotContext must be used within a PlotContextProvider");
  return e;
}
const _1 = { style: { position: "relative", overflow: "hidden" } }, z1 = /* @__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: r } = C1(), f = fe(), u = fe(null), c = fe(""), p = fe(""), y = fe(0), b = fe(0);
    function v() {
      u.value && (i.onDestroy && i.onDestroy(u.value), u.value.destroy(), u.value = null, r({ uPlotInstance: null }), i.plotRef && i.plotRef(null));
    }
    function C(W) {
      if (W === null || typeof W != "object")
        return W;
      const te = Za(W);
      if (te instanceof Date)
        return new Date(te.getTime());
      if (te instanceof RegExp)
        return new RegExp(te.source, te.flags);
      if (typeof te == "function")
        return te;
      if (Array.isArray(te)) {
        const G = [];
        for (let J = 0; J < te.length; J++)
          G.push(C(Za(te[J])));
        return G;
      }
      const M = {};
      for (const G in te)
        Object.prototype.hasOwnProperty.call(te, G) && (M[G] = C(Za(te[G])));
      return M;
    }
    function z() {
      if (v(), !f.value || i.width === 0 || i.height === 0)
        return;
      const W = i.config.getConfig(), M = C({
        ...W,
        width: Math.floor(i.width),
        height: Math.floor(i.height),
        series: W.series ?? []
      }), G = q(i.data, i.config), J = new tn(M, G, f.value);
      i.plotRef && i.plotRef(J), r({
        uPlotInstance: J,
        id: i.config.getId(),
        shouldSaveSelectionPreference: i.config.getShouldSaveSelectionPreference()
      }), u.value = J, a("plotReady", J), c.value = JSON.stringify(i.config.getConfig()), p.value = JSON.stringify(i.data), y.value = i.width, b.value = i.height;
    }
    function T(W) {
      return JSON.parse(JSON.stringify(W));
    }
    function q(W, te) {
      const M = T(W), G = te.getSeriesSpanGapsOptions();
      return G.length > 0 ? Wg(M, G) : M;
    }
    function Q() {
      return i.width === y.value && i.height === b.value;
    }
    function F() {
      return JSON.stringify(i.data) === p.value;
    }
    function U() {
      return JSON.stringify(i.config.getConfig()) === c.value;
    }
    const O = re(() => !!(i.data && i.data[0] && i.data[0].length === 0));
    return Fe(O, (W) => {
      W && v();
    }), wa((W) => {
      if (W(() => {
        v(), c.value = "", p.value = "", y.value = 0, b.value = 0;
      }), !f.value || i.width === 0 || i.height === 0)
        return;
      if (!c.value) {
        z();
        return;
      }
      const te = !!u.value && (!f.value || u.value.root.parentElement !== f.value);
      if (!Q() && u.value && !te && u.value.setSize({
        width: Math.floor(i.width),
        height: Math.floor(i.height)
      }), !U() || te)
        z();
      else if (!F() && u.value) {
        const M = q(i.data, i.config);
        u.value.setData(M);
      }
    }), no(() => {
      v();
    }), t({ plotInstance: u }), (W, te) => (E(), B("div", _1, [
      O.value ? (E(), B("div", {
        key: 0,
        class: "flex flex-col items-center justify-center not-found",
        style: He({
          width: `${e.width}px`,
          height: `${e.height}px`
        })
      }, [
        m("div", {
          class: Ae([d(Me).chartLine, "mb-2"]),
          style: { "font-size": "48px" }
        }, null, 2),
        te[0] || (te[0] = m("div", { class: "text-gray-400 text-sm" }, " No Data ", -1))
      ], 4)) : (E(), B("div", {
        key: 1,
        ref_key: "containerRef",
        ref: f,
        class: "w-full h-full"
      }, null, 512)),
      zi(W.$slots, "default")
    ]));
  }
}), M1 = {
  key: 0,
  class: "flex items-center justify-center h-full text-gray-400 select-none"
}, T1 = { class: "flex-1 min-h-0 min-w-0 relative overflow-hidden" }, P1 = {
  key: 2,
  class: "flex items-center justify-center h-full text-red-500 select-none"
}, $1 = { class: "text-xs" }, nr = /* @__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 = fe(), i = fe({ width: 0, height: 0 });
    let a = null;
    function r(q) {
      a = new ResizeObserver((Q) => {
        const F = Q[0];
        if (F) {
          const { width: U, height: O } = F.contentRect;
          i.value = { width: Math.floor(U), height: Math.floor(O) };
        }
      }), a.observe(q), requestAnimationFrame(() => {
        const { width: Q, height: F } = q.getBoundingClientRect();
        i.value = { width: Math.floor(Q), height: Math.floor(F) };
      });
    }
    In(() => {
      n.value && r(n.value);
    }), Fe(n, (q) => {
      a?.disconnect(), q && r(q);
    }), no(() => {
      a?.disconnect();
    });
    const f = re(() => {
      const q = new Bg({ id: t.panelId ?? "chart" }), Q = t.scaleDistribution ?? "linear", F = t.stackingMode !== "none";
      q.addScale({ scaleKey: "x", time: t.xAxisTime }), q.addScale({
        scaleKey: "y",
        distribution: Q === "logarithmic" ? jl.Logarithmic : Q === "symlog" ? jl.Symlog : jl.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, Je, Ge) => {
            const mt = Math.max(Math.abs(Je), Math.abs(Ge));
            return [-mt, mt];
          }
        } : {}
      });
      const U = t.gridColor ?? "#E8E9EA", O = t.showGridLines === "all" || t.showGridLines === "x", W = t.showGridLines === "all" || t.showGridLines === "y", te = t.axisLabel === "all" || t.axisLabel === "x", M = t.axisLabel === "all" || t.axisLabel === "y", G = te ? t.axisLabelColor ?? "#666666" : "transparent", J = M ? t.axisLabelColor ?? "#666666" : "transparent", K = t.axisTick === "all" || t.axisTick === "x", A = t.axisTick === "all" || t.axisTick === "y", Z = K ? t.axisTickColor ?? "#666666" : "transparent", Y = A ? t.axisTickColor ?? "#666666" : "transparent", $ = t.axisBorder === "all" || t.axisBorder === "x", j = t.axisBorder === "all" || t.axisBorder === "y", ue = t.axisBorderColor ?? "#666666";
      q.addAxis({
        scaleKey: "x",
        side: 2,
        size: 28,
        stroke: G,
        grid: { show: O, stroke: U },
        ticks: { show: K, stroke: Z, width: 0.5 },
        border: { show: $, stroke: ue }
      });
      const ie = t.axisPlacement === "right" ? 1 : 3, Ee = t.axisPlacement !== "hidden", me = (() => {
        if (t.axisWidth !== void 0 && t.axisWidth !== null)
          return t.axisWidth;
        const qe = t.data.series.reduce((ft, Tt) => ft.concat(Tt.values.filter((ut) => ut !== null && Number.isFinite(ut))), []);
        if (qe.length === 0)
          return 56;
        const Je = Math.max(...qe.map(Math.abs)), Ge = t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15, It = ((ft) => {
          if (Math.abs(ft) >= 1e6) {
            const ut = Ge !== void 0 ? (ft / 1e6).toFixed(Ge) : String(ft / 1e6);
            return t.unit ? `${ut}M ${t.unit}` : `${ut}M`;
          }
          if (Math.abs(ft) >= 1e3) {
            const ut = Ge !== void 0 ? (ft / 1e3).toFixed(Ge) : String(ft / 1e3);
            return t.unit ? `${ut}K ${t.unit}` : `${ut}K`;
          }
          const Tt = Ge !== void 0 ? ft.toFixed(Ge) : String(Math.round(ft * 100) / 100);
          return t.unit ? `${Tt} ${t.unit}` : Tt;
        })(Je);
        try {
          const ft = document.createElement("canvas").getContext("2d");
          if (!ft)
            return 56;
          ft.font = "12px system-ui, sans-serif";
          const Tt = ft.measureText(It).width;
          return Math.ceil(Tt) + 14;
        } catch {
          return 56;
        }
      })(), ge = t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15;
      q.addAxis({
        scaleKey: "y",
        side: ie,
        show: Ee,
        label: t.axisName || void 0,
        size: me,
        stroke: J,
        grid: { show: W, stroke: U },
        ticks: { show: A, stroke: Y, width: 0.5 },
        border: { show: j, stroke: ue },
        isDarkMode: !0,
        yAxisUnit: t.unit,
        decimalPrecision: ge,
        isLogScale: Q === "logarithmic" || Q === "symlog"
      });
      const le = $f(
        t.colorScheme,
        t.data.series.length,
        t.colorDistribution ?? "sequential",
        t.colorSingleValue
      ), ve = t.drawStyle === "bars", Oe = t.drawStyle === "points", xe = t.data.series.length, ke = t.barGroupWidth ?? 0.7, se = t.barWidth ?? (t.stackingMode !== "none" ? 1 : 1 / Math.max(xe, 1)), oe = ve ? ke * se : void 0, Te = Oe || t.showPointsMode === "always" ? !0 : t.showPointsMode === "never" ? !1 : t.showPoints, be = F ? "none" : t.fillOpacity > 0 ? t.gradientMode !== "none" ? "gradient" : "solid" : "none";
      if (t.data.series.forEach((qe, Je) => {
        const Ge = le[Je] ?? ji[Je % ji.length];
        q.addSeries({
          scaleKey: "y",
          label: qe.label,
          drawStyle: ve ? "bars" : Oe ? "points" : "lines",
          lineColor: Ge,
          lineWidth: t.lineWidth,
          lineInterpolation: t.lineInterpolation,
          lineStyle: t.lineStyle,
          fillColor: Ge,
          fillOpacity: t.fillOpacity,
          fillMode: be,
          showPoints: Te,
          pointSize: Te ? 4 : 0,
          spanGaps: t.spanNulls ?? !1,
          ...oe !== void 0 ? { barWidthFactor: oe } : {}
        });
      }), F && t.data.series.length > 0 && t.fillOpacity > 0) {
        const qe = le.length > 0 ? le : [...ji], Je = 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), Ge = t.data.series.map((mt, It) => ({
          series: [It + 1, It],
          fill: `${qe[It % qe.length]}${Je}`
        }));
        Ge.length > 0 && (Ge[0] = { series: [1, 0], fill: `${qe[0]}${Je}` }), q.setBands(Ge);
      }
      return t.syncKey && q.setCursor({ sync: { key: t.syncKey, setSeries: !0 } }), t.showAxisPointer || q.setCursor({ x: !1, y: !1 }), q.setCursor({
        drag: { setScale: !0 },
        points: {
          one: !0,
          size: (qe, Je) => (qe.series[Je]?.points?.size ?? 0) * 3,
          width: (qe, Je, Ge) => Ge / 4,
          stroke: (qe, Je) => {
            const Ge = qe.series[Je]?.points, mt = typeof Ge?.stroke == "function" ? Ge.stroke : void 0;
            return `${mt !== void 0 ? mt(qe, Je) : typeof Ge?.stroke == "string" ? Ge.stroke : ""}90`;
          },
          fill: "#fff"
        },
        focus: {
          prox: 30
        },
        hover: {
          prox: 30,
          bias: 0
        }
      }), q;
    }), u = re(() => {
      const q = t.data?.timestamps ?? [], Q = JSON.parse(JSON.stringify(q));
      if (Q.length === 0 || !t.data)
        return [[]];
      const F = t.data.series.map((U) => JSON.parse(JSON.stringify(U.values.map((O) => O ?? 0))));
      if (t.stackingMode !== "none" && t.data.series.length > 0) {
        const U = Q.length, O = Array.from({ length: U }, () => 0), W = [];
        for (const te of t.data.series) {
          const M = Array.from({ length: U });
          for (let G = 0; G < U; G++) {
            if (t.stackingMode === "percent") {
              let J = 0;
              for (const K of t.data.series)
                J += K.values[G] ?? 0;
              O[G] = O[G] + (te.values[G] ?? 0) / (J || 1) * 100;
            } else
              O[G] = O[G] + (te.values[G] ?? 0);
            M[G] = O[G];
          }
          W.push(M);
        }
        return [Q, ...W];
      }
      return [Q, ...F];
    }), c = re(() => !t.data || t.data.timestamps.length === 0 || t.data.series.length === 0), p = fe(null);
    function y(q) {
      p.value = q;
    }
    const b = re(() => t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15), v = re(() => t.legendPosition === "right"), C = re(() => t.legendPosition !== "hidden" && t.data.series.length > 0), z = re(() => v.value && C.value ? Math.max(i.value.width - 160, 100) : i.value.width), T = re(() => Math.max(i.value.height, 50));
    return (q, Q) => (E(), B("div", {
      ref_key: "chartAreaRef",
      ref: n,
      class: Ae(["w-full h-full flex overflow-hidden relative", v.value ? "flex-row" : "flex-col"])
    }, [
      c.value ? (E(), B("div", M1, [...Q[0] || (Q[0] = [
        m("span", { class: "text-xs" }, "No data", -1)
      ])])) : i.value.width > 0 && i.value.height > 0 ? (E(), B(Pe, { key: 1 }, [
        m("div", T1, [
          k(z1, {
            config: f.value,
            data: u.value,
            width: z.value,
            height: T.value,
            onPlotReady: y
          }, {
            default: R(() => [
              k(k1, {
                "u-plot-instance": p.value,
                unit: t.unit,
                decimals: b.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"])
        ]),
        C.value ? (E(), B("div", {
          key: 0,
          style: He(
            v.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" }
          )
        }, [
          k(e1, {
            items: f.value.getLegendItems(),
            "u-plot-instance": p.value,
            position: v.value ? "right" : "bottom",
            mode: t.legendMode ?? "list",
            values: t.legendValues ?? [],
            data: u.value,
            decimals: b.value,
            unit: t.unit
          }, null, 8, ["items", "u-plot-instance", "position", "mode", "values", "data", "decimals", "unit"])
        ], 4)) : ye("", !0)
      ], 64)) : (E(), B("div", P1, [
        m("span", $1, "dims: " + I(i.value.width) + " x " + I(i.value.height), 1)
      ]))
    ], 2));
  }
}), E1 = /* @__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) => (E(), Ce(nr, {
      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"]));
  }
}), I1 = {
  key: 0,
  style: { "text-align": "center", "font-size": "11px", color: "#888", padding: "2px 4px 4px", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }
}, ms = 2, A1 = /* @__PURE__ */ ze({
  __name: "GaugePanel",
  props: {
    series: {},
    value: { default: 0 },
    title: {},
    min: { default: _t.min },
    max: { default: _t.max },
    unit: {},
    thresholds: {},
    thresholdBaseColor: {},
    capRound: { type: Boolean, default: _t.capRound },
    trackWidth: { default: _t.trackWidth },
    fillWidth: { default: _t.fillWidth },
    trackColor: { default: _t.trackColor },
    sweepAngle: { default: _t.sweepAngle },
    valueColor: { default: _t.valueColor },
    valueSize: { default: _t.valueSize },
    valueVisible: { type: Boolean, default: _t.valueVisible },
    paddingX: { default: _t.paddingX },
    paddingY: { default: _t.paddingY },
    activeColorOverride: {},
    thresholdDisplay: { default: _t.thresholdDisplay },
    thresholdLabelDisplay: { default: _t.thresholdLabelDisplay },
    valueOffsetY: { default: _t.valueOffsetY },
    orientation: { default: _t.orientation }
  },
  setup(e) {
    const t = e, n = fe(), i = fe({ w: 0, h: 0 });
    let a = null;
    function r(F, U, O = 2) {
      const W = F.toFixed(O);
      return U === "percent" ? `${W}%` : U === "bytes" ? F >= 1024 * 1024 ? `${(F / 1024 / 1024).toFixed(1)} MB` : F >= 1024 ? `${(F / 1024).toFixed(1)} KB` : `${F} B` : U ? `${W} ${U}` : W;
    }
    function f(F, U, O) {
      const W = [...O].sort((M, G) => M.value - G.value);
      let te = U;
      for (const M of W)
        F >= M.value && (te = M.color);
      return te;
    }
    function u(F, U) {
      const O = F.match(/^#([0-9a-f]{6})([0-9a-f]{2})?$/i);
      if (O) {
        const te = Number.parseInt(O[1].slice(0, 2), 16), M = Number.parseInt(O[1].slice(2, 4), 16), G = Number.parseInt(O[1].slice(4, 6), 16);
        return `rgba(${te},${M},${G},${U})`;
      }
      const W = F.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
      return W ? `rgba(${W[1]},${W[2]},${W[3]},${U})` : F;
    }
    function c(F, U, O, W, te, M, G, J, K, A, Z, Y, $, j, ue, ie, Ee, me, ge, le, ve, Oe) {
      const xe = F.getContext("2d");
      if (!xe)
        return;
      const ke = window.devicePixelRatio || 1, se = F.clientWidth, oe = F.clientHeight;
      if (se === 0 || oe === 0)
        return;
      F.width = se * ke, F.height = oe * ke, xe.scale(ke, ke), xe.clearRect(0, 0, se, oe);
      const Te = Y * Math.PI / 180, be = (Y + $) * Math.PI / 180;
      let qe, Je, Ge, mt;
      if ($ >= 360)
        qe = -1, Je = 1, Ge = -1, mt = 1;
      else {
        qe = Math.cos(Te), Je = Math.cos(Te), Ge = Math.sin(Te), mt = Math.sin(Te);
        const vt = (bt) => {
          qe = Math.min(qe, Math.cos(bt)), Je = Math.max(Je, Math.cos(bt)), Ge = Math.min(Ge, Math.sin(bt)), mt = Math.max(mt, Math.sin(bt));
        };
        vt(be);
        const Ft = [0, 90, 180, 270, 360, 450, 540].map((bt) => bt * Math.PI / 180);
        for (const bt of Ft) {
          const Pt = (rn) => (rn % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI), Xt = Pt(Te), wn = Pt(be), De = Pt(bt);
          (Xt <= wn ? De >= Xt && De <= wn : De >= Xt || De <= wn) && vt(bt);
        }
      }
      const It = Je - qe, ft = mt - Ge, Tt = Math.min(se, oe), ut = Tt / 300, At = Ee * ut, Wn = me * ut, Wt = Math.max(0, se - 2 * At), ln = Math.max(0, oe - 2 * Wn), Be = At, ae = Wn, Ie = K * ut, _e = A * ut, je = le === "marker", ct = le === "track", Ye = je ? Math.max(2, Tt * 0.04) : 0, Le = je ? Math.max(Ie, _e) / 2 + 2 + Ye : Math.max(Ie, _e) / 2, et = Math.min((Wt - Le * 2) / It, (ln - Le * 2) / ft);
      if (et < 10)
        return;
      const nt = Be + Wt / 2 - (qe + Je) / 2 * et, it = ae + ln / 2 - (Ge + mt) / 2 * et, St = W - O || 1, Lt = Math.max(O, Math.min(W, U)), Gt = (Lt - O) / St, fn = Te + Gt * (be - Te), sn = ge ?? f(Lt, G, M), Ut = J ? "round" : "butt";
      xe.beginPath(), xe.arc(nt, it, et, Te, be), xe.strokeStyle = Z, xe.lineWidth = Ie, xe.lineCap = Ut, xe.stroke();
      const Mt = [...M].sort((vt, Ft) => vt.value - Ft.value), Kt = [];
      if (Mt.length === 0)
        Kt.push({ from: O, to: W, color: G });
      else {
        Kt.push({ from: O, to: Mt[0].value, color: G });
        for (let vt = 0; vt < Mt.length; vt++)
          Kt.push({ from: Mt[vt].value, to: vt + 1 < Mt.length ? Mt[vt + 1].value : W, color: Mt[vt].color });
      }
      if (ct) {
        const vt = (be - Te) / (2 * Math.PI), Ft = xe.createConicGradient(Te, nt, it);
        for (const bt of Kt) {
          const Pt = Math.min(1, (Math.max(O, bt.from) - O) / St * vt), Xt = Math.min(1, (Math.min(W, bt.to) - O) / St * vt);
          Ft.addColorStop(Pt, u(bt.color, 0.25)), Ft.addColorStop(Xt, u(bt.color, 0.25));
        }
        Ft.addColorStop(1, u(Kt[0].color, 0.25)), xe.beginPath(), xe.arc(nt, it, et, Te, be), xe.strokeStyle = Ft, xe.lineWidth = Ie, xe.lineCap = Ut, xe.stroke();
      }
      if (Gt > 0 && (xe.beginPath(), xe.arc(nt, it, et, Te, fn), xe.strokeStyle = sn, xe.lineWidth = _e, xe.lineCap = Ut, xe.stroke()), je && Kt.length > 0) {
        const vt = et + Math.max(Ie, _e) / 2 + Ye / 2 + 2, Ft = (be - Te) / (2 * Math.PI), bt = xe.createConicGradient(Te, nt, it);
        for (const Pt of Kt) {
          const Xt = Math.min(1, (Math.max(O, Pt.from) - O) / St * Ft), wn = Math.min(1, (Math.min(W, Pt.to) - O) / St * Ft);
          bt.addColorStop(Xt, Pt.color), bt.addColorStop(wn, Pt.color);
        }
        bt.addColorStop(1, Kt[0].color), xe.beginPath(), xe.arc(nt, it, vt, Te, be), xe.strokeStyle = bt, xe.lineWidth = Ye, xe.lineCap = Ut, xe.stroke();
      }
      if (Oe !== "none" && M.length > 0) {
        const vt = Math.max(8, 11 * ut), Ft = et + Math.max(Ie, _e) / 2 + (je ? Ye + 4 : 4) + vt * 0.6, bt = W - O || 1;
        xe.font = `${vt}px system-ui, sans-serif`, xe.textBaseline = "middle";
        for (const Pt of M) {
          const Xt = (Pt.value - O) / bt;
          if (Xt < 0 || Xt > 1)
            continue;
          const wn = Te + Xt * (be - Te), De = nt + Math.cos(wn) * Ft, rn = it + Math.sin(wn) * Ft, Rt = De - nt;
          if (xe.textAlign = Rt > 1 ? "left" : Rt < -1 ? "right" : "center", xe.fillStyle = Pt.color, Oe === "label" || Oe === "both") {
            const hn = Pt.label || String(Pt.value);
            Oe === "both" ? (xe.fillText(hn, De, rn - vt * 0.6), xe.fillText(r(Pt.value, te, 1), De, rn + vt * 0.6)) : xe.fillText(hn, De, rn);
          } else
            xe.fillText(r(Pt.value, te, 1), De, rn);
        }
      }
      if (ie) {
        const vt = Math.max(4, ue * ut), Ft = r(Lt, te, 2), bt = it + Ge * et - _e / 2, Pt = it + mt * et + _e / 2, Xt = (bt + Pt) / 2;
        xe.textAlign = "center", xe.textBaseline = "middle", xe.fillStyle = j, xe.font = `600 ${vt}px system-ui, sans-serif`, xe.fillText(Ft, nt, Xt + ve * ut);
      }
    }
    function p(F, U, O) {
      const W = Math.ceil(Math.sqrt(O * F / U));
      return Math.floor(W * U / F) * W < O ? U / Math.ceil(W * U / F) : F / W;
    }
    function y(F, U, O, W) {
      const te = Math.max(p(F, U, W), p(U, F, W));
      let M = Math.max(1, Math.floor(F / te));
      const G = Math.ceil(W / M);
      return M = Math.ceil(W / G), { xCount: M, yCount: G, cellW: F / M - O + O / M, cellH: U / G - O + O / G };
    }
    const b = re(
      () => t.series && t.series.length > 0 ? t.series : [{ label: t.title ?? "", value: t.value ?? 0, activeColorOverride: t.activeColorOverride }]
    ), v = re(() => b.value.length), C = re(() => t.thresholds && t.thresholds.length > 0 ? t.thresholds : []), z = re(() => t.thresholdBaseColor ?? "#52c41a"), T = re(() => {
      const F = i.value.w, U = i.value.h;
      return F <= 0 || U <= 0 ? { xCount: 1, yCount: 1, cellW: 0, cellH: 0 } : t.orientation === "horizontal" ? { xCount: v.value, yCount: 1, cellW: (F - ms * (v.value - 1)) / v.value, cellH: U } : t.orientation === "vertical" ? { xCount: 1, yCount: v.value, cellW: F, cellH: (U - ms * (v.value - 1)) / v.value } : y(F, U, ms, v.value);
    });
    In(() => {
      n.value && (a = new ResizeObserver((F) => {
        const U = F[0].contentRect;
        i.value = { w: U.width, h: U.height };
      }), a.observe(n.value));
    }), Ui(() => {
      a?.disconnect();
    });
    const q = fe({});
    function Q() {
      zn(() => {
        for (let F = 0; F < b.value.length; F++) {
          const U = q.value[F];
          if (!U)
            continue;
          const O = b.value[F];
          c(
            U,
            O.value,
            t.min,
            t.max,
            t.unit,
            C.value,
            z.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,
            O.activeColorOverride ?? t.activeColorOverride,
            t.thresholdDisplay,
            t.valueOffsetY,
            t.thresholdLabelDisplay
          );
        }
      });
    }
    return Fe(() => [
      b.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
    ], Q, { deep: !0, immediate: !0 }), (F, U) => (E(), B("div", {
      ref_key: "containerRef",
      ref: n,
      style: He([{ width: "100%", height: "100%", display: "grid", gap: "2px" }, {
        gridTemplateColumns: `repeat(${T.value.xCount}, 1fr)`,
        gridTemplateRows: `repeat(${T.value.yCount}, 1fr)`
      }])
    }, [
      (E(!0), B(Pe, null, Xe(b.value, (O, W) => (E(), B("div", {
        key: `${O.label}-${W}`,
        style: { width: "100%", height: "100%", display: "flex", "flex-direction": "column", overflow: "hidden" }
      }, [
        m("canvas", {
          ref_for: !0,
          ref: (te) => {
            te && (q.value[W] = te);
          },
          style: { flex: "1", width: "100%", height: "0", display: "block", "min-height": "0" }
        }, null, 512),
        v.value > 1 && O.label ? (E(), B("div", I1, I(O.label), 1)) : ye("", !0)
      ]))), 128))
    ], 4));
  }
}), O1 = /* @__PURE__ */ ze({
  __name: "HistogramPanel",
  props: {
    seriesValues: {},
    seriesLabels: {},
    bucketSize: {},
    bucketCount: {},
    bucketOffset: {},
    combineSeries: { type: Boolean, default: !1 },
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    lineWidth: { default: 1 },
    fillOpacity: { default: 80 },
    unit: {}
  },
  setup(e) {
    const t = e;
    function n(f, u) {
      const c = f.filter((U) => Number.isFinite(U));
      if (c.length === 0)
        return { bucketStarts: [], counts: [] };
      const p = Math.min(...c), y = Math.max(...c), b = y - p || 1, v = u.bucketOffset ?? 0, C = u.bucketCount ?? 30, z = u.bucketSize ?? b / C, T = Math.floor((p - v) / z) * z + v, q = [], Q = [];
      let F = T;
      for (; F <= y; )
        q.push(F), Q.push(0), F += z;
      for (const U of c) {
        const O = Math.floor((U - T) / z), W = Math.min(O, Q.length - 1);
        W >= 0 && Q[W]++;
      }
      return { bucketStarts: q, counts: Q };
    }
    function i(f, u) {
      const c = f.flat();
      return n(c, u);
    }
    const a = re(() => {
      const f = { bucketSize: t.bucketSize, bucketCount: t.bucketCount, bucketOffset: t.bucketOffset };
      if (t.combineSeries || t.seriesValues.length === 0) {
        const { bucketStarts: b, counts: v } = i(t.seriesValues, f);
        return { bucketStarts: b, countSeries: [v], labels: ["combined"] };
      }
      const u = t.seriesValues.flat(), { bucketStarts: c } = n(u, f), p = c.length > 1 ? c[1] - c[0] : void 0, y = t.seriesValues.map((b) => {
        const { counts: v } = n(b, { ...f, bucketSize: p });
        return Array.from({ length: c.length }, (C, z) => v[z] ?? 0);
      });
      return { bucketStarts: c, countSeries: y, labels: t.seriesLabels };
    }), r = re(() => ({
      timestamps: a.value.bucketStarts,
      series: a.value.labels.map((f, u) => ({
        label: f,
        values: a.value.countSeries[u] ?? []
      }))
    }));
    return (f, u) => (E(), Ce(nr, {
      data: r.value,
      "fill-opacity": e.fillOpacity,
      "line-width": e.lineWidth,
      "draw-style": "bars",
      unit: e.unit,
      "color-scheme": e.colorScheme,
      "color-single-value": e.colorSingleValue,
      "color-distribution": e.colorDistribution,
      "scale-distribution": "linear",
      "show-grid-lines": "y",
      "axis-label": "y",
      "axis-tick": "hidden",
      "axis-border": "hidden",
      "tooltip-mode": "multi",
      "legend-position": !e.combineSeries && a.value.countSeries.length > 1 ? "bottom" : "hidden",
      "legend-mode": "list",
      "stacking-mode": "none",
      "x-axis-time": !1
    }, null, 8, ["data", "fill-opacity", "line-width", "unit", "color-scheme", "color-single-value", "color-distribution", "legend-position"]));
  }
}), D1 = ["width", "height"], q1 = ["d", "fill", "stroke", "opacity", "onMousemove"], L1 = ["x", "y"], R1 = ["onClick"], N1 = { style: { width: "100%", "border-collapse": "collapse" } }, V1 = ["onClick"], F1 = { class: "flex items-center gap-1" }, B1 = {
  class: "overflow-hidden text-ellipsis whitespace-nowrap",
  style: { "max-width": "80px" }
}, H1 = { class: "flex items-center gap-1.5" }, W1 = /* @__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 = Mi(), i = fe(), a = fe({ width: 0, height: 0 });
    let r = null;
    In(() => {
      if (!i.value)
        return;
      r = new ResizeObserver((le) => {
        const { width: ve, height: Oe } = le[0].contentRect;
        a.value = { width: Math.floor(ve), height: Math.floor(Oe) };
      }), r.observe(i.value);
      const { width: me, height: ge } = i.value.getBoundingClientRect();
      a.value = { width: Math.floor(me), height: Math.floor(ge) };
    }), no(() => {
      r?.disconnect();
    });
    const f = re(() => n.isDark), u = re(() => f.value ? "#d9d9d9" : "#141414"), c = re(() => f.value ? "#8c8c8c" : "#595959"), p = re(() => f.value ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"), y = re(() => f.value ? "rgba(0,0,0,0.6)" : "rgba(255,255,255,0.8)"), b = re(() => {
      const me = t.legendValues.length > 0;
      return t.legendMode === "table" ? me ? 120 + t.legendValues.length * 64 : 160 : 140;
    }), v = re(
      () => t.legendPosition === "bottom" ? t.legendMode === "table" ? Math.min(t.slices.length * 24 + 28, 120) : 28 : 0
    ), C = re(() => t.legendPosition === "right" ? b.value : 0), z = re(() => Math.max(a.value.width - C.value, 10)), T = re(() => Math.max(a.value.height - v.value, 10)), q = re(() => z.value / 2), Q = re(() => T.value / 2), F = re(() => Math.min(q.value, Q.value) * 0.85), U = re(() => t.pieType === "donut" ? F.value * 0.55 : 0), O = fe(null), W = fe({ x: 0, y: 0 }), te = fe(/* @__PURE__ */ new Set()), M = re(() => t.slices.filter((me) => !te.value.has(me.label))), G = re(() => M.value.reduce((me, ge) => me + ge.value, 0));
    function J(me, ge, le, ve) {
      const Oe = (ve - 90) * Math.PI / 180;
      return { x: me + le * Math.cos(Oe), y: ge + le * Math.sin(Oe) };
    }
    function K(me, ge, le, ve, Oe, xe) {
      const ke = Math.min(xe - Oe, 359.9999), se = ke > 180 ? 1 : 0, oe = J(me, ge, le, Oe), Te = J(me, ge, le, Oe + ke);
      if (ve <= 0)
        return [
          `M ${me} ${ge}`,
          `L ${oe.x} ${oe.y}`,
          `A ${le} ${le} 0 ${se} 1 ${Te.x} ${Te.y}`,
          "Z"
        ].join(" ");
      const be = J(me, ge, ve, Oe + ke), qe = J(me, ge, ve, Oe);
      return [
        `M ${oe.x} ${oe.y}`,
        `A ${le} ${le} 0 ${se} 1 ${Te.x} ${Te.y}`,
        `L ${be.x} ${be.y}`,
        `A ${ve} ${ve} 0 ${se} 0 ${qe.x} ${qe.y}`,
        "Z"
      ].join(" ");
    }
    const A = re(() => {
      const me = G.value;
      if (me === 0 || a.value.width === 0)
        return [];
      let ge = 0;
      return M.value.map((le) => {
        const ve = le.value / me * 360, Oe = le.value / me * 100, xe = ge;
        ge += ve;
        const ke = ge, se = xe + ve / 2, oe = (F.value + U.value) / 2 || F.value * 0.65, Te = J(q.value, Q.value, oe, se), be = K(q.value, Q.value, F.value, U.value, xe, ke);
        return { ...le, angle: ve, pct: Oe, startAngle: xe, endAngle: ke, midAngle: se, labelPos: Te, path: be };
      });
    });
    function Z(me) {
      const ge = me.toFixed(t.decimals);
      return t.unit ? `${ge} ${t.unit}` : ge;
    }
    function Y(me, ge) {
      return me.rawValues && me.rawValues.length > 0 ? zo(me.rawValues, ge) : me.value;
    }
    function $(me) {
      const ge = new Set(te.value);
      if (ge.has(me))
        ge.delete(me);
      else {
        if (t.slices.filter((ve) => !ge.has(ve.label)).length <= 1)
          return;
        ge.add(me);
      }
      te.value = ge;
    }
    function j(me, ge) {
      O.value = ge;
      const le = i.value?.getBoundingClientRect();
      le && (W.value = { x: me.clientX - le.left, y: me.clientY - le.top });
    }
    function ue() {
      O.value = null;
    }
    const ie = re(() => {
      if (!O.value || t.tooltipMode === "none")
        return [];
      const me = G.value;
      if (t.tooltipMode === "single") {
        const le = M.value.find((ve) => ve.label === O.value);
        return le ? [{ ...le, percent: me > 0 ? le.value / me * 100 : 0 }] : [];
      }
      let ge = M.value.map((le) => ({ ...le, percent: me > 0 ? le.value / me * 100 : 0 }));
      return t.tooltipSort === "desc" && (ge = [...ge].sort((le, ve) => ve.value - le.value)), t.tooltipSort === "asc" && (ge = [...ge].sort((le, ve) => le.value - ve.value)), ge;
    }), Ee = re(() => {
      const me = t.tooltipMode === "multi" ? 180 : 140, ge = t.tooltipMode === "multi" ? ie.value.length * 22 + 32 : 72, le = Math.min(W.value.x + 14, a.value.width - me - 4), ve = Math.min(W.value.y - 8, a.value.height - ge - 4);
      return { left: Math.max(4, le), top: Math.max(4, ve) };
    });
    return (me, ge) => (E(), B("div", {
      ref_key: "containerRef",
      ref: i,
      class: "w-full h-full relative overflow-hidden",
      style: He({
        display: "flex",
        flexDirection: e.legendPosition === "bottom" ? "column" : "row"
      })
    }, [
      a.value.width > 0 ? (E(), B("svg", {
        key: 0,
        width: z.value,
        height: T.value,
        style: { "flex-shrink": "0" }
      }, [
        (E(!0), B(Pe, null, Xe(A.value, (le) => (E(), B("g", {
          key: le.label
        }, [
          le.angle > 0.3 ? (E(), B("path", {
            key: 0,
            d: le.path,
            fill: le.color,
            stroke: y.value,
            "stroke-width": "1.5",
            opacity: O.value && O.value !== le.label ? 0.6 : 1,
            style: { cursor: "pointer", transition: "opacity 0.15s" },
            onMousemove: (ve) => j(ve, le.label),
            onMouseleave: ue
          }, null, 40, q1)) : ye("", !0),
          e.pieLabels.length > 0 && le.angle > 20 ? (E(), B("text", {
            key: 1,
            x: le.labelPos.x,
            y: le.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)" }
          }, I([
            e.pieLabels.includes("name") ? le.label : null,
            e.pieLabels.includes("percent") ? `${le.pct.toFixed(1)}%` : null,
            e.pieLabels.includes("value") ? Z(le.value) : null
          ].filter(Boolean).join(" ")), 9, L1)) : ye("", !0)
        ]))), 128))
      ], 8, D1)) : ye("", !0),
      e.legendPosition !== "hidden" && e.legendMode === "list" ? (E(), B("div", {
        key: 1,
        style: He({
          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" ? `${C.value}px` : void 0,
          height: e.legendPosition === "bottom" ? `${v.value}px` : void 0
        })
      }, [
        (E(!0), B(Pe, null, Xe(e.slices, (le) => (E(), B("div", {
          key: le.label,
          class: "flex items-center gap-1 text-xs whitespace-nowrap cursor-pointer select-none",
          style: He({
            color: u.value,
            opacity: te.value.has(le.label) ? 0.35 : 1,
            textDecoration: te.value.has(le.label) ? "line-through" : "none"
          }),
          onClick: (ve) => $(le.label)
        }, [
          m("span", {
            class: "inline-block w-2 h-2 rounded-sm flex-shrink-0",
            style: He({ background: le.color })
          }, null, 4),
          m("span", null, I(le.label), 1),
          e.legendValues.length > 0 ? (E(), B("span", {
            key: 0,
            class: "ml-1",
            style: He({ color: c.value })
          }, I(e.legendValues.map((ve) => Z(Y(le, ve))).join(" / ")), 5)) : ye("", !0)
        ], 12, R1))), 128))
      ], 4)) : ye("", !0),
      e.legendPosition !== "hidden" && e.legendMode === "table" ? (E(), B("div", {
        key: 2,
        style: He({
          width: e.legendPosition === "right" ? `${C.value}px` : void 0,
          height: e.legendPosition === "bottom" ? `${v.value}px` : void 0,
          overflowY: "auto",
          flexShrink: 0,
          fontSize: "11px"
        })
      }, [
        m("table", N1, [
          m("thead", null, [
            m("tr", null, [
              m("th", {
                style: He({ textAlign: "left", padding: "2px 6px", color: c.value, fontWeight: 500, borderBottom: `1px solid ${p.value}` })
              }, " Name ", 4),
              m("th", {
                style: He({ textAlign: "right", padding: "2px 6px", color: c.value, fontWeight: 500, borderBottom: `1px solid ${p.value}` })
              }, " Value ", 4),
              (E(!0), B(Pe, null, Xe(e.legendValues, (le) => (E(), B("th", {
                key: le,
                style: He({ textAlign: "right", padding: "2px 6px", color: c.value, fontWeight: 500, borderBottom: `1px solid ${p.value}`, minWidth: "56px" })
              }, I(le.charAt(0).toUpperCase() + le.slice(1)), 5))), 128))
            ])
          ]),
          m("tbody", null, [
            (E(!0), B(Pe, null, Xe(e.slices, (le) => (E(), B("tr", {
              key: le.label,
              class: "cursor-pointer select-none",
              style: He({ opacity: te.value.has(le.label) ? 0.35 : 1 }),
              onClick: (ve) => $(le.label)
            }, [
              m("td", {
                style: He({ padding: "2px 6px", color: u.value })
              }, [
                m("div", F1, [
                  m("span", {
                    class: "inline-block w-2 h-2 rounded-sm flex-shrink-0",
                    style: He({ background: le.color })
                  }, null, 4),
                  m("span", B1, I(le.label), 1)
                ])
              ], 4),
              m("td", {
                style: He({ textAlign: "right", padding: "2px 6px", color: u.value, fontVariantNumeric: "tabular-nums" })
              }, I(Z(le.value)), 5),
              (E(!0), B(Pe, null, Xe(e.legendValues, (ve) => (E(), B("td", {
                key: ve,
                style: He({ textAlign: "right", padding: "2px 6px", color: c.value, fontVariantNumeric: "tabular-nums" })
              }, I(Z(Y(le, ve))), 5))), 128))
            ], 12, V1))), 128))
          ])
        ])
      ], 4)) : ye("", !0),
      O.value && e.tooltipMode !== "none" && ie.value.length > 0 ? (E(), B("div", {
        key: 3,
        class: "absolute z-50 pointer-events-none rounded shadow-lg text-xs",
        style: He({
          left: `${Ee.value.left}px`,
          top: `${Ee.value.top}px`,
          background: f.value ? "#1f1f1f" : "#fff",
          border: f.value ? "1px solid #333" : "1px solid #e8e8e8",
          minWidth: "140px"
        })
      }, [
        m("div", {
          class: "px-2 pt-1.5 pb-0 text-xs font-medium",
          style: He({ color: f.value ? "#d9d9d9" : "#141414" })
        }, I(e.tooltipMode === "multi" ? `${Z(G.value)} total` : ie.value[0]?.label), 5),
        m("div", {
          class: "border-t my-1",
          style: He({ borderColor: f.value ? "#333" : "#e8e8e8" })
        }, null, 4),
        (E(!0), B(Pe, null, Xe(ie.value, (le) => (E(), B("div", {
          key: le.label,
          class: "px-2 py-0.5 flex items-center justify-between gap-2"
        }, [
          m("div", H1, [
            m("span", {
              class: "inline-block w-2 h-2 rounded-sm",
              style: He({ background: le.color })
            }, null, 4),
            m("span", {
              style: He({ color: f.value ? "#d9d9d9" : "#141414" })
            }, I(e.tooltipMode === "multi" ? le.label : `${le.percent.toFixed(1)}%`), 5)
          ]),
          m("span", {
            class: "font-mono",
            style: He({ color: le.color })
          }, I(Z(le.value)), 5)
        ]))), 128))
      ], 4)) : ye("", !0)
    ], 4));
  }
}), ma = 36, rl = 1.2, Wu = 1, j1 = /* @__PURE__ */ ze({
  __name: "StatPanel",
  props: {
    title: {},
    unit: {},
    series: {},
    trend: {},
    thresholds: {},
    thresholdBaseColor: {},
    orientation: {},
    textMode: {},
    colorMode: {}
  },
  setup(e) {
    const t = e, n = Mi(), i = fe(), a = fe({ w: 0, h: 0 });
    let r = null;
    const f = ["#1677ff", "#52c41a", "#fa8c16", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#faad14"];
    function u(O) {
      return O >= 1e6 ? `${(O / 1e6).toFixed(1)}M` : O >= 1e3 ? `${(O / 1e3).toFixed(1)}K` : O % 1 === 0 ? String(O) : O.toFixed(1);
    }
    function c(O, W, te, M) {
      const G = te ?? M ?? f[0];
      if (W && W.length > 0) {
        let J = G;
        for (const K of W)
          O >= K.value && (J = K.color);
        return J;
      }
      return G;
    }
    function p(O, W) {
      if (O.startsWith("rgb("))
        return O.replace("rgb(", "rgba(").replace(")", `, ${W})`);
      if (O.startsWith("rgba("))
        return O.replace(/,\s*[\d.]+\)$/, `, ${W})`);
      const te = O.replace("#", ""), M = te.length === 3 ? te.split("").map((A) => A + A).join("") : te.slice(0, 6), G = Number.parseInt(M.slice(0, 2), 16), J = Number.parseInt(M.slice(2, 4), 16), K = Number.parseInt(M.slice(4, 6), 16);
      return `rgba(${G}, ${J}, ${K}, ${W})`;
    }
    function y(O, W, te) {
      switch (W) {
        case "background_solid":
          return Ne(O).toString();
        case "background": {
          const M = te ? 1 : -0.7, G = Ne(O).darken(15 * M).spin(8).toRgbString(), J = Ne(O).darken(5 * M).spin(-8).toRgbString();
          return `linear-gradient(120deg, ${G}, ${J})`;
        }
        default:
          return "transparent";
      }
    }
    function b(O) {
      return Ne(O).isLight() ? "#1a1a1a" : "#ffffff";
    }
    function v(O, W, te) {
      if (O === 0 || W === 0)
        return { isWide: !1, showSparkline: !1, valueFontSize: 24, titleFontSize: 12, chartHeight: 0, padding: 8 };
      const M = W > 100 ? 12 : 8, G = O - M * 2, J = W - M * 2, K = O / W > 2.5, A = te && (K ? W > 50 : W > 100), Z = Math.max(10, Math.min(13, J * (K ? 0.22 : 0.18)));
      let Y, $ = 0;
      if (K)
        Y = A ? Math.min(J * 0.62, G * 0.42, ma) : Math.min(J * 0.7, G * 0.38, ma), A && ($ = W * 0.5);
      else {
        const j = Z * rl;
        Y = Math.min(A ? (J - j) * 0.65 : (J - j) * 0.85, G * 0.9, ma), A && ($ = Math.max(0, Math.min(W - Z * rl - Y * rl - M, W * 0.5)));
      }
      return {
        isWide: K,
        showSparkline: A,
        valueFontSize: Math.max(11, Y),
        titleFontSize: Z,
        chartHeight: $,
        padding: M
      };
    }
    function C(O, W, te) {
      const M = Math.ceil(Math.sqrt(te * O / W));
      return Math.floor(M * W / O) * M < te ? W / Math.ceil(M * W / O) : O / M;
    }
    function z(O, W, te, M) {
      const G = Math.max(C(O, W, M), C(W, O, M));
      let J = Math.max(1, Math.floor(O / G));
      const K = Math.ceil(M / J);
      return J = Math.ceil(M / K), {
        xCount: J,
        yCount: K,
        cellW: O / J - te + te / J,
        cellH: W / K - te + te / K
      };
    }
    function T(O, W, te) {
      const M = O.getContext("2d");
      if (!M)
        return;
      const G = window.devicePixelRatio || 1, J = O.getBoundingClientRect();
      if (J.width === 0 || J.height === 0)
        return;
      O.width = J.width * G, O.height = J.height * G, M.scale(G, G);
      const K = J.width, A = J.height, Z = Math.min(...W), $ = Math.max(...W) - Z || 1;
      M.clearRect(0, 0, K, A);
      const j = M.createLinearGradient(0, 0, 0, A);
      j.addColorStop(0, p(te, 0.25)), j.addColorStop(1, p(te, 0));
      const ue = W.map((ie, Ee) => ({
        x: Ee / (W.length - 1) * K,
        y: A - 2 - (ie - Z) / $ * (A - 4)
      }));
      M.beginPath(), ue.forEach(({ x: ie, y: Ee }, me) => me === 0 ? M.moveTo(ie, Ee) : M.lineTo(ie, Ee)), M.lineTo(K, A), M.lineTo(0, A), M.fillStyle = j, M.fill(), M.beginPath(), ue.forEach(({ x: ie, y: Ee }, me) => me === 0 ? M.moveTo(ie, Ee) : M.lineTo(ie, Ee)), M.strokeStyle = te, M.lineWidth = 1.5, M.stroke();
    }
    const q = re(() => Math.max(t.series.length, 1)), Q = re(() => {
      const O = a.value.w, W = a.value.h;
      return O <= 0 || W <= 0 ? { xCount: 1, yCount: 1, cellW: 0, cellH: 0 } : t.orientation === "horizontal" ? { xCount: 1, yCount: q.value, cellW: O, cellH: (W - Wu * (q.value - 1)) / q.value } : z(O, W, Wu, q.value);
    }), F = re(() => n.isDark ? "#303030" : "#fff");
    In(() => {
      i.value && (r = new ResizeObserver((O) => {
        const W = O[0].contentRect;
        (a.value.w !== W.width || a.value.h !== W.height) && (a.value = { w: W.width, h: W.height });
      }), r.observe(i.value));
    }), Ui(() => {
      r?.disconnect();
    });
    const U = 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(O) {
        const W = fe(), te = Mi();
        function M() {
          zn(() => {
            W.value && O.sparkline && O.sparkline.length > 1 && T(W.value, O.sparkline, O.color ?? "#1677ff");
          });
        }
        return Fe(() => [O.sparkline, O.color, O.width, O.height], M, { immediate: !0 }), () => {
          const G = O, J = te.isDark, K = G.sparkline != null && G.sparkline.length > 1, A = v(G.width ?? 0, G.height ?? 0, K), Z = G.textMode === "value_and_name" || G.textMode === "name", Y = G.textMode === "value_and_name" || G.textMode === "value", $ = Math.max(10, A.valueFontSize * 0.44), j = G.colorMode === "background_solid" || G.colorMode === "background", ue = j ? y(G.color ?? "#1677ff", G.colorMode ?? "value", J) : "transparent", ie = j ? b(G.color ?? "#1677ff") : G.color ?? "#d9d9d9", Ee = j ? ie : "#888", me = j ? ie : "#666", ge = G.percentChange != null ? (G.percentChange > 0 ? "+" : "") + G.percentChange.toLocaleString(void 0, { style: "percent", minimumFractionDigits: 1, maximumFractionDigits: 2 }) : null, le = G.percentChange != null ? G.percentChange > 0 ? "#52c41a" : G.percentChange < 0 ? "#ff4d4f" : "#888" : "", ve = G.percentChange != null ? G.percentChange > 0 ? "↑" : G.percentChange < 0 ? "↓" : "" : "", Oe = G.mappedLabel ?? u(G.value ?? 0), xe = [
            Mn("span", {
              style: {
                color: ie,
                fontSize: `${A.valueFontSize}px`,
                fontWeight: 500,
                fontFamily: "monospace",
                lineHeight: rl
              }
            }, Oe)
          ];
          G.mappedLabel || xe.push(Mn("span", {
            style: { color: me, fontSize: `${$}px`, lineHeight: rl }
          }, G.unit)), ge && xe.push(Mn("span", {
            style: { color: le, fontSize: `${$}px`, marginLeft: "2px", lineHeight: rl }
          }, `${ve}${ge}`));
          const ke = Z ? Mn("div", {
            style: {
              color: Ee,
              fontSize: `${A.titleFontSize}px`,
              lineHeight: rl,
              ...A.isWide ? { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } : { marginBottom: "2px" }
            }
          }, G.label) : null, se = Y ? Mn("div", {
            style: {
              display: "flex",
              alignItems: "baseline",
              gap: A.isWide ? "3px" : "4px",
              flexWrap: "wrap"
            }
          }, xe) : null, oe = Mn("div", {
            style: A.isWide ? { flex: 1, minWidth: 0, position: "relative", zIndex: 1 } : { position: "relative", zIndex: 1 }
          }, [ke, se]), Te = A.showSparkline ? Mn("canvas", {
            ref: (qe) => {
              W.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, be = A.isWide ? {
            width: "100%",
            height: "100%",
            display: "flex",
            alignItems: "center",
            padding: `0 ${A.padding}px`,
            gap: "8px",
            overflow: "hidden",
            position: "relative",
            background: ue
          } : {
            width: "100%",
            height: "100%",
            display: "flex",
            flexDirection: "column",
            justifyContent: "center",
            padding: `${A.padding}px`,
            overflow: "hidden",
            position: "relative",
            background: ue
          };
          return Mn("div", { style: be }, A.isWide ? [Te, oe] : [Te, oe]);
        };
      }
    });
    return (O, W) => (E(), B("div", {
      ref_key: "containerRef",
      ref: i,
      style: He([{ width: "100%", height: "100%", display: "grid", gap: "1px" }, {
        gridTemplateColumns: e.orientation === "horizontal" ? "1fr" : `repeat(${Q.value.xCount}, 1fr)`,
        gridTemplateRows: e.orientation === "horizontal" ? `repeat(${q.value}, 1fr)` : `repeat(${Q.value.yCount}, 1fr)`,
        background: F.value
      }])
    }, [
      (E(!0), B(Pe, null, Xe(e.series, (te, M) => (E(), Ce(d(U), {
        key: `${te.label}-${M}`,
        label: q.value === 1 ? e.title : te.label,
        value: te.displayValue ?? (te.values.length > 0 ? te.values[te.values.length - 1] ?? 0 : 0),
        unit: te.units ?? e.unit,
        "mapped-label": te.valueMap !== void 0 ? te.valueMap[String(te.displayValue ?? (te.values.length > 0 ? te.values[te.values.length - 1] ?? 0 : 0))] : void 0,
        sparkline: te.values.length > 1 ? te.values : void 0,
        "percent-change": te.percentChange,
        "text-mode": e.textMode,
        "color-mode": e.colorMode,
        color: c(
          te.displayValue ?? te.values[te.values.length - 1] ?? 0,
          e.thresholds,
          e.thresholdBaseColor,
          f[M % f.length]
        ),
        width: Q.value.cellW,
        height: Q.value.cellH
      }, null, 8, ["label", "value", "unit", "mapped-label", "sparkline", "percent-change", "text-mode", "color-mode", "color", "width", "height"]))), 128))
    ], 4));
  }
}), G1 = {
  key: 0,
  class: "flex-center h-full text-secondary"
}, Y1 = {
  key: 1,
  class: "flex-center h-full"
}, U1 = {
  key: 2,
  class: "flex-center h-full text-red-500 text-xs"
}, K1 = {
  key: 3,
  class: "w-full h-full relative"
}, X1 = {
  key: 0,
  class: "absolute inset-0 z-10 flex items-center justify-center",
  style: { "backdrop-filter": "blur(1px)", "border-radius": "4px" }
}, Q1 = {
  key: 0,
  class: "w-full h-full"
}, J1 = {
  key: 0,
  class: "w-full h-full overflow-auto"
}, Rs = /* @__PURE__ */ ze({
  __name: "PanelRenderer",
  props: {
    panelId: {},
    panelConfig: { default: void 0 }
  },
  setup(e) {
    const t = e, n = fi(), { t: i } = ot(), a = re(() => t.panelConfig ?? n.panels[t.panelId]), r = fe(!1), f = fe(null), u = fe(null), c = fe(null), p = fe(null), y = fe(null), b = fe(null), v = fe(null);
    let C = null;
    const z = fe(null), T = ["#1677ff", "#52c41a", "#fa8c16", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#faad14"];
    function q(O, W) {
      Q();
      const te = O.seriesCount ?? 1, M = Vl(
        { from: W.from / 1e3, to: W.to / 1e3 },
        15,
        te,
        O.pattern,
        O.labels
      ), G = Array.from({ length: te }, (K, A) => 20 + (A * 37 + 13) % 60), J = Array.from({ length: te }, (K, A) => 10 + (A * 53 + 7) % 40);
      z.value = {
        timestamps: [...M.timestamps],
        seriesValues: M.series.map((K) => [...K.values])
      }, C = setInterval(() => {
        const K = z.value;
        if (!K)
          return;
        const A = Math.floor(Date.now() / 1e3), Z = [...K.timestamps.slice(1), A], Y = K.seriesValues.map(($, j) => {
          const ue = $[$.length - 1], ie = Mf(ue, G[j], J[j] * 0.1, J[j] + G[j] * 1.8);
          return [...$.slice(1), ie];
        });
        z.value = { timestamps: Z, seriesValues: Y };
      }, 1e3);
    }
    function Q() {
      C && (clearInterval(C), C = null), z.value = null;
    }
    Ui(Q);
    async function F() {
      const O = a.value;
      if (O) {
        r.value = !0, f.value = null, Q();
        try {
          const W = O.queries.filter((K) => K.enabled !== !1).map((K) => K.dataSource).filter((K) => !!K && K.type === "mock");
          if (W.length === 0)
            return;
          const te = n.timeRange, M = { from: te.from / 1e3, to: te.to / 1e3 }, G = W[0];
          if (G.pattern === "live") {
            q(G, te);
            return;
          }
          if (O.type === "timeseries" || O.type === "bar") {
            const K = W.map(
              (Z) => Vl(M, 15, Z.seriesCount ?? 1, Z.pattern, Z.labels)
            ), A = {
              timestamps: K[0].timestamps,
              series: K.flatMap((Z) => Z.series)
            };
            O.type === "timeseries" ? u.value = A : c.value = A;
            return;
          }
          if (O.type === "histogram") {
            const K = W.map(
              (A) => Vl(M, 15, A.seriesCount ?? 1, A.pattern, A.labels)
            );
            v.value = {
              seriesValues: K.flatMap((A) => A.series.map((Z) => Z.values)),
              seriesLabels: K.flatMap((A) => A.series.map((Z) => Z.label))
            };
            return;
          }
          const J = await Promise.all(
            W.map(async (K) => Vl(M, 15, 1, K.pattern, K.labels).series[0] ?? { label: K.metric || "series", values: [] })
          );
          if (O.type === "stat" || O.type === "gauge")
            p.value = {
              value: J[0]?.values[J[0].values.length - 1] ?? 0,
              values: J.map((K) => K.values[K.values.length - 1] ?? 0),
              series: J.map((K) => ({
                label: K.label,
                values: K.values,
                displayValue: zo(K.values, O.statReducer ?? "lastNotNull"),
                percentChange: O.showPercentChange ? aa(K.values) : void 0
              })),
              unit: O.unit ?? O.statUnit ?? "",
              trend: O.statTrend ?? "flat",
              percentChange: O.showPercentChange ? aa(J[0]?.values ?? []) : void 0
            };
          else if (O.type === "pie")
            b.value = J.map((K, A) => ({
              label: K.label,
              value: zo(K.values, O.statReducer ?? "lastNotNull"),
              color: T[A % T.length],
              rawValues: K.values
            }));
          else if (O.type === "table") {
            const K = Vl(M, 15, G.seriesCount ?? 1, G.pattern, G.labels);
            y.value = {
              columns: [
                { key: "time", title: "Time", dataIndex: "time" },
                ...K.series.map((A) => ({ key: A.label, title: A.label, dataIndex: A.label }))
              ],
              dataSource: K.timestamps.map((A, Z) => {
                const Y = { time: new Date(A * 1e3).toLocaleString(), key: Z };
                return K.series.forEach(($) => {
                  Y[$.label] = $.values[Z];
                }), Y;
              })
            };
          }
        } catch (W) {
          f.value = W?.message ?? String(W);
        } finally {
          r.value = !1;
        }
      }
    }
    Fe(z, (O) => {
      if (!O)
        return;
      const W = a.value;
      W && (W.type === "timeseries" ? u.value = {
        timestamps: O.timestamps,
        series: O.seriesValues.map((te, M) => ({
          label: `series-${M}`,
          values: te
        }))
      } : W.type === "stat" || W.type === "gauge" ? p.value = {
        value: O.seriesValues[0]?.[O.seriesValues[0].length - 1] ?? 0,
        values: O.seriesValues.map((te) => te[te.length - 1] ?? 0),
        series: O.seriesValues.map((te, M) => ({
          label: `series-${M}`,
          values: te,
          displayValue: zo(te, W.statReducer ?? "lastNotNull"),
          percentChange: W.showPercentChange ? aa(te) : void 0
        })),
        unit: W.statUnit ?? "",
        trend: W.statTrend ?? "flat",
        percentChange: W.showPercentChange ? aa(O.seriesValues[0] ?? []) : void 0
      } : W.type === "pie" ? b.value = O.seriesValues.map((te, M) => ({
        label: `series-${M}`,
        value: zo(te, W.statReducer ?? "lastNotNull"),
        color: T[M % T.length],
        rawValues: te
      })) : W.type === "histogram" && (v.value = {
        seriesValues: O.seriesValues,
        seriesLabels: O.seriesValues.map((te, M) => `series-${M}`)
      }));
    }, { deep: !0 }), Fe(() => n.panelRefreshKeys[t.panelId], F, { immediate: !0 }), Fe(() => n.timeRange, F, { deep: !0 });
    const U = ze({
      name: "NoDataPlaceholder",
      setup() {
        const { t: O } = ot();
        return () => Mn("div", { class: "flex flex-col items-center justify-center h-full gap-1.5 text-gray-400 select-none" }, [
          Mn("span", { class: [Me.databaseOff, "text-7", "opacity-50"] }),
          Mn("span", { class: "text-xs" }, O("panel.noData"))
        ]);
      }
    });
    return (O, W) => {
      const te = lt("a-table");
      return a.value ? r.value && !z.value ? (E(), B("div", Y1, [
        k(d(Jn))
      ])) : f.value ? (E(), B("div", U1, I(f.value), 1)) : (E(), B("div", K1, [
        r.value && z.value ? (E(), B("div", X1, [
          k(d(Jn))
        ])) : ye("", !0),
        a.value.type === "timeseries" ? (E(), B(Pe, { key: 1 }, [
          u.value && u.value.series.length > 0 ? (E(), B("div", Q1, [
            k(nr, {
              data: u.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"])
          ])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : a.value.type === "bar" ? (E(), B(Pe, { key: 2 }, [
          c.value && c.value.series.length > 0 ? (E(), Ce(E1, {
            key: 0,
            data: c.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"])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : a.value.type === "stat" ? (E(), B(Pe, { key: 3 }, [
          p.value ? (E(), Ce(j1, {
            key: 0,
            title: a.value.title,
            unit: p.value.unit,
            series: p.value.series,
            trend: p.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"])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : a.value.type === "gauge" ? (E(), B(Pe, { key: 4 }, [
          p.value ? (E(), Ce(A1, {
            key: 0,
            series: p.value.series.map((M, G) => ({
              label: M.label,
              value: M.displayValue ?? M.values[M.values.length - 1] ?? 0,
              activeColorOverride: T[G % T.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"])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : a.value.type === "table" ? (E(), B(Pe, { key: 5 }, [
          y.value ? (E(), B("div", J1, [
            k(te, {
              columns: y.value.columns,
              "data-source": y.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"])
          ])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : a.value.type === "pie" ? (E(), B(Pe, { key: 6 }, [
          b.value && b.value.length > 0 ? (E(), Ce(W1, {
            key: 0,
            slices: b.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"])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : a.value.type === "histogram" ? (E(), B(Pe, { key: 7 }, [
          v.value && v.value.seriesValues.length > 0 ? (E(), Ce(O1, {
            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"])) : (E(), Ce(d(U), { key: 1 }))
        ], 64)) : ye("", !0)
      ])) : (E(), B("div", G1, I(d(i)("panel.noData")), 1));
    };
  }
}), Z1 = { class: "w-full h-full flex flex-col" }, ex = { class: "flex-1 min-h-0" }, tx = {
  key: 1,
  class: "flex-center h-full text-secondary text-sm"
}, nx = /* @__PURE__ */ ze({
  __name: "ChartPreview",
  setup(e) {
    const { panel: t } = ao(), n = re(() => {
      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) => (E(), B("div", Z1, [
      m("div", ex, [
        d(t).id ? (E(), Ce(Rs, {
          key: n.value,
          "panel-id": d(t).id,
          "panel-config": d(t)
        }, null, 8, ["panel-id", "panel-config"])) : (E(), B("div", tx, " No preview available "))
      ])
    ]));
  }
}), ix = { class: "w-full h-full flex flex-col" }, lx = { class: "flex-1 min-h-0" }, ox = /* @__PURE__ */ ze({
  __name: "PanelChrome",
  setup(e) {
    const t = Mi(), { panel: n } = ao(), i = re(() => t.isDark), a = re(() => i.value ? "#303030" : "#e8e8e8"), r = re(() => i.value ? "#d9d9d9" : "#141414"), f = re(() => i.value ? "#666" : "#bbb");
    return (u, c) => (E(), B("div", ix, [
      m("div", {
        class: "flex items-center px-2.5 py-1.5 flex-shrink-0 gap-1.5 h-32px",
        style: He({ borderBottom: `1px solid ${a.value}` })
      }, [
        m("span", {
          class: "text-xs font-medium truncate",
          style: He({ color: r.value })
        }, I(d(n).title || "—"), 5),
        d(n).description ? (E(), Ce(d(Pn), {
          key: 0,
          title: d(n).description,
          placement: "bottom"
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).info, "text-xs"]),
              style: He({ color: f.value })
            }, null, 6)
          ]),
          _: 1
        }, 8, ["title"])) : ye("", !0),
        k(wd, {
          links: d(n).links ?? [],
          "icon-color": f.value
        }, null, 8, ["links", "icon-color"])
      ], 4),
      m("div", lx, [
        k(nx)
      ])
    ]));
  }
}), Cd = /* @__PURE__ */ ze({
  __name: "TimeRangePicker",
  setup(e) {
    const { RangePicker: t } = Ld, n = fi(), 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 }
    ], r = fe(!1), f = Math.round((n.timeRange.to - n.timeRange.from) / 6e4), u = i.find((y) => y.minutes === f);
    function c(y) {
      const b = Date.now();
      n.setTimeRange({ from: b - y * 60 * 1e3, to: b }), r.value = !1;
    }
    function p() {
      const y = Date.now(), b = n.timeRange.to - n.timeRange.from;
      n.setTimeRange({ from: y - b, to: y });
    }
    return (y, b) => (E(), Ce(d(Wl), null, {
      default: R(() => [
        k(d(Wl).Compact, null, {
          default: R(() => [
            r.value ? (E(), Ce(d(t), {
              key: 1,
              "show-time": "",
              "allow-clear": !1,
              style: { width: "320px" },
              value: [d(ar)(d(n).timeRange.from), d(ar)(d(n).timeRange.to)],
              onChange: b[1] || (b[1] = (v) => {
                v?.[0] && v?.[1] && d(n).setTimeRange({ from: v[0].valueOf(), to: v[1].valueOf() });
              })
            }, null, 8, ["value"])) : (E(), Ce(d(Qe), {
              key: 0,
              value: d(u)?.minutes,
              options: i.map((v) => ({ value: v.minutes, label: v.label })),
              "popup-match-select-width": "false",
              placeholder: "快速选择",
              onChange: b[0] || (b[0] = (v) => c(v))
            }, null, 8, ["value", "options"])),
            k(d(tt), {
              onClick: b[2] || (b[2] = (v) => r.value = !r.value)
            }, {
              default: R(() => [
                ce(I(r.value ? "收起" : "自定义"), 1)
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        k(d(Wl).Compact, null, {
          default: R(() => [
            k(d(tt), { onClick: p }, {
              default: R(() => [
                m("span", {
                  class: Ae([d(Me).refresh, "mr-1"])
                }, null, 2),
                b[4] || (b[4] = ce(" 刷新 ", -1))
              ]),
              _: 1
            }),
            k(d(Qe), {
              value: d(n).autoRefresh,
              options: a,
              "popup-match-select-width": "false",
              onChange: b[3] || (b[3] = (v) => d(n).setAutoRefresh(v))
            }, null, 8, ["value"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
}), ax = { class: "font-semibold mb-3" }, sx = /* @__PURE__ */ ze({
  __name: "ConstantOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot();
    return (a, r) => {
      const f = lt("a-form-item");
      return E(), B("div", null, [
        m("div", ax, I(d(i)("variable.constant.title")), 1),
        k(f, {
          label: d(i)("variable.constant.value"),
          required: ""
        }, {
          default: R(() => [
            k(d(Ze), {
              size: "small",
              value: e.config.constantValue,
              onChange: r[0] || (r[0] = (u) => n("change", { constantValue: u.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(d(Gi), {
          checked: e.config.hide,
          onChange: r[1] || (r[1] = (u) => n("change", { hide: u.target.checked }))
        }, {
          default: R(() => [
            ce(I(d(i)("variable.constant.hide")), 1)
          ]),
          _: 1
        }, 8, ["checked"])
      ]);
    };
  }
}), rx = { class: "font-semibold mb-3" }, ux = { class: "mt-3" }, cx = { class: "mt-2" }, dx = /* @__PURE__ */ ze({
  __name: "CustomOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = ot();
    function r() {
      const f = [...n.config.customOptions ?? []];
      i("change", { customOptions: f });
    }
    return (f, u) => {
      const c = lt("a-form-item");
      return E(), B("div", null, [
        m("div", rx, I(d(a)("variable.custom.title")), 1),
        (E(!0), B(Pe, null, Xe(e.config.customOptions ?? [], (p, y) => (E(), B("div", {
          key: y,
          class: "flex gap-2 mb-2"
        }, [
          k(d(Ze), {
            size: "small",
            value: p.text,
            placeholder: "Text",
            onChange: (b) => {
              const v = [...e.config.customOptions ?? []];
              v[y] = { ...v[y], text: b.target.value }, i("change", { customOptions: v });
            }
          }, null, 8, ["value", "onChange"]),
          k(d(Ze), {
            size: "small",
            value: p.value,
            placeholder: "Value",
            onChange: (b) => {
              const v = [...e.config.customOptions ?? []];
              v[y] = { ...v[y], value: b.target.value }, i("change", { customOptions: v });
            }
          }, null, 8, ["value", "onChange"]),
          k(d(tt), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (b) => i("change", { customOptions: (e.config.customOptions ?? []).filter((v, C) => C !== y) })
          }, {
            default: R(() => [
              m("span", {
                class: Ae(d(Me).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]))), 128)),
        k(d(tt), {
          type: "dashed",
          size: "small",
          block: "",
          onClick: r
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).plus, "mr-1"])
            }, null, 2),
            ce(" " + I(d(a)("variable.custom.add")), 1)
          ]),
          _: 1
        }),
        m("div", ux, [
          k(c, {
            label: d(a)("variable.custom.allValue")
          }, {
            default: R(() => [
              k(d(Ze), {
                size: "small",
                value: e.config.allValue,
                placeholder: "$_all",
                onChange: u[0] || (u[0] = (p) => i("change", { allValue: p.target.value }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        m("div", cx, [
          k(d(Gi), {
            checked: e.config.multi,
            onChange: u[1] || (u[1] = (p) => i("change", { multi: p.target.checked }))
          }, {
            default: R(() => [
              ce(I(d(a)("variable.query.multi")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        m("div", null, [
          k(d(Gi), {
            checked: e.config.includeAll,
            onChange: u[2] || (u[2] = (p) => i("change", { includeAll: p.target.checked }))
          }, {
            default: R(() => [
              ce(I(d(a)("variable.query.includeAll")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ])
      ]);
    };
  }
}), fx = { class: "font-semibold mb-3" }, hx = /* @__PURE__ */ ze({
  __name: "DataSourceOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot(), a = [
      { label: "Zabbix", value: "zabbix" },
      { label: "Prometheus", value: "prometheus" },
      { label: "MySQL", value: "mysql" }
    ];
    return (r, f) => {
      const u = lt("a-form-item");
      return E(), B("div", null, [
        m("div", fx, I(d(i)("variable.ds.title")), 1),
        k(u, {
          label: d(i)("variable.ds.type")
        }, {
          default: R(() => [
            k(d(Qe), {
              value: e.config.dsType,
              options: a,
              placeholder: d(i)("variable.ds.type.placeholder"),
              onChange: f[0] || (f[0] = (c) => n("change", { dsType: c }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(u, {
          label: d(i)("variable.ds.filterRegex")
        }, {
          default: R(() => [
            k(d(Ze), {
              value: e.config.instanceFilterRegex ?? "",
              placeholder: "/regex/",
              onChange: f[1] || (f[1] = (c) => n("change", { instanceFilterRegex: c.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(u, null, {
          default: R(() => [
            k(d(Gi), {
              checked: e.config.multi,
              onChange: f[2] || (f[2] = (c) => n("change", { multi: c.target.checked }))
            }, {
              default: R(() => [
                ce(I(d(i)("variable.ds.multi")), 1)
              ]),
              _: 1
            }, 8, ["checked"])
          ]),
          _: 1
        }),
        k(u, null, {
          default: R(() => [
            k(d(Gi), {
              checked: e.config.includeAll,
              onChange: f[3] || (f[3] = (c) => n("change", { includeAll: c.target.checked }))
            }, {
              default: R(() => [
                ce(I(d(i)("variable.ds.includeAll")), 1)
              ]),
              _: 1
            }, 8, ["checked"])
          ]),
          _: 1
        })
      ]);
    };
  }
}), gx = { class: "font-semibold mb-3" }, px = { class: "grid grid-cols-2 gap-x-4" }, mx = /* @__PURE__ */ ze({
  __name: "GeneralSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot(), 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.constant"), value: "constant" }
    ], r = [
      { 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 f(u) {
      n("change", {
        type: u,
        queryType: void 0,
        extractRegex: void 0,
        sortMode: void 0,
        customOptions: void 0,
        allValue: void 0,
        constantValue: void 0
      });
    }
    return (u, c) => {
      const p = lt("a-form-item");
      return E(), B("div", null, [
        m("div", gx, I(d(i)("variable.general.title")), 1),
        m("div", px, [
          k(p, {
            label: d(i)("variable.general.type"),
            required: ""
          }, {
            default: R(() => [
              k(d(Qe), {
                value: e.config.type,
                options: a,
                style: { width: "100%" },
                onChange: f
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: d(i)("variable.general.name"),
            required: ""
          }, {
            default: R(() => [
              k(d(Ze), {
                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"]),
          k(p, {
            label: d(i)("variable.general.label")
          }, {
            default: R(() => [
              k(d(Ze), {
                value: e.config.label,
                placeholder: d(i)("variable.general.label.placeholder"),
                onChange: c[1] || (c[1] = (y) => n("change", { label: y.target.value }))
              }, null, 8, ["value", "placeholder"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: d(i)("variable.general.showOn")
          }, {
            default: R(() => [
              k(d(Qe), {
                value: e.config.showOnDashboard ?? "label-and-value",
                options: r,
                style: { width: "100%" },
                onChange: c[2] || (c[2] = (y) => n("change", { showOnDashboard: y }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        k(p, {
          label: d(i)("variable.general.description")
        }, {
          default: R(() => [
            k(d(Ze), {
              value: e.config.description ?? "",
              placeholder: d(i)("variable.general.description.placeholder"),
              onChange: c[3] || (c[3] = (y) => n("change", { description: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), vx = { class: "font-semibold mb-3" }, yx = { class: "grid grid-cols-2 gap-x-4" }, bx = { class: "mb-2" }, xx = { class: "mb-2" }, wx = {
  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" }
}, Sx = /* @__PURE__ */ ze({
  __name: "QueryOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot(), 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" }
    ], r = [
      { label: i("variable.query.sort.disabled"), value: "disabled" },
      { label: i("variable.query.sort.alphabetical"), value: "alphabetical" },
      { label: i("variable.query.sort.numeric"), value: "numeric" }
    ], f = [
      { label: i("variable.query.refresh.onLoad"), value: "onLoad" },
      { label: i("variable.query.refresh.onTimeChange"), value: "onTimeChange" }
    ];
    return (u, c) => {
      const p = lt("a-form-item");
      return E(), B("div", null, [
        m("div", vx, I(d(i)("variable.query.title")), 1),
        k(p, {
          label: d(i)("variable.query.dsUid")
        }, {
          default: R(() => [
            k(d(Ze), {
              size: "small",
              value: e.config.targetDsUid ?? "",
              placeholder: d(i)("variable.query.dsUid.placeholder"),
              onChange: c[0] || (c[0] = (y) => n("change", { targetDsUid: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(p, {
          label: d(i)("variable.query.queryType")
        }, {
          default: R(() => [
            k(d(Qe), {
              size: "small",
              value: e.config.queryType,
              options: a,
              style: { width: "100%" },
              placeholder: d(i)("variable.query.queryType.placeholder"),
              onChange: c[1] || (c[1] = (y) => n("change", { queryType: y }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(p, {
          label: d(i)("variable.query.query")
        }, {
          default: R(() => [
            k(d(Ze), {
              size: "small",
              value: e.config.query ?? "",
              placeholder: d(i)("variable.query.query.placeholder"),
              onChange: c[2] || (c[2] = (y) => n("change", { query: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(p, {
          label: d(i)("variable.query.regex")
        }, {
          default: R(() => [
            k(d(Ze), {
              size: "small",
              value: e.config.extractRegex ?? "",
              placeholder: d(i)("variable.query.regex.placeholder"),
              onChange: c[3] || (c[3] = (y) => n("change", { extractRegex: y.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        m("div", yx, [
          k(p, {
            label: d(i)("variable.query.sort")
          }, {
            default: R(() => [
              k(d(Qe), {
                size: "small",
                value: e.config.sortMode ?? "disabled",
                options: r,
                style: { width: "100%" },
                onChange: c[4] || (c[4] = (y) => n("change", { sortMode: y }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: d(i)("variable.query.refresh")
          }, {
            default: R(() => [
              k(d(Qe), {
                size: "small",
                value: e.config.refresh,
                options: f,
                style: { width: "100%" },
                onChange: c[5] || (c[5] = (y) => n("change", { refresh: y }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        m("div", bx, [
          k(d(Gi), {
            checked: e.config.multi,
            onChange: c[6] || (c[6] = (y) => n("change", { multi: y.target.checked }))
          }, {
            default: R(() => [
              ce(I(d(i)("variable.query.multi")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        m("div", xx, [
          k(d(Gi), {
            checked: e.config.includeAll,
            onChange: c[7] || (c[7] = (y) => n("change", { includeAll: y.target.checked }))
          }, {
            default: R(() => [
              ce(I(d(i)("variable.query.includeAll")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        k(p, {
          label: d(i)("variable.query.preview")
        }, {
          default: R(() => [
            m("div", wx, I(d(i)("variable.query.preview.placeholder")), 1)
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), kx = { class: "font-semibold mb-3" }, Cx = /* @__PURE__ */ ze({
  __name: "TextBoxOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot();
    return (a, r) => {
      const f = lt("a-form-item");
      return E(), B("div", null, [
        m("div", kx, I(d(i)("variable.textbox.title")), 1),
        k(f, {
          label: d(i)("variable.textbox.defaultValue")
        }, {
          default: R(() => [
            k(d(Ze), {
              size: "small",
              value: e.config.defaultValue,
              onChange: r[0] || (r[0] = (u) => n("change", { defaultValue: u.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), _x = /* @__PURE__ */ ze({
  __name: "VariableForm",
  props: {
    draft: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t;
    ot();
    function i(a) {
      n("change", a);
    }
    return (a, r) => (E(), Ce(d(Rd), {
      layout: "vertical",
      class: "px-5 py-4 overflow-y-auto flex-1"
    }, {
      default: R(() => [
        k(mx, {
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"]),
        r[0] || (r[0] = m("div", {
          class: "my-4",
          style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
        }, null, -1)),
        e.draft.config.type === "query" ? (E(), Ce(Sx, {
          key: 0,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "datasource" ? (E(), Ce(hx, {
          key: 1,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "custom" ? (E(), Ce(dx, {
          key: 2,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "textbox" ? (E(), Ce(Cx, {
          key: 3,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "constant" ? (E(), Ce(sx, {
          key: 4,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0)
      ]),
      _: 1
    }));
  }
}), zx = {
  class: "w-45 flex flex-col h-full",
  style: { "border-right": "1px solid var(--ant-color-border-secondary)" }
}, Mx = {
  class: "px-3 py-2 text-xs text-secondary",
  style: { "border-bottom": "1px solid var(--ant-color-border-secondary)" }
}, Tx = { class: "flex-1 overflow-y-auto" }, Px = ["onClick"], $x = { key: 0 }, Ex = {
  key: 1,
  class: "text-secondary"
}, Ix = {
  class: "p-2",
  style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
}, Ax = /* @__PURE__ */ ze({
  __name: "VariableNavList",
  props: {
    drafts: {},
    selectedId: {}
  },
  emits: ["select", "add"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot();
    return (a, r) => (E(), B("div", zx, [
      m("div", Mx, I(d(i)("variable.nav.count", { n: e.drafts.length })), 1),
      m("div", Tx, [
        (E(!0), B(Pe, null, Xe(e.drafts, (f) => (E(), B("div", {
          key: f.id,
          class: Ae(["px-3 py-2 cursor-pointer text-sm transition-colors", f.id === e.selectedId ? "bg-blue-50 dark:bg-blue-900/30 border-l-3 border-primary" : "border-l-3 border-transparent"]),
          onClick: (u) => n("select", f.id)
        }, [
          f.config.name ? (E(), B("span", $x, I(f.config.name), 1)) : (E(), B("span", Ex, I(d(i)("variable.nav.unnamed")), 1))
        ], 10, Px))), 128))
      ]),
      m("div", Ix, [
        k(d(tt), {
          type: "dashed",
          block: "",
          onClick: r[0] || (r[0] = (f) => n("add"))
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).plus, "mr-1"])
            }, null, 2),
            ce(" " + I(d(i)("variable.modal.add")), 1)
          ]),
          _: 1
        })
      ])
    ]));
  }
}), Ox = { class: "flex flex-1 overflow-hidden" }, Dx = { class: "flex-1 overflow-hidden flex flex-col" }, qx = {
  key: 1,
  class: "flex-1 flex-center text-secondary text-sm"
}, Lx = {
  class: "flex items-center justify-between px-4 py-3",
  style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
}, Rx = { class: "flex gap-2" }, Nx = /* @__PURE__ */ ze({
  __name: "VariableConfigModal",
  props: {
    open: { type: Boolean }
  },
  emits: ["close"],
  setup(e, { emit: t }) {
    const n = e, i = t, a = to(), { t: r } = ot(), f = fe([]), u = fe(""), c = () => `new-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
    function p(T) {
      return {
        id: "",
        name: T,
        label: "",
        type: "custom",
        hide: !1,
        refresh: "onLoad",
        multi: !1,
        includeAll: !1,
        showOnDashboard: "label-and-value"
      };
    }
    Fe(
      () => n.open,
      (T) => {
        if (T) {
          const q = Object.values(a.variables).map((Q) => ({
            id: Q.config.id,
            isNew: !1,
            config: JSON.parse(JSON.stringify(Q.config))
          }));
          f.value = q, u.value = q[0]?.id ?? "";
        }
      }
    );
    const y = re(
      () => f.value.find((T) => T.id === u.value) ?? null
    );
    function b() {
      const q = `variable_${f.value.length + 1}`, Q = c(), F = {
        id: Q,
        isNew: !0,
        config: p(q)
      };
      f.value = [...f.value, F], u.value = Q;
    }
    function v() {
      if (!y.value)
        return;
      const T = f.value.findIndex((q) => q.id === u.value);
      f.value = f.value.filter((q) => q.id !== u.value), f.value.length > 0 ? u.value = f.value[Math.min(T, f.value.length - 1)].id : u.value = "";
    }
    function C(T) {
      y.value && (f.value = f.value.map(
        (q) => q.id === u.value ? { ...q, config: { ...q.config, ...T } } : q
      ));
    }
    function z() {
      const T = a.variables, q = new Set(f.value.map((F) => F.id)), Q = new Set(Object.keys(T));
      for (const F of Q)
        q.has(F) || a.removeVariable(F);
      for (const F of f.value) {
        const U = F.config;
        F.isNew || !Q.has(F.id) ? a.addVariable(U) : a.updateVariable(F.id, U);
      }
      i("close");
    }
    return (T, q) => (E(), Ce(d(Ul), {
      open: e.open,
      title: d(r)("variable.modal.title"),
      width: 780,
      footer: null,
      "body-style": { padding: 0, height: "480px", display: "flex", flexDirection: "column" },
      onCancel: q[2] || (q[2] = (Q) => i("close"))
    }, {
      default: R(() => [
        m("div", Ox, [
          k(Ax, {
            drafts: f.value,
            "selected-id": u.value,
            onSelect: q[0] || (q[0] = (Q) => u.value = Q),
            onAdd: b
          }, null, 8, ["drafts", "selected-id"]),
          m("div", Dx, [
            y.value ? (E(), Ce(_x, {
              key: 0,
              draft: y.value,
              onChange: C
            }, null, 8, ["draft"])) : (E(), B("div", qx, I(d(r)("variable.modal.placeholder")), 1))
          ])
        ]),
        m("div", Lx, [
          k(d(tt), {
            danger: "",
            disabled: !y.value,
            onClick: v
          }, {
            default: R(() => [
              ce(I(d(r)("variable.modal.delete")), 1)
            ]),
            _: 1
          }, 8, ["disabled"]),
          m("div", Rx, [
            k(d(tt), {
              onClick: q[1] || (q[1] = (Q) => i("close"))
            }, {
              default: R(() => [
                ce(I(d(r)("variable.modal.cancel")), 1)
              ]),
              _: 1
            }),
            k(d(tt), {
              type: "primary",
              onClick: z
            }, {
              default: R(() => [
                ce(I(d(r)("variable.modal.save")), 1)
              ]),
              _: 1
            })
          ])
        ])
      ]),
      _: 1
    }, 8, ["open", "title"]));
  }
}), Vx = {
  key: 0,
  class: "flex items-center gap-3 flex-wrap",
  style: { padding: "0 8px" }
}, Fx = {
  key: 0,
  class: "flex items-center gap-1"
}, Bx = {
  key: 1,
  class: "flex items-center gap-1"
}, Hx = {
  key: 2,
  class: "flex items-center gap-1"
}, _d = /* @__PURE__ */ ze({
  __name: "VariableBar",
  setup(e) {
    const t = to(), n = fi(), i = Mi(), a = fe(!1), r = re(
      () => Object.entries(t.variables).filter(([, c]) => !c.config.hide).map(([c, p]) => ({ id: c, ...p })).sort((c, p) => c.config.name.localeCompare(p.config.name))
    ), f = re(() => i.isDark ? "#888" : "#555");
    function u(c, p) {
      t.setValue(c, p);
      const y = t.variables[c];
      if (y) {
        const b = t.getDependents(y.config.name);
        for (const v of b)
          for (const [C, z] of Object.entries(t.variables))
            if (z.config.name === v) {
              t.refreshVariable(C);
              break;
            }
      }
    }
    return (c, p) => r.value.length > 0 || d(n).isEditing ? (E(), B("div", Vx, [
      (E(!0), B(Pe, null, Xe(r.value, (y) => (E(), B(Pe, {
        key: y.id
      }, [
        y.config.type === "textbox" ? (E(), B("div", Fx, [
          m("span", {
            class: "text-sm",
            style: He({ color: f.value, whiteSpace: "nowrap" })
          }, I(y.config.label), 5),
          k(d(Ze), {
            size: "small",
            style: { width: "160px" },
            value: Array.isArray(y.current) ? y.current[0] || "" : y.current,
            placeholder: "Enter value...",
            onChange: (b) => u(y.id, b.target.value)
          }, null, 8, ["value", "onChange"])
        ])) : y.config.type === "constant" ? (E(), B("div", Bx, [
          y.config.label ? (E(), B("span", {
            key: 0,
            class: "text-sm",
            style: He({ color: f.value, whiteSpace: "nowrap" })
          }, I(y.config.label), 5)) : ye("", !0),
          k(d(Kl), { style: { margin: "0", "font-size": "12px" } }, {
            default: R(() => [
              ce(I(y.config.constantValue ?? ""), 1)
            ]),
            _: 2
          }, 1024)
        ])) : (E(), B("div", Hx, [
          m("span", {
            class: "text-sm",
            style: He({ color: f.value, whiteSpace: "nowrap" })
          }, I(y.config.label || y.config.name) + ": ", 5),
          k(d(Qe), {
            value: y.current,
            mode: y.config.multi ? "multiple" : void 0,
            options: y.options.map((b) => ({ label: b.label === "$__all" ? "All" : b.label, value: b.value })),
            loading: y.loading,
            style: { minWidth: "120px" },
            size: "small",
            "show-search": "",
            "allow-clear": !y.config.multi,
            "filter-option": (b, v) => (v?.label ?? "").toLowerCase().includes(b.toLowerCase()),
            placeholder: `Select ${y.config.label}`,
            onChange: (b) => u(y.id, b)
          }, null, 8, ["value", "mode", "options", "loading", "allow-clear", "filter-option", "placeholder", "onChange"]),
          y.error ? (E(), Ce(d(Kl), {
            key: 0,
            color: "red",
            style: { "font-size": "10px", margin: "0" }
          }, {
            default: R(() => [
              ce(I(y.error), 1)
            ]),
            _: 2
          }, 1024)) : ye("", !0)
        ]))
      ], 64))), 128)),
      d(n).isEditing ? (E(), Ce(d(tt), {
        key: 0,
        size: "small",
        type: "text",
        class: "ml-auto",
        onClick: p[0] || (p[0] = (y) => a.value = !0)
      }, {
        default: R(() => [
          m("span", {
            class: Ae([d(Me).settings, "text-base"])
          }, null, 2)
        ]),
        _: 1
      })) : ye("", !0),
      k(Nx, {
        open: a.value,
        onClose: p[1] || (p[1] = (y) => a.value = !1)
      }, null, 8, ["open"])
    ])) : ye("", !0);
  }
}), Wx = /* @__PURE__ */ ze({
  __name: "DatasourceSelect",
  props: {
    value: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { config: i } = Fo(), a = re(() => {
      const u = [{ value: "mock", label: "Mock", type: "mock", uid: "" }], c = i.value.datasourceConfig ?? [];
      return c.filter((p) => p.type === "zabbix").forEach((p, y) => {
        const b = p.uid || String(y);
        u.push({ value: `zabbix:${b}`, label: `${p.name}`, type: "zabbix", uid: b });
      }), c.filter((p) => p.type === "argus").forEach((p, y) => {
        const b = p.uid || String(y);
        u.push({ value: `argus:${b}`, label: `${p.name}`, type: "argus", uid: b });
      }), u;
    }), r = re(
      () => a.value.map((u) => ({ value: u.value, label: u.label }))
    );
    function f(u) {
      const c = a.value.find((p) => p.value === u);
      c && n("change", c);
    }
    return (u, c) => (E(), Ce(d(Qe), {
      size: "small",
      style: { "min-width": "140px" },
      value: e.value,
      options: r.value,
      onChange: f
    }, null, 8, ["value", "options"]));
  }
}), jx = {
  key: 0,
  class: ""
}, Gx = {
  key: 1,
  class: "pt-2 px-2 text-xs text-secondary"
}, Yx = /* @__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 = re(() => "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[n.index] ?? String(n.index + 1)), r = re(() => ws(n.entry.dataSource.type)), f = re(() => r.value?.QueryEditor ?? null), u = re(() => {
      const y = n.entry.dataSource;
      if (y.type === "mock")
        return "mock";
      const b = "datasourceId" in y ? y.datasourceId : "";
      return b ? `${y.type}:${b}` : y.type;
    });
    function c(y) {
      const b = ws(y.type);
      if (!b?.defaultQuery)
        return;
      const v = { ...b.defaultQuery(), ...y.uid ? { datasourceId: y.uid } : {} };
      i("update", { dataSource: v });
    }
    function p(y) {
      i("update", { dataSource: y });
    }
    return (y, b) => (E(), Ce(d(Sa), {
      size: "small",
      collapsible: "icon",
      bordered: !0,
      "default-active-key": [e.entry.id]
    }, {
      default: R(() => [
        (E(), Ce(d(Sa).Panel, {
          key: e.entry.id
        }, {
          header: R(() => [
            m("div", {
              class: "flex items-center gap-2",
              onClick: b[3] || (b[3] = $n(() => {
              }, ["stop"]))
            }, [
              k(d(Kl), {
                color: "blue",
                style: { "font-size": "12px", "font-weight": "600", margin: "0", "min-width": "24px", "text-align": "center", "line-height": "20px" }
              }, {
                default: R(() => [
                  ce(I(a.value), 1)
                ]),
                _: 1
              }),
              k(d(ki), {
                size: "small",
                checked: e.entry.enabled,
                onChange: b[0] || (b[0] = (v) => i("update", { enabled: v })),
                onClick: b[1] || (b[1] = $n(() => {
                }, ["stop"]))
              }, null, 8, ["checked"]),
              b[5] || (b[5] = m("div", { class: "flex-1" }, null, -1)),
              b[6] || (b[6] = m("span", { style: { "font-size": "11px", color: "var(--ant-color-text-secondary)" } }, "数据源", -1)),
              k(Wx, {
                value: u.value,
                onClick: b[2] || (b[2] = $n(() => {
                }, ["stop"])),
                onChange: c
              }, null, 8, ["value"])
            ])
          ]),
          extra: R(() => [
            e.canDelete ? (E(), Ce(d(tt), {
              key: 0,
              type: "text",
              danger: "",
              size: "small",
              onClick: b[4] || (b[4] = $n((v) => i("remove"), ["stop"]))
            }, {
              default: R(() => [
                m("span", {
                  class: Ae(d(Me).delete)
                }, null, 2)
              ]),
              _: 1
            })) : ye("", !0)
          ]),
          default: R(() => [
            e.entry.enabled && f.value ? (E(), B("div", jx, [
              (E(), Ce(Zu(f.value), {
                query: e.entry.dataSource,
                "datasource-id": "datasourceId" in e.entry.dataSource ? e.entry.dataSource.datasourceId : "",
                "is-chart": e.isChart,
                onChange: p
              }, null, 40, ["query", "datasource-id", "is-chart"]))
            ])) : e.entry.enabled && !f.value ? (E(), B("div", Gx, " No query editor available for datasource type: " + I(e.entry.dataSource.type), 1)) : ye("", !0)
          ]),
          _: 1
        }))
      ]),
      _: 1
    }, 8, ["default-active-key"]));
  }
}), Ux = {
  class: "px-4 py-3 flex flex-col gap-2",
  style: { "min-width": "300px" }
}, Kx = { class: "flex items-center gap-2" }, Xx = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Qx = { class: "flex items-center gap-2" }, Jx = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Zx = { class: "flex items-center gap-2" }, ew = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, tw = {
  class: "text-xs",
  style: { color: "var(--ant-color-text-quaternary)" }
}, nw = { class: "flex items-center gap-2" }, iw = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, lw = { class: "flex items-center gap-2" }, ow = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, ju = 1e3, aw = /* @__PURE__ */ ze({
  __name: "QueryOptionsPanel",
  setup(e) {
    const { t } = ot(), { panel: n, onChange: i } = ao(), a = fi();
    function r(p) {
      return p >= 36e5 ? `${Math.round(p / 36e5)}h` : p >= 6e4 ? `${Math.round(p / 6e4)}m` : p >= 1e3 ? `${Math.round(p / 1e3)}s` : `${p}ms`;
    }
    function f(p) {
      const y = p.trim().match(/^(\d+(?:\.\d+)?)(ms|[smh])?$/i);
      if (!y)
        return;
      const b = Number.parseFloat(y[1]), v = (y[2] ?? "s").toLowerCase();
      return v === "ms" ? b : v === "s" ? b * 1e3 : v === "m" ? b * 6e4 : b * 36e5;
    }
    const u = re(() => {
      const p = n.value.queryOptions?.maxDataPoints ?? ju, y = a.timeRange, b = y.to - y.from;
      return Math.max(Math.ceil(b / p), 1e3);
    }), c = re(() => {
      const p = n.value.queryOptions?.minIntervalMs;
      return p != null ? r(p) : "";
    });
    return (p, y) => (E(), B("div", Ux, [
      m("div", Kx, [
        m("span", Xx, [
          k(d(Pn), {
            title: d(t)("qb.queryOptions.maxDataPoints")
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(d(t)("qb.queryOptions.maxDataPoints")), 1)
        ]),
        k(d(on), {
          size: "small",
          style: { width: "100px" },
          min: 1,
          value: d(n).queryOptions?.maxDataPoints,
          placeholder: String(ju),
          onChange: y[0] || (y[0] = (b) => d(i)({ queryOptions: { ...d(n).queryOptions, maxDataPoints: b ?? void 0 } }))
        }, null, 8, ["value", "placeholder"])
      ]),
      m("div", Qx, [
        m("span", Jx, [
          k(d(Pn), {
            title: d(t)("qb.queryOptions.minInterval")
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(d(t)("qb.queryOptions.minInterval")), 1)
        ]),
        k(d(Ze), {
          size: "small",
          style: { width: "100px" },
          value: c.value,
          placeholder: d(t)("qb.queryOptions.minIntervalPlaceholder"),
          onChange: y[1] || (y[1] = (b) => {
            const v = b.target.value.trim();
            if (!v) {
              d(i)({ queryOptions: { ...d(n).queryOptions, minIntervalMs: void 0 } });
              return;
            }
            const C = f(v);
            C !== void 0 && d(i)({ queryOptions: { ...d(n).queryOptions, minIntervalMs: C } });
          })
        }, null, 8, ["value", "placeholder"])
      ]),
      m("div", Zx, [
        m("span", ew, [
          k(d(Pn), {
            title: d(t)("qb.queryOptions.interval")
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(d(t)("qb.queryOptions.interval")), 1)
        ]),
        k(d(Ze), {
          size: "small",
          style: { width: "100px" },
          value: r(u.value),
          readonly: ""
        }, null, 8, ["value"]),
        m("span", tw, " = " + I(d(t)("qb.queryOptions.intervalHint")), 1)
      ]),
      m("div", nw, [
        m("span", iw, [
          k(d(Pn), {
            title: d(t)("qb.queryOptions.relativeTime")
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(d(t)("qb.queryOptions.relativeTime")), 1)
        ]),
        k(d(Ze), {
          size: "small",
          style: { width: "100px" },
          placeholder: "1h",
          value: d(n).queryOptions?.relativeTime ?? "",
          onChange: y[2] || (y[2] = (b) => d(i)({ queryOptions: { ...d(n).queryOptions, relativeTime: b.target.value || void 0 } }))
        }, null, 8, ["value"])
      ]),
      m("div", lw, [
        m("span", ow, [
          k(d(Pn), {
            title: d(t)("qb.queryOptions.timeShift")
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(d(t)("qb.queryOptions.timeShift")), 1)
        ]),
        k(d(Ze), {
          size: "small",
          style: { width: "100px" },
          placeholder: "1h",
          value: d(n).queryOptions?.timeShift ?? "",
          onChange: y[3] || (y[3] = (b) => d(i)({ queryOptions: { ...d(n).queryOptions, timeShift: b.target.value || void 0 } }))
        }, null, 8, ["value"])
      ])
    ]));
  }
}), sw = { class: "flex flex-col h-full" }, rw = {
  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)" }
}, uw = { class: "flex-1 overflow-y-auto px-3 py-2 flex flex-col gap-2" }, cw = {
  key: 0,
  class: "text-center text-secondary text-sm py-8"
}, dw = /* @__PURE__ */ ze({
  __name: "QueryEditorPane",
  setup(e) {
    const { t } = ot(), { panel: n, onChange: i } = ao(), a = re(() => ["timeseries", "bar", "histogram"].includes(n.value.type)), r = re(() => n.value.queries ?? []), f = fe(!1), u = fe("mock");
    function c(b, v) {
      i({ queries: r.value.map((C, z) => z === b ? { ...C, ...v } : C) });
    }
    function p(b) {
      i({ queries: r.value.filter((v, C) => C !== b) });
    }
    function y() {
      if (r.value.length >= 26)
        return;
      const b = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[r.value.length] ?? String(r.value.length + 1), [v, C = ""] = u.value.split(":"), z = ws(v);
      if (!z?.defaultQuery)
        return;
      const T = {
        ...z.defaultQuery(),
        ...C ? { datasourceId: C } : {},
        // Non-chart types: each query = 1 series; seriesCount controlled by query count
        ...!a.value && "seriesCount" in z.defaultQuery() ? { seriesCount: 1 } : {}
      };
      i({
        queries: [...r.value, { id: b, enabled: !0, dataSource: T }]
      });
    }
    return (b, v) => (E(), B("div", sw, [
      m("div", rw, [
        k(_d),
        v[1] || (v[1] = m("div", { class: "flex-1" }, null, -1)),
        k(Cd),
        k(d(Nd), {
          type: "vertical",
          style: { margin: "0" }
        }),
        k(d(Wl).Compact, null, {
          default: R(() => [
            k(d(tt), {
              type: "primary",
              disabled: r.value.length >= 26,
              onClick: y
            }, {
              default: R(() => [
                m("span", {
                  class: Ae([d(Me).plus, "mr-1"])
                }, null, 2),
                ce(" " + I(d(t)("qb.addQuery")), 1)
              ]),
              _: 1
            }, 8, ["disabled"]),
            k(d(Vd), {
              open: f.value,
              "onUpdate:open": v[0] || (v[0] = (C) => f.value = C),
              trigger: "click",
              placement: "bottomRight",
              "overlay-inner-style": { padding: 0, minWidth: "320px" }
            }, {
              content: R(() => [
                k(aw)
              ]),
              default: R(() => [
                k(d(tt), { class: "text-12px cursor-pointer hover:op-90 active:op-80 underline" }, {
                  default: R(() => [
                    ce(I(d(t)("qb.queryOptions")) + " ", 1),
                    m("span", {
                      class: Ae([d(Me).chevronDown, ""])
                    }, null, 2)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["open"])
          ]),
          _: 1
        })
      ]),
      m("div", uw, [
        (E(!0), B(Pe, null, Xe(r.value, (C, z) => (E(), Ce(Yx, {
          key: C.id,
          entry: C,
          index: z,
          "is-chart": a.value,
          "can-delete": r.value.length > 1,
          onUpdate: (T) => c(z, T),
          onRemove: () => p(z)
        }, null, 8, ["entry", "index", "is-chart", "can-delete", "onUpdate", "onRemove"]))), 128)),
        r.value.length === 0 ? (E(), B("div", cw, ' No queries. Click "' + I(d(t)("qb.addQuery")) + '" to start. ', 1)) : ye("", !0)
      ])
    ]));
  }
}), fw = { class: "w-full h-full" }, hw = { class: "w-full h-full" }, gw = /* @__PURE__ */ ze({
  __name: "PanelEditorLayout",
  setup(e) {
    const n = Mi().isDark ? "#303030" : "#e8e8e8";
    return (i, a) => (E(), Ce(d(Fu), { style: { height: "100%" } }, {
      default: R(() => [
        k(d(pa), { "min-size": 200 }, {
          default: R(() => [
            k(d(Fu), {
              vertical: "",
              "default-sizes": [100, 200]
            }, {
              default: R(() => [
                k(d(pa), { "min-size": 100 }, {
                  default: R(() => [
                    m("div", fw, [
                      k(ox)
                    ])
                  ]),
                  _: 1
                }),
                k(d(pa), { "min-size": 60 }, {
                  default: R(() => [
                    m("div", hw, [
                      k(dw)
                    ])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        k(d(pa), {
          "preferred-size": "35%",
          "min-size": 200
        }, {
          default: R(() => [
            m("div", {
              class: "w-full h-full overflow-y-auto",
              style: He({ borderLeft: `1px solid ${d(n)}` })
            }, [
              k(E0)
            ], 4)
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
}), pw = { class: "flex items-center gap-2" }, mw = { class: "font-medium text-sm" }, vw = { class: "flex justify-end gap-2 py-1" }, yw = /* @__PURE__ */ ze({
  __name: "PanelEditorModal",
  setup(e) {
    const t = fi(), { t: n } = ot(), i = fe(null), a = fe(null), r = re(() => {
      const z = t.editingPanelId;
      return z ? t.panels[z] : null;
    }), f = re(() => i.value ?? r.value), u = re(() => {
      const z = a.value?.data?.[0];
      return z ? z.fields.filter((T) => T.type === "number").map((T) => T.name) : [];
    }), c = re(() => {
      const z = a.value?.data?.[0];
      return z ? z.fields.map((T) => T.config?.displayNameFromDS ?? T.name) : [];
    });
    function p(z) {
      f.value && (i.value = { ...f.value, ...z });
    }
    function y() {
      i.value && t.editingPanelId && t.updatePanel(t.editingPanelId, i.value), i.value = null, t.setEditingPanel(null);
    }
    function b() {
      i.value = null, t.setEditingPanel(null);
    }
    Fe(() => t.editingPanelId, (z) => {
      z || (i.value = null);
    });
    const v = re(() => !!t.editingPanelId && !!r.value), C = fe(!1);
    return Fe(v, (z) => {
      z && !C.value && setTimeout(() => {
        C.value = !0;
      }, 0);
    }), ym({
      panel: re(() => f.value),
      onChange: p,
      previewData: a,
      numericFieldNames: u,
      allFieldNames: c
    }), (z, T) => (E(), Ce(d(Fd), {
      open: v.value,
      closable: !0,
      mask: !1,
      placement: "right",
      width: "71vw",
      "body-style": { padding: 0 },
      "destroy-on-close": !1,
      onClose: b
    }, {
      title: R(() => [
        m("div", pw, [
          m("span", mw, "Edit: " + I(f.value?.title ?? ""), 1)
        ])
      ]),
      footer: R(() => [
        m("div", vw, [
          k(d(tt), { onClick: b }, {
            default: R(() => [
              ce(I(d(n)("dashboard.cancel")), 1)
            ]),
            _: 1
          }),
          k(d(tt), {
            type: "primary",
            onClick: y
          }, {
            default: R(() => [
              ce(I(d(n)("dashboard.save")), 1)
            ]),
            _: 1
          })
        ])
      ]),
      default: R(() => [
        f.value && C.value ? (E(), Ce(gw, { key: 0 })) : ye("", !0)
      ]),
      _: 1
    }, 8, ["open"]));
  }
}), bw = {
  key: 0,
  class: "panel-container w-full h-full flex flex-col rounded-lg overflow-hidden bg-white dark:bg-[#1f1f1f] border border-[#e8e8e8] dark:border-[#303030]"
}, xw = { class: "flex items-center gap-2 min-w-0 lh-1 flex-1 text-[#666] dark:text-[#666]" }, ww = {
  key: 0,
  class: "drag-handle flex-shrink-0 cursor-grab"
}, Sw = { class: "text-sm truncate text-[#141414] dark:text-[#d9d9d9]" }, kw = { class: "panel-actions flex items-center gap-10px lh-1 flex-shrink-0 text-[#444] dark:text-[#666]" }, Cw = { class: "panel-content flex-1 overflow-hidden" }, _w = { class: "w-full h-full flex flex-col rounded-lg overflow-hidden bg-white dark:bg-[#1f1f1f]" }, zw = { class: "panel-content flex-1 overflow-hidden" }, Mw = /* @__PURE__ */ ze({
  __name: "PanelContainer",
  props: {
    panelId: {},
    menuMode: { default: "inline" }
  },
  setup(e) {
    const t = e, n = fi(), i = Mi(), { t: a } = ot(), r = fe(!1), f = fe(!1), u = re(() => n.panels[t.panelId]), c = re(() => i.isDark), p = re(() => c.value ? "#666" : "#bbb"), y = re(() => {
      const z = (T) => Mn("span", { class: T });
      return n.isEditing ? [
        { key: "edit", label: a("panel.menu.edit"), icon: () => z(Me.edit) },
        { key: "clone", label: a("panel.menu.clone"), icon: () => z(Me.clone) },
        { key: "fullscreen", label: a("panel.menu.fullscreen"), icon: () => z(Me.fullscreen) },
        { type: "divider" },
        { key: "remove", label: a("panel.menu.remove"), icon: () => z(Me.delete), danger: !0 }
      ] : [
        { key: "fullscreen", label: a("panel.menu.fullscreen"), icon: () => z(Me.fullscreen) }
      ];
    });
    function b(z) {
      switch (z) {
        case "edit":
          n.setEditingPanel(t.panelId);
          break;
        case "clone":
          n.clonePanel(t.panelId);
          break;
        case "remove":
          Ul.confirm({
            title: a("panel.remove.title", { title: u.value?.title ?? "" }),
            content: a("panel.remove.content"),
            okText: a("panel.remove.ok"),
            okButtonProps: { danger: !0 },
            onOk: () => n.removePanel(t.panelId)
          });
          break;
        case "fullscreen":
          r.value = !0;
          break;
      }
    }
    function v(z) {
      f.value = !1, b(String(z.key));
    }
    function C(z) {
      z.stopPropagation(), n.refreshPanel(t.panelId);
    }
    return (z, T) => (E(), B(Pe, null, [
      u.value && !r.value ? (E(), B("div", bw, [
        m("div", {
          class: "panel-header flex items-center px-3 py-2 flex-shrink-0 border-b border-[#e8e8e8] dark:border-[#303030]",
          onDblclick: T[6] || (T[6] = (q) => d(n).isEditing && d(n).setEditingPanel(t.panelId))
        }, [
          m("div", xw, [
            d(n).isEditing ? (E(), B("span", ww, [
              m("span", {
                class: Ae(d(Me).dragVertical)
              }, null, 2)
            ])) : ye("", !0),
            m("span", Sw, I(u.value.title), 1),
            u.value.description ? (E(), Ce(d(Pn), {
              key: 1,
              title: u.value.description,
              placement: "bottom"
            }, {
              default: R(() => [
                m("span", {
                  class: Ae([d(Me).info, "flex-shrink-0"])
                }, null, 2)
              ]),
              _: 1
            }, 8, ["title"])) : ye("", !0),
            k(wd, {
              links: u.value.links ?? [],
              "icon-color": p.value
            }, null, 8, ["links", "icon-color"])
          ]),
          m("div", kw, [
            k(d(Pn), {
              title: d(a)("panel.menu.refresh")
            }, {
              default: R(() => [
                m("span", {
                  class: Ae([d(Me).refresh, "panel-refresh-btn cursor-pointer"]),
                  onMousedown: T[0] || (T[0] = $n(() => {
                  }, ["stop"])),
                  onClick: C
                }, null, 34)
              ]),
              _: 1
            }, 8, ["title"]),
            t.menuMode === "inline" ? (E(), B(Pe, { key: 0 }, [
              d(n).isEditing ? (E(), Ce(d(Pn), {
                key: 0,
                title: d(a)("panel.menu.edit")
              }, {
                default: R(() => [
                  m("span", {
                    class: Ae([d(Me).edit, "cursor-pointer"]),
                    onClick: T[1] || (T[1] = (q) => b("edit"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : ye("", !0),
              d(n).isEditing ? (E(), Ce(d(Pn), {
                key: 1,
                title: d(a)("panel.menu.clone")
              }, {
                default: R(() => [
                  m("span", {
                    class: Ae([d(Me).clone, "cursor-pointer"]),
                    onClick: T[2] || (T[2] = (q) => b("clone"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : ye("", !0),
              d(n).isEditing ? (E(), Ce(d(Pn), {
                key: 2,
                title: d(a)("panel.menu.remove")
              }, {
                default: R(() => [
                  m("span", {
                    class: Ae([d(Me).delete, "cursor-pointer text-red-500"]),
                    onClick: T[3] || (T[3] = (q) => b("remove"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : ye("", !0)
            ], 64)) : (E(), Ce(d(Vo), {
              key: 1,
              open: f.value,
              "onUpdate:open": T[5] || (T[5] = (q) => f.value = q),
              trigger: "click"
            }, {
              overlay: R(() => [
                k(d(ii), {
                  items: y.value,
                  onClick: v
                }, null, 8, ["items"])
              ]),
              default: R(() => [
                m("span", {
                  class: "cursor-pointer p-[2px_4px]",
                  onClick: T[4] || (T[4] = $n(() => {
                  }, ["prevent"]))
                }, [
                  m("span", {
                    class: Ae(d(Me).dotsVertical)
                  }, null, 2)
                ])
              ]),
              _: 1
            }, 8, ["open"]))
          ])
        ], 32),
        m("div", Cw, [
          zi(z.$slots, "default", {}, void 0, !0)
        ])
      ])) : ye("", !0),
      r.value ? (E(), Ce(d(Ul), {
        key: 1,
        open: !0,
        title: u.value?.title,
        footer: null,
        width: "92vw",
        "body-style": { height: "82vh", padding: 0 },
        closable: !1,
        onCancel: T[7] || (T[7] = (q) => r.value = !1)
      }, {
        default: R(() => [
          m("div", _w, [
            m("div", zw, [
              zi(z.$slots, "default", {}, void 0, !0)
            ])
          ])
        ]),
        _: 3
      }, 8, ["title"])) : ye("", !0)
    ], 64));
  }
}), Gu = /* @__PURE__ */ xn(Mw, [["__scopeId", "data-v-2c616ca4"]]), Tw = { class: "font-medium text-sm" }, Pw = { class: "text-xs text-secondary mt-1" }, $w = /* @__PURE__ */ ze({
  __name: "AddPanelModal",
  setup(e) {
    const t = fi(), { t: n } = ot(), i = [
      { type: "timeseries", icon: Me.chartLine, descKey: "panel.type.desc.timeseries" },
      { type: "bar", icon: Me.chartBar, descKey: "panel.type.desc.bar" },
      { type: "histogram", icon: Me.chartArea, descKey: "panel.type.desc.histogram" },
      { type: "stat", icon: Me.stat, descKey: "panel.type.desc.stat" },
      { type: "gauge", icon: Me.gauge, descKey: "panel.type.desc.gauge" },
      { type: "table", icon: Me.table, descKey: "panel.type.desc.table" },
      { type: "pie", icon: Me.chartPie, descKey: "panel.type.desc.pie" }
    ];
    function a(r) {
      t.addPanel(r);
    }
    return (r, f) => (E(), Ce(d(Ul), {
      open: d(t).addPanelModalOpen,
      title: d(n)("dashboard.addPanel"),
      footer: null,
      onCancel: f[0] || (f[0] = (u) => d(t).addPanelModalOpen = !1)
    }, {
      default: R(() => [
        k(d(Bd), {
          gutter: [16, 16],
          class: "mt-4"
        }, {
          default: R(() => [
            (E(), B(Pe, null, Xe(i, (u) => k(d(Hd), {
              key: u.type,
              span: 8
            }, {
              default: R(() => [
                k(d(Wd), {
                  hoverable: "",
                  class: "text-center cursor-pointer",
                  onClick: (c) => a(u.type)
                }, {
                  default: R(() => [
                    m("div", {
                      class: Ae(["text-2xl mb-2", u.icon])
                    }, null, 2),
                    m("div", Tw, I(d(n)(`config.type.${u.type}`)), 1),
                    m("div", Pw, I(d(n)(u.descKey)), 1)
                  ]),
                  _: 2
                }, 1032, ["onClick"])
              ]),
              _: 2
            }, 1024)), 64))
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["open", "title"]));
  }
}), Ew = { style: { display: "flex", "align-items": "center", "flex-wrap": "wrap", gap: "8px", padding: "0 4px" } }, Iw = { class: "" }, Aw = { style: { margin: "0" } }, Ow = { style: { margin: "0" } }, Dw = /* @__PURE__ */ ze({
  __name: "DashboardHeader",
  setup(e) {
    const t = fi(), { t: n } = ot(), { config: i } = Fo(), { message: a } = ec.useApp(), r = fe(!1), f = fe(!1), u = fe(null);
    function c() {
      t.confirmSave(i.value.onSave);
    }
    function p() {
      t.isDirty ? r.value = !0 : t.discardChanges();
    }
    function y() {
      r.value = !1, t.discardChanges();
    }
    function b() {
      const F = t.exportJSON(), U = new Blob([F], { type: "application/json" }), O = URL.createObjectURL(U), W = document.createElement("a");
      W.href = O, W.download = "dashboard.json", W.click(), URL.revokeObjectURL(O), a.success(n("dashboard.exportSuccess"));
    }
    function v() {
      u.value?.click();
    }
    function C(F) {
      const U = F.target.files?.[0];
      U && (U.text().then((O) => {
        t.importJSON(O) ? a.success(n("dashboard.importSuccess")) : a.error(n("dashboard.importError"));
      }), F.target.value = "");
    }
    function z(F) {
      t.importJSON(F) ? a.success(n("dashboard.importSuccess")) : a.error(n("dashboard.importError"));
    }
    const T = re(() => {
      const F = Af(), U = (i.value.presets ?? []).map((O) => ({ label: O.label, value: O.config }));
      return [{ label: "内置模板", value: F }, ...U];
    }), q = re(() => [
      { key: "export", label: n("dashboard.export"), icon: Me.export },
      { key: "import", label: n("dashboard.import"), icon: Me.import },
      { type: "divider" },
      { key: "clear", label: n("dashboard.clearPanels"), icon: Me.delete, danger: !0 }
    ]);
    function Q(F) {
      F === "export" ? b() : F === "import" ? v() : F === "clear" && (f.value = !0);
    }
    return (F, U) => (E(), B("div", Ew, [
      d(t).isEditing ? (E(), B(Pe, { key: 0 }, [
        k(d(Wl).Compact, null, {
          default: R(() => [
            k(d(tt), {
              onClick: U[0] || (U[0] = (O) => d(t).addPanelModalOpen = !0)
            }, {
              default: R(() => [
                m("span", {
                  class: Ae([d(Me).plus, "mr-1"])
                }, null, 2),
                ce(" " + I(d(n)("dashboard.addPanel")), 1)
              ]),
              _: 1
            }),
            k(d(Qe), {
              placeholder: "预设",
              "popup-match-select-width": !1,
              options: T.value,
              style: { "min-width": "80px" },
              onSelect: U[1] || (U[1] = (O) => z(O))
            }, null, 8, ["options"]),
            m("input", {
              ref_key: "fileInputRef",
              ref: u,
              type: "file",
              accept: ".json",
              style: { display: "none" },
              onChange: C
            }, null, 544),
            k(d(Vo), { trigger: ["click"] }, {
              overlay: R(() => [
                k(d(ii), {
                  onClick: U[2] || (U[2] = ({ key: O }) => Q(O))
                }, {
                  default: R(() => [
                    (E(!0), B(Pe, null, Xe(q.value, (O) => (E(), B(Pe, {
                      key: O.key ?? O.type
                    }, [
                      O.type === "divider" ? (E(), Ce(d(ii).Divider, { key: 0 })) : (E(), Ce(d(ii).Item, {
                        key: O.key,
                        danger: O.danger
                      }, {
                        default: R(() => [
                          m("span", {
                            class: Ae([O.icon, "mr-1"])
                          }, null, 2),
                          ce(I(O.label), 1)
                        ]),
                        _: 2
                      }, 1032, ["danger"]))
                    ], 64))), 128))
                  ]),
                  _: 1
                })
              ]),
              default: R(() => [
                k(d(tt), null, {
                  default: R(() => [
                    m("span", {
                      class: Ae(d(Me).dotsVertical)
                    }, null, 2)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        k(d(tt), {
          type: "primary",
          ghost: "",
          onClick: c
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).save, "mr-1"])
            }, null, 2),
            ce(" " + I(d(n)("dashboard.save")), 1)
          ]),
          _: 1
        }),
        k(d(tt), {
          danger: d(t).isDirty,
          onClick: p
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).cancel, "mr-1"])
            }, null, 2),
            ce(" " + I(d(n)("dashboard.cancel")), 1)
          ]),
          _: 1
        }, 8, ["danger"])
      ], 64)) : (E(), Ce(d(tt), {
        key: 1,
        onClick: d(t).startEditing
      }, {
        default: R(() => [
          m("span", {
            class: Ae([d(Me).edit, "mr-1"])
          }, null, 2),
          m("span", Iw, I(d(n)("dashboard.edit")), 1)
        ]),
        _: 1
      }, 8, ["onClick"])),
      k(d(Ul), {
        open: r.value,
        "onUpdate:open": U[3] || (U[3] = (O) => r.value = O),
        title: d(n)("dashboard.cancelConfirmTitle"),
        "ok-text": d(n)("dashboard.cancelConfirmOk"),
        "cancel-text": d(n)("dashboard.cancelConfirmCancel"),
        "ok-button-props": { danger: !0 },
        onOk: y,
        onCancel: U[4] || (U[4] = (O) => r.value = !1)
      }, {
        default: R(() => [
          m("p", Aw, I(d(n)("dashboard.cancelConfirmTitle")), 1)
        ]),
        _: 1
      }, 8, ["open", "title", "ok-text", "cancel-text"]),
      k(d(Ul), {
        open: f.value,
        "onUpdate:open": U[5] || (U[5] = (O) => f.value = O),
        title: d(n)("dashboard.clearConfirmTitle"),
        "ok-text": d(n)("dashboard.clearConfirmOk"),
        "ok-button-props": { danger: !0 },
        onOk: U[6] || (U[6] = () => {
          d(t).clearPanels(), f.value = !1;
        }),
        onCancel: U[7] || (U[7] = (O) => f.value = !1)
      }, {
        default: R(() => [
          m("p", Ow, I(d(n)("dashboard.clearConfirmTitle")), 1)
        ]),
        _: 1
      }, 8, ["open", "title", "ok-text"])
    ]));
  }
}), qw = { class: "w-full min-h-screen flex flex-col" }, Lw = {
  key: 1,
  class: "p-2"
}, Rw = {
  key: 1,
  class: "flex-center h-64"
}, Nw = 30, vs = 8, Vw = 768, Fw = /* @__PURE__ */ ze({
  __name: "DashboardPage",
  setup(e) {
    const t = fi(), n = Mi(), { config: i } = Fo(), a = re(() => i.value.canEdit !== !1), r = Ku([...t.layouts]);
    Fe(
      () => t.layouts,
      (z) => {
        const T = r.value;
        T.length === z.length && T.every(
          (q, Q) => q.i === z[Q].i && q.x === z[Q].x && q.y === z[Q].y && q.w === z[Q].w && q.h === z[Q].h
        ) || (r.value = [...z]);
      }
    );
    function f(z) {
      r.value = z, t.setLayouts(z);
    }
    const u = fe(), c = fe(0), p = re(() => c.value > 0 && c.value < Vw);
    let y = null;
    In(() => {
      u.value && (y = new ResizeObserver((z) => {
        c.value = z[0].contentRect.width;
      }), y.observe(u.value), c.value = u.value.getBoundingClientRect().width);
    }), Ui(() => {
      y?.disconnect();
    });
    let b = null;
    function v() {
      C(), t.autoRefresh > 0 && (b = setInterval(() => {
        t.refresh();
      }, t.autoRefresh * 1e3));
    }
    function C() {
      b && (clearInterval(b), b = null);
    }
    return Fe(() => t.autoRefresh, v), (z, T) => (E(), B("div", qw, [
      m("div", {
        class: "flex items-center gap-2 flex-wrap px-2 sticky top-0 z-10",
        style: He({
          background: d(n).isDark ? "#1a1a1a" : "#f5f5f5",
          border: `1px solid ${d(n).isDark ? "#303030" : "#e8e8e8"}`,
          height: "42px"
        })
      }, [
        k(_d),
        T[0] || (T[0] = m("div", { class: "flex-1" }, null, -1)),
        k(Cd),
        a.value ? (E(), Ce(Dw, { key: 0 })) : ye("", !0)
      ], 4),
      m("div", {
        ref_key: "containerRef",
        ref: u,
        class: "flex-1 overflow-auto"
      }, [
        p.value ? (E(), B("div", {
          key: 0,
          class: "flex flex-col",
          style: He({ gap: `${vs}px`, padding: "8px" })
        }, [
          (E(!0), B(Pe, null, Xe(Object.keys(d(t).panels), (q) => (E(), B("div", { key: q }, [
            k(Gu, { "panel-id": q }, {
              default: R(() => [
                k(Rs, { "panel-id": q }, null, 8, ["panel-id"])
              ]),
              _: 2
            }, 1032, ["panel-id"])
          ]))), 128))
        ], 4)) : (E(), B("div", Lw, [
          c.value > 0 ? (E(), Ce(d(vm), {
            key: 0,
            layout: r.value,
            "col-num": 12,
            "row-height": Nw,
            margin: [vs, vs],
            "is-draggable": a.value && d(t).isEditing,
            "is-resizable": a.value && d(t).isEditing,
            "vertical-compact": !0,
            onLayoutUpdated: f
          }, {
            item: R(({ item: q }) => [
              k(Gu, {
                "panel-id": String(q.i)
              }, {
                default: R(() => [
                  k(Rs, {
                    "panel-id": String(q.i)
                  }, null, 8, ["panel-id"])
                ]),
                _: 2
              }, 1032, ["panel-id"])
            ]),
            _: 1
          }, 8, ["layout", "margin", "is-draggable", "is-resizable"])) : ye("", !0),
          Object.keys(d(t).panels).length === 0 ? (E(), B("div", Rw, [...T[1] || (T[1] = [
            m("div", { class: "text-center text-secondary" }, [
              m("div", { class: "text-4xl mb-4" }, " 📊 "),
              m("div", null, "No panels yet"),
              m("div", { class: "text-sm mt-2" }, ' Click "Edit" then "Add Panel" to get started ')
            ], -1)
          ])])) : ye("", !0)
        ]))
      ], 512),
      k($w),
      k(yw)
    ]));
  }
}), Bw = { class: "flex justify-between items-center gap-2" }, Hw = { style: { "font-size": "12px" } }, Ww = { style: { "font-size": "10px", color: "var(--ant-color-text-quaternary)" } }, ys = /* @__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 = fe(""), r = fe([]), f = fe(!1), u = fe(!1);
    let c = null;
    Fe(
      [a, u, () => n.cfg?.url, () => n.cfg?.token, () => n.signal, () => n.metricName],
      () => {
        !n.cfg || !u.value || (c && clearTimeout(c), c = setTimeout(async () => {
          f.value = !0;
          try {
            const v = new Set(n.groupBy.map((z) => z.name)), C = await Jd(n.cfg, {
              signal: n.signal,
              metricName: n.metricName,
              search: a.value
            });
            r.value = C.filter((z) => !v.has(z.name));
          } catch {
            r.value = [];
          } finally {
            f.value = !1;
          }
        }, 300));
      }
    );
    const p = re(() => n.groupBy.map((v) => v.name));
    function y(v) {
      const z = (Array.isArray(v) ? v : [v]).map((T) => {
        const q = r.value.find((F) => F.name === T), Q = n.groupBy.find((F) => F.name === T);
        return q ?? Q ?? { name: T, fieldDataType: "string", fieldContext: "tag" };
      });
      i("change", z);
    }
    const b = re(() => f.value ? Mn(Jn, { size: "small" }) : null);
    return (v, C) => (E(), Ce(d(Qe), {
      mode: "tags",
      size: "small",
      style: { flex: "1", "min-width": "160px" },
      placeholder: "不分组（全量汇总）",
      value: p.value,
      disabled: e.disabled,
      "filter-option": !1,
      "not-found-content": b.value,
      onSearch: C[0] || (C[0] = (z) => a.value = z),
      onFocus: C[1] || (C[1] = () => u.value = !0),
      onBlur: C[2] || (C[2] = () => {
        u.value = !1, a.value = "";
      }),
      onChange: y
    }, {
      default: R(() => [
        (E(!0), B(Pe, null, Xe(r.value, (z) => (E(), Ce(d(Qe).Option, {
          key: z.name,
          value: z.name
        }, {
          default: R(() => [
            m("div", Bw, [
              m("span", Hw, I(z.name), 1),
              m("span", Ww, I([z.fieldContext, z.fieldDataType].filter(Boolean).join(" · ")), 1)
            ])
          ]),
          _: 2
        }, 1032, ["value"]))), 128))
      ]),
      _: 1
    }, 8, ["value", "disabled", "not-found-content"]));
  }
}), jw = { class: "flex flex-wrap gap-1 items-center" }, Gw = { class: "font-medium" }, Yu = /* @__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" }
    ], r = [{ value: "timeShift", label: "Time Shift" }], f = {
      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 }
    }, u = re(
      () => n.signal === "logs" || n.signal === "traces" ? r : a
    );
    function c(b) {
      const v = f[b];
      i("change", [...n.functions, { name: b, args: v?.showInput ? [{ value: "" }] : [] }]);
    }
    function p(b) {
      i("change", n.functions.filter((v, C) => C !== b));
    }
    function y(b, v) {
      i("change", n.functions.map((C, z) => z === b ? { ...C, args: [{ value: v }] } : C));
    }
    return (b, v) => (E(), B("div", jw, [
      (E(!0), B(Pe, null, Xe(e.functions, (C, z) => (E(), B("div", {
        key: z,
        class: "inline-flex items-center gap-1 rounded px-1.5",
        style: { background: "#eee", "font-size": "12px" }
      }, [
        m("span", Gw, I(C.name) + "(", 1),
        f[C.name]?.showInput ? (E(), Ce(d(Ze), {
          key: 0,
          class: "text-center",
          size: "small",
          bordered: !1,
          variant: "borderless",
          style: { width: "40px", padding: "0 2px", height: "20px" },
          placeholder: f[C.name]?.placeholder ?? "value",
          value: C.args[0]?.value ?? "",
          onChange: (T) => y(z, T.target.value)
        }, null, 8, ["placeholder", "value", "onChange"])) : ye("", !0),
        v[1] || (v[1] = m("span", null, ")", -1)),
        k(d(tt), {
          class: "p-0!",
          type: "link",
          size: "small",
          danger: "",
          onClick: (T) => p(z)
        }, {
          default: R(() => [
            m("span", {
              class: Ae(d(Me).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["onClick"])
      ]))), 128)),
      k(d(Vo), { trigger: "click" }, {
        overlay: R(() => [
          k(d(ii), {
            onClick: v[0] || (v[0] = ({ key: C }) => c(String(C)))
          }, {
            default: R(() => [
              (E(!0), B(Pe, null, Xe(u.value, (C) => (E(), Ce(d(ii).Item, {
                key: C.value
              }, {
                default: R(() => [
                  ce(I(C.label), 1)
                ]),
                _: 2
              }, 1024))), 128))
            ]),
            _: 1
          })
        ]),
        default: R(() => [
          k(d(tt), {
            size: "small",
            type: "dashed"
          }, {
            default: R(() => [
              m("span", {
                class: Ae([d(Me).plus, "mr-0.5"])
              }, null, 2),
              v[2] || (v[2] = ce("函数 ", -1))
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), Yw = {
  class: "bg-white p-2",
  style: { border: "1px solid #eee", "border-radius": "6px", "margin-bottom": "6px" }
}, Uw = { class: "flex items-center gap-1 select-none" }, Kw = { class: "flex gap-2 ml-1" }, Xw = {
  key: 0,
  style: { "border-top": "1px solid var(--ant-color-border)" }
}, Qw = {
  key: 0,
  class: "flex flex-col gap-2 p-2"
}, Jw = { class: "flex flex-col gap-0.5" }, Zw = { class: "flex items-center gap-1.5" }, eS = { class: "flex flex-col gap-0.5" }, tS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, nS = { class: "flex flex-col gap-0.5" }, iS = { class: "flex flex-col gap-0.5" }, lS = { class: "flex flex-col gap-0.5" }, oS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, aS = { class: "flex flex-col gap-0.5" }, sS = { class: "flex items-center gap-1" }, rS = { class: "flex flex-col gap-0.5" }, uS = { class: "flex items-center gap-1" }, cS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, dS = { class: "flex flex-col gap-0.5" }, fS = { class: "flex flex-col gap-0.5" }, hS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, gS = { class: "flex flex-col gap-0.5" }, pS = { class: "flex flex-col gap-0.5" }, mS = {
  key: 1,
  class: "flex flex-col gap-2 p-2"
}, vS = { class: "flex flex-col gap-0.5" }, yS = { class: "flex flex-col gap-0.5" }, bS = { class: "flex flex-col gap-1" }, xS = { class: "flex flex-col gap-0.5" }, wS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, SS = { class: "flex flex-col gap-0.5" }, kS = { class: "flex flex-col gap-0.5" }, CS = { class: "flex flex-col gap-0.5" }, _S = {
  key: 2,
  class: "flex flex-col gap-1.5 p-2"
}, zS = { class: "flex items-center gap-1.5" }, MS = {
  key: 3,
  class: "flex flex-col gap-2 p-2"
}, TS = { class: "flex flex-col gap-0.5" }, PS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, $S = { class: "flex flex-col gap-0.5" }, ES = { class: "flex flex-col gap-0.5" }, IS = /* @__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 = re(() => n.item.type === "builder_formula"), r = re(() => n.item.spec.disabled), f = re(() => n.item.spec.name), u = fe(
      n.item.type === "builder_query" ? n.item.queryType ?? "builder" : "builder"
    ), c = [
      { label: "查询构建器", value: "builder" },
      { label: "PromQL", value: "promql" },
      { label: "ClickHouse SQL", value: "clickhouse_sql" }
    ], p = [
      { value: "metrics", label: "指标" },
      { value: "logs", label: "日志" },
      { value: "traces", label: "链路" }
    ];
    function y(Y) {
      i("change", Y);
    }
    function b(Y) {
      if (n.item.type !== "builder_query")
        return;
      const $ = Y === "metrics" ? [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }] : [{ expression: "count()" }];
      y({ ...n.item, spec: { ...n.item.spec, signal: Y, aggregations: $ } });
    }
    function v(Y) {
      n.item.type === "builder_query" && (u.value = Y, y({ ...n.item, queryType: Y }));
    }
    const C = fe([]), z = fe(!1);
    Fe(
      [() => n.cfg?.url, () => n.cfg?.token],
      async ([Y, $]) => {
        z.value = !0;
        try {
          C.value = await Qd({ url: Y ?? "", token: $ ?? "" });
        } catch {
          C.value = [];
        } finally {
          z.value = !1;
        }
      },
      { immediate: !0 }
    );
    const T = re(
      () => n.item.type === "builder_query" ? n.item.spec : null
    ), q = re(
      () => T.value?.aggregations?.[0] ?? { metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }
    ), Q = re(
      () => q.value.metricType === "histogram" || q.value.metricType === "exponential_histogram"
    ), F = re(
      () => Q.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" }]
    ), U = re(() => Q.value ? [] : q.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 O(Y, $) {
      T.value && y({ ...n.item, spec: { ...T.value, [Y]: $ } });
    }
    function W(Y) {
      T.value && O("aggregations", [{ ...q.value, ...Y }]);
    }
    function te(Y) {
      const j = C.value.find((ue) => ue.metricName === Y)?.type ?? "";
      W({
        metricName: Y,
        metricType: j,
        timeAggregation: j === "" ? "" : j === "gauge" ? "latest" : "rate",
        spaceAggregation: j === "histogram" || j === "exponential_histogram" ? "p99" : "sum"
      });
    }
    const M = re(
      () => T.value?.aggregations ?? []
    );
    function G() {
      T.value && O("aggregations", [...M.value, { expression: "count()" }]);
    }
    function J(Y) {
      T.value && O("aggregations", M.value.filter(($, j) => j !== Y));
    }
    function K(Y, $) {
      T.value && O("aggregations", M.value.map((j, ue) => ue === Y ? { expression: $ } : j));
    }
    function A(Y) {
      if (!Y) {
        O("order", []);
        return;
      }
      const $ = Y.split(" "), j = $[$.length - 1], ie = { key: { name: $.slice(0, -1).join(" ") }, direction: j };
      O("order", [ie]);
    }
    function Z(Y) {
      n.item.type === "builder_formula" && i("change", { ...n.item, spec: { ...n.item.spec, ...Y } });
    }
    return (Y, $) => (E(), B("div", Yw, [
      m("div", Uw, [
        m("span", {
          class: "flex items-center gap-1.5 flex-1 cursor-pointer",
          onClick: $[2] || ($[2] = (j) => i("toggleCollapse"))
        }, [
          m("span", {
            class: Ae([e.collapsed ? d(Me).chevronRight : d(Me).chevronDown, "text-16px"])
          }, null, 2),
          k(d(Kl), {
            color: a.value ? "purple" : "cyan",
            style: { margin: "0", "font-weight": "600", "font-size": "12px", "line-height": "18px", padding: "0 6px" }
          }, {
            default: R(() => [
              ce(I(f.value), 1)
            ]),
            _: 1
          }, 8, ["color"]),
          a.value ? ye("", !0) : (E(), B(Pe, { key: 0 }, [
            m("div", Kw, [
              (E(), B(Pe, null, Xe(c, (j) => k(d(tt), {
                key: j.value,
                size: "small",
                type: u.value === j.value ? "primary" : "default",
                style: { "font-size": "12px", height: "22px" },
                onClick: $n((ue) => v(j.value), ["stop"])
              }, {
                default: R(() => [
                  ce(I(j.label), 1)
                ]),
                _: 2
              }, 1032, ["type", "onClick"])), 64))
            ]),
            u.value === "builder" ? (E(), Ce(d(Qe), {
              key: 0,
              size: "small",
              style: { width: "80px" },
              value: e.item.spec.signal,
              options: p,
              onClick: $[0] || ($[0] = $n(() => {
              }, ["stop"])),
              onChange: $[1] || ($[1] = (j) => b(j))
            }, null, 8, ["value"])) : ye("", !0),
            $[32] || ($[32] = m("div", { class: "flex-1" }, null, -1))
          ], 64))
        ]),
        k(d(tt), {
          class: "p-0!",
          size: "small",
          type: "link",
          onClick: $[3] || ($[3] = $n((j) => i("toggleDisabled"), ["stop"]))
        }, {
          default: R(() => [
            m("span", {
              class: Ae(r.value ? d(Me).viewOff : d(Me).view)
            }, null, 2)
          ]),
          _: 1
        }),
        k(d(tt), {
          class: "p-0!",
          size: "small",
          type: "link",
          danger: "",
          disabled: !e.canDelete,
          onClick: $[4] || ($[4] = (j) => i("delete"))
        }, {
          default: R(() => [
            m("span", {
              class: Ae(d(Me).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled"])
      ]),
      e.collapsed ? ye("", !0) : (E(), B("div", Xw, [
        e.item.type === "builder_query" && u.value === "builder" && e.item.spec.signal === "metrics" && T.value ? (E(), B("div", Qw, [
          m("div", Jw, [
            $[33] || ($[33] = m("span", { class: "text-xs text-secondary" }, "指标名称", -1)),
            m("div", Zw, [
              ce(I(z.value) + " ", 1),
              k(d(Qe), {
                "show-search": "",
                "allow-clear": "",
                loading: z.value,
                size: "small",
                style: { flex: "1" },
                placeholder: "指标名称",
                value: q.value.metricName || void 0,
                options: C.value.map((j) => ({
                  value: j.metricName,
                  label: j.metricName
                })),
                "filter-option": (j, ue) => String(ue?.value ?? "").toLowerCase().includes(j.toLowerCase()),
                onChange: $[5] || ($[5] = (j) => te(j)),
                onClear: $[6] || ($[6] = () => W({
                  metricName: "",
                  metricType: "",
                  timeAggregation: "rate",
                  spaceAggregation: "sum"
                }))
              }, null, 8, ["loading", "value", "options", "filter-option"]),
              q.value.metricType ? (E(), Ce(d(Kl), {
                key: 0,
                style: { "font-size": "10px", margin: "0" }
              }, {
                default: R(() => [
                  ce(I(q.value.metricType), 1)
                ]),
                _: 1
              })) : ye("", !0)
            ])
          ]),
          m("div", eS, [
            $[34] || ($[34] = m("span", { class: "text-xs text-secondary" }, "源数据筛选", -1)),
            k(d(Ze), {
              size: "small",
              placeholder: "如 host.name = 'my-host'",
              value: T.value.filter.expression,
              onChange: $[7] || ($[7] = (j) => O("filter", { expression: j.target.value }))
            }, null, 8, ["value"])
          ]),
          Q.value ? (E(), B(Pe, { key: 0 }, [
            m("div", tS, [
              m("div", nS, [
                $[35] || ($[35] = m("span", { class: "text-xs text-secondary" }, "跨时序聚合", -1)),
                k(d(Qe), {
                  size: "small",
                  value: q.value.spaceAggregation || void 0,
                  options: F.value,
                  disabled: !q.value.metricType,
                  onChange: $[8] || ($[8] = (j) => W({ spaceAggregation: j }))
                }, null, 8, ["value", "options", "disabled"])
              ]),
              m("div", iS, [
                $[36] || ($[36] = m("span", { class: "text-xs text-secondary" }, "分组", -1)),
                k(ys, {
                  "group-by": T.value.groupBy,
                  cfg: e.cfg,
                  signal: "metrics",
                  "metric-name": q.value.metricName,
                  disabled: !q.value.metricName,
                  onChange: $[9] || ($[9] = (j) => O("groupBy", j))
                }, null, 8, ["group-by", "cfg", "metric-name", "disabled"])
              ])
            ]),
            m("div", lS, [
              $[37] || ($[37] = m("span", { class: "text-xs text-secondary" }, "步长（秒）", -1)),
              k(d(on), {
                size: "small",
                style: { width: "100%" },
                placeholder: "自动",
                value: T.value.stepInterval ?? void 0,
                min: 1,
                onChange: $[10] || ($[10] = (j) => O("stepInterval", j ?? null))
              }, null, 8, ["value"])
            ])
          ], 64)) : (E(), B(Pe, { key: 1 }, [
            m("div", oS, [
              m("div", aS, [
                $[40] || ($[40] = m("span", { class: "text-xs text-secondary" }, "时序内聚合", -1)),
                m("div", sS, [
                  k(d(Qe), {
                    size: "small",
                    style: { flex: "1" },
                    value: q.value.timeAggregation || void 0,
                    options: U.value,
                    disabled: !q.value.metricType,
                    onChange: $[11] || ($[11] = (j) => W({ timeAggregation: j }))
                  }, null, 8, ["value", "options", "disabled"]),
                  $[38] || ($[38] = m("span", { class: "text-xs text-secondary whitespace-nowrap" }, "每隔", -1)),
                  k(d(on), {
                    size: "small",
                    style: { width: "60px" },
                    placeholder: "自动",
                    value: T.value.stepInterval ?? void 0,
                    min: 1,
                    onChange: $[12] || ($[12] = (j) => O("stepInterval", j ?? null))
                  }, null, 8, ["value"]),
                  $[39] || ($[39] = m("span", { class: "text-xs text-secondary" }, "秒", -1))
                ])
              ]),
              m("div", rS, [
                $[41] || ($[41] = m("span", { class: "text-xs text-secondary" }, "跨时序聚合", -1)),
                m("div", uS, [
                  k(d(Qe), {
                    size: "small",
                    style: { width: "80px" },
                    value: q.value.spaceAggregation || void 0,
                    options: F.value,
                    disabled: !q.value.metricType,
                    onChange: $[13] || ($[13] = (j) => W({ spaceAggregation: j }))
                  }, null, 8, ["value", "options", "disabled"]),
                  k(ys, {
                    "group-by": T.value.groupBy,
                    cfg: e.cfg,
                    signal: "metrics",
                    "metric-name": q.value.metricName,
                    disabled: !q.value.metricName,
                    onChange: $[14] || ($[14] = (j) => O("groupBy", j))
                  }, null, 8, ["group-by", "cfg", "metric-name", "disabled"])
                ])
              ])
            ]),
            m("div", cS, [
              m("div", dS, [
                $[42] || ($[42] = m("span", { class: "text-xs text-secondary" }, "聚合结果筛选", -1)),
                k(d(Ze), {
                  size: "small",
                  placeholder: "如 sum > 100",
                  value: T.value.having?.expression ?? "",
                  onChange: $[15] || ($[15] = (j) => O("having", { expression: j.target.value }))
                }, null, 8, ["value"])
              ]),
              m("div", fS, [
                $[43] || ($[43] = m("span", { class: "text-xs text-secondary" }, "条数", -1)),
                k(d(on), {
                  size: "small",
                  style: { width: "80px" },
                  placeholder: "∞",
                  value: T.value.limit ?? void 0,
                  min: 1,
                  onChange: $[16] || ($[16] = (j) => O("limit", j ?? void 0))
                }, null, 8, ["value"])
              ])
            ]),
            m("div", hS, [
              m("div", gS, [
                $[44] || ($[44] = m("span", { class: "text-xs text-secondary" }, "排序", -1)),
                k(d(Qe), {
                  size: "small",
                  "allow-clear": "",
                  placeholder: "字段 升序/降序",
                  value: T.value.order[0] ? `${T.value.order[0].key.name} ${T.value.order[0].direction}` : void 0,
                  options: [
                    { value: "value asc", label: "值 升序" },
                    { value: "value desc", label: "值 降序" }
                  ],
                  onChange: $[17] || ($[17] = (j) => A(j)),
                  onClear: $[18] || ($[18] = () => O("order", []))
                }, null, 8, ["value"])
              ]),
              m("div", pS, [
                $[45] || ($[45] = m("span", { class: "text-xs text-secondary" }, "图例", -1)),
                k(d(Ze), {
                  size: "small",
                  placeholder: "{{label}}",
                  value: T.value.legend,
                  onChange: $[19] || ($[19] = (j) => O("legend", j.target.value))
                }, null, 8, ["value"])
              ])
            ])
          ], 64)),
          k(Yu, {
            functions: T.value.functions,
            signal: T.value.signal,
            onChange: $[20] || ($[20] = (j) => O("functions", j))
          }, null, 8, ["functions", "signal"])
        ])) : e.item.type === "builder_query" && u.value === "builder" && T.value ? (E(), B("div", mS, [
          m("div", vS, [
            $[46] || ($[46] = m("span", { class: "text-xs text-secondary" }, "过滤条件", -1)),
            k(d(Ze), {
              size: "small",
              placeholder: "过滤表达式",
              value: T.value.filter.expression,
              onChange: $[21] || ($[21] = (j) => O("filter", { expression: j.target.value }))
            }, null, 8, ["value"])
          ]),
          m("div", yS, [
            $[49] || ($[49] = m("span", { class: "text-xs text-secondary" }, "聚合表达式", -1)),
            m("div", bS, [
              (E(!0), B(Pe, null, Xe(M.value, (j, ue) => (E(), B("div", {
                key: ue,
                class: "flex items-center gap-1"
              }, [
                k(d(Ze), {
                  size: "small",
                  style: { flex: "1" },
                  placeholder: "如 count() / avg(body)",
                  value: j.expression,
                  onChange: (ie) => K(ue, ie.target.value)
                }, null, 8, ["value", "onChange"]),
                M.value.length > 1 ? (E(), Ce(d(tt), {
                  key: 0,
                  size: "small",
                  type: "text",
                  danger: "",
                  onClick: (ie) => J(ue)
                }, {
                  default: R(() => [...$[47] || ($[47] = [
                    ce(" × ", -1)
                  ])]),
                  _: 1
                }, 8, ["onClick"])) : ye("", !0)
              ]))), 128)),
              k(d(tt), {
                size: "small",
                type: "dashed",
                style: { "align-self": "flex-start" },
                onClick: G
              }, {
                default: R(() => [
                  m("span", {
                    class: Ae([d(Me).plus, "mr-0.5"])
                  }, null, 2),
                  $[48] || ($[48] = ce("添加聚合 ", -1))
                ]),
                _: 1
              })
            ])
          ]),
          m("div", xS, [
            $[50] || ($[50] = m("span", { class: "text-xs text-secondary" }, "分组", -1)),
            k(ys, {
              "group-by": T.value.groupBy,
              cfg: e.cfg,
              signal: T.value.signal,
              onChange: $[22] || ($[22] = (j) => O("groupBy", j))
            }, null, 8, ["group-by", "cfg", "signal"])
          ]),
          m("div", wS, [
            m("div", SS, [
              $[51] || ($[51] = m("span", { class: "text-xs text-secondary" }, "聚合结果筛选", -1)),
              k(d(Ze), {
                size: "small",
                placeholder: "如 count > 100",
                value: T.value.having?.expression ?? "",
                onChange: $[23] || ($[23] = (j) => O("having", { expression: j.target.value }))
              }, null, 8, ["value"])
            ]),
            m("div", kS, [
              $[52] || ($[52] = m("span", { class: "text-xs text-secondary" }, "条数", -1)),
              k(d(on), {
                size: "small",
                style: { width: "80px" },
                placeholder: "∞",
                value: T.value.limit ?? void 0,
                min: 1,
                onChange: $[24] || ($[24] = (j) => O("limit", j ?? void 0))
              }, null, 8, ["value"])
            ])
          ]),
          m("div", CS, [
            $[53] || ($[53] = m("span", { class: "text-xs text-secondary" }, "图例", -1)),
            k(d(Ze), {
              size: "small",
              placeholder: "{{label}}",
              value: T.value.legend,
              onChange: $[25] || ($[25] = (j) => O("legend", j.target.value))
            }, null, 8, ["value"])
          ]),
          k(Yu, {
            functions: T.value.functions,
            signal: T.value.signal,
            onChange: $[26] || ($[26] = (j) => O("functions", j))
          }, null, 8, ["functions", "signal"])
        ])) : e.item.type === "builder_query" && u.value !== "builder" ? (E(), B("div", _S, [
          k(d(Ze).TextArea, {
            rows: 4,
            placeholder: u.value === "promql" ? "输入 PromQL 查询语句…" : "输入 ClickHouse SQL 查询语句…",
            value: e.item.rawQuery ?? "",
            style: { "font-family": "monospace", "font-size": "12px" },
            onChange: $[27] || ($[27] = (j) => i("change", { ...e.item, rawQuery: j.target.value }))
          }, null, 8, ["placeholder", "value"]),
          m("div", zS, [
            $[54] || ($[54] = m("span", { class: "text-xs text-secondary whitespace-nowrap" }, "图例格式", -1)),
            k(d(Ze), {
              size: "small",
              style: { flex: "1" },
              placeholder: "{{label}}",
              value: e.item.rawLegend ?? "",
              onChange: $[28] || ($[28] = (j) => i("change", { ...e.item, rawLegend: j.target.value }))
            }, null, 8, ["value"])
          ])
        ])) : e.item.type === "builder_formula" ? (E(), B("div", MS, [
          m("div", TS, [
            $[55] || ($[55] = m("span", { class: "text-xs text-secondary" }, "表达式", -1)),
            k(d(Ze), {
              size: "small",
              placeholder: "如 A + B",
              value: e.item.spec.expression,
              onChange: $[29] || ($[29] = (j) => i("change", {
                ...e.item,
                spec: { ...e.item.spec, expression: j.target.value }
              }))
            }, null, 8, ["value"])
          ]),
          m("div", PS, [
            m("div", $S, [
              $[56] || ($[56] = m("span", { class: "text-xs text-secondary" }, "图例", -1)),
              k(d(Ze), {
                size: "small",
                placeholder: "图例格式",
                value: e.item.spec.legend,
                onChange: $[30] || ($[30] = (j) => Z({ legend: j.target.value }))
              }, null, 8, ["value"])
            ]),
            m("div", ES, [
              $[57] || ($[57] = m("span", { class: "text-xs text-secondary" }, "条数", -1)),
              k(d(on), {
                size: "small",
                style: { width: "80px" },
                placeholder: "∞",
                value: e.item.spec.limit ?? void 0,
                min: 1,
                onChange: $[31] || ($[31] = (j) => Z({ limit: j ?? void 0 }))
              }, null, 8, ["value"])
            ])
          ])
        ])) : ye("", !0)
      ]))
    ]));
  }
}), AS = { class: "flex flex-col gap-2 p-1" }, OS = {
  key: 0,
  class: "flex items-center gap-2 mb-1"
}, DS = { class: "flex gap-1.5 mt-1" }, qS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", LS = /* @__PURE__ */ ze({
  __name: "ArgusQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { config: a } = Fo(), r = re(
      () => (a.value.datasourceConfig ?? []).filter((Q) => Q.type === "argus")
    ), f = fe(/* @__PURE__ */ new Set());
    function u(Q) {
      return {
        name: Q,
        signal: "metrics",
        stepInterval: null,
        disabled: !1,
        filter: { expression: "" },
        having: { expression: "" },
        groupBy: [],
        order: [],
        legend: "",
        functions: [],
        aggregations: [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }]
      };
    }
    function c(Q) {
      return { name: Q, expression: "", disabled: !1, legend: "", order: [] };
    }
    function p(Q, F) {
      i("change", { ...n.query, [Q]: F });
    }
    function y() {
      const Q = n.query.queries.filter((O) => O.type === "builder_query"), F = qS[Q.length] ?? `Q${Q.length}`, U = { type: "builder_query", spec: u(F) };
      i("change", { ...n.query, queries: [...n.query.queries, U] });
    }
    function b() {
      const F = `F${n.query.queries.filter((O) => O.type === "builder_formula").length + 1}`, U = { type: "builder_formula", spec: c(F) };
      i("change", { ...n.query, queries: [...n.query.queries, U] });
    }
    function v(Q) {
      i("change", { ...n.query, queries: n.query.queries.filter((F) => F.spec.name !== Q) });
    }
    function C(Q) {
      i("change", {
        ...n.query,
        queries: n.query.queries.map((F) => F.spec.name === Q.spec.name ? Q : F)
      });
    }
    function z(Q) {
      const F = new Set(f.value);
      F.has(Q) ? F.delete(Q) : F.add(Q), f.value = F;
    }
    function T(Q) {
      C({ ...Q, spec: { ...Q.spec, disabled: !Q.spec.disabled } });
    }
    const q = re(() => {
      const Q = (a.value.datasourceConfig ?? []).filter((U) => U.type === "argus");
      if (!Q.length)
        return null;
      const F = Q.find((U) => U.uid === n.datasourceId) ?? Q.find((U) => U.default) ?? Q[0];
      return { url: F.url, token: F.token };
    });
    return (Q, F) => (E(), B("div", AS, [
      r.value.length > 1 ? (E(), B("div", OS, [
        F[1] || (F[1] = m("span", { class: "text-xs text-secondary whitespace-nowrap" }, "数据源", -1)),
        k(d(Qe), {
          size: "small",
          style: { width: "180px" },
          value: e.query.datasourceId,
          options: r.value.map((U) => ({ value: U.uid, label: U.name })),
          onChange: F[0] || (F[0] = (U) => p("datasourceId", U))
        }, null, 8, ["value", "options"])
      ])) : ye("", !0),
      (E(!0), B(Pe, null, Xe(e.query.queries, (U) => (E(), Ce(IS, {
        key: U.spec.name,
        item: U,
        cfg: q.value,
        collapsed: f.value.has(U.spec.name),
        "can-delete": e.query.queries.length > 1,
        onToggleCollapse: () => z(U.spec.name),
        onToggleDisabled: () => T(U),
        onDelete: () => v(U.spec.name),
        onChange: C
      }, null, 8, ["item", "cfg", "collapsed", "can-delete", "onToggleCollapse", "onToggleDisabled", "onDelete"]))), 128)),
      m("div", DS, [
        k(d(tt), {
          size: "small",
          type: "dashed",
          onClick: y
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).plus, "mr-1"])
            }, null, 2),
            F[2] || (F[2] = ce("基础查询 ", -1))
          ]),
          _: 1
        }),
        k(d(tt), {
          size: "small",
          type: "dashed",
          onClick: b
        }, {
          default: R(() => [
            m("span", {
              class: Ae([d(Me).plus, "mr-1"])
            }, null, 2),
            F[3] || (F[3] = ce("衍生算式 ", -1))
          ]),
          _: 1
        })
      ])
    ]));
  }
}), RS = { style: { "padding-top": "6px" } }, NS = { class: "inline-flex items-center gap-1.5 mb-2" }, VS = { class: "text-xs text-secondary" }, FS = {
  key: 0,
  class: "inline-flex items-center gap-1.5 mb-0 ml-2"
}, BS = { class: "text-xs text-secondary" }, HS = {
  key: 1,
  class: "inline-flex items-center gap-1.5 mb-0 ml-2"
}, WS = { class: "text-xs text-secondary" }, jS = {
  class: "text-xs text-secondary",
  style: { "min-width": "28px" }
}, GS = /* @__PURE__ */ ze({
  __name: "MockQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = ot(), a = re(() => [
      { 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 (r, f) => (E(), B("div", RS, [
      m("div", NS, [
        m("span", VS, I(d(i)("qb.pattern")), 1),
        k(d(Qe), {
          size: "small",
          style: { width: "140px" },
          value: e.query.pattern,
          options: a.value,
          onChange: f[0] || (f[0] = (u) => n("change", { ...e.query, pattern: u }))
        }, null, 8, ["value", "options"])
      ]),
      e.isChart ? (E(), B("div", FS, [
        m("span", BS, I(d(i)("qb.seriesCount")), 1),
        k(d(bn), {
          min: 1,
          max: 8,
          value: e.query.seriesCount ?? 1,
          style: { width: "200px" },
          onChange: f[1] || (f[1] = (u) => n("change", { ...e.query, seriesCount: u }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      e.query.pattern === "live" ? (E(), B("div", HS, [
        m("span", WS, I(d(i)("qb.liveAmplitude")), 1),
        k(d(bn), {
          min: 0.1,
          max: 5,
          step: 0.1,
          value: e.query.liveAmplitude ?? 1,
          style: { width: "160px" },
          onChange: f[2] || (f[2] = (u) => n("change", { ...e.query, liveAmplitude: u }))
        }, null, 8, ["value"]),
        m("span", jS, I((e.query.liveAmplitude ?? 1).toFixed(1)) + "x ", 1)
      ])) : ye("", !0)
    ]));
  }
}), ul = /* @__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 = fe(n.displayValue ?? n.value ?? "");
    Fe(
      [() => n.value, () => n.displayValue],
      ([c, p]) => {
        a.value = p ?? c ?? "";
      }
    );
    function r(c, p) {
      return c.toLowerCase().includes(p.toLowerCase());
    }
    const f = re(() => {
      const c = a.value, p = n.groups.flatMap((v) => v.options), y = n.allowCustom && c && !p.some((v) => v.value === c || v.label === c) ? [{ label: "── 自定义 ──", options: [{ value: c, label: c }] }] : [], b = c ? n.groups.map((v) => ({ ...v, options: v.options.filter((C) => r(C.label, c)) })).filter((v) => v.options.length > 0) : n.groups;
      return [...y, ...b];
    }), u = re(
      () => f.value.map((c) => ({
        label: c.label,
        options: c.options
      }))
    );
    return (c, p) => (E(), Ce(d(Qe), {
      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: u.value,
      onFocus: p[0] || (p[0] = () => {
        a.value = e.displayValue ?? e.value ?? "";
      }),
      onSearch: p[1] || (p[1] = (y) => {
        a.value = y;
      }),
      onChange: p[2] || (p[2] = (y) => {
        a.value = String(y ?? ""), i("change", String(y));
      }),
      onClear: p[3] || (p[3] = () => {
        a.value = "", i("clear");
      })
    }, null, 8, ["value", "search-value", "placeholder", "loading", "disabled", "options"]));
  }
}), YS = { class: "flex flex-wrap items-center gap-1.5 mt-1" }, US = { class: "text-xs text-secondary" }, KS = { class: "font-medium text-blue lh-1" }, XS = /* @__PURE__ */ ze({
  __name: "FunctionsEditor",
  props: {
    functions: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = ot();
    function r(C, z) {
      return z.length === 0 ? `${C.name}()` : `${C.name}(${z.join(", ")})`;
    }
    function f(C) {
      return { def: C, params: [...C.defaultParams], text: r(C, C.defaultParams) };
    }
    function u(C) {
      const z = C.filter((q) => q.def.category === "Alias");
      return [...C.filter((q) => q.def.category !== "Alias"), ...z];
    }
    function c(C) {
      const z = nu.find((q) => q.name === C);
      if (!z)
        return;
      const T = f(z);
      i("change", u([...n.functions, T]));
    }
    function p(C, z, T) {
      const q = n.functions.map((Q, F) => {
        if (F !== C)
          return Q;
        const U = [...Q.params];
        return U[z] = T, { ...Q, params: U, text: r(Q.def, U) };
      });
      i("change", q);
    }
    function y(C) {
      i("change", n.functions.filter((z, T) => T !== C));
    }
    function b(C, z) {
      const T = C + z;
      if (T < 0 || T >= n.functions.length)
        return;
      const q = [...n.functions];
      [q[C], q[T]] = [q[T], q[C]], i("change", q);
    }
    const v = re(
      () => ap.map((C) => ({
        key: C,
        label: C,
        children: nu.filter((z) => z.category === C).map((z) => ({ key: z.name, label: z.name }))
      }))
    );
    return (C, z) => (E(), B("div", YS, [
      m("span", US, I(d(a)("qb.functions")), 1),
      (E(!0), B(Pe, null, Xe(e.functions, (T, q) => (E(), B("div", {
        key: q,
        class: "inline-flex items-center gap-0.5 rounded px-1",
        style: { background: "#eee", "font-size": "12px" }
      }, [
        k(d(tt), {
          type: "text",
          size: "small",
          class: "p-0!",
          disabled: q === 0,
          onClick: (Q) => b(q, -1)
        }, {
          default: R(() => [
            m("span", {
              class: Ae(d(Me).chevronLeft)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled", "onClick"]),
        m("span", KS, I(T.def.name), 1),
        z[1] || (z[1] = m("span", { class: "text-yellow" }, "(", -1)),
        (E(!0), B(Pe, null, Xe(T.def.params, (Q, F) => (E(), B(Pe, { key: F }, [
          Q.options ? (E(), Ce(d(Qe), {
            key: 0,
            size: "small",
            value: String(T.params[F] ?? Q.options[0]),
            options: Q.options.map((U) => ({ value: String(U), label: String(U) })),
            "popup-match-select-width": "false",
            bordered: !1,
            variant: "borderless",
            style: { "min-width": "60px" },
            onChange: (U) => p(q, F, U)
          }, null, 8, ["value", "options", "onChange"])) : (E(), Ce(d(Ze), {
            key: 1,
            class: "text-green text-center",
            size: "small",
            bordered: !1,
            value: String(T.params[F] ?? ""),
            style: { width: "40px", padding: "0 4px", height: "20px" },
            variant: "borderless",
            onChange: (U) => p(q, F, U.target.value)
          }, null, 8, ["value", "onChange"]))
        ], 64))), 128)),
        z[2] || (z[2] = m("span", { class: "text-yellow font-medium" }, ")", -1)),
        k(d(tt), {
          type: "text",
          size: "small",
          class: "p-0!",
          disabled: q === e.functions.length - 1,
          onClick: (Q) => b(q, 1)
        }, {
          default: R(() => [
            m("span", {
              class: Ae(d(Me).chevronRight)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled", "onClick"]),
        k(d(tt), {
          type: "text",
          size: "small",
          class: "p-0!",
          danger: "",
          onClick: (Q) => y(q)
        }, {
          default: R(() => [
            m("span", {
              class: Ae(d(Me).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["onClick"])
      ]))), 128)),
      k(d(Vo), { trigger: ["click"] }, {
        overlay: R(() => [
          k(d(ii), {
            onClick: z[0] || (z[0] = ({ key: T }) => c(String(T)))
          }, {
            default: R(() => [
              (E(!0), B(Pe, null, Xe(v.value, (T) => (E(), Ce(d(ii).SubMenu, {
                key: T.key,
                title: T.label
              }, {
                default: R(() => [
                  (E(!0), B(Pe, null, Xe(T.children, (q) => (E(), Ce(d(ii).Item, {
                    key: q.key
                  }, {
                    default: R(() => [
                      ce(I(q.label), 1)
                    ]),
                    _: 2
                  }, 1024))), 128))
                ]),
                _: 2
              }, 1032, ["title"]))), 128))
            ]),
            _: 1
          })
        ]),
        default: R(() => [
          k(d(tt), {
            size: "small",
            type: "dashed"
          }, {
            default: R(() => [
              ce(" + " + I(d(a)("qb.functions.add")), 1)
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), QS = { class: "flex flex-wrap items-center gap-0 mt-3" }, JS = { class: "text-xs text-secondary font-medium" }, ZS = { class: "text-xs" }, ek = { class: "inline-flex items-center gap-1.5 mr-3" }, tk = { class: "text-xs text-secondary whitespace-nowrap" }, nk = { class: "inline-flex items-center gap-1.5 mr-3" }, ik = { class: "text-xs text-secondary whitespace-nowrap" }, lk = { class: "inline-flex items-center gap-1.5 mr-3" }, ok = { class: "text-xs text-secondary whitespace-nowrap" }, ak = { class: "inline-flex items-center gap-1.5 mr-3" }, sk = { class: "text-xs text-secondary whitespace-nowrap" }, rk = {
  key: 1,
  class: "inline-flex items-center gap-1.5 mr-3"
}, uk = { class: "text-xs text-secondary whitespace-nowrap" }, ck = { class: "inline-flex items-center gap-1.5 mr-3" }, dk = { class: "text-xs text-secondary whitespace-nowrap" }, fk = { class: "inline-flex items-center gap-1.5 mr-3" }, hk = { class: "text-xs text-secondary whitespace-nowrap" }, gk = { class: "inline-flex items-center gap-1.5 mr-3" }, pk = { class: "text-xs text-secondary whitespace-nowrap" }, mk = { class: "inline-flex items-center gap-1.5 mr-3" }, vk = { class: "text-xs text-secondary whitespace-nowrap" }, yk = { class: "inline-flex items-center gap-1.5 mr-3" }, bk = { class: "text-xs text-secondary whitespace-nowrap" }, xk = { class: "inline-flex items-center gap-1.5 mr-3" }, wk = { class: "text-xs text-secondary whitespace-nowrap" }, Sk = { class: "inline-flex items-center gap-1.5 mr-3" }, kk = { class: "text-xs text-secondary whitespace-nowrap" }, Ck = { class: "inline-flex items-center gap-1.5 mr-3" }, _k = { class: "text-xs text-secondary whitespace-nowrap" }, zk = /* @__PURE__ */ ze({
  __name: "OptionsEditor",
  props: {
    queryType: {},
    options: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = ot(), r = fe(!0);
    function f(y) {
      i("change", { ...n.options, ...y });
    }
    const u = [
      { 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") }
    ], p = [
      { value: "default", label: a("qb.trends.default") },
      { value: "true", label: a("qb.trends.true") },
      { value: "false", label: a("qb.trends.false") }
    ];
    return (y, b) => (E(), B("div", QS, [
      m("div", {
        class: "inline-flex items-center gap-1.5 cursor-pointer py-1 mr-2 select-none flex-shrink-0",
        onClick: b[0] || (b[0] = (v) => r.value = !r.value)
      }, [
        m("span", JS, I(d(a)("qb.options")), 1),
        m("span", ZS, I(r.value ? "▸" : "▾"), 1)
      ]),
      m("div", {
        class: "flex flex-wrap items-center overflow-hidden transition-all",
        style: He({ maxHeight: r.value ? "200px" : "0" })
      }, [
        e.queryType === "metrics" || e.queryType === "itemid" || e.queryType === "services" ? (E(), B(Pe, { key: 0 }, [
          m("div", ek, [
            m("span", tk, I(d(a)("qb.options.trends")), 1),
            k(d(Qe), {
              size: "small",
              style: { width: "100px" },
              value: e.options.useTrends ?? "default",
              options: p,
              onChange: b[1] || (b[1] = (v) => f({ useTrends: v }))
            }, null, 8, ["value"])
          ]),
          m("div", nk, [
            m("span", ik, I(d(a)("qb.options.showDisabled")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.showDisabledItems,
              onChange: b[2] || (b[2] = (v) => f({ showDisabledItems: v }))
            }, null, 8, ["checked"])
          ]),
          m("div", lk, [
            m("span", ok, I(d(a)("qb.options.valueMapping")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.useZabbixValueMapping,
              onChange: b[3] || (b[3] = (v) => f({ useZabbixValueMapping: v }))
            }, null, 8, ["checked"])
          ]),
          m("div", ak, [
            m("span", sk, I(d(a)("qb.options.disableAlignment")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.disableDataAlignment,
              onChange: b[4] || (b[4] = (v) => f({ disableDataAlignment: v }))
            }, null, 8, ["checked"])
          ])
        ], 64)) : ye("", !0),
        e.queryType === "text" ? (E(), B("div", rk, [
          m("span", uk, I(d(a)("qb.options.showDisabled")), 1),
          k(d(ki), {
            size: "small",
            checked: !!e.options.showDisabledItems,
            onChange: b[5] || (b[5] = (v) => f({ showDisabledItems: v }))
          }, null, 8, ["checked"])
        ])) : ye("", !0),
        e.queryType === "problems" ? (E(), B(Pe, { key: 2 }, [
          m("div", ck, [
            m("span", dk, I(d(a)("qb.options.acknowledged")), 1),
            k(d(Qe), {
              size: "small",
              style: { width: "140px" },
              value: e.options.acknowledged ?? 2,
              options: u,
              onChange: b[6] || (b[6] = (v) => f({ acknowledged: v }))
            }, null, 8, ["value"])
          ]),
          m("div", fk, [
            m("span", hk, I(d(a)("qb.options.sortBy")), 1),
            k(d(Qe), {
              size: "small",
              style: { width: "120px" },
              value: e.options.sortProblems ?? "default",
              options: c,
              onChange: b[7] || (b[7] = (v) => f({ sortProblems: v }))
            }, null, 8, ["value"])
          ]),
          m("div", gk, [
            m("span", pk, I(d(a)("qb.options.useTimeRange")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.useTimeRange,
              onChange: b[8] || (b[8] = (v) => f({ useTimeRange: v }))
            }, null, 8, ["checked"])
          ]),
          m("div", mk, [
            m("span", vk, I(d(a)("qb.options.hostsInMaintenance")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.hostsInMaintenance,
              onChange: b[9] || (b[9] = (v) => f({ hostsInMaintenance: v }))
            }, null, 8, ["checked"])
          ]),
          m("div", yk, [
            m("span", bk, I(d(a)("qb.options.hostProxy")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.hostProxy,
              onChange: b[10] || (b[10] = (v) => f({ hostProxy: v }))
            }, null, 8, ["checked"])
          ]),
          m("div", xk, [
            m("span", wk, I(d(a)("qb.options.limit")), 1),
            k(d(Ze), {
              size: "small",
              type: "number",
              style: { width: "80px" },
              value: e.options.limit ?? 100,
              onChange: b[11] || (b[11] = (v) => f({ limit: Number(v.target.value) }))
            }, null, 8, ["value"])
          ])
        ], 64)) : ye("", !0),
        e.queryType === "triggers" ? (E(), B(Pe, { key: 3 }, [
          m("div", Sk, [
            m("span", kk, I(d(a)("qb.options.acknowledged")), 1),
            k(d(Qe), {
              size: "small",
              style: { width: "140px" },
              value: e.options.acknowledged ?? 2,
              options: u,
              onChange: b[12] || (b[12] = (v) => f({ acknowledged: v }))
            }, null, 8, ["value"])
          ]),
          m("div", Ck, [
            m("span", _k, I(d(a)("qb.options.useTimeRange")), 1),
            k(d(ki), {
              size: "small",
              checked: !!e.options.useTimeRange,
              onChange: b[13] || (b[13] = (v) => f({ useTimeRange: v }))
            }, null, 8, ["checked"])
          ])
        ], 64)) : ye("", !0)
      ], 4)
    ]));
  }
});
function zd(e) {
  const t = to();
  return re(() => {
    const n = e();
    if (!n)
      return [];
    if (!n.startsWith("$"))
      return [n];
    const i = n.slice(1), a = Object.values(t.variables).find(
      (u) => u.config.name === i
    );
    if (!a)
      return [];
    const r = a.current, f = Array.isArray(r) ? r : [r];
    return f.includes("$__all") ? a.options.map((u) => u.value).filter((u) => u !== "$__all") : f.filter(Boolean);
  });
}
function Mk(e, t) {
  const n = fe([]), i = fe([]), a = fe(!1), r = fe(!1), f = zd(() => e().groupId);
  return Fe(
    () => ({ url: t().url, token: t().token }),
    async ({ url: u, token: c }) => {
      if (u) {
        a.value = !0, n.value = [];
        try {
          n.value = await Qg({ url: u, token: c });
        } catch {
        } finally {
          a.value = !1;
        }
      }
    },
    { immediate: !0, deep: !0 }
  ), Fe(
    [f, () => t().url, () => t().token],
    async ([u, c, p]) => {
      if (!c || u.length === 0) {
        i.value = [];
        return;
      }
      r.value = !0, i.value = [];
      try {
        i.value = await Jg(u, void 0, { url: c, token: p });
      } catch {
      } finally {
        r.value = !1;
      }
    },
    { immediate: !0 }
  ), { groups: n, hosts: i, loadingGroups: a, loadingHosts: r, resolvedGroupIds: f };
}
function Tk(e) {
  const { config: t } = Fo(), n = re(() => (t.value.datasourceConfig ?? []).filter((f) => f.type === "zabbix").map((f, u) => ({
    uid: f.uid || String(u),
    name: f.name,
    url: f.url,
    token: f.token,
    isDefault: !!f.default
  }))), i = re(() => {
    const r = Dd(e);
    return n.value.find((u) => u.uid === r) ?? n.value[0] ?? { url: "", token: "" };
  }), a = re(
    () => n.value.find((r) => r.isDefault)?.uid ?? n.value[0]?.uid ?? ""
  );
  return { sources: n, cfg: i, defaultUid: a };
}
const Pk = {
  class: "flex flex-col gap-3 p-2",
  style: { "font-size": "12px" }
}, $k = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Ek = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Ik = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Ak = { key: 0 }, Ok = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Dk = {
  key: 1,
  style: { "max-width": "400px" }
}, qk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Lk = {
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr" }
}, Rk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Nk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Vk = { class: "flex items-center gap-2" }, Fk = {
  class: "text-secondary",
  style: { "font-size": "11px" }
}, Bk = { key: 3 }, Hk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Wk = { key: 4 }, jk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Gk = {
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr 1fr" }
}, Yk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Uk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Kk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Xk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, Qk = { class: "flex flex-wrap gap-1" }, Jk = {
  key: 6,
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr 1fr" }
}, Zk = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, eC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, tC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, nC = { key: 7 }, iC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, lC = {
  key: 8,
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr" }
}, oC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, aC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, sC = /* @__PURE__ */ ze({
  __name: "ZabbixQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: a } = ot(), { cfg: r } = Tk(() => n.datasourceId), f = to();
    function u(ke) {
      i("change", { ...n.query, ...ke });
    }
    const c = re(
      () => Object.values(f.variables).map((ke) => ({
        value: `$${ke.config.name}`,
        label: `$${ke.config.name}`
      }))
    );
    function p(ke, se) {
      const oe = [];
      return c.value.length > 0 && oe.push({ label: "── 变量 ──", options: c.value }), oe.push({ label: ke, options: se }), oe;
    }
    function y(ke) {
      return typeof ke == "string" && ke.startsWith("$");
    }
    const { groups: b, hosts: v, loadingGroups: C, loadingHosts: z } = Mk(
      () => n.query,
      () => r.value
    ), T = zd(() => n.query.hostId), q = re(
      () => b.value.map((ke) => ({ value: ke.groupid, label: ke.name }))
    ), Q = re(
      () => v.value.map((ke) => ({ value: ke.hostid, label: ke.name || ke.host }))
    ), F = fe([]), U = fe(!1);
    Fe(
      [
        T,
        () => r.value.url,
        () => r.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "metrics") {
          F.value = [];
          return;
        }
        if (!ke.length || !se) {
          F.value = [];
          return;
        }
        U.value = !0;
        try {
          F.value = (await Promise.all(
            ke.map(
              (be) => Zg([be], void 0, void 0, { url: se, token: oe })
            )
          )).flat();
        } catch {
          F.value = [];
        } finally {
          U.value = !1;
        }
      },
      { immediate: !0 }
    );
    const O = re(() => {
      const ke = /* @__PURE__ */ new Set();
      return F.value.flatMap(
        (se) => (se.tags ?? []).map((oe) => ep(oe))
      ).filter((se) => ke.has(se) ? !1 : (ke.add(se), !0)).map((se) => ({ value: se, label: se }));
    }), W = re(() => {
      if (!n.query.itemTagsFilter)
        return F.value;
      const [ke, se] = n.query.itemTagsFilter.split(":").map((oe) => oe.trim());
      return F.value.filter(
        (oe) => (oe.tags ?? []).some(
          (Te) => Te.tag === ke && (se ? Te.value === se : !0)
        )
      );
    }), te = re(() => {
      const ke = /* @__PURE__ */ new Set();
      return W.value.map((se) => se.name).filter((se) => ke.has(se) ? !1 : (ke.add(se), !0)).map((se) => ({ value: se, label: se }));
    }), M = fe([]), G = fe(!1);
    Fe(
      [
        () => n.query.hostId,
        () => r.value.url,
        () => r.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "text" || !ke || !se) {
          M.value = [];
          return;
        }
        G.value = !0;
        try {
          M.value = await tp([ke], void 0, { url: se, token: oe });
        } catch {
          M.value = [];
        } finally {
          G.value = !1;
        }
      },
      { immediate: !0 }
    );
    const J = re(() => {
      const ke = /* @__PURE__ */ new Set();
      return M.value.map((se) => se.name).filter((se) => ke.has(se) ? !1 : (ke.add(se), !0)).map((se) => ({ value: se, label: se }));
    }), K = fe([]), A = fe(!1);
    Fe(
      [() => r.value.url, () => r.value.token, () => n.query.queryType],
      async ([ke, se, oe]) => {
        if (!(oe !== "services" || !ke)) {
          A.value = !0;
          try {
            K.value = await ip({ url: ke, token: se });
          } catch {
            K.value = [];
          } finally {
            A.value = !1;
          }
        }
      },
      { immediate: !0 }
    );
    const Z = fe([]), Y = fe(!1);
    Fe(
      [
        () => n.query.hostId,
        () => r.value.url,
        () => r.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "macros" || !ke || !se) {
          Z.value = [];
          return;
        }
        Y.value = !0;
        try {
          Z.value = await np([ke], { url: se, token: oe });
        } catch {
          Z.value = [];
        } finally {
          Y.value = !1;
        }
      },
      { immediate: !0 }
    );
    const $ = fe([]), j = fe(!1), ue = fe([]), ie = fe(!1);
    Fe(
      [
        () => n.query.hostId,
        () => r.value.url,
        () => r.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "lld" || !ke || ke.startsWith("$") || !se) {
          $.value = [];
          return;
        }
        j.value = !0;
        try {
          $.value = await lp([ke], { url: se, token: oe });
        } catch {
          $.value = [];
        } finally {
          j.value = !1;
        }
      },
      { immediate: !0 }
    ), Fe(
      [() => n.query.lldRuleId, () => r.value.url, () => r.value.token],
      async ([ke, se, oe]) => {
        if (!ke || !se) {
          ue.value = [];
          return;
        }
        ie.value = !0;
        try {
          const Te = /* @__PURE__ */ new Set();
          ue.value = (await op(ke, { url: se, token: oe })).map((be) => {
            const qe = be.key_.includes("[") ? be.key_.slice(0, be.key_.indexOf("[")) : be.key_;
            return { value: qe, label: `${be.name} (${qe})` };
          }).filter((be) => Te.has(be.value) ? !1 : (Te.add(be.value), !0));
        } catch {
          ue.value = [];
        } finally {
          ie.value = !1;
        }
      },
      { immediate: !0 }
    );
    const Ee = [
      "metrics",
      "text",
      "services",
      "itemid",
      "triggers",
      "problems",
      "macros",
      "lld"
    ], me = [
      "problems",
      "recent",
      "history"
    ], ge = {
      problems: "Problems",
      recent: "Recent problems",
      history: "History"
    }, le = [
      { 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" }
    ], Oe = [
      { 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" }
    ], xe = re(
      () => ["metrics", "text", "triggers", "problems", "macros", "lld"].includes(
        n.query.queryType
      )
    );
    return (ke, se) => (E(), B("div", Pk, [
      m("div", null, [
        m("div", $k, I(d(a)("qb.queryType")), 1),
        k(d(Qe), {
          size: "small",
          style: { width: "100%" },
          value: e.query.queryType,
          options: Ee.map((oe) => ({
            value: oe,
            label: d(a)(`qb.queryType.${oe}`)
          })),
          onChange: se[0] || (se[0] = (oe) => u({ queryType: oe, itemIds: [], itemNames: [], itemids: "" }))
        }, null, 8, ["value", "options"])
      ]),
      xe.value ? (E(), B("div", {
        key: 0,
        class: "grid gap-3",
        style: He({ gridTemplateColumns: e.query.queryType === "metrics" ? "repeat(3, 1fr)" : "repeat(2, 1fr)" })
      }, [
        m("div", null, [
          m("div", Ek, I(d(a)("panel.group")), 1),
          k(d(Jn), {
            spinning: d(C),
            size: "small"
          }, {
            default: R(() => [
              k(ul, {
                value: e.query.groupId || void 0,
                "display-value": e.query.groupName || void 0,
                placeholder: d(a)("panel.group.placeholder"),
                groups: p("── 主机组 ──", q.value),
                onChange: se[1] || (se[1] = (oe) => u({ groupId: oe, groupName: y(oe) ? oe : d(b).find((Te) => Te.groupid === oe)?.name ?? oe, hostId: "", hostName: "", itemIds: [], itemNames: [] })),
                onClear: se[2] || (se[2] = () => u({ groupId: "", groupName: "", hostId: "", hostName: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "display-value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        m("div", null, [
          m("div", Ik, I(d(a)("panel.host")), 1),
          k(d(Jn), {
            spinning: d(z),
            size: "small"
          }, {
            default: R(() => [
              k(ul, {
                value: e.query.hostId || void 0,
                "display-value": e.query.hostName || void 0,
                placeholder: d(a)("panel.host.placeholder"),
                groups: p("── 主机 ──", Q.value),
                onChange: se[3] || (se[3] = (oe) => u({ hostId: oe, hostName: y(oe) ? oe : d(v).find((Te) => Te.hostid === oe)?.name ?? oe, itemIds: [], itemNames: [] })),
                onClear: se[4] || (se[4] = () => u({ hostId: "", hostName: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "display-value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        e.query.queryType === "metrics" ? (E(), B("div", Ak, [
          m("div", Ok, I(d(a)("panel.itemTag")), 1),
          k(d(Jn), {
            spinning: U.value,
            size: "small"
          }, {
            default: R(() => [
              k(ul, {
                value: e.query.itemTagsFilter || void 0,
                placeholder: d(a)("panel.itemTag.placeholder"),
                groups: p("── 标签 ──", O.value),
                onChange: se[5] || (se[5] = (oe) => u({ itemTagsFilter: oe ?? "", itemIds: [], itemNames: [] })),
                onClear: se[6] || (se[6] = () => u({ itemTagsFilter: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ])) : ye("", !0)
      ], 4)) : ye("", !0),
      e.query.queryType === "metrics" ? (E(), B("div", Dk, [
        m("div", qk, I(d(a)("panel.items")), 1),
        k(ul, {
          value: e.query.itemNames[0] || void 0,
          placeholder: d(a)("panel.items.placeholder"),
          groups: p("── 监控项 ──", te.value),
          onChange: se[7] || (se[7] = (oe) => u({ itemNames: [oe], itemIds: [] })),
          onClear: se[8] || (se[8] = () => u({ itemNames: [], itemIds: [] }))
        }, null, 8, ["value", "placeholder", "groups"])
      ])) : ye("", !0),
      e.query.queryType === "text" ? (E(), B(Pe, { key: 2 }, [
        m("div", Lk, [
          m("div", null, [
            m("div", Rk, I(d(a)("panel.items")), 1),
            k(d(Jn), {
              spinning: G.value,
              size: "small"
            }, {
              default: R(() => [
                k(ul, {
                  value: e.query.itemNames[0] || void 0,
                  placeholder: d(a)("panel.items.placeholder"),
                  disabled: !e.query.hostId,
                  groups: p("── 监控项 ──", J.value),
                  onChange: se[9] || (se[9] = (oe) => u({ itemNames: [oe], itemIds: [] })),
                  onClear: se[10] || (se[10] = () => u({ itemNames: [], itemIds: [] }))
                }, null, 8, ["value", "placeholder", "disabled", "groups"])
              ]),
              _: 1
            }, 8, ["spinning"])
          ]),
          m("div", null, [
            m("div", Nk, I(d(a)("qb.textFilter")), 1),
            k(d(Ze), {
              size: "small",
              style: { width: "100%" },
              value: e.query.textFilter,
              onChange: se[11] || (se[11] = (oe) => u({ textFilter: oe.target.value }))
            }, null, 8, ["value"])
          ])
        ]),
        m("div", Vk, [
          k(d(Gi), {
            checked: e.query.useCaptureGroups,
            onChange: se[12] || (se[12] = (oe) => u({ useCaptureGroups: oe.target.checked }))
          }, null, 8, ["checked"]),
          m("span", Fk, I(d(a)("qb.useCaptureGroups")), 1)
        ])
      ], 64)) : ye("", !0),
      e.query.queryType === "itemid" ? (E(), B("div", Bk, [
        m("div", Hk, I(d(a)("qb.itemIds")), 1),
        k(d(Ze), {
          size: "small",
          style: { width: "100%" },
          value: e.query.itemids,
          placeholder: d(a)("qb.itemIds.placeholder"),
          onChange: se[13] || (se[13] = (oe) => u({ itemids: oe.target.value }))
        }, null, 8, ["value", "placeholder"])
      ])) : ye("", !0),
      e.query.queryType === "triggers" ? (E(), B("div", Wk, [
        m("div", jk, I(d(a)("qb.triggerFilter")), 1),
        k(d(Ze), {
          size: "small",
          style: { width: "100%" },
          value: e.query.triggerFilter,
          onChange: se[14] || (se[14] = (oe) => u({ triggerFilter: oe.target.value }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      e.query.queryType === "problems" ? (E(), B(Pe, { key: 5 }, [
        m("div", Gk, [
          m("div", null, [
            m("div", Yk, I(d(a)("qb.problemName")), 1),
            k(d(Ze), {
              size: "small",
              style: { width: "100%" },
              value: e.query.triggerFilter,
              onChange: se[15] || (se[15] = (oe) => u({ triggerFilter: oe.target.value }))
            }, null, 8, ["value"])
          ]),
          m("div", null, [
            m("div", Uk, I(d(a)("qb.tags")), 1),
            k(d(Ze), {
              size: "small",
              style: { width: "100%" },
              value: e.query.tagsFilter,
              onChange: se[16] || (se[16] = (oe) => u({ tagsFilter: oe.target.value }))
            }, null, 8, ["value"])
          ]),
          m("div", null, [
            m("div", Kk, I(d(a)("qb.show")), 1),
            k(d(Qe), {
              size: "small",
              style: { width: "100%" },
              value: e.query.showProblems,
              options: me.map((oe) => ({ value: oe, label: ge[oe] })),
              onChange: se[17] || (se[17] = (oe) => u({ showProblems: oe }))
            }, null, 8, ["value", "options"])
          ])
        ]),
        m("div", null, [
          m("div", Xk, I(d(a)("qb.severity")), 1),
          m("div", Qk, [
            (E(), B(Pe, null, Xe(le, (oe) => k(d(Kl), {
              key: oe.value,
              color: e.query.severities.includes(oe.value) ? oe.color : void 0,
              class: "cursor-pointer select-none",
              style: He({ opacity: e.query.severities.includes(oe.value) ? 1 : 0.4 }),
              onClick: () => u({ severities: e.query.severities.includes(oe.value) ? e.query.severities.filter((Te) => Te !== oe.value) : [...e.query.severities, oe.value] })
            }, {
              default: R(() => [
                ce(I(oe.label), 1)
              ]),
              _: 2
            }, 1032, ["color", "style", "onClick"])), 64))
          ])
        ])
      ], 64)) : ye("", !0),
      e.query.queryType === "services" ? (E(), B("div", Jk, [
        m("div", null, [
          m("div", Zk, I(d(a)("qb.itService")), 1),
          k(d(Jn), {
            spinning: A.value,
            size: "small"
          }, {
            default: R(() => [
              k(ul, {
                value: e.query.itServiceFilter || void 0,
                placeholder: d(a)("qb.itService.placeholder"),
                groups: p("── 服务 ──", K.value.map((oe) => ({ value: oe.name, label: oe.name }))),
                onChange: se[18] || (se[18] = (oe) => u({ itServiceFilter: oe })),
                onClear: se[19] || (se[19] = () => u({ itServiceFilter: "" }))
              }, null, 8, ["value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        m("div", null, [
          m("div", eC, I(d(a)("qb.slaProperty")), 1),
          k(d(Qe), {
            size: "small",
            style: { width: "100%" },
            value: e.query.slaProperty,
            options: ve,
            onChange: se[20] || (se[20] = (oe) => u({ slaProperty: oe }))
          }, null, 8, ["value"])
        ]),
        m("div", null, [
          m("div", tC, I(d(a)("qb.slaInterval")), 1),
          k(d(Qe), {
            size: "small",
            style: { width: "100%" },
            value: e.query.slaInterval,
            options: Oe,
            onChange: se[21] || (se[21] = (oe) => u({ slaInterval: oe }))
          }, null, 8, ["value"])
        ])
      ])) : ye("", !0),
      e.query.queryType === "macros" ? (E(), B("div", nC, [
        m("div", iC, I(d(a)("qb.macroFilter")), 1),
        k(d(Jn), {
          spinning: Y.value,
          size: "small"
        }, {
          default: R(() => [
            k(ul, {
              value: e.query.macroFilter || void 0,
              placeholder: "{$MACRO_NAME}",
              disabled: !e.query.hostId,
              groups: [{ label: "── 宏 ──", options: Z.value.map((oe) => ({ value: oe.macro, label: `${oe.macro} = ${oe.value}` })) }],
              onChange: se[22] || (se[22] = (oe) => u({ macroFilter: oe })),
              onClear: se[23] || (se[23] = () => u({ macroFilter: "" }))
            }, null, 8, ["value", "disabled", "groups"])
          ]),
          _: 1
        }, 8, ["spinning"])
      ])) : ye("", !0),
      e.query.queryType === "lld" ? (E(), B("div", lC, [
        m("div", null, [
          m("div", oC, I(d(a)("qb.lld.rule")), 1),
          k(d(Jn), {
            spinning: j.value,
            size: "small"
          }, {
            default: R(() => [
              k(d(Qe), {
                size: "small",
                style: { width: "100%" },
                "allow-clear": "",
                "show-search": "",
                value: e.query.lldRuleId || void 0,
                placeholder: d(a)("qb.lld.rule.placeholder"),
                options: $.value.map((oe) => ({ value: oe.itemid, label: oe.name })),
                onChange: se[24] || (se[24] = (oe) => u({ lldRuleId: oe, lldRuleName: $.value.find((Te) => Te.itemid === oe)?.name ?? oe, lldItemKeys: [] })),
                onClear: se[25] || (se[25] = () => u({ lldRuleId: "", lldRuleName: "", lldItemKeys: [] }))
              }, null, 8, ["value", "placeholder", "options"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        m("div", null, [
          m("div", aC, I(d(a)("qb.lld.itemKeys")), 1),
          k(d(Jn), {
            spinning: ie.value,
            size: "small"
          }, {
            default: R(() => [
              k(d(Qe), {
                size: "small",
                style: { width: "100%" },
                mode: "multiple",
                "allow-clear": "",
                value: e.query.lldItemKeys ?? [],
                options: ue.value,
                onChange: se[26] || (se[26] = (oe) => u({ lldItemKeys: oe }))
              }, null, 8, ["value", "options"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ])
      ])) : ye("", !0),
      ["metrics", "itemid", "services"].includes(e.query.queryType) ? (E(), Ce(XS, {
        key: 9,
        functions: e.query.functions ?? [],
        onChange: se[27] || (se[27] = (oe) => u({ functions: oe }))
      }, null, 8, ["functions"])) : ye("", !0),
      ["macros", "lld"].includes(e.query.queryType) ? ye("", !0) : (E(), Ce(zk, {
        key: 10,
        "query-type": e.query.queryType,
        options: e.query.options ?? {},
        onChange: se[28] || (se[28] = (oe) => u({ options: oe }))
      }, null, 8, ["query-type", "options"]))
    ]));
  }
});
class rC {
  type = "argus";
  meta = { type: "argus", displayName: "Argus", icon: "📊" };
  QueryEditor = LS;
  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 uC {
  type = "zabbix";
  meta = { type: "zabbix", displayName: "Zabbix", icon: "" };
  QueryEditor = sC;
  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() {
    return { data: [], state: "Done" };
  }
}
let Uu = !1;
function cC() {
  if (Uu)
    return;
  Uu = !0, Bf();
  const e = new Tf();
  e.QueryEditor = GS, ts(e), ts(new rC()), ts(new uC());
}
const QC = /* @__PURE__ */ ze({
  __name: "ArgusBoard",
  props: {
    config: { default: () => ({
      hideHeader: !1,
      canEdit: !0,
      theme: null,
      lang: null,
      isEditing: !0,
      initialEditingPanelId: null,
      datasourceConfig: null
    }) }
  },
  emits: ["save"],
  setup(e, { emit: t }) {
    const n = e, i = t;
    cC(), Xd({
      ...n.config,
      onSave: (b) => i("save", b)
    });
    const a = Mi();
    n.config.theme && a.setTheme(n.config.theme);
    const r = re(() => n.config.theme ?? a.theme);
    Fe(r, (b) => {
      document.documentElement.dataset.theme = b, document.body.dataset.theme = b;
    }, { immediate: !0 });
    const f = fe(n.config.lang ?? "zh");
    Ud(f), Fe(() => n.config.lang, (b) => {
      b && (f.value = b);
    });
    const u = fi();
    In(() => {
      n.config.canEdit === !1 ? u.setEditing(!1) : n.config.isEditing !== null && u.setEditing(n.config.isEditing), n.config.initialConfig ? u.importJSON(
        typeof n.config.initialConfig == "string" ? n.config.initialConfig : JSON.stringify(n.config.initialConfig)
      ) : n.config.renderDefaultDashboard === !1 && u.importJSON(JSON.stringify({ title: "", panels: {}, layouts: [] })), n.config.initialEditingPanelId && u.setEditingPanel(n.config.initialEditingPanelId);
    });
    const c = re(() => ({
      algorithm: r.value === "dark" ? lr.darkAlgorithm : lr.defaultAlgorithm,
      token: { colorPrimary: "#1677ff", borderRadius: 4 },
      getPopupContainer: () => document.body
    })), p = re(() => r.value === "dark"), y = re(() => p.value ? "#141414" : "#f0f2f5");
    return (b, v) => (E(), Ce(d(jd), { theme: c.value }, {
      default: R(() => [
        k(d(ec), null, {
          default: R(() => [
            k(d(or), {
              style: He({ minHeight: "100%", background: y.value })
            }, {
              default: R(() => [
                k(d(or).Content, { style: { padding: 0, flex: 1, minHeight: 0 } }, {
                  default: R(() => [
                    k(Fw)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["style"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["theme"]));
  }
}), dC = { class: "log-toolbar" }, fC = { class: "log-scroller" }, hC = { class: "log-time" }, gC = { class: "log-message" }, pC = {
  key: 0,
  class: "log-empty"
}, mC = /* @__PURE__ */ ze({
  __name: "LogViewer",
  props: {
    logs: {},
    maxHeight: { default: 400 }
  },
  setup(e) {
    const t = e, n = fe(""), i = fe([]), a = re(() => t.logs.filter((f) => !(i.value.length > 0 && !i.value.includes(f.level) || n.value && !f.message.toLowerCase().includes(n.value.toLowerCase())))), r = {
      error: "#ff4d4f",
      warn: "#faad14",
      info: "#52c41a",
      debug: "#8c8c8c"
    };
    return (f, u) => {
      const c = lt("a-input"), p = lt("a-select");
      return E(), B("div", {
        class: "log-viewer",
        style: He({ maxHeight: `${e.maxHeight}px` })
      }, [
        m("div", dC, [
          k(c, {
            value: n.value,
            "onUpdate:value": u[0] || (u[0] = (y) => n.value = y),
            size: "small",
            placeholder: "Search logs...",
            "allow-clear": "",
            style: { flex: "1" }
          }, null, 8, ["value"]),
          k(p, {
            value: i.value,
            "onUpdate:value": u[1] || (u[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"])
        ]),
        m("div", fC, [
          (E(!0), B(Pe, null, Xe(a.value, (y) => (E(), B("div", {
            key: y.id,
            class: "log-entry"
          }, [
            m("span", hC, I(new Date(y.timestamp).toLocaleTimeString()), 1),
            m("span", {
              class: "log-level",
              style: He({ color: r[y.level] })
            }, I(y.level.toUpperCase()), 5),
            m("span", gC, I(y.message), 1)
          ]))), 128))
        ]),
        a.value.length === 0 ? (E(), B("div", pC, " No log entries ")) : ye("", !0)
      ], 4);
    };
  }
}), JC = /* @__PURE__ */ xn(mC, [["__scopeId", "data-v-22a0d40d"]]), vC = {
  key: 0,
  class: "topology-empty"
}, yC = ["width", "height"], bC = { class: "edges" }, xC = ["x1", "y1", "x2", "y2"], wC = ["cx", "cy", "fill", "stroke"], SC = ["x", "y"], kC = ["x", "y"], CC = /* @__PURE__ */ ze({
  __name: "ServiceTopology",
  props: {
    nodes: { default: () => [] },
    edges: { default: () => [] },
    width: { default: 800 },
    height: { default: 500 }
  },
  setup(e) {
    const t = e, n = fe(), i = fe({});
    function a() {
      if (t.nodes.length === 0)
        return;
      const f = Math.ceil(Math.sqrt(t.nodes.length)), u = t.width / f, c = t.height / Math.ceil(t.nodes.length / f), p = {};
      t.nodes.forEach((y, b) => {
        const v = b % f, C = Math.floor(b / f);
        p[y.id] = {
          x: v * u + u / 2,
          y: C * c + c / 2
        };
      }), i.value = p;
    }
    In(a);
    function r(f) {
      return f ? f > 0.05 ? "#ff4d4f" : f > 0.01 ? "#faad14" : "#52c41a" : "#52c41a";
    }
    return (f, u) => (E(), B("div", {
      class: "service-topology",
      style: He({ width: `${e.width}px`, height: `${e.height}px` })
    }, [
      e.nodes.length === 0 ? (E(), B("div", vC, " No topology data ")) : (E(), B("svg", {
        key: 1,
        ref_key: "svgRef",
        ref: n,
        width: e.width,
        height: e.height
      }, [
        m("g", bC, [
          (E(!0), B(Pe, null, Xe(e.edges, (c) => (E(), B("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, xC))), 128))
        ]),
        u[0] || (u[0] = m("defs", null, [
          m("marker", {
            id: "arrowhead",
            markerWidth: "10",
            markerHeight: "7",
            refX: "10",
            refY: "3.5",
            orient: "auto"
          }, [
            m("polygon", {
              points: "0 0, 10 3.5, 0 7",
              fill: "var(--ant-color-border)"
            })
          ])
        ], -1)),
        (E(!0), B(Pe, null, Xe(e.nodes, (c) => (E(), B("g", {
          key: c.id,
          class: "topology-node"
        }, [
          m("circle", {
            cx: i.value[c.id]?.x ?? 0,
            cy: i.value[c.id]?.y ?? 0,
            r: "24",
            fill: r(c.errorRate),
            "fill-opacity": "0.15",
            stroke: r(c.errorRate),
            "stroke-width": "2"
          }, null, 8, wC),
          m("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)"
          }, I(c.name), 9, SC),
          c.latency !== void 0 ? (E(), B("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)"
          }, I(c.latency) + "ms ", 9, kC)) : ye("", !0)
        ]))), 128))
      ], 8, yC))
    ], 4));
  }
}), ZC = /* @__PURE__ */ xn(CC, [["__scopeId", "data-v-da85d863"]]), _C = { class: "trace-waterfall" }, zC = {
  key: 0,
  class: "trace-empty"
}, MC = { class: "trace-name-col" }, TC = { class: "trace-service" }, PC = { class: "trace-op" }, $C = { class: "trace-bar-col" }, EC = { class: "trace-dur-col" }, IC = /* @__PURE__ */ ze({
  __name: "TraceWaterfall",
  props: {
    spans: { default: () => [] },
    startTime: {},
    endTime: {}
  },
  setup(e) {
    const t = e, n = re(() => t.startTime ?? Math.min(...t.spans.map((p) => p.startTime))), i = re(() => t.endTime ?? Math.max(...t.spans.map((p) => p.startTime + p.duration))), a = re(() => i.value - n.value);
    function r(p) {
      return (p.startTime - n.value) / a.value * 100;
    }
    function f(p) {
      return Math.max(p.duration / a.value * 100, 0.5);
    }
    function u(p) {
      return p >= 1e6 ? `${(p / 1e6).toFixed(2)}s` : p >= 1e3 ? `${(p / 1e3).toFixed(2)}ms` : `${p}μs`;
    }
    const c = {
      ok: "#52c41a",
      error: "#ff4d4f",
      unset: "#1677ff"
    };
    return (p, y) => (E(), B("div", _C, [
      e.spans.length === 0 ? (E(), B("div", zC, " No trace data ")) : (E(), B(Pe, { key: 1 }, [
        y[0] || (y[0] = m("div", { class: "trace-header" }, [
          m("div", { class: "trace-name-col" }, " Operation "),
          m("div", { class: "trace-bar-col" }, " Timeline "),
          m("div", { class: "trace-dur-col" }, " Duration ")
        ], -1)),
        (E(!0), B(Pe, null, Xe(e.spans, (b) => (E(), B("div", {
          key: b.spanId,
          class: "trace-row"
        }, [
          m("div", MC, [
            m("span", TC, I(b.serviceName), 1),
            m("span", PC, I(b.operationName), 1)
          ]),
          m("div", $C, [
            m("div", {
              class: "trace-bar",
              style: He({
                left: `${r(b)}%`,
                width: `${f(b)}%`,
                background: c[b.status ?? "unset"]
              })
            }, null, 4)
          ]),
          m("div", EC, I(u(b.duration)), 1)
        ]))), 128))
      ], 64))
    ]));
  }
}), e2 = /* @__PURE__ */ xn(IC, [["__scopeId", "data-v-0212681c"]]), t2 = /* @__PURE__ */ ze({
  __name: "SimpleChart",
  props: {
    options: {},
    data: {}
  },
  setup(e) {
    const t = e, n = fe(), i = fe(null), a = fe({ width: 0, height: 0 });
    let r = null;
    function f() {
      i.value && (i.value.destroy(), i.value = null);
    }
    return no(() => {
      r?.disconnect(), f();
    }), wa((u) => {
      n.value && (r = new ResizeObserver((c) => {
        const { width: p, height: y } = c[0].contentRect;
        p > 0 && y > 0 && (a.value = { width: Math.floor(p), height: Math.floor(y) });
      }), r.observe(n.value), a.value = {
        width: Math.floor(n.value.getBoundingClientRect().width),
        height: Math.floor(n.value.getBoundingClientRect().height)
      }, u(() => {
        r?.disconnect();
      }));
    }), wa((u) => {
      !n.value || a.value.width <= 0 || a.value.height <= 0 || (f(), i.value = new tn(
        { ...t.options, width: a.value.width, height: a.value.height },
        t.data,
        n.value
      ), u(() => {
        f();
      }));
    }), (u, c) => (E(), B("div", {
      ref_key: "containerRef",
      ref: n,
      class: "w-full h-full"
    }, null, 512));
  }
}), AC = { class: "kbd-key" }, OC = /* @__PURE__ */ ze({
  __name: "Kbd",
  props: {
    char: {}
  },
  setup(e) {
    return (t, n) => (E(), B("kbd", AC, [
      zi(t.$slots, "default", {}, () => [
        ce(I(e.char), 1)
      ], !0)
    ]));
  }
}), n2 = /* @__PURE__ */ xn(OC, [["__scopeId", "data-v-94fb4749"]]), DC = ["href", "target"], qC = {
  key: 1,
  class: "panel-links-icon",
  style: { cursor: "pointer" }
}, LC = { style: { "font-size": "10px", "margin-left": "2px" } }, RC = /* @__PURE__ */ ze({
  __name: "PanelLinksIcon",
  props: {
    panel: {}
  },
  setup(e) {
    return (t, n) => e.panel.links && e.panel.links.length > 0 ? (E(), Ce(d(Pn), {
      key: 0,
      title: e.panel.links.map((i) => i.title ?? i.url).join(", ")
    }, {
      default: R(() => [
        e.panel.links.length === 1 ? (E(), B("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] = $n(() => {
          }, ["stop"]))
        }, [...n[1] || (n[1] = [
          m("span", {
            class: "i-mdi-link",
            style: { "font-size": "14px" }
          }, null, -1)
        ])], 8, DC)) : (E(), B("span", qC, [
          n[2] || (n[2] = m("span", {
            class: "i-mdi-link-variant",
            style: { "font-size": "14px" }
          }, null, -1)),
          m("span", LC, I(e.panel.links.length), 1)
        ]))
      ]),
      _: 1
    }, 8, ["title"])) : ye("", !0);
  }
}), i2 = /* @__PURE__ */ xn(RC, [["__scopeId", "data-v-6925a5a2"]]), NC = { class: "viz-picker" }, VC = { class: "viz-picker-title" }, FC = { class: "viz-picker-grid" }, BC = ["onClick"], HC = { class: "viz-picker-label" }, WC = /* @__PURE__ */ ze({
  __name: "VizPickerPane",
  setup(e) {
    const { t } = ot(), { panel: n, onChange: i } = ao(), a = [
      { type: "timeseries", icon: Me.chartLine, labelKey: "config.type.timeseries" },
      { type: "bar", icon: Me.chartBar, labelKey: "config.type.bar" },
      { type: "stat", icon: Me.stat, labelKey: "config.type.stat" },
      { type: "gauge", icon: Me.gauge, labelKey: "config.type.gauge" },
      { type: "pie", icon: Me.chartPie, labelKey: "config.type.pie" },
      { type: "table", icon: Me.table, labelKey: "config.type.table" },
      { type: "histogram", icon: Me.chartArea, labelKey: "config.type.histogram" }
    ];
    return (r, f) => (E(), B("div", NC, [
      m("div", VC, I(d(t)("editor.vizPicker.title")), 1),
      m("div", FC, [
        (E(), B(Pe, null, Xe(a, (u) => m("button", {
          key: u.type,
          class: Ae(["viz-picker-item", { "viz-picker-item--active": d(n).type === u.type }]),
          onClick: (c) => d(i)({ type: u.type })
        }, [
          m("span", {
            class: Ae(["viz-picker-icon", [u.icon]])
          }, null, 2),
          m("span", HC, I(d(t)(u.labelKey)), 1)
        ], 10, BC)), 64))
      ])
    ]));
  }
}), l2 = /* @__PURE__ */ xn(WC, [["__scopeId", "data-v-1d0d144f"]]);
export {
  $w as AddPanelModal,
  nr as AgChart,
  QC as ArgusBoard,
  LS as ArgusQueryEditor,
  Dw as DashboardHeader,
  Fw as DashboardPage,
  n2 as Kbd,
  JC as LogViewer,
  GS as MockQueryEditor,
  Gu as PanelContainer,
  gw as PanelEditorLayout,
  yw as PanelEditorModal,
  i2 as PanelLinksIcon,
  Rs as PanelRenderer,
  ZC as ServiceTopology,
  t2 as SimpleChart,
  Cd as TimeRangePicker,
  e2 as TraceWaterfall,
  z1 as UPlotChart,
  _d as VariableBar,
  Nx as VariableConfigModal,
  l2 as VizPickerPane,
  C1 as providePlotContext,
  cC as registerAllPlugins,
  XC as usePlotContext
};
