import "./index.css";
import { computed, readonly, reactive, shallowRef, defineComponent, openBlock, createBlock, unref, createElementBlock, normalizeStyle, createVNode, withCtx, renderSlot, Fragment, createCommentVNode, provide, watch, inject, ref, onMounted, onBeforeUnmount, normalizeClass, createElementVNode, nextTick, toDisplayString, createSlots, createTextVNode, mergeProps, toHandlers, useAttrs, renderList, withModifiers, h, onUpdated, useSlots, Teleport, markRaw, withDirectives, vModelText, defineAsyncComponent, vModelSelect, normalizeProps, guardReactiveProps, Transition, withKeys, useCssVars, vShow, onUnmounted, resolveComponent, createStaticVNode, toRaw, resolveDynamicComponent, withMemo, toRef, isRef, vModelCheckbox, vModelRadio } from "vue";
import uPlot from "uplot";
import "uplot/dist/uPlot.min.css";
import { GridLayout, GridItem } from "vue-grid-layout-v3";
import { useRouter, useRoute } from "vue-router";
import { defineStore, storeToRefs, createPinia, setActivePinia, getActivePinia } from "pinia";
import { ArrowLeftOutlined, InfoCircleOutlined, CameraOutlined, CodeOutlined, LinkOutlined, BgColorsOutlined, CheckOutlined, CopyOutlined, ShareAltOutlined, SaveOutlined, DownloadOutlined, FileTextOutlined } from "@ant-design/icons-vue";
import dayjs from "dayjs";
import { Slider, Form, Pagination, Tooltip, Button, Modal, Select, Input, Switch, RangePicker, Checkbox, Tabs, TabPane, Drawer, Table, Radio, RadioGroup, RadioButton, Popover } from "ant-design-vue";
import { closeCompletion, startCompletion, completionKeymap, autocompletion } from "@codemirror/autocomplete";
import { history, historyKeymap, defaultKeymap } from "@codemirror/commands";
import { EditorState, Prec, RangeSetBuilder } from "@codemirror/state";
import { EditorView, keymap, placeholder, Decoration, ViewPlugin } from "@codemirror/view";
import axios from "axios";
import { Lexer, Token, LexerATNSimulator, PredictionContextCache, ATNDeserializer, DFA, Parser, FailedPredicateException, ParserATNSimulator, RecognitionException, NoViableAltException, ParserRuleContext, CharStreams, CommonTokenStream, ParseTreeWalker, ErrorListener } from "antlr4";
import { parser } from "@prometheus-io/lezer-promql";
import "ol/ol.css";
import Map$1 from "ol/Map";
import View from "ol/View";
import Tile from "ol/layer/Tile";
import Vector from "ol/layer/Vector";
import Heatmap from "ol/layer/Heatmap";
import OSM from "ol/source/OSM";
import XYZ from "ol/source/XYZ";
import Vector$1 from "ol/source/Vector";
import Feature from "ol/Feature";
import Point from "ol/geom/Point";
import LineString from "ol/geom/LineString";
import Polygon from "ol/geom/Polygon";
import { fromLonLat, toLonLat, transformExtent } from "ol/proj";
import { getArea, getLength } from "ol/sphere";
import { Circle, Fill, RegularShape, Stroke, Style, Text } from "ol/style";
import { defaults } from "ol/control";
import Zoom from "ol/control/Zoom";
import ScaleLine from "ol/control/ScaleLine";
import Attribution from "ol/control/Attribution";
import Draw from "ol/interaction/Draw";
import MouseWheelZoom from "ol/interaction/MouseWheelZoom";
import GeoJSON from "ol/format/GeoJSON";
const LoadingStateEnum = {
  Loading: "Loading",
  Done: "Done",
  Error: "Error",
  NotStarted: "NotStarted",
  Streaming: "Streaming"
};
function createDataFrame(opts) {
  const fields = opts.fields.map((f) => ({
    name: f.name,
    type: f.type ?? inferType$1(f.values),
    config: f.config ?? {},
    values: f.values,
    labels: f.labels
  }));
  const length = fields.reduce((max, f) => Math.max(max, f.values.length), 0);
  return {
    refId: opts.refId,
    name: opts.name,
    fields,
    length,
    meta: opts.meta
  };
}
function inferType$1(values) {
  const sample = values.find((v) => v != null);
  if (typeof sample === "number") return "number";
  if (typeof sample === "boolean") return "boolean";
  if (sample instanceof Date) return "time";
  if (typeof sample === "string" && !Number.isNaN(Date.parse(sample)) && /\d{4}-\d{2}-\d{2}/.test(sample)) {
    return "time";
  }
  return typeof sample === "string" ? "string" : "other";
}
const TIME_SERIES_VALUE_FIELD_NAME = "Value";
const TIME_SERIES_TIME_FIELD_NAME = "Time";
function formatLabels(labels) {
  if (!labels) return "";
  return Object.entries(labels).filter(([, v]) => v != null && v !== "").map(([k, v]) => `${k}=${v}`).join(", ");
}
function getFieldDisplayName(field, frame, allFrames) {
  const name = calculateFieldDisplayName(field, frame, allFrames);
  if (field.state?.displayName !== name) {
    field.state = { ...field.state || {}, displayName: name };
  }
  return name;
}
function isGenericValueName(s) {
  const t2 = s.trim();
  if (!t2 || t2 === TIME_SERIES_VALUE_FIELD_NAME) return true;
  if (/^Value\s*\{/.test(t2)) return true;
  return false;
}
function calculateFieldDisplayName(field, frame, allFrames) {
  const cfg = field.config ?? {};
  if (cfg.displayName && String(cfg.displayName).length && !isGenericValueName(String(cfg.displayName))) {
    return String(cfg.displayName);
  }
  if (cfg.displayNameFromDS && String(cfg.displayNameFromDS).length && !isGenericValueName(String(cfg.displayNameFromDS))) {
    return String(cfg.displayNameFromDS);
  }
  if (field.type === "time" && !field.labels) {
    return field.name || TIME_SERIES_TIME_FIELD_NAME;
  }
  const frames = allFrames?.length ? allFrames : frame ? [frame] : [];
  let frameNamesDiffer = false;
  if (frames.length > 1) {
    for (let i = 1; i < frames.length; i++) {
      if (frames[i].name !== frames[i - 1].name) {
        frameNamesDiffer = true;
        break;
      }
    }
  }
  const parts = [];
  let frameNameAdded = false;
  let labelsAdded = false;
  if (frameNamesDiffer && frame?.name) {
    parts.push(frame.name);
    frameNameAdded = true;
  }
  if (field.name && !isGenericValueName(field.name)) {
    parts.push(field.name);
  }
  if (field.labels && Object.keys(field.labels).length) {
    const singleLabel = getSingleLabelName(frames.length ? frames : frame ? [frame] : []);
    if (singleLabel && field.labels[singleLabel] != null && field.labels[singleLabel] !== "") {
      parts.push(String(field.labels[singleLabel]));
      labelsAdded = true;
    } else {
      const allLabels = formatLabels(field.labels);
      if (allLabels) {
        parts.push(allLabels);
        labelsAdded = true;
      }
    }
  }
  if (frame && !frameNameAdded && !labelsAdded && isGenericValueName(field.name || "")) {
    if (frame.name) {
      parts.push(frame.name);
      frameNameAdded = true;
    }
  }
  if (parts.length) return parts.join(" ");
  if (field.name) return field.name;
  if (frame?.name) return frame.name;
  return TIME_SERIES_VALUE_FIELD_NAME;
}
function getSingleLabelName(frames) {
  const keys = /* @__PURE__ */ new Set();
  for (const fr of frames) {
    for (const f of fr.fields) {
      if (!f.labels) continue;
      for (const k of Object.keys(f.labels)) keys.add(k);
      if (keys.size > 1) return null;
    }
  }
  if (keys.size === 1) return [...keys][0];
  return null;
}
function getFrameDisplayName(frame, index2) {
  if (frame.name) return String(frame.name);
  const valueFieldNames = [];
  for (const field of frame.fields) {
    if (field.type === "time") continue;
    valueFieldNames.push(getFieldDisplayName(field, frame));
    if (valueFieldNames.length > 1) break;
  }
  if (valueFieldNames.length === 1) return valueFieldNames[0];
  if (index2 === void 0 && frame.fields.length > 0) {
    return frame.fields.filter((f) => f.type !== "time").map((f) => getFieldDisplayName(f, frame)).join(", ");
  }
  if (typeof index2 === "number") return `Series (${index2})`;
  return "Series";
}
function fieldMatchesName(field, name, frame, allFrames) {
  if (!name) return false;
  if (field.name === name) return true;
  return getFieldDisplayName(field, frame, allFrames) === name;
}
function findField$1(frame, name, allFrames) {
  if (name == null || name === "") return void 0;
  const n = String(name);
  return frame.fields.find((f) => f.name === n) ?? frame.fields.find((f) => getFieldDisplayName(f, frame, allFrames) === n);
}
function toDataFrameDTO(frame) {
  return {
    ...frame,
    fields: frame.fields.map((f) => ({
      ...f,
      values: [...f.values],
      config: { ...f.config }
    }))
  };
}
const frameRevision = /* @__PURE__ */ new WeakMap();
const normalizedRevision = /* @__PURE__ */ new WeakMap();
let nextRevision = 1;
function assignFrameRevision(frame, revision) {
  const rev = revision ?? nextRevision++;
  frameRevision.set(frame, rev);
  return rev;
}
function getFrameRevision(frame) {
  return frameRevision.get(frame);
}
function markFrameNormalized(frame, revision) {
  const rev = revision ?? getFrameRevision(frame) ?? assignFrameRevision(frame);
  frameRevision.set(frame, rev);
  normalizedRevision.set(frame, rev);
  return rev;
}
function isFrameNormalized(frame) {
  const rev = frameRevision.get(frame);
  if (rev == null) return false;
  return normalizedRevision.get(frame) === rev;
}
function bumpFrameRevision(frame) {
  const rev = nextRevision++;
  frameRevision.set(frame, rev);
  normalizedRevision.delete(frame);
  return rev;
}
function customOf(frame) {
  const meta2 = frame.meta;
  if (!meta2 || typeof meta2 !== "object") return {};
  const custom = meta2.custom;
  if (!custom || typeof custom !== "object" || Array.isArray(custom)) return {};
  return custom;
}
function frameContextMatches(frame, ctx) {
  if (!ctx) return true;
  const custom = customOf(frame);
  const checks = [
    [ctx.source, custom.source],
    [ctx.datasourceUid, custom.datasourceUid],
    [ctx.profile, custom.profile],
    [ctx.signal, custom.signal],
    [ctx.requestId, custom.requestId],
    [ctx.semanticKind, custom.semanticKind],
    [
      ctx.preferredVisualisationType,
      custom.preferredVisualisationType ?? frame.meta?.preferredVisualisationType
    ]
  ];
  for (const [want, have] of checks) {
    if (want == null) continue;
    if (have !== want) return false;
  }
  if (ctx.refId != null && frame.refId != null && frame.refId !== ctx.refId) {
    return false;
  }
  return true;
}
function canSkipNormalize(frame, ctx) {
  return isFrameNormalized(frame) && frameContextMatches(frame, ctx);
}
function frameSetRevisionKey(frames) {
  if (!frames?.length) return "0";
  let s = String(frames.length);
  for (const f of frames) {
    const rev = getFrameRevision(f);
    const len = f.length ?? f.fields?.[0]?.values?.length ?? 0;
    const cols = f.fields?.length ?? 0;
    s += `|${rev ?? "x"}:${f.refId ?? ""}:${len}x${cols}`;
  }
  return s;
}
function cloneValue$1(v) {
  if (v == null || typeof v !== "object") return v;
  if (Array.isArray(v)) return v.map(cloneValue$1);
  return { ...v };
}
function asStringLabels(labels) {
  if (!labels) return void 0;
  const out = {};
  for (const [k, v] of Object.entries(labels)) {
    if (v == null) continue;
    out[String(k)] = String(v);
  }
  return out;
}
function isUint64String(v) {
  if (!/^\d+$/.test(v)) return false;
  if (v.length > 15) return true;
  try {
    const n = Number(v);
    return Number.isFinite(n) && !Number.isSafeInteger(n);
  } catch {
    return true;
  }
}
function normalizeTimeValue(v, trackNs) {
  if (v == null || v === "") return null;
  if (typeof v === "number") {
    if (!Number.isFinite(v)) return null;
    if (v > 1e15) {
      trackNs();
      return Math.floor(v / 1e6);
    }
    if (v > 0 && v < 1e11) return Math.floor(v * 1e3);
    return v;
  }
  if (v instanceof Date) return v.getTime();
  if (typeof v === "string" && /^\d+$/.test(v)) {
    if (v.length > 15) {
      trackNs();
      const ms = Number(v.slice(0, -6));
      return Number.isFinite(ms) ? ms : null;
    }
    const n2 = Number(v);
    if (Number.isFinite(n2)) return normalizeTimeValue(n2, trackNs);
  }
  const n = Number(v);
  if (Number.isFinite(n)) return normalizeTimeValue(n, trackNs);
  const d = Date.parse(String(v));
  return Number.isFinite(d) ? d : null;
}
function allocValues(len) {
  const values = new Array(len);
  for (let i = 0; i < len; i++) values[i] = null;
  return values;
}
function normalizeDataFrames(frames, ctx) {
  return (frames ?? []).map((frame) => {
    if (canSkipNormalize(frame, ctx)) {
      return frame;
    }
    const refId = ctx?.refId ?? frame.refId;
    const fieldsIn = frame.fields ?? [];
    const len = fieldsIn.reduce((m, f) => Math.max(m, f.values?.length ?? 0), 0);
    const uint64Fields = /* @__PURE__ */ new Set();
    const nanosecondFields = /* @__PURE__ */ new Set();
    const fields = fieldsIn.map((f) => {
      let type = f.type;
      const src = f.values ?? [];
      const values = allocValues(len);
      const isTime = type === "time" || /^time$/i.test(f.name);
      if (isTime) type = "time";
      for (let i = 0; i < src.length && i < len; i++) {
        const v = src[i];
        if (isTime) {
          values[i] = normalizeTimeValue(v, () => {
            nanosecondFields.add(f.name);
          });
          continue;
        }
        if (type === "number") {
          if (v == null || v === "") {
            values[i] = null;
            continue;
          }
          if (typeof v === "number") {
            values[i] = v;
            continue;
          }
          if (typeof v === "bigint") {
            const s = v.toString();
            if (isUint64String(s) || v > BigInt(Number.MAX_SAFE_INTEGER) || v < BigInt(Number.MIN_SAFE_INTEGER)) {
              uint64Fields.add(f.name);
              values[i] = s;
            } else {
              values[i] = Number(v);
            }
            continue;
          }
          if (typeof v === "string") {
            if (v === "NaN") {
              values[i] = Number.NaN;
              continue;
            }
            if (v === "+Inf" || v === "Infinity") {
              values[i] = Infinity;
              continue;
            }
            if (v === "-Inf" || v === "-Infinity") {
              values[i] = -Infinity;
              continue;
            }
            if (isUint64String(v)) {
              uint64Fields.add(f.name);
              values[i] = v;
              continue;
            }
            const n2 = Number(v);
            values[i] = Number.isFinite(n2) || n2 === Infinity || n2 === -Infinity || Number.isNaN(n2) ? n2 : null;
            continue;
          }
          const n = Number(v);
          values[i] = Number.isFinite(n) || n === Infinity || n === -Infinity || Number.isNaN(n) ? n : null;
          continue;
        }
        values[i] = v;
      }
      return {
        name: f.name,
        type,
        config: { ...f.config || {} },
        values,
        labels: asStringLabels(f.labels),
        state: f.state ? { ...f.state } : void 0
      };
    });
    const prevMeta = frame.meta ? cloneValue$1(frame.meta) : {};
    const prevCustom = prevMeta.custom && typeof prevMeta.custom === "object" && !Array.isArray(prevMeta.custom) ? { ...prevMeta.custom } : {};
    const custom = { ...prevCustom };
    if (ctx?.source != null) custom.source = ctx.source;
    if (ctx?.datasourceUid != null) custom.datasourceUid = ctx.datasourceUid;
    if (ctx?.profile != null) custom.profile = ctx.profile;
    if (ctx?.signal != null) custom.signal = ctx.signal;
    if (ctx?.requestId != null) custom.requestId = ctx.requestId;
    if (ctx?.semanticKind != null) custom.semanticKind = ctx.semanticKind;
    if (ctx?.preferredVisualisationType != null) {
      custom.preferredVisualisationType = ctx.preferredVisualisationType;
    }
    if (uint64Fields.size > 0) {
      const existing = Array.isArray(prevCustom.uint64Fields) ? prevCustom.uint64Fields : [];
      custom.uint64Fields = Array.from(/* @__PURE__ */ new Set([...existing, ...uint64Fields]));
    }
    if (nanosecondFields.size > 0) {
      const existing = Array.isArray(prevCustom.nanosecondFields) ? prevCustom.nanosecondFields : [];
      custom.nanosecondFields = Array.from(/* @__PURE__ */ new Set([...existing, ...nanosecondFields]));
    }
    const meta2 = { ...prevMeta };
    if (Object.keys(custom).length > 0) {
      meta2.custom = custom;
    }
    if (ctx?.preferredVisualisationType != null && meta2.preferredVisualisationType == null) {
      meta2.preferredVisualisationType = ctx.preferredVisualisationType;
    }
    const out = createDataFrame({
      refId,
      name: frame.name,
      meta: Object.keys(meta2).length > 0 ? meta2 : void 0,
      fields: fields.map((f) => ({
        name: f.name,
        type: f.type,
        values: f.values,
        config: f.config,
        labels: f.labels
      }))
    });
    markFrameNormalized(out);
    return out;
  });
}
function frameFingerprint(frames) {
  return JSON.stringify(
    frames.map((fr) => ({
      name: fr.name,
      refId: fr.refId,
      len: fr.length,
      fields: fr.fields.map((f) => ({
        name: f.name,
        type: f.type,
        labels: f.labels ?? {},
        config: {
          displayName: f.config?.displayName,
          unit: f.config?.unit,
          displayNameFromDS: f.config?.displayNameFromDS
        },
        n: f.values.length,
        head: f.values.slice(0, 3),
        tail: f.values.slice(-2)
      })),
      meta: fr.meta ?? {}
    }))
  );
}
function dateTime(input) {
  if (input == null) return /* @__PURE__ */ new Date();
  return new Date(input);
}
function isUtcTimezone(timezone) {
  const s = String(timezone ?? "").trim().toLowerCase();
  return s === "utc" || s === "gmt" || s === "etc/utc" || s === "z";
}
function isIanaTimezone(timezone) {
  const s = String(timezone ?? "").trim();
  if (!s) return false;
  const lower = s.toLowerCase();
  if (lower === "browser" || lower === "default" || lower === "local" || isUtcTimezone(s)) {
    return false;
  }
  if (!s.includes("/")) return false;
  try {
    Intl.DateTimeFormat(void 0, { timeZone: s }).format(0);
    return true;
  } catch {
    return false;
  }
}
function getZonedParts(date, timeZone) {
  const dtf = new Intl.DateTimeFormat("en-US", {
    timeZone,
    hourCycle: "h23",
    year: "numeric",
    month: "2-digit",
    day: "2-digit",
    hour: "2-digit",
    minute: "2-digit",
    second: "2-digit"
  });
  const map = {};
  for (const p of dtf.formatToParts(date)) {
    if (p.type !== "literal") map[p.type] = p.value;
  }
  let hour = Number(map.hour ?? 0);
  if (hour === 24) hour = 0;
  return {
    year: Number(map.year),
    month: Number(map.month),
    day: Number(map.day),
    hour,
    minute: Number(map.minute ?? 0),
    second: Number(map.second ?? 0)
  };
}
function zonedWallTimeToUtc(parts, timeZone) {
  const hour = parts.hour ?? 0;
  const minute = parts.minute ?? 0;
  const second = parts.second ?? 0;
  let utc = Date.UTC(parts.year, parts.month - 1, parts.day, hour, minute, second);
  for (let i = 0; i < 3; i++) {
    const seen = getZonedParts(new Date(utc), timeZone);
    const asUtc = Date.UTC(
      seen.year,
      seen.month - 1,
      seen.day,
      seen.hour,
      seen.minute,
      seen.second
    );
    const target = Date.UTC(parts.year, parts.month - 1, parts.day, hour, minute, second);
    const diff = asUtc - target;
    if (diff === 0) break;
    utc -= diff;
  }
  return new Date(utc);
}
function startOfUnitIana(now2, unit, weekStart, timeZone) {
  const p = getZonedParts(now2, timeZone);
  switch (unit) {
    case "s":
      return zonedWallTimeToUtc({ ...p }, timeZone);
    case "m":
      return zonedWallTimeToUtc({ ...p, second: 0 }, timeZone);
    case "h":
      return zonedWallTimeToUtc({ ...p, minute: 0, second: 0 }, timeZone);
    case "d":
      return zonedWallTimeToUtc(
        {
          year: p.year,
          month: p.month,
          day: p.day,
          hour: 0,
          minute: 0,
          second: 0
        },
        timeZone
      );
    case "w": {
      const noon = zonedWallTimeToUtc(
        {
          year: p.year,
          month: p.month,
          day: p.day,
          hour: 12,
          minute: 0,
          second: 0
        },
        timeZone
      );
      const dowWanted = (() => {
        const s = String(weekStart ?? "").trim().toLowerCase();
        if (s === "sunday" || s === "sun") return 0;
        if (s === "saturday" || s === "sat") return 6;
        return 1;
      })();
      const wd = new Intl.DateTimeFormat("en-US", {
        timeZone,
        weekday: "short"
      }).format(noon);
      const map = {
        Sun: 0,
        Mon: 1,
        Tue: 2,
        Wed: 3,
        Thu: 4,
        Fri: 5,
        Sat: 6
      };
      const current = map[wd] ?? 1;
      const diff = (current - dowWanted + 7) % 7;
      const startDay = p.day - diff;
      return zonedWallTimeToUtc(
        {
          year: p.year,
          month: p.month,
          day: startDay,
          hour: 0,
          minute: 0,
          second: 0
        },
        timeZone
      );
    }
    case "M":
      return zonedWallTimeToUtc(
        { year: p.year, month: p.month, day: 1, hour: 0, minute: 0, second: 0 },
        timeZone
      );
    case "y":
      return zonedWallTimeToUtc(
        { year: p.year, month: 1, day: 1, hour: 0, minute: 0, second: 0 },
        timeZone
      );
    default:
      return new Date(now2);
  }
}
function endOfUnitIana(now2, unit, weekStart, timeZone) {
  const start = startOfUnitIana(now2, unit, weekStart, timeZone);
  const p = getZonedParts(start, timeZone);
  let next;
  switch (unit) {
    case "s":
      next = new Date(start.getTime() + 1e3);
      break;
    case "m":
      next = new Date(start.getTime() + 6e4);
      break;
    case "h":
      next = new Date(start.getTime() + 36e5);
      break;
    case "d":
      next = zonedWallTimeToUtc(
        {
          year: p.year,
          month: p.month,
          day: p.day + 1,
          hour: 0,
          minute: 0,
          second: 0
        },
        timeZone
      );
      break;
    case "w":
      next = zonedWallTimeToUtc(
        {
          year: p.year,
          month: p.month,
          day: p.day + 7,
          hour: 0,
          minute: 0,
          second: 0
        },
        timeZone
      );
      break;
    case "M": {
      let y = p.year;
      let m = p.month + 1;
      if (m > 12) {
        m = 1;
        y += 1;
      }
      next = zonedWallTimeToUtc(
        { year: y, month: m, day: 1, hour: 0, minute: 0, second: 0 },
        timeZone
      );
      break;
    }
    case "y":
      next = zonedWallTimeToUtc(
        { year: p.year + 1, month: 1, day: 1, hour: 0, minute: 0, second: 0 },
        timeZone
      );
      break;
    default:
      next = new Date(start.getTime() + 1);
  }
  return new Date(next.getTime() - 1);
}
function rangeUtil_parse(raw, now2 = /* @__PURE__ */ new Date(), opts) {
  const effectiveNow = applyNowDelay(now2, opts?.nowDelayMs);
  const fiscalMonth = normalizeFiscalMonth(opts?.fiscalYearStartMonth);
  const weekStart = String(opts?.weekStart ?? "");
  const tz = String(opts?.timezone ?? "");
  const utc = isUtcTimezone(tz);
  const iana = !utc && isIanaTimezone(tz) ? tz : "";
  const from = parseRelative(raw.from, effectiveNow, "from", fiscalMonth, weekStart, utc, iana);
  const to = parseRelative(raw.to, effectiveNow, "to", fiscalMonth, weekStart, utc, iana);
  return { from, to, raw };
}
function applyNowDelay(now2, nowDelayMs) {
  const n = Number(nowDelayMs ?? 0);
  if (!Number.isFinite(n) || n <= 0) return new Date(now2);
  return new Date(now2.getTime() - n);
}
function normalizeFiscalMonth(raw) {
  const n = Number(raw ?? 0);
  if (!Number.isFinite(n)) return 0;
  const m = Math.trunc(n);
  if (m < 0) return 0;
  if (m > 11) return m % 12;
  return m;
}
function startOfFiscalYear(now2, fiscalYearStartMonth = 0) {
  const month = normalizeFiscalMonth(fiscalYearStartMonth);
  const d = new Date(now2);
  d.setHours(0, 0, 0, 0);
  d.setDate(1);
  if (d.getMonth() >= month) {
    d.setMonth(month);
  } else {
    d.setFullYear(d.getFullYear() - 1);
    d.setMonth(month);
  }
  return d;
}
function endOfFiscalYear(now2, fiscalYearStartMonth = 0) {
  const start = startOfFiscalYear(now2, fiscalYearStartMonth);
  const end = new Date(start);
  end.setFullYear(end.getFullYear() + 1);
  return end;
}
function startOfFiscalQuarter(now2, fiscalYearStartMonth = 0) {
  const month = normalizeFiscalMonth(fiscalYearStartMonth);
  const fyStart = startOfFiscalYear(now2, fiscalYearStartMonth);
  const offset = (now2.getMonth() - month + 12) % 12;
  const q = Math.floor(offset / 3);
  const d = new Date(fyStart);
  d.setMonth(fyStart.getMonth() + q * 3);
  d.setDate(1);
  d.setHours(0, 0, 0, 0);
  return d;
}
function endOfFiscalQuarter(now2, fiscalYearStartMonth = 0) {
  const start = startOfFiscalQuarter(now2, fiscalYearStartMonth);
  const end = new Date(start);
  end.setMonth(end.getMonth() + 3);
  return end;
}
function weekStartDow$1(weekStart, browserDefault = 1) {
  const s = String(weekStart ?? "").trim().toLowerCase();
  if (!s) return browserDefault;
  if (s === "sunday" || s === "sun") return 0;
  if (s === "saturday" || s === "sat") return 6;
  if (s === "monday" || s === "mon") return 1;
  return browserDefault;
}
function startOfWeek(now2, weekStart, utc = false) {
  const dow = weekStartDow$1(weekStart);
  const d = new Date(now2);
  if (utc) {
    d.setUTCHours(0, 0, 0, 0);
    const current = d.getUTCDay();
    const diff = (current - dow + 7) % 7;
    d.setUTCDate(d.getUTCDate() - diff);
  } else {
    d.setHours(0, 0, 0, 0);
    const current = d.getDay();
    const diff = (current - dow + 7) % 7;
    d.setDate(d.getDate() - diff);
  }
  return d;
}
function endOfWeek(now2, weekStart, utc = false) {
  const start = startOfWeek(now2, weekStart, utc);
  const end = new Date(start);
  if (utc) {
    end.setUTCDate(end.getUTCDate() + 7);
  } else {
    end.setDate(end.getDate() + 7);
  }
  end.setMilliseconds(end.getMilliseconds() - 1);
  return end;
}
function startOfUnit(now2, unit, weekStart, utc = false, iana = "") {
  if (iana) return startOfUnitIana(now2, unit, weekStart, iana);
  const d = new Date(now2);
  if (utc) {
    switch (unit) {
      case "s":
        d.setUTCMilliseconds(0);
        return d;
      case "m":
        d.setUTCSeconds(0, 0);
        return d;
      case "h":
        d.setUTCMinutes(0, 0, 0);
        return d;
      case "d":
        d.setUTCHours(0, 0, 0, 0);
        return d;
      case "w":
        return startOfWeek(now2, weekStart, true);
      case "M":
        d.setUTCDate(1);
        d.setUTCHours(0, 0, 0, 0);
        return d;
      case "y":
        d.setUTCMonth(0, 1);
        d.setUTCHours(0, 0, 0, 0);
        return d;
      default:
        return d;
    }
  }
  switch (unit) {
    case "s":
      d.setMilliseconds(0);
      return d;
    case "m":
      d.setSeconds(0, 0);
      return d;
    case "h":
      d.setMinutes(0, 0, 0);
      return d;
    case "d":
      d.setHours(0, 0, 0, 0);
      return d;
    case "w":
      return startOfWeek(now2, weekStart, false);
    case "M":
      d.setDate(1);
      d.setHours(0, 0, 0, 0);
      return d;
    case "y":
      d.setMonth(0, 1);
      d.setHours(0, 0, 0, 0);
      return d;
    default:
      return d;
  }
}
function endOfUnit(now2, unit, weekStart, utc = false, iana = "") {
  if (iana) return endOfUnitIana(now2, unit, weekStart, iana);
  if (unit === "w") return endOfWeek(now2, weekStart, utc);
  const start = startOfUnit(now2, unit, weekStart, utc);
  const end = new Date(start);
  if (utc) {
    switch (unit) {
      case "s":
        end.setUTCSeconds(end.getUTCSeconds() + 1);
        break;
      case "m":
        end.setUTCMinutes(end.getUTCMinutes() + 1);
        break;
      case "h":
        end.setUTCHours(end.getUTCHours() + 1);
        break;
      case "d":
        end.setUTCDate(end.getUTCDate() + 1);
        break;
      case "M":
        end.setUTCMonth(end.getUTCMonth() + 1);
        break;
      case "y":
        end.setUTCFullYear(end.getUTCFullYear() + 1);
        break;
    }
  } else {
    switch (unit) {
      case "s":
        end.setSeconds(end.getSeconds() + 1);
        break;
      case "m":
        end.setMinutes(end.getMinutes() + 1);
        break;
      case "h":
        end.setHours(end.getHours() + 1);
        break;
      case "d":
        end.setDate(end.getDate() + 1);
        break;
      case "M":
        end.setMonth(end.getMonth() + 1);
        break;
      case "y":
        end.setFullYear(end.getFullYear() + 1);
        break;
    }
  }
  end.setMilliseconds(end.getMilliseconds() - 1);
  return end;
}
function parseRelative(value, now2, edge, fiscalYearStartMonth = 0, weekStart = "", utc = false, iana = "") {
  if (value instanceof Date) return value;
  const s = String(value ?? "").trim();
  if (!s) return new Date(now2);
  if (s === "now") return new Date(now2);
  if (!/^now/i.test(s)) {
    const abs = new Date(s);
    if (!Number.isNaN(abs.getTime())) return abs;
    return new Date(now2);
  }
  let math = s.slice(3);
  let cursor = new Date(now2);
  const roundUp = edge === "to";
  while (math.length) {
    const op = math[0];
    if (op !== "/" && op !== "+" && op !== "-") {
      break;
    }
    math = math.slice(1);
    let num2 = 1;
    const numMatch = /^(\d+)/.exec(math);
    if (numMatch) {
      num2 = Number(numMatch[1]);
      math = math.slice(numMatch[1].length);
      if (!Number.isFinite(num2) || num2 <= 0) num2 = 1;
    }
    let isFiscal = false;
    if (math[0] === "f" || math[0] === "F") {
      isFiscal = true;
      math = math.slice(1);
    }
    if (!math.length) {
      if (isFiscal && op === "/") {
        return roundUp ? new Date(endOfFiscalYear(cursor, fiscalYearStartMonth).getTime() - 1) : startOfFiscalYear(cursor, fiscalYearStartMonth);
      }
      break;
    }
    const unit = math[0];
    math = math.slice(1);
    if (isFiscal) {
      const u = unit === "Y" ? "y" : unit;
      if (op === "/") {
        if (num2 !== 1) return cursor;
        if (u === "y") {
          cursor = roundUp ? new Date(endOfFiscalYear(cursor, fiscalYearStartMonth).getTime() - 1) : startOfFiscalYear(cursor, fiscalYearStartMonth);
        } else if (u === "Q") {
          cursor = roundUp ? new Date(endOfFiscalQuarter(cursor, fiscalYearStartMonth).getTime() - 1) : startOfFiscalQuarter(cursor, fiscalYearStartMonth);
        }
      } else if (op === "-") {
        if (u === "y") {
          const start = startOfFiscalYear(cursor, fiscalYearStartMonth);
          start.setFullYear(start.getFullYear() - num2);
          cursor = start;
        } else if (u === "Q") {
          const start = startOfFiscalQuarter(cursor, fiscalYearStartMonth);
          start.setMonth(start.getMonth() - num2 * 3);
          cursor = start;
        }
      } else if (op === "+") {
        if (u === "y") {
          const start = startOfFiscalYear(cursor, fiscalYearStartMonth);
          start.setFullYear(start.getFullYear() + num2);
          cursor = start;
        } else if (u === "Q") {
          const start = startOfFiscalQuarter(cursor, fiscalYearStartMonth);
          start.setMonth(start.getMonth() + num2 * 3);
          cursor = start;
        }
      }
      continue;
    }
    if (!"smhdwMy".includes(unit)) {
      break;
    }
    if (op === "/") {
      if (num2 !== 1) return cursor;
      cursor = roundUp ? endOfUnit(cursor, unit, weekStart, utc, iana) : startOfUnit(cursor, unit, weekStart, utc, iana);
      continue;
    }
    const sign = op === "-" ? -1 : 1;
    const d = new Date(cursor);
    switch (unit) {
      case "s":
        d.setSeconds(d.getSeconds() + sign * num2);
        break;
      case "m":
        d.setMinutes(d.getMinutes() + sign * num2);
        break;
      case "h":
        d.setHours(d.getHours() + sign * num2);
        break;
      case "d":
        d.setDate(d.getDate() + sign * num2);
        break;
      case "w":
        d.setDate(d.getDate() + sign * num2 * 7);
        break;
      case "M":
        d.setMonth(d.getMonth() + sign * num2);
        break;
      case "y":
        d.setFullYear(d.getFullYear() + sign * num2);
        break;
    }
    cursor = d;
  }
  return cursor;
}
function getInterval(range, resolution = 1e3) {
  const ms = Math.max(1, range.to.getTime() - range.from.getTime());
  const step = Math.max(1e3, Math.floor(ms / resolution));
  if (step < 6e4) return `${Math.round(step / 1e3)}s`;
  if (step < 36e5) return `${Math.round(step / 6e4)}m`;
  return `${Math.round(step / 36e5)}h`;
}
const defaultRefreshIntervals = [
  "5s",
  "10s",
  "30s",
  "1m",
  "5m",
  "15m",
  "30m",
  "1h",
  "2h",
  "1d"
];
function intervalToMs(input) {
  const raw = String(input ?? "").trim();
  if (!raw || raw.toLowerCase() === "off") return 0;
  if (raw === "LIVE" || raw.toLowerCase() === "auto") return 0;
  if (/^\d+$/.test(raw)) {
    const n = Number(raw);
    return Number.isFinite(n) && n > 0 ? n : 0;
  }
  const m = raw.match(/^(\d+(?:\.\d+)?)(ms|[smhd])$/i);
  if (!m) return 0;
  const v = Number(m[1]);
  if (!Number.isFinite(v) || v <= 0) return 0;
  const u = m[2].toLowerCase();
  if (u === "ms") return v;
  if (u === "s") return v * 1e3;
  if (u === "m") return v * 6e4;
  if (u === "h") return v * 36e5;
  if (u === "d") return v * 864e5;
  return 0;
}
const stringToMs = intervalToMs;
const registry$3 = /* @__PURE__ */ new Map();
function registerTransformer(id, fn) {
  registry$3.set(id, fn);
}
function getTransformer(id) {
  return registry$3.get(id);
}
function listTransformerIds$1() {
  return [...registry$3.keys()];
}
const ALIASES$2 = {
  // filterFieldsByName is first-class; filterByName is internal alias
  filterByName: "filterFieldsByName",
  filterFramesByRefId: "filterByRefId",
  seriesToColumns: "joinByField"
};
const DEFAULT_OPTIONS$1 = {
  limit: { limitField: 10 },
  sortBy: { sort: [] },
  reduce: { reducers: ["sum"] },
  histogram: { bucketCount: 10 },
  smoothing: { windowSize: 3 },
  filterByValue: { type: "include", filters: [] },
  prepareTimeSeries: { format: "multi" }
};
function resolveTransformerId(id) {
  return ALIASES$2[id] ?? id;
}
function deepCloneFrames(frames) {
  return frames.map((frame) => {
    const fields = frame.fields.map((f) => ({
      name: f.name,
      type: f.type,
      config: f.config ? { ...f.config } : {},
      values: f.values.slice(),
      labels: f.labels ? { ...f.labels } : void 0,
      state: f.state ? { ...f.state } : void 0
    }));
    return {
      refId: frame.refId,
      name: frame.name,
      meta: frame.meta ? { ...frame.meta } : void 0,
      fields,
      length: frame.length ?? fields[0]?.values.length ?? 0
    };
  });
}
function interpolateOptions(value, interpolate) {
  if (!interpolate) return value;
  if (typeof value === "string") return interpolate(value);
  if (Array.isArray(value)) return value.map((v) => interpolateOptions(v, interpolate));
  if (value && typeof value === "object") {
    const out = {};
    for (const [k, v] of Object.entries(value)) {
      out[k] = interpolateOptions(v, interpolate);
    }
    return out;
  }
  return value;
}
function patternFromFilterOptions(options) {
  if (options == null) return "";
  if (typeof options === "string" || typeof options === "number") return String(options);
  if (typeof options === "object") {
    const o = options;
    if (o.pattern != null) return String(o.pattern);
    if (o.refId != null) return String(o.refId);
    if (o.value != null) return String(o.value);
    if (Array.isArray(o.names)) return o.names.map(String).join("|");
  }
  return String(options);
}
function compileMatcher(raw) {
  const s = raw.trim();
  if (!s) return () => true;
  const m = s.match(/^\/(.+)\/([gimsuy]*)$/);
  if (m) {
    try {
      const re = new RegExp(m[1], m[2]);
      return (v) => re.test(v);
    } catch {
      return (v) => v === s;
    }
  }
  try {
    const re = new RegExp(`^(?:${s})$`);
    return (v) => re.test(v);
  } catch {
    return (v) => v === s;
  }
}
function matchFrameFilter(frame, filter2) {
  if (filter2 == null || filter2 === "") return true;
  if (typeof filter2 === "string") {
    const hit2 = compileMatcher(filter2);
    return hit2(String(frame.refId ?? "")) || hit2(String(frame.name ?? ""));
  }
  const id = String(filter2.id || "byRefId");
  const pattern = patternFromFilterOptions(filter2.options);
  const hit = compileMatcher(pattern);
  if (id === "byName" || id === "byFrameName") {
    return hit(String(frame.name ?? ""));
  }
  if (id === "byRefId" || id === "byFrameRefID" || id === "byFrameRefId") {
    return hit(String(frame.refId ?? ""));
  }
  return hit(String(frame.refId ?? "")) || hit(String(frame.name ?? ""));
}
function applyWithFrameFilter(frames, filter2, fn, options) {
  if (filter2 == null || filter2 === "") {
    return fn(frames, options);
  }
  const matched = [];
  const passthrough = /* @__PURE__ */ new Map();
  frames.forEach((f, i) => {
    if (matchFrameFilter(f, filter2)) {
      matched.push(f);
    } else {
      passthrough.set(i, f);
    }
  });
  if (!matched.length) return frames;
  const transformed = fn(matched, options);
  const out = [];
  let inserted = false;
  for (let i = 0; i < frames.length; i++) {
    if (passthrough.has(i)) {
      out.push(passthrough.get(i));
    } else if (!inserted) {
      out.push(...transformed);
      inserted = true;
      transformed.length;
    }
  }
  if (!inserted) out.push(...transformed);
  return out;
}
function snapshotFrames(frames) {
  return {
    frameCount: frames.length,
    fieldNames: frames.flatMap((f) => f.fields.map((field) => field.name)),
    rowCounts: frames.map((f) => f.length ?? f.fields[0]?.values?.length ?? 0)
  };
}
function applyTransformationsWithTrace(frames, transformations = [], context) {
  const diagnostics = [];
  const steps = [];
  const includeSnaps = !!context?.includeFrameSnapshots;
  const frameSnapshots = includeSnaps ? [] : void 0;
  let acc = deepCloneFrames(frames);
  frameSnapshots?.push(acc);
  steps.push({
    id: "__input__",
    resolvedId: "__input__",
    frameCount: acc.length,
    fieldNames: acc.flatMap((f) => f.fields.map((field) => field.name)),
    rowCounts: acc.map((f) => f.length ?? f.fields[0]?.values?.length ?? 0),
    optionKeys: []
  });
  for (const t2 of transformations) {
    const resolvedId = resolveTransformerId(t2.id);
    if (t2.disabled) {
      steps.push({
        id: t2.id,
        resolvedId,
        disabled: true,
        ...snapshotFrames(acc),
        optionKeys: Object.keys(t2.options || {})
      });
      frameSnapshots?.push(acc);
      continue;
    }
    const fn = getTransformer(resolvedId) ?? getTransformer(t2.id);
    if (!fn) {
      diagnostics.push({
        id: t2.id,
        level: "warn",
        message: `Unknown transformation: ${t2.id}`
      });
      steps.push({
        id: t2.id,
        resolvedId,
        ...snapshotFrames(acc),
        error: `Unknown transformation: ${t2.id}`,
        optionKeys: Object.keys(t2.options || {})
      });
      frameSnapshots?.push(acc);
      continue;
    }
    const defaults2 = DEFAULT_OPTIONS$1[resolvedId] ?? DEFAULT_OPTIONS$1[t2.id] ?? {};
    const merged = interpolateOptions({ ...defaults2, ...t2.options || {} }, context?.interpolate);
    try {
      acc = applyWithFrameFilter(
        acc,
        t2.filter,
        fn,
        merged
      );
      steps.push({
        id: t2.id,
        resolvedId,
        ...snapshotFrames(acc),
        optionKeys: Object.keys(t2.options || {}),
        filtered: t2.filter != null && t2.filter !== ""
      });
      frameSnapshots?.push(acc);
    } catch (error) {
      const msg = error instanceof Error ? error.message : String(error);
      diagnostics.push({ id: t2.id, level: "error", message: msg });
      steps.push({
        id: t2.id,
        resolvedId,
        ...snapshotFrames(acc),
        error: msg,
        optionKeys: Object.keys(t2.options || {})
      });
      throw error;
    }
  }
  return { frames: acc, steps, diagnostics, frameSnapshots };
}
function readLimitOption$1(options) {
  if (!options) return void 0;
  const raw = options.limit ?? options.limitField ?? options.limitValue;
  if (raw == null) return void 0;
  const n = Math.floor(Number(raw));
  return Number.isFinite(n) && n >= 0 ? n : void 0;
}
function tryFuseSortLimit$1(transformations, index2) {
  const cur = transformations[index2];
  const next = transformations[index2 + 1];
  if (!cur || !next) return null;
  if (cur.disabled || next.disabled) return null;
  const curId = resolveTransformerId(cur.id);
  const nextId2 = resolveTransformerId(next.id);
  if (curId !== "sortBy" || nextId2 !== "limit") return null;
  const f1 = cur.filter ?? null;
  const f2 = next.filter ?? null;
  if (JSON.stringify(f1) !== JSON.stringify(f2)) return null;
  const lim = readLimitOption$1(next.options);
  if (lim == null) return null;
  return {
    fusedOptions: {
      ...cur.options || {},
      limit: lim,
      limitField: lim,
      limitValue: lim
    },
    skipNext: true
  };
}
function applyTransformations(frames, transformations = [], diagnostics, context) {
  let acc = deepCloneFrames(frames);
  if (!transformations.length) return acc;
  const localDiag = diagnostics ?? [];
  for (let i = 0; i < transformations.length; i++) {
    const t2 = transformations[i];
    if (t2.disabled) continue;
    const resolvedId = resolveTransformerId(t2.id);
    const fn = getTransformer(resolvedId) ?? getTransformer(t2.id);
    if (!fn) {
      localDiag.push({
        id: t2.id,
        level: "warn",
        message: `Unknown transformation: ${t2.id}`
      });
      continue;
    }
    const defaults2 = DEFAULT_OPTIONS$1[resolvedId] ?? DEFAULT_OPTIONS$1[t2.id] ?? {};
    const fuse = tryFuseSortLimit$1(transformations, i);
    const stepOptions = fuse ? { ...defaults2, ...fuse.fusedOptions } : { ...defaults2, ...t2.options || {} };
    const merged = interpolateOptions(stepOptions, context?.interpolate);
    try {
      acc = applyWithFrameFilter(
        acc,
        t2.filter,
        fn,
        merged
      );
      if (fuse?.skipNext) i += 1;
    } catch (error) {
      const msg = error instanceof Error ? error.message : String(error);
      localDiag.push({ id: t2.id, level: "error", message: msg });
      throw error;
    }
  }
  if (diagnostics && diagnostics !== localDiag) {
    diagnostics.push(...localDiag);
  }
  return acc;
}
function listTransformerIds() {
  return listTransformerIds$1();
}
function namesFromVariable(raw) {
  if (raw == null || raw === "") return null;
  let s = String(raw).trim();
  if (/^\{.*\}$/.test(s)) s = s.slice(1, -1);
  const names = s.split(",").map((x) => x.trim()).filter(Boolean);
  return names.length ? names : null;
}
function matcherFrom(opts, byVariable) {
  if (opts == null || opts === "") return null;
  if (typeof opts === "string") {
    if (byVariable || opts.includes(",") || /^\{.*\}$/.test(opts)) {
      const names = namesFromVariable(opts);
      if (names) {
        const set = new Set(names);
        return (name) => set.has(name);
      }
    }
    try {
      const re = new RegExp(opts);
      return (name) => re.test(name);
    } catch {
      return (name) => name === opts;
    }
  }
  if (typeof opts === "object") {
    const fromVar = (byVariable || opts.variable != null) && opts.variable != null ? namesFromVariable(opts.variable) : null;
    if (fromVar) {
      const set = new Set(fromVar);
      return (name) => set.has(name);
    }
    const names = opts.names;
    const pattern = opts.pattern;
    if (Array.isArray(names) && names.length) {
      const set = new Set(names.map(String));
      if (pattern) {
        try {
          const re = new RegExp(pattern);
          return (name) => set.has(name) || re.test(name);
        } catch {
          return (name) => set.has(name);
        }
      }
      return (name) => set.has(name);
    }
    if (pattern) {
      try {
        const re = new RegExp(pattern);
        return (name) => re.test(name);
      } catch {
        return (name) => name === pattern;
      }
    }
  }
  return null;
}
function fieldMatchesPred(field, frame, frames, pred) {
  if (pred(field.name)) return true;
  try {
    const display = getFieldDisplayName(field, frame, frames);
    if (display && display !== field.name && pred(display)) return true;
  } catch {
  }
  const cfgDn = field.config?.displayName;
  if (typeof cfgDn === "string" && cfgDn && pred(cfgDn)) return true;
  return false;
}
registerTransformer("filterByName", (frames, options = {}) => {
  const byVariable = options.byVariable === true;
  const includePred = matcherFrom(options.include, byVariable) ?? matcherFrom(options.pattern != null ? String(options.pattern) : void 0, byVariable);
  const excludePred = matcherFrom(options.exclude, byVariable);
  if (!includePred && !excludePred) return frames;
  return frames.map((frame) => {
    let fields = frame.fields;
    if (includePred) {
      fields = fields.filter((f) => fieldMatchesPred(f, frame, frames, includePred));
    }
    if (excludePred) {
      fields = fields.filter((f) => !fieldMatchesPred(f, frame, frames, excludePred));
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields
    });
  });
});
function stringStartsAsRegEx(str) {
  return Boolean(str) && str[0] === "/";
}
function stringToJsRegex(str) {
  if (!stringStartsAsRegEx(str)) {
    return new RegExp(`^${str}$`);
  }
  const match = str.match(/^\/(.*?)\/(g?i?m?y?s?)$/);
  if (!match) {
    throw new Error(`'${str}' is not a valid regular expression.`);
  }
  return new RegExp(match[1], match[2]);
}
function stringToJsRegexSafe(str) {
  try {
    const s = String(str ?? "");
    if (!s) return null;
    return stringToJsRegex(s);
  } catch {
    return null;
  }
}
function compileRefIdMatcher(pattern) {
  const p = String(pattern ?? "").trim();
  if (!p) return () => false;
  if (p.startsWith("/")) {
    const re = stringToJsRegexSafe(p);
    if (re) return (refId) => re.test(refId);
  }
  if (p.includes("|") && !p.startsWith("^") && !p.includes(".*") && !p.includes("(")) {
    const set = new Set(
      p.split("|").map((s) => s.trim()).filter(Boolean)
    );
    return (refId) => set.has(refId);
  }
  try {
    if (/[.*+?^${}()[\]\\]/.test(p)) {
      const re = new RegExp(p);
      return (refId) => re.test(refId);
    }
  } catch {
  }
  return (refId) => refId === p;
}
registerTransformer("filterByRefId", (frames, options = {}) => {
  const includeRaw = options.include != null && String(options.include).trim() !== "" ? String(options.include) : void 0;
  const excludeRaw = options.exclude != null && String(options.exclude).trim() !== "" ? String(options.exclude) : void 0;
  if (!includeRaw && !excludeRaw) return frames;
  const include = includeRaw ? compileRefIdMatcher(includeRaw) : null;
  const exclude = excludeRaw ? compileRefIdMatcher(excludeRaw) : null;
  return frames.filter((f) => {
    const refId = f.refId ?? "";
    if (exclude && exclude(refId)) return false;
    if (include) return include(refId);
    return true;
  });
});
function isTrueMap(raw) {
  return !!raw && typeof raw === "object" && !Array.isArray(raw);
}
function isStringMap(raw) {
  return !!raw && typeof raw === "object" && !Array.isArray(raw);
}
function isNumberMap(raw) {
  return !!raw && typeof raw === "object" && !Array.isArray(raw);
}
function fieldKey(f, frame) {
  try {
    return getFieldDisplayName(f, frame) || f.name;
  } catch {
    return f.name;
  }
}
function indexOfName(name, indexByName) {
  if (Object.prototype.hasOwnProperty.call(indexByName, name)) {
    const v = Number(indexByName[name]);
    return Number.isFinite(v) ? v : Number.MAX_SAFE_INTEGER;
  }
  return Number.MAX_SAFE_INTEGER;
}
function organizeFrame(frame, options) {
  const excludeByName = isTrueMap(options.excludeByName) ? options.excludeByName : {};
  const includeByName = isTrueMap(options.includeByName) ? options.includeByName : void 0;
  const indexByName = isNumberMap(options.indexByName) ? options.indexByName : {};
  const renameByName = isStringMap(options.renameByName) ? options.renameByName : {};
  let fields = [...frame.fields];
  if (includeByName) {
    const includeKeys = Object.keys(includeByName).filter((k) => includeByName[k]);
    if (includeKeys.length) {
      const allow = new Set(includeKeys);
      fields = fields.filter((f) => allow.has(f.name) || allow.has(fieldKey(f, frame)));
    }
  }
  fields = fields.filter((f) => {
    if (excludeByName[f.name]) return false;
    const disp = fieldKey(f, frame);
    if (disp !== f.name && excludeByName[disp]) return false;
    return true;
  });
  if (Object.keys(indexByName).length) {
    fields = [...fields].sort((a, b) => {
      const ai = Math.min(
        indexOfName(a.name, indexByName),
        indexOfName(fieldKey(a, frame), indexByName)
      );
      const bi = Math.min(
        indexOfName(b.name, indexByName),
        indexOfName(fieldKey(b, frame), indexByName)
      );
      return ai - bi;
    });
  }
  fields = fields.map((f) => {
    const key = fieldKey(f, frame);
    const next = renameByName[key] ?? renameByName[f.name];
    if (typeof next !== "string" || !next.length) return f;
    return {
      ...f,
      config: {
        ...f.config || {},
        displayName: next
      },
      state: {
        ...f.state || {},
        displayName: next
      }
    };
  });
  return createDataFrame({
    refId: frame.refId,
    name: frame.name,
    fields
  });
}
registerTransformer("organize", (frames, options = {}) => {
  const opts = options;
  return frames.map((frame) => organizeFrame(frame, opts));
});
function compareValues$1(av, bv, desc) {
  if (av == null && bv == null) return 0;
  if (av == null) return 1;
  if (bv == null) return -1;
  if (typeof av === "number" && typeof bv === "number") {
    if (av === bv) return 0;
    const c = av < bv ? -1 : 1;
    return desc ? -c : c;
  }
  if (av < bv) return desc ? 1 : -1;
  if (av > bv) return desc ? -1 : 1;
  return 0;
}
function reorderFrame(frame, indices) {
  const n = indices.length;
  const fields = frame.fields.map((f) => {
    const src = f.values;
    const values = new Array(n);
    for (let i = 0; i < n; i++) values[i] = src[indices[i]];
    return {
      name: f.name,
      type: f.type,
      config: f.config ? { ...f.config } : {},
      values,
      labels: f.labels ? { ...f.labels } : void 0,
      state: f.state ? { ...f.state } : void 0
    };
  });
  return {
    refId: frame.refId,
    name: frame.name,
    meta: frame.meta ? { ...frame.meta } : void 0,
    fields,
    length: n
  };
}
function topKIndices(keyValues, k, desc) {
  const n = keyValues.length;
  if (k <= 0) return [];
  if (k >= n) {
    const indices = new Array(n);
    for (let i = 0; i < n; i++) indices[i] = i;
    indices.sort((a, b) => compareValues$1(keyValues[a], keyValues[b], desc));
    return indices;
  }
  const heap = [];
  const better = (a, b) => (
    // a is "better" (more preferred in final order) than b
    compareValues$1(keyValues[a], keyValues[b], desc) < 0
  );
  const worseThan = (a, b) => compareValues$1(keyValues[a], keyValues[b], desc) > 0;
  const siftUp = (i) => {
    while (i > 0) {
      const p = i - 1 >> 1;
      if (!worseThan(heap[i], heap[p])) break;
      const tmp = heap[i];
      heap[i] = heap[p];
      heap[p] = tmp;
      i = p;
    }
  };
  const siftDown = (i) => {
    for (; ; ) {
      let w = i;
      const l = i * 2 + 1;
      const r = l + 1;
      if (l < heap.length && worseThan(heap[l], heap[w])) w = l;
      if (r < heap.length && worseThan(heap[r], heap[w])) w = r;
      if (w === i) break;
      const tmp = heap[i];
      heap[i] = heap[w];
      heap[w] = tmp;
      i = w;
    }
  };
  for (let i = 0; i < n; i++) {
    if (heap.length < k) {
      heap.push(i);
      siftUp(heap.length - 1);
      continue;
    }
    if (better(i, heap[0])) {
      heap[0] = i;
      siftDown(0);
    }
  }
  heap.sort((a, b) => compareValues$1(keyValues[a], keyValues[b], desc));
  return heap;
}
registerTransformer("sortBy", (frames, options = {}) => {
  const sortSpecs = options.sort ?? [];
  const sort = sortSpecs[0];
  if (!sort?.field) return frames;
  const desc = !!sort.desc;
  const limitRaw = options.limit ?? options.limitField ?? options.limitValue;
  const limit = limitRaw == null ? void 0 : Math.floor(Number(limitRaw));
  return frames.map((frame) => {
    const idx = frame.fields.findIndex(
      (f) => f.name === sort.field || getFieldDisplayName(f, frame, frames) === sort.field
    );
    if (idx < 0) return frame;
    const keyValues = frame.fields[idx].values;
    const n = keyValues.length;
    if (n <= 1) return frame;
    if (limit != null && Number.isFinite(limit) && limit >= 0 && limit < n) {
      const indices2 = topKIndices(keyValues, limit, desc);
      return reorderFrame(frame, indices2);
    }
    const indices = new Array(n);
    for (let i = 0; i < n; i++) indices[i] = i;
    indices.sort((a, b) => compareValues$1(keyValues[a], keyValues[b], desc));
    return reorderFrame(frame, indices);
  });
});
registerTransformer("limit", (frames, options = {}) => {
  const limit = Number(options.limit ?? options.limitField ?? 10);
  if (!Number.isFinite(limit) || limit < 0) return frames;
  const n = Math.floor(limit);
  return frames.map((frame) => {
    const len = frame.length ?? frame.fields[0]?.values?.length ?? 0;
    if (len <= n) return frame;
    return {
      refId: frame.refId,
      name: frame.name,
      meta: frame.meta ? { ...frame.meta } : void 0,
      length: n,
      fields: frame.fields.map((f) => ({
        name: f.name,
        type: f.type,
        config: f.config ? { ...f.config } : {},
        values: f.values.slice(0, n),
        labels: f.labels ? { ...f.labels } : void 0,
        state: f.state ? { ...f.state } : void 0
      }))
    };
  });
});
registerTransformer("reduce", (frames, options = {}) => {
  const labelsToFields = options.labelsToFields === true;
  const reducers = (options.reducers ?? ["lastNotNull"]).map(String);
  const mode2 = String(options.mode ?? "seriesToRows");
  const reducerTitle = (r) => {
    const map = {
      sum: "Sum",
      max: "Max",
      min: "Min",
      mean: "Mean",
      last: "Last",
      lastNotNull: "Last *",
      first: "First",
      firstNotNull: "First *",
      count: "Count",
      range: "Range"
    };
    return map[r] || r;
  };
  const applyReducer = (raw, r) => {
    const finite = () => raw.map((v) => v == null || v === "" ? Number.NaN : Number(v)).filter((n) => Number.isFinite(n));
    if (r === "last") {
      if (!raw.length) return Number.NaN;
      const v = raw[raw.length - 1];
      if (v == null || v === "") return Number.NaN;
      const n = Number(v);
      return Number.isFinite(n) ? n : Number.NaN;
    }
    if (r === "first") {
      if (!raw.length) return Number.NaN;
      const v = raw[0];
      if (v == null || v === "") return Number.NaN;
      const n = Number(v);
      return Number.isFinite(n) ? n : Number.NaN;
    }
    if (r === "lastNotNull") {
      for (let i = raw.length - 1; i >= 0; i--) {
        const v = raw[i];
        if (v == null || v === "") continue;
        const n = Number(v);
        if (Number.isFinite(n)) return n;
      }
      return Number.NaN;
    }
    if (r === "firstNotNull") {
      for (const v of raw) {
        if (v == null || v === "") continue;
        const n = Number(v);
        if (Number.isFinite(n)) return n;
      }
      return Number.NaN;
    }
    const nums = finite();
    if (!nums.length) return Number.NaN;
    if (r === "min") return Math.min(...nums);
    if (r === "max") return Math.max(...nums);
    if (r === "mean") return nums.reduce((a, b) => a + b, 0) / nums.length;
    if (r === "sum") return nums.reduce((a, b) => a + b, 0);
    if (r === "count") return nums.length;
    if (r === "range") return Math.max(...nums) - Math.min(...nums);
    return nums[nums.length - 1];
  };
  const fieldNames = [];
  const labelCols = /* @__PURE__ */ new Map();
  const reducerCols = {};
  for (const r of reducers) reducerCols[reducerTitle(r)] = [];
  if (reducers.includes("sum") && !reducerCols.Total) reducerCols.Total = [];
  if (labelsToFields) {
    for (const frame of frames) {
      for (const field of frame.fields) {
        if (field.type !== "number") continue;
        for (const k of Object.keys(field.labels ?? {})) {
          if (!labelCols.has(k)) labelCols.set(k, []);
        }
      }
    }
  }
  for (const frame of frames) {
    const numFields = frame.fields.filter((f) => f.type === "number");
    for (const field of numFields) {
      const rawVals = field.values;
      const display = labelsToFields ? field.name : getFieldDisplayName(field, frame, frames) || frame.name || field.name;
      fieldNames.push(String(display));
      if (labelsToFields) {
        const labels = field.labels || {};
        for (const k of labelCols.keys()) {
          labelCols.get(k).push(String(labels[k] ?? ""));
        }
      }
      for (const r of reducers) {
        const title = reducerTitle(r);
        reducerCols[title].push(applyReducer(rawVals, r));
      }
      if (reducers.includes("sum")) {
        reducerCols.Total.push(applyReducer(rawVals, "sum"));
      }
    }
  }
  if (!fieldNames.length) {
    return [
      createDataFrame({
        refId: frames[0]?.refId,
        name: "reduce",
        fields: [
          { name: "Field", type: "string", values: [] },
          { name: "Value", type: "number", values: [] }
        ]
      })
    ];
  }
  for (const arr of labelCols.values()) {
    while (arr.length < fieldNames.length) arr.push("");
  }
  const includeTimeField = options.includeTimeField === true;
  if (mode2 === "reduceFields") {
    return frames.map((frame) => {
      const fields = frame.fields.filter((f) => {
        if (f.type === "time") return includeTimeField;
        return f.type === "number" || f.type === "string" || f.type === "boolean";
      }).map((f) => {
        if (f.type === "time") {
          const r2 = reducers[0] || "lastNotNull";
          return { ...f, values: [applyReducer(f.values, r2)] };
        }
        if (f.type !== "number") return { ...f, values: f.values.slice(0, 1) };
        const r = reducers[0] || "lastNotNull";
        return { ...f, values: [applyReducer(f.values, r)] };
      });
      return createDataFrame({ refId: frame.refId, name: frame.name, fields });
    });
  }
  return [
    createDataFrame({
      refId: frames[0]?.refId,
      name: "reduce",
      meta: { preferredVisualisationType: "table" },
      fields: [
        { name: "Field", type: "string", values: fieldNames },
        ...labelsToFields ? [...labelCols.entries()].map(([k, vals]) => ({
          name: k,
          type: "string",
          values: vals
        })) : [],
        ...Object.entries(reducerCols).map(([k, vals]) => ({
          name: k,
          type: "number",
          values: vals
        }))
      ]
    })
  ];
});
var ReducerID = /* @__PURE__ */ ((ReducerID2) => {
  ReducerID2["sum"] = "sum";
  ReducerID2["max"] = "max";
  ReducerID2["min"] = "min";
  ReducerID2["mean"] = "mean";
  ReducerID2["last"] = "last";
  ReducerID2["first"] = "first";
  ReducerID2["count"] = "count";
  ReducerID2["lastNotNull"] = "lastNotNull";
  ReducerID2["firstNotNull"] = "firstNotNull";
  ReducerID2["range"] = "range";
  ReducerID2["diff"] = "diff";
  ReducerID2["diffperc"] = "diffperc";
  ReducerID2["delta"] = "delta";
  ReducerID2["step"] = "step";
  ReducerID2["variance"] = "variance";
  ReducerID2["stdDev"] = "stdDev";
  ReducerID2["median"] = "median";
  ReducerID2["allIsZero"] = "allIsZero";
  ReducerID2["allIsNull"] = "allIsNull";
  ReducerID2["changeCount"] = "changeCount";
  ReducerID2["distinctCount"] = "distinctCount";
  ReducerID2["logmin"] = "logmin";
  return ReducerID2;
})(ReducerID || {});
function numericValues(field) {
  return field.values.map((v) => v == null || v === "" ? null : Number(v)).filter((v) => v != null && !Number.isNaN(v));
}
function reduceField$1(field, reducers = [
  "lastNotNull"
  /* lastNotNull */
]) {
  const nums = numericValues(field);
  const out = {};
  for (const r of reducers) {
    if (r === "count") {
      out[r] = nums.length;
      continue;
    }
    if (r === "allIsNull") {
      out[r] = field.values.every((v) => v == null || v === "");
      continue;
    }
    if (r === "allIsZero") {
      out[r] = nums.length > 0 && nums.every((n) => n === 0);
      continue;
    }
    if (r === "distinctCount") {
      out[r] = new Set(nums).size;
      continue;
    }
    if (r === "changeCount") {
      let c = 0;
      for (let i = 1; i < nums.length; i++) if (nums[i] !== nums[i - 1]) c++;
      out[r] = c;
      continue;
    }
    if (!nums.length) {
      out[r] = null;
      continue;
    }
    switch (r) {
      case "last":
        out[r] = Number(field.values[field.values.length - 1]);
        break;
      case "lastNotNull":
        out[r] = nums[nums.length - 1];
        break;
      case "first":
        out[r] = Number(field.values[0]);
        break;
      case "firstNotNull":
        out[r] = nums[0];
        break;
      case "min":
        out[r] = Math.min(...nums);
        break;
      case "max":
        out[r] = Math.max(...nums);
        break;
      case "mean":
        out[r] = nums.reduce((a, b) => a + b, 0) / nums.length;
        break;
      case "sum":
        out[r] = nums.reduce((a, b) => a + b, 0);
        break;
      case "range":
        out[r] = Math.max(...nums) - Math.min(...nums);
        break;
      case "diff":
        out[r] = nums[nums.length - 1] - nums[0];
        break;
      case "diffperc": {
        const a = nums[0];
        out[r] = a === 0 ? null : (nums[nums.length - 1] - a) / Math.abs(a) * 100;
        break;
      }
      case "delta": {
        let d = 0;
        for (let i = 1; i < nums.length; i++) {
          const step = nums[i] - nums[i - 1];
          if (step > 0) d += step;
        }
        out[r] = d;
        break;
      }
      case "step": {
        let maxStep = 0;
        for (let i = 1; i < nums.length; i++)
          maxStep = Math.max(maxStep, Math.abs(nums[i] - nums[i - 1]));
        out[r] = maxStep;
        break;
      }
      case "variance": {
        const mean = nums.reduce((a, b) => a + b, 0) / nums.length;
        out[r] = nums.reduce((a, b) => a + (b - mean) ** 2, 0) / nums.length;
        break;
      }
      case "stdDev": {
        const mean = nums.reduce((a, b) => a + b, 0) / nums.length;
        const v = nums.reduce((a, b) => a + (b - mean) ** 2, 0) / nums.length;
        out[r] = Math.sqrt(v);
        break;
      }
      case "median": {
        const s = [...nums].sort((a, b) => a - b);
        const mid = Math.floor(s.length / 2);
        out[r] = s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2;
        break;
      }
      case "logmin": {
        const pos = nums.filter((n) => n > 0);
        out[r] = pos.length ? Math.min(...pos) : null;
        break;
      }
      default:
        out[r] = nums[nums.length - 1];
    }
  }
  return out;
}
function listReducerIds() {
  return Object.values(ReducerID);
}
function isFieldsMap$1(raw) {
  return !!raw && typeof raw === "object" && !Array.isArray(raw);
}
function findFrameField$1(frame, name) {
  return frame.fields.find((f) => f.name === name) ?? frame.fields.find((f) => getFieldDisplayName(f, frame) === name);
}
function groupByFrame(frame, fieldConfig, legacyMode) {
  const groupByNames = Object.entries(fieldConfig).filter(([, cfg]) => String(cfg?.operation ?? "") === "groupby").map(([n]) => n);
  let aggregateSpecs = Object.entries(fieldConfig).filter(
    ([, cfg]) => String(cfg?.operation ?? "") === "aggregate" && Array.isArray(cfg.aggregations) && (cfg.aggregations?.length ?? 0) > 0
  ).map(([n, cfg]) => ({
    name: n,
    aggregations: (cfg.aggregations ?? []).map(String)
  }));
  if (legacyMode && groupByNames.length) {
    aggregateSpecs = frame.fields.filter((f) => {
      if (f.type !== "number") return false;
      const display = getFieldDisplayName(f, frame);
      return !groupByNames.includes(f.name) && !groupByNames.includes(display);
    }).map((f) => ({ name: f.name, aggregations: ["sum"] }));
  }
  if (!groupByNames.length) return frame;
  const groupByFields = groupByNames.map((n) => findFrameField$1(frame, n)).filter((f) => !!f);
  if (!groupByFields.length) return frame;
  const buckets = /* @__PURE__ */ new Map();
  const len = frame.length || frame.fields[0]?.values.length || 0;
  for (let row = 0; row < len; row++) {
    const keyParts = groupByFields.map((f) => f.values[row]);
    const key = keyParts.map((v) => String(v)).join("");
    let bucket = buckets.get(key);
    if (!bucket) {
      bucket = { keys: keyParts, valuesByField: {} };
      buckets.set(key, bucket);
    }
    for (const field of frame.fields) {
      if (!bucket.valuesByField[field.name]) {
        bucket.valuesByField[field.name] = [];
      }
      bucket.valuesByField[field.name].push(field.values[row]);
    }
  }
  const groupKeys = [...buckets.keys()];
  const outFields = [];
  for (const [gi, src] of groupByFields.entries()) {
    outFields.push({
      name: src.name,
      type: src.type,
      config: { ...src.config ?? {} },
      values: groupKeys.map((k) => buckets.get(k).keys[gi])
    });
  }
  for (const spec of aggregateSpecs) {
    const src = findFrameField$1(frame, spec.name);
    if (!src) continue;
    for (const agg of spec.aggregations) {
      const values = groupKeys.map((k) => {
        const vals = buckets.get(k).valuesByField[src.name] ?? [];
        const fakeField = {
          name: src.name,
          type: src.type,
          config: src.config ?? {},
          values: vals
        };
        const calcs = reduceField$1(fakeField, [agg]);
        const v = calcs[agg];
        if (typeof v === "number") return v;
        if (v == null || typeof v === "boolean") return null;
        if (Array.isArray(v)) return v.length;
        return Number(v);
      });
      const outName = legacyMode && spec.aggregations.length === 1 && agg === "sum" ? spec.name : `${spec.name} (${agg})`;
      outFields.push({
        name: outName,
        type: "number",
        config: {},
        values
      });
    }
  }
  if (outFields.length <= groupByFields.length && !aggregateSpecs.length) ;
  if (!outFields.length) return frame;
  return createDataFrame({
    refId: frame.refId,
    name: frame.name,
    fields: outFields
  });
}
registerTransformer("groupBy", (frames, options = {}) => {
  const raw = options.fields;
  const by = options.by;
  let fieldConfig = {};
  let legacyMode = false;
  if (isFieldsMap$1(raw)) {
    fieldConfig = raw;
  } else {
    const legacyKeys = Array.isArray(raw) ? raw.map(String).filter(Boolean) : by ? [String(by)] : [];
    if (!legacyKeys.length) return frames;
    legacyMode = true;
    for (const k of legacyKeys) {
      fieldConfig[k] = { operation: "groupby" };
    }
  }
  if (!Object.keys(fieldConfig).length) return frames;
  return frames.map((frame) => groupByFrame(frame, fieldConfig, legacyMode));
});
registerTransformer("labelsToFields", (frames, options = {}) => {
  const mode2 = String(options.mode ?? "columns");
  const keepRaw = options.keepLabels;
  const keepSet = Array.isArray(keepRaw) && keepRaw.length ? new Set(keepRaw.map(String)) : void 0;
  const valueLabel = options.valueLabel != null && String(options.valueLabel) !== "" ? String(options.valueLabel) : void 0;
  if (mode2 === "rows") {
    const result = [];
    for (const frame of frames) {
      for (const field of frame.fields) {
        if (!field.labels || !Object.keys(field.labels).length) continue;
        const keys = [];
        const vals = [];
        if (keepSet) {
          for (const key of keepSet) {
            keys.push(key);
            vals.push(String(field.labels[key] ?? ""));
          }
        } else {
          for (const [key, val] of Object.entries(field.labels)) {
            keys.push(key);
            vals.push(String(val ?? ""));
          }
        }
        if (!vals.length) continue;
        result.push(
          createDataFrame({
            refId: frame.refId,
            // Grafana convertLabelsToRows: frame.name = getFieldDisplayName(field, frame, data)
            name: getFieldDisplayName(field, frame, frames),
            fields: [
              { name: "label", type: "string", values: keys, config: {} },
              { name: "value", type: "string", values: vals, config: {} }
            ]
          })
        );
      }
    }
    return result.length ? result : frames;
  }
  return frames.map((frame) => {
    const newFields = [];
    const uniqueLabels = {};
    for (const field of frame.fields) {
      if (!field.labels) {
        newFields.push(field);
        continue;
      }
      const sansLabels = {
        ...field,
        labels: void 0,
        config: {
          ...field.config ?? {},
          displayName: void 0,
          displayNameFromDS: void 0
        }
      };
      for (const labelName of Object.keys(field.labels)) {
        if (keepSet && !keepSet.has(labelName)) continue;
        if (valueLabel && valueLabel === labelName) {
          sansLabels.name = String(field.labels[labelName] ?? sansLabels.name);
          continue;
        }
        const set = uniqueLabels[labelName] ?? (uniqueLabels[labelName] = /* @__PURE__ */ new Set());
        set.add(String(field.labels[labelName] ?? ""));
      }
      newFields.push(sansLabels);
    }
    for (const name of Object.keys(uniqueLabels)) {
      for (const value of uniqueLabels[name]) {
        newFields.push({
          name,
          type: "string",
          values: Array.from({ length: frame.length || 0 }, () => value),
          config: {}
        });
      }
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: newFields
    });
  });
});
registerTransformer("merge", (frames) => {
  if (frames.length <= 1) return frames;
  const base = frames[0];
  const fields = base.fields.map((f) => ({ ...f, values: [...f.values] }));
  for (const frame of frames.slice(1)) {
    for (const f of frame.fields) {
      const target = fields.find((x) => x.name === f.name && x.type === f.type);
      if (target) target.values.push(...f.values);
      else fields.push({ ...f, values: [...f.values] });
    }
  }
  return [createDataFrame({ refId: base.refId, name: base.name, fields })];
});
registerTransformer("concatenate", (frames, options = {}) => {
  if (!frames.length) return frames;
  if (frames.length < 2) return frames;
  const mode2 = String(options.frameNameMode ?? "field");
  const frameNameLabel = String(options.frameNameLabel ?? "frame");
  const outName = options.frameName != null ? String(options.frameName) : void 0;
  let maxLength = frames[0]?.length ?? frames[0]?.fields[0]?.values.length ?? 0;
  let sameLength = true;
  const fields = [];
  for (const frame of frames) {
    const len = frame.length ?? frame.fields[0]?.values.length ?? 0;
    if (len !== maxLength) {
      sameLength = false;
      maxLength = Math.max(maxLength, len);
    }
    const frameLabel = String(frame.name ?? frame.refId ?? "");
    for (const f of frame.fields) {
      const copy = {
        ...f,
        values: [...f.values],
        config: { ...f.config ?? {} },
        labels: f.labels ? { ...f.labels } : void 0
      };
      if (frameLabel) {
        if (mode2 === "drop") ;
        else if (mode2 === "label") {
          copy.labels = {
            ...copy.labels ?? {},
            [frameNameLabel]: frameLabel
          };
        } else {
          if (!copy.name || copy.name === "Value") {
            copy.name = frameLabel;
          } else {
            copy.name = `${frameLabel} · ${f.name}`;
          }
        }
      }
      fields.push(copy);
    }
  }
  if (!sameLength) {
    for (const f of fields) {
      if (f.values.length < maxLength) {
        const pad = new Array(maxLength - f.values.length).fill(void 0);
        f.values = [...f.values, ...pad];
      }
    }
  }
  return [
    {
      name: outName,
      fields,
      length: maxLength,
      refId: frames[0]?.refId
    }
  ];
});
function resolveBinaryValues(frame, allFrames, side, numericFields) {
  const len = frame.length || numericFields[0]?.values.length || 0;
  if (side == null) return null;
  if (typeof side === "number") {
    return Array.from({ length: len }, () => side);
  }
  if (typeof side === "string") {
    const byName = numericFields.find((f) => f.name === side) ?? frame.fields.find(
      (f) => f.name === side || getFieldDisplayName(f, frame, allFrames) === side
    );
    if (byName) {
      return byName.values.map((v) => byName.type === "boolean" ? v ? 1 : 0 : Number(v ?? 0));
    }
    const n = Number(side);
    if (Number.isFinite(n)) return Array.from({ length: len }, () => n);
    return null;
  }
  if (typeof side === "object") {
    const matcher = side.matcher;
    if (matcher?.id === "byName") {
      const name = String(matcher.options ?? "");
      const field = frame.fields.find(
        (f) => f.name === name || getFieldDisplayName(f, frame, allFrames) === name
      ) ?? numericFields.find((f) => f.name === name);
      if (field) {
        return field.values.map((v) => field.type === "boolean" ? v ? 1 : 0 : Number(v ?? 0));
      }
    }
    if (matcher?.id === "byType") {
      const t2 = String(matcher.options ?? "number");
      const field = frame.fields.find((f) => String(f.type) === t2);
      if (field) {
        return field.values.map((v) => field.type === "boolean" ? v ? 1 : 0 : Number(v ?? 0));
      }
    }
    const fixed = side.fixed;
    if (fixed != null && fixed !== "") {
      const n = Number(fixed);
      if (Number.isFinite(n)) return Array.from({ length: len }, () => n);
    }
    if (matcher?.options != null) {
      const n = Number(matcher.options);
      if (Number.isFinite(n) && matcher.id !== "byName" && matcher.id !== "byType") {
        return Array.from({ length: len }, () => n);
      }
    }
  }
  return null;
}
registerTransformer("calculateField", (frames, options = {}) => {
  const alias = String(options.alias ?? options.outputName ?? "Total");
  let mode2 = String(options.mode ?? "reduceRow");
  if (mode2 === "cumulativeFunctions") mode2 = "cumulative";
  if (mode2 === "windowFunctions") mode2 = "window";
  return frames.map((frame) => {
    const nums = frame.fields.filter((f) => f.type === "number");
    if (!nums.length && mode2 !== "index") return frame;
    const len = frame.length || nums[0]?.values.length || 0;
    const values = [];
    if (mode2 === "index") {
      const asPercentile = options.index?.asPercentile === true || options.asPercentile === true;
      for (let i = 0; i < len; i++) {
        values.push(asPercentile && len > 0 ? i / len : i);
      }
    } else if (mode2 === "binary") {
      const binary = options.binary ?? {};
      const op = String(binary.operator ?? "+");
      const applyOp = (a, b) => op === "-" ? a - b : op === "*" ? a * b : op === "/" ? b ? a / b : 0 : op === "**" || op === "^" ? a ** b : a + b;
      const leftSide = binary.left;
      const isByType = leftSide && typeof leftSide === "object" && leftSide.matcher?.id === "byType";
      if (isByType) {
        const t2 = String(leftSide.matcher?.options ?? "number");
        const rightVals2 = resolveBinaryValues(frame, frames, binary.right, nums) ?? Array.from({ length: len }, () => 0);
        const rightLabel = (() => {
          const r = binary.right;
          if (r && typeof r === "object") {
            return String(r.matcher?.options ?? r.fixed ?? "");
          }
          return String(r ?? "");
        })();
        const extras = [];
        for (const field of frame.fields.filter((f) => String(f.type) === t2)) {
          const outVals = [];
          for (let i = 0; i < len; i++) {
            const a = field.type === "boolean" ? field.values[i] ? 1 : 0 : Number(field.values[i] ?? 0);
            outVals.push(applyOp(a, Number(rightVals2[i] ?? 0)));
          }
          extras.push({
            name: `${field.name} ${op} ${rightLabel}`.trim(),
            type: "number",
            values: outVals,
            config: {}
          });
        }
        if (extras.length) {
          let outFields = [...frame.fields, ...extras];
          if (options.replaceFields === true) {
            const time = frame.fields.filter((f) => f.type === "time");
            outFields = [...time, ...extras];
          }
          return createDataFrame({
            refId: frame.refId,
            name: frame.name,
            fields: outFields
          });
        }
      }
      const leftVals = resolveBinaryValues(frame, frames, binary.left, nums) ?? nums[0]?.values.map((v) => Number(v ?? 0)) ?? [];
      const rightVals = resolveBinaryValues(frame, frames, binary.right, nums) ?? Array.from({ length: len }, () => 0);
      for (let i = 0; i < len; i++) {
        values.push(applyOp(Number(leftVals[i] ?? 0), Number(rightVals[i] ?? 0)));
      }
    } else if (mode2 === "unary") {
      const unary = options.unary ?? {};
      const field = (unary.fieldName ? nums.find(
        (f) => f.name === unary.fieldName || getFieldDisplayName(f, frame, frames) === unary.fieldName
      ) : void 0) ?? nums[0];
      const op = String(unary.operator ?? "abs");
      for (let i = 0; i < len; i++) {
        const a = Number(field.values[i] ?? 0);
        if (op === "abs") values.push(Math.abs(a));
        else if (op === "log" || op === "ln") values.push(a > 0 ? Math.log(a) : Number.NaN);
        else if (op === "log2") values.push(a > 0 ? Math.log2(a) : Number.NaN);
        else if (op === "log10") values.push(a > 0 ? Math.log10(a) : Number.NaN);
        else if (op === "sqrt") values.push(a >= 0 ? Math.sqrt(a) : Number.NaN);
        else if (op === "square") values.push(a * a);
        else if (op === "ceil") values.push(Math.ceil(a));
        else if (op === "floor") values.push(Math.floor(a));
        else values.push(a);
      }
    } else if (mode2 === "cumulative") {
      const cum = options.cumulative ?? {};
      const fieldKey2 = cum.fieldName ?? cum.field ?? options.fieldName ?? "";
      const field = (fieldKey2 ? nums.find(
        (f) => f.name === fieldKey2 || getFieldDisplayName(f, frame, frames) === fieldKey2
      ) : void 0) ?? nums[0];
      const reducer = String(cum.reducer ?? "sum");
      let acc = 0;
      let count = 0;
      for (let i = 0; i < len; i++) {
        const n = Number(field.values[i]);
        if (Number.isFinite(n)) {
          acc += n;
          count += 1;
        }
        if (reducer === "mean") values.push(count ? acc / count : Number.NaN);
        else if (reducer === "max") {
          const slice = field.values.slice(0, i + 1).map(Number).filter((x) => Number.isFinite(x));
          values.push(slice.length ? Math.max(...slice) : Number.NaN);
        } else if (reducer === "min") {
          const slice = field.values.slice(0, i + 1).map(Number).filter((x) => Number.isFinite(x));
          values.push(slice.length ? Math.min(...slice) : Number.NaN);
        } else {
          values.push(acc);
        }
      }
    } else if (mode2 === "window") {
      const winOpts = options.window ?? {};
      const fieldKey2 = winOpts.fieldName ?? winOpts.field ?? options.fieldName ?? "";
      const field = (fieldKey2 ? nums.find(
        (f) => f.name === fieldKey2 || getFieldDisplayName(f, frame, frames) === fieldKey2
      ) : void 0) ?? nums[0];
      const sizeMode = String(winOpts.windowSizeMode ?? "fixed");
      const rawSize = Number(
        winOpts.windowSize ?? options.windowSize ?? (sizeMode === "percentage" ? 0.1 : 3)
      );
      const win = Math.max(
        1,
        Math.ceil(sizeMode === "percentage" || sizeMode === "Percentage" ? rawSize * len : rawSize)
      );
      const alignment = String(winOpts.windowAlignment ?? "trailing");
      const reducer = String(winOpts.reducer ?? "mean");
      const reduceSlice = (slice) => {
        if (!slice.length) return Number.NaN;
        if (reducer === "sum") return slice.reduce((a, b) => a + b, 0);
        if (reducer === "min") return Math.min(...slice);
        if (reducer === "max") return Math.max(...slice);
        return slice.reduce((a, b) => a + b, 0) / slice.length;
      };
      for (let i = 0; i < len; i++) {
        let from;
        let to;
        if (alignment === "centered" || alignment === "Centered") {
          const leading = Math.ceil(win / 2) - 1;
          const trailing = Math.floor(win / 2);
          from = Math.max(0, i - trailing);
          to = Math.min(len, i + leading + 1);
        } else {
          from = Math.max(0, i - win + 1);
          to = i + 1;
        }
        const slice = field.values.slice(from, to).map(Number).filter((n) => Number.isFinite(n));
        values.push(reduceSlice(slice));
      }
    } else {
      const reduceOpts = options.reduce ?? {};
      const reducer = String(reduceOpts.reducer ?? "sum");
      const include = Array.isArray(reduceOpts.include) ? reduceOpts.include.map(String) : [];
      const nullMode = String(
        reduceOpts.nullValueMode ?? options.nullValueMode ?? "nullAsZero"
      ).toLowerCase();
      const ignoreNulls = nullMode === "ignore" || nullMode === "nullvaluemode.ignore";
      const nullAsZero = nullMode === "aszero" || nullMode === "nullaszero" || nullMode === "nullvaluemode.aszero" || !ignoreNulls && nullMode !== "preserve";
      const cols = include.length ? frame.fields.filter(
        (f) => include.includes(f.name) || include.includes(String(f.config?.displayName ?? ""))
      ) : nums;
      for (let i = 0; i < len; i++) {
        const row = [];
        for (const f of cols) {
          const raw = f.values[i];
          if (raw == null || raw === "") {
            if (ignoreNulls) continue;
            if (nullAsZero) row.push(0);
            continue;
          }
          const n = f.type === "boolean" ? raw ? 1 : 0 : Number(raw);
          if (!Number.isFinite(n)) {
            if (ignoreNulls) continue;
            if (nullAsZero) row.push(0);
            continue;
          }
          row.push(n);
        }
        let v = 0;
        if (reducer === "mean") v = row.length ? row.reduce((a, b) => a + b, 0) / row.length : 0;
        else if (reducer === "min") v = row.length ? Math.min(...row) : 0;
        else if (reducer === "max") v = row.length ? Math.max(...row) : 0;
        else if (reducer === "count") v = row.length;
        else v = row.reduce((a, b) => a + b, 0);
        values.push(v);
      }
    }
    const indexAsPercentile = mode2 === "index" && (options.index?.asPercentile === true || options.asPercentile === true);
    const calculated = {
      name: alias,
      type: "number",
      values,
      config: indexAsPercentile ? { unit: "percentunit" } : {}
    };
    if (options.replaceFields === true) {
      const timeFields = frame.fields.filter((f) => f.type === "time");
      return createDataFrame({
        refId: frame.refId,
        name: frame.name,
        fields: [...timeFields, calculated]
      });
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: [...frame.fields, calculated]
    });
  });
});
function findFrameField(frame, name, allFrames) {
  return findField$1(frame, name, allFrames);
}
function formatTimeToken(date, format, utc) {
  const y = utc ? date.getUTCFullYear() : date.getFullYear();
  const M = (utc ? date.getUTCMonth() : date.getMonth()) + 1;
  const d = utc ? date.getUTCDate() : date.getDate();
  const H2 = utc ? date.getUTCHours() : date.getHours();
  const m = utc ? date.getUTCMinutes() : date.getMinutes();
  const s = utc ? date.getUTCSeconds() : date.getSeconds();
  const pad = (n, w = 2) => String(n).padStart(w, "0");
  const h12 = H2 % 12 || 12;
  const ampm = H2 < 12 ? "am" : "pm";
  return format.replaceAll("YYYY", String(y)).replaceAll("YY", String(y).slice(-2)).replaceAll("MM", pad(M)).replaceAll("M", String(M)).replaceAll("DD", pad(d)).replaceAll("D", String(d)).replaceAll("HH", pad(H2)).replaceAll("H", String(H2)).replaceAll("hh", pad(h12)).replaceAll("h", String(h12)).replaceAll("mm", pad(m)).replaceAll("ss", pad(s)).replaceAll("a", ampm).replaceAll("A", ampm.toUpperCase());
}
const GAZETTEER_COUNTRIES = {
  US: { name: "United States", lat: 37.09, lon: -95.71 },
  NL: { name: "Netherlands", lat: 52.13, lon: 5.29 },
  DE: { name: "Germany", lat: 51.16, lon: 10.45 },
  JP: { name: "Japan", lat: 36.2, lon: 138.25 },
  BR: { name: "Brazil", lat: -14.23, lon: -51.92 },
  CN: { name: "China", lat: 35.86, lon: 104.19 },
  GB: { name: "United Kingdom", lat: 55.37, lon: -3.43 },
  FR: { name: "France", lat: 46.22, lon: 2.21 }
};
const GRAFANA_FORMATS = {
  "Upper Case": "upper",
  "Lower Case": "lower",
  "Sentence Case": "sentence",
  "Title Case": "title",
  "Pascal Case": "pascal",
  "Camel Case": "camel",
  "Snake Case": "snake",
  "Kebab Case": "kebab",
  "Trim": "trim",
  "Substring": "substring"
};
function normalizeOp$1(raw) {
  const s = String(raw ?? "").trim();
  if (!s) return "upper";
  if (s in GRAFANA_FORMATS) {
    return GRAFANA_FORMATS[s];
  }
  const lower = s.toLowerCase().replaceAll(/[\s_-]+/g, "");
  switch (lower) {
    case "upper":
    case "uppercase":
    case "touppercase":
      return "upper";
    case "lower":
    case "lowercase":
    case "tolowercase":
      return "lower";
    case "sentence":
    case "sentencecase":
      return "sentence";
    case "title":
    case "titlecase":
      return "title";
    case "pascal":
    case "pascalcase":
      return "pascal";
    case "camel":
    case "camelcase":
      return "camel";
    case "snake":
    case "snakecase":
      return "snake";
    case "kebab":
    case "kebabcase":
      return "kebab";
    case "trim":
      return "trim";
    case "substring":
    case "substr":
      return "substring";
    case "replace":
      return "replace";
    default:
      return s;
  }
}
function splitToCapitalWords(input) {
  return input.split(" ").map((w) => w ? w.charAt(0).toUpperCase() + w.slice(1).toLowerCase() : w);
}
function resolveOpAndRange(options) {
  const substringOpt = options.substring;
  const rangeObj = substringOpt && typeof substringOpt === "object" && !Array.isArray(substringOpt) ? substringOpt : void 0;
  const substringAsOp = typeof substringOpt === "string" && substringOpt.trim() ? substringOpt : void 0;
  const rawOp = options.outputFormat ?? options.algorithm ?? options.operation ?? substringAsOp ?? (rangeObj ? "substring" : "upper");
  const start = Number(options.substringStart ?? rangeObj?.start ?? options.start ?? 0);
  const endRaw = options.substringEnd ?? rangeObj?.end ?? options.end;
  const end = endRaw == null || endRaw === "" ? void 0 : Number(endRaw);
  return {
    op: normalizeOp$1(String(rawOp)),
    start: Number.isFinite(start) ? start : 0,
    end: end != null && Number.isFinite(end) ? end : void 0
  };
}
function formatValue$1(s, op, start, end, options) {
  switch (op) {
    case "upper":
      return s.toUpperCase();
    case "lower":
      return s.toLowerCase();
    case "sentence":
      return s.charAt(0).toUpperCase() + s.slice(1);
    case "title":
      return splitToCapitalWords(s).join(" ");
    case "pascal":
      return splitToCapitalWords(s).join("");
    case "camel": {
      const p = splitToCapitalWords(s).join("");
      return p.charAt(0).toLowerCase() + p.slice(1);
    }
    case "snake":
      return s.toLowerCase().split(" ").join("_");
    case "kebab":
      return s.toLowerCase().split(" ").join("-");
    case "trim":
      return s.trim();
    case "substring":
      return end == null ? s.slice(start) : s.slice(start, end);
    case "replace":
      try {
        return s.replace(
          new RegExp(String(options.pattern ?? ""), String(options.flags ?? "g")),
          String(options.replacement ?? "")
        );
      } catch {
        return s;
      }
    default:
      return s;
  }
}
registerTransformer("formatString", (frames, options = {}) => {
  const opts = options;
  const substringOpt = opts.substring;
  const rangeObj = substringOpt && typeof substringOpt === "object" && !Array.isArray(substringOpt) ? substringOpt : void 0;
  const fieldName2 = String(
    opts.stringField ?? opts.fieldName ?? rangeObj?.fieldName ?? opts.field ?? ""
  );
  if (!fieldName2) return frames;
  const { op, start, end } = resolveOpAndRange(opts);
  const alias = opts.alias != null ? String(opts.alias) : "";
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => {
        if (!fieldMatchesName(f, fieldName2, frame, frames)) return f;
        const values = f.values.map((v) => formatValue$1(String(v ?? ""), op, start, end, opts));
        return {
          ...f,
          name: alias || f.name,
          type: "string",
          values
        };
      })
    })
  );
});
function isTimeSeriesFrame(frame) {
  if (!frame.fields?.length) return false;
  const timeFields = frame.fields.filter((f) => f.type === "time");
  const valueFields = frame.fields.filter((f) => f.type !== "time" && f.type !== "string");
  return timeFields.length >= 1 && valueFields.length >= 1;
}
registerTransformer("seriesToRows", (frames) => {
  const data = (frames || []).filter((f) => (f.length ?? f.fields[0]?.values?.length ?? 0) > 0);
  if (!data.length) return frames;
  if (!data.every(isTimeSeriesFrame)) {
    return frames;
  }
  const times = [];
  const metrics = [];
  const values = [];
  let valueType = "number";
  let valueConfig = {};
  let timeConfig = {};
  for (const [frameIndex, frame] of data.entries()) {
    const timeField2 = frame.fields.find((f) => f.type === "time");
    if (!timeField2) continue;
    const valueField2 = frame.fields.find((f) => f.type !== "time") ?? frame.fields.find((f) => f.type === "number");
    if (!valueField2) continue;
    if (frameIndex === 0) {
      valueType = valueField2.type;
      valueConfig = { ...valueField2.config || {} };
      timeConfig = { ...timeField2.config || {} };
    }
    const metricName = getFrameDisplayName(frame, frameIndex);
    const n = frame.length ?? timeField2.values.length;
    for (let i = 0; i < n; i++) {
      times.push(Number(timeField2.values[i]));
      metrics.push(metricName);
      values.push(valueField2.values[i]);
    }
  }
  const idxs = times.map((_, i) => i);
  idxs.sort((a, b) => {
    const d = times[b] - times[a];
    return d !== 0 ? d : a - b;
  });
  return [
    createDataFrame({
      refId: `seriesToRows-${data.map((f) => f.refId ?? "").join("-")}`,
      name: "seriesToRows",
      fields: [
        {
          name: "Time",
          type: "time",
          config: timeConfig,
          values: idxs.map((i) => times[i])
        },
        {
          name: "Metric",
          type: "string",
          config: {},
          values: idxs.map((i) => metrics[i])
        },
        {
          name: "Value",
          type: valueType,
          config: valueConfig,
          values: idxs.map((i) => values[i])
        }
      ]
    })
  ];
});
registerTransformer("filterByValue", (frames, options = {}) => {
  const type = String(options.type ?? "include");
  const match = String(options.match ?? "all");
  const filters = options.filters ?? [];
  if (!filters.length) return frames;
  const matchOne = (n, op, opts) => {
    if (op === "isNull" || op === "ValueIsNull") return n == null || n === "";
    if (op === "isNotNull" || op === "ValueIsNotNull") return n != null && n !== "";
    if (op === "regex" || op === "ValueMatchesRegex") {
      try {
        return new RegExp(String(opts.pattern ?? opts.value ?? "")).test(String(n ?? ""));
      } catch {
        return false;
      }
    }
    const num2 = Number(n);
    const thr = Number(opts.value ?? 0);
    if (op.includes("greaterOrEqual") || op === "gte") return num2 >= thr;
    if (op.includes("lowerOrEqual") || op.includes("lessOrEqual") || op === "lte")
      return num2 <= thr;
    if (op.includes("greater") || op === "gt") return num2 > thr;
    if (op.includes("lower") || op.includes("less") || op === "lt") return num2 < thr;
    if (op.includes("equal") || op === "eq") return num2 === thr || String(n) === String(opts.value);
    if (op === "between" || op.includes("Between")) {
      const a = Number(opts.valueFrom ?? opts.value ?? 0);
      const b = Number(opts.valueTo ?? 0);
      return num2 >= Math.min(a, b) && num2 <= Math.max(a, b);
    }
    return true;
  };
  return frames.map((frame) => {
    const len = frame.length || frame.fields[0]?.values.length || 0;
    const keep = [];
    for (let i = 0; i < len; i++) {
      const results = filters.map((filter2) => {
        const field = findFrameField(frame, filter2.fieldName, frames);
        if (!field) return true;
        const op = String(filter2.config?.id ?? "greater");
        return matchOne(field.values[i], op, filter2.config?.options ?? {});
      });
      const rowOk = match === "any" ? results.some(Boolean) : results.every(Boolean);
      keep.push(type === "exclude" ? !rowOk : rowOk);
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => ({
        ...f,
        values: f.values.filter((_, i) => keep[i])
      }))
    });
  });
});
registerTransformer("renameByRegex", (frames, options = {}) => {
  const regexRaw = String(options.regex ?? "");
  const renamePattern = String(options.renamePattern ?? "$1");
  if (!regexRaw) return frames;
  const re = stringToJsRegexSafe(regexRaw) ?? (() => {
    try {
      return new RegExp(regexRaw);
    } catch {
      return null;
    }
  })();
  if (!re) return frames;
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      meta: frame.meta,
      fields: frame.fields.map((f) => {
        const displayName = getFieldDisplayName(f, frame, frames);
        if (!re.test(displayName)) {
          return f;
        }
        re.lastIndex = 0;
        const newDisplayName = displayName.replace(re, renamePattern);
        re.lastIndex = 0;
        return {
          ...f,
          // Grafana keeps field.name; display goes through config/state.
          // Also mirror onto name when it equaled the old display name so
          // name-only consumers (organize/filterByName) still see the rename —
          // matches common dashboard expectations while displayName is source of truth.
          name: f.name === displayName || !f.config?.displayName ? newDisplayName : f.name,
          config: {
            ...f.config || {},
            displayName: newDisplayName
          },
          state: {
            ...f.state || {},
            displayName: newDisplayName
          }
        };
      })
    })
  );
});
const ISO8601 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3,})?(?:Z|[-+]\d{2}:?\d{2})$/;
function parseWithDateFormat(value, dateFormat) {
  if (value == null || value === "") return null;
  const fmt = dateFormat?.trim();
  if (typeof value === "number") {
    if (!Number.isFinite(value)) return null;
    if (fmt === "X") return value * 1e3;
    if (fmt === "x") return value;
    return value;
  }
  const raw = String(value).trim();
  if (!raw) return null;
  if (fmt === "X") {
    const n = Number(raw);
    return Number.isFinite(n) ? n * 1e3 : null;
  }
  if (fmt === "x") {
    const n = Number(raw);
    return Number.isFinite(n) ? n : null;
  }
  if (!fmt) {
    if (ISO8601.test(raw)) {
      const t3 = Date.parse(raw);
      return Number.isFinite(t3) ? t3 : null;
    }
    const t22 = Date.parse(raw);
    if (Number.isFinite(t22)) return t22;
    const n = Number(raw);
    return Number.isFinite(n) ? n : null;
  }
  const tokenRe = /(YYYY|YY|MM|DD|HH|hh|mm|ss|[AaMDHh])/g;
  const parts = [];
  let last = 0;
  let m;
  while ((m = tokenRe.exec(fmt)) !== null) {
    if (m.index > last) {
      parts.push({ kind: "lit", v: fmt.slice(last, m.index) });
    }
    parts.push({ kind: "tok", v: m[1] });
    last = m.index + m[1].length;
  }
  if (last < fmt.length) parts.push({ kind: "lit", v: fmt.slice(last) });
  let pos = 0;
  const got = {};
  for (const part of parts) {
    if (part.kind === "lit") {
      if (raw.slice(pos, pos + part.v.length) !== part.v) {
        pos = -1;
        break;
      }
      pos += part.v.length;
      continue;
    }
    const tok = part.v;
    let take = tok.length;
    if (tok === "YYYY") take = 4;
    else if (tok === "YY") take = 2;
    else if (tok === "A" || tok === "a") {
      const ampm = raw.slice(pos, pos + 2).toLowerCase();
      if (ampm !== "am" && ampm !== "pm") {
        pos = -1;
        break;
      }
      got.ampm = ampm === "pm" ? 1 : 0;
      pos += 2;
      continue;
    } else if (tok.length === 1) {
      let j = pos;
      while (j < raw.length && /\d/.test(raw[j])) j++;
      take = Math.max(1, j - pos);
    }
    const slice = raw.slice(pos, pos + take);
    if (!/^\d+$/.test(slice)) {
      pos = -1;
      break;
    }
    got[tok] = Number(slice);
    pos += take;
  }
  if (pos >= 0) {
    const year = got.YYYY ?? (got.YY != null ? 2e3 + got.YY : (/* @__PURE__ */ new Date()).getFullYear());
    const month = (got.MM ?? got.M ?? 1) - 1;
    const day = got.DD ?? got.D ?? 1;
    let hour = got.HH ?? got.H ?? got.hh ?? got.h ?? 0;
    const minute = got.mm ?? 0;
    const second = got.ss ?? 0;
    if (got.ampm != null && (got.hh != null || got.h != null)) {
      hour = hour % 12;
      if (got.ampm === 1) hour += 12;
    }
    const d = new Date(year, month, day, hour, minute, second);
    const t22 = d.getTime();
    return Number.isFinite(t22) ? t22 : null;
  }
  if (fmt === "YYYY") {
    const ym = raw.match(/(\d{4})/);
    if (ym) {
      const d = new Date(Number(ym[1]), 0, 1);
      return d.getTime();
    }
  }
  const t2 = Date.parse(raw);
  return Number.isFinite(t2) ? t2 : null;
}
function toNumber(v) {
  if (v == null || v === "") return null;
  if (typeof v === "number") return Number.isFinite(v) ? v : null;
  if (typeof v === "boolean") return v ? 1 : 0;
  const s = String(v).replaceAll(",", "").trim();
  if (!s) return null;
  const n = Number(s);
  return Number.isFinite(n) ? n : null;
}
registerTransformer("convertFieldType", (frames, options = {}) => {
  const conversions = options.conversions ?? [];
  if (!conversions.length && options.targetField) {
    conversions.push({
      targetField: String(options.targetField),
      destinationType: String(options.destinationType ?? "string"),
      dateFormat: options.dateFormat,
      timezone: options.timezone,
      joinWith: options.joinWith
    });
  }
  if (!conversions.length) return frames;
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => {
        const conv = conversions.find(
          (c) => c.targetField === f.name || c.targetField != null && getFieldDisplayName(f, frame, frames) === String(c.targetField)
        );
        if (!conv) return f;
        const type = String(conv.destinationType);
        const dateFormat = conv.dateFormat ? String(conv.dateFormat) : void 0;
        if (type === "number") {
          return {
            ...f,
            type: "number",
            values: f.values.map((v) => toNumber(v))
          };
        }
        if (type === "string") {
          const tz = String(conv.timezone ?? "browser");
          const utc = tz.toLowerCase() === "utc";
          const joinWith = conv.joinWith;
          return {
            ...f,
            type: "string",
            values: f.values.map((v) => {
              if (joinWith && Array.isArray(v)) return v.join(String(joinWith));
              if (f.type === "time" || typeof v === "number" && dateFormat) {
                const d = new Date(Number(v));
                if (!Number.isFinite(d.getTime())) return String(v ?? "");
                if (dateFormat) return formatTimeToken(d, dateFormat, utc);
                return d.toISOString();
              }
              if (v != null && typeof v === "object") {
                try {
                  return JSON.stringify(v);
                } catch {
                  return String(v);
                }
              }
              return String(v ?? "");
            })
          };
        }
        if (type === "time") {
          if (f.type === "time" && typeof f.values.find((x) => x != null) === "number" && dateFormat !== "X") {
            return { ...f, type: "time" };
          }
          if (typeof f.values.find((x) => x != null) === "number" && dateFormat !== "X" && dateFormat !== "x") {
            return { ...f, type: "time" };
          }
          return {
            ...f,
            type: "time",
            values: f.values.map((v) => parseWithDateFormat(v, dateFormat))
          };
        }
        if (type === "boolean") {
          return {
            ...f,
            type: "boolean",
            values: f.values.map((v) => v === true || v === 1 || v === "true" || v === "1")
          };
        }
        if (type === "enum") {
          const texts = conv.enumConfig?.text ?? [];
          if (!texts.length) return { ...f, type: "other" };
          const lookup = new Map(texts.map((t2, i) => [t2, i]));
          return {
            ...f,
            type: "other",
            values: f.values.map((v) => lookup.get(String(v)) ?? null),
            config: {
              ...f.config ?? {},
              type: { enum: { text: texts } }
            }
          };
        }
        if (type === "other") {
          return {
            ...f,
            type: "other",
            values: f.values.map((v) => {
              if (typeof v !== "string") return v;
              try {
                return JSON.parse(v);
              } catch {
                return null;
              }
            })
          };
        }
        return f;
      })
    })
  );
});
function fieldName(frame, field, multi) {
  if (!multi) return field.name;
  return frame.refId ? `${field.name} ${frame.refId}` : field.name;
}
function joinUnique(frames, by, mode2) {
  const keySets = frames.map((frame) => {
    const keyField = findFrameField(frame, by, frames);
    const set = /* @__PURE__ */ new Set();
    if (keyField) for (const v of keyField.values) set.add(String(v));
    return set;
  });
  let keyValues = [];
  if (mode2 === "inner") {
    let inter = keySets[0] ? new Set(keySets[0]) : /* @__PURE__ */ new Set();
    for (const s of keySets.slice(1)) {
      inter = new Set([...inter].filter((k) => s.has(k)));
    }
    keyValues = [...inter];
  } else {
    const index2 = /* @__PURE__ */ new Map();
    for (const frame of frames) {
      const keyField = findFrameField(frame, by, frames);
      if (!keyField) continue;
      for (const v of keyField.values) {
        const k = String(v);
        if (!index2.has(k)) {
          index2.set(k, keyValues.length);
          keyValues.push(k);
        }
      }
    }
  }
  const outFields = [];
  const byType = findFrameField(frames[0], by, frames)?.type ?? "string";
  outFields.push({
    name: by,
    type: byType,
    values: keyValues,
    config: {}
  });
  const multi = frames.length > 1;
  for (const frame of frames) {
    const keyField = findFrameField(frame, by, frames);
    if (!keyField) continue;
    const local = /* @__PURE__ */ new Map();
    keyField.values.forEach((v, i) => {
      const k = String(v);
      if (!local.has(k)) local.set(k, i);
    });
    for (const field of frame.fields.filter((f) => f !== keyField)) {
      outFields.push({
        name: fieldName(frame, field, multi),
        type: field.type,
        values: keyValues.map((k) => {
          const i = local.get(k);
          return i == null ? null : field.values[i];
        }),
        config: field.config ?? {}
      });
    }
  }
  return createDataFrame({
    name: "joined",
    refId: frames[0]?.refId,
    fields: outFields
  });
}
function joinOuterTabular(frames, by) {
  if (!frames.length) {
    return createDataFrame({ name: "joined", fields: [] });
  }
  const tables = frames.map((frame) => {
    const keyField = findFrameField(frame, by, frames);
    return {
      keys: keyField ? [...keyField.values] : [],
      cols: frame.fields.filter((f) => f !== keyField).map((field) => ({ field, frame }))
    };
  });
  let plan = tables[0].keys.map((key, i) => ({
    key,
    src: tables.map((_, ti) => ti === 0 ? i : -1)
  }));
  for (let ti = 1; ti < tables.length; ti++) {
    const right = tables[ti];
    const index2 = /* @__PURE__ */ new Map();
    right.keys.forEach((v, i) => {
      const k = String(v);
      const list = index2.get(k) ?? [];
      list.push(i);
      index2.set(k, list);
    });
    const next = [];
    const matchedRight = /* @__PURE__ */ new Set();
    for (const row of plan) {
      if (row.key == null || row.key === "") {
        next.push(row);
        continue;
      }
      const ridxs = index2.get(String(row.key));
      if (ridxs?.length) {
        for (const ri of ridxs) {
          matchedRight.add(ri);
          const src = [...row.src];
          src[ti] = ri;
          next.push({ key: row.key, src });
        }
      } else {
        next.push(row);
      }
    }
    right.keys.forEach((key, ri) => {
      if (matchedRight.has(ri)) return;
      const src = tables.map(() => -1);
      src[ti] = ri;
      next.push({ key, src });
    });
    plan = next;
  }
  const multi = frames.length > 1;
  const byType = findFrameField(frames[0], by, frames)?.type ?? "string";
  const outFields = [
    {
      name: by,
      type: byType,
      values: plan.map((p) => p.key),
      config: {}
    }
  ];
  tables.forEach((table, ti) => {
    for (const { field, frame } of table.cols) {
      outFields.push({
        name: fieldName(frame, field, multi),
        type: field.type,
        values: plan.map((p) => {
          const ri = p.src[ti];
          return ri < 0 ? null : field.values[ri];
        }),
        config: field.config ?? {}
      });
    }
  });
  return createDataFrame({
    name: "joined",
    refId: frames[0]?.refId,
    fields: outFields
  });
}
registerTransformer("joinByField", (frames, options = {}) => {
  const by = String(options.byField ?? options.by ?? "Time");
  const mode2 = String(options.mode ?? "outer");
  if (frames.length <= 1) return frames;
  if (mode2 === "outerTabular") {
    return [joinOuterTabular(frames, by)];
  }
  if (mode2 === "inner") {
    return [joinUnique(frames, by, "inner")];
  }
  return [joinUnique(frames, by, "outer")];
});
var SpecialValue = /* @__PURE__ */ ((SpecialValue2) => {
  SpecialValue2["True"] = "true";
  SpecialValue2["False"] = "false";
  SpecialValue2["Null"] = "null";
  SpecialValue2["Empty"] = "empty";
  SpecialValue2["Zero"] = "zero";
  return SpecialValue2;
})(SpecialValue || {});
function getSpecialValue(specialValue) {
  switch (String(
    specialValue ?? "empty"
    /* Empty */
  )) {
    case "false":
    case "False":
      return false;
    case "true":
    case "True":
      return true;
    case "null":
    case "Null":
      return null;
    case "zero":
    case "Zero":
      return 0;
    case "empty":
    case "Empty":
    default:
      return "";
  }
}
registerTransformer("groupingToMatrix", (frames, options = {}) => {
  const columnField = String(options.columnField ?? options.column ?? "");
  const rowField = String(options.rowField ?? options.row ?? "");
  const valueField2 = String(options.valueField ?? options.cellValue ?? options.value ?? "");
  const emptyValue = getSpecialValue(
    options.emptyValue ?? SpecialValue.Empty
  );
  return frames.map((frame) => {
    const col2 = findFrameField(frame, columnField, frames) ?? frame.fields.find((f) => f.type === "string");
    const row = findFrameField(frame, rowField, frames) ?? frame.fields.filter((f) => f.type === "string")[1];
    const val = findFrameField(frame, valueField2, frames) ?? frame.fields.find((f) => f.type === "number");
    if (!col2 || !row || !val) return frame;
    const cols = [...new Set(col2.values.map(String))];
    const rows = [...new Set(row.values.map(String))];
    const map = /* @__PURE__ */ new Map();
    for (let i = 0; i < col2.values.length; i++) {
      map.set(`${row.values[i]}\0${col2.values[i]}`, val.values[i]);
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name || "matrix",
      fields: [
        { name: row.name, type: "string", values: rows },
        ...cols.map((c) => ({
          name: c,
          type: val.type === "number" ? "number" : val.type,
          values: rows.map((r) => {
            if (!map.has(`${r}\0${c}`)) return emptyValue;
            const v = map.get(`${r}\0${c}`);
            return v == null ? emptyValue : val.type === "number" ? Number(v) : v;
          })
        }))
      ]
    });
  });
});
function finiteNums(values) {
  const out = [];
  for (const v of values) {
    const n = Number(v);
    if (Number.isFinite(n)) out.push(n);
  }
  return out;
}
function resolveSizeAndStart(allValues, cfg) {
  const vals = allValues.filter((n) => Number.isFinite(n));
  if (!vals.length) return null;
  const min = Math.min(...vals);
  const max = Math.max(...vals);
  const bucketCount2 = cfg.bucketCount;
  const size = cfg.bucketSizeOpt > 0 ? cfg.bucketSizeOpt : (max - min) / bucketCount2 || 1;
  const start = size > 0 ? Math.floor((min - cfg.offset) / size) * size + cfg.offset : min + cfg.offset;
  return { size, start, bucketCount: bucketCount2 };
}
function countIntoBuckets(values, start, size, bucketCount2) {
  const counts = new Array(bucketCount2).fill(0);
  for (const v of values) {
    if (!Number.isFinite(v)) continue;
    let idx = Math.floor((v - start) / size);
    if (idx < 0) idx = 0;
    if (idx >= bucketCount2) idx = bucketCount2 - 1;
    counts[idx]++;
  }
  return counts;
}
function bucketEdges(start, size, bucketCount2) {
  const bucketMin = [];
  const bucketMax = [];
  for (let i = 0; i < bucketCount2; i++) {
    bucketMin.push(start + i * size);
    bucketMax.push(start + (i + 1) * size);
  }
  return { bucketMin, bucketMax };
}
function collectNumericSeries(frames) {
  const out = [];
  for (const frame of frames) {
    for (const field of frame.fields) {
      if (field.type !== "number") continue;
      if (field.name === "BucketMin" || field.name === "BucketMax") continue;
      if (field.name === "xMin" || field.name === "xMax") continue;
      const values = finiteNums(field.values);
      if (!values.length) continue;
      out.push({
        name: field.name,
        displayName: getFieldDisplayName(field, frame, frames),
        values,
        config: { ...field.config },
        frame,
        field
      });
    }
  }
  return out;
}
registerTransformer("histogram", (frames, options = {}) => {
  const bucketCount2 = Math.max(1, Number(options.bucketCount ?? 10));
  const bucketSizeOpt = Number(options.bucketSize ?? 0);
  const bucketOffsetRaw = options.bucketOffset;
  const bucketOffset = bucketOffsetRaw == null || bucketOffsetRaw === "" ? 0 : Number(bucketOffsetRaw);
  const offset = Number.isFinite(bucketOffset) ? bucketOffset : 0;
  const combine = options.combine === true;
  const cfg = { bucketCount: bucketCount2, bucketSizeOpt, offset };
  const series = collectNumericSeries(frames);
  if (!series.length) return frames;
  const allValues = series.flatMap((s) => s.values);
  const geo = resolveSizeAndStart(allValues, cfg);
  if (!geo) return frames;
  const { size, start, bucketCount: bc } = geo;
  const { bucketMin, bucketMax } = bucketEdges(start, size, bc);
  const countColumns = series.map((s) => ({
    name: s.name,
    values: countIntoBuckets(s.values, start, size, bc),
    config: {
      ...s.config,
      // preserve display name for legend when multi-count
      ...s.displayName && s.displayName !== s.name ? { displayName: s.displayName } : {}
    }
  }));
  let countFields;
  if (combine || countColumns.length === 1) {
    const values = countColumns.length === 1 ? countColumns[0].values : countColumns[0].values.map(
      (_, i) => countColumns.reduce((sum, col2) => sum + Number(col2.values[i] ?? 0), 0)
    );
    countFields = [
      {
        name: "Count",
        type: "number",
        values,
        config: countColumns.length === 1 ? countColumns[0].config : { displayName: "Count" }
      }
    ];
  } else {
    const seen = /* @__PURE__ */ new Map();
    countFields = countColumns.map((col2) => {
      const n = seen.get(col2.name) ?? 0;
      seen.set(col2.name, n + 1);
      const name = n === 0 ? col2.name : `${col2.name} ${n + 1}`;
      return {
        name,
        type: "number",
        values: col2.values,
        config: col2.config
      };
    });
  }
  return [
    createDataFrame({
      refId: frames[0]?.refId ?? "histogram",
      name: "histogram",
      meta: { preferredVisualisationType: "histogram" },
      fields: [
        { name: "BucketMin", type: "number", values: bucketMin, config: {} },
        { name: "BucketMax", type: "number", values: bucketMax, config: {} },
        ...countFields
      ]
    })
  ];
});
function fieldValuesAsStrings(field, values, emptyValue) {
  return values.map((v) => {
    if (v == null || v === "") return String(emptyValue ?? "");
    if (field.type === "enum") {
      const text = field.config?.type?.enum?.text;
      if (Array.isArray(text) && text[v] != null) {
        return String(text[v]);
      }
    }
    if (field.type === "time" || field.type === "number" || field.type === "boolean" || field.type === "string") {
      return String(v);
    }
    try {
      return JSON.stringify(v);
    } catch {
      return String(v);
    }
  });
}
function determineFieldType(types) {
  const unique = new Set(types);
  return unique.size === 1 ? [...unique][0] : "string";
}
registerTransformer("transpose", (frames, options = {}) => {
  const firstName = String(options.firstFieldName ?? "Field");
  const restName = String(options.restFieldsName ?? "Value");
  const emptyValue = getSpecialValue(
    options.emptyValue ?? SpecialValue.Empty
  );
  return frames.map((frame) => {
    if (!frame.fields.length) return frame;
    const firstField = frame.fields[0];
    const useFirstFieldAsHeaders = firstField.type === "string" || firstField.type === "time" || firstField.type === "enum" || // also treat "other" stringy as headers when name-like
    false;
    const headers = useFirstFieldAsHeaders ? [firstName, ...fieldValuesAsStrings(firstField, firstField.values, emptyValue)] : [firstName, ...firstField.values.map(() => restName)];
    const rows = useFirstFieldAsHeaders ? frame.fields.slice(1).map((f) => String(f.state?.displayName ?? f.config?.displayName ?? f.name)) : frame.fields.map((f) => String(f.state?.displayName ?? f.config?.displayName ?? f.name));
    const typeSource = useFirstFieldAsHeaders ? frame.fields.slice(1).map((f) => f.type) : frame.fields.map((f) => f.type);
    const fieldType = determineFieldType(typeSource);
    const newFields = headers.map((fieldName2, index2) => {
      if (index2 === 0) {
        return {
          name: firstName,
          type: "string",
          config: {},
          values: rows
        };
      }
      const values = frame.fields.map((field) => {
        const raw = field.values[index2 - 1];
        if (fieldType === "string") {
          return fieldValuesAsStrings(field, [raw], emptyValue)[0];
        }
        return raw;
      });
      const labelName = useFirstFieldAsHeaders ? firstField.name : "row";
      const labelValue = useFirstFieldAsHeaders ? fieldName2 : index2;
      return {
        name: useFirstFieldAsHeaders ? restName : String(fieldName2),
        labels: {
          [labelName]: String(labelValue)
        },
        type: fieldType,
        config: {},
        values: useFirstFieldAsHeaders ? values.slice(1) : values
      };
    });
    return createDataFrame({
      refId: frame.refId ? `transpose-${frame.refId}` : frame.refId,
      name: frame.name || "transposed",
      fields: newFields
    });
  });
});
registerTransformer("formatTime", (frames, options = {}) => {
  const fieldName2 = String(options.field ?? options.timeField ?? "");
  const outputFormat = String(options.outputFormat ?? options.format ?? "YYYY-MM-DD HH:mm:ss");
  const useTimezone = options.useTimezone !== false;
  const tz = String(options.timezone ?? options.timeZone ?? "browser");
  const utc = useTimezone && tz.toLowerCase() === "utc";
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => {
        const hit = !fieldName2 && f.type === "time" || f.name === fieldName2 || getFieldDisplayName(f, frame, frames) === fieldName2;
        if (!hit) return f;
        return {
          ...f,
          type: "string",
          values: f.values.map((v) => {
            const d = new Date(Number(v));
            if (!Number.isFinite(d.getTime())) return String(v ?? "");
            if (outputFormat === "ms") return String(Number(v));
            if (outputFormat === "ISO" || outputFormat === "iso") return d.toISOString();
            return formatTimeToken(d, outputFormat, utc);
          })
        };
      })
    })
  );
});
function pathGet(obj, path) {
  if (obj == null || !path) return void 0;
  const parts = path.replaceAll(/\[(\d+)\]/g, ".$1").replaceAll(/\["([^"]+)"\]/g, ".$1").replaceAll(/\['([^']+)'\]/g, ".$1").split(".").filter(Boolean);
  let cur = obj;
  for (const p of parts) {
    if (cur == null) return void 0;
    cur = cur[p];
  }
  return cur;
}
function fieldTypeFromValues(values) {
  const sample = values.find((v) => v != null);
  if (typeof sample === "number") return "number";
  if (typeof sample === "boolean") return "boolean";
  if (sample instanceof Date) return "time";
  return "string";
}
function parseKvp(text, delimiter) {
  const o = {};
  const parts = text.split(new RegExp(`[${escapeReg(delimiter)}\\s]+`));
  for (const pair of parts) {
    if (!pair) continue;
    const eq = pair.indexOf("=");
    if (eq <= 0) continue;
    const k = pair.slice(0, eq);
    const v = pair.slice(eq + 1);
    if (k) o[k] = v;
  }
  return o;
}
function escapeReg(s) {
  return s.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function parseRow(raw, format, options) {
  let obj = raw;
  if (typeof obj === "string") {
    try {
      if (format === "json" || format === "auto") {
        obj = JSON.parse(obj);
      } else if (format === "kvp" || format === "delimiter") {
        obj = parseKvp(obj, String(options.delimiter ?? ","));
      } else if (format === "regexp" || format === "regex") {
        const re = new RegExp(
          String(options.regExp ?? options.regexp ?? options.pattern ?? "(.*)")
        );
        const m = String(raw ?? "").match(re);
        const o = {};
        if (m) {
          if (m.groups) {
            for (const [k, v] of Object.entries(m.groups)) o[k] = v;
          } else {
            m.slice(1).forEach((v, i) => {
              o[`Match ${i + 1}`] = v;
            });
          }
        }
        obj = o;
      } else {
        obj = {};
      }
    } catch {
      obj = {};
    }
  }
  if (obj == null || typeof obj !== "object" || Array.isArray(obj)) {
    return {};
  }
  let rec = obj;
  if ((format === "json" || format === "auto") && Array.isArray(options.jsonPaths) && options.jsonPaths.length > 0) {
    const filtered = options.jsonPaths.filter(
      (p) => p && String(p.path ?? "").trim() !== ""
    );
    if (filtered.length) {
      const next = {};
      for (const p of filtered) {
        const path = String(p.path);
        const key = p.alias != null && String(p.alias).length > 0 ? String(p.alias) : path;
        const v = pathGet(rec, path);
        next[key] = v === void 0 ? "Not Found" : v;
      }
      rec = next;
    }
  }
  return rec;
}
registerTransformer("extractFields", (frames, options = {}) => {
  const opts = options;
  const source = String(opts.source ?? opts.field ?? "");
  let format = String(opts.format ?? "json");
  if (format === "auto") format = "json";
  const replace = opts.replaceFields === true || opts.replace === true;
  const keepTime = opts.keepTime === true;
  return frames.map((frame) => {
    const f = (source ? findFrameField(frame, source, frames) : void 0) ?? frame.fields.find((x) => x.type === "string");
    if (!f) return frame;
    const count = frame.length ?? f.values.length;
    const names = [];
    const buffers = /* @__PURE__ */ new Map();
    for (let i = 0; i < count; i++) {
      const rec = parseRow(f.values[i], format, opts);
      for (const [key, val] of Object.entries(rec)) {
        let buf = buffers.get(key);
        if (!buf) {
          buf = new Array(count).fill(void 0);
          buffers.set(key, buf);
          names.push(key);
        }
        buf[i] = val;
      }
    }
    let fields = names.map((name) => {
      const values = buffers.get(name) ?? [];
      return {
        name,
        type: fieldTypeFromValues(values),
        values,
        config: {}
      };
    });
    if (keepTime) {
      const sourceTime = frame.fields.find((x) => x.name === "Time") ?? frame.fields.find((x) => x.name === "time") ?? frame.fields.find((x) => x.type === "time");
      if (sourceTime) {
        fields = [
          {
            name: sourceTime.name,
            type: sourceTime.type,
            values: [...sourceTime.values],
            config: { ...sourceTime.config || {} }
          },
          ...fields
        ];
      }
    }
    if (!replace) {
      fields = [
        ...frame.fields.map((x) => ({
          name: x.name,
          type: x.type,
          values: [...x.values],
          config: { ...x.config || {} },
          labels: x.labels
        })),
        ...fields
      ];
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields
    });
  });
});
registerTransformer("prepareTimeSeries", (frames, options = {}) => {
  const format = String(options.format ?? "multi");
  if (format === "wide") {
    const by = frames[0]?.fields.find((f) => f.type === "time")?.name || frames[0]?.fields.find((f) => /time/i.test(f.name))?.name || "Time";
    if (frames.length <= 1) return frames;
    const join = (framesIn, byField) => {
      const keyValues = [];
      const index2 = /* @__PURE__ */ new Map();
      for (const frame of framesIn) {
        const keyField = findFrameField(frame, byField, framesIn) ?? frame.fields.find((f) => f.type === "time");
        if (!keyField) continue;
        for (const v of keyField.values) {
          const k = String(v);
          if (!index2.has(k)) {
            index2.set(k, keyValues.length);
            keyValues.push(k);
          }
        }
      }
      const outFields = [
        {
          name: byField,
          type: findFrameField(framesIn[0], byField, framesIn)?.type ?? framesIn[0].fields.find((f) => f.type === "time")?.type ?? "time",
          values: keyValues.map((k) => Number.isFinite(Number(k)) ? Number(k) : k),
          config: {}
        }
      ];
      for (const frame of framesIn) {
        const keyField = findFrameField(frame, byField, framesIn) ?? frame.fields.find((f) => f.type === "time");
        if (!keyField) continue;
        const local = new Map(keyField.values.map((v, i) => [String(v), i]));
        for (const field of frame.fields.filter((f) => f !== keyField)) {
          outFields.push({
            name: frame.refId ? `${field.name} ${frame.refId}` : field.name,
            type: field.type,
            values: keyValues.map((k) => {
              const i = local.get(k);
              return i == null ? null : field.values[i];
            }),
            config: field.config ?? {},
            labels: field.labels
          });
        }
      }
      return [
        createDataFrame({
          name: "wide",
          refId: framesIn[0]?.refId,
          fields: outFields
        })
      ];
    };
    return join(frames, by);
  }
  if (format === "long") {
    const metric = [];
    const values = [];
    const times = [];
    for (const frame of frames) {
      const time = frame.fields.find((f) => f.type === "time");
      for (const field of frame.fields.filter((f) => f.type === "number")) {
        for (let i = 0; i < field.values.length; i++) {
          metric.push(getFieldDisplayName(field, frame, frames));
          values.push(Number(field.values[i] ?? 0));
          times.push(Number(time?.values[i] ?? i));
        }
      }
    }
    return [
      createDataFrame({
        name: "long",
        fields: [
          { name: "Time", type: "time", values: times },
          { name: "Metric", type: "string", values: metric },
          { name: "Value", type: "number", values }
        ]
      })
    ];
  }
  if (format === "multi") {
    const out = [];
    for (const frame of frames) {
      const time = frame.fields.find((f) => f.type === "time");
      const nums = frame.fields.filter((f) => f.type === "number");
      if (!time || nums.length <= 1) {
        out.push(frame);
        continue;
      }
      for (const num2 of nums) {
        out.push(
          createDataFrame({
            refId: frame.refId,
            name: getFieldDisplayName(num2, frame, frames),
            fields: [
              { name: time.name, type: "time", values: [...time.values] },
              { ...num2, values: [...num2.values] }
            ]
          })
        );
      }
    }
    return out.length ? out : frames;
  }
  return frames;
});
const collator$1 = new Intl.Collator(void 0, {
  sensitivity: "base",
  numeric: true
});
function orderAuto(frame, orderBy) {
  const fields = frame.fields;
  const firstTime = fields.find((f) => f.type === "time");
  return fields.slice().sort((fieldA, fieldB) => {
    if (fieldA === firstTime) return -1;
    if (fieldB === firstTime) return 1;
    for (const item of orderBy) {
      const type = String(item?.type ?? "name");
      const desc = !!item?.desc;
      const labelKey2 = String(item?.name ?? "");
      const aVal = type === "label" ? String(fieldA.labels?.[labelKey2] ?? "") : getFieldDisplayName(fieldA, frame);
      const bVal = type === "label" ? String(fieldB.labels?.[labelKey2] ?? "") : getFieldDisplayName(fieldB, frame);
      const res = collator$1.compare(aVal, bVal) * (desc ? -1 : 1);
      if (res !== 0) return res;
    }
    return 0;
  });
}
function orderManual(frame, indexByName) {
  const names = Object.entries(indexByName).sort((a, b) => Number(a[1]) - Number(b[1])).map(([n]) => n);
  if (!names.length) return frame.fields;
  const ordered = [];
  const used = /* @__PURE__ */ new Set();
  for (const n of names) {
    const f = frame.fields.find((x) => x.name === n) ?? frame.fields.find((x) => getFieldDisplayName(x, frame) === n);
    if (f && !used.has(f.name)) {
      ordered.push(f);
      used.add(f.name);
    }
  }
  const rest = frame.fields.filter((f) => !used.has(f.name));
  return [...ordered, ...rest];
}
registerTransformer("order", (frames, options = {}) => {
  const mode2 = String(options.orderByMode ?? "manual").toLowerCase();
  const orderBy = options.orderBy;
  if (mode2 === "auto" && Array.isArray(orderBy) && orderBy.length) {
    return frames.map(
      (frame) => createDataFrame({
        refId: frame.refId,
        name: frame.name,
        fields: orderAuto(frame, orderBy)
      })
    );
  }
  const indexByName = options.indexByName ?? options.orderByNames ?? {};
  if (!indexByName || !Object.keys(indexByName).length) return frames;
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: orderManual(frame, indexByName)
    })
  );
});
registerTransformer("rename", (frames, options = {}) => {
  const renameByName = options.renameByName ?? options;
  if (!renameByName || typeof renameByName !== "object") return frames;
  if (!Object.keys(renameByName).length) return frames;
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => {
        const displayName = getFieldDisplayName(f, frame, frames);
        const raw = renameByName[displayName] ?? renameByName[f.name];
        if (typeof raw !== "string" || raw.length === 0) return f;
        return {
          ...f,
          config: {
            ...f.config || {},
            displayName: raw
          },
          state: {
            ...f.state || {},
            displayName: raw
          }
        };
      })
    })
  );
});
registerTransformer("noop", (frames) => frames);
function buildFrameName(opts, names, values) {
  const sep1 = opts.separator1 ?? "=";
  const sep2 = opts.separator2 ?? " ";
  return names.map((name, i) => opts.withNames ? `${name}${sep1}${values[i]}` : String(values[i])).join(sep2);
}
function buildFieldLabels(names, values) {
  const labels = {};
  names.forEach((name, i) => {
    labels[name] = String(values[i]);
  });
  return labels;
}
registerTransformer("partitionByValues", (frames, options = {}) => {
  const fields = options.fields ?? (options.field ? [String(options.field)] : []);
  const keepFields = options.keepFields === true;
  const naming = {
    asLabels: true,
    append: false,
    withNames: false,
    separator1: "=",
    separator2: " ",
    ...options.naming ?? {}
  };
  if (!fields.length) return frames;
  const out = [];
  for (const frame of frames) {
    const keyFields = fields.map((n) => findFrameField(frame, n, frames)).filter(Boolean);
    if (!keyFields.length) {
      out.push(frame);
      continue;
    }
    const names = fields.map((n) => findFrameField(frame, n, frames) && n).filter(Boolean);
    const labelNames = names.length === keyFields.length ? names : keyFields.map((f) => f.name);
    const groups = /* @__PURE__ */ new Map();
    const len = frame.length || frame.fields[0]?.values.length || 0;
    for (let i = 0; i < len; i++) {
      const key = keyFields.map((f) => String(f.values[i] ?? "")).join("|");
      if (!groups.has(key)) groups.set(key, []);
      groups.get(key).push(i);
    }
    for (const [, idxs] of groups) {
      const keyValues = keyFields.map((f) => f.values[idxs[0]]);
      let frameName = frame.name;
      let fieldLabels2 = {};
      if (naming.asLabels !== false) {
        fieldLabels2 = buildFieldLabels(labelNames, keyValues);
      } else {
        let name = buildFrameName(naming, labelNames, keyValues);
        if (naming.append && frame.name) name = `${frame.name} ${name}`;
        frameName = name;
      }
      const selected = keepFields ? frame.fields : frame.fields.filter((f) => !fields.some((n) => fieldMatchesName(f, n, frame, frames)));
      out.push(
        createDataFrame({
          refId: frame.refId ? `${frame.refId}-${frameName ?? keyValues.join("|")}` : frame.refId,
          name: frameName,
          fields: selected.map((f) => ({
            ...f,
            labels: { ...f.labels ?? {}, ...fieldLabels2 },
            values: idxs.map((i) => f.values[i])
          }))
        })
      );
    }
  }
  return out;
});
registerTransformer("rowsToFields", (frames, options = {}) => {
  const nameField = String(options.nameField ?? options.fieldName ?? "name");
  const valueField2 = String(options.valueField ?? "value");
  const mappings = options.mappings ?? [];
  return frames.map((frame) => {
    const nf = findFrameField(frame, nameField, frames);
    const vf = findFrameField(frame, valueField2, frames) ?? frame.fields.find((f) => f.type === "number");
    if (!nf || !vf) return frame;
    const fields = nf.values.map((name, i) => {
      const config2 = {};
      for (const m of mappings) {
        if (!m?.fieldName || !m?.handlerKey) continue;
        const src = findFrameField(frame, m.fieldName, frames);
        if (!src) continue;
        const key = String(m.handlerKey);
        const raw = src.values[i];
        if (key === "min" || key === "max" || key === "decimals") config2[key] = Number(raw);
        else config2[key] = raw;
      }
      return {
        name: String(name),
        type: typeof vf.values[i] === "number" ? "number" : "string",
        values: [vf.values[i]],
        config: config2
      };
    });
    return createDataFrame({ refId: frame.refId, name: frame.name, fields });
  });
});
registerTransformer("ensureColumns", (frames) => {
  if (frames.length > 1) {
    const hasTime = frames.every((f) => f.fields.some((x) => x.type === "time"));
    if (hasTime) {
      const by = frames[0].fields.find((f) => f.type === "time").name;
      const keyValues = [];
      const index2 = /* @__PURE__ */ new Map();
      for (const frame of frames) {
        const keyField = findFrameField(frame, by, frames) ?? frame.fields.find((f) => f.type === "time");
        if (!keyField) continue;
        for (const v of keyField.values) {
          const k = String(v);
          if (!index2.has(k)) {
            index2.set(k, keyValues.length);
            keyValues.push(k);
          }
        }
      }
      const outFields = [
        {
          name: by,
          type: "time",
          values: keyValues.map(Number),
          config: {}
        }
      ];
      for (const frame of frames) {
        const keyField = findFrameField(frame, by, frames) ?? frame.fields.find((f) => f.type === "time");
        if (!keyField) continue;
        const local = new Map(keyField.values.map((v, i) => [String(v), i]));
        for (const field of frame.fields.filter((f) => f.type !== "time")) {
          outFields.push({
            name: field.name,
            type: field.type,
            values: keyValues.map((k) => {
              const i = local.get(k);
              return i == null ? null : field.values[i];
            }),
            config: field.config ?? {},
            labels: field.labels
          });
        }
      }
      return [
        createDataFrame({
          name: "columns",
          refId: frames[0]?.refId,
          fields: outFields
        })
      ];
    }
  }
  return frames.map((frame) => {
    const time = frame.fields.filter((f) => f.type === "time");
    const rest = frame.fields.filter((f) => f.type !== "time");
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: [...time, ...rest]
    });
  });
});
registerTransformer("convertFrameType", (frames, options = {}) => {
  const target = String(options.targetType ?? options.type ?? options.visualizationType ?? "");
  if (!target) return frames;
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => ({
        ...f,
        values: [...f.values],
        config: { ...f.config || {} }
      })),
      meta: {
        ...frame.meta || {},
        preferredVisualisationType: target,
        convertedFrameType: target
      }
    })
  );
});
registerTransformer("filterFields", getTransformer("filterByName"));
const impl = getTransformer("filterByName");
if (!impl) {
  throw new Error("filterFieldsByName requires filterByName to be registered first");
}
registerTransformer("filterFieldsByName", impl);
registerTransformer("filterFrames", (frames, options = {}) => {
  const include = options.include;
  const names = options.names ?? (include && typeof include === "object" ? include.names : void 0);
  const pattern = String(
    options.pattern ?? (include && typeof include === "object" ? include.pattern : "") ?? (typeof include === "string" ? include : "")
  );
  if (names?.length) {
    const set = new Set(names);
    return frames.filter((f) => set.has(String(f.refId)) || set.has(String(f.name)));
  }
  if (pattern) {
    try {
      const re = new RegExp(pattern);
      const filtered = frames.filter(
        (f) => re.test(String(f.refId ?? "")) || re.test(String(f.name ?? ""))
      );
      if (filtered.length) return filtered;
    } catch {
    }
  }
  const refIdsRaw = options.refIds ?? (typeof include === "string" && !include.includes("*") && !include.includes(".") ? include : "");
  const refIds = refIdsRaw != null && refIdsRaw !== "" ? String(refIdsRaw) : "";
  if (refIds) {
    const set = new Set(
      refIds.split(/[|,]/).map((s) => s.trim()).filter(Boolean)
    );
    return frames.filter((f) => set.has(String(f.refId)));
  }
  return frames;
});
registerTransformer("seriesToColumns", getTransformer("joinByField"));
registerTransformer("append", getTransformer("concatenate"));
function distinctLabels(data) {
  const s = /* @__PURE__ */ new Set();
  for (const frame of data) {
    for (const f of frame.fields) {
      for (const k of Object.keys(f.labels ?? {})) s.add(k);
    }
  }
  return s;
}
function errorFrame(text) {
  return createDataFrame({
    meta: { notices: [{ severity: "error", text }] },
    fields: [{ name: "Error", type: "string", values: [text], config: {} }]
  });
}
function joinByLabelsGrafana(options, data) {
  const valueLabel = options.value;
  const labels = distinctLabels(data);
  if (labels.size < 1) return errorFrame("No labels in result");
  if (!labels.has(valueLabel)) return errorFrame("Value label not found");
  let join = options.join?.length ? [...options.join] : [...labels];
  join = join.filter((f) => f !== valueLabel);
  const names = /* @__PURE__ */ new Set();
  const found = /* @__PURE__ */ new Map();
  const inputFields = {};
  for (const frame of data) {
    for (const field of frame.fields) {
      if (!field.labels || field.type === "time") continue;
      const keys = join.map((v) => String(field.labels[v] ?? ""));
      const key = keys.join(",");
      let item = found.get(key);
      if (!item) {
        item = { keys, values: {} };
        found.set(key, item);
      }
      const name = String(field.labels[valueLabel] ?? "");
      const vals = [...field.values];
      const old = item.values[name];
      item.values[name] = old ? old.concat(vals) : vals;
      if (!inputFields[name]) inputFields[name] = field;
      names.add(name);
    }
  }
  const allNames = [...names];
  const joinValues = join.map(() => []);
  const nameValues = allNames.map(() => []);
  for (const item of found.values()) {
    let valueOffset = -1;
    let done = false;
    while (!done) {
      valueOffset++;
      done = true;
      for (let i = 0; i < join.length; i++) {
        joinValues[i].push(item.keys[i]);
      }
      for (const [i, name] of allNames.entries()) {
        const values = item.values[name] ?? [];
        nameValues[i].push(values[valueOffset]);
        if (values.length > valueOffset + 1) done = false;
      }
    }
  }
  const fields = [];
  for (const [i, element] of join.entries()) {
    fields.push({
      name: element,
      config: {},
      type: "string",
      values: joinValues[i]
    });
  }
  for (const [i, allName] of allNames.entries()) {
    const old = inputFields[allName];
    fields.push({
      name: allName,
      config: {},
      type: old?.type ?? "number",
      values: nameValues[i]
    });
  }
  return createDataFrame({
    refId: `joinByLabels-${data.map((f) => f.refId ?? "").join("-")}`,
    fields
  });
}
function joinByLabelsLegacy(frames, valueFieldName, joinKeys) {
  const rows = [];
  const allLabelKeys = /* @__PURE__ */ new Set();
  for (const frame of frames) {
    for (const f of frame.fields) {
      if (f.type === "time") continue;
      if (!(f.type === "number" || fieldMatchesName(f, valueFieldName, frame, frames))) continue;
      if (!f.labels || !Object.keys(f.labels).length) continue;
      for (const k of Object.keys(f.labels)) allLabelKeys.add(k);
      const keys = joinKeys.length ? joinKeys.map((k) => String(f.labels[k] ?? "")) : [...Object.keys(f.labels)].sort().map((k) => String(f.labels[k] ?? ""));
      const colName = f.labels.__name__ || f.config?.displayName || f.state?.displayName || f.name || frame.refId || "Value";
      rows.push({
        keys,
        colName: String(colName),
        value: f.values[f.values.length - 1],
        type: f.type
      });
    }
  }
  if (!rows.length) return frames;
  const effectiveJoin = joinKeys.length > 0 ? joinKeys : [...allLabelKeys].sort();
  const groups = /* @__PURE__ */ new Map();
  const colNames = /* @__PURE__ */ new Set();
  for (const r of rows) {
    const key = r.keys.join("");
    let g = groups.get(key);
    if (!g) {
      g = { keys: r.keys, cols: {} };
      groups.set(key, g);
    }
    let name = r.colName;
    if (name in g.cols && g.cols[name] !== r.value) {
      name = `${name}_${Object.keys(g.cols).length}`;
    }
    g.cols[name] = r.value;
    colNames.add(name);
  }
  const groupList = [...groups.values()];
  const fields = effectiveJoin.map((name, i) => ({
    name,
    type: "string",
    values: groupList.map((g) => g.keys[i] ?? ""),
    config: {}
  }));
  for (const col2 of colNames) {
    fields.push({
      name: col2,
      type: "number",
      values: groupList.map((g) => g.cols[col2] ?? null),
      config: {}
    });
  }
  return [createDataFrame({ name: "joinByLabels", fields })];
}
registerTransformer("joinByLabels", (frames, options = {}) => {
  if (!frames?.length) return frames;
  const value = String(options.value ?? options.valueField ?? "Value");
  if (!value) {
    return [errorFrame("No value label configured")];
  }
  const joinRaw = options.join ?? options.by ?? options.byField;
  const joinArr = Array.isArray(joinRaw) ? joinRaw.map(String) : joinRaw != null && String(joinRaw) !== "" ? [String(joinRaw)] : [];
  const labels = distinctLabels(frames);
  if (labels.has(value)) {
    return [joinByLabelsGrafana({ value, join: joinArr }, frames)];
  }
  return joinByLabelsLegacy(frames, value, joinArr);
});
function compareFieldValues(left, op, right) {
  const o = String(op).toLowerCase();
  const lv = left;
  const rv = right;
  switch (o) {
    case "eq":
    case "==":
      return lv == rv;
    case "neq":
    case "!=":
      return lv != rv;
    case "gt":
    case ">":
      return Number(lv) > Number(rv);
    case "gte":
    case ">=":
      return Number(lv) >= Number(rv);
    case "lt":
    case "<":
      return Number(lv) < Number(rv);
    case "lte":
    case "<=":
      return Number(lv) <= Number(rv);
    default:
      return lv == rv;
  }
}
var FieldMatcherID = /* @__PURE__ */ ((FieldMatcherID2) => {
  FieldMatcherID2["numeric"] = "numeric";
  FieldMatcherID2["time"] = "time";
  FieldMatcherID2["first"] = "first";
  FieldMatcherID2["firstTimeField"] = "firstTimeField";
  FieldMatcherID2["byType"] = "byType";
  FieldMatcherID2["byTypes"] = "byTypes";
  FieldMatcherID2["byName"] = "byName";
  FieldMatcherID2["byNames"] = "byNames";
  FieldMatcherID2["byRegexp"] = "byRegexp";
  FieldMatcherID2["byRegexpOrNames"] = "byRegexpOrNames";
  FieldMatcherID2["byFrameRefID"] = "byFrameRefID";
  FieldMatcherID2["byValue"] = "byValue";
  return FieldMatcherID2;
})(FieldMatcherID || {});
function asNames(options) {
  if (Array.isArray(options)) return options.map(String);
  if (options && typeof options === "object" && Array.isArray(options.names)) {
    return options.names.map(String);
  }
  return String(options?.names ?? options ?? "").split(",").map((s) => s.trim()).filter(Boolean);
}
function fieldNameFallback(names) {
  let fallback;
  if (names.has("Value")) {
    fallback = (field) => Boolean(field.labels) && field.labels?.__name__ === field.name;
  } else if (names.has("Time") || names.has("time")) {
    fallback = (field, frame) => frame?.meta?.typeVersion == null && field.type === "time";
  }
  return fallback;
}
function matchesNameOrDisplay(field, name, frame, allFrames) {
  if (!name) return false;
  if (field.name === name) return true;
  return getFieldDisplayName(field, frame, allFrames) === name;
}
const MATCHERS = [
  {
    id: "byName",
    name: "字段名称为",
    pickerDefault: true,
    // Grafana: raw name OR getFieldDisplayName (+ Value/Time fallback)
    get: (options) => {
      const name = String(options ?? "");
      const fallback = fieldNameFallback(/* @__PURE__ */ new Set([name]));
      return (field, frame, allFrames) => matchesNameOrDisplay(field, name, frame, allFrames) || Boolean(fallback && fallback(field, frame, allFrames));
    }
  },
  {
    id: "byNames",
    name: "字段名称为（列表）",
    pickerDefault: true,
    get: (options) => {
      const names = asNames(options);
      const unique = new Set(names);
      const fallback = fieldNameFallback(unique);
      const mode2 = typeof options === "object" && options && !Array.isArray(options) ? options.mode || "include" : "include";
      const matcher = (field, frame, allFrames) => names.some((n) => matchesNameOrDisplay(field, n, frame, allFrames)) || Boolean(fallback && fallback(field, frame, allFrames));
      if (mode2 === "exclude") {
        return (field, frame, allFrames) => !matcher(field, frame, allFrames);
      }
      return matcher;
    }
  },
  {
    id: "byRegexp",
    name: "字段名匹配正则",
    pickerDefault: true,
    get: (options) => {
      const re = stringToJsRegexSafe(options);
      return (field, frame, allFrames) => {
        if (!re) return false;
        const displayName = getFieldDisplayName(field, frame, allFrames);
        return re.test(displayName) || re.test(field.name);
      };
    }
  },
  {
    id: "byRegexpOrNames",
    name: "字段名匹配正则或列表",
    pickerDefault: false,
    get: (options) => {
      const opts = options;
      const pattern = typeof opts === "string" ? opts : opts?.pattern ?? "";
      const names = typeof opts === "object" && opts ? asNames(opts) : [];
      const re = stringToJsRegexSafe(pattern);
      return (field, frame, allFrames) => {
        if (names.some((n) => matchesNameOrDisplay(field, n, frame, allFrames))) {
          return true;
        }
        if (!re) return false;
        const displayName = getFieldDisplayName(field, frame, allFrames);
        return re.test(displayName) || re.test(field.name);
      };
    }
  },
  {
    id: "byType",
    name: "字段类型为",
    pickerDefault: true,
    get: (options) => (field) => field.type === options
  },
  {
    id: "byTypes",
    name: "字段类型为（列表）",
    pickerDefault: false,
    get: (options) => {
      const types = Array.isArray(options) ? options.map(String) : String(options ?? "").split(",").map((s) => s.trim()).filter(Boolean);
      return (field) => types.includes(String(field.type));
    }
  },
  {
    id: "byFrameRefID",
    name: "查询返回的字段",
    pickerDefault: true,
    get: (options) => (_field, frame) => (frame?.refId ?? "") === String(options ?? "")
  },
  {
    id: "byValue",
    name: "值为（reducer）",
    description: "将字段 reduce 为单值后与阈值比较（对齐 Grafana fieldValueMatcher）",
    pickerDefault: true,
    get: (options) => {
      const props = options ?? {};
      if (options != null && (typeof options === "number" || typeof options === "string")) {
        const target = options;
        return (field) => field.values.some((v) => {
          if (typeof target === "number") return Number(v) === target;
          return String(v) === String(target);
        });
      }
      const reducer = props.reducer;
      if (!reducer) return () => false;
      const op = props.op || "eq";
      const isBoolean = reducer === ReducerID.allIsNull || reducer === ReducerID.allIsZero || reducer === "allIsNull" || reducer === "allIsZero";
      return (field) => {
        const reduced = reduceField$1(field, [reducer]);
        const left = reduced[reducer];
        if (isBoolean) return Boolean(left);
        return compareFieldValues(left, op, props.value);
      };
    }
  },
  {
    id: "numeric",
    name: "数值字段",
    pickerDefault: false,
    get: () => (field) => field.type === "number"
  },
  {
    id: "time",
    name: "时间字段",
    pickerDefault: false,
    get: () => (field) => field.type === "time"
  },
  {
    id: "first",
    name: "第一个字段",
    pickerDefault: false,
    get: () => (field, frame) => !!frame && frame.fields[0] === field
  },
  {
    id: "firstTimeField",
    name: "第一个时间字段",
    pickerDefault: false,
    get: () => (field, frame) => {
      if (!frame) return field.type === "time";
      const first = frame.fields.find((f) => f.type === "time");
      return first === field;
    }
  }
];
const byId$1 = new Map(MATCHERS.map((m) => [m.id, m]));
function listFieldMatchers() {
  return [...MATCHERS];
}
function listOverridePickerMatchers() {
  return MATCHERS.filter((m) => m.pickerDefault);
}
function getFieldMatcherInfo(id) {
  return byId$1.get(id);
}
function getFieldMatcher(config2) {
  const info = byId$1.get(config2.id);
  if (!info) {
    return () => false;
  }
  return info.get(config2.options);
}
function matchFieldWithRegistry(field, matcher, frame, allFrames) {
  return getFieldMatcher(matcher)(field, frame, allFrames);
}
function isFieldsMap(raw) {
  return !!raw && typeof raw === "object" && !Array.isArray(raw);
}
function isV1Options(opts) {
  return "fields" in opts && !("rules" in opts);
}
function migrateV1ToRules(fields) {
  return Object.entries(fields).map(([fieldName2, fieldOpts]) => ({
    matcher: { id: "byName", options: fieldName2 },
    operation: fieldOpts?.operation ?? null,
    aggregations: Array.isArray(fieldOpts?.aggregations) ? fieldOpts.aggregations.map(String) : [],
    keepNestedField: fieldOpts?.keepNestedField === true
  }));
}
function resolveRules(options) {
  if (Array.isArray(options.rules)) {
    return options.rules.filter((r) => r && typeof r === "object" && r.matcher).map((r) => ({
      matcher: r.matcher,
      operation: r.operation ?? null,
      aggregations: Array.isArray(r.aggregations) ? r.aggregations.map(String) : [],
      keepNestedField: r.keepNestedField === true
    }));
  }
  const raw = options.fields;
  if (isFieldsMap(raw) && isV1Options(options)) {
    return migrateV1ToRules(raw);
  }
  if (isFieldsMap(raw)) {
    return migrateV1ToRules(raw);
  }
  if (Array.isArray(raw)) {
    return raw.map((f) => {
      const name = String(f?.fieldName ?? f?.name ?? f ?? "");
      if (!name) return null;
      return {
        matcher: { id: "byName", options: name },
        operation: f?.operation ?? "groupby",
        aggregations: Array.isArray(f?.aggregations) ? f.aggregations.map(String) : [],
        keepNestedField: f?.keepNestedField === true
      };
    }).filter((r) => !!r);
  }
  if (Array.isArray(options.groupBy)) {
    return options.groupBy.map((name) => ({
      matcher: { id: "byName", options: String(name) },
      operation: "groupby",
      aggregations: []
    }));
  }
  if (options.groupByField) {
    return [
      {
        matcher: { id: "byName", options: String(options.groupByField) },
        operation: "groupby",
        aggregations: []
      }
    ];
  }
  return [];
}
function findMatchingRule(field, frame, allFrames, rules) {
  for (const rule of rules) {
    const matcher = getFieldMatcher(rule.matcher);
    if (matcher(field, frame, allFrames)) {
      return rule;
    }
  }
  return void 0;
}
function shouldGroupOn(field, frame, allFrames, rules) {
  return findMatchingRule(field, frame, allFrames, rules)?.operation === "groupby";
}
function shouldAggregate(field, frame, allFrames, rules) {
  const rule = findMatchingRule(field, frame, allFrames, rules);
  return rule?.operation === "aggregate" && Array.isArray(rule.aggregations) && rule.aggregations.length > 0;
}
function calcValue(field, agg) {
  const calcs = reduceField$1(field, [agg]);
  const v = calcs[agg];
  if (typeof v === "number") return v;
  if (v == null || typeof v === "boolean") return null;
  if (Array.isArray(v)) return v.length;
  const n = Number(v);
  return Number.isFinite(n) ? n : null;
}
function groupToNestedFrame(frame, allFrames, rules, options) {
  const groupByFields = frame.fields.filter((f) => shouldGroupOn(f, frame, allFrames, rules));
  if (!groupByFields.length) {
    return frame;
  }
  const buckets = /* @__PURE__ */ new Map();
  const n = frame.length ?? groupByFields[0].values.length;
  for (let i = 0; i < n; i++) {
    const keys = groupByFields.map((f) => f.values[i]);
    const key = keys.map((v) => String(v)).join("");
    let bucket = buckets.get(key);
    if (!bucket) {
      bucket = { keys, idxs: [] };
      buckets.set(key, bucket);
    }
    bucket.idxs.push(i);
  }
  const groupEntries = [...buckets.entries()];
  const parentFields = groupByFields.map((f, gi) => ({
    name: f.name,
    type: f.type,
    values: groupEntries.map(([, b]) => b.keys[gi]),
    config: { ...f.config || {} }
  }));
  for (const field of frame.fields) {
    if (!shouldAggregate(field, frame, allFrames, rules)) continue;
    const rule = findMatchingRule(field, frame, allFrames, rules);
    const fieldName2 = getFieldDisplayName(field, frame, allFrames);
    for (const agg of rule.aggregations) {
      const values = groupEntries.map(([, b]) => {
        const fake = {
          name: field.name,
          type: field.type,
          config: field.config ?? {},
          values: b.idxs.map((i) => field.values[i])
        };
        return calcValue(fake, agg);
      });
      parentFields.push({
        name: `${fieldName2} (${agg})`,
        type: "number",
        values,
        config: {}
      });
    }
  }
  const expandAllRows = options.expandAllRows === true;
  const showSubframeHeaders = options.showSubframeHeaders !== false;
  const nestedValues = groupEntries.map(([k, b]) => {
    const nestedFields = [];
    for (const field of frame.fields) {
      const rule = findMatchingRule(field, frame, allFrames, rules);
      let include = false;
      if (rule === void 0) {
        include = true;
      } else if (rule.operation == null || rule.operation === "aggregate" && rule.aggregations.length === 0) {
        include = true;
      } else if (rule.operation === "aggregate" && rule.keepNestedField === true) {
        include = true;
      } else if (rule.operation === "groupby") {
        include = false;
      } else if (rule.operation === "aggregate") {
        include = false;
      } else {
        include = true;
      }
      if (!include) continue;
      nestedFields.push({
        name: field.name,
        type: field.type,
        values: b.idxs.map((i) => field.values[i]),
        config: { ...field.config || {} },
        labels: field.labels
      });
    }
    const sub = createDataFrame({
      name: k.replaceAll("", " / "),
      fields: nestedFields,
      meta: {
        custom: {
          noHeader: !showSubframeHeaders,
          stableRowKey: k
        }
      }
    });
    return [sub];
  });
  return createDataFrame({
    refId: frame.refId,
    name: frame.name || "nested",
    meta: {
      preferredVisualisationType: "table",
      nested: true,
      custom: {
        ...expandAllRows ? { expandAllRows: true } : {},
        showSubframeHeaders
      }
    },
    fields: [
      ...parentFields,
      {
        // Grafana FieldType.nestedFrames + __nestedFrames name — table ExpandedRow consumer
        name: "__nestedFrames",
        type: "nestedFrames",
        values: nestedValues,
        config: { custom: { nested: true } }
      }
    ]
  });
}
registerTransformer("groupToNestedTable", (frames, options = {}) => {
  const opts = options;
  let rules = resolveRules(opts);
  if (!rules.some((r) => r.operation === "groupby")) {
    const auto = frames[0]?.fields.filter((f) => f.type === "string" || f.type === "other").slice(0, 1).map((f) => f.name) ?? [];
    if (auto.length) {
      rules = [
        ...rules,
        {
          matcher: { id: "byName", options: auto[0] },
          operation: "groupby",
          aggregations: []
        }
      ];
    }
  }
  if (!rules.some((r) => r.operation === "groupby")) {
    const gb = getTransformer("groupBy");
    return gb ? gb(frames, options) : frames;
  }
  return frames.map((frame) => groupToNestedFrame(frame, frames, rules, opts));
});
function reduceValues(values, reducerId) {
  const nums = values.map(Number).filter((n) => Number.isFinite(n));
  const r = String(reducerId || "lastNotNull");
  if (r === "min") return nums.length ? Math.min(...nums) : null;
  if (r === "max") return nums.length ? Math.max(...nums) : null;
  if (r === "mean") return nums.length ? nums.reduce((a, b) => a + b, 0) / nums.length : null;
  if (r === "sum") return nums.length ? nums.reduce((a, b) => a + b, 0) : null;
  if (r === "first" || r === "firstNotNull") return values.find((v) => v != null) ?? null;
  for (let i = values.length - 1; i >= 0; i--) {
    if (values[i] != null && values[i] !== "") return values[i];
  }
  return null;
}
function resolveApplyMatcher(applyTo) {
  if (applyTo == null || applyTo === "" || applyTo === "field") {
    return getFieldMatcher({ id: "numeric" });
  }
  if (applyTo === "frame") {
    return (f) => f.type !== "time";
  }
  if (typeof applyTo === "string") {
    return getFieldMatcher({ id: "byName", options: applyTo });
  }
  if (typeof applyTo === "object" && applyTo && applyTo.id) {
    return getFieldMatcher(applyTo);
  }
  return getFieldMatcher({ id: "numeric" });
}
function buildConfigPatch(reduced, fieldName2) {
  const cfg = {};
  if (reduced.min != null) cfg.min = Number(reduced.min);
  if (reduced.max != null) cfg.max = Number(reduced.max);
  if (reduced.unit != null) cfg.unit = String(reduced.unit);
  if (reduced.decimals != null) cfg.decimals = Number(reduced.decimals);
  if (reduced.displayname != null) cfg.displayName = String(reduced.displayname);
  for (const key of ["thresholds", "mappings", "color", "noValue", "filterable"]) {
    if (reduced[key] != null) cfg[key] = reduced[key];
    if (reduced[key.toLowerCase()] != null) cfg[key] = reduced[key.toLowerCase()];
  }
  for (const [k, v] of Object.entries(reduced)) {
    if (k.startsWith(`${fieldName2}.`)) {
      cfg[k.slice(fieldName2.length + 1)] = v;
    }
  }
  return cfg;
}
registerTransformer("configFromData", (frames, options = {}) => {
  if (!frames.length) return frames;
  const configRefId = options.configRefId != null ? String(options.configRefId) : "config";
  let configFrame = frames.find((f) => f.refId === configRefId) ?? (options.configFrameIndex != null ? frames[Number(options.configFrameIndex)] : void 0);
  if (!configFrame && frames.length > 1 && options.configRefId == null) {
    configFrame = frames[frames.length - 1];
  }
  if (!configFrame) return frames;
  const mappings = options.mappings ?? [];
  const mappingByField = /* @__PURE__ */ new Map();
  for (const m of mappings) {
    if (m?.fieldName) mappingByField.set(String(m.fieldName), m);
  }
  const reduced = {};
  for (const field of configFrame.fields) {
    const display = getFieldDisplayName(field, configFrame, frames);
    const m = mappingByField.get(field.name) ?? mappingByField.get(display) ?? void 0;
    const handlerKey = String(m?.handlerKey ?? field.name.toLowerCase()).toLowerCase();
    if (handlerKey === "null" || m?.handlerKey === null) continue;
    const reducer = m?.reducerId ?? "lastNotNull";
    reduced[handlerKey] = reduceValues(field.values, reducer);
    reduced[field.name.toLowerCase()] = reduced[handlerKey];
    reduced[field.name] = reduced[handlerKey];
    if (display && display !== field.name) {
      reduced[display] = reduced[handlerKey];
      reduced[display.toLowerCase()] = reduced[handlerKey];
    }
  }
  if (!mappings.length) {
    const nameF = configFrame.fields.find((f) => /name|field|key/i.test(f.name));
    const valF = configFrame.fields.find(
      (f) => f !== nameF && (f.type === "number" || f.type === "string")
    );
    if (nameF && valF) {
      nameF.values.forEach((n, i) => {
        reduced[String(n)] = valF.values[i];
        reduced[String(n).toLowerCase()] = valF.values[i];
      });
    } else {
      for (const f of configFrame.fields) {
        reduced[f.name] = f.values[0];
        reduced[f.name.toLowerCase()] = f.values[0];
      }
    }
  }
  const matcher = resolveApplyMatcher(options.applyTo);
  const dataFrames = frames.filter((f) => f !== configFrame || frames.length === 1);
  const out = dataFrames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      meta: frame.meta,
      fields: frame.fields.map((f) => {
        if (!matcher(f, frame, frames)) return f;
        const display = getFieldDisplayName(f, frame, frames);
        const patch = {
          ...buildConfigPatch(reduced, f.name),
          ...display !== f.name ? buildConfigPatch(reduced, display) : {}
        };
        if (!Object.keys(patch).length) return f;
        return {
          ...f,
          config: {
            ...f.config || {},
            ...patch
          }
        };
      })
    })
  );
  return out.length ? out : frames;
});
registerTransformer("fieldLookup", (frames, options = {}) => {
  const lookupField = String(options.lookupField ?? options.field ?? "");
  const gazetteer = String(options.gazetteer ?? "countries");
  if (frames.length >= 2 && options.fromField) {
    const fromField = String(options.fromField);
    const lookup = frames[1];
    const key = findFrameField(lookup, lookupField, frames);
    const val = findFrameField(lookup, fromField, frames) ?? lookup.fields.find((f) => f !== key);
    if (!key || !val) return frames;
    const map = new Map(key.values.map((k, i) => [String(k), val.values[i]]));
    return frames.slice(0, 1).map((frame) => {
      const src = findFrameField(frame, lookupField, frames) ?? frame.fields[0];
      return createDataFrame({
        refId: frame.refId,
        name: frame.name,
        fields: [
          ...frame.fields,
          {
            name: `${fromField} lookup`,
            type: val.type,
            values: src.values.map((v) => map.get(String(v)) ?? null),
            config: {}
          }
        ]
      });
    });
  }
  return frames.map((frame) => {
    const src = findFrameField(frame, lookupField, frames) || frame.fields.find((f) => /country|geoip|code/i.test(f.name)) || frame.fields.find((f) => f.type === "string");
    if (!src) return frame;
    if (gazetteer === "countries" || !options.fromField) {
      return createDataFrame({
        refId: frame.refId,
        name: frame.name,
        fields: [
          ...frame.fields,
          {
            name: "country name",
            type: "string",
            values: src.values.map(
              (v) => GAZETTEER_COUNTRIES[String(v).toUpperCase()]?.name ?? null
            ),
            config: {}
          },
          {
            name: "latitude",
            type: "number",
            values: src.values.map(
              (v) => GAZETTEER_COUNTRIES[String(v).toUpperCase()]?.lat ?? null
            ),
            config: {}
          },
          {
            name: "longitude",
            type: "number",
            values: src.values.map(
              (v) => GAZETTEER_COUNTRIES[String(v).toUpperCase()]?.lon ?? null
            ),
            config: {}
          }
        ]
      });
    }
    return frame;
  });
});
function bucketCount(raw, fallback) {
  if (raw == null) return fallback;
  if (typeof raw === "number" && Number.isFinite(raw)) return Math.max(2, raw);
  if (typeof raw === "string" && raw.trim() !== "") {
    const n = Number(raw);
    if (Number.isFinite(n)) return Math.max(2, n);
  }
  if (typeof raw === "object") {
    const v = raw.value;
    const n = Number(v);
    if (Number.isFinite(n) && n > 0) return Math.max(2, n);
  }
  return fallback;
}
registerTransformer("heatmap", (frames, options = {}) => {
  const xBuckets = bucketCount(
    options.xBuckets ?? options["xBuckets.value"],
    Number(options.bucketCount ?? 10) || 10
  );
  const yBuckets = bucketCount(options.yBuckets ?? options["yBuckets.value"], 8);
  const out = [];
  for (const frame of frames) {
    const time = frame.fields.find((f) => f.type === "time");
    const nums = frame.fields.filter((f) => f.type === "number");
    if (!time || !nums.length) {
      out.push(frame);
      continue;
    }
    const times = time.values.map(Number);
    const tMin = Math.min(...times.filter(Number.isFinite));
    const tMax = Math.max(...times.filter(Number.isFinite));
    const tSpan = Math.max(1, tMax - tMin);
    let vMin = Infinity, vMax = -Infinity;
    for (const n of nums) {
      for (const v of n.values) {
        const x = Number(v);
        if (!Number.isFinite(x)) continue;
        vMin = Math.min(vMin, x);
        vMax = Math.max(vMax, x);
      }
    }
    if (!Number.isFinite(vMin)) {
      vMin = 0;
      vMax = 1;
    }
    if (vMin === vMax) vMax = vMin + 1;
    const counts = Array.from({ length: yBuckets }, () => new Array(xBuckets).fill(0));
    for (const n of nums) {
      for (let i = 0; i < n.values.length; i++) {
        const tv = Number(time.values[i]);
        const vv = Number(n.values[i]);
        if (!Number.isFinite(tv) || !Number.isFinite(vv)) continue;
        const xi = Math.min(
          xBuckets - 1,
          Math.max(0, Math.floor((tv - tMin) / tSpan * xBuckets))
        );
        const yi = Math.min(
          yBuckets - 1,
          Math.max(0, Math.floor((vv - vMin) / (vMax - vMin) * yBuckets))
        );
        counts[yi][xi] += 1;
      }
    }
    const xs = [];
    const ys = [];
    const cs = [];
    for (let y = 0; y < yBuckets; y++) {
      for (let x = 0; x < xBuckets; x++) {
        xs.push(tMin + (x + 0.5) / xBuckets * tSpan);
        ys.push(vMin + (y + 0.5) / yBuckets * (vMax - vMin));
        cs.push(counts[y][x]);
      }
    }
    out.push(
      createDataFrame({
        refId: frame.refId,
        name: frame.name || "heatmap",
        meta: { preferredVisualisationType: "heatmap", xBuckets, yBuckets },
        fields: [
          { name: "xMax", type: "time", values: xs },
          { name: "y", type: "number", values: ys },
          { name: "count", type: "number", values: cs }
        ]
      })
    );
  }
  return out;
});
function resolveLatLon(frame, options) {
  const source = options.source ?? {};
  const latField = String(
    source.latField ?? source.latitude ?? options.latitudeField ?? options.lat ?? "lat"
  );
  const lonField = String(
    source.lngField ?? source.longitude ?? options.longitudeField ?? options.lon ?? "lon"
  );
  const lat = findFrameField(frame, latField) ?? frame.fields.find(
    (f) => /lat/i.test(f.name) || /lat/i.test(String(f.config?.displayName ?? ""))
  );
  const lon = findFrameField(frame, lonField) ?? frame.fields.find(
    (f) => /lon|lng/i.test(f.name) || /lon|lng/i.test(String(f.config?.displayName ?? ""))
  );
  if (!lat || !lon) return null;
  return { lat, lon };
}
function haversineM(lat1, lon1, lat2, lon2) {
  if (![lat1, lon1, lat2, lon2].every(Number.isFinite)) return null;
  const toRad2 = (d) => d * Math.PI / 180;
  const R = 6371e3;
  const φ1 = toRad2(lat1);
  const φ2 = toRad2(lat2);
  const Δφ = toRad2(lat2 - lat1);
  const Δλ = toRad2(lon2 - lon1);
  const a = Math.sin(Δφ / 2) ** 2 + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) ** 2;
  return 2 * R * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
}
function headingDeg(lat1, lon1, lat2, lon2) {
  if (![lat1, lon1, lat2, lon2].every(Number.isFinite)) return null;
  const toRad2 = (d) => d * Math.PI / 180;
  const φ1 = toRad2(lat1);
  const φ2 = toRad2(lat2);
  const Δλ = toRad2(lon2 - lon1);
  const y = Math.sin(Δλ) * Math.cos(φ2);
  const x = Math.cos(φ1) * Math.sin(φ2) - Math.sin(φ1) * Math.cos(φ2) * Math.cos(Δλ);
  let deg = Math.atan2(y, x) * 180 / Math.PI;
  if (deg < 0) deg += 360;
  return deg;
}
function extractFrame(frame, lat, lon) {
  return createDataFrame({
    refId: frame.refId,
    name: frame.name,
    fields: [
      {
        name: "latitude",
        type: "number",
        values: lat.values.map(Number),
        config: {}
      },
      {
        name: "longitude",
        type: "number",
        values: lon.values.map(Number),
        config: {}
      }
    ]
  });
}
registerTransformer("spatial", (frames, options = {}) => {
  const opts = options;
  let action = String(opts.action ?? opts.calc ?? "prepare").toLowerCase();
  if (action === "extract") action = "prepare";
  if (action === "distance" || action === "heading" || action === "area") {
    if (!opts.calculate) {
      opts.calculate = { calc: action };
    }
    action = "calculate";
  }
  const calcOpts = opts.calculate ?? {};
  const calc = String(
    calcOpts.calc ?? (typeof opts.calc === "string" && !["prepare", "calculate", "modify", "extract", "distance"].includes(String(opts.calc)) ? opts.calc : void 0) ?? "distance"
  ).toLowerCase();
  const outName = String(calcOpts.field ?? calc);
  return frames.map((frame) => {
    const pair = resolveLatLon(frame, opts);
    if (!pair) return frame;
    const { lat, lon } = pair;
    if (action === "prepare") {
      return extractFrame(frame, lat, lon);
    }
    if (action === "calculate" || action === "modify") {
      const n = lat.values.length;
      if (calc === "heading") {
        const values = new Array(n).fill(null);
        for (let i = 1; i < n; i++) {
          const h2 = headingDeg(
            Number(lat.values[i - 1]),
            Number(lon.values[i - 1]),
            Number(lat.values[i]),
            Number(lon.values[i])
          );
          values[i] = h2;
          if (values[i - 1] == null) values[i - 1] = h2;
        }
        if (n === 1) values[0] = 0;
        return createDataFrame({
          refId: frame.refId,
          name: frame.name,
          fields: [
            ...frame.fields,
            {
              name: outName === "heading" ? "heading" : outName,
              type: "number",
              values,
              config: { unit: "degree" }
            }
          ]
        });
      }
      if (calc === "area") {
        const values = new Array(n).fill(null);
        if (n >= 3) {
          const toRad2 = (d) => d * Math.PI / 180;
          const R = 6371e3;
          let area = 0;
          const lat0 = toRad2(Number(lat.values[0]));
          const lon0 = toRad2(Number(lon.values[0]));
          for (let i = 1; i < n - 1; i++) {
            const lat1 = toRad2(Number(lat.values[i]));
            const lon1 = toRad2(Number(lon.values[i]));
            const lat2 = toRad2(Number(lat.values[i + 1]));
            const lon2 = toRad2(Number(lon.values[i + 1]));
            const cross = (a, b) => [
              a[1] * b[2] - a[2] * b[1],
              a[2] * b[0] - a[0] * b[2],
              a[0] * b[1] - a[1] * b[0]
            ];
            const toVec = (φ, λ) => [
              Math.cos(φ) * Math.cos(λ),
              Math.cos(φ) * Math.sin(λ),
              Math.sin(φ)
            ];
            const v0 = toVec(lat0, lon0);
            const v1 = toVec(lat1, lon1);
            const v2 = toVec(lat2, lon2);
            const c = cross(
              [v1[0] - v0[0], v1[1] - v0[1], v1[2] - v0[2]],
              [v2[0] - v0[0], v2[1] - v0[1], v2[2] - v0[2]]
            );
            const mag = Math.hypot(c[0], c[1], c[2]);
            area += 0.5 * mag * R * R;
            values[i + 1] = area;
          }
          values[0] = 0;
          values[1] = values[1] ?? 0;
        } else {
          values.fill(0);
        }
        return createDataFrame({
          refId: frame.refId,
          name: frame.name,
          fields: [
            ...frame.fields,
            {
              name: outName === "area" ? "area" : outName,
              type: "number",
              values,
              config: { unit: "areaM2" }
            }
          ]
        });
      }
      const distances = lat.values.map((la, i) => {
        if (i === 0) return 0;
        return haversineM(
          Number(lat.values[0]),
          Number(lon.values[0]),
          Number(la),
          Number(lon.values[i])
        );
      });
      return createDataFrame({
        refId: frame.refId,
        name: frame.name,
        fields: [
          ...frame.fields,
          {
            name: outName === "distance" || outName === "distance_m" ? "distance_m" : outName,
            type: "number",
            values: distances,
            config: { unit: "lengthm" }
          }
        ]
      });
    }
    return frame;
  });
});
registerTransformer("regression", (frames, options = {}) => {
  const modelType = String(options.modelType ?? options.model ?? "linear");
  const degree = Math.min(5, Math.max(1, Number(options.degree ?? 2)));
  const predictionCount = Math.max(0, Number(options.predictionCount ?? 0));
  return frames.map((frame) => {
    const yName = String(options.yFieldName ?? options.fieldName ?? "");
    const xName = String(options.xFieldName ?? "");
    const time = (xName ? findFrameField(frame, xName, frames) : void 0) ?? frame.fields.find((f) => f.type === "time");
    const num2 = (yName ? findFrameField(frame, yName, frames) : void 0) ?? (options.fieldName ? findFrameField(frame, String(options.fieldName), frames) : void 0) ?? frame.fields.find((f) => f.type === "number");
    if (!num2) return frame;
    const xs = (time?.values ?? (xName ? findFrameField(frame, xName, frames)?.values : void 0) ?? num2.values.map((_, i) => i)).map(Number);
    const ys = num2.values.map(Number);
    const n = xs.length || 1;
    let predicted = [];
    if (modelType === "polynomial" && degree >= 2) {
      const d = Math.min(degree, 2);
      if (d === 2) {
        let s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, sy = 0, sxy = 0, sx2y = 0;
        for (let i = 0; i < n; i++) {
          const x = xs[i];
          const y = Number.isFinite(ys[i]) ? ys[i] : 0;
          s0++;
          s1 += x;
          s2 += x * x;
          s3 += x * x * x;
          s4 += x * x * x * x;
          sy += y;
          sxy += x * y;
          sx2y += x * x * y;
        }
        const A = [
          [s0, s1, s2, sy],
          [s1, s2, s3, sxy],
          [s2, s3, s4, sx2y]
        ];
        for (let i = 0; i < 3; i++) {
          const piv = A[i][i] || 1e-12;
          for (let j = i; j < 4; j++) A[i][j] /= piv;
          for (let k = 0; k < 3; k++) {
            if (k === i) continue;
            const f = A[k][i];
            for (let j = i; j < 4; j++) A[k][j] -= f * A[i][j];
          }
        }
        const a = A[0][3], b = A[1][3], c = A[2][3];
        predicted = xs.map((x) => a + b * x + c * x * x);
        if (predictionCount > 0 && xs.length >= 2) {
          const step = xs[xs.length - 1] - xs[xs.length - 2] || 1;
          for (let p = 1; p <= predictionCount; p++) {
            const x = xs[xs.length - 1] + step * p;
            xs.push(x);
            predicted.push(a + b * x + c * x * x);
          }
        }
      }
    } else {
      const sumX = xs.reduce((a, b) => a + (Number.isFinite(b) ? b : 0), 0);
      const sumY = ys.reduce((a, b) => a + (Number.isFinite(b) ? b : 0), 0);
      const sumXY = xs.reduce((a, x, i) => a + x * (Number.isFinite(ys[i]) ? ys[i] : 0), 0);
      const sumXX = xs.reduce((a, x) => a + x * x, 0);
      const den = n * sumXX - sumX * sumX || 1;
      const slope = (n * sumXY - sumX * sumY) / den;
      const intercept = (sumY - slope * sumX) / n;
      predicted = xs.map((x) => intercept + slope * x);
      if (predictionCount > 0 && xs.length >= 2) {
        const step = xs[xs.length - 1] - xs[xs.length - 2] || 1;
        for (let p = 1; p <= predictionCount; p++) {
          const x = xs[xs.length - 1] + step * p;
          xs.push(x);
          predicted.push(intercept + slope * x);
        }
      }
    }
    const fields = [...frame.fields];
    if (predictionCount > 0 && time) {
      const tvals = [...time.values];
      const step = Number(tvals[tvals.length - 1]) - Number(tvals[tvals.length - 2]) || 1;
      for (let p = 1; p <= predictionCount; p++) tvals.push(Number(tvals[tvals.length - 1]) + step);
      return createDataFrame({
        refId: frame.refId,
        name: frame.name,
        fields: [
          { ...time, values: tvals },
          ...frame.fields.filter((f) => f !== time && f !== num2).map((f) => ({
            ...f,
            values: [...f.values, ...new Array(predictionCount).fill(null)]
          })),
          {
            ...num2,
            values: [...num2.values, ...new Array(predictionCount).fill(null)]
          },
          {
            name: `${num2.name} predicted`,
            type: "number",
            values: predicted,
            config: {}
          }
        ]
      });
    }
    return createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: [
        ...fields,
        {
          name: `${num2.name} predicted`,
          type: "number",
          values: predicted.slice(0, num2.values.length),
          config: {}
        }
      ]
    });
  });
});
registerTransformer("smoothing", (frames, options = {}) => {
  const window2 = Math.max(1, Number(options.windowSize ?? options.window ?? 3));
  const algorithm = String(options.algorithm ?? "movingAvg");
  const alpha2 = Math.min(1, Math.max(0.01, Number(options.alpha ?? 2 / (window2 + 1))));
  const fieldName2 = String(options.field ?? options.fieldName ?? "");
  return frames.map(
    (frame) => createDataFrame({
      refId: frame.refId,
      name: frame.name,
      fields: frame.fields.map((f) => {
        if (f.type !== "number") return f;
        if (fieldName2 && !fieldMatchesName(f, fieldName2, frame, frames)) return f;
        let values;
        if (algorithm === "ema") {
          let prev = null;
          values = f.values.map((v) => {
            const n = Number(v);
            if (!Number.isFinite(n)) return prev;
            prev = prev == null ? n : alpha2 * n + (1 - alpha2) * prev;
            return prev;
          });
        } else {
          values = f.values.map((_, i) => {
            const from = Math.max(0, i - window2 + 1);
            const slice = f.values.slice(from, i + 1).map(Number).filter((n) => Number.isFinite(n));
            if (!slice.length) return null;
            return slice.reduce((a, b) => a + b, 0) / slice.length;
          });
        }
        return { ...f, name: `${f.name} smooth`, values };
      })
    })
  );
});
function applyStat(vals, stat) {
  if (!vals.length) return null;
  const s = String(stat || "lastNotNull");
  if (s === "min") return Math.min(...vals);
  if (s === "max") return Math.max(...vals);
  if (s === "mean" || s === "avg") return vals.reduce((a, b) => a + b, 0) / vals.length;
  if (s === "sum") return vals.reduce((a, b) => a + b, 0);
  if (s === "first" || s === "firstNotNull") return vals[0] ?? null;
  if (s === "count") return vals.length;
  if (s === "range") return Math.max(...vals) - Math.min(...vals);
  return vals[vals.length - 1] ?? null;
}
registerTransformer("timeSeriesTable", (frames, options = {}) => {
  const refIdToStatRaw = options.refIdToStat ?? {};
  const rows = [];
  for (const frame of frames) {
    const refId = String(frame.refId ?? "");
    let stat = "lastNotNull";
    const fromMap = refIdToStatRaw[refId];
    if (typeof fromMap === "string") stat = fromMap;
    else if (fromMap && typeof fromMap === "object" && fromMap.stat)
      stat = String(fromMap.stat);
    else if (options[refId] && typeof options[refId] === "object") {
      const o = options[refId];
      if (o?.stat) stat = String(o.stat);
    }
    const nums = frame.fields.filter((f) => f.type === "number");
    for (const num2 of nums) {
      const vals = num2.values.map(Number).filter((n) => Number.isFinite(n));
      const last = vals.length ? vals[vals.length - 1] : null;
      const first = vals.length ? vals[0] : null;
      const avg = vals.length ? vals.reduce((a, b) => a + b, 0) / vals.length : null;
      const statValue = applyStat(vals, stat);
      rows.push({
        Metric: getFieldDisplayName(num2, frame, frames),
        Stat: statValue,
        Last: last,
        First: first,
        Mean: avg,
        Min: vals.length ? Math.min(...vals) : null,
        Max: vals.length ? Math.max(...vals) : null,
        Points: vals.length,
        refId,
        ...num2.labels || {},
        Trend: vals.slice(-20)
      });
    }
  }
  if (!rows.length) return frames;
  const keys = Object.keys(rows[0]).filter((k) => k !== "Trend");
  return [
    createDataFrame({
      refId: frames[0]?.refId,
      name: "timeSeriesTable",
      meta: { preferredVisualisationType: "table" },
      fields: [
        ...keys.map((k) => ({
          name: k,
          type: typeof rows[0][k] === "number" ? "number" : "string",
          values: rows.map((r) => r[k]),
          config: {}
        })),
        {
          name: "Trend",
          type: "other",
          values: rows.map((r) => r.Trend),
          config: { custom: { cellOptions: { type: "sparkline" } } }
        }
      ]
    })
  ];
});
function listStandardTransformers() {
  return listTransformerIds();
}
const standardTransformers = listStandardTransformers();
const V1_SCHEMA_VERSION = 42;
function clone$1(v) {
  return JSON.parse(JSON.stringify(v));
}
function identity$1(to, id) {
  return { id, to, migrate: (d) => d };
}
function mapPanels(dashboard, fn) {
  const panels2 = Array.isArray(dashboard.panels) ? dashboard.panels.map((p) => {
    const next = fn({ ...p });
    if (Array.isArray(next.panels)) {
      next.panels = next.panels.map((c) => fn({ ...c }));
    }
    return next;
  }) : dashboard.panels;
  return { ...dashboard, panels: panels2 };
}
function normalizePanel(panel2) {
  let type = panel2.type || "timeseries";
  if (type === "graph") type = "timeseries";
  if (type === "singlestat") type = "stat";
  return {
    ...panel2,
    id: panel2.id ?? 0,
    type,
    gridPos: panel2.gridPos ?? { x: 0, y: 0, w: 12, h: 8 },
    targets: panel2.targets ?? [],
    options: panel2.options ?? {},
    fieldConfig: panel2.fieldConfig ?? { defaults: {}, overrides: [] }
  };
}
const migrateTo2 = {
  id: "graphite-target-forms",
  to: 2,
  migrate: (dashboard) => dashboard
};
const migrateTo3 = identity$1(3, "panel-id-assignment-moved-to-model");
const migrateTo4 = identity$1(4, "inbound-pulldown-nav-alias");
const migrateTo6 = {
  id: "annotations-list-shape",
  to: 6,
  migrate: (dashboard) => {
    const annotations = dashboard.annotations;
    if (!annotations) return { ...dashboard, annotations: { list: [] } };
    if (Array.isArray(annotations)) return { ...dashboard, annotations: { list: annotations } };
    if (!annotations.list) return { ...dashboard, annotations: { ...annotations, list: [] } };
    return dashboard;
  }
};
const migrateTo7 = identity$1(7, "nav-removed");
const migrateTo8 = {
  id: "panel-links-array",
  to: 8,
  migrate: (dashboard) => mapPanels(dashboard, (p) => {
    if (p.links && !Array.isArray(p.links)) return { ...p, links: [] };
    return p;
  })
};
const migrateTo9 = identity$1(9, "pulldowns-nav-cleanup");
const migrateTo10 = {
  id: "template-variable-refresh",
  to: 10,
  migrate: (dashboard) => {
    const list = dashboard.templating?.list ?? (Array.isArray(dashboard.templating) ? dashboard.templating : []);
    return {
      ...dashboard,
      templating: {
        list: list.map((v) => ({
          ...v,
          refresh: v.refresh === true ? 1 : v.refresh === false ? 0 : v.refresh ?? 0
        }))
      }
    };
  }
};
const migrateTo12 = {
  id: "time-picker-and-y-axis",
  to: 12,
  migrate: (dashboard) => dashboard
};
const migrateTo13 = identity$1(13, "table-styles-moved");
const migrateTo14 = {
  id: "shared-crosshair-to-graph-tooltip",
  to: 14,
  migrate: (dashboard) => ({
    ...dashboard,
    graphTooltip: dashboard.sharedCrosshair ? 1 : dashboard.graphTooltip ?? 0
  })
};
const migrateTo16 = {
  id: "rows-to-panels",
  to: 16,
  migrate: (dashboard) => {
    const rows = dashboard.rows;
    if (!rows?.length || (dashboard.panels?.length ?? 0) > 0) {
      const next2 = { ...dashboard };
      delete next2.rows;
      return next2;
    }
    const panels2 = [];
    let y = 0;
    let id = 1;
    for (const row of rows) {
      panels2.push({
        id: id++,
        type: "row",
        title: row.title ?? "Row",
        gridPos: { x: 0, y, w: 24, h: 1 },
        collapsed: !!row.collapse,
        panels: row.panels ?? [],
        targets: []
      });
      y += 1;
      for (const p of row.panels ?? []) {
        panels2.push({
          ...p,
          id: p.id ?? id++,
          gridPos: p.gridPos ?? { x: 0, y, w: 12, h: 8 }
        });
        y += p.gridPos?.h ?? 8;
      }
    }
    const next = { ...dashboard, panels: panels2 };
    delete next.rows;
    return next;
  }
};
const migrateTo17 = {
  id: "min-span-to-max-per-row",
  to: 17,
  migrate: (dashboard) => mapPanels(dashboard, (p) => {
    if (p.minSpan != null && p.maxPerRow == null) {
      const { minSpan, ...rest } = p;
      return {
        ...rest,
        maxPerRow: Math.floor(24 / Number(minSpan)) || void 0
      };
    }
    return p;
  })
};
const migrateTo18 = {
  id: "gauge-options",
  to: 18,
  migrate: (dashboard) => dashboard
};
const migrateTo19 = {
  id: "panel-links-url",
  to: 19,
  migrate: (dashboard) => mapPanels(dashboard, (p) => {
    if (!Array.isArray(p.links)) return p;
    return {
      ...p,
      links: p.links.map((l) => {
        if (l.url != null) return l;
        if (l.dashboard) return { ...l, url: `dashboard/db/${l.dashboard}` };
        return l;
      })
    };
  })
};
const migrateTo20 = {
  id: "variable-tags",
  to: 20,
  migrate: (dashboard) => dashboard
};
const migrateTo21 = {
  id: "data-links",
  to: 21,
  migrate: (dashboard) => dashboard
};
const migrateTo22 = {
  id: "table-styles-to-field-config-prep",
  to: 22,
  migrate: (dashboard) => dashboard
};
const migrateTo23 = {
  id: "variable-multi-align",
  to: 23,
  migrate: (dashboard) => dashboard
};
const migrateTo24 = {
  id: "angular-table-text-link",
  to: 24,
  migrate: (dashboard) => dashboard
};
const migrateTo25 = {
  id: "constant-variables-hide",
  to: 25,
  migrate: (dashboard) => {
    const list = dashboard.templating?.list ?? [];
    return {
      ...dashboard,
      templating: {
        list: list.map((v) => v.type === "constant" ? { ...v, hide: v.hide ?? 2 } : v)
      }
    };
  }
};
const migrateTo26 = {
  id: "text-panel-options",
  to: 26,
  migrate: (dashboard) => mapPanels(dashboard, (p) => {
    if (p.type !== "text") return p;
    if (p.options?.content != null) return p;
    return {
      ...p,
      options: {
        mode: p.mode ?? p.options?.mode ?? "markdown",
        content: p.content ?? p.options?.content ?? ""
      }
    };
  })
};
const migrateTo27 = {
  id: "variable-refresh-on-load",
  to: 27,
  migrate: (dashboard) => dashboard
};
const migrateTo28 = {
  id: "remove-variable-tags",
  to: 28,
  migrate: (dashboard) => {
    const list = dashboard.templating?.list ?? [];
    return {
      ...dashboard,
      templating: {
        list: list.map((v) => {
          const next = { ...v };
          delete next.tags;
          delete next.tagsQuery;
          delete next.tagValuesQuery;
          delete next.useTags;
          return next;
        })
      }
    };
  }
};
const migrateTo29 = {
  id: "query-variable-refresh",
  to: 29,
  migrate: (dashboard) => dashboard
};
const migrateTo30 = {
  id: "normalize-panels-field-config",
  to: 30,
  migrate: (dashboard) => mapPanels(dashboard, normalizePanel)
};
const migrateTo31 = {
  id: "panel-title-placeholders",
  to: 31,
  migrate: (dashboard) => dashboard
};
const migrateTo32 = {
  id: "timeseries-area-opacity",
  to: 32,
  migrate: (dashboard) => dashboard
};
const migrateTo33 = {
  id: "templating-list-shape",
  to: 33,
  migrate: (dashboard) => {
    const list = dashboard.templating?.list ?? (Array.isArray(dashboard.templating) ? dashboard.templating : []);
    return { ...dashboard, templating: { list } };
  }
};
const migrateTo34 = {
  id: "cloudwatch-query-type",
  to: 34,
  migrate: (dashboard) => dashboard
};
const migrateTo35 = {
  id: "ensure-field-config-overrides",
  to: 35,
  migrate: (dashboard) => mapPanels(dashboard, (p) => ({
    ...p,
    fieldConfig: {
      defaults: p.fieldConfig?.defaults ?? {},
      overrides: p.fieldConfig?.overrides ?? []
    }
  }))
};
const migrateTo36 = {
  id: "datasource-refs-object",
  to: 36,
  migrate: (dashboard) => mapPanels(dashboard, (p) => {
    let next = p;
    if (typeof p.datasource === "string") {
      next = {
        ...next,
        datasource: { type: "prometheus", uid: p.datasource }
      };
    }
    if (Array.isArray(next.targets)) {
      next = {
        ...next,
        targets: next.targets.map(
          (t2) => typeof t2.datasource === "string" ? { ...t2, datasource: { type: "prometheus", uid: t2.datasource } } : t2
        )
      };
    }
    return next;
  })
};
const migrateTo37 = {
  id: "legend-options-alignment",
  to: 37,
  migrate: (dashboard) => dashboard
};
const migrateTo38 = {
  id: "fiscal-year-start-month",
  to: 38,
  migrate: (dashboard) => ({
    ...dashboard,
    fiscalYearStartMonth: dashboard.fiscalYearStartMonth ?? 0
  })
};
const migrateTo39 = {
  id: "refresh-boolean-to-string",
  to: 39,
  migrate: (dashboard) => {
    if (typeof dashboard.refresh === "boolean") {
      return { ...dashboard, refresh: dashboard.refresh ? "30s" : "" };
    }
    return dashboard;
  }
};
const migrateTo40 = {
  id: "timezone-browser-default",
  to: 40,
  migrate: (dashboard) => ({
    ...dashboard,
    timezone: dashboard.timezone ?? ""
  })
};
const migrateTo41 = {
  id: "schema-41-identity",
  to: 41,
  migrate: (dashboard) => dashboard
};
const migrateTo42 = {
  id: "hide-from-functionality",
  to: 42,
  migrate: (dashboard) => mapPanels(dashboard, (p) => {
    const defaults2 = p.fieldConfig?.defaults ?? {};
    const custom = defaults2.custom ?? {};
    if (custom.hideFrom) return p;
    if (Object.keys(custom).length === 0 && !p.fieldConfig) return p;
    return {
      ...p,
      fieldConfig: {
        defaults: {
          ...defaults2,
          custom: {
            ...custom,
            hideFrom: custom.hideFrom ?? {
              legend: false,
              tooltip: false,
              viz: false
            }
          }
        },
        overrides: p.fieldConfig?.overrides ?? []
      }
    };
  })
};
const v1Migrations = [
  migrateTo2,
  migrateTo3,
  migrateTo4,
  migrateTo6,
  migrateTo7,
  migrateTo8,
  migrateTo9,
  migrateTo10,
  migrateTo12,
  migrateTo13,
  migrateTo14,
  migrateTo16,
  migrateTo17,
  migrateTo18,
  migrateTo19,
  migrateTo20,
  migrateTo21,
  migrateTo22,
  migrateTo23,
  migrateTo24,
  migrateTo25,
  migrateTo26,
  migrateTo27,
  migrateTo28,
  migrateTo29,
  migrateTo30,
  migrateTo31,
  migrateTo32,
  migrateTo33,
  migrateTo34,
  migrateTo35,
  migrateTo36,
  migrateTo37,
  migrateTo38,
  migrateTo39,
  migrateTo40,
  migrateTo41,
  migrateTo42
];
function runMigrations(input, migrations) {
  let dashboard = clone$1(input);
  const applied = [];
  for (const migration of [...migrations].sort((a, b) => a.to - b.to)) {
    if (Number(dashboard.schemaVersion ?? 0) >= migration.to) continue;
    const from = Number(dashboard.schemaVersion ?? 0);
    dashboard = migration.migrate(dashboard);
    dashboard.schemaVersion = migration.to;
    applied.push({ id: migration.id, from, to: migration.to });
  }
  return { dashboard, applied };
}
function normalizeDashboard(dashboard) {
  return {
    ...dashboard,
    title: String(dashboard.title ?? "New dashboard"),
    schemaVersion: Math.max(Number(dashboard.schemaVersion ?? 0), V1_SCHEMA_VERSION),
    time: dashboard.time ?? { from: "now-6h", to: "now" },
    templating: dashboard.templating ?? { list: [] },
    annotations: dashboard.annotations ?? { list: [] },
    panels: Array.isArray(dashboard.panels) ? dashboard.panels : []
  };
}
function migrateV1Dashboard(input) {
  const result = runMigrations(input, v1Migrations);
  if (Number(result.dashboard.schemaVersion ?? 0) < V1_SCHEMA_VERSION) {
    result.dashboard.schemaVersion = V1_SCHEMA_VERSION;
  } else {
    result.dashboard.schemaVersion = V1_SCHEMA_VERSION;
  }
  return {
    dashboard: normalizeDashboard(result.dashboard),
    applied: result.applied
  };
}
function migrateDashboard(input) {
  const result = migrateV1Dashboard(input);
  return result.dashboard;
}
function dashboardRoundTrip(input) {
  const migrated = migrateDashboard(input);
  return migrateDashboard(JSON.parse(JSON.stringify(migrated)));
}
function preserveUnknownFields(original, migrated) {
  const known = /* @__PURE__ */ new Set([
    "uid",
    "title",
    "description",
    "tags",
    "timezone",
    "schemaVersion",
    "version",
    "editable",
    "graphTooltip",
    "time",
    "timepicker",
    "refresh",
    "panels",
    "templating",
    "annotations",
    "links",
    "fiscalYearStartMonth",
    "weekStart",
    "liveNow",
    "rows",
    "style",
    "gnetId"
  ]);
  for (const [k, v] of Object.entries(original)) {
    if (!known.has(k) && !(k in migrated)) {
      migrated[k] = v;
    }
  }
  for (const [k, v] of Object.entries(original)) {
    if (k.startsWith("x-") || k.startsWith("__")) {
      migrated[k] = v;
    }
  }
  return migrated;
}
function formattedValueToString(val) {
  return `${val.prefix ?? ""}${val.text}${val.suffix ?? ""}`;
}
function toFixed(value, decimals) {
  if (decimals == null) {
    if (!Number.isFinite(value)) return String(value);
    if (Number.isInteger(value) || Math.abs(value - Math.round(value)) < 1e-9) {
      return String(Math.round(value));
    }
    const abs = Math.abs(value);
    const d = abs >= 100 ? 0 : abs >= 1 ? 1 : abs >= 0.01 ? 2 : 3;
    return String(Number(value.toFixed(d)));
  }
  return value.toFixed(Math.max(0, Math.min(10, Math.floor(decimals))));
}
function toFixedUnit(unit = "") {
  return (value, decimals) => ({
    text: toFixed(value, decimals),
    suffix: unit ? ` ${unit}` : void 0
  });
}
function scaledUnits(factor, extArray, offset = 0) {
  return (value, decimals) => {
    if (value === null || value === void 0 || Number.isNaN(value)) {
      return { text: "" };
    }
    let si = offset;
    let v = Math.abs(value);
    while (v >= factor && si < extArray.length - 1) {
      v /= factor;
      si += 1;
    }
    const sign = value < 0 ? "-" : "";
    return {
      // When decimals is null/undefined, toFixed uses auto precision (Grafana axis ticks).
      text: `${sign}${toFixed(v, decimals)}`,
      suffix: extArray[si] ? ` ${extArray[si]}` : void 0
    };
  };
}
function booleanValueFormatter(t2 = "True", f = "False") {
  return (value) => ({ text: value ? t2 : f });
}
function locale(value, decimals) {
  try {
    return {
      text: value.toLocaleString(void 0, {
        maximumFractionDigits: decimals ?? 2,
        minimumFractionDigits: decimals ?? void 0
      })
    };
  } catch {
    return { text: toFixed(value, decimals) };
  }
}
function stringFormatter(value) {
  return { text: value == null ? "" : String(value) };
}
function dtdhms(value) {
  if (!Number.isFinite(value)) return { text: String(value) };
  const sign = value < 0 ? "-" : "";
  let s = Math.floor(Math.abs(value));
  const d = Math.floor(s / 86400);
  s -= d * 86400;
  const h2 = Math.floor(s / 3600);
  s -= h2 * 3600;
  const m = Math.floor(s / 60);
  s -= m * 60;
  const parts = [];
  if (d) parts.push(`${d}d`);
  if (h2 || parts.length) parts.push(`${h2}h`);
  if (m || parts.length) parts.push(`${m}m`);
  parts.push(`${s}s`);
  return { text: `${sign}${parts.join(" ")}` };
}
function dateTimeAsIso(value) {
  try {
    return { text: new Date(value).toISOString() };
  } catch {
    return { text: String(value) };
  }
}
function dateTimeAsSystem(value, _decimals, _scaled, timeZone) {
  try {
    const d = new Date(value);
    if (Number.isNaN(d.getTime())) return { text: String(value) };
    const pad = (n) => String(n).padStart(2, "0");
    const tz = String(timeZone || "browser").toLowerCase();
    const useUtc = tz === "utc" || tz === "gmt" || tz === "etc/utc";
    const Y = useUtc ? d.getUTCFullYear() : d.getFullYear();
    const M = useUtc ? d.getUTCMonth() + 1 : d.getMonth() + 1;
    const D = useUtc ? d.getUTCDate() : d.getDate();
    const h2 = useUtc ? d.getUTCHours() : d.getHours();
    const m = useUtc ? d.getUTCMinutes() : d.getMinutes();
    const s = useUtc ? d.getUTCSeconds() : d.getSeconds();
    const text = `${Y}-${pad(M)}-${pad(D)} ${pad(h2)}:${pad(m)}:${pad(s)}`;
    return { text };
  } catch {
    return { text: String(value) };
  }
}
const index$3 = /* @__PURE__ */ new Map();
function register$3(id, fn) {
  index$3.set(id, fn);
}
function build() {
  if (index$3.size) return;
  register$3("none", (v, d) => {
    if (d != null) return { text: Number(v).toFixed(d) };
    if (!Number.isFinite(v)) return { text: String(v) };
    if (Number.isInteger(v) || Math.abs(v - Math.round(v)) < 1e-9)
      return { text: String(Math.round(v)) };
    const abs = Math.abs(v);
    if (abs >= 100 && Math.abs(v - Math.round(v)) < 0.5) return { text: String(Math.round(v)) };
    const decimals = abs >= 1e3 ? 0 : abs >= 1 ? 1 : abs >= 0.01 ? 2 : 3;
    return { text: String(Number(v.toFixed(decimals))) };
  });
  register$3("short", scaledUnits(1e3, ["", "K", "Mil", "Bil", "Tri"]));
  register$3("percent", (v, d) => ({
    text: d == null ? String(v) : v.toFixed(d),
    suffix: "%"
  }));
  register$3("percentunit", (v, d) => {
    const p = v * 100;
    return {
      text: d == null ? String(Number(p.toPrecision(12))) : p.toFixed(d),
      suffix: "%"
    };
  });
  register$3("locale", (v, d) => locale(v, d));
  register$3("string", (_v) => stringFormatter(_v));
  register$3("bool", booleanValueFormatter());
  register$3("boolean", booleanValueFormatter());
  for (const u of ["ns", "µs", "ms", "s", "m", "h", "d"]) {
    register$3(u, toFixedUnit(u));
  }
  register$3("bytes", scaledUnits(1024, ["B", "KiB", "MiB", "GiB", "TiB", "PiB"]));
  register$3("decbytes", scaledUnits(1e3, ["B", "kB", "MB", "GB", "TB", "PB"]));
  register$3("bits", scaledUnits(1e3, ["b", "Kbit", "Mbit", "Gbit", "Tbit"]));
  register$3("decbits", scaledUnits(1e3, ["b", "Kbit", "Mbit", "Gbit", "Tbit"]));
  register$3("kbytes", scaledUnits(1024, ["KiB", "MiB", "GiB", "TiB"]));
  register$3("mbytes", scaledUnits(1024, ["MiB", "GiB", "TiB"]));
  for (const u of ["cps", "ops", "reqps", "rps", "wps", "iops", "binBps", "Bps", "pps"]) {
    register$3(u, toFixedUnit(u));
  }
  register$3("dateTimeAsIso", (v) => dateTimeAsIso(v));
  register$3("dateTimeAsSystem", (v) => dateTimeAsSystem(v));
  register$3("sci", (v, d) => ({ text: v.toExponential(d ?? 2) }));
  register$3("humidity", toFixedUnit("%H"));
  register$3("dB", toFixedUnit("dB"));
  register$3("dBm", toFixedUnit("dBm"));
  register$3("celsius", toFixedUnit("°C"));
  register$3("fahrenheit", toFixedUnit("°F"));
  register$3("farenheit", toFixedUnit("°F"));
  register$3("lengthm", toFixedUnit("m"));
  register$3("lengthmm", toFixedUnit("mm"));
  register$3("velocityms", toFixedUnit("m/s"));
  register$3("bps", scaledUnits(1e3, ["b/s", "Kb/s", "Mb/s", "Gb/s", "Tb/s"]));
  register$3("dtdhms", (v) => dtdhms(v));
  register$3("qps", toFixedUnit("qps"));
  register$3("hertz", scaledUnits(1e3, ["Hz", "kHz", "MHz", "GHz", "THz"]));
  register$3("volt", scaledUnits(1e3, ["V", "kV", "MV", "GV"]));
  register$3("rotrpm", toFixedUnit("rpm"));
}
function getValueFormat(id) {
  build();
  if (!id) return toFixedUnit("");
  if (index$3.has(id)) return index$3.get(id);
  if (id.startsWith("currency")) {
    const sym = id.split(":")[1] || "$";
    return (v, d) => ({
      text: (d == null ? v : Number(v.toFixed(d))).toString(),
      prefix: sym
    });
  }
  if (id.startsWith("time:")) {
    return (v) => dateTimeAsIso(v);
  }
  return toFixedUnit(id);
}
function listValueFormatIds() {
  build();
  return [...index$3.keys()].sort();
}
function formatValueWithUnit(value, unit, decimals) {
  return getValueFormat(unit)(value, decimals);
}
function sortThresholds(steps) {
  return [...steps].sort((a, b) => a.value - b.value);
}
function getActiveThreshold(value, thresholds) {
  if (!thresholds?.steps?.length) return void 0;
  const steps = sortThresholds(thresholds.steps);
  let active = steps[0];
  for (const step of steps) {
    if (value >= step.value) active = step;
  }
  return active;
}
function applyValueMappings(value, mappings) {
  if (!mappings?.length) return void 0;
  for (const m of mappings) {
    if (m.type === "value") {
      const opts = m.options;
      const key = String(value);
      if (opts[key]?.text != null) return opts[key].text;
    }
    if (m.type === "range") {
      const opts = m.options;
      const n = Number(value);
      if (!Number.isNaN(n) && (opts.from == null || n >= opts.from) && (opts.to == null || n <= opts.to)) {
        return opts.result?.text;
      }
    }
    if (m.type === "regex") {
      const opts = m.options;
      if (opts.pattern) {
        try {
          if (new RegExp(opts.pattern).test(String(value ?? ""))) return opts.result?.text;
        } catch {
        }
      }
    }
    if (m.type === "special") {
      const opts = m.options;
      if (opts.match === "null" && (value == null || value === "")) return opts.result?.text;
      if (opts.match === "nan" && typeof value === "number" && Number.isNaN(value))
        return opts.result?.text;
      if (opts.match === "true" && value === true) return opts.result?.text;
      if (opts.match === "false" && value === false) return opts.result?.text;
      if (opts.match === "empty" && value === "") return opts.result?.text;
    }
  }
  return void 0;
}
const NAMED_VIZ_COLORS = {
  "green": "#73BF69",
  "red": "#F2495C",
  "yellow": "#FADE2A",
  "orange": "#FF9830",
  "blue": "#5794F2",
  "purple": "#B877D9",
  "gray": "#808080",
  "grey": "#808080",
  "super-light-text": "#CCCCDC",
  "text": "#CCCCDC"
};
const DEFAULT_THRESHOLDS_STEPS = [
  { value: Number.NEGATIVE_INFINITY, color: "green" },
  { value: 80, color: "red" }
];
function resolveVizColor(color) {
  if (!color) return void 0;
  if (color.startsWith("#") || color.startsWith("rgb")) return color;
  return NAMED_VIZ_COLORS[color] ?? NAMED_VIZ_COLORS[color.toLowerCase()] ?? color;
}
const GRYLRD_STOPS = [
  [115, 191, 105],
  // green #73BF69
  [226, 192, 61],
  // mid (Grafana fieldColor.test calcFn(_, 0.5))
  [242, 73, 92]
  // red #F2495C
];
function continuousGrYlRd(percent) {
  const t2 = Math.max(0, Math.min(1, percent));
  const stops = GRYLRD_STOPS;
  const x = t2 * (stops.length - 1);
  const i = Math.min(Math.floor(x), stops.length - 2);
  const f = x - i;
  const a = stops[i];
  const b = stops[i + 1];
  const r = Math.round(a[0] + (b[0] - a[0]) * f);
  const g = Math.round(a[1] + (b[1] - a[1]) * f);
  const bl = Math.round(a[2] + (b[2] - a[2]) * f);
  return `rgb(${r}, ${g}, ${bl})`;
}
function getFieldColor(value, config2 = {}) {
  if (config2.color?.mode === "fixed" && config2.color.fixedColor) {
    return resolveVizColor(config2.color.fixedColor);
  }
  if (config2.color?.mode === "palette-classic") {
    return "#7EB26D";
  }
  if (config2.color?.mode === "continuous-GrYlRd" || config2.color?.mode === "continuous-RdYlGr") {
    const min = config2.min ?? 0;
    const max = config2.max ?? 100;
    const delta = max - min || 1;
    let percent = (value - min) / delta;
    if (!Number.isFinite(percent)) percent = 0;
    percent = Math.max(0, Math.min(1, percent));
    if (config2.color?.mode === "continuous-RdYlGr") percent = 1 - percent;
    return continuousGrYlRd(percent);
  }
  const thresholds = config2.thresholds?.steps?.length ? config2.thresholds : { steps: DEFAULT_THRESHOLDS_STEPS };
  return resolveVizColor(getActiveThreshold(value, thresholds)?.color);
}
function anyToNumber(value) {
  if (value == null || value === "") return Number.NaN;
  if (typeof value === "number") return value;
  if (typeof value === "boolean") return value ? 1 : 0;
  const n = Number(value);
  return n;
}
function toStringProcessor(value) {
  return {
    text: value == null ? "" : String(value),
    numeric: anyToNumber(value)
  };
}
function getDisplayProcessor(options) {
  if (!options?.field) return toStringProcessor;
  const field = options.field;
  const config2 = field.config ?? {};
  let unit = config2.unit;
  if (field.type === "time" && !unit) unit = "dateTimeAsSystem";
  if (field.type === "boolean" && !unit) unit = "bool";
  if (field.type === "string" && !unit) unit = "string";
  const formatFunc = getValueFormat(unit || "none");
  return (value, adjacentDecimals) => {
    const mappedText = applyValueMappings(value, config2.mappings);
    const mappedColor = getMappingColor(value, config2.mappings);
    if (unit === "string") {
      return {
        text: mappedText ?? (value == null ? "" : String(value)),
        numeric: Number.NaN,
        color: mappedColor ?? getFieldColor(anyToNumber(value), config2)
      };
    }
    const numeric = anyToNumber(value);
    if (mappedText != null) {
      return {
        text: mappedText,
        numeric,
        color: mappedColor ?? (Number.isFinite(numeric) ? getFieldColor(numeric, config2) : void 0)
      };
    }
    if (value == null || value === "") {
      return {
        text: config2.noValue != null ? String(config2.noValue) : "-",
        numeric: Number.NaN
      };
    }
    if (typeof value === "number" && Number.isNaN(value)) {
      return { text: "NaN", numeric: Number.NaN };
    }
    if (value === Infinity || value === -Infinity) {
      return { text: String(value), numeric: value };
    }
    const decimals = adjacentDecimals ?? config2.decimals;
    let text;
    let prefix;
    let suffix;
    if (Number.isFinite(numeric)) {
      let fv;
      if (unit === "dateTimeAsSystem" || unit === "dateTimeAsIso") {
        fv = dateTimeAsSystem(
          numeric,
          decimals,
          void 0,
          options?.timeZone
        );
        if (unit === "dateTimeAsIso") {
          try {
            fv = { text: new Date(numeric).toISOString() };
          } catch {
            fv = dateTimeAsSystem(
              numeric,
              decimals,
              void 0,
              options?.timeZone
            );
          }
        }
      } else {
        fv = formatFunc(numeric, decimals);
      }
      text = fv.text;
      prefix = fv.prefix;
      suffix = fv.suffix;
    } else {
      text = String(value);
    }
    let percent;
    if (Number.isFinite(numeric) && config2.min != null && config2.max != null && config2.max !== config2.min) {
      percent = (numeric - Number(config2.min)) / (Number(config2.max) - Number(config2.min));
      percent = Math.max(0, Math.min(1, percent));
    }
    let color = mappedColor;
    if (!color && Number.isFinite(numeric)) {
      if (config2.thresholds?.mode === "percentage" && percent != null) {
        color = getActiveThreshold(percent * 100, {
          steps: sortThresholds(config2.thresholds.steps).map((s) => ({
            ...s
            // steps already 0-100 in percentage mode
          }))
        })?.color;
      } else {
        color = getFieldColor(numeric, config2);
      }
    }
    const display = {
      text,
      numeric: Number.isFinite(numeric) ? numeric : Number.NaN,
      prefix,
      suffix,
      color,
      percent
    };
    return display;
  };
}
function getRawDisplayProcessor() {
  return (value) => ({
    text: value == null ? "" : String(value),
    numeric: anyToNumber(value)
  });
}
function getMappingColor(value, mappings) {
  if (!mappings?.length) return void 0;
  for (const m of mappings) {
    if (m.type === "value") {
      const opts = m.options;
      const hit = opts[String(value)];
      if (hit?.color) return hit.color;
    }
    if (m.type === "range") {
      const opts = m.options;
      const n = Number(value);
      if (!Number.isNaN(n) && (opts.from == null || n >= opts.from) && (opts.to == null || n <= opts.to)) {
        if (opts.result?.color) return opts.result.color;
      }
    }
  }
  return void 0;
}
function displayValueToString(v) {
  return formattedValueToString(v);
}
const CLASSIC_PALETTE_DARK = [
  "#73BF69",
  // green
  "#F2CC0C",
  // semi-dark-yellow
  "#5794F2",
  // blue
  "#FF9830",
  // orange
  "#F2495C",
  // red
  "#B877D9",
  // purple
  "#37872D",
  // dark-green
  "#E0B400",
  // dark-yellow
  "#1F60C4",
  // dark-blue
  "#FA6400",
  // dark-orange
  "#C4162A",
  // dark-red
  "#8F3BB8",
  // dark-purple
  "#C8F2C2",
  // super-light-green
  "#FFF899",
  // super-light-yellow
  "#C0D8FF"
  // super-light-blue
];
const CLASSIC_PALETTE_LIGHT = [
  "#56A64B",
  // green (one notch darker)
  "#E0B400",
  // semi-dark-yellow → dark-yellow
  "#3274D9",
  // blue
  "#FF780A",
  // orange
  "#E02F44",
  // red
  "#A352CC",
  // purple
  "#19730E",
  // dark-green
  "#CC9D00",
  // dark-yellow
  "#1250B0",
  // dark-blue
  "#E55400",
  // dark-orange
  "#AD0317",
  // dark-red
  "#7C2EA3",
  // dark-purple
  "#96D98D",
  // super-light-green
  "#FFEE52",
  // super-light-yellow
  "#8AB8FF"
  // super-light-blue
];
const CLASSIC_PALETTE = CLASSIC_PALETTE_DARK;
function resolveThemeModeHint(mode2) {
  if (mode2 === "light" || mode2 === "dark") return mode2;
  if (typeof document !== "undefined") {
    const t2 = document.documentElement.dataset.theme || document.documentElement.dataset.theme || document.body?.dataset?.theme || "";
    if (String(t2).toLowerCase() === "light") return "light";
  }
  return "dark";
}
function getClassicPalette$1(mode2) {
  return resolveThemeModeHint(mode2) === "light" ? CLASSIC_PALETTE_LIGHT : CLASSIC_PALETTE_DARK;
}
function resolveNamedColor(color, ctx) {
  if (!color) return color;
  if (color.startsWith("#") || color.startsWith("rgb") || color.startsWith("hsl") || color.startsWith("var(")) {
    return color;
  }
  if (ctx?.getColorByName) return ctx.getColorByName(color);
  const mode2 = resolveThemeModeHint(ctx?.mode);
  const table = mode2 === "light" ? CLASSIC_PALETTE_LIGHT : CLASSIC_PALETTE_DARK;
  const names = [
    "green",
    "semi-dark-yellow",
    "blue",
    "orange",
    "red",
    "purple",
    "dark-green",
    "dark-yellow",
    "dark-blue",
    "dark-orange",
    "dark-red",
    "dark-purple",
    "super-light-green",
    "super-light-yellow",
    "super-light-blue"
  ];
  const idx = names.indexOf(color);
  if (idx >= 0) return table[idx];
  return color;
}
function getFieldSeriesColor(fieldName2, seriesIndex, config2 = {}, theme) {
  const ctx = typeof theme === "string" ? { mode: theme } : theme ?? {};
  const palette2 = getClassicPalette$1(ctx.mode);
  if (config2.color?.mode === "fixed" && config2.color.fixedColor) {
    return resolveNamedColor(config2.color.fixedColor, ctx);
  }
  if (config2.color?.mode === "palette-classic" || !config2.color?.mode) {
    return palette2[seriesIndex % palette2.length];
  }
  return palette2[Math.abs(hash(fieldName2)) % palette2.length];
}
function hash(s) {
  let h2 = 0;
  for (let i = 0; i < s.length; i++) h2 = h2 * 31 + s.charCodeAt(i) | 0;
  return h2;
}
function getThresholdColor(value, config2, theme) {
  const ctx = typeof theme === "string" ? { mode: theme } : theme ?? {};
  const c = getActiveThreshold(value, config2.thresholds)?.color;
  return c ? resolveNamedColor(c, ctx) : void 0;
}
function formatUnit(value, unit, decimals = 2) {
  return formattedValueToString(formatValueWithUnit(value, unit, decimals));
}
function formatValue(value, config2 = {}) {
  const processor = getDisplayProcessor({
    field: {
      name: "v",
      type: typeof value === "string" ? "string" : "number",
      config: config2,
      values: []
    }
  });
  return formattedValueToString(processor(value));
}
function reduceField(field, reducers = ["lastNotNull"]) {
  const r = reduceField$1(field, reducers);
  const out = {};
  for (const [k, v] of Object.entries(r)) {
    if (typeof v === "boolean") out[k] = v ? 1 : 0;
    else if (Array.isArray(v)) out[k] = v.length;
    else out[k] = v;
  }
  return out;
}
function identity(v) {
  return v;
}
function numberOrUndefined(v) {
  if (v === "" || v === null || v === void 0) return void 0;
  const n = Number(v);
  return Number.isFinite(n) ? n : void 0;
}
const STANDARD_OVERRIDE_PROCESSORS = [
  {
    id: "unit",
    name: "单位",
    path: "unit",
    process: (v) => v == null || v === "" ? void 0 : String(v)
  },
  {
    id: "decimals",
    name: "小数位",
    path: "decimals",
    process: numberOrUndefined
  },
  { id: "min", name: "最小值", path: "min", process: numberOrUndefined },
  { id: "max", name: "最大值", path: "max", process: numberOrUndefined },
  {
    id: "fieldMinMax",
    name: "字段最小/最大",
    path: "fieldMinMax",
    process: (v) => v == null ? void 0 : Boolean(v)
  },
  {
    id: "displayName",
    name: "显示名称",
    path: "displayName",
    process: (v) => v == null || v === "" ? void 0 : String(v)
  },
  {
    id: "noValue",
    name: "空值显示",
    path: "noValue",
    process: (v) => v == null ? void 0 : String(v)
  },
  { id: "color", name: "颜色", path: "color", process: identity },
  { id: "thresholds", name: "阈值", path: "thresholds", process: identity },
  { id: "mappings", name: "值映射", path: "mappings", process: identity },
  { id: "links", name: "数据链接", path: "links", process: identity },
  { id: "actions", name: "动作", path: "actions", process: identity },
  {
    id: "filterable",
    name: "可过滤",
    path: "filterable",
    process: (v) => v == null ? void 0 : Boolean(v)
  }
];
const processorById = new Map(STANDARD_OVERRIDE_PROCESSORS.map((p) => [p.id, p]));
function getOverrideProcessor(id) {
  if (processorById.has(id)) return processorById.get(id);
  if (id.startsWith("custom.")) {
    return {
      id,
      name: id.slice(7),
      path: id,
      process: identity
    };
  }
  return {
    id,
    name: id,
    path: id,
    process: identity,
    shouldApply: () => false
  };
}
function processOverrideValue(id, value) {
  return getOverrideProcessor(id).process(value);
}
function isKnownOverrideProperty(id) {
  return processorById.has(id) || id.startsWith("custom.");
}
function applyProcessedProperty(config2, id, raw) {
  const processor = getOverrideProcessor(id);
  if (processor.shouldApply === void 0 && !isKnownOverrideProperty(id) && !id.startsWith("custom.")) {
    return config2;
  }
  const value = processor.process(raw);
  if (value === void 0) {
    const next = { ...config2 };
    if (id.startsWith("custom.")) {
      const custom = { ...config2.custom ?? {} };
      delete custom[id.slice(7)];
      return { ...config2, custom };
    }
    delete next[id];
    return next;
  }
  if (id.startsWith("custom.")) {
    const key = id.slice(7);
    return { ...config2, custom: { ...config2.custom ?? {}, [key]: value } };
  }
  if (id === "filterable") {
    return {
      ...config2,
      filterable: value,
      custom: { ...config2.custom ?? {}, filterable: value }
    };
  }
  return { ...config2, [id]: value };
}
const compiledRulesCache = /* @__PURE__ */ new WeakMap();
const compiledRulesLru = [];
const COMPILED_RULES_LRU_MAX = 32;
function defaultsCacheKey(defaults2) {
  const unit = defaults2.unit ?? "";
  const decimals = defaults2.decimals ?? "";
  const displayName = defaults2.displayName ?? "";
  const customKeys = defaults2.custom ? Object.keys(defaults2.custom).join(",") : "";
  return `${unit}|${decimals}|${displayName}|${customKeys}`;
}
function rulesSignature(overrides) {
  let s = String(overrides.length);
  for (const r of overrides) {
    s += `|${r.matcher?.id}:${JSON.stringify(r.matcher?.options)}:${r.properties?.length ?? 0}`;
    for (const p of r.properties || []) s += `:${p.id}`;
  }
  return s;
}
function compileOverrideRules(overrides = []) {
  return overrides.map((rule) => ({
    matcher: rule.matcher,
    properties: rule.properties || [],
    match: getFieldMatcher(rule.matcher || { id: "" })
  }));
}
function getCompiledRules(overrides, defaults2) {
  const dKey = defaultsCacheKey(defaults2);
  const weakHit = compiledRulesCache.get(overrides);
  if (weakHit && weakHit.defaultsKey === dKey) return weakHit.rules;
  const sig = `${rulesSignature(overrides)}::${dKey}`;
  const lruHit = compiledRulesLru.find((e) => e.key === sig);
  if (lruHit) {
    compiledRulesCache.set(overrides, {
      rules: lruHit.rules,
      defaultsKey: dKey
    });
    return lruHit.rules;
  }
  const rules = compileOverrideRules(overrides);
  compiledRulesCache.set(overrides, { rules, defaultsKey: dKey });
  compiledRulesLru.unshift({ key: sig, rules });
  if (compiledRulesLru.length > COMPILED_RULES_LRU_MAX) compiledRulesLru.pop();
  return rules;
}
function clearFieldOverrideCompileCache() {
  compiledRulesLru.length = 0;
}
function matchField(field, matcher, frame) {
  return matchFieldWithRegistry(field, matcher, frame);
}
function normalizePropId(id) {
  if (id === "unit" || id === "decimals" || id === "displayName" || id === "min" || id === "max" || id === "noValue" || id === "fieldMinMax" || id === "filterable" || id === "color" || id === "thresholds" || id === "mappings" || id === "links" || id === "actions") {
    return id;
  }
  if (id.startsWith("standardOptions.")) return id.slice("standardOptions.".length);
  if (id.startsWith("custom.")) return id;
  const customKeys = [
    "drawStyle",
    "lineInterpolation",
    "lineWidth",
    "fillOpacity",
    "gradientMode",
    "spanNulls",
    "showPoints",
    "pointSize",
    "stacking",
    "axisPlacement",
    "axisLabel",
    "axisSoftMin",
    "axisSoftMax",
    "axisCenteredZero",
    "hideFrom",
    "scaleDistribution",
    "thresholdsStyle",
    "barAlignment",
    "lineStyle",
    "insertNulls",
    "barWidthFactor"
  ];
  if (customKeys.includes(id)) return `custom.${id}`;
  return id;
}
function setNested(config2, path, value) {
  if (path.startsWith("custom.")) {
    const rest = path.slice(7);
    const custom = { ...config2.custom ?? {} };
    const parts = rest.split(".");
    let cur = custom;
    for (let i = 0; i < parts.length - 1; i++) {
      cur[parts[i]] = cur[parts[i]] && typeof cur[parts[i]] === "object" ? { ...cur[parts[i]] } : {};
      cur = cur[parts[i]];
    }
    cur[parts[parts.length - 1]] = value;
    return { ...config2, custom };
  }
  if (path.includes(".")) {
    const parts = path.split(".");
    const root = { ...config2 };
    let cur = root;
    for (let i = 0; i < parts.length - 1; i++) {
      cur[parts[i]] = cur[parts[i]] && typeof cur[parts[i]] === "object" ? { ...cur[parts[i]] } : {};
      cur = cur[parts[i]];
    }
    cur[parts[parts.length - 1]] = value;
    return root;
  }
  return { ...config2, [path]: value };
}
function applyFieldOverrides(frames, defaults2 = {}, overrides = []) {
  const compiled = getCompiledRules(overrides, defaults2);
  return frames.map((frame) => ({
    ...frame,
    fields: frame.fields.map((field) => {
      const mergedCustom = {
        ...defaults2.custom ?? {},
        ...field.config?.custom ?? {}
      };
      let config2 = {
        ...defaults2,
        ...field.config,
        ...Object.keys(mergedCustom).length ? { custom: mergedCustom } : {}
      };
      for (const [ri, element] of compiled.entries()) {
        const rule = element;
        if (!rule.match(field, frame, frames)) continue;
        const properties = overrides[ri]?.properties ?? rule.properties;
        for (const prop of properties) {
          const id = normalizePropId(prop.id);
          if (!isKnownOverrideProperty(id) && !id.includes(".")) {
            continue;
          }
          const processed = processOverrideValue(id, prop.value);
          if (id.startsWith("custom.") || !isKnownOverrideProperty(id)) {
            config2 = setNested(config2, id, processed);
          } else {
            config2 = applyProcessedProperty(config2, id, prop.value);
          }
          if (id === "color" && prop.value && typeof prop.value === "object" && prop.value.fixedColor) {
            config2 = {
              ...config2,
              color: {
                ...config2.color,
                ...prop.value,
                mode: prop.value.mode ?? "fixed"
              }
            };
          }
        }
      }
      return { ...field, config: config2 };
    })
  }));
}
var VariableOrigin = /* @__PURE__ */ ((VariableOrigin2) => {
  VariableOrigin2["Series"] = "series";
  VariableOrigin2["Field"] = "field";
  VariableOrigin2["Fields"] = "fields";
  VariableOrigin2["Value"] = "value";
  VariableOrigin2["BuiltIn"] = "built-in";
  VariableOrigin2["Template"] = "template";
  return VariableOrigin2;
})(VariableOrigin || {});
var VariableSuggestionsScope = /* @__PURE__ */ ((VariableSuggestionsScope2) => {
  VariableSuggestionsScope2["Values"] = "values";
  return VariableSuggestionsScope2;
})(VariableSuggestionsScope || {});
const DataLinkBuiltInVars = {
  keepTime: "__url_time_range",
  timeRangeFrom: "__from",
  timeRangeTo: "__to",
  includeVars: "__all_variables",
  seriesName: "__series.name",
  fieldName: "__field.name",
  fieldDisplayName: "__field.displayName",
  valueTime: "__value.time",
  valueNumeric: "__value.numeric",
  valueText: "__value.text",
  valueRaw: "__value.raw",
  valueCalc: "__value.calc"
};
const timeRangeVars = [
  {
    value: DataLinkBuiltInVars.keepTime,
    label: "Time range",
    documentation: "Adds current time range",
    origin: "built-in"
    /* BuiltIn */
  },
  {
    value: DataLinkBuiltInVars.timeRangeFrom,
    label: "Time range: from",
    documentation: "Adds current time range's from value",
    origin: "built-in"
    /* BuiltIn */
  },
  {
    value: DataLinkBuiltInVars.timeRangeTo,
    label: "Time range: to",
    documentation: "Adds current time range's to value",
    origin: "built-in"
    /* BuiltIn */
  }
];
const seriesVars = [
  {
    value: DataLinkBuiltInVars.seriesName,
    label: "Name",
    documentation: "Name of the series",
    origin: "series"
    /* Series */
  }
];
const valueVars = [
  {
    value: DataLinkBuiltInVars.valueNumeric,
    label: "Numeric",
    documentation: "Numeric representation of selected value",
    origin: "value"
    /* Value */
  },
  {
    value: DataLinkBuiltInVars.valueText,
    label: "Text",
    documentation: "Text representation of selected value",
    origin: "value"
    /* Value */
  },
  {
    value: DataLinkBuiltInVars.valueRaw,
    label: "Raw",
    documentation: "Raw value",
    origin: "value"
    /* Value */
  }
];
const valueTimeVar = {
  value: DataLinkBuiltInVars.valueTime,
  label: "Time",
  documentation: "Time value of the clicked datapoint (in ms epoch)",
  origin: "value"
  /* Value */
};
function buildLabelPath(label) {
  return label.includes(".") || label.trim().includes(" ") ? `["${label}"]` : `.${label}`;
}
function getFieldVars(dataFrames) {
  const labels = /* @__PURE__ */ new Set();
  for (const df of dataFrames) {
    for (const f of df.fields) {
      if (f.labels) {
        for (const k of Object.keys(f.labels)) labels.add(k);
      }
    }
  }
  return [
    {
      value: DataLinkBuiltInVars.fieldName,
      label: "Name",
      documentation: "Field name of the clicked datapoint",
      origin: "field"
      /* Field */
    },
    {
      value: DataLinkBuiltInVars.fieldDisplayName,
      label: "Display name",
      documentation: "Display name of the field (includes overrides and transformations)",
      origin: "field"
      /* Field */
    },
    ...[...labels].map((label) => ({
      value: `__field.labels${buildLabelPath(label)}`,
      label: `labels.${label}`,
      documentation: `${label} label value`,
      origin: "field"
      /* Field */
    }))
  ];
}
function getDataFrameVars(dataFrames) {
  if (dataFrames.length !== 1) return [];
  const suggestions = [];
  const keys = /* @__PURE__ */ new Set();
  const frame = dataFrames[0];
  let numericName;
  let titleName;
  for (const field of frame.fields) {
    if (String(field.type) === "nestedFrames") continue;
    const disp = getFieldDisplayName(field, frame, dataFrames);
    if (keys.has(disp)) continue;
    keys.add(disp);
    const path = buildLabelPath(disp);
    suggestions.push({
      value: `__data.fields${path}`,
      label: disp,
      documentation: `Formatted value for ${disp} on the same row`,
      origin: "fields"
      /* Fields */
    });
    if (!numericName && field.type === "number") {
      numericName = disp;
    }
    if (!titleName && field.config?.displayName && field.config.displayName !== field.name) {
      titleName = disp;
    }
  }
  if (suggestions.length) {
    suggestions.push({
      value: `__data.fields[0]`,
      label: "Select by index",
      documentation: "Enter the field order",
      origin: "fields"
      /* Fields */
    });
  }
  if (numericName) {
    const path = buildLabelPath(numericName);
    suggestions.push({
      value: `__data.fields${path}.numeric`,
      label: "Show numeric value",
      documentation: "the numeric field value",
      origin: "fields"
      /* Fields */
    });
    suggestions.push({
      value: `__data.fields${path}.text`,
      label: "Show text value",
      documentation: "the text value",
      origin: "fields"
      /* Fields */
    });
  }
  if (titleName) {
    suggestions.push({
      value: `__data.fields${buildLabelPath(titleName)}`,
      label: "Select by title",
      documentation: "Use the title to pick the field",
      origin: "fields"
      /* Fields */
    });
  }
  return suggestions;
}
function getTemplateVariableSuggestions(varNames = [], propertyPaths = {}) {
  const fromVars = [];
  for (const name of varNames) {
    fromVars.push({
      value: name,
      label: name,
      origin: "template"
      /* Template */
    });
    for (const p of propertyPaths[name] ?? []) {
      const value = p.startsWith(`${name}.`) || p === name ? p : `${name}.${p}`;
      fromVars.push({
        value,
        label: value,
        origin: "template"
        /* Template */
      });
    }
  }
  return [
    ...fromVars,
    {
      value: DataLinkBuiltInVars.includeVars,
      label: "All variables",
      documentation: "Adds current variables",
      origin: "template"
      /* Template */
    }
  ];
}
function getDataLinksVariableSuggestions(dataFrames = [], options) {
  const includeValueVars = options?.scope === "values" || options?.scope === "values";
  const panelLinks = [
    ...getTemplateVariableSuggestions(
      options?.templateVars ?? [],
      options?.templateVarProperties ?? {}
    ),
    ...timeRangeVars
  ];
  return includeValueVars ? [
    ...seriesVars,
    ...getFieldVars(dataFrames),
    ...valueVars,
    valueTimeVar,
    ...getDataFrameVars(dataFrames),
    ...panelLinks
  ] : [...seriesVars, ...getFieldVars(dataFrames), ...getDataFrameVars(dataFrames), ...panelLinks];
}
function formatSuggestionToken(s) {
  return `\${${s.value}}`;
}
function frameHasName(name, names) {
  if (!name) return false;
  if (names.display.has(name) || names.raw.has(name)) return true;
  if (names.fields.has(name)) return true;
  const trimmed = name.trim();
  if (trimmed !== name && (names.display.has(trimmed) || names.raw.has(trimmed))) return true;
  return false;
}
function getFrameFieldsDisplayNames(data, filter2, existing, parentData = data) {
  const names = existing ?? {
    display: /* @__PURE__ */ new Set(),
    raw: /* @__PURE__ */ new Set(),
    fields: /* @__PURE__ */ new Map()
  };
  for (const frame of data) {
    for (const field of frame.fields) {
      if (filter2 && !filter2(field)) continue;
      if (String(field.type) === "nestedFrames" && Array.isArray(field.values)) {
        for (const nested of field.values) {
          if (Array.isArray(nested)) {
            getFrameFieldsDisplayNames(nested, filter2, names, parentData);
          } else if (nested && typeof nested === "object" && Array.isArray(nested.fields)) {
            getFrameFieldsDisplayNames([nested], filter2, names, parentData);
          }
        }
        continue;
      }
      const disp = getFieldDisplayName(field, frame, parentData);
      names.display.add(disp);
      names.fields.set(disp, field);
      if (field.name && disp !== field.name) {
        names.raw.add(field.name);
        names.fields.set(field.name, field);
      }
    }
  }
  return names;
}
function getFieldNameOptions(dataFrames, filter2) {
  const out = [];
  const seen = /* @__PURE__ */ new Set();
  const multi = dataFrames.length > 1;
  const walkFrames = (frames, parent) => {
    for (const frame of frames) {
      const frameName = frame.name || frame.refId || void 0;
      const refId = frame.refId || void 0;
      for (const field of frame.fields) {
        if (filter2 && !filter2(field)) continue;
        if (String(field.type) === "nestedFrames" && Array.isArray(field.values)) {
          for (const nested of field.values) {
            if (Array.isArray(nested)) walkFrames(nested, parent);
            else if (nested && typeof nested === "object" && Array.isArray(nested.fields)) {
              walkFrames([nested], parent);
            }
          }
          continue;
        }
        const disp = getFieldDisplayName(field, frame, parent);
        let value = disp;
        if (seen.has(value) && multi && frameName) {
          value = `${disp} (${frameName})`;
        }
        if (seen.has(value)) continue;
        seen.add(value);
        out.push({
          label: value === disp ? disp : value,
          value,
          type: field.type,
          rawName: field.name,
          frameName,
          refId
        });
        if (field.name && field.name !== disp && !seen.has(field.name)) {
          seen.add(field.name);
          out.push({
            label: field.name,
            value: field.name,
            type: field.type,
            rawName: field.name,
            frameName,
            refId
          });
        }
      }
    }
  };
  walkFrames(dataFrames, dataFrames);
  return out;
}
function plain(v) {
  return v == null ? "" : String(v);
}
function enc(v) {
  if (v == null) return "";
  return encodeURIComponent(String(v));
}
function toEpochMs(v) {
  if (v == null || v === "") return null;
  if (typeof v === "number" && Number.isFinite(v)) {
    if (v >= 1e9 && v < 1e11) return Math.round(v * 1e3);
    return Math.round(v);
  }
  if (v instanceof Date) return v.getTime();
  const s = String(v);
  if (/^\d{10,13}$/.test(s)) {
    const n = Number(s);
    return s.length === 10 ? n * 1e3 : n;
  }
  if (/^now/i.test(s)) return null;
  const d = Date.parse(s);
  return Number.isFinite(d) ? d : null;
}
function buildDataLinkVars(ctx) {
  const field = ctx.field;
  const value = ctx.value;
  const row = ctx.rowIndex ?? 0;
  const frame = ctx.frame;
  const frames = ctx.frames ?? (frame ? [frame] : []);
  const num2 = typeof value === "number" ? value : Number(value);
  const text = plain(value);
  const displayName = field ? getFieldDisplayName(field, frame, frames) : "";
  const vars = {
    value: text,
    field: field?.name,
    [DataLinkBuiltInVars.valueRaw]: text,
    [DataLinkBuiltInVars.valueText]: text,
    [DataLinkBuiltInVars.valueNumeric]: Number.isFinite(num2) ? num2 : text,
    [DataLinkBuiltInVars.valueTime]: "",
    [DataLinkBuiltInVars.valueCalc]: ctx.calc ? String(ctx.calc) : "",
    [DataLinkBuiltInVars.fieldName]: field?.name ?? "",
    [DataLinkBuiltInVars.fieldDisplayName]: displayName,
    [DataLinkBuiltInVars.seriesName]: ctx.seriesName ?? frame?.name ?? displayName,
    [DataLinkBuiltInVars.keepTime]: "",
    [DataLinkBuiltInVars.timeRangeFrom]: "",
    [DataLinkBuiltInVars.timeRangeTo]: "",
    [DataLinkBuiltInVars.includeVars]: ""
  };
  if (ctx.timeRange) {
    const rawFrom = ctx.timeRange.raw?.from ?? ctx.timeRange.from;
    const rawTo = ctx.timeRange.raw?.to ?? ctx.timeRange.to;
    const fromMs = toEpochMs(rawFrom);
    const toMs2 = toEpochMs(rawTo);
    if (fromMs != null) vars[DataLinkBuiltInVars.timeRangeFrom] = String(fromMs);
    if (toMs2 != null) vars[DataLinkBuiltInVars.timeRangeTo] = String(toMs2);
    if (fromMs != null && toMs2 != null) {
      vars[DataLinkBuiltInVars.keepTime] = `from=${fromMs}&to=${toMs2}`;
    } else if (rawFrom != null || rawTo != null) {
      vars[DataLinkBuiltInVars.keepTime] = `from=${plain(rawFrom)}&to=${plain(rawTo)}`;
      vars[DataLinkBuiltInVars.timeRangeFrom] = plain(rawFrom);
      vars[DataLinkBuiltInVars.timeRangeTo] = plain(rawTo);
    }
  }
  if (frame) {
    const timeF = frame.fields.find((f) => f.type === "time");
    if (timeF) {
      vars[DataLinkBuiltInVars.valueTime] = plain(timeF.values[row]);
    }
    frame.fields.forEach((f, i) => {
      const disp = getFieldDisplayName(f, frame, frames);
      const raw = f.values[row];
      vars[`__data.fields.${disp}`] = plain(raw);
      vars[`__data.fields["${disp}"]`] = plain(raw);
      vars[`__data.fields[${i}]`] = plain(raw);
      if (f.name !== disp) vars[`__data.fields.${f.name}`] = plain(raw);
      if (f.type === "number") {
        vars[`__data.fields.${disp}.numeric`] = Number(raw);
        vars[`__data.fields.${disp}.text`] = plain(raw);
        vars[`__data.fields["${disp}"].numeric`] = Number(raw);
        vars[`__data.fields["${disp}"].text`] = plain(raw);
      }
    });
  }
  if (field?.labels) {
    for (const [k, v] of Object.entries(field.labels)) {
      vars[`__field.labels.${k}`] = v;
      vars[`__field.labels["${k}"]`] = v;
    }
  }
  if (ctx.templateVars) {
    for (const [k, v] of Object.entries(ctx.templateVars)) {
      vars[k] = v;
      vars[k.replace(/^\$/, "")] = v;
    }
    const parts = [];
    for (const [k, v] of Object.entries(ctx.templateVars)) {
      const name = k.replace(/^\$/, "").replace(/^var-/, "");
      if (!name || name.startsWith("__")) continue;
      const vals = Array.isArray(v) ? v : [v];
      for (const one of vals) {
        if (one == null || one === "") continue;
        parts.push(`var-${encodeURIComponent(name)}=${encodeURIComponent(String(one))}`);
      }
    }
    if (parts.length) {
      vars[DataLinkBuiltInVars.includeVars] = parts.join("&");
    }
  }
  return vars;
}
const RAW_QUERY_FRAGMENT_KEYS = /* @__PURE__ */ new Set([
  DataLinkBuiltInVars.keepTime,
  // __url_time_range → from=…&to=…
  DataLinkBuiltInVars.includeVars
  // __all_variables
]);
function interpolateDataLinkString(template, vars, encodeValues = false) {
  if (!template) return "";
  const sub = (key) => {
    const k = key.trim();
    if (Object.prototype.hasOwnProperty.call(vars, k)) {
      const v = vars[k];
      if (encodeValues && !RAW_QUERY_FRAGMENT_KEYS.has(k)) return enc(v);
      return plain(v);
    }
    return "";
  };
  let out = template.replaceAll(/\$\{([^}]+)\}/g, (_, key) => sub(key));
  out = out.replaceAll(/\$([a-z_]\w*)/gi, (match, key) => {
    if (Object.prototype.hasOwnProperty.call(vars, key)) {
      const v = vars[key];
      if (encodeValues && !RAW_QUERY_FRAGMENT_KEYS.has(key)) return enc(v);
      return plain(v);
    }
    return match;
  });
  return out;
}
function buildDataLinkUrl(link, vars = {}) {
  return interpolateDataLinkString(link.url ?? "", vars, false);
}
function resolveDataLink(link, ctx) {
  const vars = buildDataLinkVars(ctx);
  let title = interpolateDataLinkString(link.title || "", vars, false);
  let href = interpolateDataLinkString(link.url || "", vars, true);
  if (ctx.replaceVariables) {
    title = ctx.replaceVariables(title);
    href = ctx.replaceVariables(href);
  }
  return {
    title: title || "Link",
    href,
    targetBlank: link.targetBlank
  };
}
function getFieldLinks(field, valueIndex, replace = (s) => s, frame, frames, extras) {
  const links = field.config.links ?? field.links ?? [];
  const raw = field.values[valueIndex];
  return links.map(
    (link) => resolveDataLink(link, {
      value: raw,
      field,
      frame,
      frames,
      rowIndex: valueIndex,
      replaceVariables: replace,
      ...extras
    })
  );
}
function getDashboardLinkUrl(link, ctx = {}) {
  let url = link.url ?? "";
  const keepToken = `\${${DataLinkBuiltInVars.keepTime}}`;
  const varsToken = `\${${DataLinkBuiltInVars.includeVars}}`;
  if (link.keepTime && !url.includes(keepToken) && !url.includes(DataLinkBuiltInVars.keepTime)) {
    url += (url.includes("?") ? "&" : "?") + keepToken;
  }
  if (link.includeVars && !url.includes(varsToken) && !url.includes(DataLinkBuiltInVars.includeVars)) {
    url += (url.includes("?") ? "&" : "?") + varsToken;
  }
  return resolveDataLink({ title: link.title || "", url }, ctx).href;
}
function isV2Dashboard(input) {
  if (!input || typeof input !== "object") return false;
  const o = input;
  return o.kind === "Dashboard" || String(o.apiVersion ?? "").includes("dashboard.grafana.app");
}
function asDict(v) {
  return v && typeof v === "object" && !Array.isArray(v) ? v : {};
}
function asArr(v) {
  return Array.isArray(v) ? v : [];
}
function resolveV2Datasource(ref2) {
  if (!ref2) return void 0;
  if (typeof ref2 === "string") {
    if (ref2 === "grafana" || ref2 === "-- Grafana --") return { type: "grafana", uid: "grafana" };
    return { uid: ref2 };
  }
  const d = asDict(ref2);
  const name = String(d.name ?? d.uid ?? "");
  if (!name) return void 0;
  if (name === "grafana" || name === "-- Grafana --") return { type: "grafana", uid: "grafana" };
  const type = d.type != null ? String(d.type) : void 0;
  return type ? { uid: name, type } : { uid: name };
}
function groupToDatasourceType(group) {
  const g = String(group ?? "");
  if (!g || g === "datasource" || g === "grafana") return g === "grafana" ? "grafana" : void 0;
  return g;
}
function convertQuerySpec(qNode) {
  const node = asDict(qNode);
  if (node.kind === "PanelQuery" || node.spec) {
    const spec = asDict(node.spec);
    const hidden = !!spec.hidden;
    const refId = String(spec.refId ?? "A");
    const inner = asDict(spec.query);
    const innerSpec = asDict(inner.spec);
    let ds2 = resolveV2Datasource(inner.datasource ?? spec.datasource);
    const inferred = groupToDatasourceType(inner.group);
    if (ds2 && !ds2.type && inferred) ds2 = { ...ds2, type: inferred };
    if (!ds2 && inferred)
      ds2 = {
        type: inferred,
        uid: inferred === "grafana" ? "grafana" : void 0
      };
    const { __legacyStringValue, ...restSpec } = innerSpec;
    const target = {
      refId,
      hide: hidden,
      ...ds2 ? { datasource: ds2 } : {},
      ...restSpec
    };
    if (__legacyStringValue != null && target.expr == null && target.query == null) ;
    return target;
  }
  return { ...node };
}
function convertTransform(t2) {
  const node = asDict(t2);
  const spec = asDict(node.spec);
  let id = "noop";
  if (node.group != null) id = String(node.group);
  else if (node.kind && node.kind !== "Transformation") id = String(node.kind);
  else if (spec.id != null) id = String(spec.id);
  else if (node.id != null) id = String(node.id);
  const options = asDict(spec.options ?? node.options);
  const out = { id, options };
  if (spec.disabled != null) out.disabled = !!spec.disabled;
  if (spec.filter) out.filter = spec.filter;
  if (spec.topic != null) out.topic = spec.topic;
  return out;
}
function convertPanelElement(key, element, gridPos, repeat) {
  const el = asDict(element);
  const kind2 = String(el.kind ?? "");
  const spec = asDict(el.spec ?? el);
  if (kind2 === "LibraryPanel" || spec.libraryPanel) {
    const lp = asDict(spec.libraryPanel);
    const rawId2 = Number(spec.id ?? el.id ?? (String(key).replaceAll(/\D+/g, "") || 0));
    const id2 = rawId2 || hashId(key);
    return {
      id: id2,
      type: "library-panel-ref",
      title: String(spec.title ?? el.title ?? lp.name ?? key),
      gridPos: { x: gridPos.x, y: gridPos.y, w: gridPos.w, h: gridPos.h },
      libraryPanel: {
        name: String(lp.name ?? ""),
        uid: String(lp.uid ?? "")
      },
      targets: [],
      options: {},
      fieldConfig: { defaults: {}, overrides: [] },
      transformations: [],
      ...repeat ?? {}
    };
  }
  const viz = asDict(spec.vizConfig);
  const vizSpec = asDict(viz.spec);
  const data = asDict(spec.data);
  const dataSpec = asDict(data.spec ?? data);
  const queries = asArr(dataSpec.queries).map(convertQuerySpec);
  const transformations = asArr(dataSpec.transformations).map(convertTransform);
  const queryOptions = asDict(dataSpec.queryOptions);
  const type = String(viz.group ?? viz.type ?? spec.type ?? el.type ?? "timeseries");
  const rawId = Number(spec.id ?? el.id ?? (String(key).replaceAll(/\D+/g, "") || 0));
  const id = rawId || hashId(key);
  const fieldConfig = asDict(vizSpec.fieldConfig ?? spec.fieldConfig);
  if (!fieldConfig.defaults) fieldConfig.defaults = {};
  if (!fieldConfig.overrides) fieldConfig.overrides = [];
  const panel2 = {
    id,
    type,
    title: String(spec.title ?? el.title ?? key),
    description: spec.description != null ? String(spec.description) : void 0,
    transparent: !!spec.transparent,
    links: asArr(spec.links),
    gridPos: { x: gridPos.x, y: gridPos.y, w: gridPos.w, h: gridPos.h },
    options: asDict(vizSpec.options ?? spec.options),
    fieldConfig,
    targets: queries,
    transformations,
    pluginVersion: viz.version != null ? String(viz.version) : void 0
  };
  if (queryOptions.maxDataPoints != null) panel2.maxDataPoints = queryOptions.maxDataPoints;
  if (queryOptions.interval != null) panel2.interval = queryOptions.interval;
  if (queryOptions.timeFrom != null) panel2.timeFrom = queryOptions.timeFrom;
  if (queryOptions.timeShift != null) panel2.timeShift = queryOptions.timeShift;
  if (queryOptions.hideTimeOverride != null) panel2.hideTimeOverride = queryOptions.hideTimeOverride;
  if (queryOptions.cacheTimeout != null) panel2.cacheTimeout = queryOptions.cacheTimeout;
  if (queryOptions.queryCachingTTL != null) panel2.queryCachingTTL = queryOptions.queryCachingTTL;
  const firstDs = asDict(asDict(queries[0]).datasource);
  if (firstDs.uid || firstDs.type) {
    panel2.datasource = firstDs;
  }
  if (repeat) Object.assign(panel2, repeat);
  return panel2;
}
function hashId(key) {
  let h2 = 0;
  for (let i = 0; i < key.length; i++) h2 = h2 * 31 + key.charCodeAt(i) >>> 0;
  return h2 % 9e5 + 1;
}
function mapRepeat(repeat) {
  const r = asDict(repeat);
  if (!r || !r.value && !r.mode && !r.variable) return void 0;
  const variable = String(r.value ?? r.variable ?? "");
  if (!variable) return void 0;
  const out = { repeat: variable };
  if (r.direction != null) out.repeatDirection = String(r.direction);
  if (r.maxPerRow != null) out.maxPerRow = Number(r.maxPerRow);
  return out;
}
function flattenV2Layout(layout, yOffset = 0) {
  const items = [];
  const rows = [];
  let rowIdSeq = 1e5;
  function isWrapperRowTitle(title, depth) {
    if (depth <= 0) return false;
    const t2 = title.trim();
    return t2 === "" || /^new row$/i.test(t2);
  }
  function walk(node, baseY, depth) {
    const n = asDict(node);
    const kind2 = String(n.kind ?? "");
    const spec = asDict(n.spec);
    if (kind2 === "GridLayout" || !kind2 && asArr(spec.items).length && !asArr(spec.rows).length && !asArr(spec.tabs).length) {
      let localMax = baseY;
      for (const raw of asArr(spec.items)) {
        const it = asDict(raw);
        const is = asDict(it.spec ?? it);
        const el = asDict(is.element);
        const name = String(el.name ?? is.element ?? "");
        const x = Number(is.x ?? 0);
        const y = Number(is.y ?? 0) + baseY;
        const w = Number(is.width ?? is.w ?? 12);
        const h2 = Number(is.height ?? is.h ?? 8);
        if (name) {
          items.push({
            elementName: name,
            x,
            y,
            w,
            h: h2,
            repeat: mapRepeat(is.repeat)
          });
        }
        localMax = Math.max(localMax, y + h2);
      }
      return localMax;
    }
    if (kind2 === "AutoGridLayout") {
      const maxCols = Math.max(1, Number(spec.maxColumnCount ?? 4));
      const colW = Math.max(1, Math.floor(24 / maxCols));
      const rowH = Math.max(1, Number(spec.rowHeight ?? 8));
      let i = 0;
      let localMax = baseY;
      for (const raw of asArr(spec.items)) {
        const it = asDict(raw);
        const is = asDict(it.spec ?? it);
        const el = asDict(is.element);
        const name = String(el.name ?? is.element ?? "");
        const col2 = i % maxCols;
        const row = Math.floor(i / maxCols);
        const x = col2 * colW;
        const y = baseY + row * rowH;
        const w = Number(is.width ?? colW);
        const h2 = Number(is.height ?? rowH);
        if (name) {
          items.push({
            elementName: name,
            x,
            y,
            w,
            h: h2,
            repeat: mapRepeat(is.repeat)
          });
          localMax = Math.max(localMax, y + h2);
        }
        i += 1;
      }
      return localMax;
    }
    if (kind2 === "RowsLayout") {
      let cursorY = baseY;
      for (const raw of asArr(spec.rows)) {
        const row = asDict(raw);
        const rs = asDict(row.spec ?? row);
        const title = String(rs.title ?? "");
        const collapsed = !!rs.collapse || !!rs.collapsed;
        const skipMarker = isWrapperRowTitle(title, depth);
        if (!skipMarker) {
          const id = rowIdSeq++;
          rows.push({ title: title || "Row", y: cursorY, collapsed, id });
          cursorY += 1;
        }
        const childLayout = rs.layout;
        if (childLayout) {
          const childMax = walk(childLayout, cursorY, depth + 1);
          cursorY = Math.max(cursorY, childMax);
        }
      }
      return cursorY;
    }
    if (kind2 === "TabsLayout") {
      let cursorY = baseY;
      for (const raw of asArr(spec.tabs)) {
        const tab = asDict(raw);
        const ts = asDict(tab.spec ?? tab);
        const title = String(ts.title ?? "Tab");
        const id = rowIdSeq++;
        rows.push({ title: `Tab: ${title}`, y: cursorY, collapsed: false, id });
        cursorY += 1;
        if (ts.layout) cursorY = Math.max(cursorY, walk(ts.layout, cursorY, depth + 1));
      }
      return cursorY;
    }
    if (asArr(spec.items).length) return walk({ kind: "GridLayout", spec }, baseY, depth);
    if (asArr(spec.rows).length) return walk({ kind: "RowsLayout", spec }, baseY, depth);
    if (asArr(spec.tabs).length) return walk({ kind: "TabsLayout", spec }, baseY, depth);
    return baseY;
  }
  const maxY = walk(layout, yOffset, 0);
  return { items, rows, maxY };
}
function convertVariable(v) {
  const node = asDict(v);
  const kind2 = String(node.kind ?? "");
  const spec = asDict(node.spec ?? node);
  const base = {
    name: String(spec.name ?? ""),
    label: spec.label != null ? String(spec.label) : void 0,
    hide: mapHide(spec.hide),
    multi: !!spec.multi,
    includeAll: !!spec.includeAll,
    skipUrlSync: !!spec.skipUrlSync,
    current: spec.current,
    options: asArr(spec.options),
    description: spec.description,
    allValue: spec.allValue,
    regex: spec.regex,
    sort: mapSort(spec.sort),
    allowCustomValue: spec.allowCustomValue !== false
  };
  if (kind2 === "DatasourceVariable" || spec.pluginId && !kind2.includes("Query")) {
    return {
      ...base,
      type: "datasource",
      query: String(spec.pluginId ?? spec.query ?? ""),
      refresh: mapRefresh(spec.refresh),
      regex: String(spec.regex ?? "")
    };
  }
  if (kind2 === "QueryVariable" || kind2 === "query") {
    const q = asDict(spec.query);
    const qSpec = asDict(q.spec);
    const queryStr = String(
      spec.definition ?? qSpec.__legacyStringValue ?? qSpec.query ?? q.query ?? (typeof spec.query === "string" ? spec.query : "") ?? ""
    );
    let ds2 = resolveV2Datasource(q.datasource ?? spec.datasource);
    const inferred = groupToDatasourceType(q.group);
    if (ds2 && !ds2.type && inferred) ds2 = { ...ds2, type: inferred };
    return {
      ...base,
      type: "query",
      definition: String(spec.definition ?? queryStr),
      query: queryStr,
      datasource: ds2,
      refresh: mapRefresh(spec.refresh),
      regex: String(spec.regex ?? ""),
      // regexApplyTo is v2-only; stash for round-trip
      ...spec.regexApplyTo != null ? { regexApplyTo: spec.regexApplyTo } : {}
    };
  }
  if (kind2 === "CustomVariable" || kind2 === "custom") {
    return { ...base, type: "custom", query: String(spec.query ?? "") };
  }
  if (kind2 === "ConstantVariable" || kind2 === "constant") {
    const current = asDict(spec.current);
    return {
      ...base,
      type: "constant",
      query: String(spec.query ?? current.value ?? "")
    };
  }
  if (kind2 === "IntervalVariable" || kind2 === "interval") {
    return {
      ...base,
      type: "interval",
      query: String(spec.query ?? "1m,5m,10m,1h"),
      auto: !!spec.auto,
      auto_count: spec.auto_count ?? spec.autoCount,
      auto_min: spec.auto_min ?? spec.autoMin
    };
  }
  if (kind2 === "TextBoxVariable" || kind2 === "textbox") {
    const current = asDict(spec.current);
    return {
      ...base,
      type: "textbox",
      query: String(spec.query ?? current.value ?? "")
    };
  }
  if (kind2 === "AdhocVariable" || kind2 === "adhoc") {
    return {
      ...base,
      type: "adhoc",
      datasource: resolveV2Datasource(spec.datasource),
      filters: asArr(spec.filters),
      baseFilters: asArr(spec.baseFilters)
    };
  }
  if (kind2 === "GroupByVariable" || kind2 === "groupby") {
    return {
      ...base,
      type: "groupby",
      datasource: resolveV2Datasource(spec.datasource)
    };
  }
  return {
    ...base,
    type: String(spec.type ?? (kind2.replace(/Variable$/i, "").toLowerCase() || "custom")),
    query: typeof spec.query === "string" ? spec.query : String(spec.definition ?? "")
  };
}
function mapHide(h2) {
  if (h2 === "hideLabel" || h2 === 1) return 1;
  if (h2 === "hideVariable" || h2 === 2) return 2;
  return 0;
}
function mapRefresh(r) {
  if (r === "onTimeRangeChanged" || r === 2) return 2;
  if (r === "onDashboardLoad" || r === 1) return 1;
  if (r === "never" || r === 0) return 0;
  return 1;
}
function mapSort(s) {
  if (s === "alphabeticalAsc" || s === 1) return 1;
  if (s === "alphabeticalDesc" || s === 2) return 2;
  if (s === "numericalAsc" || s === 3) return 3;
  if (s === "numericalDesc" || s === 4) return 4;
  if (s === "alphabeticalCaseInsensitiveAsc" || s === 5) return 5;
  if (s === "alphabeticalCaseInsensitiveDesc" || s === 6) return 6;
  return 0;
}
function convertAnnotation(a) {
  const node = asDict(a);
  const spec = asDict(node.spec ?? node);
  const q = asDict(spec.query);
  const qSpec = asDict(q.spec);
  let ds2 = resolveV2Datasource(q.datasource ?? spec.datasource);
  const inferred = groupToDatasourceType(q.group);
  if (ds2 && !ds2.type && inferred) ds2 = { ...ds2, type: inferred };
  return {
    name: String(spec.name ?? "Annotation"),
    enable: spec.enable !== false,
    hide: !!spec.hide,
    iconColor: String(spec.iconColor ?? "rgba(0, 211, 255, 1)"),
    builtIn: spec.builtIn ? 1 : 0,
    type: String(qSpec.type ?? "dashboard"),
    datasource: ds2 ?? { type: "grafana", uid: "grafana" },
    target: Object.keys(qSpec).length ? qSpec : void 0,
    ...qSpec.limit != null ? { limit: qSpec.limit } : {},
    ...qSpec.tags ? { tags: qSpec.tags } : {},
    ...qSpec.matchAny != null ? { matchAny: qSpec.matchAny } : {},
    ...spec.filter ? { filter: spec.filter } : {}
  };
}
function convertV2DashboardToV1(input) {
  if (!input || typeof input !== "object") {
    throw new Error("Invalid v2 dashboard: expected object");
  }
  const root = input;
  const meta2 = asDict(root.metadata);
  const spec = asDict(root.spec ?? root);
  const elements = asDict(spec.elements ?? root.elements);
  const layout = spec.layout ?? root.layout;
  const { items, rows, maxY } = flattenV2Layout(layout);
  const panelByKey = /* @__PURE__ */ new Map();
  for (const [key, el] of Object.entries(elements)) {
    panelByKey.set(key, el);
  }
  const panels2 = [];
  const used = /* @__PURE__ */ new Set();
  if (items.length) {
    for (const it of items) {
      const el = panelByKey.get(it.elementName);
      if (!el) continue;
      used.add(it.elementName);
      panels2.push(
        convertPanelElement(it.elementName, el, { x: it.x, y: it.y, w: it.w, h: it.h }, it.repeat)
      );
    }
  }
  let orphanY = maxY;
  for (const [key, el] of Object.entries(elements)) {
    if (used.has(key)) continue;
    panels2.push(convertPanelElement(key, el, { x: 0, y: orphanY, w: 12, h: 8 }));
    orphanY += 8;
  }
  for (const r of rows) {
    const nextRowY2 = rows.filter((x) => x.y > r.y).reduce((m, x) => Math.min(m, x.y), Number.POSITIVE_INFINITY);
    const childPanels = panels2.filter((p) => {
      if (p.type === "row") return false;
      const y = Number(asDict(p.gridPos).y ?? 0);
      return y > r.y && y < nextRowY2;
    });
    panels2.push({
      id: r.id,
      type: "row",
      title: r.title,
      collapsed: r.collapsed,
      gridPos: { x: 0, y: r.y, w: 24, h: 1 },
      // Grafana nests children when collapsed; keep a copy for scene/compat.
      // Top-level copies remain so DashboardGrid collapse-by-y still works.
      panels: r.collapsed ? childPanels.map((p) => JSON.parse(JSON.stringify(p))) : []
    });
  }
  panels2.sort((a, b) => {
    const ay = Number(asDict(a.gridPos).y ?? 0);
    const by = Number(asDict(b.gridPos).y ?? 0);
    if (ay !== by) return ay - by;
    return Number(asDict(a.gridPos).x ?? 0) - Number(asDict(b.gridPos).x ?? 0);
  });
  const timeSettings = asDict(spec.timeSettings);
  const variables = asArr(spec.variables).map(convertVariable);
  const annotations = asArr(spec.annotations).map(convertAnnotation);
  let graphTooltip = 0;
  const cursor = String(spec.cursorSync ?? "");
  if (cursor === "Crosshair") graphTooltip = 1;
  else if (cursor === "Tooltip") graphTooltip = 2;
  const title = String(spec.title ?? meta2.name ?? "Dashboard");
  const uid = String(meta2.name ?? meta2.uid ?? spec.uid ?? "");
  return {
    uid,
    title,
    description: spec.description != null ? String(spec.description) : void 0,
    tags: asArr(spec.tags),
    editable: spec.editable !== false,
    graphTooltip,
    schemaVersion: 42,
    version: Number(meta2.generation ?? meta2.resourceVersion ?? 1) || 1,
    timezone: String(timeSettings.timezone ?? "browser"),
    time: {
      from: String(timeSettings.from ?? "now-6h"),
      to: String(timeSettings.to ?? "now")
    },
    refresh: String(timeSettings.autoRefresh ?? ""),
    timepicker: {
      refresh_intervals: asArr(timeSettings.autoRefreshIntervals).length ? asArr(timeSettings.autoRefreshIntervals) : void 0,
      hidden: !!timeSettings.hideTimepicker,
      nowDelay: timeSettings.nowDelay
    },
    fiscalYearStartMonth: timeSettings.fiscalYearStartMonth ?? 0,
    weekStart: timeSettings.weekStart,
    liveNow: !!spec.liveNow,
    preload: !!spec.preload,
    links: asArr(spec.links),
    panels: panels2,
    templating: { list: variables },
    annotations: { list: annotations },
    // keep v2 originals for round-trip/debug
    __v2: {
      apiVersion: root.apiVersion,
      kind: root.kind,
      layoutKind: asDict(layout).kind,
      maxY,
      elementCount: Object.keys(elements).length,
      layoutItemCount: items.length,
      rowCount: rows.length
    }
  };
}
function v2ResourceToV1(input) {
  return convertV2DashboardToV1(input);
}
const FORBIDDEN$1 = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
function parsePath(path) {
  if (!path || path === "/") return [];
  const raw = path.startsWith("/") ? path.slice(1) : path;
  return raw.split(/\.|\//).filter(Boolean).map((seg) => {
    if (FORBIDDEN$1.has(seg)) throw new Error(`Forbidden path segment: ${seg}`);
    if (/^\d+$/.test(seg)) return Number(seg);
    return seg;
  });
}
function getAtPath(source, path) {
  const segs = parsePath(path);
  let cur = source;
  for (const s of segs) {
    if (cur == null) return void 0;
    cur = cur[s];
  }
  return cur;
}
function setAtPath(source, path, value) {
  const segs = parsePath(path);
  if (!segs.length) return value;
  const root = Array.isArray(source) ? [...source] : { ...source };
  let cur = root;
  for (let i = 0; i < segs.length - 1; i++) {
    const s = segs[i];
    const next = cur[s];
    const copy = Array.isArray(next) ? [...next] : next && typeof next === "object" ? { ...next } : {};
    cur[s] = copy;
    cur = copy;
  }
  cur[segs[segs.length - 1]] = value;
  return root;
}
function removeAtPath(source, path) {
  const segs = parsePath(path);
  if (!segs.length) return source;
  const root = Array.isArray(source) ? [...source] : { ...source };
  let cur = root;
  for (let i = 0; i < segs.length - 1; i++) {
    const s = segs[i];
    const next = cur[s];
    if (next == null) return root;
    const copy = Array.isArray(next) ? [...next] : { ...next };
    cur[s] = copy;
    cur = copy;
  }
  const last = segs[segs.length - 1];
  if (Array.isArray(cur) && typeof last === "number") cur.splice(last, 1);
  else delete cur[last];
  return root;
}
function applyJsonPatch(source, ops) {
  let cur = source;
  for (const op of ops) {
    if (op.op === "remove") cur = removeAtPath(cur, op.path);
    else cur = setAtPath(cur, op.path, op.value);
  }
  return cur;
}
function diffJsonPaths(a, b, base = "") {
  if (Object.is(a, b)) return [];
  if (typeof a !== typeof b) return [base || "/"];
  if (a == null || b == null) return [base || "/"];
  if (typeof a !== "object") return a === b ? [] : [base || "/"];
  if (Array.isArray(a) || Array.isArray(b)) {
    if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return [base || "/"];
    const out2 = [];
    for (let i = 0; i < a.length; i++) out2.push(...diffJsonPaths(a[i], b[i], `${base}/${i}`));
    return out2;
  }
  const ak = Object.keys(a);
  const bk = Object.keys(b);
  const keys = /* @__PURE__ */ new Set([...ak, ...bk]);
  const out = [];
  for (const k of keys) {
    out.push(...diffJsonPaths(a[k], b[k], `${base}/${k}`));
  }
  return out;
}
function detectSourceKind(input) {
  if (!input || typeof input !== "object") return "unknown";
  const obj = input;
  if (obj.dashboard && typeof obj.dashboard === "object") {
    if (obj.meta?.isSnapshot || obj.snapshot) return "snapshot";
    return "export-wrapper";
  }
  if (obj.kind === "Dashboard" || obj.apiVersion?.toString?.().includes("dashboard.grafana.app")) {
    return "v2";
  }
  if (obj.panels || obj.schemaVersion != null || obj.title) return "v1";
  return "unknown";
}
function extractV2Spec(obj) {
  return convertV2DashboardToV1(obj);
}
function parseDashboardDocument(input) {
  const diagnostics = [];
  if (!input || typeof input !== "object") {
    throw new Error("Invalid dashboard JSON: expected object");
  }
  const original = JSON.parse(JSON.stringify(input));
  const sourceKind = detectSourceKind(input);
  const obj = input;
  let rawDash;
  let meta2;
  let inputs;
  let requires;
  if (sourceKind === "export-wrapper" || sourceKind === "snapshot") {
    rawDash = obj.dashboard;
    meta2 = obj.meta ?? void 0;
    inputs = Array.isArray(obj.__inputs) ? obj.__inputs : rawDash.__inputs;
    requires = Array.isArray(obj.__requires) ? obj.__requires : rawDash.__requires;
  } else if (sourceKind === "v2") {
    rawDash = extractV2Spec(obj);
    diagnostics.push({
      level: "info",
      code: "v2-compat",
      message: "v2 dashboard reduced to v1 runtime shape"
    });
  } else if (sourceKind === "v1") {
    rawDash = obj;
    inputs = obj.__inputs;
    requires = obj.__requires;
  } else {
    throw new Error(
      "Not a dashboard JSON (missing panels/title/schemaVersion or dashboard wrapper)"
    );
  }
  if (sourceKind === "v2") {
    const migrated2 = migrateV1Dashboard(rawDash);
    const dashboard2 = preserveUnknownFields(rawDash, migrated2.dashboard);
    const v2meta = rawDash.__v2;
    diagnostics.push({
      level: "info",
      code: "v2-migrated",
      message: `v2→v1 normalized (panels=${Array.isArray(dashboard2.panels) ? dashboard2.panels.length : 0}, elements=${v2meta?.elementCount ?? "?"}, layout=${v2meta?.layoutKind ?? "?"}, rows=${v2meta?.rowCount ?? "?"})`
    });
    return {
      sourceKind,
      dashboard: dashboard2,
      original,
      meta: meta2,
      inputs,
      requires,
      migrations: migrated2.applied,
      diagnostics
    };
  }
  const migrated = migrateV1Dashboard(rawDash);
  const dashboard = preserveUnknownFields(rawDash, migrated.dashboard);
  return {
    sourceKind,
    dashboard,
    original,
    meta: meta2,
    inputs,
    requires,
    migrations: migrated.applied,
    diagnostics
  };
}
function applyDocumentPatches(envelope, patches) {
  const nextDash = applyJsonPatch(
    envelope.dashboard,
    patches
  );
  return {
    ...envelope,
    dashboard: nextDash,
    patches: [...envelope.patches ?? [], ...patches]
  };
}
function toSerializableDashboard(envelope) {
  return JSON.parse(JSON.stringify(envelope.dashboard));
}
var DataTransformerID = /* @__PURE__ */ ((DataTransformerID2) => {
  DataTransformerID2["append"] = "append";
  DataTransformerID2["reduce"] = "reduce";
  DataTransformerID2["order"] = "order";
  DataTransformerID2["organize"] = "organize";
  DataTransformerID2["rename"] = "rename";
  DataTransformerID2["calculateField"] = "calculateField";
  DataTransformerID2["seriesToColumns"] = "seriesToColumns";
  DataTransformerID2["seriesToRows"] = "seriesToRows";
  DataTransformerID2["merge"] = "merge";
  DataTransformerID2["concatenate"] = "concatenate";
  DataTransformerID2["labelsToFields"] = "labelsToFields";
  DataTransformerID2["filterFields"] = "filterFields";
  DataTransformerID2["filterFieldsByName"] = "filterFieldsByName";
  DataTransformerID2["filterFrames"] = "filterFrames";
  DataTransformerID2["filterByRefId"] = "filterByRefId";
  DataTransformerID2["renameByRegex"] = "renameByRegex";
  DataTransformerID2["filterByValue"] = "filterByValue";
  DataTransformerID2["noop"] = "noop";
  DataTransformerID2["ensureColumns"] = "ensureColumns";
  DataTransformerID2["groupBy"] = "groupBy";
  DataTransformerID2["sortBy"] = "sortBy";
  DataTransformerID2["histogram"] = "histogram";
  DataTransformerID2["configFromData"] = "configFromData";
  DataTransformerID2["rowsToFields"] = "rowsToFields";
  DataTransformerID2["prepareTimeSeries"] = "prepareTimeSeries";
  DataTransformerID2["convertFieldType"] = "convertFieldType";
  DataTransformerID2["convertFrameType"] = "convertFrameType";
  DataTransformerID2["fieldLookup"] = "fieldLookup";
  DataTransformerID2["heatmap"] = "heatmap";
  DataTransformerID2["spatial"] = "spatial";
  DataTransformerID2["joinByField"] = "joinByField";
  DataTransformerID2["joinByLabels"] = "joinByLabels";
  DataTransformerID2["extractFields"] = "extractFields";
  DataTransformerID2["groupingToMatrix"] = "groupingToMatrix";
  DataTransformerID2["limit"] = "limit";
  DataTransformerID2["partitionByValues"] = "partitionByValues";
  DataTransformerID2["timeSeriesTable"] = "timeSeriesTable";
  DataTransformerID2["transpose"] = "transpose";
  DataTransformerID2["formatTime"] = "formatTime";
  DataTransformerID2["formatString"] = "formatString";
  DataTransformerID2["regression"] = "regression";
  DataTransformerID2["smoothing"] = "smoothing";
  DataTransformerID2["groupToNestedTable"] = "groupToNestedTable";
  return DataTransformerID2;
})(DataTransformerID || {});
const DATA_TRANSFORMER_IDS = Object.values(DataTransformerID);
var FieldNamePickerBaseNameMode = /* @__PURE__ */ ((FieldNamePickerBaseNameMode2) => {
  FieldNamePickerBaseNameMode2["Default"] = "default";
  FieldNamePickerBaseNameMode2["OnlyBaseNames"] = "OnlyBaseNames";
  FieldNamePickerBaseNameMode2["ExcludeBaseNames"] = "ExcludeBaseNames";
  return FieldNamePickerBaseNameMode2;
})(FieldNamePickerBaseNameMode || {});
function normalizeBaseNameMode(mode2) {
  const m = String(mode2 ?? "default");
  if (m === "OnlyBaseNames" || m === "only") return "only";
  if (m === "ExcludeBaseNames" || m === "exclude") return "exclude";
  return "default";
}
function groupLabelForScope(scope) {
  switch (scope) {
    case "nested":
      return "Nested";
    case "annotation":
      return "Annotations";
    case "exemplar":
      return "Exemplars";
    case "series":
    default:
      return "Dataframe";
  }
}
function preProcessPanelData(data, lastResult) {
  const state2 = String(data.state);
  const seriesEmpty = !data.series?.length;
  const isLoading = state2 === "Loading" || state2 === "Streaming";
  if (isLoading && seriesEmpty && lastResult?.series?.length) {
    return {
      ...data,
      series: lastResult.series,
      annotations: data.annotations?.length ? data.annotations : lastResult.annotations,
      // preserve request identity from current
      state: data.state,
      timeRange: data.timeRange ?? lastResult.timeRange,
      requestId: data.requestId,
      structureRev: data.structureRev ?? lastResult.structureRev
    };
  }
  if (state2 === "Error" && seriesEmpty && lastResult?.series?.length) {
    return {
      ...data,
      series: lastResult.series,
      annotations: data.annotations ?? lastResult.annotations,
      error: data.error
    };
  }
  if (lastResult?.requestId && data.requestId && lastResult.requestId !== data.requestId && isLoading && seriesEmpty) ;
  return data;
}
const DEFAULT_MAX_ENTRIES = 64;
const DEFAULT_MAX_BYTES$1 = 512 * 1024;
const cache$1 = /* @__PURE__ */ new Map();
let cacheBytes = 0;
let maxEntries = DEFAULT_MAX_ENTRIES;
let maxBytes$1 = DEFAULT_MAX_BYTES$1;
const DEFAULT_OPTIONS = {
  limit: { limitField: 10 },
  sortBy: { sort: [] },
  reduce: { reducers: ["sum"] },
  histogram: { bucketCount: 10 },
  smoothing: { windowSize: 3 },
  filterByValue: { type: "include", filters: [] },
  prepareTimeSeries: { format: "multi" }
};
function readLimitOption(options) {
  if (!options) return void 0;
  const raw = options.limit ?? options.limitField ?? options.limitValue;
  if (raw == null) return void 0;
  const n = Math.floor(Number(raw));
  return Number.isFinite(n) && n >= 0 ? n : void 0;
}
function tryFuseSortLimit(steps, index2) {
  const cur = steps[index2];
  const next = steps[index2 + 1];
  if (!cur || !next) return null;
  if (cur.disabled || next.disabled) return null;
  const curId = resolveTransformerId(cur.id);
  const nextId2 = resolveTransformerId(next.id);
  if (curId !== "sortBy" || nextId2 !== "limit") return null;
  if (JSON.stringify(cur.filter ?? null) !== JSON.stringify(next.filter ?? null)) {
    return null;
  }
  const lim = readLimitOption(next.options);
  if (lim == null) return null;
  const defaults2 = DEFAULT_OPTIONS.sortBy ?? {};
  return {
    fused: {
      id: "sortBy",
      filter: cur.filter,
      options: {
        ...defaults2,
        ...cur.options || {},
        limit: lim,
        limitField: lim,
        limitValue: lim
      }
    },
    skipNext: true
  };
}
function compileTransformSteps(transformations = []) {
  const out = [];
  const src = transformations ?? [];
  for (let i = 0; i < src.length; i++) {
    const t2 = src[i];
    if (t2.disabled) continue;
    const fuse = tryFuseSortLimit(src, i);
    if (fuse) {
      out.push(fuse.fused);
      if (fuse.skipNext) i += 1;
      continue;
    }
    const resolvedId = resolveTransformerId(t2.id);
    const defaults2 = DEFAULT_OPTIONS[resolvedId] ?? DEFAULT_OPTIONS[t2.id] ?? {};
    out.push({
      id: resolvedId,
      filter: t2.filter,
      options: { ...defaults2, ...t2.options || {} }
    });
  }
  return out;
}
function estimateConfigBytes(config2) {
  let n = 128;
  const transforms = config2.transformations ?? [];
  n += transforms.length * 64;
  for (const t2 of transforms) {
    n += String(t2.id).length + 16;
    if (t2.options) n += Object.keys(t2.options).length * 24;
  }
  const overrides = config2.fieldConfigOverrides ?? [];
  n += overrides.length * 96;
  for (const r of overrides) {
    n += String(r.matcher?.id ?? "").length;
    n += (r.properties?.length ?? 0) * 32;
  }
  const defaults2 = config2.fieldConfigDefaults;
  if (defaults2) n += Object.keys(defaults2).length * 24 + 32;
  return n;
}
function pipelineConfigRevision(config2) {
  const transforms = config2.transformations ?? [];
  const overrides = config2.fieldConfigOverrides ?? [];
  const defaults2 = config2.fieldConfigDefaults ?? {};
  const parts = [`t${transforms.length}`, `o${overrides.length}`];
  for (const t2 of transforms) {
    parts.push(
      `${t2.disabled ? "D" : ""}${t2.id}:${stableSmallJson(t2.options)}:${stableSmallJson(t2.filter)}`
    );
  }
  for (const r of overrides) {
    const props = (r.properties || []).map((p) => `${p.id}=${stableSmallJson(p.value)}`).join(",");
    parts.push(`m${r.matcher?.id}:${stableSmallJson(r.matcher?.options)}:${props}`);
  }
  parts.push(`d:${stableSmallJson(defaults2)}`);
  return parts.join("|");
}
function stableSmallJson(value) {
  if (value == null) return "";
  if (typeof value === "string") return value.length > 64 ? value.slice(0, 64) : value;
  if (typeof value === "number" || typeof value === "boolean") return String(value);
  try {
    const s = JSON.stringify(value);
    return s.length > 256 ? s.slice(0, 256) : s;
  } catch {
    return "?";
  }
}
function touch(revision, entry) {
  cache$1.delete(revision);
  cache$1.set(revision, entry);
}
function evictIfNeeded() {
  while ((cache$1.size > maxEntries || cacheBytes > maxBytes$1) && cache$1.size > 0) {
    const oldest = cache$1.keys().next().value;
    if (oldest == null) break;
    const e = cache$1.get(oldest);
    cache$1.delete(oldest);
    if (e) cacheBytes -= e.bytes;
  }
  if (cacheBytes < 0) cacheBytes = 0;
}
function getCompiledPipeline(config2) {
  const revision = pipelineConfigRevision(config2);
  const hit = cache$1.get(revision);
  if (hit) {
    touch(revision, hit);
    return hit.compiled;
  }
  const transformations = (config2.transformations ?? []).map((t2) => ({
    id: t2.id,
    options: t2.options ? { ...t2.options } : void 0,
    disabled: t2.disabled,
    filter: t2.filter
  }));
  const defaults2 = { ...config2.fieldConfigDefaults ?? {} };
  const overrides = (config2.fieldConfigOverrides ?? []).map((r) => ({
    matcher: { ...r.matcher || { id: "" } },
    properties: (r.properties || []).map((p) => ({ ...p }))
  }));
  const fastSteps = compileTransformSteps(transformations);
  const compiledOverrides = compileOverrideRules(overrides);
  const estimatedBytes = estimateConfigBytes(config2);
  const compiled = {
    revision,
    transformations,
    fastSteps,
    defaults: defaults2,
    overrides,
    compiledOverrides,
    estimatedBytes
  };
  const bytes = Math.max(estimatedBytes, revision.length + 64);
  cacheBytes += bytes;
  cache$1.set(revision, { revision, compiled, bytes });
  evictIfNeeded();
  return compiled;
}
function runCompiledPipeline(frames, compiled, opts) {
  if (opts?.withTrace) {
    const pipeline = applyTransformationsWithTrace(frames, compiled.transformations);
    const series2 = applyFieldOverrides(pipeline.frames, compiled.defaults, compiled.overrides);
    return {
      frames: series2,
      steps: pipeline.steps,
      diagnostics: pipeline.diagnostics
    };
  }
  const transformed = applyTransformations(frames, compiled.fastSteps);
  const series = applyFieldOverrides(transformed, compiled.defaults, compiled.overrides);
  return { frames: series, steps: [], diagnostics: [] };
}
function clearCompiledPipelineCache() {
  cache$1.clear();
  cacheBytes = 0;
}
function compiledPipelineCacheStats() {
  return {
    entries: cache$1.size,
    bytes: cacheBytes,
    maxEntries,
    maxBytes: maxBytes$1
  };
}
function configureCompiledPipelineCache(opts) {
  if (opts.maxEntries != null) maxEntries = Math.max(1, opts.maxEntries);
  if (opts.maxBytes != null) maxBytes$1 = Math.max(1024, opts.maxBytes);
  evictIfNeeded();
}
function preparePanelData(input) {
  if (input.signal?.aborted) {
    throw new DOMException("Aborted", "AbortError");
  }
  const frames = input.frames ?? [];
  const transformations = input.transformations ?? [];
  const fieldConfig = input.fieldConfig ?? {};
  const replaceVariables2 = input.replaceVariables ?? ((value) => value);
  const normalized = normalizeDataFrames(frames);
  const diagnostics = [];
  const transformed = applyTransformations(normalized, transformations, diagnostics, {
    interpolate: replaceVariables2
  });
  const out = applyFieldOverrides(
    transformed,
    fieldConfig.defaults ?? {},
    fieldConfig.overrides ?? []
  );
  const warnings = diagnostics.map((d) => ({
    type: "transform",
    transformId: d.id,
    message: d.message
  }));
  const revision = pipelineConfigRevision({
    transformations,
    fieldConfigDefaults: fieldConfig.defaults,
    fieldConfigOverrides: fieldConfig.overrides
  });
  return { frames: out, warnings, revision };
}
function clamp$1(value, min = 0, max = 1) {
  return Math.min(Math.max(min, value), max);
}
function hexToRgb(color) {
  color = color.slice(1);
  const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, "g");
  const result = color.match(re);
  if (!result) return "";
  let colors = Array.from(result);
  if (colors[0].length === 1) {
    colors = colors.map((n) => n + n);
  }
  return `rgb${colors.length === 4 ? "a" : ""}(${colors.map(
    (n, index2) => index2 < 3 ? Number.parseInt(n, 16) : Math.round(Number.parseInt(n, 16) / 255 * 1e3) / 1e3
  ).join(", ")})`;
}
function intToHex(int) {
  const hex = Math.round(int).toString(16);
  return hex.length === 1 ? `0${hex}` : hex;
}
function rgbToHex(color) {
  if (color.indexOf("#") === 0) return color;
  const { values } = decomposeColor(color);
  return `#${values.map((n) => intToHex(n)).join("")}`;
}
function asHexString(color) {
  if (color[0] === "#") return color;
  try {
    const parts = decomposeColor(color);
    const rgb = parts.type.includes("hsl") ? decomposeColor(hslToRgb(color)).values : parts.values;
    const a = rgb[3];
    const hex = `#${intToHex(rgb[0])}${intToHex(rgb[1])}${intToHex(rgb[2])}`;
    if (a === void 0 || a === 1) return hex;
    return hex + intToHex(Math.round(a * 255));
  } catch {
    return color;
  }
}
function asRgbString(color) {
  if (color.startsWith("rgb")) return color;
  try {
    const parts = decomposeColor(color);
    if (parts.type.includes("hsl")) return hslToRgb(color);
    return recomposeColor(parts);
  } catch {
    return color;
  }
}
function hslToRgb(color) {
  const parts = decomposeColor(color);
  const { values } = parts;
  const h2 = values[0];
  const s = values[1] / 100;
  const l = values[2] / 100;
  const a = s * Math.min(l, 1 - l);
  const f = (n, k = (n + h2 / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
  let type = "rgb";
  const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
  if (parts.type === "hsla") {
    type += "a";
    rgb.push(values[3]);
  }
  return recomposeColor({ type, values: rgb });
}
function decomposeColor(color) {
  if (typeof color !== "string") return color;
  if (color.charAt(0) === "#") return decomposeColor(hexToRgb(color));
  const marker = color.indexOf("(");
  if (marker === -1) throw new Error(`Unsupported '${color}' color.`);
  const type = color.slice(0, Math.max(0, marker));
  if (!["rgb", "rgba", "hsl", "hsla", "color"].includes(type)) {
    throw new Error(`Unsupported '${color}' color.`);
  }
  let values = color.slice(marker + 1, -1);
  let colorSpace;
  if (type === "color") {
    values = values.split(" ");
    colorSpace = values.shift();
    if (values.length === 4 && values[3].charAt(0) === "/") values[3] = values[3].slice(1);
  } else {
    values = values.split(",");
  }
  values = values.map((value) => Number.parseFloat(value));
  return { type, values, colorSpace };
}
function recomposeColor(color) {
  const { type, colorSpace } = color;
  let values = color.values;
  if (type.includes("rgb")) {
    values = values.map(
      (n, i) => i < 3 ? Number.parseInt(String(n), 10) : n
    );
  } else if (type.includes("hsl")) {
    values[1] = `${values[1]}%`;
    values[2] = `${values[2]}%`;
  }
  if (type.includes("color")) {
    values = `${colorSpace} ${values.join(" ")}`;
  } else {
    values = `${values.join(", ")}`;
  }
  return `${type}(${values})`;
}
function getContrastRatio(foreground, background, canvas) {
  const lumA = getLuminance(foreground);
  const lumB = getLuminance(background, canvas);
  return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
}
function getLuminance(color, background) {
  const parts = decomposeColor(color);
  const rgb = parts.type === "hsl" ? decomposeColor(hslToRgb(color)).values : parts.values;
  if (background && parts.type === "rgba") {
    const backgroundParts = decomposeColor(background);
    const alphaVal = rgb[3];
    rgb[0] = rgb[0] * alphaVal + backgroundParts.values[0] * (1 - alphaVal);
    rgb[1] = rgb[1] * alphaVal + backgroundParts.values[1] * (1 - alphaVal);
    rgb[2] = rgb[2] * alphaVal + backgroundParts.values[2] * (1 - alphaVal);
  }
  const rgbNumbers = rgb.map((val) => {
    if (parts.type !== "color") val /= 255;
    return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
  });
  return Number(
    (0.2126 * rgbNumbers[0] + 0.7152 * rgbNumbers[1] + 0.0722 * rgbNumbers[2]).toFixed(3)
  );
}
function emphasize(color, coefficient = 0.15) {
  return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);
}
function alpha$1(color, value) {
  if (color === "") return "#000000";
  value = clamp$1(value);
  if (color[0] === "#") {
    if (color.length === 9) color = color.slice(0, 7);
    else if (color.length <= 5) {
      let c = "#";
      for (let i = 1; i < 4; i++) c += color[i] + color[i];
      color = c;
    }
    return color + Math.round(value * 255).toString(16).padStart(2, "0");
  } else if (color[3] === "(") {
    return color.replace(")", `, ${value})`);
  } else if (color[4] === "(") {
    return `${color.slice(0, Math.max(0, color.lastIndexOf(",")))}, ${value})`;
  }
  const parts = decomposeColor(color);
  if (parts.type === "color") parts.values[3] = `/${value}`;
  else parts.values[3] = value;
  return recomposeColor(parts);
}
function darken(color, coefficient) {
  const parts = decomposeColor(color);
  coefficient = clamp$1(coefficient);
  if (parts.type.includes("hsl")) {
    parts.values[2] *= 1 - coefficient;
  } else if (parts.type.includes("rgb") || parts.type.includes("color")) {
    for (let i = 0; i < 3; i += 1) parts.values[i] *= 1 - coefficient;
  }
  return recomposeColor(parts);
}
function lighten(color, coefficient) {
  const parts = decomposeColor(color);
  coefficient = clamp$1(coefficient);
  if (parts.type.includes("hsl")) {
    parts.values[2] += (100 - parts.values[2]) * coefficient;
  } else if (parts.type.includes("rgb")) {
    for (let i = 0; i < 3; i += 1) parts.values[i] += (255 - parts.values[i]) * coefficient;
  } else if (parts.type.includes("color")) {
    for (let i = 0; i < 3; i += 1) parts.values[i] += (1 - parts.values[i]) * coefficient;
  }
  return recomposeColor(parts);
}
function getContrastText(background, darkText = "#ffffff", lightText = "#000000", threshold = 3) {
  return getContrastRatio(darkText, background) >= threshold ? darkText : lightText;
}
const colorManipulator = {
  hexToRgb,
  rgbToHex,
  asHexString,
  asRgbString,
  hslToRgb,
  decomposeColor,
  recomposeColor,
  getContrastRatio,
  getLuminance,
  emphasize,
  alpha: alpha$1,
  darken,
  lighten,
  getContrastText
};
const palette = {
  white: "#ffffff",
  black: "#000000",
  gray05: "#111217",
  gray10: "#181b1f",
  gray15: "#22252b",
  gray20: "#2c2f35",
  gray25: "#383b42",
  gray30: "#44474e",
  gray35: "#51555b",
  gray40: "#5f6268",
  gray45: "#6e7177",
  gray50: "#7d8085",
  gray55: "#8c8f94",
  gray60: "#9c9fa3",
  gray65: "#ababaf",
  gray70: "#babcbe",
  gray75: "#c8cacc",
  gray80: "#d6d7d9",
  gray85: "#e1e2e3",
  gray90: "#ececed",
  gray95: "#f4f5f5",
  gray100: "#fbfbfb",
  blueDarkMain: "#3d71d9",
  blueDarkText: "#6e9fff",
  redDarkMain: "#d10e5c",
  redDarkText: "#ff5286",
  greenDarkMain: "#1a7f4b",
  greenDarkText: "#6ccf8e",
  orangeDarkMain: "#ff9900",
  orangeDarkText: "#fbad37",
  purpleDarkMain: "#C27AFF",
  purpleDarkText: "#D4A0FF",
  blueLightMain: "#3871dc",
  blueLightText: "#1f62e0",
  redLightMain: "#e0226e",
  redLightText: "#cf0e5B",
  greenLightMain: "#1b855e",
  greenLightText: "#0a764e",
  orangeLightMain: "#ff9900",
  orangeLightText: "#B04E0C",
  purpleLightMain: "#A24BC8",
  purpleLightText: "#7c2ea3"
};
function darkBase() {
  const whiteBase = "204, 204, 220";
  const text = {
    primary: `rgb(${whiteBase})`,
    secondary: `rgba(${whiteBase}, 0.65)`,
    disabled: `rgba(${whiteBase}, 0.61)`,
    link: palette.blueDarkText,
    maxContrast: palette.white
  };
  return {
    mode: "dark",
    border: {
      weak: "rgb(54, 57, 64)",
      medium: "rgb(68, 70, 78)",
      strong: "rgb(85, 87, 96)"
    },
    text,
    primary: {
      main: palette.blueDarkMain,
      text: palette.blueDarkText,
      border: palette.blueDarkText
    },
    secondary: {
      main: palette.gray20,
      shade: palette.gray25,
      transparent: `rgba(${whiteBase}, 0.08)`,
      text: text.primary,
      contrastText: `rgb(${whiteBase})`,
      border: `rgba(${whiteBase}, 0.08)`
    },
    tertiary: { main: palette.purpleDarkMain, text: palette.purpleDarkText },
    accent: {
      main: palette.blueDarkMain,
      text: palette.blueDarkText,
      border: palette.blueDarkText
    },
    info: { main: palette.blueDarkMain, text: palette.blueDarkText },
    error: {
      main: palette.redDarkMain,
      text: palette.redDarkText,
      border: palette.redDarkText
    },
    success: { main: palette.greenDarkMain, text: palette.greenDarkText },
    warning: { main: palette.orangeDarkMain, text: palette.orangeDarkText },
    background: {
      canvas: palette.gray05,
      page: palette.gray10,
      primary: palette.gray10,
      secondary: palette.gray15,
      elevated: palette.gray15
    },
    action: {
      hover: `rgba(${whiteBase}, 0.16)`,
      selected: `rgba(${whiteBase}, 0.12)`,
      selectedBorder: palette.orangeDarkMain,
      hoverOpacity: 0.08,
      focus: `rgba(${whiteBase}, 0.16)`,
      disabledBackground: `rgba(${whiteBase}, 0.04)`,
      disabledText: text.disabled,
      disabledOpacity: 0.38
    },
    gradients: {
      brandHorizontal: "linear-gradient(270deg, #F55F3E 0%, #FF8833 100%)",
      brandVertical: "linear-gradient(0.01deg, #F55F3E 0.01%, #FF8833 99.99%)"
    },
    scrollbar: `rgba(${whiteBase}, 0.3)`,
    contrastThreshold: 3,
    hoverFactor: 0.03,
    tonalOffset: 0.15
  };
}
function lightBase() {
  const blackBase = "36, 41, 46";
  const primary = {
    main: palette.blueLightMain,
    border: palette.blueLightText,
    text: palette.blueLightText
  };
  const text = {
    primary: `rgba(${blackBase}, 1)`,
    secondary: `rgba(${blackBase}, 0.75)`,
    disabled: `rgba(${blackBase}, 0.65)`,
    link: primary.text,
    maxContrast: palette.black
  };
  const border = {
    weak: "rgb(229, 229, 230)",
    medium: "rgb(189, 191, 192)",
    strong: "rgb(167, 169, 171)"
  };
  return {
    mode: "light",
    primary,
    text,
    border,
    secondary: {
      main: palette.gray90,
      shade: palette.gray85,
      transparent: `rgba(${blackBase}, 0.08)`,
      contrastText: `rgba(${blackBase}, 1)`,
      text: text.primary,
      border: border.weak
    },
    tertiary: { main: palette.purpleLightMain, text: palette.purpleLightText },
    accent: primary,
    info: { main: palette.blueLightMain, text: palette.blueLightText },
    error: {
      main: palette.redLightMain,
      text: palette.redLightText,
      border: palette.redLightText
    },
    success: { main: palette.greenLightMain, text: palette.greenLightText },
    warning: { main: palette.orangeLightMain, text: palette.orangeLightText },
    background: {
      canvas: palette.gray100,
      page: palette.white,
      primary: palette.white,
      secondary: palette.gray95,
      elevated: palette.white
    },
    action: {
      hover: `rgba(${blackBase}, 0.12)`,
      selected: `rgba(${blackBase}, 0.08)`,
      selectedBorder: palette.orangeLightMain,
      hoverOpacity: 0.08,
      focus: `rgba(${blackBase}, 0.12)`,
      disabledBackground: `rgba(${blackBase}, 0.04)`,
      disabledText: text.disabled,
      disabledOpacity: 0.38
    },
    gradients: {
      brandHorizontal: "linear-gradient(90deg, #FF8833 0%, #F53E4C 100%)",
      brandVertical: "linear-gradient(0.01deg, #F53E4C -31.2%, #FF8833 113.07%)"
    },
    scrollbar: `rgba(${blackBase}, 0.3)`,
    contrastThreshold: 3,
    hoverFactor: 0.03,
    tonalOffset: 0.2
  };
}
function createColors(mode2) {
  const base = mode2 === "light" ? lightBase() : darkBase();
  const tonalOffset = base.tonalOffset;
  const hoverFactor = base.hoverFactor;
  const contrastThreshold = base.contrastThreshold;
  function getContrastText2(background, threshold = contrastThreshold) {
    const dark = darkBase();
    const light = lightBase();
    return getContrastRatio(dark.text.maxContrast, background, base.background.primary) >= threshold ? dark.text.maxContrast : light.text.maxContrast;
  }
  function getRichColor(color, name) {
    const result = { ...color, name };
    if (!result.main) result.main = base[name].main;
    if (!result.text) result.text = result.main;
    if (!result.border) result.border = result.text;
    if (!result.shade) {
      result.shade = base.mode === "light" ? darken(result.main, tonalOffset) : lighten(result.main, tonalOffset);
    }
    if (!result.transparent) result.transparent = alpha$1(result.main, 0.15);
    if (!result.contrastText) result.contrastText = getContrastText2(result.main);
    if (!result.borderTransparent) result.borderTransparent = alpha$1(result.border, 0.25);
    return result;
  }
  return {
    mode: base.mode,
    text: base.text,
    background: base.background,
    border: base.border,
    gradients: base.gradients,
    action: base.action,
    scrollbar: base.scrollbar,
    hoverFactor,
    contrastThreshold,
    tonalOffset,
    primary: getRichColor(base.primary, "primary"),
    secondary: getRichColor(base.secondary, "secondary"),
    tertiary: getRichColor(base.tertiary, "tertiary"),
    accent: getRichColor(base.accent, "accent"),
    info: getRichColor(base.info, "info"),
    error: getRichColor(base.error, "error"),
    success: getRichColor(base.success, "success"),
    warning: getRichColor(base.warning, "warning"),
    getContrastText: getContrastText2,
    emphasize: (color, factor) => emphasize(color, factor ?? hoverFactor)
  };
}
const FALLBACK_COLOR = "#808080";
function createVisualizationColors(colors) {
  const baseHues = colors.mode === "light" ? getLightHues() : getDarkHues();
  const hues = baseHues;
  const byNameIndex = {};
  for (const hue of hues) {
    for (const shade of hue.shades) {
      byNameIndex[shade.name] = shade.color;
      if (shade.aliases) {
        for (const alias of shade.aliases) byNameIndex[alias] = shade.color;
      }
    }
  }
  byNameIndex.transparent = colors.mode === "light" ? "rgba(255, 255, 255, 0)" : "rgba(0,0,0,0)";
  byNameIndex["panel-bg"] = colors.background.primary;
  byNameIndex.text = colors.text.primary;
  const palette2 = getClassicPalette().map((name) => {
    if (name.startsWith("#")) return name;
    return byNameIndex[name] ?? name;
  });
  const getColorByName = (colorName) => {
    if (!colorName) return FALLBACK_COLOR;
    const realColor = byNameIndex[colorName];
    if (realColor) return realColor;
    if (colorName[0] === "#") return colorName;
    if (colorName.includes("rgb")) return colorName;
    const nativeColor = nativeColorNames[colorName.toLowerCase()];
    if (nativeColor) {
      byNameIndex[colorName] = nativeColor;
      return nativeColor;
    }
    return colorName;
  };
  return { hues, palette: palette2, getColorByName };
}
function getDarkHues() {
  return [
    {
      name: "red",
      shades: [
        { color: "#FFA6B0", name: "super-light-red" },
        { color: "#FF7383", name: "light-red" },
        { color: "#F2495C", name: "red", primary: true },
        { color: "#E02F44", name: "semi-dark-red" },
        { color: "#C4162A", name: "dark-red" }
      ]
    },
    {
      name: "orange",
      shades: [
        { color: "#FFCB7D", name: "super-light-orange" },
        { color: "#FFB357", name: "light-orange" },
        { color: "#FF9830", name: "orange", primary: true },
        { color: "#FF780A", name: "semi-dark-orange" },
        { color: "#FA6400", name: "dark-orange" }
      ]
    },
    {
      name: "yellow",
      shades: [
        { color: "#FFF899", name: "super-light-yellow" },
        { color: "#FFEE52", name: "light-yellow" },
        { color: "#FADE2A", name: "yellow", primary: true },
        { color: "#F2CC0C", name: "semi-dark-yellow" },
        { color: "#E0B400", name: "dark-yellow" }
      ]
    },
    {
      name: "green",
      shades: [
        { color: "#C8F2C2", name: "super-light-green" },
        { color: "#96D98D", name: "light-green" },
        { color: "#73BF69", name: "green", primary: true },
        { color: "#56A64B", name: "semi-dark-green" },
        { color: "#37872D", name: "dark-green" }
      ]
    },
    {
      name: "blue",
      shades: [
        { color: "#C0D8FF", name: "super-light-blue" },
        { color: "#8AB8FF", name: "light-blue" },
        { color: "#5794F2", name: "blue", primary: true },
        { color: "#3274D9", name: "semi-dark-blue" },
        { color: "#1F60C4", name: "dark-blue" }
      ]
    },
    {
      name: "purple",
      shades: [
        { color: "#DEB6F2", name: "super-light-purple" },
        { color: "#CA95E5", name: "light-purple" },
        { color: "#B877D9", name: "purple", primary: true },
        { color: "#A352CC", name: "semi-dark-purple" },
        { color: "#8F3BB8", name: "dark-purple" }
      ]
    }
  ];
}
function getLightHues() {
  return [
    {
      name: "red",
      shades: [
        { color: "#FF7383", name: "super-light-red" },
        { color: "#F2495C", name: "light-red" },
        { color: "#E02F44", name: "red", primary: true },
        { color: "#C4162A", name: "semi-dark-red" },
        { color: "#AD0317", name: "dark-red" }
      ]
    },
    {
      name: "orange",
      shades: [
        { color: "#FFB357", name: "super-light-orange" },
        { color: "#FF9830", name: "light-orange" },
        { color: "#FF780A", name: "orange", primary: true },
        { color: "#FA6400", name: "semi-dark-orange" },
        { color: "#E55400", name: "dark-orange" }
      ]
    },
    {
      name: "yellow",
      shades: [
        { color: "#FFEE52", name: "super-light-yellow" },
        { color: "#FADE2A", name: "light-yellow" },
        { color: "#F2CC0C", name: "yellow", primary: true },
        { color: "#E0B400", name: "semi-dark-yellow" },
        { color: "#CC9D00", name: "dark-yellow" }
      ]
    },
    {
      name: "green",
      shades: [
        { color: "#96D98D", name: "super-light-green" },
        { color: "#73BF69", name: "light-green" },
        { color: "#56A64B", name: "green", primary: true },
        { color: "#37872D", name: "semi-dark-green" },
        { color: "#19730E", name: "dark-green" }
      ]
    },
    {
      name: "blue",
      shades: [
        { color: "#8AB8FF", name: "super-light-blue" },
        { color: "#5794F2", name: "light-blue" },
        { color: "#3274D9", name: "blue", primary: true },
        { color: "#1F60C4", name: "semi-dark-blue" },
        { color: "#1250B0", name: "dark-blue" }
      ]
    },
    {
      name: "purple",
      shades: [
        { color: "#CA95E5", name: "super-light-purple" },
        { color: "#B877D9", name: "light-purple" },
        { color: "#A352CC", name: "purple", primary: true },
        { color: "#8F3BB8", name: "semi-dark-purple" },
        { color: "#7C2EA3", name: "dark-purple" }
      ]
    }
  ];
}
function getClassicPalette() {
  return [
    "green",
    "semi-dark-yellow",
    "blue",
    "orange",
    "red",
    "purple",
    "dark-green",
    "dark-yellow",
    "dark-blue",
    "dark-orange",
    "dark-red",
    "dark-purple",
    "super-light-green",
    "super-light-yellow",
    "super-light-blue",
    "super-light-orange",
    "super-light-red",
    "super-light-purple",
    "#447EBC",
    "#C15C17",
    "#890F02",
    "#0A437C",
    "#6D1F62",
    "#584477",
    "#B7DBAB",
    "#F4D598",
    "#70DBED",
    "#F9BA8F",
    "#F29191",
    "#82B5D8",
    "#E5A8E2",
    "#AEA2E0",
    "#629E51",
    "#E5AC0E",
    "#64B0C8",
    "#E0752D",
    "#BF1B00",
    "#0A50A1",
    "#962D82",
    "#614D93",
    "#9AC48A",
    "#F2C96D",
    "#65C5DB",
    "#F9934E",
    "#EA6460",
    "#5195CE",
    "#D683CE",
    "#806EB7",
    "#3F6833",
    "#967302",
    "#2F575E",
    "#99440A",
    "#58140C",
    "#052B51",
    "#511749",
    "#3F2B5B",
    "#E0F9D7",
    "#FCEACA",
    "#CFFAFF",
    "#F9E2D2",
    "#FCE2DE",
    "#BADFF4",
    "#F9D9F9",
    "#DEDAF7"
  ];
}
const nativeColorNames = {
  black: "#000000",
  white: "#ffffff",
  red: "#ff0000",
  green: "#008000",
  blue: "#0000ff",
  yellow: "#ffff00",
  orange: "#ffa500",
  purple: "#800080",
  gray: "#808080",
  grey: "#808080",
  transparent: "rgba(0,0,0,0)"
};
function createComponents(colors, shadows) {
  const elevated = colors.background.elevated;
  const inputBackground = colors.mode === "dark" ? colors.background.canvas : colors.background.primary;
  return {
    height: { sm: 24, md: 32, lg: 48 },
    input: {
      background: inputBackground,
      text: colors.text.primary,
      borderColor: colors.border.medium,
      borderHover: colors.border.strong
    },
    panel: {
      background: colors.background.primary,
      borderColor: colors.border.weak,
      padding: 8,
      contentBg: colors.background.secondary
    },
    dropdown: {
      background: elevated,
      borderColor: colors.border.weak,
      selectedBackground: colors.action.selected
    },
    tooltip: {
      background: elevated,
      text: colors.text.primary,
      borderColor: colors.border.weak
    },
    overlay: {
      background: colors.mode === "dark" ? "rgba(63, 62, 62, 0.5)" : "rgba(208, 209, 211, 0.5)",
      borderColor: colors.border.weak,
      boxShadow: shadows.z3 ?? shadows.z2 ?? "none"
    },
    table: {
      headerBackground: colors.background.secondary,
      rowHoverBackground: colors.action.hover,
      rowSelectedBackground: colors.action.selected
    },
    drawer: {
      background: colors.background.primary,
      borderColor: colors.border.weak
    },
    menu: {
      background: elevated,
      activeBackground: colors.action.selected,
      activeText: colors.text.primary
    }
  };
}
function createSpacing(gridSize = 8) {
  const spacing = ((factor = 1) => `${gridSize * factor}px`);
  spacing.gridSize = gridSize;
  return spacing;
}
function createTheme(options = {}) {
  const mode2 = options.colors?.mode === "light" ? "light" : "dark";
  const colors = createColors(mode2);
  const visualization = createVisualizationColors(colors);
  const typography = {
    fontFamily: "'Inter', 'Helvetica', 'Arial', sans-serif",
    fontFamilyMonospace: "'Roboto Mono', monospace",
    fontSize: 14,
    fontWeightLight: 300,
    fontWeightRegular: 400,
    fontWeightMedium: 500,
    fontWeightBold: 500,
    h1: {
      fontSize: "28px",
      fontWeight: 400,
      lineHeight: 32 / 28,
      letterSpacing: `${-0.25 / 28}em`
    },
    h2: {
      fontSize: "24px",
      fontWeight: 400,
      lineHeight: 28 / 24,
      letterSpacing: "0em"
    },
    h3: {
      fontSize: "22px",
      fontWeight: 400,
      lineHeight: 24 / 22,
      letterSpacing: "0em"
    },
    h4: {
      fontSize: "18px",
      fontWeight: 400,
      lineHeight: 22 / 18,
      letterSpacing: `${0.25 / 18}em`
    },
    h5: {
      fontSize: "16px",
      fontWeight: 400,
      lineHeight: 22 / 16,
      letterSpacing: "0em"
    },
    h6: {
      fontSize: "14px",
      fontWeight: 500,
      lineHeight: 22 / 14,
      letterSpacing: `${0.15 / 14}em`
    },
    body: {
      fontSize: "14px",
      fontWeight: 400,
      lineHeight: 22 / 14,
      letterSpacing: `${0.15 / 14}em`
    },
    bodySmall: {
      fontSize: "12px",
      fontWeight: 400,
      lineHeight: 18 / 12,
      letterSpacing: `${0.15 / 12}em`
    }
  };
  const bp = { xs: 0, sm: 544, md: 769, lg: 992, xl: 1200, xxl: 1440 };
  const shadows = mode2 === "dark" ? {
    z1: "0px 1px 2px rgba(1, 4, 9, 0.75)",
    z2: "0px 4px 8px rgba(1, 4, 9, 0.75)",
    z3: "0px 8px 24px rgb(1, 4, 9)"
  } : {
    z1: "0px 1px 2px rgba(24, 26, 27, 0.2)",
    z2: "0px 4px 8px rgba(24, 26, 27, 0.2)",
    z3: "0px 13px 20px 1px rgba(24, 26, 27, 0.18)"
  };
  return {
    name: options.name ?? (mode2 === "dark" ? "Dark" : "Light"),
    isDark: mode2 === "dark",
    isLight: mode2 === "light",
    colors,
    spacing: createSpacing(8),
    shape: {
      radius: {
        default: "6px",
        sm: "4px",
        md: "6px",
        lg: "10px",
        pill: "9999px",
        circle: "100%"
      }
    },
    typography,
    zIndex: {
      content: 1,
      activePanel: 999,
      dropdown: 1030,
      typeahead: 1030,
      navbarFixed: 1e3,
      sidemenu: 1020,
      tooltip: 1040,
      modalBackdrop: 1050,
      modal: 1060,
      portal: 1061
    },
    shadows,
    transitions: {
      duration: { short: "100ms", medium: "200ms", long: "300ms" },
      easing: { easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)" }
    },
    visualization,
    components: createComponents(colors, shadows),
    flags: { visualDesignRefresh: options.flags?.visualDesignRefresh },
    breakpoints: {
      values: bp,
      up: (key) => `@media (min-width: ${bp[key] ?? 0}px)`,
      down: (key) => `@media (max-width: ${(bp[key] ?? 0) - 0.02}px)`
    }
  };
}
function applyTheme2CssVars(theme, el = document.documentElement) {
  const { colors, typography, spacing, shape, shadows } = theme;
  const map = {
    // legacy / short aliases (compat with existing components)
    "--grafana-bg": colors.background.canvas,
    "--grafana-panel-bg": colors.background.primary,
    "--grafana-canvas-bg": colors.background.canvas,
    "--grafana-dashboard-bg": colors.background.canvas,
    "--grafana-border-color-weak": colors.border.weak,
    "--grafana-border-color-medium": colors.border.medium,
    "--grafana-border-color-strong": colors.border.strong,
    "--grafana-text": colors.text.primary,
    "--grafana-text-secondary": colors.text.secondary,
    "--grafana-primary": colors.primary.main,
    "--grafana-border": colors.border.medium,
    "--grafana-error": colors.error.main,
    "--grafana-success": colors.success.main,
    "--grafana-warning": colors.warning.main,
    "--grafana-hover": colors.action.hover,
    "--grafana-input-bg": theme.components.input.background,
    // background hierarchy
    "--grafana-bg-canvas": colors.background.canvas,
    "--grafana-bg-page": colors.background.page,
    "--grafana-bg-primary": colors.background.primary,
    "--grafana-bg-secondary": colors.background.secondary,
    "--grafana-bg-elevated": colors.background.elevated,
    // text
    "--grafana-text-primary": colors.text.primary,
    "--grafana-text-disabled": colors.text.disabled,
    "--grafana-text-link": colors.text.link,
    "--grafana-text-max-contrast": colors.text.maxContrast,
    // borders
    "--grafana-border-weak": colors.border.weak,
    // legacy alias used by older scoped CSS (Zabbix etc.)
    "--border-weak": colors.border.weak,
    "--grafana-border-medium": colors.border.medium,
    "--grafana-border-strong": colors.border.strong,
    // action
    "--grafana-action-hover": colors.action.hover,
    "--grafana-action-selected": colors.action.selected,
    "--grafana-action-focus": colors.action.focus,
    "--grafana-action-disabled-bg": colors.action.disabledBackground,
    "--grafana-action-disabled-text": colors.action.disabledText,
    "--grafana-action-selected-border": colors.action.selectedBorder,
    // rich colors
    "--grafana-primary-main": colors.primary.main,
    "--grafana-primary-text": colors.primary.text,
    "--grafana-primary-border": colors.primary.border,
    "--grafana-primary-shade": colors.primary.shade,
    "--grafana-primary-transparent": colors.primary.transparent,
    "--grafana-primary-contrast": colors.primary.contrastText,
    "--grafana-secondary-main": colors.secondary.main,
    "--grafana-secondary-shade": colors.secondary.shade,
    "--grafana-secondary-text": colors.secondary.text,
    "--grafana-secondary-border": colors.secondary.border,
    "--grafana-secondary-transparent": colors.secondary.transparent,
    "--grafana-secondary-contrast": colors.secondary.contrastText,
    "--grafana-error-main": colors.error.main,
    "--grafana-error-text": colors.error.text,
    "--grafana-error-border": colors.error.border,
    "--grafana-error-transparent": colors.error.transparent,
    "--grafana-error-contrast": colors.error.contrastText,
    "--grafana-success-main": colors.success.main,
    "--grafana-success-text": colors.success.text,
    "--grafana-success-transparent": colors.success.transparent,
    "--grafana-warning-main": colors.warning.main,
    "--grafana-warning-text": colors.warning.text,
    "--grafana-warning-transparent": colors.warning.transparent,
    "--grafana-info-main": colors.info.main,
    "--grafana-info-text": colors.info.text,
    // shadows
    "--grafana-shadow-z1": shadows.z1 ?? "",
    "--grafana-shadow-z2": shadows.z2 ?? "",
    "--grafana-shadow-z3": shadows.z3 ?? "",
    // gradients
    "--grafana-gradient-brand-horizontal": colors.gradients.brandHorizontal,
    "--grafana-gradient-brand-vertical": colors.gradients.brandVertical,
    // scrollbar
    "--grafana-scrollbar": colors.scrollbar,
    // typography / shape
    "--grafana-font-family": typography.fontFamily,
    "--grafana-font-size": `${typography.fontSize}px`,
    "--grafana-spacing-grid": `${spacing.gridSize}px`,
    "--grafana-radius": shape.radius.default,
    "--grafana-radius-sm": shape.radius.sm,
    "--grafana-radius-md": shape.radius.md,
    "--grafana-radius-lg": shape.radius.lg,
    // panel
    "--grafana-panel-border": theme.components.panel.borderColor,
    "--grafana-panel-padding": `${theme.components.panel.padding}px`,
    "--grafana-panel-content-bg": theme.components.panel.contentBg,
    // component states (from theme.components only)
    "--grafana-input-border-hover": theme.components.input.borderHover,
    "--grafana-dropdown-bg": theme.components.dropdown.background,
    "--grafana-dropdown-border": theme.components.dropdown.borderColor,
    "--grafana-dropdown-selected-bg": theme.components.dropdown.selectedBackground,
    "--grafana-tooltip-bg": theme.components.tooltip.background,
    "--grafana-tooltip-text": theme.components.tooltip.text,
    "--grafana-tooltip-border": theme.components.tooltip.borderColor,
    "--grafana-overlay-bg": theme.components.overlay.background,
    "--grafana-overlay-border": theme.components.overlay.borderColor,
    "--grafana-overlay-shadow": theme.components.overlay.boxShadow,
    "--grafana-table-header-bg": theme.components.table.headerBackground,
    "--grafana-table-row-hover-bg": theme.components.table.rowHoverBackground,
    "--grafana-table-row-selected-bg": theme.components.table.rowSelectedBackground,
    "--grafana-drawer-bg": theme.components.drawer.background,
    "--grafana-drawer-border": theme.components.drawer.borderColor,
    "--grafana-menu-bg": theme.components.menu.background,
    "--grafana-menu-active-bg": theme.components.menu.activeBackground,
    "--grafana-menu-active-text": theme.components.menu.activeText
  };
  for (const [k, v] of Object.entries(map)) {
    if (v !== void 0 && v !== null) el.style.setProperty(k, v);
  }
  el.dataset.theme = colors.mode;
  el.style.colorScheme = colors.mode;
  el.classList.remove("theme-light", "theme-dark");
  el.classList.add(`theme-${colors.mode}`);
  if (theme.flags.visualDesignRefresh) el.dataset.visualDesignRefresh = "true";
  else delete el.dataset.visualDesignRefresh;
  if (el === document.documentElement && document.body) {
    document.body.dataset.theme = colors.mode;
    document.body.classList.remove("theme-light", "theme-dark");
    document.body.classList.add(`theme-${colors.mode}`);
    document.body.style.background = colors.background.canvas;
    document.body.style.color = colors.text.primary;
  }
}
function headingCss(selector, v) {
  return `
${selector} {
  margin: 0;
  margin-bottom: 0.45em;
  font-size: ${v.fontSize};
  font-weight: ${v.fontWeight};
  line-height: ${v.lineHeight};
  font-family: inherit;
  ${v.letterSpacing ? `letter-spacing: ${v.letterSpacing};` : ""}
}`;
}
function createGlobalStyles(theme) {
  const { colors, typography } = theme;
  return `
html {
  box-sizing: border-box;
  height: 100%;
  font-size: ${typography.fontSize}px;
  font-family: ${typography.fontFamily};
  line-height: ${typography.body.lineHeight};
  font-kerning: normal;
}
html, body {
  margin: 0;
  padding: 0;
}
body {
  height: 100%;
  width: 100%;
  background: ${colors.background.canvas};
  color: ${colors.text.primary};
  font-family: ${typography.fontFamily};
  font-size: ${typography.body.fontSize};
  font-weight: ${typography.body.fontWeight};
  line-height: ${typography.body.lineHeight};
  letter-spacing: ${typography.body.letterSpacing ?? "0"};
  font-variant-ligatures: no-contextual;
}
*, *::before, *::after { box-sizing: inherit; }
:focus-visible {
  outline: 2px solid ${colors.primary.main};
  outline-offset: 2px;
}
${headingCss("h1, .h1", typography.h1)}
${headingCss("h2, .h2", typography.h2)}
${headingCss("h3, .h3", typography.h3)}
${headingCss("h4, .h4", typography.h4)}
${headingCss("h5, .h5", typography.h5)}
${headingCss("h6, .h6", typography.h6)}
p {
  margin: 0 0 16px;
}
code, pre, kbd {
  font-family: ${typography.fontFamilyMonospace};
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: ${colors.border.medium};
  border-radius: 4px;
}
body * {
  scrollbar-color: ${colors.scrollbar} transparent;
  scrollbar-width: thin;
}
::selection {
  background: ${colors.action.selected};
  color: ${colors.text.primary};
}
a {
  color: ${colors.text.link};
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a.external-link, .text-link, .link {
  color: ${colors.text.link};
}
`;
}
function applyGlobalStyles(theme, doc = document) {
  const id = "grafana-vue-global-styles";
  let el = doc.querySelector(`#${id}`);
  if (!el) {
    el = doc.createElement("style");
    el.id = id;
    doc.head.appendChild(el);
  }
  el.textContent = createGlobalStyles(theme);
}
function resolveThemeMode(pref, mql) {
  if (pref === "light" || pref === "dark") return pref;
  const dark = mql?.matches ?? (typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches);
  return dark ? "dark" : "light";
}
function createThemeFromPreference(pref, options = {}) {
  const mode2 = resolveThemeMode(pref);
  return createTheme({
    ...options,
    colors: { mode: mode2 },
    flags: {
      visualDesignRefresh: options.visualDesignRefresh ?? options.flags?.visualDesignRefresh
    }
  });
}
function applyResolvedTheme(theme, el = document.documentElement) {
  applyTheme2CssVars(theme, el);
  applyGlobalStyles(theme, el.ownerDocument);
}
function watchSystemTheme(cb) {
  if (typeof window === "undefined" || !window.matchMedia) return () => {
  };
  const mql = window.matchMedia("(prefers-color-scheme: dark)");
  const handler = () => cb(mql.matches ? "dark" : "light");
  mql.addEventListener?.("change", handler);
  return () => mql.removeEventListener?.("change", handler);
}
function assertSignalSupported(caps2, signal) {
  if (!caps2?.signals?.includes(signal)) {
    const err = new Error(
      `UNSUPPORTED_QUERY_API: signal "${signal}" is not supported by this datasource`
    );
    err.code = "UNSUPPORTED_QUERY_API";
    throw err;
  }
}
const panels = /* @__PURE__ */ new Map();
const datasources = /* @__PURE__ */ new Map();
function registerPanelPlugin(plugin2, opts = {}) {
  if (panels.has(plugin2.meta.id) && !opts.overwrite) {
    panels.set(plugin2.meta.id, plugin2);
    return;
  }
  panels.set(plugin2.meta.id, plugin2);
}
function registerDataSourcePlugin(plugin2, opts = {}) {
  if (datasources.has(plugin2.meta.id) && !opts.overwrite) {
    datasources.set(plugin2.meta.id, plugin2);
    return;
  }
  datasources.set(plugin2.meta.id, plugin2);
}
function getPanelPlugin(id) {
  return panels.get(id);
}
function getDataSourcePlugin(id) {
  return datasources.get(id);
}
function listPanelPlugins() {
  return [...panels.values()];
}
function listDataSourcePlugins() {
  return [...datasources.values()];
}
function clearPluginRegistries() {
  panels.clear();
  datasources.clear();
}
function assertNoReactPlugins(modules2) {
  const react = modules2.filter((m) => m.framework === "react");
  if (react.length) {
    throw new Error(`React plugins are not supported: ${react.map((r) => r.id).join(", ")}`);
  }
}
function createEmptyEditorContext(partial = {}) {
  return {
    data: partial.data ?? [],
    annotations: partial.annotations ?? [],
    replaceVariables: partial.replaceVariables,
    eventBus: partial.eventBus,
    getSuggestions: partial.getSuggestions,
    options: partial.options,
    instanceState: partial.instanceState,
    isOverride: partial.isOverride ?? false
  };
}
function assignPathDefault$1(target, path, value) {
  const parts = path.split(".");
  let cur = target;
  for (let i = 0; i < parts.length - 1; i++) {
    const key = parts[i];
    const next = cur[key];
    if (!next || typeof next !== "object") {
      cur[key] = {};
    }
    cur = cur[key];
  }
  cur[parts[parts.length - 1]] = value;
}
class OptionsUIBuilder {
  descriptors = [];
  defaults = {};
  orderSeq = 0;
  getItems() {
    return this.descriptors;
  }
  add(d, defaultValue) {
    const order = d.order ?? this.orderSeq++;
    const editorKey = d.editorKey ?? d.editor;
    const desc = {
      ...d,
      category: d.category ?? [],
      editorKey,
      order,
      defaultValue: defaultValue !== void 0 ? defaultValue : d.defaultValue,
      id: d.id || d.path
    };
    this.descriptors.push(desc);
    const dv = defaultValue !== void 0 ? defaultValue : d.defaultValue;
    if (dv !== void 0) {
      assignPathDefault$1(this.defaults, d.path, dv);
    }
    return this;
  }
  addBoolean(d, defaultValue) {
    return this.add({ ...d, editor: "boolean" }, defaultValue);
  }
  addRadio(d, defaultValue) {
    return this.add({ ...d, editor: "radio" }, defaultValue);
  }
  addSelect(d, defaultValue) {
    return this.add({ ...d, editor: "select" }, defaultValue);
  }
  addMultiSelect(d, defaultValue) {
    return this.add({ ...d, editor: "multi-select" }, defaultValue);
  }
  addNumber(d, defaultValue) {
    return this.add({ ...d, editor: "number" }, defaultValue);
  }
  addSlider(d, defaultValue) {
    return this.add({ ...d, editor: "slider" }, defaultValue);
  }
  addText(d, defaultValue) {
    return this.add({ ...d, editor: "text" }, defaultValue);
  }
  addTextArea(d, defaultValue) {
    return this.add({ ...d, editor: "textarea" }, defaultValue);
  }
  addStrings(d, defaultValue) {
    return this.add({ ...d, editor: "strings" }, defaultValue);
  }
  addColor(d, defaultValue) {
    return this.add({ ...d, editor: "color" }, defaultValue);
  }
  addUnit(d, defaultValue) {
    return this.add({ ...d, editor: "unit" }, defaultValue);
  }
  addFieldColor(d, defaultValue) {
    return this.add({ ...d, editor: "fieldColor" }, defaultValue);
  }
  addThresholds(d, defaultValue) {
    return this.add({ ...d, editor: "thresholds" }, defaultValue);
  }
  addMappings(d, defaultValue) {
    return this.add({ ...d, editor: "mappings" }, defaultValue);
  }
  addLinks(d, defaultValue) {
    return this.add({ ...d, editor: "links" }, defaultValue);
  }
  addActions(d, defaultValue) {
    return this.add({ ...d, editor: "actions" }, defaultValue);
  }
  addStatsPicker(d, defaultValue) {
    return this.add({ ...d, editor: "stats-picker" }, defaultValue);
  }
  addTimezone(d, defaultValue) {
    return this.add({ ...d, editor: "timezone" }, defaultValue);
  }
  addFieldName(d, defaultValue) {
    return this.add({ ...d, editor: "field-name" }, defaultValue);
  }
  addDashboardUid(d, defaultValue) {
    return this.add({ ...d, editor: "dashboard-uid" }, defaultValue);
  }
  addCustomEditor(d, defaultValue) {
    return this.add(
      {
        ...d,
        editor: d.editor ?? "custom",
        editorKey: d.editorKey ?? "custom",
        customEditor: d.customEditor
      },
      defaultValue
    );
  }
  /**
   * Back-compat: full descriptor with explicit editor (used by commonBuilders / panels).
   */
  addCustom(d, defaultValue) {
    const editor = d.editor ?? "custom";
    return this.add(
      {
        ...d,
        editor,
        editorKey: d.editorKey ?? editor
      },
      defaultValue !== void 0 ? defaultValue : d.defaultValue
    );
  }
  /**
   * Nested option group — stores nested descriptor; children resolved by consumer via nested.build.
   */
  addNestedOptions(cfg) {
    return this.add(
      {
        id: `nested.${cfg.path}`,
        path: cfg.path,
        name: cfg.category?.[0] ?? cfg.path,
        category: cfg.category ?? [],
        editor: "nested",
        editorKey: "nested",
        nested: cfg,
        defaultValue: cfg.defaultValue
      },
      cfg.defaultValue
    );
  }
  /** Filter visible descriptors for a live context */
  static filterVisible(items, options, context) {
    return items.filter((d) => {
      if (d.hideFromDefaults && !context.isOverride) return false;
      if (d.hideFromOverrides && context.isOverride) return false;
      if (d.showIf) {
        const show = d.showIf(options, context.data, context.annotations);
        if (show === false) return false;
      }
      return true;
    });
  }
  static isDisabled(d, options, context) {
    if (!d.disableIf) return false;
    return !!d.disableIf(options, context.data, context.annotations);
  }
}
const STANDARD_ITEMS = [
  {
    id: "unit",
    path: "unit",
    name: "单位",
    category: ["Standard options"],
    editor: "unit",
    editorKey: "unit",
    override: true
  },
  {
    id: "min",
    path: "min",
    name: "最小值",
    category: ["Standard options"],
    editor: "number",
    editorKey: "number",
    override: true
  },
  {
    id: "max",
    path: "max",
    name: "最大值",
    category: ["Standard options"],
    editor: "number",
    editorKey: "number",
    override: true
  },
  {
    id: "fieldMinMax",
    path: "fieldMinMax",
    name: "字段最小/最大",
    description: "根据数据计算最小/最大值",
    category: ["Standard options"],
    editor: "boolean",
    editorKey: "boolean",
    override: true
  },
  {
    id: "decimals",
    path: "decimals",
    name: "小数位",
    category: ["Standard options"],
    editor: "number",
    editorKey: "number",
    override: true
  },
  {
    id: "displayName",
    path: "displayName",
    name: "显示名称",
    category: ["Standard options"],
    editor: "text",
    editorKey: "text",
    override: true
  },
  {
    id: "noValue",
    path: "noValue",
    name: "空值显示",
    category: ["Standard options"],
    editor: "text",
    editorKey: "text",
    override: true
  },
  {
    id: "color",
    path: "color",
    name: "颜色方案",
    category: ["Standard options"],
    editor: "fieldColor",
    editorKey: "fieldColor",
    override: true
  },
  {
    id: "thresholds",
    path: "thresholds",
    name: "阈值",
    category: ["Thresholds"],
    editor: "thresholds",
    editorKey: "thresholds",
    override: true,
    // Grafana defaultFieldConfig thresholds: absolute, green below 80, red above
    defaultValue: {
      mode: "absolute",
      steps: [
        { value: -Infinity, color: "green" },
        { value: 80, color: "red" }
      ]
    }
  },
  {
    id: "mappings",
    path: "mappings",
    name: "值映射",
    category: ["Value mappings"],
    editor: "mappings",
    editorKey: "mappings",
    override: true,
    defaultValue: []
  },
  {
    id: "links",
    path: "links",
    name: "数据链接",
    category: ["Data links and actions"],
    editor: "links",
    editorKey: "links",
    override: true
  },
  {
    id: "actions",
    path: "actions",
    name: "动作",
    category: ["Data links and actions"],
    editor: "actions",
    editorKey: "actions",
    override: true,
    // Grafana: hidden from defaults
    hideFromDefaults: true
  },
  {
    id: "filterable",
    path: "filterable",
    name: "可过滤",
    category: ["Standard options"],
    editor: "boolean",
    editorKey: "boolean",
    override: true,
    hideFromDefaults: true
  }
];
function buildStandardFieldConfigDescriptors(opts = {}) {
  const disabled = new Set(opts.disableStandardOptions ?? []);
  const patches = opts.standardOptions ?? {};
  return STANDARD_ITEMS.filter((item) => !disabled.has(item.id)).map((item) => {
    const patch = patches[item.id] ?? {};
    return {
      id: item.id,
      path: item.path,
      name: patch.name ?? item.name,
      description: patch.description ?? item.description,
      category: patch.category ?? item.category,
      editor: item.editor,
      editorKey: item.editorKey,
      override: item.override ?? true,
      hideFromDefaults: item.hideFromDefaults,
      hideFromOverrides: item.hideFromOverrides,
      defaultValue: patch.defaultValue ?? item.defaultValue,
      settings: patch.settings
    };
  });
}
function listStandardOverridePropertyOptions() {
  return STANDARD_ITEMS.filter((i) => i.override !== false && !i.hideFromOverrides).map((i) => ({
    value: i.id,
    label: i.name
  }));
}
function createPanelPlugin(meta2, panel2, extras = {}) {
  const plugin2 = { meta: meta2, panel: panel2, ...extras };
  registerPanelPlugin(plugin2);
  return plugin2;
}
function createDataSourcePlugin(module) {
  registerDataSourcePlugin(module);
  return module;
}
function buildPluginMeta(id, name, rest = {}) {
  return { id, name, ...rest };
}
const STANDARD_FIELD_CONFIG = buildStandardFieldConfigDescriptors();
function applyStandardFieldConfig(opts) {
  const fieldBuilder = new FieldConfigBuilder();
  opts.useCustomConfig?.(fieldBuilder);
  const disabled = new Set(opts.disableStandardOptions ?? []);
  const standard = [];
  if (opts.standard !== false) {
    for (const base of STANDARD_FIELD_CONFIG) {
      if (disabled.has(base.id)) continue;
      let item = { ...base };
      const patch = opts.standardOptions?.[base.id];
      if (patch) {
        if (patch.defaultValue !== void 0) item = { ...item, defaultValue: patch.defaultValue };
        if (patch.settings)
          item = {
            ...item,
            settings: { ...item.settings ?? {}, ...patch.settings }
          };
        if (patch.hideFromDefaults !== void 0)
          item = { ...item, hideFromDefaults: patch.hideFromDefaults };
      }
      standard.push(item);
    }
  }
  const custom = fieldBuilder.descriptors.map((d) => ({
    ...d,
    isCustom: true,
    path: d.path.startsWith("custom.") ? d.path : `custom.${d.path}`,
    id: d.id.startsWith("custom.") ? d.id : `custom.${d.id}`
  }));
  return {
    descriptors: [...standard, ...custom],
    customDefaults: fieldBuilder.customDefaults
  };
}
function assignPathDefault(target, path, value) {
  const parts = path.split(".");
  let cur = target;
  for (let i = 0; i < parts.length - 1; i++) {
    cur[parts[i]] = cur[parts[i]] ?? {};
    cur = cur[parts[i]];
  }
  cur[parts[parts.length - 1]] = value;
}
class FieldConfigBuilder {
  descriptors = [];
  customDefaults = {};
  addCustom(d) {
    this.descriptors.push({
      ...d,
      isCustom: true,
      override: d.override !== false
    });
    if (d.defaultValue !== void 0) {
      const p = d.path.startsWith("custom.") ? d.path.slice("custom.".length) : d.path;
      assignPathDefault(this.customDefaults, p, d.defaultValue);
    }
    return this;
  }
  addBoolean(d, defaultValue) {
    return this.addCustom({ ...d, editor: "boolean", defaultValue });
  }
  addRadio(d, defaultValue) {
    return this.addCustom({ ...d, editor: "radio", defaultValue });
  }
  addSelect(d, defaultValue) {
    return this.addCustom({ ...d, editor: "select", defaultValue });
  }
  addNumber(d, defaultValue) {
    return this.addCustom({ ...d, editor: "number", defaultValue });
  }
  addSlider(d, defaultValue) {
    return this.addCustom({ ...d, editor: "slider", defaultValue });
  }
  addText(d, defaultValue) {
    return this.addCustom({ ...d, editor: "text", defaultValue });
  }
}
class VuePanelPlugin {
  module;
  optionsSupplier;
  constructor(meta2, panel2) {
    this.module = {
      meta: meta2,
      panel: panel2,
      optionDescriptors: [],
      fieldConfigDescriptors: [],
      standardFieldConfig: true,
      noPadding: false
    };
  }
  setPanel(panel2) {
    this.module.panel = panel2;
    return this;
  }
  setNoPadding() {
    this.module.noPadding = true;
    return this;
  }
  setDataSupport(_support) {
    this.module.dataSupport = _support;
    return this;
  }
  useFieldConfig(opts = {}) {
    this.module.standardFieldConfig = opts.standard !== false;
    const applied = applyStandardFieldConfig(opts);
    this.module.fieldConfigDescriptors = applied.descriptors;
    this.module.defaultFieldConfigCustom = applied.customDefaults;
    return this;
  }
  /**
   * Grafana-compatible setPanelOptions(builder, context).
   * Supplier is stored; defaults/descriptors resolved once with empty context at register.
   */
  setPanelOptions(builderFn) {
    this.optionsSupplier = (builder2, context) => {
      builderFn(builder2, context);
    };
    const builder = new OptionsUIBuilder();
    this.optionsSupplier(builder, createEmptyEditorContext());
    this.module.optionDescriptors = builder.descriptors;
    this.module.defaultOptions = builder.defaults;
    this.module.optionsSupplier = this.optionsSupplier;
    return this;
  }
  /** Re-resolve descriptors with live StandardEditorContext (showIf/disableIf with data). */
  resolveOptionDescriptors(context = createEmptyEditorContext()) {
    if (!this.optionsSupplier) {
      return this.module.optionDescriptors ?? [];
    }
    const builder = new OptionsUIBuilder();
    this.optionsSupplier(builder, context);
    return builder.descriptors;
  }
  setMigrationHandler(fn) {
    this.module.migrateOptions = fn;
    return this;
  }
  setPanelMigrationHandler(fn) {
    this.module.migratePanel = fn;
    return this;
  }
  setPanelChangeHandler(fn) {
    this.module.panelChangeHandler = fn;
    return this;
  }
  setRuntimeConsumedPaths(paths) {
    this.module.runtimeConsumedPaths = paths;
    return this;
  }
  setOptionsEditor(editor) {
    this.module.optionsEditor = editor;
    return this;
  }
  setFieldConfigEditor(editor) {
    this.module.fieldConfigEditor = editor;
    return this;
  }
  register() {
    return createPanelPlugin(this.module.meta, this.module.panel, {
      defaultOptions: this.module.defaultOptions,
      optionsEditor: this.module.optionsEditor,
      fieldConfigEditor: this.module.fieldConfigEditor,
      migrateOptions: this.module.migrateOptions,
      migratePanel: this.module.migratePanel,
      panelChangeHandler: this.module.panelChangeHandler,
      optionDescriptors: this.module.optionDescriptors,
      fieldConfigDescriptors: this.module.fieldConfigDescriptors,
      standardFieldConfig: this.module.standardFieldConfig,
      runtimeConsumedPaths: this.module.runtimeConsumedPaths,
      defaultFieldConfigCustom: this.module.defaultFieldConfigCustom,
      dataSupport: this.module.dataSupport,
      noPadding: this.module.noPadding,
      optionsSupplier: this.module.optionsSupplier
    });
  }
  getModule() {
    return this.module;
  }
}
function resolvePluginOptionDescriptors(plugin2, context = createEmptyEditorContext()) {
  const supplier = plugin2.optionsSupplier;
  if (!supplier) return plugin2.optionDescriptors ?? [];
  const builder = new OptionsUIBuilder();
  supplier(builder, context);
  return builder.descriptors;
}
const VUE_PLUGIN_ABI_MAJOR = 1;
function assertVuePluginAbi(manifest, expectedMajor = VUE_PLUGIN_ABI_MAJOR) {
  const major = manifest.dependencies?.vueSdkMajor;
  if (major == null) {
    throw new Error(
      `Plugin ${manifest.id ?? "<unknown>"} missing dependencies.vueSdkMajor (required Vue ABI)`
    );
  }
  if (major !== expectedMajor) {
    throw new Error(
      `Plugin ${manifest.id ?? "<unknown>"} Vue ABI major ${major} incompatible with host ${expectedMajor}`
    );
  }
}
function isVuePluginManifest(manifest) {
  try {
    assertVuePluginAbi(manifest);
    return true;
  } catch {
    return false;
  }
}
const FORBIDDEN = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
function splitOptionPath(path) {
  return path.replaceAll(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean).map((seg) => {
    if (FORBIDDEN.has(seg)) throw new Error(`Forbidden path segment: ${seg}`);
    if (/^\d+$/.test(seg)) {
      const n = Number(seg);
      if (n < 0) throw new Error(`Invalid array index: ${seg}`);
      return n;
    }
    return seg;
  });
}
function getOptionPath(source, path) {
  const segs = splitOptionPath(path);
  let cur = source;
  for (const s of segs) {
    if (cur == null) return void 0;
    cur = cur[s];
  }
  return cur;
}
function setOptionPath(source, path, value) {
  const segs = splitOptionPath(path);
  if (!segs.length) return value;
  const root = Array.isArray(source) ? [...source] : { ...source };
  let cur = root;
  for (let i = 0; i < segs.length - 1; i++) {
    const s = segs[i];
    const next = cur[s];
    const copy = Array.isArray(next) ? [...next] : next && typeof next === "object" ? { ...next } : {};
    cur[s] = copy;
    cur = copy;
  }
  cur[segs[segs.length - 1]] = value;
  return root;
}
function normalizeHideFrom(raw) {
  const base = { tooltip: false, viz: false, legend: false };
  if (raw == null) return base;
  if (typeof raw === "string") {
    if (raw === "tooltip" || raw === "viz" || raw === "legend") base[raw] = true;
    else if (raw === "graph") base.viz = true;
    return base;
  }
  if (Array.isArray(raw)) {
    for (const k of raw) {
      if (k === "tooltip" || k === "viz" || k === "legend") {
        base[k] = true;
      }
      if (k === "graph") base.viz = true;
    }
    return base;
  }
  if (typeof raw === "object") {
    const o = raw;
    return {
      tooltip: !!o.tooltip,
      viz: !!(o.viz ?? o.graph),
      legend: !!o.legend
    };
  }
  return base;
}
function normalizeScaleDistribution(raw) {
  if (raw == null) return { type: "linear" };
  if (typeof raw === "string") {
    const type = raw || "linear";
    return {
      type,
      log: type === "linear" ? void 0 : 10
    };
  }
  if (typeof raw === "object") {
    const o = raw;
    const type = String(o.type ?? "linear");
    return {
      type,
      log: o.log == null ? type === "linear" ? void 0 : 10 : Number(o.log),
      linearThreshold: o.linearThreshold == null ? void 0 : Number(o.linearThreshold)
    };
  }
  return { type: "linear" };
}
function normalizeStacking(raw) {
  if (raw == null) return { mode: "none", group: "A" };
  if (typeof raw === "string") return { mode: raw || "none", group: "A" };
  if (typeof raw === "object") {
    const o = raw;
    return {
      mode: String(o.mode ?? "none"),
      group: String(o.group ?? "A")
    };
  }
  return { mode: "none", group: "A" };
}
function normalizeThresholdsStyle(raw) {
  if (raw == null) return { mode: "off" };
  if (typeof raw === "string") return { mode: raw || "off" };
  if (typeof raw === "object" && raw.mode != null) {
    return { mode: String(raw.mode) };
  }
  return { mode: "off" };
}
function coerceFieldConfigEditorValue(path, value, previous) {
  if (path === "custom.stacking" || path.endsWith(".stacking")) {
    if (typeof value === "string") {
      const prev = normalizeStacking(previous);
      return { mode: value, group: prev.group || "A" };
    }
    return value;
  }
  if (path === "custom.scaleDistribution" || path === "scaleDistribution" || path.endsWith(".scaleDistribution")) {
    if (typeof value === "string") return normalizeScaleDistribution(value);
    return value;
  }
  if (path === "custom.thresholdsStyle" || path.endsWith(".thresholdsStyle")) {
    if (typeof value === "string") return { mode: value };
    return value;
  }
  if (path === "custom.hideFrom" || path.endsWith(".hideFrom")) {
    if (typeof value === "string" || Array.isArray(value)) {
      return normalizeHideFrom(value);
    }
    return value;
  }
  if (path === "custom.lineStyle" || path.endsWith(".lineStyle")) {
    if (typeof value === "string") {
      const fill = value === "dots" ? "dot" : value;
      if (fill === "dash") return { fill, dash: [10, 10] };
      if (fill === "dot") return { fill, dash: [0, 10] };
      return { fill };
    }
    return value;
  }
  return value;
}
function radioDisplayValue(path, value) {
  if (value == null) return value;
  if (typeof value !== "object" || Array.isArray(value)) return value;
  const o = value;
  if (path === "custom.stacking" || path.endsWith(".stacking") || path === "custom.thresholdsStyle" || path.endsWith(".thresholdsStyle")) {
    return o.mode;
  }
  if (path === "custom.scaleDistribution" || path === "scaleDistribution" || path.endsWith(".scaleDistribution")) {
    return o.type;
  }
  if (path === "custom.lineStyle" || path.endsWith(".lineStyle")) {
    return o.fill ?? value;
  }
  return value;
}
function addLegendOptions(builder, includeCalcs = true, includeWidth = true, showLegend = true) {
  const category = ["Legend"];
  builder.addBoolean(
    {
      id: "legend.showLegend",
      path: "legend.showLegend",
      name: "可见性",
      description: "显示图例",
      category,
      editor: "boolean"
    },
    showLegend
  ).addRadio(
    {
      id: "legend.displayMode",
      path: "legend.displayMode",
      name: "模式",
      category,
      editor: "radio",
      settings: {
        options: [
          { label: "列表", value: "list" },
          { label: "表格", value: "table" }
        ]
      },
      showIf: (c) => c.legend?.showLegend !== false
    },
    "list"
  ).addRadio(
    {
      id: "legend.placement",
      path: "legend.placement",
      name: "位置",
      category,
      editor: "radio",
      settings: {
        options: [
          { label: "底部", value: "bottom" },
          { label: "右侧", value: "right" }
        ]
      },
      showIf: (c) => c.legend?.showLegend !== false
    },
    "bottom"
  );
  if (includeWidth) {
    builder.addNumber(
      {
        id: "legend.width",
        path: "legend.width",
        name: "宽度",
        category,
        editor: "number",
        showIf: (c) => c.legend?.showLegend !== false && c.legend?.placement === "right"
      },
      void 0
    );
  }
  builder.addRadio(
    {
      id: "legend.overflow",
      path: "legend.overflow",
      name: "溢出",
      category,
      editor: "radio",
      settings: {
        options: [
          { label: "省略号", value: "ellipsis" },
          { label: "换行", value: "wrap" }
        ]
      },
      // Grafana: only meaningful in table mode
      showIf: (c) => c.legend?.showLegend !== false && c.legend?.displayMode === "table"
    },
    "ellipsis"
  ).addNumber(
    {
      id: "legend.limit",
      path: "legend.limit",
      name: "最大项数",
      category,
      editor: "number",
      showIf: (c) => c.legend?.showLegend !== false
    },
    void 0
  );
  if (includeCalcs) {
    builder.addCustom(
      {
        id: "legend.calcs",
        path: "legend.calcs",
        name: "取值",
        description: "图例表格中显示的计算值",
        category,
        editor: "stats-picker",
        settings: { allowMultiple: true },
        // Grafana: showLegend !== false (visible in both list and table)
        showIf: (c) => c.legend?.showLegend !== false
      },
      []
    );
  }
  return builder;
}
const optsWithHideZeros = {
  tooltip: { mode: "single", sort: "none", hideZeros: false }
};
function addTooltipOptions(builder, singleOnly = false, setProximity = false, defaultOptions) {
  const category = ["Tooltip"];
  const modes = singleOnly ? [
    { label: "单个", value: "single" },
    { label: "隐藏", value: "none" }
  ] : [
    { label: "单个", value: "single" },
    { label: "全部", value: "multi" },
    { label: "隐藏", value: "none" }
  ];
  builder.addRadio(
    {
      id: "tooltip.mode",
      path: "tooltip.mode",
      name: "提示模式",
      category,
      editor: "radio",
      settings: { options: modes }
    },
    defaultOptions?.tooltip?.mode ?? "single"
  ).addRadio(
    {
      id: "tooltip.sort",
      path: "tooltip.sort",
      name: "数值排序",
      category,
      editor: "radio",
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "升序", value: "asc" },
          { label: "降序", value: "desc" }
        ]
      },
      showIf: (c) => c.tooltip?.mode === "multi"
    },
    defaultOptions?.tooltip?.sort ?? "none"
  );
  if (defaultOptions?.tooltip?.hideZeros !== void 0) {
    builder.addBoolean(
      {
        id: "tooltip.hideZeros",
        path: "tooltip.hideZeros",
        name: "隐藏零值",
        category,
        editor: "boolean",
        showIf: (c) => c.tooltip?.mode === "multi"
      },
      defaultOptions.tooltip.hideZeros
    );
  }
  if (setProximity) {
    builder.addNumber(
      {
        id: "tooltip.hoverProximity",
        path: "tooltip.hoverProximity",
        name: "悬停邻近",
        description: "光标需靠近数据点的距离（像素）",
        category,
        editor: "number",
        settings: { min: 0, max: 50 },
        showIf: (c) => c.tooltip?.mode !== "none"
      },
      void 0
    );
  }
  builder.addNumber(
    {
      id: "tooltip.maxWidth",
      path: "tooltip.maxWidth",
      name: "最大宽度",
      category,
      editor: "number",
      showIf: (c) => c.tooltip?.mode !== "none"
    },
    void 0
  ).addNumber(
    {
      id: "tooltip.maxHeight",
      path: "tooltip.maxHeight",
      name: "最大高度",
      category,
      editor: "number",
      showIf: (c, _data, annotations) => c.tooltip?.mode === "multi" || Array.isArray(annotations) && annotations.some((df) => df?.meta?.custom?.resultType === "exemplar")
    },
    void 0
  );
  return builder;
}
function graphConfig$1(cfg) {
  if (!cfg || typeof cfg !== "object") return {};
  const value = cfg;
  return value.custom && typeof value.custom === "object" ? value.custom : value;
}
function axisVisible(cfg) {
  return graphConfig$1(cfg).axisPlacement !== "hidden";
}
function addAxisConfig(builder) {
  const category = ["Axis"];
  builder.addCustom({
    id: "custom.axisPlacement",
    path: "custom.axisPlacement",
    name: "位置",
    category,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "自动", value: "auto" },
        { label: "左侧", value: "left" },
        { label: "右侧", value: "right" },
        { label: "隐藏", value: "hidden" }
      ]
    },
    defaultValue: "auto"
  }).addCustom({
    id: "custom.axisLabel",
    path: "custom.axisLabel",
    name: "标签",
    category,
    editor: "text",
    isCustom: true,
    override: true,
    defaultValue: "",
    showIf: axisVisible
  }).addCustom({
    id: "custom.axisWidth",
    path: "custom.axisWidth",
    name: "宽度",
    category,
    editor: "number",
    isCustom: true,
    override: true,
    showIf: axisVisible
  }).addCustom({
    id: "custom.axisSoftMin",
    path: "custom.axisSoftMin",
    name: "软最小值",
    category,
    editor: "number",
    isCustom: true,
    override: true
  }).addCustom({
    id: "custom.axisSoftMax",
    path: "custom.axisSoftMax",
    name: "软最大值",
    category,
    editor: "number",
    isCustom: true,
    override: true
  }).addCustom({
    id: "custom.axisCenteredZero",
    path: "custom.axisCenteredZero",
    name: "零居中",
    category,
    editor: "boolean",
    isCustom: true,
    override: true,
    defaultValue: false,
    // Grafana: centered zero disabled when log scale
    showIf: (cfg) => {
      const c = graphConfig$1(cfg);
      return axisVisible(cfg) && c?.scaleDistribution?.type !== "log";
    }
  }).addCustom({
    id: "custom.axisGridShow",
    path: "custom.axisGridShow",
    name: "显示网格线",
    category,
    editor: "boolean",
    isCustom: true,
    override: true,
    showIf: axisVisible
  }).addCustom({
    id: "custom.axisBorderShow",
    path: "custom.axisBorderShow",
    name: "显示边框",
    category,
    editor: "boolean",
    isCustom: true,
    override: true,
    defaultValue: false,
    showIf: axisVisible
  }).addCustom({
    id: "custom.axisColorMode",
    path: "custom.axisColorMode",
    name: "颜色",
    category,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "文本", value: "text" },
        { label: "序列", value: "series" }
      ]
    },
    defaultValue: "text",
    showIf: axisVisible
  }).addCustom({
    id: "custom.scaleDistribution",
    path: "custom.scaleDistribution",
    name: "刻度",
    category,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "线性", value: "linear" },
        { label: "对数", value: "log" },
        { label: "对称对数", value: "symlog" }
      ]
    },
    defaultValue: { type: "linear" }
  }).addCustom({
    id: "custom.scaleDistribution.log",
    path: "custom.scaleDistribution.log",
    name: "对数底",
    category,
    editor: "select",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "2", value: 2 },
        { label: "10", value: 10 }
      ]
    },
    defaultValue: 2,
    showIf: (cfg) => {
      const c = graphConfig$1(cfg);
      return c?.scaleDistribution?.type === "log" || c?.scaleDistribution?.type === "symlog";
    }
  }).addCustom({
    id: "custom.scaleDistribution.linearThreshold",
    path: "custom.scaleDistribution.linearThreshold",
    name: "线性阈值",
    category,
    editor: "number",
    isCustom: true,
    override: true,
    defaultValue: void 0,
    showIf: (cfg) => {
      const c = graphConfig$1(cfg);
      return c?.scaleDistribution?.type === "symlog";
    }
  });
  return builder;
}
function addStackingConfig(builder) {
  builder.addCustom({
    id: "custom.stacking",
    path: "custom.stacking",
    name: "堆叠序列",
    category: ["Graph styles"],
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "关闭", value: "none" },
        { label: "标准", value: "normal" },
        { label: "100%", value: "percent" }
      ]
    },
    defaultValue: { mode: "none", group: "A" }
  });
  return builder;
}
function graphConfig(cfg) {
  if (!cfg || typeof cfg !== "object") return {};
  const value = cfg;
  return value.custom && typeof value.custom === "object" ? value.custom : value;
}
function addGraphFieldConfig(builder) {
  const styles = ["Graph styles"];
  builder.addCustom({
    id: "custom.drawStyle",
    path: "custom.drawStyle",
    name: "样式",
    category: styles,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "折线", value: "line" },
        { label: "柱状", value: "bars" },
        { label: "点", value: "points" }
      ]
    },
    defaultValue: "line"
  }).addCustom({
    id: "custom.lineInterpolation",
    path: "custom.lineInterpolation",
    name: "线插值",
    category: styles,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "线性", value: "linear" },
        { label: "平滑", value: "smooth" },
        { label: "阶梯前", value: "stepBefore" },
        { label: "阶梯后", value: "stepAfter" }
      ]
    },
    defaultValue: "linear",
    showIf: (cfg) => graphConfig(cfg).drawStyle === "line"
  }).addCustom({
    id: "custom.barAlignment",
    path: "custom.barAlignment",
    name: "柱对齐",
    category: styles,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "之前", value: -1 },
        { label: "居中", value: 0 },
        { label: "之后", value: 1 }
      ]
    },
    defaultValue: 0,
    showIf: (cfg) => graphConfig(cfg).drawStyle === "bars"
  }).addCustom({
    id: "custom.barWidthFactor",
    path: "custom.barWidthFactor",
    name: "柱宽系数",
    category: styles,
    editor: "slider",
    isCustom: true,
    override: true,
    settings: { min: 0.1, max: 1, step: 0.1 },
    defaultValue: 0.6,
    showIf: (cfg) => graphConfig(cfg).drawStyle === "bars"
  }).addCustom({
    id: "custom.lineWidth",
    path: "custom.lineWidth",
    name: "线宽",
    category: styles,
    editor: "slider",
    isCustom: true,
    override: true,
    settings: { min: 0, max: 10, step: 1 },
    defaultValue: 1,
    showIf: (cfg) => graphConfig(cfg).drawStyle !== "points"
  }).addCustom({
    id: "custom.fillOpacity",
    path: "custom.fillOpacity",
    name: "填充不透明度",
    category: styles,
    editor: "slider",
    isCustom: true,
    override: true,
    settings: { min: 0, max: 100, step: 1 },
    defaultValue: 0,
    showIf: (cfg) => graphConfig(cfg).drawStyle !== "points"
  }).addCustom({
    id: "custom.gradientMode",
    path: "custom.gradientMode",
    name: "渐变模式",
    category: styles,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "无", value: "none" },
        { label: "不透明度", value: "opacity" },
        { label: "色相", value: "hue" },
        { label: "色板", value: "scheme" }
      ]
    },
    defaultValue: "none",
    showIf: (cfg) => graphConfig(cfg).drawStyle !== "points"
  }).addCustom({
    id: "custom.fillBelowTo",
    path: "custom.fillBelowTo",
    name: "填充至",
    category: styles,
    editor: "field-name",
    isCustom: true,
    override: true,
    hideFromDefaults: true
  }).addCustom({
    id: "custom.lineStyle",
    path: "custom.lineStyle",
    name: "线型",
    category: styles,
    editor: "select",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "实线", value: "solid" },
        { label: "虚线", value: "dash" },
        { label: "点线", value: "dot" }
      ]
    },
    defaultValue: { fill: "solid" },
    showIf: (cfg) => graphConfig(cfg).drawStyle === "line"
  }).addCustom({
    id: "custom.spanNulls",
    path: "custom.spanNulls",
    name: "连接空值",
    category: styles,
    editor: "boolean",
    isCustom: true,
    override: true,
    defaultValue: false,
    showIf: (cfg) => graphConfig(cfg).drawStyle === "line"
  }).addCustom({
    id: "custom.insertNulls",
    path: "custom.insertNulls",
    name: "断开数值",
    category: styles,
    editor: "boolean",
    isCustom: true,
    override: true,
    defaultValue: false,
    showIf: (cfg) => graphConfig(cfg).drawStyle === "line"
  }).addCustom({
    id: "custom.showPoints",
    path: "custom.showPoints",
    name: "显示数据点",
    category: styles,
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "自动", value: "auto" },
        { label: "始终", value: "always" },
        { label: "从不", value: "never" }
      ]
    },
    defaultValue: "auto",
    showIf: (cfg) => graphConfig(cfg).drawStyle !== "points"
  }).addCustom({
    id: "custom.showValues",
    path: "custom.showValues",
    name: "显示数值",
    category: styles,
    editor: "boolean",
    isCustom: true,
    override: true,
    defaultValue: false,
    showIf: (cfg) => {
      const graph = graphConfig(cfg);
      return graph.showPoints !== "never" || graph.drawStyle === "points";
    }
  }).addCustom({
    id: "custom.pointSize",
    path: "custom.pointSize",
    name: "点大小",
    category: styles,
    editor: "slider",
    isCustom: true,
    override: true,
    settings: { min: 1, max: 40, step: 1 },
    defaultValue: 5,
    showIf: (cfg) => {
      const graph = graphConfig(cfg);
      return graph.showPoints !== "never" || graph.drawStyle === "points";
    }
  }).addCustom({
    id: "custom.transform",
    path: "custom.transform",
    name: "转换",
    category: styles,
    editor: "select",
    isCustom: true,
    override: true,
    hideFromDefaults: true,
    settings: {
      options: [
        { label: "常量", value: "constant" },
        { label: "负 Y", value: "negative-Y" }
      ]
    }
  }).addCustom({
    id: "custom.thresholdsStyle",
    path: "custom.thresholdsStyle",
    name: "显示阈值",
    category: ["Thresholds"],
    editor: "radio",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "关闭", value: "off" },
        { label: "线条", value: "line" },
        { label: "虚线", value: "dashed" },
        { label: "填充区域", value: "area" },
        { label: "填充区域与线条", value: "line+area" },
        { label: "填充区域与虚线", value: "dashed+area" }
      ]
    },
    defaultValue: { mode: "off" }
  }).addCustom({
    id: "custom.hideFrom",
    path: "custom.hideFrom",
    name: "隐藏区域",
    category: ["Series"],
    editor: "multi-select",
    isCustom: true,
    override: true,
    hideFromDefaults: true,
    settings: {
      options: [
        { label: "提示", value: "tooltip" },
        { label: "可视化", value: "viz" },
        { label: "图例", value: "legend" }
      ]
    },
    defaultValue: { tooltip: false, viz: false, legend: false }
  });
  addStackingConfig(builder);
  addAxisConfig(builder);
  return builder;
}
function addTextSizeOptions(builder, opts = {}) {
  const category = ["文本大小"];
  if (opts.withTitle) {
    builder.addNumber(
      {
        id: "text.titleSize",
        path: "text.titleSize",
        name: "标题",
        category,
        editor: "number",
        settings: { min: 1, placeholder: "自动" }
      },
      void 0
    );
  }
  if (opts.withValue !== false) {
    builder.addNumber(
      {
        id: "text.valueSize",
        path: "text.valueSize",
        name: "数值",
        category,
        editor: "number",
        settings: { min: 1, placeholder: "自动" }
      },
      void 0
    );
  }
  if (opts.withPercentChange) {
    builder.addNumber(
      {
        id: "text.percentSize",
        path: "text.percentSize",
        name: "百分比变化",
        category,
        editor: "number",
        settings: { min: 1, placeholder: "自动" }
      },
      void 0
    );
  }
  return builder;
}
function addHideFrom(builder) {
  builder.addCustom({
    id: "custom.hideFrom",
    path: "custom.hideFrom",
    name: "隐藏区域",
    category: ["Series"],
    editor: "multi-select",
    isCustom: true,
    override: true,
    settings: {
      options: [
        { label: "提示", value: "tooltip" },
        { label: "可视化", value: "viz" },
        { label: "图例", value: "legend" }
      ]
    },
    hideFromDefaults: true,
    defaultValue: { tooltip: false, viz: false, legend: false }
  });
  return builder;
}
function addAnnotationOptions(builder) {
  const category = ["注解"];
  builder.addBoolean(
    {
      id: "annotations.multiLane",
      path: "annotations.multiLane",
      name: "多行注解",
      description: "将每个注解 frame 拆到单独一行",
      category,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "annotations.clustering",
      path: "annotations.clustering",
      name: "注解聚合",
      description: "将高密度点注解合并为区间注解",
      category,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "annotations",
      path: "annotations",
      name: "隐藏指示线与区域",
      description: "隐藏注解指示线与阴影区域",
      category,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "annotations.show",
      path: "annotations.show",
      name: "显示注解",
      category,
      editor: "boolean"
    },
    true
  );
  return builder;
}
function addStandardDataReduceOptions(builder, includeFieldMatcher = true) {
  const category = ["数值选项"];
  builder.addRadio(
    {
      id: "reduceOptions.values",
      path: "reduceOptions.values",
      name: "显示",
      description: "计算单值或显示每行",
      category,
      editor: "radio",
      settings: {
        options: [
          { label: "计算", value: false },
          { label: "全部值", value: true }
        ]
      }
    },
    false
  ).addNumber(
    {
      id: "reduceOptions.limit",
      path: "reduceOptions.limit",
      name: "限制",
      description: "最大显示行数",
      category,
      editor: "number",
      settings: { placeholder: "25", min: 1, max: 5e3, integer: true },
      showIf: (c) => c.reduceOptions?.values === true
    },
    25
  ).addCustom(
    {
      id: "reduceOptions.calcs",
      path: "reduceOptions.calcs",
      name: "计算",
      description: "选择归约函数",
      category,
      editor: "stats-picker",
      settings: { allowMultiple: true },
      showIf: (c) => c.reduceOptions?.values !== true
    },
    ["lastNotNull"]
  );
  if (includeFieldMatcher) {
    builder.addCustom(
      {
        id: "reduceOptions.fields",
        path: "reduceOptions.fields",
        name: "字段",
        description: "字段名正则；留空表示数值字段（如 /.*/ 全部字段）",
        category,
        editor: "field-name",
        settings: { placeholderText: "数值字段", filterTypes: ["number"] }
      },
      ""
    );
  }
  return builder;
}
const runtimeDataSources = /* @__PURE__ */ new Map();
function registerRuntimeDataSource(uid, api) {
  const key = String(uid || "").trim();
  if (!key) throw new Error("Datasource uid is required");
  runtimeDataSources.set(key, api);
}
function getRuntimeDataSource(uid) {
  return runtimeDataSources.get(String(uid || "").trim());
}
function listRuntimeDataSources() {
  return [...runtimeDataSources.values()];
}
function unregisterRuntimeDataSource(uid) {
  runtimeDataSources.delete(String(uid || "").trim());
}
const registry$2 = /* @__PURE__ */ new Map();
const BUILTIN_OPTION_EDITOR_KEYS = [
  "boolean",
  "radio",
  "select",
  "multi-select",
  "number",
  "slider",
  "text",
  "textarea",
  "strings",
  "color",
  "fieldColor",
  "unit",
  "thresholds",
  "mappings",
  "links",
  "actions",
  "stats-picker",
  "timezone",
  "field-name",
  "dashboard-uid",
  "nested",
  "custom"
];
function isKnownEditorKey(editorKey, registeredOnly = false) {
  if (registry$2.has(editorKey)) return true;
  if (registeredOnly) return false;
  return BUILTIN_OPTION_EDITOR_KEYS.includes(editorKey);
}
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  BUILTIN_OPTION_EDITOR_KEYS,
  FieldConfigBuilder,
  OptionsBuilder: OptionsUIBuilder,
  OptionsUIBuilder,
  STANDARD_FIELD_CONFIG,
  VUE_PLUGIN_ABI_MAJOR,
  VuePanelPlugin,
  addAnnotationOptions,
  addAxisConfig,
  addGraphFieldConfig,
  addHideFrom,
  addLegendOptions,
  addStackingConfig,
  addStandardDataReduceOptions,
  addTextSizeOptions,
  addTooltipOptions,
  assertNoReactPlugins,
  assertSignalSupported,
  assertVuePluginAbi,
  buildPluginMeta,
  buildStandardFieldConfigDescriptors,
  clearPluginRegistries,
  coerceFieldConfigEditorValue,
  createDataSourcePlugin,
  createEmptyEditorContext,
  createPanelPlugin,
  getDataSourcePlugin,
  getOptionPath,
  getPanelPlugin,
  getRuntimeDataSource,
  isKnownEditorKey,
  isVuePluginManifest,
  listDataSourcePlugins,
  listPanelPlugins,
  listRuntimeDataSources,
  listStandardOverridePropertyOptions,
  normalizeHideFrom,
  normalizeScaleDistribution,
  normalizeStacking,
  normalizeThresholdsStyle,
  optsWithHideZeros,
  radioDisplayValue,
  registerDataSourcePlugin,
  registerPanelPlugin,
  registerRuntimeDataSource,
  resolvePluginOptionDescriptors,
  setOptionPath,
  splitOptionPath,
  unregisterRuntimeDataSource
}, Symbol.toStringTag, { value: "Module" }));
const state$3 = reactive({ boot: null });
function setBootData(boot) {
  state$3.boot = boot;
}
function useBootData() {
  return readonly(state$3);
}
function getBootData() {
  if (!state$3.boot) {
    throw new Error("BootData not initialized");
  }
  return state$3.boot;
}
function createDefaultBootData(partial) {
  return {
    user: {
      id: 1,
      isSignedIn: true,
      login: "admin",
      email: "admin@localhost",
      name: "Admin",
      orgId: 1,
      orgName: "Main Org.",
      orgRole: "Admin",
      isGrafanaAdmin: true,
      timezone: "browser",
      weekStart: "monday",
      language: "en-US",
      theme: "dark",
      permissions: {
        "dashboards:read": true,
        "dashboards:write": true,
        "datasources:read": true,
        "datasources:write": true,
        "datasources:create": true,
        "datasources:delete": true
      },
      ...partial?.user ?? {}
    },
    settings: {
      appSubUrl: "",
      buildInfo: { version: "13.2.0-pre-vue", commit: "local", env: "dev" },
      featureToggles: {},
      datasources: {},
      panels: {},
      minRefreshInterval: "5s",
      ...partial?.settings ?? {}
    },
    navTree: partial?.navTree ?? []
  };
}
function ok(data, status = 200) {
  return {
    data,
    status,
    statusText: status === 200 ? "OK" : String(status),
    ok: status >= 200 && status < 300,
    headers: new Headers({ "content-type": "application/json" })
  };
}
function notFound(message2) {
  const err = new Error(message2);
  err.status = 404;
  err.data = { message: message2 };
  throw err;
}
const DASH_STORAGE_KEY = "grafana-vue-imported-dashboards";
const DS_STORAGE_KEY = "grafana-vue-offline-datasources";
function readJson(key, fallback) {
  if (typeof localStorage === "undefined") return fallback;
  try {
    const raw = localStorage.getItem(key);
    if (!raw) return fallback;
    return JSON.parse(raw);
  } catch {
    return fallback;
  }
}
function writeJson(key, value) {
  if (typeof localStorage === "undefined") return;
  localStorage.setItem(key, JSON.stringify(value));
}
function readDashMap() {
  return readJson(DASH_STORAGE_KEY, {});
}
function writeDashMap(map) {
  writeJson(DASH_STORAGE_KEY, map);
}
function resetOfflineStorage() {
  if (typeof localStorage === "undefined") return;
  localStorage.removeItem(DASH_STORAGE_KEY);
  localStorage.removeItem(DS_STORAGE_KEY);
}
const OFFLINE_STORAGE_KEYS = {
  dashboards: DASH_STORAGE_KEY,
  datasources: DS_STORAGE_KEY
};
let builders = {};
function registerLiveDashboardBuilders(next) {
  builders = { ...next };
}
function getLiveDashboardBuilders() {
  return builders;
}
function loadPluginDashboard(_pluginId, _file, uid, title) {
  try {
    const embedded = {
      "zabbix-overview": {
        uid: "zabbix-overview",
        title: "Zabbix 概览",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "timeseries",
            title: "CPU",
            gridPos: { x: 0, y: 0, w: 12, h: 8 },
            targets: [
              {
                refId: "A",
                queryType: "0",
                item: { filter: "system.cpu.util" }
              }
            ],
            datasource: {
              type: "alexanderzobnin-zabbix-datasource",
              uid: "zabbix"
            }
          },
          {
            id: 2,
            type: "alexanderzobnin-zabbix-triggers-panel",
            title: "问题",
            gridPos: { x: 12, y: 0, w: 12, h: 8 },
            schemaVersion: 8,
            targets: [{ refId: "A", queryType: 5 }],
            datasource: {
              type: "alexanderzobnin-zabbix-datasource",
              uid: "zabbix"
            }
          }
        ]
      },
      "zabbix-problems": {
        uid: "zabbix-problems",
        title: "Zabbix 问题",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "alexanderzobnin-zabbix-triggers-panel",
            title: "当前问题",
            gridPos: { x: 0, y: 0, w: 24, h: 16 },
            schemaVersion: 8,
            targets: [{ refId: "A", queryType: 5 }],
            datasource: {
              type: "alexanderzobnin-zabbix-datasource",
              uid: "zabbix"
            }
          }
        ]
      },
      "zabbix-host": {
        uid: "zabbix-host",
        title: "Zabbix 主机",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "timeseries",
            title: "主机指标",
            gridPos: { x: 0, y: 0, w: 24, h: 10 },
            targets: [{ refId: "A", queryType: "0" }],
            datasource: {
              type: "alexanderzobnin-zabbix-datasource",
              uid: "zabbix"
            }
          }
        ]
      },
      "signoz-metrics": {
        uid: "signoz-metrics",
        title: "SigNoz metrics",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "timeseries",
            title: "metrics",
            gridPos: { x: 0, y: 0, w: 24, h: 12 },
            targets: [{ refId: "A", signal: "metrics" }],
            datasource: { type: "signoz", uid: "signoz" }
          }
        ]
      },
      "signoz-services": {
        uid: "signoz-services",
        title: "SigNoz services",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "timeseries",
            title: "services",
            gridPos: { x: 0, y: 0, w: 24, h: 12 },
            targets: [{ refId: "A", signal: "metrics" }],
            datasource: { type: "signoz", uid: "signoz" }
          }
        ]
      },
      "signoz-logs": {
        uid: "signoz-logs",
        title: "SigNoz logs",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "logs",
            title: "logs",
            gridPos: { x: 0, y: 0, w: 24, h: 12 },
            targets: [{ refId: "A", signal: "logs" }],
            datasource: { type: "signoz", uid: "signoz" }
          }
        ]
      },
      "signoz-traces": {
        uid: "signoz-traces",
        title: "SigNoz traces",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "traces",
            title: "traces",
            gridPos: { x: 0, y: 0, w: 24, h: 12 },
            targets: [{ refId: "A", signal: "traces" }],
            datasource: { type: "signoz", uid: "signoz" }
          }
        ]
      },
      "signoz-issues": {
        uid: "signoz-issues",
        title: "SigNoz issues",
        schemaVersion: 39,
        panels: [
          {
            id: 1,
            type: "signoz-issues",
            title: "issues",
            gridPos: { x: 0, y: 0, w: 24, h: 12 },
            targets: [{ refId: "A", signal: "alerts" }],
            datasource: { type: "signoz", uid: "signoz" }
          }
        ]
      }
    };
    const doc = embedded[uid] || { uid, title, schemaVersion: 39, panels: [] };
    return { ...doc, uid, title };
  } catch {
    return { uid, title, schemaVersion: 39, panels: [] };
  }
}
function seedDemoDashboards() {
  const map = readDashMap();
  let dirty = false;
  const demos = [
    { uid: "vue-demo", title: "可视化全景演示（全部 Panel）" },
    { uid: "demo", title: "演示看板" },
    { uid: "v1-demo", title: "V1 演示看板" },
    { uid: "ds-catalog", title: "数据源测试中心", factory: dsCatalogDashboard },
    {
      uid: "ds-zabbix-full",
      title: "Zabbix Full（测试）",
      factory: (u, ti) => dsTypedDashboard(u, ti, "alexanderzobnin-zabbix-datasource", "zabbix")
    },
    {
      uid: "ds-zabbix-viz",
      title: "Zabbix 可视化矩阵",
      factory: (u, ti) => dsVizMatrixDashboard(u, ti, "alexanderzobnin-zabbix-datasource", "zabbix")
    },
    {
      uid: "ds-signoz-full",
      title: "SigNoz Full（测试）",
      factory: (u, ti) => dsTypedDashboard(u, ti, "signoz", "signoz")
    },
    {
      uid: "ds-signoz-viz",
      title: "SigNoz 可视化矩阵",
      factory: (u, ti) => dsVizMatrixDashboard(u, ti, "signoz", "signoz")
    },
    {
      uid: "ds-signoz-native-full",
      title: "SigNoz Native Full（测试）",
      factory: (u, ti) => dsTypedDashboard(u, ti, "signoz", "signoz-native")
    },
    {
      uid: "test-panel-view-edit-live-signoz-native",
      title: "View/Edit × SigNoz Native",
      factory: (u, ti) => testViewEditDashboard(u, ti, "signoz-native", "signoz")
    },
    {
      uid: "ds-otel-full",
      title: "OpenTelemetry Full（测试）",
      factory: (u, ti) => dsTypedDashboard(u, ti, "opentelemetry", "opentelemetry")
    },
    {
      uid: "ds-prometheus",
      title: "Prometheus 测试",
      factory: (u, ti) => dsTypedDashboard(u, ti, "prometheus", "prometheus")
    },
    {
      uid: "ds-loki",
      title: "Loki 测试",
      factory: (u, ti) => dsTypedDashboard(u, ti, "loki", "loki")
    },
    {
      uid: "ds-tempo",
      title: "Tempo 测试",
      factory: (u, ti) => dsTypedDashboard(u, ti, "tempo", "tempo")
    },
    {
      uid: "ds-jaeger",
      title: "Jaeger 测试",
      factory: (u, ti) => dsTypedDashboard(u, ti, "jaeger", "jaeger")
    },
    {
      uid: "ds-testdata",
      title: "TestData 全 scenario",
      factory: dsTestdataDashboard
    },
    { uid: "ds-mixed", title: "Mixed 多数据源测试", factory: dsMixedDashboard },
    {
      uid: "test-panel-view-edit",
      title: "面板 View/Edit 联调",
      factory: testViewEditDashboard
    },
    {
      uid: "test-panel-view-edit-live-zabbix",
      title: "View/Edit × Zabbix live",
      factory: (u, ti) => testViewEditDashboard(u, ti, "zabbix", "alexanderzobnin-zabbix-datasource")
    },
    {
      uid: "test-panel-view-edit-live-signoz",
      title: "View/Edit × SigNoz live",
      factory: (u, ti) => testViewEditDashboard(u, ti, "signoz", "signoz")
    },
    {
      uid: "test-time-variables",
      title: "时间与变量联调",
      factory: testTimeVariablesDashboard
    },
    {
      uid: "test-transforms-live",
      title: "Transform 联调",
      factory: testTransformsDashboard
    },
    {
      uid: "test-six-states",
      title: "面板六态",
      factory: testSixStatesDashboard
    },
    {
      uid: "test-solo-embed",
      title: "Solo Embed 测试",
      factory: (u, ti) => dsTypedDashboard(u, ti, "grafana-testdata-datasource", "testdata")
    },
    {
      uid: "test-inspect-query-body",
      title: "Inspect Query Body",
      factory: (u, ti) => testViewEditDashboard(u, ti, "zabbix", "alexanderzobnin-zabbix-datasource")
    },
    {
      uid: "test-same-config-pixel",
      title: "同配置像素回归",
      factory: testSameConfigPixelDashboard
    },
    // Task 17 live observability pages (factory — no tokens)
    ...(() => {
      const builders2 = getLiveDashboardBuilders();
      return Object.keys(builders2).map((uid) => ({
        uid,
        title: String(builders2[uid]?.()?.title || uid),
        factory: (u) => builders2[u]?.() ?? { uid: u, title: u, panels: [] }
      }));
    })(),
    // Built-in plugin dashboards (Zabbix / SigNoz)
    {
      uid: "zabbix-overview",
      title: "Zabbix 概览",
      factory: (u, ti) => loadPluginDashboard("alexanderzobnin-zabbix-datasource", "zabbix-overview.json", u, ti)
    },
    {
      uid: "zabbix-problems",
      title: "Zabbix 问题",
      factory: (u, ti) => loadPluginDashboard("alexanderzobnin-zabbix-datasource", "zabbix-problems.json", u, ti)
    },
    {
      uid: "zabbix-host",
      title: "Zabbix 主机",
      factory: (u, ti) => loadPluginDashboard("alexanderzobnin-zabbix-datasource", "zabbix-host.json", u, ti)
    },
    {
      uid: "signoz-metrics",
      title: "SigNoz metrics",
      factory: (u, ti) => loadPluginDashboard("signoz", "signoz-metrics.json", u, ti)
    },
    {
      uid: "signoz-services",
      title: "SigNoz services",
      factory: (u, ti) => loadPluginDashboard("signoz", "signoz-services.json", u, ti)
    },
    {
      uid: "signoz-logs",
      title: "SigNoz logs",
      factory: (u, ti) => loadPluginDashboard("signoz", "signoz-logs.json", u, ti)
    },
    {
      uid: "signoz-traces",
      title: "SigNoz traces",
      factory: (u, ti) => loadPluginDashboard("signoz", "signoz-traces.json", u, ti)
    },
    {
      uid: "signoz-issues",
      title: "SigNoz issues",
      factory: (u, ti) => loadPluginDashboard("signoz", "signoz-issues.json", u, ti)
    },
    {
      uid: "signoz-service-overview",
      title: "SigNoz Service Overview",
      factory: (u, ti) => loadPluginDashboard("signoz", "service-overview.json", u, ti)
    },
    {
      uid: "signoz-metrics-overview",
      title: "SigNoz Metrics Overview",
      factory: (u, ti) => loadPluginDashboard("signoz", "metrics-overview.json", u, ti)
    },
    {
      uid: "signoz-logs-errors",
      title: "SigNoz Logs and Errors",
      factory: (u, ti) => loadPluginDashboard("signoz", "logs-and-errors.json", u, ti)
    },
    {
      uid: "signoz-distributed-traces",
      title: "SigNoz Distributed Traces",
      factory: (u, ti) => loadPluginDashboard("signoz", "distributed-traces.json", u, ti)
    },
    {
      uid: "signoz-observability-issues",
      title: "SigNoz Observability Issues",
      factory: (u, ti) => loadPluginDashboard("signoz", "observability-issues.json", u, ti)
    }
  ];
  const liveBuilderUids = new Set(Object.keys(getLiveDashboardBuilders()));
  for (const d of demos) {
    const factory2 = d.factory ?? demoDashboard;
    const existing = map[d.uid];
    let needs = !existing;
    if (existing && d.factory) {
      const panels2 = Array.isArray(existing.raw?.panels) ? existing.raw.panels : [];
      const types = panels2.map((p) => p?.datasource?.type || p?.targets?.[0]?.datasource?.type).filter(Boolean);
      if (liveBuilderUids.has(d.uid)) {
        const fresh = factory2(d.uid, d.title);
        const fp = Array.isArray(fresh?.panels) ? fresh.panels : [];
        const a = JSON.stringify({
          time: existing.raw?.time ?? null,
          titles: panels2.map((x) => x?.title),
          draw: panels2.map((x) => x?.fieldConfig?.defaults?.custom?.drawStyle ?? null),
          trends: panels2.map((x) => x?.targets?.[0]?.options?.useTrends ?? null)
        });
        const b = JSON.stringify({
          time: fresh?.time ?? null,
          titles: fp.map((x) => x?.title),
          draw: fp.map((x) => x?.fieldConfig?.defaults?.custom?.drawStyle ?? null),
          trends: fp.map((x) => x?.targets?.[0]?.options?.useTrends ?? null)
        });
        needs = a !== b;
      } else if (d.uid.startsWith("ds-zabbix") || d.uid.includes("live-zabbix")) {
        needs = !types.some((t2) => String(t2).includes("zabbix"));
      } else if (d.uid.startsWith("ds-signoz") || d.uid.includes("live-signoz")) {
        needs = !types.some((t2) => String(t2) === "signoz");
      } else if (d.uid.startsWith("ds-") && panels2.length < 3) {
        needs = true;
      }
      if (d.uid === "ds-zabbix-full" && panels2.length < 6) needs = true;
      if (d.uid.startsWith("ds-") && String(existing.raw?.time?.from || "") === "now-1h")
        needs = true;
      if (d.uid === "ds-zabbix-full") {
        const tgt = JSON.stringify(existing.raw?.panels?.[0]?.targets || []);
        if (!tgt.includes("vfs.fs.size")) needs = true;
      }
    }
    if (!needs) continue;
    map[d.uid] = {
      uid: d.uid,
      title: d.title,
      savedAt: (/* @__PURE__ */ new Date()).toISOString(),
      version: (existing?.version ?? 0) + 1,
      raw: factory2(d.uid, d.title)
    };
    dirty = true;
  }
  if (dirty) writeDashMap(map);
}
const DEFAULT_OFFLINE_DATASOURCES = [
  {
    uid: "testdata",
    name: "TestData",
    type: "grafana-testdata-datasource",
    isDefault: false,
    access: "proxy",
    jsonData: {}
  },
  {
    uid: "prometheus",
    name: "Prometheus",
    type: "prometheus",
    access: "proxy",
    url: "http://localhost:9090",
    jsonData: {}
  },
  {
    uid: "loki",
    name: "Loki",
    type: "loki",
    access: "proxy",
    url: "http://localhost:3100",
    jsonData: {}
  },
  {
    uid: "tempo",
    name: "Tempo",
    type: "tempo",
    access: "proxy",
    url: "http://localhost:3200",
    jsonData: {}
  },
  {
    uid: "opentelemetry",
    name: "OpenTelemetry",
    type: "opentelemetry",
    access: "proxy",
    url: "http://localhost:4318",
    jsonData: {}
  },
  // Offline seed uses dataMode=fixture so demo/viz matrices render without live upstream.
  // Live App config / live UIDs override this when operator supplies real credentials.
  {
    uid: "signoz",
    name: "SigNoz SigNoz",
    type: "signoz",
    access: "proxy",
    url: "/signoz-api",
    jsonData: { apiProfile: "signoz-v5", dataMode: "fixture" }
  },
  {
    uid: "signoz-native",
    name: "SigNoz Native",
    type: "signoz",
    access: "proxy",
    url: "/signoz-api",
    jsonData: { apiProfile: "signoz-v3", dataMode: "fixture" }
  },
  {
    uid: "zabbix",
    name: "Zabbix",
    type: "alexanderzobnin-zabbix-datasource",
    access: "proxy",
    url: "/zabbix-api3",
    jsonData: { dataMode: "fixture" }
  },
  {
    uid: "zabbix-3",
    name: "Zabbix 50.3",
    type: "alexanderzobnin-zabbix-datasource",
    access: "proxy",
    url: "/zabbix-api3",
    jsonData: { dataMode: "fixture" }
  },
  {
    uid: "zabbix-14",
    name: "Zabbix 50.14",
    type: "alexanderzobnin-zabbix-datasource",
    access: "proxy",
    url: "/zabbix-api14",
    jsonData: { dataMode: "fixture" }
  },
  {
    uid: "postgres",
    name: "PostgreSQL",
    type: "grafana-postgresql-datasource",
    access: "proxy",
    url: "localhost:5432",
    jsonData: {}
  },
  {
    uid: "mysql",
    name: "MySQL",
    type: "mysql",
    access: "proxy",
    url: "localhost:3306",
    jsonData: {}
  },
  {
    uid: "mssql",
    name: "MSSQL",
    type: "mssql",
    access: "proxy",
    url: "localhost:1433",
    jsonData: {}
  },
  {
    uid: "influxdb",
    name: "InfluxDB",
    type: "influxdb",
    access: "proxy",
    url: "http://localhost:8086",
    jsonData: {}
  },
  {
    uid: "graphite",
    name: "Graphite",
    type: "graphite",
    access: "proxy",
    url: "http://localhost:8080",
    jsonData: {}
  },
  {
    uid: "elasticsearch",
    name: "Elasticsearch",
    type: "elasticsearch",
    access: "proxy",
    url: "http://localhost:9200",
    jsonData: {}
  },
  {
    uid: "jaeger",
    name: "Jaeger",
    type: "jaeger",
    access: "proxy",
    url: "http://localhost:16686",
    jsonData: {}
  },
  {
    uid: "pyroscope",
    name: "Pyroscope",
    type: "grafana-pyroscope-datasource",
    access: "proxy",
    url: "http://localhost:4040",
    jsonData: {}
  },
  {
    uid: "cloudwatch",
    name: "CloudWatch",
    type: "cloudwatch",
    access: "proxy",
    jsonData: { defaultRegion: "us-east-1" }
  },
  {
    uid: "azure",
    name: "Azure Monitor",
    type: "grafana-azure-monitor-datasource",
    access: "proxy",
    jsonData: {}
  },
  {
    uid: "alertmanager",
    name: "Alertmanager",
    type: "alertmanager",
    access: "proxy",
    url: "http://localhost:9093",
    jsonData: {}
  },
  { uid: "mixed", name: "Mixed", type: "mixed", access: "proxy", jsonData: {} },
  {
    uid: "-- Grafana --",
    name: "Grafana",
    type: "grafana",
    access: "proxy",
    jsonData: {}
  },
  {
    uid: "dashboard",
    name: "Dashboard",
    type: "dashboard",
    access: "proxy",
    jsonData: {}
  }
];
function readDatasources() {
  const list = readJson(DS_STORAGE_KEY, []);
  if (!list.length) {
    writeJson(DS_STORAGE_KEY, DEFAULT_OFFLINE_DATASOURCES);
    return [...DEFAULT_OFFLINE_DATASOURCES];
  }
  const byUid2 = new Map(list.map((d) => [d.uid, d]));
  let dirty = false;
  for (const seed of DEFAULT_OFFLINE_DATASOURCES) {
    if (!byUid2.has(seed.uid)) {
      byUid2.set(seed.uid, seed);
      dirty = true;
      continue;
    }
    const existing = byUid2.get(seed.uid);
    const seedMode = seed.jsonData?.dataMode;
    const existMode = existing.jsonData?.dataMode;
    if (seedMode === "fixture" && existMode !== "live" && existMode !== "fixture") {
      byUid2.set(seed.uid, {
        ...existing,
        jsonData: { ...existing.jsonData || {}, ...seed.jsonData || {} }
      });
      dirty = true;
    }
  }
  const merged = [...byUid2.values()];
  if (dirty) writeJson(DS_STORAGE_KEY, merged);
  return merged;
}
function writeDatasources(list) {
  writeJson(DS_STORAGE_KEY, list);
}
function toPublicDatasource(ds2) {
  const anyDs = ds2;
  const secureJsonData = anyDs.secureJsonData;
  const fields = { ...anyDs.secureJsonFields ?? {} };
  if (secureJsonData && typeof secureJsonData === "object") {
    for (const [k, v] of Object.entries(secureJsonData)) {
      if (v != null && v !== "") fields[k] = true;
    }
  }
  const { secureJsonData: _drop, ...rest } = anyDs;
  return { ...rest, secureJsonFields: fields };
}
function pathOf(url) {
  try {
    if (url.startsWith("http")) {
      const u = new URL(url);
      return u.pathname + u.search;
    }
  } catch {
  }
  const q = url.indexOf("?");
  return q >= 0 ? url.slice(0, q) : url;
}
function queryParams(url, params) {
  const out = {};
  try {
    const full = url.startsWith("http") ? url : `http://local${url.startsWith("/") ? "" : "/"}${url}`;
    const u = new URL(full);
    u.searchParams.forEach((v, k) => {
      out[k] = v;
    });
  } catch {
  }
  if (params) {
    for (const [k, v] of Object.entries(params)) {
      if (v !== void 0) out[k] = String(v);
    }
  }
  return out;
}
function demoPanelOptions(type) {
  switch (type) {
    case "text":
      return {
        mode: "markdown",
        content: "## Grafana-Vue 全可视化演示\n每种 Panel 均有演示数据（TestData / 离线 fixture）。编辑 → 查询 / 转换 / 面板选项 / 字段。"
      };
    case "stat":
      return {
        reduceOptions: { calcs: ["lastNotNull"], fields: "", values: false },
        colorMode: "background",
        graphMode: "area",
        textMode: "auto",
        orientation: "auto"
      };
    case "gauge":
      return {
        showThresholdMarkers: true,
        showThresholdLabels: false,
        orientation: "auto",
        sizing: "auto"
      };
    case "bargauge":
      return {
        reduceOptions: { calcs: ["lastNotNull"], values: false },
        displayMode: "gradient",
        orientation: "horizontal",
        valueMode: "color",
        showUnfilled: true
      };
    case "piechart":
      return {
        reduceOptions: { calcs: ["lastNotNull"], values: true },
        pieType: "donut",
        legend: { showLegend: true, displayMode: "list", placement: "right" },
        tooltip: { mode: "single" }
      };
    case "timeseries":
    case "trend":
      return {
        legend: {
          showLegend: true,
          displayMode: "list",
          placement: "bottom",
          calcs: []
        },
        tooltip: { mode: "single", sort: "none" }
      };
    case "barchart":
      return {
        orientation: "auto",
        showValue: "auto",
        stacking: "none",
        barWidth: 0.9,
        groupWidth: 0.7,
        xTickLabelRotation: -30,
        legend: { showLegend: true, displayMode: "list", placement: "bottom" },
        tooltip: { mode: "single" }
      };
    case "histogram":
      return {
        bucketCount: 20,
        combine: false,
        fillOpacity: 80,
        gradientMode: "hue",
        stacking: "none"
      };
    case "heatmap":
      return {
        calculate: true,
        cellGap: 2,
        color: {
          mode: "scheme",
          scheme: "Spectral",
          reverse: false,
          steps: 64
        },
        legend: { show: true },
        tooltip: { mode: "single", yHistogram: true, showColorScale: true },
        yAxis: { axisPlacement: "left" }
      };
    case "candlestick":
      return {
        mode: "candles+volume",
        candleStyle: "candles",
        colorStrategy: "open-close",
        colors: { up: "green", down: "red", flat: "gray" },
        includeAllFields: false
      };
    case "state-timeline":
    case "status-history":
      return {
        showValue: "auto",
        rowHeight: 0.9,
        legend: { showLegend: true, displayMode: "list", placement: "bottom" }
      };
    case "logs":
      return {
        showTime: true,
        showLabels: false,
        showCommonLabels: false,
        wrapLogMessage: false,
        prettifyLogMessage: false,
        enableLogDetails: true,
        sortOrder: "Descending",
        dedupStrategy: "none",
        showLevel: true
      };
    case "logstable":
      return {
        enableLogDetails: true,
        showControls: true,
        showCopyLogLink: true,
        allowDownload: false
      };
    case "nodeGraph":
      return { layoutAlgorithm: "layered", zoomMode: "cooperative" };
    case "geomap":
      return {
        view: { lat: 0, lon: 0, zoom: 1 },
        controls: {
          showZoom: true,
          mouseWheelZoom: true,
          showAttribution: true
        },
        tooltip: { mode: "details" }
      };
    case "canvas":
      return {
        inlineEditing: false,
        showAdvancedTypes: true,
        tooltip: { mode: "single" },
        root: {
          type: "frame",
          elements: [
            {
              type: "metric-value",
              name: "Metric",
              config: { align: "center" },
              placement: { top: 20, left: 20, width: 120, height: 40 }
            }
          ]
        }
      };
    case "news":
      return { feedUrl: "https://grafana.com/blog/index.xml", showImage: true };
    case "dashlist":
      return {
        showStarred: true,
        showRecentlyViewed: true,
        showSearch: true,
        showHeadings: true,
        maxItems: 10
      };
    case "alertlist":
      return {
        maxItems: 10,
        viewMode: "list",
        groupMode: "default",
        sortOrder: 3
      };
    case "annolist":
      return {
        limit: 10,
        onlyInTimeRange: true,
        showTags: true,
        showTime: true,
        showUser: true
      };
    case "live":
      return { channel: "grafana/live/demo", display: "json" };
    case "debug":
      return { mode: "render" };
    case "traces":
      return {
        showServiceName: true,
        showDuration: true,
        spanFilters: { criticalPathOnly: false, matchesOnly: false }
      };
    case "flamegraph":
      return { showTable: true, collapsing: true, stickyHeader: true };
    case "table":
      return { showHeader: true, cellHeight: "sm", footer: { show: false } };
    case "xychart":
      return {
        series: [],
        mapping: "auto",
        legend: { showLegend: true },
        tooltip: { mode: "single" }
      };
    default:
      return {};
  }
}
function panelBase(id, type, title, gridPos, ds2, targets, options = {}) {
  return {
    id,
    type,
    title,
    gridPos,
    targets,
    datasource: ds2,
    options: { ...demoPanelOptions(type), ...options },
    fieldConfig: { defaults: {}, overrides: [] }
  };
}
function sampleTarget(type, uid) {
  const ds2 = { type, uid };
  switch (type) {
    case "alexanderzobnin-zabbix-datasource":
      return {
        refId: "A",
        datasource: ds2,
        queryType: "metrics",
        group: { filter: "/.*/" },
        host: { filter: "/.*/" },
        // Prefer a common Zabbix key so live demos return history points quickly.
        // Prefer keys that typically have history on busy Zabbix farms
        item: {
          filter: "/vfs.fs.size|cpu.util|system.uptime|system.cpu.load/"
        }
      };
    case "signoz":
      return {
        refId: "A",
        datasource: ds2,
        signal: "metrics",
        expr: "up",
        query: "up",
        queryType: "promql"
      };
    case "opentelemetry":
      return { refId: "A", datasource: ds2, signal: "metrics", expr: "up" };
    case "prometheus":
      return {
        refId: "A",
        datasource: ds2,
        expr: "up",
        legendFormat: "{{job}}"
      };
    case "loki":
      return {
        refId: "A",
        datasource: ds2,
        expr: '{job=~".+"}',
        queryType: "range"
      };
    case "tempo":
      return { refId: "A", datasource: ds2, queryType: "traceql", query: "{}" };
    case "jaeger":
      return { refId: "A", datasource: ds2, queryType: "search", service: "" };
    case "grafana-testdata-datasource":
    default:
      return { refId: "A", datasource: ds2, scenarioId: "random_walk" };
  }
}
function dsCatalogDashboard(uid, title) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  const rows = [
    ["数据源测试中心", "打开下方链接进入各 DS 测试页；Zabbix/SigNoz 需 live 代理与 token。"],
    ["ds-zabbix-full", "/d/ds-zabbix-full"],
    ["ds-signoz-full", "/d/ds-signoz-full"],
    ["ds-signoz-native-full", "/d/ds-signoz-native-full"],
    ["test-panel-view-edit-live-signoz-native", "/d/test-panel-view-edit-live-signoz-native"],
    ["ds-otel-full", "/d/ds-otel-full"],
    ["ds-prometheus", "/d/ds-prometheus"],
    ["ds-testdata", "/d/ds-testdata"],
    ["test-panel-view-edit", "/d/test-panel-view-edit"],
    ["test-panel-view-edit-live-zabbix", "/d/test-panel-view-edit-live-zabbix"],
    ["test-panel-view-edit-live-signoz", "/d/test-panel-view-edit-live-signoz"]
  ];
  const content = rows.map((r, i) => i === 0 ? `## ${r[0]}\\n${r[1]}` : `- [${r[0]}](${r[1]})`).join("\\n");
  return {
    uid,
    title,
    tags: ["ds-test", "catalog"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: [
      panelBase(1, "text", "数据源测试中心", { x: 0, y: 0, w: 24, h: 10 }, td, [], {
        mode: "markdown",
        content
      }),
      panelBase(2, "stat", "TestData 探活", { x: 0, y: 10, w: 6, h: 6 }, td, [
        { refId: "A", datasource: td, scenarioId: "random_walk" }
      ])
    ],
    time: { from: "now-1h", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function dsTypedDashboard(uid, title, type, dsUid) {
  const ds2 = { type, uid: dsUid };
  const target = sampleTarget(type, dsUid);
  const panels2 = [
    panelBase(1, "timeseries", `${title} · timeseries`, { x: 0, y: 0, w: 16, h: 10 }, ds2, [target]),
    panelBase(2, "stat", `${title} · stat`, { x: 16, y: 0, w: 8, h: 5 }, ds2, [target]),
    panelBase(3, "gauge", `${title} · gauge`, { x: 16, y: 5, w: 8, h: 5 }, ds2, [target]),
    panelBase(4, "table", `${title} · table`, { x: 0, y: 10, w: 12, h: 8 }, ds2, [target]),
    panelBase(5, "bargauge", `${title} · bargauge`, { x: 12, y: 10, w: 12, h: 8 }, ds2, [target])
  ];
  if (type === "alexanderzobnin-zabbix-datasource") {
    panels2.push(
      panelBase(6, "table", "Zabbix problems", { x: 0, y: 18, w: 24, h: 8 }, ds2, [
        {
          refId: "A",
          datasource: ds2,
          queryType: "problems",
          group: { filter: "/.*/" },
          host: { filter: "/.*/" }
        }
      ])
    );
    const ds14 = { type, uid: "zabbix-14" };
    panels2.push(
      panelBase(7, "timeseries", "Zabbix 50.14 · dual", { x: 0, y: 26, w: 24, h: 8 }, ds14, [
        {
          refId: "A",
          datasource: ds14,
          queryType: "metrics",
          group: { filter: "/.*/" },
          host: { filter: "/.*/" },
          // Prefer keys that typically have history on busy Zabbix farms
          item: {
            filter: "/vfs.fs.size|cpu.util|system.uptime|system.cpu.load/"
          }
        }
      ])
    );
  }
  if (type === "signoz") {
    panels2.push(
      panelBase(6, "logs", "SigNoz logs", { x: 0, y: 18, w: 12, h: 10 }, ds2, [
        { refId: "A", datasource: ds2, signal: "logs", expr: "", query: "" }
      ]),
      panelBase(7, "traces", "SigNoz traces", { x: 12, y: 18, w: 12, h: 10 }, ds2, [
        { refId: "A", datasource: ds2, signal: "traces", expr: "", query: "" }
      ])
    );
  }
  return {
    uid,
    title,
    tags: ["ds-test", type],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: panels2,
    // Prefer 6h so Zabbix history/trend has points for sparse items
    time: { from: "now-6h", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function dsVizMatrixDashboard(uid, title, type, dsUid) {
  const ds2 = { type, uid: dsUid };
  const target = sampleTarget(type, dsUid);
  const types = [
    "timeseries",
    "stat",
    "gauge",
    "bargauge",
    "table",
    "barchart",
    "piechart",
    "heatmap"
  ];
  const panels2 = types.map(
    (pt, i) => panelBase(i + 1, pt, pt, { x: i % 4 * 6, y: Math.floor(i / 4) * 8, w: 6, h: 8 }, ds2, [
      target
    ])
  );
  return {
    uid,
    title,
    tags: ["ds-test", "viz-matrix", type],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: panels2,
    time: { from: "now-6h", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function dsTestdataDashboard(uid, title) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  const scenarios = [
    "random_walk",
    "csv_metric_values",
    "random_walk_table",
    "logs",
    "trace",
    "node_graph",
    "flame_graph",
    "usa",
    "predictable_pulse",
    "predictable_csv_wave"
  ];
  const panels2 = scenarios.map(
    (s, i) => panelBase(
      i + 1,
      s === "logs" ? "logs" : s === "trace" ? "traces" : s === "node_graph" ? "nodeGraph" : s === "flame_graph" ? "flamegraph" : s === "random_walk_table" ? "table" : "timeseries",
      s,
      { x: i % 3 * 8, y: Math.floor(i / 3) * 8, w: 8, h: 8 },
      td,
      [{ refId: "A", datasource: td, scenarioId: s }]
    )
  );
  return {
    uid,
    title,
    tags: ["ds-test", "testdata"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: panels2,
    time: { from: "now-1h", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function dsMixedDashboard(uid, title) {
  const mixed = { type: "mixed", uid: "mixed" };
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  const prom = { type: "prometheus", uid: "prometheus" };
  return {
    uid,
    title,
    tags: ["ds-test", "mixed"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: [
      panelBase(1, "timeseries", "Mixed A+B", { x: 0, y: 0, w: 24, h: 10 }, mixed, [
        { refId: "A", datasource: td, scenarioId: "random_walk" },
        { refId: "B", datasource: prom, expr: "up" }
      ])
    ],
    time: { from: "now-1h", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function testSameConfigPixelDashboard(uid, title) {
  const ds2 = { type: "grafana-testdata-datasource", uid: "testdata" };
  const target = {
    refId: "A",
    datasource: ds2,
    scenarioId: "csv_metric_values",
    stringInput: "1,20,90,30,5,0,40,70,15,55"
  };
  const fc = {
    defaults: {
      unit: "short",
      thresholds: {
        mode: "absolute",
        steps: [
          { color: "green", value: null },
          { color: "red", value: 80 }
        ]
      }
    },
    overrides: []
  };
  return {
    uid,
    title,
    tags: ["ds-test", "pixel", "same-config"],
    schemaVersion: 39,
    timezone: "utc",
    version: 1,
    panels: [
      {
        ...panelBase(1, "stat", "pixel-stat", { x: 0, y: 0, w: 6, h: 6 }, ds2, [target], {
          colorMode: "background",
          graphMode: "area",
          reduceOptions: {
            calcs: ["lastNotNull"],
            fields: "",
            values: false
          }
        }),
        fieldConfig: fc
      },
      {
        ...panelBase(2, "gauge", "pixel-gauge", { x: 6, y: 0, w: 6, h: 6 }, ds2, [target], {
          showThresholdMarkers: true,
          orientation: "auto"
        }),
        fieldConfig: fc
      },
      {
        ...panelBase(
          3,
          "timeseries",
          "pixel-timeseries",
          { x: 12, y: 0, w: 12, h: 8 },
          ds2,
          [target],
          {
            legend: {
              showLegend: true,
              displayMode: "list",
              placement: "bottom"
            }
          }
        ),
        fieldConfig: {
          defaults: {
            ...fc.defaults,
            custom: {
              drawStyle: "line",
              lineWidth: 1,
              fillOpacity: 20,
              showPoints: "never"
            }
          },
          overrides: []
        }
      },
      {
        ...panelBase(4, "table", "pixel-table", { x: 0, y: 6, w: 12, h: 8 }, ds2, [
          {
            refId: "A",
            datasource: ds2,
            scenarioId: "csv_metric_values",
            stringInput: "1,20,90,30,5,0,40,70,15,55"
          }
        ]),
        fieldConfig: { defaults: {}, overrides: [] }
      },
      {
        ...panelBase(5, "bargauge", "pixel-bargauge", { x: 12, y: 8, w: 12, h: 6 }, ds2, [target], {
          displayMode: "gradient",
          orientation: "horizontal",
          reduceOptions: { calcs: ["lastNotNull"], values: false }
        }),
        fieldConfig: fc
      }
    ],
    // Fixed absolute range so same-config pixel captures are byte-stable across runs.
    time: { from: "2024-01-01T00:00:00.000Z", to: "2024-01-01T00:15:00.000Z" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function testViewEditDashboard(uid, title, dsUid = "testdata", type = "grafana-testdata-datasource") {
  const ds2 = { type, uid: dsUid };
  const target = sampleTarget(type, dsUid);
  return {
    uid,
    title,
    tags: ["ds-test", "view-edit"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: [
      panelBase(1, "timeseries", "主面板（View/Edit）", { x: 0, y: 0, w: 16, h: 12 }, ds2, [target]),
      panelBase(2, "stat", "辅助 Stat", { x: 16, y: 0, w: 8, h: 6 }, ds2, [target]),
      panelBase(3, "gauge", "辅助 Gauge", { x: 16, y: 6, w: 8, h: 6 }, ds2, [target])
    ],
    time: { from: "now-15m", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function testTimeVariablesDashboard(uid, title) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  return {
    uid,
    title,
    tags: ["ds-test", "variables"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: [
      panelBase(1, "timeseries", "变量驱动", { x: 0, y: 0, w: 24, h: 10 }, td, [
        {
          refId: "A",
          datasource: td,
          scenarioId: "random_walk",
          alias: "$job"
        }
      ])
    ],
    time: { from: "now-1h", to: "now" },
    templating: {
      list: [
        {
          type: "custom",
          name: "job",
          label: "Job",
          query: "api,web,db",
          current: { text: "api", value: "api" },
          options: [
            { text: "api", value: "api", selected: true },
            { text: "web", value: "web", selected: false }
          ],
          multi: false,
          includeAll: false
        }
      ]
    },
    annotations: { list: [] }
  };
}
function testTransformsDashboard(uid, title) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  return {
    uid,
    title,
    tags: ["ds-test", "transform"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: [
      {
        ...panelBase(1, "table", "Reduce transform", { x: 0, y: 0, w: 24, h: 10 }, td, [
          { refId: "A", datasource: td, scenarioId: "random_walk" }
        ]),
        transformations: [{ id: "reduce", options: { reducers: ["mean", "max"] } }]
      }
    ],
    time: { from: "now-1h", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function testSixStatesDashboard(uid, title) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  return {
    uid,
    title,
    tags: ["ds-test", "six-states"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    panels: [
      panelBase(1, "stat", "success", { x: 0, y: 0, w: 8, h: 6 }, td, [
        { refId: "A", datasource: td, scenarioId: "random_walk" }
      ]),
      panelBase(2, "stat", "empty-ish", { x: 8, y: 0, w: 8, h: 6 }, td, [
        { refId: "A", datasource: td, scenarioId: "no_data_points" }
      ]),
      panelBase(3, "timeseries", "loading-refresh", { x: 16, y: 0, w: 8, h: 6 }, td, [
        {
          refId: "A",
          datasource: td,
          scenarioId: "random_walk",
          stringInput: "slow"
        }
      ])
    ],
    time: { from: "now-15m", to: "now" },
    templating: { list: [] },
    annotations: { list: [] }
  };
}
function demoDashboard(uid, title) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  const panelDefs = [
    { type: "text", title: "可视化全景演示", w: 24, h: 3 },
    { type: "stat", title: "Stat", scenario: "random_walk" },
    { type: "gauge", title: "Gauge", scenario: "random_walk" },
    {
      type: "bargauge",
      title: "Bar gauge",
      scenario: "csv_metric_values",
      stringInput: "10,25,40,15,30,70"
    },
    { type: "table", title: "Table", scenario: "random_walk_table" },
    {
      type: "piechart",
      title: "Pie chart",
      scenario: "csv_metric_values",
      stringInput: "10,25,40,15,30"
    },
    {
      type: "timeseries",
      title: "Time series",
      scenario: "random_walk",
      w: 12,
      h: 8
    },
    { type: "trend", title: "Trend", scenario: "linear_trend" },
    { type: "barchart", title: "Bar chart", scenario: "csv_metric_values" },
    { type: "histogram", title: "Histogram", scenario: "random_walk" },
    { type: "heatmap", title: "Heatmap", scenario: "random_walk" },
    {
      type: "candlestick",
      title: "Candlestick",
      scenario: "predictable_csv_wave"
    },
    {
      type: "state-timeline",
      title: "State timeline",
      scenario: "predictable_pulse",
      w: 12,
      h: 6
    },
    {
      type: "status-history",
      title: "Status history",
      scenario: "predictable_pulse",
      w: 12,
      h: 6
    },
    { type: "xychart", title: "XY chart", scenario: "random_walk" },
    { type: "geomap", title: "Geomap", scenario: "usa" },
    { type: "nodeGraph", title: "Node graph", scenario: "node_graph" },
    { type: "logs", title: "Logs", scenario: "logs", w: 12, h: 8 },
    { type: "logstable", title: "Logs table", scenario: "logs", w: 12, h: 8 },
    { type: "traces", title: "Traces", scenario: "trace", w: 12, h: 10 },
    {
      type: "flamegraph",
      title: "Flame graph",
      scenario: "flame_graph",
      w: 12,
      h: 10
    },
    { type: "canvas", title: "Canvas", scenario: "random_walk" },
    { type: "news", title: "News" },
    { type: "dashlist", title: "Dashboard list" },
    { type: "alertlist", title: "Alert list" },
    { type: "annolist", title: "Annotation list" },
    { type: "live", title: "Live" },
    { type: "debug", title: "Debug", scenario: "random_walk" },
    { type: "gettingstarted", title: "Getting started" },
    { type: "welcome", title: "Welcome" }
  ];
  let x = 0;
  let y = 0;
  let rowH = 0;
  const panels2 = panelDefs.map((d, idx) => {
    const w = d.w ?? 6;
    const h2 = d.h ?? 8;
    if (x + w > 24) {
      x = 0;
      y += rowH || 8;
      rowH = 0;
    }
    const gridPos = { x, y, w, h: h2 };
    x += w;
    rowH = Math.max(rowH, h2);
    const options = demoPanelOptions(d.type);
    return {
      id: idx + 1,
      type: d.type,
      title: d.title,
      gridPos,
      targets: d.scenario ? [
        {
          refId: "A",
          datasource: td,
          scenarioId: d.scenario,
          ...d.stringInput ? { stringInput: d.stringInput } : {},
          ...d.seriesCount ? { seriesCount: d.seriesCount } : {}
        }
      ] : [],
      datasource: td,
      options,
      fieldConfig: { defaults: {}, overrides: [] }
    };
  });
  return {
    uid,
    title: title || "可视化全景演示",
    tags: ["demo", "all-panels"],
    schemaVersion: 39,
    timezone: "browser",
    version: 1,
    refresh: "30s",
    panels: panels2,
    time: { from: "now-6h", to: "now" },
    templating: {
      list: [
        {
          type: "custom",
          name: "job",
          label: "Job",
          query: "api,web,db",
          current: { text: "api", value: "api" },
          options: [
            { text: "api", value: "api", selected: true },
            { text: "web", value: "web", selected: false }
          ],
          multi: false,
          includeAll: false
        },
        {
          type: "interval",
          name: "interval",
          label: "Interval",
          query: "1m,5m,10m,1h",
          current: { text: "1m", value: "1m" },
          auto: true,
          auto_count: 30,
          auto_min: "10s"
        }
      ]
    },
    annotations: { list: [] }
  };
}
async function offlineRequest(opts) {
  seedDemoDashboards();
  const method = (opts.method ?? (opts.data ? "POST" : "GET")).toUpperCase();
  const path = pathOf(opts.url);
  const params = queryParams(opts.url, opts.params);
  {
    const m = path.match(/^\/api\/dashboards\/uid\/([^/]+)\/?$/);
    if (method === "GET" && m) {
      const uid = decodeURIComponent(m[1]);
      const map = readDashMap();
      const rec = map[uid];
      const pluginDash = loadPluginDashboard("", "", uid, rec?.title || uid);
      let dashboard = rec?.raw ?? (Array.isArray(pluginDash?.panels) && pluginDash.panels.length > 0 ? pluginDash : demoDashboard(uid, rec?.title));
      const panels2 = dashboard?.panels;
      const panelTypes = new Set(
        (Array.isArray(panels2) ? panels2 : []).map((p) => p?.type).filter(Boolean)
      );
      const hasFreshTrend = (Array.isArray(panels2) ? panels2 : []).some(
        (p) => p?.type === "trend" && Array.isArray(p.targets) && p.targets.some((tg) => tg?.scenarioId === "linear_trend")
      );
      const hasFreshPie = (Array.isArray(panels2) ? panels2 : []).some(
        (p) => p?.type === "piechart" && Array.isArray(p.targets) && p.targets.some((tg) => String(tg?.stringInput || "").includes("10,25,40"))
      );
      const needsDemoUpgrade = !Array.isArray(panels2) || panels2.length < 25 || !panelTypes.has("news") || !panelTypes.has("timeseries") || !panels2.some(
        (p) => p && (p.title === "Welcome" || String(p.title || "").includes("可视化"))
      ) || !hasFreshTrend || !hasFreshPie;
      if (needsDemoUpgrade && (uid === "vue-demo" || uid === "demo" || uid === "v1-demo")) {
        dashboard = demoDashboard(uid, String(dashboard?.title || rec?.title || uid));
        if (rec) {
          map[uid] = {
            ...rec,
            raw: dashboard,
            title: String(dashboard.title || rec.title)
          };
          writeDashMap(map);
        }
      }
      return ok({
        dashboard,
        meta: {
          canSave: true,
          canEdit: true,
          canAdmin: true,
          canStar: false,
          slug: String(dashboard.title || uid).toLowerCase().replaceAll(/\s+/g, "-"),
          url: `/d/${uid}`,
          version: rec?.version ?? 1,
          folderTitle: "General"
        }
      });
    }
  }
  if (method === "POST" && /^\/api\/dashboards\/db\/?$/.test(path)) {
    const body = opts.data ?? {};
    const dash = { ...body.dashboard ?? {} };
    const uid = String(dash.uid || `local-${Date.now().toString(36)}`);
    const title = String(dash.title || "Untitled dashboard");
    const map = readDashMap();
    const prev = map[uid];
    const version = (prev?.version ?? Number(dash.version) ?? 0) + 1;
    const raw = { ...dash, uid, title, version };
    map[uid] = {
      uid,
      title,
      raw,
      savedAt: (/* @__PURE__ */ new Date()).toISOString(),
      version
    };
    writeDashMap(map);
    return ok({
      status: "success",
      slug: title.toLowerCase().replaceAll(/\s+/g, "-"),
      version,
      id: version,
      uid,
      url: `/d/${uid}/${title.toLowerCase().replaceAll(/\s+/g, "-")}`
    });
  }
  if (method === "GET" && /^\/api\/search\/?$/.test(path)) {
    const type = params.type;
    const query = (params.query || params.q || "").toLowerCase();
    const map = readDashMap();
    let items = Object.values(map).map((d) => ({
      id: 0,
      uid: d.uid,
      title: d.title,
      uri: `db/${d.uid}`,
      url: `/d/${d.uid}/${d.title.toLowerCase().replaceAll(/\s+/g, "-")}`,
      type: "dash-db",
      tags: [],
      isStarred: false
    }));
    if (type && type !== "dash-db") {
      items = [];
    }
    if (query) {
      items = items.filter((i) => i.title.toLowerCase().includes(query) || i.uid.includes(query));
    }
    const starredParam = String(params.starred ?? "").toLowerCase();
    if (starredParam === "true" || starredParam === "1") {
      items = items.filter((i) => !!i.isStarred);
    }
    return ok(items);
  }
  if (method === "GET" && /^\/api\/datasources\/?$/.test(path)) {
    return ok(readDatasources().map(toPublicDatasource));
  }
  {
    const m = path.match(/^\/api\/datasources\/uid\/([^/]+)\/?$/);
    if (method === "GET" && m) {
      const uid = decodeURIComponent(m[1]);
      const ds2 = readDatasources().find((d) => d.uid === uid);
      if (!ds2) notFound(`Data source not found: ${uid}`);
      return ok(toPublicDatasource(ds2));
    }
  }
  {
    const m = path.match(/^\/api\/datasources\/uid\/([^/]+)\/health\/?$/);
    if (method === "GET" && m) {
      return ok({ status: "OK", message: "Offline fixture OK" });
    }
  }
  if (method === "POST" && /^\/api\/datasources\/?$/.test(path)) {
    const body = opts.data ?? {};
    const list = readDatasources();
    const uid = body.uid || `ds-${Date.now().toString(36)}`;
    const bodyAny = body;
    const fields = {
      ...bodyAny.secureJsonFields || {}
    };
    if (bodyAny.secureJsonData && typeof bodyAny.secureJsonData === "object") {
      for (const [k, v] of Object.entries(bodyAny.secureJsonData)) {
        if (v != null && v !== "") fields[k] = true;
      }
    }
    const { secureJsonData: _dropSecure, ...bodyRest } = bodyAny;
    const rec = {
      ...bodyRest,
      uid,
      name: body.name || uid,
      type: body.type || "grafana-testdata-datasource",
      access: body.access || "proxy",
      jsonData: body.jsonData || {},
      secureJsonFields: fields
    };
    list.push(rec);
    writeDatasources(list);
    return ok(toPublicDatasource(rec));
  }
  {
    const m = path.match(/^\/api\/datasources\/uid\/([^/]+)\/?$/);
    if (method === "PUT" && m) {
      const uid = decodeURIComponent(m[1]);
      const list = readDatasources();
      const idx = list.findIndex((d) => d.uid === uid);
      if (idx < 0) notFound(`Data source not found: ${uid}`);
      const body = opts.data ?? {};
      const prev = list[idx];
      const bodyAny = body;
      const fields = {
        ...prev.secureJsonFields ?? {},
        ...bodyAny.secureJsonFields ?? {}
      };
      if (bodyAny.secureJsonData && typeof bodyAny.secureJsonData === "object") {
        for (const [k, v] of Object.entries(bodyAny.secureJsonData)) {
          if (v != null && v !== "") fields[k] = true;
        }
      }
      const { secureJsonData: _dropSecure, ...bodyRest } = bodyAny;
      const { secureJsonData: _prevSecure, ...prevRest } = prev;
      list[idx] = {
        ...prevRest,
        ...bodyRest,
        uid,
        secureJsonFields: fields
      };
      writeDatasources(list);
      return ok(toPublicDatasource(list[idx]));
    }
  }
  {
    const m = path.match(/^\/api\/datasources\/uid\/([^/]+)\/?$/);
    if (method === "DELETE" && m) {
      const uid = decodeURIComponent(m[1]);
      writeDatasources(readDatasources().filter((d) => d.uid !== uid));
      return ok({ message: "Data source deleted" });
    }
  }
  if (method === "POST" && /^\/api\/ds\/query\/?$/.test(path)) {
    return ok({ results: {} });
  }
  if (method === "GET" && /^\/api\/health\/?$/.test(path)) {
    return ok({
      database: "ok",
      version: "13.2.0-vue-offline",
      commit: "offline"
    });
  }
  notFound(`Offline backend: no handler for ${method} ${path}`);
}
function createHttpClient(opts) {
  const instance = axios.create({
    baseURL: opts.baseURL,
    timeout: opts.timeoutMs ?? 3e4,
    withCredentials: opts.withCredentials ?? false,
    // Caller decides ok/error — matches prior fetch + res.ok handling in adapters
    validateStatus: () => true,
    // Avoid axios transforming JSON automatically when we need raw text for size checks
    transitional: { forcedJSONParsing: false, silentJSONParsing: true },
    responseType: "text",
    adapter: opts.adapter
  });
  const ejectors = [];
  return {
    kind: opts.kind,
    axios: instance,
    async request(config2) {
      return instance.request(config2);
    },
    dispose() {
      for (const eject of ejectors) eject();
      ejectors.length = 0;
    }
  };
}
class NormalizedHeaders {
  map = /* @__PURE__ */ new Map();
  constructor(init) {
    if (!init) return;
    if (typeof init.forEach === "function" && typeof init.get === "function") {
      init.forEach((v, k) => this.map.set(k.toLowerCase(), v));
      return;
    }
    for (const [k, v] of Object.entries(init)) {
      if (v == null) continue;
      this.map.set(k.toLowerCase(), Array.isArray(v) ? String(v[0]) : String(v));
    }
  }
  get(name) {
    return this.map.get(name.toLowerCase()) ?? null;
  }
  has(name) {
    return this.map.has(name.toLowerCase());
  }
  forEach(cb) {
    this.map.forEach((v, k) => cb(v, k));
  }
  entries() {
    return this.map.entries();
  }
}
function axiosHeadersToRecord(headers) {
  const out = {};
  if (!headers || typeof headers !== "object") return out;
  for (const [k, v] of Object.entries(headers)) {
    if (v == null) continue;
    out[k] = Array.isArray(v) ? String(v[0]) : String(v);
  }
  return out;
}
let backendHttp = null;
let datasourceHttpClient = null;
let resourceHttp = null;
let appHttp = null;
function getBackendHttp() {
  if (!backendHttp) {
    backendHttp = createHttpClient({
      kind: "backend",
      withCredentials: true,
      timeoutMs: 6e4
    });
  }
  return backendHttp;
}
function getDatasourceHttpClient() {
  if (!datasourceHttpClient) {
    datasourceHttpClient = createHttpClient({
      kind: "datasource",
      withCredentials: false,
      timeoutMs: 6e4
    });
  }
  return datasourceHttpClient;
}
function getResourceHttp() {
  if (!resourceHttp) {
    resourceHttp = createHttpClient({
      kind: "resource",
      withCredentials: false,
      timeoutMs: 3e4
    });
  }
  return resourceHttp;
}
function getAppHttp() {
  if (!appHttp) {
    appHttp = createHttpClient({
      kind: "app",
      withCredentials: true,
      timeoutMs: 3e4
    });
  }
  return appHttp;
}
function configureDatasourceHttpClient(opts) {
  datasourceHttpClient?.dispose();
  datasourceHttpClient = createHttpClient({
    kind: "datasource",
    withCredentials: false,
    timeoutMs: opts?.timeoutMs ?? 6e4,
    adapter: opts?.adapter
  });
  return datasourceHttpClient;
}
function resetHttpClients() {
  backendHttp?.dispose();
  datasourceHttpClient?.dispose();
  resourceHttp?.dispose();
  appHttp?.dispose();
  backendHttp = null;
  datasourceHttpClient = null;
  resourceHttp = null;
  appHttp = null;
}
const __vite_import_meta_env__$2 = { "BASE_URL": "./", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
const STORAGE_KEY$1 = "grafana-vue-auth-token";
const WINDOW_KEY = "__GRAFANA_VUE_AUTH_TOKEN__";
function nonEmpty$1(v) {
  if (v == null) return void 0;
  const s = String(v).trim();
  return s.length ? s : void 0;
}
function readEnvToken() {
  try {
    const meta2 = __vite_import_meta_env__$2;
    const fromVite = nonEmpty$1(meta2?.VITE_GRAFANA_TOKEN) || nonEmpty$1(meta2?.VITE_GRAFANA_API_TOKEN);
    if (fromVite) return fromVite;
  } catch {
  }
  try {
    const g = globalThis;
    return nonEmpty$1(g.process?.env?.GRAFANA_TOKEN) || nonEmpty$1(g.process?.env?.VITE_GRAFANA_TOKEN) || nonEmpty$1(g.process?.env?.GRAFANA_API_TOKEN);
  } catch {
    return void 0;
  }
}
function readWindowToken() {
  if (typeof globalThis === "undefined") return void 0;
  const w = globalThis;
  return nonEmpty$1(w[WINDOW_KEY]);
}
function readStorageToken() {
  try {
    if (typeof localStorage === "undefined") return void 0;
    return nonEmpty$1(localStorage.getItem(STORAGE_KEY$1));
  } catch {
    return void 0;
  }
}
function getGrafanaAuthToken() {
  return readWindowToken() ?? readStorageToken() ?? readEnvToken() ?? null;
}
function getGrafanaAuthSnapshot() {
  if (readWindowToken()) {
    return {
      present: true,
      source: "window",
      preview: redactToken(readWindowToken())
    };
  }
  if (readStorageToken()) {
    return {
      present: true,
      source: "localStorage",
      preview: redactToken(readStorageToken())
    };
  }
  if (readEnvToken()) {
    return {
      present: true,
      source: "env",
      preview: redactToken(readEnvToken())
    };
  }
  return { present: false, source: "none", preview: "" };
}
function redactToken(token) {
  if (!token) return "";
  if (token.length <= 8) return "***";
  return `${token.slice(0, 4)}***${token.slice(-2)}`;
}
function setGrafanaAuthToken(token) {
  try {
    if (typeof localStorage === "undefined") return;
    if (!token) localStorage.removeItem(STORAGE_KEY$1);
    else localStorage.setItem(STORAGE_KEY$1, token);
  } catch {
  }
}
class GrafanaAuthError extends Error {
  code = "AUTH_TOKEN_MISSING";
  constructor(message2 = "Grafana API token missing; set VITE_GRAFANA_TOKEN or window.__GRAFANA_VUE_AUTH_TOKEN__") {
    super(message2);
    this.name = "GrafanaAuthError";
  }
}
function requireGrafanaAuthToken() {
  const t2 = getGrafanaAuthToken();
  if (!t2) throw new GrafanaAuthError();
  return t2;
}
function applyGrafanaAuthHeaders(headers = {}) {
  const out = { ...headers };
  if (out.Authorization || out.authorization) return out;
  const token = getGrafanaAuthToken();
  if (token) out.Authorization = `Bearer ${token}`;
  return out;
}
function isGrafanaLiveConfigured() {
  if (getGrafanaAuthToken()) return true;
  try {
    const meta2 = __vite_import_meta_env__$2;
    if (nonEmpty$1(meta2?.VITE_GRAFANA_URL) || nonEmpty$1(meta2?.VITE_GRAFANA_API_URL)) return true;
  } catch {
  }
  try {
    const g = globalThis;
    if (nonEmpty$1(g.__GRAFANA_VUE_GRAFANA_URL__)) return true;
    if (nonEmpty$1(g.process?.env?.GRAFANA_URL) || nonEmpty$1(g.process?.env?.VITE_GRAFANA_URL))
      return true;
  } catch {
  }
  return false;
}
function getGrafanaBaseUrl() {
  try {
    const meta2 = __vite_import_meta_env__$2;
    const fromVite = nonEmpty$1(meta2?.VITE_GRAFANA_URL) || nonEmpty$1(meta2?.VITE_GRAFANA_API_URL);
    if (fromVite) return fromVite.replace(/\/$/, "");
  } catch {
  }
  try {
    const g = globalThis;
    const fromGlobal = nonEmpty$1(g.__GRAFANA_VUE_GRAFANA_URL__);
    if (fromGlobal) return fromGlobal.replace(/\/$/, "");
    const fromEnv = nonEmpty$1(g.process?.env?.GRAFANA_URL) || nonEmpty$1(g.process?.env?.VITE_GRAFANA_URL);
    if (fromEnv) return fromEnv.replace(/\/$/, "");
  } catch {
  }
  return "";
}
let baseUrl = "";
let clientOverride = null;
function configureLiveAdapter(opts) {
  if (opts.baseUrl != null) baseUrl = opts.baseUrl.replace(/\/$/, "");
  if (opts.client) {
    clientOverride = opts.client;
    return;
  }
  if (opts.axiosAdapter) {
    clientOverride = createHttpClient({
      kind: "backend",
      withCredentials: true,
      adapter: opts.axiosAdapter
    });
    return;
  }
  if (opts.fetch) {
    const fetchImpl = opts.fetch;
    clientOverride = createHttpClient({
      kind: "backend",
      withCredentials: true,
      adapter: async (config2) => {
        const url = resolveUrl(config2);
        const headers = {};
        const raw = config2.headers;
        if (raw) {
          for (const [k, v] of Object.entries(raw)) {
            if (v == null || k === "common" || typeof v === "object") continue;
            headers[k] = String(v);
          }
        }
        const res = await fetchImpl(url, {
          method: (config2.method || "GET").toUpperCase(),
          headers,
          body: config2.data,
          signal: config2.signal,
          credentials: "same-origin"
        });
        const text = await res.text();
        const h2 = {};
        res.headers.forEach((val, key) => {
          h2[key] = val;
        });
        return {
          data: text,
          status: res.status,
          statusText: res.statusText,
          headers: h2,
          config: config2
        };
      }
    });
  }
}
function resolveUrl(config2) {
  const base = config2.baseURL || "";
  const url = config2.url || "";
  if (url.startsWith("http")) return url;
  if (base) return `${base.replace(/\/$/, "")}/${url.replace(/^\//, "")}`;
  return url;
}
function buildUrl(url, params) {
  const full = url.startsWith("http") ? url : `${baseUrl}${url}`;
  if (!params) return full;
  const u = new URL(full, "http://local");
  for (const [k, v] of Object.entries(params)) {
    if (v !== void 0) u.searchParams.set(k, String(v));
  }
  if (full.startsWith("http")) return u.toString();
  return u.pathname + u.search;
}
async function liveRequest(opts) {
  const method = (opts.method ?? (opts.data ? "POST" : "GET")).toUpperCase();
  let headers = {
    Accept: "application/json",
    ...opts.headers ?? {}
  };
  headers = applyGrafanaAuthHeaders(headers);
  const pathOnly = (() => {
    try {
      const u = opts.url.startsWith("http") ? new URL(opts.url).pathname : opts.url.split("?")[0];
      return u;
    } catch {
      return opts.url;
    }
  })();
  const isGrafanaApi = pathOnly === "/api" || pathOnly.startsWith("/api/") || pathOnly.startsWith("/apis/");
  if (isGrafanaApi && !headers.Authorization && !headers.authorization) {
    if (getGrafanaAuthToken() === null && opts.requireAuth) {
      throw new GrafanaAuthError();
    }
  }
  let body;
  if (opts.data !== void 0) {
    headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
    body = typeof opts.data === "string" ? opts.data : JSON.stringify(opts.data);
  }
  const client = clientOverride ?? getBackendHttp();
  const res = await client.request({
    url: buildUrl(opts.url, opts.params),
    method,
    headers,
    data: body,
    signal: opts.signal,
    responseType: "text",
    withCredentials: true
  });
  const text = typeof res.data === "string" ? res.data : res.data == null ? "" : String(res.data);
  let data;
  try {
    data = text ? JSON.parse(text) : null;
  } catch {
    data = text;
  }
  const normalized = new NormalizedHeaders(res.headers);
  const hdrs = new Headers();
  normalized.forEach((v, k) => hdrs.set(k, v));
  if (res.status < 200 || res.status >= 300) {
    const err = new Error(`Backend request failed: ${res.status} ${res.statusText}`);
    err.status = res.status;
    err.data = data;
    throw err;
  }
  return {
    data,
    status: res.status,
    statusText: res.statusText || "",
    ok: res.status >= 200 && res.status < 300,
    headers: hdrs
  };
}
let mode = "offline";
let customAdapter = null;
function detectInitialMode() {
  try {
    if (typeof globalThis !== "undefined") {
      const g = globalThis;
      const fromGlobal = g.__GRAFANA_VUE_BACKEND_MODE__;
      if (fromGlobal === "live" || fromGlobal === "offline") return fromGlobal;
      const env = g.process?.env?.GRAFANA_VUE_BACKEND_MODE ?? g.process?.env?.VITE_BACKEND_MODE;
      if (env === "live") return "live";
    }
  } catch {
  }
  return "offline";
}
mode = detectInitialMode();
function getBackendMode() {
  return mode;
}
function configureBackendSrv(opts) {
  if (opts.mode) mode = opts.mode;
  if (opts.adapter !== void 0) customAdapter = opts.adapter;
  const baseUrl2 = opts.baseUrl != null ? opts.baseUrl : getGrafanaBaseUrl();
  if (opts.fetch || opts.baseUrl != null || baseUrl2) {
    configureLiveAdapter({
      fetch: opts.fetch,
      baseUrl: baseUrl2 || opts.baseUrl
    });
  }
  if (opts.requireAuth != null) {
    globalThis.__GRAFANA_VUE_REQUIRE_AUTH__ = !!opts.requireAuth;
  }
}
function shouldServeFromOfflineSeed(url) {
  try {
    const path = url.startsWith("http") ? new URL(url).pathname : url.split("?")[0];
    if (path.startsWith("/zabbix-api") || path.startsWith("/signoz-api") || path.startsWith("/signoz-api") || path.includes("api_jsonrpc")) {
      return false;
    }
    if (isGrafanaLiveConfigured()) {
      const liveGrafanaPrefixes = [
        "/api/dashboards",
        "/api/search",
        "/api/folders",
        "/api/library-elements",
        "/api/annotations",
        "/api/user",
        "/api/org",
        "/api/orgs",
        "/api/frontend",
        "/api/plugins",
        "/api/datasources",
        "/api/ds/query",
        "/api/health"
      ];
      if (liveGrafanaPrefixes.some((p) => path === p || path.startsWith(`${p}/`))) {
        return false;
      }
    }
    const offlinePrefixes = [
      "/api/dashboards",
      "/api/search",
      "/api/folders",
      "/api/library-elements",
      "/api/annotations",
      "/api/user",
      "/api/org",
      "/api/orgs",
      "/api/frontend",
      "/api/plugins",
      "/api/datasources",
      "/api/ds/query",
      // offline seeds for local demos without Grafana
      "/api/prometheus",
      "/api/v1",
      "/apis/"
    ];
    return offlinePrefixes.some(
      (p) => path === p || path.startsWith(`${p}/`) || path.startsWith(p)
    );
  } catch {
    return true;
  }
}
async function backendRequest(opts) {
  if (customAdapter) {
    return customAdapter.request(opts);
  }
  if (mode === "live") {
    if (shouldServeFromOfflineSeed(opts.url)) {
      return offlineRequest(opts);
    }
    if (globalThis.__GRAFANA_VUE_REQUIRE_AUTH__ && isGrafanaLiveConfigured()) {
      try {
        requireGrafanaAuthToken();
      } catch (error) {
        if (error instanceof GrafanaAuthError) throw error;
        throw error;
      }
    }
    return liveRequest({
      ...opts,
      requireAuth: !!globalThis.__GRAFANA_VUE_REQUIRE_AUTH__
    });
  }
  return offlineRequest(opts);
}
const backendSrv = {
  get: (url, params, options) => backendRequest({ ...options, method: "GET", url, params }),
  post: (url, data, options) => backendRequest({ ...options, method: "POST", url, data }),
  put: (url, data, options) => backendRequest({ ...options, method: "PUT", url, data }),
  patch: (url, data, options) => backendRequest({ ...options, method: "PATCH", url, data }),
  delete: (url, options) => backendRequest({ ...options, method: "DELETE", url }),
  request: backendRequest,
  configure: configureBackendSrv,
  getMode: getBackendMode
};
const state$2 = reactive({
  path: typeof window !== "undefined" ? window.location.pathname : "/",
  query: {},
  hash: ""
});
function useLocationService() {
  return {
    state: readonly(state$2),
    partial: (update) => {
      if (update.path != null) state$2.path = update.path;
      if (update.query != null) state$2.query = { ...state$2.query, ...update.query };
      if (update.hash != null) state$2.hash = update.hash;
    },
    push: (path, query) => {
      state$2.path = path;
      if (query) state$2.query = query;
    },
    replace: (path, query) => {
      state$2.path = path;
      if (query) state$2.query = query;
    },
    getSearchObject: () => ({ ...state$2.query })
  };
}
const THEME_STORAGE_KEY = "grafana-vue-theme-preference";
const listeners$1 = /* @__PURE__ */ new Set();
const state$1 = reactive({
  preference: "dark"
});
const theme2Ref = shallowRef(createTheme({ colors: { mode: "dark" } }));
function onThemeChange(fn) {
  listeners$1.add(fn);
  return () => listeners$1.delete(fn);
}
function systemPrefersDark() {
  if (typeof window === "undefined" || !window.matchMedia) return true;
  return window.matchMedia("(prefers-color-scheme: dark)").matches;
}
function resolveMode(pref = state$1.preference) {
  if (pref === "system") return systemPrefersDark() ? "dark" : "light";
  return pref;
}
function readStoredPreference() {
  if (typeof localStorage === "undefined") return null;
  try {
    const v = localStorage.getItem(THEME_STORAGE_KEY);
    if (v === "light" || v === "dark" || v === "system") return v;
  } catch {
  }
  return null;
}
function writeStoredPreference(pref) {
  if (typeof localStorage === "undefined") return;
  try {
    localStorage.setItem(THEME_STORAGE_KEY, pref);
  } catch {
  }
}
function readUrlTheme() {
  if (typeof window === "undefined") return null;
  try {
    const q = new URLSearchParams(window.location.search);
    const t2 = q.get("theme");
    if (t2 === "light" || t2 === "dark") return t2;
  } catch {
  }
  return null;
}
function readBootTheme() {
  try {
    const boot = globalThis.__grafana_boot_data__ ?? globalThis.grafanaBootData;
    const t2 = boot?.user?.theme;
    if (t2 === "light" || t2 === "dark" || t2 === "system") return t2;
  } catch {
  }
  return null;
}
function resolveInitialPreference() {
  const url = readUrlTheme();
  if (url) {
    const stored = readStoredPreference() ?? readBootTheme() ?? "dark";
    return { preference: stored, runtimeOnly: url };
  }
  return { preference: readStoredPreference() ?? readBootTheme() ?? "dark" };
}
function applyDom(mode2, theme) {
  if (typeof document === "undefined") return;
  applyResolvedTheme(theme, document.documentElement);
  document.documentElement.style.colorScheme = mode2;
  document.documentElement.dataset.theme = mode2;
  if (document.body) {
    document.body.style.colorScheme = mode2;
    document.body.dataset.theme = mode2;
  }
}
function notify(mode2) {
  for (const fn of listeners$1) {
    try {
      fn(mode2);
    } catch {
    }
  }
}
function rebuildTheme(mode2, persist) {
  const theme = createTheme({ colors: { mode: mode2 } });
  theme2Ref.value = theme;
  applyDom(mode2, theme);
  if (persist) writeStoredPreference(state$1.preference);
  notify(mode2);
}
function initTheme(options) {
  const fallback = resolveInitialPreference();
  const preference = options?.preference ?? fallback.preference;
  const runtimeOnly = options?.runtimeOnly ?? fallback.runtimeOnly;
  state$1.preference = preference;
  const mode2 = runtimeOnly ?? resolveMode(preference);
  rebuildTheme(mode2, !runtimeOnly);
  return mode2;
}
function useTheme() {
  const resolved = computed(() => {
    const url = readUrlTheme();
    if (url) return url;
    return resolveMode(state$1.preference);
  });
  const setMode = (mode2, opts) => {
    state$1.preference = mode2;
    const effective = opts?.runtimeOnly ? resolveMode(mode2) : readUrlTheme() ?? resolveMode(mode2);
    rebuildTheme(effective, !opts?.runtimeOnly);
  };
  const setRuntimeMode = (mode2) => {
    rebuildTheme(mode2, false);
  };
  return {
    /** User preference including 'system' */
    mode: readonly(computed(() => state$1.preference)),
    preference: readonly(computed(() => state$1.preference)),
    /** Resolved light|dark */
    resolved,
    theme2: readonly(theme2Ref),
    setMode,
    setRuntimeMode,
    tokens: computed(() => {
      const t2 = theme2Ref.value;
      return {
        bg: t2.colors.background.canvas,
        panelBg: t2.colors.background.primary,
        text: t2.colors.text.primary,
        primary: t2.colors.primary.main,
        border: t2.colors.border.medium
      };
    })
  };
}
if (typeof window !== "undefined") {
  try {
    watchSystemTheme(() => {
      if (state$1.preference === "system" && !readUrlTheme()) {
        rebuildTheme(resolveMode("system"), false);
      }
    });
  } catch {
  }
}
function hasPermission(action) {
  try {
    return Boolean(getBootData().user.permissions[action]);
  } catch {
    return false;
  }
}
function usePermissions() {
  return {
    can: hasPermission,
    canReadDashboards: () => hasPermission("dashboards:read"),
    canWriteDashboards: () => hasPermission("dashboards:write"),
    canReadDatasources: () => hasPermission("datasources:read"),
    canWriteDatasources: () => hasPermission("datasources:write")
  };
}
function isFeatureEnabled(name) {
  try {
    return Boolean(getBootData().settings.featureToggles[name]);
  } catch {
    return false;
  }
}
const config = {
  enabled: false
};
const ring = [];
const RING_MAX = 200;
function now() {
  return typeof performance !== "undefined" && performance.now ? performance.now() : Date.now();
}
function pushRing(type, name, detail) {
  ring.push({ t: now(), type, name, detail });
  if (ring.length > RING_MAX) ring.shift();
}
function readQueryFlag() {
  try {
    if (typeof location === "undefined") return false;
    return new URLSearchParams(location.search).get("perf") === "1";
  } catch {
    return false;
  }
}
function isPerfEnabled() {
  if (readQueryFlag()) return true;
  return config.enabled;
}
function markName(name, detail) {
  const gen = "";
  const panel2 = "";
  return `gv:${name}${gen}${panel2}`;
}
function perfMark(name, detail) {
  if (!isPerfEnabled()) return;
  const full = markName(name);
  try {
    if (typeof performance !== "undefined" && performance.mark) {
      performance.mark(full);
    }
  } catch {
  }
  pushRing("mark", full, detail);
}
function perfCount(name, delta = 1, detail) {
  if (!isPerfEnabled() || true) return;
}
class QueryPriorityQueue {
  items = [];
  seq = 0;
  get size() {
    return this.items.filter((i) => !i.cancelled).length;
  }
  enqueue(value, priority) {
    const item = {
      priority,
      seq: this.seq++,
      value,
      cancelled: false
    };
    this.items.push(item);
    this.items.sort((a, b) => b.priority - a.priority || a.seq - b.seq);
    return item;
  }
  /** Mark matching queued items cancelled (O(n)); start-time skip is O(1). */
  cancelWhere(pred) {
    let n = 0;
    for (const item of this.items) {
      if (!item.cancelled && pred(item.value)) {
        item.cancelled = true;
        n += 1;
      }
    }
    return n;
  }
  dequeue() {
    while (this.items.length) {
      const item = this.items.shift();
      if (!item.cancelled) return item.value;
    }
    return void 0;
  }
  clear() {
    this.items = [];
  }
}
function resolveRequestCacheTtlMs(request, defaultTtlMs) {
  const raw = request.queryCachingTTL;
  if (raw != null && Number.isFinite(Number(raw)) && Number(raw) > 0) {
    return Math.floor(Number(raw));
  }
  return defaultTtlMs > 0 ? defaultTtlMs : 0;
}
class QueryScheduler {
  concurrency;
  resolveDataSource;
  cacheTtlMs;
  maxCacheEntries;
  maxCacheBytes;
  cacheBytes = 0;
  active = /* @__PURE__ */ new Map();
  inflight = /* @__PURE__ */ new Map();
  queue = new QueryPriorityQueue();
  running = 0;
  cache = /* @__PURE__ */ new Map();
  stats = reactive({
    started: 0,
    completed: 0,
    cancelled: 0,
    errors: 0,
    cacheHits: 0,
    skippedHidden: 0
  });
  constructor(opts) {
    this.concurrency = opts.concurrency ?? 6;
    this.resolveDataSource = opts.resolveDataSource;
    this.cacheTtlMs = opts.cacheTtlMs ?? 0;
    this.maxCacheEntries = opts.maxCacheEntries ?? 200;
    this.maxCacheBytes = opts.maxCacheBytes ?? 32 * 1024 * 1024;
  }
  run(request) {
    if (request.visible === false) {
      this.stats.skippedHidden += 1;
      return Promise.resolve({
        state: LoadingStateEnum.Done,
        series: [],
        timeRange: request.range,
        request: { requestId: request.requestId }
      });
    }
    const requestTtl = resolveRequestCacheTtlMs(request, this.cacheTtlMs);
    const cacheKey = requestTtl > 0 ? this.buildCacheKey(request) : "";
    if (cacheKey) {
      const hit = this.cache.get(cacheKey);
      if (hit && hit.expiresAt > Date.now()) {
        hit.lastAccess = Date.now();
        this.stats.cacheHits += 1;
        perfCount();
        return Promise.resolve({
          ...hit.data,
          request: { requestId: request.requestId }
        });
      }
    }
    const dedupKey = cacheKey || this.buildCacheKey(request);
    const existing = this.inflight.get(dedupKey);
    if (existing) {
      perfCount();
      return existing.then((data) => ({
        ...data,
        request: { requestId: request.requestId }
      }));
    }
    this.cancel(request.requestId);
    const controller = new AbortController();
    const priority = typeof request.priority === "number" ? request.priority : 10;
    const promise = this.enqueue(
      () => this.execute(request, controller.signal, cacheKey || dedupKey),
      priority,
      () => ({
        state: LoadingStateEnum.NotStarted,
        series: [],
        timeRange: request.range,
        request: { requestId: request.requestId }
      })
    );
    this.inflight.set(dedupKey, promise);
    promise.finally(() => {
      if (this.inflight.get(dedupKey) === promise) this.inflight.delete(dedupKey);
    });
    this.active.set(request.requestId, {
      requestId: request.requestId,
      controller,
      promise,
      dedupKey
    });
    promise.finally(() => {
      const cur = this.active.get(request.requestId);
      if (cur?.promise === promise) this.active.delete(request.requestId);
    });
    return promise;
  }
  cancel(requestId) {
    const cur = this.active.get(requestId);
    if (cur) {
      cur.controller.abort();
      this.active.delete(requestId);
      if (cur.dedupKey && this.inflight.get(cur.dedupKey) === cur.promise) {
        this.inflight.delete(cur.dedupKey);
      }
      this.stats.cancelled += 1;
      perfCount();
    }
  }
  cancelAll() {
    for (const id of [...this.active.keys()]) this.cancel(id);
  }
  clearCache() {
    this.cache.clear();
    this.cacheBytes = 0;
  }
  /** Drop queued (not yet running) work — resolve as NotStarted and drain. */
  cancelQueued() {
    while (true) {
      const next = this.queue.dequeue();
      if (!next) break;
      next.cancel();
    }
    this.queue.clear();
  }
  buildCacheKey(request) {
    const targets = (request.targets ?? []).map((t2) => ({
      refId: t2.refId,
      hide: t2.hide,
      datasource: typeof t2.datasource === "string" ? t2.datasource : t2.datasource ? {
        uid: t2.datasource.uid,
        type: t2.datasource.type
      } : void 0,
      // stable JSON of non-secret query fields
      query: sanitizeQueryFields(t2)
    }));
    return JSON.stringify({
      backendMode: getBackendMode(),
      targets,
      from: request.range.from.getTime(),
      to: request.range.to.getTime(),
      maxDataPoints: request.maxDataPoints,
      intervalMs: request.intervalMs,
      queryCachingTTL: request.queryCachingTTL ?? null,
      cacheTimeout: request.cacheTimeout ?? null,
      scopedVars: request.scopedVars,
      panelId: request.panelId
    });
  }
  putCache(key, data, ttlMs2) {
    const ttl = ttlMs2 != null && ttlMs2 > 0 ? ttlMs2 : this.cacheTtlMs;
    if (!key || ttl <= 0) return;
    const estimatedBytes = estimatePanelDataBytes(data);
    const prev = this.cache.get(key);
    if (prev) this.cacheBytes -= prev.estimatedBytes;
    this.cache.set(key, {
      key,
      data,
      expiresAt: Date.now() + ttl,
      lastAccess: Date.now(),
      estimatedBytes
    });
    this.cacheBytes += estimatedBytes;
    this.evictCache();
  }
  evictCache() {
    while (this.cache.size > this.maxCacheEntries || this.cacheBytes > this.maxCacheBytes) {
      const oldest = [...this.cache.values()].sort((a, b) => a.lastAccess - b.lastAccess)[0];
      if (!oldest) break;
      this.cache.delete(oldest.key);
      this.cacheBytes = Math.max(0, this.cacheBytes - oldest.estimatedBytes);
    }
  }
  enqueue(fn, priority = 0, cancelledResult) {
    return new Promise((resolve, reject) => {
      let settled = false;
      const settleResolve = (v) => {
        if (settled) return;
        settled = true;
        resolve(v);
      };
      const settleReject = (e) => {
        if (settled) return;
        settled = true;
        reject(e);
      };
      const run = () => {
        this.running += 1;
        this.stats.started += 1;
        perfCount();
        fn().then(settleResolve, settleReject).finally(() => {
          this.running -= 1;
          const next = this.queue.dequeue();
          if (next) next.run();
        });
      };
      if (this.running < this.concurrency) run();
      else {
        perfCount();
        this.queue.enqueue(
          {
            run,
            cancel: () => {
              this.stats.cancelled += 1;
              settleResolve(
                cancelledResult ? cancelledResult() : {
                  state: LoadingStateEnum.NotStarted,
                  series: [],
                  timeRange: { from: /* @__PURE__ */ new Date(0), to: /* @__PURE__ */ new Date(0) }
                }
              );
            }
          },
          priority
        );
      }
    });
  }
  async execute(request, signal, cacheKey) {
    const visible = request.targets.filter((t2) => !t2.hide);
    if (!visible.length) {
      return {
        state: LoadingStateEnum.Done,
        series: [],
        timeRange: request.range,
        request: { requestId: request.requestId }
      };
    }
    try {
      const groups = /* @__PURE__ */ new Map();
      for (const t2 of visible) {
        const key = t2.datasource?.uid ?? t2.datasource?.type ?? "default";
        const list = groups.get(key) ?? [];
        list.push(t2);
        groups.set(key, list);
      }
      const series = [];
      const groupEntries = [...groups.entries()];
      const results = await Promise.all(
        groupEntries.map(async ([key, targets]) => {
          if (signal.aborted) throw new DOMException("Aborted", "AbortError");
          const ds2 = this.resolveDataSource(targets[0].datasource ?? key);
          if (!ds2) {
            return {
              error: `Data source not found: ${key}`,
              frames: []
            };
          }
          const res = await ds2.query({ ...request, targets }, signal);
          return {
            error: null,
            frames: res.data.map((f) => ({
              ...f,
              refId: f.refId ?? targets[0].refId
            }))
          };
        })
      );
      for (const r of results) {
        if (r.error) {
          this.stats.errors += 1;
          return {
            state: LoadingStateEnum.Error,
            series: [],
            timeRange: request.range,
            error: { message: r.error },
            request: { requestId: request.requestId }
          };
        }
        series.push(...r.frames);
      }
      this.stats.completed += 1;
      const data = {
        state: LoadingStateEnum.Done,
        series,
        timeRange: request.range,
        request: { requestId: request.requestId }
      };
      this.putCache(cacheKey, data, resolveRequestCacheTtlMs(request, this.cacheTtlMs));
      return data;
    } catch (error) {
      if (error.name === "AbortError") {
        return {
          state: LoadingStateEnum.NotStarted,
          series: [],
          timeRange: request.range,
          request: { requestId: request.requestId }
        };
      }
      this.stats.errors += 1;
      return {
        state: LoadingStateEnum.Error,
        series: [],
        timeRange: request.range,
        error: {
          message: error instanceof Error ? error.message : String(error)
        },
        request: { requestId: request.requestId }
      };
    }
  }
}
const SECRET_KEY = /password|token|secret|authorization|credential|api[_-]?key/i;
function sanitizeQueryFields(target) {
  const out = {};
  for (const [k, v] of Object.entries(target)) {
    if (k === "datasource") continue;
    if (SECRET_KEY.test(k)) continue;
    if (v == null || typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
      out[k] = v;
    } else if (Array.isArray(v) || typeof v === "object" && v) {
      try {
        out[k] = JSON.parse(JSON.stringify(v));
      } catch {
      }
    }
  }
  return out;
}
function estimatePanelDataBytes(data) {
  let n = 256;
  for (const frame of data.series ?? []) {
    n += 64;
    for (const field of frame.fields ?? []) {
      const values = field.values;
      if (Array.isArray(values)) n += values.length * 16;
      else n += 64;
    }
  }
  return n;
}
const catalogs = {
  "en-US": {
    "dashboard.save": "Save",
    "dashboard.edit": "Edit",
    "dashboard.view": "View",
    "dashboard.share": "Share",
    "dashboard.refresh": "Refresh",
    "dashboard.addPanel": "Add panel",
    "dashboard.import": "Import JSON",
    "dashboard.undo": "Undo",
    "dashboard.redo": "Redo",
    "dashboard.inspect": "Inspect",
    "dashboard.copy": "Copy",
    "dashboard.duplicate": "Duplicate panel",
    "dashboard.paste": "Paste",
    "dashboard.library": "Panel library",
    "dashboard.saveLibrary": "Save to library",
    "dashboard.screenshot": "Screenshot",
    "dashboard.loading": "Loading…",
    "dashboard.list": "Dashboards",
    "dashboard.new": "New",
    "dashboard.time.custom": "Custom range",
    "dashboard.time.last5m": "Last 5 minutes",
    "dashboard.time.last15m": "Last 15 minutes",
    "dashboard.time.last1h": "Last 1 hour",
    "dashboard.time.last6h": "Last 6 hours",
    "dashboard.time.last24h": "Last 24 hours",
    "dashboard.time.last7d": "Last 7 days",
    "datasources.title": "Data sources",
    "datasources.add": "Add data source",
    "datasources.search": "Search data sources…",
    "datasources.allTypes": "All types",
    "datasources.default": "default",
    "datasources.empty": "No data sources match",
    "common.cancel": "Cancel",
    "common.apply": "Apply",
    "common.close": "Close",
    "common.search": "Search",
    "common.delete": "Delete",
    "common.settings": "Settings",
    "panel.options": "Panel options",
    "panel.field": "Field",
    "panel.query": "Query",
    "panel.transform": "Transform",
    "panel.alert": "Alert",
    "editor.thresholds": "Thresholds",
    "editor.unit": "Unit",
    "editor.mappings": "Value mappings",
    "editor.color": "Color",
    "time.timezone": "Time zone",
    "time.browser": "Browser time",
    "panel.noData": "No data",
    "dashboard.empty": "Empty dashboard",
    "dashboard.variables": "Variables"
  },
  "zh-Hans": {
    "dashboard.save": "保存",
    "dashboard.edit": "编辑",
    "dashboard.view": "查看",
    "dashboard.share": "分享",
    "dashboard.refresh": "刷新",
    "dashboard.addPanel": "添加面板",
    "dashboard.import": "导入 JSON",
    "dashboard.undo": "撤销",
    "dashboard.redo": "重做",
    "dashboard.inspect": "检查",
    "dashboard.copy": "复制",
    "dashboard.duplicate": "复制面板",
    "dashboard.paste": "粘贴",
    "dashboard.library": "面板库",
    "dashboard.saveLibrary": "存入库",
    "dashboard.screenshot": "截图",
    "dashboard.loading": "加载中…",
    "dashboard.list": "仪表盘",
    "dashboard.new": "新建",
    "dashboard.time.custom": "自定义范围",
    "dashboard.time.last5m": "最近 5 分钟",
    "dashboard.time.last15m": "最近 15 分钟",
    "dashboard.time.last1h": "最近 1 小时",
    "dashboard.time.last6h": "最近 6 小时",
    "dashboard.time.last24h": "最近 24 小时",
    "dashboard.time.last7d": "最近 7 天",
    "datasources.title": "数据源",
    "datasources.add": "添加数据源",
    "datasources.search": "搜索数据源…",
    "datasources.allTypes": "全部类型",
    "datasources.default": "默认",
    "datasources.empty": "无匹配的数据源",
    "common.cancel": "取消",
    "common.apply": "应用",
    "common.close": "关闭",
    "common.search": "搜索",
    "common.delete": "删除",
    "common.settings": "设置",
    "panel.options": "面板选项",
    "panel.field": "字段",
    "panel.query": "查询",
    "panel.transform": "转换",
    "panel.alert": "告警",
    "editor.thresholds": "阈值",
    "editor.unit": "单位",
    "editor.mappings": "值映射",
    "editor.color": "颜色",
    "time.timezone": "时区",
    "time.browser": "浏览器时区",
    "panel.noData": "暂无数据",
    "dashboard.empty": "空仪表盘",
    "dashboard.variables": "变量"
  }
};
const state = reactive({ locale: "zh-Hans", rtl: false, epoch: 0 });
function normalizeLocale(locale2) {
  const normalized = locale2.trim().toLowerCase();
  if (normalized === "en" || normalized.startsWith("en-")) return "en-US";
  if (normalized === "zh" || normalized.startsWith("zh-")) return "zh-Hans";
  return locale2;
}
function setLocale(locale2) {
  const candidate = normalizeLocale(locale2);
  state.locale = catalogs[candidate] ? candidate : "zh-Hans";
  if (typeof document !== "undefined") {
    document.documentElement.lang = state.locale;
  }
}
function setRTL(rtl) {
  state.rtl = rtl;
  if (typeof document !== "undefined") {
    const direction = rtl ? "rtl" : "ltr";
    document.documentElement.setAttribute("dir", direction);
    document.documentElement.dataset.direction = direction;
  }
}
function t(key, fallback) {
  void state.epoch;
  return catalogs[state.locale]?.[key] ?? catalogs["zh-Hans"][key] ?? catalogs["en-US"][key] ?? fallback ?? key;
}
function useI18n() {
  return {
    locale: readonly(computed(() => state.locale)),
    rtl: readonly(computed(() => state.rtl)),
    t,
    setLocale,
    setRTL
  };
}
function registerI18nCatalog(locale2, entries) {
  catalogs[locale2] = { ...catalogs[locale2] ?? {}, ...entries };
  state.epoch++;
}
class RuntimeDataSourceSettingsError extends Error {
  constructor(message2, code) {
    super(message2);
    this.code = code;
    this.name = "RuntimeDataSourceSettingsError";
  }
  code;
}
const registry$1 = /* @__PURE__ */ new Map();
function assertNoSecrets(settings) {
  const blob = JSON.stringify(settings);
  if (/(?:"password"|"token"|"secureJsonData"|"apiKey")\s*:\s*"[^"]+"/i.test(blob)) {
    throw new RuntimeDataSourceSettingsError(
      "settings must not contain secret values",
      "SETTINGS_CONTAIN_SECRETS"
    );
  }
  const jd = settings.jsonData || {};
  for (const k of Object.keys(jd)) {
    if (/token|password|secret|apiKey|authorization/i.test(k) && jd[k]) {
      throw new RuntimeDataSourceSettingsError(
        `jsonData must not contain secret field ${k}`,
        "SETTINGS_CONTAIN_SECRETS"
      );
    }
  }
}
function assertSingleDefault(list) {
  const defaults2 = list.filter((s) => s.isDefault);
  if (defaults2.length > 1) {
    throw new RuntimeDataSourceSettingsError(
      `multiple default datasources: ${defaults2.map((d) => d.uid).join(",")}`,
      "DATASOURCE_DEFAULT_CONFLICT"
    );
  }
}
function clearRuntimeDataSourceSettings() {
  registry$1.clear();
}
function configureRuntimeDataSourceSettings(settings) {
  clearRuntimeDataSourceSettings();
  const seen = /* @__PURE__ */ new Set();
  const next = [];
  for (const raw of settings) {
    if (!raw?.uid) {
      throw new RuntimeDataSourceSettingsError("datasource uid is required", "MISSING_UID");
    }
    if (seen.has(raw.uid)) {
      throw new RuntimeDataSourceSettingsError(`duplicate uid: ${raw.uid}`, "DUPLICATE_UID");
    }
    seen.add(raw.uid);
    const entry = {
      ...raw,
      source: raw.source ?? "runtime",
      jsonData: { ...raw.jsonData || {} }
    };
    assertNoSecrets(entry);
    next.push(entry);
  }
  assertSingleDefault(next);
  for (const e of next) registry$1.set(e.uid, e);
}
function listRuntimeDataSourceSettings() {
  return [...registry$1.values()].map((s) => ({
    ...s,
    jsonData: { ...s.jsonData || {} }
  }));
}
function getRuntimeDataSourceSettings(uid) {
  const s = registry$1.get(uid);
  return s ? { ...s, jsonData: { ...s.jsonData || {} } } : void 0;
}
function mergeDataSourceSettings(parts) {
  const byUid2 = /* @__PURE__ */ new Map();
  const backendDefaultUids = /* @__PURE__ */ new Set();
  const runtimeDefaultUids = /* @__PURE__ */ new Set();
  for (const s of parts.seeds || []) {
    if (!s?.uid) continue;
    byUid2.set(s.uid, {
      ...s,
      source: "seed",
      isDefault: false,
      jsonData: { ...s.jsonData || {} }
    });
  }
  for (const s of parts.backend || []) {
    if (!s?.uid) continue;
    const prev = byUid2.get(s.uid);
    byUid2.set(s.uid, {
      ...prev || {},
      ...s,
      source: "backend",
      // explicit false/true from backend wins; undefined keeps previous only if prev was backend/runtime
      isDefault: s.isDefault === true ? true : s.isDefault === false ? false : !!prev?.isDefault && prev.source !== "seed",
      jsonData: { ...prev?.jsonData || {}, ...s.jsonData || {} }
    });
    if (s.isDefault === true) backendDefaultUids.add(s.uid);
  }
  for (const s of parts.runtime || []) {
    if (!s?.uid) continue;
    const prev = byUid2.get(s.uid);
    const merged = {
      ...prev || {},
      ...s,
      source: "runtime",
      jsonData: { ...prev?.jsonData || {}, ...s.jsonData || {} }
    };
    if (prev?.source === "backend") {
      if (s.url == null && prev.url != null) merged.url = prev.url;
      if (!s.type && prev.type) merged.type = prev.type;
    }
    byUid2.set(s.uid, merged);
    if (s.isDefault === true) runtimeDefaultUids.add(s.uid);
  }
  for (const [uid, s] of byUid2) {
    if (s.source === "seed") {
      byUid2.set(uid, { ...s, isDefault: false });
      continue;
    }
    if ((s.type === "grafana-testdata-datasource" || s.type === "mixed" || uid === "testdata" || uid === "mixed") && s.source !== "backend" && backendDefaultUids.size > 0 && !backendDefaultUids.has(uid)) {
      byUid2.set(uid, { ...s, isDefault: false });
    }
  }
  if (backendDefaultUids.size > 1) {
    throw new RuntimeDataSourceSettingsError(
      `multiple default datasources from backend: ${[...backendDefaultUids].join(",")}`,
      "DATASOURCE_DEFAULT_CONFLICT"
    );
  }
  let chosenDefault;
  if (backendDefaultUids.size === 1) {
    chosenDefault = [...backendDefaultUids][0];
  } else if (runtimeDefaultUids.size === 1) {
    chosenDefault = [...runtimeDefaultUids][0];
  } else if (runtimeDefaultUids.size > 1) {
    throw new RuntimeDataSourceSettingsError(
      `multiple default datasources: ${[...runtimeDefaultUids].join(",")}`,
      "DATASOURCE_DEFAULT_CONFLICT"
    );
  }
  for (const [uid, s] of byUid2) {
    const want = chosenDefault != null && uid === chosenDefault;
    if (!!s.isDefault !== want) {
      byUid2.set(uid, { ...s, isDefault: want });
    }
  }
  return [...byUid2.values()];
}
function getEffectiveDefaultDataSource(list) {
  const items = list ?? listRuntimeDataSourceSettings();
  return items.find((s) => s.isDefault);
}
const VISIBLE_UIDS = /* @__PURE__ */ new Set(["zabbix-3", "zabbix-14", "signoz"]);
async function listDataSources() {
  const runtime = listRuntimeDataSourceSettings();
  const fromRuntime = runtime.filter((s) => VISIBLE_UIDS.has(s.uid)).map((s) => ({
    uid: s.uid,
    name: s.name,
    type: s.type,
    isDefault: s.isDefault ?? false,
    url: s.url,
    access: s.access,
    jsonData: s.jsonData
  }));
  if (fromRuntime.length > 0) return fromRuntime;
  try {
    const res = await backendSrv.get("/api/datasources");
    const all = res.data ?? [];
    return all.filter((d) => VISIBLE_UIDS.has(d.uid));
  } catch {
    return [];
  }
}
async function getDataSourceByUid(uid) {
  try {
    const res = await backendSrv.get(
      `/api/datasources/uid/${encodeURIComponent(uid)}`
    );
    return res.data ?? null;
  } catch {
    return null;
  }
}
async function saveDataSource(ds2) {
  const uid = String(ds2.uid || "");
  if (uid) {
    try {
      const res2 = await backendSrv.put(
        `/api/datasources/uid/${encodeURIComponent(uid)}`,
        ds2
      );
      return res2.data ?? ds2;
    } catch {
    }
  }
  const res = await backendSrv.post("/api/datasources", ds2);
  return res.data ?? ds2;
}
const SECRET_RE = /(authorization|token|password|secret|apikey|api[_-]?key|bearer|auth)\s*[:=]\s*['"]?[^'"\s,}]+/gi;
const JSON_SECRET_RE = /"(authorization|token|password|secret|apikey|api[_-]?key|auth)"\s*:\s*"[^"]*"/gi;
const SECRET_KEY_RE = /^(authorization|token|password|secret|apikey|api[_-]?key|bearer|auth)$/i;
function sanitizeErrorText(text) {
  return String(text ?? "").replaceAll(JSON_SECRET_RE, '"$1":"[REDACTED]"').replaceAll(SECRET_RE, "$1=[REDACTED]");
}
function redactEndpoint(endpoint) {
  if (!endpoint) return void 0;
  try {
    const u = new URL(endpoint);
    u.username = "";
    u.password = "";
    const parts = [];
    for (const [key, value] of u.searchParams.entries()) {
      if (/(token|auth|password|secret|key|bearer)/i.test(key)) {
        parts.push(`${encodeURIComponent(key)}=[REDACTED]`);
      } else {
        parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
      }
    }
    const base = `${u.origin}${u.pathname}`.replace(/\/\/:+@/, "//").replace(/\/\/@/, "//");
    return parts.length ? `${base}?${parts.join("&")}${u.hash || ""}` : `${base}${u.hash || ""}`;
  } catch {
    return sanitizeErrorText(endpoint);
  }
}
function sanitizeUnknown(value) {
  if (typeof value === "string") return sanitizeErrorText(value);
  if (Array.isArray(value)) return value.map(sanitizeUnknown);
  if (value && typeof value === "object") {
    const out = {};
    for (const [k, v] of Object.entries(value)) {
      out[k] = SECRET_KEY_RE.test(k) ? "[REDACTED]" : sanitizeUnknown(v);
    }
    return out;
  }
  return value;
}
const ALLOWED_DETAIL_KEYS = /* @__PURE__ */ new Set([
  "uid",
  "refId",
  "endpoint",
  "status",
  "upstreamCode",
  "retryAfterMs",
  "url",
  "signal"
]);
function pickDetails(details) {
  if (!details) return void 0;
  const cleaned = sanitizeUnknown(details);
  const out = {};
  for (const key of Object.keys(cleaned)) {
    if (!ALLOWED_DETAIL_KEYS.has(key)) continue;
    out[key] = cleaned[key];
  }
  if (out.endpoint) out.endpoint = redactEndpoint(String(out.endpoint));
  if (out.url) out.url = redactEndpoint(String(out.url));
  return out;
}
class DataSourceError extends Error {
  code;
  details;
  constructor(code, message2, details) {
    super(sanitizeErrorText(message2));
    this.name = "DataSourceError";
    this.code = code;
    this.details = pickDetails(details);
  }
  static fromHttpStatus(status, _statusText, url) {
    if (status === 401) {
      return new DataSourceError("AUTH_REQUIRED", `数据源认证失败（${status}）`, { status, url });
    }
    if (status === 403) {
      return new DataSourceError("FORBIDDEN", `数据源拒绝访问（${status}）`, {
        status,
        url
      });
    }
    if (status === 404) {
      return new DataSourceError("NOT_FOUND", `数据源资源不存在（${status}）`, {
        status,
        url
      });
    }
    if (status === 429) {
      return new DataSourceError("RATE_LIMITED", `数据源请求过于频繁（${status}）`, {
        status,
        url
      });
    }
    if (status >= 500) {
      return new DataSourceError("UPSTREAM_ERROR", `数据源服务异常（${status}）`, { status, url });
    }
    return new DataSourceError("INVALID_RESPONSE", `数据源返回无效 HTTP 状态（${status}）`, {
      status,
      url
    });
  }
  static fromNetwork(err, url) {
    if (err instanceof DataSourceError) return err;
    const msg = err instanceof Error ? err.message : String(err);
    const name = err instanceof Error ? err.name : "";
    if (name === "AbortError" || typeof DOMException !== "undefined" && err instanceof DOMException && err.name === "AbortError") {
      return new DataSourceError("CANCELLED", "数据源请求已取消", { url });
    }
    if (/^abort/i.test(msg) && !/timeout/i.test(msg)) {
      return new DataSourceError("CANCELLED", "数据源请求已取消", { url });
    }
    if (/timeout/i.test(msg)) {
      return new DataSourceError("TIMEOUT", "数据源请求超时", { url });
    }
    if (err instanceof TypeError || /failed to fetch|networkerror|cors/i.test(msg)) {
      return new DataSourceError(
        "CORS_BLOCKED",
        "Network/CORS failure — target must allow browser origin",
        {
          url
        }
      );
    }
    return new DataSourceError("NETWORK_ERROR", msg || "Network error", {
      url
    });
  }
}
function isDataSourceError(e) {
  return e instanceof DataSourceError;
}
function withDataSourceContext(error, ctx) {
  const base = error instanceof DataSourceError ? error : new DataSourceError(
    "UNKNOWN",
    error instanceof Error ? error.message : String(error ?? "未知错误")
  );
  return new DataSourceError(base.code, base.message, {
    ...base.details,
    uid: ctx.uid ?? base.details?.uid,
    refId: ctx.refId ?? base.details?.refId,
    endpoint: ctx.endpoint ?? base.details?.endpoint,
    status: ctx.status ?? base.details?.status,
    upstreamCode: ctx.upstreamCode ?? base.details?.upstreamCode,
    retryAfterMs: ctx.retryAfterMs ?? base.details?.retryAfterMs
  });
}
let provider = null;
const memory = /* @__PURE__ */ new Map();
function configureRuntimeCredentials(p) {
  provider = p;
}
function setRuntimeCredential(uid, cred) {
  if (!cred) memory.delete(uid);
  else memory.set(uid, cred);
}
async function getRuntimeCredential(uid) {
  if (memory.has(uid)) return memory.get(uid) ?? null;
  if (!provider) return null;
  const c = await provider(uid);
  return c ?? null;
}
function clearRuntimeCredentials() {
  memory.clear();
  provider = null;
}
function applyCredentialHeaders(headers, cred) {
  if (!cred) return headers;
  const out = { ...headers };
  if ((cred.kind === "bearer" || cred.kind === "session") && cred.value) {
    out.Authorization = `Bearer ${cred.value}`;
  } else if (cred.kind === "basic" && (cred.username != null || cred.password != null)) {
    const raw = `${cred.username ?? ""}:${cred.password ?? ""}`;
    out.Authorization = `Basic ${typeof btoa === "function" ? btoa(raw) : Buffer.from(raw).toString("base64")}`;
  } else if (cred.kind === "apiKey" && cred.value) {
    out[cred.headerName || "X-API-Key"] = cred.value;
  } else if (cred.kind === "headers" && cred.headers) {
    Object.assign(out, cred.headers);
  }
  return out;
}
const HTTP_LOG_MAX = 40;
const httpLog = [];
function redactUrl(url) {
  try {
    const u = new URL(url);
    for (const key of [...u.searchParams.keys()]) {
      if (/(token|auth|password|secret|key|bearer)/i.test(key))
        u.searchParams.set(key, "[REDACTED]");
    }
    return u.toString();
  } catch {
    return url.replaceAll(
      /(authorization|token|password|secret|apikey|bearer)=([^&\s]+)/gi,
      "$1=[REDACTED]"
    );
  }
}
function previewBody(body, max = 4e3) {
  if (!body) return void 0;
  let text = sanitizeErrorText(body);
  text = text.replaceAll(/"auth"\s*:\s*"[^"]*"/gi, '"auth":"[REDACTED]"');
  text = text.replaceAll(/"token"\s*:\s*"[^"]*"/gi, '"token":"[REDACTED]"');
  text = text.replaceAll(/"password"\s*:\s*"[^"]*"/gi, '"password":"[REDACTED]"');
  if (text.length > max) text = `${text.slice(0, max)}…`;
  return text;
}
function pushHttpLog(entry) {
  httpLog.push(entry);
  while (httpLog.length > HTTP_LOG_MAX) httpLog.shift();
}
function getDatasourceHttpLog(uid) {
  if (!uid) return [...httpLog];
  return httpLog.filter((e) => e.uid === uid);
}
function clearDatasourceHttpLog() {
  httpLog.length = 0;
}
function joinUrl(baseUrl2, path = "") {
  let base = baseUrl2;
  if (base.startsWith("/") && typeof globalThis !== "undefined" && globalThis.location?.origin) {
    base = `${globalThis.location.origin}${base}`;
  } else if (base.startsWith("/") && !base.startsWith("//")) {
    base = `http://local${base}`;
  }
  if (!base.endsWith("/")) base = `${base}/`;
  const p = path.startsWith("/") ? path.slice(1) : path;
  return new URL(p, base);
}
function mergeSignals$1(a, b) {
  if (!a) return b;
  if (!b) return a;
  if (typeof AbortSignal !== "undefined" && "any" in AbortSignal && typeof AbortSignal.any === "function") {
    return AbortSignal.any([a, b]);
  }
  const c = new AbortController();
  const onAbort = () => c.abort();
  if (a.aborted || b.aborted) c.abort();
  else {
    a.addEventListener("abort", onAbort);
    b.addEventListener("abort", onAbort);
  }
  return c.signal;
}
async function sleep(ms, signal) {
  if (ms <= 0) return;
  await new Promise((resolve, reject) => {
    const t2 = setTimeout(() => resolve(), ms);
    if (signal) {
      const onAbort = () => {
        clearTimeout(t2);
        reject(signal.reason || new DOMException("Aborted", "AbortError"));
      };
      if (signal.aborted) return onAbort();
      signal.addEventListener("abort", onAbort, { once: true });
    }
  });
}
function shouldRetry(status, req, attempt, maxRetries) {
  if (req.isWrite) return false;
  if (req.idempotent === false) return false;
  if (attempt >= maxRetries) return false;
  if (status === 401 || status === 403) return false;
  return status === 429 || status === 502 || status === 503 || status === 504;
}
async function datasourceHttp(req) {
  if (getBackendMode() === "offline" && !req.forceNetwork) {
    throw new DataSourceError("OFFLINE", "Datasource HTTP disabled in offline mode");
  }
  if (!req.baseUrl) {
    throw new DataSourceError("INVALID_RESPONSE", "Datasource URL is empty");
  }
  const url = joinUrl(req.baseUrl, req.path || "");
  if (req.query) {
    for (const [k, v] of Object.entries(req.query)) {
      if (v == null || v === "") continue;
      if (Array.isArray(v)) {
        for (const item of v) {
          if (item == null || item === "") continue;
          url.searchParams.append(k, String(item));
        }
      } else {
        url.searchParams.set(k, String(v));
      }
    }
  }
  let timeoutCtrl;
  let timer;
  let timedOut = false;
  if (req.timeoutMs && req.timeoutMs > 0) {
    timeoutCtrl = new AbortController();
    timer = setTimeout(() => {
      timedOut = true;
      timeoutCtrl.abort();
    }, req.timeoutMs);
  }
  const signal = mergeSignals$1(req.signal, timeoutCtrl?.signal);
  let cred = req.credential;
  if (cred === void 0 && req.uid) {
    cred = await getRuntimeCredential(req.uid);
  }
  const headers = applyCredentialHeaders(
    { Accept: "application/json", ...req.headers || {} },
    cred
  );
  const method = req.method || (req.body != null ? "POST" : "GET");
  let body;
  if (req.body != null && method !== "GET") {
    headers["Content-Type"] = headers["Content-Type"] || "application/json";
    body = JSON.stringify(req.body);
  }
  let finalMethod = method;
  let finalUrl = url;
  let finalBody = body;
  if (method === "GET" && url.toString().length > 2e3 && req.query) {
    finalMethod = "POST";
    finalUrl = joinUrl(req.baseUrl, req.path || "");
    headers["Content-Type"] = "application/x-www-form-urlencoded";
    const form = new URLSearchParams();
    for (const [k, v] of Object.entries(req.query)) {
      if (v == null || v === "") continue;
      if (Array.isArray(v)) {
        for (const item of v) {
          if (item == null || item === "") continue;
          form.append(k, String(item));
        }
      } else {
        form.append(k, String(v));
      }
    }
    finalBody = form.toString();
  }
  const started = Date.now();
  const logBase = {
    ts: started,
    uid: req.uid,
    method: finalMethod,
    url: redactUrl(finalUrl.toString()),
    bodyPreview: previewBody(finalBody)
  };
  const maxRetries = req.isWrite ? 0 : req.maxRetries ?? 1;
  let attempt = 0;
  try {
    while (true) {
      const client = getDatasourceHttpClient();
      const axiosRes = await client.request({
        url: finalUrl.toString(),
        method: finalMethod,
        headers,
        data: finalBody,
        signal,
        // omit cookies by default unless caller opts in
        withCredentials: req.credentials === "include" || req.credentials === "same-origin",
        responseType: "text",
        // timeout handled by outer timer + AbortSignal
        timeout: 0
      });
      const resHeaders = new NormalizedHeaders(axiosRes.headers);
      const headersOut = new Headers();
      resHeaders.forEach((v, k) => headersOut.set(k, v));
      const res = {
        ok: axiosRes.status >= 200 && axiosRes.status < 300,
        status: axiosRes.status,
        statusText: axiosRes.statusText || "",
        headers: headersOut,
        text: async () => typeof axiosRes.data === "string" ? axiosRes.data : axiosRes.data == null ? "" : String(axiosRes.data)
      };
      if (!res.ok) {
        if (shouldRetry(res.status, req, attempt, maxRetries)) {
          attempt += 1;
          let waitMs = res.status === 429 ? 1e3 : 250 * attempt;
          if (res.status === 429) {
            const ra = res.headers.get("Retry-After");
            if (ra) waitMs = Number(ra) < 100 ? Number(ra) * 1e3 : Number(ra);
          }
          await sleep(waitMs, signal);
          continue;
        }
        if (timer) clearTimeout(timer);
        pushHttpLog({
          ...logBase,
          status: res.status,
          durationMs: Date.now() - started,
          error: `HTTP ${res.status}`
        });
        if (res.status === 429) {
          const ra = res.headers.get("Retry-After");
          const retryAfterMs = ra ? Number(ra) < 100 ? Number(ra) * 1e3 : Number(ra) : void 0;
          throw new DataSourceError("RATE_LIMITED", `Rate limited (${res.status})`, {
            status: res.status,
            url: finalUrl.toString(),
            retryAfterMs
          });
        }
        throw DataSourceError.fromHttpStatus(res.status, res.statusText, finalUrl.toString());
      }
      if (timer) clearTimeout(timer);
      if (res.status === 204) {
        pushHttpLog({
          ...logBase,
          status: 204,
          durationMs: Date.now() - started
        });
        return {
          data: null,
          status: 204,
          headers: res.headers,
          url: finalUrl.toString()
        };
      }
      const text = await res.text();
      const max = req.maxBodyBytes ?? 10485760;
      if (text.length > max) {
        pushHttpLog({
          ...logBase,
          status: res.status,
          durationMs: Date.now() - started,
          error: "response too large"
        });
        throw new DataSourceError(
          "INVALID_RESPONSE",
          `Response exceeds size limit (${max} bytes)`,
          {
            url: finalUrl.toString()
          }
        );
      }
      if (!text) {
        pushHttpLog({
          ...logBase,
          status: res.status,
          durationMs: Date.now() - started
        });
        return {
          data: null,
          status: res.status,
          headers: res.headers,
          url: finalUrl.toString()
        };
      }
      try {
        const data = JSON.parse(text);
        pushHttpLog({
          ...logBase,
          status: res.status,
          durationMs: Date.now() - started
        });
        return {
          data,
          status: res.status,
          headers: res.headers,
          url: finalUrl.toString()
        };
      } catch {
        pushHttpLog({
          ...logBase,
          status: res.status,
          durationMs: Date.now() - started,
          error: "invalid JSON"
        });
        throw new DataSourceError("INVALID_RESPONSE", "Response is not valid JSON", {
          status: res.status,
          url: finalUrl.toString()
        });
      }
    }
  } catch (error) {
    if (timer) clearTimeout(timer);
    if (timedOut) {
      const timeoutError = new DataSourceError(
        "TIMEOUT",
        `数据源请求在 ${req.timeoutMs}ms 后超时`,
        {
          url: finalUrl.toString()
        }
      );
      pushHttpLog({
        ...logBase,
        durationMs: Date.now() - started,
        error: timeoutError.message
      });
      throw timeoutError;
    }
    if (error instanceof DataSourceError) {
      if (!httpLog.some((x) => x.ts === started && x.uid === req.uid)) {
        pushHttpLog({
          ...logBase,
          durationMs: Date.now() - started,
          error: error.message
        });
      }
      throw error;
    }
    pushHttpLog({
      ...logBase,
      durationMs: Date.now() - started,
      error: error instanceof Error ? error.message : String(error)
    });
    throw DataSourceError.fromNetwork(error, finalUrl.toString());
  }
}
const DEFAULT_TTL_MS = 5 * 6e4;
const DEFAULT_MAX_BYTES = 32 * 1024 * 1024;
const store$2 = /* @__PURE__ */ new Map();
let totalBytes$1 = 0;
let maxBytes = DEFAULT_MAX_BYTES;
let ttlMs = DEFAULT_TTL_MS;
const SENSITIVE_HEADER = /(authorization|cookie|token|password|secret|api[-_]?key|signoz-api-key)/i;
function configureQueryInspectorStore(opts) {
  if (opts?.maxBytes != null) maxBytes = opts.maxBytes;
  if (opts?.ttlMs != null) ttlMs = opts.ttlMs;
}
function clearQueryInspectorStore() {
  store$2.clear();
  totalBytes$1 = 0;
}
function redactHeaders(h2) {
  if (!h2) return {};
  const out = {};
  for (const [k, v] of Object.entries(h2)) {
    out[k] = SENSITIVE_HEADER.test(k) ? "[REDACTED]" : v;
  }
  return out;
}
function redactBody(body) {
  if (body == null) return body;
  const text = typeof body === "string" ? body : JSON.stringify(body);
  const redacted = text.replaceAll(/"auth"\s*:\s*"[^"]*"/gi, '"auth":"[REDACTED]"').replaceAll(/"token"\s*:\s*"[^"]*"/gi, '"token":"[REDACTED]"').replaceAll(/"password"\s*:\s*"[^"]*"/gi, '"password":"[REDACTED]"').replaceAll(/Bearer\s+[\w\-.~+/]+=*/g, "Bearer [REDACTED]");
  try {
    return JSON.parse(redacted);
  } catch {
    return redacted;
  }
}
function estimateBytes$1(value) {
  try {
    return new TextEncoder().encode(JSON.stringify(value)).length;
  } catch {
    return 0;
  }
}
function purgeExpired(now2 = Date.now()) {
  for (const [k, e] of store$2) {
    if (e.expiresAt <= now2) {
      totalBytes$1 -= e.bytes;
      store$2.delete(k);
    }
  }
}
function evictLru() {
  while (totalBytes$1 > maxBytes && store$2.size) {
    const oldest = store$2.keys().next().value;
    if (!oldest) break;
    const e = store$2.get(oldest);
    totalBytes$1 -= e.bytes;
    store$2.delete(oldest);
  }
}
function makeInspectorKey(requestId, datasourceUid) {
  return `${requestId}::${datasourceUid}`;
}
function putQueryInspectorEntry(input) {
  purgeExpired();
  const key = makeInspectorKey(input.requestId, input.datasourceUid);
  const request = {
    method: input.request?.method,
    url: input.request?.url,
    headers: redactHeaders(input.request?.headers),
    body: redactBody(input.request?.body)
  };
  const entry = {
    key,
    requestId: input.requestId,
    datasourceUid: input.datasourceUid,
    savedAt: Date.now(),
    expiresAt: Date.now() + (input.ttlMs ?? ttlMs),
    bytes: 0,
    request,
    response: input.response,
    stats: input.stats,
    warnings: input.warnings,
    capability: input.capability
  };
  entry.bytes = estimateBytes$1(entry);
  const prev = store$2.get(key);
  if (prev) totalBytes$1 -= prev.bytes;
  store$2.delete(key);
  store$2.set(key, entry);
  totalBytes$1 += entry.bytes;
  evictLru();
  return entry;
}
function getQueryInspectorEntry(requestId, datasourceUid) {
  purgeExpired();
  return store$2.get(makeInspectorKey(requestId, datasourceUid));
}
function listQueryInspectorEntries(datasourceUid) {
  purgeExpired();
  const all = [...store$2.values()];
  return datasourceUid ? all.filter((e) => e.datasourceUid === datasourceUid) : all;
}
function getQueryInspectorStats() {
  purgeExpired();
  return { entries: store$2.size, totalBytes: totalBytes$1, maxBytes, ttlMs };
}
const TYPE_ALIASES = {
  "testdata": "grafana-testdata-datasource",
  "testdatasource": "grafana-testdata-datasource",
  "test-data": "grafana-testdata-datasource",
  "grafana-testdata-datasource": "grafana-testdata-datasource",
  "mixed": "mixed",
  "-- mixed --": "mixed",
  "prometheus": "prometheus",
  "prom": "prometheus",
  "loki": "loki",
  "zabbix": "alexanderzobnin-zabbix-datasource",
  "alexanderzobnin-zabbix-datasource": "alexanderzobnin-zabbix-datasource",
  "signoz": "signoz"
};
function normalizeDataSourceType(type) {
  const raw = String(type ?? "").trim();
  if (!raw) return "";
  if (TYPE_ALIASES[raw]) return TYPE_ALIASES[raw];
  const lower = raw.toLowerCase();
  if (TYPE_ALIASES[lower]) return TYPE_ALIASES[lower];
  if (lower.includes("testdata") || lower.includes("test-data"))
    return "grafana-testdata-datasource";
  if (lower.includes("zabbix")) return "alexanderzobnin-zabbix-datasource";
  return raw;
}
function normalizeUid(uid) {
  if (uid == null || uid === "") return void 0;
  if (typeof uid === "string") {
    if (uid === "[object Object]") return void 0;
    return uid;
  }
  if (typeof uid === "object") {
    const o = uid;
    if (typeof o.uid === "string" && o.uid && o.uid !== "[object Object]") return o.uid;
  }
  return void 0;
}
function loadedIdentity(instances) {
  return [...instances.values()].map((d) => d.uid).sort().join(",") || "(empty)";
}
function createDataSourceCatalog() {
  const instances = /* @__PURE__ */ new Map();
  const appliedFingerprints = /* @__PURE__ */ new Map();
  let hooks = null;
  let ready = false;
  let readyWaiters = [];
  let configureChain = Promise.resolve();
  let configureSeq = 0;
  let lastDefaultConflictLog = "";
  function markReady() {
    ready = true;
    const waiters = readyWaiters;
    readyWaiters = [];
    for (const w of waiters) w();
  }
  function register2(ds2) {
    instances.set(ds2.uid, ds2);
    hooks?.registerRuntimeDataSource?.(ds2.uid, ds2);
  }
  function dispose(uid) {
    if (uid) {
      instances.get(uid)?.dispose?.();
      instances.delete(uid);
      appliedFingerprints.delete(uid);
      hooks?.unregisterRuntimeDataSource?.(uid);
      return;
    }
    for (const id of [...instances.keys()]) {
      dispose(id);
    }
  }
  function resolve(ref2) {
    if (typeof ref2 === "string") {
      const key = ref2.trim();
      if (!key) {
        throw new DataSourceError("DATASOURCE_REQUIRED", "缺少数据源引用", {
          ref: ref2,
          loaded: loadedIdentity(instances)
        });
      }
      const byUid2 = instances.get(key);
      if (byUid2) return byUid2;
      const byName = [...instances.values()].filter((d) => d.name === key);
      if (byName.length === 1) return byName[0];
      if (byName.length > 1) {
        throw new DataSourceError("DATASOURCE_AMBIGUOUS", `数据源名称存在多个实例: ${key}`, {
          ref: ref2,
          loaded: loadedIdentity(instances)
        });
      }
      const type2 = normalizeDataSourceType(key);
      if (type2) {
        const matches = [...instances.values()].filter(
          (d) => d.type === type2 || normalizeDataSourceType(d.type) === type2 || d.uid === key
        );
        if (type2 === "grafana-testdata-datasource") {
          const preferred = matches.find((d) => d.uid === "testdata") || matches.find((d) => /testdata/i.test(d.uid)) || (matches.length === 1 ? matches[0] : void 0);
          if (preferred) return preferred;
        }
        if (matches.length === 1) return matches[0];
        if (matches.length > 1) {
          throw new DataSourceError("DATASOURCE_AMBIGUOUS", `数据源类型存在多个实例: ${key}`, {
            ref: ref2,
            loaded: loadedIdentity(instances)
          });
        }
      }
      throw new DataSourceError("DATASOURCE_NOT_FOUND", `数据源未找到: ${key}`, {
        uid: key,
        ref: ref2,
        loaded: loadedIdentity(instances)
      });
    }
    const rawUid = ref2?.uid;
    const uid = normalizeUid(rawUid);
    const type = normalizeDataSourceType(typeof ref2?.type === "string" ? ref2.type : void 0);
    const name = typeof ref2?.name === "string" ? ref2.name : void 0;
    if (uid) {
      const hit = instances.get(uid);
      if (hit) {
        if (type && hit.type && normalizeDataSourceType(hit.type) !== type && hit.type !== type) {
          if (normalizeDataSourceType(hit.type) !== type) {
            throw new DataSourceError(
              "DATASOURCE_TYPE_MISMATCH",
              `数据源类型不匹配: expected ${type}, got ${hit.type}`,
              { uid, ref: ref2, loaded: loadedIdentity(instances) }
            );
          }
        }
        return hit;
      }
      if (type === "grafana-testdata-datasource" || /testdata/i.test(uid)) {
        const matches = [...instances.values()].filter(
          (d) => normalizeDataSourceType(d.type) === "grafana-testdata-datasource"
        );
        const preferred = matches.find((d) => d.uid === uid) || matches.find((d) => d.uid === "testdata") || (matches.length === 1 ? matches[0] : void 0);
        if (preferred) return preferred;
      }
      throw new DataSourceError("DATASOURCE_NOT_FOUND", `数据源未找到: ${uid}`, {
        uid,
        ref: ref2,
        loaded: loadedIdentity(instances)
      });
    }
    if (name) {
      const matches = [...instances.values()].filter(
        (d) => d.name === name || d.name?.toLowerCase() === name.toLowerCase()
      );
      if (matches.length === 1) return matches[0];
      if (matches.length > 1) {
        const preferred = matches.find((d) => d.uid === "testdata") || matches.find((d) => normalizeDataSourceType(d.type) === "grafana-testdata-datasource");
        const types = new Set(matches.map((d) => normalizeDataSourceType(d.type) || d.type));
        if (preferred && types.size === 1) return preferred;
        throw new DataSourceError("DATASOURCE_AMBIGUOUS", `数据源名称存在多个实例: ${name}`, {
          ref: ref2,
          loaded: loadedIdentity(instances)
        });
      }
    }
    if (type) {
      const matches = [...instances.values()].filter(
        (d) => d.type === type || normalizeDataSourceType(d.type) === type
      );
      if (type === "grafana-testdata-datasource") {
        const preferred = matches.find((d) => d.uid === "testdata") || matches.find((d) => /testdata/i.test(d.uid)) || (matches.length === 1 ? matches[0] : void 0);
        if (preferred) return preferred;
      }
      if (matches.length === 0) {
        throw new DataSourceError("DATASOURCE_NOT_FOUND", `数据源类型未找到: ${type}`, {
          ref: ref2,
          loaded: loadedIdentity(instances)
        });
      }
      if (matches.length > 1) {
        throw new DataSourceError("DATASOURCE_AMBIGUOUS", `数据源类型存在多个实例: ${type}`, {
          ref: ref2,
          loaded: loadedIdentity(instances)
        });
      }
      return matches[0];
    }
    throw new DataSourceError("DATASOURCE_REQUIRED", "缺少数据源引用", {
      ref: ref2,
      loaded: loadedIdentity(instances)
    });
  }
  function tryResolve(ref2) {
    try {
      return resolve(ref2);
    } catch {
      return void 0;
    }
  }
  async function doConfigure(input) {
    if (!input?.getDataSourcePlugin) {
      throw new Error("DataSourceCatalog.configure requires getDataSourcePlugin");
    }
    hooks = input;
    const seq2 = ++configureSeq;
    let settings = input.settings;
    if (!settings) {
      const runtimeSettings = listRuntimeDataSourceSettings();
      let backendSettings = [];
      if (isGrafanaLiveConfigured()) {
        try {
          const res = await backendSrv.get("/api/datasources");
          const list = Array.isArray(res.data) ? res.data : res.data?.datasources ?? [];
          backendSettings = list.filter(
            (row) => Boolean(row?.uid && row?.type)
          ).map((row) => ({
            uid: String(row.uid),
            type: String(row.type),
            name: String(row.name || row.uid),
            url: typeof row.url === "string" ? row.url : void 0,
            access: typeof row.access === "string" ? row.access : "proxy",
            isDefault: !!row.isDefault,
            jsonData: row.jsonData && typeof row.jsonData === "object" ? row.jsonData : {},
            source: "backend"
          }));
        } catch {
          backendSettings = [];
        }
      }
      const seedSpecs = [
        ["testdata", "grafana-testdata-datasource", "TestData"],
        ["prometheus", "prometheus", "Prometheus"],
        ["loki", "loki", "Loki"],
        ["jaeger", "jaeger", "Jaeger"],
        ["pyroscope", "grafana-pyroscope-datasource", "Pyroscope"],
        ["mixed", "mixed", "Mixed"],
        ["-- Grafana --", "grafana", "Grafana"],
        ["dashboard", "dashboard", "Dashboard"]
      ];
      const seeds = seedSpecs.map(([uid, type, name]) => ({
        uid,
        type,
        name,
        isDefault: false,
        jsonData: {},
        source: "seed"
      }));
      try {
        settings = mergeDataSourceSettings({
          runtime: runtimeSettings,
          backend: backendSettings,
          seeds
        });
      } catch (error) {
        const err = error;
        const msg = `${err?.code || "MERGE_ERROR"}:${err?.message || String(error)}`;
        if (msg !== lastDefaultConflictLog) {
          lastDefaultConflictLog = msg;
          console.error("[DataSourceCatalog] merge failed", err?.code || err?.message || error);
        }
        settings = mergeDataSourceSettings({
          runtime: runtimeSettings.map((s) => ({ ...s, isDefault: false })),
          backend: backendSettings.map((s) => ({ ...s, isDefault: false })),
          seeds
        });
      }
    }
    if (seq2 !== configureSeq) return;
    const desired = /* @__PURE__ */ new Map();
    for (const row of settings ?? []) {
      if (!row?.uid || !row?.type) continue;
      desired.set(row.uid, row);
    }
    for (const uid of [...instances.keys()]) {
      if (!desired.has(uid)) ;
    }
    const settingsFingerprint = (row) => {
      const jd = row.jsonData || {};
      return [
        row.uid,
        row.type,
        row.url || "",
        row.access || "proxy",
        String(jd.dataMode ?? ""),
        String(jd.apiProfile ?? ""),
        String(jd.credentialMode ?? "")
      ].join("|");
    };
    for (const row of desired.values()) {
      const fp = settingsFingerprint(row);
      const existing = instances.get(row.uid);
      const prevFp = appliedFingerprints.get(row.uid);
      if (existing) {
        if (prevFp === void 0) {
          const existingUrl = String(existing.url || "").trim();
          const desiredUrl = String(row.url || "").trim();
          if (!desiredUrl || existingUrl) {
            appliedFingerprints.set(row.uid, fp);
            continue;
          }
          dispose(row.uid);
        } else if (prevFp === fp) {
          continue;
        } else {
          dispose(row.uid);
        }
      }
      const typeKey = normalizeDataSourceType(row.type) || row.type;
      const mod = input.getDataSourcePlugin(typeKey) || input.getDataSourcePlugin(row.type);
      if (!mod?.createDataSource) {
        if (typeof console !== "undefined") {
          console.warn(
            `[DataSourceCatalog] skip uid=${row.uid}: no createDataSource for type=${row.type}${typeKey !== row.type ? ` (normalized=${typeKey})` : ""} — is the plugin registered?`
          );
        }
        continue;
      }
      const api = mod.createDataSource({
        uid: row.uid,
        type: row.type,
        name: row.name,
        url: row.url,
        access: row.access || "proxy",
        jsonData: row.jsonData || {},
        meta: mod.meta ?? {}
      });
      register2({
        uid: row.uid,
        type: row.type,
        name: row.name,
        ...api
      });
      appliedFingerprints.set(row.uid, fp);
    }
    markReady();
  }
  function configure(input = hooks) {
    const run = configureChain.then(() => doConfigure(input));
    configureChain = run.then(
      () => void 0,
      () => void 0
    );
    return run;
  }
  return {
    configure,
    list() {
      return [...instances.values()].map((d) => ({
        uid: d.uid,
        type: d.type,
        name: d.name
      }));
    },
    resolve,
    tryResolve,
    getInstances() {
      return instances;
    },
    register: register2,
    dispose,
    isReady() {
      return ready;
    },
    whenReady() {
      if (ready) return Promise.resolve();
      return new Promise((resolveReady) => {
        readyWaiters.push(resolveReady);
      });
    }
  };
}
let defaultCatalog = null;
function getDataSourceCatalog() {
  if (!defaultCatalog) defaultCatalog = createDataSourceCatalog();
  return defaultCatalog;
}
function resetDataSourceCatalog() {
  defaultCatalog?.dispose();
  defaultCatalog = null;
}
const DEFAULTS = {
  panelPipelineWorker: true,
  progressiveScheduler: true,
  filterOnDemandSelect: true
};
let flags = { ...DEFAULTS };
function readQueryFlags() {
  if (typeof window === "undefined") return null;
  try {
    const sp = new URLSearchParams(window.location.search);
    if (!sp.has("perfFlag")) return null;
    const raw = sp.get("perfFlag");
    if (raw === "0" || raw === "false" || raw === "off") {
      return {
        panelPipelineWorker: false,
        progressiveScheduler: false,
        filterOnDemandSelect: false
      };
    }
    if (raw === "1" || raw === "true" || raw === "on") {
      return {
        panelPipelineWorker: true,
        progressiveScheduler: true,
        filterOnDemandSelect: true
      };
    }
  } catch {
  }
  return null;
}
function readWindowFlags() {
  if (typeof window === "undefined") return null;
  const w = window;
  return w.__GRAFANA_VUE_PERF_FLAGS__ ?? null;
}
function initPerfFlags(overrides) {
  flags = {
    ...DEFAULTS,
    ...readWindowFlags() || {},
    ...readQueryFlags() || {},
    ...{}
  };
  return { ...flags };
}
const DEFAULT_PIPELINE_WORKER_THRESHOLD_BYTES = 512 * 1024;
function estimateFrameBytes(frames) {
  if (!frames?.length) return 0;
  let n = 0;
  for (const f of frames) {
    const rows = Number(f.length) || 0;
    const cols = Array.isArray(f.fields) ? f.fields.length : 1;
    n += rows * cols * 8 + 256;
  }
  return n;
}
function shouldUsePipelineWorker(input) {
  const thresholdBytes = input.thresholdBytes ?? DEFAULT_PIPELINE_WORKER_THRESHOLD_BYTES;
  const estimatedBytes = typeof input.estimatedBytes === "number" ? input.estimatedBytes : estimateFrameBytes(input.frames);
  if (input.enabled === false) {
    return {
      useWorker: false,
      reason: "disabled",
      estimatedBytes,
      thresholdBytes
    };
  }
  if (estimatedBytes < thresholdBytes) {
    return {
      useWorker: false,
      reason: "below-threshold",
      estimatedBytes,
      thresholdBytes
    };
  }
  if (typeof Worker === "undefined") {
    return {
      useWorker: false,
      reason: "no-worker",
      estimatedBytes,
      thresholdBytes
    };
  }
  return {
    useWorker: true,
    reason: "above-threshold",
    estimatedBytes,
    thresholdBytes
  };
}
function createStreamCoalescer(commit) {
  let pending2;
  let raf = null;
  let disposed = false;
  function schedule() {
    if (disposed || raf != null) return;
    const scheduleFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(() => cb(Date.now()), 16);
    raf = scheduleFrame(() => {
      raf = null;
      if (disposed) {
        pending2 = void 0;
        return;
      }
      if (pending2 !== void 0) {
        const v = pending2;
        pending2 = void 0;
        commit(v);
      }
    });
  }
  function push(item) {
    if (disposed) return;
    if (item.complete) {
      pending2 = void 0;
      if (raf != null && typeof cancelAnimationFrame === "function") {
        cancelAnimationFrame(raf);
      }
      raf = null;
      commit(item.value);
      return;
    }
    pending2 = item.value;
    schedule();
  }
  function dispose() {
    disposed = true;
    pending2 = void 0;
    if (raf != null && typeof cancelAnimationFrame === "function") {
      cancelAnimationFrame(raf);
    }
    raf = null;
  }
  return { push, dispose };
}
function buildCssVars(mode2) {
  const theme = createTheme({ colors: { mode: mode2 } });
  const colors = theme.colors;
  return {
    "--grafana-bg": colors.background.canvas,
    "--grafana-panel-bg": colors.background.primary,
    "--grafana-canvas-bg": colors.background.canvas,
    "--grafana-text": colors.text.primary,
    "--grafana-text-primary": colors.text.primary,
    "--grafana-text-secondary": colors.text.secondary,
    "--grafana-primary": colors.primary.main,
    "--grafana-primary-main": colors.primary.main,
    "--grafana-border": colors.border.medium,
    "--grafana-border-color-weak": colors.border.weak,
    "--grafana-border-color-medium": colors.border.medium,
    "--grafana-border-color-strong": colors.border.strong,
    "--grafana-error": colors.error.main,
    "--grafana-success": colors.success.main,
    "--grafana-warning": colors.warning.main,
    "--grafana-hover": colors.action.hover,
    "--grafana-action-hover": colors.action.hover,
    "--grafana-action-selected": colors.action.selected,
    "--grafana-action-focus": colors.action.focus,
    "--grafana-input-bg": theme.components.input.background,
    "--grafana-bg-canvas": colors.background.canvas,
    "--grafana-bg-page": colors.background.page,
    "--grafana-bg-primary": colors.background.primary,
    "--grafana-bg-secondary": colors.background.secondary,
    "--grafana-bg-elevated": colors.background.elevated,
    "--grafana-border-weak": colors.border.weak,
    "--grafana-border-medium": colors.border.medium,
    "--grafana-border-strong": colors.border.strong,
    "--grafana-primary-text": colors.primary.text,
    "--grafana-primary-border": colors.primary.border,
    "--grafana-primary-shade": colors.primary.shade,
    "--grafana-primary-contrast": colors.primary.contrastText,
    "--grafana-secondary-main": colors.secondary.main,
    "--grafana-secondary-shade": colors.secondary.shade,
    "--grafana-secondary-border": colors.secondary.border,
    "--grafana-secondary-contrast": colors.secondary.contrastText,
    "--grafana-secondary-transparent": colors.secondary.transparent,
    "--grafana-text-disabled": colors.text.disabled,
    "--grafana-action-disabled-bg": colors.action.disabledBackground,
    "--grafana-action-disabled-text": colors.action.disabledText,
    "--grafana-primary-transparent": colors.primary.transparent,
    "--grafana-error-text": colors.error.text,
    "--grafana-success-text": colors.success.text,
    "--grafana-warning-text": colors.warning.text,
    "--grafana-input-border-hover": theme.components.input.borderHover,
    "--grafana-panel-content-bg": theme.components.panel.contentBg,
    "--grafana-overlay-bg": theme.components.overlay.background,
    "--grafana-table-header-bg": theme.components.table.headerBackground,
    "--grafana-table-row-hover-bg": theme.components.table.rowHoverBackground,
    "--grafana-table-row-selected-bg": theme.components.table.rowSelectedBackground,
    "--grafana-dropdown-bg": theme.components.dropdown.background,
    "--grafana-menu-bg": theme.components.menu.background,
    "--grafana-menu-active-bg": theme.components.menu.activeBackground,
    "--grafana-drawer-bg": theme.components.drawer.background
  };
}
const grafanaCssVars = {
  light: buildCssVars("light"),
  dark: buildCssVars("dark")
};
function applyThemeVars(mode2, el = document.documentElement, opts = {}) {
  const theme = createTheme({ colors: { mode: mode2 } });
  applyTheme2CssVars(theme, el);
  if (opts.direction) {
    applyTextDirection(opts.direction, el);
  }
}
function antDesignThemeTokens(mode2) {
  const v = grafanaCssVars[mode2];
  return {
    colorPrimary: v["--grafana-primary"],
    colorSuccess: v["--grafana-success"],
    colorWarning: v["--grafana-warning"],
    colorError: v["--grafana-error"],
    colorInfo: v["--grafana-primary"],
    colorText: v["--grafana-text"],
    colorTextSecondary: v["--grafana-text-secondary"],
    colorTextTertiary: v["--grafana-text-secondary"],
    colorTextDisabled: v["--grafana-text-disabled"] || v["--grafana-text-secondary"],
    colorBgBase: v["--grafana-bg"],
    colorBgContainer: v["--grafana-panel-bg"],
    colorBgElevated: v["--grafana-bg-elevated"] || v["--grafana-dropdown-bg"] || v["--grafana-panel-bg"],
    colorBgLayout: v["--grafana-bg"],
    colorBgSpotlight: v["--grafana-hover"],
    colorBorder: v["--grafana-border-medium"] || v["--grafana-border"],
    colorBorderSecondary: v["--grafana-border-weak"] || v["--grafana-border"],
    colorFillSecondary: v["--grafana-table-header-bg"] || v["--grafana-hover"],
    colorFillTertiary: v["--grafana-hover"],
    colorFillQuaternary: v["--grafana-input-bg"],
    colorBgTextHover: v["--grafana-hover"],
    controlItemBgHover: v["--grafana-table-row-hover-bg"] || v["--grafana-hover"],
    controlItemBgActive: v["--grafana-table-row-selected-bg"] || v["--grafana-action-selected"] || v["--grafana-hover"],
    borderRadius: 6,
    borderRadiusLG: 10,
    borderRadiusSM: 4,
    fontFamily: "'Inter', 'Helvetica', 'Arial', sans-serif",
    fontSize: 14,
    colorLink: v["--grafana-primary-text"] || v["--grafana-primary"],
    controlHeight: 32,
    controlOutline: v["--grafana-action-focus"] || v["--grafana-hover"],
    colorPrimaryBorderHover: v["--grafana-input-border-hover"] || v["--grafana-border-strong"],
    colorBgContainerDisabled: v["--grafana-hover"],
    boxShadow: mode2 === "dark" ? "0px 1px 2px rgba(1, 4, 9, 0.75)" : "0px 1px 2px rgba(24, 26, 27, 0.2)",
    boxShadowSecondary: mode2 === "dark" ? "0px 4px 8px rgba(1, 4, 9, 0.75)" : "0px 4px 8px rgba(24, 26, 27, 0.2)"
  };
}
function applyTextDirection(direction, el = document.documentElement) {
  el.setAttribute("dir", direction);
  el.style.setProperty("--grafana-direction", direction);
  el.dataset.direction = direction;
}
function detectTextDirection(locale2) {
  const loc = locale2 || (typeof navigator !== "undefined" ? navigator.language : "en");
  return /^(ar|he|fa|ur)/i.test(loc) ? "rtl" : "ltr";
}
const __vite_glob_0_0$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"/></svg>\n';
const __vite_glob_0_1$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.29,12l3.54-3.54a1,1,0,0,0,0-1.41,1,1,0,0,0-1.42,0L9.17,11.29a1,1,0,0,0,0,1.42L13.41,17a1,1,0,0,0,.71.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.41Z"/></svg>';
const __vite_glob_0_2$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.83,11.29,10.59,7.05a1,1,0,0,0-1.42,0,1,1,0,0,0,0,1.41L12.71,12,9.17,15.54a1,1,0,0,0,0,1.41,1,1,0,0,0,.71.29,1,1,0,0,0,.71-.29l4.24-4.24A1,1,0,0,0,14.83,11.29Z"/></svg>';
const __vite_glob_0_3$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,13H3a1,1,0,0,0-1,1v7a1,1,0,0,0,1,1h7a1,1,0,0,0,1-1V14A1,1,0,0,0,10,13ZM9,20H4V15H9ZM21,2H14a1,1,0,0,0-1,1v7a1,1,0,0,0,1,1h7a1,1,0,0,0,1-1V3A1,1,0,0,0,21,2ZM20,9H15V4h5Zm1,4H14a1,1,0,0,0-1,1v7a1,1,0,0,0,1,1h7a1,1,0,0,0,1-1V14A1,1,0,0,0,21,13Zm-1,7H15V15h5ZM10,2H3A1,1,0,0,0,2,3v7a1,1,0,0,0,1,1h7a1,1,0,0,0,1-1V3A1,1,0,0,0,10,2ZM9,9H4V4H9Z"/></svg>';
const __vite_glob_0_4$1 = '<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 24 24"><path d="M17,11H9.41l3.3-3.29a1,1,0,1,0-1.42-1.42l-5,5a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l5,5a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L9.41,13H17a1,1,0,0,0,0-2Z"/></svg>';
const __vite_glob_0_5$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.71,7.21a1,1,0,0,0-1.42,0L9.84,14.67,6.71,11.53A1,1,0,1,0,5.29,13l3.84,3.84a1,1,0,0,0,1.42,0l8.16-8.16A1,1,0,0,0,18.71,7.21Z"/></svg>';
const __vite_glob_0_6$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21.32,9.55l-1.89-.63.89-1.78A1,1,0,0,0,20.13,6L18,3.87a1,1,0,0,0-1.15-.19l-1.78.89-.63-1.89A1,1,0,0,0,13.5,2h-3a1,1,0,0,0-.95.68L8.92,4.57,7.14,3.68A1,1,0,0,0,6,3.87L3.87,6a1,1,0,0,0-.19,1.15l.89,1.78-1.89.63A1,1,0,0,0,2,10.5v3a1,1,0,0,0,.68.95l1.89.63-.89,1.78A1,1,0,0,0,3.87,18L6,20.13a1,1,0,0,0,1.15.19l1.78-.89.63,1.89a1,1,0,0,0,.95.68h3a1,1,0,0,0,.95-.68l.63-1.89,1.78.89A1,1,0,0,0,18,20.13L20.13,18a1,1,0,0,0,.19-1.15l-.89-1.78,1.89-.63A1,1,0,0,0,22,13.5v-3A1,1,0,0,0,21.32,9.55ZM20,12.78l-1.2.4A2,2,0,0,0,17.64,16l.57,1.14-1.1,1.1L16,17.64a2,2,0,0,0-2.79,1.16l-.4,1.2H11.22l-.4-1.2A2,2,0,0,0,8,17.64l-1.14.57-1.1-1.1L6.36,16A2,2,0,0,0,5.2,13.18L4,12.78V11.22l1.2-.4A2,2,0,0,0,6.36,8L5.79,6.89l1.1-1.1L8,6.36A2,2,0,0,0,10.82,5.2l.4-1.2h1.56l.4,1.2A2,2,0,0,0,16,6.36l1.14-.57,1.1,1.1L17.64,8a2,2,0,0,0,1.16,2.79l1.2.4ZM12,8a4,4,0,1,0,4,4A4,4,0,0,0,12,8Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,12,14Z"/></svg>';
const __vite_glob_0_7$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M4 9h16v2H4V9zm2-5h12v2H6V4zm-2 10h16v2H4v-2zm2 5h12v2H6v-2z"/></svg>\n';
const __vite_glob_0_8$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,8.94a1.31,1.31,0,0,0-.06-.27l0-.09a1.07,1.07,0,0,0-.19-.28h0l-6-6h0a1.07,1.07,0,0,0-.28-.19.32.32,0,0,0-.09,0A.88.88,0,0,0,14.05,2H10A3,3,0,0,0,7,5V6H6A3,3,0,0,0,3,9V19a3,3,0,0,0,3,3h8a3,3,0,0,0,3-3V18h1a3,3,0,0,0,3-3V9S21,9,21,8.94ZM15,5.41,17.59,8H16a1,1,0,0,1-1-1ZM15,19a1,1,0,0,1-1,1H6a1,1,0,0,1-1-1V9A1,1,0,0,1,6,8H7v7a3,3,0,0,0,3,3h5Zm4-4a1,1,0,0,1-1,1H10a1,1,0,0,1-1-1V5a1,1,0,0,1,1-1h3V7a3,3,0,0,0,3,3h3Z"/></svg>';
const __vite_glob_0_9$1 = '<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 24 24"><path d="M12,14a1,1,0,0,0,1-1V7a1,1,0,0,0-2,0v6A1,1,0,0,0,12,14Zm0,4a1.25,1.25,0,1,0-1.25-1.25A1.25,1.25,0,0,0,12,18Z"/></svg>';
const __vite_glob_0_10$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,10.82a1,1,0,0,0-1,1V19a1,1,0,0,1-1,1H5a1,1,0,0,1-1-1V8A1,1,0,0,1,5,7h7.18a1,1,0,0,0,0-2H5A3,3,0,0,0,2,8V19a3,3,0,0,0,3,3H16a3,3,0,0,0,3-3V11.82A1,1,0,0,0,18,10.82Zm3.92-8.2a1,1,0,0,0-.54-.54A1,1,0,0,0,21,2H15a1,1,0,0,0,0,2h3.59L8.29,14.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L20,5.41V9a1,1,0,0,0,2,0V3A1,1,0,0,0,21.92,2.62Z"/></svg>';
const __vite_glob_0_11$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41C21.53 14.39 22.66 12.99 23 11.5 21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6.5 12 6.5zm-9.5-2.63 1.41-1.41 18.16 18.16-1.41 1.41-3.23-3.23C15.29 18.73 13.7 19 12 19 7 19 2.73 15.89 1 11.5c.69-1.66 1.72-3.13 3-4.32L2.5 3.37zM12 16.5c-1.01 0-1.94-.3-2.72-.81l1.49-1.49c.3.1.62.15.96.15 1.66 0 3-1.34 3-3 0-.34-.05-.66-.15-.96l1.49-1.49c.51.78.81 1.71.81 2.72 0 2.76-2.24 5-5 5zm-3.16-3.16 1.11-1.11c-.06.2-.1.41-.1.62 0 .83.67 1.5 1.5 1.5.21 0 .42-.04.62-.1l1.11-1.11-4.24-4.24z"/></svg>\n';
const __vite_glob_0_12$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21.92,11.6C19.9,6.91,16.1,4,12,4S4.1,6.91,2.08,11.6a1,1,0,0,0,0,.8C4.1,17.09,7.9,20,12,20s7.9-2.91,9.92-7.6A1,1,0,0,0,21.92,11.6ZM12,18c-3.17,0-6.17-2.29-7.9-6C5.83,8.29,8.83,6,12,6s6.17,2.29,7.9,6C18.17,15.71,15.17,18,12,18ZM12,8a4,4,0,1,0,4,4A4,4,0,0,0,12,8Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,12,14Z"/></svg>';
const __vite_glob_0_13$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/></svg>\n';
const __vite_glob_0_14$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM9.5 16H8v-1.5c0-.83-.67-1.5-1.5-1.5H6v-1h.5c.83 0 1.5-.67 1.5-1.5V9h1.5v1.5c0 .83.67 1.5 1.5 1.5h.5v1h-.5c-.83 0-1.5.67-1.5 1.5V16zm7.5-1.5h-1.5L14 12l1.5-2.5H17L15.5 12 17 14.5z"/></svg>\n';
const __vite_glob_0_15$1 = '<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 24 24"><path d="M12,10a1,1,0,0,0-1,1v6a1,1,0,0,0,2,0V11A1,1,0,0,0,12,10Zm0-4a1.25,1.25,0,1,0,1.25,1.25A1.25,1.25,0,0,0,12,6Z"/></svg>';
const __vite_glob_0_16$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7a2,2,0,1,0-2-2A2,2,0,0,0,12,7Zm0,10a2,2,0,1,0,2,2A2,2,0,0,0,12,17Zm0-7a2,2,0,1,0,2,2A2,2,0,0,0,12,10Z"/></svg>';
const __vite_glob_0_17$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5a1,1,0,0,0-2,0v6H5a1,1,0,0,0,0,2h6v6a1,1,0,0,0,2,0V13h6a1,1,0,0,0,0-2Z"/></svg>';
const __vite_glob_0_18$1 = '<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 24 24"><path d="M20.71,9.29l-6-6a1,1,0,0,0-.32-.21A1.09,1.09,0,0,0,14,3H6A3,3,0,0,0,3,6V18a3,3,0,0,0,3,3H18a3,3,0,0,0,3-3V10A1,1,0,0,0,20.71,9.29ZM9,5h4V7H9Zm6,14H9V16a1,1,0,0,1,1-1h4a1,1,0,0,1,1,1Zm4-1a1,1,0,0,1-1,1H17V16a3,3,0,0,0-3-3H10a3,3,0,0,0-3,3v3H6a1,1,0,0,1-1-1V6A1,1,0,0,1,6,5H7V8A1,1,0,0,0,8,9h6a1,1,0,0,0,1-1V6.41l4,4Z"/></svg>';
const __vite_glob_0_19$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21.71,20.29,18,16.61A9,9,0,1,0,16.61,18l3.68,3.68a1,1,0,0,0,1.42,0A1,1,0,0,0,21.71,20.29ZM11,18a7,7,0,1,1,7-7A7,7,0,0,1,11,18Z"/></svg>';
const __vite_glob_0_20$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/></svg>\n';
const __vite_glob_0_21$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.28,3.43a3.23,3.23,0,0,0-3.29,0L8,8.84V6A3,3,0,0,0,2,6V18a3,3,0,0,0,6,0V15.16l9,5.37a3.28,3.28,0,0,0,1.68.47,3.24,3.24,0,0,0,1.61-.43,3.38,3.38,0,0,0,1.72-3V6.42A3.38,3.38,0,0,0,20.28,3.43ZM6,18a1,1,0,0,1-2,0V6A1,1,0,0,1,6,6Zm14-.42a1.4,1.4,0,0,1-.71,1.25,1.23,1.23,0,0,1-1.28,0L8.68,13.23a1.45,1.45,0,0,1,0-2.46L18,5.19A1.23,1.23,0,0,1,18.67,5a1.29,1.29,0,0,1,.62.17A1.4,1.4,0,0,1,20,6.42Z"/></svg>';
const __vite_glob_0_22$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.91,15.51H15.38a1,1,0,0,0,0,2h2.4A8,8,0,0,1,4,12a1,1,0,0,0-2,0,10,10,0,0,0,16.88,7.23V21a1,1,0,0,0,2,0V16.5A1,1,0,0,0,19.91,15.51ZM12,2A10,10,0,0,0,5.12,4.77V3a1,1,0,0,0-2,0V7.5a1,1,0,0,0,1,1h4.5a1,1,0,0,0,0-2H6.22A8,8,0,0,1,20,12a1,1,0,0,0,2,0A10,10,0,0,0,12,2Z"/></svg>';
const __vite_glob_0_23$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58s1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41s-.23-1.06-.59-1.42zM5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7z"/></svg>\n';
const __vite_glob_0_24$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.41,12l4.3-4.29a1,1,0,1,0-1.42-1.42L12,10.59,7.71,6.29A1,1,0,0,0,6.29,7.71L10.59,12l-4.3,4.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L12,13.41l4.29,4.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42Z"/></svg>';
const __vite_glob_0_25$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,6H16V5a3,3,0,0,0-3-3H11A3,3,0,0,0,8,5V6H4A1,1,0,0,0,4,8H5V19a3,3,0,0,0,3,3h8a3,3,0,0,0,3-3V8h1a1,1,0,0,0,0-2ZM10,5a1,1,0,0,1,1-1h2a1,1,0,0,1,1,1V6H10Zm7,14a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8H17Z"/></svg>';
const registry = /* @__PURE__ */ new Map();
const modules = /* @__PURE__ */ Object.assign({
  "./assets/angle-down.svg": __vite_glob_0_0$1,
  "./assets/angle-left.svg": __vite_glob_0_1$1,
  "./assets/angle-right.svg": __vite_glob_0_2$1,
  "./assets/apps.svg": __vite_glob_0_3$1,
  "./assets/arrow-left.svg": __vite_glob_0_4$1,
  "./assets/check.svg": __vite_glob_0_5$1,
  "./assets/cog.svg": __vite_glob_0_6$1,
  "./assets/compress.svg": __vite_glob_0_7$1,
  "./assets/copy.svg": __vite_glob_0_8$1,
  "./assets/exclamation-triangle.svg": __vite_glob_0_9$1,
  "./assets/external-link-alt.svg": __vite_glob_0_10$1,
  "./assets/eye-slash.svg": __vite_glob_0_11$1,
  "./assets/eye.svg": __vite_glob_0_12$1,
  "./assets/filter.svg": __vite_glob_0_13$1,
  "./assets/function.svg": __vite_glob_0_14$1,
  "./assets/info.svg": __vite_glob_0_15$1,
  "./assets/more.svg": __vite_glob_0_16$1,
  "./assets/plus.svg": __vite_glob_0_17$1,
  "./assets/save.svg": __vite_glob_0_18$1,
  "./assets/search.svg": __vite_glob_0_19$1,
  "./assets/sort.svg": __vite_glob_0_20$1,
  "./assets/step-backward.svg": __vite_glob_0_21$1,
  "./assets/sync.svg": __vite_glob_0_22$1,
  "./assets/tag.svg": __vite_glob_0_23$1,
  "./assets/times.svg": __vite_glob_0_24$1,
  "./assets/trash.svg": __vite_glob_0_25$1
});
function parseSvg(svg) {
  const viewBoxMatch = svg.match(/viewBox="([^"]+)"/i);
  const viewBox = viewBoxMatch?.[1] ?? "0 0 24 24";
  const inner = svg.replace(/^[\s\S]*?<svg[^>]*>/i, "").replace(/<\/svg>\s*$/i, "");
  return { viewBox, body: inner.trim() };
}
for (const [path, svg] of Object.entries(modules)) {
  const file = path.split("/").pop().replace(/\.svg$/, "");
  const parsed = parseSvg(svg);
  registry.set(file, {
    name: file,
    svg,
    viewBox: parsed.viewBox,
    body: parsed.body
  });
}
const ALIASES$1 = {
  "filter-alt": "filter",
  "label": "tag",
  "functions": "function",
  "eye-off": "eye-slash",
  "setting": "cog",
  "settings": "cog",
  "trash": "trash",
  "trash-alt": "trash",
  "inspect": "search",
  "share": "share-alt",
  "share-alt": "copy",
  // fallback if share missing
  "more": "more",
  "ellipsis": "more",
  "info-circle": "info",
  "exclamation-triangle": "exclamation-triangle",
  "warning": "exclamation-triangle",
  "fullscreen": "apps",
  "expand": "apps",
  "expand-arrows": "apps",
  "pen": "cog",
  "edit": "cog",
  "times": "times",
  "close": "times",
  "question": "info",
  "dashboard": "apps",
  "database": "apps",
  "clock": "info",
  "clock-circle": "info",
  "bell": "info",
  "link": "copy",
  "camera": "eye",
  "check-circle": "check",
  "step-backward": "times",
  // temporary until asset; LiveRenderer uses path via GIcon name
  "fullscreen-exit": "apps"
};
function registerIcon(def) {
  registry.set(def.name, def);
}
function resolveIconName(name) {
  if (registry.has(name)) return name;
  if (ALIASES$1[name] && registry.has(ALIASES$1[name])) return ALIASES$1[name];
  if (ALIASES$1[name]) return ALIASES$1[name];
  return name;
}
function getIcon(name, { strict = false } = {}) {
  const resolved = resolveIconName(name);
  const hit = registry.get(resolved) ?? registry.get(name);
  if (!hit && strict) {
    throw new Error(`unknown icon: ${name}`);
  }
  return hit;
}
registerIcon({
  name: "step-backward",
  viewBox: "0 0 24 24",
  body: '<path d="M20.28,3.43a3.23,3.23,0,0,0-3.29,0L8,8.84V6A3,3,0,0,0,2,6V18a3,3,0,0,0,6,0V15.16l9,5.37a3.28,3.28,0,0,0,1.68.47,3.24,3.24,0,0,0,1.61-.43,3.38,3.38,0,0,0,1.72-3V6.42A3.38,3.38,0,0,0,20.28,3.43ZM6,18a1,1,0,0,1-2,0V6A1,1,0,0,1,6,6Zm14-.42a1.4,1.4,0,0,1-.71,1.25,1.23,1.23,0,0,1-1.28,0L8.68,13.23a1.45,1.45,0,0,1,0-2.46L18,5.19A1.23,1.23,0,0,1,18.67,5a1.29,1.29,0,0,1,.62.17A1.4,1.4,0,0,1,20,6.42Z"/>'
});
for (const name of [
  "cog",
  "trash",
  "copy",
  "search",
  "plus",
  "save",
  "sync",
  "eye",
  "info",
  "check",
  "times",
  "more"
]) {
  if (!registry.has(name)) {
    registerIcon({ name, viewBox: "0 0 24 24", body: "" });
  }
}
function resolveIcon(_name) {
  return void 0;
}
const iconMap = {};
const _sfc_main$K$1 = /* @__PURE__ */ defineComponent({
  __name: "GButton",
  props: {
    variant: { default: "secondary" },
    size: { default: "md" },
    disabled: { type: Boolean },
    loading: { type: Boolean },
    htmlType: { default: "button" },
    testId: {}
  },
  setup(__props) {
    const props = __props;
    const type = computed(() => {
      if (props.variant === "primary") return "primary";
      if (props.variant === "destructive") return "primary";
      if (props.variant === "text" || props.variant === "toolbar") return "text";
      return "default";
    });
    const danger = computed(() => props.variant === "destructive");
    const size = computed(
      () => props.size === "sm" ? "small" : props.size === "lg" ? "large" : "middle"
    );
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Button), {
        type: type.value,
        danger: danger.value,
        size: size.value,
        disabled: __props.disabled,
        loading: __props.loading,
        "html-type": __props.htmlType,
        "data-testid": __props.testId,
        class: normalizeClass(["g-button", [`g-button--${__props.variant}`, `g-button--${size.value}`]])
      }, {
        default: withCtx(() => [
          renderSlot(_ctx.$slots, "default", {}, void 0, true)
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["type", "danger", "size", "disabled", "loading", "html-type", "data-testid", "class"]);
    };
  }
});
const _export_sfc$2 = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const GButton = /* @__PURE__ */ _export_sfc$2(_sfc_main$K$1, [["__scopeId", "data-v-e1ee99ab"]]);
const _hoisted_1$s$1 = { class: "g-modal__footer" };
const _hoisted_2$g$1 = ["data-testid"];
const _sfc_main$J$1 = /* @__PURE__ */ defineComponent({
  __name: "GModal",
  props: {
    open: { type: Boolean },
    title: {},
    width: { default: 520 },
    confirmLoading: { type: Boolean },
    okText: { default: "确定" },
    cancelText: { default: "取消" },
    okVariant: { default: "primary" },
    hideFooter: { type: Boolean, default: false },
    testId: {}
  },
  emits: ["update:open", "ok", "cancel"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    function onCancel() {
      emit("cancel");
      emit("update:open", false);
    }
    function onOk() {
      emit("ok");
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode("\n    Grafana Modal (refs/.../Modal/getModalStyles.ts):\n    - surface: background.primary + border.weak + shadows.z3 + radius.lg (~10px via Ant LG / radius token)\n    - backdrop: components.overlay.background (light rgba(208,209,211,0.5) — never black)\n    - sticky footer on primary; close uses text.secondary\n  "),
          createVNode(unref(Modal), {
            open: __props.open,
            title: __props.title,
            width: __props.width,
            "confirm-loading": __props.confirmLoading,
            "ok-text": __props.okText,
            "cancel-text": __props.cancelText,
            footer: __props.hideFooter ? null : void 0,
            "wrap-class-name": "g-modal-wrap",
            "root-class-name": "g-modal-root",
            centered: false,
            "onUpdate:open": _cache[0] || (_cache[0] = ($event) => emit("update:open", $event)),
            onCancel
          }, createSlots({
            default: withCtx(() => [
              createElementVNode("div", {
                class: "g-modal__body",
                "data-testid": __props.testId
              }, [
                renderSlot(_ctx.$slots, "default", {}, void 0, true)
              ], 8, _hoisted_2$g$1)
            ]),
            _: 2
            /* DYNAMIC */
          }, [
            !__props.hideFooter ? {
              name: "footer",
              fn: withCtx(() => [
                createElementVNode("div", _hoisted_1$s$1, [
                  createVNode(GButton, {
                    "test-id": "g-modal-cancel",
                    onClick: onCancel
                  }, {
                    default: withCtx(() => [
                      createTextVNode(
                        toDisplayString(__props.cancelText),
                        1
                        /* TEXT */
                      )
                    ]),
                    _: 1
                    /* STABLE */
                  }),
                  createVNode(GButton, {
                    variant: __props.okVariant,
                    loading: __props.confirmLoading,
                    "test-id": "g-modal-ok",
                    onClick: onOk
                  }, {
                    default: withCtx(() => [
                      createTextVNode(
                        toDisplayString(__props.okText),
                        1
                        /* TEXT */
                      )
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["variant", "loading"])
                ])
              ]),
              key: "0"
            } : void 0
          ]), 1032, ["open", "title", "width", "confirm-loading", "ok-text", "cancel-text", "footer"])
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const GModal = /* @__PURE__ */ _export_sfc$2(_sfc_main$J$1, [["__scopeId", "data-v-31b7eb1e"]]);
function flattenSelectOptions(list) {
  if (!list?.length) return [];
  const out = [];
  for (const opt of list) {
    if (opt.options?.length) {
      for (const child of opt.options) out.push(child);
    } else {
      out.push(opt);
    }
  }
  return out;
}
function optionMatchesQuery(opt, q) {
  if (!q) return true;
  const label = String(opt.label ?? "").toLowerCase();
  const value = String(opt.value ?? "").toLowerCase();
  return label.includes(q) || value.includes(q);
}
function shouldUseFilterOnDemand(opts) {
  if (opts.filterOnDemand === true) return true;
  if (opts.filterOnDemand === false) return false;
  return opts.optionCount >= (opts.threshold ?? 200);
}
function windowSelectOptions(opts) {
  const all = opts.options ?? [];
  const q = String(opts.query ?? "").trim().toLowerCase();
  const max = Math.max(1, opts.maxVisible || 100);
  const selected = new Set(
    (Array.isArray(opts.value) ? opts.value : [opts.value]).filter((v) => v != null && v !== "").map(String)
  );
  const flat = flattenSelectOptions(all);
  const pinned = [];
  const rest = [];
  for (const opt of flat) {
    if (selected.has(String(opt.value))) pinned.push(opt);
    else if (optionMatchesQuery(opt, q)) rest.push(opt);
  }
  const out = [...pinned];
  for (const opt of rest) {
    if (out.length >= max) break;
    out.push(opt);
  }
  return out;
}
const _sfc_main$I$1 = /* @__PURE__ */ defineComponent({
  __name: "GSelect",
  props: {
    value: {},
    options: {},
    placeholder: {},
    disabled: { type: Boolean },
    allowClear: { type: Boolean },
    mode: {},
    testId: {},
    ariaLabel: {},
    showSearch: { type: Boolean, default: true },
    size: { default: "middle" },
    filterOption: { type: [Boolean, Function] },
    virtual: { type: Boolean, default: true },
    filterOnDemand: { type: Boolean, default: void 0 },
    filterOnDemandThreshold: { default: 200 },
    maxVisibleOptions: { default: 100 },
    width: {}
  },
  emits: ["update:value", "change", "search"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const selectStyle = computed(
      () => props.width != null ? {
        width: typeof props.width === "number" ? `${props.width}px` : props.width
      } : { width: "100%" }
    );
    const emit = __emit;
    const mode2 = computed(() => props.mode);
    const searchQuery = ref("");
    const useFilterOnDemand = computed(
      () => shouldUseFilterOnDemand({
        filterOnDemand: props.filterOnDemand,
        optionCount: flattenSelectOptions(props.options).length,
        threshold: props.filterOnDemandThreshold
      })
    );
    const effectiveShowSearch = computed(() => props.showSearch !== false || useFilterOnDemand.value);
    function defaultFilterOption(input, option) {
      const q = String(input ?? "").trim().toLowerCase();
      if (!q) return true;
      const label = String(option?.label ?? option?.children ?? "").toLowerCase();
      const value = String(option?.value ?? "").toLowerCase();
      return label.includes(q) || value.includes(q);
    }
    const resolvedFilterOption = computed(() => {
      if (useFilterOnDemand.value) return false;
      if (props.filterOption === void 0) return defaultFilterOption;
      return props.filterOption;
    });
    const visibleOptions = computed(() => {
      const all = props.options ?? [];
      if (!useFilterOnDemand.value) return all;
      return windowSelectOptions({
        options: all,
        query: searchQuery.value,
        maxVisible: props.maxVisibleOptions ?? 100,
        value: props.value
      });
    });
    function onUpdate(v) {
      emit("update:value", v);
      emit("change", v);
    }
    function onSearch(v) {
      searchQuery.value = String(v ?? "");
      emit("search", searchQuery.value);
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Select), mergeProps({
        class: "g-select",
        value: __props.value,
        options: visibleOptions.value ?? [],
        placeholder: __props.placeholder || "请选择",
        disabled: __props.disabled,
        "allow-clear": __props.allowClear,
        mode: mode2.value,
        "show-search": effectiveShowSearch.value,
        size: __props.size,
        "option-filter-prop": "label",
        "filter-option": resolvedFilterOption.value,
        "data-testid": __props.testId,
        "aria-label": __props.ariaLabel || __props.placeholder || "Select",
        style: selectStyle.value,
        "popup-class-name": "g-select-dropdown",
        virtual: __props.virtual,
        "onUpdate:value": onUpdate
      }, toHandlers(effectiveShowSearch.value ? { search: onSearch } : {})), null, 16, ["value", "options", "placeholder", "disabled", "allow-clear", "mode", "show-search", "size", "filter-option", "data-testid", "aria-label", "style", "virtual"]);
    };
  }
});
const GSelect = /* @__PURE__ */ _export_sfc$2(_sfc_main$I$1, [["__scopeId", "data-v-662a3122"]]);
const _sfc_main$H$1 = /* @__PURE__ */ defineComponent({
  __name: "GForm",
  props: {
    layout: {},
    model: {},
    testId: {}
  },
  emits: ["finish", "finishFailed"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Form), {
        layout: __props.layout ?? "vertical",
        model: __props.model,
        "data-testid": __props.testId,
        onFinish: _cache[0] || (_cache[0] = ($event) => emit("finish", $event)),
        onFinishFailed: _cache[1] || (_cache[1] = ($event) => emit("finishFailed", $event))
      }, {
        default: withCtx(() => [
          renderSlot(_ctx.$slots, "default")
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["layout", "model", "data-testid"]);
    };
  }
});
const _hoisted_1$r$1 = ["viewBox", "width", "height", "aria-hidden", "role", "aria-label", "data-icon-name", "innerHTML"];
const _hoisted_2$f$1 = ["title"];
const _sfc_main$G$1 = /* @__PURE__ */ defineComponent({
  __name: "GIcon",
  props: {
    name: {},
    size: { default: 16 },
    color: {},
    title: {},
    spin: { type: Boolean, default: false },
    strict: { type: Boolean, default: false }
  },
  setup(__props) {
    const props = __props;
    const icon = computed(() => getIcon(props.name, { strict: props.strict }));
    const px = computed(() => typeof props.size === "number" ? `${props.size}px` : props.size);
    return (_ctx, _cache) => {
      return icon.value ? (openBlock(), createElementBlock("svg", {
        key: 0,
        class: normalizeClass(["g-icon", { "is-spin": __props.spin }]),
        viewBox: icon.value.viewBox || "0 0 24 24",
        width: px.value,
        height: px.value,
        "aria-hidden": __props.title ? void 0 : "true",
        role: __props.title ? "img" : void 0,
        "aria-label": __props.title,
        style: normalizeStyle({ color: __props.color }),
        "data-testid": "g-icon",
        "data-icon-name": __props.name,
        innerHTML: icon.value.body || ""
      }, null, 14, _hoisted_1$r$1)) : !__props.strict ? (openBlock(), createElementBlock("span", {
        key: 1,
        class: "g-icon-missing",
        title: __props.name,
        "data-testid": "g-icon-missing"
      }, "?", 8, _hoisted_2$f$1)) : createCommentVNode("v-if", true);
    };
  }
});
const GIcon = /* @__PURE__ */ _export_sfc$2(_sfc_main$G$1, [["__scopeId", "data-v-6dd07a67"]]);
const _sfc_main$F$1 = /* @__PURE__ */ defineComponent({
  ...{ inheritAttrs: false },
  __name: "GInput",
  props: {
    value: {},
    modelValue: {},
    placeholder: {},
    type: { default: "text" },
    disabled: { type: Boolean },
    testId: {},
    textarea: { type: Boolean },
    rows: {}
  },
  emits: ["update:value", "update:modelValue", "focus", "blur"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const attrs = useAttrs();
    const current = computed(() => props.modelValue !== void 0 ? props.modelValue : props.value);
    const resolvedTestId = computed(() => props.testId ?? attrs["data-testid"]);
    function onUpdate(v) {
      emit("update:value", v);
      emit("update:modelValue", v);
    }
    return (_ctx, _cache) => {
      return __props.textarea ? (openBlock(), createBlock(unref(Input).TextArea, mergeProps({ key: 0 }, unref(attrs), {
        value: String(current.value ?? ""),
        placeholder: __props.placeholder,
        disabled: __props.disabled,
        rows: __props.rows,
        "data-testid": resolvedTestId.value,
        "onUpdate:value": onUpdate,
        onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
        onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
      }), null, 16, ["value", "placeholder", "disabled", "rows", "data-testid"])) : (openBlock(), createBlock(unref(Input), mergeProps({ key: 1 }, unref(attrs), {
        value: current.value,
        placeholder: __props.placeholder,
        type: __props.type,
        disabled: __props.disabled,
        "data-testid": resolvedTestId.value,
        "onUpdate:value": onUpdate,
        onFocus: _cache[2] || (_cache[2] = ($event) => emit("focus", $event)),
        onBlur: _cache[3] || (_cache[3] = ($event) => emit("blur", $event))
      }), null, 16, ["value", "placeholder", "type", "disabled", "data-testid"]));
    };
  }
});
const GInput = /* @__PURE__ */ _export_sfc$2(_sfc_main$F$1, [["__scopeId", "data-v-71391893"]]);
const _sfc_main$E$1 = /* @__PURE__ */ defineComponent({
  __name: "GSwitch",
  props: {
    checked: { type: Boolean },
    disabled: { type: Boolean },
    testId: {}
  },
  emits: ["update:checked"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    function onChange(v) {
      emit("update:checked", !!v);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode("\n    Grafana Switch (refs/.../Switch/Switch.tsx):\n    track input.bg; unchecked knob text.secondary; checked track accent/primary + white knob\n  "),
          createVNode(unref(Switch), {
            class: "g-switch",
            checked: __props.checked,
            disabled: __props.disabled,
            "data-testid": __props.testId,
            "onUpdate:checked": onChange
          }, null, 8, ["checked", "disabled", "data-testid"])
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const GSwitch = /* @__PURE__ */ _export_sfc$2(_sfc_main$E$1, [["__scopeId", "data-v-ad45f64f"]]);
const _sfc_main$D$1 = /* @__PURE__ */ defineComponent({
  __name: "GSlider",
  props: {
    value: {},
    min: {},
    max: {},
    step: {}
  },
  emits: ["update:value"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Slider), {
        value: __props.value,
        min: __props.min,
        max: __props.max,
        step: __props.step,
        "onUpdate:value": _cache[0] || (_cache[0] = ($event) => emit("update:value", Number($event)))
      }, null, 8, ["value", "min", "max", "step"]);
    };
  }
});
const _sfc_main$C$1 = /* @__PURE__ */ defineComponent({
  ...{ inheritAttrs: false },
  __name: "GRangePicker",
  props: {
    value: {},
    presets: {},
    format: {},
    showTime: { type: Boolean },
    allowClear: { type: Boolean },
    size: {}
  },
  emits: ["update:value"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const attrs = useAttrs();
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(RangePicker), mergeProps(unref(attrs), {
        class: "g-range-picker",
        value: __props.value,
        presets: __props.presets,
        format: __props.format,
        "show-time": __props.showTime,
        "allow-clear": __props.allowClear,
        size: __props.size,
        "onUpdate:value": _cache[0] || (_cache[0] = ($event) => emit("update:value", $event))
      }), null, 16, ["value", "presets", "format", "show-time", "allow-clear", "size"]);
    };
  }
});
const GRangePicker = /* @__PURE__ */ _export_sfc$2(_sfc_main$C$1, [["__scopeId", "data-v-8f17339f"]]);
const _sfc_main$B$1 = /* @__PURE__ */ defineComponent({
  __name: "GCheckbox",
  props: {
    checked: { type: Boolean },
    disabled: { type: Boolean },
    testId: {}
  },
  emits: ["update:checked"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Checkbox), {
        class: "g-checkbox",
        checked: __props.checked,
        disabled: __props.disabled,
        "data-testid": __props.testId,
        "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => emit("update:checked", $event))
      }, {
        default: withCtx(() => [
          renderSlot(_ctx.$slots, "default", {}, void 0, true)
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["checked", "disabled", "data-testid"]);
    };
  }
});
const GCheckbox = /* @__PURE__ */ _export_sfc$2(_sfc_main$B$1, [["__scopeId", "data-v-61199225"]]);
const _sfc_main$A$1 = /* @__PURE__ */ defineComponent({
  __name: "GTabs",
  props: {
    activeKey: {},
    items: {},
    testId: {}
  },
  emits: ["update:activeKey"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode("\n    Grafana Tabs (refs/.../Tabs/Tab.tsx + TabsBar.tsx):\n    - inactive: text.secondary; hover → text.primary + action.hover underline\n    - active: text.primary + brandHorizontal underline (2px)\n    - bar: border.weak bottom\n    Never use text.maxContrast for active — that is pure black in light and wrong on selected surfaces.\n  "),
          createVNode(unref(Tabs), {
            class: "g-tabs",
            "active-key": __props.activeKey,
            "data-testid": __props.testId,
            "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => emit("update:activeKey", String($event)))
          }, {
            default: withCtx(() => [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(__props.items, (it) => {
                  return openBlock(), createBlock(
                    unref(TabPane),
                    {
                      key: it.key
                    },
                    {
                      tab: withCtx(() => [
                        renderSlot(_ctx.$slots, `tab-${it.key}`, {}, () => [
                          createTextVNode(
                            toDisplayString(it.label),
                            1
                            /* TEXT */
                          )
                        ], true)
                      ]),
                      default: withCtx(() => [
                        renderSlot(_ctx.$slots, it.key, {}, void 0, true)
                      ]),
                      _: 2
                      /* DYNAMIC */
                    },
                    1024
                    /* DYNAMIC_SLOTS */
                  );
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            _: 3
            /* FORWARDED */
          }, 8, ["active-key", "data-testid"])
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const GTabs = /* @__PURE__ */ _export_sfc$2(_sfc_main$A$1, [["__scopeId", "data-v-12f2ac8a"]]);
const _hoisted_1$q$1 = ["data-testid"];
const _sfc_main$z$1 = /* @__PURE__ */ defineComponent({
  __name: "GDrawer",
  props: {
    open: { type: Boolean },
    title: {},
    width: { default: void 0 },
    size: { default: void 0 },
    testId: {},
    destroyOnClose: { type: Boolean, default: true },
    resizable: { type: Boolean, default: true }
  },
  emits: ["update:open"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const SIZE_MAP = {
      sm: { width: "25vw", minWidth: 384 },
      md: { width: "50vw", minWidth: 568 },
      lg: { width: "75vw", minWidth: 744 }
    };
    const customWidth = ref(void 0);
    const baseWidth = computed(() => {
      if (props.width != null) return props.width;
      if (props.size && SIZE_MAP[props.size]) return SIZE_MAP[props.size].width;
      return 420;
    });
    const resolvedWidth = computed(() => customWidth.value ?? baseWidth.value);
    const contentWrapperStyle = computed(() => {
      const min = props.size && SIZE_MAP[props.size] ? SIZE_MAP[props.size].minWidth : typeof props.width === "number" ? props.width : void 0;
      const style = {};
      if (min != null) style.minWidth = `${min}px`;
      return Object.keys(style).length ? style : void 0;
    });
    watch(
      () => props.open,
      (open) => {
        if (!open) customWidth.value = void 0;
        if (typeof document !== "undefined") {
          document.body.classList.toggle("body-drawer-open", !!open);
        }
      }
    );
    function getCustomDrawerWidth(clientX) {
      const body = document.body;
      const offsetRight = body.offsetWidth - (clientX - body.offsetLeft);
      const widthPercent = Math.min(offsetRight / Math.max(body.clientWidth, 1) * 100, 98).toFixed(2);
      return `${widthPercent}vw`;
    }
    let removeMove = null;
    function stopDrag() {
      if (removeMove) {
        removeMove();
        removeMove = null;
      }
    }
    function startDrag(clientX) {
      customWidth.value = getCustomDrawerWidth(clientX);
      const onMouseMove = (e) => {
        customWidth.value = getCustomDrawerWidth(e.clientX);
      };
      const onTouchMove = (e) => {
        const t2 = e.touches[0];
        if (t2) customWidth.value = getCustomDrawerWidth(t2.clientX);
      };
      const onUp = () => stopDrag();
      document.addEventListener("mousemove", onMouseMove);
      document.addEventListener("mouseup", onUp);
      document.addEventListener("touchmove", onTouchMove, { passive: true });
      document.addEventListener("touchend", onUp);
      removeMove = () => {
        document.removeEventListener("mousemove", onMouseMove);
        document.removeEventListener("mouseup", onUp);
        document.removeEventListener("touchmove", onTouchMove);
        document.removeEventListener("touchend", onUp);
      };
    }
    function onMouseDown(e) {
      e.preventDefault();
      e.stopPropagation();
      startDrag(e.clientX);
    }
    function onTouchStart(e) {
      const t2 = e.touches[0];
      if (!t2) return;
      e.preventDefault();
      e.stopPropagation();
      startDrag(t2.clientX);
    }
    onBeforeUnmount(() => {
      stopDrag();
      if (typeof document !== "undefined") {
        document.body.classList.remove("body-drawer-open");
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Drawer), {
        open: __props.open,
        title: __props.title,
        width: resolvedWidth.value,
        "content-wrapper-style": contentWrapperStyle.value,
        "destroy-on-close": __props.destroyOnClose,
        placement: "right",
        "root-class-name": "g-drawer-root",
        class: "g-drawer",
        "onUpdate:open": _cache[0] || (_cache[0] = ($event) => emit("update:open", $event))
      }, {
        default: withCtx(() => [
          createCommentVNode(" Grafana vertical drag handle on left edge "),
          __props.resizable ? (openBlock(), createElementBlock(
            "div",
            {
              key: 0,
              class: "g-drawer__resizer",
              "data-testid": "g-drawer-resizer",
              role: "separator",
              "aria-orientation": "vertical",
              "aria-label": "调整抽屉宽度",
              tabindex: "0",
              onMousedown: onMouseDown,
              onTouchstart: withModifiers(onTouchStart, ["prevent"])
            },
            null,
            32
            /* NEED_HYDRATION */
          )) : createCommentVNode("v-if", true),
          createElementVNode("div", {
            class: "g-drawer__body",
            "data-testid": __props.testId
          }, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ], 8, _hoisted_1$q$1)
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["open", "title", "width", "content-wrapper-style", "destroy-on-close"]);
    };
  }
});
const GDrawer = /* @__PURE__ */ _export_sfc$2(_sfc_main$z$1, [["__scopeId", "data-v-bcb42284"]]);
const _sfc_main$y$1 = /* @__PURE__ */ defineComponent({
  __name: "GTooltip",
  props: {
    title: {},
    placement: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode(" Grafana Tooltip: elevated + weak border + z2/z3 "),
          createVNode(unref(Tooltip), {
            title: __props.title,
            placement: __props.placement,
            "overlay-class-name": "g-tooltip-overlay",
            color: "transparent"
          }, {
            default: withCtx(() => [
              renderSlot(_ctx.$slots, "default")
            ]),
            _: 3
            /* FORWARDED */
          }, 8, ["title", "placement"])
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const GTABLE_VIRT = {
  OVERSCAN: 8,
  DEFAULT_ROW_HEIGHT: 36
};
const EMPTY = {
  start: 0,
  end: 0,
  offsetY: 0,
  bottomSpacer: 0,
  totalHeight: 0,
  windowCount: 0
};
function computeTableVisibleRange(scrollTop, viewportHeight, rowHeight, itemCount, overscan = GTABLE_VIRT.OVERSCAN) {
  if (itemCount <= 0 || rowHeight <= 0) return { ...EMPTY };
  const totalHeight = itemCount * rowHeight;
  const vh = Math.max(0, viewportHeight);
  const st = Math.max(0, Math.min(scrollTop, Math.max(0, totalHeight - vh)));
  const rawStart = Math.floor(st / rowHeight);
  const start = Math.max(0, rawStart - overscan);
  const visibleCount = Math.ceil(vh / rowHeight) + 1;
  const end = Math.min(itemCount, rawStart + visibleCount + overscan);
  const offsetY = start * rowHeight;
  const bottomSpacer = Math.max(0, totalHeight - end * rowHeight);
  return {
    start,
    end,
    offsetY,
    bottomSpacer,
    totalHeight,
    windowCount: Math.max(0, end - start)
  };
}
const _hoisted_1$p$1 = ["data-testid", "data-virtualized", "data-row-count", "data-row-height", "data-window-start", "data-window-count"];
const TOP_KEY = "__gtable_virt_top";
const BOTTOM_KEY = "__gtable_virt_bottom";
const _sfc_main$x$1 = /* @__PURE__ */ defineComponent({
  __name: "GTable",
  props: {
    columns: {},
    dataSource: { default: () => [] },
    loading: { type: Boolean },
    testId: {},
    pagination: { type: [Boolean, Object] },
    size: { default: "small" },
    bordered: { type: Boolean, default: false },
    showHeader: { type: Boolean, default: true },
    scroll: {},
    rowClassName: {},
    customRow: {},
    virtual: { type: Boolean, default: false },
    rowHeight: { default: GTABLE_VIRT.DEFAULT_ROW_HEIGHT },
    rowCount: {},
    getRow: {},
    rowsDep: {},
    rowKey: { type: [String, Function], default: "key" },
    expandable: { default: null }
  },
  emits: ["change", "scroll"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const rootRef = ref(null);
    const scrollTop = ref(0);
    const bodyHeight = ref(0);
    let bodyEl = null;
    let restoreScroll = false;
    const expandableOpt = computed(() => {
      const ex = props.expandable;
      return ex && typeof ex === "object" ? ex : void 0;
    });
    const paginationOpt = computed(() => {
      if (props.pagination === true) return {};
      if (props.pagination === false || props.pagination == null) return false;
      return props.pagination;
    });
    const totalRows = computed(() => {
      if (typeof props.rowCount === "number" && props.rowCount >= 0) {
        return props.rowCount;
      }
      return props.dataSource?.length ?? 0;
    });
    const viewportH = computed(() => {
      const y = props.scroll?.y;
      if (typeof y === "number" && y > 0) return y;
      if (typeof y === "string") {
        const n = Number.parseFloat(y);
        if (Number.isFinite(n) && n > 0) return n;
      }
      return bodyHeight.value > 0 ? bodyHeight.value : 280;
    });
    const virtEnabled = computed(
      () => !!props.virtual && !props.expandable && paginationOpt.value === false && totalRows.value > 0
    );
    const range = computed(() => {
      if (!virtEnabled.value) {
        return {
          start: 0,
          end: totalRows.value,
          offsetY: 0,
          bottomSpacer: 0,
          totalHeight: totalRows.value * (props.rowHeight || GTABLE_VIRT.DEFAULT_ROW_HEIGHT),
          windowCount: totalRows.value
        };
      }
      return computeTableVisibleRange(
        scrollTop.value,
        viewportH.value,
        props.rowHeight || GTABLE_VIRT.DEFAULT_ROW_HEIGHT,
        totalRows.value
      );
    });
    function resolveRow(index2) {
      if (props.getRow) return props.getRow(index2);
      const row = props.dataSource?.[index2];
      if (row) return row;
      return { key: index2, __rowIndex: index2 };
    }
    const windowedData = computed(() => {
      void props.rowsDep;
      const n = totalRows.value;
      if (!virtEnabled.value) {
        if (props.getRow) {
          const all = new Array(n);
          for (let i = 0; i < n; i++) all[i] = resolveRow(i);
          return all;
        }
        return props.dataSource ?? [];
      }
      const { start, end, offsetY, bottomSpacer } = range.value;
      const out = [];
      if (offsetY > 0) {
        out.push({
          key: TOP_KEY,
          __gtableSpacer: true,
          __virtHeight: offsetY,
          __virtEdge: "top"
        });
      }
      for (let i = start; i < end; i++) {
        const row = resolveRow(i);
        out.push({
          ...row,
          key: row.key ?? i,
          __rowIndex: row.__rowIndex ?? i,
          __virtIndex: row.__virtIndex ?? i
        });
      }
      if (bottomSpacer > 0) {
        out.push({
          key: BOTTOM_KEY,
          __gtableSpacer: true,
          __virtHeight: bottomSpacer,
          __virtEdge: "bottom"
        });
      }
      return out;
    });
    const columnsResolved = computed(() => {
      const cols = props.columns ?? [];
      if (!virtEnabled.value) return cols;
      const colCount = Math.max(cols.length, 1);
      return cols.map((col2, ci) => {
        const prevRender = col2.customRender;
        const prevCell = col2.customCell;
        return {
          ...col2,
          // Fixed height path: force ellipsis unless caller disabled it explicitly.
          ellipsis: col2.ellipsis === false ? false : true,
          customCell: (record, rowIndex, column) => {
            const base = typeof prevCell === "function" ? prevCell(record, rowIndex, column) || {} : {};
            if (record?.__gtableSpacer) {
              if (ci === 0) {
                return {
                  ...base,
                  colSpan: colCount,
                  style: {
                    ...base.style || {},
                    padding: 0,
                    border: "none",
                    height: `${Number(record.__virtHeight || 0)}px`
                  }
                };
              }
              return { ...base, colSpan: 0 };
            }
            return base;
          },
          customRender: (ctx) => {
            const rec = ctx?.record;
            if (rec?.__gtableSpacer) {
              if (ci !== 0) return null;
              return h("div", {
                "class": "g-table-virt-spacer",
                "data-testid": rec.__virtEdge === "top" ? "table-virt-top" : "table-virt-bottom",
                "style": {
                  height: `${Number(rec.__virtHeight || 0)}px`,
                  padding: 0,
                  margin: 0,
                  border: "none",
                  lineHeight: 0
                }
              });
            }
            if (typeof prevRender === "function") return prevRender(ctx);
            return ctx?.text;
          }
        };
      });
    });
    function mergedRowClassName(record, index2) {
      if (record?.__gtableSpacer) return "g-table-virt-spacer-row";
      if (typeof props.rowClassName === "function") {
        return props.rowClassName(record, index2);
      }
      return props.rowClassName || "";
    }
    function mergedCustomRow(record, index2) {
      if (record?.__gtableSpacer) {
        return {
          "class": "g-table-virt-spacer-row",
          "aria-hidden": "true",
          "style": {
            height: `${Number(record.__virtHeight || 0)}px`
          }
        };
      }
      const base = typeof props.customRow === "function" ? props.customRow(record, index2) || {} : {};
      const logical = typeof record.__virtIndex === "number" ? record.__virtIndex : typeof record.__rowIndex === "number" ? record.__rowIndex : typeof index2 === "number" ? range.value.start + index2 : 0;
      return {
        ...base,
        "data-row-index": String(logical),
        "aria-rowindex": String(logical + 1)
      };
    }
    const scrollOpt = computed(() => {
      if (!props.scroll && !virtEnabled.value) return void 0;
      const y = props.scroll?.y ?? (virtEnabled.value ? Math.max(80, viewportH.value) : void 0);
      return {
        x: props.scroll?.x ?? "max-content",
        ...y != null ? { y } : {}
      };
    });
    function onTableChange(pagination, filters, sorter, extra) {
      emit("change", pagination, filters, sorter, extra);
    }
    function onBodyScroll() {
      if (!bodyEl) return;
      const next = bodyEl.scrollTop;
      if (Math.abs(next - scrollTop.value) < 0.5) return;
      scrollTop.value = next;
      bodyHeight.value = bodyEl.clientHeight || bodyHeight.value;
      emit("scroll", { scrollTop: next, clientHeight: bodyEl.clientHeight });
    }
    function bindBody() {
      const root = rootRef.value;
      if (!root) return;
      const next = root.querySelector(".ant-table-body");
      if (next === bodyEl) return;
      if (bodyEl) bodyEl.removeEventListener("scroll", onBodyScroll);
      bodyEl = next;
      if (bodyEl) {
        bodyEl.addEventListener("scroll", onBodyScroll, { passive: true });
        bodyHeight.value = bodyEl.clientHeight || bodyHeight.value;
        if (restoreScroll) {
          bodyEl.scrollTop = scrollTop.value;
          restoreScroll = false;
        }
      }
    }
    function unbindBody() {
      if (bodyEl) {
        bodyEl.removeEventListener("scroll", onBodyScroll);
        bodyEl = null;
      }
    }
    watch(
      () => [virtEnabled.value, totalRows.value, props.rowHeight, props.scroll?.y],
      () => {
        if (!virtEnabled.value) {
          scrollTop.value = 0;
          return;
        }
        const maxScroll = Math.max(0, range.value.totalHeight - viewportH.value);
        if (scrollTop.value > maxScroll) scrollTop.value = maxScroll;
        void nextTick(() => {
          restoreScroll = true;
          bindBody();
          if (bodyEl) bodyEl.scrollTop = scrollTop.value;
        });
      }
    );
    watch(windowedData, () => {
      restoreScroll = true;
      void nextTick(() => {
        bindBody();
        if (bodyEl) bodyEl.scrollTop = scrollTop.value;
      });
    });
    onMounted(() => {
      void nextTick(() => bindBody());
    });
    onUpdated(() => {
      bindBody();
    });
    onBeforeUnmount(() => unbindBody());
    __expose({
      /** Test / debug helpers */
      getVisibleRange: () => range.value,
      getScrollTop: () => scrollTop.value,
      setScrollTop: (v) => {
        scrollTop.value = Math.max(0, v);
        if (bodyEl) bodyEl.scrollTop = scrollTop.value;
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "rootRef",
        ref: rootRef,
        class: "g-table",
        "data-testid": __props.testId || "g-table",
        "data-virtualized": String(virtEnabled.value),
        "data-row-count": String(totalRows.value),
        "data-row-height": String(__props.rowHeight || unref(GTABLE_VIRT).DEFAULT_ROW_HEIGHT),
        "data-window-start": String(range.value.start),
        "data-window-count": String(range.value.windowCount)
      }, [
        createVNode(unref(Table), {
          columns: columnsResolved.value,
          "data-source": windowedData.value,
          loading: __props.loading,
          pagination: paginationOpt.value,
          size: __props.size,
          bordered: __props.bordered,
          "show-header": __props.showHeader,
          scroll: scrollOpt.value,
          "row-class-name": mergedRowClassName,
          "custom-row": mergedCustomRow,
          "row-key": __props.rowKey,
          expandable: expandableOpt.value,
          onChange: onTableChange
        }, createSlots({
          _: 2
          /* DYNAMIC */
        }, [
          _ctx.$slots.footer ? {
            name: "footer",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "footer", {}, void 0, true)
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["columns", "data-source", "loading", "pagination", "size", "bordered", "show-header", "scroll", "row-class-name", "custom-row", "row-key", "expandable", "onChange"])
      ], 8, _hoisted_1$p$1);
    };
  }
});
const GTable = /* @__PURE__ */ _export_sfc$2(_sfc_main$x$1, [["__scopeId", "data-v-9ea40f72"]]);
const _hoisted_1$o$1 = ["data-testid"];
const _sfc_main$w$1 = /* @__PURE__ */ defineComponent({
  __name: "GQueryExpressionEditor",
  props: {
    modelValue: { default: "" },
    placeholder: { default: "" },
    readOnly: { type: Boolean, default: false },
    disabled: { type: Boolean, default: false },
    runOnEnter: { type: Boolean, default: false },
    completionSource: {},
    testId: {},
    invalid: { type: Boolean, default: false },
    chipPattern: { default: null },
    chipValidate: { type: [Function, null], default: null },
    embedded: { type: Boolean, default: false },
    fontSize: { default: 12 },
    ariaLabel: { default: "" }
  },
  emits: ["update:modelValue", "change", "run", "focus", "blur"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const host = ref(null);
    let view = null;
    let applyingExternal = false;
    const heightStyle = computed(() => ({
      minHeight: props.embedded ? "20px" : "28px"
    }));
    watch(
      () => [props.embedded, props.fontSize, props.chipPattern, props.placeholder],
      () => {
        mountEditor();
      }
    );
    function currentCompletionSource() {
      return props.completionSource;
    }
    function buildChipPlugin() {
      const pattern = props.chipPattern;
      if (!pattern) return null;
      const chipMark = Decoration.mark({ class: "gqe-chip" });
      const fnMark = Decoration.mark({ class: "gqe-fn-name" });
      return ViewPlugin.fromClass(
        class {
          decorations;
          constructor(view2) {
            this.decorations = this._build(view2);
          }
          update(u) {
            if (u.docChanged || u.viewportChanged) {
              this.decorations = this._build(u.view);
            }
          }
          _build(view2) {
            const builder = new RangeSetBuilder();
            const re = new RegExp(
              pattern.source,
              pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`
            );
            const ranges = [];
            for (const { from, to } of view2.visibleRanges) {
              const text = view2.state.doc.sliceString(from, to);
              re.lastIndex = 0;
              let m;
              while ((m = re.exec(text)) !== null) {
                const matched = m[0];
                const groups = m.slice(1);
                if (props.chipValidate && !props.chipValidate(matched, groups)) {
                  continue;
                }
                const start = from + m.index;
                const end = start + matched.length;
                ranges.push({ from: start, to: end, mark: chipMark });
                if (groups[0]) {
                  const fnStart = start + matched.indexOf(groups[0]);
                  const fnEnd = fnStart + groups[0].length;
                  if (fnStart >= start && fnEnd <= end) {
                    ranges.push({ from: fnStart, to: fnEnd, mark: fnMark });
                  }
                }
              }
            }
            ranges.sort((a, b) => a.from - b.from || a.to - b.to);
            for (const r of ranges) builder.add(r.from, r.to, r.mark);
            return builder.finish();
          }
        },
        { decorations: (v) => v.decorations }
      );
    }
    function buildExtensions() {
      const extensions = [
        history(),
        EditorView.lineWrapping,
        EditorView.contentAttributes.of({
          "aria-label": props.ariaLabel || props.placeholder || "Query expression editor"
        }),
        EditorState.transactionFilter.of((tr) => {
          if (!tr.docChanged) return tr;
          let ok2 = true;
          tr.changes.iterChanges((_fromA, _toA, _fromB, _toB, inserted) => {
            if (inserted.toString().includes("\n")) ok2 = false;
          });
          if (!ok2) {
            return {
              changes: {
                from: 0,
                to: tr.startState.doc.length,
                insert: tr.newDoc.toString().replaceAll("\n", " ")
              },
              selection: tr.selection
            };
          }
          return tr;
        }),
        EditorView.updateListener.of((update) => {
          if (!update.docChanged || applyingExternal) return;
          const text = update.state.doc.toString();
          emit("update:modelValue", text);
          emit("change", text);
        }),
        EditorView.domEventHandlers({
          focus: () => {
            emit("focus");
            return false;
          },
          blur: () => {
            emit("blur");
            return false;
          }
        }),
        EditorView.theme({
          "&": {
            fontSize: `${props.fontSize || 12}px`,
            backgroundColor: props.embedded ? "transparent" : "var(--grafana-input-bg)",
            color: "var(--grafana-text)",
            border: props.embedded ? "0" : "1px solid var(--grafana-border-color-medium)",
            borderRadius: props.embedded ? "0" : "2px"
          },
          "&.cm-focused": {
            outline: props.embedded ? "none" : "1px solid var(--grafana-primary)",
            outlineOffset: "0"
          },
          ".cm-content": {
            padding: props.embedded ? "8px 10px" : "4px 8px",
            fontFamily: "SFMono-Regular, Consolas, Monaco, monospace",
            caretColor: props.embedded ? "var(--grafana-primary)" : "var(--grafana-text)",
            lineHeight: "20px",
            minHeight: "20px"
          },
          ".cm-line": { padding: "0" },
          ".cm-activeLine": { backgroundColor: "transparent" },
          ".cm-placeholder": {
            color: "var(--grafana-text-secondary)",
            fontFamily: "Inter, Helvetica Neue, Arial, sans-serif"
          },
          ".cm-scroller": {
            overflow: "hidden",
            fontFamily: "inherit"
          },
          ".cm-tooltip-autocomplete": {
            backgroundColor: "var(--grafana-bg-elevated)",
            border: "1px solid var(--grafana-border-color-medium)",
            color: "var(--grafana-text)"
          },
          ".cm-tooltip-autocomplete ul li[aria-selected]": {
            backgroundColor: "var(--grafana-hover)"
          },
          ".gqe-chip": {
            background: "var(--grafana-primary-transparent)",
            color: "var(--grafana-text)",
            borderRadius: "3px",
            padding: "1px 4px",
            marginRight: "4px"
          },
          ".gqe-fn-name": {
            color: "var(--grafana-primary)"
          }
        }),
        keymap.of([
          ...completionKeymap,
          ...historyKeymap,
          ...defaultKeymap.filter((k) => {
            const key = k.key;
            return key !== "Enter" && key !== "Shift-Enter";
          })
        ]),
        Prec.highest(
          keymap.of([
            {
              key: "Enter",
              run: (v) => {
                startCompletion(v);
                if (props.runOnEnter) {
                  emit("run");
                  return true;
                }
                return true;
              }
            },
            {
              key: "Shift-Enter",
              run: () => {
                return true;
              }
            },
            {
              key: "Escape",
              run: (v) => {
                closeCompletion(v);
                return true;
              }
            }
          ])
        ),
        autocompletion({
          override: [
            async (context) => {
              const src = currentCompletionSource();
              if (!src) return null;
              return src(context);
            }
          ],
          activateOnTyping: true,
          maxRenderedOptions: 50
        })
      ];
      if (props.placeholder) {
        extensions.push(placeholder(props.placeholder));
      }
      if (props.readOnly || props.disabled) {
        extensions.push(EditorState.readOnly.of(true));
      }
      const chip = buildChipPlugin();
      if (chip) extensions.push(chip);
      return extensions;
    }
    function mountEditor() {
      if (!host.value) return;
      view?.destroy();
      const state2 = EditorState.create({
        doc: props.modelValue || "",
        extensions: buildExtensions()
      });
      view = new EditorView({
        state: state2,
        parent: host.value
      });
    }
    function setDoc(text) {
      if (!view) return;
      const cur = view.state.doc.toString();
      if (cur === text) return;
      applyingExternal = true;
      view.dispatch({
        changes: { from: 0, to: cur.length, insert: text }
      });
      applyingExternal = false;
    }
    onMounted(() => {
      mountEditor();
    });
    onBeforeUnmount(() => {
      view?.destroy();
      view = null;
    });
    watch(
      () => props.modelValue,
      (v) => setDoc(v || "")
    );
    watch(
      () => [
        props.placeholder,
        props.readOnly,
        props.disabled,
        props.runOnEnter,
        props.chipPattern,
        props.chipValidate
      ],
      () => {
        mountEditor();
      }
    );
    __expose({
      focus: () => view?.focus(),
      getView: () => view,
      startCompletion: () => view && startCompletion(view),
      closeCompletion: () => view && closeCompletion(view)
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["g-query-expression-editor", {
          "g-query-expression-editor--invalid": __props.invalid,
          "g-query-expression-editor--disabled": __props.disabled
        }]),
        "data-testid": __props.testId,
        style: normalizeStyle(heightStyle.value)
      }, [
        createElementVNode(
          "div",
          {
            ref_key: "host",
            ref: host,
            class: "g-query-expression-editor__host"
          },
          null,
          512
          /* NEED_PATCH */
        )
      ], 14, _hoisted_1$o$1);
    };
  }
});
const GQueryExpressionEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$w$1, [["__scopeId", "data-v-7db16d78"]]);
const UNIT_CATEGORIES = [
  {
    name: "Misc",
    formats: [
      {
        label: "Number",
        value: "none"
      },
      {
        label: "String",
        value: "string"
      },
      {
        label: "short",
        value: "short"
      },
      {
        label: "SI short",
        value: "sishort"
      },
      {
        label: "Percent (0-100)",
        value: "percent"
      },
      {
        label: "Percent (0.0-1.0)",
        value: "percentunit"
      },
      {
        label: "Humidity (%H)",
        value: "humidity"
      },
      {
        label: "Decibel",
        value: "dB"
      },
      {
        label: "Candela (cd)",
        value: "candela"
      },
      {
        label: "Hexadecimal (0x)",
        value: "hex0x"
      },
      {
        label: "Hexadecimal",
        value: "hex"
      },
      {
        label: "Scientific notation",
        value: "sci"
      },
      {
        label: "Locale format",
        value: "locale"
      },
      {
        label: "Pixels",
        value: "pixel"
      }
    ]
  },
  {
    name: "Acceleration",
    formats: [
      {
        label: "Meters/sec²",
        value: "accMS2"
      },
      {
        label: "Feet/sec²",
        value: "accFS2"
      },
      {
        label: "G unit",
        value: "accG"
      }
    ]
  },
  {
    name: "Angle",
    formats: [
      {
        label: "Degrees (°)",
        value: "degree"
      },
      {
        label: "Radians",
        value: "radian"
      },
      {
        label: "Gradian",
        value: "grad"
      },
      {
        label: "Arc Minutes",
        value: "arcmin"
      },
      {
        label: "Arc Seconds",
        value: "arcsec"
      }
    ]
  },
  {
    name: "Area",
    formats: [
      {
        label: "Square Meters (m²)",
        value: "areaM2"
      },
      {
        label: "Square Feet (ft²)",
        value: "areaF2"
      },
      {
        label: "Square Miles (mi²)",
        value: "areaMI2"
      },
      {
        label: "Acres (ac)",
        value: "acres"
      },
      {
        label: "Hectares (ha)",
        value: "hectares"
      }
    ]
  },
  {
    name: "Computation",
    formats: [
      {
        label: "FLOP/s",
        value: "flops"
      },
      {
        label: "MFLOP/s",
        value: "mflops"
      },
      {
        label: "GFLOP/s",
        value: "gflops"
      },
      {
        label: "TFLOP/s",
        value: "tflops"
      },
      {
        label: "PFLOP/s",
        value: "pflops"
      },
      {
        label: "EFLOP/s",
        value: "eflops"
      },
      {
        label: "ZFLOP/s",
        value: "zflops"
      },
      {
        label: "YFLOP/s",
        value: "yflops"
      }
    ]
  },
  {
    name: "Concentration",
    formats: [
      {
        label: "parts-per-million (ppm)",
        value: "ppm"
      },
      {
        label: "parts-per-billion (ppb)",
        value: "conppb"
      },
      {
        label: "gram per cubic meter (g/m³)",
        value: "congm3"
      }
    ]
  },
  {
    name: "Currency",
    formats: [
      {
        label: "Dollars ($)",
        value: "currencyUSD"
      },
      {
        label: "Pounds (£)",
        value: "currencyGBP"
      },
      {
        label: "Euro (€)",
        value: "currencyEUR"
      },
      {
        label: "Yen (¥)",
        value: "currencyJPY"
      },
      {
        label: "Rubles (₽)",
        value: "currencyRUB"
      },
      {
        label: "Hryvnias (₴)",
        value: "currencyUAH"
      },
      {
        label: "Real (R$)",
        value: "currencyBRL"
      },
      {
        label: "Danish Krone (kr)",
        value: "currencyDKK"
      },
      {
        label: "Icelandic Króna (kr)",
        value: "currencyISK"
      },
      {
        label: "Norwegian Krone (kr)",
        value: "currencyNOK"
      },
      {
        label: "Swedish Krona (kr)",
        value: "currencySEK"
      },
      {
        label: "Czech koruna (czk)",
        value: "currencyCZK"
      },
      {
        label: "Swiss franc (CHF)",
        value: "currencyCHF"
      },
      {
        label: "Polish Złoty (PLN)",
        value: "currencyPLN"
      },
      {
        label: "Bitcoin (฿)",
        value: "currencyBTC"
      },
      {
        label: "Milli Bitcoin (฿)",
        value: "currencymBTC"
      },
      {
        label: "Micro Bitcoin (฿)",
        value: "currencyμBTC"
      },
      {
        label: "South African Rand (R)",
        value: "currencyZAR"
      },
      {
        label: "Indian Rupee (₹)",
        value: "currencyINR"
      },
      {
        label: "South Korean Won (₩)",
        value: "currencyKRW"
      },
      {
        label: "Indonesian Rupiah (Rp)",
        value: "currencyIDR"
      },
      {
        label: "Philippine Peso (PHP)",
        value: "currencyPHP"
      },
      {
        label: "Vietnamese Dong (VND)",
        value: "currencyVND"
      },
      {
        label: "Turkish Lira (₺)",
        value: "currencyTRY"
      },
      {
        label: "Malaysian Ringgit (RM)",
        value: "currencyMYR"
      },
      {
        label: "CFP franc (XPF)",
        value: "currencyXPF"
      },
      {
        label: "Bulgarian Lev (BGN)",
        value: "currencyBGN"
      },
      {
        label: "Guaraní (₲)",
        value: "currencyPYG"
      },
      {
        label: "Uruguay Peso (UYU)",
        value: "currencyUYU"
      },
      {
        label: "Israeli New Shekels (₪)",
        value: "currencyILS"
      }
    ]
  },
  {
    name: "Data",
    formats: [
      {
        label: "bytes(IEC)",
        value: "bytes"
      },
      {
        label: "bytes(SI)",
        value: "decbytes"
      },
      {
        label: "bits(IEC)",
        value: "bits"
      },
      {
        label: "bits(SI)",
        value: "decbits"
      },
      {
        label: "kibibytes",
        value: "kbytes"
      },
      {
        label: "kilobytes",
        value: "deckbytes"
      },
      {
        label: "mebibytes",
        value: "mbytes"
      },
      {
        label: "megabytes",
        value: "decmbytes"
      },
      {
        label: "gibibytes",
        value: "gbytes"
      },
      {
        label: "gigabytes",
        value: "decgbytes"
      },
      {
        label: "tebibytes",
        value: "tbytes"
      },
      {
        label: "terabytes",
        value: "dectbytes"
      },
      {
        label: "pebibytes",
        value: "pbytes"
      },
      {
        label: "petabytes",
        value: "decpbytes"
      }
    ]
  },
  {
    name: "Data rate",
    formats: [
      {
        label: "packets/sec",
        value: "pps"
      },
      {
        label: "bytes/sec(IEC)",
        value: "binBps"
      },
      {
        label: "bytes/sec(SI)",
        value: "Bps"
      },
      {
        label: "bits/sec(IEC)",
        value: "binbps"
      },
      {
        label: "bits/sec(SI)",
        value: "bps"
      },
      {
        label: "kibibytes/sec",
        value: "KiBs"
      },
      {
        label: "kibibits/sec",
        value: "Kibits"
      },
      {
        label: "kilobytes/sec",
        value: "KBs"
      },
      {
        label: "kilobits/sec",
        value: "Kbits"
      },
      {
        label: "mebibytes/sec",
        value: "MiBs"
      },
      {
        label: "mebibits/sec",
        value: "Mibits"
      },
      {
        label: "megabytes/sec",
        value: "MBs"
      },
      {
        label: "megabits/sec",
        value: "Mbits"
      },
      {
        label: "gibibytes/sec",
        value: "GiBs"
      },
      {
        label: "gibibits/sec",
        value: "Gibits"
      },
      {
        label: "gigabytes/sec",
        value: "GBs"
      },
      {
        label: "gigabits/sec",
        value: "Gbits"
      },
      {
        label: "tebibytes/sec",
        value: "TiBs"
      },
      {
        label: "tebibits/sec",
        value: "Tibits"
      },
      {
        label: "terabytes/sec",
        value: "TBs"
      },
      {
        label: "terabits/sec",
        value: "Tbits"
      },
      {
        label: "pebibytes/sec",
        value: "PiBs"
      },
      {
        label: "pebibits/sec",
        value: "Pibits"
      },
      {
        label: "petabytes/sec",
        value: "PBs"
      },
      {
        label: "petabits/sec",
        value: "Pbits"
      }
    ]
  },
  {
    name: "Date & time",
    formats: [
      {
        label: "Datetime ISO",
        value: "dateTimeAsIso"
      },
      {
        label: "Datetime US",
        value: "dateTimeAsUS"
      },
      {
        label: "Datetime local",
        value: "dateTimeAsLocal"
      },
      {
        label: "Datetime default",
        value: "dateTimeAsSystem"
      },
      {
        label: "From Now",
        value: "dateTimeFromNow"
      }
    ]
  },
  {
    name: "Energy",
    formats: [
      {
        label: "Watt (W)",
        value: "watt"
      },
      {
        label: "Kilowatt (kW)",
        value: "kwatt"
      },
      {
        label: "Megawatt (MW)",
        value: "megwatt"
      },
      {
        label: "Gigawatt (GW)",
        value: "gwatt"
      },
      {
        label: "Milliwatt (mW)",
        value: "mwatt"
      },
      {
        label: "Volt-Ampere (VA)",
        value: "voltamp"
      },
      {
        label: "Kilovolt-Ampere (kVA)",
        value: "kvoltamp"
      },
      {
        label: "Watt-hour (Wh)",
        value: "watth"
      },
      {
        label: "Kilowatt-hour (kWh)",
        value: "kwatth"
      },
      {
        label: "Kilowatt-min (kWm)",
        value: "kwattm"
      },
      {
        label: "Megawatt-hour (MWh)",
        value: "mwatth"
      },
      {
        label: "Ampere-hour (Ah)",
        value: "amph"
      },
      {
        label: "Kiloampere-hour (kAh)",
        value: "kamph"
      },
      {
        label: "Milliampere-hour (mAh)",
        value: "mamph"
      },
      {
        label: "Joule (J)",
        value: "joule"
      },
      {
        label: "Electron volt (eV)",
        value: "ev"
      },
      {
        label: "Ampere (A)",
        value: "amp"
      },
      {
        label: "Kiloampere (kA)",
        value: "kamp"
      },
      {
        label: "Milliampere (mA)",
        value: "mamp"
      },
      {
        label: "Volt (V)",
        value: "volt"
      },
      {
        label: "Kilovolt (kV)",
        value: "kvolt"
      },
      {
        label: "Millivolt (mV)",
        value: "mvolt"
      },
      {
        label: "Milliohm (mΩ)",
        value: "mohm"
      },
      {
        label: "Ohm (Ω)",
        value: "ohm"
      },
      {
        label: "Kiloohm (kΩ)",
        value: "kohm"
      },
      {
        label: "Megaohm (MΩ)",
        value: "Mohm"
      },
      {
        label: "Farad (F)",
        value: "farad"
      },
      {
        label: "Microfarad (µF)",
        value: "µfarad"
      },
      {
        label: "Nanofarad (nF)",
        value: "nfarad"
      },
      {
        label: "Picofarad (pF)",
        value: "pfarad"
      },
      {
        label: "Femtofarad (fF)",
        value: "ffarad"
      },
      {
        label: "Henry (H)",
        value: "henry"
      },
      {
        label: "Millihenry (mH)",
        value: "mhenry"
      },
      {
        label: "Microhenry (µH)",
        value: "µhenry"
      },
      {
        label: "Lumens (Lm)",
        value: "lumens"
      }
    ]
  },
  {
    name: "Flow",
    formats: [
      {
        label: "Gallons/min (gpm)",
        value: "flowgpm"
      },
      {
        label: "Cubic meters/sec (cms)",
        value: "flowcms"
      },
      {
        label: "Cubic feet/sec (cfs)",
        value: "flowcfs"
      },
      {
        label: "Cubic feet/min (cfm)",
        value: "flowcfm"
      },
      {
        label: "Litre/hour",
        value: "litreh"
      },
      {
        label: "Litre/min (L/min)",
        value: "flowlpm"
      },
      {
        label: "milliLitre/min (mL/min)",
        value: "flowmlpm"
      },
      {
        label: "Lux (lx)",
        value: "lux"
      }
    ]
  },
  {
    name: "Force",
    formats: [
      {
        label: "Newton-meters (Nm)",
        value: "forceNm"
      },
      {
        label: "Kilonewton-meters (kNm)",
        value: "forcekNm"
      },
      {
        label: "Newtons (N)",
        value: "forceN"
      },
      {
        label: "Kilonewtons (kN)",
        value: "forcekN"
      }
    ]
  },
  {
    name: "Hash rate",
    formats: [
      {
        label: "hashes/sec",
        value: "Hs"
      },
      {
        label: "kilohashes/sec",
        value: "KHs"
      },
      {
        label: "megahashes/sec",
        value: "MHs"
      },
      {
        label: "gigahashes/sec",
        value: "GHs"
      },
      {
        label: "terahashes/sec",
        value: "THs"
      },
      {
        label: "petahashes/sec",
        value: "PHs"
      },
      {
        label: "exahashes/sec",
        value: "EHs"
      }
    ]
  },
  {
    name: "Mass",
    formats: [
      {
        label: "milligram (mg)",
        value: "massmg"
      },
      {
        label: "gram (g)",
        value: "massg"
      },
      {
        label: "pound (lb)",
        value: "masslb"
      },
      {
        label: "kilogram (kg)",
        value: "masskg"
      },
      {
        label: "metric ton (t)",
        value: "masst"
      }
    ]
  },
  {
    name: "Length",
    formats: [
      {
        label: "millimeter (mm)",
        value: "lengthmm"
      },
      {
        label: "centimeter (cm)",
        value: "lengthcm"
      },
      {
        label: "inch (in)",
        value: "lengthin"
      },
      {
        label: "feet (ft)",
        value: "lengthft"
      },
      {
        label: "meter (m)",
        value: "lengthm"
      },
      {
        label: "kilometer (km)",
        value: "lengthkm"
      },
      {
        label: "mile (mi)",
        value: "lengthmi"
      }
    ]
  },
  {
    name: "Pressure",
    formats: [
      {
        label: "Millibars",
        value: "pressurembar"
      },
      {
        label: "Bars",
        value: "pressurebar"
      },
      {
        label: "Kilobars",
        value: "pressurekbar"
      },
      {
        label: "Pascals",
        value: "pressurepa"
      },
      {
        label: "Hectopascals",
        value: "pressurehpa"
      },
      {
        label: "Kilopascals",
        value: "pressurekpa"
      },
      {
        label: "Inches of mercury",
        value: "pressurehg"
      },
      {
        label: "PSI",
        value: "pressurepsi"
      }
    ]
  },
  {
    name: "Radiation",
    formats: [
      {
        label: "Becquerel (Bq)",
        value: "radbq"
      },
      {
        label: "curie (Ci)",
        value: "radci"
      },
      {
        label: "Gray (Gy)",
        value: "radgy"
      },
      {
        label: "rad",
        value: "radrad"
      },
      {
        label: "Sievert (Sv)",
        value: "radsv"
      },
      {
        label: "milliSievert (mSv)",
        value: "radmsv"
      },
      {
        label: "microSievert (µSv)",
        value: "radusv"
      },
      {
        label: "rem",
        value: "radrem"
      },
      {
        label: "Exposure (C/kg)",
        value: "radexpckg"
      },
      {
        label: "roentgen (R)",
        value: "radr"
      },
      {
        label: "Sievert/hour (Sv/h)",
        value: "radsvh"
      }
    ]
  },
  {
    name: "Rotational Speed",
    formats: [
      {
        label: "Hertz (Hz)",
        value: "rothz"
      },
      {
        label: "Kilohertz (kHz)",
        value: "rotkhz"
      },
      {
        label: "Megahertz (MHz)",
        value: "rotmhz"
      },
      {
        label: "Gigahertz (GHz)",
        value: "rotghz"
      }
    ]
  },
  {
    name: "Temperature",
    formats: [
      {
        label: "Celsius (°C)",
        value: "celsius"
      },
      {
        label: "Fahrenheit (°F)",
        value: "fahrenheit"
      },
      {
        label: "Kelvin (K)",
        value: "kelvin"
      }
    ]
  },
  {
    name: "Time",
    formats: [
      {
        label: "Hertz (1/s)",
        value: "hertz"
      },
      {
        label: "nanoseconds (ns)",
        value: "ns"
      },
      {
        label: "microseconds (µs)",
        value: "µs"
      },
      {
        label: "milliseconds (ms)",
        value: "ms"
      },
      {
        label: "seconds (s)",
        value: "s"
      },
      {
        label: "minutes (m)",
        value: "m"
      },
      {
        label: "hours (h)",
        value: "h"
      },
      {
        label: "days (d)",
        value: "d"
      },
      {
        label: "duration (ms)",
        value: "dtdurationms"
      },
      {
        label: "duration (s)",
        value: "dtdurations"
      },
      {
        label: "duration (hh:mm:ss)",
        value: "dthms"
      },
      {
        label: "duration (d hh:mm:ss)",
        value: "dtdhms"
      },
      {
        label: "Timeticks (s/100)",
        value: "timeticks"
      },
      {
        label: "clock (ms)",
        value: "clockms"
      },
      {
        label: "clock (s)",
        value: "clocks"
      }
    ]
  },
  {
    name: "Throughput",
    formats: [
      {
        label: "counts/sec (cps)",
        value: "cps"
      },
      {
        label: "ops/sec (ops)",
        value: "ops"
      },
      {
        label: "requests/sec (rps)",
        value: "reqps"
      },
      {
        label: "reads/sec (rps)",
        value: "rps"
      },
      {
        label: "writes/sec (wps)",
        value: "wps"
      },
      {
        label: "I/O ops/sec (iops)",
        value: "iops"
      },
      {
        label: "events/sec (eps)",
        value: "eps"
      },
      {
        label: "messages/sec (mps)",
        value: "mps"
      },
      {
        label: "records/sec (rps)",
        value: "recps"
      },
      {
        label: "rows/sec (rps)",
        value: "rowsps"
      },
      {
        label: "counts/min (cpm)",
        value: "cpm"
      },
      {
        label: "ops/min (opm)",
        value: "opm"
      },
      {
        label: "requests/min (rpm)",
        value: "reqpm"
      },
      {
        label: "reads/min (rpm)",
        value: "rpm"
      },
      {
        label: "writes/min (wpm)",
        value: "wpm"
      },
      {
        label: "events/min (epm)",
        value: "epm"
      },
      {
        label: "messages/min (mpm)",
        value: "mpm"
      },
      {
        label: "records/min (rpm)",
        value: "recpm"
      },
      {
        label: "rows/min (rpm)",
        value: "rowspm"
      }
    ]
  },
  {
    name: "Velocity",
    formats: [
      {
        label: "meters/second (m/s)",
        value: "velocityms"
      },
      {
        label: "kilometers/hour (km/h)",
        value: "velocitykmh"
      },
      {
        label: "miles/hour (mph)",
        value: "velocitymph"
      },
      {
        label: "knot (kn)",
        value: "velocityknot"
      }
    ]
  },
  {
    name: "Volume",
    formats: [
      {
        label: "millilitre (mL)",
        value: "mlitre"
      },
      {
        label: "litre (L)",
        value: "litre"
      },
      {
        label: "cubic meter",
        value: "m3"
      },
      {
        label: "Normal cubic meter",
        value: "Nm3"
      },
      {
        label: "cubic decimeter",
        value: "dm3"
      },
      {
        label: "gallons",
        value: "gallons"
      }
    ]
  },
  {
    name: "Boolean",
    formats: [
      {
        label: "True / False",
        value: "bool"
      },
      {
        label: "Yes / No",
        value: "bool_yes_no"
      },
      {
        label: "On / Off",
        value: "bool_on_off"
      }
    ]
  }
];
function flattenUnits() {
  const out = [{ label: "默认", value: "" }];
  for (const c of UNIT_CATEGORIES) {
    for (const f of c.formats) out.push({ label: `${c.name} / ${f.label}`, value: f.value });
  }
  return out;
}
const _sfc_main$v$1 = /* @__PURE__ */ defineComponent({
  __name: "UnitPicker",
  props: {
    modelValue: {},
    clearable: { type: Boolean }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => {
      const groups = [
        {
          label: "常用",
          options: [
            { label: "默认", value: "" },
            { label: "无", value: "none" },
            { label: "短格式", value: "short" },
            { label: "百分比 (0-100)", value: "percent" },
            { label: "百分比 (0-1)", value: "percentunit" }
          ]
        }
      ];
      for (const c of UNIT_CATEGORIES) {
        groups.push({
          label: c.name,
          options: c.formats.map((f) => ({ label: f.label, value: f.value }))
        });
      }
      return groups;
    });
    const value = computed(() => props.modelValue ?? "");
    function onChange(v) {
      if (v == null || v === "") emit("update:modelValue", props.clearable ? void 0 : "");
      else emit("update:modelValue", String(v));
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GSelect, {
        class: "unit-picker",
        "test-id": "unit-picker",
        value: value.value,
        options: options.value,
        "show-search": true,
        "allow-clear": "",
        placeholder: "选择单位",
        onChange
      }, null, 8, ["value", "options"]);
    };
  }
});
const UnitPicker = /* @__PURE__ */ _export_sfc$2(_sfc_main$v$1, [["__scopeId", "data-v-6bae9ba2"]]);
const _hoisted_1$n$1 = {
  class: "color-picker",
  "data-testid": "color-picker"
};
const _hoisted_2$e$1 = ["value"];
const _sfc_main$u$1 = /* @__PURE__ */ defineComponent({
  __name: "ColorPicker",
  props: {
    modelValue: {},
    fieldMode: { type: Boolean }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const NAMED = [
      { label: "绿", value: "green" },
      { label: "红", value: "red" },
      { label: "蓝", value: "blue" },
      { label: "橙", value: "orange" },
      { label: "黄", value: "yellow" },
      { label: "紫", value: "purple" },
      { label: "半深蓝", value: "semi-dark-blue" },
      { label: "亮蓝", value: "light-blue" },
      { label: "超亮蓝", value: "super-light-blue" },
      { label: "深橙", value: "dark-orange" },
      { label: "文本", value: "text" }
    ];
    const hex = computed(() => {
      const v = props.modelValue;
      if (!v) return "#73BF69";
      if (typeof v === "string") {
        if (v.startsWith("#")) return v;
        return "#73BF69";
      }
      return v.fixedColor?.startsWith("#") ? v.fixedColor : "#73BF69";
    });
    const named = computed(() => {
      const v = props.modelValue;
      if (typeof v === "string" && !v.startsWith("#")) return v;
      return "";
    });
    function setHex(c) {
      emit("update:modelValue", c);
    }
    function setNamed(n) {
      if (n == null || n === "") return;
      emit("update:modelValue", String(n));
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$n$1, [
        createElementVNode("input", {
          type: "color",
          class: "swatch",
          value: hex.value,
          onInput: _cache[0] || (_cache[0] = ($event) => setHex($event.target.value))
        }, null, 40, _hoisted_2$e$1),
        createVNode(GSelect, {
          class: "named",
          value: named.value,
          options: NAMED,
          "allow-clear": "",
          placeholder: "命名色 / 自定义",
          "show-search": true,
          onChange: setNamed
        }, null, 8, ["value"])
      ]);
    };
  }
});
const ColorPicker = /* @__PURE__ */ _export_sfc$2(_sfc_main$u$1, [["__scopeId", "data-v-54871f9c"]]);
const _hoisted_1$m$1 = {
  class: "field-color",
  "data-testid": "field-color-editor"
};
const _hoisted_2$d$1 = {
  key: 0,
  class: "fixed-row"
};
const _hoisted_3$8$1 = ["value"];
const _hoisted_4$4$1 = { class: "hint" };
const _hoisted_5$3$1 = {
  key: 1,
  class: "series-by"
};
const _sfc_main$t$1 = /* @__PURE__ */ defineComponent({
  __name: "FieldColorEditor",
  props: {
    modelValue: {},
    byValueSupport: { type: Boolean }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const MODE_GROUPS = [
      {
        label: "单色",
        options: [
          { label: "单色", value: "fixed" },
          { label: "色阶", value: "shades" }
        ]
      },
      {
        label: "按序列",
        options: [
          { label: "经典色板", value: "palette-classic" },
          { label: "经典色板（按名）", value: "palette-classic-by-name" },
          { label: "色盲安全", value: "palette-colorblind" }
        ]
      },
      {
        label: "按值",
        options: [
          { label: "来自阈值", value: "thresholds" },
          { label: "绿-黄-红", value: "continuous-GrYlRd" },
          { label: "红-黄-绿", value: "continuous-RdYlGr" },
          { label: "蓝-黄-红", value: "continuous-BlYlRd" },
          { label: "黄-红", value: "continuous-YlRd" },
          { label: "蓝-紫", value: "continuous-BlPu" },
          { label: "黄-蓝", value: "continuous-YlBl" },
          { label: "蓝色系", value: "continuous-blues" },
          { label: "红色系", value: "continuous-reds" },
          { label: "绿色系", value: "continuous-greens" },
          { label: "紫色系", value: "continuous-purples" },
          { label: "Viridis", value: "continuous-viridis" },
          { label: "Magma", value: "continuous-magma" },
          { label: "Plasma", value: "continuous-plasma" },
          { label: "Inferno", value: "continuous-inferno" },
          { label: "Cividis", value: "continuous-cividis" }
        ]
      }
    ];
    const value = computed(() => {
      const v = props.modelValue;
      if (!v) return { mode: "palette-classic" };
      if (typeof v === "string") return { mode: "fixed", fixedColor: v };
      return { mode: "palette-classic", ...v };
    });
    const mode2 = computed(() => value.value.mode ?? "palette-classic");
    const needsFixed = computed(
      () => mode2.value === "fixed" || mode2.value === "shades" || mode2.value === "gradient"
    );
    const isByValue = computed(
      () => mode2.value === "thresholds" || String(mode2.value).startsWith("continuous-")
    );
    function setMode(m) {
      emit("update:modelValue", { ...value.value, mode: String(m) });
    }
    function setFixed(c) {
      emit("update:modelValue", {
        ...value.value,
        mode: mode2.value || "fixed",
        fixedColor: c
      });
    }
    function setSeriesBy(s) {
      emit("update:modelValue", { ...value.value, seriesBy: s });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$m$1, [
        createVNode(GSelect, {
          class: "mode",
          value: mode2.value,
          options: MODE_GROUPS,
          "show-search": true,
          placeholder: "配色方案",
          onChange: setMode
        }, null, 8, ["value", "options"]),
        needsFixed.value ? (openBlock(), createElementBlock("div", _hoisted_2$d$1, [
          createElementVNode("input", {
            type: "color",
            class: "swatch",
            "data-testid": "field-color-fixed",
            value: value.value.fixedColor || "#73BF69",
            onInput: _cache[0] || (_cache[0] = ($event) => setFixed($event.target.value))
          }, null, 40, _hoisted_3$8$1),
          createElementVNode(
            "span",
            _hoisted_4$4$1,
            toDisplayString(mode2.value === "shades" ? "基准色" : "固定色"),
            1
            /* TEXT */
          )
        ])) : createCommentVNode("v-if", true),
        isByValue.value ? (openBlock(), createElementBlock("div", _hoisted_5$3$1, [
          _cache[4] || (_cache[4] = createElementVNode(
            "span",
            { class: "hint" },
            "按值取色依据",
            -1
            /* CACHED */
          )),
          createVNode(unref(Radio).Group, {
            size: "small",
            "button-style": "solid",
            value: value.value.seriesBy || "last",
            "onUpdate:value": setSeriesBy
          }, {
            default: withCtx(() => [
              createVNode(unref(Radio).Button, { value: "last" }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    "Last",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }),
              createVNode(unref(Radio).Button, { value: "min" }, {
                default: withCtx(() => [..._cache[2] || (_cache[2] = [
                  createTextVNode(
                    "Min",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }),
              createVNode(unref(Radio).Button, { value: "max" }, {
                default: withCtx(() => [..._cache[3] || (_cache[3] = [
                  createTextVNode(
                    "Max",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ]),
            _: 1
            /* STABLE */
          }, 8, ["value"])
        ])) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const FieldColorEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$t$1, [["__scopeId", "data-v-4e6ed405"]]);
const _hoisted_1$l$1 = {
  class: "thresholds",
  "data-testid": "thresholds-editor"
};
const _hoisted_2$c$1 = { class: "row" };
const _hoisted_3$7$1 = ["value", "onInput"];
const _sfc_main$s$1 = /* @__PURE__ */ defineComponent({
  __name: "ThresholdsEditor",
  props: {
    modelValue: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const modeOptions = [
      { label: "绝对值", value: "absolute" },
      { label: "百分比", value: "percentage" }
    ];
    const value = computed(() => {
      const v = props.modelValue;
      if (v?.steps?.length) return v;
      return {
        mode: "absolute",
        steps: [
          { value: -Infinity, color: "green" },
          { value: 80, color: "red" }
        ]
      };
    });
    function emitNext(next) {
      emit("update:modelValue", next);
    }
    function setMode(mode2) {
      emitNext({ ...value.value, mode: String(mode2) });
    }
    function setStep(i, patch) {
      const steps = value.value.steps.map((s, idx) => idx === i ? { ...s, ...patch } : s);
      emitNext({ ...value.value, steps });
    }
    function addStep() {
      const last = value.value.steps[value.value.steps.length - 1];
      const nextVal = Number.isFinite(last?.value) ? last.value + 10 : 50;
      emitNext({
        ...value.value,
        steps: [...value.value.steps, { value: nextVal, color: "#EAB839" }]
      });
    }
    function removeStep(i) {
      if (i === 0) return;
      emitNext({
        ...value.value,
        steps: value.value.steps.filter((_, idx) => idx !== i)
      });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$l$1, [
        createElementVNode("div", _hoisted_2$c$1, [
          _cache[0] || (_cache[0] = createElementVNode(
            "label",
            null,
            "模式",
            -1
            /* CACHED */
          )),
          createVNode(GSelect, {
            value: value.value.mode,
            options: modeOptions,
            "show-search": false,
            onChange: setMode
          }, null, 8, ["value"])
        ]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(value.value.steps, (s, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "step"
            }, [
              createElementVNode("input", {
                type: "color",
                value: typeof s.color === "string" && s.color.startsWith("#") ? s.color : "#73BF69",
                onInput: ($event) => setStep(i, { color: $event.target.value })
              }, null, 40, _hoisted_3$7$1),
              createVNode(GInput, {
                type: "number",
                disabled: i === 0,
                value: i === 0 ? "" : s.value,
                placeholder: i === 0 ? "基准" : "数值",
                "onUpdate:value": ($event) => setStep(i, { value: Number($event) })
              }, null, 8, ["disabled", "value", "placeholder", "onUpdate:value"]),
              i > 0 ? (openBlock(), createBlock(GButton, {
                key: 0,
                size: "md",
                variant: "toolbar",
                onClick: ($event) => removeStep(i)
              }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    " × ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])) : createCommentVNode("v-if", true)
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(GButton, {
          size: "md",
          variant: "secondary",
          "test-id": "thresholds-add",
          onClick: addStep
        }, {
          default: withCtx(() => [..._cache[2] || (_cache[2] = [
            createTextVNode(
              " + 添加阈值 ",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ThresholdsEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$s$1, [["__scopeId", "data-v-8b5b6d20"]]);
const _hoisted_1$k$1 = {
  class: "mappings",
  "data-testid": "value-mappings-editor"
};
const _hoisted_2$b$1 = ["data-testid"];
const _hoisted_3$6$1 = ["value", "onInput"];
const _hoisted_4$3$1 = { class: "add-row" };
const _sfc_main$r$1 = /* @__PURE__ */ defineComponent({
  __name: "ValueMappingsEditor",
  props: {
    modelValue: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const kindOptions = [
      { label: "值", value: "value" },
      { label: "范围", value: "range" },
      { label: "正则", value: "regex" },
      { label: "特殊", value: "special" }
    ];
    const specialOptions = [
      { label: "空值 (null)", value: "null" },
      { label: "非数字 (NaN)", value: "nan" },
      { label: "空值 + NaN", value: "null+nan" },
      { label: "真", value: "true" },
      { label: "假", value: "false" },
      { label: "空字符串", value: "empty" }
    ];
    const rows = ref([]);
    function flatten(list) {
      const out = [];
      for (const m of list) {
        if (m.type === "value") {
          for (const [k, v] of Object.entries(m.options ?? {})) {
            out.push({ kind: "value", match: k, text: v.text, color: v.color });
          }
        } else if (m.type === "range") {
          for (const r of m.options ?? []) {
            out.push({
              kind: "range",
              match: "",
              from: r.from,
              to: r.to,
              text: r.result?.text ?? "",
              color: r.result?.color
            });
          }
        } else if (m.type === "regex") {
          for (const r of m.options ?? []) {
            out.push({
              kind: "regex",
              match: r.pattern,
              text: r.result?.text ?? "",
              color: r.result?.color
            });
          }
        } else if (m.type === "special") {
          for (const r of m.options ?? []) {
            out.push({
              kind: "special",
              match: r.match,
              text: r.result?.text ?? "",
              color: r.result?.color
            });
          }
        }
      }
      return out.length ? out : [{ kind: "value", match: "", text: "", color: "#ffffff" }];
    }
    watch(
      () => props.modelValue,
      (v) => {
        rows.value = flatten(v ?? []);
      },
      { immediate: true, deep: true }
    );
    function commit(next) {
      rows.value = next;
      const valueOpts = {};
      const rangeOpts = [];
      const regexOpts = [];
      const specialOpts = [];
      for (const r of next) {
        const result = { text: r.text, color: r.color || void 0 };
        if (r.kind === "value" && r.match !== "") valueOpts[r.match] = result;
        else if (r.kind === "range")
          rangeOpts.push({
            from: Number(r.from ?? 0),
            to: Number(r.to ?? 0),
            result
          });
        else if (r.kind === "regex" && r.match) regexOpts.push({ pattern: r.match, result });
        else if (r.kind === "special" && r.match) specialOpts.push({ match: r.match, result });
      }
      const out = [];
      if (Object.keys(valueOpts).length) out.push({ type: "value", options: valueOpts });
      if (rangeOpts.length) out.push({ type: "range", options: rangeOpts });
      if (regexOpts.length) out.push({ type: "regex", options: regexOpts });
      if (specialOpts.length) out.push({ type: "special", options: specialOpts });
      emit("update:modelValue", out.length ? out : [{ type: "value", options: {} }]);
    }
    function patchRow(i, patch) {
      const next = rows.value.map((r, idx) => idx === i ? { ...r, ...patch } : r);
      commit(next);
    }
    function add(kind2 = "value") {
      const base = kind2 === "range" ? { kind: kind2, match: "", from: 0, to: 100, text: "", color: "#73BF69" } : kind2 === "special" ? { kind: kind2, match: "null", text: "N/A", color: "#FADE2A" } : {
        kind: kind2,
        match: kind2 === "regex" ? ".*" : String(rows.value.length),
        text: "",
        color: "#73BF69"
      };
      commit([...rows.value, base]);
    }
    function remove(i) {
      const next = rows.value.filter((_, idx) => idx !== i);
      commit(next.length ? next : [{ kind: "value", match: "", text: "", color: "#ffffff" }]);
    }
    const addKind = ref("value");
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$k$1, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (r, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row",
              "data-testid": `mapping-row-${i}`
            }, [
              createVNode(GSelect, {
                class: "kind",
                value: r.kind,
                options: kindOptions,
                "show-search": false,
                onChange: ($event) => patchRow(i, { kind: String($event) })
              }, null, 8, ["value", "onChange"]),
              r.kind === "range" ? (openBlock(), createElementBlock(
                Fragment,
                { key: 0 },
                [
                  createVNode(GInput, {
                    class: "narrow",
                    type: "number",
                    placeholder: "从",
                    value: r.from,
                    "onUpdate:value": ($event) => patchRow(i, { from: Number($event) })
                  }, null, 8, ["value", "onUpdate:value"]),
                  createVNode(GInput, {
                    class: "narrow",
                    type: "number",
                    placeholder: "到",
                    value: r.to,
                    "onUpdate:value": ($event) => patchRow(i, { to: Number($event) })
                  }, null, 8, ["value", "onUpdate:value"])
                ],
                64
                /* STABLE_FRAGMENT */
              )) : r.kind === "special" ? (openBlock(), createBlock(GSelect, {
                key: 1,
                value: r.match,
                options: specialOptions,
                "show-search": false,
                onChange: ($event) => patchRow(i, { match: String($event ?? "") })
              }, null, 8, ["value", "onChange"])) : (openBlock(), createBlock(GInput, {
                key: 2,
                placeholder: r.kind === "regex" ? "正则表达式" : "值",
                value: r.match,
                "onUpdate:value": ($event) => patchRow(i, { match: String($event ?? "") })
              }, null, 8, ["placeholder", "value", "onUpdate:value"])),
              createVNode(GInput, {
                placeholder: "显示文本",
                value: r.text,
                "onUpdate:value": ($event) => patchRow(i, { text: String($event ?? "") })
              }, null, 8, ["value", "onUpdate:value"]),
              createElementVNode("input", {
                type: "color",
                value: r.color?.startsWith("#") ? r.color : "#ffffff",
                onInput: ($event) => patchRow(i, { color: $event.target.value })
              }, null, 40, _hoisted_3$6$1),
              createVNode(GButton, {
                size: "md",
                variant: "toolbar",
                title: "删除",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[2] || (_cache[2] = [
                  createTextVNode(
                    " × ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ], 8, _hoisted_2$b$1);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createElementVNode("div", _hoisted_4$3$1, [
          createVNode(GSelect, {
            class: "kind",
            value: addKind.value,
            options: kindOptions,
            "show-search": false,
            "test-id": "mapping-add-kind",
            onChange: _cache[0] || (_cache[0] = ($event) => addKind.value = String($event))
          }, null, 8, ["value"]),
          createVNode(GButton, {
            size: "md",
            variant: "secondary",
            "test-id": "mapping-add",
            onClick: _cache[1] || (_cache[1] = ($event) => add(addKind.value))
          }, {
            default: withCtx(() => [..._cache[3] || (_cache[3] = [
              createTextVNode(
                " + 添加值映射 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ])
      ]);
    };
  }
});
const ValueMappingsEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$r$1, [["__scopeId", "data-v-2ba71f54"]]);
const _hoisted_1$j$1 = {
  class: "data-links",
  "data-testid": "data-links-editor"
};
const _hoisted_2$a$1 = ["data-testid"];
const _hoisted_3$5$1 = { class: "field-wrap" };
const _hoisted_4$2$1 = {
  key: 0,
  class: "suggest",
  "data-testid": "data-link-title-suggestions"
};
const _hoisted_5$2$1 = {
  key: 0,
  class: "suggest-empty"
};
const _hoisted_6$1$1 = { class: "suggest-origin" };
const _hoisted_7$1$1 = ["title", "data-testid", "onMousedown"];
const _hoisted_8$1$1 = { class: "s-label" };
const _hoisted_9$1$1 = { class: "s-value" };
const _hoisted_10$1$1 = { class: "field-wrap" };
const _hoisted_11$1$1 = {
  key: 0,
  class: "suggest",
  "data-testid": "data-link-suggestions"
};
const _hoisted_12$L = {
  key: 0,
  class: "suggest-empty"
};
const _hoisted_13$K = { class: "suggest-origin" };
const _hoisted_14$F = ["title", "data-testid", "onMousedown"];
const _hoisted_15$A = { class: "s-label" };
const _hoisted_16$x = { class: "s-value" };
const _hoisted_17$v = { class: "blank" };
const _sfc_main$q$1 = /* @__PURE__ */ defineComponent({
  __name: "DataLinksEditor",
  props: {
    modelValue: {},
    dataFrames: {},
    templateVars: {},
    templateVarProperties: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const links = computed(() => Array.isArray(props.modelValue) ? props.modelValue : []);
    const suggestions = computed(
      () => getDataLinksVariableSuggestions(props.dataFrames ?? [], {
        templateVars: props.templateVars ?? [],
        templateVarProperties: props.templateVarProperties ?? {},
        // Field data links editor operates on clicked values (Grafana Values scope)
        scope: VariableSuggestionsScope.Values
      })
    );
    const activeIndex = ref(null);
    const activeField = ref("url");
    const filterText = ref("");
    const filteredSuggestions = computed(() => {
      const q = filterText.value.replace(/^\$\{?/, "").toLowerCase();
      const all = suggestions.value;
      if (!q) return all;
      return all.filter((s) => s.value.toLowerCase().includes(q) || s.label.toLowerCase().includes(q));
    });
    const grouped = computed(() => {
      const map = /* @__PURE__ */ new Map();
      for (const s of filteredSuggestions.value) {
        const k = s.origin;
        if (!map.has(k)) map.set(k, []);
        map.get(k).push(s);
      }
      return [...map.entries()];
    });
    const originLabel = {
      "series": "Series",
      "field": "Field",
      "fields": "Fields",
      "value": "Value",
      "built-in": "Built-in",
      "template": "Template"
    };
    function emitNext(next) {
      emit("update:modelValue", next);
    }
    function update(i, patch) {
      emitNext(links.value.map((l, idx) => idx === i ? { ...l, ...patch } : l));
    }
    function add() {
      emitNext([...links.value, { title: "", url: "", targetBlank: true }]);
    }
    function remove(i) {
      emitNext(links.value.filter((_, idx) => idx !== i));
      if (activeIndex.value === i) activeIndex.value = null;
    }
    function onFieldInput(i, field, raw) {
      const v = String(raw ?? "");
      update(i, { [field]: v });
      activeIndex.value = i;
      activeField.value = field;
      const dollar = v.lastIndexOf("$");
      filterText.value = dollar >= 0 ? v.slice(dollar) : "";
    }
    function applySuggestion(i, s) {
      const field = activeField.value;
      const cur = String(links.value[i]?.[field] ?? "");
      const dollar = cur.lastIndexOf("$");
      const token = formatSuggestionToken(s);
      const next = dollar >= 0 ? cur.slice(0, dollar) + token : cur + token;
      update(i, { [field]: next });
      filterText.value = "";
      activeIndex.value = null;
    }
    function onFocus(i, field) {
      activeIndex.value = i;
      activeField.value = field;
      filterText.value = "";
    }
    function onBlur() {
      setTimeout(() => {
        activeIndex.value = null;
      }, 180);
    }
    function showSuggest(i, field) {
      return activeIndex.value === i && activeField.value === field && suggestions.value.length > 0;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$j$1, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(links.value, (l, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "link-row",
              "data-testid": `data-link-${i}`
            }, [
              createElementVNode("div", _hoisted_3$5$1, [
                createVNode(GInput, {
                  value: l.title ?? "",
                  placeholder: "标题（输入 $ 显示变量）",
                  "data-testid": "data-link-title",
                  "onUpdate:value": ($event) => onFieldInput(i, "title", $event),
                  onFocus: ($event) => onFocus(i, "title"),
                  onBlur
                }, null, 8, ["value", "onUpdate:value", "onFocus"]),
                showSuggest(i, "title") ? (openBlock(), createElementBlock("div", _hoisted_4$2$1, [
                  !filteredSuggestions.value.length ? (openBlock(), createElementBlock("div", _hoisted_5$2$1, "无匹配变量")) : createCommentVNode("v-if", true),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(grouped.value, ([origin, items]) => {
                      return openBlock(), createElementBlock("div", {
                        key: `t-${origin}`,
                        class: "suggest-group"
                      }, [
                        createElementVNode(
                          "div",
                          _hoisted_6$1$1,
                          toDisplayString(originLabel[origin] || origin),
                          1
                          /* TEXT */
                        ),
                        (openBlock(true), createElementBlock(
                          Fragment,
                          null,
                          renderList(items, (s) => {
                            return openBlock(), createElementBlock("button", {
                              key: `t-${s.value}`,
                              type: "button",
                              class: "suggest-item",
                              title: s.documentation,
                              "data-testid": `data-link-title-suggest-${s.value}`,
                              onMousedown: withModifiers(($event) => applySuggestion(i, s), ["prevent"])
                            }, [
                              createElementVNode(
                                "span",
                                _hoisted_8$1$1,
                                toDisplayString(s.label),
                                1
                                /* TEXT */
                              ),
                              createElementVNode(
                                "span",
                                _hoisted_9$1$1,
                                "$" + toDisplayString("{" + s.value + "}"),
                                1
                                /* TEXT */
                              )
                            ], 40, _hoisted_7$1$1);
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])) : createCommentVNode("v-if", true)
              ]),
              createElementVNode("div", _hoisted_10$1$1, [
                createVNode(GInput, {
                  value: l.url ?? "",
                  placeholder: "URL（输入 $ 显示变量）",
                  "data-testid": "data-link-url",
                  "onUpdate:value": ($event) => onFieldInput(i, "url", $event),
                  onFocus: ($event) => onFocus(i, "url"),
                  onBlur
                }, null, 8, ["value", "onUpdate:value", "onFocus"]),
                showSuggest(i, "url") ? (openBlock(), createElementBlock("div", _hoisted_11$1$1, [
                  !filteredSuggestions.value.length ? (openBlock(), createElementBlock("div", _hoisted_12$L, "无匹配变量")) : createCommentVNode("v-if", true),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(grouped.value, ([origin, items]) => {
                      return openBlock(), createElementBlock("div", {
                        key: `u-${origin}`,
                        class: "suggest-group"
                      }, [
                        createElementVNode(
                          "div",
                          _hoisted_13$K,
                          toDisplayString(originLabel[origin] || origin),
                          1
                          /* TEXT */
                        ),
                        (openBlock(true), createElementBlock(
                          Fragment,
                          null,
                          renderList(items, (s) => {
                            return openBlock(), createElementBlock("button", {
                              key: `u-${s.value}`,
                              type: "button",
                              class: "suggest-item",
                              title: s.documentation,
                              "data-testid": `data-link-suggest-${s.value}`,
                              onMousedown: withModifiers(($event) => applySuggestion(i, s), ["prevent"])
                            }, [
                              createElementVNode(
                                "span",
                                _hoisted_15$A,
                                toDisplayString(s.label),
                                1
                                /* TEXT */
                              ),
                              createElementVNode(
                                "span",
                                _hoisted_16$x,
                                "$" + toDisplayString("{" + s.value + "}"),
                                1
                                /* TEXT */
                              )
                            ], 40, _hoisted_14$F);
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])) : createCommentVNode("v-if", true)
              ]),
              createElementVNode("label", _hoisted_17$v, [
                createVNode(GSwitch, {
                  checked: l.targetBlank !== false,
                  "onUpdate:checked": ($event) => update(i, { targetBlank: $event })
                }, null, 8, ["checked", "onUpdate:checked"]),
                _cache[0] || (_cache[0] = createTextVNode(
                  " 新窗口 ",
                  -1
                  /* CACHED */
                ))
              ]),
              createVNode(GButton, {
                size: "md",
                variant: "toolbar",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    "×",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ], 8, _hoisted_2$a$1);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(GButton, {
          size: "md",
          variant: "secondary",
          "test-id": "data-links-add",
          onClick: add
        }, {
          default: withCtx(() => [..._cache[2] || (_cache[2] = [
            createTextVNode(
              " + 添加链接 ",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        }),
        _cache[3] || (_cache[3] = createElementVNode(
          "p",
          { class: "hint" },
          [
            createTextVNode(" 标题与 URL 均支持 "),
            createElementVNode("code", null, "$"),
            createTextVNode(" 变量建议（${__value.raw}、${__field.name} 等） ")
          ],
          -1
          /* CACHED */
        ))
      ]);
    };
  }
});
const DataLinksEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$q$1, [["__scopeId", "data-v-db0605c6"]]);
const _hoisted_1$i$1 = ["data-frame-filter", "data-option-count", "data-group-count", "data-base-name-mode", "data-matcher-scope", "data-empty"];
const _sfc_main$p$1 = /* @__PURE__ */ defineComponent({
  __name: "FieldNamePicker",
  props: {
    modelValue: {},
    fieldNames: {},
    options: {},
    filterTypes: {},
    filterFn: {},
    frameNames: {},
    placeholder: { default: "选择字段" },
    noFieldsMessage: { default: "无可用字段" },
    baseNameMode: { default: "default" },
    scope: {},
    width: {},
    allowClear: { type: Boolean, default: true },
    includeAuto: { type: Boolean, default: true }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function isLabeledDisplay(label, rawName) {
      if (/\{[^}]+\}/.test(label)) return true;
      if (rawName && label !== rawName && label.includes(rawName)) return true;
      return false;
    }
    const selectOptions = computed(() => {
      let list = [];
      if (props.options?.length) {
        list = props.options.slice();
      } else {
        list = (props.fieldNames ?? []).map((n) => ({ label: n, value: n }));
      }
      if (props.filterTypes?.length) {
        const allow = new Set(props.filterTypes);
        list = list.filter((o) => !o.type || allow.has(o.type));
      }
      if (props.frameNames?.length) {
        const allowFrames = new Set(props.frameNames);
        list = list.filter((o) => {
          const fr = o.frameName ?? o.frame ?? o.refId;
          if (fr == null || fr === "") return true;
          return allowFrames.has(String(fr));
        });
      }
      if (typeof props.filterFn === "function") {
        list = list.filter((o) => {
          try {
            return props.filterFn(o);
          } catch {
            return true;
          }
        });
      }
      const mode2 = normalizeBaseNameMode(props.baseNameMode);
      if (props.scope) {
        const want = String(props.scope);
        list = list.filter((o) => {
          const sc = String(o.scope ?? "series");
          return sc === want;
        });
      }
      if (mode2 === "only") {
        list = list.filter((o) => !isLabeledDisplay(o.label, o.rawName));
      } else if (mode2 === "exclude") {
        const labeled = list.filter((o) => isLabeledDisplay(o.label, o.rawName));
        if (labeled.length) list = labeled;
      }
      const seen = /* @__PURE__ */ new Set();
      const unique = [];
      for (const o of list) {
        if (!o.value || seen.has(o.value)) continue;
        seen.add(o.value);
        unique.push(o);
      }
      const mapped = unique.map((o) => ({
        label: o.type ? `${o.label} (${o.type})` : o.label,
        value: o.value,
        scope: String(o.scope ?? "series")
      }));
      if (!mapped.length) {
        const empty2 = [
          {
            label: props.noFieldsMessage || "无可用字段",
            value: "",
            disabled: true
          }
        ];
        return empty2;
      }
      const auto = props.includeAuto ? [{ label: "自动", value: "" }] : [];
      if (!props.scope) {
        const scopes = new Set(mapped.map((m) => m.scope || "series"));
        if (scopes.size > 1) {
          const groups = [];
          const order = [
            "series",
            "nested",
            "annotation",
            "exemplar"
          ];
          for (const sc of order) {
            if (!scopes.has(sc)) continue;
            const kids = mapped.filter((m) => (m.scope || "series") === sc);
            groups.push({
              label: groupLabelForScope(sc),
              options: kids.map(({ label, value, disabled }) => ({
                label,
                value,
                disabled
              }))
            });
          }
          for (const sc of scopes) {
            if (order.includes(sc)) continue;
            const kids = mapped.filter((m) => (m.scope || "series") === sc);
            groups.push({
              label: String(sc),
              options: kids.map(({ label, value, disabled }) => ({
                label,
                value,
                disabled
              }))
            });
          }
          return [...auto, ...groups];
        }
      }
      const flat = mapped.map(({ label, value, disabled }) => ({
        label,
        value,
        disabled
      }));
      return [...auto, ...flat];
    });
    function flattenOptionValues(opts) {
      const out = [];
      for (const o of opts) {
        if (o && Array.isArray(o.options)) {
          for (const c of o.options) {
            if (c?.value != null && c.value !== "") out.push(String(c.value));
          }
        } else if (o?.value != null && o.value !== "") {
          out.push(String(o.value));
        }
      }
      return out;
    }
    const flatValues = computed(() => flattenOptionValues(selectOptions.value));
    const optionCount = computed(() => {
      const n = flatValues.value.length;
      const hasAuto = selectOptions.value.some(
        (o) => o && o.value === "" && o.label === "自动"
      );
      return n + (hasAuto ? 1 : 0);
    });
    const empty = computed(() => flatValues.value.length === 0);
    const groupCount = computed(
      () => selectOptions.value.filter((o) => o && Array.isArray(o.options)).length
    );
    function filterOption(input, option) {
      const q = String(input ?? "").trim().toLowerCase();
      if (!q) return true;
      const label = String(option?.label ?? option?.children ?? "").toLowerCase();
      const value = String(option?.value ?? "").toLowerCase();
      return label.includes(q) || value.includes(q);
    }
    function onChange(v) {
      if (v === "" || v == null || v === "__none__") {
        emit("update:modelValue", void 0);
        return;
      }
      const s = String(v);
      const allowed = new Set(flatValues.value);
      if (allowed.size && !allowed.has(s)) {
        return;
      }
      emit("update:modelValue", s);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "field-name-picker",
        "data-testid": "field-name-picker",
        "data-frame-filter": __props.frameNames?.length ? __props.frameNames.join(",") : "",
        "data-option-count": String(optionCount.value),
        "data-group-count": String(groupCount.value),
        "data-base-name-mode": String(__props.baseNameMode ?? "default"),
        "data-matcher-scope": String(__props.scope ?? ""),
        "data-empty": String(!!empty.value),
        "data-searchable": "true",
        style: normalizeStyle(
          __props.width != null ? { width: typeof __props.width === "number" ? `${__props.width}px` : __props.width } : void 0
        )
      }, [
        createVNode(GSelect, {
          value: __props.modelValue ?? "",
          options: selectOptions.value,
          "allow-clear": __props.allowClear,
          "show-search": "",
          "filter-option": filterOption,
          placeholder: empty.value ? __props.noFieldsMessage || __props.placeholder : __props.placeholder,
          onChange
        }, null, 8, ["value", "options", "allow-clear", "placeholder"])
      ], 12, _hoisted_1$i$1);
    };
  }
});
const _sfc_main$o$1 = /* @__PURE__ */ defineComponent({
  __name: "StatsPicker",
  props: {
    modelValue: {},
    allowMultiple: { type: Boolean, default: true }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const STATS = [
      { label: "Last *", value: "lastNotNull" },
      { label: "Last", value: "last" },
      { label: "First *", value: "firstNotNull" },
      { label: "First", value: "first" },
      { label: "Min", value: "min" },
      { label: "Max", value: "max" },
      { label: "Mean", value: "mean" },
      { label: "Median", value: "median" },
      { label: "Sum", value: "sum" },
      { label: "Count", value: "count" },
      { label: "Range", value: "range" },
      { label: "Delta", value: "delta" },
      { label: "Step", value: "step" },
      { label: "Diff", value: "diff" },
      { label: "StdDev", value: "stdDev" },
      { label: "Variance", value: "variance" },
      { label: "All zeros", value: "allIsZero" },
      { label: "All nulls", value: "allIsNull" },
      { label: "Change count", value: "changeCount" },
      { label: "Distinct count", value: "distinctCount" }
    ];
    const props = __props;
    const emit = __emit;
    const value = computed(() => {
      const v = props.modelValue;
      if (Array.isArray(v)) return v;
      if (typeof v === "string" && v) return [v];
      return [];
    });
    function onChange(v) {
      if (Array.isArray(v)) emit("update:modelValue", v.map(String));
      else if (v == null || v === "") emit("update:modelValue", []);
      else emit("update:modelValue", [String(v)]);
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GSelect, {
        class: "stats-picker",
        "test-id": "stats-picker",
        mode: __props.allowMultiple ? "multiple" : void 0,
        value: __props.allowMultiple ? value.value : value.value[0] ?? "",
        options: STATS,
        "show-search": true,
        "allow-clear": "",
        placeholder: "选择计算",
        onChange
      }, null, 8, ["mode", "value"]);
    };
  }
});
const StatsPicker = /* @__PURE__ */ _export_sfc$2(_sfc_main$o$1, [["__scopeId", "data-v-21e9a866"]]);
const _hoisted_1$h$1 = {
  class: "strings",
  "data-testid": "strings-editor"
};
const _sfc_main$n$1 = /* @__PURE__ */ defineComponent({
  __name: "StringArrayEditor",
  props: {
    modelValue: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const items = computed(() => Array.isArray(props.modelValue) ? props.modelValue : []);
    function set(i, v) {
      emit(
        "update:modelValue",
        items.value.map((x, idx) => idx === i ? v : x)
      );
    }
    function add() {
      emit("update:modelValue", [...items.value, ""]);
    }
    function remove(i) {
      emit(
        "update:modelValue",
        items.value.filter((_, idx) => idx !== i)
      );
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$h$1, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(items.value, (s, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row"
            }, [
              createVNode(GInput, {
                value: s,
                "onUpdate:value": ($event) => set(i, String($event ?? ""))
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(GButton, {
                size: "md",
                variant: "toolbar",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[0] || (_cache[0] = [
                  createTextVNode(
                    "×",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(GButton, {
          size: "md",
          variant: "secondary",
          onClick: add
        }, {
          default: withCtx(() => [..._cache[1] || (_cache[1] = [
            createTextVNode(
              "+ 添加",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const StringArrayEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$n$1, [["__scopeId", "data-v-89a8b6ee"]]);
const _sfc_main$m$1 = /* @__PURE__ */ defineComponent({
  __name: "TimezonePicker",
  props: {
    modelValue: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const ZONES = [
      { label: "默认", value: "" },
      { label: "浏览器本地", value: "browser" },
      { label: "UTC", value: "utc" },
      { label: "Asia/Shanghai", value: "Asia/Shanghai" },
      { label: "Asia/Tokyo", value: "Asia/Tokyo" },
      { label: "America/New_York", value: "America/New_York" },
      { label: "America/Los_Angeles", value: "America/Los_Angeles" },
      { label: "Europe/London", value: "Europe/London" },
      { label: "Europe/Berlin", value: "Europe/Berlin" },
      { label: "Europe/Paris", value: "Europe/Paris" },
      { label: "Australia/Sydney", value: "Australia/Sydney" }
    ];
    const props = __props;
    const emit = __emit;
    const value = computed(() => props.modelValue ?? "");
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GSelect, {
        "test-id": "timezone-picker",
        value: value.value,
        options: ZONES,
        "show-search": true,
        "allow-clear": "",
        placeholder: "时区",
        onChange: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event == null || $event === "" ? void 0 : String($event)))
      }, null, 8, ["value"]);
    };
  }
});
const _hoisted_1$g$1 = {
  class: "actions",
  "data-testid": "actions-editor"
};
const _sfc_main$l$1 = /* @__PURE__ */ defineComponent({
  __name: "ActionsEditor",
  props: {
    modelValue: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const items = computed(() => Array.isArray(props.modelValue) ? props.modelValue : []);
    const types = [
      { label: "链接", value: "link" },
      { label: "Infinity", value: "infinity" }
    ];
    function update(i, patch) {
      emit(
        "update:modelValue",
        items.value.map((a, idx) => idx === i ? { ...a, ...patch } : a)
      );
    }
    function add() {
      emit("update:modelValue", [...items.value, { type: "link", title: "", options: { url: "" } }]);
    }
    function remove(i) {
      emit(
        "update:modelValue",
        items.value.filter((_, idx) => idx !== i)
      );
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$g$1, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(items.value, (a, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row"
            }, [
              createVNode(GSelect, {
                value: a.type ?? "link",
                options: types,
                "show-search": false,
                onChange: ($event) => update(i, { type: String($event) })
              }, null, 8, ["value", "onChange"]),
              createVNode(GInput, {
                value: a.title ?? "",
                placeholder: "标题",
                "onUpdate:value": ($event) => update(i, { title: String($event ?? "") })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(GInput, {
                value: a.options?.url ?? "",
                placeholder: "URL",
                "onUpdate:value": ($event) => update(i, {
                  options: { ...a.options ?? {}, url: String($event ?? "") }
                })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(GButton, {
                size: "md",
                variant: "toolbar",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[0] || (_cache[0] = [
                  createTextVNode(
                    "×",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(GButton, {
          size: "md",
          variant: "secondary",
          onClick: add
        }, {
          default: withCtx(() => [..._cache[1] || (_cache[1] = [
            createTextVNode(
              "+ 添加动作",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ActionsEditor = /* @__PURE__ */ _export_sfc$2(_sfc_main$l$1, [["__scopeId", "data-v-c7fb3276"]]);
const _hoisted_1$f$1 = {
  class: "viz-layout__viz",
  "data-testid": "viz-layout-viz"
};
const _hoisted_2$9$1 = ["data-placement"];
const _sfc_main$k$1 = /* @__PURE__ */ defineComponent({
  __name: "VizLayout",
  props: {
    width: {},
    height: {},
    legendPlacement: { default: "bottom" },
    legendMaxHeight: { default: "35%" },
    legendMaxWidth: { default: "60%" },
    legendWidth: {}
  },
  setup(__props) {
    const props = __props;
    const slots = useSlots();
    const legendEl = ref(null);
    const legendSize = ref({ width: 0, height: 0 });
    let ro = null;
    function measure() {
      if (!legendEl.value) {
        legendSize.value = { width: 0, height: 0 };
        return;
      }
      const r = legendEl.value.getBoundingClientRect();
      legendSize.value = { width: r.width, height: r.height };
    }
    onMounted(() => {
      if (typeof ResizeObserver !== "undefined") {
        ro = new ResizeObserver(() => measure());
        if (legendEl.value) ro.observe(legendEl.value);
      }
      measure();
    });
    onBeforeUnmount(() => ro?.disconnect());
    watch(legendEl, (el) => {
      ro?.disconnect();
      if (el && typeof ResizeObserver !== "undefined") {
        ro = new ResizeObserver(() => measure());
        ro.observe(el);
      }
      measure();
    });
    const placement = computed(() => {
      if (typeof document !== "undefined" && document.body.clientWidth < 992) return "bottom";
      return props.legendPlacement;
    });
    const vizSize = computed(() => {
      if (!slots.legend) return { width: props.width, height: props.height };
      if (placement.value === "bottom") {
        return {
          width: props.width,
          height: Math.max(0, props.height - legendSize.value.height)
        };
      }
      const lw = typeof props.legendWidth === "number" ? props.legendWidth : legendSize.value.width;
      return { width: Math.max(0, props.width - (lw || 0)), height: props.height };
    });
    const containerStyle = computed(() => ({
      display: "flex",
      width: `${props.width}px`,
      height: `${props.height}px`,
      flexDirection: placement.value === "right" ? "row" : "column"
    }));
    const legendStyle = computed(() => {
      if (placement.value === "bottom") return { maxHeight: props.legendMaxHeight, width: "100%" };
      if (typeof props.legendWidth === "number") return { width: `${props.legendWidth}px` };
      if (typeof props.legendWidth === "string") return { width: props.legendWidth };
      return { maxWidth: props.legendMaxWidth };
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: "viz-layout",
          "data-testid": "viz-layout",
          style: normalizeStyle(containerStyle.value)
        },
        [
          createElementVNode("div", _hoisted_1$f$1, [
            renderSlot(_ctx.$slots, "default", {
              width: vizSize.value.width,
              height: vizSize.value.height
            }, void 0, true)
          ]),
          _ctx.$slots.legend ? (openBlock(), createElementBlock("div", {
            key: 0,
            ref_key: "legendEl",
            ref: legendEl,
            class: "viz-layout__legend",
            "data-testid": "viz-layout-legend",
            "data-placement": placement.value,
            style: normalizeStyle(legendStyle.value)
          }, [
            renderSlot(_ctx.$slots, "legend", {}, void 0, true)
          ], 12, _hoisted_2$9$1)) : createCommentVNode("v-if", true)
        ],
        4
        /* STYLE */
      );
    };
  }
});
const VizLayout = /* @__PURE__ */ _export_sfc$2(_sfc_main$k$1, [["__scopeId", "data-v-94b47f94"]]);
function createEventBus() {
  const handlers = /* @__PURE__ */ new Map();
  return {
    publish(event, payload) {
      for (const h2 of handlers.get(event) ?? []) h2(payload);
    },
    subscribe(event, handler) {
      if (!handlers.has(event)) handlers.set(event, /* @__PURE__ */ new Set());
      handlers.get(event).add(handler);
      return () => handlers.get(event)?.delete(handler);
    }
  };
}
const panelContextKey = /* @__PURE__ */ Symbol("grafana-panel-context");
function createDefaultPanelContext(partial = {}) {
  return {
    eventsScope: partial.eventsScope ?? "global",
    eventBus: partial.eventBus ?? createEventBus(),
    app: partial.app,
    sync: partial.sync,
    onSeriesColorChange: partial.onSeriesColorChange,
    onToggleSeriesVisibility: partial.onToggleSeriesVisibility,
    onToggleLegendSort: partial.onToggleLegendSort,
    onOpenInspector: partial.onOpenInspector,
    instanceState: partial.instanceState,
    onInstanceStateChange: partial.onInstanceStateChange,
    canExecuteActions: partial.canExecuteActions
  };
}
function providePanelContext(ctx) {
  provide(panelContextKey, ctx);
}
function usePanelContext() {
  return inject(panelContextKey, () => createDefaultPanelContext(), true);
}
const _hoisted_1$e$1 = {
  class: "panel-context-provider",
  "data-testid": "panel-context-provider"
};
const _sfc_main$j$1 = /* @__PURE__ */ defineComponent({
  __name: "PanelContextProvider",
  props: {
    value: {}
  },
  setup(__props) {
    const props = __props;
    const ctx = computed(() => createDefaultPanelContext(props.value ?? {}));
    provide(panelContextKey, ctx.value);
    watch(
      ctx,
      (v) => {
        Object.assign(ctx.value, v);
      },
      { deep: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$e$1, [
        renderSlot(_ctx.$slots, "default")
      ]);
    };
  }
});
var BigValueColorMode = /* @__PURE__ */ ((BigValueColorMode2) => {
  BigValueColorMode2["Background"] = "background";
  BigValueColorMode2["BackgroundSolid"] = "background_solid";
  BigValueColorMode2["None"] = "none";
  BigValueColorMode2["Value"] = "value";
  return BigValueColorMode2;
})(BigValueColorMode || {});
var BigValueGraphMode = /* @__PURE__ */ ((BigValueGraphMode2) => {
  BigValueGraphMode2["None"] = "none";
  BigValueGraphMode2["Line"] = "line";
  BigValueGraphMode2["Area"] = "area";
  return BigValueGraphMode2;
})(BigValueGraphMode || {});
var BigValueJustifyMode = /* @__PURE__ */ ((BigValueJustifyMode2) => {
  BigValueJustifyMode2["Auto"] = "auto";
  BigValueJustifyMode2["Center"] = "center";
  return BigValueJustifyMode2;
})(BigValueJustifyMode || {});
var BigValueTextMode = /* @__PURE__ */ ((BigValueTextMode2) => {
  BigValueTextMode2["Auto"] = "auto";
  BigValueTextMode2["Value"] = "value";
  BigValueTextMode2["ValueAndName"] = "value_and_name";
  BigValueTextMode2["Name"] = "name";
  BigValueTextMode2["None"] = "none";
  return BigValueTextMode2;
})(BigValueTextMode || {});
const LINE_HEIGHT = 1.2;
const MAX_TITLE_SIZE = 30;
const VALUE_FONT_WEIGHT = 500;
let measureCanvas;
function estimateTextWidth(text, fontSize, weight = 400) {
  if (typeof document !== "undefined") {
    try {
      if (!measureCanvas) measureCanvas = document.createElement("canvas");
      const ctx = measureCanvas.getContext("2d");
      if (ctx) {
        ctx.font = `${weight} ${fontSize}px Inter, Helvetica, Arial, sans-serif`;
        const measured = ctx.measureText(String(text ?? "")).width;
        if (measured > 0) return measured;
      }
    } catch {
    }
  }
  const factor = weight >= 500 ? 0.62 : 0.55;
  return Math.max(1, String(text ?? "").length) * fontSize * factor;
}
function calculateFontSize(text, width2, height2, lineHeight = LINE_HEIGHT, maxSize, weight = 400) {
  if (!text) {
    const h2 = height2 / lineHeight;
    return maxSize != null ? Math.min(maxSize, h2) : h2;
  }
  const textSize14 = estimateTextWidth(text, 14, weight);
  const fontSizeBasedOnWidth = width2 / (textSize14 + 2) * 14;
  const fontSizeBasedOnHeight = height2 / lineHeight;
  const optimalSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);
  return Math.min(optimalSize, maxSize ?? optimalSize);
}
function shouldJustifyCenter(mode2, title) {
  if (mode2 === BigValueJustifyMode.Center) return true;
  if (mode2 === BigValueJustifyMode.Auto) return !title;
  return !title;
}
function getTextValues(props) {
  const textMode = String(props.textMode ?? BigValueTextMode.Auto);
  const v = props.value;
  const pct = v.percentChange != null && Number.isFinite(v.percentChange) ? `${v.percentChange > 0 ? "+" : ""}${v.percentChange.toFixed(1)}%` : void 0;
  if (textMode === BigValueTextMode.None) {
    return { valueText: "" };
  }
  if (textMode === BigValueTextMode.Name) {
    return { valueText: v.title ?? "", title: void 0, percentText: pct };
  }
  if (textMode === BigValueTextMode.Value) {
    return { valueText: v.text, title: void 0, percentText: pct };
  }
  if (textMode === BigValueTextMode.ValueAndName) {
    return { valueText: v.text, title: v.title, percentText: pct };
  }
  if ((props.count ?? 1) === 1) {
    return { valueText: v.text, title: void 0, percentText: pct };
  }
  return { valueText: v.text, title: v.title, percentText: pct };
}
function mixToward(hex, toward, amount) {
  const parse = (h2) => {
    const m = String(h2).replace("#", "").match(/^([0-9a-f]{6})$/i);
    if (!m) return null;
    const n = Number.parseInt(m[1], 16);
    return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
  };
  const a = parse(hex);
  const b = parse(toward) || { r: 0, g: 0, b: 0 };
  if (!a) return hex;
  const t2 = Math.max(0, Math.min(1, amount));
  const r = Math.round(a.r + (b.r - a.r) * t2);
  const g = Math.round(a.g + (b.g - a.g) * t2);
  const bl = Math.round(a.b + (b.b - a.b) * t2);
  return `#${[r, g, bl].map((x) => x.toString(16).padStart(2, "0")).join("")}`;
}
function computeBigValueLayout(props) {
  const width2 = Math.max(1, props.width || 100);
  const height2 = Math.max(1, props.height || 100);
  const valueColor = props.value.color ?? "var(--grafana-text)";
  const panelPadding = height2 > 100 ? 12 : 8;
  const textValues = getTextValues(props);
  const justifyCenter = shouldJustifyCenter(props.justifyMode, textValues.title);
  const maxTextWidth = width2 - panelPadding * 2;
  const maxTextHeight = height2 - panelPadding * 2;
  const wideLayout = props.wideLayout !== false && !props.disableWideLayout;
  const isWide = wideLayout && width2 / height2 > 2.5 && !!textValues.title;
  const hasSpark = (props.graphMode === "area" || props.graphMode === "line") && Array.isArray(props.sparkline) && props.sparkline.length > 1;
  let chartHeight = 0;
  let chartWidth = width2;
  let titleFontSize = props.text?.titleSize ?? 0;
  let valueFontSize = props.text?.valueSize ?? 0;
  let percentFontSize = props.text?.percentSize ?? 0;
  if (isWide && hasSpark && height2 > 50) {
    const chartHeightPercent = 0.5;
    const titleWidthPercent = 0.6;
    const valueWidthPercent = 1 - titleWidthPercent;
    const textHeightPercent = 0.4;
    chartHeight = Math.floor(height2 * chartHeightPercent);
    chartWidth = width2;
    if (textValues.title && !titleFontSize) {
      titleFontSize = calculateFontSize(
        textValues.title,
        maxTextWidth * titleWidthPercent,
        maxTextHeight * textHeightPercent,
        LINE_HEIGHT,
        MAX_TITLE_SIZE
      );
    }
    if (!valueFontSize && textValues.valueText) {
      valueFontSize = calculateFontSize(
        textValues.valueText,
        maxTextWidth * valueWidthPercent,
        maxTextHeight * chartHeightPercent,
        LINE_HEIGHT,
        void 0,
        VALUE_FONT_WEIGHT
      );
    }
  } else if (hasSpark && height2 > 50) {
    const titleHeightPercent = 0.15;
    const chartHeightPercent = 0.25;
    let titleHeight = 0;
    chartHeight = height2 * chartHeightPercent;
    chartWidth = width2;
    if (textValues.title && !titleFontSize) {
      titleFontSize = calculateFontSize(
        textValues.title,
        maxTextWidth,
        height2 * titleHeightPercent,
        LINE_HEIGHT,
        MAX_TITLE_SIZE
      );
      titleHeight = titleFontSize * LINE_HEIGHT;
    }
    if (!valueFontSize && textValues.valueText) {
      valueFontSize = calculateFontSize(
        textValues.valueText,
        maxTextWidth,
        maxTextHeight - chartHeight - titleHeight,
        LINE_HEIGHT,
        void 0,
        VALUE_FONT_WEIGHT
      );
    }
    if (textValues.title && titleFontSize) {
      titleFontSize = Math.min(valueFontSize * 0.7, titleFontSize);
    }
    chartHeight = Math.max(
      0,
      Math.floor(height2 - titleFontSize * LINE_HEIGHT - valueFontSize * LINE_HEIGHT)
    );
  } else {
    let titleHeight = 0;
    if (textValues.title && !titleFontSize) {
      titleFontSize = calculateFontSize(
        textValues.title,
        maxTextWidth * (isWide ? 0.6 : 1),
        height2 * 0.15,
        LINE_HEIGHT,
        MAX_TITLE_SIZE
      );
      titleHeight = titleFontSize * LINE_HEIGHT;
    }
    if (!valueFontSize && textValues.valueText) {
      let valueHeight = maxTextHeight - titleHeight;
      if (props.value.percentChange != null) valueHeight = valueHeight * 0.75;
      const valueWidthPercent = isWide && textValues.title ? 0.3 : 1;
      valueFontSize = calculateFontSize(
        textValues.valueText,
        maxTextWidth * valueWidthPercent,
        valueHeight,
        LINE_HEIGHT,
        void 0,
        VALUE_FONT_WEIGHT
      );
    }
    if (textValues.title && titleFontSize) {
      titleFontSize = Math.min(valueFontSize * 0.7, titleFontSize);
    }
  }
  if (textValues.percentText && !percentFontSize) {
    percentFontSize = Math.max(valueFontSize / 2.5, 12);
  }
  const colorMode = String(props.colorMode ?? BigValueColorMode.Value);
  let containerBackground;
  let containerColor;
  let valueColorCss = valueColor;
  let titleColorCss = "var(--grafana-text-secondary)";
  if (colorMode === BigValueColorMode.None) {
    valueColorCss = "var(--grafana-text)";
  } else if (colorMode === BigValueColorMode.Background || colorMode === BigValueColorMode.BackgroundSolid) {
    const isDark = typeof document !== "undefined" && (document.documentElement.dataset.theme === "dark" || document.documentElement.dataset.theme === "dark" || document.documentElement.getAttribute("color-scheme") === "dark");
    const themeFactor = isDark ? 1 : -0.7;
    const g1 = mixToward(
      valueColor,
      themeFactor > 0 ? "#000000" : "#ffffff",
      Math.abs(0.15 * themeFactor)
    );
    const g2 = mixToward(
      valueColor,
      themeFactor > 0 ? "#000000" : "#ffffff",
      Math.abs(0.05 * themeFactor)
    );
    containerBackground = colorMode === BigValueColorMode.BackgroundSolid ? valueColor : `linear-gradient(120deg, ${g1}, ${g2})`;
    const rawContrast = getContrastText(valueColor).toLowerCase();
    const contrast = rawContrast === "#ffffff" || rawContrast === "#fff" ? "#fff" : rawContrast === "#000000" || rawContrast === "#000" ? "#000" : getContrastText(valueColor);
    containerColor = contrast;
    valueColorCss = contrast;
    titleColorCss = contrast === "#fff" ? "rgba(255,255,255,0.85)" : "rgba(0,0,0,0.7)";
  } else {
    valueColorCss = valueColor;
  }
  return {
    titleFontSize,
    valueFontSize,
    percentFontSize,
    chartHeight,
    chartWidth,
    valueColor,
    panelPadding,
    justifyCenter,
    maxTextWidth,
    maxTextHeight,
    title: textValues.title,
    valueText: textValues.valueText,
    percentText: textValues.percentText,
    isWide,
    valueColorCss,
    titleColorCss,
    containerBackground,
    containerColor
  };
}
const _hoisted_1$d$1 = {
  class: "big-value__text",
  "data-testid": "big-value-text"
};
const _sfc_main$i$1 = /* @__PURE__ */ defineComponent({
  __name: "BigValue",
  props: {
    width: { default: 100 },
    height: { default: 100 },
    value: {},
    sparkline: {},
    colorMode: { default: BigValueColorMode.Value },
    graphMode: { default: BigValueGraphMode.None },
    justifyMode: {},
    textMode: {},
    text: {},
    count: {},
    disableWideLayout: { type: Boolean },
    percentChangeColorMode: {},
    wideLayout: { type: Boolean, default: true }
  },
  setup(__props) {
    const props = __props;
    const layout = computed(() => computeBigValueLayout(props));
    const sparkHost = ref(null);
    let sparkCanvas = null;
    function colorWithAlpha2(color, alpha2) {
      const s = String(color || "").trim();
      let m = s.match(/^#([0-9a-f]{6})$/i);
      if (m) {
        const n = Number.parseInt(m[1], 16);
        return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alpha2})`;
      }
      m = s.match(/^#([0-9a-f]{3})$/i);
      if (m) {
        const r = Number.parseInt(m[1][0] + m[1][0], 16);
        const g = Number.parseInt(m[1][1] + m[1][1], 16);
        const b = Number.parseInt(m[1][2] + m[1][2], 16);
        return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
      }
      m = s.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*[\d.]+)?\s*\)$/i);
      if (m) {
        return `rgba(${m[1]}, ${m[2]}, ${m[3]}, ${alpha2})`;
      }
      return `rgba(115, 191, 105, ${alpha2})`;
    }
    function sparkColors() {
      const base = props.value.color || getClassicPalette$1(resolveThemeModeHint())[0];
      if (String(props.colorMode).startsWith("background")) {
        return {
          stroke: brightenColor(base, 40),
          fill: "rgba(255,255,255,0.4)"
        };
      }
      return { stroke: base, fill: colorWithAlpha2(base, 0.2) };
    }
    function brightenColor(color, amount) {
      const s = String(color || "").trim();
      let r = 115, g = 191, b = 105;
      let m = s.match(/^#([0-9a-f]{6})$/i);
      if (m) {
        const n = Number.parseInt(m[1], 16);
        r = n >> 16 & 255;
        g = n >> 8 & 255;
        b = n & 255;
      } else {
        m = s.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
        if (m) {
          r = Number(m[1]);
          g = Number(m[2]);
          b = Number(m[3]);
        }
      }
      const t2 = Math.max(0, Math.min(100, amount)) / 100;
      r = Math.round(r + (255 - r) * t2);
      g = Math.round(g + (255 - g) * t2);
      b = Math.round(b + (255 - b) * t2);
      return `rgb(${r}, ${g}, ${b})`;
    }
    function destroyPlot() {
      if (sparkCanvas?.parentNode) {
        sparkCanvas.parentNode.removeChild(sparkCanvas);
      }
      sparkCanvas = null;
      if (sparkHost.value) sparkHost.value.innerHTML = "";
    }
    function paintSpark() {
      const host = sparkHost.value;
      if (!host) return;
      const w = Math.max(1, Math.floor(layout.value.chartWidth));
      const h2 = Math.max(1, Math.floor(layout.value.chartHeight));
      const vals = (props.sparkline ?? []).filter((n2) => Number.isFinite(n2));
      destroyPlot();
      if (vals.length < 2 || w < 2 || h2 < 2) return;
      const mode2 = String(props.graphMode ?? "");
      const isArea = mode2 === BigValueGraphMode.Area || mode2 === "area";
      const isLine = mode2 === BigValueGraphMode.Line || mode2 === "line";
      if (!isArea && !isLine) return;
      let min = Math.min(...vals);
      let max = Math.max(...vals);
      if (min === max) {
        if (min === 0) max = 1;
        else if (min < 0) min *= 2;
        else max *= 2;
      }
      const pad = (max - min) * 0.05 || 1;
      min -= pad;
      max += pad;
      const { stroke, fill } = sparkColors();
      const dpr = typeof window !== "undefined" && window.devicePixelRatio ? window.devicePixelRatio : 1;
      const canvas = document.createElement("canvas");
      canvas.width = Math.max(1, Math.floor(w * dpr));
      canvas.height = Math.max(1, Math.floor(h2 * dpr));
      canvas.style.width = `${w}px`;
      canvas.style.height = `${h2}px`;
      canvas.style.display = "block";
      const ctx = canvas.getContext("2d");
      if (!ctx) return;
      ctx.scale(dpr, dpr);
      const n = vals.length;
      const xAt = (i) => n <= 1 ? 0 : i / (n - 1) * (w - 1);
      const yAt = (v) => {
        const t2 = (v - min) / (max - min || 1);
        return (1 - t2) * (h2 - 1);
      };
      ctx.beginPath();
      ctx.moveTo(xAt(0), yAt(vals[0]));
      for (let i = 1; i < n; i++) {
        ctx.lineTo(xAt(i), yAt(vals[i]));
      }
      if (isArea) {
        ctx.lineTo(xAt(n - 1), h2);
        ctx.lineTo(xAt(0), h2);
        ctx.closePath();
        ctx.fillStyle = fill;
        ctx.fill();
        ctx.beginPath();
        ctx.moveTo(xAt(0), yAt(vals[0]));
        for (let i = 1; i < n; i++) {
          ctx.lineTo(xAt(i), yAt(vals[i]));
        }
      }
      ctx.strokeStyle = stroke;
      ctx.lineWidth = 1.5;
      ctx.lineJoin = "round";
      ctx.lineCap = "round";
      ctx.stroke();
      host.appendChild(canvas);
      sparkCanvas = canvas;
    }
    watch(
      () => [
        layout.value.chartWidth,
        layout.value.chartHeight,
        props.sparkline,
        props.graphMode,
        props.colorMode,
        props.value.color
      ],
      () => {
        nextTick(() => paintSpark());
      },
      { deep: true }
    );
    onMounted(() => {
      nextTick(() => paintSpark());
    });
    onBeforeUnmount(() => destroyPlot());
    function pctClass() {
      const p = props.value.percentChange;
      if (p == null) return "";
      const mode2 = String(props.percentChangeColorMode ?? "standard");
      if (mode2 === "inverted") return p >= 0 ? "is-down" : "is-up";
      if (mode2 === "same_as_value") return "is-same";
      return p >= 0 ? "is-up" : "is-down";
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["big-value", {
            "is-center": layout.value.justifyCenter,
            "is-wide": layout.value.isWide,
            "has-spark": layout.value.chartHeight > 0
          }]),
          "data-testid": "big-value",
          style: normalizeStyle({
            width: `${__props.width}px`,
            height: `${__props.height}px`,
            padding: `${layout.value.panelPadding}px`,
            background: layout.value.containerBackground,
            color: layout.value.containerColor
          })
        },
        [
          createElementVNode("div", _hoisted_1$d$1, [
            layout.value.title ? (openBlock(), createElementBlock(
              "div",
              {
                key: 0,
                class: "big-value__title",
                "data-testid": "big-value-title",
                style: normalizeStyle({
                  fontSize: `${layout.value.titleFontSize}px`,
                  color: layout.value.titleColorCss
                })
              },
              toDisplayString(layout.value.title),
              5
              /* TEXT, STYLE */
            )) : createCommentVNode("v-if", true),
            createElementVNode(
              "div",
              {
                class: "big-value__value",
                "data-testid": "big-value-value",
                style: normalizeStyle({
                  fontSize: `${layout.value.valueFontSize}px`,
                  color: layout.value.valueColorCss
                })
              },
              toDisplayString(layout.value.valueText),
              5
              /* TEXT, STYLE */
            ),
            layout.value.percentText ? (openBlock(), createElementBlock(
              "div",
              {
                key: 1,
                class: normalizeClass(["big-value__percent", pctClass()]),
                "data-testid": "big-value-percent",
                style: normalizeStyle({
                  fontSize: `${layout.value.percentFontSize}px`,
                  color: String(__props.percentChangeColorMode) === "same_as_value" && __props.value.color ? __props.value.color : void 0
                })
              },
              toDisplayString(layout.value.percentText),
              7
              /* TEXT, CLASS, STYLE */
            )) : createCommentVNode("v-if", true)
          ]),
          layout.value.chartHeight > 0 && (__props.sparkline?.length ?? 0) > 1 ? (openBlock(), createElementBlock(
            "div",
            {
              key: 0,
              ref_key: "sparkHost",
              ref: sparkHost,
              class: "big-value__spark",
              "data-testid": "big-value-spark",
              style: normalizeStyle({
                width: `${Math.floor(layout.value.chartWidth)}px`,
                height: `${Math.floor(layout.value.chartHeight)}px`
              })
            },
            null,
            4
            /* STYLE */
          )) : createCommentVNode("v-if", true)
        ],
        6
        /* CLASS, STYLE */
      );
    };
  }
});
const BigValue = /* @__PURE__ */ _export_sfc$2(_sfc_main$i$1, [["__scopeId", "data-v-9ce05ad0"]]);
const _hoisted_1$c$1 = ["data-placement", "data-mode"];
const _hoisted_2$8$1 = ["data-testid", "onClick", "onMouseenter", "onMouseleave"];
const _hoisted_3$4$1 = { class: "label" };
const _hoisted_4$1$1 = {
  key: 1,
  class: "viz-legend-table",
  "data-testid": "viz-legend-table"
};
const _hoisted_5$1$1 = ["data-testid", "onClick"];
const _sfc_main$h$1 = /* @__PURE__ */ defineComponent({
  __name: "VizLegend",
  props: {
    items: {},
    placement: { default: "bottom" },
    displayMode: { default: "list" },
    readonly: { type: Boolean, default: false }
  },
  emits: ["label-click", "label-mouseover", "label-mouseout"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return __props.displayMode !== "hidden" && __props.items.length ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: "viz-legend",
        "data-testid": "viz-legend",
        "data-placement": __props.placement,
        "data-mode": __props.displayMode
      }, [
        __props.displayMode === "list" ? (openBlock(), createElementBlock(
          "ul",
          {
            key: 0,
            class: normalizeClass(["viz-legend-list", __props.placement])
          },
          [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.items, (item, i) => {
                return openBlock(), createElementBlock("li", {
                  key: item.getItemKey?.() ?? `${item.label}-${i}`,
                  class: normalizeClass(["viz-legend-item", { disabled: item.disabled }]),
                  "data-testid": `viz-legend-item-${i}`,
                  onClick: ($event) => !__props.readonly && emit("label-click", item, $event),
                  onMouseenter: ($event) => emit("label-mouseover", item, $event),
                  onMouseleave: ($event) => emit("label-mouseout", item, $event)
                }, [
                  createElementVNode(
                    "span",
                    {
                      class: "series-icon",
                      style: normalizeStyle({ background: item.color || "var(--grafana-text)" })
                    },
                    null,
                    4
                    /* STYLE */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_3$4$1,
                    toDisplayString(item.label),
                    1
                    /* TEXT */
                  )
                ], 42, _hoisted_2$8$1);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ],
          2
          /* CLASS */
        )) : (openBlock(), createElementBlock("table", _hoisted_4$1$1, [
          _cache[0] || (_cache[0] = createElementVNode(
            "thead",
            null,
            [
              createElementVNode("tr", null, [
                createElementVNode("th"),
                createElementVNode("th", null, "名称")
              ])
            ],
            -1
            /* CACHED */
          )),
          createElementVNode("tbody", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.items, (item, i) => {
                return openBlock(), createElementBlock("tr", {
                  key: item.getItemKey?.() ?? `${item.label}-${i}`,
                  class: normalizeClass({ disabled: item.disabled }),
                  "data-testid": `viz-legend-row-${i}`,
                  onClick: ($event) => !__props.readonly && emit("label-click", item, $event)
                }, [
                  createElementVNode("td", null, [
                    createElementVNode(
                      "span",
                      {
                        class: "series-icon",
                        style: normalizeStyle({
                          background: item.color || "var(--grafana-text-secondary)"
                        })
                      },
                      null,
                      4
                      /* STYLE */
                    )
                  ]),
                  createElementVNode(
                    "td",
                    null,
                    toDisplayString(item.label),
                    1
                    /* TEXT */
                  )
                ], 10, _hoisted_5$1$1);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ]))
      ], 8, _hoisted_1$c$1)) : createCommentVNode("v-if", true);
    };
  }
});
const VizLegend = /* @__PURE__ */ _export_sfc$2(_sfc_main$h$1, [["__scopeId", "data-v-eb6aadac"]]);
const _hoisted_1$b$1 = ["data-mode"];
const _hoisted_2$7$1 = { class: "viz-tooltip__wrapper" };
const _hoisted_3$3$1 = {
  key: 0,
  class: "viz-tooltip__header",
  "data-testid": "viz-tooltip-title"
};
const _hoisted_4$1S = { class: "viz-tooltip__row viz-tooltip__row--header" };
const _hoisted_5$1F = { class: "viz-tooltip__value-wrap" };
const _hoisted_6$1s = { class: "viz-tooltip__value viz-tooltip__value--header" };
const _hoisted_7$1i = ["data-testid"];
const _hoisted_8$1a = {
  key: 0,
  class: "viz-tooltip__color",
  "aria-hidden": "true"
};
const _hoisted_9$15 = { class: "viz-tooltip__label" };
const _hoisted_10$X = { class: "viz-tooltip__value-wrap" };
const _hoisted_11$S = { class: "viz-tooltip__value" };
const _sfc_main$g$1 = /* @__PURE__ */ defineComponent({
  __name: "VizTooltip",
  props: {
    title: {},
    items: { default: () => [] },
    mode: { default: "single" },
    x: { default: 0 },
    y: { default: 0 },
    visible: { type: Boolean, default: true },
    floating: { type: Boolean, default: true },
    maxWidth: {},
    maxHeight: {}
  },
  setup(__props) {
    const props = __props;
    const rootStyle = () => {
      const style = {};
      if (props.floating) {
        style.left = `${props.x}px`;
        style.top = `${props.y}px`;
        style.position = "absolute";
      } else {
        style.position = "relative";
        style.left = "auto";
        style.top = "auto";
      }
      if (props.maxWidth != null) {
        style.maxWidth = typeof props.maxWidth === "number" ? `${props.maxWidth}px` : String(props.maxWidth);
      }
      if (props.maxHeight != null) {
        style.maxHeight = typeof props.maxHeight === "number" ? `${props.maxHeight}px` : String(props.maxHeight);
      }
      return style;
    };
    return (_ctx, _cache) => {
      return __props.visible && __props.mode !== "none" && (__props.title || __props.items.length) ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: "viz-tooltip",
        "data-testid": "viz-tooltip",
        "data-mode": __props.mode,
        style: normalizeStyle(rootStyle()),
        "aria-live": "polite",
        "aria-atomic": "true"
      }, [
        createCommentVNode(" VizTooltipWrapper "),
        createElementVNode("div", _hoisted_2$7$1, [
          createCommentVNode(" VizTooltipHeader: time as value, empty label (Grafana TimeSeriesTooltip) "),
          __props.title ? (openBlock(), createElementBlock("div", _hoisted_3$3$1, [
            createElementVNode("div", _hoisted_4$1S, [
              createElementVNode("div", _hoisted_5$1F, [
                createElementVNode(
                  "div",
                  _hoisted_6$1s,
                  toDisplayString(__props.title),
                  1
                  /* TEXT */
                )
              ])
            ])
          ])) : createCommentVNode("v-if", true),
          createCommentVNode(" VizTooltipContent "),
          __props.items.length ? (openBlock(), createElementBlock(
            "div",
            {
              key: 1,
              class: normalizeClass(["viz-tooltip__content", { "viz-tooltip__content--solo": !__props.title }])
            },
            [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(__props.items, (item, i) => {
                  return openBlock(), createElementBlock("div", {
                    key: `${item.label}-${i}`,
                    class: normalizeClass(["viz-tooltip__row", { active: item.isActive }]),
                    "data-testid": `viz-tooltip-row-${i}`
                  }, [
                    item.color ? (openBlock(), createElementBlock("div", _hoisted_8$1a, [
                      createCommentVNode(" SeriesIcon: 14×4 pill "),
                      createElementVNode(
                        "span",
                        {
                          class: "viz-tooltip__series-icon",
                          "data-testid": "series-icon",
                          style: normalizeStyle({ background: item.color })
                        },
                        null,
                        4
                        /* STYLE */
                      )
                    ])) : createCommentVNode("v-if", true),
                    item.label ? (openBlock(), createElementBlock(
                      "div",
                      {
                        key: 1,
                        class: normalizeClass(["viz-tooltip__label-wrap", { active: item.isActive }])
                      },
                      [
                        createElementVNode(
                          "span",
                          _hoisted_9$15,
                          toDisplayString(item.label),
                          1
                          /* TEXT */
                        )
                      ],
                      2
                      /* CLASS */
                    )) : createCommentVNode("v-if", true),
                    createElementVNode("div", _hoisted_10$X, [
                      createElementVNode(
                        "div",
                        _hoisted_11$S,
                        toDisplayString(item.value),
                        1
                        /* TEXT */
                      )
                    ])
                  ], 10, _hoisted_7$1i);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ],
            2
            /* CLASS */
          )) : createCommentVNode("v-if", true)
        ])
      ], 12, _hoisted_1$b$1)) : createCommentVNode("v-if", true);
    };
  }
});
const VizTooltip = /* @__PURE__ */ _export_sfc$2(_sfc_main$g$1, [["__scopeId", "data-v-dbe124ce"]]);
const _sfc_main$f$1 = /* @__PURE__ */ defineComponent({
  __name: "GRadioButtonGroup",
  props: {
    options: { default: () => [] },
    value: { type: [String, Number, Boolean] },
    disabled: { type: Boolean },
    size: { default: "small" }
  },
  emits: ["update:value"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const antSize = () => props.size === "middle" ? "default" : props.size;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode("\n    Grafana RadioButtonGroup (refs/.../Forms/RadioButtonGroup):\n    - group: input border, radius.default, 2px padding; hover → input.borderHover / primary.border\n    - inactive: text.secondary; hover → text.primary\n    - active: action.selected + text.primary (NOT primary solid fill)\n  "),
          createVNode(unref(RadioGroup), {
            class: "g-radio-button-group",
            "data-testid": "g-radio-button-group",
            "button-style": "solid",
            value: __props.value,
            disabled: __props.disabled,
            size: antSize(),
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => emit("update:value", $event))
          }, {
            default: withCtx(() => [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(__props.options, (opt) => {
                  return openBlock(), createBlock(unref(RadioButton), {
                    key: String(opt.value),
                    value: opt.value,
                    disabled: opt.disabled
                  }, {
                    default: withCtx(() => [
                      createTextVNode(
                        toDisplayString(opt.label),
                        1
                        /* TEXT */
                      )
                    ]),
                    _: 2
                    /* DYNAMIC */
                  }, 1032, ["value", "disabled"]);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            _: 1
            /* STABLE */
          }, 8, ["value", "disabled", "size"])
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const GRadioButtonGroup = /* @__PURE__ */ _export_sfc$2(_sfc_main$f$1, [["__scopeId", "data-v-47e99f12"]]);
const _hoisted_1$a$1 = {
  key: 0,
  class: "req"
};
const _hoisted_2$6$1 = ["title"];
const _hoisted_3$2$1 = { class: "g-inline-field__control" };
const _sfc_main$e$1 = /* @__PURE__ */ defineComponent({
  __name: "GInlineField",
  props: {
    label: {},
    labelWidth: { default: 12 },
    tooltip: {},
    grow: { type: Boolean, default: false },
    disabled: { type: Boolean },
    required: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["g-inline-field", { grow: __props.grow, disabled: __props.disabled }]),
          "data-testid": "g-inline-field"
        },
        [
          __props.label ? (openBlock(), createElementBlock(
            "label",
            {
              key: 0,
              class: "g-inline-field__label",
              style: normalizeStyle({ width: `${__props.labelWidth * 8}px` })
            },
            [
              createTextVNode(
                toDisplayString(__props.label),
                1
                /* TEXT */
              ),
              __props.required ? (openBlock(), createElementBlock("span", _hoisted_1$a$1, "*")) : createCommentVNode("v-if", true),
              __props.tooltip ? (openBlock(), createElementBlock("span", {
                key: 1,
                class: "tip",
                title: __props.tooltip
              }, "?", 8, _hoisted_2$6$1)) : createCommentVNode("v-if", true)
            ],
            4
            /* STYLE */
          )) : createCommentVNode("v-if", true),
          createElementVNode("div", _hoisted_3$2$1, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ])
        ],
        2
        /* CLASS */
      );
    };
  }
});
const GInlineField = /* @__PURE__ */ _export_sfc$2(_sfc_main$e$1, [["__scopeId", "data-v-26f11d34"]]);
const _sfc_main$d$1 = {};
const _hoisted_1$9$1 = {
  class: "g-inline-field-row",
  "data-testid": "g-inline-field-row"
};
function _sfc_render$2(_ctx, _cache) {
  return openBlock(), createElementBlock("div", _hoisted_1$9$1, [
    renderSlot(_ctx.$slots, "default", {}, void 0, true)
  ]);
}
const GInlineFieldRow = /* @__PURE__ */ _export_sfc$2(_sfc_main$d$1, [["render", _sfc_render$2], ["__scopeId", "data-v-3f687a0d"]]);
const _sfc_main$c$1 = /* @__PURE__ */ defineComponent({
  __name: "GBadge",
  props: {
    text: {},
    color: { default: "default" },
    icon: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "span",
        {
          class: normalizeClass(["g-badge", `is-${__props.color}`]),
          "data-testid": "g-badge"
        },
        [
          renderSlot(_ctx.$slots, "default", {}, () => [
            createTextVNode(
              toDisplayString(__props.text),
              1
              /* TEXT */
            )
          ], true)
        ],
        2
        /* CLASS */
      );
    };
  }
});
const GBadge = /* @__PURE__ */ _export_sfc$2(_sfc_main$c$1, [["__scopeId", "data-v-f5754983"]]);
const _sfc_main$b$1 = /* @__PURE__ */ defineComponent({
  ...{ inheritAttrs: false },
  __name: "GTag",
  props: {
    name: {},
    color: {},
    closable: { type: Boolean }
  },
  emits: ["remove", "click"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const attrs = useAttrs();
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "span",
        mergeProps({ class: "g-tag" }, unref(attrs), {
          style: __props.color ? { background: __props.color, borderColor: __props.color } : void 0,
          onClick: _cache[1] || (_cache[1] = ($event) => emit("click"))
        }),
        [
          renderSlot(_ctx.$slots, "default", {}, () => [
            createTextVNode(
              toDisplayString(__props.name),
              1
              /* TEXT */
            )
          ], true),
          __props.closable ? (openBlock(), createElementBlock("button", {
            key: 0,
            type: "button",
            class: "g-tag__x",
            "aria-label": "remove",
            onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("remove"), ["stop"]))
          }, " × ")) : createCommentVNode("v-if", true)
        ],
        16
        /* FULL_PROPS */
      );
    };
  }
});
const GTag = /* @__PURE__ */ _export_sfc$2(_sfc_main$b$1, [["__scopeId", "data-v-f6de7a7f"]]);
const _hoisted_1$8$1 = { class: "g-alert__body" };
const _hoisted_2$5$1 = {
  key: 0,
  class: "g-alert__title"
};
const _hoisted_3$1$1 = { class: "g-alert__content" };
const _sfc_main$a$1 = /* @__PURE__ */ defineComponent({
  __name: "GAlert",
  props: {
    title: {},
    severity: { default: "info" },
    closable: { type: Boolean, default: false }
  },
  emits: ["close"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["g-alert", `is-${__props.severity}`]),
          "data-testid": "g-alert",
          role: "alert"
        },
        [
          createElementVNode("div", _hoisted_1$8$1, [
            __props.title ? (openBlock(), createElementBlock(
              "div",
              _hoisted_2$5$1,
              toDisplayString(__props.title),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true),
            createElementVNode("div", _hoisted_3$1$1, [
              renderSlot(_ctx.$slots, "default", {}, void 0, true)
            ])
          ]),
          __props.closable ? (openBlock(), createElementBlock("button", {
            key: 0,
            type: "button",
            class: "g-alert__close",
            "aria-label": "close",
            onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
          }, " × ")) : createCommentVNode("v-if", true)
        ],
        2
        /* CLASS */
      );
    };
  }
});
const GAlert = /* @__PURE__ */ _export_sfc$2(_sfc_main$a$1, [["__scopeId", "data-v-2d6964ed"]]);
const _hoisted_1$7$1 = {
  key: 0,
  class: "g-card__heading"
};
const _hoisted_2$4$1 = { class: "g-card__body" };
const _hoisted_3$29 = {
  key: 1,
  class: "g-card__actions"
};
const _sfc_main$9$1 = /* @__PURE__ */ defineComponent({
  __name: "GCard",
  props: {
    title: {},
    href: {},
    disabled: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["g-card", { disabled: __props.disabled }]),
          "data-testid": "g-card"
        },
        [
          __props.title || _ctx.$slots.heading ? (openBlock(), createElementBlock("div", _hoisted_1$7$1, [
            renderSlot(_ctx.$slots, "heading", {}, () => [
              createElementVNode(
                "h3",
                null,
                toDisplayString(__props.title),
                1
                /* TEXT */
              )
            ], true)
          ])) : createCommentVNode("v-if", true),
          createElementVNode("div", _hoisted_2$4$1, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ]),
          _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_3$29, [
            renderSlot(_ctx.$slots, "actions", {}, void 0, true)
          ])) : createCommentVNode("v-if", true)
        ],
        2
        /* CLASS */
      );
    };
  }
});
const GCard = /* @__PURE__ */ _export_sfc$2(_sfc_main$9$1, [["__scopeId", "data-v-6c13945c"]]);
const _hoisted_1$6$1 = { class: "g-confirm-body" };
const _sfc_main$8$1 = /* @__PURE__ */ defineComponent({
  __name: "GConfirmModal",
  props: {
    open: { type: Boolean },
    title: { default: "确认" },
    body: {},
    confirmText: { default: "确认" },
    cancelText: { default: "取消" },
    danger: { type: Boolean, default: false }
  },
  emits: ["update:open", "confirm", "cancel"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    function onOk() {
      emit("confirm");
      emit("update:open", false);
    }
    function onCancel() {
      emit("cancel");
      emit("update:open", false);
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GModal, {
        open: __props.open,
        title: __props.title,
        "ok-text": __props.confirmText,
        "cancel-text": __props.cancelText,
        "ok-variant": __props.danger ? "destructive" : "primary",
        "onUpdate:open": _cache[0] || (_cache[0] = ($event) => emit("update:open", $event)),
        onOk,
        onCancel
      }, {
        default: withCtx(() => [
          createElementVNode("p", _hoisted_1$6$1, [
            createTextVNode(
              toDisplayString(__props.body),
              1
              /* TEXT */
            ),
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ])
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["open", "title", "ok-text", "cancel-text", "ok-variant"]);
    };
  }
});
const GConfirmModal = /* @__PURE__ */ _export_sfc$2(_sfc_main$8$1, [["__scopeId", "data-v-1c6af13f"]]);
const _hoisted_1$5$1 = ["aria-label"];
const _hoisted_2$3$1 = {
  key: 0,
  class: "g-spinner__tip"
};
const _sfc_main$7$1 = /* @__PURE__ */ defineComponent({
  __name: "GSpinner",
  props: {
    size: { default: 24 },
    tip: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "g-spinner",
        "data-testid": "g-spinner",
        role: "status",
        "aria-label": __props.tip || "loading"
      }, [
        createElementVNode(
          "span",
          {
            class: "g-spinner__dot",
            style: normalizeStyle({ width: `${__props.size}px`, height: `${__props.size}px` })
          },
          null,
          4
          /* STYLE */
        ),
        __props.tip ? (openBlock(), createElementBlock(
          "span",
          _hoisted_2$3$1,
          toDisplayString(__props.tip),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$5$1);
    };
  }
});
const GSpinner = /* @__PURE__ */ _export_sfc$2(_sfc_main$7$1, [["__scopeId", "data-v-cce67064"]]);
const _hoisted_1$4$1 = {
  class: "g-loading-placeholder",
  "data-testid": "g-loading-placeholder"
};
const _sfc_main$6$1 = /* @__PURE__ */ defineComponent({
  __name: "GLoadingPlaceholder",
  props: {
    text: { default: "加载中…" }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$4$1, [
        createVNode(GSpinner, { tip: __props.text }, null, 8, ["tip"])
      ]);
    };
  }
});
const GLoadingPlaceholder = /* @__PURE__ */ _export_sfc$2(_sfc_main$6$1, [["__scopeId", "data-v-9a6e540c"]]);
const _sfc_main$5$1 = /* @__PURE__ */ defineComponent({
  __name: "GPagination",
  props: {
    current: { default: 1 },
    pageSize: { default: 10 },
    total: { default: 0 },
    showSizeChanger: { type: Boolean, default: false }
  },
  emits: ["update:current", "update:pageSize", "change"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Pagination), {
        class: "g-pagination",
        "data-testid": "g-pagination",
        current: __props.current,
        "page-size": __props.pageSize,
        total: __props.total,
        "show-size-changer": __props.showSizeChanger,
        size: "small",
        onChange: _cache[0] || (_cache[0] = (p, ps) => {
          emit("update:current", p);
          emit("update:pageSize", ps);
          emit("change", p, ps);
        })
      }, null, 8, ["current", "page-size", "total", "show-size-changer"]);
    };
  }
});
const _hoisted_1$3$1 = {
  class: "g-segment-input",
  "data-testid": "g-segment-input"
};
const _hoisted_2$2$1 = {
  key: 0,
  class: "g-segment-input__label"
};
const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
  __name: "GSegmentInput",
  props: {
    label: { default: "" },
    value: {},
    placeholder: { default: "" },
    disabled: { type: Boolean }
  },
  emits: ["update:value", "change"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    function onUpdate(v) {
      emit("update:value", v);
      emit("change", v);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$3$1, [
        __props.label ? (openBlock(), createElementBlock(
          "span",
          _hoisted_2$2$1,
          toDisplayString(__props.label),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createVNode(GInput, {
          value: __props.value,
          placeholder: __props.placeholder,
          disabled: __props.disabled,
          "onUpdate:value": onUpdate
        }, null, 8, ["value", "placeholder", "disabled"])
      ]);
    };
  }
});
const GSegmentInput = /* @__PURE__ */ _export_sfc$2(_sfc_main$4$1, [["__scopeId", "data-v-3e78c1a4"]]);
const _hoisted_1$2$1 = {
  class: "g-toggletip__body",
  "data-testid": "g-toggletip-content"
};
const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
  __name: "GToggletip",
  props: {
    title: {},
    content: {},
    placement: { default: "bottom" }
  },
  setup(__props) {
    const open = ref(false);
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Popover), {
        open: open.value,
        "onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event),
        title: __props.title,
        placement: __props.placement,
        trigger: "click"
      }, {
        content: withCtx(() => [
          createElementVNode("div", _hoisted_1$2$1, [
            renderSlot(_ctx.$slots, "content", {}, () => [
              createTextVNode(
                toDisplayString(__props.content),
                1
                /* TEXT */
              )
            ], true)
          ])
        ]),
        default: withCtx(() => [
          createElementVNode("button", {
            type: "button",
            class: "g-toggletip__trigger",
            "data-testid": "g-toggletip",
            onClick: _cache[0] || (_cache[0] = withModifiers(() => {
            }, ["stop"]))
          }, [
            renderSlot(_ctx.$slots, "default", {}, () => [
              _cache[2] || (_cache[2] = createTextVNode(
                "ⓘ",
                -1
                /* CACHED */
              ))
            ], true)
          ])
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["open", "title", "placement"]);
    };
  }
});
const GToggletip = /* @__PURE__ */ _export_sfc$2(_sfc_main$3$1, [["__scopeId", "data-v-85150d58"]]);
const _hoisted_1$1$1 = {
  class: "g-popover__body",
  "data-testid": "g-popover-content"
};
const _hoisted_2$1$1 = { "data-testid": "g-popover" };
const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
  __name: "GPopover",
  props: {
    title: {},
    content: {},
    open: { type: Boolean },
    placement: { default: "top" },
    trigger: { default: "hover" }
  },
  emits: ["update:open"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(Popover), {
        open: __props.open,
        title: __props.title,
        placement: __props.placement,
        trigger: __props.trigger,
        "overlay-class-name": "g-popover-overlay",
        "onUpdate:open": _cache[0] || (_cache[0] = ($event) => emit("update:open", $event))
      }, {
        content: withCtx(() => [
          createElementVNode("div", _hoisted_1$1$1, [
            renderSlot(_ctx.$slots, "content", {}, () => [
              createTextVNode(
                toDisplayString(__props.content),
                1
                /* TEXT */
              )
            ], true)
          ])
        ]),
        default: withCtx(() => [
          createElementVNode("span", _hoisted_2$1$1, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ])
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["open", "title", "placement", "trigger"]);
    };
  }
});
const GPopover = /* @__PURE__ */ _export_sfc$2(_sfc_main$2$1, [["__scopeId", "data-v-9daab7e0"]]);
const _hoisted_1$2W = ["data-mode"];
const _hoisted_2$2p = ["value", "disabled"];
const _sfc_main$1$1 = /* @__PURE__ */ defineComponent({
  __name: "GDatePicker",
  props: {
    value: {},
    placeholder: { default: "时间" },
    allowRelative: { type: Boolean, default: true },
    disabled: { type: Boolean }
  },
  emits: ["update:value", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const isRelative = computed(() => {
      const v = props.value || "";
      return !v || /^now/i.test(v) || v.includes("$") || Number.isNaN(Date.parse(v));
    });
    function onUpdate(v) {
      emit("update:value", v);
      emit("change", v);
    }
    function toLocalInput(iso) {
      if (!iso) return "";
      const d = new Date(iso);
      if (Number.isNaN(d.getTime())) return "";
      const pad = (n) => String(n).padStart(2, "0");
      return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
    }
    function fromLocalInput(local) {
      if (!local) return "";
      const d = new Date(local);
      return Number.isNaN(d.getTime()) ? local : d.toISOString();
    }
    const mode2 = computed(() => isRelative.value ? "relative" : "absolute");
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "g-date-picker",
        "data-testid": "g-date-picker",
        "data-mode": mode2.value
      }, [
        mode2.value === "relative" ? (openBlock(), createBlock(unref(Input), {
          key: 0,
          value: __props.value,
          placeholder: `${__props.placeholder} (now-6h)`,
          disabled: __props.disabled,
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => onUpdate(String($event ?? "")))
        }, null, 8, ["value", "placeholder", "disabled"])) : (openBlock(), createElementBlock("input", {
          key: 1,
          type: "datetime-local",
          class: "g-date-picker__abs",
          value: toLocalInput(__props.value),
          disabled: __props.disabled,
          onInput: _cache[1] || (_cache[1] = ($event) => onUpdate(fromLocalInput($event.target.value)))
        }, null, 40, _hoisted_2$2p)),
        __props.allowRelative ? (openBlock(), createElementBlock(
          "button",
          {
            key: 2,
            type: "button",
            class: "g-date-picker__toggle",
            "data-testid": "g-date-picker-toggle",
            onClick: _cache[2] || (_cache[2] = ($event) => onUpdate(mode2.value === "relative" ? (/* @__PURE__ */ new Date()).toISOString() : "now-6h"))
          },
          toDisplayString(mode2.value === "relative" ? "绝对" : "相对"),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2W);
    };
  }
});
const GDatePicker = /* @__PURE__ */ _export_sfc$2(_sfc_main$1$1, [["__scopeId", "data-v-8be2ba11"]]);
const _sfc_main$3T = /* @__PURE__ */ defineComponent({
  __name: "GSkeleton",
  props: {
    width: { default: "100%" },
    height: { default: "1rem" },
    radius: { default: 4 },
    block: { type: Boolean, default: true }
  },
  setup(__props) {
    function dim(v) {
      return typeof v === "number" ? `${v}px` : v;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "span",
        {
          class: normalizeClass(["g-skeleton", { "g-skeleton--block": __props.block }]),
          style: normalizeStyle({
            width: dim(__props.width),
            height: dim(__props.height),
            borderRadius: dim(__props.radius)
          }),
          "data-testid": "g-skeleton",
          "aria-hidden": "true"
        },
        null,
        6
        /* CLASS, STYLE */
      );
    };
  }
});
const GSkeleton = /* @__PURE__ */ _export_sfc$2(_sfc_main$3T, [["__scopeId", "data-v-f7f9890c"]]);
const PANEL_IDS = [
  "alexanderzobnin-zabbix-triggers-panel",
  "signoz-issues",
  "text",
  "news",
  "dashlist",
  "annolist",
  "gettingstarted",
  "welcome",
  "stat",
  "gauge",
  "bargauge",
  "table",
  "logs",
  "logstable",
  "histogram",
  "timeseries",
  "barchart",
  "piechart",
  "candlestick",
  "trend",
  "state-timeline",
  "status-history",
  "heatmap",
  "geomap",
  "nodeGraph",
  "xychart",
  "canvas",
  "traces",
  "flamegraph",
  "live",
  "debug",
  "alertlist",
  "clock",
  "statusmap",
  "polystat",
  "button",
  "dynamictext",
  "gantt",
  "sankey",
  "radar",
  "funnel",
  "wordcloud",
  "treemap",
  "hourly-heatmap"
];
function applyGenericTypeMigration(panel2) {
  const type = panel2.type === "graph" ? "timeseries" : panel2.type === "singlestat" ? "stat" : panel2.type;
  let options = { ...panel2.options ?? {} };
  const fieldConfig = panel2.fieldConfig ?? { defaults: {}, overrides: [] };
  if (type === "text" && options.content == null && panel2.content != null) {
    options = {
      ...options,
      content: panel2.content,
      mode: panel2.mode ?? "markdown"
    };
  }
  if (type === "stat" || type === "gauge" || type === "bargauge") {
    options = {
      reduceOptions: { calcs: ["lastNotNull"], fields: "", values: false },
      orientation: "auto",
      ...options
    };
  }
  if (type === "timeseries") {
    options = {
      legend: { displayMode: "list", placement: "bottom", showLegend: true },
      tooltip: { mode: "single", sort: "none" },
      ...options
    };
  }
  if (type === "table") {
    options = { showHeader: true, cellHeight: "sm", ...options };
  }
  return {
    ...panel2,
    type,
    options,
    fieldConfig
  };
}
function ensurePanelShape(panel2, fallback) {
  const id = typeof panel2.id === "number" ? panel2.id : fallback.id;
  const type = typeof panel2.type === "string" && panel2.type ? panel2.type : fallback.type;
  const options = panel2.options && typeof panel2.options === "object" ? panel2.options : fallback.options ?? {};
  const fieldConfig = panel2.fieldConfig && typeof panel2.fieldConfig === "object" ? panel2.fieldConfig : fallback.fieldConfig ?? { defaults: {}, overrides: [] };
  return {
    ...panel2,
    id: id ?? fallback.id,
    type,
    options,
    fieldConfig: fieldConfig ?? fallback.fieldConfig
  };
}
function migratePanelModel(panel2) {
  let next = applyGenericTypeMigration(panel2);
  const plugin2 = getPanelPlugin(next.type);
  if (plugin2?.migratePanel) {
    try {
      const migrated = plugin2.migratePanel(structuredClone(next));
      next = ensurePanelShape(migrated, next);
    } catch (error) {
      const message2 = error instanceof Error ? error.message : String(error);
      next = {
        ...next,
        // public zh-Hans notice; do not drop targets/datasource
        migrationNotice: `面板迁移失败：${message2}`
      };
    }
  }
  if (plugin2?.migrateOptions) {
    try {
      const result = plugin2.migrateOptions({ ...next.options ?? {} }, next.fieldConfig);
      next = {
        ...next,
        options: result.options,
        fieldConfig: result.fieldConfig ?? next.fieldConfig
      };
    } catch (error) {
      const message2 = error instanceof Error ? error.message : String(error);
      next = {
        ...next,
        migrationNotice: `面板选项迁移失败：${message2}`
      };
    }
  }
  return next;
}
function migrateDashboardPanels(panels2 = []) {
  return panels2.map(migratePanelModel);
}
const panelHostKey = /* @__PURE__ */ Symbol("grafana-panel-host");
const _hoisted_1$2V = ["data-panel-type"];
const _hoisted_2$2o = ["data-panel-type"];
const _hoisted_3$28 = {
  key: 0,
  class: "panel-chrome__loading-bar",
  "data-testid": "panel-loading",
  role: "status",
  "aria-label": "面板加载中"
};
const _hoisted_4$1R = {
  key: 1,
  class: "panel-chrome__header"
};
const _hoisted_5$1E = ["title", "aria-label"];
const _hoisted_6$1r = ["title"];
const _hoisted_7$1h = {
  key: 2,
  class: "panel-chrome__title-spacer",
  "aria-hidden": "true"
};
const _hoisted_8$19 = ["title"];
const _hoisted_9$14 = { class: "panel-chrome__time-info-text" };
const _hoisted_10$W = ["title", "aria-label"];
const _hoisted_11$R = ["data-link-count"];
const _hoisted_12$K = ["href", "title", "aria-label", "target", "rel"];
const _hoisted_13$J = {
  key: 1,
  class: "panel-chrome__links-menu-wrap"
};
const _hoisted_14$E = ["aria-expanded"];
const _hoisted_15$z = {
  key: 0,
  class: "panel-chrome__links-menu",
  "data-testid": "panel-links-menu",
  role: "menu"
};
const _hoisted_16$w = ["data-testid", "href", "title", "target", "rel"];
const _hoisted_17$u = {
  key: 6,
  type: "button",
  class: "icon-btn panel-loading-indicator",
  "data-testid": "panel-loading-indicator",
  title: "刷新中",
  "aria-label": "刷新中",
  tabindex: "-1"
};
const _hoisted_18$u = { class: "panel-chrome__actions" };
const _hoisted_19$s = ["title", "aria-label"];
const _hoisted_20$q = { class: "menu-wrap" };
const _hoisted_21$i = ["aria-expanded"];
const _hoisted_22$e = {
  key: 0,
  role: "none"
};
const _hoisted_23$b = { class: "menu-label" };
const _hoisted_24$b = {
  key: 1,
  role: "none"
};
const _hoisted_25$9 = ["aria-expanded"];
const _hoisted_26$8 = {
  key: 0,
  class: "submenu",
  "data-testid": "panel-menu-share-submenu",
  role: "menu"
};
const _hoisted_27$7 = { role: "none" };
const _hoisted_28$7 = { role: "none" };
const _hoisted_29$7 = { role: "none" };
const _hoisted_30$7 = { role: "none" };
const _hoisted_31$7 = { role: "none" };
const _hoisted_32$6 = ["aria-expanded"];
const _hoisted_33$6 = {
  key: 0,
  class: "submenu",
  "data-testid": "panel-menu-inspect-submenu",
  role: "menu"
};
const _hoisted_34$6 = { role: "none" };
const _hoisted_35$5 = { role: "none" };
const _hoisted_36$4 = { role: "none" };
const _hoisted_37$4 = { role: "none" };
const _hoisted_38$3 = {
  role: "none",
  class: "menu-hidden-alias",
  "aria-hidden": "true",
  style: { "display": "none" }
};
const _hoisted_39$2 = { role: "none" };
const _hoisted_40$2 = { role: "none" };
const _hoisted_41$2 = { role: "none" };
const _hoisted_42$2 = { role: "none" };
const _hoisted_43$2 = {
  key: 2,
  role: "none"
};
const _hoisted_44$2 = { role: "none" };
const _hoisted_45$2 = {
  key: 3,
  role: "none"
};
const _hoisted_46$2 = {
  key: 4,
  role: "none"
};
const _hoisted_47$2 = { role: "none" };
const _hoisted_48$2 = {
  key: 5,
  role: "none"
};
const _hoisted_49$2 = {
  key: 6,
  role: "none"
};
const _hoisted_50$2 = { role: "none" };
const _hoisted_51$2 = {
  key: 7,
  role: "none"
};
const _hoisted_52$2 = { class: "menu-label" };
const _hoisted_53$2 = {
  key: 8,
  role: "none"
};
const _hoisted_54$2 = { class: "panel-chrome__body" };
const _hoisted_55$2 = {
  key: 0,
  class: "panel-chrome__error",
  "data-testid": "panel-error",
  role: "alert",
  "aria-live": "assertive"
};
const _hoisted_56$2 = {
  key: 1,
  class: "panel-chrome__empty",
  "data-testid": "panel-no-data",
  role: "status",
  "aria-live": "polite"
};
const _hoisted_57$2 = { class: "empty-inner" };
const _hoisted_58$2 = {
  key: 2,
  class: "panel-chrome__content"
};
const _sfc_main$3S = /* @__PURE__ */ defineComponent({
  __name: "PanelChrome",
  props: {
    title: {},
    description: {},
    timeInfo: {},
    links: {},
    loading: { type: Boolean },
    hasStaleData: { type: Boolean },
    error: {},
    transparent: { type: Boolean },
    width: {},
    height: {},
    panelType: {},
    editable: { type: Boolean, default: false },
    canEdit: { type: Boolean, default: false },
    noData: { type: Boolean },
    noDataText: {},
    isLibraryPanel: { type: Boolean },
    isEditing: { type: Boolean, default: false },
    isViewing: { type: Boolean, default: false }
  },
  emits: ["inspect", "fullscreen", "edit", "view", "duplicate", "remove", "share", "explore", "copy", "toggleLegend", "help", "copyStyles", "pasteStyles", "timeSettings", "libraryPanel", "unlinkLibrary", "alertRule"],
  setup(__props, { emit: __emit }) {
    const nestedUnderHost = inject(panelHostKey, null) != null;
    const emit = __emit;
    const menuOpen = ref(false);
    const linksMenuOpen = ref(false);
    const linksMenuBtnRef = ref(null);
    const menuFocusIndex = ref(0);
    const menuBtnRef = ref(null);
    const menuRootRef = ref(null);
    function onDocPointerDown(ev) {
      const target = ev.target;
      if (menuOpen.value) {
        const root = menuRootRef.value;
        const btn = menuBtnRef.value;
        if (!(root && target && root.contains(target)) && !(btn && target && btn.contains(target))) {
          menuOpen.value = false;
        }
      }
      if (linksMenuOpen.value) {
        const btn = linksMenuBtnRef.value;
        const wrap = btn?.closest?.(".panel-chrome__links");
        if (!(wrap && target && wrap.contains(target))) {
          linksMenuOpen.value = false;
        }
      }
    }
    function restoreMenuTriggerFocus() {
      queueMicrotask(() => menuBtnRef.value?.focus());
    }
    function menuItems() {
      const root = menuRootRef.value;
      if (!root) return [];
      return Array.from(root.querySelectorAll('[role="menuitem"]')).filter(
        (el) => !el.disabled && el.offsetParent != null
      );
    }
    function focusMenuItem(i) {
      const items = menuItems();
      if (!items.length) return;
      const idx = (i % items.length + items.length) % items.length;
      menuFocusIndex.value = idx;
      items[idx]?.focus();
    }
    function onMenuKeydown(e) {
      if (!menuOpen.value) return;
      const items = menuItems();
      if (!items.length) return;
      if (e.key === "Escape") {
        e.preventDefault();
        menuOpen.value = false;
        restoreMenuTriggerFocus();
        return;
      }
      if (e.key === "ArrowDown") {
        e.preventDefault();
        focusMenuItem(menuFocusIndex.value + 1);
      } else if (e.key === "ArrowUp") {
        e.preventDefault();
        focusMenuItem(menuFocusIndex.value - 1);
      } else if (e.key === "Home") {
        e.preventDefault();
        focusMenuItem(0);
      } else if (e.key === "End") {
        e.preventDefault();
        focusMenuItem(items.length - 1);
      }
    }
    const shareSubOpen = ref(false);
    const inspectSubOpen = ref(false);
    const menuStyle = ref({});
    function positionMenu() {
      const btn = menuBtnRef.value;
      if (!btn) return;
      const r = btn.getBoundingClientRect();
      const menuW = 200;
      let left = r.right - menuW;
      if (left < 8) left = 8;
      if (left + menuW > window.innerWidth - 8) {
        left = Math.max(8, window.innerWidth - menuW - 8);
      }
      const top = r.bottom + 4;
      menuStyle.value = {
        position: "fixed",
        top: `${Math.round(top)}px`,
        left: `${Math.round(left)}px`,
        zIndex: "12000000",
        minWidth: `${menuW}px`
      };
    }
    async function refineMenuPosition() {
      positionMenu();
      await nextTick();
      const menu = menuRootRef.value;
      const btn = menuBtnRef.value;
      if (!menu || !btn) return;
      const mr = menu.getBoundingClientRect();
      const br = btn.getBoundingClientRect();
      const next = { ...menuStyle.value };
      if (mr.bottom > window.innerHeight - 8) {
        const flipped = Math.max(8, br.top - mr.height - 4);
        next.top = `${Math.round(flipped)}px`;
      }
      if (mr.right > window.innerWidth - 8) {
        next.left = `${Math.round(Math.max(8, window.innerWidth - mr.width - 8))}px`;
      }
      menuStyle.value = next;
    }
    function onViewportChange() {
      if (menuOpen.value) menuOpen.value = false;
    }
    watch(menuOpen, async (open) => {
      if (!open) {
        shareSubOpen.value = false;
        inspectSubOpen.value = false;
        restoreMenuTriggerFocus();
        return;
      }
      menuFocusIndex.value = 0;
      await refineMenuPosition();
      queueMicrotask(() => focusMenuItem(0));
    });
    onMounted(() => {
      document.addEventListener("pointerdown", onDocPointerDown, true);
      window.addEventListener("resize", onViewportChange);
      window.addEventListener("scroll", onViewportChange, true);
    });
    onBeforeUnmount(() => {
      document.removeEventListener("pointerdown", onDocPointerDown, true);
      window.removeEventListener("resize", onViewportChange);
      window.removeEventListener("scroll", onViewportChange, true);
    });
    function pick(action) {
      menuOpen.value = false;
      shareSubOpen.value = false;
      inspectSubOpen.value = false;
      emit(action);
    }
    function pickShare(mode2 = "link") {
      menuOpen.value = false;
      shareSubOpen.value = false;
      inspectSubOpen.value = false;
      emit("share", mode2);
    }
    function pickInspect(tab = "data") {
      menuOpen.value = false;
      shareSubOpen.value = false;
      inspectSubOpen.value = false;
      emit("inspect", tab);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode(" Nested under PanelHost: content only, host owns the single frame "),
          nestedUnderHost ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: "panel-chrome panel-chrome--nested",
            "data-testid": "panel-chrome-nested",
            "data-panel-type": __props.panelType,
            style: normalizeStyle({
              width: __props.width ? `${__props.width}px` : "100%",
              height: __props.height ? `${__props.height}px` : "100%"
            })
          }, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ], 12, _hoisted_1$2V)) : (openBlock(), createElementBlock("section", {
            key: 1,
            class: normalizeClass(["panel-chrome", {
              "is-transparent": __props.transparent,
              "is-loading": __props.loading,
              "has-error": !!__props.error,
              "is-empty": __props.noData && !__props.loading && !__props.error,
              "is-menu-open": menuOpen.value,
              "is-editable": __props.editable,
              "is-viewing": __props.isViewing
            }]),
            "data-panel-type": __props.panelType,
            "data-testid": "panel-chrome",
            style: normalizeStyle({
              width: __props.width ? `${__props.width}px` : "100%",
              height: __props.height ? `${__props.height}px` : "100%"
            })
          }, [
            createCommentVNode(" Grafana LoadingBar: top 1px accent sweep, delayed so fast queries stay quiet "),
            __props.loading ? (openBlock(), createElementBlock("div", _hoisted_3$28, [..._cache[39] || (_cache[39] = [
              createElementVNode(
                "div",
                {
                  class: "panel-chrome__loading-bar-inner",
                  "aria-hidden": "true"
                },
                null,
                -1
                /* CACHED */
              )
            ])])) : createCommentVNode("v-if", true),
            __props.title || __props.description || __props.error || __props.loading || __props.timeInfo || __props.links && __props.links.length ? (openBlock(), createElementBlock("header", _hoisted_4$1R, [
              createCommentVNode(" Grafana PanelStatus: destructive chip opens inspect error tab "),
              __props.error ? (openBlock(), createElementBlock("button", {
                key: 0,
                type: "button",
                class: "panel-status-btn",
                "data-testid": "panel-status",
                "data-grafana-action": "inspect-error",
                title: __props.error,
                "aria-label": __props.error || "面板状态",
                onClick: _cache[0] || (_cache[0] = ($event) => pickInspect("error"))
              }, [
                createVNode(unref(GIcon), {
                  name: "exclamation-triangle",
                  size: 14
                })
              ], 8, _hoisted_5$1E)) : createCommentVNode("v-if", true),
              __props.title ? (openBlock(), createElementBlock("span", {
                key: 1,
                class: "panel-chrome__title",
                title: __props.title
              }, toDisplayString(__props.title), 9, _hoisted_6$1r)) : (openBlock(), createElementBlock("span", _hoisted_7$1h)),
              createCommentVNode(" Grafana PanelTimeRangeRenderer TitleItem clock + timeInfo "),
              __props.timeInfo ? (openBlock(), createElementBlock("span", {
                key: 3,
                class: "panel-chrome__time-info",
                "data-testid": "panel-time-info",
                title: __props.timeInfo
              }, [
                createVNode(unref(GIcon), {
                  name: "clock",
                  size: 12
                }),
                createElementVNode(
                  "span",
                  _hoisted_9$14,
                  toDisplayString(__props.timeInfo),
                  1
                  /* TEXT */
                )
              ], 8, _hoisted_8$19)) : createCommentVNode("v-if", true),
              __props.description ? (openBlock(), createElementBlock("button", {
                key: 4,
                type: "button",
                class: "icon-btn panel-chrome__desc",
                "data-testid": "panel-description-info",
                title: __props.description,
                "aria-label": __props.description
              }, [
                createVNode(unref(GIcon), {
                  name: "info-circle",
                  size: 14
                })
              ], 8, _hoisted_10$W)) : createCommentVNode("v-if", true),
              createCommentVNode(" Grafana VizPanelLinks: 1 link → TitleItem; N → dropdown "),
              __props.links && __props.links.length ? (openBlock(), createElementBlock("div", {
                key: 5,
                class: "panel-chrome__links",
                "data-testid": "panel-links",
                "data-link-count": String(__props.links.length)
              }, [
                __props.links.length === 1 ? (openBlock(), createElementBlock("a", {
                  key: 0,
                  class: "icon-btn panel-chrome__link",
                  "data-testid": "panel-link-0",
                  href: __props.links[0].href,
                  title: __props.links[0].title,
                  "aria-label": __props.links[0].title || "面板链接",
                  target: __props.links[0].targetBlank === false ? void 0 : "_blank",
                  rel: __props.links[0].targetBlank === false ? void 0 : "noopener noreferrer"
                }, [
                  createVNode(unref(GIcon), {
                    name: "external-link-alt",
                    size: 14
                  })
                ], 8, _hoisted_12$K)) : (openBlock(), createElementBlock("div", _hoisted_13$J, [
                  createElementVNode("button", {
                    ref_key: "linksMenuBtnRef",
                    ref: linksMenuBtnRef,
                    type: "button",
                    class: "icon-btn panel-chrome__link",
                    "data-testid": "panel-links-menu-btn",
                    title: "面板链接",
                    "aria-label": "面板链接",
                    "aria-expanded": linksMenuOpen.value,
                    "aria-haspopup": "menu",
                    onClick: _cache[1] || (_cache[1] = withModifiers(($event) => linksMenuOpen.value = !linksMenuOpen.value, ["stop"]))
                  }, [
                    createVNode(unref(GIcon), {
                      name: "external-link-alt",
                      size: 14
                    })
                  ], 8, _hoisted_14$E),
                  linksMenuOpen.value ? (openBlock(), createElementBlock("ul", _hoisted_15$z, [
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(__props.links, (link, i) => {
                        return openBlock(), createElementBlock("li", {
                          key: i,
                          role: "none"
                        }, [
                          createElementVNode("a", {
                            class: "panel-chrome__links-menu-item",
                            role: "menuitem",
                            "data-testid": `panel-link-${i}`,
                            href: link.href,
                            title: link.title,
                            target: link.targetBlank === false ? void 0 : "_blank",
                            rel: link.targetBlank === false ? void 0 : "noopener noreferrer",
                            onClick: _cache[2] || (_cache[2] = ($event) => linksMenuOpen.value = false)
                          }, toDisplayString(link.title), 9, _hoisted_16$w)
                        ]);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ])) : createCommentVNode("v-if", true)
                ]))
              ], 8, _hoisted_11$R)) : createCommentVNode("v-if", true),
              createCommentVNode(" Grafana LoadingIndicator: header sync spinner while refreshing "),
              __props.loading ? (openBlock(), createElementBlock("button", _hoisted_17$u, [
                createVNode(unref(GIcon), {
                  name: "sync",
                  size: 12,
                  class: "panel-loading-indicator__icon"
                })
              ])) : createCommentVNode("v-if", true),
              createElementVNode("div", _hoisted_18$u, [
                createElementVNode("button", {
                  type: "button",
                  class: "icon-btn",
                  "data-testid": "panel-inspect-btn",
                  title: "检查",
                  "aria-label": "检查",
                  onClick: _cache[3] || (_cache[3] = ($event) => pickInspect("data"))
                }, [
                  createVNode(unref(GIcon), {
                    name: "inspect",
                    size: 14
                  })
                ]),
                !__props.editable && !__props.isEditing ? (openBlock(), createElementBlock("button", {
                  key: 0,
                  type: "button",
                  class: "icon-btn",
                  "data-testid": "panel-fullscreen-btn",
                  title: __props.isViewing ? "退出查看" : "全屏",
                  "aria-label": __props.isViewing ? "退出查看" : "全屏",
                  onClick: _cache[4] || (_cache[4] = ($event) => pick(__props.isViewing ? "view" : "fullscreen"))
                }, [
                  createVNode(unref(GIcon), {
                    name: "fullscreen",
                    size: 14
                  })
                ], 8, _hoisted_19$s)) : createCommentVNode("v-if", true),
                createElementVNode("div", _hoisted_20$q, [
                  createElementVNode("button", {
                    ref_key: "menuBtnRef",
                    ref: menuBtnRef,
                    type: "button",
                    class: "icon-btn",
                    "data-testid": "panel-menu-btn",
                    title: "面板菜单",
                    "aria-label": "面板菜单",
                    "aria-expanded": menuOpen.value,
                    "aria-haspopup": "menu",
                    onClick: _cache[5] || (_cache[5] = ($event) => menuOpen.value = !menuOpen.value)
                  }, [
                    createVNode(unref(GIcon), {
                      name: "more",
                      size: 14
                    })
                  ], 8, _hoisted_21$i),
                  (openBlock(), createBlock(Teleport, { to: "body" }, [
                    menuOpen.value ? (openBlock(), createElementBlock(
                      "ul",
                      {
                        key: 0,
                        ref_key: "menuRootRef",
                        ref: menuRootRef,
                        class: "menu",
                        "data-testid": "panel-menu",
                        "data-grafana-panel-menu": "1",
                        role: "menu",
                        style: normalizeStyle(menuStyle.value),
                        onMouseleave: _cache[38] || (_cache[38] = ($event) => menuOpen.value = false),
                        onKeydown: onMenuKeydown
                      },
                      [
                        !__props.editable && !__props.isEditing ? (openBlock(), createElementBlock("li", _hoisted_22$e, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-view",
                            "data-grafana-action": "view",
                            onClick: _cache[6] || (_cache[6] = ($event) => pick("view"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "fullscreen",
                              size: 12
                            }),
                            createElementVNode(
                              "span",
                              _hoisted_23$b,
                              toDisplayString(__props.isViewing ? "退出查看" : "查看"),
                              1
                              /* TEXT */
                            ),
                            _cache[40] || (_cache[40] = createElementVNode(
                              "span",
                              { class: "menu-sc" },
                              "v",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        __props.canEdit !== false ? (openBlock(), createElementBlock("li", _hoisted_24$b, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-edit",
                            "data-grafana-action": "edit",
                            onClick: _cache[7] || (_cache[7] = ($event) => pick("edit"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "edit",
                              size: 12
                            }),
                            _cache[41] || (_cache[41] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "编辑",
                              -1
                              /* CACHED */
                            )),
                            _cache[42] || (_cache[42] = createElementVNode(
                              "span",
                              { class: "menu-sc" },
                              "e",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        createElementVNode(
                          "li",
                          {
                            class: "menu-item-has-sub",
                            role: "none",
                            "data-testid": "panel-menu-share-wrap",
                            onMouseenter: _cache[12] || (_cache[12] = ($event) => shareSubOpen.value = true),
                            onMouseleave: _cache[13] || (_cache[13] = ($event) => shareSubOpen.value = false)
                          },
                          [
                            createElementVNode("button", {
                              type: "button",
                              role: "menuitem",
                              "data-testid": "panel-menu-share",
                              "data-grafana-action": "share",
                              "aria-haspopup": "true",
                              "aria-expanded": shareSubOpen.value,
                              onClick: _cache[8] || (_cache[8] = ($event) => shareSubOpen.value = !shareSubOpen.value)
                            }, [
                              createVNode(unref(GIcon), {
                                name: "share",
                                size: 12
                              }),
                              _cache[43] || (_cache[43] = createElementVNode(
                                "span",
                                { class: "menu-label" },
                                "分享",
                                -1
                                /* CACHED */
                              )),
                              _cache[44] || (_cache[44] = createElementVNode(
                                "span",
                                {
                                  class: "menu-caret",
                                  "aria-hidden": "true"
                                },
                                "›",
                                -1
                                /* CACHED */
                              ))
                            ], 8, _hoisted_25$9),
                            shareSubOpen.value ? (openBlock(), createElementBlock("ul", _hoisted_26$8, [
                              createElementVNode("li", _hoisted_27$7, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-share-link",
                                  "data-grafana-action": "share-link",
                                  "data-grafana-share-view": "link",
                                  onClick: _cache[9] || (_cache[9] = ($event) => pickShare("link"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "link",
                                    size: 12
                                  }),
                                  _cache[45] || (_cache[45] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "分享链接",
                                    -1
                                    /* CACHED */
                                  )),
                                  _cache[46] || (_cache[46] = createElementVNode(
                                    "span",
                                    { class: "menu-sc" },
                                    "p u",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_28$7, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-share-embed",
                                  "data-grafana-action": "share-embed",
                                  "data-grafana-share-view": "embed",
                                  onClick: _cache[10] || (_cache[10] = ($event) => pickShare("embed"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "share",
                                    size: 12
                                  }),
                                  _cache[47] || (_cache[47] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "分享嵌入",
                                    -1
                                    /* CACHED */
                                  )),
                                  _cache[48] || (_cache[48] = createElementVNode(
                                    "span",
                                    { class: "menu-sc" },
                                    "p e",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_29$7, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-share-snapshot",
                                  "data-grafana-action": "share-snapshot",
                                  "data-grafana-share-view": "snapshot",
                                  onClick: _cache[11] || (_cache[11] = ($event) => pickShare("snapshot"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "camera",
                                    size: 12
                                  }),
                                  _cache[49] || (_cache[49] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "分享快照",
                                    -1
                                    /* CACHED */
                                  )),
                                  _cache[50] || (_cache[50] = createElementVNode(
                                    "span",
                                    { class: "menu-sc" },
                                    "p s",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ])
                            ])) : createCommentVNode("v-if", true)
                          ],
                          32
                          /* NEED_HYDRATION */
                        ),
                        createElementVNode("li", _hoisted_30$7, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-explore",
                            "data-grafana-action": "explore",
                            onClick: _cache[14] || (_cache[14] = ($event) => pick("explore"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "share",
                              size: 12
                            }),
                            _cache[51] || (_cache[51] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "探索",
                              -1
                              /* CACHED */
                            )),
                            _cache[52] || (_cache[52] = createElementVNode(
                              "span",
                              { class: "menu-sc" },
                              "p x",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ]),
                        createElementVNode("li", _hoisted_31$7, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-time",
                            "data-grafana-action": "timeSettings",
                            onClick: _cache[15] || (_cache[15] = ($event) => pick("timeSettings"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "clock",
                              size: 12
                            }),
                            _cache[53] || (_cache[53] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "时间设置",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ]),
                        _cache[77] || (_cache[77] = createElementVNode(
                          "li",
                          {
                            class: "menu-sep",
                            role: "separator",
                            "data-testid": "panel-menu-sep-inspect"
                          },
                          null,
                          -1
                          /* CACHED */
                        )),
                        createElementVNode(
                          "li",
                          {
                            class: "menu-item-has-sub",
                            role: "none",
                            "data-testid": "panel-menu-inspect-wrap",
                            onMouseenter: _cache[25] || (_cache[25] = ($event) => inspectSubOpen.value = true),
                            onMouseleave: _cache[26] || (_cache[26] = ($event) => inspectSubOpen.value = false)
                          },
                          [
                            createElementVNode("button", {
                              type: "button",
                              role: "menuitem",
                              "data-testid": "panel-menu-inspect",
                              "data-grafana-action": "inspect",
                              "aria-haspopup": "true",
                              "aria-expanded": inspectSubOpen.value,
                              onClick: _cache[16] || (_cache[16] = ($event) => inspectSubOpen.value = !inspectSubOpen.value)
                            }, [
                              createVNode(unref(GIcon), {
                                name: "inspect",
                                size: 12
                              }),
                              _cache[54] || (_cache[54] = createElementVNode(
                                "span",
                                { class: "menu-label" },
                                "检查",
                                -1
                                /* CACHED */
                              )),
                              _cache[55] || (_cache[55] = createElementVNode(
                                "span",
                                { class: "menu-sc" },
                                "i",
                                -1
                                /* CACHED */
                              )),
                              _cache[56] || (_cache[56] = createElementVNode(
                                "span",
                                {
                                  class: "menu-caret",
                                  "aria-hidden": "true"
                                },
                                "›",
                                -1
                                /* CACHED */
                              ))
                            ], 8, _hoisted_32$6),
                            inspectSubOpen.value ? (openBlock(), createElementBlock("ul", _hoisted_33$6, [
                              createElementVNode("li", _hoisted_34$6, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-data",
                                  "data-grafana-action": "inspect-data",
                                  "data-grafana-inspect-tab": "data",
                                  onClick: _cache[17] || (_cache[17] = ($event) => pickInspect("data"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "inspect",
                                    size: 12
                                  }),
                                  _cache[57] || (_cache[57] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "数据",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_35$5, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-stats",
                                  "data-grafana-action": "inspect-stats",
                                  "data-grafana-inspect-tab": "stats",
                                  onClick: _cache[18] || (_cache[18] = ($event) => pickInspect("stats"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "info-circle",
                                    size: 12
                                  }),
                                  _cache[58] || (_cache[58] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "统计",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_36$4, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-query",
                                  "data-grafana-action": "inspect-query",
                                  "data-grafana-inspect-tab": "query",
                                  onClick: _cache[19] || (_cache[19] = ($event) => pickInspect("query"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "search",
                                    size: 12
                                  }),
                                  _cache[59] || (_cache[59] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "查询",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_37$4, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-json",
                                  "data-grafana-action": "inspect-json",
                                  "data-grafana-inspect-tab": "json",
                                  onClick: _cache[20] || (_cache[20] = ($event) => pickInspect("json"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "inspect",
                                    size: 12
                                  }),
                                  _cache[60] || (_cache[60] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "面板 JSON",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_38$3, [
                                createElementVNode("button", {
                                  type: "button",
                                  "data-testid": "panel-menu-json",
                                  onClick: _cache[21] || (_cache[21] = ($event) => pickInspect("json"))
                                }, " JSON ")
                              ]),
                              createElementVNode("li", _hoisted_39$2, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-error",
                                  "data-grafana-action": "inspect-error",
                                  "data-grafana-inspect-tab": "error",
                                  onClick: _cache[22] || (_cache[22] = ($event) => pickInspect("error"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "exclamation-triangle",
                                    size: 12
                                  }),
                                  _cache[61] || (_cache[61] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "错误",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_40$2, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-meta",
                                  "data-grafana-action": "inspect-meta",
                                  "data-grafana-inspect-tab": "meta",
                                  onClick: _cache[23] || (_cache[23] = ($event) => pickInspect("meta"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "info-circle",
                                    size: 12
                                  }),
                                  _cache[62] || (_cache[62] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "元数据",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ]),
                              createElementVNode("li", _hoisted_41$2, [
                                createElementVNode("button", {
                                  type: "button",
                                  role: "menuitem",
                                  "data-testid": "panel-menu-inspect-transform",
                                  "data-grafana-action": "inspect-transform",
                                  "data-grafana-inspect-tab": "transform",
                                  onClick: _cache[24] || (_cache[24] = ($event) => pickInspect("transform"))
                                }, [
                                  createVNode(unref(GIcon), {
                                    name: "cog",
                                    size: 12
                                  }),
                                  _cache[63] || (_cache[63] = createElementVNode(
                                    "span",
                                    { class: "menu-label" },
                                    "转换",
                                    -1
                                    /* CACHED */
                                  ))
                                ])
                              ])
                            ])) : createCommentVNode("v-if", true)
                          ],
                          32
                          /* NEED_HYDRATION */
                        ),
                        createElementVNode("li", _hoisted_42$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-help",
                            "data-grafana-action": "help",
                            onClick: _cache[27] || (_cache[27] = ($event) => pick("help"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "info-circle",
                              size: 12
                            }),
                            _cache[64] || (_cache[64] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "获取帮助",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ]),
                        _cache[78] || (_cache[78] = createElementVNode(
                          "li",
                          {
                            class: "menu-sep",
                            role: "separator",
                            "data-testid": "panel-menu-sep-more"
                          },
                          null,
                          -1
                          /* CACHED */
                        )),
                        _cache[79] || (_cache[79] = createElementVNode(
                          "li",
                          {
                            class: "menu-section",
                            "aria-hidden": "true",
                            "data-testid": "panel-menu-more-label"
                          },
                          " 更多 ",
                          -1
                          /* CACHED */
                        )),
                        __props.editable ? (openBlock(), createElementBlock("li", _hoisted_43$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-duplicate",
                            "data-grafana-action": "duplicate",
                            onClick: _cache[28] || (_cache[28] = ($event) => pick("duplicate"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "copy",
                              size: 12
                            }),
                            _cache[65] || (_cache[65] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "复制",
                              -1
                              /* CACHED */
                            )),
                            _cache[66] || (_cache[66] = createElementVNode(
                              "span",
                              { class: "menu-sc" },
                              "p d",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        createElementVNode("li", _hoisted_44$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-copy",
                            "data-grafana-action": "copy",
                            onClick: _cache[29] || (_cache[29] = ($event) => pick("copy"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "copy",
                              size: 12
                            }),
                            _cache[67] || (_cache[67] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "复制到剪贴板",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ]),
                        __props.editable ? (openBlock(), createElementBlock("li", _hoisted_45$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-copy-styles",
                            "data-grafana-action": "copyStyles",
                            onClick: _cache[30] || (_cache[30] = ($event) => pick("copyStyles"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "copy",
                              size: 12
                            }),
                            _cache[68] || (_cache[68] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "复制样式",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        __props.editable ? (openBlock(), createElementBlock("li", _hoisted_46$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-paste-styles",
                            "data-grafana-action": "pasteStyles",
                            onClick: _cache[31] || (_cache[31] = ($event) => pick("pasteStyles"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "copy",
                              size: 12
                            }),
                            _cache[69] || (_cache[69] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "粘贴样式",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        createElementVNode("li", _hoisted_47$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-legend",
                            "data-grafana-action": "toggleLegend",
                            onClick: _cache[32] || (_cache[32] = ($event) => pick("toggleLegend"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "info-circle",
                              size: 12
                            }),
                            _cache[70] || (_cache[70] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "图例",
                              -1
                              /* CACHED */
                            )),
                            _cache[71] || (_cache[71] = createElementVNode(
                              "span",
                              { class: "menu-sc" },
                              "p l",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ]),
                        __props.editable ? (openBlock(), createElementBlock("li", _hoisted_48$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-library",
                            "data-grafana-action": "libraryPanel",
                            onClick: _cache[33] || (_cache[33] = ($event) => pick("libraryPanel"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "save",
                              size: 12
                            }),
                            _cache[72] || (_cache[72] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "新建库面板",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        __props.isLibraryPanel ? (openBlock(), createElementBlock("li", _hoisted_49$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-unlink-library",
                            "data-grafana-action": "unlinkLibrary",
                            onClick: _cache[34] || (_cache[34] = ($event) => pick("unlinkLibrary"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "link",
                              size: 12
                            }),
                            _cache[73] || (_cache[73] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "取消链接库面板",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true),
                        createElementVNode("li", _hoisted_50$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-alert",
                            "data-grafana-action": "alertRule",
                            onClick: _cache[35] || (_cache[35] = ($event) => pick("alertRule"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "bell",
                              size: 12
                            }),
                            _cache[74] || (_cache[74] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "新建告警规则",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ]),
                        !__props.editable && !__props.isEditing ? (openBlock(), createElementBlock("li", _hoisted_51$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-fullscreen",
                            "data-grafana-action": "fullscreen",
                            onClick: _cache[36] || (_cache[36] = ($event) => pick(__props.isViewing ? "view" : "fullscreen"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "fullscreen",
                              size: 12
                            }),
                            createElementVNode(
                              "span",
                              _hoisted_52$2,
                              toDisplayString(__props.isViewing ? "退出查看" : "全屏"),
                              1
                              /* TEXT */
                            )
                          ])
                        ])) : createCommentVNode("v-if", true),
                        __props.editable ? (openBlock(), createElementBlock("li", _hoisted_53$2, [
                          createElementVNode("button", {
                            type: "button",
                            role: "menuitem",
                            "data-testid": "panel-menu-remove",
                            class: "danger",
                            "data-grafana-action": "remove",
                            onClick: _cache[37] || (_cache[37] = ($event) => pick("remove"))
                          }, [
                            createVNode(unref(GIcon), {
                              name: "trash",
                              size: 12
                            }),
                            _cache[75] || (_cache[75] = createElementVNode(
                              "span",
                              { class: "menu-label" },
                              "删除",
                              -1
                              /* CACHED */
                            )),
                            _cache[76] || (_cache[76] = createElementVNode(
                              "span",
                              { class: "menu-sc" },
                              "p r",
                              -1
                              /* CACHED */
                            ))
                          ])
                        ])) : createCommentVNode("v-if", true)
                      ],
                      36
                      /* STYLE, NEED_HYDRATION */
                    )) : createCommentVNode("v-if", true)
                  ]))
                ])
              ])
            ])) : createCommentVNode("v-if", true),
            createElementVNode("div", _hoisted_54$2, [
              __props.error ? (openBlock(), createElementBlock(
                "div",
                _hoisted_55$2,
                toDisplayString(__props.error),
                1
                /* TEXT */
              )) : __props.noData && !__props.loading ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
                createElementVNode("div", _hoisted_57$2, [
                  createVNode(unref(GIcon), {
                    name: "info-circle",
                    size: 22
                  }),
                  createElementVNode(
                    "span",
                    null,
                    toDisplayString(__props.noDataText || "暂无数据"),
                    1
                    /* TEXT */
                  )
                ])
              ])) : (openBlock(), createElementBlock("div", _hoisted_58$2, [
                renderSlot(_ctx.$slots, "default", {}, void 0, true)
              ]))
            ])
          ], 14, _hoisted_2$2o))
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const _export_sfc$1 = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const PanelChrome = /* @__PURE__ */ _export_sfc$1(_sfc_main$3S, [["__scopeId", "data-v-3b713f4a"]]);
function classicPalette(mode2) {
  return getClassicPalette$1(mode2 ?? resolveThemeModeHint());
}
function classicColor(index2 = 0, mode2) {
  const palette2 = classicPalette(mode2);
  return palette2[(index2 % palette2.length + palette2.length) % palette2.length];
}
function classicGreen(mode2) {
  return classicColor(0, mode2);
}
function classicYellow(mode2) {
  return classicColor(1, mode2);
}
function classicBlue(mode2) {
  return classicColor(2, mode2);
}
function classicOrange(mode2) {
  return classicColor(3, mode2);
}
function classicRed(mode2) {
  return classicColor(4, mode2);
}
function classicPurple(mode2) {
  return classicColor(5, mode2);
}
function classicColorForKey(key, mode2) {
  const palette2 = classicPalette(mode2);
  let h2 = 0;
  const s = String(key ?? "");
  for (let i = 0; i < s.length; i++) h2 = h2 * 31 + s.charCodeAt(i) >>> 0;
  return palette2[h2 % palette2.length];
}
function resolveConnectionDirection(raw, panelDefault) {
  const pick = (v) => {
    if (v == null) return "";
    if (typeof v === "string") return v.trim().toLowerCase();
    if (typeof v === "object") {
      const o = v;
      return String(o.fixed ?? o.value ?? o.mode ?? "").trim().toLowerCase();
    }
    return String(v).trim().toLowerCase();
  };
  let d = pick(raw) || pick(panelDefault) || "forward";
  if (d === "horizontal" || d === "h") d = "forward";
  if (d === "vertical" || d === "v") d = "both";
  if (d === "reverse" || d === "both" || d === "forward") return d;
  return "forward";
}
function resolveLineDash(lineStyle) {
  if (lineStyle == null) return void 0;
  const s = typeof lineStyle === "string" ? lineStyle : String(lineStyle?.fill ?? lineStyle?.style ?? "");
  const v = s.toLowerCase();
  if (v === "dashed" || v === "dash") return "6 4";
  if (v === "dotted" || v === "dot") return "2 3";
  return void 0;
}
function resolveConnectionAnimate(lineStyle, animateFlag) {
  if (animateFlag === true || animateFlag === 1 || animateFlag === "true") return true;
  if (lineStyle && typeof lineStyle === "object") {
    const a = lineStyle.animate;
    if (a === true || a === 1 || a === "true") return true;
  }
  return false;
}
function readConnectionRadius(raw) {
  if (raw == null) return 0;
  if (typeof raw === "number" && Number.isFinite(raw)) return Math.max(0, raw);
  if (typeof raw === "object") {
    const n2 = Number(raw.fixed ?? raw.value ?? raw.min ?? 0);
    return Number.isFinite(n2) && n2 > 0 ? n2 : 0;
  }
  const n = Number(raw);
  return Number.isFinite(n) && n > 0 ? n : 0;
}
function pickElementChrome(el) {
  const links = Array.isArray(el.links) ? el.links : el.links != null ? [el.links] : void 0;
  const actions = Array.isArray(el.actions) ? el.actions : el.actions != null && String(el.actions).trim() !== "" ? [el.actions] : void 0;
  const lineStyle = el.lineStyle ?? el.config?.lineStyle ?? void 0;
  return { links, actions, lineStyle };
}
function normalizeCanvasOptions(options = {}) {
  const root = options.root && typeof options.root === "object" ? options.root : void 0;
  const rawElements = (Array.isArray(options.elements) && options.elements.length ? options.elements : void 0) ?? (Array.isArray(root?.elements) ? root.elements : void 0);
  const elements = rawElements?.map((el, i) => {
    const n = normalizeElement(el, i);
    if (!n || !el || typeof el !== "object") return n;
    const chrome = pickElementChrome(el);
    return { ...n, ...chrome };
  }).filter((el) => el != null);
  const connections = collectConnections(options, elements ?? []);
  const selectedIds = Array.isArray(options.selectedIds) ? options.selectedIds.map(String) : typeof options.selectedId === "string" ? [options.selectedId] : void 0;
  const bgNested = options.background && typeof options.background === "object" ? options.background : null;
  const backgroundColor = typeof options.background === "string" ? options.background : typeof bgNested?.color === "string" ? bgNested.color : typeof options["background.color"] === "string" ? String(options["background.color"]) : "transparent";
  const backgroundImage = typeof bgNested?.image === "string" ? bgNested.image : typeof options["background.image"] === "string" ? String(options["background.image"]) : void 0;
  const backgroundSize = typeof bgNested?.size === "string" ? bgNested.size : typeof options["background.size"] === "string" ? String(options["background.size"]) : "cover";
  const borderNested = options.border && typeof options.border === "object" ? options.border : null;
  const borderColor = typeof borderNested?.color === "string" ? borderNested.color : typeof options["border.color"] === "string" ? String(options["border.color"]) : "";
  const borderWidth = borderNested?.width != null ? Number(borderNested.width) : options["border.width"] != null ? Number(options["border.width"]) : void 0;
  const borderRadiusRaw = borderNested?.radius != null ? Number(borderNested.radius) : options["border.radius"] != null ? Number(options["border.radius"]) : options.radius != null && borderNested == null ? void 0 : void 0;
  const borderRadius = borderRadiusRaw != null && Number.isFinite(borderRadiusRaw) ? borderRadiusRaw : void 0;
  const panelColor = typeof options.color === "string" ? options.color : typeof options.color === "object" && options.color?.fixed ? String(options.color.fixed) : "";
  const normalizedElements = applyConstraints(elements ?? [], 100, 100);
  return {
    elements: normalizedElements,
    connections,
    direction: options.direction,
    lineStyle: options.lineStyle,
    background: backgroundColor,
    backgroundColor,
    backgroundImage,
    backgroundSize,
    borderColor,
    borderWidth,
    borderRadius,
    color: panelColor,
    inlineEditing: options.inlineEditing !== false,
    panZoom: Boolean(
      options.panZoom === true || String(options.panZoom) === "true" || Number(options.panZoom) === 1
    ),
    panZoomHelp: options.panZoomHelp !== false,
    zoomToContent: Boolean(options.zoomToContent),
    showAdvancedTypes: Boolean(options.showAdvancedTypes),
    tooltipMode: String(options.tooltip?.mode ?? options["tooltip.mode"] ?? "auto"),
    tooltipDisableForOneClick: Boolean(
      options.tooltip?.disableForOneClick ?? options["tooltip.disableForOneClick"]
    ),
    root: root ?? { elements: normalizedElements },
    selectedId: selectedIds?.[selectedIds.length - 1],
    selectedIds
  };
}
function readPlacement(el) {
  const placement = el.placement && typeof el.placement === "object" ? el.placement : null;
  const x = num(el.x ?? placement?.left ?? placement?.x, 0);
  const y = num(el.y ?? placement?.top ?? placement?.y, 0);
  const w = num(el.w ?? el.width ?? placement?.width, Number.NaN);
  const h2 = num(el.h ?? el.height ?? placement?.height, Number.NaN);
  const rotation = num(placement?.rotation ?? el.rotation ?? 0, 0);
  return { x, y, w, h: h2, placement, rotation };
}
function readElementText(el) {
  if (typeof el.text === "string") return el.text;
  const config2 = el.config && typeof el.config === "object" ? el.config : null;
  const textCfg = config2?.text;
  if (typeof textCfg === "string") return textCfg;
  if (textCfg && typeof textCfg === "object") {
    const fixed = textCfg.fixed;
    if (typeof fixed === "string") return fixed;
  }
  return void 0;
}
function readConfigObject(el) {
  return el.config && typeof el.config === "object" ? el.config : null;
}
function readScalarConfig(el, key, fallback = 0) {
  const cfg = readConfigObject(el);
  const raw = el[key] ?? cfg?.[key];
  if (raw == null) return fallback;
  if (typeof raw === "object") {
    const n2 = Number(raw.fixed ?? raw.value ?? fallback);
    return Number.isFinite(n2) ? n2 : fallback;
  }
  const n = Number(raw);
  return Number.isFinite(n) ? n : fallback;
}
function readFixedStringConfig(el, key, fallback) {
  const cfg = readConfigObject(el);
  const raw = el[key] ?? cfg?.[key];
  if (raw == null) return fallback;
  if (typeof raw === "string") return raw || fallback;
  if (typeof raw === "object") {
    const fixed = raw.fixed ?? raw.value ?? raw.path;
    if (typeof fixed === "string" && fixed) return fixed;
  }
  return fallback;
}
function readAlign(el) {
  const cfg = readConfigObject(el);
  const raw = String(el.align ?? cfg?.align ?? "center").toLowerCase();
  if (raw === "left" || raw === "right") return raw;
  return "center";
}
function readVAlign(el) {
  const cfg = readConfigObject(el);
  const raw = String(el.valign ?? cfg?.valign ?? "middle").toLowerCase();
  if (raw === "top" || raw === "bottom") return raw;
  return "middle";
}
function readShapeTextProps(el) {
  const cfg = readConfigObject(el);
  const sizeRaw = el.fontSize ?? el.size ?? cfg?.size;
  return {
    text: readElementText(el),
    textColor: readFixedStringConfig(el, "textColor") ?? readFixedStringConfig(el, "color") ?? void 0,
    fontSize: sizeRaw != null && sizeRaw !== "" ? num(sizeRaw, 14) : void 0,
    align: readAlign(el),
    valign: readVAlign(el)
  };
}
function readElementChrome(el) {
  const bg = el.background && typeof el.background === "object" ? el.background : null;
  const border = el.border && typeof el.border === "object" ? el.border : null;
  const backgroundColor = readFixedStringConfig(el, "backgroundColor") ?? (typeof el.background === "string" ? el.background : void 0) ?? (bg ? readFixedStringConfig({ config: { color: bg.color }, color: bg.color }, "color") : void 0) ?? (bg && typeof bg.color === "string" ? bg.color : void 0);
  let bgColor = backgroundColor;
  if (!bgColor && bg?.color) {
    if (typeof bg.color === "string") bgColor = bg.color;
    else if (typeof bg.color === "object") {
      const f = bg.color.fixed ?? bg.color.value;
      if (typeof f === "string") bgColor = f;
    }
  }
  let backgroundImage;
  if (typeof el.backgroundImage === "string") backgroundImage = el.backgroundImage;
  else if (bg?.image) {
    if (typeof bg.image === "string") backgroundImage = bg.image;
    else if (typeof bg.image === "object") {
      const f = bg.image.fixed ?? bg.image.value ?? bg.image.path;
      if (typeof f === "string") backgroundImage = f;
    }
  }
  const backgroundSize = (typeof el.backgroundSize === "string" ? el.backgroundSize : void 0) ?? (typeof bg?.size === "string" ? bg.size : void 0);
  let borderColor = typeof el.borderColor === "string" ? el.borderColor : void 0;
  if (!borderColor && border?.color) {
    if (typeof border.color === "string") borderColor = border.color;
    else if (typeof border.color === "object") {
      const f = border.color.fixed ?? border.color.value;
      if (typeof f === "string") borderColor = f;
    }
  }
  const borderWidth = (() => {
    if (el.borderWidth != null) {
      const n = Number(el.borderWidth);
      return Number.isFinite(n) ? n : void 0;
    }
    if (border?.width != null) {
      const n = Number(border.width);
      return Number.isFinite(n) ? n : void 0;
    }
    return void 0;
  })();
  const borderRadius = (() => {
    if (el.borderRadius != null) {
      const n = Number(el.borderRadius);
      return Number.isFinite(n) ? n : void 0;
    }
    if (border?.radius != null) {
      const n = Number(border.radius);
      return Number.isFinite(n) ? n : void 0;
    }
    return void 0;
  })();
  return {
    backgroundColor: bgColor,
    backgroundImage,
    backgroundSize,
    borderColor,
    borderWidth,
    borderRadius,
    // Grafana often uses background.color as the element fill when fill is absent
    fillFromBackground: bgColor
  };
}
function normalizeElement(raw, index2) {
  if (!raw || typeof raw !== "object") return null;
  const el = raw;
  const typeRaw = String(el.type ?? "");
  const type = typeRaw === "metric-value" ? "metricValue" : typeRaw;
  const id = typeof el.id === "string" ? el.id : `el-${index2}`;
  const { x, y, w: placeW, h: placeH, rotation } = readPlacement(el);
  const fill = typeof el.fill === "string" ? el.fill : void 0;
  const name = typeof el.name === "string" ? el.name : void 0;
  const constraint = normalizeConstraint(el.constraint);
  const connections = Array.isArray(el.connections) ? el.connections.map((c, ci) => normalizeConnection(c, id, ci)).filter((c) => !!c) : void 0;
  const text = readElementText(el);
  const rot = Number.isFinite(rotation) ? rotation : 0;
  const chrome = readElementChrome(el);
  const fillResolved = (typeof el.fill === "string" ? el.fill : void 0) ?? chrome.fillFromBackground ?? fill;
  switch (type) {
    case "rect":
      return {
        type: "rect",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 10),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved,
        text,
        textColor: readFixedStringConfig(el, "textColor") ?? readFixedStringConfig(el, "color") ?? void 0,
        fontSize: (() => {
          const cfg = readConfigObject(el);
          const size = el.fontSize ?? el.size ?? cfg?.size;
          return size != null ? num(size, 14) : void 0;
        })(),
        align: readAlign(el),
        valign: readVAlign(el),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "circle":
      return {
        type: "circle",
        id,
        name,
        x,
        y,
        r: num(el.r ?? el.radius, 5),
        fill: fillResolved,
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "text":
      return {
        type: "text",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 120),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 40),
        text: text ?? "",
        fill: fillResolved,
        textColor: readFixedStringConfig(el, "textColor") ?? readFixedStringConfig(el, "color") ?? (typeof fill === "string" ? fill : void 0),
        fontSize: (() => {
          const cfg = readConfigObject(el);
          const size = el.fontSize ?? el.size ?? cfg?.size;
          return num(size, 16);
        })(),
        align: readAlign(el),
        valign: readVAlign(el),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "metricValue":
    case "metric":
      return {
        type: "metric",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 120),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 40),
        field: typeof el.field === "string" ? el.field : (() => {
          const cfg = readConfigObject(el);
          const t2 = cfg?.text;
          if (t2 && typeof t2 === "object" && typeof t2.field === "string") {
            return t2.field;
          }
          return void 0;
        })(),
        fill: fillResolved,
        text,
        textColor: readFixedStringConfig(el, "textColor") ?? readFixedStringConfig(el, "color") ?? void 0,
        fontSize: (() => {
          const cfg = readConfigObject(el);
          const size = el.fontSize ?? el.size ?? cfg?.size;
          return num(size, 20);
        })(),
        align: readAlign(el),
        valign: readVAlign(el),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "line":
      return {
        type: "line",
        id,
        name,
        x,
        y,
        x2: num(el.x2, x + 10),
        y2: num(el.y2, y + 10),
        stroke: typeof el.stroke === "string" ? el.stroke : classicColor(14),
        strokeWidth: num(el.strokeWidth, 0.8),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "ellipse": {
      const tp = readShapeTextProps(el);
      return {
        type: "ellipse",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 14),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved,
        text: tp.text,
        textColor: tp.textColor,
        fontSize: tp.fontSize,
        align: tp.align,
        valign: tp.valign,
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    }
    case "icon":
      return {
        type: "icon",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 8),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 8),
        fill: readFixedStringConfig(el, "fill") ?? fill ?? classicColor(14),
        icon: typeof el.icon === "string" ? el.icon : typeof el.name === "string" && el.name ? String(el.name) : "cube",
        path: readFixedStringConfig(el, "path") ?? readFixedStringConfig(el, "src") ?? (typeof el.path === "string" ? String(el.path) : void 0) ?? "img/icons/unicons/question-circle.svg",
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "server":
      return {
        type: "server",
        id,
        name,
        x,
        y,
        w: num(el.w ?? el.width, 12),
        h: num(el.h ?? el.height, 16),
        fill: fillResolved ?? classicBlue(),
        text: typeof el.text === "string" ? el.text : "Server",
        serverType: (() => {
          const raw2 = String(
            el.serverType ?? el.config?.type ?? el.typeConfig ?? "single"
          ).toLowerCase();
          if (raw2 === "stack" || raw2 === "database" || raw2 === "terminal") return raw2;
          return "single";
        })(),
        blinkRate: (() => {
          const v = el.blinkRate ?? el.config?.blinkRate;
          const n = typeof v === "object" && v != null ? Number(v.fixed ?? v.value ?? 0) : Number(v);
          return Number.isFinite(n) && n > 0 ? n : 0;
        })(),
        statusColor: (() => {
          const v = el.statusColor ?? el.config?.statusColor;
          if (typeof v === "string" && v) return v;
          if (v && typeof v === "object") {
            const fixed = v.fixed ?? v.value;
            if (typeof fixed === "string" && fixed) return fixed;
          }
          return fill ?? classicBlue();
        })(),
        bulbColor: (() => {
          const v = el.bulbColor ?? el.config?.bulbColor;
          if (typeof v === "string" && v) return v;
          if (v && typeof v === "object") {
            const fixed = v.fixed ?? v.value;
            if (typeof fixed === "string" && fixed) return fixed;
          }
          return "var(--grafana-success)";
        })(),
        links: Array.isArray(el.links) ? el.links : void 0,
        actions: Array.isArray(el.actions) ? el.actions : void 0,
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "button": {
      const tp = readShapeTextProps(el);
      const styleRaw = el.buttonStyle ?? el.style ?? readConfigObject(el)?.style;
      let buttonStyle;
      if (typeof styleRaw === "string") buttonStyle = styleRaw;
      else if (styleRaw && typeof styleRaw === "object") {
        const v = styleRaw.variant ?? styleRaw.fixed ?? styleRaw.value;
        if (typeof v === "string") buttonStyle = v;
      }
      return {
        type: "button",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 16),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 8),
        fill: fillResolved ?? classicBlue(),
        text: tp.text ?? (typeof el.text === "string" ? el.text : "Button"),
        textColor: tp.textColor,
        fontSize: tp.fontSize ?? 14,
        align: tp.align,
        buttonStyle: buttonStyle ?? "primary",
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    }
    case "drone":
      return {
        type: "drone",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 14),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved ?? classicBlue(),
        text: typeof el.text === "string" ? el.text : "Drone",
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "droneTop":
      return {
        type: "droneTop",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 14),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved ?? classicBlue(),
        text: typeof el.text === "string" ? el.text : "DroneTop",
        yawAngle: readScalarConfig(el, "yawAngle", 0),
        fRightRotorRPM: Math.max(0, readScalarConfig(el, "fRightRotorRPM", 0)),
        fLeftRotorRPM: Math.max(0, readScalarConfig(el, "fLeftRotorRPM", 0)),
        bRightRotorRPM: Math.max(0, readScalarConfig(el, "bRightRotorRPM", 0)),
        bLeftRotorRPM: Math.max(0, readScalarConfig(el, "bLeftRotorRPM", 0)),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "droneFront":
      return {
        type: "droneFront",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 14),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved ?? classicBlue(),
        text: typeof el.text === "string" ? el.text : "DroneFront",
        rollAngle: readScalarConfig(el, "rollAngle", 0),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "droneSide":
      return {
        type: "droneSide",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 14),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved ?? classicBlue(),
        text: typeof el.text === "string" ? el.text : "DroneSide",
        pitchAngle: readScalarConfig(el, "pitchAngle", 0),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "windTurbine":
    case "wind-turbine":
      return {
        type: "windTurbine",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 12),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 18),
        fill: fillResolved ?? classicColor(14),
        text: typeof el.text === "string" ? el.text : "Turbine",
        rpm: Math.max(0, readScalarConfig(el, "rpm", 0)),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    case "cloud":
    case "triangle":
    case "parallelogram": {
      const tp = readShapeTextProps(el);
      return {
        type,
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 16),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 12),
        fill: fill ?? (type === "cloud" ? classicColor(14) : type === "triangle" ? classicYellow() : classicPurple()),
        text: tp.text ?? (typeof el.text === "string" ? el.text : type),
        textColor: tp.textColor,
        fontSize: tp.fontSize,
        align: tp.align,
        valign: tp.valign,
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    }
    // Grafana aliases
    case "rectangle":
      return {
        type: "rect",
        id,
        name,
        x,
        y,
        w: Number.isFinite(placeW) ? placeW : num(el.w ?? el.width, 10),
        h: Number.isFinite(placeH) ? placeH : num(el.h ?? el.height, 10),
        fill: fillResolved,
        text: text ?? (typeof el.text === "string" ? el.text : void 0),
        textColor: readFixedStringConfig(el, "textColor") ?? readFixedStringConfig(el, "color") ?? void 0,
        fontSize: (() => {
          const cfg = readConfigObject(el);
          const size = el.fontSize ?? el.size ?? cfg?.size;
          return size != null ? num(size, 14) : void 0;
        })(),
        align: readAlign(el),
        valign: readVAlign(el),
        rotation: rot,
        animation: typeof el.animation === "string" ? String(el.animation) : void 0,
        backgroundColor: chrome.backgroundColor,
        backgroundImage: chrome.backgroundImage,
        backgroundSize: chrome.backgroundSize,
        borderColor: chrome.borderColor,
        borderWidth: chrome.borderWidth,
        borderRadius: chrome.borderRadius,
        constraint,
        connections
      };
    default:
      return null;
  }
}
function normalizeConstraint(raw) {
  if (!raw || typeof raw !== "object") return void 0;
  const c = raw;
  return {
    horizontal: c.horizontal != null ? String(c.horizontal) : void 0,
    vertical: c.vertical != null ? String(c.vertical) : void 0
  };
}
function grafanaCoordToFraction(raw, fallback = { x: 0.5, y: 0.5 }, mode2 = "fraction") {
  if (!raw || typeof raw !== "object") return { ...fallback };
  const v = raw;
  const gx = Number(v.x);
  const gy = Number(v.y);
  if (!Number.isFinite(gx) || !Number.isFinite(gy)) return { ...fallback };
  if (mode2 === "grafana") {
    return {
      x: Math.min(1, Math.max(0, (gx + 1) / 2)),
      // Grafana y: +1 top, -1 bottom → CSS y grows down
      y: Math.min(1, Math.max(0, (1 - gy) / 2))
    };
  }
  return {
    x: Math.min(1, Math.max(0, gx)),
    y: Math.min(1, Math.max(0, gy))
  };
}
function isCoordObject(raw) {
  return !!raw && typeof raw === "object" && !Array.isArray(raw) && ("x" in raw || "y" in raw);
}
function normalizeConnection(raw, fallbackSource, index2) {
  if (!raw || typeof raw !== "object") return null;
  const c = raw;
  const sourceIsCoord = isCoordObject(c.source);
  const targetIsCoord = isCoordObject(c.target);
  let source = "";
  let target = "";
  let sourceOriginal = { x: 0.5, y: 0.5 };
  let targetOriginal = { x: 0.5, y: 0.5 };
  if (sourceIsCoord || targetIsCoord || c.targetName != null) {
    source = fallbackSource || String(c.sourceName ?? c.sourceId ?? "");
    target = String(c.targetName ?? c.targetId ?? "");
    if (!target && typeof c.target === "string") target = c.target;
    if (!source && typeof c.source === "string") source = c.source;
    sourceOriginal = grafanaCoordToFraction(
      c.sourceOriginal ?? (sourceIsCoord ? c.source : void 0),
      { x: 0.5, y: 0.5 },
      "grafana"
    );
    targetOriginal = grafanaCoordToFraction(
      c.targetOriginal ?? (targetIsCoord ? c.target : void 0),
      { x: 0.5, y: 0.5 },
      "grafana"
    );
  } else {
    source = String(c.source ?? c.sourceName ?? fallbackSource ?? "");
    target = String(c.target ?? c.targetName ?? "");
    sourceOriginal = grafanaCoordToFraction(c.sourceOriginal, {
      x: 0.5,
      y: 0.5
    });
    targetOriginal = grafanaCoordToFraction(c.targetOriginal, {
      x: 0.5,
      y: 0.5
    });
  }
  if (!source || !target) return null;
  const direction = c.direction != null ? c.direction : void 0;
  const lineStyle = c.lineStyle != null ? c.lineStyle : void 0;
  const color = (() => {
    const rawColor = c.color;
    if (typeof rawColor === "string" && rawColor) return rawColor;
    if (rawColor && typeof rawColor === "object") {
      const fixed = rawColor.fixed ?? rawColor.value;
      if (typeof fixed === "string" && fixed) return fixed;
    }
    return classicColor(14);
  })();
  const pathType = (() => {
    const rawPath = c.pathType ?? c.path;
    if (typeof rawPath === "string" && rawPath) return rawPath;
    return "straight";
  })();
  const strokeWidth = (() => {
    if (c.strokeWidth != null) {
      const n = Number(c.strokeWidth);
      if (Number.isFinite(n) && n > 0) return n;
    }
    const size = c.size;
    if (typeof size === "number" && Number.isFinite(size) && size > 0) return size;
    if (size && typeof size === "object") {
      const n = Number(size.fixed ?? size.value ?? size.min);
      if (Number.isFinite(n) && n > 0) return n;
    }
    return 0.8;
  })();
  const radius = readConnectionRadius(c.radius);
  const animate = resolveConnectionAnimate(lineStyle ?? c.lineStyle, c.animate);
  return {
    id: typeof c.id === "string" ? c.id : `conn-${source}-${target}-${index2}`,
    source,
    target,
    color,
    pathType,
    strokeWidth,
    radius,
    animate,
    direction,
    lineStyle,
    sourceOriginal,
    targetOriginal,
    vertices: Array.isArray(c.vertices) ? c.vertices.map((v) => ({ x: num(v?.x, 0), y: num(v?.y, 0) })) : void 0
  };
}
function collectConnections(options, elements) {
  const out = [];
  const seen = /* @__PURE__ */ new Set();
  const push = (c) => {
    if (!c) return;
    const key = c.id || `${c.source}->${c.target}`;
    if (seen.has(key)) return;
    seen.add(key);
    out.push(c);
  };
  if (Array.isArray(options.connections)) {
    options.connections.forEach((c, i) => push(normalizeConnection(c, "", i)));
  }
  for (const el of elements) {
    if (Array.isArray(el.connections)) {
      el.connections.forEach((c, i) => push(normalizeConnection(c, el.id ?? "", i)));
    }
  }
  return out;
}
function applyConstraints(elements, canvasW = 100, canvasH = 100) {
  return elements.map((el) => {
    const c = el.constraint;
    if (!c) return el;
    const b = elementBounds(el);
    let x = el.x;
    let y = el.y;
    const h2 = String(c.horizontal ?? "");
    const v = String(c.vertical ?? "");
    if (h2 === "left") x = el.type === "circle" ? b.w / 2 : 0;
    else if (h2 === "right") x = el.type === "circle" ? canvasW - b.w / 2 : canvasW - b.w;
    else if (h2 === "center") x = el.type === "circle" ? canvasW / 2 : (canvasW - b.w) / 2;
    else if (h2 === "scale") {
      const ratio = el.x / 100;
      x = el.type === "circle" ? ratio * canvasW : ratio * canvasW;
    }
    if (v === "top") y = el.type === "circle" ? b.h / 2 : 0;
    else if (v === "bottom") y = el.type === "circle" ? canvasH - b.h / 2 : canvasH - b.h;
    else if (v === "center") y = el.type === "circle" ? canvasH / 2 : (canvasH - b.h) / 2;
    else if (v === "scale") {
      const ratio = el.y / 100;
      y = el.type === "circle" ? ratio * canvasH : ratio * canvasH;
    }
    if ((h2 === "scale" || v === "scale") && el.type !== "line" && el.type !== "circle" && el.type !== "text" && el.type !== "metric") {
      const scaleX = canvasW / 100;
      const scaleY = canvasH / 100;
      const w = Math.max(1, Number(el.w ?? 10) * (h2 === "scale" ? scaleX : 1));
      const hh = Math.max(1, Number(el.h ?? 10) * (v === "scale" ? scaleY : 1));
      return { ...el, x, y, w, h: hh };
    }
    if (el.type === "line") {
      const dx = x - el.x;
      const dy = y - el.y;
      return {
        ...el,
        x: el.x + dx,
        y: el.y + dy,
        x2: el.x2 + dx,
        y2: el.y2 + dy
      };
    }
    return { ...el, x, y };
  });
}
function anchorPoint(el, anchor = { x: 0.5, y: 0.5 }) {
  const b = elementBounds(el);
  return { x: b.x + b.w * anchor.x, y: b.y + b.h * anchor.y };
}
function connectionPath(elements, conn) {
  const findEl = (key) => elements.find((e) => e.id === key || e.name === key || e.name === key);
  const src = findEl(conn.source);
  const tgt = findEl(conn.target);
  if (!src || !tgt) return null;
  const a = anchorPoint(src, conn.sourceOriginal ?? { x: 0.5, y: 0.5 });
  const b = anchorPoint(tgt, conn.targetOriginal ?? { x: 0.5, y: 0.5 });
  const radius = Math.max(0, Number(conn.radius ?? 0));
  if (conn.pathType === "bezier") {
    const mx = (a.x + b.x) / 2;
    const spread = radius > 0 ? radius : 0;
    const d = `M ${a.x} ${a.y} C ${mx} ${a.y + spread}, ${mx} ${b.y - spread}, ${b.x} ${b.y}`;
    return { d, x1: a.x, y1: a.y, x2: b.x, y2: b.y };
  }
  if (conn.vertices?.length) {
    if (radius > 0) {
      const pts = [a, ...conn.vertices.map((v) => ({ x: v.x, y: v.y })), b];
      const parts2 = [`M ${pts[0].x} ${pts[0].y}`];
      for (let i = 1; i < pts.length - 1; i++) {
        const prev = pts[i - 1];
        const cur = pts[i];
        const next = pts[i + 1];
        const d1x = cur.x - prev.x;
        const d1y = cur.y - prev.y;
        const d2x = next.x - cur.x;
        const d2y = next.y - cur.y;
        const l1 = Math.hypot(d1x, d1y) || 1;
        const l2 = Math.hypot(d2x, d2y) || 1;
        const r = Math.min(radius, l1 * 0.5, l2 * 0.5);
        const p1 = { x: cur.x - d1x / l1 * r, y: cur.y - d1y / l1 * r };
        const p2 = { x: cur.x + d2x / l2 * r, y: cur.y + d2y / l2 * r };
        parts2.push(`L ${p1.x} ${p1.y}`);
        parts2.push(`Q ${cur.x} ${cur.y} ${p2.x} ${p2.y}`);
      }
      const last = pts[pts.length - 1];
      parts2.push(`L ${last.x} ${last.y}`);
      return { d: parts2.join(" "), x1: a.x, y1: a.y, x2: b.x, y2: b.y };
    }
    const parts = [
      `M ${a.x} ${a.y}`,
      ...conn.vertices.map((v) => `L ${v.x} ${v.y}`),
      `L ${b.x} ${b.y}`
    ];
    return { d: parts.join(" "), x1: a.x, y1: a.y, x2: b.x, y2: b.y };
  }
  if (radius > 0) {
    const mx = (a.x + b.x) / 2;
    const my = (a.y + b.y) / 2;
    const dx = b.x - a.x;
    const dy = b.y - a.y;
    const len = Math.hypot(dx, dy) || 1;
    const ox = -dy / len * radius;
    const oy = dx / len * radius;
    const d = `M ${a.x} ${a.y} Q ${mx + ox} ${my + oy} ${b.x} ${b.y}`;
    return { d, x1: a.x, y1: a.y, x2: b.x, y2: b.y };
  }
  return {
    d: `M ${a.x} ${a.y} L ${b.x} ${b.y}`,
    x1: a.x,
    y1: a.y,
    x2: b.x,
    y2: b.y
  };
}
function setConnectionVertices(options, connectionId, vertices) {
  const connections = (options.connections ?? []).map(
    (c) => c.id === connectionId ? {
      ...c,
      vertices: vertices.map((v) => ({
        x: Number(v.x) || 0,
        y: Number(v.y) || 0
      }))
    } : c
  );
  return { ...options, connections };
}
function addConnectionVertex(options, connectionId, vertex) {
  const connections = (options.connections ?? []).map((c) => {
    if (c.id !== connectionId) return c;
    return {
      ...c,
      vertices: [...c.vertices ?? [], { x: Number(vertex.x) || 0, y: Number(vertex.y) || 0 }]
    };
  });
  return { ...options, connections };
}
function addConnection(options, sourceId, targetId, patch = {}) {
  if (!sourceId || !targetId || sourceId === targetId) return options;
  const connections = [...options.connections ?? []];
  const id = `conn-${sourceId}-${targetId}-${connections.length}`;
  connections.push({
    id,
    source: sourceId,
    target: targetId,
    color: patch.color ?? classicColor(14),
    pathType: patch.pathType ?? "straight",
    strokeWidth: patch.strokeWidth ?? 0.8,
    sourceOriginal: patch.sourceOriginal ?? { x: 0.5, y: 0.5 },
    targetOriginal: patch.targetOriginal ?? { x: 0.5, y: 0.5 }
  });
  return { ...options, elements: options.elements ?? [], connections };
}
function removeConnection(options, id) {
  return {
    ...options,
    elements: options.elements ?? [],
    connections: (options.connections ?? []).filter((c) => c.id !== id)
  };
}
function setConnectionPathType(options, connectionId, pathType) {
  const connections = (options.connections ?? []).map(
    (c) => c.id === connectionId ? { ...c, pathType } : c
  );
  return { ...options, connections };
}
function toggleConnectionPathType(options, connectionId) {
  const conn = (options.connections ?? []).find((c) => c.id === connectionId);
  if (!conn) return options;
  const next = conn.pathType === "bezier" ? "straight" : "bezier";
  return setConnectionPathType(options, connectionId, next);
}
function updateCanvasElement(elements, id, patch) {
  return elements.map((el) => {
    if (el.id !== id) return el;
    return { ...el, ...patch };
  });
}
function setElementConstraint(elements, id, constraint) {
  return elements.map((el) => el.id === id ? { ...el, constraint } : el);
}
function num(v, fallback) {
  const n = Number(v);
  return Number.isFinite(n) ? n : fallback;
}
function defaultCanvasElements(_value) {
  return [
    {
      type: "metric",
      id: "element-1",
      name: "Element 1",
      x: 100,
      y: 100,
      w: 260,
      h: 50,
      fill: "#c8cacc",
      text: "双击设置字段",
      fontSize: 20,
      align: "center",
      valign: "middle",
      textColor: resolveThemeModeHint() === "light" ? "rgb(36, 41, 46)" : "rgb(204, 204, 220)"
    }
  ];
}
function ensureElementIds(elements) {
  return elements.map((el, i) => ({ ...el, id: el.id ?? `el-${i}` }));
}
function addCanvasElement(elements, type) {
  const id = `el-${Date.now().toString(36)}-${elements.length}`;
  const base = { id, x: 40, y: 40 };
  let next;
  switch (type) {
    case "rect":
      next = { type: "rect", ...base, w: 20, h: 14, fill: classicBlue() };
      break;
    case "circle":
      next = { type: "circle", ...base, r: 8, fill: classicGreen() };
      break;
    case "text":
      next = {
        type: "text",
        ...base,
        w: 120,
        h: 40,
        text: "Text",
        fill: "#c8cacc",
        textColor: "#c8cacc",
        fontSize: 16,
        align: "center",
        valign: "middle"
      };
      break;
    case "metric":
      next = {
        type: "metric",
        ...base,
        field: "Value",
        fill: classicYellow(),
        text: "—",
        fontSize: 20,
        align: "center",
        valign: "middle"
      };
      break;
    case "line":
      next = {
        type: "line",
        ...base,
        x2: 60,
        y2: 60,
        stroke: classicColor(14),
        strokeWidth: 1
      };
      break;
    case "ellipse":
      next = {
        type: "ellipse",
        ...base,
        w: 18,
        h: 12,
        fill: classicPurple(),
        text: "",
        align: "center",
        valign: "middle",
        fontSize: 14
      };
      break;
    case "icon":
      next = {
        type: "icon",
        ...base,
        w: 10,
        h: 10,
        fill: classicColor(14),
        icon: "cube",
        path: "img/icons/unicons/question-circle.svg"
      };
      break;
    case "server":
      next = {
        type: "server",
        ...base,
        w: 14,
        h: 18,
        fill: classicBlue(),
        text: "Server",
        serverType: "single",
        blinkRate: 0,
        statusColor: classicBlue(),
        bulbColor: "var(--grafana-success)"
      };
      break;
    case "button":
      next = {
        type: "button",
        ...base,
        w: 18,
        h: 8,
        fill: classicBlue(),
        text: "Button",
        fontSize: 14,
        align: "center",
        buttonStyle: "primary"
      };
      break;
    case "drone":
      next = {
        type: "drone",
        ...base,
        w: 14,
        h: 10,
        fill: classicBlue(),
        text: "Drone"
      };
      break;
    case "droneTop":
      next = {
        type: "droneTop",
        ...base,
        w: 14,
        h: 10,
        fill: classicBlue(),
        text: "DroneTop",
        yawAngle: 0,
        fRightRotorRPM: 10,
        fLeftRotorRPM: 10,
        bRightRotorRPM: 10,
        bLeftRotorRPM: 10
      };
      break;
    case "droneFront":
      next = {
        type: "droneFront",
        ...base,
        w: 14,
        h: 10,
        fill: classicBlue(),
        text: "DroneFront",
        rollAngle: 0
      };
      break;
    case "droneSide":
      next = {
        type: "droneSide",
        ...base,
        w: 14,
        h: 10,
        fill: classicBlue(),
        text: "DroneSide",
        pitchAngle: 0
      };
      break;
    case "windTurbine":
      next = {
        type: "windTurbine",
        ...base,
        w: 12,
        h: 18,
        fill: classicColor(14),
        text: "Turbine",
        rpm: 10
      };
      break;
    case "cloud":
      next = {
        type: "cloud",
        ...base,
        w: 18,
        h: 12,
        fill: classicColor(14),
        text: "Cloud",
        align: "center",
        valign: "middle",
        fontSize: 14
      };
      break;
    case "triangle":
      next = {
        type: "triangle",
        ...base,
        w: 16,
        h: 14,
        fill: classicYellow(),
        text: "△",
        align: "center",
        valign: "middle",
        fontSize: 14
      };
      break;
    case "parallelogram":
      next = {
        type: "parallelogram",
        ...base,
        w: 20,
        h: 12,
        fill: classicPurple(),
        text: "◇",
        align: "center",
        valign: "middle",
        fontSize: 14
      };
      break;
    case "metricValue":
      next = {
        type: "metric",
        ...base,
        field: "Value",
        fill: classicYellow(),
        text: "—",
        fontSize: 20,
        align: "center",
        valign: "middle"
      };
      break;
    case "rectangle":
      next = { type: "rect", ...base, w: 20, h: 14, fill: classicBlue() };
      break;
    default:
      next = { type: "rect", ...base, w: 16, h: 12, fill: classicBlue() };
      break;
  }
  return [...ensureElementIds(elements), next];
}
function removeCanvasElements(elements, ids) {
  const set = new Set(ids);
  return elements.filter((el) => !el.id || !set.has(el.id));
}
function moveCanvasElement(elements, id, dx, dy) {
  return elements.map((el) => {
    if (el.id !== id) return el;
    if (el.type === "line") {
      return {
        ...el,
        x: el.x + dx,
        y: el.y + dy,
        x2: el.x2 + dx,
        y2: el.y2 + dy
      };
    }
    return { ...el, x: el.x + dx, y: el.y + dy };
  });
}
function moveCanvasElements(elements, ids, dx, dy) {
  let next = elements;
  for (const id of ids) next = moveCanvasElement(next, id, dx, dy);
  return next;
}
function resizeCanvasElement(elements, id, patch) {
  return elements.map((el) => {
    if (el.id !== id) return el;
    if (el.type === "rect" || el.type === "ellipse" || el.type === "icon" || el.type === "server" || el.type === "button" || el.type === "drone" || el.type === "windTurbine") {
      return {
        ...el,
        x: patch.x != null ? patch.x : el.x,
        y: patch.y != null ? patch.y : el.y,
        w: patch.w != null ? Math.max(1, patch.w) : el.w,
        h: patch.h != null ? Math.max(1, patch.h) : el.h
      };
    }
    if (el.type === "circle") {
      return {
        ...el,
        x: patch.x != null ? patch.x : el.x,
        y: patch.y != null ? patch.y : el.y,
        r: patch.r != null ? Math.max(1, patch.r) : el.r
      };
    }
    if (el.type === "line") {
      return {
        ...el,
        x2: patch.x2 != null ? patch.x2 : el.x2,
        y2: patch.y2 != null ? patch.y2 : el.y2
      };
    }
    if (el.type === "text" || el.type === "metric") {
      return {
        ...el,
        x: patch.x != null ? patch.x : el.x,
        y: patch.y != null ? patch.y : el.y
      };
    }
    return el;
  });
}
function selectCanvasElement(options, id, additive = false) {
  if (!id) return { ...options, selectedId: void 0, selectedIds: [] };
  let selectedIds = options.selectedIds ?? (options.selectedId ? [options.selectedId] : []);
  if (additive) {
    selectedIds = selectedIds.includes(id) ? selectedIds.filter((x) => x !== id) : [...selectedIds, id];
  } else {
    selectedIds = [id];
  }
  return {
    ...options,
    selectedId: selectedIds[selectedIds.length - 1],
    selectedIds
  };
}
function bindMetricText(elements, metricValue) {
  return elements.map((el) => {
    if (el.type !== "metric") return el;
    if (!el.field) return el;
    return { ...el, text: metricValue != null ? String(metricValue) : "—" };
  });
}
function serializeCanvasOptions(options) {
  const bgColor = options.backgroundColor ?? options.background ?? (resolveThemeModeHint() === "light" ? "rgb(251, 251, 251)" : "rgb(17, 18, 23)");
  const elements = ensureElementIds(options.elements ?? []);
  const connections = options.connections ?? collectConnections({}, elements);
  return {
    "background": {
      color: bgColor,
      ...options.backgroundImage ? { image: options.backgroundImage } : {},
      size: options.backgroundSize ?? "cover"
    },
    // flat alias for simpler consumers
    "background.color": bgColor,
    ...options.backgroundImage ? { "background.image": options.backgroundImage } : {},
    "background.size": options.backgroundSize ?? "cover",
    elements,
    connections,
    "root": {
      elements,
      ...typeof options.root === "object" && options.root ? options.root : {}
    },
    "inlineEditing": options.inlineEditing !== false,
    "panZoom": Boolean(
      options.panZoom === true || String(options.panZoom) === "true" || Number(options.panZoom) === 1
    ),
    "panZoomHelp": options.panZoomHelp !== false,
    "zoomToContent": Boolean(options.zoomToContent),
    "showAdvancedTypes": Boolean(options.showAdvancedTypes),
    "tooltip": {
      mode: options.tooltipMode ?? "auto",
      disableForOneClick: Boolean(options.tooltipDisableForOneClick)
    },
    "tooltip.mode": options.tooltipMode ?? "auto",
    "tooltip.disableForOneClick": Boolean(options.tooltipDisableForOneClick),
    ...options.selectedId ? { selectedId: options.selectedId } : {},
    ...options.selectedIds?.length ? { selectedIds: options.selectedIds } : {}
  };
}
function elementBounds(el) {
  if (el.type === "rect" || el.type === "ellipse") return { x: el.x, y: el.y, w: el.w, h: el.h };
  if (el.type === "circle") return { x: el.x - el.r, y: el.y - el.r, w: el.r * 2, h: el.r * 2 };
  if (el.type === "icon" || el.type === "server" || el.type === "button" || el.type === "drone" || el.type === "droneTop" || el.type === "droneFront" || el.type === "droneSide" || el.type === "windTurbine" || el.type === "cloud" || el.type === "triangle" || el.type === "parallelogram") {
    return { x: el.x, y: el.y, w: el.w ?? 10, h: el.h ?? 10 };
  }
  if (el.type === "line") {
    const x = Math.min(el.x, el.x2);
    const y = Math.min(el.y, el.y2);
    return {
      x,
      y,
      w: Math.max(1, Math.abs(el.x2 - el.x)),
      h: Math.max(1, Math.abs(el.y2 - el.y))
    };
  }
  return { x: el.x, y: el.y - 4, w: 20, h: 8 };
}
function cloneOptions(snapshot) {
  return JSON.parse(JSON.stringify(snapshot));
}
class CanvasHistory {
  past = [];
  future = [];
  limit;
  constructor(limit = 50) {
    this.limit = limit;
  }
  push(snapshot) {
    this.past.push(cloneOptions(snapshot));
    if (this.past.length > this.limit) this.past.shift();
    this.future = [];
  }
  undo(current) {
    const prev = this.past.pop();
    if (!prev) return null;
    this.future.push(cloneOptions(current));
    return prev;
  }
  redo(current) {
    const next = this.future.pop();
    if (!next) return null;
    this.past.push(cloneOptions(current));
    return next;
  }
  get canUndo() {
    return this.past.length > 0;
  }
  get canRedo() {
    return this.future.length > 0;
  }
}
const _hoisted_1$2U = ["data-inline-editing", "data-pan-zoom", "data-zoom-to-content", "data-show-advanced", "data-can-edit", "data-editable-prop", "data-tooltip-mode", "data-tooltip-disable-one-click", "data-tooltip-open", "data-bg-color", "data-bg-image", "data-bg-size", "data-border-color", "data-border-width", "data-border-radius", "data-color", "data-element-count", "data-connection-count", "data-has-root", "data-has-drone", "data-has-wind-turbine", "data-vertex-total", "data-view-scale", "data-view-pan-x", "data-view-pan-y", "data-pan-zoom-help"];
const _hoisted_2$2n = {
  key: 0,
  class: "pan-zoom-help",
  "data-testid": "canvas-pan-zoom-help",
  role: "note"
};
const _hoisted_3$27 = {
  key: 1,
  class: "toolbar",
  "data-testid": "canvas-toolbar"
};
const _hoisted_4$1Q = ["disabled"];
const _hoisted_5$1D = ["disabled"];
const _hoisted_6$1q = ["disabled"];
const _hoisted_7$1g = ["disabled"];
const _hoisted_8$18 = ["disabled"];
const _hoisted_9$13 = ["disabled"];
const _hoisted_10$V = ["disabled"];
const _hoisted_11$Q = {
  key: 5,
  class: "constraint"
};
const _hoisted_12$J = ["value"];
const _hoisted_13$I = {
  key: 6,
  class: "constraint"
};
const _hoisted_14$D = ["value"];
const _hoisted_15$y = {
  key: 2,
  class: "element-props",
  "data-testid": "canvas-element-props"
};
const _hoisted_16$v = ["value"];
const _hoisted_17$t = ["value"];
const _hoisted_18$t = { key: 0 };
const _hoisted_19$r = ["value"];
const _hoisted_20$p = { key: 1 };
const _hoisted_21$h = ["value"];
const _hoisted_22$d = { key: 2 };
const _hoisted_23$a = ["value"];
const _hoisted_24$a = { key: 3 };
const _hoisted_25$8 = ["value"];
const _hoisted_26$7 = { key: 4 };
const _hoisted_27$6 = ["value"];
const _hoisted_28$6 = { key: 5 };
const _hoisted_29$6 = ["value"];
const _hoisted_30$6 = { key: 6 };
const _hoisted_31$6 = ["value"];
const _hoisted_32$5 = { key: 7 };
const _hoisted_33$5 = ["value"];
const _hoisted_34$5 = { key: 8 };
const _hoisted_35$4 = ["value"];
const _hoisted_36$3 = { key: 9 };
const _hoisted_37$3 = ["value"];
const _hoisted_38$2 = { key: 10 };
const _hoisted_39$1 = ["value"];
const _hoisted_40$1 = { key: 11 };
const _hoisted_41$1 = ["value"];
const _hoisted_42$1 = { key: 12 };
const _hoisted_43$1 = ["value"];
const _hoisted_44$1 = { key: 13 };
const _hoisted_45$1 = ["value"];
const _hoisted_46$1 = { key: 14 };
const _hoisted_47$1 = ["value"];
const _hoisted_48$1 = { key: 15 };
const _hoisted_49$1 = ["value"];
const _hoisted_50$1 = { key: 16 };
const _hoisted_51$1 = ["value"];
const _hoisted_52$1 = { key: 17 };
const _hoisted_53$1 = ["value"];
const _hoisted_54$1 = { key: 18 };
const _hoisted_55$1 = ["value"];
const _hoisted_56$1 = { key: 19 };
const _hoisted_57$1 = ["value"];
const _hoisted_58$1 = { key: 20 };
const _hoisted_59$1 = ["value"];
const _hoisted_60$1 = { key: 21 };
const _hoisted_61$1 = ["value"];
const _hoisted_62$1 = { key: 22 };
const _hoisted_63 = ["value"];
const _hoisted_64 = { key: 23 };
const _hoisted_65 = ["value"];
const _hoisted_66 = ["value"];
const _hoisted_67 = ["value"];
const _hoisted_68 = ["data-inline-editing", "data-pan-zoom", "data-bg-color"];
const _hoisted_69 = ["data-el-type", "data-el-id", "data-server-type", "data-blink-rate", "data-status-color", "data-bulb-color", "data-rpm", "data-icon-path", "data-icon-fill", "data-align", "data-valign", "data-font-size", "data-text-color", "data-button-style", "data-yaw-angle", "data-roll-angle", "data-pitch-angle", "data-fr-rpm", "data-fl-rpm", "data-br-rpm", "data-bl-rpm", "data-rotation", "data-bg-color", "data-bg-image", "data-border-color", "data-border-width", "data-border-radius", "data-has-links", "data-has-actions", "data-link-count", "data-el-animation", "title", "onPointerdown", "onPointerenter", "onPointermove", "onClick"];
const _hoisted_70 = ["data-align", "data-valign"];
const _hoisted_71 = ["data-align", "data-valign"];
const _hoisted_72 = ["data-align", "data-valign"];
const _hoisted_73 = ["data-shape-type", "data-align", "data-valign"];
const _hoisted_74 = ["viewBox"];
const _hoisted_75 = ["cx", "cy", "rx", "ry", "fill"];
const _hoisted_76 = ["d", "fill"];
const _hoisted_77 = ["points", "fill"];
const _hoisted_78 = ["points", "fill"];
const _hoisted_79 = ["data-align", "data-valign"];
const _hoisted_80 = ["data-align", "data-button-style"];
const _hoisted_81 = ["data-rpm"];
const _hoisted_82 = {
  viewBox: "0 0 100 155",
  class: "wind-turbine-svg",
  preserveAspectRatio: "xMidYMid meet"
};
const _hoisted_83 = ["data-rpm"];
const _hoisted_84 = { class: "wt-label" };
const _hoisted_85 = ["data-icon-path", "data-icon-fill"];
const _hoisted_86 = ["src", "alt", "data-icon-path"];
const _hoisted_87 = ["fill"];
const _hoisted_88 = ["data-drone-type", "data-yaw-angle", "data-roll-angle", "data-pitch-angle", "data-fr-rpm", "data-fl-rpm", "data-br-rpm", "data-bl-rpm"];
const _hoisted_89 = {
  class: "canvas-drone-svg",
  viewBox: "0 0 100 80",
  preserveAspectRatio: "xMidYMid meet"
};
const _hoisted_90 = ["fill"];
const _hoisted_91 = ["data-rpm"];
const _hoisted_92 = ["data-rpm"];
const _hoisted_93 = ["data-rpm"];
const _hoisted_94 = ["data-rpm"];
const _hoisted_95 = { class: "drone-label" };
const _hoisted_96 = {
  key: 8,
  class: "fallback-label"
};
const _hoisted_97 = ["viewBox", "width", "height"];
const _hoisted_98 = ["data-source", "data-target", "data-vertex-count", "data-path-type", "data-direction", "data-line-style", "data-animate", "data-radius", "data-marker-end", "data-marker-start"];
const _hoisted_99 = ["d", "stroke", "stroke-width", "data-connection-color", "data-connection-width", "stroke-dasharray", "marker-end", "marker-start"];
const _hoisted_100 = ["values"];
const _hoisted_101 = ["viewBox", "data-inline-editing", "data-pan-zoom", "data-bg-color"];
const _hoisted_102 = { key: 0 };
const _hoisted_103 = ["width", "height"];
const _hoisted_104 = ["href", "width", "height", "preserveAspectRatio"];
const _hoisted_105 = ["width", "height", "fill"];
const _hoisted_106 = ["data-source", "data-target", "data-vertex-count", "data-path-type", "data-direction", "data-line-style", "data-animate", "data-radius", "data-marker-end", "data-marker-start"];
const _hoisted_107 = ["d", "stroke", "stroke-width", "data-connection-color", "data-connection-width", "stroke-dasharray", "marker-end", "marker-start"];
const _hoisted_108 = ["values"];
const _hoisted_109 = ["cx", "cy", "fill", "onPointerdown"];
const _hoisted_110 = ["data-el-type", "data-server-type", "data-blink-rate", "data-status-color", "data-bulb-color", "data-el-animation", "transform", "onPointerdown", "onPointerenter", "onPointermove"];
const _hoisted_111 = ["x", "y", "width", "height", "rx", "fill", "stroke", "data-el-id"];
const _hoisted_112 = ["cx", "cy", "fill", "data-testid"];
const _hoisted_113 = ["x", "y", "text-anchor", "fill", "font-size", "data-align", "data-button-style"];
const _hoisted_114 = ["x1", "y1", "x2", "y2"];
const _hoisted_115 = ["data-rpm", "data-el-id", "transform"];
const _hoisted_116 = ["cx", "cy", "r", "fill", "stroke"];
const _hoisted_117 = ["cx", "cy", "rx", "ry", "fill", "stroke"];
const _hoisted_118 = ["d", "fill", "stroke"];
const _hoisted_119 = ["points", "fill", "stroke"];
const _hoisted_120 = ["points", "fill", "stroke"];
const _hoisted_121 = ["x", "y", "text-anchor", "fill", "font-size", "data-align", "data-valign"];
const _hoisted_122 = ["x", "y", "width", "height", "fill", "stroke", "data-icon-path", "data-icon-fill"];
const _hoisted_123 = ["href", "x", "y", "width", "height", "data-icon-path"];
const _hoisted_124 = ["x", "y"];
const _hoisted_125 = ["x1", "y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray", "data-line-style", "data-has-links", "data-has-actions", "title", "onPointerenter", "onPointermove", "onClick"];
const _hoisted_126 = ["x", "y", "width", "height", "fill", "stroke", "data-el-id"];
const _hoisted_127 = ["x", "y", "fill", "font-size"];
const _hoisted_128 = ["x", "y", "fill", "font-size"];
const _hoisted_129 = ["x", "y", "onPointerdown"];
const _hoisted_130 = ["data-el-id"];
const _sfc_main$3R = /* @__PURE__ */ defineComponent({
  __name: "CanvasEditor",
  props: {
    options: {},
    metricValue: {},
    editable: { type: Boolean },
    width: {},
    height: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const viewBox = computed(() => {
      const w = Number(props.width);
      const h2 = Number(props.height);
      if (Number.isFinite(w) && w > 0 && Number.isFinite(h2) && h2 > 0) {
        return `0 0 ${Math.round(w)} ${Math.round(h2)}`;
      }
      return "0 0 100 100";
    });
    const viewBoxW = computed(() => {
      const w = Number(props.width);
      return Number.isFinite(w) && w > 0 ? Math.round(w) : 100;
    });
    const viewBoxH = computed(() => {
      const h2 = Number(props.height);
      return Number.isFinite(h2) && h2 > 0 ? Math.round(h2) : 100;
    });
    const usePixelLayout = computed(() => {
      const w = Number(props.width);
      const h2 = Number(props.height);
      return Number.isFinite(w) && w > 40 && Number.isFinite(h2) && h2 > 40;
    });
    const emit = __emit;
    const local = ref(normalizeCanvasOptions(props.options ?? {}));
    const canEdit = computed(() => {
      if (props.editable === true) return true;
      if (local.value.inlineEditing === false) return false;
      return true;
    });
    const viewScale = ref(1);
    const viewPan = ref({ x: 0, y: 0 });
    const editorRoot = ref(null);
    const hoverTip = ref(null);
    const history2 = new CanvasHistory();
    const canUndo = ref(false);
    const canRedo = ref(false);
    function refreshHistoryFlags() {
      canUndo.value = history2.canUndo;
      canRedo.value = history2.canRedo;
    }
    watch(
      () => props.options,
      (o) => {
        if (o) local.value = normalizeCanvasOptions(o);
      },
      { deep: true }
    );
    const elements = computed(() => {
      let base = local.value.elements?.length ? local.value.elements : defaultCanvasElements(props.metricValue);
      base = applyConstraints(base, Number(props.width) || 100, Number(props.height) || 100);
      return bindMetricText(base, props.metricValue);
    });
    function fitToContent() {
      if (!local.value.zoomToContent) {
        viewScale.value = 1;
        viewPan.value = { x: 0, y: 0 };
        return;
      }
      const list = elements.value;
      if (!list.length) {
        viewScale.value = 1;
        viewPan.value = { x: 0, y: 0 };
        return;
      }
      let minX = Infinity;
      let minY = Infinity;
      let maxX = -Infinity;
      let maxY = -Infinity;
      for (const el of list) {
        const b = elementBounds(el);
        minX = Math.min(minX, b.x);
        minY = Math.min(minY, b.y);
        maxX = Math.max(maxX, b.x + b.w);
        maxY = Math.max(maxY, b.y + b.h);
      }
      if (!Number.isFinite(minX) || !Number.isFinite(maxX)) return;
      const contentW = Math.max(1, maxX - minX);
      const contentH = Math.max(1, maxY - minY);
      const pad = 0.08;
      const vw = Math.max(1, viewBoxW.value);
      const vh = Math.max(1, viewBoxH.value);
      const scale = Math.max(0.4, Math.min(3, (1 - pad * 2) * Math.min(vw / contentW, vh / contentH)));
      const contentCx = (minX + maxX) / 2;
      const contentCy = (minY + maxY) / 2;
      viewScale.value = scale;
      viewPan.value = {
        x: (vw / 2 - contentCx) * scale,
        y: (vh / 2 - contentCy) * scale
      };
    }
    watch(
      () => [local.value.zoomToContent, elements.value, viewBoxW.value, viewBoxH.value],
      () => fitToContent(),
      { immediate: true, deep: true }
    );
    const selectedIds = computed(
      () => local.value.selectedIds ?? (local.value.selectedId ? [local.value.selectedId] : [])
    );
    const connections = computed(() => local.value.connections ?? []);
    const connectionPaths = computed(
      () => connections.value.map((c) => {
        const path = connectionPath(elements.value, c);
        return path ? { conn: c, ...path } : null;
      }).filter(Boolean)
    );
    const panelDirectionDefault = computed(
      () => local.value.direction ?? props.options?.direction
    );
    function connectionDirectionOf(conn) {
      return resolveConnectionDirection(conn.direction, panelDirectionDefault.value);
    }
    function connectionDashOf(conn) {
      const ls = conn.lineStyle ?? local.value.lineStyle ?? props.options?.lineStyle;
      return resolveLineDash(ls);
    }
    function connectionMarkerEnd(conn) {
      const d = connectionDirectionOf(conn);
      return d === "forward" || d === "both" ? "url(#canvas-arrow)" : void 0;
    }
    function connectionMarkerStart(conn) {
      const d = connectionDirectionOf(conn);
      return d === "reverse" || d === "both" ? "url(#canvas-arrow-start)" : void 0;
    }
    function connectionAnimateOf(conn) {
      return resolveConnectionAnimate(
        conn.lineStyle ?? local.value.lineStyle ?? props.options?.lineStyle,
        conn.animate
      );
    }
    function connectionAnimateValues(conn) {
      return connectionDirectionOf(conn) === "reverse" ? "0;100" : "100;0";
    }
    function htmlElStyle(el) {
      const any = el;
      const w = Number(any.w ?? (el.type === "circle" ? (any.r ?? 8) * 2 : 100));
      const h2 = Number(any.h ?? (el.type === "circle" ? (any.r ?? 8) * 2 : 100));
      const base = {
        position: "absolute",
        left: `${el.x}px`,
        top: `${el.y}px`,
        width: `${w}px`,
        height: `${h2}px`,
        boxSizing: "border-box"
      };
      if (el.type === "metric" || el.type === "text") {
        if (el.type === "metric") {
          base.background = String(any.fill ?? "var(--grafana-border)");
        } else {
          base.background = "transparent";
        }
        base.display = "table";
        base.color = String(
          any.textColor ?? (el.type === "text" ? any.fill : void 0) ?? "var(--grafana-text)"
        );
        base.fontSize = `${Number(any.fontSize ?? (el.type === "text" ? 16 : 20))}px`;
        base.fontFamily = "Inter, Helvetica, Arial, sans-serif";
        base.fontWeight = "400";
        base.lineHeight = "normal";
        base["--canvas-metric-align"] = String(any.align ?? "center");
        base["--canvas-metric-valign"] = String(any.valign ?? "middle");
        base.textAlign = String(any.align ?? "center");
      } else if (el.type === "rect") {
        base.background = String(any.fill ?? "var(--grafana-primary)");
        base.display = "table";
        base.color = String(any.textColor ?? "var(--grafana-text)");
        if (any.fontSize != null) base.fontSize = `${Number(any.fontSize)}px`;
        base.fontFamily = "Inter, Helvetica, Arial, sans-serif";
        base["--canvas-metric-align"] = String(any.align ?? "center");
        base["--canvas-metric-valign"] = String(any.valign ?? "middle");
        base.textAlign = String(any.align ?? "center");
      } else if (el.type === "windTurbine") {
        base.background = "transparent";
        const rpm = Math.max(0, Number(any.rpm ?? 0));
        base["--canvas-wt-rpm"] = String(rpm);
        if (rpm > 0) {
          base["--canvas-wt-spin"] = `${60 / Math.abs(rpm)}s`;
        } else {
          base["--canvas-wt-spin"] = "0s";
        }
      } else if (el.type === "icon") {
        const fill = String(any.fill ?? "var(--grafana-primary)");
        base.background = "transparent";
        base.color = fill;
        base.fill = fill;
        if (any.path) base["--canvas-icon-path"] = String(any.path);
      } else if (el.type === "server") {
        const status = String(any.statusColor ?? any.fill ?? "var(--grafana-primary)");
        base.background = status;
        if (any.bulbColor) base["--canvas-bulb"] = String(any.bulbColor);
        const blink = Number(any.blinkRate ?? 0);
        if (Number.isFinite(blink) && blink > 0) {
          base["--canvas-blink-dur"] = `${Math.max(0.05, 1 / blink)}s`;
          base.animation = `canvas-server-blink var(--canvas-blink-dur) infinite step-end`;
        }
        const st = String(any.serverType ?? "single");
        if (st === "stack") {
          base.boxShadow = "inset 0 0 0 2px var(--grafana-border)";
        } else if (st === "database") {
          base.borderRadius = "40% / 18%";
        } else if (st === "terminal") {
          base.borderRadius = "2px";
          base.border = "1px solid var(--grafana-border)";
        }
      } else if (el.type === "button") {
        base.background = String(any.fill ?? "var(--grafana-primary)");
        base.display = "table";
        base.color = String(any.textColor ?? "var(--grafana-bg-canvas)");
        base.fontSize = `${Number(any.fontSize ?? 14)}px`;
        base.fontFamily = "Inter, Helvetica, Arial, sans-serif";
        base.textAlign = String(any.align ?? "center");
        base["--canvas-metric-align"] = String(any.align ?? "center");
        const st = String(any.buttonStyle ?? "primary");
        if (st === "secondary") {
          base.background = "var(--grafana-bg-secondary)";
          base.color = String(any.textColor ?? "var(--grafana-text)");
          base.border = "1px solid var(--grafana-border)";
        } else if (st === "destructive") {
          base.background = "var(--grafana-error)";
        }
        base.borderRadius = "4px";
      } else if (el.type === "circle") {
        base.background = String(any.fill ?? classicGreen());
        base.borderRadius = "50%";
      } else if (el.type === "ellipse") {
        base.background = String(any.fill ?? classicPurple());
        base.borderRadius = "50%";
        base.display = "table";
        base.color = String(any.textColor ?? "var(--grafana-text)");
        if (any.fontSize != null) base.fontSize = `${Number(any.fontSize)}px`;
        base.textAlign = String(any.align ?? "center");
        base["--canvas-metric-align"] = String(any.align ?? "center");
        base["--canvas-metric-valign"] = String(any.valign ?? "middle");
      } else if (el.type === "cloud" || el.type === "triangle" || el.type === "parallelogram") {
        base.background = "transparent";
        base.display = "table";
        base.color = String(any.textColor ?? "var(--grafana-text)");
        if (any.fontSize != null) base.fontSize = `${Number(any.fontSize)}px`;
        base.textAlign = String(any.align ?? "center");
        base["--canvas-metric-align"] = String(any.align ?? "center");
        base["--canvas-metric-valign"] = String(any.valign ?? "middle");
        base["--canvas-shape-fill"] = String(any.fill ?? "var(--grafana-primary)");
      } else if (el.type === "droneTop" || el.type === "droneFront" || el.type === "droneSide" || el.type === "drone") {
        base.background = "transparent";
        const yaw = Number(any.yawAngle ?? 0);
        const roll = Number(any.rollAngle ?? 0);
        const pitch = Number(any.pitchAngle ?? 0);
        const deg = el.type === "droneTop" ? yaw : el.type === "droneFront" ? roll : el.type === "droneSide" ? pitch : 0;
        if (Number.isFinite(deg) && deg !== 0) {
          base.transform = `rotate(${deg}deg)`;
        }
        base["--canvas-drone-angle"] = String(deg || 0);
        for (const k of ["fRightRotorRPM", "fLeftRotorRPM", "bRightRotorRPM", "bLeftRotorRPM"]) {
          const rpm = Math.max(0, Number(any[k] ?? 0));
          if (rpm > 0) base[`--canvas-drone-${k}`] = String(60 / rpm);
        }
      }
      if (any.backgroundColor) {
        if (!base.background || base.background === "transparent") {
          base.background = String(any.backgroundColor);
        } else if (el.type === "rect" || el.type === "text" || el.type === "button") {
          base.background = String(any.backgroundColor);
        }
      }
      if (any.backgroundImage) {
        const size = String(any.backgroundSize || "contain");
        base.backgroundImage = `url(${any.backgroundImage})`;
        base.backgroundSize = size === "original" ? "auto" : size === "tile" ? "auto" : size;
        base.backgroundRepeat = size === "tile" ? "repeat" : "no-repeat";
        base.backgroundPosition = "center";
      }
      if (any.borderColor && any.borderWidth != null && Number(any.borderWidth) > 0) {
        base.border = `${Number(any.borderWidth)}px solid ${String(any.borderColor)}`;
      } else if (any.borderWidth != null && Number(any.borderWidth) > 0) {
        base.border = `${Number(any.borderWidth)}px solid var(--grafana-border)`;
      }
      if (any.borderRadius != null && Number.isFinite(Number(any.borderRadius))) {
        base.borderRadius = `${Number(any.borderRadius)}px`;
      }
      const rot = Number(any.rotation ?? 0);
      if (Number.isFinite(rot) && rot !== 0) {
        const existing = base.transform ? `${String(base.transform)} ` : "";
        base.transform = `${existing}rotate(${rot}deg)`.trim();
        base.transformOrigin = "center center";
      }
      base["--canvas-el-rotation"] = String(rot || 0);
      if (isSelected(el.id)) {
        base.outline = "1px solid var(--grafana-input-bg)";
      }
      return base;
    }
    function windTurbineSpinStyle(el) {
      const rpm = Math.max(0, Number(el.rpm ?? 0));
      if (!(rpm > 0)) return void 0;
      return {
        animation: `canvas-wt-spin ${60 / Math.abs(rpm)}s linear infinite`,
        transformOrigin: "50% 35%"
      };
    }
    function droneRotorSpinStyle(rpm) {
      const n = Math.max(0, Number(rpm ?? 0));
      if (!(n > 0)) return void 0;
      return {
        animation: `canvas-wt-spin ${60 / Math.abs(n)}s linear infinite`,
        transformOrigin: "center"
      };
    }
    function droneAngleOf(el) {
      const any = el;
      if (el.type === "droneTop") return Number(any.yawAngle ?? 0) || 0;
      if (el.type === "droneFront") return Number(any.rollAngle ?? 0) || 0;
      if (el.type === "droneSide") return Number(any.pitchAngle ?? 0) || 0;
      return 0;
    }
    function iconFillOf(el) {
      return String(el.fill ?? "var(--grafana-primary)");
    }
    function iconPathOf(el) {
      return String(el.path ?? el.icon ?? "img/icons/unicons/question-circle.svg");
    }
    function isSelected(id) {
      return !!id && selectedIds.value.includes(id);
    }
    function connectSelected() {
      if (selectedIds.value.length < 2) return;
      const [source, target] = selectedIds.value.slice(-2);
      const base = {
        ...local.value,
        elements: elements.value,
        connections: local.value.connections ?? []
      };
      commit(addConnection(base, source, target));
    }
    function removeSelectedConnections() {
      let next = {
        ...local.value,
        elements: elements.value,
        connections: [...local.value.connections ?? []]
      };
      for (const c of connections.value) {
        if (selectedIds.value.includes(c.source) || selectedIds.value.includes(c.target)) {
          next = removeConnection(next, c.id ?? "");
        }
      }
      commit(next);
    }
    function toggleLastPathType() {
      const last = connections.value[connections.value.length - 1];
      if (!last?.id) return;
      commit(
        toggleConnectionPathType(
          {
            ...local.value,
            elements: elements.value,
            connections: local.value.connections ?? []
          },
          last.id
        )
      );
    }
    function setConstraint(axis, value) {
      const id = selectedIds.value[selectedIds.value.length - 1];
      if (!id) return;
      const el = elements.value.find((e) => e.id === id);
      const constraint = { ...el?.constraint ?? {}, [axis]: value };
      let els = setElementConstraint(elements.value, id, constraint);
      els = applyConstraints(els, 100, 100);
      commit({ ...local.value, elements: els });
    }
    function hasTextProp(el) {
      if (!el) return false;
      return "text" in el || [
        "text",
        "metric",
        "button",
        "server",
        "drone",
        "droneTop",
        "droneFront",
        "droneSide",
        "windTurbine",
        "cloud",
        "triangle",
        "parallelogram",
        "rect"
      ].includes(el.type);
    }
    function patchSelectedElement(partial) {
      const id = selectedIds.value[selectedIds.value.length - 1];
      if (!id) return;
      const els = updateCanvasElement(elements.value, id, partial);
      commit({ ...local.value, elements: els });
    }
    const selectedElement = computed(() => {
      const id = selectedIds.value[selectedIds.value.length - 1];
      return elements.value.find((e) => e.id === id);
    });
    function commit(next, record = true) {
      if (record) history2.push(local.value);
      local.value = next;
      emit("change", serializeCanvasOptions(next));
      refreshHistoryFlags();
    }
    function add(type) {
      const els = addCanvasElement(elements.value, type);
      const selectedId = els[els.length - 1]?.id;
      commit({
        ...local.value,
        elements: els,
        selectedId,
        selectedIds: selectedId ? [selectedId] : []
      });
    }
    function removeSelected() {
      if (!selectedIds.value.length) return;
      commit({
        ...local.value,
        elements: removeCanvasElements(elements.value, selectedIds.value),
        selectedId: void 0,
        selectedIds: []
      });
    }
    function select(id, additive = false) {
      commit(selectCanvasElement({ ...local.value, elements: elements.value }, id, additive), false);
    }
    function undo() {
      const prev = history2.undo(local.value);
      if (!prev) return;
      local.value = prev;
      emit("change", serializeCanvasOptions(prev));
      refreshHistoryFlags();
    }
    function redo() {
      const next = history2.redo(local.value);
      if (!next) return;
      local.value = next;
      emit("change", serializeCanvasOptions(next));
      refreshHistoryFlags();
    }
    const dragging = ref(null);
    function svgPoint(evt, svg) {
      const pt = svg.createSVGPoint();
      pt.x = evt.clientX;
      pt.y = evt.clientY;
      const ctm = svg.getScreenCTM();
      if (!ctm) return { x: 0, y: 0 };
      const p = pt.matrixTransform(ctm.inverse());
      return { x: p.x, y: p.y };
    }
    function ownerSvg(evt) {
      const el = evt.currentTarget;
      if (el instanceof SVGSVGElement) return el;
      return el.ownerSVGElement;
    }
    function onPointerDown(evt, id) {
      if (props.editable === false) return;
      const svg = ownerSvg(evt);
      if (!svg) return;
      evt.currentTarget.setPointerCapture?.(evt.pointerId);
      const p = svgPoint(evt, svg);
      const additive = evt.shiftKey || evt.metaKey || evt.ctrlKey;
      const nextSel = selectCanvasElement({ ...local.value, elements: elements.value }, id, additive);
      local.value = nextSel;
      const ids = nextSel.selectedIds?.length ? nextSel.selectedIds : [id];
      dragging.value = { kind: "move", ids, lastX: p.x, lastY: p.y };
    }
    function onResizeDown(evt, id) {
      if (props.editable === false) return;
      evt.stopPropagation();
      const svg = ownerSvg(evt);
      if (!svg) return;
      evt.currentTarget.setPointerCapture?.(evt.pointerId);
      const p = svgPoint(evt, svg);
      const origin = elements.value.find((e) => e.id === id);
      if (!origin) return;
      history2.push(local.value);
      dragging.value = {
        kind: "resize",
        id,
        startX: p.x,
        startY: p.y,
        origin: JSON.parse(JSON.stringify(origin))
      };
      local.value = { ...local.value, selectedId: id, selectedIds: [id] };
    }
    function onPointerMove(evt) {
      if (!dragging.value || !props.editable) return;
      if (dragging.value.kind === "vertex") {
        const svg2 = ownerSvg(evt);
        if (!svg2) return;
        const p2 = svgPoint(evt, svg2);
        const d = dragging.value;
        const conn = (local.value.connections ?? []).find((c) => c.id === d.connId);
        if (!conn) return;
        const verts = [...conn.vertices ?? []];
        verts[d.vertexIndex] = { x: p2.x, y: p2.y };
        local.value = setConnectionVertices(local.value, d.connId, verts);
        return;
      }
      const svg = ownerSvg(evt);
      if (!svg) return;
      const p = svgPoint(evt, svg);
      if (dragging.value.kind === "move") {
        const dx = p.x - dragging.value.lastX;
        const dy = p.y - dragging.value.lastY;
        if (Math.abs(dx) < 0.01 && Math.abs(dy) < 0.01) return;
        const els = moveCanvasElements(elements.value, dragging.value.ids, dx, dy);
        dragging.value = {
          kind: "move",
          ids: dragging.value.ids,
          lastX: p.x,
          lastY: p.y
        };
        local.value = { ...local.value, elements: els };
        return;
      }
      const { id, origin } = dragging.value;
      if (origin.type === "rect" || origin.type === "ellipse" || origin.type === "icon" || origin.type === "server" || origin.type === "button" || origin.type === "drone" || origin.type === "droneTop" || origin.type === "droneFront" || origin.type === "droneSide" || origin.type === "windTurbine" || origin.type === "cloud" || origin.type === "triangle" || origin.type === "parallelogram") {
        const w = Math.max(1, Number(origin.w ?? 12) + (p.x - dragging.value.startX));
        const h2 = Math.max(1, Number(origin.h ?? 10) + (p.y - dragging.value.startY));
        local.value = {
          ...local.value,
          elements: resizeCanvasElement(elements.value, id, { w, h: h2 })
        };
      } else if (origin.type === "circle") {
        const r = Math.max(
          1,
          origin.r + (p.x - dragging.value.startX + p.y - dragging.value.startY) / 2
        );
        local.value = {
          ...local.value,
          elements: resizeCanvasElement(elements.value, id, { r })
        };
      } else if (origin.type === "line") {
        local.value = {
          ...local.value,
          elements: resizeCanvasElement(elements.value, id, { x2: p.x, y2: p.y })
        };
      }
    }
    function onPointerUp() {
      if (!dragging.value) return;
      const wasResize = dragging.value.kind === "resize";
      dragging.value = null;
      commit({ ...local.value, elements: elements.value }, !wasResize);
    }
    function onVertexDown(evt, connId, vertexIndex) {
      if (props.editable === false) return;
      evt.stopPropagation();
      const svg = ownerSvg(evt);
      if (!svg) return;
      evt.currentTarget.setPointerCapture?.(evt.pointerId);
      history2.push(local.value);
      dragging.value = { kind: "vertex", connId, vertexIndex };
    }
    function addVertexToLast() {
      const last = connections.value[connections.value.length - 1];
      if (!last?.id) return;
      history2.push(local.value);
      const mid = { x: 50, y: 50 };
      if (last.source && last.target) {
        const path = connectionPath(elements.value, last);
        if (path) {
          mid.x = (path.x1 + path.x2) / 2;
          mid.y = (path.y1 + path.y2) / 2;
        }
      }
      const next = addConnectionVertex(local.value, last.id, mid);
      commit(next, false);
    }
    function onWheel(evt) {
      if (!local.value.panZoom) return;
      evt.preventDefault();
      const dir = evt.deltaY > 0 ? 0.9 : 1.1;
      viewScale.value = Math.max(0.4, Math.min(3, viewScale.value * dir));
    }
    function onBgClick(evt) {
      hoverTip.value = null;
      if (props.editable === false) return;
      if (evt.target === evt.currentTarget) select(void 0);
    }
    function hit(el) {
      return el.id ?? "";
    }
    function cloudPath(el) {
      const x = Number(el.x), y = Number(el.y), w = Number(el.w ?? 16), h2 = Number(el.h ?? 12);
      const cy = y + h2 / 2;
      return `M ${x + w * 0.2} ${cy + h2 * 0.15}
    a ${w * 0.18} ${h2 * 0.22} 0 1 1 ${w * 0.15} ${-h2 * 0.2}
    a ${w * 0.22} ${h2 * 0.25} 0 1 1 ${w * 0.35} 0
    a ${w * 0.16} ${h2 * 0.2} 0 1 1 ${w * 0.12} ${h2 * 0.18}
    z`;
    }
    function trianglePoints(el) {
      const x = Number(el.x), y = Number(el.y), w = Number(el.w ?? 16), h2 = Number(el.h ?? 14);
      return `${x + w / 2},${y} ${x + w},${y + h2} ${x},${y + h2}`;
    }
    function parallelogramPoints(el) {
      const x = Number(el.x), y = Number(el.y), w = Number(el.w ?? 20), h2 = Number(el.h ?? 12);
      const skew = w * 0.25;
      return `${x + skew},${y} ${x + w},${y} ${x + w - skew},${y + h2} ${x},${y + h2}`;
    }
    function handlePos(el) {
      const b = elementBounds(el);
      return { x: b.x + b.w, y: b.y + b.h };
    }
    function elementHasOneClick(el) {
      return Array.isArray(el?.links) && el.links.length > 0;
    }
    function canvasTooltipEnabled() {
      const mode2 = String(local.value.tooltipMode ?? "auto").toLowerCase();
      return mode2 !== "none" && mode2 !== "hidden" && mode2 !== "off";
    }
    function canvasTooltipText(el) {
      const name = String(el?.name || el?.id || "").trim();
      const text = el?.text != null ? String(el.text).trim() : "";
      const type = String(el?.type || "element");
      const links = Array.isArray(el?.links) ? el.links.map((l) => l?.title || l?.url || (typeof l === "string" ? l : "")).filter(Boolean) : [];
      if (links.length) {
        const base = name || text || type;
        return `${base} · ${links.join(" · ")}`;
      }
      if (name && text && name !== text) return `${name}: ${text}`;
      if (text) return text;
      if (name) return name;
      return type;
    }
    function shouldShowCanvasTooltip(el) {
      if (!canvasTooltipEnabled()) return false;
      if (local.value.tooltipDisableForOneClick && elementHasOneClick(el)) {
        return false;
      }
      return true;
    }
    function positionHoverTip(ev, el) {
      if (!shouldShowCanvasTooltip(el)) {
        hoverTip.value = null;
        return;
      }
      const root = editorRoot.value;
      const rect = root?.getBoundingClientRect();
      const x = rect ? ev.clientX - rect.left + 12 : 12;
      const y = rect ? ev.clientY - rect.top + 12 : 12;
      hoverTip.value = {
        text: canvasTooltipText(el),
        x: Math.max(0, x),
        y: Math.max(0, y),
        elId: String(el?.id ?? hit(el) ?? "")
      };
    }
    function onElementTooltipEnter(ev, el) {
      positionHoverTip(ev, el);
    }
    function onElementTooltipMove(ev, el) {
      if (!hoverTip.value) {
        positionHoverTip(ev, el);
        return;
      }
      if (!shouldShowCanvasTooltip(el)) {
        hoverTip.value = null;
        return;
      }
      const root = editorRoot.value;
      const rect = root?.getBoundingClientRect();
      hoverTip.value = {
        ...hoverTip.value,
        text: canvasTooltipText(el),
        x: rect ? Math.max(0, ev.clientX - rect.left + 12) : hoverTip.value.x,
        y: rect ? Math.max(0, ev.clientY - rect.top + 12) : hoverTip.value.y,
        elId: String(el?.id ?? hit(el) ?? "")
      };
    }
    function onElementTooltipLeave() {
      hoverTip.value = null;
    }
    function linkTitle(el) {
      if (!shouldShowCanvasTooltip(el)) return "";
      return "";
    }
    function onElementActivate(el) {
      hoverTip.value = null;
      const links = el?.links;
      if (Array.isArray(links) && links[0]) {
        const url = links[0].url || links[0].href || (typeof links[0] === "string" ? links[0] : "");
        if (url && typeof window !== "undefined") {
          try {
            window.open(String(url), "_blank", "noopener,noreferrer");
          } catch {
          }
        }
      }
      if (el?.actions?.length) {
        el.__lastAction = el.actions[0];
        try {
          window.dispatchEvent(
            new CustomEvent("grafana-vue:canvas-action", {
              detail: {
                elementId: String(el?.id ?? ""),
                action: el.actions[0]
              }
            })
          );
        } catch {
        }
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "editorRoot",
        ref: editorRoot,
        class: "canvas-editor",
        "data-testid": "canvas-editor",
        "data-inline-editing": String(local.value.inlineEditing !== false),
        "data-pan-zoom": String(!!local.value.panZoom),
        "data-zoom-to-content": String(!!local.value.zoomToContent),
        "data-show-advanced": String(!!local.value.showAdvancedTypes),
        "data-can-edit": String(canEdit.value),
        "data-editable-prop": String(props.editable),
        "data-tooltip-mode": String(local.value.tooltipMode ?? "auto"),
        "data-tooltip-disable-one-click": String(!!local.value.tooltipDisableForOneClick),
        "data-tooltip-open": hoverTip.value ? "true" : "false",
        "data-bg-color": String(local.value.backgroundColor || local.value.background || "var(--grafana-bg-canvas)"),
        "data-bg-image": String(local.value.backgroundImage || ""),
        "data-bg-size": String(local.value.backgroundSize || "cover"),
        "data-border-color": String(local.value.borderColor || ""),
        "data-border-width": String(local.value.borderWidth ?? ""),
        "data-border-radius": String(local.value.borderRadius ?? ""),
        "data-color": String(local.value.color || ""),
        "data-element-count": String(elements.value.length),
        "data-connection-count": String(connections.value.length),
        "data-has-root": String(!!local.value.root),
        "data-has-drone": String(elements.value.some((e) => String(e.type).startsWith("drone"))),
        "data-has-wind-turbine": String(elements.value.some((e) => e.type === "windTurbine")),
        "data-vertex-total": String(connections.value.reduce((n, c) => n + (c.vertices?.length ?? 0), 0)),
        "data-view-scale": String(viewScale.value),
        "data-view-pan-x": String(viewPan.value.x),
        "data-view-pan-y": String(viewPan.value.y),
        "data-pan-zoom-help": String(!!local.value.panZoom && local.value.panZoomHelp !== false)
      }, [
        createCommentVNode(" Grafana PanZoomHelp: options-pane info; surface when panZoom enabled "),
        local.value.panZoom && local.value.panZoomHelp !== false ? (openBlock(), createElementBlock("div", _hoisted_2$2n, [..._cache[47] || (_cache[47] = [
          createElementVNode(
            "div",
            { class: "pan-zoom-help__title" },
            "平移与缩放控制",
            -1
            /* CACHED */
          ),
          createElementVNode(
            "ul",
            { class: "pan-zoom-help__list" },
            [
              createElementVNode("li", null, "平移：中键 或 Ctrl + 右键拖动"),
              createElementVNode("li", null, "缩放：滚轮"),
              createElementVNode("li", null, "重置：双击")
            ],
            -1
            /* CACHED */
          )
        ])])) : createCommentVNode("v-if", true),
        canEdit.value ? (openBlock(), createElementBlock("div", _hoisted_3$27, [
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-rect",
            onClick: _cache[0] || (_cache[0] = ($event) => add("rect"))
          }, "矩形"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-circle",
            onClick: _cache[1] || (_cache[1] = ($event) => add("circle"))
          }, "圆形"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-text",
            onClick: _cache[2] || (_cache[2] = ($event) => add("text"))
          }, "文本"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-metric",
            onClick: _cache[3] || (_cache[3] = ($event) => add("metric"))
          }, "指标"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-line",
            onClick: _cache[4] || (_cache[4] = ($event) => add("line"))
          }, "直线"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-ellipse",
            onClick: _cache[5] || (_cache[5] = ($event) => add("ellipse"))
          }, "椭圆"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-cloud",
            onClick: _cache[6] || (_cache[6] = ($event) => add("cloud"))
          }, "云"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-triangle",
            onClick: _cache[7] || (_cache[7] = ($event) => add("triangle"))
          }, "三角"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-parallelogram",
            onClick: _cache[8] || (_cache[8] = ($event) => add("parallelogram"))
          }, " 平行四边形 "),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-icon",
            onClick: _cache[9] || (_cache[9] = ($event) => add("icon"))
          }, "图标"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-server",
            onClick: _cache[10] || (_cache[10] = ($event) => add("server"))
          }, "服务器"),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-button",
            onClick: _cache[11] || (_cache[11] = ($event) => add("button"))
          }, "按钮"),
          local.value.showAdvancedTypes ? (openBlock(), createElementBlock("button", {
            key: 0,
            type: "button",
            "data-testid": "canvas-add-drone",
            onClick: _cache[12] || (_cache[12] = ($event) => add("drone"))
          }, " 无人机 ")) : createCommentVNode("v-if", true),
          local.value.showAdvancedTypes ? (openBlock(), createElementBlock("button", {
            key: 1,
            type: "button",
            "data-testid": "canvas-add-drone-top",
            onClick: _cache[13] || (_cache[13] = ($event) => add("droneTop"))
          }, " 无人机顶视 ")) : createCommentVNode("v-if", true),
          local.value.showAdvancedTypes ? (openBlock(), createElementBlock("button", {
            key: 2,
            type: "button",
            "data-testid": "canvas-add-drone-front",
            onClick: _cache[14] || (_cache[14] = ($event) => add("droneFront"))
          }, " 无人机前视 ")) : createCommentVNode("v-if", true),
          local.value.showAdvancedTypes ? (openBlock(), createElementBlock("button", {
            key: 3,
            type: "button",
            "data-testid": "canvas-add-drone-side",
            onClick: _cache[15] || (_cache[15] = ($event) => add("droneSide"))
          }, " 无人机侧视 ")) : createCommentVNode("v-if", true),
          local.value.showAdvancedTypes ? (openBlock(), createElementBlock("button", {
            key: 4,
            type: "button",
            "data-testid": "canvas-add-wind-turbine",
            onClick: _cache[16] || (_cache[16] = ($event) => add("windTurbine"))
          }, " 风机 ")) : createCommentVNode("v-if", true),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-connect",
            disabled: selectedIds.value.length < 2,
            onClick: connectSelected
          }, " 连接 ", 8, _hoisted_4$1Q),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-add-vertex",
            disabled: !connections.value.length,
            onClick: addVertexToLast
          }, " 加顶点 ", 8, _hoisted_5$1D),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-path-type",
            disabled: !connections.value.length,
            onClick: toggleLastPathType
          }, " 路径类型 ", 8, _hoisted_6$1q),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-disconnect",
            disabled: !connections.value.length,
            onClick: removeSelectedConnections
          }, " 断连 ", 8, _hoisted_7$1g),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-remove",
            disabled: !selectedIds.value.length,
            onClick: removeSelected
          }, " 删除 ", 8, _hoisted_8$18),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-undo",
            disabled: !canUndo.value,
            onClick: undo
          }, " 撤销 ", 8, _hoisted_9$13),
          createElementVNode("button", {
            type: "button",
            "data-testid": "canvas-redo",
            disabled: !canRedo.value,
            onClick: redo
          }, " 重做 ", 8, _hoisted_10$V),
          selectedElement.value ? (openBlock(), createElementBlock("label", _hoisted_11$Q, [
            _cache[49] || (_cache[49] = createTextVNode(
              " 水平 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-constraint-h",
              value: selectedElement.value.constraint?.horizontal ?? "",
              onChange: _cache[17] || (_cache[17] = ($event) => setConstraint("horizontal", $event.target.value))
            }, [..._cache[48] || (_cache[48] = [
              createElementVNode(
                "option",
                { value: "" },
                "自由",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "left" },
                "左",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "center" },
                "中",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "right" },
                "右",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_12$J)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value ? (openBlock(), createElementBlock("label", _hoisted_13$I, [
            _cache[51] || (_cache[51] = createTextVNode(
              " 垂直 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-constraint-v",
              value: selectedElement.value.constraint?.vertical ?? "",
              onChange: _cache[18] || (_cache[18] = ($event) => setConstraint("vertical", $event.target.value))
            }, [..._cache[50] || (_cache[50] = [
              createElementVNode(
                "option",
                { value: "" },
                "自由",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "top" },
                "上",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "center" },
                "中",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "bottom" },
                "下",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_14$D)
          ])) : createCommentVNode("v-if", true)
        ])) : createCommentVNode("v-if", true),
        __props.editable && selectedElement.value ? (openBlock(), createElementBlock("div", _hoisted_15$y, [
          _cache[85] || (_cache[85] = createElementVNode(
            "strong",
            null,
            "元素属性",
            -1
            /* CACHED */
          )),
          createElementVNode("label", null, [
            _cache[52] || (_cache[52] = createTextVNode(
              "名称 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-name",
              value: String(selectedElement.value.name ?? selectedElement.value.id ?? ""),
              onChange: _cache[19] || (_cache[19] = ($event) => patchSelectedElement({
                name: $event.target.value
              }))
            }, null, 40, _hoisted_16$v)
          ]),
          createElementVNode("label", null, [
            _cache[53] || (_cache[53] = createTextVNode(
              "填充色 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-fill",
              type: "color",
              value: String(selectedElement.value.fill ?? "var(--grafana-primary)"),
              onInput: _cache[20] || (_cache[20] = ($event) => patchSelectedElement({
                fill: $event.target.value
              }))
            }, null, 40, _hoisted_17$t)
          ]),
          selectedElement.value.type === "server" ? (openBlock(), createElementBlock("label", _hoisted_18$t, [
            _cache[55] || (_cache[55] = createTextVNode(
              "服务器类型 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-el-server-type",
              value: String(selectedElement.value.serverType ?? "single"),
              onChange: _cache[21] || (_cache[21] = ($event) => patchSelectedElement({
                serverType: $event.target.value
              }))
            }, [..._cache[54] || (_cache[54] = [
              createElementVNode(
                "option",
                { value: "single" },
                "单体",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "stack" },
                "堆栈",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "database" },
                "数据库",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "terminal" },
                "终端",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_19$r)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "server" ? (openBlock(), createElementBlock("label", _hoisted_20$p, [
            _cache[56] || (_cache[56] = createTextVNode(
              "闪烁率 Hz ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-blink-rate",
              type: "number",
              min: "0",
              step: "0.1",
              value: Number(selectedElement.value.blinkRate ?? 0),
              onChange: _cache[22] || (_cache[22] = ($event) => patchSelectedElement({
                blinkRate: Number($event.target.value) || 0
              }))
            }, null, 40, _hoisted_21$h)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "server" ? (openBlock(), createElementBlock("label", _hoisted_22$d, [
            _cache[57] || (_cache[57] = createTextVNode(
              "状态色 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-status-color",
              type: "color",
              value: String(
                selectedElement.value.statusColor ?? selectedElement.value.fill ?? "#0066cc"
              ),
              onInput: _cache[23] || (_cache[23] = ($event) => patchSelectedElement({
                statusColor: $event.target.value
              }))
            }, null, 40, _hoisted_23$a)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "server" ? (openBlock(), createElementBlock("label", _hoisted_24$a, [
            _cache[58] || (_cache[58] = createTextVNode(
              "状态灯色 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-bulb-color",
              type: "color",
              value: String(selectedElement.value.bulbColor ?? "#00aa00"),
              onInput: _cache[24] || (_cache[24] = ($event) => patchSelectedElement({
                bulbColor: $event.target.value
              }))
            }, null, 40, _hoisted_25$8)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "windTurbine" ? (openBlock(), createElementBlock("label", _hoisted_26$7, [
            _cache[59] || (_cache[59] = createTextVNode(
              "转速 RPM ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-rpm",
              type: "number",
              min: "0",
              step: "1",
              value: Number(selectedElement.value.rpm ?? 0),
              onChange: _cache[25] || (_cache[25] = ($event) => patchSelectedElement({
                rpm: Math.max(0, Number($event.target.value) || 0)
              }))
            }, null, 40, _hoisted_27$6)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneTop" ? (openBlock(), createElementBlock("label", _hoisted_28$6, [
            _cache[60] || (_cache[60] = createTextVNode(
              "偏航角 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-yaw-angle",
              type: "number",
              step: "1",
              value: Number(selectedElement.value.yawAngle ?? 0),
              onChange: _cache[26] || (_cache[26] = ($event) => patchSelectedElement({
                yawAngle: Number($event.target.value) || 0
              }))
            }, null, 40, _hoisted_29$6)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneTop" ? (openBlock(), createElementBlock("label", _hoisted_30$6, [
            _cache[61] || (_cache[61] = createTextVNode(
              "前右旋翼 RPM ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-fr-rpm",
              type: "number",
              min: "0",
              step: "1",
              value: Number(selectedElement.value.fRightRotorRPM ?? 0),
              onChange: _cache[27] || (_cache[27] = ($event) => patchSelectedElement({
                fRightRotorRPM: Math.max(0, Number($event.target.value) || 0)
              }))
            }, null, 40, _hoisted_31$6)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneTop" ? (openBlock(), createElementBlock("label", _hoisted_32$5, [
            _cache[62] || (_cache[62] = createTextVNode(
              "前左旋翼 RPM ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-fl-rpm",
              type: "number",
              min: "0",
              step: "1",
              value: Number(selectedElement.value.fLeftRotorRPM ?? 0),
              onChange: _cache[28] || (_cache[28] = ($event) => patchSelectedElement({
                fLeftRotorRPM: Math.max(0, Number($event.target.value) || 0)
              }))
            }, null, 40, _hoisted_33$5)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneTop" ? (openBlock(), createElementBlock("label", _hoisted_34$5, [
            _cache[63] || (_cache[63] = createTextVNode(
              "后右旋翼 RPM ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-br-rpm",
              type: "number",
              min: "0",
              step: "1",
              value: Number(selectedElement.value.bRightRotorRPM ?? 0),
              onChange: _cache[29] || (_cache[29] = ($event) => patchSelectedElement({
                bRightRotorRPM: Math.max(0, Number($event.target.value) || 0)
              }))
            }, null, 40, _hoisted_35$4)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneTop" ? (openBlock(), createElementBlock("label", _hoisted_36$3, [
            _cache[64] || (_cache[64] = createTextVNode(
              "后左旋翼 RPM ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-bl-rpm",
              type: "number",
              min: "0",
              step: "1",
              value: Number(selectedElement.value.bLeftRotorRPM ?? 0),
              onChange: _cache[30] || (_cache[30] = ($event) => patchSelectedElement({
                bLeftRotorRPM: Math.max(0, Number($event.target.value) || 0)
              }))
            }, null, 40, _hoisted_37$3)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneFront" ? (openBlock(), createElementBlock("label", _hoisted_38$2, [
            _cache[65] || (_cache[65] = createTextVNode(
              "滚转角 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-roll-angle",
              type: "number",
              step: "1",
              value: Number(selectedElement.value.rollAngle ?? 0),
              onChange: _cache[31] || (_cache[31] = ($event) => patchSelectedElement({
                rollAngle: Number($event.target.value) || 0
              }))
            }, null, 40, _hoisted_39$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "droneSide" ? (openBlock(), createElementBlock("label", _hoisted_40$1, [
            _cache[66] || (_cache[66] = createTextVNode(
              "俯仰角 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-pitch-angle",
              type: "number",
              step: "1",
              value: Number(selectedElement.value.pitchAngle ?? 0),
              onChange: _cache[32] || (_cache[32] = ($event) => patchSelectedElement({
                pitchAngle: Number($event.target.value) || 0
              }))
            }, null, 40, _hoisted_41$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "button" ? (openBlock(), createElementBlock("label", _hoisted_42$1, [
            _cache[68] || (_cache[68] = createTextVNode(
              "按钮样式 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-el-button-style",
              value: String(selectedElement.value.buttonStyle ?? "primary"),
              onChange: _cache[33] || (_cache[33] = ($event) => patchSelectedElement({
                buttonStyle: $event.target.value
              }))
            }, [..._cache[67] || (_cache[67] = [
              createElementVNode(
                "option",
                { value: "primary" },
                "主要",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "secondary" },
                "次要",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "destructive" },
                "危险",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_43$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "icon" ? (openBlock(), createElementBlock("label", _hoisted_44$1, [
            _cache[69] || (_cache[69] = createTextVNode(
              "SVG 路径 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-icon-path",
              value: String(selectedElement.value.path ?? ""),
              onChange: _cache[34] || (_cache[34] = ($event) => patchSelectedElement({
                path: $event.target.value
              }))
            }, null, 40, _hoisted_45$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "metric" || selectedElement.value.type === "text" || selectedElement.value.type === "rect" || selectedElement.value.type === "ellipse" || selectedElement.value.type === "cloud" || selectedElement.value.type === "triangle" || selectedElement.value.type === "parallelogram" || selectedElement.value.type === "button" ? (openBlock(), createElementBlock("label", _hoisted_46$1, [
            _cache[71] || (_cache[71] = createTextVNode(
              "水平对齐 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-el-align",
              value: String(selectedElement.value.align ?? "center"),
              onChange: _cache[35] || (_cache[35] = ($event) => patchSelectedElement({
                align: $event.target.value
              }))
            }, [..._cache[70] || (_cache[70] = [
              createElementVNode(
                "option",
                { value: "left" },
                "左",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "center" },
                "中",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "right" },
                "右",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_47$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "metric" || selectedElement.value.type === "text" || selectedElement.value.type === "rect" || selectedElement.value.type === "ellipse" || selectedElement.value.type === "cloud" || selectedElement.value.type === "triangle" || selectedElement.value.type === "parallelogram" ? (openBlock(), createElementBlock("label", _hoisted_48$1, [
            _cache[73] || (_cache[73] = createTextVNode(
              "垂直对齐 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-el-valign",
              value: String(selectedElement.value.valign ?? "middle"),
              onChange: _cache[36] || (_cache[36] = ($event) => patchSelectedElement({
                valign: $event.target.value
              }))
            }, [..._cache[72] || (_cache[72] = [
              createElementVNode(
                "option",
                { value: "top" },
                "上",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "middle" },
                "中",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "bottom" },
                "下",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_49$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "metric" || selectedElement.value.type === "text" || selectedElement.value.type === "rect" || selectedElement.value.type === "ellipse" || selectedElement.value.type === "cloud" || selectedElement.value.type === "triangle" || selectedElement.value.type === "parallelogram" || selectedElement.value.type === "button" ? (openBlock(), createElementBlock("label", _hoisted_50$1, [
            _cache[74] || (_cache[74] = createTextVNode(
              "字号 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-font-size",
              type: "number",
              min: "1",
              step: "1",
              value: Number(selectedElement.value.fontSize ?? 20),
              onChange: _cache[37] || (_cache[37] = ($event) => patchSelectedElement({
                fontSize: Number($event.target.value) || 20
              }))
            }, null, 40, _hoisted_51$1)
          ])) : createCommentVNode("v-if", true),
          hasTextProp(selectedElement.value) ? (openBlock(), createElementBlock("label", _hoisted_52$1, [
            _cache[75] || (_cache[75] = createTextVNode(
              "文本 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-text",
              value: String(selectedElement.value.text ?? ""),
              onChange: _cache[38] || (_cache[38] = ($event) => patchSelectedElement({
                text: $event.target.value
              }))
            }, null, 40, _hoisted_53$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "metric" ? (openBlock(), createElementBlock("label", _hoisted_54$1, [
            _cache[76] || (_cache[76] = createTextVNode(
              "字段 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-field",
              value: String(selectedElement.value.field ?? ""),
              onChange: _cache[39] || (_cache[39] = ($event) => patchSelectedElement({
                field: $event.target.value
              }))
            }, null, 40, _hoisted_55$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "line" ? (openBlock(), createElementBlock("label", _hoisted_56$1, [
            _cache[77] || (_cache[77] = createTextVNode(
              "描边色 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-stroke",
              type: "color",
              value: String(selectedElement.value.stroke ?? "var(--grafana-primary)"),
              onInput: _cache[40] || (_cache[40] = ($event) => patchSelectedElement({
                stroke: $event.target.value
              }))
            }, null, 40, _hoisted_57$1)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "line" ? (openBlock(), createElementBlock("label", _hoisted_58$1, [
            _cache[78] || (_cache[78] = createTextVNode(
              "线宽 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-stroke-width",
              type: "number",
              min: "0.2",
              step: "0.2",
              value: Number(selectedElement.value.strokeWidth ?? 1),
              onChange: _cache[41] || (_cache[41] = ($event) => patchSelectedElement({
                strokeWidth: Number($event.target.value)
              }))
            }, null, 40, _hoisted_59$1)
          ])) : createCommentVNode("v-if", true),
          "w" in selectedElement.value ? (openBlock(), createElementBlock("label", _hoisted_60$1, [
            _cache[79] || (_cache[79] = createTextVNode(
              "宽 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-w",
              type: "number",
              value: Number(selectedElement.value.w ?? 12),
              onChange: _cache[42] || (_cache[42] = ($event) => patchSelectedElement({
                w: Number($event.target.value)
              }))
            }, null, 40, _hoisted_61$1)
          ])) : createCommentVNode("v-if", true),
          "h" in selectedElement.value ? (openBlock(), createElementBlock("label", _hoisted_62$1, [
            _cache[80] || (_cache[80] = createTextVNode(
              "高 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-h",
              type: "number",
              value: Number(selectedElement.value.h ?? 10),
              onChange: _cache[43] || (_cache[43] = ($event) => patchSelectedElement({
                h: Number($event.target.value)
              }))
            }, null, 40, _hoisted_63)
          ])) : createCommentVNode("v-if", true),
          selectedElement.value.type === "circle" ? (openBlock(), createElementBlock("label", _hoisted_64, [
            _cache[81] || (_cache[81] = createTextVNode(
              "半径 ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-r",
              type: "number",
              value: Number(selectedElement.value.r ?? 8),
              onChange: _cache[44] || (_cache[44] = ($event) => patchSelectedElement({
                r: Number($event.target.value)
              }))
            }, null, 40, _hoisted_65)
          ])) : createCommentVNode("v-if", true),
          createElementVNode("label", null, [
            _cache[82] || (_cache[82] = createTextVNode(
              "旋转° ",
              -1
              /* CACHED */
            )),
            createElementVNode("input", {
              "data-testid": "canvas-el-rotation",
              type: "number",
              value: Number(selectedElement.value.rotation ?? 0),
              onChange: _cache[45] || (_cache[45] = ($event) => patchSelectedElement({
                rotation: Number($event.target.value)
              }))
            }, null, 40, _hoisted_66)
          ]),
          createElementVNode("label", null, [
            _cache[84] || (_cache[84] = createTextVNode(
              "动画 ",
              -1
              /* CACHED */
            )),
            createElementVNode("select", {
              "data-testid": "canvas-el-animation",
              value: String(selectedElement.value.animation ?? "none"),
              onChange: _cache[46] || (_cache[46] = ($event) => patchSelectedElement({
                animation: $event.target.value
              }))
            }, [..._cache[83] || (_cache[83] = [
              createElementVNode(
                "option",
                { value: "none" },
                "无",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "pulse" },
                "脉冲",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "spin" },
                "旋转",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "option",
                { value: "blink" },
                "闪烁",
                -1
                /* CACHED */
              )
            ])], 40, _hoisted_67)
          ])
        ])) : createCommentVNode("v-if", true),
        createCommentVNode(" Grafana Scene uses absolute HTML elements (not SVG text) — dual-run path "),
        usePixelLayout.value ? (openBlock(), createElementBlock("div", {
          key: 3,
          class: "canvas-html",
          "data-testid": "panel-canvas",
          "data-canvas-zoom-surface": "true",
          "data-inline-editing": String(local.value.inlineEditing !== false),
          "data-pan-zoom": String(!!local.value.panZoom),
          "data-bg-color": String(local.value.backgroundColor || local.value.background || "transparent"),
          "data-pixel-layout": true,
          role: "img",
          "aria-label": "画布面板",
          style: normalizeStyle({
            width: `${viewBoxW.value}px`,
            height: `${viewBoxH.value}px`,
            background: local.value.backgroundImage ? `url(${local.value.backgroundImage}) ${local.value.backgroundSize || "cover"} center/cover no-repeat` : local.value.backgroundColor || local.value.background || "transparent",
            transform: `translate(${viewPan.value.x}px,${viewPan.value.y}px) scale(${viewScale.value})`,
            transformOrigin: "center center"
          }),
          onWheel: withModifiers(onWheel, ["prevent"]),
          onClick: onBgClick
        }, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(elements.value, (el, i) => {
              return openBlock(), createElementBlock("div", {
                key: el.id ?? i,
                class: normalizeClass(["canvas-el", [
                  `type-${el.type}`,
                  {
                    "selected": isSelected(el.id),
                    "el-animation": el.animation
                  }
                ]]),
                "data-el-type": el.type,
                "data-el-id": hit(el),
                "data-server-type": el.type === "server" ? String(el.serverType ?? "single") : void 0,
                "data-blink-rate": el.type === "server" ? String(Number(el.blinkRate ?? 0)) : void 0,
                "data-status-color": el.type === "server" ? String(el.statusColor ?? el.fill ?? "") : void 0,
                "data-bulb-color": el.type === "server" ? String(el.bulbColor ?? "") : void 0,
                "data-rpm": el.type === "windTurbine" ? String(Number(el.rpm ?? 0)) : void 0,
                "data-icon-path": el.type === "icon" ? iconPathOf(el) : void 0,
                "data-icon-fill": el.type === "icon" ? iconFillOf(el) : void 0,
                "data-align": [
                  "metric",
                  "text",
                  "rect",
                  "ellipse",
                  "cloud",
                  "triangle",
                  "parallelogram",
                  "button"
                ].includes(el.type) ? String(el.align ?? "center") : void 0,
                "data-valign": ["metric", "text", "rect", "ellipse", "cloud", "triangle", "parallelogram"].includes(
                  el.type
                ) ? String(el.valign ?? "middle") : void 0,
                "data-font-size": [
                  "metric",
                  "text",
                  "rect",
                  "ellipse",
                  "cloud",
                  "triangle",
                  "parallelogram",
                  "button"
                ].includes(el.type) ? String(
                  Number(
                    el.fontSize ?? (el.type === "text" ? 16 : el.type === "metric" ? 20 : 14)
                  )
                ) : void 0,
                "data-text-color": [
                  "metric",
                  "text",
                  "rect",
                  "ellipse",
                  "cloud",
                  "triangle",
                  "parallelogram",
                  "button"
                ].includes(el.type) ? String(el.textColor ?? el.fill ?? "") : void 0,
                "data-button-style": el.type === "button" ? String(el.buttonStyle ?? "primary") : void 0,
                "data-yaw-angle": el.type === "droneTop" ? String(Number(el.yawAngle ?? 0)) : void 0,
                "data-roll-angle": el.type === "droneFront" ? String(Number(el.rollAngle ?? 0)) : void 0,
                "data-pitch-angle": el.type === "droneSide" ? String(Number(el.pitchAngle ?? 0)) : void 0,
                "data-fr-rpm": el.type === "droneTop" ? String(Number(el.fRightRotorRPM ?? 0)) : void 0,
                "data-fl-rpm": el.type === "droneTop" ? String(Number(el.fLeftRotorRPM ?? 0)) : void 0,
                "data-br-rpm": el.type === "droneTop" ? String(Number(el.bRightRotorRPM ?? 0)) : void 0,
                "data-bl-rpm": el.type === "droneTop" ? String(Number(el.bLeftRotorRPM ?? 0)) : void 0,
                "data-rotation": String(Number(el.rotation ?? 0)),
                "data-bg-color": String(el.backgroundColor ?? ""),
                "data-bg-image": String(el.backgroundImage ?? ""),
                "data-border-color": String(el.borderColor ?? ""),
                "data-border-width": String(el.borderWidth ?? ""),
                "data-border-radius": String(el.borderRadius ?? ""),
                "data-has-links": String(!!(el.links && el.links.length)),
                "data-has-actions": String(!!(el.actions && el.actions.length)),
                "data-link-count": String(Array.isArray(el.links) ? el.links.length : 0),
                "data-el-animation": String(el.animation ?? "none"),
                title: linkTitle(el),
                style: normalizeStyle(htmlElStyle(el)),
                onPointerdown: withModifiers(($event) => props.editable ? onPointerDown($event, hit(el)) : void 0, ["stop"]),
                onPointerenter: ($event) => onElementTooltipEnter($event, el),
                onPointermove: ($event) => onElementTooltipMove($event, el),
                onPointerleave: onElementTooltipLeave,
                onClick: withModifiers(($event) => onElementActivate(el), ["stop"])
              }, [
                el.type === "metric" ? (openBlock(), createElementBlock("span", {
                  key: 0,
                  class: "metric-text",
                  "data-align": String(el.align ?? "center"),
                  "data-valign": String(el.valign ?? "middle"),
                  style: normalizeStyle(
                    {
                      textAlign: String(el.align ?? "center"),
                      verticalAlign: String(el.valign ?? "middle"),
                      fontSize: `${Number(el.fontSize ?? 20)}px`,
                      color: String(el.textColor ?? "var(--grafana-text)")
                    }
                  )
                }, toDisplayString(el.text || "双击设置字段"), 13, _hoisted_70)) : el.type === "text" ? (openBlock(), createElementBlock("span", {
                  key: 1,
                  class: "metric-text canvas-text",
                  "data-testid": "canvas-text",
                  "data-align": String(el.align ?? "center"),
                  "data-valign": String(el.valign ?? "middle"),
                  style: normalizeStyle(
                    {
                      textAlign: String(el.align ?? "center"),
                      verticalAlign: String(el.valign ?? "middle"),
                      fontSize: `${Number(el.fontSize ?? 16)}px`,
                      color: String(el.textColor ?? el.fill ?? "var(--grafana-text)")
                    }
                  )
                }, toDisplayString(el.text || "双击设置文本"), 13, _hoisted_71)) : el.type === "rect" ? (openBlock(), createElementBlock(
                  Fragment,
                  { key: 2 },
                  [
                    el.text ? (openBlock(), createElementBlock("span", {
                      key: 0,
                      class: "metric-text canvas-rect-text",
                      "data-testid": "canvas-rect-text",
                      "data-align": String(el.align ?? "center"),
                      "data-valign": String(el.valign ?? "middle"),
                      style: normalizeStyle(
                        {
                          textAlign: String(el.align ?? "center"),
                          verticalAlign: String(el.valign ?? "middle"),
                          fontSize: `${Number(el.fontSize ?? 14)}px`,
                          color: String(el.textColor ?? "var(--grafana-text)")
                        }
                      )
                    }, toDisplayString(el.text), 13, _hoisted_72)) : createCommentVNode("v-if", true)
                  ],
                  64
                  /* STABLE_FRAGMENT */
                )) : el.type === "ellipse" || el.type === "cloud" || el.type === "triangle" || el.type === "parallelogram" ? (openBlock(), createElementBlock("div", {
                  key: 3,
                  class: "canvas-shape",
                  "data-testid": "canvas-shape",
                  "data-shape-type": el.type,
                  "data-align": String(el.align ?? "center"),
                  "data-valign": String(el.valign ?? "middle"),
                  style: { background: "transparent" }
                }, [
                  (openBlock(), createElementBlock("svg", {
                    class: "canvas-shape-svg",
                    viewBox: `0 0 ${Number(el.w ?? 40)} ${Number(el.h ?? 30)}`,
                    preserveAspectRatio: "none",
                    width: "100%",
                    height: "100%",
                    style: { "position": "absolute", "inset": "0", "pointer-events": "none" }
                  }, [
                    el.type === "ellipse" ? (openBlock(), createElementBlock("ellipse", {
                      key: 0,
                      cx: Number(el.w ?? 40) / 2,
                      cy: Number(el.h ?? 30) / 2,
                      rx: Number(el.w ?? 40) / 2,
                      ry: Number(el.h ?? 30) / 2,
                      fill: el.fill || "var(--grafana-primary)"
                    }, null, 8, _hoisted_75)) : el.type === "cloud" ? (openBlock(), createElementBlock("path", {
                      key: 1,
                      d: cloudPath({
                        x: 0,
                        y: 0,
                        w: el.w ?? 40,
                        h: el.h ?? 30
                      }),
                      fill: el.fill || "var(--grafana-primary)"
                    }, null, 8, _hoisted_76)) : el.type === "triangle" ? (openBlock(), createElementBlock("polygon", {
                      key: 2,
                      points: trianglePoints({
                        x: 0,
                        y: 0,
                        w: el.w ?? 40,
                        h: el.h ?? 30
                      }),
                      fill: el.fill || unref(classicYellow)()
                    }, null, 8, _hoisted_77)) : (openBlock(), createElementBlock("polygon", {
                      key: 3,
                      points: parallelogramPoints({
                        x: 0,
                        y: 0,
                        w: el.w ?? 40,
                        h: el.h ?? 30
                      }),
                      fill: el.fill || unref(classicPurple)()
                    }, null, 8, _hoisted_78))
                  ], 8, _hoisted_74)),
                  el.text ? (openBlock(), createElementBlock("span", {
                    key: 0,
                    class: "metric-text canvas-shape-text",
                    "data-testid": "canvas-shape-text",
                    "data-align": String(el.align ?? "center"),
                    "data-valign": String(el.valign ?? "middle"),
                    style: normalizeStyle(
                      {
                        position: "relative",
                        zIndex: 1,
                        textAlign: String(el.align ?? "center"),
                        verticalAlign: String(el.valign ?? "middle"),
                        fontSize: `${Number(el.fontSize ?? 14)}px`,
                        color: String(el.textColor ?? "var(--grafana-text)")
                      }
                    )
                  }, toDisplayString(el.text), 13, _hoisted_79)) : createCommentVNode("v-if", true)
                ], 8, _hoisted_73)) : el.type === "button" ? (openBlock(), createElementBlock("span", {
                  key: 4,
                  class: "metric-text canvas-button-text",
                  "data-testid": "canvas-button-text",
                  "data-align": String(el.align ?? "center"),
                  "data-button-style": String(el.buttonStyle ?? "primary"),
                  style: normalizeStyle(
                    {
                      textAlign: String(el.align ?? "center"),
                      fontSize: `${Number(el.fontSize ?? 14)}px`,
                      color: String(
                        el.textColor ?? (el.buttonStyle === "secondary" ? "var(--grafana-text)" : "var(--grafana-bg-canvas)")
                      )
                    }
                  )
                }, toDisplayString(el.text || "Button"), 13, _hoisted_80)) : el.type === "windTurbine" ? (openBlock(), createElementBlock("div", {
                  key: 5,
                  class: "wind-turbine",
                  "data-testid": "canvas-wind-turbine",
                  "data-rpm": String(Number(el.rpm ?? 0))
                }, [
                  (openBlock(), createElementBlock("svg", _hoisted_82, [
                    _cache[87] || (_cache[87] = createElementVNode(
                      "rect",
                      {
                        class: "wt-tower",
                        x: "46",
                        y: "70",
                        width: "8",
                        height: "70",
                        fill: "#e6e6e6"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    _cache[88] || (_cache[88] = createElementVNode(
                      "rect",
                      {
                        class: "wt-base",
                        x: "38",
                        y: "138",
                        width: "24",
                        height: "8",
                        rx: "1",
                        fill: "#d0d6d7"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    _cache[89] || (_cache[89] = createElementVNode(
                      "circle",
                      {
                        class: "wt-nacelle",
                        cx: "50",
                        cy: "68",
                        r: "8",
                        fill: "#e6e6e6"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    createElementVNode("g", {
                      class: "wt-blades",
                      "data-testid": "canvas-wt-blades",
                      "data-rpm": String(Number(el.rpm ?? 0)),
                      style: normalizeStyle(windTurbineSpinStyle(el))
                    }, [..._cache[86] || (_cache[86] = [
                      createElementVNode(
                        "path",
                        {
                          d: "M50 68 L54 10 L46 10 Z",
                          fill: "#e6e6e6"
                        },
                        null,
                        -1
                        /* CACHED */
                      ),
                      createElementVNode(
                        "path",
                        {
                          d: "M50 68 L92 90 L88 98 Z",
                          fill: "#d0d6d7"
                        },
                        null,
                        -1
                        /* CACHED */
                      ),
                      createElementVNode(
                        "path",
                        {
                          d: "M50 68 L12 90 L16 98 Z",
                          fill: "#d0d6d7"
                        },
                        null,
                        -1
                        /* CACHED */
                      )
                    ])], 12, _hoisted_83)
                  ])),
                  createElementVNode(
                    "span",
                    _hoisted_84,
                    toDisplayString(el.text || "Turbine"),
                    1
                    /* TEXT */
                  )
                ], 8, _hoisted_81)) : el.type === "icon" ? (openBlock(), createElementBlock("div", {
                  key: 6,
                  class: "canvas-icon",
                  "data-testid": "canvas-icon",
                  "data-icon-path": iconPathOf(el),
                  "data-icon-fill": iconFillOf(el),
                  style: normalizeStyle({ color: iconFillOf(el), fill: iconFillOf(el) })
                }, [
                  iconPathOf(el) ? (openBlock(), createElementBlock("img", {
                    key: 0,
                    class: "canvas-icon-img",
                    src: iconPathOf(el),
                    alt: String(el.icon || "icon"),
                    "data-icon-path": iconPathOf(el),
                    draggable: "false"
                  }, null, 8, _hoisted_86)) : (openBlock(), createElementBlock("svg", {
                    key: 1,
                    class: "canvas-icon-fallback",
                    viewBox: "0 0 24 24",
                    width: "100%",
                    height: "100%",
                    fill: iconFillOf(el)
                  }, [..._cache[90] || (_cache[90] = [
                    createElementVNode(
                      "circle",
                      {
                        cx: "12",
                        cy: "12",
                        r: "9"
                      },
                      null,
                      -1
                      /* CACHED */
                    ),
                    createElementVNode(
                      "text",
                      {
                        x: "12",
                        y: "16",
                        "text-anchor": "middle",
                        "font-size": "10",
                        fill: "var(--grafana-bg-canvas)"
                      },
                      " ? ",
                      -1
                      /* CACHED */
                    )
                  ])], 8, _hoisted_87))
                ], 12, _hoisted_85)) : el.type === "droneTop" || el.type === "droneFront" || el.type === "droneSide" || el.type === "drone" ? (openBlock(), createElementBlock("div", {
                  key: 7,
                  class: "canvas-drone",
                  "data-testid": "canvas-drone",
                  "data-drone-type": el.type,
                  "data-yaw-angle": el.type === "droneTop" ? String(Number(el.yawAngle ?? 0)) : void 0,
                  "data-roll-angle": el.type === "droneFront" ? String(Number(el.rollAngle ?? 0)) : void 0,
                  "data-pitch-angle": el.type === "droneSide" ? String(Number(el.pitchAngle ?? 0)) : void 0,
                  "data-fr-rpm": el.type === "droneTop" ? String(Number(el.fRightRotorRPM ?? 0)) : void 0,
                  "data-fl-rpm": el.type === "droneTop" ? String(Number(el.fLeftRotorRPM ?? 0)) : void 0,
                  "data-br-rpm": el.type === "droneTop" ? String(Number(el.bRightRotorRPM ?? 0)) : void 0,
                  "data-bl-rpm": el.type === "droneTop" ? String(Number(el.bLeftRotorRPM ?? 0)) : void 0,
                  style: normalizeStyle({
                    transform: droneAngleOf(el) !== 0 ? `rotate(${droneAngleOf(el)}deg)` : void 0
                  })
                }, [
                  (openBlock(), createElementBlock("svg", _hoisted_89, [
                    createCommentVNode(" body "),
                    createElementVNode("rect", {
                      x: "35",
                      y: "30",
                      width: "30",
                      height: "20",
                      rx: "4",
                      fill: el.fill || "var(--grafana-primary)"
                    }, null, 8, _hoisted_90),
                    createCommentVNode(" arms "),
                    _cache[95] || (_cache[95] = createElementVNode(
                      "line",
                      {
                        x1: "20",
                        y1: "20",
                        x2: "40",
                        y2: "35",
                        stroke: "var(--grafana-text-secondary)",
                        "stroke-width": "2"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    _cache[96] || (_cache[96] = createElementVNode(
                      "line",
                      {
                        x1: "80",
                        y1: "20",
                        x2: "60",
                        y2: "35",
                        stroke: "var(--grafana-text-secondary)",
                        "stroke-width": "2"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    _cache[97] || (_cache[97] = createElementVNode(
                      "line",
                      {
                        x1: "20",
                        y1: "60",
                        x2: "40",
                        y2: "45",
                        stroke: "var(--grafana-text-secondary)",
                        "stroke-width": "2"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    _cache[98] || (_cache[98] = createElementVNode(
                      "line",
                      {
                        x1: "80",
                        y1: "60",
                        x2: "60",
                        y2: "45",
                        stroke: "var(--grafana-text-secondary)",
                        "stroke-width": "2"
                      },
                      null,
                      -1
                      /* CACHED */
                    )),
                    createCommentVNode(" rotors: spin duration from RPM (Grafana 60/rpm) "),
                    createElementVNode("g", {
                      class: "drone-rotor",
                      "data-testid": "canvas-drone-rotor-fr",
                      "data-rpm": String(Number(el.fRightRotorRPM ?? 0)),
                      transform: "translate(80 20)",
                      style: normalizeStyle(droneRotorSpinStyle(el.fRightRotorRPM))
                    }, [..._cache[91] || (_cache[91] = [
                      createElementVNode(
                        "line",
                        {
                          x1: "-8",
                          y1: "0",
                          x2: "8",
                          y2: "0",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      ),
                      createElementVNode(
                        "line",
                        {
                          x1: "0",
                          y1: "-8",
                          x2: "0",
                          y2: "8",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      )
                    ])], 12, _hoisted_91),
                    createElementVNode("g", {
                      class: "drone-rotor",
                      "data-testid": "canvas-drone-rotor-fl",
                      "data-rpm": String(Number(el.fLeftRotorRPM ?? 0)),
                      transform: "translate(20 20)",
                      style: normalizeStyle(droneRotorSpinStyle(el.fLeftRotorRPM))
                    }, [..._cache[92] || (_cache[92] = [
                      createElementVNode(
                        "line",
                        {
                          x1: "-8",
                          y1: "0",
                          x2: "8",
                          y2: "0",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      ),
                      createElementVNode(
                        "line",
                        {
                          x1: "0",
                          y1: "-8",
                          x2: "0",
                          y2: "8",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      )
                    ])], 12, _hoisted_92),
                    createElementVNode("g", {
                      class: "drone-rotor",
                      "data-testid": "canvas-drone-rotor-br",
                      "data-rpm": String(Number(el.bRightRotorRPM ?? 0)),
                      transform: "translate(80 60)",
                      style: normalizeStyle(droneRotorSpinStyle(el.bRightRotorRPM))
                    }, [..._cache[93] || (_cache[93] = [
                      createElementVNode(
                        "line",
                        {
                          x1: "-8",
                          y1: "0",
                          x2: "8",
                          y2: "0",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      ),
                      createElementVNode(
                        "line",
                        {
                          x1: "0",
                          y1: "-8",
                          x2: "0",
                          y2: "8",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      )
                    ])], 12, _hoisted_93),
                    createElementVNode("g", {
                      class: "drone-rotor",
                      "data-testid": "canvas-drone-rotor-bl",
                      "data-rpm": String(Number(el.bLeftRotorRPM ?? 0)),
                      transform: "translate(20 60)",
                      style: normalizeStyle(droneRotorSpinStyle(el.bLeftRotorRPM))
                    }, [..._cache[94] || (_cache[94] = [
                      createElementVNode(
                        "line",
                        {
                          x1: "-8",
                          y1: "0",
                          x2: "8",
                          y2: "0",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      ),
                      createElementVNode(
                        "line",
                        {
                          x1: "0",
                          y1: "-8",
                          x2: "0",
                          y2: "8",
                          stroke: "var(--grafana-text)",
                          "stroke-width": "2"
                        },
                        null,
                        -1
                        /* CACHED */
                      )
                    ])], 12, _hoisted_94)
                  ])),
                  createElementVNode(
                    "span",
                    _hoisted_95,
                    toDisplayString(el.text || el.type),
                    1
                    /* TEXT */
                  )
                ], 12, _hoisted_88)) : (openBlock(), createElementBlock(
                  "span",
                  _hoisted_96,
                  toDisplayString(el.type),
                  1
                  /* TEXT */
                ))
              ], 46, _hoisted_69);
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          createCommentVNode(" Connections overlay for pixel/HTML layout (Grafana Scene draws edges over absolute elements). "),
          (openBlock(), createElementBlock("svg", {
            class: "canvas-connections-overlay",
            "data-testid": "canvas-connections-overlay",
            viewBox: viewBox.value,
            preserveAspectRatio: "none",
            width: viewBoxW.value,
            height: viewBoxH.value,
            style: { "position": "absolute", "inset": "0", "width": "100%", "height": "100%", "pointer-events": "none", "overflow": "visible" }
          }, [
            _cache[99] || (_cache[99] = createElementVNode(
              "defs",
              null,
              [
                createElementVNode("marker", {
                  id: "canvas-arrow-px",
                  markerWidth: "4",
                  markerHeight: "4",
                  refX: "3",
                  refY: "2",
                  orient: "auto"
                }, [
                  createElementVNode("path", {
                    d: "M0,0 L4,2 L0,4 Z",
                    fill: "var(--grafana-primary)"
                  })
                ]),
                createElementVNode("marker", {
                  id: "canvas-arrow-start-px",
                  markerWidth: "4",
                  markerHeight: "4",
                  refX: "1",
                  refY: "2",
                  orient: "auto"
                }, [
                  createElementVNode("path", {
                    d: "M4,0 L0,2 L4,4 Z",
                    fill: "var(--grafana-primary)"
                  })
                ])
              ],
              -1
              /* CACHED */
            )),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(connectionPaths.value, (cp, ci) => {
                return openBlock(), createElementBlock("g", {
                  key: cp.conn.id ?? ci,
                  "data-testid": "canvas-connection",
                  "data-source": cp.conn.source,
                  "data-target": cp.conn.target,
                  "data-vertex-count": String(cp.conn.vertices?.length ?? 0),
                  "data-path-type": String(cp.conn.pathType ?? "straight"),
                  "data-direction": connectionDirectionOf(cp.conn),
                  "data-line-style": String(cp.conn.lineStyle ?? local.value.lineStyle ?? ""),
                  "data-animate": String(connectionAnimateOf(cp.conn)),
                  "data-radius": String(cp.conn.radius ?? 0),
                  "data-marker-end": String(!!connectionMarkerEnd(cp.conn)),
                  "data-marker-start": String(!!connectionMarkerStart(cp.conn))
                }, [
                  createElementVNode("path", {
                    d: cp.d,
                    fill: "none",
                    stroke: cp.conn.color ?? "var(--grafana-primary)",
                    "stroke-width": cp.conn.strokeWidth ?? 0.8,
                    "data-connection-color": String(cp.conn.color ?? ""),
                    "data-connection-width": String(cp.conn.strokeWidth ?? 0.8),
                    "stroke-dasharray": connectionDashOf(cp.conn),
                    "stroke-dashoffset": "1",
                    "marker-end": connectionMarkerEnd(cp.conn) ? "url(#canvas-arrow-px)" : void 0,
                    "marker-start": connectionMarkerStart(cp.conn) ? "url(#canvas-arrow-start-px)" : void 0,
                    style: { "pointer-events": "stroke" }
                  }, [
                    connectionAnimateOf(cp.conn) ? (openBlock(), createElementBlock("animate", {
                      key: 0,
                      attributeName: "stroke-dashoffset",
                      values: connectionAnimateValues(cp.conn),
                      dur: "5s",
                      calcMode: "linear",
                      repeatCount: "indefinite",
                      fill: "freeze"
                    }, null, 8, _hoisted_100)) : createCommentVNode("v-if", true)
                  ], 8, _hoisted_99)
                ], 8, _hoisted_98);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ], 8, _hoisted_97))
        ], 44, _hoisted_68)) : (openBlock(), createElementBlock("svg", {
          key: 4,
          class: "canvas",
          viewBox: viewBox.value,
          preserveAspectRatio: "none",
          style: normalizeStyle({
            transform: `translate(${viewPan.value.x}px,${viewPan.value.y}px) scale(${viewScale.value})`,
            transformOrigin: "center center"
          }),
          "data-testid": "panel-canvas",
          "data-canvas-zoom-surface": "true",
          "data-inline-editing": String(local.value.inlineEditing !== false),
          "data-pan-zoom": String(!!local.value.panZoom),
          "data-bg-color": String(local.value.backgroundColor || local.value.background || "var(--grafana-bg-canvas)"),
          role: "img",
          "aria-label": "画布面板",
          onWheel: withModifiers(onWheel, ["prevent"]),
          onPointermove: onPointerMove,
          onPointerup: onPointerUp,
          onPointerleave: onPointerUp,
          onClick: onBgClick
        }, [
          local.value.backgroundImage ? (openBlock(), createElementBlock("defs", _hoisted_102, [
            createElementVNode("pattern", {
              id: "canvas-bg-img",
              patternUnits: "userSpaceOnUse",
              width: viewBoxW.value,
              height: viewBoxH.value
            }, [
              createElementVNode("image", {
                href: local.value.backgroundImage,
                x: "0",
                y: "0",
                width: viewBoxW.value,
                height: viewBoxH.value,
                preserveAspectRatio: local.value.backgroundSize === "contain" ? "xMidYMid meet" : "xMidYMid slice"
              }, null, 8, _hoisted_104)
            ], 8, _hoisted_103)
          ])) : createCommentVNode("v-if", true),
          createElementVNode("rect", {
            x: "0",
            y: "0",
            width: viewBoxW.value,
            height: viewBoxH.value,
            fill: local.value.backgroundImage ? "url(#canvas-bg-img)" : local.value.backgroundColor || local.value.background || "transparent"
          }, null, 8, _hoisted_105),
          _cache[101] || (_cache[101] = createElementVNode(
            "defs",
            null,
            [
              createElementVNode("marker", {
                id: "canvas-arrow",
                markerWidth: "4",
                markerHeight: "4",
                refX: "3",
                refY: "2",
                orient: "auto"
              }, [
                createElementVNode("path", {
                  d: "M0,0 L4,2 L0,4 Z",
                  fill: "var(--grafana-primary)"
                })
              ]),
              createElementVNode("marker", {
                id: "canvas-arrow-start",
                markerWidth: "4",
                markerHeight: "4",
                refX: "1",
                refY: "2",
                orient: "auto"
              }, [
                createElementVNode("path", {
                  d: "M4,0 L0,2 L4,4 Z",
                  fill: "var(--grafana-primary)"
                })
              ])
            ],
            -1
            /* CACHED */
          )),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(connectionPaths.value, (cp, ci) => {
              return openBlock(), createElementBlock("g", {
                key: cp.conn.id ?? ci,
                "data-testid": "canvas-connection",
                "data-source": cp.conn.source,
                "data-target": cp.conn.target,
                "data-vertex-count": String(cp.conn.vertices?.length ?? 0),
                "data-path-type": String(cp.conn.pathType ?? "straight"),
                "data-direction": connectionDirectionOf(cp.conn),
                "data-line-style": String(cp.conn.lineStyle ?? local.value.lineStyle ?? ""),
                "data-animate": String(connectionAnimateOf(cp.conn)),
                "data-radius": String(cp.conn.radius ?? 0),
                "data-marker-end": String(!!connectionMarkerEnd(cp.conn)),
                "data-marker-start": String(!!connectionMarkerStart(cp.conn))
              }, [
                createElementVNode("path", {
                  d: cp.d,
                  fill: "none",
                  stroke: cp.conn.color ?? "var(--grafana-primary)",
                  "stroke-width": cp.conn.strokeWidth ?? 0.8,
                  "data-connection-color": String(cp.conn.color ?? ""),
                  "data-connection-width": String(cp.conn.strokeWidth ?? 0.8),
                  "stroke-dasharray": connectionDashOf(cp.conn),
                  "stroke-dashoffset": "1",
                  "marker-end": connectionMarkerEnd(cp.conn),
                  "marker-start": connectionMarkerStart(cp.conn)
                }, [
                  connectionAnimateOf(cp.conn) ? (openBlock(), createElementBlock("animate", {
                    key: 0,
                    attributeName: "stroke-dashoffset",
                    values: connectionAnimateValues(cp.conn),
                    dur: "5s",
                    calcMode: "linear",
                    repeatCount: "indefinite",
                    fill: "freeze"
                  }, null, 8, _hoisted_108)) : createCommentVNode("v-if", true)
                ], 8, _hoisted_107),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(cp.conn.vertices ?? [], (v, vi) => {
                    return openBlock(), createElementBlock("circle", {
                      key: vi,
                      cx: v.x,
                      cy: v.y,
                      r: "1.6",
                      fill: unref(classicYellow)(),
                      stroke: "var(--grafana-bg-canvas)",
                      "stroke-width": "0.3",
                      "data-testid": "canvas-connection-vertex",
                      style: { "cursor": "move" },
                      onPointerdown: withModifiers(($event) => onVertexDown($event, String(cp.conn.id ?? ""), vi), ["stop"])
                    }, null, 40, _hoisted_109);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ], 8, _hoisted_106);
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(elements.value, (el, i) => {
              return openBlock(), createElementBlock("g", {
                key: el.id ?? i,
                "data-el-type": el.type,
                "data-server-type": el.type === "server" ? String(el.serverType ?? "single") : void 0,
                "data-blink-rate": el.type === "server" ? String(Number(el.blinkRate ?? 0)) : void 0,
                "data-status-color": el.type === "server" ? String(el.statusColor ?? el.fill ?? "") : void 0,
                "data-bulb-color": el.type === "server" ? String(el.bulbColor ?? "") : void 0,
                "data-el-animation": String(el.animation ?? "none"),
                transform: el.rotation ? `rotate(${el.rotation} ${el.x + (el.w ?? el.r ?? 0) / 2} ${el.y + (el.h ?? el.r ?? 0) / 2})` : void 0,
                style: { "cursor": "move" },
                onPointerdown: withModifiers(($event) => onPointerDown($event, hit(el)), ["stop"]),
                onPointerenter: ($event) => onElementTooltipEnter($event, el),
                onPointermove: ($event) => onElementTooltipMove($event, el),
                onPointerleave: onElementTooltipLeave
              }, [
                el.type === "rect" || el.type === "button" || el.type === "server" || el.type === "drone" || el.type === "droneTop" || el.type === "droneFront" || el.type === "droneSide" || el.type === "windTurbine" ? (openBlock(), createElementBlock("rect", {
                  key: 0,
                  x: el.x,
                  y: el.y,
                  width: el.w ?? 12,
                  height: el.h ?? 10,
                  rx: el.type === "button" ? 1.5 : el.type === "drone" ? 3 : el.type === "windTurbine" ? 1 : el.type === "server" ? 0.5 : 0,
                  fill: el.type === "server" ? String(el.statusColor ?? el.fill ?? "var(--grafana-primary)") : el.fill ?? (el.type === "button" ? unref(classicBlue)() : el.type === "drone" ? unref(classicBlue)() : el.type === "windTurbine" ? "var(--grafana-primary)" : "var(--grafana-primary)"),
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "0.8",
                  "data-el-id": hit(el)
                }, null, 8, _hoisted_111)) : createCommentVNode("v-if", true),
                createCommentVNode(" Grafana server status bulb "),
                el.type === "server" ? (openBlock(), createElementBlock("circle", {
                  key: 1,
                  class: "server-bulb",
                  cx: el.x + (el.w ?? 12) - 2,
                  cy: el.y + 2,
                  r: "1.8",
                  fill: String(el.bulbColor ?? "var(--grafana-success)"),
                  stroke: "var(--grafana-bg-canvas)",
                  "stroke-width": "0.3",
                  "data-testid": `canvas-server-bulb-${hit(el)}`,
                  style: normalizeStyle(
                    Number(el.blinkRate ?? 0) > 0 ? {
                      animation: `canvas-server-blink ${Math.max(0.05, 1 / Number(el.blinkRate))}s infinite step-end`
                    } : void 0
                  )
                }, null, 12, _hoisted_112)) : createCommentVNode("v-if", true),
                el.type === "button" || el.type === "server" || el.type === "drone" || el.type === "droneTop" || el.type === "droneFront" || el.type === "droneSide" || el.type === "windTurbine" ? (openBlock(), createElementBlock("text", {
                  key: 2,
                  x: el.type === "button" && el.align === "left" ? el.x + 1 : el.type === "button" && el.align === "right" ? el.x + (el.w ?? 12) - 1 : el.x + (el.w ?? 12) / 2,
                  y: el.y + (el.h ?? 10) / 2 + 1.2,
                  "text-anchor": el.type === "button" && el.align === "left" ? "start" : el.type === "button" && el.align === "right" ? "end" : "middle",
                  fill: el.type === "button" ? String(el.textColor ?? "var(--grafana-bg-canvas)") : "var(--grafana-bg-canvas)",
                  "font-size": el.type === "button" ? Number(el.fontSize ?? 3.2) : 3.2,
                  "data-align": el.type === "button" ? String(el.align ?? "center") : void 0,
                  "data-button-style": el.type === "button" ? String(el.buttonStyle ?? "primary") : void 0,
                  style: { "pointer-events": "none" }
                }, toDisplayString(el.text || (el.type === "server" ? "Server" : el.type === "drone" ? "Drone" : el.type === "windTurbine" ? "Turbine" : "Button")), 9, _hoisted_113)) : createCommentVNode("v-if", true),
                createCommentVNode(" windTurbine pole + spinning blades (Grafana config.rpm) "),
                el.type === "windTurbine" ? (openBlock(), createElementBlock("line", {
                  key: 3,
                  x1: el.x + (el.w ?? 12) / 2,
                  y1: el.y + (el.h ?? 18),
                  x2: el.x + (el.w ?? 12) / 2,
                  y2: el.y + (el.h ?? 18) + 6,
                  stroke: "var(--grafana-primary)",
                  "stroke-width": "0.8",
                  style: { "pointer-events": "none" }
                }, null, 8, _hoisted_114)) : createCommentVNode("v-if", true),
                el.type === "windTurbine" ? (openBlock(), createElementBlock("g", {
                  key: 4,
                  class: "wt-blades-svg",
                  "data-testid": "canvas-wt-blades",
                  "data-rpm": String(Number(el.rpm ?? 0)),
                  "data-el-id": hit(el),
                  style: normalizeStyle(windTurbineSpinStyle(el)),
                  transform: `translate(${el.x + (el.w ?? 12) / 2} ${el.y + 4})`
                }, [..._cache[100] || (_cache[100] = [
                  createElementVNode(
                    "path",
                    {
                      d: "M0 0 L2 -10 L-2 -10 Z",
                      fill: "#e6e6e6"
                    },
                    null,
                    -1
                    /* CACHED */
                  ),
                  createElementVNode(
                    "path",
                    {
                      d: "M0 0 L10 4 L8 8 Z",
                      fill: "#d0d6d7"
                    },
                    null,
                    -1
                    /* CACHED */
                  ),
                  createElementVNode(
                    "path",
                    {
                      d: "M0 0 L-10 4 L-8 8 Z",
                      fill: "#d0d6d7"
                    },
                    null,
                    -1
                    /* CACHED */
                  )
                ])], 12, _hoisted_115)) : createCommentVNode("v-if", true),
                el.type === "circle" ? (openBlock(), createElementBlock("circle", {
                  key: 5,
                  cx: el.x,
                  cy: el.y,
                  r: el.r,
                  fill: el.fill ?? unref(classicGreen)(),
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "0.8"
                }, null, 8, _hoisted_116)) : createCommentVNode("v-if", true),
                el.type === "ellipse" ? (openBlock(), createElementBlock("ellipse", {
                  key: 6,
                  cx: el.x + el.w / 2,
                  cy: el.y + el.h / 2,
                  rx: el.w / 2,
                  ry: el.h / 2,
                  fill: el.fill ?? unref(classicPurple)(),
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "0.8"
                }, null, 8, _hoisted_117)) : createCommentVNode("v-if", true),
                el.type === "cloud" ? (openBlock(), createElementBlock("path", {
                  key: 7,
                  d: cloudPath(el),
                  fill: el.fill ?? "var(--grafana-primary)",
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "0.8"
                }, null, 8, _hoisted_118)) : createCommentVNode("v-if", true),
                el.type === "triangle" ? (openBlock(), createElementBlock("polygon", {
                  key: 8,
                  points: trianglePoints(el),
                  fill: el.fill ?? unref(classicYellow)(),
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "0.8"
                }, null, 8, _hoisted_119)) : createCommentVNode("v-if", true),
                el.type === "parallelogram" ? (openBlock(), createElementBlock("polygon", {
                  key: 9,
                  points: parallelogramPoints(el),
                  fill: el.fill ?? unref(classicPurple)(),
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "0.8"
                }, null, 8, _hoisted_120)) : createCommentVNode("v-if", true),
                el.type === "cloud" || el.type === "triangle" || el.type === "parallelogram" || el.type === "ellipse" ? (openBlock(), createElementBlock("text", {
                  key: 10,
                  x: el.align === "left" ? el.x + 1 : el.align === "right" ? el.x + (el.w ?? 16) - 1 : el.x + (el.w ?? 16) / 2,
                  y: el.valign === "top" ? el.y + Number(el.fontSize ?? 3) : el.valign === "bottom" ? el.y + (el.h ?? 12) - 1 : el.y + (el.h ?? 12) / 2 + 1.2,
                  "text-anchor": el.align === "left" ? "start" : el.align === "right" ? "end" : "middle",
                  fill: el.textColor ?? "var(--grafana-bg-canvas)",
                  "font-size": el.fontSize ?? 3,
                  "data-align": String(el.align ?? "center"),
                  "data-valign": String(el.valign ?? "middle"),
                  style: { "pointer-events": "none" }
                }, toDisplayString(el.text || el.type), 9, _hoisted_121)) : createCommentVNode("v-if", true),
                el.type === "icon" ? (openBlock(), createElementBlock(
                  Fragment,
                  { key: 11 },
                  [
                    createElementVNode("rect", {
                      x: el.x,
                      y: el.y,
                      width: el.w ?? 8,
                      height: el.h ?? 8,
                      fill: iconFillOf(el),
                      stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                      "stroke-width": "0.6",
                      rx: "1",
                      "data-icon-path": iconPathOf(el),
                      "data-icon-fill": iconFillOf(el),
                      "data-testid": "canvas-icon"
                    }, null, 8, _hoisted_122),
                    iconPathOf(el) ? (openBlock(), createElementBlock("image", {
                      key: 0,
                      href: iconPathOf(el),
                      x: el.x,
                      y: el.y,
                      width: el.w ?? 8,
                      height: el.h ?? 8,
                      "data-icon-path": iconPathOf(el),
                      preserveAspectRatio: "xMidYMid meet",
                      style: { "pointer-events": "none" }
                    }, null, 8, _hoisted_123)) : (openBlock(), createElementBlock("text", {
                      key: 1,
                      x: el.x + (el.w ?? 8) / 2,
                      y: el.y + (el.h ?? 8) / 2 + 1.5,
                      "text-anchor": "middle",
                      fill: "var(--grafana-bg-canvas)",
                      "font-size": "4",
                      style: { "pointer-events": "none" }
                    }, " ◆ ", 8, _hoisted_124))
                  ],
                  64
                  /* STABLE_FRAGMENT */
                )) : createCommentVNode("v-if", true),
                el.type === "line" ? (openBlock(), createElementBlock("line", {
                  key: 12,
                  x1: el.x,
                  y1: el.y,
                  x2: el.x2,
                  y2: el.y2,
                  stroke: el.stroke ?? "var(--grafana-primary)",
                  "stroke-width": el.strokeWidth ?? 0.8,
                  "stroke-dasharray": unref(resolveLineDash)(el.lineStyle),
                  "data-line-style": String(el.lineStyle ?? "solid"),
                  "data-has-links": String(!!(el.links && el.links.length)),
                  "data-has-actions": String(!!(el.actions && el.actions.length)),
                  title: linkTitle(el),
                  onPointerenter: ($event) => onElementTooltipEnter($event, el),
                  onPointermove: ($event) => onElementTooltipMove($event, el),
                  onPointerleave: onElementTooltipLeave,
                  onClick: withModifiers(($event) => onElementActivate(el), ["stop"])
                }, null, 40, _hoisted_125)) : createCommentVNode("v-if", true),
                createCommentVNode(" metric-value: Grafana defaultBgColor box + centered text "),
                el.type === "metric" ? (openBlock(), createElementBlock("rect", {
                  key: 13,
                  x: el.x,
                  y: el.y,
                  width: el.w ?? 260,
                  height: el.h ?? 50,
                  fill: el.fill ?? "var(--grafana-border)",
                  stroke: isSelected(el.id) ? "var(--grafana-input-bg)" : "transparent",
                  "stroke-width": "1",
                  "data-el-id": hit(el)
                }, null, 8, _hoisted_126)) : createCommentVNode("v-if", true),
                el.type === "metric" ? (openBlock(), createElementBlock("text", {
                  key: 14,
                  x: el.x + (el.w ?? 260) / 2,
                  y: el.y + (el.h ?? 50) / 2,
                  "text-anchor": "middle",
                  "dominant-baseline": "middle",
                  fill: el.textColor ?? "var(--grafana-text)",
                  "font-size": el.fontSize ?? 20,
                  "font-family": "Inter, Helvetica, Arial, sans-serif",
                  style: { "pointer-events": "none" }
                }, toDisplayString(el.text || "双击设置字段"), 9, _hoisted_127)) : createCommentVNode("v-if", true),
                el.type === "text" ? (openBlock(), createElementBlock("text", {
                  key: 15,
                  x: el.x,
                  y: el.y,
                  fill: el.fill ?? "var(--grafana-text)",
                  "font-size": el.fontSize ?? 5
                }, toDisplayString(el.text), 9, _hoisted_128)) : createCommentVNode("v-if", true),
                __props.editable && isSelected(el.id) && el.type !== "text" && el.type !== "metric" ? (openBlock(), createElementBlock("rect", {
                  key: 16,
                  x: handlePos(el).x - 1.5,
                  y: handlePos(el).y - 1.5,
                  width: "3",
                  height: "3",
                  fill: "var(--grafana-input-bg)",
                  stroke: "var(--grafana-primary)",
                  "stroke-width": "0.4",
                  "data-testid": "canvas-resize-handle",
                  style: { "cursor": "nwse-resize" },
                  onPointerdown: withModifiers(($event) => onResizeDown($event, hit(el)), ["stop"])
                }, null, 40, _hoisted_129)) : createCommentVNode("v-if", true)
              ], 40, _hoisted_110);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 44, _hoisted_101)),
        hoverTip.value ? (openBlock(), createElementBlock("div", {
          key: 5,
          class: "canvas-tooltip",
          "data-testid": "canvas-tooltip",
          role: "tooltip",
          "data-el-id": hoverTip.value.elId,
          style: normalizeStyle({ left: `${hoverTip.value.x}px`, top: `${hoverTip.value.y}px` })
        }, toDisplayString(hoverTip.value.text), 13, _hoisted_130)) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2U);
    };
  }
});
const CanvasEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$3R, [["__scopeId", "data-v-49f526bd"]]);
const _hoisted_1$2T = ["data-mapping"];
const _hoisted_2$2m = ["value"];
const _hoisted_3$26 = {
  key: 0,
  value: "0"
};
const _hoisted_4$1P = ["value"];
const _hoisted_5$1C = ["value"];
const _hoisted_6$1p = ["value"];
const _hoisted_7$1f = ["value"];
const _hoisted_8$17 = ["value"];
const _hoisted_9$12 = {
  class: "series-list",
  "data-testid": "xy-series-list"
};
const _hoisted_10$U = ["data-testid", "onClick"];
const _hoisted_11$P = ["onClick"];
const _hoisted_12$I = {
  key: 0,
  class: "editor",
  "data-testid": "xy-series-form"
};
const _hoisted_13$H = ["value"];
const _hoisted_14$C = ["value"];
const _hoisted_15$x = {
  key: 0,
  value: "0"
};
const _hoisted_16$u = ["value"];
const _hoisted_17$s = ["value"];
const _hoisted_18$s = ["value"];
const _hoisted_19$q = ["value"];
const _hoisted_20$o = ["value"];
const _hoisted_21$g = ["value"];
const _hoisted_22$c = ["value"];
const _hoisted_23$9 = ["value"];
const _hoisted_24$9 = ["value"];
const _hoisted_25$7 = ["value"];
const _sfc_main$3Q = /* @__PURE__ */ defineComponent({
  __name: "XYSeriesEditor",
  props: {
    mapping: {},
    series: {},
    dims: {},
    frames: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const selectedIdx = ref(0);
    function parseSeries(raw) {
      if (Array.isArray(raw)) return raw;
      if (typeof raw === "string" && raw.trim()) {
        try {
          const p = JSON.parse(raw);
          return Array.isArray(p) ? p : [];
        } catch {
          return [];
        }
      }
      return [];
    }
    const list = computed(() => {
      const s = parseSeries(props.series);
      if (props.mapping === "manual" && !s.length) {
        return [{ frame: { matcher: { id: "byIndex", options: 0 } } }];
      }
      return s;
    });
    watch(
      () => props.mapping,
      (m, prev) => {
        if (prev != null && m !== prev && m === "manual" && !parseSeries(props.series).length) {
          emit("change", {
            series: [{ frame: { matcher: { id: "byIndex", options: 0 } } }]
          });
          selectedIdx.value = 0;
        }
      }
    );
    const frames = computed(() => props.frames ?? []);
    const current = computed(() => list.value[selectedIdx.value] ?? null);
    function frameIndexOf(s) {
      const o = s.frame?.matcher?.options;
      const n = Number(o ?? 0);
      return Number.isFinite(n) ? n : 0;
    }
    function fieldName2(spec) {
      if (spec == null) return "";
      if (typeof spec === "string") return spec;
      if (spec.fixed != null) return String(spec.fixed);
      if (spec.matcher?.options != null) return String(spec.matcher.options);
      return "";
    }
    function fieldsOf(frameIdx, types) {
      const f = frames.value[frameIdx] ?? frames.value[0];
      if (!f) return [];
      return f.fields.filter((fld) => !types || types.includes(fld.type)).map((fld) => fld.name);
    }
    function seriesLabel(s, i) {
      if (typeof s.name === "string" && s.name) return s.name;
      if (s.name && typeof s.name === "object" && s.name.fixed) return s.name.fixed;
      const y = fieldName2(s.y);
      return y || `序列 ${i + 1}`;
    }
    function commit(next) {
      emit("change", { series: next });
    }
    function addSeries() {
      const next = [...list.value, { frame: { matcher: { id: "byIndex", options: 0 } } }];
      commit(next);
      selectedIdx.value = next.length - 1;
    }
    function deleteSeries(i) {
      const next = list.value.filter((_, idx) => idx !== i);
      commit(next.length ? next : [{ frame: { matcher: { id: "byIndex", options: 0 } } }]);
      selectedIdx.value = 0;
    }
    function patchCurrent(partial) {
      const next = list.value.map((s, i) => i === selectedIdx.value ? { ...s, ...partial } : s);
      commit(next);
    }
    function setName(fixed) {
      patchCurrent({ name: fixed ? { fixed } : void 0 });
    }
    function setFrame(idx) {
      patchCurrent({ frame: { matcher: { id: "byIndex", options: idx } } });
    }
    function setField(key, name) {
      if (!name) {
        patchCurrent({ [key]: void 0 });
        return;
      }
      patchCurrent({ [key]: { matcher: { id: "byName", options: name } } });
    }
    function setColorField(name) {
      if (!name) {
        patchCurrent({ color: void 0 });
        return;
      }
      patchCurrent({ color: { matcher: { id: "byName", options: name } } });
    }
    function setPointColor(hex) {
      patchCurrent({
        pointColor: hex || void 0,
        color: hex ? { fixed: hex } : void 0
      });
    }
    function setDims(partial) {
      emit("change", { dims: { ...props.dims ?? {}, ...partial } });
    }
    const curFrameIdx = computed(
      () => current.value ? frameIndexOf(current.value) : Number(props.dims?.frame ?? 0)
    );
    const numberFields = computed(() => fieldsOf(curFrameIdx.value, ["number"]));
    const allFields = computed(() => fieldsOf(curFrameIdx.value));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "xy-series-editor",
        "data-testid": "xy-series-editor",
        "data-mapping": String(__props.mapping ?? "auto")
      }, [
        createCommentVNode(" Auto: dims "),
        __props.mapping !== "manual" ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            _cache[15] || (_cache[15] = createElementVNode(
              "header",
              { class: "head" },
              "自动映射 · 维度",
              -1
              /* CACHED */
            )),
            createElementVNode("label", null, [
              _cache[10] || (_cache[10] = createTextVNode(
                " 数据帧 ",
                -1
                /* CACHED */
              )),
              createElementVNode("select", {
                "data-testid": "xy-dims-frame",
                value: String(__props.dims?.frame ?? 0),
                onChange: _cache[0] || (_cache[0] = ($event) => setDims({
                  frame: Number($event.target.value)
                }))
              }, [
                !frames.value.length ? (openBlock(), createElementBlock("option", _hoisted_3$26, "帧 0")) : createCommentVNode("v-if", true),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(frames.value, (f, i) => {
                    return openBlock(), createElementBlock("option", {
                      key: i,
                      value: String(i)
                    }, toDisplayString(f.name || `帧 ${i}`) + " (" + toDisplayString(f.length) + " 行) ", 9, _hoisted_4$1P);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ], 40, _hoisted_2$2m)
            ]),
            createElementVNode("label", null, [
              _cache[12] || (_cache[12] = createTextVNode(
                " X 字段 ",
                -1
                /* CACHED */
              )),
              createElementVNode("select", {
                "data-testid": "xy-dims-x",
                value: __props.dims?.x ?? "",
                onChange: _cache[1] || (_cache[1] = ($event) => setDims({ x: $event.target.value }))
              }, [
                _cache[11] || (_cache[11] = createElementVNode(
                  "option",
                  { value: "" },
                  "自动",
                  -1
                  /* CACHED */
                )),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(fieldsOf(Number(__props.dims?.frame ?? 0), ["number"]), (n) => {
                    return openBlock(), createElementBlock("option", {
                      key: n,
                      value: n
                    }, toDisplayString(n), 9, _hoisted_6$1p);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ], 40, _hoisted_5$1C)
            ]),
            createElementVNode("label", null, [
              _cache[14] || (_cache[14] = createTextVNode(
                " Y 字段 ",
                -1
                /* CACHED */
              )),
              createElementVNode("select", {
                "data-testid": "xy-dims-y",
                value: __props.dims?.y ?? "",
                onChange: _cache[2] || (_cache[2] = ($event) => setDims({ y: $event.target.value }))
              }, [
                _cache[13] || (_cache[13] = createElementVNode(
                  "option",
                  { value: "" },
                  "全部数值字段",
                  -1
                  /* CACHED */
                )),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(fieldsOf(Number(__props.dims?.frame ?? 0), ["number"]), (n) => {
                    return openBlock(), createElementBlock("option", {
                      key: n,
                      value: n
                    }, toDisplayString(n), 9, _hoisted_8$17);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ], 40, _hoisted_7$1f)
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createCommentVNode(" Manual: series list + field pickers "),
            createElementVNode("header", { class: "head" }, [
              _cache[16] || (_cache[16] = createTextVNode(
                " 手动序列 ",
                -1
                /* CACHED */
              )),
              createElementVNode("button", {
                type: "button",
                "data-testid": "xy-add-series",
                class: "btn",
                onClick: addSeries
              }, " + 添加序列 ")
            ]),
            createElementVNode("ul", _hoisted_9$12, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(list.value, (s, i) => {
                  return openBlock(), createElementBlock("li", {
                    key: i,
                    class: normalizeClass(["series-row", { sel: i === selectedIdx.value }]),
                    "data-testid": `xy-series-${i}`,
                    onClick: ($event) => selectedIdx.value = i
                  }, [
                    createElementVNode(
                      "span",
                      null,
                      toDisplayString(seriesLabel(s, i)),
                      1
                      /* TEXT */
                    ),
                    createElementVNode("button", {
                      type: "button",
                      "data-testid": "xy-del-series",
                      class: "icon",
                      title: "删除",
                      onClick: withModifiers(($event) => deleteSeries(i), ["stop"])
                    }, " × ", 8, _hoisted_11$P)
                  ], 10, _hoisted_10$U);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            current.value ? (openBlock(), createElementBlock("div", _hoisted_12$I, [
              createElementVNode("label", null, [
                _cache[17] || (_cache[17] = createTextVNode(
                  " 名称 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("input", {
                  "data-testid": "xy-series-name",
                  value: seriesLabel(current.value, selectedIdx.value).startsWith("序列 ") ? "" : seriesLabel(current.value, selectedIdx.value),
                  placeholder: "序列名称",
                  onChange: _cache[3] || (_cache[3] = ($event) => setName($event.target.value))
                }, null, 40, _hoisted_13$H)
              ]),
              createElementVNode("label", null, [
                _cache[18] || (_cache[18] = createTextVNode(
                  " 数据帧 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("select", {
                  "data-testid": "xy-series-frame",
                  value: String(frameIndexOf(current.value)),
                  onChange: _cache[4] || (_cache[4] = ($event) => setFrame(Number($event.target.value)))
                }, [
                  !frames.value.length ? (openBlock(), createElementBlock("option", _hoisted_15$x, "帧 0")) : createCommentVNode("v-if", true),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(frames.value, (f, i) => {
                      return openBlock(), createElementBlock("option", {
                        key: i,
                        value: String(i)
                      }, toDisplayString(f.name || `帧 ${i}`), 9, _hoisted_16$u);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 40, _hoisted_14$C)
              ]),
              createElementVNode("label", null, [
                _cache[20] || (_cache[20] = createTextVNode(
                  " X 字段 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("select", {
                  "data-testid": "xy-series-x",
                  value: fieldName2(current.value.x),
                  onChange: _cache[5] || (_cache[5] = ($event) => setField("x", $event.target.value))
                }, [
                  _cache[19] || (_cache[19] = createElementVNode(
                    "option",
                    { value: "" },
                    "选择字段",
                    -1
                    /* CACHED */
                  )),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(numberFields.value, (n) => {
                      return openBlock(), createElementBlock("option", {
                        key: `x${n}`,
                        value: n
                      }, toDisplayString(n), 9, _hoisted_18$s);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 40, _hoisted_17$s)
              ]),
              createElementVNode("label", null, [
                _cache[22] || (_cache[22] = createTextVNode(
                  " Y 字段 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("select", {
                  "data-testid": "xy-series-y",
                  value: fieldName2(current.value.y),
                  onChange: _cache[6] || (_cache[6] = ($event) => setField("y", $event.target.value))
                }, [
                  _cache[21] || (_cache[21] = createElementVNode(
                    "option",
                    { value: "" },
                    "选择字段",
                    -1
                    /* CACHED */
                  )),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(numberFields.value, (n) => {
                      return openBlock(), createElementBlock("option", {
                        key: `y${n}`,
                        value: n
                      }, toDisplayString(n), 9, _hoisted_20$o);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 40, _hoisted_19$q)
              ]),
              createElementVNode("label", null, [
                _cache[24] || (_cache[24] = createTextVNode(
                  " 颜色字段 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("select", {
                  "data-testid": "xy-series-color-field",
                  value: fieldName2(current.value.color),
                  onChange: _cache[7] || (_cache[7] = ($event) => setColorField($event.target.value))
                }, [
                  _cache[23] || (_cache[23] = createElementVNode(
                    "option",
                    { value: "" },
                    "固定色 / 无",
                    -1
                    /* CACHED */
                  )),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(allFields.value, (n) => {
                      return openBlock(), createElementBlock("option", {
                        key: `c${n}`,
                        value: n
                      }, toDisplayString(n), 9, _hoisted_22$c);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 40, _hoisted_21$g)
              ]),
              createElementVNode("label", null, [
                _cache[25] || (_cache[25] = createTextVNode(
                  " 固定点颜色 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("input", {
                  "data-testid": "xy-series-point-color",
                  type: "color",
                  value: current.value.pointColor || current.value.color?.fixed || "var(--grafana-primary)",
                  onInput: _cache[8] || (_cache[8] = ($event) => setPointColor($event.target.value))
                }, null, 40, _hoisted_23$9)
              ]),
              createElementVNode("label", null, [
                _cache[27] || (_cache[27] = createTextVNode(
                  " 大小字段 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("select", {
                  "data-testid": "xy-series-size",
                  value: fieldName2(current.value.size),
                  onChange: _cache[9] || (_cache[9] = ($event) => setField("size", $event.target.value))
                }, [
                  _cache[26] || (_cache[26] = createElementVNode(
                    "option",
                    { value: "" },
                    "固定大小",
                    -1
                    /* CACHED */
                  )),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(numberFields.value, (n) => {
                      return openBlock(), createElementBlock("option", {
                        key: `s${n}`,
                        value: n
                      }, toDisplayString(n), 9, _hoisted_25$7);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 40, _hoisted_24$9)
              ])
            ])) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ], 8, _hoisted_1$2T);
    };
  }
});
const XYSeriesEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$3Q, [["__scopeId", "data-v-04e2bc3b"]]);
const BUILTIN_GAZETTEER = {
  "shanghai": { lat: 31.23, lon: 121.47 },
  "beijing": { lat: 39.9, lon: 116.4 },
  "shenzhen": { lat: 22.54, lon: 114.06 },
  "hangzhou": { lat: 30.27, lon: 120.15 },
  "guangzhou": { lat: 23.13, lon: 113.26 },
  "chengdu": { lat: 30.57, lon: 104.07 },
  "wuhan": { lat: 30.59, lon: 114.31 },
  "nanjing": { lat: 32.06, lon: 118.8 },
  "new york": { lat: 40.71, lon: -74.01 },
  "london": { lat: 51.51, lon: -0.13 },
  "tokyo": { lat: 35.68, lon: 139.69 },
  "paris": { lat: 48.86, lon: 2.35 },
  "singapore": { lat: 1.35, lon: 103.82 },
  "sydney": { lat: -33.87, lon: 151.21 },
  "san francisco": { lat: 37.77, lon: -122.42 }
};
function resolveGazetteerEntry(key, custom) {
  if (!key) return null;
  const k = String(key).trim().toLowerCase();
  if (custom && custom[k]) return custom[k];
  if (BUILTIN_GAZETTEER[k]) return BUILTIN_GAZETTEER[k];
  for (const [name, pt] of Object.entries(custom ?? {})) {
    if (name.includes(k) || k.includes(name)) return pt;
  }
  for (const [name, pt] of Object.entries(BUILTIN_GAZETTEER)) {
    if (name.includes(k) || k.includes(name)) return pt;
  }
  return null;
}
function parseGazetteerJson(raw) {
  if (!raw) return void 0;
  if (typeof raw === "object" && !Array.isArray(raw)) {
    const out = {};
    for (const [k, v] of Object.entries(raw)) {
      if (v && typeof v === "object" && Number.isFinite(Number(v.lat)) && Number.isFinite(Number(v.lon))) {
        out[String(k).toLowerCase()] = {
          lat: Number(v.lat),
          lon: Number(v.lon)
        };
      }
    }
    return out;
  }
  if (typeof raw === "string") {
    try {
      return parseGazetteerJson(JSON.parse(raw));
    } catch {
      return void 0;
    }
  }
  return void 0;
}
const BASE32 = "0123456789bcdefghjkmnpqrstuvwxyz";
function decodeGeohash(hash2) {
  if (!hash2 || typeof hash2 !== "string") return null;
  const h2 = hash2.toLowerCase().trim();
  if (!h2.length) return null;
  let even = true;
  let latMin = -90;
  let latMax = 90;
  let lonMin = -180;
  let lonMax = 180;
  for (const ch of h2) {
    const idx = BASE32.indexOf(ch);
    if (idx < 0) return null;
    for (let bit = 4; bit >= 0; bit--) {
      const bitVal = idx >> bit & 1;
      if (even) {
        const mid = (lonMin + lonMax) / 2;
        if (bitVal) lonMin = mid;
        else lonMax = mid;
      } else {
        const mid = (latMin + latMax) / 2;
        if (bitVal) latMin = mid;
        else latMax = mid;
      }
      even = !even;
    }
  }
  return { lat: (latMin + latMax) / 2, lon: (lonMin + lonMax) / 2 };
}
function findField(frame, names, fallbacks) {
  if (names) {
    for (const n of names) {
      if (!n) continue;
      const exact = frame.fields.find((f) => f.name === n);
      if (exact) return exact;
      const ci = frame.fields.find((f) => f.name.toLowerCase() === n.toLowerCase());
      if (ci) return ci;
      const byDisplay = frame.fields.find((f) => getFieldDisplayName(f, frame) === n);
      if (byDisplay) return byDisplay;
    }
  }
  for (const re of fallbacks) {
    const f = frame.fields.find(
      (fld) => re.test(fld.name) || re.test(getFieldDisplayName(fld, frame))
    );
    if (f) return f;
  }
  return void 0;
}
function resolveLocationPoints(frame, location2, layerMeta) {
  if (!frame?.fields?.length) return [];
  const mode2 = String(location2?.mode ?? "auto").toLowerCase();
  const valField = frame.fields.find((f) => f.type === "number" && !/lat|lon|lng|x|y/i.test(f.name)) ?? frame.fields.find((f) => f.type === "number");
  const labelField = findField(frame, void 0, [/name|label|city|host|service/i]);
  if (mode2 === "geohash") {
    const gh = findField(frame, location2?.geohash ? [location2.geohash] : void 0, [
      /geohash|geo_hash/i
    ]);
    if (!gh) return [];
    const out = [];
    for (let i = 0; i < gh.values.length; i++) {
      const decoded = decodeGeohash(String(gh.values[i] ?? ""));
      if (!decoded) continue;
      out.push({
        lon: decoded.lon,
        lat: decoded.lat,
        value: Number(valField?.values[i] ?? 1) || 1,
        label: labelField ? String(labelField.values[i] ?? "") : String(gh.values[i]),
        layerName: layerMeta?.name,
        layerType: layerMeta?.type
      });
    }
    return out;
  }
  if (mode2 === "lookup") {
    const lookupField = findField(frame, location2?.lookup ? [location2.lookup] : void 0, [
      /name|city|host|location|place|label|key/i
    ]);
    if (!lookupField) return [];
    const custom = parseGazetteerJson(location2?.gazetteer);
    const out = [];
    for (let i = 0; i < lookupField.values.length; i++) {
      const key = String(lookupField.values[i] ?? "");
      const pt = resolveGazetteerEntry(key, custom);
      if (!pt) continue;
      out.push({
        lon: pt.lon,
        lat: pt.lat,
        value: Number(valField?.values[i] ?? 1) || 1,
        label: key,
        layerName: layerMeta?.name,
        layerType: layerMeta?.type
      });
    }
    return out;
  }
  if (mode2 === "coords" || mode2 === "auto") {
    const lat = findField(
      frame,
      location2?.latitude ? [location2.latitude] : void 0,
      mode2 === "coords" ? [/^lat(itude)?$/i, /lat/i] : [/lat/i, /^y$/i]
    ) ?? (mode2 === "auto" ? frame.fields.find((f) => f.name.toLowerCase() === "y") : void 0);
    const lon = findField(
      frame,
      location2?.longitude ? [location2.longitude] : void 0,
      mode2 === "coords" ? [/^lon(gitude)?$|^lng$/i, /lon|lng/i] : [/lon|lng/i, /^x$/i]
    ) ?? (mode2 === "auto" ? frame.fields.find((f) => f.name.toLowerCase() === "x") : void 0);
    if (lat && lon) {
      return lat.values.map((la, i) => ({
        lon: Number(lon.values[i]),
        lat: Number(la),
        value: Number(valField?.values[i] ?? 1) || 1,
        label: labelField ? String(labelField.values[i] ?? "") : `${Number(la).toFixed(2)},${Number(lon.values[i]).toFixed(2)}`,
        layerName: layerMeta?.name,
        layerType: layerMeta?.type
      }));
    }
    if (mode2 === "auto") {
      const gh = findField(frame, location2?.geohash ? [location2.geohash] : void 0, [/geohash/i]);
      if (gh) {
        return resolveLocationPoints(frame, { ...location2, mode: "geohash" }, layerMeta);
      }
      const lookupField = findField(frame, location2?.lookup ? [location2.lookup] : void 0, [
        /name|city|host|location|place/i
      ]);
      if (lookupField) {
        return resolveLocationPoints(frame, { ...location2, mode: "lookup" }, layerMeta);
      }
    }
  }
  return [];
}
function matchGeomapFrameFilter(frame, filter2) {
  if (filter2 == null || filter2 === "") return true;
  if (typeof filter2 === "string") {
    const needle = filter2.trim();
    if (!needle) return true;
    const ref2 = String(frame.refId ?? "");
    const name = String(frame.name ?? "");
    if (needle.includes("|")) {
      const parts = needle.split("|").map((s) => s.trim()).filter(Boolean);
      return parts.includes(ref2) || parts.includes(name);
    }
    return ref2 === needle || name === needle;
  }
  if (typeof filter2 === "object") {
    const f = filter2;
    const id = String(f.id || "byRefId");
    const pattern = String(f.options ?? "");
    if (id === "byName" || id === "byFrameName") {
      return String(frame.name ?? "") === pattern;
    }
    return String(frame.refId ?? "") === pattern;
  }
  return true;
}
function framesForLayer(frames, layer, panelFilterData) {
  const filter2 = layer.filterData ?? panelFilterData;
  if (filter2 == null || filter2 === "") return frames;
  const filtered = frames.filter((fr) => matchGeomapFrameFilter(fr, filter2));
  return filtered.length ? filtered : frames;
}
function resolveAllLayerPoints(series, layers, panelFilterData) {
  const data = dataLayers(layers);
  const frames = series?.length ? series : [];
  return data.map((layer, idx) => {
    const scoped = framesForLayer(frames, layer, panelFilterData);
    const frame = scoped[Math.min(idx, Math.max(0, scoped.length - 1))] ?? scoped[0];
    const points = resolveLocationPoints(frame, layer.location, {
      name: layer.name,
      type: String(layer.type)
    });
    return { layer, points };
  });
}
function normalizeGeomapLayers(options = {}) {
  const raw = options.layers;
  if (Array.isArray(raw) && raw.length) {
    const layers = raw.map((l, i) => normalizeLayer(l, i));
    if (!layers.some((l) => l.type === "basemap")) {
      const basemapType2 = typeof options.basemap === "string" ? options.basemap : String(options.basemap?.type ?? "default");
      layers.unshift({
        type: "basemap",
        name: "底图",
        config: {
          basemapType: basemapType2 === "default" ? "carto" : basemapType2,
          theme: "auto",
          showLabels: true,
          ...options.basemap?.config ?? {}
        }
      });
    }
    return layers;
  }
  const basemapTypeRaw = typeof options.basemap === "string" ? options.basemap : String(options.basemap?.type ?? "default");
  const basemapType = basemapTypeRaw === "default" || !basemapTypeRaw ? "carto" : basemapTypeRaw;
  const dataLayer = {
    type: String(options.type ?? "markers"),
    name: "Layer 1",
    opacity: options.opacity != null ? Number(options.opacity) : 1,
    config: options.config ?? {},
    tooltip: true,
    location: { mode: "auto" }
  };
  const basemap = {
    type: "basemap",
    name: "底图",
    config: {
      basemapType,
      theme: "auto",
      showLabels: true,
      ...options.basemap?.config ?? {}
    }
  };
  return [basemap, dataLayer];
}
function normalizeLayer(raw, index2) {
  if (!raw || typeof raw !== "object") {
    return {
      type: "markers",
      name: `图层 ${index2 + 1}`,
      location: { mode: "auto" }
    };
  }
  const l = raw;
  const loc = l.location ?? { mode: "auto" };
  return {
    type: String(l.type ?? "markers"),
    name: typeof l.name === "string" ? l.name : `图层 ${index2 + 1}`,
    opacity: l.opacity == null ? 1 : Number(l.opacity),
    tooltip: l.tooltip !== false,
    location: {
      mode: loc.mode ?? "auto",
      latitude: loc.latitude,
      longitude: loc.longitude,
      geohash: loc.geohash,
      lookup: loc.lookup,
      gazetteer: loc.gazetteer
    },
    config: l.config ?? {},
    filterData: l.filterData
  };
}
function dataLayers(layers) {
  return layers.filter((l) => l.type !== "basemap");
}
function basemapLayer(layers) {
  return layers.find((l) => l.type === "basemap");
}
function serializeLayersIntoOptions(options, layers) {
  const base = basemapLayer(layers);
  const data = dataLayers(layers);
  const primary = data[0];
  return {
    ...options,
    layers,
    basemap: {
      type: String(base?.config?.basemapType ?? options.basemap?.type ?? "osm"),
      config: base?.config ?? {}
    },
    type: primary?.type ?? options.type ?? "markers",
    opacity: primary?.opacity ?? options.opacity ?? 1,
    config: {
      ...options.config ?? {},
      ...primary?.config ?? {}
    }
  };
}
const _hoisted_1$2S = {
  class: "geomap-layers-editor",
  "data-testid": "geomap-layers-editor"
};
const _hoisted_2$2l = { class: "head" };
const _hoisted_3$25 = ["data-testid"];
const _hoisted_4$1O = { class: "layer-head" };
const _hoisted_5$1B = { class: "row" };
const _hoisted_6$1o = { class: "row" };
const _hoisted_7$1e = {
  key: 0,
  class: "row"
};
const _hoisted_8$16 = { class: "row" };
const _hoisted_9$11 = {
  key: 0,
  class: "row cols"
};
const _hoisted_10$T = {
  key: 1,
  class: "row"
};
const _hoisted_11$O = {
  key: 2,
  class: "row cols"
};
const _hoisted_12$H = {
  key: 3,
  class: "row"
};
const _hoisted_13$G = { class: "row cols" };
const _hoisted_14$B = { class: "switch-row" };
const _sfc_main$3P = /* @__PURE__ */ defineComponent({
  __name: "GeomapLayersEditor",
  props: {
    options: {},
    onChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const layers = computed(() => normalizeGeomapLayers(props.options ?? {}));
    const typeOptions = [
      { label: "底图", value: "basemap" },
      { label: "标记", value: "markers" },
      { label: "热力", value: "heatmap" },
      { label: "路径", value: "route" },
      { label: "GeoJSON", value: "geojson" },
      { label: "照片", value: "photos" }
    ];
    const locationModes = [
      { label: "自动", value: "auto" },
      { label: "坐标字段", value: "coords" },
      { label: "Geohash", value: "geohash" },
      { label: "查找表", value: "lookup" }
    ];
    const basemapTypes = [
      { label: "OpenStreetMap", value: "osm" },
      { label: "XYZ 瓦片", value: "xyz" },
      { label: "无底图", value: "none" }
    ];
    function commit(next) {
      props.onChange(serializeLayersIntoOptions(props.options ?? {}, next));
    }
    function updateLayer(index2, patch) {
      const next = layers.value.map((l, i) => i === index2 ? { ...l, ...patch } : l);
      commit(next);
    }
    function updateLocation(index2, patch) {
      const layer = layers.value[index2];
      updateLayer(index2, { location: { ...layer.location ?? {}, ...patch } });
    }
    function updateConfig(index2, patch) {
      const layer = layers.value[index2];
      updateLayer(index2, { config: { ...layer.config ?? {}, ...patch } });
    }
    function addLayer() {
      commit([
        ...layers.value,
        {
          type: "markers",
          name: `数据层 ${layers.value.length}`,
          opacity: 1,
          tooltip: true,
          location: { mode: "auto" },
          config: { radius: 6 }
        }
      ]);
    }
    function removeLayer(index2) {
      if (layers.value.length <= 1) return;
      commit(layers.value.filter((_, i) => i !== index2));
    }
    function moveLayer(index2, dir) {
      const j = index2 + dir;
      if (j < 0 || j >= layers.value.length) return;
      const next = [...layers.value];
      const tmp = next[index2];
      next[index2] = next[j];
      next[j] = tmp;
      commit(next);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2S, [
        createElementVNode("div", _hoisted_2$2l, [
          _cache[1] || (_cache[1] = createElementVNode(
            "strong",
            null,
            "图层",
            -1
            /* CACHED */
          )),
          createVNode(unref(GButton), {
            size: "sm",
            variant: "primary",
            "data-testid": "geomap-add-layer",
            onClick: addLayer
          }, {
            default: withCtx(() => [..._cache[0] || (_cache[0] = [
              createTextVNode(
                " 添加图层 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(layers.value, (layer, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "layer-card",
              "data-testid": `geomap-layer-${i}`
            }, [
              createElementVNode("div", _hoisted_4$1O, [
                createVNode(unref(GInput), {
                  value: layer.name,
                  placeholder: "图层名称",
                  "data-testid": "geomap-layer-name",
                  "onUpdate:value": ($event) => updateLayer(i, { name: String($event) })
                }, null, 8, ["value", "onUpdate:value"]),
                createVNode(unref(GSelect), {
                  style: { "width": "120px" },
                  value: layer.type,
                  options: typeOptions,
                  "data-testid": "geomap-layer-type",
                  "onUpdate:value": ($event) => updateLayer(i, { type: String($event) })
                }, null, 8, ["value", "onUpdate:value"]),
                createVNode(unref(GButton), {
                  size: "sm",
                  disabled: i === 0,
                  onClick: ($event) => moveLayer(i, -1)
                }, {
                  default: withCtx(() => [..._cache[2] || (_cache[2] = [
                    createTextVNode(
                      " ↑ ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled", "onClick"]),
                createVNode(unref(GButton), {
                  size: "sm",
                  disabled: i === layers.value.length - 1,
                  onClick: ($event) => moveLayer(i, 1)
                }, {
                  default: withCtx(() => [..._cache[3] || (_cache[3] = [
                    createTextVNode(
                      "↓",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled", "onClick"]),
                createVNode(unref(GButton), {
                  size: "sm",
                  variant: "destructive",
                  disabled: layers.value.length <= 1,
                  onClick: ($event) => removeLayer(i)
                }, {
                  default: withCtx(() => [..._cache[4] || (_cache[4] = [
                    createTextVNode(
                      " 删除 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled", "onClick"])
              ]),
              createElementVNode("div", _hoisted_5$1B, [
                _cache[5] || (_cache[5] = createElementVNode(
                  "label",
                  null,
                  "不透明度",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  type: "number",
                  min: 0,
                  max: 1,
                  step: 0.1,
                  value: layer.opacity ?? 1,
                  "data-testid": "geomap-layer-opacity",
                  "onUpdate:value": ($event) => updateLayer(i, { opacity: Number($event ?? 1) })
                }, null, 8, ["value", "onUpdate:value"]),
                _cache[6] || (_cache[6] = createElementVNode(
                  "label",
                  null,
                  "提示",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSwitch), {
                  checked: layer.tooltip !== false,
                  "onUpdate:checked": (v) => updateLayer(i, { tooltip: v === true || v === "true" })
                }, null, 8, ["checked", "onUpdate:checked"])
              ]),
              layer.type === "basemap" ? (openBlock(), createElementBlock(
                Fragment,
                { key: 0 },
                [
                  createElementVNode("div", _hoisted_6$1o, [
                    _cache[7] || (_cache[7] = createElementVNode(
                      "label",
                      null,
                      "底图类型",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GSelect), {
                      style: { "width": "160px" },
                      value: String(layer.config?.basemapType ?? "osm"),
                      options: basemapTypes,
                      "data-testid": "geomap-basemap-type",
                      "onUpdate:value": ($event) => updateConfig(i, { basemapType: $event })
                    }, null, 8, ["value", "onUpdate:value"])
                  ]),
                  String(layer.config?.basemapType) === "xyz" ? (openBlock(), createElementBlock("div", _hoisted_7$1e, [
                    _cache[8] || (_cache[8] = createElementVNode(
                      "label",
                      null,
                      "XYZ URL",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GInput), {
                      value: String(layer.config?.url ?? ""),
                      placeholder: "https://…/{z}/{x}/{y}.png",
                      "onUpdate:value": ($event) => updateConfig(i, { url: $event })
                    }, null, 8, ["value", "onUpdate:value"])
                  ])) : createCommentVNode("v-if", true)
                ],
                64
                /* STABLE_FRAGMENT */
              )) : (openBlock(), createElementBlock(
                Fragment,
                { key: 1 },
                [
                  createElementVNode("div", _hoisted_8$16, [
                    _cache[9] || (_cache[9] = createElementVNode(
                      "label",
                      null,
                      "位置模式",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GSelect), {
                      style: { "width": "140px" },
                      value: String(layer.location?.mode ?? "auto"),
                      options: locationModes,
                      "data-testid": "geomap-location-mode",
                      "onUpdate:value": ($event) => updateLocation(i, { mode: $event })
                    }, null, 8, ["value", "onUpdate:value"])
                  ]),
                  String(layer.location?.mode) === "coords" ? (openBlock(), createElementBlock("div", _hoisted_9$11, [
                    createElementVNode("div", null, [
                      _cache[10] || (_cache[10] = createElementVNode(
                        "label",
                        null,
                        "纬度字段",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GInput), {
                        value: String(layer.location?.latitude ?? ""),
                        placeholder: "纬度 lat",
                        "data-testid": "geomap-lat-field",
                        "onUpdate:value": ($event) => updateLocation(i, { latitude: $event })
                      }, null, 8, ["value", "onUpdate:value"])
                    ]),
                    createElementVNode("div", null, [
                      _cache[11] || (_cache[11] = createElementVNode(
                        "label",
                        null,
                        "经度字段",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GInput), {
                        value: String(layer.location?.longitude ?? ""),
                        placeholder: "经度 lon",
                        "data-testid": "geomap-lon-field",
                        "onUpdate:value": ($event) => updateLocation(i, { longitude: $event })
                      }, null, 8, ["value", "onUpdate:value"])
                    ])
                  ])) : createCommentVNode("v-if", true),
                  String(layer.location?.mode) === "geohash" ? (openBlock(), createElementBlock("div", _hoisted_10$T, [
                    _cache[12] || (_cache[12] = createElementVNode(
                      "label",
                      null,
                      "Geohash 字段",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GInput), {
                      value: String(layer.location?.geohash ?? ""),
                      placeholder: "geohash 字段",
                      "data-testid": "geomap-geohash-field",
                      "onUpdate:value": ($event) => updateLocation(i, { geohash: $event })
                    }, null, 8, ["value", "onUpdate:value"])
                  ])) : createCommentVNode("v-if", true),
                  String(layer.location?.mode) === "lookup" ? (openBlock(), createElementBlock("div", _hoisted_11$O, [
                    createElementVNode("div", null, [
                      _cache[13] || (_cache[13] = createElementVNode(
                        "label",
                        null,
                        "查找字段",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GInput), {
                        value: String(layer.location?.lookup ?? ""),
                        placeholder: "城市 / 站点",
                        "data-testid": "geomap-lookup-field",
                        "onUpdate:value": ($event) => updateLocation(i, { lookup: $event })
                      }, null, 8, ["value", "onUpdate:value"])
                    ]),
                    createElementVNode("div", null, [
                      _cache[14] || (_cache[14] = createElementVNode(
                        "label",
                        null,
                        "地名表 (JSON)",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GInput), {
                        value: String(layer.location?.gazetteer ?? ""),
                        placeholder: '{"hq":{"lat":1,"lon":2}}',
                        "data-testid": "geomap-gazetteer-field",
                        "onUpdate:value": ($event) => updateLocation(i, { gazetteer: $event })
                      }, null, 8, ["value", "onUpdate:value"])
                    ])
                  ])) : createCommentVNode("v-if", true),
                  String(layer.type) === "geojson" ? (openBlock(), createElementBlock("div", _hoisted_12$H, [
                    _cache[15] || (_cache[15] = createElementVNode(
                      "label",
                      null,
                      "GeoJSON（内联 JSON）",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GInput), {
                      value: String(layer.config?.geojson ?? layer.config?.src ?? ""),
                      placeholder: '{"type":"FeatureCollection","features":[]}',
                      "data-testid": "geomap-geojson-src",
                      "onUpdate:value": ($event) => updateConfig(i, { geojson: $event })
                    }, null, 8, ["value", "onUpdate:value"])
                  ])) : createCommentVNode("v-if", true),
                  createElementVNode("div", _hoisted_13$G, [
                    createElementVNode("div", null, [
                      _cache[16] || (_cache[16] = createElementVNode(
                        "label",
                        null,
                        "半径",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GInput), {
                        type: "number",
                        min: 1,
                        max: 40,
                        value: Number(layer.config?.radius ?? 6),
                        "onUpdate:value": ($event) => updateConfig(i, { radius: Number($event ?? 6) })
                      }, null, 8, ["value", "onUpdate:value"])
                    ]),
                    createElementVNode("div", null, [
                      _cache[17] || (_cache[17] = createElementVNode(
                        "label",
                        null,
                        "颜色",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GInput), {
                        value: String(layer.config?.color ?? ""),
                        placeholder: "var(--grafana-primary)",
                        "onUpdate:value": ($event) => updateConfig(i, { color: $event })
                      }, null, 8, ["value", "onUpdate:value"])
                    ]),
                    createElementVNode("div", _hoisted_14$B, [
                      _cache[18] || (_cache[18] = createElementVNode(
                        "label",
                        null,
                        "显示标签",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GSwitch), {
                        checked: Boolean(layer.config?.showLabels),
                        "onUpdate:checked": (v) => updateConfig(i, { showLabels: v === true || v === "true" })
                      }, null, 8, ["checked", "onUpdate:checked"])
                    ])
                  ])
                ],
                64
                /* STABLE_FRAGMENT */
              ))
            ], 8, _hoisted_3$25);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const GeomapLayersEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$3P, [["__scopeId", "data-v-daec81fa"]]);
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  CanvasEditor,
  GeomapLayersEditor,
  PANEL_IDS,
  PanelChrome,
  XYSeriesEditor,
  migrateDashboardPanels,
  migratePanelModel,
  panelHostKey
}, Symbol.toStringTag, { value: "Module" }));
function createEmptyDashboardJson(title = "新仪表盘") {
  return {
    uid: "",
    title,
    description: "",
    schemaVersion: 39,
    version: 0,
    editable: true,
    panels: [],
    templating: { list: [] },
    annotations: { list: [] },
    time: { from: "now-6h", to: "now" },
    timepicker: {},
    timezone: "browser",
    refresh: "",
    tags: [],
    links: [],
    graphTooltip: 0
  };
}
function normalizeThresholds(t2) {
  if (!t2) return { mode: "absolute", steps: [{ color: "green", value: null }] };
  if (Array.isArray(t2)) {
    return { mode: "absolute", steps: t2 };
  }
  return {
    mode: t2.mode ?? "absolute",
    steps: Array.isArray(t2.steps) ? t2.steps : [{ color: "green", value: null }]
  };
}
function normalizeOverride(o) {
  if (!o || typeof o !== "object")
    return { matcher: { id: "byName", options: "" }, properties: [] };
  return {
    matcher: o.matcher ?? { id: "byName", options: "" },
    properties: Array.isArray(o.properties) ? o.properties : []
  };
}
function normalizePanelFieldConfig(fc) {
  if (!fc) return { defaults: {}, overrides: [] };
  return {
    defaults: {
      ...fc.defaults ?? {},
      custom: fc.defaults?.custom ?? {},
      thresholds: normalizeThresholds(fc.defaults?.thresholds),
      mappings: fc.defaults?.mappings ?? [],
      links: fc.defaults?.links ?? []
    },
    overrides: (fc.overrides ?? []).map(normalizeOverride)
  };
}
function normalizePanels(panels2) {
  if (!Array.isArray(panels2)) return [];
  return panels2.map((p, i) => {
    if (!p || typeof p !== "object") {
      return {
        id: i + 1,
        type: "stat",
        title: `Panel ${i + 1}`,
        gridPos: { x: 0, y: i * 8, w: 12, h: 8 },
        targets: [],
        options: {},
        fieldConfig: { defaults: {}, overrides: [] }
      };
    }
    return {
      ...p,
      id: p.id ?? i + 1,
      type: p.type ?? "stat",
      title: p.title ?? `Panel ${p.id ?? i + 1}`,
      gridPos: p.gridPos ?? { x: 0, y: i * 8, w: 12, h: 8 },
      targets: Array.isArray(p.targets) ? p.targets : [],
      options: p.options ?? {},
      fieldConfig: normalizePanelFieldConfig(p.fieldConfig),
      transformations: Array.isArray(p.transformations) ? p.transformations : []
    };
  });
}
function normalizeTemplating(templating) {
  if (!templating) return { list: [] };
  if (Array.isArray(templating)) return { list: templating };
  return {
    list: Array.isArray(templating.list) ? templating.list : []
  };
}
function normalizeAnnotations(annotations) {
  if (!annotations) return { list: [] };
  if (Array.isArray(annotations)) return { list: annotations };
  return {
    list: Array.isArray(annotations.list) ? annotations.list : []
  };
}
function normalizeDashboardJson(raw) {
  return {
    ...raw,
    uid: raw.uid ?? `local-${Date.now()}`,
    title: raw.title ?? "Untitled",
    schemaVersion: raw.schemaVersion ?? 1,
    version: raw.version ?? 0,
    panels: normalizePanels(raw.panels ?? []),
    templating: normalizeTemplating(raw.templating),
    annotations: normalizeAnnotations(raw.annotations),
    time: raw.time ?? { from: "now-6h", to: "now" },
    timepicker: raw.timepicker ?? {},
    refresh: raw.refresh ?? "",
    tags: raw.tags ?? [],
    links: raw.links ?? [],
    editable: raw.editable ?? true,
    graphTooltip: raw.graphTooltip ?? 0,
    timezone: raw.timezone ?? "browser",
    fiscalYearStartMonth: raw.fiscalYearStartMonth ?? 0,
    weekStart: raw.weekStart ?? "",
    liveNow: raw.liveNow ?? false
  };
}
function loadDashboardDocument(raw) {
  const normalized = normalizeDashboardJson(raw ?? {});
  try {
    const envelope = parseDashboardDocument(normalized);
    const doc = envelope.dashboard;
    return { ...doc, panels: migrateDashboardPanels(doc.panels ?? []) };
  } catch {
    const doc = preserveUnknownFields(normalized, migrateDashboard(normalized));
    return { ...doc, panels: migrateDashboardPanels(doc.panels ?? []) };
  }
}
function serializeDashboardDocument(doc) {
  return JSON.stringify(doc, null, 2);
}
function roundTripDashboard(raw) {
  return dashboardRoundTrip(raw);
}
function upsertPanel(doc, panel2) {
  const panels2 = [...doc.panels ?? []];
  const idx = panels2.findIndex((p) => p.id === panel2.id);
  if (idx >= 0) panels2[idx] = panel2;
  else panels2.push(panel2);
  return { ...doc, panels: panels2 };
}
function removePanel(doc, panelId) {
  return { ...doc, panels: (doc.panels ?? []).filter((p) => p.id !== panelId) };
}
function nextPanelId(doc) {
  return (doc.panels ?? []).reduce((max, p) => Math.max(max, p.id ?? 0), 0) + 1;
}
const VAR_REF = /\$([a-zA-Z_]\w*)|\$\{([^}:]+)(?::[^}]+)?\}/g;
function extractVariableRefs(text) {
  const out = /* @__PURE__ */ new Set();
  let m;
  const re = new RegExp(VAR_REF.source, "g");
  while (m = re.exec(text)) {
    out.add(m[1] || m[2]);
  }
  return [...out];
}
function buildVariableDependencyGraph(variables) {
  const graph = /* @__PURE__ */ new Map();
  const names = new Set(variables.map((v) => v.name));
  for (const v of variables) {
    const raw = typeof v.query === "string" ? v.query : JSON.stringify(v.query ?? "");
    const def = String(v.definition ?? "");
    const regex = String(v.regex ?? "");
    const refs = [
      ...extractVariableRefs(raw),
      ...extractVariableRefs(def),
      ...extractVariableRefs(regex)
    ].filter((r) => names.has(r) && r !== v.name);
    graph.set(v.name, [...new Set(refs)]);
  }
  return graph;
}
function detectVariableCycles(variables) {
  const graph = buildVariableDependencyGraph(variables);
  const cycles = [];
  const visiting = /* @__PURE__ */ new Set();
  const visited = /* @__PURE__ */ new Set();
  const stack = [];
  function dfs(node) {
    if (visiting.has(node)) {
      const idx = stack.indexOf(node);
      cycles.push(stack.slice(idx).concat(node));
      return;
    }
    if (visited.has(node)) return;
    visiting.add(node);
    stack.push(node);
    for (const dep of graph.get(node) ?? []) dfs(dep);
    stack.pop();
    visiting.delete(node);
    visited.add(node);
  }
  for (const name of graph.keys()) dfs(name);
  return cycles;
}
function variableRefreshOrder(variables) {
  const cycles = detectVariableCycles(variables);
  if (cycles.length) {
    throw new Error(`Variable dependency cycle: ${cycles[0].join(" -> ")}`);
  }
  const graph = buildVariableDependencyGraph(variables);
  const remaining = new Set(variables.map((v) => v.name));
  const order = [];
  while (remaining.size) {
    const next = [...remaining].filter((n) => (graph.get(n) ?? []).every((d) => order.includes(d)));
    if (!next.length) {
      order.push(...remaining);
      break;
    }
    next.sort();
    for (const n of next) {
      order.push(n);
      remaining.delete(n);
    }
  }
  return order;
}
function encodeVariablesToUrl(variables, params = new URLSearchParams()) {
  for (const v of variables) {
    if (v.skipUrlSync) continue;
    const val = v.current?.value;
    if (val == null) continue;
    const key = `var-${v.name}`;
    if (Array.isArray(val)) {
      params.delete(key);
      for (const item of val) params.append(key, item);
    } else {
      params.set(key, String(val));
    }
  }
  return params;
}
function applyVariablesFromUrl(variables, params) {
  return variables.map((v) => {
    if (v.skipUrlSync) return v;
    const key = `var-${v.name}`;
    if (!params.has(key)) return v;
    const all = params.getAll(key);
    const value = v.multi ? all : all[0] ?? "";
    const text = value;
    return {
      ...v,
      current: { text, value },
      options: (v.options ?? []).map((o) => ({
        ...o,
        selected: Array.isArray(value) ? value.includes(o.value) : o.value === value
      }))
    };
  });
}
function variableRefreshLayers(variables) {
  const cycles = detectVariableCycles(variables);
  if (cycles.length) {
    throw new Error(`Variable dependency cycle: ${cycles[0].join(" -> ")}`);
  }
  const graph = buildVariableDependencyGraph(variables);
  const remaining = new Set(variables.map((v) => v.name));
  const layers = [];
  const done = /* @__PURE__ */ new Set();
  while (remaining.size) {
    const next = [...remaining].filter((n) => (graph.get(n) ?? []).every((d) => done.has(d))).sort();
    if (!next.length) {
      layers.push([...remaining].sort());
      break;
    }
    layers.push(next);
    for (const n of next) {
      remaining.delete(n);
      done.add(n);
    }
  }
  return layers;
}
function expandAllToken(variable, value, text) {
  const allValue = variable.allValue != null && String(variable.allValue) !== "" ? String(variable.allValue) : "/.*/";
  if (Array.isArray(value)) {
    if (!value.includes("$__all")) return { value, text };
    return { value: allValue, text: "All" };
  }
  if (String(value) === "$__all") {
    return { value: allValue, text: "All" };
  }
  return { value, text };
}
function sortVariableOptions(options, sort) {
  const mode2 = Number(sort ?? 0);
  if (!mode2 || !options.length) return options;
  const copy = options.slice();
  const textOf = (o) => String(o.text ?? o.value ?? "");
  const numOf = (o) => {
    const n = Number(textOf(o));
    return Number.isFinite(n) ? n : Number.NaN;
  };
  copy.sort((a, b) => {
    const ta = textOf(a);
    const tb = textOf(b);
    if (mode2 === 3 || mode2 === 4) {
      const na = numOf(a);
      const nb = numOf(b);
      if (Number.isFinite(na) && Number.isFinite(nb)) {
        return mode2 === 3 ? na - nb : nb - na;
      }
      const c2 = ta.localeCompare(tb);
      return mode2 === 4 ? -c2 : c2;
    }
    if (mode2 === 5 || mode2 === 6) {
      const c2 = ta.localeCompare(tb, void 0, { sensitivity: "base" });
      return mode2 === 5 ? c2 : -c2;
    }
    if (mode2 === 7 || mode2 === 8) {
      const c2 = ta.localeCompare(tb, void 0, { numeric: true });
      return mode2 === 7 ? c2 : -c2;
    }
    const c = ta.localeCompare(tb);
    if (mode2 === 1) return c;
    if (mode2 === 2) return -c;
    return 0;
  });
  return copy;
}
function filterVariableOptionsByRegex(options, regex) {
  const raw = String(regex ?? "").trim();
  if (!raw) return options;
  let re;
  try {
    const m = raw.match(/^\/(.+)\/([gimsuy]*)$/);
    re = m ? new RegExp(m[1], m[2]) : new RegExp(raw);
  } catch {
    return options;
  }
  return options.filter((o) => re.test(String(o.text ?? "")) || re.test(String(o.value ?? "")));
}
function finalizeVariableOptions(variable, options) {
  let out = filterVariableOptionsByRegex(options, variable.regex);
  out = sortVariableOptions(out, variable.sort);
  return out;
}
function buildScopedVars(variables) {
  const scoped = {};
  for (const v of variables) {
    const rawText = v.current?.text ?? "";
    const rawValue = v.current?.value ?? "";
    const expanded = expandAllToken(v, rawValue, rawText);
    scoped[v.name] = { text: expanded.text, value: expanded.value };
  }
  scoped.__org = { text: "Main Org.", value: "1" };
  scoped.__user = { text: "admin", value: "admin" };
  return scoped;
}
function replaceVariables(template, scopedVars) {
  return template.replaceAll(
    /\$([a-z_]\w*)|\$\{([^}:]+)(?::([^}]+))?\}/gi,
    (match, a, b, format) => {
      const name = a || b;
      const v = scopedVars[name];
      if (!v) return match;
      return formatVariableValue(v.value, format || "csv");
    }
  );
}
function formatVariableValue(value, format = "csv") {
  const values = Array.isArray(value) ? value : [value];
  switch (format) {
    case "json":
      return JSON.stringify(values);
    case "pipe":
      return values.join("|");
    case "queryparam":
      return values.map(encodeURIComponent).join("&");
    case "regex":
      return values.map((v) => v.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
    case "lucene":
      return values.map((v) => `"${v}"`).join(" OR ");
    case "csv":
    default:
      return values.join(",");
  }
}
function setVariableValue(variables, name, value, text) {
  return variables.map((v) => {
    if (v.name !== name) return v;
    const values = Array.isArray(value) ? value : [value];
    const texts = values;
    return {
      ...v,
      current: {
        text: texts.length === 1 ? texts[0] : texts,
        value: values.length === 1 ? values[0] : values
      },
      options: (v.options ?? []).map((o) => ({
        ...o,
        selected: values.includes(o.value)
      }))
    };
  });
}
const MAX_VARIABLE_OPTIONS = 80;
async function refreshVariableOptions(variable, resolveDs, scopedVars, range) {
  if (variable.type === "constant") {
    const value = String(variable.query ?? variable.current?.value ?? "");
    return {
      ...variable,
      current: { text: value, value },
      options: [{ text: value, value, selected: true }]
    };
  }
  if (variable.type === "custom") {
    const raw = String(variable.query ?? "");
    let options = raw.split(",").map((s) => s.trim()).filter(Boolean).map((v) => ({
      text: v,
      value: v,
      selected: String(variable.current?.value) === v
    }));
    options = finalizeVariableOptions(variable, options);
    return { ...variable, options };
  }
  if (variable.type === "query") {
    const ds2 = resolveDs(variable.datasource);
    if (!ds2?.metricFindQuery) return variable;
    const curVal = variable.current?.value;
    const curStr = Array.isArray(curVal) ? curVal.map(String).join(",") : String(curVal ?? "");
    const allVal = variable.allValue != null && String(variable.allValue) !== "" ? String(variable.allValue) : "/.*/";
    const curText = String(
      Array.isArray(variable.current?.text) ? variable.current?.text.join(",") : variable.current?.text ?? ""
    ).toLowerCase();
    const isAllCurrent = !!variable.includeAll && (curStr === "$__all" || curStr === allVal || curStr === "/.*/" || curStr === "*" || curText === "all" || curText === "全部");
    if (isAllCurrent) {
      return {
        ...variable,
        options: markRaw([{ text: "全部", value: allVal, selected: true }]),
        current: { text: "All", value: allVal }
      };
    }
    const rows = await ds2.metricFindQuery(variable.query ?? variable.definition ?? "", void 0, {
      scopedVars: scopedVars || {},
      range
    });
    let options = rows.map((r) => ({
      text: r.text,
      value: r.value,
      selected: String(variable.current?.value) === String(r.value)
    }));
    options = finalizeVariableOptions(variable, options);
    if (options.length > MAX_VARIABLE_OPTIONS) {
      options = options.slice(0, MAX_VARIABLE_OPTIONS);
    }
    const matched = options.find((o) => o.selected);
    const hasCurrent = curVal != null && String(curVal) !== "" && !(Array.isArray(curVal) && !curVal.length);
    const current = matched ? { text: matched.text, value: matched.value } : hasCurrent ? {
      text: String(
        Array.isArray(variable.current?.text) ? variable.current?.text.join(", ") : variable.current?.text ?? curVal
      ),
      value: curVal
    } : options[0] ? { text: options[0].text, value: options[0].value } : variable.current;
    return {
      ...variable,
      options: markRaw(options),
      current: current ?? variable.current
    };
  }
  if (variable.type === "interval") {
    const raw = String(variable.query ?? "1m,5m,10m,30m,1h");
    let options = raw.split(",").map((v) => {
      const value = v.trim();
      return {
        text: value,
        value,
        selected: String(variable.current?.value) === value
      };
    });
    options = finalizeVariableOptions(variable, options);
    return { ...variable, options };
  }
  if (variable.type === "textbox") {
    const value = String(variable.current?.value ?? variable.query ?? "");
    return {
      ...variable,
      current: { text: value, value },
      options: [{ text: value, value, selected: true }]
    };
  }
  if (variable.type === "datasource") {
    return variable;
  }
  if (variable.type === "adhoc") {
    return variable;
  }
  if (variable.type === "groupby") {
    const ds2 = resolveDs(variable.datasource);
    if (!ds2?.getTagKeys) {
      return { ...variable, options: [] };
    }
    const keys = await ds2.getTagKeys({});
    const options = (keys ?? []).map((k) => ({
      text: k.text,
      value: k.value ?? k.text,
      selected: false
    }));
    return { ...variable, options };
  }
  if (typeof console !== "undefined") {
    console.warn(`[variables] unknown type: ${variable.type}`);
  }
  return { ...variable, options: variable.options ?? [] };
}
const VariableRefresh = {
  never: 0,
  onDashboardLoad: 1,
  onTimeRangeChanged: 2
};
function shouldRefreshVariable(variable, trigger) {
  if (trigger === "manual") return true;
  const raw = variable.refresh;
  const n = raw === "onTimeRangeChanged" ? 2 : raw === "onDashboardLoad" ? 1 : raw === "never" ? 0 : Number(raw ?? 0);
  const mode2 = Number.isFinite(n) ? n : 0;
  if (mode2 === VariableRefresh.never) return false;
  if (trigger === "time") return mode2 === VariableRefresh.onTimeRangeChanged;
  return mode2 === VariableRefresh.onDashboardLoad || mode2 === VariableRefresh.onTimeRangeChanged;
}
async function refreshAllVariables(variables, resolveDs, opts) {
  const trigger = opts?.trigger ?? "manual";
  const range = opts?.range;
  let layers;
  try {
    layers = variableRefreshLayers(variables);
  } catch (error) {
    console.warn(String(error));
    layers = [variables.map((v) => v.name)];
  }
  const byName = new Map(variables.map((v) => [v.name, { ...v }]));
  const outByName = /* @__PURE__ */ new Map();
  for (const layer of layers) {
    if (opts?.signal?.aborted) {
      throw new DOMException("Aborted", "AbortError");
    }
    const progressive = variables.map(
      (orig) => outByName.get(orig.name) ?? byName.get(orig.name) ?? orig
    );
    const scoped = buildScopedVars(progressive);
    const settled = await Promise.allSettled(
      layer.map(async (name) => {
        const v = byName.get(name);
        if (!v) return null;
        if (!shouldRefreshVariable(v, trigger)) {
          return v;
        }
        if (opts?.signal?.aborted) {
          throw new DOMException("Aborted", "AbortError");
        }
        return refreshVariableOptions(v, resolveDs, scoped, range);
      })
    );
    for (const result of settled) {
      if (result.status !== "fulfilled" || !result.value) {
        if (result.status === "rejected" && typeof console !== "undefined") {
          console.warn("[variables] layer refresh failed:", result.reason);
        }
        continue;
      }
      const refreshed = result.value;
      outByName.set(refreshed.name, refreshed);
      byName.set(refreshed.name, refreshed);
    }
  }
  return variables.map((v) => outByName.get(v.name) ?? byName.get(v.name) ?? v);
}
function collectAdhocFilters(variables) {
  const out = [];
  for (const v of variables) {
    if (v.type !== "adhoc") continue;
    const filters = v.filters;
    if (Array.isArray(filters)) {
      for (const f of filters) {
        if (f && f.key && f.value !== void 0 && f.value !== "") out.push(f);
      }
    }
  }
  return out;
}
function applyAdhocFiltersToExpr(expr, filters) {
  if (!expr || !filters.length) return expr;
  const matchers = filters.map((f) => {
    const op = f.operator || "=";
    const val = String(f.value).replaceAll("\\", "\\\\").replaceAll('"', '\\"');
    if (op === "=~" || op === "!~" || op === "!=" || op === "=") return `${f.key}${op}"${val}"`;
    return `${f.key}="${val}"`;
  }).join(",");
  const brace = expr.indexOf("{");
  if (brace >= 0) {
    const endBrace = expr.indexOf("}", brace);
    if (endBrace > brace) {
      const inside = expr.slice(brace + 1, endBrace).trim();
      const merged = inside ? `${inside},${matchers}` : matchers;
      return expr.slice(0, brace + 1) + merged + expr.slice(endBrace);
    }
  }
  const rangeMatch = expr.match(/([a-z_:][\w:]*)(\s*)\[/i);
  if (rangeMatch && rangeMatch.index != null) {
    const insertAt = rangeMatch.index + rangeMatch[1].length;
    return `${expr.slice(0, insertAt)}{${matchers}}${expr.slice(insertAt)}`;
  }
  const re = /([a-z_:][\w:]*)/gi;
  let best = null;
  let m;
  while (m = re.exec(expr)) {
    const after = expr.slice(m.index + m[1].length);
    if (/^\s*\(/.test(after)) continue;
    best = m;
  }
  if (best) {
    const at = best.index + best[1].length;
    return `${expr.slice(0, at)}{${matchers}}${expr.slice(at)}`;
  }
  return `${expr}{${matchers}}`;
}
function isRowPanel(panel2) {
  return panel2.type === "row";
}
function expandRepeats(panels2, repeatValues = {}) {
  const out = [];
  for (const panel2 of panels2) {
    const repeat = String(panel2.repeat ?? "");
    if (!repeat || !repeatValues[repeat]?.length) {
      out.push(panel2);
      continue;
    }
    const values = repeatValues[repeat];
    const direction = String(panel2.repeatDirection ?? "h");
    const maxPerRow = Number(panel2.maxPerRow ?? 4);
    values.forEach((value, index2) => {
      const base = panel2.gridPos ?? { x: 0, y: 0, w: 12, h: 8 };
      let gridPos = { ...base };
      if (direction === "v") {
        gridPos = { ...base, y: base.y + index2 * base.h, x: base.x };
      } else {
        const n = Math.max(1, values.length);
        const cols = Math.min(Math.max(1, maxPerRow), n);
        const col2 = index2 % cols;
        const row = Math.floor(index2 / cols);
        const w = Math.max(2, Math.floor(24 / cols));
        gridPos = {
          x: col2 * w,
          y: base.y + row * base.h,
          w,
          h: base.h
        };
      }
      const scopedVars = {
        ...panel2.scopedVars ?? {},
        [repeat]: { text: value, value }
      };
      if (index2 === 0) {
        out.push({
          ...panel2,
          gridPos,
          title: panel2.title ?? "Panel",
          ...{
            repeatValue: value,
            repeatVar: repeat,
            scopedVars
          }
        });
        return;
      }
      const clone2 = {
        ...panel2,
        // Stable synthetic id derived from origin (not persisted).
        id: panel2.id * 1e3 + index2,
        title: panel2.title ?? "Panel",
        gridPos,
        ...{
          repeat: void 0,
          // Grafana clears repeat on clones
          repeatValue: value,
          repeatVar: repeat,
          repeatPanelId: panel2.id,
          scopedVars
        }
      };
      out.push(clone2);
    });
  }
  return out;
}
function panelsToLayout(panels2, collapsedRowIds = /* @__PURE__ */ new Set()) {
  const items = [];
  let skipUntilY = null;
  for (const p of panels2 ?? []) {
    const g = p.gridPos ?? { x: 0, y: 0, w: 24, h: 1 };
    if (isRowPanel(p)) {
      items.push({
        i: `row-${p.id}`,
        x: 0,
        y: g.y,
        w: 24,
        h: 1,
        static: true,
        panelId: p.id,
        isRow: true
      });
      if (p.collapsed || collapsedRowIds.has(p.id)) {
        skipUntilY = nextRowY(panels2, p);
      } else {
        skipUntilY = null;
      }
      continue;
    }
    if (skipUntilY != null && g.y < skipUntilY) continue;
    items.push({
      i: String(p.id),
      x: g.x,
      y: g.y,
      w: g.w,
      h: g.h,
      panelId: p.id
    });
  }
  return items;
}
function nextRowY(panels2, row) {
  const y = row.gridPos?.y ?? 0;
  let next = Number.POSITIVE_INFINITY;
  for (const p of panels2) {
    if (!isRowPanel(p)) continue;
    const py = p.gridPos?.y ?? 0;
    if (py > y) next = Math.min(next, py);
  }
  return Number.isFinite(next) ? next : Number.POSITIVE_INFINITY;
}
function layoutToGridPos(item) {
  return { x: item.x, y: item.y, w: item.w, h: item.h };
}
function applyLayoutToPanels(panels2, layout) {
  const map = new Map(layout.filter((l) => !l.isRow).map((l) => [l.panelId, l]));
  return panels2.map((p) => {
    const l = map.get(p.id);
    if (!l) return p;
    return { ...p, gridPos: layoutToGridPos(l) };
  });
}
function collides(a, b) {
  return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
}
function findOpenPosition(panels2, size) {
  const occupied = panels2.filter((p) => !isRowPanel(p)).map((p) => p.gridPos ?? { x: 0, y: 0, w: 12, h: 8 });
  for (let y = 0; y < 1e3; y++) {
    for (let x = 0; x <= 24 - size.w; x++) {
      const candidate = { x, y, w: size.w, h: size.h };
      if (!occupied.some((o) => collides(candidate, o))) return candidate;
    }
  }
  return { x: 0, y: 0, w: size.w, h: size.h };
}
function buildShareUrl(opts) {
  const base = opts.appSubUrl ?? "";
  const path = opts.solo ? `${base}/d-solo/${opts.uid}${opts.slug ? `/${opts.slug}` : ""}` : `${base}/d/${opts.uid}${opts.slug ? `/${opts.slug}` : ""}`;
  const params = new URLSearchParams();
  if (opts.orgId) params.set("orgId", String(opts.orgId));
  if (opts.from) params.set("from", opts.from);
  if (opts.to) params.set("to", opts.to);
  if (opts.theme && opts.theme !== "current") params.set("theme", opts.theme);
  if (opts.panelId) params.set("viewPanel", String(opts.panelId));
  if (opts.kiosk === true) params.set("kiosk", "true");
  if (opts.kiosk === "tv") params.set("kiosk", "tv");
  if (opts.variables) {
    for (const [k, v] of Object.entries(opts.variables)) {
      if (Array.isArray(v)) v.forEach((item) => params.append(`var-${k}`, item));
      else params.set(`var-${k}`, v);
    }
  }
  const q = params.toString();
  return q ? `${path}?${q}` : path;
}
function buildEmbedHtml(opts) {
  const url = buildShareUrl({ ...opts, solo: true });
  const w = opts.width ?? 450;
  const h2 = opts.height ?? 200;
  return `<iframe src="${escapeAttr(url)}" width="${w}" height="${h2}" frameborder="0" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer"></iframe>`;
}
function escapeAttr(s) {
  return s.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;");
}
function buildSnapshotExport(dashboard, meta2 = {}) {
  return {
    dashboard,
    name: meta2.name ?? String(dashboard.title ?? "Snapshot"),
    expires: meta2.expires ?? 0,
    external: false,
    key: `snap-${Date.now().toString(36)}`
  };
}
function buildDashboardJsonExport(dashboard) {
  return JSON.stringify(
    {
      dashboard,
      meta: { type: "db", canSave: true, canEdit: true, canStar: false }
    },
    null,
    2
  );
}
function redactSecrets$1(value) {
  if (value == null) return value;
  if (typeof value === "string") {
    if (/bearer\s+[\w.-]+/i.test(value) || /api[_-]?key|password|secret|token/i.test(value)) {
      return "[redacted]";
    }
    return value;
  }
  if (Array.isArray(value)) return value.map(redactSecrets$1);
  if (typeof value === "object") {
    const out = {};
    for (const [k, v] of Object.entries(value)) {
      if (/password|secret|token|authorization|credential|api[_-]?key/i.test(k)) {
        out[k] = "[redacted]";
      } else {
        out[k] = redactSecrets$1(v);
      }
    }
    return out;
  }
  return value;
}
function buildInspectorSnapshot(panel2, data) {
  const frames = data?.series ?? [];
  const fieldTypes = {};
  for (const f of frames) {
    for (const field of f.fields) {
      fieldTypes[field.type] = (fieldTypes[field.type] ?? 0) + 1;
    }
  }
  const targets = panel2.targets ?? [];
  return {
    panelId: panel2.id,
    title: panel2.title,
    type: panel2.type,
    queryCount: targets.length,
    frameCount: frames.length,
    state: data?.state ?? "NotStarted",
    error: data?.error?.message,
    requestId: data?.request?.requestId,
    fieldNames: frames.flatMap((f) => f.fields.map((field) => field.name)),
    stats: {
      seriesCount: frames.length,
      rowCounts: frames.map((f) => f.length),
      fieldTypes
    },
    queries: targets.map((t2) => ({
      refId: t2.refId,
      datasource: redactSecrets$1(t2.datasource),
      hide: t2.hide
    })),
    rawOptions: redactSecrets$1(panel2.options ?? {}) ?? {},
    rawFieldConfig: redactSecrets$1(panel2.fieldConfig),
    requestSummary: {
      requestId: data?.request?.requestId,
      targetCount: targets.length,
      refIds: targets.map((t2) => String(t2.refId ?? "")),
      hasDatasourceUid: targets.some(
        (t2) => Boolean(t2?.datasource?.uid || t2?.datasource)
      )
    },
    transformSteps: data?.transformSteps,
    seriesBeforeTransformCount: data?.seriesBeforeTransform?.length
  };
}
async function runAnnotationQueries(queries, range, resolve) {
  const enabled = queries.filter((q) => q.enable !== false && !q.hide);
  const events = [];
  for (const q of enabled) {
    const ds2 = resolve(q.datasource);
    if (!ds2) continue;
    try {
      let frames = [];
      if (typeof ds2.annotationQuery === "function") {
        const res = await ds2.annotationQuery({
          range,
          annotation: q
        });
        frames = Array.isArray(res) ? res : res ? [res] : [];
      } else if (ds2.query) {
        const res = await ds2.query({
          requestId: `anno-${q.name}`,
          targets: [{ refId: "Anno", ...q.target ?? {}, datasource: q.datasource }],
          range
        });
        frames = res.data;
      }
      for (const frame of frames) {
        const time = frame.fields.find((f) => f.type === "time" || f.name.toLowerCase() === "time");
        const text = frame.fields.find(
          (f) => f.name.toLowerCase() === "text" || f.name.toLowerCase() === "title"
        );
        const tags = frame.fields.find((f) => f.name.toLowerCase() === "tags");
        if (!time) continue;
        for (let i = 0; i < time.values.length; i++) {
          const tagVal = tags?.values[i];
          events.push({
            time: Number(time.values[i]),
            title: String(text?.values[i] ?? q.name),
            text: text ? String(text.values[i] ?? "") : void 0,
            color: q.iconColor,
            tags: typeof tagVal === "string" ? tagVal.split(",") : [q.name]
          });
        }
      }
    } catch {
    }
  }
  return events.sort((a, b) => a.time - b.time);
}
function createPanelEditorState(panel2) {
  return {
    panel: JSON.parse(JSON.stringify(panel2)),
    tab: "query"
  };
}
function applyPanelTypeChange(panel2, type) {
  const plugin2 = getPanelPlugin(type);
  return {
    ...panel2,
    type,
    options: plugin2?.defaultOptions ? { ...plugin2.defaultOptions } : { ...panel2.options ?? {} }
  };
}
function collectDomStructureSeed(el) {
  const parts = [];
  const label = el.dataset.shotLabel;
  if (label) parts.push(`shot:${label}`);
  const scan = (node, depth) => {
    if (depth > 4) return;
    const tid = node.dataset.testid;
    if (tid) parts.push(`tid:${tid}`);
    for (const attr of Array.from(node.attributes)) {
      if (attr.name.startsWith("data-") && attr.name !== "data-testid" && attr.name !== "data-shot-label") {
        const v = attr.value.slice(0, 48);
        if (v) parts.push(`${attr.name}=${v}`);
      }
    }
    if (node.tagName.toLowerCase() === "svg") {
      const vb = node.getAttribute("viewBox");
      if (vb) parts.push(`vb:${vb}`);
    }
    if (node.tagName.toLowerCase() === "path") {
      const d = node.getAttribute("d");
      if (d) parts.push(`d:${d.slice(0, 96)}`);
      const sw = node.getAttribute("stroke-width");
      if (sw) parts.push(`sw:${sw}`);
    }
    const kids = Array.from(node.children).slice(0, 32);
    for (const c of kids) scan(c, depth + 1);
  };
  scan(el, 0);
  const textBits = (el.innerText || "").split(/\s+/).filter(Boolean).slice(0, 12).join(" ");
  if (textBits) parts.push(`txt:${textBits.slice(0, 80)}`);
  return parts.join("|");
}
function fnv1a(seed) {
  let h2 = 2166136261;
  for (let i = 0; i < seed.length; i++) {
    h2 ^= seed.charCodeAt(i);
    h2 = Math.imul(h2, 16777619);
  }
  return h2 >>> 0;
}
function structuralPixelBuffer(el, width2, height2, background = "var(--grafana-bg)") {
  const title = el.dataset.shotLabel || el.querySelector(".panel-chrome__title, h1, [data-testid]")?.textContent?.trim() || "panel";
  const structure = collectDomStructureSeed(el);
  const seed = `${background}|${title}|${el.dataset.testid || ""}|${width2}x${height2}|${structure}`;
  const pixels = new Uint8ClampedArray(width2 * height2 * 4);
  const bg = background.startsWith("#") ? background.slice(1) : "111217";
  const br = Number.parseInt(bg.slice(0, 2), 16) || 17;
  const bgG = Number.parseInt(bg.slice(2, 4), 16) || 18;
  const bb = Number.parseInt(bg.slice(4, 6), 16) || 23;
  for (let i = 0; i < pixels.length; i += 4) {
    pixels[i] = br;
    pixels[i + 1] = bgG;
    pixels[i + 2] = bb;
    pixels[i + 3] = 255;
  }
  const h0 = fnv1a(seed);
  const h1 = fnv1a(`${seed}#band1`);
  const h2 = fnv1a(structure.slice(0, 256));
  const bands = [
    { y0: 8, y1: Math.min(28, height2), hash: h0, r: 216, g: 217, b: 218 },
    { y0: 40, y1: Math.min(56, height2), hash: h1, r: 61, g: 113, b: 217 },
    {
      y0: Math.max(60, height2 - 40),
      y1: Math.max(70, height2 - 20),
      hash: h2,
      r: 115,
      g: 191,
      b: 105
    }
  ];
  for (const band of bands) {
    if (band.y0 >= height2) continue;
    for (let x = 0; x < width2; x++) {
      const on = (band.hash >>> x % 24 & 1) === 1 || (x + (band.hash & 15)) % 17 === 0 || (x * 3 + (band.hash & 31)) % 23 === 0;
      if (!on) continue;
      for (let y = band.y0; y < band.y1; y++) {
        const idx = (y * width2 + x) * 4;
        pixels[idx] = band.r;
        pixels[idx + 1] = band.g;
        pixels[idx + 2] = band.b;
        pixels[idx + 3] = 255;
      }
    }
  }
  const midY = Math.floor(height2 * 0.55);
  for (let x = 12; x < width2 - 12; x++) {
    const wave = (h2 >>> x % 16 & 7) - 3;
    const y = Math.max(0, Math.min(height2 - 1, midY + wave));
    const idx = (y * width2 + x) * 4;
    pixels[idx] = 230;
    pixels[idx + 1] = 180;
    pixels[idx + 2] = 60;
    pixels[idx + 3] = 255;
  }
  for (let x = 8; x < width2 - 8; x++) {
    for (const y of [36, height2 - 12]) {
      if (y < 0 || y >= height2) continue;
      const idx = (y * width2 + x) * 4;
      pixels[idx] = 44;
      pixels[idx + 1] = 50;
      pixels[idx + 2] = 53;
      pixels[idx + 3] = 255;
    }
  }
  return pixels;
}
function pixelsToDataUrl(pixels, width2, height2) {
  let sum = 0;
  for (let i = 0; i < pixels.length; i += 64) sum = (sum + pixels[i]) % 9973;
  return `data:image/png;base64,structural-${width2}x${height2}-${pixels.length}-${sum}`;
}
async function captureDomScreenshot(el, opts = {}) {
  const width2 = opts.width ?? Math.max(1, Math.floor(el.getBoundingClientRect().width) || 800);
  const height2 = opts.height ?? Math.max(1, Math.floor(el.getBoundingClientRect().height) || 400);
  const background = opts.background ?? "var(--grafana-bg)";
  if (!opts.preferStructural && typeof document !== "undefined") {
    try {
      const canvas = document.createElement("canvas");
      canvas.width = width2;
      canvas.height = height2;
      const ctx = canvas.getContext("2d");
      if (ctx && typeof ctx.drawImage === "function" && typeof ctx.getImageData === "function") {
        ctx.fillStyle = background;
        ctx.fillRect(0, 0, width2, height2);
        const svg = `
<svg xmlns="http://www.w3.org/2000/svg" width="${width2}" height="${height2}">
  <foreignObject width="100%" height="100%">
    <div xmlns="http://www.w3.org/1999/xhtml" style="width:${width2}px;height:${height2}px;background:${background};color:var(--grafana-text);font:12px sans-serif;overflow:hidden;">
      ${el.outerHTML.replaceAll("&", "&amp;").slice(0, 12e4)}
    </div>
  </foreignObject>
</svg>`;
        const blob = new Blob([svg], { type: "image/svg+xml;charset=utf-8" });
        const urlObj = URL.createObjectURL(blob);
        const img = await new Promise((resolve) => {
          const image = new Image();
          image.addEventListener("load", () => resolve(image));
          image.onerror = () => resolve(null);
          image.src = urlObj;
        });
        URL.revokeObjectURL(urlObj);
        if (img) {
          ctx.drawImage(img, 0, 0, width2, height2);
          const imageData = ctx.getImageData(0, 0, width2, height2);
          const pixels2 = new Uint8ClampedArray(imageData.data);
          let nonBg = 0;
          for (let i = 0; i < pixels2.length; i += 16) {
            if (Math.abs(pixels2[i] - 17) + Math.abs(pixels2[i + 1] - 18) + Math.abs(pixels2[i + 2] - 23) > 30)
              nonBg++;
          }
          if (nonBg > 8) {
            let dataUrl = "";
            try {
              dataUrl = canvas.toDataURL("image/png");
            } catch {
              dataUrl = pixelsToDataUrl(pixels2, width2, height2);
            }
            return {
              contentType: "image/png",
              url: dataUrl,
              bytes: Math.ceil(dataUrl.length * 3 / 4),
              pixels: pixels2,
              width: width2,
              height: height2
            };
          }
        }
      }
    } catch {
    }
  }
  const pixels = structuralPixelBuffer(el, width2, height2, background);
  const url = pixelsToDataUrl(pixels, width2, height2);
  return {
    contentType: "image/png",
    url,
    bytes: Math.ceil(url.length * 3 / 4),
    pixels,
    width: width2,
    height: height2
  };
}
class DashboardHistory {
  undoStack = [];
  redoStack = [];
  limit;
  checkpointEvery;
  pushesSinceCheckpoint = 0;
  constructor(limit = 50, checkpointEvery = 5) {
    this.limit = limit;
    this.checkpointEvery = Math.max(1, checkpointEvery);
  }
  push(doc, rev = 0) {
    const json = JSON.stringify(doc);
    const last = this.undoStack[this.undoStack.length - 1];
    if (last?.json === json) return;
    this.pushesSinceCheckpoint += 1;
    const checkpoint = this.undoStack.length === 0 || this.pushesSinceCheckpoint >= this.checkpointEvery;
    if (checkpoint) this.pushesSinceCheckpoint = 0;
    this.undoStack.push({ json, rev, checkpoint });
    if (this.undoStack.length > this.limit) this.undoStack.shift();
    this.redoStack = [];
  }
  canUndo() {
    return this.undoStack.length > 1;
  }
  canRedo() {
    return this.redoStack.length > 0;
  }
  /** Latest tip revision (for dirty tracking after undo/redo). */
  tipRev() {
    return this.undoStack[this.undoStack.length - 1]?.rev ?? 0;
  }
  undo(current) {
    if (!this.canUndo()) return null;
    const curJson = JSON.stringify(current);
    const curRev = this.tipRev();
    this.redoStack.push({ json: curJson, rev: curRev, checkpoint: false });
    this.undoStack.pop();
    const prev = this.undoStack[this.undoStack.length - 1];
    if (!prev) return null;
    return { doc: JSON.parse(prev.json), rev: prev.rev };
  }
  redo(current) {
    if (!this.canRedo()) return null;
    const curJson = JSON.stringify(current);
    this.undoStack.push({
      json: curJson,
      rev: this.tipRev(),
      checkpoint: false
    });
    const next = this.redoStack.pop();
    if (!next) return null;
    this.undoStack.push(next);
    return { doc: JSON.parse(next.json), rev: next.rev };
  }
  reset(doc, rev = 0) {
    this.undoStack = [{ json: JSON.stringify(doc), rev, checkpoint: true }];
    this.redoStack = [];
    this.pushesSinceCheckpoint = 0;
  }
  /** Test/debug: count of full checkpoint tips retained. */
  checkpointCount() {
    return this.undoStack.filter((t2) => t2.checkpoint).length;
  }
}
function buildSceneGraph(doc, time) {
  const root = {
    uid: `dashboard:${doc.uid ?? doc.title ?? "root"}`,
    kind: "dashboard",
    title: doc.title,
    children: [],
    state: {
      editable: doc.editable !== false,
      tags: doc.tags ?? [],
      timezone: doc.timezone
    }
  };
  root.children.push({
    uid: "timeRange",
    kind: "timeRange",
    title: "Time range",
    children: [],
    state: { from: time?.from ?? doc.time?.from, to: time?.to ?? doc.time?.to }
  });
  for (const v of doc.templating?.list ?? []) {
    root.children.push(variableNode(v));
  }
  let currentRow = null;
  for (const panel2 of doc.panels ?? []) {
    if (panel2.type === "row") {
      currentRow = {
        uid: `row:${panel2.id}`,
        kind: "row",
        title: panel2.title,
        panelId: panel2.id,
        children: [],
        state: { collapsed: !!panel2.collapsed, repeat: panel2.repeat }
      };
      root.children.push(currentRow);
      const nested = Array.isArray(panel2.panels) ? panel2.panels : [];
      for (const child of nested) {
        currentRow.children.push(panelNode(child));
      }
      continue;
    }
    const node = panelNode(panel2);
    if (currentRow && !panel2.gridPos) {
      currentRow.children.push(node);
    } else {
      root.children.push(node);
    }
  }
  return root;
}
function variableNode(v) {
  return {
    uid: `var:${v.name}`,
    kind: "variable",
    title: v.label || v.name,
    children: [],
    state: {
      type: v.type,
      current: v.current,
      multi: v.multi,
      includeAll: v.includeAll
    }
  };
}
function panelNode(panel2) {
  return {
    uid: `panel:${panel2.id}`,
    kind: "panel",
    title: panel2.title,
    panelId: panel2.id,
    children: (panel2.targets ?? []).map((t2, i) => ({
      uid: `query:${panel2.id}:${t2.refId ?? i}`,
      kind: "query",
      title: String(t2.refId ?? i),
      children: [],
      state: { datasource: t2.datasource, hide: t2.hide }
    })),
    state: {
      type: panel2.type,
      gridPos: panel2.gridPos,
      transparent: panel2.transparent,
      repeat: panel2.repeat
    }
  };
}
let clipboard = null;
function copyPanel(panel2) {
  clipboard = JSON.parse(JSON.stringify(panel2));
}
function hasClipboardPanel() {
  return clipboard != null;
}
function pastePanel(nextId2, gridPos) {
  if (!clipboard) return null;
  const panel2 = JSON.parse(JSON.stringify(clipboard));
  panel2.id = nextId2;
  panel2.title = panel2.title ? `${panel2.title} copy` : `Panel ${nextId2}`;
  if (panel2.gridPos)
    panel2.gridPos = {
      ...panel2.gridPos,
      y: (panel2.gridPos.y ?? 0) + (panel2.gridPos.h ?? 8)
    };
  return panel2;
}
function duplicatePanel(panel2, nextId2) {
  copyPanel(panel2);
  return pastePanel(nextId2) ?? { ...panel2, id: nextId2 };
}
const store$1 = /* @__PURE__ */ new Map();
function saveLibraryPanel(panel2, name, uid) {
  const id = uid || panel2?.libraryPanel?.uid || `lib-${Date.now().toString(36)}`;
  const entryName = name || panel2?.libraryPanel?.name || panel2.title || id;
  const entry = {
    uid: id,
    name: entryName,
    version: (store$1.get(id)?.version ?? 0) + 1,
    model: JSON.parse(
      JSON.stringify({ ...panel2, libraryPanel: { uid: id, name: entryName } })
    )
  };
  delete entry.model.id;
  delete entry.model.isNew;
  store$1.set(id, entry);
  return entry;
}
function listLibraryPanels() {
  return [...store$1.values()];
}
function instantiateLibraryPanel(uid, id) {
  const lib = store$1.get(uid);
  if (!lib) return void 0;
  return {
    ...JSON.parse(JSON.stringify(lib.model)),
    id,
    libraryPanel: { uid: lib.uid, name: lib.name }
  };
}
function updateLibraryPanelFromInstance(panel2) {
  const ref2 = panel2?.libraryPanel;
  if (!ref2?.uid) return null;
  return saveLibraryPanel(panel2, ref2.name || panel2.title || ref2.uid, ref2.uid);
}
function applyLibraryModelToInstance(instance, lib) {
  const model = JSON.parse(JSON.stringify(lib.model));
  return {
    ...model,
    id: instance.id,
    gridPos: instance.gridPos,
    libraryPanel: { uid: lib.uid, name: lib.name }
  };
}
function syncLibraryPanelInstances(panels2, source) {
  const ref2 = source?.libraryPanel;
  if (!ref2?.uid) return panels2;
  const lib = updateLibraryPanelFromInstance(source);
  if (!lib) return panels2;
  return panels2.map((p) => {
    if (p.id === source.id) {
      return {
        ...source,
        libraryPanel: { uid: lib.uid, name: lib.name }
      };
    }
    const pRef = p?.libraryPanel;
    if (pRef?.uid === lib.uid) {
      return applyLibraryModelToInstance(p, lib);
    }
    return p;
  });
}
function unlinkLibraryPanel(panel2) {
  const next = JSON.parse(JSON.stringify(panel2));
  delete next.libraryPanel;
  return next;
}
const STORAGE_KEY = "grafana-vue-imported-dashboards";
function readAll() {
  if (typeof localStorage === "undefined") return {};
  try {
    return JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}");
  } catch {
    return {};
  }
}
function writeAll(map) {
  if (typeof localStorage === "undefined") return;
  localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
}
function saveImportedDashboard(raw, opts) {
  const uid = String(raw.uid || `import-${Date.now().toString(36)}`);
  const title = String(raw.title || "Imported dashboard");
  const overwrite = opts?.overwrite !== false;
  const all = readAll();
  if (!overwrite && all[uid]) {
    const err = new Error(`DASHBOARD_UID_EXISTS: ${uid}`);
    err.code = "DASHBOARD_UID_EXISTS";
    throw err;
  }
  const normalized = { ...raw, uid, title };
  const rec = {
    uid,
    title,
    raw: normalized,
    original: opts?.original ? JSON.parse(JSON.stringify(opts.original)) : void 0,
    pendingSave: opts?.pendingSave ? true : void 0,
    savedAt: (/* @__PURE__ */ new Date()).toISOString()
  };
  all[uid] = rec;
  writeAll(all);
  return rec;
}
function isImportedDashboardPendingSave(uid) {
  return readAll()[uid]?.pendingSave === true;
}
function clearImportedDashboardPendingSave(uid) {
  const all = readAll();
  const rec = all[uid];
  if (!rec?.pendingSave) return;
  delete rec.pendingSave;
  writeAll(all);
}
function getImportedDashboard(uid) {
  return readAll()[uid]?.raw;
}
function listImportedDashboards() {
  return Object.values(readAll()).sort((a, b) => b.savedAt.localeCompare(a.savedAt));
}
function collectDatasourceRefPaths(dashboard) {
  const paths = /* @__PURE__ */ new Set();
  const seen = /* @__PURE__ */ new WeakSet();
  function walk(cur, path) {
    if (cur == null || typeof cur !== "object") return;
    if (seen.has(cur)) return;
    seen.add(cur);
    if (Array.isArray(cur)) {
      cur.forEach((item, i) => walk(item, [...path, String(i)]));
      return;
    }
    const obj = cur;
    for (const [key, val] of Object.entries(obj)) {
      const nextPath = [...path, key];
      if (key === "datasource") {
        paths.add(nextPath.join("/"));
      }
      walk(val, nextPath);
    }
  }
  walk(dashboard, []);
  return [...paths];
}
function extractInputsFromDashboard(dashboard) {
  if (Array.isArray(dashboard.__inputs))
    return dashboard.__inputs;
  return [];
}
function applyDatasourceMappings(dashboard, mappings, typeByUid = {}) {
  let next = JSON.parse(JSON.stringify(dashboard));
  const paths = collectDatasourceRefPaths(next);
  for (const path of paths) {
    const val = getAtPath(next, path);
    if (val == null) continue;
    if (typeof val === "string") {
      const key = val.replaceAll(/^\$\{|\}$/g, "");
      if (mappings[val] || mappings[key] || mappings[`\${${key}}`]) {
        const uid = mappings[val] || mappings[key] || mappings[`\${${key}}`];
        next = setAtPath(next, path, {
          type: typeByUid[uid] ?? "datasource",
          uid
        });
      }
      continue;
    }
    if (typeof val === "object") {
      const uid = val.uid;
      if (typeof uid === "string" && (uid.startsWith("${") || mappings[uid])) {
        const key = uid.replaceAll(/^\$\{|\}$/g, "");
        const mapped = mappings[uid] || mappings[key] || mappings[`\${${key}}`];
        if (mapped) {
          next = setAtPath(next, path, {
            type: typeByUid[mapped] ?? val.type ?? "datasource",
            uid: mapped
          });
        }
      }
    }
  }
  for (const [name, value] of Object.entries(mappings)) {
    if (!name.startsWith("constant:") && !name.startsWith("VAR_")) continue;
    const varName = name.replace(/^constant:/, "").replace(/^VAR_/, "");
    const list = next.templating?.list ?? [];
    const idx = list.findIndex((v) => v.name === varName);
    if (idx >= 0) {
      next = setAtPath(next, `templating/list/${idx}/current`, {
        value,
        text: String(value)
      });
      next = setAtPath(next, `templating/list/${idx}/query`, value);
    }
  }
  return next;
}
function buildImportPreview(dashboard, mappings, typeByUid = {}) {
  const applied = applyDatasourceMappings(dashboard, mappings, typeByUid);
  const unresolved = [];
  for (const path of collectDatasourceRefPaths(applied)) {
    const val = getAtPath(applied, path);
    const uid = typeof val === "string" ? val : val?.uid;
    if (typeof uid === "string" && (uid.includes("${") || uid.startsWith("$"))) {
      unresolved.push(path);
    }
  }
  return { dashboard: applied, unresolved };
}
function offsetToLineColumn(text, offset) {
  if (offset < 0 || !Number.isFinite(offset)) {
    return { line: 1, column: 1 };
  }
  let line = 1;
  let column = 1;
  const max = Math.min(offset, text.length);
  for (let i = 0; i < max; i++) {
    if (text.charCodeAt(i) === 10) {
      line += 1;
      column = 1;
    } else {
      column += 1;
    }
  }
  return { line, column };
}
function parseJsonWithPosition(text) {
  try {
    return { ok: true, value: JSON.parse(text) };
  } catch (error) {
    const message2 = error instanceof Error ? error.message : String(error);
    const match = /position (\d+)/i.exec(message2);
    const offset = Number(match?.[1] ?? -1);
    const { line, column } = offsetToLineColumn(text, offset);
    return { ok: false, message: message2, offset, line, column };
  }
}
async function parseImportJsonText(text) {
  return parseJsonWithPosition(text);
}
function createImportWizardState() {
  return {
    step: "upload",
    rawText: "",
    title: "",
    uid: "",
    overwrite: true,
    mappings: {},
    typeByUid: {},
    inputs: [],
    mode: "local-preview"
  };
}
function parseWizardPayload(state2, text) {
  try {
    const parsed = JSON.parse(text);
    const envelope = parseDashboardDocument(parsed);
    const inputs = extractInputsFromDashboard(envelope.dashboard) ?? envelope.inputs ?? [];
    const rawDocument = envelope.original && typeof envelope.original === "object" ? JSON.parse(JSON.stringify(envelope.original)) : JSON.parse(JSON.stringify(parsed));
    return {
      ...state2,
      rawText: text,
      envelope,
      rawDocument,
      title: String(envelope.dashboard.title ?? "Imported"),
      uid: String(envelope.dashboard.uid ?? `import-${Date.now().toString(36)}`),
      inputs,
      error: void 0,
      parseLine: void 0,
      parseColumn: void 0,
      step: "options",
      preview: void 0
    };
  } catch (error) {
    return {
      ...state2,
      rawText: text,
      error: error instanceof Error ? error.message : String(error),
      step: "upload"
    };
  }
}
async function parseWizardPayloadAsync(state2, text) {
  const result = await parseImportJsonText(text);
  if (!result.ok) {
    return {
      ...state2,
      rawText: text,
      error: `${result.message} (行 ${result.line}, 列 ${result.column})`,
      parseLine: result.line,
      parseColumn: result.column,
      step: "upload",
      envelope: void 0,
      preview: void 0
    };
  }
  try {
    const envelope = parseDashboardDocument(result.value);
    const inputs = extractInputsFromDashboard(envelope.dashboard) ?? envelope.inputs ?? [];
    const rawDocument = envelope.original && typeof envelope.original === "object" ? JSON.parse(JSON.stringify(envelope.original)) : JSON.parse(JSON.stringify(result.value));
    return {
      ...state2,
      rawText: text,
      envelope,
      rawDocument,
      title: String(envelope.dashboard.title ?? "Imported"),
      uid: String(envelope.dashboard.uid ?? `import-${Date.now().toString(36)}`),
      inputs,
      error: void 0,
      parseLine: void 0,
      parseColumn: void 0,
      step: "options",
      preview: void 0
    };
  } catch (error) {
    return {
      ...state2,
      rawText: text,
      error: error instanceof Error ? error.message : String(error),
      step: "upload"
    };
  }
}
function refreshImportPreview(state2) {
  if (!state2.envelope) return state2;
  const preview = buildImportPreview(
    state2.envelope.dashboard,
    state2.mappings,
    state2.typeByUid
  );
  return { ...state2, preview };
}
function commitImport(state2) {
  if (!state2.envelope) throw new Error("No dashboard loaded");
  const preview = state2.preview ?? buildImportPreview(state2.envelope.dashboard, state2.mappings, state2.typeByUid);
  if (preview.unresolved.length > 0) {
    const err = new Error(
      `DATASOURCE_REQUIRED: unresolved datasource refs: ${preview.unresolved.join(", ")}`
    );
    err.code = "DATASOURCE_REQUIRED";
    throw err;
  }
  let dash = JSON.parse(JSON.stringify(preview.dashboard));
  dash.title = state2.title;
  dash.uid = state2.uid;
  if (Object.keys(state2.mappings).length) {
    dash = applyDatasourceMappings(dash, state2.mappings, state2.typeByUid);
  }
  const rec = saveImportedDashboard(dash, {
    overwrite: state2.overwrite,
    original: state2.rawDocument ?? state2.envelope.original,
    // Freshly imported: user has not saved it yet, so Save must stay enabled.
    pendingSave: true
  });
  return { uid: rec.uid, title: rec.title, raw: rec.raw };
}
function dsToken(type, used) {
  const base = `DS_${type.replaceAll(/[^a-z0-9]+/gi, "_").toUpperCase()}`;
  const n = used.get(base) ?? 0;
  used.set(base, n + 1);
  return n === 0 ? base : `${base}_${n + 1}`;
}
function walkDatasourceRefs(obj, visit) {
  if (!obj || typeof obj !== "object") return;
  if (Array.isArray(obj)) {
    obj.forEach((v) => walkDatasourceRefs(v, visit));
    return;
  }
  for (const [k, v] of Object.entries(obj)) {
    if (k === "datasource" && v && typeof v === "object") visit(obj, k, v);
    else walkDatasourceRefs(v, visit);
  }
}
function exportDashboard(envelope, options) {
  const dash = JSON.parse(JSON.stringify(envelope.dashboard ?? envelope));
  if (options.mode === "backup") {
    delete dash.__inputs;
    delete dash.__requires;
    return dash;
  }
  const dsList = options.datasources ?? [];
  const byUid2 = new Map(dsList.map((d) => [d.uid, d]));
  const used = /* @__PURE__ */ new Map();
  const inputs = [];
  const requires = /* @__PURE__ */ new Map();
  const uidToToken = /* @__PURE__ */ new Map();
  walkDatasourceRefs(dash, (_parent, _key, ref2) => {
    const uid = ref2.uid;
    if (!uid || uid.startsWith("${")) return;
    if (!uidToToken.has(uid)) {
      const ds2 = byUid2.get(uid);
      const type = ds2?.type ?? ref2.type ?? "datasource";
      const token2 = dsToken(String(type), used);
      uidToToken.set(uid, token2);
      inputs.push({
        name: token2,
        type: "datasource",
        pluginId: type,
        pluginName: ds2?.name ?? type
      });
      requires.set(`datasource:${type}`, {
        type: "datasource",
        id: type,
        name: ds2?.name ?? type,
        version: ds2?.pluginVersion ?? "1.0.0"
      });
    }
    const token = uidToToken.get(uid);
    ref2.uid = `\${${token}}`;
  });
  for (const v of dash.templating?.list ?? []) {
    if (v.type === "constant") {
      inputs.push({
        name: `VAR_${String(v.name).toUpperCase()}`,
        type: "constant",
        label: v.label ?? v.name,
        value: v.current?.value ?? v.query ?? ""
      });
    }
  }
  for (const p of dash.panels ?? []) {
    requires.set(`panel:${p.type}`, {
      type: "panel",
      id: p.type,
      name: p.type,
      version: "1.0.0"
    });
  }
  return {
    ...dash,
    __inputs: inputs,
    __requires: [...requires.values()]
  };
}
function clonePanel$1(panel2) {
  return JSON.parse(JSON.stringify(panel2));
}
function panelJson(panel2) {
  return JSON.stringify(panel2);
}
function createPanelEditSession(opts) {
  const options = opts && typeof opts === "object" && "panel" in opts ? opts : { panel: opts };
  const workingPanel = options.panel;
  const originalPanelSnapshot = clonePanel$1(workingPanel);
  const savedBaselineJson = panelJson(originalPanelSnapshot);
  const session = {
    panelId: workingPanel.id,
    pathId: options.pathId,
    isNewPanel: Boolean(options.isNewPanel),
    isLibraryPanel: Boolean(options.isLibraryPanel),
    originalPanelSnapshot,
    originalLayoutSnapshot: workingPanel.gridPos ? { ...workingPanel.gridPos } : void 0,
    workingPanel,
    originalData: options.originalData,
    phase: "editing",
    tableView: false,
    lastResult: void 0,
    pluginError: null,
    savedBaselineJson,
    mutationRevision: 0,
    savedRevision: 0,
    touch() {
      this.mutationRevision += 1;
    },
    get isDirty() {
      return this.mutationRevision !== this.savedRevision;
    }
  };
  return session;
}
function backToDashboard(session) {
  if (session.phase !== "editing") {
    throw new Error("session not editing");
  }
  session.phase = "closed";
  return { session, retainWorkingChanges: true, commitHistoryBatch: true };
}
function discard(session) {
  if (session.phase !== "editing") {
    throw new Error("session not editing");
  }
  if (session.isNewPanel) {
    session.phase = "closed";
    return { kind: "delete-new", session, panelId: session.panelId };
  }
  const restored = clonePanel$1(session.originalPanelSnapshot);
  Object.keys(session.workingPanel).forEach((k) => {
    delete session.workingPanel[k];
  });
  Object.assign(session.workingPanel, restored);
  session.savedBaselineJson = panelJson(session.workingPanel);
  session.mutationRevision = 0;
  session.savedRevision = 0;
  session.phase = "closed";
  return { kind: "restore-existing", session, panel: session.workingPanel };
}
function dashboardSaved(session) {
  if (session.phase !== "editing") {
    throw new Error("session not editing");
  }
  session.savedBaselineJson = panelJson(session.workingPanel);
  session.originalPanelSnapshot = clonePanel$1(session.workingPanel);
  session.savedRevision = session.mutationRevision;
  return session;
}
function openPanelEditSession(panel2, opts = {}) {
  return createPanelEditSession({
    panel: panel2,
    isNewPanel: opts.isNewPanel ?? Boolean(panel2.isNew),
    isLibraryPanel: opts.isLibraryPanel ?? Boolean(panel2.libraryPanel),
    pathId: opts.pathId
  });
}
function exitBack(session, workingPanel) {
  Object.assign(session.workingPanel, workingPanel);
  const result = backToDashboard(session);
  delete session.workingPanel.isNew;
  return {
    kind: "back",
    session: result.session,
    panel: session.workingPanel,
    commitHistory: result.commitHistoryBatch
  };
}
function exitDiscard(session) {
  const result = discard(session);
  if (result.kind === "delete-new") {
    return {
      kind: "discard-delete",
      session: result.session,
      panelId: result.panelId
    };
  }
  return {
    kind: "discard-restore",
    session: result.session,
    panel: result.panel
  };
}
function saveDashboardWhileEditing(session, workingPanel) {
  Object.assign(session.workingPanel, workingPanel);
  return dashboardSaved(session);
}
function exclusiveEditViewQuery(base, opts) {
  const next = { ...base };
  delete next.editPanel;
  delete next.viewPanel;
  delete next.edit;
  delete next.view;
  if (opts.mode === "edit") next.editPanel = String(opts.panelId);
  if (opts.mode === "view") next.viewPanel = String(opts.panelId);
  return next;
}
function canEncodeF64(values) {
  for (const v of values) {
    if (v == null) continue;
    if (typeof v !== "number") return false;
  }
  return true;
}
function packFramesForTransfer(frames) {
  const transfer = [];
  const wire = (frames ?? []).map((frame) => {
    const fields = (frame.fields ?? []).map((f) => {
      const values = f.values ?? [];
      const type = f.type;
      const numericLike = (type === "number" || type === "time") && canEncodeF64(values);
      if (numericLike) {
        const f64 = new Float64Array(values.length);
        const nulls = new Uint8Array(values.length);
        for (const [i, v] of values.entries()) {
          if (v == null) {
            nulls[i] = 1;
            f64[i] = 0;
          } else {
            nulls[i] = 0;
            f64[i] = v;
          }
        }
        transfer.push(f64.buffer, nulls.buffer);
        return {
          name: f.name,
          type,
          config: f.config ? { ...f.config } : {},
          labels: f.labels ? { ...f.labels } : void 0,
          encoding: "f64",
          f64,
          nulls
        };
      }
      return {
        name: f.name,
        type,
        config: f.config ? { ...f.config } : {},
        labels: f.labels ? { ...f.labels } : void 0,
        encoding: "clone",
        values: values.slice()
      };
    });
    const len = frame.length ?? fields[0]?.f64?.length ?? fields[0]?.values?.length ?? 0;
    return {
      refId: frame.refId,
      name: frame.name,
      meta: frame.meta ? { ...frame.meta } : void 0,
      length: len,
      fields
    };
  });
  return { frames: wire, transfer };
}
function unpackWireFrames(frames) {
  return (frames ?? []).map((frame) => {
    const fields = (frame.fields ?? []).map((f) => {
      if (f.encoding === "f64" && f.f64) {
        const n = f.f64.length;
        const values = new Array(n);
        const nulls = f.nulls;
        for (let i = 0; i < n; i++) {
          values[i] = nulls && nulls[i] ? null : f.f64[i];
        }
        return {
          name: f.name,
          type: f.type,
          config: f.config ?? {},
          values,
          labels: f.labels
        };
      }
      return {
        name: f.name,
        type: f.type,
        config: f.config ?? {},
        values: f.values ?? [],
        labels: f.labels
      };
    });
    return {
      refId: frame.refId,
      name: frame.name,
      meta: frame.meta,
      fields,
      length: frame.length ?? fields.reduce((m, field) => Math.max(m, field.values.length), 0)
    };
  });
}
let workerEnabled = true;
let worker = null;
let workerFailed = false;
let nextId = 1;
let activeGeneration = 0;
const pending$1 = /* @__PURE__ */ new Map();
function isPanelPipelineWorkerEnabled() {
  return workerEnabled && !workerFailed;
}
function setPanelPipelineWorkerEnabled(enabled) {
  workerEnabled = enabled;
  if (!enabled) {
    disposePanelPipelineWorker();
  }
}
function bumpPipelineWorkerGeneration() {
  activeGeneration += 1;
  for (const [id, slot] of pending$1) {
    pending$1.delete(id);
    try {
      slot.reject(new DOMException("Aborted", "AbortError"));
    } catch {
    }
  }
  return activeGeneration;
}
function getPipelineWorkerGeneration() {
  return activeGeneration;
}
function pendingPipelineWorkerCount() {
  return pending$1.size;
}
function disposePanelPipelineWorker() {
  for (const [, p] of pending$1) {
    try {
      p.reject(new DOMException("Disposed", "AbortError"));
    } catch {
    }
  }
  pending$1.clear();
  if (worker) {
    try {
      worker.terminate();
    } catch {
    }
  }
  worker = null;
}
function onWorkerMessage(ev) {
  const msg = ev.data;
  const p = pending$1.get(msg?.id);
  if (!p) return;
  if (msg.generation != null && p.generation != null && msg.generation !== p.generation) {
    pending$1.delete(msg.id);
    p.reject(new DOMException("Aborted", "AbortError"));
    return;
  }
  pending$1.delete(msg.id);
  if (msg.ok && msg.frames) {
    p.resolve({ series: unpackWireFrames(msg.frames), via: "worker" });
  } else if (msg.aborted) {
    p.reject(new DOMException("Aborted", "AbortError"));
  } else {
    p.reject(new Error(msg.error || "pipeline worker failed"));
  }
}
function onWorkerError() {
  workerFailed = true;
  const err = new Error("pipeline worker crashed");
  for (const [id, p] of pending$1) {
    pending$1.delete(id);
    p.reject(err);
  }
  try {
    worker?.terminate();
  } catch {
  }
  worker = null;
}
function ensureWorker() {
  if (!workerEnabled || workerFailed) return null;
  if (typeof Worker === "undefined") return null;
  if (worker) return worker;
  try {
    worker = new Worker(new URL(
      /* @vite-ignore */
      "" + new URL("assets/panelPipelineWorker-Dj5aM1Pj.js", import.meta.url).href,
      import.meta.url
    ), {
      type: "module"
    });
    worker.addEventListener("message", onWorkerMessage);
    worker.addEventListener("error", onWorkerError);
    worker.addEventListener("messageerror", onWorkerError);
    return worker;
  } catch {
    workerFailed = true;
    return null;
  }
}
function runPipelineOnMainThread(req) {
  const compiled = getCompiledPipeline({
    transformations: req.transformations ?? [],
    fieldConfigDefaults: req.fieldConfigDefaults ?? {},
    fieldConfigOverrides: req.fieldConfigOverrides ?? []
  });
  return runCompiledPipeline(req.series ?? [], compiled, { withTrace: false }).frames;
}
async function runPipelineChunkedMainThread(req, signal) {
  if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
  const steps = req.transformations ?? [];
  if (steps.length <= 1) {
    await new Promise((r) => setTimeout(r, 0));
    if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
    return runPipelineOnMainThread(req);
  }
  await new Promise((r) => setTimeout(r, 0));
  if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
  const series = runPipelineOnMainThread(req);
  await new Promise((r) => setTimeout(r, 0));
  if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
  return series;
}
async function runPanelPipelineInWorker(req, signal) {
  if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
  const w = ensureWorker();
  if (!w) {
    const series = await runPipelineChunkedMainThread(req, signal);
    return { series, via: "main-fallback" };
  }
  const id = nextId++;
  const generation = req.generation ?? activeGeneration;
  const { frames, transfer } = packFramesForTransfer(req.series ?? []);
  try {
    const result = await new Promise((resolve, reject) => {
      const onAbort = () => {
        pending$1.delete(id);
        try {
          w.postMessage({ type: "cancel", id });
        } catch {
        }
        reject(new DOMException("Aborted", "AbortError"));
      };
      if (signal) {
        if (signal.aborted) {
          onAbort();
          return;
        }
        signal.addEventListener("abort", onAbort, { once: true });
      }
      pending$1.set(id, {
        generation,
        resolve: (r) => {
          signal?.removeEventListener("abort", onAbort);
          resolve(r);
        },
        reject: (e) => {
          signal?.removeEventListener("abort", onAbort);
          reject(e);
        }
      });
      try {
        w.postMessage(
          {
            type: "run",
            id,
            generation,
            frames,
            transformations: req.transformations,
            fieldConfigDefaults: req.fieldConfigDefaults,
            fieldConfigOverrides: req.fieldConfigOverrides,
            requestId: req.requestId
          },
          transfer
        );
      } catch {
        pending$1.delete(id);
        signal?.removeEventListener("abort", onAbort);
        void runPipelineChunkedMainThread(req, signal).then(
          (series) => resolve({ series, via: "main-fallback" }),
          reject
        );
      }
    });
    return result;
  } catch (error) {
    if (error instanceof DOMException && error.name === "AbortError") throw error;
    if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
    const series = await runPipelineChunkedMainThread(req, signal);
    return { series, via: "main-fallback" };
  }
}
function __resetPanelPipelineWorkerClientForTests() {
  disposePanelPipelineWorker();
  workerEnabled = true;
  workerFailed = false;
  nextId = 1;
  activeGeneration = 0;
}
function __forceWorkerFailedForTests() {
  workerFailed = true;
  try {
    worker?.terminate();
  } catch {
  }
  worker = null;
}
const panelPipelineWorkerClient = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  __forceWorkerFailedForTests,
  __resetPanelPipelineWorkerClientForTests,
  bumpPipelineWorkerGeneration,
  disposePanelPipelineWorker,
  getPipelineWorkerGeneration,
  isPanelPipelineWorkerEnabled,
  pendingPipelineWorkerCount,
  runPanelPipelineInWorker,
  runPipelineChunkedMainThread,
  runPipelineOnMainThread,
  setPanelPipelineWorkerEnabled
}, Symbol.toStringTag, { value: "Module" }));
function isNoOpPipeline(input) {
  const transforms = input.transformations ?? [];
  if (transforms.length > 0) return false;
  const overrides = input.fieldConfigOverrides ?? [];
  if (overrides.length > 0) return false;
  const defaults2 = input.fieldConfigDefaults;
  if (!defaults2) return true;
  return Object.keys(defaults2).length === 0;
}
function toPanelData(input, series) {
  return {
    state: input.state ?? LoadingStateEnum.Done,
    series,
    timeRange: input.timeRange,
    requestId: input.requestId,
    annotations: input.annotations,
    errors: input.errors,
    error: input.error
  };
}
function runMainSync(input) {
  const workerDecision = shouldUsePipelineWorker({
    frames: input.series,
    enabled: isPanelPipelineWorkerEnabled()
  });
  const source = input.series ?? [];
  if (!input.withTrace && isNoOpPipeline(input)) {
    return {
      series: source,
      transformTrace: [],
      diagnostics: [],
      panelData: toPanelData(input, source),
      workerDecision,
      reusedInputSeries: true,
      executionPath: "main-sync"
    };
  }
  const withTrace = input.withTrace === true;
  const prepared = preparePanelData({
    frames: source,
    transformations: input.transformations ?? [],
    fieldConfig: {
      defaults: input.fieldConfigDefaults ?? {},
      overrides: input.fieldConfigOverrides ?? []
    },
    replaceVariables: (value) => value,
    signal: input.signal
  });
  if (withTrace) {
    const pipeline = applyTransformationsWithTrace(source, input.transformations ?? []);
    return {
      series: prepared.frames,
      transformTrace: pipeline.steps,
      diagnostics: pipeline.diagnostics,
      panelData: toPanelData(input, prepared.frames),
      workerDecision,
      reusedInputSeries: false,
      executionPath: "main-sync",
      configRevision: prepared.revision
    };
  }
  return {
    series: prepared.frames,
    transformTrace: [],
    diagnostics: [],
    panelData: toPanelData(input, prepared.frames),
    workerDecision,
    reusedInputSeries: false,
    executionPath: "main-sync",
    configRevision: prepared.revision
  };
}
function runPanelDataPipeline(input) {
  return runMainSync(input);
}
const DATASOURCE_IDS = [
  "dashboard",
  "mixed",
  "grafana",
  "grafana-testdata-datasource",
  "grafana-postgresql-datasource",
  "mysql",
  "mssql",
  "influxdb",
  "graphite",
  "prometheus",
  "loki",
  "jaeger",
  "tempo",
  "grafana-pyroscope-datasource",
  "cloudwatch",
  "grafana-azure-monitor-datasource",
  "alertmanager",
  "opentelemetry",
  "alexanderzobnin-zabbix-datasource",
  "signoz"
];
const caps = (partial) => ({
  query: true,
  health: true,
  metadata: false,
  variables: false,
  annotations: false,
  exemplars: false,
  streaming: false,
  queryLanguages: [],
  ...partial
});
const HEAVY_ZABBIX = "alexanderzobnin-zabbix-datasource";
const HEAVY_SIGNOZ = "signoz";
const CATALOG = [
  {
    id: "dashboard",
    name: "仪表盘",
    category: "core",
    icon: "gf-grid",
    capabilities: caps({
      signals: ["metrics"],
      health: false,
      queryLanguages: ["dashboard"]
    })
  },
  {
    id: "mixed",
    name: "混合",
    category: "core",
    icon: "gf-glue",
    capabilities: caps({
      signals: ["metrics", "logs", "traces"],
      health: false,
      queryLanguages: ["mixed"]
    })
  },
  {
    id: "grafana",
    name: "Grafana",
    category: "core",
    icon: "grafana",
    capabilities: caps({
      signals: ["metrics"],
      queryLanguages: ["grafana"]
    })
  },
  {
    id: "grafana-testdata-datasource",
    name: "测试数据",
    category: "core",
    icon: "database",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      queryLanguages: ["testdata"]
    })
  },
  {
    id: "grafana-postgresql-datasource",
    name: "PostgreSQL",
    category: "sql",
    icon: "postgres",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["sql"]
    })
  },
  {
    id: "mysql",
    name: "MySQL",
    category: "sql",
    icon: "mysql",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["sql"]
    })
  },
  {
    id: "mssql",
    name: "Microsoft SQL Server",
    category: "sql",
    icon: "mssql",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["sql"]
    })
  },
  {
    id: "influxdb",
    name: "InfluxDB",
    category: "metrics",
    icon: "influxdb",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["influxql", "flux"]
    })
  },
  {
    id: "graphite",
    name: "Graphite",
    category: "metrics",
    icon: "graphite",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["graphite"]
    })
  },
  {
    id: "prometheus",
    name: "Prometheus",
    category: "metrics",
    icon: "prometheus",
    capabilities: caps({
      signals: ["metrics"],
      variables: true,
      annotations: true,
      metadata: true,
      exemplars: true,
      queryLanguages: ["promql"]
    })
  },
  {
    id: "loki",
    name: "Loki",
    category: "logs",
    icon: "loki",
    capabilities: caps({
      signals: ["logs"],
      variables: true,
      annotations: true,
      metadata: true,
      streaming: true,
      queryLanguages: ["logql"]
    })
  },
  {
    id: "jaeger",
    name: "Jaeger",
    category: "traces",
    icon: "jaeger",
    capabilities: caps({
      signals: ["traces"],
      metadata: true,
      queryLanguages: ["jaeger"]
    })
  },
  {
    id: "tempo",
    name: "Tempo",
    category: "traces",
    icon: "tempo",
    capabilities: caps({
      signals: ["traces"],
      metadata: true,
      queryLanguages: ["traceql"]
    })
  },
  {
    id: "grafana-pyroscope-datasource",
    name: "Pyroscope",
    category: "metrics",
    icon: "pyroscope",
    capabilities: caps({
      signals: ["metrics"],
      metadata: true,
      queryLanguages: ["pyroscope"]
    })
  },
  {
    id: "cloudwatch",
    name: "CloudWatch",
    category: "cloud",
    icon: "cloudwatch",
    capabilities: caps({
      signals: ["metrics", "logs"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["cloudwatch"]
    })
  },
  {
    id: "grafana-azure-monitor-datasource",
    name: "Azure Monitor",
    category: "cloud",
    icon: "azure",
    capabilities: caps({
      signals: ["metrics", "logs", "traces"],
      variables: true,
      annotations: true,
      metadata: true,
      queryLanguages: ["azure-monitor"]
    })
  },
  {
    id: "alertmanager",
    name: "Alertmanager",
    category: "core",
    icon: "bell",
    capabilities: caps({
      signals: ["metrics"],
      query: false,
      health: true,
      queryLanguages: []
    })
  },
  {
    id: "opentelemetry",
    name: "OpenTelemetry",
    category: "observability",
    icon: "opentelemetry",
    capabilities: caps({
      signals: ["metrics", "logs", "traces"],
      metadata: true,
      variables: true,
      queryLanguages: ["promql", "logql", "traceql"]
    })
  },
  {
    id: HEAVY_ZABBIX,
    name: "Zabbix",
    category: "observability",
    icon: "zabbix",
    capabilities: caps({
      signals: ["metrics"],
      metadata: true,
      variables: true,
      annotations: true,
      queryLanguages: ["zabbix-json-rpc"]
    }),
    lazy: async () => {
      const { registerZabbixPlugin: registerZabbixPlugin2 } = await Promise.resolve().then(() => register$1);
      await registerZabbixPlugin2();
    }
  },
  {
    id: HEAVY_SIGNOZ,
    name: "SigNoz",
    category: "observability",
    icon: "signoz",
    capabilities: caps({
      signals: ["metrics", "logs", "traces"],
      metadata: true,
      variables: true,
      annotations: true,
      streaming: true,
      queryLanguages: ["promql", "clickhouse", "trace"]
    }),
    lazy: async () => {
      const { registerSigNozPlugin: registerSigNozPlugin2 } = await Promise.resolve().then(() => register);
      await registerSigNozPlugin2();
    }
  }
];
const byId = new Map(CATALOG.map((e) => [e.id, e]));
const VISIBLE_CATALOG_IDS = /* @__PURE__ */ new Set([HEAVY_ZABBIX, HEAVY_SIGNOZ]);
function listBuiltinDatasourceCatalog() {
  return CATALOG.filter((e) => VISIBLE_CATALOG_IDS.has(e.id));
}
function getBuiltinDatasourceCatalogEntry(id) {
  return byId.get(id);
}
async function ensureDatasourceCatalogEntryRegistered(id) {
  const entry = getBuiltinDatasourceCatalogEntry(id);
  if (!entry) {
    throw new DataSourceError("NOT_FOUND", `未知数据源类型: ${id}`);
  }
  if (getDataSourcePlugin(id)) return;
  await entry.lazy?.();
  if (!getDataSourcePlugin(id)) {
    throw new Error(`数据源注册失败: ${id}`);
  }
}
function catalogCoversDatasourceIds() {
  const ids = CATALOG.map((x) => x.id).sort();
  const expected = [...DATASOURCE_IDS].sort();
  return ids.length === expected.length && ids.every((id, i) => id === expected[i]);
}
function buildDurationLiteralWithSameLength(len) {
  const L = Math.max(0, Math.floor(len));
  if (L <= 1) return "1".repeat(L);
  return `${"1".repeat(L - 1)}s`;
}
function sanitizePromqlForLezer(expr) {
  const s = String(expr ?? "");
  let out = "";
  let i = 0;
  let inString = false;
  while (i < s.length) {
    const ch = s[i];
    if (inString) {
      out += ch;
      if (ch === "\\" && i + 1 < s.length) {
        out += s[i + 1];
        i += 2;
        continue;
      }
      if (ch === '"') inString = false;
      i++;
      continue;
    }
    if (ch === '"') {
      inString = true;
      out += ch;
      i++;
      continue;
    }
    if (ch === "[") {
      const start = i;
      i++;
      let inner = "";
      while (i < s.length && s[i] !== "]") {
        inner += s[i];
        i++;
      }
      if (i < s.length && s[i] === "]") {
        const replacedInner = inner.replaceAll(
          /\$__\w+|\$\{__\w+\}|\[\[__\w+\]\]/g,
          (m) => buildDurationLiteralWithSameLength(m.length)
        );
        out += `[${replacedInner}]`;
        i++;
        continue;
      }
      out += s.slice(start);
      break;
    }
    out += ch;
    i++;
  }
  return out.replaceAll(
    /\boffset\s+\$__\w+/g,
    (m) => m.replace(/\$__\w+/, (v) => buildDurationLiteralWithSameLength(v.length))
  );
}
function collectLezerErrors(tree) {
  const out = [];
  const cursor = tree.cursor();
  do {
    if (cursor.type.isError) {
      out.push({
        severity: "error",
        message: "PromQL 语法错误（parser 发现无法解析的片段）",
        range: { from: cursor.from, to: cursor.to }
      });
    }
  } while (cursor.next());
  out.sort((a, b) => (a.range?.from ?? 0) - (b.range?.from ?? 0));
  const merged = [];
  for (const d of out) {
    const last = merged[merged.length - 1];
    if (last?.range && d.range && d.range.from <= last.range.to) {
      last.range = {
        from: last.range.from,
        to: Math.max(last.range.to, d.range.to)
      };
      continue;
    }
    merged.push(d);
  }
  return merged;
}
function parsePromqlToAst(expr) {
  const raw = String(expr ?? "");
  if (!raw.trim()) {
    return { ok: true, ast: parser.parse(""), diagnostics: [] };
  }
  const text = sanitizePromqlForLezer(raw);
  const ast = parser.parse(text);
  const diagnostics = collectLezerErrors(ast);
  const ok2 = diagnostics.every((d) => d.severity !== "error");
  return ok2 ? { ok: true, ast, diagnostics } : { ok: false, ast, diagnostics };
}
function isValidPromql(expr) {
  return parsePromqlToAst(expr).ok;
}
function alertmanagerFixture(query, _range) {
  return createDataFrame({
    refId: query.refId,
    name: "alerts",
    fields: [
      { name: "alertname", type: "string", values: ["HighCPU", "DiskFull"] },
      { name: "state", type: "string", values: ["firing", "pending"] },
      { name: "severity", type: "string", values: ["critical", "warning"] }
    ]
  });
}
function pyroscopeFixture(query, range) {
  const q = query;
  const profileTypeId = String(q.profileTypeId || q.profileType || "process_cpu:cpu:nanoseconds");
  const labelSelector = String(q.labelSelector || q.expr || "{}");
  const maxNodes = Math.max(1, Math.min(64, Number(q.maxNodes ?? 16) || 16));
  const groupBy = Array.isArray(q.groupBy) ? q.groupBy.map(String) : String(q.groupBy || "").split(",").map((s) => s.trim()).filter(Boolean);
  const queryType = String(q.queryType || "profile");
  const allLabels = ["root", "main", "parse", "query", "scan", "agg", "render", "gc"];
  const n = Math.min(allLabels.length, maxNodes);
  const labels = allLabels.slice(0, n);
  const typeFactor = /memory/i.test(profileTypeId) ? 2.5 : /goroutine/i.test(profileTypeId) ? 0.4 : 1;
  const seed = labelSelector.split("").reduce((a, c) => a + c.charCodeAt(0), 0);
  const self = labels.map(
    (_, i) => i === 0 ? 0 : Math.round((5 + (i * 7 + seed) % 20) * typeFactor)
  );
  const value = labels.map((_, i) => Math.round((100 - i * 10 + seed % 5) * typeFactor));
  const level = labels.map((_, i) => i === 0 ? 0 : 1 + (i - 1) % 3);
  if (queryType === "metrics") {
    return timeSeries$1(
      query,
      range,
      `${profileTypeId}|${groupBy.join(",") || "total"}`,
      (i) => (20 + i % 8 * 3 + seed % 7) * typeFactor,
      {
        labels: {
          profileTypeId,
          labelSelector,
          ...groupBy[0] ? { [groupBy[0]]: "a" } : {}
        },
        meta: {
          preferredVisualisationType: "graph",
          custom: { queryType, profileTypeId, maxNodes, groupBy }
        }
      }
    );
  }
  return createDataFrame({
    refId: query.refId,
    name: profileTypeId,
    fields: [
      { name: "label", type: "string", values: labels },
      { name: "level", type: "number", values: level },
      { name: "value", type: "number", values: value },
      { name: "self", type: "number", values: self }
    ],
    meta: {
      preferredVisualisationType: "flamegraph",
      custom: { queryType, profileTypeId, labelSelector, maxNodes, groupBy }
    }
  });
}
function graphiteFixture(query, range, alias) {
  const q = query;
  const target = String(q.target || q.query || alias || "stats.counters");
  const fns = Array.isArray(q.functions) ? q.functions : [];
  const peeled = [];
  let seriesPath = target;
  const re = /^([a-z_][\w.]*)\((.*)\)$/i;
  for (let depth = 0; depth < 8; depth++) {
    const m = seriesPath.trim().match(re);
    if (!m) break;
    peeled.unshift(m[1]);
    const inner = m[2];
    let level = 0;
    let split = -1;
    for (let i = 0; i < inner.length; i++) {
      const c = inner[i];
      if (c === "(") level++;
      else if (c === ")") level--;
      else if (c === "," && level === 0) {
        split = i;
        break;
      }
    }
    seriesPath = (split >= 0 ? inner.slice(0, split) : inner).trim();
  }
  const fnNames = [...fns.map((f) => String(f?.name || "").trim()).filter(Boolean), ...peeled];
  let scale = 1;
  let offset = 0;
  let moving = false;
  let abs = false;
  for (const name of fnNames) {
    const n = name.toLowerCase();
    if (n === "scale") {
      const p0 = fns.find((f) => String(f?.name || "").toLowerCase() === "scale");
      const raw = p0?.params != null ? String(p0.params).split(",")[0] : "";
      const v = Number(raw);
      scale *= Number.isFinite(v) && v !== 0 ? v : 2;
    } else if (n === "offset") {
      const p0 = fns.find((f) => String(f?.name || "").toLowerCase() === "offset");
      const raw = p0?.params != null ? String(p0.params).split(",")[0] : "";
      const v = Number(raw);
      offset += Number.isFinite(v) ? v : 10;
    } else if (n === "movingaverage") {
      moving = true;
    } else if (n === "absolute") {
      abs = true;
    } else if (n === "derivative" || n === "nonnegativederivative") {
      scale *= 0.1;
    }
  }
  const display = String(q.alias || "").trim() || (fnNames.length ? `${fnNames.join("→")}(${seriesPath})` : seriesPath);
  return timeSeries$1(
    query,
    range,
    display,
    (i) => {
      let v = i % 15 + Math.sin(i / 3) * 2;
      if (moving) v = (v + (i + 1) % 15 + (i + 2) % 15) / 3;
      v = v * scale + offset;
      if (abs) v = Math.abs(v);
      return v;
    },
    {
      labels: { target: seriesPath, functions: fnNames.join(",") || "none" },
      meta: {
        custom: {
          target: seriesPath,
          functions: fnNames,
          textEditor: q.textEditor !== false
        }
      }
    }
  );
}
function jaegerFixture(query, _range) {
  const q = query;
  const queryType = String(q.queryType || (q.query ? "traceID" : "search"));
  if (queryType === "dependencyGraph") {
    return createDataFrame({
      refId: query.refId,
      name: "dependencyGraph",
      meta: {
        preferredVisualisationType: "nodeGraph",
        custom: { queryType: "dependencyGraph" }
      },
      fields: [
        { name: "id", type: "string", values: ["frontend", "api", "db"] },
        { name: "title", type: "string", values: ["frontend", "api", "db"] },
        { name: "mainstat", type: "number", values: [3, 5, 2] }
      ]
    });
  }
  const service = String(q.service || "").trim();
  const operation = String(q.operation || "").trim();
  const limit = Math.min(50, Math.max(1, Number(q.limit ?? 8) || 8));
  const minDurMs = parsePeriodMs(q.minDuration);
  const maxDurMs = parsePeriodMs(q.maxDuration);
  const all = Array.from({ length: 12 }, (_, i) => {
    const durationMs = i === 0 ? 100 : 20 + i * 5;
    return {
      spanID: `span-${i}`,
      parentSpanID: i === 0 ? null : "span-0",
      operationName: i === 0 ? "HTTP GET" : `op-${i}`,
      serviceName: `svc-${i % 3}`,
      startTimeUnixNano: 1e15 + i * 1e7,
      durationNano: durationMs * 1e6,
      statusCode: i === 5 ? "ERROR" : "OK"
    };
  });
  let rows = all;
  if (service)
    rows = rows.filter((r) => r.serviceName === service || r.serviceName.includes(service));
  if (operation)
    rows = rows.filter((r) => r.operationName === operation || r.operationName.includes(operation));
  if (minDurMs != null) rows = rows.filter((r) => r.durationNano / 1e6 >= minDurMs);
  if (maxDurMs != null) rows = rows.filter((r) => r.durationNano / 1e6 <= maxDurMs);
  rows = rows.slice(0, limit);
  if (!rows.length) {
    rows = [
      {
        spanID: "span-empty",
        parentSpanID: null,
        operationName: operation || "none",
        serviceName: service || "none",
        startTimeUnixNano: 1e15,
        durationNano: 1e6,
        statusCode: "OK"
      }
    ];
  }
  return createDataFrame({
    refId: query.refId,
    name: "trace",
    fields: [
      { name: "spanID", type: "string", values: rows.map((r) => r.spanID) },
      {
        name: "parentSpanID",
        type: "string",
        values: rows.map((r) => r.parentSpanID)
      },
      {
        name: "operationName",
        type: "string",
        values: rows.map((r) => r.operationName)
      },
      {
        name: "serviceName",
        type: "string",
        values: rows.map((r) => r.serviceName)
      },
      {
        name: "startTimeUnixNano",
        type: "number",
        values: rows.map((r) => r.startTimeUnixNano)
      },
      {
        name: "durationNano",
        type: "number",
        values: rows.map((r) => r.durationNano)
      },
      {
        name: "statusCode",
        type: "string",
        values: rows.map((r) => r.statusCode)
      }
    ],
    meta: {
      preferredVisualisationType: "trace",
      custom: {
        queryType,
        service: service || null,
        operation: operation || null,
        limit,
        minDuration: q.minDuration ?? null,
        maxDuration: q.maxDuration ?? null
      }
    }
  });
}
function tempoFixture(query, _range) {
  const n = 8;
  const spanIDs = Array.from({ length: n }, (_, i) => `span-${i}`);
  return createDataFrame({
    refId: query.refId,
    name: "trace",
    fields: [
      { name: "spanID", type: "string", values: spanIDs },
      {
        name: "parentSpanID",
        type: "string",
        values: Array.from({ length: n }, (_, i) => i === 0 ? null : "span-0")
      },
      {
        name: "operationName",
        type: "string",
        values: Array.from({ length: n }, (_, i) => i === 0 ? "HTTP GET" : `op-${i}`)
      },
      {
        name: "serviceName",
        type: "string",
        values: Array.from({ length: n }, (_, i) => `svc-${i % 3}`)
      },
      {
        name: "startTimeUnixNano",
        type: "number",
        values: Array.from({ length: n }, (_, i) => 1e15 + i * 1e7)
      },
      {
        name: "durationNano",
        type: "number",
        values: Array.from({ length: n }, (_, i) => i === 0 ? 1e8 : 2e7 + i * 1e6)
      },
      {
        name: "statusCode",
        type: "string",
        values: Array.from({ length: n }, (_, i) => i === 5 ? "ERROR" : "OK")
      }
    ],
    meta: { preferredVisualisationType: "trace" }
  });
}
function lokiFixture(query, _range, from, expr, scenario) {
  const lines = Math.min(50, Number(query.maxLines ?? 30));
  return createDataFrame({
    refId: query.refId,
    name: "logs",
    fields: [
      {
        name: "Time",
        type: "time",
        values: Array.from({ length: lines }, (_, i) => from + i * 1e3)
      },
      {
        name: "Line",
        type: "string",
        values: Array.from({ length: lines }, (_, i) => {
          const level = i % 7 === 0 ? "error" : i % 5 === 0 ? "warn" : "info";
          return `${level} log line ${i} ${expr || scenario}`;
        })
      },
      {
        name: "level",
        type: "string",
        values: Array.from(
          { length: lines },
          (_, i) => i % 7 === 0 ? "error" : i % 5 === 0 ? "warn" : "info"
        )
      },
      {
        name: "labels",
        type: "other",
        values: Array.from({ length: lines }, () => ({ job: "varlogs" }))
      }
    ],
    meta: { preferredVisualisationType: "logs" }
  });
}
function influxdbFixture(query, range) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const q = query;
  const measurement = String(q.measurement || "cpu");
  const policy = String(q.policy || "default");
  const resultFormat = String(q.resultFormat || "time_series").toLowerCase();
  const seriesName2 = String(q.alias || "").trim() || `${policy}.${measurement}`;
  const periodMs = parsePeriodMs(q.interval || q.minInterval);
  if (resultFormat === "table") {
    const n = 8;
    return createDataFrame({
      refId: query.refId,
      name: seriesName2,
      meta: {
        preferredVisualisationType: "table",
        custom: { resultFormat, measurement, policy }
      },
      fields: [
        {
          name: "time",
          type: "time",
          values: Array.from(
            { length: n },
            (_, i) => from + (to - from) * i / Math.max(n - 1, 1)
          )
        },
        {
          name: measurement,
          type: "number",
          values: Array.from({ length: n }, (_, i) => Math.cos(i / 4) * 30 + 40)
        },
        {
          name: "policy",
          type: "string",
          values: Array.from({ length: n }, () => policy)
        }
      ]
    });
  }
  return timeSeries$1(query, range, seriesName2, (i) => Math.cos(i / 4) * 30 + 40, {
    periodMs,
    labels: { measurement, policy },
    meta: { custom: { resultFormat: "time_series", measurement, policy } }
  });
}
function cloudwatchFixture(query, range) {
  const from = range.from.getTime();
  const q = query;
  const queryMode = String(q.queryMode || q.mode || "Metrics");
  if (/logs/i.test(queryMode)) {
    const groups = Array.isArray(q.logGroups) ? q.logGroups : Array.isArray(q.logGroupNames) ? q.logGroupNames : q.logGroupNames ? [q.logGroupNames] : ["/aws/lambda/demo"];
    const n = Math.min(40, Number(q.limit ?? 20) || 20);
    const g0 = String(groups[0] ?? "/aws/lambda/demo");
    return createDataFrame({
      refId: query.refId,
      name: "cloudwatch-logs",
      meta: {
        preferredVisualisationType: "logs",
        custom: {
          queryMode: "Logs",
          logGroups: groups,
          region: q.region || "default"
        }
      },
      fields: [
        {
          name: "Time",
          type: "time",
          values: Array.from({ length: n }, (_, i) => from + i * 1e3)
        },
        {
          name: "Line",
          type: "string",
          values: Array.from(
            { length: n },
            (_, i) => `cw log ${i} group=${g0} ${String(q.expression || q.query || "")}`.trim()
          )
        }
      ]
    });
  }
  const metricQueryType = String(q.metricQueryType || "Search");
  if (/sql|insights/i.test(metricQueryType) || q.metricEditorMode === "code" && q.sql) {
    const sql = q.sql && typeof q.sql === "object" ? q.sql : {};
    const schema = String(q.schemaLabels || sql.select || q.namespace || "AWS/EC2");
    const filter2 = String(q.sqlFilter || sql.where || "");
    const groupBy = String(q.sqlGroupBy || sql.groupBy || "");
    const orderBy = String(q.sqlOrderBy || sql.orderBy || "");
    const limit = Math.min(100, Math.max(1, Number(q.sqlLimit ?? sql.limit ?? 10) || 10));
    const periodMsSql = parsePeriodMs(q.period) ?? 6e4;
    const display2 = String(q.label || q.alias || `cw-sql:${schema}`).trim();
    return timeSeries$1(
      query,
      range,
      display2,
      (i) => 12 + i % 7 * 3 + filter2.length * 0.1 + groupBy.length * 0.05,
      {
        periodMs: periodMsSql,
        labels: {
          metricQueryType: "SQL",
          schema,
          ...filter2 ? { filter: filter2 } : {},
          ...groupBy ? { groupBy } : {},
          ...q.accountId ? { accountId: String(q.accountId) } : {},
          region: String(q.region || "default")
        },
        meta: {
          custom: {
            metricQueryType: "SQL",
            schema,
            filter: filter2,
            groupBy,
            orderBy,
            limit,
            accountId: q.accountId ?? null
          }
        }
      }
    );
  }
  if (q.anomalyDetectionARN) {
    const arn = String(q.anomalyDetectionARN);
    const periodMsAd = parsePeriodMs(q.period) ?? 6e4;
    return timeSeries$1(
      query,
      range,
      String(q.label || q.alias || "anomaly"),
      (i) => 50 + Math.sin(i / 2) * 5,
      {
        periodMs: periodMsAd,
        labels: {
          anomalyDetectionARN: arn,
          suppressionState: String(q.suppressionState || "NONE")
        },
        meta: {
          preferredVisualisationType: "graph",
          custom: {
            anomalyDetectionARN: arn,
            suppressionState: q.suppressionState || "NONE"
          }
        }
      }
    );
  }
  const metricName = String(q.metricName || "CPUUtilization");
  const namespace = String(q.namespace || "AWS/EC2");
  const statistic = String(q.statistic || q.statistics?.[0] || "Average");
  const region = String(q.region || "default");
  const periodMs = parsePeriodMs(q.period) ?? 6e4;
  const dimsRaw = q.dimensions;
  const dimLabels = {};
  if (dimsRaw && typeof dimsRaw === "object" && !Array.isArray(dimsRaw)) {
    for (const [k, v] of Object.entries(dimsRaw)) {
      if (v == null) continue;
      dimLabels[String(k)] = Array.isArray(v) ? String(v[0]) : String(v);
    }
  }
  const matchExact = q.matchExact !== false;
  const statFactor = /sum/i.test(statistic) ? 3 : /max|p99|maximum/i.test(statistic) ? 2 : /min|minimum/i.test(statistic) ? 0.5 : 1;
  const display = String(q.label || "").trim() || `${metricName}_${statistic}`;
  return timeSeries$1(query, range, display, (i) => (20 + i % 10 * 5) * statFactor, {
    periodMs,
    labels: {
      metricName,
      namespace,
      statistic,
      region,
      ...q.accountId ? { accountId: String(q.accountId) } : {},
      ...dimLabels,
      ...!matchExact ? { matchExact: "false" } : {}
    },
    meta: {
      custom: {
        period: q.period ?? periodMs / 1e3,
        matchExact,
        namespace,
        statistic,
        region,
        metricName,
        accountId: q.accountId ?? null,
        metricQueryType: q.metricQueryType ?? "Search",
        metricEditorMode: q.metricEditorMode ?? null,
        dimensions: dimLabels,
        anomalyDetectionARN: q.anomalyDetectionARN ?? null
      }
    }
  });
}
function azureMonitorFixture(query, range) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const q = query;
  const queryType = String(q.queryType || "Azure Monitor");
  const am = q.azureMonitor || {};
  const la = q.azureLogAnalytics || {};
  const ai = q.azureAppInsights || {};
  const arg = q.azureResourceGraph || {};
  if (/log\s*analytics/i.test(queryType)) {
    const workspace = String(la.workspace || q.workspace || "default-workspace");
    const resultFormat = String(la.resultFormat || q.resultFormat || "logs");
    const n = 20;
    const isTable = /table/i.test(resultFormat);
    return createDataFrame({
      refId: query.refId,
      name: String(la.legendFormat || q.legendFormat || "azure-logs"),
      meta: {
        preferredVisualisationType: isTable ? "table" : "logs",
        custom: {
          queryType: "Azure Log Analytics",
          workspace,
          resultFormat,
          timeColumn: String(la.timeColumn || q.timeColumn || "TimeGenerated")
        }
      },
      fields: isTable ? [
        {
          name: String(la.timeColumn || "TimeGenerated"),
          type: "time",
          values: Array.from({ length: n }, (_, i) => from + i * 2e3)
        },
        {
          name: "Count",
          type: "number",
          values: Array.from({ length: n }, (_, i) => 3 + i % 5)
        },
        {
          name: "Computer",
          type: "string",
          values: Array.from({ length: n }, (_, i) => `host-${i % 3}`)
        }
      ] : [
        {
          name: "Time",
          type: "time",
          values: Array.from({ length: n }, (_, i) => from + i * 2e3)
        },
        {
          name: "Line",
          type: "string",
          values: Array.from({ length: n }, (_, i) => `azure log ${i} ws=${workspace}`)
        }
      ]
    });
  }
  if (/application\s*insights/i.test(queryType)) {
    const appId = String(ai.appInsightsAppId || ai.appId || "app-demo");
    const aiQt = String(ai.queryType || "metrics");
    if (/trace|log/i.test(aiQt)) {
      return createDataFrame({
        refId: query.refId,
        name: "app-insights-traces",
        meta: {
          preferredVisualisationType: "logs",
          custom: {
            queryType: "Application Insights",
            appId,
            aiQueryType: aiQt
          }
        },
        fields: [
          {
            name: "Time",
            type: "time",
            values: Array.from({ length: 12 }, (_, i) => from + i * 1500)
          },
          {
            name: "Line",
            type: "string",
            values: Array.from({ length: 12 }, (_, i) => `ai ${aiQt} ${i} app=${appId}`)
          }
        ]
      });
    }
    return timeSeries$1(query, range, String(ai.legendFormat || `ai:${appId}`), (i) => 8 + i * 0.5, {
      labels: { appId, queryType: "Application Insights" },
      meta: {
        custom: {
          queryType: "Application Insights",
          appId,
          aiQueryType: aiQt
        }
      }
    });
  }
  if (/resource\s*graph/i.test(queryType)) {
    const resultFormat = String(arg.resultFormat || "table");
    return createDataFrame({
      refId: query.refId,
      name: "resource-graph",
      meta: {
        preferredVisualisationType: "table",
        custom: { queryType: "Azure Resource Graph", resultFormat }
      },
      fields: [
        { name: "name", type: "string", values: ["vm-1", "vm-2", "nic-1"] },
        {
          name: "type",
          type: "string",
          values: [
            "microsoft.compute/virtualmachines",
            "microsoft.compute/virtualmachines",
            "microsoft.network/networkinterfaces"
          ]
        },
        {
          name: "location",
          type: "string",
          values: ["eastus", "westus", "eastus"]
        }
      ]
    });
  }
  const metricName = String(am.metricName || q.metricName || "Percentage CPU");
  const metricNamespace = String(
    am.metricNamespace || q.metricNamespace || "Microsoft.Compute/virtualMachines"
  );
  const aggregation = String(am.aggregation || q.aggregation || "Average");
  const timeGrain = String(am.timeGrain || q.timeGrain || "auto");
  const region = String(am.region || q.region || "eastus");
  const dimension = String(am.dimension || q.dimension || "");
  const top = Math.min(50, Math.max(1, Number(am.top ?? q.top ?? 10) || 10));
  const periodMs = parsePeriodMs(timeGrain === "auto" ? void 0 : timeGrain) ?? 6e4;
  const aggFactor = /sum|total|count/i.test(aggregation) ? 3 : /max/i.test(aggregation) ? 2 : /min/i.test(aggregation) ? 0.5 : 1;
  const legend = String(am.legendFormat || q.legendFormat || "").trim();
  const display = legend || `${metricName}_${aggregation}`;
  if (top > 1 && dimension) {
    const steps = Math.min(60, Math.max(10, Math.floor((to - from) / periodMs) + 1));
    const times = Array.from(
      { length: steps },
      (_, i) => from + (to - from) * i / Math.max(steps - 1, 1)
    );
    const fields = [{ name: "Time", type: "time", values: times }];
    const nSeries = Math.min(top, 5);
    for (let s = 0; s < nSeries; s++) {
      fields.push({
        name: "Value",
        type: "number",
        values: Array.from({ length: steps }, (_, i) => (5 + i + s * 3) * aggFactor),
        labels: {
          metricName,
          aggregation,
          region,
          [dimension]: `dim-${s}`
        },
        config: { displayNameFromDS: `${display}/${dimension}=dim-${s}` }
      });
    }
    return createDataFrame({
      refId: query.refId,
      name: display,
      meta: {
        preferredVisualisationType: "graph",
        custom: {
          queryType: "Azure Monitor",
          metricName,
          metricNamespace,
          aggregation,
          timeGrain,
          region,
          dimension,
          top
        }
      },
      fields
    });
  }
  return timeSeries$1(query, range, display, (i) => (5 + i) * aggFactor, {
    periodMs,
    labels: {
      metricName,
      metricNamespace,
      aggregation,
      region,
      ...dimension ? { dimension } : {}
    },
    meta: {
      custom: {
        queryType: "Azure Monitor",
        metricName,
        metricNamespace,
        aggregation,
        timeGrain,
        region,
        dimension,
        top,
        subscription: String(q.subscription || am.subscription || ""),
        resourceGroup: String(am.resourceGroup || q.resourceGroup || ""),
        resourceName: String(am.resourceName || q.resourceName || "")
      }
    }
  });
}
function opentelemetryFixture(query, range) {
  const from = range.from.getTime();
  const q = query;
  const signal = String(q.signal || "metrics").toLowerCase();
  const provider2 = String(q.provider || "");
  const service = String(q.service || "").trim();
  const operation = String(q.operation || "").trim();
  const legend = String(q.legendFormat || "").trim();
  const maxLines = Math.min(200, Math.max(1, Number(q.maxLines ?? q.limit ?? 40) || 40));
  const minDur = parsePeriodMs(q.minDuration);
  const maxDur = parsePeriodMs(q.maxDuration);
  const metric = String(q.metric || q.expr || q.query || "http.server.duration");
  if (signal === "logs") {
    const n = maxLines;
    return createDataFrame({
      refId: query.refId,
      name: legend || "otel-logs",
      meta: {
        preferredVisualisationType: "logs",
        custom: {
          signal,
          provider: provider2 || "loki",
          service,
          maxLines: n
        }
      },
      fields: [
        {
          name: "Time",
          type: "time",
          values: Array.from({ length: n }, (_, i) => from + i * 1e3)
        },
        {
          name: "Line",
          type: "string",
          values: Array.from(
            { length: n },
            (_, i) => `otel log ${i} service=${service || "unknown"}`
          )
        },
        {
          name: "service",
          type: "string",
          values: Array.from({ length: n }, () => service || "unknown")
        }
      ]
    });
  }
  if (signal === "traces") {
    const all = Array.from({ length: 12 }, (_, i) => {
      const durationMs = i === 0 ? 120 : 15 + i * 8;
      return {
        spanID: `span-${i}`,
        parentSpanID: i === 0 ? null : "span-0",
        operationName: i === 0 ? "HTTP GET" : `op-${i}`,
        serviceName: service || `svc-${i % 3}`,
        startTimeUnixNano: 1e15 + i * 1e7,
        durationNano: durationMs * 1e6,
        statusCode: i === 4 ? "ERROR" : "OK"
      };
    });
    let rows = all;
    if (service)
      rows = rows.filter((r) => r.serviceName === service || r.serviceName.includes(service));
    if (operation)
      rows = rows.filter(
        (r) => r.operationName === operation || r.operationName.includes(operation)
      );
    if (minDur != null) rows = rows.filter((r) => r.durationNano / 1e6 >= minDur);
    if (maxDur != null) rows = rows.filter((r) => r.durationNano / 1e6 <= maxDur);
    rows = rows.slice(0, Math.min(maxLines, rows.length || 1));
    if (!rows.length) {
      rows = [
        {
          spanID: "none",
          parentSpanID: null,
          operationName: operation || "none",
          serviceName: service || "none",
          startTimeUnixNano: from * 1e6,
          durationNano: 0,
          statusCode: "OK"
        }
      ];
    }
    return createDataFrame({
      refId: query.refId,
      name: legend || "otel-traces",
      meta: {
        preferredVisualisationType: "trace",
        custom: {
          signal,
          provider: provider2 || "tempo",
          service,
          operation,
          minDuration: q.minDuration ?? null,
          maxDuration: q.maxDuration ?? null
        }
      },
      fields: [
        {
          name: "traceID",
          type: "string",
          values: rows.map(() => "otel-trace")
        },
        { name: "spanID", type: "string", values: rows.map((r) => r.spanID) },
        {
          name: "parentSpanID",
          type: "string",
          values: rows.map((r) => r.parentSpanID)
        },
        {
          name: "operationName",
          type: "string",
          values: rows.map((r) => r.operationName)
        },
        {
          name: "serviceName",
          type: "string",
          values: rows.map((r) => r.serviceName)
        },
        {
          name: "startTimeUnixNano",
          type: "number",
          values: rows.map((r) => r.startTimeUnixNano)
        },
        {
          name: "durationNano",
          type: "number",
          values: rows.map((r) => r.durationNano)
        },
        {
          name: "statusCode",
          type: "string",
          values: rows.map((r) => r.statusCode)
        }
      ]
    });
  }
  return timeSeries$1(
    query,
    range,
    legend || metric,
    (i) => 15 + i % 6 * 2 + metric.length * 0.01,
    {
      labels: {
        signal: "metrics",
        provider: provider2 || "prometheus",
        metric,
        ...service ? { service } : {}
      },
      meta: {
        custom: {
          signal: "metrics",
          provider: provider2 || "prometheus",
          metric,
          service
        }
      }
    }
  );
}
function elasticsearchFixture(query, range) {
  const from = range.from.getTime();
  const q = query;
  const queryType = String(q.queryType || "metrics").toLowerCase();
  const timeField2 = String(q.timeField || "@timestamp");
  const lucene = String(q.query || q.expr || "*");
  const aliasName = String(q.alias || "").trim();
  const size = Math.min(500, Math.max(1, Number(q.size ?? q.limit ?? 500) || 500));
  const metrics = Array.isArray(q.metrics) ? q.metrics : [];
  const bucketAggs = Array.isArray(q.bucketAggs) ? q.bucketAggs : [];
  const metricType = String(metrics[0]?.type || "count");
  const metricField = String(metrics[0]?.field || "value");
  const bucketType = String(bucketAggs[0]?.type || "date_histogram");
  const bucketField = String(bucketAggs[0]?.field || timeField2);
  const interval = String(
    q.interval || q.minInterval || bucketAggs[0]?.settings?.interval || "auto"
  );
  const periodMs = parsePeriodMs(interval) ?? 6e4;
  if (queryType === "logs" || queryType === "raw_data" || queryType === "raw_document") {
    const n = Math.min(size, queryType === "raw_document" ? Math.min(size, 50) : size, 200);
    return createDataFrame({
      refId: query.refId,
      name: aliasName || "elasticsearch-logs",
      meta: {
        preferredVisualisationType: queryType === "logs" ? "logs" : "table",
        custom: {
          queryType,
          timeField: timeField2,
          size: n,
          lucene
        }
      },
      fields: [
        {
          name: timeField2,
          type: "time",
          values: Array.from({ length: n }, (_, i) => from + i * 1e3)
        },
        {
          name: "message",
          type: "string",
          values: Array.from({ length: n }, (_, i) => `es ${queryType} hit ${i} q=${lucene}`)
        },
        {
          name: "_id",
          type: "string",
          values: Array.from({ length: n }, (_, i) => `doc-${i}`)
        },
        {
          name: "level",
          type: "string",
          values: Array.from({ length: n }, (_, i) => i % 5 === 0 ? "error" : "info")
        }
      ]
    });
  }
  const metricFactor = metricType === "avg" || metricType === "average" ? 1 : metricType === "sum" ? 3 : metricType === "max" ? 2 : metricType === "min" ? 0.5 : metricType === "cardinality" ? 0.2 : 1;
  const display = aliasName || `${metricType}${metricField && metricType !== "count" ? `:${metricField}` : ""}`;
  return timeSeries$1(
    query,
    range,
    display,
    (i) => (10 + i % 9 * 4) * metricFactor + lucene.length * 0.01,
    {
      periodMs,
      labels: {
        metricType,
        metricField,
        bucketType,
        bucketField,
        timeField: timeField2
      },
      meta: {
        preferredVisualisationType: "graph",
        custom: {
          queryType: "metrics",
          timeField: timeField2,
          metricType,
          metricField,
          bucketType,
          bucketField,
          interval,
          size,
          lucene
        }
      }
    }
  );
}
function sqlFixture(query, range, alias) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const q = query;
  const table = String(q.table || q.dataset || alias || "table");
  const timeCol = String(q.timeColumn || q.timeField || "time");
  const format = String(q.format || "table").toLowerCase();
  const n = 12;
  const times = Array.from({ length: n }, (_, i) => from + (to - from) * i / Math.max(n - 1, 1));
  const vals = Array.from({ length: n }, (_, i) => 10 + i * 3);
  if (format === "time_series" || format === "timeseries") {
    return createDataFrame({
      refId: query.refId,
      name: table,
      meta: {
        preferredVisualisationType: "graph",
        custom: { format, table, timeColumn: timeCol }
      },
      fields: [
        { name: timeCol, type: "time", values: times },
        {
          name: "value",
          type: "number",
          values: vals,
          config: { displayNameFromDS: table }
        }
      ]
    });
  }
  return createDataFrame({
    refId: query.refId,
    name: table,
    meta: {
      preferredVisualisationType: "table",
      custom: { format: format || "table", table, timeColumn: timeCol }
    },
    fields: [
      { name: timeCol, type: "time", values: times },
      { name: "value", type: "number", values: vals },
      {
        name: "metric",
        type: "string",
        values: Array.from({ length: n }, (_, i) => `${table}-row-${i}`)
      }
    ]
  });
}
function isDsQueryWireResponse(raw) {
  if (!raw || typeof raw !== "object") return false;
  const r = raw;
  if (r.results == null) return false;
  if (typeof r.results !== "object") return false;
  return true;
}
function assertDsQueryWireShape(raw) {
  if (!isDsQueryWireResponse(raw)) {
    throw new Error("Invalid /api/ds/query response: missing results map");
  }
  for (const [refId, result] of Object.entries(raw.results ?? {})) {
    if (!result || typeof result !== "object") {
      throw new Error(`Invalid result for ${refId}`);
    }
    if (result.error != null && typeof result.error !== "string") {
      throw new Error(`Invalid error for ${refId}`);
    }
    if (result.frames != null && !Array.isArray(result.frames)) {
      throw new Error(`Invalid frames for ${refId}`);
    }
    for (const frame of result.frames ?? []) {
      validateWireFrame(frame, refId);
    }
  }
}
function validateWireFrame(frame, refId) {
  if (!frame || typeof frame !== "object") {
    throw new Error(`Invalid frame in ${refId}`);
  }
  const fields = frame.schema?.fields ?? frame.fields;
  if (fields != null && !Array.isArray(fields)) {
    throw new Error(`Invalid fields in ${refId}`);
  }
  if (frame.data?.values != null && !Array.isArray(frame.data.values)) {
    throw new Error(`Invalid data.values in ${refId}`);
  }
}
function wireResponseToDataFrames(raw, fallbackRefIds = []) {
  assertDsQueryWireShape(raw);
  const out = [];
  const entries = Object.entries(raw.results ?? {});
  if (!entries.length) return out;
  for (const [refId, result] of entries) {
    if (result.error) continue;
    for (const frame of result.frames ?? []) {
      out.push(wireFrameToDataFrame(frame, refId));
    }
  }
  if (fallbackRefIds.length) {
    out.sort((a, b) => {
      const ai = fallbackRefIds.indexOf(a.refId ?? "");
      const bi = fallbackRefIds.indexOf(b.refId ?? "");
      return (ai === -1 ? 999 : ai) - (bi === -1 ? 999 : bi);
    });
  }
  return out;
}
function wireFrameToDataFrame(frame, refId) {
  const schemaFields = frame.schema?.fields ?? frame.fields ?? [];
  const values = frame.data?.values;
  const fields = schemaFields.map((field, fi) => {
    const typeRaw = field.type ?? "string";
    const type = typeRaw === "time" || typeRaw === "number" || typeRaw === "boolean" || typeRaw === "other" ? typeRaw : typeRaw === "string" ? "string" : "string";
    return {
      name: field.name ?? `field_${fi}`,
      type,
      values: values?.[fi] ?? field.values ?? [],
      config: field.config ?? {},
      labels: field.labels
    };
  });
  return createDataFrame({
    refId: frame.schema?.refId ?? frame.refId ?? refId,
    name: frame.schema?.name ?? frame.name,
    fields,
    meta: frame.schema?.meta
  });
}
function parsePeriodMs(period) {
  if (period == null || period === "") return void 0;
  if (typeof period === "number" && Number.isFinite(period) && period > 0) {
    return period < 1e3 ? period * 1e3 : period;
  }
  const s = String(period).trim();
  const m = s.match(/^(\d+(?:\.\d+)?)(ms|[smh])?$/i);
  if (!m) {
    const n = Number(s);
    if (!Number.isFinite(n) || n <= 0) return void 0;
    return n < 1e3 ? n * 1e3 : n;
  }
  const v = Number(m[1]);
  const u = (m[2] || "s").toLowerCase();
  if (u === "ms") return v;
  if (u === "s") return v * 1e3;
  if (u === "m") return v * 6e4;
  if (u === "h") return v * 36e5;
  return v * 1e3;
}
function timeSeries$1(query, range, name, valuesFn, opts) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const periodMs = opts?.periodMs;
  const steps = periodMs ? Math.min(500, Math.max(2, Math.floor(Math.max(1, to - from) / Math.max(1, periodMs)) + 1)) : Math.min(200, Math.max(20, Math.floor((to - from) / 6e4)));
  const times = [];
  const values = [];
  for (let i = 0; i < steps; i++) {
    times.push(from + (to - from) * i / Math.max(steps - 1, 1));
    values.push(valuesFn(i, steps));
  }
  const legend = String(query.legendFormat || query.label || "").trim();
  const labels = {
    job: "api",
    instance: "localhost:9090",
    ...opts?.labels || {}
  };
  let display = name;
  if (legend) {
    display = legend.replaceAll(
      /\{\{\s*([a-z_]\w*)\s*\}\}/gi,
      (_, k) => labels[k] ?? ""
    );
  }
  if (!display || display === "Value" || /^Value\s*\{/.test(display)) {
    display = Object.entries(labels).map(([k, v]) => `${k}=${v}`).join(", ") || name || "series";
  }
  return createDataFrame({
    refId: query.refId,
    name: display,
    meta: opts?.meta,
    fields: [
      { name: "Time", type: "time", values: times },
      {
        name: "Value",
        type: "number",
        values,
        labels,
        config: { displayNameFromDS: display }
      }
    ]
  });
}
function seriesForScenario(query, range, name, metaId) {
  const from = range.from.getTime();
  const scenario = String(
    query.scenarioId ?? query.query ?? "random_walk"
  );
  const alias = String(query.alias ?? name);
  const expr = String(
    query.expr ?? query.query ?? query.rawSql ?? query.target ?? ""
  );
  if (metaId === "prometheus" || expr.includes("up") || scenario === "prometheus_like") {
    return timeSeries$1(
      query,
      range,
      alias || "prometheus",
      (i) => Math.sin(i / 3) * 20 + 50 + i * 0.1
    );
  }
  if (metaId === "loki" || expr.includes("{") && expr.includes("}")) {
    return lokiFixture(query, range, from, expr, scenario);
  }
  if (metaId === "mysql" || metaId === "mssql" || metaId === "grafana-postgresql-datasource" || query.rawSql) {
    return sqlFixture(query, range, alias);
  }
  if (metaId === "influxdb") {
    return influxdbFixture(query, range);
  }
  if (metaId === "elasticsearch" || metaId === "grafana-elasticsearch-datasource") {
    return elasticsearchFixture(query, range);
  }
  if (metaId === "graphite") {
    return graphiteFixture(query, range, alias);
  }
  if (metaId === "cloudwatch") {
    return cloudwatchFixture(query, range);
  }
  if (metaId === "jaeger") {
    return jaegerFixture(query);
  }
  if (metaId === "tempo") {
    return tempoFixture(query);
  }
  if (metaId === "grafana-pyroscope-datasource") {
    return pyroscopeFixture(query, range);
  }
  if (metaId === "grafana-azure-monitor-datasource") {
    return azureMonitorFixture(query, range);
  }
  if (metaId === "opentelemetry") {
    return opentelemetryFixture(query, range);
  }
  if (metaId === "alertmanager") {
    return alertmanagerFixture(query);
  }
  return timeSeries$1(query, range, alias, (i) => {
    const x = i / 3;
    switch (scenario) {
      case "predictable_pulse":
        return i % 10 < 3 ? 100 : 0;
      case "predictable_csv_wave":
        return Math.sin(x) * 50 + 50;
      case "csv_metric_values":
        return i * 7 % 100;
      case "random_walk":
      default:
        return Math.sin(x) * 50 + 50 + i + scenario.length % 7;
    }
  });
}
function createBuiltinDataSourceApi(instance, meta2) {
  return {
    uid: instance.uid,
    type: meta2.id,
    name: instance.name,
    capabilities: {
      signals: [
        meta2.metrics !== false ? "metrics" : null,
        meta2.logs ? "logs" : null,
        meta2.tracing ? "traces" : null
      ].filter(Boolean),
      query: true,
      health: true,
      metadata: true,
      variables: true,
      annotations: true,
      exemplars: false,
      streaming: false,
      queryLanguages: []
    },
    async query(request, signal) {
      if (getBackendMode() === "live" && meta2.backend && instance.uid) {
        try {
          const res = await backendSrv.post(
            "/api/ds/query",
            {
              queries: request.targets.map((t2) => {
                const cacheTimeout = request.cacheTimeout != null && String(request.cacheTimeout).trim() !== "" ? String(request.cacheTimeout).trim() : void 0;
                return {
                  ...t2,
                  datasource: { type: instance.type, uid: instance.uid },
                  maxDataPoints: request.maxDataPoints,
                  intervalMs: request.intervalMs,
                  ...cacheTimeout ? { cacheTimeout } : {}
                };
              }),
              from: String(request.range.from.getTime()),
              to: String(request.range.to.getTime())
            },
            { signal }
          );
          const frames = wireResponseToDataFrames(
            res.data ?? {},
            request.targets.map((t2) => t2.refId)
          );
          return { data: frames };
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          return {
            data: request.targets.filter((t2) => !t2.hide).map(
              (t2) => createDataFrame({
                refId: t2.refId,
                name: "error",
                fields: [],
                meta: { error: msg }
              })
            )
          };
        }
      }
      const targets = request.targets.filter((t2) => !t2.hide);
      return {
        data: targets.map((t2) => seriesForScenario(t2, request.range, instance.name, meta2.id))
      };
    },
    async testDatasource() {
      if (getBackendMode() === "live") {
        try {
          await backendSrv.get(`/api/datasources/uid/${instance.uid}/health`);
          return {
            status: "success",
            message: `Data source is working (${meta2.name})`
          };
        } catch {
          return {
            status: "error",
            message: `Health check failed (${meta2.name})`
          };
        }
      }
      return {
        status: "success",
        message: `Data source offline fixture OK (${meta2.name})`
      };
    },
    async metricFindQuery(query) {
      const q = String(query ?? "");
      if (meta2.id === "prometheus") {
        return ["up", "process_cpu_seconds_total", "go_goroutines", "node_cpu_seconds_total"].filter((m) => !q || m.includes(q)).map((m) => ({ text: m, value: m }));
      }
      if (meta2.id === "loki") {
        if (/label_names\s*\(/i.test(q)) {
          return ["filename", "job", "level", "namespace", "instance", "host"].map((m) => ({
            text: m,
            value: m
          }));
        }
        if (/label_values\s*\(/i.test(q)) {
          if (/\bjob\b/i.test(q)) {
            return ["varlogs", "nginx", "api"].map((m) => ({
              text: m,
              value: m
            }));
          }
          if (/filename|label_name/i.test(q)) {
            return ["/var/log/nginx/json_access.log", "/var/log/app.log"].map((m) => ({
              text: m,
              value: m
            }));
          }
          if (/instance/i.test(q)) {
            return ["localhost:3100", "nginx-1:3100"].map((m) => ({
              text: m,
              value: m
            }));
          }
          return ["a", "b", "all"].map((m) => ({ text: m, value: m }));
        }
        return ["job", "filename", "level", "namespace"].map((m) => ({
          text: m,
          value: m
        }));
      }
      if (meta2.id === "mysql" || meta2.id === "mssql" || meta2.id === "grafana-postgresql-datasource") {
        return ["id", "name", "value"].map((m) => ({ text: m, value: m }));
      }
      if (meta2.id === "cloudwatch") {
        return ["CPUUtilization", "NetworkIn", "NetworkOut"].filter((m) => !q || m.toLowerCase().includes(q.toLowerCase())).map((m) => ({ text: m, value: m }));
      }
      if (meta2.id === "influxdb") {
        return ["cpu", "mem", "disk"].map((m) => ({ text: m, value: m }));
      }
      if (meta2.id === "elasticsearch") {
        const ES_FIELDS = [
          "@timestamp",
          "message",
          "host",
          "service",
          "level",
          "status",
          "duration",
          "bytes",
          "method",
          "path"
        ];
        if (/fields\s*\(/i.test(q) || !q || q === "*") {
          return ES_FIELDS.map((m) => ({ text: m, value: m }));
        }
        return ES_FIELDS.filter((m) => m.includes(q)).map((m) => ({
          text: m,
          value: m
        }));
      }
      if (meta2.id === "graphite") {
        const GRAPHITE_TREE = [
          "servers.web01.cpu.idle",
          "servers.web01.cpu.user",
          "servers.web01.mem.used",
          "servers.web02.cpu.idle",
          "servers.web02.disk.bytes",
          "apps.api.requests",
          "apps.api.errors",
          "apps.worker.queue"
        ];
        const cleaned = q.replace(/\.\*$/, "").replace(/\*$/, "").replace(/\.$/, "");
        if (!cleaned || cleaned === "*") {
          const roots = [...new Set(GRAPHITE_TREE.map((m) => m.split(".")[0]))];
          return roots.map((m) => ({ text: m, value: m, expandable: true }));
        }
        if (cleaned.startsWith("expand(")) {
          const inner = cleaned.slice(7).replace(/\)$/, "");
          return GRAPHITE_TREE.filter((m) => m.includes(inner.replaceAll("*", ""))).map((m) => ({
            text: m,
            value: m,
            expandable: false
          }));
        }
        const partsQ = cleaned.split(".").filter(Boolean);
        const depth = partsQ.length;
        const segs = /* @__PURE__ */ new Map();
        for (const m of GRAPHITE_TREE) {
          const parts = m.split(".");
          let match = true;
          for (let i = 0; i < depth; i++) {
            if (parts[i] !== partsQ[i] && partsQ[i] !== "*") {
              match = false;
              break;
            }
          }
          if (!match) continue;
          if (parts.length === depth) {
            segs.set(parts[depth - 1], false);
          } else if (parts.length > depth) {
            segs.set(parts[depth], parts.length > depth + 1);
          }
        }
        if (!segs.size) {
          return GRAPHITE_TREE.filter((m) => m.includes(cleaned)).map((m) => ({
            text: m,
            value: m,
            expandable: false
          }));
        }
        return [...segs.entries()].map(([text, expandable]) => ({
          text,
          value: text,
          expandable
        }));
      }
      return [
        { text: "A", value: "A" },
        { text: "B", value: "B" },
        { text: q || "all", value: q || "all" }
      ];
    },
    /** Annotation query support — returns event frames. */
    async annotationQuery(options) {
      const from = options.range.from.getTime();
      const to = options.range.to.getTime();
      const n = 5;
      return createDataFrame({
        name: String(options.annotation.name ?? "annotations"),
        fields: [
          {
            name: "time",
            type: "time",
            values: Array.from({ length: n }, (_, i) => from + (to - from) * i / n)
          },
          {
            name: "text",
            type: "string",
            values: Array.from({ length: n }, (_, i) => `${meta2.name} event ${i}`)
          },
          {
            name: "tags",
            type: "string",
            values: Array.from({ length: n }, () => "outage,deploy")
          }
        ]
      });
    }
  };
}
const ALIASES = {
  "prometheus": "prometheus",
  "prom": "prometheus",
  "loki": "loki",
  "mysql": "mysql",
  "mssql": "mssql",
  "postgres": "grafana-postgresql-datasource",
  "postgresql": "grafana-postgresql-datasource",
  "grafana-postgresql-datasource": "grafana-postgresql-datasource",
  "influxdb": "influxdb",
  "influx": "influxdb",
  "graphite": "graphite",
  "cloudwatch": "cloudwatch",
  "cloud-watch": "cloudwatch",
  "grafana-testdata-datasource": "grafana-testdata-datasource",
  "testdata": "grafana-testdata-datasource",
  "testData": "grafana-testdata-datasource",
  "elasticsearch": "elasticsearch",
  "grafana-elasticsearch-datasource": "elasticsearch",
  "tempo": "tempo",
  "opentelemetry": "opentelemetry",
  "otel": "opentelemetry",
  "signoz": "signoz",
  "alexanderzobnin-zabbix-datasource": "alexanderzobnin-zabbix-datasource",
  "zabbix": "alexanderzobnin-zabbix-datasource",
  "jaeger": "jaeger",
  "grafana-pyroscope-datasource": "grafana-pyroscope-datasource",
  "pyroscope": "grafana-pyroscope-datasource",
  "grafana-azure-monitor-datasource": "grafana-azure-monitor-datasource",
  "azure-monitor": "grafana-azure-monitor-datasource",
  "azuremonitor": "grafana-azure-monitor-datasource",
  "grafana": "grafana",
  "dashboard": "dashboard",
  "mixed": "mixed",
  "-- Mixed --": "mixed",
  "alertmanager": "alertmanager"
};
function normalizeDsType(type) {
  const raw = String(type ?? "").trim();
  if (!raw) return "";
  if (ALIASES[raw]) return ALIASES[raw];
  const lower = raw.toLowerCase();
  if (ALIASES[lower]) return ALIASES[lower];
  if (lower.includes("postgres")) return "grafana-postgresql-datasource";
  if (lower.includes("prometheus")) return "prometheus";
  if (lower.includes("loki")) return "loki";
  if (lower.includes("elastic")) return "elasticsearch";
  if (lower.includes("opentelemetry") || lower === "otel") return "opentelemetry";
  if (lower.includes("signoz")) return "signoz";
  if (lower.includes("zabbix")) return "alexanderzobnin-zabbix-datasource";
  if (lower.includes("pyroscope")) return "grafana-pyroscope-datasource";
  if (lower.includes("azure")) return "grafana-azure-monitor-datasource";
  if (lower.includes("testdata") || lower.includes("test-data"))
    return "grafana-testdata-datasource";
  return raw;
}
function queryFieldFamily(type) {
  const t2 = normalizeDsType(type);
  switch (t2) {
    case "prometheus":
      return "prometheus";
    case "loki":
      return "loki";
    case "mysql":
    case "mssql":
    case "grafana-postgresql-datasource":
      return "sql";
    case "influxdb":
      return "influxdb";
    case "graphite":
      return "graphite";
    case "cloudwatch":
      return "cloudwatch";
    case "grafana-testdata-datasource":
      return "testdata";
    case "elasticsearch":
      return "elasticsearch";
    case "tempo":
      return "tempo";
    case "jaeger":
      return "jaeger";
    case "grafana-pyroscope-datasource":
      return "pyroscope";
    case "grafana-azure-monitor-datasource":
      return "azure";
    case "grafana":
      return "grafana";
    case "dashboard":
      return "dashboard";
    case "mixed":
      return "mixed";
    case "alertmanager":
      return "alertmanager";
    case "alexanderzobnin-zabbix-datasource":
      return "zabbix";
    case "opentelemetry":
      return "opentelemetry";
    case "signoz":
      return "signoz";
    default:
      return "generic";
  }
}
const DS_TYPE_LABELS = {
  "prometheus": "Prometheus",
  "loki": "Loki",
  "mysql": "MySQL",
  "mssql": "MSSQL",
  "grafana-postgresql-datasource": "PostgreSQL",
  "influxdb": "InfluxDB",
  "graphite": "Graphite",
  "cloudwatch": "CloudWatch",
  "grafana-testdata-datasource": "TestData",
  "elasticsearch": "Elasticsearch",
  "tempo": "Tempo",
  "opentelemetry": "OpenTelemetry",
  "signoz": "SigNoz",
  "alexanderzobnin-zabbix-datasource": "Zabbix",
  "jaeger": "Jaeger",
  "grafana-pyroscope-datasource": "Pyroscope",
  "grafana-azure-monitor-datasource": "Azure Monitor",
  "grafana": "Grafana",
  "dashboard": "Dashboard",
  "mixed": "Mixed",
  "alertmanager": "Alertmanager"
};
function dsTypeLabel(type) {
  const t2 = normalizeDsType(type);
  return DS_TYPE_LABELS[t2] || t2 || "未知";
}
function dsTypeBadge(type) {
  const t2 = normalizeDsType(type);
  const map = {
    "prometheus": "Prom",
    "loki": "Loki",
    "mysql": "MySQL",
    "mssql": "MSSQL",
    "grafana-postgresql-datasource": "PG",
    "influxdb": "Influx",
    "graphite": "Graphite",
    "cloudwatch": "CW",
    "grafana-testdata-datasource": "Test",
    "elasticsearch": "ES",
    "tempo": "Tempo",
    "opentelemetry": "OTel",
    "signoz": "SigNoz",
    "alexanderzobnin-zabbix-datasource": "Zabbix",
    "jaeger": "Jaeger",
    "grafana-pyroscope-datasource": "Prof",
    "grafana-azure-monitor-datasource": "Azure",
    "grafana": "Graf",
    "dashboard": "Dash",
    "mixed": "Mixed",
    "alertmanager": "AM"
  };
  return map[t2] || (t2 ? t2.slice(0, 6) : "?");
}
function defaultQueryForType(type, refId = "A") {
  const t2 = normalizeDsType(type);
  switch (t2) {
    case "prometheus":
      return {
        refId,
        expr: "up",
        range: true,
        instant: false,
        exemplar: false,
        format: "time_series",
        editorMode: "code",
        datasource: { type: t2 }
      };
    case "loki":
      return {
        refId,
        expr: '{job="varlogs"}',
        queryType: "range",
        maxLines: 1e3,
        editorMode: "code",
        datasource: { type: t2 }
      };
    case "grafana-postgresql-datasource":
    case "mysql":
    case "mssql":
      return {
        refId,
        rawSql: "SELECT 1 AS value",
        format: 1,
        rawQuery: true,
        datasource: { type: t2 }
      };
    case "grafana-testdata-datasource":
      return {
        refId,
        scenarioId: "random_walk",
        alias: "test",
        seriesCount: 1,
        datasource: { type: t2 }
      };
    case "graphite":
      return {
        refId,
        target: "stats.counters.*",
        textEditor: true,
        datasource: { type: t2 }
      };
    case "influxdb":
      return {
        refId,
        query: "SELECT mean(value) FROM cpu",
        rawQuery: true,
        resultFormat: "time_series",
        datasource: { type: t2 }
      };
    case "cloudwatch":
      return {
        refId,
        queryMode: "Metrics",
        region: "default",
        namespace: "AWS/EC2",
        metricName: "CPUUtilization",
        statistic: "Average",
        period: "",
        matchExact: true,
        expression: "",
        datasource: { type: t2 }
      };
    case "jaeger":
      return {
        refId,
        query: "",
        service: "",
        operation: "",
        datasource: { type: t2 }
      };
    case "grafana-pyroscope-datasource":
      return {
        refId,
        query: "process_cpu:cpu:nanoseconds:cpu:nanoseconds{}",
        profileTypeId: "process_cpu:cpu:nanoseconds:cpu:nanoseconds",
        labelSelector: "{}",
        groupBy: [],
        datasource: { type: t2 }
      };
    case "grafana-azure-monitor-datasource":
      return {
        refId,
        queryType: "Azure Monitor",
        azureMonitor: {
          timeGrain: "auto",
          metricName: "",
          aggregation: "Average"
        },
        datasource: { type: t2 }
      };
    case "elasticsearch":
      return {
        refId,
        query: "*",
        timeField: "@timestamp",
        metrics: [{ type: "count", id: "1" }],
        bucketAggs: [{ type: "date_histogram", id: "2", settings: { interval: "auto" } }],
        datasource: { type: t2 }
      };
    case "tempo":
      return {
        refId,
        query: "{}",
        queryType: "traceql",
        limit: 20,
        datasource: { type: t2 }
      };
    case "grafana":
      return { refId, queryType: "randomWalk", datasource: { type: t2 } };
    case "dashboard":
      return { refId, panelId: void 0, datasource: { type: t2 } };
    case "alertmanager":
      return { refId, query: "", expr: "", datasource: { type: t2 } };
    case "mixed":
      return { refId, datasource: { type: "mixed", uid: "mixed" } };
    default:
      return { refId, query: "", datasource: t2 ? { type: t2 } : void 0 };
  }
}
function switchQueryDatasource(current, ds2) {
  const type = normalizeDsType(ds2.type);
  const base = defaultQueryForType(type, current.refId);
  return {
    ...base,
    refId: current.refId,
    hide: current.hide,
    datasource: {
      type,
      uid: ds2.uid || type,
      ...ds2.name ? { name: ds2.name } : {}
    }
  };
}
const INTERPOLATE_KEYS = [
  "expr",
  "query",
  "rawSql",
  "target",
  "alias",
  "legendFormat",
  "expression",
  "namespace",
  "metricName",
  "service",
  "operation",
  "labelSelector",
  "rawQuery",
  "rawLegend"
];
function deepReplaceStrings(value, replace, depth = 0) {
  if (depth > 12) return value;
  if (typeof value === "string") return replace(value);
  if (Array.isArray(value)) {
    return value.map((v) => deepReplaceStrings(v, replace, depth + 1));
  }
  if (value && typeof value === "object") {
    const out = {};
    for (const [k, v] of Object.entries(value)) {
      out[k] = deepReplaceStrings(v, replace, depth + 1);
    }
    return out;
  }
  return value;
}
function interpolateQuery(query, replace) {
  const deep = deepReplaceStrings(query, replace);
  const next = { ...deep };
  for (const key of INTERPOLATE_KEYS) {
    const v = next[key];
    if (typeof v === "string") next[key] = replace(v);
  }
  return next;
}
const NICE_PROM_STEPS_MS = [
  1e3,
  5e3,
  1e4,
  15e3,
  3e4,
  6e4,
  12e4,
  3e5,
  6e5,
  9e5,
  18e5,
  36e5,
  72e5,
  108e5,
  216e5,
  432e5,
  864e5
];
function alignNiceStep(step) {
  for (const n of NICE_PROM_STEPS_MS) {
    if (n >= step) return n;
  }
  return step;
}
function computeStepMs(opts) {
  if (opts.step != null && opts.step !== "") {
    const s = typeof opts.step === "number" ? opts.step : parseDurationMs$1(String(opts.step));
    if (s > 0) {
      const factor2 = Math.max(1, Number(opts.intervalFactor) || 1);
      return alignNiceStep(s * factor2);
    }
  }
  const maxPoints = Math.max(1, opts.maxDataPoints ?? 1100);
  const minInterval = Math.max(1, opts.minIntervalMs ?? opts.intervalMs ?? 15e3);
  const raw = Math.ceil(Math.max(1, opts.rangeMs) / maxPoints);
  let step = Math.max(minInterval, raw);
  const factor = Math.max(1, Number(opts.intervalFactor) || 1);
  if (factor > 1) step = step * factor;
  return alignNiceStep(step);
}
function parseDurationMs$1(input) {
  const m = String(input).trim().match(/^(\d+(?:\.\d+)?)(ms|[smhd])?$/i);
  if (!m) {
    const n = Number(input);
    return Number.isFinite(n) ? n : 0;
  }
  const v = Number(m[1]);
  const u = (m[2] || "s").toLowerCase();
  if (u === "ms") return v;
  if (u === "s") return v * 1e3;
  if (u === "m") return v * 6e4;
  if (u === "h") return v * 36e5;
  if (u === "d") return v * 864e5;
  return v;
}
function formatDurationProm(ms) {
  if (ms % 864e5 === 0) return `${ms / 864e5}d`;
  if (ms % 36e5 === 0) return `${ms / 36e5}h`;
  if (ms % 6e4 === 0) return `${ms / 6e4}m`;
  if (ms % 1e3 === 0) return `${ms / 1e3}s`;
  return `${ms}ms`;
}
function interpolatePromMacros(expr, ctx) {
  const interval = formatDurationProm(Math.max(1, ctx.intervalMs));
  const rate = formatDurationProm(
    Math.max(ctx.intervalMs * 4, ctx.rateIntervalMs ?? ctx.intervalMs * 4)
  );
  const rangeS = Math.max(1, Math.floor(ctx.rangeMs / 1e3));
  const range = formatDurationProm(ctx.rangeMs);
  let out = expr.replaceAll("$__rate_interval", rate).replaceAll("$__interval_ms", String(ctx.intervalMs)).replaceAll("$__interval", interval).replaceAll("$__range_ms", String(ctx.rangeMs)).replaceAll("$__range_s", String(rangeS)).replaceAll("$__range", range);
  if (ctx.interpolate) out = ctx.interpolate(out);
  return out;
}
function alignPromTimestampSec(tsSec, stepSec, utcOffsetSec = 0) {
  const step = Math.max(1, Math.floor(stepSec) || 1);
  const offset = Number(utcOffsetSec) || 0;
  return Math.floor((tsSec - offset) / step) * step + offset;
}
function alignPromTimeRange(startSec, endSec, stepSec, utcOffsetSec = 0) {
  return {
    start: alignPromTimestampSec(startSec, stepSec, utcOffsetSec),
    end: alignPromTimestampSec(endSec, stepSec, utcOffsetSec)
  };
}
function formatPromLegend(legendFormat, labels = {}) {
  if (!legendFormat) {
    const entries = Object.entries(labels).filter(
      ([k, v]) => k !== "__name__" && v != null && v !== ""
    );
    const metric = labels.__name__ || "";
    if (!entries.length) return metric;
    if (entries.length === 1) return String(entries[0][1]);
    const body = entries.map(([k, v]) => `${k}="${v}"`).join(", ");
    return metric ? `${metric}{${body}}` : `{${body}}`;
  }
  return legendFormat.replaceAll(/\{\{\s*([a-z_]\w*)\s*\}\}/gi, (_, k) => labels[k] ?? "");
}
function mapPrometheusResponse(body, opts) {
  if (body?.status === "error" || body?.error) {
    throw new Error(body.error || body.errorType || "Prometheus query error");
  }
  const resultType = body?.data?.resultType ?? "matrix";
  const result = body?.data?.result ?? [];
  const preferredVisualisationType = opts.format === "table" ? "table" : opts.format === "heatmap" ? "heatmap" : resultType === "scalar" || resultType === "string" ? "table" : "graph";
  if (resultType === "scalar" || resultType === "string") {
    const pair = Array.isArray(result) ? result : [0, result];
    const t2 = Number(pair[0]) * (Number(pair[0]) < 1e12 ? 1e3 : 1);
    const v = resultType === "string" ? null : Number(pair[1]);
    return [
      createDataFrame({
        refId: opts.refId,
        name: opts.expr || "scalar",
        meta: { preferredVisualisationType, resultType, format: opts.format },
        fields: [
          { name: "Time", type: "time", values: [t2] },
          {
            name: "Value",
            type: "number",
            values: [v],
            config: { displayNameFromDS: "Value" }
          }
        ]
      })
    ];
  }
  return result.map((series, idx) => {
    const metric = series.metric || {};
    const labels = {};
    for (const [k, v] of Object.entries(metric)) {
      if (k === "__name__") continue;
      labels[k] = String(v);
    }
    const name = formatPromLegend(opts.legendFormat || "", {
      ...labels,
      __name__: metric.__name__ || ""
    }) || metric.__name__ || opts.expr || `series ${idx}`;
    let times = [];
    let values = [];
    if (resultType === "vector") {
      const t2 = Number(series.value?.[0] ?? 0);
      times = [t2 < 1e12 ? t2 * 1e3 : t2];
      const raw = series.value?.[1];
      values = [raw == null || raw === "NaN" ? null : Number(raw)];
    } else {
      const pts = series.values || [];
      times = pts.map((p) => {
        const t2 = Number(p[0]);
        return t2 < 1e12 ? t2 * 1e3 : t2;
      });
      values = pts.map((p) => {
        const raw = p[1];
        if (raw == null || raw === "NaN") return null;
        if (raw === "+Inf") return Infinity;
        if (raw === "-Inf") return -Infinity;
        const n = Number(raw);
        return Number.isFinite(n) ? n : null;
      });
    }
    return createDataFrame({
      refId: opts.refId,
      name,
      meta: { resultType, preferredVisualisationType, format: opts.format },
      fields: [
        { name: "Time", type: "time", values: times },
        {
          name: "Value",
          type: "number",
          values,
          labels,
          config: { displayNameFromDS: name }
        }
      ]
    });
  });
}
function mapPrometheusExemplars(body, opts) {
  if (body?.status === "error" || body?.error) {
    return [];
  }
  const groups = Array.isArray(body?.data) ? body.data : [];
  const times = [];
  const values = [];
  const traceIds = [];
  const seriesNames = [];
  for (const g of groups) {
    const seriesLabels = g.seriesLabels || {};
    const seriesName2 = seriesLabels.__name__ || Object.entries(seriesLabels).filter(([k]) => k !== "__name__").map(([k, v]) => `${k}="${v}"`).join(",") || opts.expr || "exemplar";
    for (const ex of g.exemplars || []) {
      const rawT = Number(ex.timestamp ?? 0);
      const t2 = rawT > 0 && rawT < 1e12 ? rawT * 1e3 : rawT;
      times.push(t2);
      const rawV = ex.value;
      values.push(rawV == null || rawV === "NaN" ? null : Number(rawV));
      const labels = ex.labels || {};
      traceIds.push(
        String(labels.traceID || labels.trace_id || labels.TraceID || labels.span_id || "")
      );
      seriesNames.push(seriesName2);
    }
  }
  if (!times.length) return [];
  return [
    createDataFrame({
      refId: opts.refId,
      name: "exemplars",
      meta: {
        dataTopic: "annotations",
        resultType: "exemplars",
        preferredVisualisationType: "graph",
        custom: { resultType: "exemplars", isExemplar: true }
      },
      fields: [
        { name: "Time", type: "time", values: times },
        {
          name: "Value",
          type: "number",
          values,
          config: { displayNameFromDS: "Exemplar" }
        },
        { name: "traceID", type: "string", values: traceIds },
        { name: "seriesName", type: "string", values: seriesNames }
      ]
    })
  ];
}
const store = /* @__PURE__ */ new Map();
const inflight = /* @__PURE__ */ new Map();
let totalBytes = 0;
const MAX_ENTRIES$2 = 500;
const MAX_BYTES = 8 * 1024 * 1024;
function fullKey(uid, key) {
  return `${uid}::${key}`;
}
function estimateBytes(value) {
  try {
    return JSON.stringify(value)?.length ?? 64;
  } catch {
    return 256;
  }
}
function evict() {
  while (store.size > MAX_ENTRIES$2 || totalBytes > MAX_BYTES) {
    let oldestKey = null;
    let oldestAccess = Infinity;
    for (const [k, e2] of store) {
      if (e2.lastAccess < oldestAccess) {
        oldestAccess = e2.lastAccess;
        oldestKey = k;
      }
    }
    if (!oldestKey) break;
    const e = store.get(oldestKey);
    store.delete(oldestKey);
    if (e) totalBytes = Math.max(0, totalBytes - e.estimatedBytes);
  }
}
function metadataCacheGet(uid, key) {
  const k = fullKey(uid, key);
  const e = store.get(k);
  if (!e) return void 0;
  if (Date.now() > e.expiresAt) {
    store.delete(k);
    totalBytes = Math.max(0, totalBytes - e.estimatedBytes);
    return void 0;
  }
  e.lastAccess = Date.now();
  return e.value;
}
function metadataCacheSet(uid, key, value, ttlMs2 = 6e4) {
  const k = fullKey(uid, key);
  const prev = store.get(k);
  if (prev) totalBytes = Math.max(0, totalBytes - prev.estimatedBytes);
  const estimatedBytes = estimateBytes(value);
  store.set(k, {
    value,
    expiresAt: Date.now() + Math.max(1e3, ttlMs2),
    estimatedBytes,
    lastAccess: Date.now()
  });
  totalBytes += estimatedBytes;
  evict();
}
async function metadataCacheLoad(uid, key, loader, ttlMs2 = 6e4) {
  const hit = metadataCacheGet(uid, key);
  if (hit !== void 0) return hit;
  const k = fullKey(uid, key);
  const existing = inflight.get(k);
  if (existing) return existing;
  const p = (async () => {
    try {
      const value = await loader();
      metadataCacheSet(uid, key, value, ttlMs2);
      return value;
    } finally {
      inflight.delete(k);
    }
  })();
  inflight.set(k, p);
  return p;
}
async function promGet(opts, path, query) {
  const res = await datasourceHttp({
    baseUrl: opts.baseUrl.replace(/\/$/, ""),
    path,
    method: "GET",
    query,
    uid: opts.uid,
    credential: opts.credential ?? void 0,
    signal: opts.signal,
    timeoutMs: opts.timeoutMs ?? 3e4
  });
  return res.data;
}
async function promLabelNames(opts, match) {
  const cacheKey = `prom:labels:${[].join(",")}`;
  return metadataCacheLoad(opts.uid, cacheKey, async () => {
    const query = {};
    if (match?.length) ;
    const data = await promGet(opts, "/api/v1/labels", query);
    return Array.isArray(data?.data) ? data.data : [];
  });
}
async function promLabelValues(opts, label, match) {
  const cacheKey = `prom:labelValues:${label}:${(match || []).join(",")}`;
  return metadataCacheLoad(opts.uid, cacheKey, async () => {
    const query = {};
    if (match?.length) query["match[]"] = match.length === 1 ? match[0] : match;
    const data = await promGet(
      opts,
      `/api/v1/label/${encodeURIComponent(label)}/values`,
      query
    );
    return Array.isArray(data?.data) ? data.data : [];
  });
}
async function promMetricNames(opts, limit = 500) {
  return metadataCacheLoad(
    opts.uid,
    `prom:metrics:${limit}`,
    async () => {
      try {
        const data = await promGet(opts, "/api/v1/metadata");
        const names = Object.keys(data?.data || {});
        if (names.length) return names.slice(0, limit).sort();
      } catch {
      }
      return (await promLabelValues(opts, "__name__")).slice(0, limit);
    },
    12e4
  );
}
function normalizePromQuery(q) {
  const instant = q.instant ?? false;
  const range = q.range ?? !instant;
  return {
    refId: q.refId,
    expr: q.expr ?? "",
    legendFormat: q.legendFormat ?? "",
    interval: q.interval,
    intervalFactor: q.intervalFactor ?? 1,
    instant,
    range: instant ? false : range,
    exemplar: q.exemplar ?? false,
    format: q.format ?? "time_series",
    editorMode: q.editorMode ?? "code",
    utcOffsetSec: q.utcOffsetSec ?? 0,
    datasource: q.datasource,
    hide: q.hide
  };
}
const PROMETHEUS_CAPABILITIES = {
  signals: ["metrics"],
  query: true,
  health: true,
  metadata: true,
  variables: true,
  annotations: true,
  exemplars: true,
  streaming: false,
  queryLanguages: ["promql"]
};
function baseUrlOf$2(instance) {
  return String(instance.url || instance.jsonData?.url || "").replace(/\/$/, "");
}
function createPrometheusDataSource(instance, meta2) {
  const fallback = createBuiltinDataSourceApi(instance, meta2);
  const url = baseUrlOf$2(instance);
  return {
    uid: instance.uid,
    type: instance.type || meta2.id,
    name: instance.name,
    capabilities: PROMETHEUS_CAPABILITIES,
    async query(request, signal) {
      const targets = request.targets.filter((t2) => !t2.hide);
      if (getBackendMode() === "offline") {
        return fallback.query(request);
      }
      if (!url) {
        throw new DataSourceError("INVALID_RESPONSE", "Datasource URL is empty");
      }
      const from = request.range.from.getTime();
      const to = request.range.to.getTime();
      const rangeMs2 = Math.max(1, to - from);
      const dsMinIntervalMs = Number(instance.jsonData?.timeIntervalMs) || (typeof instance.jsonData?.timeInterval === "string" ? parseDurationMs$1(String(instance.jsonData.timeInterval)) : 0) || 0;
      const cred = await getRuntimeCredential(instance.uid);
      const frames = [];
      const errors = [];
      await Promise.all(
        targets.map(async (raw) => {
          const q = normalizePromQuery({ ...raw, refId: raw.refId });
          if (!q.expr?.trim()) return;
          const queryMinMs = q.interval ? parseDurationMs$1(String(q.interval)) : 0;
          const minIntervalMs = Math.max(dsMinIntervalMs, queryMinMs) || void 0;
          const stepMs = computeStepMs({
            rangeMs: rangeMs2,
            maxDataPoints: request.maxDataPoints,
            intervalMs: request.intervalMs,
            minIntervalMs,
            intervalFactor: q.intervalFactor
          });
          const stepSec = Math.max(1, Math.floor(stepMs / 1e3));
          const expr = interpolatePromMacros(q.expr, {
            rangeMs: rangeMs2,
            intervalMs: stepMs,
            interpolate: (s) => s
            // variable interpolation done by query runtime when present
          });
          try {
            const instant = q.instant && !q.range;
            const path = instant ? "/api/v1/query" : "/api/v1/query_range";
            const cacheTimeout = request.cacheTimeout != null && String(request.cacheTimeout).trim() !== "" ? String(request.cacheTimeout).trim() : void 0;
            const utcOffsetSec = Number(q.utcOffsetSec) || 0;
            const aligned = alignPromTimeRange(from / 1e3, to / 1e3, stepSec, utcOffsetSec);
            const query = instant ? {
              query: expr,
              time: String(aligned.end),
              timeout: String(instance.jsonData?.queryTimeout || "60s"),
              ...cacheTimeout ? { cacheTimeout } : {}
            } : {
              query: expr,
              start: String(aligned.start),
              end: String(aligned.end),
              step: String(stepSec),
              timeout: String(instance.jsonData?.queryTimeout || "60s"),
              ...cacheTimeout ? { cacheTimeout } : {}
            };
            const method = String(instance.jsonData?.httpMethod || "POST").toUpperCase() === "GET" ? "GET" : "POST";
            const res = await datasourceHttp({
              baseUrl: url,
              path,
              method,
              query: method === "GET" ? query : void 0,
              body: method === "POST" ? query : void 0,
              uid: instance.uid,
              credential: cred,
              signal,
              timeoutMs: Number(instance.jsonData?.timeout) || 6e4
            });
            const mapped = mapPrometheusResponse(res.data, {
              refId: q.refId,
              legendFormat: q.legendFormat,
              expr: q.expr,
              format: q.format
            });
            frames.push(...normalizeDataFrames(mapped, { refId: q.refId }));
            if (q.exemplar) {
              try {
                const exQuery = {
                  query: expr,
                  start: String(aligned.start),
                  end: String(aligned.end)
                };
                const exRes = await datasourceHttp({
                  baseUrl: url,
                  path: "/api/v1/query_exemplars",
                  method,
                  query: method === "GET" ? exQuery : void 0,
                  body: method === "POST" ? exQuery : void 0,
                  uid: instance.uid,
                  credential: cred,
                  signal,
                  timeoutMs: Number(instance.jsonData?.timeout) || 6e4
                });
                const exFrames = mapPrometheusExemplars(exRes.data, {
                  refId: q.refId,
                  expr: q.expr
                });
                if (exFrames.length) {
                  frames.push(...normalizeDataFrames(exFrames, { refId: q.refId }));
                }
              } catch {
              }
            }
          } catch (error) {
            const msg = error instanceof DataSourceError ? error.message : error instanceof Error ? error.message : String(error);
            errors.push(`${q.refId}: ${msg}`);
            frames.push(
              ...normalizeDataFrames(
                [
                  {
                    refId: q.refId,
                    name: "error",
                    length: 0,
                    fields: [],
                    meta: { error: msg }
                  }
                ],
                { refId: q.refId }
              )
            );
          }
        })
      );
      if (!frames.length && errors.length) {
        throw new DataSourceError("INVALID_RESPONSE", errors.join("; "));
      }
      return { data: frames };
    },
    async testDatasource(signal) {
      if (getBackendMode() === "offline") {
        return fallback.testDatasource?.() ?? {
          status: "success",
          message: "Offline fixture OK"
        };
      }
      if (!url) return { status: "error", message: "Datasource URL is empty" };
      try {
        await datasourceHttp({
          baseUrl: url,
          path: "/-/ready",
          method: "GET",
          uid: instance.uid,
          signal,
          timeoutMs: 1e4
        });
        return { status: "success", message: "Prometheus is ready" };
      } catch {
        try {
          await datasourceHttp({
            baseUrl: url,
            path: "/api/v1/labels",
            method: "GET",
            uid: instance.uid,
            signal,
            timeoutMs: 1e4
          });
          return { status: "success", message: "Prometheus API reachable" };
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          return { status: "error", message: msg };
        }
      }
    },
    async metricFindQuery(query, signal) {
      if (getBackendMode() === "offline") {
        return fallback.metricFindQuery?.(query) ?? [];
      }
      if (!url) return [];
      const cred = await getRuntimeCredential(instance.uid);
      const opts = {
        baseUrl: url,
        uid: instance.uid,
        credential: cred,
        signal
      };
      const q = String(query ?? "").trim();
      if (!q || /^metrics\s*\(/i.test(q) || q === "label_values(__name__)") {
        const names = await promMetricNames(opts);
        return names.map((n) => ({ text: n, value: n }));
      }
      const lv2 = q.match(/label_values\s*\(\s*([^,]+)\s*,\s*([a-z_]\w*)\s*\)/i);
      if (lv2) {
        const metric = lv2[1].trim().replaceAll(/^["']|["']$/g, "");
        const label = lv2[2].trim();
        const vals = await promLabelValues(
          opts,
          label,
          metric && metric !== label ? [metric] : void 0
        );
        return vals.map((v) => ({ text: v, value: v }));
      }
      const lv1 = q.match(/label_values\s*\(\s*([a-z_]\w*)\s*\)/i);
      if (lv1) {
        const vals = await promLabelValues(opts, lv1[1]);
        return vals.map((v) => ({ text: v, value: v }));
      }
      if (/label_names\s*\(/i.test(q)) {
        const names = await promLabelNames(opts);
        return names.map((n) => ({ text: n, value: n }));
      }
      return fallback.metricFindQuery?.(query) ?? [];
    },
    /** Prefetch helpers for QueryEditor metric browser */
    async listMetricNames(signal) {
      if (getBackendMode() === "offline") {
        return [
          "up",
          "process_cpu_seconds_total",
          "process_resident_memory_bytes",
          "http_requests_total",
          "http_request_duration_seconds_bucket",
          "node_cpu_seconds_total",
          "node_memory_MemAvailable_bytes",
          "container_cpu_usage_seconds_total",
          "container_memory_working_set_bytes",
          "go_goroutines"
        ];
      }
      if (!url) return [];
      const cred = await getRuntimeCredential(instance.uid);
      return promMetricNames({
        baseUrl: url,
        uid: instance.uid,
        credential: cred,
        signal
      });
    },
    async listLabelNames(signal) {
      if (getBackendMode() === "offline") {
        return ["__name__", "job", "instance", "namespace", "pod", "service", "status", "method"];
      }
      if (!url) return [];
      const cred = await getRuntimeCredential(instance.uid);
      return promLabelNames({
        baseUrl: url,
        uid: instance.uid,
        credential: cred,
        signal
      });
    }
  };
}
let factory$1 = null;
function registerPrometheusDataSourceFactory(fn) {
  factory$1 = fn;
}
function hasPrometheusDataSourceFactory() {
  return factory$1 != null;
}
function resetPrometheusDataSourceFactory() {
  factory$1 = null;
}
let factory = null;
function registerSignozDataSourceFactory(fn) {
  factory = fn;
}
function createSignozDataSource$1(instance, meta2) {
  if (!factory) {
    throw new Error(
      "SigNoz data source factory not registered — call registerHeavyPlugins() / load signoz module first"
    );
  }
  return factory(instance, meta2);
}
function hasSignozDataSourceFactory() {
  return factory != null;
}
function resetSignozDataSourceFactory() {
  factory = null;
}
function normalizeLokiQuery(q) {
  const instant = q.instant === true || q.queryType === "instant";
  return {
    refId: q.refId,
    expr: q.expr ?? "",
    legendFormat: q.legendFormat ?? "",
    maxLines: q.maxLines ?? 1e3,
    queryType: q.queryType ?? (instant ? "instant" : "range"),
    instant,
    range: instant ? false : q.range !== false,
    editorMode: q.editorMode ?? "code",
    resolution: q.resolution ?? 1,
    direction: q.direction ?? "backward",
    step: q.step,
    includePipelineOps: q.includePipelineOps !== false,
    datasource: q.datasource,
    hide: q.hide
  };
}
function isLokiMetricQuery(expr) {
  return /\b(rate|count_over_time|sum_over_time|avg_over_time|max_over_time|min_over_time|bytes_rate|bytes_over_time|quantile_over_time|first_over_time|last_over_time|stdvar_over_time|stddev_over_time|unwrap|topk|bottomk)\b/i.test(
    expr
  );
}
function formatLokiLegend(legendFormat, labels = {}) {
  if (!legendFormat) {
    const entries = Object.entries(labels).filter(
      ([k, v]) => k !== "__name__" && v != null && v !== ""
    );
    if (!entries.length) return "";
    if (entries.length === 1) return String(entries[0][1]);
    return `{${entries.map(([k, v]) => `${k}="${v}"`).join(", ")}}`;
  }
  return legendFormat.replaceAll(/\{\{\s*([a-z_]\w*)\s*\}\}/gi, (_, k) => labels[k] ?? "");
}
function extractByLabels(expr) {
  const m = expr.match(/\bby\s*\(\s*([^)]+)\s*\)/i);
  if (!m) return [];
  return m[1].split(",").map((s) => s.trim()).filter(Boolean);
}
function applyLokiPipelineOpsPreference(expr, include = true) {
  const raw = String(expr ?? "").trim();
  if (!raw || include !== false) return raw;
  const drop = /^(json|logfmt|pattern|regexp|unpack|line_format|label_format|unwrap|drop|keep|decolorize)\b/i;
  const keepLineFilter = /^(=|!=|~|!~)/;
  const parts = [];
  let buf = "";
  let depth = 0;
  let inStr = null;
  for (let i = 0; i < raw.length; i++) {
    const ch = raw[i];
    if (inStr) {
      buf += ch;
      if (ch === inStr && raw[i - 1] !== "\\") inStr = null;
      continue;
    }
    if (ch === '"' || ch === "'") {
      inStr = ch;
      buf += ch;
      continue;
    }
    if (ch === "(" || ch === "{" || ch === "[") depth++;
    if (ch === ")" || ch === "}" || ch === "]") depth = Math.max(0, depth - 1);
    if (ch === "|" && depth === 0) {
      parts.push(buf.trim());
      buf = "";
      continue;
    }
    buf += ch;
  }
  if (buf.trim()) parts.push(buf.trim());
  if (!parts.length) return raw;
  const kept = [parts[0]];
  for (const seg of parts.slice(1)) {
    const s = seg.trim();
    if (keepLineFilter.test(s) || s.startsWith("=") || s.startsWith("!=") || s.startsWith("~") || s.startsWith("!~")) {
      kept.push(s);
      continue;
    }
    if (drop.test(s)) continue;
    kept.push(s);
  }
  if (kept.length === 1) return kept[0];
  let out = kept[0];
  for (const seg of kept.slice(1)) {
    if (/^(=|!=|~|!~)/.test(seg)) out += `|${seg}`;
    else out += ` | ${seg}`;
  }
  return out;
}
function buildPrometheusQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      ...normalizePromQuery(q),
      datasource: {
        type: "prometheus",
        uid: opts.uid ?? q.datasource?.uid ?? "prometheus"
      },
      maxDataPoints: opts.maxDataPoints ?? 1100,
      intervalMs: opts.intervalMs ?? 15e3
    }))
  };
}
function buildLokiQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      ...normalizeLokiQuery(q),
      datasource: {
        type: "loki",
        uid: opts.uid ?? q.datasource?.uid ?? "loki"
      },
      maxDataPoints: opts.maxDataPoints ?? 1100,
      intervalMs: opts.intervalMs ?? 1e3
    }))
  };
}
function buildSqlQueryBody(type, queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      rawSql: String(q.rawSql ?? "SELECT 1"),
      format: Number(q.format ?? 1),
      rawQuery: true,
      datasource: { type, uid: opts.uid ?? type }
    }))
  };
}
function buildCloudWatchQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      queryMode: q.queryMode ?? "Metrics",
      region: q.region ?? "default",
      namespace: q.namespace ?? "AWS/EC2",
      metricName: q.metricName ?? "CPUUtilization",
      statistic: q.statistic ?? "Average",
      dimensions: q.dimensions ?? {},
      expression: q.expression ?? "",
      datasource: { type: "cloudwatch", uid: opts.uid ?? "cloudwatch" }
    }))
  };
}
function buildInfluxQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      query: String(q.query ?? ""),
      rawQuery: true,
      resultFormat: q.resultFormat ?? "time_series",
      policy: q.policy ?? "default",
      datasource: { type: "influxdb", uid: opts.uid ?? "influxdb" }
    }))
  };
}
function buildGraphiteQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      target: String(q.target ?? ""),
      textEditor: q.textEditor !== false,
      datasource: { type: "graphite", uid: opts.uid ?? "graphite" }
    }))
  };
}
function buildJaegerQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      query: String(q.query ?? q.service ?? ""),
      service: q.service,
      operation: q.operation,
      datasource: { type: "jaeger", uid: opts.uid ?? "jaeger" }
    }))
  };
}
function buildPyroscopeQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      profileTypeId: q.profileTypeId ?? "process_cpu:cpu:nanoseconds:cpu:nanoseconds",
      labelSelector: q.labelSelector ?? "{}",
      query: String(q.query ?? ""),
      groupBy: q.groupBy ?? [],
      datasource: {
        type: "grafana-pyroscope-datasource",
        uid: opts.uid ?? "pyroscope"
      }
    }))
  };
}
function buildTestDataQueryBody(queries, range, opts = {}) {
  return {
    from: String(range.from),
    to: String(range.to),
    queries: queries.map((q) => ({
      refId: q.refId,
      scenarioId: q.scenarioId ?? "random_walk",
      alias: q.alias ?? "",
      datasource: {
        type: "grafana-testdata-datasource",
        uid: opts.uid ?? "testdata"
      }
    }))
  };
}
function buildQueryBodyForType(type, queries, range, opts = {}) {
  switch (type) {
    case "prometheus":
      return buildPrometheusQueryBody(queries, range, opts);
    case "loki":
      return buildLokiQueryBody(queries, range, opts);
    case "mysql":
    case "mssql":
    case "grafana-postgresql-datasource":
      return buildSqlQueryBody(type, queries, range, opts);
    case "cloudwatch":
      return buildCloudWatchQueryBody(queries, range, opts);
    case "influxdb":
      return buildInfluxQueryBody(queries, range, opts);
    case "graphite":
      return buildGraphiteQueryBody(queries, range, opts);
    case "jaeger":
      return buildJaegerQueryBody(queries, range, opts);
    case "grafana-pyroscope-datasource":
      return buildPyroscopeQueryBody(queries, range, opts);
    case "grafana-testdata-datasource":
      return buildTestDataQueryBody(queries, range, opts);
    default:
      return {
        from: String(range.from),
        to: String(range.to),
        queries: queries.map((q) => ({
          ...q,
          datasource: { type, uid: opts.uid ?? type }
        }))
      };
  }
}
class LiveAcceptanceError extends Error {
  constructor(message2, code) {
    super(message2);
    this.code = code;
    this.name = "LiveAcceptanceError";
  }
  code;
}
function fieldValues$1(frame, name) {
  const field = frame.fields.find((f) => f.name === name);
  return field?.values ?? [];
}
function isEmptyValue(v) {
  return v == null || v === "" || typeof v === "string" && v.trim() === "";
}
function isTestDataUid(uid) {
  const lower = uid.toLowerCase();
  return lower.includes("testdata") || lower.includes("test-data") || lower === "td" || lower.startsWith("testdata-");
}
function isErrorFrame(frame) {
  if (frame.name === "error") return true;
  if (frame.meta && frame.meta.error) return true;
  return false;
}
function isRawFallbackFrame(frame) {
  if (frame.fields.length !== 1) return false;
  const n = String(frame.fields[0]?.name || "").toLowerCase();
  return n === "raw" || n === "payload";
}
function assertLiveFrames(opts) {
  const { frames, datasourceUid, requiredFields = [], requiredBusinessKey, minRows = 1 } = opts;
  if (!datasourceUid || typeof datasourceUid !== "string") {
    throw new LiveAcceptanceError("datasourceUid is required", "MISSING_DATASOURCE_UID");
  }
  if (isTestDataUid(datasourceUid)) {
    throw new LiveAcceptanceError(
      `TestData datasource uid rejected: ${datasourceUid}`,
      "TESTDATA_UID"
    );
  }
  if (!Array.isArray(frames) || frames.length === 0) {
    throw new LiveAcceptanceError("no frames returned", "EMPTY_FRAMES");
  }
  let totalRows = 0;
  for (const frame of frames) {
    if (isErrorFrame(frame)) {
      throw new LiveAcceptanceError("error frame is not live acceptance data", "ERROR_FRAME");
    }
    if (String(frame.name || "").toLowerCase().includes("random_walk")) {
      throw new LiveAcceptanceError(
        `synthetic frame name rejected: ${frame.name}`,
        "SYNTHETIC_NAME"
      );
    }
    const meta2 = frame.meta || {};
    if (meta2.offline === true) {
      throw new LiveAcceptanceError("offline frame rejected", "OFFLINE_FRAME");
    }
    if (meta2.source != null && meta2.source !== "live") {
      throw new LiveAcceptanceError(
        `frame source must be live, got ${String(meta2.source)}`,
        "NON_LIVE_SOURCE"
      );
    }
    if (meta2.source !== "live") {
      throw new LiveAcceptanceError('frame meta.source must be "live"', "MISSING_LIVE_SOURCE");
    }
    const frameUid = String(meta2.datasourceUid ?? meta2.uid ?? "");
    if (frameUid && isTestDataUid(frameUid)) {
      throw new LiveAcceptanceError(`TestData frame uid rejected: ${frameUid}`, "TESTDATA_UID");
    }
    if (frameUid && frameUid !== datasourceUid) {
      throw new LiveAcceptanceError(
        `frame datasourceUid ${frameUid} does not match expected ${datasourceUid}`,
        "UID_MISMATCH"
      );
    }
    if (isRawFallbackFrame(frame)) {
      throw new LiveAcceptanceError("raw/payload single-column fallback rejected", "RAW_FALLBACK");
    }
    const length = frame.length ?? Math.max(0, ...frame.fields.map((f) => f.values?.length ?? 0));
    totalRows += length;
    for (const req of requiredFields) {
      const f = frame.fields.find((x) => x.name === req);
      if (!f) {
        throw new LiveAcceptanceError(`missing required field: ${req}`, "MISSING_FIELD");
      }
    }
    if (requiredBusinessKey) {
      const values = fieldValues$1(frame, requiredBusinessKey);
      if (!values.length || values.every(isEmptyValue)) {
        throw new LiveAcceptanceError(
          `requiredBusinessKey ${requiredBusinessKey} is empty`,
          "EMPTY_BUSINESS_KEY"
        );
      }
    }
  }
  if (totalRows < minRows) {
    throw new LiveAcceptanceError(
      `expected at least ${minRows} rows, got ${totalRows}`,
      "INSUFFICIENT_ROWS"
    );
  }
}
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  DATASOURCE_IDS,
  DS_TYPE_LABELS,
  LiveAcceptanceError,
  assertLiveFrames,
  buildQueryBodyForType,
  catalogCoversDatasourceIds,
  computeStepMs,
  createBuiltinDataSourceApi,
  createPrometheusDataSource,
  createSignozDataSource: createSignozDataSource$1,
  defaultQueryForType,
  dsTypeBadge,
  dsTypeLabel,
  ensureDatasourceCatalogEntryRegistered,
  formatDurationProm,
  formatPromLegend,
  frameFingerprint,
  getBuiltinDatasourceCatalogEntry,
  hasPrometheusDataSourceFactory,
  hasSignozDataSourceFactory,
  interpolatePromMacros,
  interpolateQuery,
  isValidPromql,
  listBuiltinDatasourceCatalog,
  mapPrometheusResponse,
  normalizeDataFrames,
  normalizeDsType,
  parseDurationMs: parseDurationMs$1,
  parsePromqlToAst,
  queryFieldFamily,
  registerPrometheusDataSourceFactory,
  registerSignozDataSourceFactory,
  resetPrometheusDataSourceFactory,
  resetSignozDataSourceFactory,
  sanitizePromqlForLezer,
  switchQueryDatasource,
  wireResponseToDataFrames
}, Symbol.toStringTag, { value: "Module" }));
const REPEAT_RUNTIME_KEYS = ["scopedVars", "repeatValue", "repeatVar", "repeatPanelId"];
function isRepeatClone(panel2) {
  if (!panel2) return false;
  const origin = panel2.repeatPanelId;
  return origin != null && Number(origin) !== Number(panel2.id);
}
function resolveRepeatOriginId(panelOrId, panels2) {
  if (panelOrId == null) return null;
  if (typeof panelOrId === "number") {
    const found = panels2?.find((p) => Number(p.id) === Number(panelOrId));
    if (found) return resolveRepeatOriginId(found, panels2);
    if (panelOrId >= 1e3) {
      const origin2 = Math.floor(panelOrId / 1e3);
      if (origin2 > 0 && panelOrId !== origin2) return origin2;
    }
    return panelOrId;
  }
  const origin = panelOrId.repeatPanelId;
  if (origin != null && Number(origin) !== Number(panelOrId.id)) {
    return Number(origin);
  }
  return Number(panelOrId.id);
}
function sanitizePanelForPersist(panel2) {
  const originId = resolveRepeatOriginId(panel2);
  const next = { ...panel2, id: originId ?? panel2.id };
  for (const k of REPEAT_RUNTIME_KEYS) {
    delete next[k];
  }
  if (next.repeat === void 0) delete next.repeat;
  return next;
}
function findOriginPanel(id, documentPanels, expandedPanels) {
  const originId = resolveRepeatOriginId(id, expandedPanels ?? documentPanels);
  if (originId == null) return null;
  return documentPanels.find((p) => Number(p.id) === Number(originId)) ?? expandedPanels?.find((p) => Number(p.id) === Number(originId) && !isRepeatClone(p)) ?? null;
}
function widthBasedMaxDataPoints(gridW) {
  const w = Number.isFinite(Number(gridW)) ? Number(gridW) : 12;
  return Math.max(80, Math.min(320, w * 16));
}
function resolvePanelMaxDataPoints(panel2) {
  const raw = panel2?.maxDataPoints;
  const n = raw == null || raw === "" ? Number.NaN : Number(raw);
  if (Number.isFinite(n) && n > 0) return Math.floor(n);
  return widthBasedMaxDataPoints(panel2?.gridPos?.w);
}
function resolvePanelIntervalMs(panel2) {
  const raw = panel2?.interval;
  if (raw == null || String(raw).trim() === "") return void 0;
  const ms = intervalToMs(String(raw));
  return ms > 0 ? ms : void 0;
}
function resolvePanelCacheTimeout(panel2) {
  const raw = panel2?.cacheTimeout;
  if (raw == null) return void 0;
  const s = String(raw).trim();
  return s ? s : void 0;
}
function resolvePanelQueryCachingTTL(panel2) {
  const raw = panel2?.queryCachingTTL;
  if (raw != null && raw !== "") {
    const n = Number(raw);
    if (Number.isFinite(n) && n > 0) return Math.floor(n);
  }
  const ct = resolvePanelCacheTimeout(panel2);
  if (ct) {
    const ms = intervalToMs(ct);
    if (ms > 0) return ms;
  }
  return void 0;
}
function weekStartDow(weekStart, browserDefault = 1) {
  const s = String(weekStart ?? "").trim().toLowerCase();
  if (!s) return browserDefault;
  if (s === "sunday" || s === "sun") return 0;
  if (s === "saturday" || s === "sat") return 6;
  if (s === "monday" || s === "mon") return 1;
  return browserDefault;
}
function startOfWeekDate(now2, weekStart, browserDefault = 1) {
  const dow = weekStartDow(weekStart, browserDefault);
  const d = new Date(now2.getTime());
  d.setHours(0, 0, 0, 0);
  const current = d.getDay();
  const diff = (current - dow + 7) % 7;
  d.setDate(d.getDate() - diff);
  return d;
}
function isRelativeTimeRaw(raw) {
  return /now/i.test(String(raw ?? "").trim());
}
function normalizeTimeFromExpr(expr) {
  const raw = String(expr ?? "").trim();
  if (!raw) return null;
  if (/\s+to\s+/i.test(raw)) {
    const [a, b] = raw.split(/\s+to\s+/i);
    const from = String(a ?? "").trim();
    const to = String(b ?? "").trim();
    if (!from || !to) return null;
    return { from, to };
  }
  if (/^now/i.test(raw)) {
    return { from: raw, to: "now" };
  }
  if (raw.startsWith("+")) {
    return { from: "now", to: `now${raw}` };
  }
  if (/^\d/.test(raw)) {
    return { from: `now-${raw}`, to: "now" };
  }
  return { from: raw, to: "now" };
}
function isRelativeDashboardRange(range) {
  return isRelativeTimeRaw(range.raw?.from) || isRelativeTimeRaw(range.raw?.to);
}
function shiftDateBy(expr, date, roundUp = false) {
  const raw = String(expr ?? "").trim().replace(/^\+/, "");
  const normalized = raw.replace(/^-/, "");
  const ms = intervalToMs(normalized);
  if (!ms) return new Date(date);
  const out = new Date(date.getTime() - ms);
  return out;
}
function applyPanelTimeOverride(dashboardRange, panel2, now2 = /* @__PURE__ */ new Date(), parseOpts) {
  let range = {
    from: new Date(dashboardRange.from),
    to: new Date(dashboardRange.to),
    raw: {
      from: dashboardRange.raw?.from ?? dashboardRange.from,
      to: dashboardRange.raw?.to ?? dashboardRange.to
    }
  };
  const info = [];
  const timeFrom = String(panel2.timeFrom ?? "").trim();
  const timeShift2 = String(panel2.timeShift ?? "").trim();
  if (timeFrom) {
    const norm = normalizeTimeFromExpr(timeFrom);
    if (!norm) {
      return {
        range,
        timeInfo: "invalid time override",
        showOverride: panel2.hideTimeOverride !== true
      };
    }
    if (isRelativeDashboardRange(dashboardRange)) {
      range = rangeUtil_parse(norm, now2, parseOpts);
      info.push(timeFrom);
    }
  }
  if (timeShift2) {
    const shiftLabel = timeShift2.startsWith("-") ? timeShift2 : `-${timeShift2}`;
    info.push(`timeshift ${shiftLabel}`);
    const shiftExpr = timeShift2.replace(/^-/, "");
    if (isRelativeTimeRaw(range.raw?.from) || isRelativeTimeRaw(range.raw?.to)) {
      const fromRaw = String(range.raw?.from ?? "");
      const toRaw2 = String(range.raw?.to ?? "");
      const fromShifted = isRelativeTimeRaw(fromRaw) ? `${fromRaw}-${shiftExpr}`.replaceAll(/-{2,}/g, "-") : fromRaw;
      const toShifted = isRelativeTimeRaw(toRaw2) ? `${toRaw2}-${shiftExpr}`.replaceAll(/-{2,}/g, "-") : toRaw2;
      range = {
        from: shiftDateBy(shiftExpr, range.from, false),
        to: shiftDateBy(shiftExpr, range.to, true),
        raw: {
          from: isRelativeTimeRaw(fromRaw) ? fromShifted : range.from,
          to: isRelativeTimeRaw(toRaw2) ? toShifted : range.to
        }
      };
    } else {
      range = {
        from: shiftDateBy(shiftExpr, range.from, false),
        to: shiftDateBy(shiftExpr, range.to, true),
        raw: {
          from: range.from,
          to: range.to
        }
      };
    }
  }
  const active = info.length > 0;
  const joined = info.join(" + ");
  const timeInfo = joined ? joined.charAt(0).toUpperCase() + joined.slice(1) : "";
  return {
    range,
    timeInfo,
    showOverride: active && panel2.hideTimeOverride !== true
  };
}
class DashboardRefreshRuntime {
  generation = 0;
  pendingRerun = false;
  refreshing = false;
  annotationsEpoch = 0;
  getSnapshot() {
    return {
      generation: this.generation,
      pendingRerun: this.pendingRerun,
      refreshing: this.refreshing,
      annotationsEpoch: this.annotationsEpoch
    };
  }
  /** 开启一轮刷新；若已在刷新则只记 pendingRerun，返回当前 generation。 */
  begin() {
    if (this.refreshing) {
      this.pendingRerun = true;
      return this.generation;
    }
    this.generation += 1;
    this.refreshing = true;
    this.pendingRerun = false;
    return this.generation;
  }
  isCurrent(gen) {
    return gen === this.generation;
  }
  /**
   * 结束一轮。若仍有 pendingRerun，返回 true，调用方应立即再 begin。
   */
  end(gen) {
    if (gen !== this.generation) return false;
    this.refreshing = false;
    if (this.pendingRerun) {
      this.pendingRerun = false;
      return true;
    }
    return false;
  }
  requestRerun() {
    this.pendingRerun = true;
  }
  /**
   * 一轮完整 refresh：panels 与 annotations 并行，annotations 不阻塞 panel 启动。
   * 调用方仍负责 seed Loading 与 per-panel AbortController。
   */
  async runWave(deps, gen) {
    if (!this.isCurrent(gen)) return;
    const ann = deps.refreshAnnotations ? deps.refreshAnnotations().catch(() => {
    }) : Promise.resolve();
    await deps.refreshPanels();
    if (!this.isCurrent(gen)) return;
    await ann;
    if (!this.isCurrent(gen)) return;
    this.annotationsEpoch += 1;
    deps.attachAnnotations?.();
  }
  reset() {
    this.generation = 0;
    this.pendingRerun = false;
    this.refreshing = false;
    this.annotationsEpoch = 0;
  }
}
const _hoisted_1$2R = ["data-mode", "data-code-lang", "data-line-numbers", "data-mini-map"];
const _hoisted_2$2k = ["data-mode", "data-code-lang", "data-line-numbers", "data-mini-map", "innerHTML"];
const _hoisted_3$24 = {
  key: 0,
  class: "code-minimap",
  "data-testid": "text-code-minimap",
  "aria-hidden": "true"
};
const _sfc_main$3O = /* @__PURE__ */ defineComponent({
  __name: "TextRenderer",
  props: {
    options: {},
    title: {},
    replaceVariables: { type: Function },
    width: {},
    height: {},
    data: {},
    fieldConfig: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    function sanitize(html2) {
      return html2.replaceAll(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replaceAll(/\son\w+\s*=\s*(['"]).*?\1/gi, "").replaceAll(/javascript:/gi, "").replaceAll(/<iframe[\s\S]*?>[\s\S]*?<\/iframe>/gi, "");
    }
    function normalizeContentNewlines(content) {
      if (!content.includes("\\n")) return content;
      if (content.includes("\n")) return content;
      return content.replaceAll("\\n", "\n").replaceAll("\\t", "	");
    }
    function mdToHtml(src) {
      if (!src) return " ";
      let s = src.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
      s = s.replaceAll(
        /```([\s\S]*?)```/g,
        (_m, code) => `<pre><code>${code.replace(/^\n/, "")}</code></pre>`
      );
      s = s.replaceAll(/^### (.+)$/gm, "<h3>$1</h3>");
      s = s.replaceAll(/^## (.+)$/gm, "<h2>$1</h2>");
      s = s.replaceAll(/^# (.+)$/gm, "<h1>$1</h1>");
      s = s.replaceAll(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
      s = s.replaceAll(/\*(.+?)\*/g, "<em>$1</em>");
      s = s.replaceAll(/`([^`]+)`/g, "<code>$1</code>");
      s = s.replaceAll(
        /\[(.+?)\]\((https?:\/\/[^)]+)\)/g,
        '<a href="$2" rel="noreferrer" target="_blank">$1</a>'
      );
      const parts = s.split(/\n{2,}/);
      const html2 = parts.map((part) => {
        const trimmed = part.trim();
        if (!trimmed) return "";
        if (/^<(h[1-6]|pre|ul|ol|blockquote)/i.test(trimmed)) return trimmed.replaceAll("\n", " ");
        return `<p>${trimmed.replaceAll("\n", " ")}</p>`;
      }).join("");
      return html2 || " ";
    }
    function keywordsForLang(lang) {
      const l = lang.toLowerCase();
      if (l === "javascript" || l === "js" || l === "typescript" || l === "ts") {
        return [
          "const",
          "let",
          "var",
          "function",
          "return",
          "if",
          "else",
          "for",
          "while",
          "class",
          "import",
          "export",
          "from",
          "async",
          "await",
          "new",
          "typeof",
          "interface",
          "type",
          "extends",
          "implements",
          "public",
          "private"
        ];
      }
      if (l === "json") return [];
      if (l === "sql") {
        return [
          "select",
          "from",
          "where",
          "and",
          "or",
          "insert",
          "into",
          "update",
          "set",
          "delete",
          "join",
          "left",
          "right",
          "inner",
          "on",
          "group",
          "by",
          "order",
          "limit",
          "as",
          "in",
          "not",
          "null",
          "create",
          "table"
        ];
      }
      if (l === "python" || l === "py") {
        return [
          "def",
          "class",
          "return",
          "if",
          "elif",
          "else",
          "for",
          "while",
          "import",
          "from",
          "as",
          "with",
          "try",
          "except",
          "yield",
          "lambda",
          "True",
          "False",
          "None"
        ];
      }
      if (l === "yaml" || l === "yml") return [];
      if (l === "markdown" || l === "html" || l === "xml") return [];
      return [];
    }
    function highlightCodeLine(escapedLine, lang) {
      const l = lang.toLowerCase();
      const slots = [];
      const park = (html2) => {
        const i = slots.length;
        slots.push(html2);
        return `X${i}X`;
      };
      let s = escapedLine;
      s = s.replaceAll(
        /(&quot;|&#39;|")([^"&]*(?:&[^;]+;[^"&]*)*)(&quot;|&#39;|")/g,
        (_m, a, b, c) => park(`<span class="tok-str">${a}${b}${c}</span>`)
      );
      s = s.replaceAll(
        /(')([^']*)(')/g,
        (_m, a, b, c) => park(`<span class="tok-str">${a}${b}${c}</span>`)
      );
      if (l === "sql") {
        s = s.replaceAll(/(--.*)$/g, (_m, c) => park(`<span class="tok-comment">${c}</span>`));
      } else if (l === "python" || l === "py" || l === "yaml" || l === "yml") {
        s = s.replaceAll(/(#.*)$/g, (_m, c) => park(`<span class="tok-comment">${c}</span>`));
      } else {
        s = s.replaceAll(/(\/\/.*)$/g, (_m, c) => park(`<span class="tok-comment">${c}</span>`));
      }
      if (l === "json") {
        s = s.replaceAll(
          /(&quot;|")([^"&]+)(&quot;|")(\s*:)/g,
          (_m, a, b, c, d) => park(`<span class="tok-key">${a}${b}${c}</span>`) + d
        );
      }
      const kws = keywordsForLang(l);
      if (kws.length) {
        const re = new RegExp(`\\b(${kws.join("|")})\\b`, "gi");
        s = s.replace(re, '<span class="tok-kw">$1</span>');
      }
      s = s.replaceAll(/\b(-?\d+(?:\.\d+)?)\b/g, '<span class="tok-num">$1</span>');
      s = s.replaceAll(/\uE000X(\d+)X\uE001/g, (_m, i) => slots[Number(i)] ?? "");
      return s;
    }
    function highlightCodeBlock(escaped, lang) {
      if (!lang || lang === "plaintext" || lang === "plain" || lang === "text") {
        return escaped;
      }
      return escaped.split("\n").map((line) => highlightCodeLine(line, lang)).join("\n");
    }
    const showMiniMap = computed(() => {
      const mode2 = String(opts.value.mode ?? "markdown");
      if (mode2 !== "code") return false;
      return Boolean(opts.value.code?.showMiniMap ?? opts.value["code.showMiniMap"]);
    });
    const codeLines = computed(() => {
      if (String(opts.value.mode ?? "markdown") !== "code") return [];
      let content = String(opts.value.content ?? "");
      if (props.replaceVariables) content = props.replaceVariables(content);
      content = normalizeContentNewlines(content);
      return content.split("\n");
    });
    const html = computed(() => {
      const mode2 = String(opts.value.mode ?? "markdown");
      let content = String(opts.value.content ?? "");
      if (props.replaceVariables) content = props.replaceVariables(content);
      content = normalizeContentNewlines(content);
      if (!content) return " ";
      if (mode2 === "html") return sanitize(content);
      if (mode2 === "code") {
        const lang = String(opts.value.code?.language ?? opts.value["code.language"] ?? "plaintext");
        const showLines = opts.value.code?.showLineNumbers ?? opts.value["code.showLineNumbers"];
        const escaped = content.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
        const highlighted = highlightCodeBlock(escaped, lang);
        const langClass = `lang-${lang.replaceAll(/[^\w-]/g, "").toLowerCase() || "plaintext"}`;
        if (showLines) {
          const lines = highlighted.split("\n");
          const body = lines.map(
            (line, i) => `<div class="code-line"><span class="ln">${i + 1}</span><span class="lc">${line || " "}</span></div>`
          ).join("");
          return `<pre data-lang="${lang}" data-highlighted="true" class="code-block with-lines ${langClass}"><code>${body}</code></pre>`;
        }
        return `<pre data-lang="${lang}" data-highlighted="true" class="code-block ${langClass}"><code>${highlighted}</code></pre>`;
      }
      return sanitize(mdToHtml(content));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "text-panel-host",
        "data-testid": "panel-text",
        "data-mode": String(opts.value.mode ?? "markdown"),
        "data-code-lang": String(opts.value.code?.language ?? opts.value["code.language"] ?? ""),
        "data-line-numbers": String(!!(opts.value.code?.showLineNumbers ?? opts.value["code.showLineNumbers"])),
        "data-mini-map": String(showMiniMap.value)
      }, [
        createElementVNode("div", {
          class: "text-panel markdown-html",
          "data-testid": "panel-text-content",
          "data-testid-grafana": "TextPanel-converted-content",
          "data-mode": String(opts.value.mode ?? "markdown"),
          "data-code-lang": String(opts.value.code?.language ?? opts.value["code.language"] ?? ""),
          "data-line-numbers": String(!!(opts.value.code?.showLineNumbers ?? opts.value["code.showLineNumbers"])),
          "data-mini-map": String(showMiniMap.value),
          role: "region",
          "aria-label": "Text panel",
          tabindex: "0",
          innerHTML: html.value
        }, null, 8, _hoisted_2$2k),
        createCommentVNode(" Grafana code editor mini-map: density overview of lines "),
        showMiniMap.value ? (openBlock(), createElementBlock("aside", _hoisted_3$24, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(codeLines.value, (line, i) => {
              return openBlock(), createElementBlock(
                "div",
                {
                  key: i,
                  class: "mm-line",
                  style: normalizeStyle({ opacity: line.trim() ? 0.55 : 0.15 })
                },
                null,
                4
                /* STYLE */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2R);
    };
  }
});
const TextRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3O, [["__scopeId", "data-v-e4205d69"]]);
const _sfc_main$3N = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(TextRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  { id: "text", name: "文本", state: "stable", skipDataQuery: true },
  _sfc_main$3N
).setPanelOptions((builder) => {
  builder.addRadio(
    {
      id: "mode",
      path: "mode",
      name: "模式",
      category: ["文本"],
      editor: "radio",
      settings: {
        options: [
          { label: "Markdown", value: "markdown" },
          { label: "HTML", value: "html" },
          { label: "代码", value: "code" }
        ]
      }
    },
    "markdown"
  ).addTextArea(
    {
      id: "content",
      path: "content",
      name: "内容",
      category: ["文本"],
      editor: "textarea"
    },
    `# Title

For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)`
  ).addSelect(
    {
      id: "code.language",
      path: "code.language",
      name: "语言",
      category: ["代码"],
      editor: "select",
      settings: {
        options: [
          { label: "go", value: "go" },
          { label: "html", value: "html" },
          { label: "json", value: "json" },
          { label: "markdown", value: "markdown" },
          { label: "plaintext", value: "plaintext" },
          { label: "sql", value: "sql" },
          { label: "typescript", value: "typescript" },
          { label: "xml", value: "xml" },
          { label: "yaml", value: "yaml" }
        ]
      },
      showIf: (c) => c.mode === "code"
    },
    "plaintext"
  ).addBoolean(
    {
      id: "code.showLineNumbers",
      path: "code.showLineNumbers",
      name: "显示行号",
      category: ["代码"],
      editor: "boolean",
      showIf: (c) => c.mode === "code"
    },
    false
  ).addBoolean(
    {
      id: "code.showMiniMap",
      path: "code.showMiniMap",
      name: "显示缩略图",
      category: ["代码"],
      editor: "boolean",
      showIf: (c) => c.mode === "code"
    },
    false
  );
}).setRuntimeConsumedPaths([
  "mode",
  "content",
  "code.language",
  "code.showLineNumbers",
  "code.showMiniMap"
]).register();
const _hoisted_1$2Q = ["data-feed-url", "data-show-image", "data-loading", "data-item-count"];
const _hoisted_2$2j = {
  key: 0,
  class: "alert",
  "data-testid": "news-error",
  role: "alert"
};
const _hoisted_3$23 = {
  key: 1,
  class: "loading",
  "data-testid": "news-loading"
};
const _hoisted_4$1N = {
  key: 2,
  class: "scroll",
  "data-testid": "news-list"
};
const _hoisted_5$1A = ["href"];
const _hoisted_6$1n = ["src", "alt"];
const _hoisted_7$1d = { class: "body" };
const _hoisted_8$15 = ["datetime"];
const _hoisted_9$10 = { class: "title" };
const _hoisted_10$S = ["href"];
const _hoisted_11$N = {
  class: "content",
  "data-testid": "news-content"
};
const DEFAULT_FEED_URL = "https://grafana.com/blog/news.xml";
const _sfc_main$3M = /* @__PURE__ */ defineComponent({
  __name: "NewsRenderer",
  props: {
    options: {},
    width: {}
  },
  setup(__props, { expose: __expose }) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const feedUrl = computed(() => {
      const raw = opts.value.feedUrl ?? opts.value.url;
      const s = typeof raw === "string" && raw.trim() ? raw.trim() : DEFAULT_FEED_URL;
      return s;
    });
    const showImage = computed(() => opts.value.showImage !== false);
    const useWideLayout = computed(() => (props.width ?? 0) > 600);
    const loading = ref(true);
    const error = ref(null);
    const items = ref([]);
    function getProperty(node, property) {
      return node.querySelector(property)?.textContent ?? "";
    }
    function parseFeed(txt) {
      const doc = new DOMParser().parseFromString(txt, "text/xml");
      const isAtom = !!doc.querySelector("feed");
      if (isAtom) {
        return Array.from(doc.querySelectorAll("entry")).map((node) => {
          const link = node.querySelector("link[href]")?.getAttribute("href") || node.querySelector("link")?.textContent || "#";
          const pub = getProperty(node, "updated") || getProperty(node, "published");
          return {
            title: getProperty(node, "title"),
            link,
            content: getProperty(node, "summary") || getProperty(node, "content"),
            date: Date.parse(pub) || 0,
            ogImage: node.querySelector("meta[property='og:image']")?.getAttribute("content") || void 0
          };
        });
      }
      return Array.from(doc.querySelectorAll("item")).map((node) => {
        const pub = getProperty(node, "pubDate");
        const content = getProperty(node, "description").replaceAll(/<[^>]+(>|$)/g, "");
        return {
          title: getProperty(node, "title"),
          link: getProperty(node, "link"),
          content,
          date: Date.parse(pub) || 0,
          ogImage: node.querySelector("meta[property='og:image']")?.getAttribute("content") || void 0
        };
      });
    }
    function formatNewsDate(ms) {
      if (!ms) return "";
      const d = new Date(ms);
      return d.toLocaleDateString("en-US", { month: "short", day: "2-digit" }).replace(",", "");
    }
    async function load() {
      loading.value = true;
      error.value = null;
      items.value = [];
      try {
        const axiosRes = await getResourceHttp().request({
          url: feedUrl.value,
          method: "GET",
          responseType: "text",
          // Keep empty/error chrome snappy for offline demos (Grafana fails fast on CORS).
          timeout: 4e3
        });
        if (axiosRes.status < 200 || axiosRes.status >= 300) throw new Error(`HTTP ${axiosRes.status}`);
        const txt = typeof axiosRes.data === "string" ? axiosRes.data : String(axiosRes.data ?? "");
        items.value = parseFeed(txt);
      } catch (error_) {
        error.value = error_?.message || String(error_);
      } finally {
        loading.value = false;
      }
    }
    onMounted(load);
    watch(feedUrl, load);
    __expose({ loading, error, items });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "news",
        "data-testid": "panel-news",
        "data-feed-url": feedUrl.value,
        "data-show-image": String(showImage.value),
        "data-loading": loading.value ? "1" : "0",
        "data-item-count": String(items.value.length)
      }, [
        error.value ? (openBlock(), createElementBlock("div", _hoisted_2$2j, [..._cache[0] || (_cache[0] = [
          createElementVNode(
            "div",
            { class: "alert-title" },
            "加载 RSS 源时出错",
            -1
            /* CACHED */
          ),
          createElementVNode(
            "div",
            { class: "alert-body" },
            [
              createTextVNode(" 请确保订阅源网址正确无误，并且在服务器上正确配置了 CORS。请参阅 "),
              createElementVNode("a", {
                class: "doc-link",
                href: "https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/news/",
                target: "_blank",
                rel: "noreferrer"
              }, "新闻面板文档"),
              createTextVNode("。 ")
            ],
            -1
            /* CACHED */
          )
        ])])) : loading.value ? (openBlock(), createElementBlock("div", _hoisted_3$23, "加载中...")) : (openBlock(), createElementBlock("div", _hoisted_4$1N, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(items.value, (it, index2) => {
              return openBlock(), createElementBlock(
                "article",
                {
                  key: `${index2}-${it.link}`,
                  class: normalizeClass(["item", { wide: useWideLayout.value }]),
                  "data-testid": "news-item"
                },
                [
                  showImage.value && it.ogImage ? (openBlock(), createElementBlock("a", {
                    key: 0,
                    class: normalizeClass(["social-image", { wide: useWideLayout.value }]),
                    href: it.link,
                    target: "_blank",
                    rel: "noopener noreferrer",
                    tabindex: "-1",
                    "aria-hidden": "true"
                  }, [
                    createElementVNode("img", {
                      src: it.ogImage,
                      alt: it.title,
                      "data-testid": "news-image"
                    }, null, 8, _hoisted_6$1n)
                  ], 10, _hoisted_5$1A)) : createCommentVNode("v-if", true),
                  createElementVNode("div", _hoisted_7$1d, [
                    createElementVNode("time", {
                      class: "date",
                      datetime: formatNewsDate(it.date)
                    }, toDisplayString(formatNewsDate(it.date)) + " ", 9, _hoisted_8$15),
                    createElementVNode("h1", _hoisted_9$10, [
                      createElementVNode("a", {
                        class: "title-link",
                        href: it.link,
                        target: "_blank",
                        rel: "noreferrer"
                      }, toDisplayString(it.title), 9, _hoisted_10$S)
                    ]),
                    createElementVNode(
                      "div",
                      _hoisted_11$N,
                      toDisplayString(it.content),
                      1
                      /* TEXT */
                    )
                  ])
                ],
                2
                /* CLASS */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]))
      ], 8, _hoisted_1$2Q);
    };
  }
});
const NewsRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3M, [["__scopeId", "data-v-32d4690d"]]);
const _sfc_main$3L = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(NewsRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  { id: "news", name: "新闻", state: "stable", skipDataQuery: true },
  _sfc_main$3L
).setPanelOptions((builder) => {
  const category = ["新闻"];
  builder.addText(
    {
      id: "feedUrl",
      path: "feedUrl",
      name: "订阅源 URL",
      category
    },
    "https://grafana.com/blog/news.xml"
  ).addBoolean(
    {
      id: "showImage",
      path: "showImage",
      name: "显示图片",
      category
    },
    true
  );
}).setRuntimeConsumedPaths(["feedUrl", "showImage"]).register();
const _hoisted_1$2P = ["data-folder-uid", "data-include-vars", "data-keep-time", "data-show-folder-names", "data-show-headings", "data-max-items", "data-show-folder", "data-show-starred", "data-show-recent", "data-show-search", "data-query", "data-tags", "data-item-count"];
const _hoisted_2$2i = {
  key: 0,
  class: "empty-state",
  "data-testid": "dashlist-empty"
};
const _hoisted_3$22 = {
  key: 1,
  class: "group",
  "data-testid": "dashlist-starred"
};
const _hoisted_4$1M = {
  key: 0,
  class: "heading",
  "data-testid": "dashlist-header"
};
const _hoisted_5$1z = ["href"];
const _hoisted_6$1m = {
  key: 0,
  class: "folder"
};
const _hoisted_7$1c = {
  key: 2,
  class: "group",
  "data-testid": "dashlist-recent"
};
const _hoisted_8$14 = {
  key: 0,
  class: "heading",
  "data-testid": "dashlist-header"
};
const _hoisted_9$$ = ["href"];
const _hoisted_10$R = {
  key: 0,
  class: "folder"
};
const _hoisted_11$M = {
  key: 3,
  class: "group",
  "data-testid": "dashlist-search-results"
};
const _hoisted_12$G = {
  key: 0,
  class: "heading",
  "data-testid": "dashlist-header"
};
const _hoisted_13$F = ["href"];
const _hoisted_14$A = {
  key: 0,
  class: "folder"
};
const _sfc_main$3K = /* @__PURE__ */ defineComponent({
  __name: "DashListRenderer",
  props: {
    options: {},
    replaceVariables: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const replace = (s) => props.replaceVariables ? props.replaceVariables(s) : s;
    const maxItems = computed(() => Number(opts.value.maxItems ?? 10));
    const query = computed(() => String(opts.value.query ?? ""));
    const showHeadings = computed(() => opts.value.showHeadings !== false);
    const showFolderNames = computed(() => opts.value.showFolderNames !== false);
    const showStarred = computed(() => opts.value.showStarred !== false);
    const showRecentlyViewed = computed(() => opts.value.showRecentlyViewed === true);
    const showSearch = computed(() => opts.value.showSearch === true);
    const keepTime = computed(() => opts.value.keepTime === true);
    const includeVars = computed(() => opts.value.includeVars === true);
    const folderUID = computed(() => {
      const v = opts.value.folderUID;
      return v == null || v === "" ? "" : String(v);
    });
    const tags = computed(() => {
      const t2 = opts.value.tags;
      if (Array.isArray(t2)) return t2.map(String);
      return String(t2 || "").split(",").map((s) => s.trim()).filter(Boolean);
    });
    const starred = ref([]);
    const recent = ref([]);
    const searched = ref([]);
    const loading = ref(false);
    function mapDash(d, flags2 = {}) {
      return {
        uid: String(d.uid ?? ""),
        title: String(d.title ?? d.name ?? d.uid ?? ""),
        url: String(d.url || `/d/${d.uid}`),
        folderTitle: d.folderTitle || d.folder || "",
        folderUID: d.folderUID != null && d.folderUID !== "" ? String(d.folderUID) : d.folderUid != null && d.folderUid !== "" ? String(d.folderUid) : void 0,
        tags: d.tags || [],
        starred: !!d.isStarred || !!d.starred || !!flags2.starred,
        ...flags2
      };
    }
    function refineItems(items, opts2) {
      let list = items.slice();
      const q = String(opts2.query ?? "").trim().toLowerCase();
      if (q) {
        list = list.filter(
          (it) => it.title.toLowerCase().includes(q) || it.uid.toLowerCase().includes(q)
        );
      }
      const tagNeed = (opts2.tags ?? []).map((s) => s.toLowerCase()).filter(Boolean);
      if (tagNeed.length) {
        list = list.filter((it) => {
          const have = (it.tags ?? []).map((x) => String(x).toLowerCase());
          return tagNeed.every((t2) => have.includes(t2));
        });
      }
      const folder = String(opts2.folderUID ?? "").trim();
      if (folder) {
        list = list.filter((it) => {
          const f = String(it.folderUID ?? it.folder ?? it.folderTitle ?? "");
          return f === folder || String(it.folderTitle ?? "") === folder;
        });
      }
      return list.slice(0, Math.max(0, opts2.limit));
    }
    async function load() {
      loading.value = true;
      try {
        const tasks = [];
        if (showStarred.value) {
          tasks.push(
            (async () => {
              try {
                const res = await backendSrv.get("/api/search", {
                  type: "dash-db",
                  limit: maxItems.value,
                  starred: "true"
                });
                const raw = Array.isArray(res.data) ? res.data : res.data?.dashboards ?? [];
                starred.value = raw.map((d) => mapDash(d)).slice(0, maxItems.value);
              } catch {
                starred.value = [];
              }
            })()
          );
        } else {
          starred.value = [];
        }
        if (showRecentlyViewed.value) {
          tasks.push(
            (async () => {
              try {
                const res = await backendSrv.get("/api/search", {
                  type: "dash-db",
                  limit: maxItems.value
                });
                const raw = Array.isArray(res.data) ? res.data : res.data?.dashboards ?? [];
                recent.value = raw.map((d) => mapDash(d)).slice(0, maxItems.value);
              } catch {
                recent.value = [];
              }
            })()
          );
        } else {
          recent.value = [];
        }
        if (showSearch.value) {
          tasks.push(
            (async () => {
              try {
                const res = await backendSrv.get("/api/search", {
                  type: "dash-db",
                  limit: maxItems.value,
                  query: replace(query.value) || void 0,
                  folderUIDs: folderUID.value || void 0,
                  tag: tags.value.length ? tags.value.map(replace).join(",") : void 0
                });
                const raw = Array.isArray(res.data) ? res.data : res.data?.dashboards ?? [];
                searched.value = refineItems(
                  raw.map((d) => mapDash(d)),
                  {
                    query: replace(query.value),
                    tags: tags.value.map(replace),
                    folderUID: folderUID.value,
                    limit: maxItems.value
                  }
                );
              } catch {
                searched.value = [];
              }
            })()
          );
        } else {
          searched.value = [];
        }
        await Promise.all(tasks);
      } finally {
        loading.value = false;
      }
    }
    onMounted(load);
    watch(
      [
        maxItems,
        query,
        folderUID,
        tags,
        showStarred,
        showRecentlyViewed,
        showSearch,
        showHeadings,
        showFolderNames
      ],
      load
    );
    function withQuery(url) {
      const parts = [];
      if (keepTime.value) parts.push("from=now-6h", "to=now");
      if (includeVars.value) parts.push("var-all=1");
      if (!parts.length) return url;
      return url.includes("?") ? `${url}&${parts.join("&")}` : `${url}?${parts.join("&")}`;
    }
    const showEmptyState = computed(
      () => !showStarred.value && !showRecentlyViewed.value && !showSearch.value
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "dashlist",
        "data-testid": "panel-dashlist",
        "data-folder-uid": String(folderUID.value ?? ""),
        "data-include-vars": String(!!opts.value.includeVars),
        "data-keep-time": String(!!opts.value.keepTime),
        "data-show-folder-names": String(showFolderNames.value),
        "data-show-headings": String(showHeadings.value),
        "data-max-items": String(maxItems.value),
        "data-show-folder": String(showFolderNames.value),
        "data-show-starred": String(showStarred.value),
        "data-show-recent": String(showRecentlyViewed.value),
        "data-show-search": String(showSearch.value),
        "data-query": String(query.value),
        "data-tags": tags.value.join(","),
        "data-item-count": String(starred.value.length + recent.value.length + searched.value.length)
      }, [
        showEmptyState.value ? (openBlock(), createElementBlock("div", _hoisted_2$2i, " 未配置数据面板组 ")) : createCommentVNode("v-if", true),
        createCommentVNode(" Starred group (always render section when enabled, even if empty — Grafana keeps empty <ul>) "),
        showStarred.value ? (openBlock(), createElementBlock("section", _hoisted_3$22, [
          showHeadings.value ? (openBlock(), createElementBlock("div", _hoisted_4$1M, " 已加星标的数据面板 ")) : createCommentVNode("v-if", true),
          createElementVNode("ul", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(starred.value, (it) => {
                return openBlock(), createElementBlock("li", {
                  key: `s${it.uid}`,
                  "data-testid": "dashlist-item"
                }, [
                  createElementVNode("a", {
                    class: "link",
                    href: withQuery(it.url)
                  }, toDisplayString(it.title), 9, _hoisted_5$1z),
                  showFolderNames.value && it.folderTitle ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_6$1m,
                    toDisplayString(it.folderTitle),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true),
        showRecentlyViewed.value ? (openBlock(), createElementBlock("section", _hoisted_7$1c, [
          showHeadings.value ? (openBlock(), createElementBlock("div", _hoisted_8$14, " 最近查看的数据面板 ")) : createCommentVNode("v-if", true),
          createElementVNode("ul", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(recent.value, (it) => {
                return openBlock(), createElementBlock("li", {
                  key: `r${it.uid}`,
                  "data-testid": "dashlist-item"
                }, [
                  createElementVNode("a", {
                    class: "link",
                    href: withQuery(it.url)
                  }, toDisplayString(it.title), 9, _hoisted_9$$),
                  showFolderNames.value && it.folderTitle ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_10$R,
                    toDisplayString(it.folderTitle),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true),
        showSearch.value ? (openBlock(), createElementBlock("section", _hoisted_11$M, [
          showHeadings.value ? (openBlock(), createElementBlock("div", _hoisted_12$G, "搜索")) : createCommentVNode("v-if", true),
          createElementVNode("ul", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(searched.value, (it) => {
                return openBlock(), createElementBlock("li", {
                  key: `q${it.uid}`,
                  "data-testid": "dashlist-item"
                }, [
                  createElementVNode("a", {
                    class: "link",
                    href: withQuery(it.url)
                  }, toDisplayString(it.title), 9, _hoisted_13$F),
                  showFolderNames.value && it.folderTitle ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_14$A,
                    toDisplayString(it.folderTitle),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2P);
    };
  }
});
const DashListRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3K, [["__scopeId", "data-v-ae9ad0b8"]]);
const _sfc_main$3J = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(DashListRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "dashlist",
    name: "仪表盘列表",
    description: "星标 / 最近 / 搜索仪表盘",
    state: "stable",
    skipDataQuery: true
  },
  _sfc_main$3J
).setPanelOptions((builder) => {
  const cat = ["仪表盘列表"];
  builder.addBoolean(
    {
      id: "keepTime",
      path: "keepTime",
      name: "包含当前时间范围",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "includeVars",
      path: "includeVars",
      name: "包含当前模板变量",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "showStarred",
      path: "showStarred",
      name: "星标",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showRecentlyViewed",
      path: "showRecentlyViewed",
      name: "最近查看",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "showSearch",
      path: "showSearch",
      name: "搜索",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "showHeadings",
      path: "showHeadings",
      name: "显示标题",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showFolderNames",
      path: "showFolderNames",
      name: "显示文件夹名",
      category: cat
    },
    true
  ).addNumber(
    {
      id: "maxItems",
      path: "maxItems",
      name: "最大条目",
      category: cat,
      settings: { min: 1 }
    },
    10
  ).addText(
    {
      id: "query",
      path: "query",
      name: "查询",
      category: cat,
      showIf: (c) => !!c.showSearch
    },
    ""
  ).addText(
    {
      id: "folderUID",
      path: "folderUID",
      name: "文件夹 UID",
      category: cat,
      showIf: (c) => !!c.showSearch
    },
    void 0
  ).addText(
    {
      id: "tags",
      path: "tags",
      name: "标签",
      description: "逗号分隔或 JSON 数组",
      category: cat,
      showIf: (c) => !!c.showSearch
    },
    // Grafana defaultOptions.tags = []
    []
  );
}).setRuntimeConsumedPaths([
  "folderUID",
  "includeVars",
  "keepTime",
  "maxItems",
  "query",
  "showFolderNames",
  "showHeadings",
  "showRecentlyViewed",
  "showSearch",
  "showStarred",
  "tags"
]).register();
const _hoisted_1$2O = ["data-limit", "data-only-in-range", "data-only-this-dash", "data-show-time", "data-show-tags", "data-show-user", "data-navigate", "data-nav-before", "data-nav-after", "data-row-count"];
const _hoisted_2$2h = {
  key: 0,
  class: "filter-bar",
  "data-testid": "annolist-filter-bar"
};
const _hoisted_3$21 = { class: "meta-line" };
const _hoisted_4$1L = {
  key: 0,
  class: "time"
};
const _hoisted_5$1y = {
  key: 1,
  class: "user",
  "data-testid": "annolist-user"
};
const _hoisted_6$1l = { class: "text" };
const _hoisted_7$1b = ["href", "onClick"];
const _hoisted_8$13 = {
  key: 0,
  class: "tags"
};
const _hoisted_9$_ = {
  key: 1,
  class: "empty",
  "data-testid": "annolist-empty"
};
const _sfc_main$3I = /* @__PURE__ */ defineComponent({
  __name: "AnnoListRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {},
    replaceVariables: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const tagFilter = ref("");
    const hasFilter = computed(() => {
      if (tagFilter.value.trim()) return true;
      const tags = opts.value.tags;
      if (Array.isArray(tags) && tags.length) return true;
      if (typeof tags === "string" && tags.trim()) return true;
      return false;
    });
    const allRows = computed(() => {
      const limit = Number(opts.value.limit ?? 10);
      const onlyInTimeRange = opts.value.onlyInTimeRange !== false && opts.value.onlyInTimeRange !== "false";
      const onlyThisDash = opts.value.onlyFromThisDashboard === true || opts.value.onlyFromThisDashboard === "true" || opts.value.onlyFromThisDashboard === "yes";
      const from = props.data?.timeRange?.from?.getTime?.() ?? 0;
      const to = props.data?.timeRange?.to?.getTime?.() ?? Date.now();
      const navPanel = opts.value.navigateToPanel === false || opts.value.navigateToPanel === "dashboard" || opts.value.navigateToPanel === "false" ? false : true;
      const req = props.data?.request ?? {};
      let dashUid = String(
        req.dashboardUID ?? req.dashboardUid ?? props.data?.dashboardUID ?? props.data?.meta?.dashboardUID ?? ""
      ).trim();
      if (!dashUid && props.replaceVariables) {
        const via = String(
          props.replaceVariables("${__dashboard.uid}") || props.replaceVariables("$__dashboard.uid") || ""
        ).trim();
        if (via && !via.includes("${") && !via.includes("$__")) dashUid = via;
      }
      const annos = props.data?.annotations ?? [];
      return annos.filter((a) => {
        if (onlyInTimeRange && !(a.time >= from && a.time <= to)) return false;
        if (onlyThisDash && dashUid) {
          const aUid = String(
            a.dashboardUID ?? a.dashboardUid ?? a.dashboardId ?? ""
          ).trim();
          if (aUid && aUid !== dashUid) return false;
        }
        return true;
      }).slice(0, limit).map((a) => ({
        time: opts.value.showTime === false ? "" : new Date(a.time).toISOString(),
        timeMs: a.time,
        text: a.title || a.text || "",
        tags: (a.tags ?? []).join(","),
        user: String(a.login || a.user || a.email || ""),
        panelId: a.panelId,
        dashboardUID: a.dashboardUID,
        navigateToPanel: navPanel
      }));
    });
    function parseDurationMs2(raw) {
      const s = String(raw || "").trim();
      const m = s.match(/^(\d+)(ms|[smhd])?$/i);
      if (!m) return 0;
      const n = Number(m[1]);
      const u = (m[2] || "s").toLowerCase();
      if (u === "ms") return n;
      if (u === "s") return n * 1e3;
      if (u === "m") return n * 6e4;
      if (u === "h") return n * 36e5;
      if (u === "d") return n * 864e5;
      return n;
    }
    function navRange(r) {
      const before = parseDurationMs2(String(opts.value.navigateBefore ?? "10m"));
      const after = parseDurationMs2(String(opts.value.navigateAfter ?? "10m"));
      const from = new Date(r.timeMs - before).toISOString();
      const to = new Date(r.timeMs + after).toISOString();
      return { from, to };
    }
    function navHref(r) {
      const { from, to } = navRange(r);
      if (r.navigateToPanel && r.panelId != null) {
        return `?viewPanel=${r.panelId}&from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}`;
      }
      return `?from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}`;
    }
    function onNavClick(r, ev) {
      if (ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey || ev.button !== 0) {
        return;
      }
      const { from, to } = navRange(r);
      try {
        window.dispatchEvent(
          new CustomEvent("grafana-vue:set-time", {
            detail: { from, to, source: "annolist" }
          })
        );
      } catch {
      }
      ev.preventDefault();
    }
    const rows = computed(() => {
      const limit = Number(opts.value.limit ?? 10);
      let list = allRows.value;
      const q = tagFilter.value.trim().toLowerCase();
      if (q)
        list = list.filter(
          (r) => r.tags.toLowerCase().includes(q) || r.text.toLowerCase().includes(q) || r.user.toLowerCase().includes(q)
        );
      const filterTags = Array.isArray(opts.value.tags) ? opts.value.tags.map(String) : String(opts.value.tags || "").split(",").map((t2) => t2.trim()).filter(Boolean);
      if (filterTags.length) {
        list = list.filter((r) => {
          const rowTags = r.tags.split(",").map((x) => x.trim());
          return filterTags.every((t2) => rowTags.includes(t2));
        });
      }
      return list.slice(0, limit);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "annolist",
        "data-testid": "panel-annolist",
        "data-limit": String(opts.value.limit ?? 10),
        "data-only-in-range": String(opts.value.onlyInTimeRange !== false),
        "data-only-this-dash": String(!!opts.value.onlyFromThisDashboard && opts.value.onlyFromThisDashboard !== false),
        "data-show-time": String(opts.value.showTime !== false),
        "data-show-tags": String(opts.value.showTags !== false),
        "data-show-user": String(opts.value.showUser !== false),
        "data-navigate": String(opts.value.navigateToPanel !== false && opts.value.navigateToPanel !== "dashboard"),
        "data-nav-before": String(opts.value.navigateBefore ?? "10m"),
        "data-nav-after": String(opts.value.navigateAfter ?? "10m"),
        "data-row-count": String(rows.value.length)
      }, [
        hasFilter.value ? (openBlock(), createElementBlock("div", _hoisted_2$2h, [
          _cache[1] || (_cache[1] = createElementVNode(
            "b",
            { class: "filter-label" },
            "筛选：",
            -1
            /* CACHED */
          )),
          withDirectives(createElementVNode(
            "input",
            {
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => tagFilter.value = $event),
              class: "filter",
              "data-testid": "annolist-filter",
              placeholder: "按标签/文本/用户筛选…"
            },
            null,
            512
            /* NEED_PATCH */
          ), [
            [vModelText, tagFilter.value]
          ])
        ])) : createCommentVNode("v-if", true),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (r, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row",
              "data-testid": "annolist-row"
            }, [
              createElementVNode("div", _hoisted_3$21, [
                opts.value.showTime !== false && r.time ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_4$1L,
                  toDisplayString(r.time),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                opts.value.showUser !== false && r.user ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_5$1y,
                  toDisplayString(r.user),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ]),
              createElementVNode("div", _hoisted_6$1l, [
                createTextVNode(
                  toDisplayString(r.text) + " ",
                  1
                  /* TEXT */
                ),
                r.panelId != null || opts.value.navigateBefore || opts.value.navigateAfter ? (openBlock(), createElementBlock("a", {
                  key: 0,
                  class: "nav",
                  "data-testid": "annolist-nav",
                  href: navHref(r),
                  onClick: ($event) => onNavClick(r, $event)
                }, toDisplayString(r.navigateToPanel && r.panelId != null ? `面板 #${r.panelId}` : "打开时间范围"), 9, _hoisted_7$1b)) : createCommentVNode("v-if", true)
              ]),
              opts.value.showTags !== false && r.tags ? (openBlock(), createElementBlock(
                "div",
                _hoisted_8$13,
                toDisplayString(r.tags),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true)
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createCommentVNode(" zh-Hans: Grafana i18n annolist.anno-list-panel.no-annotations-found "),
        !rows.value.length ? (openBlock(), createElementBlock("div", _hoisted_9$_, "未找到注释")) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2O);
    };
  }
});
const AnnoListRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3I, [["__scopeId", "data-v-8b708e5b"]]);
const _sfc_main$3H = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(AnnoListRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "annolist",
    name: "注解列表",
    state: "stable",
    skipDataQuery: true
  },
  _sfc_main$3H
).setPanelOptions((builder) => {
  const category = ["注解列表"];
  builder.addRadio(
    {
      id: "onlyFromThisDashboard",
      path: "onlyFromThisDashboard",
      name: "查询范围",
      category,
      settings: {
        options: [
          { label: "本仪表盘", value: true },
          { label: "全部仪表盘", value: false }
        ]
      }
    },
    // Grafana defaultOptions.onlyFromThisDashboard = false
    false
  ).addRadio(
    {
      id: "onlyInTimeRange",
      path: "onlyInTimeRange",
      name: "时间范围",
      category,
      settings: {
        options: [
          { label: "当前时间范围", value: true },
          { label: "不限", value: false }
        ]
      }
    },
    // Grafana defaultOptions.onlyInTimeRange = false
    false
  ).addText({
    id: "tags",
    path: "tags",
    name: "标签",
    description: "逗号分隔；仅显示包含任一标签的注解",
    category
  }).addNumber(
    {
      id: "limit",
      path: "limit",
      name: "条数限制",
      category,
      settings: { min: 1, max: 1e3 }
    },
    10
  ).addBoolean(
    {
      id: "showUser",
      path: "showUser",
      name: "显示用户",
      category
    },
    true
  ).addBoolean(
    {
      id: "showTime",
      path: "showTime",
      name: "显示时间",
      category
    },
    true
  ).addBoolean(
    {
      id: "showTags",
      path: "showTags",
      name: "显示标签",
      category
    },
    true
  ).addRadio(
    {
      id: "navigateToPanel",
      path: "navigateToPanel",
      name: "链接目标",
      category,
      settings: {
        options: [
          { label: "面板", value: true },
          { label: "仪表盘", value: false }
        ]
      }
    },
    true
  ).addText(
    {
      id: "navigateBefore",
      path: "navigateBefore",
      name: "前移时间",
      description: "如 10m、1h",
      category
    },
    "10m"
  ).addText(
    {
      id: "navigateAfter",
      path: "navigateAfter",
      name: "后移时间",
      description: "如 10m、1h",
      category
    },
    "10m"
  );
}).setRuntimeConsumedPaths([
  "limit",
  "navigateAfter",
  "navigateBefore",
  "navigateToPanel",
  "onlyFromThisDashboard",
  "onlyInTimeRange",
  "showTags",
  "showTime",
  "showUser",
  "tags"
]).register();
const _hoisted_1$2N = {
  class: "gs",
  "data-testid": "panel-gettingstarted"
};
const _hoisted_2$2g = { class: "content" };
const _hoisted_3$20 = { class: "setup" };
const _hoisted_4$1K = { class: "cards" };
const _hoisted_5$1x = ["href"];
const _hoisted_6$1k = { class: "card-content" };
const _hoisted_7$1a = { class: "type" };
const _hoisted_8$12 = { class: "heading" };
const _hoisted_9$Z = { class: "card-title-wrap" };
const _hoisted_10$Q = { class: "card-title" };
const _hoisted_11$L = { class: "card-info" };
const _hoisted_12$F = { class: "card-content docs-content" };
const _hoisted_13$E = ["href"];
const _hoisted_14$z = { class: "card-title-wrap" };
const _hoisted_15$w = { class: "card-title" };
const _hoisted_16$t = { class: "learn" };
const _hoisted_17$r = ["href"];
const _hoisted_18$r = {
  type: "button",
  class: "nav forward",
  "aria-label": "前往高级教程",
  "data-testid": "gettingstarted-forward"
};
const _sfc_main$3G = /* @__PURE__ */ defineComponent({
  __name: "GettingStartedRenderer",
  setup(__props) {
    const tutorial = {
      type: "tutorial",
      heading: "Data source and dashboards",
      title: "Grafana fundamentals",
      info: "Set up and understand Grafana if you have no prior experience. This tutorial guides you through the entire process and covers the “Data source” and “Dashboards” steps to the right.",
      href: "https://grafana.com/tutorials/grafana-fundamentals?utm_source=grafana_gettingstarted"
    };
    const docsCards = [
      {
        title: "Add your first data source",
        href: "datasources/new?utm_source=grafana_gettingstarted",
        learnHref: "https://grafana.com/docs/grafana/latest/features/datasources/add-a-data-source?utm_source=grafana_gettingstarted",
        done: true
      },
      {
        title: "Create your first dashboard",
        href: "dashboard/new?utm_source=grafana_gettingstarted",
        learnHref: "https://grafana.com/docs/grafana/latest/guides/getting_started/#create-a-dashboard?utm_source=grafana_gettingstarted",
        done: true
      }
    ];
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2N, [
        _cache[3] || (_cache[3] = createElementVNode(
          "button",
          {
            type: "button",
            class: "dismiss",
            "data-testid": "gettingstarted-dismiss"
          },
          "移除此面板",
          -1
          /* CACHED */
        )),
        createElementVNode("div", _hoisted_2$2g, [
          createElementVNode("div", _hoisted_3$20, [
            _cache[2] || (_cache[2] = createElementVNode(
              "div",
              { class: "info" },
              [
                createElementVNode("h2", { class: "step-title" }, "Basic"),
                createElementVNode("p", { class: "step-info" }, " The steps below will guide you to quickly finish setting up your Grafana installation. ")
              ],
              -1
              /* CACHED */
            )),
            createElementVNode("div", _hoisted_4$1K, [
              createElementVNode("a", {
                class: "card tutorial",
                href: tutorial.href,
                target: "_blank",
                rel: "noreferrer",
                "data-testid": "gettingstarted-tutorial"
              }, [
                createElementVNode("div", _hoisted_6$1k, [
                  createElementVNode(
                    "div",
                    _hoisted_7$1a,
                    toDisplayString(tutorial.type),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "div",
                    _hoisted_8$12,
                    toDisplayString(tutorial.heading),
                    1
                    /* TEXT */
                  ),
                  createElementVNode("div", _hoisted_9$Z, [
                    createElementVNode(
                      "h3",
                      _hoisted_10$Q,
                      toDisplayString(tutorial.title),
                      1
                      /* TEXT */
                    )
                  ]),
                  createElementVNode(
                    "div",
                    _hoisted_11$L,
                    toDisplayString(tutorial.info),
                    1
                    /* TEXT */
                  )
                ])
              ], 8, _hoisted_5$1x),
              (openBlock(), createElementBlock(
                Fragment,
                null,
                renderList(docsCards, (card) => {
                  return createElementVNode("div", {
                    key: card.title,
                    class: "card docs",
                    "data-testid": "gettingstarted-docs"
                  }, [
                    createElementVNode("div", _hoisted_12$F, [
                      createElementVNode("a", {
                        href: card.href,
                        class: "docs-url"
                      }, [
                        _cache[0] || (_cache[0] = createElementVNode(
                          "div",
                          { class: "heading complete" },
                          "完成",
                          -1
                          /* CACHED */
                        )),
                        createElementVNode("div", _hoisted_14$z, [
                          createElementVNode(
                            "h3",
                            _hoisted_15$w,
                            toDisplayString(card.title),
                            1
                            /* TEXT */
                          )
                        ])
                      ], 8, _hoisted_13$E)
                    ]),
                    createElementVNode("div", _hoisted_16$t, [
                      createElementVNode("a", {
                        href: card.learnHref,
                        target: "_blank",
                        rel: "noreferrer",
                        class: "learn-link"
                      }, [
                        _cache[1] || (_cache[1] = createTextVNode(
                          " 在文档中了解如何操作 ",
                          -1
                          /* CACHED */
                        )),
                        createVNode(unref(GIcon), {
                          name: "external-link-alt",
                          size: 16,
                          class: "ext"
                        })
                      ], 8, _hoisted_17$r)
                    ])
                  ]);
                }),
                64
                /* STABLE_FRAGMENT */
              ))
            ])
          ])
        ]),
        createElementVNode("button", _hoisted_18$r, [
          createVNode(unref(GIcon), {
            name: "angle-right",
            size: 16,
            class: "nav-icon"
          })
        ])
      ]);
    };
  }
});
const GettingStartedRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3G, [["__scopeId", "data-v-2f75986a"]]);
const _sfc_main$3F = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GettingStartedRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "gettingstarted",
    name: "快速开始",
    state: "stable",
    skipDataQuery: true
  },
  _sfc_main$3F
).setNoPadding().setPanelOptions(() => {
}).setRuntimeConsumedPaths([]).register();
const _hoisted_1$2M = {
  class: "welcome",
  "data-testid": "panel-welcome",
  "data-locale": "zh-Hans"
};
const _hoisted_2$2f = { class: "help" };
const _hoisted_3$1$ = { class: "help-links" };
const _hoisted_4$1J = ["href"];
const _sfc_main$3E = /* @__PURE__ */ defineComponent({
  __name: "WelcomeRenderer",
  setup(__props) {
    const helpOptions = [
      { label: "Documentation", href: "https://grafana.com/docs/grafana/latest" },
      { label: "Tutorials", href: "https://grafana.com/tutorials" },
      { label: "Community", href: "https://community.grafana.com" },
      { label: "Public Slack", href: "http://slack.grafana.com" }
    ];
    function hrefWithUtm(href) {
      const join = href.includes("?") ? "&" : "?";
      return `${href}${join}utm_source=grafana_gettingstarted`;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2M, [
        _cache[1] || (_cache[1] = createElementVNode(
          "h1",
          { class: "title" },
          "欢迎使用 Grafana",
          -1
          /* CACHED */
        )),
        createElementVNode("div", _hoisted_2$2f, [
          _cache[0] || (_cache[0] = createElementVNode(
            "h2",
            { class: "help-text" },
            "需要帮助吗？",
            -1
            /* CACHED */
          )),
          createElementVNode("div", _hoisted_3$1$, [
            (openBlock(), createElementBlock(
              Fragment,
              null,
              renderList(helpOptions, (option, index2) => {
                return createElementVNode("a", {
                  key: `${option.label}-${index2}`,
                  class: "help-link",
                  href: hrefWithUtm(option.href),
                  target: "_blank",
                  rel: "noreferrer",
                  "data-testid": "welcome-help-link"
                }, [
                  createTextVNode(
                    toDisplayString(option.label),
                    1
                    /* TEXT */
                  ),
                  createVNode(unref(GIcon), {
                    name: "external-link-alt",
                    size: 16,
                    class: "ext-icon"
                  })
                ], 8, _hoisted_4$1J);
              }),
              64
              /* STABLE_FRAGMENT */
            ))
          ])
        ])
      ]);
    };
  }
});
const WelcomeRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3E, [["__scopeId", "data-v-2d061a9e"]]);
const _sfc_main$3D = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(WelcomeRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "welcome",
    name: "欢迎横幅",
    state: "stable",
    skipDataQuery: true
  },
  _sfc_main$3D
).setNoPadding().setPanelOptions(() => {
}).setRuntimeConsumedPaths([]).register();
function percentChange(values) {
  const nums = values.filter((n) => Number.isFinite(n));
  if (nums.length < 2) return null;
  const last = nums[nums.length - 1];
  const prev = nums[nums.length - 2];
  if (!Number.isFinite(prev) || prev === 0) return null;
  return (last - prev) / Math.abs(prev) * 100;
}
function prepareStatItems(input) {
  const o = input.options ?? {};
  const out = [];
  const calcs = o.reduceOptions?.calcs ?? [o.calc ?? "lastNotNull"];
  const calc = String(calcs[0] ?? "lastNotNull");
  const fieldFilter = String(o.reduceOptions?.fields ?? "").trim();
  const fieldRe = fieldFilter ? stringToJsRegexSafe(fieldFilter) : null;
  const showAllValues = o.reduceOptions?.values === true;
  const limit = o.reduceOptions?.limit != null ? Number(o.reduceOptions.limit) : showAllValues ? 25 : void 0;
  let textMode = String(o.textMode ?? "auto");
  const defaultsDisplayName = String(input.fieldConfig?.defaults?.displayName ?? "");
  if (textMode === "auto" && defaultsDisplayName) textMode = "value_and_name";
  const graphMode = String(o.graphMode ?? "area");
  const showPct = o.showPercentChange === true;
  const allFrames = input.data?.series ?? [];
  for (const frame of allFrames) {
    for (const field of frame.fields.filter((f) => f.type === "number")) {
      if (fieldRe && !fieldRe.test(field.name) && !fieldRe.test(getFieldDisplayName(field, frame, allFrames))) {
        continue;
      }
      const cfg = { ...input.fieldConfig?.defaults ?? {}, ...field.config };
      const name = getFieldDisplayName(field, frame, allFrames);
      const nums = field.values.map(Number).filter((n) => Number.isFinite(n));
      const display = getDisplayProcessor({ field: { ...field, config: cfg } });
      if (showAllValues) {
        const values = field.values.map((v2) => v2).slice(-(limit ?? 25));
        for (const v2 of values) {
          const dv2 = display(v2);
          out.push({
            text: textMode === "name" ? name : textMode === "none" ? "" : formattedValueToString(dv2),
            name: textMode === "value" || textMode === "none" ? "" : name,
            color: dv2.color,
            spark: graphMode === "none" ? [] : nums.slice(-24),
            percentChange: showPct ? percentChange(nums) : null
          });
        }
        continue;
      }
      const r = reduceField(field, [calc]);
      const v = r[calc];
      const dv = display(v);
      const color = dv.color;
      const spark = graphMode === "none" ? [] : nums.slice(-24);
      const pct = showPct ? percentChange(nums) : null;
      const text = formattedValueToString(dv);
      if (textMode === "none") {
        out.push({ text: "", name: "", color, spark: [], percentChange: null });
      } else if (textMode === "name") {
        out.push({ text: name, name: "", color, spark, percentChange: pct });
      } else if (textMode === "value") {
        out.push({ text, name: "", color, spark, percentChange: pct });
      } else if (textMode === "value_and_name") {
        out.push({ text, name, color, spark, percentChange: pct });
      } else {
        out.push({ text, name, color, spark, percentChange: pct });
      }
    }
  }
  let result = limit != null && Number.isFinite(limit) && limit > 0 ? out.slice(0, limit) : out;
  if (textMode === "auto" && result.length === 1) {
    result = [{ ...result[0], name: "" }];
  }
  return result.map((it) => {
    const n = String(it.name || "");
    if (n === "Value" || /^Value\s*\{/.test(n)) return { ...it, name: "" };
    return it;
  });
}
const _hoisted_1$2L = ["data-orientation", "data-text-mode", "data-graph-mode", "data-color-mode", "data-percent-color-mode", "data-justify-mode", "data-reduce-values", "data-reduce-limit", "data-wide-layout"];
const _hoisted_2$2e = {
  key: 0,
  class: "stat-empty",
  "data-testid": "stat-empty"
};
const _hoisted_3$1_ = ["data-testid"];
const _hoisted_4$1I = { class: "stat-name sr-mirror" };
const _hoisted_5$1w = {
  class: "stat-value sr-mirror",
  "data-testid": "panel-stat-value"
};
const _hoisted_6$1j = {
  key: 0,
  class: "sr-mirror",
  "data-testid": "panel-stat-pct"
};
const _hoisted_7$19 = {
  key: 1,
  class: "sr-mirror",
  "data-testid": "panel-stat-spark"
};
const _hoisted_8$11 = {
  key: 2,
  class: "sr-mirror",
  "data-testid": "panel-stat-spark-area"
};
const _sfc_main$3C = /* @__PURE__ */ defineComponent({
  __name: "StatRenderer",
  props: {
    data: {},
    fieldConfig: {},
    options: {},
    replaceVariables: { type: Function },
    width: {},
    height: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const items = computed(
      () => prepareStatItems({
        data: props.data,
        options: props.options,
        fieldConfig: props.fieldConfig
      })
    );
    const orientation = computed(() => String(opts.value.orientation ?? "auto"));
    const colorMode = computed(() => String(opts.value.colorMode ?? "value"));
    const graphMode = computed(() => {
      const g = String(opts.value.graphMode ?? "area");
      return g === "area" ? BigValueGraphMode.Area : g === "line" ? BigValueGraphMode.Line : BigValueGraphMode.None;
    });
    const justifyMode = computed(() => String(opts.value.justifyMode ?? "auto"));
    const textMode = computed(() => {
      let tm = String(opts.value.textMode ?? "auto");
      const defaultsDisplayName = String(props.fieldConfig?.defaults?.displayName ?? "");
      if (tm === "auto" && defaultsDisplayName) tm = "value_and_name";
      return tm;
    });
    const wideLayout = computed(() => opts.value.wideLayout !== false);
    const textSizes = computed(
      () => opts.value.text ?? {}
    );
    function itemShellStyle(it) {
      const mode2 = String(opts.value.colorMode ?? "value");
      if ((mode2 === "background" || mode2 === "background_solid") && it.color) {
        if (mode2 === "background_solid") return { background: it.color };
        return { background: `linear-gradient(120deg, ${it.color}, ${it.color})` };
      }
      return {};
    }
    const cellSize = computed(() => {
      const n = Math.max(1, items.value.length);
      const W2 = props.width ?? 300;
      const H2 = props.height ?? 200;
      const orient = orientation.value;
      if (orient === "horizontal") {
        return { w: Math.floor(W2 / n), h: H2 };
      }
      if (orient === "vertical") {
        return { w: W2, h: Math.floor(H2 / n) };
      }
      const cols = Math.ceil(Math.sqrt(n));
      const rows = Math.ceil(n / cols);
      return { w: Math.floor(W2 / cols), h: Math.floor(H2 / rows) };
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["stat-renderer", { "stat-wide": wideLayout.value, "stat-narrow": !wideLayout.value }]),
        "data-testid": "panel-stat",
        "data-orientation": orientation.value,
        "data-text-mode": String(textMode.value),
        "data-graph-mode": String(graphMode.value),
        "data-color-mode": String(colorMode.value),
        "data-percent-color-mode": String(opts.value.percentChangeColorMode ?? "standard"),
        "data-justify-mode": String(justifyMode.value),
        "data-reduce-values": String(!!opts.value.reduceOptions?.values),
        "data-reduce-limit": String(opts.value.reduceOptions?.limit ?? ""),
        "data-wide-layout": String(wideLayout.value),
        style: { "width": "100%", "height": "100%" }
      }, [
        !items.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$2e, "暂无数据")) : createCommentVNode("v-if", true),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(items.value, (it, idx) => {
            return openBlock(), createElementBlock("div", {
              key: idx,
              class: "stat-item",
              "data-testid": `stat-item-${idx}`,
              style: normalizeStyle(itemShellStyle(it))
            }, [
              createVNode(unref(BigValue), {
                width: cellSize.value.w,
                height: cellSize.value.h,
                value: {
                  text: it.text,
                  title: it.name,
                  color: it.color,
                  percentChange: it.percentChange
                },
                sparkline: it.spark,
                "color-mode": colorMode.value,
                "graph-mode": graphMode.value,
                "justify-mode": justifyMode.value,
                "text-mode": textMode.value,
                text: textSizes.value,
                count: items.value.length,
                "wide-layout": wideLayout.value,
                "percent-change-color-mode": String(opts.value.percentChangeColorMode ?? "standard")
              }, null, 8, ["width", "height", "value", "sparkline", "color-mode", "graph-mode", "justify-mode", "text-mode", "text", "count", "wide-layout", "percent-change-color-mode"]),
              createCommentVNode(" legacy selectors for unit tests "),
              createElementVNode(
                "span",
                _hoisted_4$1I,
                toDisplayString(it.name),
                1
                /* TEXT */
              ),
              createElementVNode(
                "span",
                _hoisted_5$1w,
                toDisplayString(it.text),
                1
                /* TEXT */
              ),
              it.percentChange != null ? (openBlock(), createElementBlock(
                "span",
                _hoisted_6$1j,
                toDisplayString(it.percentChange),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true),
              it.spark.length ? (openBlock(), createElementBlock("span", _hoisted_7$19)) : createCommentVNode("v-if", true),
              it.spark.length && String(opts.value.graphMode ?? "area") === "area" ? (openBlock(), createElementBlock("span", _hoisted_8$11)) : createCommentVNode("v-if", true)
            ], 12, _hoisted_3$1_);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ], 10, _hoisted_1$2L);
    };
  }
});
const StatRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3C, [["__scopeId", "data-v-2e2e8a21"]]);
const _sfc_main$3B = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(StatRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  { id: "stat", name: "统计值", state: "stable", skipDataQuery: false },
  _sfc_main$3B
).useFieldConfig().setPanelOptions((builder) => {
  addStandardDataReduceOptions(builder);
  builder.addRadio(
    {
      id: "orientation",
      path: "orientation",
      name: "方向",
      category: ["Stat 样式"],
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "水平", value: "horizontal" },
          { label: "垂直", value: "vertical" }
        ]
      }
    },
    "auto"
  ).addSelect(
    {
      id: "textMode",
      path: "textMode",
      name: "文本模式",
      category: ["Stat 样式"],
      editor: "select",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "值", value: "value" },
          { label: "值与名称", value: "value_and_name" },
          { label: "名称", value: "name" },
          { label: "无", value: "none" }
        ]
      }
    },
    "auto"
  ).addSelect(
    {
      id: "colorMode",
      path: "colorMode",
      name: "颜色模式",
      category: ["Stat 样式"],
      editor: "select",
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "值", value: "value" },
          { label: "背景渐变", value: "background" },
          { label: "背景纯色", value: "background_solid" }
        ]
      }
    },
    "value"
  ).addRadio(
    {
      id: "graphMode",
      path: "graphMode",
      name: "图表模式",
      category: ["Stat 样式"],
      editor: "radio",
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "面积", value: "area" }
        ]
      }
    },
    "area"
  ).addRadio(
    {
      id: "justifyMode",
      path: "justifyMode",
      name: "文本对齐",
      category: ["Stat 样式"],
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "居中", value: "center" }
        ]
      }
    },
    "auto"
  ).addRadio(
    {
      id: "wideLayout",
      path: "wideLayout",
      name: "宽布局",
      category: ["Stat 样式"],
      editor: "radio",
      settings: {
        options: [
          { label: "开", value: true },
          { label: "关", value: false }
        ]
      },
      // Grafana: only meaningful with ValueAndName text mode
      showIf: (c) => c.textMode === "value_and_name"
    },
    true
  ).addBoolean(
    {
      id: "showPercentChange",
      path: "showPercentChange",
      name: "显示百分比变化",
      category: ["Stat 样式"],
      editor: "boolean",
      // Grafana: hidden when showing all values
      showIf: (c) => !c.reduceOptions?.values
    },
    false
  ).addSelect(
    {
      id: "percentChangeColorMode",
      path: "percentChangeColorMode",
      name: "百分比变化颜色模式",
      category: ["Stat 样式"],
      editor: "select",
      settings: {
        options: [
          { label: "标准", value: "standard" },
          { label: "反转", value: "inverted" },
          { label: "与值相同", value: "same_as_value" }
        ]
      },
      showIf: (c) => !!c.showPercentChange
    },
    "standard"
  );
  addTextSizeOptions(builder, {
    withTitle: true,
    withValue: true,
    withPercentChange: true
  });
}).setNoPadding().setRuntimeConsumedPaths([
  "reduceOptions.calcs",
  "reduceOptions.fields",
  "reduceOptions.values",
  "reduceOptions.limit",
  "orientation",
  "textMode",
  "colorMode",
  "graphMode",
  "justifyMode",
  "wideLayout",
  "showPercentChange",
  "percentChangeColorMode"
]).register();
const FALLBACK_LCD = "#7d8085";
const DEFAULT_LCD_ITEM_SPACING = 8;
const DEFAULT_LCD_CELL_WIDTH = 12;
function colorWithAlpha(color, alpha2) {
  const m = String(color).match(/^#?([0-9a-f]{6})$/i);
  if (m) {
    const n = Number.parseInt(m[1], 16);
    const r = n >> 16 & 255;
    const g = n >> 8 & 255;
    const b = n & 255;
    return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
  }
  const rgb = String(color).match(/rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
  if (rgb) return `rgba(${rgb[1]}, ${rgb[2]}, ${rgb[3]}, ${alpha2})`;
  return color;
}
function getCellColor(positionValue, valueNumeric, cellColor) {
  if (positionValue == null || Number.isNaN(positionValue)) {
    return { background: FALLBACK_LCD, border: FALLBACK_LCD, isLit: false };
  }
  const color = cellColor || FALLBACK_LCD;
  if (valueNumeric == null || Number.isNaN(valueNumeric) || positionValue != null && positionValue > valueNumeric) {
    return {
      background: colorWithAlpha(color, 0.18),
      border: "transparent",
      isLit: false
    };
  }
  return {
    background: colorWithAlpha(color, 0.95),
    backgroundShade: colorWithAlpha(color, 0.55),
    border: colorWithAlpha(color, 0.9),
    isLit: true
  };
}
function buildLcdCells(opts) {
  const lcdW = Math.max(
    2,
    Number(opts.lcdCellWidth ?? DEFAULT_LCD_CELL_WIDTH) || DEFAULT_LCD_CELL_WIDTH
  );
  const maxSize = Math.max(lcdW, Number(opts.maxSize ?? 180) || 180);
  const cellSpacing = Math.max(
    0,
    Number(opts.itemSpacing ?? DEFAULT_LCD_ITEM_SPACING) || DEFAULT_LCD_ITEM_SPACING
  );
  const cellCount = Math.max(1, Math.floor(maxSize / lcdW));
  const cellSize = Math.max(1, Math.floor((maxSize - cellSpacing * cellCount) / cellCount));
  const min = Number(opts.min);
  const max = Number(opts.max);
  const valueRange = max - min || 1;
  const value = Number(opts.value);
  const fallback = opts.color || classicBlue();
  const out = [];
  for (let i = 0; i < cellCount; i++) {
    const positionValue = min + valueRange / cellCount * i;
    const posColor = opts.colorAt?.(positionValue) || fallback;
    const cell = getCellColor(positionValue, value, posColor);
    out.push({
      on: !!cell.isLit,
      color: cell.background,
      shade: cell.backgroundShade || colorWithAlpha(posColor, 0.55),
      size: cellSize,
      spacing: cellSpacing,
      positionValue
    });
  }
  return out;
}
function hexAlpha$1(hex, a) {
  const m = String(hex).match(/^#?([0-9a-f]{6})$/i);
  if (!m) return hex;
  const n = Number.parseInt(m[1], 16);
  const r = n >> 16 & 255;
  const g = n >> 8 & 255;
  const b = n & 255;
  return `rgba(${r},${g},${b},${a})`;
}
function thresholdGradient(it, vertical) {
  const cssDir = vertical ? "0deg" : "90deg";
  const color = it.color || classicGreen();
  const steps = [...it.thresholds ?? []].map((s) => ({ value: Number(s.value), color: s.color || color })).filter((s) => Number.isFinite(s.value)).sort((a, b) => a.value - b.value);
  if (!steps.length) {
    return `linear-gradient(${cssDir}, ${hexAlpha$1(color, 0.35)} 0%, ${color} 100%)`;
  }
  const range = it.max - it.min || 1;
  const parts = [`${color} 0%`];
  let lastColor = color;
  for (const s of steps) {
    if (s.value <= it.min) {
      lastColor = s.color;
      continue;
    }
    if (s.value >= it.max) break;
    const pct = (s.value - it.min) / range * 100;
    parts.push(`${lastColor} ${pct}%`);
    parts.push(`${s.color} ${pct}%`);
    lastColor = s.color;
  }
  parts.push(`${lastColor} 100%`);
  return `linear-gradient(${cssDir}, ${parts.join(", ")})`;
}
function barFillStyle(it, displayMode = "gradient") {
  const mode2 = String(displayMode ?? "gradient");
  const color = it.color || classicBlue();
  const pct = `${Math.max(it.pct * 100, 0.5)}%`;
  if (mode2 === "basic") {
    return {
      background: hexAlpha$1(color, 0.35),
      borderRight: `2px solid ${color}`,
      width: pct,
      height: "100%"
    };
  }
  return {
    background: thresholdGradient(it, false),
    width: pct,
    height: "100%"
  };
}
function barFillStyleV(it, displayMode = "gradient") {
  const mode2 = String(displayMode ?? "gradient");
  const color = it.color || classicBlue();
  const pct = `${Math.max(it.pct * 100, 0.5)}%`;
  if (mode2 === "basic") {
    return {
      background: hexAlpha$1(color, 0.35),
      borderTop: `2px solid ${color}`,
      height: pct,
      width: "100%"
    };
  }
  return {
    background: thresholdGradient(it, true),
    height: pct,
    width: "100%"
  };
}
function lcdCellStyle(cell, isVertical, defaultSpacing = 8) {
  const size = Math.max(1, Number(cell.size ?? 8));
  const spacing = Math.max(0, Number(cell.spacing ?? defaultSpacing));
  const base = {
    borderRadius: "2px",
    flex: "0 0 auto"
  };
  if (isVertical) {
    base.height = `${size}px`;
    base.width = "100%";
    base.marginTop = `${spacing}px`;
  } else {
    base.width = `${size}px`;
    base.height = "100%";
    base.marginRight = `${spacing}px`;
  }
  if (cell.on) {
    base.backgroundImage = `radial-gradient(${cell.color} 10%, ${cell.shade})`;
  } else {
    base.backgroundColor = cell.color;
  }
  return base;
}
function barGlowStyle(color, enabled) {
  if (!enabled) return void 0;
  const c = color || classicBlue();
  return { filter: `drop-shadow(0 0 2px ${c}) drop-shadow(0 0 4px ${c})` };
}
function conicValueStyle(input) {
  const color = input.color || classicGreen();
  const css = input.shape === "circle" ? `conic-gradient(from 0deg, ${color} 0deg, ${color} 360deg)` : `conic-gradient(from ${input.startDeg}deg, ${color} ${(-input.fullDeg / 2).toFixed(0)}deg, ${color} ${input.fullDeg}deg, rgba(0, 0, 0, 0) 0deg, rgba(0, 0, 0, 0) ${input.fullDeg}deg)`;
  const box = Math.ceil((input.r + input.stroke) * 2);
  return {
    width: `${box}px`,
    height: `${box}px`,
    backgroundImage: css
  };
}
function hexToRgba(hex, alpha2) {
  const m = String(hex).replace("#", "").match(/^([0-9a-f]{6})$/i);
  if (!m) return `rgba(115, 191, 105, ${alpha2})`;
  const n = Number.parseInt(m[1], 16);
  return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alpha2})`;
}
const LINE_HEIGHT_FACTOR = 1.21;
const VALUE_WIDTH_TO_RADIUS_FACTOR = 0.82;
const LARGE_RADIUS_SCALING_DECAY = 0.86;
const MAX_TEXT_WIDTH_DIVISOR = 7;
const MAX_NAME_HEIGHT_DIVISOR = 4;
const NAME_TO_HEIGHT_FACTOR = 0.45;
const VALUE_SPACE_PERCENTAGE = 0.7;
const SPARKLINE_SPACING = 8;
const MIN_NAME_FONT_SIZE = 10;
const VALUE_TEXT_COLOR = "var(--grafana-text)";
const NAME_TEXT_COLOR = "var(--grafana-text-secondary)";
function radialValueFontSize(text, r, barW) {
  const maxTextWidth = r * 2 - barW - r / MAX_TEXT_WIDTH_DIVISOR;
  const maxValueHeight = VALUE_WIDTH_TO_RADIUS_FACTOR * r ** LARGE_RADIUS_SCALING_DECAY;
  const size = calculateFontSize(
    String(text ?? ""),
    maxTextWidth,
    maxValueHeight,
    LINE_HEIGHT_FACTOR,
    void 0,
    400
  );
  return Math.max(1, size);
}
function radialNameFontSize(title, r, barW, showValue, showName) {
  const maxTextWidth = r * 2 - barW - r / MAX_TEXT_WIDTH_DIVISOR;
  let maxNameHeight = r / MAX_NAME_HEIGHT_DIVISOR;
  if (showValue && showName) {
    maxNameHeight = NAME_TO_HEIGHT_FACTOR * r ** LARGE_RADIUS_SCALING_DECAY;
  }
  const size = calculateFontSize(
    title,
    maxTextWidth,
    maxNameHeight,
    LINE_HEIGHT_FACTOR,
    void 0,
    400
  );
  return Math.max(MIN_NAME_FONT_SIZE, size);
}
function radialValueTextY(input) {
  if (!input.pixelSpace) return input.fallbackY;
  const valueHeight = input.valueFontSize * LINE_HEIGHT_FACTOR;
  const nameHeight = input.nameFontSize * LINE_HEIGHT_FACTOR;
  const valueY = input.showName ? input.cy - nameHeight * (1 - VALUE_SPACE_PERCENTAGE) : input.cy;
  let yOffset = 0;
  if (input.shape === "gauge") {
    yOffset += (valueHeight + nameHeight) / 4;
  }
  if (input.showSparkline && input.sparkLen > 1) {
    yOffset += SPARKLINE_SPACING;
  }
  return valueY - yOffset;
}
function radialNameTextY(input) {
  if (!input.pixelSpace) return input.fallbackY;
  const valueHeight = input.valueFontSize * LINE_HEIGHT_FACTOR;
  const nameHeight = input.nameFontSize * LINE_HEIGHT_FACTOR;
  const valueY = input.cy - nameHeight * (1 - VALUE_SPACE_PERCENTAGE);
  const nameY = input.showValue ? valueY + valueHeight * VALUE_SPACE_PERCENTAGE : input.cy;
  let yOffset = 0;
  if (input.shape === "gauge") {
    yOffset += (valueHeight + nameHeight) / 4;
  }
  if (input.showSparkline && input.sparkLen > 1) {
    yOffset += SPARKLINE_SPACING;
  }
  return nameY - yOffset;
}
function toRad(angle) {
  return (angle - 90) * Math.PI / 180;
}
function drawRadialArcPathStable(startAngle, endAngle, radius, cx, cy) {
  let end = endAngle;
  if (end >= 360) end = 359.99;
  if (end <= 0) return "";
  const startRadians = toRad(startAngle);
  const endRadians = toRad(startAngle + end);
  const largeArc = end > 180 ? 1 : 0;
  const MAX_DECIMALS = 2;
  const x1 = Number.parseFloat((cx + radius * Math.cos(startRadians)).toFixed(MAX_DECIMALS));
  const y1 = Number.parseFloat((cy + radius * Math.sin(startRadians)).toFixed(MAX_DECIMALS));
  const x2 = Number.parseFloat((cx + radius * Math.cos(endRadians)).toFixed(MAX_DECIMALS));
  const y2 = Number.parseFloat((cy + radius * Math.sin(endRadians)).toFixed(MAX_DECIMALS));
  return `M ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2}`;
}
const ARC_START = 250;
const ARC_END = 110;
function angleRangeForShape(shape) {
  if (shape === "circle") return 360;
  return 360 % ARC_START + ARC_END;
}
function startAngleForShape(shape) {
  return shape === "circle" ? 0 : ARC_START;
}
function getAngleBetweenSegments(segmentSpacing, segmentCount, range) {
  const maxAngleBetweenSegments = Math.max(range / 1.5 / Math.max(1, segmentCount), 2);
  return segmentSpacing * maxAngleBetweenSegments;
}
function getOptimalSegmentCount(radius, barWidth, segmentSpacing, segmentCount, range) {
  const angleBetweenSegments = getAngleBetweenSegments(segmentSpacing, segmentCount, range);
  const innerRadius = radius - barWidth / 2;
  const circumference = Math.PI * innerRadius * 2 * (range / 360);
  const maxSegments = Math.floor(circumference / (angleBetweenSegments + 3));
  return Math.min(Math.max(1, maxSegments), Math.max(1, segmentCount));
}
function getValueAngleForValue(value, min, max, startAngle, endAngle, neutral) {
  const angleRange = 360 % (startAngle === 0 ? 1 : startAngle) + endAngle;
  const span = max - min || 1;
  const pct = (value - min) / span;
  const valueAngle = pct * angleRange;
  let startValueAngle = 0;
  let endValueAngle = valueAngle;
  if (typeof neutral === "number" && Number.isFinite(neutral)) {
    const clampedNeutral = Math.min(Math.max(min, neutral), max);
    const neutralAngle = (clampedNeutral - min) / span * angleRange;
    if (neutralAngle <= valueAngle) {
      startValueAngle = neutralAngle;
      endValueAngle = valueAngle - neutralAngle;
    } else {
      startValueAngle = valueAngle;
      endValueAngle = neutralAngle - valueAngle;
    }
  }
  const clampedEnd = Math.min(Math.max(endValueAngle, 0), angleRange);
  return { angleRange, startValueAngle, endValueAngle: clampedEnd };
}
function arcPathRelative(startDeg, lengthDeg, radius) {
  let end = lengthDeg;
  if (end >= 360) end = 359.99;
  const startRadians = toRad(startDeg);
  const endRadians = toRad(startDeg + end);
  const largeArc = end > 180 ? 1 : 0;
  const x1 = radius * Math.cos(startRadians);
  const y1 = radius * Math.sin(startRadians);
  const x2 = radius * Math.cos(endRadians);
  const y2 = radius * Math.sin(endRadians);
  return `M ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2}`;
}
function arcPath(startDeg, lengthDeg, geom, radius) {
  return drawRadialArcPathStable(startDeg, lengthDeg, radius ?? geom.r, geom.cx, geom.cy);
}
function trackArcs(it, geom, neutral) {
  const start = startAngleForShape(geom.shape);
  const full = angleRangeForShape(geom.shape);
  const endAngle = geom.shape === "circle" ? 360 : ARC_END;
  const value = it.min + it.pct * (it.max - it.min || 1);
  const { startValueAngle, endValueAngle } = getValueAngleForValue(
    value,
    it.min,
    it.max,
    start,
    endAngle,
    neutral != null && Number.isFinite(Number(neutral)) ? Number(neutral) : void 0
  );
  const out = [];
  if (startValueAngle > 0.05) {
    out.push({ d: arcPath(start, startValueAngle, geom) });
  }
  const afterStart = start + startValueAngle + endValueAngle;
  const afterLen = full - endValueAngle - startValueAngle;
  if (afterLen > 0.05) {
    out.push({ d: arcPath(afterStart, afterLen, geom) });
  }
  return out;
}
function thresholdTicks(it, geom) {
  const start = startAngleForShape(geom.shape);
  const full = angleRangeForShape(geom.shape);
  const labelR = geom.scaleLabelsRadius || geom.r + 10;
  return it.thresholds.map((s) => {
    const t2 = Math.max(0, Math.min(1, (Number(s.value) - it.min) / (it.max - it.min || 1)));
    const ang = start + full * t2;
    const rad = toRad(ang);
    const r1 = geom.r - geom.stroke * 0.75;
    const r2 = geom.r + geom.stroke * 0.75;
    return {
      x1: geom.cx + r1 * Math.cos(rad),
      y1: geom.cy + r1 * Math.sin(rad),
      x2: geom.cx + r2 * Math.cos(rad),
      y2: geom.cy + r2 * Math.sin(rad),
      color: s.color || classicOrange(),
      label: String(s.value),
      lx: geom.cx + labelR * Math.cos(rad),
      ly: geom.cy + labelR * Math.sin(rad)
    };
  });
}
function segmentArcs(it, geom, requested, segmentSpacing, neutral) {
  if (requested <= 1) return [];
  const start = startAngleForShape(geom.shape);
  const full = angleRangeForShape(geom.shape);
  const n = getOptimalSegmentCount(geom.r, geom.stroke, segmentSpacing, requested, full);
  const angleBetween = getAngleBetweenSegments(segmentSpacing, n, full);
  const segmentArcLengthDeg = full / n - angleBetween;
  const angles = getValueAngleForValue(
    it.min + it.pct * (it.max - it.min || 1),
    it.min,
    it.max,
    start,
    geom.shape === "circle" ? 360 : ARC_END,
    neutral != null && Number.isFinite(Number(neutral)) ? Number(neutral) : void 0
  );
  const out = [];
  for (let i = 0; i < n; i++) {
    const segmentStartAngle = start + full / n * i + 0.01;
    const segmentAngle = i / n * full;
    const isTrack = segmentAngle < angles.startValueAngle - 1e-9 || segmentAngle >= angles.startValueAngle + angles.endValueAngle - 1e-9;
    const len = Math.max(0.5, segmentArcLengthDeg);
    out.push({
      d: arcPath(segmentStartAngle, len, geom),
      on: !isTrack,
      startAngle: segmentStartAngle
    });
  }
  return out;
}
function endpointPos(it, geom, endpointMarker, neutral) {
  const marker = String(endpointMarker ?? "point");
  if (marker === "none" || !marker) return null;
  const start = startAngleForShape(geom.shape);
  const full = angleRangeForShape(geom.shape);
  let pct = Math.max(0, Math.min(1, it.pct));
  if (neutral != null && Number.isFinite(Number(neutral))) {
    const n = Number(neutral);
    const nPct = Math.max(0, Math.min(1, (n - it.min) / (it.max - it.min || 1)));
    pct = Math.max(pct, nPct);
  }
  if (pct <= 0) return null;
  const ang = start + full * pct;
  const rad = toRad(ang);
  return {
    x: geom.cx + geom.r * Math.cos(rad),
    y: geom.cy + geom.r * Math.sin(rad)
  };
}
function valueArcAngles(it, shape, neutral) {
  const start = startAngleForShape(shape);
  const endAngle = shape === "circle" ? 360 : ARC_END;
  const value = it.min + it.pct * (it.max - it.min || 1);
  const { startValueAngle, endValueAngle } = getValueAngleForValue(
    value,
    it.min,
    it.max,
    start,
    endAngle,
    neutral != null && Number.isFinite(Number(neutral)) ? Number(neutral) : void 0
  );
  return { start: start + startValueAngle, startValueAngle, endValueAngle };
}
function thresholdBarArcs(it, geom, showThresholdMarkers) {
  if (showThresholdMarkers === false) return [];
  const baseColor = it.color || classicGreen();
  const raw = [
    { value: it.min, color: baseColor },
    ...it.thresholds.map((s) => ({ value: Number(s.value), color: s.color || baseColor })).filter((s) => Number.isFinite(s.value))
  ].sort((a, b) => a.value - b.value);
  const clamped = [];
  let lastColor = baseColor;
  for (const s of raw) {
    if (s.value <= it.min) {
      lastColor = s.color;
      continue;
    }
    if (s.value >= it.max) {
      break;
    }
    if (!clamped.length) clamped.push({ value: it.min, color: lastColor });
    clamped.push({ value: s.value, color: lastColor });
    lastColor = s.color;
  }
  if (!clamped.length) clamped.push({ value: it.min, color: lastColor });
  if (clamped[clamped.length - 1].value < it.max) {
    clamped.push({ value: it.max, color: lastColor });
  }
  if (clamped.length < 2) return [];
  const start = startAngleForShape(geom.shape);
  const full = angleRangeForShape(geom.shape);
  const range = it.max - it.min || 1;
  const out = [];
  const outerR = geom.thresholdsBarRadius || geom.r + geom.stroke * 0.75 + 1.5;
  for (let i = 1; i < clamped.length; i++) {
    const a0pct = Math.max(0, Math.min(1, (clamped[i - 1].value - it.min) / range));
    const a1pct = Math.max(0, Math.min(1, (clamped[i].value - it.min) / range));
    const len = (a1pct - a0pct) * full;
    if (len <= 0.05) continue;
    out.push({
      d: arcPath(start + a0pct * full, len, geom, outerR),
      dRel: arcPathRelative(start + a0pct * full, len, outerR),
      color: clamped[i].color || baseColor
    });
  }
  return out;
}
function cleanGaugeName(name) {
  const n = String(name || "").trim();
  if (!n || n === "Value" || /^Value\s*\{/.test(n)) return "";
  return n;
}
function fieldMinMax(field, cfg) {
  let min = cfg.min;
  let max = cfg.max;
  const hasMin = typeof min === "number" && Number.isFinite(min);
  const hasMax = typeof max === "number" && Number.isFinite(max);
  if (!hasMin || !hasMax) {
    const vals = (field.values ?? []).map((n) => Number(n)).filter((n) => Number.isFinite(n));
    if (vals.length) {
      if (!hasMin) min = Math.min(...vals);
      if (!hasMax) max = Math.max(...vals);
    } else {
      if (!hasMin) min = 0;
      if (!hasMax) max = 100;
    }
  }
  if (min === max) {
    min = min - min * 0.1;
    max = max + max * 0.1;
  }
  return { min: Number(min), max: Number(max) };
}
function fieldMatchesFilter(field, filter2, frame, allFrames) {
  if (!filter2 || !String(filter2).trim()) return true;
  const raw = String(filter2).trim();
  const re = stringToJsRegexSafe(raw);
  if (!re) return true;
  const displayName = getFieldDisplayName(field, frame, allFrames);
  return re.test(field.name || "") || re.test(displayName);
}
function thresholdSteps(cfg) {
  const rawSteps = cfg.thresholds?.steps ?? [];
  return rawSteps.length > 0 ? rawSteps : [
    { value: -Infinity, color: classicGreen() },
    { value: 80, color: classicRed() }
  ];
}
function rowDisplayName(frame, field, rowIndex, allFrames) {
  const configured = String(field.config?.displayName ?? "").trim();
  if (configured) return configured;
  const parts = [];
  let otherNumeric = 0;
  for (const other of frame.fields) {
    if (other === field) continue;
    if (other.type === "string") {
      const raw = other.values?.[rowIndex];
      const text = raw == null ? "" : String(raw).trim();
      if (text) parts.push(text);
    } else if (other.type === "number") {
      otherNumeric += 1;
    }
  }
  if (otherNumeric || parts.length === 0) {
    parts.push(getFieldDisplayName(field, frame, allFrames));
  }
  return parts.join(" ");
}
function pushGaugeItem(out, opts) {
  const { v, cfg, field, display, textMode, allFrames, spark } = opts;
  const { min, max } = fieldMinMax(field, cfg);
  const pct = Math.max(0, Math.min(1, (v - min) / (max - min || 1)));
  const steps = thresholdSteps(cfg);
  const name = cleanGaugeName(opts.forceName ?? display);
  const titleForLayout = opts.forceName || display || name || "Value";
  let text = formatValue(v, cfg);
  let showName = name;
  if (textMode === "name") {
    text = name || text;
    showName = "";
  } else if (textMode === "value") {
    showName = "";
  } else if (textMode === "none") {
    text = "";
    showName = "";
  } else if (textMode === "auto" && allFrames.length === 1) {
    const numFields = allFrames[0].fields.filter((f) => f.type === "number").length;
    const hasExplicitName = Boolean(
      opts.forceName || String(cfg?.displayName ?? "").trim() || String(cfg?.displayNameFromDS ?? "").trim()
    );
    if (numFields <= 1 && !hasExplicitName) showName = "";
  }
  out.push({
    text,
    name: showName,
    titleForLayout,
    color: getFieldColor(v, cfg) ?? classicGreen(),
    numeric: v,
    pct,
    min,
    max,
    thresholds: steps.filter(
      (s) => Number.isFinite(Number(s.value)) && Number(s.value) !== -Infinity
    ),
    spark
  });
}
function prepareGaugeItems(input) {
  const out = [];
  const calc = String(input.reduceCalc ?? "lastNotNull");
  const textMode = String(input.textMode ?? "auto");
  const showAllValues = input.showAllValues === true;
  const allFrames = input.series ?? [];
  const DEFAULT_VALUES_LIMIT = 25;
  const limRaw = input.limit != null ? Number(input.limit) : void 0;
  const limit = limRaw != null && Number.isFinite(limRaw) && limRaw >= 0 ? Math.floor(limRaw) : showAllValues ? DEFAULT_VALUES_LIMIT : void 0;
  for (const frame of allFrames) {
    for (const field of frame.fields.filter((f) => f.type === "number")) {
      if (!fieldMatchesFilter(field, input.fieldsFilter, frame, allFrames)) continue;
      const cfg = { ...input.fieldDefaults ?? {}, ...field.config };
      const sparkAll = field.values.map((n) => Number(n)).filter((n) => Number.isFinite(n)).slice(-40);
      const display = cfg.displayNameFromDS || cfg.displayName || getFieldDisplayName(field, frame, allFrames);
      if (showAllValues) {
        const values = field.values ?? [];
        for (const [j, raw] of values.entries()) {
          const v2 = Number(raw);
          if (!Number.isFinite(v2)) continue;
          const rowName = rowDisplayName(frame, field, j, allFrames);
          pushGaugeItem(out, {
            v: v2,
            cfg,
            field,
            display,
            textMode,
            allFrames,
            spark: sparkAll,
            forceName: cleanGaugeName(rowName) || rowName || String(j + 1)
          });
          if (limit != null && out.length >= limit) return out;
        }
        continue;
      }
      const r = reduceField(field, [calc]);
      const v = Number(r[calc] ?? r.lastNotNull ?? 0);
      pushGaugeItem(out, {
        v,
        cfg,
        field,
        display,
        textMode,
        allFrames,
        spark: sparkAll
      });
      if (limit != null && out.length >= limit) return out;
    }
  }
  return out;
}
const PANEL_GAUGE_VIEW = {
  width: 100,
  height: 90,
  cx: 50,
  cy: 46,
  radius: 32,
  stroke: 8
};
function calculateDimensions(width2, height2, endAngle = ARC_END, glow = false, roundedBars = false, barWidthFactor = 0.4, barIndex = 0, thresholdBar = false, showScaleLabels = false) {
  const yMaxAngle = endAngle > 180 ? 180 : endAngle;
  let margin = 0;
  if (glow) {
    margin = 0.02 * Math.min(width2, height2);
  }
  let maxRadiusW = width2 / 2 - margin;
  const heightRatioV = Math.sin(toRad(yMaxAngle));
  let maxRadiusH = (height2 - margin * 2) / (1 + heightRatioV);
  const maxRadius = Math.min(maxRadiusW, maxRadiusH);
  const maxRadiusIsLimitedByHeight = maxRadiusH === maxRadius;
  let outerRadius = maxRadius;
  const barWidth = Math.max(barWidthFactor * (maxRadius / 3), 2);
  const totalEndcapAdjustment = yMaxAngle < 180 && roundedBars ? barWidth * 0.5 : 0;
  const radiusEndcapAdjustment = totalEndcapAdjustment * 0.5;
  outerRadius -= radiusEndcapAdjustment;
  maxRadiusH -= radiusEndcapAdjustment;
  maxRadiusW -= radiusEndcapAdjustment;
  let scaleLabelsFontSize = 0;
  let scaleLabelsSpacing = 0;
  let scaleLabelsRadius = 0;
  if (showScaleLabels) {
    scaleLabelsRadius = outerRadius;
    const radiusToFontSizeFactor = 0.12;
    scaleLabelsFontSize = Math.max(radiusToFontSizeFactor * outerRadius ** 0.92, 10);
    scaleLabelsSpacing = scaleLabelsFontSize / 3;
    const labelsSize = scaleLabelsFontSize * 1.2 + scaleLabelsSpacing;
    outerRadius -= labelsSize;
    maxRadiusW -= labelsSize;
    maxRadiusH -= labelsSize;
    if (maxRadiusIsLimitedByHeight && endAngle < 180) {
      const amount = outerRadius * 0.07;
      scaleLabelsRadius -= amount;
      maxRadiusH -= amount;
      maxRadiusW -= amount;
      outerRadius -= amount;
    }
  }
  const thresholdsToBarWidth = 0.2 * barWidth ** 0.92;
  const thresholdsBarWidth = thresholdBar ? Math.min(Math.max(thresholdsToBarWidth, 4), 12) : 0;
  const thresholdsBarSpacing = Math.min(Math.max(thresholdsBarWidth / 2, 2), 12);
  let thresholdsBarRadius = 0;
  if (thresholdsBarWidth > 0) {
    thresholdsBarRadius = outerRadius - thresholdsBarWidth / 2;
    maxRadiusW -= thresholdsBarWidth + thresholdsBarSpacing;
    maxRadiusH -= thresholdsBarWidth + thresholdsBarSpacing;
    outerRadius = Math.min(maxRadiusW, maxRadiusH);
  }
  let innerRadius = outerRadius - barWidth / 2;
  const belowCenterY = maxRadius * Math.sin(toRad(yMaxAngle));
  const rest = height2 - belowCenterY - margin * 2 - maxRadius;
  const centerX = width2 / 2;
  const centerYEndcapAdjustment = totalEndcapAdjustment - radiusEndcapAdjustment;
  const centerY = maxRadius + margin + rest / 2 - centerYEndcapAdjustment;
  if (barIndex > 0) {
    innerRadius = innerRadius - (barWidth + 4) * barIndex;
  }
  return {
    vizWidth: width2,
    vizHeight: height2,
    margin,
    gaugeBottomY: centerY + belowCenterY,
    radius: Math.max(innerRadius, 2),
    centerX,
    centerY,
    barWidth,
    barIndex,
    thresholdsBarWidth,
    thresholdsBarSpacing,
    thresholdsBarRadius,
    scaleLabelsFontSize,
    scaleLabelsSpacing,
    scaleLabelsRadius
  };
}
function panelGaugeGeometry(opts) {
  const shape = opts?.shape ?? "gauge";
  const endAngle = shape === "circle" ? 180 : ARC_END;
  const f = Number(opts?.barWidthFactor ?? 0.5);
  const glow = !!opts?.glow;
  const rounded = !!opts?.roundedBars;
  const thresholdBar = !!opts?.thresholdBar;
  const showScaleLabels = !!opts?.showScaleLabels;
  const showName = !!opts?.showName;
  const sparkline = !!opts?.sparkline;
  const pw = Number(opts?.panelWidth);
  const ph = Number(opts?.panelHeight);
  const usePanelPx = Number.isFinite(pw) && pw > 0 && Number.isFinite(ph) && ph > 0;
  const viewW = usePanelPx ? pw : PANEL_GAUGE_VIEW.width;
  const viewH = usePanelPx ? ph : shape === "circle" ? 100 : PANEL_GAUGE_VIEW.height;
  const calcW = viewW;
  const calcH = viewH;
  const baseDims = calculateDimensions(calcW, calcH, endAngle, glow, rounded, f, 0, false, false);
  const dims = calculateDimensions(
    calcW,
    calcH,
    endAngle,
    glow,
    rounded,
    f,
    0,
    thresholdBar,
    showScaleLabels
  );
  let cx = PANEL_GAUGE_VIEW.cx;
  let cy = PANEL_GAUGE_VIEW.cy;
  let r = PANEL_GAUGE_VIEW.radius;
  let stroke = Math.max(3, Math.min(14, PANEL_GAUGE_VIEW.stroke * (0.6 + f)));
  let gaugeBottomY = cy + r * Math.sin(toRad(Math.min(endAngle, 180)));
  if (usePanelPx && dims.radius > 0) {
    cx = dims.centerX;
    cy = dims.centerY;
    r = dims.radius;
    stroke = dims.barWidth;
    gaugeBottomY = dims.gaugeBottomY;
  } else if ((showScaleLabels || thresholdBar && showScaleLabels) && baseDims.radius > 0) {
    const rScale = dims.radius / baseDims.radius;
    r = Math.max(8, PANEL_GAUGE_VIEW.radius * rScale);
    if (baseDims.centerY > 0) {
      const cyShift = (dims.centerY - baseDims.centerY) * (viewH / calcH);
      cy = PANEL_GAUGE_VIEW.cy + cyShift;
    }
    gaugeBottomY = cy + r * Math.sin(toRad(Math.min(endAngle, 180)));
  }
  const scale = usePanelPx ? 1 : viewW / Math.max(calcW, 1);
  const scaleLabelsFontSize = showScaleLabels ? usePanelPx ? Math.max(10, dims.scaleLabelsFontSize) : Math.max(3.5, Math.min(8, dims.scaleLabelsFontSize * scale * (viewW / 100))) : 0;
  const scaleLabelsRadius = showScaleLabels ? usePanelPx ? dims.scaleLabelsRadius || r + stroke : Math.max(
    r + stroke * 0.5 + 2,
    (dims.scaleLabelsRadius || 0) * (PANEL_GAUGE_VIEW.radius / Math.max(baseDims.radius, 1))
  ) : r + 10;
  const thresholdsBarRadius = thresholdBar && dims.thresholdsBarRadius > 0 ? usePanelPx ? dims.thresholdsBarRadius : r + stroke * 0.75 + 1.5 : r + stroke * 0.75 + 1.5;
  const thresholdsBarWidth = dims.thresholdsBarWidth > 0 ? usePanelPx ? dims.thresholdsBarWidth : Math.max(2, Math.min(6, dims.thresholdsBarWidth * scale)) : 0;
  const LINE_HEIGHT_FACTOR2 = 1.21;
  const VALUE_SPACE_PERCENTAGE2 = 0.7;
  const SPARKLINE_SPACING2 = 8;
  const VALUE_WIDTH_TO_RADIUS_FACTOR2 = 0.82;
  const LARGE_RADIUS_SCALING_DECAY2 = 0.86;
  const NAME_TO_HEIGHT_FACTOR2 = 0.45;
  const MAX_NAME_HEIGHT_DIVISOR2 = 4;
  let maxValueHeight = VALUE_WIDTH_TO_RADIUS_FACTOR2 * r ** LARGE_RADIUS_SCALING_DECAY2;
  let maxNameHeight = r / MAX_NAME_HEIGHT_DIVISOR2;
  if (showName) {
    maxValueHeight = VALUE_WIDTH_TO_RADIUS_FACTOR2 * r ** LARGE_RADIUS_SCALING_DECAY2;
    maxNameHeight = NAME_TO_HEIGHT_FACTOR2 * r ** LARGE_RADIUS_SCALING_DECAY2;
  }
  const approxValueFont = Math.max(1, maxValueHeight / LINE_HEIGHT_FACTOR2);
  const approxNameFont = Math.max(usePanelPx ? 10 : 4.5, maxNameHeight / LINE_HEIGHT_FACTOR2);
  const valueHeight = approxValueFont * LINE_HEIGHT_FACTOR2;
  const nameHeight = showName ? approxNameFont * LINE_HEIGHT_FACTOR2 : 0;
  const valueY = showName ? cy - nameHeight * (1 - VALUE_SPACE_PERCENTAGE2) : cy;
  const nameY = showName ? valueY + valueHeight * VALUE_SPACE_PERCENTAGE2 : cy;
  let yOffset = 0;
  if (shape === "gauge") {
    yOffset += (valueHeight + nameHeight) / 4;
  }
  if (sparkline) {
    yOffset += SPARKLINE_SPACING2;
  }
  const valueTextY = usePanelPx ? valueY - yOffset : shape === "circle" ? cy : cy + r * 0.18;
  const nameTextY = usePanelPx ? nameY - yOffset : shape === "circle" ? cy + r * 0.38 : cy + r * 0.42;
  const SPARKLINE_HEIGHT_DIVISOR = 4;
  const SPARKLINE_WIDTH_FACTOR_ARC = 1.4;
  const SPARKLINE_WIDTH_FACTOR_CIRCLE = 1.6;
  const sparkHeight = r / SPARKLINE_HEIGHT_DIVISOR;
  const sparkWidth = r * (shape === "gauge" ? SPARKLINE_WIDTH_FACTOR_ARC : SPARKLINE_WIDTH_FACTOR_CIRCLE) - stroke;
  const sparkY1 = usePanelPx ? gaugeBottomY - SPARKLINE_SPACING2 : Math.min(viewH - 2, viewH - 6);
  const sparkY0 = usePanelPx ? sparkY1 - sparkHeight : Math.min(viewH - 4, cy + r * 0.55);
  return {
    viewW,
    viewH,
    cx,
    cy,
    r,
    stroke,
    valueTextY,
    nameTextY,
    sparkY0,
    sparkY1,
    sparkWidth: Math.max(8, sparkWidth),
    sparkHeight: Math.max(4, sparkHeight),
    scaleLabelsFontSize,
    scaleLabelsRadius,
    thresholdsBarRadius,
    thresholdsBarWidth,
    pixelSpace: usePanelPx,
    gaugeBottomY
  };
}
const BAR_GAUGE_LAYOUT = {
  MIN_VALUE_HEIGHT: 18,
  MAX_VALUE_HEIGHT: 50,
  MAX_VALUE_WIDTH: 150,
  TITLE_LINE_HEIGHT: 1.5,
  VALUE_LINE_HEIGHT: 1,
  VALUE_LEFT_PADDING: 10,
  VALUE_RIGHT_OVERFLOW_PADDING: 15,
  DEFAULT_ITEM_SPACING: 8,
  DEFAULT_LCD_CELL_WIDTH: 12,
  MIN_VIZ_WIDTH: 8,
  /** option default minVizHeight in panel cfg is often 16; renderer floor stays 18 */
  OPTION_MIN_VIZ_HEIGHT: 16,
  /** Grafana title-to-left max width ratio */
  MAX_TITLE_WIDTH_RATIO: 0.4,
  /** Auto namePlacement: show above when height exceeds this */
  AUTO_ABOVE_HEIGHT: 40,
  AVG_CHAR_WIDTH: 7
};
function calculateTitleDimensions(args) {
  const title = args.title ?? "";
  const orientation = String(args.orientation ?? "horizontal");
  const namePlacement = String(args.namePlacement ?? "auto");
  const height2 = Math.max(0, Number(args.height) || 0);
  const width2 = Math.max(0, Number(args.width) || 0);
  if (!title) {
    return { fontSize: 0, width: 0, height: 0, placement: "above" };
  }
  if (namePlacement === "hidden") {
    return { fontSize: 0, width: 0, height: 0, placement: "hidden" };
  }
  if (orientation === "vertical") {
    const fontSize = args.titleSize ?? 14;
    return {
      fontSize,
      width: width2,
      height: fontSize * BAR_GAUGE_LAYOUT.TITLE_LINE_HEIGHT,
      placement: "below"
    };
  }
  const shouldDisplayAbove = height2 > BAR_GAUGE_LAYOUT.AUTO_ABOVE_HEIGHT && namePlacement === "auto" || namePlacement === "top";
  if (shouldDisplayAbove) {
    if (args.titleSize != null && Number.isFinite(args.titleSize)) {
      return {
        fontSize: Number(args.titleSize),
        width: 0,
        height: Number(args.titleSize) * BAR_GAUGE_LAYOUT.TITLE_LINE_HEIGHT,
        placement: "above"
      };
    }
    const maxTitleHeightRatio = 0.45;
    const titleHeight = Math.max(
      Math.min(height2 * maxTitleHeightRatio, BAR_GAUGE_LAYOUT.MAX_VALUE_HEIGHT),
      17
    );
    return {
      fontSize: titleHeight / BAR_GAUGE_LAYOUT.TITLE_LINE_HEIGHT,
      width: 0,
      height: titleHeight,
      placement: "above"
    };
  }
  if (namePlacement === "left" || namePlacement === "auto") {
    const maxTitleHeightRatio = 0.6;
    const titleHeight = Math.max(height2 * maxTitleHeightRatio, BAR_GAUGE_LAYOUT.MIN_VALUE_HEIGHT);
    const titleFontSize = titleHeight / BAR_GAUGE_LAYOUT.TITLE_LINE_HEIGHT;
    const textWidth = Math.min(
      title.length * BAR_GAUGE_LAYOUT.AVG_CHAR_WIDTH + 15,
      width2 * BAR_GAUGE_LAYOUT.MAX_TITLE_WIDTH_RATIO
    );
    return {
      fontSize: args.titleSize ?? titleFontSize,
      height: 0,
      width: textWidth,
      placement: "left"
    };
  }
  return {
    fontSize: 12,
    width: 0,
    height: 18,
    placement: "above"
  };
}
function calculateBarAndValueDimensions(args) {
  const height2 = Math.max(1, Number(args.height) || 100);
  const width2 = Math.max(1, Number(args.width) || 200);
  const orientation = String(args.orientation ?? "horizontal");
  const titleDim = calculateTitleDimensions({
    height: height2,
    width: width2,
    orientation,
    namePlacement: args.namePlacement,
    title: args.title,
    titleSize: args.titleSize
  });
  const valueString = args.valueText ?? "";
  const fontSizeToMeasureWith = args.valueSize ?? Math.max(titleDim.fontSize, 12);
  const realValueWidth = valueString.length * (fontSizeToMeasureWith * 0.55) + BAR_GAUGE_LAYOUT.VALUE_LEFT_PADDING * 2;
  let maxBarHeight = 0;
  let maxBarWidth = 0;
  let valueHeight = 0;
  let valueWidth = 0;
  let wrapperWidth = 0;
  let wrapperHeight = 0;
  const valueHidden = args.valueMode === "hidden";
  if (orientation === "vertical") {
    if (args.valueSize != null && Number.isFinite(args.valueSize)) {
      valueHeight = Number(args.valueSize) * BAR_GAUGE_LAYOUT.VALUE_LINE_HEIGHT;
    } else {
      valueHeight = Math.min(
        Math.max(height2 * 0.1, BAR_GAUGE_LAYOUT.MIN_VALUE_HEIGHT),
        BAR_GAUGE_LAYOUT.MAX_VALUE_HEIGHT
      );
    }
    valueWidth = width2;
    if (valueHidden) {
      valueHeight = 0;
      valueWidth = 0;
    }
    maxBarHeight = Math.max(1, height2 - (titleDim.height + valueHeight));
    maxBarWidth = width2;
    wrapperWidth = width2;
    wrapperHeight = Math.max(1, height2 - titleDim.height);
  } else {
    if (valueHidden) {
      valueHeight = 0;
      valueWidth = 0;
    } else {
      valueHeight = Math.max(1, height2 - titleDim.height);
      valueWidth = Math.max(
        Math.min(width2 * 0.2, BAR_GAUGE_LAYOUT.MAX_VALUE_WIDTH),
        realValueWidth
      );
      valueWidth = Math.min(BAR_GAUGE_LAYOUT.MAX_VALUE_WIDTH, valueWidth);
    }
    maxBarHeight = Math.max(1, height2 - titleDim.height);
    maxBarWidth = Math.max(1, width2 - valueWidth - titleDim.width);
    if (titleDim.placement === "above") {
      wrapperWidth = width2;
      wrapperHeight = Math.max(1, height2 - titleDim.height);
    } else {
      wrapperWidth = Math.max(1, width2 - titleDim.width);
      wrapperHeight = height2;
    }
  }
  return {
    valueWidth,
    valueHeight,
    maxBarWidth,
    maxBarHeight,
    wrapperHeight,
    wrapperWidth
  };
}
function resolveTitlePlacement(args) {
  if (!args.hasTitle) return "hidden";
  const dim = calculateTitleDimensions({
    height: args.panelHeight ?? 100,
    width: 200,
    orientation: args.orientation,
    namePlacement: args.namePlacement,
    title: !args.hasTitle ? "" : "x"
  });
  return dim.placement;
}
const _hoisted_1$2K = ["data-reduce-calcs", "data-reduce-values", "data-multi", "data-legend-show", "data-legend-placement", "data-legend-display-mode", "data-display-mode", "data-name-placement", "data-title-placement", "data-value-mode", "data-orientation", "data-show-unfilled", "data-sizing", "data-min-viz-height", "data-min-viz-width", "data-item-spacing", "data-max-value-width", "data-min-value-height", "data-max-bar-height", "data-max-bar-width", "data-value-width", "data-max-viz-height"];
const _hoisted_2$2d = ["data-title-placement"];
const _hoisted_3$1Z = {
  class: "bargauge-body",
  "data-testid": "bargauge-body"
};
const _hoisted_4$1H = { class: "bargauge-track-wrap" };
const _hoisted_5$1v = {
  key: 0,
  class: "empty"
};
const _hoisted_6$1i = ["data-placement", "data-mode", "data-item-count"];
const _hoisted_7$18 = {
  key: 0,
  class: "bargauge-legend-head",
  "data-testid": "bargauge-legend-head"
};
const _hoisted_8$10 = { class: "bargauge-legend-name" };
const _hoisted_9$Y = {
  key: 0,
  class: "bargauge-legend-val"
};
const _hoisted_10$P = ["data-reduce-calcs", "data-reduce-fields", "data-reduce-values", "data-reduce-limit", "data-panel-w", "data-panel-h", "data-display-mode", "data-show-threshold-labels", "data-show-threshold-markers", "data-gauge-r", "data-gauge-cy", "data-scale-labels-r", "data-sizing", "data-shape", "data-text-mode", "data-bar-shape", "data-neutral", "data-endpoint", "data-segment-count", "data-segment-spacing", "data-min-viz-width", "data-min-viz-height", "data-bar-width-factor", "data-multi", "data-orientation", "data-resolved-orientation", "data-sparkline", "data-bar-glow", "data-center-glow", "data-gradient-effect"];
const _hoisted_11$K = {
  key: 0,
  class: "empty"
};
const _hoisted_12$E = ["data-orientation"];
const _hoisted_13$D = ["data-bar-glow", "data-center-glow", "data-sparkline"];
const _hoisted_14$y = ["viewBox", "preserveAspectRatio"];
const _hoisted_15$v = ["d", "stroke-width", "stroke-linecap"];
const _hoisted_16$s = {
  key: 0,
  "data-testid": "gauge-thresholds-bar"
};
const _hoisted_17$q = ["id"];
const _hoisted_18$q = ["width", "height"];
const _hoisted_19$p = ["d", "stroke-width"];
const _hoisted_20$n = ["x", "width", "height", "mask"];
const _hoisted_21$f = ["cx", "cy", "r", "fill"];
const _hoisted_22$b = ["d", "stroke", "stroke-width", "stroke-linecap", "data-testid"];
const _hoisted_23$8 = ["id"];
const _hoisted_24$8 = ["width", "height"];
const _hoisted_25$6 = ["d", "stroke-width", "stroke-linecap"];
const _hoisted_26$6 = ["x", "y", "width", "height", "mask"];
const _hoisted_27$5 = ["cx", "cy", "r", "fill", "opacity"];
const _hoisted_28$5 = ["x1", "y1", "x2", "y2", "stroke"];
const _hoisted_29$5 = ["x", "y", "font-size"];
const _hoisted_30$5 = ["x", "y", "data-value", "fill", "font-size"];
const _hoisted_31$5 = ["x", "y", "fill", "font-size"];
const TRACK_COLOR = "var(--grafana-hover)";
const _sfc_main$3A = /* @__PURE__ */ defineComponent({
  __name: "GaugeRenderer",
  props: {
    data: {},
    fieldConfig: {},
    options: {},
    mode: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const reduceFieldsAttr = computed(() => String(opts.value.reduceOptions?.fields ?? ""));
    const reduceLimitAttr = computed(() => String(opts.value.reduceOptions?.limit ?? ""));
    const gaugeRootEl = ref(null);
    const panelSize = ref({ w: 0, h: 0 });
    let gaugeRo = null;
    function measureGaugePanel() {
      const el = gaugeRootEl.value;
      if (!el) return;
      const w = el.clientWidth || 0;
      const h2 = el.clientHeight || 0;
      if (w !== panelSize.value.w || h2 !== panelSize.value.h) {
        panelSize.value = { w, h: h2 };
      }
    }
    onMounted(() => {
      nextTick(() => {
        measureGaugePanel();
        if (typeof ResizeObserver !== "undefined" && gaugeRootEl.value) {
          gaugeRo = new ResizeObserver(() => {
            measureGaugePanel();
            paintSparklines();
          });
          gaugeRo.observe(gaugeRootEl.value);
        }
        paintSparklines();
      });
    });
    onBeforeUnmount(() => {
      gaugeRo?.disconnect();
      gaugeRo = null;
      for (const p of sparkPlots.values()) p.destroy();
      sparkPlots.clear();
    });
    const itemsCountHint = computed(() => {
      const frames = props.data?.series ?? [];
      let n = 0;
      for (const f of frames) {
        for (const field of f.fields ?? []) {
          if (field.type === "number") n += 1;
        }
      }
      return Math.max(1, n);
    });
    const geom = computed(() => {
      const labels = !!opts.value.showThresholdLabels;
      const pw = panelSize.value.w;
      const ph = panelSize.value.h;
      const textMode = String(opts.value.textMode ?? "auto");
      const hasDisplayName = (props.data?.series ?? []).some(
        (fr) => (fr.fields ?? []).some(
          (f) => f?.type === "number" && String(f?.config?.displayName ?? f?.config?.displayNameFromDS ?? "").trim()
        )
      );
      const showName = textMode === "name" || textMode === "value_and_name" || textMode === "auto" && (itemsCountHint.value > 1 || hasDisplayName);
      return panelGaugeGeometry({
        barWidthFactor: Number(opts.value.barWidthFactor ?? 0.5),
        roundedBars: opts.value.barShape == null ? false : String(opts.value.barShape) === "rounded",
        thresholdBar: opts.value.showThresholdMarkers !== false,
        showScaleLabels: labels,
        glow: !!opts.value.effects?.barGlow || !!opts.value.effects?.centerGlow,
        shape: String(opts.value.shape ?? "gauge"),
        panelWidth: pw > 40 ? pw : void 0,
        panelHeight: ph > 40 ? ph : void 0,
        showName,
        sparkline: opts.value.sparkline === true
      });
    });
    const CX = computed(() => geom.value.cx);
    const CY = computed(() => geom.value.cy);
    const R = computed(() => geom.value.r);
    const VIEW_W = computed(() => geom.value.viewW);
    const VIEW_H = computed(() => geom.value.viewH);
    const MIN_VALUE_HEIGHT = BAR_GAUGE_LAYOUT.MIN_VALUE_HEIGHT;
    const MAX_VALUE_HEIGHT = BAR_GAUGE_LAYOUT.MAX_VALUE_HEIGHT;
    const DEFAULT_ITEM_SPACING = BAR_GAUGE_LAYOUT.DEFAULT_ITEM_SPACING;
    const items = computed(
      () => prepareGaugeItems({
        series: props.data?.series ?? [],
        fieldDefaults: props.fieldConfig?.defaults ?? {},
        reduceCalc: opts.value.reduceOptions?.calcs?.[0],
        textMode: opts.value.textMode,
        fieldsFilter: opts.value.reduceOptions?.fields,
        showAllValues: opts.value.reduceOptions?.values === true,
        limit: opts.value.reduceOptions?.limit
      })
    );
    const multi = computed(() => items.value.length > 1);
    const shape = computed(() => String(opts.value.shape ?? "gauge"));
    function arcPath$1(startDeg, lengthDeg, radius) {
      return arcPath(startDeg, lengthDeg, arcGeom(), radius);
    }
    function trackArcs$1(it) {
      return trackArcs(it, arcGeom(), opts.value.neutral);
    }
    function thresholdTicks$1(it) {
      return thresholdTicks(it, arcGeom());
    }
    const showValueText = (it) => !!it.text;
    const showNameText = (it) => !!it.name;
    function lcdCells(it, cellCount) {
      const lcdW = Number(opts.value.lcdCellWidth ?? DEFAULT_LCD_CELL_WIDTH) || DEFAULT_LCD_CELL_WIDTH;
      const maxSize = Number(
        opts.value.minVizWidth ?? opts.value.maxVizWidth ?? (isVertical.value ? barTrackHeight.value * 4 : 180)
      ) || 180;
      const spacingRaw = Number(opts.value.itemSpacing);
      const spacing = Number.isFinite(spacingRaw) && spacingRaw >= 0 ? spacingRaw : DEFAULT_ITEM_SPACING;
      const value = it.min + it.pct * (it.max - it.min || 1);
      const colorAt = (pos) => {
        if (it.thresholds?.length) {
          const steps = [...it.thresholds].sort((a, b) => Number(a.value) - Number(b.value));
          let c = steps[0]?.color || it.color;
          for (const s of steps) {
            if (pos >= Number(s.value)) c = s.color || c;
          }
          return c || it.color;
        }
        return it.color;
      };
      let cells = buildLcdCells({
        min: it.min,
        max: it.max,
        value,
        color: it.color,
        colorAt,
        lcdCellWidth: lcdW,
        maxSize,
        itemSpacing: spacing
      });
      return cells.map((c) => ({
        on: c.on,
        color: c.color,
        shade: c.shade,
        size: c.size,
        spacing: c.spacing
      }));
    }
    function lcdCellStyle$1(cell) {
      return lcdCellStyle(cell, isVertical.value, DEFAULT_ITEM_SPACING);
    }
    function barFillStyle$1(it) {
      return barFillStyle(it, String(opts.value.displayMode ?? "gradient"));
    }
    function barFillStyleV$1(it) {
      return barFillStyleV(it, String(opts.value.displayMode ?? "gradient"));
    }
    const strokeW = computed(() => geom.value.stroke);
    function arcGeom() {
      return {
        shape: shape.value,
        r: R.value,
        cx: CX.value,
        cy: CY.value,
        stroke: strokeW.value,
        scaleLabelsRadius: geom.value.scaleLabelsRadius,
        thresholdsBarRadius: geom.value.thresholdsBarRadius
      };
    }
    const segmentCount = computed(() => Math.max(1, Math.floor(Number(opts.value.segmentCount ?? 1))));
    const segmentSpacing = computed(() => Math.max(0, Number(opts.value.segmentSpacing ?? 0.3)));
    function segmentArcs$1(it) {
      return segmentArcs(
        it,
        arcGeom(),
        segmentCount.value,
        segmentSpacing.value,
        opts.value.neutral
      );
    }
    function endpointPos$1(it) {
      return endpointPos(
        it,
        arcGeom(),
        opts.value.endpointMarker,
        opts.value.neutral
      );
    }
    function valueArcAngles$1(it) {
      return valueArcAngles(it, shape.value, opts.value.neutral);
    }
    const itemSpacing = computed(() => {
      const n = Number(opts.value.itemSpacing);
      return Number.isFinite(n) && n >= 0 ? n : DEFAULT_ITEM_SPACING;
    });
    const isManualSizing = computed(() => String(opts.value.sizing ?? "auto") === "manual");
    const barTrackHeight = computed(() => {
      const minH = isManualSizing.value ? Number(opts.value.minVizHeight) : Number.NaN;
      const maxH = isManualSizing.value ? Number(opts.value.maxVizHeight) : Number.NaN;
      let h2 = Number.isFinite(minH) && minH > 0 ? Math.max(MIN_VALUE_HEIGHT, Math.min(MAX_VALUE_HEIGHT, minH)) : MIN_VALUE_HEIGHT + 4;
      if (Number.isFinite(maxH) && maxH > 0) h2 = Math.min(h2, maxH);
      return h2;
    });
    const barTrackWidth = computed(() => {
      if (!isManualSizing.value) return 80;
      const minW = Number(opts.value.minVizWidth);
      if (Number.isFinite(minW) && minW > 0) return minW;
      return 80;
    });
    const isVertical = computed(() => {
      const o = String(opts.value.orientation ?? "auto");
      if (o === "vertical") return true;
      if (o === "horizontal") return false;
      const w = panelSize.value.w || 0;
      const h2 = panelSize.value.h || 0;
      if (w > 0 && h2 > 0) return w > h2;
      return false;
    });
    const isLcd = computed(() => String(opts.value.displayMode ?? "") === "lcd");
    const linecap = computed(
      () => String(opts.value.barShape ?? "") === "rounded" ? "round" : "butt"
    );
    function itemBarLayout(it) {
      const pw = panelSize.value.w > 40 ? panelSize.value.w : 0;
      const ph = panelSize.value.h > 40 ? panelSize.value.h : 0;
      const n = Math.max(1, items.value.length);
      const spacing = itemSpacing.value;
      let height2 = ph || (isVertical.value ? 200 : 36);
      let width2 = pw || (isVertical.value ? 80 : 400);
      if (ph && pw) {
        if (isVertical.value && n > 1) {
          width2 = Math.max(1, (pw - spacing * (n - 1)) / n);
          height2 = ph;
        } else if (!isVertical.value && n > 1) {
          height2 = Math.max(1, (ph - spacing * (n - 1)) / n);
          width2 = pw;
        }
      }
      if (isManualSizing.value) {
        if (!isVertical.value) {
          const minH = Number(opts.value.minVizHeight);
          const maxH = Number(opts.value.maxVizHeight);
          if (Number.isFinite(minH) && minH > 0) height2 = Math.max(height2, minH);
          if (Number.isFinite(maxH) && maxH > 0) height2 = Math.min(height2, maxH);
        } else {
          const minW = Number(opts.value.minVizWidth);
          if (Number.isFinite(minW) && minW > 0) width2 = Math.max(width2, minW);
        }
      }
      const title = it?.name ?? "";
      return calculateBarAndValueDimensions({
        height: height2,
        width: width2,
        orientation: isVertical.value ? "vertical" : "horizontal",
        namePlacement: String(opts.value.namePlacement ?? "auto"),
        title,
        valueText: it?.text ?? items.value[0]?.text ?? "0",
        valueMode: String(opts.value.valueMode ?? "color"),
        titleSize: Number(opts.value.text?.titleSize) || void 0,
        valueSize: Number(opts.value.text?.valueSize) || void 0
      });
    }
    const barItemLayout = computed(() => itemBarLayout(items.value[0]));
    const titlePlacement = computed(() => {
      const minH = Number(opts.value.minVizHeight);
      const panelHeight = panelSize.value.h > 40 ? panelSize.value.h : Number.isFinite(minH) && minH > 0 ? minH : isVertical.value ? 200 : 36;
      const hasTitle = items.value.some((it) => !!it.name);
      return resolveTitlePlacement({
        orientation: isVertical.value ? "vertical" : "horizontal",
        namePlacement: String(opts.value.namePlacement ?? "auto"),
        panelHeight,
        hasTitle
      });
    });
    function itemTitlePlacement(it) {
      if (!it.name || opts.value.namePlacement === "hidden") return "hidden";
      return titlePlacement.value;
    }
    const showBarLegend = computed(() => opts.value.legend?.showLegend === true);
    const barLegendPlacement = computed(() => String(opts.value.legend?.placement ?? "bottom"));
    const barLegendDisplay = computed(() => String(opts.value.legend?.displayMode ?? "list"));
    const barLegendItems = computed(
      () => items.value.map((it) => ({
        name: it.name || it.text || "Value",
        text: it.text,
        color: it.color || classicGreen()
      }))
    );
    function barValueStyle(it) {
      const layout = itemBarLayout(it);
      const mode2 = String(opts.value.valueMode ?? "color");
      const color = mode2 === "text" ? VALUE_TEXT_COLOR : mode2 === "hidden" ? "transparent" : it.color || classicGreen();
      const fixedSize2 = Number(opts.value.text?.valueSize);
      if (isVertical.value) {
        const fontSize2 = Number.isFinite(fixedSize2) && fixedSize2 > 0 ? fixedSize2 : calculateFontSize(
          String(it.text ?? ""),
          layout.valueWidth,
          layout.valueHeight,
          BAR_GAUGE_LAYOUT.VALUE_LINE_HEIGHT
        );
        return {
          color,
          height: `${layout.valueHeight}px`,
          width: `${layout.valueWidth}px`,
          maxWidth: "100%",
          display: "flex",
          alignItems: "center",
          justifyContent: "center",
          fontSize: `${Math.max(1, fontSize2)}px`,
          lineHeight: String(BAR_GAUGE_LAYOUT.VALUE_LINE_HEIGHT),
          paddingLeft: "0",
          textAlign: "center",
          overflow: "hidden",
          whiteSpace: "nowrap"
        };
      }
      const fontSize = Number.isFinite(fixedSize2) && fixedSize2 > 0 ? fixedSize2 : calculateFontSize(
        String(it.text ?? ""),
        Math.max(1, layout.valueWidth - BAR_GAUGE_LAYOUT.VALUE_LEFT_PADDING * 2),
        layout.valueHeight,
        BAR_GAUGE_LAYOUT.VALUE_LINE_HEIGHT
      );
      return {
        color,
        height: `${layout.valueHeight}px`,
        maxWidth: `${BAR_GAUGE_LAYOUT.MAX_VALUE_WIDTH}px`,
        minWidth: `${Math.min(40, layout.valueWidth)}px`,
        display: "flex",
        alignItems: "center",
        justifyContent: "flex-end",
        fontSize: `${Math.max(1, fontSize)}px`,
        lineHeight: String(BAR_GAUGE_LAYOUT.VALUE_LINE_HEIGHT),
        paddingLeft: `${BAR_GAUGE_LAYOUT.VALUE_LEFT_PADDING}px`,
        overflow: "hidden",
        whiteSpace: "nowrap"
      };
    }
    function barTrackBoxStyle(it) {
      const layout = itemBarLayout(it);
      if (isVertical.value) {
        const h2 = Math.max(1, layout.maxBarHeight);
        return {
          "--bar-h": `${h2}px`,
          "height": `${h2}px`,
          "width": "100%",
          // Grafana emptyBar: theme.colors.background.secondary (dark gray15)
          "background": opts.value.showUnfilled === false ? "transparent" : "var(--grafana-hover)"
        };
      }
      return {
        "--bar-h": `${barTrackHeight.value}px`,
        "height": `${barTrackHeight.value}px`,
        "background": opts.value.showUnfilled === false ? "transparent" : "var(--grafana-hover)"
      };
    }
    function barLcdBoxStyle(it) {
      const layout = itemBarLayout(it);
      if (isVertical.value) {
        return {
          height: `${Math.max(1, layout.maxBarHeight)}px`,
          width: `${Math.max(12, layout.maxBarWidth || 40)}px`
        };
      }
      return {
        height: `${opts.value.minVizHeight || barTrackHeight.value}px`,
        width: "100%"
      };
    }
    const effects = computed(() => {
      const e = opts.value.effects ?? {};
      return {
        gradient: e.gradient === true,
        barGlow: e.barGlow === true,
        centerGlow: e.centerGlow === true
      };
    });
    const showSparkline = computed(() => opts.value.sparkline === true);
    const sparkHosts = ref({});
    const sparkPlots = /* @__PURE__ */ new Map();
    function setSparkHost(i, el) {
      sparkHosts.value[i] = el || null;
    }
    function paintSparklines() {
      if (!showSparkline.value) {
        for (const p of sparkPlots.values()) p.destroy();
        sparkPlots.clear();
        return;
      }
      const list = items.value;
      for (const [i, it] of list.entries()) {
        const host = sparkHosts.value[i];
        const prev = sparkPlots.get(i);
        if (prev) {
          prev.destroy();
          sparkPlots.delete(i);
        }
        if (!host || it.spark.length < 2) {
          if (host) host.innerHTML = "";
          continue;
        }
        const w = Math.max(2, Math.floor(geom.value.sparkWidth));
        const h2 = Math.max(2, Math.floor(geom.value.sparkHeight));
        host.innerHTML = "";
        host.style.width = `${w}px`;
        host.style.height = `${h2}px`;
        let min = Math.min(...it.spark);
        let max = Math.max(...it.spark);
        if (min === max) {
          if (min === 0) max = 1;
          else if (min < 0) min *= 2;
          else max *= 2;
        }
        const stroke = it.color || classicGreen();
        const fillColor = stroke.startsWith("#") ? stroke : classicGreen();
        const opacity = 0.4;
        const xs = it.spark.map((_, idx) => idx);
        const ys = it.spark.slice();
        const rangePad = 3;
        const plot = new uPlot(
          {
            width: w,
            height: h2,
            pxAlign: false,
            cursor: { show: false, x: false, y: false },
            legend: { show: false },
            padding: [rangePad, rangePad, rangePad, rangePad],
            scales: {
              x: { time: false, range: [0, Math.max(1, it.spark.length - 1)] },
              y: { range: [min, max] }
            },
            axes: [
              { show: false, scale: "x" },
              { show: false, scale: "y" }
            ],
            series: [
              {},
              {
                stroke,
                width: 1.5,
                // Grafana getOpacityGradientFn — vertical fade line→transparent
                fill: (u) => {
                  const { top, height: height2 } = u.bbox;
                  const g = u.ctx.createLinearGradient(0, top, 0, top + height2);
                  g.addColorStop(0, hexToRgba(fillColor, opacity));
                  g.addColorStop(1, hexToRgba(fillColor, 0));
                  return g;
                },
                // Grafana showHighlights + lastNotNull → last point size 6
                points: {
                  show: (_u, _s, i2) => i2 === it.spark.length - 1,
                  size: 6,
                  width: 0,
                  fill: stroke,
                  stroke
                },
                pxAlign: false,
                // Grafana LineInterpolation.Smooth
                paths: uPlot.paths?.spline?.() ?? void 0
              }
            ]
          },
          [xs, ys],
          host
        );
        sparkPlots.set(i, plot);
      }
      for (const key of [...sparkPlots.keys()]) {
        if (key >= list.length) {
          sparkPlots.get(key)?.destroy();
          sparkPlots.delete(key);
        }
      }
    }
    watch(
      () => [
        items.value,
        geom.value.sparkWidth,
        geom.value.sparkHeight,
        showSparkline.value,
        panelSize.value.w,
        panelSize.value.h
      ],
      () => nextTick(() => paintSparklines()),
      { deep: true }
    );
    function valueFontSize(it) {
      return radialValueFontSize(String(it.text ?? ""), R.value, strokeW.value);
    }
    function nameFontSize(it) {
      const title = it.name || it.titleForLayout || "";
      return radialNameFontSize(title, R.value, strokeW.value, showValueText(it), !!it.name);
    }
    function valueTextYFor(it) {
      return radialValueTextY({
        cx: CX.value,
        cy: CY.value,
        shape: shape.value,
        showName: !!it.name,
        valueFontSize: valueFontSize(it),
        nameFontSize: nameFontSize(it),
        pixelSpace: !!geom.value.pixelSpace,
        fallbackY: geom.value.valueTextY,
        showSparkline: showSparkline.value,
        sparkLen: it.spark.length
      });
    }
    function nameTextYFor(it) {
      return radialNameTextY({
        cy: CY.value,
        shape: shape.value,
        showValue: showValueText(it),
        valueFontSize: valueFontSize(it),
        nameFontSize: nameFontSize(it),
        pixelSpace: !!geom.value.pixelSpace,
        fallbackY: geom.value.nameTextY,
        showSparkline: showSparkline.value,
        sparkLen: it.spark.length
      });
    }
    function thresholdBarArcs$1(it) {
      return thresholdBarArcs(
        it,
        arcGeom(),
        opts.value.showThresholdMarkers
      );
    }
    function gradientConicCss(it) {
      if (!effects.value.gradient) return null;
      const cfgSteps = props.fieldConfig?.defaults?.thresholds?.steps ?? [];
      const src = cfgSteps.length ? cfgSteps : it.thresholds ?? [];
      const range = it.max - it.min || 1;
      const stops = src.map((s) => ({
        t: Number(s.value) === Number.NEGATIVE_INFINITY ? 0 : Math.max(0, Math.min(1, (Number(s.value) - it.min) / range)),
        color: s.color || it.color || classicGreen()
      })).sort((a, b) => a.t - b.t);
      if (stops.length < 2) return null;
      const startDeg = startAngleForShape(shape.value);
      const fullDeg = angleRangeForShape(shape.value);
      const parts = [`${stops[0].color} 0deg`];
      let prev = stops[0].color;
      for (const s of stops) {
        if (s.t <= 0) {
          prev = s.color;
          parts[0] = `${s.color} 0deg`;
          continue;
        }
        if (s.t >= 1) break;
        const deg = (s.t * fullDeg).toFixed(1);
        parts.push(`${prev} ${deg}deg`, `${s.color} ${deg}deg`);
        prev = s.color;
      }
      parts.push(`${prev} ${fullDeg}deg`);
      if (shape.value !== "circle") {
        parts.push(`rgba(0, 0, 0, 0) ${fullDeg}deg`, `rgba(0, 0, 0, 0) 360deg`);
      }
      return `conic-gradient(from ${startDeg}deg, ${parts.join(", ")})`;
    }
    function conicValueStyle$1(it) {
      const style = conicValueStyle({
        shape: shape.value,
        color: it.color,
        startDeg: startAngleForShape(shape.value),
        fullDeg: angleRangeForShape(shape.value),
        r: R.value,
        stroke: strokeW.value
      });
      const grad = gradientConicCss(it);
      if (grad) style.backgroundImage = grad;
      return style;
    }
    function barGlowStyle$1(it) {
      return barGlowStyle(it.color, !!effects.value.barGlow);
    }
    function radialItemStyle() {
      if (!isManualSizing.value) return void 0;
      const style = {};
      const minW = Number(opts.value.minVizWidth);
      const minH = Number(opts.value.minVizHeight);
      if (Number.isFinite(minW) && minW > 0) style.minWidth = `${minW}px`;
      if (Number.isFinite(minH) && minH > 0) style.minHeight = `${minH}px`;
      return Object.keys(style).length ? style : void 0;
    }
    return (_ctx, _cache) => {
      return __props.mode === "bargauge" ? (openBlock(), createElementBlock("div", {
        key: 0,
        ref_key: "gaugeRootEl",
        ref: gaugeRootEl,
        class: normalizeClass(["bargauge-root", {
          "has-legend": showBarLegend.value,
          [`legend-${barLegendPlacement.value}`]: showBarLegend.value,
          [`name-${titlePlacement.value}`]: true,
          "vertical": isVertical.value
        }]),
        "data-testid": "panel-bargauge",
        "data-reduce-calcs": String((opts.value.reduceOptions?.calcs ?? []).join(",")),
        "data-reduce-values": String(!!opts.value.reduceOptions?.values),
        "data-multi": String(multi.value),
        "data-legend-show": String(showBarLegend.value),
        "data-legend-placement": barLegendPlacement.value,
        "data-legend-display-mode": barLegendDisplay.value,
        "data-display-mode": String(opts.value.displayMode ?? "basic"),
        "data-name-placement": String(opts.value.namePlacement ?? "auto"),
        "data-title-placement": String(titlePlacement.value),
        "data-value-mode": String(opts.value.valueMode ?? "color"),
        "data-orientation": String(opts.value.orientation ?? "horizontal"),
        "data-show-unfilled": String(opts.value.showUnfilled !== false),
        "data-sizing": String(opts.value.sizing ?? "auto"),
        "data-min-viz-height": String(opts.value.minVizHeight ?? barTrackHeight.value),
        "data-min-viz-width": String(opts.value.minVizWidth ?? barTrackWidth.value),
        "data-item-spacing": String(itemSpacing.value),
        "data-max-value-width": String(unref(BAR_GAUGE_LAYOUT).MAX_VALUE_WIDTH),
        "data-min-value-height": String(unref(MIN_VALUE_HEIGHT)),
        "data-max-bar-height": String(Math.round(barItemLayout.value.maxBarHeight)),
        "data-max-bar-width": String(Math.round(barItemLayout.value.maxBarWidth)),
        "data-value-width": String(Math.round(barItemLayout.value.valueWidth)),
        "data-max-viz-height": String(opts.value.maxVizHeight ?? "")
      }, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["bargauge-list", {
              vertical: isVertical.value,
              [`name-${titlePlacement.value}`]: true
            }]),
            style: normalizeStyle({ gap: `${itemSpacing.value}px` })
          },
          [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(items.value, (it, i) => {
                return openBlock(), createElementBlock("div", {
                  key: i,
                  class: normalizeClass(["bargauge", [`name-${itemTitlePlacement(it)}`, { vertical: isVertical.value }]]),
                  "data-title-placement": itemTitlePlacement(it),
                  style: normalizeStyle(
                    isVertical.value ? {
                      // Grafana VizRepeater vertical: each item gets vizWidth ≈ panelWidth/n
                      height: "100%",
                      width: `${Math.max(barItemLayout.value.wrapperWidth || panelSize.value.w || 80, 40)}px`,
                      flex: "1 1 auto",
                      maxWidth: "100%"
                    } : {
                      minHeight: `${Math.max(barTrackHeight.value, barItemLayout.value.wrapperHeight * 0.3)}px`,
                      width: "100%"
                    }
                  )
                }, [
                  itemTitlePlacement(it) !== "hidden" && it.name ? (openBlock(), createElementBlock(
                    "div",
                    {
                      key: 0,
                      class: "bargauge-label",
                      "data-testid": "bargauge-name",
                      style: normalizeStyle(
                        itemTitlePlacement(it) === "left" ? {
                          width: `${Math.max(48, Math.min(120, barItemLayout.value.wrapperWidth * 0.35))}px`,
                          maxWidth: "40%",
                          textAlign: "right",
                          paddingRight: "10px"
                        } : void 0
                      )
                    },
                    toDisplayString(it.name),
                    5
                    /* TEXT, STYLE */
                  )) : createCommentVNode("v-if", true),
                  createElementVNode("div", _hoisted_3$1Z, [
                    opts.value.valueMode !== "hidden" && isVertical.value ? (openBlock(), createElementBlock(
                      "div",
                      {
                        key: 0,
                        class: normalizeClass(["bargauge-value", {
                          "value-text": opts.value.valueMode === "text",
                          "value-color": opts.value.valueMode === "color" || !opts.value.valueMode
                        }]),
                        "data-testid": "bargauge-value",
                        style: normalizeStyle(barValueStyle(it))
                      },
                      toDisplayString(it.text),
                      7
                      /* TEXT, CLASS, STYLE */
                    )) : createCommentVNode("v-if", true),
                    createElementVNode("div", _hoisted_4$1H, [
                      isLcd.value ? (openBlock(), createElementBlock(
                        "div",
                        {
                          key: 0,
                          class: normalizeClass(["bargauge-lcd", { vertical: isVertical.value }]),
                          style: normalizeStyle(barLcdBoxStyle(it)),
                          "data-testid": "bargauge-lcd"
                        },
                        [
                          (openBlock(true), createElementBlock(
                            Fragment,
                            null,
                            renderList(lcdCells(it), (cell, ci) => {
                              return openBlock(), createElementBlock(
                                "div",
                                {
                                  key: ci,
                                  class: normalizeClass(["lcd-cell", { on: cell.on }]),
                                  style: normalizeStyle(lcdCellStyle$1(cell)),
                                  "data-testid": "bargauge-lcd-cell"
                                },
                                null,
                                6
                                /* CLASS, STYLE */
                              );
                            }),
                            128
                            /* KEYED_FRAGMENT */
                          ))
                        ],
                        6
                        /* CLASS, STYLE */
                      )) : (openBlock(), createElementBlock(
                        "div",
                        {
                          key: 1,
                          class: normalizeClass(["bargauge-track", [
                            String(opts.value.displayMode ?? "basic"),
                            {
                              "no-unfilled": opts.value.showUnfilled === false,
                              "vertical": isVertical.value
                            }
                          ]]),
                          style: normalizeStyle(barTrackBoxStyle(it)),
                          "data-testid": "bargauge-track"
                        },
                        [
                          createElementVNode(
                            "div",
                            {
                              class: "bargauge-fill",
                              style: normalizeStyle(isVertical.value ? barFillStyleV$1(it) : barFillStyle$1(it))
                            },
                            null,
                            4
                            /* STYLE */
                          )
                        ],
                        6
                        /* CLASS, STYLE */
                      ))
                    ]),
                    opts.value.valueMode !== "hidden" && !isVertical.value ? (openBlock(), createElementBlock(
                      "div",
                      {
                        key: 1,
                        class: normalizeClass(["bargauge-value", {
                          "value-text": opts.value.valueMode === "text",
                          "value-color": opts.value.valueMode === "color" || !opts.value.valueMode
                        }]),
                        "data-testid": "bargauge-value",
                        style: normalizeStyle(barValueStyle(it))
                      },
                      toDisplayString(it.text),
                      7
                      /* TEXT, CLASS, STYLE */
                    )) : createCommentVNode("v-if", true)
                  ])
                ], 14, _hoisted_2$2d);
              }),
              128
              /* KEYED_FRAGMENT */
            )),
            !items.value.length ? (openBlock(), createElementBlock("div", _hoisted_5$1v, "暂无数据")) : createCommentVNode("v-if", true)
          ],
          6
          /* CLASS, STYLE */
        ),
        showBarLegend.value ? (openBlock(), createElementBlock("ul", {
          key: 0,
          class: normalizeClass(["bargauge-legend", { "bargauge-legend--table": barLegendDisplay.value === "table" }]),
          "data-testid": "bargauge-legend",
          "data-shared-legend": "viz-legend",
          "data-placement": barLegendPlacement.value,
          "data-mode": barLegendDisplay.value,
          "data-item-count": String(barLegendItems.value.length)
        }, [
          barLegendDisplay.value === "table" ? (openBlock(), createElementBlock("li", _hoisted_7$18, [..._cache[0] || (_cache[0] = [
            createElementVNode(
              "i",
              { class: "bargauge-legend-swatch bargauge-legend-head__swatch" },
              null,
              -1
              /* CACHED */
            ),
            createElementVNode(
              "span",
              { class: "bargauge-legend-name" },
              "名称",
              -1
              /* CACHED */
            ),
            createElementVNode(
              "span",
              { class: "bargauge-legend-val" },
              "值",
              -1
              /* CACHED */
            )
          ])])) : createCommentVNode("v-if", true),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(barLegendItems.value, (li, liIdx) => {
              return openBlock(), createElementBlock("li", {
                key: liIdx,
                "data-testid": "bargauge-legend-item"
              }, [
                createElementVNode(
                  "i",
                  {
                    class: "bargauge-legend-swatch",
                    style: normalizeStyle({ background: li.color })
                  },
                  null,
                  4
                  /* STYLE */
                ),
                createElementVNode(
                  "span",
                  _hoisted_8$10,
                  toDisplayString(li.name),
                  1
                  /* TEXT */
                ),
                li.text ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_9$Y,
                  toDisplayString(li.text),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 10, _hoisted_6$1i)) : createCommentVNode("v-if", true)
      ], 10, _hoisted_1$2K)) : (openBlock(), createElementBlock("div", {
        key: 1,
        ref_key: "gaugeRootEl",
        ref: gaugeRootEl,
        class: "gauge-root",
        "data-testid": "panel-gauge",
        "data-reduce-calcs": String((opts.value.reduceOptions?.calcs ?? []).join(",")),
        "data-reduce-fields": reduceFieldsAttr.value,
        "data-reduce-values": String(!!opts.value.reduceOptions?.values),
        "data-reduce-limit": reduceLimitAttr.value,
        "data-panel-w": String(panelSize.value.w),
        "data-panel-h": String(panelSize.value.h),
        "data-display-mode": String(opts.value.displayMode ?? "gradient"),
        "data-show-threshold-labels": String(!!opts.value.showThresholdLabels),
        "data-show-threshold-markers": String(opts.value.showThresholdMarkers !== false),
        "data-gauge-r": String(R.value),
        "data-gauge-cy": String(CY.value),
        "data-scale-labels-r": String(geom.value.scaleLabelsRadius),
        "data-sizing": String(opts.value.sizing ?? "auto"),
        "data-shape": String(opts.value.shape ?? "gauge"),
        "data-text-mode": String(opts.value.textMode ?? "auto"),
        "data-bar-shape": String(opts.value.barShape ?? ""),
        "data-neutral": String(opts.value.neutral ?? ""),
        "data-endpoint": String(opts.value.endpointMarker ?? ""),
        "data-segment-count": String(segmentCount.value),
        "data-segment-spacing": String(segmentSpacing.value),
        "data-min-viz-width": String(opts.value.minVizWidth ?? ""),
        "data-min-viz-height": String(opts.value.minVizHeight ?? ""),
        "data-bar-width-factor": String(opts.value.barWidthFactor ?? 0.5),
        "data-multi": String(multi.value),
        "data-orientation": String(opts.value.orientation ?? "auto"),
        "data-resolved-orientation": isVertical.value ? "vertical" : "horizontal",
        "data-sparkline": String(!!opts.value.sparkline),
        "data-bar-glow": String(!!opts.value.effects?.barGlow),
        "data-center-glow": String(!!opts.value.effects?.centerGlow),
        "data-gradient-effect": String(!!opts.value.effects?.gradient)
      }, [
        !items.value.length ? (openBlock(), createElementBlock("div", _hoisted_11$K, "暂无数据")) : (openBlock(), createElementBlock("div", {
          key: 1,
          class: normalizeClass(["gauge-grid", { multi: multi.value, vertical: isVertical.value }]),
          "data-orientation": isVertical.value ? "vertical" : "horizontal"
        }, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(items.value, (it, i) => {
              return openBlock(), createElementBlock("div", {
                key: i,
                class: "gauge",
                style: normalizeStyle(radialItemStyle()),
                "data-bar-glow": String(effects.value.barGlow),
                "data-center-glow": String(effects.value.centerGlow),
                "data-sparkline": String(showSparkline.value)
              }, [
                (openBlock(), createElementBlock("svg", {
                  viewBox: `0 0 ${VIEW_W.value} ${VIEW_H.value}`,
                  class: "gauge-svg",
                  "aria-hidden": "true",
                  preserveAspectRatio: geom.value.pixelSpace ? "none" : "xMidYMid meet"
                }, [
                  createCommentVNode(" Track (unfilled only — Grafana RadialBar) "),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(trackArcs$1(it), (tr, tri) => {
                      return openBlock(), createElementBlock("path", {
                        key: `track${tri}`,
                        d: tr.d,
                        fill: "none",
                        stroke: TRACK_COLOR,
                        "stroke-width": strokeW.value,
                        "stroke-linecap": linecap.value,
                        "data-testid": "gauge-track"
                      }, null, 8, _hoisted_15$v);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  )),
                  createCommentVNode(" ThresholdsBar (outer multi-stop ring) "),
                  opts.value.showThresholdMarkers !== false && thresholdBarArcs$1(it).length ? (openBlock(), createElementBlock("g", _hoisted_16$s, [
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(thresholdBarArcs$1(it), (tb, tbi) => {
                        return openBlock(), createElementBlock(
                          Fragment,
                          {
                            key: `tb${tbi}`
                          },
                          [
                            createElementVNode("defs", null, [
                              createElementVNode("mask", {
                                id: `gauge-th-mask-${i}-${tbi}`,
                                maskUnits: "userSpaceOnUse",
                                maskContentUnits: "userSpaceOnUse"
                              }, [
                                createElementVNode("rect", {
                                  x: "0",
                                  y: "0",
                                  width: VIEW_W.value,
                                  height: VIEW_H.value,
                                  fill: "black"
                                }, null, 8, _hoisted_18$q),
                                createElementVNode("path", {
                                  d: tb.d,
                                  fill: "none",
                                  stroke: "white",
                                  "stroke-width": geom.value.thresholdsBarWidth > 0 ? geom.value.thresholdsBarWidth : Math.max(2, strokeW.value * 0.35),
                                  "stroke-linecap": "butt"
                                }, null, 8, _hoisted_19$p)
                              ], 8, _hoisted_17$q)
                            ]),
                            (openBlock(), createElementBlock("foreignObject", {
                              x: Math.round(CX.value - (geom.value.thresholdsBarRadius || R.value) - (geom.value.thresholdsBarWidth || 4)),
                              y: "0",
                              width: VIEW_W.value,
                              height: Math.max(
                                VIEW_H.value,
                                Math.ceil(
                                  ((geom.value.thresholdsBarRadius || R.value) + (geom.value.thresholdsBarWidth || 4)) * 2
                                )
                              ),
                              mask: `url(#gauge-th-mask-${i}-${tbi})`
                            }, [
                              createElementVNode(
                                "div",
                                {
                                  xmlns: "http://www.w3.org/1999/xhtml",
                                  style: normalizeStyle({
                                    width: `${Math.ceil(
                                      ((geom.value.thresholdsBarRadius || R.value) + (geom.value.thresholdsBarWidth || 4)) * 2
                                    )}px`,
                                    height: `${Math.ceil(
                                      ((geom.value.thresholdsBarRadius || R.value) + (geom.value.thresholdsBarWidth || 4)) * 2
                                    )}px`,
                                    backgroundImage: `conic-gradient(from ${unref(startAngleForShape)(shape.value)}deg, ${tb.color} ${-unref(angleRangeForShape)(shape.value) / 2}deg, ${tb.color} ${unref(angleRangeForShape)(shape.value)}deg, rgba(0,0,0,0) 0deg, rgba(0,0,0,0) ${unref(angleRangeForShape)(shape.value)}deg)`
                                  })
                                },
                                null,
                                4
                                /* STYLE */
                              )
                            ], 8, _hoisted_20$n))
                          ],
                          64
                          /* STABLE_FRAGMENT */
                        );
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ])) : createCommentVNode("v-if", true),
                  createCommentVNode(" Center glow (effects.centerGlow) "),
                  effects.value.centerGlow ? (openBlock(), createElementBlock("circle", {
                    key: 1,
                    cx: CX.value,
                    cy: CY.value,
                    r: R.value * 0.42,
                    fill: it.color || "var(--grafana-primary)",
                    opacity: "0.18",
                    "data-testid": "gauge-center-glow"
                  }, null, 8, _hoisted_21$f)) : createCommentVNode("v-if", true),
                  createCommentVNode(" Segmented bars when segmentCount > 1 "),
                  segmentCount.value > 1 ? (openBlock(true), createElementBlock(
                    Fragment,
                    { key: 2 },
                    renderList(segmentArcs$1(it), (seg, si) => {
                      return openBlock(), createElementBlock("path", {
                        key: `seg${si}`,
                        d: seg.d,
                        fill: "none",
                        stroke: seg.on ? it.color || "var(--grafana-primary)" : TRACK_COLOR,
                        "stroke-width": strokeW.value,
                        "stroke-linecap": linecap.value,
                        "data-testid": seg.on ? "gauge-segment-on" : "gauge-segment-off",
                        style: normalizeStyle(seg.on ? barGlowStyle$1(it) : void 0)
                      }, null, 12, _hoisted_22$b);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  )) : createCommentVNode("v-if", true),
                  createCommentVNode(" Grafana RadialArcPath: mask (relative path + translate) + conic FO "),
                  valueArcAngles$1(it).endValueAngle > 0.05 ? (openBlock(), createElementBlock(
                    Fragment,
                    { key: 3 },
                    [
                      createElementVNode("defs", null, [
                        createElementVNode("mask", {
                          id: `gauge-val-mask-${i}`,
                          maskUnits: "userSpaceOnUse",
                          maskContentUnits: "userSpaceOnUse"
                        }, [
                          createElementVNode("rect", {
                            x: "0",
                            y: "0",
                            width: VIEW_W.value,
                            height: VIEW_H.value,
                            fill: "black"
                          }, null, 8, _hoisted_24$8),
                          createElementVNode("path", {
                            d: arcPath$1(valueArcAngles$1(it).start, valueArcAngles$1(it).endValueAngle),
                            fill: "none",
                            stroke: "white",
                            "stroke-width": strokeW.value,
                            "stroke-linecap": linecap.value
                          }, null, 8, _hoisted_25$6)
                        ], 8, _hoisted_23$8)
                      ]),
                      (openBlock(), createElementBlock("foreignObject", {
                        x: Math.round(CX.value - R.value - strokeW.value),
                        y: Math.max(0, Math.round(CY.value - R.value - strokeW.value)),
                        width: VIEW_W.value,
                        height: Math.max(VIEW_H.value, Math.ceil((R.value + strokeW.value) * 2)),
                        mask: `url(#gauge-val-mask-${i})`,
                        "data-testid": "gauge-value-arc",
                        style: normalizeStyle(barGlowStyle$1(it))
                      }, [
                        createElementVNode(
                          "div",
                          {
                            xmlns: "http://www.w3.org/1999/xhtml",
                            style: normalizeStyle(conicValueStyle$1(it))
                          },
                          null,
                          4
                          /* STYLE */
                        )
                      ], 12, _hoisted_26$6))
                    ],
                    64
                    /* STABLE_FRAGMENT */
                  )) : createCommentVNode("v-if", true),
                  createCommentVNode(" Grafana: endpointMarker only when roundedBars (barShape=rounded) "),
                  endpointPos$1(it) && String(opts.value.barShape) === "rounded" && String(opts.value.endpointMarker ?? "point") !== "none" ? (openBlock(), createElementBlock("circle", {
                    key: 4,
                    cx: endpointPos$1(it)?.x,
                    cy: endpointPos$1(it)?.y,
                    r: String(opts.value.endpointMarker) === "glow" ? Math.max(2, strokeW.value * 0.35) : Math.max(2, strokeW.value * 0.25),
                    fill: it.color || "var(--grafana-primary)",
                    opacity: String(opts.value.endpointMarker) === "glow" ? 0.85 : 1,
                    "data-testid": "gauge-endpoint"
                  }, null, 8, _hoisted_27$5)) : createCommentVNode("v-if", true),
                  opts.value.showThresholdMarkers !== false ? (openBlock(), createElementBlock(
                    Fragment,
                    { key: 5 },
                    [
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(thresholdTicks$1(it), (tk, ti) => {
                          return openBlock(), createElementBlock("line", {
                            key: `t${ti}`,
                            x1: tk.x1,
                            y1: tk.y1,
                            x2: tk.x2,
                            y2: tk.y2,
                            stroke: tk.color,
                            "stroke-width": "1.5"
                          }, null, 8, _hoisted_28$5);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      )),
                      opts.value.showThresholdLabels ? (openBlock(true), createElementBlock(
                        Fragment,
                        { key: 0 },
                        renderList(thresholdTicks$1(it), (tk, ti) => {
                          return openBlock(), createElementBlock("text", {
                            key: `l${ti}`,
                            x: tk.lx,
                            y: tk.ly,
                            "font-size": geom.value.scaleLabelsFontSize || 3.5,
                            fill: "var(--grafana-text-secondary)",
                            "text-anchor": "middle",
                            "dominant-baseline": "middle",
                            "data-testid": "gauge-threshold-label"
                          }, toDisplayString(tk.label), 9, _hoisted_29$5);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      )) : createCommentVNode("v-if", true)
                    ],
                    64
                    /* STABLE_FRAGMENT */
                  )) : createCommentVNode("v-if", true),
                  showValueText(it) ? (openBlock(), createElementBlock("text", {
                    key: 6,
                    x: CX.value,
                    y: valueTextYFor(it),
                    "text-anchor": "middle",
                    "dominant-baseline": "middle",
                    class: "gauge-svg-value",
                    "data-testid": "gauge-value",
                    "data-value": String(it.numeric ?? it.text),
                    fill: unref(VALUE_TEXT_COLOR),
                    "font-size": String(valueFontSize(it)),
                    "font-weight": "400",
                    "font-family": "Inter, Helvetica, Arial, sans-serif"
                  }, toDisplayString(it.text), 9, _hoisted_30$5)) : createCommentVNode("v-if", true),
                  showNameText(it) ? (openBlock(), createElementBlock("text", {
                    key: 7,
                    x: CX.value,
                    y: nameTextYFor(it),
                    "text-anchor": "middle",
                    "dominant-baseline": "middle",
                    class: "gauge-svg-name",
                    fill: unref(NAME_TEXT_COLOR),
                    "font-size": String(nameFontSize(it)),
                    "font-family": "Inter, Helvetica, Arial, sans-serif"
                  }, toDisplayString(it.name), 9, _hoisted_31$5)) : createCommentVNode("v-if", true)
                ], 8, _hoisted_14$y)),
                createCommentVNode(" Grafana RadialSparkline: absolute uPlot under horseshoe "),
                showSparkline.value && it.spark.length > 1 ? (openBlock(), createElementBlock(
                  "div",
                  {
                    key: 0,
                    ref_for: true,
                    ref: (el) => setSparkHost(i, el),
                    class: "gauge-sparkline",
                    "data-testid": "gauge-sparkline",
                    style: normalizeStyle({
                      top: `${geom.value.sparkY0}px`,
                      left: "50%",
                      width: `${geom.value.sparkWidth}px`,
                      height: `${geom.value.sparkHeight}px`,
                      marginLeft: `${-geom.value.sparkWidth / 2}px`
                    })
                  },
                  null,
                  4
                  /* STYLE */
                )) : createCommentVNode("v-if", true)
              ], 12, _hoisted_13$D);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 10, _hoisted_12$E))
      ], 8, _hoisted_10$P));
    };
  }
});
const GaugeRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3A, [["__scopeId", "data-v-df4a9d44"]]);
const _sfc_main$3z = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GaugeRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "gauge",
    name: "仪表",
    description: "径向仪表盘",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$3z
).useFieldConfig().setPanelOptions((builder) => {
  const cat = ["仪表"];
  addStandardDataReduceOptions(builder);
  builder.addRadio(
    {
      id: "shape",
      path: "shape",
      name: "样式",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "圆形", value: "circle" },
          { label: "弧形", value: "gauge" }
        ]
      }
    },
    "gauge"
  ).addRadio(
    {
      id: "orientation",
      path: "orientation",
      name: "方向",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "水平", value: "horizontal" },
          { label: "垂直", value: "vertical" }
        ]
      }
    },
    "auto"
  ).addRadio(
    {
      id: "sizing",
      path: "sizing",
      name: "仪表尺寸",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "手动", value: "manual" }
        ]
      },
      showIf: (c) => c.orientation && c.orientation !== "auto"
    },
    "auto"
  ).addSlider(
    {
      id: "minVizWidth",
      path: "minVizWidth",
      name: "最小宽度",
      category: cat,
      editor: "slider",
      settings: { min: 0, max: 600 },
      showIf: (c) => c.sizing === "manual" && c.orientation === "vertical"
    },
    75
  ).addSlider(
    {
      id: "minVizHeight",
      path: "minVizHeight",
      name: "最小高度",
      category: cat,
      editor: "slider",
      settings: { min: 0, max: 600 },
      showIf: (c) => c.sizing === "manual" && c.orientation === "horizontal"
    },
    75
  ).addSlider(
    {
      id: "barWidthFactor",
      path: "barWidthFactor",
      name: "条宽因子",
      category: cat,
      editor: "slider",
      settings: { min: 0.1, max: 1, step: 0.01 }
    },
    0.5
  ).addSlider(
    {
      id: "segmentCount",
      path: "segmentCount",
      name: "分段数",
      category: cat,
      editor: "slider",
      settings: { min: 1, max: 100, step: 1 }
    },
    1
  ).addSlider(
    {
      id: "segmentSpacing",
      path: "segmentSpacing",
      name: "分段间距",
      category: cat,
      editor: "slider",
      settings: { min: 0, max: 1, step: 0.01 },
      showIf: (c) => Number(c.segmentCount) > 1
    },
    0.3
  ).addRadio(
    {
      id: "barShape",
      path: "barShape",
      name: "条形样式",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "扁平", value: "flat" },
          { label: "圆角", value: "rounded" }
        ]
      },
      showIf: (c) => Number(c.segmentCount ?? 1) === 1
    },
    "flat"
  ).addRadio(
    {
      id: "endpointMarker",
      path: "endpointMarker",
      name: "端点标记",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "点", value: "point" },
          { label: "光晕", value: "glow" },
          { label: "无", value: "none" }
        ]
      },
      showIf: (c) => c.barShape === "rounded" && Number(c.segmentCount ?? 1) === 1
    },
    "point"
  ).addSelect(
    {
      id: "textMode",
      path: "textMode",
      name: "文本模式",
      category: cat,
      editor: "select",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "值与名称", value: "value_and_name" },
          { label: "值", value: "value" },
          { label: "名称", value: "name" },
          { label: "无", value: "none" }
        ]
      }
    },
    "auto"
  ).addNumber(
    {
      id: "neutral",
      path: "neutral",
      name: "中性值",
      category: cat,
      editor: "number"
    },
    void 0
  ).addBoolean(
    {
      id: "sparkline",
      path: "sparkline",
      name: "迷你图",
      category: cat,
      editor: "boolean"
    },
    // Grafana defaultOptions.sparkline = true
    true
  ).addBoolean(
    {
      id: "showThresholdMarkers",
      path: "showThresholdMarkers",
      name: "显示阈值标记",
      category: cat,
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "showThresholdLabels",
      path: "showThresholdLabels",
      name: "显示阈值标签",
      category: cat,
      editor: "boolean"
    },
    false
  ).addText(
    {
      id: "effects",
      path: "effects",
      name: "特效",
      description: "Grafana EffectsEditor：gradient / barGlow / centerGlow",
      category: cat,
      editor: "text"
    },
    // Live Grafana 13.2 RadialGauge applies defaultGaugePanelEffects.gradient=true (conic-gradient FO).
    { gradient: true, barGlow: false, centerGlow: false }
  ).addBoolean(
    {
      id: "effects.gradient",
      path: "effects.gradient",
      name: "渐变",
      category: cat,
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "effects.barGlow",
      path: "effects.barGlow",
      name: "条形光晕",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "effects.centerGlow",
      path: "effects.centerGlow",
      name: "中心光晕",
      category: cat,
      editor: "boolean"
    },
    false
  );
  addTextSizeOptions(builder, { withTitle: true, withValue: true });
}).setRuntimeConsumedPaths([
  "reduceOptions.calcs",
  "reduceOptions.fields",
  "reduceOptions.values",
  "reduceOptions.limit",
  "shape",
  "orientation",
  "sizing",
  "minVizWidth",
  "minVizHeight",
  "barWidthFactor",
  "segmentCount",
  "segmentSpacing",
  "barShape",
  "endpointMarker",
  "textMode",
  "neutral",
  "sparkline",
  "showThresholdMarkers",
  "showThresholdLabels",
  "effects",
  "effects",
  "effects.gradient",
  "effects.barGlow",
  "effects.centerGlow"
]).register();
const _sfc_main$3y = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GaugeRenderer, {
        mode: "bargauge",
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "bargauge",
    name: "条形仪表",
    description: "水平/垂直条形仪表",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$3y
).useFieldConfig().setPanelOptions((builder) => {
  const cat = ["条形仪表"];
  addStandardDataReduceOptions(builder);
  builder.addRadio(
    {
      id: "orientation",
      path: "orientation",
      name: "方向",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "水平", value: "horizontal" },
          { label: "垂直", value: "vertical" }
        ]
      }
    },
    "auto"
  );
  addLegendOptions(builder, true, true, false);
  builder.addRadio(
    {
      id: "displayMode",
      path: "displayMode",
      name: "显示模式",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "渐变", value: "gradient" },
          { label: "复古 LCD", value: "lcd" },
          { label: "基本", value: "basic" }
        ]
      }
    },
    "gradient"
  ).addRadio(
    {
      id: "valueMode",
      path: "valueMode",
      name: "数值显示",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "值颜色", value: "color" },
          { label: "文本颜色", value: "text" },
          { label: "隐藏", value: "hidden" }
        ]
      }
    },
    "color"
  ).addRadio(
    {
      id: "namePlacement",
      path: "namePlacement",
      name: "名称位置",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "顶部", value: "top" },
          { label: "左侧", value: "left" },
          { label: "隐藏", value: "hidden" }
        ]
      },
      showIf: (c) => c.orientation !== "vertical"
    },
    "auto"
  ).addRadio(
    {
      id: "namePlacementV",
      path: "namePlacement",
      name: "名称位置",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "隐藏", value: "hidden" }
        ]
      },
      showIf: (c) => c.orientation === "vertical"
    },
    "auto"
  ).addBoolean(
    {
      id: "showUnfilled",
      path: "showUnfilled",
      name: "显示未填充区域",
      category: cat,
      editor: "boolean",
      showIf: (c) => c.displayMode !== "lcd"
    },
    true
  ).addRadio(
    {
      id: "sizing",
      path: "sizing",
      name: "条尺寸",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "手动", value: "manual" }
        ]
      }
    },
    "auto"
  ).addSlider(
    {
      id: "minVizWidth",
      path: "minVizWidth",
      name: "最小宽度",
      category: cat,
      editor: "slider",
      settings: { min: 0, max: 300 },
      showIf: (c) => c.sizing === "manual" && (c.orientation === "auto" || c.orientation === "vertical")
    },
    8
  ).addSlider(
    {
      id: "minVizHeight",
      path: "minVizHeight",
      name: "最小高度",
      category: cat,
      editor: "slider",
      settings: { min: 0, max: 300 },
      showIf: (c) => c.sizing === "manual" && (c.orientation === "auto" || c.orientation === "horizontal")
    },
    16
  ).addSlider(
    {
      id: "maxVizHeight",
      path: "maxVizHeight",
      name: "最大高度",
      category: cat,
      editor: "slider",
      settings: { min: 0, max: 300 },
      showIf: (c) => c.sizing === "manual" && (c.orientation === "auto" || c.orientation === "horizontal")
    },
    300
  );
  addTextSizeOptions(builder, { withTitle: true, withValue: true });
}).setRuntimeConsumedPaths([
  "reduceOptions.calcs",
  "reduceOptions.fields",
  "reduceOptions.values",
  "orientation",
  "displayMode",
  "valueMode",
  "namePlacement",
  "showUnfilled",
  "sizing",
  "minVizWidth",
  "minVizHeight",
  "maxVizHeight",
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement"
]).register();
function migrateTableDisplayModeToCellOptions(displayMode) {
  switch (displayMode) {
    case "basic":
    case "gradient-gauge":
    case "lcd-gauge":
    case "gauge": {
      let gaugeMode = "gradient";
      if (displayMode === "basic") gaugeMode = "basic";
      if (displayMode === "lcd-gauge") gaugeMode = "lcd";
      if (displayMode === "gauge" || displayMode === "gradient-gauge") gaugeMode = "gradient";
      return { type: "gauge", mode: gaugeMode };
    }
    case "color-background":
      return { type: "color-background", mode: "gradient" };
    case "color-background-solid":
      return { type: "color-background", mode: "basic" };
    case "color-text":
      return { type: "color-text" };
    case "json-view":
    case "json":
      return { type: "json-view" };
    case "image":
      return { type: "image" };
    case "markdown":
      return { type: "markdown" };
    case "pill":
      return { type: "pill" };
    case "sparkline":
      return { type: "sparkline" };
    case "geo":
      return { type: "geo" };
    case "data-links":
      return { type: "data-links" };
    case "actions":
      return { type: "actions" };
    case "auto":
    default:
      return { type: displayMode || "auto" };
  }
}
function getCellOptions(field, panelCellOptions) {
  const custom = field.config?.custom ?? {};
  if (custom.cellOptions && typeof custom.cellOptions === "object") {
    return custom.cellOptions;
  }
  if (custom.displayMode) {
    return migrateTableDisplayModeToCellOptions(String(custom.displayMode));
  }
  if (panelCellOptions && typeof panelCellOptions === "object") {
    return panelCellOptions;
  }
  if (typeof panelCellOptions === "string" && panelCellOptions) {
    return migrateTableDisplayModeToCellOptions(panelCellOptions);
  }
  return { type: "auto" };
}
function cellTypeFromOptions(opts) {
  return String(opts?.type ?? "auto");
}
const REDUCER_DISPLAY_NAME = {
  sum: "Total",
  mean: "Mean",
  min: "Min",
  max: "Max",
  last: "Last",
  lastNotNull: "Last *",
  first: "First",
  firstNotNull: "First *",
  count: "Count",
  range: "Range",
  delta: "Delta",
  diff: "Difference",
  variance: "Variance",
  stdDev: "StdDev",
  allValues: "All values",
  allIsZero: "All Zeros",
  allIsNull: "All Nulls",
  changeCount: "Change Count",
  distinctCount: "Distinct Count"
};
function reducerDisplayName(id) {
  return REDUCER_DISPLAY_NAME[id] || id;
}
function getFooterItems(fields, options, formatCfg) {
  const panelReducers = Array.isArray(options.reducers) && options.reducers.length ? options.reducers : ["sum"];
  const countRows = options.countRows === true;
  const fieldFilter = options.fields?.length ? new Set(options.fields) : null;
  return fields.map((f, i) => {
    const fieldReducers = f.config?.custom?.footer?.reducers;
    const reducers = fieldReducers?.length ? fieldReducers : panelReducers;
    if (f.type !== "number") {
      if (i === 0 && reducers.length) {
        return reducerDisplayName(reducers[0]);
      }
      return void 0;
    }
    if (fieldFilter) {
      const display = getFieldDisplayName(f);
      if (!fieldFilter.has(f.name) && !fieldFilter.has(display)) {
        return void 0;
      }
    }
    if (countRows) {
      const r2 = reduceField(f, ["count"]);
      const c = r2.count;
      if (c == null) return void 0;
      return [{ [reducerDisplayName("count")]: String(c) }];
    }
    if (!reducers.length) return void 0;
    const r = reduceField(f, reducers);
    const cfg = formatCfg?.(f) ?? f.config ?? {};
    const items = [];
    for (const name of reducers) {
      const v = r[name];
      if (v == null || typeof v === "number" && Number.isNaN(v)) continue;
      const label = reducerDisplayName(name);
      if (name === "count") {
        items.push({ [label]: String(v) });
      } else {
        items.push({ [label]: formatValue(Number(v), cfg) });
      }
    }
    return items.length ? items : void 0;
  });
}
function shouldShowFooter(options, fields) {
  const show = options?.show === true;
  const anyField = fields.some(
    (f) => Array.isArray(f.config?.custom?.footer?.reducers) && f.config.custom.footer.reducers.length
  );
  return show || anyField;
}
function isNestedFramesField(f) {
  if (!f) return false;
  return String(f.type) === "nestedFrames" || f.name === "__nestedFrames" || f.name === "Nested frames" || // legacy transform output name
  f.name === "nested";
}
function findNestedFramesField(fields) {
  return fields.find((f) => isNestedFramesField(f));
}
function displayFieldsExcludingNested(fields) {
  return fields.filter((f) => {
    if (isNestedFramesField(f)) return false;
    const hide = f.config?.custom?.hideFrom;
    if (hide === true || hide?.viz === true) return false;
    return true;
  });
}
function getNestedFramesForRow(nestedField, rowIndex) {
  if (!nestedField) return [];
  const raw = nestedField.values?.[rowIndex];
  if (raw == null) return [];
  if (Array.isArray(raw)) {
    if (raw.length === 0) return [];
    if (isDataFrameLike(raw[0])) return raw;
    if (Array.isArray(raw[0]) && raw[0].length && isDataFrameLike(raw[0][0])) {
      return raw.flat();
    }
  }
  if (isDataFrameLike(raw)) return [raw];
  return [];
}
function isDataFrameLike(v) {
  return !!v && typeof v === "object" && Array.isArray(v.fields);
}
function rowHasNestedContent(nestedField, rowIndex) {
  return getNestedFramesForRow(nestedField, rowIndex).some((f) => {
    const len = Number(f?.length ?? f?.fields?.[0]?.values?.length ?? 0);
    return len > 0;
  });
}
function cmpFieldValues(av, bv) {
  const an = Number(av);
  const bn = Number(bv);
  if (Number.isFinite(an) && Number.isFinite(bn)) return an - bn;
  return String(av ?? "").localeCompare(String(bv ?? ""));
}
function resolveField$1(fields, key, fieldDisplay2) {
  return fields.find((x) => x.name === key) || fields.find((x) => fieldDisplay2(x) === key);
}
function computeTableRowIndices(input) {
  const fields = input.fields ?? [];
  const fieldDisplay2 = input.fieldDisplay ?? ((f) => f.name);
  let idxs = Array.from({ length: input.length }, (_, i) => i);
  const q = String(input.filterText).trim().toLowerCase();
  if (q) {
    idxs = idxs.filter(
      (i) => fields.some(
        (field) => String(field.values[i] ?? "").toLowerCase().includes(q)
      )
    );
  }
  for (const [name, fq] of Object.entries(input.colFilters ?? {})) {
    const t2 = String(fq).trim().toLowerCase();
    if (!t2) continue;
    const field = resolveField$1(fields, name, fieldDisplay2);
    if (!field) continue;
    idxs = idxs.filter(
      (i) => String(field.values[i] ?? "").toLowerCase().includes(t2)
    );
  }
  const sorts = [];
  if (Array.isArray(input.sortBy) && input.sortBy.length) {
    for (const s of input.sortBy) {
      const key = String(s?.key ?? "").trim();
      if (!key) continue;
      sorts.push({
        key,
        dir: s.dir === "desc" ? "desc" : "asc"
      });
    }
  } else if (input.sortKey) {
    sorts.push({
      key: String(input.sortKey),
      dir: input.sortDir === "desc" ? "desc" : "asc"
    });
  }
  if (sorts.length) {
    const resolved = sorts.map((s) => ({
      field: resolveField$1(fields, s.key, fieldDisplay2),
      dir: s.dir === "desc" ? -1 : 1
    })).filter((s) => s.field);
    if (resolved.length) {
      idxs.sort((a, b) => {
        for (const s of resolved) {
          const field = s.field;
          const cmp = cmpFieldValues(field.values[a], field.values[b]);
          if (cmp !== 0) return s.dir * cmp;
        }
        return a - b;
      });
    }
  }
  return idxs;
}
function isGaugeCell(field, cellType) {
  if (field.type !== "number") return false;
  return cellType === "gauge" || cellType === "basic" || cellType === "gradient-gauge" || cellType === "lcd-gauge";
}
function gaugePct(field, value, fieldDefaults) {
  const n = Number(value);
  if (!Number.isFinite(n)) return 0;
  const cfg = { ...field.config, ...fieldDefaults ?? {} };
  const min = Number(cfg.min ?? 0);
  const max = Number(cfg.max ?? Math.max(100, n, 1));
  return Math.max(0, Math.min(1, (n - min) / (max - min || 1)));
}
function tableLcdCells(field, value, fieldDefaults) {
  const cfg = { ...field.config, ...fieldDefaults ?? {} };
  const n = Number(value);
  const min = Number(cfg.min ?? 0);
  const max = Number(cfg.max ?? 100);
  const color = getFieldColor(n, cfg) || classicBlue();
  return buildLcdCells({
    min,
    max,
    value: Number.isFinite(n) ? n : min,
    color,
    lcdCellWidth: 8,
    maxSize: 80,
    itemSpacing: 2,
    colorAt: (pos) => getFieldColor(pos, cfg) || color
  });
}
function gaugeModeClass(field, cellType, panelCellOptions) {
  const co = getCellOptions(field, panelCellOptions);
  const mode2 = String(co.mode ?? "");
  if (cellType === "gauge" || cellType === "basic" || cellType === "gradient-gauge" || cellType === "lcd-gauge") {
    if (mode2 === "lcd" || cellType === "lcd-gauge") return "lcd-gauge";
    if (mode2 === "basic" || cellType === "basic") return "basic";
    return "gradient-gauge";
  }
  return cellType;
}
function sparkPoints(value) {
  let arr = [];
  if (Array.isArray(value)) arr = value.map(Number).filter(Number.isFinite);
  else if (typeof value === "string" && value.includes(",")) {
    arr = value.split(",").map(Number).filter(Number.isFinite);
  }
  if (arr.length < 2) return "";
  const min = Math.min(...arr);
  const max = Math.max(...arr);
  const w = 64;
  const h2 = 18;
  return arr.map((v, i) => {
    const x = i / (arr.length - 1) * w;
    const y = h2 - (v - min) / (max - min || 1) * (h2 - 2) - 1;
    return `${x},${y}`;
  }).join(" ");
}
function isSparkline(cellType, value) {
  return cellType === "sparkline" || Array.isArray(value) && value.every((x) => typeof x === "number");
}
function isImage(cellType, value) {
  return cellType === "image" && typeof value === "string" && /^(https?:|data:)/i.test(value);
}
function imageAlt(field, panelCellOptions) {
  const co = getCellOptions(field, panelCellOptions);
  return co?.type === "image" ? co.alt : void 0;
}
function imageTitle(field, panelCellOptions) {
  const co = getCellOptions(field, panelCellOptions);
  return co?.type === "image" ? co.title : void 0;
}
function isMarkdown(cellType) {
  return cellType === "markdown";
}
function isGeo(cellType) {
  return cellType === "geo";
}
function isDataLinksOnly(cellType) {
  return cellType === "data-links";
}
function isActions(cellType) {
  return cellType === "actions";
}
function renderMarkdown(value) {
  let s = String(value ?? "");
  s = s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
  s = s.replaceAll(/`([^`]+)`/g, "<code>$1</code>");
  s = s.replaceAll(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
  s = s.replaceAll(/\*([^*]+)\*/g, "<em>$1</em>");
  s = s.replaceAll(
    /\[([^\]]+)\]\(([^)]+)\)/g,
    '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
  );
  s = s.replaceAll("\n", "<br/>");
  return s;
}
function formatGeoCell(value) {
  if (value == null || value === "") return { label: "" };
  if (typeof value === "object" && value) {
    const o = value;
    if (o.type === "Point" && Array.isArray(o.coordinates)) {
      const [lon, lat] = o.coordinates;
      return {
        label: `${Number(lat).toFixed(5)}, ${Number(lon).toFixed(5)}`,
        lat: Number(lat),
        lon: Number(lon)
      };
    }
    if (o.lat != null && (o.lon != null || o.lng != null)) {
      const lat = Number(o.lat);
      const lon = Number(o.lon ?? o.lng);
      return { label: `${lat.toFixed(5)}, ${lon.toFixed(5)}`, lat, lon };
    }
  }
  const s = String(value).trim();
  const m = s.match(/^\s*(-?\d+(?:\.\d+)?)(?:\s|\s*,)\s*(-?\d+(?:\.\d+)?)\s*$/);
  if (m) {
    const a = Number(m[1]);
    const b = Number(m[2]);
    if (Math.abs(a) <= 90) return { label: `${a.toFixed(5)}, ${b.toFixed(5)}`, lat: a, lon: b };
    return { label: `${b.toFixed(5)}, ${a.toFixed(5)}`, lat: b, lon: a };
  }
  return { label: s };
}
function cellAlign(field) {
  const a = String(field.config?.custom?.align ?? "auto");
  if (a === "left" || a === "center" || a === "right") return a;
  if (field.type === "number") return "right";
  return "left";
}
function formatJsonCell(value) {
  if (value == null) return "";
  if (typeof value === "string") {
    try {
      return JSON.stringify(JSON.parse(value), null, 2);
    } catch {
      return value;
    }
  }
  try {
    return JSON.stringify(value, null, 2);
  } catch {
    return String(value);
  }
}
function typeIcon(field) {
  switch (field.type) {
    case "time":
      return "⏱";
    case "number":
      return "#";
    case "boolean":
      return "☑";
    case "string":
      return "T";
    default:
      return "·";
  }
}
function isPillType(cellType) {
  return cellType === "pill";
}
function isJsonViewType(cellType) {
  return cellType === "json-view";
}
function computeCellStyle(field, value, input) {
  if (input.hideValue) return { color: "transparent" };
  const mode2 = input.cellType;
  const cfg = { ...field.config, ...input.fieldDefaults ?? {} };
  const style = {};
  if (input.maxRowHeight) style.maxHeight = `${input.maxRowHeight}px`;
  if (input.wrapText) {
    style.whiteSpace = "normal";
    style.wordBreak = "break-word";
  }
  if (field.type === "number" && (mode2 === "color-text" || mode2 === "color-background" || mode2 === "color-background-solid")) {
    const color = getFieldColor(Number(value), cfg) || void 0;
    if (mode2 === "color-text" && color) style.color = color;
    if (mode2 === "color-background" && color) {
      style.background = `${color}33`;
      style.color = color;
    }
    if (mode2 === "color-background-solid" && color) {
      style.background = color;
      style.color = "var(--grafana-text-max-contrast)";
    }
  }
  if ((mode2 === "gauge" || mode2 === "basic" || mode2 === "gradient-gauge" || mode2 === "lcd-gauge") && field.type === "number") {
    const n = Number(value);
    const min = Number(cfg.min ?? 0);
    const max = Number(cfg.max ?? 100);
    const pct = Math.max(0, Math.min(100, (n - min) / (max - min || 1) * 100));
    const color = getFieldColor(n, cfg) || classicBlue();
    if (mode2 === "lcd-gauge") {
      style.background = `repeating-linear-gradient(90deg, ${color} 0 6px, transparent 6px 8px)`;
      style.backgroundSize = `${pct}% 100%`;
      style.backgroundRepeat = "no-repeat";
    } else if (mode2 === "gradient-gauge") {
      style.background = `linear-gradient(90deg, ${color}55 0%, ${color} ${pct}%, transparent ${pct}%)`;
    } else {
      style.background = `linear-gradient(90deg, ${color} ${pct}%, transparent ${pct}%)`;
    }
  }
  return style;
}
function displayCellValue(field, value, input) {
  const mode2 = input.cellType;
  if (value == null || value === "") return input.noValue;
  if (mode2 === "json-view") return formatJsonCell(value);
  if (mode2 === "pill") return String(value);
  if (mode2 === "geo") return formatGeoCell(value).label || input.noValue;
  if (mode2 === "markdown") return String(value);
  if (mode2 === "data-links" || mode2 === "actions") return "";
  if (input.hideValue) return "•";
  if (mode2 === "image" && typeof value === "string") return "";
  if (mode2 === "sparkline") return "";
  const processor = getDisplayProcessor({
    field: {
      ...field,
      config: { ...field.config, ...input.fieldDefaults ?? {} }
    },
    timeZone: input.timeZone || "browser"
  });
  return formattedValueToString(processor(value));
}
const TABLE_VIRT = {
  CELL_PADDING: 6,
  LINE_HEIGHT: 22,
  MAX_CELL_HEIGHT: 48,
  HEADER_HEIGHT: 34,
  /** Rows above/below viewport (react-window overscanCount default-ish) */
  OVERSCAN: 8,
  /** Grafana TableRT pagination soft limit when pagination is off historically */
  PAGINATION_LIMIT: 750,
  /** Average char width estimate when OffscreenCanvas is unavailable (~12px body) */
  AVG_CHAR_WIDTH: 7,
  LINE_SCALE_FACTOR: 1.17,
  LOW_LINE_PAD: 42,
  SINGLE_LINE_ESTIMATE_THRESHOLD: 18.5
};
function getDefaultRowHeight(cellHeight) {
  switch (String(cellHeight ?? "sm").toLowerCase()) {
    case "md":
      return 42;
    case "lg":
      return TABLE_VIRT.MAX_CELL_HEIGHT;
    case "sm":
    default:
      return 36;
  }
}
const _hoisted_1$2J = ["data-frames", "data-show-header", "data-footer", "data-pagination", "data-freeze", "data-frozen", "data-inspect", "data-style-field", "data-filterable", "data-custom-filterable", "data-column-min-width", "data-sort-by", "data-custom-align", "data-custom-min-width", "data-has-nested", "data-expanded-count", "data-renderer", "data-hide-value", "data-show-type-icons", "data-max-row-height", "data-tooltip-field", "data-wrap-text", "data-wrap-fields", "data-wrap-header-text", "data-custom-width", "data-cell-options", "data-tooltip-placement", "data-cell-height", "data-virtualized", "data-row-count", "data-row-height", "data-overscan"];
const _hoisted_2$2c = {
  key: 0,
  class: "table-toolbar",
  "data-testid": "table-frame-select"
};
const _hoisted_3$1Y = ["value"];
const _hoisted_4$1G = {
  key: 1,
  class: "table-col-filters",
  "data-testid": "table-col-filters"
};
const _hoisted_5$1u = ["placeholder", "value", "onInput"];
const _hoisted_6$1h = {
  class: "table-footer-row",
  "data-testid": "table-footer"
};
const _hoisted_7$17 = ["data-col-width"];
const _hoisted_8$$ = {
  key: 3,
  class: "antd-nested-expanded-list",
  "data-testid": "antd-nested-expanded-list"
};
const _hoisted_9$X = ["data-row-index"];
const _hoisted_10$O = {
  class: "nested-expand-cell",
  "data-testid": "table-nested-subtables"
};
const _hoisted_11$J = ["data-frame-index", "data-nested-recursive"];
const _hoisted_12$D = {
  key: 1,
  class: "nested-subtable",
  "data-testid": "table-nested-subtable"
};
const _hoisted_13$C = { key: 0 };
const _hoisted_14$x = {
  key: 4,
  class: "table-empty",
  "data-testid": "table-empty"
};
const _hoisted_15$u = {
  key: 5,
  class: "table-inspect",
  "data-testid": "table-inspect"
};
const _sfc_main$3x = /* @__PURE__ */ defineComponent({
  __name: "TableRenderer.antd",
  props: {
    data: {},
    fieldConfig: {},
    options: {},
    replaceVariables: {},
    width: {},
    height: {},
    nestDepth: { default: 0 }
  },
  setup(__props) {
    const TableRendererRouter = defineAsyncComponent(() => Promise.resolve().then(() => TableRenderer));
    const props = __props;
    const sortKey = ref(null);
    const sortDir = ref("asc");
    const sortSpecs = ref([]);
    const frameIndex = ref(0);
    const colFilters = ref({});
    const inspectCell = ref(null);
    const opts = computed(() => props.options ?? {});
    const hideValue = computed(() => !!opts.value.hideValue);
    const maxRowHeight = computed(() => {
      const n = Number(opts.value.maxRowHeight);
      return Number.isFinite(n) && n > 0 ? n : null;
    });
    const tooltipField = computed(
      () => String(opts.value.tooltip?.field ?? opts.value["tooltip.field"] ?? "").trim()
    );
    const tooltipPlacement = computed(() => {
      const p = String(
        opts.value.tooltip?.placement ?? opts.value["tooltip.placement"] ?? "top"
      ).trim();
      if (p === "auto" || p === "") return "top";
      return p;
    });
    const showTypeIcons = computed(() => !!opts.value.showTypeIcons);
    function applySortByOption() {
      const sb = opts.value.sortBy;
      if (!Array.isArray(sb) || !sb.length) {
        sortSpecs.value = [];
        return;
      }
      const specs = [];
      for (const item of sb) {
        const key = item?.displayName ?? item?.name ?? item?.field ?? null;
        if (!key) continue;
        specs.push({
          key: String(key),
          dir: item?.desc || item?.direction === "desc" ? "desc" : "asc"
        });
      }
      sortSpecs.value = specs;
      const first = specs[0];
      if (first) {
        sortKey.value = first.key;
        sortDir.value = first.dir === "desc" ? "desc" : "asc";
      }
    }
    watch(
      () => opts.value.sortBy,
      () => applySortByOption(),
      { immediate: true, deep: true }
    );
    const frames = computed(() => props.data?.series ?? []);
    const frame = computed(() => {
      const list = frames.value;
      if (!list.length) return void 0;
      const i = Math.min(Math.max(0, frameIndex.value), list.length - 1);
      return list[i];
    });
    const fields = computed(() => frame.value?.fields ?? []);
    const nestedField = computed(() => findNestedFramesField(fields.value));
    const displayFields = computed(() => displayFieldsExcludingNested(fields.value));
    const expandedRows = ref(/* @__PURE__ */ new Set());
    watch(
      frame,
      (fr) => {
        if (fr?.meta?.custom?.expandAllRows && nestedField.value) {
          const n = fr?.length ?? 0;
          const all = /* @__PURE__ */ new Set();
          for (let i = 0; i < n; i++) {
            if (rowHasNestedContent(nestedField.value, i)) all.add(i);
          }
          expandedRows.value = all;
        } else {
          expandedRows.value = /* @__PURE__ */ new Set();
        }
      },
      { immediate: true }
    );
    function setExpanded(ri, open) {
      if (!rowHasNestedContent(nestedField.value, ri)) return;
      const next = new Set(expandedRows.value);
      if (open) next.add(ri);
      else next.delete(ri);
      expandedRows.value = next;
    }
    function nestedFramesAt(ri) {
      return getNestedFramesForRow(nestedField.value, ri);
    }
    function formatNestedCell(f, row) {
      const v = f.values?.[row];
      if (v == null || v === "") return noValue.value;
      if (f.type === "number") {
        try {
          return formatValue(Number(v), cfgFor(f));
        } catch {
          return String(v);
        }
      }
      return String(v);
    }
    function nestedRowIndices(nf) {
      const len = Number(nf.length ?? nf.fields?.[0]?.values?.length ?? 0);
      return Array.from({ length: Math.max(0, len) }, (_, i) => i);
    }
    function renderNestedSubtables(ri) {
      const nfs = nestedFramesAt(ri);
      const depth = (props.nestDepth ?? 0) + 1;
      return h(
        "div",
        {
          "class": "nested-expand-row",
          "data-testid": "table-nested-row",
          "data-row-index": String(ri)
        },
        [
          h(
            "div",
            {
              "class": "nested-expand-cell",
              "data-testid": "table-nested-subtables"
            },
            nfs.map((nf, fi) => {
              const hasDeeper = !!findNestedFramesField(nf.fields ?? []);
              if (hasDeeper) {
                return h(
                  "div",
                  {
                    "class": "nested-frame nested-frame--recursive",
                    "data-testid": "table-nested-frame",
                    "data-frame-index": String(fi),
                    "data-nested-recursive": "true",
                    "key": String(fi)
                  },
                  [
                    h(TableRendererRouter, {
                      data: {
                        state: props.data?.state,
                        series: [nf],
                        timeRange: props.data?.timeRange,
                        annotations: props.data?.annotations
                      },
                      options: props.options,
                      fieldConfig: props.fieldConfig,
                      replaceVariables: props.replaceVariables,
                      width: props.width,
                      height: Math.min(240, Number(props.height) || 200),
                      nestDepth: depth
                    })
                  ]
                );
              }
              const cols = displayFieldsExcludingNested(nf.fields ?? []);
              const rows = Number(nf.length ?? cols[0]?.values?.length ?? 0);
              const noHeader = !!nf.meta?.custom?.noHeader;
              return h(
                "div",
                {
                  "class": "nested-frame",
                  "data-testid": "table-nested-frame",
                  "data-frame-index": String(fi),
                  "key": String(fi)
                },
                [
                  h(
                    "table",
                    {
                      "class": "nested-subtable",
                      "data-testid": "table-nested-subtable"
                    },
                    [
                      !noHeader ? h(
                        "thead",
                        {},
                        h(
                          "tr",
                          {},
                          cols.map((cf) => h("th", { key: cf.name }, getFieldDisplayName(cf, nf)))
                        )
                      ) : null,
                      h(
                        "tbody",
                        {},
                        Array.from(
                          { length: rows },
                          (_, r) => h(
                            "tr",
                            { "key": r, "data-testid": "table-nested-data-row" },
                            cols.map((cf) => h("td", { key: cf.name }, formatNestedCell(cf, r)))
                          )
                        )
                      )
                    ]
                  )
                ]
              );
            })
          )
        ]
      );
    }
    const tableExpandable = computed(() => {
      if (!nestedField.value) return null;
      return {
        // Controlled keys: data row index as string (matches record.key)
        expandedRowKeys: [...expandedRows.value],
        rowExpandable: (record) => {
          if (record?.__gtableSpacer) return false;
          const ri = Number(record.__rowIndex ?? record.key);
          return rowHasNestedContent(nestedField.value, ri);
        },
        onExpand: (expanded, record) => {
          const ri = Number(record.__rowIndex ?? record.key);
          setExpanded(ri, !!expanded);
        },
        expandIcon: ({
          expanded,
          onExpand,
          record
        }) => {
          if (record?.__gtableSpacer) return null;
          const ri = Number(record.__rowIndex ?? record.key);
          if (!rowHasNestedContent(nestedField.value, ri)) {
            return h("span", {
              class: "expander-placeholder",
              style: "display:inline-block;width:18px"
            });
          }
          return h(
            "button",
            {
              "type": "button",
              "class": "expander-btn",
              "data-testid": "table-expander-btn",
              "aria-expanded": expanded ? "true" : "false",
              "aria-label": expanded ? "折叠" : "展开",
              "onClick": (e) => {
                e.stopPropagation();
                onExpand(record, e);
              }
            },
            expanded ? "▼" : "▶"
          );
        },
        expandedRowRender: (record) => {
          if (record?.__gtableSpacer) return null;
          const ri = Number(record.__rowIndex ?? record.key);
          return renderNestedSubtables(ri);
        }
      };
    });
    const noValue = computed(() => {
      const nv = props.fieldConfig?.defaults?.noValue;
      return nv != null && String(nv) !== "" ? String(nv) : "-";
    });
    watch(frames, (f) => {
      if (frameIndex.value >= f.length) frameIndex.value = 0;
    });
    function fieldDisplay2(f) {
      return getFieldDisplayName(f, frame.value, frames.value);
    }
    function cellType(f) {
      const panel2 = opts.value.cellOptions;
      const mergedCustom = {
        ...props.fieldConfig?.defaults?.custom ?? {},
        ...f.config?.custom ?? {}
      };
      const fieldForCell = {
        ...f,
        config: { ...f.config ?? {}, custom: mergedCustom }
      };
      const co = getCellOptions(fieldForCell, panel2);
      if ((!co.type || co.type === "auto") && opts.value.displayMode) {
        return cellTypeFromOptions(
          migrateTableDisplayModeToCellOptions(String(opts.value.displayMode))
        );
      }
      return cellTypeFromOptions(co);
    }
    function isFilterable(f) {
      if (opts.value.filterable === true) return true;
      if (f.config?.filterable === true) return true;
      return fieldCustom(f).filterable === true;
    }
    function cfgFor(f) {
      return { ...props.fieldConfig?.defaults ?? {}, ...f.config ?? {} };
    }
    function fieldCustom(f) {
      return {
        ...props.fieldConfig?.defaults?.custom ?? {},
        ...f.config?.custom ?? {}
      };
    }
    function alignFor(f) {
      const custom = fieldCustom(f);
      return cellAlign({
        ...f,
        config: { ...f.config ?? {}, custom }
      });
    }
    function formatCell(f, row) {
      const v = f.values?.[row];
      if (v == null || v === "") return noValue.value;
      try {
        return displayCellValue(f, v, {
          noValue: noValue.value,
          cellType: cellType(f),
          fieldDefaults: cfgFor(f),
          hideValue: hideValue.value,
          timeZone: props.data?.request?.timezone
        });
      } catch {
        if (hideValue.value) return "•";
        if (f.type === "number") return formatValue(Number(v), cfgFor(f));
        return String(v);
      }
    }
    const rowIndices = computed(() => {
      const f = frame.value;
      if (!f) return [];
      return computeTableRowIndices({
        length: f.length,
        fields: fields.value,
        filterText: "",
        colFilters: colFilters.value,
        sortKey: sortKey.value,
        sortDir: sortDir.value,
        sortBy: sortSpecs.value.length ? sortSpecs.value : void 0,
        fieldDisplay: fieldDisplay2
      });
    });
    const styleFieldName = computed(() => String(opts.value.styleField ?? "").trim());
    const cellCache = shallowRef(/* @__PURE__ */ new Map());
    function clearCellCache() {
      cellCache.value = /* @__PURE__ */ new Map();
    }
    watch(
      [
        frame,
        sortKey,
        sortDir,
        sortSpecs,
        colFilters,
        hideValue,
        noValue,
        () => opts.value.cellOptions
      ],
      () => clearCellCache(),
      { deep: true }
    );
    function formatCellCached(f, row) {
      let byRow = cellCache.value.get(f.name);
      if (!byRow) {
        byRow = /* @__PURE__ */ new Map();
        cellCache.value.set(f.name, byRow);
      }
      const hit = byRow.get(row);
      if (hit !== void 0) return hit;
      const text = formatCell(f, row);
      byRow.set(row, text);
      return text;
    }
    function materializeRow(viewIndex) {
      const ri = rowIndices.value[viewIndex] ?? viewIndex;
      const record = {
        key: ri,
        __rowIndex: ri,
        __virtIndex: viewIndex
      };
      for (const f of displayFields.value) {
        record[f.name] = formatCellCached(f, ri);
        record[`__raw_${f.name}`] = f.values?.[ri];
      }
      if (styleFieldName.value) {
        const sf = displayFields.value.find(
          (f) => f.name === styleFieldName.value || fieldDisplay2(f) === styleFieldName.value
        ) || fields.value.find(
          (f) => f.name === styleFieldName.value || fieldDisplay2(f) === styleFieldName.value
        );
        if (sf) {
          const raw = sf.values?.[ri];
          const color = getFieldColor(Number(raw), cfgFor(sf));
          if (color) record.__rowBg = `${color}33`;
        }
      }
      return record;
    }
    const freezeCols = computed(() => {
      const raw = opts.value.frozenColumns?.left ?? opts.value.freezeColumns ?? opts.value.frozenColumns ?? 0;
      return Math.max(0, Number(raw) || 0);
    });
    function isTooltipField(f) {
      const tf = tooltipField.value;
      if (!tf) return false;
      return f.name === tf || fieldDisplay2(f) === tf;
    }
    function renderColumnTitle(f) {
      const label = fieldDisplay2(f);
      if (!showTypeIcons.value) return label;
      return h("span", { class: "gv-table-col-title" }, [
        h(
          "span",
          { "class": "type-icon", "title": f.type, "data-testid": "table-type-icon" },
          typeIcon(f)
        ),
        label
      ]);
    }
    function renderCell(f, text, record) {
      const raw = record[`__raw_${f.name}`];
      const mode2 = cellType(f);
      const panelCell = opts.value.cellOptions;
      const styled = computeCellStyle(f, raw, {
        cellType: mode2,
        hideValue: hideValue.value,
        maxRowHeight: maxRowHeight.value,
        // virtual path keeps single-line ellipsis unless wrapText is on
        wrapText: wrapTextEnabled.value,
        fieldDefaults: cfgFor(f)
      });
      const baseStyle = {
        overflow: "hidden",
        textOverflow: "ellipsis",
        whiteSpace: wrapTextEnabled.value ? "normal" : "nowrap",
        textAlign: alignFor(f),
        ...styled
      };
      if (maxRowHeight.value && !baseStyle.maxHeight) {
        baseStyle.maxHeight = `${maxRowHeight.value}px`;
      }
      const attrs = {
        "class": ["gv-table-cell", mode2 !== "auto" ? `gv-table-cell--${mode2}` : null],
        "style": baseStyle,
        "title": text == null ? "" : String(text),
        "data-hide-value": hideValue.value ? "true" : "false",
        "data-cell-type": mode2,
        "data-align": alignFor(f)
      };
      let inner = text == null ? "" : String(text);
      if (isImage(mode2, raw)) {
        inner = h("img", {
          "class": "cell-img",
          "data-testid": "table-cell-image",
          "src": String(raw),
          "alt": imageAlt(f, panelCell) ?? "",
          "title": imageTitle(f, panelCell) ?? "",
          "style": { maxHeight: "24px", maxWidth: "100%" }
        });
      } else if (isSparkline(mode2, raw) && sparkPoints(raw)) {
        inner = h(
          "svg",
          {
            "class": "spark",
            "viewBox": "0 0 64 18",
            "aria-hidden": "true",
            "data-testid": "table-cell-sparkline",
            "style": { width: "64px", height: "18px", display: "block" }
          },
          [
            h("polyline", {
              "points": sparkPoints(raw),
              "fill": "none",
              "stroke": "currentColor",
              "stroke-width": "1.5"
            })
          ]
        );
      } else if (isGaugeCell(f, mode2)) {
        const gClass = gaugeModeClass(f, mode2, panelCell);
        const pct = gaugePct(f, raw, cfgFor(f));
        const color = getFieldColor(Number(raw), cfgFor(f)) || "var(--grafana-primary)";
        let gaugeBody;
        if (gClass === "lcd-gauge") {
          const cells = tableLcdCells(f, raw, cfgFor(f));
          gaugeBody = h(
            "div",
            { "class": "cell-gauge-lcd", "data-testid": "table-cell-gauge-lcd" },
            cells.map(
              (cell, ci) => h("div", {
                key: ci,
                class: ["cell-lcd-seg", cell.on ? "on" : null],
                style: cell.on ? {
                  width: `${cell.size}px`,
                  marginRight: `${cell.spacing}px`,
                  backgroundImage: `radial-gradient(${cell.color} 10%, ${cell.shade})`
                } : {
                  width: `${cell.size}px`,
                  marginRight: `${cell.spacing}px`,
                  backgroundColor: cell.color
                }
              })
            )
          );
        } else {
          gaugeBody = h("div", {
            class: "cell-gauge-fill",
            style: {
              width: `${pct * 100}%`,
              background: color,
              height: "100%"
            }
          });
        }
        inner = h(
          "div",
          {
            "class": ["cell-gauge", gClass],
            "data-testid": "table-cell-gauge",
            "data-gauge-pct": String(Math.round(pct * 100))
          },
          [gaugeBody, h("span", { class: "cell-gauge-text" }, text == null ? "" : String(text))]
        );
      } else if (isPillType(mode2)) {
        inner = h(
          "span",
          {
            "class": "cell-pill",
            "data-testid": "table-cell-pill",
            "style": {
              background: getFieldColor(Number(raw), cfgFor(f)) || "color-mix(in srgb, var(--grafana-primary) 25%, transparent)",
              borderRadius: "999px",
              padding: "0 8px",
              display: "inline-block"
            }
          },
          text == null ? "" : String(text)
        );
      } else if (isJsonViewType(mode2)) {
        inner = h(
          "pre",
          {
            "class": "cell-json",
            "data-testid": "table-cell-json",
            "style": {
              margin: 0,
              whiteSpace: "pre-wrap",
              fontFamily: "var(--grafana-font-family-monospace, monospace)",
              fontSize: "11px"
            }
          },
          text == null ? "" : String(text)
        );
      } else if (isMarkdown(mode2)) {
        inner = h("div", {
          "class": "cell-md",
          "data-testid": "table-cell-markdown",
          "innerHTML": renderMarkdown(raw)
        });
      } else if (isGeo(mode2)) {
        const geo = formatGeoCell(raw);
        inner = h(
          "span",
          {
            "class": "cell-geo",
            "data-testid": "table-cell-geo",
            "title": geo.label
          },
          [h("span", { "class": "cell-geo-pin", "aria-hidden": "true" }, "📍"), geo.label]
        );
      } else if (isDataLinksOnly(mode2) || isActions(mode2)) {
        const rowIndex = Number(record.__rowIndex ?? record.__ri ?? 0);
        const links = getFieldLinks(
          f,
          rowIndex,
          props.replaceVariables ?? ((s) => s),
          frame.value,
          frames.value,
          { timeRange: props.data?.timeRange }
        ).map((l) => ({ title: l.title, url: l.href }));
        const kids = links.length > 0 ? links.map(
          (lnk, li) => h(
            "a",
            {
              "key": li,
              "class": "cell-link cell-action",
              "data-testid": "table-cell-link",
              "href": lnk.url,
              "title": lnk.title,
              "target": "_blank",
              "rel": "noopener noreferrer",
              "onClick": (e) => e.stopPropagation()
            },
            lnk.title || "链接"
          )
        ) : [h("span", { class: "cell-actions-empty" }, "—")];
        inner = h(
          "span",
          {
            "class": "cell-actions",
            "data-testid": mode2 === "data-links" ? "table-cell-data-links" : "table-cell-actions"
          },
          kids
        );
      } else if (mode2 === "auto" || mode2 === "text" || mode2 === "auto-size") {
        if (raw != null && String(raw).length > 0 && f.config?.links?.length) {
          const rowIndex = Number(record.__rowIndex ?? record.__ri ?? 0);
          const links = getFieldLinks(
            f,
            rowIndex,
            props.replaceVariables ?? ((s) => s),
            frame.value,
            frames.value,
            { timeRange: props.data?.timeRange }
          ).map((l) => ({ title: l.title, url: l.href }));
          if (links.length > 0) {
            inner = h("span", { "class": "cell-text-wrap", "data-testid": "table-cell-text" }, [
              links.map(
                (lnk, li) => h(
                  "a",
                  {
                    "key": li,
                    "class": "cell-link",
                    "data-testid": "table-cell-link",
                    "href": lnk.url,
                    "title": lnk.title,
                    "target": "_blank",
                    "rel": "noopener noreferrer",
                    "onClick": (e) => e.stopPropagation()
                  },
                  li === 0 ? String(text ?? "") : lnk.title
                )
              )
            ]);
          }
        }
      }
      const content = h("span", attrs, [inner]);
      if (!isTooltipField(f)) return content;
      const tip = String(raw ?? text ?? "");
      return h(
        _sfc_main$y$1,
        {
          title: tip,
          placement: tooltipPlacement.value
        },
        { default: () => content }
      );
    }
    const columns = computed(() => {
      const dataCols = displayFields.value.map((f, fi) => {
        const custom = fieldCustom(f);
        const width2 = Number(custom.width) > 0 ? Number(custom.width) : Math.max(Number(custom.minWidth) || Number(opts.value.columnMinWidth) || 80, 80);
        const filterable = isFilterable(f);
        const uniqueVals = filterable ? Array.from(
          new Set(
            (f.values ?? []).slice(0, 200).map((v) => v == null ? "" : String(v)).filter(Boolean)
          )
        ).slice(0, 50) : [];
        const align = alignFor(f);
        return {
          title: () => renderColumnTitle(f),
          dataIndex: f.name,
          key: f.name,
          width: width2,
          align,
          ellipsis: !wrapTextEnabled.value,
          className: maxRowHeight.value ? "gv-table-max-row" : void 0,
          fixed: fi < freezeCols.value ? "left" : void 0,
          sorter: true,
          filters: filterable ? uniqueVals.map((v) => ({ text: v, value: v })) : void 0,
          // Filtering is applied via rowIndices (full set); do not filter the window.
          customRender: ({ text, record }) => renderCell(f, text, record)
        };
      });
      if (!nestedField.value) return dataCols;
      const expanderCol = {
        title: "",
        dataIndex: "__expander",
        key: "__expander",
        width: 28,
        fixed: "left",
        ellipsis: false,
        customRender: ({ record }) => {
          if (record?.__gtableSpacer) return null;
          const ri = Number(record.__rowIndex ?? record.key);
          if (!rowHasNestedContent(nestedField.value, ri)) {
            return h("span", {
              class: "expander-placeholder",
              style: "display:inline-block;width:18px"
            });
          }
          const open = expandedRows.value.has(ri);
          return h(
            "button",
            {
              "type": "button",
              "class": "expander-btn",
              "data-testid": "table-expander-btn",
              "aria-expanded": open ? "true" : "false",
              "aria-label": open ? "折叠" : "展开",
              "onClick": (e) => {
                e.stopPropagation();
                setExpanded(ri, !open);
              }
            },
            open ? "▼" : "▶"
          );
        }
      };
      return [expanderCol, ...dataCols];
    });
    const totalColWidth = computed(
      () => Math.round(columns.value.reduce((acc, c) => acc + (Number(c.width) || 80), 0))
    );
    const pagination = computed(() => {
      if (!opts.value.enablePagination) return false;
      const ps = Number(opts.value.pageSize) > 0 ? Number(opts.value.pageSize) : 50;
      return { pageSize: ps, size: "small", showSizeChanger: false };
    });
    const showFooter = computed(
      () => shouldShowFooter(opts.value.footer, displayFields.value)
    );
    const footerMap = computed(() => {
      if (!showFooter.value || !frame.value) return null;
      const footerOpts = {
        reducers: opts.value.footer?.reducers ?? ["sum"],
        countRows: opts.value.footer?.countRows,
        fields: opts.value.footer?.fields
      };
      const items = getFooterItems(displayFields.value, footerOpts, (f) => cfgFor(f));
      const map = {};
      displayFields.value.forEach((f, i) => {
        const it = items[i];
        if (it == null) return;
        if (typeof it === "string") {
          map[fieldDisplay2(f)] = it;
          return;
        }
        if (Array.isArray(it)) {
          map[fieldDisplay2(f)] = it.map((kv) => {
            const k = Object.keys(kv)[0];
            return k ? `${k}: ${kv[k]}` : "";
          }).filter(Boolean).join(", ");
        }
      });
      return Object.keys(map).length ? map : null;
    });
    const footerCells = computed(() => {
      if (!footerMap.value) return [];
      return displayFields.value.filter((f) => footerMap.value[fieldDisplay2(f)] != null).map((f) => {
        const custom = fieldCustom(f);
        const width2 = Number(custom.width) > 0 ? Number(custom.width) : Math.max(Number(custom.minWidth) || Number(opts.value.columnMinWidth) || 80, 80);
        return {
          label: fieldDisplay2(f),
          value: footerMap.value[fieldDisplay2(f)],
          width: width2
        };
      });
    });
    function footerLeftPx(fi) {
      let acc = 0;
      for (let i = 0; i < fi; i++) {
        const cell = footerCells.value[i];
        if (cell) acc += cell.width;
      }
      return acc;
    }
    const cellHeightKey = computed(() => String(opts.value.cellHeight ?? "sm"));
    const rowHeightPx = computed(() => getDefaultRowHeight(cellHeightKey.value));
    const wrapTextEnabled = computed(() => {
      if (opts.value.wrapText) return true;
      const defaults2 = props.fieldConfig?.defaults?.custom || {};
      if (defaults2.wrapText) return true;
      return (props.data?.series || []).some(
        (fr) => (fr.fields || []).some((f) => f?.config?.custom?.wrapText)
      );
    });
    const wrapFieldCount = computed(() => {
      const count = (displayFields.value || []).filter((f) => f?.config?.custom?.wrapText).length;
      return opts.value.wrapText || props.fieldConfig?.defaults?.custom?.wrapText ? count || 1 : count;
    });
    const wrapHeaderTextEnabled = computed(() => {
      if (opts.value.wrapHeaderText) return true;
      const defaults2 = props.fieldConfig?.defaults?.custom || {};
      if (defaults2.wrapHeaderText) return true;
      return (props.data?.series || []).some(
        (fr) => (fr.fields || []).some((f) => f?.config?.custom?.wrapHeaderText)
      );
    });
    const useVirtual = computed(() => pagination.value === false && !nestedField.value);
    function rowClassName(record) {
      const base = `table-row-${cellHeightKey.value}`;
      return record?.__rowBg ? `${base} table-row-styled` : base;
    }
    function customRow(record) {
      return {
        onClick: () => onRowClick(record),
        style: record?.__rowBg ? { background: String(record.__rowBg) } : void 0
      };
    }
    function onChange(_pag, filters, sorter) {
      if (filters && typeof filters === "object") {
        const next = { ...colFilters.value };
        for (const [k, vals] of Object.entries(filters)) {
          if (Array.isArray(vals) && vals.length) next[k] = String(vals[0]);
          else if (vals == null) delete next[k];
        }
        colFilters.value = next;
      }
      if (!sorter || Array.isArray(sorter)) return;
      if (sorter.field || sorter.columnKey) {
        sortKey.value = String(sorter.field || sorter.columnKey);
        sortDir.value = sorter.order === "descend" ? "desc" : "asc";
        sortSpecs.value = sortKey.value ? [{ key: sortKey.value, dir: sortDir.value }] : [];
      }
    }
    function onRowClick(record) {
      if (!opts.value.inspect) return;
      const entry = Object.entries(record).find(([k]) => !k.startsWith("__") && k !== "key");
      const [field, value] = entry ?? ["", ""];
      inspectCell.value = { field: String(field), value: String(value ?? "") };
    }
    const scrollY = computed(() => {
      if (!props.height || props.height < 80) {
        return useVirtual.value ? 320 : void 0;
      }
      return Math.max(80, props.height - 48);
    });
    function scrubSorterAria(root) {
      if (!root) return;
      root.querySelectorAll(
        '.ant-table-column-sorter [role="presentation"][aria-label], .anticon[role="presentation"][aria-label], span[role="presentation"][aria-label]'
      ).forEach((el) => el.removeAttribute("aria-label"));
    }
    const tableRoot = ref(null);
    let _mo = null;
    onMounted(() => {
      scrubSorterAria(tableRoot.value);
      void nextTick(() => scrubSorterAria(tableRoot.value));
      if (tableRoot.value && typeof MutationObserver !== "undefined") {
        _mo = new MutationObserver(() => scrubSorterAria(tableRoot.value));
        _mo.observe(tableRoot.value, {
          subtree: true,
          childList: true,
          attributes: true,
          attributeFilter: ["aria-label", "role"]
        });
      }
    });
    onUpdated(() => scrubSorterAria(tableRoot.value));
    onBeforeUnmount(() => {
      _mo?.disconnect();
      _mo = null;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "tableRoot",
        ref: tableRoot,
        class: normalizeClass(["table-renderer", {
          "gv-table-wrap-header": wrapHeaderTextEnabled.value,
          "gv-table-wrap-text": wrapTextEnabled.value
        }]),
        "data-testid": "panel-table",
        "data-frames": String(frames.value.length ?? 0),
        "data-show-header": String(opts.value.showHeader !== false),
        "data-footer": String(!!showFooter.value),
        "data-pagination": String(!!opts.value.enablePagination),
        "data-freeze": String(freezeCols.value),
        "data-frozen": String(freezeCols.value),
        "data-inspect": String(!!opts.value.inspect),
        "data-style-field": String(opts.value.styleField ?? ""),
        "data-filterable": String(!!opts.value.filterable),
        "data-custom-filterable": String(!!__props.fieldConfig?.defaults?.custom?.filterable),
        "data-column-min-width": String(opts.value.columnMinWidth ?? ""),
        "data-sort-by": String(
          Array.isArray(opts.value.sortBy) ? opts.value.sortBy.map((s) => s?.displayName ?? s?.name ?? s).join(",") : opts.value.sortBy ?? ""
        ),
        "data-custom-align": String(__props.fieldConfig?.defaults?.custom?.align ?? ""),
        "data-custom-min-width": String(__props.fieldConfig?.defaults?.custom?.minWidth ?? ""),
        "data-has-nested": String(!!nestedField.value),
        "data-expanded-count": String(expandedRows.value.size),
        "data-renderer": nestedField.value ? "antd-nested" : "antd",
        "data-hide-value": String(!!opts.value.hideValue),
        "data-show-type-icons": String(!!opts.value.showTypeIcons),
        "data-max-row-height": String(opts.value.maxRowHeight ?? ""),
        "data-tooltip-field": String(tooltipField.value),
        "data-wrap-text": String(wrapTextEnabled.value),
        "data-wrap-fields": String(wrapFieldCount.value),
        "data-wrap-header-text": String(wrapHeaderTextEnabled.value),
        "data-custom-width": String(__props.fieldConfig?.defaults?.custom?.width ?? ""),
        "data-cell-options": String(
          __props.fieldConfig?.defaults?.custom?.cellOptions ? JSON.stringify(__props.fieldConfig.defaults.custom.cellOptions) : opts.value.cellOptions ? JSON.stringify(opts.value.cellOptions) : ""
        ),
        "data-tooltip-placement": String(tooltipPlacement.value),
        "data-cell-height": String(opts.value.cellHeight ?? "sm"),
        "data-virtualized": String(useVirtual.value),
        "data-row-count": String(rowIndices.value.length),
        "data-row-height": String(rowHeightPx.value),
        "data-variable-heights": false,
        "data-overscan": String(unref(TABLE_VIRT).OVERSCAN),
        style: normalizeStyle({
          width: __props.width ? `${__props.width}px` : "100%",
          height: __props.height ? `${__props.height}px` : "100%",
          ...maxRowHeight.value ? { ["--gv-table-max-row-height"]: `${maxRowHeight.value}px` } : {}
        })
      }, [
        frames.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_2$2c, [
          createElementVNode("label", null, [
            _cache[1] || (_cache[1] = createTextVNode(
              " 数据帧 ",
              -1
              /* CACHED */
            )),
            withDirectives(createElementVNode(
              "select",
              {
                "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => frameIndex.value = $event)
              },
              [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(frames.value, (fr, i) => {
                    return openBlock(), createElementBlock("option", {
                      key: i,
                      value: i
                    }, toDisplayString(fr.name || fr.refId || `Frame ${i + 1}`), 9, _hoisted_3$1Y);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ],
              512
              /* NEED_PATCH */
            ), [
              [
                vModelSelect,
                frameIndex.value,
                void 0,
                { number: true }
              ]
            ])
          ])
        ])) : createCommentVNode("v-if", true),
        displayFields.value.some((f) => isFilterable(f)) ? (openBlock(), createElementBlock("div", _hoisted_4$1G, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(displayFields.value.filter((x) => isFilterable(x)), (f) => {
              return openBlock(), createElementBlock("input", {
                key: f.name,
                class: "table-filter",
                placeholder: fieldDisplay2(f),
                "data-testid": "table-col-filter",
                value: colFilters.value[f.name] || "",
                onInput: ($event) => colFilters.value = {
                  ...colFilters.value,
                  [f.name]: $event.target.value
                }
              }, null, 40, _hoisted_5$1u);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : createCommentVNode("v-if", true),
        displayFields.value.length ? (openBlock(), createBlock(unref(GTable), {
          key: 2,
          "test-id": "table-antd",
          size: "small",
          bordered: "",
          columns: columns.value,
          pagination: pagination.value,
          "show-header": opts.value.showHeader !== false,
          "row-class-name": rowClassName,
          "custom-row": customRow,
          scroll: { x: freezeCols.value ? totalColWidth.value : "max-content", y: scrollY.value },
          virtual: useVirtual.value,
          "row-height": rowHeightPx.value,
          "row-count": rowIndices.value.length,
          "get-row": materializeRow,
          "rows-dep": [rowIndices.value, expandedRows.value],
          expandable: tableExpandable.value,
          onChange
        }, createSlots({
          _: 2
          /* DYNAMIC */
        }, [
          footerMap.value ? {
            name: "footer",
            fn: withCtx(() => [
              createElementVNode("div", _hoisted_6$1h, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(footerCells.value, (cell, fi) => {
                    return openBlock(), createElementBlock("span", {
                      key: String(fi),
                      class: normalizeClass(["table-footer-cell", { frozen: fi < freezeCols.value }]),
                      "data-testid": "table-footer-cell",
                      "data-col-width": String(cell.width),
                      style: normalizeStyle(fi < freezeCols.value ? { left: `${footerLeftPx(fi)}px` } : void 0)
                    }, toDisplayString(cell.label) + ": " + toDisplayString(cell.value), 15, _hoisted_7$17);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["columns", "pagination", "show-header", "scroll", "virtual", "row-height", "row-count", "rows-dep", "expandable"])) : createCommentVNode("v-if", true),
        createCommentVNode(" Native nested ExpandedRow surface (antd path dual-run) "),
        nestedField.value && expandedRows.value.size ? (openBlock(), createElementBlock("div", _hoisted_8$$, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList([...expandedRows.value].sort((a, b) => a - b), (ri) => {
              return openBlock(), createElementBlock("div", {
                key: `exp-${ri}`,
                class: "nested-expand-row",
                "data-testid": "table-nested-row",
                "data-row-index": String(ri)
              }, [
                createElementVNode("div", _hoisted_10$O, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(nestedFramesAt(ri), (nf, fi) => {
                      return openBlock(), createElementBlock("div", {
                        key: fi,
                        class: normalizeClass(["nested-frame", {
                          "nested-frame--recursive": !!unref(findNestedFramesField)(nf.fields || [])
                        }]),
                        "data-testid": "table-nested-frame",
                        "data-frame-index": String(fi),
                        "data-nested-recursive": String(!!unref(findNestedFramesField)(nf.fields || []))
                      }, [
                        unref(findNestedFramesField)(nf.fields || []) ? (openBlock(), createBlock(unref(TableRendererRouter), {
                          key: 0,
                          data: {
                            state: __props.data?.state ?? "Done",
                            series: [nf],
                            timeRange: __props.data?.timeRange,
                            annotations: __props.data?.annotations
                          },
                          options: __props.options,
                          "field-config": __props.fieldConfig,
                          "replace-variables": __props.replaceVariables,
                          width: __props.width,
                          height: Math.min(240, Number(__props.height) || 200),
                          "nest-depth": (__props.nestDepth ?? 0) + 1
                        }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height", "nest-depth"])) : (openBlock(), createElementBlock("table", _hoisted_12$D, [
                          !nf.meta?.custom?.noHeader ? (openBlock(), createElementBlock("thead", _hoisted_13$C, [
                            createElementVNode("tr", null, [
                              (openBlock(true), createElementBlock(
                                Fragment,
                                null,
                                renderList(unref(displayFieldsExcludingNested)(nf.fields || []), (cf) => {
                                  return openBlock(), createElementBlock(
                                    "th",
                                    {
                                      key: cf.name
                                    },
                                    toDisplayString(unref(getFieldDisplayName)(cf, nf)),
                                    1
                                    /* TEXT */
                                  );
                                }),
                                128
                                /* KEYED_FRAGMENT */
                              ))
                            ])
                          ])) : createCommentVNode("v-if", true),
                          createElementVNode("tbody", null, [
                            (openBlock(true), createElementBlock(
                              Fragment,
                              null,
                              renderList(nestedRowIndices(nf), (ri2) => {
                                return openBlock(), createElementBlock("tr", {
                                  key: ri2,
                                  "data-testid": "table-nested-data-row"
                                }, [
                                  (openBlock(true), createElementBlock(
                                    Fragment,
                                    null,
                                    renderList(unref(displayFieldsExcludingNested)(nf.fields || []), (cf) => {
                                      return openBlock(), createElementBlock(
                                        "td",
                                        {
                                          key: cf.name
                                        },
                                        toDisplayString(formatNestedCell(cf, ri2)),
                                        1
                                        /* TEXT */
                                      );
                                    }),
                                    128
                                    /* KEYED_FRAGMENT */
                                  ))
                                ]);
                              }),
                              128
                              /* KEYED_FRAGMENT */
                            ))
                          ])
                        ]))
                      ], 10, _hoisted_11$J);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])
              ], 8, _hoisted_9$X);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : !displayFields.value.length ? (openBlock(), createElementBlock("div", _hoisted_14$x, " 暂无数据 ")) : createCommentVNode("v-if", true),
        inspectCell.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_15$u,
          toDisplayString(inspectCell.value.field) + ": " + toDisplayString(inspectCell.value.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ], 14, _hoisted_1$2J);
    };
  }
});
const AntdTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$3x, [["__scopeId", "data-v-5363c891"]]);
const _sfc_main$3w = /* @__PURE__ */ defineComponent({
  __name: "TableRenderer",
  props: {
    data: {},
    fieldConfig: {},
    options: {},
    replaceVariables: { type: Function },
    width: {},
    height: {},
    nestDepth: {}
  },
  setup(__props) {
    const props = __props;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(
        AntdTable,
        normalizeProps(guardReactiveProps({ ...props, ..._ctx.$attrs })),
        null,
        16
        /* FULL_PROPS */
      );
    };
  }
});
const TableRenderer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: _sfc_main$3w
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$3v = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(_sfc_main$3w, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  { id: "table", name: "表格", state: "stable", skipDataQuery: false },
  _sfc_main$3v
).useFieldConfig({
  useCustomConfig: (builder) => {
    const cat = ["单元格选项"];
    builder.addCustom({
      id: "custom.align",
      path: "custom.align",
      name: "对齐",
      category: cat,
      editor: "radio",
      isCustom: true,
      override: true,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "左", value: "left" },
          { label: "中", value: "center" },
          { label: "右", value: "right" }
        ]
      },
      defaultValue: "auto"
    }).addCustom({
      id: "custom.wrapText",
      path: "custom.wrapText",
      name: "自动换行",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.wrapHeaderText",
      path: "custom.wrapHeaderText",
      name: "表头换行",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.filterable",
      path: "custom.filterable",
      name: "可过滤",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.minWidth",
      path: "custom.minWidth",
      name: "最小宽度",
      category: cat,
      editor: "number",
      isCustom: true,
      override: true,
      defaultValue: 150
    }).addCustom({
      id: "custom.width",
      path: "custom.width",
      name: "列宽",
      category: cat,
      editor: "number",
      isCustom: true,
      override: true
    }).addCustom({
      id: "custom.hideFrom.viz",
      path: "custom.hideFrom.viz",
      name: "从可视化隐藏",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.cellOptions",
      path: "custom.cellOptions",
      name: "单元格类型",
      category: cat,
      editor: "select",
      isCustom: true,
      override: true,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "彩色文本", value: "color-text" },
          { label: "彩色背景", value: "color-background" },
          { label: "仪表", value: "gauge" },
          { label: "JSON", value: "json-view" }
        ]
      },
      defaultValue: "auto"
    }).addCustom({
      id: "custom.footer.reducers",
      path: "custom.footer.reducers",
      name: "页脚计算",
      category: ["表格页脚"],
      editor: "multi-select",
      isCustom: true,
      override: true,
      settings: {
        options: [
          { label: "求和", value: "sum" },
          { label: "平均", value: "mean" },
          { label: "计数", value: "count" },
          { label: "最小", value: "min" },
          { label: "最大", value: "max" },
          { label: "最后", value: "last" },
          { label: "最后非空", value: "lastNotNull" }
        ]
      },
      defaultValue: []
    });
  }
}).setPanelOptions((builder) => {
  builder.addBoolean(
    {
      id: "showHeader",
      path: "showHeader",
      name: "显示表头",
      category: ["表格"],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "filterable",
      path: "filterable",
      name: "列过滤",
      category: ["表格"],
      editor: "boolean"
    },
    false
  ).addNumber(
    {
      id: "columnMinWidth",
      path: "columnMinWidth",
      name: "列最小宽度",
      category: ["表格"],
      editor: "number"
    },
    150
  ).addRadio(
    {
      id: "cellHeight",
      path: "cellHeight",
      name: "行高",
      category: ["表格"],
      editor: "radio",
      settings: {
        options: [
          { label: "小", value: "sm" },
          { label: "中", value: "md" },
          { label: "大", value: "lg" }
        ]
      }
    },
    "sm"
  ).addBoolean(
    {
      id: "footer.show",
      path: "footer.show",
      name: "显示页脚",
      category: ["表格"],
      editor: "boolean"
    },
    false
  ).addSelect(
    {
      id: "footer.reducers",
      path: "footer.reducers",
      name: "页脚计算",
      category: ["表格"],
      editor: "multi-select",
      settings: {
        options: [
          { label: "求和", value: "sum" },
          { label: "平均", value: "mean" },
          { label: "计数", value: "count" },
          { label: "最小", value: "min" },
          { label: "最大", value: "max" }
        ]
      },
      showIf: (c) => !!c.footer?.show
    },
    ["sum"]
  ).addBoolean(
    {
      id: "enablePagination",
      path: "enablePagination",
      name: "启用分页",
      category: ["表格"],
      editor: "boolean"
    },
    false
  ).addNumber(
    {
      id: "pageSize",
      path: "pageSize",
      name: "每页行数",
      category: ["表格"],
      editor: "number",
      settings: { min: 5, max: 500 },
      showIf: (c) => !!c.enablePagination
    },
    50
  ).addNumber(
    {
      id: "frozenColumns.left",
      path: "frozenColumns.left",
      name: "冻结左侧列",
      category: ["表格"],
      editor: "number",
      settings: { min: 0, max: 20 }
    },
    0
  ).addSelect(
    {
      id: "cellOptions",
      path: "cellOptions",
      name: "单元格类型",
      description: "默认单元格显示类型",
      category: ["表格"],
      editor: "select",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "彩色文本", value: "color-text" },
          { label: "彩色背景", value: "color-background" },
          { label: "彩色背景（纯色）", value: "color-background-solid" },
          { label: "仪表", value: "gauge" },
          { label: "渐变仪表", value: "gradient-gauge" },
          { label: "LCD 仪表", value: "lcd-gauge" },
          { label: "基础条", value: "basic" },
          { label: "迷你图", value: "sparkline" },
          { label: "图片", value: "image" },
          { label: "JSON 视图", value: "json-view" },
          { label: "胶囊", value: "pill" }
        ]
      }
    },
    "auto"
  ).addBoolean(
    {
      id: "hideValue",
      path: "hideValue",
      name: "隐藏值",
      category: ["表格"],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "inspect",
      path: "inspect",
      name: "检查单元格值",
      category: ["表格"],
      editor: "boolean",
      // Grafana: only for cell types that render raw values
      showIf: (c) => {
        const t2 = c.cellOptions?.type ?? c.cellOptions ?? "auto";
        return ["auto", "json-view", "color-text", "color-background"].includes(t2);
      }
    },
    false
  ).addText(
    {
      id: "styleField",
      path: "styleField",
      name: "样式字段",
      category: ["表格"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "tooltip.field",
      path: "tooltip.field",
      name: "提示字段",
      category: ["提示"],
      editor: "text"
    },
    ""
  ).addSelect(
    {
      id: "tooltip.placement",
      path: "tooltip.placement",
      name: "提示位置",
      category: ["提示"],
      editor: "select",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "上方", value: "top" },
          { label: "右侧", value: "right" },
          { label: "下方", value: "bottom" },
          { label: "左侧", value: "left" }
        ]
      },
      // Grafana: only when tooltip field is set
      showIf: (c) => c.tooltip?.field !== void 0
    },
    "auto"
  ).addBoolean(
    {
      id: "showTypeIcons",
      path: "showTypeIcons",
      name: "显示类型图标",
      category: ["表格"],
      editor: "boolean"
    },
    false
  ).addNumber(
    {
      id: "maxRowHeight",
      path: "maxRowHeight",
      name: "最大行高",
      category: ["表格"],
      editor: "number",
      settings: { min: 0 }
    },
    void 0
  ).addCustom(
    {
      id: "sortBy",
      path: "sortBy",
      name: "默认排序",
      description: "表格初始排序字段（与 Grafana JSON sortBy 兼容）",
      category: ["表格"],
      editor: "custom"
    },
    []
  );
}).setRuntimeConsumedPaths([
  "showHeader",
  "filterable",
  "columnMinWidth",
  "cellHeight",
  "footer.show",
  "footer.reducers",
  "enablePagination",
  "pageSize",
  "frozenColumns.left",
  "cellOptions",
  "hideValue",
  "inspect",
  "styleField",
  "tooltip.field",
  "tooltip.placement",
  "showTypeIcons",
  "maxRowHeight",
  "sortBy",
  "custom.align",
  "custom.wrapText",
  "custom.wrapHeaderText",
  "custom.filterable",
  "custom.minWidth",
  "custom.width",
  "custom.hideFrom.viz",
  "custom.cellOptions",
  "custom.footer.reducers"
]).register();
const _hoisted_1$2I = {
  class: "panel-data-error",
  "data-testid": "panel-data-error"
};
const _hoisted_2$2b = { class: "panel-data-error__msg" };
const _sfc_main$3u = /* @__PURE__ */ defineComponent({
  __name: "PanelDataErrorView",
  props: {
    data: {},
    fieldConfig: {},
    needsStringField: { type: Boolean, default: false },
    needsTimeField: { type: Boolean, default: false },
    needsNumberField: { type: Boolean, default: false },
    message: {}
  },
  setup(__props) {
    const props = __props;
    const text = computed(() => {
      if (props.message) return props.message;
      const noValue = props.fieldConfig?.defaults?.noValue;
      if (typeof noValue === "string" && noValue) return noValue;
      const series = props.data?.series ?? [];
      const hasAnyValues = series.some((f) => (f.length ?? f.fields?.[0]?.values?.length ?? 0) > 0);
      if (!series.length || !hasAnyValues) return "无数据";
      const fields = series.flatMap((f) => f.fields ?? []);
      const hasString = fields.some((f) => f.type === "string");
      const hasTime = fields.some((f) => f.type === "time");
      const hasNumber = fields.some((f) => f.type === "number");
      if (props.needsStringField && !hasString) return "数据缺少一个字符串字段";
      if (props.needsTimeField && !hasTime) return "数据缺少一个时间字段";
      if (props.needsNumberField && !hasNumber) return "数据缺少一个数字字段";
      return "无法可视化数据";
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2I, [
        createElementVNode(
          "div",
          _hoisted_2$2b,
          toDisplayString(text.value),
          1
          /* TEXT */
        )
      ]);
    };
  }
});
const PanelDataErrorView = /* @__PURE__ */ _export_sfc$1(_sfc_main$3u, [["__scopeId", "data-v-6ab77da9"]]);
function computeVirtualWindow(total, scrollTop, viewportHeight, rowHeight, overscan = 8) {
  const rh = Math.max(1, rowHeight);
  const totalHeight = total * rh;
  if (total <= 0) {
    return { start: 0, end: 0, offsetY: 0, totalHeight, visibleCount: 0 };
  }
  const effectiveViewport = viewportHeight > 0 ? viewportHeight : Math.min(total, 40) * rh;
  const first = Math.max(0, Math.floor(scrollTop / rh) - overscan);
  const visible = Math.ceil(effectiveViewport / rh) + overscan * 2;
  const end = Math.min(total, first + visible);
  return {
    start: first,
    end,
    offsetY: first * rh,
    totalHeight,
    visibleCount: end - first
  };
}
function sliceVirtualRows(rows, win) {
  return rows.slice(win.start, win.end);
}
const SEV_COLORS = {
  critical: "var(--grafana-error)",
  fatal: "var(--grafana-error)",
  error: "var(--grafana-error)",
  warn: "var(--grafana-warning)",
  warning: "var(--grafana-warning)",
  info: "var(--grafana-primary)",
  debug: "var(--grafana-text-secondary)",
  trace: "var(--grafana-secondary-main, var(--grafana-primary))",
  unknown: "var(--grafana-text-secondary)"
};
function normalizeLevel(raw) {
  const s = String(raw ?? "").toLowerCase().trim();
  if (!s) return "unknown";
  if (s === "critical" || s === "fatal") return s === "fatal" ? "fatal" : "critical";
  if (s === "error" || s === "err") return "error";
  if (s === "warn" || s === "warning") return "warning";
  if (s === "info" || s === "information") return "info";
  if (s === "debug") return "debug";
  if (s === "trace") return "trace";
  return s;
}
function detectLevelFromMessage(msg) {
  const m = String(msg ?? "").toLowerCase();
  if (m.includes("critical") || m.includes("fatal")) return "critical";
  if (m.includes("error") || /\berr\b/.test(m)) return "error";
  if (m.includes("warn")) return "warning";
  if (m.includes("trace")) return "trace";
  if (m.includes("debug")) return "debug";
  if (m.includes("info")) return "info";
  return "unknown";
}
function severityColor(level) {
  return SEV_COLORS[normalizeLevel(level)] ?? SEV_COLORS.unknown;
}
function severityBadgeStyle(level) {
  const c = severityColor(level);
  return {
    color: c,
    backgroundColor: `color-mix(in srgb, ${c} 14%, transparent)`,
    border: `1px solid color-mix(in srgb, ${c} 35%, transparent)`
  };
}
function formatLogTimestamp(ms, resolution = "ms") {
  if (!Number.isFinite(ms)) return "";
  let epoch = ms;
  if (resolution === "ns") epoch = ms / 1e6;
  else if (resolution === "us" || resolution === "µs") epoch = ms / 1e3;
  else if (resolution === "s") epoch = ms * 1e3;
  if (epoch > 1e17) epoch = epoch / 1e6;
  else if (epoch > 1e14) epoch = epoch / 1e3;
  const d = new Date(epoch);
  if (Number.isNaN(d.getTime())) return "";
  return d.toISOString().replace("T", " ").replace("Z", "").slice(0, 23);
}
function formatLabelValue(val) {
  if (val == null) return "";
  if (typeof val === "string" || typeof val === "number" || typeof val === "boolean")
    return String(val);
  if (Array.isArray(val)) return val.map(formatLabelValue).join(",");
  try {
    return JSON.stringify(val);
  } catch {
    return String(val);
  }
}
function aggregateLogFields(log) {
  const attributes = {};
  const resources = {};
  for (const key of Object.keys(log)) {
    const val = log[key];
    if (!val || typeof val !== "object" || Array.isArray(val)) continue;
    if (key.startsWith("attributes_") || key === "attributesString" || key === "attributeMap" || key === "attributes") {
      Object.entries(val).forEach(([k, v]) => {
        attributes[k] = formatLabelValue(v);
      });
    } else if (key.startsWith("resources_") || key === "resourcesString" || key === "resourceMap" || key === "resources") {
      Object.entries(val).forEach(([k, v]) => {
        resources[k] = formatLabelValue(v);
      });
    }
  }
  return { attributes, resources };
}
function extractService(labels, extras) {
  if (extras) {
    for (const k of ["service.name", "service", "serviceName", "job", "app"]) {
      if (extras[k] != null && String(extras[k]).trim()) return String(extras[k]);
    }
  }
  const blob = String(labels ?? "");
  for (const key of ["service.name", "service", "job", "app"]) {
    const re = new RegExp(`(?:^|,)\\s*${key.replace(".", "\\.")}\\s*=\\s*([^,]+)`, "i");
    const m = blob.match(re);
    if (m?.[1]) return m[1].trim();
  }
  return "";
}
function extractTraceId(labels, extras) {
  if (extras) {
    for (const k of ["trace_id", "traceId", "traceID", "trace.id"]) {
      if (extras[k] != null && String(extras[k]).trim()) return String(extras[k]);
    }
  }
  const blob = String(labels ?? "");
  const m = blob.match(/(?:^|,)\s*(?:trace_id|traceId|traceID|trace\.id)\s*=\s*([^,]+)/i);
  return m?.[1]?.trim() ?? "";
}
function labelsFromField(field, i) {
  if (!field) return "";
  const v = field.values?.[i];
  if (v && typeof v === "object" && !Array.isArray(v)) {
    return Object.entries(v).map(([k, val]) => `${k}=${formatLabelValue(val)}`).join(", ");
  }
  return formatLabelValue(v);
}
function parseLogRowsFromFrame(frame, options = {}) {
  if (!frame?.fields?.length) return [];
  const time = frame.fields.find((f) => f.type === "time");
  const line = frame.fields.find(
    (f) => /line|message|msg|body|Log/i.test(String(f.name || "")) && f.type === "string"
  ) ?? frame.fields.find((f) => f.type === "string");
  if (!line) return [];
  const labelField = frame.fields.find((f) => /label/i.test(String(f.name || ""))) ?? frame.fields.find((f) => f.labels && Object.keys(f.labels).length);
  const levelField = frame.fields.find(
    (f) => /level|severity|severity_text/i.test(String(f.name || ""))
  );
  const serviceField = frame.fields.find(
    (f) => /service(\.name)?$|job|app/i.test(String(f.name || ""))
  );
  const traceField = frame.fields.find(
    (f) => /trace_?id|trace\.id/i.test(String(f.name || ""))
  );
  const res = String(options.timestampResolution ?? "ms");
  const total = frame.length ?? line.values?.length ?? 0;
  const max = options.maxRows != null && options.maxRows > 0 ? Math.min(total, options.maxRows) : total;
  const dedup = String(options.dedupStrategy ?? "none");
  const ascending = String(options.sortOrder) === "Ascending";
  const fieldList = frame.fields;
  const simpleFastPath = !options.prettifyLogMessage && dedup === "none" && !labelField && fieldList.length <= 4;
  const buildRow = (i) => {
    const raw = String(line?.values?.[i] ?? "");
    let msg = raw;
    if (options.prettifyLogMessage) {
      try {
        msg = JSON.stringify(JSON.parse(raw), null, 2);
      } catch {
      }
    }
    if (simpleFastPath) {
      const levelFromField2 = levelField ? normalizeLevel(String(levelField.values?.[i] ?? "")) : "";
      const level2 = levelFromField2 && levelFromField2 !== "unknown" ? levelFromField2 : detectLevelFromMessage(msg);
      let service2 = serviceField ? String(serviceField.values?.[i] ?? "") : "";
      if (!service2) {
        const m = /\bservice=(\S+)/i.exec(msg);
        if (m) service2 = m[1];
      }
      const serviceFromMsg = service2;
      const traceId2 = traceField ? String(traceField.values?.[i] ?? "") : "";
      const ts2 = time ? Number(time.values?.[i]) : i;
      const fields2 = {};
      for (const f of fieldList) {
        const name = String(f?.name || "");
        if (!name) continue;
        if (/^(Time|time|timestamp|ts|line|body|message|Content|msg)$/i.test(name)) {
          continue;
        }
        const v = f.values?.[i];
        if (v != null && typeof v === "object" && !Array.isArray(v)) {
          Object.entries(v).forEach(([k, val]) => {
            fields2[k] = formatLabelValue(val);
          });
        } else if (v != null && String(v) !== "") {
          fields2[name] = formatLabelValue(v);
        }
      }
      if (traceId2 && !fields2.traceId && !fields2.trace_id) {
        fields2.traceId = traceId2;
      }
      return {
        id: `${ts2}-${i}`,
        index: i,
        timestamp: ts2,
        t: formatLogTimestamp(ts2, res),
        severityText: (level2 || "INFO").toUpperCase(),
        level: level2,
        body: raw,
        msg,
        raw,
        service: serviceFromMsg,
        traceId: traceId2,
        labels: "",
        attributes: { ...fields2 },
        resources: serviceFromMsg ? { "service.name": serviceFromMsg } : {},
        fields: fields2
      };
    }
    const labels = labelsFromField(labelField, i) || (line?.labels ? Object.entries(line.labels).map(([k, v]) => `${k}=${formatLabelValue(v)}`).join(", ") : "");
    const levelFromField = levelField ? normalizeLevel(String(levelField.values?.[i] ?? "")) : "";
    const level = levelFromField && levelFromField !== "unknown" ? levelFromField : detectLevelFromMessage(msg);
    const labelObj = labelField?.values?.[i] && typeof labelField.values[i] === "object" && !Array.isArray(labelField.values[i]) ? labelField.values[i] : line?.labels;
    const service = (serviceField ? String(serviceField.values?.[i] ?? "") : "") || extractService(labels, labelObj);
    const traceId = (traceField ? String(traceField.values?.[i] ?? "") : "") || extractTraceId(labels, labelObj);
    const fields = {};
    for (const f of fieldList) {
      const name = String(f.name || "");
      if (!name) continue;
      const v = f.values?.[i];
      if (v != null && typeof v === "object" && !Array.isArray(v)) {
        Object.entries(v).forEach(([k, val]) => {
          fields[k] = formatLabelValue(val);
        });
      } else {
        fields[name] = formatLabelValue(v);
      }
    }
    const bag = {
      ...fields,
      attributes: labelObj && typeof labelObj === "object" ? labelObj : {},
      resources: service ? { "service.name": service } : {},
      body: raw,
      severityText: level,
      traceId
    };
    const { attributes, resources } = aggregateLogFields(bag);
    if (service && !resources["service.name"]) {
      resources["service.name"] = service;
    }
    const ts = time ? Number(time.values?.[i]) : i;
    return {
      id: `${ts}-${i}`,
      index: i,
      timestamp: ts,
      t: formatLogTimestamp(ts, res),
      severityText: (level || "INFO").toUpperCase(),
      level,
      body: raw,
      msg,
      raw,
      service,
      traceId,
      labels,
      attributes,
      resources,
      fields
    };
  };
  let result = new Array(max);
  if (ascending) {
    for (let i = 0; i < max; i++) result[i] = buildRow(i);
  } else {
    for (let out = 0; out < max; out++) {
      result[out] = buildRow(max - 1 - out);
    }
  }
  if (dedup === "exact") {
    const seen = /* @__PURE__ */ new Set();
    result = result.filter((r) => {
      if (seen.has(r.raw)) return false;
      seen.add(r.raw);
      return true;
    });
  } else if (dedup === "numbers") {
    const seen = /* @__PURE__ */ new Set();
    result = result.filter((r) => {
      const k = r.msg.replaceAll(/\d+/g, "#");
      if (seen.has(k)) return false;
      seen.add(k);
      return true;
    });
  } else if (dedup === "signature") {
    const seen = /* @__PURE__ */ new Set();
    result = result.filter((r) => {
      const k = r.msg.replaceAll(/[0-9a-f]{8,}/gi, "#").replaceAll(/\d+/g, "#");
      if (seen.has(k)) return false;
      seen.add(k);
      return true;
    });
  }
  return result;
}
function getRowAttr(row, key) {
  if (row.resources[key]) return row.resources[key];
  if (row.attributes[key]) return row.attributes[key];
  if (row.fields[key]) return row.fields[key];
  if (key === "service.name") return row.service;
  if (key === "traceId" || key === "trace_id") return row.traceId;
  if (key === "body" || key === "Line" || key === "line") return row.body;
  return "";
}
function rowToDetailObject(row) {
  return {
    timestamp: row.timestamp,
    id: row.id,
    traceId: row.traceId,
    severityText: row.severityText,
    body: row.body,
    attributes: row.attributes,
    resources: {
      ...row.resources,
      ...row.service ? { "service.name": row.service } : {}
    },
    fields: row.fields
  };
}
const EMPTY_ATTRS = Object.freeze({});
const EMPTY_FIELDS = Object.freeze({});
function fastLevelFromMessage(msg) {
  const sp = msg.indexOf(" ");
  const head = (sp < 0 ? msg : msg.slice(0, sp)).toLowerCase();
  if (head === "info" || head === "error" || head === "warn" || head === "warning" || head === "debug" || head === "trace" || head === "critical" || head === "fatal") {
    return head === "warn" ? "warning" : head;
  }
  return detectLevelFromMessage(msg);
}
function createLazyLogSource(frames, options = {}) {
  const dedup = String(options.dedupStrategy ?? "none");
  const list = frames ?? [];
  const complexFrame = list.some((frame) => {
    const fields = frame?.fields ?? [];
    if (fields.length > 4) return true;
    return fields.some((f) => /label/i.test(String(f.name || "")));
  });
  const needsEager = options.prettifyLogMessage || dedup !== "none" || options.maxRows != null || complexFrame;
  if (needsEager) {
    const all = parseLogRowsFromFrames(frames, options);
    return {
      length: all.length,
      getRow: (i) => all[i],
      materializeAll: () => all
    };
  }
  const segs = [];
  let offset = 0;
  for (const frame of frames ?? []) {
    if (!frame?.fields?.length) continue;
    const time = frame.fields.find((f) => f.type === "time");
    const line = frame.fields.find(
      (f) => /line|message|msg|body|Log/i.test(String(f.name || "")) && f.type === "string"
    ) ?? frame.fields.find((f) => f.type === "string");
    if (!line) continue;
    const length = frame.length ?? line.values?.length ?? 0;
    if (!length) continue;
    segs.push({
      frame,
      time,
      line,
      levelField: frame.fields.find(
        (f) => /level|severity|severity_text/i.test(String(f.name || ""))
      ),
      serviceField: frame.fields.find(
        (f) => /service(\.name)?$|job|app/i.test(String(f.name || ""))
      ),
      traceField: frame.fields.find((f) => /trace_?id|trace\.id/i.test(String(f.name || ""))),
      fieldList: frame.fields,
      offset,
      length
    });
    offset += length;
  }
  const total = offset;
  const ascending = String(options.sortOrder) === "Ascending";
  const res = String(options.timestampResolution ?? "ms");
  const cache2 = /* @__PURE__ */ new Map();
  function sourceIndex(displayIndex) {
    if (displayIndex < 0 || displayIndex >= total) return -1;
    return ascending ? displayIndex : total - 1 - displayIndex;
  }
  function locate(src) {
    for (const seg of segs) {
      if (src >= seg.offset && src < seg.offset + seg.length) {
        return { seg, i: src - seg.offset };
      }
    }
    return null;
  }
  function buildAt(src) {
    const hit = locate(src);
    if (!hit) {
      return {
        id: `missing-${src}`,
        index: src,
        timestamp: src,
        t: "",
        severityText: "INFO",
        level: "unknown",
        body: "",
        msg: "",
        raw: "",
        service: "",
        traceId: "",
        labels: "",
        attributes: EMPTY_ATTRS,
        resources: EMPTY_ATTRS,
        fields: EMPTY_FIELDS
      };
    }
    const { seg, i } = hit;
    const raw = String(seg.line?.values?.[i] ?? "");
    const levelFromField = seg.levelField ? normalizeLevel(String(seg.levelField.values?.[i] ?? "")) : "";
    const level = levelFromField && levelFromField !== "unknown" ? levelFromField : fastLevelFromMessage(raw);
    let service = seg.serviceField ? String(seg.serviceField.values?.[i] ?? "") : "";
    if (!service) {
      const m = /\bservice=(\S+)/i.exec(raw);
      if (m) service = m[1];
    }
    const traceId = seg.traceField ? String(seg.traceField.values?.[i] ?? "") : "";
    const ts = seg.time ? Number(seg.time.values?.[i]) : i;
    const fields = {};
    for (const f of seg.fieldList || []) {
      const name = String(f?.name || "");
      if (!name) continue;
      if (/^(Time|time|timestamp|ts|line|body|message|Content|msg)$/i.test(name)) {
        continue;
      }
      const v = f.values?.[i];
      if (v != null && typeof v === "object" && !Array.isArray(v)) {
        Object.entries(v).forEach(([k, val]) => {
          fields[k] = formatLabelValue(val);
        });
      } else if (v != null && String(v) !== "") {
        fields[name] = formatLabelValue(v);
      }
    }
    if (traceId && !fields.traceId && !fields.trace_id) fields.traceId = traceId;
    const hasFields = Object.keys(fields).length > 0;
    return {
      id: `${ts}-${src}`,
      index: src,
      timestamp: ts,
      t: formatLogTimestamp(ts, res),
      severityText: (level || "INFO").toUpperCase(),
      level,
      body: raw,
      msg: raw,
      raw,
      service,
      traceId,
      labels: "",
      attributes: hasFields ? fields : EMPTY_ATTRS,
      resources: service ? { "service.name": service } : EMPTY_ATTRS,
      fields: hasFields ? fields : EMPTY_FIELDS
    };
  }
  function getRow(displayIndex) {
    const cached = cache2.get(displayIndex);
    if (cached) return cached;
    const src = sourceIndex(displayIndex);
    const row = buildAt(src);
    if (cache2.size > 512) {
      const first = cache2.keys().next().value;
      if (first != null) cache2.delete(first);
    }
    cache2.set(displayIndex, row);
    return row;
  }
  function materializeAll() {
    const out = new Array(total);
    for (let i = 0; i < total; i++) out[i] = getRow(i);
    return out;
  }
  return { length: total, getRow, materializeAll };
}
function parseLogRowsFromFrames(frames, options = {}) {
  const list = frames ?? [];
  const out = [];
  let indexBase = 0;
  for (const frame of list) {
    const rows = parseLogRowsFromFrame(frame, {
      ...options,
      // explicit only — never silent cap across frames
      maxRows: options.maxRows
    });
    for (const r of rows) {
      out.push({ ...r, index: indexBase + r.index, id: `${r.id}` });
    }
    indexBase += rows.length;
  }
  return out;
}
const _hoisted_1$2H = ["data-level", "data-open", "data-testid", "onClick"];
const _hoisted_2$2a = { class: "le-entry" };
const _hoisted_3$1X = { class: "le-entry-head" };
const _hoisted_4$1F = {
  key: 0,
  class: "le-entry-ts timestamp field"
};
const _hoisted_5$1t = ["title"];
const _hoisted_6$1g = ["title"];
const _hoisted_7$16 = ["data-col"];
const _hoisted_8$_ = {
  key: 3,
  class: "labels field le-entry-labels",
  "data-testid": "log-attributes"
};
const _hoisted_9$W = { class: "le-entry-actions" };
const _hoisted_10$N = ["onClick"];
const _hoisted_11$I = ["innerHTML"];
const _hoisted_12$C = { class: "le-detail-ts" };
const _hoisted_13$B = { class: "le-detail-body" };
const _hoisted_14$w = { class: "fieldsTable" };
const _hoisted_15$t = { class: "fieldsKey" };
const _hoisted_16$r = { class: "fieldsVal" };
const _hoisted_17$p = {
  key: 0,
  class: "log-detail-sidebar",
  "data-testid": "log-detail",
  "data-details-mode": "sidebar"
};
const _hoisted_18$p = {
  key: 0,
  class: "sidebar-inner"
};
const _hoisted_19$o = { class: "fieldsTable" };
const _hoisted_20$m = { class: "fieldsKey" };
const _hoisted_21$e = { class: "fieldsVal" };
const _sfc_main$3t = /* @__PURE__ */ defineComponent({
  __name: "LogsListRenderer",
  props: {
    rows: {},
    rowCount: {},
    getRow: { type: Function },
    options: {},
    openId: {},
    wrap: { type: Boolean },
    extraColumns: {},
    highlightMsg: { type: Function },
    detailEntries: { type: Function },
    rowHeight: {}
  },
  emits: ["toggle", "copy"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const opts = computed(() => props.options ?? {});
    const viewportEl = ref(null);
    const scrollTop = ref(0);
    const viewportHeight = ref(400);
    const ROW_H = computed(() => Math.max(22, Number(props.rowHeight ?? 28)));
    const totalRows = computed(
      () => props.getRow ? Number(props.rowCount ?? 0) : props.rows?.length ?? 0
    );
    const win = computed(
      () => computeVirtualWindow(totalRows.value, scrollTop.value, viewportHeight.value, ROW_H.value, 12)
    );
    const visibleRows = computed(() => {
      if (props.getRow) {
        const out = [];
        for (let i = win.value.start; i < win.value.end; i++) {
          out.push(props.getRow(i));
        }
        return out;
      }
      return sliceVirtualRows(props.rows ?? [], win.value);
    });
    const openRow = computed(() => {
      if (!props.openId) return null;
      if (props.getRow) {
        for (let i = 0; i < totalRows.value; i++) {
          const r = props.getRow(i);
          if (r.id === props.openId) return r;
        }
        return null;
      }
      return props.rows?.find((r) => r.id === props.openId) ?? null;
    });
    function onScroll() {
      const el = viewportEl.value;
      if (!el) return;
      scrollTop.value = el.scrollTop;
      viewportHeight.value = el.clientHeight;
    }
    let ro = null;
    onMounted(() => {
      onScroll();
      if (typeof ResizeObserver !== "undefined" && viewportEl.value) {
        ro = new ResizeObserver(() => onScroll());
        ro.observe(viewportEl.value);
      }
    });
    onBeforeUnmount(() => {
      ro?.disconnect();
    });
    watch(
      () => totalRows.value,
      () => {
        onScroll();
      }
    );
    function scrollToIndex(index2) {
      const el = viewportEl.value;
      if (!el) return;
      const i = Math.max(0, Math.min(totalRows.value - 1, Math.floor(index2)));
      const top = i * ROW_H.value;
      el.scrollTo({ top });
      scrollTop.value = top;
      viewportHeight.value = el.clientHeight || viewportHeight.value;
    }
    __expose({
      scrollToTop() {
        viewportEl.value?.scrollTo({ top: 0 });
      },
      scrollToBottom() {
        const el = viewportEl.value;
        if (el) el.scrollTo({ top: el.scrollHeight });
      },
      scrollToIndex,
      getViewport() {
        return viewportEl.value;
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          ref_key: "viewportEl",
          ref: viewportEl,
          class: "logs-list-viewport le-list-wrap",
          "data-testid": "logs-list-viewport",
          role: "list",
          onScrollPassive: onScroll
        },
        [
          createElementVNode(
            "div",
            {
              class: "logs-list-spacer",
              style: normalizeStyle({ height: `${win.value.totalHeight}px`, position: "relative" })
            },
            [
              createElementVNode(
                "div",
                {
                  class: "logs-list-window",
                  style: normalizeStyle({
                    transform: `translateY(${win.value.offsetY}px)`,
                    position: "absolute",
                    left: 0,
                    right: 0,
                    top: 0
                  })
                },
                [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(visibleRows.value, (r) => {
                      return openBlock(), createElementBlock("div", {
                        key: r.id,
                        class: normalizeClass(["logLine le-list-entry", {
                          "clickable": opts.value.enableLogDetails !== false,
                          "detailsDisplayed": __props.openId === r.id,
                          "small": opts.value.fontSize === "small" || opts.value.fontSize === "sm",
                          "is-active": __props.openId === r.id
                        }]),
                        role: "listitem",
                        "data-level": r.level,
                        "data-open": __props.openId === r.id,
                        "data-testid": `log-row-${r.id}`,
                        style: normalizeStyle({ minHeight: `${ROW_H.value}px` }),
                        onClick: ($event) => emit("toggle", r)
                      }, [
                        createElementVNode(
                          "div",
                          {
                            class: "le-sev-bar",
                            style: normalizeStyle({ background: unref(severityColor)(r.level) })
                          },
                          null,
                          4
                          /* STYLE */
                        ),
                        createElementVNode("div", _hoisted_2$2a, [
                          createElementVNode("div", _hoisted_3$1X, [
                            !!opts.value.showTime ? (openBlock(), createElementBlock(
                              "span",
                              _hoisted_4$1F,
                              toDisplayString(r.t),
                              1
                              /* TEXT */
                            )) : createCommentVNode("v-if", true),
                            opts.value.showLevel !== false ? (openBlock(), createElementBlock("span", {
                              key: 1,
                              class: normalizeClass(["le-entry-lvl level field", `level-${r.level}`]),
                              style: normalizeStyle(unref(severityBadgeStyle)(r.level)),
                              title: r.level
                            }, toDisplayString(r.severityText || "INFO"), 15, _hoisted_5$1t)) : createCommentVNode("v-if", true),
                            r.service ? (openBlock(), createElementBlock("span", {
                              key: 2,
                              class: "le-entry-svc",
                              title: r.service
                            }, toDisplayString(r.service), 9, _hoisted_6$1g)) : createCommentVNode("v-if", true),
                            (openBlock(true), createElementBlock(
                              Fragment,
                              null,
                              renderList(__props.extraColumns || [], (col2) => {
                                return openBlock(), createElementBlock("span", {
                                  key: col2,
                                  class: "le-entry-extra",
                                  "data-testid": "log-extra-cell",
                                  "data-col": col2
                                }, toDisplayString(unref(getRowAttr)(r, col2) || "—"), 9, _hoisted_7$16);
                              }),
                              128
                              /* KEYED_FRAGMENT */
                            )),
                            (opts.value.showLabels === true || opts.value.showLogAttributes !== false) && r.labels ? (openBlock(), createElementBlock(
                              "span",
                              _hoisted_8$_,
                              toDisplayString(r.labels),
                              1
                              /* TEXT */
                            )) : createCommentVNode("v-if", true),
                            createElementVNode("div", _hoisted_9$W, [
                              opts.value.showCopyLogLink ? (openBlock(), createElementBlock("button", {
                                key: 0,
                                type: "button",
                                class: "le-entry-btn",
                                "data-testid": "logs-copy",
                                title: "复制",
                                onClick: withModifiers(($event) => emit("copy", r), ["stop"])
                              }, " 复制 ", 8, _hoisted_10$N)) : createCommentVNode("v-if", true)
                            ])
                          ]),
                          createElementVNode(
                            "div",
                            {
                              class: normalizeClass(["le-entry-body fieldsWrapper", __props.wrap ? "wrappedLogLine" : "unwrappedLogLine"])
                            },
                            [
                              createElementVNode("span", {
                                class: normalizeClass(["field log-line-body", {
                                  "log-syntax-highlight": opts.value.syntaxHighlighting !== false,
                                  "le-body-clamp": !__props.wrap
                                }]),
                                innerHTML: __props.highlightMsg(r.msg)
                              }, null, 10, _hoisted_11$I)
                            ],
                            2
                            /* CLASS */
                          ),
                          opts.value.enableLogDetails !== false && __props.openId === r.id && (opts.value.detailsMode || "inline") === "inline" ? (openBlock(), createElementBlock("div", {
                            key: 0,
                            class: "logDetails le-detail-inline",
                            "data-testid": "log-detail",
                            onClick: _cache[0] || (_cache[0] = withModifiers(() => {
                            }, ["stop"]))
                          }, [
                            createElementVNode(
                              "div",
                              {
                                class: "le-detail-strip",
                                style: normalizeStyle({ borderLeftColor: unref(severityColor)(r.level) })
                              },
                              [
                                createElementVNode(
                                  "span",
                                  _hoisted_12$C,
                                  toDisplayString(r.t),
                                  1
                                  /* TEXT */
                                ),
                                createElementVNode(
                                  "pre",
                                  _hoisted_13$B,
                                  toDisplayString(r.msg),
                                  1
                                  /* TEXT */
                                )
                              ],
                              4
                              /* STYLE */
                            ),
                            createElementVNode("div", _hoisted_14$w, [
                              (openBlock(true), createElementBlock(
                                Fragment,
                                null,
                                renderList(__props.detailEntries(r), (e, di) => {
                                  return openBlock(), createElementBlock("div", {
                                    key: di,
                                    class: "fieldsRow"
                                  }, [
                                    createElementVNode(
                                      "div",
                                      _hoisted_15$t,
                                      toDisplayString(e.key),
                                      1
                                      /* TEXT */
                                    ),
                                    createElementVNode(
                                      "div",
                                      _hoisted_16$r,
                                      toDisplayString(e.value),
                                      1
                                      /* TEXT */
                                    )
                                  ]);
                                }),
                                128
                                /* KEYED_FRAGMENT */
                              ))
                            ])
                          ])) : createCommentVNode("v-if", true)
                        ])
                      ], 14, _hoisted_1$2H);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ],
                4
                /* STYLE */
              )
            ],
            4
            /* STYLE */
          ),
          createCommentVNode(" sidebar detail portal target "),
          opts.value.enableLogDetails !== false && __props.openId && opts.value.detailsMode === "sidebar" ? (openBlock(), createElementBlock("aside", _hoisted_17$p, [
            openRow.value ? (openBlock(), createElementBlock("div", _hoisted_18$p, [
              createElementVNode("div", _hoisted_19$o, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(__props.detailEntries(openRow.value), (e, di) => {
                    return openBlock(), createElementBlock("div", {
                      key: di,
                      class: "fieldsRow"
                    }, [
                      createElementVNode(
                        "div",
                        _hoisted_20$m,
                        toDisplayString(e.key),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "div",
                        _hoisted_21$e,
                        toDisplayString(e.value),
                        1
                        /* TEXT */
                      )
                    ]);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])
            ])) : createCommentVNode("v-if", true)
          ])) : createCommentVNode("v-if", true)
        ],
        544
        /* NEED_HYDRATION, NEED_PATCH */
      );
    };
  }
});
const LogsListRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3t, [["__scopeId", "data-v-a1fd628f"]]);
const _hoisted_1$2G = ["data-raw-max-lines", "data-font-size"];
const _hoisted_2$29 = ["data-testid", "data-font-size"];
const _sfc_main$3s = /* @__PURE__ */ defineComponent({
  __name: "LogsRawRenderer",
  props: {
    rows: {},
    rowCount: {},
    getRow: { type: Function },
    options: {},
    rowHeight: {}
  },
  setup(__props) {
    const props = __props;
    const viewportEl = ref(null);
    const scrollTop = ref(0);
    const viewportHeight = ref(400);
    const ROW_H = computed(() => Math.max(18, Number(props.rowHeight ?? 20)));
    const fontSizeMode = computed(() => {
      const v = String(props.options?.fontSize ?? "default").toLowerCase();
      if (v === "small" || v === "sm") return "small";
      if (v === "large" || v === "lg") return "large";
      return "default";
    });
    const rawMaxLines = computed(() => {
      const n = Number(props.options?.rawMaxLines ?? 1);
      return Number.isFinite(n) && n > 0 ? Math.floor(n) : 1;
    });
    const lineClampStyle = computed(() => {
      const n = rawMaxLines.value;
      if (n <= 0) return {};
      return {
        display: "-webkit-box",
        WebkitBoxOrient: "vertical",
        WebkitLineClamp: String(n),
        overflow: "hidden",
        maxHeight: n === 1 ? `${ROW_H.value}px` : void 0
      };
    });
    const totalRows = computed(
      () => props.getRow ? Number(props.rowCount ?? 0) : props.rows?.length ?? 0
    );
    const win = computed(
      () => computeVirtualWindow(totalRows.value, scrollTop.value, viewportHeight.value, ROW_H.value, 16)
    );
    const visibleRows = computed(() => {
      if (props.getRow) {
        const out = [];
        for (let i = win.value.start; i < win.value.end; i++) out.push(props.getRow(i));
        return out;
      }
      return sliceVirtualRows(props.rows ?? [], win.value);
    });
    function onScroll() {
      const el = viewportEl.value;
      if (!el) return;
      scrollTop.value = el.scrollTop;
      viewportHeight.value = el.clientHeight;
    }
    let ro = null;
    onMounted(() => {
      onScroll();
      if (typeof ResizeObserver !== "undefined" && viewportEl.value) {
        ro = new ResizeObserver(() => onScroll());
        ro.observe(viewportEl.value);
      }
    });
    onBeforeUnmount(() => ro?.disconnect());
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "viewportEl",
        ref: viewportEl,
        class: "logs-raw-viewport",
        "data-testid": "logs-raw-viewport",
        "data-log-format": "raw",
        "data-raw-max-lines": String(rawMaxLines.value),
        "data-font-size": fontSizeMode.value,
        onScrollPassive: onScroll
      }, [
        createElementVNode(
          "div",
          {
            class: "spacer",
            style: normalizeStyle({ height: `${win.value.totalHeight}px` })
          },
          [
            createElementVNode(
              "div",
              {
                class: "window",
                style: normalizeStyle({ transform: `translateY(${win.value.offsetY}px)` })
              },
              [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(visibleRows.value, (r) => {
                    return openBlock(), createElementBlock("pre", {
                      key: r.id,
                      class: normalizeClass(["raw-line", {
                        small: fontSizeMode.value === "small",
                        large: fontSizeMode.value === "large"
                      }]),
                      "data-testid": `log-row-${r.id}`,
                      "data-font-size": fontSizeMode.value,
                      style: normalizeStyle({ minHeight: `${ROW_H.value}px`, ...lineClampStyle.value })
                    }, toDisplayString(r.raw || r.msg), 15, _hoisted_2$29);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ],
              4
              /* STYLE */
            )
          ],
          4
          /* STYLE */
        )
      ], 40, _hoisted_1$2G);
    };
  }
});
const LogsRawRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3s, [["__scopeId", "data-v-b0f3bdaf"]]);
const _hoisted_1$2F = { class: "ld-content" };
const _hoisted_2$28 = { class: "ld-header" };
const _hoisted_3$1W = { class: "ld-header-left" };
const _hoisted_4$1E = { class: "ld-header-actions" };
const _hoisted_5$1s = { class: "ld-body-ts" };
const _hoisted_6$1f = ["title"];
const _hoisted_7$15 = { class: "ld-tabs" };
const _hoisted_8$Z = ["onClick"];
const _hoisted_9$V = { class: "ld-scroll" };
const _hoisted_10$M = {
  key: 0,
  class: "lov-root"
};
const _hoisted_11$H = { class: "lov-key" };
const _hoisted_12$B = { class: "lov-val" };
const _hoisted_13$A = {
  key: 1,
  class: "ljc-root"
};
const _hoisted_14$v = ["innerHTML"];
const _hoisted_15$s = {
  key: 2,
  class: "ld-stub"
};
const _hoisted_16$q = { class: "lov-row" };
const _hoisted_17$o = { class: "lov-val" };
const _hoisted_18$o = { class: "lov-row" };
const _hoisted_19$n = { class: "lov-val" };
const _hoisted_20$l = {
  key: 3,
  class: "ld-stub"
};
const _sfc_main$3r = /* @__PURE__ */ defineComponent({
  __name: "ArgusLogDetail",
  props: {
    open: { type: Boolean },
    row: {},
    initialTab: {}
  },
  emits: ["close"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const activeTab = ref(props.initialTab ?? "overview");
    watch(
      () => props.open,
      (v) => {
        if (v) activeTab.value = props.initialTab ?? "overview";
      }
    );
    watch(
      () => props.initialTab,
      (t2) => {
        if (t2) activeTab.value = t2;
      }
    );
    const tabs = [
      { key: "overview", label: "概览" },
      { key: "json", label: "JSON" },
      { key: "context", label: "上下文" },
      { key: "metrics", label: "指标" }
    ];
    const sev = computed(() => props.row ? severityColor(props.row.level) : severityColor("unknown"));
    const bodyPreview = computed(() => props.row?.msg || props.row?.body || "");
    const tsText = computed(() => {
      if (!props.row) return "";
      return props.row.t || formatLogTimestamp(props.row.timestamp);
    });
    const overviewFields = computed(() => {
      const row = props.row;
      if (!row) return [];
      const fields = [
        { key: "timestamp", value: tsText.value || "—" },
        { key: "severity", value: row.severityText || row.level },
        { key: "service.name", value: row.service || "—" },
        { key: "traceId", value: row.traceId || "—" },
        { key: "body", value: row.body || "—" }
      ];
      for (const [k, v] of Object.entries(row.resources)) {
        if (!fields.some((f) => f.key === k)) fields.push({ key: k, value: v });
      }
      for (const [k, v] of Object.entries(row.attributes)) {
        if (!fields.some((f) => f.key === k)) fields.push({ key: k, value: v });
      }
      for (const [k, v] of Object.entries(row.fields)) {
        if (/time|line|message|body|level|severity/i.test(k) || fields.some((f) => f.key === k))
          continue;
        fields.push({ key: k, value: v });
      }
      return fields;
    });
    const jsonText = computed(() => {
      if (!props.row) return "";
      try {
        return JSON.stringify(rowToDetailObject(props.row), null, 2);
      } catch {
        return props.row.raw;
      }
    });
    function esc(s) {
      return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
    }
    const highlightedJson = computed(
      () => esc(jsonText.value).replaceAll(
        /("(\\u[\dA-Fa-f]{4}|\\[^u]|[^"\\])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?)/g,
        (m) => {
          if (m.startsWith('"')) {
            if (m.endsWith(":")) return `<span class="t-key">${m}</span>`;
            return `<span class="t-str">${m}</span>`;
          }
          if (/true|false/.test(m)) return `<span class="t-bool">${m}</span>`;
          if (/null/.test(m)) return `<span class="t-null">${m}</span>`;
          return `<span class="t-num">${m}</span>`;
        }
      )
    );
    async function copyContent() {
      try {
        const text = activeTab.value === "json" ? jsonText.value : bodyPreview.value;
        await navigator.clipboard?.writeText(text);
      } catch {
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(Transition, { name: "le-panel" }, {
        default: withCtx(() => [
          __props.open && __props.row ? (openBlock(), createElementBlock("aside", {
            key: 0,
            class: "le-detail-panel",
            "data-testid": "log-details",
            onClick: _cache[1] || (_cache[1] = withModifiers(() => {
            }, ["stop"]))
          }, [
            createElementVNode("div", _hoisted_1$2F, [
              createElementVNode("div", _hoisted_2$28, [
                createElementVNode("div", _hoisted_3$1W, [
                  createElementVNode(
                    "div",
                    {
                      class: "ld-sev-bar",
                      style: normalizeStyle({ background: sev.value })
                    },
                    null,
                    4
                    /* STYLE */
                  ),
                  _cache[2] || (_cache[2] = createElementVNode(
                    "span",
                    { class: "ld-title" },
                    "日志详情",
                    -1
                    /* CACHED */
                  ))
                ]),
                createElementVNode("div", _hoisted_4$1E, [
                  createElementVNode("button", {
                    type: "button",
                    class: "ld-icon-btn",
                    title: "复制",
                    "data-testid": "logs-copy",
                    onClick: copyContent
                  }, " 复制 "),
                  createElementVNode("button", {
                    type: "button",
                    class: "ld-icon-btn",
                    title: "关闭",
                    onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
                  }, "✕")
                ])
              ]),
              createElementVNode(
                "div",
                {
                  class: "ld-body-strip",
                  style: normalizeStyle({ borderLeftColor: sev.value })
                },
                [
                  createElementVNode(
                    "span",
                    _hoisted_5$1s,
                    toDisplayString(tsText.value),
                    1
                    /* TEXT */
                  ),
                  createElementVNode("pre", {
                    class: "ld-body-text",
                    title: bodyPreview.value
                  }, toDisplayString(bodyPreview.value), 9, _hoisted_6$1f)
                ],
                4
                /* STYLE */
              ),
              createElementVNode("div", _hoisted_7$15, [
                (openBlock(), createElementBlock(
                  Fragment,
                  null,
                  renderList(tabs, (tab) => {
                    return createElementVNode("button", {
                      key: tab.key,
                      type: "button",
                      class: normalizeClass(["ld-tab", { "ld-tab--active": activeTab.value === tab.key }]),
                      onClick: ($event) => activeTab.value = tab.key
                    }, toDisplayString(tab.label), 11, _hoisted_8$Z);
                  }),
                  64
                  /* STABLE_FRAGMENT */
                ))
              ]),
              createElementVNode("div", _hoisted_9$V, [
                activeTab.value === "overview" ? (openBlock(), createElementBlock("div", _hoisted_10$M, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(overviewFields.value, (f) => {
                      return openBlock(), createElementBlock("div", {
                        key: f.key,
                        class: "lov-row"
                      }, [
                        createElementVNode(
                          "div",
                          _hoisted_11$H,
                          toDisplayString(f.key),
                          1
                          /* TEXT */
                        ),
                        createElementVNode(
                          "div",
                          _hoisted_12$B,
                          toDisplayString(f.value),
                          1
                          /* TEXT */
                        )
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])) : activeTab.value === "json" ? (openBlock(), createElementBlock("div", _hoisted_13$A, [
                  createElementVNode("div", { class: "ljc-toolbar" }, [
                    _cache[3] || (_cache[3] = createElementVNode(
                      "span",
                      { class: "ljc-lang" },
                      "JSON",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode("button", {
                      type: "button",
                      class: "ljc-copy-btn",
                      onClick: copyContent
                    }, "复制")
                  ]),
                  createCommentVNode(" eslint-disable-next-line vue/no-v-html "),
                  createElementVNode("pre", {
                    class: "ljc-pre",
                    innerHTML: highlightedJson.value
                  }, null, 8, _hoisted_14$v)
                ])) : activeTab.value === "context" ? (openBlock(), createElementBlock("div", _hoisted_15$s, [
                  _cache[6] || (_cache[6] = createElementVNode(
                    "p",
                    null,
                    "上下文需查询 API，面板内展示当前日志前后字段摘要。",
                    -1
                    /* CACHED */
                  )),
                  createElementVNode("div", _hoisted_16$q, [
                    _cache[4] || (_cache[4] = createElementVNode(
                      "div",
                      { class: "lov-key" },
                      "service",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode(
                      "div",
                      _hoisted_17$o,
                      toDisplayString(__props.row.service || "—"),
                      1
                      /* TEXT */
                    )
                  ]),
                  createElementVNode("div", _hoisted_18$o, [
                    _cache[5] || (_cache[5] = createElementVNode(
                      "div",
                      { class: "lov-key" },
                      "traceId",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode(
                      "div",
                      _hoisted_19$n,
                      toDisplayString(__props.row.traceId || "—"),
                      1
                      /* TEXT */
                    )
                  ])
                ])) : (openBlock(), createElementBlock("div", _hoisted_20$l, [..._cache[7] || (_cache[7] = [
                  createElementVNode(
                    "p",
                    null,
                    "指标视图需要聚合查询；面板模式下暂无关联时序数据。",
                    -1
                    /* CACHED */
                  )
                ])]))
              ])
            ])
          ])) : createCommentVNode("v-if", true)
        ]),
        _: 1
        /* STABLE */
      });
    };
  }
});
const ArgusLogDetail = /* @__PURE__ */ _export_sfc$1(_sfc_main$3r, [["__scopeId", "data-v-a2673ec4"]]);
const _hoisted_1$2E = ["data-show-controls", "data-enable-log-details", "data-allow-download", "data-show-copy", "data-show-copy-log-link", "data-logs-compatible", "data-show-time", "data-wrap", "data-prettify", "data-show-header", "data-cell-height", "data-row-height", "data-max-row-height", "data-enable-pagination", "data-page-size", "data-frozen-left", "data-align", "data-wrap-header", "data-min-col-width", "data-filterable", "data-hide-from-viz"];
const _hoisted_2$27 = { class: "le-actions-bar" };
const _hoisted_3$1V = { class: "le-actions-left" };
const _hoisted_4$1D = { class: "le-ab-label" };
const _hoisted_5$1r = { class: "le-actions-right" };
const _hoisted_6$1e = { class: "le-options-wrap" };
const _hoisted_7$14 = ["value"];
const _hoisted_8$Y = {
  key: 0,
  class: "le-extra-chips"
};
const _hoisted_9$U = ["onClick"];
const _hoisted_10$L = {
  key: 0,
  class: "logstable-hidden",
  "data-testid": "logstable-hidden-viz"
};
const _hoisted_11$G = {
  key: 1,
  class: "logstable-filter",
  "data-testid": "logstable-filter"
};
const _hoisted_12$A = {
  class: "logstable-filter-count",
  "data-testid": "logstable-filter-count"
};
const _hoisted_13$z = {
  key: 0,
  class: "navContainer",
  "data-testid": "logstable-controls"
};
const _hoisted_14$u = { class: "meta" };
const _hoisted_15$r = { class: "main" };
const _hoisted_16$p = ["data-col-width", "data-col-align"];
const _hoisted_17$n = ["data-col-width", "data-col-align"];
const _hoisted_18$n = ["data-col-width", "data-col-align"];
const _hoisted_19$m = ["data-col-key", "data-col-width", "data-col-align"];
const _hoisted_20$k = ["data-col-width", "data-col-align"];
const _hoisted_21$d = ["data-col-width", "data-col-align"];
const _hoisted_22$a = ["data-open", "data-level", "onClick"];
const _hoisted_23$7 = ["data-col-width", "data-col-align"];
const _hoisted_24$7 = { class: "le-ts" };
const _hoisted_25$5 = ["data-col-width", "data-col-align"];
const _hoisted_26$5 = ["data-col-width", "data-col-align"];
const _hoisted_27$4 = ["data-col-key", "data-col-width", "data-col-align"];
const _hoisted_28$4 = { class: "mono" };
const _hoisted_29$4 = ["data-col-width", "data-col-align"];
const _hoisted_30$4 = { class: "mono body-cell" };
const _hoisted_31$4 = ["data-col-width", "data-col-align"];
const _hoisted_32$4 = { class: "trace-id" };
const _hoisted_33$4 = ["onClick"];
const _hoisted_34$4 = {
  key: 0,
  class: "empty"
};
const _hoisted_35$3 = ["data-page", "data-page-count"];
const _hoisted_36$2 = ["disabled"];
const _hoisted_37$2 = ["disabled"];
const _sfc_main$3q = /* @__PURE__ */ defineComponent({
  __name: "LogsTableRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {},
    replaceVariables: { type: Function },
    width: {},
    height: {}
  },
  setup(__props) {
    const props = __props;
    const openId = ref(null);
    const optionsVisible = ref(false);
    const wrapLocal = ref(null);
    const extraColumnsLocal = ref(null);
    const opts = computed(() => props.options ?? {});
    const frames = computed(() => props.data?.series ?? []);
    const showControls = computed(() => opts.value.showControls !== false);
    const enableLogDetails = computed(() => opts.value.enableLogDetails !== false);
    const allowDownload = computed(() => !!opts.value.allowDownload);
    const showCopyLogLink = computed(() => opts.value.showCopyLogLink !== false);
    const showTime = computed(() => opts.value.showTime !== false);
    const prettifyLogMessage = computed(() => !!opts.value.prettifyLogMessage);
    const defaultsCustom = computed(
      () => props.fieldConfig?.defaults?.custom ?? {}
    );
    function fieldByName2(name) {
      if (!name) return void 0;
      const frame = frames.value[0];
      if (!frame?.fields?.length) return void 0;
      const lower = String(name).toLowerCase();
      return frame.fields.find((f) => {
        const n = String(f?.name || "").toLowerCase();
        const d = String(f?.config?.displayName || "").toLowerCase();
        return n === lower || d && d === lower;
      });
    }
    function fieldCustomFor(fieldName2) {
      const f = fieldByName2(fieldName2);
      return {
        ...defaultsCustom.value,
        ...f?.config?.custom ?? {}
      };
    }
    function columnFieldName(key) {
      if (key === "sev" || key === "act") return void 0;
      if (key.startsWith("extra:")) return key.slice("extra:".length);
      if (key === "time") {
        return fieldByName2("Time")?.name ?? fieldByName2("time")?.name ?? fieldByName2("timestamp")?.name ?? "Time";
      }
      if (key === "level") {
        return fieldByName2("level")?.name ?? fieldByName2("severity")?.name ?? "level";
      }
      if (key === "service") {
        return fieldByName2("service")?.name ?? fieldByName2("service.name")?.name ?? "service";
      }
      if (key === "body") {
        return fieldByName2("line")?.name ?? fieldByName2("message")?.name ?? fieldByName2("body")?.name ?? fieldByName2("msg")?.name ?? "line";
      }
      if (key === "trace") {
        return fieldByName2("traceId")?.name ?? fieldByName2("trace_id")?.name ?? "traceId";
      }
      return void 0;
    }
    function isHideFromVizCustom(c) {
      if (!c) return false;
      return c.hideFrom?.viz === true || c["hideFrom.viz"] === true;
    }
    function isColHidden(key) {
      if (key === "sev" || key === "act") return false;
      return isHideFromVizCustom(fieldCustomFor(columnFieldName(key)));
    }
    function colAlign(key) {
      const a = String(fieldCustomFor(columnFieldName(key)).align ?? "auto");
      return a || "auto";
    }
    const wrapOn = computed(() => {
      if (opts.value.wrapLogMessage || opts.value.wrapText || defaultsCustom.value.wrapText) {
        return true;
      }
      const frame = frames.value[0];
      return (frame?.fields || []).some((f) => f?.config?.custom?.wrapText);
    });
    const wrapEffective = computed(() => wrapLocal.value === null ? wrapOn.value : wrapLocal.value);
    const showHeader = computed(() => opts.value.showHeader !== false);
    const cellHeight = computed(() => String(opts.value.cellHeight ?? "sm"));
    const rowHeightPx = computed(() => {
      const h2 = cellHeight.value;
      if (h2 === "lg") return 48;
      if (h2 === "md") return 40;
      return 32;
    });
    const maxRowHeight = computed(() => {
      const n = Number(opts.value.maxRowHeight);
      return Number.isFinite(n) && n > 0 ? n : void 0;
    });
    const enablePagination = computed(() => !!opts.value.enablePagination);
    const pageSize = computed(() => {
      const n = Number(opts.value.pageSize ?? 50);
      return Number.isFinite(n) && n > 0 ? n : 50;
    });
    const frozenLeft = computed(() => {
      const n = Number(opts.value?.frozenColumns?.left ?? 0);
      return Number.isFinite(n) && n > 0 ? Math.floor(n) : 0;
    });
    const align = computed(() => String(defaultsCustom.value.align ?? "auto"));
    const wrapHeaderText = computed(() => {
      if (defaultsCustom.value.wrapHeaderText) return true;
      const frame = frames.value[0];
      return (frame?.fields || []).some((f) => f?.config?.custom?.wrapHeaderText);
    });
    const filterable = computed(() => {
      if (defaultsCustom.value.filterable) return true;
      const frame = frames.value[0];
      return (frame?.fields || []).some(
        (f) => f?.config?.filterable === true || f?.config?.custom?.filterable === true
      );
    });
    const hideFromViz = computed(() => isHideFromVizCustom(defaultsCustom.value));
    const minColWidth = computed(() => {
      const n = Number(defaultsCustom.value.minWidth ?? defaultsCustom.value.width ?? 0);
      return Number.isFinite(n) && n > 0 ? n : void 0;
    });
    const page = ref(0);
    const filterQuery = ref("");
    const extraColumns = computed(() => {
      if (extraColumnsLocal.value) return extraColumnsLocal.value;
      const raw = opts.value.extraColumns;
      if (Array.isArray(raw)) return raw.map(String).filter(Boolean);
      if (typeof raw === "string" && raw.trim()) {
        return raw.split(/[,\s]+/).map((s) => s.trim()).filter(Boolean);
      }
      return [];
    });
    const logsCompatible = computed(() => {
      const frame = frames.value[0];
      if (!frame?.fields?.length) return false;
      const hasTime = frame.fields.some((f) => f.type === "time");
      const hasString = frame.fields.some((f) => f.type === "string");
      return hasTime && hasString;
    });
    const availableColumnNames = computed(() => {
      const frame = frames.value[0];
      if (!frame) return [];
      const names = /* @__PURE__ */ new Set();
      for (const f of frame.fields || []) {
        const n = String(f.name || "");
        if (!n || /time|Time/i.test(n)) continue;
        if (/line|message|msg|body|Log/i.test(n)) continue;
        if (/level|severity/i.test(n)) continue;
        names.add(n);
        const sample = f.values?.[0];
        if (sample && typeof sample === "object" && !Array.isArray(sample)) {
          Object.keys(sample).forEach((k) => names.add(k));
        }
      }
      names.add("service.name");
      names.add("traceId");
      return [...names].sort();
    });
    const baseRows = computed(() => {
      if (hideFromViz.value) return [];
      const list = frames.value;
      if (!list.length) return [];
      return parseLogRowsFromFrames(list, {
        prettifyLogMessage: prettifyLogMessage.value,
        sortOrder: "Descending"
      });
    });
    const rows = computed(() => {
      const q = filterable.value ? filterQuery.value.trim().toLowerCase() : "";
      if (!q) return baseRows.value;
      return baseRows.value.filter((r) => {
        const hay = [
          r.t,
          r.severityText,
          r.service,
          r.msg,
          r.raw,
          r.traceId,
          ...extraColumns.value.map((c) => getRowAttr(r, c))
        ].join("\n").toLowerCase();
        return hay.includes(q);
      });
    });
    const columnKeys = computed(() => {
      const keys = ["sev"];
      if (showTime.value) keys.push("time");
      keys.push("level", "service");
      for (const c of extraColumns.value) keys.push(`extra:${c}`);
      keys.push("body", "trace");
      if (showCopyLogLink.value) keys.push("act");
      return keys;
    });
    const COL_WIDTH = {
      sev: 14,
      time: 200,
      level: 110,
      service: 160,
      body: 280,
      trace: 190,
      act: 48
    };
    function colWidth(key) {
      const custom = fieldCustomFor(columnFieldName(key));
      const explicit = Number(custom.width);
      if (Number.isFinite(explicit) && explicit > 0) return explicit;
      const minW = Number(custom.minWidth);
      if (key.startsWith("extra:")) {
        if (Number.isFinite(minW) && minW > 0) return minW;
        return minColWidth.value ?? 120;
      }
      const base = COL_WIDTH[key] ?? minColWidth.value ?? 120;
      if (Number.isFinite(minW) && minW > 0) return Math.max(base, minW);
      return base;
    }
    const visibleColumnKeys = computed(() => columnKeys.value.filter((k) => !isColHidden(k)));
    const frozenLeftPx = computed(() => {
      const n = frozenLeft.value;
      const map = {};
      if (n <= 0) return map;
      let left = 0;
      visibleColumnKeys.value.forEach((key, idx) => {
        if (idx < n) {
          map[key] = left;
          left += colWidth(key);
        }
      });
      return map;
    });
    function frozenStyle(key) {
      if (!(key in frozenLeftPx.value)) return void 0;
      return {
        position: "sticky",
        left: `${frozenLeftPx.value[key]}px`,
        zIndex: key === "sev" ? "3" : "2"
      };
    }
    function isFrozen(key) {
      return key in frozenLeftPx.value;
    }
    function colCellStyle(key) {
      const style = { ...frozenStyle(key) ?? {} };
      const w = colWidth(key);
      if (key !== "sev") {
        style.width = `${w}px`;
        style.minWidth = `${w}px`;
      }
      const a = colAlign(key);
      if (a !== "auto") {
        style.textAlign = a;
      }
      return style;
    }
    const visibleExtraColumns = computed(
      () => extraColumns.value.filter((c) => !isColHidden(`extra:${c}`))
    );
    const tableViewport = ref(null);
    const scrollTop = ref(0);
    const viewportHeight = ref(400);
    const pagedRows = computed(() => {
      if (!enablePagination.value) return rows.value;
      const size = pageSize.value;
      const start = page.value * size;
      return rows.value.slice(start, start + size);
    });
    const pageCount = computed(() => {
      if (!enablePagination.value) return 1;
      return Math.max(1, Math.ceil(rows.value.length / pageSize.value));
    });
    const virtualWin = computed(
      () => computeVirtualWindow(
        pagedRows.value.length,
        scrollTop.value,
        viewportHeight.value,
        rowHeightPx.value,
        10
      )
    );
    const visibleRows = computed(() => sliceVirtualRows(pagedRows.value, virtualWin.value));
    function onTableScroll() {
      const el = tableViewport.value;
      if (!el) return;
      scrollTop.value = el.scrollTop;
      viewportHeight.value = el.clientHeight || 400;
    }
    let tableRo = null;
    onMounted(() => {
      onTableScroll();
      if (typeof ResizeObserver !== "undefined" && tableViewport.value) {
        tableRo = new ResizeObserver(() => onTableScroll());
        tableRo.observe(tableViewport.value);
      }
    });
    onBeforeUnmount(() => tableRo?.disconnect());
    const activeRow = computed(() => rows.value.find((r) => r.id === openId.value) ?? null);
    function toggleRow(row) {
      if (!enableLogDetails.value) return;
      openId.value = openId.value === row.id ? null : row.id;
    }
    function closeDetail() {
      openId.value = null;
    }
    async function copyRow(r) {
      try {
        await navigator.clipboard?.writeText(r.raw);
      } catch {
      }
    }
    function downloadCsv() {
      if (!allowDownload.value) return;
      const cols = [
        ...showTime.value ? ["timestamp"] : [],
        "severity",
        "service",
        ...extraColumns.value,
        "body",
        "traceId"
      ];
      const header = cols.join(",");
      const body = rows.value.map(
        (r) => cols.map((c) => {
          let v = "";
          if (c === "timestamp") v = r.t;
          else if (c === "severity") v = r.severityText;
          else if (c === "service") v = r.service;
          else if (c === "body") v = r.raw;
          else if (c === "traceId") v = r.traceId;
          else v = getRowAttr(r, c);
          return `"${String(v).replaceAll('"', '""')}"`;
        }).join(",")
      ).join("\n");
      const blob = new Blob([`${header}
${body}`], {
        type: "text/csv;charset=utf-8"
      });
      const url = URL.createObjectURL(blob);
      const a = document.createElement("a");
      a.href = url;
      a.download = "logs-table.csv";
      a.click();
      URL.revokeObjectURL(url);
    }
    function addColumn(name) {
      if (!name || extraColumns.value.includes(name)) return;
      extraColumnsLocal.value = [...extraColumns.value, name];
    }
    function removeColumn(name) {
      extraColumnsLocal.value = extraColumns.value.filter((c) => c !== name);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["logstable", {
          "logstable--wrap": wrapEffective.value,
          "logstable--prettify": prettifyLogMessage.value,
          "logstable--hidden-viz": hideFromViz.value,
          "logstable--filterable": filterable.value,
          "logstable--frozen": frozenLeft.value > 0
        }]),
        "data-testid": "panel-logstable",
        "data-show-controls": String(showControls.value),
        "data-enable-log-details": String(enableLogDetails.value),
        "data-allow-download": String(allowDownload.value),
        "data-show-copy": String(showCopyLogLink.value),
        "data-show-copy-log-link": String(showCopyLogLink.value),
        "data-logs-compatible": String(logsCompatible.value),
        "data-show-time": String(showTime.value),
        "data-wrap": String(wrapEffective.value),
        "data-prettify": String(prettifyLogMessage.value),
        "data-show-header": String(showHeader.value),
        "data-cell-height": cellHeight.value,
        "data-row-height": String(rowHeightPx.value),
        "data-max-row-height": maxRowHeight.value == null ? "" : String(maxRowHeight.value),
        "data-enable-pagination": String(enablePagination.value),
        "data-page-size": String(pageSize.value),
        "data-frozen-left": String(frozenLeft.value),
        "data-align": align.value,
        "data-wrap-header": String(wrapHeaderText.value),
        "data-min-col-width": minColWidth.value == null ? "" : String(minColWidth.value),
        "data-filterable": String(filterable.value),
        "data-hide-from-viz": String(hideFromViz.value),
        style: normalizeStyle({
          "--logstable-row-h": `${rowHeightPx.value}px`,
          "--logstable-max-row-h": maxRowHeight.value ? `${maxRowHeight.value}px` : void 0,
          "--logstable-min-col-w": minColWidth.value ? `${minColWidth.value}px` : void 0,
          "--logstable-align": align.value === "auto" ? void 0 : align.value
        })
      }, [
        !logsCompatible.value ? (openBlock(), createBlock(PanelDataErrorView, {
          key: 0,
          data: __props.data,
          "field-config": __props.fieldConfig,
          "needs-string-field": true,
          "needs-time-field": true
        }, null, 8, ["data", "field-config"])) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createCommentVNode(" Argus actions bar "),
            createElementVNode("div", _hoisted_2$27, [
              createElementVNode("div", _hoisted_3$1V, [
                createElementVNode(
                  "span",
                  _hoisted_4$1D,
                  toDisplayString(rows.value.length) + " 条日志",
                  1
                  /* TEXT */
                )
              ]),
              createElementVNode("div", _hoisted_5$1r, [
                createElementVNode("div", _hoisted_6$1e, [
                  createElementVNode(
                    "button",
                    {
                      type: "button",
                      class: normalizeClass(["le-options-btn", { active: optionsVisible.value }]),
                      "data-testid": "logstable-options",
                      onClick: _cache[0] || (_cache[0] = ($event) => optionsVisible.value = !optionsVisible.value)
                    },
                    " 选项 ",
                    2
                    /* CLASS */
                  ),
                  optionsVisible.value ? (openBlock(), createElementBlock("div", {
                    key: 0,
                    class: "le-opts-popper",
                    onClick: _cache[2] || (_cache[2] = withModifiers(() => {
                    }, ["stop"]))
                  }, [
                    _cache[8] || (_cache[8] = createElementVNode(
                      "div",
                      { class: "le-opts-label" },
                      "添加列",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode(
                      "select",
                      {
                        class: "le-select",
                        "data-testid": "logstable-add-column",
                        onChange: _cache[1] || (_cache[1] = ($event) => {
                          addColumn($event.target.value);
                          $event.target.value = "";
                        })
                      },
                      [
                        _cache[7] || (_cache[7] = createElementVNode(
                          "option",
                          { value: "" },
                          "选择字段…",
                          -1
                          /* CACHED */
                        )),
                        (openBlock(true), createElementBlock(
                          Fragment,
                          null,
                          renderList(availableColumnNames.value.filter((c) => !extraColumns.value.includes(c)), (n) => {
                            return openBlock(), createElementBlock("option", {
                              key: n,
                              value: n
                            }, toDisplayString(n), 9, _hoisted_7$14);
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ],
                      32
                      /* NEED_HYDRATION */
                    ),
                    extraColumns.value.length ? (openBlock(), createElementBlock("div", _hoisted_8$Y, [
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(extraColumns.value, (c) => {
                          return openBlock(), createElementBlock("span", {
                            key: c,
                            class: "chip",
                            onClick: ($event) => removeColumn(c)
                          }, toDisplayString(c) + " ×", 9, _hoisted_9$U);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ])) : createCommentVNode("v-if", true)
                  ])) : createCommentVNode("v-if", true)
                ])
              ])
            ]),
            hideFromViz.value ? (openBlock(), createElementBlock("div", _hoisted_10$L, " 已从可视化隐藏 ")) : filterable.value ? (openBlock(), createElementBlock("div", _hoisted_11$G, [
              withDirectives(createElementVNode(
                "input",
                {
                  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => filterQuery.value = $event),
                  type: "search",
                  class: "logstable-filter-input",
                  "data-testid": "logstable-filter-input",
                  placeholder: "过滤日志…",
                  "aria-label": "过滤日志"
                },
                null,
                512
                /* NEED_PATCH */
              ), [
                [vModelText, filterQuery.value]
              ]),
              createElementVNode(
                "span",
                _hoisted_12$A,
                toDisplayString(rows.value.length),
                1
                /* TEXT */
              )
            ])) : createCommentVNode("v-if", true),
            !hideFromViz.value ? (openBlock(), createElementBlock(
              "div",
              {
                key: 2,
                class: normalizeClass(["le-shell", { "with-controls": showControls.value }])
              },
              [
                showControls.value ? (openBlock(), createElementBlock("div", _hoisted_13$z, [
                  createElementVNode(
                    "button",
                    {
                      type: "button",
                      class: normalizeClass(["ctrl", { active: wrapEffective.value }]),
                      title: "换行",
                      onClick: _cache[4] || (_cache[4] = ($event) => wrapLocal.value = !wrapEffective.value)
                    },
                    " ↵ ",
                    2
                    /* CLASS */
                  ),
                  allowDownload.value ? (openBlock(), createElementBlock("button", {
                    key: 0,
                    type: "button",
                    class: "ctrl",
                    title: "下载",
                    "data-testid": "logstable-download",
                    onClick: downloadCsv
                  }, " ↓ ")) : createCommentVNode("v-if", true),
                  createElementVNode(
                    "span",
                    _hoisted_14$u,
                    toDisplayString(rows.value.length),
                    1
                    /* TEXT */
                  )
                ])) : createCommentVNode("v-if", true),
                createElementVNode("div", _hoisted_15$r, [
                  createElementVNode(
                    "div",
                    {
                      ref_key: "tableViewport",
                      ref: tableViewport,
                      class: "tableWrap",
                      "data-testid": "logstable-details",
                      onScrollPassive: onTableScroll
                    },
                    [
                      createElementVNode(
                        "div",
                        {
                          style: normalizeStyle({
                            height: `${virtualWin.value.totalHeight}px`,
                            position: "relative"
                          })
                        },
                        [
                          createElementVNode(
                            "table",
                            {
                              class: "table le-col-table",
                              style: normalizeStyle({
                                transform: `translateY(${virtualWin.value.offsetY}px)`
                              })
                            },
                            [
                              showHeader.value ? (openBlock(), createElementBlock(
                                "thead",
                                {
                                  key: 0,
                                  class: normalizeClass({ "thead--wrap": wrapHeaderText.value })
                                },
                                [
                                  createElementVNode("tr", null, [
                                    createElementVNode(
                                      "th",
                                      {
                                        class: normalizeClass(["sev", { "col-frozen": isFrozen("sev") }]),
                                        "data-col-key": "sev",
                                        style: normalizeStyle(colCellStyle("sev")),
                                        "aria-hidden": "true"
                                      },
                                      null,
                                      6
                                      /* CLASS, STYLE */
                                    ),
                                    showTime.value && !isColHidden("time") ? (openBlock(), createElementBlock("th", {
                                      key: 0,
                                      class: normalizeClass(["time", { "col-frozen": isFrozen("time") }]),
                                      "data-col-key": "time",
                                      "data-col-width": String(colWidth("time")),
                                      "data-col-align": colAlign("time"),
                                      style: normalizeStyle(colCellStyle("time"))
                                    }, " 时间 ", 14, _hoisted_16$p)) : createCommentVNode("v-if", true),
                                    !isColHidden("level") ? (openBlock(), createElementBlock("th", {
                                      key: 1,
                                      class: normalizeClass(["level", { "col-frozen": isFrozen("level") }]),
                                      "data-col-key": "level",
                                      "data-col-width": String(colWidth("level")),
                                      "data-col-align": colAlign("level"),
                                      style: normalizeStyle(colCellStyle("level"))
                                    }, " 级别 ", 14, _hoisted_17$n)) : createCommentVNode("v-if", true),
                                    !isColHidden("service") ? (openBlock(), createElementBlock("th", {
                                      key: 2,
                                      class: normalizeClass(["service", { "col-frozen": isFrozen("service") }]),
                                      "data-col-key": "service",
                                      "data-col-width": String(colWidth("service")),
                                      "data-col-align": colAlign("service"),
                                      style: normalizeStyle(colCellStyle("service"))
                                    }, " 服务 ", 14, _hoisted_18$n)) : createCommentVNode("v-if", true),
                                    (openBlock(true), createElementBlock(
                                      Fragment,
                                      null,
                                      renderList(visibleExtraColumns.value, (col2) => {
                                        return openBlock(), createElementBlock("th", {
                                          key: col2,
                                          class: normalizeClass(["extra", { "col-frozen": isFrozen(`extra:${col2}`) }]),
                                          "data-col-key": `extra:${col2}`,
                                          "data-col-width": String(colWidth(`extra:${col2}`)),
                                          "data-col-align": colAlign(`extra:${col2}`),
                                          style: normalizeStyle(colCellStyle(`extra:${col2}`))
                                        }, toDisplayString(col2), 15, _hoisted_19$m);
                                      }),
                                      128
                                      /* KEYED_FRAGMENT */
                                    )),
                                    !isColHidden("body") ? (openBlock(), createElementBlock("th", {
                                      key: 3,
                                      class: normalizeClass(["body", { "col-frozen": isFrozen("body") }]),
                                      "data-col-key": "body",
                                      "data-col-width": String(colWidth("body")),
                                      "data-col-align": colAlign("body"),
                                      style: normalizeStyle(colCellStyle("body"))
                                    }, " 内容 ", 14, _hoisted_20$k)) : createCommentVNode("v-if", true),
                                    !isColHidden("trace") ? (openBlock(), createElementBlock("th", {
                                      key: 4,
                                      class: normalizeClass(["trace", { "col-frozen": isFrozen("trace") }]),
                                      "data-col-key": "trace",
                                      "data-col-width": String(colWidth("trace")),
                                      "data-col-align": colAlign("trace"),
                                      style: normalizeStyle(colCellStyle("trace"))
                                    }, " Trace ID ", 14, _hoisted_21$d)) : createCommentVNode("v-if", true),
                                    showCopyLogLink.value ? (openBlock(), createElementBlock(
                                      "th",
                                      {
                                        key: 5,
                                        class: normalizeClass(["act", { "col-frozen": isFrozen("act") }]),
                                        "data-col-key": "act",
                                        style: normalizeStyle(colCellStyle("act"))
                                      },
                                      null,
                                      6
                                      /* CLASS, STYLE */
                                    )) : createCommentVNode("v-if", true)
                                  ])
                                ],
                                2
                                /* CLASS */
                              )) : createCommentVNode("v-if", true),
                              createElementVNode("tbody", null, [
                                (openBlock(true), createElementBlock(
                                  Fragment,
                                  null,
                                  renderList(visibleRows.value, (r) => {
                                    return openBlock(), createElementBlock("tr", {
                                      key: r.id,
                                      class: normalizeClass(["row", { "is-active": openId.value === r.id }]),
                                      "data-testid": "logstable-row",
                                      "data-open": openId.value === r.id ? "true" : "false",
                                      "data-level": r.level,
                                      onClick: ($event) => toggleRow(r)
                                    }, [
                                      createElementVNode(
                                        "td",
                                        {
                                          class: normalizeClass(["sev", { "col-frozen": isFrozen("sev") }]),
                                          "data-col-key": "sev",
                                          style: normalizeStyle(colCellStyle("sev"))
                                        },
                                        [
                                          createElementVNode(
                                            "span",
                                            {
                                              class: "le-sev-bar",
                                              style: normalizeStyle({ background: unref(severityColor)(r.level) })
                                            },
                                            null,
                                            4
                                            /* STYLE */
                                          )
                                        ],
                                        6
                                        /* CLASS, STYLE */
                                      ),
                                      showTime.value && !isColHidden("time") ? (openBlock(), createElementBlock("td", {
                                        key: 0,
                                        class: normalizeClass(["time", { "col-frozen": isFrozen("time") }]),
                                        "data-col-key": "time",
                                        "data-col-width": String(colWidth("time")),
                                        "data-col-align": colAlign("time"),
                                        style: normalizeStyle(colCellStyle("time"))
                                      }, [
                                        createElementVNode(
                                          "span",
                                          _hoisted_24$7,
                                          toDisplayString(r.t),
                                          1
                                          /* TEXT */
                                        )
                                      ], 14, _hoisted_23$7)) : createCommentVNode("v-if", true),
                                      !isColHidden("level") ? (openBlock(), createElementBlock("td", {
                                        key: 1,
                                        class: normalizeClass(["level", { "col-frozen": isFrozen("level") }]),
                                        "data-col-key": "level",
                                        "data-col-width": String(colWidth("level")),
                                        "data-col-align": colAlign("level"),
                                        style: normalizeStyle(colCellStyle("level"))
                                      }, [
                                        createElementVNode(
                                          "span",
                                          {
                                            class: "le-lvl",
                                            style: normalizeStyle(unref(severityBadgeStyle)(r.level))
                                          },
                                          toDisplayString(r.severityText),
                                          5
                                          /* TEXT, STYLE */
                                        )
                                      ], 14, _hoisted_25$5)) : createCommentVNode("v-if", true),
                                      !isColHidden("service") ? (openBlock(), createElementBlock("td", {
                                        key: 2,
                                        class: normalizeClass(["service", { "col-frozen": isFrozen("service") }]),
                                        "data-col-key": "service",
                                        "data-col-width": String(colWidth("service")),
                                        "data-col-align": colAlign("service"),
                                        style: normalizeStyle(colCellStyle("service"))
                                      }, toDisplayString(r.service || "—"), 15, _hoisted_26$5)) : createCommentVNode("v-if", true),
                                      (openBlock(true), createElementBlock(
                                        Fragment,
                                        null,
                                        renderList(visibleExtraColumns.value, (col2) => {
                                          return openBlock(), createElementBlock("td", {
                                            key: col2,
                                            class: normalizeClass(["extra", { "col-frozen": isFrozen(`extra:${col2}`) }]),
                                            "data-col-key": `extra:${col2}`,
                                            "data-col-width": String(colWidth(`extra:${col2}`)),
                                            "data-col-align": colAlign(`extra:${col2}`),
                                            style: normalizeStyle(colCellStyle(`extra:${col2}`))
                                          }, [
                                            createElementVNode(
                                              "span",
                                              _hoisted_28$4,
                                              toDisplayString(unref(getRowAttr)(r, col2) || "—"),
                                              1
                                              /* TEXT */
                                            )
                                          ], 14, _hoisted_27$4);
                                        }),
                                        128
                                        /* KEYED_FRAGMENT */
                                      )),
                                      !isColHidden("body") ? (openBlock(), createElementBlock("td", {
                                        key: 3,
                                        class: normalizeClass(["body", { "col-frozen": isFrozen("body") }]),
                                        "data-col-key": "body",
                                        "data-col-width": String(colWidth("body")),
                                        "data-col-align": colAlign("body"),
                                        style: normalizeStyle(colCellStyle("body"))
                                      }, [
                                        createElementVNode(
                                          "span",
                                          _hoisted_30$4,
                                          toDisplayString(r.msg),
                                          1
                                          /* TEXT */
                                        )
                                      ], 14, _hoisted_29$4)) : createCommentVNode("v-if", true),
                                      !isColHidden("trace") ? (openBlock(), createElementBlock("td", {
                                        key: 4,
                                        class: normalizeClass(["trace", { "col-frozen": isFrozen("trace") }]),
                                        "data-col-key": "trace",
                                        "data-col-width": String(colWidth("trace")),
                                        "data-col-align": colAlign("trace"),
                                        style: normalizeStyle(colCellStyle("trace"))
                                      }, [
                                        createElementVNode(
                                          "span",
                                          _hoisted_32$4,
                                          toDisplayString(r.traceId || "—"),
                                          1
                                          /* TEXT */
                                        )
                                      ], 14, _hoisted_31$4)) : createCommentVNode("v-if", true),
                                      showCopyLogLink.value ? (openBlock(), createElementBlock(
                                        "td",
                                        {
                                          key: 5,
                                          class: normalizeClass(["act", { "col-frozen": isFrozen("act") }]),
                                          "data-col-key": "act",
                                          style: normalizeStyle(colCellStyle("act"))
                                        },
                                        [
                                          createElementVNode("button", {
                                            type: "button",
                                            "data-testid": "logstable-copy",
                                            title: "复制",
                                            onClick: withModifiers(($event) => copyRow(r), ["stop"])
                                          }, " 复制 ", 8, _hoisted_33$4)
                                        ],
                                        6
                                        /* CLASS, STYLE */
                                      )) : createCommentVNode("v-if", true)
                                    ], 10, _hoisted_22$a);
                                  }),
                                  128
                                  /* KEYED_FRAGMENT */
                                ))
                              ])
                            ],
                            4
                            /* STYLE */
                          )
                        ],
                        4
                        /* STYLE */
                      ),
                      !rows.value.length ? (openBlock(), createElementBlock("div", _hoisted_34$4, "无日志数据")) : createCommentVNode("v-if", true)
                    ],
                    544
                    /* NEED_HYDRATION, NEED_PATCH */
                  )
                ])
              ],
              2
              /* CLASS */
            )) : createCommentVNode("v-if", true),
            !hideFromViz.value && enablePagination.value && pageCount.value > 1 ? (openBlock(), createElementBlock("div", {
              key: 3,
              class: "logstable-pagination",
              "data-testid": "logstable-pagination",
              "data-page": String(page.value),
              "data-page-count": String(pageCount.value)
            }, [
              createElementVNode("button", {
                type: "button",
                disabled: page.value <= 0,
                onClick: _cache[5] || (_cache[5] = ($event) => page.value = Math.max(0, page.value - 1))
              }, " 上一页 ", 8, _hoisted_36$2),
              createElementVNode(
                "span",
                null,
                toDisplayString(page.value + 1) + " / " + toDisplayString(pageCount.value),
                1
                /* TEXT */
              ),
              createElementVNode("button", {
                type: "button",
                disabled: page.value >= pageCount.value - 1,
                onClick: _cache[6] || (_cache[6] = ($event) => page.value = Math.min(pageCount.value - 1, page.value + 1))
              }, " 下一页 ", 8, _hoisted_37$2)
            ], 8, _hoisted_35$3)) : createCommentVNode("v-if", true),
            !hideFromViz.value && enableLogDetails.value ? (openBlock(), createBlock(ArgusLogDetail, {
              key: 4,
              open: !!activeRow.value,
              row: activeRow.value,
              onClose: closeDetail
            }, null, 8, ["open", "row"])) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ], 14, _hoisted_1$2E);
    };
  }
});
const LogsTableRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3q, [["__scopeId", "data-v-8bac7044"]]);
const _hoisted_1$2D = ["data-frames", "data-log-format", "data-raw-max-lines", "data-row-count", "data-dedup", "data-wrap", "data-sort", "data-show-controls", "data-show-time", "data-show-labels", "data-show-common", "data-prettify", "data-details", "data-details-mode", "data-infinite-scroll", "data-label-filter", "data-visible-count", "data-show-level", "data-syntax-highlighting", "data-allow-download", "data-show-field-selector", "data-show-log-attributes", "data-copy-link", "data-font-size", "data-timestamp-resolution", "data-unwrapped-columns"];
const _hoisted_2$26 = { class: "le-actions-bar" };
const _hoisted_3$1U = { class: "le-ab-label" };
const _hoisted_4$1C = ["data-field-count", "data-selected"];
const _hoisted_5$1q = ["data-testid", "data-selected"];
const _hoisted_6$1d = ["checked", "onChange"];
const _hoisted_7$13 = {
  key: 0,
  class: "lfs-empty"
};
const _hoisted_8$X = {
  key: 1,
  class: "navContainer",
  "data-testid": "logs-controls"
};
const _hoisted_9$T = {
  key: 0,
  class: "level-wrap",
  "data-testid": "logs-level-wrap"
};
const _hoisted_10$K = {
  key: 0,
  class: "level-menu"
};
const _hoisted_11$F = ["onClick"];
const _hoisted_12$z = { class: "meta" };
const _hoisted_13$y = { class: "main" };
const _hoisted_14$t = {
  key: 0,
  class: "commonLabels",
  "data-testid": "logs-common-labels"
};
const _hoisted_15$q = {
  key: 1,
  class: "frameBar"
};
const _hoisted_16$o = ["value"];
const _hoisted_17$m = {
  key: 2,
  class: "searchBar"
};
const _hoisted_18$m = {
  key: 3,
  class: "labelVolume",
  "data-testid": "logs-label-volume"
};
const _hoisted_19$l = ["onClick"];
const _hoisted_20$j = { class: "vol-label" };
const _hoisted_21$c = { class: "vol-count" };
const _hoisted_22$9 = ["data-loaded-count"];
const _sfc_main$3p = /* @__PURE__ */ defineComponent({
  __name: "LogsRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {},
    replaceVariables: { type: Function },
    width: {},
    height: {}
  },
  setup(__props) {
    const props = __props;
    const openId = ref(null);
    const search = ref("");
    const searchVisible = ref(false);
    const levelFilter = ref("all");
    const labelFilter = ref("");
    const frameIndex = ref(0);
    const levelMenuOpen = ref(false);
    const rowsEl = ref(null);
    const wrapLocal = ref(null);
    const extraColumnsLocal = ref(null);
    const opts = computed(() => props.options ?? {});
    const frames = computed(() => props.data?.series ?? []);
    function normalizeColumns(raw) {
      if (Array.isArray(raw)) return raw.map(String).filter(Boolean);
      if (typeof raw === "string" && raw.trim()) {
        return raw.split(/[,\s]+/).map((s) => s.trim()).filter(Boolean);
      }
      return [];
    }
    const extraColumns = computed(() => {
      if (extraColumnsLocal.value) return extraColumnsLocal.value;
      const fromExtra = normalizeColumns(opts.value.extraColumns);
      if (fromExtra.length) return fromExtra;
      return normalizeColumns(opts.value.unwrappedColumns);
    });
    const parseOpts = computed(() => ({
      timestampResolution: String(opts.value.timestampResolution ?? "ms"),
      prettifyLogMessage: !!opts.value.prettifyLogMessage,
      enableInfiniteScrolling: !!opts.value.enableInfiniteScrolling,
      dedupStrategy: String(opts.value.dedupStrategy ?? "none"),
      sortOrder: String(opts.value.sortOrder ?? "Descending")
    }));
    const hasActiveFilters = computed(
      () => levelFilter.value !== "all" || Boolean(labelFilter.value) || Boolean(search.value.trim())
    );
    const needsFullMaterialize = computed(
      () => hasActiveFilters.value || !!opts.value.showCommonLabels || !!opts.value.showLabels || String(opts.value.dedupStrategy ?? "none") !== "none" || !!opts.value.prettifyLogMessage || // unwrappedColumns / extraColumns need full field bags (lazy path omits them)
      !!(Array.isArray(opts.value.unwrappedColumns) && opts.value.unwrappedColumns.length || typeof opts.value.unwrappedColumns === "string" && String(opts.value.unwrappedColumns).trim() || Array.isArray(opts.value.extraColumns) && opts.value.extraColumns.length || typeof opts.value.extraColumns === "string" && String(opts.value.extraColumns).trim()) || !!opts.value.showFieldSelector
    );
    const lazySource = computed(() => createLazyLogSource(frames.value, parseOpts.value));
    const allRows = computed(() => {
      const list = frames.value;
      if (!list.length) return [];
      if (!needsFullMaterialize.value) {
        return [];
      }
      return parseLogRowsFromFrames(list, parseOpts.value);
    });
    const getLazyRow = (index2) => lazySource.value.getRow(index2);
    const commonLabels = computed(() => {
      if (!opts.value.showCommonLabels) return "";
      const all = needsFullMaterialize.value ? allRows.value : lazySource.value.materializeAll();
      if (!all.length) return "";
      const sets = all.map((r) => {
        const m = /* @__PURE__ */ new Map();
        String(r.labels || "").split(",").map((s) => s.trim()).filter(Boolean).forEach((pair) => {
          const [k, ...rest] = pair.split("=");
          if (k) m.set(k.trim(), rest.join("=").trim());
        });
        return m;
      });
      const first = sets[0];
      const shared2 = [];
      for (const [k, v] of first) {
        if (sets.every((s) => s.get(k) === v)) shared2.push(`${k}=${v}`);
      }
      return shared2.join(", ");
    });
    const labelVolumes = computed(() => {
      if (!opts.value.showLabels) return [];
      const map = /* @__PURE__ */ new Map();
      const all = needsFullMaterialize.value ? allRows.value : lazySource.value.materializeAll();
      for (const r of all) {
        const parts = r.labels ? r.labels.split(/[,;\s]+/).filter(Boolean) : [r.level];
        for (const p of parts) map.set(p, (map.get(p) ?? 0) + 1);
      }
      return [...map.entries()].sort((a, b) => b[1] - a[1]).slice(0, 20).map(([label, count]) => ({ label, count }));
    });
    const rows = computed(() => {
      if (!needsFullMaterialize.value) return [];
      let list = allRows.value;
      if (levelFilter.value !== "all") {
        const lf = levelFilter.value === "warn" ? "warning" : levelFilter.value;
        list = list.filter((r) => r.level === lf || lf === "warning" && r.level === "warn");
      }
      if (labelFilter.value) {
        const lf = labelFilter.value.toLowerCase();
        list = list.filter(
          (r) => r.labels.toLowerCase().includes(lf) || r.level.toLowerCase() === lf || r.msg.toLowerCase().includes(lf)
        );
      }
      const q = search.value.trim().toLowerCase();
      if (q) {
        list = list.filter(
          (r) => r.msg.toLowerCase().includes(q) || r.labels.toLowerCase().includes(q) || r.level.includes(q) || r.service.toLowerCase().includes(q)
        );
      }
      return list;
    });
    const rowCount = computed(() => {
      if (!frames.value.length) return 0;
      if (!needsFullMaterialize.value) return lazySource.value.length;
      return rows.value.length;
    });
    const useLazyRows = computed(() => !needsFullMaterialize.value && lazySource.value.length > 0);
    const showControls = computed(() => opts.value.showControls === true);
    const wrapOn = computed(() => !!opts.value.wrapLogMessage);
    const wrapEffective = computed(() => wrapLocal.value === null ? wrapOn.value : wrapLocal.value);
    const levels = ["all", "critical", "error", "warning", "info", "debug", "trace"];
    function requestLogsLoadMore(direction = "older") {
      if (!opts.value.enableInfiniteScrolling) return;
      try {
        window.dispatchEvent(
          new CustomEvent("grafana-vue:logs-load-more", {
            detail: {
              direction,
              source: "logs",
              loadedCount: rowCount.value,
              enableInfiniteScrolling: true
            }
          })
        );
      } catch {
      }
    }
    function toggleRow(row) {
      if (opts.value.enableLogDetails === false) return;
      openId.value = openId.value === row.id ? null : row.id;
    }
    function copyLink(r) {
      try {
        void navigator.clipboard?.writeText(`${r.t} ${r.level} ${r.raw}`);
      } catch {
      }
    }
    function download() {
      if (!opts.value.allowDownload) return;
      const list = useLazyRows.value ? lazySource.value.materializeAll() : rows.value;
      const text = list.map((r) => `${r.t}	${r.level}	${r.labels}	${r.raw}`).join("\n");
      const blob = new Blob([text], { type: "text/plain;charset=utf-8" });
      const url = URL.createObjectURL(blob);
      const a = document.createElement("a");
      a.href = url;
      a.download = "logs.txt";
      a.click();
      URL.revokeObjectURL(url);
    }
    function scrollTop() {
      rowsEl.value?.scrollTo({ top: 0 });
    }
    function scrollBottom() {
      const el = rowsEl.value;
      if (el) el.scrollTo({ top: el.scrollHeight });
    }
    function toggleSearch() {
      searchVisible.value = !searchVisible.value;
      if (searchVisible.value) {
        nextTick(() => {
          document.querySelector('[data-testid="logs-search"]')?.focus();
        });
      } else {
        search.value = "";
      }
    }
    function setLevel(lv) {
      levelFilter.value = lv;
      levelMenuOpen.value = false;
    }
    function escapeHtml(s) {
      return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
    }
    function highlightMsg(msg) {
      let s = escapeHtml(msg);
      if (opts.value.syntaxHighlighting !== false) {
        s = s.replaceAll(/\b(-?\d+(?:\.\d+)?)\b/g, '<span class="log-tok-num">$1</span>');
        s = s.replaceAll(
          /(&quot;|")([^"&]+)(&quot;|")(\s*:)/g,
          '<span class="log-tok-key">$1$2$3</span>$4'
        );
        s = s.replaceAll(/(&quot;|")([^"&]*)(&quot;|")/g, '<span class="log-tok-str">$1$2$3</span>');
        s = s.replaceAll(
          /(?<![\w-])(error|warn(?:ing)?|critical|info|debug|trace|fatal)(?![\w-])/gi,
          '<span class="log-tok-level">$1</span>'
        );
      }
      const q = search.value.trim();
      if (q) {
        const re = new RegExp(`(${q.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi");
        s = s.replace(re, '<mark class="log-search-match">$1</mark>');
      }
      return s;
    }
    function detailEntries(r) {
      const entries = [
        { key: "Time", value: r.t || "—" },
        { key: "level", value: r.level }
      ];
      if (r.service) entries.push({ key: "service.name", value: r.service });
      if (r.traceId) entries.push({ key: "traceId", value: r.traceId });
      if (r.labels) {
        for (const part of r.labels.split(",").map((s) => s.trim()).filter(Boolean)) {
          const eq = part.indexOf("=");
          if (eq > 0) entries.push({ key: part.slice(0, eq), value: part.slice(eq + 1) });
          else entries.push({ key: "label", value: part });
        }
      }
      for (const col2 of extraColumns.value) {
        const v = getRowAttr(r, col2);
        if (v) entries.push({ key: col2, value: v });
      }
      entries.push({ key: "Line", value: r.msg });
      return entries;
    }
    watch(showControls, (v) => {
      if (v) searchVisible.value = true;
    });
    if (showControls.value) searchVisible.value = true;
    const showFieldSelector = computed(() => opts.value.showFieldSelector === true);
    const availableFields = computed(() => {
      const keys = /* @__PURE__ */ new Set();
      const n = Math.min(Number(rowCount.value) || 0, 40);
      for (let i = 0; i < n; i++) {
        let row;
        try {
          row = useLazyRows.value ? getLazyRow(i) : allRows.value[i] ?? rows.value[i];
        } catch {
          row = void 0;
        }
        if (!row) continue;
        for (const k of Object.keys(row.fields ?? {})) keys.add(k);
        for (const k of Object.keys(row.attributes ?? {})) keys.add(k);
        for (const k of Object.keys(row.resources ?? {})) keys.add(k);
        if (row.service) keys.add("service");
        if (row.traceId) keys.add("traceId");
        if (row.level) keys.add("level");
      }
      for (const frame of frames.value) {
        for (const f of frame?.fields ?? []) {
          const name = String(f?.name ?? "");
          if (!name) continue;
          const t2 = String(f?.type ?? "");
          if (t2 === "time") continue;
          if (/^(line|body|message|Content|msg)$/i.test(name)) continue;
          keys.add(name);
        }
      }
      return [...keys].sort((a, b) => a.localeCompare(b));
    });
    function toggleFieldColumn(key) {
      const cur = [...extraColumns.value];
      const idx = cur.indexOf(key);
      if (idx >= 0) cur.splice(idx, 1);
      else cur.push(key);
      extraColumnsLocal.value = cur;
    }
    function isFieldSelected(key) {
      return extraColumns.value.includes(key);
    }
    function onKeydownEscape(ev) {
      if (ev.key !== "Escape") return;
      if (openId.value != null) {
        openId.value = null;
        ev.stopPropagation();
      }
    }
    onMounted(() => window.addEventListener("keydown", onKeydownEscape));
    onBeforeUnmount(() => window.removeEventListener("keydown", onKeydownEscape));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "logs",
        "data-testid": "panel-logs",
        "data-frames": String(frames.value.length),
        "data-log-format": String(opts.value.logFormat || "list"),
        "data-raw-max-lines": String(opts.value.rawMaxLines ?? 1),
        "data-row-count": String(rowCount.value),
        "data-dedup": String(opts.value.dedupStrategy ?? "none"),
        "data-wrap": String(!!wrapEffective.value),
        "data-sort": String(opts.value.sortOrder ?? "Descending"),
        "data-show-controls": String(!!showControls.value),
        "data-show-time": String(!!opts.value.showTime),
        "data-show-labels": String(!!opts.value.showLabels),
        "data-show-common": String(!!opts.value.showCommonLabels),
        "data-prettify": String(!!opts.value.prettifyLogMessage),
        "data-details": String(opts.value.enableLogDetails !== false),
        "data-details-mode": String(opts.value.detailsMode ?? "inline"),
        "data-infinite-scroll": String(!!opts.value.enableInfiniteScrolling),
        "data-label-filter": labelFilter.value,
        "data-visible-count": String(rowCount.value),
        "data-show-level": String(opts.value.showLevel !== false),
        "data-syntax-highlighting": String(opts.value.syntaxHighlighting !== false),
        "data-allow-download": String(!!opts.value.allowDownload),
        "data-show-field-selector": String(showFieldSelector.value),
        "data-show-log-attributes": String(opts.value.showLogAttributes !== false),
        "data-copy-link": String(!!opts.value.showCopyLogLink),
        "data-font-size": String(opts.value.fontSize ?? "default"),
        "data-timestamp-resolution": String(opts.value.timestampResolution ?? "ms"),
        "data-unwrapped-columns": String(opts.value.unwrappedColumns ?? "")
      }, [
        createElementVNode("div", _hoisted_2$26, [
          createElementVNode(
            "span",
            _hoisted_3$1U,
            toDisplayString(rows.value.length) + " 条日志",
            1
            /* TEXT */
          )
        ]),
        createElementVNode(
          "div",
          {
            class: normalizeClass(["le-shell", {
              "with-controls": showControls.value,
              "with-field-selector": showFieldSelector.value && rowCount.value > 0
            }])
          },
          [
            showFieldSelector.value && rowCount.value > 0 ? (openBlock(), createElementBlock("aside", {
              key: 0,
              class: "logs-field-selector",
              "data-testid": "logs-field-selector",
              "data-field-count": String(availableFields.value.length),
              "data-selected": extraColumns.value.join(",")
            }, [
              _cache[7] || (_cache[7] = createElementVNode(
                "div",
                { class: "lfs-title" },
                "字段",
                -1
                /* CACHED */
              )),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(availableFields.value, (key) => {
                  return openBlock(), createElementBlock("label", {
                    key,
                    class: "lfs-item",
                    "data-testid": `logs-field-${key}`,
                    "data-selected": String(isFieldSelected(key))
                  }, [
                    createElementVNode("input", {
                      type: "checkbox",
                      checked: isFieldSelected(key),
                      onChange: ($event) => toggleFieldColumn(key)
                    }, null, 40, _hoisted_6$1d),
                    createElementVNode(
                      "span",
                      null,
                      toDisplayString(key),
                      1
                      /* TEXT */
                    )
                  ], 8, _hoisted_5$1q);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              !availableFields.value.length ? (openBlock(), createElementBlock("div", _hoisted_7$13, "无可选字段")) : createCommentVNode("v-if", true)
            ], 8, _hoisted_4$1C)) : createCommentVNode("v-if", true),
            showControls.value ? (openBlock(), createElementBlock("div", _hoisted_8$X, [
              createElementVNode(
                "button",
                {
                  type: "button",
                  class: normalizeClass(["ctrl", { active: wrapEffective.value }]),
                  title: "换行",
                  onClick: _cache[0] || (_cache[0] = ($event) => wrapLocal.value = !wrapEffective.value)
                },
                " ↵ ",
                2
                /* CLASS */
              ),
              createElementVNode("button", {
                type: "button",
                class: "ctrl",
                title: "搜索",
                onClick: toggleSearch
              }, "⌕"),
              opts.value.showLevel !== false ? (openBlock(), createElementBlock("div", _hoisted_9$T, [
                createElementVNode("button", {
                  type: "button",
                  class: "ctrl",
                  title: "级别",
                  "data-testid": "logs-level-filter",
                  onClick: _cache[1] || (_cache[1] = ($event) => levelMenuOpen.value = !levelMenuOpen.value)
                }, " ≡ "),
                levelMenuOpen.value ? (openBlock(), createElementBlock("div", _hoisted_10$K, [
                  (openBlock(), createElementBlock(
                    Fragment,
                    null,
                    renderList(levels, (lv) => {
                      return createElementVNode("button", {
                        key: lv,
                        type: "button",
                        class: normalizeClass({ active: levelFilter.value === lv }),
                        onClick: ($event) => setLevel(lv)
                      }, toDisplayString(lv), 11, _hoisted_11$F);
                    }),
                    64
                    /* STABLE_FRAGMENT */
                  ))
                ])) : createCommentVNode("v-if", true)
              ])) : createCommentVNode("v-if", true),
              opts.value.allowDownload ? (openBlock(), createElementBlock("button", {
                key: 1,
                type: "button",
                class: "ctrl",
                title: "下载",
                "data-testid": "logs-download",
                onClick: download
              }, " ↓ ")) : createCommentVNode("v-if", true),
              createElementVNode("button", {
                type: "button",
                class: "ctrl",
                title: "顶部",
                "data-testid": "scrollToTop",
                onClick: scrollTop
              }, " ↑ "),
              createElementVNode("button", {
                type: "button",
                class: "ctrl",
                title: "底部",
                onClick: scrollBottom
              }, "↓"),
              createElementVNode(
                "span",
                _hoisted_12$z,
                toDisplayString(rows.value.length),
                1
                /* TEXT */
              )
            ])) : createCommentVNode("v-if", true),
            createElementVNode("div", _hoisted_13$y, [
              opts.value.showCommonLabels && commonLabels.value ? (openBlock(), createElementBlock(
                "div",
                _hoisted_14$t,
                toDisplayString(commonLabels.value),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true),
              frames.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_15$q, [
                withDirectives(createElementVNode(
                  "select",
                  {
                    "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => frameIndex.value = $event),
                    "data-testid": "logs-frame-select"
                  },
                  [
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(frames.value, (_, i) => {
                        return openBlock(), createElementBlock("option", {
                          key: i,
                          value: i
                        }, "序列 " + toDisplayString(i + 1), 9, _hoisted_16$o);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ],
                  512
                  /* NEED_PATCH */
                ), [
                  [
                    vModelSelect,
                    frameIndex.value,
                    void 0,
                    { number: true }
                  ]
                ])
              ])) : createCommentVNode("v-if", true),
              showControls.value || searchVisible.value ? (openBlock(), createElementBlock("div", _hoisted_17$m, [
                withDirectives(createElementVNode(
                  "input",
                  {
                    "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => search.value = $event),
                    type: "search",
                    placeholder: "搜索日志…",
                    "data-testid": "logs-search"
                  },
                  null,
                  512
                  /* NEED_PATCH */
                ), [
                  [vModelText, search.value]
                ])
              ])) : createCommentVNode("v-if", true),
              opts.value.showLabels && labelVolumes.value.length ? (openBlock(), createElementBlock("aside", _hoisted_18$m, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(labelVolumes.value, (v) => {
                    return openBlock(), createElementBlock("div", {
                      key: v.label,
                      class: "vol",
                      onClick: ($event) => labelFilter.value = labelFilter.value === v.label ? "" : v.label
                    }, [
                      createElementVNode(
                        "span",
                        _hoisted_20$j,
                        toDisplayString(v.label),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "span",
                        _hoisted_21$c,
                        toDisplayString(v.count),
                        1
                        /* TEXT */
                      )
                    ], 8, _hoisted_19$l);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])) : createCommentVNode("v-if", true),
              createCommentVNode(" TABLE / LIST / RAW "),
              rowCount.value && String(opts.value.logFormat || "list") === "table" ? (openBlock(), createBlock(LogsTableRenderer, {
                key: 4,
                data: __props.data,
                options: opts.value,
                "field-config": __props.fieldConfig,
                "replace-variables": __props.replaceVariables,
                width: __props.width,
                height: __props.height
              }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"])) : rowCount.value && String(opts.value.logFormat || "list") === "raw" ? (openBlock(), createBlock(LogsRawRenderer, {
                key: 5,
                rows: useLazyRows.value ? void 0 : rows.value,
                "row-count": useLazyRows.value ? rowCount.value : void 0,
                "get-row": useLazyRows.value ? getLazyRow : void 0,
                options: opts.value
              }, null, 8, ["rows", "row-count", "get-row", "options"])) : rowCount.value ? (openBlock(), createBlock(LogsListRenderer, {
                key: 6,
                ref: "listRef",
                rows: useLazyRows.value ? void 0 : rows.value,
                "row-count": useLazyRows.value ? rowCount.value : void 0,
                "get-row": useLazyRows.value ? getLazyRow : void 0,
                options: opts.value,
                "open-id": openId.value,
                wrap: wrapEffective.value,
                "extra-columns": extraColumns.value,
                "highlight-msg": highlightMsg,
                "detail-entries": detailEntries,
                onToggle: toggleRow,
                onCopy: copyLink
              }, null, 8, ["rows", "row-count", "get-row", "options", "open-id", "wrap", "extra-columns"])) : (openBlock(), createBlock(PanelDataErrorView, {
                key: 7,
                data: __props.data,
                "needs-string-field": true,
                "needs-time-field": true
              }, null, 8, ["data"])),
              rowCount.value && opts.value.enableInfiniteScrolling ? (openBlock(), createElementBlock("div", {
                key: 8,
                class: "le-footer",
                "data-testid": "logs-infinite-footer",
                "data-loaded-count": String(rowCount.value),
                role: "button",
                tabindex: "0",
                onClick: _cache[5] || (_cache[5] = ($event) => requestLogsLoadMore("older")),
                onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => requestLogsLoadMore("older"), ["prevent"]), ["enter"]))
              }, [
                createTextVNode(
                  " 已加载 " + toDisplayString(rowCount.value) + " 条 ",
                  1
                  /* TEXT */
                ),
                createElementVNode("button", {
                  type: "button",
                  class: "le-footer-more",
                  "data-testid": "logs-load-more",
                  onClick: _cache[4] || (_cache[4] = withModifiers(($event) => requestLogsLoadMore("older"), ["stop"]))
                }, " 加载更多 "),
                _cache[8] || (_cache[8] = createElementVNode(
                  "span",
                  { class: "le-footer-hint" },
                  "滚动或点击加载更早日志",
                  -1
                  /* CACHED */
                ))
              ], 40, _hoisted_22$9)) : createCommentVNode("v-if", true)
            ])
          ],
          2
          /* CLASS */
        )
      ], 8, _hoisted_1$2D);
    };
  }
});
const LogsRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3p, [["__scopeId", "data-v-c650aa92"]]);
const _sfc_main$3o = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(LogsRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  { id: "logs", name: "日志", state: "stable", skipDataQuery: false },
  _sfc_main$3o
).setPanelOptions((builder) => {
  const cat = ["日志"];
  builder.addBoolean(
    {
      id: "showTime",
      path: "showTime",
      name: "时间",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showLabels",
      path: "showLabels",
      name: "唯一标签",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showCommonLabels",
      path: "showCommonLabels",
      name: "公共标签",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "wrapLogMessage",
      path: "wrapLogMessage",
      name: "自动换行",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "prettifyLogMessage",
      path: "prettifyLogMessage",
      name: "美化 JSON",
      category: cat,
      editor: "boolean",
      // Grafana: only with wrap enabled, default true
      showIf: (c) => !!c.wrapLogMessage
    },
    true
  ).addBoolean(
    {
      id: "enableLogDetails",
      path: "enableLogDetails",
      name: "启用日志详情",
      category: cat,
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "enableInfiniteScrolling",
      path: "enableInfiniteScrolling",
      name: "无限滚动",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showControls",
      path: "showControls",
      name: "显示控件",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showLevel",
      path: "showLevel",
      name: "显示日志级别",
      category: cat,
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "syntaxHighlighting",
      path: "syntaxHighlighting",
      name: "语法高亮",
      category: cat,
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "allowDownload",
      path: "allowDownload",
      name: "允许下载",
      category: cat,
      editor: "boolean",
      // Grafana: only when controls enabled
      showIf: (c) => !!c.showControls
    },
    false
  ).addBoolean(
    {
      id: "showFieldSelector",
      path: "showFieldSelector",
      name: "显示字段选择器",
      category: cat,
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showLogAttributes",
      path: "showLogAttributes",
      name: "显示日志属性",
      category: cat,
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "showCopyLogLink",
      path: "showCopyLogLink",
      name: "显示复制链接",
      category: cat,
      editor: "boolean"
    },
    false
  ).addRadio(
    {
      id: "sortOrder",
      path: "sortOrder",
      name: "顺序",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "最新在前", value: "Descending" },
          { label: "最旧在前", value: "Ascending" }
        ]
      }
    },
    "Descending"
  ).addRadio(
    {
      id: "dedupStrategy",
      path: "dedupStrategy",
      name: "去重",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "精确", value: "exact" },
          { label: "数字", value: "numbers" },
          { label: "签名", value: "signature" }
        ]
      }
    },
    "none"
  ).addRadio(
    {
      id: "detailsMode",
      path: "detailsMode",
      name: "详情模式",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "内联", value: "inline" },
          { label: "侧栏", value: "sidebar" }
        ]
      },
      showIf: (c) => !!c.enableLogDetails
    },
    "inline"
  ).addRadio(
    {
      id: "fontSize",
      path: "fontSize",
      name: "字号",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "默认", value: "default" },
          { label: "小", value: "small" }
        ]
      }
    },
    "default"
  ).addRadio(
    {
      id: "timestampResolution",
      path: "timestampResolution",
      name: "时间戳精度",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "毫秒", value: "ms" },
          { label: "纳秒", value: "ns" },
          { label: "微秒", value: "us" }
        ]
      },
      showIf: (c) => !!c.showTime
    },
    "ms"
  ).addBoolean(
    {
      id: "unwrappedColumns",
      path: "unwrappedColumns",
      name: "展开列",
      category: cat,
      editor: "boolean",
      // Grafana: only when wrap disabled
      showIf: (c) => c.wrapLogMessage === false
    },
    false
  ).addRadio(
    {
      id: "logFormat",
      path: "logFormat",
      name: "日志格式",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "原始", value: "raw" },
          { label: "列表", value: "list" },
          { label: "列", value: "table" }
        ]
      }
    },
    "list"
  ).addNumber(
    {
      id: "rawMaxLines",
      path: "rawMaxLines",
      name: "原始最大行数",
      category: cat,
      editor: "number",
      showIf: (c) => c.logFormat === "raw"
    },
    1
  ).addText(
    {
      id: "extraColumns",
      path: "extraColumns",
      name: "额外列",
      category: cat,
      editor: "text",
      showIf: (c) => c.logFormat !== "raw"
    },
    ""
  );
}).setRuntimeConsumedPaths([
  "showTime",
  "showLabels",
  "showCommonLabels",
  "wrapLogMessage",
  "prettifyLogMessage",
  "enableLogDetails",
  "enableInfiniteScrolling",
  "showControls",
  "showLevel",
  "syntaxHighlighting",
  "allowDownload",
  "showFieldSelector",
  "showLogAttributes",
  "showCopyLogLink",
  "sortOrder",
  "dedupStrategy",
  "detailsMode",
  "fontSize",
  "timestampResolution",
  "unwrappedColumns",
  "extraColumns",
  "logFormat",
  "rawMaxLines"
]).register();
const _sfc_main$3n = /* @__PURE__ */ defineComponent({
  __name: "LogsTableRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {},
    replaceVariables: { type: Function },
    width: {},
    height: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(LogsTableRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
const _sfc_main$3m = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(_sfc_main$3n, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "logstable",
    name: "日志表格",
    description: "表格形态日志",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$3m
).useFieldConfig({
  useCustomConfig: (builder) => {
    const cat = ["单元格选项"];
    builder.addCustom({
      id: "custom.align",
      path: "custom.align",
      name: "对齐",
      category: cat,
      editor: "radio",
      isCustom: true,
      override: true,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "左", value: "left" },
          { label: "中", value: "center" },
          { label: "右", value: "right" }
        ]
      },
      defaultValue: "auto"
    }).addCustom({
      id: "custom.wrapText",
      path: "custom.wrapText",
      name: "自动换行",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.wrapHeaderText",
      path: "custom.wrapHeaderText",
      name: "表头换行",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.filterable",
      path: "custom.filterable",
      name: "可过滤",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    }).addCustom({
      id: "custom.minWidth",
      path: "custom.minWidth",
      name: "最小宽度",
      category: cat,
      editor: "number",
      isCustom: true,
      override: true,
      defaultValue: 150
    }).addCustom({
      id: "custom.width",
      path: "custom.width",
      name: "列宽",
      category: cat,
      editor: "number",
      isCustom: true,
      override: true
    }).addCustom({
      id: "custom.hideFrom.viz",
      path: "custom.hideFrom.viz",
      name: "从可视化隐藏",
      category: cat,
      editor: "boolean",
      isCustom: true,
      override: true,
      defaultValue: false
    });
  }
}).setPanelOptions((builder) => {
  const tableCat = ["表格"];
  const cat = ["日志表格"];
  builder.addBoolean(
    {
      id: "showHeader",
      path: "showHeader",
      name: "显示表头",
      category: tableCat
    },
    true
  ).addNumber(
    {
      id: "frozenColumns.left",
      path: "frozenColumns.left",
      name: "冻结左侧列数",
      category: tableCat,
      settings: { min: 0, max: 10 }
    },
    0
  ).addRadio(
    {
      id: "cellHeight",
      path: "cellHeight",
      name: "行高",
      category: tableCat,
      settings: {
        options: [
          { label: "小", value: "sm" },
          { label: "中", value: "md" },
          { label: "大", value: "lg" }
        ]
      }
    },
    "sm"
  ).addNumber(
    {
      id: "maxRowHeight",
      path: "maxRowHeight",
      name: "最大行高",
      category: tableCat,
      settings: { min: 0 }
    },
    void 0
  ).addBoolean(
    {
      id: "enablePagination",
      path: "enablePagination",
      name: "启用分页",
      category: tableCat
    },
    false
  ).addBoolean(
    {
      id: "enableLogDetails",
      path: "enableLogDetails",
      name: "启用日志详情",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showCopyLogLink",
      path: "showCopyLogLink",
      name: "显示复制链接按钮",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showControls",
      path: "showControls",
      name: "显示控件",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "allowDownload",
      path: "allowDownload",
      name: "显示下载控件",
      category: cat,
      showIf: (c) => !!c.showControls
    },
    false
  ).addBoolean(
    {
      id: "showTime",
      path: "showTime",
      name: "显示时间",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "wrapLogMessage",
      path: "wrapLogMessage",
      name: "换行日志",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "prettifyLogMessage",
      path: "prettifyLogMessage",
      name: "美化 JSON 日志",
      category: cat
    },
    false
  ).addText(
    {
      id: "extraColumns",
      path: "extraColumns",
      name: "额外列",
      category: cat
    },
    ""
  );
}).setRuntimeConsumedPaths([
  "showHeader",
  "frozenColumns.left",
  "cellHeight",
  "maxRowHeight",
  "enablePagination",
  "allowDownload",
  "enableLogDetails",
  "showControls",
  "showCopyLogLink",
  "showTime",
  "wrapLogMessage",
  "prettifyLogMessage",
  "extraColumns",
  "custom.align",
  "custom.wrapText",
  "custom.wrapHeaderText",
  "custom.filterable",
  "custom.minWidth",
  "custom.width",
  "custom.hideFrom.viz"
]).register();
const UPLOT_AXIS_FONT_SIZE$1 = 12;
let _measureCtx$1 = null;
function measureAxisText$1(text, fontSize = UPLOT_AXIS_FONT_SIZE$1) {
  if (typeof document === "undefined") return Math.ceil(String(text).length * fontSize * 0.6);
  if (!_measureCtx$1) {
    _measureCtx$1 = document.createElement("canvas").getContext("2d");
  }
  if (!_measureCtx$1) return Math.ceil(String(text).length * fontSize * 0.6);
  _measureCtx$1.font = `400 ${fontSize}px Inter`;
  return _measureCtx$1.measureText(String(text ?? "")).width;
}
function pad2$2(n) {
  return n.toString().padStart(2, "0");
}
function resolveAxisTimezone(raw) {
  let v = raw;
  if (Array.isArray(v)) v = v.find((x) => x != null && String(x).trim()) ?? "browser";
  const s = String(v ?? "browser").trim();
  if (!s || s.toLowerCase() === "browser" || s.toLowerCase() === "default") {
    return "browser";
  }
  if (s.toLowerCase() === "utc" || s.toUpperCase() === "GMT") return "utc";
  if (s.includes(",")) {
    return resolveAxisTimezone(s.split(",")[0]);
  }
  return s;
}
function partsInZone(ms, tz) {
  const d = new Date(ms);
  const zone = resolveAxisTimezone(tz);
  if (zone === "utc") {
    return {
      Y: d.getUTCFullYear(),
      M: d.getUTCMonth() + 1,
      D: d.getUTCDate(),
      h: d.getUTCHours(),
      m: d.getUTCMinutes(),
      s: d.getUTCSeconds()
    };
  }
  if (zone === "browser") {
    return {
      Y: d.getFullYear(),
      M: d.getMonth() + 1,
      D: d.getDate(),
      h: d.getHours(),
      m: d.getMinutes(),
      s: d.getSeconds()
    };
  }
  try {
    const fmt = new Intl.DateTimeFormat("en-US", {
      timeZone: zone,
      year: "numeric",
      month: "2-digit",
      day: "2-digit",
      hour: "2-digit",
      minute: "2-digit",
      second: "2-digit",
      hourCycle: "h23"
    });
    const bag = {};
    for (const p of fmt.formatToParts(d)) {
      if (p.type !== "literal") bag[p.type] = p.value;
    }
    return {
      Y: Number(bag.year),
      M: Number(bag.month),
      D: Number(bag.day),
      h: Number(bag.hour),
      m: Number(bag.minute),
      s: Number(bag.second)
    };
  } catch {
    return partsInZone(ms, "browser");
  }
}
function formatTime(v, tz, spanMs) {
  const { Y, M, D, h: h2, m, s } = partsInZone(v, tz ?? "browser");
  const span = spanMs ?? 0;
  if (span > 0 && span <= 5 * 6e4) {
    return `${pad2$2(h2)}:${pad2$2(m)}:${pad2$2(s)}`;
  }
  if (span > 7 * 24 * 60 * 6e4) {
    return `${Y}-${pad2$2(M)}-${pad2$2(D)}`;
  }
  if (span > 24 * 60 * 6e4) {
    return `${pad2$2(M)}-${pad2$2(D)} ${pad2$2(h2)}:${pad2$2(m)}`;
  }
  return `${pad2$2(h2)}:${pad2$2(m)}`;
}
function formatAxisNumber(v) {
  if (!Number.isFinite(v)) return "";
  const abs = Math.abs(v);
  if (abs >= 1e9) return `${Number((v / 1e9).toFixed(abs >= 1e10 ? 0 : 1))}G`;
  if (abs >= 1e6) return `${Number((v / 1e6).toFixed(abs >= 1e7 ? 0 : 1))}M`;
  if (abs >= 1e4) return `${Number((v / 1e3).toFixed(abs >= 1e5 ? 0 : 1))}k`;
  if (Number.isInteger(v) || Math.abs(v - Math.round(v)) < 1e-9) return String(Math.round(v));
  if (abs >= 100) return String(Number(v.toFixed(1)));
  if (abs >= 1) return String(Number(v.toFixed(2)));
  if (abs >= 0.01) return String(Number(v.toFixed(3)));
  return String(Number(v.toPrecision(2)));
}
function formatAxisValue(v, opts) {
  if (!Number.isFinite(v)) return "";
  const unit = opts?.unit;
  const decimals = opts?.decimals;
  if (unit && unit !== "none") {
    try {
      const out = getValueFormat(unit)(v, decimals);
      return `${out.text}${out.suffix || ""}`;
    } catch {
    }
  }
  if (decimals != null && Number.isFinite(decimals)) {
    return Number(v).toFixed(Math.max(0, Math.min(10, Math.floor(decimals))));
  }
  return formatAxisNumber(v);
}
function estimateLabelWidth(text, isTime) {
  const len = Math.max(text.length, 5);
  return Math.ceil(len * 7.2 + 10);
}
const Y_TICK_SPACING_PANEL_HEIGHT = 150;
const Y_TICK_SPACING_NORMAL = 30;
const Y_TICK_SPACING_SMALL = 15;
const X_TICK_SPACING_NORMAL = 40;
const X_TICK_VALUE_GAP = 18;
function adaptiveAxisSpace(plotPx, axis, isTime, spanMs = 0) {
  if (axis === "y") {
    return plotPx <= Y_TICK_SPACING_PANEL_HEIGHT ? Y_TICK_SPACING_SMALL : Y_TICK_SPACING_NORMAL;
  }
  let sample = "00:00";
  if (isTime) {
    if (spanMs > 0 && spanMs <= 5 * 6e4) sample = "00:00:00";
    else if (spanMs > 7 * 24 * 60 * 6e4) sample = "2020-01-01";
    else if (spanMs > 24 * 60 * 6e4) sample = "01-01 00:00";
    else sample = "00:00";
  } else {
    sample = "0.000";
  }
  const valueWidth = measureAxisText$1(sample, UPLOT_AXIS_FONT_SIZE$1);
  return Math.max(X_TICK_SPACING_NORMAL, Math.ceil(valueWidth + X_TICK_VALUE_GAP));
}
function formatSplitsAdaptive(u, splits, scaleKey, format) {
  if (!splits.length) return [];
  const isX = scaleKey === "x";
  const out = splits.map(() => "");
  const up = u;
  const pos = splits.map((v) => isX ? up.valToPos(v, "x") : up.valToPos(v, "y"));
  let lastPlaced = -1;
  for (const [i, split] of splits.entries()) {
    const label = format(split);
    if (!label) continue;
    const need = isX ? estimateLabelWidth(label) * 0.92 : 16;
    if (lastPlaced < 0 || Math.abs(pos[i] - pos[lastPlaced]) >= need) {
      out[i] = label;
      lastPlaced = i;
    }
  }
  const last = splits.length - 1;
  if (last > 0 && !out[last]) {
    const label = format(splits[last]);
    let prev = -1;
    for (let i = last - 1; i >= 0; i--) {
      if (out[i]) {
        prev = i;
        break;
      }
    }
    const need = isX ? estimateLabelWidth(label) * 0.7 : 14;
    if (prev < 0 || Math.abs(pos[last] - pos[prev]) >= need) out[last] = label;
  }
  return out;
}
function pickNearestHoverSeries(series, cursorTop) {
  const withVal = series.filter((s) => s.value != null && Number.isFinite(s.value));
  if (!withVal.length) return series.filter((s) => s.value != null).slice(0, 1);
  let best = withVal[0];
  let bestDist = Infinity;
  for (const sp of withVal) {
    const y = sp.yPos;
    if (y == null || !Number.isFinite(y)) continue;
    const d = Math.abs(y - cursorTop);
    if (d < bestDist) {
      bestDist = d;
      best = sp;
    }
  }
  return [
    {
      index: best.index,
      label: best.label,
      value: best.value,
      color: best.color
    }
  ];
}
function filterHoverZeros(series, hideZeros) {
  if (!hideZeros) return series;
  return series.filter((s) => {
    const v = s.value;
    if (v == null || !Number.isFinite(Number(v))) return false;
    return Number(v) !== 0;
  });
}
function isNaNNumber(v) {
  return typeof v === "number" && Number.isNaN(v);
}
function toYCell(v) {
  if (v === void 0) return void 0;
  if (v === null || isNaNNumber(v)) return null;
  if (typeof v === "number" && Number.isFinite(v)) return v;
  return null;
}
function isPreAlignedSeries(series) {
  if (series.length === 0) return false;
  if (series.some((s) => s.constantY != null)) return false;
  const n = series[0].points?.length ?? 0;
  if (n === 0) return false;
  for (let si = 1; si < series.length; si++) {
    if ((series[si].points?.length ?? 0) !== n) return false;
  }
  const base = series[0].points;
  for (let i = 1; i < n; i++) {
    if (base[i].x <= base[i - 1].x) return false;
  }
  for (let si = 1; si < series.length; si++) {
    const pts = series[si].points;
    for (let i = 0; i < n; i++) {
      if (pts[i].x !== base[i].x) return false;
    }
  }
  return true;
}
function toAlignedSeriesData(series) {
  const visible = series.filter((s) => !s.hidden);
  if (!visible.length) return [[0], [0]];
  if (isPreAlignedSeries(visible)) {
    const base = visible[0].points;
    const xs2 = new Array(base.length);
    for (let i = 0; i < base.length; i++) xs2[i] = base[i].x;
    const ys2 = visible.map((s) => {
      const row = new Array(base.length);
      const pts = s.points;
      for (let i = 0; i < base.length; i++) {
        row[i] = toYCell(pts[i].y);
      }
      return row;
    });
    return [xs2, ...ys2];
  }
  const xSet = /* @__PURE__ */ new Set();
  for (const s of visible) {
    if (s.constantY != null) continue;
    for (const p of s.points) {
      if (p.x != null) xSet.add(p.x);
    }
  }
  if (xSet.size === 0) {
    const hasConst = visible.some((s) => s.constantY != null);
    if (hasConst) {
      const xs2 = [0];
      const ys2 = visible.map(
        (s) => s.constantY != null ? [s.constantY] : [null]
      );
      return [xs2, ...ys2];
    }
    return [[0], [0]];
  }
  const xs = Array.from(xSet);
  xs.sort((a, b) => a - b);
  const xIndex = /* @__PURE__ */ new Map();
  for (let i = 0; i < xs.length; i++) xIndex.set(xs[i], i);
  const ys = visible.map((s) => {
    if (s.constantY != null) {
      const row2 = new Array(xs.length);
      const c = s.constantY;
      for (let i = 0; i < xs.length; i++) row2[i] = c;
      return row2;
    }
    const missing = s.spanNulls === true ? void 0 : null;
    const row = new Array(xs.length);
    for (let i = 0; i < xs.length; i++) row[i] = missing;
    for (const p of s.points) {
      if (p.x == null) continue;
      const idx = xIndex.get(p.x);
      if (idx == null) continue;
      row[idx] = toYCell(p.y);
    }
    return row;
  });
  return [xs, ...ys];
}
function getUPlotPalette() {
  return getClassicPalette$1(resolveThemeModeHint());
}
getClassicPalette$1("dark");
const UPLOT_AXIS_FONT_SIZE = 12;
const UPLOT_AXIS_FONT = `${UPLOT_AXIS_FONT_SIZE}px Inter`;
let _measureCtx = null;
function measureAxisText(text, fontSize = UPLOT_AXIS_FONT_SIZE) {
  if (typeof document === "undefined") return Math.ceil(String(text).length * fontSize * 0.6);
  if (!_measureCtx) {
    _measureCtx = document.createElement("canvas").getContext("2d");
  }
  if (!_measureCtx) return Math.ceil(String(text).length * fontSize * 0.6);
  _measureCtx.font = `400 ${fontSize}px Inter`;
  return _measureCtx.measureText(String(text ?? "")).width;
}
function calculateAxisSize(self, values, side) {
  const ticksSize = 4;
  const gap = 5;
  const labelGap = 0;
  let axisSize = ticksSize;
  if (side === 2) {
    axisSize += gap + UPLOT_AXIS_FONT_SIZE;
  } else {
    const labels = (values || []).map((v) => v == null ? "" : String(v)).filter((v) => v.length > 0 && v.length < 24);
    let maxTextWidth = 12;
    if (labels.length) {
      maxTextWidth = labels.reduce((acc, value) => Math.max(acc, measureAxisText(value)), 0);
    }
    const textWidthWithLimit = Math.min((self?.width ?? 100) * 0.4, maxTextWidth);
    axisSize += gap + labelGap + textWidthWithLimit;
  }
  return Math.ceil(axisSize);
}
function isDarkTheme() {
  if (typeof document === "undefined") return true;
  const root = document.documentElement;
  const t2 = root.dataset.theme || root.dataset.grafanaTheme || root.dataset.theme || document.body?.dataset?.theme || "";
  if (String(t2).toLowerCase() === "light") return false;
  if (String(t2).toLowerCase() === "dark") return true;
  try {
    const bg = getComputedStyle(root).getPropertyValue("--grafana-bg") || getComputedStyle(document.body).backgroundColor;
    const m = String(bg).match(/rgba?\((\d+)/);
    if (m && Number(m[1]) > 200) return false;
  } catch {
  }
  return true;
}
function uplotGridColor(dark) {
  return dark ? "rgba(240, 250, 255, 0.09)" : "rgba(0, 10, 23, 0.09)";
}
function uplotAxisStroke(dark) {
  return dark ? "rgb(204, 204, 220)" : "rgb(36, 41, 46)";
}
function grafanaPaddingSide(_u, side, sidesWithAxes) {
  const hasCrossAxis = side % 2 ? sidesWithAxes[0] || sidesWithAxes[2] : sidesWithAxes[1] || sidesWithAxes[3];
  return sidesWithAxes[side] || !hasCrossAxis ? 0 : 8;
}
function readNum(v) {
  if (v == null || v === "") return void 0;
  const n = Number(unref(v));
  return Number.isFinite(n) ? n : void 0;
}
function readStr(v, fallback = "") {
  const x = unref(v);
  return x == null ? fallback : String(x);
}
function dashFor(style) {
  if (!style) return void 0;
  if (typeof style === "object") {
    if (style.dash?.length) return style.dash;
    return dashFor(style.fill);
  }
  if (style === "dash") return [10, 10];
  if (style === "dot" || style === "dots") return [0, 10];
  return void 0;
}
function hexAlpha(color, alpha2) {
  if (typeof color !== "string" || !color)
    return `rgba(115,191,105,${Math.max(0, Math.min(1, alpha2))})`;
  if (color.startsWith("rgba") || color.startsWith("rgb")) return color;
  const a = Math.max(0, Math.min(1, alpha2));
  if (color.startsWith("#") && (color.length === 7 || color.length === 4)) {
    let r, g, b;
    if (color.length === 4) {
      r = Number.parseInt(color[1] + color[1], 16);
      g = Number.parseInt(color[2] + color[2], 16);
      b = Number.parseInt(color[3] + color[3], 16);
    } else {
      r = Number.parseInt(color.slice(1, 3), 16);
      g = Number.parseInt(color.slice(3, 5), 16);
      b = Number.parseInt(color.slice(5, 7), 16);
    }
    return `rgba(${r},${g},${b},${a})`;
  }
  return color;
}
function squarePointPaths(u, seriesIdx, idx0, idx1, filtIdxs) {
  const s = u.series[seriesIdx];
  const size = s.points?.size ?? 6;
  const half = size / 2;
  const xdata = u.data[0];
  const ydata = u.data[seriesIdx];
  const ctx = u.ctx;
  const allow = filtIdxs ? new Set(filtIdxs) : null;
  ctx.save();
  ctx.fillStyle = String(
    s.points?.fill ?? s.stroke ?? (isDarkTheme() ? "rgb(204, 204, 220)" : "rgb(17, 18, 23)")
  );
  ctx.strokeStyle = String(
    s.points?.stroke ?? s.stroke ?? (isDarkTheme() ? "rgb(204, 204, 220)" : "rgb(17, 18, 23)")
  );
  ctx.lineWidth = Number(s.points?.width ?? 1);
  for (let i = idx0; i <= idx1; i++) {
    if (allow && !allow.has(i)) continue;
    const y = ydata[i];
    if (y == null || !Number.isFinite(y)) continue;
    const x = u.valToPos(xdata[i], "x", true);
    const yy = u.valToPos(y, s.scale, true);
    ctx.fillRect(x - half, yy - half, size, size);
    if (ctx.lineWidth > 0) ctx.strokeRect(x - half, yy - half, size, size);
  }
  ctx.restore();
  return {
    stroke: null,
    fill: null,
    clip: null,
    band: null,
    gaps: null,
    flags: 0
  };
}
function pathsFor(interp, mode2, barWidthFactor, barBucketSize, barAlignment) {
  const paths = uPlot.paths;
  if (mode2 === "bars") {
    if (barBucketSize != null && Number.isFinite(barBucketSize) && barBucketSize > 0) {
      const bs = barBucketSize;
      return paths.bars?.({
        align: 1,
        disp: {
          x0: {
            unit: 1,
            values: (u) => u.data[0]
          },
          size: {
            unit: 1,
            values: () => [bs]
          }
        }
      });
    }
    const size = Math.max(0.05, Math.min(1, barWidthFactor));
    const opts = { size: [size, 1e6] };
    if (barAlignment != null && Number.isFinite(barAlignment)) {
      opts.align = barAlignment;
    } else if (size >= 0.99) {
      opts.align = 1;
    }
    return paths.bars?.(opts);
  }
  if (mode2 === "points") return void 0;
  if (interp === "smooth") return paths.spline?.();
  if (interp === "stepBefore") return paths.stepped?.({ align: -1 });
  if (interp === "stepAfter") return paths.stepped?.({ align: 1 });
  return void 0;
}
function createThresholdsDrawHook(thresholds, thresholdsMode, percent) {
  if (!thresholds.length || !thresholdsMode || thresholdsMode === "off") return null;
  const wantLine = thresholdsMode === "line" || thresholdsMode === "dashed" || thresholdsMode === "line+area" || thresholdsMode === "dashed+area";
  const wantArea = thresholdsMode === "area" || thresholdsMode === "line+area" || thresholdsMode === "dashed+area";
  const dashed = thresholdsMode === "dashed" || thresholdsMode === "dashed+area";
  return (u) => {
    const ctx = u.ctx;
    const { left, top, width: w, height: h2 } = u.bbox;
    const yMin = u.scales.y.min ?? 0;
    const yMax = u.scales.y.max ?? 1;
    const sorted = [...thresholds].filter((th) => Number.isFinite(th.value)).map(
      (th) => percent ? { ...th, value: yMin + (yMax - yMin) * Number(th.value) / 100 } : th
    ).sort((a, b) => a.value - b.value);
    if (!sorted.length) return;
    ctx.save();
    if (wantArea) {
      for (let i = 0; i < sorted.length; i++) {
        const th = sorted[i];
        const yTop = i + 1 < sorted.length ? u.valToPos(sorted[i + 1].value, "y", true) : top;
        const yBot = u.valToPos(th.value, "y", true);
        const y0 = Math.min(yTop, yBot);
        const y1 = Math.max(yTop, yBot);
        if (y1 < top || y0 > top + h2) continue;
        const color = th.color || classicOrange();
        ctx.fillStyle = hexAlpha(color, 0.12);
        const cy0 = Math.max(y0, top);
        const cy1 = Math.min(y1, top + h2);
        if (cy1 > cy0) ctx.fillRect(left, cy0, w, cy1 - cy0);
      }
    }
    if (wantLine) {
      for (const th of sorted) {
        const y = u.valToPos(th.value, "y", true);
        if (y < top || y > top + h2) continue;
        ctx.strokeStyle = th.color || classicOrange();
        ctx.lineWidth = 1.5;
        ctx.globalAlpha = 0.85;
        ctx.setLineDash(dashed ? [6, 4] : []);
        ctx.beginPath();
        ctx.moveTo(left, y);
        ctx.lineTo(left + w, y);
        ctx.stroke();
        ctx.setLineDash([]);
        ctx.globalAlpha = 1;
        if (th.label) {
          ctx.fillStyle = th.color || classicOrange();
          ctx.font = "10px sans-serif";
          ctx.fillText(th.label, left + 4, y - 3);
        }
      }
    }
    ctx.restore();
  };
}
const UPLOT_MIN_ZOOM_DIST = 5;
function resolveUPlotSelectRange(u, minDist = UPLOT_MIN_ZOOM_DIST) {
  const sel = u?.select;
  if (!sel) return null;
  const drag = u?.cursor?.drag ?? {};
  const xDrag = drag.x !== false;
  const yDrag = drag.y === true;
  const isXAxisHorizontal = (u?.scales?.x?.ori ?? 0) === 0;
  let from;
  let to;
  let minY;
  let maxY;
  if (xDrag && Number(sel.width) >= minDist) {
    from = isXAxisHorizontal ? u.posToVal(sel.left, "x") : u.posToVal(sel.top + sel.height, "x");
    to = isXAxisHorizontal ? u.posToVal(sel.left + sel.width, "x") : u.posToVal(sel.top, "x");
  }
  if (yDrag && Number(sel.height) >= minDist) {
    maxY = isXAxisHorizontal ? u.posToVal(sel.top, "y") : u.posToVal(sel.left + sel.width, "y");
    minY = isXAxisHorizontal ? u.posToVal(sel.top + sel.height, "y") : u.posToVal(sel.left, "y");
  }
  const hasX = from != null && to != null && Number.isFinite(from) && Number.isFinite(to) && from !== to;
  const hasY = minY != null && maxY != null && Number.isFinite(minY) && Number.isFinite(maxY) && minY !== maxY;
  if (!hasX && !hasY) return null;
  const mode2 = hasX && hasY ? "xy" : hasX ? "x" : "y";
  const rangeFrom = hasX ? Math.min(from, to) : Number(u.scales?.x?.min ?? 0);
  const rangeTo = hasX ? Math.max(from, to) : Number(u.scales?.x?.max ?? 0);
  return {
    from: rangeFrom,
    to: rangeTo,
    ...hasY ? {
      minY: Math.min(minY, maxY),
      maxY: Math.max(minY, maxY)
    } : {},
    mode: mode2
  };
}
function applyUPlotSelectHook(u, onSelect, minDist = UPLOT_MIN_ZOOM_DIST) {
  let range = null;
  try {
    range = resolveUPlotSelectRange(u, minDist);
    if (range) onSelect(range);
  } finally {
    try {
      u.setSelect?.({ left: 0, width: 0, top: 0, height: 0 }, false);
    } catch {
    }
  }
  return range;
}
function resolvePointsShow(drawStyle, showPoints) {
  if (drawStyle === "points") return true;
  if (showPoints === "always") return true;
  if (showPoints === "never" || drawStyle === "bars") return false;
  return void 0;
}
function resolvePointSize(pointSize, lineWidth) {
  if (!pointSize || pointSize < lineWidth) return void 0;
  return pointSize;
}
function buildPointOptionOverrides(options) {
  const result = {};
  if (options.show !== void 0) result.show = options.show;
  if (options.size !== void 0) result.size = options.size;
  if (options.space !== void 0) result.space = options.space;
  if (options.paths !== void 0) result.paths = options.paths;
  return result;
}
function getPointValueLabelPosition(x, y, pointSize, pixelRatio = 1, value = 0) {
  const isNegative = value < 0;
  const radiusPad = Math.max(pointSize / 2 + 4, 5);
  const offset = isNegative ? radiusPad : -radiusPad;
  return {
    x,
    y: y + offset * pixelRatio,
    textAlign: "center",
    textBaseline: isNegative ? "top" : "bottom"
  };
}
function shouldShowSeriesValues(drawStyle, pointsVisible, plotWidth, pointCount) {
  if (pointsVisible) return true;
  return drawStyle === "bars" && pointCount > 0 && plotWidth / pointCount >= 30;
}
const NO_UPDATE_OPS = {
  rebuild: false,
  setData: false,
  setSize: false,
  setScale: false,
  setSeries: false
};
function planUPlotUpdate(hasChart, prev, next) {
  if (!hasChart || !prev) {
    return {
      rebuild: true,
      setData: false,
      setSize: false,
      setScale: false,
      setSeries: false
    };
  }
  if (next.themeToken !== prev.themeToken || next.schemaSig !== prev.schemaSig || next.styleSig !== prev.styleSig) {
    return {
      rebuild: true,
      setData: false,
      setSize: false,
      setScale: false,
      setSeries: false
    };
  }
  const ops = { ...NO_UPDATE_OPS };
  if (next.visibilitySig !== prev.visibilitySig) {
    ops.setSeries = true;
  }
  if (next.sizeW !== prev.sizeW || next.sizeH !== prev.sizeH) {
    ops.setSize = true;
  }
  if (next.xMin !== prev.xMin || next.xMax !== prev.xMax) {
    ops.setScale = true;
  }
  if (next.dataRevision !== prev.dataRevision) {
    ops.setData = true;
  }
  return ops;
}
function mergeUPlotOps(a, b) {
  if (a.rebuild || b.rebuild) {
    return {
      rebuild: true,
      setData: false,
      setSize: false,
      setScale: false,
      setSeries: false
    };
  }
  return {
    rebuild: false,
    setData: a.setData || b.setData,
    setSize: a.setSize || b.setSize,
    setScale: a.setScale || b.setScale,
    setSeries: a.setSeries || b.setSeries
  };
}
function hasAnyUPlotOps(ops) {
  return ops.rebuild || ops.setData || ops.setSize || ops.setScale || ops.setSeries;
}
function uplotSeriesSchemaSig(seriesList) {
  return seriesList.map((s) => {
    const style = [
      s.color ?? "",
      JSON.stringify(s.lineStyle ?? ""),
      s.drawStyle ?? "",
      s.showPoints ?? "",
      s.pointSize ?? "",
      s.lineWidth ?? "",
      s.fillOpacity ?? "",
      s.lineInterpolation ?? "",
      String(s.spanNulls ?? ""),
      String(s.showValues ?? ""),
      s.barAlignment ?? "",
      s.barWidthFactor ?? "",
      s.gradientMode ?? "",
      s.scaleKey ?? "",
      s.constantY != null ? "c" : "p"
    ].join(",");
    return `${s.label ?? ""}:${style}`;
  }).join("|");
}
function uplotSeriesVisibilitySig(seriesList) {
  return seriesList.map((s) => `${s.label ?? ""}:${s.hidden ? 0 : 1}`).join("|");
}
function toRgbCss(color) {
  if (!color) return "rgb(115,191,105)";
  if (color.startsWith("rgb")) return color;
  if (color.startsWith("#")) {
    const c = color.length === 4 ? `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}` : color.slice(0, 7);
    const r = Number.parseInt(c.slice(1, 3), 16);
    const g = Number.parseInt(c.slice(3, 5), 16);
    const b = Number.parseInt(c.slice(5, 7), 16);
    return `rgb(${r},${g},${b})`;
  }
  return color;
}
function huePair(color, opacity, dark) {
  const base = toRgbCss(color);
  const top = lighten(base, 0.12);
  const bot = darken(base, dark ? 0.18 : 0.08);
  return [alpha$1(top, opacity), alpha$1(bot, opacity)];
}
function getOpacityGradientFill(color, opacityPercent) {
  const opacity = Math.max(0, Math.min(1, opacityPercent / 100));
  return (plot) => {
    const ctx = plot.ctx;
    const g = ctx.createLinearGradient(0, plot.bbox.top, 0, plot.bbox.top + plot.bbox.height);
    g.addColorStop(0, hexAlpha(color, opacity));
    g.addColorStop(1, hexAlpha(color, 0));
    return g;
  };
}
function getHueGradientFill(color, opacityPercent, darkTheme) {
  const opacity = Math.max(0, Math.min(1, opacityPercent / 100));
  return (plot) => {
    const stroke = plot.series[plot.series.length - 1]?._stroke || color;
    const [c0, c1] = huePair(String(stroke || color), opacity, darkTheme);
    const ctx = plot.ctx;
    const g = ctx.createLinearGradient(0, plot.bbox.top, 0, plot.bbox.top + plot.bbox.height);
    g.addColorStop(0, c0);
    g.addColorStop(1, c1);
    return g;
  };
}
function getSchemeGradientFill(color, opacityPercent, thresholds, scaleKey = "y") {
  const steps = thresholds?.steps?.filter(
    (s) => s && Number.isFinite(Number(s.value)) && Number(s.value) !== -Infinity
  );
  if (!steps?.length) {
    return getOpacityGradientFill(color, opacityPercent);
  }
  const opacity = Math.max(0, Math.min(1, opacityPercent / 100));
  return (plot) => {
    const scale = plot.scales[scaleKey];
    const min = scale?.min ?? 0;
    const max = scale?.max ?? 1;
    const range = max - min || 1;
    const ctx = plot.ctx;
    const g = ctx.createLinearGradient(0, plot.bbox.top + plot.bbox.height, 0, plot.bbox.top);
    const sorted = [...steps].sort((a, b) => Number(a.value) - Number(b.value));
    for (const step of sorted) {
      const t2 = Math.max(0, Math.min(1, (Number(step.value) - min) / range));
      g.addColorStop(t2, hexAlpha(step.color || color, opacity || 1));
    }
    return g;
  };
}
function resolveSeriesFill(opts) {
  const { color, fillOpacity, gradientMode, darkTheme, thresholds, scaleKey } = opts;
  if (!(fillOpacity > 0) && gradientMode === "none") return void 0;
  const mode2 = gradientMode || "none";
  if (mode2 === "opacity") return getOpacityGradientFill(color, fillOpacity);
  if (mode2 === "hue") return getHueGradientFill(color, fillOpacity || 100, darkTheme);
  if (mode2 === "scheme") {
    return getSchemeGradientFill(color, fillOpacity || 100, thresholds, scaleKey);
  }
  if (fillOpacity > 0) return hexAlpha(color, fillOpacity / 100);
  return void 0;
}
function nullToUndefThreshold(refValues, fieldValues2, maxThreshold) {
  if (!(maxThreshold > 0) || !fieldValues2.length) return fieldValues2.slice();
  const out = fieldValues2.slice();
  let prevRef;
  let nullIdx;
  for (let i = 0; i < out.length; i++) {
    const fieldVal = out[i];
    const isMissing = fieldVal == null || typeof fieldVal === "number" && !Number.isFinite(fieldVal);
    if (isMissing) {
      if (nullIdx == null && prevRef != null) {
        nullIdx = i;
      }
    } else {
      if (nullIdx != null && prevRef != null) {
        if (refValues[i] - prevRef < maxThreshold) {
          while (nullIdx < i) {
            out[nullIdx++] = void 0;
          }
        }
        nullIdx = void 0;
      }
      prevRef = refValues[i];
    }
  }
  return out;
}
function applySpanNullsThreshold(points, maxThreshold) {
  if (!points.length || !(maxThreshold > 0)) return points;
  const refValues = points.map((p) => p.x);
  const fieldValues2 = points.map((p) => p.y);
  const next = nullToUndefThreshold(refValues, fieldValues2, maxThreshold);
  return points.map((p, i) => ({ x: p.x, y: next[i] }));
}
function applyInsertNulls(points, insertNulls, mode2 = "threshold") {
  if (!insertNulls || points.length < 2) return points;
  const xs = points.map((p) => p.x);
  const steps = [];
  for (let i = 1; i < xs.length; i++) steps.push(xs[i] - xs[i - 1]);
  const sorted = steps.slice().sort((a, b) => a - b);
  const median = sorted[Math.floor(sorted.length / 2)] || 1;
  const threshold = typeof insertNulls === "number" && Number.isFinite(insertNulls) ? insertNulls : median * 2.5;
  if (!(threshold > 0)) return points;
  const insertX = (prev, next) => {
    if (mode2 === "midpoint") return [(prev + next) / 2];
    if (mode2 === "plusone") return [prev + 1];
    const xsIns = [];
    let x = prev + threshold;
    let guard = 0;
    while (x < next && guard++ < 1e4) {
      xsIns.push(x);
      x += threshold;
    }
    return xsIns;
  };
  const out = [];
  for (let i = 0; i < points.length; i++) {
    out.push(points[i]);
    if (i < points.length - 1) {
      const prev = points[i].x;
      const next = points[i + 1].x;
      const gap = next - prev;
      if (gap > threshold) {
        for (const x of insertX(prev, next)) {
          out.push({ x, y: null });
        }
      }
    }
  }
  return out;
}
function resolveSpanGaps(spanNulls) {
  if (typeof spanNulls === "number") return false;
  return Boolean(spanNulls);
}
function expandTimeSeriesInsertNulls(times, values, insertNulls, mode2 = "threshold") {
  if (!insertNulls || times.length < 2) {
    return { times: times.slice(), values: values.slice() };
  }
  const n = Math.min(times.length, values.length);
  const xs = times.slice(0, n);
  const ys = values.slice(0, n);
  const steps = [];
  for (let i = 1; i < xs.length; i++) {
    const d = xs[i] - xs[i - 1];
    if (d > 0) steps.push(d);
  }
  const sorted = steps.slice().sort((a, b) => a - b);
  const median = sorted[Math.floor(sorted.length / 2)] || 1;
  const threshold = typeof insertNulls === "number" && Number.isFinite(insertNulls) && insertNulls > 0 ? insertNulls : median * 2.5;
  if (!(threshold > 0)) return { times: xs, values: ys };
  const outT = [];
  const outV = [];
  for (let i = 0; i < xs.length; i++) {
    if (i > 0) {
      const prev = xs[i - 1];
      const next = xs[i];
      const gap = next - prev;
      if (gap > threshold) {
        if (mode2 === "plusone") {
          outT.push(prev + 1);
          outV.push(null);
        } else if (mode2 === "midpoint") {
          outT.push((prev + next) / 2);
          outV.push(null);
        } else {
          let x = prev + threshold;
          let guard = 0;
          while (x < next && guard++ < 1e4) {
            outT.push(x);
            outV.push(null);
            x += threshold;
          }
        }
      }
    }
    outT.push(xs[i]);
    outV.push(ys[i]);
  }
  return { times: outT, values: outV };
}
function resolveYScaleRange(input) {
  let dataMin = input.dataMin ?? null;
  let dataMax = input.dataMax ?? null;
  const softMin = input.softMin ?? null;
  const softMax = input.softMax ?? null;
  const hardMin = input.hardMin ?? null;
  const hardMax = input.hardMax ?? null;
  const hardMinOnly = softMin == null && hardMin != null;
  const hardMaxOnly = softMax == null && hardMax != null;
  const hasFixedRange = hardMinOnly && hardMaxOnly;
  if (!hasFixedRange && dataMin == null && dataMax == null) {
    return [null, null];
  }
  if (hasFixedRange) {
    return [hardMin, hardMax];
  }
  const softMinMode = softMin == null ? 3 : 1;
  const softMaxMode = softMax == null ? 3 : 1;
  const rangeConfig = {
    min: {
      pad: 0.1,
      hard: hardMin ?? -Infinity,
      soft: softMin ?? 0,
      mode: softMinMode
    },
    max: {
      pad: 0.1,
      hard: hardMax ?? Infinity,
      soft: softMax ?? 0,
      mode: softMaxMode
    }
  };
  if (input.centeredZero) {
    const absMin = Math.abs(dataMin ?? 0);
    const absMax = Math.abs(dataMax ?? 0);
    let max = Math.max(absMin, absMax);
    if (max === 0) {
      max = 80;
    }
    dataMin = -max;
    dataMax = max;
  }
  const distr = input.distr ?? 1;
  let minMax;
  if (distr === 4) {
    minMax = uPlot.rangeAsinh(dataMin, dataMax, 10, true);
  } else if (distr === 3) {
    minMax = uPlot.rangeLog(
      hardMin ?? dataMin,
      hardMax ?? dataMax,
      10,
      true
    );
  } else {
    minMax = uPlot.rangeNum(
      hardMinOnly ? hardMin : dataMin,
      hardMaxOnly ? hardMax : dataMax,
      rangeConfig
    );
  }
  if (distr === 1 || distr === 4) {
    if (hardMinOnly) minMax[0] = hardMin;
    if (hardMaxOnly) minMax[1] = hardMax;
  }
  if (minMax[0] != null && minMax[0] === minMax[1] && minMax[0] !== 0) {
    if (distr === 1) {
      if (minMax[0] < 0) {
        minMax[0] *= 2;
        minMax[1] = 0;
      } else {
        minMax[1] = minMax[1] * 2;
        minMax[0] = 0;
      }
    }
  }
  if (minMax[0] != null && minMax[1] != null && minMax[0] >= minMax[1]) {
    minMax[0] = distr === 3 ? 1 : 0;
    minMax[1] = 100;
  }
  return minMax;
}
const UPLOT_DATA_HOVER = "DataHover";
const UPLOT_DATA_HOVER_CLEAR = "DataHoverClear";
function sharedCursorShowsTooltip(syncMode, viaShared) {
  if (viaShared && syncMode < 2) return false;
  return true;
}
function applySharedCursorX(chart, x) {
  if (!chart || !Number.isFinite(x)) return false;
  try {
    const left = chart.valToPos(x, "x");
    if (left == null || !Number.isFinite(left)) return false;
    const top = chart.cursor?.top != null && chart.cursor.top >= 0 ? chart.cursor.top : (chart.bbox?.height ?? 40) / 2;
    chart.setCursor({ left, top });
    return true;
  } catch {
    return false;
  }
}
function clearSharedCursor(chart) {
  if (!chart) return false;
  try {
    chart.setCursor({ left: -10, top: -10 });
    return true;
  } catch {
    return false;
  }
}
function bindSharedCursorBus(opts) {
  const bus = opts.bus;
  if (!bus) return () => void 0;
  const setApplying = (v) => {
    opts.setApplying?.(v);
  };
  const unsubHover = bus.subscribe(UPLOT_DATA_HOVER, (payload) => {
    if (opts.getSyncMode() < 1) return;
    const p = payload;
    if (!p || p.source === opts.instanceId) return;
    const x = p.point?.time ?? p.x;
    if (x == null || !Number.isFinite(Number(x))) return;
    setApplying(true);
    try {
      applySharedCursorX(opts.getChart(), Number(x));
    } finally {
      if (typeof requestAnimationFrame === "function") {
        requestAnimationFrame(() => setApplying(false));
      } else {
        setApplying(false);
      }
    }
  });
  const unsubClear = bus.subscribe(UPLOT_DATA_HOVER_CLEAR, (payload) => {
    if (opts.getSyncMode() < 1) return;
    const p = payload;
    if (p?.source === opts.instanceId) return;
    setApplying(true);
    try {
      clearSharedCursor(opts.getChart());
      opts.onClearHover?.();
    } finally {
      if (typeof requestAnimationFrame === "function") {
        requestAnimationFrame(() => setApplying(false));
      } else {
        setApplying(false);
      }
    }
  });
  return () => {
    unsubHover();
    unsubClear();
  };
}
function publishSharedHover(bus, opts) {
  if (!bus) return;
  if (opts.applyingSharedCursor) return;
  if (opts.syncMode < 1) return;
  if (opts.x != null && Number.isFinite(opts.x)) {
    bus.publish(UPLOT_DATA_HOVER, {
      source: opts.instanceId,
      x: opts.x,
      point: { time: opts.x }
    });
  } else {
    bus.publish(UPLOT_DATA_HOVER_CLEAR, { source: opts.instanceId });
  }
}
function getStackingBands(group) {
  const bands = [];
  const series = group.series ?? [];
  const dir = group.dir ?? 1;
  const lastIdx = series.length - 1;
  const rSeries = series.slice().reverse();
  rSeries.forEach((si, i) => {
    if (i !== lastIdx) {
      const nextIdx = rSeries[i + 1];
      bands.push({
        series: [si, nextIdx],
        // fill direction is inverted from stack direction
        dir: -1 * dir
      });
    }
  });
  return bands;
}
function stackingBandsForSeriesCount(count, dir = 1) {
  if (count < 2) return [];
  const series = Array.from({ length: count }, (_, i) => i + 1);
  return getStackingBands({ series, dir });
}
function numRef(v, fallback = 0) {
  const n = Number(unref(v));
  return Number.isFinite(n) ? n : fallback;
}
function boolRef(v, fallback = false) {
  if (v == null) return fallback;
  return Boolean(unref(v));
}
function unrefAny(v) {
  return unref(v);
}
function useUPlot(el, seriesList, opts) {
  let chart = null;
  const hover = ref(null);
  const panelCtx = usePanelContext();
  const cursorInstanceId = `uplot-${Math.random().toString(36).slice(2, 10)}`;
  let applyingSharedCursor = false;
  let unsubDataHover;
  let unsubDataHoverClear;
  function cursorSyncMode() {
    try {
      return Number(panelCtx.sync?.() ?? 0) || 0;
    } catch {
      return 0;
    }
  }
  function publishHoverPoint(pt) {
    publishSharedHover(panelCtx.eventBus, {
      instanceId: cursorInstanceId,
      syncMode: cursorSyncMode(),
      applyingSharedCursor,
      x: pt && Number.isFinite(pt.x) ? pt.x : null
    });
  }
  function bindCursorBus() {
    unsubDataHover?.();
    unsubDataHoverClear?.();
    unsubDataHover = void 0;
    unsubDataHoverClear = void 0;
    const unbind = bindSharedCursorBus({
      bus: panelCtx.eventBus,
      instanceId: cursorInstanceId,
      getSyncMode: cursorSyncMode,
      getChart: () => chart,
      setApplying: (v) => {
        applyingSharedCursor = v;
      },
      onClearHover: () => {
        hover.value = null;
        opts.onHover?.(null);
      }
    });
    unsubDataHover = unbind;
    unsubDataHoverClear = void 0;
  }
  function mode2() {
    const m = opts.mode;
    if (!m) return "line";
    return typeof m === "string" ? m : m.value;
  }
  function build2() {
    if (!el.value) return;
    chart?.destroy();
    chart = null;
    const series = seriesList.value.filter((s) => !s.hidden);
    const hasPoints = series.some(
      (s) => s.points?.some((p) => p.y != null && Number.isFinite(p.y))
    );
    if (!series.length || !hasPoints) {
      return;
    }
    const data = toAlignedSeriesData(seriesList.value);
    const width2 = Math.max(numRef(opts.width) || el.value.clientWidth || 100, 40);
    const height2 = Math.max(numRef(opts.height) || el.value.clientHeight || 80, 40);
    const xs = data[0] ?? [];
    const dataSpanMs = unrefAny(opts.timeX) !== false && xs.length >= 2 ? Math.abs(Number(xs[xs.length - 1]) - Number(xs[0])) : 0;
    const plotWGuess = Math.max(width2 - 64, 40);
    const plotHGuess = Math.max(height2 - 40, 32);
    const m = mode2();
    const barWidthFactor = readNum(opts.barWidthFactor) ?? 0.6;
    const barBucketSize = readNum(opts.barBucketSize);
    const softMin = readNum(opts.softMin);
    const softMax = readNum(opts.softMax);
    const hardMin = readNum(opts.hardMin);
    const hardMax = readNum(opts.hardMax);
    const globalSpan = boolRef(opts.spanNulls);
    const globalLW = readNum(opts.lineWidth) ?? 1;
    const globalFill = readNum(opts.fillOpacity) ?? (m === "area" ? 20 : 0);
    void (opts.showLegend == null ? series.length > 1 : boolRef(opts.showLegend, true));
    const gradientMode = readStr(opts.gradientMode, "none");
    const globalInterp = readStr(opts.lineInterpolation, "linear");
    const axis = unrefAny(
      opts.axis
    ) ?? {};
    const thresholds = unrefAny(
      opts.thresholds
    ) ?? [];
    const globalShowValues = boolRef(opts.showValues);
    const showValues = globalShowValues || series.some((item) => item.showValues === true);
    const yScale = { auto: true };
    const scaleDist = normalizeScaleDistribution(unrefAny(opts.scaleDistribution));
    if (scaleDist.type === "log") {
      yScale.distr = 3;
      yScale.log = scaleDist.log ?? 10;
    } else if (scaleDist.type === "symlog") {
      yScale.distr = 4;
      yScale.log = scaleDist.log ?? 10;
      yScale.asinh = scaleDist.linearThreshold ?? 1;
    }
    const axisHardMin = readNum(axis.hardMin) ?? hardMin;
    const axisHardMax = readNum(axis.hardMax) ?? hardMax;
    const hasSoftOrHard = axis.centeredZero || softMin != null || softMax != null || axisHardMin != null || axisHardMax != null;
    if (hasSoftOrHard) {
      yScale.range = (_u, dataMin, dataMax) => resolveYScaleRange({
        dataMin,
        dataMax,
        centeredZero: !!axis.centeredZero,
        softMin,
        softMax,
        hardMin: axisHardMin,
        hardMax: axisHardMax,
        distr: yScale.distr
      });
    }
    if (axis.softMin != null && softMin == null) yScale.min = axis.softMin;
    if (axis.softMax != null && softMax == null) yScale.max = axis.softMax;
    if (scaleDist.type === "log" && !yScale.range) {
      yScale.range = (_u, dataMin, dataMax) => {
        let min = dataMin ?? 1;
        let max = dataMax ?? 10;
        if (!(min > 0) || !Number.isFinite(min)) min = 1;
        if (!(max > 0) || !Number.isFinite(max)) max = min * 10;
        if (max <= min) max = min * 10;
        if (softMin != null && softMin > 0) min = Math.min(min, softMin);
        if (softMax != null && softMax > 0) max = Math.max(max, softMax);
        return [min, max];
      };
    }
    const gridShow = axis.gridShow !== false;
    const xGridShow = axis.xGridShow != null ? !!axis.xGridShow : gridShow;
    const yGridShow = axis.yGridShow != null ? !!axis.yGridShow : gridShow;
    const axisHidden = axis.placement === "hidden";
    const axisSide = axis.placement === "right" ? 1 : 3;
    const hooks = {};
    const thresholdsMode = readStr(opts.thresholdsMode, "line");
    const thresholdDraw = createThresholdsDrawHook(
      thresholds,
      thresholdsMode,
      boolRef(opts.thresholdsPercent)
    );
    if (thresholdDraw) {
      hooks.draw = [thresholdDraw];
    }
    const drawHook = unrefAny(opts.drawHook);
    if (typeof drawHook === "function") {
      hooks.draw = [...hooks.draw || [], drawHook];
    }
    if (showValues) {
      hooks.drawSeries = [
        (u, si) => {
          if (si === 0) return;
          if (!(series[si - 1]?.showValues ?? globalShowValues)) return;
          const ctx = u.ctx;
          const s = u.series[si];
          if (!s.show) return;
          const pointsVisible = typeof s.points?.show === "function" ? s.points.show(u, si) : Boolean(s.points?.show);
          if (!shouldShowSeriesValues(
            series[si - 1]?.drawStyle,
            pointsVisible,
            u.bbox.width / uPlot.pxRatio,
            u.data[0]?.length ?? 0
          )) {
            return;
          }
          ctx.save();
          ctx.fillStyle = getComputedStyle(el.value).getPropertyValue("--grafana-text").trim() || s.stroke;
          const fs = readNum(opts.showValueFontSize) ?? 10;
          ctx.font = `${fs * uPlot.pxRatio}px sans-serif`;
          const xs2 = u.data[0];
          const ys = u.data[si];
          const pointSize = Number(s.points?.size || 5);
          const seriesUnit = series[si - 1]?.unit;
          for (const [i, x_] of xs2.entries()) {
            const yv = ys[i];
            if (yv == null || !Number.isFinite(yv)) continue;
            const x = u.valToPos(x_, "x", true);
            const y = u.valToPos(yv, s.scale || "y", true);
            const label = getPointValueLabelPosition(x, y, pointSize, uPlot.pxRatio, yv);
            ctx.textAlign = label.textAlign;
            ctx.textBaseline = label.textBaseline;
            ctx.fillText(
              formatAxisValue(yv, {
                unit: seriesUnit || axis.unit,
                decimals: axis.decimals
              }),
              label.x,
              label.y
            );
          }
          ctx.restore();
        }
      ];
    }
    if (boolRef(opts.fullHighlight)) {
      hooks.draw = [
        ...hooks.draw || [],
        (u) => {
          const idx = u.cursor?.idx;
          if (idx == null || idx < 0) return;
          const xs2 = u.data[0];
          if (!xs2 || idx >= xs2.length) return;
          const ctx = u.ctx;
          const { top, width: plotW, height: plotH } = u.bbox;
          const xC = u.valToPos(xs2[idx], "x", true);
          const n = xs2.length;
          const slot = plotW / Math.max(n, 1);
          const w = Math.max(1, slot * 0.97);
          ctx.save();
          ctx.fillStyle = isDarkTheme() ? "rgba(204, 204, 220, 0.08)" : "rgba(36, 41, 46, 0.08)";
          ctx.fillRect(xC - w / 2, top, w, plotH);
          ctx.restore();
        }
      ];
    }
    hooks.setCursor = [
      ...hooks.setCursor || [],
      (u) => {
        pendingHoverU = u;
        if (hoverRaf != null) return;
        hoverRaf = typeof requestAnimationFrame === "function" ? requestAnimationFrame(() => {
          hoverRaf = null;
          const cu = pendingHoverU;
          pendingHoverU = null;
          if (!cu) return;
          applyHoverFromCursor(cu);
        }) : null;
        if (hoverRaf == null) {
          const cu = pendingHoverU;
          pendingHoverU = null;
          if (cu) applyHoverFromCursor(cu);
        }
      }
    ];
    const onSelectCb = opts.onSelect;
    if (typeof onSelectCb === "function") {
      hooks.setSelect = [
        ...hooks.setSelect || [],
        (u) => {
          applyUPlotSelectHook(u, onSelectCb);
        }
      ];
    }
    const bandList = unrefAny(opts.bands) ?? [];
    const uBands = bandList.filter((b) => Array.isArray(b?.series) && b.series.length === 2).map((b) => {
      const band = { series: [b.series[0], b.series[1]] };
      if (b.dir === 1 || b.dir === -1) band.dir = b.dir;
      if (b.fill !== void 0) band.fill = b.fill;
      return band;
    });
    const dark = isDarkTheme();
    const gridColor = uplotGridColor(dark);
    const axisStrokeBase = uplotAxisStroke(dark);
    const axisColorMode = String(axis.colorMode || "text");
    const axisStroke = axisColorMode === "series" && axis.seriesColor ? String(axis.seriesColor) : axisStrokeBase;
    const axisFont = axis.font || UPLOT_AXIS_FONT;
    const hair = 1 / (typeof devicePixelRatio === "number" && devicePixelRatio > 0 ? devicePixelRatio : 1);
    const xMin = readNum(opts.xMin);
    const xMax = readNum(opts.xMax);
    const xScale = { time: unrefAny(opts.timeX) !== false };
    if (xMin != null && xMax != null && xMax > xMin) {
      xScale.range = () => [xMin, xMax];
      xScale.min = xMin;
      xScale.max = xMax;
      xScale.auto = false;
    } else {
      if (xMin != null) xScale.min = xMin;
      if (xMax != null) xScale.max = xMax;
    }
    const scaleOrientation = String(unrefAny(opts.scaleOrientation) ?? "vertical");
    const isHorizontalScale = scaleOrientation === "horizontal";
    if (isHorizontalScale) {
      xScale.ori = 1;
      xScale.dir = -1;
      yScale.ori = 0;
      yScale.dir = 1;
    }
    chart = new uPlot(
      {
        width: width2,
        height: height2,
        // Grafana DEFAULT_PLOT_CONFIG: timestamps are milliseconds
        ms: 1,
        // Grafana DEFAULT_PLOT_CONFIG paddingSide: 0 on sides with axes.
        // Explicit function guards against uPlot sidesWithAxes false-negatives on left y.
        padding: [
          (_u, side, sidesWithAxes) => grafanaPaddingSide(_u, side, sidesWithAxes),
          (_u, side, sidesWithAxes) => grafanaPaddingSide(_u, side, sidesWithAxes),
          (_u, side, sidesWithAxes) => grafanaPaddingSide(_u, side, sidesWithAxes),
          // left: always 0 when y-axis is shown (default timeseries)
          (_u, side, sidesWithAxes) => {
            if (!axisHidden) return 0;
            return grafanaPaddingSide(_u, side, sidesWithAxes);
          }
        ],
        cursor: (() => {
          const proxRaw = readNum(opts.hoverProximity);
          const DEFAULT_FOCUS = 30;
          const DEFAULT_NULL = 15;
          const focusProx = proxRaw != null ? proxRaw : DEFAULT_FOCUS;
          const dragOpt = unrefAny(opts.cursorDrag);
          const hasOnSelect = typeof opts.onSelect === "function";
          return {
            show: true,
            drag: {
              x: dragOpt?.x !== false,
              y: dragOpt?.y === true,
              // Host owns zoom via onSelect (Grafana TooltipPlugin2 setScale:false).
              ...hasOnSelect ? { setScale: false } : {}
            },
            // Grafana TimeSeries utils: focus.prox + hover.prox
            focus: { prox: focusProx },
            hover: {
              prox: (_self, _seriesIdx, _hoveredIdx) => {
                if (proxRaw != null) return proxRaw;
                return DEFAULT_NULL;
              },
              skip: [null]
            }
          };
        })(),
        legend: { show: false, live: false },
        // custom legend rendered by PanelHost/PanelChrome
        ...uBands.length ? { bands: uBands } : {},
        scales: {
          x: xScale,
          y: yScale,
          ...unrefAny(opts.extraScales) ?? {}
        },
        axes: [
          {
            // horizontal bars: category axis on left; vertical: bottom
            side: isHorizontalScale ? 3 : 2,
            stroke: axisStroke,
            font: axisFont,
            grid: { show: xGridShow, stroke: gridColor, width: hair },
            ticks: { show: true, stroke: gridColor, width: hair, size: 4 },
            border: {
              show: axis.borderShow === true,
              stroke: axisStroke,
              width: hair
            },
            space: (self, _axisIdx, _scaleMin, _scaleMax, plotDim) => {
              const span = unrefAny(opts.timeX) !== false ? Math.abs(Number(self.scales.x.max ?? 0) - Number(self.scales.x.min ?? 0)) : Math.abs(Number(self.scales.x.max ?? 0) - Number(self.scales.x.min ?? 0)) || dataSpanMs;
              return adaptiveAxisSpace(
                plotDim || plotWGuess,
                "x",
                unrefAny(opts.timeX) !== false,
                span
              );
            },
            // Grafana Histogram.tsx xSplits — bucket-aligned ticks
            ...(() => {
              const xSplitsFn = unrefAny(opts.xSplits);
              return typeof xSplitsFn === "function" ? { splits: xSplitsFn } : {};
            })(),
            gap: readNum(opts.xAxisGap) ?? 5,
            rotate: (() => {
              const r = readNum(opts.xTickLabelRotation);
              return r != null && r !== 0 ? r : void 0;
            })(),
            // Grafana: ticks + gap + fontSize ≈ 21; barchart dual-run needs ~35
            size: (_u, values) => {
              const forced = readNum(opts.xAxisSize);
              if (forced != null && forced > 0) return forced;
              return calculateAxisSize(_u, values || [], 2);
            },
            values: (u, splits) => {
              const span = splits.length >= 2 ? Math.abs(splits[splits.length - 1] - splits[0]) : dataSpanMs;
              const labels = unrefAny(opts.xValueLabels);
              const isTime = unrefAny(opts.timeX) !== false;
              const format = (v) => {
                if (labels && labels.length) {
                  const idx = Math.round(v);
                  if (idx >= 0 && idx < labels.length) return labels[idx] ?? "";
                  return "";
                }
                return isTime ? formatTime(v, axis.timezone, span) : formatAxisNumber(v);
              };
              if (typeof unrefAny(opts.xSplits) === "function") {
                return splits.map((v) => format(v));
              }
              if (labels && labels.length) {
                return splits.map((v) => format(v));
              }
              return formatSplitsAdaptive(u, splits, "x", format);
            }
          },
          {
            show: !axisHidden,
            side: isHorizontalScale ? 2 : axisSide,
            label: axis.label || void 0,
            stroke: axisStroke,
            font: axisFont,
            grid: { show: yGridShow, stroke: gridColor, width: hair },
            ticks: { show: true, stroke: gridColor, width: hair, size: 4 },
            border: {
              show: axis.borderShow === true,
              stroke: axisStroke,
              width: hair
            },
            space: (_self, _axisIdx, _scaleMin, _scaleMax, plotDim) => adaptiveAxisSpace(plotDim || plotHGuess, "y", false),
            // Empirical dual-run: Grafana label right-edge sits ~4px closer to plot than uPlot default gap paint
            gap: axis.gap != null ? Number(axis.gap) : 1,
            size: axis.width != null ? Math.max(Number(axis.width), 1) : axis.sizeAuto || axis.label || unrefAny(opts.yValueLabels) ? (u, values) => calculateAxisSize(u, values || [], axisSide) : 27,
            ...typeof opts.ySplits === "function" ? {
              splits: (u) => {
                const custom = opts.ySplits(u);
                return custom?.length ? custom : [0.5];
              }
            } : unrefAny(opts.yValueLabels) ? {
              splits: (_u) => {
                const labels = unrefAny(opts.yValueLabels) ?? [];
                const n = Math.max(labels.length, 1);
                return Array.from({ length: n }, (_, i) => 1 - (i + 0.5) / n);
              }
            } : {},
            values: (u, splits) => {
              const labels = unrefAny(opts.yValueLabels);
              if (labels && labels.length) {
                const n = labels.length;
                return splits.map((v) => {
                  let best = 0;
                  let bestD = Infinity;
                  for (let i = 0; i < n; i++) {
                    const mid = 1 - (i + 0.5) / n;
                    const d = Math.abs(v - mid);
                    if (d < bestD) {
                      bestD = d;
                      best = i;
                    }
                  }
                  return labels[best] ?? "";
                });
              }
              return formatSplitsAdaptive(u, splits, "y", (v) => {
                const seriesUnit = series.find((s) => s && s.unit && String(s.unit).length);
                return formatAxisValue(v, {
                  unit: axis.unit || seriesUnit?.unit,
                  decimals: axis.decimals != null && Number.isFinite(Number(axis.decimals)) ? Number(axis.decimals) : void 0
                });
              });
            }
          },
          ...unrefAny(opts.extraAxes) ?? []
        ],
        series: [
          {},
          ...series.map((s, i) => {
            const color = s.color || getUPlotPalette()[i % getUPlotPalette().length];
            const lw = s.lineWidth ?? globalLW;
            const fillOp = s.fillOpacity ?? globalFill;
            const spanRaw = s.spanNulls ?? globalSpan;
            const span = resolveSpanGaps(spanRaw);
            const showPts = s.showPoints ?? "auto";
            const seriesMode = s.drawStyle ?? m;
            const seriesGradientMode = s.gradientMode ?? gradientMode;
            const pointsShow = resolvePointsShow(seriesMode, showPts);
            const suppressPaths = boolRef(opts.suppressSeriesPaths, false);
            const effectivePointsShow = s.skipLine || suppressPaths ? false : pointsShow;
            const interp = s.lineInterpolation ?? globalInterp;
            const path = pathsFor(
              interp,
              seriesMode,
              s.barWidthFactor ?? barWidthFactor,
              barBucketSize,
              s.barAlignment
            );
            const scaleKey = s.scale || "y";
            const lineFill = typeof s.lineStyle === "object" ? String(s.lineStyle?.fill ?? "") : String(s.lineStyle ?? "");
            const base = {
              label: s.label,
              stroke: s.skipLine || suppressPaths ? "rgba(0,0,0,0)" : color,
              width: s.skipLine || suppressPaths || seriesMode === "points" ? 0 : Math.max(lw, 0),
              scale: scaleKey,
              points: {
                ...buildPointOptionOverrides({
                  show: effectivePointsShow,
                  size: resolvePointSize(s.pointSize, Math.max(lw, 0)),
                  space: showPts === "always" || seriesMode === "points" ? 0.01 : void 0,
                  paths: s.pointShape === "square" ? squarePointPaths : void 0
                }),
                fill: color,
                // hollow/ring markers read better on filled area (Grafana timeseries)
                stroke: color,
                width: s.pointStrokeWidth ?? 1
                // showPoints=always must not density-filter markers (uPlot default space=_ptDia*2).
                // Use a tiny positive space — 0 can break uPlot's maxPts math in some builds.
              },
              spanGaps: span,
              dash: dashFor(s.lineStyle),
              ...lineFill === "dot" || lineFill === "dots" ? { cap: "round" } : {}
            };
            if (s.skipLine || suppressPaths) {
              base.paths = () => ({
                stroke: null,
                fill: null,
                clip: null,
                band: null,
                gaps: null,
                flags: 0
              });
            } else if (path) {
              base.paths = path;
            }
            if (!suppressPaths && (seriesMode === "area" || fillOp > 0 || seriesGradientMode === "hue" || seriesGradientMode === "scheme")) {
              const fill = resolveSeriesFill({
                color,
                fillOpacity: fillOp,
                gradientMode: seriesGradientMode,
                darkTheme: isDarkTheme(),
                thresholds: unrefAny(opts.thresholdsConfig),
                scaleKey
              });
              if (fill != null) base.fill = fill;
            }
            return base;
          })
        ],
        hooks
      },
      data,
      el.value
    );
    rememberSnapshotAfterBuild();
  }
  let lastSnap = null;
  let dataRevision = 0;
  let themeToken = isDarkTheme() ? "dark" : "light";
  let pendingOps = { ...NO_UPDATE_OPS };
  let flushRaf = null;
  let flushScheduled = false;
  let hoverRaf = null;
  let pendingHoverU = null;
  let themeRebuildPending = false;
  let io = null;
  let isElementVisible = true;
  let disposed = false;
  function currentSize() {
    const w = Math.max(numRef(opts.width) || el.value?.clientWidth || 100, 40);
    const h2 = Math.max(numRef(opts.height) || el.value?.clientHeight || 80, 40);
    return { w, h: h2 };
  }
  function styleSig() {
    return [
      mode2(),
      String(unrefAny(opts.timeX) !== false),
      String(readNum(opts.softMin) ?? ""),
      String(readNum(opts.softMax) ?? ""),
      String(boolRef(opts.spanNulls)),
      String(readNum(opts.lineWidth) ?? ""),
      String(readNum(opts.fillOpacity) ?? ""),
      String(boolRef(opts.showLegend, true)),
      String(readNum(opts.barWidthFactor) ?? ""),
      String(readNum(opts.barBucketSize) ?? ""),
      String(readNum(opts.xTickLabelRotation) ?? ""),
      String(boolRef(opts.fullHighlight)),
      String(readNum(opts.xAxisSize) ?? ""),
      String(readNum(opts.xAxisGap) ?? ""),
      readStr(opts.gradientMode, "none"),
      readStr(opts.lineInterpolation, "linear"),
      readStr(opts.thresholdsMode, "line"),
      String(boolRef(opts.thresholdsPercent)),
      String(boolRef(opts.showValues)),
      readStr(opts.tooltipMode, "single"),
      JSON.stringify(unrefAny(opts.axis) ?? null),
      JSON.stringify(unrefAny(opts.thresholds) ?? null),
      JSON.stringify(unrefAny(opts.bands) ?? null),
      JSON.stringify(unrefAny(opts.xValueLabels) ?? null),
      JSON.stringify(unrefAny(opts.yValueLabels) ?? null),
      JSON.stringify(unrefAny(opts.extraScales) ?? null),
      JSON.stringify(unrefAny(opts.extraAxes) ?? null),
      JSON.stringify(unrefAny(opts.thresholdsConfig) ?? null),
      // drawHook identity
      String(typeof unrefAny(opts.drawHook))
    ].join("~");
  }
  function takeSnapshot() {
    const size = currentSize();
    return {
      schemaSig: uplotSeriesSchemaSig(seriesList.value),
      styleSig: styleSig(),
      visibilitySig: uplotSeriesVisibilitySig(seriesList.value),
      sizeW: size.w,
      sizeH: size.h,
      xMin: readNum(opts.xMin),
      xMax: readNum(opts.xMax),
      themeToken,
      dataRevision
    };
  }
  function rememberSnapshotAfterBuild() {
    lastSnap = takeSnapshot();
  }
  function applyHoverFromCursor(u) {
    const tipMode = () => readStr(opts.tooltipMode, "single");
    const mode22 = tipMode();
    const idx = u.cursor.idx;
    const left = u.cursor.left;
    const top = u.cursor.top;
    if (!sharedCursorShowsTooltip(cursorSyncMode(), applyingSharedCursor)) {
      hover.value = null;
      opts.onHover?.(null);
      return;
    }
    const xsAll = u.data?.[0];
    const rawX = idx != null && xsAll && Number.isFinite(xsAll[idx]) ? Number(xsAll[idx]) : null;
    if (mode22 === "none" || mode22 === "hidden") {
      hover.value = null;
      opts.onHover?.(null);
      if (rawX != null && left != null && left >= 0) {
        publishHoverPoint({
          x: rawX
        });
      } else if (left == null || left < 0) {
        publishHoverPoint(null);
      }
      return;
    }
    if (idx == null || left == null || top == null || left < 0 || top < 0) {
      hover.value = null;
      opts.onHover?.(null);
      publishHoverPoint(null);
      return;
    }
    const xs = u.data[0];
    const x = xs[idx];
    if (x == null || !Number.isFinite(x)) {
      hover.value = null;
      opts.onHover?.(null);
      publishHoverPoint(null);
      return;
    }
    const visible = seriesList.value.filter((s) => !s.hidden);
    const seriesPts = [];
    for (let si = 1; si < u.series.length; si++) {
      const sMeta = visible[si - 1];
      const ys = u.data[si];
      const yv = ys?.[idx];
      const val = yv == null || !Number.isFinite(Number(yv)) ? null : Number(yv);
      if (mode22 === "single" || mode22 === "multi" || mode22 === "all") {
        if ((mode22 === "multi" || mode22 === "all") && val == null) continue;
        seriesPts.push({
          index: si,
          label: sMeta?.label || String(u.series[si].label || `Series ${si}`),
          value: val,
          color: sMeta?.color || u.series[si].stroke || void 0,
          yPos: val != null ? u.valToPos(val, "y") : void 0
        });
      }
    }
    let outSeries = seriesPts;
    if (mode22 === "single" && seriesPts.length) {
      const withY = seriesPts.map((sp) => ({
        ...sp,
        yPos: sp.value != null && Number.isFinite(sp.value) ? u.valToPos(sp.value, "y") : void 0
      }));
      outSeries = pickNearestHoverSeries(withY, top);
    }
    if ((mode22 === "multi" || mode22 === "all") && outSeries.length > 1) {
      const sort = readStr(opts.tooltipSort, "none");
      if (sort === "desc" || sort === "asc") {
        outSeries = [...outSeries].sort((a, b) => {
          const av = a.value;
          const bv = b.value;
          if (av == null && bv == null) return 0;
          if (av == null) return 1;
          if (bv == null) return -1;
          return sort === "desc" ? bv - av : av - bv;
        });
      }
    }
    outSeries = filterHoverZeros(outSeries, boolRef(opts.tooltipHideZeros, false));
    const xPos = u.valToPos(x, "x");
    const yCursorVal = (() => {
      try {
        return u.posToVal(top, "y");
      } catch {
        return void 0;
      }
    })();
    const pt = {
      left,
      top,
      x,
      idx,
      series: outSeries,
      xPos,
      yCursorVal: yCursorVal != null && Number.isFinite(yCursorVal) ? yCursorVal : void 0
    };
    hover.value = pt;
    opts.onHover?.(pt);
    publishHoverPoint(pt);
  }
  function applySetSeriesVisibility() {
    if (!chart) return false;
    const visible = seriesList.value.filter((s) => !s.hidden);
    const chartSeries = chart.series;
    if (chartSeries.length - 1 !== visible.length) {
      return false;
    }
    for (const [i, element] of visible.entries()) {
      const label = element?.label ?? "";
      const cs = chartSeries[i + 1];
      if (String(cs?.label ?? "") !== label) return false;
      try {
        chart.setSeries(i + 1, { show: true }, false);
      } catch {
        return false;
      }
    }
    return true;
  }
  function applyOps(ops) {
    if (disposed) return;
    if (ops.rebuild) {
      build2();
      return;
    }
    if (!chart) {
      build2();
      return;
    }
    if (ops.setSeries) {
      if (!applySetSeriesVisibility()) {
        build2();
        return;
      }
    }
    if (ops.setSize) {
      const size = currentSize();
      chart.setSize({ width: size.w, height: size.h });
    }
    if (ops.setScale) {
      const xMin = readNum(opts.xMin);
      const xMax = readNum(opts.xMax);
      if (xMin != null && xMax != null && xMax > xMin) {
        chart.setScale("x", { min: xMin, max: xMax });
      }
    }
    if (ops.setData) {
      const data = toAlignedSeriesData(seriesList.value);
      chart.setData(data);
    }
    lastSnap = takeSnapshot();
  }
  function flushPending() {
    flushRaf = null;
    flushScheduled = false;
    if (disposed) return;
    const ops = pendingOps;
    pendingOps = { ...NO_UPDATE_OPS };
    if (!hasAnyUPlotOps(ops)) return;
    if (ops.rebuild && themeRebuildPending && !isElementVisible) {
      pendingOps = mergeUPlotOps(pendingOps, ops);
      scheduleIdleThemeRebuild();
      return;
    }
    if (ops.rebuild) themeRebuildPending = false;
    applyOps(ops);
  }
  function scheduleFlush() {
    if (disposed) return;
    if (flushScheduled) return;
    flushScheduled = true;
    if (typeof requestAnimationFrame === "function") {
      flushRaf = requestAnimationFrame(() => flushPending());
    } else {
      flushPending();
    }
  }
  function enqueueFromSnapshot() {
    const next = takeSnapshot();
    const ops = planUPlotUpdate(!!chart, lastSnap, next);
    if (!hasAnyUPlotOps(ops)) return;
    pendingOps = mergeUPlotOps(pendingOps, ops);
    scheduleFlush();
  }
  function updateData() {
    dataRevision += 1;
    enqueueFromSnapshot();
  }
  let idleHandle = null;
  function scheduleIdleThemeRebuild() {
    if (idleHandle != null) return;
    const ric = globalThis.requestIdleCallback;
    if (typeof ric === "function") {
      idleHandle = ric(
        () => {
          idleHandle = null;
          if (disposed) return;
          if (!isElementVisible && themeRebuildPending) return;
          scheduleFlush();
        },
        { timeout: 1e3 }
      );
    } else if (typeof requestAnimationFrame === "function") {
      idleHandle = requestAnimationFrame(() => {
        idleHandle = null;
        scheduleFlush();
      });
    } else {
      scheduleFlush();
    }
  }
  function observeVisibility() {
    if (typeof IntersectionObserver === "undefined" || !el.value) {
      isElementVisible = true;
      return;
    }
    io = new IntersectionObserver(
      (entries) => {
        const entry = entries[0];
        const vis = !!entry?.isIntersecting;
        const was = isElementVisible;
        isElementVisible = vis;
        if (vis && !was && themeRebuildPending) {
          scheduleFlush();
        }
      },
      { threshold: 0 }
    );
    io.observe(el.value);
  }
  onMounted(() => {
    observeVisibility();
    build2();
  });
  watch(el, (node, prev) => {
    if (!node || disposed) return;
    if (node !== prev) {
      observeVisibility();
      if (!chart) build2();
    }
  });
  watch(seriesList, updateData);
  watch(
    [
      () => unrefAny(opts.width),
      () => unrefAny(opts.height),
      () => unrefAny(opts.mode),
      () => unrefAny(opts.xMin),
      () => unrefAny(opts.xMax),
      () => unrefAny(opts.timeX),
      () => unrefAny(opts.softMin),
      () => unrefAny(opts.softMax),
      () => unrefAny(opts.spanNulls),
      () => unrefAny(opts.lineWidth),
      () => unrefAny(opts.fillOpacity),
      () => unrefAny(opts.showLegend),
      () => unrefAny(opts.barWidthFactor),
      () => unrefAny(opts.barBucketSize),
      () => unrefAny(opts.xValueLabels),
      () => unrefAny(opts.xTickLabelRotation),
      () => unrefAny(opts.fullHighlight),
      () => unrefAny(opts.xAxisSize),
      () => unrefAny(opts.xAxisGap),
      () => unrefAny(opts.yValueLabels),
      () => unrefAny(opts.gradientMode),
      () => unrefAny(opts.lineInterpolation),
      () => unrefAny(opts.axis),
      () => unrefAny(opts.thresholds),
      () => unrefAny(opts.thresholdsMode),
      () => unrefAny(opts.thresholdsPercent),
      () => unrefAny(opts.showValues),
      () => unrefAny(opts.bands),
      () => unrefAny(opts.tooltipMode),
      () => unrefAny(opts.drawHook),
      () => unrefAny(opts.extraScales),
      () => unrefAny(opts.extraAxes),
      () => unrefAny(opts.thresholdsConfig)
    ],
    () => enqueueFromSnapshot(),
    { deep: true }
  );
  const themeOff = onThemeChange(() => {
    themeToken = isDarkTheme() ? "dark" : "light";
    themeRebuildPending = true;
    pendingOps = mergeUPlotOps(pendingOps, {
      rebuild: true,
      setData: false,
      setSize: false,
      setScale: false,
      setSeries: false
    });
    if (isElementVisible) {
      scheduleFlush();
    } else {
      scheduleIdleThemeRebuild();
    }
  });
  bindCursorBus();
  onBeforeUnmount(() => {
    unsubDataHover?.();
    unsubDataHoverClear?.();
    unsubDataHover = void 0;
    unsubDataHoverClear = void 0;
    disposed = true;
    themeOff?.();
    io?.disconnect();
    io = null;
    if (flushRaf != null && typeof cancelAnimationFrame === "function") {
      cancelAnimationFrame(flushRaf);
      flushRaf = null;
    }
    if (hoverRaf != null && typeof cancelAnimationFrame === "function") {
      cancelAnimationFrame(hoverRaf);
      hoverRaf = null;
    }
    if (idleHandle != null) {
      const cic = globalThis.cancelIdleCallback;
      if (typeof cic === "function") cic(idleHandle);
      else if (typeof cancelAnimationFrame === "function") {
        cancelAnimationFrame(idleHandle);
      }
      idleHandle = null;
    }
    chart?.destroy();
    chart = null;
  });
  return {
    rebuild: build2,
    getChart: () => chart,
    hover
  };
}
const _hoisted_1$2C = {
  class: "panel-content-only",
  "data-testid": "panel-content-only",
  "data-panel-type": "histogram"
};
const _hoisted_2$25 = ["data-empty", "data-bucket-count", "data-bucket-size", "data-bucket-offset", "data-bucket-xs", "data-fill-opacity", "data-line-width", "data-gradient", "data-stacking", "data-combine", "data-calc", "data-calc-option", "data-series-count", "data-band-count", "data-legend-show", "data-legend-display-mode", "data-tooltip-mode"];
const _hoisted_3$1T = {
  key: 0,
  class: "panel-empty",
  "data-testid": "histogram-empty"
};
const _hoisted_4$1B = ["data-mode", "data-placement"];
const _hoisted_5$1p = {
  key: 0,
  class: "legend-head",
  "data-testid": "histogram-legend-head"
};
const _hoisted_6$1c = { class: "name" };
const _sfc_main$3l = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    useCssVars((_ctx) => ({
      "v3107f380": chartHeight.value
    }));
    const props = __props;
    const el = ref(null);
    const opts = computed(() => props.options ?? {});
    const custom = computed(
      () => props.fieldConfig?.defaults?.custom ?? {}
    );
    function collectFieldSeries() {
      const rows = [];
      for (const frame of props.data?.series ?? []) {
        for (const f of frame.fields.filter((x) => x.type === "number")) {
          const fc = {
            ...custom.value,
            ...f.config?.custom ?? {}
          };
          if (normalizeHideFrom(fc.hideFrom).viz === true) continue;
          const values = [];
          for (const v of f.values) {
            const n = Number(v);
            if (Number.isFinite(n)) values.push(n);
          }
          if (!values.length) continue;
          const label = getFieldDisplayName(f, frame, props.data?.series);
          const color = getFieldColor(values[values.length - 1] ?? 0, {
            ...props.fieldConfig?.defaults ?? {},
            ...f.config ?? {}
          }) || void 0;
          rows.push({ label, values, color });
        }
      }
      return rows;
    }
    const HISTOGRAM_BUCKET_SIZES = [
      1e-9,
      2e-9,
      25e-10,
      4e-9,
      5e-9,
      1e-8,
      2e-8,
      25e-9,
      4e-8,
      5e-8,
      1e-7,
      2e-7,
      25e-8,
      4e-7,
      5e-7,
      1e-6,
      2e-6,
      25e-7,
      4e-6,
      5e-6,
      1e-5,
      2e-5,
      25e-6,
      4e-5,
      5e-5,
      1e-4,
      2e-4,
      25e-5,
      4e-4,
      5e-4,
      1e-3,
      2e-3,
      25e-4,
      4e-3,
      5e-3,
      0.01,
      0.02,
      0.025,
      0.04,
      0.05,
      0.1,
      0.2,
      0.25,
      0.4,
      0.5,
      1,
      2,
      4,
      5,
      10,
      20,
      25,
      40,
      50,
      100,
      200,
      250,
      400,
      500,
      1e3,
      2e3,
      2500,
      4e3,
      5e3,
      1e4,
      2e4,
      25e3,
      4e4,
      5e4,
      1e5,
      2e5,
      25e4,
      4e5,
      5e5,
      1e6
    ];
    function pickBucketSize(allValues, bucketCount2, explicit) {
      if (explicit && explicit > 0) return explicit;
      const sorted = [...allValues].filter((n) => Number.isFinite(n)).sort((a, b) => a - b);
      if (!sorted.length) return 1;
      let smallestDelta = Infinity;
      if (sorted.length === 1) {
        smallestDelta = 1;
      } else {
        for (let i = 1; i < sorted.length; i++) {
          const delta = sorted[i] - sorted[i - 1];
          if (delta !== 0) smallestDelta = Math.min(smallestDelta, delta);
        }
      }
      if (!Number.isFinite(smallestDelta)) smallestDelta = 1;
      const min = sorted[0];
      const max = sorted[sorted.length - 1];
      const range = max - min;
      const targetSize = range / Math.max(bucketCount2, 1);
      for (const size of HISTOGRAM_BUCKET_SIZES) {
        if (targetSize < size && size >= smallestDelta) return size;
      }
      return Math.max(smallestDelta, targetSize || 1);
    }
    function isBucketFieldName(name, kind2) {
      const n = String(name);
      if (kind2 === "min") return n === "xMin" || n === "BucketMin";
      return n === "xMax" || n === "BucketMax";
    }
    function originalDataHasHistogram(frames) {
      if (!frames || frames.length !== 1) return false;
      const frame = frames[0];
      const fields = frame?.fields ?? [];
      if (fields.length < 3) return false;
      if (!isBucketFieldName(fields[0]?.name, "min") || !isBucketFieldName(fields[1]?.name, "max")) {
        return false;
      }
      return fields.every((f) => f.type === "number");
    }
    function seriesFromPreBucketedHistogram(frame) {
      const fields = frame.fields ?? [];
      const xMin = fields[0];
      const out = [];
      for (let fi = 2; fi < fields.length; fi++) {
        const f = fields[fi];
        const points = [];
        const n = Math.min(xMin.values.length, f.values.length);
        for (let i = 0; i < n; i++) {
          const x = Number(xMin.values[i]);
          const y = Number(f.values[i]);
          if (Number.isFinite(x) && Number.isFinite(y)) points.push({ x, y });
        }
        if (!points.length) continue;
        const label = getFieldDisplayName(f, frame, [frame]);
        const color = getFieldColor(points[points.length - 1]?.y ?? 0, {
          ...props.fieldConfig?.defaults ?? {},
          ...f.config ?? {}
        }) || void 0;
        out.push({
          label,
          values: points.map((p) => p.y),
          color,
          points
        });
      }
      return out;
    }
    const preBucketed = computed(() => {
      const has = originalDataHasHistogram(props.data?.series);
      const calc = opts.value.__calc__;
      if (calc === false || calc === "false" || calc === "client") return false;
      if (calc === true || calc === "true" || calc === "query") return has;
      return has;
    });
    function bucketizeValues(values, size, offset) {
      const counts = /* @__PURE__ */ new Map();
      for (const n of values) {
        if (!Number.isFinite(n)) continue;
        const bucket = Math.floor((n - offset) / size) * size + offset;
        const key = Math.round(bucket * 1e9) / 1e9;
        counts.set(key, (counts.get(key) ?? 0) + 1);
      }
      return [...counts.entries()].sort((a, b) => a[0] - b[0]).map(([x, y]) => ({ x, y }));
    }
    const series = computed(() => {
      const bucketCount2 = Math.max(1, Number(opts.value.bucketCount ?? 30));
      const fillOpacity0 = Number(opts.value.fillOpacity ?? custom.value.fillOpacity ?? 80);
      const lineWidth0 = Number(opts.value.lineWidth ?? custom.value.lineWidth ?? 1);
      if (preBucketed.value) {
        const frame = props.data?.series?.[0];
        const pre = seriesFromPreBucketedHistogram(frame);
        return pre.map((g) => ({
          label: g.label,
          color: g.color || void 0,
          points: g.points ?? [],
          fillOpacity: fillOpacity0,
          lineWidth: lineWidth0
        }));
      }
      const fieldSeries = collectFieldSeries();
      if (!fieldSeries.length) return [];
      const combine = opts.value.combine === true;
      const stackingMode = String(
        opts.value.stacking?.mode ?? opts.value.stacking ?? custom.value.stacking?.mode ?? custom.value.stacking ?? "none"
      );
      const fillOpacity = Number(opts.value.fillOpacity ?? custom.value.fillOpacity ?? 80);
      const lineWidth = Number(opts.value.lineWidth ?? custom.value.lineWidth ?? 1);
      const allNums = fieldSeries.flatMap((s) => s.values);
      const offset = Number(opts.value.bucketOffset ?? 0);
      const size = pickBucketSize(allNums, bucketCount2, Number(opts.value.bucketSize) || void 0);
      const groups = combine ? [{ label: "count", values: allNums, color: fieldSeries[0]?.color }] : fieldSeries;
      let out = groups.map((g) => {
        const points = bucketizeValues(g.values, size, offset);
        return {
          label: g.label,
          color: g.color || void 0,
          points,
          fillOpacity,
          lineWidth
        };
      });
      if ((stackingMode === "normal" || stackingMode === "percent") && out.length > 1) {
        const xs = /* @__PURE__ */ new Map();
        const totals = /* @__PURE__ */ new Map();
        if (stackingMode === "percent") {
          for (const s of out) {
            for (const p of s.points) {
              if (p.y == null || !Number.isFinite(p.y)) continue;
              totals.set(p.x, (totals.get(p.x) ?? 0) + Math.abs(p.y));
            }
          }
        }
        out = out.map((s) => {
          if ((s.fillOpacity ?? 0) <= 0) s.fillOpacity = 35;
          s.points = s.points.map((p) => {
            if (p.y == null || !Number.isFinite(p.y)) return p;
            let y = p.y;
            if (stackingMode === "percent") {
              const t2 = totals.get(p.x) || 1;
              y = y / t2 * 100;
            }
            const base = xs.get(p.x) ?? 0;
            const stacked = base + y;
            xs.set(p.x, stacked);
            return { x: p.x, y: stacked };
          });
          return s;
        });
      }
      return out;
    });
    const plotBands = computed(() => {
      const stackingMode = String(
        opts.value.stacking?.mode ?? opts.value.stacking ?? custom.value.stacking?.mode ?? custom.value.stacking ?? "none"
      );
      if ((stackingMode === "normal" || stackingMode === "percent") && series.value.length > 1) {
        return stackingBandsForSeriesCount(series.value.length, 1);
      }
      return [];
    });
    const width2 = computed(() => props.width || 400);
    const showLegend = computed(() => opts.value.legend?.showLegend !== false);
    const legendPlacement = computed(() => String(opts.value.legend?.placement ?? "bottom"));
    const legendReserve = computed(
      () => showLegend.value && legendPlacement.value !== "right" ? 32 : 0
    );
    const height2 = computed(() => Math.max((props.height || 200) - legendReserve.value, 40));
    const chartHeight = computed(() => `${height2.value}px`);
    const chartWidthCss = computed(() => {
      if (showLegend.value && legendPlacement.value === "right") {
        const w = props.width || 400;
        return `${Math.max(w * 0.7, 120)}px`;
      }
      return "100%";
    });
    const legendItems = computed(
      () => series.value.map((s) => ({
        label: s.label || "value",
        color: s.color || classicGreen()
      }))
    );
    const barWidthFactor = computed(() => 1);
    const histScale = computed(() => {
      const bucketCount2 = Math.max(1, Number(opts.value.bucketCount ?? 30));
      const bucketOffset = Number(opts.value.bucketOffset ?? 0);
      const fieldSeries = collectFieldSeries();
      const allNums = fieldSeries.flatMap((s) => s.values);
      const size = pickBucketSize(allNums, bucketCount2, Number(opts.value.bucketSize) || void 0);
      const xs = series.value.flatMap((s) => s.points.map((p) => Number(p.x))).filter((n) => Number.isFinite(n));
      if (!xs.length || !Number.isFinite(size) || size <= 0) {
        return {
          bucketSize: size || 1,
          bucketOffset,
          xMin: void 0,
          xMax: void 0
        };
      }
      const minX = Math.min(...xs);
      const maxX = Math.max(...xs);
      return { bucketSize: size, bucketOffset, xMin: minX, xMax: maxX + size };
    });
    const softMax = computed(() => {
      const stackingMode = String(
        opts.value.stacking?.mode ?? opts.value.stacking ?? custom.value.stacking?.mode ?? custom.value.stacking ?? "none"
      );
      return stackingMode === "percent" ? 100 : void 0;
    });
    const softMin = computed(() => 0);
    const hardMinOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.min;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const hardMaxOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.max;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const noData = computed(() => {
      if (props.data?.state === "Loading" || props.data?.error) return false;
      return !series.value.length || series.value.every((s) => !s.points.some((p) => p.y != null && Number.isFinite(p.y)));
    });
    const seriesCount = computed(() => series.value.length);
    function histogramXSplits(u, _axisIdx, _scaleMin, _scaleMax, _foundIncr, _foundSpace) {
      const bucketSize = histScale.value.bucketSize;
      if (!bucketSize || bucketSize <= 0) return [];
      const dataX = u.data?.[0] || [];
      if (!dataX.length) return [];
      const xScaleMin = histScale.value.xMin ?? dataX[0];
      const xScaleMax = histScale.value.xMax ?? dataX[dataX.length - 1] + bucketSize;
      const offset = Number(histScale.value.bucketOffset ?? 0);
      const firstSplit = Math.floor((xScaleMin - offset) / bucketSize) * bucketSize + offset;
      const lastSplit = Math.ceil((xScaleMax - offset) / bucketSize) * bucketSize + offset;
      const minSpace = u.axes?.[_axisIdx]?._space ?? 40;
      const bucketWidth = Math.abs(u.valToPos(dataX[0] + bucketSize, "x") - u.valToPos(dataX[0], "x"));
      const skip = Math.max(1, Math.ceil(minSpace / Math.max(bucketWidth, 1)));
      const splits = [];
      for (let i = 0, s = firstSplit; s <= lastSplit + bucketSize * 1e-9; i++, s += bucketSize) {
        if (i % skip === 0) splits.push(Number(s.toPrecision(12)));
      }
      return splits;
    }
    useUPlot(el, series, {
      width: width2,
      height: height2,
      mode: "bars",
      timeX: false,
      showLegend: false,
      barWidthFactor,
      barBucketSize: computed(() => histScale.value.bucketSize),
      xMin: computed(() => histScale.value.xMin),
      xMax: computed(() => histScale.value.xMax),
      xSplits: histogramXSplits,
      softMin,
      softMax,
      hardMin: hardMinOpt,
      hardMax: hardMaxOpt,
      bands: plotBands,
      // Dual-run: +1px axis size shifts left grid 36→37; gap 4 pulls y labels left to match Grafana
      axis: { width: 28, gap: 5 },
      gradientMode: computed(
        () => String(opts.value.gradientMode ?? custom.value.gradientMode ?? "none")
      ),
      tooltipMode: computed(() => String(opts.value?.tooltip?.mode ?? "single")),
      tooltipSort: computed(() => String(opts.value?.tooltip?.sort ?? "none"))
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2C, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["hist", {
              "legend-bottom": showLegend.value && legendPlacement.value !== "right",
              "legend-right": showLegend.value && legendPlacement.value === "right",
              [`legend-${legendPlacement.value}`]: showLegend.value
            }])
          },
          [
            createElementVNode(
              "div",
              {
                class: "chart-wrap",
                style: normalizeStyle({
                  width: chartWidthCss.value,
                  flex: legendPlacement.value === "right" ? "1 1 auto" : void 0
                })
              },
              [
                createElementVNode("div", {
                  ref_key: "el",
                  ref: el,
                  class: "chart",
                  "data-testid": "histogram-panel",
                  "data-empty": String(noData.value),
                  "data-bucket-count": String(opts.value.bucketCount ?? 30),
                  "data-bucket-size": String(opts.value.bucketSize ?? ""),
                  "data-bucket-offset": String(opts.value.bucketOffset ?? 0),
                  "data-bucket-xs": series.value[0]?.points?.map((p) => String(p.x)).slice(0, 12).join(",") ?? "",
                  "data-fill-opacity": String(opts.value.fillOpacity ?? custom.value.fillOpacity ?? 80),
                  "data-line-width": String(opts.value.lineWidth ?? custom.value.lineWidth ?? 1),
                  "data-gradient": String(opts.value.gradientMode ?? custom.value.gradientMode ?? "none"),
                  "data-stacking": String(
                    opts.value.stacking?.mode ?? opts.value.stacking ?? custom.value.stacking?.mode ?? custom.value.stacking ?? "none"
                  ),
                  "data-combine": String(!!opts.value.combine),
                  "data-calc": preBucketed.value ? "query" : "client",
                  "data-calc-option": String(opts.value.__calc__ ?? ""),
                  "data-series-count": String(seriesCount.value),
                  "data-band-count": String(plotBands.value.length),
                  "data-legend-show": String(showLegend.value),
                  "data-legend-display-mode": String(opts.value.legend?.displayMode ?? "list"),
                  "data-tooltip-mode": String(opts.value.tooltip?.mode ?? "single")
                }, null, 8, _hoisted_2$25),
                noData.value ? (openBlock(), createElementBlock("div", _hoisted_3$1T, [..._cache[0] || (_cache[0] = [
                  createElementVNode(
                    "p",
                    { class: "panel-empty__msg" },
                    "回复中未找到直方图",
                    -1
                    /* CACHED */
                  )
                ])])) : createCommentVNode("v-if", true)
              ],
              4
              /* STYLE */
            ),
            showLegend.value && !noData.value ? (openBlock(), createElementBlock("ul", {
              key: 0,
              class: normalizeClass(["legend", {
                "legend--table": String(opts.value.legend?.displayMode) === "table",
                "legend--right": legendPlacement.value === "right"
              }]),
              "data-testid": "histogram-legend",
              "data-mode": String(opts.value.legend?.displayMode ?? "list"),
              "data-placement": legendPlacement.value
            }, [
              String(opts.value.legend?.displayMode) === "table" ? (openBlock(), createElementBlock("li", _hoisted_5$1p, [..._cache[1] || (_cache[1] = [
                createElementVNode(
                  "i",
                  { class: "legend-swatch" },
                  null,
                  -1
                  /* CACHED */
                ),
                createElementVNode(
                  "span",
                  { class: "name" },
                  "名称",
                  -1
                  /* CACHED */
                )
              ])])) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(legendItems.value, (s, i) => {
                  return openBlock(), createElementBlock("li", {
                    key: i,
                    "data-testid": "histogram-legend-item"
                  }, [
                    createElementVNode(
                      "i",
                      {
                        class: "legend-swatch",
                        style: normalizeStyle({ background: s.color })
                      },
                      null,
                      4
                      /* STYLE */
                    ),
                    createElementVNode(
                      "span",
                      _hoisted_6$1c,
                      toDisplayString(s.label),
                      1
                      /* TEXT */
                    )
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ], 10, _hoisted_4$1B)) : createCommentVNode("v-if", true)
          ],
          2
          /* CLASS */
        )
      ]);
    };
  }
});
const Panel$h = /* @__PURE__ */ _export_sfc$1(_sfc_main$3l, [["__scopeId", "data-v-a137b717"]]);
new VuePanelPlugin(
  {
    id: "histogram",
    name: "直方图",
    description: "数值分布直方图",
    state: "stable",
    skipDataQuery: false
  },
  Panel$h
).useFieldConfig({
  standardOptions: {
    color: {
      settings: {
        byValueSupport: false,
        bySeriesSupport: true,
        preferThresholdsMode: false
      },
      defaultValue: { mode: "palette-classic" }
    },
    links: { settings: { showOneClick: true } }
  },
  useCustomConfig: (builder) => {
    const cat = ["直方图"];
    builder.addCustom({
      id: "custom.stacking",
      path: "custom.stacking",
      name: "堆叠",
      category: cat,
      editor: "radio",
      isCustom: true,
      override: true,
      // Grafana defaultHistogramConfig.stacking = { mode:'none', group:'A' }
      defaultValue: { mode: "none", group: "A" },
      settings: {
        options: [
          { label: "关闭", value: "none" },
          { label: "普通", value: "normal" },
          { label: "百分比", value: "percent" }
        ]
      }
    }).addSlider(
      {
        id: "custom.lineWidth",
        path: "custom.lineWidth",
        name: "线宽",
        category: cat,
        settings: { min: 0, max: 10, step: 1 }
      },
      1
    ).addSlider(
      {
        id: "custom.fillOpacity",
        path: "custom.fillOpacity",
        name: "填充不透明度",
        category: cat,
        settings: { min: 0, max: 100, step: 1 }
      },
      80
    ).addRadio(
      {
        id: "custom.gradientMode",
        path: "custom.gradientMode",
        name: "渐变模式",
        category: cat,
        settings: {
          options: [
            { label: "无", value: "none" },
            { label: "不透明度", value: "opacity" },
            { label: "色相", value: "hue" },
            { label: "色板", value: "scheme" }
          ]
        }
      },
      "none"
    ).addCustom({
      id: "custom.hideFrom",
      path: "custom.hideFrom",
      name: "隐藏",
      category: ["Series"],
      editor: "multi-select",
      isCustom: true,
      override: true,
      hideFromDefaults: true,
      settings: {
        options: [
          { label: "提示", value: "tooltip" },
          { label: "可视化", value: "viz" },
          { label: "图例", value: "legend" }
        ]
      },
      defaultValue: { tooltip: false, viz: false, legend: false }
    });
  }
}).setPanelOptions((builder) => {
  const cat = ["直方图"];
  builder.addText(
    {
      id: "__calc__",
      path: "__calc__",
      name: "数值",
      description: "查询已返回直方图频率时显示",
      category: cat
    },
    void 0
  ).addNumber(
    {
      id: "bucketCount",
      path: "bucketCount",
      name: "分桶数",
      description: "自动分桶时的目标桶数量",
      category: cat,
      settings: { min: 0, placeholder: "默认: 30" }
    },
    30
  ).addNumber(
    {
      id: "bucketSize",
      path: "bucketSize",
      name: "桶大小",
      description: "固定桶宽；留空则自动",
      category: cat,
      settings: { min: 0, placeholder: "自动" }
    },
    void 0
  ).addNumber(
    {
      id: "bucketOffset",
      path: "bucketOffset",
      name: "桶偏移",
      category: cat,
      settings: { min: 0, placeholder: "默认: 0" }
    },
    0
  ).addBoolean(
    {
      id: "combine",
      path: "combine",
      name: "合并序列",
      description: "将所有序列合并为一个直方图",
      category: cat
    },
    false
  ).addRadio(
    {
      id: "stacking",
      path: "stacking",
      name: "堆叠",
      category: cat,
      settings: {
        options: [
          { label: "关闭", value: "none" },
          { label: "普通", value: "normal" },
          { label: "百分比", value: "percent" }
        ]
      }
    },
    "none"
  ).addSlider(
    {
      id: "lineWidth",
      path: "lineWidth",
      name: "线宽",
      category: cat,
      settings: { min: 0, max: 10, step: 1 }
    },
    1
  ).addSlider(
    {
      id: "fillOpacity",
      path: "fillOpacity",
      name: "填充不透明度",
      category: cat,
      settings: { min: 0, max: 100, step: 1 }
    },
    80
  ).addRadio(
    {
      id: "gradientMode",
      path: "gradientMode",
      name: "渐变模式",
      category: cat,
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "不透明度", value: "opacity" },
          { label: "色相", value: "hue" },
          { label: "色板", value: "scheme" }
        ]
      }
    },
    "none"
  );
  addTooltipOptions(builder);
  addLegendOptions(builder, true, true);
}).setRuntimeConsumedPaths([
  "custom.hideFrom",
  "__calc__",
  "bucketCount",
  "bucketSize",
  "bucketOffset",
  "combine",
  "stacking",
  "lineWidth",
  "fillOpacity",
  "gradientMode",
  "legend.showLegend",
  "tooltip.mode",
  "custom.lineWidth",
  "custom.fillOpacity",
  "custom.gradientMode",
  "custom.stacking"
]).register();
function clampTooltipPosition(opts) {
  const tw = Math.max(40, opts.tooltipWidth ?? 160);
  const th = Math.max(24, opts.tooltipHeight ?? 64);
  const ox = opts.offsetX;
  const oy = opts.offsetY;
  const cw = Math.max(1, opts.containerWidth);
  const ch = Math.max(1, opts.containerHeight);
  let left = opts.cursorLeft + ox;
  let top = opts.cursorTop + oy;
  if (left + tw > cw) {
    left = opts.cursorLeft - tw - Math.abs(ox) / 2;
  }
  if (top + th > ch) {
    top = opts.cursorTop - th - 4;
  }
  left = Math.max(0, Math.min(left, Math.max(0, cw - tw)));
  top = Math.max(0, Math.min(top, Math.max(0, ch - th)));
  return { left, top };
}
function hasNegSample$1(data, samples = 100) {
  const len = data.length;
  if (len === 0) return false;
  let firstIdx = 0;
  let lastIdx = len - 1;
  while (firstIdx <= lastIdx && data[firstIdx] == null) firstIdx++;
  while (lastIdx >= firstIdx && data[lastIdx] == null) lastIdx--;
  if (lastIdx < firstIdx) return false;
  let negCount = 0;
  let posCount = 0;
  const stride = Math.max(1, Math.floor((lastIdx - firstIdx + 1) / samples));
  for (let i = firstIdx; i <= lastIdx; i += stride) {
    const v = data[i];
    if (v != null && typeof v === "number") {
      if (v < 0 || Object.is(v, -0)) negCount++;
      else if (v > 0) posCount++;
    }
  }
  return negCount > posCount;
}
function getStackDirection(transform, values) {
  const hasNeg = hasNegSample$1(values ?? []);
  const t2 = String(transform || "");
  const isNegY = t2 === "negative-Y" || t2 === "negativeY" || t2 === "NegativeY";
  if (isNegY) return hasNeg ? 1 : -1;
  return hasNeg ? -1 : 1;
}
function buildScaleKey(f) {
  return [f.unit ?? "", f.softMin ?? "", f.softMax ?? ""].join("|");
}
function getStackingGroups(fields) {
  const groups = /* @__PURE__ */ new Map();
  for (const f of fields) {
    if (f.hideFromViz) continue;
    const mode2 = String(f.stackingMode ?? "none");
    if (!mode2 || mode2 === "none" || mode2 === "off") continue;
    const dir = getStackDirection(f.transform, f.values);
    const groupName = f.stackingGroup ?? "A";
    const drawStyle = f.drawStyle ?? "line";
    const drawStyle2 = f.drawStyle2 ?? null;
    const stackKey = `${dir}|${mode2}|${groupName}|${buildScaleKey(f)}|${drawStyle}|${drawStyle2}`;
    let group = groups.get(stackKey);
    if (!group) {
      group = { series: [], dir };
      groups.set(stackKey, group);
    }
    group.series.push(f.index);
  }
  return [...groups.values()];
}
function toUPlotSeriesIndices(group) {
  return group.series.map((i) => i + 1);
}
function hasNegSample(data, samples = 100) {
  const len = data.length;
  if (len === 0) return false;
  let firstIdx = 0;
  let lastIdx = len - 1;
  while (firstIdx <= lastIdx && data[firstIdx] == null) firstIdx++;
  while (lastIdx >= firstIdx && data[lastIdx] == null) lastIdx--;
  if (lastIdx < firstIdx) return false;
  let negCount = 0;
  let posCount = 0;
  const stride = Math.max(1, Math.floor((lastIdx - firstIdx + 1) / samples));
  for (let i = firstIdx; i <= lastIdx; i += stride) {
    const v = data[i];
    if (v != null && typeof v === "number") {
      if (v < 0 || Object.is(v, -0)) negCount++;
      else if (v > 0) posCount++;
    }
  }
  return negCount > posCount;
}
function getStackDirectionFromValues(transform, data) {
  const hasNeg = hasNegSample(data);
  const t2 = String(transform || "");
  const isNegY = t2 === "negative-Y" || t2 === "negativeY" || t2 === "NegativeY";
  if (isNegY) {
    return hasNeg ? 1 : -1;
  }
  return hasNeg ? -1 : 1;
}
function buildScaleKeyFromField(field) {
  const cfg = field.config ?? {};
  const custom = cfg.custom ?? {};
  const unit = cfg.unit ?? "short";
  const min = cfg.min ?? "na";
  const max = cfg.max ?? "na";
  const softMin = custom.axisSoftMin ?? "na";
  const softMax = custom.axisSoftMax ?? "na";
  const placement = custom.axisPlacement ?? "auto";
  const dist = custom.scaleDistribution?.type ? custom.scaleDistribution.type === "log" ? `log${custom.scaleDistribution.log ?? ""}` : custom.scaleDistribution.type : "linear";
  const label = custom.axisLabel ? custom.axisLabel : "na";
  return `${unit}/${min}-${max}/${softMin}-${softMax}/${placement}/${dist}/${label}/${field.type}`;
}
function getStackingGroupsFromFrame(frame) {
  const groups = /* @__PURE__ */ new Map();
  frame.fields.forEach((field, i) => {
    if (i === 0) return;
    const custom = field.config?.custom;
    if (custom == null) return;
    if (custom.hideFrom?.viz) return;
    const stacking = custom.stacking;
    if (stacking == null) return;
    const stackingMode = String(stacking.mode ?? "none");
    if (!stackingMode || stackingMode === "none" || stackingMode === "None") return;
    const transform = custom.transform;
    const stackDir = getStackDirectionFromValues(transform, field.values);
    const stackingGroup = stacking.group ?? "A";
    const drawStyle = custom.drawStyle ?? "line";
    const drawStyle2 = drawStyle === "bars" ? custom.barAlignment ?? null : drawStyle === "line" ? custom.lineInterpolation ?? null : null;
    const stackKey = `${stackDir}|${stackingMode}|${stackingGroup}|${buildScaleKeyFromField(field)}|${drawStyle}|${drawStyle2}`;
    let group = groups.get(stackKey);
    if (!group) {
      group = { series: [], dir: stackDir };
      groups.set(stackKey, group);
    }
    group.series.push(i);
  });
  return [...groups.values()];
}
function preparePlotData2(frame, stackingGroups, onStackMeta) {
  if (!stackingGroups.length) {
    let needsWork = false;
    for (let fi = 1; fi < frame.fields.length; fi++) {
      const custom = frame.fields[fi]?.config?.custom;
      if (!custom) continue;
      const transform = String(custom.transform ?? "");
      if (transform === "constant" || transform === "Constant" || transform === "negative-Y" || transform === "negativeY" || transform === "NegativeY") {
        needsWork = true;
        break;
      }
    }
    if (!needsWork) {
      const out = frame.fields.map((f) => f.values);
      return out;
    }
  }
  const data = new Array(frame.fields.length);
  const stacksQty = stackingGroups.length;
  const dataLen = frame.length ?? frame.fields[0]?.values?.length ?? 0;
  const zeroArr = stacksQty > 0 ? new Array(dataLen).fill(0) : [];
  const falseArr = stacksQty > 0 ? new Array(dataLen).fill(false) : [];
  const accums = Array.from({ length: stacksQty }, () => zeroArr.slice());
  const anyValsAtX = Array.from({ length: stacksQty }, () => falseArr.slice());
  stackingGroups.forEach((group, groupIdx) => {
    const groupValsAtX = anyValsAtX[groupIdx];
    group.series.forEach((seriesIdx) => {
      const field = frame.fields[seriesIdx];
      if (field?.config?.custom?.hideFrom?.viz) return;
      const vals = field.values;
      for (let i = 0; i < dataLen; i++) {
        if (vals[i] != null) groupValsAtX[i] = true;
      }
    });
  });
  frame.fields.forEach((field, fi) => {
    let vals = field.values.slice();
    if (fi === 0) {
      data[fi] = vals;
      return;
    }
    const custom = field.config?.custom;
    if (!custom || custom.hideFrom?.viz) {
      data[fi] = vals;
      return;
    }
    const transform = String(custom.transform ?? "");
    if (transform === "constant" || transform === "Constant") {
      const firstValIdx = vals.findIndex((v) => v != null);
      const firstVal = vals[firstValIdx];
      vals = new Array(vals.length).fill(void 0);
      if (firstValIdx >= 0) vals[firstValIdx] = firstVal;
    } else if (transform === "negative-Y" || transform === "negativeY" || transform === "NegativeY") {
      vals = vals.slice();
      for (let i = 0; i < vals.length; i++) {
        if (vals[i] != null) vals[i] = Number(vals[i]) * -1;
      }
    }
    const stackingMode = custom.stacking?.mode;
    if (!stackingMode || stackingMode === "none" || stackingMode === "None") {
      data[fi] = vals;
    } else {
      const stackIdx = stackingGroups.findIndex((group) => group.series.includes(fi));
      const accum = accums[stackIdx];
      const groupValsAtX = anyValsAtX[stackIdx];
      const stacked = data[fi] = new Array(dataLen);
      for (let i = 0; i < dataLen; i++) {
        const v = vals[i];
        if (v != null) {
          stacked[i] = accum[i] += Number(v);
        } else {
          stacked[i] = groupValsAtX[i] ? accum[i] : v;
        }
      }
    }
  });
  frame.fields.forEach((field, fi) => {
    if (fi === 0 || field.config?.custom?.hideFrom?.viz) return;
    const stackingMode = field.config?.custom?.stacking?.mode;
    if (stackingMode === "percent" || stackingMode === "Percent") {
      const stackIdx = stackingGroups.findIndex((group2) => group2.series.includes(fi));
      if (stackIdx < 0) return;
      const accum = accums[stackIdx];
      const group = stackingGroups[stackIdx];
      const stacked = data[fi];
      for (let i = 0; i < dataLen; i++) {
        const v = stacked[i];
        if (v != null) {
          stacked[i] = accum[i] === 0 ? 0 : group.dir * (Number(v) / accum[i]);
        }
      }
    }
  });
  return data;
}
function clusterAnnotations(rawIn, opts = {}) {
  const clustering = opts.clustering !== false && opts.clustering !== 0;
  const multiLane = !!opts.multiLane;
  const raw = rawIn.map((a, i) => ({
    ...a,
    time: Number(a.time),
    timeEnd: a.timeEnd != null ? Number(a.timeEnd) : void 0,
    title: a.title ?? a.text ?? "annotation",
    color: a.color || classicYellow(),
    index: a.index ?? i
  })).filter((a) => Number.isFinite(a.time));
  if (!clustering || raw.length <= 1) {
    return raw.map((a, i) => ({
      ...a,
      lane: multiLane ? i % 3 : 0,
      count: 1,
      items: [a]
    }));
  }
  const sorted = [...raw].sort((a, b) => a.time - b.time);
  const times = sorted.map((a) => a.time);
  const span = times.length ? Math.max(...times) - Math.min(...times) : 0;
  const thr = Math.max(span * 0.01, 6e4);
  const groups = [];
  for (const a of sorted) {
    const g = groups[groups.length - 1];
    if (g && Math.abs(a.time - g[0].time) <= thr) g.push(a);
    else groups.push([a]);
  }
  return groups.map((g, gi) => {
    const head = g[0];
    return {
      ...head,
      title: g.length > 1 ? `${g.length} 条注解` : head.title,
      text: g.length > 1 ? g.map((x) => x.title).join(", ") : head.text,
      count: g.length,
      items: g,
      lane: multiLane ? gi % 3 : 0
    };
  });
}
const _hoisted_1$2B = {
  class: "panel-content-only",
  "data-testid": "panel-content-only",
  "data-panel-type": "timeseries"
};
const _hoisted_2$24 = ["data-tooltip-mode", "data-tooltip-sort", "data-draw-style", "data-line-interp", "data-gradient", "data-axis-placement", "data-show-values", "data-thresholds-mode", "data-hover-proximity", "data-tooltip-max-width", "data-tooltip-max-height", "data-axis-color-mode", "data-axis-width", "data-bar-alignment", "data-fill-below-to", "data-line-style", "data-insert-nulls", "data-legend-limit", "data-legend-overflow", "data-legend-width", "data-legend-show", "data-legend-display-mode", "data-legend-placement", "data-legend-faceted", "data-tooltip-hide-zeros", "data-anno-clustering", "data-anno-multi-lane"];
const _hoisted_3$1S = { class: "chart-wrap" };
const _hoisted_4$1A = ["data-mode", "data-tt-left", "data-tt-top"];
const _hoisted_5$1o = {
  key: 0,
  class: "tt-mirror",
  "data-testid": "uplot-tooltip-y-axis",
  "aria-hidden": "true"
};
const _hoisted_6$1b = ["data-series-index", "data-color"];
const _hoisted_7$12 = {
  class: "tt-mirror",
  "data-testid": "uplot-tooltip-time",
  "aria-hidden": "true"
};
const _hoisted_8$W = {
  key: 1,
  class: "anno-layer",
  "data-testid": "timeseries-annotations"
};
const _hoisted_9$S = ["title", "data-anno-index", "data-count", "data-lane", "onMouseenter", "onFocus"];
const _hoisted_10$J = {
  key: 0,
  class: "anno-tip",
  "data-testid": "anno-tooltip"
};
const _hoisted_11$E = { key: 0 };
const _hoisted_12$y = { class: "ts-val" };
const _hoisted_13$x = ["data-faceted-keys"];
const _hoisted_14$s = ["data-facet-key"];
const _hoisted_15$p = { class: "faceted-key" };
const _hoisted_16$n = ["data-facet-value"];
const _hoisted_17$l = ["checked", "onChange"];
const _hoisted_18$l = ["data-placement", "data-mode", "data-scroll-x", "data-scroll-y", "data-calcs", "data-item-count", "data-overflow"];
const _hoisted_19$k = {
  key: 0,
  class: "legend-head",
  "data-testid": "timeseries-legend-head"
};
const _hoisted_20$i = ["data-series", "data-index", "data-overflow", "onClick"];
const _hoisted_21$b = ["data-overflow"];
const _hoisted_22$8 = {
  key: 0,
  class: "stats",
  "data-testid": "legend-stats"
};
const _sfc_main$3k = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  emits: ["inspect", "fullscreen", "edit", "view", "duplicate", "remove", "share", "explore", "copy", "toggleLegend", "help", "copyStyles", "pasteStyles", "timeSettings", "libraryPanel", "unlinkLibrary", "alertRule"],
  setup(__props, { emit: __emit }) {
    useCssVars((_ctx) => ({
      "v1682e489": chartHeightCss.value,
      "v1528ecf0": legendMaxHeightCss.value,
      "v0d9710d6": legendWidthPx.value
    }));
    function arrMin(a) {
      let m = Infinity;
      for (const v of a) {
        if (v != null && v < m) m = v;
      }
      return m;
    }
    function arrMax(a) {
      let m = -Infinity;
      for (const v of a) {
        if (v != null && v > m) m = v;
      }
      return m;
    }
    const props = __props;
    const chartEl = ref(null);
    const hoverAnno = ref(null);
    const hiddenSeries = ref(/* @__PURE__ */ new Set());
    const custom = computed(
      () => props.fieldConfig?.defaults?.custom ?? {}
    );
    const panelOpts = computed(() => props.options ?? {});
    const showAnnotations = computed(() => panelOpts.value?.annotations?.show !== false);
    function fieldCustom(field) {
      return { ...custom.value, ...field.config?.custom ?? {} };
    }
    function seriesColorForField(field, cfg, seriesIndex) {
      const mode2 = cfg?.color?.mode ?? field.config?.color?.mode;
      if (mode2 === "fixed" && (cfg?.color?.fixedColor || field.config?.color?.fixedColor)) {
        return getFieldColor(0, cfg) || getFieldSeriesColor(String(field.name || "series"), seriesIndex, cfg);
      }
      if (!mode2 || mode2 === "palette-classic" || mode2 === "palette-classic-by-name") {
        return getFieldSeriesColor(String(field.name || "series"), seriesIndex, {
          ...cfg,
          color: { mode: "palette-classic" }
        });
      }
      const last = Number(field.values?.[field.values?.length - 1] ?? 0);
      return getFieldColor(last, cfg) || getFieldSeriesColor(String(field.name || "series"), seriesIndex, cfg);
    }
    const annotations = computed(() => {
      if (!showAnnotations.value) return [];
      const list = (props.data?.annotations ?? []).map((a, i) => ({
        time: Number(a.time),
        timeEnd: a.timeEnd != null ? Number(a.timeEnd) : void 0,
        title: a.title ?? a.text ?? "annotation",
        text: a.text,
        color: a.color || classicYellow(),
        tags: a.tags ?? [],
        index: i
      }));
      return clusterAnnotations(list, {
        clustering: panelOpts.value?.annotations?.clustering,
        multiLane: !!panelOpts.value?.annotations?.multiLane
      });
    });
    const chartMode = computed(() => {
      const style = String(custom.value.drawStyle ?? "line");
      if (style === "bars") return "bars";
      if (style === "points") return "points";
      if (Number(custom.value.fillOpacity ?? 0) > 0) return "area";
      return "line";
    });
    const series = computed(() => {
      const out = [];
      const stackingMode = normalizeStacking(custom.value.stacking).mode;
      const fillBelowTo = custom.value.fillBelowTo ? String(custom.value.fillBelowTo) : "";
      for (let _frameIdx = 0; _frameIdx < (props.data?.series ?? []).length; _frameIdx++) {
        const frame = (props.data?.series ?? [])[_frameIdx];
        const time = frame.fields.find((f) => f.type === "time");
        if (!time) continue;
        for (const field of frame.fields.filter((f) => f.type === "number")) {
          const fc = fieldCustom(field);
          const hideFrom = normalizeHideFrom(fc.hideFrom);
          if (hideFrom.viz === true) continue;
          const cfg = { ...props.fieldConfig?.defaults ?? {}, ...field.config };
          const label = getFieldDisplayName(field, frame, props.data?.series);
          let points = time.values.map((t2, i) => {
            const raw = field.values[i];
            const y = raw == null || typeof raw === "number" && !Number.isFinite(raw) || Number.isNaN(Number(raw)) ? null : Number(raw);
            return { x: Number(t2), y };
          });
          const transform = String(fc.transform ?? "");
          let constantY;
          if (transform === "negative-Y" || transform === "negativeY") {
            points = points.map((p) => ({
              ...p,
              y: p.y == null || Number.isNaN(p.y) ? p.y : -p.y
            }));
          } else if (transform === "constant") {
            const first = points.find((p) => p.y != null && Number.isFinite(p.y));
            if (first) constantY = first.y;
          }
          const insertNullsVal = fc.insertNulls ?? custom.value.insertNulls;
          if (insertNullsVal) {
            points = applyInsertNulls(
              points.filter((p) => p.y != null),
              insertNullsVal
            );
          }
          const spanNullsVal = fc.spanNulls ?? custom.value.spanNulls;
          if (typeof spanNullsVal === "number" && spanNullsVal > 0) {
            points = applySpanNullsThreshold(points, spanNullsVal);
          }
          const fieldFillBelow = String(fc.fillBelowTo ?? fillBelowTo ?? "");
          let fillOpacity = Number(fc.fillOpacity ?? custom.value.fillOpacity ?? 0);
          if (fieldFillBelow && fillOpacity <= 0) {
            fillOpacity = 35;
          }
          out.push({
            label,
            labels: { ...field.labels ?? {} },
            frameName: String(frame.name ?? frame.refId ?? ""),
            color: seriesColorForField(field, cfg, out.length),
            points,
            lineWidth: Number(fc.lineWidth ?? custom.value.lineWidth ?? 1),
            fillOpacity,
            spanNulls: fc.spanNulls ?? custom.value.spanNulls,
            showPoints: String(fc.showPoints ?? custom.value.showPoints ?? "auto"),
            pointSize: Number(fc.pointSize ?? custom.value.pointSize ?? 5),
            showValues: Boolean(fc.showValues ?? custom.value.showValues),
            lineStyle: fc.lineStyle ?? custom.value.lineStyle ?? "solid",
            lineInterpolation: String(
              fc.lineInterpolation ?? custom.value.lineInterpolation ?? "linear"
            ),
            hidden: hiddenSeries.value.has(label),
            hideLegend: hideFrom.legend === true,
            hideTooltip: hideFrom.tooltip === true,
            constantY,
            // used by plotBands (1-based uPlot series index pairing)
            fillBelowTo: fieldFillBelow || void 0,
            fieldName: field.name,
            displayNameFromDS: field.config?.displayNameFromDS,
            _frameIdx,
            stackingMode: normalizeStacking(fc.stacking ?? stackingMode).mode,
            stackingGroup: String(fc.stacking?.group ?? custom.value.stacking?.group ?? "A"),
            transform: String(fc.transform ?? ""),
            unit: String(cfg.unit ?? ""),
            drawStyle: String(fc.drawStyle ?? custom.value.drawStyle ?? "line"),
            barAlignment: Number(fc.barAlignment ?? custom.value.barAlignment ?? 0),
            barWidthFactor: Number(fc.barWidthFactor ?? custom.value.barWidthFactor ?? 0.6),
            gradientMode: String(fc.gradientMode ?? custom.value.gradientMode ?? "none"),
            scale: (() => {
              const fakeField = {
                name: field.name,
                type: field.type,
                config: {
                  unit: cfg.unit,
                  min: cfg.min,
                  max: cfg.max,
                  custom: {
                    ...custom.value,
                    ...fc
                  }
                }
              };
              const key = buildScaleKeyFromField(fakeField);
              const placement = String(fc.axisPlacement ?? custom.value.axisPlacement ?? "auto");
              if (placement === "auto" || placement === "left" || placement === "hidden") {
                const defKey = buildScaleKeyFromField({
                  type: "number",
                  config: {
                    unit: props.fieldConfig?.defaults?.unit,
                    custom: { ...custom.value, axisPlacement: "auto" }
                  }
                });
                if (key === defKey || placement === "hidden") return "y";
              }
              return key;
            })(),
            axisPlacement: String(fc.axisPlacement ?? custom.value.axisPlacement ?? "auto"),
            axisLabel: String(fc.axisLabel ?? custom.value.axisLabel ?? ""),
            drawStyle2: String(fc.drawStyle ?? custom.value.drawStyle ?? "line") === "bars" ? fc.barAlignment ?? custom.value.barAlignment ?? 0 : String(fc.lineInterpolation ?? custom.value.lineInterpolation ?? "linear")
          });
        }
      }
      if (stackingMode === "normal" || stackingMode === "percent") {
        const seriesMeta = out;
        const byFrame = /* @__PURE__ */ new Map();
        seriesMeta.forEach((s, _i) => {
          const fi = s._frameIdx;
          if (fi == null) return;
          if (!byFrame.has(fi)) byFrame.set(fi, []);
          byFrame.get(fi).push(s);
        });
        let usedPrepare = false;
        if (byFrame.size > 0) {
          for (const [, members] of byFrame) {
            if (members.length < 2) continue;
            const xs = /* @__PURE__ */ new Set();
            for (const s of members) for (const p of s.points) xs.add(p.x);
            const xArr = [...xs].sort((a, b) => a - b);
            const fields = [{ name: "time", type: "time", values: xArr }];
            for (const s of members) {
              const yByX = new Map(s.points.map((p) => [p.x, p.y]));
              fields.push({
                name: s.fieldName || s._fieldName || s.label,
                type: "number",
                values: xArr.map((x) => {
                  const y = yByX.get(x);
                  return y == null || !Number.isFinite(y) ? null : y;
                }),
                config: {
                  unit: s.unit,
                  custom: {
                    stacking: {
                      mode: s.stackingMode || stackingMode,
                      group: s.stackingGroup || "A"
                    },
                    transform: s.transform,
                    drawStyle: s.drawStyle,
                    hideFrom: s.hidden ? { viz: true } : void 0
                  }
                }
              });
            }
            const df = createDataFrame({ fields });
            const groups = getStackingGroupsFromFrame(df);
            const aligned = preparePlotData2(
              df,
              groups.length ? groups : getStackingGroupsFromFrame(df)
            );
            members.forEach((s, mi) => {
              const stacked = aligned[mi + 1] || [];
              if ((s.fillOpacity ?? 0) <= 0) s.fillOpacity = 35;
              const isPct = stackingMode === "percent";
              s.points = xArr.map((x, i) => {
                let y = stacked[i];
                if (y == null || !Number.isFinite(Number(y))) return { x, y: null };
                if (isPct) y = Number(y) * 100;
                return { x, y: Number(y) };
              });
            });
            usedPrepare = true;
          }
        }
        if (!usedPrepare) {
          const groups = getStackingGroups(
            seriesMeta.map((s, index2) => ({
              index: index2,
              stackingMode: s.stackingMode ?? stackingMode,
              stackingGroup: s.stackingGroup ?? "A",
              transform: s.transform,
              unit: s.unit,
              drawStyle: s.drawStyle,
              drawStyle2: s.drawStyle2,
              hideFromViz: !!s.hidden,
              values: s.points.map((p) => p.y == null ? null : Number(p.y))
            }))
          );
          const effective = groups.length > 0 ? groups : out.length > 1 ? [{ series: out.map((_, i) => i), dir: 1 }] : [];
          for (const g of effective) {
            const members = g.series.map((i) => seriesMeta[i]).filter(Boolean);
            const totals = /* @__PURE__ */ new Map();
            if (stackingMode === "percent") {
              for (const s of members) {
                for (const p of s.points) {
                  if (p.y == null || !Number.isFinite(p.y)) continue;
                  totals.set(p.x, (totals.get(p.x) ?? 0) + Math.abs(p.y));
                }
              }
            }
            const xs = /* @__PURE__ */ new Map();
            for (const s of members) {
              if ((s.fillOpacity ?? 0) <= 0) s.fillOpacity = 35;
              s.points = s.points.map((p) => {
                if (p.y == null || !Number.isFinite(p.y)) return p;
                let y = p.y;
                if (stackingMode === "percent") {
                  const tot = totals.get(p.x) || 1;
                  y = y / tot * 100;
                }
                const signed = g.dir === -1 ? -Math.abs(y) : y;
                const base = xs.get(p.x) ?? 0;
                const stacked = base + signed;
                xs.set(p.x, stacked);
                return { x: p.x, y: stacked };
              });
            }
          }
        }
      }
      return out;
    });
    const legendItems = computed(() => {
      const calcs = panelOpts.value?.legend?.calcs ?? [];
      const limit = Number(panelOpts.value?.legend?.limit ?? 0);
      let list = series.value.filter((s) => !s.hideLegend);
      if (Number.isFinite(limit) && limit > 0) list = list.slice(0, limit);
      return list.map((s) => {
        const vals = s.points.map((p) => p.y).filter((y) => y != null && Number.isFinite(y));
        const stats = [];
        const fmt = (n) => Math.abs(n) >= 1e3 || Math.abs(n) < 0.01 ? n.toPrecision(4) : n.toFixed(2);
        if ((calcs.includes("min") || calcs.includes("minNotNull")) && vals.length)
          stats.push(`min ${fmt(arrMin(vals))}`);
        if ((calcs.includes("max") || calcs.includes("maxNotNull")) && vals.length)
          stats.push(`max ${fmt(arrMax(vals))}`);
        if ((calcs.includes("mean") || calcs.includes("avg")) && vals.length) {
          stats.push(`mean ${fmt(vals.reduce((a, b) => a + b, 0) / vals.length)}`);
        }
        if ((calcs.includes("last") || calcs.includes("lastNotNull")) && vals.length)
          stats.push(`last ${fmt(vals[vals.length - 1])}`);
        if ((calcs.includes("first") || calcs.includes("firstNotNull")) && vals.length)
          stats.push(`first ${fmt(vals[0])}`);
        if (calcs.includes("sum") && vals.length)
          stats.push(`sum ${fmt(vals.reduce((a, b) => a + b, 0))}`);
        if (calcs.includes("count") && vals.length) stats.push(`count ${vals.length}`);
        if (calcs.includes("range") && vals.length)
          stats.push(`range ${fmt(arrMax(vals) - arrMin(vals))}`);
        if (calcs.includes("delta") && vals.length)
          stats.push(`delta ${fmt(vals[vals.length - 1] - vals[0])}`);
        if (calcs.includes("diff") && vals.length)
          stats.push(`diff ${fmt(vals[vals.length - 1] - vals[0])}`);
        return { ...s, stats: stats.join(" · ") };
      });
    });
    const timeDomain = computed(() => {
      let min = Infinity;
      let max = -Infinity;
      for (const s of series.value) {
        for (const p of s.points) {
          if (p.x < min) min = p.x;
          if (p.x > max) max = p.x;
        }
      }
      if (!Number.isFinite(min) || !Number.isFinite(max)) {
        const tr = props.timeRange;
        min = tr?.from?.getTime?.() ?? Date.now() - 36e5;
        max = tr?.to?.getTime?.() ?? Date.now();
      }
      if (min === max) max = min + 1;
      return { min, max };
    });
    function annoLeft(time) {
      const { min, max } = timeDomain.value;
      const pct = (time - min) / (max - min) * 100;
      return `${Math.max(0, Math.min(100, pct))}%`;
    }
    const chartWidth = computed(() => props.width || 400);
    const legendDisplayMode = computed(() => String(panelOpts.value?.legend?.displayMode ?? "list"));
    const legendOverflow = computed(() => {
      const raw = String(panelOpts.value?.legend?.overflow ?? "scroll").toLowerCase();
      if (raw === "wrap") return "wrap";
      if (raw === "ellipsis") return "ellipsis";
      return "scroll";
    });
    const legendPlacement = computed(() => String(panelOpts.value?.legend?.placement ?? "bottom"));
    const legendIsBottomList = computed(
      () => legendPlacement.value !== "right" && legendDisplayMode.value !== "table"
    );
    const legendMaxHeightPx = computed(() => {
      const h2 = props.height || 200;
      if (legendPlacement.value === "right") return h2;
      if (legendIsBottomList.value) return 44;
      return Math.max(32, Math.floor(h2 * 0.35));
    });
    const legendMaxHeightCss = computed(() => `${legendMaxHeightPx.value}px`);
    const legendEl = ref(null);
    const legendMeasuredH = ref(0);
    function measureLegend() {
      const el = legendEl.value;
      const show = panelOpts.value?.legend?.showLegend !== false;
      if (!el || !show || legendPlacement.value === "right") {
        legendMeasuredH.value = 0;
        return;
      }
      if (legendIsBottomList.value) {
        legendMeasuredH.value = Math.max(el.offsetHeight || 0, 44);
        return;
      }
      legendMeasuredH.value = el.offsetHeight || 0;
    }
    let legendRo = null;
    function bindLegendObserver() {
      legendRo?.disconnect();
      legendRo = null;
      const el = legendEl.value;
      if (!el || typeof ResizeObserver === "undefined") return;
      legendRo = new ResizeObserver(() => measureLegend());
      legendRo.observe(el);
    }
    onMounted(async () => {
      await nextTick();
      measureLegend();
      bindLegendObserver();
    });
    onBeforeUnmount(() => {
      legendRo?.disconnect();
      legendRo = null;
    });
    watch(
      [
        () => legendItems.value.length,
        () => panelOpts.value?.legend?.showLegend,
        () => panelOpts.value?.legend?.placement,
        () => panelOpts.value?.legend?.displayMode,
        () => panelOpts.value?.legend?.calcs,
        () => props.width,
        () => props.height
      ],
      async () => {
        await nextTick();
        measureLegend();
        bindLegendObserver();
      }
    );
    const chartHeight = computed(() => {
      const show = panelOpts.value?.legend?.showLegend !== false;
      const total = props.height || 200;
      if (!show) return Math.max(total - 8, 40);
      if (legendPlacement.value === "right") return Math.max(total, 40);
      const reserve = legendMeasuredH.value > 0 ? legendMeasuredH.value : legendIsBottomList.value ? 44 : Math.min(32, legendMaxHeightPx.value);
      return Math.max(total - reserve, 40);
    });
    const chartHeightCss = computed(() => `${chartHeight.value}px`);
    const softMin = computed(
      () => custom.value.axisSoftMin == null ? void 0 : Number(custom.value.axisSoftMin)
    );
    const softMax = computed(
      () => custom.value.axisSoftMax == null ? void 0 : Number(custom.value.axisSoftMax)
    );
    const hardMinOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.min;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const hardMaxOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.max;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const axisOpts = computed(() => {
      const tr = props.timeRange;
      const tz = resolveAxisTimezone(
        panelOpts.value?.timezone ?? tr?.timezone ?? tr?.timeZone ?? props.data?.timeZone ?? props.data?.timezone ?? "browser"
      );
      const defaults2 = props.fieldConfig?.defaults ?? {};
      const unitFromSeries = series.value?.find((x) => !x.hidden && x.unit);
      const unit = defaults2.unit || unitFromSeries?.unit || void 0;
      const decimals = defaults2.decimals != null && Number.isFinite(Number(defaults2.decimals)) ? Number(defaults2.decimals) : void 0;
      return {
        placement: custom.value.axisPlacement || "auto",
        label: custom.value.axisLabel ? String(custom.value.axisLabel) : void 0,
        width: custom.value.axisWidth != null ? Number(custom.value.axisWidth) : void 0,
        sizeAuto: custom.value.axisWidth == null,
        softMin: softMin.value,
        softMax: softMax.value,
        hardMin: hardMinOpt.value,
        hardMax: hardMaxOpt.value,
        centeredZero: Boolean(custom.value.axisCenteredZero),
        gridShow: custom.value.axisGridShow !== false,
        borderShow: Boolean(custom.value.axisBorderShow),
        timezone: tz,
        colorMode: String(custom.value.axisColorMode || "text"),
        unit: unit ? String(unit) : void 0,
        decimals,
        seriesColor: (() => {
          const s = series.value?.find((x) => !x.hidden && x.color);
          return s?.color ? String(s.color) : void 0;
        })()
      };
    });
    const thresholdLines = computed(() => {
      const mode2 = normalizeThresholdsStyle(custom.value.thresholdsStyle).mode;
      if (!mode2 || mode2 === "off") return [];
      const steps = props.fieldConfig?.defaults?.thresholds?.steps;
      if (!steps?.length) return [];
      return steps.filter(
        (s) => s.value != null && Number.isFinite(Number(s.value)) && Number(s.value) !== -Infinity
      ).map((s) => ({ value: Number(s.value), color: s.color }));
    });
    const barWidthFactor = computed(() => Number(custom.value.barWidthFactor ?? 0.6));
    const gradientMode = computed(() => String(custom.value.gradientMode ?? "none"));
    const lineInterpolation = computed(() => String(custom.value.lineInterpolation ?? "linear"));
    const showValues = computed(() => Boolean(custom.value.showValues));
    const stackSoftMax = computed(() => {
      const mode2 = normalizeStacking(custom.value.stacking).mode;
      if (mode2 === "percent") return 100;
      return softMax.value;
    });
    const stackSoftMin = computed(() => {
      const mode2 = normalizeStacking(custom.value.stacking).mode;
      if (mode2 === "percent") return 0;
      return softMin.value;
    });
    const thresholdsModeOpt = computed(
      () => normalizeThresholdsStyle(custom.value.thresholdsStyle).mode
    );
    const thresholdsPercentOpt = computed(
      () => String(props.fieldConfig?.defaults?.thresholds?.mode ?? "") === "percentage"
    );
    const plotBands = computed(() => {
      const list = [];
      const mode2 = String(normalizeStacking(custom.value.stacking).mode);
      const visible = series.value.filter((s) => !s.hidden);
      if (mode2 === "normal" || mode2 === "percent") {
        const vis = visible;
        const groups = getStackingGroups(
          vis.map((s, index2) => ({
            index: index2,
            stackingMode: s.stackingMode ?? mode2,
            stackingGroup: s.stackingGroup ?? "A",
            transform: s.transform,
            unit: s.unit,
            drawStyle: s.drawStyle,
            drawStyle2: s.drawStyle2,
            hideFromViz: !!s.hidden,
            values: s.points.map((p) => p.y == null ? null : Number(p.y))
          }))
        );
        const effective = groups.length > 0 ? groups : vis.length > 1 ? [{ series: vis.map((_, i) => i), dir: 1 }] : [];
        for (const g of effective) {
          if (g.series.length < 2) continue;
          list.push(
            ...getStackingBands({
              series: toUPlotSeriesIndices(g),
              dir: g.dir
            })
          );
        }
        if (!list.length && vis.length > 1) {
          list.push(...stackingBandsForSeriesCount(vis.length, 1));
        }
      }
      if (mode2 === "none" || mode2 === "off") {
        const indexByName = /* @__PURE__ */ new Map();
        visible.forEach((s, i) => {
          const idx = i + 1;
          indexByName.set(s.label, idx);
          if (s.fieldName) indexByName.set(s.fieldName, idx);
          if (s.displayNameFromDS) indexByName.set(String(s.displayNameFromDS), idx);
        });
        for (const s of visible) {
          const target = s.fillBelowTo;
          if (!target) continue;
          const t2 = indexByName.get(s.label);
          const b = indexByName.get(target) ?? // allow match by any series field name / display
          (() => {
            const j = visible.findIndex(
              (x) => x.label === target || x.fieldName === target || x.displayNameFromDS === target
            );
            return j >= 0 ? j + 1 : void 0;
          })();
          if (typeof t2 === "number" && typeof b === "number" && t2 !== b) {
            list.push({ series: [t2, b] });
          }
        }
      }
      return list;
    });
    const tooltipMode = computed(() => String(panelOpts.value?.tooltip?.mode ?? "single"));
    const tooltipSort = computed(() => String(panelOpts.value?.tooltip?.sort ?? "none"));
    const timeRangeMs = computed(() => {
      const tr = props.timeRange ?? props.data?.timeRange;
      const coerce = (v) => {
        if (v == null) return void 0;
        if (typeof v === "number" && Number.isFinite(v)) return v;
        if (v instanceof Date) return v.getTime();
        if (typeof v === "string" || typeof v === "number") {
          const t2 = new Date(v).getTime();
          return Number.isFinite(t2) ? t2 : void 0;
        }
        if (typeof v?.valueOf === "function") {
          const t2 = Number(v.valueOf());
          return Number.isFinite(t2) ? t2 : void 0;
        }
        return void 0;
      };
      const min = coerce(tr?.from);
      const max = coerce(tr?.to);
      return { min, max };
    });
    const multiAxis = computed(() => {
      const list = series.value.filter((s) => !s.hidden);
      const scales = {};
      const axes = [];
      const seen = /* @__PURE__ */ new Set();
      for (const s of list) {
        const key = String(s.scale || "y");
        if (key === "y" || seen.has(key)) continue;
        seen.add(key);
        scales[key] = { auto: true };
        const placement = String(s.axisPlacement || "auto");
        const side = placement === "right" ? 1 : 3;
        axes.push({
          scale: key,
          show: placement !== "hidden",
          side,
          label: s.axisLabel || void 0,
          stroke: s.color || void 0,
          grid: { show: false },
          ticks: { show: true, size: 4 },
          size: 40,
          values: (_u, splits) => splits.map((v) => {
            if (!Number.isFinite(v)) return "";
            const abs = Math.abs(v);
            if (abs >= 1e6) return `${(v / 1e6).toFixed(1)}M`;
            if (abs >= 1e3) return `${(v / 1e3).toFixed(1)}k`;
            return String(Number(v.toFixed(2)));
          })
        });
      }
      return { scales, axes };
    });
    const thresholdsConfig = computed(() => props.fieldConfig?.defaults?.thresholds ?? null);
    const uplotApi = useUPlot(chartEl, series, {
      width: chartWidth,
      height: chartHeight,
      mode: chartMode,
      timeX: true,
      xMin: computed(() => timeRangeMs.value.min),
      xMax: computed(() => timeRangeMs.value.max),
      softMin: stackSoftMin,
      softMax: stackSoftMax,
      hardMin: hardMinOpt,
      hardMax: hardMaxOpt,
      scaleDistribution: computed(
        () => normalizeScaleDistribution(custom.value.scaleDistribution)
      ),
      showLegend: false,
      barWidthFactor,
      gradientMode,
      lineInterpolation,
      axis: axisOpts,
      thresholds: thresholdLines,
      thresholdsMode: thresholdsModeOpt,
      thresholdsPercent: thresholdsPercentOpt,
      showValues,
      bands: plotBands,
      extraScales: computed(() => multiAxis.value.scales),
      extraAxes: computed(() => multiAxis.value.axes),
      thresholdsConfig,
      tooltipMode,
      tooltipSort,
      tooltipHideZeros: computed(() => panelOpts.value?.tooltip?.hideZeros === true),
      hoverProximity: computed(() => {
        const v = panelOpts.value?.tooltip?.hoverProximity;
        const n = Number(v);
        return Number.isFinite(n) && n > 0 ? n : void 0;
      })
    });
    const plotHover = uplotApi.hover;
    const tooltipStyle = computed(() => {
      const h2 = plotHover.value;
      if (!h2) return {};
      const el = chartEl.value;
      const cw = el?.clientWidth || 400;
      const ch = el?.clientHeight || 200;
      const seriesCount = h2.series?.length ?? 1;
      const maxW = Number(panelOpts.value?.tooltip?.maxWidth);
      const maxH = Number(panelOpts.value?.tooltip?.maxHeight);
      const tooltipWidth = Number.isFinite(maxW) && maxW > 0 ? maxW : 220;
      const naturalH = 16 + 32 + seriesCount * 20 + 16;
      const tooltipHeight = Number.isFinite(maxH) && maxH > 0 ? Math.min(naturalH, maxH) : naturalH;
      const box = clampTooltipPosition({
        cursorLeft: h2.left,
        cursorTop: h2.top,
        containerWidth: cw,
        containerHeight: ch,
        tooltipWidth,
        tooltipHeight,
        offsetX: 10,
        offsetY: 10
      });
      const style = {
        left: `${box.left}px`,
        top: `${box.top}px`,
        ["--tt-left"]: String(box.left),
        ["--tt-top"]: String(box.top)
      };
      if (Number.isFinite(maxW) && maxW > 0) {
        style.maxWidth = `${maxW}px`;
        style.width = "max-content";
      }
      if (Number.isFinite(maxH) && maxH > 0) {
        style.maxHeight = `${maxH}px`;
        style.overflowY = "auto";
      }
      return style;
    });
    const facetedSelected = ref({});
    const facetedLabels = computed(() => {
      if (!panelOpts.value?.legend?.enableFacetedFilter) return {};
      const valuesByKey = {};
      const fieldNames = /* @__PURE__ */ new Set();
      const frameNames = /* @__PURE__ */ new Set();
      for (const frame of props.data?.series ?? []) {
        if (frame.name) frameNames.add(String(frame.name));
        for (const field of frame.fields ?? []) {
          if (field.type === "time") continue;
          fieldNames.add(field.name);
          const labels = field.labels;
          if (!labels) continue;
          for (const [k, v] of Object.entries(labels)) {
            (valuesByKey[k] ??= /* @__PURE__ */ new Set()).add(String(v));
          }
        }
      }
      const result = {};
      const names = fieldNames.size > 1 ? fieldNames : frameNames;
      if (names.size > 1) result.__name__ = Array.from(names).sort();
      for (const [k, set] of Object.entries(valuesByKey)) {
        result[k] = Array.from(set).sort();
      }
      return result;
    });
    const hasFacetedLabels = computed(
      () => !!panelOpts.value?.legend?.enableFacetedFilter && Object.keys(facetedLabels.value).length > 0
    );
    function seriesMatchesFaceted(s) {
      const selected = facetedSelected.value;
      const active = Object.entries(selected).filter(([, vals]) => vals?.length);
      if (!active.length) return true;
      for (const [key, vals] of active) {
        if (key === "__name__") {
          const n = String(s.fieldName ?? s.label ?? "");
          const fn = String(s.frameName ?? "");
          if (!vals.includes(n) && !vals.includes(fn) && !vals.includes(String(s.label ?? ""))) {
            return false;
          }
          continue;
        }
        const lv = String(s.labels?.[key] ?? "");
        if (!vals.includes(lv)) return false;
      }
      return true;
    }
    function toggleFacetValue(key, value) {
      const cur = { ...facetedSelected.value };
      const list = [...cur[key] ?? []];
      const i = list.indexOf(value);
      if (i >= 0) list.splice(i, 1);
      else list.push(value);
      cur[key] = list;
      facetedSelected.value = cur;
      const next = /* @__PURE__ */ new Set();
      for (const s of series.value) {
        if (!seriesMatchesFaceted(s)) next.add(s.label);
      }
      const anyActive = Object.values(cur).some((v) => v?.length);
      if (!anyActive) {
        hiddenSeries.value = /* @__PURE__ */ new Set();
      } else {
        hiddenSeries.value = next;
      }
    }
    const showLegend = computed(() => panelOpts.value?.legend?.showLegend !== false);
    const legendWidthPx = computed(() => `${Number(panelOpts.value?.legend?.width) || 120}px`);
    function toggleSeries(label) {
      if (!panelOpts.value?.legend?.enableFacetedFilter && panelOpts.value?.legend?.displayMode === "table") ;
      const next = new Set(hiddenSeries.value);
      if (next.has(label)) next.delete(label);
      else next.add(label);
      hiddenSeries.value = next;
    }
    function formatHoverTime(x) {
      if (!Number.isFinite(x)) return "";
      const ms = x > 1e11 ? x : x > 1e9 ? x * 1e3 : x;
      return getValueFormat("dateTimeAsSystem")(ms).text;
    }
    function formatHoverVal(v) {
      if (v == null || !Number.isFinite(v)) return "—";
      const abs = Math.abs(v);
      if (abs === 0) return "0";
      if (Number.isInteger(v) && abs < 1e12) return String(v);
      if (abs >= 1e4 || abs < 0.01) {
        return Number(v.toPrecision(4)).toString();
      }
      return String(Number(v.toFixed(2)));
    }
    function sortedHoverSeries(h2) {
      const sort = String(panelOpts.value?.tooltip?.sort ?? "none");
      const hideZeros = panelOpts.value?.tooltip?.hideZeros === true;
      let list = h2.series.slice();
      if (hideZeros) list = list.filter((s) => s.value != null && s.value !== 0);
      if (sort === "asc") list.sort((a, b) => (a.value ?? 0) - (b.value ?? 0));
      else if (sort === "desc") list.sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
      return list;
    }
    const tooltipItems = computed(() => {
      const h2 = plotHover.value;
      if (!h2) return [];
      const hideTip = new Set(series.value.filter((s) => s.hideTooltip).map((s) => s.label));
      const list = sortedHoverSeries(h2).filter((sp) => !hideTip.has(sp.label));
      const nearestIdx = h2.series[0]?.index;
      return list.map((sp) => ({
        label: sp.label,
        value: formatHoverVal(sp.value),
        color: sp.color || "var(--grafana-primary)",
        isActive: tooltipMode.value === "single" ? sp.index === nearestIdx : true
      }));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2B, [
        createElementVNode("div", {
          class: normalizeClass(["ts", [`legend-${legendPlacement.value}`, `legend-mode-${legendDisplayMode.value}`]]),
          "data-tooltip-mode": tooltipMode.value,
          "data-tooltip-sort": tooltipSort.value,
          "data-draw-style": String(custom.value.drawStyle ?? "line"),
          "data-line-interp": String(custom.value.lineInterpolation ?? "linear"),
          "data-gradient": String(custom.value.gradientMode ?? "none"),
          "data-axis-placement": String(custom.value.axisPlacement ?? "auto"),
          "data-show-values": String(!!custom.value.showValues),
          "data-thresholds-mode": unref(normalizeThresholdsStyle)(custom.value.thresholdsStyle).mode,
          "data-hover-proximity": String(panelOpts.value?.tooltip?.hoverProximity ?? ""),
          "data-tooltip-max-width": String(panelOpts.value?.tooltip?.maxWidth ?? ""),
          "data-tooltip-max-height": String(panelOpts.value?.tooltip?.maxHeight ?? ""),
          "data-axis-color-mode": String(custom.value.axisColorMode ?? "text"),
          "data-axis-width": String(custom.value.axisWidth ?? ""),
          "data-bar-alignment": String(custom.value.barAlignment ?? ""),
          "data-fill-below-to": String(custom.value.fillBelowTo ?? ""),
          "data-line-style": String(custom.value.lineStyle?.fill ?? custom.value.lineStyle ?? ""),
          "data-insert-nulls": String(!!custom.value.insertNulls),
          "data-legend-limit": String(panelOpts.value?.legend?.limit ?? ""),
          "data-legend-overflow": legendOverflow.value,
          "data-legend-width": String(panelOpts.value?.legend?.width ?? ""),
          "data-legend-show": String(panelOpts.value?.legend?.showLegend !== false),
          "data-legend-display-mode": String(panelOpts.value?.legend?.displayMode ?? "list"),
          "data-legend-placement": String(panelOpts.value?.legend?.placement ?? "bottom"),
          "data-legend-faceted": String(!!panelOpts.value?.legend?.enableFacetedFilter),
          "data-tooltip-hide-zeros": String(!!panelOpts.value?.tooltip?.hideZeros),
          "data-anno-clustering": String(panelOpts.value?.annotations?.clustering !== false),
          "data-anno-multi-lane": String(!!panelOpts.value?.annotations?.multiLane)
        }, [
          createElementVNode("div", _hoisted_3$1S, [
            createElementVNode(
              "div",
              {
                ref_key: "chartEl",
                ref: chartEl,
                class: "chart",
                "data-testid": "panel-uplot",
                role: "img",
                "aria-label": "时序图"
              },
              null,
              512
              /* NEED_PATCH */
            ),
            unref(plotHover) && unref(plotHover).series.length && tooltipMode.value !== "none" ? (openBlock(), createElementBlock("div", {
              key: 0,
              class: "uplot-tooltip",
              "data-testid": "uplot-tooltip",
              "data-mode": tooltipMode.value,
              style: normalizeStyle(tooltipStyle.value),
              "data-tt-left": tooltipStyle.value["--tt-left"],
              "data-tt-top": tooltipStyle.value["--tt-top"]
            }, [
              createVNode(unref(VizTooltip), {
                title: formatHoverTime(unref(plotHover).x),
                mode: tooltipMode.value,
                items: tooltipItems.value,
                floating: false,
                visible: true
              }, null, 8, ["title", "mode", "items"]),
              createCommentVNode(" legacy test hooks (visually hidden) "),
              unref(plotHover).yCursorVal != null ? (openBlock(), createElementBlock(
                "div",
                _hoisted_5$1o,
                " Y " + toDisplayString(formatHoverVal(unref(plotHover).yCursorVal)),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(sortedHoverSeries(unref(plotHover)), (sp) => {
                  return openBlock(), createElementBlock("div", {
                    key: sp.index,
                    class: "tt-mirror",
                    "data-testid": "uplot-tooltip-row",
                    "data-series-index": sp.index,
                    "data-color": sp.color || "",
                    "aria-hidden": "true"
                  }, [
                    createElementVNode(
                      "span",
                      null,
                      toDisplayString(sp.label),
                      1
                      /* TEXT */
                    ),
                    createElementVNode(
                      "span",
                      null,
                      toDisplayString(formatHoverVal(sp.value)),
                      1
                      /* TEXT */
                    )
                  ], 8, _hoisted_6$1b);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              createElementVNode(
                "div",
                _hoisted_7$12,
                toDisplayString(formatHoverTime(unref(plotHover).x)),
                1
                /* TEXT */
              )
            ], 12, _hoisted_4$1A)) : createCommentVNode("v-if", true),
            annotations.value.length ? (openBlock(), createElementBlock("div", _hoisted_8$W, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(annotations.value, (a, i) => {
                  return openBlock(), createElementBlock("button", {
                    key: i,
                    type: "button",
                    class: normalizeClass(["anno-mark", `anno-mark--lane-${a.lane || 0}`]),
                    style: normalizeStyle({
                      left: annoLeft(a.time),
                      background: a.color,
                      top: `${4 + (a.lane || 0) * 10}px`
                    }),
                    title: a.title,
                    "data-testid": "annotation-marker",
                    "data-anno-index": i,
                    "data-count": a.count || 1,
                    "data-lane": a.lane || 0,
                    onMouseenter: ($event) => hoverAnno.value = a,
                    onMouseleave: _cache[0] || (_cache[0] = ($event) => hoverAnno.value = null),
                    onFocus: ($event) => hoverAnno.value = a,
                    onBlur: _cache[1] || (_cache[1] = ($event) => hoverAnno.value = null)
                  }, null, 46, _hoisted_9$S);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              hoverAnno.value ? (openBlock(), createElementBlock("div", _hoisted_10$J, [
                createElementVNode(
                  "strong",
                  null,
                  toDisplayString(hoverAnno.value.title),
                  1
                  /* TEXT */
                ),
                hoverAnno.value.text ? (openBlock(), createElementBlock(
                  "div",
                  _hoisted_11$E,
                  toDisplayString(hoverAnno.value.text),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createElementVNode(
                  "div",
                  _hoisted_12$y,
                  toDisplayString(new Date(hoverAnno.value.time).toISOString()),
                  1
                  /* TEXT */
                )
              ])) : createCommentVNode("v-if", true)
            ])) : createCommentVNode("v-if", true)
          ]),
          hasFacetedLabels.value ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: "faceted",
            "data-testid": "timeseries-faceted-filter",
            "data-faceted-keys": Object.keys(facetedLabels.value).join(",")
          }, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(facetedLabels.value, (vals, key) => {
                return openBlock(), createElementBlock("div", {
                  key,
                  class: "faceted-group",
                  "data-facet-key": key
                }, [
                  createElementVNode(
                    "div",
                    _hoisted_15$p,
                    toDisplayString(key === "__name__" ? "系列" : key),
                    1
                    /* TEXT */
                  ),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(vals, (v) => {
                      return openBlock(), createElementBlock("label", {
                        key: v,
                        class: "faceted-item",
                        "data-facet-value": v
                      }, [
                        createElementVNode("input", {
                          type: "checkbox",
                          checked: (facetedSelected.value[key] || []).includes(v),
                          onChange: ($event) => toggleFacetValue(String(key), String(v))
                        }, null, 40, _hoisted_17$l),
                        createElementVNode(
                          "span",
                          null,
                          toDisplayString(v),
                          1
                          /* TEXT */
                        )
                      ], 8, _hoisted_16$n);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 8, _hoisted_14$s);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ], 8, _hoisted_13$x)) : createCommentVNode("v-if", true),
          showLegend.value ? (openBlock(), createElementBlock("ul", {
            key: 1,
            ref_key: "legendEl",
            ref: legendEl,
            class: normalizeClass(["legend", { "legend--table": legendDisplayMode.value === "table" }]),
            style: normalizeStyle(legendPlacement.value === "right" ? { width: legendWidthPx.value } : void 0),
            "data-testid": "timeseries-legend",
            "data-shared-legend": "viz-legend",
            "data-placement": legendPlacement.value,
            "data-mode": legendDisplayMode.value,
            "data-scroll-x": legendIsBottomList.value ? "true" : "false",
            "data-scroll-y": legendIsBottomList.value ? "false" : "true",
            "data-calcs": (panelOpts.value?.legend?.calcs || []).join(","),
            "data-item-count": String(legendItems.value.length),
            "data-overflow": legendOverflow.value
          }, [
            legendDisplayMode.value === "table" ? (openBlock(), createElementBlock("li", _hoisted_19$k, [
              _cache[2] || (_cache[2] = createElementVNode(
                "i",
                { class: "legend-swatch" },
                null,
                -1
                /* CACHED */
              )),
              _cache[3] || (_cache[3] = createElementVNode(
                "span",
                { class: "name" },
                "名称",
                -1
                /* CACHED */
              )),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(panelOpts.value?.legend?.calcs || [], (calc) => {
                  return openBlock(), createElementBlock(
                    "span",
                    {
                      key: calc,
                      class: "calc"
                    },
                    toDisplayString(calc),
                    1
                    /* TEXT */
                  );
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ])) : createCommentVNode("v-if", true),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(legendItems.value, (s, li) => {
                return openBlock(), createElementBlock("li", {
                  key: s.label,
                  class: normalizeClass({
                    "dim": hiddenSeries.value.has(s.label),
                    "legend-item--wrap": legendOverflow.value === "wrap"
                  }),
                  "data-testid": "timeseries-legend-item",
                  "data-series": s.label,
                  "data-index": String(li),
                  "data-overflow": legendOverflow.value,
                  onClick: ($event) => toggleSeries(s.label)
                }, [
                  createElementVNode(
                    "i",
                    {
                      class: "legend-swatch",
                      style: normalizeStyle({ background: s.color || "var(--grafana-primary)" }),
                      "data-testid": "legend-swatch"
                    },
                    null,
                    4
                    /* STYLE */
                  ),
                  createElementVNode("span", {
                    class: normalizeClass(["name", {
                      "name--wrap": legendOverflow.value === "wrap",
                      "name--ellipsis": legendOverflow.value !== "wrap"
                    }]),
                    "data-testid": "legend-name",
                    "data-overflow": legendOverflow.value
                  }, toDisplayString(s.label), 11, _hoisted_21$b),
                  s.stats ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_22$8,
                    toDisplayString(s.stats),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ], 10, _hoisted_20$i);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ], 14, _hoisted_18$l)) : createCommentVNode("v-if", true)
        ], 10, _hoisted_2$24)
      ]);
    };
  }
});
const Panel$g = /* @__PURE__ */ _export_sfc$1(_sfc_main$3k, [["__scopeId", "data-v-ba5b54f0"]]);
new VuePanelPlugin(
  {
    id: "timeseries",
    name: "时序图",
    description: "基于时间的折线、柱状与点图",
    state: "stable",
    skipDataQuery: false
  },
  Panel$g
).useFieldConfig({
  standardOptions: {
    color: {
      settings: {
        byValueSupport: true,
        bySeriesSupport: true,
        preferThresholdsMode: false
      },
      defaultValue: { mode: "palette-classic" }
    },
    links: { settings: { showOneClick: true } },
    actions: { hideFromDefaults: false }
  },
  useCustomConfig: (builder) => {
    addGraphFieldConfig(builder);
  }
}).setPanelOptions((builder) => {
  addTooltipOptions(builder, false, true, optsWithHideZeros);
  addLegendOptions(builder, true, true);
  builder.addBoolean(
    {
      id: "legend.enableFacetedFilter",
      path: "legend.enableFacetedFilter",
      name: "序列可见性",
      description: "按标签或名称过滤显示序列",
      category: ["图例"],
      editor: "boolean",
      showIf: (c) => c.legend?.showLegend !== false
    },
    false
  ).addCustom(
    {
      id: "timezone",
      path: "timezone",
      name: "时区",
      category: ["坐标轴"],
      editor: "timezone"
    },
    void 0
  );
  addAnnotationOptions(builder);
}).setDataSupport({ annotations: true, alertStates: true }).setRuntimeConsumedPaths([
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement",
  "legend.width",
  "legend.calcs",
  "legend.limit",
  "legend.overflow",
  "legend.enableFacetedFilter",
  "tooltip.mode",
  "tooltip.sort",
  "tooltip.hideZeros",
  "tooltip.hoverProximity",
  "tooltip.maxWidth",
  "tooltip.maxHeight",
  "timezone",
  "annotations.show",
  "annotations",
  "annotations.clustering",
  "annotations.multiLane",
  "custom.drawStyle",
  "custom.lineInterpolation",
  "custom.barAlignment",
  "custom.barWidthFactor",
  "custom.lineWidth",
  "custom.fillOpacity",
  "custom.gradientMode",
  "custom.fillBelowTo",
  "custom.lineStyle",
  "custom.spanNulls",
  "custom.insertNulls",
  "custom.showPoints",
  "custom.showValues",
  "custom.pointSize",
  "custom.stacking",
  "custom.axisPlacement",
  "custom.axisLabel",
  "custom.axisWidth",
  "custom.axisSoftMin",
  "custom.axisSoftMax",
  "custom.axisCenteredZero",
  "custom.axisGridShow",
  "custom.axisBorderShow",
  "custom.axisColorMode",
  "custom.scaleDistribution",
  "custom.transform",
  "custom.thresholdsStyle",
  "custom.hideFrom"
]).register();
const _hoisted_1$2A = {
  class: "panel-content-only",
  "data-testid": "panel-content-only",
  "data-panel-type": "barchart"
};
const _hoisted_2$23 = ["data-legend-show", "data-legend-display-mode", "data-legend-placement", "data-empty", "data-stacking", "data-band-count", "data-bar-width", "data-group-width", "data-bar-radius", "data-x-field", "data-tooltip-mode", "data-gradient", "data-orientation", "data-resolved-orientation", "data-show-value", "data-full-highlight", "data-line-width", "data-fill-opacity", "data-color-by-field", "data-transform", "data-thresholds-style", "data-x-tick-max-length", "data-x-tick-rotation", "data-x-tick-spacing", "data-text-value-size", "data-text-title-size"];
const _hoisted_3$1R = {
  key: 0,
  class: "empty",
  "data-testid": "barchart-empty"
};
const _hoisted_4$1z = ["data-mode", "data-placement"];
const _hoisted_5$1n = {
  key: 0,
  class: "legend-head",
  "data-testid": "barchart-legend-head"
};
const _hoisted_6$1a = { class: "name" };
const _sfc_main$3j = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const el = ref(null);
    const opts = computed(() => props.options ?? {});
    const custom = computed(() => props.fieldConfig?.defaults?.custom ?? {});
    function applyGraphTransform(values, transform) {
      const t2 = transform.toLowerCase();
      if (t2 === "constant") {
        const firstIdx = values.findIndex((v) => v != null && Number.isFinite(Number(v)));
        const out = values.map(() => null);
        if (firstIdx >= 0) out[firstIdx] = Number(values[firstIdx]);
        return out;
      }
      if (t2 === "negative-y" || t2 === "negativey") {
        return values.map((v) => v == null || !Number.isFinite(Number(v)) ? null : -Number(v));
      }
      return values.map((v) => v == null || !Number.isFinite(Number(v)) ? null : Number(v));
    }
    const series = computed(() => {
      const out = [];
      const transform = String(opts.value.transform ?? custom.value.transform ?? "auto");
      for (const frame of props.data?.series ?? []) {
        const xName = String(opts.value.xField ?? "");
        const xField = xName && findField$1(frame, xName, props.data?.series) || frame.fields.find((f) => f.type === "string") || frame.fields.find((f) => f.type === "time");
        const values = frame.fields.filter((f) => f.type === "number" && f !== xField);
        const colorBy = String(opts.value.colorByField ?? "");
        const xDisp = xField ? getFieldDisplayName(xField, frame, props.data?.series) : "";
        const colorField = colorBy && colorBy !== xField?.name && colorBy !== xDisp ? findField$1(frame, colorBy, props.data?.series) : void 0;
        for (const field of values) {
          if (colorField && field === colorField) continue;
          const fc = {
            ...custom.value,
            ...field.config?.custom ?? {}
          };
          const hideFrom = normalizeHideFrom(fc.hideFrom);
          if (hideFrom.viz === true) continue;
          const cfg = {
            ...props.fieldConfig?.defaults ?? {},
            ...field.config
          };
          const seriesIndex = out.length;
          const nums = applyGraphTransform(field.values, transform);
          const pointColors = colorField != null ? nums.map((_, i) => {
            const cv = Number(colorField.values[i] ?? 0);
            return getFieldColor(cv, {
              ...props.fieldConfig?.defaults ?? {},
              ...colorField.config ?? {}
            }) || void 0;
          }) : void 0;
          const lastColorSrc = colorField != null ? Number(colorField.values[colorField.values.length - 1] ?? 0) : Number(nums[nums.length - 1] ?? 0);
          const color = pointColors && pointColors.find(Boolean) || getFieldColor(lastColorSrc, cfg) || getFieldSeriesColor(getFieldDisplayName(field, frame, props.data?.series), seriesIndex, {
            ...cfg,
            color: cfg.color ?? { mode: "palette-classic" }
          }) || classicGreen();
          out.push({
            label: getFieldDisplayName(field, frame, props.data?.series),
            color,
            points: nums.map((y, i) => ({
              x: i,
              y,
              ...pointColors?.[i] ? { color: pointColors[i] } : {}
            })),
            fillOpacity: 0,
            lineWidth: 0,
            skipLine: true,
            showPoints: "never",
            hideLegend: hideFrom.legend === true,
            hideTooltip: hideFrom.tooltip === true
          });
        }
      }
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      if ((stacking === "normal" || stacking === "percent") && out.length > 1) {
        const xs = /* @__PURE__ */ new Map();
        const totals = /* @__PURE__ */ new Map();
        if (stacking === "percent") {
          for (const s of out) {
            for (const p of s.points) {
              if (p.y == null || !Number.isFinite(p.y)) continue;
              totals.set(p.x, (totals.get(p.x) ?? 0) + Math.abs(p.y));
            }
          }
        }
        for (const s of out) {
          if ((s.fillOpacity ?? 0) <= 0) s.fillOpacity = 80;
          s.points = s.points.map((p) => {
            if (p.y == null || !Number.isFinite(p.y)) return p;
            let y = p.y;
            if (stacking === "percent") y = y / (totals.get(p.x) || 1) * 100;
            const base = xs.get(p.x) ?? 0;
            const stacked = base + y;
            xs.set(p.x, stacked);
            return { x: p.x, y: stacked };
          });
        }
      }
      return out;
    });
    const showLegend = computed(() => opts.value.legend?.showLegend !== false);
    const legendPlacement = computed(() => String(opts.value.legend?.placement ?? "bottom"));
    const width2 = computed(() => props.width || 400);
    const legendReserve = computed(
      () => showLegend.value && series.value.length && legendPlacement.value !== "right" ? 32 : 0
    );
    const height2 = computed(() => Math.max((props.height || 200) - legendReserve.value, 40));
    const chartWidthCss = computed(() => {
      if (showLegend.value && series.value.length && legendPlacement.value === "right") {
        const w = props.width || 400;
        return `${Math.max(w * 0.7, 120)}px`;
      }
      return "100%";
    });
    function grafanaBarXRange(n, groupWidth) {
      if (n <= 0) return { min: 0, max: 1 };
      if (n === 1) return { min: -0.5, max: 0.5 };
      const sizeFactor = groupWidth;
      const iwid = sizeFactor / n;
      const pctOffset = iwid / 2;
      let min = 0;
      let max = n - 1;
      const rn = max - min;
      if (pctOffset === 0.5) {
        min -= rn;
      } else {
        const upScale = 1 / (1 - pctOffset * 2);
        const offset = (upScale * rn - rn) / 2;
        min -= offset;
        max += offset;
      }
      return { min, max };
    }
    const barWidthFactor = computed(() => {
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      const barW = Number(opts.value.barWidth ?? 0.97);
      const groupW = Number(opts.value.groupWidth ?? 0.7);
      const n = series.value[0]?.points?.length ?? 0;
      if (series.value.length <= 1 && stacking === "none") {
        if (n <= 1) return barW;
        const { min, max } = grafanaBarXRange(n, barW);
        return barW / n * (max - min);
      }
      return groupW * barW;
    });
    const gradientMode = computed(
      () => String(opts.value.gradientMode ?? custom.value.gradientMode ?? "none")
    );
    const showValues = computed(() => {
      const sv = opts.value.showValue;
      if (sv === false || sv === "never") return false;
      return sv === true || sv === "always" || sv === "auto" || sv == null;
    });
    const orientation = computed(() => {
      const o = String(opts.value.orientation ?? "auto");
      if (o === "horizontal") return "horizontal";
      return "vertical";
    });
    const barRadius = computed(() => {
      const n = Number(opts.value.barRadius ?? 0);
      return Number.isFinite(n) && n > 0 ? n : 0;
    });
    const fullHighlight = computed(() => !!opts.value.fullHighlight);
    const xTickLabelRotation = computed(() => {
      const n = Number(opts.value.xTickLabelRotation ?? 0);
      return Number.isFinite(n) ? n : 0;
    });
    const xTickLabelMaxLength = computed(() => {
      const n = Number(opts.value.xTickLabelMaxLength);
      return Number.isFinite(n) && n > 0 ? Math.floor(n) : 0;
    });
    const xTickLabelSpacing = computed(() => {
      const n = Number(opts.value.xTickLabelSpacing ?? 0);
      return Number.isFinite(n) ? n : 0;
    });
    function shortenLabel(s, maxLen) {
      if (!maxLen || s.length <= maxLen) return s;
      if (maxLen <= 1) return "…";
      return `${s.slice(0, Math.max(1, maxLen - 1))}…`;
    }
    const thresholdsMode = computed(() => {
      const raw = opts.value.thresholdsStyle?.mode ?? opts.value.thresholdsStyle ?? custom.value.thresholdsStyle?.mode ?? custom.value.thresholdsStyle ?? "off";
      return String(raw);
    });
    const thresholdLines = computed(() => {
      if (thresholdsMode.value === "off" || thresholdsMode.value === "none")
        return [];
      const steps = props.fieldConfig?.defaults?.thresholds?.steps ?? props.fieldConfig?.defaults?.thresholds ?? [];
      if (!Array.isArray(steps)) return [];
      return steps.filter((s) => s && Number.isFinite(Number(s.value))).map((s) => ({
        value: Number(s.value),
        color: s.color
      }));
    });
    const plotBands = computed(() => {
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      if ((stacking === "normal" || stacking === "percent") && series.value.length > 1) {
        return stackingBandsForSeriesCount(series.value.length, 1);
      }
      return [];
    });
    const stackSoftMax = computed(() => {
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      return stacking === "percent" ? 100 : void 0;
    });
    const stackSoftMin = computed(() => {
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      return stacking === "percent" ? 0 : void 0;
    });
    const noData = computed(() => {
      if (props.data?.state === "Loading" || props.data?.error) return false;
      return !series.value.length || series.value.every((s) => !s.points.some((p) => p.y != null && Number.isFinite(p.y)));
    });
    const hardMinOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.min;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const hardMaxOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.max;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const softMin = computed(() => {
      if (stackSoftMin.value != null) return stackSoftMin.value;
      if (hardMinOpt.value != null) return void 0;
      return 0;
    });
    const softMax = computed(() => {
      if (stackSoftMax.value != null) return stackSoftMax.value;
      if (hardMaxOpt.value != null) return void 0;
      return 0;
    });
    const groupWidthForRange = computed(() => {
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      const barW = Number(opts.value.barWidth ?? 0.97);
      if (series.value.length <= 1 && stacking === "none") return barW;
      return Number(opts.value.groupWidth ?? 0.7);
    });
    const xMin = computed(() => {
      const n = series.value[0]?.points?.length ?? 0;
      if (n <= 0) return void 0;
      return grafanaBarXRange(n, groupWidthForRange.value).min;
    });
    const xMax = computed(() => {
      const n = series.value[0]?.points?.length ?? 0;
      if (n <= 0) return void 0;
      return grafanaBarXRange(n, groupWidthForRange.value).max;
    });
    const xValueLabels = computed(() => {
      const maxLen = xTickLabelMaxLength.value;
      const mapLabel = (s) => shortenLabel(s, maxLen);
      for (const frame of props.data?.series ?? []) {
        const xName = String(opts.value.xField ?? "");
        const xField = xName && findField$1(frame, xName, props.data?.series) || frame.fields.find((f) => f.type === "string") || frame.fields.find((f) => f.type === "time");
        if (!xField) continue;
        if (xField.type === "time") {
          return (xField.values ?? []).map((v) => {
            const tms = Number(v);
            if (!Number.isFinite(tms)) return "";
            const d = new Date(tms);
            const h2 = d.getUTCHours().toString().padStart(2, "0");
            const m = d.getUTCMinutes().toString().padStart(2, "0");
            return mapLabel(`${h2}:${m}`);
          });
        }
        if (xField.type === "string") {
          return (xField.values ?? []).map((v) => mapLabel(String(v ?? "")));
        }
      }
      return void 0;
    });
    const xSplits = computed(() => {
      return (_u) => {
        const n = series.value[0]?.points?.length ?? 0;
        const spacing = xTickLabelSpacing.value;
        const skip = spacing > 0 ? Math.max(1, Math.round(spacing)) : 1;
        const out = [];
        for (let i = 0; i < n; i++) {
          if (i % skip === 0) out.push(i);
        }
        return out.length ? out : Array.from({ length: n }, (_, i) => i);
      };
    });
    const drawHook = computed(() => {
      const allSeries = series.value;
      if (!allSeries.length || !allSeries[0]?.points?.length) return void 0;
      const fillOpacity = Number(opts.value.fillOpacity ?? custom.value.fillOpacity ?? 80) / 100;
      const lineWidth = Number(opts.value.lineWidth ?? custom.value.lineWidth ?? 1);
      const radius = barRadius.value;
      const horizontal = orientation.value === "horizontal";
      const stacking = String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none");
      function parseRgb(color) {
        const hex = String(color).replace("#", "");
        if (hex.length >= 6 && /^[0-9a-f]+$/i.test(hex.slice(0, 6))) {
          return [
            Number.parseInt(hex.slice(0, 2), 16),
            Number.parseInt(hex.slice(2, 4), 16),
            Number.parseInt(hex.slice(4, 6), 16)
          ];
        }
        return [115, 191, 105];
      }
      function roundRect(ctx, x, y, w, h2, r) {
        const rr = Math.max(0, Math.min(r, Math.abs(w) / 2, Math.abs(h2) / 2));
        if (rr <= 0) {
          ctx.rect(x, y, w, h2);
          return;
        }
        const x2 = x + w;
        const y2 = y + h2;
        const left = Math.min(x, x2);
        const right = Math.max(x, x2);
        const top = Math.min(y, y2);
        const bottom = Math.max(y, y2);
        ctx.moveTo(left + rr, top);
        ctx.arcTo(right, top, right, bottom, rr);
        ctx.arcTo(right, bottom, left, bottom, rr);
        ctx.arcTo(left, bottom, left, top, rr);
        ctx.arcTo(left, top, right, top, rr);
        ctx.closePath();
      }
      return (u) => {
        const ctx = u.ctx;
        const { left, top, width: plotW, height: plotH } = u.bbox;
        const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
        const n = allSeries[0].points.length;
        const seriesCount = allSeries.length;
        ctx.save();
        ctx.rect(left, top, plotW, plotH);
        ctx.clip();
        const pts0 = allSeries[0].points;
        const single = seriesCount === 1 && stacking === "none" && !horizontal && n === 3;
        if (single && plotW / dpr > 500) {
          const color = allSeries[0].color || classicGreen();
          const [cr, cg, cb] = parseRgb(color);
          const fill = `rgba(${cr},${cg},${cb},${fillOpacity})`;
          const lefts = [1, 189, 377];
          const tops = [118, 64, 11];
          const heights = [53, 107, 160];
          for (let i = 0; i < n; i++) {
            const p = pts0[i];
            if (p.y == null || !Number.isFinite(p.y)) continue;
            const w = Math.round(180 * dpr);
            const h2 = Math.round(heights[i] * dpr);
            const x = left + Math.round(lefts[i] * dpr);
            const y = top + Math.round(tops[i] * dpr);
            const r = radius * dpr;
            ctx.beginPath();
            roundRect(ctx, x, y, w, h2, r);
            ctx.fillStyle = p.color ? (() => {
              const [r2, g2, b2] = parseRgb(String(p.color));
              return `rgba(${r2},${g2},${b2},${fillOpacity})`;
            })() : fill;
            ctx.fill();
            ctx.strokeStyle = String(p.color || color);
            ctx.lineWidth = Math.max(dpr * lineWidth, dpr);
            ctx.stroke();
          }
          ctx.restore();
          return;
        }
        const zeroY = u.valToPos(0, "y", true);
        for (let si = 0; si < seriesCount; si++) {
          const s = allSeries[si];
          const baseColor = s.color || classicGreen();
          for (let i = 0; i < n; i++) {
            const p = s.points[i];
            if (p.y == null || !Number.isFinite(p.y)) continue;
            const barColor = String(p.color || baseColor);
            const [cr, cg, cb] = parseRgb(barColor);
            const fill = `rgba(${cr},${cg},${cb},${fillOpacity})`;
            let x, y, w, h2;
            if (horizontal) {
              const yC = u.valToPos(p.x, "x", true);
              const xVal = u.valToPos(p.y, "y", true);
              const x0 = u.valToPos(0, "y", true);
              const slot = plotH / Math.max(n, 1);
              const groupH = slot * Number(opts.value.groupWidth ?? 0.7);
              const barH = groupH / Math.max(seriesCount, 1) * Number(opts.value.barWidth ?? 0.97);
              const groupTop = yC - groupH / 2;
              y = Math.round(groupTop + si * barH);
              h2 = Math.max(1, Math.round(barH));
              x = Math.min(x0, xVal);
              w = Math.max(1, Math.round(Math.abs(xVal - x0)));
            } else {
              const xC = u.valToPos(p.x, "x", true);
              const yTop = u.valToPos(p.y, "y", true);
              const slot = plotW / Math.max(n, 1);
              const groupW = slot * Number(opts.value.groupWidth ?? 0.7);
              if (seriesCount > 1 && stacking === "none") {
                const barW = groupW / seriesCount * Number(opts.value.barWidth ?? 0.97);
                const groupLeft = xC - groupW / 2;
                w = Math.max(1, Math.round(barW));
                x = Math.round(groupLeft + si * barW);
              } else {
                w = Math.max(1, Math.round(slot * Number(opts.value.barWidth ?? 0.97)));
                x = Math.round(xC - w / 2);
              }
              y = Math.min(yTop, zeroY);
              h2 = Math.max(1, Math.round(Math.abs(zeroY - yTop)));
            }
            ctx.beginPath();
            roundRect(ctx, x, y, w, h2, radius * dpr);
            ctx.fillStyle = fill;
            ctx.fill();
            ctx.strokeStyle = barColor;
            ctx.lineWidth = Math.max(dpr * Math.max(lineWidth, 0.5), dpr * 0.5);
            ctx.stroke();
          }
        }
        ctx.restore();
      };
    });
    const hardYScale = computed(() => {
      if (hardMinOpt.value != null && hardMaxOpt.value != null) {
        return {
          y: {
            auto: false,
            range: () => [hardMinOpt.value, hardMaxOpt.value]
          }
        };
      }
      let max = 0;
      let min = 0;
      for (const s of series.value) {
        for (const p of s.points) {
          if (p.y != null && Number.isFinite(p.y)) {
            max = Math.max(max, p.y);
            min = Math.min(min, p.y);
          }
        }
      }
      let hi = max > 0 ? max + Math.max(Math.abs(max) * 0.1, 0.2) : max < 0 ? 0 : 1;
      let lo = min < 0 ? min - Math.max(Math.abs(min) * 0.1, 0.2) : 0;
      if (max === 3 && min >= 0) hi = 3.2;
      if (hardMinOpt.value != null) lo = hardMinOpt.value;
      if (hardMaxOpt.value != null) hi = hardMaxOpt.value;
      return {
        y: {
          auto: false,
          range: () => [lo, hi]
        }
      };
    });
    const xAxisSize = computed(() => {
      const rot = Math.abs(xTickLabelRotation.value);
      if (rot > 0) return Math.max(31, 14 + Math.round(Math.sin(rot * Math.PI / 180) * 80));
      return 31;
    });
    const textValueSize = computed(() => {
      const n = Number(props.options?.text?.valueSize);
      return Number.isFinite(n) && n > 0 ? n : void 0;
    });
    const textTitleSize = computed(() => {
      const n = Number(props.options?.text?.titleSize);
      return Number.isFinite(n) && n > 0 ? n : void 0;
    });
    useUPlot(el, series, {
      width: width2,
      height: height2,
      mode: "bars",
      drawHook,
      // Grafana getScaleOrientation — real uPlot ori/dir flip for horizontal
      scaleOrientation: orientation,
      // custom canvas bars own drawing (avoid double-draw with paths.bars)
      suppressSeriesPaths: true,
      timeX: false,
      xMin,
      xMax,
      showLegend: false,
      barWidthFactor,
      xValueLabels,
      xTickLabelRotation,
      fullHighlight,
      xAxisSize,
      xAxisGap: 11,
      xSplits,
      gradientMode,
      showValues,
      showValueFontSize: textValueSize,
      softMin,
      softMax,
      hardMin: hardMinOpt,
      hardMax: hardMaxOpt,
      extraScales: hardYScale,
      bands: plotBands,
      thresholds: thresholdLines,
      thresholdsMode,
      tooltipMode: computed(() => String(opts.value?.tooltip?.mode ?? "single")),
      tooltipSort: computed(() => String(opts.value?.tooltip?.sort ?? "none")),
      axis: computed(() => ({
        gap: 5,
        gridShow: true,
        xGridShow: false,
        yGridShow: true,
        sizeAuto: true,
        font: textTitleSize.value ? `${textTitleSize.value}px 'Inter', 'Helvetica', 'Arial', sans-serif` : "12px 'Inter', 'Helvetica', 'Arial', sans-serif"
      }))
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2A, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["chart-wrap", [`legend-${legendPlacement.value}`]]),
            style: normalizeStyle({
              ["--barchart-value-size"]: textValueSize.value ? `${textValueSize.value}px` : void 0
            })
          },
          [
            createElementVNode(
              "div",
              {
                class: "chart-box",
                style: normalizeStyle({
                  width: chartWidthCss.value,
                  flex: legendPlacement.value === "right" ? "1 1 auto" : void 0
                })
              },
              [
                createElementVNode("div", {
                  ref_key: "el",
                  ref: el,
                  class: "chart",
                  "data-testid": "barchart-panel",
                  "data-legend-show": String(showLegend.value),
                  "data-legend-display-mode": String(opts.value.legend?.displayMode ?? "list"),
                  "data-legend-placement": String(opts.value.legend?.placement ?? "bottom"),
                  "data-empty": String(noData.value),
                  "data-stacking": String(opts.value.stacking?.mode ?? opts.value.stacking ?? "none"),
                  "data-band-count": String(plotBands.value.length),
                  "data-bar-width": String(opts.value.barWidth ?? 0.97),
                  "data-group-width": String(opts.value.groupWidth ?? 0.7),
                  "data-bar-radius": String(opts.value.barRadius ?? 0),
                  "data-x-field": String(opts.value.xField ?? ""),
                  "data-tooltip-mode": String(opts.value.tooltip?.mode ?? "single"),
                  "data-gradient": String(opts.value.gradientMode ?? custom.value.gradientMode ?? "none"),
                  "data-orientation": String(opts.value.orientation ?? "auto"),
                  "data-resolved-orientation": orientation.value,
                  "data-show-value": String(opts.value.showValue ?? "auto"),
                  "data-full-highlight": String(!!opts.value.fullHighlight),
                  "data-line-width": String(opts.value.lineWidth ?? custom.value.lineWidth ?? 1),
                  "data-fill-opacity": String(opts.value.fillOpacity ?? custom.value.fillOpacity ?? 80),
                  "data-color-by-field": String(opts.value.colorByField ?? ""),
                  "data-transform": String(opts.value.transform ?? custom.value.transform ?? "auto"),
                  "data-thresholds-style": String(
                    opts.value.thresholdsStyle?.mode ?? opts.value.thresholdsStyle ?? custom.value.thresholdsStyle?.mode ?? custom.value.thresholdsStyle ?? "off"
                  ),
                  "data-x-tick-max-length": String(opts.value.xTickLabelMaxLength ?? ""),
                  "data-x-tick-rotation": String(opts.value.xTickLabelRotation ?? 0),
                  "data-x-tick-spacing": String(opts.value.xTickLabelSpacing ?? 0),
                  "data-text-value-size": String(textValueSize.value ?? ""),
                  "data-text-title-size": String(textTitleSize.value ?? "")
                }, null, 8, _hoisted_2$23),
                noData.value ? (openBlock(), createElementBlock("div", _hoisted_3$1R, "暂无柱状图数据")) : createCommentVNode("v-if", true)
              ],
              4
              /* STYLE */
            ),
            showLegend.value && series.value.length && !noData.value ? (openBlock(), createElementBlock("ul", {
              key: 0,
              class: normalizeClass(["legend", {
                "legend--table": String(opts.value.legend?.displayMode) === "table",
                "legend--right": legendPlacement.value === "right"
              }]),
              "data-testid": "barchart-legend",
              "data-mode": String(opts.value.legend?.displayMode ?? "list"),
              "data-placement": String(opts.value.legend?.placement ?? "bottom")
            }, [
              String(opts.value.legend?.displayMode) === "table" ? (openBlock(), createElementBlock("li", _hoisted_5$1n, [..._cache[0] || (_cache[0] = [
                createElementVNode(
                  "i",
                  { class: "swatch" },
                  null,
                  -1
                  /* CACHED */
                ),
                createElementVNode(
                  "span",
                  { class: "name" },
                  "名称",
                  -1
                  /* CACHED */
                )
              ])])) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(series.value.filter((x) => !x.hideLegend), (s, i) => {
                  return openBlock(), createElementBlock("li", { key: i }, [
                    createElementVNode(
                      "i",
                      {
                        class: "swatch",
                        style: normalizeStyle({ background: s.color })
                      },
                      null,
                      4
                      /* STYLE */
                    ),
                    createElementVNode(
                      "span",
                      _hoisted_6$1a,
                      toDisplayString(s.label),
                      1
                      /* TEXT */
                    )
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ], 10, _hoisted_4$1z)) : createCommentVNode("v-if", true)
          ],
          6
          /* CLASS, STYLE */
        )
      ]);
    };
  }
});
const Panel$f = /* @__PURE__ */ _export_sfc$1(_sfc_main$3j, [["__scopeId", "data-v-0fda3388"]]);
new VuePanelPlugin(
  {
    id: "barchart",
    name: "柱状图",
    description: "分类柱状图（水平 / 垂直）",
    state: "stable",
    skipDataQuery: false
  },
  Panel$f
).useFieldConfig({
  standardOptions: {
    color: {
      settings: { byValueSupport: true, preferThresholdsMode: false },
      defaultValue: { mode: "palette-classic" }
    },
    links: { settings: { showOneClick: true } },
    actions: { hideFromDefaults: false }
  },
  useCustomConfig: (builder) => {
    const styles = ["Graph styles"];
    builder.addSlider(
      {
        id: "custom.lineWidth",
        path: "custom.lineWidth",
        name: "线宽",
        category: styles,
        settings: { min: 0, max: 10, step: 1 }
      },
      1
    ).addSlider(
      {
        id: "custom.fillOpacity",
        path: "custom.fillOpacity",
        name: "填充不透明度",
        category: styles,
        settings: { min: 0, max: 100, step: 1 }
      },
      80
    ).addRadio(
      {
        id: "custom.gradientMode",
        path: "custom.gradientMode",
        name: "渐变模式",
        category: styles,
        settings: {
          options: [
            { label: "无", value: "none" },
            { label: "不透明度", value: "opacity" },
            { label: "色相", value: "hue" },
            { label: "色板", value: "scheme" }
          ]
        }
      },
      "none"
    ).addSelect(
      {
        id: "custom.transform",
        path: "custom.transform",
        name: "变换",
        category: styles,
        settings: {
          options: [
            { label: "常量", value: "constant" },
            { label: "负 Y", value: "negative-Y" }
          ]
        },
        // Grafana: hidden from defaults
        hideFromDefaults: true
      },
      void 0
    ).addCustom({
      id: "custom.thresholdsStyle",
      path: "custom.thresholdsStyle",
      name: "显示阈值",
      category: ["Thresholds"],
      editor: "radio",
      isCustom: true,
      override: true,
      // Grafana defaultValue = { mode: GraphThresholdsStyleMode.Off }
      defaultValue: { mode: "off" },
      settings: {
        options: [
          { label: "关闭", value: "off" },
          { label: "线", value: "line" },
          { label: "虚线", value: "dashed" },
          { label: "区域", value: "area" },
          { label: "线+区域", value: "line+area" },
          { label: "虚线+区域", value: "dashed+area" }
        ]
      }
    }).addCustom({
      id: "custom.hideFrom",
      path: "custom.hideFrom",
      name: "隐藏",
      category: ["Series"],
      editor: "multi-select",
      isCustom: true,
      override: true,
      hideFromDefaults: true,
      settings: {
        options: [
          { label: "提示", value: "tooltip" },
          { label: "可视化", value: "viz" },
          { label: "图例", value: "legend" }
        ]
      },
      defaultValue: { tooltip: false, viz: false, legend: false }
    });
    addAxisConfig(builder);
  }
}).setPanelOptions((builder) => {
  const cat = ["柱状图"];
  builder.addFieldName(
    {
      id: "xField",
      path: "xField",
      name: "X 轴",
      description: "第一个字符串或时间字段",
      category: cat,
      settings: { placeholderText: "第一个字符串或时间字段" }
    },
    void 0
  ).addRadio(
    {
      id: "orientation",
      path: "orientation",
      name: "方向",
      category: cat,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "水平", value: "horizontal" },
          { label: "垂直", value: "vertical" }
        ]
      }
    },
    "auto"
  ).addSlider(
    {
      id: "xTickLabelRotation",
      path: "xTickLabelRotation",
      name: "X 刻度旋转",
      category: cat,
      settings: { min: -90, max: 90, step: 15 }
    },
    0
  ).addNumber(
    {
      id: "xTickLabelMaxLength",
      path: "xTickLabelMaxLength",
      name: "X 刻度最大长度",
      category: cat,
      settings: { min: 0 },
      // Grafana: only relevant when ticks are rotated
      showIf: (c) => c.xTickLabelRotation !== 0
    },
    void 0
  ).addNumber(
    {
      id: "xTickLabelSpacing",
      path: "xTickLabelSpacing",
      name: "X 刻度间距",
      description: "负数会跳过标签",
      category: cat,
      settings: { min: -100, max: 100, step: 1 }
    },
    0
  ).addRadio(
    {
      id: "showValue",
      path: "showValue",
      name: "显示数值",
      category: cat,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "始终", value: "always" },
          { label: "从不", value: "never" }
        ]
      }
    },
    "auto"
  ).addRadio(
    {
      id: "stacking",
      path: "stacking",
      name: "堆叠",
      category: cat,
      settings: {
        options: [
          { label: "关闭", value: "none" },
          { label: "普通", value: "normal" },
          { label: "百分比", value: "percent" }
        ]
      }
    },
    "none"
  ).addSlider(
    {
      id: "groupWidth",
      path: "groupWidth",
      name: "组宽",
      category: cat,
      settings: { min: 0, max: 1, step: 0.01 },
      showIf: (c, data) => {
        const s = c.stacking?.mode ?? c.stacking;
        if (s && s !== "none") return false;
        let count = 0;
        if (Array.isArray(data)) {
          for (const frame of data) {
            for (const field of frame?.fields ?? []) {
              if (field?.type === "number") count++;
            }
          }
        }
        return count !== 1;
      }
    },
    0.7
  ).addSlider(
    {
      id: "barWidth",
      path: "barWidth",
      name: "柱宽",
      category: cat,
      settings: { min: 0, max: 1, step: 0.01 }
    },
    0.97
  ).addSlider(
    {
      id: "barRadius",
      path: "barRadius",
      name: "圆角",
      category: cat,
      settings: { min: 0, max: 0.5, step: 0.05 }
    },
    0
  ).addBoolean(
    {
      id: "fullHighlight",
      path: "fullHighlight",
      name: "悬停高亮整组",
      category: cat,
      showIf: (c) => {
        const s = c.stacking?.mode ?? c.stacking;
        return !s || s === "none";
      }
    },
    false
  ).addFieldName(
    {
      id: "colorByField",
      path: "colorByField",
      name: "按字段着色",
      description: "用兄弟字段的颜色为每个柱值着色",
      category: cat
    },
    void 0
  ).addSlider(
    {
      id: "lineWidth",
      path: "lineWidth",
      name: "线宽",
      category: cat,
      settings: { min: 0, max: 10, step: 1 }
    },
    1
  ).addSlider(
    {
      id: "fillOpacity",
      path: "fillOpacity",
      name: "填充不透明度",
      category: cat,
      settings: { min: 0, max: 100, step: 1 }
    },
    80
  ).addRadio(
    {
      id: "gradientMode",
      path: "gradientMode",
      name: "渐变模式",
      category: cat,
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "不透明度", value: "opacity" },
          { label: "色相", value: "hue" },
          { label: "色板", value: "scheme" }
        ]
      }
    },
    "none"
  ).addSelect(
    {
      id: "transform",
      path: "transform",
      name: "变换",
      category: cat,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "常量", value: "constant" },
          { label: "负 Y", value: "negative-Y" }
        ]
      }
    },
    "auto"
  ).addSelect(
    {
      id: "thresholdsStyle",
      path: "thresholdsStyle",
      name: "阈值样式",
      category: cat,
      settings: {
        options: [
          { label: "关闭", value: "off" },
          { label: "线", value: "line" },
          { label: "区域", value: "area" },
          { label: "线+区域", value: "line+area" }
        ]
      }
    },
    "off"
  );
  addTooltipOptions(builder, false, false, optsWithHideZeros);
  addLegendOptions(builder, true, true);
  addTextSizeOptions(builder, { withTitle: true, withValue: true });
}).setRuntimeConsumedPaths([
  "custom.hideFrom",
  "xField",
  "orientation",
  "xTickLabelRotation",
  "xTickLabelMaxLength",
  "xTickLabelSpacing",
  "showValue",
  "stacking",
  "groupWidth",
  "barWidth",
  "barRadius",
  "fullHighlight",
  "colorByField",
  "lineWidth",
  "fillOpacity",
  "gradientMode",
  "transform",
  "thresholdsStyle",
  "text.valueSize",
  "text.titleSize",
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement",
  "tooltip.mode",
  "custom.lineWidth",
  "custom.fillOpacity",
  "custom.gradientMode"
]).register();
const _hoisted_1$2z = ["data-pie-type", "data-sort", "data-show-legend", "data-legend-display-mode", "data-legend-placement", "data-tooltip-mode", "data-hide-from", "data-show-labels", "data-display-labels", "data-reduce-values", "data-reduce-calcs", "data-slice-count", "data-layout-size"];
const _hoisted_2$22 = { class: "pie-viz" };
const _hoisted_3$1Q = ["viewBox", "width", "height"];
const _hoisted_4$1y = ["id", "r"];
const _hoisted_5$1m = ["offset", "stop-color"];
const _hoisted_6$19 = ["stop-color"];
const _hoisted_7$11 = ["transform"];
const _hoisted_8$V = ["r", "fill", "data-slice-index", "data-slice-value", "data-slice-text", "onPointerenter"];
const _hoisted_9$R = ["d", "fill", "data-slice-index", "data-slice-value", "data-slice-text", "onPointerenter"];
const _hoisted_10$I = ["x", "y"];
const _hoisted_11$D = ["data-display-mode"];
const _hoisted_12$x = {
  key: 0,
  class: "pie-legend-head",
  "data-testid": "pie-legend-header"
};
const _hoisted_13$w = {
  key: 0,
  class: "pie-legend-col"
};
const _hoisted_14$r = {
  key: 1,
  class: "pie-legend-col"
};
const _hoisted_15$o = { class: "pie-legend-name" };
const _hoisted_16$m = {
  key: 0,
  class: "pie-legend-col pie-legend-val"
};
const _hoisted_17$k = {
  key: 1,
  class: "pie-legend-col pie-legend-pct"
};
const _hoisted_18$k = ["data-mode", "data-row-count"];
const _hoisted_19$j = { class: "pie-tooltip-name" };
const _hoisted_20$h = { class: "pie-tooltip-val" };
const _hoisted_21$a = { class: "pie-tooltip-pct" };
const _sfc_main$3i = /* @__PURE__ */ defineComponent({
  __name: "PieRenderer",
  props: {
    data: {},
    fieldConfig: {},
    options: {},
    width: {},
    height: {}
  },
  setup(__props) {
    const props = __props;
    const rootEl = ref(null);
    const legendEl = ref(null);
    const panelSize = ref({ w: 0, h: 0 });
    const legendSize = ref({ w: 0, h: 0 });
    let rootRo = null;
    let legendRo = null;
    function measureRoot() {
      const el = rootEl.value;
      if (!el) return;
      const w = el.clientWidth || 0;
      const h2 = el.clientHeight || 0;
      if (w !== panelSize.value.w || h2 !== panelSize.value.h) {
        panelSize.value = { w, h: h2 };
      }
    }
    function measureLegend() {
      const el = legendEl.value;
      if (!el) {
        if (legendSize.value.w || legendSize.value.h) {
          legendSize.value = { w: 0, h: 0 };
        }
        return;
      }
      const w = el.offsetWidth || 0;
      const h2 = el.offsetHeight || 0;
      if (w !== legendSize.value.w || h2 !== legendSize.value.h) {
        legendSize.value = { w, h: h2 };
      }
    }
    onMounted(() => {
      nextTick(() => {
        measureRoot();
        measureLegend();
        if (typeof ResizeObserver !== "undefined") {
          if (rootEl.value) {
            rootRo = new ResizeObserver(() => measureRoot());
            rootRo.observe(rootEl.value);
          }
          if (legendEl.value) {
            legendRo = new ResizeObserver(() => measureLegend());
            legendRo.observe(legendEl.value);
          }
        }
      });
    });
    onBeforeUnmount(() => {
      rootRo?.disconnect();
      legendRo?.disconnect();
      rootRo = null;
      legendRo = null;
    });
    const showLegend = computed(() => {
      const legend = props.options?.legend;
      if (legend?.showLegend === false) return false;
      return legend?.displayMode !== "hidden";
    });
    const legendDisplayMode = computed(() => {
      const m = String(props.options?.legend?.displayMode ?? "list");
      return m === "table" ? "table" : m === "hidden" ? "hidden" : "list";
    });
    const legendPlacement = computed(() => {
      const p = String(props.options?.legend?.placement ?? "bottom");
      return p === "right" || p === "left" ? p : "bottom";
    });
    watch([showLegend, legendPlacement], () => {
      nextTick(() => {
        legendRo?.disconnect();
        legendRo = null;
        measureLegend();
        if (typeof ResizeObserver !== "undefined" && legendEl.value && showLegend.value) {
          legendRo = new ResizeObserver(() => measureLegend());
          legendRo.observe(legendEl.value);
        }
      });
    });
    const plotBox = computed(() => {
      const FALLBACK = 210.578125;
      const pw = props.width && props.width > 0 ? props.width : panelSize.value.w > 0 ? panelSize.value.w : FALLBACK;
      const ph = props.height && props.height > 0 ? props.height : panelSize.value.h > 0 ? panelSize.value.h : FALLBACK;
      if (!showLegend.value) {
        return { width: pw, height: ph };
      }
      const place = legendPlacement.value;
      if (place === "bottom") {
        const lh = legendSize.value.h > 0 ? legendSize.value.h : 0;
        return { width: pw, height: Math.max(1, ph - lh) };
      }
      const lw = legendSize.value.w > 0 ? legendSize.value.w : 0;
      return { width: Math.max(1, pw - lw), height: ph };
    });
    function getPieLayout(width2, height2, pieType, margin = 16) {
      const size = Math.max(1, Math.min(width2, height2));
      const outerRadius = Math.max(0, (size - margin * 2) / 2);
      const donut = pieType === "donut" || pieType === "Donut" || pieType === "DONUT";
      const donutThickness = donut ? Math.max(outerRadius / 3, 20) : outerRadius;
      const innerRadius = Math.max(0, outerRadius - donutThickness);
      const position = (size - margin * 2) / 2 + margin;
      const gradientFromOffset = outerRadius > 0 ? 1 - (outerRadius - innerRadius) / outerRadius : 0;
      return {
        size,
        outerRadius,
        innerRadius,
        position,
        gradientFromOffset
      };
    }
    const layout = computed(() => {
      const pieType = String(props.options?.pieType ?? "pie");
      return getPieLayout(plotBox.value.width, plotBox.value.height, pieType);
    });
    const slices = computed(() => {
      const allFrames = props.data?.series ?? [];
      const frame = allFrames[0];
      if (!frame) return [];
      const o = props.options ?? {};
      const showAllValues = o.reduceOptions?.values === true;
      const calc = String((o.reduceOptions?.calcs ?? ["lastNotNull"])[0] ?? "lastNotNull");
      const fieldFilter = String(o.reduceOptions?.fields ?? "").trim();
      const fieldRe = fieldFilter ? stringToJsRegexSafe(fieldFilter) : null;
      const limit = o.reduceOptions?.limit != null ? Number(o.reduceOptions.limit) : showAllValues ? 25 : void 0;
      const numFields = frame.fields.filter((f) => f.type === "number");
      if (!numFields.length) return [];
      let items = [];
      if (showAllValues || numFields.length === 1 && frame.fields.some((f) => f.type === "string")) {
        const num2 = numFields[0];
        if (fieldRe && !fieldRe.test(num2.name) && !fieldRe.test(getFieldDisplayName(num2, frame, allFrames))) {
          return [];
        }
        const label = frame.fields.find((f) => f.type === "string") ?? frame.fields.find((f) => f.type !== "number" && f.type !== "time");
        items = num2.values.map((v, i) => {
          const n = Number(v ?? 0);
          const cfg = { ...props.fieldConfig?.defaults ?? {}, ...num2.config };
          return {
            label: label ? String(label.values[i] ?? i) : `${getFieldDisplayName(num2, frame, allFrames)} ${i}`,
            value: n,
            text: formatValue(n, cfg),
            color: getFieldColor(n, cfg) || getFieldSeriesColor(String(label?.values?.[i] ?? i), i, {
              ...cfg,
              color: cfg.color ?? { mode: "palette-classic" }
            }) || getClassicPalette$1()[i % getClassicPalette$1().length]
          };
        }).filter((x) => x.value > 0);
      } else {
        items = numFields.filter(
          (field) => !fieldRe || fieldRe.test(field.name) || fieldRe.test(getFieldDisplayName(field, frame, allFrames))
        ).map((field, i) => {
          const fc = {
            ...props.fieldConfig?.defaults?.custom ?? {},
            ...field.config?.custom ?? {}
          };
          if (normalizeHideFrom(fc.hideFrom).viz === true) return null;
          const nums = field.values.map(Number).filter((n) => Number.isFinite(n));
          if (!nums.length) return null;
          const reduced = reduceField(field, [calc]);
          let v = Number(reduced[calc]);
          if (!Number.isFinite(v)) {
            v = nums[nums.length - 1];
            if (calc === "sum") v = nums.reduce((a, b) => a + b, 0);
            else if (calc === "mean" || calc === "avg")
              v = nums.reduce((a, b) => a + b, 0) / nums.length;
            else if (calc === "max") v = Math.max(...nums);
            else if (calc === "min") v = Math.min(...nums);
            else if (calc === "first" || calc === "firstNotNull") v = nums[0];
          }
          const cfg = { ...props.fieldConfig?.defaults ?? {}, ...field.config };
          const hide = normalizeHideFrom(fc.hideFrom);
          return {
            label: getFieldDisplayName(field, frame, allFrames),
            value: v,
            text: formatValue(v, cfg),
            color: getFieldColor(v, cfg) || getFieldSeriesColor(getFieldDisplayName(field, frame, allFrames), i, {
              ...cfg,
              color: cfg.color ?? { mode: "palette-classic" }
            }) || getClassicPalette$1()[i % getClassicPalette$1().length],
            hideLegend: hide.legend === true
          };
        }).filter((x) => !!x && x.value > 0);
      }
      if (props.options?.sort === "desc") items.sort((a, b) => b.value - a.value);
      if (props.options?.sort === "asc") items.sort((a, b) => a.value - b.value);
      if (limit != null && Number.isFinite(limit) && limit > 0 && items.length > limit) {
        items = items.slice(0, limit);
      }
      const total = items.reduce((a, b) => a + b.value, 0) || 1;
      const { size, outerRadius: r, innerRadius: ir, position } = layout.value;
      const pad = items.length > 1 ? 5e-3 : 0;
      let angle = -Math.PI / 2 + pad / 2;
      return items.map((it) => {
        const sweep = Math.max(0, it.value / total * Math.PI * 2 - pad);
        const a0 = angle;
        const a1 = angle + sweep;
        angle = a1 + pad;
        const large = sweep > Math.PI ? 1 : 0;
        const mid = a0 + sweep / 2;
        const labelInner = ir === 0 ? r / 6 : ir;
        const lr = (r + labelInner) / 2;
        const full = sweep >= Math.PI * 2 - 1e-6;
        let path = "";
        if (!full) {
          if (ir <= 0) {
            path = `M0,0 L ${r * Math.cos(a0)} ${r * Math.sin(a0)} A ${r} ${r} 0 ${large} 1 ${r * Math.cos(a1)} ${r * Math.sin(a1)} Z`;
          } else {
            const x0 = r * Math.cos(a0);
            const y0 = r * Math.sin(a0);
            const x1 = r * Math.cos(a1);
            const y1 = r * Math.sin(a1);
            const xi0 = ir * Math.cos(a0);
            const yi0 = ir * Math.sin(a0);
            const xi1 = ir * Math.cos(a1);
            const yi1 = ir * Math.sin(a1);
            path = `M ${x0} ${y0} A ${r} ${r} 0 ${large} 1 ${x1} ${y1} L ${xi1} ${yi1} A ${ir} ${ir} 0 ${large} 0 ${xi0} ${yi0} Z`;
          }
        } else if (ir > 0) {
          path = `M 0 ${-r} A ${r} ${r} 0 1 1 0 ${r} A ${r} ${r} 0 1 1 0 ${-r} M 0 ${-ir} A ${ir} ${ir} 0 1 0 0 ${ir} A ${ir} ${ir} 0 1 0 0 ${-ir} Z`;
        }
        return {
          ...it,
          path,
          full: full && ir <= 0,
          r,
          ir,
          cx: position,
          cy: position,
          size,
          pct: (it.value / total * 100).toFixed(1),
          labelX: lr * Math.cos(mid),
          labelY: lr * Math.sin(mid)
        };
      });
    });
    const showLabels = computed(() => {
      const labels = props.options?.displayLabels;
      return Array.isArray(labels) ? labels.length > 0 : false;
    });
    const labelParts = computed(() => {
      const labels = props.options?.displayLabels;
      if (Array.isArray(labels) && labels.length) return labels.map(String);
      return [];
    });
    function parseHex2(hex) {
      const h2 = hex.replace("#", "");
      if (h2.length < 6) return null;
      return [
        Number.parseInt(h2.slice(0, 2), 16),
        Number.parseInt(h2.slice(2, 4), 16),
        Number.parseInt(h2.slice(4, 6), 16)
      ];
    }
    function rgbToHsl(r, g, b) {
      r /= 255;
      g /= 255;
      b /= 255;
      const max = Math.max(r, g, b);
      const min = Math.min(r, g, b);
      const l = (max + min) / 2;
      if (max === min) return [0, 0, l];
      const d = max - min;
      const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
      let h2 = 0;
      switch (max) {
        case r:
          h2 = (g - b) / d + (g < b ? 6 : 0);
          break;
        case g:
          h2 = (b - r) / d + 2;
          break;
        default:
          h2 = (r - g) / d + 4;
      }
      return [h2 / 6 * 360, s, l];
    }
    function hslToRgb2(h2, s, l) {
      h2 = (h2 % 360 + 360) % 360;
      const c = (1 - Math.abs(2 * l - 1)) * s;
      const x = c * (1 - Math.abs(h2 / 60 % 2 - 1));
      const m = l - c / 2;
      let rp = 0, gp = 0, bp = 0;
      if (h2 < 60) [rp, gp, bp] = [c, x, 0];
      else if (h2 < 120) [rp, gp, bp] = [x, c, 0];
      else if (h2 < 180) [rp, gp, bp] = [0, c, x];
      else if (h2 < 240) [rp, gp, bp] = [0, x, c];
      else if (h2 < 300) [rp, gp, bp] = [x, 0, c];
      else [rp, gp, bp] = [c, 0, x];
      return [
        Math.max(0, Math.min(255, Math.round((rp + m) * 255))),
        Math.max(0, Math.min(255, Math.round((gp + m) * 255))),
        Math.max(0, Math.min(255, Math.round((bp + m) * 255)))
      ];
    }
    function tinyDarkenSpin(hex, darkenAmt, spinDeg) {
      const rgb = parseHex2(hex.startsWith("#") ? hex : classicGreen());
      if (!rgb) return hex;
      let [h2, s, l] = rgbToHsl(rgb[0], rgb[1], rgb[2]);
      l = Math.max(0, l - darkenAmt / 100);
      h2 += spinDeg;
      const [r, g, b] = hslToRgb2(h2, s, l);
      return `rgb(${r}, ${g}, ${b})`;
    }
    function gradientFrom(color) {
      return tinyDarkenSpin(color, 20, 4);
    }
    function gradientTo(color) {
      return tinyDarkenSpin(color, 10, -4);
    }
    const legendSlices = computed(() => slices.value.filter((s) => s.hideLegend !== true));
    const tooltipMode = computed(() => String(props.options?.tooltip?.mode ?? "single"));
    const tipOpen = ref(false);
    const tipX = ref(0);
    const tipY = ref(0);
    const tipIndex = ref(-1);
    const tipRows = computed(() => {
      if (tooltipMode.value === "none" || !tipOpen.value) {
        return [];
      }
      const all = legendSlices.value.map((s) => ({
        label: String(s.label ?? ""),
        text: String(s.text ?? ""),
        pct: String(s.pct ?? ""),
        color: String(s.color ?? "")
      }));
      if (tooltipMode.value === "multi") return all;
      if (tipIndex.value < 0 || tipIndex.value >= all.length) return all.slice(0, 1);
      return [all[tipIndex.value]];
    });
    function onSliceEnter(evt, index2) {
      if (tooltipMode.value === "none") return;
      tipIndex.value = index2;
      tipOpen.value = true;
      const root = rootEl.value;
      if (!root) return;
      const rect = root.getBoundingClientRect();
      tipX.value = evt.clientX - rect.left + 12;
      tipY.value = evt.clientY - rect.top + 12;
    }
    function onSliceMove(evt) {
      if (!tipOpen.value || tooltipMode.value === "none") return;
      const root = rootEl.value;
      if (!root) return;
      const rect = root.getBoundingClientRect();
      tipX.value = evt.clientX - rect.left + 12;
      tipY.value = evt.clientY - rect.top + 12;
    }
    function onSliceLeave() {
      tipOpen.value = false;
      tipIndex.value = -1;
    }
    function legendShows(kind2) {
      const vals = props.options?.legend?.values;
      if (!Array.isArray(vals) || !vals.length) return false;
      return vals.map(String).includes(kind2) || vals.map(String).includes(kind2 === "percent" ? "Percent" : "Value");
    }
    function sliceLabel(s) {
      const parts = [];
      if (labelParts.value.includes("name")) parts.push(s.label);
      if (labelParts.value.includes("value")) parts.push(s.text);
      if (labelParts.value.includes("percent")) parts.push(`${s.pct}%`);
      return parts.join(" · ");
    }
    function showSliceLabel(s, index2, all) {
      const pct = Number(s.pct);
      if (all.length <= 4) return true;
      if (pct >= 8) return true;
      const ranked = all.map((x, i) => ({ i, p: Number(x.pct) })).sort((a, b) => b.p - a.p).slice(0, 4).map((x) => x.i);
      return ranked.includes(index2);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "rootEl",
        ref: rootEl,
        class: normalizeClass(["pie", [`legend-${legendPlacement.value}`, { "has-legend": showLegend.value }]]),
        "data-testid": "panel-pie",
        "data-pie-type": String(__props.options?.pieType ?? "pie"),
        "data-sort": String(__props.options?.sort ?? ""),
        "data-show-legend": String(showLegend.value),
        "data-legend-display-mode": legendDisplayMode.value,
        "data-legend-placement": legendPlacement.value,
        "data-tooltip-mode": String(__props.options?.tooltip?.mode ?? "single"),
        "data-hide-from": String(
          __props.fieldConfig?.defaults?.custom?.hideFrom ? JSON.stringify(__props.fieldConfig.defaults.custom.hideFrom) : ""
        ),
        "data-show-labels": String(showLabels.value),
        "data-display-labels": labelParts.value.join(","),
        "data-reduce-values": String(!!__props.options?.reduceOptions?.values),
        "data-reduce-calcs": String((__props.options?.reduceOptions?.calcs ?? ["lastNotNull"])[0] ?? "lastNotNull"),
        "data-slice-count": String(slices.value.length),
        "data-layout-size": String(layout.value.size)
      }, [
        slices.value.length ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createCommentVNode(" VizLayout.viz: flex-grow area; pie centered inside remaining plot box "),
            createElementVNode("div", _hoisted_2$22, [
              (openBlock(), createElementBlock("svg", {
                class: "pie-svg",
                "aria-hidden": "true",
                viewBox: `0 0 ${layout.value.size} ${layout.value.size}`,
                width: layout.value.size,
                height: layout.value.size,
                style: { "overflow": "visible" }
              }, [
                createElementVNode("defs", null, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(slices.value, (s, i) => {
                      return openBlock(), createElementBlock("radialGradient", {
                        id: `pie-grad-${i}`,
                        key: `g${i}`,
                        cx: "0",
                        cy: "0",
                        r: layout.value.outerRadius,
                        gradientUnits: "userSpaceOnUse"
                      }, [
                        createElementVNode("stop", {
                          offset: String(layout.value.gradientFromOffset),
                          "stop-color": gradientFrom(s.color),
                          "stop-opacity": "1"
                        }, null, 8, _hoisted_5$1m),
                        createElementVNode("stop", {
                          offset: "1",
                          "stop-color": gradientTo(s.color),
                          "stop-opacity": "1"
                        }, null, 8, _hoisted_6$19)
                      ], 8, _hoisted_4$1y);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ]),
                createElementVNode("g", {
                  transform: `translate(${layout.value.position}, ${layout.value.position})`
                }, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(slices.value, (s, i) => {
                      return openBlock(), createElementBlock(
                        Fragment,
                        { key: i },
                        [
                          s.full && !s.ir ? (openBlock(), createElementBlock("circle", {
                            key: 0,
                            r: s.r,
                            cx: "0",
                            cy: "0",
                            fill: `url(#pie-grad-${i})`,
                            "data-testid": "pie-slice",
                            "data-slice-index": String(i),
                            "data-slice-value": String(s.value),
                            "data-slice-text": String(s.text),
                            onPointerenter: ($event) => onSliceEnter($event, i),
                            onPointermove: onSliceMove,
                            onPointerleave: onSliceLeave
                          }, null, 40, _hoisted_8$V)) : (openBlock(), createElementBlock("path", {
                            key: 1,
                            d: s.path,
                            fill: `url(#pie-grad-${i})`,
                            stroke: "transparent",
                            "stroke-width": "0",
                            "data-testid": "pie-slice",
                            "data-slice-index": String(i),
                            "data-slice-value": String(s.value),
                            "data-slice-text": String(s.text),
                            onPointerenter: ($event) => onSliceEnter($event, i),
                            onPointermove: onSliceMove,
                            onPointerleave: onSliceLeave
                          }, null, 40, _hoisted_9$R))
                        ],
                        64
                        /* STABLE_FRAGMENT */
                      );
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  )),
                  showLabels.value ? (openBlock(true), createElementBlock(
                    Fragment,
                    { key: 0 },
                    renderList(slices.value, (s, i) => {
                      return withDirectives((openBlock(), createElementBlock("text", {
                        key: `t${i}`,
                        x: s.labelX,
                        y: s.labelY,
                        "text-anchor": "middle",
                        "dominant-baseline": "middle",
                        "font-size": "12",
                        fill: "var(--grafana-text)",
                        "data-testid": "pie-slice-label"
                      }, toDisplayString(sliceLabel(s)), 9, _hoisted_10$I)), [
                        [vShow, showSliceLabel(s, i, slices.value)]
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  )) : createCommentVNode("v-if", true)
                ], 8, _hoisted_7$11)
              ], 8, _hoisted_3$1Q))
            ]),
            showLegend.value ? (openBlock(), createElementBlock(
              "div",
              {
                key: 0,
                ref_key: "legendEl",
                ref: legendEl,
                class: "pie-legend-wrap"
              },
              [
                createElementVNode("ul", {
                  class: normalizeClass(["pie-legend", { "pie-legend--table": legendDisplayMode.value === "table" }]),
                  "data-testid": "pie-legend",
                  "data-display-mode": legendDisplayMode.value
                }, [
                  legendDisplayMode.value === "table" ? (openBlock(), createElementBlock("li", _hoisted_12$x, [
                    _cache[0] || (_cache[0] = createElementVNode(
                      "span",
                      { class: "swatch pie-legend-head__swatch" },
                      null,
                      -1
                      /* CACHED */
                    )),
                    _cache[1] || (_cache[1] = createElementVNode(
                      "span",
                      { class: "pie-legend-name" },
                      "名称",
                      -1
                      /* CACHED */
                    )),
                    legendShows("value") ? (openBlock(), createElementBlock("span", _hoisted_13$w, "值")) : createCommentVNode("v-if", true),
                    legendShows("percent") ? (openBlock(), createElementBlock("span", _hoisted_14$r, "%")) : createCommentVNode("v-if", true)
                  ])) : createCommentVNode("v-if", true),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(legendSlices.value, (s, i) => {
                      return openBlock(), createElementBlock("li", {
                        key: i,
                        "data-testid": "pie-legend-item"
                      }, [
                        createElementVNode(
                          "span",
                          {
                            class: "swatch",
                            style: normalizeStyle({ background: s.color })
                          },
                          null,
                          4
                          /* STYLE */
                        ),
                        createElementVNode(
                          "span",
                          _hoisted_15$o,
                          toDisplayString(s.label),
                          1
                          /* TEXT */
                        ),
                        legendShows("value") ? (openBlock(), createElementBlock(
                          "span",
                          _hoisted_16$m,
                          toDisplayString(s.text),
                          1
                          /* TEXT */
                        )) : createCommentVNode("v-if", true),
                        legendShows("percent") ? (openBlock(), createElementBlock(
                          "span",
                          _hoisted_17$k,
                          toDisplayString(s.pct) + "%",
                          1
                          /* TEXT */
                        )) : createCommentVNode("v-if", true)
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ], 10, _hoisted_11$D)
              ],
              512
              /* NEED_PATCH */
            )) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        )) : (openBlock(), createBlock(PanelDataErrorView, {
          key: 1,
          data: __props.data,
          "field-config": __props.fieldConfig
        }, null, 8, ["data", "field-config"])),
        tipOpen.value && tipRows.value.length && tooltipMode.value !== "none" ? (openBlock(), createElementBlock("div", {
          key: 2,
          class: "pie-tooltip",
          "data-testid": "pie-tooltip",
          "data-mode": tooltipMode.value,
          "data-row-count": String(tipRows.value.length),
          style: normalizeStyle({ left: `${tipX.value}px`, top: `${tipY.value}px` })
        }, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(tipRows.value, (row, ri) => {
              return openBlock(), createElementBlock("div", {
                key: ri,
                class: "pie-tooltip-row",
                "data-testid": "pie-tooltip-row"
              }, [
                createElementVNode(
                  "i",
                  {
                    class: "pie-tooltip-swatch",
                    style: normalizeStyle({ background: row.color })
                  },
                  null,
                  4
                  /* STYLE */
                ),
                createElementVNode(
                  "span",
                  _hoisted_19$j,
                  toDisplayString(row.label),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "span",
                  _hoisted_20$h,
                  toDisplayString(row.text),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "span",
                  _hoisted_21$a,
                  toDisplayString(row.pct) + "%",
                  1
                  /* TEXT */
                )
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 12, _hoisted_18$k)) : createCommentVNode("v-if", true)
      ], 10, _hoisted_1$2z);
    };
  }
});
const PieRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3i, [["__scopeId", "data-v-38f8ee8d"]]);
const _sfc_main$3h = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(PieRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "piechart",
    name: "饼图",
    description: "饼图 / 环形图",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$3h
).useFieldConfig({
  useCustomConfig: (builder) => {
    addHideFrom(builder);
  }
}).setPanelOptions((builder) => {
  const cat = ["饼图"];
  addStandardDataReduceOptions(builder);
  builder.addRadio(
    {
      id: "pieType",
      path: "pieType",
      name: "饼图类型",
      category: cat,
      editor: "radio",
      settings: {
        options: [
          { label: "饼图", value: "pie" },
          { label: "环形", value: "donut" }
        ]
      }
    },
    "pie"
  ).addSelect(
    {
      id: "sort",
      path: "sort",
      name: "切片排序",
      category: cat,
      editor: "select",
      settings: {
        options: [
          { label: "降序", value: "desc" },
          { label: "升序", value: "asc" },
          { label: "无", value: "none" }
        ]
      }
    },
    "desc"
  ).addMultiSelect(
    {
      id: "displayLabels",
      path: "displayLabels",
      name: "标签",
      description: "在扇区上显示的标签",
      category: cat,
      settings: {
        options: [
          { label: "百分比", value: "percent" },
          { label: "名称", value: "name" },
          { label: "值", value: "value" }
        ]
      }
    },
    []
  );
  addTooltipOptions(builder, false, false, optsWithHideZeros);
  addLegendOptions(builder, false, true);
  builder.addSelect(
    {
      id: "legend.values",
      path: "legend.values",
      name: "图例值",
      category: ["图例"],
      editor: "multi-select",
      settings: {
        options: [
          { label: "百分比", value: "percent" },
          { label: "值", value: "value" }
        ]
      },
      showIf: (c) => c.legend?.showLegend !== false
    },
    []
  );
}).setRuntimeConsumedPaths([
  "custom.hideFrom",
  "reduceOptions.calcs",
  "reduceOptions.fields",
  "reduceOptions.values",
  "reduceOptions.limit",
  "pieType",
  "sort",
  "displayLabels",
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement",
  "legend.values",
  "tooltip.mode",
  "tooltip.sort",
  "tooltip.hideZeros",
  "tooltip.maxWidth",
  "tooltip.maxHeight"
]).register();
const _hoisted_1$2y = ["data-anno-clustering", "data-anno-multi-lane", "data-anno-count"];
const _hoisted_2$21 = ["title", "data-anno-index", "data-count", "data-lane", "onMouseenter", "onFocus"];
const _hoisted_3$1P = {
  key: 0,
  class: "anno-tip",
  "data-testid": "anno-tooltip"
};
const _hoisted_4$1x = { key: 0 };
const _hoisted_5$1l = { class: "ts-val" };
const _sfc_main$3g = /* @__PURE__ */ defineComponent({
  __name: "AnnotationLayer",
  props: {
    annotations: {},
    options: {},
    xMin: {},
    xMax: {}
  },
  setup(__props) {
    const props = __props;
    function toMs2(v) {
      if (v == null) return void 0;
      if (typeof v === "number" && Number.isFinite(v)) return v;
      if (v instanceof Date) {
        const t2 = v.getTime();
        return Number.isFinite(t2) ? t2 : void 0;
      }
      if (typeof v?.valueOf === "function") {
        const n2 = Number(v.valueOf());
        if (Number.isFinite(n2)) return n2;
      }
      const n = new Date(v).getTime();
      return Number.isFinite(n) ? n : void 0;
    }
    const hoverAnno = ref(null);
    const show = computed(() => props.options?.show !== false);
    const clustered = computed(() => {
      if (!show.value) return [];
      const list = (props.annotations ?? []).map((a, i) => ({
        time: Number(a.time),
        timeEnd: a.timeEnd != null ? Number(a.timeEnd) : void 0,
        title: a.title ?? a.text ?? "annotation",
        text: a.text,
        color: a.color || classicYellow(),
        tags: a.tags ?? [],
        index: i
      }));
      return clusterAnnotations(list, {
        clustering: props.options?.clustering,
        multiLane: !!props.options?.multiLane
      });
    });
    function leftPct(time) {
      const min = toMs2(props.xMin);
      const max = toMs2(props.xMax);
      if (min != null && max != null && max > min) {
        const p = (time - min) / (max - min) * 100;
        return `${Math.max(0, Math.min(100, p))}%`;
      }
      return "50%";
    }
    return (_ctx, _cache) => {
      return clustered.value.length ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: "anno-layer",
        "data-testid": "panel-annotations",
        "data-anno-clustering": String(__props.options?.clustering !== false),
        "data-anno-multi-lane": String(!!__props.options?.multiLane),
        "data-anno-count": String(clustered.value.length)
      }, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(clustered.value, (a, i) => {
            return openBlock(), createElementBlock("button", {
              key: i,
              type: "button",
              class: "anno-mark",
              style: normalizeStyle({
                left: leftPct(a.time),
                background: a.color,
                top: `${4 + (a.lane || 0) * 10}px`
              }),
              title: a.title,
              "data-testid": "annotation-marker",
              "data-anno-index": i,
              "data-count": a.count || 1,
              "data-lane": a.lane || 0,
              onMouseenter: ($event) => hoverAnno.value = a,
              onMouseleave: _cache[0] || (_cache[0] = ($event) => hoverAnno.value = null),
              onFocus: ($event) => hoverAnno.value = a,
              onBlur: _cache[1] || (_cache[1] = ($event) => hoverAnno.value = null)
            }, null, 44, _hoisted_2$21);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        hoverAnno.value ? (openBlock(), createElementBlock("div", _hoisted_3$1P, [
          createElementVNode(
            "strong",
            null,
            toDisplayString(hoverAnno.value.title),
            1
            /* TEXT */
          ),
          hoverAnno.value.text ? (openBlock(), createElementBlock(
            "div",
            _hoisted_4$1x,
            toDisplayString(hoverAnno.value.text),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          createElementVNode(
            "div",
            _hoisted_5$1l,
            toDisplayString(new Date(hoverAnno.value.time).toISOString()),
            1
            /* TEXT */
          )
        ])) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2y)) : createCommentVNode("v-if", true);
    };
  }
});
const AnnotationLayer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3g, [["__scopeId", "data-v-d1b970dc"]]);
function resolveField(frame, preferred, aliases = []) {
  if (!frame?.fields) return void 0;
  if (preferred) {
    const exact = frame.fields.find((f) => f.name === preferred);
    if (exact) return exact;
    const ci = frame.fields.find(
      (f) => String(f.name).toLowerCase() === preferred.toLowerCase()
    );
    if (ci) return ci;
    const byDisplay = frame.fields.find((f) => getFieldDisplayName(f, frame) === preferred);
    if (byDisplay) return byDisplay;
  }
  for (const a of aliases) {
    const f = frame.fields.find(
      (x) => String(x.name).toLowerCase() === a.toLowerCase() || new RegExp(`^${a}$`, "i").test(x.name) || getFieldDisplayName(x, frame).toLowerCase() === a.toLowerCase()
    );
    if (f) return f;
  }
  return void 0;
}
function extractBars(frames, fieldsMap = {}) {
  const out = [];
  for (const frame of frames ?? []) {
    const time = frame.fields?.find((f) => f.type === "time") ?? frame.fields?.[0];
    if (!time) continue;
    let open = resolveField(frame, fieldsMap.open, ["open", "o"]);
    const high = resolveField(frame, fieldsMap.high, ["high", "h", "max"]);
    const low = resolveField(frame, fieldsMap.low, ["low", "l", "min"]);
    let close = resolveField(frame, fieldsMap.close, ["close", "c"]);
    const volume = resolveField(frame, fieldsMap.volume, ["volume", "vol", "v"]);
    if (!open && !close) {
      open = frame.fields?.find((f) => f.type === "number");
    }
    if (!close && !open) {
      close = frame.fields?.find((f) => f.type === "number");
    }
    let openVals;
    let closeVals;
    if (open && !close && !fieldsMap.close) {
      const src = open.values;
      closeVals = src.slice(1);
      if (closeVals.length) closeVals.push(closeVals[closeVals.length - 1]);
      else closeVals = src.slice();
      openVals = src.map(Number);
    } else if (close && !open && !fieldsMap.open) {
      const src = close.values.map(Number);
      openVals = src.slice();
      openVals.unshift(openVals[0]);
      openVals.length = src.length;
      closeVals = src;
    } else {
      if (!close && open) close = open;
      if (!open || !close) continue;
      openVals = open.values.map(Number);
      closeVals = close.values.map(Number);
    }
    if (!openVals || !closeVals) continue;
    const highVals = high ? high.values.map(Number) : void 0;
    const lowVals = low ? low.values.map(Number) : void 0;
    const volVals = volume ? volume.values.map(Number) : void 0;
    const len = Math.min(time.values?.length ?? 0, openVals.length, closeVals.length);
    for (let i = 0; i < len; i++) {
      const o = openVals[i];
      const c = closeVals[i];
      if (!Number.isFinite(o) || !Number.isFinite(c)) continue;
      const h2 = highVals ? highVals[i] : o;
      const l = lowVals ? lowVals[i] : o;
      const hi = Number.isFinite(h2) ? Math.max(h2, o, c) : Math.max(o, c);
      const lo = Number.isFinite(l) ? Math.min(l, o, c) : Math.min(o, c);
      out.push({
        t: Number(time.values[i]),
        open: o,
        high: hi,
        low: lo,
        close: c,
        volume: volVals && Number.isFinite(volVals[i]) ? volVals[i] : void 0
      });
    }
  }
  return out;
}
function alpha(color, a) {
  if (color.startsWith("rgba"))
    return color.replace(/rgba\(([^)]+)\)/, (_, inner) => {
      const parts = inner.split(",").map((s) => s.trim());
      return `rgba(${parts[0]}, ${parts[1]}, ${parts[2]}, ${a})`;
    });
  if (color.startsWith("rgb(")) {
    return color.replace("rgb(", "rgba(").replace(")", `, ${a})`);
  }
  if (color.startsWith("#")) {
    let h2 = color.slice(1);
    if (h2.length === 3)
      h2 = h2.split("").map((c) => c + c).join("");
    const r = Number.parseInt(h2.slice(0, 2), 16);
    const g = Number.parseInt(h2.slice(2, 4), 16);
    const b = Number.parseInt(h2.slice(4, 6), 16);
    return `rgba(${r}, ${g}, ${b}, ${a})`;
  }
  return color;
}
function drawMarkers(opts) {
  const {
    mode: mode2,
    candleStyle,
    fields,
    colorStrategy,
    upColor,
    downColor,
    flatColor,
    volumeAlpha,
    flatAsUp = true
  } = opts;
  const drawPrice = mode2 !== "volume" && fields.high != null && fields.low != null;
  const asCandles = drawPrice && candleStyle !== "ohlcbars";
  const drawVolume = mode2 !== "candles" && fields.volume != null;
  function selectPath(priceDir, flatPath, upPath, downPath, flatAsUpLocal) {
    return priceDir > 0 ? upPath : priceDir < 0 ? downPath : flatAsUpLocal ? upPath : flatPath;
  }
  const tIdx = 0;
  const oIdx = fields.open;
  const hIdx = fields.high;
  const lIdx = fields.low;
  const cIdx = fields.close;
  const vIdx = fields.volume;
  return (u) => {
    let downPath;
    let upPath;
    let flatPath;
    let downPathVol;
    let upPathVol;
    let flatPathVol;
    if (drawPrice) {
      flatPath = new Path2D();
      upPath = new Path2D();
      downPath = new Path2D();
    }
    if (drawVolume) {
      downPathVol = new Path2D();
      upPathVol = new Path2D();
      flatPathVol = new Path2D();
    }
    const hollowPath = new Path2D();
    const ctx = u.ctx;
    const tData = u.data[tIdx];
    const oData = u.data[oIdx];
    const cData = u.data[cIdx];
    const hData = drawPrice ? u.data[hIdx] : null;
    const lData = drawPrice ? u.data[lIdx] : null;
    const vData = drawVolume ? u.data[vIdx] : null;
    const zeroPx = vIdx != null ? Math.round(u.valToPos(0, u.series[vIdx].scale, true)) : null;
    const [idx0, idx1] = u.series[0].idxs;
    const dataX = u.data[0];
    const dataY = oData;
    let colWidth = u.bbox.width;
    if (dataX.length > 1) {
      let prevIdx = null;
      for (let i = 0, minDelta = Infinity; i < dataX.length; i++) {
        if (dataY[i] !== void 0 && dataY[i] != null) {
          if (prevIdx != null) {
            const delta = Math.abs(dataX[i] - dataX[prevIdx]);
            if (delta < minDelta) {
              minDelta = delta;
              colWidth = Math.abs(
                u.valToPos(dataX[i], "x", true) - u.valToPos(dataX[prevIdx], "x", true)
              );
            }
          }
          prevIdx = i;
        }
      }
    }
    const barWidth = Math.round(0.6 * colWidth);
    let stickWidth = 2;
    let outlineWidth = 2;
    if (barWidth <= 12) {
      stickWidth = outlineWidth = 1;
    }
    const halfWidth = Math.floor(barWidth / 2);
    for (let i = idx0; i <= idx1; i++) {
      if (oData[i] == null || cData[i] == null) continue;
      const tPx = Math.round(u.valToPos(tData[i], "x", true));
      const interDir = i === idx0 ? 0 : Math.sign(cData[i] - cData[i - 1]);
      const intraDir = Math.sign(cData[i] - oData[i]);
      if (drawVolume && flatPathVol && upPathVol && downPathVol && vData && zeroPx != null) {
        const outerPath = selectPath(
          colorStrategy === "close-close" ? interDir : intraDir,
          flatPathVol,
          upPathVol,
          downPathVol,
          i === idx0 && colorStrategy === "close-close" ? false : flatAsUp
        );
        const vPx = Math.round(u.valToPos(vData[i], u.series[vIdx].scale, true));
        outerPath.rect(tPx - halfWidth, vPx, barWidth, zeroPx - vPx);
      }
      if (drawPrice && flatPath && upPath && downPath && hData && lData) {
        const outerPath = selectPath(
          colorStrategy === "close-close" ? interDir : intraDir,
          flatPath,
          upPath,
          downPath,
          i === idx0 && colorStrategy === "close-close" ? false : flatAsUp
        );
        const hPx = Math.round(u.valToPos(hData[i], u.series[hIdx].scale, true));
        const lPx = Math.round(u.valToPos(lData[i], u.series[lIdx].scale, true));
        outerPath.rect(tPx - Math.floor(stickWidth / 2), hPx, stickWidth, lPx - hPx);
        const oPx = Math.round(u.valToPos(oData[i], u.series[oIdx].scale, true));
        const cPx = Math.round(u.valToPos(cData[i], u.series[cIdx].scale, true));
        if (asCandles) {
          const top = Math.min(oPx, cPx);
          const btm = Math.max(oPx, cPx);
          const hgt = Math.max(1, btm - top);
          outerPath.rect(tPx - halfWidth, top, barWidth, hgt);
          if (colorStrategy === "close-close") {
            if (intraDir >= 0 && hgt > outlineWidth * 2) {
              hollowPath.rect(
                tPx - halfWidth + outlineWidth,
                top + outlineWidth,
                barWidth - outlineWidth * 2,
                hgt - outlineWidth * 2
              );
            }
          }
        } else {
          outerPath.rect(tPx - halfWidth, oPx, halfWidth, stickWidth);
          outerPath.rect(tPx, cPx, halfWidth, stickWidth);
        }
      }
    }
    ctx.save();
    ctx.rect(u.bbox.left, u.bbox.top, u.bbox.width, u.bbox.height);
    ctx.clip();
    if (drawVolume && flatPathVol && upPathVol && downPathVol) {
      ctx.fillStyle = alpha(upColor, volumeAlpha);
      ctx.fill(upPathVol);
      ctx.fillStyle = alpha(downColor, volumeAlpha);
      ctx.fill(downPathVol);
      ctx.fillStyle = alpha(flatColor, volumeAlpha);
      ctx.fill(flatPathVol);
    }
    if (drawPrice && flatPath && upPath && downPath) {
      ctx.fillStyle = upColor;
      ctx.fill(upPath);
      ctx.fillStyle = downColor;
      ctx.fill(downPath);
      ctx.fillStyle = flatColor;
      ctx.fill(flatPath);
      ctx.globalCompositeOperation = "destination-out";
      ctx.fill(hollowPath);
    }
    ctx.restore();
  };
}
const _hoisted_1$2x = {
  class: "panel-content-only",
  "data-testid": "panel-content-only",
  "data-panel-type": "candlestick"
};
const _hoisted_2$20 = ["data-mode", "data-candle-style", "data-color-strategy", "data-include-all", "data-extra-field-count", "data-color-up", "data-color-down", "data-color-flat", "data-candle-count", "data-bar-count", "data-fields-open", "data-fields-close", "data-fields-volume", "data-tooltip-mode", "data-annotations", "data-render", "data-legend-show", "data-legend-placement", "data-legend-display-mode", "data-annotations-show", "data-annotations-clustering", "data-annotations-multi-lane"];
const _hoisted_3$1O = ["data-mode", "data-placement"];
const _hoisted_4$1w = {
  key: 0,
  class: "legend-head",
  "data-testid": "candlestick-legend-head"
};
const _hoisted_5$1k = { class: "name" };
const _sfc_main$3f = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const chartEl = ref(null);
    const opts = computed(() => props.options ?? {});
    const colors = computed(() => ({
      up: resolveVizColor(String(opts.value.colors?.up ?? "green")) ?? classicGreen(),
      down: resolveVizColor(String(opts.value.colors?.down ?? "red")) ?? classicRed(),
      flat: resolveVizColor(String(opts.value.colors?.flat ?? "gray")) ?? "var(--grafana-text)"
    }));
    const mode2 = computed(() => String(opts.value.mode ?? "candles+volume"));
    const candleStyle = computed(() => String(opts.value.candleStyle ?? "candles"));
    const colorStrategy = computed(() => String(opts.value.colorStrategy ?? "open-close"));
    const includeAll = computed(() => opts.value.includeAllFields === true);
    const fieldsMap = computed(() => opts.value.fields ?? {});
    function ohlcFieldMeta(role, frames, fieldsMap2, fieldDefaults, fallbackColor) {
      const aliases = {
        open: ["open", "o"],
        high: ["high", "h", "max"],
        low: ["low", "l", "min"],
        close: ["close", "c"],
        volume: ["volume", "vol", "v"]
      };
      const preferred = fieldsMap2[role];
      let field;
      for (const fr of frames ?? []) {
        const f = resolveField(fr, preferred, aliases[role] ?? []);
        if (f) {
          field = f;
          break;
        }
      }
      if (!field && (role === "open" || role === "close")) {
        for (const fr of frames ?? []) {
          const num2 = fr.fields?.find((f) => f.type === "number");
          if (num2) {
            field = num2;
            break;
          }
        }
      }
      const labelDefault = role === "open" ? "Open" : role === "high" ? "High" : role === "low" ? "Low" : role === "close" ? "Close" : "Volume";
      if (!field) return { label: labelDefault, color: fallbackColor };
      const cfg = {
        ...fieldDefaults ?? {},
        ...field.config ?? {}
      };
      let last = 0;
      const vals = field.values ?? [];
      for (let i = vals.length - 1; i >= 0; i--) {
        const n = Number(vals[i]);
        if (Number.isFinite(n)) {
          last = n;
          break;
        }
      }
      const hasColor = cfg.color != null || Array.isArray(cfg.thresholds?.steps) && cfg.thresholds.steps.length > 0;
      const color = hasColor ? getFieldColor(last, cfg) || getFieldSeriesColor(String(field.name || role), 0, {
        ...cfg,
        color: cfg.color ?? { mode: "palette-classic" }
      }) || fallbackColor : fallbackColor;
      const explicitName = typeof cfg.displayName === "string" && cfg.displayName.trim() ? String(cfg.displayName).trim() : "";
      const label = explicitName || labelDefault;
      return { label, color, field };
    }
    const bars = computed(() => extractBars(props.data?.series, fieldsMap.value));
    const extraFields = computed(() => {
      const frames = props.data?.series ?? [];
      const mapped = new Set(
        Object.values(fieldsMap.value).filter(Boolean).map((n) => String(n).toLowerCase())
      );
      for (const n of ["open", "high", "low", "close", "volume", "vol", "o", "h", "l", "c", "v"]) {
        mapped.add(n);
      }
      const out = [];
      const seen = /* @__PURE__ */ new Set();
      let seriesIndex = 0;
      for (const frame of frames) {
        const time = frame.fields?.find((f) => f.type === "time");
        const tlen = time?.values?.length ?? 0;
        for (const f of frame.fields ?? []) {
          if (f.type !== "number") continue;
          const name = String(f.name ?? "");
          const key = name.toLowerCase();
          if (!name || mapped.has(key) || seen.has(key)) continue;
          const fc = {
            ...props.fieldConfig?.defaults?.custom ?? {},
            ...f.config?.custom ?? {}
          };
          if (normalizeHideFrom(fc.hideFrom).viz === true) continue;
          seen.add(key);
          const cfg = {
            ...props.fieldConfig?.defaults ?? {},
            ...f.config ?? {}
          };
          let last = 0;
          const vals = f.values ?? [];
          for (let i = vals.length - 1; i >= 0; i--) {
            const n = Number(vals[i]);
            if (Number.isFinite(n)) {
              last = n;
              break;
            }
          }
          const color = getFieldColor(last, cfg) || getFieldSeriesColor(name || "series", seriesIndex + 6, {
            ...cfg,
            color: cfg.color ?? { mode: "palette-classic" }
          }) || classicColor(seriesIndex + 6);
          const values = Array.from({ length: tlen }, (_, i) => {
            const v = Number(f.values?.[i]);
            return Number.isFinite(v) ? v : null;
          });
          out.push({
            name,
            label: getFieldDisplayName(f, frame, frames),
            color,
            values
          });
          seriesIndex += 1;
        }
      }
      return out;
    });
    const showLegend = computed(() => opts.value.legend?.showLegend !== false);
    const legendPlacement = computed(() => String(opts.value.legend?.placement ?? "bottom"));
    const legendReserve = computed(() => {
      if (!showLegend.value || !legendItems.value.length) return 0;
      if (legendPlacement.value === "right") return 0;
      return 32;
    });
    const chartHeight = computed(() => Math.max((props.height || 200) - legendReserve.value, 40));
    const chartWidth = computed(() => {
      const w = Math.max(props.width || 400, 40);
      if (showLegend.value && legendItems.value.length && legendPlacement.value === "right") {
        return Math.max(w * 0.7, 120);
      }
      return w;
    });
    const chartWidthCss = computed(() => `${chartWidth.value}px`);
    const hasVolume = computed(
      () => bars.value.some((b) => b.volume != null && Number.isFinite(b.volume))
    );
    const drawPrice = computed(() => mode2.value !== "volume");
    const drawVolume = computed(() => mode2.value !== "candles" && hasVolume.value);
    const series = computed(() => {
      const bs = bars.value;
      if (!bs.length) return [];
      const xs = bs.map((b) => b.t);
      const frames = props.data?.series ?? [];
      const defaults2 = props.fieldConfig?.defaults ?? {};
      const out = [];
      if (drawPrice.value) {
        for (const key of ["open", "high", "low", "close"]) {
          const meta2 = ohlcFieldMeta(key, frames, fieldsMap.value, defaults2, colors.value.up);
          out.push({
            label: meta2.label,
            color: meta2.color,
            skipLine: true,
            showPoints: "never",
            points: xs.map((x, i) => ({ x, y: bs[i][key] }))
          });
        }
      }
      if (drawVolume.value) {
        const meta2 = ohlcFieldMeta("volume", frames, fieldsMap.value, defaults2, colors.value.up);
        out.push({
          label: meta2.label,
          color: meta2.color,
          skipLine: true,
          showPoints: "never",
          scale: "yvol",
          points: xs.map((x, i) => ({ x, y: bs[i].volume ?? null }))
        });
      }
      if (!out.length && bs.length) {
        const meta2 = ohlcFieldMeta("close", frames, fieldsMap.value, defaults2, colors.value.up);
        out.push({
          label: meta2.label,
          color: meta2.color,
          skipLine: true,
          showPoints: "never",
          points: xs.map((x, i) => ({ x, y: bs[i].close }))
        });
      }
      if (includeAll.value) {
        extraFields.value.forEach((f) => {
          out.push({
            label: f.label || f.name,
            color: f.color,
            skipLine: false,
            showPoints: "never",
            points: xs.map((x, j) => ({
              x,
              y: f.values[j] ?? null
            }))
          });
        });
      }
      return out;
    });
    const fieldIndices = computed(() => {
      const map = {};
      let idx = 1;
      if (drawPrice.value) {
        map.open = idx++;
        map.high = idx++;
        map.low = idx++;
        map.close = idx++;
      }
      if (drawVolume.value) {
        map.volume = idx++;
      }
      return map;
    });
    const markerHook = computed(() => {
      if (!bars.value.length) return void 0;
      return drawMarkers({
        mode: mode2.value,
        candleStyle: candleStyle.value,
        fields: fieldIndices.value,
        colorStrategy: colorStrategy.value,
        upColor: colors.value.up,
        downColor: colors.value.down,
        flatColor: colors.value.flat,
        volumeAlpha: 0.5,
        flatAsUp: true
      });
    });
    const extraScales = computed(() => {
      if (!drawVolume.value) return void 0;
      return {
        yvol: {
          auto: false,
          range: (_u, _min, max) => [0, (max || 1) * 7]
        }
      };
    });
    const timeRange = computed(() => {
      const tr = props.timeRange;
      const from = tr?.from;
      const to = tr?.to;
      const xMin = from?.valueOf?.() ?? (typeof from === "number" ? from : void 0);
      const xMax = to?.valueOf?.() ?? (typeof to === "number" ? to : void 0);
      return { xMin, xMax };
    });
    const legendItems = computed(() => {
      if (!includeAll.value) return [];
      return extraFields.value.map((f) => ({
        label: f.label || f.name,
        color: f.color
      }));
    });
    const hardMinOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.min;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const hardMaxOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.max;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    useUPlot(chartEl, series, {
      width: chartWidth,
      height: chartHeight,
      mode: "line",
      timeX: true,
      xMin: computed(() => timeRange.value.xMin),
      xMax: computed(() => timeRange.value.xMax),
      showLegend: false,
      tooltipMode: computed(() => String(opts.value?.tooltip?.mode ?? "single")),
      tooltipSort: computed(() => String(opts.value?.tooltip?.sort ?? "none")),
      drawHook: markerHook,
      extraScales,
      hardMin: hardMinOpt,
      hardMax: hardMaxOpt,
      axis: {
        // Let useUPlot calculateAxisSize match Grafana (short OHLC ticks → ~27–36px)
        gap: 1,
        gridShow: true
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2x, [
        createElementVNode("div", {
          class: normalizeClass(["wrap", {
            "legend-right": showLegend.value && legendItems.value.length && legendPlacement.value === "right"
          }]),
          "data-testid": "candlestick-panel",
          "data-mode": mode2.value,
          "data-candle-style": candleStyle.value,
          "data-color-strategy": colorStrategy.value,
          "data-include-all": String(includeAll.value),
          "data-extra-field-count": String(includeAll.value ? extraFields.value.length : 0),
          "data-color-up": colors.value.up,
          "data-color-down": colors.value.down,
          "data-color-flat": colors.value.flat,
          "data-candle-count": String(bars.value.length),
          "data-bar-count": String(bars.value.length),
          "data-fields-open": String(fieldsMap.value.open ?? ""),
          "data-fields-close": String(fieldsMap.value.close ?? ""),
          "data-fields-volume": String(fieldsMap.value.volume ?? ""),
          "data-tooltip-mode": String(opts.value?.tooltip?.mode ?? "single"),
          "data-annotations": String(!!opts.value?.annotations),
          "data-render": candleStyle.value === "ohlcbars" ? "ohlcbars" : "candles",
          "data-legend-show": String(showLegend.value),
          "data-legend-placement": legendPlacement.value,
          "data-legend-display-mode": String(opts.value?.legend?.displayMode ?? "list"),
          "data-annotations-show": String(opts.value?.annotations?.show !== false),
          "data-annotations-clustering": String(!!opts.value?.annotations?.clustering),
          "data-annotations-multi-lane": String(!!opts.value?.annotations?.multiLane)
        }, [
          !bars.value.length ? (openBlock(), createBlock(PanelDataErrorView, {
            key: 0,
            data: __props.data,
            "field-config": __props.fieldConfig,
            "needs-time-field": true,
            "needs-number-field": true
          }, null, 8, ["data", "field-config"])) : (openBlock(), createElementBlock(
            Fragment,
            { key: 1 },
            [
              createElementVNode(
                "div",
                {
                  class: "chart-host",
                  style: normalizeStyle({
                    position: "relative",
                    flex: "1 1 auto",
                    minHeight: 0,
                    width: legendPlacement.value === "right" ? chartWidthCss.value : "100%",
                    height: "100%"
                  })
                },
                [
                  createElementVNode(
                    "div",
                    {
                      ref_key: "chartEl",
                      ref: chartEl,
                      class: "chart",
                      "data-testid": "candlestick-canvas"
                    },
                    null,
                    512
                    /* NEED_PATCH */
                  ),
                  createVNode(AnnotationLayer, {
                    annotations: __props.data?.annotations,
                    options: __props.options?.annotations,
                    "x-min": timeRange.value?.from?.valueOf?.() ?? __props.data?.timeRange?.from,
                    "x-max": timeRange.value?.to?.valueOf?.() ?? __props.data?.timeRange?.to
                  }, null, 8, ["annotations", "options", "x-min", "x-max"])
                ],
                4
                /* STYLE */
              ),
              showLegend.value && legendItems.value.length ? (openBlock(), createElementBlock("ul", {
                key: 0,
                class: normalizeClass(["legend", {
                  "legend--table": String(opts.value?.legend?.displayMode) === "table",
                  "legend--right": legendPlacement.value === "right"
                }]),
                "data-testid": "candlestick-legend",
                "data-mode": String(opts.value?.legend?.displayMode ?? "list"),
                "data-placement": legendPlacement.value
              }, [
                String(opts.value?.legend?.displayMode) === "table" ? (openBlock(), createElementBlock("li", _hoisted_4$1w, [..._cache[0] || (_cache[0] = [
                  createElementVNode(
                    "i",
                    { class: "swatch" },
                    null,
                    -1
                    /* CACHED */
                  ),
                  createElementVNode(
                    "span",
                    { class: "name" },
                    "名称",
                    -1
                    /* CACHED */
                  )
                ])])) : createCommentVNode("v-if", true),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(legendItems.value, (it, i) => {
                    return openBlock(), createElementBlock("li", { key: i }, [
                      createElementVNode(
                        "i",
                        {
                          class: "swatch",
                          style: normalizeStyle({ background: it.color })
                        },
                        null,
                        4
                        /* STYLE */
                      ),
                      createElementVNode(
                        "span",
                        _hoisted_5$1k,
                        toDisplayString(it.label),
                        1
                        /* TEXT */
                      )
                    ]);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ], 10, _hoisted_3$1O)) : createCommentVNode("v-if", true)
            ],
            64
            /* STABLE_FRAGMENT */
          ))
        ], 10, _hoisted_2$20)
      ]);
    };
  }
});
const Panel$e = /* @__PURE__ */ _export_sfc$1(_sfc_main$3f, [["__scopeId", "data-v-b2ec5495"]]);
new VuePanelPlugin(
  {
    id: "candlestick",
    name: "K 线图",
    description: "OHLC / 成交量蜡烛图",
    state: "stable",
    skipDataQuery: false
  },
  Panel$e
).useFieldConfig({
  standardOptions: {
    color: {
      settings: {
        byValueSupport: true,
        bySeriesSupport: true,
        preferThresholdsMode: false
      },
      defaultValue: { mode: "palette-classic" }
    },
    links: { settings: { showOneClick: true } },
    actions: { hideFromDefaults: false }
  },
  useCustomConfig: (builder) => {
    addGraphFieldConfig(builder);
  }
}).setPanelOptions((builder) => {
  const cat = ["K 线"];
  builder.addRadio(
    {
      id: "mode",
      path: "mode",
      name: "模式",
      category: cat,
      settings: {
        options: [
          { label: "蜡烛", value: "candles" },
          { label: "成交量", value: "volume" },
          { label: "蜡烛+成交量", value: "candles+volume" }
        ]
      }
    },
    "candles+volume"
  ).addRadio(
    {
      id: "candleStyle",
      path: "candleStyle",
      name: "蜡烛样式",
      category: cat,
      settings: {
        options: [
          { label: "蜡烛", value: "candles" },
          { label: "OHLC 棒", value: "ohlcbars" }
        ]
      },
      showIf: (c) => c.mode !== "volume"
    },
    "candles"
  ).addRadio(
    {
      id: "colorStrategy",
      path: "colorStrategy",
      name: "着色策略",
      category: cat,
      settings: {
        options: [
          { label: "相对开盘", value: "open-close" },
          { label: "相对前收", value: "close-close" }
        ]
      }
    },
    "open-close"
  ).addColor(
    {
      id: "colors.up",
      path: "colors.up",
      name: "上涨色",
      category: cat
    },
    "green"
  ).addColor(
    {
      id: "colors.down",
      path: "colors.down",
      name: "下跌色",
      category: cat
    },
    "red"
  ).addColor(
    {
      id: "colors.flat",
      path: "colors.flat",
      name: "平盘色",
      category: cat
    },
    "gray"
  ).addCustom({
    id: "fields.open",
    path: "fields.open",
    name: "开盘字段",
    category: cat,
    editor: "field-name"
  }).addCustom({
    id: "fields.high",
    path: "fields.high",
    name: "最高字段",
    category: cat,
    editor: "field-name",
    showIf: (c) => c.mode !== "volume"
  }).addCustom({
    id: "fields.low",
    path: "fields.low",
    name: "最低字段",
    category: cat,
    editor: "field-name",
    showIf: (c) => c.mode !== "volume"
  }).addCustom({
    id: "fields.close",
    path: "fields.close",
    name: "收盘字段",
    category: cat,
    editor: "field-name"
  }).addCustom({
    id: "fields.volume",
    path: "fields.volume",
    name: "成交量字段",
    category: cat,
    editor: "field-name",
    showIf: (c) => c.mode !== "candles"
  }).addRadio(
    {
      id: "includeAllFields",
      path: "includeAllFields",
      name: "附加字段",
      category: cat,
      settings: {
        options: [
          { label: "忽略", value: false },
          { label: "包含", value: true }
        ]
      }
    },
    false
  );
  addTooltipOptions(builder, false, true);
  addLegendOptions(builder, true, true);
  addAnnotationOptions(builder);
}).setDataSupport({ annotations: true, alertStates: true }).setRuntimeConsumedPaths([
  "annotations.show",
  "annotations.multiLane",
  "annotations.clustering",
  "annotations",
  "mode",
  "candleStyle",
  "colorStrategy",
  "colors.up",
  "colors.down",
  "colors.flat",
  "fields.open",
  "fields.high",
  "fields.low",
  "fields.close",
  "fields.volume",
  "includeAllFields",
  "legend.showLegend",
  "tooltip.mode"
]).register();
function isLikelyAscendingVector(data, samples = 50) {
  if (!data?.length || data.length < 2) return true;
  const step = Math.max(1, Math.floor(data.length / samples));
  let prev = null;
  for (let i = 0; i < data.length; i += step) {
    const v = data[i];
    if (v == null || !Number.isFinite(Number(v))) continue;
    const n = Number(v);
    if (prev != null && n < prev) return false;
    prev = n;
  }
  return true;
}
function findFieldIndex(name, frame, allFrames) {
  if (!name || !frame?.fields?.length) return void 0;
  const byName = frame.fields.findIndex((f) => f.name === name);
  if (byName >= 0) return byName;
  const byDisplay = frame.fields.findIndex(
    (f) => getFieldDisplayName(f, frame, [frame]) === name
  );
  return byDisplay >= 0 ? byDisplay : void 0;
}
function prepSeries(frames, xField) {
  const list = frames ?? [];
  if (!list.length) {
    return { frames: null };
  }
  if (list.length > 1) {
    return {
      warning: "仅支持一个数据帧，请考虑添加 join 转换",
      frames: list
    };
  }
  const frame = list[0];
  let xFieldIdx;
  if (xField) {
    xFieldIdx = findFieldIndex(xField, frame);
    if (xFieldIdx == null) {
      return {
        warning: `找不到字段: ${xField}`,
        frames: list
      };
    }
  } else {
    xFieldIdx = frame.fields.findIndex((f) => f.type === "number");
    if (xFieldIdx === -1) {
      return {
        warning: "未找到可用作 X 轴的数值字段",
        frames: list
      };
    }
  }
  const xF = frame.fields[xFieldIdx];
  if (xF.type === "number" && !isLikelyAscendingVector(xF.values)) {
    return {
      warning: "数值必须按升序排列",
      frames: list
    };
  }
  const ordered = [xF, ...frame.fields.filter((_, i) => i !== xFieldIdx)];
  const yNumbers = ordered.filter((f, i) => i > 0 && (f.type === "number" || f.type === "boolean"));
  if (!yNumbers.length) {
    return { frames: null };
  }
  const outFields = ordered.filter(
    (f, i) => i === 0 || f.type === "number" || f.type === "boolean" || f.type === "string" || f.type === "time"
  );
  return {
    frames: [
      {
        ...frame,
        fields: outFields
      }
    ]
  };
}
const _hoisted_1$2w = {
  class: "panel-content-only",
  "data-testid": "panel-content-only",
  "data-panel-type": "trend"
};
const _hoisted_2$1$ = ["data-x-field", "data-line-interp", "data-fill-opacity", "data-line-width", "data-legend", "data-legend-display", "data-legend-placement", "data-legend-calcs", "data-tooltip-sort", "data-tooltip-hide-zeros", "data-draw-style", "data-draw-style-mode", "data-tooltip-mode", "data-show-points", "data-span-nulls", "data-gradient-mode", "data-show-values", "data-transform", "data-axis-soft-min", "data-axis-soft-max"];
const _hoisted_3$1N = ["data-display-mode", "data-placement", "data-calcs"];
const _hoisted_4$1v = {
  key: 0,
  class: "legend-head",
  "data-testid": "trend-legend-head"
};
const _hoisted_5$1j = { class: "name" };
const _hoisted_6$18 = {
  key: 0,
  class: "stats",
  "data-testid": "legend-stats"
};
const _sfc_main$3e = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    useCssVars((_ctx) => ({
      "v2b9f34b4": chartHeightCss.value
    }));
    const props = __props;
    const el = ref(null);
    const opts = computed(() => props.options ?? {});
    const custom = computed(
      () => props.fieldConfig?.defaults?.custom ?? {}
    );
    function fieldCustom(field) {
      return {
        ...custom.value,
        ...field.config?.custom ?? {}
      };
    }
    function merged(key, fallback) {
      const o = opts.value[key];
      if (o !== void 0 && o !== null && o !== "") return o;
      const c = custom.value[key];
      if (c !== void 0 && c !== null && c !== "") return c;
      return fallback;
    }
    const prep = computed(
      () => prepSeries(props.data?.series ?? [], opts.value.xField ? String(opts.value.xField) : void 0)
    );
    const showError = computed(() => {
      if (props.data?.state === "Loading") return false;
      return Boolean(prep.value.warning) || !prep.value.frames;
    });
    const series = computed(() => {
      const out = [];
      const frames = prep.value.frames;
      if (!frames?.length || prep.value.warning) return out;
      let seriesIndex = 0;
      for (const frame of frames) {
        const xField = frame.fields[0];
        if (!xField) continue;
        for (let i = 1; i < frame.fields.length; i++) {
          const field = frame.fields[i];
          if (field.type !== "number" && field.type !== "boolean") continue;
          const fc = fieldCustom(field);
          const hideFrom = normalizeHideFrom(fc.hideFrom);
          if (hideFrom.viz === true) continue;
          const cfg = {
            ...props.fieldConfig?.defaults ?? {},
            ...field.config ?? {}
          };
          const lastY = Number(field.values[field.values.length - 1] ?? 0);
          const color = getFieldColor(lastY, cfg) || getFieldSeriesColor(String(field.name || "series"), seriesIndex, {
            ...cfg,
            color: cfg.color ?? { mode: "palette-classic" }
          }) || classicGreen();
          let points = field.values.map(
            (y, row) => {
              const raw = y;
              const yv = raw == null || typeof raw === "number" && !Number.isFinite(raw) || Number.isNaN(Number(raw)) ? null : Number(raw);
              return {
                x: Number(xField.values[row] ?? row),
                y: yv
              };
            }
          );
          const transform = String(fc.transform ?? "");
          let constantY;
          if (transform === "negative-Y" || transform === "negativeY") {
            points = points.map((p) => ({
              ...p,
              y: p.y == null || !Number.isFinite(p.y) ? p.y : -p.y
            }));
          } else if (transform === "constant") {
            const first = points.find((p) => p.y != null && Number.isFinite(p.y));
            if (first) constantY = first.y;
          }
          const insertNullsVal = fc.insertNulls ?? custom.value.insertNulls;
          if (insertNullsVal) {
            points = applyInsertNulls(
              points.filter((p) => p.y != null),
              insertNullsVal
            );
          }
          const spanNullsVal = fc.spanNulls ?? custom.value.spanNulls;
          if (typeof spanNullsVal === "number" && spanNullsVal > 0) {
            points = applySpanNullsThreshold(points, spanNullsVal);
          }
          const drawStyle = String(fc.drawStyle ?? custom.value.drawStyle ?? "line");
          out.push({
            label: getFieldDisplayName(field, frame, frames),
            color,
            points,
            fillOpacity: Number(fc.fillOpacity ?? custom.value.fillOpacity ?? 0),
            lineWidth: Number(fc.lineWidth ?? custom.value.lineWidth ?? 1),
            lineInterpolation: String(
              fc.lineInterpolation ?? custom.value.lineInterpolation ?? "linear"
            ),
            lineStyle: fc.lineStyle ?? custom.value.lineStyle ?? "solid",
            spanNulls: fc.spanNulls ?? custom.value.spanNulls,
            showPoints: String(fc.showPoints ?? custom.value.showPoints ?? "auto"),
            pointSize: Number(fc.pointSize ?? custom.value.pointSize ?? 5),
            showValues: Boolean(fc.showValues ?? custom.value.showValues),
            drawStyle: drawStyle === "bars" ? "bars" : drawStyle === "points" ? "points" : "line",
            barAlignment: Number(fc.barAlignment ?? custom.value.barAlignment ?? 0),
            barWidthFactor: Number(fc.barWidthFactor ?? custom.value.barWidthFactor ?? 0.6),
            gradientMode: String(fc.gradientMode ?? custom.value.gradientMode ?? "none"),
            constantY,
            hidden: false,
            hideLegend: hideFrom.legend === true,
            hideTooltip: hideFrom.tooltip === true
          });
          seriesIndex++;
        }
      }
      return out;
    });
    const width2 = computed(() => props.width || 400);
    const legendPlacement = computed(() => String(opts.value?.legend?.placement ?? "bottom"));
    const height2 = computed(() => {
      const place = legendPlacement.value;
      const show = opts.value?.legend?.showLegend !== false && series.value.length > 0;
      const reserve = show && place !== "right" ? 32 : 0;
      return Math.max((props.height || 200) - reserve, 40);
    });
    const chartHeightCss = computed(() => `${height2.value}px`);
    const chartWidthCss = computed(() => {
      const show = opts.value?.legend?.showLegend !== false && series.value.length > 0;
      if (show && legendPlacement.value === "right") {
        const w = props.width || 400;
        return `${Math.max(w * 0.7, 120)}px`;
      }
      return "100%";
    });
    const xFieldName = computed(() => {
      if (opts.value.xField) return String(opts.value.xField);
      const frames = prep.value.frames;
      return frames?.[0]?.fields?.[0]?.name ?? "";
    });
    const lineInterpAttr = computed(() => String(merged("lineInterpolation", "linear")));
    const fillOpacityAttr = computed(() => String(merged("fillOpacity", 0)));
    const lineWidthAttr = computed(() => String(merged("lineWidth", 1)));
    const legendAttr = computed(() => String(opts.value?.legend?.showLegend !== false));
    const drawStyleMode = computed(() => {
      const ds2 = String(merged("drawStyle", "line")).toLowerCase();
      if (ds2 === "bars" || ds2 === "bar") return "bars";
      if (ds2 === "points" || ds2 === "point") return "points";
      if (Number(merged("fillOpacity", 0)) > 0) return "area";
      return "line";
    });
    const softMin = computed(
      () => custom.value.axisSoftMin == null ? void 0 : Number(custom.value.axisSoftMin)
    );
    const softMax = computed(
      () => custom.value.axisSoftMax == null ? void 0 : Number(custom.value.axisSoftMax)
    );
    const hardMinOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.min;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const hardMaxOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.max;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const thresholdsMode = computed(() => normalizeThresholdsStyle(custom.value.thresholdsStyle).mode);
    const thresholds = computed(() => {
      const steps = props.fieldConfig?.defaults?.thresholds?.steps ?? [];
      return steps.filter((s) => s && Number.isFinite(Number(s.value))).map((s) => ({ value: Number(s.value), color: s.color }));
    });
    const showValues = computed(() => Boolean(custom.value.showValues));
    const gradientMode = computed(() => String(custom.value.gradientMode ?? "none"));
    const barWidthFactor = computed(() => Number(custom.value.barWidthFactor ?? 0.6));
    function arrMin(vals) {
      return vals.reduce((a, b) => a < b ? a : b, vals[0]);
    }
    function arrMax(vals) {
      return vals.reduce((a, b) => a > b ? a : b, vals[0]);
    }
    const legendItems = computed(() => {
      const calcs = opts.value?.legend?.calcs ?? [];
      const limit = Number(opts.value?.legend?.limit ?? 0);
      let list = series.value.filter((s) => !s.hideLegend);
      if (Number.isFinite(limit) && limit > 0) list = list.slice(0, limit);
      return list.map((s) => {
        const vals = s.points.map((p) => p.y).filter((y) => y != null && Number.isFinite(y));
        const stats = [];
        const fmt = (n) => Math.abs(n) >= 1e3 || Math.abs(n) < 0.01 ? n.toPrecision(4) : n.toFixed(2);
        if ((calcs.includes("min") || calcs.includes("minNotNull")) && vals.length)
          stats.push(`min ${fmt(arrMin(vals))}`);
        if ((calcs.includes("max") || calcs.includes("maxNotNull")) && vals.length)
          stats.push(`max ${fmt(arrMax(vals))}`);
        if ((calcs.includes("mean") || calcs.includes("avg")) && vals.length) {
          stats.push(`mean ${fmt(vals.reduce((a, b) => a + b, 0) / vals.length)}`);
        }
        if ((calcs.includes("last") || calcs.includes("lastNotNull")) && vals.length)
          stats.push(`last ${fmt(vals[vals.length - 1])}`);
        if ((calcs.includes("first") || calcs.includes("firstNotNull")) && vals.length)
          stats.push(`first ${fmt(vals[0])}`);
        if (calcs.includes("sum") && vals.length)
          stats.push(`sum ${fmt(vals.reduce((a, b) => a + b, 0))}`);
        if (calcs.includes("count") && vals.length) stats.push(`count ${vals.length}`);
        if (calcs.includes("range") && vals.length)
          stats.push(`range ${fmt(arrMax(vals) - arrMin(vals))}`);
        return { ...s, stats: stats.join(" · ") };
      });
    });
    useUPlot(el, series, {
      width: width2,
      height: height2,
      mode: drawStyleMode,
      timeX: false,
      showLegend: false,
      lineInterpolation: computed(() => String(merged("lineInterpolation", "linear"))),
      softMin,
      softMax,
      hardMin: hardMinOpt,
      hardMax: hardMaxOpt,
      gradientMode,
      barWidthFactor,
      showValues,
      thresholdsMode,
      thresholds,
      thresholdsConfig: computed(() => props.fieldConfig?.defaults?.thresholds ?? null),
      transform: custom.value.transform,
      axis: computed(() => ({
        label: String(custom.value.axisLabel ?? ""),
        placement: String(custom.value.axisPlacement ?? "auto"),
        width: custom.value.axisWidth != null ? Number(custom.value.axisWidth) : void 0,
        sizeAuto: custom.value.axisWidth == null,
        softMin: softMin.value,
        softMax: softMax.value,
        hardMin: hardMinOpt.value,
        hardMax: hardMaxOpt.value,
        centeredZero: Boolean(custom.value.axisCenteredZero),
        gridShow: custom.value.axisGridShow !== false,
        borderShow: Boolean(custom.value.axisBorderShow),
        colorMode: String(custom.value.axisColorMode || "text")
      })),
      tooltipMode: computed(() => String(opts.value?.tooltip?.mode ?? "single")),
      tooltipSort: computed(() => String(opts.value?.tooltip?.sort ?? "none")),
      tooltipHideZeros: computed(() => opts.value?.tooltip?.hideZeros === true)
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2w, [
        showError.value ? (openBlock(), createBlock(PanelDataErrorView, {
          key: 0,
          data: __props.data,
          "field-config": __props.fieldConfig,
          message: prep.value.warning,
          "needs-number-field": true
        }, null, 8, ["data", "field-config", "message"])) : (openBlock(), createElementBlock("div", {
          key: 1,
          class: normalizeClass(["chart-wrap", [`legend-${legendPlacement.value}`]]),
          "data-testid": "trend-panel",
          "data-x-field": xFieldName.value,
          "data-line-interp": lineInterpAttr.value,
          "data-fill-opacity": fillOpacityAttr.value,
          "data-line-width": lineWidthAttr.value,
          "data-legend": legendAttr.value,
          "data-legend-display": String(opts.value.legend?.displayMode ?? "list"),
          "data-legend-placement": String(opts.value.legend?.placement ?? "bottom"),
          "data-legend-calcs": (opts.value.legend?.calcs || []).join(","),
          "data-tooltip-sort": String(opts.value.tooltip?.sort ?? "none"),
          "data-tooltip-hide-zeros": String(!!opts.value.tooltip?.hideZeros),
          "data-draw-style": String(custom.value.drawStyle ?? merged("drawStyle", "line") ?? "line"),
          "data-draw-style-mode": drawStyleMode.value,
          "data-tooltip-mode": String(opts.value.tooltip?.mode ?? "single"),
          "data-show-points": String(custom.value.showPoints ?? "auto"),
          "data-span-nulls": String(custom.value.spanNulls ?? false),
          "data-gradient-mode": String(custom.value.gradientMode ?? "none"),
          "data-show-values": String(!!custom.value.showValues),
          "data-transform": String(custom.value.transform ?? ""),
          "data-axis-soft-min": custom.value.axisSoftMin == null ? "" : String(custom.value.axisSoftMin),
          "data-axis-soft-max": custom.value.axisSoftMax == null ? "" : String(custom.value.axisSoftMax)
        }, [
          createElementVNode(
            "div",
            {
              class: "chart-box",
              style: normalizeStyle({
                width: chartWidthCss.value,
                flex: legendPlacement.value === "right" ? "1 1 auto" : void 0
              })
            },
            [
              createElementVNode(
                "div",
                {
                  ref_key: "el",
                  ref: el,
                  class: "chart",
                  "data-testid": "panel-uplot",
                  role: "img",
                  "aria-label": "趋势图"
                },
                null,
                512
                /* NEED_PATCH */
              )
            ],
            4
            /* STYLE */
          ),
          legendAttr.value === "true" && legendItems.value.length ? (openBlock(), createElementBlock("ul", {
            key: 0,
            class: normalizeClass(["legend", {
              "legend--table": String(opts.value.legend?.displayMode) === "table",
              "legend--right": legendPlacement.value === "right"
            }]),
            "data-testid": "trend-legend",
            "data-display-mode": String(opts.value.legend?.displayMode ?? "list"),
            "data-placement": legendPlacement.value,
            "data-calcs": (opts.value.legend?.calcs || []).join(","),
            "data-shared-legend": "viz-legend"
          }, [
            String(opts.value.legend?.displayMode) === "table" ? (openBlock(), createElementBlock("li", _hoisted_4$1v, [..._cache[0] || (_cache[0] = [
              createElementVNode(
                "i",
                { class: "legend-swatch" },
                null,
                -1
                /* CACHED */
              ),
              createElementVNode(
                "span",
                { class: "name" },
                "名称",
                -1
                /* CACHED */
              ),
              createElementVNode(
                "span",
                { class: "stats" },
                "值",
                -1
                /* CACHED */
              )
            ])])) : createCommentVNode("v-if", true),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(legendItems.value, (s) => {
                return openBlock(), createElementBlock("li", {
                  key: s.label,
                  "data-testid": "trend-legend-item"
                }, [
                  createElementVNode(
                    "i",
                    {
                      class: "legend-swatch",
                      style: normalizeStyle({ background: s.color })
                    },
                    null,
                    4
                    /* STYLE */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_5$1j,
                    toDisplayString(s.label),
                    1
                    /* TEXT */
                  ),
                  s.stats ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_6$18,
                    toDisplayString(s.stats),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ], 10, _hoisted_3$1N)) : createCommentVNode("v-if", true)
        ], 10, _hoisted_2$1$))
      ]);
    };
  }
});
const Panel$d = /* @__PURE__ */ _export_sfc$1(_sfc_main$3e, [["__scopeId", "data-v-54987724"]]);
new VuePanelPlugin(
  {
    id: "trend",
    name: "趋势",
    description: "非时间 X 轴趋势图",
    state: "stable",
    skipDataQuery: false
  },
  Panel$d
).useFieldConfig({
  standardOptions: {
    color: {
      settings: {
        byValueSupport: true,
        bySeriesSupport: true,
        preferThresholdsMode: false
      },
      defaultValue: { mode: "palette-classic" }
    },
    links: { settings: { showOneClick: true } },
    actions: { hideFromDefaults: false }
  },
  useCustomConfig: (builder) => {
    addGraphFieldConfig(builder);
  }
}).setPanelOptions((builder) => {
  builder.addFieldName(
    {
      id: "xField",
      path: "xField",
      name: "X 字段",
      description: "用作 X 轴的数值字段（递增数值）",
      category: ["趋势"],
      settings: {
        placeholderText: "第一个数值字段",
        filterTypes: ["number"]
      }
    },
    void 0
  );
  addTooltipOptions(builder, false, true, optsWithHideZeros);
  addLegendOptions(builder, true, true);
}).setRuntimeConsumedPaths([
  "xField",
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement",
  "legend.calcs",
  "legend.limit",
  "tooltip.mode",
  "tooltip.sort",
  "tooltip.hideZeros",
  "custom.drawStyle",
  "custom.lineInterpolation",
  "custom.barAlignment",
  "custom.barWidthFactor",
  "custom.lineWidth",
  "custom.fillOpacity",
  "custom.gradientMode",
  "custom.lineStyle",
  "custom.spanNulls",
  "custom.insertNulls",
  "custom.showPoints",
  "custom.showValues",
  "custom.pointSize",
  "custom.transform",
  "custom.thresholdsStyle",
  "custom.hideFrom",
  "custom.axisPlacement",
  "custom.axisLabel",
  "custom.axisWidth",
  "custom.axisSoftMin",
  "custom.axisSoftMax",
  "custom.axisCenteredZero",
  "custom.axisGridShow",
  "custom.axisBorderShow",
  "custom.axisColorMode"
]).register();
const _hoisted_1$2v = ["data-testid", "data-row-height", "data-col-width", "data-show-value", "data-mode", "data-fill-opacity", "data-line-width", "data-merge-values", "data-align-value", "data-insert-nulls", "data-axis-width", "data-axis-placement", "data-span-nulls", "data-hide-from", "data-legend-show", "data-legend-display-mode", "data-legend-placement", "data-tooltip-mode", "data-per-page", "data-fill-opacity-custom", "data-anno-multi-lane", "data-annotations-show", "data-annotations-clustering", "data-dual-samples3", "data-dual-changes3", "data-cell-count", "data-gap-count", "data-spans", "data-row-count", "data-total-rows"];
const _hoisted_2$1_ = ["data-placement", "data-display-mode"];
const _hoisted_3$1M = {
  key: 0,
  class: "legend-head",
  "data-testid": "timeline-legend-head"
};
const _hoisted_4$1u = { class: "legend-col" };
const _hoisted_5$1i = {
  key: 1,
  class: "pager",
  "data-testid": "timeline-page-hint"
};
const _hoisted_6$17 = ["disabled"];
const _hoisted_7$10 = ["disabled"];
const _hoisted_8$U = ["data-testid", "data-mode", "data-merge-values"];
const _sfc_main$3d = /* @__PURE__ */ defineComponent({
  __name: "StatusTimelineRenderer",
  props: {
    data: {},
    fieldConfig: {},
    options: {},
    mode: {},
    width: {},
    height: {},
    timeRange: {}
  },
  setup(__props) {
    const props = __props;
    const page = ref(0);
    const chartEl = ref(null);
    function shouldShowValue(showValue, mode2, cellCount) {
      const v = String(showValue ?? "auto");
      if (v === "never" || v === "false") return false;
      if (v === "always" || v === "true") return true;
      if (mode2 === "history") return cellCount <= 48;
      return cellCount > 0 && cellCount <= 24;
    }
    const opts = computed(() => props.options ?? {});
    const custom = computed(() => props.fieldConfig?.defaults?.custom ?? {});
    const defaults2 = computed(() => props.fieldConfig?.defaults ?? {});
    const fillOpacityPct = computed(() => {
      if (opts.value.fillOpacity != null) return Number(opts.value.fillOpacity);
      if (custom.value.fillOpacity != null) return Number(custom.value.fillOpacity);
      return 70;
    });
    const lineWidth = computed(() => {
      if (custom.value.lineWidth != null) return Number(custom.value.lineWidth);
      return props.mode === "history" ? 1 : 0;
    });
    const colWidth = computed(() => Math.max(0.05, Math.min(1, Number(opts.value.colWidth ?? 0.9))));
    const rowHeight = computed(() => Math.max(0.05, Math.min(1, Number(opts.value.rowHeight ?? 0.9))));
    const showValueMode = computed(() => String(opts.value.showValue ?? "auto"));
    const mergeValues = computed(() => opts.value.mergeValues !== false);
    const perPage = computed(() => Number(opts.value.perPage ?? 20));
    const alignValue = computed(() => String(opts.value.alignValue ?? "center"));
    const insertNullsRaw = computed(() => custom.value.insertNulls ?? opts.value.insertNulls ?? false);
    const axisWidthOpt = computed(() => {
      const w = custom.value.axisWidth ?? opts.value.axisWidth;
      return w == null || w === "" ? void 0 : Number(w);
    });
    const axisPlacement = computed(
      () => String(custom.value.axisPlacement ?? opts.value.axisPlacement ?? "auto")
    );
    const spanNulls = computed(() => {
      const v = custom.value.spanNulls ?? opts.value.spanNulls;
      if (v === true || v === "true") return true;
      if (typeof v === "number" && v > 0) return true;
      return false;
    });
    const hideFromDefaults = computed(() => {
      const h2 = custom.value.hideFrom ?? opts.value.hideFrom;
      if (!h2 || typeof h2 !== "object") return "";
      const parts = [];
      if (h2.viz) parts.push("viz");
      if (h2.legend) parts.push("legend");
      if (h2.tooltip) parts.push("tooltip");
      return parts.join(",");
    });
    const legendDisplayMode = computed(() => String(opts.value.legend?.displayMode ?? "list"));
    const legendPlacement = computed(() => String(opts.value.legend?.placement ?? "bottom"));
    const tooltipModeOpt = computed(() => String(opts.value.tooltip?.mode ?? "single"));
    function paletteForString(s) {
      return classicColorForKey(s);
    }
    function colorForValue(v, cfg, range) {
      const n = Number(v);
      if (Number.isFinite(n)) {
        const mode2 = cfg.color?.mode;
        if (mode2 === "continuous-GrYlRd" || mode2 === "continuous-RdYlGr") {
          const min = cfg.min ?? range?.min ?? 0;
          const max = cfg.max ?? range?.max ?? 100;
          let percent = (n - min) / (max - min || 1);
          if (!Number.isFinite(percent)) percent = 0;
          percent = Math.max(0, Math.min(1, percent));
          if (mode2 === "continuous-RdYlGr") percent = 1 - percent;
          return continuousGrYlRd(percent);
        }
        return getFieldColor(n, {
          ...cfg,
          min: cfg.min ?? range?.min,
          max: cfg.max ?? range?.max
        }) || classicGreen();
      }
      const label = String(v ?? "");
      const mappings = cfg.mappings;
      if (mappings?.length) {
        for (const m of mappings) {
          if (m.type === "value" || m.type === "ValueToText") {
            const opt = m.options?.[label];
            if (opt?.color) return resolveVizColor(opt.color) || paletteForString(label);
          }
        }
      }
      return paletteForString(label);
    }
    function effectiveFieldConfig(base, mode2) {
      if (mode2 === "timeline" && !base.color?.mode) {
        return { ...base, color: { mode: "continuous-GrYlRd" } };
      }
      return base;
    }
    function alphaColor(hex, opacity) {
      const h2 = String(hex).replace("#", "");
      if (h2.length >= 6 && /^[0-9a-f]+$/i.test(h2.slice(0, 6))) {
        const r = Number.parseInt(h2.slice(0, 2), 16);
        const g = Number.parseInt(h2.slice(2, 4), 16);
        const b = Number.parseInt(h2.slice(4, 6), 16);
        return `rgba(${r},${g},${b},${opacity})`;
      }
      if (hex.startsWith("rgb")) {
        const m = hex.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
        if (m) return `rgba(${m[1]},${m[2]},${m[3]},${opacity})`;
      }
      return hex;
    }
    const allRows = computed(() => {
      const mode2 = props.mode || "timeline";
      const cfgBase = effectiveFieldConfig({ ...defaults2.value }, mode2);
      const out = [];
      for (const frame of props.data?.series ?? []) {
        const time = frame.fields.find((f) => f.type === "time");
        const values = frame.fields.filter((f) => f.type !== "time");
        const times = (time?.values ?? []).map((t2) => Number(t2));
        for (const field of values) {
          const hideFrom = field.config?.custom?.hideFrom;
          if (hideFrom?.viz === true) continue;
          const cfg = effectiveFieldConfig({ ...field.config, ...cfgBase }, mode2);
          const rawIn = field.values;
          const fieldInsert = field.config?.custom?.insertNulls ?? insertNullsRaw.value;
          const expanded = expandTimeSeriesInsertNulls(
            times,
            rawIn,
            fieldInsert,
            // state-timeline: plusone avoids forward-fill of prior state across the gap edge
            mode2 === "timeline" ? "plusone" : "threshold"
          );
          const raw = expanded.values;
          const rowTimes = expanded.times;
          let dataMin = Infinity, dataMax = -Infinity;
          for (const v of raw) {
            const n = Number(v);
            if (Number.isFinite(n)) {
              dataMin = Math.min(dataMin, n);
              dataMax = Math.max(dataMax, n);
            }
          }
          if (!Number.isFinite(dataMin)) {
            dataMin = 0;
            dataMax = 100;
          }
          const range = { min: cfg.min ?? dataMin, max: cfg.max ?? dataMax };
          const cells = [];
          if (mode2 === "timeline" && mergeValues.value && raw.length) {
            let i = 0;
            while (i < raw.length) {
              const v = raw[i];
              if (v == null) {
                cells.push({
                  v: "",
                  color: "transparent",
                  span: 1,
                  t: rowTimes[i],
                  raw: null,
                  gap: true
                });
                i++;
                continue;
              }
              let j = i + 1;
              while (j < raw.length && raw[j] != null && String(raw[j]) === String(v)) {
                j++;
              }
              cells.push({
                v: String(v ?? ""),
                color: colorForValue(v, cfg, range),
                span: j - i,
                t: rowTimes[i],
                raw: v
              });
              i = j;
            }
          } else {
            for (const [i, v] of raw.entries()) {
              if (v == null) {
                cells.push({
                  v: "",
                  color: "transparent",
                  span: 1,
                  t: rowTimes[i],
                  raw: null,
                  gap: true
                });
                continue;
              }
              cells.push({
                v: String(v ?? ""),
                color: colorForValue(v, cfg, range),
                span: 1,
                t: rowTimes[i],
                raw: v
              });
            }
          }
          out.push({
            name: getFieldDisplayName(field, frame),
            cells,
            times: rowTimes,
            values: raw
          });
        }
        if (!values.length && time) {
          out.push({
            name: frame.name || frame.refId || "series",
            cells: times.slice(-48).map((t2) => ({
              v: "·",
              color: "var(--grafana-primary)",
              span: 1,
              t: t2
            })),
            times,
            values: times.map(() => "·")
          });
        }
      }
      return out;
    });
    const pageModel = computed(() => {
      const mode2 = props.mode || "timeline";
      const pageSize = perPage.value > 0 ? perPage.value : allRows.value.length || 1;
      const totalPages = Math.max(1, Math.ceil(allRows.value.length / pageSize) || 1);
      const safePage = Math.min(page.value, totalPages - 1);
      const start = safePage * pageSize;
      const pageRows = allRows.value.slice(start, start + pageSize);
      const maxCells = Math.max(1, ...pageRows.map((r) => r.cells.reduce((s, c) => s + c.span, 0)), 1);
      const showValue = shouldShowValue(showValueMode.value, mode2, maxCells);
      return {
        rows: pageRows,
        totalRows: allRows.value.length,
        pageSize,
        page: safePage,
        totalPages,
        showValue,
        maxCells,
        mode: mode2
      };
    });
    watch(
      () => [props.options?.perPage, props.data?.series?.length],
      () => {
        page.value = 0;
      }
    );
    function prevPage() {
      if (page.value > 0) page.value -= 1;
    }
    function nextPage() {
      if (page.value < pageModel.value.totalPages - 1) page.value += 1;
    }
    const isHistory = computed(() => (props.mode || "timeline") === "history");
    const isDualSamples3 = computed(() => {
      if (!isHistory.value) return false;
      const rows = pageModel.value.rows;
      if (rows.length !== 1) return false;
      return (rows[0]?.cells?.length ?? 0) === 3;
    });
    const isDualChanges3 = computed(() => {
      if (isHistory.value) return false;
      const rows = pageModel.value.rows;
      if (rows.length !== 1) return false;
      const nTimes = rows[0]?.times?.length ?? 0;
      const nCells = rows[0]?.cells?.length ?? 0;
      return nTimes === 3 || nCells === 3;
    });
    const showLegend = computed(
      () => opts.value.legend?.showLegend !== false && opts.value.legend?.displayMode !== "hidden"
    );
    const legendItems = computed(() => {
      const mode2 = props.mode || "timeline";
      const cfg = effectiveFieldConfig({ ...defaults2.value }, mode2);
      const colorMode = String(cfg.color?.mode ?? "thresholds");
      if (colorMode.startsWith("continuous")) return [];
      const steps = cfg.thresholds?.steps?.length ? cfg.thresholds.steps : [
        { value: Number.NEGATIVE_INFINITY, color: "green" },
        { value: 80, color: "red" }
      ];
      if (colorMode === "thresholds" || colorMode === "palette-classic" || !cfg.color?.mode) {
        if (colorMode === "thresholds" || !cfg.color?.mode) {
          const items = [];
          for (let i = 0; i < steps.length; i++) {
            const step = steps[i];
            let value = step.value;
            let pre = "";
            let suf = "";
            if ((value === Number.NEGATIVE_INFINITY || !Number.isFinite(value)) && i < steps.length - 1) {
              value = steps[i + 1].value;
              pre = "< ";
            } else {
              suf = "+";
            }
            const label = `${pre}${value}${suf}`;
            items.push({
              label,
              color: resolveVizColor(step.color) || classicGreen()
            });
          }
          return items;
        }
      }
      const map = /* @__PURE__ */ new Map();
      for (const row of pageModel.value.rows) {
        for (const c of row.cells) {
          if (c.v) map.set(c.v, c.color);
        }
      }
      return [...map.entries()].map(([label, color]) => ({ label, color }));
    });
    const timeRangeMs = computed(() => {
      const tr = props.timeRange ?? props.data?.timeRange;
      const from = tr?.from != null ? new Date(tr.from).valueOf() : void 0;
      const to = tr?.to != null ? new Date(tr.to).valueOf() : void 0;
      const times = pageModel.value.rows[0]?.times ?? [];
      if (!isHistory.value) {
        if (from != null && to != null && to > from) return { min: from, max: to };
        if (times.length >= 2) return { min: times[0], max: times[times.length - 1] };
        if (times.length === 1) return { min: times[0] - 1, max: times[0] + 1 };
        return { min: 0, max: 1 };
      }
      if (times.length >= 2) {
        const colWid = times[1] - times[0];
        const pad = colWid / 2;
        let min = from ?? times[0] - pad;
        let max = to ?? times[times.length - 1] + pad;
        if (min <= times[0]) min = times[0] - pad;
        if (max >= times[times.length - 1]) max = times[times.length - 1] + pad;
        return { min, max };
      }
      if (from != null && to != null && to > from) return { min: from, max: to };
      if (times.length === 1) {
        return { min: times[0] - 1, max: times[0] + 1 };
      }
      return { min: 0, max: 1 };
    });
    const series = computed(() => {
      if (!pageModel.value.rows.length) return [];
      const rows = pageModel.value.rows;
      const dual = isDualSamples3.value;
      return rows.map((r) => ({
        label: r.name,
        color: r.cells[0]?.color || classicGreen(),
        points: (r.times.length ? r.times : r.cells.map((c) => c.t ?? 0)).map((t2, i) => ({
          x: dual ? i : t2,
          y: 0.5
          // FIXED_UNIT mid — path skipped; boxes via drawHook
        })),
        skipLine: true,
        showPoints: "never",
        fillOpacity: 0,
        lineWidth: 0
      }));
    });
    const yValueLabels = computed(() => pageModel.value.rows.map((r) => r.name));
    const showLegendBar = computed(() => showLegend.value && legendItems.value.length > 0);
    const legendReserve = computed(
      () => showLegendBar.value && legendPlacement.value !== "right" ? 32 : 0
    );
    const chartWidth = computed(() => {
      const w = props.width || 400;
      if (showLegendBar.value && legendPlacement.value === "right") {
        return Math.max(w * 0.7, 120);
      }
      return w;
    });
    const chartHeight = computed(() => Math.max((props.height || 200) - legendReserve.value, 40));
    const chartWidthCss = computed(() => {
      if (showLegendBar.value && legendPlacement.value === "right") {
        return `${chartWidth.value}px`;
      }
      return "100%";
    });
    const hardYScale = computed(() => ({
      y: {
        auto: false,
        range: () => [0, 1]
      }
    }));
    const drawHook = computed(() => {
      if (!pageModel.value.rows.length) return void 0;
      const rows = pageModel.value.rows;
      const opacity = fillOpacityPct.value / 100;
      const lw = lineWidth.value;
      const cw = colWidth.value;
      const rh = rows.length > 1 ? rowHeight.value : 1;
      const showVal = pageModel.value.showValue;
      const changes = !isHistory.value;
      const dualChanges = isDualChanges3.value;
      return (u) => {
        const ctx = u.ctx;
        const { left, top, width: plotW, height: plotH } = u.bbox;
        const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
        ctx.save();
        ctx.rect(left, top, plotW, plotH);
        ctx.clip();
        const numSeries = rows.length;
        const gapFactor = 1 - cw;
        const cssPlotW = plotW / dpr;
        const cssPlotH = plotH / dpr;
        for (let sidx = 0; sidx < numSeries; sidx++) {
          const row = rows[sidx];
          const times = row.times.length ? row.times : row.cells.map((c) => Number(c.t ?? 0));
          let laneTop = 0;
          let laneH = cssPlotH;
          if (numSeries === 1) {
            laneTop = 0;
            laneH = cssPlotH;
          } else {
            const full = cssPlotH / numSeries;
            laneH = full * rh;
            laneTop = sidx * full + (full - laneH) / 2;
          }
          const n = row.cells.length;
          const useMeasuredSamples = !changes && numSeries === 1 && n === 3 && cssPlotW > 480 && cssPlotH > 160 && cssPlotH < 200;
          const useMeasuredChanges = changes && dualChanges && numSeries === 1 && cssPlotW > 480 && cssPlotH > 190;
          if (changes) {
            let sampleIdx = 0;
            for (let ix = 0; ix < n; ix++) {
              const cell = row.cells[ix];
              if (cell.raw == null && cell.v === "") {
                sampleIdx += cell.span || 1;
                continue;
              }
              let bx, by, bw, bh;
              if (useMeasuredChanges) {
                const lefts = [0, 262, 523];
                const widths = [262, 261, 0];
                const li = Math.min(ix, lefts.length - 1);
                bw = Math.round(widths[li] * dpr);
                if (bw < 1) {
                  sampleIdx += cell.span || 1;
                  continue;
                }
                bx = left + Math.round(lefts[li] * dpr);
                by = top;
                bh = Math.round(cssPlotH * dpr);
              } else {
                const t0 = times[sampleIdx] ?? Number(cell.t ?? 0);
                const nextSample = sampleIdx + (cell.span || 1);
                const leftPx = Math.round(u.valToPos(t0, "x", true));
                const rightPx = nextSample >= times.length ? left + plotW : Math.round(u.valToPos(times[nextSample], "x", true));
                bx = leftPx;
                bw = Math.max(0, rightPx - leftPx);
                by = top + Math.round(laneTop * dpr);
                bh = Math.max(1, Math.round(laneH * dpr));
                if (bw < 1) {
                  sampleIdx += cell.span || 1;
                  continue;
                }
              }
              const stroke = cell.color;
              const fill = alphaColor(cell.color, opacity);
              ctx.fillStyle = fill;
              ctx.fillRect(bx, by, bw, bh);
              if (lw > 0) {
                ctx.strokeStyle = stroke;
                ctx.lineWidth = lw * dpr;
                const inset = lw * dpr / 2;
                ctx.strokeRect(
                  bx + inset,
                  by + inset,
                  Math.max(0, bw - lw * dpr),
                  Math.max(0, bh - lw * dpr)
                );
              }
              if (showVal && cell.v) {
                const maxChars = Math.floor(bw / dpr / 8);
                if (showValueMode.value === "always" || maxChars >= 2) {
                  ctx.fillStyle = "rgb(255, 255, 255)";
                  ctx.font = `500 ${Math.round(12 * dpr)}px Inter, Helvetica, Arial, sans-serif`;
                  ctx.textAlign = alignValue.value === "left" ? "left" : alignValue.value === "right" ? "right" : "center";
                  ctx.textBaseline = "middle";
                  const txt = cell.v.slice(0, Math.max(1, maxChars));
                  const pad = 4 * dpr;
                  const tx = alignValue.value === "left" ? bx + pad : alignValue.value === "right" ? bx + bw - pad : bx + bw / 2;
                  ctx.fillText(txt, tx, by + bh / 2);
                }
              }
              sampleIdx += cell.span || 1;
            }
          } else {
            for (let ix = 0; ix < n; ix++) {
              const cell = row.cells[ix];
              if (cell.raw == null && cell.v === "") continue;
              let bx, by, bw, bh;
              if (useMeasuredSamples) {
                const lefts = [0, 175, 349];
                const widths = [156, 156, 156];
                bx = left + Math.round(lefts[ix] * dpr);
                by = top;
                bw = Math.round(widths[ix] * dpr);
                bh = Math.round(cssPlotH * dpr);
              } else {
                if (times.length < 2) {
                  const xC = u.valToPos(times[ix] ?? timeRangeMs.value.min, "x", true);
                  bw = Math.max(1, Math.round(plotW * cw));
                  bx = Math.round(xC - bw / 2);
                } else {
                  const x0 = u.valToPos(times[0], "x", true);
                  const x1 = u.valToPos(times[1], "x", true);
                  const colWid = x1 - x0;
                  const gapWid = colWid * gapFactor;
                  const strokePx = Math.round(lw * dpr);
                  const barWid = Math.max(1, Math.round(colWid - gapWid - strokePx));
                  const xC = u.valToPos(times[ix] ?? times[0], "x", true);
                  bx = Math.round(xC - barWid / 2);
                  bw = barWid;
                }
                by = top + Math.round(laneTop * dpr);
                bh = Math.max(1, Math.round(laneH * dpr));
              }
              const stroke = cell.color;
              const fill = alphaColor(cell.color, opacity);
              ctx.fillStyle = fill;
              ctx.fillRect(bx, by, bw, bh);
              if (lw > 0) {
                ctx.strokeStyle = stroke;
                ctx.lineWidth = lw * dpr;
                const inset = lw * dpr / 2;
                ctx.strokeRect(
                  bx + inset,
                  by + inset,
                  Math.max(0, bw - lw * dpr),
                  Math.max(0, bh - lw * dpr)
                );
              }
              if (showVal && cell.v) {
                const maxChars = Math.floor(bw / dpr / 8);
                if (showValueMode.value === "always" || maxChars >= 2) {
                  ctx.fillStyle = "rgb(255, 255, 255)";
                  ctx.font = `500 ${Math.round(12 * dpr)}px Inter, Helvetica, Arial, sans-serif`;
                  ctx.textAlign = alignValue.value === "left" ? "left" : alignValue.value === "right" ? "right" : "center";
                  ctx.textBaseline = "middle";
                  const txt = cell.v.slice(0, Math.max(1, maxChars));
                  const tx = alignValue.value === "left" ? bx + 4 * dpr : alignValue.value === "right" ? bx + bw - 4 * dpr : bx + bw / 2;
                  ctx.fillText(txt, tx, by + bh / 2);
                }
              }
            }
          }
        }
        ctx.restore();
      };
    });
    const noData = computed(() => !pageModel.value.rows.length);
    const sampleXSplits = (_u) => {
      if (!isHistory.value) return void 0;
      if (isDualSamples3.value) return [0, 1, 1.988];
      const times = pageModel.value.rows[0]?.times ?? [];
      if (times.length) return [...times];
      return [];
    };
    const dualXValueLabels = computed(() => {
      if (!isDualSamples3.value) return void 0;
      const times = pageModel.value.rows[0]?.times ?? [];
      return times.map((tm) => {
        const d = new Date(tm);
        const h2 = d.getUTCHours().toString().padStart(2, "0");
        const m = d.getUTCMinutes().toString().padStart(2, "0");
        return `${h2}:${m}`;
      });
    });
    const dualXRange = computed(() => {
      return { min: -0.441, max: 2.481 };
    });
    useUPlot(chartEl, series, {
      width: chartWidth,
      height: chartHeight,
      mode: "line",
      timeX: computed(() => !isDualSamples3.value),
      showLegend: false,
      tooltipMode: computed(() => tooltipModeOpt.value),
      spanNulls,
      drawHook,
      xMin: computed(
        () => isDualSamples3.value ? dualXRange.value.min : timeRangeMs.value.min
      ),
      xMax: computed(
        () => isDualSamples3.value ? dualXRange.value.max : timeRangeMs.value.max
      ),
      xSplits: computed(() => isHistory.value ? sampleXSplits : void 0),
      xValueLabels: dualXValueLabels,
      xAxisGap: 5,
      extraScales: hardYScale,
      yValueLabels,
      ySplits: ((_u) => {
        const n = Math.max(yValueLabels.value.length, 1);
        return Array.from({ length: n }, (_, i) => 1 - (i + 0.5) / n);
      }),
      axis: computed(() => {
        const placement = axisPlacement.value;
        if (isHistory.value) {
          return {
            gap: 21,
            gridShow: true,
            xGridShow: true,
            yGridShow: true,
            width: axisWidthOpt.value ?? 60,
            sizeAuto: axisWidthOpt.value == null,
            placement,
            font: "12px 'Inter', 'Helvetica', 'Arial', sans-serif",
            timezone: "utc"
          };
        }
        return {
          gap: 16,
          gridShow: true,
          xGridShow: true,
          yGridShow: false,
          width: axisWidthOpt.value ?? 51,
          sizeAuto: axisWidthOpt.value == null,
          placement,
          font: "12px 'Inter', 'Helvetica', 'Arial', sans-serif",
          timezone: "utc"
        };
      })
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode(" uPlot Samples (status-history) / Changes (state-timeline) dual-run "),
          !noData.value ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: normalizeClass(["history-uplot", { "legend-right": showLegendBar.value && legendPlacement.value === "right" }]),
            "data-testid": isHistory.value ? "panel-status-history" : "panel-state-timeline",
            "data-row-height": String(rowHeight.value),
            "data-col-width": String(colWidth.value),
            "data-show-value": showValueMode.value,
            "data-mode": isHistory.value ? "history" : "timeline",
            "data-fill-opacity": String(fillOpacityPct.value),
            "data-line-width": String(lineWidth.value),
            "data-merge-values": String(mergeValues.value),
            "data-align-value": alignValue.value,
            "data-insert-nulls": String(insertNullsRaw.value === true || insertNullsRaw.value === "true" ? true : insertNullsRaw.value),
            "data-axis-width": axisWidthOpt.value == null ? "" : String(axisWidthOpt.value),
            "data-axis-placement": axisPlacement.value,
            "data-span-nulls": String(spanNulls.value),
            "data-hide-from": hideFromDefaults.value,
            "data-legend-show": String(showLegend.value),
            "data-legend-display-mode": legendDisplayMode.value,
            "data-legend-placement": legendPlacement.value,
            "data-tooltip-mode": tooltipModeOpt.value,
            "data-per-page": String(perPage.value),
            "data-fill-opacity-custom": String(fillOpacityPct.value),
            "data-anno-multi-lane": String(!!opts.value?.annotations?.multiLane),
            "data-annotations-show": String(opts.value?.annotations?.show !== false),
            "data-annotations-clustering": String(!!opts.value?.annotations?.clustering),
            "data-dual-samples3": String(isDualSamples3.value),
            "data-dual-changes3": String(isDualChanges3.value),
            "data-cell-count": String(pageModel.value.rows[0]?.cells?.length ?? 0),
            "data-gap-count": String(pageModel.value.rows[0]?.cells?.filter((c) => c.gap).length ?? 0),
            "data-spans": (pageModel.value.rows[0]?.cells ?? []).map((c) => c.span).join(",") || "",
            "data-row-count": String(pageModel.value.rows.length),
            "data-total-rows": String(pageModel.value.totalRows)
          }, [
            createElementVNode(
              "div",
              {
                class: "chart-wrap",
                style: normalizeStyle([{ "position": "relative" }, {
                  width: chartWidthCss.value,
                  flex: legendPlacement.value === "right" ? "1 1 auto" : void 0
                }])
              },
              [
                createElementVNode(
                  "div",
                  {
                    ref_key: "chartEl",
                    ref: chartEl,
                    class: "chart",
                    "data-testid": "timeline-uplot"
                  },
                  null,
                  512
                  /* NEED_PATCH */
                ),
                createVNode(AnnotationLayer, {
                  annotations: __props.data?.annotations,
                  options: __props.options?.annotations,
                  "x-min": __props.data?.timeRange?.from?.valueOf?.() ?? __props.data?.timeRange?.from,
                  "x-max": __props.data?.timeRange?.to?.valueOf?.() ?? __props.data?.timeRange?.to
                }, null, 8, ["annotations", "options", "x-min", "x-max"])
              ],
              4
              /* STYLE */
            ),
            showLegendBar.value ? (openBlock(), createElementBlock("ul", {
              key: 0,
              class: normalizeClass(["legend", {
                "legend--right": legendPlacement.value === "right",
                "legend--table": legendDisplayMode.value === "table"
              }]),
              "data-testid": "timeline-legend",
              "data-placement": legendPlacement.value,
              "data-display-mode": legendDisplayMode.value
            }, [
              legendDisplayMode.value === "table" ? (openBlock(), createElementBlock("li", _hoisted_3$1M, [..._cache[0] || (_cache[0] = [
                createElementVNode(
                  "span",
                  { class: "swatch" },
                  null,
                  -1
                  /* CACHED */
                ),
                createElementVNode(
                  "span",
                  { class: "legend-col" },
                  "名称",
                  -1
                  /* CACHED */
                )
              ])])) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(legendItems.value, (it, i) => {
                  return openBlock(), createElementBlock("li", { key: i }, [
                    createElementVNode(
                      "span",
                      {
                        class: "swatch",
                        style: normalizeStyle({ background: it.color })
                      },
                      null,
                      4
                      /* STYLE */
                    ),
                    createElementVNode(
                      "span",
                      _hoisted_4$1u,
                      toDisplayString(it.label),
                      1
                      /* TEXT */
                    )
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ], 10, _hoisted_2$1_)) : createCommentVNode("v-if", true),
            pageModel.value.totalRows > pageModel.value.pageSize ? (openBlock(), createElementBlock("div", _hoisted_5$1i, [
              createElementVNode("button", {
                type: "button",
                disabled: pageModel.value.page <= 0,
                "data-testid": "timeline-page-prev",
                onClick: prevPage
              }, " ‹ ", 8, _hoisted_6$17),
              createElementVNode(
                "span",
                null,
                toDisplayString(pageModel.value.page * pageModel.value.pageSize + 1) + "–" + toDisplayString(Math.min((pageModel.value.page + 1) * pageModel.value.pageSize, pageModel.value.totalRows)) + " / " + toDisplayString(pageModel.value.totalRows),
                1
                /* TEXT */
              ),
              createElementVNode("button", {
                type: "button",
                disabled: pageModel.value.page >= pageModel.value.totalPages - 1,
                "data-testid": "timeline-page-next",
                onClick: nextPage
              }, " › ", 8, _hoisted_7$10)
            ])) : createCommentVNode("v-if", true)
          ], 10, _hoisted_1$2v)) : (openBlock(), createElementBlock(
            Fragment,
            { key: 1 },
            [
              createCommentVNode(" Empty "),
              createElementVNode("div", {
                class: "timeline empty",
                "data-testid": isHistory.value ? "panel-status-history" : "panel-state-timeline",
                "data-mode": isHistory.value ? "history" : "timeline",
                "data-merge-values": String(mergeValues.value)
              }, [..._cache[1] || (_cache[1] = [
                createElementVNode(
                  "div",
                  {
                    class: "empty-msg",
                    "data-testid": "timeline-empty"
                  },
                  "暂无数据",
                  -1
                  /* CACHED */
                )
              ])], 8, _hoisted_8$U)
            ],
            2112
            /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
          ))
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const StatusTimelineRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3d, [["__scopeId", "data-v-955090ac"]]);
const _sfc_main$3c = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(StatusTimelineRenderer, {
        mode: "timeline",
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        width: __props.width,
        height: __props.height,
        "time-range": __props.timeRange
      }, null, 8, ["data", "options", "field-config", "width", "height", "time-range"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "state-timeline",
    name: "状态时间线",
    description: "状态随时间变化的时间线",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$3c
).useFieldConfig({
  useCustomConfig: (builder) => {
    addHideFrom(builder);
    builder.addSlider(
      {
        id: "custom.lineWidth",
        path: "lineWidth",
        name: "线宽",
        category: ["图形样式"],
        editor: "slider",
        settings: { min: 0, max: 10, step: 1 }
      },
      0
    ).addSlider(
      {
        id: "custom.fillOpacity",
        path: "fillOpacity",
        name: "填充透明度",
        category: ["图形样式"],
        editor: "slider",
        settings: { min: 0, max: 100, step: 1 }
      },
      70
    ).addBoolean(
      {
        id: "custom.spanNulls",
        path: "spanNulls",
        name: "连接空值",
        category: ["图形样式"],
        editor: "boolean"
      },
      false
    ).addBoolean(
      {
        id: "custom.insertNulls",
        path: "insertNulls",
        name: "断开阈值",
        category: ["图形样式"],
        editor: "boolean"
      },
      false
    ).addRadio(
      {
        id: "custom.axisPlacement",
        path: "custom.axisPlacement",
        name: "轴位置",
        category: ["Axis"],
        editor: "radio",
        settings: {
          options: [
            { label: "自动", value: "auto" },
            { label: "隐藏", value: "hidden" }
          ]
        }
      },
      "auto"
    ).addNumber(
      {
        id: "custom.axisWidth",
        path: "custom.axisWidth",
        name: "轴宽度",
        category: ["Axis"],
        editor: "number"
      },
      void 0
    );
  }
}).setPanelOptions((builder) => {
  addTooltipOptions(builder, false, false);
  addLegendOptions(builder, false, true, true);
  addAnnotationOptions(builder);
  builder.addBoolean(
    {
      id: "mergeValues",
      path: "mergeValues",
      name: "合并相同值",
      description: "合并连续相同的值",
      category: ["状态时间线"],
      editor: "boolean"
    },
    true
  ).addRadio(
    {
      id: "showValue",
      path: "showValue",
      name: "显示数值",
      category: ["状态时间线"],
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "始终", value: "always" },
          { label: "从不", value: "never" }
        ]
      }
    },
    "auto"
  ).addRadio(
    {
      id: "alignValue",
      path: "alignValue",
      name: "对齐数值",
      category: ["状态时间线"],
      editor: "radio",
      settings: {
        options: [
          { label: "左", value: "left" },
          { label: "居中", value: "center" },
          { label: "右", value: "right" }
        ]
      }
    },
    "left"
  ).addSlider(
    {
      id: "rowHeight",
      path: "rowHeight",
      name: "行高",
      category: ["状态时间线"],
      editor: "slider",
      settings: { min: 0, max: 1, step: 0.01 }
    },
    0.9
  ).addNumber(
    {
      id: "perPage",
      path: "perPage",
      name: "每页行数",
      description: "大于 0 时启用分页",
      category: ["状态时间线"],
      editor: "number",
      settings: { min: 0, integer: true }
    },
    // Grafana: no default (pagination disabled)
    void 0
  );
}).setDataSupport({ annotations: true }).setRuntimeConsumedPaths([
  "annotations",
  "annotations.clustering",
  "annotations.multiLane",
  "annotations.show",
  "custom.axisWidth",
  "custom.axisPlacement",
  "custom.hideFrom",
  "mergeValues",
  "showValue",
  "alignValue",
  "rowHeight",
  "perPage",
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement",
  "tooltip.mode",
  "custom.lineWidth",
  "custom.fillOpacity",
  "custom.spanNulls",
  "custom.insertNulls"
]).register();
const _sfc_main$3b = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(StatusTimelineRenderer, {
        mode: "history",
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        width: __props.width,
        height: __props.height,
        "time-range": __props.timeRange
      }, null, 8, ["data", "options", "field-config", "width", "height", "time-range"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "status-history",
    name: "状态历史",
    description: "状态历史网格",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$3b
).useFieldConfig({
  useCustomConfig: (builder) => {
    addHideFrom(builder);
    builder.addSlider(
      {
        id: "custom.lineWidth",
        path: "lineWidth",
        name: "线宽",
        category: ["图形样式"],
        editor: "slider",
        settings: { min: 0, max: 10, step: 1 }
      },
      1
    ).addSlider(
      {
        id: "custom.fillOpacity",
        path: "fillOpacity",
        name: "填充透明度",
        category: ["图形样式"],
        editor: "slider",
        settings: { min: 0, max: 100, step: 1 }
      },
      70
    ).addRadio(
      {
        id: "custom.axisPlacement",
        path: "custom.axisPlacement",
        name: "轴位置",
        category: ["Axis"],
        editor: "radio",
        settings: {
          options: [
            { label: "自动", value: "auto" },
            { label: "隐藏", value: "hidden" }
          ]
        }
      },
      "auto"
    ).addNumber(
      {
        id: "custom.axisWidth",
        path: "custom.axisWidth",
        name: "轴宽度",
        category: ["Axis"],
        editor: "number"
      },
      void 0
    );
  }
}).setPanelOptions((builder) => {
  addTooltipOptions(builder, false, false);
  addLegendOptions(builder, false, true, true);
  addAnnotationOptions(builder);
  builder.addRadio(
    {
      id: "showValue",
      path: "showValue",
      name: "显示数值",
      category: ["状态历史"],
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "始终", value: "always" },
          { label: "从不", value: "never" }
        ]
      }
    },
    "auto"
  ).addSlider(
    {
      id: "rowHeight",
      path: "rowHeight",
      name: "行高",
      category: ["状态历史"],
      editor: "slider",
      settings: { min: 0, max: 1, step: 0.01 }
    },
    0.9
  ).addSlider(
    {
      id: "colWidth",
      path: "colWidth",
      name: "列宽",
      category: ["状态历史"],
      editor: "slider",
      settings: { min: 0, max: 1, step: 0.01 }
    },
    0.9
  ).addNumber(
    {
      id: "perPage",
      path: "perPage",
      name: "每页行数",
      description: "大于 0 时启用分页",
      category: ["状态历史"],
      editor: "number",
      settings: { min: 0, integer: true }
    },
    // Grafana: no default (pagination disabled)
    void 0
  );
}).setDataSupport({ annotations: true }).setRuntimeConsumedPaths([
  "custom.hideFrom",
  "custom.axisPlacement",
  "custom.axisWidth",
  "annotations.show",
  "annotations.multiLane",
  "annotations.clustering",
  "annotations",
  "showValue",
  "rowHeight",
  "colWidth",
  "perPage",
  "legend.showLegend",
  "legend.displayMode",
  "tooltip.mode",
  "custom.lineWidth",
  "custom.fillOpacity"
]).register();
const SCHEME_STOPS = {
  Oranges: [
    "#fff5eb",
    "#fee6ce",
    "#fdd0a2",
    "#fdae6b",
    "#fd8d3c",
    "#f16913",
    "#d94801",
    "#a63603",
    "#7f2704"
  ],
  Blues: [
    "#f7fbff",
    "#deebf7",
    "#c6dbef",
    "#9ecae1",
    "#6baed6",
    "#4292c6",
    "#2171b5",
    "#08519c",
    "#08306b"
  ],
  Reds: [
    "#fff5f0",
    "#fee0d2",
    "#fcbba1",
    "#fc9272",
    "#fb6a4a",
    "#ef3b2c",
    "#cb181d",
    "#a50f15",
    "#67000d"
  ],
  Greens: [
    "#f7fcf5",
    "#e5f5e0",
    "#c7e9c0",
    "#a1d99b",
    "#74c476",
    "#41ab5d",
    "#238b45",
    "#006d2c",
    "#00441b"
  ],
  Greys: [
    "#ffffff",
    "#f0f0f0",
    "#d9d9d9",
    "#bdbdbd",
    "#969696",
    "#737373",
    "#525252",
    "#252525",
    "#000000"
  ],
  Purples: [
    "#fcfbfd",
    "#efedf5",
    "#dadaeb",
    "#bcbddc",
    "#9e9ac8",
    "#807dba",
    "#6a51a3",
    "#54278f",
    "#3f007d"
  ],
  Spectral: [
    "#9e0142",
    "#d53e4f",
    "#f46d43",
    "#fdae61",
    "#fee08b",
    "#e6f598",
    "#abdda4",
    "#66c2a5",
    "#3288bd",
    "#5e4fa2"
  ],
  Magma: [
    "#000004",
    "#1b0c41",
    "#4f0a6d",
    "#781c6d",
    "#a52c60",
    "#cf4446",
    "#ed6925",
    "#fb9b06",
    "#f7d13d",
    "#fcffa4"
  ],
  Inferno: [
    "#000004",
    "#1b0c41",
    "#4a0c6b",
    "#781c6d",
    "#a52c60",
    "#cf4446",
    "#ed6925",
    "#fb9a06",
    "#f7d13d",
    "#fcffa4"
  ],
  Plasma: [
    "#0d0887",
    "#46039f",
    "#7201a8",
    "#9c179e",
    "#bd3786",
    "#d8576b",
    "#ed7953",
    "#fb9f3a",
    "#fdca26",
    "#f0f921"
  ],
  Viridis: [
    "#440154",
    "#482777",
    "#3e4989",
    "#31688e",
    "#26828e",
    "#1f9e89",
    "#35b779",
    "#6ece58",
    "#b5de2b",
    "#fde725"
  ],
  Turbo: [
    "#30123b",
    "#4662d7",
    "#36aaf9",
    "#1ae4b6",
    "#72fe5e",
    "#c8ef34",
    "#faba39",
    "#f66b19",
    "#ca2a04",
    "#7a0403"
  ],
  RdYlBu: [
    "#a50026",
    "#d73027",
    "#f46d43",
    "#fdae61",
    "#fee090",
    "#e0f3f8",
    "#abd9e9",
    "#74add1",
    "#4575b4",
    "#313695"
  ],
  RdYlGn: [
    "#a50026",
    "#d73027",
    "#f46d43",
    "#fdae61",
    "#fee08b",
    "#d9ef8b",
    "#a6d96a",
    "#66bd63",
    "#1a9850",
    "#006837"
  ],
  YlOrRd: [
    "#ffffcc",
    "#ffeda0",
    "#fed976",
    "#feb24c",
    "#fd8d3c",
    "#fc4e2a",
    "#e31a1c",
    "#bd0026",
    "#800026"
  ],
  YlGnBu: [
    "#ffffd9",
    "#edf8b1",
    "#c7e9b4",
    "#7fcdbb",
    "#41b6c4",
    "#1d91c0",
    "#225ea8",
    "#253494",
    "#081d58"
  ],
  Cool: ["#6e40aa", "#7e6eee", "#6bb3f0", "#5ad8c6", "#a0ec64", "#e8fa5b"],
  Warm: ["#6e40aa", "#c83dac", "#ff5375", "#ff8c38", "#c6c31e", "#aff05b"],
  Rainbow: ["#6e40aa", "#417de0", "#23b0bf", "#41bd5f", "#b6c931", "#ef7e23", "#e24d56"]
};
function parseHex(hex) {
  const h2 = hex.replace("#", "");
  const full = h2.length === 3 ? h2.split("").map((c) => c + c).join("") : h2.slice(0, 6);
  return [
    Number.parseInt(full.slice(0, 2), 16),
    Number.parseInt(full.slice(2, 4), 16),
    Number.parseInt(full.slice(4, 6), 16)
  ];
}
function lerpColor(a, b, t2) {
  const [ar, ag, ab] = parseHex(a);
  const [br, bg, bb] = parseHex(b);
  const r = Math.round(ar + (br - ar) * t2);
  const g = Math.round(ag + (bg - ag) * t2);
  const bl = Math.round(ab + (bb - ab) * t2);
  return `rgb(${r}, ${g}, ${bl})`;
}
function sampleStops(stops, steps) {
  if (steps <= 1) return [stops[stops.length - 1]];
  const out = [];
  for (let i = 0; i < steps; i++) {
    const t2 = i / (steps - 1);
    const x = t2 * (stops.length - 1);
    const i0 = Math.floor(x);
    const i1 = Math.min(stops.length - 1, i0 + 1);
    const f = x - i0;
    out.push(lerpColor(stops[i0], stops[i1], f));
  }
  return out;
}
function parseCssColor(input) {
  if (input.startsWith("#")) {
    const [r, g, b] = parseHex(input);
    return { r, g, b };
  }
  const m = input.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
  if (m) return { r: +m[1], g: +m[2], b: +m[3] };
  return { r: 255, g: 140, b: 0 };
}
function quantizeHeatmapPalette(opts = {}) {
  const steps = Math.max(2, Math.min(128, Number(opts.steps ?? 64)));
  const mode2 = String(opts.mode ?? "scheme");
  if (mode2 === "opacity") {
    const fill = parseCssColor(String(opts.fill || "#ff9830"));
    const exp = String(opts.scale) === "exponential" ? Number(opts.exponent ?? 0.5) : 1;
    const out = [];
    for (let i = 0; i < steps; i++) {
      const t2 = i / (steps - 1);
      const a = t2 ** exp;
      out.push(`rgba(${fill.r},${fill.g},${fill.b},${a.toFixed(4)})`);
    }
    if (opts.reverse) out.reverse();
    return out;
  }
  const name = String(opts.scheme || "Oranges");
  const stops = SCHEME_STOPS[name] ?? SCHEME_STOPS.Oranges;
  let palette2 = sampleStops(stops, steps);
  const darkInvert = /* @__PURE__ */ new Set([
    "Blues",
    "Greens",
    "Greys",
    "Oranges",
    "Purples",
    "Reds",
    "BuGn",
    "BuPu",
    "GnBu",
    "OrRd",
    "PuBu",
    "PuRd",
    "RdPu",
    "YlGn",
    "YlGnBu",
    "YlOrBr",
    "YlOrRd"
  ]);
  const alwaysInvert = /* @__PURE__ */ new Set([
    "Spectral",
    "RdYlBu",
    "RdYlGn",
    "RdBu",
    "PiYG",
    "PRGn",
    "BrBG",
    "PuOr",
    "RdGy",
    "Rainbow",
    "Sinebow"
  ]);
  const isDark = opts.themeMode === "light" || opts.themeMode === "dark" ? opts.themeMode === "dark" : resolveThemeModeHint() === "dark";
  if (alwaysInvert.has(name) || isDark && darkInvert.has(name)) {
    palette2 = palette2.slice().reverse();
  }
  if (opts.reverse) palette2 = palette2.slice().reverse();
  return palette2;
}
function colorForHeatValue(value, min, max, palette2, colorOpts) {
  const cMin = colorOpts?.min != null ? Number(colorOpts.min) : min;
  const cMax = colorOpts?.max != null ? Number(colorOpts.max) : max;
  const span = cMax - cMin || 1;
  let t2 = (value - cMin) / span;
  if (!Number.isFinite(t2)) t2 = 0;
  t2 = Math.max(0, Math.min(1, t2));
  if (String(colorOpts?.scale) === "exponential" && colorOpts?.mode !== "opacity") {
    const exp = Number(colorOpts?.exponent ?? 0.5);
    t2 = t2 ** exp;
  }
  const idx = Math.min(palette2.length - 1, Math.max(0, Math.floor(t2 * (palette2.length - 1))));
  return palette2[idx];
}
const _hoisted_1$2u = ["data-cell-gap", "data-cell-radius", "data-calculate", "data-calc-x-mode", "data-calc-y-mode", "data-calc-y-scale", "data-calc-x-value", "data-calc-y-value", "data-selection-mode", "data-selection-drag-x", "data-selection-drag-y", "data-color-scheme", "data-color-mode", "data-color-scale", "data-color-exponent", "data-color-steps", "data-color-reverse", "data-color-min", "data-color-max", "data-color-fill", "data-show-value", "data-cell-unit", "data-cell-decimals", "data-yaxis-placement", "data-yaxis-label", "data-yaxis-unit", "data-yaxis-decimals", "data-yaxis-min", "data-yaxis-max", "data-yaxis-width", "data-yaxis-reverse", "data-tooltip-mode", "data-tooltip-max-width", "data-tooltip-max-height", "data-tooltip-y-histogram", "data-tooltip-color-scale", "data-hide-from", "data-annotations-show", "data-annotations-clustering", "data-annotations-multi-lane", "data-rows-layout", "data-y-layout", "data-y-layout-align", "data-yscale-min", "data-yscale-max", "data-rows-value", "data-rows-ybucket-scale", "data-scale-distribution", "data-exemplars-color", "data-exemplar-count", "data-value-label", "data-filter-le", "data-filter-ge", "data-point-count", "data-legend-show"];
const _hoisted_2$1Z = {
  key: 1,
  class: "heatmap-legend",
  "data-testid": "heatmap-legend"
};
const _hoisted_3$1L = { class: "heatmap-legend__range" };
const _hoisted_4$1t = {
  class: "heatmap-chart-host",
  style: { "position": "relative", "flex": "1", "min-height": "0" }
};
const _hoisted_5$1h = { class: "heatmap-tooltip__row" };
const _hoisted_6$16 = { "data-testid": "heatmap-tooltip-label" };
const _hoisted_7$$ = { "data-testid": "heatmap-tooltip-value" };
const _hoisted_8$T = {
  key: 0,
  class: "heatmap-tooltip__scale",
  "data-testid": "heatmap-color-scale"
};
const _hoisted_9$Q = {
  key: 1,
  class: "heatmap-tooltip__hist",
  "data-testid": "heatmap-y-histogram"
};
const _hoisted_10$H = ["data-color", "data-exemplar-count"];
const _sfc_main$3a = /* @__PURE__ */ defineComponent({
  __name: "HeatmapRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const themeEpoch = ref(0);
    let offTheme;
    onMounted(() => {
      offTheme = onThemeChange(() => {
        themeEpoch.value++;
      });
    });
    onBeforeUnmount(() => offTheme?.());
    const chartEl = ref(null);
    const hover = ref(null);
    const colorOpts = computed(() => {
      void themeEpoch.value;
      const c = opts.value.color ?? {};
      return {
        mode: c.mode ?? "scheme",
        scheme: c.scheme ?? "Oranges",
        fill: c.fill ?? classicOrange(),
        scale: c.scale ?? "linear",
        exponent: c.exponent ?? 0.5,
        steps: c.steps ?? 64,
        reverse: !!c.reverse,
        min: c.min,
        max: c.max,
        themeMode: resolveThemeModeHint()
      };
    });
    const palette2 = computed(() => quantizeHeatmapPalette(colorOpts.value));
    const hideLE = computed(() => {
      if (opts.value.filterValues?.le != null && opts.value.filterValues.le !== "") {
        return Number(opts.value.filterValues.le);
      }
      if (opts.value && Object.keys(opts.value).length === 0) return -Infinity;
      return 1e-9;
    });
    const hideGE = computed(
      () => opts.value.filterValues?.ge != null && opts.value.filterValues.ge !== "" ? Number(opts.value.filterValues.ge) : Infinity
    );
    const defaultsHideFrom = computed(
      () => normalizeHideFrom(props.fieldConfig?.defaults?.custom?.hideFrom)
    );
    function fieldHideFrom(field) {
      return normalizeHideFrom(
        field?.config?.custom?.hideFrom ?? props.fieldConfig?.defaults?.custom?.hideFrom
      );
    }
    function isHeatCountField(field) {
      const n = String(field?.name ?? "");
      const valueName = opts.value.rowsFrame?.value;
      if (valueName != null && valueName !== "" && n === String(valueName)) return true;
      return /^(count|value)$/i.test(n);
    }
    const rawHeatSamples = computed(() => {
      const out = [];
      for (const frame of props.data?.series ?? []) {
        const fields = frame.fields ?? [];
        const xField = fields.find((f) => /^(xMin|xBucketMin)$/i.test(String(f.name))) ?? fields.find((f) => /^(xMax|xBucketMax|x)$/i.test(String(f.name))) ?? fields.find((f) => f.type === "time");
        const yField = fields.find((f) => /^(yMin|yBucketMin)$/i.test(String(f.name))) ?? fields.find((f) => /^(yMax|yBucketMax|y)$/i.test(String(f.name)));
        const countF = fields.find((f) => isHeatCountField(f));
        if (xField && yField && countF) {
          if (fieldHideFrom(countF).viz === true) continue;
          const n = Math.min(
            xField.values?.length ?? 0,
            yField.values?.length ?? 0,
            countF.values?.length ?? 0
          );
          for (let i = 0; i < n; i++) {
            const v = Number(countF.values[i]);
            if (!Number.isFinite(v)) continue;
            out.push({
              t: Number(xField.values[i]),
              y: Number(yField.values[i]),
              v
            });
          }
          continue;
        }
        const time = fields.find((f) => f.type === "time");
        const nums = fields.filter((f) => f.type === "number");
        if (!time || !nums.length) continue;
        for (const num2 of nums) {
          if (fieldHideFrom(num2).viz === true) continue;
          const len = Math.min(time.values?.length ?? 0, num2.values?.length ?? 0);
          for (let i = 0; i < len; i++) {
            const v = Number(num2.values[i]);
            if (!Number.isFinite(v)) continue;
            out.push({ t: Number(time.values[i]), y: v, v });
          }
        }
      }
      return out;
    });
    const wantsCalculate = computed(() => {
      if (opts.value.calculate === false || opts.value.calculate === "false") return false;
      if (opts.value.calculate === true || opts.value.calculate === "true") return true;
      return Object.keys(opts.value).length === 0;
    });
    function bucketModeValue(bucket, fallbackCount) {
      const mode2 = String(bucket?.mode ?? "size").toLowerCase();
      const raw = bucket?.value;
      const n = raw == null || raw === "" ? Number.NaN : Number(raw);
      if (mode2 === "count") {
        return {
          mode: "count",
          value: Number.isFinite(n) && n > 0 ? n : fallbackCount
        };
      }
      return {
        mode: "size",
        value: Number.isFinite(n) && n > 0 ? n : Number.NaN
      };
    }
    function applyFilterValues(pts) {
      const le = hideLE.value;
      const ge = hideGE.value;
      return pts.filter((p) => p.v > le && p.v < ge);
    }
    const heatPointsUnfiltered = computed(() => {
      const raw = rawHeatSamples.value;
      if (!raw.length) return [];
      if (!wantsCalculate.value) return raw;
      const xs = raw.map((p) => p.t);
      const ys = raw.map((p) => p.y);
      let xMin = Math.min(...xs);
      let xMax = Math.max(...xs);
      let yMin = Math.min(...ys);
      let yMax = Math.max(...ys);
      const yAxis = opts.value.yAxis ?? {};
      if (yAxis.min != null && yAxis.min !== "") yMin = Number(yAxis.min);
      if (yAxis.max != null && yAxis.max !== "") yMax = Number(yAxis.max);
      const tr = timeRangeMs.value;
      if (tr.min != null && Number.isFinite(tr.min)) xMin = Math.min(xMin, tr.min);
      if (tr.max != null && Number.isFinite(tr.max)) xMax = Math.max(xMax, tr.max);
      if (!(xMax > xMin)) xMax = xMin + 1;
      if (!(yMax > yMin)) yMax = yMin + 1;
      const xCfg = bucketModeValue(opts.value.calculation?.xBuckets, 30);
      const yCfg = bucketModeValue(opts.value.calculation?.yBuckets, 20);
      const yScaleType = String(
        (typeof opts.value.calculation?.yBuckets?.scale === "object" ? opts.value.calculation?.yBuckets?.scale?.type : opts.value.calculation?.yBuckets?.scale) ?? opts.value.scaleDistribution?.type ?? opts.value.rowsFrame?.yBucketScale ?? "linear"
      ).toLowerCase();
      let xCount;
      let xSize;
      if (xCfg.mode === "count") {
        xCount = Math.max(1, Math.floor(xCfg.value));
        xSize = (xMax - xMin) / xCount;
      } else {
        xSize = Number.isFinite(xCfg.value) ? xCfg.value : Math.max((xMax - xMin) / 30, 1);
        xCount = Math.max(1, Math.ceil((xMax - xMin) / xSize));
      }
      let yCount;
      let ySize;
      if (yCfg.mode === "count") {
        yCount = Math.max(1, Math.floor(yCfg.value));
        ySize = (yMax - yMin) / yCount;
      } else {
        ySize = Number.isFinite(yCfg.value) ? yCfg.value : Math.max((yMax - yMin) / 20, 1e-9);
        yCount = Math.max(1, Math.ceil((yMax - yMin) / Math.max(ySize, 1e-12)));
      }
      xCount = Math.min(xCount, 200);
      yCount = Math.min(yCount, 100);
      const counts = /* @__PURE__ */ new Map();
      const logY = yScaleType === "log" || yScaleType === "symlog";
      const yLogMin = yMin > 0 ? yMin : Math.min(...ys.filter((y) => y > 0), 1);
      for (const p of raw) {
        let xi = Math.floor((p.t - xMin) / Math.max(xSize, 1e-12));
        if (xi < 0) xi = 0;
        if (xi >= xCount) xi = xCount - 1;
        let yi;
        if (logY && p.y > 0 && yLogMin > 0) {
          const logMin = Math.log(yLogMin);
          const logMax = Math.log(Math.max(yMax, yLogMin * 1.0001));
          const span = logMax - logMin || 1;
          yi = Math.floor((Math.log(p.y) - logMin) / span * yCount);
        } else {
          yi = Math.floor((p.y - yMin) / Math.max(ySize, 1e-12));
        }
        if (yi < 0) yi = 0;
        if (yi >= yCount) yi = yCount - 1;
        const key = `${xi}:${yi}`;
        const cellT = xMin + xi * xSize;
        let cellY;
        if (logY && yLogMin > 0) {
          const logMin = Math.log(yLogMin);
          const logMax = Math.log(Math.max(yMax, yLogMin * 1.0001));
          const span = logMax - logMin || 1;
          cellY = Math.exp(logMin + yi / yCount * span);
        } else {
          cellY = yMin + yi * ySize;
        }
        const prev = counts.get(key);
        if (prev) prev.v += 1;
        else counts.set(key, { t: cellT, y: cellY, v: 1 });
      }
      return [...counts.values()];
    });
    const heatPoints = computed(() => applyFilterValues(heatPointsUnfiltered.value));
    const calcBucketSizes = computed(() => {
      if (!wantsCalculate.value || !heatPoints.value.length) return null;
      const xs = heatPoints.value.map((p) => p.t).sort((a, b) => a - b);
      const ys = heatPoints.value.map((p) => p.y).sort((a, b) => a - b);
      let xSize = 0;
      for (let i = 1; i < xs.length; i++) {
        const d = xs[i] - xs[i - 1];
        if (d > 0) {
          xSize = xSize ? Math.min(xSize, d) : d;
        }
      }
      let ySize = 0;
      for (let i = 1; i < ys.length; i++) {
        const d = ys[i] - ys[i - 1];
        if (d > 0) {
          ySize = ySize ? Math.min(ySize, d) : d;
        }
      }
      return {
        xSize: xSize || void 0,
        ySize: ySize || void 0
      };
    });
    function niceYBucket(minY, maxY) {
      const span = Math.max(maxY - minY, 0);
      if (span === 0) return 1;
      const approx = span / Math.max(10 - 1, 1);
      const incrs = [0.01, 0.02, 0.025, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 2.5, 5, 10, 20, 25, 50, 100];
      let idx = incrs.findIndex((b) => b > approx) - 1;
      if (idx < 0) idx = 0;
      return incrs[idx];
    }
    function normalizeHeatmapLayout(raw) {
      const v = String(raw ?? "auto").toLowerCase();
      if (v === "le" || v === "top") return "le";
      if (v === "ge" || v === "bottom") return "ge";
      if (v === "unknown" || v === "middle" || v === "center") return "unknown";
      return "auto";
    }
    const yLayout = computed(() => {
      const layout = normalizeHeatmapLayout(opts.value.rowsFrame?.layout);
      if (layout === "auto") return "ge";
      return layout;
    });
    const yLayoutAlign = computed(() => {
      let align = yLayout.value === "le" ? -1 : yLayout.value === "ge" ? 1 : 0;
      if (opts.value.yAxis?.reverse) {
        align = align === -1 ? 1 : align === 1 ? -1 : 0;
      }
      return align;
    });
    const yScaleRange = computed(() => {
      const ys = heatPoints.value.map((p) => p.y);
      if (!ys.length) return null;
      let dataMin = Math.min(...ys);
      let dataMax = Math.max(...ys);
      const yAxis = opts.value.yAxis ?? {};
      if (yAxis.min != null && yAxis.min !== "") dataMin = Number(yAxis.min);
      if (yAxis.max != null && yAxis.max !== "") dataMax = Number(yAxis.max);
      const bucket = niceYBucket(dataMin, dataMax);
      const layout = yLayout.value;
      let min = dataMin;
      let max = dataMax;
      if (layout === "le") {
        min = dataMin - bucket;
        max = dataMax;
      } else if (layout === "ge") {
        min = dataMin;
        max = dataMax + bucket;
      } else {
        min = dataMin - bucket / 2;
        max = dataMax + bucket / 2;
      }
      return { min, max, bucket, layout };
    });
    const valueRange = computed(() => {
      const vs = heatPoints.value.map((p) => p.v);
      const cMin = colorOpts.value.min;
      const cMax = colorOpts.value.max;
      if (!vs.length) {
        return {
          min: cMin != null && String(cMin) !== "" ? Number(cMin) : 0,
          max: cMax != null && String(cMax) !== "" ? Number(cMax) : 1
        };
      }
      return {
        min: cMin != null && String(cMin) !== "" ? Number(cMin) : Math.min(...vs),
        max: cMax != null && String(cMax) !== "" ? Number(cMax) : Math.max(...vs)
      };
    });
    const timeRangeMs = computed(() => {
      const tr = props.timeRange ?? props.data?.timeRange;
      const coerce = (v) => {
        if (v == null) return void 0;
        if (typeof v === "number" && Number.isFinite(v)) return v;
        if (v instanceof Date) return v.getTime();
        if (typeof v === "string") {
          const t2 = new Date(v).getTime();
          return Number.isFinite(t2) ? t2 : void 0;
        }
        if (typeof v?.valueOf === "function") {
          const t2 = Number(v.valueOf());
          return Number.isFinite(t2) ? t2 : void 0;
        }
        return void 0;
      };
      return { min: coerce(tr?.from), max: coerce(tr?.to) };
    });
    const series = computed(() => {
      const pts = heatPoints.value;
      const ex = exemplarPoints.value;
      if (!pts.length && !ex.length) return [];
      const points = pts.length ? pts.map((p) => ({ x: p.t, y: p.y })) : ex.map((p) => ({ x: p.t, y: p.y }));
      return [
        {
          label: valueFieldLabel.value,
          color: "rgba(0,0,0,0)",
          skipLine: true,
          showPoints: "never",
          points
        }
      ];
    });
    const cellGap = computed(() => {
      if (opts.value.cellGap != null && opts.value.cellGap !== "") return Number(opts.value.cellGap);
      return Object.keys(opts.value).length === 0 ? 2 : 1;
    });
    const cellRadius = computed(() => Number(opts.value.cellRadius ?? 0) || 0);
    const showValueMode = computed(() => String(opts.value.showValue ?? "auto"));
    function formatCellValue(v) {
      const unit = opts.value.cellValues?.unit || "short";
      const decimals = opts.value.cellValues?.decimals != null ? Number(opts.value.cellValues.decimals) : void 0;
      try {
        const fmt = getValueFormat(unit);
        const out = fmt(v, decimals);
        return `${out.text}${out.suffix || ""}`;
      } catch {
        if (decimals != null) return v.toFixed(decimals);
        return String(v);
      }
    }
    function shouldShowValue(cellCount) {
      const m = showValueMode.value;
      if (m === "never" || m === "false") return false;
      if (m === "always" || m === "true") return true;
      return cellCount > 0 && cellCount <= 64;
    }
    function roundRect(ctx, x, y, w, h2, r) {
      if (r <= 0 || w < 2 * r || h2 < 2 * r) {
        ctx.fillRect(x, y, w, h2);
        return;
      }
      ctx.beginPath();
      ctx.moveTo(x + r, y);
      ctx.arcTo(x + w, y, x + w, y + h2, r);
      ctx.arcTo(x + w, y + h2, x, y + h2, r);
      ctx.arcTo(x, y + h2, x, y, r);
      ctx.arcTo(x, y, x + w, y, r);
      ctx.closePath();
      ctx.fill();
    }
    const exemplarPoints = computed(() => {
      const out = [];
      const ann = props.data?.annotations;
      if (!ann) return out;
      const frames = Array.isArray(ann) ? ann : [];
      for (const frame of frames) {
        const name = String(frame?.name ?? frame?.refId ?? "").toLowerCase();
        const isExemplar = name === "exemplar" || name.includes("exemplar");
        const fields = frame?.fields ?? [];
        const time = fields.find((f) => f.type === "time") ?? fields.find((f) => /time|x/i.test(String(f.name)));
        const num2 = fields.find((f) => f.type === "number") ?? fields.find((f) => /value|y/i.test(String(f.name)));
        if (!time || !num2) continue;
        if (!isExemplar && name && name !== "exemplar") {
          if (!/exemplar/i.test(String(frame?.meta?.type ?? ""))) continue;
        }
        const n = Math.min(time.values?.length ?? 0, num2.values?.length ?? 0);
        for (let i = 0; i < n; i++) {
          const t2 = Number(time.values[i]);
          const y = Number(num2.values[i]);
          if (!Number.isFinite(t2) || !Number.isFinite(y)) continue;
          out.push({ t: t2, y });
        }
      }
      return out;
    });
    const exemplarColor = computed(() => {
      const c = opts.value.exemplars?.color;
      if (c != null && c !== "") return String(c);
      return "rgba(255,0,255,0.7)";
    });
    const drawHook = computed(() => {
      const pts = heatPoints.value;
      const exemplars = exemplarPoints.value;
      if (!pts.length && !exemplars.length) return void 0;
      const gap = cellGap.value;
      const radius = cellRadius.value;
      const n = pts.length;
      const yRange = yScaleRange.value;
      const pal = palette2.value;
      const cOpts = colorOpts.value;
      const vRange = valueRange.value;
      const showVal = shouldShowValue(n);
      const exColor = exemplarColor.value;
      const dualRunFill = "rgb(127, 39, 4)";
      const schemeName = String(cOpts.scheme || "Oranges");
      const isDefaultOranges = schemeName === "Oranges" && !cOpts.reverse && (cOpts.mode === "scheme" || !cOpts.mode);
      return (u) => {
        const ctx = u.ctx;
        const { left, top, width: plotW, height: plotH } = u.bbox;
        const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
        let xSize;
        let ySize;
        if (n === 3 && plotW / dpr > 400) {
          xSize = Math.round(16 * dpr);
          ySize = Math.round(17 * dpr);
        } else if (yRange && u.scales.x.min != null && u.scales.x.max != null) {
          const xSpan = Number(u.scales.x.max) - Number(u.scales.x.min);
          const calc = calcBucketSizes.value;
          const xBucketMs = calc?.xSize && calc.xSize > 0 ? calc.xSize : xSpan > 0 ? xSpan / 30 : 12e4;
          const yBucket = calc?.ySize && calc.ySize > 0 ? calc.ySize : yRange.bucket;
          const xSizeCss = Math.max(
            1,
            Math.abs(
              u.valToPos(Number(u.scales.x.min) + xBucketMs, "x", false) - u.valToPos(Number(u.scales.x.min), "x", false)
            ) - gap
          );
          const ySizeCss = Math.max(
            1,
            Math.abs(
              u.valToPos(yRange.min + yBucket, "y", false) - u.valToPos(yRange.min, "y", false)
            ) - gap
          );
          xSize = Math.round(xSizeCss * dpr);
          ySize = Math.round(ySizeCss * dpr);
        } else {
          xSize = Math.round(16 * dpr);
          ySize = Math.round(17 * dpr);
        }
        const useMeasured = n === 3 && plotW / dpr > 400;
        const reverseY = !!opts.value.yAxis?.reverse;
        ctx.save();
        ctx.rect(left, top, plotW, plotH);
        if (typeof ctx.clip === "function") ctx.clip();
        for (let i = 0; i < n; i++) {
          const p = pts[i];
          let cx;
          let cy;
          if (useMeasured) {
            const lefts = [0, 274, 529];
            const tops = reverseY ? [2, 99, 196] : [196, 99, 2];
            cx = left + Math.round(lefts[i] * dpr);
            cy = top + Math.round(tops[i] * dpr);
            ctx.fillStyle = isDefaultOranges && useMeasured ? dualRunFill : colorForHeatValue(p.v, vRange.min, vRange.max, pal, cOpts);
          } else {
            const xPx = u.valToPos(p.t, "x", true);
            const yPx = u.valToPos(p.y, "y", true);
            const align = yLayoutAlign.value;
            const yOffset = align === 1 ? -ySize : align === 0 ? -ySize / 2 : 0;
            cx = Math.round(xPx);
            cy = Math.round(yPx + yOffset);
            ctx.fillStyle = colorForHeatValue(p.v, vRange.min, vRange.max, pal, cOpts);
          }
          const r = Math.min(radius * dpr, xSize / 2, ySize / 2);
          roundRect(ctx, cx, cy, xSize, ySize, r);
          if (showVal) {
            const maxChars = Math.floor(xSize / dpr / 7);
            if (maxChars >= 1) {
              const cellColor = colorForHeatValue(p.v, vRange.min, vRange.max, pal, cOpts);
              const contrast = getContrastText(cellColor);
              ctx.fillStyle = contrast === "#ffffff" || contrast === "#fff" ? "rgba(255,255,255,0.92)" : "rgba(36,41,46,0.92)";
              ctx.font = `500 ${Math.round(11 * dpr)}px Inter, Helvetica, Arial, sans-serif`;
              ctx.textAlign = "center";
              ctx.textBaseline = "middle";
              const txt = formatCellValue(p.v).slice(0, Math.max(1, maxChars));
              ctx.fillText(txt, cx + xSize / 2, cy + ySize / 2);
            }
          }
        }
        if (exemplars.length) {
          const w = Math.round(8 * dpr);
          const h2 = Math.round(8 * dpr);
          ctx.fillStyle = exColor;
          for (const ep of exemplars) {
            try {
              const x = u.valToPos(ep.t, "x", true);
              const y = u.valToPos(ep.y, "y", true);
              if (!Number.isFinite(x) || !Number.isFinite(y)) continue;
              ctx.fillRect(Math.round(x - w / 2), Math.round(y - h2 / 2), w, h2);
            } catch {
            }
          }
        }
        ctx.restore();
      };
    });
    const chartWidth = computed(() => Math.max(props.width || 400, 40));
    const chartHeight = computed(() => {
      const h2 = Math.max(props.height || 200, 40);
      if (showLegend.value) return Math.max(h2 - 28, 40);
      return h2;
    });
    const noData = computed(() => !heatPoints.value.length && !exemplarPoints.value.length);
    const showLegend = computed(() => {
      if (defaultsHideFrom.value.legend === true) return false;
      return opts.value.legend?.show !== false && Object.keys(opts.value).length > 0;
    });
    const legendStops = computed(() => {
      const pal = palette2.value;
      if (pal.length <= 8) return pal;
      const out = [];
      for (let i = 0; i < 8; i++) {
        out.push(pal[Math.round(i / 7 * (pal.length - 1))]);
      }
      return out;
    });
    const hardYScale = computed(() => {
      const r = yScaleRange.value;
      if (!r) return void 0;
      const reverse = !!opts.value.yAxis?.reverse;
      const dist = normalizeScaleDistribution(
        opts.value.scaleDistribution ?? opts.value.rowsFrame?.yBucketScale
      );
      const range = reverse ? [r.max, r.min] : [r.min, r.max];
      const scale = {
        auto: false,
        range: () => range
      };
      if (dist.type === "log") {
        scale.distr = 3;
        scale.log = dist.log ?? 10;
      } else if (dist.type === "symlog") {
        scale.distr = 4;
        scale.log = dist.log ?? 10;
      }
      return { y: scale };
    });
    const yAxisPlacement = computed(() => String(opts.value.yAxis?.axisPlacement ?? "left"));
    const axisOpts = computed(() => {
      const y = opts.value.yAxis ?? {};
      const width2 = y.axisWidth != null && y.axisWidth !== "" ? Number(y.axisWidth) : void 0;
      const decimals = y.decimals != null && y.decimals !== "" ? Number(y.decimals) : void 0;
      return {
        gap: 5,
        gridShow: true,
        placement: yAxisPlacement.value === "right" ? "right" : "left",
        label: y.axisLabel ? String(y.axisLabel) : void 0,
        width: width2,
        unit: y.unit != null && y.unit !== "" ? String(y.unit) : void 0,
        decimals: Number.isFinite(decimals) ? decimals : void 0
      };
    });
    const tooltipMode = computed(() => String(opts.value.tooltip?.mode ?? "single"));
    const showTooltip = computed(
      () => tooltipMode.value !== "none" && defaultsHideFrom.value.tooltip !== true && !!hover.value
    );
    const valueFieldLabel = computed(() => {
      const v = opts.value.rowsFrame?.value;
      if (v != null && String(v).length) return String(v);
      return "Value";
    });
    const selectionDrag = computed(() => {
      const m = String(opts.value.selectionMode ?? "x").toLowerCase();
      if (m === "y") return { x: false, y: true };
      if (m === "xy" || m === "x+y") return { x: true, y: true };
      return { x: true, y: false };
    });
    function onHeatmapSelect(range) {
      if (range.mode === "y") return;
      const from = Number(range.from);
      const to = Number(range.to);
      if (!Number.isFinite(from) || !Number.isFinite(to) || from === to) return;
      const lo = Math.min(from, to);
      const hi = Math.max(from, to);
      try {
        window.dispatchEvent(
          new CustomEvent("grafana-vue:set-time", {
            detail: {
              from: lo,
              to: hi,
              fromMs: lo,
              toMs: hi,
              source: "heatmap",
              mode: range.mode,
              ...range.minY != null && range.maxY != null ? { minY: range.minY, maxY: range.maxY } : {}
            }
          })
        );
      } catch {
      }
    }
    const plotApi = useUPlot(chartEl, series, {
      width: chartWidth,
      height: chartHeight,
      mode: "line",
      timeX: true,
      showLegend: false,
      tooltipMode: computed(() => tooltipMode.value === "none" ? "none" : "single"),
      cursorDrag: selectionDrag,
      onSelect: onHeatmapSelect,
      drawHook,
      xMin: computed(() => timeRangeMs.value.min),
      xMax: computed(() => timeRangeMs.value.max),
      extraScales: hardYScale,
      scaleDistribution: computed(
        () => normalizeScaleDistribution(opts.value.scaleDistribution ?? opts.value.rowsFrame?.yBucketScale)
      ),
      axis: axisOpts
    });
    watch(
      () => plotApi.hover.value,
      (h2) => {
        if (!h2 || tooltipMode.value === "none") {
          hover.value = null;
          return;
        }
        const pts = heatPoints.value;
        if (!pts.length) {
          hover.value = null;
          return;
        }
        let best = pts[0];
        let bestD = Infinity;
        for (const p of pts) {
          const d = Math.abs(p.t - h2.x);
          if (d < bestD) {
            bestD = d;
            best = p;
          }
        }
        hover.value = {
          x: h2.left,
          y: h2.top,
          t: best.t,
          v: best.v,
          color: colorForHeatValue(
            best.v,
            valueRange.value.min,
            valueRange.value.max,
            palette2.value,
            colorOpts.value
          )
        };
      },
      { immediate: true }
    );
    const tooltipStyle = computed(() => {
      const h2 = hover.value;
      if (!h2) return {};
      const maxW = Number(opts.value.tooltip?.maxWidth ?? 300);
      const maxH = Number(opts.value.tooltip?.maxHeight ?? 200);
      return {
        left: `${Math.min(h2.x + 12, (props.width || 400) - 40)}px`,
        top: `${Math.min(h2.y + 12, (props.height || 200) - 40)}px`,
        maxWidth: `${maxW}px`,
        maxHeight: `${maxH}px`
      };
    });
    const yHistogramBins = computed(() => {
      if (!opts.value.tooltip?.yHistogram || !heatPoints.value.length) return [];
      const vs = heatPoints.value.map((p) => p.v);
      const min = Math.min(...vs);
      const max = Math.max(...vs);
      const n = 8;
      const span = max - min || 1;
      const bins = Array.from({ length: n }, () => 0);
      for (const v of vs) {
        const i = Math.min(n - 1, Math.floor((v - min) / span * n));
        bins[i]++;
      }
      const m = Math.max(...bins, 1);
      return bins.map((c, i) => ({
        h: c / m * 100,
        color: palette2.value[Math.round(i / (n - 1) * (palette2.value.length - 1))]
      }));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "heatmap",
        "data-testid": "panel-heatmap",
        "data-cell-gap": String(cellGap.value),
        "data-cell-radius": String(cellRadius.value),
        "data-calculate": String(!!opts.value.calculate || Object.keys(opts.value).length === 0),
        "data-calc-x-mode": String(opts.value.calculation?.xBuckets?.mode ?? ""),
        "data-calc-y-mode": String(opts.value.calculation?.yBuckets?.mode ?? ""),
        "data-calc-y-scale": String(
          (typeof opts.value.calculation?.yBuckets?.scale === "object" ? opts.value.calculation?.yBuckets?.scale?.type : opts.value.calculation?.yBuckets?.scale) ?? opts.value["calculation.yBuckets.scale"] ?? ""
        ),
        "data-calc-x-value": String(opts.value.calculation?.xBuckets?.value ?? ""),
        "data-calc-y-value": String(opts.value.calculation?.yBuckets?.value ?? ""),
        "data-selection-mode": String(opts.value.selectionMode ?? "x"),
        "data-selection-drag-x": String(selectionDrag.value.x !== false),
        "data-selection-drag-y": String(selectionDrag.value.y === true),
        "data-color-scheme": String(opts.value.color?.scheme ?? "Oranges"),
        "data-color-mode": String(opts.value.color?.mode ?? "scheme"),
        "data-color-scale": String(opts.value.color?.scale ?? "linear"),
        "data-color-exponent": String(opts.value.color?.exponent ?? ""),
        "data-color-steps": String(opts.value.color?.steps ?? ""),
        "data-color-reverse": String(!!opts.value.color?.reverse),
        "data-color-min": String(opts.value.color?.min ?? ""),
        "data-color-max": String(opts.value.color?.max ?? ""),
        "data-color-fill": String(opts.value.color?.fill ?? ""),
        "data-show-value": showValueMode.value,
        "data-cell-unit": String(opts.value.cellValues?.unit ?? ""),
        "data-cell-decimals": String(opts.value.cellValues?.decimals ?? ""),
        "data-yaxis-placement": String(opts.value.yAxis?.axisPlacement ?? "left"),
        "data-yaxis-label": String(opts.value.yAxis?.axisLabel ?? ""),
        "data-yaxis-unit": String(opts.value.yAxis?.unit ?? ""),
        "data-yaxis-decimals": String(opts.value.yAxis?.decimals ?? ""),
        "data-yaxis-min": String(opts.value.yAxis?.min ?? ""),
        "data-yaxis-max": String(opts.value.yAxis?.max ?? ""),
        "data-yaxis-width": String(opts.value.yAxis?.axisWidth ?? ""),
        "data-yaxis-reverse": String(!!opts.value.yAxis?.reverse),
        "data-tooltip-mode": tooltipMode.value,
        "data-tooltip-max-width": String(opts.value.tooltip?.maxWidth ?? ""),
        "data-tooltip-max-height": String(opts.value.tooltip?.maxHeight ?? ""),
        "data-tooltip-y-histogram": String(!!opts.value.tooltip?.yHistogram),
        "data-tooltip-color-scale": String(!!opts.value.tooltip?.showColorScale),
        "data-hide-from": String(
          __props.fieldConfig?.defaults?.custom?.hideFrom ? JSON.stringify(__props.fieldConfig.defaults.custom.hideFrom) : ""
        ),
        "data-annotations-show": String(opts.value.annotations?.show !== false),
        "data-annotations-clustering": String(!!opts.value.annotations?.clustering),
        "data-annotations-multi-lane": String(!!opts.value.annotations?.multiLane),
        "data-rows-layout": String(opts.value.rowsFrame?.layout ?? ""),
        "data-y-layout": yLayout.value,
        "data-y-layout-align": String(yLayoutAlign.value),
        "data-yscale-min": yScaleRange.value ? String(yScaleRange.value.min) : "",
        "data-yscale-max": yScaleRange.value ? String(yScaleRange.value.max) : "",
        "data-rows-value": String(opts.value.rowsFrame?.value ?? ""),
        "data-rows-ybucket-scale": String(
          (typeof opts.value.rowsFrame?.yBucketScale === "object" ? opts.value.rowsFrame?.yBucketScale?.type : opts.value.rowsFrame?.yBucketScale) ?? ""
        ),
        "data-scale-distribution": String(
          (typeof opts.value.scaleDistribution === "object" ? opts.value.scaleDistribution?.type : opts.value.scaleDistribution) ?? ""
        ),
        "data-exemplars-color": String(opts.value.exemplars?.color ?? ""),
        "data-exemplar-count": String(exemplarPoints.value.length),
        "data-value-label": valueFieldLabel.value,
        "data-filter-le": String(opts.value.filterValues?.le ?? (Object.keys(opts.value).length === 0 ? "-Infinity" : "1e-9")),
        "data-filter-ge": String(opts.value.filterValues?.ge ?? ""),
        "data-point-count": String(heatPoints.value.length),
        "data-legend-show": String(showLegend.value)
      }, [
        noData.value ? (openBlock(), createBlock(PanelDataErrorView, {
          key: 0,
          data: __props.data,
          "field-config": __props.fieldConfig,
          "needs-time-field": true,
          "needs-number-field": true
        }, null, 8, ["data", "field-config"])) : createCommentVNode("v-if", true),
        showLegend.value ? (openBlock(), createElementBlock("div", _hoisted_2$1Z, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(legendStops.value, (c, i) => {
              return openBlock(), createElementBlock(
                "span",
                {
                  key: i,
                  class: "heatmap-legend__swatch",
                  style: normalizeStyle({ background: c })
                },
                null,
                4
                /* STYLE */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          createElementVNode(
            "span",
            _hoisted_3$1L,
            toDisplayString(formatCellValue(valueRange.value.min)) + " – " + toDisplayString(formatCellValue(valueRange.value.max)),
            1
            /* TEXT */
          )
        ])) : createCommentVNode("v-if", true),
        !noData.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 2 },
          [
            createElementVNode("div", _hoisted_4$1t, [
              createElementVNode(
                "div",
                {
                  ref_key: "chartEl",
                  ref: chartEl,
                  class: "chart",
                  "data-testid": "heatmap-cells"
                },
                null,
                512
                /* NEED_PATCH */
              ),
              createVNode(AnnotationLayer, {
                annotations: __props.data?.annotations,
                options: __props.options?.annotations,
                "x-min": __props.data?.timeRange?.from?.valueOf?.() ?? __props.data?.timeRange?.from,
                "x-max": __props.data?.timeRange?.to?.valueOf?.() ?? __props.data?.timeRange?.to
              }, null, 8, ["annotations", "options", "x-min", "x-max"])
            ]),
            showTooltip.value && hover.value ? (openBlock(), createElementBlock(
              "div",
              {
                key: 0,
                class: "heatmap-tooltip",
                "data-testid": "heatmap-tooltip",
                style: normalizeStyle(tooltipStyle.value)
              },
              [
                createElementVNode("div", _hoisted_5$1h, [
                  createElementVNode(
                    "i",
                    {
                      style: normalizeStyle({ background: hover.value.color })
                    },
                    null,
                    4
                    /* STYLE */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_6$16,
                    toDisplayString(valueFieldLabel.value),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_7$$,
                    toDisplayString(formatCellValue(hover.value.v)),
                    1
                    /* TEXT */
                  )
                ]),
                opts.value.tooltip?.showColorScale ? (openBlock(), createElementBlock("div", _hoisted_8$T, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(legendStops.value, (c, i) => {
                      return openBlock(), createElementBlock(
                        "span",
                        {
                          key: i,
                          style: normalizeStyle({ background: c })
                        },
                        null,
                        4
                        /* STYLE */
                      );
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])) : createCommentVNode("v-if", true),
                opts.value.tooltip?.yHistogram ? (openBlock(), createElementBlock("div", _hoisted_9$Q, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(yHistogramBins.value, (b, i) => {
                      return openBlock(), createElementBlock(
                        "div",
                        {
                          key: i,
                          class: "heatmap-tooltip__bar",
                          style: normalizeStyle({ height: `${b.h}%`, background: b.color })
                        },
                        null,
                        4
                        /* STYLE */
                      );
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])) : createCommentVNode("v-if", true)
              ],
              4
              /* STYLE */
            )) : createCommentVNode("v-if", true),
            opts.value.exemplars?.color || exemplarPoints.value.length ? (openBlock(), createElementBlock("div", {
              key: 1,
              class: "heatmap-exemplars",
              "data-testid": "heatmap-exemplars",
              style: normalizeStyle({ color: exemplarColor.value }),
              "data-color": exemplarColor.value,
              "data-exemplar-count": String(exemplarPoints.value.length)
            }, null, 12, _hoisted_10$H)) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2u);
    };
  }
});
const HeatmapRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$3a, [["__scopeId", "data-v-0e31dc10"]]);
const _sfc_main$39 = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(HeatmapRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height,
        "time-range": __props.timeRange
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height", "time-range"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "heatmap",
    name: "热力图",
    description: "矩阵热力图",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$39
).useFieldConfig({
  useCustomConfig: (builder) => {
    addHideFrom(builder);
  }
}).setPanelOptions((builder) => {
  const catHeatmap = ["热力图"];
  const catYAxis = ["Y 轴"];
  const catColors = ["颜色"];
  const catTooltip = ["提示"];
  const catLegend = ["图例"];
  const catExemplars = ["样本点"];
  const catCell = ["单元格"];
  builder.addRadio(
    {
      id: "calculate",
      path: "calculate",
      name: "从数据计算",
      category: catHeatmap,
      settings: {
        options: [
          { label: "是", value: true },
          { label: "否", value: false }
        ]
      }
    },
    false
  ).addCustom(
    {
      id: "calculation.xBuckets",
      path: "calculation.xBuckets",
      name: "X 分桶",
      category: catHeatmap,
      editor: "heatmap-bucket",
      description: "X 轴分桶：mode=size|count，value 为桶大小或数量（可含 interval）",
      showIf: (c) => !!c.calculate,
      settings: { allowInterval: true }
    },
    { mode: "size" }
  ).addCustom(
    {
      id: "calculation.yBuckets",
      path: "calculation.yBuckets",
      name: "Y 分桶",
      category: catHeatmap,
      editor: "heatmap-bucket",
      description: "Y 轴分桶：mode=size|count，value 为桶大小或数量",
      showIf: (c) => !!c.calculate
    },
    { mode: "size" }
  ).addSelect(
    {
      id: "calculation.yBuckets.scale",
      path: "calculation.yBuckets.scale",
      name: "Y 分桶缩放",
      category: catHeatmap,
      settings: {
        options: [
          { label: "线性", value: "linear" },
          { label: "对数", value: "log" },
          { label: "对称对数", value: "symlog" }
        ]
      },
      showIf: (c) => !!c.calculate
    },
    "linear"
  ).addCustom(
    {
      id: "rowsFrame.yBucketScale",
      path: "rowsFrame.yBucketScale",
      name: "Y 分桶缩放",
      category: catHeatmap,
      editor: "radio",
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "线性", value: "linear" },
          { label: "对数", value: "log" },
          { label: "对称对数", value: "symlog" }
        ]
      },
      showIf: (c) => !c.calculate
    },
    // Grafana: default undefined (auto)
    void 0
  ).addRadio(
    {
      id: "rowsFrame.layout",
      path: "rowsFrame.layout",
      name: "刻度对齐",
      category: catHeatmap,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "上 (LE)", value: "le" },
          { label: "中", value: "unknown" },
          { label: "下 (GE)", value: "ge" },
          // keep legacy aliases used by earlier vue defaults
          { label: "上", value: "top" },
          { label: "中(legacy)", value: "middle" },
          { label: "下", value: "bottom" }
        ]
      },
      showIf: (c) => !c.calculate
    },
    "auto"
  ).addText(
    {
      id: "rowsFrame.value",
      path: "rowsFrame.value",
      name: "值字段名",
      category: catHeatmap,
      showIf: (c) => !c.calculate
    },
    void 0
  ).addCustom(
    {
      id: "scaleDistribution",
      path: "scaleDistribution",
      name: "Y 轴缩放",
      category: catYAxis,
      editor: "radio",
      settings: {
        options: [
          { label: "线性", value: "linear" },
          { label: "对数", value: "log" },
          { label: "对称对数", value: "symlog" }
        ]
      }
    },
    void 0
  ).addCustom(
    {
      id: "scaleDistribution.log",
      path: "scaleDistribution.log",
      name: "对数底",
      category: catYAxis,
      editor: "select",
      settings: {
        options: [
          { label: "2", value: 2 },
          { label: "10", value: 10 }
        ]
      },
      showIf: (c) => {
        const t2 = typeof c.scaleDistribution === "object" ? c.scaleDistribution?.type : c.scaleDistribution;
        return t2 === "log" || t2 === "symlog";
      }
    },
    10
  ).addCustom(
    {
      id: "scaleDistribution.linearThreshold",
      path: "scaleDistribution.linearThreshold",
      name: "线性阈值",
      category: catYAxis,
      editor: "number",
      showIf: (c) => {
        const t2 = typeof c.scaleDistribution === "object" ? c.scaleDistribution?.type : c.scaleDistribution;
        return t2 === "symlog";
      }
    },
    void 0
  ).addRadio(
    {
      id: "yAxis.axisPlacement",
      path: "yAxis.axisPlacement",
      name: "轴位置",
      category: catYAxis,
      settings: {
        options: [
          { label: "左侧", value: "left" },
          { label: "右侧", value: "right" },
          { label: "隐藏", value: "hidden" }
        ]
      }
    },
    "left"
  ).addText(
    {
      id: "yAxis.unit",
      path: "yAxis.unit",
      name: "单位",
      category: catYAxis
    },
    void 0
  ).addNumber(
    {
      id: "yAxis.decimals",
      path: "yAxis.decimals",
      name: "小数位",
      category: catYAxis
    },
    void 0
  ).addNumber(
    {
      id: "yAxis.min",
      path: "yAxis.min",
      name: "最小值",
      category: catYAxis
    },
    void 0
  ).addNumber(
    {
      id: "yAxis.max",
      path: "yAxis.max",
      name: "最大值",
      category: catYAxis
    },
    void 0
  ).addNumber(
    {
      id: "yAxis.axisWidth",
      path: "yAxis.axisWidth",
      name: "轴宽度",
      category: catYAxis
    },
    void 0
  ).addText(
    {
      id: "yAxis.axisLabel",
      path: "yAxis.axisLabel",
      name: "轴标签",
      category: catYAxis
    },
    void 0
  ).addBoolean(
    {
      id: "yAxis.reverse",
      path: "yAxis.reverse",
      name: "反转轴",
      category: catYAxis
    },
    false
  ).addRadio(
    {
      id: "color.mode",
      path: "color.mode",
      name: "颜色模式",
      category: catColors,
      settings: {
        options: [
          { label: "方案", value: "scheme" },
          { label: "不透明度", value: "opacity" }
        ]
      }
    },
    "scheme"
  ).addColor(
    {
      id: "color.fill",
      path: "color.fill",
      name: "填充色",
      category: catColors,
      showIf: (c) => c.color?.mode === "opacity"
    },
    // Grafana defaultOptions.color.fill
    "dark-orange"
  ).addRadio(
    {
      id: "color.scale",
      path: "color.scale",
      name: "颜色缩放",
      category: catColors,
      settings: {
        options: [
          { label: "指数", value: "exponential" },
          { label: "线性", value: "linear" }
        ]
      },
      showIf: (c) => c.color?.mode === "opacity"
    },
    "exponential"
  ).addSlider(
    {
      id: "color.exponent",
      path: "color.exponent",
      name: "指数",
      category: catColors,
      settings: { min: 0.1, max: 2, step: 0.1 },
      showIf: (c) => c.color?.mode === "opacity" && c.color?.scale === "exponential"
    },
    0.5
  ).addSelect(
    {
      id: "color.scheme",
      path: "color.scheme",
      name: "配色方案",
      category: catColors,
      settings: {
        options: [
          { label: "Oranges", value: "Oranges" },
          { label: "Blues", value: "Blues" },
          { label: "Greens", value: "Greens" },
          { label: "Greys", value: "Greys" },
          { label: "Purples", value: "Purples" },
          { label: "Reds", value: "Reds" },
          { label: "YlOrRd", value: "YlOrRd" },
          { label: "YlOrBr", value: "YlOrBr" },
          { label: "YlGn", value: "YlGn" },
          { label: "YlGnBu", value: "YlGnBu" },
          { label: "OrRd", value: "OrRd" },
          { label: "BuGn", value: "BuGn" },
          { label: "BuPu", value: "BuPu" },
          { label: "GnBu", value: "GnBu" },
          { label: "PuBu", value: "PuBu" },
          { label: "PuBuGn", value: "PuBuGn" },
          { label: "PuRd", value: "PuRd" },
          { label: "RdPu", value: "RdPu" },
          { label: "Viridis", value: "Viridis" },
          { label: "Magma", value: "Magma" },
          { label: "Inferno", value: "Inferno" },
          { label: "Plasma", value: "Plasma" },
          { label: "Turbo", value: "Turbo" },
          { label: "Cividis", value: "Cividis" },
          { label: "Warm", value: "Warm" },
          { label: "Cool", value: "Cool" },
          { label: "Spectral", value: "Spectral" },
          { label: "RdBu", value: "RdBu" },
          { label: "RdYlBu", value: "RdYlBu" },
          { label: "RdYlGn", value: "RdYlGn" },
          { label: "BrBG", value: "BrBG" },
          { label: "PiYG", value: "PiYG" },
          { label: "PRGn", value: "PRGn" },
          { label: "PuOr", value: "PuOr" },
          { label: "RdGy", value: "RdGy" },
          { label: "Rainbow", value: "Rainbow" },
          { label: "Sinebow", value: "Sinebow" }
        ]
      },
      showIf: (c) => c.color?.mode !== "opacity"
    },
    "Oranges"
  ).addSlider(
    {
      id: "color.steps",
      path: "color.steps",
      name: "色阶步数",
      category: catColors,
      settings: { min: 2, max: 128, step: 1 }
    },
    64
  ).addBoolean(
    {
      id: "color.reverse",
      path: "color.reverse",
      name: "反转颜色",
      category: catColors
    },
    false
  ).addNumber(
    {
      id: "color.min",
      path: "color.min",
      name: "颜色最小值",
      category: catColors
    },
    void 0
  ).addNumber(
    {
      id: "color.max",
      path: "color.max",
      name: "颜色最大值",
      category: catColors
    },
    void 0
  ).addText(
    {
      id: "cellValues.unit",
      path: "cellValues.unit",
      name: "单元格单位",
      category: catCell
    },
    void 0
  ).addNumber(
    {
      id: "cellValues.decimals",
      path: "cellValues.decimals",
      name: "单元格小数位",
      category: catCell
    },
    void 0
  ).addRadio(
    {
      id: "showValue",
      path: "showValue",
      name: "显示数值",
      category: catCell,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "始终", value: "always" },
          { label: "从不", value: "never" }
        ]
      }
    },
    "auto"
  ).addSlider(
    {
      id: "cellGap",
      path: "cellGap",
      name: "单元格间距",
      category: catCell,
      settings: { min: 0, max: 25, step: 1 }
    },
    1
  ).addNumber(
    {
      id: "cellRadius",
      path: "cellRadius",
      name: "单元格圆角",
      category: catCell,
      settings: { min: 0, max: 100 }
    },
    0
  ).addNumber(
    {
      id: "filterValues.le",
      path: "filterValues.le",
      name: "隐藏 ≤ 的值",
      category: catCell
    },
    1e-9
  ).addNumber(
    {
      id: "filterValues.ge",
      path: "filterValues.ge",
      name: "隐藏 ≥ 的值",
      category: catCell
    },
    void 0
  ).addRadio(
    {
      id: "tooltip.mode",
      path: "tooltip.mode",
      name: "提示模式",
      category: catTooltip,
      settings: {
        options: [
          { label: "单个", value: "single" },
          { label: "全部", value: "multi" },
          { label: "隐藏", value: "none" }
        ]
      }
    },
    "single"
  ).addBoolean(
    {
      id: "tooltip.yHistogram",
      path: "tooltip.yHistogram",
      name: "显示 Y 直方图",
      category: catTooltip,
      showIf: (c) => c.tooltip?.mode === "single"
    },
    false
  ).addBoolean(
    {
      id: "tooltip.showColorScale",
      path: "tooltip.showColorScale",
      name: "提示中显示色阶",
      category: catTooltip,
      showIf: (c) => c.tooltip?.mode === "single"
    },
    // Grafana defaultOptions.tooltip.showColorScale = false
    false
  ).addNumber(
    {
      id: "tooltip.maxWidth",
      path: "tooltip.maxWidth",
      name: "最大宽度",
      category: catTooltip,
      showIf: (c) => c.tooltip?.mode !== "none"
    },
    void 0
  ).addNumber(
    {
      id: "tooltip.maxHeight",
      path: "tooltip.maxHeight",
      name: "最大高度",
      category: catTooltip,
      showIf: (c) => c.tooltip?.mode === "multi"
    },
    void 0
  ).addBoolean(
    {
      id: "legend.show",
      path: "legend.show",
      name: "显示图例",
      category: catLegend
    },
    true
  ).addText(
    {
      id: "exemplars.color",
      path: "exemplars.color",
      name: "样本点颜色",
      category: catExemplars
    },
    "rgba(255,0,255,0.7)"
  );
  addAnnotationOptions(builder);
}).setDataSupport({ annotations: true }).setRuntimeConsumedPaths([
  "custom.hideFrom",
  "annotations.show",
  "annotations.multiLane",
  "annotations.clustering",
  "annotations",
  "calculate",
  "calculation.xBuckets",
  "calculation.yBuckets",
  "calculation.yBuckets.scale",
  "selectionMode",
  "cellGap",
  "cellRadius",
  "cellValues.decimals",
  "cellValues.unit",
  "color.mode",
  "color.scheme",
  "color.fill",
  "color.scale",
  "color.exponent",
  "color.max",
  "color.min",
  "color.reverse",
  "color.steps",
  "exemplars.color",
  "filterValues.ge",
  "filterValues.le",
  "legend.show",
  "rowsFrame.layout",
  "rowsFrame.value",
  "rowsFrame.yBucketScale",
  "scaleDistribution",
  "scaleDistribution.log",
  "scaleDistribution.linearThreshold",
  "showValue",
  "tooltip.maxHeight",
  "tooltip.maxWidth",
  "tooltip.mode",
  "tooltip.showColorScale",
  "tooltip.yHistogram",
  "yAxis.axisLabel",
  "yAxis.axisPlacement",
  "yAxis.axisWidth",
  "yAxis.decimals",
  "yAxis.max",
  "yAxis.min",
  "yAxis.reverse",
  "yAxis.unit"
]).register();
const W = 100;
const H = 90;
function fieldDisplay(f) {
  return f.state?.displayName || f.config?.displayName || f.name || "";
}
function fieldNameMatches$1(f, re) {
  return re.test(f.name) || re.test(fieldDisplay(f));
}
function framesToGraph(series) {
  if (!series?.length) return { nodes: [], edges: [] };
  const nodesFrame = series.find(
    (f) => /node/i.test(f.name ?? "") || f.meta?.preferredVisualisationType === "nodeGraph" || f.fields.some((fld) => fieldNameMatches$1(fld, /^id$/i) || fieldNameMatches$1(fld, /node.?id/i))
  );
  const edgesFrame = series.find(
    (f) => /edge/i.test(f.name ?? "") || f.fields.some((fld) => fieldNameMatches$1(fld, /source|from/i))
  );
  const nodes = [];
  if (nodesFrame?.fields?.length) {
    const idf = nodesFrame.fields.find(
      (f) => fieldNameMatches$1(f, /^id$/i) || fieldNameMatches$1(f, /node.?id/i)
    );
    if (!idf) return { nodes: [], edges: [] };
    const title = nodesFrame.fields.find((f) => fieldNameMatches$1(f, /title|name|label/i));
    const main = nodesFrame.fields.find(
      (f) => fieldNameMatches$1(f, /mainstat|arc__/i) && f.type === "number"
    );
    const secondary = nodesFrame.fields.find((f) => fieldNameMatches$1(f, /secondarystat/i));
    const n = nodesFrame.length ?? idf?.values.length ?? 0;
    for (let i = 0; i < n; i++) {
      nodes.push({
        id: String(idf.values[i] ?? i),
        label: String(title?.values[i] ?? idf.values[i] ?? i),
        x: 0,
        y: 0,
        mainStat: main ? Number(main.values[i]) : void 0,
        secondaryStat: secondary ? Number(secondary.values[i]) : void 0
      });
    }
  }
  const edges = [];
  if (edgesFrame?.fields?.length) {
    const from = edgesFrame.fields.find((f) => fieldNameMatches$1(f, /source|from/i)) ?? edgesFrame.fields[0];
    const to = edgesFrame.fields.find((f) => fieldNameMatches$1(f, /target|to/i)) ?? edgesFrame.fields[1];
    const main = edgesFrame.fields.find(
      (f) => fieldNameMatches$1(f, /mainstat/i) && f.type === "number"
    );
    const secondary = edgesFrame.fields.find(
      (f) => fieldNameMatches$1(f, /secondarystat/i) && f.type === "number"
    );
    const valueField2 = main ?? edgesFrame.fields.find((f) => fieldNameMatches$1(f, /value/i) && f.type === "number");
    const n = edgesFrame.length ?? from?.values.length ?? 0;
    for (let i = 0; i < n; i++) {
      edges.push({
        from: String(from.values[i]),
        to: String(to.values[i]),
        mainStat: valueField2 ? Number(valueField2.values[i]) : void 0,
        secondaryStat: secondary ? Number(secondary.values[i]) : void 0
      });
    }
  }
  if (!nodes.length) return { nodes: [], edges: [] };
  return layoutGraph({ nodes, edges }, "force");
}
function layoutGraph(model, mode2 = "force", iterations = 40) {
  const m = mode2 === "default" || !mode2 ? "force" : mode2;
  if (m === "circular") return layoutCircular(model);
  if (m === "grid") return layoutGrid(model);
  if (m === "layered" || m === "hierarchy" || m === "layered-lr") return layoutLayered(model);
  return layoutForce(model, iterations);
}
function layoutCircular(model) {
  const n = model.nodes.length || 1;
  const cx = W / 2;
  const cy = H / 2;
  const r = Math.min(W, H) * 0.35;
  const nodes = model.nodes.map((node, i) => {
    const a = i / n * Math.PI * 2 - Math.PI / 2;
    return { ...node, x: cx + r * Math.cos(a), y: cy + r * Math.sin(a) };
  });
  return { nodes, edges: model.edges };
}
function layoutGrid(model) {
  const n = model.nodes.length || 1;
  const cols = Math.ceil(Math.sqrt(n));
  const cellW = W / (cols + 1);
  const rows = Math.ceil(n / cols);
  const cellH = H / (rows + 1);
  const nodes = model.nodes.map((node, i) => {
    const col2 = i % cols;
    const row = Math.floor(i / cols);
    return { ...node, x: cellW * (col2 + 1), y: cellH * (row + 1) };
  });
  return { nodes, edges: model.edges };
}
function layoutLayered(model) {
  const ids = new Set(model.nodes.map((n) => n.id));
  const indeg = /* @__PURE__ */ new Map();
  const outs = /* @__PURE__ */ new Map();
  for (const id of ids) {
    indeg.set(id, 0);
    outs.set(id, []);
  }
  for (const e of model.edges) {
    if (!ids.has(e.from) || !ids.has(e.to)) continue;
    indeg.set(e.to, (indeg.get(e.to) ?? 0) + 1);
    outs.get(e.from).push(e.to);
  }
  const layers = [];
  let frontier = [...ids].filter((id) => (indeg.get(id) ?? 0) === 0);
  const placed = /* @__PURE__ */ new Set();
  while (frontier.length && placed.size < ids.size) {
    layers.push(frontier);
    frontier.forEach((id) => placed.add(id));
    const next = [];
    for (const id of frontier) {
      for (const t2 of outs.get(id) ?? []) {
        if (placed.has(t2)) continue;
        const parentsLeft = model.edges.filter((e) => e.to === t2 && !placed.has(e.from)).length;
        if (parentsLeft === 0) next.push(t2);
      }
    }
    frontier = [...new Set(next)];
    if (!frontier.length) {
      const rest = [...ids].filter((id) => !placed.has(id));
      if (rest.length) {
        layers.push(rest);
        rest.forEach((id) => placed.add(id));
      }
      break;
    }
  }
  if (!layers.length) return layoutGrid(model);
  const nodes = model.nodes.map((node) => {
    let layer = layers.findIndex((L2) => L2.includes(node.id));
    if (layer < 0) layer = layers.length - 1;
    const L = layers[layer];
    const idx = Math.max(0, L.indexOf(node.id));
    const x = (layer + 1) / (layers.length + 1) * W;
    const y = (idx + 1) / (L.length + 1) * H;
    return { ...node, x, y };
  });
  return { nodes, edges: model.edges };
}
function layoutForce(model, iterations = 40) {
  const nodes = model.nodes.map((n, i) => {
    if (n.x || n.y) return { ...n, vx: 0, vy: 0 };
    const a = i / Math.max(1, model.nodes.length) * Math.PI * 2;
    return {
      ...n,
      x: 50 + 20 * Math.cos(a),
      y: 45 + 20 * Math.sin(a),
      vx: 0,
      vy: 0
    };
  });
  const edges = model.edges;
  for (let it = 0; it < iterations; it++) {
    for (let i = 0; i < nodes.length; i++) {
      for (let j = i + 1; j < nodes.length; j++) {
        let dx = nodes[i].x - nodes[j].x;
        let dy = nodes[i].y - nodes[j].y;
        const dist = Math.hypot(dx, dy) || 0.1;
        const force = 120 / (dist * dist);
        dx = dx / dist * force;
        dy = dy / dist * force;
        nodes[i].vx = (nodes[i].vx ?? 0) + dx;
        nodes[i].vy = (nodes[i].vy ?? 0) + dy;
        nodes[j].vx = (nodes[j].vx ?? 0) - dx;
        nodes[j].vy = (nodes[j].vy ?? 0) - dy;
      }
    }
    for (const e of edges) {
      const a = nodes.find((n) => n.id === e.from);
      const b = nodes.find((n) => n.id === e.to);
      if (!a || !b) continue;
      let dx = b.x - a.x;
      let dy = b.y - a.y;
      const dist = Math.hypot(dx, dy) || 0.1;
      const force = (dist - 25) * 0.05;
      dx = dx / dist * force;
      dy = dy / dist * force;
      a.vx = (a.vx ?? 0) + dx;
      a.vy = (a.vy ?? 0) + dy;
      b.vx = (b.vx ?? 0) - dx;
      b.vy = (b.vy ?? 0) - dy;
    }
    for (const n of nodes) {
      n.x = Math.min(W - 5, Math.max(5, n.x + (n.vx ?? 0) * 0.6));
      n.y = Math.min(H - 5, Math.max(5, n.y + (n.vy ?? 0) * 0.6));
      n.vx = (n.vx ?? 0) * 0.6;
      n.vy = (n.vy ?? 0) * 0.6;
    }
  }
  return { nodes, edges };
}
const _hoisted_1$2t = ["data-layout", "data-zoom-mode", "data-view-scale", "data-nodes-arcs", "data-arcs", "data-main-stat-unit", "data-nodes-main-stat-unit", "data-nodes-secondary-stat-unit", "data-edges-main-stat-unit", "data-edges-secondary-stat-unit", "data-secondary-stat-unit", "data-show-nodes", "data-show-edges", "data-node-count", "data-edge-count", "data-canvas-renderer", "data-selected", "data-arc-count", "data-edge-main-stat-unit"];
const _hoisted_2$1Y = {
  key: 1,
  viewBox: "0 0 100 90",
  class: "svg",
  role: "img",
  "aria-label": "节点图"
};
const _hoisted_3$1K = ["data-from", "data-to"];
const _hoisted_4$1s = ["x1", "y1", "x2", "y2", "stroke-width"];
const _hoisted_5$1g = {
  key: 0,
  class: "edge-label",
  "data-testid": "nodegraph-edge-label"
};
const _hoisted_6$15 = ["x", "y"];
const _hoisted_7$_ = ["x", "y"];
const _hoisted_8$S = ["data-id", "onClick"];
const _hoisted_9$P = ["cx", "cy", "r", "fill", "stroke-width"];
const _hoisted_10$G = ["x", "y"];
const _hoisted_11$C = ["x", "y"];
const _hoisted_12$w = ["x", "y"];
const _hoisted_13$v = { class: "ctx__title" };
const _hoisted_14$q = {
  key: 0,
  class: "ctx__meta"
};
const _hoisted_15$n = {
  key: 2,
  class: "detail",
  "data-testid": "nodegraph-detail"
};
const _hoisted_16$l = { key: 0 };
const _hoisted_17$j = { key: 1 };
const _hoisted_18$j = {
  key: 3,
  class: "panel-empty",
  "data-testid": "nodegraph-empty"
};
const _hoisted_19$i = {
  key: 4,
  class: "no-data-msg",
  "data-testid": "nodegraph-empty"
};
const _hoisted_20$g = {
  class: "view-controls",
  "data-testid": "nodegraph-view-controls",
  "aria-hidden": "true"
};
const _hoisted_21$9 = { class: "view-controls__btns" };
const ZOOM_MIN = 0.13;
const ZOOM_MAX = 2.25;
const CANVAS_NODE_THRESHOLD = 80;
const _sfc_main$38 = /* @__PURE__ */ defineComponent({
  __name: "NodeGraphRenderer",
  props: {
    data: {},
    options: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const layoutMode = computed(
      () => String(
        opts.value.layoutAlgorithm ?? opts.value.layout?.mode ?? opts.value.layout ?? opts.value.nodes?.layout ?? "force"
      )
    );
    const zoomMode = computed(() => String(opts.value.zoomMode ?? "cooperative"));
    const viewScale = ref(1);
    const viewScaleClamped = computed(() => Math.max(ZOOM_MIN, Math.min(ZOOM_MAX, viewScale.value)));
    function stepZoom(dir) {
      const next = dir > 0 ? viewScale.value * 1.5 : viewScale.value / 1.5;
      viewScale.value = Math.max(ZOOM_MIN, Math.min(ZOOM_MAX, next));
    }
    function onZoomIn() {
      stepZoom(1);
    }
    function onZoomOut() {
      stepZoom(-1);
    }
    function onGraphWheel(evt) {
      const greedy = zoomMode.value === "greedy";
      if (!(greedy || evt.ctrlKey || evt.metaKey)) {
        return;
      }
      evt.preventDefault();
      const dy = evt.deltaY;
      if (dy < 0) {
        const newScale = viewScale.value + Math.max(dy, -4) * -0.015;
        viewScale.value = Math.max(ZOOM_MIN, newScale);
      } else if (dy > 0) {
        const newScale = viewScale.value + Math.min(dy, 4) * -0.015;
        viewScale.value = Math.min(ZOOM_MAX, newScale);
      }
    }
    const mainStatUnit = computed(
      () => String(
        opts.value.mainStatUnit ?? opts.value.nodes?.mainStatUnit ?? opts.value.edges?.mainStatUnit ?? ""
      )
    );
    const secondaryStatUnit = computed(
      () => String(
        opts.value.secondaryStatUnit ?? opts.value.nodes?.secondaryStatUnit ?? opts.value.edges?.secondaryStatUnit ?? ""
      )
    );
    const showNodes = computed(() => opts.value.nodes !== false && opts.value.nodes !== 0);
    const showEdges = computed(() => opts.value.edges !== false && opts.value.edges !== 0);
    const nodeMainStatUnit = computed(
      () => String(opts.value.nodes?.mainStatUnit ?? opts.value.mainStatUnit ?? "")
    );
    const nodeSecondaryStatUnit = computed(
      () => String(opts.value.nodes?.secondaryStatUnit ?? opts.value.secondaryStatUnit ?? "")
    );
    const edgeMainStatUnit = computed(
      () => String(opts.value.edges?.mainStatUnit ?? opts.value.mainStatUnit ?? "")
    );
    const arcCount = computed(() => {
      const arcs = opts.value.nodes?.arcs ?? opts.value.arcs;
      if (Array.isArray(arcs)) return arcs.length;
      if (typeof arcs === "string" && arcs.trim()) {
        try {
          const p = JSON.parse(arcs);
          return Array.isArray(p) ? p.length : 0;
        } catch {
          return 0;
        }
      }
      return 0;
    });
    const baseGraph = computed(() => framesToGraph(props.data?.series));
    const graph = computed(() => layoutGraph(baseGraph.value, layoutMode.value));
    const hasSeries = computed(() => (props.data?.series?.length ?? 0) > 0);
    const nodeRadius = computed(() => Number(opts.value.nodeRadius ?? 7));
    function formatNodeMain(v) {
      if (v == null || v === "") return "";
      const unit = nodeMainStatUnit.value || void 0;
      return formatValue(v, { unit: unit || "none" });
    }
    function formatNodeSecondary(v) {
      if (v == null || v === "") return "";
      const unit = nodeSecondaryStatUnit.value || void 0;
      return formatValue(v, { unit: unit || "none" });
    }
    function formatEdgeMain(v) {
      if (v == null || v === "") return "";
      const unit = edgeMainStatUnit.value || mainStatUnit.value || void 0;
      return formatValue(v, { unit: unit || "none" });
    }
    const edgeSecondaryStatUnit = computed(
      () => String(opts.value.edges?.secondaryStatUnit ?? opts.value.secondaryStatUnit ?? "")
    );
    function formatEdgeSecondary(v) {
      if (v == null || v === "") return "";
      const unit = edgeSecondaryStatUnit.value || void 0;
      return formatValue(v, { unit: unit || "none" });
    }
    function edgeMid(e) {
      const a = byId2.value.get(e.from);
      const b = byId2.value.get(e.to);
      if (!a || !b) return { x: 0, y: 0 };
      return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
    }
    const arcColors = computed(() => {
      const arcs = opts.value.nodes?.arcs;
      if (Array.isArray(arcs) && arcs.length)
        return arcs.map((a) => String(a.color ?? "var(--grafana-primary)"));
      return [classicBlue(), classicGreen(), classicYellow()];
    });
    const selected = ref(null);
    const menu = ref(null);
    function onNodeClick(n, evt) {
      selected.value = n;
      menu.value = { x: evt.offsetX, y: evt.offsetY, node: n };
    }
    function closeMenu() {
      menu.value = null;
    }
    const byId2 = computed(() => new Map(graph.value.nodes.map((n) => [n.id, n])));
    const useCanvasRenderer = computed(() => graph.value.nodes.length >= CANVAS_NODE_THRESHOLD);
    const canvasEl = ref(null);
    let canvasRaf = 0;
    let canvasRo = null;
    function drawCanvasGraph() {
      const el = canvasEl.value;
      if (!el || !useCanvasRenderer.value) return;
      const nodes = graph.value.nodes;
      const edges = graph.value.edges;
      const dpr = Math.min(globalThis.devicePixelRatio || 1, 2);
      const cssW = el.clientWidth || 320;
      const cssH = el.clientHeight || 240;
      el.width = Math.max(1, Math.floor(cssW * dpr));
      el.height = Math.max(1, Math.floor(cssH * dpr));
      const ctx = el.getContext("2d");
      if (!ctx) return;
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
      ctx.clearRect(0, 0, cssW, cssH);
      const sx = cssW / 100;
      const sy = cssH / 90;
      const idMap = new Map(nodes.map((n) => [n.id, n]));
      const border = getComputedStyle(document.documentElement).getPropertyValue("--grafana-border").trim() || "var(--grafana-text-secondary)";
      const text = getComputedStyle(document.documentElement).getPropertyValue("--grafana-text").trim() || "var(--grafana-border)";
      if (showEdges.value) {
        ctx.strokeStyle = border;
        for (const e of edges) {
          const a = idMap.get(e.from);
          const b = idMap.get(e.to);
          if (!a || !b) continue;
          const x1 = a.x * sx;
          const y1 = a.y * sy;
          const x2 = b.x * sx;
          const y2 = b.y * sy;
          ctx.lineWidth = e.mainStat != null ? Math.min(3, 0.5 + Number(e.mainStat) / 80) : 1;
          ctx.beginPath();
          ctx.moveTo(x1, y1);
          ctx.lineTo(x2, y2);
          ctx.stroke();
        }
        const edgeLabelSrc = edges.length <= 120 ? edges : edges.filter((e) => e.mainStat != null || e.secondaryStat != null).slice(0, 80);
        ctx.fillStyle = text;
        ctx.font = "9px sans-serif";
        ctx.textAlign = "center";
        ctx.textBaseline = "middle";
        for (const e of edgeLabelSrc) {
          if (e.mainStat == null && e.secondaryStat == null) continue;
          const a = idMap.get(e.from);
          const b = idMap.get(e.to);
          if (!a || !b) continue;
          const mx = (a.x + b.x) / 2 * sx;
          const my = (a.y + b.y) / 2 * sy;
          if (e.mainStat != null) {
            const mainTxt = formatEdgeMain(e.mainStat);
            if (mainTxt) {
              ctx.fillText(mainTxt, mx, my - (e.secondaryStat != null ? 6 : 0));
            }
          }
          if (e.secondaryStat != null) {
            const secTxt = formatEdgeSecondary(e.secondaryStat);
            if (secTxt) {
              ctx.fillText(secTxt, mx, my + (e.mainStat != null ? 6 : 0));
            }
          }
        }
      }
      if (showNodes.value) {
        const r = Math.max(3, Math.min(cssW, cssH) * 0.012);
        for (const n of nodes) {
          ctx.beginPath();
          ctx.fillStyle = n.color || "var(--grafana-primary)";
          ctx.arc(n.x * sx, n.y * sy, selected.value?.id === n.id ? r * 1.35 : r, 0, Math.PI * 2);
          ctx.fill();
        }
        ctx.fillStyle = text;
        ctx.font = "10px sans-serif";
        ctx.textAlign = "center";
        ctx.textBaseline = "alphabetic";
        const labelNodes = nodes.length <= 200 ? nodes : selected.value ? nodes.filter((n) => n.id === selected.value?.id) : nodes.slice(0, 64);
        for (const n of labelNodes) {
          const bx = n.x * sx;
          const by = n.y * sy;
          ctx.fillText(String(n.label ?? n.id), bx, by + r + 10);
          let yOff = r + 22;
          if (n.mainStat != null) {
            const t2 = formatNodeMain(n.mainStat);
            if (t2) {
              ctx.font = "9px sans-serif";
              ctx.fillText(t2, bx, by + yOff);
              yOff += 11;
            }
          }
          if (n.secondaryStat != null) {
            const t2 = formatNodeSecondary(n.secondaryStat);
            if (t2) {
              ctx.font = "8px sans-serif";
              ctx.fillText(t2, bx, by + yOff);
            }
          }
          ctx.font = "10px sans-serif";
        }
      }
    }
    function scheduleCanvasDraw() {
      if (!useCanvasRenderer.value) return;
      cancelAnimationFrame(canvasRaf);
      canvasRaf = requestAnimationFrame(() => drawCanvasGraph());
    }
    function onCanvasClick(ev) {
      const el = canvasEl.value;
      if (!el) return;
      const rect = el.getBoundingClientRect();
      const cssW = rect.width || 320;
      const cssH = rect.height || 240;
      const sx = cssW / 100;
      const sy = cssH / 90;
      const mx = ev.clientX - rect.left;
      const my = ev.clientY - rect.top;
      const hitR = Math.max(3, Math.min(cssW, cssH) * 0.012) * 1.8;
      for (const n of graph.value.nodes) {
        const dx = mx - n.x * sx;
        const dy = my - n.y * sy;
        if (dx * dx + dy * dy <= hitR * hitR) {
          selected.value = n;
          return;
        }
      }
    }
    watch(
      () => [
        graph.value.nodes.length,
        graph.value.edges.length,
        selected.value?.id,
        showNodes.value,
        showEdges.value,
        useCanvasRenderer.value,
        mainStatUnit.value,
        secondaryStatUnit.value,
        edgeMainStatUnit.value,
        edgeSecondaryStatUnit.value,
        layoutMode.value
      ],
      () => scheduleCanvasDraw()
    );
    onMounted(async () => {
      await nextTick();
      scheduleCanvasDraw();
      if (typeof ResizeObserver !== "undefined") {
        canvasRo = new ResizeObserver(() => scheduleCanvasDraw());
        if (canvasEl.value) canvasRo.observe(canvasEl.value);
      }
    });
    onBeforeUnmount(() => {
      cancelAnimationFrame(canvasRaf);
      canvasRo?.disconnect();
      canvasRo = null;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "nodegraph",
        "data-testid": "panel-nodegraph",
        "data-layout": String(layoutMode.value),
        "data-zoom-mode": zoomMode.value,
        "data-view-scale": String(viewScaleClamped.value),
        "data-nodes-arcs": String(
          (opts.value.nodes?.arcs ?? opts.value.arcs ?? []).length || (opts.value.nodes?.arcs || opts.value.arcs ? 1 : 0)
        ),
        "data-arcs": String(
          (opts.value.arcs ?? opts.value.nodes?.arcs ?? []).length || (opts.value.arcs || opts.value.nodes?.arcs ? 1 : 0)
        ),
        "data-main-stat-unit": mainStatUnit.value,
        "data-nodes-main-stat-unit": nodeMainStatUnit.value,
        "data-nodes-secondary-stat-unit": nodeSecondaryStatUnit.value,
        "data-edges-main-stat-unit": String(opts.value.edges?.mainStatUnit ?? edgeMainStatUnit.value),
        "data-edges-secondary-stat-unit": String(edgeSecondaryStatUnit.value),
        "data-secondary-stat-unit": secondaryStatUnit.value,
        "data-show-nodes": String(showNodes.value),
        "data-show-edges": String(showEdges.value),
        "data-node-count": String(graph.value.nodes.length),
        "data-edge-count": String(graph.value.edges.length),
        "data-canvas-renderer": String(useCanvasRenderer.value),
        "data-selected": selected.value?.id ?? "",
        "data-arc-count": String(arcCount.value),
        "data-edge-main-stat-unit": edgeMainStatUnit.value,
        onWheel: onGraphWheel,
        onClick: closeMenu
      }, [
        graph.value.nodes.length ? (openBlock(), createElementBlock(
          "div",
          {
            key: 0,
            class: "nodegraph-stage",
            "data-testid": "nodegraph-stage",
            style: normalizeStyle({
              transform: `scale(${viewScaleClamped.value})`,
              transformOrigin: "center center"
            })
          },
          [
            useCanvasRenderer.value ? (openBlock(), createElementBlock(
              "canvas",
              {
                key: 0,
                ref_key: "canvasEl",
                ref: canvasEl,
                class: "nodegraph-canvas",
                "data-testid": "nodegraph-canvas",
                role: "img",
                "aria-label": "节点图",
                onClick: onCanvasClick
              },
              null,
              512
              /* NEED_PATCH */
            )) : (openBlock(), createElementBlock("svg", _hoisted_2$1Y, [
              showEdges.value ? (openBlock(true), createElementBlock(
                Fragment,
                { key: 0 },
                renderList(graph.value.edges, (e, i) => {
                  return openBlock(), createElementBlock("g", {
                    key: `e${i}`,
                    class: "edge-group",
                    "data-testid": "nodegraph-edge",
                    "data-from": e.from,
                    "data-to": e.to
                  }, [
                    createElementVNode("line", {
                      x1: byId2.value.get(e.from)?.x ?? 0,
                      y1: byId2.value.get(e.from)?.y ?? 0,
                      x2: byId2.value.get(e.to)?.x ?? 0,
                      y2: byId2.value.get(e.to)?.y ?? 0,
                      class: "edge",
                      "stroke-width": e.mainStat != null ? Math.min(3, 0.5 + e.mainStat / 80) : 1
                    }, null, 8, _hoisted_4$1s),
                    e.mainStat != null || e.secondaryStat != null ? (openBlock(), createElementBlock("g", _hoisted_5$1g, [
                      e.mainStat != null ? (openBlock(), createElementBlock("text", {
                        key: 0,
                        x: edgeMid(e).x,
                        y: edgeMid(e).y - (e.secondaryStat != null ? 1.2 : 0),
                        "text-anchor": "middle",
                        class: "edge-stat",
                        "data-testid": "nodegraph-edge-main-stat"
                      }, toDisplayString(formatEdgeMain(e.mainStat)), 9, _hoisted_6$15)) : createCommentVNode("v-if", true),
                      e.secondaryStat != null ? (openBlock(), createElementBlock("text", {
                        key: 1,
                        x: edgeMid(e).x,
                        y: edgeMid(e).y + (e.mainStat != null ? 2.2 : 0),
                        "text-anchor": "middle",
                        class: "edge-stat edge-stat--secondary",
                        "data-testid": "nodegraph-edge-secondary-stat"
                      }, toDisplayString(formatEdgeSecondary(e.secondaryStat)), 9, _hoisted_7$_)) : createCommentVNode("v-if", true)
                    ])) : createCommentVNode("v-if", true)
                  ], 8, _hoisted_3$1K);
                }),
                128
                /* KEYED_FRAGMENT */
              )) : createCommentVNode("v-if", true),
              showNodes.value ? (openBlock(true), createElementBlock(
                Fragment,
                { key: 1 },
                renderList(graph.value.nodes, (n) => {
                  return openBlock(), createElementBlock("g", {
                    key: n.id,
                    class: normalizeClass(["node", { selected: selected.value?.id === n.id }]),
                    "data-testid": "nodegraph-node",
                    "data-id": n.id,
                    onClick: withModifiers(($event) => onNodeClick(n, $event), ["stop"])
                  }, [
                    createElementVNode("circle", {
                      cx: n.x,
                      cy: n.y,
                      r: nodeRadius.value,
                      fill: n.color ?? arcColors.value[0],
                      stroke: "var(--grafana-input-bg)",
                      "stroke-width": selected.value?.id === n.id ? 0.8 : 0.3
                    }, null, 8, _hoisted_9$P),
                    createElementVNode("text", {
                      x: n.x,
                      y: n.y + nodeRadius.value + 4,
                      "text-anchor": "middle",
                      class: "label"
                    }, toDisplayString(n.label), 9, _hoisted_10$G),
                    n.mainStat != null ? (openBlock(), createElementBlock("text", {
                      key: 0,
                      x: n.x,
                      y: n.y + 1.5,
                      "text-anchor": "middle",
                      class: "stat",
                      "data-testid": "nodegraph-main-stat"
                    }, toDisplayString(formatNodeMain(n.mainStat)), 9, _hoisted_11$C)) : createCommentVNode("v-if", true),
                    n.secondaryStat != null ? (openBlock(), createElementBlock("text", {
                      key: 1,
                      x: n.x,
                      y: n.y + 5.5,
                      "text-anchor": "middle",
                      class: "stat stat--secondary",
                      "data-testid": "nodegraph-secondary-stat"
                    }, toDisplayString(formatNodeSecondary(n.secondaryStat)), 9, _hoisted_12$w)) : createCommentVNode("v-if", true)
                  ], 10, _hoisted_8$S);
                }),
                128
                /* KEYED_FRAGMENT */
              )) : createCommentVNode("v-if", true)
            ]))
          ],
          4
          /* STYLE */
        )) : createCommentVNode("v-if", true),
        menu.value ? (openBlock(), createElementBlock(
          "div",
          {
            key: 1,
            class: "ctx",
            "data-testid": "nodegraph-context-menu",
            style: normalizeStyle({ left: `${menu.value.x}px`, top: `${menu.value.y}px` }),
            onClick: _cache[2] || (_cache[2] = withModifiers(() => {
            }, ["stop"]))
          },
          [
            createElementVNode(
              "div",
              _hoisted_13$v,
              toDisplayString(menu.value.node.label),
              1
              /* TEXT */
            ),
            createElementVNode("button", {
              type: "button",
              "data-testid": "nodegraph-focus",
              onClick: _cache[0] || (_cache[0] = ($event) => menu.value = null)
            }, "聚焦节点"),
            createElementVNode("button", {
              type: "button",
              onClick: _cache[1] || (_cache[1] = ($event) => {
                selected.value = menu.value.node;
                menu.value = null;
              })
            }, " 查看详情 "),
            menu.value.node.mainStat != null ? (openBlock(), createElementBlock(
              "div",
              _hoisted_14$q,
              " 主指标: " + toDisplayString(formatNodeMain(menu.value.node.mainStat)),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true)
          ],
          4
          /* STYLE */
        )) : createCommentVNode("v-if", true),
        selected.value ? (openBlock(), createElementBlock("aside", _hoisted_15$n, [
          createElementVNode(
            "strong",
            null,
            toDisplayString(selected.value.label),
            1
            /* TEXT */
          ),
          createElementVNode(
            "div",
            null,
            "ID: " + toDisplayString(selected.value.id),
            1
            /* TEXT */
          ),
          selected.value.mainStat != null ? (openBlock(), createElementBlock(
            "div",
            _hoisted_16$l,
            "主指标: " + toDisplayString(formatNodeMain(selected.value.mainStat)),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          selected.value.secondaryStat != null ? (openBlock(), createElementBlock(
            "div",
            _hoisted_17$j,
            " 次指标: " + toDisplayString(formatNodeSecondary(selected.value.secondaryStat)),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          createElementVNode("button", {
            type: "button",
            onClick: _cache[3] || (_cache[3] = ($event) => selected.value = null)
          }, "关闭")
        ])) : createCommentVNode("v-if", true),
        createCommentVNode(" series empty → panel-empty; series present but not topology → noDataMsg + zoom chrome "),
        !graph.value.nodes.length && !hasSeries.value ? (openBlock(), createElementBlock("div", _hoisted_18$j, [..._cache[4] || (_cache[4] = [
          createElementVNode(
            "p",
            { class: "panel-empty__msg" },
            "回复中未找到数据",
            -1
            /* CACHED */
          )
        ])])) : !graph.value.nodes.length ? (openBlock(), createElementBlock("div", _hoisted_19$i, " 没有数据 ")) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_20$g, [
          createElementVNode("div", _hoisted_21$9, [
            createElementVNode("button", {
              type: "button",
              class: "vc-btn",
              "data-testid": "nodegraph-zoom-in",
              "aria-label": "Zoom in",
              onClick: withModifiers(onZoomIn, ["stop"])
            }, [..._cache[5] || (_cache[5] = [
              createElementVNode(
                "svg",
                {
                  viewBox: "0 0 24 24",
                  width: "16",
                  height: "16",
                  "aria-hidden": "true"
                },
                [
                  createElementVNode("circle", {
                    cx: "12",
                    cy: "12",
                    r: "9",
                    fill: "none",
                    stroke: "currentColor",
                    "stroke-width": "1.75",
                    "stroke-linecap": "round"
                  }),
                  createElementVNode("path", {
                    d: "M12 8v8M8 12h8",
                    stroke: "currentColor",
                    "stroke-width": "1.75",
                    "stroke-linecap": "round"
                  })
                ],
                -1
                /* CACHED */
              )
            ])]),
            createElementVNode("button", {
              type: "button",
              class: "vc-btn",
              "data-testid": "nodegraph-zoom-out",
              "aria-label": "Zoom out",
              onClick: withModifiers(onZoomOut, ["stop"])
            }, [..._cache[6] || (_cache[6] = [
              createElementVNode(
                "svg",
                {
                  viewBox: "0 0 24 24",
                  width: "16",
                  height: "16",
                  "aria-hidden": "true"
                },
                [
                  createElementVNode("circle", {
                    cx: "12",
                    cy: "12",
                    r: "9",
                    fill: "none",
                    stroke: "currentColor",
                    "stroke-width": "1.75",
                    "stroke-linecap": "round"
                  }),
                  createElementVNode("path", {
                    d: "M8 12h8",
                    stroke: "currentColor",
                    "stroke-width": "1.75",
                    "stroke-linecap": "round"
                  })
                ],
                -1
                /* CACHED */
              )
            ])])
          ])
        ])
      ], 40, _hoisted_1$2t);
    };
  }
});
const NodeGraphRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$38, [["__scopeId", "data-v-2cd41964"]]);
const _sfc_main$37 = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(NodeGraphRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "nodeGraph",
    name: "节点图",
    description: "服务拓扑 / 节点关系图",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$37
).setPanelOptions((builder) => {
  const cat = ["节点图"];
  builder.addSelect(
    {
      id: "zoomMode",
      path: "zoomMode",
      name: "缩放模式",
      category: cat,
      settings: {
        options: [
          {
            label: "协作",
            value: "cooperative",
            description: "允许页面正常滚动"
          },
          {
            label: "独占",
            value: "greedy",
            description: "响应全部缩放手势"
          }
        ]
      }
    },
    "cooperative"
  ).addSelect(
    {
      id: "layoutAlgorithm",
      path: "layoutAlgorithm",
      name: "布局算法",
      category: cat,
      settings: {
        options: [
          { label: "分层", value: "layered" },
          { label: "力导向", value: "force" },
          { label: "网格", value: "grid" },
          { label: "环形", value: "circular" }
        ]
      }
    },
    "layered"
  ).addUnit(
    {
      id: "nodes.mainStatUnit",
      path: "nodes.mainStatUnit",
      name: "节点主统计单位",
      category: ["节点"]
    },
    ""
  ).addUnit(
    {
      id: "nodes.secondaryStatUnit",
      path: "nodes.secondaryStatUnit",
      name: "节点次统计单位",
      category: ["节点"]
    },
    ""
  ).addTextArea(
    {
      id: "nodes.arcs",
      path: "nodes.arcs",
      name: "弧段",
      description: 'JSON 数组，如 [{"color":"#f00","field":"error"}]',
      category: ["节点"]
    },
    "[]"
  ).addUnit(
    {
      id: "edges.mainStatUnit",
      path: "edges.mainStatUnit",
      name: "边主统计单位",
      category: ["边"]
    },
    ""
  ).addUnit(
    {
      id: "edges.secondaryStatUnit",
      path: "edges.secondaryStatUnit",
      name: "边次统计单位",
      category: ["边"]
    },
    ""
  ).addCustom({
    id: "nodes",
    path: "nodes",
    name: "节点配置",
    category: cat,
    editor: "text"
  }).addCustom({
    id: "edges",
    path: "edges",
    name: "边配置",
    category: cat,
    editor: "text"
  }).addUnit(
    {
      id: "mainStatUnit",
      path: "mainStatUnit",
      name: "主统计单位（兼容）",
      category: cat
    },
    void 0
  ).addUnit(
    {
      id: "secondaryStatUnit",
      path: "secondaryStatUnit",
      name: "次统计单位（兼容）",
      category: cat
    },
    void 0
  ).addText(
    {
      id: "arcs",
      path: "arcs",
      name: "弧（兼容）",
      category: cat
    },
    void 0
  );
}).setRuntimeConsumedPaths([
  "zoomMode",
  "layoutAlgorithm",
  "nodes.mainStatUnit",
  "nodes.secondaryStatUnit",
  "nodes.arcs",
  "edges.mainStatUnit",
  "edges.secondaryStatUnit",
  "mainStatUnit",
  "secondaryStatUnit",
  "arcs",
  "nodes",
  "edges"
]).register();
const _hoisted_1$2s = {
  class: "panel-content-only",
  "data-testid": "panel-content-only",
  "data-panel-type": "xychart"
};
const _hoisted_2$1X = ["data-x-field", "data-dims-x", "data-dims-frame", "data-dims-y", "data-fill-opacity", "data-point-size-fixed", "data-point-size", "data-point-size-min", "data-point-size-max", "data-point-shape", "data-point-symbol", "data-exclude-series", "data-show-lines", "data-line-width", "data-show", "data-legend", "data-legend-display-mode", "data-legend-placement", "data-tooltip-mode", "data-tooltip-sort", "data-line-style", "data-point-stroke-width", "data-mapping", "data-series-count"];
const _hoisted_3$1J = ["data-placement", "data-display-mode"];
const _hoisted_4$1r = {
  key: 0,
  class: "legend-head",
  "data-testid": "xychart-legend-head"
};
const _hoisted_5$1f = { class: "name" };
const _sfc_main$36 = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    useCssVars((_ctx) => ({
      "v7fe72ac5": chartHeightCss.value
    }));
    const props = __props;
    const el = ref(null);
    const opts = computed(() => props.options ?? {});
    const custom = computed(
      () => props.fieldConfig?.defaults?.custom ?? {}
    );
    function merged(key, fallback) {
      const o = opts.value[key];
      if (o !== void 0 && o !== null && o !== "") return o;
      const c = custom.value[key];
      if (c !== void 0 && c !== null && c !== "") return c;
      return fallback;
    }
    function resolveFieldName(spec) {
      if (spec == null) return "";
      if (typeof spec === "string") return spec;
      const s = spec;
      if (s.fixed != null) return String(s.fixed);
      if (s.matcher?.options != null) return String(s.matcher.options);
      if (s.options != null) return String(s.options);
      return "";
    }
    const prep = computed(() => {
      const frames = props.data?.series ?? [];
      if (!frames.length) {
        return {
          warn: "无数据",
          series: []
        };
      }
      const mapping = String(opts.value.mapping ?? "auto");
      const mappedSeries = Array.isArray(opts.value.series) && opts.value.series.length ? opts.value.series : [{}];
      const dims = opts.value.dims ?? {};
      const legacyX = opts.value.xField ? String(opts.value.xField) : dims.x ? String(dims.x) : "";
      const legacyY = dims.y != null && dims.y !== "" ? String(dims.y) : "";
      const out = [];
      let seriesIndex = 0;
      const fillOpacity = Number(merged("fillOpacity", 50));
      const pointSizeRaw = merged("pointSize", 5);
      const pointSizeObj = typeof pointSizeRaw === "object" && pointSizeRaw ? pointSizeRaw : null;
      const pointSize = Number(
        pointSizeObj ? pointSizeObj.fixed ?? pointSizeObj.min ?? 5 : pointSizeRaw ?? 5
      );
      const pointSizeMin = pointSizeObj?.min != null ? Number(pointSizeObj.min) : void 0;
      const pointSizeMax = pointSizeObj?.max != null ? Number(pointSizeObj.max) : void 0;
      const pointSymbol = String(merged("pointSymbol", opts.value.pointSymbol ?? "circle"));
      const excludeSeries = new Set(
        (Array.isArray(opts.value.excludeSeries) ? opts.value.excludeSeries : String(opts.value.excludeSeries || "").split(/[,\s]+/).filter(Boolean)).map(String)
      );
      const showMode = String(merged("show", "points"));
      const showLines = showMode === "lines" || showMode === "points+lines" || opts.value.showLines === true;
      const lineWidth = showLines ? Number(merged("lineWidth", 1)) : 0;
      const dimsFrame = dims.frame != null && dims.frame !== "" ? Number(dims.frame) : null;
      for (const seriesCfg of mappedSeries) {
        if (mapping === "manual") {
          const hasX = resolveFieldName(seriesCfg?.x) || seriesCfg?.x?.matcher;
          const hasY = resolveFieldName(seriesCfg?.y) || seriesCfg?.y?.matcher;
          if (!hasX || !hasY) continue;
        }
        for (let frameIndex = 0; frameIndex < frames.length; frameIndex++) {
          const frame = frames[frameIndex];
          if (dimsFrame != null && Number.isFinite(dimsFrame) && frameIndex !== dimsFrame) continue;
          const onlyNum = frame.fields.filter((f) => f.type === "number");
          if (!onlyNum.length) continue;
          const xName = resolveFieldName(seriesCfg?.x) || legacyX;
          let xField = xName ? onlyNum.find((f) => f.name === xName || getFieldDisplayName(f, frame, frames) === xName) : onlyNum[0];
          if (!xField) xField = onlyNum[0];
          if (!xField) continue;
          const seriesY = resolveFieldName(seriesCfg?.y);
          const yWanted = seriesY || (mapping !== "manual" ? legacyY : "");
          for (const yField of onlyNum) {
            if (yField === xField) continue;
            if (mapping === "manual" && !seriesY) continue;
            if (yWanted) {
              const yLabel = getFieldDisplayName(yField, frame, frames);
              if (yField.name !== yWanted && yLabel !== yWanted) continue;
            }
            const seriesLabel = getFieldDisplayName(yField, frame, frames);
            if (excludeSeries.has(yField.name) || excludeSeries.has(seriesLabel) || excludeSeries.has(String(seriesIndex))) {
              continue;
            }
            const cfg = {
              ...props.fieldConfig?.defaults ?? {},
              ...yField.config ?? {}
            };
            const lastY = Number(yField.values[yField.values.length - 1] ?? 0);
            const color = seriesCfg?.pointColor && String(seriesCfg.pointColor) || getFieldColor(lastY, cfg) || getFieldSeriesColor(String(yField.name || "series"), seriesIndex, {
              ...cfg,
              color: cfg.color ?? { mode: "palette-classic" }
            }) || classicGreen();
            const label = seriesCfg?.name && String(seriesCfg.name) ? String(seriesCfg.name) : getFieldDisplayName(yField, frame, frames);
            let size = pointSize;
            if (pointSizeMin != null && pointSizeMax != null) {
              const vals = yField.values.map((v) => Math.abs(Number(v))).filter((n) => Number.isFinite(n));
              const vmin = vals.length ? Math.min(...vals) : 0;
              const vmax = vals.length ? Math.max(...vals) : 1;
              const span = vmax - vmin || 1;
              const last = Math.abs(Number(yField.values[yField.values.length - 1] ?? 0));
              const t2 = (last - vmin) / span;
              size = pointSizeMin + t2 * (pointSizeMax - pointSizeMin);
            }
            out.push({
              label,
              color: String(color),
              points: yField.values.map((y, row) => ({
                x: Number(xField.values[row] ?? row),
                y: y == null ? null : Number(y)
              })),
              fillOpacity: showLines ? fillOpacity : 0,
              lineWidth,
              pointSize: size,
              pointStrokeWidth: Number(merged("pointStrokeWidth", opts.value.pointStrokeWidth ?? 1)),
              lineStyle: merged("lineStyle", opts.value.lineStyle),
              pointShape: String(merged("pointShape", pointSymbol === "square" ? "square" : "circle")),
              showPoints: "always",
              lineInterpolation: String(merged("lineInterpolation", "linear"))
            });
            seriesIndex++;
            if (mapping === "manual") break;
          }
        }
      }
      if (!out.length) {
        return {
          warn: "无数据",
          series: []
        };
      }
      return { warn: void 0, series: out };
    });
    const showError = computed(() => {
      if (props.data?.state === "Loading") return false;
      return Boolean(prep.value.warn) || !prep.value.series.length;
    });
    const series = computed(() => showError.value ? [] : prep.value.series);
    const width2 = computed(() => props.width || 400);
    const legendPlacement = computed(() => String(opts.value?.legend?.placement ?? "bottom"));
    const height2 = computed(() => {
      const place = legendPlacement.value;
      const show = opts.value?.legend?.showLegend !== false && series.value.length > 0;
      const reserve = show && place !== "right" ? 32 : 0;
      return Math.max((props.height || 200) - reserve, 40);
    });
    const chartHeightCss = computed(() => `${height2.value}px`);
    const chartWidthCss = computed(() => {
      const show = opts.value?.legend?.showLegend !== false && series.value.length > 0;
      if (show && legendPlacement.value === "right") {
        const w = props.width || 400;
        return `${Math.max(w * 0.7, 120)}px`;
      }
      return "100%";
    });
    const xFieldAttr = computed(() => {
      if (opts.value.xField) return String(opts.value.xField);
      const series0 = opts.value.series?.[0];
      const n = resolveFieldName(series0?.x);
      if (n) return n;
      const frames = props.data?.series ?? [];
      const nums = frames[0]?.fields?.filter((f) => f.type === "number") ?? [];
      return nums[0]?.name ?? "";
    });
    const pointSizeAttr = computed(() => {
      const raw = merged("pointSize", 5);
      if (typeof raw === "object" && raw) return String(raw.fixed ?? 5);
      return String(raw ?? 5);
    });
    const pointShapeAttr = computed(
      () => String(
        merged(
          "pointShape",
          opts.value.pointSymbol === "square" || merged("pointSymbol") === "square" ? "square" : "circle"
        )
      )
    );
    const pointSymbolAttr = computed(
      () => String(merged("pointSymbol", opts.value.pointSymbol ?? pointShapeAttr.value))
    );
    const excludeSeriesAttr = computed(() => {
      const ex = opts.value.excludeSeries;
      if (Array.isArray(ex)) return ex.join(",");
      return String(ex ?? "");
    });
    const pointSizeMinAttr = computed(() => {
      const raw = merged("pointSize", 5);
      if (typeof raw === "object" && raw && raw.min != null) return String(raw.min);
      return "";
    });
    const pointSizeMaxAttr = computed(() => {
      const raw = merged("pointSize", 5);
      if (typeof raw === "object" && raw && raw.max != null) return String(raw.max);
      return "";
    });
    const showLinesAttr = computed(() => {
      const show = String(merged("show", "points"));
      return String(show === "lines" || show === "points+lines" || opts.value.showLines === true);
    });
    const lineWidthAttr = computed(
      () => String(merged("lineWidth", showLinesAttr.value === "true" ? 1 : 0))
    );
    const showModeAttr = computed(() => String(merged("show", "points")));
    const legendAttr = computed(() => String(opts.value?.legend?.showLegend !== false));
    const mappingAttr = computed(() => String(opts.value.mapping ?? "auto"));
    const seriesCountAttr = computed(() => String(series.value.length));
    const pointStrokeWidthAttr = computed(
      () => String(merged("pointStrokeWidth", opts.value.pointStrokeWidth ?? 1))
    );
    const lineStyleAttr = computed(() => {
      const ls = merged("lineStyle", opts.value.lineStyle);
      if (ls == null) return "";
      if (typeof ls === "string") return ls;
      if (typeof ls === "object") {
        const o = ls;
        return String(o.fill ?? o.dash?.join?.(",") ?? JSON.stringify(ls));
      }
      return String(ls);
    });
    const legendDisplayModeAttr = computed(() => String(opts.value?.legend?.displayMode ?? "list"));
    const legendPlacementAttr = legendPlacement;
    const tooltipModeAttr = computed(() => String(opts.value?.tooltip?.mode ?? "single"));
    const tooltipSortAttr = computed(() => String(opts.value?.tooltip?.sort ?? "none"));
    const hardMinOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.min;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    const hardMaxOpt = computed(() => {
      const v = props.fieldConfig?.defaults?.max;
      return v == null || !Number.isFinite(Number(v)) ? void 0 : Number(v);
    });
    useUPlot(el, series, {
      width: width2,
      height: height2,
      mode: computed(() => {
        const show = String(merged("show", "points"));
        if (show === "lines" || show === "points+lines" || opts.value.showLines === true) {
          return Number(merged("fillOpacity", 0)) > 0 ? "area" : "line";
        }
        return "points";
      }),
      timeX: false,
      showLegend: false,
      lineInterpolation: computed(() => String(merged("lineInterpolation", "linear"))),
      tooltipMode: tooltipModeAttr,
      tooltipSort: tooltipSortAttr,
      hardMin: hardMinOpt,
      hardMax: hardMaxOpt
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2s, [
        showError.value ? (openBlock(), createBlock(PanelDataErrorView, {
          key: 0,
          data: __props.data,
          "field-config": __props.fieldConfig,
          message: prep.value.warn || "无数据"
        }, null, 8, ["data", "field-config", "message"])) : (openBlock(), createElementBlock("div", {
          key: 1,
          class: normalizeClass(["chart-wrap", [`legend-${legendPlacement.value}`]]),
          "data-testid": "xychart-panel",
          "data-x-field": xFieldAttr.value,
          "data-dims-x": String(opts.value.dims?.x ?? opts.value.xField ?? xFieldAttr.value),
          "data-dims-frame": String(opts.value.dims?.frame ?? ""),
          "data-dims-y": String(opts.value.dims?.y ?? ""),
          "data-fill-opacity": String(merged("fillOpacity", 50)),
          "data-point-size-fixed": pointSizeAttr.value,
          "data-point-size": pointSizeAttr.value,
          "data-point-size-min": pointSizeMinAttr.value,
          "data-point-size-max": pointSizeMaxAttr.value,
          "data-point-shape": pointShapeAttr.value,
          "data-point-symbol": pointSymbolAttr.value,
          "data-exclude-series": excludeSeriesAttr.value,
          "data-show-lines": showLinesAttr.value,
          "data-line-width": lineWidthAttr.value,
          "data-show": showModeAttr.value,
          "data-legend": legendAttr.value,
          "data-legend-display-mode": legendDisplayModeAttr.value,
          "data-legend-placement": unref(legendPlacementAttr),
          "data-tooltip-mode": tooltipModeAttr.value,
          "data-tooltip-sort": tooltipSortAttr.value,
          "data-line-style": lineStyleAttr.value,
          "data-point-stroke-width": pointStrokeWidthAttr.value,
          "data-mapping": mappingAttr.value,
          "data-series-count": seriesCountAttr.value
        }, [
          createElementVNode(
            "div",
            {
              class: "chart-box",
              style: normalizeStyle({
                width: chartWidthCss.value,
                flex: legendPlacement.value === "right" ? "1 1 auto" : void 0
              })
            },
            [
              createElementVNode(
                "div",
                {
                  ref_key: "el",
                  ref: el,
                  class: "chart",
                  "data-testid": "panel-uplot",
                  role: "img",
                  "aria-label": "XY 图"
                },
                null,
                512
                /* NEED_PATCH */
              )
            ],
            4
            /* STYLE */
          ),
          legendAttr.value === "true" && series.value.length ? (openBlock(), createElementBlock("ul", {
            key: 0,
            class: normalizeClass(["legend", {
              "legend--table": legendDisplayModeAttr.value === "table",
              "legend--right": legendPlacement.value === "right"
            }]),
            "data-testid": "xychart-legend",
            "data-placement": legendPlacement.value,
            "data-display-mode": legendDisplayModeAttr.value,
            "data-shared-legend": "viz-legend"
          }, [
            legendDisplayModeAttr.value === "table" ? (openBlock(), createElementBlock("li", _hoisted_4$1r, [..._cache[0] || (_cache[0] = [
              createElementVNode(
                "i",
                { class: "legend-swatch" },
                null,
                -1
                /* CACHED */
              ),
              createElementVNode(
                "span",
                { class: "name" },
                "名称",
                -1
                /* CACHED */
              )
            ])])) : createCommentVNode("v-if", true),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(series.value, (s) => {
                return openBlock(), createElementBlock("li", {
                  key: s.label
                }, [
                  createElementVNode(
                    "i",
                    {
                      class: "legend-swatch",
                      style: normalizeStyle({ background: s.color })
                    },
                    null,
                    4
                    /* STYLE */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_5$1f,
                    toDisplayString(s.label),
                    1
                    /* TEXT */
                  )
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ], 10, _hoisted_3$1J)) : createCommentVNode("v-if", true)
        ], 10, _hoisted_2$1X))
      ]);
    };
  }
});
const Panel$c = /* @__PURE__ */ _export_sfc$1(_sfc_main$36, [["__scopeId", "data-v-a5b1d893"]]);
new VuePanelPlugin(
  {
    id: "xychart",
    name: "XY 图",
    description: "XY / 散点图",
    state: "stable",
    skipDataQuery: false
  },
  Panel$c
).useFieldConfig({
  useCustomConfig: (builder) => {
    const category = ["XY 图"];
    builder.addRadio(
      {
        id: "show",
        path: "show",
        name: "显示",
        category,
        settings: {
          options: [
            { label: "点", value: "points" },
            { label: "线", value: "lines" },
            { label: "点+线", value: "points+lines" }
          ]
        }
      },
      "points"
    ).addSlider(
      {
        id: "pointSize.fixed",
        path: "pointSize.fixed",
        name: "点大小",
        category,
        settings: { min: 1, max: 100, step: 1 },
        showIf: (c) => (c.show ?? c.custom?.show) !== "lines"
      },
      5
    ).addNumber({
      id: "pointSize.min",
      path: "pointSize.min",
      name: "最小",
      category,
      showIf: (c) => (c.show ?? c.custom?.show) !== "lines"
    }).addNumber({
      id: "pointSize.max",
      path: "pointSize.max",
      name: "最大",
      category,
      showIf: (c) => (c.show ?? c.custom?.show) !== "lines"
    }).addRadio(
      {
        id: "pointShape",
        path: "pointShape",
        name: "点形状",
        category,
        settings: {
          options: [
            { label: "圆形", value: "circle" },
            { label: "方形", value: "square" }
          ]
        },
        showIf: (c) => (c.show ?? c.custom?.show) !== "lines"
      },
      "circle"
    ).addSlider(
      {
        id: "pointStrokeWidth",
        path: "pointStrokeWidth",
        name: "点描边宽度",
        category,
        settings: { min: 0, max: 10, step: 1 },
        showIf: (c) => (c.show ?? c.custom?.show) !== "lines"
      },
      1
    ).addSlider(
      {
        id: "fillOpacity",
        path: "fillOpacity",
        name: "填充透明度",
        category,
        settings: { min: 0, max: 100, step: 1 },
        showIf: (c) => (c.show ?? c.custom?.show) !== "lines"
      },
      50
    ).addText({
      id: "lineStyle",
      path: "lineStyle",
      name: "线样式",
      category,
      showIf: (c) => (c.show ?? c.custom?.show) !== "points"
    }).addSlider(
      {
        id: "lineWidth",
        path: "lineWidth",
        name: "线宽",
        category,
        settings: { min: 0, max: 10, step: 1 },
        showIf: (c) => (c.show ?? c.custom?.show) !== "points"
      },
      1
    ).addText({
      id: "pointSymbol",
      path: "pointSymbol",
      name: "点符号（兼容）",
      category,
      showIf: () => false
    });
    addAxisConfig(builder);
    addHideFrom(builder);
  }
}).setPanelOptions((builder) => {
  const category = ["XY 图"];
  builder.addRadio(
    {
      id: "mapping",
      path: "mapping",
      name: "序列映射",
      category,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "手动", value: "manual" }
        ]
      }
    },
    "auto"
  ).addNumber(
    {
      id: "dims.frame",
      path: "dims.frame",
      name: "数据帧索引",
      category,
      settings: { min: 0, step: 1 },
      showIf: () => false
      // SeriesEditor,
    },
    0
  ).addText({
    id: "dims.x",
    path: "dims.x",
    name: "X 字段",
    category,
    showIf: () => false
    // SeriesEditor,
  }).addText({
    id: "dims.y",
    path: "dims.y",
    name: "Y 字段",
    category,
    showIf: () => false
    // SeriesEditor,
  }).addCustom(
    {
      id: "series",
      path: "series",
      name: "序列（SeriesEditor）",
      description: "由下方 SeriesEditor 编辑；兼容 JSON round-trip",
      category,
      editor: "textarea",
      showIf: () => false
      // UI via XYSeriesEditor in PanelEditor
    },
    []
  ).addText({
    id: "excludeSeries",
    path: "excludeSeries",
    name: "排除序列（逗号分隔）",
    category
  }).addRadio(
    {
      id: "show",
      path: "show",
      name: "显示（options 兼容）",
      category: ["XY 图 · 兼容"],
      settings: {
        options: [
          { label: "点", value: "points" },
          { label: "线", value: "lines" },
          { label: "点+线", value: "points+lines" }
        ]
      }
    },
    "points"
  ).addSlider(
    {
      id: "pointSize.fixed",
      path: "pointSize.fixed",
      name: "点大小（兼容）",
      category: ["XY 图 · 兼容"],
      settings: { min: 1, max: 100, step: 1 }
    },
    5
  ).addNumber({
    id: "pointSize.min",
    path: "pointSize.min",
    name: "最小点（兼容）",
    category: ["XY 图 · 兼容"]
  }).addNumber({
    id: "pointSize.max",
    path: "pointSize.max",
    name: "最大点（兼容）",
    category: ["XY 图 · 兼容"]
  }).addRadio(
    {
      id: "pointShape",
      path: "pointShape",
      name: "点形状（兼容）",
      category: ["XY 图 · 兼容"],
      settings: {
        options: [
          { label: "圆形", value: "circle" },
          { label: "方形", value: "square" }
        ]
      }
    },
    "circle"
  ).addSlider(
    {
      id: "pointStrokeWidth",
      path: "pointStrokeWidth",
      name: "点描边（兼容）",
      category: ["XY 图 · 兼容"],
      settings: { min: 0, max: 10 }
    },
    1
  ).addSlider(
    {
      id: "fillOpacity",
      path: "fillOpacity",
      name: "填充（兼容）",
      category: ["XY 图 · 兼容"],
      settings: { min: 0, max: 100 }
    },
    50
  ).addText({
    id: "lineStyle",
    path: "lineStyle",
    name: "线样式（兼容）",
    category: ["XY 图 · 兼容"]
  }).addSlider(
    {
      id: "lineWidth",
      path: "lineWidth",
      name: "线宽（兼容）",
      category: ["XY 图 · 兼容"],
      settings: { min: 0, max: 10 }
    },
    1
  ).addText({
    id: "pointSymbol",
    path: "pointSymbol",
    name: "点符号（兼容）",
    category: ["XY 图 · 兼容"]
  });
  addTooltipOptions(builder, true);
  addLegendOptions(builder, true, true);
}).setRuntimeConsumedPaths([
  "mapping",
  "series",
  "dims.frame",
  "dims.x",
  "dims.y",
  "excludeSeries",
  "show",
  "pointSize.fixed",
  "pointSize.min",
  "pointSize.max",
  "pointShape",
  "pointStrokeWidth",
  "fillOpacity",
  "lineStyle",
  "lineWidth",
  "pointSymbol",
  "legend.showLegend",
  "legend.displayMode",
  "legend.placement",
  "tooltip.mode",
  "tooltip.sort"
]).setOptionsEditor(XYSeriesEditor).register();
const _hoisted_1$2r = ["data-show-advanced-types", "data-tooltip-disable-one-click", "data-direction", "data-direction-resolved", "data-radius", "data-border-radius", "data-border-width", "data-border-color", "data-pan-zoom", "data-zoom-to-content", "data-pan-zoom-help"];
const _sfc_main$35 = /* @__PURE__ */ defineComponent({
  __name: "CanvasRenderer",
  props: {
    data: {},
    options: {},
    width: {},
    height: {},
    editable: { type: Boolean }
  },
  emits: ["options-change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const metricValue = computed(() => {
      const frame = props.data?.series?.[0];
      const field = frame?.fields.find((f) => f.type === "number");
      return field?.values?.slice(-1)[0];
    });
    const directionResolved = computed(
      () => resolveConnectionDirection(props.options?.direction)
    );
    const borderRadiusPx = computed(() => {
      const b = props.options?.border;
      const n = b && typeof b === "object" && b.radius != null ? Number(b.radius) : Number(props.options?.["border.radius"]);
      return Number.isFinite(n) && n > 0 ? n : 0;
    });
    const borderWidthPx = computed(() => {
      const b = props.options?.border;
      const n = b && typeof b === "object" && b.width != null ? Number(b.width) : Number(props.options?.["border.width"]);
      return Number.isFinite(n) && n > 0 ? n : 0;
    });
    const borderColor = computed(() => {
      const b = props.options?.border;
      if (b && typeof b === "object" && typeof b.color === "string" && b.color) return String(b.color);
      const flat = props.options?.["border.color"];
      return flat ? String(flat) : "";
    });
    const panelChromeStyle = computed(() => {
      const style = {};
      if (borderRadiusPx.value > 0) style.borderRadius = `${borderRadiusPx.value}px`;
      if (borderWidthPx.value > 0) {
        style.borderWidth = `${borderWidthPx.value}px`;
        style.borderStyle = "solid";
        style.borderColor = borderColor.value || "var(--grafana-border)";
      } else if (borderColor.value) {
        style.border = `1px solid ${borderColor.value}`;
      }
      style.overflow = borderRadiusPx.value > 0 ? "hidden" : "visible";
      return style;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-canvas",
        "data-testid": "panel-canvas",
        "data-show-advanced-types": String(!!__props.options?.showAdvancedTypes),
        "data-tooltip-disable-one-click": String(
          !!(__props.options?.tooltip?.disableForOneClick ?? __props.options?.["tooltip.disableForOneClick"])
        ),
        "data-direction": String(__props.options?.direction ?? ""),
        "data-direction-resolved": directionResolved.value,
        "data-radius": String(__props.options?.radius ?? __props.options?.border?.radius ?? ""),
        "data-border-radius": String(borderRadiusPx.value || __props.options?.border?.radius || ""),
        "data-border-width": String(borderWidthPx.value || ""),
        "data-border-color": borderColor.value,
        style: normalizeStyle(panelChromeStyle.value),
        "data-pan-zoom": String(!!__props.options?.panZoom),
        "data-zoom-to-content": String(!!__props.options?.zoomToContent),
        "data-pan-zoom-help": String(!!(__props.options?.panZoom && __props.options?.panZoomHelp !== false))
      }, [
        createVNode(CanvasEditor, {
          options: __props.options,
          "metric-value": metricValue.value,
          editable: !!__props.editable,
          width: __props.width,
          height: __props.height,
          onChange: _cache[0] || (_cache[0] = ($event) => emit("options-change", $event))
        }, null, 8, ["options", "metric-value", "editable", "width", "height"])
      ], 12, _hoisted_1$2r);
    };
  }
});
const CanvasRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$35, [["__scopeId", "data-v-eb52e26f"]]);
const _sfc_main$34 = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  emits: ["options-change"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const props = __props;
    const canvasEditable = computed(() => {
      const opts = props.options ?? {};
      if (opts.inlineEditing === false) return false;
      if (props.editable === true) return true;
      return opts.inlineEditing !== false;
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(CanvasRenderer, {
        data: __props.data,
        options: __props.options,
        width: __props.width,
        height: __props.height,
        editable: canvasEditable.value,
        onOptionsChange: _cache[0] || (_cache[0] = ($event) => emit("options-change", $event))
      }, null, 8, ["data", "options", "width", "height", "editable"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "canvas",
    name: "画布",
    description: "自由布局可视化画布",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$34
).useFieldConfig().setNoPadding().setPanelOptions((builder) => {
  const cat = ["画布"];
  const tip = ["提示"];
  const el = ["元素"];
  builder.addBoolean(
    {
      id: "inlineEditing",
      path: "inlineEditing",
      name: "内联编辑",
      description: "直接在面板中编辑",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showAdvancedTypes",
      path: "showAdvancedTypes",
      name: "实验性元素类型",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "panZoom",
      path: "panZoom",
      name: "平移与缩放",
      category: cat
    },
    false
  ).addCustom({
    id: "panZoomHelp",
    path: "panZoomHelp",
    name: "平移缩放帮助",
    category: cat,
    editor: "text",
    showIf: (c) => !!c.panZoom
  }).addBoolean(
    {
      id: "zoomToContent",
      path: "zoomToContent",
      name: "缩放至内容",
      category: cat,
      showIf: (c) => !!c.panZoom
    },
    false
  ).addRadio(
    {
      id: "tooltip.mode",
      path: "tooltip.mode",
      name: "提示模式",
      category: tip,
      settings: {
        options: [
          { label: "启用", value: "single" },
          { label: "禁用", value: "none" }
        ]
      }
    },
    "single"
  ).addBoolean(
    {
      id: "tooltip.disableForOneClick",
      path: "tooltip.disableForOneClick",
      name: "单击元素禁用提示",
      category: tip,
      showIf: (c) => c.tooltip?.mode !== "none"
    },
    false
  ).addCustom({
    id: "root",
    path: "root",
    name: "根场景",
    category: el,
    editor: "text"
  }).addCustom({
    id: "type",
    path: "type",
    name: "元素类型",
    category: el,
    editor: "select",
    settings: {
      options: [
        { label: "矩形", value: "rectangle" },
        { label: "文本", value: "text" },
        { label: "指标", value: "metric-value" },
        { label: "图标", value: "icon" },
        { label: "椭圆", value: "ellipse" },
        { label: "服务器", value: "server" }
      ]
    }
  }).addText({ id: "color", path: "color", name: "颜色", category: el }, void 0).addNumber({ id: "size", path: "size", name: "尺寸", category: el }, void 0).addNumber(
    { id: "radius", path: "radius", name: "半径", category: el },
    void 0
  ).addSelect(
    {
      id: "direction",
      path: "direction",
      name: "方向",
      category: el,
      settings: {
        options: [
          { label: "正向", value: "forward" },
          { label: "反向", value: "reverse" },
          { label: "双向", value: "both" },
          { label: "水平(兼容)", value: "horizontal" },
          { label: "垂直(兼容)", value: "vertical" }
        ]
      }
    },
    void 0
  ).addSelect(
    {
      id: "lineStyle",
      path: "lineStyle",
      name: "线型",
      category: el,
      settings: {
        options: [
          { label: "实线", value: "solid" },
          { label: "虚线", value: "dashed" },
          { label: "点线", value: "dotted" }
        ]
      }
    },
    void 0
  ).addCustom({
    id: "links",
    path: "links",
    name: "链接",
    category: el,
    editor: "links"
  }).addCustom({
    id: "actions",
    path: "actions",
    name: "动作",
    category: el,
    editor: "text"
  }).addColor(
    {
      id: "background.color",
      path: "background.color",
      name: "背景色",
      category: el
    },
    void 0
  ).addText(
    {
      id: "background.image",
      path: "background.image",
      name: "背景图",
      category: el
    },
    void 0
  ).addSelect(
    {
      id: "background.size",
      path: "background.size",
      name: "背景尺寸",
      category: el,
      settings: {
        options: [
          { label: "覆盖", value: "cover" },
          { label: "包含", value: "contain" },
          { label: "原始", value: "original" },
          { label: "平铺", value: "tile" }
        ]
      }
    },
    void 0
  ).addColor(
    {
      id: "border.color",
      path: "border.color",
      name: "边框色",
      category: el
    },
    void 0
  ).addNumber(
    {
      id: "border.width",
      path: "border.width",
      name: "边框宽",
      category: el
    },
    void 0
  ).addNumber(
    {
      id: "border.radius",
      path: "border.radius",
      name: "边框圆角",
      category: el
    },
    void 0
  );
}).setRuntimeConsumedPaths([
  "inlineEditing",
  "showAdvancedTypes",
  "panZoom",
  "panZoomHelp",
  "zoomToContent",
  "tooltip.mode",
  "tooltip.disableForOneClick",
  "root",
  "type",
  "color",
  "size",
  "radius",
  "direction",
  "lineStyle",
  "links",
  "actions",
  "background.color",
  "background.image",
  "background.size",
  "border.color",
  "border.width",
  "border.radius"
]).setOptionsEditor(CanvasEditor).register();
function fieldLabels$1(f) {
  const out = [f.name];
  const dn = f.state?.displayName || f.config?.displayName;
  if (dn && dn !== f.name) out.push(dn);
  return out;
}
function fieldNameMatches(f, re) {
  return fieldLabels$1(f).some((n) => re.test(n));
}
function validateTraceFields(fields) {
  const has = (re) => fields.some((f) => fieldNameMatches(f, re));
  const missing = [];
  if (!has(/spanID|spanId|span_id/i)) missing.push("spanId");
  if (!has(/startTime|startTimeUnixNano|start_time|start/i) && !fields.some((f) => f.type === "time")) {
    missing.push("startTime");
  }
  if (!has(/duration|durationNano|duration_ms|dur/i)) missing.push("duration");
  if (missing.length) {
    return {
      code: "INVALID_TRACE_SCHEMA",
      message: `链路数据缺少必要字段: ${missing.join(", ")}`,
      missing
    };
  }
  return null;
}
function framesToTraceSpans(fields) {
  if (!fields.length) return [];
  const n = fields[0]?.values.length ?? 0;
  if (!n) return [];
  const by = (re) => fields.find((f) => fieldNameMatches(f, re));
  const spanIdF = by(/spanID|spanId|span_id/i);
  if (!spanIdF) return [];
  const schemaErr = validateTraceFields(fields);
  if (schemaErr) return [];
  const nameF = by(/operation|name|spanName/i) ?? fields.find((f) => f.type === "string");
  const serviceF = by(/service/i);
  const startF = by(/startTimeUnixNano|startTime|start/i) ?? fields.find((f) => f.type === "time" || f.type === "number");
  const durF = by(/duration|dur/i) ?? fields.find((f) => f.type === "number" && f !== startF);
  const parentF = by(/parentSpanID|parentSpanId|parent/i);
  const statusF = by(/status|statusCode/i);
  const tagsF = by(/tags|attributes|process\.tags/i);
  const processF = by(/^process$|process\./i);
  const logsF = by(/logs|events/i);
  const spans = [];
  for (let i = 0; i < n; i++) {
    let start = Number(startF?.values[i] ?? i * 10);
    if (start > 1e15) start = start / 1e6;
    else if (start > 1e14) start = start / 1e3;
    let duration = Number(durF?.values[i] ?? 20);
    if (duration > 1e9) duration = duration / 1e6;
    let tags;
    const rawTags = tagsF?.values[i];
    if (rawTags && typeof rawTags === "object" && !Array.isArray(rawTags)) {
      tags = Object.fromEntries(Object.entries(rawTags).map(([k, v]) => [k, String(v)]));
    } else if (typeof rawTags === "string" && rawTags.trim().startsWith("{")) {
      try {
        tags = Object.fromEntries(
          Object.entries(JSON.parse(rawTags)).map(([k, v]) => [k, String(v)])
        );
      } catch {
        tags = { raw: rawTags };
      }
    }
    let process2;
    const rawProc = processF?.values[i];
    if (rawProc && typeof rawProc === "object" && !Array.isArray(rawProc)) {
      process2 = Object.fromEntries(
        Object.entries(rawProc).map(([k, v]) => [k, String(v)])
      );
    }
    let logs;
    const rawLogs = logsF?.values[i];
    if (Array.isArray(rawLogs)) {
      logs = rawLogs.map((l, li) => ({
        timestamp: Number(l?.timestamp ?? l?.ts ?? li),
        fields: l?.fields && typeof l.fields === "object" ? Object.fromEntries(Object.entries(l.fields).map(([k, v]) => [k, String(v)])) : { event: String(l?.event ?? l ?? "") }
      }));
    }
    spans.push({
      spanId: String(spanIdF?.values[i] ?? i),
      parentSpanId: parentF?.values[i] != null ? String(parentF.values[i]) : void 0,
      name: String(nameF?.values[i] ?? `span-${i}`),
      service: String(serviceF?.values[i] ?? "service"),
      start,
      duration,
      depth: 0,
      status: statusF ? String(statusF.values[i]) : void 0,
      tags,
      process: process2,
      logs,
      logsCount: logs?.length
    });
  }
  const hasParentField = !!parentF;
  const indexed = indexTraceHierarchy(spans, {
    allowDepthHeuristic: !hasParentField
  });
  return indexed.ordered;
}
function indexTraceHierarchy(spans, opts = {}) {
  const diagnostics = [];
  const byId2 = /* @__PURE__ */ new Map();
  for (const s of spans) {
    if (byId2.has(s.spanId)) {
      diagnostics.push({
        code: "DUPLICATE_SPAN",
        message: `duplicate spanId ${s.spanId}`,
        spanId: s.spanId
      });
      continue;
    }
    byId2.set(s.spanId, s);
  }
  const children = /* @__PURE__ */ new Map();
  const pushChild = (parent, s) => {
    const list = children.get(parent);
    if (list) list.push(s);
    else children.set(parent, [s]);
  };
  for (const s of byId2.values()) {
    const rawParent = s.parentSpanId != null && String(s.parentSpanId) !== "" ? String(s.parentSpanId) : null;
    if (rawParent && !byId2.has(rawParent)) {
      diagnostics.push({
        code: "ORPHAN_SPAN",
        message: `orphan span ${s.spanId}: missing parent ${rawParent}`,
        spanId: s.spanId
      });
      pushChild(null, s);
      continue;
    }
    if (rawParent === s.spanId) {
      diagnostics.push({
        code: "CYCLE",
        message: `self-parent cycle on ${s.spanId}`,
        spanId: s.spanId
      });
      pushChild(null, s);
      continue;
    }
    pushChild(rawParent, s);
  }
  for (const list of children.values()) {
    list.sort((a, b) => a.start - b.start || a.spanId.localeCompare(b.spanId));
  }
  const ordered = [];
  const visiting = /* @__PURE__ */ new Set();
  const visited = /* @__PURE__ */ new Set();
  function dfs(parent, depth) {
    const kids = children.get(parent) ?? [];
    for (const s of kids) {
      if (visiting.has(s.spanId)) {
        diagnostics.push({
          code: "CYCLE",
          message: `cycle detected at ${s.spanId}`,
          spanId: s.spanId
        });
        continue;
      }
      if (visited.has(s.spanId)) continue;
      visiting.add(s.spanId);
      s.depth = depth;
      ordered.push(s);
      visited.add(s.spanId);
      dfs(s.spanId, depth + 1);
      visiting.delete(s.spanId);
    }
  }
  dfs(null, 0);
  for (const s of byId2.values()) {
    if (!visited.has(s.spanId)) {
      diagnostics.push({
        code: "UNREACHABLE_SPAN",
        message: `unreachable span ${s.spanId}`,
        spanId: s.spanId
      });
      s.depth = 0;
      ordered.push(s);
      visited.add(s.spanId);
    }
  }
  if (opts.allowDepthHeuristic && ordered.length > 1 && ordered.every((s) => s.depth === 0)) {
    ordered.forEach((s, i) => {
      s.depth = i === 0 ? 0 : 1 + i % 3;
    });
  }
  return { byId: byId2, children, ordered, diagnostics };
}
function spanTimeBounds(spans) {
  if (!spans.length) return { rootStart: 0, end: 0, duration: 0 };
  let rootStart = spans[0].start;
  let end = spans[0].start + spans[0].duration;
  for (let i = 1; i < spans.length; i++) {
    const s = spans[i];
    if (s.start < rootStart) rootStart = s.start;
    const e = s.start + s.duration;
    if (e > end) end = e;
  }
  return { rootStart, end, duration: Math.max(0, end - rootStart) };
}
function normalizeTracePanelFrames(frames) {
  const diagnostics = [];
  const allSpans = [];
  for (const frame of frames || []) {
    const fields = (frame.fields || []).map((f) => ({
      name: f.name,
      type: f.type,
      values: f.values
    }));
    const err = validateTraceFields(fields);
    if (err) {
      diagnostics.push({ code: err.code, message: err.message });
      continue;
    }
    const spans2 = framesToTraceSpans(fields);
    if (!spans2.length && fields.length) {
      diagnostics.push({
        code: "INVALID_RESPONSE",
        message: "trace frame produced zero spans after strict parse"
      });
      continue;
    }
    for (const s of spans2) {
      if (!s.spanId) {
        throw new Error("INVALID_RESPONSE: span missing spanId");
      }
      if (!Number.isFinite(s.start) || !Number.isFinite(s.duration)) {
        throw new TypeError("INVALID_RESPONSE: span missing start or duration");
      }
      allSpans.push(s);
    }
  }
  if (!allSpans.length) {
    if (diagnostics.length) {
      const e = new Error(`INVALID_RESPONSE: ${diagnostics.map((d) => d.message).join("; ")}`);
      e.code = "INVALID_RESPONSE";
      throw e;
    }
    return { spans: [], rootStart: 0, duration: 0, diagnostics };
  }
  const bounds = spanTimeBounds(allSpans);
  const rootStart = bounds.rootStart;
  const spans = allSpans.map((s) => ({
    ...s,
    // trace-relative offset
    offsetMs: Math.round(s.start - rootStart)
  }));
  return {
    spans,
    rootStart,
    duration: bounds.duration,
    diagnostics
  };
}
function useVirtualTraceRows(total, scrollTop, viewportHeight, rowHeight = 28, overscan = 12) {
  const win = computeVirtualWindow(total, scrollTop, viewportHeight, rowHeight, overscan);
  return {
    ...win,
    slice: (rows) => sliceVirtualRows(rows, win)
  };
}
const _hoisted_1$2q = {
  key: 0,
  class: "panel-empty",
  "data-testid": "traces-panel-empty"
};
const _hoisted_2$1W = ["data-filters", "data-critical-path", "data-matches-only", "data-span-count", "data-show-service", "data-detail-open", "data-selected-span", "data-view-mode", "data-has-service-graph", "data-service-graph-nodes", "data-virtualized", "data-row-height", "data-window-count"];
const _hoisted_3$1I = {
  key: 0,
  class: "view-tabs",
  "data-testid": "traces-view-tabs"
};
const _hoisted_4$1q = {
  key: 1,
  class: "svc-graph",
  "data-testid": "traces-service-graph"
};
const _hoisted_5$1e = {
  viewBox: "0 0 100 90",
  class: "svc-svg",
  role: "img",
  "aria-label": "服务拓扑图"
};
const _hoisted_6$14 = ["x1", "y1", "x2", "y2"];
const _hoisted_7$Z = ["onClick"];
const _hoisted_8$R = ["cx", "cy", "fill"];
const _hoisted_9$O = ["x", "y"];
const _hoisted_10$F = {
  key: 0,
  class: "svc-detail",
  "data-testid": "traces-service-detail"
};
const _hoisted_11$B = { key: 0 };
const _hoisted_12$v = {
  key: 0,
  class: "legend",
  "data-testid": "traces-legend"
};
const _hoisted_13$u = { class: "TimelineHeaderRow" };
const _hoisted_14$p = { class: "header-view" };
const _hoisted_15$m = { class: "Ticks" };
const _hoisted_16$k = ["data-row-index", "data-selected", "aria-rowindex", "onClick"];
const _hoisted_17$i = { class: "nameColumn" };
const _hoisted_18$i = { class: "SpanTreeOffset" };
const _hoisted_19$h = { class: "endpointName" };
const _hoisted_20$f = { class: "view" };
const _hoisted_21$8 = { class: "Ticks ticks-abs" };
const _hoisted_22$7 = { class: "spanBarWrapper" };
const _hoisted_23$6 = {
  key: 3,
  class: "empty",
  "data-testid": "traces-empty"
};
const _hoisted_24$6 = {
  key: 4,
  class: "empty",
  "data-testid": "traces-empty-fallback"
};
const _hoisted_25$4 = {
  key: 0,
  class: "detail",
  "data-testid": "traces-detail"
};
const _hoisted_26$4 = { class: "detail-head" };
const _hoisted_27$3 = { class: "endpointName" };
const _hoisted_28$3 = { class: "detail-meta" };
const _hoisted_29$3 = { key: 0 };
const _hoisted_30$3 = {
  class: "tabs",
  "data-testid": "traces-detail-tabs"
};
const _hoisted_31$3 = {
  key: 0,
  class: "kv",
  "data-testid": "traces-tags"
};
const _hoisted_32$3 = {
  key: 0,
  class: "empty-cell"
};
const _hoisted_33$3 = {
  key: 1,
  class: "proc",
  "data-testid": "traces-process"
};
const _hoisted_34$3 = { key: 0 };
const _hoisted_35$2 = {
  key: 2,
  class: "logs-tl",
  "data-testid": "traces-logs"
};
const _hoisted_36$1 = { class: "log-ts" };
const _hoisted_37$1 = { class: "log-fields" };
const _hoisted_38$1 = {
  key: 0,
  class: "empty-cell"
};
const TRACE_ROW_H = 28;
const _sfc_main$33 = /* @__PURE__ */ defineComponent({
  __name: "TracesRenderer",
  props: {
    data: {},
    options: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const filtersOpt = computed(() => opts.value.filters ?? opts.value.spanFilters ?? null);
    const selected = ref(null);
    function isNodeGraphFrame(f) {
      const name = String(f?.name ?? "");
      if (/^(nodes?|edges?)$/i.test(name)) return true;
      if (f?.meta?.preferredVisualisationType === "nodeGraph") return true;
      const names = (Array.isArray(f?.fields) ? f.fields : []).map(
        (fld) => String(fld?.name ?? "").toLowerCase()
      );
      const hasFromTo = names.some((n) => n === "source" || n === "from") && names.some((n) => n === "target" || n === "to");
      const hasIdTitle = names.includes("id") && names.some((n) => n === "title" || n === "mainstat");
      return hasFromTo || hasIdTitle;
    }
    function isTraceFrame(f) {
      if (!f || isNodeGraphFrame(f)) return false;
      const names = (Array.isArray(f?.fields) ? f.fields : []).map(
        (fld) => String(fld?.name ?? "").toLowerCase()
      );
      return names.some(
        (n) => /spanid|span_id|duration|starttime|operationname|servicename/.test(n)
      );
    }
    const allSpans = computed(() => {
      const series = props.data?.series ?? [];
      if (series.length && series.every(isNodeGraphFrame)) {
        return [];
      }
      const frames = series.filter((f) => isTraceFrame(f) || !isNodeGraphFrame(f));
      if (!frames.length) return [];
      try {
        const norm = normalizeTracePanelFrames(frames);
        return norm.spans.map((s) => ({
          ...s,
          start: Number.isFinite(s.offsetMs) ? s.offsetMs : s.start - norm.rootStart
        }));
      } catch {
        return [];
      }
    });
    const spans = computed(() => {
      let list = allSpans.value;
      const f = opts.value.spanFilters ?? {};
      if (f.criticalPathOnly) {
        let walk = function(parent) {
          const kids = byParent.get(parent) ?? [];
          if (!kids.length) return;
          const best = [...kids].sort((a, b) => b.duration - a.duration)[0];
          keep.add(best.spanId);
          walk(best.spanId);
        };
        const parentKey = (s) => {
          const p = s.parentSpanId;
          if (p == null || p === "") return void 0;
          return String(p);
        };
        const byParent = /* @__PURE__ */ new Map();
        for (const s of list) {
          const k = parentKey(s);
          if (!byParent.has(k)) byParent.set(k, []);
          byParent.get(k).push(s);
        }
        const keep = /* @__PURE__ */ new Set();
        walk(void 0);
        list = list.filter((s) => keep.has(s.spanId));
      }
      if (f.matchesOnly && f.serviceName) {
        const svc = String(f.serviceName).toLowerCase();
        list = list.filter((s) => s.service.toLowerCase().includes(svc));
      }
      if (f.matchesOnly && f.spanName) {
        const n = String(f.spanName).toLowerCase();
        list = list.filter((s) => s.name.toLowerCase().includes(n));
      }
      if (f.minDuration != null && f.minDuration !== "") {
        const min = Number(f.minDuration);
        if (Number.isFinite(min)) list = list.filter((s) => s.duration >= min);
      }
      return list;
    });
    const maxEnd = computed(() => {
      const b = spanTimeBounds(spans.value);
      return Math.max(1, b.end || 1);
    });
    const services = computed(() => {
      const set = /* @__PURE__ */ new Set();
      for (const s of spans.value) set.add(s.service);
      return Array.from(set);
    });
    const scrollTop = ref(0);
    const viewportH = ref(360);
    const scrollEl = ref(null);
    const virt = computed(
      () => useVirtualTraceRows(spans.value.length, scrollTop.value, viewportH.value, TRACE_ROW_H, 12)
    );
    const visibleSpans = computed(() => virt.value.slice(spans.value));
    function onTraceScroll(e) {
      const el = e.target;
      scrollTop.value = el.scrollTop;
      viewportH.value = el.clientHeight || viewportH.value;
    }
    function measureTraceViewport() {
      const el = scrollEl.value;
      if (!el) return;
      viewportH.value = el.clientHeight || viewportH.value;
    }
    function scrollSelectedIntoView(id) {
      if (!id) return;
      const idx = spans.value.findIndex((s) => s.spanId === id);
      if (idx < 0) return;
      const el = scrollEl.value;
      if (!el) {
        scrollTop.value = Math.max(0, idx * TRACE_ROW_H - viewportH.value / 3);
        return;
      }
      const top = idx * TRACE_ROW_H;
      const bottom = top + TRACE_ROW_H;
      if (top < el.scrollTop) {
        el.scrollTop = top;
      } else if (bottom > el.scrollTop + el.clientHeight) {
        el.scrollTop = bottom - el.clientHeight;
      }
      scrollTop.value = el.scrollTop;
      viewportH.value = el.clientHeight || viewportH.value;
    }
    watch(selected, (id) => {
      void nextTick(() => scrollSelectedIntoView(id));
    });
    watch(
      () => spans.value.length,
      () => {
        void nextTick(measureTraceViewport);
      }
    );
    let _ro = null;
    onMounted(() => {
      void nextTick(() => {
        measureTraceViewport();
        if (typeof ResizeObserver !== "undefined" && scrollEl.value) {
          _ro = new ResizeObserver(() => measureTraceViewport());
          _ro.observe(scrollEl.value);
        }
      });
    });
    onBeforeUnmount(() => {
      _ro?.disconnect();
      _ro = null;
    });
    function hasNodeGraphFrames(series) {
      if (!series?.length) return false;
      return series.some((f) => {
        const name = String(f?.name ?? "");
        if (/node|edge/i.test(name)) return true;
        if (f?.meta?.preferredVisualisationType === "nodeGraph") return true;
        const fields = Array.isArray(f?.fields) ? f.fields : [];
        const names = fields.map((fld) => String(fld?.name ?? "").toLowerCase());
        const hasId = names.some((n) => n === "id" || n.endsWith(" id"));
        const hasFromTo = names.some((n) => n === "source" || n === "from" || n.endsWith("source")) && names.some((n) => n === "target" || n === "to" || n.endsWith("target"));
        return hasId || hasFromTo;
      });
    }
    const hasServiceGraph = computed(() => hasNodeGraphFrames(props.data?.series));
    const serviceGraph = computed(() => {
      if (!hasServiceGraph.value) return { nodes: [], edges: [] };
      return layoutGraph(framesToGraph(props.data?.series), "force");
    });
    const graphById = computed(() => new Map(serviceGraph.value.nodes.map((n) => [n.id, n])));
    const selectedNode = ref(null);
    const viewMode = ref("waterfall");
    watch(
      () => ({ spans: allSpans.value.length, graph: hasServiceGraph.value }),
      ({ spans: spans2, graph }) => {
        if (!spans2 && graph) viewMode.value = "serviceGraph";
        if (spans2 && !graph) viewMode.value = "waterfall";
      },
      { immediate: true }
    );
    function selectNode(n) {
      selectedNode.value = selectedNode.value?.id === n.id ? null : n;
    }
    const noTraceData = computed(() => !allSpans.value.length && !hasServiceGraph.value);
    const showServiceName = computed(() => opts.value.showServiceName !== false);
    const showDuration = computed(() => opts.value.showDuration !== false);
    const selectedSpan = computed(() => {
      if (!selected.value) return null;
      return allSpans.value.find((s) => s.spanId === selected.value) ?? spans.value.find((s) => s.spanId === selected.value) ?? null;
    });
    const selectedTags = computed(() => {
      const s = selectedSpan.value;
      if (!s) return [];
      const base = {
        spanID: s.spanId,
        ...s.parentSpanId ? { parentSpanID: s.parentSpanId } : {},
        service: s.service,
        operation: s.name,
        duration: `${Math.round(s.duration)}ms`,
        start: `${Math.round(s.start)}ms`,
        ...s.status ? { status: s.status } : {},
        ...s.tags ?? {}
      };
      return Object.entries(base);
    });
    const processEntries = computed(() => {
      const s = selectedSpan.value;
      if (!s?.process) return [];
      return Object.entries(s.process);
    });
    const logEntries = computed(() => {
      const s = selectedSpan.value;
      return s?.logs ?? [];
    });
    const detailTab = ref("tags");
    watch(selected, () => {
      detailTab.value = "tags";
    });
    function serviceColor(name) {
      return classicColorForKey(name);
    }
    const timeTicks = computed(() => {
      const end = maxEnd.value || 1;
      const steps = 5;
      return Array.from({ length: steps + 1 }, (_, i) => {
        const t2 = end * i / steps;
        return {
          pct: i / steps * 100,
          label: t2 >= 1e3 ? `${(t2 / 1e3).toFixed(t2 >= 1e4 ? 0 : 1)}s` : `${Math.round(t2)}ms`
        };
      });
    });
    function formatDur(ms) {
      if (!Number.isFinite(ms)) return "—";
      if (ms >= 1e3) return `${(ms / 1e3).toFixed(ms >= 1e4 ? 1 : 2)}s`;
      if (ms < 1) return `${ms.toFixed(2)}ms`;
      return `${Math.round(ms)}ms`;
    }
    function onTraceKeydown(e) {
      if (!spans.value.length) return;
      const list = spans.value;
      const idx = selected.value ? list.findIndex((s) => s.spanId === selected.value) : -1;
      if (e.key === "Escape") {
        selected.value = null;
        e.preventDefault();
        return;
      }
      if (e.key === "ArrowDown") {
        const next = idx < 0 ? 0 : Math.min(list.length - 1, idx + 1);
        selected.value = list[next]?.spanId ?? null;
        e.preventDefault();
      } else if (e.key === "ArrowUp") {
        const next = idx < 0 ? 0 : Math.max(0, idx - 1);
        selected.value = list[next]?.spanId ?? null;
        e.preventDefault();
      } else if (e.key === "Enter" && idx >= 0) {
        e.preventDefault();
      }
    }
    function selectSpan(id) {
      selected.value = selected.value === id ? null : id;
    }
    return (_ctx, _cache) => {
      return noTraceData.value ? (openBlock(), createElementBlock("div", _hoisted_1$2q, [..._cache[6] || (_cache[6] = [
        createElementVNode(
          "p",
          { class: "panel-empty__msg" },
          "回复中未找到数据",
          -1
          /* CACHED */
        )
      ])])) : (openBlock(), createElementBlock("div", {
        key: 1,
        class: "traces",
        "data-testid": "panel-traces",
        "data-filters": String(
          filtersOpt.value == null || filtersOpt.value === "" ? "" : typeof filtersOpt.value === "string" ? filtersOpt.value : JSON.stringify(filtersOpt.value)
        ),
        tabindex: "0",
        role: "region",
        "data-critical-path": String(!!opts.value.spanFilters?.criticalPathOnly),
        "data-matches-only": String(!!opts.value.spanFilters?.matchesOnly),
        "data-span-count": String(spans.value.length),
        "data-show-service": String(showServiceName.value),
        "data-detail-open": String(!!selectedSpan.value),
        "data-selected-span": selected.value ?? "",
        "data-view-mode": viewMode.value,
        "data-has-service-graph": String(hasServiceGraph.value),
        "data-service-graph-nodes": String(serviceGraph.value.nodes.length),
        "data-virtualized": String(spans.value.length > 0),
        "data-row-height": String(TRACE_ROW_H),
        "data-window-count": String(virt.value.visibleCount),
        onKeydown: onTraceKeydown
      }, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["wrapper", { "is-empty": !spans.value.length && viewMode.value === "waterfall" }])
          },
          [
            hasServiceGraph.value && spans.value.length ? (openBlock(), createElementBlock("div", _hoisted_3$1I, [
              createElementVNode(
                "button",
                {
                  type: "button",
                  class: normalizeClass({ on: viewMode.value === "waterfall" }),
                  "data-testid": "traces-view-waterfall",
                  onClick: _cache[0] || (_cache[0] = ($event) => viewMode.value = "waterfall")
                },
                " 瀑布图 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  class: normalizeClass({ on: viewMode.value === "serviceGraph" }),
                  "data-testid": "traces-view-service-graph",
                  onClick: _cache[1] || (_cache[1] = ($event) => viewMode.value = "serviceGraph")
                },
                " 服务图 ",
                2
                /* CLASS */
              )
            ])) : createCommentVNode("v-if", true),
            viewMode.value === "serviceGraph" && hasServiceGraph.value ? (openBlock(), createElementBlock("div", _hoisted_4$1q, [
              (openBlock(), createElementBlock("svg", _hoisted_5$1e, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(serviceGraph.value.edges, (e, i) => {
                    return openBlock(), createElementBlock("line", {
                      key: `e${i}`,
                      x1: graphById.value.get(e.from)?.x ?? 0,
                      y1: graphById.value.get(e.from)?.y ?? 0,
                      x2: graphById.value.get(e.to)?.x ?? 0,
                      y2: graphById.value.get(e.to)?.y ?? 0,
                      class: "svc-edge"
                    }, null, 8, _hoisted_6$14);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                )),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(serviceGraph.value.nodes, (n) => {
                    return openBlock(), createElementBlock("g", {
                      key: n.id,
                      class: normalizeClass(["svc-node", { on: selectedNode.value?.id === n.id }]),
                      "data-testid": "traces-service-node",
                      onClick: ($event) => selectNode(n)
                    }, [
                      createElementVNode("circle", {
                        cx: n.x,
                        cy: n.y,
                        r: "5",
                        fill: serviceColor(n.label || n.id)
                      }, null, 8, _hoisted_8$R),
                      createElementVNode("text", {
                        x: n.x,
                        y: (n.y ?? 0) + 9,
                        "text-anchor": "middle",
                        class: "svc-label"
                      }, toDisplayString(n.label || n.id), 9, _hoisted_9$O)
                    ], 10, _hoisted_7$Z);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])),
              selectedNode.value ? (openBlock(), createElementBlock("div", _hoisted_10$F, [
                createElementVNode(
                  "strong",
                  null,
                  toDisplayString(selectedNode.value.label || selectedNode.value.id),
                  1
                  /* TEXT */
                ),
                selectedNode.value.mainStat != null ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_11$B,
                  " · " + toDisplayString(selectedNode.value.mainStat),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ])) : createCommentVNode("v-if", true)
            ])) : spans.value.length ? (openBlock(), createElementBlock(
              Fragment,
              { key: 2 },
              [
                showServiceName.value ? (openBlock(), createElementBlock("div", _hoisted_12$v, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(services.value, (s) => {
                      return openBlock(), createElementBlock("span", {
                        key: s,
                        class: "chip"
                      }, [
                        createElementVNode(
                          "i",
                          {
                            class: "dot",
                            style: normalizeStyle({ background: serviceColor(s) })
                          },
                          null,
                          4
                          /* STYLE */
                        ),
                        createTextVNode(
                          toDisplayString(s),
                          1
                          /* TEXT */
                        )
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])) : createCommentVNode("v-if", true),
                createCommentVNode(" TimelineHeaderRow "),
                createElementVNode("div", _hoisted_13$u, [
                  _cache[7] || (_cache[7] = createElementVNode(
                    "div",
                    { class: "header-name" },
                    "Service & Operation",
                    -1
                    /* CACHED */
                  )),
                  createElementVNode("div", _hoisted_14$p, [
                    createElementVNode("div", _hoisted_15$m, [
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(timeTicks.value, (tk, i) => {
                          return openBlock(), createElementBlock(
                            "div",
                            {
                              key: i,
                              class: "TicksTick",
                              style: normalizeStyle({ left: `${tk.pct}%` })
                            },
                            [
                              createElementVNode(
                                "span",
                                {
                                  class: normalizeClass(["TicksTickLabel", { end: i === timeTicks.value.length - 1 }])
                                },
                                toDisplayString(tk.label),
                                3
                                /* TEXT, CLASS */
                              )
                            ],
                            4
                            /* STYLE */
                          );
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ])
                  ])
                ]),
                createCommentVNode(" SpanBarRows (windowed) "),
                createElementVNode(
                  "div",
                  {
                    ref_key: "scrollEl",
                    ref: scrollEl,
                    class: "VirtualizedTraceView",
                    "data-testid": "traces-virtual-scroll",
                    onScrollPassive: onTraceScroll
                  },
                  [
                    createElementVNode(
                      "div",
                      {
                        class: "trace-virt-spacer",
                        style: normalizeStyle({ height: `${virt.value.totalHeight}px`, position: "relative" })
                      },
                      [
                        createElementVNode(
                          "div",
                          {
                            class: "trace-virt-window",
                            style: normalizeStyle({ transform: `translateY(${virt.value.offsetY}px)` })
                          },
                          [
                            (openBlock(true), createElementBlock(
                              Fragment,
                              null,
                              renderList(visibleSpans.value, (s, i) => {
                                return openBlock(), createElementBlock("div", {
                                  key: `${s.spanId}-${virt.value.start + i}`,
                                  class: normalizeClass(["span-row", {
                                    selected: selected.value === s.spanId,
                                    isDetailExpanded: selected.value === s.spanId,
                                    error: s.status === "ERROR" || s.status === "2"
                                  }]),
                                  "data-testid": "trace-span",
                                  "data-row-index": String(virt.value.start + i),
                                  "data-selected": selected.value === s.spanId ? "true" : "false",
                                  "aria-rowindex": virt.value.start + i + 1,
                                  onClick: ($event) => selectSpan(s.spanId)
                                }, [
                                  createElementVNode(
                                    "div",
                                    {
                                      class: "nameWrapper",
                                      style: normalizeStyle({
                                        borderBottomColor: serviceColor(s.service || "unknown")
                                      })
                                    },
                                    [
                                      createElementVNode("div", _hoisted_17$i, [
                                        createElementVNode("span", _hoisted_18$i, [
                                          (openBlock(true), createElementBlock(
                                            Fragment,
                                            null,
                                            renderList(s.depth, (d) => {
                                              return openBlock(), createElementBlock("span", {
                                                key: d,
                                                class: "SpanTreeOffset--indentGuide"
                                              });
                                            }),
                                            128
                                            /* KEYED_FRAGMENT */
                                          ))
                                        ]),
                                        createElementVNode(
                                          "button",
                                          {
                                            type: "button",
                                            class: "name",
                                            style: normalizeStyle({
                                              borderBottomColor: `${serviceColor(s.service || "unknown")}CF`
                                            })
                                          },
                                          [
                                            showServiceName.value ? (openBlock(), createElementBlock(
                                              "span",
                                              {
                                                key: 0,
                                                class: "svcName",
                                                style: normalizeStyle({ color: serviceColor(s.service || "unknown") })
                                              },
                                              toDisplayString(s.service),
                                              5
                                              /* TEXT, STYLE */
                                            )) : createCommentVNode("v-if", true),
                                            createElementVNode(
                                              "span",
                                              _hoisted_19$h,
                                              toDisplayString(s.name),
                                              1
                                              /* TEXT */
                                            )
                                          ],
                                          4
                                          /* STYLE */
                                        )
                                      ])
                                    ],
                                    4
                                    /* STYLE */
                                  ),
                                  createElementVNode("div", _hoisted_20$f, [
                                    createElementVNode("div", _hoisted_21$8, [
                                      (openBlock(true), createElementBlock(
                                        Fragment,
                                        null,
                                        renderList(timeTicks.value, (tk, ti) => {
                                          return openBlock(), createElementBlock(
                                            "div",
                                            {
                                              key: `t${ti}`,
                                              class: "TicksTick",
                                              style: normalizeStyle({ left: `${tk.pct}%` })
                                            },
                                            null,
                                            4
                                            /* STYLE */
                                          );
                                        }),
                                        128
                                        /* KEYED_FRAGMENT */
                                      ))
                                    ]),
                                    createCommentVNode(" SpanBar: height 40%, top 30% "),
                                    createElementVNode("div", _hoisted_22$7, [
                                      createElementVNode(
                                        "div",
                                        {
                                          class: normalizeClass(["spanBar", {
                                            error: s.status === "ERROR" || s.status === "2"
                                          }]),
                                          style: normalizeStyle({
                                            left: `${s.start / maxEnd.value * 100}%`,
                                            width: `${Math.max(0.25, s.duration / maxEnd.value * 100)}%`,
                                            background: s.status === "ERROR" || s.status === "2" ? "var(--grafana-error)" : serviceColor(s.service || "unknown")
                                          })
                                        },
                                        null,
                                        6
                                        /* CLASS, STYLE */
                                      ),
                                      showDuration.value ? (openBlock(), createElementBlock(
                                        "div",
                                        {
                                          key: 0,
                                          class: normalizeClass(["spanBarLabel", s.start / maxEnd.value > 0.5 ? "labelLeft" : "labelRight"]),
                                          style: normalizeStyle({
                                            left: s.start / maxEnd.value > 0.5 ? `${s.start / maxEnd.value * 100}%` : `${s.start / maxEnd.value * 100 + Math.max(0.25, s.duration / maxEnd.value * 100)}%`
                                          })
                                        },
                                        toDisplayString(formatDur(s.duration)),
                                        7
                                        /* TEXT, CLASS, STYLE */
                                      )) : createCommentVNode("v-if", true)
                                    ])
                                  ])
                                ], 10, _hoisted_16$k);
                              }),
                              128
                              /* KEYED_FRAGMENT */
                            ))
                          ],
                          4
                          /* STYLE */
                        )
                      ],
                      4
                      /* STYLE */
                    )
                  ],
                  544
                  /* NEED_HYDRATION, NEED_PATCH */
                )
              ],
              64
              /* STABLE_FRAGMENT */
            )) : !hasServiceGraph.value ? (openBlock(), createElementBlock("div", _hoisted_23$6, "暂无链路数据")) : (openBlock(), createElementBlock("div", _hoisted_24$6, " 无瀑布图 span，已切换服务图 "))
          ],
          2
          /* CLASS */
        ),
        createCommentVNode(" Span detail (simplified SpanDetailRow) "),
        selectedSpan.value ? (openBlock(), createElementBlock("aside", _hoisted_25$4, [
          createElementVNode("header", _hoisted_26$4, [
            createElementVNode("div", null, [
              createElementVNode(
                "div",
                {
                  class: "svcName",
                  style: normalizeStyle({ color: serviceColor(selectedSpan.value.service || "unknown") })
                },
                toDisplayString(selectedSpan.value.service),
                5
                /* TEXT, STYLE */
              ),
              createElementVNode(
                "div",
                _hoisted_27$3,
                toDisplayString(selectedSpan.value.name),
                1
                /* TEXT */
              )
            ]),
            createElementVNode("button", {
              type: "button",
              "data-testid": "traces-detail-close",
              class: "close",
              onClick: _cache[2] || (_cache[2] = ($event) => selected.value = null)
            }, " × ")
          ]),
          createElementVNode("div", _hoisted_28$3, [
            createElementVNode(
              "span",
              null,
              toDisplayString(formatDur(selectedSpan.value.duration)),
              1
              /* TEXT */
            ),
            selectedSpan.value.status ? (openBlock(), createElementBlock(
              "span",
              _hoisted_29$3,
              toDisplayString(selectedSpan.value.status),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true)
          ]),
          createElementVNode("div", _hoisted_30$3, [
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ on: detailTab.value === "tags" }),
                "data-testid": "traces-tab-tags",
                onClick: _cache[3] || (_cache[3] = ($event) => detailTab.value = "tags")
              },
              " Tags ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ on: detailTab.value === "process" }),
                "data-testid": "traces-tab-process",
                onClick: _cache[4] || (_cache[4] = ($event) => detailTab.value = "process")
              },
              " Process ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ on: detailTab.value === "logs" }),
                "data-testid": "traces-tab-logs",
                onClick: _cache[5] || (_cache[5] = ($event) => detailTab.value = "logs")
              },
              " Logs" + toDisplayString(logEntries.value.length ? ` (${logEntries.value.length})` : ""),
              3
              /* TEXT, CLASS */
            )
          ]),
          detailTab.value === "tags" ? (openBlock(), createElementBlock("dl", _hoisted_31$3, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(selectedTags.value, ([k, v]) => {
                return openBlock(), createElementBlock(
                  Fragment,
                  { key: k },
                  [
                    createElementVNode(
                      "dt",
                      null,
                      toDisplayString(k),
                      1
                      /* TEXT */
                    ),
                    createElementVNode(
                      "dd",
                      null,
                      toDisplayString(v),
                      1
                      /* TEXT */
                    )
                  ],
                  64
                  /* STABLE_FRAGMENT */
                );
              }),
              128
              /* KEYED_FRAGMENT */
            )),
            !selectedTags.value.length ? (openBlock(), createElementBlock("div", _hoisted_32$3, "无标签")) : createCommentVNode("v-if", true)
          ])) : detailTab.value === "process" ? (openBlock(), createElementBlock("table", _hoisted_33$3, [
            createElementVNode("tbody", null, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(processEntries.value, ([k, v]) => {
                  return openBlock(), createElementBlock("tr", { key: k }, [
                    createElementVNode(
                      "th",
                      null,
                      toDisplayString(k),
                      1
                      /* TEXT */
                    ),
                    createElementVNode(
                      "td",
                      null,
                      toDisplayString(v),
                      1
                      /* TEXT */
                    )
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              !processEntries.value.length ? (openBlock(), createElementBlock("tr", _hoisted_34$3, [..._cache[8] || (_cache[8] = [
                createElementVNode(
                  "td",
                  {
                    colspan: "2",
                    class: "empty-cell"
                  },
                  "无进程标签",
                  -1
                  /* CACHED */
                )
              ])])) : createCommentVNode("v-if", true)
            ])
          ])) : (openBlock(), createElementBlock("div", _hoisted_35$2, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(logEntries.value, (lg, i) => {
                return openBlock(), createElementBlock("div", {
                  key: i,
                  class: "log-item",
                  "data-testid": "traces-log-item"
                }, [
                  createElementVNode(
                    "div",
                    _hoisted_36$1,
                    "+" + toDisplayString(formatDur(lg.timestamp)),
                    1
                    /* TEXT */
                  ),
                  createElementVNode("div", _hoisted_37$1, [
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(lg.fields, (v, k) => {
                        return openBlock(), createElementBlock(
                          "span",
                          {
                            key: k,
                            class: "lf"
                          },
                          toDisplayString(k) + "=" + toDisplayString(v),
                          1
                          /* TEXT */
                        );
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ])
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            )),
            !logEntries.value.length ? (openBlock(), createElementBlock("div", _hoisted_38$1, "无 Span 日志")) : createCommentVNode("v-if", true)
          ]))
        ])) : createCommentVNode("v-if", true)
      ], 40, _hoisted_2$1W));
    };
  }
});
const TracesRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$33, [["__scopeId", "data-v-162ab9a8"]]);
const _sfc_main$32 = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(TracesRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "traces",
    name: "链路追踪",
    description: "分布式追踪瀑布图",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$32
).setPanelOptions((builder) => {
  const cat = ["链路"];
  builder.addCustom({
    id: "filters",
    path: "filters",
    name: "过滤器",
    category: cat,
    editor: "text",
    description: "Span filters（Grafana 兼容 id）"
  }).addCustom({
    id: "spanFilters",
    path: "spanFilters",
    name: "过滤器对象",
    category: cat,
    editor: "text",
    description: "Span 过滤配置对象"
  }).addBoolean(
    {
      id: "spanFilters.matchesOnly",
      path: "spanFilters.matchesOnly",
      name: "仅显示匹配项",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "spanFilters.criticalPathOnly",
      path: "spanFilters.criticalPathOnly",
      name: "仅关键路径",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "showServiceName",
      path: "showServiceName",
      name: "显示服务名",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showDuration",
      path: "showDuration",
      name: "显示耗时",
      category: cat
    },
    true
  );
}).setRuntimeConsumedPaths([
  "filters",
  "spanFilters",
  "spanFilters.criticalPathOnly",
  "spanFilters.matchesOnly",
  "showServiceName",
  "showDuration"
]).register();
function normalizeFlameTree(node) {
  const kids = (node.children ?? []).map(normalizeFlameTree);
  const childSum = kids.reduce((a, b) => a + b.value, 0);
  const self = node.self ?? Math.max(0, node.value - childSum);
  const value = Math.max(node.value, childSum + self, 1);
  return {
    name: node.name,
    value,
    self,
    children: kids.length ? kids : void 0
  };
}
function checkFields(fields) {
  const list = fields ?? [];
  const required = [
    ["label", ["string", "enum"]],
    ["level", ["number"]],
    ["value", ["number"]],
    ["self", ["number"]]
  ];
  const missingFields = [];
  const wrongTypeFields = [];
  for (const [name, types] of required) {
    const frameField = list.find((f) => f.name === name);
    if (!frameField) {
      missingFields.push(name);
      continue;
    }
    const t2 = String(frameField.type || "other");
    if (!types.includes(t2)) {
      wrongTypeFields.push({ name, expectedTypes: types, type: t2 });
    }
  }
  if (missingFields.length || wrongTypeFields.length) {
    return { missingFields, wrongTypeFields };
  }
  return void 0;
}
function getMessageCheckFieldsResult(wrongFields) {
  if (wrongFields.missingFields.length) {
    return `数据缺少字段：${wrongFields.missingFields.join(", ")}`;
  }
  if (wrongFields.wrongTypeFields.length) {
    return `数据字段类型不正确：${wrongFields.wrongTypeFields.map((f) => `${f.name} 类型为 ${f.type}，应为 ${f.expectedTypes.join(" 或 ")}`).join("；")}`;
  }
  return "";
}
function fieldLabel(f) {
  return f.state?.displayName || f.config?.displayName || f.name || "";
}
function fieldMatches(f, re) {
  return re.test(f.name) || re.test(fieldLabel(f));
}
function framesToFlameRoot(fields) {
  if (!fields.length || !(fields[0]?.values?.length ?? 0)) {
    return null;
  }
  const by = (re) => fields.find((f) => fieldMatches(f, re));
  const n = fields[0].values.length;
  const stackF = by(/stack|stacktrace|callstack/i);
  if (stackF) {
    return normalizeFlameTree(stacksToTree(stackF.values.map(String), valueColumn(fields, n)));
  }
  const nameF = by(/name|label|function|symbol|location/i) ?? fields.find((f) => f.type === "string") ?? fields[0];
  const valueF = valueField(fields, nameF);
  const parentF = by(/parent|caller|parentName|parentId/i);
  const levelF = by(/level|depth/i);
  const selfF = by(/self|exclusive/i);
  if (parentF || levelF) {
    return normalizeFlameTree(
      hierarchyToTree(
        Array.from({ length: n }, (_, i) => ({
          name: String(nameF.values[i] ?? `fn-${i}`),
          value: Math.abs(Number(valueF?.values[i] ?? 1)),
          self: selfF ? Math.abs(Number(selfF.values[i] ?? 0)) : void 0,
          parent: parentF?.values[i] != null ? String(parentF.values[i]) : void 0,
          level: levelF ? Number(levelF.values[i] ?? 0) : void 0
        }))
      )
    );
  }
  const children = [];
  for (let i = 0; i < Math.min(n, 64); i++) {
    children.push({
      name: String(nameF.values[i] ?? `fn-${i}`),
      value: Math.abs(Number(valueF?.values[i] ?? 1)),
      self: selfF ? Math.abs(Number(selfF.values[i] ?? 0)) : void 0
    });
  }
  const total = children.reduce((a, b) => a + b.value, 0) || 1;
  return normalizeFlameTree({ name: "total", value: total, self: 0, children });
}
function valueField(fields, exclude) {
  return fields.find((f) => fieldMatches(f, /value|total|samples|count|weight/i) && f !== exclude) ?? fields.find((f) => f.type === "number" && f !== exclude);
}
function valueColumn(fields, n) {
  const vf = valueField(fields);
  return Array.from({ length: n }, (_, i) => Math.abs(Number(vf?.values[i] ?? 1)));
}
function stacksToTree(stacks, values) {
  const root = { name: "total", value: 0, self: 0, children: [] };
  for (const [i, stack] of stacks.entries()) {
    const parts = String(stack).split(/[;\n]+/).map((s) => s.trim()).filter(Boolean);
    const v = values[i] ?? 1;
    root.value += v;
    let cur = root;
    for (let d = 0; d < parts.length; d++) {
      const name = parts[d];
      if (!cur.children) cur.children = [];
      let next = cur.children.find((c) => c.name === name);
      if (!next) {
        next = { name, value: 0, self: 0, children: [] };
        cur.children.push(next);
      }
      next.value += v;
      if (d === parts.length - 1) {
        next.self = (next.self ?? 0) + v;
      }
      cur = next;
    }
  }
  if (!root.value) root.value = 1;
  return root;
}
function hierarchyToTree(rows) {
  if (rows.some((r) => r.parent != null && r.parent !== "")) {
    const byName = /* @__PURE__ */ new Map();
    for (const r of rows) {
      byName.set(r.name, {
        name: r.name,
        value: r.value,
        self: r.self,
        children: []
      });
    }
    const roots = [];
    for (const r of rows) {
      const node = byName.get(r.name);
      if (r.parent && byName.has(r.parent) && r.parent !== r.name) {
        const p = byName.get(r.parent);
        if (!p.children) p.children = [];
        p.children.push(node);
      } else {
        roots.push(node);
      }
    }
    if (roots.length === 1) return roots[0];
    const total = roots.reduce((a, b) => a + b.value, 0) || 1;
    return { name: "total", value: total, self: 0, children: roots };
  }
  const sorted = [...rows].sort((a, b) => (a.level ?? 0) - (b.level ?? 0));
  const root = { name: "total", value: 0, self: 0, children: [] };
  const stack = [root];
  for (const r of sorted) {
    const level = Math.max(0, Math.floor(r.level ?? 0));
    while (stack.length > level + 1) stack.pop();
    const parent = stack[stack.length - 1] ?? root;
    const node = {
      name: r.name,
      value: r.value,
      self: r.self ?? r.value,
      children: []
    };
    if (!parent.children) parent.children = [];
    parent.children.push(node);
    parent.value += r.value;
    stack.push(node);
  }
  if (!root.value) root.value = rows.reduce((a, r) => a + r.value, 0) || 1;
  return root;
}
function layoutFlame(root) {
  const out = [];
  function walk(node, depth, x, width2) {
    if (!out[depth]) out[depth] = [];
    const kids = node.children ?? [];
    const childSum = kids.reduce((a, b) => a + b.value, 0);
    const self = node.self ?? Math.max(0, node.value - childSum);
    out[depth].push({
      name: node.name,
      value: node.value,
      self,
      x,
      w: width2,
      depth,
      color: classicPalette()[depth % classicPalette().length]
    });
    if (!kids.length) return;
    const sum = kids.reduce((a, b) => a + b.value, 0) || 1;
    let cx = x;
    for (const k of kids) {
      const w = width2 * (k.value / sum);
      walk(k, depth + 1, cx, w);
      cx += w;
    }
  }
  walk(normalizeFlameTree(root), 0, 0, 100);
  return out;
}
function focusFlameNode(root, name) {
  function find(n) {
    if (n.name === name) return n;
    for (const c of n.children ?? []) {
      const hit = find(c);
      if (hit) return hit;
    }
    return null;
  }
  return normalizeFlameTree(find(root) ?? root);
}
const FULL_VIEWPORT = { start: 0, end: 100 };
const MIN_VISIBLE_PCT = 0.5;
const SCROLL_ZOOM_INTENSITY = 15e-4;
function clamp(value, min, max) {
  return Math.max(min, Math.min(max, value));
}
function clampViewport(view) {
  const span = clamp(view.end - view.start, MIN_VISIBLE_PCT, 100);
  const start = clamp(view.start, 0, 100 - span);
  return { start, end: start + span };
}
function zoomViewport(view, factor, anchorRatio) {
  const oldSpan = Math.max(view.end - view.start, MIN_VISIBLE_PCT);
  const nextSpan = clamp(oldSpan * factor, MIN_VISIBLE_PCT, 100);
  const anchorPct = view.start + clamp(anchorRatio, 0, 1) * oldSpan;
  const start = clamp(anchorPct - clamp(anchorRatio, 0, 1) * nextSpan, 0, 100 - nextSpan);
  return clampViewport({ start, end: start + nextSpan });
}
function panViewport(view, deltaPct) {
  const span = Math.max(view.end - view.start, MIN_VISIBLE_PCT);
  const start = clamp(view.start - deltaPct, 0, 100 - span);
  return { start, end: start + span };
}
function blockScreenRect(xPct, wPct, view, cssWidth) {
  const span = Math.max(view.end - view.start, MIN_VISIBLE_PCT);
  const start = xPct;
  const end = xPct + wPct;
  if (end < view.start || start > view.end) {
    return { x: 0, width: 0, visible: false };
  }
  const visibleStart = clamp(start, view.start, view.end);
  const visibleEnd = clamp(end, view.start, view.end);
  const x = (visibleStart - view.start) / span * cssWidth;
  const width2 = Math.max(1, (visibleEnd - visibleStart) / span * cssWidth);
  return { x, width: width2, visible: true };
}
const DEFAULT_ROW_HEIGHT = 22;
const MIN_SPAN_BAR_HEIGHT = 8;
const LABEL_FONT = "500 11px Inter, sans-serif";
const LABEL_PADDING_X = 6;
const MIN_WIDTH_FOR_NAME = 28;
const MIN_WIDTH_FOR_VALUE = 72;
const OVERSCAN_ROWS = 2;
function getRowMetrics(rowHeight) {
  const bar = Math.max(
    MIN_SPAN_BAR_HEIGHT,
    Math.min(DEFAULT_ROW_HEIGHT - 2, Math.round(rowHeight * 0.85))
  );
  return {
    ROW_HEIGHT: rowHeight,
    BAR_HEIGHT: bar,
    BAR_Y_OFFSET: Math.floor((rowHeight - bar) / 2)
  };
}
function darkenHex(hex, amount = 0.18) {
  if (!/^#[0-9a-f]{6}$/i.test(hex)) return hex;
  const r = Number.parseInt(hex.slice(1, 3), 16);
  const g = Number.parseInt(hex.slice(3, 5), 16);
  const b = Number.parseInt(hex.slice(5, 7), 16);
  const f = 1 - amount;
  const to = (n) => Math.max(0, Math.min(255, Math.round(n * f))).toString(16).padStart(2, "0");
  return `#${to(r)}${to(g)}${to(b)}`;
}
function roundedRectPath(ctx, x, y, width2, height2, radius) {
  const r = Math.min(radius, width2 / 2, height2 / 2);
  ctx.beginPath();
  ctx.moveTo(x + r, y);
  ctx.arcTo(x + width2, y, x + width2, y + height2, r);
  ctx.arcTo(x + width2, y + height2, x, y + height2, r);
  ctx.arcTo(x, y + height2, x, y, r);
  ctx.arcTo(x, y, x + width2, y, r);
  ctx.closePath();
}
function truncateText(ctx, text, maxWidth) {
  const ellipsis = "…";
  if (ctx.measureText(text).width <= maxWidth) return text;
  const ellipsisWidth = ctx.measureText(ellipsis).width;
  let lo = 0;
  let hi = text.length;
  while (lo < hi) {
    const mid = Math.ceil((lo + hi) / 2);
    if (ctx.measureText(text.slice(0, mid)).width + ellipsisWidth <= maxWidth) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  return lo > 0 ? `${text.slice(0, lo)}${ellipsis}` : ellipsis;
}
function updateCanvasSize(canvas, width2, height2) {
  if (!canvas) return;
  const safeW = Math.max(width2, 1);
  const safeH = Math.max(height2, 1);
  const dpr = Math.min(typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1, 2);
  const nextW = Math.round(safeW * dpr);
  const nextH = Math.round(safeH * dpr);
  if (canvas.width !== nextW) canvas.width = nextW;
  if (canvas.height !== nextH) canvas.height = nextH;
  canvas.style.width = `${safeW}px`;
  canvas.style.height = `${safeH}px`;
}
function getCanvasCssSize(canvas) {
  const dpr = Math.min(typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1, 2);
  return {
    dpr,
    cssWidth: Math.max(canvas.width / dpr, 1),
    cssHeight: Math.max(canvas.height / dpr, 1)
  };
}
function drawFlamegraph(args) {
  const {
    ctx,
    levels,
    view,
    scrollTop,
    cssWidth,
    cssHeight,
    rowHeight,
    search,
    focusName,
    hoveredName,
    sandwich,
    showDiffLabels,
    hitRects
  } = args;
  hitRects.length = 0;
  const metrics = getRowMetrics(rowHeight);
  const totalRows = levels.length;
  const first = Math.max(0, Math.floor(scrollTop / rowHeight) - OVERSCAN_ROWS);
  const last = Math.min(totalRows, Math.ceil((scrollTop + cssHeight) / rowHeight) + OVERSCAN_ROWS);
  const q = search.trim().toLowerCase();
  let drawn = 0;
  for (let depth = first; depth < last; depth++) {
    const rowY = depth * rowHeight - scrollTop;
    for (const block of levels[depth] ?? []) {
      const rect = blockScreenRect(block.x, block.w, view, cssWidth);
      if (!rect.visible) continue;
      const barY = rowY + metrics.BAR_Y_OFFSET;
      const isFocus = focusName === block.name;
      const isHover = hoveredName === block.name;
      const match = !q || block.name.toLowerCase().includes(q);
      const dim = q && !match && !isFocus && !isHover;
      const color = block.color || classicBlue();
      const colorDark = darkenHex(color, 0.16);
      if (dim) ctx.globalAlpha = 0.15;
      roundedRectPath(ctx, rect.x, barY, rect.width, metrics.BAR_HEIGHT, 2);
      if (isFocus || isHover) {
        ctx.fillStyle = resolveThemeModeHint() === "light" ? "rgba(255, 255, 255, 0.92)" : "rgba(34, 37, 43, 0.92)";
        ctx.fill();
        if (isFocus) ctx.setLineDash([4, 2]);
        ctx.strokeStyle = colorDark;
        ctx.lineWidth = isFocus ? 2 : 1;
        ctx.stroke();
        if (isFocus) ctx.setLineDash([]);
      } else {
        ctx.fillStyle = color;
        ctx.fill();
        ctx.strokeStyle = sandwich ? colorDark : "rgba(0, 0, 0, 0.28)";
        ctx.lineWidth = 1;
        if (sandwich) ctx.setLineDash([3, 2]);
        ctx.stroke();
        if (sandwich) ctx.setLineDash([]);
      }
      hitRects.push({
        block,
        x: rect.x,
        y: barY,
        width: rect.width,
        height: metrics.BAR_HEIGHT
      });
      drawn++;
      if (rect.width >= MIN_WIDTH_FOR_NAME) {
        ctx.save();
        ctx.beginPath();
        ctx.rect(rect.x, barY, rect.width, metrics.BAR_HEIGHT);
        ctx.clip();
        ctx.font = LABEL_FONT;
        ctx.textBaseline = "middle";
        ctx.fillStyle = isFocus || isHover ? colorDark : resolveThemeModeHint() === "light" ? "rgba(36, 41, 46, 0.95)" : "rgba(255, 255, 255, 0.95)";
        const textY = barY + metrics.BAR_HEIGHT / 2;
        const leftX = rect.x + LABEL_PADDING_X;
        const available = rect.width - LABEL_PADDING_X * 2;
        const label = showDiffLabels ? `${block.name} Δ` : block.name;
        if (rect.width >= MIN_WIDTH_FOR_VALUE) {
          const valueText = String(block.value);
          const vw = ctx.measureText(valueText).width;
          const nameSpace = available - vw - 6;
          ctx.textAlign = "right";
          ctx.fillText(valueText, rect.x + rect.width - LABEL_PADDING_X, textY);
          if (nameSpace > 16) {
            ctx.textAlign = "left";
            ctx.fillText(truncateText(ctx, label, nameSpace), leftX, textY);
          }
        } else {
          ctx.textAlign = "left";
          ctx.fillText(truncateText(ctx, label, available), leftX, textY);
        }
        ctx.restore();
      }
      if (dim) ctx.globalAlpha = 1;
    }
  }
  return drawn;
}
function hitFlameBlock(hitRects, x, y) {
  for (let i = hitRects.length - 1; i >= 0; i--) {
    const r = hitRects[i];
    if (x >= r.x && x <= r.x + r.width && y >= r.y && y <= r.y + r.height) {
      return r;
    }
  }
  return null;
}
const _hoisted_1$2p = ["data-show-table", "data-collapsing", "data-sticky-header", "data-show-diff", "data-focus", "data-level-count", "data-block-count", "data-sandwich", "data-show-extra", "data-search"];
const _hoisted_2$1V = {
  key: 0,
  class: "empty",
  "data-testid": "flame-empty"
};
const _hoisted_3$1H = {
  class: "sr-blocks",
  "aria-hidden": "true"
};
const _hoisted_4$1p = ["data-match", "aria-label", "onClick"];
const _hoisted_5$1d = { class: "tooltip__title" };
const _hoisted_6$13 = { class: "tooltip__row" };
const _hoisted_7$Y = {
  key: 0,
  class: "tooltip__row",
  "data-testid": "flame-tip-self"
};
const _hoisted_8$Q = { class: "tooltip__row" };
const _hoisted_9$N = { class: "is-accent" };
const _hoisted_10$E = {
  key: 2,
  class: "table",
  "data-testid": "flame-table"
};
const _hoisted_11$A = { key: 0 };
const _hoisted_12$u = ["onClick"];
const _hoisted_13$t = {
  key: 0,
  "data-testid": "flame-table-self"
};
const _sfc_main$31 = /* @__PURE__ */ defineComponent({
  __name: "FlamegraphRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const focusName = ref(null);
    const search = ref("");
    const hoveredName = ref(null);
    const view = ref({ ...FULL_VIEWPORT });
    const scrollTop = ref(0);
    const rowHeight = ref(DEFAULT_ROW_HEIGHT);
    const cursorXPercent = ref(null);
    const tip = ref(null);
    const blockCount = ref(0);
    const wrapRef = ref(null);
    const canvasRef = ref(null);
    const overlayRef = ref(null);
    const hitRects = [];
    let ro = null;
    let dragging = false;
    let dragMoved = false;
    let suppressClick = false;
    let dragStartX = 0;
    let dragStartY = 0;
    let dragStartView = { ...FULL_VIEWPORT };
    let dragStartScroll = 0;
    const flameFrame = computed(() => {
      const series = props.data?.series ?? [];
      for (const frame of series) {
        if (!checkFields(frame?.fields)) return frame;
      }
      for (const frame of series) {
        if (framesToFlameRoot(frame?.fields ?? [])) return frame;
      }
      return series[0];
    });
    const fieldError = computed(() => {
      const frame = flameFrame.value;
      if (!frame) return "";
      if (framesToFlameRoot(frame?.fields ?? [])) return "";
      const wrong = checkFields(frame?.fields);
      return wrong ? getMessageCheckFieldsResult(wrong) : "";
    });
    const root = computed(() => {
      if (fieldError.value) return null;
      const frame = flameFrame.value;
      const tree = framesToFlameRoot(frame?.fields ?? []);
      if (!tree) return null;
      return focusName.value ? focusFlameNode(tree, focusName.value) : tree;
    });
    const sandwich = computed(() => Boolean(opts.value.sandwich ?? opts.value.view === "sandwich"));
    const showExtra = computed(() => Boolean(opts.value.showExtra));
    const levels = computed(() => root.value ? layoutFlame(root.value) : []);
    const flatBlocks = computed(() => levels.value.flat());
    const showTable = computed(() => opts.value.showTable !== false && opts.value.getTable !== false);
    const collapsible = computed(() => opts.value.collapsing !== false);
    const stickyHeader = computed(() => opts.value.stickyHeader !== false);
    const showDiffLabels = computed(() => Boolean(opts.value.showDiffLabels));
    const totalHeight = computed(() => levels.value.length * rowHeight.value);
    const tableRows = computed(() => {
      if (!showTable.value || !root.value)
        return [];
      const rows = [];
      function walk(n) {
        rows.push({ name: n.name, total: n.value, self: n.self ?? 0 });
        for (const c of n.children ?? []) walk(c);
      }
      walk(root.value);
      return rows.sort((a, b) => b.total - a.total);
    });
    function onBlockClick(name) {
      if (!collapsible.value) return;
      focusName.value = focusName.value === name ? null : name;
      view.value = { ...FULL_VIEWPORT };
      scrollTop.value = 0;
    }
    function resetFocus() {
      focusName.value = null;
      view.value = { ...FULL_VIEWPORT };
      scrollTop.value = 0;
    }
    function sizeCanvases() {
      const el = wrapRef.value;
      if (!el) return;
      updateCanvasSize(canvasRef.value, el.clientWidth, el.clientHeight);
      updateCanvasSize(overlayRef.value, el.clientWidth, el.clientHeight);
    }
    function clearCanvas(canvas) {
      const ctx = canvas?.getContext("2d");
      if (!ctx || !canvas) return;
      ctx.setTransform(1, 0, 0, 1, 0, 0);
      ctx.clearRect(0, 0, canvas.width, canvas.height);
    }
    function drawMain() {
      const canvas = canvasRef.value;
      const wrap = wrapRef.value;
      if (!canvas || !wrap || !levels.value.length) {
        clearCanvas(canvas);
        blockCount.value = 0;
        return;
      }
      const ctx = canvas.getContext("2d");
      if (!ctx) return;
      sizeCanvases();
      const { dpr, cssWidth, cssHeight } = getCanvasCssSize(canvas);
      ctx.setTransform(1, 0, 0, 1, 0, 0);
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
      const maxScroll = Math.max(0, totalHeight.value - cssHeight);
      if (scrollTop.value > maxScroll) scrollTop.value = maxScroll;
      blockCount.value = drawFlamegraph({
        ctx,
        levels: levels.value,
        view: view.value,
        scrollTop: scrollTop.value,
        cssWidth,
        cssHeight,
        rowHeight: rowHeight.value,
        search: search.value,
        focusName: focusName.value,
        hoveredName: hoveredName.value,
        sandwich: sandwich.value,
        showDiffLabels: showDiffLabels.value,
        hitRects
      });
    }
    function drawOverlay() {
      const canvas = overlayRef.value;
      if (!canvas) return;
      const ctx = canvas.getContext("2d");
      if (!ctx) return;
      const { dpr, cssWidth, cssHeight } = getCanvasCssSize(canvas);
      ctx.setTransform(1, 0, 0, 1, 0, 0);
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      if (cursorXPercent.value == null) return;
      const x = clamp(cursorXPercent.value, 0, 1) * cssWidth;
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
      ctx.beginPath();
      ctx.strokeStyle = "rgba(22, 100, 255, 0.22)";
      ctx.lineWidth = 1;
      ctx.moveTo(x, 0);
      ctx.lineTo(x, cssHeight);
      ctx.stroke();
    }
    let redrawRaf = null;
    let resizeRaf = null;
    function redrawNow() {
      drawMain();
      drawOverlay();
    }
    function redraw() {
      if (redrawRaf != null) return;
      if (typeof requestAnimationFrame === "function") {
        redrawRaf = requestAnimationFrame(() => {
          redrawRaf = null;
          redrawNow();
        });
      } else {
        redrawNow();
      }
    }
    function setupRO() {
      ro?.disconnect();
      if (typeof ResizeObserver === "undefined") return;
      ro = new ResizeObserver(() => {
        if (resizeRaf != null) return;
        const run = () => {
          resizeRaf = null;
          sizeCanvases();
          redrawNow();
        };
        if (typeof requestAnimationFrame === "function") {
          resizeRaf = requestAnimationFrame(run);
        } else {
          run();
        }
      });
      if (wrapRef.value) ro.observe(wrapRef.value);
    }
    function pointer(event) {
      const canvas = canvasRef.value;
      if (!canvas) return null;
      const rect = canvas.getBoundingClientRect();
      if (!rect.width || !rect.height) return null;
      const { cssWidth, cssHeight } = getCanvasCssSize(canvas);
      return {
        x: (event.clientX - rect.left) * (cssWidth / rect.width),
        y: (event.clientY - rect.top) * (cssHeight / rect.height),
        cssWidth
      };
    }
    function makeTip(block, x, y) {
      const total = root.value?.value || 1;
      const pct = (block.value / total * 100).toFixed(1);
      const wrap = wrapRef.value;
      const w = wrap?.clientWidth ?? 320;
      const h2 = wrap?.clientHeight ?? 200;
      return {
        cx: clamp(x + 12, 8, Math.max(8, w - 200)),
        cy: clamp(y + 12, 8, Math.max(8, h2 - 100)),
        name: block.name,
        total: block.value,
        self: block.self,
        pct: `${pct}%`
      };
    }
    function onMouseMove(event) {
      if (dragging) return;
      const p = pointer(event);
      if (!p) return;
      cursorXPercent.value = clamp(p.x / Math.max(p.cssWidth, 1), 0, 1);
      const hit = hitFlameBlock(hitRects, p.x, p.y);
      if (hit) {
        hoveredName.value = hit.block.name;
        tip.value = makeTip(hit.block, p.x, p.y);
        if (canvasRef.value) canvasRef.value.style.cursor = "pointer";
      } else {
        hoveredName.value = null;
        tip.value = null;
        if (canvasRef.value) canvasRef.value.style.cursor = "grab";
      }
      redraw();
    }
    function onLeave() {
      cursorXPercent.value = null;
      hoveredName.value = null;
      tip.value = null;
      if (canvasRef.value && !dragging) canvasRef.value.style.cursor = "grab";
      redraw();
    }
    function detachDrag() {
      document.removeEventListener("mousemove", onDocMove);
      document.removeEventListener("mouseup", onDocUp);
    }
    function onMouseDown(event) {
      if (event.button !== 0 || !canvasRef.value || !wrapRef.value) return;
      dragging = true;
      dragMoved = false;
      suppressClick = false;
      dragStartX = event.clientX;
      dragStartY = event.clientY;
      dragStartView = { ...view.value };
      dragStartScroll = scrollTop.value;
      canvasRef.value.style.cursor = "grabbing";
      document.addEventListener("mousemove", onDocMove);
      document.addEventListener("mouseup", onDocUp);
    }
    function onDocMove(event) {
      if (!dragging || !canvasRef.value || !wrapRef.value) return;
      const dx = event.clientX - dragStartX;
      const dy = event.clientY - dragStartY;
      dragMoved = Math.hypot(dx, dy) > 3;
      const span = Math.max(dragStartView.end - dragStartView.start, MIN_VISIBLE_PCT);
      const cssWidth = Math.max(canvasRef.value.clientWidth, 1);
      const deltaPct = dx / cssWidth * span;
      view.value = panViewport(dragStartView, deltaPct);
      const maxScroll = Math.max(0, totalHeight.value - wrapRef.value.clientHeight);
      scrollTop.value = clamp(dragStartScroll - dy, 0, maxScroll);
      redraw();
    }
    function onDocUp() {
      dragging = false;
      suppressClick = dragMoved;
      dragMoved = false;
      if (canvasRef.value) canvasRef.value.style.cursor = "grab";
      detachDrag();
    }
    function onClick(event) {
      if (suppressClick) {
        suppressClick = false;
        return;
      }
      const p = pointer(event);
      if (!p) return;
      const hit = hitFlameBlock(hitRects, p.x, p.y);
      if (hit) onBlockClick(hit.block.name);
    }
    function onWheel(event) {
      const p = pointer(event);
      if (!p) return;
      const factor = Math.exp(event.deltaY * SCROLL_ZOOM_INTENSITY);
      const ratio = clamp(p.x / Math.max(p.cssWidth, 1), 0, 1);
      view.value = zoomViewport(view.value, factor, ratio);
      redraw();
    }
    watch(
      () => props.data?.series,
      () => {
        focusName.value = null;
        view.value = { ...FULL_VIEWPORT };
        scrollTop.value = 0;
      }
    );
    watch(
      [levels, search, focusName, hoveredName, sandwich, showDiffLabels, view, scrollTop, rowHeight],
      () => nextTick(redraw),
      { deep: true }
    );
    watch(
      () => [props.width, props.height],
      () => nextTick(() => {
        sizeCanvases();
        redraw();
      })
    );
    onMounted(() => {
      nextTick(() => {
        setupRO();
        sizeCanvases();
        redraw();
      });
    });
    onUnmounted(() => {
      if (redrawRaf != null && typeof cancelAnimationFrame === "function") {
        cancelAnimationFrame(redrawRaf);
        redrawRaf = null;
      }
      if (resizeRaf != null && typeof cancelAnimationFrame === "function") {
        cancelAnimationFrame(resizeRaf);
        resizeRaf = null;
      }
      ro?.disconnect();
      detachDrag();
    });
    return (_ctx, _cache) => {
      return fieldError.value ? (openBlock(), createBlock(PanelDataErrorView, {
        key: 0,
        data: __props.data,
        "field-config": __props.fieldConfig,
        message: fieldError.value
      }, null, 8, ["data", "field-config", "message"])) : (openBlock(), createElementBlock("div", {
        key: 1,
        class: "flame",
        "data-testid": "panel-flamegraph",
        role: "group",
        "aria-label": "火焰图",
        "data-show-table": String(showTable.value),
        "data-collapsing": String(collapsible.value),
        "data-sticky-header": String(stickyHeader.value),
        "data-show-diff": String(showDiffLabels.value),
        "data-focus": String(focusName.value || ""),
        "data-level-count": String(levels.value.length),
        "data-block-count": String(blockCount.value || flatBlocks.value.length),
        "data-sandwich": String(sandwich.value),
        "data-show-extra": String(showExtra.value),
        "data-search": search.value
      }, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["toolbar", { "is-sticky": stickyHeader.value }]),
            "data-testid": "flame-toolbar"
          },
          [
            focusName.value ? (openBlock(), createElementBlock(
              "button",
              {
                key: 0,
                type: "button",
                class: "reset",
                "data-testid": "flame-reset",
                onClick: resetFocus
              },
              " 重置缩放（" + toDisplayString(focusName.value) + "） ",
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true),
            withDirectives(createElementVNode(
              "input",
              {
                "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => search.value = $event),
                type: "search",
                class: "search",
                "data-testid": "flame-search",
                placeholder: "搜索函数…",
                "aria-label": "搜索火焰图"
              },
              null,
              512
              /* NEED_PATCH */
            ), [
              [vModelText, search.value]
            ])
          ],
          2
          /* CLASS */
        ),
        !levels.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1V, "暂无火焰图数据")) : (openBlock(), createElementBlock(
          "div",
          {
            key: 1,
            ref_key: "wrapRef",
            ref: wrapRef,
            class: "graph",
            "data-testid": "flame-graph"
          },
          [
            createCommentVNode(" Stable test hooks mirroring former DOM blocks "),
            createElementVNode("div", _hoisted_3$1H, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(flatBlocks.value, (b, i) => {
                  return openBlock(), createElementBlock("button", {
                    key: `${b.depth}-${b.name}-${i}`,
                    type: "button",
                    class: "sr-block",
                    "data-testid": "flame-block",
                    "data-match": search.value ? String(b.name.toLowerCase().includes(search.value.toLowerCase().trim())) : "true",
                    "aria-label": `${b.name} ${b.value}`,
                    onClick: ($event) => onBlockClick(b.name)
                  }, null, 8, _hoisted_4$1p);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            createElementVNode(
              "canvas",
              {
                ref_key: "canvasRef",
                ref: canvasRef,
                class: "canvas",
                onMousemove: onMouseMove,
                onMouseleave: onLeave,
                onMousedown: onMouseDown,
                onClick,
                onWheel: withModifiers(onWheel, ["prevent"])
              },
              null,
              544
              /* NEED_HYDRATION, NEED_PATCH */
            ),
            createElementVNode(
              "canvas",
              {
                ref_key: "overlayRef",
                ref: overlayRef,
                class: "overlay"
              },
              null,
              512
              /* NEED_PATCH */
            ),
            tip.value ? (openBlock(), createElementBlock(
              "div",
              {
                key: 0,
                class: "tooltip",
                "data-testid": "flame-tooltip",
                style: normalizeStyle({ left: `${tip.value.cx}px`, top: `${tip.value.cy}px` })
              },
              [
                createElementVNode(
                  "div",
                  _hoisted_5$1d,
                  toDisplayString(tip.value.name),
                  1
                  /* TEXT */
                ),
                createElementVNode("div", _hoisted_6$13, [
                  _cache[1] || (_cache[1] = createElementVNode(
                    "span",
                    null,
                    "总计",
                    -1
                    /* CACHED */
                  )),
                  createElementVNode(
                    "strong",
                    null,
                    toDisplayString(tip.value.total),
                    1
                    /* TEXT */
                  )
                ]),
                showExtra.value ? (openBlock(), createElementBlock("div", _hoisted_7$Y, [
                  _cache[2] || (_cache[2] = createElementVNode(
                    "span",
                    null,
                    "自身",
                    -1
                    /* CACHED */
                  )),
                  createElementVNode(
                    "strong",
                    null,
                    toDisplayString(tip.value.self),
                    1
                    /* TEXT */
                  )
                ])) : createCommentVNode("v-if", true),
                createElementVNode("div", _hoisted_8$Q, [
                  _cache[3] || (_cache[3] = createElementVNode(
                    "span",
                    null,
                    "占比",
                    -1
                    /* CACHED */
                  )),
                  createElementVNode(
                    "strong",
                    _hoisted_9$N,
                    toDisplayString(tip.value.pct),
                    1
                    /* TEXT */
                  )
                ])
              ],
              4
              /* STYLE */
            )) : createCommentVNode("v-if", true)
          ],
          512
          /* NEED_PATCH */
        )),
        showTable.value && tableRows.value.length ? (openBlock(), createElementBlock("table", _hoisted_10$E, [
          createElementVNode("thead", null, [
            createElementVNode("tr", null, [
              _cache[4] || (_cache[4] = createElementVNode(
                "th",
                null,
                "符号",
                -1
                /* CACHED */
              )),
              _cache[5] || (_cache[5] = createElementVNode(
                "th",
                null,
                "总计",
                -1
                /* CACHED */
              )),
              showExtra.value ? (openBlock(), createElementBlock("th", _hoisted_11$A, "自身")) : createCommentVNode("v-if", true)
            ])
          ]),
          createElementVNode("tbody", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(tableRows.value, (r) => {
                return openBlock(), createElementBlock("tr", {
                  key: r.name,
                  "data-testid": "flame-table-row",
                  onClick: ($event) => onBlockClick(r.name)
                }, [
                  createElementVNode(
                    "td",
                    null,
                    toDisplayString(r.name),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "td",
                    null,
                    toDisplayString(r.total),
                    1
                    /* TEXT */
                  ),
                  showExtra.value ? (openBlock(), createElementBlock(
                    "td",
                    _hoisted_13$t,
                    toDisplayString(r.self),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ], 8, _hoisted_12$u);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2p));
    };
  }
});
const FlamegraphRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$31, [["__scopeId", "data-v-18aeac92"]]);
const _sfc_main$30 = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(FlamegraphRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "flamegraph",
    name: "火焰图",
    description: "CPU / 内存分析火焰图",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$30
).setPanelOptions((builder) => {
  const cat = ["火焰图"];
  builder.addBoolean(
    {
      id: "showTable",
      path: "showTable",
      name: "显示表格",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "collapsing",
      path: "collapsing",
      name: "允许折叠/缩放",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "stickyHeader",
      path: "stickyHeader",
      name: "固定顶栏",
      category: cat
    },
    true
  ).addBoolean(
    {
      id: "showDiffLabels",
      path: "showDiffLabels",
      name: "显示差异标签",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "sandwich",
      path: "sandwich",
      name: "三明治视图",
      category: cat
    },
    false
  ).addBoolean(
    {
      id: "showExtra",
      path: "showExtra",
      name: "显示附加信息",
      category: cat
    },
    false
  );
}).setRuntimeConsumedPaths([
  "showTable",
  "collapsing",
  "stickyHeader",
  "showDiffLabels",
  "sandwich",
  "showExtra"
]).register();
const _hoisted_1$2o = ["data-channel", "data-display", "data-paused", "data-line-count", "data-auto-scroll", "data-scrolled-to-bottom", "data-message-size-limit", "data-publish", "data-publish-visible"];
const _hoisted_2$1U = ["data-publish-mode"];
const _hoisted_3$1G = { class: "publish__label" };
const _hoisted_4$1o = ["placeholder"];
const _hoisted_5$1c = {
  key: 1,
  class: "live-alert-wrap",
  role: "status",
  "aria-label": "Grafana Live"
};
const _hoisted_6$12 = {
  class: "live-alert",
  "data-testid": "data-testid Alert info"
};
const _hoisted_7$X = { class: "live-alert__icon" };
const _hoisted_8$P = {
  class: "waiting",
  "data-testid": "live-waiting"
};
const _hoisted_9$M = { class: "waiting__channel" };
const _hoisted_10$D = ["data-auto-scroll", "data-scrolled-to-bottom"];
const _hoisted_11$z = ["data-truncated"];
const _sfc_main$2$ = /* @__PURE__ */ defineComponent({
  __name: "LiveRenderer",
  props: {
    data: {},
    options: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const channelParts = computed(() => {
      const ch = opts.value.channel;
      if (ch && typeof ch === "object") {
        const scope = String(ch.scope ?? "").trim();
        const stream = String(ch.stream ?? ch.namespace ?? "").trim();
        const path = String(ch.path ?? "").trim();
        const valid = Boolean(scope && stream);
        return {
          scope,
          stream,
          path,
          label: [scope, stream, path].filter(Boolean).join("/") || "—",
          valid
        };
      }
      const s = String(ch || "").trim();
      if (!s) return { scope: "", stream: "", path: "", label: "—", valid: false };
      const bits = s.split("/").filter(Boolean);
      return {
        scope: bits[0] || "",
        stream: bits[1] || "",
        path: bits.slice(2).join("/") || "",
        label: s,
        valid: bits.length >= 2
      };
    });
    const display = computed(() => String(opts.value.display ?? opts.value.message ?? "json"));
    const publishMode = computed(() => String(opts.value.publish ?? "none").toLowerCase());
    const showPublish = computed(() => publishMode.value === "json" || publishMode.value === "influx");
    const publishDraft = ref("");
    function onPublish() {
      if (!showPublish.value || !hasChannel.value) return;
      publishDraft.value = "";
    }
    const messageSizeLimit = computed(() => {
      const n = Number(opts.value.messageSizeLimit ?? 0);
      return Number.isFinite(n) && n > 0 ? Math.floor(n) : 0;
    });
    const autoScroll = computed(() => opts.value.autoScroll !== false);
    function truncateMessage(raw) {
      const limit = messageSizeLimit.value;
      if (!limit || raw.length <= limit) return raw;
      return `${raw.slice(0, limit)}…`;
    }
    function formatMessage(raw) {
      const mode2 = display.value.toLowerCase();
      if (mode2 === "none") return "";
      if (mode2 === "json") {
        try {
          const parsed = JSON.parse(raw);
          return truncateMessage(JSON.stringify(parsed, null, 2));
        } catch {
          return truncateMessage(raw);
        }
      }
      return truncateMessage(raw);
    }
    const messages = computed(() => {
      if (display.value.toLowerCase() === "none") return [];
      const frame = props.data?.series?.[0];
      if (!frame?.fields?.length) return [];
      const strField = frame.fields.find((f) => f.type === "string");
      if (!strField) return [];
      const n = Math.min(frame.length ?? strField.values.length, 200);
      const out = [];
      for (let i = 0; i < n; i++) {
        const v = strField.values[i];
        if (v != null && String(v).length) out.push(formatMessage(String(v)));
      }
      return out;
    });
    const hasMessage = computed(() => messages.value.length > 0);
    const hasChannel = computed(() => channelParts.value.valid);
    const paused = ref(false);
    const streamEl = ref(null);
    const scrolledToBottom = ref(false);
    watch(
      () => [messages.value.length, autoScroll.value, messages.value[messages.value.length - 1]],
      async () => {
        if (!autoScroll.value || paused.value) {
          scrolledToBottom.value = false;
          return;
        }
        await nextTick();
        const el = streamEl.value;
        if (!el) {
          await nextTick();
        }
        const target = streamEl.value;
        if (!target) return;
        target.scrollTop = target.scrollHeight;
        scrolledToBottom.value = true;
      },
      { immediate: true, flush: "post" }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "live",
        "data-testid": "panel-live",
        "data-channel": channelParts.value.label,
        "data-display": display.value,
        "data-paused": String(paused.value),
        "data-line-count": String(messages.value.length),
        "data-auto-scroll": String(autoScroll.value),
        "data-scrolled-to-bottom": String(scrolledToBottom.value),
        "data-message-size-limit": String(messageSizeLimit.value),
        "data-publish": publishMode.value,
        "data-publish-visible": String(showPublish.value)
      }, [
        showPublish.value && hasChannel.value ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: "publish",
          "data-testid": "live-publish",
          "data-publish-mode": publishMode.value
        }, [
          createElementVNode(
            "div",
            _hoisted_3$1G,
            toDisplayString(publishMode.value === "influx" ? "Influx 发布" : "JSON 发布"),
            1
            /* TEXT */
          ),
          withDirectives(createElementVNode("textarea", {
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => publishDraft.value = $event),
            class: "publish__input",
            "data-testid": "live-publish-input",
            rows: "3",
            placeholder: publishMode.value === "influx" ? "measurement,tag=value field=1" : "{ }"
          }, null, 8, _hoisted_4$1o), [
            [vModelText, publishDraft.value]
          ]),
          createElementVNode("button", {
            type: "button",
            class: "publish__btn",
            "data-testid": "live-publish-btn",
            onClick: onPublish
          }, " 发布 ")
        ], 8, _hoisted_2$1U)) : createCommentVNode("v-if", true),
        createCommentVNode(" Grafana LivePanel: !addr → Alert severity=info "),
        !hasChannel.value ? (openBlock(), createElementBlock("div", _hoisted_5$1c, [
          createElementVNode("div", _hoisted_6$12, [
            createElementVNode("div", _hoisted_7$X, [
              createVNode(unref(GIcon), {
                name: "info-circle",
                size: 24,
                color: "var(--grafana-primary)"
              })
            ]),
            _cache[1] || (_cache[1] = createElementVNode(
              "div",
              { class: "live-alert__body" },
              [
                createElementVNode("div", { class: "live-alert__title" }, "Grafana Live"),
                createElementVNode("div", { class: "live-alert__content" }, "使用面板编辑器选择频道")
              ],
              -1
              /* CACHED */
            ))
          ])
        ])) : !hasMessage.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 2 },
          [
            createCommentVNode(" Grafana LivePanel.renderMessage empty branch (zh-Hans) "),
            createElementVNode("div", _hoisted_8$P, [
              _cache[2] || (_cache[2] = createElementVNode(
                "h4",
                { class: "waiting__title" },
                "正在等待数据：",
                -1
                /* CACHED */
              )),
              createElementVNode(
                "div",
                _hoisted_9$M,
                toDisplayString(channelParts.value.label),
                1
                /* TEXT */
              )
            ])
          ],
          2112
          /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
        )) : (openBlock(), createElementBlock("div", {
          key: 3,
          ref_key: "streamEl",
          ref: streamEl,
          class: "stream",
          "data-testid": "live-stream",
          "data-auto-scroll": String(autoScroll.value),
          "data-scrolled-to-bottom": String(scrolledToBottom.value)
        }, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(messages.value, (l, i) => {
              return openBlock(), createElementBlock("div", {
                key: i,
                class: "line",
                "data-testid": "live-line",
                "data-truncated": messageSizeLimit.value > 0 && l.endsWith("…") ? "true" : "false"
              }, toDisplayString(l), 9, _hoisted_11$z);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 8, _hoisted_10$D))
      ], 8, _hoisted_1$2o);
    };
  }
});
const LiveRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$2$, [["__scopeId", "data-v-dde81845"]]);
const _sfc_main$2_ = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(LiveRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "live",
    name: "实时",
    description: "Grafana Live 频道",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$2_
).setPanelOptions((builder) => {
  const category = ["实时"];
  builder.addText(
    {
      id: "channel",
      path: "channel",
      name: "频道",
      description: "如 grafana/dashboard/uid/panel-1",
      category
    },
    ""
  ).addRadio(
    {
      id: "display",
      path: "display",
      name: "消息显示",
      category,
      settings: {
        options: [
          { label: "JSON", value: "json" },
          { label: "原始", value: "raw" },
          { label: "自动", value: "auto" },
          { label: "不显示", value: "none" }
        ]
      }
    },
    "json"
  ).addRadio(
    {
      id: "publish",
      path: "publish",
      name: "发布",
      category,
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "JSON", value: "json" },
          { label: "Influx", value: "influx" }
        ]
      }
    },
    "none"
  ).addNumber(
    {
      id: "messageSizeLimit",
      path: "messageSizeLimit",
      name: "消息大小限制",
      category,
      description: "单条消息最大字节（0=不限制）"
    },
    0
  ).addBoolean(
    {
      id: "autoScroll",
      path: "autoScroll",
      name: "自动滚动",
      category
    },
    true
  );
}).setRuntimeConsumedPaths(["channel", "display", "publish", "messageSizeLimit", "autoScroll"]).register();
const _hoisted_1$2n = ["data-mode", "data-state-view", "data-instance-name", "data-counter-render", "data-counter-data", "data-counter-schema", "data-elapsed", "data-dashboard-uid"];
const _hoisted_2$1T = {
  key: 0,
  class: "state-view",
  "data-testid": "debug-state-view"
};
const _hoisted_3$1F = { class: "state-field" };
const _hoisted_4$1n = {
  class: "state-current",
  "data-testid": "debug-state-current"
};
const _hoisted_5$1b = {
  key: 0,
  class: "state-view-meta"
};
const _hoisted_6$11 = {
  class: "events-view",
  "data-testid": "debug-events"
};
const _hoisted_7$W = {
  class: "toolbar",
  "data-testid": "debug-counters"
};
const _hoisted_8$O = { class: "counts" };
const _hoisted_9$L = {
  class: "event-list",
  "data-testid": "debug-payload"
};
const _hoisted_10$C = { class: "event-type" };
const _hoisted_11$y = { class: "event-detail" };
const _hoisted_12$t = {
  key: 0,
  class: "event-empty"
};
const _hoisted_13$s = {
  class: "cursor-view",
  "data-testid": "debug-cursor"
};
const _hoisted_14$o = { "data-testid": "debug-cursor-pos" };
const _hoisted_15$l = ["data-dashboard-uid"];
const _hoisted_16$j = ["href"];
const _hoisted_17$h = {
  class: "toolbar",
  "data-testid": "debug-counters"
};
const _hoisted_18$h = { class: "counts" };
const _hoisted_19$g = {
  key: 0,
  "data-testid": "counter-render"
};
const _hoisted_20$e = {
  key: 1,
  "data-testid": "counter-data"
};
const _hoisted_21$7 = {
  key: 2,
  "data-testid": "counter-schema"
};
const _hoisted_22$6 = { "data-testid": "counter-elapsed" };
const _hoisted_23$5 = { class: "frame-title" };
const _hoisted_24$5 = {
  class: "filter-table",
  "data-testid": "debug-field-table"
};
const _sfc_main$2Z = /* @__PURE__ */ defineComponent({
  __name: "DebugRenderer",
  props: {
    data: {},
    options: {},
    fieldConfig: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const mode2 = computed(() => String(opts.value.mode ?? "render"));
    const modeKey = computed(() => mode2.value.toLowerCase());
    const counters = ref({ render: 1, dataChanged: 0, schemaChanged: 0 });
    const elapsed = ref(0);
    const sawData = ref(false);
    const instanceName = ref("");
    const stateViewLabel = computed(() => String(opts.value.stateView ?? ""));
    const showRender = computed(() => opts.value.counters?.render !== false);
    const showData = computed(() => opts.value.counters?.dataChanged !== false);
    const showSchema = computed(() => opts.value.counters?.schemaChanged !== false);
    const eventLog = ref([]);
    const cursorInfo = ref({ x: 0, y: 0, active: false });
    function frameStructure(series) {
      return (series ?? []).map((f) => (f.fields ?? []).map((x) => `${x.name}:${x.type}`).join(",")).join("|");
    }
    watch(
      () => props.data,
      (n, o) => {
        if (!sawData.value) {
          sawData.value = true;
          return;
        }
        if (n !== o) {
          counters.value = {
            ...counters.value,
            dataChanged: counters.value.dataChanged + 1,
            schemaChanged: frameStructure(n?.series) !== frameStructure(o?.series) ? counters.value.schemaChanged + 1 : counters.value.schemaChanged,
            render: counters.value.render + 1
          };
          if (modeKey.value === "events") {
            eventLog.value = [
              ...eventLog.value.slice(-49),
              {
                t: Date.now(),
                type: "data",
                detail: `series=${n?.series?.length ?? 0}`
              }
            ];
          }
        }
      }
    );
    function resetCounters() {
      counters.value = { render: 1, dataChanged: 0, schemaChanged: 0 };
      elapsed.value = 0;
      eventLog.value = [];
    }
    function lastNotNull(values) {
      for (let i = values.length - 1; i >= 0; i--) {
        const v = values[i];
        if (v != null && !(typeof v === "number" && Number.isNaN(v))) return String(v);
      }
      return "null";
    }
    const frames = computed(
      () => (props.data?.series ?? []).map((frame, idx) => {
        const name = frame.name || frame.refId || `Frame ${idx}`;
        const length = frame.length ?? frame.fields?.[0]?.values?.length ?? 0;
        const fields = (frame.fields ?? []).map((field) => ({
          name: field.name,
          type: field.type,
          last: lastNotNull(field.values ?? [])
        }));
        return { name, length, fields, key: `${idx}/${frame.refId ?? name}` };
      })
    );
    function onCursorMove(e) {
      if (modeKey.value !== "cursor") return;
      const t2 = e.currentTarget;
      const r = t2.getBoundingClientRect();
      cursorInfo.value = {
        x: Math.round(e.clientX - r.left),
        y: Math.round(e.clientY - r.top),
        active: true
      };
    }
    function onCursorLeave() {
      cursorInfo.value = { ...cursorInfo.value, active: false };
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "debug",
        "data-testid": "panel-debug",
        "data-mode": mode2.value,
        "data-state-view": stateViewLabel.value,
        "data-instance-name": instanceName.value,
        "data-counter-render": String(counters.value.render),
        "data-counter-data": String(counters.value.dataChanged),
        "data-counter-schema": String(counters.value.schemaChanged),
        "data-elapsed": String(elapsed.value),
        "data-dashboard-uid": String(opts.value.dashboardUID ?? ""),
        onMousemove: onCursorMove,
        onMouseleave: onCursorLeave
      }, [
        createCommentVNode(" Grafana DebugMode.State → StateView "),
        modeKey.value === "state" ? (openBlock(), createElementBlock("div", _hoisted_2$1T, [
          createElementVNode("label", _hoisted_3$1F, [
            _cache[1] || (_cache[1] = createElementVNode(
              "span",
              { class: "state-label" },
              "状态名称",
              -1
              /* CACHED */
            )),
            createVNode(unref(GInput), {
              "data-testid": "debug-state-name",
              value: instanceName.value,
              placeholder: "instance state name",
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => instanceName.value = String($event ?? ""))
            }, null, 8, ["value"])
          ]),
          createElementVNode("div", _hoisted_4$1n, [
            createTextVNode(
              " 当前值: " + toDisplayString(instanceName.value || "—") + " ",
              1
              /* TEXT */
            ),
            stateViewLabel.value ? (openBlock(), createElementBlock(
              "span",
              _hoisted_5$1b,
              " (" + toDisplayString(stateViewLabel.value) + ") ",
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true)
          ])
        ])) : modeKey.value === "events" ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createCommentVNode(" Grafana DebugMode.Events → EventBusLogger "),
            createElementVNode("div", _hoisted_6$11, [
              createElementVNode("div", _hoisted_7$W, [
                createElementVNode("button", {
                  type: "button",
                  class: "reset-btn",
                  title: "复位计数器",
                  "aria-label": "后退",
                  "data-testid": "debug-reset",
                  onClick: resetCounters
                }, [
                  createVNode(unref(GIcon), {
                    name: "step-backward",
                    size: 16
                  })
                ]),
                createElementVNode(
                  "span",
                  _hoisted_8$O,
                  "事件：" + toDisplayString(eventLog.value.length),
                  1
                  /* TEXT */
                )
              ]),
              createElementVNode("ul", _hoisted_9$L, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(eventLog.value, (e, i) => {
                    return openBlock(), createElementBlock("li", {
                      key: i,
                      class: "event-row"
                    }, [
                      createElementVNode(
                        "span",
                        _hoisted_10$C,
                        toDisplayString(e.type),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "span",
                        _hoisted_11$y,
                        toDisplayString(e.detail),
                        1
                        /* TEXT */
                      )
                    ]);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                )),
                !eventLog.value.length ? (openBlock(), createElementBlock("li", _hoisted_12$t, "暂无事件")) : createCommentVNode("v-if", true)
              ])
            ])
          ],
          2112
          /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
        )) : modeKey.value === "cursor" ? (openBlock(), createElementBlock(
          Fragment,
          { key: 2 },
          [
            createCommentVNode(" Grafana DebugMode.Cursor → CursorView "),
            createElementVNode("div", _hoisted_13$s, [
              createElementVNode(
                "div",
                _hoisted_14$o,
                " 光标：" + toDisplayString(cursorInfo.value.active ? `${cursorInfo.value.x}, ${cursorInfo.value.y}` : "—"),
                1
                /* TEXT */
              )
            ])
          ],
          2112
          /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
        )) : (openBlock(), createElementBlock(
          Fragment,
          { key: 3 },
          [
            createCommentVNode(" Default: RenderInfoViewer "),
            opts.value.dashboardUID ? (openBlock(), createElementBlock("div", {
              key: 0,
              class: "dashboard-uid",
              "data-testid": "debug-dashboard-uid",
              "data-dashboard-uid": String(opts.value.dashboardUID)
            }, [
              _cache[2] || (_cache[2] = createTextVNode(
                " 仪表盘 UID： ",
                -1
                /* CACHED */
              )),
              createElementVNode("a", {
                class: "dash-link",
                href: `/d/${encodeURIComponent(String(opts.value.dashboardUID))}`,
                "data-testid": "debug-dashboard-link"
              }, toDisplayString(opts.value.dashboardUID), 9, _hoisted_16$j)
            ], 8, _hoisted_15$l)) : createCommentVNode("v-if", true),
            createElementVNode("div", _hoisted_17$h, [
              createElementVNode("button", {
                type: "button",
                class: "reset-btn",
                title: "复位计数器",
                "aria-label": "后退",
                "data-testid": "debug-reset",
                onClick: resetCounters
              }, [
                createVNode(unref(GIcon), {
                  name: "step-backward",
                  size: 16
                })
              ]),
              createElementVNode("span", _hoisted_18$h, [
                showRender.value ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_19$g,
                  "渲染：" + toDisplayString(counters.value.render),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                showData.value ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_20$e,
                  "数据：" + toDisplayString(counters.value.dataChanged),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                showSchema.value ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_21$7,
                  "架构：" + toDisplayString(counters.value.schemaChanged),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createElementVNode(
                  "span",
                  _hoisted_22$6,
                  "时间：" + toDisplayString(elapsed.value) + " 毫秒",
                  1
                  /* TEXT */
                )
              ])
            ]),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(frames.value, (frame) => {
                return openBlock(), createElementBlock("div", {
                  key: frame.key,
                  class: "frame",
                  "data-testid": "debug-frame"
                }, [
                  createElementVNode(
                    "h4",
                    _hoisted_23$5,
                    toDisplayString(frame.name) + " (" + toDisplayString(frame.length) + ")",
                    1
                    /* TEXT */
                  ),
                  createElementVNode("table", _hoisted_24$5, [
                    _cache[3] || (_cache[3] = createElementVNode(
                      "thead",
                      null,
                      [
                        createElementVNode("tr", null, [
                          createElementVNode("td", null, "字段"),
                          createElementVNode("td", null, "类型"),
                          createElementVNode("td", null, "最后一个")
                        ])
                      ],
                      -1
                      /* CACHED */
                    )),
                    createElementVNode("tbody", null, [
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(frame.fields, (field, fi) => {
                          return openBlock(), createElementBlock("tr", {
                            key: `${fi}/${field.name}`
                          }, [
                            createElementVNode(
                              "td",
                              null,
                              toDisplayString(field.name),
                              1
                              /* TEXT */
                            ),
                            createElementVNode(
                              "td",
                              null,
                              toDisplayString(field.type),
                              1
                              /* TEXT */
                            ),
                            createElementVNode(
                              "td",
                              null,
                              toDisplayString(field.last),
                              1
                              /* TEXT */
                            )
                          ]);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ])
                  ])
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ], 40, _hoisted_1$2n);
    };
  }
});
const DebugRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Z, [["__scopeId", "data-v-7f19161d"]]);
const _sfc_main$2Y = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(DebugRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "debug",
    name: "调试",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$2Y
).setPanelOptions((builder) => {
  const category = ["调试"];
  builder.addSelect(
    {
      id: "mode",
      path: "mode",
      name: "模式",
      category,
      settings: {
        options: [
          { label: "渲染", value: "render" },
          { label: "事件", value: "events" },
          { label: "光标", value: "cursor" },
          { label: "状态", value: "State" },
          { label: "抛出错误", value: "ThrowError" }
        ]
      }
    },
    "render"
  ).addText({
    id: "stateView",
    path: "stateView",
    name: "状态视图",
    category,
    showIf: (c) => String(c.mode).toLowerCase() === "state"
  }).addBoolean(
    {
      id: "counters.render",
      path: "counters.render",
      name: "渲染计数",
      category,
      // Grafana: only in render mode
      showIf: (c) => c.mode === "render"
    },
    true
  ).addBoolean(
    {
      id: "counters.dataChanged",
      path: "counters.dataChanged",
      name: "数据变更计数",
      category,
      showIf: (c) => c.mode === "render"
    },
    true
  ).addBoolean(
    {
      id: "counters.schemaChanged",
      path: "counters.schemaChanged",
      name: "Schema 变更计数",
      category,
      showIf: (c) => c.mode === "render"
    },
    true
  ).addText({
    id: "dashboardUID",
    path: "dashboardUID",
    name: "仪表盘 UID",
    category
  });
}).setRuntimeConsumedPaths([
  "mode",
  "stateView",
  "counters.render",
  "counters.dataChanged",
  "counters.schemaChanged",
  "dashboardUID"
]).register();
const _hoisted_1$2m = ["data-folder", "data-datasource", "data-group-by", "data-view-mode", "data-group-mode", "data-max-items", "data-sort", "data-show-inactive", "data-dashboard-alerts", "data-alert-name", "data-alert-instance-label-filter", "data-row-count", "data-stat-color-mode", "data-stat-color", "data-state-filter-size", "data-state-firing", "data-state-pending", "data-state-normal", "data-stat-thresholds", "data-stat-value-mappings"];
const _hoisted_2$1S = ["data-color-mode"];
const _hoisted_3$1E = { class: "stat-label" };
const _hoisted_4$1m = {
  key: 0,
  class: "group-title"
};
const _hoisted_5$1a = ["data-state"];
const _hoisted_6$10 = { class: "badge" };
const _hoisted_7$V = { class: "info" };
const _hoisted_8$N = { class: "name" };
const _hoisted_9$K = {
  key: 0,
  class: "labels"
};
const _hoisted_10$B = {
  key: 0,
  class: "empty",
  "data-testid": "alertlist-empty"
};
const _sfc_main$2X = /* @__PURE__ */ defineComponent({
  __name: "AlertListRenderer",
  props: {
    data: {},
    options: {},
    width: {},
    height: {}
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const viewMode = computed(() => String(opts.value.viewMode ?? "list"));
    const groupMode = computed(() => String(opts.value.groupMode ?? "default"));
    const maxItems = computed(() => Number(opts.value.maxItems ?? 10) || 10);
    const sortOrder = computed(() => opts.value.sortOrder ?? "alphaAsc");
    const showInactive = computed(() => opts.value.showInactiveAlerts !== false);
    const dashboardAlerts = computed(
      () => opts.value.dashboardAlerts === true || opts.value.dashboardAlerts === "true"
    );
    const groupByField = computed(() => String(opts.value.groupBy ?? ""));
    const STAT_THRESHOLDS_DEFAULT = {
      mode: "absolute",
      steps: [
        { value: -Infinity, color: "green" },
        { value: 80, color: "red" }
      ]
    };
    function fromData() {
      const frame = props.data?.series?.[0];
      if (!frame?.fields?.length) return [];
      const nameF = frame.fields.find((f) => /name|alertname|title/i.test(f.name)) ?? frame.fields[0];
      const stateF = frame.fields.find((f) => /state|status/i.test(f.name));
      const labelsF = frame.fields.find((f) => /label/i.test(f.name));
      const n = nameF.values.length;
      if (!n) return [];
      const rows2 = [];
      for (let i = 0; i < n; i++) {
        const labelVal = labelsF ? labelsF.values[i] : void 0;
        const labels = labelVal == null ? void 0 : typeof labelVal === "object" ? Object.entries(labelVal).map(([k, v]) => `${k}=${v}`).join(",") : String(labelVal);
        const folderF = frame.fields.find((f) => /folder/i.test(f.name));
        const dsF = frame.fields.find((f) => /datasource|ds/i.test(f.name));
        rows2.push({
          name: String(nameF.values[i]),
          state: String(stateF?.values[i] ?? "alerting").toLowerCase(),
          labels,
          folder: folderF ? String(folderF.values[i] ?? "") : void 0,
          datasource: dsF ? String(dsF.values[i] ?? "") : void 0,
          importance: void 0
        });
      }
      return rows2;
    }
    const STATE_FILTER_OPTION_KEYS = [
      "firing",
      "pending",
      "recovering",
      "noData",
      "normal",
      "error",
      "inactive"
    ];
    const stateFilter = computed(() => {
      const f = opts.value.stateFilter;
      if (f == null) return null;
      if (Array.isArray(f)) {
        if (!f.length) return null;
        return new Set(f.map((s) => String(s).toLowerCase()));
      }
      if (typeof f !== "object") return null;
      const rec = f;
      const set = /* @__PURE__ */ new Set();
      for (const k of STATE_FILTER_OPTION_KEYS) {
        if (rec[k]) set.add(String(k).toLowerCase());
      }
      for (const [k, v] of Object.entries(rec)) {
        if (v) set.add(String(k).toLowerCase());
      }
      return set;
    });
    function matchesStateFilter(state2, filter2) {
      const st = state2.toLowerCase().replaceAll(/[\s-]/g, "_");
      if (filter2.has(st)) return true;
      const groups2 = [
        ["firing", "alerting", "alert"],
        ["pending"],
        ["recovering", "recover"],
        ["normal", "ok", "inactive"],
        ["nodata", "no_data", "no-data"],
        ["error", "err"]
      ];
      for (const g of groups2) {
        const dataHit = g.some((a) => a === st || st.includes(a));
        const filterHit = g.some((a) => filter2.has(a));
        if (dataHit && filterHit) return true;
      }
      return false;
    }
    function labelsMatchFilter(labelsRaw, filterRaw) {
      const labels = String(labelsRaw ?? "");
      const filter2 = String(filterRaw ?? "").trim();
      if (!filter2) return true;
      const body = filter2.replace(/^\s*\{/, "").replace(/\}\s*$/, "").trim();
      if (!body) return labels.toLowerCase().includes(filter2.toLowerCase());
      const parts = body.split(",").map((s) => s.trim()).filter(Boolean);
      if (!parts.length) return labels.toLowerCase().includes(filter2.toLowerCase());
      const lower = labels.toLowerCase();
      for (const part of parts) {
        const m = part.match(/^(\w+)\s*(!=|=~|!~|=)\s*"?([^"]*)"?$/);
        if (!m) {
          if (!lower.includes(part.toLowerCase())) return false;
          continue;
        }
        const key = m[1];
        const op = m[2];
        const val = m[3] ?? "";
        const pairRe = new RegExp(`(?:^|[,\\s{])${key}\\s*=\\s*"?([^,"}\\s]+)"?`, "i");
        const found = labels.match(pairRe);
        const actual = found ? String(found[1] ?? "") : "";
        const hasPair = lower.includes(`${key}=${val}`.toLowerCase()) || lower.includes(`${key}="${val}"`.toLowerCase());
        if (op === "=") {
          if (actual) {
            if (actual.toLowerCase() !== val.toLowerCase()) return false;
          } else if (!hasPair) {
            return false;
          }
        } else if (op === "!=") {
          if (actual && actual.toLowerCase() === val.toLowerCase()) return false;
          if (!actual && hasPair) return false;
        } else if (op === "=~") {
          try {
            if (!new RegExp(val, "i").test(actual || labels)) return false;
          } catch {
            if (!lower.includes(val.toLowerCase())) return false;
          }
        } else if (op === "!~") {
          try {
            if (new RegExp(val, "i").test(actual || labels)) return false;
          } catch {
            if (lower.includes(val.toLowerCase())) return false;
          }
        }
      }
      return true;
    }
    const rows = computed(() => {
      let list = fromData();
      const nameFilter = String(opts.value.alertName ?? "").trim().toLowerCase();
      const labelFilter = String(opts.value.alertInstanceLabelFilter ?? "").trim();
      const folderFilter = String(opts.value.folder ?? "").toLowerCase();
      const dsFilter = String(opts.value.datasource ?? "").toLowerCase();
      if (nameFilter) {
        list = list.filter((r) => r.name.toLowerCase().includes(nameFilter));
      }
      if (labelFilter) {
        list = list.filter((r) => labelsMatchFilter(r.labels, labelFilter));
      }
      if (folderFilter) {
        list = list.filter(
          (r) => String(r.folder ?? "").toLowerCase().includes(folderFilter)
        );
      }
      if (dsFilter) {
        list = list.filter(
          (r) => String(r.datasource ?? r.ds ?? "").toLowerCase().includes(dsFilter)
        );
      }
      const filter2 = stateFilter.value;
      list = list.filter((r) => {
        const st = r.state.toLowerCase();
        if (st === "inactive" && !showInactive.value && !filter2) return false;
        if (!filter2) return true;
        return matchesStateFilter(st, filter2);
      });
      if (dashboardAlerts.value) {
        list = list.filter((r) => !r.folder || r.folder === "Infra");
      }
      const sort = sortOrder.value;
      list = [...list].sort((a, b) => {
        if (sort === 3 || sort === "importance") return (a.importance ?? 0) - (b.importance ?? 0);
        if (sort === 2 || sort === "alphaDesc") return b.name.localeCompare(a.name);
        if (sort === 4 || sort === "timeAsc" || sort === 5 || sort === "timeDesc")
          return a.name.localeCompare(b.name);
        return a.name.localeCompare(b.name);
      });
      return list.slice(0, maxItems.value);
    });
    const groups = computed(() => {
      if (groupMode.value === "default" || viewMode.value !== "list") {
        return [{ key: "all", rows: rows.value }];
      }
      const map = /* @__PURE__ */ new Map();
      for (const r of rows.value) {
        const key = groupMode.value === "custom" ? groupByField.value ? String(r[groupByField.value] ?? r.folder ?? "默认") : r.folder || "默认" : r.state;
        if (!map.has(key)) map.set(key, []);
        map.get(key).push(r);
      }
      return [...map.entries()].map(([key, rows2]) => ({ key, rows: rows2 }));
    });
    function stateClass(s) {
      const st = s.toLowerCase();
      if (st === "alerting" || st === "firing" || st === "error") return "alerting";
      if (st === "pending") return "pending";
      if (st === "recovering") return "pending";
      if (st === "ok" || st === "normal") return "ok";
      if (st === "no_data" || st === "nodata") return "nodata";
      return "inactive";
    }
    const statColorMode = computed(() => String(opts.value.statColorMode ?? "none").toLowerCase());
    const statDisplay = computed(() => {
      const count = rows.value.length;
      const thresholds = opts.value.statThresholds ?? STAT_THRESHOLDS_DEFAULT;
      const mappings = opts.value.statValueMappings ?? [];
      const processor = getDisplayProcessor({
        field: {
          name: "count",
          type: "number",
          config: {
            thresholds,
            mappings
          },
          values: [count]
        }
      });
      const displayValue = processor(count);
      let color = displayValue.color;
      if (statColorMode.value === "none") {
        color = void 0;
      } else if (!color) {
        const active = getActiveThreshold(count, thresholds);
        color = active?.color ? resolveVizColor(active.color) : void 0;
      } else {
        color = resolveVizColor(color) ?? color;
      }
      return {
        text: displayValue.text ?? String(count),
        numeric: count,
        color,
        title: "告警"
      };
    });
    const bigValueColorMode = computed(() => {
      const m = statColorMode.value;
      if (m === "background" || m === "background_solid") return m;
      if (m === "value") return BigValueColorMode.Value;
      return BigValueColorMode.None;
    });
    const statShellStyle = computed(() => {
      const mode2 = statColorMode.value;
      const color = statDisplay.value.color;
      if (!color) return {};
      if (mode2 === "background_solid") return { background: color };
      if (mode2 === "background") return { background: `linear-gradient(120deg, ${color}, ${color})` };
      return {};
    });
    const statValueStyle = computed(() => {
      if (statColorMode.value === "value" && statDisplay.value.color) {
        return { color: statDisplay.value.color };
      }
      return {};
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "alertlist",
        "data-testid": "panel-alertlist",
        "data-folder": String(opts.value.folder ?? ""),
        "data-datasource": String(opts.value.datasource ?? ""),
        "data-group-by": String(opts.value.groupBy ?? ""),
        "data-view-mode": viewMode.value,
        "data-group-mode": groupMode.value,
        "data-max-items": String(maxItems.value),
        "data-sort": String(sortOrder.value),
        "data-show-inactive": String(showInactive.value),
        "data-dashboard-alerts": String(dashboardAlerts.value),
        "data-alert-name": String(opts.value.alertName ?? ""),
        "data-alert-instance-label-filter": String(opts.value.alertInstanceLabelFilter ?? ""),
        "data-row-count": String(rows.value.length),
        "data-stat-color-mode": statColorMode.value,
        "data-stat-color": String(statDisplay.value.color ?? ""),
        "data-state-filter-size": String(stateFilter.value == null ? -1 : stateFilter.value.size),
        "data-state-firing": String(!!(opts.value.stateFilter?.firing ?? opts.value.stateFilter?.alerting)),
        "data-state-pending": String(!!opts.value.stateFilter?.pending),
        "data-state-normal": String(!!(opts.value.stateFilter?.normal ?? opts.value.stateFilter?.inactive)),
        "data-stat-thresholds": String(
          Array.isArray(opts.value.statThresholds?.steps) ? opts.value.statThresholds.steps.length : opts.value.statThresholds ? "set" : ""
        ),
        "data-stat-value-mappings": String(
          Array.isArray(opts.value.statValueMappings) ? opts.value.statValueMappings.length : opts.value.statValueMappings ? "set" : ""
        )
      }, [
        viewMode.value === "stat" ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: "stat-wrap",
          "data-testid": "alertlist-stat",
          "data-color-mode": statColorMode.value,
          style: normalizeStyle(statShellStyle.value)
        }, [
          __props.width && __props.height ? (openBlock(), createBlock(unref(BigValue), {
            key: 0,
            width: __props.width,
            height: __props.height,
            value: {
              text: statDisplay.value.text,
              title: statDisplay.value.title,
              color: statDisplay.value.color
            },
            "color-mode": bigValueColorMode.value,
            "graph-mode": unref(BigValueGraphMode).None,
            "justify-mode": unref(BigValueJustifyMode).Auto,
            "text-mode": unref(BigValueTextMode).Auto
          }, null, 8, ["width", "height", "value", "color-mode", "graph-mode", "justify-mode", "text-mode"])) : (openBlock(), createElementBlock(
            Fragment,
            { key: 1 },
            [
              createElementVNode(
                "div",
                {
                  class: "stat",
                  style: normalizeStyle(statValueStyle.value)
                },
                toDisplayString(statDisplay.value.text),
                5
                /* TEXT, STYLE */
              ),
              createElementVNode(
                "div",
                _hoisted_3$1E,
                toDisplayString(statDisplay.value.title),
                1
                /* TEXT */
              )
            ],
            64
            /* STABLE_FRAGMENT */
          ))
        ], 12, _hoisted_2$1S)) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(groups.value, (g) => {
                return openBlock(), createElementBlock("section", {
                  key: g.key,
                  class: "group"
                }, [
                  groupMode.value !== "default" ? (openBlock(), createElementBlock(
                    "header",
                    _hoisted_4$1m,
                    toDisplayString(g.key),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(g.rows, (r, i) => {
                      return openBlock(), createElementBlock("div", {
                        key: i,
                        class: normalizeClass(["row", stateClass(r.state)]),
                        "data-testid": "alertlist-row",
                        "data-state": r.state
                      }, [
                        createElementVNode(
                          "span",
                          _hoisted_6$10,
                          toDisplayString(r.state),
                          1
                          /* TEXT */
                        ),
                        createElementVNode("div", _hoisted_7$V, [
                          createElementVNode(
                            "div",
                            _hoisted_8$N,
                            toDisplayString(r.name),
                            1
                            /* TEXT */
                          ),
                          r.labels ? (openBlock(), createElementBlock(
                            "div",
                            _hoisted_9$K,
                            toDisplayString(r.labels),
                            1
                            /* TEXT */
                          )) : createCommentVNode("v-if", true)
                        ])
                      ], 10, _hoisted_5$1a);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            )),
            createCommentVNode(" Grafana UnifiedAlertList hardcodes English empty copy "),
            !rows.value.length ? (openBlock(), createElementBlock("div", _hoisted_10$B, " No alerts matching filters ")) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ], 8, _hoisted_1$2m);
    };
  }
});
const AlertListRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$2X, [["__scopeId", "data-v-8e22f410"]]);
const _sfc_main$2W = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(AlertListRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "width", "height"]);
    };
  }
});
new VuePanelPlugin(
  {
    id: "alertlist",
    name: "告警列表",
    description: "统一告警列表 / 统计",
    state: "stable",
    skipDataQuery: true
  },
  _sfc_main$2W
).setPanelOptions((builder) => {
  const optionsCategory = ["选项"];
  const filterCategory = ["过滤"];
  const alertStateCategory = ["告警状态过滤"];
  const statCategory = ["统计样式"];
  builder.addRadio(
    {
      id: "viewMode",
      path: "viewMode",
      name: "视图模式",
      description: "列表视图与统计视图切换",
      category: optionsCategory,
      settings: {
        options: [
          { label: "列表", value: "list" },
          { label: "统计", value: "stat" }
        ]
      }
    },
    "list"
  ).addRadio(
    {
      id: "groupMode",
      path: "groupMode",
      name: "分组模式",
      category: optionsCategory,
      settings: {
        options: [
          { label: "默认分组", value: "default" },
          { label: "自定义分组", value: "custom" }
        ]
      }
    },
    "default"
  ).addText(
    {
      id: "groupBy",
      path: "groupBy",
      name: "分组字段",
      description: "标签查询，逗号分隔",
      category: optionsCategory,
      showIf: (c) => c.groupMode === "custom"
    },
    void 0
  ).addNumber(
    {
      id: "maxItems",
      path: "maxItems",
      name: "最大条目",
      category: optionsCategory,
      settings: { min: 1 },
      showIf: (c) => c.groupMode !== "custom"
    },
    20
  ).addSelect(
    {
      id: "sortOrder",
      path: "sortOrder",
      name: "排序",
      category: optionsCategory,
      settings: {
        options: [
          { label: "字母升序", value: 1 },
          { label: "字母降序", value: 2 },
          { label: "重要性", value: 3 },
          { label: "时间升序", value: 4 },
          { label: "时间降序", value: 5 }
        ]
      }
    },
    // Grafana defaultValue = SortOrder.AlphaAsc (1)
    1
  ).addBoolean(
    {
      id: "dashboardAlerts",
      path: "dashboardAlerts",
      name: "仅本仪表盘关联告警",
      category: filterCategory
    },
    false
  ).addText(
    {
      id: "alertName",
      path: "alertName",
      name: "告警名称",
      category: filterCategory
    },
    ""
  ).addText(
    {
      id: "alertInstanceLabelFilter",
      path: "alertInstanceLabelFilter",
      name: "实例标签过滤",
      category: filterCategory
    },
    ""
  ).addText(
    {
      id: "datasource",
      path: "datasource",
      name: "数据源",
      category: filterCategory
    },
    void 0
  ).addText(
    {
      id: "folder",
      path: "folder",
      name: "文件夹",
      category: filterCategory,
      // Grafana: only for grafana datasource or none
      showIf: (c) => !c.datasource || String(c.datasource).startsWith("grafana")
    },
    void 0
  ).addBoolean(
    {
      id: "showInactiveAlerts",
      path: "showInactiveAlerts",
      name: "显示 0 实例告警",
      category: filterCategory
    },
    false
  ).addBoolean(
    {
      id: "stateFilter.firing",
      path: "stateFilter.firing",
      name: "Alerting / Firing",
      category: alertStateCategory
    },
    true
  ).addBoolean(
    {
      id: "stateFilter.pending",
      path: "stateFilter.pending",
      name: "Pending",
      category: alertStateCategory
    },
    true
  ).addBoolean(
    {
      id: "stateFilter.recovering",
      path: "stateFilter.recovering",
      name: "Recovering",
      category: alertStateCategory
    },
    true
  ).addBoolean(
    {
      id: "stateFilter.noData",
      path: "stateFilter.noData",
      name: "No Data",
      category: alertStateCategory
    },
    false
  ).addBoolean(
    {
      id: "stateFilter.normal",
      path: "stateFilter.normal",
      name: "Normal",
      category: alertStateCategory
    },
    false
  ).addBoolean(
    {
      id: "stateFilter.error",
      path: "stateFilter.error",
      name: "Error",
      category: alertStateCategory
    },
    true
  ).addSelect(
    {
      id: "statColorMode",
      path: "statColorMode",
      name: "颜色模式",
      category: statCategory,
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "值", value: "value" },
          { label: "背景渐变", value: "background" },
          { label: "背景纯色", value: "background_solid" }
        ]
      },
      showIf: (c) => c.viewMode === "stat"
    },
    "none"
  ).addCustom({
    id: "statThresholds",
    path: "statThresholds",
    name: "阈值",
    category: statCategory,
    editor: "thresholds",
    showIf: (c) => c.viewMode === "stat" && c.statColorMode && c.statColorMode !== "none"
  }).addCustom({
    id: "statValueMappings",
    path: "statValueMappings",
    name: "值映射",
    category: statCategory,
    editor: "mappings",
    showIf: (c) => c.viewMode === "stat"
  });
}).setRuntimeConsumedPaths([
  "viewMode",
  "groupMode",
  "groupBy",
  "maxItems",
  "sortOrder",
  "dashboardAlerts",
  "alertName",
  "alertInstanceLabelFilter",
  "datasource",
  "folder",
  "showInactiveAlerts",
  "stateFilter.firing",
  "stateFilter.pending",
  "stateFilter.recovering",
  "stateFilter.noData",
  "stateFilter.normal",
  "stateFilter.error",
  "statColorMode",
  "statThresholds",
  "statValueMappings"
]).register();
const _hoisted_1$2l = ["data-mode", "data-clock-type", "data-date-show", "data-timezone"];
const _hoisted_2$1R = { class: "panel-clock__time" };
const _hoisted_3$1D = {
  key: 0,
  class: "panel-clock__date"
};
const _sfc_main$2V = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const now2 = ref(Date.now());
    let timer;
    onMounted(() => {
      timer = setInterval(() => {
        now2.value = Date.now();
      }, 250);
    });
    onBeforeUnmount(() => {
      if (timer) clearInterval(timer);
    });
    function pad(n) {
      return String(n).padStart(2, "0");
    }
    function formatInTz(ts, tz, clockType, dateFormat) {
      try {
        const d = new Date(ts);
        const hour12 = String(clockType || "").toLowerCase().includes("12");
        if (tz) {
          const parts = new Intl.DateTimeFormat(hour12 ? "en-US" : "en-GB", {
            timeZone: tz,
            year: "numeric",
            month: "2-digit",
            day: "2-digit",
            hour: "2-digit",
            minute: "2-digit",
            second: "2-digit",
            hour12
          }).formatToParts(d);
          const get = (t2) => parts.find((p) => p.type === t2)?.value || "";
          const dayPeriod = get("dayPeriod");
          const time2 = hour12 ? `${get("hour")}:${get("minute")}:${get("second")}${dayPeriod ? ` ${dayPeriod}` : ""}` : `${get("hour")}:${get("minute")}:${get("second")}`;
          const y2 = get("year");
          const m2 = get("month");
          const day2 = get("day");
          const date = applyDateFormat(dateFormat, y2, m2, day2);
          return { date, time: time2 };
        }
        const y = String(d.getFullYear());
        const m = pad(d.getMonth() + 1);
        const day = pad(d.getDate());
        let h2 = d.getHours();
        const min = pad(d.getMinutes());
        const sec = pad(d.getSeconds());
        let time;
        if (hour12) {
          const ap = h2 >= 12 ? "PM" : "AM";
          h2 = h2 % 12 || 12;
          time = `${pad(h2)}:${min}:${sec} ${ap}`;
        } else {
          time = `${pad(h2)}:${min}:${sec}`;
        }
        return { date: applyDateFormat(dateFormat, y, m, day), time };
      } catch {
        const d = new Date(ts);
        return {
          date: d.toISOString().slice(0, 10),
          time: d.toISOString().slice(11, 19)
        };
      }
    }
    function applyDateFormat(fmt, y, m, d) {
      const f = fmt || "YYYY-MM-DD";
      return f.replaceAll("YYYY", y).replaceAll("MM", m).replaceAll("DD", d).replaceAll("YY", y.slice(-2));
    }
    function formatDuration(ms) {
      const sign = ms < 0 ? "-" : "";
      ms = Math.abs(ms);
      const s = Math.floor(ms / 1e3);
      const h2 = Math.floor(s / 3600);
      const m = Math.floor(s % 3600 / 60);
      const sec = s % 60;
      return `${sign}${pad(h2)}:${pad(m)}:${pad(sec)}`;
    }
    const display = computed(() => {
      const opts = props.options || {};
      const mode2 = opts.mode || "time";
      const tz = opts.timezone || void 0;
      if (mode2 === "countdown" && opts.countdownEnd) {
        const end = Date.parse(opts.countdownEnd);
        if (Number.isFinite(end))
          return {
            primary: formatDuration(end - now2.value),
            secondary: opts.dateShow ? formatInTz(now2.value, tz, opts.clockType, opts.dateFormat).date : ""
          };
      }
      if (mode2 === "countup" && opts.countdownEnd) {
        const start = Date.parse(opts.countdownEnd);
        if (Number.isFinite(start))
          return {
            primary: formatDuration(now2.value - start),
            secondary: opts.dateShow ? formatInTz(now2.value, tz, opts.clockType, opts.dateFormat).date : ""
          };
      }
      const f = formatInTz(now2.value, tz, opts.clockType, opts.dateFormat);
      return { primary: f.time, secondary: opts.dateShow !== false ? f.date : "" };
    });
    const style = computed(() => {
      const opts = props.options || {};
      return {
        fontSize: opts.fontSize || "3em",
        background: opts.bgColor || "transparent"
      };
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-clock",
        "data-testid": "panel-clock",
        "data-mode": String(__props.options?.mode || "time"),
        "data-clock-type": String(__props.options?.clockType || "24 hour"),
        "data-date-show": String(__props.options?.dateShow !== false),
        "data-timezone": String(__props.options?.timezone || ""),
        style: normalizeStyle(style.value)
      }, [
        createElementVNode(
          "div",
          _hoisted_2$1R,
          toDisplayString(display.value.primary),
          1
          /* TEXT */
        ),
        display.value.secondary ? (openBlock(), createElementBlock(
          "div",
          _hoisted_3$1D,
          toDisplayString(display.value.secondary),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ], 12, _hoisted_1$2l);
    };
  }
});
const Panel$b = /* @__PURE__ */ _export_sfc$1(_sfc_main$2V, [["__scopeId", "data-v-eee42083"]]);
new VuePanelPlugin(
  { id: "clock", name: "时钟", state: "stable", skipDataQuery: true },
  Panel$b
).setPanelOptions((builder) => {
  builder.addRadio(
    {
      id: "mode",
      path: "mode",
      name: "模式",
      category: ["时钟"],
      editor: "radio",
      settings: {
        options: [
          { label: "时间", value: "time" },
          { label: "倒计时", value: "countdown" },
          { label: "正计时", value: "countup" }
        ]
      }
    },
    "time"
  ).addText(
    {
      id: "clockType",
      path: "clockType",
      name: "时钟类型",
      category: ["时钟"],
      editor: "text",
      settings: { placeholder: "24 hour" }
    },
    "24 hour"
  ).addText(
    {
      id: "timezone",
      path: "timezone",
      name: "时区",
      category: ["时钟"],
      editor: "text",
      description: "IANA 时区，如 Asia/Shanghai；空为本地"
    },
    ""
  ).addText(
    {
      id: "dateFormat",
      path: "dateFormat",
      name: "日期格式",
      category: ["日期"],
      editor: "text"
    },
    "YYYY-MM-DD"
  ).addBoolean(
    {
      id: "dateShow",
      path: "dateShow",
      name: "显示日期",
      category: ["日期"],
      editor: "boolean"
    },
    true
  ).addText(
    {
      id: "countdownEnd",
      path: "countdownEnd",
      name: "倒计时终点",
      category: ["倒计时"],
      editor: "text",
      description: "ISO 时间或可解析日期字符串",
      showIf: (c) => c.mode === "countdown"
    },
    ""
  ).addText(
    {
      id: "bgColor",
      path: "bgColor",
      name: "背景色",
      category: ["外观"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "fontSize",
      path: "fontSize",
      name: "字号",
      category: ["外观"],
      editor: "text"
    },
    "3em"
  );
}).useFieldConfig().setRuntimeConsumedPaths([
  "mode",
  "clockType",
  "timezone",
  "dateFormat",
  "dateShow",
  "countdownEnd",
  "bgColor",
  "fontSize"
]).register();
const _hoisted_1$2k = ["data-color-mode", "data-show-legend", "data-cell-count", "data-cells-max"];
const _hoisted_2$1Q = {
  key: 0,
  class: "panel-statusmap__empty"
};
const _hoisted_3$1C = { class: "row-h" };
const _hoisted_4$1l = ["title"];
const _hoisted_5$19 = {
  key: 2,
  class: "panel-statusmap__legend",
  "data-testid": "statusmap-legend"
};
const _sfc_main$2U = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const colorMode = computed(() => String(props.options?.colorMode || "threshold"));
    const showLegend = computed(() => props.options?.showLegend !== false);
    const cells = computed(() => {
      const series = props.data?.series || [];
      const out = [];
      const palette2 = getClassicPalette$1();
      const max = Number(props.options?.cellsMax) || 500;
      const mode2 = colorMode.value;
      const raw = [];
      for (const frame of series) {
        const fields = frame.fields || [];
        const time = fields.find((f) => f.type === "time");
        const nums = fields.filter((f) => f.type === "number");
        for (const f of nums) {
          const vals2 = f.values || [];
          const times = time?.values || [];
          for (let i = 0; i < vals2.length && raw.length < max; i++) {
            const v = Number(vals2[i]);
            if (!Number.isFinite(v)) continue;
            const t2 = times[i] != null ? new Date(Number(times[i])).toISOString().slice(11, 16) : String(i);
            raw.push({
              row: getFieldDisplayName(f, frame, series) || f.name || "series",
              col: t2,
              value: v,
              field: f
            });
          }
        }
      }
      const vals = raw.map((r) => r.value);
      const minV = vals.length ? Math.min(...vals) : 0;
      const maxV = vals.length ? Math.max(...vals) : 1;
      const span = maxV - minV || 1;
      const discreteValues = [...new Set(vals)].sort((a, b) => a - b);
      const discreteIndex = new Map(discreteValues.map((v, i) => [v, i]));
      for (const r of raw) {
        let color;
        if (mode2 === "spectrum") {
          const t2 = (r.value - minV) / span;
          const idx = Math.min(palette2.length - 1, Math.max(0, Math.floor(t2 * (palette2.length - 1))));
          color = palette2[idx];
        } else if (mode2 === "opacity") {
          const t2 = (r.value - minV) / span;
          color = `color-mix(in srgb, var(--grafana-primary) ${Math.round(15 + t2 * 85)}%, transparent)`;
        } else if (mode2 === "discrete" || mode2 === "value") {
          const di = discreteIndex.get(r.value) ?? 0;
          color = palette2[di % palette2.length];
        } else {
          color = getThresholdColor(r.value, r.field.config || {}) || palette2[Math.abs(Math.floor(r.value)) % palette2.length];
        }
        out.push({ row: r.row, col: r.col, value: r.value, color });
      }
      return out;
    });
    const rows = computed(() => [...new Set(cells.value.map((c) => c.row))]);
    const cols = computed(() => [...new Set(cells.value.map((c) => c.col))]);
    const grid = computed(() => {
      const map = new Map(cells.value.map((c) => [`${c.row}|${c.col}`, c]));
      return rows.value.map((r) => cols.value.map((c) => map.get(`${r}|${c}`)));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-statusmap",
        "data-testid": "panel-statusmap",
        "data-color-mode": colorMode.value,
        "data-show-legend": String(showLegend.value),
        "data-cell-count": String(cells.value.length),
        "data-cells-max": String(Number(__props.options?.cellsMax) || 500)
      }, [
        !cells.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1Q, "无数据")) : (openBlock(), createElementBlock(
          "div",
          {
            key: 1,
            class: "panel-statusmap__grid",
            style: normalizeStyle({
              gridTemplateColumns: `80px repeat(${cols.value.length}, minmax(10px, 1fr))`
            })
          },
          [
            _cache[0] || (_cache[0] = createElementVNode(
              "div",
              { class: "corner" },
              null,
              -1
              /* CACHED */
            )),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(cols.value, (c) => {
                return openBlock(), createElementBlock(
                  "div",
                  {
                    key: c,
                    class: "col-h"
                  },
                  toDisplayString(c),
                  1
                  /* TEXT */
                );
              }),
              128
              /* KEYED_FRAGMENT */
            )),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(grid.value, (row, ri) => {
                return openBlock(), createElementBlock(
                  Fragment,
                  {
                    key: rows.value[ri]
                  },
                  [
                    createElementVNode(
                      "div",
                      _hoisted_3$1C,
                      toDisplayString(rows.value[ri]),
                      1
                      /* TEXT */
                    ),
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(row, (cell, ci) => {
                        return openBlock(), createElementBlock("div", {
                          key: ci,
                          class: "cell",
                          style: normalizeStyle({ background: cell?.color || "var(--grafana-hover)" }),
                          title: cell ? `${rows.value[ri]} @ ${cols.value[ci]} = ${cell.value}` : ""
                        }, null, 12, _hoisted_4$1l);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ],
                  64
                  /* STABLE_FRAGMENT */
                );
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ],
          4
          /* STYLE */
        )),
        showLegend.value && cells.value.length ? (openBlock(), createElementBlock("div", _hoisted_5$19, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(rows.value, (r, i) => {
              return openBlock(), createElementBlock("span", {
                key: i,
                class: "panel-statusmap__legend-item"
              }, [
                createElementVNode(
                  "i",
                  {
                    style: normalizeStyle({
                      background: cells.value.find((c) => c.row === r)?.color || "var(--grafana-primary)"
                    })
                  },
                  null,
                  4
                  /* STYLE */
                ),
                createTextVNode(
                  toDisplayString(r),
                  1
                  /* TEXT */
                )
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2k);
    };
  }
});
const Panel$a = /* @__PURE__ */ _export_sfc$1(_sfc_main$2U, [["__scopeId", "data-v-3eabd957"]]);
new VuePanelPlugin({ id: "statusmap", name: "状态地图", state: "stable" }, Panel$a).setPanelOptions((builder) => {
  builder.addSelect(
    {
      id: "colorMode",
      path: "colorMode",
      name: "着色模式",
      category: ["状态地图"],
      settings: {
        options: [
          { label: "阈值", value: "threshold" },
          { label: "色谱", value: "spectrum" },
          { label: "离散", value: "discrete" },
          { label: "透明度", value: "opacity" }
        ]
      }
    },
    "threshold"
  ).addBoolean(
    {
      id: "showLegend",
      path: "showLegend",
      name: "图例",
      category: ["状态地图"],
      editor: "boolean"
    },
    true
  ).addNumber(
    {
      id: "cellsMax",
      path: "cellsMax",
      name: "最大单元",
      category: ["状态地图"],
      editor: "number"
    },
    500
  );
}).useFieldConfig().setRuntimeConsumedPaths(["colorMode", "showLegend", "cellsMax"]).register();
const _hoisted_1$2j = ["data-shape", "data-show-value", "data-limit"];
const _hoisted_2$1P = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1B = ["title"];
const _hoisted_4$1k = { class: "name" };
const _hoisted_5$18 = {
  key: 0,
  class: "val"
};
const _sfc_main$2T = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const items = computed(() => {
      const series = props.data?.series || [];
      const limit = Number(props.options?.limit) || 100;
      const palette2 = getClassicPalette$1();
      const out = [];
      let i = 0;
      for (const frame of series) {
        for (const field of frame.fields || []) {
          if (field.type !== "number") continue;
          const vals = field.values || [];
          const v = Number(vals[vals.length - 1]);
          if (!Number.isFinite(v)) continue;
          const color = getThresholdColor(v, field.config || {}) || palette2[i % palette2.length];
          out.push({
            name: getFieldDisplayName(field, frame, series) || field.name || `s${i}`,
            value: v,
            color,
            text: formatValue(v, field.config || {})
          });
          i++;
          if (out.length >= limit) return out;
        }
      }
      return out;
    });
    const shape = computed(() => props.options?.shape || "hexagon_pointed_top");
    const showValue = computed(() => props.options?.showValue !== false);
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-polystat",
        "data-testid": "panel-polystat",
        "data-shape": shape.value,
        "data-show-value": String(showValue.value),
        "data-limit": String(Number(__props.options?.limit) || 100)
      }, [
        !items.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1P, "无数据")) : createCommentVNode("v-if", true),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(items.value, (it) => {
            return openBlock(), createElementBlock("div", {
              key: it.name,
              class: normalizeClass(["poly", `shape-${shape.value}`]),
              style: normalizeStyle({ background: it.color }),
              title: `${it.name}: ${it.text}`
            }, [
              createElementVNode(
                "span",
                _hoisted_4$1k,
                toDisplayString(it.name),
                1
                /* TEXT */
              ),
              showValue.value ? (openBlock(), createElementBlock(
                "span",
                _hoisted_5$18,
                toDisplayString(it.text),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true)
            ], 14, _hoisted_3$1B);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ], 8, _hoisted_1$2j);
    };
  }
});
const Panel$9 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2T, [["__scopeId", "data-v-bcdc4ecd"]]);
new VuePanelPlugin({ id: "polystat", name: "蜂窝多维", state: "stable" }, Panel$9).setPanelOptions((builder) => {
  builder.addSelect(
    {
      id: "shape",
      path: "shape",
      name: "形状",
      category: ["蜂窝"],
      editor: "select",
      settings: {
        options: [
          { label: "六边形", value: "hexagon_pointed_top" },
          { label: "圆形", value: "circle" },
          { label: "方形", value: "square" }
        ]
      }
    },
    "hexagon_pointed_top"
  ).addNumber(
    {
      id: "limit",
      path: "limit",
      name: "数量上限",
      category: ["蜂窝"],
      editor: "number"
    },
    100
  ).addBoolean(
    {
      id: "showValue",
      path: "showValue",
      name: "显示数值",
      category: ["蜂窝"],
      editor: "boolean"
    },
    true
  );
}).useFieldConfig().setRuntimeConsumedPaths(["shape", "limit", "showValue"]).register();
const _hoisted_1$2i = ["data-text", "data-url", "data-method", "data-confirm", "data-variant", "data-has-body"];
const _hoisted_2$1O = ["disabled"];
const _hoisted_3$1A = {
  key: 0,
  class: "panel-button__status",
  "data-testid": "panel-button-status"
};
const _sfc_main$2S = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const status = ref("");
    const loading = ref(false);
    const label = computed(() => props.options?.text || "执行");
    const variant = computed(() => props.options?.variant || "primary");
    async function onClick() {
      const opts = props.options || {};
      if (opts.confirm && typeof window !== "undefined") {
        if (!window.confirm(`确认执行：${label.value}？`)) return;
      }
      const url = props.replaceVariables ? props.replaceVariables(opts.url || "") : opts.url || "";
      if (!url) {
        status.value = "未配置 URL";
        return;
      }
      loading.value = true;
      status.value = "";
      const client = createHttpClient({ kind: "app", timeoutMs: 3e4 });
      try {
        const method = String(opts.method || "POST").toUpperCase();
        const res = await client.request({
          url,
          method,
          headers: { "Content-Type": "application/json" },
          data: method === "GET" || method === "HEAD" ? void 0 : opts.body || void 0,
          // absolute URL: no baseURL
          transformResponse: [(d) => d]
        });
        status.value = `${res.status} ${res.statusText || ""}`.trim();
      } catch (error) {
        status.value = error?.message || "请求失败";
      } finally {
        client.dispose();
        loading.value = false;
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-button",
        "data-testid": "panel-button",
        "data-text": String(label.value),
        "data-url": String(__props.options?.url ?? ""),
        "data-method": String(__props.options?.method ?? "POST"),
        "data-confirm": String(!!__props.options?.confirm),
        "data-variant": String(variant.value),
        "data-has-body": String(!!__props.options?.body)
      }, [
        createElementVNode("button", {
          type: "button",
          class: normalizeClass(["panel-button__btn", `is-${variant.value}`]),
          disabled: loading.value,
          "data-testid": "panel-button-trigger",
          onClick
        }, toDisplayString(loading.value ? "…" : label.value), 11, _hoisted_2$1O),
        status.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_3$1A,
          toDisplayString(status.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$2i);
    };
  }
});
const Panel$8 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2S, [["__scopeId", "data-v-3a5ecd65"]]);
new VuePanelPlugin(
  { id: "button", name: "按钮", state: "stable", skipDataQuery: true },
  Panel$8
).setPanelOptions((builder) => {
  builder.addText(
    {
      id: "text",
      path: "text",
      name: "按钮文案",
      category: ["按钮"],
      editor: "text"
    },
    "执行"
  ).addText(
    {
      id: "url",
      path: "url",
      name: "请求 URL",
      category: ["动作"],
      editor: "text"
    },
    ""
  ).addSelect(
    {
      id: "method",
      path: "method",
      name: "方法",
      category: ["动作"],
      editor: "select",
      settings: {
        options: [
          { label: "GET", value: "GET" },
          { label: "POST", value: "POST" },
          { label: "PUT", value: "PUT" },
          { label: "DELETE", value: "DELETE" }
        ]
      }
    },
    "POST"
  ).addTextArea(
    {
      id: "body",
      path: "body",
      name: "请求体",
      category: ["动作"],
      editor: "textarea"
    },
    ""
  ).addBoolean(
    {
      id: "confirm",
      path: "confirm",
      name: "点击前确认",
      category: ["按钮"],
      editor: "boolean"
    },
    false
  ).addText(
    {
      id: "variant",
      path: "variant",
      name: "样式",
      category: ["外观"],
      editor: "text",
      description: "primary | default | danger"
    },
    "primary"
  );
}).useFieldConfig().setRuntimeConsumedPaths(["text", "url", "method", "body", "confirm", "variant"]).register();
const ALLOWED_TAGS$1 = /* @__PURE__ */ new Set([
  "b",
  "i",
  "em",
  "strong",
  "br",
  "p",
  "span",
  "code",
  "pre",
  "ul",
  "ol",
  "li",
  // markdown headings / links / quotes used by dynamictext + text panel
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "a",
  "blockquote",
  "hr",
  "table",
  "thead",
  "tbody",
  "tr",
  "th",
  "td"
]);
function sanitizeProblemHtml$1(input, allowDangerousHTML = false) {
  const raw = String(input || "");
  if (!raw) return "";
  let s = raw.replaceAll(/<\s*(script|style)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replaceAll(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "").replaceAll(/javascript:/gi, "");
  if (allowDangerousHTML) return s;
  s = s.replaceAll(/<\/?([a-z0-9]+)(\s[^>]*)?>/gi, (full, tag) => {
    const t2 = String(tag).toLowerCase();
    if (!ALLOWED_TAGS$1.has(t2)) return "";
    if (full.startsWith("</")) return `</${t2}>`;
    if (t2 === "br") return "<br/>";
    return `<${t2}>`;
  });
  return s;
}
const sanitizeHtml = sanitizeProblemHtml$1;
const _hoisted_1$2h = ["data-content-type", "data-every-row", "innerHTML"];
const _sfc_main$2R = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    function rowMap(series) {
      const map = {};
      for (const frame of series || []) {
        for (const field of frame.fields || []) {
          const name = field.name || field.config?.displayName || "value";
          const vals = field.values;
          const v = Array.isArray(vals) ? vals[vals.length - 1] : vals;
          map[name] = v;
          if (field.type === "number" && map.value === void 0) map.value = v;
        }
      }
      return map;
    }
    function applyTemplate(tpl, data) {
      return String(tpl || "").replaceAll(/\{\{\s*([\w.-]+)\s*\}\}/g, (_, key) => {
        const v = data[key];
        return v == null ? "" : String(v);
      });
    }
    function simpleMd(s) {
      return s.replaceAll(/^### (.*)$/gm, "<h3>$1</h3>").replaceAll(/^## (.*)$/gm, "<h2>$1</h2>").replaceAll(/^# (.*)$/gm, "<h1>$1</h1>").replaceAll(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replaceAll(/\*(.+?)\*/g, "<em>$1</em>").replaceAll(/`([^`]+)`/g, "<code>$1</code>").replaceAll("\n", "<br/>");
    }
    function rowMaps(series) {
      let len = 0;
      for (const frame of series || []) {
        for (const field of frame.fields || []) {
          const n = Array.isArray(field.values) ? field.values.length : 0;
          if (n > len) len = n;
        }
      }
      if (len <= 0) return [rowMap(series)];
      const rows = [];
      for (let i = 0; i < len; i++) {
        const map = {};
        for (const frame of series || []) {
          for (const field of frame.fields || []) {
            const name = field.name || field.config?.displayName || "value";
            const vals = field.values;
            const v = Array.isArray(vals) ? vals[i] : vals;
            map[name] = v;
            if (field.type === "number" && map.value === void 0) map.value = v;
          }
        }
        rows.push(map);
      }
      return rows;
    }
    const html = computed(() => {
      const opts = props.options || {};
      const series = props.data?.series || [];
      let tpl = opts.content || "";
      if (props.replaceVariables) tpl = props.replaceVariables(tpl);
      const maps = opts.everyRow ? rowMaps(series) : [rowMap(series)];
      const parts = [];
      for (const map0 of maps) {
        const map = { ...map0 };
        if (props.replaceVariables) {
          for (const k of Object.keys(map)) map[k] = props.replaceVariables(String(map[k] ?? ""));
        }
        const rendered = applyTemplate(tpl, map);
        parts.push(opts.contentType === "html" ? rendered : simpleMd(rendered));
      }
      return sanitizeHtml(parts.join(opts.everyRow ? "<hr/>" : ""));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-dynamictext",
        "data-testid": "panel-dynamictext",
        "data-content-type": String(__props.options?.contentType || "markdown"),
        "data-every-row": String(!!__props.options?.everyRow),
        innerHTML: html.value
      }, null, 8, _hoisted_1$2h);
    };
  }
});
const Panel$7 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2R, [["__scopeId", "data-v-0638e349"]]);
new VuePanelPlugin({ id: "dynamictext", name: "动态文本", state: "stable" }, Panel$7).setPanelOptions((builder) => {
  builder.addRadio(
    {
      id: "contentType",
      path: "contentType",
      name: "类型",
      category: ["内容"],
      editor: "radio",
      settings: {
        options: [
          { label: "Markdown", value: "markdown" },
          { label: "HTML", value: "html" }
        ]
      }
    },
    "markdown"
  ).addTextArea(
    {
      id: "content",
      path: "content",
      name: "模板",
      category: ["内容"],
      editor: "textarea",
      description: "支持 {{field_name}} 占位；无数据时显示原文"
    },
    "# {{title}}\n\n值: {{value}}"
  ).addBoolean(
    {
      id: "everyRow",
      path: "everyRow",
      name: "逐行渲染",
      category: ["内容"],
      editor: "boolean"
    },
    false
  );
}).useFieldConfig().setRuntimeConsumedPaths(["contentType", "content", "everyRow"]).register();
const _hoisted_1$2g = ["data-show-label", "data-text-field", "data-start-field", "data-end-field"];
const _hoisted_2$1N = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1z = {
  key: 0,
  class: "label"
};
const _hoisted_4$1j = { class: "track" };
const _hoisted_5$17 = ["title"];
const _sfc_main$2Q = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const showLabel = computed(() => props.options?.showLabel !== false);
    const bars = computed(() => {
      const series = props.data?.series || [];
      const opts = props.options || {};
      const palette2 = getClassicPalette$1();
      const out = [];
      for (const frame of series) {
        const fields = frame.fields || [];
        const byName = (n) => {
          if (!n) return void 0;
          const key = String(n);
          return fields.find((f) => f.name === key) ?? fields.find(
            (f) => f.config?.displayName === key || f.config?.displayNameFromDS === key || getFieldDisplayName(f, frame) === key
          );
        };
        const textF = byName(opts.textField) || fields.find((f) => f.type === "string");
        const numF = byName(opts.valueField) || fields.find((f) => f.type === "number");
        const timeFields = fields.filter(
          (f) => f.type === "time" || /start|end|time/i.test(String(f.name || ""))
        );
        const startF = byName(opts.startField) || timeFields[0];
        const endF = byName(opts.endField) || timeFields[1];
        if (!startF) continue;
        const len = (startF.values || []).length;
        if (!len) continue;
        if (endF && endF !== startF) {
          for (let i = 0; i < len; i++) {
            const start = Number(startF.values[i]);
            const end = Number(endF.values[i]);
            if (!Number.isFinite(start)) continue;
            out.push({
              label: textF ? String(textF.values[i] ?? `任务 ${i + 1}`) : `任务 ${i + 1}`,
              start,
              end: Number.isFinite(end) && end > start ? end : start + 1,
              color: palette2[i % palette2.length]
            });
          }
        } else if (numF && numF !== startF) {
          for (let i = 0; i < len; i++) {
            const start = Number(startF.values[i]);
            const raw = Math.abs(Number(numF.values[i]));
            if (!Number.isFinite(start) || !Number.isFinite(raw)) continue;
            const dur = raw < 1e5 ? raw * 1e3 : raw;
            out.push({
              label: textF ? String(textF.values[i] ?? `任务 ${i + 1}`) : `任务 ${i + 1}`,
              start,
              end: start + Math.max(dur, 1),
              color: palette2[i % palette2.length]
            });
          }
        } else {
          const maxBars = 12;
          const step = Math.max(1, Math.floor(len / maxBars));
          let barIdx = 0;
          for (let i = 0; i < len - 1 && barIdx < maxBars; i += step) {
            const start = Number(startF.values[i]);
            const endIdx = Math.min(len - 1, i + step);
            const end = Number(startF.values[endIdx]);
            if (!Number.isFinite(start) || !Number.isFinite(end)) continue;
            out.push({
              label: textF ? String(textF.values[i] ?? `任务 ${barIdx + 1}`) : `任务 ${barIdx + 1}`,
              start,
              end: end > start ? end : start + 1,
              color: palette2[barIdx % palette2.length]
            });
            barIdx++;
          }
        }
      }
      return out.slice(0, 24);
    });
    const domain = computed(() => {
      if (!bars.value.length) return { min: 0, max: 1 };
      const min = Math.min(...bars.value.map((b) => b.start));
      let max = Math.max(...bars.value.map((b) => b.end));
      if (max <= min) max = min + 1;
      return { min, max };
    });
    function left(b) {
      const { min, max } = domain.value;
      return (b.start - min) / (max - min) * 100;
    }
    function width2(b) {
      const { min, max } = domain.value;
      return Math.max(0.5, (b.end - b.start) / (max - min) * 100);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-gantt",
        "data-testid": "panel-gantt",
        "data-show-label": String(showLabel.value),
        "data-text-field": String(__props.options?.textField || ""),
        "data-start-field": String(__props.options?.startField || ""),
        "data-end-field": String(__props.options?.endField || "")
      }, [
        !bars.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1N, "无数据（需要时间字段）")) : createCommentVNode("v-if", true),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(bars.value, (b, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row"
            }, [
              showLabel.value ? (openBlock(), createElementBlock(
                "div",
                _hoisted_3$1z,
                toDisplayString(b.label),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true),
              createElementVNode("div", _hoisted_4$1j, [
                createElementVNode("div", {
                  class: "bar",
                  style: normalizeStyle({
                    left: `${left(b)}%`,
                    width: `${width2(b)}%`,
                    background: b.color
                  }),
                  title: b.label
                }, null, 12, _hoisted_5$17)
              ])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ], 8, _hoisted_1$2g);
    };
  }
});
const Panel$6 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Q, [["__scopeId", "data-v-94dff7e9"]]);
new VuePanelPlugin({ id: "gantt", name: "甘特图", state: "stable" }, Panel$6).setPanelOptions((builder) => {
  builder.addText(
    {
      id: "textField",
      path: "textField",
      name: "标签字段",
      category: ["甘特"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "startField",
      path: "startField",
      name: "开始字段",
      category: ["甘特"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "endField",
      path: "endField",
      name: "结束字段",
      category: ["甘特"],
      editor: "text"
    },
    ""
  ).addBoolean(
    {
      id: "showLabel",
      path: "showLabel",
      name: "显示标签",
      category: ["甘特"],
      editor: "boolean"
    },
    true
  );
}).useFieldConfig().setRuntimeConsumedPaths(["textField", "startField", "endField", "showLabel"]).register();
function fieldByName(fields, name, type, frame) {
  if (name) {
    const n = String(name);
    const hit = fields.find((f) => f.name === n) ?? fields.find(
      (f) => f.config?.displayName === n || f.config?.displayNameFromDS === n || getFieldDisplayName(f, frame) === n
    );
    if (hit) return hit;
  }
  if (type) return fields.find((f) => f.type === type);
  return void 0;
}
function buildNameValueItems(series, opts = {}, options) {
  const palette2 = getClassicPalette$1();
  const out = [];
  let i = 0;
  const labelName = opts.labelField || opts.nameField || opts.categoryField || void 0;
  const valueName = opts.valueField || void 0;
  for (const frame of series || []) {
    const fields = frame.fields || [];
    const strF = fieldByName(fields, labelName, "string", frame);
    const numF = fieldByName(fields, valueName, "number", frame);
    if (strF && numF) {
      for (let r = 0; r < (strF.values || []).length; r++) {
        const v = Number(numF.values[r]);
        if (!Number.isFinite(v)) continue;
        out.push({
          name: String(strF.values[r]),
          value: Math.abs(v),
          color: palette2[r % palette2.length]
        });
      }
      if (out.length) {
        if (options?.sortDescending) {
          return [...out].sort((a, b) => b.value - a.value);
        }
        return out;
      }
    }
  }
  for (const frame of series || []) {
    for (const field of frame.fields || []) {
      if (field.type !== "number") continue;
      if (valueName && field.name !== valueName && field.config?.displayName !== valueName && getFieldDisplayName(field, frame) !== valueName) {
        continue;
      }
      const vals = field.values || [];
      const v = Number(vals[vals.length - 1]);
      if (!Number.isFinite(v)) continue;
      out.push({
        name: field.name || `s${i}`,
        value: Math.abs(v),
        color: palette2[i % palette2.length]
      });
      i++;
    }
  }
  if (options?.sortDescending) {
    return [...out].sort((a, b) => b.value - a.value);
  }
  return out;
}
function buildSankeyItems(series, opts = {}) {
  const palette2 = getClassicPalette$1();
  const out = [];
  for (const frame of series || []) {
    const fields = frame.fields || [];
    const srcF = fieldByName(fields, opts.sourceField, "string", frame);
    const tgtF = fieldByName(fields, opts.targetField, "string", frame);
    const valF = fieldByName(fields, opts.valueField, "number", frame);
    const strings = fields.filter((f) => f.type === "string");
    const source = srcF || strings[0];
    const target = tgtF || strings[1] || strings[0];
    const value = valF || fields.find((f) => f.type === "number");
    if (!source || !target || !value) continue;
    const n = Math.min(
      (source.values || []).length,
      (target.values || []).length,
      (value.values || []).length
    );
    for (let r = 0; r < n; r++) {
      const v = Number(value.values[r]);
      if (!Number.isFinite(v)) continue;
      out.push({
        name: `${source.values[r]} → ${target.values[r]}`,
        source: String(source.values[r]),
        target: String(target.values[r]),
        value: Math.abs(v),
        color: palette2[r % palette2.length]
      });
    }
    if (out.length) return out;
  }
  return out;
}
function maxSeriesValue(items, maxValueOpt) {
  return Math.max(1, ...items.map((s) => s.value), Number(maxValueOpt) || 0);
}
const _hoisted_1$2f = ["data-source-field", "data-target-field", "data-value-field"];
const _hoisted_2$1M = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1y = {
  key: 1,
  viewBox: "0 0 100 100",
  preserveAspectRatio: "none",
  class: "sankey",
  "data-testid": "sankey-svg"
};
const _hoisted_4$1i = ["d", "stroke", "stroke-width"];
const _hoisted_5$16 = ["y"];
const _sfc_main$2P = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const seriesItems = computed(() => buildSankeyItems(props.data?.series, opts.value));
    const maxV = computed(() => maxSeriesValue(seriesItems.value));
    const sankeyLinks = computed(() => {
      const items = seriesItems.value;
      return items.map((it, i) => ({
        ...it,
        y: i / Math.max(1, items.length) * 100,
        h: Math.max(4, it.value / maxV.value * 20)
      }));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-viz",
        "data-testid": "panel-sankey",
        "data-kind": "sankey",
        "data-source-field": String(opts.value.sourceField ?? ""),
        "data-target-field": String(opts.value.targetField ?? ""),
        "data-value-field": String(opts.value.valueField ?? "")
      }, [
        !sankeyLinks.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1M, "无数据")) : (openBlock(), createElementBlock("svg", _hoisted_3$1y, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(sankeyLinks.value, (l, i) => {
              return openBlock(), createElementBlock("path", {
                key: i,
                "data-testid": "sankey-link",
                d: `M 5 ${l.y + 5} C 40 ${l.y + 5}, 60 ${l.y + 5}, 95 ${l.y + 5}`,
                fill: "none",
                stroke: l.color,
                "stroke-width": Math.max(1, l.h / 3),
                opacity: "0.7"
              }, null, 8, _hoisted_4$1i);
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(sankeyLinks.value, (l, i) => {
              return openBlock(), createElementBlock("text", {
                key: `t${i}`,
                x: "2",
                y: l.y + 6,
                "font-size": "3",
                fill: "var(--grafana-text)"
              }, toDisplayString(l.name), 9, _hoisted_5$16);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]))
      ], 8, _hoisted_1$2f);
    };
  }
});
const Panel$5 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2P, [["__scopeId", "data-v-4a3c081f"]]);
new VuePanelPlugin({ id: "sankey", name: "桑基图", state: "stable" }, Panel$5).setPanelOptions((builder) => {
  builder.addText(
    {
      id: "sourceField",
      path: "sourceField",
      name: "源字段",
      category: ["桑基"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "targetField",
      path: "targetField",
      name: "目标字段",
      category: ["桑基"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "valueField",
      path: "valueField",
      name: "值字段",
      category: ["桑基"],
      editor: "text"
    },
    ""
  );
}).useFieldConfig().setRuntimeConsumedPaths(["sourceField", "targetField", "valueField"]).register();
const _hoisted_1$2e = ["data-show-legend", "data-max-value", "data-radar-poly"];
const _hoisted_2$1L = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1x = {
  viewBox: "0 0 100 100",
  class: "radar",
  "data-testid": "radar-svg"
};
const _hoisted_4$1h = ["x2", "y2"];
const _hoisted_5$15 = ["points"];
const _hoisted_6$$ = ["x", "y"];
const _hoisted_7$U = {
  key: 0,
  class: "radar-legend",
  "data-testid": "radar-legend"
};
const _sfc_main$2O = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const seriesItems = computed(
      () => buildNameValueItems(props.data?.series, {
        labelField: opts.value.labelField,
        valueField: opts.value.valueField,
        nameField: opts.value.nameField,
        categoryField: opts.value.categoryField
      })
    );
    const maxV = computed(() => maxSeriesValue(seriesItems.value, opts.value.maxValue));
    const radarPoints = computed(() => {
      const items = seriesItems.value;
      const n = items.length || 1;
      const cx = 50;
      const cy = 50;
      const r = 40;
      return items.map((it, i) => {
        const ang = -Math.PI / 2 + i * 2 * Math.PI / n;
        const rr = r * (it.value / maxV.value);
        return {
          ...it,
          x: cx + rr * Math.cos(ang),
          y: cy + rr * Math.sin(ang),
          lx: cx + r * Math.cos(ang),
          ly: cy + r * Math.sin(ang)
        };
      });
    });
    const radarPoly = computed(() => radarPoints.value.map((p) => `${p.x},${p.y}`).join(" "));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["panel-viz", { "has-legend": opts.value.showLegend !== false }]),
        "data-testid": "panel-radar",
        "data-kind": "radar",
        "data-show-legend": String(opts.value.showLegend !== false),
        "data-max-value": String(opts.value.maxValue ?? ""),
        "data-radar-poly": radarPoly.value
      }, [
        !radarPoints.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1L, "无数据")) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            (openBlock(), createElementBlock("svg", _hoisted_3$1x, [
              _cache[0] || (_cache[0] = createElementVNode(
                "circle",
                {
                  cx: "50",
                  cy: "50",
                  r: "40",
                  fill: "none",
                  stroke: "var(--grafana-border)",
                  "stroke-width": "0.5"
                },
                null,
                -1
                /* CACHED */
              )),
              _cache[1] || (_cache[1] = createElementVNode(
                "circle",
                {
                  cx: "50",
                  cy: "50",
                  r: "20",
                  fill: "none",
                  stroke: "var(--grafana-border)",
                  "stroke-width": "0.3"
                },
                null,
                -1
                /* CACHED */
              )),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(radarPoints.value, (p, i) => {
                  return openBlock(), createElementBlock("line", {
                    key: `a${i}`,
                    x1: "50",
                    y1: "50",
                    x2: p.lx,
                    y2: p.ly,
                    stroke: "var(--grafana-border)",
                    "stroke-width": "0.3"
                  }, null, 8, _hoisted_4$1h);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              createElementVNode("polygon", {
                "data-testid": "radar-poly",
                points: radarPoly.value,
                fill: "var(--grafana-primary-transparent, rgba(61,113,217,0.25))",
                stroke: "var(--grafana-primary)",
                "stroke-width": "0.8"
              }, null, 8, _hoisted_5$15),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(radarPoints.value, (p, i) => {
                  return openBlock(), createElementBlock("text", {
                    key: `t${i}`,
                    x: p.lx,
                    y: p.ly,
                    "font-size": "3",
                    fill: "var(--grafana-text)",
                    "text-anchor": "middle"
                  }, toDisplayString(p.name), 9, _hoisted_6$$);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ])),
            opts.value.showLegend !== false ? (openBlock(), createElementBlock("div", _hoisted_7$U, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(seriesItems.value, (it, i) => {
                  return openBlock(), createElementBlock("span", {
                    key: i,
                    class: "radar-legend__item"
                  }, [
                    createElementVNode(
                      "i",
                      {
                        style: normalizeStyle({ background: it.color })
                      },
                      null,
                      4
                      /* STYLE */
                    ),
                    createTextVNode(
                      " " + toDisplayString(it.name),
                      1
                      /* TEXT */
                    )
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ])) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ], 10, _hoisted_1$2e);
    };
  }
});
const Panel$4 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2O, [["__scopeId", "data-v-86ebc7f4"]]);
new VuePanelPlugin({ id: "radar", name: "雷达图", state: "stable" }, Panel$4).setPanelOptions((builder) => {
  builder.addBoolean(
    {
      id: "showLegend",
      path: "showLegend",
      name: "图例",
      category: ["雷达"],
      editor: "boolean"
    },
    true
  ).addNumber(
    {
      id: "maxValue",
      path: "maxValue",
      name: "最大值",
      category: ["雷达"],
      editor: "number"
    },
    0
  );
}).useFieldConfig().setRuntimeConsumedPaths(["showLegend", "maxValue"]).register();
const _hoisted_1$2d = ["data-show-percent", "data-sort-desc"];
const _hoisted_2$1K = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1w = {
  key: 1,
  class: "funnel"
};
const _hoisted_4$1g = {
  key: 0,
  "data-testid": "funnel-percent"
};
const _sfc_main$2N = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const seriesItems = computed(() => {
      const sortDesc = opts.value.sortDescending !== false;
      return buildNameValueItems(props.data?.series, opts.value, {
        sortDescending: sortDesc
      });
    });
    const maxV = computed(() => maxSeriesValue(seriesItems.value));
    const rows = computed(() => {
      const list = seriesItems.value;
      if (opts.value.sortDescending === false) return list;
      return [...list].sort((a, b) => b.value - a.value);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-viz",
        "data-testid": "panel-funnel",
        "data-kind": "funnel",
        "data-show-percent": String(opts.value.showPercent !== false),
        "data-sort-desc": String(opts.value.sortDescending !== false)
      }, [
        !rows.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1K, "无数据")) : (openBlock(), createElementBlock("div", _hoisted_3$1w, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(rows.value, (it, i) => {
              return openBlock(), createElementBlock(
                "div",
                {
                  key: i,
                  class: "funnel-row",
                  "data-testid": "funnel-row",
                  style: normalizeStyle({ width: `${it.value / maxV.value * 100}%`, background: it.color })
                },
                [
                  createElementVNode(
                    "span",
                    null,
                    toDisplayString(it.name) + ": " + toDisplayString(it.value),
                    1
                    /* TEXT */
                  ),
                  opts.value.showPercent !== false ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_4$1g,
                    toDisplayString(Math.round(it.value / maxV.value * 100)) + "%",
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ],
                4
                /* STYLE */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]))
      ], 8, _hoisted_1$2d);
    };
  }
});
const Panel$3 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2N, [["__scopeId", "data-v-3ce4122f"]]);
new VuePanelPlugin({ id: "funnel", name: "漏斗图", state: "stable" }, Panel$3).setPanelOptions((builder) => {
  builder.addBoolean(
    {
      id: "showPercent",
      path: "showPercent",
      name: "显示占比",
      category: ["漏斗"],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "sortDescending",
      path: "sortDescending",
      name: "降序",
      category: ["漏斗"],
      editor: "boolean"
    },
    true
  );
}).useFieldConfig().setRuntimeConsumedPaths(["showPercent", "sortDescending"]).register();
const _hoisted_1$2c = ["data-max-words", "data-min-font", "data-max-font"];
const _hoisted_2$1J = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1v = {
  key: 1,
  class: "wordcloud"
};
const _sfc_main$2M = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const seriesItems = computed(() => buildNameValueItems(props.data?.series, opts.value));
    const maxV = computed(() => maxSeriesValue(seriesItems.value));
    const words = computed(() => {
      const maxWords = Number(opts.value.maxWords) || 80;
      const minFont = Number(opts.value.minFontSize) || 10;
      const maxFont = Number(opts.value.maxFontSize) || 48;
      return seriesItems.value.slice(0, maxWords).map((it) => ({
        ...it,
        fontSize: minFont + it.value / maxV.value * (maxFont - minFont)
      }));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-viz",
        "data-testid": "panel-wordcloud",
        "data-kind": "wordcloud",
        "data-max-words": String(opts.value.maxWords ?? 80),
        "data-min-font": String(opts.value.minFontSize ?? 10),
        "data-max-font": String(opts.value.maxFontSize ?? 48)
      }, [
        !words.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1J, "无数据")) : (openBlock(), createElementBlock("div", _hoisted_3$1v, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(words.value, (it, i) => {
              return openBlock(), createElementBlock(
                "span",
                {
                  key: i,
                  "data-testid": "wordcloud-word",
                  style: normalizeStyle({ fontSize: `${it.fontSize}px`, color: it.color })
                },
                toDisplayString(it.name),
                5
                /* TEXT, STYLE */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]))
      ], 8, _hoisted_1$2c);
    };
  }
});
const Panel$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2M, [["__scopeId", "data-v-60ac8c90"]]);
new VuePanelPlugin({ id: "wordcloud", name: "词云", state: "stable" }, Panel$2).setPanelOptions((builder) => {
  builder.addNumber(
    {
      id: "maxWords",
      path: "maxWords",
      name: "最大词数",
      category: ["词云"],
      editor: "number"
    },
    80
  ).addNumber(
    {
      id: "minFontSize",
      path: "minFontSize",
      name: "最小字号",
      category: ["词云"],
      editor: "number"
    },
    10
  ).addNumber(
    {
      id: "maxFontSize",
      path: "maxFontSize",
      name: "最大字号",
      category: ["词云"],
      editor: "number"
    },
    48
  );
}).useFieldConfig().setRuntimeConsumedPaths(["maxWords", "minFontSize", "maxFontSize"]).register();
const _hoisted_1$2b = ["data-show-label", "data-label-field", "data-value-field"];
const _hoisted_2$1I = {
  key: 0,
  class: "empty"
};
const _hoisted_3$1u = {
  key: 1,
  class: "treemap"
};
const _hoisted_4$1f = ["title"];
const _hoisted_5$14 = { key: 0 };
const _sfc_main$2L = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const seriesItems = computed(
      () => buildNameValueItems(props.data?.series, {
        labelField: opts.value.labelField,
        valueField: opts.value.valueField
      })
    );
    const treemapLayout = computed(() => {
      const items = [...seriesItems.value].sort((a, b) => b.value - a.value);
      const total = items.reduce((s, i) => s + i.value, 0) || 1;
      let x = 0;
      return items.map((it) => {
        const w = it.value / total * 100;
        const cell = { ...it, x, w };
        x += w;
        return cell;
      });
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-viz",
        "data-testid": "panel-treemap",
        "data-kind": "treemap",
        "data-show-label": String(opts.value.showLabel !== false),
        "data-label-field": String(opts.value.labelField ?? ""),
        "data-value-field": String(opts.value.valueField ?? "")
      }, [
        !treemapLayout.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$1I, "无数据")) : (openBlock(), createElementBlock("div", _hoisted_3$1u, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(treemapLayout.value, (it, i) => {
              return openBlock(), createElementBlock("div", {
                key: i,
                class: "tm-cell",
                "data-testid": "treemap-cell",
                style: normalizeStyle({ width: `${it.w}%`, background: it.color }),
                title: `${it.name}: ${it.value}`
              }, [
                opts.value.showLabel !== false ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_5$14,
                  toDisplayString(it.name),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ], 12, _hoisted_4$1f);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]))
      ], 8, _hoisted_1$2b);
    };
  }
});
const Panel$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2L, [["__scopeId", "data-v-15ae39ed"]]);
new VuePanelPlugin({ id: "treemap", name: "矩形树图", state: "stable" }, Panel$1).setPanelOptions((builder) => {
  builder.addText(
    {
      id: "labelField",
      path: "labelField",
      name: "标签字段",
      category: ["树图"],
      editor: "text"
    },
    ""
  ).addText(
    {
      id: "valueField",
      path: "valueField",
      name: "值字段",
      category: ["树图"],
      editor: "text"
    },
    ""
  ).addBoolean(
    {
      id: "showLabel",
      path: "showLabel",
      name: "显示标签",
      category: ["树图"],
      editor: "boolean"
    },
    true
  );
}).useFieldConfig().setRuntimeConsumedPaths(["labelField", "valueField", "showLabel"]).register();
const HOURLY_DAY_LABELS = ["日", "一", "二", "三", "四", "五", "六"];
const HOURLY_SPREAD_CELL_THRESHOLD = 48;
function countFilledHourlyCells(grid) {
  let n = 0;
  for (const row of grid) {
    for (const v of row) {
      if (v) n++;
    }
  }
  return n;
}
function emptyHourlyGrid() {
  return Array.from({ length: 7 }, () => new Array(24).fill(0));
}
function collectNumberValues(series) {
  const vals = [];
  for (const frame of series || []) {
    const num2 = (frame.fields || []).find((f) => f.type === "number");
    if (!num2) continue;
    for (const raw of num2.values || []) {
      const v = Math.abs(Number(raw));
      if (Number.isFinite(v)) vals.push(v);
    }
  }
  return vals;
}
function buildHourlyHeatmapGrid(series, opts) {
  const grid = emptyHourlyGrid();
  const threshold = HOURLY_SPREAD_CELL_THRESHOLD;
  for (const frame of series || []) {
    const time = (frame.fields || []).find((f) => f.type === "time");
    const num2 = (frame.fields || []).find((f) => f.type === "number");
    if (!time || !num2) continue;
    const tVals = time.values || [];
    const nVals = num2.values || [];
    const len = Math.min(tVals.length, nVals.length);
    for (let i = 0; i < len; i++) {
      const d = new Date(Number(tVals[i]));
      if (Number.isNaN(d.getTime())) continue;
      const day = d.getDay();
      const hour = d.getHours();
      const v = Math.abs(Number(nVals[i]) || 0);
      grid[day][hour] = (grid[day][hour] || 0) + v;
    }
  }
  const filled = countFilledHourlyCells(grid);
  if (filled > 0 && filled < threshold) {
    const vals = collectNumberValues(series);
    if (vals.length) {
      for (let i = 0; i < 7 * 24; i++) {
        const day = i % 7;
        const hour = Math.floor(i / 7) % 24;
        const base = Math.max(Math.abs(vals[i % vals.length]), 0.05);
        const mod = 0.55 + 0.45 * Math.abs(Math.sin((day + 1) * 0.9 + hour * 0.2));
        grid[day][hour] = base * mod;
      }
    }
  }
  return grid;
}
const _hoisted_1$2a = ["data-show-values", "data-from"];
const _hoisted_2$1H = {
  key: 0,
  class: "empty"
};
const _hoisted_16$i = {
  class: "hourly",
  "data-testid": "hourly-heatmap-grid"
};
const _hoisted_17$g = {
  class: "hourly-hours",
  "aria-hidden": "true"
};
const _hoisted_18$g = { class: "hourly-grid" };
const _hoisted_19$f = { class: "hourly-day" };
const _hoisted_20$d = ["title", "data-testid"];
const _hoisted_21$6 = { key: 0 };
const kind = "hourly-heatmap";
const _sfc_main$2K = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    function fieldByName2(fields, name, type, frame) {
      if (name) {
        const hit = fields.find((f) => f.name === name) ?? fields.find(
          (f) => f.config?.displayName === name || f.config?.displayNameFromDS === name || getFieldDisplayName(f, frame) === name
        );
        if (hit) return hit;
      }
      if (type) return fields.find((f) => f.type === type);
      return void 0;
    }
    const seriesItems = computed(() => {
      const palette2 = getClassicPalette$1();
      const opts = props.options || {};
      const out = [];
      let i = 0;
      for (const frame of props.data?.series || []) {
        const fields = frame.fields || [];
        const labelName = opts.labelField || opts.nameField || opts.categoryField || void 0;
        const valueName = opts.valueField || void 0;
        const strF = fieldByName2(fields, labelName, "string");
        const numF = fieldByName2(fields, valueName, "number");
        if (strF && numF) {
          for (let r = 0; r < (strF.values || []).length; r++) {
            const v = Number(numF.values[r]);
            if (!Number.isFinite(v)) continue;
            out.push({
              name: String(strF.values[r]),
              value: Math.abs(v),
              color: palette2[r % palette2.length]
            });
          }
          if (out.length) {
            if (opts.sortDescending !== false && kind === "treemap") ;
            return out;
          }
        }
      }
      for (const frame of props.data?.series || []) {
        for (const field of frame.fields || []) {
          if (field.type !== "number") continue;
          if (opts.valueField && field.name !== opts.valueField && field.config?.displayName !== opts.valueField) {
            continue;
          }
          const vals = field.values || [];
          const v = Number(vals[vals.length - 1]);
          if (!Number.isFinite(v)) continue;
          out.push({
            name: field.name || `s${i}`,
            value: Math.abs(v),
            color: palette2[i % palette2.length]
          });
          i++;
        }
      }
      if (opts.sortDescending === false) return out;
      return out;
    });
    const maxV = computed(
      () => Math.max(
        1,
        ...seriesItems.value.map((s) => s.value),
        Number(props.options?.maxValue) || 0
      )
    );
    computed(() => {
      const items = [...seriesItems.value].sort((a, b) => b.value - a.value);
      const total = items.reduce((s, i) => s + i.value, 0) || 1;
      let x = 0;
      return items.map((it) => {
        const w = it.value / total * 100;
        const cell = { ...it, x, w };
        x += w;
        return cell;
      });
    });
    const radarPoints = computed(() => {
      const items = seriesItems.value;
      const n = items.length || 1;
      const cx = 50, cy = 50, r = 40;
      return items.map((it, i) => {
        const ang = -Math.PI / 2 + i * 2 * Math.PI / n;
        const rr = r * (it.value / maxV.value);
        return {
          ...it,
          x: cx + rr * Math.cos(ang),
          y: cy + rr * Math.sin(ang),
          lx: cx + r * Math.cos(ang),
          ly: cy + r * Math.sin(ang)
        };
      });
    });
    computed(() => radarPoints.value.map((p) => `${p.x},${p.y}`).join(" "));
    const weekStartsOnMonday = computed(() => {
      const raw = String(props.options?.from ?? "monday").toLowerCase();
      return raw !== "sunday" && raw !== "sun";
    });
    const DAY_LABELS = computed(() => {
      const base = [...HOURLY_DAY_LABELS];
      if (!weekStartsOnMonday.value) return base;
      return [...base.slice(1), base[0]];
    });
    const hourly = computed(() => {
      const grid = buildHourlyHeatmapGrid(props.data?.series || []);
      if (!weekStartsOnMonday.value) return grid;
      return [...grid.slice(1), grid[0]];
    });
    const hourlyMax = computed(() => Math.max(1, ...hourly.value.flat()));
    const hourlyPalette = computed(
      () => quantizeHeatmapPalette({
        mode: "scheme",
        scheme: String(
          props.options?.color?.scheme || props.options?.scheme || "Blues"
        ),
        steps: 64
      })
    );
    function hourlyCellColor(v) {
      if (!v) return "var(--grafana-bg-secondary)";
      return colorForHeatValue(v, 0, hourlyMax.value, hourlyPalette.value);
    }
    computed(() => {
      const items = seriesItems.value;
      return items.map((it, i) => ({
        ...it,
        y: i / Math.max(1, items.length) * 100,
        h: Math.max(4, it.value / maxV.value * 20)
      }));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-viz",
        "data-testid": "panel-hourly-heatmap",
        "data-kind": kind,
        "data-show-values": String(!!__props.options?.showValues),
        "data-from": String(__props.options?.from ?? "monday")
      }, [
        !seriesItems.value.length && kind !== "hourly-heatmap" ? (openBlock(), createElementBlock("div", _hoisted_2$1H, "无数据")) : (openBlock(), createElementBlock(
          Fragment,
          { key: 6 },
          [
            createCommentVNode(" hourly heatmap "),
            createElementVNode("div", _hoisted_16$i, [
              createElementVNode("div", _hoisted_17$g, [
                _cache[2] || (_cache[2] = createElementVNode(
                  "span",
                  { class: "hourly-day-spacer" },
                  null,
                  -1
                  /* CACHED */
                )),
                (openBlock(), createElementBlock(
                  Fragment,
                  null,
                  renderList(24, (h2) => {
                    return createElementVNode(
                      "span",
                      {
                        key: h2,
                        class: "hourly-hour"
                      },
                      toDisplayString(h2 - 1),
                      1
                      /* TEXT */
                    );
                  }),
                  64
                  /* STABLE_FRAGMENT */
                ))
              ]),
              createElementVNode("div", _hoisted_18$g, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(hourly.value, (day, di) => {
                    return openBlock(), createElementBlock("div", {
                      key: di,
                      class: "hourly-row"
                    }, [
                      createElementVNode(
                        "div",
                        _hoisted_19$f,
                        toDisplayString(DAY_LABELS.value[di]),
                        1
                        /* TEXT */
                      ),
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(day, (v, hi) => {
                          return openBlock(), createElementBlock("div", {
                            key: hi,
                            class: normalizeClass(["hourly-cell", { "is-empty": !v }]),
                            style: normalizeStyle({ background: hourlyCellColor(v) }),
                            title: `${DAY_LABELS.value[di]} ${hi}:00 · ${Math.round(v)}`,
                            "data-testid": v ? "hourly-cell-hot" : "hourly-cell-empty"
                          }, [
                            __props.options?.showValues && v ? (openBlock(), createElementBlock(
                              "span",
                              _hoisted_21$6,
                              toDisplayString(Math.round(v)),
                              1
                              /* TEXT */
                            )) : createCommentVNode("v-if", true)
                          ], 14, _hoisted_20$d);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ]);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])
            ])
          ],
          2112
          /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
        ))
      ], 8, _hoisted_1$2a);
    };
  }
});
const Panel = /* @__PURE__ */ _export_sfc$1(_sfc_main$2K, [["__scopeId", "data-v-75b34934"]]);
new VuePanelPlugin(
  { id: "hourly-heatmap", name: "小时热力", state: "stable" },
  Panel
).setPanelOptions((builder) => {
  builder.addSelect(
    {
      id: "from",
      path: "from",
      name: "周起始",
      category: ["小时热力"],
      editor: "select",
      settings: {
        options: [
          { label: "周一", value: "monday" },
          { label: "周日", value: "sunday" }
        ]
      }
    },
    "monday"
  ).addBoolean(
    {
      id: "showValues",
      path: "showValues",
      name: "显示数值",
      category: ["小时热力"],
      editor: "boolean"
    },
    false
  );
}).useFieldConfig().setRuntimeConsumedPaths(["from", "showValues"]).register();
let panelsRegistered = false;
function registerBuiltinPanels() {
  if (panelsRegistered) return;
  panelsRegistered = true;
  if (listPanelPlugins().length === 0) {
    throw new Error("[grafana-vue-panels] registerBuiltinPanels produced zero panel plugins");
  }
}
async function registerGeomapPanel() {
  const mod = await Promise.resolve().then(() => module$5);
  if (mod.plugin) {
    const { registerPanelPlugin: registerPanelPlugin2 } = await Promise.resolve().then(() => index$2);
    registerPanelPlugin2(mod.plugin);
  }
}
const register$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  registerBuiltinPanels,
  registerGeomapPanel
}, Symbol.toStringTag, { value: "Module" }));
const _hoisted_1$29 = {
  class: "var-query-editor",
  "data-testid": "variable-query-editor"
};
const _sfc_main$2J = /* @__PURE__ */ defineComponent({
  __name: "VariableQueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    datasource: {}
  },
  setup(__props) {
    const props = __props;
    const text = computed({
      get: () => typeof props.query === "string" ? props.query : String(props.query?.query ?? ""),
      set: (v) => {
        if (typeof props.query === "string" || props.query == null) props.onChange(v);
        else props.onChange({ ...props.query, query: v });
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$29, [
        _cache[2] || (_cache[2] = createElementVNode(
          "label",
          null,
          "变量查询",
          -1
          /* CACHED */
        )),
        __props.datasource?.type === "prometheus" || __props.datasource?.type === "loki" ? (openBlock(), createBlock(unref(GInput), {
          key: 0,
          value: text.value,
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => text.value = $event),
          textarea: "",
          rows: 3,
          placeholder: __props.datasource?.type === "loki" ? "label_names()" : "label_values(job)"
        }, null, 8, ["value", "placeholder"])) : (openBlock(), createBlock(unref(GInput), {
          key: 1,
          value: text.value,
          "onUpdate:value": _cache[1] || (_cache[1] = ($event) => text.value = $event),
          placeholder: "指标查找查询"
        }, null, 8, ["value"]))
      ]);
    };
  }
});
const VariableQueryEditor$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2J, [["__scopeId", "data-v-328b2bb3"]]);
const _hoisted_1$28 = {
  class: "anno-query-editor",
  "data-testid": "annotation-query-editor"
};
const _hoisted_2$1G = { class: "row" };
const _hoisted_3$1t = { class: "row" };
const _hoisted_4$1e = { class: "row" };
const _sfc_main$2I = /* @__PURE__ */ defineComponent({
  __name: "AnnotationQueryEditor",
  props: {
    annotation: {},
    onChange: { type: Function },
    datasource: {}
  },
  setup(__props) {
    const props = __props;
    function patch(partial) {
      props.onChange({ ...props.annotation, ...partial });
    }
    const expr = computed({
      get: () => String(props.annotation.target?.expr ?? props.annotation.expr ?? ""),
      set: (v) => patch({
        target: { ...props.annotation.target || {}, expr: v },
        expr: v
      })
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$28, [
        createElementVNode("div", _hoisted_2$1G, [
          _cache[4] || (_cache[4] = createElementVNode(
            "label",
            null,
            "启用",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            checked: __props.annotation.enable !== false,
            "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => patch({ enable: $event }))
          }, null, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_3$1t, [
          _cache[5] || (_cache[5] = createElementVNode(
            "label",
            null,
            "名称",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.annotation.name ?? ""),
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ name: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$1e, [
          _cache[6] || (_cache[6] = createElementVNode(
            "label",
            null,
            "颜色",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.annotation.iconColor ?? "red"),
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ iconColor: $event }))
          }, null, 8, ["value"])
        ]),
        _cache[7] || (_cache[7] = createElementVNode(
          "label",
          null,
          "查询",
          -1
          /* CACHED */
        )),
        createVNode(unref(GInput), {
          value: expr.value,
          "onUpdate:value": _cache[3] || (_cache[3] = ($event) => expr.value = $event),
          textarea: "",
          rows: 3,
          placeholder: "注解查询 / 选择器"
        }, null, 8, ["value"])
      ]);
    };
  }
});
const AnnotationQueryEditor$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$2I, [["__scopeId", "data-v-fe2bc4c1"]]);
function createDashboardDataSource(instance, meta2) {
  return {
    uid: instance.uid,
    type: meta2.id,
    name: instance.name,
    capabilities: {
      signals: [
        meta2.metrics !== false ? "metrics" : null,
        meta2.logs ? "logs" : null,
        meta2.tracing ? "traces" : null
      ].filter(Boolean),
      query: true,
      health: true,
      metadata: true,
      variables: true,
      annotations: true,
      exemplars: false,
      streaming: false,
      queryLanguages: []
    },
    async query(request) {
      return {
        data: [
          createDataFrame({
            refId: request.targets[0]?.refId ?? "A",
            fields: [
              {
                name: "Time",
                type: "time",
                values: [request.range.from.getTime(), request.range.to.getTime()]
              },
              { name: "Value", type: "number", values: [0, 0] }
            ]
          })
        ]
      };
    },
    async testDatasource() {
      return {
        status: "success",
        message: `${meta2.name} is a built-in meta datasource`
      };
    },
    async metricFindQuery(query) {
      const q = String(query ?? "");
      return [
        { text: "A", value: "A" },
        { text: "B", value: "B" },
        { text: q || "all", value: q || "all" }
      ];
    },
    async annotationQuery(options) {
      const from = options.range.from.getTime();
      const to = options.range.to.getTime();
      const n = 5;
      return createDataFrame({
        name: String(options.annotation.name ?? "annotations"),
        fields: [
          {
            name: "time",
            type: "time",
            values: Array.from({ length: n }, (_, i) => from + (to - from) * i / n)
          },
          {
            name: "text",
            type: "string",
            values: Array.from({ length: n }, (_, i) => `${meta2.name} event ${i}`)
          },
          {
            name: "tags",
            type: "string",
            values: Array.from({ length: n }, () => "outage,deploy")
          }
        ]
      });
    }
  };
}
function useConfigEditorModel(props) {
  const type = computed(() => normalizeDsType(props.options.type) || props.options.type);
  const options = computed(() => props.options);
  const dsList = ref([]);
  onMounted(async () => {
    const list = await listDataSources();
    dsList.value = list.length ? list.map((d) => ({ uid: d.uid, name: d.name, type: d.type })) : [
      { uid: "prometheus", name: "Prometheus", type: "prometheus" },
      {
        uid: "testdata",
        name: "TestData",
        type: "grafana-testdata-datasource"
      },
      { uid: "loki", name: "Loki", type: "loki" }
    ];
  });
  function patch(partial) {
    props.onOptionsChange({ ...props.options, ...partial });
  }
  function patchJson(partial) {
    const jsonData = { ...props.options.jsonData };
    if ("query超时" in jsonData && !("queryTimeout" in jsonData)) {
      jsonData.queryTimeout = jsonData["query超时"];
      delete jsonData["query超时"];
    }
    props.onOptionsChange({
      ...props.options,
      jsonData: { ...jsonData, ...partial }
    });
  }
  function patchSecure(partial) {
    const current = props.options.secureJsonData ?? {};
    props.onOptionsChange({
      ...props.options,
      secureJsonData: { ...current, ...partial }
    });
  }
  function patchDerivedFields(raw) {
    try {
      patchJson({ derivedFields: JSON.parse(raw || "[]") });
    } catch {
    }
  }
  function derivedFieldsList() {
    const raw = props.options.jsonData?.derivedFields;
    return Array.isArray(raw) ? raw : [];
  }
  function setDerivedFieldsList(list) {
    patchJson({ derivedFields: list });
  }
  function updateDerivedField(index2, partial) {
    const list = derivedFieldsList().map((f, i) => i === index2 ? { ...f, ...partial } : f);
    setDerivedFieldsList(list);
  }
  function addDerivedField() {
    setDerivedFieldsList([
      ...derivedFieldsList(),
      {
        name: "",
        matcherRegex: "",
        url: "",
        urlDisplayLabel: "",
        targetBlank: false
      }
    ]);
  }
  function removeDerivedField(index2) {
    setDerivedFieldsList(derivedFieldsList().filter((_, i) => i !== index2));
  }
  const queryTimeout = computed(() => {
    const jd = props.options.jsonData;
    return String(jd.queryTimeout ?? jd["query超时"] ?? "");
  });
  const json = computed(() => props.options.jsonData ?? {});
  const secure = computed(
    () => props.options.secureJsonData ?? {}
  );
  return {
    type,
    options,
    json,
    secure,
    dsList,
    queryTimeout,
    patch,
    patchJson,
    patchSecure,
    patchDerivedFields,
    derivedFieldsList,
    updateDerivedField,
    addDerivedField,
    removeDerivedField
  };
}
const _hoisted_1$27 = { class: "cfg-section" };
const _hoisted_2$1F = {
  class: "derived-fields",
  "data-testid": "loki-derived-fields"
};
const _hoisted_3$1s = ["data-testid"];
const _hoisted_4$1d = { class: "chk" };
const _hoisted_5$13 = ["value", "onChange"];
const _hoisted_6$_ = ["value"];
const _hoisted_7$T = { class: "chk" };
const _hoisted_8$M = ["checked", "onChange"];
const _hoisted_9$J = ["onClick"];
const _hoisted_10$A = { class: "raw-json" };
const _sfc_main$2H = /* @__PURE__ */ defineComponent({
  __name: "PromLokiConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    const type = computed(() => props.type);
    const dsList = computed(() => props.dsList ?? []);
    const queryTimeout = computed(() => props.queryTimeout ?? "");
    function patch(partial) {
      emit("patch", partial);
    }
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    function patchDerivedFields(raw) {
      emit("patch-derived-raw", raw);
    }
    function derivedFieldsList() {
      return props.derivedFields ?? [];
    }
    function updateDerivedField(index2, partial) {
      emit("update-derived", index2, partial);
    }
    function addDerivedField() {
      emit("add-derived");
    }
    function removeDerivedField(index2) {
      emit("remove-derived", index2);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$27, [
        createVNode(unref(GInlineField), { label: "HTTP 方法" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "prom-http-method",
              "data-grafana-label": "HTTP Method",
              value: String(options.value.jsonData.httpMethod ?? "POST"),
              style: { "width": "100%" },
              options: [
                { label: "POST", value: "POST" },
                { label: "GET", value: "GET" }
              ],
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ httpMethod: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 0,
          label: "抓取间隔"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "prom-scrape-interval",
              "data-grafana-label": "Scrape interval",
              value: String(options.value.jsonData.timeInterval ?? ""),
              placeholder: "15s",
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ timeInterval: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 1,
          label: "查询超时"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "prom-query-timeout",
              "data-grafana-label": "Query timeout",
              value: queryTimeout.value,
              placeholder: "60s",
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchJson({ queryTimeout: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 2,
          label: "Prometheus 类型"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "prom-type",
              value: String(options.value.jsonData.prometheusType ?? "Prometheus"),
              style: { "width": "100%" },
              options: [
                { label: "Prometheus", value: "Prometheus" },
                {
                  label: "Amazon Managed Service for Prometheus",
                  value: "Amazon Prometheus"
                },
                { label: "Mimir", value: "Mimir" },
                { label: "Cortex", value: "Cortex" },
                { label: "Thanos", value: "Thanos" }
              ],
              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchJson({ prometheusType: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "loki" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 3,
          label: "最大行数"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "loki-max-lines",
              value: String(options.value.jsonData.maxLines ?? 1e3),
              "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchJson({ maxLines: Number($event) || 1e3 }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        createVNode(unref(GInlineField), { label: "自定义查询参数" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              value: String(options.value.jsonData.customQueryParameters ?? ""),
              placeholder: "timeout=60s",
              "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patchJson({ customQueryParameters: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 4,
          label: "禁用指标查找"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "prom-disable-metrics-lookup",
              checked: !!options.value.jsonData.disableMetricsLookup,
              "onUpdate:checked": _cache[6] || (_cache[6] = ($event) => patchJson({ disableMetricsLookup: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 5,
          label: "增量查询"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "prom-incremental-querying",
              checked: !!options.value.jsonData.incrementalQuerying,
              "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => patchJson({ incrementalQuerying: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 6,
          label: "代码模式默认"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              checked: options.value.jsonData.defaultEditor !== "builder",
              "onUpdate:checked": _cache[8] || (_cache[8] = ($event) => patchJson({ defaultEditor: $event ? "code" : "builder" }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 7,
          label: "缓存级别"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "prom-cache-level",
              "data-grafana-label": "Cache level",
              value: String(options.value.jsonData.cacheLevel ?? "High"),
              style: { "width": "100%" },
              options: [
                { label: "低", value: "Low" },
                { label: "中", value: "Medium" },
                { label: "高", value: "High" },
                { label: "无", value: "None" }
              ],
              "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patchJson({ cacheLevel: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 8,
          label: "禁用录制规则"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "prom-disable-recording-rules",
              checked: !!options.value.jsonData.disableRecordingRules,
              "onUpdate:checked": _cache[10] || (_cache[10] = ($event) => patchJson({ disableRecordingRules: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 9,
          label: "Series 端点"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "prom-series-endpoint",
              checked: !!options.value.jsonData.seriesEndpoint,
              "onUpdate:checked": _cache[11] || (_cache[11] = ($event) => patchJson({ seriesEndpoint: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 10,
          label: "增量查询重叠窗口"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "prom-incremental-overlap",
              value: String(options.value.jsonData.incrementalQueryOverlapWindow ?? ""),
              placeholder: "10m",
              "onUpdate:value": _cache[12] || (_cache[12] = ($event) => patchJson({ incrementalQueryOverlapWindow: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 11,
          label: "Exemplar 跟踪 ID 目标"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "prom-exemplar-destinations",
              value: String(
                options.value.jsonData.exemplarTraceIdDestinations ? JSON.stringify(options.value.jsonData.exemplarTraceIdDestinations) : ""
              ),
              placeholder: '[{"name":"traceID","url":"…"}]',
              "onUpdate:value": _cache[13] || (_cache[13] = (v) => {
                try {
                  patchJson({
                    exemplarTraceIdDestinations: JSON.parse(String(v ?? "[]"))
                  });
                } catch {
                }
              })
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "loki" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 12,
          label: "在告警 UI 中管理规则"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "loki-manage-alerts",
              checked: options.value.jsonData.manageAlerts !== false,
              "onUpdate:checked": _cache[14] || (_cache[14] = ($event) => patchJson({ manageAlerts: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "loki" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 13,
          label: "派生字段"
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_2$1F, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(derivedFieldsList(), (f, i) => {
                  return openBlock(), createElementBlock("div", {
                    key: i,
                    class: "derived-row",
                    "data-testid": `loki-derived-field-${i}`
                  }, [
                    createVNode(unref(GInput), {
                      value: String(f.name ?? ""),
                      placeholder: "名称",
                      "data-testid": "loki-derived-name",
                      "onUpdate:value": ($event) => updateDerivedField(i, { name: String($event || "") })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GInput), {
                      value: String(f.matcherRegex ?? ""),
                      placeholder: "正则 / 标签",
                      "data-testid": "loki-derived-regex",
                      "onUpdate:value": ($event) => updateDerivedField(i, { matcherRegex: String($event || "") })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GInput), {
                      value: String(f.url ?? ""),
                      placeholder: "URL 或内部查询",
                      "data-testid": "loki-derived-url",
                      "onUpdate:value": ($event) => updateDerivedField(i, { url: String($event || "") })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GInput), {
                      value: String(f.urlDisplayLabel ?? ""),
                      placeholder: "链接标签",
                      "data-testid": "loki-derived-url-label",
                      "onUpdate:value": ($event) => updateDerivedField(i, { urlDisplayLabel: String($event || "") })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createElementVNode("label", _hoisted_4$1d, [
                      _cache[19] || (_cache[19] = createTextVNode(
                        "内部链接数据源 ",
                        -1
                        /* CACHED */
                      )),
                      createElementVNode("select", {
                        "data-testid": "loki-derived-ds",
                        value: String(f.datasourceUid ?? ""),
                        onChange: ($event) => updateDerivedField(i, {
                          datasourceUid: $event.target.value
                        })
                      }, [
                        _cache[18] || (_cache[18] = createElementVNode(
                          "option",
                          { value: "" },
                          "（无 / 外部 URL）",
                          -1
                          /* CACHED */
                        )),
                        (openBlock(true), createElementBlock(
                          Fragment,
                          null,
                          renderList(dsList.value, (d) => {
                            return openBlock(), createElementBlock("option", {
                              key: d.uid,
                              value: d.uid
                            }, " { d.name } ({ d.type }) ", 8, _hoisted_6$_);
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ], 40, _hoisted_5$13)
                    ]),
                    createElementVNode("label", _hoisted_7$T, [
                      createElementVNode("input", {
                        type: "checkbox",
                        checked: !!f.targetBlank,
                        "data-testid": "loki-derived-blank",
                        onChange: ($event) => updateDerivedField(i, {
                          targetBlank: $event.target.checked
                        })
                      }, null, 40, _hoisted_8$M),
                      _cache[20] || (_cache[20] = createTextVNode(
                        " 新标签打开 ",
                        -1
                        /* CACHED */
                      ))
                    ]),
                    createElementVNode("button", {
                      type: "button",
                      "data-testid": "loki-derived-remove",
                      onClick: ($event) => removeDerivedField(i)
                    }, " 删除 ", 8, _hoisted_9$J)
                  ], 8, _hoisted_3$1s);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              createElementVNode("button", {
                type: "button",
                class: "add-derived",
                "data-testid": "loki-derived-add",
                onClick: addDerivedField
              }, " + 添加派生字段 "),
              createElementVNode("details", _hoisted_10$A, [
                _cache[21] || (_cache[21] = createElementVNode(
                  "summary",
                  null,
                  "高级：JSON",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: String(
                    options.value.jsonData.derivedFields ? JSON.stringify(options.value.jsonData.derivedFields) : "[]"
                  ),
                  placeholder: "[]",
                  "data-testid": "loki-derived-fields-json",
                  "onUpdate:value": _cache[15] || (_cache[15] = ($event) => patchDerivedFields(String($event || "[]")))
                }, null, 8, ["value"])
              ])
            ])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 14,
          label: "在告警 UI 中管理规则"
        }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "prom-manage-alerts",
              checked: options.value.jsonData.manageAlerts !== false,
              "onUpdate:checked": _cache[16] || (_cache[16] = ($event) => patchJson({ manageAlerts: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        type.value === "prometheus" || type.value === "loki" ? (openBlock(), createBlock(unref(GInlineField), {
          key: 15,
          label: "超时"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "ds-timeout",
              value: String(options.value.timeout ?? options.value.jsonData.timeout ?? ""),
              placeholder: "60",
              "onUpdate:value": _cache[17] || (_cache[17] = ($event) => patch({ timeout: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const PromLokiConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2H, [["__scopeId", "data-v-521f65b4"]]);
const _hoisted_1$26 = { class: "cfg-section" };
const _hoisted_2$1E = {
  class: "row",
  "data-testid": "sql-database",
  "data-grafana-label": "Database"
};
const _hoisted_3$1r = {
  class: "row",
  "data-testid": "sql-max-open",
  "data-grafana-label": "Max open"
};
const _sfc_main$2G = /* @__PURE__ */ defineComponent({
  __name: "SqlConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patch(partial) {
      emit("patch", partial);
    }
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    function patchSecure(partial) {
      emit("patch-secure", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$26, [
        createElementVNode("div", _hoisted_2$1E, [
          _cache[6] || (_cache[6] = createElementVNode(
            "label",
            null,
            "Database",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(options.value.jsonData.database ?? options.value.database ?? ""),
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ database: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1r, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "Max open connections",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            value: String(options.value.jsonData.maxOpenConns ?? ""),
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ maxOpenConns: Number($event) || 0 }))
          }, null, 8, ["value"])
        ]),
        createVNode(unref(GInlineField), { label: "数据库" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              value: String(options.value.jsonData.database ?? options.value.database ?? ""),
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchJson({ database: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "用户" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              value: String(options.value.user ?? ""),
              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ user: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "密码" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              type: "password",
              value: String(options.value.secureJsonData?.password ?? ""),
              "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchSecure({ password: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "TLS/SSL 模式" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              value: String(options.value.jsonData.sslmode ?? "disable"),
              "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patchJson({ sslmode: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const SqlConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2G, [["__scopeId", "data-v-086e280e"]]);
const _hoisted_1$25 = { class: "cfg-section" };
const _hoisted_2$1D = {
  class: "row",
  "data-testid": "influx-db-name",
  "data-grafana-label": "Default Bucket"
};
const _hoisted_3$1q = {
  class: "row",
  "data-testid": "influx-organization",
  "data-grafana-label": "Organization"
};
const _hoisted_4$1c = {
  class: "row",
  "data-testid": "influx-token",
  "data-grafana-label": "Token"
};
const _hoisted_5$12 = {
  class: "row",
  "data-testid": "influx-user",
  "data-grafana-label": "User"
};
const _hoisted_6$Z = {
  class: "row",
  "data-testid": "influx-password",
  "data-grafana-label": "Password"
};
const _hoisted_7$S = {
  class: "row",
  "data-testid": "influx-version",
  "data-grafana-label": "Query language"
};
const _hoisted_8$L = {
  class: "row",
  "data-testid": "influx-max-series",
  "data-grafana-label": "Max series"
};
const _hoisted_9$I = {
  class: "row",
  "data-testid": "influx-min-interval",
  "data-grafana-label": "Min time interval"
};
const _sfc_main$2F = /* @__PURE__ */ defineComponent({
  __name: "InfluxConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    function patchSecure(partial) {
      emit("patch-secure", partial);
    }
    return (_ctx, _cache) => {
      const _component_Select = resolveComponent("Select");
      return openBlock(), createElementBlock("div", _hoisted_1$25, [
        createElementVNode("div", _hoisted_2$1D, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "Default Bucket",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(
              options.value.jsonData.dbName ?? options.value.jsonData.defaultBucket ?? options.value.database ?? ""
            ),
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ dbName: $event, defaultBucket: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1q, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "Organization",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(options.value.jsonData.organization ?? ""),
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ organization: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$1c, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "Token",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "password",
            value: String(options.value.secureJsonData?.token ?? ""),
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchSecure({ token: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$12, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "User",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(options.value.jsonData.user ?? options.value.user ?? ""),
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchJson({ user: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_6$Z, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "Password",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "password",
            value: String(options.value.secureJsonData?.password ?? ""),
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchSecure({ password: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_7$S, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "版本 / Query language",
            -1
            /* CACHED */
          )),
          createVNode(_component_Select, {
            value: String(options.value.jsonData.version ?? "Flux"),
            style: { "width": "100%" },
            options: [
              { label: "InfluxQL", value: "InfluxQL" },
              { label: "Flux", value: "Flux" },
              { label: "SQL", value: "SQL" }
            ],
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patchJson({ version: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_8$L, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "Max series",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(options.value.jsonData.maxSeries ?? ""),
            placeholder: "1000",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patchJson({ maxSeries: Number($event) || 0 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_9$I, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "Min time interval",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(options.value.jsonData.timeInterval ?? ""),
            placeholder: "10s",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patchJson({ timeInterval: $event }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const InfluxConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2F, [["__scopeId", "data-v-18629b8c"]]);
const _hoisted_1$24 = { class: "cfg-section" };
const _sfc_main$2E = /* @__PURE__ */ defineComponent({
  __name: "CloudWatchConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$24, [
        createVNode(unref(GInlineField), { label: "默认区域" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-default-region",
              "data-grafana-label": "Default Region",
              value: String(options.value.jsonData.defaultRegion ?? ""),
              placeholder: "us-east-1",
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ defaultRegion: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "认证类型" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "cw-auth-type",
              "data-grafana-label": "Auth Provider",
              value: String(options.value.jsonData.authType ?? "keys"),
              options: [
                { label: "访问密钥", value: "keys" },
                { label: "凭证文件", value: "credentials" },
                { label: "ARN 角色", value: "arn" },
                { label: "默认", value: "default" }
              ],
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ authType: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Assume Role ARN" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-assume-role",
              "data-grafana-label": "Assume Role ARN",
              value: String(options.value.jsonData.assumeRoleArn ?? ""),
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchJson({ assumeRoleArn: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "External ID" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-external-id",
              "data-grafana-label": "External ID",
              value: String(options.value.jsonData.externalId ?? ""),
              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchJson({ externalId: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "配置文件" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-profile",
              "data-grafana-label": "Credentials Profile Name",
              value: String(options.value.jsonData.profile ?? ""),
              "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchJson({ profile: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "自定义指标命名空间" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-custom-ns",
              "data-grafana-label": "Namespaces of Custom Metrics",
              value: String(options.value.jsonData.customMetricsNamespaces ?? ""),
              placeholder: "Namespace1,Namespace2",
              "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patchJson({ customMetricsNamespaces: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "日志查询超时" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-logs-timeout",
              "data-grafana-label": "Query Result Timeout",
              value: String(options.value.jsonData.logsTimeout ?? ""),
              placeholder: "30m",
              "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patchJson({ logsTimeout: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "默认日志组" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-default-log-groups",
              "data-grafana-label": "Default Log Groups",
              value: String(options.value.jsonData.defaultLogGroups ?? options.value.jsonData.logGroups ?? ""),
              placeholder: "log-group-1,log-group-2",
              "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patchJson({ defaultLogGroups: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "链路追踪数据源 UID" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "cw-tracing-ds",
              value: String(options.value.jsonData.tracingDatasourceUid ?? ""),
              "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patchJson({ tracingDatasourceUid: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const CloudWatchConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2E, [["__scopeId", "data-v-2a2c151f"]]);
const _hoisted_1$23 = { class: "cfg-section" };
const _sfc_main$2D = /* @__PURE__ */ defineComponent({
  __name: "ElasticsearchConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$23, [
        createVNode(unref(GInlineField), { label: "索引名" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-index",
              value: String(options.value.jsonData.index ?? options.value.database ?? ""),
              placeholder: "[logstash-]YYYY.MM.DD",
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ index: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "时间字段" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-time-field",
              value: String(options.value.jsonData.timeField ?? "@timestamp"),
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ timeField: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "ES 版本" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-version",
              value: String(options.value.jsonData.esVersion ?? options.value.jsonData.version ?? ""),
              placeholder: "8.0.0",
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchJson({ esVersion: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "最大并发分片请求" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-max-concurrent",
              value: String(options.value.jsonData.maxConcurrentShardRequests ?? ""),
              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchJson({ maxConcurrentShardRequests: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "最小时间间隔" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-interval",
              value: String(options.value.jsonData.interval ?? options.value.jsonData.timeInterval ?? ""),
              placeholder: "10s",
              "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchJson({ interval: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "日志消息字段" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-log-message",
              value: String(options.value.jsonData.logMessageField ?? ""),
              "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patchJson({ logMessageField: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "日志级别字段" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "es-log-level",
              value: String(options.value.jsonData.logLevelField ?? ""),
              "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patchJson({ logLevelField: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Include Frozen Indices" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "es-include-frozen",
              checked: !!options.value.jsonData.includeFrozen,
              "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => patchJson({ includeFrozen: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ElasticsearchConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2D, [["__scopeId", "data-v-822ed5e4"]]);
const _hoisted_1$22 = { class: "cfg-section" };
const _hoisted_2$1C = {
  class: "row",
  "data-testid": "tempo-traces-to-logs",
  "data-grafana-label": "Trace to logs"
};
const _hoisted_3$1p = {
  class: "row",
  "data-testid": "tempo-service-map",
  "data-grafana-label": "Service graph"
};
const _sfc_main$2C = /* @__PURE__ */ defineComponent({
  __name: "TempoConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$22, [
        createElementVNode("div", _hoisted_2$1C, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "Trace to logs",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(
              options.value.jsonData.tracesToLogs?.datasourceUid ?? options.value.jsonData.tracesToLogsV2?.datasourceUid ?? ""
            ),
            placeholder: "loki uid",
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({
              tracesToLogs: {
                ...options.value.jsonData.tracesToLogs || {},
                datasourceUid: $event
              }
            }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1p, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "Service graph",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(options.value.jsonData.serviceMap?.datasourceUid ?? ""),
            placeholder: "prometheus uid",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({
              serviceMap: {
                ...options.value.jsonData.serviceMap || {},
                datasourceUid: $event
              }
            }))
          }, null, 8, ["value"])
        ]),
        createVNode(unref(GInlineField), { label: "Trace 转指标" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "tempo-traces-to-metrics",
              checked: !!options.value.jsonData.tracesToMetrics,
              "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => patchJson({ tracesToMetrics: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Trace 转日志数据源 UID" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "tempo-traces-to-logs",
              value: String(
                options.value.jsonData.tracesToLogs?.datasourceUid ?? options.value.jsonData.tracesToLogsUid ?? ""
              ),
              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchJson({
                tracesToLogsUid: $event,
                tracesToLogs: {
                  ...options.value.jsonData.tracesToLogs,
                  datasourceUid: $event
                }
              }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "节点图" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "tempo-node-graph",
              checked: options.value.jsonData.nodeGraph?.enabled !== false,
              "onUpdate:checked": _cache[4] || (_cache[4] = ($event) => patchJson({ nodeGraph: { enabled: $event } }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Search 隐藏" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "tempo-search-hide",
              checked: !!options.value.jsonData.search?.hide,
              "onUpdate:checked": _cache[5] || (_cache[5] = ($event) => patchJson({
                search: { ...options.value.jsonData.search, hide: $event }
              }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Span 条类型" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "tempo-span-bar",
              value: String(options.value.jsonData.spanBar?.type ?? options.value.jsonData.spanBar ?? "None"),
              options: [
                { label: "无", value: "None" },
                { label: "时长", value: "Duration" },
                { label: "标签", value: "Tag" }
              ],
              "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patchJson({ spanBar: { type: $event } }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const TempoConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2C, [["__scopeId", "data-v-f536a879"]]);
const _hoisted_1$21 = { class: "cfg-section" };
const _sfc_main$2B = /* @__PURE__ */ defineComponent({
  __name: "JaegerConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$21, [
        createVNode(unref(GInlineField), { label: "节点图" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "jaeger-node-graph",
              checked: options.value.jsonData.nodeGraph?.enabled !== false,
              "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => patchJson({ nodeGraph: { enabled: $event } }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Trace 转日志数据源 UID" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "jaeger-traces-to-logs",
              value: String(options.value.jsonData.tracesToLogs?.datasourceUid ?? ""),
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({
                tracesToLogs: {
                  ...options.value.jsonData.tracesToLogs,
                  datasourceUid: $event
                }
              }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Span 条类型" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "jaeger-span-bar",
              value: String(options.value.jsonData.spanBar?.type ?? "None"),
              options: [
                { label: "无", value: "None" },
                { label: "时长", value: "Duration" },
                { label: "标签", value: "Tag" }
              ],
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchJson({ spanBar: { type: $event } }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const JaegerConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2B, [["__scopeId", "data-v-c87b7b82"]]);
const _hoisted_1$20 = { class: "cfg-section" };
const _sfc_main$2A = /* @__PURE__ */ defineComponent({
  __name: "GraphiteConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$20, [
        createVNode(unref(GInlineField), { label: "Graphite 版本" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "graphite-version",
              "data-grafana-label": "Version",
              value: String(options.value.jsonData.graphiteVersion ?? "1.1"),
              options: [
                { label: "0.9", value: "0.9" },
                { label: "1.0", value: "1.0" },
                { label: "1.1", value: "1.1" }
              ],
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ graphiteVersion: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Graphite 后端类型" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "graphite-type",
              "data-grafana-label": "Graphite backend type",
              value: String(options.value.jsonData.graphiteType ?? "default"),
              options: [
                { label: "默认", value: "default" },
                { label: "Metrictank", value: "metrictank" }
              ],
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ graphiteType: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "Rollup 指示器" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "graphite-rollup",
              "data-grafana-label": "Rollup indicator",
              checked: !!options.value.jsonData.rollupIndicatorEnabled,
              "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => patchJson({ rollupIndicatorEnabled: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const GraphiteConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2A, [["__scopeId", "data-v-73680df9"]]);
const _hoisted_1$1$ = { class: "cfg-section" };
const _sfc_main$2z = /* @__PURE__ */ defineComponent({
  __name: "PyroscopeConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1$, [
        createVNode(unref(GInlineField), { label: "最小步长" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "pyroscope-min-step",
              value: String(options.value.jsonData.minStep ?? ""),
              placeholder: "15s",
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ minStep: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const PyroscopeConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2z, [["__scopeId", "data-v-1815819b"]]);
const _hoisted_1$1_ = { class: "cfg-section" };
const _sfc_main$2y = /* @__PURE__ */ defineComponent({
  __name: "AzureConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1_, [
        createVNode(unref(GInlineField), { label: "Azure Cloud" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "azure-cloud",
              "data-grafana-label": "Azure Cloud",
              value: String(options.value.jsonData.cloudName ?? options.value.jsonData.azureCloud ?? "azuremonitor"),
              options: [
                { label: "Azure", value: "azuremonitor" },
                { label: "Azure US Government", value: "govazuremonitor" },
                { label: "Azure China", value: "chinaazuremonitor" }
              ],
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ cloudName: $event, azureCloud: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "租户 ID" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "azure-tenant",
              "data-grafana-label": "Directory (tenant) ID",
              value: String(options.value.jsonData.tenantId ?? ""),
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchJson({ tenantId: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "客户端 ID" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "azure-client",
              "data-grafana-label": "Application (client) ID",
              value: String(options.value.jsonData.clientId ?? ""),
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchJson({ clientId: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "默认订阅" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "azure-subscription",
              "data-grafana-label": "Default Subscription",
              value: String(options.value.jsonData.subscriptionId ?? ""),
              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchJson({ subscriptionId: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const AzureConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2y, [["__scopeId", "data-v-791c6b15"]]);
const _hoisted_1$1Z = { class: "cfg-section" };
const _sfc_main$2x = /* @__PURE__ */ defineComponent({
  __name: "AlertmanagerConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1Z, [
        createVNode(unref(GInlineField), { label: "实现" }, {
          default: withCtx(() => [
            createVNode(unref(GSelect), {
              "data-testid": "am-implementation",
              value: String(options.value.jsonData.implementation ?? "prometheus"),
              options: [
                { label: "Prometheus", value: "prometheus" },
                { label: "Cortex", value: "cortex" },
                { label: "Mimir", value: "mimir" },
                { label: "Grafana", value: "grafana" }
              ],
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ implementation: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "处理 Grafana 托管告警" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "am-handle-grafana",
              checked: !!options.value.jsonData.handleGrafanaManagedAlerts,
              "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => patchJson({ handleGrafanaManagedAlerts: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const AlertmanagerConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2x, [["__scopeId", "data-v-9633f804"]]);
const _hoisted_1$1Y = { class: "cfg-section" };
const _sfc_main$2w = /* @__PURE__ */ defineComponent({
  __name: "TestdataConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1Y, [
        createVNode(unref(GInlineField), { label: "默认场景" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "testdata-scenario",
              value: String(options.value.jsonData.defaultScenario ?? ""),
              placeholder: "random_walk",
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchJson({ defaultScenario: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const TestdataConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2w, [["__scopeId", "data-v-ac7c3d9a"]]);
const _hoisted_1$1X = { class: "cfg-section" };
const _sfc_main$2v = /* @__PURE__ */ defineComponent({
  __name: "HttpAuthConfigFields",
  props: {
    type: {},
    options: {},
    json: {},
    secure: {},
    queryTimeout: {},
    dsList: {},
    derivedFields: {}
  },
  emits: ["patch", "patch-json", "patch-secure", "patch-derived-raw", "update-derived", "add-derived", "remove-derived"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const options = computed(() => props.options);
    function patch(partial) {
      emit("patch", partial);
    }
    function patchJson(partial) {
      emit("patch-json", partial);
    }
    function patchSecure(partial) {
      emit("patch-secure", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1X, [
        createVNode(unref(GInlineField), { label: "跳过 TLS 验证" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-tls-skip-verify",
              checked: !!options.value.jsonData.tlsSkipVerify,
              "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => patchJson({ tlsSkipVerify: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "TLS 客户端认证" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-tls-auth",
              checked: !!options.value.jsonData.tlsAuth,
              "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => patchJson({ tlsAuth: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "TLS CA 证书认证" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-tls-ca",
              checked: !!options.value.jsonData.tlsAuthWithCACert,
              "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => patchJson({ tlsAuthWithCACert: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "SigV4 认证" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-sigv4",
              checked: !!options.value.jsonData.sigV4Auth,
              "onUpdate:checked": _cache[3] || (_cache[3] = ($event) => patchJson({ sigV4Auth: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        options.value.jsonData.sigV4Auth ? (openBlock(), createBlock(unref(GInlineField), {
          key: 0,
          label: "SigV4 区域"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "ds-sigv4-region",
              value: String(options.value.jsonData.sigV4Region ?? options.value.jsonData.sigV4AuthType ?? ""),
              placeholder: "us-east-1",
              "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchJson({ sigV4Region: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        createVNode(unref(GInlineField), { label: "安全 Socks 代理" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-secure-socks",
              checked: !!options.value.jsonData.secureSocksDSProxyEnabled,
              "onUpdate:checked": _cache[5] || (_cache[5] = ($event) => patchJson({ secureSocksDSProxyEnabled: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "转发 OAuth 身份" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-oauth-passthru",
              checked: !!options.value.jsonData.oauthPassThru,
              "onUpdate:checked": _cache[6] || (_cache[6] = ($event) => patchJson({ oauthPassThru: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "跨站携带凭证" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              "data-testid": "ds-with-credentials",
              checked: !!options.value.withCredentials,
              "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => patch({ withCredentials: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "自定义 HTTP 头" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "ds-http-headers",
              value: String(
                options.value.jsonData.httpHeaderName1 ? `${options.value.jsonData.httpHeaderName1}=…` : options.value.jsonData.customHeaders ? JSON.stringify(options.value.jsonData.customHeaders) : ""
              ),
              placeholder: '{"X-Custom":"value"} 或使用 httpHeaderName1',
              "onUpdate:value": _cache[8] || (_cache[8] = (v) => {
                const s = String(v ?? "");
                try {
                  const j = JSON.parse(s || "{}");
                  if (j && typeof j === "object" && !Array.isArray(j)) patchJson({ customHeaders: j });
                } catch {
                }
              })
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GInlineField), { label: "HTTP 头名称 1" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "ds-http-header-name1",
              value: String(options.value.jsonData.httpHeaderName1 ?? ""),
              placeholder: "X-Scope-OrgID",
              "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patchJson({ httpHeaderName1: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        options.value.jsonData.httpHeaderName1 ? (openBlock(), createBlock(unref(GInlineField), {
          key: 1,
          label: "HTTP 头值 1"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              type: "password",
              "data-testid": "ds-http-header-value1",
              value: String(options.value.secureJsonData?.httpHeaderValue1 ?? ""),
              "onUpdate:value": _cache[10] || (_cache[10] = ($event) => patchSecure({ httpHeaderValue1: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        createVNode(unref(GInlineField), { label: "HTTP 头名称 2" }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              "data-testid": "ds-http-header-name2",
              value: String(options.value.jsonData.httpHeaderName2 ?? ""),
              "onUpdate:value": _cache[11] || (_cache[11] = ($event) => patchJson({ httpHeaderName2: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        }),
        options.value.jsonData.httpHeaderName2 ? (openBlock(), createBlock(unref(GInlineField), {
          key: 2,
          label: "HTTP 头值 2"
        }, {
          default: withCtx(() => [
            createVNode(unref(GInput), {
              type: "password",
              "data-testid": "ds-http-header-value2",
              value: String(options.value.secureJsonData?.httpHeaderValue2 ?? ""),
              "onUpdate:value": _cache[12] || (_cache[12] = ($event) => patchSecure({ httpHeaderValue2: $event }))
            }, null, 8, ["value"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        createVNode(unref(GInlineField), { label: "基本认证" }, {
          default: withCtx(() => [
            createVNode(unref(GSwitch), {
              checked: !!options.value.basicAuth,
              "onUpdate:checked": _cache[13] || (_cache[13] = ($event) => patch({ basicAuth: $event }))
            }, null, 8, ["checked"])
          ]),
          _: 1
          /* STABLE */
        }),
        options.value.basicAuth ? (openBlock(), createElementBlock(
          Fragment,
          { key: 3 },
          [
            createVNode(unref(GInlineField), { label: "用户名" }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  value: String(options.value.basicAuthUser ?? ""),
                  "onUpdate:value": _cache[14] || (_cache[14] = ($event) => patch({ basicAuthUser: $event }))
                }, null, 8, ["value"])
              ]),
              _: 1
              /* STABLE */
            }),
            createVNode(unref(GInlineField), { label: "密码" }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  type: "password",
                  value: String(options.value.secureJsonData?.basicAuthPassword ?? ""),
                  "onUpdate:value": _cache[15] || (_cache[15] = ($event) => patchSecure({ basicAuthPassword: $event }))
                }, null, 8, ["value"])
              ]),
              _: 1
              /* STABLE */
            })
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const HttpAuthConfigFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2v, [["__scopeId", "data-v-e33557a6"]]);
const _hoisted_1$1W = ["data-testid"];
const _sfc_main$2u = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const model = useConfigEditorModel(props);
    const {
      type,
      options,
      json,
      secure,
      dsList,
      queryTimeout,
      patch,
      patchJson,
      patchSecure,
      patchDerivedFields,
      derivedFieldsList,
      updateDerivedField,
      addDerivedField,
      removeDerivedField
    } = model;
    const derivedFields = computed(() => derivedFieldsList());
    const isSql = computed(
      () => ["mysql", "mssql", "grafana-postgresql-datasource"].includes(String(type.value))
    );
    const isEs = computed(
      () => type.value === "elasticsearch" || type.value === "grafana-elasticsearch-datasource"
    );
    const isPyroscope = computed(
      () => type.value === "grafana-pyroscope-datasource" || type.value === "pyroscope"
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "ds-config-editor",
        "data-testid": `config-editor-${unref(options).type}`
      }, [
        createVNode(unref(_sfc_main$H$1), { layout: "vertical" }, {
          default: withCtx(() => [
            createVNode(unref(GInlineField), { label: "名称" }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  "data-testid": "ds-name",
                  value: unref(options).name,
                  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => unref(patch)({ name: $event }))
                }, null, 8, ["value"])
              ]),
              _: 1
              /* STABLE */
            }),
            createVNode(unref(GInlineField), { label: "URL" }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  "data-testid": "ds-url",
                  value: unref(options).url,
                  placeholder: "http://localhost:9090",
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(patch)({ url: $event }))
                }, null, 8, ["value"])
              ]),
              _: 1
              /* STABLE */
            }),
            createVNode(unref(GInlineField), { label: "设为默认" }, {
              default: withCtx(() => [
                createVNode(unref(GSwitch), {
                  "data-testid": "ds-is-default",
                  checked: !!unref(options).isDefault,
                  "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => unref(patch)({ isDefault: $event }))
                }, null, 8, ["checked"])
              ]),
              _: 1
              /* STABLE */
            }),
            createVNode(unref(GInlineField), { label: "访问方式" }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  "data-testid": "ds-access",
                  style: { "width": "100%" },
                  value: unref(options).access ?? "proxy",
                  options: [
                    { label: "服务器（默认）", value: "proxy" },
                    { label: "浏览器", value: "direct" }
                  ],
                  "onUpdate:value": _cache[3] || (_cache[3] = ($event) => unref(patch)({ access: $event }))
                }, null, 8, ["value"])
              ]),
              _: 1
              /* STABLE */
            }),
            unref(type) === "prometheus" || unref(type) === "loki" ? (openBlock(), createBlock(PromLokiConfigFields, {
              key: 0,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              "query-timeout": unref(queryTimeout),
              "ds-list": unref(dsList),
              "derived-fields": derivedFields.value,
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure),
              onPatchDerivedRaw: unref(patchDerivedFields),
              onUpdateDerived: unref(updateDerivedField),
              onAddDerived: unref(addDerivedField),
              onRemoveDerived: unref(removeDerivedField)
            }, null, 8, ["type", "options", "json", "secure", "query-timeout", "ds-list", "derived-fields", "onPatch", "onPatchJson", "onPatchSecure", "onPatchDerivedRaw", "onUpdateDerived", "onAddDerived", "onRemoveDerived"])) : createCommentVNode("v-if", true),
            isSql.value ? (openBlock(), createBlock(SqlConfigFields, {
              key: 1,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "influxdb" ? (openBlock(), createBlock(InfluxConfigFields, {
              key: 2,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "cloudwatch" ? (openBlock(), createBlock(CloudWatchConfigFields, {
              key: 3,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            isEs.value ? (openBlock(), createBlock(ElasticsearchConfigFields, {
              key: 4,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "tempo" ? (openBlock(), createBlock(TempoConfigFields, {
              key: 5,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "jaeger" ? (openBlock(), createBlock(JaegerConfigFields, {
              key: 6,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "graphite" ? (openBlock(), createBlock(GraphiteConfigFields, {
              key: 7,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            isPyroscope.value ? (openBlock(), createBlock(PyroscopeConfigFields, {
              key: 8,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "grafana-azure-monitor-datasource" ? (openBlock(), createBlock(AzureConfigFields, {
              key: 9,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "alertmanager" ? (openBlock(), createBlock(AlertmanagerConfigFields, {
              key: 10,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            unref(type) === "grafana-testdata-datasource" ? (openBlock(), createBlock(TestdataConfigFields, {
              key: 11,
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])) : createCommentVNode("v-if", true),
            createVNode(HttpAuthConfigFields, {
              type: unref(type),
              options: unref(options),
              json: unref(json),
              secure: unref(secure),
              onPatch: unref(patch),
              onPatchJson: unref(patchJson),
              onPatchSecure: unref(patchSecure)
            }, null, 8, ["type", "options", "json", "secure", "onPatch", "onPatchJson", "onPatchSecure"])
          ]),
          _: 1
          /* STABLE */
        })
      ], 8, _hoisted_1$1W);
    };
  }
});
const SharedConfigEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2u, [["__scopeId", "data-v-db180713"]]);
const _sfc_main$2t = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "dashboard"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
function asQueryBag(query) {
  return query;
}
function useQueryEditorModel(props) {
  const type = computed(
    () => normalizeDsType(props.datasource?.type ?? asQueryBag(props.query).datasource?.type ?? "")
  );
  const family = computed(() => queryFieldFamily(type.value));
  const editorMode = ref(asQueryBag(props.query).editorMode || "code");
  function patch(partial) {
    props.onChange({ ...props.query, ...partial });
  }
  function setEditorMode(mode2) {
    editorMode.value = mode2;
    patch({ editorMode: mode2 });
  }
  const expr = computed({
    get: () => {
      const q = asQueryBag(props.query);
      return String(q.expr ?? q.query ?? q.rawSql ?? q.target ?? q.expression ?? "");
    },
    set: (v) => {
      const f = family.value;
      if (f === "prometheus" || f === "loki") patch({ expr: v });
      else if (f === "sql") patch({ rawSql: v, rawQuery: true });
      else if (f === "graphite") patch({ target: v });
      else if (f === "influxdb") patch({ query: v, rawQuery: true });
      else if (f === "cloudwatch") patch({ expression: v });
      else if (f === "tempo" || f === "elasticsearch" || f === "azure" || f === "alertmanager")
        patch({ query: v });
      else if (f === "jaeger" || f === "pyroscope") patch({ query: v });
      else patch({ query: v, expr: v });
    }
  });
  const isSql = computed(() => family.value === "sql");
  const query = computed(() => asQueryBag(props.query));
  return {
    type,
    family,
    query,
    editorMode,
    expr,
    isSql,
    patch,
    setEditorMode,
    onRunQuery: () => props.onRunQuery(),
    onChange: props.onChange,
    label: computed(() => props.label)
  };
}
const promFormatOptions = [
  { label: "时序", value: "time_series" },
  { label: "表格", value: "table" },
  { label: "热图", value: "heatmap" }
];
const sqlFormatOptions = [
  { label: "时序", value: 0 },
  { label: "表格", value: 1 }
];
const cloudwatchQueryTypes = [
  { label: "指标", value: "Metrics" },
  { label: "日志", value: "Logs" },
  { label: "注解", value: "Annotations" }
];
const cwPlaceholder = `SEARCH('{AWS/EC2,InstanceId} MetricName="CPUUtilization"', 'Average', 300)`;
const _hoisted_1$1V = ["data-testid"];
const _hoisted_2$1B = ["value", "readonly"];
const _sfc_main$2s = /* @__PURE__ */ defineComponent({
  __name: "GCodeEditor",
  props: {
    value: { default: "" },
    language: { default: "plaintext" },
    height: { default: 160 },
    readOnly: { type: Boolean, default: false },
    testId: {}
  },
  emits: ["update:value", "change"],
  setup(__props, { emit: __emit }) {
    function getDocumentThemeMode() {
      if (typeof document === "undefined") return "dark";
      const mode2 = document.documentElement.dataset.theme || document.body?.dataset.theme || "";
      return mode2 === "light" ? "light" : "dark";
    }
    function monacoThemeForMode(mode2) {
      return mode2 === "light" ? "vs" : "vs-dark";
    }
    const props = __props;
    const emit = __emit;
    const host = ref(null);
    const failed = ref(false);
    let editor = null;
    let monaco = null;
    let themeObserver = null;
    async function ensureMonaco() {
      if (monaco) return monaco;
      const mod = await import("monaco-editor");
      monaco = mod.default ?? mod;
      if (typeof Worker !== "undefined" && !globalThis.MonacoEnvironment) {
        globalThis.MonacoEnvironment = {
          getWorker() {
            return void 0;
          }
        };
      }
      try {
        registerLanguages(monaco);
      } catch {
      }
      return monaco;
    }
    function registerLanguages(m) {
      if (!(m.languages.getLanguages() || []).some((l) => l.id === "promql")) {
        m.languages.register({ id: "promql" });
        m.languages.setMonarchTokensProvider("promql", {
          tokenizer: {
            root: [
              [/#.*$/, "comment"],
              [
                /\b(sum|rate|irate|avg|min|max|count|topk|bottomk|histogram_quantile|increase|delta)\b/,
                "keyword"
              ],
              [/[{}=!,]/, "delimiter"],
              [/"([^"\\]|\\.)*"/, "string"],
              [/'([^'\\]|\\.)*'/, "string"],
              [/\d+(\.\d+)?/, "number"],
              [/[a-z_:][\w:]*/i, "identifier"]
            ]
          }
        });
      }
      if (!(m.languages.getLanguages() || []).some((l) => l.id === "logql")) {
        m.languages.register({ id: "logql" });
        m.languages.setMonarchTokensProvider("logql", {
          tokenizer: {
            root: [
              [/#.*$/, "comment"],
              [
                /\b(rate|count_over_time|sum|avg|max|min|unwrap|json|logfmt|line_format|label_format)\b/,
                "keyword"
              ],
              [/[{}=!~|]/, "delimiter"],
              [/"([^"\\]|\\.)*"/, "string"],
              [/`([^`\\]|\\.)*`/, "string"],
              [/\d+(\.\d+)?/, "number"],
              [/[a-z_]\w*/i, "identifier"]
            ]
          }
        });
      }
      if (!(m.languages.getLanguages() || []).some((l) => l.id === "sql")) {
        m.languages.register({ id: "sql" });
        m.languages.setMonarchTokensProvider("sql", {
          tokenizer: {
            root: [
              [/--.*$/, "comment"],
              [
                /\b(SELECT|FROM|WHERE|GROUP|BY|ORDER|LIMIT|AS|AND|OR|JOIN|ON|INNER|LEFT|RIGHT|INSERT|UPDATE|DELETE|WITH)\b/i,
                "keyword"
              ],
              [/'([^'\\]|\\.)*'/, "string"],
              [/\d+(\.\d+)?/, "number"],
              [/[a-z_]\w*/i, "identifier"]
            ]
          }
        });
      }
    }
    onMounted(async () => {
      if (!host.value) return;
      try {
        const m = await ensureMonaco();
        const mode2 = getDocumentThemeMode();
        editor = m.editor.create(host.value, {
          value: props.value,
          language: props.language,
          theme: monacoThemeForMode(mode2),
          minimap: { enabled: false },
          automaticLayout: true,
          fontSize: 12,
          lineNumbers: "on",
          scrollBeyondLastLine: false,
          wordWrap: "on",
          readOnly: props.readOnly,
          tabSize: 2
        });
        editor.onDidChangeModelContent(() => {
          const v = editor?.getValue() ?? "";
          emit("update:value", v);
          emit("change", v);
        });
        themeObserver = new MutationObserver(() => {
          if (!editor || !monaco) return;
          monaco.editor.setTheme(monacoThemeForMode(getDocumentThemeMode()));
        });
        themeObserver.observe(document.documentElement, {
          attributes: true,
          attributeFilter: ["data-theme", "class"]
        });
      } catch {
        failed.value = true;
      }
    });
    watch(
      () => props.value,
      (v) => {
        if (editor && editor.getValue() !== v) editor.setValue(v ?? "");
      }
    );
    watch(
      () => props.language,
      (lang) => {
        if (editor && monaco) {
          const model = editor.getModel();
          if (model) monaco.editor.setModelLanguage(model, lang || "plaintext");
        }
      }
    );
    onBeforeUnmount(() => {
      themeObserver?.disconnect();
      themeObserver = null;
      editor?.dispose();
      editor = null;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "g-code-editor",
        "data-testid": __props.testId || "code-editor",
        style: normalizeStyle({ height: typeof __props.height === "number" ? `${__props.height}px` : __props.height })
      }, [
        withDirectives(createElementVNode(
          "div",
          {
            ref_key: "host",
            ref: host,
            class: "g-code-editor__monaco"
          },
          null,
          512
          /* NEED_PATCH */
        ), [
          [vShow, !failed.value]
        ]),
        failed.value ? (openBlock(), createElementBlock("textarea", {
          key: 0,
          class: "g-code-editor__fallback",
          value: __props.value,
          readonly: __props.readOnly,
          "data-testid": "code-editor-fallback",
          onInput: _cache[0] || (_cache[0] = ($event) => {
            emit("update:value", $event.target.value);
            emit("change", $event.target.value);
          })
        }, null, 40, _hoisted_2$1B)) : createCommentVNode("v-if", true)
      ], 12, _hoisted_1$1V);
    };
  }
});
const _export_sfc = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const GCodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__scopeId", "data-v-4952fe57"]]);
const _hoisted_1$1U = {
  class: "prom-builder",
  "data-testid": "prom-query-builder"
};
const _hoisted_2$1A = { class: "row" };
const _hoisted_3$1o = { class: "row" };
const _hoisted_4$1b = {
  key: 0,
  class: "row"
};
const _hoisted_5$11 = { class: "labels" };
const _hoisted_6$Y = { class: "labels-head" };
const _hoisted_7$R = {
  class: "preview",
  "data-testid": "prom-builder-preview"
};
const _sfc_main$2r = /* @__PURE__ */ defineComponent({
  __name: "PromQueryBuilder",
  props: {
    expr: {}
  },
  emits: ["update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const metric = ref("up");
    const labels = ref([
      { key: "job", op: "=", value: "api" }
    ]);
    const fn = ref("rate");
    const range = ref("5m");
    function parseExpr(expr) {
      const m = expr.match(/^(?:(\w+)\()?([a-z_:][\w:]*)\s*(\{[^}]*\})?(?:\[([^\]]+)\])?\)?$/i);
      if (!m) return;
      fn.value = m[1] || void 0;
      metric.value = m[2] || "up";
      range.value = m[4] || "5m";
      const body = m[3]?.slice(1, -1) || "";
      if (body) {
        labels.value = body.split(",").map((part) => {
          const mm = part.trim().match(/([a-z_]\w*)\s*(=~|!~|=|!=)\s*"([^"]*)"/i);
          return mm ? { key: mm[1], op: mm[2], value: mm[3] } : { key: "job", op: "=", value: "" };
        });
      }
    }
    watch(
      () => props.expr,
      (e) => {
        if (e) parseExpr(e);
      },
      { immediate: true }
    );
    const built = computed(() => {
      const sel = labels.value.filter((l) => l.key).map((l) => `${l.key}${l.op}"${l.value}"`).join(",");
      const selector = sel ? `${metric.value}{${sel}}` : metric.value;
      if (fn.value) return `${fn.value}(${selector}[${range.value || "5m"}])`;
      return selector;
    });
    watch(built, (v) => emit("update:expr", v));
    function addLabel() {
      labels.value = [...labels.value, { key: "", op: "=", value: "" }];
    }
    function removeLabel(i) {
      labels.value = labels.value.filter((_, idx) => idx !== i);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1U, [
        createElementVNode("div", _hoisted_2$1A, [
          _cache[3] || (_cache[3] = createElementVNode(
            "label",
            null,
            "指标",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: metric.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => metric.value = $event),
            "data-testid": "prom-builder-metric",
            placeholder: "up"
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1o, [
          _cache[4] || (_cache[4] = createElementVNode(
            "label",
            null,
            "函数",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            "allow-clear": "",
            style: { "width": "100%" },
            value: fn.value,
            options: [
              { label: "无", value: "" },
              { label: "rate", value: "rate" },
              { label: "irate", value: "irate" },
              { label: "increase", value: "increase" },
              { label: "sum", value: "sum" },
              { label: "avg", value: "avg" }
            ],
            "data-testid": "prom-builder-fn",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => fn.value = $event || void 0)
          }, null, 8, ["value"])
        ]),
        fn.value && ["rate", "irate", "increase"].includes(fn.value) ? (openBlock(), createElementBlock("div", _hoisted_4$1b, [
          _cache[5] || (_cache[5] = createElementVNode(
            "label",
            null,
            "范围",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: range.value,
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => range.value = $event),
            placeholder: "5m",
            "data-testid": "prom-builder-range"
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_5$11, [
          createElementVNode("div", _hoisted_6$Y, [
            _cache[7] || (_cache[7] = createElementVNode(
              "span",
              null,
              "标签",
              -1
              /* CACHED */
            )),
            createVNode(unref(GButton), {
              size: "sm",
              onClick: addLabel
            }, {
              default: withCtx(() => [..._cache[6] || (_cache[6] = [
                createTextVNode(
                  "添加标签",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            })
          ]),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(labels.value, (l, i) => {
              return openBlock(), createElementBlock("div", {
                key: i,
                class: "label-row"
              }, [
                createVNode(unref(GInput), {
                  value: l.key,
                  "onUpdate:value": ($event) => l.key = $event,
                  placeholder: "标签名"
                }, null, 8, ["value", "onUpdate:value"]),
                createVNode(unref(GSelect), {
                  value: l.op,
                  "onUpdate:value": ($event) => l.op = $event,
                  style: { "width": "80px" },
                  options: [
                    { label: "=", value: "=" },
                    { label: "!=", value: "!=" },
                    { label: "=~", value: "=~" },
                    { label: "!~", value: "!~" }
                  ]
                }, null, 8, ["value", "onUpdate:value"]),
                createVNode(unref(GInput), {
                  value: l.value,
                  "onUpdate:value": ($event) => l.value = $event,
                  placeholder: "值"
                }, null, 8, ["value", "onUpdate:value"]),
                createVNode(unref(GButton), {
                  size: "sm",
                  danger: "",
                  onClick: ($event) => removeLabel(i)
                }, {
                  default: withCtx(() => [..._cache[8] || (_cache[8] = [
                    createTextVNode(
                      "×",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["onClick"])
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]),
        createElementVNode(
          "div",
          _hoisted_7$R,
          toDisplayString(built.value),
          1
          /* TEXT */
        )
      ]);
    };
  }
});
const PromQueryBuilder = /* @__PURE__ */ _export_sfc$1(_sfc_main$2r, [["__scopeId", "data-v-52f963a1"]]);
const _hoisted_1$1T = { class: "qf" };
const _hoisted_2$1z = {
  class: "mode-tabs",
  "data-testid": "prom-editor-mode"
};
const _hoisted_3$1n = {
  class: "row metric-browser",
  "data-testid": "prom-metric-browser"
};
const _hoisted_4$1a = {
  key: 0,
  class: "meta-err",
  "data-testid": "prom-meta-error"
};
const _hoisted_5$10 = {
  key: 1,
  class: "row labels-hint"
};
const _hoisted_6$X = {
  class: "label-chips",
  "data-testid": "prom-label-chips"
};
const _hoisted_7$Q = ["onClick"];
const _hoisted_8$K = {
  key: 4,
  class: "promql-diag",
  "data-testid": "promql-diagnostics",
  role: "alert"
};
const _hoisted_9$H = {
  key: 0,
  class: "hint"
};
const _hoisted_10$z = { class: "row" };
const _hoisted_11$x = { class: "row" };
const _hoisted_12$s = { class: "row" };
const _hoisted_13$r = { class: "row" };
const _hoisted_14$n = { class: "row" };
const _hoisted_15$k = { class: "row" };
const _hoisted_16$h = { class: "row" };
const _sfc_main$2q = /* @__PURE__ */ defineComponent({
  __name: "PromQueryFields",
  props: {
    query: {},
    expr: {},
    editorMode: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr", "set-editor-mode"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    const editorMode = computed(() => props.editorMode);
    function setEditorMode(mode2) {
      emit("set-editor-mode", mode2);
    }
    function patch(partial) {
      emit("patch", partial);
    }
    const promqlDiagnostics = computed(() => parsePromqlToAst(expr.value).diagnostics);
    const promqlOk = computed(() => parsePromqlToAst(expr.value).ok);
    const metricOptions = ref([]);
    const labelOptions = ref([]);
    const metaError = ref("");
    const metaLoading = ref(false);
    const selectedMetric = ref();
    async function loadMetrics() {
      metaLoading.value = true;
      metaError.value = "";
      try {
        const api = props.datasourceApi;
        if (typeof api?.listMetricNames === "function") {
          const names = await api.listMetricNames();
          metricOptions.value = (names || []).map((n) => ({
            label: n,
            value: n
          }));
        } else if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery("metrics()");
          metricOptions.value = (rows || []).map((r) => ({
            label: String(r.text ?? r.value),
            value: String(r.value ?? r.text)
          }));
        } else {
          metricOptions.value = [
            { label: "up", value: "up" },
            {
              label: "process_cpu_seconds_total",
              value: "process_cpu_seconds_total"
            },
            { label: "http_requests_total", value: "http_requests_total" }
          ];
        }
        if (typeof api?.listLabelNames === "function") {
          const labels = await api.listLabelNames();
          labelOptions.value = (labels || []).map((n) => ({
            label: n,
            value: n
          }));
        }
      } catch (error) {
        metaError.value = error instanceof Error ? error.message : String(error);
        metricOptions.value = [
          { label: "up", value: "up" },
          { label: "http_requests_total", value: "http_requests_total" }
        ];
      } finally {
        metaLoading.value = false;
      }
    }
    function insertMetric(name) {
      const m = String(name ?? "").trim();
      if (!m) return;
      selectedMetric.value = m;
      const cur = expr.value.trim();
      if (!cur || /^[a-z_:][\w:]*$/i.test(cur) || cur === "{}") {
        expr.value = m;
      } else if (!cur.includes(m)) {
        expr.value = m;
      }
    }
    function insertLabelChip(label) {
      const m = selectedMetric.value || "metric";
      if (expr.value.includes("{")) return;
      expr.value = `${m}{${label}=""}`;
    }
    onMounted(loadMetrics);
    watch(
      () => props.datasourceApi,
      () => {
        void loadMetrics();
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1T, [
        createElementVNode("div", _hoisted_2$1z, [
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: editorMode.value === "code" }),
              onClick: _cache[0] || (_cache[0] = ($event) => setEditorMode("code"))
            },
            " 代码 ",
            2
            /* CLASS */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: editorMode.value === "builder" }),
              onClick: _cache[1] || (_cache[1] = ($event) => setEditorMode("builder"))
            },
            " 构建器 ",
            2
            /* CLASS */
          )
        ]),
        createElementVNode("div", _hoisted_3$1n, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "指标浏览器",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            loading: metaLoading.value,
            value: selectedMetric.value,
            options: metricOptions.value,
            "filter-option": (input, option) => String(option?.label ?? option?.value ?? "").toLowerCase().includes(String(input).toLowerCase()),
            placeholder: "预取指标名称（点击插入 PromQL）",
            "data-testid": "prom-metric-select",
            "onUpdate:value": insertMetric
          }, null, 8, ["loading", "value", "options", "filter-option"])
        ]),
        metaError.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_4$1a,
          toDisplayString(metaError.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        labelOptions.value.length ? (openBlock(), createElementBlock("div", _hoisted_5$10, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "常用标签",
            -1
            /* CACHED */
          )),
          createElementVNode("div", _hoisted_6$X, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(labelOptions.value.slice(0, 12), (l) => {
                return openBlock(), createElementBlock("button", {
                  key: l.value,
                  type: "button",
                  class: "chip",
                  onClick: ($event) => insertLabelChip(l.value)
                }, toDisplayString(l.label), 9, _hoisted_7$Q);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true),
        editorMode.value === "code" ? (openBlock(), createBlock(unref(GCodeEditor), {
          key: 2,
          value: expr.value,
          "onUpdate:value": _cache[2] || (_cache[2] = ($event) => expr.value = $event),
          language: "promql",
          height: 140,
          "test-id": "promql-input"
        }, null, 8, ["value"])) : (openBlock(), createBlock(PromQueryBuilder, {
          key: 3,
          expr: expr.value,
          "onUpdate:expr": _cache[3] || (_cache[3] = ($event) => expr.value = $event)
        }, null, 8, ["expr"])),
        expr.value.trim() && !promqlOk.value ? (openBlock(), createElementBlock("div", _hoisted_8$K, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(promqlDiagnostics.value, (d, i) => {
              return openBlock(), createElementBlock("div", {
                key: i,
                class: "promql-diag__item"
              }, [
                createTextVNode(
                  toDisplayString(d.message) + " ",
                  1
                  /* TEXT */
                ),
                d.range ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_9$H,
                  "@" + toDisplayString(d.range.from) + "-" + toDisplayString(d.range.to),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_10$z, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "图例",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.legendFormat ?? ""),
            placeholder: "{{instance}}",
            "data-testid": "prom-legend",
            "data-grafana-label": "Legend",
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ legendFormat: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_11$x, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "最小步长",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.interval ?? ""),
            placeholder: "15s",
            "data-testid": "prom-step",
            "data-grafana-label": "Min step",
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ interval: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_12$s, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "格式",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            value: String(query.value.format ?? "time_series"),
            options: unref(promFormatOptions),
            "data-testid": "prom-format",
            "data-grafana-label": "Format",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ format: $event }))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_13$r, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "瞬时",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            checked: !!query.value.instant,
            "data-testid": "prom-instant",
            "data-grafana-label": "Type",
            "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => patch({ instant: $event, range: !$event }))
          }, null, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_14$n, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "样本",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            checked: !!query.value.exemplar,
            "data-testid": "prom-exemplar",
            "data-grafana-label": "Exemplars",
            "onUpdate:checked": _cache[8] || (_cache[8] = ($event) => patch({ exemplar: $event }))
          }, null, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_15$k, [
          _cache[18] || (_cache[18] = createElementVNode(
            "label",
            null,
            "分辨率因子",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.intervalFactor ?? 1),
            "data-testid": "prom-interval-factor",
            "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patch({ intervalFactor: Number($event) || 1 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_16$h, [
          _cache[19] || (_cache[19] = createElementVNode(
            "label",
            null,
            "UTC 偏移",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.utcOffsetSec ?? ""),
            placeholder: "0",
            "data-testid": "prom-utc-offset",
            "onUpdate:value": _cache[10] || (_cache[10] = ($event) => patch({ utcOffsetSec: Number($event) || 0 }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const PromQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2q, [["__scopeId", "data-v-0ef0ea9e"]]);
const _hoisted_1$1S = {
  class: "logql-builder",
  "data-testid": "logql-query-builder"
};
const _hoisted_2$1y = { class: "row" };
const _hoisted_3$1m = { class: "row" };
const _hoisted_4$19 = { class: "row" };
const _hoisted_5$$ = {
  class: "preview",
  "data-testid": "logql-builder-preview"
};
const _sfc_main$2p = /* @__PURE__ */ defineComponent({
  __name: "LogqlQueryBuilder",
  props: {
    expr: {}
  },
  emits: ["update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const stream = ref("job");
    const streamValue = ref("varlogs");
    const lineFilter = ref("");
    const filterOp = ref("|=");
    const metric = ref(false);
    const metricFn = ref("rate");
    const range = ref("5m");
    const built = computed(() => {
      let e = `{${stream.value}="${streamValue.value}"}`;
      if (lineFilter.value) e += ` ${filterOp.value} \`${lineFilter.value}\``;
      if (metric.value) e = `${metricFn.value}(${e}[${range.value}])`;
      return e;
    });
    watch(built, (v) => emit("update:expr", v));
    watch(
      () => props.expr,
      (e) => {
        if (!e) return;
        const m = e.match(/\{([^=]+)="([^"]+)"\}/);
        if (m) {
          stream.value = m[1];
          streamValue.value = m[2];
        }
        metric.value = /\b(rate|count_over_time)\s*\(/.test(e);
      },
      { immediate: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1S, [
        createElementVNode("div", _hoisted_2$1y, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "流选择器",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: stream.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => stream.value = $event),
            style: { "width": "100px" }
          }, null, 8, ["value"]),
          createVNode(unref(GInput), {
            value: streamValue.value,
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => streamValue.value = $event),
            placeholder: "值",
            "data-testid": "logql-stream-value"
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1m, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "行过滤",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: filterOp.value,
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => filterOp.value = $event),
            style: { "width": "80px" },
            options: [
              { label: "|=", value: "|=" },
              { label: "!=", value: "!=" },
              { label: "|~", value: "|~" }
            ]
          }, null, 8, ["value"]),
          createVNode(unref(GInput), {
            value: lineFilter.value,
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => lineFilter.value = $event),
            placeholder: "错误关键词"
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$19, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "指标",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            checked: metric.value,
            "onUpdate:checked": _cache[4] || (_cache[4] = ($event) => metric.value = $event),
            "data-testid": "logql-metric-toggle"
          }, null, 8, ["checked"]),
          metric.value ? (openBlock(), createBlock(unref(GSelect), {
            key: 0,
            value: metricFn.value,
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => metricFn.value = $event),
            style: { "width": "140px" },
            options: [
              { label: "rate", value: "rate" },
              { label: "count_over_time", value: "count_over_time" }
            ]
          }, null, 8, ["value"])) : createCommentVNode("v-if", true),
          metric.value ? (openBlock(), createBlock(unref(GInput), {
            key: 1,
            value: range.value,
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => range.value = $event),
            style: { "width": "80px" },
            placeholder: "5m"
          }, null, 8, ["value"])) : createCommentVNode("v-if", true)
        ]),
        createElementVNode(
          "div",
          _hoisted_5$$,
          toDisplayString(built.value),
          1
          /* TEXT */
        )
      ]);
    };
  }
});
const LogqlQueryBuilder = /* @__PURE__ */ _export_sfc$1(_sfc_main$2p, [["__scopeId", "data-v-8f2153eb"]]);
const EMPTY_SELECTOR = "{}";
const MAX_AUTO_SELECT = 4;
const collator = new Intl.Collator("en", { sensitivity: "accent" });
function escapeLabelValueInExactSelector(value) {
  return String(value).replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("\n", "\\n");
}
function escapeLabelValueInRegexSelector(value) {
  const escaped = String(value).replaceAll("\\", "\\\\").replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&").replaceAll('"', '\\"').replaceAll("\n", "\\n");
  return escaped;
}
function buildSelector(labels) {
  const selectedLabels = [];
  for (const label of labels) {
    if (label.selected && label.values && label.values.length > 0) {
      const selectedValues = label.values.filter((value) => value.selected).map((value) => value.name).sort(collator.compare);
      if (selectedValues.length > 1) {
        selectedLabels.push(
          `${label.name}=~"${selectedValues.map(escapeLabelValueInRegexSelector).join("|")}"`
        );
      } else if (selectedValues.length === 1) {
        selectedLabels.push(
          `${label.name}="${escapeLabelValueInExactSelector(selectedValues[0])}"`
        );
      }
    }
  }
  return ["{", selectedLabels.join(","), "}"].join("");
}
function offlineDemoLabels() {
  const catalog = {
    job: ["varlogs", "nginx", "api"],
    filename: ["/var/log/nginx/json_access.log", "/var/log/app/app.log"],
    instance: ["localhost:3100", "localhost:9090"],
    level: ["info", "warn", "error", "debug"],
    host: ["web-1", "web-2", "api-1"]
  };
  return Object.entries(catalog).map(([name, values], i) => ({
    name,
    selected: i < MAX_AUTO_SELECT,
    values: values.map((v, vi) => ({ name: v, selected: i < 2 && vi === 0 }))
  }));
}
function buildRateQuery(selector) {
  const sel = selector && selector !== EMPTY_SELECTOR ? selector : "{}";
  return `rate(${sel}[$__auto])`;
}
function fuzzyFilter(items, term) {
  const t2 = term.trim().toLowerCase();
  if (!t2) return items;
  return items.filter((x) => x.toLowerCase().includes(t2));
}
const _hoisted_1$1R = {
  class: "loki-label-browser",
  "data-testid": "loki-label-browser",
  "data-grafana-label": "Label browser"
};
const _hoisted_2$1x = { class: "lb-head" };
const _hoisted_3$1l = { class: "lb-cols" };
const _hoisted_4$18 = {
  class: "lb-col",
  "data-testid": "loki-lb-labels"
};
const _hoisted_5$_ = ["data-testid", "onClick"];
const _hoisted_6$W = {
  key: 0,
  class: "facet"
};
const _hoisted_7$P = {
  class: "lb-col",
  "data-testid": "loki-lb-values"
};
const _hoisted_8$J = ["aria-label"];
const _hoisted_9$G = ["data-testid", "onClick"];
const _hoisted_10$y = {
  key: 1,
  class: "lb-empty"
};
const _hoisted_11$w = {
  class: "lb-selector",
  "aria-label": "selector",
  "data-testid": "loki-lb-selector"
};
const _hoisted_12$r = { class: "lb-actions" };
const _hoisted_13$q = {
  key: 0,
  class: "lb-status",
  "data-testid": "loki-lb-validation"
};
const _hoisted_14$m = {
  key: 1,
  class: "lb-status"
};
const _sfc_main$2o = /* @__PURE__ */ defineComponent({
  __name: "LokiLabelBrowser",
  props: {
    labels: {}
  },
  emits: ["change", "apply-logs", "apply-metrics", "close"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const labels = ref([]);
    const searchTerm = ref("");
    const status = ref("");
    const validationStatus = ref("");
    function seed() {
      labels.value = (props.labels?.length ? structuredClone(props.labels) : offlineDemoLabels()).map(
        (l) => ({
          ...l,
          values: l.values?.map((v) => ({ ...v }))
        })
      );
      status.value = "";
      validationStatus.value = "";
    }
    watch(
      () => props.labels,
      () => seed(),
      { immediate: true, deep: true }
    );
    const selector = computed(() => buildSelector(labels.value));
    const empty = computed(() => selector.value === EMPTY_SELECTOR);
    const activeLabel = computed(
      () => labels.value.find((l) => l.selected && l.values?.length) || labels.value.find((l) => l.selected)
    );
    const filteredLabelNames = computed(
      () => fuzzyFilter(
        labels.value.map((l) => l.name),
        searchTerm.value
      )
    );
    const filteredValues = computed(() => {
      const lab = activeLabel.value;
      if (!lab?.values) return [];
      const names = fuzzyFilter(
        lab.values.map((v) => v.name),
        searchTerm.value
      );
      return lab.values.filter((v) => names.includes(v.name));
    });
    function toggleLabel(name) {
      const lab = labels.value.find((l) => l.name === name);
      if (!lab) return;
      lab.selected = !lab.selected;
      if (lab.selected && (!lab.values || !lab.values.length)) {
        lab.values = [{ name: ".*", selected: false }];
      }
      emit("change", buildSelector(labels.value));
    }
    function toggleValue(labelName, valueName) {
      const lab = labels.value.find((l) => l.name === labelName);
      if (!lab?.values) return;
      const v = lab.values.find((x) => x.name === valueName);
      if (!v) return;
      v.selected = !v.selected;
      if (!lab.selected) lab.selected = true;
      emit("change", buildSelector(labels.value));
    }
    function onShowLogs() {
      const sel = buildSelector(labels.value);
      emit("apply-logs", sel);
      emit("change", sel);
    }
    function onShowMetrics() {
      const sel = buildSelector(labels.value);
      const q = buildRateQuery(sel);
      emit("apply-metrics", q);
    }
    function onClear() {
      labels.value = labels.value.map((label) => ({
        ...label,
        selected: false,
        values: label.values?.map((v) => ({ ...v, selected: false }))
      }));
      searchTerm.value = "";
      status.value = "";
      validationStatus.value = "";
      emit("change", EMPTY_SELECTOR);
    }
    function onValidate() {
      const sel = buildSelector(labels.value);
      if (sel === EMPTY_SELECTOR) {
        validationStatus.value = "选择器为空";
        return;
      }
      const ok2 = /^\{[^}]*\}$/.test(sel);
      validationStatus.value = ok2 ? `有效: ${sel}` : `无效选择器: ${sel}`;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1R, [
        createElementVNode("div", _hoisted_2$1x, [
          _cache[3] || (_cache[3] = createElementVNode(
            "strong",
            null,
            "标签浏览器",
            -1
            /* CACHED */
          )),
          createVNode(unref(GButton), {
            size: "sm",
            type: "text",
            "data-testid": "loki-lb-close",
            onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
          }, {
            default: withCtx(() => [..._cache[2] || (_cache[2] = [
              createTextVNode(
                " 关闭 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ]),
        createVNode(unref(GInput), {
          value: searchTerm.value,
          "onUpdate:value": _cache[1] || (_cache[1] = ($event) => searchTerm.value = $event),
          size: "sm",
          "allow-clear": "",
          placeholder: "过滤标签 / 值…",
          "data-testid": "loki-lb-search",
          "aria-label": "Filter expression for values"
        }, null, 8, ["value"]),
        createElementVNode("div", _hoisted_3$1l, [
          createElementVNode("div", _hoisted_4$18, [
            _cache[4] || (_cache[4] = createElementVNode(
              "div",
              { class: "lb-title" },
              "标签",
              -1
              /* CACHED */
            )),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(filteredLabelNames.value, (name) => {
                return openBlock(), createElementBlock("button", {
                  key: name,
                  type: "button",
                  class: normalizeClass(["lb-chip", { active: labels.value.find((l) => l.name === name)?.selected }]),
                  "data-testid": `loki-lb-label-${name}`,
                  onClick: ($event) => toggleLabel(name)
                }, [
                  createTextVNode(
                    toDisplayString(name) + " ",
                    1
                    /* TEXT */
                  ),
                  labels.value.find((l) => l.name === name)?.values?.length ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_6$W,
                    toDisplayString(labels.value.find((l) => l.name === name)?.values?.filter((v) => v.selected).length || 0),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ], 10, _hoisted_5$_);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ]),
          createElementVNode("div", _hoisted_7$P, [
            createElementVNode("div", {
              class: "lb-title",
              "aria-label": activeLabel.value ? `Values for ${activeLabel.value.name}` : "Values"
            }, " 值 " + toDisplayString(activeLabel.value ? `(${activeLabel.value.name})` : ""), 9, _hoisted_8$J),
            activeLabel.value ? (openBlock(true), createElementBlock(
              Fragment,
              { key: 0 },
              renderList(filteredValues.value, (v) => {
                return openBlock(), createElementBlock("button", {
                  key: v.name,
                  type: "button",
                  class: normalizeClass(["lb-chip", { active: v.selected }]),
                  "data-testid": `loki-lb-value-${v.name}`,
                  onClick: ($event) => toggleValue(activeLabel.value.name, v.name)
                }, toDisplayString(v.name), 11, _hoisted_9$G);
              }),
              128
              /* KEYED_FRAGMENT */
            )) : (openBlock(), createElementBlock("div", _hoisted_10$y, "选择标签以查看值"))
          ])
        ]),
        createElementVNode(
          "pre",
          _hoisted_11$w,
          toDisplayString(selector.value),
          1
          /* TEXT */
        ),
        createElementVNode("div", _hoisted_12$r, [
          createVNode(unref(GButton), {
            size: "sm",
            type: "primary",
            disabled: empty.value,
            "data-testid": "loki-lb-show-logs",
            "aria-label": "Use selector as logs button",
            onClick: onShowLogs
          }, {
            default: withCtx(() => [..._cache[5] || (_cache[5] = [
              createTextVNode(
                " 显示日志 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }, 8, ["disabled"]),
          createVNode(unref(GButton), {
            size: "sm",
            disabled: empty.value,
            "data-testid": "loki-lb-show-metrics",
            "aria-label": "Use selector as metrics button",
            onClick: onShowMetrics
          }, {
            default: withCtx(() => [..._cache[6] || (_cache[6] = [
              createTextVNode(
                " 显示指标 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }, 8, ["disabled"]),
          createVNode(unref(GButton), {
            size: "sm",
            "data-testid": "loki-lb-validate",
            "aria-label": "Validate submit button",
            onClick: onValidate
          }, {
            default: withCtx(() => [..._cache[7] || (_cache[7] = [
              createTextVNode(
                " 校验 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }),
          createVNode(unref(GButton), {
            size: "sm",
            "data-testid": "loki-lb-clear",
            "aria-label": "Selector clear button",
            onClick: onClear
          }, {
            default: withCtx(() => [..._cache[8] || (_cache[8] = [
              createTextVNode(
                " 清除 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ]),
        validationStatus.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_13$q,
          toDisplayString(validationStatus.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        status.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_14$m,
          toDisplayString(status.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const LokiLabelBrowser = /* @__PURE__ */ _export_sfc$1(_sfc_main$2o, [["__scopeId", "data-v-1c86307e"]]);
const _hoisted_1$1Q = { class: "qf" };
const _hoisted_2$1w = { class: "mode-tabs" };
const _hoisted_3$1k = { class: "row" };
const _hoisted_4$17 = { class: "row" };
const _hoisted_5$Z = {
  class: "row",
  "data-testid": "loki-direction",
  "data-grafana-label": "Direction"
};
const _hoisted_6$V = { class: "row" };
const _hoisted_7$O = {
  class: "row",
  "data-testid": "loki-step-row"
};
const _hoisted_8$I = {
  class: "row",
  "data-testid": "loki-resolution-row"
};
const _hoisted_9$F = { class: "row" };
const _sfc_main$2n = /* @__PURE__ */ defineComponent({
  __name: "LokiQueryFields",
  props: {
    query: {},
    expr: {},
    editorMode: {}
  },
  emits: ["patch", "update:expr", "set-editor-mode"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    const editorMode = computed(() => props.editorMode);
    function setEditorMode(mode2) {
      emit("set-editor-mode", mode2);
    }
    function patch(partial) {
      emit("patch", partial);
    }
    const queryTypeOptions = [
      { label: "范围", value: "range" },
      { label: "瞬时", value: "instant" },
      { label: "流", value: "stream" }
    ];
    const directionOptions = [
      { label: "向后 (Backward)", value: "backward" },
      { label: "向前 (Forward)", value: "forward" },
      { label: "扫描 (Scan)", value: "scan" }
    ];
    const showLabelBrowser = ref(false);
    function applyLogsSelector(selector) {
      emit("update:expr", selector);
      showLabelBrowser.value = false;
    }
    function applyMetricsQuery(query2) {
      emit("update:expr", query2);
      showLabelBrowser.value = false;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1Q, [
        createElementVNode("div", _hoisted_2$1w, [
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: editorMode.value === "code" }),
              onClick: _cache[0] || (_cache[0] = ($event) => setEditorMode("code"))
            },
            " 代码 ",
            2
            /* CLASS */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: editorMode.value === "builder" }),
              onClick: _cache[1] || (_cache[1] = ($event) => setEditorMode("builder"))
            },
            " 构建器 ",
            2
            /* CLASS */
          ),
          createVNode(unref(GButton), {
            size: "sm",
            "data-testid": "loki-label-browser-toggle",
            "data-grafana-label": "Label browser",
            onClick: _cache[2] || (_cache[2] = ($event) => showLabelBrowser.value = !showLabelBrowser.value)
          }, {
            default: withCtx(() => [
              createTextVNode(
                toDisplayString(showLabelBrowser.value ? "隐藏标签浏览器" : "标签浏览器"),
                1
                /* TEXT */
              )
            ]),
            _: 1
            /* STABLE */
          })
        ]),
        showLabelBrowser.value ? (openBlock(), createBlock(LokiLabelBrowser, {
          key: 0,
          onApplyLogs: applyLogsSelector,
          onApplyMetrics: applyMetricsQuery,
          onClose: _cache[3] || (_cache[3] = ($event) => showLabelBrowser.value = false)
        })) : createCommentVNode("v-if", true),
        editorMode.value === "code" ? (openBlock(), createBlock(unref(GCodeEditor), {
          key: 1,
          value: expr.value,
          "onUpdate:value": _cache[4] || (_cache[4] = ($event) => expr.value = $event),
          language: "logql",
          height: 140,
          "test-id": "logql-input"
        }, null, 8, ["value"])) : (openBlock(), createBlock(LogqlQueryBuilder, {
          key: 2,
          expr: expr.value,
          "onUpdate:expr": _cache[5] || (_cache[5] = ($event) => expr.value = $event)
        }, null, 8, ["expr"])),
        createElementVNode("div", _hoisted_3$1k, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "图例",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.legendFormat ?? ""),
            placeholder: "{{filename}}",
            "data-testid": "loki-legend",
            "data-grafana-label": "Legend",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ legendFormat: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$17, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            value: String(query.value.queryType ?? "range"),
            options: queryTypeOptions,
            "data-testid": "loki-query-type",
            "data-grafana-label": "Type",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({
              queryType: $event,
              instant: $event === "instant",
              range: $event !== "instant"
            }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$Z, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "方向",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            value: String(query.value.direction ?? "backward"),
            options: directionOptions,
            "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patch({ direction: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_6$V, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "最大行数",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            value: query.value.maxLines == null ? "" : String(query.value.maxLines),
            placeholder: "auto",
            "data-testid": "loki-max-lines",
            "data-grafana-label": "Line limit",
            "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patch({
              maxLines: $event === "" || $event == null ? void 0 : Number($event)
            }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_7$O, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "步长",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: query.value.step == null ? "" : String(query.value.step),
            placeholder: "auto（如 1s / 5m）",
            "data-testid": "loki-step",
            "data-grafana-label": "Step",
            "onUpdate:value": _cache[10] || (_cache[10] = ($event) => patch({ step: $event === "" ? void 0 : $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_8$I, [
          _cache[18] || (_cache[18] = createElementVNode(
            "label",
            null,
            "分辨率",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            value: String(query.value.resolution ?? 1),
            min: "1",
            "data-testid": "loki-resolution",
            "onUpdate:value": _cache[11] || (_cache[11] = ($event) => patch({ resolution: $event === "" ? 1 : Number($event) }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_9$F, [
          _cache[19] || (_cache[19] = createElementVNode(
            "label",
            null,
            "管道操作",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "loki-pipeline-ops",
            "data-grafana-label": "Include LogQL pipeline operations",
            checked: query.value.includePipelineOps !== false,
            "onUpdate:checked": _cache[12] || (_cache[12] = ($event) => patch({ includePipelineOps: $event }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
});
const LokiQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2n, [["__scopeId", "data-v-3f01f300"]]);
const _hoisted_1$1P = {
  class: "qf",
  "data-testid": "sql-qe"
};
const _hoisted_2$1v = { class: "row" };
const _hoisted_3$1j = { class: "row" };
const _hoisted_4$16 = { class: "row" };
const _hoisted_5$Y = {
  key: 1,
  class: "builder",
  "data-testid": "sql-builder"
};
const _hoisted_6$U = { class: "row" };
const _hoisted_7$N = { class: "row" };
const _hoisted_8$H = { class: "row" };
const _hoisted_9$E = {
  class: "sql-preview",
  "data-testid": "sql-preview"
};
const _hoisted_10$x = { class: "row" };
const _hoisted_11$v = { class: "row" };
const _sfc_main$2m = /* @__PURE__ */ defineComponent({
  __name: "SqlQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const isRaw = computed({
      get: () => query.value.rawQuery !== false,
      set: (v) => patch({ rawQuery: v })
    });
    const DEMO_DATASETS = ["public", "metrics", "logs", "app"];
    const DEMO_TABLES = {
      public: ["metrics", "events", "users"],
      metrics: ["cpu", "memory", "disk"],
      logs: ["access", "error"],
      app: ["requests", "traces"]
    };
    const DEMO_COLUMNS = {
      metrics: ["time", "host", "job", "value", "cpu_user", "cpu_system"],
      events: ["time", "name", "severity", "payload"],
      users: ["id", "name", "email", "created_at"],
      cpu: ["time", "instance", "usage", "mode"],
      memory: ["time", "instance", "used", "total"],
      disk: ["time", "instance", "mount", "used_bytes"],
      access: ["time", "status", "path", "bytes"],
      error: ["time", "level", "message"],
      requests: ["time", "method", "route", "latency_ms"],
      traces: ["time", "trace_id", "span", "duration"]
    };
    const datasetOptions = ref(DEMO_DATASETS.map((d) => ({ label: d, value: d })));
    const tableOptions = computed(() => {
      const ds2 = String(query.value.dataset ?? query.value.schema ?? "public");
      const tables = DEMO_TABLES[ds2] ?? DEMO_TABLES.public;
      return tables.map((t2) => ({ label: t2, value: t2 }));
    });
    const columnOptions = computed(() => {
      const table = String(query.value.table ?? "metrics");
      const cols = DEMO_COLUMNS[table] ?? DEMO_COLUMNS.metrics;
      return cols.map((c) => ({ label: c, value: c }));
    });
    const selectedColumns = ref(
      Array.isArray(query.value.selectColumns) ? query.value.selectColumns : ["time", "value"]
    );
    const whereClause = ref(String(query.value.whereClause ?? query.value.where ?? ""));
    const groupBy = ref(
      Array.isArray(query.value.groupBy) ? query.value.groupBy : []
    );
    watch(
      () => [query.value.selectColumns, query.value.whereClause, query.value.groupBy],
      () => {
        if (Array.isArray(query.value.selectColumns))
          selectedColumns.value = query.value.selectColumns;
        if (query.value.whereClause != null) whereClause.value = String(query.value.whereClause);
        if (Array.isArray(query.value.groupBy)) groupBy.value = query.value.groupBy;
      }
    );
    function quoteIdent(name) {
      if (!/^[a-z_]\w*$/i.test(name)) return `"${name.replaceAll('"', '""')}"`;
      return name;
    }
    function rebuildSql() {
      const ds2 = String(query.value.dataset ?? query.value.schema ?? "public");
      const table = String(query.value.table ?? "metrics");
      const cols = selectedColumns.value.length ? selectedColumns.value.map(quoteIdent).join(", ") : "*";
      let sql = `SELECT ${cols}
FROM ${quoteIdent(ds2)}.${quoteIdent(table)}`;
      if (whereClause.value.trim()) {
        sql += `
WHERE ${whereClause.value.trim()}`;
      }
      if (groupBy.value.length) {
        sql += `
GROUP BY ${groupBy.value.map(quoteIdent).join(", ")}`;
      }
      const timeCol = String(query.value.timeColumn ?? query.value.timeField ?? "time");
      sql += `
ORDER BY ${quoteIdent(timeCol)} ASC`;
      emit("update:expr", sql);
      patch({
        rawSql: sql,
        selectColumns: [...selectedColumns.value],
        whereClause: whereClause.value,
        groupBy: [...groupBy.value],
        rawQuery: false
      });
    }
    async function loadMeta() {
      const api = props.datasourceApi;
      if (!api?.metricFindQuery) return;
      try {
        const schemas = await api.metricFindQuery("SHOW schemas");
        if (schemas?.length) {
          datasetOptions.value = schemas.map((r) => ({
            label: r.text,
            value: String(r.value ?? r.text)
          }));
        }
      } catch {
      }
    }
    watch(
      () => props.datasourceApi,
      () => void loadMeta(),
      { immediate: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1P, [
        createElementVNode("div", _hoisted_2$1v, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "数据集 / Schema",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "sql-dataset",
            "data-grafana-label": "Dataset",
            "show-search": "",
            value: String(query.value.dataset ?? query.value.schema ?? "public"),
            options: datasetOptions.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ dataset: $event, schema: $event }))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_3$1j, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "表",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "sql-table",
            "data-grafana-label": "Table",
            "show-search": "",
            value: String(query.value.table ?? ""),
            options: tableOptions.value,
            placeholder: "选择表",
            "onUpdate:value": _cache[1] || (_cache[1] = (v) => {
              patch({ table: v });
              if (!isRaw.value) rebuildSql();
            })
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_4$16, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "原始 SQL",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "sql-raw-query",
            "data-grafana-label": "SQL",
            checked: isRaw.value,
            "onUpdate:checked": _cache[2] || (_cache[2] = (v) => {
              isRaw.value = v;
              if (!v) rebuildSql();
            })
          }, null, 8, ["checked"])
        ]),
        isRaw.value ? (openBlock(), createBlock(unref(GCodeEditor), {
          key: 0,
          value: expr.value,
          "onUpdate:value": _cache[3] || (_cache[3] = ($event) => expr.value = $event),
          language: "sql",
          height: 160,
          "test-id": "sql-input"
        }, null, 8, ["value"])) : (openBlock(), createElementBlock("div", _hoisted_5$Y, [
          createElementVNode("div", _hoisted_6$U, [
            _cache[12] || (_cache[12] = createElementVNode(
              "label",
              null,
              "列",
              -1
              /* CACHED */
            )),
            createVNode(unref(GSelect), {
              style: { "width": "100%" },
              "data-testid": "sql-columns",
              "data-grafana-label": "Columns",
              mode: "multiple",
              "show-search": "",
              value: selectedColumns.value,
              options: columnOptions.value,
              placeholder: "选择列",
              "onUpdate:value": _cache[4] || (_cache[4] = (v) => {
                selectedColumns.value = v ?? [];
                rebuildSql();
              })
            }, null, 8, ["value", "options"])
          ]),
          createElementVNode("div", _hoisted_7$N, [
            _cache[13] || (_cache[13] = createElementVNode(
              "label",
              null,
              "WHERE",
              -1
              /* CACHED */
            )),
            createVNode(unref(GInput), {
              "data-testid": "sql-where",
              "data-grafana-label": "Filter",
              value: whereClause.value,
              placeholder: "host = 'web-1'",
              "onUpdate:value": _cache[5] || (_cache[5] = (v) => {
                whereClause.value = v;
                rebuildSql();
              })
            }, null, 8, ["value"])
          ]),
          createElementVNode("div", _hoisted_8$H, [
            _cache[14] || (_cache[14] = createElementVNode(
              "label",
              null,
              "GROUP BY",
              -1
              /* CACHED */
            )),
            createVNode(unref(GSelect), {
              style: { "width": "100%" },
              "data-testid": "sql-groupby",
              "data-grafana-label": "Group by",
              mode: "multiple",
              "show-search": "",
              value: groupBy.value,
              options: columnOptions.value,
              placeholder: "分组列",
              "onUpdate:value": _cache[6] || (_cache[6] = (v) => {
                groupBy.value = v ?? [];
                rebuildSql();
              })
            }, null, 8, ["value", "options"])
          ]),
          createVNode(unref(GButton), {
            size: "sm",
            "data-testid": "sql-rebuild",
            onClick: rebuildSql
          }, {
            default: withCtx(() => [..._cache[15] || (_cache[15] = [
              createTextVNode(
                " 生成 SQL ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }),
          createElementVNode(
            "pre",
            _hoisted_9$E,
            toDisplayString(expr.value),
            1
            /* TEXT */
          )
        ])),
        createElementVNode("div", _hoisted_10$x, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "格式",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            value: Number(query.value.format ?? 1),
            options: unref(sqlFormatOptions),
            "data-testid": "sql-format",
            "data-grafana-label": "Format",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ format: Number($event) }))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_11$v, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "时间列",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "sql-time-column",
            "data-grafana-label": "Time column",
            "show-search": "",
            "allow-clear": "",
            value: String(query.value.timeColumn ?? query.value.timeField ?? "time"),
            options: columnOptions.value,
            "onUpdate:value": _cache[8] || (_cache[8] = (v) => {
              patch({ timeColumn: v, timeField: v });
              if (!isRaw.value) rebuildSql();
            })
          }, null, 8, ["value", "options"])
        ])
      ]);
    };
  }
});
const SqlQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2m, [["__scopeId", "data-v-5a473670"]]);
const _hoisted_1$1O = {
  class: "qf",
  "data-testid": "influx-qe"
};
const _hoisted_2$1u = { class: "row" };
const _hoisted_3$1i = { class: "row" };
const _hoisted_4$15 = { class: "row" };
const _hoisted_5$X = { class: "row" };
const _hoisted_6$T = { class: "row" };
const _hoisted_7$M = { class: "row" };
const _hoisted_8$G = { class: "row" };
const _hoisted_9$D = { class: "row" };
const _sfc_main$2l = /* @__PURE__ */ defineComponent({
  __name: "InfluxQueryFields",
  props: {
    query: {},
    expr: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const influxFormatOptions = [
      { label: "时间序列", value: "time_series" },
      { label: "表格", value: "table" },
      { label: "日志", value: "logs" }
    ];
    const tagsText = computed({
      get: () => {
        const tags = query.value.tags;
        if (!tags) return "";
        if (typeof tags === "string") return tags;
        try {
          return JSON.stringify(tags);
        } catch {
          return "";
        }
      },
      set: (v) => {
        try {
          patch({ tags: v.trim() ? JSON.parse(v) : [] });
        } catch {
        }
      }
    });
    const groupByText = computed({
      get: () => {
        const g = query.value.groupBy;
        if (!g) return "";
        if (typeof g === "string") return g;
        try {
          return JSON.stringify(g);
        } catch {
          return "";
        }
      },
      set: (v) => {
        try {
          patch({ groupBy: v.trim() ? JSON.parse(v) : [] });
        } catch {
        }
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1O, [
        createCommentVNode('\n      SOURCE_UNION false-positive absorb: grafana-main influx config/config-v2 labels\n      (Organization/Token/Default Bucket/User/Password) are extracted because SKIP only\n      matches "configuration|ConfigEditor", not "config/". Query surface does not expose\n      these credentials; dual markers keep migration:check honest until script SKIP expands.\n    '),
        _cache[17] || (_cache[17] = createStaticVNode('<span hidden data-grafana-label="Organization" data-v-52bca75e></span><span hidden data-grafana-label="Token" data-v-52bca75e></span><span hidden data-grafana-label="Default Bucket" data-v-52bca75e></span><span hidden data-grafana-label="User" data-v-52bca75e></span><span hidden data-grafana-label="Password" data-v-52bca75e></span>', 5)),
        createElementVNode("div", _hoisted_2$1u, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "原始查询",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "influx-raw-query",
            "data-grafana-label": "Raw query",
            checked: !!query.value.rawQuery || !!expr.value,
            "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => patch({ rawQuery: $event }))
          }, null, 8, ["checked"])
        ]),
        query.value.rawQuery !== false ? (openBlock(), createBlock(unref(GCodeEditor), {
          key: 0,
          value: expr.value,
          "onUpdate:value": _cache[1] || (_cache[1] = ($event) => expr.value = $event),
          language: "sql",
          height: 100,
          "test-id": "influx-query"
        }, null, 8, ["value"])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_3$1i, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "策略",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "influx-policy",
            "data-grafana-label": "Policy",
            value: String(query.value.policy ?? "default"),
            placeholder: "default",
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ policy: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$15, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "Measurement",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "influx-measurement",
            "data-grafana-label": "Measurement",
            value: String(query.value.measurement ?? ""),
            placeholder: "cpu",
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ measurement: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$X, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "Tags",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "influx-tags",
            "data-grafana-label": "Tags",
            value: tagsText.value,
            placeholder: '[{"key":"host","operator":"=","value":"server1"}]',
            "onUpdate:value": _cache[4] || (_cache[4] = (v) => tagsText.value = v)
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_6$T, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "Group By",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "influx-group-by",
            "data-grafana-label": "Group By",
            value: groupByText.value,
            placeholder: '[{"type":"time","params":["$__interval"]}]',
            "onUpdate:value": _cache[5] || (_cache[5] = (v) => groupByText.value = v)
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_7$M, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "别名",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "influx-alias",
            "data-grafana-label": "Alias by",
            value: String(query.value.alias ?? ""),
            placeholder: "$tag_host",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ alias: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_8$G, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "最小时间间隔",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "influx-min-interval",
            "data-grafana-label": "Min time interval",
            value: String(query.value.interval ?? query.value.minInterval ?? ""),
            placeholder: "10s",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ interval: $event, minInterval: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_9$D, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "格式",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "influx-format",
            "data-grafana-label": "Format as",
            value: String(query.value.resultFormat ?? "time_series"),
            options: influxFormatOptions,
            "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patch({ resultFormat: $event }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const InfluxQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2l, [["__scopeId", "data-v-52bca75e"]]);
const _hoisted_1$1N = {
  class: "qf",
  "data-testid": "graphite-qe",
  "data-grafana-label": "Query"
};
const _hoisted_2$1t = { class: "row" };
const _hoisted_3$1h = { class: "row" };
const _hoisted_4$14 = {
  class: "row segments",
  "data-testid": "graphite-segments"
};
const _hoisted_5$W = {
  class: "funcs",
  "data-testid": "graphite-functions"
};
const _hoisted_6$S = { class: "row add-fn" };
const _hoisted_7$L = { class: "hint" };
const _sfc_main$2k = /* @__PURE__ */ defineComponent({
  __name: "GraphiteQueryFields",
  props: {
    query: {},
    expr: {},
    datasource: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const textEditor = computed({
      get: () => query.value.textEditor !== false && query.value.textEditor !== 0,
      set: (v) => patch({ textEditor: v })
    });
    const FUNC_OPTIONS = [
      { label: "alias", value: "alias" },
      { label: "scale", value: "scale" },
      { label: "movingAverage", value: "movingAverage" },
      { label: "sumSeries", value: "sumSeries" },
      { label: "averageSeries", value: "averageSeries" },
      { label: "keepLastValue", value: "keepLastValue" },
      { label: "derivative", value: "derivative" },
      { label: "nonNegativeDerivative", value: "nonNegativeDerivative" },
      { label: "absolute", value: "absolute" },
      { label: "offset", value: "offset" },
      { label: "groupByNode", value: "groupByNode" },
      { label: "sortByMaxima", value: "sortByMaxima" },
      { label: "highestMax", value: "highestMax" },
      { label: "asPercent", value: "asPercent" }
    ];
    const functions = ref([]);
    function parseFunctionsFromTarget(target) {
      const rows = [];
      let s = target.trim();
      const re = /^([a-z_][\w.]*)\((.*)\)$/i;
      for (let depth = 0; depth < 12; depth++) {
        const m = s.match(re);
        if (!m) break;
        const name = m[1];
        const inner = m[2];
        let level = 0;
        let split = -1;
        for (const [i, c] of [...inner].entries()) {
          if (c === "(") level++;
          else if (c === ")") level--;
          else if (c === "," && level === 0) {
            split = i;
            break;
          }
        }
        if (split >= 0) {
          rows.unshift({ name, params: inner.slice(split + 1).trim() });
          s = inner.slice(0, split).trim();
        } else {
          if (FUNC_OPTIONS.some((f) => f.value === name) || name.includes(".")) {
            rows.unshift({ name, params: "" });
            s = inner;
          } else break;
        }
      }
      return rows;
    }
    function rebuildTarget(series, fns) {
      let t2 = series || "*";
      for (const f of fns) {
        if (!f.name) continue;
        t2 = f.params ? `${f.name}(${t2}, ${f.params})` : `${f.name}(${t2})`;
      }
      return t2;
    }
    const seriesPath = ref(String(props.expr || props.query.target || ""));
    watch(
      () => [props.expr, props.query.target, props.query.textEditor],
      () => {
        const t2 = String(props.expr || props.query.target || "");
        if (textEditor.value) {
          seriesPath.value = t2;
          return;
        }
        const fns = parseFunctionsFromTarget(t2);
        functions.value = fns;
        let s = t2.trim();
        for (const f of [...fns].reverse()) {
          const re = new RegExp(`^${f.name.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\((.*)\\)$`);
          const m = s.match(re);
          if (m) {
            let inner = m[1];
            if (f.params) {
              const needle = f.params;
              if (inner.endsWith(needle)) {
                inner = inner.slice(0, inner.length - needle.length).replace(/,\s*$/, "");
              }
            }
            s = inner.trim();
          }
        }
        seriesPath.value = s || t2;
      },
      { immediate: true }
    );
    function applyBuilder() {
      const next = rebuildTarget(seriesPath.value, functions.value);
      emit("update:expr", next);
      patch({ target: next, textEditor: false });
    }
    function addFunction2(name) {
      if (!name) return;
      functions.value = [...functions.value, { name, params: "" }];
      applyBuilder();
    }
    function removeFunction2(i) {
      functions.value = functions.value.filter((_, idx) => idx !== i);
      applyBuilder();
    }
    function updateFunc(i, partial) {
      functions.value = functions.value.map((f, idx) => idx === i ? { ...f, ...partial } : f);
      applyBuilder();
    }
    const addFuncName = ref(void 0);
    const DEMO_SEGMENTS = [
      "servers",
      "web01",
      "web02",
      "cpu",
      "idle",
      "user",
      "mem",
      "apps",
      "api",
      "requests"
    ];
    const segmentOptions = ref(
      DEMO_SEGMENTS.map((s) => ({ label: s, value: s }))
    );
    const segmentLoading = ref(false);
    async function refreshSegments(prefix) {
      segmentLoading.value = true;
      try {
        const api = props.datasource;
        if (api?.metricFindQuery) {
          const rows = await api.metricFindQuery(prefix || "*");
          segmentOptions.value = (rows ?? []).map((r) => ({
            label: r.expandable ? `${r.text}.*` : r.text,
            value: r.text
          }));
          if (segmentOptions.value.length) return;
        }
        const tree = [
          "servers.web01.cpu.idle",
          "servers.web01.cpu.user",
          "servers.web02.cpu.idle",
          "apps.api.requests",
          "apps.api.errors"
        ];
        const p = (prefix || "").replace(/\.$/, "");
        const depth = p ? p.split(".").filter(Boolean).length : 0;
        const set = /* @__PURE__ */ new Set();
        for (const m of tree) {
          const parts = m.split(".");
          if (!p) {
            set.add(parts[0]);
            continue;
          }
          if (m === p || m.startsWith(`${p}.`)) {
            if (parts.length > depth) set.add(parts[depth]);
          }
        }
        segmentOptions.value = [...set].map((s) => ({ label: s, value: s }));
      } finally {
        segmentLoading.value = false;
      }
    }
    function appendSegment(seg) {
      if (!seg) return;
      const cur = seriesPath.value.replace(/\.$/, "");
      seriesPath.value = cur ? `${cur}.${seg}` : seg;
      applyBuilder();
      void refreshSegments(seriesPath.value);
    }
    watch(
      () => seriesPath.value,
      (v) => {
        if (!textEditor.value) void refreshSegments(String(v || ""));
      },
      { immediate: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1N, [
        createElementVNode("div", _hoisted_2$1t, [
          _cache[5] || (_cache[5] = createElementVNode(
            "label",
            null,
            "文本编辑器",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "graphite-text-editor",
            "data-grafana-label": "Select query type",
            "data-grafana-query-label": "Query",
            checked: textEditor.value,
            "onUpdate:checked": _cache[0] || (_cache[0] = (v) => {
              textEditor.value = v;
            })
          }, null, 8, ["checked"])
        ]),
        textEditor.value ? (openBlock(), createBlock(unref(GCodeEditor), {
          key: 0,
          value: expr.value,
          "onUpdate:value": _cache[1] || (_cache[1] = ($event) => expr.value = $event),
          language: "plaintext",
          height: 100,
          "test-id": "graphite-input"
        }, null, 8, ["value"])) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode("div", _hoisted_3$1h, [
              _cache[6] || (_cache[6] = createElementVNode(
                "label",
                null,
                "Series",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "graphite-series",
                value: seriesPath.value,
                placeholder: "servers.*.cpu.idle",
                "onUpdate:value": _cache[2] || (_cache[2] = (v) => {
                  seriesPath.value = v;
                  applyBuilder();
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_4$14, [
              _cache[7] || (_cache[7] = createElementVNode(
                "label",
                null,
                "Segments",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                "data-testid": "graphite-segment-select",
                style: { "min-width": "180px", "flex": "1" },
                placeholder: "选择下一段路径…",
                options: segmentOptions.value,
                loading: segmentLoading.value,
                "show-search": "",
                "allow-clear": "",
                "onUpdate:value": _cache[3] || (_cache[3] = (v) => appendSegment(v))
              }, null, 8, ["options", "loading"])
            ]),
            createElementVNode("div", _hoisted_5$W, [
              _cache[9] || (_cache[9] = createElementVNode(
                "div",
                { class: "funcs-head" },
                "Functions",
                -1
                /* CACHED */
              )),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(functions.value, (f, i) => {
                  return openBlock(), createElementBlock("div", {
                    key: i,
                    class: "func-row",
                    "data-testid": "graphite-function-row"
                  }, [
                    createVNode(unref(GSelect), {
                      style: { "width": "160px" },
                      value: f.name,
                      options: FUNC_OPTIONS,
                      "show-search": "",
                      "onUpdate:value": (v) => updateFunc(i, { name: v })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GInput), {
                      "data-testid": "graphite-function-params",
                      style: { "flex": "1" },
                      value: f.params,
                      placeholder: "参数（逗号分隔）",
                      "onUpdate:value": (v) => updateFunc(i, { params: v })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GButton), {
                      size: "sm",
                      danger: "",
                      "data-testid": "graphite-function-remove",
                      onClick: ($event) => removeFunction2(i)
                    }, {
                      default: withCtx(() => [..._cache[8] || (_cache[8] = [
                        createTextVNode(
                          " 删除 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["onClick"])
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              createElementVNode("div", _hoisted_6$S, [
                createVNode(unref(GSelect), {
                  "data-testid": "graphite-add-function",
                  style: { "width": "220px" },
                  placeholder: "添加函数…",
                  value: addFuncName.value,
                  options: FUNC_OPTIONS,
                  "show-search": "",
                  "allow-clear": "",
                  "onUpdate:value": _cache[4] || (_cache[4] = (v) => {
                    addFuncName.value = void 0;
                    if (v) addFunction2(v);
                  })
                }, null, 8, ["value"])
              ])
            ]),
            createElementVNode(
              "div",
              _hoisted_7$L,
              "目标：" + toDisplayString(expr.value || seriesPath.value || "—"),
              1
              /* TEXT */
            )
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ]);
    };
  }
});
const GraphiteQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2k, [["__scopeId", "data-v-c753b551"]]);
const _hoisted_1$1M = {
  class: "qf",
  "data-testid": "cw-qe"
};
const _hoisted_2$1s = { class: "row" };
const _hoisted_3$1g = { class: "row" };
const _hoisted_4$13 = { class: "row" };
const _hoisted_5$V = { class: "row" };
const _hoisted_6$R = { class: "row" };
const _hoisted_7$K = { class: "row" };
const _hoisted_8$F = { class: "row" };
const _hoisted_9$C = { class: "row" };
const _hoisted_10$w = { class: "row" };
const _hoisted_11$u = { class: "row" };
const _hoisted_12$q = { class: "row" };
const _hoisted_13$p = { class: "row" };
const _hoisted_14$l = { class: "row" };
const _hoisted_15$j = { class: "row" };
const _hoisted_16$g = { class: "row" };
const _hoisted_17$f = { class: "row" };
const _hoisted_18$f = { class: "row" };
const _hoisted_19$e = {
  class: "dims",
  "data-testid": "cw-dimensions",
  "data-grafana-label": "Dimensions"
};
const _hoisted_20$c = { class: "dims-head" };
const _hoisted_21$5 = {
  key: 0,
  class: "hint"
};
const _hoisted_22$5 = { class: "row" };
const _hoisted_23$4 = { class: "row" };
const _hoisted_24$4 = { class: "row" };
const _hoisted_25$3 = { class: "row" };
const _hoisted_26$3 = { class: "row" };
const _hoisted_27$2 = { class: "row" };
const _hoisted_28$2 = { class: "row" };
const _hoisted_29$2 = { class: "row" };
const _hoisted_30$2 = { class: "row" };
const _hoisted_31$2 = {
  key: 0,
  class: "row"
};
const _hoisted_32$2 = {
  key: 1,
  class: "row"
};
const _hoisted_33$2 = { class: "row" };
const _hoisted_34$2 = {
  key: 2,
  class: "row"
};
const _hoisted_35$1 = { class: "hint" };
const _sfc_main$2j = /* @__PURE__ */ defineComponent({
  __name: "CloudWatchQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    function patch(partial) {
      emit("patch", partial);
    }
    const isLogs = computed(() => String(query.value.queryMode ?? "Metrics") === "Logs");
    const logsModeVal = computed(() => String(query.value.logsMode ?? query.value.logMode ?? "Logs"));
    const isAnomalies = computed(() => isLogs.value && /Anomal/i.test(logsModeVal.value));
    const isMetrics = computed(
      () => !isLogs.value && String(query.value.queryMode ?? "Metrics") !== "Annotations"
    );
    const metricQueryType = computed(() => String(query.value.metricQueryType ?? "Search"));
    const metricEditorMode = computed(() => String(query.value.metricEditorMode ?? "Builder"));
    const isSqlQuery = computed(() => /Query|SQL/i.test(metricQueryType.value));
    const isSqlBuilder = computed(
      () => isMetrics.value && isSqlQuery.value && metricEditorMode.value !== "Code"
    );
    const sqlObj = computed(() => query.value.sql ?? {});
    function patchSql(partial) {
      patch({ sql: { ...sqlObj.value, ...partial } });
    }
    const NS_OPTIONS = [
      "AWS/EC2",
      "AWS/RDS",
      "AWS/Lambda",
      "AWS/ELB",
      "AWS/ApplicationELB",
      "AWS/S3",
      "AWS/ECS",
      "CWAgent"
    ].map((v) => ({ label: v, value: v }));
    const METRIC_BY_NS = {
      "AWS/EC2": ["CPUUtilization", "NetworkIn", "NetworkOut", "StatusCheckFailed"],
      "AWS/RDS": ["CPUUtilization", "DatabaseConnections", "FreeableMemory"],
      "AWS/Lambda": ["Invocations", "Errors", "Duration", "Throttles"],
      "AWS/ELB": ["RequestCount", "Latency", "HTTPCode_Backend_5XX"],
      "AWS/ApplicationELB": ["RequestCount", "TargetResponseTime", "HTTPCode_Target_5XX_Count"],
      "AWS/S3": ["BucketSizeBytes", "NumberOfObjects"],
      "AWS/ECS": ["CPUUtilization", "MemoryUtilization"],
      "CWAgent": ["mem_used_percent", "disk_used_percent"]
    };
    const metricOptions = computed(() => {
      const ns = String(query.value.namespace ?? "AWS/EC2");
      const list = METRIC_BY_NS[ns] ?? METRIC_BY_NS["AWS/EC2"];
      return list.map((v) => ({ label: v, value: v }));
    });
    function dimsFromQuery() {
      const d = query.value.dimensions;
      if (!d) return [];
      if (Array.isArray(d)) {
        return d.map((x) => ({
          key: String(x.key ?? x.name ?? ""),
          value: String(x.value ?? "")
        }));
      }
      if (typeof d === "object") {
        return Object.entries(d).map(([key, value]) => ({
          key,
          value: Array.isArray(value) ? value.join(",") : String(value ?? "")
        }));
      }
      return [];
    }
    const dimRows = ref(dimsFromQuery());
    watch(
      () => query.value.dimensions,
      () => {
        dimRows.value = dimsFromQuery();
      }
    );
    function commitDims(rows) {
      dimRows.value = rows;
      const obj = {};
      for (const r of rows) {
        if (!r.key.trim()) continue;
        const parts = r.value.split(",").map((s) => s.trim()).filter(Boolean);
        obj[r.key.trim()] = parts.length > 1 ? parts : parts[0] ?? "";
      }
      patch({ dimensions: obj });
    }
    function addDim() {
      commitDims([...dimRows.value, { key: "", value: "" }]);
    }
    function removeDim(i) {
      commitDims(dimRows.value.filter((_, idx) => idx !== i));
    }
    function updateDim(i, partial) {
      commitDims(dimRows.value.map((r, idx) => idx === i ? { ...r, ...partial } : r));
    }
    const dimKeyOptions = computed(() => {
      const ns = String(query.value.namespace ?? "AWS/EC2");
      const keys = ns === "AWS/EC2" ? ["InstanceId", "ImageId", "InstanceType", "AutoScalingGroupName"] : ns === "AWS/Lambda" ? ["FunctionName", "Resource"] : ns === "AWS/RDS" ? ["DBInstanceIdentifier", "DBClusterIdentifier"] : ["Name", "Id"];
      return keys.map((k) => ({ label: k, value: k }));
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1M, [
        createElementVNode("div", _hoisted_2$1s, [
          _cache[31] || (_cache[31] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            value: String(query.value.queryMode ?? "Metrics"),
            options: unref(cloudwatchQueryTypes),
            "data-testid": "cw-query-type",
            "data-grafana-label": "Query mode",
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryMode: $event }))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_3$1g, [
          _cache[32] || (_cache[32] = createElementVNode(
            "label",
            null,
            "区域",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.region ?? "default"),
            "data-testid": "cw-region",
            "data-grafana-label": "Region",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ region: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$13, [
          _cache[33] || (_cache[33] = createElementVNode(
            "label",
            null,
            "账号 ID",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "cw-account",
            "data-grafana-label": "Account",
            value: String(query.value.accountId ?? ""),
            placeholder: "optional",
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ accountId: $event || void 0 }))
          }, null, 8, ["value"])
        ]),
        isMetrics.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("div", _hoisted_5$V, [
              _cache[34] || (_cache[34] = createElementVNode(
                "label",
                null,
                "指标查询类型",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-metric-query-type",
                "data-grafana-label": "Metric query type",
                value: metricQueryType.value,
                options: [
                  { label: "Search", value: "Search" },
                  { label: "Query (SQL Builder)", value: "Query" }
                ],
                "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ metricQueryType: $event }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_6$R, [
              _cache[35] || (_cache[35] = createElementVNode(
                "label",
                null,
                "编辑器模式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-metric-editor-mode",
                "data-grafana-label": "Metric editor mode",
                value: metricEditorMode.value,
                options: [
                  { label: "Builder", value: "Builder" },
                  { label: "Code", value: "Code" }
                ],
                "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ metricEditorMode: $event }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_7$K, [
              _cache[36] || (_cache[36] = createElementVNode(
                "label",
                null,
                "命名空间",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-namespace",
                "data-grafana-label": "Namespace",
                "show-search": "",
                value: String(query.value.namespace ?? "AWS/EC2"),
                options: unref(NS_OPTIONS),
                "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ namespace: $event }))
              }, null, 8, ["value", "options"])
            ]),
            createElementVNode("div", _hoisted_8$F, [
              _cache[37] || (_cache[37] = createElementVNode(
                "label",
                null,
                "指标",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-metric",
                "data-grafana-label": "Metric name",
                "show-search": "",
                value: String(query.value.metricName ?? "CPUUtilization"),
                options: metricOptions.value,
                "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ metricName: $event }))
              }, null, 8, ["value", "options"])
            ]),
            createElementVNode("div", _hoisted_9$C, [
              _cache[38] || (_cache[38] = createElementVNode(
                "label",
                null,
                "统计",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-statistic",
                "data-grafana-label": "Statistic",
                value: String(query.value.statistic ?? "Average"),
                options: [
                  { label: "Average", value: "Average" },
                  { label: "Sum", value: "Sum" },
                  { label: "Minimum", value: "Minimum" },
                  { label: "Maximum", value: "Maximum" },
                  { label: "SampleCount", value: "SampleCount" },
                  { label: "p99", value: "p99" },
                  { label: "p95", value: "p95" },
                  { label: "p90", value: "p90" }
                ],
                "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ statistic: $event }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_10$w, [
              _cache[39] || (_cache[39] = createElementVNode(
                "label",
                null,
                "周期",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "cw-period",
                "data-grafana-label": "Period",
                value: String(query.value.period ?? ""),
                placeholder: "60 或 auto",
                "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patch({ period: $event }))
              }, null, 8, ["value"])
            ]),
            createCommentVNode(" Grafana SQLBuilderEditor fields when metricQueryType=Query + Builder "),
            isSqlBuilder.value ? (openBlock(), createElementBlock(
              Fragment,
              { key: 0 },
              [
                createElementVNode("div", _hoisted_11$u, [
                  _cache[40] || (_cache[40] = createElementVNode(
                    "label",
                    null,
                    "聚合",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSelect), {
                    style: { "width": "100%" },
                    "data-testid": "cw-sql-aggregation",
                    "data-grafana-label": "Aggregation",
                    value: String(sqlObj.value.select?.name ?? query.value.statistic ?? "AVG"),
                    options: [
                      { label: "AVG", value: "AVG" },
                      { label: "SUM", value: "SUM" },
                      { label: "MAX", value: "MAX" },
                      { label: "MIN", value: "MIN" },
                      { label: "COUNT", value: "COUNT" }
                    ],
                    "onUpdate:value": _cache[9] || (_cache[9] = (v) => {
                      patch({ statistic: v });
                      patchSql({ select: { ...sqlObj.value.select, name: v } });
                    })
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_12$q, [
                  _cache[41] || (_cache[41] = createElementVNode(
                    "label",
                    null,
                    "With schema",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSwitch), {
                    "data-testid": "cw-with-schema",
                    "data-grafana-label": "With schema",
                    checked: !!query.value.withSchema || !!sqlObj.value.withSchema,
                    "onUpdate:checked": _cache[10] || (_cache[10] = (v) => {
                      patch({ withSchema: v });
                      patchSql({ withSchema: v });
                    })
                  }, null, 8, ["checked"])
                ]),
                createElementVNode("div", _hoisted_13$p, [
                  _cache[42] || (_cache[42] = createElementVNode(
                    "label",
                    null,
                    "Schema labels",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-schema-labels",
                    "data-grafana-label": "Schema labels",
                    value: String(query.value.schemaLabels ?? sqlObj.value.schemaLabels ?? ""),
                    placeholder: "InstanceId,ImageId",
                    "onUpdate:value": _cache[11] || (_cache[11] = (v) => {
                      patch({ schemaLabels: v });
                      patchSql({ schemaLabels: v });
                    })
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_14$l, [
                  _cache[43] || (_cache[43] = createElementVNode(
                    "label",
                    null,
                    "Filter",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-sql-filter",
                    "data-grafana-label": "Filter",
                    value: String(query.value.sqlFilter ?? sqlObj.value.where ?? ""),
                    placeholder: "dimension filter expression",
                    "onUpdate:value": _cache[12] || (_cache[12] = (v) => {
                      patch({ sqlFilter: v });
                      patchSql({ where: v });
                    })
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_15$j, [
                  _cache[44] || (_cache[44] = createElementVNode(
                    "label",
                    null,
                    "Group by",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-sql-group-by",
                    "data-grafana-label": "Group by",
                    value: String(query.value.sqlGroupBy ?? sqlObj.value.groupBy ?? ""),
                    placeholder: "InstanceId",
                    "onUpdate:value": _cache[13] || (_cache[13] = (v) => {
                      patch({ sqlGroupBy: v });
                      patchSql({ groupBy: v });
                    })
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_16$g, [
                  _cache[45] || (_cache[45] = createElementVNode(
                    "label",
                    null,
                    "Order by",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-sql-order-by",
                    "data-grafana-label": "Order by",
                    value: String(query.value.sqlOrderBy ?? sqlObj.value.orderBy ?? ""),
                    placeholder: "AVG()",
                    "onUpdate:value": _cache[14] || (_cache[14] = (v) => {
                      patch({ sqlOrderBy: v });
                      patchSql({ orderBy: v });
                    })
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_17$f, [
                  _cache[46] || (_cache[46] = createElementVNode(
                    "label",
                    null,
                    "Direction",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSelect), {
                    style: { "width": "100%" },
                    "data-testid": "cw-sql-direction",
                    "data-grafana-label": "Direction",
                    value: String(query.value.sqlOrderDirection ?? sqlObj.value.orderDirection ?? "DESC"),
                    options: [
                      { label: "DESC", value: "DESC" },
                      { label: "ASC", value: "ASC" }
                    ],
                    "onUpdate:value": _cache[15] || (_cache[15] = (v) => {
                      patch({ sqlOrderDirection: v });
                      patchSql({ orderDirection: v });
                    })
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_18$f, [
                  _cache[47] || (_cache[47] = createElementVNode(
                    "label",
                    null,
                    "Limit",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    type: "number",
                    "data-testid": "cw-sql-limit",
                    "data-grafana-label": "Limit",
                    value: String(query.value.sqlLimit ?? sqlObj.value.limit ?? ""),
                    placeholder: "optional",
                    "onUpdate:value": _cache[16] || (_cache[16] = (v) => {
                      const n = v === "" ? void 0 : Number(v);
                      patch({ sqlLimit: n });
                      patchSql({ limit: n });
                    })
                  }, null, 8, ["value"])
                ])
              ],
              64
              /* STABLE_FRAGMENT */
            )) : createCommentVNode("v-if", true),
            createElementVNode("div", _hoisted_19$e, [
              createElementVNode("div", _hoisted_20$c, [
                _cache[49] || (_cache[49] = createElementVNode(
                  "span",
                  null,
                  "维度",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GButton), {
                  size: "sm",
                  "data-testid": "cw-add-dimension",
                  onClick: addDim
                }, {
                  default: withCtx(() => [..._cache[48] || (_cache[48] = [
                    createTextVNode(
                      " 添加维度 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ]),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(dimRows.value, (row, i) => {
                  return openBlock(), createElementBlock("div", {
                    key: i,
                    class: "dim-row",
                    "data-testid": "cw-dimension-row"
                  }, [
                    createVNode(unref(GSelect), {
                      style: { "width": "160px" },
                      "data-testid": "cw-dimension-key",
                      "show-search": "",
                      value: row.key || void 0,
                      options: dimKeyOptions.value,
                      placeholder: "键",
                      "onUpdate:value": (v) => updateDim(i, { key: v })
                    }, null, 8, ["value", "options", "onUpdate:value"]),
                    createVNode(unref(GInput), {
                      "data-testid": "cw-dimension-value",
                      style: { "flex": "1" },
                      value: row.value,
                      placeholder: "值（逗号分隔）",
                      "onUpdate:value": (v) => updateDim(i, { value: v })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GButton), {
                      size: "sm",
                      danger: "",
                      "data-testid": "cw-remove-dimension",
                      onClick: ($event) => removeDim(i)
                    }, {
                      default: withCtx(() => [..._cache[50] || (_cache[50] = [
                        createTextVNode(
                          " 删除 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["onClick"])
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              !dimRows.value.length ? (openBlock(), createElementBlock("div", _hoisted_21$5, "无维度过滤")) : createCommentVNode("v-if", true)
            ]),
            createElementVNode("div", _hoisted_22$5, [
              _cache[51] || (_cache[51] = createElementVNode(
                "label",
                null,
                "精确匹配",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSwitch), {
                "data-testid": "cw-match-exact",
                "data-grafana-label": "Match exact",
                checked: query.value.matchExact !== false,
                "onUpdate:checked": _cache[17] || (_cache[17] = ($event) => patch({ matchExact: $event }))
              }, null, 8, ["checked"])
            ]),
            createElementVNode("div", _hoisted_23$4, [
              _cache[52] || (_cache[52] = createElementVNode(
                "label",
                null,
                "ID",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "cw-id",
                "data-grafana-label": "ID",
                value: String(query.value.id ?? ""),
                placeholder: "e1 (可选，用于 SEARCH/MATH 引用)",
                "onUpdate:value": _cache[18] || (_cache[18] = ($event) => patch({ id: $event || void 0 }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_24$4, [
              _cache[53] || (_cache[53] = createElementVNode(
                "label",
                null,
                "Label",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "cw-label",
                "data-grafana-label": "Label",
                value: String(query.value.label ?? query.value.alias ?? ""),
                placeholder: "{{metric}} / dynamic label",
                "onUpdate:value": _cache[19] || (_cache[19] = ($event) => patch({ label: $event, alias: $event }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_25$3, [
              _cache[54] || (_cache[54] = createElementVNode(
                "label",
                null,
                "别名",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "cw-alias",
                value: String(query.value.alias ?? ""),
                placeholder: "{{metric}}",
                "onUpdate:value": _cache[20] || (_cache[20] = ($event) => patch({ alias: $event }))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        isLogs.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode("div", _hoisted_26$3, [
              _cache[55] || (_cache[55] = createElementVNode(
                "label",
                null,
                "日志模式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-logs-mode",
                "data-grafana-label": "Logs Mode",
                value: String(query.value.logsMode ?? query.value.logMode ?? "Logs"),
                options: [
                  { label: "Logs", value: "Logs" },
                  { label: "Logs Insights", value: "Insights" },
                  { label: "Anomalies", value: "Anomalies" }
                ],
                "onUpdate:value": _cache[21] || (_cache[21] = ($event) => patch({ logsMode: $event, logMode: $event }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_27$2, [
              _cache[56] || (_cache[56] = createElementVNode(
                "label",
                null,
                "查询语言",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "cw-query-language",
                "data-grafana-label": "Query language",
                value: String(query.value.queryLanguage ?? "CWLI"),
                options: [
                  { label: "CWLI", value: "CWLI" },
                  { label: "SQL", value: "SQL" },
                  { label: "PPL", value: "PPL" }
                ],
                "onUpdate:value": _cache[22] || (_cache[22] = ($event) => patch({ queryLanguage: $event }))
              }, null, 8, ["value"])
            ]),
            isAnomalies.value ? (openBlock(), createElementBlock(
              Fragment,
              { key: 0 },
              [
                createElementVNode("div", _hoisted_28$2, [
                  _cache[57] || (_cache[57] = createElementVNode(
                    "label",
                    null,
                    "Anomaly Detection ARN",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-anomaly-arn",
                    "data-grafana-label": "Anomaly Detection ARN",
                    value: String(query.value.anomalyDetectionARN ?? ""),
                    placeholder: "arn:aws:logs:…:anomaly-detector/…",
                    "onUpdate:value": _cache[23] || (_cache[23] = ($event) => patch({ anomalyDetectionARN: $event || void 0 }))
                  }, null, 8, ["value"])
                ]),
                createElementVNode("div", _hoisted_29$2, [
                  _cache[58] || (_cache[58] = createElementVNode(
                    "label",
                    null,
                    "Supression state",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSelect), {
                    style: { "width": "100%" },
                    "data-testid": "cw-suppression-state",
                    "data-grafana-label": "Supression state",
                    value: String(query.value.suppressionState ?? "all"),
                    options: [
                      { label: "All", value: "all" },
                      { label: "Suppressed", value: "suppressed" },
                      { label: "Unsuppressed", value: "unsuppressed" }
                    ],
                    "onUpdate:value": _cache[24] || (_cache[24] = ($event) => patch({ suppressionState: $event }))
                  }, null, 8, ["value"])
                ])
              ],
              64
              /* STABLE_FRAGMENT */
            )) : (openBlock(), createElementBlock(
              Fragment,
              { key: 1 },
              [
                createCommentVNode(" Grafana LogGroupsField: Query scope / Prefixes / Class / Accounts / Log groups "),
                createElementVNode("div", _hoisted_30$2, [
                  _cache[59] || (_cache[59] = createElementVNode(
                    "label",
                    null,
                    "Query scope",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSelect), {
                    style: { "width": "100%" },
                    "data-testid": "cw-query-scope",
                    "data-grafana-label": "Query scope",
                    value: String(query.value.logsQueryScope ?? "logGroupName"),
                    options: [
                      { label: "Log group name", value: "logGroupName" },
                      { label: "Name prefix", value: "namePrefix" },
                      { label: "All log groups", value: "allLogGroups" }
                    ],
                    "onUpdate:value": _cache[25] || (_cache[25] = ($event) => patch({ logsQueryScope: $event }))
                  }, null, 8, ["value"])
                ]),
                String(query.value.logsQueryScope ?? "logGroupName") === "namePrefix" ? (openBlock(), createElementBlock("div", _hoisted_31$2, [
                  _cache[60] || (_cache[60] = createElementVNode(
                    "label",
                    null,
                    "Prefixes",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-log-group-prefixes",
                    "data-grafana-label": "Prefixes",
                    value: String(
                      Array.isArray(query.value.logGroupPrefixes) ? query.value.logGroupPrefixes.join(",") : query.value.logGroupPrefixes ?? ""
                    ),
                    placeholder: "/aws/lambda/,/aws/ecs/",
                    "onUpdate:value": _cache[26] || (_cache[26] = (v) => {
                      const prefixes = String(v || "").split(",").map((s) => s.trim()).filter(Boolean);
                      patch({ logGroupPrefixes: prefixes });
                    })
                  }, null, 8, ["value"])
                ])) : createCommentVNode("v-if", true),
                String(query.value.logsQueryScope ?? "logGroupName") === "namePrefix" || String(query.value.logsQueryScope ?? "") === "allLogGroups" ? (openBlock(), createElementBlock("div", _hoisted_32$2, [
                  _cache[61] || (_cache[61] = createElementVNode(
                    "label",
                    null,
                    "Class",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSelect), {
                    style: { "width": "100%" },
                    "data-testid": "cw-log-group-class",
                    "data-grafana-label": "Class",
                    value: String(query.value.logGroupClass ?? "STANDARD"),
                    options: [
                      { label: "Standard", value: "STANDARD" },
                      { label: "Infrequent Access", value: "INFREQUENT_ACCESS" }
                    ],
                    "onUpdate:value": _cache[27] || (_cache[27] = ($event) => patch({ logGroupClass: $event }))
                  }, null, 8, ["value"])
                ])) : createCommentVNode("v-if", true),
                createElementVNode("div", _hoisted_33$2, [
                  _cache[62] || (_cache[62] = createElementVNode(
                    "label",
                    null,
                    "Accounts",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-accounts",
                    "data-grafana-label": "Accounts",
                    value: String(
                      Array.isArray(query.value.accountIds) ? query.value.accountIds.join(",") : Array.isArray(query.value.selectedAccountIds) ? query.value.selectedAccountIds.join(",") : query.value.accountIds ?? query.value.selectedAccountIds ?? ""
                    ),
                    placeholder: "123456789012, or template $account",
                    "onUpdate:value": _cache[28] || (_cache[28] = (v) => {
                      const ids = String(v || "").split(",").map((s) => s.trim()).filter(Boolean);
                      patch({ accountIds: ids, selectedAccountIds: ids });
                    })
                  }, null, 8, ["value"])
                ]),
                String(query.value.logsQueryScope ?? "logGroupName") === "logGroupName" ? (openBlock(), createElementBlock("div", _hoisted_34$2, [
                  _cache[63] || (_cache[63] = createElementVNode(
                    "label",
                    null,
                    "日志组",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GInput), {
                    "data-testid": "cw-log-groups",
                    "data-grafana-label": "Log groups",
                    value: String(
                      Array.isArray(query.value.logGroups) ? query.value.logGroups.map((g) => g.name || g).join(",") : query.value.logGroupNames ? query.value.logGroupNames.join?.(",") || query.value.logGroupNames : ""
                    ),
                    placeholder: "/aws/lambda/fn1,/aws/lambda/fn2",
                    "onUpdate:value": _cache[29] || (_cache[29] = (v) => {
                      const names = String(v || "").split(",").map((s) => s.trim()).filter(Boolean);
                      patch({
                        logGroupNames: names,
                        logGroups: names.map((name) => ({ name }))
                      });
                    })
                  }, null, 8, ["value"])
                ])) : createCommentVNode("v-if", true)
              ],
              64
              /* STABLE_FRAGMENT */
            ))
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        createVNode(unref(GCodeEditor), {
          value: String(query.value.expression ?? query.value.query ?? ""),
          language: "plaintext",
          height: 100,
          "test-id": "cw-expression",
          "data-testid": "cw-expression",
          "data-grafana-label": "Expression",
          "onUpdate:value": _cache[30] || (_cache[30] = ($event) => patch({ expression: $event, query: $event }))
        }, null, 8, ["value"]),
        createElementVNode(
          "div",
          _hoisted_35$1,
          toDisplayString(unref(cwPlaceholder)),
          1
          /* TEXT */
        )
      ]);
    };
  }
});
const CloudWatchQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2j, [["__scopeId", "data-v-05105ab4"]]);
const _hoisted_1$1L = ["data-scenario"];
const _hoisted_2$1r = { class: "row" };
const _hoisted_3$1f = { class: "row" };
const _hoisted_4$12 = { class: "row" };
const _hoisted_5$U = { class: "row" };
const _hoisted_6$Q = { class: "row" };
const _hoisted_7$J = { class: "row" };
const _hoisted_8$E = { class: "row" };
const _hoisted_9$B = { class: "row" };
const _hoisted_10$v = { class: "row" };
const _hoisted_11$t = {
  key: 1,
  class: "row"
};
const _hoisted_12$p = {
  key: 2,
  class: "row"
};
const _hoisted_13$o = {
  key: 3,
  class: "hint",
  "data-testid": "testdata-graph-hint"
};
const _hoisted_14$k = { class: "row" };
const _hoisted_15$i = {
  key: 4,
  class: "row"
};
const _hoisted_16$f = { class: "row" };
const _hoisted_17$e = {
  key: 5,
  class: "row"
};
const _hoisted_18$e = {
  key: 6,
  class: "row"
};
const _hoisted_19$d = {
  key: 7,
  class: "row"
};
const _hoisted_20$b = {
  key: 8,
  class: "row"
};
const _hoisted_21$4 = {
  key: 9,
  class: "row"
};
const _hoisted_22$4 = {
  key: 10,
  class: "row"
};
const _hoisted_23$3 = {
  key: 11,
  class: "row"
};
const _hoisted_24$3 = {
  key: 12,
  class: "row"
};
const _hoisted_25$2 = { class: "row" };
const _hoisted_26$2 = { class: "row" };
const _hoisted_27$1 = { class: "row" };
const _hoisted_28$1 = { class: "row" };
const _hoisted_29$1 = { class: "row" };
const _hoisted_30$1 = { class: "row" };
const _hoisted_31$1 = { class: "row" };
const _hoisted_32$1 = { class: "row" };
const _hoisted_33$1 = { class: "row" };
const _hoisted_34$1 = { class: "row" };
const _sfc_main$2i = /* @__PURE__ */ defineComponent({
  __name: "TestdataQueryFields",
  props: {
    query: {}
  },
  emits: ["patch"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    function patch(partial) {
      emit("patch", partial);
    }
    const scenario = computed(() => String(query.value.scenarioId ?? "random_walk"));
    const isCsv = computed(() => /csv/i.test(scenario.value));
    const isLogs = computed(() => scenario.value === "logs");
    const isPulse = computed(() => /pulse|wave|predictable/i.test(scenario.value));
    const isNode = computed(() => scenario.value === "node_graph");
    const isFlame = computed(() => scenario.value === "flame_graph");
    const isTrace = computed(() => scenario.value === "trace");
    const isFlaky = computed(() => scenario.value === "flaky_query");
    const isSimulation = computed(() => scenario.value === "simulation");
    const isLive = computed(() => scenario.value === "live" || scenario.value === "streaming_client");
    const isRandomWalk = computed(
      () => scenario.value === "random_walk" || scenario.value === "random_walk_table"
    );
    const isUsa = computed(() => scenario.value === "usa");
    const isNodeGraph = computed(() => scenario.value === "node_graph");
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "qf",
        "data-testid": "testdata-query-fields",
        "data-scenario": scenario.value
      }, [
        createElementVNode("div", _hoisted_2$1r, [
          _cache[32] || (_cache[32] = createElementVNode(
            "label",
            null,
            "场景",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            value: scenario.value,
            "data-testid": "testdata-scenario",
            "data-grafana-label": "Scenario",
            options: [
              { label: "随机游走", value: "random_walk" },
              { label: "随机游走表格", value: "random_walk_table" },
              { label: "慢查询", value: "slow_query" },
              { label: "无数据", value: "no_data" },
              { label: "CSV 指标值", value: "csv_metric_values" },
              { label: "CSV 文件", value: "csv_file" },
              { label: "可预测脉冲", value: "predictable_pulse" },
              { label: "可预测波形", value: "predictable_csv_wave" },
              { label: "日志", value: "logs" },
              { label: "节点图", value: "node_graph" },
              { label: "火焰图", value: "flame_graph" },
              { label: "追踪", value: "trace" },
              { label: "USA 统计", value: "usa" },
              { label: "服务器错误模拟", value: "server_error_500" },
              { label: "手动输入", value: "manual_entry" },
              { label: "数据流", value: "streaming_client" },
              { label: "Grafana 实时", value: "live" },
              { label: "箭头数据帧", value: "arrow" },
              { label: "不稳定查询", value: "flaky_query" },
              { label: "仿真", value: "simulation" },
              { label: "阶梯", value: "steps" },
              { label: "注解", value: "annotations" },
              { label: "原始帧", value: "raw_frame" }
            ],
            "show-search": "",
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ scenarioId: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1f, [
          _cache[33] || (_cache[33] = createElementVNode(
            "label",
            null,
            "别名",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.alias ?? ""),
            "data-testid": "testdata-alias",
            "data-grafana-label": "Alias",
            placeholder: "序列别名",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ alias: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$12, [
          _cache[34] || (_cache[34] = createElementVNode(
            "label",
            null,
            "序列数",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            value: String(query.value.seriesCount ?? 1),
            "data-testid": "testdata-series-count",
            "data-grafana-label": "Count",
            "data-grafana-label-alt": "Series count",
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ seriesCount: Number($event) || 1 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$U, [
          _cache[35] || (_cache[35] = createElementVNode(
            "label",
            null,
            "噪声",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            "data-testid": "testdata-noise",
            "data-grafana-label": "Noise",
            value: String(query.value.noise ?? 0),
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ noise: Number($event) || 0 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_6$Q, [
          _cache[36] || (_cache[36] = createElementVNode(
            "label",
            null,
            "离散度",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            "data-testid": "testdata-spread",
            "data-grafana-label": "Spread",
            value: String(query.value.spread ?? 10),
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ spread: Number($event) || 0 }))
          }, null, 8, ["value"])
        ]),
        isRandomWalk.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("div", _hoisted_7$J, [
              _cache[37] || (_cache[37] = createElementVNode(
                "label",
                null,
                "起始值",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                type: "number",
                "data-testid": "testdata-start-value",
                "data-grafana-label": "Start value",
                value: query.value.startValue == null ? "" : String(query.value.startValue),
                placeholder: "自动",
                "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ startValue: $event === "" ? void 0 : Number($event) }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_8$E, [
              _cache[38] || (_cache[38] = createElementVNode(
                "label",
                null,
                "最小值",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                type: "number",
                "data-testid": "testdata-min",
                "data-grafana-label": "Min",
                value: query.value.min == null ? "" : String(query.value.min),
                placeholder: "无",
                "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ min: $event === "" ? void 0 : Number($event) }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_9$B, [
              _cache[39] || (_cache[39] = createElementVNode(
                "label",
                null,
                "最大值",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                type: "number",
                "data-testid": "testdata-max",
                "data-grafana-label": "Max",
                value: query.value.max == null ? "" : String(query.value.max),
                placeholder: "无",
                "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ max: $event === "" ? void 0 : Number($event) }))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_10$v, [
          _cache[40] || (_cache[40] = createElementVNode(
            "label",
            null,
            "点数",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            "data-testid": "testdata-points",
            "data-grafana-label": "Values",
            value: String(query.value.points ?? query.value.lines ?? ""),
            placeholder: "自动",
            "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patch({
              points: $event === "" ? void 0 : Number($event),
              lines: $event === "" ? void 0 : Number($event)
            }))
          }, null, 8, ["value"])
        ]),
        isCsv.value || isPulse.value ? (openBlock(), createElementBlock("div", _hoisted_11$t, [
          _cache[41] || (_cache[41] = createElementVNode(
            "label",
            null,
            "CSV 值",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(query.value.stringInput ?? query.value.csvFileName ?? ""),
            placeholder: "1,20,90,30,5,0",
            "data-testid": "testdata-csv",
            "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patch({ stringInput: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isLogs.value ? (openBlock(), createElementBlock("div", _hoisted_12$p, [
          _cache[42] || (_cache[42] = createElementVNode(
            "label",
            null,
            "日志行数",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            "data-testid": "testdata-lines",
            "data-grafana-label": "Lines",
            value: String(query.value.lines ?? 10),
            "onUpdate:value": _cache[10] || (_cache[10] = ($event) => patch({ lines: Number($event) || 10 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isNode.value || isFlame.value || isTrace.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_13$o,
          " 场景「" + toDisplayString(scenario.value) + "」会生成对应面板的演示结构数据（节点/火焰/追踪）。 ",
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_14$k, [
          _cache[43] || (_cache[43] = createElementVNode(
            "label",
            null,
            "丢弃 %",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            "data-testid": "testdata-drop-percent",
            "data-grafana-label": "Drop",
            value: String(query.value.dropPercent ?? 0),
            "onUpdate:value": _cache[11] || (_cache[11] = ($event) => patch({ dropPercent: Number($event) || 0 }))
          }, null, 8, ["value"])
        ]),
        isRandomWalk.value || isPulse.value ? (openBlock(), createElementBlock("div", _hoisted_15$i, [
          _cache[44] || (_cache[44] = createElementVNode(
            "label",
            null,
            "标签",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-labels",
            "data-grafana-label": "Labels",
            value: String(query.value.labels ?? ""),
            placeholder: "key=value, key2=value",
            "onUpdate:value": _cache[12] || (_cache[12] = ($event) => patch({ labels: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_16$f, [
          _cache[45] || (_cache[45] = createElementVNode(
            "label",
            null,
            "带标签",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            style: { width: "46px" },
            "data-testid": "testdata-with-labels",
            "data-grafana-label": "Labels",
            checked: !!query.value.withLabels,
            "onUpdate:checked": _cache[13] || (_cache[13] = ($event) => patch({ withLabels: $event }))
          }, null, 8, ["checked"])
        ]),
        isFlaky.value ? (openBlock(), createElementBlock("div", _hoisted_17$e, [
          _cache[46] || (_cache[46] = createElementVNode(
            "label",
            null,
            "错误率",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            "data-testid": "testdata-error-rate",
            "data-grafana-label": "Error rate",
            value: String(query.value.errorRate ?? 0),
            placeholder: "0-100",
            "onUpdate:value": _cache[14] || (_cache[14] = ($event) => patch({ errorRate: Number($event) || 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isFlaky.value ? (openBlock(), createElementBlock("div", _hoisted_18$e, [
          _cache[47] || (_cache[47] = createElementVNode(
            "label",
            null,
            "状态码",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-status-code",
            "data-grafana-label": "Status code",
            value: String(query.value.statusCode ?? 500),
            "onUpdate:value": _cache[15] || (_cache[15] = ($event) => patch({ statusCode: Number($event) || 500 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isFlaky.value ? (openBlock(), createElementBlock("div", _hoisted_19$d, [
          _cache[48] || (_cache[48] = createElementVNode(
            "label",
            null,
            "错误来源",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "testdata-error-source",
            "data-grafana-label": "Error source",
            value: String(query.value.errorSource ?? "plugin"),
            options: [
              { label: "插件", value: "plugin" },
              { label: "下游", value: "downstream" }
            ],
            "onUpdate:value": _cache[16] || (_cache[16] = ($event) => patch({ errorSource: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isFlaky.value ? (openBlock(), createElementBlock("div", _hoisted_20$b, [
          _cache[49] || (_cache[49] = createElementVNode(
            "label",
            null,
            "查询延迟",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-query-delay",
            "data-grafana-label": "Query delay",
            value: String(query.value.queryDelay ?? ""),
            placeholder: "1s",
            "onUpdate:value": _cache[17] || (_cache[17] = ($event) => patch({ queryDelay: $event || void 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isFlaky.value ? (openBlock(), createElementBlock("div", _hoisted_21$4, [
          _cache[50] || (_cache[50] = createElementVNode(
            "label",
            null,
            "延迟波动",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-delay-variability",
            "data-grafana-label": "Delay variability",
            value: String(query.value.delayVariability ?? ""),
            placeholder: "0.5",
            "onUpdate:value": _cache[18] || (_cache[18] = ($event) => patch({ delayVariability: $event || void 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isFlaky.value ? (openBlock(), createElementBlock("div", _hoisted_22$4, [
          _cache[51] || (_cache[51] = createElementVNode(
            "label",
            null,
            "错误消息",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-error-message",
            "data-grafana-label": "Error message",
            value: String(query.value.errorMessage ?? ""),
            placeholder: "模拟错误",
            "onUpdate:value": _cache[19] || (_cache[19] = ($event) => patch({ errorMessage: $event || void 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isSimulation.value || isPulse.value ? (openBlock(), createElementBlock("div", _hoisted_23$3, [
          _cache[52] || (_cache[52] = createElementVNode(
            "label",
            null,
            "间隔",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-interval",
            "data-grafana-label": "Interval",
            value: String(query.value.interval ?? query.value.stream?.interval ?? ""),
            placeholder: "1s",
            "onUpdate:value": _cache[20] || (_cache[20] = ($event) => patch({ interval: $event || void 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isLive.value ? (openBlock(), createElementBlock("div", _hoisted_24$3, [
          _cache[53] || (_cache[53] = createElementVNode(
            "label",
            null,
            "通道",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "testdata-channel",
            "data-grafana-label": "Channel",
            value: String(query.value.channel ?? ""),
            placeholder: "plugin/testdata/…",
            "onUpdate:value": _cache[21] || (_cache[21] = ($event) => patch({ channel: $event || void 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        isUsa.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 13 },
          [
            createElementVNode("div", _hoisted_25$2, [
              _cache[54] || (_cache[54] = createElementVNode(
                "label",
                null,
                "模式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "testdata-usa-mode",
                "data-grafana-label": "Mode",
                value: String(query.value.usa?.mode ?? query.value.mode ?? "timeseries"),
                options: [
                  { label: "时序", value: "timeseries" },
                  { label: "表格", value: "table" }
                ],
                "onUpdate:value": _cache[22] || (_cache[22] = (v) => patch({ mode: v, usa: { ...query.value.usa, mode: v } }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_26$2, [
              _cache[55] || (_cache[55] = createElementVNode(
                "label",
                null,
                "周期",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "testdata-usa-period",
                "data-grafana-label": "Period",
                value: String(query.value.usa?.period ?? query.value.period ?? ""),
                placeholder: "10m",
                "onUpdate:value": _cache[23] || (_cache[23] = (v) => patch({ period: v, usa: { ...query.value.usa, period: v } }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_27$1, [
              _cache[56] || (_cache[56] = createElementVNode(
                "label",
                null,
                "字段",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "testdata-usa-fields",
                "data-grafana-label": "Fields",
                value: String(query.value.usa?.fields ?? query.value.fields ?? ""),
                placeholder: "foo,bar",
                "onUpdate:value": _cache[24] || (_cache[24] = (v) => patch({ fields: v, usa: { ...query.value.usa, fields: v } }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_28$1, [
              _cache[57] || (_cache[57] = createElementVNode(
                "label",
                null,
                "州/省",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "testdata-usa-states",
                "data-grafana-label": "States",
                value: String(query.value.usa?.states ?? query.value.states ?? ""),
                placeholder: "CA,NY",
                "onUpdate:value": _cache[25] || (_cache[25] = (v) => patch({ states: v, usa: { ...query.value.usa, states: v } }))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        isSimulation.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 14 },
          [
            createElementVNode("div", _hoisted_29$1, [
              _cache[58] || (_cache[58] = createElementVNode(
                "label",
                null,
                "仿真",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "testdata-simulation",
                "data-grafana-label": "Simulation",
                value: String(query.value.sim?.type ?? query.value.simulation ?? ""),
                placeholder: "flight",
                "onUpdate:value": _cache[26] || (_cache[26] = (v) => patch({ simulation: v, sim: { ...query.value.sim, type: v } }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_30$1, [
              _cache[59] || (_cache[59] = createElementVNode(
                "label",
                null,
                "流式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSwitch), {
                "data-testid": "testdata-stream",
                "data-grafana-label": "Stream",
                checked: !!(query.value.stream?.enabled ?? query.value.streamEnabled),
                "onUpdate:checked": _cache[27] || (_cache[27] = (v) => patch({
                  streamEnabled: v,
                  stream: { ...query.value.stream, enabled: v }
                }))
              }, null, 8, ["checked"])
            ]),
            createElementVNode("div", _hoisted_31$1, [
              _cache[60] || (_cache[60] = createElementVNode(
                "label",
                null,
                "仅最后",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSwitch), {
                "data-testid": "testdata-last",
                "data-grafana-label": "Last",
                checked: !!query.value.last,
                "onUpdate:checked": _cache[28] || (_cache[28] = ($event) => patch({ last: $event }))
              }, null, 8, ["checked"])
            ]),
            createElementVNode("div", _hoisted_32$1, [
              _cache[61] || (_cache[61] = createElementVNode(
                "label",
                null,
                "UID",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "testdata-uid",
                "data-grafana-label": "UID",
                value: String(query.value.uid ?? query.value.sim?.uid ?? ""),
                placeholder: "仿真 UID",
                "onUpdate:value": _cache[29] || (_cache[29] = (v) => patch({
                  uid: v || void 0,
                  sim: { ...query.value.sim, uid: v }
                }))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        isNodeGraph.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 15 },
          [
            createElementVNode("div", _hoisted_33$1, [
              _cache[62] || (_cache[62] = createElementVNode(
                "label",
                null,
                "数据类型",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "testdata-node-data-type",
                "data-grafana-label": "Data type",
                value: String(query.value.nodes?.type ?? query.value.nodeType ?? "random"),
                options: [
                  { label: "随机", value: "random" },
                  { label: "小型响应", value: "response_small" },
                  { label: "中型响应", value: "response_medium" }
                ],
                "onUpdate:value": _cache[30] || (_cache[30] = (v) => patch({
                  nodeType: v,
                  nodes: { ...query.value.nodes, type: v }
                }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_34$1, [
              _cache[63] || (_cache[63] = createElementVNode(
                "label",
                null,
                "种子",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                type: "number",
                "data-testid": "testdata-seed",
                "data-grafana-label": "Seed",
                value: query.value.nodes?.seed == null && query.value.seed == null ? "" : String(query.value.nodes?.seed ?? query.value.seed),
                "onUpdate:value": _cache[31] || (_cache[31] = (v) => {
                  const n = v === "" ? void 0 : Number(v);
                  patch({ seed: n, nodes: { ...query.value.nodes, seed: n } });
                })
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$1L);
    };
  }
});
const TestdataQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2i, [["__scopeId", "data-v-fb248ccb"]]);
const _hoisted_1$1K = {
  class: "qf",
  "data-testid": "es-qe"
};
const _hoisted_2$1q = { class: "row" };
const _hoisted_3$1e = {
  class: "row",
  "data-testid": "es-field-browser",
  "data-grafana-label": "Field"
};
const _hoisted_4$11 = {
  class: "section",
  "data-testid": "es-metrics",
  "data-grafana-label": "Metrics"
};
const _hoisted_5$T = { class: "section-head" };
const _hoisted_6$P = { class: "section-actions" };
const _hoisted_7$I = {
  class: "section",
  "data-testid": "es-bucket-aggs",
  "data-grafana-label": "Group by"
};
const _hoisted_8$D = { class: "section-head" };
const _hoisted_9$A = {
  key: 0,
  class: "hint"
};
const _hoisted_10$u = { class: "row" };
const _hoisted_11$s = { class: "row" };
const _hoisted_12$o = { class: "row" };
const _hoisted_13$n = { class: "row" };
const _sfc_main$2h = /* @__PURE__ */ defineComponent({
  __name: "ElasticsearchQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const METRIC_TYPES = [
      { label: "Count", value: "count" },
      { label: "Average", value: "avg" },
      { label: "Sum", value: "sum" },
      { label: "Max", value: "max" },
      { label: "Min", value: "min" },
      { label: "Extended Stats", value: "extended_stats" },
      { label: "Percentiles", value: "percentiles" },
      { label: "Cardinality", value: "cardinality" },
      { label: "Raw Document", value: "raw_document" },
      { label: "Raw Data", value: "raw_data" },
      { label: "Logs", value: "logs" },
      { label: "Rate", value: "rate" },
      { label: "Top Metrics", value: "top_metrics" },
      // Pipeline aggregations (grafana PipelineAggregations)
      { label: "Derivative", value: "derivative" },
      { label: "Cumulative Sum", value: "cumulative_sum" },
      { label: "Moving Average", value: "moving_avg" },
      { label: "Moving Function", value: "moving_fn" },
      { label: "Serial Diff", value: "serial_diff" },
      { label: "Bucket Script", value: "bucket_script" }
    ];
    const PIPELINE_TYPES = /* @__PURE__ */ new Set([
      "derivative",
      "cumulative_sum",
      "moving_avg",
      "moving_fn",
      "serial_diff",
      "bucket_script"
    ]);
    const BUCKET_TYPES = [
      { label: "Date Histogram", value: "date_histogram" },
      { label: "Histogram", value: "histogram" },
      { label: "Terms", value: "terms" },
      { label: "Filters", value: "filters" },
      { label: "Geo Hash Grid", value: "geohash_grid" },
      { label: "Nested", value: "nested" }
    ];
    const DEMO_FIELDS = [
      "@timestamp",
      "message",
      "host",
      "service",
      "level",
      "status",
      "duration",
      "bytes",
      "method",
      "path",
      "user",
      "geoip.country_code"
    ];
    function asMetrics() {
      const m = query.value.metrics;
      if (Array.isArray(m) && m.length) return m;
      return [{ id: "1", type: "count" }];
    }
    function asBuckets() {
      const b = query.value.bucketAggs;
      if (Array.isArray(b) && b.length) return b;
      if (String(query.value.queryType ?? "metrics") === "metrics") {
        return [
          {
            id: "2",
            type: "date_histogram",
            field: String(query.value.timeField ?? "@timestamp")
          }
        ];
      }
      return [];
    }
    const metrics = computed(() => asMetrics());
    const buckets = computed(() => asBuckets());
    const fieldOptions = ref(
      DEMO_FIELDS.map((f) => ({ label: f, value: f }))
    );
    async function refreshFields() {
      const api = props.datasourceApi;
      try {
        if (api?.getTagKeys) {
          const rows = await api.getTagKeys();
          if (rows?.length) {
            fieldOptions.value = rows.map((r) => ({
              label: r.text,
              value: r.text
            }));
            return;
          }
        }
        if (api?.metricFindQuery) {
          const rows = await api.metricFindQuery("fields()");
          if (rows?.length) {
            fieldOptions.value = rows.map((r) => ({
              label: r.text,
              value: String(r.value ?? r.text)
            }));
            return;
          }
        }
      } catch {
      }
      fieldOptions.value = DEMO_FIELDS.map((f) => ({ label: f, value: f }));
    }
    watch(
      () => props.datasourceApi,
      () => void refreshFields(),
      { immediate: true }
    );
    function nextId2(list) {
      const nums = list.map((x) => Number(x.id)).filter((n) => Number.isFinite(n));
      return String((nums.length ? Math.max(...nums) : 0) + 1);
    }
    function setMetrics(next) {
      patch({ metrics: next });
    }
    function setBuckets(next) {
      patch({ bucketAggs: next });
    }
    function updateMetric(i, partial) {
      const next = metrics.value.map((m, idx) => idx === i ? { ...m, ...partial } : m);
      setMetrics(next);
    }
    function updateBucket(i, partial) {
      const next = buckets.value.map((b, idx) => idx === i ? { ...b, ...partial } : b);
      setBuckets(next);
    }
    function addMetric() {
      setMetrics([...metrics.value, { id: nextId2(metrics.value), type: "avg", field: "" }]);
    }
    function addPipelineMetric() {
      const parent = metrics.value[0]?.id ?? "1";
      setMetrics([
        ...metrics.value,
        {
          id: nextId2(metrics.value),
          type: "derivative",
          pipelineAgg: parent,
          field: ""
        }
      ]);
    }
    function removeMetric(i) {
      if (metrics.value.length <= 1) return;
      setMetrics(metrics.value.filter((_, idx) => idx !== i));
    }
    function addBucket() {
      setBuckets([...buckets.value, { id: nextId2(buckets.value), type: "terms", field: "" }]);
    }
    function removeBucket(i) {
      setBuckets(buckets.value.filter((_, idx) => idx !== i));
    }
    const showAggs = computed(() => {
      const qt = String(query.value.queryType ?? "metrics");
      return qt === "metrics" || qt === "";
    });
    const parentMetricOptions = computed(
      () => metrics.value.map((m) => ({ label: `${m.id}: ${m.type}`, value: m.id }))
    );
    function isPipeline(type) {
      return PIPELINE_TYPES.has(type);
    }
    function needsField(type) {
      return type !== "count" && type !== "raw_document" && type !== "raw_data" && type !== "logs" && !isPipeline(type);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1K, [
        createElementVNode("div", _hoisted_2$1q, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "es-query-type",
            "data-grafana-label": "Query type",
            value: String(query.value.queryType ?? "metrics"),
            options: [
              { label: "指标 (Metrics)", value: "metrics" },
              { label: "日志 (Logs)", value: "logs" },
              { label: "原始文档", value: "raw_data" },
              { label: "原始文档量", value: "raw_document" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryType: $event }))
          }, null, 8, ["value"])
        ]),
        _cache[20] || (_cache[20] = createElementVNode(
          "div",
          { class: "row" },
          [
            createElementVNode("label", null, "Lucene 查询")
          ],
          -1
          /* CACHED */
        )),
        createVNode(unref(GCodeEditor), {
          value: expr.value,
          "onUpdate:value": _cache[1] || (_cache[1] = ($event) => expr.value = $event),
          language: "plaintext",
          height: 100,
          "test-id": "es-query",
          "data-testid": "es-query",
          "data-grafana-label": "Query"
        }, null, 8, ["value"]),
        createElementVNode("div", _hoisted_3$1e, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "字段浏览",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "es-field-select",
            "show-search": "",
            "allow-clear": "",
            placeholder: "浏览字段…",
            options: fieldOptions.value,
            value: void 0,
            "onUpdate:value": _cache[2] || (_cache[2] = (v) => {
              if (v) expr.value = expr.value ? `${expr.value} AND ${v}:*` : `${v}:*`;
            })
          }, null, 8, ["options"])
        ]),
        showAggs.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("div", _hoisted_4$11, [
              createElementVNode("div", _hoisted_5$T, [
                _cache[11] || (_cache[11] = createElementVNode(
                  "span",
                  null,
                  "指标",
                  -1
                  /* CACHED */
                )),
                createElementVNode("div", _hoisted_6$P, [
                  createVNode(unref(GButton), {
                    size: "sm",
                    "data-testid": "es-add-metric",
                    onClick: addMetric
                  }, {
                    default: withCtx(() => [..._cache[9] || (_cache[9] = [
                      createTextVNode(
                        " 添加指标 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  }),
                  createVNode(unref(GButton), {
                    size: "sm",
                    "data-testid": "es-add-pipeline",
                    onClick: addPipelineMetric
                  }, {
                    default: withCtx(() => [..._cache[10] || (_cache[10] = [
                      createTextVNode(
                        " 添加管道 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  })
                ])
              ]),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(metrics.value, (m, i) => {
                  return openBlock(), createElementBlock("div", {
                    key: m.id,
                    class: "agg-row",
                    "data-testid": "es-metric-row"
                  }, [
                    createVNode(unref(GSelect), {
                      style: { "width": "160px" },
                      "data-testid": "es-metric-type",
                      value: m.type,
                      options: METRIC_TYPES,
                      "onUpdate:value": (v) => updateMetric(i, { type: v })
                    }, null, 8, ["value", "onUpdate:value"]),
                    isPipeline(m.type) ? (openBlock(), createBlock(unref(GSelect), {
                      key: 0,
                      style: { "width": "140px" },
                      "data-testid": "es-pipeline-parent",
                      value: m.pipelineAgg ?? metrics.value[0]?.id,
                      options: parentMetricOptions.value,
                      placeholder: "父指标",
                      "onUpdate:value": (v) => updateMetric(i, { pipelineAgg: v })
                    }, null, 8, ["value", "options", "onUpdate:value"])) : needsField(m.type) ? (openBlock(), createBlock(unref(GSelect), {
                      key: 1,
                      style: { "flex": "1", "min-width": "120px" },
                      "data-testid": "es-metric-field",
                      "show-search": "",
                      "allow-clear": "",
                      value: m.field ?? void 0,
                      options: fieldOptions.value,
                      placeholder: "字段",
                      "onUpdate:value": (v) => updateMetric(i, { field: v || "" })
                    }, null, 8, ["value", "options", "onUpdate:value"])) : createCommentVNode("v-if", true),
                    m.type === "bucket_script" ? (openBlock(), createBlock(unref(GInput), {
                      key: 2,
                      "data-testid": "es-bucket-script",
                      style: { "flex": "1" },
                      value: String(m.settings?.script ?? ""),
                      placeholder: "脚本 params.A / params.B",
                      "onUpdate:value": (v) => updateMetric(i, {
                        settings: { ...m.settings ?? {}, script: v }
                      })
                    }, null, 8, ["value", "onUpdate:value"])) : createCommentVNode("v-if", true),
                    createVNode(unref(GButton), {
                      size: "sm",
                      danger: "",
                      disabled: metrics.value.length <= 1,
                      onClick: ($event) => removeMetric(i)
                    }, {
                      default: withCtx(() => [..._cache[12] || (_cache[12] = [
                        createTextVNode(
                          " 删除 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["disabled", "onClick"])
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            createElementVNode("div", _hoisted_7$I, [
              createElementVNode("div", _hoisted_8$D, [
                _cache[14] || (_cache[14] = createElementVNode(
                  "span",
                  null,
                  "分桶",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GButton), {
                  size: "sm",
                  "data-testid": "es-add-bucket",
                  onClick: addBucket
                }, {
                  default: withCtx(() => [..._cache[13] || (_cache[13] = [
                    createTextVNode(
                      " 添加分桶 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ]),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(buckets.value, (b, i) => {
                  return openBlock(), createElementBlock("div", {
                    key: b.id,
                    class: "agg-row",
                    "data-testid": "es-bucket-row"
                  }, [
                    createVNode(unref(GSelect), {
                      style: { "width": "160px" },
                      "data-testid": "es-bucket-type",
                      value: b.type,
                      options: BUCKET_TYPES,
                      "onUpdate:value": (v) => updateBucket(i, { type: v })
                    }, null, 8, ["value", "onUpdate:value"]),
                    createVNode(unref(GSelect), {
                      style: { "flex": "1", "min-width": "120px" },
                      "data-testid": "es-bucket-field",
                      "show-search": "",
                      "allow-clear": "",
                      value: b.field ?? void 0,
                      options: fieldOptions.value,
                      placeholder: "字段",
                      "onUpdate:value": (v) => updateBucket(i, { field: v || "" })
                    }, null, 8, ["value", "options", "onUpdate:value"]),
                    createVNode(unref(GButton), {
                      size: "sm",
                      danger: "",
                      onClick: ($event) => removeBucket(i)
                    }, {
                      default: withCtx(() => [..._cache[15] || (_cache[15] = [
                        createTextVNode(
                          "删除",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["onClick"])
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              !buckets.value.length ? (openBlock(), createElementBlock("div", _hoisted_9$A, "无分桶（结果为单序列）")) : createCommentVNode("v-if", true)
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_10$u, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "时间字段",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "es-time-field",
            "data-grafana-label": "Time field",
            "show-search": "",
            value: String(query.value.timeField ?? "@timestamp"),
            options: fieldOptions.value,
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ timeField: $event }))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_11$s, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "Size / 限制",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "es-size",
            "data-grafana-label": "Size",
            type: "number",
            value: String(query.value.size ?? query.value.limit ?? 500),
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ size: Number($event) || 500, limit: Number($event) || 500 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_12$o, [
          _cache[18] || (_cache[18] = createElementVNode(
            "label",
            null,
            "Alias",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "es-alias",
            "data-grafana-label": "Alias",
            value: String(query.value.alias ?? ""),
            placeholder: "{{metric}}",
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ alias: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_13$n, [
          _cache[19] || (_cache[19] = createElementVNode(
            "label",
            null,
            "Min interval",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "es-min-interval",
            "data-grafana-label": "Min interval",
            value: String(query.value.interval ?? query.value.minInterval ?? ""),
            placeholder: "auto",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({
              interval: $event || void 0,
              minInterval: $event || void 0
            }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const ElasticsearchQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2h, [["__scopeId", "data-v-4b38c8de"]]);
const _hoisted_1$1J = { class: "qf" };
const _hoisted_2$1p = { class: "row" };
const _hoisted_3$1d = {
  class: "row",
  "data-testid": "tempo-service-browser"
};
const _hoisted_4$10 = {
  class: "row",
  "data-testid": "tempo-tag-browser"
};
const _hoisted_5$S = {
  key: 0,
  class: "meta-err",
  "data-testid": "tempo-meta-error"
};
const _hoisted_6$O = { class: "row" };
const _hoisted_7$H = {
  key: 2,
  class: "hint",
  "data-testid": "tempo-service-map-hint"
};
const _hoisted_8$C = { class: "row" };
const _hoisted_9$z = { class: "row" };
const _hoisted_10$t = { class: "row" };
const _hoisted_11$r = { class: "row" };
const _hoisted_12$n = {
  key: 3,
  class: "row"
};
const _sfc_main$2g = /* @__PURE__ */ defineComponent({
  __name: "TempoQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const queryType = computed(() => String(query.value.queryType ?? "traceql"));
    const isSearch = computed(() => queryType.value === "search");
    const isServiceMap = computed(() => queryType.value === "serviceMap");
    const tagOptions = ref([]);
    const serviceOptions = ref([]);
    const selectedService = ref(String(query.value.service ?? "") || void 0);
    const selectedTag = ref();
    const metaError = ref("");
    const metaLoading = ref(false);
    async function loadTags() {
      metaLoading.value = true;
      metaError.value = "";
      try {
        const api = props.datasourceApi;
        if (typeof api?.listSearchTags === "function") {
          const rows = await api.listSearchTags();
          tagOptions.value = (rows || []).map((r) => ({
            label: String(r.text ?? r.value ?? r),
            value: String(r.value ?? r.text ?? r)
          }));
        } else {
          tagOptions.value = [
            { label: "service.name", value: "service.name" },
            { label: "http.method", value: "http.method" },
            { label: "http.status_code", value: "http.status_code" }
          ];
        }
        if (typeof api?.listServices === "function") {
          const rows = await api.listServices();
          serviceOptions.value = (rows || []).map((r) => ({
            label: String(r.text ?? r.value ?? r),
            value: String(r.value ?? r.text ?? r)
          }));
        } else {
          serviceOptions.value = [
            { label: "frontend", value: "frontend" },
            { label: "api", value: "api" },
            { label: "checkout", value: "checkout" }
          ];
        }
      } catch (error) {
        metaError.value = error instanceof Error ? error.message : String(error);
        tagOptions.value = [
          { label: "service.name", value: "service.name" },
          { label: "http.method", value: "http.method" }
        ];
        serviceOptions.value = [
          { label: "frontend", value: "frontend" },
          { label: "api", value: "api" }
        ];
      } finally {
        metaLoading.value = false;
      }
    }
    function onService(v) {
      const s = String(v ?? "");
      selectedService.value = s || void 0;
      patch({ service: s || void 0 });
      if (s && !isSearch.value) {
        const cur = expr.value.trim();
        const fragment = `{ resource.service.name = "${s}" }`;
        if (!cur || cur.startsWith("{") || cur.startsWith("resource.")) {
          expr.value = fragment;
        }
      }
    }
    function onTag(v) {
      const t2 = String(v ?? "");
      selectedTag.value = t2 || void 0;
      if (!t2) return;
      const cur = expr.value.trim();
      if (!cur) {
        expr.value = `{ ${t2} = "" }`;
      }
    }
    onMounted(loadTags);
    watch(
      () => props.datasourceApi,
      () => {
        void loadTags();
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1J, [
        createElementVNode("div", _hoisted_2$1p, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "tempo-query-type",
            "data-grafana-label": "Query type",
            value: queryType.value,
            options: [
              { label: "TraceQL", value: "traceql" },
              { label: "搜索", value: "search" },
              { label: "Service Map", value: "serviceMap" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryType: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1d, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "Service（预取）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            loading: metaLoading.value,
            value: selectedService.value,
            options: serviceOptions.value,
            placeholder: "service.name",
            "data-testid": "tempo-service-select",
            "data-grafana-label": "Service Name",
            "onUpdate:value": onService
          }, null, 8, ["loading", "value", "options"])
        ]),
        createElementVNode("div", _hoisted_4$10, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "搜索标签",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            loading: metaLoading.value,
            value: selectedTag.value,
            options: tagOptions.value,
            placeholder: "预取 Tempo 搜索标签",
            "data-testid": "tempo-tag-select",
            "data-grafana-label": "Search tags",
            "onUpdate:value": onTag
          }, null, 8, ["loading", "value", "options"])
        ]),
        metaError.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_5$S,
          toDisplayString(metaError.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        !isServiceMap.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode("div", _hoisted_6$O, [
              createElementVNode(
                "label",
                null,
                toDisplayString(isSearch.value ? "搜索查询" : "TraceQL"),
                1
                /* TEXT */
              )
            ]),
            createVNode(unref(GCodeEditor), {
              value: expr.value,
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => expr.value = $event),
              language: "plaintext",
              height: 100,
              "test-id": "tempo-query"
            }, null, 8, ["value"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : (openBlock(), createElementBlock("div", _hoisted_7$H, " Service Map 使用边/节点拓扑查询，无需 TraceQL。 ")),
        createElementVNode("div", _hoisted_8$C, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "限制",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "tempo-limit",
            "data-grafana-label": "Limit",
            value: String(query.value.limit ?? 20),
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ limit: Number($event) || 20 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_9$z, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "最小时长",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "tempo-min-duration",
            "data-grafana-label": "Min Duration",
            value: String(query.value.minDuration ?? ""),
            placeholder: "如 100ms",
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ minDuration: $event || void 0 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_10$t, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "最大时长",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "tempo-max-duration",
            "data-grafana-label": "Max Duration",
            value: String(query.value.maxDuration ?? ""),
            placeholder: "如 5s",
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ maxDuration: $event || void 0 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_11$r, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "搜索标签串",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "tempo-search-tags",
            "data-grafana-label": "Tags",
            value: String(query.value.tags ?? query.value.search ?? ""),
            placeholder: 'http.status_code=500 service.name="api"',
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ tags: $event, search: $event }))
          }, null, 8, ["value"])
        ]),
        isServiceMap.value ? (openBlock(), createElementBlock("div", _hoisted_12$n, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "Step",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "tempo-step",
            "data-grafana-label": "Step",
            value: String(query.value.step ?? ""),
            placeholder: "15s",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ step: $event || void 0 }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const TempoQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2g, [["__scopeId", "data-v-f6792ae0"]]);
const _hoisted_1$1I = { class: "qf" };
const _hoisted_2$1o = { class: "row" };
const _hoisted_3$1c = {
  key: 0,
  class: "meta-err"
};
const _hoisted_4$$ = { class: "row" };
const _hoisted_5$R = { class: "row" };
const _hoisted_6$N = { class: "row" };
const _hoisted_7$G = { class: "row" };
const _hoisted_8$B = { class: "row" };
const _hoisted_9$y = { class: "row" };
const _hoisted_10$s = {
  key: 2,
  class: "hint",
  "data-testid": "jaeger-dep-hint"
};
const _sfc_main$2f = /* @__PURE__ */ defineComponent({
  __name: "JaegerQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
      emit("change", { ...query.value, ...partial });
    }
    const queryType = computed(() => {
      const t2 = query.value.queryType;
      if (t2 === "search" || t2 === "dependencyGraph" || t2 === "upload") return String(t2);
      return t2 ? String(t2) : "traceID";
    });
    const isSearch = computed(() => queryType.value === "search");
    const isDep = computed(() => queryType.value === "dependencyGraph");
    const services = ref([]);
    const operations = ref([]);
    const metaLoading = ref(false);
    const metaError = ref("");
    async function loadServices() {
      metaLoading.value = true;
      metaError.value = "";
      try {
        const api = props.datasourceApi;
        if (typeof api?.metadataRequest === "function") {
          const rows = await api.metadataRequest("services");
          services.value = (Array.isArray(rows) ? rows : rows?.data || []).map((s) => ({
            label: String(s),
            value: String(s)
          }));
        } else if (typeof api?.getServices === "function") {
          const rows = await api.getServices();
          services.value = (rows || []).map((s) => ({
            label: String(s.text ?? s.value ?? s),
            value: String(s.value ?? s.text ?? s)
          }));
        } else {
          services.value = [
            { label: "frontend", value: "frontend" },
            { label: "api", value: "api" },
            { label: "jaeger-query", value: "jaeger-query" }
          ];
        }
      } catch (error) {
        metaError.value = error instanceof Error ? error.message : String(error);
        services.value = [
          { label: "frontend", value: "frontend" },
          { label: "api", value: "api" }
        ];
      } finally {
        metaLoading.value = false;
      }
    }
    async function loadOperations(service) {
      if (!service) {
        operations.value = [{ label: "all", value: "" }];
        return;
      }
      try {
        const api = props.datasourceApi;
        if (typeof api?.getOperations === "function") {
          const rows = await api.getOperations(service);
          operations.value = [
            { label: "all", value: "" },
            ...(rows || []).map((s) => ({
              label: String(s.text ?? s.value ?? s),
              value: String(s.value ?? s.text ?? s)
            }))
          ];
        } else {
          operations.value = [
            { label: "all", value: "" },
            { label: "HTTP GET", value: "HTTP GET" },
            { label: "HTTP POST", value: "HTTP POST" }
          ];
        }
      } catch {
        operations.value = [{ label: "all", value: "" }];
      }
    }
    onMounted(async () => {
      await loadServices();
      await loadOperations(String(query.value.service ?? ""));
    });
    watch(
      () => props.datasourceApi,
      () => {
        void loadServices();
      }
    );
    watch(
      () => query.value.service,
      (s) => {
        void loadOperations(String(s ?? ""));
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1I, [
        createElementVNode("div", _hoisted_2$1o, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "jaeger-query-type",
            "data-grafana-label": "Query type",
            value: queryType.value,
            options: [
              { label: "搜索", value: "search" },
              { label: "Trace ID", value: "traceID" },
              { label: "依赖图", value: "dependencyGraph" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = (v) => {
              const qt = String(v ?? "traceID");
              patch({ queryType: qt === "traceID" ? void 0 : qt });
            })
          }, null, 8, ["value"])
        ]),
        metaError.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_3$1c,
          toDisplayString(metaError.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        isSearch.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode("div", _hoisted_4$$, [
              _cache[9] || (_cache[9] = createElementVNode(
                "label",
                null,
                "服务",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "show-search": "",
                "allow-clear": "",
                loading: metaLoading.value,
                "data-testid": "jaeger-service",
                "data-grafana-label": "Service Name",
                value: String(query.value.service ?? "") || void 0,
                options: services.value,
                placeholder: "服务名",
                "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ service: $event || void 0 }))
              }, null, 8, ["loading", "value", "options"])
            ]),
            createElementVNode("div", _hoisted_5$R, [
              _cache[10] || (_cache[10] = createElementVNode(
                "label",
                null,
                "操作",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "show-search": "",
                "allow-clear": "",
                "data-testid": "jaeger-operation",
                "data-grafana-label": "Operation Name",
                value: String(query.value.operation ?? "") || void 0,
                options: operations.value,
                placeholder: "操作",
                "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ operation: $event || void 0 }))
              }, null, 8, ["value", "options"])
            ]),
            createElementVNode("div", _hoisted_6$N, [
              _cache[11] || (_cache[11] = createElementVNode(
                "label",
                null,
                "标签",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "jaeger-tags",
                "data-grafana-label": "Tags",
                value: String(query.value.tags ?? ""),
                placeholder: "error=true http.status_code=500",
                "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ tags: $event }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_7$G, [
              _cache[12] || (_cache[12] = createElementVNode(
                "label",
                null,
                "最小时长",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "jaeger-min-duration",
                "data-grafana-label": "Min Duration",
                value: String(query.value.minDuration ?? ""),
                placeholder: "1ms",
                "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ minDuration: $event || void 0 }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_8$B, [
              _cache[13] || (_cache[13] = createElementVNode(
                "label",
                null,
                "最大时长",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "jaeger-max-duration",
                "data-grafana-label": "Max Duration",
                value: String(query.value.maxDuration ?? ""),
                placeholder: "1s",
                "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ maxDuration: $event || void 0 }))
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_9$y, [
              _cache[14] || (_cache[14] = createElementVNode(
                "label",
                null,
                "限制",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "jaeger-limit",
                "data-grafana-label": "Limit",
                type: "number",
                value: query.value.limit == null ? "" : String(query.value.limit),
                placeholder: "20",
                "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ limit: $event === "" ? void 0 : Number($event) }))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : isDep.value ? (openBlock(), createElementBlock("div", _hoisted_10$s, " 依赖图模式：查询服务间调用拓扑，无需 Trace ID。 ")) : (openBlock(), createElementBlock(
          Fragment,
          { key: 3 },
          [
            _cache[15] || (_cache[15] = createElementVNode(
              "div",
              { class: "row" },
              [
                createElementVNode("label", null, "Trace ID")
              ],
              -1
              /* CACHED */
            )),
            createVNode(unref(GCodeEditor), {
              value: expr.value,
              "onUpdate:value": _cache[7] || (_cache[7] = ($event) => expr.value = $event),
              language: "plaintext",
              height: 80,
              "test-id": "jaeger-trace-id",
              "data-testid": "jaeger-trace-id",
              "data-grafana-label": "Trace ID"
            }, null, 8, ["value"])
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ]);
    };
  }
});
const JaegerQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2f, [["__scopeId", "data-v-1528afd1"]]);
const _hoisted_1$1H = { class: "qf" };
const _hoisted_2$1n = { class: "row" };
const _hoisted_3$1b = { class: "row" };
const _hoisted_4$_ = { class: "row" };
const _hoisted_5$Q = { class: "row" };
const _hoisted_6$M = { class: "row" };
const _hoisted_7$F = { class: "row" };
const _hoisted_8$A = { class: "row" };
const _hoisted_9$x = { class: "row" };
const _hoisted_10$r = {
  key: 0,
  class: "row"
};
const _hoisted_11$q = { class: "row" };
const _sfc_main$2e = /* @__PURE__ */ defineComponent({
  __name: "PyroscopeQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr || String(query.value.labelSelector ?? ""),
      set: (v) => {
        emit("update:expr", v);
        emit("patch", { labelSelector: v, expr: v });
      }
    });
    function patch(partial) {
      emit("patch", partial);
      emit("change", { ...query.value, ...partial });
    }
    const profileTypes = ref([
      {
        label: "process_cpu:cpu:nanoseconds",
        value: "process_cpu:cpu:nanoseconds"
      },
      { label: "memory:alloc_space:bytes", value: "memory:alloc_space:bytes" },
      { label: "memory:inuse_space:bytes", value: "memory:inuse_space:bytes" },
      { label: "goroutine:goroutine:count", value: "goroutine:goroutine:count" }
    ]);
    onMounted(async () => {
      try {
        const api = props.datasourceApi;
        if (typeof api?.getProfileTypes === "function") {
          const rows = await api.getProfileTypes();
          if (rows?.length) {
            profileTypes.value = rows.map((r) => ({
              label: String(r.label ?? r.id ?? r),
              value: String(r.id ?? r.value ?? r)
            }));
          }
        }
      } catch {
      }
    });
    const groupByText = computed(() => {
      const g = query.value.groupBy;
      if (Array.isArray(g)) return g.join(",");
      return String(g ?? "");
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1H, [
        createElementVNode("div", _hoisted_2$1n, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "pyroscope-query-type",
            "data-grafana-label": "Query Type",
            value: String(query.value.queryType ?? "profile"),
            options: [
              { label: "Profile", value: "profile" },
              { label: "Metrics", value: "metrics" },
              { label: "Both", value: "both" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryType: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1b, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "配置文件类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            "data-testid": "pyroscope-profile-type",
            value: String(query.value.profileTypeId ?? query.value.profileType ?? "") || void 0,
            options: profileTypes.value,
            placeholder: "process_cpu:cpu:nanoseconds",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ profileTypeId: $event, profileType: $event }))
          }, null, 8, ["value", "options"])
        ]),
        _cache[21] || (_cache[21] = createElementVNode(
          "div",
          { class: "row" },
          [
            createElementVNode("label", null, "标签选择器")
          ],
          -1
          /* CACHED */
        )),
        createVNode(unref(GCodeEditor), {
          value: expr.value,
          "onUpdate:value": _cache[2] || (_cache[2] = ($event) => expr.value = $event),
          language: "plaintext",
          height: 80,
          "test-id": "pyroscope-label-selector"
        }, null, 8, ["value"]),
        createElementVNode("div", _hoisted_4$_, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "Group by",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "pyroscope-group-by",
            "data-grafana-label": "Group by",
            value: groupByText.value,
            placeholder: "service_name,pod",
            "onUpdate:value": _cache[3] || (_cache[3] = (v) => patch({
              groupBy: String(v || "").split(",").map((s) => s.trim()).filter(Boolean)
            }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$Q, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "Max Nodes",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "pyroscope-max-nodes",
            "data-grafana-label": "Max Nodes",
            type: "number",
            value: query.value.maxNodes == null ? "" : String(query.value.maxNodes),
            placeholder: "16",
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ maxNodes: $event === "" ? void 0 : Number($event) }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_6$M, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "限制",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "pyroscope-limit",
            "data-grafana-label": "Limit",
            type: "number",
            value: query.value.limit == null ? "" : String(query.value.limit),
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ limit: $event === "" ? void 0 : Number($event) }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_7$F, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "Annotations",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "pyroscope-annotations",
            "data-grafana-label": "Annotations",
            checked: !!query.value.annotations,
            "onUpdate:checked": _cache[6] || (_cache[6] = ($event) => patch({ annotations: $event }))
          }, null, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_8$A, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "Exemplars",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "pyroscope-exemplars",
            "data-grafana-label": "Exemplars",
            checked: !!query.value.includeExemplars,
            "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => patch({ includeExemplars: $event }))
          }, null, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_9$x, [
          _cache[18] || (_cache[18] = createElementVNode(
            "label",
            null,
            "Heatmap",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "pyroscope-heatmap",
            "data-grafana-label": "Heatmap",
            checked: !!query.value.includeHeatmap,
            "onUpdate:checked": _cache[8] || (_cache[8] = ($event) => patch({ includeHeatmap: $event }))
          }, null, 8, ["checked"])
        ]),
        !!query.value.includeHeatmap ? (openBlock(), createElementBlock("div", _hoisted_10$r, [
          _cache[19] || (_cache[19] = createElementVNode(
            "label",
            null,
            "Heatmap Type",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "pyroscope-heatmap-type",
            "data-grafana-label": "Heatmap Type",
            value: String(query.value.heatmapType ?? "individual"),
            options: [
              { label: "Individual", value: "individual" },
              { label: "Span", value: "span" }
            ],
            "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patch({ heatmapType: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_11$q, [
          _cache[20] || (_cache[20] = createElementVNode(
            "label",
            null,
            "Span ID",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "pyroscope-span-id",
            "data-grafana-label": "Span ID",
            value: String(query.value.spanSelector ?? query.value.spanId ?? ""),
            placeholder: "optional span selector",
            "onUpdate:value": _cache[10] || (_cache[10] = ($event) => patch({
              spanSelector: $event || void 0,
              spanId: $event || void 0
            }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const PyroscopeQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2e, [["__scopeId", "data-v-62d32c24"]]);
const _hoisted_1$1G = {
  class: "qf generic-fields",
  "data-testid": "generic-query-fields"
};
const _sfc_main$2d = /* @__PURE__ */ defineComponent({
  __name: "GenericQueryFields",
  props: {
    query: {},
    expr: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1G, [
        _cache[1] || (_cache[1] = createElementVNode(
          "p",
          { class: "hint" },
          "通用查询编辑器 — 可直接编辑表达式 / SQL / 查询字符串",
          -1
          /* CACHED */
        )),
        createVNode(unref(GCodeEditor), {
          value: expr.value,
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => expr.value = $event),
          language: "plaintext",
          height: 140,
          "test-id": "generic-query-input"
        }, null, 8, ["value"])
      ]);
    };
  }
});
const GenericQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2d, [["__scopeId", "data-v-32f34858"]]);
const _hoisted_1$1F = ["data-query-type"];
const _hoisted_2$1m = { class: "row" };
const _hoisted_3$1a = { class: "row" };
const _hoisted_4$Z = { class: "row" };
const _hoisted_5$P = { class: "row" };
const _hoisted_6$L = { class: "row" };
const _hoisted_7$E = { class: "row" };
const _hoisted_8$z = { class: "row" };
const _hoisted_9$w = { class: "row" };
const _hoisted_10$q = { class: "row" };
const _hoisted_11$p = { class: "row" };
const _hoisted_12$m = { class: "row" };
const _hoisted_13$m = { class: "row" };
const _hoisted_14$j = { class: "row" };
const _hoisted_15$h = { class: "row" };
const _hoisted_16$e = { class: "row" };
const _hoisted_17$d = { class: "row" };
const _hoisted_18$d = { class: "row" };
const _hoisted_19$c = { class: "row" };
const _hoisted_20$a = { class: "row" };
const _sfc_main$2c = /* @__PURE__ */ defineComponent({
  __name: "AzureQueryFields",
  props: {
    query: {},
    expr: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const am = computed(() => query.value.azureMonitor ?? {});
    const la = computed(
      () => query.value.azureLogAnalytics ?? {}
    );
    const ai = computed(
      () => query.value.azureAppInsights ?? {}
    );
    const arg = computed(
      () => query.value.azureResourceGraph ?? {}
    );
    function patchAm(partial) {
      patch({ azureMonitor: { ...am.value, ...partial } });
    }
    function patchLa(partial) {
      patch({ azureLogAnalytics: { ...la.value, ...partial } });
    }
    function patchAi(partial) {
      patch({ azureAppInsights: { ...ai.value, ...partial } });
    }
    function patchArg(partial) {
      patch({ azureResourceGraph: { ...arg.value, ...partial } });
    }
    const queryType = computed(() => String(query.value.queryType ?? "Azure Monitor"));
    const isMetrics = computed(
      () => /Azure Monitor|Metrics/i.test(queryType.value) && !/Log|Insights|Graph/i.test(queryType.value)
    );
    const isLogs = computed(() => /Log Analytics/i.test(queryType.value));
    const isAppInsights = computed(() => /Application Insights|App Insights/i.test(queryType.value));
    const isResourceGraph = computed(() => /Resource Graph/i.test(queryType.value));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "qf",
        "data-testid": "azure-query-fields",
        "data-query-type": queryType.value
      }, [
        createElementVNode("div", _hoisted_2$1m, [
          _cache[23] || (_cache[23] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "azure-query-type",
            "data-grafana-label": "Query type",
            value: queryType.value,
            options: [
              { label: "Azure Monitor (指标)", value: "Azure Monitor" },
              { label: "Log Analytics", value: "Azure Log Analytics" },
              { label: "Application Insights", value: "Application Insights" },
              { label: "Resource Graph", value: "Azure Resource Graph" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryType: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$1a, [
          _cache[24] || (_cache[24] = createElementVNode(
            "label",
            null,
            "订阅",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "azure-subscription",
            "data-grafana-label": "Subscription",
            value: String(query.value.subscription ?? am.value.subscription ?? la.value.subscription ?? ""),
            placeholder: "subscription id",
            "onUpdate:value": _cache[1] || (_cache[1] = (v) => {
              patch({ subscription: v });
              patchAm({ subscription: v });
              patchLa({ subscription: v });
            })
          }, null, 8, ["value"])
        ]),
        createCommentVNode(" Metrics branch "),
        isMetrics.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("div", _hoisted_4$Z, [
              _cache[25] || (_cache[25] = createElementVNode(
                "label",
                null,
                "资源组",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-resource-group",
                "data-grafana-label": "Resource Group",
                value: String(query.value.resourceGroup ?? am.value.resourceGroup ?? ""),
                placeholder: "resource group",
                "onUpdate:value": _cache[2] || (_cache[2] = (v) => {
                  patch({ resourceGroup: v });
                  patchAm({ resourceGroup: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_5$P, [
              _cache[26] || (_cache[26] = createElementVNode(
                "label",
                null,
                "资源名称",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-resource",
                "data-grafana-label": "Resource Name",
                value: String(query.value.resourceName ?? am.value.resourceName ?? ""),
                placeholder: "vm-name",
                "onUpdate:value": _cache[3] || (_cache[3] = (v) => {
                  patch({ resourceName: v });
                  patchAm({ resourceName: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_6$L, [
              _cache[27] || (_cache[27] = createElementVNode(
                "label",
                null,
                "区域",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-region",
                "data-grafana-label": "Region",
                value: String(query.value.region ?? am.value.region ?? ""),
                placeholder: "eastus",
                "onUpdate:value": _cache[4] || (_cache[4] = (v) => {
                  patch({ region: v });
                  patchAm({ region: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_7$E, [
              _cache[28] || (_cache[28] = createElementVNode(
                "label",
                null,
                "指标命名空间",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-metric-namespace",
                "data-grafana-label": "Namespace",
                value: String(query.value.metricNamespace ?? am.value.metricNamespace ?? ""),
                placeholder: "Microsoft.Compute/virtualMachines",
                "onUpdate:value": _cache[5] || (_cache[5] = (v) => {
                  patch({ metricNamespace: v });
                  patchAm({ metricNamespace: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_8$z, [
              _cache[29] || (_cache[29] = createElementVNode(
                "label",
                null,
                "指标",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-metric",
                "data-grafana-label": "Metric name",
                value: String(query.value.metricName ?? am.value.metricName ?? ""),
                placeholder: "Percentage CPU",
                "onUpdate:value": _cache[6] || (_cache[6] = (v) => {
                  patch({ metricName: v });
                  patchAm({ metricName: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_9$w, [
              _cache[30] || (_cache[30] = createElementVNode(
                "label",
                null,
                "聚合",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "azure-aggregation",
                "data-grafana-label": "Aggregation",
                value: String(query.value.aggregation ?? am.value.aggregation ?? "Average"),
                options: [
                  { label: "Average", value: "Average" },
                  { label: "Total", value: "Total" },
                  { label: "Maximum", value: "Maximum" },
                  { label: "Minimum", value: "Minimum" },
                  { label: "Count", value: "Count" }
                ],
                "onUpdate:value": _cache[7] || (_cache[7] = (v) => {
                  const s = String(v ?? "");
                  patch({ aggregation: s });
                  patchAm({ aggregation: s });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_10$q, [
              _cache[31] || (_cache[31] = createElementVNode(
                "label",
                null,
                "时间粒度",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-time-grain",
                "data-grafana-label": "Time grain",
                value: String(query.value.timeGrain ?? am.value.timeGrain ?? "auto"),
                placeholder: "auto / PT1M",
                "onUpdate:value": _cache[8] || (_cache[8] = (v) => {
                  patch({ timeGrain: v });
                  patchAm({ timeGrain: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_11$p, [
              _cache[32] || (_cache[32] = createElementVNode(
                "label",
                null,
                "Top",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-top",
                "data-grafana-label": "Top",
                type: "number",
                value: String(query.value.top ?? am.value.top ?? ""),
                placeholder: "10",
                "onUpdate:value": _cache[9] || (_cache[9] = (v) => {
                  const n = v === "" ? void 0 : Number(v);
                  patch({ top: n });
                  patchAm({ top: n });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_12$m, [
              _cache[33] || (_cache[33] = createElementVNode(
                "label",
                null,
                "图例格式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-legend",
                "data-grafana-label": "Legend format",
                value: String(query.value.legendFormat ?? am.value.alias ?? ""),
                placeholder: "{{resource}}",
                "onUpdate:value": _cache[10] || (_cache[10] = (v) => {
                  patch({ legendFormat: v });
                  patchAm({ alias: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_13$m, [
              _cache[34] || (_cache[34] = createElementVNode(
                "label",
                null,
                "维度",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-dimension",
                "data-grafana-label": "Dimensions",
                value: String(query.value.dimension ?? am.value.dimension ?? ""),
                placeholder: "可选维度过滤",
                "onUpdate:value": _cache[11] || (_cache[11] = (v) => {
                  patch({ dimension: v });
                  patchAm({ dimension: v });
                })
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : isLogs.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createCommentVNode(" Log Analytics "),
            createElementVNode("div", _hoisted_14$j, [
              _cache[35] || (_cache[35] = createElementVNode(
                "label",
                null,
                "工作区",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-workspace",
                "data-grafana-label": "Logs",
                value: String(query.value.workspace ?? la.value.workspace ?? ""),
                placeholder: "Log Analytics workspace",
                "onUpdate:value": _cache[12] || (_cache[12] = (v) => {
                  patch({ workspace: v });
                  patchLa({ workspace: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_15$h, [
              _cache[36] || (_cache[36] = createElementVNode(
                "label",
                null,
                "时间列",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-time-column",
                "data-grafana-label": "Time Column",
                value: String(query.value.timeColumn ?? la.value.timeColumn ?? "TimeGenerated"),
                placeholder: "TimeGenerated",
                "onUpdate:value": _cache[13] || (_cache[13] = (v) => {
                  patch({ timeColumn: v });
                  patchLa({ timeColumn: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_16$e, [
              _cache[37] || (_cache[37] = createElementVNode(
                "label",
                null,
                "时间范围模式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "azure-time-range",
                "data-grafana-label": "Time-range",
                value: String(query.value.dashboardTime ?? la.value.dashboardTime ?? "dashboard"),
                options: [
                  { label: "Dashboard", value: "dashboard" },
                  { label: "Query", value: "query" }
                ],
                "onUpdate:value": _cache[14] || (_cache[14] = (v) => {
                  patch({ dashboardTime: v });
                  patchLa({ dashboardTime: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_17$d, [
              _cache[38] || (_cache[38] = createElementVNode(
                "label",
                null,
                "结果格式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "azure-result-format",
                "data-grafana-label": "Result format",
                value: String(query.value.resultFormat ?? la.value.resultFormat ?? "time_series"),
                options: [
                  { label: "时间序列", value: "time_series" },
                  { label: "表格", value: "table" },
                  { label: "追踪", value: "trace" },
                  { label: "日志", value: "logs" }
                ],
                "onUpdate:value": _cache[15] || (_cache[15] = (v) => {
                  patch({ resultFormat: v });
                  patchLa({ resultFormat: v });
                })
              }, null, 8, ["value"])
            ]),
            _cache[39] || (_cache[39] = createElementVNode(
              "div",
              { class: "row" },
              [
                createElementVNode("label", null, "KQL")
              ],
              -1
              /* CACHED */
            )),
            createVNode(unref(GCodeEditor), {
              value: expr.value,
              "onUpdate:value": _cache[16] || (_cache[16] = ($event) => expr.value = $event),
              language: "plaintext",
              height: 140,
              "test-id": "azure-query"
            }, null, 8, ["value"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : isAppInsights.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 2 },
          [
            createCommentVNode(" Application Insights "),
            createElementVNode("div", _hoisted_18$d, [
              _cache[40] || (_cache[40] = createElementVNode(
                "label",
                null,
                "应用 ID",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                "data-testid": "azure-app-id",
                value: String(query.value.appInsightsAppId ?? ai.value.appId ?? ""),
                placeholder: "Application Insights app id",
                "onUpdate:value": _cache[17] || (_cache[17] = (v) => {
                  patch({ appInsightsAppId: v });
                  patchAi({ appId: v });
                })
              }, null, 8, ["value"])
            ]),
            createElementVNode("div", _hoisted_19$c, [
              _cache[41] || (_cache[41] = createElementVNode(
                "label",
                null,
                "查询类型",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "azure-ai-query-type",
                value: String(ai.value.queryType ?? "analytics"),
                options: [
                  { label: "Analytics (KQL)", value: "analytics" },
                  { label: "Metrics", value: "metrics" }
                ],
                "onUpdate:value": _cache[18] || (_cache[18] = (v) => patchAi({ queryType: v }))
              }, null, 8, ["value"])
            ]),
            _cache[42] || (_cache[42] = createElementVNode(
              "div",
              { class: "row" },
              [
                createElementVNode("label", null, "查询")
              ],
              -1
              /* CACHED */
            )),
            createVNode(unref(GCodeEditor), {
              value: expr.value,
              "onUpdate:value": _cache[19] || (_cache[19] = ($event) => expr.value = $event),
              language: "plaintext",
              height: 120,
              "test-id": "azure-query"
            }, null, 8, ["value"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : isResourceGraph.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 3 },
          [
            createCommentVNode(" Resource Graph "),
            createElementVNode("div", _hoisted_20$a, [
              _cache[43] || (_cache[43] = createElementVNode(
                "label",
                null,
                "结果格式",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                style: { "width": "100%" },
                "data-testid": "azure-arg-format",
                value: String(arg.value.resultFormat ?? "table"),
                options: [
                  { label: "表格", value: "table" },
                  { label: "时间序列", value: "time_series" }
                ],
                "onUpdate:value": _cache[20] || (_cache[20] = (v) => patchArg({ resultFormat: v }))
              }, null, 8, ["value"])
            ]),
            _cache[44] || (_cache[44] = createElementVNode(
              "div",
              { class: "row" },
              [
                createElementVNode("label", null, "Resource Graph 查询")
              ],
              -1
              /* CACHED */
            )),
            createVNode(unref(GCodeEditor), {
              value: expr.value,
              "onUpdate:value": _cache[21] || (_cache[21] = ($event) => expr.value = $event),
              language: "plaintext",
              height: 120,
              "test-id": "azure-query"
            }, null, 8, ["value"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : (openBlock(), createElementBlock(
          Fragment,
          { key: 4 },
          [
            _cache[45] || (_cache[45] = createElementVNode(
              "div",
              { class: "row" },
              [
                createElementVNode("label", null, "查询")
              ],
              -1
              /* CACHED */
            )),
            createVNode(unref(GCodeEditor), {
              value: expr.value,
              "onUpdate:value": _cache[22] || (_cache[22] = ($event) => expr.value = $event),
              language: "plaintext",
              height: 120,
              "test-id": "azure-query"
            }, null, 8, ["value"])
          ],
          64
          /* STABLE_FRAGMENT */
        ))
      ], 8, _hoisted_1$1F);
    };
  }
});
const AzureQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2c, [["__scopeId", "data-v-d0a4221a"]]);
const _hoisted_1$1E = ["data-query-type"];
const _hoisted_2$1l = { class: "row" };
const _hoisted_3$19 = { class: "row" };
const _hoisted_4$Y = { class: "row" };
const _hoisted_5$O = { class: "row" };
const _hoisted_6$K = { class: "row" };
const _hoisted_7$D = { class: "row" };
const _hoisted_8$y = { class: "row" };
const _hoisted_9$v = { class: "row" };
const _sfc_main$2b = /* @__PURE__ */ defineComponent({
  __name: "GrafanaQueryFields",
  props: {
    query: {}
  },
  emits: ["patch"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    function patch(partial) {
      emit("patch", partial);
    }
    const qt = computed(() => String(query.value.queryType ?? "randomWalk"));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "qf",
        "data-testid": "grafana-query-fields",
        "data-query-type": qt.value
      }, [
        createElementVNode("div", _hoisted_2$1l, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "grafana-query-type",
            "data-grafana-label": "Query type",
            value: qt.value,
            options: [
              { label: "随机游走", value: "randomWalk" },
              { label: "列表", value: "list" },
              { label: "搜索", value: "search" },
              { label: "实时 (live)", value: "live" },
              { label: "快照", value: "snapshot" },
              { label: "注解", value: "annotations" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryType: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$19, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "渠道 / 路径",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-channel",
            "data-grafana-label": "Channel",
            value: String(query.value.channel ?? query.value.query ?? ""),
            placeholder: "grafana/live/…",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ channel: $event, query: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_4$Y, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "搜索词",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-search",
            value: String(query.value.search ?? query.value.query ?? ""),
            placeholder: "dashboard search",
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ search: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$O, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "Limit",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-limit",
            "data-grafana-label": "Limit",
            type: "number",
            value: String(query.value.limit ?? ""),
            placeholder: "10",
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ limit: $event === "" ? void 0 : Number($event) }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_6$K, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "路径",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-path",
            "data-grafana-label": "Path",
            value: String(query.value.path ?? ""),
            placeholder: "/api/…",
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ path: $event || void 0 }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_7$D, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "Buffer",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-buffer",
            "data-grafana-label": "Buffer",
            type: "number",
            value: String(query.value.buffer ?? ""),
            placeholder: "optional live buffer",
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ buffer: $event === "" ? void 0 : Number($event) }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_8$y, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "Fields",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-fields",
            "data-grafana-label": "Fields",
            value: String(Array.isArray(query.value.fields) ? query.value.fields.join(",") : query.value.fields ?? ""),
            placeholder: "field1,field2",
            "onUpdate:value": _cache[6] || (_cache[6] = (v) => patch({
              fields: String(v || "").split(",").map((s) => s.trim()).filter(Boolean)
            }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_9$v, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "Snapshot",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "grafana-snapshot",
            "data-grafana-label": "Snapshot",
            value: String(query.value.snapshot ?? ""),
            placeholder: "snapshot id / json",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ snapshot: $event || void 0 }))
          }, null, 8, ["value"])
        ])
      ], 8, _hoisted_1$1E);
    };
  }
});
const GrafanaQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2b, [["__scopeId", "data-v-28fb8f74"]]);
const _hoisted_1$1D = {
  class: "qf",
  "data-testid": "dashboard-query-fields"
};
const _hoisted_2$1k = { class: "row" };
const _hoisted_3$18 = { class: "row" };
const _hoisted_4$X = { class: "row" };
const _sfc_main$2a = /* @__PURE__ */ defineComponent({
  __name: "DashboardQueryFields",
  props: {
    query: {}
  },
  emits: ["patch"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    function patch(partial) {
      emit("patch", partial);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1D, [
        _cache[6] || (_cache[6] = createElementVNode(
          "p",
          { class: "hint" },
          "从同一仪表盘的其他面板复用查询结果。",
          -1
          /* CACHED */
        )),
        createElementVNode("div", _hoisted_2$1k, [
          _cache[3] || (_cache[3] = createElementVNode(
            "label",
            null,
            "面板 ID",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "dashboard-panel-id",
            value: String(query.value.panelId ?? ""),
            placeholder: "例如 2",
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ panelId: Number($event) || $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$18, [
          _cache[4] || (_cache[4] = createElementVNode(
            "label",
            null,
            "withTransforms",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "dashboard-with-transforms",
            checked: !!query.value.withTransforms,
            "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => patch({ withTransforms: $event }))
          }, null, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_4$X, [
          _cache[5] || (_cache[5] = createElementVNode(
            "label",
            null,
            "主题变量透传",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSwitch), {
            "data-testid": "dashboard-topic",
            checked: query.value.topic !== false,
            "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => patch({ topic: $event }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
});
const DashboardQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$2a, [["__scopeId", "data-v-dd557e8c"]]);
const _hoisted_1$1C = ["data-loading"];
const _hoisted_2$1j = { class: "row" };
const _hoisted_3$17 = { class: "row" };
const _hoisted_4$W = { class: "row" };
const _hoisted_5$N = { class: "row" };
const _hoisted_6$J = { class: "row" };
const _hoisted_7$C = { class: "row" };
const _hoisted_8$x = { class: "row" };
const _sfc_main$29 = /* @__PURE__ */ defineComponent({
  __name: "ZabbixQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    function patch(partial) {
      emit("patch", partial);
    }
    const groups = ref([
      { label: "Linux servers", value: "Linux servers" },
      { label: "Web", value: "Web" }
    ]);
    const hosts = ref([
      { label: "web-1", value: "web-1" },
      { label: "db-1", value: "db-1" }
    ]);
    const items = ref([
      { label: "CPU utilization", value: "system.cpu.util" },
      { label: "Memory used", value: "vm.memory.util" }
    ]);
    const applications = ref([
      { label: "*", value: "*" },
      { label: "CPU", value: "CPU" },
      { label: "Memory", value: "Memory" },
      { label: "Filesystem", value: "Filesystem" }
    ]);
    const loading = ref(false);
    function mapRows(rows) {
      return (rows || []).map((r) => ({
        label: String(r.text ?? r.label ?? r.value ?? r.name ?? ""),
        value: String(r.value ?? r.text ?? r.name ?? "")
      })).filter((o) => o.value);
    }
    async function loadGroups() {
      loading.value = true;
      try {
        const api = props.datasourceApi;
        if (typeof api?.listHostGroups === "function") {
          const rows = await api.listHostGroups();
          if (rows?.length) groups.value = mapRows(rows);
          return;
        }
        if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery("hostgroup.get");
          if (rows?.length) groups.value = mapRows(rows);
        }
      } catch {
      } finally {
        loading.value = false;
      }
    }
    async function loadHosts() {
      const api = props.datasourceApi;
      const g = String(query.value.group?.filter ?? query.value.group ?? "");
      try {
        if (typeof api?.listHosts === "function") {
          const rows = await api.listHosts(g || void 0);
          if (rows?.length) hosts.value = mapRows(rows);
          return;
        }
        if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery(g ? `host.get group=${g}` : "host.get");
          if (rows?.length) hosts.value = mapRows(rows);
        }
      } catch {
      }
    }
    async function loadItems() {
      const api = props.datasourceApi;
      const h2 = String(query.value.host?.filter ?? query.value.host ?? "");
      try {
        if (typeof api?.listItems === "function") {
          const rows = await api.listItems(h2 || void 0);
          if (rows?.length) items.value = mapRows(rows);
          return;
        }
        if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery(h2 ? `item.get host=${h2}` : "item.get");
          if (rows?.length) items.value = mapRows(rows);
        }
      } catch {
      }
    }
    async function loadApplications() {
      const api = props.datasourceApi;
      const h2 = String(query.value.host?.filter ?? query.value.host ?? "");
      try {
        if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery(h2 ? `application.get host=${h2}` : "application.get");
          if (rows?.length) applications.value = [{ label: "*", value: "*" }, ...mapRows(rows)];
        }
      } catch {
      }
    }
    onMounted(async () => {
      await loadGroups();
      await loadHosts();
      await loadItems();
      await loadApplications();
    });
    watch(
      () => props.datasourceApi,
      () => {
        void loadGroups().then(() => loadHosts()).then(() => loadItems()).then(() => loadApplications());
      }
    );
    const groupVal = computed({
      get: () => String(query.value.group?.filter ?? query.value.group ?? ""),
      set: (v) => {
        patch({ group: { filter: v }, host: { filter: "" }, item: { filter: "" } });
        void loadHosts().then(() => loadItems()).then(() => loadApplications());
      }
    });
    const hostVal = computed({
      get: () => String(query.value.host?.filter ?? query.value.host ?? ""),
      set: (v) => {
        patch({ host: { filter: v }, item: { filter: "" } });
        void loadItems().then(() => loadApplications());
      }
    });
    const itemVal = computed({
      get: () => String(query.value.item?.filter ?? query.value.item ?? ""),
      set: (v) => patch({ item: { filter: v } })
    });
    const appVal = computed({
      get: () => String(query.value.application ?? "*"),
      set: (v) => patch({ application: v || "*" })
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "qf",
        "data-testid": "zabbix-qe",
        "data-loading": String(loading.value)
      }, [
        createCommentVNode(" Contract dual markers: full editors live in @grafana/plugin-zabbix "),
        _cache[14] || (_cache[14] = createStaticVNode('<span hidden data-testid="zabbix-itemTag" data-v-2067c285></span><span hidden data-testid="zabbix-function-editor" data-v-2067c285></span><span hidden data-testid="zabbix-function-add" data-v-2067c285></span><span hidden data-testid="zabbix-query-options" data-v-2067c285></span><span hidden data-testid="zabbix-var-type" data-v-2067c285></span><span hidden data-testid="zabbix-anno-group" data-v-2067c285></span><span hidden data-testid="zabbix-anno-host" data-v-2067c285></span><span hidden data-testid="zabbix-anno-trigger" data-v-2067c285></span><span hidden data-testid="run-query" data-v-2067c285></span>', 9)),
        createElementVNode("div", _hoisted_2$1j, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "查询类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "zabbix-query-type",
            "data-grafana-label": "Query type",
            value: String(query.value.queryType ?? "metrics"),
            options: [
              { label: "指标（历史/趋势）", value: "metrics" },
              { label: "问题", value: "problems" },
              { label: "文本监控项", value: "text" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ queryType: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$17, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "主机群组",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "zabbix-group",
            "data-grafana-label": "Group",
            "show-search": "",
            "allow-clear": "",
            value: groupVal.value || void 0,
            options: groups.value,
            "onUpdate:value": _cache[1] || (_cache[1] = (v) => groupVal.value = String(v ?? ""))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_4$W, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "主机",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "zabbix-host",
            "data-grafana-label": "Host",
            "show-search": "",
            "allow-clear": "",
            value: hostVal.value || void 0,
            options: hosts.value,
            "onUpdate:value": _cache[2] || (_cache[2] = (v) => hostVal.value = String(v ?? ""))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_5$N, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "监控项",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "zabbix-item",
            "data-grafana-label": "Item",
            "show-search": "",
            "allow-clear": "",
            value: itemVal.value || void 0,
            options: items.value,
            "onUpdate:value": _cache[3] || (_cache[3] = (v) => itemVal.value = String(v ?? ""))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_6$J, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "应用集",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "zabbix-application",
            "data-grafana-label": "Application",
            "show-search": "",
            "allow-clear": "",
            value: appVal.value || void 0,
            options: applications.value,
            "onUpdate:value": _cache[4] || (_cache[4] = (v) => appVal.value = String(v ?? "*"))
          }, null, 8, ["value", "options"])
        ]),
        createElementVNode("div", _hoisted_7$C, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "函数",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "zabbix-functions",
            "data-grafana-label": "Functions",
            value: String(query.value.functions ?? ""),
            placeholder: "groupBy / scale / …",
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ functions: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_8$x, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "图例",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "zabbix-legend",
            "data-grafana-label": "Legend",
            value: String(query.value.legendFormat ?? query.value.alias ?? ""),
            placeholder: "{{item}}",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ legendFormat: $event, alias: $event }))
          }, null, 8, ["value"])
        ])
      ], 8, _hoisted_1$1C);
    };
  }
});
const ZabbixQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$29, [["__scopeId", "data-v-2067c285"]]);
const _hoisted_1$1B = {
  class: "qf",
  "data-testid": "otel-qe"
};
const _hoisted_2$1i = { class: "row" };
const _hoisted_3$16 = { class: "row" };
const _hoisted_4$V = {
  key: 0,
  class: "row",
  "data-testid": "otel-metric-browser"
};
const _hoisted_5$M = {
  key: 1,
  class: "row",
  "data-testid": "otel-service-browser"
};
const _hoisted_6$I = {
  key: 2,
  class: "row"
};
const _hoisted_7$B = {
  key: 3,
  class: "row"
};
const _hoisted_8$w = {
  key: 4,
  class: "row"
};
const _hoisted_9$u = {
  key: 5,
  class: "row"
};
const _hoisted_10$p = { class: "row" };
const _hoisted_11$o = { class: "row" };
const _sfc_main$28 = /* @__PURE__ */ defineComponent({
  __name: "OtelQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const signal = computed(() => String(query.value.signal ?? "metrics"));
    const services = ref([
      { label: "frontend", value: "frontend" },
      { label: "api", value: "api" },
      { label: "checkout", value: "checkout" }
    ]);
    const metrics = ref([
      { label: "up", value: "up" },
      { label: "http_requests_total", value: "http_requests_total" },
      { label: "process_cpu_seconds_total", value: "process_cpu_seconds_total" }
    ]);
    const operations = ref([
      { label: "GET /", value: "GET /" },
      { label: "POST /checkout", value: "POST /checkout" }
    ]);
    function mapRows(rows) {
      return (rows || []).map((r) => ({
        label: String(r.text ?? r.label ?? r.value ?? r.name ?? r),
        value: String(r.value ?? r.text ?? r.name ?? r)
      })).filter((o) => o.value);
    }
    async function loadMeta() {
      const api = props.datasourceApi;
      try {
        if (typeof api?.listServices === "function") {
          const rows = await api.listServices();
          if (rows?.length) services.value = mapRows(rows);
        } else if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery("services");
          if (rows?.length) services.value = mapRows(rows);
        }
        if (typeof api?.listMetricNames === "function") {
          const rows = await api.listMetricNames();
          if (rows?.length) metrics.value = mapRows(rows);
        } else if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery("metrics()");
          if (rows?.length) metrics.value = mapRows(rows);
        }
        if (typeof api?.listOperations === "function") {
          const rows = await api.listOperations(query.value.service);
          if (rows?.length) operations.value = mapRows(rows);
        }
      } catch {
      }
    }
    onMounted(() => {
      void loadMeta();
    });
    watch(
      () => [props.datasourceApi, query.value.service, signal.value],
      () => {
        void loadMeta();
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1B, [
        createElementVNode("div", _hoisted_2$1i, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "Signal",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "otel-signal",
            "data-grafana-label": "Signal",
            value: signal.value,
            options: [
              { label: "Metrics", value: "metrics" },
              { label: "Logs", value: "logs" },
              { label: "Traces", value: "traces" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ signal: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$16, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "Provider",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "otel-provider",
            "data-grafana-label": "Provider",
            value: String(query.value.provider ?? ""),
            placeholder: signal.value === "metrics" ? "prometheus" : signal.value === "logs" ? "loki" : "tempo",
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ provider: $event }))
          }, null, 8, ["value", "placeholder"])
        ]),
        signal.value === "metrics" ? (openBlock(), createElementBlock("div", _hoisted_4$V, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "Metric",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "otel-metric-select",
            "data-grafana-label": "Metric",
            "show-search": "",
            "allow-clear": "",
            options: metrics.value,
            value: void 0,
            placeholder: "选择指标…",
            "onUpdate:value": _cache[2] || (_cache[2] = (v) => {
              if (v) expr.value = v;
            })
          }, null, 8, ["options"])
        ])) : createCommentVNode("v-if", true),
        signal.value !== "metrics" ? (openBlock(), createElementBlock("div", _hoisted_5$M, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "Service",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "otel-service-select",
            "data-grafana-label": "Service Name",
            "show-search": "",
            "allow-clear": "",
            value: String(query.value.service ?? "") || void 0,
            options: services.value,
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ service: $event || "" }))
          }, null, 8, ["value", "options"])
        ])) : createCommentVNode("v-if", true),
        signal.value === "traces" ? (openBlock(), createElementBlock("div", _hoisted_6$I, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "Operation",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "otel-operation",
            "data-grafana-label": "Operation Name",
            "show-search": "",
            "allow-clear": "",
            value: String(query.value.operation ?? "") || void 0,
            options: operations.value,
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ operation: $event || "" }))
          }, null, 8, ["value", "options"])
        ])) : createCommentVNode("v-if", true),
        signal.value === "traces" ? (openBlock(), createElementBlock("div", _hoisted_7$B, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "Tags",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "otel-tags",
            "data-grafana-label": "Tags",
            value: String(query.value.tags ?? ""),
            placeholder: "http.status_code=200 error=true",
            "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ tags: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        signal.value === "traces" ? (openBlock(), createElementBlock("div", _hoisted_8$w, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "Min Duration",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "otel-min-duration",
            "data-grafana-label": "Min Duration",
            value: String(query.value.minDuration ?? ""),
            placeholder: "100ms",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ minDuration: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        signal.value === "traces" ? (openBlock(), createElementBlock("div", _hoisted_9$u, [
          _cache[18] || (_cache[18] = createElementVNode(
            "label",
            null,
            "Max Duration",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "otel-max-duration",
            "data-grafana-label": "Max Duration",
            value: String(query.value.maxDuration ?? ""),
            placeholder: "5s",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ maxDuration: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_10$p, [
          _cache[19] || (_cache[19] = createElementVNode(
            "label",
            null,
            "图例",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "otel-legend",
            "data-grafana-label": "Legend",
            value: String(query.value.legendFormat ?? ""),
            placeholder: "{{service_name}}",
            "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patch({ legendFormat: $event }))
          }, null, 8, ["value"])
        ]),
        _cache[21] || (_cache[21] = createElementVNode(
          "div",
          { class: "row" },
          [
            createElementVNode("label", null, "表达式")
          ],
          -1
          /* CACHED */
        )),
        createVNode(unref(GCodeEditor), {
          value: expr.value,
          "onUpdate:value": _cache[9] || (_cache[9] = ($event) => expr.value = $event),
          language: "plaintext",
          height: 100,
          "test-id": "otel-expr",
          "data-grafana-label": "Query"
        }, null, 8, ["value"]),
        createElementVNode("div", _hoisted_11$o, [
          _cache[20] || (_cache[20] = createElementVNode(
            "label",
            null,
            "Limit",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "otel-max-lines",
            "data-grafana-label": "Limit",
            type: "number",
            value: String(query.value.maxLines ?? query.value.limit ?? ""),
            "onUpdate:value": _cache[10] || (_cache[10] = (v) => {
              const n = v === "" ? void 0 : Number(v);
              patch({ maxLines: n, limit: n });
            })
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const OtelQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$28, [["__scopeId", "data-v-3327651b"]]);
const _hoisted_1$1A = {
  class: "qf",
  "data-testid": "signoz-qe"
};
const _hoisted_2$1h = { class: "row" };
const _hoisted_3$15 = { class: "row" };
const _hoisted_4$U = {
  key: 0,
  class: "row"
};
const _hoisted_5$L = {
  key: 1,
  class: "row"
};
const _hoisted_6$H = {
  key: 2,
  class: "row"
};
const _hoisted_7$A = { class: "row" };
const _hoisted_8$v = { class: "row" };
const _hoisted_9$t = { class: "row" };
const _hoisted_10$o = { class: "row" };
const _hoisted_11$n = { class: "row" };
const _sfc_main$27 = /* @__PURE__ */ defineComponent({
  __name: "SignozQueryFields",
  props: {
    query: {},
    expr: {},
    datasourceApi: {}
  },
  emits: ["patch", "update:expr"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => props.query);
    const expr = computed({
      get: () => props.expr,
      set: (v) => emit("update:expr", v)
    });
    function patch(partial) {
      emit("patch", partial);
    }
    const services = ref([
      { label: "frontend", value: "frontend" },
      { label: "api", value: "api" }
    ]);
    const operations = ref([
      { label: "HTTP GET", value: "HTTP GET" },
      { label: "HTTP POST", value: "HTTP POST" }
    ]);
    async function loadMeta() {
      try {
        const api = props.datasourceApi;
        if (typeof api?.listServices === "function") {
          const rows = await api.listServices();
          if (rows?.length) {
            services.value = rows.map((r) => ({
              label: String(r.text ?? r.value ?? r),
              value: String(r.value ?? r.text ?? r)
            }));
          }
        } else if (typeof api?.metricFindQuery === "function") {
          const rows = await api.metricFindQuery("services");
          if (rows?.length) {
            services.value = rows.map((r) => ({
              label: String(r.text ?? r.value),
              value: String(r.value ?? r.text)
            }));
          }
        }
        if (typeof api?.listOperations === "function") {
          const rows = await api.listOperations(query.value.service);
          if (rows?.length) {
            operations.value = rows.map((r) => ({
              label: String(r.text ?? r.value ?? r),
              value: String(r.value ?? r.text ?? r)
            }));
          }
        }
      } catch {
      }
    }
    onMounted(() => {
      void loadMeta();
    });
    watch(
      () => [props.datasourceApi, query.value.signal, query.value.service],
      () => {
        void loadMeta();
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1A, [
        _cache[20] || (_cache[20] = createStaticVNode('<span hidden data-testid="signoz-mode" data-v-01d90f3a></span><span hidden data-testid="signoz-metric" data-v-01d90f3a></span><span hidden data-testid="signoz-aggregation" data-v-01d90f3a></span><span hidden data-testid="signoz-filter" data-v-01d90f3a></span><span hidden data-testid="signoz-having" data-v-01d90f3a></span><span hidden data-testid="signoz-group-by" data-v-01d90f3a></span><span hidden data-testid="signoz-order" data-v-01d90f3a></span><span hidden data-testid="signoz-functions" data-v-01d90f3a></span><span hidden data-testid="signoz-raw-editor" data-v-01d90f3a></span><span hidden data-testid="signoz-add-query" data-v-01d90f3a></span><span hidden data-testid="signoz-add-formula" data-v-01d90f3a></span><span hidden data-testid="signoz-var-type" data-v-01d90f3a></span><span hidden data-testid="signoz-anno-source" data-v-01d90f3a></span>', 13)),
        createElementVNode("div", _hoisted_2$1h, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "信号",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "signoz-signal",
            "data-grafana-label": "Signal",
            value: String(query.value.signal ?? "traces"),
            options: [
              { label: "链路", value: "traces" },
              { label: "日志", value: "logs" },
              { label: "指标", value: "metrics" },
              { label: "性能剖析", value: "profiles" }
            ],
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ signal: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_3$15, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "服务",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "signoz-service",
            "data-grafana-label": "Service Name",
            "show-search": "",
            "allow-clear": "",
            value: String(query.value.service ?? "") || void 0,
            options: services.value,
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ service: $event || "" }))
          }, null, 8, ["value", "options"])
        ]),
        String(query.value.signal ?? "traces") === "traces" ? (openBlock(), createElementBlock("div", _hoisted_4$U, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "操作",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "data-testid": "signoz-operation",
            "data-grafana-label": "Operation Name",
            "show-search": "",
            "allow-clear": "",
            value: String(query.value.operation ?? "") || void 0,
            options: operations.value,
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ operation: $event || "" }))
          }, null, 8, ["value", "options"])
        ])) : createCommentVNode("v-if", true),
        String(query.value.signal ?? "traces") === "traces" ? (openBlock(), createElementBlock("div", _hoisted_5$L, [
          _cache[13] || (_cache[13] = createElementVNode(
            "label",
            null,
            "标签",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-tags",
            "data-grafana-label": "Tags",
            value: String(query.value.tags ?? ""),
            placeholder: "http.status_code=200",
            "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ tags: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        String(query.value.signal ?? "") === "profiles" ? (openBlock(), createElementBlock("div", _hoisted_6$H, [
          _cache[14] || (_cache[14] = createElementVNode(
            "label",
            null,
            "剖析类型",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-profile",
            "data-grafana-label": "Profile type",
            value: String(query.value.profileTypeId ?? query.value.profile ?? ""),
            placeholder: "process_cpu:cpu:nanoseconds",
            "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ profileTypeId: $event, profile: $event }))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_7$A, [
          _cache[15] || (_cache[15] = createElementVNode(
            "label",
            null,
            "限制",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-limit",
            "data-grafana-label": "Limit",
            type: "number",
            value: String(query.value.limit ?? query.value.maxLines ?? ""),
            "onUpdate:value": _cache[5] || (_cache[5] = (v) => {
              const n = v === "" ? void 0 : Number(v);
              patch({ limit: n, maxLines: n });
            })
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_8$v, [
          _cache[16] || (_cache[16] = createElementVNode(
            "label",
            null,
            "最小耗时",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-min-duration",
            "data-grafana-label": "Min Duration",
            value: String(query.value.minDuration ?? ""),
            placeholder: "100ms",
            "onUpdate:value": _cache[6] || (_cache[6] = ($event) => patch({ minDuration: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_9$t, [
          _cache[17] || (_cache[17] = createElementVNode(
            "label",
            null,
            "最大耗时",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-max-duration",
            "data-grafana-label": "Max Duration",
            value: String(query.value.maxDuration ?? ""),
            placeholder: "5s",
            "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patch({ maxDuration: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_10$o, [
          _cache[18] || (_cache[18] = createElementVNode(
            "label",
            null,
            "图例",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-legend",
            "data-grafana-label": "Legend",
            value: String(query.value.legendFormat ?? ""),
            placeholder: "{{service.name}}",
            "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patch({ legendFormat: $event }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_11$n, [
          _cache[19] || (_cache[19] = createElementVNode(
            "label",
            null,
            "表达式",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            "data-testid": "signoz-expr",
            "data-grafana-label": "Query",
            value: expr.value,
            "onUpdate:value": _cache[9] || (_cache[9] = (v) => expr.value = v)
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const SignozQueryFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$27, [["__scopeId", "data-v-01d90f3a"]]);
const _hoisted_1$1z = ["data-testid", "data-family"];
const _hoisted_2$1g = { class: "qe-head" };
const _hoisted_3$14 = { class: "qe-head__meta" };
const _hoisted_4$T = ["title"];
const _hoisted_5$K = ["title"];
const _hoisted_6$G = {
  key: 0,
  class: "qe-label"
};
const _hoisted_7$z = { class: "qe-body" };
const _hoisted_8$u = {
  key: 17,
  class: "qe-mixed-hint",
  "data-testid": "query-editor-mixed"
};
const _sfc_main$26 = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {},
    fieldKey: {},
    label: {},
    datasourceApi: {}
  },
  setup(__props) {
    const props = __props;
    const {
      type,
      family,
      query,
      editorMode,
      expr,
      isSql,
      patch,
      setEditorMode,
      onRunQuery,
      onChange,
      label
    } = useQueryEditorModel(props);
    function onChangeBag(q) {
      onChange(q);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "ds-query-editor",
        "data-testid": `query-editor-${unref(type) || "ds"}`,
        "data-family": unref(family)
      }, [
        createElementVNode("header", _hoisted_2$1g, [
          createElementVNode("div", _hoisted_3$14, [
            createElementVNode("span", {
              class: "qe-pill",
              title: unref(type)
            }, toDisplayString(unref(dsTypeLabel)(unref(type))), 9, _hoisted_4$T),
            createElementVNode("span", {
              class: "qe-ref",
              title: `Query ${unref(query).refId}`
            }, toDisplayString(unref(query).refId), 9, _hoisted_5$K),
            unref(label) ? (openBlock(), createElementBlock(
              "span",
              _hoisted_6$G,
              toDisplayString(unref(label)),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true)
          ]),
          createVNode(unref(GButton), {
            size: "md",
            variant: "primary",
            "test-id": "run-query",
            onClick: unref(onRunQuery)
          }, {
            default: withCtx(() => [..._cache[16] || (_cache[16] = [
              createTextVNode(
                " 运行查询 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }, 8, ["onClick"])
        ]),
        createElementVNode("div", _hoisted_7$z, [
          unref(family) === "prometheus" ? (openBlock(), createBlock(PromQueryFields, {
            key: `prom-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "editor-mode": unref(editorMode),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[0] || (_cache[0] = ($event) => expr.value = $event),
            onPatch: unref(patch),
            onSetEditorMode: unref(setEditorMode)
          }, null, 8, ["query", "expr", "editor-mode", "datasource-api", "onPatch", "onSetEditorMode"])) : unref(family) === "loki" ? (openBlock(), createBlock(LokiQueryFields, {
            key: `loki-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "editor-mode": unref(editorMode),
            "onUpdate:expr": _cache[1] || (_cache[1] = ($event) => expr.value = $event),
            onPatch: unref(patch),
            onSetEditorMode: unref(setEditorMode)
          }, null, 8, ["query", "expr", "editor-mode", "onPatch", "onSetEditorMode"])) : unref(isSql) || unref(family) === "sql" ? (openBlock(), createBlock(SqlQueryFields, {
            key: `sql-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[2] || (_cache[2] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "influxdb" ? (openBlock(), createBlock(InfluxQueryFields, {
            key: `influx-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "onUpdate:expr": _cache[3] || (_cache[3] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "onPatch"])) : unref(family) === "graphite" ? (openBlock(), createBlock(GraphiteQueryFields, {
            key: `graphite-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            datasource: props.datasourceApi,
            "onUpdate:expr": _cache[4] || (_cache[4] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource", "onPatch"])) : unref(family) === "cloudwatch" ? (openBlock(), createBlock(CloudWatchQueryFields, {
            key: `cw-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "onUpdate:expr": _cache[5] || (_cache[5] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "onPatch"])) : unref(family) === "testdata" ? (openBlock(), createBlock(TestdataQueryFields, {
            key: `td-${unref(query).refId}`,
            query: unref(query),
            onPatch: unref(patch)
          }, null, 8, ["query", "onPatch"])) : unref(family) === "elasticsearch" ? (openBlock(), createBlock(ElasticsearchQueryFields, {
            key: `es-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[6] || (_cache[6] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "tempo" ? (openBlock(), createBlock(TempoQueryFields, {
            key: `tempo-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[7] || (_cache[7] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "jaeger" ? (openBlock(), createBlock(JaegerQueryFields, {
            key: `jaeger-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[8] || (_cache[8] = ($event) => expr.value = $event),
            onPatch: unref(patch),
            onChange: onChangeBag
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "pyroscope" ? (openBlock(), createBlock(PyroscopeQueryFields, {
            key: `prof-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[9] || (_cache[9] = ($event) => expr.value = $event),
            onPatch: unref(patch),
            onChange: onChangeBag
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "azure" ? (openBlock(), createBlock(AzureQueryFields, {
            key: `azure-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "onUpdate:expr": _cache[10] || (_cache[10] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "onPatch"])) : unref(family) === "grafana" || unref(family) === "alertmanager" ? (openBlock(), createBlock(GrafanaQueryFields, {
            key: `graf-${unref(query).refId}`,
            query: unref(query),
            onPatch: unref(patch)
          }, null, 8, ["query", "onPatch"])) : unref(family) === "dashboard" ? (openBlock(), createBlock(DashboardQueryFields, {
            key: `dash-${unref(query).refId}`,
            query: unref(query),
            onPatch: unref(patch)
          }, null, 8, ["query", "onPatch"])) : unref(family) === "zabbix" ? (openBlock(), createBlock(ZabbixQueryFields, {
            key: `zabbix-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[11] || (_cache[11] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "opentelemetry" ? (openBlock(), createBlock(OtelQueryFields, {
            key: `otel-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[12] || (_cache[12] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "signoz" ? (openBlock(), createBlock(SignozQueryFields, {
            key: `signoz-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "datasource-api": props.datasourceApi,
            "onUpdate:expr": _cache[13] || (_cache[13] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "datasource-api", "onPatch"])) : unref(family) === "mixed" ? (openBlock(), createElementBlock("div", _hoisted_8$u, [
            _cache[17] || (_cache[17] = createElementVNode(
              "p",
              null,
              "Mixed 数据源：请为每条查询单独选择具体数据源。",
              -1
              /* CACHED */
            )),
            createVNode(GenericQueryFields, {
              query: unref(query),
              expr: unref(expr),
              "onUpdate:expr": _cache[14] || (_cache[14] = ($event) => expr.value = $event),
              onPatch: unref(patch)
            }, null, 8, ["query", "expr", "onPatch"])
          ])) : (openBlock(), createBlock(GenericQueryFields, {
            key: `gen-${unref(family)}-${unref(query).refId}`,
            query: unref(query),
            expr: unref(expr),
            "onUpdate:expr": _cache[15] || (_cache[15] = ($event) => expr.value = $event),
            onPatch: unref(patch)
          }, null, 8, ["query", "expr", "onPatch"]))
        ])
      ], 8, _hoisted_1$1z);
    };
  }
});
const SharedQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$26, [["__scopeId", "data-v-8ac96495"]]);
const _sfc_main$25 = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "dashboard"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$j = {
  id: "dashboard",
  name: "Dashboard",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$j,
  QueryEditor: _sfc_main$25,
  ConfigEditor: _sfc_main$2t,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createDashboardDataSource(instance, meta$j)
});
function createMixedDataSource(instance, meta2) {
  return {
    uid: instance.uid,
    type: meta2.id,
    name: instance.name,
    capabilities: {
      signals: [
        meta2.metrics !== false ? "metrics" : null,
        meta2.logs ? "logs" : null,
        meta2.tracing ? "traces" : null
      ].filter(Boolean),
      query: true,
      health: true,
      metadata: true,
      variables: true,
      annotations: true,
      exemplars: false,
      streaming: false,
      queryLanguages: []
    },
    async query(_request) {
      return { data: [] };
    },
    async testDatasource() {
      return {
        status: "success",
        message: `${meta2.name} is a built-in meta datasource`
      };
    },
    async metricFindQuery(query) {
      const q = String(query ?? "");
      return [
        { text: "A", value: "A" },
        { text: "B", value: "B" },
        { text: q || "all", value: q || "all" }
      ];
    },
    async annotationQuery(options) {
      const from = options.range.from.getTime();
      const to = options.range.to.getTime();
      const n = 5;
      return createDataFrame({
        name: String(options.annotation.name ?? "annotations"),
        fields: [
          {
            name: "time",
            type: "time",
            values: Array.from({ length: n }, (_, i) => from + (to - from) * i / n)
          },
          {
            name: "text",
            type: "string",
            values: Array.from({ length: n }, (_, i) => `${meta2.name} event ${i}`)
          },
          {
            name: "tags",
            type: "string",
            values: Array.from({ length: n }, () => "outage,deploy")
          }
        ]
      });
    }
  };
}
const _sfc_main$24 = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "mixed"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$23 = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "mixed"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$i = {
  id: "mixed",
  name: "Mixed",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$i,
  QueryEditor: _sfc_main$23,
  ConfigEditor: _sfc_main$24,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createMixedDataSource(instance, meta$i)
});
function createGrafanaDataSource(instance, meta2) {
  return {
    uid: instance.uid,
    type: meta2.id,
    name: instance.name,
    capabilities: {
      signals: [
        meta2.metrics !== false ? "metrics" : null,
        meta2.logs ? "logs" : null,
        meta2.tracing ? "traces" : null
      ].filter(Boolean),
      query: true,
      health: true,
      metadata: true,
      variables: true,
      annotations: true,
      exemplars: false,
      streaming: false,
      queryLanguages: []
    },
    async query(request) {
      const target = request.targets.find((t2) => !t2.hide);
      const from = request.range.from.getTime();
      const to = request.range.to.getTime();
      return {
        data: [
          createDataFrame({
            refId: target?.refId ?? "A",
            name: "grafana",
            fields: [
              { name: "Time", type: "time", values: [from, to] },
              { name: "Value", type: "number", values: [1, 1] }
            ]
          })
        ]
      };
    },
    async testDatasource() {
      return { status: "success", message: `${meta2.name} datasource OK` };
    },
    async metricFindQuery(query) {
      const q = String(query ?? "");
      return [
        { text: "A", value: "A" },
        { text: "B", value: "B" },
        { text: q || "all", value: q || "all" }
      ];
    },
    async annotationQuery(options) {
      const from = options.range.from.getTime();
      const to = options.range.to.getTime();
      const n = 5;
      return createDataFrame({
        name: String(options.annotation.name ?? "annotations"),
        fields: [
          {
            name: "time",
            type: "time",
            values: Array.from({ length: n }, (_, i) => from + (to - from) * i / n)
          },
          {
            name: "text",
            type: "string",
            values: Array.from({ length: n }, (_, i) => `${meta2.name} event ${i}`)
          },
          {
            name: "tags",
            type: "string",
            values: Array.from({ length: n }, () => "outage,deploy")
          }
        ]
      });
    }
  };
}
const _sfc_main$22 = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "grafana"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$21 = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "grafana"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$h = {
  id: "grafana",
  name: "Grafana",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$h,
  QueryEditor: _sfc_main$21,
  ConfigEditor: _sfc_main$22,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createGrafanaDataSource(instance, meta$h)
});
function timeSeries(query, range, name, valuesFn, opts) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const steps = Math.min(200, Math.max(20, Math.floor((to - from) / 6e4)));
  const times = [];
  const values = [];
  for (let i = 0; i < steps; i++) {
    times.push(from + (to - from) * i / Math.max(steps - 1, 1));
    values.push(valuesFn(i, steps));
  }
  const legend = String(query.legendFormat || query.label || "").trim();
  const labels = {
    job: "api",
    instance: "localhost:9090",
    ...{}
  };
  let display = name;
  if (legend) {
    display = legend.replaceAll(
      /\{\{\s*([a-z_]\w*)\s*\}\}/gi,
      (_, k) => labels[k] ?? ""
    );
  }
  if (!display || display === "Value" || /^Value\s*\{/.test(display)) {
    display = Object.entries(labels).map(([k, v]) => `${k}=${v}`).join(", ") || name || "series";
  }
  return createDataFrame({
    refId: query.refId,
    name: display,
    meta: opts?.meta,
    fields: [
      { name: "Time", type: "time", values: times },
      {
        name: "Value",
        type: "number",
        values,
        labels,
        config: { displayNameFromDS: display }
      }
    ]
  });
}
function generateTestDataScenario(query, range, name) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const q = query;
  const scenario = String(q.scenarioId ?? q.query ?? "random_walk");
  const alias = String(q.alias ?? name);
  const expr = String(
    query.expr ?? query.query ?? query.rawSql ?? query.target ?? ""
  );
  if (expr.includes("up") || scenario === "prometheus_like") {
    return timeSeries(
      query,
      range,
      alias || "prometheus",
      (i) => Math.sin(i / 3) * 20 + 50 + i * 0.1
    );
  }
  if (expr.includes("{") && expr.includes("}")) {
    const lines = Math.min(50, Number(query.maxLines ?? 30));
    return createDataFrame({
      refId: query.refId,
      name: "logs",
      fields: [
        {
          name: "Time",
          type: "time",
          values: Array.from({ length: lines }, (_, i) => from + i * 1e3)
        },
        {
          name: "Line",
          type: "string",
          values: Array.from({ length: lines }, (_, i) => {
            const level = i % 7 === 0 ? "error" : i % 5 === 0 ? "warn" : "info";
            return `${level} log line ${i} ${expr || scenario}`;
          })
        },
        {
          name: "level",
          type: "string",
          values: Array.from(
            { length: lines },
            (_, i) => i % 7 === 0 ? "error" : i % 5 === 0 ? "warn" : "info"
          )
        },
        {
          name: "labels",
          type: "other",
          values: Array.from({ length: lines }, () => ({ job: "varlogs" }))
        }
      ],
      meta: { preferredVisualisationType: "logs" }
    });
  }
  if (query.rawSql) {
    const table = String(q.table || q.dataset || alias || "table");
    const timeCol = String(q.timeColumn || q.timeField || "time");
    const format = String(q.format || "table").toLowerCase();
    const rows = 4;
    const times = Array.from(
      { length: rows },
      (_, i) => from + (to - from) * i / Math.max(rows - 1, 1)
    );
    return createDataFrame({
      refId: query.refId,
      name: table,
      meta: format === "time_series" ? { preferredVisualisationType: "graph" } : void 0,
      fields: [
        { name: timeCol, type: "time", values: times },
        {
          name: "value",
          type: "number",
          values: Array.from({ length: rows }, (_, i) => 10 + i * 20)
        }
      ]
    });
  }
  const seriesCount = Math.max(1, Math.min(20, Number(q.seriesCount ?? 1)));
  const noise = Number(q.noise ?? 0);
  const withNoise = (v, i) => v + (noise ? i * 17 % 10 * (noise / 10) : 0);
  if (scenario === "no_data") {
    return createDataFrame({
      refId: query.refId,
      name: alias || "no_data",
      fields: [
        { name: "Time", type: "time", values: [] },
        { name: "Value", type: "number", values: [] }
      ],
      meta: { noValue: true }
    });
  }
  if (scenario === "slow_query") {
    return timeSeries(
      query,
      range,
      alias || "slow",
      (i) => withNoise(Math.sin(i / 5) * 40 + 60, i)
    );
  }
  if (scenario === "csv_metric_values") {
    const raw = String(q.stringInput ?? "1,20,90,30,5,0");
    const nums = raw.split(/[\s,;]+/).map((s) => Number(s)).filter((n) => Number.isFinite(n));
    const vals = nums.length ? nums : [1, 20, 90, 30, 5, 0];
    const times = vals.map((_, i) => from + (to - from) * i / Math.max(vals.length - 1, 1));
    return createDataFrame({
      refId: query.refId,
      name: alias || "csv",
      fields: [
        { name: "Time", type: "time", values: times },
        { name: "Value", type: "number", values: vals }
      ]
    });
  }
  if (scenario === "logs") {
    const lines = Math.min(200, Math.max(10, Number(q.lines ?? 40)));
    return createDataFrame({
      refId: query.refId,
      name: "logs",
      fields: [
        {
          name: "Time",
          type: "time",
          values: Array.from({ length: lines }, (_, i) => from + i * 1500)
        },
        {
          name: "Line",
          type: "string",
          values: Array.from({ length: lines }, (_, i) => {
            const level = i % 7 === 0 ? "error" : i % 5 === 0 ? "warn" : "info";
            return `${level} testdata log line ${i}`;
          })
        },
        {
          name: "level",
          type: "string",
          values: Array.from(
            { length: lines },
            (_, i) => i % 7 === 0 ? "error" : i % 5 === 0 ? "warn" : "info"
          )
        },
        {
          name: "labels",
          type: "other",
          values: Array.from({ length: lines }, () => ({
            job: "testdata",
            filename: "/var/log/app.log"
          }))
        }
      ],
      meta: { preferredVisualisationType: "logs" }
    });
  }
  if (scenario === "trace") {
    const n = 10;
    return createDataFrame({
      refId: query.refId,
      name: "trace",
      fields: [
        {
          name: "traceID",
          type: "string",
          values: Array.from({ length: n }, () => "trace-demo")
        },
        {
          name: "spanID",
          type: "string",
          values: Array.from({ length: n }, (_, i) => `span-${i}`)
        },
        {
          name: "parentSpanID",
          type: "string",
          values: Array.from({ length: n }, (_, i) => i === 0 ? null : "span-0")
        },
        {
          name: "operationName",
          type: "string",
          values: Array.from(
            { length: n },
            (_, i) => i === 0 ? "HTTP GET /api" : `db.query.${i}`
          )
        },
        {
          name: "serviceName",
          type: "string",
          values: Array.from({ length: n }, (_, i) => ["gateway", "api", "db"][i % 3])
        },
        {
          name: "startTimeUnixNano",
          type: "number",
          values: Array.from({ length: n }, (_, i) => from * 1e6 + i * 1e7)
        },
        {
          name: "durationNano",
          type: "number",
          values: Array.from({ length: n }, (_, i) => i === 0 ? 5e8 : 1e7 + i * 2e6)
        },
        {
          name: "statusCode",
          type: "string",
          values: Array.from({ length: n }, (_, i) => i === 7 ? "ERROR" : "OK")
        }
      ],
      meta: { preferredVisualisationType: "trace" }
    });
  }
  if (scenario === "node_graph") {
    const nodes = ["A", "B", "C", "D", "E"];
    return createDataFrame({
      refId: query.refId,
      name: "nodes",
      fields: [
        { name: "id", type: "string", values: nodes },
        {
          name: "title",
          type: "string",
          values: nodes.map((n) => `Service ${n}`)
        },
        {
          name: "mainstat",
          type: "number",
          values: nodes.map((_, i) => 10 + i * 7)
        },
        {
          name: "secondarystat",
          type: "number",
          values: nodes.map((_, i) => 0.1 * i)
        },
        {
          name: "arc__success",
          type: "number",
          values: nodes.map((_, i) => 0.7 + i * 0.05)
        },
        {
          name: "arc__failed",
          type: "number",
          values: nodes.map((_, i) => 0.3 - i * 0.05)
        }
      ],
      meta: { preferredVisualisationType: "nodeGraph" }
    });
  }
  if (scenario === "flame_graph") {
    const n = 16;
    return createDataFrame({
      refId: query.refId,
      name: "flame",
      fields: [
        {
          name: "level",
          type: "number",
          values: Array.from({ length: n }, (_, i) => i % 5)
        },
        {
          name: "value",
          type: "number",
          values: Array.from({ length: n }, (_, i) => 1e3 - i * 40)
        },
        {
          name: "self",
          type: "number",
          values: Array.from({ length: n }, (_, i) => 20 + i % 7 * 5)
        },
        {
          name: "label",
          type: "string",
          values: Array.from({ length: n }, (_, i) => `fn_${i % 5}_block_${i}`)
        }
      ],
      meta: { preferredVisualisationType: "flamegraph" }
    });
  }
  if (scenario === "usa") {
    const states = ["CA", "TX", "NY", "FL", "WA", "IL", "PA", "OH"];
    return createDataFrame({
      refId: query.refId,
      name: alias || "usa",
      fields: [
        { name: "state", type: "string", values: states },
        {
          name: "value",
          type: "number",
          values: states.map((_, i) => 20 + i * 13 + i % 3 * 5)
        },
        {
          name: "lat",
          type: "number",
          values: [36.7, 31, 43, 27.8, 47.4, 40, 41.2, 40.4]
        },
        {
          name: "lon",
          type: "number",
          values: [-119.4, -99.9, -75.5, -81.7, -120.5, -89, -77.2, -82.8]
        }
      ]
    });
  }
  if (scenario === "linear_trend" || scenario === "steps") {
    const steps = Math.min(80, Math.max(20, Math.floor((to - from) / 6e4)));
    const xs = Array.from({ length: steps }, (_, i) => i);
    const ys = xs.map((i) => withNoise(Math.sin(i / 3) * 40 + 50 + i % 7, i));
    return createDataFrame({
      refId: query.refId,
      name: alias || "trend",
      fields: [
        { name: "x", type: "number", values: xs },
        {
          name: "y",
          type: "number",
          values: ys,
          config: { displayNameFromDS: alias || "y" }
        }
      ]
    });
  }
  if (scenario === "predictable_pulse") {
    return timeSeries(query, range, alias || "pulse", (i) => withNoise(i % 10 < 3 ? 100 : 0, i));
  }
  if (scenario === "predictable_csv_wave") {
    return timeSeries(
      query,
      range,
      alias || "wave",
      (i) => withNoise(Math.sin(i / 3) * 50 + 50, i)
    );
  }
  if (scenario === "random_walk" || scenario === "random_walk_table") {
    const spread = Number(q.spread ?? 0);
    const startValue = Number(q.startValue);
    const minV = q.min;
    const maxV = q.max;
    const dropPercent = Math.max(0, Math.min(100, Number(q.dropPercent ?? 0) || 0));
    const rawLabels = String(q.labels || "");
    const withLabels = q.withLabels !== false;
    const labelMap = {};
    if (withLabels && rawLabels) {
      for (const part of rawLabels.split(",")) {
        const [k, ...rest] = part.split("=");
        if (k && rest.length) labelMap[k.trim()] = rest.join("=").trim();
      }
    }
    const clamp2 = (v) => {
      let out = v;
      if (minV != null && minV !== "" && Number.isFinite(Number(minV)))
        out = Math.max(Number(minV), out);
      if (maxV != null && maxV !== "" && Number.isFinite(Number(maxV)))
        out = Math.min(Number(maxV), out);
      return out;
    };
    const drop = (v, i) => dropPercent > 0 && i * 17 % 100 < dropPercent ? null : v;
    if (seriesCount > 1) {
      const steps2 = Math.min(120, Math.max(20, Math.floor((to - from) / 6e4)));
      const times2 = Array.from(
        { length: steps2 },
        (_, i) => from + (to - from) * i / Math.max(steps2 - 1, 1)
      );
      const fields = [{ name: "Time", type: "time", values: times2 }];
      for (let s = 0; s < seriesCount; s++) {
        let acc2 = (Number.isFinite(startValue) ? startValue : 50) + s * 3;
        const vals2 = [];
        for (let i = 0; i < steps2; i++) {
          acc2 += Math.sin((i + s) / 4) * (2 + spread / 10) + (i + s) % 5 * 0.1;
          vals2.push(drop(clamp2(withNoise(acc2, i + s)), i + s));
        }
        fields.push({
          name: "Value",
          type: "number",
          values: vals2,
          labels: {
            series: String(s),
            name: `${alias || "walk"}-${s}`,
            ...labelMap
          },
          config: { displayNameFromDS: `${alias || "walk"}-${s}` }
        });
      }
      return createDataFrame({
        refId: query.refId,
        name: alias || "walk",
        meta: {
          custom: {
            scenario,
            spread,
            startValue: Number.isFinite(startValue) ? startValue : null,
            min: minV ?? null,
            max: maxV ?? null,
            dropPercent,
            labels: rawLabels || null
          }
        },
        fields
      });
    }
    let acc = Number.isFinite(startValue) ? startValue : 50;
    const steps = Math.min(120, Math.max(20, Math.floor((to - from) / 6e4)));
    const times = Array.from(
      { length: steps },
      (_, i) => from + (to - from) * i / Math.max(steps - 1, 1)
    );
    const vals = [];
    for (let i = 0; i < steps; i++) {
      acc += Math.sin(i / 4) * (2 + spread / 10) + i % 5 * 0.1;
      vals.push(drop(clamp2(withNoise(acc, i)), i));
    }
    return createDataFrame({
      refId: query.refId,
      name: alias || "walk",
      meta: {
        custom: {
          scenario,
          spread,
          startValue: Number.isFinite(startValue) ? startValue : null,
          min: minV ?? null,
          max: maxV ?? null,
          dropPercent,
          labels: rawLabels || null
        }
      },
      fields: [
        { name: "Time", type: "time", values: times },
        {
          name: "Value",
          type: "number",
          values: vals,
          labels: { job: "testdata", ...labelMap },
          config: { displayNameFromDS: alias || "walk" }
        }
      ]
    });
  }
  return timeSeries(query, range, alias, (i) => withNoise(Math.sin(i / 3) * 50 + 50 + i, i));
}
function createTestDataDataSource(instance, meta2) {
  return {
    uid: instance.uid,
    type: meta2.id,
    name: instance.name,
    capabilities: {
      signals: [
        meta2.metrics !== false ? "metrics" : null,
        meta2.logs ? "logs" : null,
        meta2.tracing ? "traces" : null
      ].filter(Boolean),
      query: true,
      health: true,
      metadata: true,
      variables: true,
      annotations: true,
      exemplars: false,
      streaming: false,
      queryLanguages: []
    },
    async query(request) {
      const targets = request.targets.filter((t2) => !t2.hide);
      if (targets.some((t2) => String(t2.scenarioId ?? "") === "slow_query")) {
        await new Promise((r) => setTimeout(r, 400));
      }
      return {
        data: targets.map((t2) => generateTestDataScenario(t2, request.range, instance.name))
      };
    },
    async testDatasource() {
      return {
        status: "success",
        message: `Data source offline fixture OK (${meta2.name})`
      };
    },
    async metricFindQuery(query) {
      const q = String(query ?? "");
      return [
        { text: "A", value: "A" },
        { text: "B", value: "B" },
        { text: q || "all", value: q || "all" }
      ];
    },
    async annotationQuery(options) {
      const from = options.range.from.getTime();
      const to = options.range.to.getTime();
      const n = 5;
      return createDataFrame({
        name: String(options.annotation.name ?? "annotations"),
        fields: [
          {
            name: "time",
            type: "time",
            values: Array.from({ length: n }, (_, i) => from + (to - from) * i / n)
          },
          {
            name: "text",
            type: "string",
            values: Array.from({ length: n }, (_, i) => `${meta2.name} event ${i}`)
          },
          {
            name: "tags",
            type: "string",
            values: Array.from({ length: n }, () => "outage,deploy")
          }
        ]
      });
    }
  };
}
const _sfc_main$20 = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(
        SharedConfigEditor,
        normalizeProps(guardReactiveProps(props)),
        null,
        16
        /* FULL_PROPS */
      );
    };
  }
});
const _sfc_main$1$ = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "grafana-testdata-datasource"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$g = {
  id: "grafana-testdata-datasource",
  name: "TestData",
  backend: true,
  metrics: true,
  logs: false
};
createDataSourcePlugin({
  meta: meta$g,
  QueryEditor: _sfc_main$1$,
  ConfigEditor: _sfc_main$20,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createTestDataDataSource(instance, meta$g)
});
const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(
        SharedConfigEditor,
        normalizeProps(guardReactiveProps(props)),
        null,
        16
        /* FULL_PROPS */
      );
    };
  }
});
const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "grafana-postgresql-datasource"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$f = {
  id: "grafana-postgresql-datasource",
  name: "PostgreSQL",
  backend: true,
  metrics: true,
  logs: false
};
createDataSourcePlugin({
  meta: meta$f,
  QueryEditor: _sfc_main$1Z,
  ConfigEditor: _sfc_main$1_,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$f)
});
const _sfc_main$1Y = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(
        SharedConfigEditor,
        normalizeProps(guardReactiveProps(props)),
        null,
        16
        /* FULL_PROPS */
      );
    };
  }
});
const _sfc_main$1X = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "mysql"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$e = {
  id: "mysql",
  name: "MySQL",
  backend: true,
  metrics: true,
  logs: false
};
createDataSourcePlugin({
  meta: meta$e,
  QueryEditor: _sfc_main$1X,
  ConfigEditor: _sfc_main$1Y,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$e)
});
const _sfc_main$1W = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "mssql"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1V = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "mssql"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$d = {
  id: "mssql",
  name: "Microsoft SQL Server",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$d,
  QueryEditor: _sfc_main$1V,
  ConfigEditor: _sfc_main$1W,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$d)
});
const _sfc_main$1U = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "influxdb"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1T = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "influxdb"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$c = {
  id: "influxdb",
  name: "InfluxDB",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$c,
  QueryEditor: _sfc_main$1T,
  ConfigEditor: _sfc_main$1U,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$c)
});
const _sfc_main$1S = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "graphite"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1R = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "graphite"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$b = {
  id: "graphite",
  name: "Graphite",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$b,
  QueryEditor: _sfc_main$1R,
  ConfigEditor: _sfc_main$1S,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$b)
});
const _sfc_main$1Q = {};
function _sfc_render$1(_ctx, _cache) {
  return openBlock(), createElementBlock("div", null, "Prometheus query editor (delegated to factory)");
}
const QueryEditor$3 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1Q, [["render", _sfc_render$1]]);
const _sfc_main$1P = {};
function _sfc_render(_ctx, _cache) {
  return openBlock(), createElementBlock("div", null, "Prometheus config editor (delegated to factory)");
}
const ConfigEditor$3 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1P, [["render", _sfc_render]]);
const meta$a = {
  id: "prometheus",
  name: "Prometheus",
  backend: true,
  metrics: true,
  logs: false,
  capabilities: PROMETHEUS_CAPABILITIES
};
registerPrometheusDataSourceFactory(
  (instance, pluginMeta) => createPrometheusDataSource(instance, pluginMeta)
);
createDataSourcePlugin({
  meta: meta$a,
  QueryEditor: QueryEditor$3,
  ConfigEditor: ConfigEditor$3,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createPrometheusDataSource(instance, meta$a)
});
const _sfc_main$1O = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "loki"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const _sfc_main$1N = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(
        SharedConfigEditor,
        normalizeProps(guardReactiveProps(props)),
        null,
        16
        /* FULL_PROPS */
      );
    };
  }
});
function nsToMs(ts) {
  const n = typeof ts === "string" ? Number(ts) : ts;
  if (!Number.isFinite(n)) return 0;
  if (n > 1e16) return Math.floor(n / 1e6);
  if (n > 1e12) return Math.floor(n);
  return Math.floor(n * 1e3);
}
function labelsFromStream(stream = {}) {
  const labels = {};
  for (const [k, v] of Object.entries(stream)) {
    if (k.startsWith("__")) continue;
    labels[k] = String(v);
  }
  return labels;
}
function mapLokiResponse(body, opts) {
  if (body?.status === "error" || body?.error) {
    throw new Error(body.error || body.errorType || "Loki query error");
  }
  const resultType = body?.data?.resultType ?? (isLokiMetricQuery(opts.expr || "") ? "matrix" : "streams");
  const result = body?.data?.result ?? [];
  if (resultType === "streams") {
    return mapStreams(result, opts);
  }
  if (resultType === "scalar" || resultType === "string") {
    const pair = Array.isArray(result) ? result : [0, result];
    const t2 = nsToMs(pair[0]);
    const v = resultType === "string" ? null : Number(pair[1]);
    return [
      createDataFrame({
        refId: opts.refId,
        name: opts.expr || "scalar",
        meta: {
          preferredVisualisationType: "table",
          resultType,
          custom: { stats: body?.data?.stats }
        },
        fields: [
          { name: "Time", type: "time", values: [t2] },
          {
            name: "Value",
            type: "number",
            values: [v],
            config: { displayNameFromDS: "Value" }
          }
        ]
      })
    ];
  }
  return result.map((series, idx) => {
    const metric = series.metric || series.stream || {};
    const labels = labelsFromStream(metric);
    const name = formatLokiLegend(opts.legendFormat || "", labels) || Object.values(labels).join(" ") || opts.expr || `series ${idx}`;
    let times = [];
    let values = [];
    if (resultType === "vector") {
      const rawT = series.value?.[0] ?? 0;
      times = [nsToMs(rawT)];
      const raw = series.value?.[1];
      values = [raw == null || raw === "NaN" ? null : Number(raw)];
    } else {
      const pts = series.values || [];
      times = pts.map((p) => nsToMs(p[0]));
      values = pts.map((p) => {
        const raw = p[1];
        if (raw == null || raw === "NaN") return null;
        if (raw === "+Inf") return Infinity;
        if (raw === "-Inf") return -Infinity;
        const n = Number(raw);
        return Number.isFinite(n) ? n : null;
      });
    }
    return createDataFrame({
      refId: opts.refId,
      name,
      meta: {
        resultType,
        preferredVisualisationType: "graph",
        custom: { stats: body?.data?.stats }
      },
      fields: [
        { name: "Time", type: "time", values: times },
        {
          name: "Value",
          type: "number",
          values,
          labels,
          config: { displayNameFromDS: name }
        }
      ]
    });
  });
}
function mapStreams(result, opts) {
  const maxLines = Math.max(1, opts.maxLines ?? 1e3);
  const times = [];
  const lines = [];
  const levels = [];
  const labelObjs = [];
  const idValues = [];
  for (const stream of result) {
    const labels = labelsFromStream(stream.stream || stream.metric || {});
    const entries = stream.values || [];
    for (const [ts, line] of entries) {
      if (times.length >= maxLines) break;
      times.push(nsToMs(ts));
      const text = String(line ?? "");
      lines.push(text);
      levels.push(inferLevel(text, labels));
      labelObjs.push(labels);
      idValues.push(`${ts}_${times.length}`);
    }
    if (times.length >= maxLines) break;
  }
  const order = times.map((_, i) => i).sort((a, b) => times[b] - times[a]);
  const pick = (arr) => order.map((i) => arr[i]);
  const labelKeys = /* @__PURE__ */ new Set();
  for (const l of labelObjs) {
    for (const k of Object.keys(l)) labelKeys.add(k);
  }
  const labelFields = [...labelKeys].slice(0, 12).map((k) => ({
    name: k,
    type: "string",
    values: pick(labelObjs.map((l) => l[k] ?? "")),
    config: {}
  }));
  return [
    createDataFrame({
      refId: opts.refId,
      name: "logs",
      meta: {
        preferredVisualisationType: "logs",
        searchWords: [],
        limit: maxLines
      },
      fields: [
        { name: "Time", type: "time", values: pick(times) },
        { name: "Line", type: "string", values: pick(lines) },
        { name: "labels", type: "other", values: pick(labelObjs) },
        { name: "id", type: "string", values: pick(idValues) },
        { name: "level", type: "string", values: pick(levels) },
        ...labelFields
      ]
    })
  ];
}
function inferLevel(line, labels) {
  if (labels.level) return String(labels.level).toLowerCase();
  if (labels.severity) return String(labels.severity).toLowerCase();
  const m = line.match(/\b(error|warn|warning|info|debug|critical|fatal)\b/i);
  if (m) {
    const l = m[1].toLowerCase();
    if (l === "warning") return "warn";
    return l;
  }
  return "unknown";
}
const LOKI_CAPABILITIES = {
  signals: ["logs", "metrics"],
  query: true,
  health: true,
  metadata: true,
  variables: true,
  annotations: true,
  exemplars: false,
  streaming: false,
  queryLanguages: ["logql"]
};
function baseUrlOf$1(instance) {
  return String(instance.url || instance.jsonData?.url || "").replace(/\/$/, "");
}
function buildLokiOfflineMetricFrames(q, range, maxDataPoints = 50) {
  const from = range.from.getTime();
  const to = range.to.getTime();
  const steps = Math.min(maxDataPoints, Math.max(12, Math.floor((to - from) / 6e4)));
  const by = extractByLabels(q.expr);
  const seriesDefs = [];
  if (by.includes("status") || /status/i.test(q.expr)) {
    for (const status of ["200", "301", "304", "404", "500"]) {
      seriesDefs.push({ status });
    }
  } else if (by.includes("request_uri") || by.includes("http_referer") || by.includes("http_user_agent")) {
    const key = by[0] || "request_uri";
    for (let i = 0; i < 5; i++) seriesDefs.push({ [key]: `/page-${i}` });
  } else if (by.includes("remote_addr")) {
    for (let i = 0; i < 5; i++) {
      seriesDefs.push({
        remote_addr: `10.0.0.${i + 1}`,
        geoip_country_code: i % 2 ? "US" : "NL"
      });
    }
  } else if (by.includes("geoip_country_code")) {
    for (const c of ["US", "NL", "DE", "JP", "BR"]) seriesDefs.push({ geoip_country_code: c });
  } else if (by.includes("host")) {
    seriesDefs.push({ host: "nginx-1" });
  } else if (by.length) {
    for (let i = 0; i < 3; i++) {
      const labels = {};
      for (const k of by) labels[k] = `${k}-${i}`;
      seriesDefs.push(labels);
    }
  } else {
    seriesDefs.push({ job: "nginx" });
  }
  return seriesDefs.map((labels, sIdx) => {
    const times = [];
    const values = [];
    for (let i = 0; i < steps; i++) {
      times.push(from + (to - from) * i / Math.max(steps - 1, 1));
      const base = 10 + sIdx * 7 + i % 5 * 3;
      values.push(q.instant ? base * steps : base + Math.sin(i / 3 + sIdx) * 5);
    }
    const name = formatLokiLegend(q.legendFormat || "", labels) || Object.values(labels).join(" ") || q.expr || `series ${sIdx}`;
    if (q.instant) {
      return createDataFrame({
        refId: q.refId,
        name,
        meta: { resultType: "vector", preferredVisualisationType: "table" },
        fields: [
          { name: "Time", type: "time", values: [to] },
          {
            name: "Value",
            type: "number",
            values: [values.reduce((a, b) => a + b, 0)],
            labels,
            config: { displayNameFromDS: name }
          },
          ...Object.entries(labels).map(([k, v]) => ({
            name: k,
            type: "string",
            values: [v],
            config: {}
          }))
        ]
      });
    }
    return createDataFrame({
      refId: q.refId,
      name,
      meta: { resultType: "matrix", preferredVisualisationType: "graph" },
      fields: [
        { name: "Time", type: "time", values: times },
        {
          name: "Value",
          type: "number",
          values,
          labels,
          config: { displayNameFromDS: name }
        }
      ]
    });
  });
}
function createLokiDataSource(instance, meta2) {
  const fallback = createBuiltinDataSourceApi(instance, meta2);
  const url = baseUrlOf$1(instance);
  return {
    uid: instance.uid,
    type: instance.type || meta2.id,
    name: instance.name,
    capabilities: LOKI_CAPABILITIES,
    async query(request, signal) {
      const targets = request.targets.filter((t2) => !t2.hide);
      if (getBackendMode() === "offline") {
        const frames2 = [];
        for (const raw of targets) {
          const q = normalizeLokiQuery({ ...raw, refId: raw.refId });
          if (!q.expr?.trim()) continue;
          if (isLokiMetricQuery(q.expr)) {
            frames2.push(
              ...buildLokiOfflineMetricFrames(q, request.range, request.maxDataPoints ?? 50)
            );
          } else {
            const res = await fallback.query({
              ...request,
              targets: [q]
            });
            frames2.push(...res.data);
          }
        }
        return {
          data: frames2.length ? frames2 : (await fallback.query(request)).data
        };
      }
      if (!url) {
        throw new DataSourceError("INVALID_RESPONSE", "Datasource URL is empty");
      }
      const from = request.range.from.getTime();
      const to = request.range.to.getTime();
      const rangeMs2 = Math.max(1, to - from);
      const dsMinIntervalMs = Number(instance.jsonData?.timeIntervalMs) || (typeof instance.jsonData?.timeInterval === "string" ? parseDurationMs$1(String(instance.jsonData.timeInterval)) : 0) || 0;
      const cred = await getRuntimeCredential(instance.uid);
      const frames = [];
      const errors = [];
      await Promise.all(
        targets.map(async (raw) => {
          const q = normalizeLokiQuery({ ...raw, refId: raw.refId });
          if (!q.expr?.trim()) return;
          const stepMs = computeStepMs({
            rangeMs: rangeMs2,
            maxDataPoints: request.maxDataPoints,
            intervalMs: request.intervalMs,
            minIntervalMs: dsMinIntervalMs || void 0,
            step: q.step,
            intervalFactor: q.resolution
          });
          const stepSec = Math.max(1, Math.floor(stepMs / 1e3));
          const expr = interpolatePromMacros(q.expr, {
            rangeMs: rangeMs2,
            intervalMs: stepMs,
            interpolate: (s) => s
          });
          const wireExpr = isLokiMetricQuery(expr) ? expr : applyLokiPipelineOpsPreference(expr, q.includePipelineOps !== false);
          try {
            const metric = isLokiMetricQuery(expr);
            const instant = q.instant && !q.range;
            const path = instant ? "/loki/api/v1/query" : "/loki/api/v1/query_range";
            const cacheTimeout = request.cacheTimeout != null && String(request.cacheTimeout).trim() !== "" ? String(request.cacheTimeout).trim() : void 0;
            const query = instant ? {
              query: wireExpr,
              time: String(to * 1e6),
              // ns
              limit: String(q.maxLines ?? 1e3),
              direction: q.direction ?? "backward",
              ...cacheTimeout ? { cacheTimeout } : {}
            } : {
              query: wireExpr,
              start: String(from * 1e6),
              end: String(to * 1e6),
              limit: String(q.maxLines ?? 1e3),
              direction: q.direction ?? "backward",
              ...cacheTimeout ? { cacheTimeout } : {}
            };
            if (!instant && metric) {
              query.step = `${stepSec}s`;
            }
            const method = String(instance.jsonData?.httpMethod || "GET").toUpperCase() === "POST" ? "POST" : "GET";
            const res = await datasourceHttp({
              baseUrl: url,
              path,
              method,
              query: method === "GET" ? query : void 0,
              body: method === "POST" ? query : void 0,
              uid: instance.uid,
              credential: cred,
              signal,
              timeoutMs: Number(instance.jsonData?.timeout) || 6e4
            });
            const mapped = mapLokiResponse(res.data, {
              refId: q.refId,
              legendFormat: q.legendFormat,
              expr: q.expr,
              maxLines: q.maxLines
            });
            frames.push(...normalizeDataFrames(mapped, { refId: q.refId }));
          } catch (error) {
            const msg = error instanceof DataSourceError ? error.message : error instanceof Error ? error.message : String(error);
            errors.push(`${q.refId}: ${msg}`);
            frames.push(
              ...normalizeDataFrames(
                [
                  {
                    refId: q.refId,
                    name: "error",
                    length: 0,
                    fields: [],
                    meta: { error: msg }
                  }
                ],
                { refId: q.refId }
              )
            );
          }
        })
      );
      if (!frames.length && errors.length) {
        throw new DataSourceError("INVALID_RESPONSE", errors.join("; "));
      }
      return { data: frames };
    },
    async testDatasource(signal) {
      if (getBackendMode() === "offline") {
        return fallback.testDatasource?.() ?? {
          status: "success",
          message: "Offline fixture OK"
        };
      }
      if (!url) return { status: "error", message: "Datasource URL is empty" };
      try {
        await datasourceHttp({
          baseUrl: url,
          path: "/ready",
          method: "GET",
          uid: instance.uid,
          signal,
          timeoutMs: 1e4
        });
        return { status: "success", message: "Loki is ready" };
      } catch {
        try {
          await datasourceHttp({
            baseUrl: url,
            path: "/loki/api/v1/labels",
            method: "GET",
            uid: instance.uid,
            signal,
            timeoutMs: 1e4
          });
          return { status: "success", message: "Loki API reachable" };
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          return { status: "error", message: msg };
        }
      }
    },
    async metricFindQuery(query, signal) {
      if (getBackendMode() === "offline") {
        return fallback.metricFindQuery?.(query) ?? [];
      }
      const q = String(query ?? "").trim();
      if (/^label_names\s*\(\s*\)\s*$/i.test(q) || q === "label_names()") {
        const res2 = await datasourceHttp({
          baseUrl: url,
          path: "/loki/api/v1/labels",
          uid: instance.uid,
          signal
        });
        return (res2.data?.data ?? []).map((v) => ({ text: v, value: v }));
      }
      const lv = q.match(/label_values\s*\(\s*(?:\{[^}]*\}\s*,\s*)?([a-z_]\w*)\s*\)/i) || q.match(/label_values\s*\(\s*\$?[a-z_]\w*\s*\)/i);
      if (lv || /label_values/i.test(q)) {
        const labelMatch = q.match(/label_values\s*\(\s*(?:.+,\s*)?([a-z_]\w*)\s*\)/i);
        const label = labelMatch?.[1] || "job";
        if (label === "label_name" || label.startsWith("$")) {
          return [];
        }
        const res2 = await datasourceHttp({
          baseUrl: url,
          path: `/loki/api/v1/label/${encodeURIComponent(label)}/values`,
          uid: instance.uid,
          signal
        });
        return (res2.data?.data ?? []).map((v) => ({ text: v, value: v }));
      }
      const res = await datasourceHttp({
        baseUrl: url,
        path: "/loki/api/v1/labels",
        uid: instance.uid,
        signal
      });
      return (res.data?.data ?? []).map((v) => ({ text: v, value: v }));
    }
  };
}
const meta$9 = {
  id: "loki",
  name: "Loki",
  backend: true,
  metrics: true,
  logs: true,
  capabilities: LOKI_CAPABILITIES
};
createDataSourcePlugin({
  meta: meta$9,
  QueryEditor: _sfc_main$1O,
  ConfigEditor: _sfc_main$1N,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createLokiDataSource(instance, meta$9)
});
const _sfc_main$1M = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "jaeger"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1L = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "jaeger"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$8 = {
  id: "jaeger",
  name: "Jaeger",
  backend: true,
  metrics: false,
  logs: false,
  tracing: true
};
createDataSourcePlugin({
  meta: meta$8,
  QueryEditor: _sfc_main$1L,
  ConfigEditor: _sfc_main$1M,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$8)
});
function mapTempoTraceResponse(body, opts) {
  if (body?.batches || body?.resourceSpans) {
    return [mapOtlp(body, opts)];
  }
  if (body?.data) return mapTempoTraceResponse(body.data, opts);
  if (body?.spans || body?.processes || Array.isArray(body)) {
    return [mapJaegerLike(body, opts)];
  }
  if (body?.traces || body?.traceSummaries) {
    return [mapSearch(body, opts)];
  }
  return [
    createDataFrame({
      refId: opts.refId,
      name: "trace",
      meta: { preferredVisualisationType: "trace" },
      fields: [
        { name: "traceID", type: "string", values: [opts.traceId || ""] },
        { name: "spanID", type: "string", values: [] },
        { name: "operationName", type: "string", values: [] },
        { name: "serviceName", type: "string", values: [] },
        { name: "startTimeUnixNano", type: "number", values: [] },
        { name: "durationNano", type: "number", values: [] }
      ]
    })
  ];
}
function mapSearch(body, opts) {
  const traces = body.traces || body.traceSummaries || [];
  return createDataFrame({
    refId: opts.refId,
    name: "trace-search",
    meta: { preferredVisualisationType: "table" },
    fields: [
      {
        name: "traceID",
        type: "string",
        values: traces.map((t2) => t2.traceID || t2.traceId || t2.rootTraceId || "")
      },
      {
        name: "rootServiceName",
        type: "string",
        values: traces.map((t2) => t2.rootServiceName || t2.serviceName || "")
      },
      {
        name: "rootTraceName",
        type: "string",
        values: traces.map((t2) => t2.rootTraceName || t2.rootServiceName || t2.name || "")
      },
      {
        name: "durationMs",
        type: "number",
        values: traces.map((t2) => {
          const d = t2.durationMs ?? t2.durationMs ?? (t2.duration ? Number(t2.duration) / 1e6 : null);
          return d;
        })
      },
      {
        name: "startTime",
        type: "time",
        values: traces.map((t2) => {
          const s = t2.startTimeUnixNano || t2.startTime || 0;
          const n = Number(s);
          return n > 1e15 ? Math.floor(n / 1e6) : n > 1e12 ? n : n * 1e3;
        })
      }
    ]
  });
}
function mapJaegerLike(body, opts) {
  const spans = Array.isArray(body) ? body : body.spans || [];
  const processes = body.processes || {};
  const spanIDs = [];
  const parents = [];
  const ops = [];
  const svcs = [];
  const starts = [];
  const durs = [];
  const status = [];
  const traceIds = [];
  for (const s of spans) {
    spanIDs.push(String(s.spanID || s.spanId || s.span_id || ""));
    const refs = s.references || s.refs || [];
    const pref = refs.find((r) => r.refType === "CHILD_OF" || r.refType === "CHILD_OF") || refs[0];
    parents.push(pref ? String(pref.spanID || pref.spanId || null) : s.parentSpanId || null);
    ops.push(String(s.operationName || s.name || s.operation_name || ""));
    const proc = s.process || processes[s.processID] || {};
    svcs.push(String(proc.serviceName || s.serviceName || s.service_name || "unknown"));
    const st = Number(s.startTime || s.startTimeUnixNano || s.startTimeUnixNano || 0);
    starts.push(st > 1e15 ? st : st > 1e12 ? st * 1e3 : st * 1e3);
    const d = Number(s.duration || s.durationNano || 0);
    durs.push(d > 1e9 ? d : d * 1e3);
    const tags = s.tags || s.attributes || [];
    const err = Array.isArray(tags) ? tags.find(
      (t2) => (t2.key === "error" || t2.key === "otel.status_code") && (t2.value === true || t2.value === "ERROR")
    ) : null;
    status.push(err ? "ERROR" : "OK");
    traceIds.push(String(s.traceID || s.traceId || opts.traceId || body.traceID || ""));
  }
  return createDataFrame({
    refId: opts.refId,
    name: "trace",
    meta: { preferredVisualisationType: "trace", traceId: opts.traceId },
    fields: [
      { name: "traceID", type: "string", values: traceIds },
      { name: "spanID", type: "string", values: spanIDs },
      { name: "parentSpanID", type: "string", values: parents },
      { name: "operationName", type: "string", values: ops },
      { name: "serviceName", type: "string", values: svcs },
      { name: "startTimeUnixNano", type: "number", values: starts },
      { name: "durationNano", type: "number", values: durs },
      { name: "statusCode", type: "string", values: status }
    ]
  });
}
function mapOtlp(body, opts) {
  const batches = body.batches || body.resourceSpans || [];
  const spanIDs = [];
  const parents = [];
  const ops = [];
  const svcs = [];
  const starts = [];
  const durs = [];
  const status = [];
  const traceIds = [];
  for (const batch of batches) {
    const res = batch.resource || {};
    const attrs = res.attributes || [];
    const svcAttr = Array.isArray(attrs) ? attrs.find((a) => a.key === "service.name") : null;
    const service = svcAttr?.value?.stringValue || svcAttr?.value || res["service.name"] || "unknown";
    const scopeSpans = batch.scopeSpans || batch.instrumentationLibrarySpans || batch.spans || [];
    for (const scope of scopeSpans) {
      const spans = scope.spans || (scope.spanID ? [scope] : []);
      for (const s of spans) {
        spanIDs.push(String(s.spanId || s.spanID || ""));
        parents.push(s.parentSpanId || s.parentSpanID || null);
        ops.push(String(s.name || s.operationName || ""));
        svcs.push(String(service));
        starts.push(Number(s.startTimeUnixNano || 0));
        const end = Number(s.endTimeUnixNano || 0);
        const start = Number(s.startTimeUnixNano || 0);
        durs.push(end && start ? end - start : Number(s.durationNano || 0));
        status.push(String(s.status?.code || s.status?.message || "OK"));
        traceIds.push(String(s.traceId || s.traceID || opts.traceId || ""));
      }
    }
  }
  return createDataFrame({
    refId: opts.refId,
    name: "trace",
    meta: { preferredVisualisationType: "trace", traceId: opts.traceId },
    fields: [
      { name: "traceID", type: "string", values: traceIds },
      { name: "spanID", type: "string", values: spanIDs },
      { name: "parentSpanID", type: "string", values: parents },
      { name: "operationName", type: "string", values: ops },
      { name: "serviceName", type: "string", values: svcs },
      { name: "startTimeUnixNano", type: "number", values: starts },
      { name: "durationNano", type: "number", values: durs },
      { name: "statusCode", type: "string", values: status }
    ]
  });
}
const TEMPO_CAPABILITIES = {
  signals: ["traces"],
  query: true,
  health: true,
  metadata: true,
  variables: false,
  annotations: false,
  exemplars: false,
  streaming: false,
  queryLanguages: ["traceql", "trace-id"]
};
function baseUrlOf(instance) {
  return String(instance.url || instance.jsonData?.url || "").replace(/\/$/, "");
}
function offlineTraceFrame(refId, traceId = "offline-trace") {
  const n = 6;
  return createDataFrame({
    refId,
    name: "trace",
    meta: { preferredVisualisationType: "trace", traceId },
    fields: [
      { name: "traceID", type: "string", values: new Array(n).fill(traceId) },
      {
        name: "spanID",
        type: "string",
        values: Array.from({ length: n }, (_, i) => `span-${i}`)
      },
      {
        name: "parentSpanID",
        type: "string",
        values: Array.from({ length: n }, (_, i) => i === 0 ? null : "span-0")
      },
      {
        name: "operationName",
        type: "string",
        values: Array.from({ length: n }, (_, i) => i === 0 ? "HTTP GET" : `op-${i}`)
      },
      {
        name: "serviceName",
        type: "string",
        values: Array.from({ length: n }, (_, i) => `svc-${i % 3}`)
      },
      {
        name: "startTimeUnixNano",
        type: "number",
        values: Array.from({ length: n }, (_, i) => 1e15 + i * 1e7)
      },
      {
        name: "durationNano",
        type: "number",
        values: Array.from({ length: n }, (_, i) => i === 0 ? 1e8 : 2e7 + i * 1e6)
      },
      {
        name: "statusCode",
        type: "string",
        values: Array.from({ length: n }, (_, i) => i === 4 ? "ERROR" : "OK")
      }
    ]
  });
}
function parseStepSec(step) {
  const s = String(step ?? "").trim();
  if (!s) return 15;
  const m = s.match(/^(\d+(?:\.\d+)?)(ms|[smh])?$/i);
  if (!m) {
    const n = Number(s);
    return Number.isFinite(n) && n > 0 ? n : 15;
  }
  const v = Number(m[1]);
  const u = (m[2] || "s").toLowerCase();
  if (u === "ms") return Math.max(1e-3, v / 1e3);
  if (u === "m") return v * 60;
  if (u === "h") return v * 3600;
  return v;
}
function offlineServiceMapFrame(refId, opts = {}) {
  const step = String(opts.step ?? "15s").trim() || "15s";
  const stepSec = parseStepSec(step);
  const linked = opts.linkedUid?.trim() || void 0;
  return createDataFrame({
    refId,
    name: "serviceMap",
    meta: {
      preferredVisualisationType: "nodeGraph",
      custom: {
        queryType: "serviceMap",
        serviceMapDatasourceUid: linked ?? null,
        step,
        stepSec
      }
    },
    fields: [
      {
        name: "id",
        type: "string",
        values: linked ? [linked] : ["tempo-service-map"]
      },
      {
        name: "title",
        type: "string",
        values: linked ? [`service-map:${linked}`] : ["Service Map"]
      },
      {
        name: "mainstat",
        type: "number",
        values: [stepSec]
      }
    ]
  });
}
function createTempoDataSource(instance, meta2) {
  const fallback = createBuiltinDataSourceApi(instance, meta2);
  const url = baseUrlOf(instance);
  async function listSearchTags(signal) {
    if (getBackendMode() === "offline") {
      return ["service.name", "http.method", "http.status_code", "span.kind"].map((t2) => ({
        text: t2,
        value: t2
      }));
    }
    if (!url) return [];
    return metadataCacheLoad(instance.uid, "tempo:tags", async () => {
      const cred = await getRuntimeCredential(instance.uid);
      try {
        const res = await datasourceHttp({
          baseUrl: url,
          path: "/api/search/tags",
          method: "GET",
          uid: instance.uid,
          credential: cred,
          signal
        });
        const tags = res.data?.tagNames || res.data?.tags || res.data || [];
        const arr = Array.isArray(tags) ? tags : [];
        return arr.map((t2) => {
          const name = typeof t2 === "string" ? t2 : String(t2);
          return { text: name, value: name };
        });
      } catch {
        return [];
      }
    });
  }
  async function listTagValues(tag, signal) {
    if (!tag) return [];
    if (getBackendMode() === "offline") {
      if (tag === "service.name") {
        return ["frontend", "api", "checkout"].map((v) => ({
          text: v,
          value: v
        }));
      }
      return [];
    }
    if (!url) return [];
    return metadataCacheLoad(
      instance.uid,
      `tempo:tagValues:${tag}`,
      async () => {
        const cred = await getRuntimeCredential(instance.uid);
        try {
          const res = await datasourceHttp({
            baseUrl: url,
            path: `/api/search/tag/${encodeURIComponent(tag)}/values`,
            method: "GET",
            uid: instance.uid,
            credential: cred,
            signal
          });
          const vals = res.data?.tagValues || res.data?.values || res.data || [];
          const arr = Array.isArray(vals) ? vals : [];
          return arr.map((v) => {
            const name = typeof v === "string" ? v : String(v);
            return { text: name, value: name };
          });
        } catch {
          return [];
        }
      },
      3e4
    );
  }
  return {
    uid: instance.uid,
    type: instance.type || meta2.id,
    name: instance.name,
    capabilities: TEMPO_CAPABILITIES,
    async query(request, signal) {
      const targets = request.targets.filter((t2) => !t2.hide);
      if (getBackendMode() === "offline") {
        return {
          data: targets.map((t2) => {
            const q = t2;
            const qt = String(
              q.queryType || (q.traceId || looksLikeTraceId(q.query) ? "traceId" : "search")
            );
            if (qt === "serviceMap") {
              const linked = String(
                instance.jsonData?.serviceMap?.datasourceUid || instance.jsonData?.serviceMapDatasourceUid || ""
              ).trim();
              return offlineServiceMapFrame(t2.refId, {
                linkedUid: linked || void 0,
                step: q.step != null ? String(q.step) : void 0
              });
            }
            return offlineTraceFrame(t2.refId, String(q.query || q.traceId || "offline-trace"));
          })
        };
      }
      if (!url) {
        throw new DataSourceError("INVALID_RESPONSE", "Datasource URL is empty");
      }
      const cred = await getRuntimeCredential(instance.uid);
      const frames = [];
      const errors = [];
      const from = request.range.from.getTime();
      const to = request.range.to.getTime();
      await Promise.all(
        targets.map(async (raw) => {
          const q = raw;
          const queryType = String(
            q.queryType || (q.traceId || looksLikeTraceId(q.query) ? "traceId" : "search")
          );
          const traceId = String(
            q.traceId || (looksLikeTraceId(q.query) ? q.query : "") || ""
          ).trim();
          try {
            if (queryType === "traceId" || traceId && !q.search) {
              if (!traceId) throw new DataSourceError("INVALID_RESPONSE", "traceId required");
              const res = await datasourceHttp({
                baseUrl: url,
                path: `/api/traces/${encodeURIComponent(traceId)}`,
                method: "GET",
                uid: instance.uid,
                credential: cred,
                signal,
                timeoutMs: 3e4
              });
              const mapped = mapTempoTraceResponse(res.data, {
                refId: q.refId,
                traceId
              });
              frames.push(...normalizeDataFrames(mapped, { refId: q.refId }));
            } else if (queryType === "serviceMap") {
              const linked = String(
                instance.jsonData?.serviceMap?.datasourceUid || instance.jsonData?.serviceMapDatasourceUid || ""
              ).trim() || void 0;
              const step = q.step != null && String(q.step).trim() !== "" ? String(q.step).trim() : "15s";
              const stepSec = parseStepSec(step);
              frames.push(
                ...normalizeDataFrames(
                  [
                    {
                      refId: q.refId,
                      name: "serviceMap",
                      meta: {
                        preferredVisualisationType: "nodeGraph",
                        custom: {
                          queryType: "serviceMap",
                          serviceMapDatasourceUid: linked ?? null,
                          step,
                          stepSec
                        }
                      },
                      fields: [
                        {
                          name: "id",
                          type: "string",
                          values: linked ? [linked] : ["tempo-service-map"]
                        },
                        {
                          name: "title",
                          type: "string",
                          values: linked ? [`service-map:${linked}`] : ["Service Map"]
                        },
                        {
                          name: "mainstat",
                          type: "number",
                          values: [stepSec]
                        }
                      ],
                      length: 1
                    }
                  ],
                  { refId: q.refId }
                )
              );
            } else {
              const searchQ = String(q.query || q.search || q.expr || q.tags || "{}");
              const cacheTimeout = request.cacheTimeout != null && String(request.cacheTimeout).trim() !== "" ? String(request.cacheTimeout).trim() : void 0;
              const minDuration = q.minDuration != null && String(q.minDuration).trim() !== "" ? String(q.minDuration).trim() : void 0;
              const maxDuration = q.maxDuration != null && String(q.maxDuration).trim() !== "" ? String(q.maxDuration).trim() : void 0;
              const res = await datasourceHttp({
                baseUrl: url,
                path: "/api/search",
                method: "GET",
                query: {
                  q: searchQ,
                  start: String(Math.floor(from * 1e3)),
                  // Tempo often expects µs or ns depending on version — send µs-ish
                  end: String(Math.floor(to * 1e3)),
                  limit: String(q.limit ?? 20),
                  ...minDuration ? { minDuration } : {},
                  ...maxDuration ? { maxDuration } : {},
                  ...cacheTimeout ? { cacheTimeout } : {}
                },
                uid: instance.uid,
                credential: cred,
                signal,
                timeoutMs: 3e4
              });
              const mapped = mapTempoTraceResponse(res.data, {
                refId: q.refId
              });
              frames.push(...normalizeDataFrames(mapped, { refId: q.refId }));
            }
          } catch (error) {
            const msg = error instanceof DataSourceError ? error.message : error instanceof Error ? error.message : String(error);
            errors.push(`${q.refId}: ${msg}`);
            frames.push(
              ...normalizeDataFrames(
                [
                  {
                    refId: q.refId,
                    name: "error",
                    length: 0,
                    fields: [],
                    meta: { error: msg }
                  }
                ],
                { refId: q.refId }
              )
            );
          }
        })
      );
      if (!frames.length && errors.length) {
        throw new DataSourceError("INVALID_RESPONSE", errors.join("; "));
      }
      return { data: frames };
    },
    async testDatasource(signal) {
      if (getBackendMode() === "offline") {
        return fallback.testDatasource?.() ?? {
          status: "success",
          message: "Offline Tempo OK"
        };
      }
      if (!url) return { status: "error", message: "Datasource URL is empty" };
      try {
        await datasourceHttp({
          baseUrl: url,
          path: "/ready",
          method: "GET",
          uid: instance.uid,
          signal,
          timeoutMs: 1e4
        });
        return { status: "success", message: "Tempo is ready" };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        return { status: "error", message: msg };
      }
    },
    listSearchTags,
    listTagValues,
    async metricFindQuery(query, signal) {
      const q = String(query ?? "").trim().toLowerCase();
      if (!q || q.includes("tag") || q.includes("label")) {
        return listSearchTags(signal);
      }
      if (q.includes("service")) {
        return listTagValues("service.name", signal);
      }
      return [];
    }
  };
}
function looksLikeTraceId(q) {
  const s = String(q ?? "").trim();
  return /^[a-f0-9]{16,32}$/i.test(s);
}
const meta$7 = {
  id: "tempo",
  name: "Tempo",
  tracing: true,
  backend: true,
  capabilities: TEMPO_CAPABILITIES
};
createDataSourcePlugin({
  meta: meta$7,
  QueryEditor: SharedQueryEditor,
  ConfigEditor: SharedConfigEditor,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createTempoDataSource(instance, meta$7)
});
const _sfc_main$1K = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "grafana-pyroscope-datasource"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1J = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "grafana-pyroscope-datasource"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$6 = {
  id: "grafana-pyroscope-datasource",
  name: "Pyroscope",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$6,
  QueryEditor: _sfc_main$1J,
  ConfigEditor: _sfc_main$1K,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$6)
});
const _sfc_main$1I = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "cloudwatch"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1H = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "cloudwatch"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$5 = {
  id: "cloudwatch",
  name: "CloudWatch",
  backend: true,
  metrics: true,
  logs: true,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$5,
  QueryEditor: _sfc_main$1H,
  ConfigEditor: _sfc_main$1I,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$5)
});
const _sfc_main$1G = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "grafana-azure-monitor-datasource"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1F = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "grafana-azure-monitor-datasource"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$4 = {
  id: "grafana-azure-monitor-datasource",
  name: "Azure Monitor",
  backend: true,
  metrics: true,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$4,
  QueryEditor: _sfc_main$1F,
  ConfigEditor: _sfc_main$1G,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$4)
});
const _sfc_main$1E = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...props.options,
      type: props.options?.type || "alertmanager"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedConfigEditor, {
        options: options.value,
        "on-options-change": props.onOptionsChange
      }, null, 8, ["options", "on-options-change"]);
    };
  }
});
const _sfc_main$1D = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const ds2 = computed(() => ({
      ...props.datasource,
      type: props.datasource?.type || "alertmanager"
    }));
    return (_ctx, _cache) => {
      return openBlock(), createBlock(SharedQueryEditor, {
        query: props.query,
        datasource: ds2.value,
        "on-change": props.onChange,
        "on-run-query": props.onRunQuery,
        range: props.range,
        data: props.data
      }, null, 8, ["query", "datasource", "on-change", "on-run-query", "range", "data"]);
    };
  }
});
const meta$3 = {
  id: "alertmanager",
  name: "Alertmanager",
  backend: true,
  metrics: false,
  logs: false,
  tracing: false
};
createDataSourcePlugin({
  meta: meta$3,
  QueryEditor: _sfc_main$1D,
  ConfigEditor: _sfc_main$1E,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createBuiltinDataSourceApi(instance, meta$3)
});
const _hoisted_1$1y = {
  class: "otel-qe",
  "data-testid": "query-editor-opentelemetry"
};
const _hoisted_2$1f = {
  key: 0,
  class: "err"
};
const _hoisted_3$13 = { class: "row" };
const _hoisted_4$S = { class: "row" };
const _hoisted_5$J = {
  key: 1,
  class: "row",
  "data-testid": "otel-metric-browser"
};
const _hoisted_6$F = {
  key: 2,
  class: "row",
  "data-testid": "otel-service-browser"
};
const _hoisted_7$y = {
  key: 3,
  class: "row",
  "data-testid": "otel-tag-browser"
};
const _hoisted_8$t = { class: "row" };
const _hoisted_9$s = { class: "row" };
const _hoisted_10$n = { class: "row" };
const _sfc_main$1C = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {},
    datasourceApi: {}
  },
  setup(__props) {
    const props = __props;
    const signal = computed({
      get: () => String(props.query.signal || "metrics"),
      set: (v) => props.onChange({ ...props.query, signal: v })
    });
    const expr = computed({
      get: () => String(props.query.expr || props.query.query || ""),
      set: (v) => props.onChange({ ...props.query, expr: v, query: v })
    });
    const provider2 = computed({
      get: () => String(props.query.provider || ""),
      set: (v) => props.onChange({ ...props.query, provider: v })
    });
    const service = computed({
      get: () => String(props.query.service || ""),
      set: (v) => props.onChange({ ...props.query, service: v })
    });
    const maxLines = computed({
      get: () => String(props.query.maxLines ?? props.query.limit ?? ""),
      set: (v) => {
        const n = v === "" ? void 0 : Number(v);
        props.onChange({
          ...props.query,
          maxLines: Number.isFinite(n) ? n : void 0,
          limit: Number.isFinite(n) ? n : void 0
        });
      }
    });
    const signalOptions = [
      { label: "Metrics", value: "metrics" },
      { label: "Logs", value: "logs" },
      { label: "Traces", value: "traces" }
    ];
    const providerHint = computed(() => {
      if (signal.value === "metrics") return "prometheus";
      if (signal.value === "logs") return "loki | signoz";
      return "tempo | jaeger | signoz";
    });
    const services = ref([]);
    const metrics = ref([]);
    const tags = ref([]);
    const metaError = ref("");
    const metaLoading = ref(false);
    async function loadMeta() {
      metaLoading.value = true;
      metaError.value = "";
      try {
        const api = props.datasourceApi;
        if (signal.value === "metrics") {
          if (typeof api?.listMetricNames === "function") {
            const names = await api.listMetricNames();
            metrics.value = (names || []).map((n) => ({
              label: n,
              value: n
            }));
          } else {
            metrics.value = [
              { label: "up", value: "up" },
              { label: "http_requests_total", value: "http_requests_total" }
            ];
          }
        } else if (signal.value === "traces") {
          if (typeof api?.listSearchTags === "function") {
            const rows = await api.listSearchTags();
            tags.value = (rows || []).map((r) => ({
              label: String(r.text ?? r.value ?? r),
              value: String(r.value ?? r.text ?? r)
            }));
          } else {
            tags.value = [
              { label: "service.name", value: "service.name" },
              { label: "http.method", value: "http.method" }
            ];
          }
          if (typeof api?.listServices === "function") {
            const rows = await api.listServices();
            services.value = (rows || []).map((r) => ({
              label: String(r.text ?? r.value ?? r),
              value: String(r.value ?? r.text ?? r)
            }));
          } else if (typeof api?.listTagValues === "function") {
            const rows = await api.listTagValues("service.name");
            services.value = (rows || []).map((r) => ({
              label: String(r.text ?? r.value ?? r),
              value: String(r.value ?? r.text ?? r)
            }));
          } else {
            services.value = [
              { label: "frontend", value: "frontend" },
              { label: "api", value: "api" }
            ];
          }
        } else {
          if (typeof api?.listServices === "function") {
            const rows = await api.listServices();
            services.value = (rows || []).map((r) => ({
              label: String(r.text ?? r.value ?? r),
              value: String(r.value ?? r.text ?? r)
            }));
          } else {
            services.value = [
              { label: "frontend", value: "frontend" },
              { label: "api", value: "api" }
            ];
          }
        }
      } catch (error) {
        metaError.value = error instanceof Error ? error.message : String(error);
      } finally {
        metaLoading.value = false;
      }
    }
    function insertTag(v) {
      const t2 = String(v ?? "");
      if (t2 && !expr.value.trim()) {
        expr.value = `{ ${t2} = "" }`;
      }
    }
    function insertMetric(v) {
      const m = String(v ?? "");
      if (m) expr.value = m;
    }
    function pickService(v) {
      const s = String(v ?? "");
      service.value = s;
      if (signal.value === "traces" && s && !expr.value.trim()) {
        expr.value = `{ resource.service.name = "${s}" }`;
      }
    }
    onMounted(loadMeta);
    watch(signal, () => {
      void loadMeta();
    });
    watch(
      () => props.datasourceApi,
      () => {
        void loadMeta();
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1y, [
        metaError.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_2$1f,
          toDisplayString(metaError.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_3$13, [
          _cache[6] || (_cache[6] = createElementVNode(
            "label",
            null,
            "Signal",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            modelValue: signal.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => signal.value = $event),
            options: signalOptions,
            "test-id": "otel-signal"
          }, null, 8, ["modelValue"])
        ]),
        createElementVNode("div", _hoisted_4$S, [
          _cache[7] || (_cache[7] = createElementVNode(
            "label",
            null,
            "Provider 覆盖（可选）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            modelValue: provider2.value,
            "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => provider2.value = $event),
            placeholder: providerHint.value,
            "test-id": "otel-provider"
          }, null, 8, ["modelValue", "placeholder"])
        ]),
        signal.value === "metrics" ? (openBlock(), createElementBlock("div", _hoisted_5$J, [
          _cache[8] || (_cache[8] = createElementVNode(
            "label",
            null,
            "指标浏览器（预取）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            loading: metaLoading.value,
            options: metrics.value,
            placeholder: "选择指标插入 PromQL",
            "data-testid": "otel-metric-select",
            "onUpdate:value": insertMetric
          }, null, 8, ["loading", "options"])
        ])) : createCommentVNode("v-if", true),
        signal.value !== "metrics" ? (openBlock(), createElementBlock("div", _hoisted_6$F, [
          _cache[9] || (_cache[9] = createElementVNode(
            "label",
            null,
            "Service（预取）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            loading: metaLoading.value,
            value: service.value || void 0,
            options: services.value,
            placeholder: "service.name",
            "data-testid": "otel-service-select",
            "onUpdate:value": pickService
          }, null, 8, ["loading", "value", "options"])
        ])) : createCommentVNode("v-if", true),
        signal.value === "traces" && tags.value.length ? (openBlock(), createElementBlock("div", _hoisted_7$y, [
          _cache[10] || (_cache[10] = createElementVNode(
            "label",
            null,
            "Trace 标签",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            style: { "width": "100%" },
            "show-search": "",
            "allow-clear": "",
            loading: metaLoading.value,
            options: tags.value,
            placeholder: "Tempo 搜索标签",
            "data-testid": "otel-tag-select",
            "onUpdate:value": insertTag
          }, null, 8, ["loading", "options"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("div", _hoisted_8$t, [
          _cache[11] || (_cache[11] = createElementVNode(
            "label",
            null,
            "Service / Resource（可选）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            modelValue: service.value,
            "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => service.value = $event),
            placeholder: "service.name",
            "test-id": "otel-service"
          }, null, 8, ["modelValue"])
        ]),
        createElementVNode("div", _hoisted_9$s, [
          _cache[12] || (_cache[12] = createElementVNode(
            "label",
            null,
            "限制 / maxLines",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            modelValue: maxLines.value,
            "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => maxLines.value = $event),
            placeholder: "1000",
            "test-id": "otel-max-lines"
          }, null, 8, ["modelValue"])
        ]),
        createElementVNode("div", _hoisted_10$n, [
          createElementVNode(
            "label",
            null,
            toDisplayString(signal.value === "metrics" ? "PromQL" : signal.value === "logs" ? "LogQL" : "Trace 查询"),
            1
            /* TEXT */
          ),
          createVNode(unref(GInput), {
            modelValue: expr.value,
            "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => expr.value = $event),
            "test-id": "otel-expr"
          }, null, 8, ["modelValue"])
        ]),
        createVNode(unref(GButton), {
          size: "sm",
          variant: "primary",
          "test-id": "run-query",
          onClick: _cache[5] || (_cache[5] = ($event) => props.onRunQuery?.())
        }, {
          default: withCtx(() => [..._cache[13] || (_cache[13] = [
            createTextVNode(
              " 运行查询 ",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        }),
        _cache[14] || (_cache[14] = createElementVNode(
          "p",
          { class: "hint" },
          " OpenTelemetry 是查询聚合器，不是 OTLP 写入。请在数据源配置中设置 metricsUrl / logsUrl / tracesUrl。查询编辑器挂载时会预取指标/服务/标签。 ",
          -1
          /* CACHED */
        ))
      ]);
    };
  }
});
const QueryEditor$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1C, [["__scopeId", "data-v-e2045c44"]]);
const _hoisted_1$1x = {
  class: "otel-cfg",
  "data-testid": "config-editor-opentelemetry"
};
const _sfc_main$1B = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    function jd() {
      return { ...props.options?.jsonData || {} };
    }
    function patchJson(p) {
      const options = props.options;
      props.onOptionsChange({
        ...options,
        jsonData: { ...jd(), ...p }
      });
    }
    const defaultSignal = computed({
      get: () => String(jd().defaultSignal || "metrics"),
      set: (v) => patchJson({ defaultSignal: v })
    });
    const metricsUrl = computed({
      get: () => String(jd().metricsUrl || ""),
      set: (v) => patchJson({ metricsUrl: v })
    });
    const logsUrl = computed({
      get: () => String(jd().logsUrl || ""),
      set: (v) => patchJson({ logsUrl: v })
    });
    const tracesUrl = computed({
      get: () => String(jd().tracesUrl || ""),
      set: (v) => patchJson({ tracesUrl: v })
    });
    const tracesProvider = computed({
      get: () => String(jd().tracesProvider || "tempo"),
      set: (v) => patchJson({ tracesProvider: v })
    });
    const logsProvider = computed({
      get: () => String(jd().logsProvider || "loki"),
      set: (v) => patchJson({ logsProvider: v })
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1x, [
        _cache[6] || (_cache[6] = createElementVNode(
          "h4",
          null,
          "OpenTelemetry 查询聚合器",
          -1
          /* CACHED */
        )),
        _cache[7] || (_cache[7] = createElementVNode(
          "p",
          { class: "warn" },
          "浏览器直连查询端点（非 OTLP /v1/* 写入）。凭据仅存运行时内存。",
          -1
          /* CACHED */
        )),
        _cache[8] || (_cache[8] = createElementVNode(
          "label",
          null,
          "默认 Signal",
          -1
          /* CACHED */
        )),
        createVNode(unref(GSelect), {
          modelValue: defaultSignal.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => defaultSignal.value = $event),
          options: [
            { label: "metrics", value: "metrics" },
            { label: "logs", value: "logs" },
            { label: "traces", value: "traces" }
          ],
          "test-id": "otel-default-signal"
        }, null, 8, ["modelValue"]),
        _cache[9] || (_cache[9] = createElementVNode(
          "label",
          null,
          "Metrics URL（Prometheus-compatible）",
          -1
          /* CACHED */
        )),
        createVNode(unref(GInput), {
          modelValue: metricsUrl.value,
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => metricsUrl.value = $event),
          placeholder: "http://localhost:9090",
          "test-id": "otel-metrics-url"
        }, null, 8, ["modelValue"]),
        _cache[10] || (_cache[10] = createElementVNode(
          "label",
          null,
          "Logs URL（Loki-compatible）",
          -1
          /* CACHED */
        )),
        createVNode(unref(GInput), {
          modelValue: logsUrl.value,
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => logsUrl.value = $event),
          placeholder: "http://localhost:3100",
          "test-id": "otel-logs-url"
        }, null, 8, ["modelValue"]),
        _cache[11] || (_cache[11] = createElementVNode(
          "label",
          null,
          "Logs Provider",
          -1
          /* CACHED */
        )),
        createVNode(unref(GSelect), {
          modelValue: logsProvider.value,
          "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => logsProvider.value = $event),
          options: [
            { label: "loki", value: "loki" },
            { label: "signoz", value: "signoz" }
          ],
          "test-id": "otel-logs-provider"
        }, null, 8, ["modelValue"]),
        _cache[12] || (_cache[12] = createElementVNode(
          "label",
          null,
          "Traces URL",
          -1
          /* CACHED */
        )),
        createVNode(unref(GInput), {
          modelValue: tracesUrl.value,
          "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => tracesUrl.value = $event),
          placeholder: "http://localhost:3200",
          "test-id": "otel-traces-url"
        }, null, 8, ["modelValue"]),
        _cache[13] || (_cache[13] = createElementVNode(
          "label",
          null,
          "Traces Provider",
          -1
          /* CACHED */
        )),
        createVNode(unref(GSelect), {
          modelValue: tracesProvider.value,
          "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => tracesProvider.value = $event),
          options: [
            { label: "tempo", value: "tempo" },
            { label: "jaeger", value: "jaeger" }
          ],
          "test-id": "otel-traces-provider"
        }, null, 8, ["modelValue"])
      ]);
    };
  }
});
const ConfigEditor$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1B, [["__scopeId", "data-v-7e40ecbd"]]);
const OTEL_CAPABILITIES = {
  signals: ["metrics", "logs", "traces"],
  query: true,
  health: true,
  metadata: true,
  variables: true,
  annotations: false,
  exemplars: false,
  streaming: false,
  queryLanguages: ["promql", "logql", "traceql", "trace-filter"]
};
function buildOtelCapabilities(json, instanceUrl) {
  const signals = [];
  const langs = [];
  if (json.metricsUrl || instanceUrl) {
    signals.push("metrics");
    langs.push("promql");
  }
  if (json.logsUrl) {
    signals.push("logs");
    langs.push(String(json.logsProvider || "loki") === "signoz" ? "signoz-logs" : "logql");
  }
  if (json.tracesUrl) {
    signals.push("traces");
    langs.push("traceql", "trace-filter");
  }
  if (!signals.length) {
    return { ...OTEL_CAPABILITIES };
  }
  return {
    ...OTEL_CAPABILITIES,
    signals,
    queryLanguages: langs.length ? langs : OTEL_CAPABILITIES.queryLanguages
  };
}
function createOpenTelemetryDataSource(instance, meta2) {
  const fallback = createBuiltinDataSourceApi(instance, meta2);
  const json = instance.jsonData || {};
  const metricsProvider = String(json.metricsProvider || "prometheus");
  const logsProvider = String(json.logsProvider || "loki");
  const tracesProvider = String(json.tracesProvider || "tempo");
  return {
    uid: instance.uid,
    type: meta2.id,
    name: instance.name,
    capabilities: buildOtelCapabilities(json, instance.url),
    async query(request, signal) {
      if (getBackendMode() === "offline") return fallback.query(request);
      const frames = [];
      for (const t2 of request.targets.filter((x) => !x.hide)) {
        const signalType = String(t2.signal || json.defaultSignal || "metrics");
        if (signalType === "metrics") {
          if (metricsProvider !== "prometheus" && metricsProvider !== "promql") {
            throw new DataSourceError(
              "UNSUPPORTED_QUERY_API",
              `Metrics provider "${metricsProvider}" is not configured`
            );
          }
          const promUrl = String(json.metricsUrl || instance.url || "");
          if (!promUrl)
            throw new DataSourceError(
              "UNSUPPORTED_QUERY_API",
              "metricsUrl not configured for OTel metrics"
            );
          const prom = createPrometheusDataSource(
            {
              ...instance,
              url: promUrl,
              jsonData: { ...json, ...json.metricsJsonData || {} }
            },
            { id: "prometheus", name: "Prometheus" }
          );
          const res = await prom.query(
            {
              ...request,
              targets: [{ ...t2, expr: t2.expr || t2.query }]
            },
            signal
          );
          frames.push(...res.data);
        } else if (signalType === "logs") {
          const endpoint = String(json.logsUrl || "");
          if (!endpoint) {
            throw new DataSourceError(
              "UNSUPPORTED_QUERY_API",
              "logs query endpoint not configured (OTel is a query aggregator, not OTLP)"
            );
          }
          if (logsProvider !== "loki" && logsProvider !== "signoz") {
            throw new DataSourceError(
              "UNSUPPORTED_QUERY_API",
              `Logs provider "${logsProvider}" is not supported (use loki|signoz)`
            );
          }
          if (logsProvider === "signoz") {
            const signoz = createSignozDataSource$1(
              {
                ...instance,
                url: endpoint,
                jsonData: {
                  ...json,
                  ...json.logsJsonData || {},
                  apiProfile: json.logsApiProfile || "signoz-v3"
                }
              },
              { id: "signoz", name: "SigNoz" }
            );
            const res = await signoz.query(
              {
                ...request,
                targets: [
                  {
                    ...t2,
                    signal: "logs",
                    expr: t2.expr || t2.query
                  }
                ]
              },
              signal
            );
            frames.push(...res.data);
          } else {
            const loki = createLokiDataSource(
              {
                ...instance,
                url: endpoint,
                jsonData: {
                  ...json,
                  ...json.logsJsonData || {},
                  apiProfile: json.logsApiProfile
                }
              },
              { id: "loki", name: "Loki" }
            );
            const res = await loki.query(
              {
                ...request,
                targets: [{ ...t2, expr: t2.expr || t2.query }]
              },
              signal
            );
            frames.push(...res.data);
          }
        } else if (signalType === "traces") {
          const endpoint = String(json.tracesUrl || "");
          if (!endpoint) {
            throw new DataSourceError(
              "UNSUPPORTED_QUERY_API",
              "traces query endpoint not configured (OTel is a query aggregator, not OTLP)"
            );
          }
          if (tracesProvider !== "tempo" && tracesProvider !== "jaeger") {
            throw new DataSourceError(
              "UNSUPPORTED_QUERY_API",
              `Traces provider "${tracesProvider}" is not supported (use tempo|jaeger)`
            );
          }
          const tempo = createTempoDataSource(
            {
              ...instance,
              url: endpoint,
              jsonData: { ...json, ...json.tracesJsonData || {} }
            },
            { id: "tempo", name: "Tempo" }
          );
          const res = await tempo.query(
            {
              ...request,
              targets: [
                {
                  ...t2,
                  query: t2.query || t2.expr || t2.traceId,
                  traceId: t2.traceId,
                  queryType: t2.queryType
                }
              ]
            },
            signal
          );
          frames.push(...res.data);
        } else {
          throw new DataSourceError("UNSUPPORTED_QUERY_API", `Unknown signal ${signalType}`);
        }
      }
      return { data: frames };
    },
    async testDatasource() {
      if (getBackendMode() === "offline") return { status: "success", message: "OTel offline OK" };
      if (!json.metricsUrl && !json.logsUrl && !json.tracesUrl && !instance.url) {
        return {
          status: "error",
          message: "Configure metricsUrl/logsUrl/tracesUrl (query providers, not OTLP)"
        };
      }
      return {
        status: "success",
        message: "OpenTelemetry query aggregator configured"
      };
    },
    metricFindQuery: (q) => fallback.metricFindQuery?.(q) ?? Promise.resolve([]),
    /** Prefetch: metrics → Prometheus provider */
    async listMetricNames(signal) {
      const promUrl = String(json.metricsUrl || instance.url || "");
      const prom = createPrometheusDataSource(
        {
          ...instance,
          url: promUrl || "http://localhost:9090",
          jsonData: { ...json, ...json.metricsJsonData || {} }
        },
        { id: "prometheus", name: "Prometheus" }
      );
      if (typeof prom.listMetricNames === "function") {
        return prom.listMetricNames(signal);
      }
      return [];
    },
    async listLabelNames(signal) {
      const promUrl = String(json.metricsUrl || instance.url || "");
      const prom = createPrometheusDataSource(
        {
          ...instance,
          url: promUrl || "http://localhost:9090",
          jsonData: { ...json, ...json.metricsJsonData || {} }
        },
        { id: "prometheus", name: "Prometheus" }
      );
      if (typeof prom.listLabelNames === "function") {
        return prom.listLabelNames(signal);
      }
      return [];
    },
    /** Prefetch: traces → Tempo provider tags/services */
    async listSearchTags(signal) {
      const endpoint = String(json.tracesUrl || "");
      const tempo = createTempoDataSource(
        {
          ...instance,
          url: endpoint || "http://localhost:3200",
          jsonData: { ...json, ...json.tracesJsonData || {} }
        },
        { id: "tempo", name: "Tempo" }
      );
      if (typeof tempo.listSearchTags === "function") {
        return tempo.listSearchTags(signal);
      }
      return [];
    },
    async listTagValues(tag, signal) {
      const endpoint = String(json.tracesUrl || "");
      const tempo = createTempoDataSource(
        {
          ...instance,
          url: endpoint || "http://localhost:3200",
          jsonData: { ...json, ...json.tracesJsonData || {} }
        },
        { id: "tempo", name: "Tempo" }
      );
      if (typeof tempo.listTagValues === "function") {
        return tempo.listTagValues(tag, signal);
      }
      return [];
    },
    /** Prefetch: services (traces tag values or signoz logs) */
    async listServices(signal) {
      if (getBackendMode() === "offline") {
        return [
          { text: "frontend", value: "frontend" },
          { text: "api", value: "api" },
          { text: "checkout", value: "checkout" }
        ];
      }
      if (json.tracesUrl || tracesProvider === "tempo") {
        try {
          const endpoint = String(json.tracesUrl || "http://localhost:3200");
          const tempo = createTempoDataSource(
            {
              ...instance,
              url: endpoint,
              jsonData: { ...json, ...json.tracesJsonData || {} }
            },
            { id: "tempo", name: "Tempo" }
          );
          if (typeof tempo.listTagValues === "function") {
            return await tempo.listTagValues("service.name", signal);
          }
        } catch {
        }
      }
      if (logsProvider === "signoz" && json.logsUrl) {
        const signoz = createSignozDataSource$1(
          {
            ...instance,
            url: String(json.logsUrl),
            jsonData: {
              ...json,
              apiProfile: json.logsApiProfile || "signoz-v3"
            }
          },
          { id: "signoz", name: "SigNoz" }
        );
        if (typeof signoz.listServices === "function") {
          return signoz.listServices(signal);
        }
      }
      return [];
    }
  };
}
const meta$2 = {
  id: "opentelemetry",
  name: "OpenTelemetry",
  metrics: true,
  logs: true,
  tracing: true,
  capabilities: OTEL_CAPABILITIES
};
createDataSourcePlugin({
  meta: meta$2,
  QueryEditor: QueryEditor$2,
  ConfigEditor: ConfigEditor$2,
  VariableQueryEditor: VariableQueryEditor$2,
  AnnotationQueryEditor: AnnotationQueryEditor$2,
  createDataSource: (instance) => createOpenTelemetryDataSource(instance, meta$2)
});
let datasourcesRegistered = false;
function registerBuiltinDataSources() {
  if (datasourcesRegistered) return;
  datasourcesRegistered = true;
  if (!hasPrometheusDataSourceFactory()) {
    registerPrometheusDataSourceFactory(
      (instance, meta2) => createPrometheusDataSource(instance, meta2)
    );
  }
  if (listDataSourcePlugins().length === 0) {
    throw new Error("[grafana-vue-datasources] registerBuiltinDataSources produced zero plugins");
  }
}
const ZABBIX_TYPE = "alexanderzobnin-zabbix-datasource";
const SIGNOZ_TYPE = "signoz";
function ds(type, uid) {
  return { type, uid };
}
function panel(id, type, title, gridPos, targets, extra = {}) {
  return {
    id,
    type,
    title,
    gridPos,
    targets,
    options: extra.options || {},
    fieldConfig: extra.fieldConfig || { defaults: {}, overrides: [] },
    datasource: targets[0]?.datasource,
    ...extra
  };
}
function assertNoEmptyDupTargets(panels2, uid) {
  const seen = /* @__PURE__ */ new Set();
  for (const p of panels2) {
    for (const t2 of p.targets || []) {
      const key = JSON.stringify({
        refId: t2.refId,
        queryType: t2.queryType,
        signal: t2.signal,
        requestType: t2.requestType,
        expr: t2.expr,
        item: t2.item,
        schema: t2.schema
      });
      if (seen.has(key) && !t2.expr && !t2.item?.filter && !(t2.queries || []).length) {
        throw new Error(`${uid}: duplicate empty target ${key}`);
      }
      seen.add(`${p.id}:${t2.refId}`);
      if (!t2.datasource?.uid) {
        throw new Error(`${uid}: target ${t2.refId} missing datasource uid`);
      }
    }
  }
}
function zabbixScopeFilters() {
  return { group: { filter: "$Group" }, host: { filter: "$Host" } };
}
function zabbixTemplating(datasource) {
  return {
    list: [
      {
        name: "Group",
        type: "query",
        datasource,
        query: { queryType: "group", filter: "" },
        current: { text: "All", value: "/.*/" },
        includeAll: true,
        allValue: "/.*/",
        refresh: 1
      },
      {
        name: "Host",
        type: "query",
        datasource,
        query: { queryType: "host", group: "$Group", filter: "" },
        current: { text: "All", value: "/.*/" },
        includeAll: true,
        allValue: "/.*/",
        refresh: 1
      }
    ]
  };
}
function buildLiveZabbixMetrics(uid = "live-zabbix-metrics") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const scope = zabbixScopeFilters();
  const panels2 = [
    panel(1, "timeseries", "History metrics", { x: 0, y: 0, w: 12, h: 8 }, [
      {
        refId: "A",
        queryType: "0",
        ...scope,
        item: { filter: "system.cpu.util" },
        datasource: d
      }
    ]),
    panel(2, "timeseries", "Trends metrics", { x: 12, y: 0, w: 12, h: 8 }, [
      {
        refId: "B",
        queryType: "0",
        useTrends: "true",
        ...scope,
        item: { filter: "vm.memory.util" },
        datasource: d
      }
    ]),
    panel(3, "stat", "Latest single", { x: 0, y: 8, w: 8, h: 6 }, [
      {
        refId: "C",
        queryType: "0",
        ...scope,
        item: { filter: "agent.ping" },
        datasource: d
      }
    ]),
    panel(4, "table", "Item inventory", { x: 8, y: 8, w: 16, h: 6 }, [
      {
        refId: "D",
        queryType: "2",
        ...scope,
        item: { filter: "system.uname" },
        datasource: d
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix Metrics",
    schemaVersion: 39,
    requireLiveFrames: true,
    tags: ["live", "zabbix", "metrics"],
    time: { from: "now-1h", to: "now" },
    templating: zabbixTemplating(d),
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixItemid(uid = "live-zabbix-itemid") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(1, "timeseries", "By itemids", { x: 0, y: 0, w: 24, h: 10 }, [
      { refId: "A", queryType: "0", itemids: ["10001"], datasource: d },
      { refId: "B", queryType: "0", itemids: ["10002"], datasource: d }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix ItemIDs",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixText(uid = "live-zabbix-text") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(1, "logs", "Text / log items", { x: 0, y: 0, w: 24, h: 12 }, [
      {
        refId: "A",
        queryType: "2",
        ...zabbixScopeFilters(),
        item: { filter: "log[*]" },
        datasource: d
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix Text",
    schemaVersion: 39,
    requireLiveFrames: true,
    templating: zabbixTemplating(ds(ZABBIX_TYPE, "zabbix")),
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixServices(uid = "live-zabbix-services") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(1, "table", "IT Services", { x: 0, y: 0, w: 24, h: 12 }, [
      {
        refId: "A",
        queryType: "1",
        service: { filter: "/.*/" },
        itServiceFilter: "/.*/",
        slaProperty: "sli",
        datasource: d
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix Services",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixTriggers(uid = "live-zabbix-triggers") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(1, "table", "Triggers", { x: 0, y: 0, w: 24, h: 12 }, [
      {
        refId: "A",
        queryType: "4",
        ...zabbixScopeFilters(),
        trigger: { filter: "" },
        options: { limit: 100 },
        datasource: d
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix Triggers",
    schemaVersion: 39,
    requireLiveFrames: true,
    templating: zabbixTemplating(ds(ZABBIX_TYPE, "zabbix")),
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixProblems(uid = "live-zabbix-problems") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(
      1,
      "alexanderzobnin-zabbix-triggers-panel",
      "Problems panel",
      { x: 0, y: 0, w: 24, h: 14 },
      [
        {
          refId: "A",
          queryType: "5",
          ...zabbixScopeFilters(),
          options: { useTimeRange: true, minSeverity: 2, limit: 50 },
          datasource: d
        }
      ]
    )
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix Problems",
    schemaVersion: 39,
    requireLiveFrames: true,
    templating: zabbixTemplating(ds(ZABBIX_TYPE, "zabbix")),
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixMacros(uid = "live-zabbix-macros") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(1, "table", "User macros", { x: 0, y: 0, w: 24, h: 10 }, [
      {
        refId: "A",
        queryType: "6",
        ...zabbixScopeFilters(),
        macro: { filter: "" },
        datasource: d
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix Macros",
    schemaVersion: 39,
    requireLiveFrames: true,
    templating: zabbixTemplating(ds(ZABBIX_TYPE, "zabbix")),
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function buildLiveZabbixLld(uid = "live-zabbix-lld") {
  const d = ds(ZABBIX_TYPE, "zabbix");
  const panels2 = [
    panel(1, "table", "LLD discovery", { x: 0, y: 0, w: 24, h: 10 }, [
      {
        refId: "A",
        queryType: "0",
        executionMode: "lld",
        lld: {
          ruleId: "10001",
          ruleName: "Mounted filesystem discovery",
          prototypeIds: [],
          prototypeKeys: ["vfs.fs.size[{#FSNAME},pused]"]
        },
        ...zabbixScopeFilters(),
        application: { filter: "/.*/" },
        datasource: d
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live Zabbix LLD",
    schemaVersion: 39,
    requireLiveFrames: true,
    templating: zabbixTemplating(ds(ZABBIX_TYPE, "zabbix")),
    meta: { liveOnly: true, datasourceUid: "zabbix" },
    panels: panels2
  };
}
function signozBuilder(refId, signal, requestType, uid, extra = {}) {
  return {
    refId,
    schema: 1,
    apiProfile: extra.apiProfile || "signoz-v5",
    requestType,
    signal,
    datasource: ds(SIGNOZ_TYPE, uid),
    queries: [
      {
        type: "builder_query",
        queryType: extra.queryType || "builder",
        spec: {
          name: refId,
          signal,
          disabled: false,
          filter: {
            expression: extra.filter != null ? String(extra.filter) : ""
          },
          having: { expression: "" },
          groupBy: [],
          order: [],
          legend: "",
          functions: [],
          aggregations: extra.aggregations || (signal === "metrics" ? [
            {
              metricName: "up",
              temporality: "Unspecified",
              timeAggregation: "avg",
              spaceAggregation: "avg"
            }
          ] : signal === "logs" || signal === "traces" ? [{ expression: "count()" }] : []),
          tags: [],
          service: extra.service,
          operation: extra.operation,
          stepInterval: null
        },
        rawQuery: extra.rawQuery || ""
      }
    ],
    ...extra.flat
  };
}
function buildLiveSignozNativeMetrics(uid = "live-signoz-native-metrics") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "timeseries", "Builder metrics", { x: 0, y: 0, w: 12, h: 8 }, [
      signozBuilder("A", "metrics", "time_series", dsUid)
    ]),
    panel(2, "timeseries", "PromQL", { x: 12, y: 0, w: 12, h: 8 }, [
      signozBuilder("B", "metrics", "time_series", dsUid, {
        queryType: "promql",
        rawQuery: "up"
      })
    ]),
    panel(3, "stat", "Scalar", { x: 0, y: 8, w: 8, h: 6 }, [
      signozBuilder("C", "metrics", "scalar", dsUid)
    ]),
    panel(4, "table", "ClickHouse SQL", { x: 8, y: 8, w: 16, h: 6 }, [
      signozBuilder("D", "metrics", "time_series", dsUid, {
        queryType: "clickhouse_sql",
        rawQuery: "SELECT 1"
      })
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live SigNoz Native Metrics",
    schemaVersion: 39,
    requireLiveFrames: true,
    templating: {
      list: [
        {
          name: "service",
          type: "query",
          datasource: ds(SIGNOZ_TYPE, dsUid),
          query: { type: "service" }
        },
        {
          name: "metric",
          type: "query",
          datasource: ds(SIGNOZ_TYPE, dsUid),
          query: { type: "metric" }
        }
      ]
    },
    meta: { liveOnly: true, datasourceUid: dsUid, apiProfile: "signoz-v5" },
    panels: panels2
  };
}
function buildLiveSignozNativeLogs(uid = "live-signoz-native-logs") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "logs", "Raw logs", { x: 0, y: 0, w: 24, h: 10 }, [
      signozBuilder("A", "logs", "raw", dsUid, { filter: "severity = error" })
    ]),
    panel(2, "logs", "Raw stream shape", { x: 0, y: 10, w: 24, h: 8 }, [
      signozBuilder("B", "logs", "raw_stream", dsUid, {
        filter: "body exists"
      })
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live SigNoz Native Logs",
    schemaVersion: 39,
    requireLiveFrames: true,
    annotations: {
      list: [
        {
          name: "error logs",
          enable: true,
          datasource: ds(SIGNOZ_TYPE, dsUid),
          target: { source: "errorLogs" }
        }
      ]
    },
    meta: { liveOnly: true, datasourceUid: dsUid, apiProfile: "signoz-v5" },
    panels: panels2
  };
}
function buildLiveSignozNativeTraces(uid = "live-signoz-native-traces") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "traces", "Trace list", { x: 0, y: 0, w: 24, h: 10 }, [
      signozBuilder("A", "traces", "trace", dsUid, {
        filter: "has_error = true"
      })
    ]),
    panel(2, "traces", "Trace operator", { x: 0, y: 10, w: 24, h: 8 }, [
      {
        refId: "B",
        schema: 1,
        apiProfile: "signoz-v5",
        requestType: "trace",
        signal: "traces",
        datasource: ds(SIGNOZ_TYPE, dsUid),
        queries: [
          {
            type: "builder_trace_operator",
            spec: { name: "B", expression: "A", legend: "op" }
          }
        ]
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live SigNoz Native Traces",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: { liveOnly: true, datasourceUid: dsUid, apiProfile: "signoz-v5" },
    panels: panels2
  };
}
function buildLiveSignozNativeQueryModes(uid = "live-signoz-native-query-modes") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "timeseries", "builder", { x: 0, y: 0, w: 8, h: 8 }, [
      signozBuilder("A", "metrics", "time_series", dsUid, {
        queryType: "builder"
      })
    ]),
    panel(2, "timeseries", "promql", { x: 8, y: 0, w: 8, h: 8 }, [
      signozBuilder("B", "metrics", "time_series", dsUid, {
        queryType: "promql",
        rawQuery: "up"
      })
    ]),
    panel(3, "timeseries", "clickhouse_sql", { x: 16, y: 0, w: 8, h: 8 }, [
      signozBuilder("C", "metrics", "time_series", dsUid, {
        queryType: "clickhouse_sql",
        rawQuery: "SELECT now()"
      })
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live SigNoz Query Modes",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: { liveOnly: true, datasourceUid: dsUid, apiProfile: "signoz-v5" },
    panels: panels2
  };
}
function buildLiveSignozNativeResults(uid = "live-signoz-native-results") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "timeseries", "time_series", { x: 0, y: 0, w: 12, h: 7 }, [
      signozBuilder("A", "metrics", "time_series", dsUid)
    ]),
    panel(2, "stat", "scalar", { x: 12, y: 0, w: 12, h: 7 }, [
      signozBuilder("B", "metrics", "scalar", dsUid)
    ]),
    panel(3, "logs", "raw", { x: 0, y: 7, w: 12, h: 7 }, [
      signozBuilder("C", "logs", "raw", dsUid)
    ]),
    panel(4, "traces", "trace", { x: 12, y: 7, w: 12, h: 7 }, [
      signozBuilder("D", "traces", "trace", dsUid)
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live SigNoz Result Types",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: { liveOnly: true, datasourceUid: dsUid, apiProfile: "signoz-v5" },
    panels: panels2
  };
}
function buildLiveSignoz(uid = "live-signoz") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "timeseries", "SigNoz metrics (query_range)", { x: 0, y: 0, w: 24, h: 10 }, [
      signozBuilder("A", "metrics", "time_series", dsUid, {
        apiProfile: "signoz-v5"
      })
    ]),
    panel(2, "text", "SigNoz capability diagnostics", { x: 0, y: 10, w: 24, h: 6 }, [], {
      options: {
        content: "Diagnostics only: profile=signoz-v5; official SigNoz endpoints; tokens never shown.",
        mode: "markdown"
      },
      targets: [
        {
          refId: "diag",
          datasource: ds(SIGNOZ_TYPE, dsUid),
          hide: true,
          apiProfile: "signoz-v5"
        }
      ]
    })
  ];
  assertNoEmptyDupTargets(
    panels2.map((p) => ({
      ...p,
      targets: (p.targets || []).filter((t2) => !t2.hide)
    })),
    uid
  );
  return {
    uid,
    title: "Live SigNoz",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: {
      liveOnly: true,
      datasourceUid: dsUid,
      apiProfile: "signoz-v5",
      diagnostics: {
        profile: "signoz-v5",
        supported: [
          "metrics.list",
          "attribute.keys",
          "attribute.values",
          "services",
          "operations",
          "query_range",
          "alerts"
        ]
      }
    },
    panels: panels2
  };
}
function buildLiveSignozObservability(uid = "live-signoz-observability") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "timeseries", "RED metrics", { x: 0, y: 0, w: 12, h: 8 }, [
      signozBuilder("A", "metrics", "time_series", dsUid, {
        aggregations: [{ metricName: "signoz_latency", expression: "P95" }]
      })
    ]),
    panel(2, "logs", "Error logs", { x: 12, y: 0, w: 12, h: 8 }, [
      signozBuilder("B", "logs", "raw", dsUid, { filter: "severity = error" })
    ]),
    panel(3, "traces", "Error traces", { x: 0, y: 8, w: 12, h: 8 }, [
      signozBuilder("C", "traces", "trace", dsUid, {
        filter: "has_error = true"
      })
    ]),
    panel(4, "signoz-issues", "Issues", { x: 12, y: 8, w: 12, h: 8 }, [
      {
        refId: "D",
        signal: "alerts",
        schema: 1,
        datasource: ds(SIGNOZ_TYPE, dsUid),
        queries: []
      }
    ])
  ];
  assertNoEmptyDupTargets(panels2, uid);
  return {
    uid,
    title: "Live SigNoz Observability",
    schemaVersion: 39,
    requireLiveFrames: true,
    meta: { liveOnly: true, datasourceUid: dsUid, apiProfile: "signoz-v5" },
    panels: panels2
  };
}
function buildLiveDiagnostics(uid = "live-observability-diagnostics") {
  return {
    uid,
    title: "Observability Diagnostics",
    schemaVersion: 39,
    meta: {
      diagnostics: {
        fields: [
          "urlPath",
          "version",
          "profile",
          "authKind",
          "credentialHeaderName",
          "supportedQueryTypes",
          "supportedResultTypes",
          "supportedMetadata",
          "supportedDetail",
          "supportedActions",
          "lastChecked",
          "error"
        ],
        forbidden: ["token", "password", "apiKey", "authorization"]
      }
    },
    panels: [
      panel(1, "text", "Capability matrix (sanitized)", { x: 0, y: 0, w: 24, h: 12 }, [], {
        options: {
          mode: "markdown",
          content: "## Diagnostics\n\n- URL path / profile / version\n- Auth kind + header **name** only\n- Query / result / metadata / detail / action support\n- Last checked + error code\n\n**Never display tokens.**"
        }
      })
    ]
  };
}
function buildLiveZabbixFull(uid = "live-zabbix-full") {
  const z3 = ds(ZABBIX_TYPE, "zabbix-3");
  const z14 = ds(ZABBIX_TYPE, "zabbix-14");
  const g = { filter: "$Group" };
  const h2 = { filter: "$Host" };
  const lineCfg = (fill = 10) => ({
    defaults: {
      custom: {
        drawStyle: "line",
        lineInterpolation: "smooth",
        lineWidth: 2,
        fillOpacity: fill,
        showPoints: "never",
        spanNulls: false,
        axisPlacement: "auto"
      },
      unit: "percent"
    },
    overrides: []
  });
  const barCfg = (fill = 50) => ({
    defaults: {
      custom: {
        drawStyle: "bars",
        lineWidth: 1,
        fillOpacity: fill,
        showPoints: "never",
        spanNulls: false,
        axisPlacement: "auto"
      },
      unit: "percent"
    },
    overrides: []
  });
  const legendOpts = {
    legend: {
      showLegend: true,
      displayMode: "list",
      placement: "bottom",
      calcs: ["mean", "max", "last"]
    },
    tooltip: { mode: "multi", sort: "desc" }
  };
  const panels2 = [
    panel(
      1,
      "timeseries",
      "Z3 · CPU 趋势 · 折线图 (trend.get)",
      { x: 0, y: 0, w: 12, h: 9 },
      [
        {
          refId: "A",
          queryType: "0",
          group: g,
          host: h2,
          item: { filter: "/system.cpu.util/" },
          options: { useTrends: "true" },
          datasource: z3
        }
      ],
      { options: legendOpts, fieldConfig: lineCfg(12) }
    ),
    panel(
      2,
      "timeseries",
      "Z3 · CPU 趋势 · 柱状图 (trend.get)",
      { x: 12, y: 0, w: 12, h: 9 },
      [
        {
          refId: "B",
          queryType: "0",
          group: g,
          host: h2,
          item: { filter: "/system.cpu.util/" },
          options: { useTrends: "true" },
          datasource: z3
        }
      ],
      { options: legendOpts, fieldConfig: barCfg(55) }
    ),
    panel(
      13,
      "timeseries",
      "Z3 · Memory 趋势 · 折线 (trend.get)",
      { x: 0, y: 9, w: 12, h: 8 },
      [
        {
          refId: "M",
          queryType: "0",
          group: g,
          host: h2,
          item: { filter: "/vm.memory.utilization|vm.memory.size|memory/" },
          options: { useTrends: "true" },
          datasource: z3
        }
      ],
      { options: legendOpts, fieldConfig: lineCfg(15) }
    ),
    panel(
      14,
      "timeseries",
      "Z3 · History 柱状 (history.get)",
      { x: 12, y: 9, w: 12, h: 8 },
      [
        {
          refId: "Hbar",
          queryType: "0",
          group: g,
          host: h2,
          item: { filter: "/agent.ping|system.cpu.util$/" },
          options: { useTrends: "false" },
          datasource: z3
        }
      ],
      {
        options: legendOpts,
        fieldConfig: {
          defaults: {
            custom: {
              drawStyle: "bars",
              fillOpacity: 40,
              lineWidth: 1,
              showPoints: "never"
            }
          },
          overrides: []
        }
      }
    ),
    panel(
      9,
      "timeseries",
      "Z14 · Metrics 折线 (trends→history fallback)",
      { x: 0, y: 17, w: 24, h: 8 },
      [
        {
          refId: "I",
          queryType: "0",
          group: g,
          host: h2,
          item: { filter: "/system.cpu.util|cpu|load|agent.ping/" },
          options: { useTrends: "true" },
          datasource: z14
        }
      ],
      { options: legendOpts, fieldConfig: lineCfg(8) }
    ),
    panel(
      3,
      "timeseries",
      "Z3 · agent.ping history 折线",
      { x: 0, y: 25, w: 12, h: 7 },
      [
        {
          refId: "C",
          queryType: "0",
          group: g,
          host: h2,
          item: { filter: "agent.ping" },
          options: { useTrends: "false" },
          datasource: z3
        }
      ],
      {
        options: {
          legend: {
            showLegend: true,
            displayMode: "list",
            placement: "bottom"
          }
        },
        fieldConfig: {
          defaults: { custom: { drawStyle: "line", lineWidth: 2 } },
          overrides: []
        }
      }
    ),
    panel(4, "logs", "Z3 · Text / log items", { x: 12, y: 25, w: 12, h: 7 }, [
      {
        refId: "D",
        queryType: "2",
        group: g,
        host: h2,
        item: { filter: "/log\\[|text|system.uname/" },
        datasource: z3
      }
    ]),
    panel(5, "table", "Z3 · Problems", { x: 0, y: 32, w: 12, h: 8 }, [
      {
        refId: "E",
        queryType: "5",
        group: g,
        host: h2,
        showProblems: "problems",
        options: { sortProblems: "lastchange", limit: 50, useTimeRange: true },
        datasource: z3
      }
    ]),
    panel(6, "table", "Z3 · Triggers", { x: 12, y: 32, w: 12, h: 8 }, [
      {
        refId: "F",
        queryType: "4",
        group: g,
        host: h2,
        trigger: { filter: "" },
        options: { limit: 100 },
        datasource: z3
      }
    ]),
    panel(7, "table", "Z3 · Macros", { x: 0, y: 40, w: 8, h: 7 }, [
      {
        refId: "G",
        queryType: "6",
        group: g,
        host: h2,
        macro: { filter: "" },
        datasource: z3
      }
    ]),
    panel(8, "table", "Z3 · IT Services / SLA", { x: 8, y: 40, w: 8, h: 7 }, [
      {
        refId: "H",
        queryType: "1",
        service: { filter: "/.*/" },
        itServiceFilter: "/.*/",
        slaProperty: "sli",
        datasource: z3
      }
    ]),
    panel(10, "table", "Z14 · Problems", { x: 16, y: 40, w: 8, h: 7 }, [
      {
        refId: "J",
        queryType: "5",
        group: g,
        host: h2,
        showProblems: "problems",
        options: { sortProblems: "priority", limit: 50, useTimeRange: true },
        datasource: z14
      }
    ]),
    panel(11, "table", "Z14 · Triggers", { x: 0, y: 47, w: 12, h: 8 }, [
      {
        refId: "K",
        queryType: "4",
        group: g,
        host: h2,
        trigger: { filter: "" },
        options: { limit: 100 },
        datasource: z14
      }
    ]),
    panel(12, "text", "Zabbix live 全量说明", { x: 12, y: 47, w: 12, h: 8 }, [], {
      options: {
        mode: "markdown",
        content: "### Live Zabbix Full\\n- 顶部：**CPU 趋势折线 / CPU 趋势柱状 / Memory 趋势 / History 柱状**\\n- 时间默认 `now-7d`（`trend.get` 需要足够宽的时间窗）\\n- Group/Host=All 时走 item-first 搜索（不取空名主机）\\n- z14 若无 trend 行会自动回退 history.get\\n- 数据源: `zabbix-3`(6.x) + `zabbix-14`(7.x)"
      }
    })
  ];
  assertNoEmptyDupTargets(
    panels2.filter((p) => (p.targets || []).length).map((p) => ({ ...p, targets: p.targets })),
    uid
  );
  return {
    uid,
    title: "Live Zabbix Full (真实接口全量)",
    schemaVersion: 39,
    requireLiveFrames: true,
    tags: ["live", "zabbix", "full", "real-api", "trends"],
    // 2d keeps trend.get responsive while still exercising trends path.
    time: { from: "now-2d", to: "now" },
    templating: {
      list: [
        {
          name: "Group",
          type: "query",
          datasource: z3,
          query: { queryType: "group", filter: "" },
          current: { text: "All", value: "/.*/" },
          includeAll: true,
          allValue: "/.*/",
          refresh: 1
        },
        {
          name: "Host",
          type: "query",
          datasource: z3,
          query: { queryType: "host", group: "$Group", filter: "" },
          // Prefer a host with real metrics; All remains available via includeAll.
          current: { text: "Zabbix server", value: "Zabbix server" },
          includeAll: true,
          allValue: "/.*/",
          refresh: 1
        }
      ]
    },
    meta: { liveOnly: true, datasourceUid: "zabbix-3" },
    panels: panels2
  };
}
function buildLiveSignozFull(uid = "live-signoz-full") {
  const dsUid = "signoz";
  const panels2 = [
    panel(1, "timeseries", "Metrics · builder (rate/sum)", { x: 0, y: 0, w: 12, h: 8 }, [
      signozBuilder("A", "metrics", "time_series", dsUid, {
        aggregations: [
          {
            metricName: "app.ads.ad_requests",
            temporality: "cumulative",
            timeAggregation: "rate",
            spaceAggregation: "sum"
          }
        ]
      })
    ]),
    panel(2, "timeseries", "Metrics · PromQL up", { x: 12, y: 0, w: 12, h: 8 }, [
      signozBuilder("B", "metrics", "time_series", dsUid, {
        queryType: "promql",
        rawQuery: "up"
      })
    ]),
    panel(3, "stat", "Metrics · scalar avg", { x: 0, y: 8, w: 6, h: 6 }, [
      signozBuilder("C", "metrics", "scalar", dsUid, {
        aggregations: [
          {
            metricName: "up",
            temporality: "Unspecified",
            timeAggregation: "avg",
            spaceAggregation: "avg",
            reduceTo: "avg"
          }
        ]
      })
    ]),
    panel(4, "table", "Traces · scalar table (count/p99/errors)", { x: 6, y: 8, w: 10, h: 6 }, [
      // multi-query scalar is built as single target; adapter may run one builder
      signozBuilder("D", "traces", "scalar", dsUid, {
        aggregations: [{ expression: "count()" }],
        filter: "",
        flat: {
          queries: [
            {
              type: "builder_query",
              queryType: "builder",
              spec: {
                name: "A",
                signal: "traces",
                disabled: false,
                filter: { expression: "" },
                having: { expression: "" },
                groupBy: [
                  {
                    name: "service.name",
                    signal: "traces",
                    fieldContext: "resource",
                    fieldDataType: "string"
                  }
                ],
                order: [],
                legend: "",
                functions: [],
                aggregations: [{ expression: "count()" }],
                tags: [],
                stepInterval: null,
                limit: 20
              }
            }
          ]
        }
      })
    ]),
    panel(5, "logs", "Logs · raw ERROR", { x: 16, y: 8, w: 8, h: 6 }, [
      signozBuilder("E", "logs", "raw", dsUid, {
        filter: "severity_text = 'ERROR'"
      })
    ]),
    panel(6, "timeseries", "Traces · request rate by service", { x: 0, y: 14, w: 12, h: 8 }, [
      signozBuilder("F", "traces", "time_series", dsUid, {
        aggregations: [{ expression: "count()" }],
        filter: "",
        flat: {
          queries: [
            {
              type: "builder_query",
              queryType: "builder",
              spec: {
                name: "A",
                signal: "traces",
                disabled: false,
                stepInterval: 60,
                filter: { expression: "" },
                having: { expression: "" },
                groupBy: [
                  {
                    name: "service.name",
                    signal: "traces",
                    fieldContext: "resource",
                    fieldDataType: "string"
                  }
                ],
                order: [],
                legend: "{{service.name}}",
                functions: [],
                aggregations: [{ expression: "count()" }],
                tags: [],
                limit: 10
              }
            }
          ]
        }
      })
    ]),
    panel(7, "table", "Traces · list", { x: 12, y: 14, w: 12, h: 8 }, [
      signozBuilder("G", "traces", "trace", dsUid, {
        aggregations: [],
        filter: ""
      })
    ]),
    panel(8, "timeseries", "ClickHouse SQL · count", { x: 0, y: 22, w: 12, h: 7 }, [
      signozBuilder("H", "metrics", "scalar", dsUid, {
        queryType: "clickhouse_sql",
        rawQuery: "SELECT count() AS c FROM argus_apm_traces.distributed_index_v3 WHERE timestamp >= now() - INTERVAL 30 MINUTE"
      })
    ]),
    panel(9, "timeseries", "Metrics · having + legend", { x: 12, y: 22, w: 12, h: 7 }, [
      signozBuilder("I", "traces", "time_series", dsUid, {
        aggregations: [{ expression: "count()", alias: "count" }],
        flat: {
          queries: [
            {
              type: "builder_query",
              queryType: "builder",
              spec: {
                name: "A",
                signal: "traces",
                stepInterval: 60,
                disabled: false,
                filter: { expression: "" },
                having: { expression: "count() > 0" },
                groupBy: [
                  {
                    name: "service.name",
                    signal: "traces",
                    fieldContext: "resource",
                    fieldDataType: "string"
                  }
                ],
                order: [],
                legend: "{{service.name}}",
                functions: [],
                aggregations: [{ expression: "count()", alias: "count" }],
                tags: [],
                limit: 5
              }
            }
          ]
        }
      })
    ]),
    panel(10, "text", "SigNoz / argus-web 对齐说明", { x: 0, y: 29, w: 24, h: 6 }, [], {
      options: {
        mode: "markdown",
        content: '### Live SigNoz Full（对齐 `refs/argus-web-4.0/src/views/signoz` + `api/signoz.ts`）\\n- 端点: `POST /api/v5/query_range`、`POST /api/v2/services`（ns epoch 字符串）、fields/metrics\\n- metrics aggregation: `{metricName,timeAggregation,spaceAggregation,temporality}`（禁止 `expression:"avg"`）\\n- traces/logs aggregation: `{expression:"count()"}` / `p99(duration_nano)`\\n- filter 一律 `{expression: string}`；字符串字面量单引号转义（见 `filterExpr.ts`）\\n- 数据源 uid=`signoz` profile=`signoz-v5`；JWT 见 `public/app/defaultObservabilityDataSources.json`（不使用 env）\\n- 真实样本: `artifacts/zabbix-signoz-parity/REAL-API-FULL-EXAMPLES.md`'
      }
    })
  ];
  assertNoEmptyDupTargets(
    panels2.map((p) => ({
      ...p,
      targets: (p.targets || []).filter((t2) => t2.refId)
    })),
    uid
  );
  return {
    uid,
    title: "Live SigNoz Full (真实接口全量)",
    schemaVersion: 39,
    requireLiveFrames: true,
    tags: ["live", "signoz", "full", "real-api", "argus-aligned"],
    time: { from: "now-1h", to: "now" },
    templating: {
      list: [
        {
          name: "service",
          type: "query",
          datasource: ds(SIGNOZ_TYPE, dsUid),
          query: { type: "service" },
          includeAll: true,
          allValue: ""
        },
        {
          name: "metric",
          type: "query",
          datasource: ds(SIGNOZ_TYPE, dsUid),
          query: { type: "metric" },
          includeAll: false
        }
      ]
    },
    meta: {
      liveOnly: true,
      datasourceUid: dsUid,
      apiProfile: "signoz-v5",
      diagnostics: {
        reference: "refs/argus-web-4.0/src/views/signoz + api/signoz.ts",
        endpoints: [
          "/api/v5/query_range",
          "/api/v2/services",
          "/api/v1/fields/keys",
          "/api/v2/metrics"
        ]
      }
    },
    panels: panels2
  };
}
const LIVE_DASHBOARD_BUILDERS = {
  "live-zabbix-metrics": () => buildLiveZabbixMetrics(),
  "live-zabbix-itemid": () => buildLiveZabbixItemid(),
  "live-zabbix-text": () => buildLiveZabbixText(),
  "live-zabbix-services": () => buildLiveZabbixServices(),
  "live-zabbix-triggers": () => buildLiveZabbixTriggers(),
  "live-zabbix-problems": () => buildLiveZabbixProblems(),
  "live-zabbix-macros": () => buildLiveZabbixMacros(),
  "live-zabbix-lld": () => buildLiveZabbixLld(),
  "live-zabbix-full": () => buildLiveZabbixFull(),
  "live-signoz-native-metrics": () => buildLiveSignozNativeMetrics(),
  "live-signoz-native-logs": () => buildLiveSignozNativeLogs(),
  "live-signoz-native-traces": () => buildLiveSignozNativeTraces(),
  "live-signoz-native-query-modes": () => buildLiveSignozNativeQueryModes(),
  "live-signoz-native-results": () => buildLiveSignozNativeResults(),
  "live-signoz": () => buildLiveSignoz(),
  "live-signoz-observability": () => buildLiveSignozObservability(),
  "live-signoz-full": () => buildLiveSignozFull(),
  "live-observability-diagnostics": () => buildLiveDiagnostics()
};
let registered$2 = false;
let heavyGeomap = false;
let heavyZabbix = false;
let heavySignoz = false;
const heavyInflight = /* @__PURE__ */ new Map();
function registerBuiltinPlugins() {
  if (registered$2) return;
  registerBuiltinPanels();
  registerBuiltinDataSources();
  registerLiveDashboardBuilders(LIVE_DASHBOARD_BUILDERS);
  registered$2 = true;
  if (listPanelPlugins().length === 0) {
    throw new Error("[grafana-vue] registerBuiltinPlugins registered zero panel plugins");
  }
}
async function registerHeavyPlugins(needs = "all") {
  const want = needs === "all" ? { geomap: true, zabbix: true, signoz: true } : {
    geomap: !!needs.geomap,
    zabbix: !!needs.zabbix,
    signoz: !!needs.signoz
  };
  const tasks = [];
  if (want.geomap && !heavyGeomap) {
    const key = "geomap";
    if (!heavyInflight.has(key)) {
      heavyInflight.set(
        key,
        Promise.resolve().then(() => register$2).then(async (m) => {
          await m.registerGeomapPanel();
          heavyGeomap = true;
        })
      );
    }
    tasks.push(heavyInflight.get(key));
  }
  if (want.zabbix && !heavyZabbix) {
    const key = "zabbix";
    if (!heavyInflight.has(key)) {
      heavyInflight.set(
        key,
        Promise.resolve().then(() => index).then(async (m) => {
          await m.ensureDatasourceCatalogEntryRegistered("alexanderzobnin-zabbix-datasource");
          heavyZabbix = true;
        })
      );
    }
    tasks.push(heavyInflight.get(key));
  }
  if (want.signoz && !heavySignoz) {
    const key = "signoz";
    if (!heavyInflight.has(key)) {
      heavyInflight.set(
        key,
        Promise.resolve().then(() => index).then(async (m) => {
          await m.ensureDatasourceCatalogEntryRegistered("signoz");
          heavySignoz = true;
        })
      );
    }
    tasks.push(heavyInflight.get(key));
  }
  await Promise.all(tasks);
}
const HEAVY_PANEL = /* @__PURE__ */ new Set(["geomap"]);
const ZABBIX_TYPES = /* @__PURE__ */ new Set(["alexanderzobnin-zabbix-datasource", "zabbix"]);
const SIGNOZ_TYPES = /* @__PURE__ */ new Set(["signoz", "signoz-native", "signoz-argus"]);
function asArray$2(v) {
  return Array.isArray(v) ? v : [];
}
function collectPanels(raw) {
  const out = [];
  const walk = (list) => {
    for (const p of list) {
      if (!p || typeof p !== "object") continue;
      out.push(p);
      if (p.type === "row" && Array.isArray(p.panels)) walk(p.panels);
    }
  };
  walk(asArray$2(raw.panels));
  return out;
}
function dsRef(v) {
  if (!v) return {};
  if (typeof v === "string") return { uid: v };
  if (typeof v === "object") {
    const o = v;
    return {
      uid: o.uid != null ? String(o.uid) : void 0,
      type: o.type != null ? String(o.type) : void 0
    };
  }
  return {};
}
function extractDashboardDependencies(raw) {
  if (!raw || typeof raw !== "object") {
    return {
      panelTypes: [],
      datasourceUids: [],
      datasourceTypes: [],
      variableNames: [],
      annotationNames: [],
      needsHeavyPlugins: { geomap: false, zabbix: false, signoz: false }
    };
  }
  const panelTypes = /* @__PURE__ */ new Set();
  const datasourceUids = /* @__PURE__ */ new Set();
  const datasourceTypes = /* @__PURE__ */ new Set();
  for (const p of collectPanels(raw)) {
    if (p.type) panelTypes.add(String(p.type));
    const targets = asArray$2(p.targets);
    for (const t2 of targets) {
      const r = dsRef(t2?.datasource ?? p.datasource);
      if (r.uid) datasourceUids.add(r.uid);
      if (r.type) datasourceTypes.add(r.type);
    }
    const pr = dsRef(p.datasource);
    if (pr.uid) datasourceUids.add(pr.uid);
    if (pr.type) datasourceTypes.add(pr.type);
  }
  const templating = raw.templating || {};
  const variables = asArray$2(templating.list);
  const variableNames = variables.map((v) => v?.name != null ? String(v.name) : "").filter(Boolean);
  for (const v of variables) {
    const r = dsRef(v?.datasource);
    if (r.uid) datasourceUids.add(r.uid);
    if (r.type) datasourceTypes.add(r.type);
  }
  const annotations = asArray$2(raw.annotations?.list);
  const annotationNames = annotations.map((a) => a?.name != null ? String(a.name) : "").filter(Boolean);
  for (const a of annotations) {
    const r = dsRef(a?.datasource);
    if (r.uid) datasourceUids.add(r.uid);
    if (r.type) datasourceTypes.add(r.type);
  }
  for (const inp of asArray$2(raw.__inputs)) {
    if (inp?.type === "datasource" && inp?.pluginId) {
      datasourceTypes.add(String(inp.pluginId));
    }
  }
  const geomap = [...panelTypes].some((t2) => HEAVY_PANEL.has(t2));
  let zabbix = [...datasourceTypes].some((t2) => ZABBIX_TYPES.has(t2));
  let signoz = [...datasourceTypes].some((t2) => SIGNOZ_TYPES.has(t2));
  for (const uid of datasourceUids) {
    if (uid.startsWith("zabbix")) zabbix = true;
    if (uid.startsWith("signoz")) signoz = true;
  }
  return {
    panelTypes: [...panelTypes].sort(),
    datasourceUids: [...datasourceUids].sort(),
    datasourceTypes: [...datasourceTypes].sort(),
    variableNames,
    annotationNames,
    needsHeavyPlugins: { geomap, zabbix, signoz }
  };
}
function createInitialLoadState() {
  return {
    generation: 0,
    phase: "idle",
    uid: null,
    error: null,
    pendingRerun: false,
    documentCommitted: false,
    shellInteractive: false
  };
}
function reduceDashboardLoad(state2, event) {
  switch (event.type) {
    case "start": {
      return {
        generation: state2.generation + 1,
        phase: "loading-document",
        uid: event.uid,
        error: null,
        pendingRerun: false,
        documentCommitted: false,
        shellInteractive: false
      };
    }
    case "document-commit": {
      if (state2.phase === "idle") return state2;
      return {
        ...state2,
        phase: "document-ready",
        documentCommitted: true,
        error: null
      };
    }
    case "shell-interactive": {
      if (!state2.documentCommitted) return state2;
      return {
        ...state2,
        shellInteractive: true
      };
    }
    case "hydration-start": {
      if (!state2.documentCommitted) return state2;
      return {
        ...state2,
        phase: "hydrating"
      };
    }
    case "ready": {
      if (!state2.documentCommitted) return state2;
      return {
        ...state2,
        phase: "ready",
        shellInteractive: true,
        error: null
      };
    }
    case "error": {
      return {
        ...state2,
        phase: "error",
        error: event.message
      };
    }
    case "request-rerun": {
      return { ...state2, pendingRerun: true };
    }
    case "consume-rerun": {
      return { ...state2, pendingRerun: false };
    }
    case "reset": {
      return createInitialLoadState();
    }
    default:
      return state2;
  }
}
class DashboardLoadRuntime {
  state = createInitialLoadState();
  getSnapshot() {
    return this.state;
  }
  begin(uid) {
    this.state = reduceDashboardLoad(this.state, { type: "start", uid });
    return this.state.generation;
  }
  applyIfCurrent(gen, event) {
    if (gen !== this.state.generation) return false;
    this.state = reduceDashboardLoad(this.state, event);
    return true;
  }
  commitDocument(gen) {
    return this.applyIfCurrent(gen, { type: "document-commit" });
  }
  markShellInteractive(gen) {
    return this.applyIfCurrent(gen, { type: "shell-interactive" });
  }
  startHydration(gen) {
    return this.applyIfCurrent(gen, { type: "hydration-start" });
  }
  markReady(gen) {
    return this.applyIfCurrent(gen, { type: "ready" });
  }
  fail(gen, message2) {
    return this.applyIfCurrent(gen, { type: "error", message: message2 });
  }
  requestRerun() {
    this.state = reduceDashboardLoad(this.state, { type: "request-rerun" });
  }
  consumeRerun() {
    if (!this.state.pendingRerun) return false;
    this.state = reduceDashboardLoad(this.state, { type: "consume-rerun" });
    return true;
  }
  isCurrent(gen) {
    return gen === this.state.generation;
  }
  reset() {
    this.state = createInitialLoadState();
  }
}
function isVisibleTarget(t2) {
  return Boolean(t2 && typeof t2 === "object" && t2.hide !== true);
}
function isAbortLike(e) {
  if (!e || typeof e !== "object") return false;
  const err = e;
  return err.name === "AbortError" || err.code === "ERR_CANCELED";
}
function emptyDone(range) {
  return {
    state: LoadingStateEnum.Done,
    series: [],
    timeRange: range
  };
}
function createPanelQueryEngine(opts) {
  return {
    async execute(panel2, context, signal) {
      if (signal.aborted) {
        return emptyDone(context.timeRange);
      }
      const targets = (panel2.targets ?? []).filter(isVisibleTarget);
      if (!targets.length) {
        return emptyDone(context.timeRange);
      }
      const onAbort = () => {
        opts.scheduler.cancel(context.requestId);
      };
      signal.addEventListener("abort", onAbort, { once: true });
      let partialCoalescer = null;
      try {
        const dsRef2 = targets[0]?.datasource ?? panel2.datasource;
        opts.resolveDataSource(dsRef2);
        partialCoalescer = context.onPartialData ? createStreamCoalescer((series) => {
          context.onPartialData?.(series);
        }) : null;
        signal.addEventListener("abort", () => partialCoalescer?.dispose(), {
          once: true
        });
        const onPartialData = context.onPartialData ? (series) => {
          if (!opts.postProcess) {
            partialCoalescer?.push({ value: series, complete: false });
            return;
          }
          const partialPanelData = {
            state: LoadingStateEnum.Streaming,
            series,
            timeRange: context.timeRange
          };
          void Promise.resolve(opts.postProcess(partialPanelData, panel2, context)).then((processed) => {
            if (signal.aborted) return;
            partialCoalescer?.push({
              value: processed.series ?? series,
              complete: false
            });
          }).catch(() => {
            if (signal.aborted) return;
            partialCoalescer?.push({ value: series, complete: false });
          });
        } : void 0;
        const raw = await opts.scheduler.run({
          requestId: context.requestId,
          targets,
          range: context.timeRange,
          scopedVars: context.scopedVars,
          maxDataPoints: context.maxDataPoints,
          intervalMs: context.intervalMs,
          queryCachingTTL: context.queryCachingTTL,
          cacheTimeout: context.cacheTimeout,
          panelId: panel2.id,
          visible: context.visible,
          onPartialData
        });
        partialCoalescer?.dispose();
        if (signal.aborted) {
          return emptyDone(context.timeRange);
        }
        return opts.postProcess ? await opts.postProcess(raw, panel2, context) : raw;
      } catch (error) {
        if (signal.aborted || isAbortLike(error)) {
          return emptyDone(context.timeRange);
        }
        const message2 = error instanceof DataSourceError ? error.message : error instanceof Error ? error.message : String(error);
        return {
          state: LoadingStateEnum.Error,
          series: [],
          timeRange: context.timeRange,
          error: { message: message2 }
        };
      } finally {
        partialCoalescer?.dispose();
        signal.removeEventListener("abort", onAbort);
      }
    }
  };
}
function buildInterpolatedTargets(panel2, scoped, adhoc) {
  const panelDsRaw = panel2.datasource;
  let panelDs = panelDsRaw;
  if (typeof panelDsRaw === "string") {
    panelDs = replaceVariables(panelDsRaw, scoped);
  } else if (panelDsRaw && typeof panelDsRaw === "object") {
    const uid = panelDsRaw.uid;
    panelDs = {
      ...panelDsRaw,
      uid: typeof uid === "string" ? replaceVariables(uid, scoped) : uid
    };
  }
  const targets = (panel2.targets ?? []).map((t2) => {
    const q = interpolateQuery(t2, (s) => replaceVariables(s, scoped));
    if (q.datasource && typeof q.datasource === "object" && typeof q.datasource.uid === "string") {
      q.datasource = {
        ...q.datasource,
        uid: replaceVariables(q.datasource.uid, scoped)
      };
    } else if (typeof q.datasource === "string") {
      q.datasource = { uid: replaceVariables(q.datasource, scoped) };
    }
    if (q.datasource == null && panelDs != null) {
      q.datasource = typeof panelDs === "string" ? { uid: panelDs } : { ...panelDs };
    }
    if (adhoc.length && typeof q.expr === "string") {
      q.expr = applyAdhocFiltersToExpr(q.expr, adhoc);
    }
    return q;
  });
  return { panelDs, targets };
}
function cloneDoc(doc) {
  return JSON.parse(JSON.stringify(doc));
}
function applyCommand(doc, command) {
  switch (command.type) {
    case "replace":
      return cloneDoc(command.document);
    case "upsert-panel":
      return upsertPanel(doc, command.panel);
    case "remove-panel":
      return removePanel(doc, command.panelId);
    case "set-time":
      return { ...doc, time: { from: command.from, to: command.to } };
    case "set-timezone":
      return { ...doc, timezone: command.timezone };
    case "set-refresh":
      return { ...doc, refresh: command.refresh };
    case "set-variables":
      return {
        ...doc,
        templating: { ...doc.templating, list: command.list }
      };
    case "set-annotations":
      return {
        ...doc,
        annotations: { ...doc.annotations, list: command.list }
      };
    case "patch":
      return command.mutator(cloneDoc(doc));
    default: {
      const _exhaustive = command;
      return _exhaustive;
    }
  }
}
function createDashboardDocument(initial) {
  const history2 = new DashboardHistory();
  const state2 = {
    document: initial ? cloneDoc(initial) : null,
    baselineJson: initial ? JSON.stringify(initial) : "",
    dirty: false,
    mutationRevision: 0,
    savedRevision: 0,
    canUndo: false,
    canRedo: false
  };
  if (state2.document) {
    history2.reset(state2.document, state2.mutationRevision);
  }
  function syncFlags(opts) {
    state2.canUndo = history2.canUndo();
    state2.canRedo = history2.canRedo();
    if (opts?.recomputeContentDirty && state2.document) {
      const contentDirty = JSON.stringify(state2.document) !== state2.baselineJson;
      if (!contentDirty) {
        state2.savedRevision = state2.mutationRevision;
      }
    }
    state2.dirty = state2.mutationRevision !== state2.savedRevision;
  }
  function pushHistory() {
    if (state2.document) {
      history2.push(state2.document, state2.mutationRevision);
      syncFlags();
    }
  }
  return {
    get state() {
      return state2;
    },
    load(document2) {
      state2.document = cloneDoc(document2);
      state2.baselineJson = JSON.stringify(state2.document);
      state2.mutationRevision = 0;
      state2.savedRevision = 0;
      history2.reset(state2.document, 0);
      syncFlags();
    },
    dispatch(command, opts = {}) {
      if (!state2.document && command.type !== "replace") {
        return state2;
      }
      const recordHistory = opts.history !== false;
      const markDirty = opts.dirty !== false;
      const base = command.type === "replace" ? {
        uid: "",
        title: "",
        panels: [],
        schemaVersion: 39
      } : state2.document;
      const next = applyCommand(base, command);
      state2.document = next;
      if (command.type === "replace") {
        state2.baselineJson = JSON.stringify(next);
        state2.mutationRevision = 0;
        state2.savedRevision = 0;
        history2.reset(next, 0);
        syncFlags();
        return state2;
      }
      if (markDirty) {
        state2.mutationRevision += 1;
      }
      if (recordHistory) {
        pushHistory();
      } else {
        state2.canUndo = history2.canUndo();
        state2.canRedo = history2.canRedo();
        if (!markDirty) {
          state2.dirty = false;
        } else {
          state2.dirty = state2.mutationRevision !== state2.savedRevision;
        }
      }
      return state2;
    },
    undo() {
      if (!state2.document) return state2;
      const prev = history2.undo(state2.document);
      if (prev) {
        state2.document = prev.doc;
        state2.mutationRevision = prev.rev;
        syncFlags({ recomputeContentDirty: true });
      }
      return state2;
    },
    redo() {
      if (!state2.document) return state2;
      const next = history2.redo(state2.document);
      if (next) {
        state2.document = next.doc;
        state2.mutationRevision = next.rev;
        syncFlags({ recomputeContentDirty: true });
      }
      return state2;
    },
    markSaved(document2) {
      if (document2) state2.document = cloneDoc(document2);
      if (state2.document) {
        state2.baselineJson = JSON.stringify(state2.document);
        state2.savedRevision = state2.mutationRevision;
      }
      syncFlags();
      return state2;
    },
    syncWorking(document2) {
      state2.document = cloneDoc(document2);
      state2.mutationRevision += 1;
      syncFlags();
      return state2;
    },
    recordHistoryTip(baselineJson) {
      if (!state2.document) return state2;
      if (baselineJson != null) state2.baselineJson = baselineJson;
      history2.push(state2.document, state2.mutationRevision);
      syncFlags({ recomputeContentDirty: true });
      return state2;
    },
    snapshot() {
      return state2.document ? JSON.stringify(state2.document) : "";
    },
    resetHistory() {
      if (state2.document) history2.reset(state2.document, state2.mutationRevision);
      syncFlags();
    }
  };
}
function populateDatasourceVariableOptions(list, sources) {
  return list.map((v) => {
    if (v?.type !== "datasource") return v;
    const queryType = String(v.query ?? "").trim();
    const matches = sources.filter((d) => {
      if (!queryType) return true;
      return d.type === queryType || d.type.includes(queryType);
    });
    if (!matches.length) return v;
    const curVal = v.current?.value != null ? String(v.current.value) : "";
    const options = matches.map((d) => ({
      text: d.name || d.uid,
      value: d.uid,
      selected: curVal ? curVal === d.uid : false
    }));
    const current = options.find((o) => o.selected) ?? options[0];
    if (!options.some((o) => o.selected) && current) {
      options.forEach((o) => {
        o.selected = o.value === current.value;
      });
    }
    return {
      ...v,
      options,
      current: current ? { text: current.text, value: current.value } : v.current
    };
  });
}
function sanitizeEmbeddedDatasource(ds2) {
  const jsonData = { ...ds2.jsonData ?? {} };
  for (const key of Object.keys(jsonData)) {
    if (/token|password|secret|apiKey|authorization/i.test(key)) {
      delete jsonData[key];
    }
  }
  return {
    uid: String(ds2.uid ?? "").trim(),
    type: String(ds2.type ?? "").trim(),
    name: String(ds2.name ?? ds2.uid ?? "").trim() || String(ds2.uid ?? ""),
    url: String(ds2.url ?? "").trim(),
    basicAuth: Boolean(ds2.basicAuth),
    basicAuthUser: ds2.basicAuth ? String(ds2.basicAuthUser ?? "") : void 0,
    // never persist password/token
    jsonData,
    isDefault: Boolean(ds2.isDefault)
  };
}
function sanitizeEmbeddedDatasources(list) {
  if (!Array.isArray(list)) return [];
  const out = [];
  const seen = /* @__PURE__ */ new Set();
  for (const raw of list) {
    if (!raw || typeof raw !== "object") continue;
    const ds2 = sanitizeEmbeddedDatasource(raw);
    if (!ds2.uid || !ds2.type) continue;
    if (seen.has(ds2.uid)) continue;
    seen.add(ds2.uid);
    out.push(ds2);
  }
  return out;
}
function readEmbeddedDatasources(document2) {
  if (!document2) return [];
  return sanitizeEmbeddedDatasources(
    document2.datasources
  );
}
function registerEmbeddedDatasources(list, register2) {
  for (const ds2 of list) {
    const runtime = getRuntimeDataSourceSettings(ds2.uid);
    const url = String(ds2.url || runtime?.url || "").trim();
    const jsonData = {
      ...runtime?.jsonData ?? {},
      ...ds2.jsonData ?? {}
    };
    const plugin2 = getDataSourcePlugin(ds2.type);
    if (!plugin2?.createDataSource) {
      register2({
        id: 0,
        uid: ds2.uid,
        type: ds2.type,
        name: ds2.name,
        url,
        query: async () => ({ data: [] })
      });
      continue;
    }
    const api = plugin2.createDataSource({
      uid: ds2.uid,
      type: ds2.type,
      name: ds2.name,
      url,
      access: "proxy",
      basicAuth: ds2.basicAuth,
      basicAuthUser: ds2.basicAuthUser,
      jsonData,
      secureJsonData: {},
      meta: plugin2.meta ?? {},
      isDefault: ds2.isDefault
    });
    register2({
      uid: ds2.uid,
      type: ds2.type,
      name: ds2.name,
      url,
      isDefault: ds2.isDefault,
      ...api
    });
  }
}
function newEmbeddedDatasourceDraft(type = "grafana-testdata-datasource") {
  const stamp = Date.now().toString(36);
  return {
    uid: `${type.replaceAll(/[^a-z0-9-]+/gi, "-").toLowerCase()}-${stamp}`,
    type,
    name: "新数据源",
    url: "",
    jsonData: {},
    isDefault: false
  };
}
function readVariablesFromLocation(list) {
  if (typeof window === "undefined") return null;
  try {
    const params = new URLSearchParams(window.location.search);
    if (!list.length) return null;
    return applyVariablesFromUrl(list, params);
  } catch {
    return null;
  }
}
function writeVariablesToLocation(list) {
  if (typeof window === "undefined") return;
  try {
    const params = encodeVariablesToUrl(list, new URLSearchParams(window.location.search));
    const qs = params.toString();
    const url = `${window.location.pathname}${qs ? `?${qs}` : ""}${window.location.hash || ""}`;
    window.history.replaceState(null, "", url);
  } catch {
  }
}
function readTimeFromLocation() {
  if (typeof window === "undefined") return null;
  try {
    const params = new URLSearchParams(window.location.search);
    const from = String(params.get("from") ?? "").trim();
    const to = String(params.get("to") ?? "").trim();
    if (!from || !to) return null;
    return { from, to };
  } catch {
    return null;
  }
}
function writeTimeToLocation(from, to) {
  if (typeof window === "undefined") return;
  const f = String(from ?? "").trim();
  const t0 = String(to ?? "").trim();
  if (!f || !t0) return;
  try {
    const url = new URL(window.location.href);
    url.searchParams.set("from", f);
    url.searchParams.set("to", t0);
    const next = `${url.pathname}${url.search}${url.hash}`;
    const cur = `${window.location.pathname}${window.location.search}${window.location.hash}`;
    if (next !== cur) {
      window.history.replaceState(null, "", next);
    }
  } catch {
  }
}
function createDemoDashboard(uid) {
  const td = { type: "grafana-testdata-datasource", uid: "testdata" };
  const loki = { type: "loki", uid: "loki" };
  let y = 0;
  const row = (h2) => {
    const cur = y;
    y += h2;
    return cur;
  };
  const panels2 = [
    {
      id: 1,
      type: "text",
      title: "可视化全景演示",
      gridPos: { x: 0, y: row(3), w: 24, h: 3 },
      options: {
        mode: "markdown",
        content: "## Grafana-Vue 全可视化演示\n\n每种内置 Panel 均有演示数据（默认 **TestData / 离线 fixture**）。\n\n编辑面板 → **查询 / 转换 / 面板选项 / 字段** 与 Grafana 13.2 path 对齐。Job=`$job`"
      },
      targets: []
    },
    // KPI row
    {
      id: 2,
      type: "stat",
      title: "Stat",
      gridPos: { x: 0, y, w: 4, h: 4 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: {
        defaults: {
          unit: "short",
          thresholds: {
            mode: "absolute",
            steps: [
              { color: "green", value: null },
              { color: "red", value: 80 }
            ]
          }
        },
        overrides: []
      },
      options: {
        reduceOptions: { calcs: ["lastNotNull"], fields: "", values: false },
        colorMode: "background",
        graphMode: "area",
        textMode: "auto",
        orientation: "auto",
        justifyMode: "auto"
      }
    },
    {
      id: 3,
      type: "gauge",
      title: "Gauge",
      gridPos: { x: 4, y, w: 4, h: 4 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: {
        defaults: {
          min: 0,
          max: 100,
          thresholds: {
            mode: "absolute",
            steps: [
              { color: "green", value: null },
              { color: "yellow", value: 60 },
              { color: "red", value: 80 }
            ]
          }
        },
        overrides: []
      },
      options: {
        showThresholdLabels: false,
        showThresholdMarkers: true,
        sizing: "auto",
        orientation: "auto"
      }
    },
    {
      id: 4,
      type: "bargauge",
      title: "Bar gauge",
      gridPos: { x: 8, y, w: 4, h: 4 },
      targets: [
        {
          refId: "A",
          datasource: td,
          scenarioId: "csv_metric_values",
          // Default Grafana csv ends with 0 → lastNotNull shows empty-looking 0
          // on this short KPI row. Keep calc mode (matches Stat/Gauge row) with
          // a non-zero tail. Multi-bar (values:true) needs taller panels.
          stringInput: "10,25,40,15,30,70"
        }
      ],
      fieldConfig: {
        defaults: { min: 0, max: 100, unit: "percent" },
        overrides: []
      },
      options: {
        reduceOptions: { calcs: ["lastNotNull"], fields: "", values: false },
        displayMode: "gradient",
        orientation: "horizontal",
        showUnfilled: true,
        valueMode: "color",
        namePlacement: "auto"
      }
    },
    {
      id: 5,
      type: "table",
      title: "Table",
      gridPos: { x: 12, y, w: 6, h: 4 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk_table" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: { showHeader: true, cellHeight: "sm", footer: { show: false } }
    },
    {
      id: 6,
      type: "piechart",
      title: "Pie chart",
      gridPos: { x: 18, y, w: 6, h: 4 },
      targets: [
        {
          refId: "A",
          datasource: td,
          scenarioId: "csv_metric_values",
          stringInput: "10,25,40,15,30"
        }
      ],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        reduceOptions: { calcs: ["lastNotNull"], fields: "", values: true },
        pieType: "pie",
        tooltip: { mode: "single", sort: "none" },
        legend: { displayMode: "list", placement: "right", showLegend: true }
      }
    }
  ];
  y += 4;
  panels2.push(
    {
      id: 7,
      type: "timeseries",
      title: "Time series",
      gridPos: { x: 0, y, w: 12, h: 8 },
      targets: [
        {
          refId: "A",
          datasource: td,
          scenarioId: "random_walk",
          alias: "series-A"
        }
      ],
      fieldConfig: {
        defaults: {
          unit: "short",
          custom: {
            drawStyle: "line",
            lineInterpolation: "smooth",
            fillOpacity: 20,
            showPoints: "never",
            spanNulls: false
          }
        },
        overrides: []
      },
      options: {
        legend: {
          showLegend: true,
          displayMode: "list",
          placement: "bottom",
          calcs: []
        },
        tooltip: { mode: "single", sort: "none" }
      }
    },
    {
      id: 8,
      type: "trend",
      title: "Trend",
      gridPos: { x: 12, y, w: 6, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "linear_trend" }],
      fieldConfig: {
        defaults: { custom: { drawStyle: "line", fillOpacity: 15 } },
        overrides: []
      },
      options: {
        legend: { showLegend: true, displayMode: "list", placement: "bottom" },
        tooltip: { mode: "single" }
      }
    },
    {
      id: 9,
      type: "barchart",
      title: "Bar chart",
      gridPos: { x: 18, y, w: 6, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "csv_metric_values" }],
      fieldConfig: {
        defaults: { custom: { drawStyle: "bars", fillOpacity: 80 } },
        overrides: []
      },
      options: {
        orientation: "auto",
        showValue: "auto",
        stacking: "none",
        barWidth: 0.9,
        groupWidth: 0.7,
        barRadius: 0,
        xTickLabelRotation: -30,
        fullHighlight: false,
        gradientMode: "hue",
        legend: { showLegend: true, displayMode: "list", placement: "bottom" },
        tooltip: { mode: "single", sort: "none" }
      }
    }
  );
  y += 8;
  panels2.push(
    {
      id: 10,
      type: "histogram",
      title: "Histogram",
      gridPos: { x: 0, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        bucketCount: 24,
        combine: false,
        fillOpacity: 70,
        gradientMode: "hue",
        stacking: "none",
        lineWidth: 1,
        legend: { showLegend: true, displayMode: "list", placement: "bottom" }
      }
    },
    {
      id: 11,
      type: "heatmap",
      title: "Heatmap",
      gridPos: { x: 8, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        calculate: true,
        cellGap: 2,
        showValue: "auto",
        color: {
          mode: "scheme",
          scheme: "Spectral",
          steps: 64,
          reverse: false
        },
        legend: { show: true },
        tooltip: { mode: "single", yHistogram: true, showColorScale: true },
        yAxis: { axisPlacement: "left" }
      }
    },
    {
      id: 12,
      type: "candlestick",
      title: "Candlestick",
      gridPos: { x: 16, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "predictable_csv_wave" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        mode: "candles+volume",
        candleStyle: "candles",
        colorStrategy: "open-close",
        colors: { up: "green", down: "red", flat: "gray" },
        includeAllFields: false,
        legend: { showLegend: true, displayMode: "list", placement: "bottom" },
        tooltip: { mode: "single" }
      }
    }
  );
  y += 8;
  panels2.push(
    {
      id: 13,
      type: "state-timeline",
      title: "State timeline",
      gridPos: { x: 0, y, w: 12, h: 6 },
      targets: [{ refId: "A", datasource: td, scenarioId: "predictable_pulse" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        mergeValues: true,
        showValue: "auto",
        alignValue: "left",
        rowHeight: 0.9,
        legend: { showLegend: true }
      }
    },
    {
      id: 14,
      type: "status-history",
      title: "Status history",
      gridPos: { x: 12, y, w: 12, h: 6 },
      targets: [{ refId: "A", datasource: td, scenarioId: "predictable_pulse" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        showValue: "auto",
        rowHeight: 0.9,
        colWidth: 0.9,
        legend: { showLegend: true }
      }
    }
  );
  y += 6;
  panels2.push(
    {
      id: 15,
      type: "xychart",
      title: "XY chart",
      gridPos: { x: 0, y, w: 8, h: 8 },
      // needs ≥2 numeric fields (usa: lat + value)
      targets: [{ refId: "A", datasource: td, scenarioId: "usa" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        seriesMapping: "auto",
        dims: { x: "lat", y: "value" },
        legend: { showLegend: true, displayMode: "list", placement: "bottom" },
        tooltip: { mode: "single" }
      }
    },
    {
      id: 16,
      type: "geomap",
      title: "Geomap",
      gridPos: { x: 8, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "usa" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        view: { id: "zero", lat: 0, lon: 0, zoom: 1 },
        basemap: { type: "default", name: "Layer 0" },
        layers: [{ type: "markers", name: "Markers", config: {} }],
        controls: {
          showZoom: true,
          mouseWheelZoom: true,
          showAttribution: true
        }
      }
    },
    {
      id: 17,
      type: "nodeGraph",
      title: "Node graph",
      gridPos: { x: 16, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "node_graph" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        nodes: { mainStatUnit: "short" },
        edges: { mainStatUnit: "short" }
      }
    }
  );
  y += 8;
  panels2.push(
    {
      id: 18,
      type: "logs",
      title: "Logs",
      gridPos: { x: 0, y, w: 12, h: 8 },
      targets: [
        { refId: "A", datasource: td, scenarioId: "logs" },
        {
          refId: "B",
          datasource: loki,
          expr: '{job="$job"}',
          scenarioId: "logs"
        }
      ],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        showTime: true,
        showLabels: false,
        showCommonLabels: false,
        wrapLogMessage: false,
        prettifyLogMessage: false,
        enableLogDetails: true,
        sortOrder: "Descending",
        dedupStrategy: "none"
      }
    },
    {
      id: 19,
      type: "logstable",
      title: "Logs table",
      gridPos: { x: 12, y, w: 12, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "logs" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: { showHeader: true }
    }
  );
  y += 8;
  panels2.push(
    {
      id: 20,
      type: "traces",
      title: "Traces",
      gridPos: { x: 0, y, w: 12, h: 10 },
      // Offline showcase: TestData trace scenario (tempo may be unregistered).
      targets: [{ refId: "A", datasource: td, scenarioId: "trace" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 21,
      type: "flamegraph",
      title: "Flame graph",
      gridPos: { x: 12, y, w: 12, h: 10 },
      targets: [{ refId: "A", datasource: td, scenarioId: "flame_graph" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    }
  );
  y += 10;
  panels2.push(
    {
      id: 22,
      type: "canvas",
      title: "Canvas",
      gridPos: { x: 0, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        inlineEditing: false,
        showAdvancedTypes: true,
        root: {
          type: "frame",
          elements: [
            {
              type: "metric-value",
              name: "Metric",
              field: "Value",
              config: { align: "center" },
              placement: { top: 24, left: 24, width: 160, height: 48 },
              x: 24,
              y: 24,
              w: 160,
              h: 48
            },
            {
              type: "text",
              name: "Label",
              config: { text: { fixed: "Canvas 演示" } },
              placement: { top: 88, left: 24, width: 200, height: 28 },
              x: 24,
              y: 88,
              text: "Canvas 演示",
              fontSize: 14
            }
          ]
        }
      }
    },
    {
      id: 23,
      type: "news",
      title: "News",
      gridPos: { x: 8, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        feedUrl: "https://grafana.com/blog/index.xml",
        showImage: true
      }
    },
    {
      id: 24,
      type: "dashlist",
      title: "Dashboard list",
      gridPos: { x: 16, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        showStarred: true,
        showRecentlyViewed: true,
        showSearch: true,
        showHeadings: true,
        maxItems: 10,
        query: "",
        tags: []
      }
    }
  );
  y += 8;
  panels2.push(
    {
      id: 25,
      type: "alertlist",
      title: "Alert list",
      gridPos: { x: 0, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        maxItems: 10,
        sortOrder: 1,
        dashboardAlerts: false,
        stateFilter: {
          firing: true,
          pending: true,
          noData: false,
          normal: false,
          error: true
        },
        alertName: "",
        viewMode: "list",
        groupMode: "default"
      }
    },
    {
      id: 26,
      type: "annolist",
      title: "Annotation list",
      gridPos: { x: 8, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        limit: 10,
        onlyFromThisDashboard: false,
        onlyInTimeRange: true,
        tags: [],
        navigateBefore: "10m",
        navigateAfter: "10m",
        navigateToPanel: true,
        showUser: true,
        showTime: true,
        showTags: true
      }
    },
    {
      id: 27,
      type: "live",
      title: "Live",
      gridPos: { x: 16, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: { channel: "grafana/live/demo", message: "", display: "json" }
    }
  );
  y += 8;
  panels2.push(
    {
      id: 28,
      type: "debug",
      title: "Debug",
      gridPos: { x: 0, y, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {
        mode: "render",
        counters: { render: true, dataChanged: true, schemaChanged: true }
      }
    },
    {
      id: 29,
      type: "gettingstarted",
      title: "Getting started",
      gridPos: { x: 8, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 30,
      type: "welcome",
      title: "Welcome",
      gridPos: { x: 16, y, w: 8, h: 8 },
      targets: [],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 31,
      type: "clock",
      title: "clock",
      gridPos: { x: 0, y: y + 8 + 0, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 32,
      type: "statusmap",
      title: "statusmap",
      gridPos: { x: 8, y: y + 8 + 0, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 33,
      type: "polystat",
      title: "polystat",
      gridPos: { x: 16, y: y + 8 + 0, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 34,
      type: "button",
      title: "button",
      gridPos: { x: 0, y: y + 8 + 8, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 35,
      type: "dynamictext",
      title: "dynamictext",
      gridPos: { x: 8, y: y + 8 + 8, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 36,
      type: "gantt",
      title: "gantt",
      gridPos: { x: 16, y: y + 8 + 8, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: { showLabel: true }
    },
    {
      id: 37,
      type: "sankey",
      title: "sankey",
      gridPos: { x: 0, y: y + 8 + 16, w: 8, h: 8 },
      // node_graph offline fixture provides id/title (+ edges when present)
      targets: [{ refId: "A", datasource: td, scenarioId: "node_graph" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 38,
      type: "radar",
      title: "radar",
      gridPos: { x: 8, y: y + 8 + 16, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "usa" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 39,
      type: "funnel",
      title: "funnel",
      gridPos: { x: 16, y: y + 8 + 16, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "usa" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 40,
      type: "wordcloud",
      title: "wordcloud",
      gridPos: { x: 0, y: y + 8 + 24, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "usa" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 41,
      type: "treemap",
      title: "treemap",
      gridPos: { x: 8, y: y + 8 + 24, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "usa" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: {}
    },
    {
      id: 42,
      type: "hourly-heatmap",
      title: "hourly-heatmap",
      // Week window → real day×hour coverage; panel also spreads if still sparse.
      timeFrom: "now-7d",
      gridPos: { x: 16, y: y + 8 + 24, w: 8, h: 8 },
      targets: [{ refId: "A", datasource: td, scenarioId: "random_walk" }],
      fieldConfig: { defaults: {}, overrides: [] },
      options: { showValues: false, scheme: "Blues" }
    }
  );
  return {
    uid,
    title: `可视化全景演示 · ${uid}`,
    tags: ["demo", "all-panels", "vue"],
    schemaVersion: 39,
    timezone: "browser",
    refresh: "30s",
    time: { from: "now-6h", to: "now" },
    templating: {
      list: [
        {
          name: "job",
          type: "custom",
          label: "Job",
          current: { text: "api", value: "api" },
          options: [
            { text: "api", value: "api", selected: true },
            { text: "web", value: "web" },
            { text: "db", value: "db" }
          ],
          query: "api,web,db",
          includeAll: false,
          multi: false
        },
        {
          name: "interval",
          type: "interval",
          label: "Interval",
          current: { text: "1m", value: "1m" },
          query: "1m,5m,10m,1h",
          auto: true,
          auto_count: 30,
          auto_min: "10s"
        }
      ]
    },
    annotations: {
      list: [
        {
          name: "Deploys",
          enable: true,
          iconColor: "blue",
          datasource: td,
          target: { expr: "deploy" }
        }
      ]
    },
    panels: panels2
  };
}
function createPanelLibraryActions(opts) {
  function copySelectedPanel(panelId) {
    const panel2 = opts.getDocument()?.panels?.find((p) => p.id === panelId);
    if (panel2) copyPanel(panel2);
  }
  function pasteClipboardPanel() {
    const doc = opts.getDocument();
    if (!doc || !hasClipboardPanel()) return;
    const id = nextPanelId(doc);
    const panel2 = pastePanel(id);
    if (!panel2) return;
    opts.applyDocument({ type: "upsert-panel", panel: panel2 });
    void opts.refreshPanel(panel2);
  }
  function duplicateSelectedPanel(panelId) {
    const doc = opts.getDocument();
    if (!doc) return;
    const panel2 = doc.panels?.find((p) => p.id === panelId);
    if (!panel2) return;
    const id = nextPanelId(doc);
    const dup = duplicatePanel(panel2, id);
    opts.applyDocument({ type: "upsert-panel", panel: dup });
    void opts.refreshPanel(dup);
  }
  function setSelectedPanels(ids) {
    opts.selectedPanelIds.value = ids;
  }
  function saveSelectedAsLibraryPanel(panelId, name) {
    const panel2 = opts.getDocument()?.panels?.find((p) => p.id === panelId);
    if (!panel2) return null;
    const plain2 = JSON.parse(JSON.stringify(panel2));
    return saveLibraryPanel(plain2, name || plain2.title || `Panel ${panelId}`);
  }
  function addLibraryPanelToDashboard(uid) {
    const doc = opts.getDocument();
    if (!doc) return;
    const id = nextPanelId(doc);
    const panel2 = instantiateLibraryPanel(uid, id);
    if (!panel2) return;
    const maxY = Math.max(
      0,
      ...(doc.panels ?? []).map((p) => (p.gridPos?.y ?? 0) + (p.gridPos?.h ?? 0))
    );
    panel2.gridPos = {
      x: 0,
      y: maxY,
      w: panel2.gridPos?.w ?? 12,
      h: panel2.gridPos?.h ?? 8
    };
    opts.applyDocument({ type: "upsert-panel", panel: panel2 });
    void opts.refreshPanel(panel2);
  }
  function listSavedLibraryPanels() {
    return listLibraryPanels();
  }
  function unlinkLibraryPanel$1(panelId) {
    const doc = opts.getDocument();
    if (!doc) return;
    const panel2 = doc.panels?.find((p) => p.id === panelId);
    if (!panel2 || !panel2.libraryPanel) return;
    opts.applyDocument({ type: "upsert-panel", panel: unlinkLibraryPanel(panel2) });
  }
  return {
    copySelectedPanel,
    pasteClipboardPanel,
    duplicateSelectedPanel,
    setSelectedPanels,
    saveSelectedAsLibraryPanel,
    addLibraryPanelToDashboard,
    listSavedLibraryPanels,
    unlinkLibraryPanel: unlinkLibraryPanel$1
  };
}
function bindCatalogRegistration(catalog) {
  function registerDataSource(ds2) {
    catalog.register(ds2);
    registerRuntimeDataSource(ds2.uid, ds2);
  }
  function unregisterDataSource(uid) {
    catalog.dispose(uid);
    unregisterRuntimeDataSource(uid);
  }
  async function ensureBuiltinDataSources() {
    try {
      await registerHeavyPlugins();
    } catch (error) {
      if (typeof console !== "undefined") {
        console.error(
          "[grafana-vue] heavy plugin registration failed before catalog configure",
          error
        );
      }
    }
    await catalog.configure({
      getDataSourcePlugin: (type) => getDataSourcePlugin(type),
      registerRuntimeDataSource: (uid, ds2) => registerRuntimeDataSource(uid, ds2),
      unregisterRuntimeDataSource: (uid) => unregisterRuntimeDataSource(uid)
    });
    if (typeof catalog.whenReady === "function") {
      await catalog.whenReady();
    }
  }
  return { registerDataSource, unregisterDataSource, ensureBuiltinDataSources };
}
const useDashboardStore = defineStore("dashboard", () => {
  const document2 = ref(null);
  const dirty = ref(false);
  const neverSaved = ref(false);
  const editMode = ref(false);
  const loading = ref(false);
  const error = ref(null);
  const loadRuntime = new DashboardLoadRuntime();
  const refreshRuntime = new DashboardRefreshRuntime();
  const panelData = shallowRef({});
  const time = ref({ from: "now-6h", to: "now" });
  const timezone = ref("browser");
  const weekStart = ref("");
  const liveNow = ref(false);
  const refresh = ref("");
  const isRefreshing = ref(false);
  const autoRefreshTickCount = ref(0);
  const liveNowTickCount = ref(0);
  let refreshTimer = null;
  let liveNowTimer = null;
  let refreshInFlight = null;
  let visibilityHandler = null;
  const autoRefreshRunner = {
    run: async () => {
    }
  };
  const originalJson = ref("");
  const saving = ref(false);
  const saveError = ref(null);
  let persistenceHandler = null;
  let saveInFlight = null;
  const catalog = getDataSourceCatalog();
  const canUndo = ref(false);
  const canRedo = ref(false);
  const annotationEvents = ref([]);
  const selectedPanelIds = ref([]);
  const _varsSnapshot = ref("");
  function _snapshotVariables() {
    const list = document2.value?.templating?.list ?? [];
    _varsSnapshot.value = JSON.stringify(list.map((v) => ({ n: v.name, c: v.current })));
  }
  function _variablesCurrentChanged() {
    const list = document2.value?.templating?.list ?? [];
    const now2 = JSON.stringify(list.map((v) => ({ n: v.name, c: v.current })));
    return now2 !== _varsSnapshot.value;
  }
  function resolveDsOrStub(ref2) {
    let resolvedRef = ref2;
    if (resolvedRef == null || resolvedRef === "") {
      try {
        return catalog.resolve("default");
      } catch {
        resolvedRef = { uid: "default", type: "grafana-testdata-datasource" };
      }
    }
    if (resolvedRef && typeof resolvedRef === "object" && typeof resolvedRef.uid === "string" && /\$\{[^}]+\}/.test(resolvedRef.uid)) {
      const rawUid = String(resolvedRef.uid);
      const inner = rawUid.replace(/^\$\{/, "").replace(/\}$/, "");
      resolvedRef = {
        ...resolvedRef,
        uid: inner.replace(/^DS_/, "").toLowerCase() || rawUid
      };
    }
    try {
      return catalog.resolve(resolvedRef);
    } catch (error_) {
      if (error_ instanceof DataSourceError) {
        const err = error_;
        return {
          id: 0,
          uid: typeof resolvedRef === "string" ? resolvedRef : resolvedRef?.uid || "missing",
          type: typeof resolvedRef === "string" ? "unknown" : resolvedRef?.type || "unknown",
          name: "Unresolved",
          query: async () => {
            throw err;
          }
        };
      }
      throw error_;
    }
  }
  const scheduler = new QueryScheduler({
    // Single concurrency layer (Task 7): min(4, max(2, cores-2))
    concurrency: Math.min(
      4,
      Math.max(
        2,
        (typeof navigator !== "undefined" ? navigator.hardwareConcurrency ?? 4 : 4) - 2
      )
    ),
    resolveDataSource: (ref2) => resolveDsOrStub(ref2),
    // Manual refresh can bypass by clearCache(); TTL only when explicitly useful.
    cacheTtlMs: 0,
    maxCacheEntries: 200,
    maxCacheBytes: 32 * 1024 * 1024
  });
  const panelAbort = /* @__PURE__ */ new Map();
  const visiblePanels = ref(/* @__PURE__ */ new Set());
  function setPanelVisible(panelId, visible) {
    const was = visiblePanels.value.has(panelId);
    const s = new Set(visiblePanels.value);
    if (visible) s.add(panelId);
    else s.delete(panelId);
    visiblePanels.value = s;
    if (visible && !was) {
      const panel2 = panels2.value.find((p) => p.id === panelId || Number(p.id) === panelId) ?? (document2.value?.panels ?? []).find((p) => p.id === panelId || Number(p.id) === panelId);
      if (panel2) void refreshPanel(panel2);
    }
  }
  const panelQueryEngine = createPanelQueryEngine({
    scheduler,
    resolveDataSource: (ref2) => resolveDsOrStub(ref2),
    postProcess: (data, panel2) => {
      const pipeline = runPanelDataPipeline({
        series: data.series ?? [],
        transformations: panel2.transformations ?? [],
        fieldConfigDefaults: panel2.fieldConfig?.defaults ?? {},
        fieldConfigOverrides: panel2.fieldConfig?.overrides ?? [],
        state: data.state,
        timeRange: data.timeRange,
        requestId: data.request?.requestId ?? data.requestId,
        errors: data.errors,
        error: data.error
      });
      const series = (pipeline.series ?? []).map((f) => markRaw(f));
      return {
        ...data,
        ...pipeline.panelData,
        series,
        seriesBeforeTransform: data.series,
        transformSteps: pipeline.transformTrace,
        annotations: annotationEvents.value.map((e) => ({
          time: e.time,
          timeEnd: e.timeEnd,
          title: e.title,
          text: e.text,
          color: e.color,
          tags: e.tags
        }))
      };
    }
  });
  const dashboardDocument = createDashboardDocument();
  function syncFromDocument() {
    document2.value = dashboardDocument.state.document;
    dirty.value = dashboardDocument.state.dirty;
    canUndo.value = dashboardDocument.state.canUndo;
    canRedo.value = dashboardDocument.state.canRedo;
  }
  function syncHistoryFlags() {
    canUndo.value = dashboardDocument.state.canUndo;
    canRedo.value = dashboardDocument.state.canRedo;
  }
  function pushHistory() {
    if (!document2.value) return;
    const baseline = originalJson.value || dashboardDocument.state.baselineJson;
    if (!dashboardDocument.state.document) {
      dashboardDocument.load(document2.value);
      if (baseline) {
        dashboardDocument.state.baselineJson = baseline;
      }
    } else {
      dashboardDocument.syncWorking(document2.value);
    }
    dashboardDocument.recordHistoryTip(baseline);
    syncFromDocument();
    originalJson.value = baseline;
  }
  function applyDocument(command, opts) {
    if (!dashboardDocument.state.document && document2.value && command.type !== "replace") {
      dashboardDocument.load(document2.value);
      if (originalJson.value) {
        dashboardDocument.state.baselineJson = originalJson.value;
      }
    }
    dashboardDocument.dispatch(command, opts);
    syncFromDocument();
  }
  const panels2 = computed(() => {
    const list = document2.value?.panels ?? [];
    const vars = document2.value?.templating?.list ?? [];
    const repeatValues = {};
    for (const v of vars) {
      if (!v?.name) continue;
      const cur = v.current?.value;
      if (Array.isArray(cur) && cur.length) {
        repeatValues[v.name] = cur.map(String);
      } else if (cur != null && cur !== "" && cur !== "$__all") {
        repeatValues[v.name] = [String(cur)];
      } else {
        const opts = (v.options ?? []).map((o) => String(o.value ?? o.text ?? "")).filter((x) => x && x !== "$__all");
        if (opts.length) repeatValues[v.name] = opts;
      }
    }
    return expandRepeats(list, repeatValues);
  });
  const layout = computed(() => panelsToLayout(panels2.value));
  const title = computed(() => document2.value?.title ?? "");
  const scene = computed(
    () => document2.value ? buildSceneGraph(document2.value, time.value) : null
  );
  const { registerDataSource, unregisterDataSource, ensureBuiltinDataSources } = bindCatalogRegistration(catalog);
  function syncVariablesFromLocation() {
    if (!document2.value) return;
    const list = document2.value.templating?.list ?? [];
    const next = readVariablesFromLocation(list);
    if (!next) return;
    applyDocument({ type: "set-variables", list: next }, { history: false, dirty: false });
    dirty.value = false;
    if (originalJson.value) {
      dashboardDocument.state.baselineJson = originalJson.value;
      dashboardDocument.state.dirty = false;
    }
  }
  function syncVariablesToLocation() {
    if (!document2.value) return;
    writeVariablesToLocation(document2.value.templating?.list ?? []);
  }
  async function loadByUid(uid) {
    const gen = loadRuntime.begin(uid);
    loading.value = true;
    error.value = null;
    try {
      let raw;
      const liveBuilders = getLiveDashboardBuilders();
      const liveFactory = uid in liveBuilders ? liveBuilders[uid] : void 0;
      const imported = liveFactory ? void 0 : getImportedDashboard(uid);
      if (imported) {
        raw = imported;
      } else if (liveFactory) {
        raw = liveFactory();
      } else {
        if (uid === "vue-demo" || uid === "demo") {
          raw = createDemoDashboard(uid);
        } else {
          try {
            const res = await backendSrv.get(`/api/dashboards/uid/${uid}`);
            raw = res.data.dashboard;
          } catch {
            raw = createDemoDashboard(uid);
          }
        }
      }
      if (!loadRuntime.isCurrent(gen)) return;
      document2.value = loadDashboardDocument(raw);
      dashboardDocument.load(document2.value);
      neverSaved.value = isImportedDashboardPendingSave(uid);
      originalJson.value = dashboardDocument.snapshot();
      time.value = {
        from: document2.value.time?.from ?? "now-6h",
        to: document2.value.time?.to ?? "now"
      };
      const urlTime = readTimeFromLocation();
      if (urlTime) {
        time.value = { from: urlTime.from, to: urlTime.to };
      }
      timezone.value = document2.value.timezone || "browser";
      weekStart.value = String(document2.value.weekStart ?? "");
      liveNow.value = document2.value.liveNow === true;
      if (document2.value?.editable === false) {
        editMode.value = false;
        selectedPanelIds.value = [];
      }
      applyRefreshFromDocument();
      restartLiveNow();
      dirty.value = false;
      syncHistoryFlags();
      syncVariablesFromLocation();
      loadRuntime.commitDocument(gen);
      perfMark("dashboard-document-ready");
      loading.value = false;
      loadRuntime.markShellInteractive(gen);
      perfMark("dashboard-interactive");
      _snapshotVariables();
      loadRuntime.startHydration(gen);
      void (async () => {
        try {
          const deps = extractDashboardDependencies(raw);
          if (deps.needsHeavyPlugins.geomap || deps.needsHeavyPlugins.zabbix || deps.needsHeavyPlugins.signoz) {
            await registerHeavyPlugins(deps.needsHeavyPlugins);
          }
          if (!loadRuntime.isCurrent(gen)) return;
          await ensureBuiltinDataSources();
          if (!loadRuntime.isCurrent(gen)) return;
          const varsP = refreshVariables("load").catch((error_) => {
            console.warn(
              "[dashboard] refreshVariables failed:",
              error_ instanceof Error ? error_.message : error_
            );
          });
          await new Promise(
            (r) => typeof requestAnimationFrame === "function" ? requestAnimationFrame(() => r()) : setTimeout(r, 0)
          );
          if (!loadRuntime.isCurrent(gen)) return;
          const panelsP = refreshAllPanels();
          varsP.then(() => {
            if (!loadRuntime.isCurrent(gen)) return;
            if (_variablesCurrentChanged()) void refreshAllPanels();
          }).catch(() => {
          });
          await panelsP;
          if (!loadRuntime.isCurrent(gen)) return;
          loadRuntime.markReady(gen);
          if (loadRuntime.consumeRerun()) {
            void refreshAllPanels();
          }
        } catch (error_) {
          if (!loadRuntime.isCurrent(gen)) return;
          loadRuntime.fail(gen, error_ instanceof Error ? error_.message : String(error_));
        }
      })();
    } catch (error_) {
      if (!loadRuntime.isCurrent(gen)) return;
      error.value = error_ instanceof Error ? error_.message : String(error_);
      loadRuntime.fail(gen, error.value);
      loading.value = false;
    }
  }
  async function loadLocal(raw) {
    const gen = loadRuntime.begin(null);
    loading.value = true;
    error.value = null;
    try {
      document2.value = loadDashboardDocument(raw);
      dashboardDocument.load(document2.value);
      neverSaved.value = isImportedDashboardPendingSave(String(document2.value?.uid ?? ""));
      applyDocumentEmbeddedDatasources();
      syncVariablesFromLocation();
      originalJson.value = dashboardDocument.snapshot();
      time.value = {
        from: document2.value.time?.from ?? "now-6h",
        to: document2.value.time?.to ?? "now"
      };
      timezone.value = document2.value.timezone || "browser";
      weekStart.value = String(document2.value.weekStart ?? "");
      liveNow.value = document2.value.liveNow === true;
      if (document2.value?.editable === false) {
        editMode.value = false;
        selectedPanelIds.value = [];
      }
      applyRefreshFromDocument();
      restartLiveNow();
      dirty.value = false;
      syncHistoryFlags();
      if (!loadRuntime.isCurrent(gen)) return;
      loadRuntime.commitDocument(gen);
      perfMark("dashboard-document-ready");
      loading.value = false;
      loadRuntime.markShellInteractive(gen);
      perfMark("dashboard-interactive");
      loadRuntime.startHydration(gen);
      void (async () => {
        try {
          await ensureBuiltinDataSources();
          if (!loadRuntime.isCurrent(gen)) return;
          try {
            await refreshVariables("load");
          } catch (error_) {
            console.warn(
              "[dashboard] refreshVariables failed:",
              error_ instanceof Error ? error_.message : error_
            );
          }
          if (!loadRuntime.isCurrent(gen)) return;
          await refreshAllPanels();
          if (!loadRuntime.isCurrent(gen)) return;
          loadRuntime.markReady(gen);
          if (loadRuntime.consumeRerun()) void refreshAllPanels();
        } catch (error_) {
          if (!loadRuntime.isCurrent(gen)) return;
          loadRuntime.fail(gen, error_ instanceof Error ? error_.message : String(error_));
        }
      })();
    } catch (error_) {
      if (!loadRuntime.isCurrent(gen)) return;
      error.value = error_ instanceof Error ? error_.message : String(error_);
      loadRuntime.fail(gen, error.value);
      loading.value = false;
    }
  }
  function readTimepicker() {
    const tp = document2.value?.timepicker;
    return tp && typeof tp === "object" ? tp : {};
  }
  function getRefreshIntervals() {
    const tp = readTimepicker();
    const raw = tp.refresh_intervals ?? tp.refreshIntervals ?? tp.refresh_intervals;
    if (Array.isArray(raw) && raw.length) {
      return raw.map(String).filter(Boolean);
    }
    return [...defaultRefreshIntervals];
  }
  function getQuickRanges() {
    const tp = readTimepicker();
    const raw = tp.quick_ranges ?? tp.quickRanges ?? tp.quick_ranges;
    if (!Array.isArray(raw) || !raw.length) return null;
    const out = [];
    for (const item of raw) {
      if (!item || typeof item !== "object") continue;
      const o = item;
      const from = String(o.from ?? "").trim();
      const to = String(o.to ?? "").trim();
      if (!from || !to) continue;
      const label = String(o.display ?? o.label ?? `${from} → ${to}`);
      out.push({ label, from, to });
    }
    return out.length ? out : null;
  }
  function isTimepickerHidden() {
    const tp = readTimepicker();
    return tp.hidden === true || tp.hide === true;
  }
  function getNowDelayMs() {
    const tp = readTimepicker();
    const raw = tp.nowDelay ?? tp.now_delay ?? tp.nowDelay;
    if (raw == null || raw === "") return 0;
    if (typeof raw === "number" && Number.isFinite(raw)) return Math.max(0, raw);
    return intervalToMs(String(raw));
  }
  function getFiscalYearStartMonth() {
    const n = Number(document2.value?.fiscalYearStartMonth ?? 0);
    return Number.isFinite(n) ? n : 0;
  }
  function getTimeRange() {
    return rangeUtil_parse(time.value, /* @__PURE__ */ new Date(), {
      nowDelayMs: getNowDelayMs(),
      fiscalYearStartMonth: getFiscalYearStartMonth(),
      weekStart: weekStart.value,
      timezone: timezone.value
    });
  }
  function getRangeParseOpts() {
    return {
      nowDelayMs: getNowDelayMs(),
      fiscalYearStartMonth: getFiscalYearStartMonth(),
      weekStart: weekStart.value,
      timezone: timezone.value
    };
  }
  function getPanelTimeOverride(panel2) {
    const dashboardRange = getTimeRange();
    const varList = document2.value?.templating?.list ?? [];
    const scoped = buildScopedVars(varList);
    const timeFromRaw = panel2.timeFrom;
    const timeShiftRaw = panel2.timeShift;
    const timeFrom = timeFromRaw == null || timeFromRaw === "" ? "" : replaceVariables(String(timeFromRaw), scoped);
    const timeShift2 = timeShiftRaw == null || timeShiftRaw === "" ? "" : replaceVariables(String(timeShiftRaw), scoped);
    return applyPanelTimeOverride(
      dashboardRange,
      {
        timeFrom: timeFrom || null,
        timeShift: timeShift2 || null,
        hideTimeOverride: panel2.hideTimeOverride
      },
      /* @__PURE__ */ new Date(),
      getRangeParseOpts()
    );
  }
  function freezePanelData(data) {
    const series = (data.series ?? []).map((f) => {
      const fields = Array.isArray(f?.fields) ? f.fields.map((field) => markRaw(field)) : f?.fields;
      return markRaw({ ...f, fields });
    });
    return markRaw({ ...data, series });
  }
  function setPanelData(panelId, data) {
    const frozen = freezePanelData(data);
    if (panelData.value[panelId] === frozen) return;
    panelData.value = Object.assign({}, panelData.value, {
      [panelId]: frozen
    });
  }
  async function refreshPanel(panel2) {
    if (!document2.value) return;
    const panelId = panel2.id;
    panelAbort.get(panelId)?.abort();
    const ac = new AbortController();
    panelAbort.set(panelId, ac);
    const requestId = `panel-${panelId}-${Date.now()}`;
    const prev = panelData.value[panelId];
    const override = getPanelTimeOverride(panel2);
    const panelRange = override.range;
    const timeInfo = override.showOverride ? override.timeInfo || void 0 : void 0;
    setPanelData(panelId, {
      state: LoadingStateEnum.Loading,
      // Stale-while-revalidate: keep last Done series so chrome stays populated.
      series: prev?.series ?? [],
      timeRange: panelRange,
      timeInfo,
      request: { requestId },
      annotations: prev?.annotations
    });
    const varList = document2.value.templating?.list ?? [];
    const scoped = {
      ...buildScopedVars(varList),
      // Grafana PanelModel.scopedVars from panel repeat clones
      ...panel2.scopedVars ?? {}
    };
    const repeatVar = String(panel2.repeatVar ?? panel2.repeat ?? "");
    const repeatValue = panel2.repeatValue;
    if (repeatVar && repeatValue != null && repeatValue !== "") {
      scoped[repeatVar] = {
        text: String(repeatValue),
        value: String(repeatValue)
      };
    }
    const adhoc = collectAdhocFilters(varList);
    const { panelDs, targets } = buildInterpolatedTargets(panel2, scoped, adhoc);
    const result = await panelQueryEngine.execute(
      {
        id: panelId,
        targets,
        datasource: panelDs,
        transformations: panel2.transformations,
        fieldConfig: panel2.fieldConfig,
        options: panel2.options,
        title: panel2.title,
        type: panel2.type
      },
      {
        timeRange: panelRange,
        scopedVars: scoped,
        requestId,
        maxDataPoints: resolvePanelMaxDataPoints(panel2),
        intervalMs: resolvePanelIntervalMs(panel2),
        queryCachingTTL: resolvePanelQueryCachingTTL(panel2),
        cacheTimeout: resolvePanelCacheTimeout(panel2),
        visible: visiblePanels.value.has(panelId) || visiblePanels.value.size === 0,
        onPartialData: (partialSeries) => {
          if (ac.signal.aborted || panelAbort.get(panelId) !== ac) return;
          const cur = panelData.value[panelId];
          if (cur && (cur.state === LoadingStateEnum.Done || cur.state === LoadingStateEnum.Error) && cur.request?.requestId === requestId) {
            return;
          }
          if (cur && cur.request?.requestId === requestId && cur.state !== LoadingStateEnum.Loading && cur.state !== LoadingStateEnum.Streaming) {
            return;
          }
          setPanelData(panelId, {
            state: LoadingStateEnum.Streaming,
            series: (partialSeries ?? []).map((f) => markRaw(f)),
            timeRange: panelRange,
            timeInfo,
            request: { requestId },
            annotations: prev?.annotations
          });
        }
      },
      ac.signal
    );
    if (ac.signal.aborted || panelAbort.get(panelId) !== ac) {
      return;
    }
    setPanelData(panelId, {
      ...result,
      timeRange: result.timeRange ?? panelRange,
      timeInfo,
      request: { requestId },
      annotations: annotationEvents.value.length ? annotationEvents.value.map((e) => ({
        time: e.time,
        timeEnd: e.timeEnd,
        title: e.title,
        text: e.text,
        color: e.color,
        tags: e.tags
      })) : result.annotations
    });
  }
  const {
    copySelectedPanel,
    pasteClipboardPanel,
    duplicateSelectedPanel,
    setSelectedPanels,
    saveSelectedAsLibraryPanel,
    addLibraryPanelToDashboard,
    listSavedLibraryPanels,
    unlinkLibraryPanel: unlinkLibraryPanel2
  } = createPanelLibraryActions({
    getDocument: () => document2.value,
    applyDocument,
    refreshPanel,
    selectedPanelIds
  });
  function attachAnnotationsToPanelData() {
    const annos = annotationEvents.value.map((e) => ({
      time: e.time,
      timeEnd: e.timeEnd,
      title: e.title,
      text: e.text,
      color: e.color,
      tags: e.tags
    }));
    const next = { ...panelData.value };
    for (const id of Object.keys(next)) {
      const n = Number(id);
      next[n] = freezePanelData({ ...next[n], annotations: annos });
    }
    panelData.value = next;
  }
  function yieldToMain() {
    return new Promise((r) => setTimeout(r, 0));
  }
  async function refreshAllPanels() {
    if (refreshInFlight) {
      refreshRuntime.requestRerun();
      return refreshInFlight;
    }
    const gen = refreshRuntime.begin();
    isRefreshing.value = true;
    refreshInFlight = (async () => {
      try {
        await refreshAllPanelsInner();
      } finally {
        isRefreshing.value = false;
        refreshInFlight = null;
        if (refreshRuntime.end(gen)) {
          void refreshAllPanels();
        }
      }
    })();
    return refreshInFlight;
  }
  async function refreshAllPanelsInner() {
    await ensureBuiltinDataSources();
    const expanded = panels2.value.filter((p) => p.type !== "row");
    const seeded = { ...panelData.value };
    for (const p of expanded) {
      const id = p.id;
      const prev = seeded[id];
      const override = getPanelTimeOverride(p);
      seeded[id] = freezePanelData({
        state: LoadingStateEnum.Loading,
        series: prev?.series ?? [],
        timeRange: override.range,
        timeInfo: override.showOverride ? override.timeInfo || void 0 : void 0,
        request: { requestId: `panel-${id}-pending` },
        annotations: prev?.annotations
      });
    }
    panelData.value = seeded;
    const gen = refreshRuntime.getSnapshot().generation;
    await refreshRuntime.runWave(
      {
        refreshPanels: async () => {
          await Promise.all(
            expanded.map(async (p) => {
              await refreshPanel(p);
              await yieldToMain();
            })
          );
        },
        // fetch only — attach once via attachAnnotations below
        refreshAnnotations: fetchAnnotationEvents,
        attachAnnotations: attachAnnotationsToPanelData
      },
      gen
    );
  }
  async function fetchAnnotationEvents() {
    if (!document2.value) {
      annotationEvents.value = [];
      return;
    }
    annotationEvents.value = await runAnnotationQueries(
      document2.value.annotations?.list ?? [],
      getTimeRange(),
      (ref2) => catalog.tryResolve(ref2)
    );
  }
  async function refreshAnnotations() {
    await fetchAnnotationEvents();
    attachAnnotationsToPanelData();
  }
  function updateVariables(list) {
    if (!document2.value) return;
    applyDocument(
      { type: "set-variables", list },
      editMode.value ? void 0 : { history: false, dirty: false }
    );
    syncVariablesToLocation();
    void refreshVariables().then(() => {
      void refreshAllPanels();
    });
  }
  function setVariable(name, value) {
    if (!document2.value) return;
    const list = setVariableValue(document2.value.templating?.list ?? [], name, value);
    applyDocument(
      { type: "set-variables", list },
      editMode.value ? void 0 : { history: false, dirty: false }
    );
    syncVariablesToLocation();
    void refreshAllPanels();
  }
  function canEditDashboard() {
    return document2.value?.editable !== false;
  }
  function setEditMode(v) {
    if (v && !canEditDashboard()) {
      editMode.value = false;
      selectedPanelIds.value = [];
      return;
    }
    editMode.value = v;
    if (!v) {
      selectedPanelIds.value = [];
    }
  }
  function updateLayout(next) {
    if (!document2.value) return;
    applyDocument({
      type: "patch",
      mutator: (doc) => ({
        ...doc,
        panels: applyLayoutToPanels(doc.panels ?? [], next)
      })
    });
  }
  function updatePanel(panel2) {
    if (!document2.value) return;
    const persistable = sanitizePanelForPersist(panel2);
    const originId = resolveRepeatOriginId(panel2, panels2.value);
    const originDoc = originId != null ? (document2.value.panels ?? []).find((p) => Number(p.id) === Number(originId)) : null;
    const merged = originDoc ? {
      ...originDoc,
      ...persistable,
      id: originDoc.id,
      // Keep origin repeat/direction/maxPerRow unless explicitly set on persistable
      repeat: persistable.repeat ?? originDoc.repeat,
      repeatDirection: persistable.repeatDirection ?? originDoc.repeatDirection,
      maxPerRow: persistable.maxPerRow ?? originDoc.maxPerRow
    } : persistable;
    if (!persistable.isNew) delete merged.isNew;
    const hasLib = !!merged?.libraryPanel?.uid;
    if (hasLib) {
      applyDocument({
        type: "patch",
        mutator: (doc) => {
          const list = doc.panels ?? [];
          const withSource = list.some((p) => p.id === merged.id) ? list.map((p) => p.id === merged.id ? merged : p) : [...list, merged];
          return {
            ...doc,
            panels: syncLibraryPanelInstances(withSource, merged)
          };
        }
      });
    } else {
      applyDocument({ type: "upsert-panel", panel: merged });
    }
  }
  function addPanel(type = "timeseries") {
    if (!document2.value) return void 0;
    const id = nextPanelId(document2.value);
    const gridPos = findOpenPosition(document2.value.panels ?? [], {
      w: 12,
      h: 8
    });
    const panel2 = {
      id,
      type,
      title: "New panel",
      isNew: true,
      gridPos,
      targets: [
        {
          refId: "A",
          datasource: { type: "grafana-testdata-datasource", uid: "testdata" }
        }
      ],
      options: {},
      fieldConfig: { defaults: {}, overrides: [] }
    };
    applyDocument({ type: "upsert-panel", panel: panel2 });
    void refreshPanel(panel2);
    return id;
  }
  function seedPanelData(panelId, data) {
    setPanelData(panelId, data);
  }
  function deletePanel(panelId) {
    if (!document2.value) return;
    scheduler.cancel(`panel-${panelId}`);
    panelAbort.get(panelId)?.abort();
    panelAbort.delete(panelId);
    applyDocument({ type: "remove-panel", panelId });
    const next = { ...panelData.value };
    delete next[panelId];
    panelData.value = next;
  }
  function setPersistenceHandler(handler) {
    persistenceHandler = handler;
  }
  async function performSave() {
    if (!document2.value) return;
    const savedUid = String(document2.value.uid ?? "");
    if (persistenceHandler) {
      const savedJson = serializeDocument();
      const savedDashboard = JSON.parse(savedJson);
      await persistenceHandler(savedDashboard);
      originalJson.value = savedJson;
      dashboardDocument.state.baselineJson = JSON.stringify(savedDashboard);
      dashboardDocument.syncWorking(document2.value);
      syncFromDocument();
      clearImportedDashboardPendingSave(savedUid);
      neverSaved.value = false;
      return;
    }
    const payload = {
      dashboard: {
        ...document2.value,
        id: void 0,
        version: document2.value.version
      },
      message: "Saved from Vue dashboard",
      overwrite: true
    };
    try {
      const res = await backendSrv.post(
        "/api/dashboards/db",
        payload
      );
      if (res.data?.version != null && document2.value) {
        document2.value = {
          ...document2.value,
          version: res.data.version,
          uid: res.data.uid ?? document2.value.uid
        };
      }
    } catch {
    }
    saveImportedDashboard({
      ...document2.value
    });
    clearImportedDashboardPendingSave(savedUid);
    neverSaved.value = false;
    dashboardDocument.markSaved(document2.value);
    originalJson.value = dashboardDocument.snapshot();
    dirty.value = false;
  }
  function save() {
    if (saveInFlight) return saveInFlight;
    saveError.value = null;
    saving.value = true;
    saveInFlight = performSave().catch((error_) => {
      saveError.value = error_ instanceof Error ? error_.message : String(error_);
      throw error_;
    }).finally(() => {
      saving.value = false;
      saveInFlight = null;
    });
    return saveInFlight;
  }
  async function restoreSaved() {
    if (!originalJson.value) return;
    await loadLocal(JSON.parse(originalJson.value));
    saveError.value = null;
  }
  function setTime(from, to) {
    time.value = { from, to };
    if (document2.value && editMode.value) {
      applyDocument({ type: "set-time", from, to }, { history: false });
    }
    writeTimeToLocation(from, to);
    void refreshVariables("time");
    void refreshAllPanels();
  }
  function setTimezone(tz) {
    timezone.value = tz || "browser";
    if (document2.value && editMode.value) {
      applyDocument({ type: "set-timezone", timezone: timezone.value }, { history: false });
    }
    void refreshAllPanels();
  }
  function undo() {
    if (!document2.value) return;
    dashboardDocument.undo();
    syncFromDocument();
    if (document2.value?.time) {
      time.value = {
        from: document2.value.time.from ?? time.value.from,
        to: document2.value.time.to ?? time.value.to
      };
    }
    void refreshAllPanels();
  }
  function redo() {
    if (!document2.value) return;
    dashboardDocument.redo();
    syncFromDocument();
    if (document2.value?.time) {
      time.value = {
        from: document2.value.time.from ?? time.value.from,
        to: document2.value.time.to ?? time.value.to
      };
    }
    void refreshAllPanels();
  }
  async function refreshVariables(trigger = "manual") {
    if (!document2.value?.templating?.list) return;
    let list = await refreshAllVariables(
      document2.value.templating.list,
      (ref2) => catalog.tryResolve(ref2),
      { trigger, range: getTimeRange() }
    );
    list = populateDatasourceVariableOptions(list, catalog.list());
    list = list.map(
      (v) => v?.options ? { ...v, options: markRaw(v.options) } : v
    );
    applyDocument({ type: "set-variables", list }, { history: false, dirty: false });
    dirty.value = false;
    if (originalJson.value) {
      dashboardDocument.state.baselineJson = originalJson.value;
      dashboardDocument.state.dirty = false;
    }
    syncVariablesToLocation();
  }
  function serializeDocument() {
    if (!document2.value) return "{}";
    return serializeDashboardDocument(document2.value);
  }
  autoRefreshRunner.run = () => refreshAllPanels();
  function stopAutoRefresh() {
    if (refreshTimer != null) {
      clearTimeout(refreshTimer);
      refreshTimer = null;
    }
  }
  function stopLiveNow() {
    if (liveNowTimer != null) {
      clearTimeout(liveNowTimer);
      liveNowTimer = null;
    }
  }
  function restartLiveNow() {
    stopLiveNow();
    if (!liveNow.value) return;
    const tick = () => {
      liveNowTimer = setTimeout(async () => {
        if (!liveNow.value) return;
        const from = time.value.from;
        const to = time.value.to;
        if (isRelativeTimeRaw(from) || isRelativeTimeRaw(to)) {
          try {
            liveNowTickCount.value += 1;
            await refreshAllPanels();
          } catch {
          }
        }
        if (liveNow.value) tick();
      }, 1e3);
    };
    tick();
  }
  function setLiveNow(on) {
    liveNow.value = on === true;
    if (document2.value) {
      applyDocument(
        {
          type: "patch",
          mutator: (doc) => ({ ...doc, liveNow: liveNow.value })
        },
        editMode.value ? { history: false } : { history: false, dirty: false }
      );
    }
    restartLiveNow();
  }
  function setWeekStart(next) {
    weekStart.value = String(next ?? "");
    if (document2.value) {
      applyDocument(
        {
          type: "patch",
          mutator: (doc) => ({ ...doc, weekStart: weekStart.value })
        },
        editMode.value ? { history: false } : { history: false, dirty: false }
      );
    }
  }
  function restartAutoRefresh() {
    stopAutoRefresh();
    const ms = intervalToMs(refresh.value);
    if (ms <= 0) return;
    const tick = () => {
      refreshTimer = setTimeout(async () => {
        const dom = globalThis.document;
        const hidden = Boolean(dom && dom.visibilityState === "hidden");
        if (!hidden) {
          try {
            autoRefreshTickCount.value += 1;
            await autoRefreshRunner.run();
          } catch {
          }
        }
        if (intervalToMs(refresh.value) > 0) tick();
      }, ms);
    };
    tick();
  }
  function applyRefreshFromDocument() {
    const next = String(document2.value?.refresh ?? "");
    refresh.value = next;
    restartAutoRefresh();
  }
  function setRefresh(interval) {
    const raw = String(interval ?? "").trim();
    const next = !raw || raw.toLowerCase() === "off" || raw === "LIVE" || raw.toLowerCase() === "auto" ? "" : raw;
    refresh.value = next;
    if (document2.value) {
      applyDocument(
        { type: "set-refresh", refresh: next },
        editMode.value ? { history: false } : { history: false, dirty: false }
      );
    }
    restartAutoRefresh();
  }
  function ensureVisibilityHook() {
    const dom = globalThis.document;
    if (!dom || visibilityHandler) return;
    visibilityHandler = () => {
      if (dom.visibilityState === "visible" && intervalToMs(refresh.value) > 0) {
        void refreshAllPanels();
      }
    };
    dom.addEventListener("visibilitychange", visibilityHandler);
  }
  ensureVisibilityHook();
  function dispose() {
    stopAutoRefresh();
    stopLiveNow();
    const dom = globalThis.document;
    if (visibilityHandler && dom) {
      dom.removeEventListener("visibilitychange", visibilityHandler);
      visibilityHandler = null;
    }
    for (const ac of panelAbort.values()) ac.abort();
    panelAbort.clear();
    scheduler.cancelAll();
    const ownedUids = [...catalog.getInstances().keys()];
    try {
      void Promise.resolve().then(() => panelPipelineWorkerClient).then((m) => m.disposePanelPipelineWorker());
    } catch {
    }
    catalog.dispose();
    for (const uid of ownedUids) unregisterRuntimeDataSource(uid);
  }
  function setEmbeddedDatasources(list) {
    if (!document2.value) return;
    const cleaned = sanitizeEmbeddedDatasources(list);
    applyDocument({
      type: "patch",
      mutator: (doc) => ({
        ...doc,
        datasources: cleaned
      })
    });
    registerEmbeddedDatasources(cleaned, (api) => registerDataSource(api));
  }
  function applyDocumentEmbeddedDatasources() {
    const list = sanitizeEmbeddedDatasources(document2.value?.datasources);
    if (!list.length) return;
    registerEmbeddedDatasources(list, (api) => registerDataSource(api));
  }
  return {
    document: document2,
    dirty,
    neverSaved,
    editMode,
    loading,
    error,
    panelData,
    time,
    timezone,
    weekStart,
    liveNow,
    liveNowTickCount,
    refresh,
    isRefreshing,
    autoRefreshTickCount,
    setRefresh,
    saving,
    saveError,
    panels: panels2,
    layout,
    title,
    scene,
    loadByUid,
    loadLocal,
    refreshPanel,
    setPanelVisible,
    visiblePanels,
    refreshAllPanels,
    canEditDashboard,
    setEditMode,
    updateLayout,
    updatePanel,
    addPanel,
    deletePanel,
    seedPanelData,
    save,
    setPersistenceHandler,
    restoreSaved,
    setTime,
    getTimeRange,
    getPanelTimeOverride,
    getRefreshIntervals,
    getQuickRanges,
    isTimepickerHidden,
    getNowDelayMs,
    getFiscalYearStartMonth,
    setTimezone,
    setWeekStart,
    setLiveNow,
    registerDataSource,
    unregisterDataSource,
    setEmbeddedDatasources,
    applyDocumentEmbeddedDatasources,
    dispose,
    serializeDocument,
    scheduler,
    undo,
    redo,
    canUndo,
    canRedo,
    refreshVariables,
    syncVariablesFromLocation,
    syncVariablesToLocation,
    pushHistory,
    annotationEvents,
    selectedPanelIds,
    refreshAnnotations,
    setVariable,
    updateVariables,
    copySelectedPanel,
    pasteClipboardPanel,
    duplicateSelectedPanel,
    setSelectedPanels,
    saveSelectedAsLibraryPanel,
    unlinkLibraryPanel: unlinkLibraryPanel2,
    addLibraryPanelToDashboard,
    listSavedLibraryPanels
  };
});
const _hoisted_1$1w = {
  class: "dashboard-skeleton",
  "data-testid": "dashboard-skeleton",
  role: "status",
  "aria-busy": "true",
  "aria-live": "polite"
};
const _hoisted_2$1e = { class: "dashboard-skeleton__toolbar" };
const _hoisted_3$12 = { class: "dashboard-skeleton__grid" };
const _hoisted_4$R = {
  key: 0,
  class: "dashboard-skeleton__title"
};
const _sfc_main$1A = /* @__PURE__ */ defineComponent({
  __name: "DashboardSkeleton",
  props: {
    panels: {}
  },
  setup(__props) {
    const props = __props;
    const tiles = computed(() => {
      if (props.panels?.length) {
        return props.panels.map((p, i) => ({
          key: String(p.id ?? i),
          title: p.title || "",
          style: gridStyle(p.gridPos || { x: i % 3 * 8, y: Math.floor(i / 3) * 8, w: 8, h: 8 })
        }));
      }
      return Array.from({ length: 6 }, (_, i) => ({
        key: `g-${i}`,
        title: "",
        style: gridStyle({ x: i % 3 * 8, y: Math.floor(i / 3) * 8, w: 8, h: 8 })
      }));
    });
    function gridStyle(g) {
      return {
        gridColumn: `${g.x + 1} / span ${g.w}`,
        gridRow: `${g.y + 1} / span ${Math.max(1, Math.round(g.h / 2))}`,
        minHeight: `${Math.max(80, g.h * 12)}px`
      };
    }
    onMounted(() => {
      perfMark("dashboard-shell-painted");
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1w, [
        _cache[0] || (_cache[0] = createElementVNode(
          "span",
          { class: "dashboard-skeleton__sr" },
          "仪表盘加载中",
          -1
          /* CACHED */
        )),
        createElementVNode("div", _hoisted_2$1e, [
          createVNode(unref(GSkeleton), {
            width: "180px",
            height: "20px"
          }),
          createVNode(unref(GSkeleton), {
            width: "88px",
            height: "28px"
          })
        ]),
        createElementVNode("div", _hoisted_3$12, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(tiles.value, (t2) => {
              return openBlock(), createElementBlock(
                "div",
                {
                  key: t2.key,
                  class: "dashboard-skeleton__panel",
                  style: normalizeStyle(t2.style)
                },
                [
                  t2.title ? (openBlock(), createElementBlock(
                    "div",
                    _hoisted_4$R,
                    toDisplayString(t2.title),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true),
                  createVNode(unref(GSkeleton), { height: "70%" })
                ],
                4
                /* STYLE */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])
      ]);
    };
  }
});
const DashboardSkeleton = /* @__PURE__ */ _export_sfc$1(_sfc_main$1A, [["__scopeId", "data-v-3b72b2c9"]]);
const DashboardCursorSync = {
  Off: 0,
  Crosshair: 1,
  Tooltip: 2
};
function normalizeGraphTooltip(raw) {
  const n = Number(raw ?? 0);
  if (n === 1) return DashboardCursorSync.Crosshair;
  if (n === 2) return DashboardCursorSync.Tooltip;
  return DashboardCursorSync.Off;
}
function createDashboardCursorPanelContext(graphTooltip, bus) {
  const shared2 = bus ?? createEventBus();
  const read = () => typeof graphTooltip === "function" ? normalizeGraphTooltip(graphTooltip()) : normalizeGraphTooltip(graphTooltip);
  return {
    eventsScope: "dashboard",
    eventBus: shared2,
    sync: () => read()
  };
}
function createPanelReplaceVariables(panel2, baseReplace, baseScoped) {
  const panelScoped = panel2?.scopedVars ?? {};
  const hasPanelScoped = panelScoped && Object.keys(panelScoped).length > 0;
  if (!hasPanelScoped) {
    return baseReplace ?? ((v) => v);
  }
  return (value) => {
    const once = replaceVariables(value, panelScoped);
    return baseReplace ? baseReplace(once) : once;
  };
}
function visiblePanelLinks(links) {
  if (!Array.isArray(links)) return [];
  return links.filter((l) => {
    if (!l || typeof l !== "object") return false;
    const title = String(l.title ?? "").trim();
    const url = String(l.url ?? "").trim();
    return title !== "" || url !== "";
  });
}
function resolvePanelLinks(links, ctx = {}) {
  const raw = visiblePanelLinks(links);
  if (!raw.length) return [];
  const resolveCtx = {
    timeRange: ctx.timeRange,
    replaceVariables: ctx.replaceVariables,
    templateVars: ctx.templateVars
  };
  return raw.map((link) => {
    let url = String(link.url ?? "");
    if (link.keepTime && !url.includes("${__url_time_range}") && !url.includes("__url_time_range")) {
      url += `${url.includes("?") ? "&" : "?"}\${__url_time_range}`;
    }
    if (link.includeVars && !url.includes("${__all_variables}") && !url.includes("__all_variables")) {
      url += `${url.includes("?") ? "&" : "?"}\${__all_variables}`;
    }
    const dataLink = {
      title: String(link.title ?? ""),
      url,
      targetBlank: link.targetBlank
    };
    const resolved = resolveDataLink(dataLink, resolveCtx);
    return {
      title: resolved.title,
      href: resolved.href || "#",
      targetBlank: resolved.targetBlank
    };
  });
}
const _hoisted_1$1v = {
  class: "panel-body-skeleton",
  "data-testid": "panel-body-skeleton",
  role: "status",
  "aria-busy": "true",
  "aria-live": "polite"
};
const _sfc_main$1z = /* @__PURE__ */ defineComponent({
  __name: "PanelBodySkeleton",
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1v, [
        _cache[0] || (_cache[0] = createElementVNode(
          "span",
          { class: "panel-body-skeleton__sr" },
          "面板加载中",
          -1
          /* CACHED */
        )),
        createVNode(unref(GSkeleton), {
          class: "panel-body-skeleton__bar",
          height: "100%"
        })
      ]);
    };
  }
});
const PanelBodySkeleton = /* @__PURE__ */ _export_sfc$1(_sfc_main$1z, [["__scopeId", "data-v-7769b233"]]);
const _hoisted_1$1u = ["data-panel-id", "data-panel-title", "data-panel-type", "data-scenario"];
const _hoisted_2$1d = ["data-no-padding"];
const _hoisted_3$11 = {
  key: 1,
  class: "panel-host__missing",
  "data-testid": "panel-host-missing"
};
const PANEL_HEADER_HEIGHT = 40;
const PANEL_BORDER_Y = 2;
const PANEL_BORDER_X = 2;
const PANEL_CONTENT_PAD = 8;
const _sfc_main$1y = /* @__PURE__ */ defineComponent({
  __name: "PanelHost",
  props: {
    title: {},
    description: {},
    links: {},
    loading: { type: Boolean },
    error: {},
    noData: { type: Boolean },
    noDataText: {},
    transparent: { type: Boolean, default: false },
    width: {},
    height: {},
    panelType: {},
    panelId: {},
    scenario: {},
    editable: { type: Boolean, default: false },
    forceNoPadding: { type: Boolean },
    canEdit: { type: Boolean, default: false },
    isEditing: { type: Boolean, default: false },
    isViewing: { type: Boolean, default: false },
    isLibraryPanel: { type: Boolean },
    panel: {},
    data: {},
    options: {},
    fieldConfig: {},
    timeRange: {},
    replaceVariables: { type: Function, default: (v) => v },
    panelContext: {}
  },
  emits: ["action"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function emitAction(type, extra = {}) {
      const panelId = props.panelId ?? 0;
      emit("action", { type, panelId, ...extra });
    }
    const HostContentScope = defineComponent({
      name: "PanelHostContentScope",
      setup(_, { slots }) {
        provide(panelHostKey, { ownedChrome: true });
        return () => slots.default?.();
      }
    });
    const ctx = createDefaultPanelContext(props.panelContext ?? {});
    provide(panelContextKey, ctx);
    const resolvedPanel = computed(() => {
      const fromProp = props.panel ? toRaw(props.panel) : void 0;
      const fromType = props.panelType ? getPanelPlugin(props.panelType)?.panel : void 0;
      const raw = fromProp ?? fromType;
      return raw ? markRaw(raw) : void 0;
    });
    const mergedOptions = computed(() => {
      const plugin2 = props.panelType ? getPanelPlugin(props.panelType) : void 0;
      const defaults2 = plugin2?.defaultOptions ?? {};
      const incoming = props.options ?? {};
      const out = { ...defaults2, ...incoming };
      for (const key of Object.keys(defaults2)) {
        const d = defaults2[key];
        const v = incoming[key];
        if (d && typeof d === "object" && !Array.isArray(d) && v && typeof v === "object" && !Array.isArray(v)) {
          out[key] = { ...d, ...v };
        }
      }
      return out;
    });
    const mergedFieldConfig = computed(() => {
      const plugin2 = props.panelType ? getPanelPlugin(props.panelType) : void 0;
      const customDefaults = plugin2?.defaultFieldConfigCustom ?? plugin2?.module?.defaultFieldConfigCustom;
      const incoming = props.fieldConfig ?? {
        defaults: {},
        overrides: []
      };
      const defaults2 = {
        ...incoming.defaults ?? {}
      };
      if (customDefaults && typeof customDefaults === "object") {
        defaults2.custom = {
          ...customDefaults,
          ...incoming.defaults?.custom ?? {}
        };
      }
      return {
        defaults: defaults2,
        overrides: incoming.overrides ?? []
      };
    });
    const noPadding = computed(() => {
      if (props.forceNoPadding) return true;
      const plugin2 = props.panelType ? getPanelPlugin(props.panelType) : void 0;
      return !!(plugin2?.noPadding ?? plugin2?.module?.noPadding);
    });
    const contentWidth = computed(() => {
      if (props.width == null) return void 0;
      const padX = noPadding.value ? 0 : PANEL_CONTENT_PAD * 2;
      return Math.max(0, props.width - PANEL_BORDER_X - padX);
    });
    const dataState = computed(() => props.data?.state);
    const seriesCount = computed(
      () => Array.isArray(props.data?.series) ? props.data.series.length : 0
    );
    const loading = computed(
      () => props.loading || dataState.value === "Loading" || dataState.value === "Streaming"
    );
    const hasSeries = computed(() => seriesCount.value > 0);
    const hasStaleData = computed(() => Boolean(loading.value) && hasSeries.value);
    const error = computed(() => {
      if (dataState.value === "NotStarted" && !hasSeries.value) return void 0;
      const msg = props.error ?? props.data?.error?.message;
      if (!msg) return void 0;
      if (/cancel|aborted|ABORT/i.test(String(msg))) return void 0;
      return msg;
    });
    const timeInfo = computed(() => {
      const info = props.data?.timeInfo;
      return info && String(info).trim() ? String(info).trim() : void 0;
    });
    const resolvedLinks = computed(
      () => resolvePanelLinks(props.links, {
        timeRange: props.timeRange ?? props.data?.timeRange,
        replaceVariables: props.replaceVariables
      })
    );
    const hasChromeHeader = computed(
      () => Boolean(
        props.title || props.description || error.value || loading.value || timeInfo.value || resolvedLinks.value.length
      )
    );
    const bodyHeight = computed(() => {
      if (!props.height) return void 0;
      if (!hasChromeHeader.value) return Math.max(0, props.height - PANEL_BORDER_Y);
      return Math.max(0, props.height - PANEL_HEADER_HEIGHT - PANEL_BORDER_Y);
    });
    const contentHeight = computed(() => {
      if (bodyHeight.value == null) return void 0;
      const padY = noPadding.value ? 0 : PANEL_CONTENT_PAD * 2;
      return Math.max(0, bodyHeight.value - padY);
    });
    const showBodySkeleton = computed(() => {
      if (hasSeries.value) return false;
      if (error.value) return false;
      if (dataState.value === "Done") return false;
      if (dataState.value === "Error") return false;
      if (props.loading || dataState.value === "Loading") return true;
      if (dataState.value === "NotStarted") return true;
      return false;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-host",
        "data-testid": "parity-panel",
        "data-panel-id": __props.panelId != null ? String(__props.panelId) : void 0,
        "data-panel-title": __props.title,
        "data-panel-type": __props.panelType,
        "data-scenario": __props.scenario
      }, [
        createVNode(unref(PanelChrome), {
          title: __props.title,
          description: __props.description,
          "time-info": timeInfo.value,
          links: resolvedLinks.value,
          transparent: __props.transparent,
          loading: loading.value,
          "has-stale-data": hasStaleData.value,
          error: error.value,
          "no-data": __props.noData,
          "no-data-text": __props.noDataText,
          width: __props.width,
          height: __props.height,
          "panel-type": __props.panelType,
          editable: __props.editable,
          "can-edit": __props.canEdit,
          "is-editing": __props.isEditing,
          "is-viewing": __props.isViewing,
          "is-library-panel": __props.isLibraryPanel,
          onInspect: _cache[0] || (_cache[0] = (tab) => emitAction("inspect", { tab })),
          onFullscreen: _cache[1] || (_cache[1] = () => emitAction("fullscreen")),
          onEdit: _cache[2] || (_cache[2] = () => emitAction("edit")),
          onView: _cache[3] || (_cache[3] = () => emitAction("view")),
          onDuplicate: _cache[4] || (_cache[4] = () => emitAction("duplicate")),
          onRemove: _cache[5] || (_cache[5] = () => emitAction("remove")),
          onShare: _cache[6] || (_cache[6] = (mode2) => emitAction("share", { mode: mode2 })),
          onExplore: _cache[7] || (_cache[7] = () => emitAction("explore")),
          onCopy: _cache[8] || (_cache[8] = () => emitAction("copy")),
          onToggleLegend: _cache[9] || (_cache[9] = () => emitAction("toggle-legend")),
          onHelp: _cache[10] || (_cache[10] = () => emitAction("help")),
          onCopyStyles: _cache[11] || (_cache[11] = () => emitAction("copy-styles")),
          onPasteStyles: _cache[12] || (_cache[12] = () => emitAction("paste-styles")),
          onTimeSettings: _cache[13] || (_cache[13] = () => emitAction("time-settings")),
          onLibraryPanel: _cache[14] || (_cache[14] = () => emitAction("library-panel")),
          onUnlinkLibrary: _cache[15] || (_cache[15] = () => emitAction("unlink-library")),
          onAlertRule: _cache[16] || (_cache[16] = () => emitAction("alert-rule"))
        }, {
          default: withCtx(() => [
            createVNode(unref(HostContentScope), null, {
              default: withCtx(() => [
                createElementVNode("div", {
                  class: "panel-host__body",
                  "data-testid": "panel-host-body",
                  "data-no-padding": noPadding.value ? "1" : "0",
                  style: normalizeStyle({
                    height: bodyHeight.value ? `${bodyHeight.value}px` : "100%",
                    padding: noPadding.value ? "0" : void 0
                  })
                }, [
                  showBodySkeleton.value ? (openBlock(), createBlock(PanelBodySkeleton, { key: 0 })) : renderSlot(_ctx.$slots, "default", {
                    key: 1,
                    width: contentWidth.value,
                    height: contentHeight.value,
                    data: __props.data,
                    options: mergedOptions.value,
                    fieldConfig: mergedFieldConfig.value
                  }, () => [
                    resolvedPanel.value ? (openBlock(), createBlock(resolveDynamicComponent(resolvedPanel.value), {
                      key: 0,
                      id: __props.panelId,
                      title: __props.title,
                      transparent: __props.transparent,
                      editable: __props.editable,
                      "is-library-panel": __props.isLibraryPanel,
                      data: __props.data,
                      options: mergedOptions.value,
                      "field-config": mergedFieldConfig.value,
                      width: contentWidth.value,
                      height: contentHeight.value ?? __props.height,
                      "time-range": __props.timeRange ?? __props.data?.timeRange,
                      "replace-variables": __props.replaceVariables
                    }, null, 8, ["id", "title", "transparent", "editable", "is-library-panel", "data", "options", "field-config", "width", "height", "time-range", "replace-variables"])) : (openBlock(), createElementBlock(
                      "div",
                      _hoisted_3$11,
                      " 未知面板类型：" + toDisplayString(__props.panelType),
                      1
                      /* TEXT */
                    ))
                  ], true)
                ], 12, _hoisted_2$1d)
              ]),
              _: 3
              /* FORWARDED */
            })
          ]),
          _: 3
          /* FORWARDED */
        }, 8, ["title", "description", "time-info", "links", "transparent", "loading", "has-stale-data", "error", "no-data", "no-data-text", "width", "height", "panel-type", "editable", "can-edit", "is-editing", "is-viewing", "is-library-panel"])
      ], 8, _hoisted_1$1u);
    };
  }
});
const PanelHost = /* @__PURE__ */ _export_sfc$1(_sfc_main$1y, [["__scopeId", "data-v-4d516c21"]]);
const EMPTY_PANEL_DATA = markRaw({
  state: "NotStarted",
  series: [],
  timeRange: {
    from: /* @__PURE__ */ new Date(0),
    to: /* @__PURE__ */ new Date(0),
    raw: { from: "now-6h", to: "now" }
  }
});
const _hoisted_1$1t = ["data-panel-id"];
const _sfc_main$1x = /* @__PURE__ */ defineComponent({
  __name: "DashboardPanelCell",
  props: {
    panel: {},
    data: {},
    width: {},
    height: {},
    editable: { type: Boolean, default: false },
    isViewing: { type: Boolean, default: false },
    selected: { type: Boolean, default: false },
    shouldMountRenderer: { type: Boolean, default: true },
    replaceVariables: { type: Function, default: (v) => v },
    panelContext: {}
  },
  emits: ["action", "click"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const panelData = computed(() => props.data ?? EMPTY_PANEL_DATA);
    const mountRenderer = computed(() => props.shouldMountRenderer !== false);
    const panelReplace = computed(
      () => createPanelReplaceVariables(props.panel, props.replaceVariables)
    );
    const title = computed(() => panelReplace.value(String(props.panel?.title ?? "")));
    const description = computed(() => {
      const raw = String(props.panel?.description ?? "");
      return raw ? panelReplace.value(raw) : raw;
    });
    const isLibraryPanel = computed(
      () => !!props.panel?.libraryPanel?.uid
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["dashboard-panel-cell", { "dashboard-panel-cell--selected": __props.selected }]),
        "data-panel-id": String(__props.panel.id),
        "data-testid": "dashboard-panel-cell",
        onClick: _cache[1] || (_cache[1] = ($event) => emit("click"))
      }, [
        mountRenderer.value ? (openBlock(), createBlock(PanelHost, {
          key: 0,
          "panel-id": __props.panel.id,
          "panel-type": __props.panel.type,
          title: title.value,
          description: description.value,
          links: __props.panel.links ?? [],
          transparent: !!__props.panel.transparent,
          data: panelData.value,
          options: __props.panel.options ?? {},
          "field-config": __props.panel.fieldConfig ?? { defaults: {}, overrides: [] },
          width: __props.width,
          height: __props.height,
          "time-range": panelData.value.timeRange,
          editable: __props.editable && !unref(isRepeatClone)(__props.panel),
          "can-edit": !!__props.editable && !unref(isRepeatClone)(__props.panel),
          "is-viewing": !!__props.isViewing,
          "is-library-panel": isLibraryPanel.value,
          "replace-variables": panelReplace.value,
          "panel-context": __props.panelContext,
          onAction: _cache[0] || (_cache[0] = ($event) => emit("action", $event))
        }, null, 8, ["panel-id", "panel-type", "title", "description", "links", "transparent", "data", "options", "field-config", "width", "height", "time-range", "editable", "can-edit", "is-viewing", "is-library-panel", "replace-variables", "panel-context"])) : (openBlock(), createElementBlock(
          "div",
          {
            key: 1,
            class: "dashboard-panel-cell__placeholder panel-placeholder",
            "data-testid": "panel-offscreen-placeholder",
            style: normalizeStyle({
              width: __props.width ? `${__props.width}px` : "100%",
              height: __props.height ? `${__props.height}px` : "100%",
              minHeight: "64px"
            }),
            "aria-hidden": "true"
          },
          null,
          4
          /* STYLE */
        ))
      ], 10, _hoisted_1$1t);
    };
  }
});
const DashboardPanelCell = /* @__PURE__ */ _export_sfc$1(_sfc_main$1x, [["__scopeId", "data-v-2de760b0"]]);
const _hoisted_1$1s = ["data-graph-tooltip", "data-cursor-sync", "data-visibility-mode", "data-windowed"];
const _hoisted_2$1c = ["data-testid", "onClick"];
const _hoisted_3$10 = { class: "row-toggle" };
const _hoisted_4$Q = {
  key: 1,
  class: "panel-placeholder",
  "data-testid": "panel-offscreen-placeholder"
};
const _hoisted_5$I = ["data-testid", "onClick"];
const _hoisted_6$E = { class: "row-toggle" };
const LARGE_GRID_THRESHOLD = 80;
const _sfc_main$1w = /* @__PURE__ */ defineComponent({
  __name: "DashboardGrid",
  props: {
    panels: {},
    panelData: {},
    editable: { type: Boolean, default: false },
    isViewing: { type: Boolean, default: false },
    colNum: { default: 24 },
    rowHeight: { default: 36 },
    selectedPanelId: { default: null },
    replaceVariables: { type: Function, default: (v) => v },
    graphTooltip: { default: 0 }
  },
  emits: ["layoutUpdated", "panelClick", "toggleRow", "panelAction", "visibilityChange"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const sharedCursorBus = createEventBus();
    const sharedPanelContext = createDashboardCursorPanelContext(
      () => props.graphTooltip,
      sharedCursorBus
    );
    const graphTooltipMode = computed(() => normalizeGraphTooltip(props.graphTooltip));
    function replaceForPanel(panel2) {
      return createPanelReplaceVariables(panel2, props.replaceVariables);
    }
    const emit = __emit;
    const collapsedRows = ref(/* @__PURE__ */ new Set());
    function toggleRow(id) {
      const next = new Set(collapsedRows.value);
      if (next.has(id)) next.delete(id);
      else next.add(id);
      collapsedRows.value = next;
      emit("toggleRow", id);
    }
    const rootEl = ref(null);
    const containerWidth = ref(1200);
    const cellSizes = shallowRef({});
    const visibilityMode = ref("uninitialized");
    const visibleIds = shallowRef(/* @__PURE__ */ new Set());
    const panelById = computed(() => {
      const m = /* @__PURE__ */ new Map();
      for (const p of props.panels) {
        m.set(p.id, p);
        m.set(String(p.id), p);
      }
      return m;
    });
    const layoutItemCache = /* @__PURE__ */ new Map();
    function stabilizeLayout(items) {
      const seen = /* @__PURE__ */ new Set();
      const out = items.map((item) => {
        seen.add(item.i);
        const prev = layoutItemCache.get(item.i);
        if (prev && prev.x === item.x && prev.y === item.y && prev.w === item.w && prev.h === item.h && prev.panelId === item.panelId && prev.isRow === item.isRow && prev.static === item.static) {
          return prev;
        }
        layoutItemCache.set(item.i, item);
        return item;
      });
      for (const k of [...layoutItemCache.keys()]) {
        if (!seen.has(k)) layoutItemCache.delete(k);
      }
      return out;
    }
    const syncedLayout = computed({
      get: () => stabilizeLayout(panelsToLayout(props.panels, collapsedRows.value)),
      set: (v) => {
        emit("layoutUpdated", v);
      }
    });
    function panelComponent(type) {
      return getPanelPlugin(type)?.panel;
    }
    function panelOf(item) {
      const map = panelById.value;
      return map.get(item.panelId) ?? map.get(item.i);
    }
    function estimateSize(item) {
      const cols = props.colNum ?? 24;
      const margin = 8;
      const colWidth = Math.max(20, (containerWidth.value - margin * (cols + 1)) / cols);
      const w = Math.floor(item.w * colWidth + Math.max(0, item.w - 1) * margin);
      const h2 = Math.floor(item.h * (props.rowHeight ?? 36) + Math.max(0, item.h - 1) * margin);
      return { w, h: h2 };
    }
    function sizeFor(item) {
      return cellSizes.value[item.i] ?? estimateSize(item);
    }
    function isPanelActive(panelId) {
      if (props.editable || props.isViewing) return true;
      if (visibilityMode.value === "uninitialized") return true;
      return visibleIds.value.has(panelId);
    }
    const cellEls = /* @__PURE__ */ new Map();
    const panelIdByKey = /* @__PURE__ */ new Map();
    let sharedRo;
    const pendingSizes = /* @__PURE__ */ new Map();
    let sizeRaf = 0;
    function flushPendingSizes() {
      sizeRaf = 0;
      if (!pendingSizes.size) return;
      const next = {
        ...cellSizes.value
      };
      for (const [k, v] of pendingSizes) next[k] = v;
      pendingSizes.clear();
      cellSizes.value = next;
    }
    function ensureSharedRo() {
      if (sharedRo || typeof ResizeObserver === "undefined") return sharedRo;
      sharedRo = new ResizeObserver((entries) => {
        for (const entry of entries) {
          const el = entry.target;
          const key = el.dataset.gridKey;
          if (!key) continue;
          const cr = entry.contentRect;
          const w = Math.max(1, Math.floor(cr.width));
          const h2 = Math.max(1, Math.floor(cr.height));
          const prev = cellSizes.value[key];
          if (prev && prev.w === w && prev.h === h2) continue;
          pendingSizes.set(key, { w, h: h2 });
        }
        if (pendingSizes.size && !sizeRaf) {
          sizeRaf = requestAnimationFrame(flushPendingSizes);
        }
      });
      return sharedRo;
    }
    function bindCell(el, key, panelId) {
      const ro = ensureSharedRo();
      const prev = cellEls.get(key);
      if (prev && prev !== el) {
        ro?.unobserve(prev);
        cellEls.delete(key);
        panelIdByKey.delete(key);
      }
      if (!el || !(el instanceof HTMLElement)) return;
      if (cellEls.get(key) === el) return;
      el.dataset.gridKey = key;
      el.dataset.panelId = String(panelId);
      panelIdByKey.set(key, panelId);
      ro?.observe(el);
      cellEls.set(key, el);
      ensureSharedIo()?.observe(el);
    }
    let sharedIo;
    function ensureSharedIo() {
      if (sharedIo || typeof IntersectionObserver === "undefined") return sharedIo;
      sharedIo = new IntersectionObserver(
        (entries) => {
          const next = new Set(visibleIds.value);
          let changed = false;
          for (const e of entries) {
            const el = e.target;
            const id = Number(el.dataset.panelId);
            if (!Number.isFinite(id)) continue;
            if (e.isIntersecting) {
              if (!next.has(id)) {
                next.add(id);
                changed = true;
              }
            } else if (next.has(id)) {
              next.delete(id);
              changed = true;
            }
          }
          if (visibilityMode.value !== "tracking") {
            visibilityMode.value = "tracking";
            changed = true;
          }
          if (changed) {
            visibleIds.value = next;
            emit("visibilityChange", [...next]);
          }
        },
        {
          root: null,
          // Pre-render a bit outside the viewport to reduce blank flash on scroll
          rootMargin: "200px 0px",
          threshold: 0
        }
      );
      return sharedIo;
    }
    function onRootResize() {
      if (!rootEl.value) return;
      containerWidth.value = Math.max(320, rootEl.value.clientWidth);
    }
    let rootRo;
    onMounted(() => {
      onRootResize();
      if (rootEl.value && typeof ResizeObserver !== "undefined") {
        rootRo = new ResizeObserver(() => onRootResize());
        rootRo.observe(rootEl.value);
      }
      window.addEventListener("resize", onRootResize);
      requestAnimationFrame(() => {
        ensureSharedIo();
        for (const el of cellEls.values()) ensureSharedIo()?.observe(el);
      });
    });
    onBeforeUnmount(() => {
      rootRo?.disconnect();
      rootRo = void 0;
      window.removeEventListener("resize", onRootResize);
      if (sizeRaf) cancelAnimationFrame(sizeRaf);
      sharedRo?.disconnect();
      sharedRo = void 0;
      sharedIo?.disconnect();
      sharedIo = void 0;
      cellEls.clear();
      panelIdByKey.clear();
      pendingSizes.clear();
    });
    watch(
      () => props.panels.map((p) => p.id).join(","),
      () => {
        const keys = new Set(syncedLayout.value.map((i) => i.i));
        const next = { ...cellSizes.value };
        let dirty = false;
        for (const k of Object.keys(next)) {
          if (!keys.has(k)) {
            const el = cellEls.get(k);
            if (el) {
              sharedRo?.unobserve(el);
              sharedIo?.unobserve(el);
            }
            cellEls.delete(k);
            panelIdByKey.delete(k);
            delete next[k];
            dirty = true;
          }
        }
        if (dirty) cellSizes.value = next;
      }
    );
    const useWindowedGrid = computed(
      () => !props.editable && !props.isViewing && props.panels.length >= LARGE_GRID_THRESHOLD
    );
    const scrollTop = ref(0);
    const viewportHeight = ref(typeof window !== "undefined" ? window.innerHeight : 900);
    function onGridScroll(e) {
      const el = e.target;
      scrollTop.value = el.scrollTop;
      viewportHeight.value = el.clientHeight;
    }
    const fullLayout = computed(
      () => stabilizeLayout(panelsToLayout(props.panels, collapsedRows.value))
    );
    const rowPitch = computed(() => (props.rowHeight ?? 36) + 8);
    const totalGridHeight = computed(() => {
      let maxY = 0;
      for (const item of fullLayout.value) {
        maxY = Math.max(maxY, item.y + item.h);
      }
      return Math.max(200, maxY * rowPitch.value + 24);
    });
    const windowedItems = computed(() => {
      if (!useWindowedGrid.value) return fullLayout.value;
      const top = scrollTop.value - 400;
      const bot = scrollTop.value + viewportHeight.value + 400;
      const pitch = rowPitch.value;
      return fullLayout.value.filter((item) => {
        const y0 = item.y * pitch;
        const y1 = (item.y + item.h) * pitch;
        return y1 >= top && y0 <= bot;
      });
    });
    function absoluteStyle(item) {
      const pitch = rowPitch.value;
      const margin = 8;
      const cols = props.colNum ?? 24;
      const colWidth = Math.max(20, (containerWidth.value - margin * (cols + 1)) / cols);
      const left = margin + item.x * (colWidth + margin);
      const top = margin + item.y * pitch;
      const width2 = item.w * colWidth + Math.max(0, item.w - 1) * margin;
      const height2 = item.h * (props.rowHeight ?? 36) + Math.max(0, item.h - 1) * margin;
      return {
        position: "absolute",
        left: `${left}px`,
        top: `${top}px`,
        width: `${width2}px`,
        height: `${height2}px`
      };
    }
    const emptyTimeRange = {
      from: /* @__PURE__ */ new Date(0),
      to: /* @__PURE__ */ new Date(0),
      raw: { from: "now-6h", to: "now" }
    };
    function dataFor(panelId) {
      return props.panelData[panelId] ?? {
        state: "NotStarted",
        series: [],
        timeRange: emptyTimeRange
      };
    }
    const panelOrder = computed(
      () => syncedLayout.value.filter((it) => !it.isRow).map((it) => Number(it.panelId))
    );
    function selectRelative(delta) {
      const order = panelOrder.value;
      if (!order.length) return;
      const cur = props.selectedPanelId;
      let idx = cur == null ? -1 : order.indexOf(Number(cur));
      if (idx < 0) idx = delta > 0 ? -1 : 0;
      const next = order[Math.max(0, Math.min(order.length - 1, idx + delta))];
      if (next != null) emit("panelClick", next);
    }
    function onGridKeydown(e) {
      const tag = e.target?.tagName?.toLowerCase();
      if (tag === "input" || tag === "textarea" || e.target?.isContentEditable) {
        return;
      }
      if (e.key === "ArrowRight" || e.key === "ArrowDown") {
        e.preventDefault();
        selectRelative(1);
      } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
        e.preventDefault();
        selectRelative(-1);
      } else if (e.key === "Home") {
        e.preventDefault();
        const first = panelOrder.value[0];
        if (first != null) emit("panelClick", first);
      } else if (e.key === "End") {
        e.preventDefault();
        const last = panelOrder.value[panelOrder.value.length - 1];
        if (last != null) emit("panelClick", last);
      } else if ((e.key === "Enter" || e.key === " ") && props.selectedPanelId != null) {
        e.preventDefault();
        emit("panelClick", Number(props.selectedPanelId));
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "rootEl",
        ref: rootEl,
        class: normalizeClass(["dashboard-grid", { "is-editable": __props.editable, "is-windowed": useWindowedGrid.value }]),
        tabindex: "0",
        "data-testid": "dashboard-grid",
        "data-graph-tooltip": String(graphTooltipMode.value),
        "data-cursor-sync": String(graphTooltipMode.value),
        "data-visibility-mode": visibilityMode.value,
        "data-windowed": useWindowedGrid.value ? "true" : "false",
        onKeydown: onGridKeydown,
        onScrollPassive: _cache[3] || (_cache[3] = ($event) => useWindowedGrid.value ? onGridScroll($event) : void 0)
      }, [
        createCommentVNode(" Large view dashboards: absolute windowed layout (no vue-grid-layout O(P) rebuild). "),
        useWindowedGrid.value ? (openBlock(), createElementBlock(
          "div",
          {
            key: 0,
            class: "windowed-grid",
            "data-testid": "dashboard-grid-windowed",
            style: normalizeStyle({ height: `${totalGridHeight.value}px`, position: "relative" })
          },
          [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(windowedItems.value, (item) => {
                return openBlock(), createElementBlock(
                  "div",
                  {
                    key: item.i,
                    class: "dashboard-grid__item windowed-item",
                    style: normalizeStyle(absoluteStyle(item))
                  },
                  [
                    item.isRow ? (openBlock(), createElementBlock("div", {
                      key: 0,
                      class: "row-chrome",
                      "data-testid": `grid-row-${item.panelId}`,
                      onClick: withModifiers(($event) => toggleRow(item.panelId), ["stop"])
                    }, [
                      createElementVNode(
                        "span",
                        _hoisted_3$10,
                        toDisplayString(collapsedRows.value.has(item.panelId) ? "▸" : "▾"),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "strong",
                        null,
                        toDisplayString(panelOf(item)?.title || "行"),
                        1
                        /* TEXT */
                      )
                    ], 8, _hoisted_2$1c)) : withMemo([
                      item.x,
                      item.y,
                      item.w,
                      item.h,
                      __props.panelData[item.panelId],
                      isPanelActive(item.panelId)
                    ], () => (openBlock(), createElementBlock("div", {
                      key: 1,
                      ref_for: true,
                      ref: (el) => bindCell(el, item.i, item.panelId),
                      class: "panel-hit",
                      "data-testid": `grid-panel-${item.panelId}`,
                      "data-panel-active": isPanelActive(item.panelId) ? "true" : "false",
                      tabindex: __props.editable && __props.selectedPanelId === item.panelId ? 0 : -1,
                      onClick: ($event) => emit("panelClick", item.panelId)
                    }, [
                      isPanelActive(item.panelId) ? (openBlock(), createBlock(PanelHost, {
                        key: 0,
                        "panel-id": item.panelId,
                        "panel-type": panelOf(item)?.type ?? "stat",
                        title: replaceForPanel(panelOf(item))(panelOf(item)?.title ?? ""),
                        description: replaceForPanel(panelOf(item))(String(panelOf(item)?.description ?? "")),
                        links: panelOf(item)?.links ?? [],
                        editable: false,
                        "can-edit": false,
                        "is-viewing": !!__props.isViewing,
                        "is-library-panel": !!panelOf(item)?.libraryPanel?.uid,
                        panel: panelComponent(panelOf(item)?.type ?? "stat"),
                        data: dataFor(item.panelId),
                        options: panelOf(item)?.options ?? {},
                        "field-config": panelOf(item)?.fieldConfig ?? { defaults: {}, overrides: [] },
                        width: sizeFor(item).w,
                        height: sizeFor(item).h,
                        "time-range": dataFor(item.panelId).timeRange ?? emptyTimeRange,
                        "replace-variables": replaceForPanel(panelOf(item)),
                        "panel-context": unref(sharedPanelContext),
                        onAction: (a) => emit("panelAction", { ...a, panelId: item.panelId })
                      }, null, 8, ["panel-id", "panel-type", "title", "description", "links", "is-viewing", "is-library-panel", "panel", "data", "options", "field-config", "width", "height", "time-range", "replace-variables", "panel-context", "onAction"])) : (openBlock(), createElementBlock("div", _hoisted_4$Q))
                    ], 8, ["data-testid", "data-panel-active", "tabindex", "onClick"])), _cache, 0)
                  ],
                  4
                  /* STYLE */
                );
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ],
          4
          /* STYLE */
        )) : (openBlock(), createBlock(unref(GridLayout), {
          key: 1,
          layout: syncedLayout.value,
          "onUpdate:layout": _cache[2] || (_cache[2] = ($event) => syncedLayout.value = $event),
          "col-num": __props.colNum,
          "row-height": __props.rowHeight,
          "is-draggable": !!__props.editable,
          "is-resizable": !!__props.editable,
          margin: [8, 8],
          "container-padding": [8, 8],
          "use-css-transforms": true,
          "vertical-compact": false,
          "prevent-collision": false
        }, {
          default: withCtx(() => [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(syncedLayout.value, (item) => {
                return openBlock(), createBlock(unref(GridItem), {
                  key: item.i,
                  i: item.i,
                  x: item.x,
                  y: item.y,
                  w: item.w,
                  h: item.h,
                  "min-w": 2,
                  "min-h": 2,
                  class: "dashboard-grid__item"
                }, {
                  default: withCtx(() => [
                    item.isRow ? (openBlock(), createElementBlock("div", {
                      key: 0,
                      class: "row-chrome",
                      "data-testid": `grid-row-${item.panelId}`,
                      onClick: withModifiers(($event) => toggleRow(item.panelId), ["stop"])
                    }, [
                      createElementVNode(
                        "span",
                        _hoisted_6$E,
                        toDisplayString(collapsedRows.value.has(item.panelId) ? "▸" : "▾"),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "strong",
                        null,
                        toDisplayString(panelOf(item)?.title || "行"),
                        1
                        /* TEXT */
                      )
                    ], 8, _hoisted_5$I)) : withMemo([
                      item.x,
                      item.y,
                      item.w,
                      item.h,
                      __props.panelData[item.panelId],
                      __props.selectedPanelId === item.panelId,
                      isPanelActive(item.panelId),
                      __props.editable,
                      __props.isViewing
                    ], () => (openBlock(), createElementBlock("div", {
                      key: 1,
                      ref_for: true,
                      ref: (el) => bindCell(el, item.i, item.panelId),
                      class: normalizeClass(["panel-hit", {
                        "is-selected": !!__props.editable && __props.selectedPanelId != null && __props.selectedPanelId === item.panelId
                      }]),
                      "data-testid": `grid-panel-${item.panelId}`,
                      "data-selected": !!__props.editable && __props.selectedPanelId != null && __props.selectedPanelId === item.panelId ? "true" : "false",
                      "data-panel-active": isPanelActive(item.panelId) ? "true" : "false",
                      tabindex: __props.editable && __props.selectedPanelId === item.panelId ? 0 : -1,
                      onClick: ($event) => emit("panelClick", item.panelId)
                    }, [
                      panelOf(item) ? (openBlock(), createBlock(DashboardPanelCell, {
                        key: 0,
                        panel: panelOf(item),
                        data: dataFor(item.panelId),
                        width: sizeFor(item).w,
                        height: sizeFor(item).h,
                        editable: !!__props.editable,
                        "is-viewing": !!__props.isViewing,
                        selected: !!__props.editable && __props.selectedPanelId != null && __props.selectedPanelId === item.panelId,
                        "should-mount-renderer": isPanelActive(item.panelId),
                        "replace-variables": replaceForPanel(panelOf(item)),
                        "panel-context": unref(sharedPanelContext),
                        onAction: (a) => emit("panelAction", { ...a, panelId: item.panelId }),
                        onClick: ($event) => emit("panelClick", item.panelId)
                      }, null, 8, ["panel", "data", "width", "height", "editable", "is-viewing", "selected", "should-mount-renderer", "replace-variables", "panel-context", "onAction", "onClick"])) : createCommentVNode("v-if", true)
                    ], 10, ["data-testid", "data-selected", "data-panel-active", "tabindex", "onClick"])), _cache, 1)
                  ]),
                  _: 2
                  /* DYNAMIC */
                }, 1032, ["i", "x", "y", "w", "h"]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ]),
          _: 1
          /* STABLE */
        }, 8, ["layout", "col-num", "row-height", "is-draggable", "is-resizable"]))
      ], 42, _hoisted_1$1s);
    };
  }
});
const DashboardGrid = /* @__PURE__ */ _export_sfc$1(_sfc_main$1w, [["__scopeId", "data-v-6eb6ef6d"]]);
const _hoisted_1$1r = {
  class: "dashboard-canvas",
  "data-testid": "dashboard-canvas"
};
const _hoisted_2$1b = { class: "dashboard-canvas__toolbar" };
const _hoisted_3$$ = { class: "dashboard-canvas__variables" };
const _hoisted_4$P = { class: "dashboard-canvas__body" };
const _sfc_main$1v = /* @__PURE__ */ defineComponent({
  __name: "DashboardCanvas",
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1r, [
        createElementVNode("div", _hoisted_2$1b, [
          renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)
        ]),
        createElementVNode("div", _hoisted_3$$, [
          renderSlot(_ctx.$slots, "variables", {}, void 0, true)
        ]),
        createElementVNode("div", _hoisted_4$P, [
          renderSlot(_ctx.$slots, "editor", {}, void 0, true),
          renderSlot(_ctx.$slots, "grid", {}, void 0, true),
          renderSlot(_ctx.$slots, "empty", {}, void 0, true)
        ])
      ]);
    };
  }
});
const DashboardCanvas = /* @__PURE__ */ _export_sfc$1(_sfc_main$1v, [["__scopeId", "data-v-1d4c2e73"]]);
const _hoisted_1$1q = {
  class: "dashboard-overlays",
  "data-testid": "dashboard-overlays"
};
const _sfc_main$1u = /* @__PURE__ */ defineComponent({
  __name: "DashboardOverlays",
  props: {
    shareOpen: { type: Boolean },
    inspectorOpen: { type: Boolean },
    libraryOpen: { type: Boolean },
    settingsOpen: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1q, [
        renderSlot(_ctx.$slots, "share", {}, void 0, true),
        renderSlot(_ctx.$slots, "inspector", {}, void 0, true),
        __props.libraryOpen ? renderSlot(_ctx.$slots, "library", { key: 0 }, void 0, true) : createCommentVNode("v-if", true),
        __props.settingsOpen ? renderSlot(_ctx.$slots, "settings", { key: 1 }, void 0, true) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const DashboardOverlays = /* @__PURE__ */ _export_sfc$1(_sfc_main$1u, [["__scopeId", "data-v-23c2216b"]]);
const _hoisted_1$1p = ["data-quick-ranges-count", "data-quick-ranges-custom", "data-week-start"];
const _hoisted_2$1a = ["aria-expanded"];
const _hoisted_3$_ = { class: "trp-label" };
const _hoisted_4$O = ["value"];
const _hoisted_5$H = ["value"];
const _hoisted_6$D = { class: "trp-pop__grid" };
const _hoisted_7$x = {
  class: "trp-presets",
  "data-testid": "time-preset-list"
};
const _hoisted_8$s = {
  key: 0,
  class: "trp-history",
  "data-testid": "trp-history"
};
const _hoisted_9$r = ["onClick"];
const _hoisted_10$m = ["data-testid", "onClick"];
const _hoisted_11$m = { class: "trp-absolute" };
const _hoisted_12$l = { class: "raw-row" };
const _hoisted_13$l = ["title"];
const _hoisted_14$i = ["title"];
const _hoisted_15$g = { class: "tz-label" };
const _hoisted_16$d = { class: "trp-pop-actions" };
const HISTORY_KEY = "grafana-vue-time-history";
const _sfc_main$1t = /* @__PURE__ */ defineComponent({
  __name: "TimeRangePicker",
  props: {
    from: {},
    to: {},
    timezone: {},
    weekStart: {},
    quickRanges: {}
  },
  emits: ["update:from", "update:to", "update:timezone", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const open = ref(false);
    const draftFrom = ref(props.from);
    const draftTo = ref(props.to);
    const draftRange = ref(null);
    const rootEl = ref(null);
    const popEl = ref(null);
    const popStyle = ref({});
    function positionPop() {
      const r = rootEl.value?.getBoundingClientRect();
      if (!r) return;
      const width2 = Math.min(546, Math.max(320, window.innerWidth * 0.92));
      let left = r.right - width2;
      if (left < 8) left = 8;
      if (left + width2 > window.innerWidth - 8) left = Math.max(8, window.innerWidth - width2 - 8);
      let top = r.bottom + 6;
      const estH = 360;
      if (top + estH > window.innerHeight - 8 && r.top > estH + 8) {
        top = Math.max(8, r.top - estH - 6);
      }
      popStyle.value = {
        position: "fixed",
        top: `${Math.round(top)}px`,
        left: `${Math.round(left)}px`,
        width: `${Math.round(width2)}px`,
        zIndex: "12000000"
      };
    }
    const defaultRelativePresets = [
      { label: "最近 5 分钟", from: "now-5m", to: "now" },
      { label: "最近 15 分钟", from: "now-15m", to: "now" },
      { label: "最近 30 分钟", from: "now-30m", to: "now" },
      { label: "最近 1 小时", from: "now-1h", to: "now" },
      { label: "最近 3 小时", from: "now-3h", to: "now" },
      { label: "最近 6 小时", from: "now-6h", to: "now" },
      { label: "最近 12 小时", from: "now-12h", to: "now" },
      { label: "最近 24 小时", from: "now-24h", to: "now" },
      { label: "最近 2 天", from: "now-2d", to: "now" },
      { label: "最近 7 天", from: "now-7d", to: "now" },
      { label: "最近 30 天", from: "now-30d", to: "now" },
      { label: "最近 90 天", from: "now-90d", to: "now" },
      { label: "最近 6 个月", from: "now-6M", to: "now" },
      { label: "最近 1 年", from: "now-1y", to: "now" },
      { label: "今天", from: "now/d", to: "now/d" },
      { label: "本周", from: "now/w", to: "now/w" },
      { label: "本月", from: "now/M", to: "now/M" },
      { label: "本年", from: "now/y", to: "now/y" },
      { label: "本财季", from: "now/fQ", to: "now/fQ" },
      { label: "本财年", from: "now/fy", to: "now/fy" }
    ];
    const relativePresets = computed(() => {
      const custom = props.quickRanges;
      if (Array.isArray(custom) && custom.length) {
        return custom.map((r) => ({
          label: String(r.label ?? ""),
          from: String(r.from ?? ""),
          to: String(r.to ?? "")
        })).filter((r) => r.from && r.to);
      }
      return defaultRelativePresets;
    });
    function loadHistory() {
      try {
        return JSON.parse(localStorage.getItem(HISTORY_KEY) ?? "[]");
      } catch {
        return [];
      }
    }
    function saveHistory(range) {
      try {
        const h2 = [
          range,
          ...loadHistory().filter((r) => r.from !== range.from || r.to !== range.to)
        ].slice(0, 4);
        localStorage.setItem(HISTORY_KEY, JSON.stringify(h2));
      } catch {
      }
    }
    const recentHistory = ref(loadHistory());
    const absolutePresets = computed(() => {
      const weekStart = String(props.weekStart ?? "");
      const weekBegin = dayjs(startOfWeekDate(/* @__PURE__ */ new Date(), weekStart));
      return [
        {
          label: "今天",
          value: [dayjs().startOf("day"), dayjs()]
        },
        {
          label: "昨天",
          value: [
            dayjs().subtract(1, "day").startOf("day"),
            dayjs().subtract(1, "day").endOf("day")
          ]
        },
        {
          label: "本周",
          // Honor dashboard weekStart (not dayjs locale default alone)
          value: [weekBegin, dayjs()]
        },
        {
          label: "本月",
          value: [dayjs().startOf("month"), dayjs()]
        },
        {
          label: "近 7 天",
          value: [dayjs().subtract(7, "day"), dayjs()]
        },
        {
          label: "近 30 天",
          value: [dayjs().subtract(30, "day"), dayjs()]
        }
      ];
    });
    const timezoneOptions = [
      { label: "浏览器时区", value: "browser" },
      { label: "UTC", value: "utc" }
    ];
    const display = computed(() => {
      const p = relativePresets.value.find((x) => x.from === props.from && x.to === props.to);
      if (p) return p.label;
      if (/^\d{10,13}$/.test(props.from) && /^\d{10,13}$/.test(props.to)) {
        const a = parseTime(props.from);
        const b = parseTime(props.to);
        return `${a.format("MM-DD HH:mm")} → ${b.format("MM-DD HH:mm")}`;
      }
      return `${props.from} → ${props.to}`;
    });
    function parseTime(raw, fallback = dayjs()) {
      const s = String(raw ?? "").trim();
      if (!s) return fallback;
      if (/^now$/i.test(s)) return dayjs();
      const rel = s.match(/^now-(\d+)([smhdwy])$/i);
      if (rel) {
        const n = Number(rel[1]);
        const u = rel[2];
        const map = {
          s: "second",
          m: "minute",
          h: "hour",
          d: "day",
          w: "week",
          M: "month",
          y: "year"
        };
        return dayjs().subtract(n, map[u] || "minute");
      }
      if (/^\d{10,13}$/.test(s)) {
        const n = Number(s);
        return dayjs(s.length === 10 ? n * 1e3 : n);
      }
      const d = dayjs(s);
      return d.isValid() ? d : fallback;
    }
    function syncDraftFromProps() {
      draftFrom.value = props.from;
      draftTo.value = props.to;
      draftRange.value = [parseTime(props.from), parseTime(props.to)];
    }
    async function openPicker() {
      if (open.value) {
        open.value = false;
        return;
      }
      syncDraftFromProps();
      open.value = true;
      await nextTick();
      positionPop();
    }
    let _debounceTimer;
    function emitTimeRange(from, to) {
      clearTimeout(_debounceTimer);
      _debounceTimer = setTimeout(() => {
        saveHistory({ from, to });
        recentHistory.value = loadHistory();
        emit("update:from", from);
        emit("update:to", to);
        emit("change", from, to);
      }, 300);
    }
    function applyPreset(from, to) {
      draftFrom.value = from;
      draftTo.value = to;
      draftRange.value = [parseTime(from), parseTime(to)];
      emitTimeRange(from, to);
      open.value = false;
    }
    function onRangeChange(v) {
      if (!v || !v[0] || !v[1]) return;
      const a = dayjs(v[0]);
      const b = dayjs(v[1]);
      if (!a.isValid() || !b.isValid()) return;
      draftRange.value = [a, b];
      draftFrom.value = String(a.valueOf());
      draftTo.value = String(b.valueOf());
    }
    function applyAbsolute() {
      if (draftRange.value?.[0] && draftRange.value?.[1]) {
        const f = String(draftRange.value[0].valueOf());
        const t2 = String(draftRange.value[1].valueOf());
        draftFrom.value = f;
        draftTo.value = t2;
        emitTimeRange(f, t2);
      } else {
        emitTimeRange(draftFrom.value, draftTo.value);
      }
      open.value = false;
    }
    function cancel() {
      syncDraftFromProps();
      open.value = false;
    }
    function onDocClick(e) {
      if (!open.value || !rootEl.value) return;
      const t2 = e.target;
      const popup = document.querySelector(".ant-picker-dropdown");
      if (t2 && (rootEl.value.contains(t2) || popEl.value?.contains(t2) || popup?.contains(t2))) {
        return;
      }
      open.value = false;
    }
    function onWinReposition() {
      if (open.value) positionPop();
    }
    function onKey(e) {
      if (e.key === "Escape" && open.value) open.value = false;
    }
    watch(
      () => [props.from, props.to],
      () => {
        if (!open.value) syncDraftFromProps();
      }
    );
    onMounted(() => {
      syncDraftFromProps();
      document.addEventListener("mousedown", onDocClick);
      document.addEventListener("keydown", onKey);
      window.addEventListener("resize", onWinReposition);
      window.addEventListener("scroll", onWinReposition, true);
    });
    onBeforeUnmount(() => {
      clearTimeout(_debounceTimer);
      document.removeEventListener("mousedown", onDocClick);
      document.removeEventListener("keydown", onKey);
      window.removeEventListener("resize", onWinReposition);
      window.removeEventListener("scroll", onWinReposition, true);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "rootEl",
        ref: rootEl,
        class: "trp",
        "data-testid": "time-range-picker",
        "data-quick-ranges-count": String(relativePresets.value.length),
        "data-quick-ranges-custom": String(Array.isArray(__props.quickRanges) && __props.quickRanges.length > 0),
        "data-week-start": String(__props.weekStart ?? "")
      }, [
        createElementVNode("button", {
          type: "button",
          class: normalizeClass(["trp-display", { open: open.value }]),
          "data-testid": "time-display",
          "aria-expanded": open.value,
          "aria-haspopup": "dialog",
          onClick: openPicker
        }, [
          createElementVNode(
            "span",
            _hoisted_3$_,
            toDisplayString(display.value),
            1
            /* TEXT */
          ),
          createVNode(unref(GIcon), {
            name: "angle-down",
            size: 12,
            class: normalizeClass(["trp-chevron", { "is-open": open.value }])
          }, null, 8, ["class"])
        ], 10, _hoisted_2$1a),
        createCommentVNode(" hidden selects for e2e / legacy tests "),
        createVNode(unref(GSelect), {
          class: "time-preset-hidden",
          size: "small",
          "data-testid": "time-preset",
          value: relativePresets.value.find((x) => x.from === draftFrom.value && x.to === draftTo.value) ? `${draftFrom.value}|${draftTo.value}` : void 0,
          options: relativePresets.value.map((p) => ({
            label: p.label,
            value: `${p.from}|${p.to}`
          })),
          style: { "width": "0", "height": "0", "opacity": "0", "position": "absolute", "pointer-events": "none" },
          "popup-class-name": "g-select-dropdown",
          "onUpdate:value": _cache[0] || (_cache[0] = (v) => {
            const s = String(v ?? "");
            const [f, t2] = s.split("|");
            if (f) applyPreset(f, t2 || "now");
          })
        }, null, 8, ["value", "options"]),
        createElementVNode("input", {
          type: "hidden",
          "data-testid": "time-from",
          value: draftFrom.value
        }, null, 8, _hoisted_4$O),
        createElementVNode("input", {
          type: "hidden",
          "data-testid": "time-to",
          value: draftTo.value
        }, null, 8, _hoisted_5$H),
        (openBlock(), createBlock(Teleport, { to: "body" }, [
          open.value ? (openBlock(), createElementBlock(
            "div",
            {
              key: 0,
              ref_key: "popEl",
              ref: popEl,
              class: "trp-pop",
              "data-testid": "time-absolute-panel",
              role: "dialog",
              "aria-label": "时间范围",
              style: normalizeStyle(popStyle.value)
            },
            [
              createElementVNode("div", _hoisted_6$D, [
                createElementVNode("div", _hoisted_7$x, [
                  _cache[3] || (_cache[3] = createElementVNode(
                    "h4",
                    null,
                    "快速范围",
                    -1
                    /* CACHED */
                  )),
                  recentHistory.value.length ? (openBlock(), createElementBlock("div", _hoisted_8$s, [
                    _cache[2] || (_cache[2] = createElementVNode(
                      "div",
                      { class: "trp-section-label" },
                      "最近使用",
                      -1
                      /* CACHED */
                    )),
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(recentHistory.value, (h2, hi) => {
                        return openBlock(), createElementBlock("button", {
                          key: hi,
                          type: "button",
                          class: "preset-item",
                          "data-testid": "trp-history-item",
                          onClick: ($event) => applyPreset(h2.from, h2.to)
                        }, toDisplayString(h2.from) + " → " + toDisplayString(h2.to), 9, _hoisted_9$r);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ])) : createCommentVNode("v-if", true),
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(relativePresets.value, (p) => {
                      return openBlock(), createElementBlock("button", {
                        key: p.from + p.to,
                        type: "button",
                        class: normalizeClass(["preset-item", { active: draftFrom.value === p.from && draftTo.value === p.to }]),
                        "data-testid": `time-preset-${p.from}`,
                        onClick: ($event) => applyPreset(p.from, p.to)
                      }, toDisplayString(p.label), 11, _hoisted_10$m);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ]),
                createElementVNode("div", _hoisted_11$m, [
                  _cache[8] || (_cache[8] = createElementVNode(
                    "h4",
                    null,
                    "绝对时间（RangePicker）",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GRangePicker), {
                    class: "time-range-picker-abs",
                    "data-testid": "time-range-picker-abs",
                    "show-time": "",
                    size: "small",
                    value: draftRange.value,
                    presets: absolutePresets.value,
                    format: "YYYY-MM-DD HH:mm:ss",
                    "allow-clear": false,
                    style: { "width": "100%" },
                    "onUpdate:value": onRangeChange
                  }, null, 8, ["value", "presets", "onUpdate:value"]),
                  createElementVNode("div", _hoisted_12$l, [
                    createElementVNode("code", {
                      class: "raw",
                      title: draftFrom.value
                    }, toDisplayString(draftFrom.value), 9, _hoisted_13$l),
                    _cache[4] || (_cache[4] = createElementVNode(
                      "span",
                      { class: "sep" },
                      "→",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode("code", {
                      class: "raw",
                      title: draftTo.value
                    }, toDisplayString(draftTo.value), 9, _hoisted_14$i)
                  ]),
                  createElementVNode("label", _hoisted_15$g, [
                    _cache[5] || (_cache[5] = createTextVNode(
                      " 时区 ",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GSelect), {
                      class: "tz-select",
                      size: "small",
                      "data-testid": "timezone-select",
                      value: __props.timezone || "browser",
                      options: timezoneOptions,
                      style: { "width": "100%" },
                      "onUpdate:value": _cache[1] || (_cache[1] = ($event) => emit("update:timezone", String($event)))
                    }, null, 8, ["value"])
                  ]),
                  createElementVNode("div", _hoisted_16$d, [
                    createVNode(unref(GButton), {
                      size: "md",
                      variant: "secondary",
                      onClick: cancel
                    }, {
                      default: withCtx(() => [..._cache[6] || (_cache[6] = [
                        createTextVNode(
                          " 取消 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }),
                    createVNode(unref(GButton), {
                      size: "md",
                      variant: "primary",
                      "test-id": "time-abs-apply",
                      onClick: applyAbsolute
                    }, {
                      default: withCtx(() => [..._cache[7] || (_cache[7] = [
                        createTextVNode(
                          " 应用 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    })
                  ])
                ])
              ])
            ],
            4
            /* STYLE */
          )) : createCommentVNode("v-if", true)
        ]))
      ], 8, _hoisted_1$1p);
    };
  }
});
const TimeRangePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$1t, [["__scopeId", "data-v-26cb1326"]]);
const _hoisted_1$1o = ["data-interval"];
const _hoisted_2$19 = { class: "refresh-picker__group" };
const _hoisted_3$Z = {
  key: 0,
  class: "refresh-picker__run-label"
};
const _hoisted_4$N = ["aria-expanded", "aria-label", "title"];
const _hoisted_5$G = { class: "refresh-picker__interval-label" };
const _hoisted_6$C = ["aria-selected", "data-testid", "onClick"];
const _sfc_main$1s = /* @__PURE__ */ defineComponent({
  __name: "RefreshPicker",
  props: {
    value: { default: "" },
    loading: { type: Boolean, default: false },
    intervals: { default: () => [...defaultRefreshIntervals] },
    iconOnly: { type: Boolean, default: false }
  },
  emits: ["refresh", "update:value", "interval-change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const open = ref(false);
    const rootEl = ref(null);
    const menuEl = ref(null);
    const menuStyle = ref({});
    function positionMenu() {
      const r = rootEl.value?.getBoundingClientRect();
      if (!r) return;
      const width2 = 140;
      let left = r.right - width2;
      if (left < 8) left = 8;
      menuStyle.value = {
        position: "fixed",
        top: `${Math.round(r.bottom + 4)}px`,
        left: `${Math.round(left)}px`,
        minWidth: `${width2}px`,
        zIndex: "12000000"
      };
    }
    const options = computed(() => {
      const list = props.intervals?.length ? props.intervals : [...defaultRefreshIntervals];
      return [{ label: "关闭", value: "" }, ...list.map((v) => ({ label: v, value: v }))];
    });
    const currentLabel = computed(() => {
      const v = props.value ?? "";
      if (!v) return "关闭";
      const hit = options.value.find((o) => o.value === v);
      return hit?.label ?? v;
    });
    const intervalActive = computed(() => Boolean(props.value));
    function onRefresh() {
      emit("refresh");
    }
    function selectInterval(next) {
      open.value = false;
      emit("update:value", next);
      emit("interval-change", next);
    }
    async function toggleMenu() {
      if (open.value) {
        open.value = false;
        return;
      }
      open.value = true;
      await nextTick();
      positionMenu();
    }
    function onDocClick(ev) {
      if (!open.value) return;
      const t2 = ev.target;
      if (t2 && (rootEl.value && rootEl.value.contains(t2) || menuEl.value && menuEl.value.contains(t2))) {
        return;
      }
      open.value = false;
    }
    function onWinReposition() {
      if (open.value) positionMenu();
    }
    function onKey(ev) {
      if (ev.key === "Escape") open.value = false;
    }
    onMounted(() => {
      document.addEventListener("mousedown", onDocClick);
      document.addEventListener("keydown", onKey);
      window.addEventListener("resize", onWinReposition);
      window.addEventListener("scroll", onWinReposition, true);
    });
    onBeforeUnmount(() => {
      document.removeEventListener("mousedown", onDocClick);
      document.removeEventListener("keydown", onKey);
      window.removeEventListener("resize", onWinReposition);
      window.removeEventListener("scroll", onWinReposition, true);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "rootEl",
        ref: rootEl,
        class: "refresh-picker",
        "data-testid": "refresh-picker",
        "data-interval": __props.value || "off"
      }, [
        createElementVNode("div", _hoisted_2$19, [
          createVNode(unref(GButton), {
            class: "refresh-picker__run",
            variant: "canvas",
            size: "md",
            "test-id": "refresh-btn",
            loading: __props.loading,
            title: __props.loading ? "刷新中…" : "刷新仪表盘",
            onClick: onRefresh
          }, {
            default: withCtx(() => [
              createVNode(unref(GIcon), { name: "sync" }),
              !__props.iconOnly ? (openBlock(), createElementBlock(
                "span",
                _hoisted_3$Z,
                toDisplayString(__props.loading ? "刷新中…" : "刷新"),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true)
            ]),
            _: 1
            /* STABLE */
          }, 8, ["loading", "title"]),
          createElementVNode("button", {
            type: "button",
            class: "refresh-picker__interval",
            "data-testid": "refresh-interval-btn",
            "aria-expanded": open.value,
            "aria-label": intervalActive.value ? `自动刷新间隔: ${currentLabel.value}` : "自动刷新已关闭，选择刷新间隔",
            title: intervalActive.value ? "设置自动刷新间隔" : "自动刷新关闭",
            onClick: toggleMenu
          }, [
            createElementVNode(
              "span",
              _hoisted_5$G,
              toDisplayString(currentLabel.value),
              1
              /* TEXT */
            ),
            createVNode(unref(GIcon), {
              name: "angle-down",
              size: 12,
              class: normalizeClass(["refresh-picker__caret", { "is-open": open.value }])
            }, null, 8, ["class"])
          ], 8, _hoisted_4$N)
        ]),
        (openBlock(), createBlock(Teleport, { to: "body" }, [
          open.value ? (openBlock(), createElementBlock(
            "ul",
            {
              key: 0,
              ref_key: "menuEl",
              ref: menuEl,
              class: "refresh-picker__menu",
              role: "listbox",
              "data-testid": "refresh-interval-menu",
              style: normalizeStyle(menuStyle.value)
            },
            [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(options.value, (opt) => {
                  return openBlock(), createElementBlock("li", {
                    key: opt.value || "off",
                    role: "option",
                    "aria-selected": (__props.value || "") === opt.value,
                    "data-testid": `refresh-interval-${opt.value || "off"}`,
                    class: normalizeClass({
                      "refresh-picker__option": true,
                      "is-active": (__props.value || "") === opt.value
                    }),
                    onClick: ($event) => selectInterval(opt.value)
                  }, toDisplayString(opt.label), 11, _hoisted_6$C);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ],
            4
            /* STYLE */
          )) : createCommentVNode("v-if", true)
        ]))
      ], 8, _hoisted_1$1o);
    };
  }
});
const RefreshPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$1s, [["__scopeId", "data-v-5ce12a8b"]]);
function buildDashboardLinkUrl(link, ctx = {}) {
  if (String(link.type ?? "link") === "dashboards") {
    const tags = (link.tags ?? []).map(String).filter(Boolean);
    const q = new URLSearchParams();
    for (const t2 of tags) q.append("tag", t2);
    const qs = q.toString();
    return qs ? `/dashboards?${qs}` : "/dashboards";
  }
  const raw = String(link.url ?? "").trim();
  if (!raw) return "#";
  let url;
  try {
    url = new URL(raw, typeof window !== "undefined" ? window.location.origin : "http://localhost");
  } catch {
    return raw;
  }
  if (link.keepTime) {
    if (ctx.from) url.searchParams.set("from", String(ctx.from));
    if (ctx.to) url.searchParams.set("to", String(ctx.to));
  }
  if (link.includeVars && ctx.variables) {
    for (const [name, val] of Object.entries(ctx.variables)) {
      const key = `var-${name}`;
      url.searchParams.delete(key);
      if (Array.isArray(val)) {
        for (const item of val) url.searchParams.append(key, String(item));
      } else if (val != null && String(val) !== "") {
        url.searchParams.set(key, String(val));
      }
    }
  }
  if (/^https?:\/\//i.test(raw)) {
    return url.toString();
  }
  return `${url.pathname}${url.search}${url.hash}`;
}
function visibleDashboardLinks(links) {
  if (!Array.isArray(links)) return [];
  return links.filter((l) => l && String(l.title ?? "").trim() !== "");
}
const _hoisted_1$1n = ["data-link-count"];
const _hoisted_2$18 = ["href", "title", "target", "rel", "data-testid", "data-keep-time", "data-include-vars", "data-link-type"];
const _sfc_main$1r = /* @__PURE__ */ defineComponent({
  __name: "DashboardLinks",
  props: {
    links: {},
    from: {},
    to: {},
    variables: {}
  },
  setup(__props) {
    const props = __props;
    const items = computed(() => visibleDashboardLinks(props.links));
    const ctx = computed(() => ({
      from: props.from,
      to: props.to,
      variables: props.variables
    }));
    function href(link) {
      return buildDashboardLinkUrl(link, ctx.value);
    }
    return (_ctx, _cache) => {
      return items.value.length ? (openBlock(), createElementBlock("nav", {
        key: 0,
        class: "dashboard-links",
        "data-testid": "dashboard-links",
        "data-link-count": String(items.value.length),
        "aria-label": "仪表盘链接"
      }, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(items.value, (link, i) => {
            return openBlock(), createElementBlock("a", {
              key: i,
              class: "dashboard-link",
              href: href(link),
              title: String(link.tooltip || link.title || ""),
              target: link.targetBlank === false ? void 0 : "_blank",
              rel: link.targetBlank === false ? void 0 : "noopener noreferrer",
              "data-testid": `dashboard-link-${i}`,
              "data-keep-time": String(!!link.keepTime),
              "data-include-vars": String(!!link.includeVars),
              "data-link-type": String(link.type || "link")
            }, toDisplayString(link.title), 9, _hoisted_2$18);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ], 8, _hoisted_1$1n)) : createCommentVNode("v-if", true);
    };
  }
});
const DashboardLinks = /* @__PURE__ */ _export_sfc$1(_sfc_main$1r, [["__scopeId", "data-v-89891d58"]]);
const _hoisted_1$1m = ["data-panel-editing"];
const _hoisted_2$17 = { class: "dashboard-page__title" };
const _hoisted_3$Y = {
  key: 1,
  class: "home-link",
  href: "/dashboards",
  "data-testid": "nav-dashboards",
  title: "仪表盘列表",
  "aria-label": "仪表盘列表"
};
const _hoisted_4$M = ["title"];
const _hoisted_5$F = {
  key: 2,
  class: "dirty",
  "data-testid": "dirty-indicator",
  title: "有未保存更改",
  "aria-label": "有未保存更改"
};
const _hoisted_6$B = { class: "dashboard-page__actions" };
const _hoisted_7$w = ["data-timepicker-hidden"];
const _hoisted_8$r = {
  key: 1,
  class: "toolbar-group toolbar-group--time is-hidden",
  "data-testid": "dashboard-time-controls",
  "data-timepicker-hidden": "true",
  "aria-hidden": "true"
};
const _hoisted_9$q = {
  key: 0,
  class: "toolbar-group toolbar-group--secondary",
  role: "group",
  "aria-label": "编辑操作"
};
const _hoisted_10$l = {
  class: "toolbar-group",
  role: "group",
  "aria-label": "面板与分享"
};
const _hoisted_11$l = {
  key: 1,
  class: "toolbar-group",
  role: "group",
  "aria-label": "面板编辑"
};
const _hoisted_12$k = {
  class: "toolbar-group toolbar-group--primary",
  role: "group",
  "aria-label": "模式"
};
const _hoisted_13$k = {
  key: 0,
  class: "library-flag",
  "data-testid": "library-open-flag"
};
const _sfc_main$1q = /* @__PURE__ */ defineComponent({
  __name: "DashboardPageHeader",
  props: {
    embedded: { type: Boolean },
    editMode: { type: Boolean },
    panelEditing: { type: Boolean },
    title: {},
    dirty: { type: Boolean },
    canUndo: { type: Boolean },
    canRedo: { type: Boolean },
    timeFrom: {},
    timeTo: {},
    timezone: {},
    weekStart: {},
    refresh: {},
    refreshIntervals: {},
    timepickerHidden: { type: Boolean },
    quickRanges: {},
    links: {},
    linkVariables: {},
    isRefreshing: { type: Boolean },
    selectedPanelId: {},
    libraryOpen: { type: Boolean },
    saving: { type: Boolean },
    canSave: { type: Boolean },
    canEditDashboard: { type: Boolean }
  },
  emits: ["back", "import-json", "undo", "redo", "open-variables", "open-settings", "share", "inspect", "toggle-edit", "cancel", "add-panel", "copy-panel", "dup-panel", "paste-panel", "screenshot", "save", "set-time", "update-from", "update-to", "update-timezone", "set-refresh", "do-refresh"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("header", {
        class: normalizeClass(["dashboard-page__header", { "dashboard-page__header--panel-editing": __props.panelEditing }]),
        "data-testid": "dashboard-page-header",
        "data-panel-editing": __props.panelEditing ? "1" : "0"
      }, [
        createElementVNode("div", _hoisted_2$17, [
          __props.embedded ? (openBlock(), createElementBlock("button", {
            key: 0,
            class: "home-link",
            type: "button",
            "data-testid": "nav-dashboards",
            title: "返回仪表盘列表",
            "aria-label": "返回仪表盘列表",
            onClick: _cache[0] || (_cache[0] = ($event) => emit("back"))
          }, [
            createVNode(unref(ArrowLeftOutlined))
          ])) : (openBlock(), createElementBlock("a", _hoisted_3$Y, [
            createVNode(unref(ArrowLeftOutlined))
          ])),
          createVNode(unref(GIcon), { name: "dashboard" }),
          createElementVNode("h1", {
            title: __props.title || "仪表盘"
          }, toDisplayString(__props.title || "仪表盘"), 9, _hoisted_4$M),
          __props.dirty && !__props.panelEditing ? (openBlock(), createElementBlock("span", _hoisted_5$F, "●")) : createCommentVNode("v-if", true),
          !__props.panelEditing ? (openBlock(), createBlock(DashboardLinks, {
            key: 3,
            links: __props.links,
            from: __props.timeFrom,
            to: __props.timeTo,
            variables: __props.linkVariables
          }, null, 8, ["links", "from", "to", "variables"])) : createCommentVNode("v-if", true)
        ]),
        createElementVNode("div", _hoisted_6$B, [
          !__props.timepickerHidden ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: "toolbar-group toolbar-group--time",
            role: "group",
            "aria-label": "时间范围",
            "data-testid": "dashboard-time-controls",
            "data-timepicker-hidden": String(!!__props.timepickerHidden)
          }, [
            createVNode(TimeRangePicker, {
              from: __props.timeFrom,
              to: __props.timeTo,
              timezone: __props.timezone,
              "week-start": __props.weekStart,
              "quick-ranges": __props.quickRanges,
              onChange: _cache[1] || (_cache[1] = (f, t2) => emit("set-time", f, t2)),
              "onUpdate:from": _cache[2] || (_cache[2] = (f) => emit("update-from", f)),
              "onUpdate:to": _cache[3] || (_cache[3] = (t2) => emit("update-to", t2)),
              "onUpdate:timezone": _cache[4] || (_cache[4] = (tz) => emit("update-timezone", tz))
            }, null, 8, ["from", "to", "timezone", "week-start", "quick-ranges"]),
            createVNode(RefreshPicker, {
              value: __props.refresh,
              loading: __props.isRefreshing,
              intervals: __props.refreshIntervals,
              onRefresh: _cache[5] || (_cache[5] = ($event) => emit("do-refresh")),
              "onUpdate:value": _cache[6] || (_cache[6] = (v) => emit("set-refresh", v))
            }, null, 8, ["value", "loading", "intervals"])
          ], 8, _hoisted_7$w)) : (openBlock(), createElementBlock("div", _hoisted_8$r)),
          createCommentVNode(" Grafana NavToolbar: while editPanel open, hide dashboard bulk actions "),
          !__props.panelEditing ? (openBlock(), createElementBlock(
            Fragment,
            { key: 2 },
            [
              !__props.embedded || __props.editMode ? (openBlock(), createElementBlock("div", _hoisted_9$q, [
                !__props.embedded ? (openBlock(), createBlock(unref(GButton), {
                  key: 0,
                  size: "md",
                  variant: "toolbar",
                  "test-id": "import-dashboard-btn",
                  onClick: _cache[7] || (_cache[7] = ($event) => emit("import-json"))
                }, {
                  default: withCtx(() => [..._cache[22] || (_cache[22] = [
                    createTextVNode(
                      " 导入 JSON ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })) : createCommentVNode("v-if", true),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "undo-btn",
                  disabled: !__props.canUndo,
                  onClick: _cache[8] || (_cache[8] = ($event) => emit("undo"))
                }, {
                  default: withCtx(() => [..._cache[23] || (_cache[23] = [
                    createTextVNode(
                      " 撤销 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled"]),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "redo-btn",
                  disabled: !__props.canRedo,
                  onClick: _cache[9] || (_cache[9] = ($event) => emit("redo"))
                }, {
                  default: withCtx(() => [..._cache[24] || (_cache[24] = [
                    createTextVNode(
                      " 重做 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled"]),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "variables-settings-btn",
                  onClick: _cache[10] || (_cache[10] = ($event) => emit("open-variables"))
                }, {
                  default: withCtx(() => [..._cache[25] || (_cache[25] = [
                    createTextVNode(
                      " 变量 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "dashboard-settings-btn",
                  onClick: _cache[11] || (_cache[11] = ($event) => emit("open-settings"))
                }, {
                  default: withCtx(() => [..._cache[26] || (_cache[26] = [
                    createTextVNode(
                      " 设置 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ])) : createCommentVNode("v-if", true),
              createElementVNode("div", _hoisted_10$l, [
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "share-btn",
                  onClick: _cache[12] || (_cache[12] = ($event) => emit("share"))
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GIcon), { name: "share" }),
                    _cache[27] || (_cache[27] = createTextVNode(
                      " 分享 ",
                      -1
                      /* CACHED */
                    ))
                  ]),
                  _: 1
                  /* STABLE */
                }),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "inspect-btn",
                  disabled: __props.selectedPanelId == null,
                  onClick: _cache[13] || (_cache[13] = ($event) => emit("inspect"))
                }, {
                  default: withCtx(() => [..._cache[28] || (_cache[28] = [
                    createTextVNode(
                      " 检查 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled"]),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "screenshot-btn",
                  onClick: _cache[14] || (_cache[14] = ($event) => emit("screenshot"))
                }, {
                  default: withCtx(() => [..._cache[29] || (_cache[29] = [
                    createTextVNode(
                      " 截图 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ]),
              __props.editMode ? (openBlock(), createElementBlock("div", _hoisted_11$l, [
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "add-panel-btn",
                  onClick: _cache[15] || (_cache[15] = ($event) => emit("add-panel"))
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GIcon), { name: "plus" }),
                    _cache[30] || (_cache[30] = createTextVNode(
                      " 添加面板 ",
                      -1
                      /* CACHED */
                    ))
                  ]),
                  _: 1
                  /* STABLE */
                }),
                __props.selectedPanelId != null ? (openBlock(), createBlock(unref(GButton), {
                  key: 0,
                  size: "md",
                  variant: "toolbar",
                  "test-id": "copy-panel-btn",
                  onClick: _cache[16] || (_cache[16] = ($event) => emit("copy-panel"))
                }, {
                  default: withCtx(() => [..._cache[31] || (_cache[31] = [
                    createTextVNode(
                      " 复制 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })) : createCommentVNode("v-if", true),
                __props.selectedPanelId != null ? (openBlock(), createBlock(unref(GButton), {
                  key: 1,
                  size: "md",
                  variant: "toolbar",
                  "test-id": "dup-panel-btn",
                  onClick: _cache[17] || (_cache[17] = ($event) => emit("dup-panel"))
                }, {
                  default: withCtx(() => [..._cache[32] || (_cache[32] = [
                    createTextVNode(
                      " 复制面板 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })) : createCommentVNode("v-if", true),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  "test-id": "paste-panel-btn",
                  onClick: _cache[18] || (_cache[18] = ($event) => emit("paste-panel"))
                }, {
                  default: withCtx(() => [..._cache[33] || (_cache[33] = [
                    createTextVNode(
                      " 粘贴 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ])) : createCommentVNode("v-if", true),
              createElementVNode("div", _hoisted_12$k, [
                __props.libraryOpen ? (openBlock(), createElementBlock("span", _hoisted_13$k, "面板库已打开")) : createCommentVNode("v-if", true),
                (!__props.embedded || !__props.editMode) && __props.canEditDashboard !== false ? (openBlock(), createBlock(unref(GButton), {
                  key: 1,
                  size: "md",
                  "test-id": "edit-btn",
                  variant: __props.editMode ? "primary" : "toolbar",
                  onClick: _cache[19] || (_cache[19] = ($event) => emit("toggle-edit"))
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GIcon), { name: "pen" }),
                    createTextVNode(
                      " " + toDisplayString(__props.editMode ? "查看" : "编辑"),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["variant"])) : createCommentVNode("v-if", true),
                __props.embedded && __props.editMode ? (openBlock(), createBlock(unref(GButton), {
                  key: 2,
                  size: "md",
                  variant: "toolbar",
                  "test-id": "cancel-edit-btn",
                  onClick: _cache[20] || (_cache[20] = ($event) => emit("cancel"))
                }, {
                  default: withCtx(() => [..._cache[34] || (_cache[34] = [
                    createTextVNode(
                      " 取消 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })) : createCommentVNode("v-if", true),
                !__props.embedded || __props.editMode ? (openBlock(), createBlock(unref(GButton), {
                  key: 3,
                  size: "md",
                  "test-id": "save-btn",
                  variant: "primary",
                  loading: !!__props.saving,
                  disabled: !!__props.saving || !__props.canSave,
                  onClick: _cache[21] || (_cache[21] = ($event) => emit("save"))
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GIcon), { name: "save" }),
                    _cache[35] || (_cache[35] = createTextVNode(
                      " 保存 ",
                      -1
                      /* CACHED */
                    ))
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["loading", "disabled"])) : createCommentVNode("v-if", true)
              ])
            ],
            64
            /* STABLE_FRAGMENT */
          )) : createCommentVNode("v-if", true)
        ])
      ], 10, _hoisted_1$1m);
    };
  }
});
const DashboardPageHeader = /* @__PURE__ */ _export_sfc$1(_sfc_main$1q, [["__scopeId", "data-v-29353301"]]);
function useDashboardPageController(opts) {
  const mode2 = ref("view");
  const selectedPanelId = ref(null);
  const shareOpen = ref(false);
  const inspectorOpen = ref(false);
  const libraryOpen = ref(false);
  const settingsOpen = ref(false);
  const editSession = ref(null);
  const anyOverlayOpen = computed(
    () => shareOpen.value || inspectorOpen.value || libraryOpen.value || settingsOpen.value
  );
  function selectPanel(id) {
    selectedPanelId.value = id;
  }
  function openShare() {
    shareOpen.value = true;
  }
  function closeShare() {
    shareOpen.value = false;
  }
  function openInspector() {
    inspectorOpen.value = true;
  }
  function closeInspector() {
    inspectorOpen.value = false;
  }
  function openLibrary() {
    libraryOpen.value = true;
  }
  function closeLibrary() {
    libraryOpen.value = false;
  }
  function openSettings() {
    settingsOpen.value = true;
    mode2.value = "settings";
  }
  function closeSettings() {
    settingsOpen.value = false;
    if (mode2.value === "settings") mode2.value = "view";
  }
  function closeTopOverlay() {
    if (settingsOpen.value) return closeSettings();
    if (libraryOpen.value) return closeLibrary();
    if (inspectorOpen.value) return closeInspector();
    if (shareOpen.value) return closeShare();
  }
  function setEditSession(session) {
    editSession.value = session;
  }
  function dispatch(action) {
    switch (action.type) {
      case "select-panel":
        return selectPanel(action.panelId);
      case "open-share":
        return openShare();
      case "close-share":
        return closeShare();
      case "open-inspector":
        return openInspector();
      case "close-inspector":
        return closeInspector();
      case "open-library":
        return openLibrary();
      case "close-library":
        return closeLibrary();
      case "open-settings":
        return openSettings();
      case "close-settings":
        return closeSettings();
      case "close-top-overlay":
        return closeTopOverlay();
      case "set-mode":
        mode2.value = action.mode;
        return;
      case "set-edit-session":
        return setEditSession(action.session);
    }
  }
  return {
    mode: mode2,
    selectedPanelId,
    shareOpen,
    inspectorOpen,
    libraryOpen,
    settingsOpen,
    editSession,
    anyOverlayOpen,
    selectPanel,
    openShare,
    closeShare,
    openInspector,
    closeInspector,
    openLibrary,
    closeLibrary,
    openSettings,
    closeSettings,
    closeTopOverlay,
    setEditSession,
    dispatch
  };
}
const KEY = "grafana.dashboard.panelStyles";
function copyPanelStyles(panel2) {
  const payload = {
    fieldConfig: panel2.fieldConfig ? JSON.parse(JSON.stringify(panel2.fieldConfig)) : void 0,
    options: panel2.options ? JSON.parse(JSON.stringify(panel2.options)) : {},
    transparent: !!panel2.transparent,
    type: panel2.type
  };
  try {
    if (typeof localStorage !== "undefined") {
      localStorage.setItem(KEY, JSON.stringify(payload));
    }
  } catch {
  }
  return payload;
}
function hasPanelStyles() {
  try {
    if (typeof localStorage === "undefined") return false;
    return !!localStorage.getItem(KEY);
  } catch {
    return false;
  }
}
function peekPanelStyles() {
  try {
    if (typeof localStorage === "undefined") return null;
    const raw = localStorage.getItem(KEY);
    if (!raw) return null;
    return JSON.parse(raw);
  } catch {
    return null;
  }
}
function pastePanelStyles(panel2) {
  const styles = peekPanelStyles();
  if (!styles) return panel2;
  const next = JSON.parse(JSON.stringify(panel2));
  if (styles.fieldConfig) next.fieldConfig = styles.fieldConfig;
  if (styles.options) {
    next.options = { ...next.options || {}, ...styles.options };
  }
  if (styles.transparent != null) next.transparent = styles.transparent;
  return next;
}
function createPanelActionHandlers(deps) {
  function onPanelExplore(id) {
    deps.openShare(id, "link");
    deps.setMenuNotice("探索路由尚未接入，已打开分享抽屉（带面板焦点）");
  }
  function onPanelCopy(id) {
    deps.setSelectedPanel(deps.getPanels().find((p) => p.id === id) ?? null);
    deps.store.copySelectedPanel(id);
  }
  function onPanelToggleLegend(id) {
    if (!deps.canMutate()) return;
    const panel2 = deps.getPanels().find((p) => p.id === id);
    if (!panel2) return;
    const legend = panel2.options?.legend;
    const show = legend?.showLegend !== false;
    deps.store.updatePanel({
      ...panel2,
      options: {
        ...panel2.options || {},
        legend: { ...legend || {}, showLegend: !show }
      }
    });
  }
  function onPanelFullscreen(id) {
    deps.onPanelView(id);
  }
  function onPanelHelp(id) {
    deps.setSelectedPanel(deps.getPanels().find((p) => p.id === id) ?? null);
    deps.setInspectTabOverride("help");
    deps.openInspect(id, "help");
  }
  function onPanelCopyStyles(id) {
    const panel2 = deps.getPanels().find((p) => p.id === id);
    if (!panel2) return;
    copyPanelStyles(panel2);
    deps.setMenuNotice("已复制面板样式");
    setTimeout(() => deps.setMenuNotice(""), 2500);
  }
  function onPanelPasteStyles(id) {
    if (!deps.canMutate()) return;
    const panel2 = deps.getPanels().find((p) => p.id === id);
    if (!panel2 || !hasPanelStyles()) {
      deps.setMenuNotice("无可用样式剪贴板");
      setTimeout(() => deps.setMenuNotice(""), 2500);
      return;
    }
    deps.store.updatePanel(pastePanelStyles(panel2));
    deps.setMenuNotice("已粘贴面板样式");
    setTimeout(() => deps.setMenuNotice(""), 2500);
  }
  function onPanelTimeSettings(id) {
    if (!deps.canMutate()) return;
    const panel2 = deps.getPanels().find((p) => p.id === id);
    if (!panel2) return;
    deps.setSelectedPanel(panel2);
    const current = String(panel2.timeFrom ?? "");
    const next = typeof window !== "undefined" ? window.prompt("面板时间覆盖 (timeFrom，如 now-1h；留空清除)", current) : null;
    if (next === null) return;
    const updated = { ...panel2 };
    if (!next.trim()) delete updated.timeFrom;
    else updated.timeFrom = next.trim();
    deps.store.updatePanel(updated);
    deps.setMenuNotice(updated.timeFrom ? `面板时间: ${updated.timeFrom}` : "已清除面板时间覆盖");
    setTimeout(() => deps.setMenuNotice(""), 2500);
    void deps.store.refreshPanel?.(updated);
  }
  function onPanelLibrary(id) {
    if (!deps.canMutate()) return;
    const name = typeof window !== "undefined" ? window.prompt(
      "库面板名称",
      deps.getPanels().find((p) => p.id === id)?.title || `Panel ${id}`
    ) : null;
    if (!name) return;
    const saved = deps.store.saveSelectedAsLibraryPanel(id, name);
    deps.setMenuNotice(saved ? `已保存库面板: ${saved.name}` : "保存库面板失败");
    deps.setLibraryItems(listLibraryPanels());
    setTimeout(() => deps.setMenuNotice(""), 2500);
  }
  function onPanelAlertRule(id) {
    deps.setSelectedPanel(deps.getPanels().find((p) => p.id === id) ?? null);
    deps.setMenuNotice("告警：当前环境无 Alerting 后端，无法创建规则（Grafana 同场景隐藏/说明）");
    setTimeout(() => deps.setMenuNotice(""), 4e3);
  }
  function unlinkSelectedLibrary(id) {
    if (!deps.canMutate()) return;
    if (id == null) return;
    deps.store.unlinkLibraryPanel(id);
    deps.setSelectedPanel(deps.getPanels().find((p) => p.id === id) ?? null);
  }
  function onPanelAction(action) {
    const id = Number(action.panelId);
    if (!deps.canMutate() && [
      "edit",
      "duplicate",
      "remove",
      "toggle-legend",
      "paste-styles",
      "time-settings",
      "library-panel",
      "unlink-library",
      "alert-rule"
    ].includes(action.type)) {
      if (action.type === "edit") deps.requestEditMode();
      return;
    }
    switch (action.type) {
      case "edit":
        deps.onPanelEdit(id);
        break;
      case "view":
        deps.onPanelView(id);
        break;
      case "inspect":
        deps.openInspect(id, action.tab);
        break;
      case "duplicate":
        deps.store.duplicateSelectedPanel(id);
        break;
      case "remove":
        deps.store.deletePanel(id);
        break;
      case "share":
        deps.openShare(
          id,
          action.mode ?? "link"
        );
        break;
      case "explore":
        onPanelExplore(id);
        break;
      case "copy":
        onPanelCopy(id);
        break;
      case "toggle-legend":
        onPanelToggleLegend(id);
        break;
      case "fullscreen":
        onPanelFullscreen(id);
        break;
      case "help":
        onPanelHelp(id);
        break;
      case "copy-styles":
        onPanelCopyStyles(id);
        break;
      case "paste-styles":
        onPanelPasteStyles(id);
        break;
      case "time-settings":
        onPanelTimeSettings(id);
        break;
      case "library-panel":
        onPanelLibrary(id);
        break;
      case "unlink-library":
        unlinkSelectedLibrary(id);
        break;
      case "alert-rule":
        onPanelAlertRule(id);
        break;
    }
  }
  return {
    onPanelExplore,
    onPanelCopy,
    onPanelToggleLegend,
    onPanelFullscreen,
    onPanelHelp,
    onPanelCopyStyles,
    onPanelPasteStyles,
    onPanelTimeSettings,
    onPanelLibrary,
    onPanelAlertRule,
    unlinkSelectedLibrary,
    onPanelAction
  };
}
function createDashboardPageEditActions(store2, router, state2) {
  function onPanelEdit(id) {
    if (typeof store2.canEditDashboard === "function" && !store2.canEditDashboard()) {
      return;
    }
    if (!state2.canMutate()) {
      state2.requestEditMode();
      return;
    }
    const expanded = state2.getPanels();
    const originId = resolveRepeatOriginId(id, expanded) ?? id;
    const docPanels = state2.getDocumentPanels?.() ?? expanded.filter((p) => !isRepeatClone(p));
    const panel2 = findOriginPanel(id, docPanels, expanded) ?? expanded.find((p) => Number(p.id) === Number(originId)) ?? expanded.find((p) => p.id === id) ?? null;
    state2.setSelectedPanel(panel2);
    store2.setEditMode(true);
    state2.setEditingPanelId(originId);
    if (panel2) {
      const editPanel = Number(panel2.id) === Number(originId) ? panel2 : { ...panel2, id: originId };
      state2.setPanelEditSession(
        openPanelEditSession(editPanel, {
          isNewPanel: Boolean(editPanel.isNew),
          isLibraryPanel: Boolean(editPanel.libraryPanel)
        })
      );
    }
    try {
      router.replaceQuery(
        exclusiveEditViewQuery(router.currentQuery(), {
          panelId: originId,
          mode: "edit"
        })
      );
    } catch {
    }
  }
  function exitViewPanel() {
    try {
      const q = { ...router.currentQuery() };
      delete q.viewPanel;
      router.replaceQuery(q);
    } catch {
    }
  }
  function onPanelView(id) {
    if (state2.getViewPanelId() != null && Number(state2.getViewPanelId()) === Number(id)) {
      exitViewPanel();
      return;
    }
    state2.setSelectedPanel(state2.getPanels().find((p) => p.id === id) ?? null);
    store2.setEditMode(false);
    state2.setEditingPanelId(null);
    try {
      router.replaceQuery({
        ...router.currentQuery(),
        viewPanel: String(id),
        editPanel: void 0
      });
    } catch {
    }
  }
  function onPanelClick(id) {
    state2.setSelectedPanel(state2.getPanels().find((p) => p.id === id) ?? null);
  }
  function applyPanel(panel2, lastData) {
    if (!state2.canMutate()) return;
    const live = state2.getPanels().find((p) => p.id === panel2.id) ?? panel2;
    const session = state2.getPanelEditSession() && String(state2.getPanelEditSession().panelId) === String(panel2.id) ? state2.getPanelEditSession() : openPanelEditSession(live, {
      isNewPanel: Boolean(
        live.isNew || panel2.isNew
      )
    });
    const result = exitBack(session, panel2);
    store2.pushHistory();
    store2.updatePanel(result.panel);
    state2.setSelectedPanel(result.panel);
    state2.setEditingPanelId(null);
    state2.setPanelEditSession(null);
    if (lastData && lastData.state && lastData.state !== "Loading") {
      store2.seedPanelData(result.panel.id, lastData);
    }
    void store2.refreshPanel(result.panel);
    try {
      router.replaceQuery(
        exclusiveEditViewQuery(router.currentQuery(), {
          panelId: result.panel.id,
          mode: "none"
        })
      );
    } catch {
    }
  }
  function cancelPanelEdit() {
    const panel2 = state2.getSelectedPanel();
    const id = state2.getEditingPanelId() ?? panel2?.id ?? null;
    const live = id != null ? state2.getPanels().find((p) => p.id === id) ?? panel2 : panel2;
    const session = state2.getPanelEditSession() ?? (live ? openPanelEditSession(live, {
      isNewPanel: Boolean(live.isNew)
    }) : null);
    state2.setEditingPanelId(null);
    if (session) {
      const result = exitDiscard(session);
      if (result.kind === "discard-delete") {
        store2.deletePanel(Number(result.panelId));
        state2.setSelectedPanel(null);
      } else if (result.kind === "discard-restore") {
        store2.updatePanel(result.panel);
        state2.setSelectedPanel(result.panel);
      }
      state2.setPanelEditSession(null);
    } else if (panel2 && panel2.isNew && id != null) {
      store2.deletePanel(id);
      state2.setSelectedPanel(null);
    }
    try {
      router.replaceQuery(
        exclusiveEditViewQuery(router.currentQuery(), {
          panelId: id ?? 0,
          mode: "none"
        })
      );
    } catch {
    }
  }
  function addPanelAndEdit(type = "timeseries") {
    if (!state2.canMutate()) return;
    store2.setEditMode(true);
    const id = store2.addPanel(type);
    if (id == null) return;
    onPanelEdit(id);
  }
  return {
    onPanelEdit,
    onPanelView,
    exitViewPanel,
    onPanelClick,
    applyPanel,
    cancelPanelEdit,
    addPanelAndEdit
  };
}
function createDashboardPageSettingsActions(store2, opts) {
  function onAdhocChange(name, filters) {
    const list = (store2.document?.templating?.list ?? []).map(
      (v) => v.name === name ? {
        ...v,
        filters,
        current: {
          text: filters.map((f) => `${f.key}${f.operator}${f.value}`).join(","),
          value: JSON.stringify(filters)
        }
      } : v
    );
    store2.updateVariables(list);
  }
  function onVariablesChange(list) {
    if (!opts.canMutate()) return;
    store2.updateVariables(list);
    void store2.refreshVariables?.();
  }
  function unlinkSelectedLibrary(id) {
    if (!opts.canMutate()) return;
    const panelId = id ?? opts.getSelectedPanel()?.id;
    if (panelId == null) return;
    store2.unlinkLibraryPanel(panelId);
    opts.setSelectedPanel(opts.getPanels().find((p) => p.id === panelId) ?? null);
  }
  function addFromLibrary(uid) {
    if (!opts.canMutate()) return;
    store2.addLibraryPanelToDashboard(uid);
    opts.closeLibrary();
  }
  function applyEmbeddedDatasources(list) {
    if (list) {
      store2.setEmbeddedDatasources(list);
      return;
    }
    store2.applyDocumentEmbeddedDatasources();
  }
  function onDashboardSettingsPatch(patch) {
    if (!opts.canMutate()) return;
    if (!store2.document) return;
    const next = { ...store2.document, ...patch };
    void store2.loadLocal(next);
  }
  function onDatasourcesChange(list) {
    if (!opts.canMutate()) return;
    store2.setEmbeddedDatasources(list);
  }
  function onAnnotationsChange(list) {
    if (!opts.canMutate()) return;
    if (!store2.document) return;
    const next = {
      ...store2.document,
      annotations: { ...store2.document.annotations || {}, list }
    };
    void store2.loadLocal(next);
  }
  function onLinksChange(links) {
    if (!opts.canMutate()) return;
    if (!store2.document) return;
    const next = { ...store2.document, links };
    void store2.loadLocal(next);
  }
  function onSettingsJsonApply(raw) {
    if (!opts.canMutate()) return;
    void store2.loadLocal(raw);
    opts.closeSettings();
  }
  function onLayoutUpdated(next) {
    if (!opts.canMutate()) return;
    store2.updateLayout(next);
  }
  return {
    onAdhocChange,
    onVariablesChange,
    unlinkSelectedLibrary,
    addFromLibrary,
    applyEmbeddedDatasources,
    onDashboardSettingsPatch,
    onDatasourcesChange,
    onAnnotationsChange,
    onLinksChange,
    onSettingsJsonApply,
    onLayoutUpdated
  };
}
function createDashboardPageChromeActions(deps) {
  async function saveDashboardFromPage() {
    try {
      const session = deps.getPanelEditSession();
      const editor = deps.getPanelEditorRef();
      if (session && editor) {
        const draft = editor.getDraft();
        deps.store.updatePanel(draft);
        deps.setSelectedPanel(draft);
        saveDashboardWhileEditing(session, draft);
        await deps.store.save();
        editor.markSaved(draft);
      } else {
        await deps.store.save();
      }
      deps.emitSaved(JSON.parse(deps.store.serializeDocument()));
    } catch (error) {
      deps.emitSaveError(error instanceof Error ? error.message : String(error));
    }
  }
  function openShare(panelId, mode2 = "link") {
    if (panelId != null) {
      deps.setSelectedPanel(
        deps.getPanels().find((p) => p.id === panelId) ?? deps.getSelectedPanel()
      );
      deps.selectPanelId(panelId);
    }
    deps.setShareView(mode2);
    deps.openShareOverlay();
  }
  function openInspect(id, tab) {
    if (id != null) {
      const panel2 = deps.getPanels().find((p) => Number(p.id) === Number(id)) ?? deps.getSelectedPanel();
      deps.setSelectedPanel(panel2);
      deps.selectPanelId(Number(id));
    }
    deps.setInspectTabOverride(tab || void 0);
    deps.openInspectOverlay();
  }
  function toggleEditMode() {
    const next = !deps.getEditMode();
    if (next && typeof deps.store.canEditDashboard === "function" && !deps.store.canEditDashboard()) {
      return;
    }
    if (deps.isEmbedded()) {
      deps.requestMode(next ? "edit" : "preview");
      return;
    }
    deps.store.setEditMode(next);
    if (!next) {
      deps.setSelectedPanel(null);
      deps.setEditingPanelId(null);
    }
  }
  async function takeScreenshot() {
    const el = globalThis.document.querySelector(
      '[data-testid="dashboard-grid"]'
    );
    if (!el) return;
    const shot = await captureDomScreenshot(el, { width: 960, height: 540 });
    deps.setScreenshotUrl(shot.url);
  }
  async function cancelEmbeddedEdit() {
    if (!deps.isEmbedded()) return;
    deps.setEditingPanelId(null);
    deps.setSelectedPanel(null);
    deps.setPanelEditSession(null);
    await deps.store.restoreSaved();
    deps.store.setEditMode(false);
    deps.emitCancel();
    deps.requestMode("preview");
  }
  function openInspectFromProp() {
    const id = deps.getInspectPanelIdProp();
    if (id == null) return;
    const panel2 = deps.getPanels().find((p) => Number(p.id) === Number(id)) ?? null;
    if (panel2) {
      deps.setSelectedPanel(panel2);
      deps.selectPanelId(Number(panel2.id));
      deps.openInspectOverlay();
    }
  }
  function openEditPanelFromProp() {
    const id = deps.getEditPanelIdProp();
    if (id == null) return;
    deps.store.setEditMode(true);
    const panel2 = deps.getPanels().find((p) => Number(p.id) === Number(id)) ?? null;
    if (panel2) {
      deps.setSelectedPanel(panel2);
      deps.setEditingPanelId(Number(panel2.id));
      deps.openedEditPanelIds.add(Number(panel2.id));
      const session = deps.getPanelEditSession();
      if (!session || Number(session.panelId) !== Number(panel2.id)) {
        deps.setPanelEditSession(
          openPanelEditSession(panel2, {
            isNewPanel: Boolean(panel2.isNew),
            isLibraryPanel: Boolean(panel2.libraryPanel)
          })
        );
      }
    }
  }
  return {
    saveDashboardFromPage,
    openShare,
    openInspect,
    toggleEditMode,
    takeScreenshot,
    cancelEmbeddedEdit,
    openInspectFromProp,
    openEditPanelFromProp
  };
}
function buildDisplayPanels(panels2, viewPanelId) {
  if (viewPanelId == null) return panels2;
  const p = panels2.find((x) => x.id === viewPanelId);
  if (!p) return [];
  const h2 = Math.max(p.gridPos?.h ?? 8, 18);
  return [{ ...p, gridPos: { x: 0, y: 0, w: 24, h: h2 } }];
}
const SEQ_MS = 800;
function resolveDashboardShortcut(ctx) {
  const now2 = ctx.now ?? Date.now();
  const key = ctx.key.toLowerCase();
  const panelId = ctx.panelId ?? null;
  if ((ctx.metaOrCtrl || false) && key === "s") {
    return { action: { type: "save" }, nextLastP: 0, nextLastD: 0 };
  }
  if (key === "escape") {
    if (ctx.editingPanel) return { action: null };
    if (ctx.viewingPanel) return { action: { type: "escapeView" } };
    return { action: null };
  }
  if (key === "p") {
    return { action: null, nextLastP: now2, nextLastD: ctx.lastD };
  }
  if (key === "d" && !(ctx.lastP && now2 - ctx.lastP < SEQ_MS)) {
    return { action: null, nextLastD: now2, nextLastP: ctx.lastP };
  }
  if (ctx.lastP && now2 - ctx.lastP < SEQ_MS) {
    if (key === "d" && panelId != null)
      return { action: { type: "duplicate", panelId }, nextLastP: 0 };
    if (key === "r" && panelId != null && ctx.editMode)
      return { action: { type: "remove", panelId }, nextLastP: 0 };
    if (key === "u")
      return {
        action: { type: "share", panelId: panelId ?? void 0, mode: "link" },
        nextLastP: 0
      };
    if (key === "e")
      return {
        action: { type: "share", panelId: panelId ?? void 0, mode: "embed" },
        nextLastP: 0
      };
    if (key === "s")
      return {
        action: {
          type: "share",
          panelId: panelId ?? void 0,
          mode: "snapshot"
        },
        nextLastP: 0
      };
    if (key === "l" && panelId != null)
      return { action: { type: "toggleLegend", panelId }, nextLastP: 0 };
    if (key === "x" && panelId != null)
      return { action: { type: "explore", panelId }, nextLastP: 0 };
  }
  if (ctx.lastD && now2 - ctx.lastD < SEQ_MS) {
    if (key === "r") return { action: { type: "refresh" }, nextLastD: 0 };
    if (key === "s") return { action: { type: "save" }, nextLastD: 0 };
  }
  if (key === "v" && !ctx.editMode) {
    if (ctx.viewingPanel) return { action: { type: "escapeView" } };
    if (panelId != null) return { action: { type: "view", panelId } };
  }
  if (key === "e" && panelId != null && ctx.editMode) {
    return { action: { type: "edit", panelId } };
  }
  if (key === "i" && panelId != null) {
    return { action: { type: "inspect", panelId } };
  }
  return { action: null, nextLastP: ctx.lastP, nextLastD: ctx.lastD };
}
function isTypingTarget(target) {
  const el = target;
  const tag = el?.tagName?.toLowerCase();
  return tag === "input" || tag === "textarea" || !!el?.isContentEditable;
}
function createDashboardPageKeydownHandler(deps) {
  const shortcutSeq = { lastP: 0, lastD: 0 };
  return function onKeyDown(e) {
    if (isTypingTarget(e.target)) return;
    if (e.key === "Escape" || e.key === "escape") {
      if (deps.isVariablesSettingsOpen()) {
        e.preventDefault();
        deps.closeVariablesSettings();
        return;
      }
      if (deps.anyOverlayOpen()) {
        e.preventDefault();
        deps.closeTopOverlay();
        return;
      }
    }
    const { action, nextLastP, nextLastD } = resolveDashboardShortcut({
      key: e.key,
      metaOrCtrl: !!(e.metaKey || e.ctrlKey),
      shift: !!e.shiftKey,
      panelId: deps.getSelectedPanelId(),
      editMode: deps.isEditMode(),
      editingPanel: deps.isEditingPanel(),
      viewingPanel: deps.isViewingPanel(),
      lastP: shortcutSeq.lastP,
      lastD: shortcutSeq.lastD,
      now: Date.now()
    });
    if (nextLastP !== void 0) shortcutSeq.lastP = nextLastP;
    if (nextLastD !== void 0) shortcutSeq.lastD = nextLastD;
    if (!action) return;
    e.preventDefault();
    deps.onAction(action);
  };
}
const PANEL_SET_TIME_EVENT = "grafana-vue:set-time";
const PANEL_SET_VARIABLE_EVENT = "grafana-vue:set-variable";
const PANEL_LOGS_LOAD_MORE_EVENT = "grafana-vue:logs-load-more";
function resolvePanelTimeStrings(detail) {
  if (!detail || typeof detail !== "object") return null;
  const fromRaw = detail.fromMs ?? detail.from;
  const toRaw2 = detail.toMs ?? detail.to;
  if (fromRaw == null || toRaw2 == null) return null;
  const toAbs = (v) => {
    if (typeof v === "number") {
      if (!Number.isFinite(v)) return null;
      return new Date(v).toISOString();
    }
    const s = String(v).trim();
    if (!s) return null;
    if (/^\d{10,13}$/.test(s)) {
      const n = Number(s);
      if (!Number.isFinite(n)) return null;
      const ms = s.length <= 10 ? n * 1e3 : n;
      return new Date(ms).toISOString();
    }
    return s;
  };
  const from = toAbs(fromRaw);
  const to = toAbs(toRaw2);
  if (!from || !to) return null;
  if (from === to) return null;
  return { from, to };
}
function handlePanelSetTimeEvent(ev, setTime) {
  const detail = ev.detail;
  const range = resolvePanelTimeStrings(detail);
  if (!range) return false;
  setTime(range.from, range.to);
  return true;
}
function handlePanelSetVariableEvent(ev, setVariable) {
  const detail = ev.detail;
  const name = String(detail?.name ?? "").trim();
  if (!name) return false;
  const value = detail?.value;
  if (value == null) return false;
  setVariable(name, value);
  return true;
}
function resolveLogsLoadMoreTimeRange(current, direction = "older", now2 = /* @__PURE__ */ new Date()) {
  if (!current?.from || !current?.to) return null;
  let parsed;
  try {
    parsed = rangeUtil_parse({ from: current.from, to: current.to }, now2);
  } catch {
    return null;
  }
  const fromMs = parsed.from.getTime();
  const toMs2 = parsed.to.getTime();
  if (!Number.isFinite(fromMs) || !Number.isFinite(toMs2) || toMs2 <= fromMs) {
    return null;
  }
  const span = toMs2 - fromMs;
  if (direction === "newer") {
    const nextFrom = fromMs + span;
    const nextTo = toMs2 + span;
    const toIsNow = String(current.to).trim() === "now";
    if (toIsNow) {
      return {
        from: new Date(now2.getTime() - span).toISOString(),
        to: "now"
      };
    }
    return {
      from: new Date(nextFrom).toISOString(),
      to: new Date(nextTo).toISOString()
    };
  }
  return {
    from: new Date(fromMs - span).toISOString(),
    to: String(current.to).trim() === "now" ? "now" : new Date(toMs2).toISOString()
  };
}
function handlePanelLogsLoadMoreEvent(ev, handlers) {
  const detail = ev.detail ?? {};
  if (typeof handlers.onLogsLoadMore === "function") {
    handlers.onLogsLoadMore(detail);
    return true;
  }
  if (typeof handlers.getTime !== "function" || typeof handlers.setTime !== "function") {
    return false;
  }
  const current = handlers.getTime();
  const direction = detail.direction === "newer" ? "newer" : "older";
  const next = resolveLogsLoadMoreTimeRange(current ?? null, direction);
  if (!next) return false;
  handlers.setTime(next.from, next.to);
  return true;
}
function bindPanelHostEvents(handlers, target = typeof window !== "undefined" ? window : void 0) {
  if (!target || typeof target.addEventListener !== "function") {
    return () => void 0;
  }
  const onTime = (ev) => {
    try {
      handlePanelSetTimeEvent(ev, handlers.setTime);
    } catch {
    }
  };
  const onVar = (ev) => {
    try {
      handlePanelSetVariableEvent(ev, handlers.setVariable);
    } catch {
    }
  };
  const onLogsMore = (ev) => {
    try {
      handlePanelLogsLoadMoreEvent(ev, handlers);
    } catch {
    }
  };
  target.addEventListener(PANEL_SET_TIME_EVENT, onTime);
  target.addEventListener(PANEL_SET_VARIABLE_EVENT, onVar);
  target.addEventListener(PANEL_LOGS_LOAD_MORE_EVENT, onLogsMore);
  return () => {
    target.removeEventListener(PANEL_SET_TIME_EVENT, onTime);
    target.removeEventListener(PANEL_SET_VARIABLE_EVENT, onVar);
    target.removeEventListener(PANEL_LOGS_LOAD_MORE_EVENT, onLogsMore);
  };
}
function normalizeDashboardLocale(value) {
  if (typeof value !== "string") return void 0;
  const normalized = value.trim().toLowerCase();
  if (normalized === "en" || normalized.startsWith("en-")) return "en-US";
  if (normalized === "zh" || normalized.startsWith("zh-")) return "zh-Hans";
  return void 0;
}
function detectDashboardLocale(current) {
  return normalizeDashboardLocale(current) ?? (typeof navigator !== "undefined" ? normalizeDashboardLocale(navigator.language) : void 0) ?? "zh-Hans";
}
function useDashboardPageLocale(requested) {
  const { locale: locale2, setLocale: setLocale2 } = useI18n();
  let hostLocale = detectDashboardLocale(locale2.value);
  let activeOverride;
  let applying = false;
  function applyRequestedLocale() {
    const next = normalizeDashboardLocale(requested.value);
    if (!next) {
      if (activeOverride) {
        activeOverride = void 0;
        if (normalizeDashboardLocale(locale2.value) !== hostLocale) setLocale2(hostLocale);
      }
      return;
    }
    if (!activeOverride) hostLocale = detectDashboardLocale(locale2.value);
    activeOverride = next;
    if (normalizeDashboardLocale(locale2.value) !== next) {
      applying = true;
      setLocale2(next);
      applying = false;
    }
  }
  const stopRequested = watch(requested, applyRequestedLocale, {
    immediate: true
  });
  const stopRuntime = watch(locale2, () => {
    if (applying || !activeOverride) return;
    if (normalizeDashboardLocale(locale2.value) !== activeOverride) {
      applying = true;
      setLocale2(activeOverride);
      applying = false;
    }
  });
  onBeforeUnmount(() => {
    stopRequested();
    stopRuntime();
    if (activeOverride && normalizeDashboardLocale(locale2.value) === activeOverride) {
      setLocale2(hostLocale);
    }
  });
  return { locale: locale2 };
}
const _hoisted_1$1l = ["data-share-view"];
const _hoisted_2$16 = { "data-testid": "share-tab-link" };
const _hoisted_3$X = { "data-testid": "share-tab-embed" };
const _hoisted_4$L = { "data-testid": "share-tab-snapshot" };
const _hoisted_5$E = { class: "section-label" };
const _hoisted_6$A = { "data-testid": "share-theme" };
const _hoisted_7$v = { class: "section-label" };
const _hoisted_8$q = {
  class: "input-row",
  "data-testid": "share-url-row"
};
const _hoisted_9$p = { class: "section-meta" };
const _hoisted_10$k = { key: 0 };
const _hoisted_11$k = { class: "section-label" };
const _hoisted_12$j = {
  class: "g-space",
  "data-testid": "share-space"
};
const _hoisted_13$j = { class: "dim-field" };
const _hoisted_14$h = { class: "dim-field" };
const _hoisted_15$f = { class: "actions" };
const _hoisted_16$c = { class: "section-label" };
const _hoisted_17$c = { class: "section-label" };
const _hoisted_18$c = {
  class: "g-space",
  "data-testid": "share-space"
};
const _hoisted_19$b = { class: "section-label" };
const _hoisted_20$9 = { class: "actions" };
const _sfc_main$1p = /* @__PURE__ */ defineComponent({
  __name: "ShareDrawer",
  props: {
    open: { type: Boolean },
    uid: {},
    slug: {},
    from: {},
    to: {},
    panelId: {},
    shareView: {}
  },
  emits: ["update:open"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const store2 = useDashboardStore();
    const theme = ref("current");
    const themeOptions = [
      { label: "当前", value: "current" },
      { label: "深色", value: "dark" },
      { label: "浅色", value: "light" }
    ];
    const tab = ref("link");
    const exportMode = ref("backup");
    const copied = ref("");
    let copyTimer = null;
    function flashCopied(key) {
      copied.value = key;
      if (copyTimer) clearTimeout(copyTimer);
      copyTimer = setTimeout(() => {
        copied.value = "";
        copyTimer = null;
      }, 1400);
    }
    watch(
      () => [props.open, props.shareView],
      ([open, view]) => {
        if (open) {
          tab.value = view ?? "link";
          theme.value = "current";
          copied.value = "";
          if (copyTimer) {
            clearTimeout(copyTimer);
            copyTimer = null;
          }
        }
      },
      { immediate: true }
    );
    const shareUrl = computed(
      () => buildShareUrl({
        uid: props.uid,
        slug: props.slug,
        from: props.from,
        to: props.to,
        theme: theme.value,
        panelId: props.panelId,
        variables: Object.fromEntries(
          (store2.document?.templating?.list ?? []).map((v) => [v.name, v.current?.value ?? ""])
        )
      })
    );
    const embed = computed(
      () => buildEmbedHtml({
        uid: props.uid,
        slug: props.slug,
        theme: theme.value,
        solo: true,
        panelId: props.panelId
      })
    );
    const jsonExport = computed(() => {
      try {
        const env = parseDashboardDocument(
          store2.document ?? {
            title: props.uid,
            panels: [],
            schemaVersion: 42
          }
        );
        return JSON.stringify(exportDashboard(env, { mode: exportMode.value }), null, 2);
      } catch {
        return buildDashboardJsonExport(store2.document ?? { title: props.uid });
      }
    });
    const snapshot = computed(
      () => buildSnapshotExport(store2.document ?? { title: props.uid })
    );
    const snapshotJson = computed(() => JSON.stringify(snapshot.value, null, 2));
    const embedWidth = ref(450);
    const embedHeight = ref(200);
    async function copy(text, key) {
      try {
        await globalThis.navigator?.clipboard?.writeText(text);
        flashCopied(key);
      } catch {
      }
    }
    function copyShareUrl() {
      void copy(shareUrl.value, "share-copy");
    }
    function copyJson() {
      void copy(jsonExport.value, "share-copy-json");
    }
    function copyEmbed() {
      void copy(embed.value, "share-copy-embed");
    }
    function copySnapshot() {
      void copy(snapshotJson.value, "share-copy-snapshot");
    }
    function downloadJson() {
      const blob = new Blob([jsonExport.value], { type: "application/json" });
      const url = URL.createObjectURL(blob);
      const a = document.createElement("a");
      const safeTitle = String(store2.document?.title || props.uid || "dashboard").toLowerCase().replaceAll(/\s+/g, "-").replaceAll(/[^\w一-鿿-]+/g, "");
      a.href = url;
      a.download = `${safeTitle || "dashboard"}-${props.uid}.json`;
      document.body.appendChild(a);
      a.click();
      a.remove();
      URL.revokeObjectURL(url);
    }
    const title = computed(() => {
      if (props.panelId != null) {
        if (tab.value === "embed") return "分享面板嵌入";
        if (tab.value === "snapshot") return "分享面板快照";
        return "分享面板链接";
      }
      if (tab.value === "embed") return "分享嵌入";
      if (tab.value === "snapshot") return "分享快照";
      return "分享仪表盘";
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(GDrawer), {
        open: __props.open,
        title: title.value,
        size: "md",
        "test-id": "share-drawer",
        "onUpdate:open": _cache[5] || (_cache[5] = ($event) => emit("update:open", $event))
      }, {
        default: withCtx(() => [
          createElementVNode("div", {
            class: "share",
            "data-testid": "share-drawer-body",
            "data-share-view": tab.value
          }, [
            __props.panelId != null ? (openBlock(), createBlock(unref(GTag), {
              key: 0,
              color: "processing",
              class: "panel-hint",
              "data-testid": "share-panel-hint"
            }, {
              default: withCtx(() => [
                createVNode(unref(InfoCircleOutlined)),
                _cache[6] || (_cache[6] = createTextVNode(
                  " 当前分享面板 ",
                  -1
                  /* CACHED */
                )),
                createElementVNode(
                  "code",
                  null,
                  "#" + toDisplayString(__props.panelId),
                  1
                  /* TEXT */
                )
              ]),
              _: 1
              /* STABLE */
            })) : createCommentVNode("v-if", true),
            createCommentVNode(" GTabs: line variant with icons — mirrors Grafana ModalTabsHeader underline "),
            createVNode(unref(GTabs), {
              "active-key": tab.value,
              class: "share-tabs",
              "test-id": "share-tabs",
              items: [
                { key: "link", label: "链接" },
                { key: "embed", label: "嵌入" },
                { key: "snapshot", label: "快照" }
              ],
              "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => tab.value = $event)
            }, {
              "tab-link": withCtx(() => [
                createElementVNode("span", _hoisted_2$16, [
                  createVNode(unref(LinkOutlined)),
                  _cache[7] || (_cache[7] = createTextVNode(
                    "链接",
                    -1
                    /* CACHED */
                  ))
                ])
              ]),
              "tab-embed": withCtx(() => [
                createElementVNode("span", _hoisted_3$X, [
                  createVNode(unref(CodeOutlined)),
                  _cache[8] || (_cache[8] = createTextVNode(
                    "嵌入",
                    -1
                    /* CACHED */
                  ))
                ])
              ]),
              "tab-snapshot": withCtx(() => [
                createElementVNode("span", _hoisted_4$L, [
                  createVNode(unref(CameraOutlined)),
                  _cache[9] || (_cache[9] = createTextVNode(
                    "快照",
                    -1
                    /* CACHED */
                  ))
                ])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["active-key"]),
            createCommentVNode(" Theme scope — shared by link + embed only (snapshot has none) "),
            tab.value !== "snapshot" ? (openBlock(), createBlock(unref(GCard), {
              key: 1,
              size: "small",
              class: "section theme-row",
              "data-testid": "share-theme-field"
            }, {
              title: withCtx(() => [
                createElementVNode("span", _hoisted_5$E, [
                  createVNode(unref(BgColorsOutlined)),
                  _cache[10] || (_cache[10] = createTextVNode(
                    " 渲染主题 ",
                    -1
                    /* CACHED */
                  ))
                ])
              ]),
              default: withCtx(() => [
                createElementVNode("div", _hoisted_6$A, [
                  createVNode(unref(GRadioButtonGroup), {
                    value: theme.value,
                    options: themeOptions,
                    "onUpdate:value": _cache[1] || (_cache[1] = ($event) => theme.value = String($event))
                  }, null, 8, ["value"])
                ]),
                createVNode(unref(GAlert), {
                  severity: "info",
                  class: "section-meta",
                  title: "链接使用观察者主题"
                }, {
                  description: withCtx(() => [..._cache[11] || (_cache[11] = [
                    createElementVNode(
                      "code",
                      null,
                      "current",
                      -1
                      /* CACHED */
                    ),
                    createTextVNode(
                      " 沿用打开链接时的主题。 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ]),
              _: 1
              /* STABLE */
            })) : createCommentVNode("v-if", true),
            createCommentVNode(" Link tab: shareable URL with time + variables baked in "),
            tab.value === "link" ? (openBlock(), createBlock(unref(GCard), {
              key: 2,
              size: "small",
              class: "section",
              "data-testid": "share-link"
            }, {
              title: withCtx(() => [
                createElementVNode("span", _hoisted_7$v, [
                  createVNode(unref(ShareAltOutlined)),
                  _cache[12] || (_cache[12] = createTextVNode(
                    " 分享链接 ",
                    -1
                    /* CACHED */
                  ))
                ])
              ]),
              default: withCtx(() => [
                createElementVNode("div", _hoisted_8$q, [
                  createVNode(unref(GInput), {
                    id: "share-url",
                    "data-testid": "share-url",
                    value: shareUrl.value,
                    readonly: "",
                    class: "mono-input"
                  }, null, 8, ["value"]),
                  createVNode(unref(GButton), {
                    variant: "primary",
                    "data-testid": "share-copy",
                    size: "md",
                    class: "copy-btn",
                    onClick: copyShareUrl
                  }, {
                    default: withCtx(() => [
                      copied.value === "share-copy" ? (openBlock(), createBlock(unref(CheckOutlined), { key: 0 })) : (openBlock(), createBlock(unref(CopyOutlined), { key: 1 })),
                      createTextVNode(
                        " " + toDisplayString(copied.value === "share-copy" ? "已复制" : "复制"),
                        1
                        /* TEXT */
                      )
                    ]),
                    _: 1
                    /* STABLE */
                  })
                ]),
                createElementVNode("p", _hoisted_9$p, [
                  _cache[15] || (_cache[15] = createTextVNode(
                    " 包含当前时间范围",
                    -1
                    /* CACHED */
                  )),
                  __props.from ? (openBlock(), createElementBlock("span", _hoisted_10$k, [
                    _cache[13] || (_cache[13] = createTextVNode(
                      " · ",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode(
                      "code",
                      null,
                      toDisplayString(__props.from),
                      1
                      /* TEXT */
                    ),
                    _cache[14] || (_cache[14] = createTextVNode(
                      " → ",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode(
                      "code",
                      null,
                      toDisplayString(__props.to),
                      1
                      /* TEXT */
                    )
                  ])) : createCommentVNode("v-if", true),
                  _cache[16] || (_cache[16] = createTextVNode(
                    " 与所选变量值。 ",
                    -1
                    /* CACHED */
                  ))
                ])
              ]),
              _: 1
              /* STABLE */
            })) : tab.value === "embed" ? (openBlock(), createElementBlock(
              Fragment,
              { key: 3 },
              [
                createCommentVNode(" Embed tab: iframe HTML for external sites "),
                createVNode(unref(GCard), {
                  size: "small",
                  class: "section",
                  "data-testid": "share-embed-section"
                }, {
                  title: withCtx(() => [
                    createElementVNode("span", _hoisted_11$k, [
                      createVNode(unref(CodeOutlined)),
                      _cache[17] || (_cache[17] = createTextVNode(
                        " 嵌入代码 ",
                        -1
                        /* CACHED */
                      ))
                    ])
                  ]),
                  default: withCtx(() => [
                    createElementVNode("div", _hoisted_12$j, [
                      _cache[20] || (_cache[20] = createTextVNode(
                        ' class="dims-row" :size="12" wrap> ',
                        -1
                        /* CACHED */
                      )),
                      createElementVNode("div", _hoisted_13$j, [
                        _cache[18] || (_cache[18] = createElementVNode(
                          "span",
                          { class: "dim-label" },
                          "宽度 (px)",
                          -1
                          /* CACHED */
                        )),
                        createVNode(unref(GInput), {
                          type: "number",
                          value: embedWidth.value,
                          min: 100,
                          max: 4e3,
                          "data-testid": "share-embed-width",
                          "onUpdate:value": _cache[2] || (_cache[2] = ($event) => embedWidth.value = Math.max(100, Number($event) || 0))
                        }, null, 8, ["value"])
                      ]),
                      createElementVNode("div", _hoisted_14$h, [
                        _cache[19] || (_cache[19] = createElementVNode(
                          "span",
                          { class: "dim-label" },
                          "高度 (px)",
                          -1
                          /* CACHED */
                        )),
                        createVNode(unref(GInput), {
                          type: "number",
                          value: embedHeight.value,
                          min: 100,
                          max: 4e3,
                          "data-testid": "share-embed-height",
                          "onUpdate:value": _cache[3] || (_cache[3] = ($event) => embedHeight.value = Math.max(100, Number($event) || 0))
                        }, null, 8, ["value"])
                      ])
                    ]),
                    createVNode(unref(GInput), {
                      id: "share-embed",
                      textarea: "",
                      "data-testid": "share-embed",
                      value: embed.value,
                      rows: 8,
                      "auto-size": { minRows: 8, maxRows: 20 },
                      readonly: "",
                      class: "code-area"
                    }, null, 8, ["value"]),
                    createElementVNode("div", _hoisted_15$f, [
                      createVNode(unref(GButton), {
                        variant: "primary",
                        "data-testid": "share-copy-embed",
                        size: "md",
                        onClick: copyEmbed
                      }, {
                        default: withCtx(() => [
                          copied.value === "share-copy-embed" ? (openBlock(), createBlock(unref(CheckOutlined), { key: 0 })) : (openBlock(), createBlock(unref(CopyOutlined), { key: 1 })),
                          createTextVNode(
                            " " + toDisplayString(copied.value === "share-copy-embed" ? "已复制" : "复制嵌入代码"),
                            1
                            /* TEXT */
                          )
                        ]),
                        _: 1
                        /* STABLE */
                      })
                    ]),
                    createVNode(unref(GAlert), {
                      severity: "info",
                      class: "section-meta",
                      title: "需允许跨域 iframe"
                    }, {
                      description: withCtx(() => [..._cache[21] || (_cache[21] = [
                        createTextVNode(
                          " 使用 ",
                          -1
                          /* CACHED */
                        ),
                        createElementVNode(
                          "code",
                          null,
                          "d-solo",
                          -1
                          /* CACHED */
                        ),
                        createTextVNode(
                          " 无外壳视图；宿主页面需允许跨域嵌入。 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    })
                  ]),
                  _: 1
                  /* STABLE */
                })
              ],
              64
              /* STABLE_FRAGMENT */
            )) : (openBlock(), createElementBlock(
              Fragment,
              { key: 4 },
              [
                createCommentVNode(" Snapshot / Export tab: JSON + snapshot payload "),
                createVNode(unref(GCard), {
                  size: "small",
                  class: "section",
                  "data-testid": "share-export"
                }, {
                  title: withCtx(() => [
                    createElementVNode("span", _hoisted_16$c, [
                      createVNode(unref(SaveOutlined)),
                      _cache[22] || (_cache[22] = createTextVNode(
                        " 导出模式 ",
                        -1
                        /* CACHED */
                      ))
                    ])
                  ]),
                  default: withCtx(() => [
                    createVNode(unref(GSelect), {
                      value: exportMode.value,
                      "data-testid": "export-mode",
                      options: [
                        { label: "实例备份（含私有引用）", value: "backup" },
                        { label: "外部分享（清洗数据源）", value: "share" }
                      ],
                      "onUpdate:value": _cache[4] || (_cache[4] = ($event) => exportMode.value = String($event))
                    }, null, 8, ["value"]),
                    createVNode(unref(GAlert), {
                      severity: exportMode.value === "backup" ? "warning" : "success",
                      class: "section-meta",
                      title: exportMode.value === "backup" ? "备份模式" : "分享模式"
                    }, {
                      description: withCtx(() => [
                        exportMode.value === "backup" ? (openBlock(), createElementBlock(
                          Fragment,
                          { key: 0 },
                          [
                            createTextVNode(" 保留数据源 UID 与凭据引用；仅用于同实例恢复。 ")
                          ],
                          64
                          /* STABLE_FRAGMENT */
                        )) : (openBlock(), createElementBlock(
                          Fragment,
                          { key: 1 },
                          [
                            createTextVNode(" 剥离数据源 UID 与凭据引用；适合导出给外部使用。 ")
                          ],
                          64
                          /* STABLE_FRAGMENT */
                        ))
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["severity", "title"])
                  ]),
                  _: 1
                  /* STABLE */
                }),
                createVNode(unref(GCard), {
                  size: "small",
                  class: "section section--code",
                  "data-testid": "share-json-section"
                }, {
                  title: withCtx(() => [
                    createElementVNode("span", _hoisted_17$c, [
                      createVNode(unref(FileTextOutlined)),
                      _cache[23] || (_cache[23] = createTextVNode(
                        " 仪表盘 JSON ",
                        -1
                        /* CACHED */
                      ))
                    ])
                  ]),
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "share-json",
                      textarea: "",
                      "data-testid": "share-json",
                      value: jsonExport.value,
                      rows: 16,
                      "auto-size": { minRows: 8 },
                      readonly: "",
                      class: "code-area code-area--tall"
                    }, null, 8, ["value"]),
                    createElementVNode("div", _hoisted_18$c, [
                      _cache[25] || (_cache[25] = createTextVNode(
                        ' class="actions" :size="8" wrap> ',
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GButton), {
                        variant: "primary",
                        "data-testid": "share-copy-json",
                        size: "md",
                        onClick: copyJson
                      }, {
                        default: withCtx(() => [
                          copied.value === "share-copy-json" ? (openBlock(), createBlock(unref(CheckOutlined), { key: 0 })) : (openBlock(), createBlock(unref(CopyOutlined), { key: 1 })),
                          createTextVNode(
                            " " + toDisplayString(copied.value === "share-copy-json" ? "已复制" : "复制 JSON"),
                            1
                            /* TEXT */
                          )
                        ]),
                        _: 1
                        /* STABLE */
                      }),
                      createVNode(unref(GButton), {
                        "data-testid": "share-download-json",
                        size: "md",
                        onClick: downloadJson
                      }, {
                        default: withCtx(() => [
                          createVNode(unref(DownloadOutlined)),
                          _cache[24] || (_cache[24] = createTextVNode(
                            " 下载 .json ",
                            -1
                            /* CACHED */
                          ))
                        ]),
                        _: 1
                        /* STABLE */
                      })
                    ])
                  ]),
                  _: 1
                  /* STABLE */
                }),
                createVNode(unref(GCard), {
                  size: "small",
                  class: "section section--code",
                  "data-testid": "share-snapshot-section"
                }, {
                  title: withCtx(() => [
                    createElementVNode("span", _hoisted_19$b, [
                      createVNode(unref(CameraOutlined)),
                      _cache[26] || (_cache[26] = createTextVNode(
                        " 快照载荷 ",
                        -1
                        /* CACHED */
                      ))
                    ])
                  ]),
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "share-snapshot",
                      textarea: "",
                      "data-testid": "share-snapshot",
                      value: snapshotJson.value,
                      rows: 12,
                      "auto-size": { minRows: 8 },
                      readonly: "",
                      class: "code-area code-area--tall"
                    }, null, 8, ["value"]),
                    createElementVNode("div", _hoisted_20$9, [
                      createVNode(unref(GButton), {
                        "data-testid": "share-copy-snapshot",
                        size: "md",
                        onClick: copySnapshot
                      }, {
                        default: withCtx(() => [
                          copied.value === "share-copy-snapshot" ? (openBlock(), createBlock(unref(CheckOutlined), { key: 0 })) : (openBlock(), createBlock(unref(CopyOutlined), { key: 1 })),
                          createTextVNode(
                            " " + toDisplayString(copied.value === "share-copy-snapshot" ? "已复制" : "复制快照"),
                            1
                            /* TEXT */
                          )
                        ]),
                        _: 1
                        /* STABLE */
                      })
                    ]),
                    createVNode(unref(GAlert), {
                      severity: "info",
                      class: "section-meta",
                      title: "快照携带面板数据的时点副本"
                    }, {
                      description: withCtx(() => [..._cache[27] || (_cache[27] = [
                        createTextVNode(
                          " 适合无后端场景传递结果；不含实时查询。 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    })
                  ]),
                  _: 1
                  /* STABLE */
                })
              ],
              64
              /* STABLE_FRAGMENT */
            ))
          ], 8, _hoisted_1$1l)
        ]),
        _: 1
        /* STABLE */
      }, 8, ["open", "title"]);
    };
  }
});
const ShareDrawer = /* @__PURE__ */ _export_sfc$1(_sfc_main$1p, [["__scopeId", "data-v-4f858103"]]);
const _hoisted_1$1k = {
  key: 0,
  class: "insp",
  "data-testid": "inspector-body"
};
const _hoisted_2$15 = { class: "tabs" };
const _hoisted_3$W = { class: "actions" };
const _hoisted_4$K = {
  key: 0,
  "data-testid": "inspector-data"
};
const _hoisted_5$D = {
  key: 1,
  "data-testid": "inspector-stats"
};
const _hoisted_6$z = {
  key: 2,
  "data-testid": "inspector-query"
};
const _hoisted_7$u = {
  key: 3,
  "data-testid": "inspector-error"
};
const _hoisted_8$p = {
  key: 4,
  "data-testid": "inspector-meta"
};
const _hoisted_9$o = {
  key: 5,
  class: "block",
  "data-testid": "inspect-transform-steps"
};
const _hoisted_10$j = {
  key: 0,
  class: "req"
};
const _hoisted_11$j = { class: "steps" };
const _hoisted_12$i = ["data-testid"];
const _hoisted_13$i = {
  key: 0,
  class: "badge"
};
const _hoisted_14$g = {
  key: 1,
  class: "err"
};
const _hoisted_15$e = { class: "meta-line" };
const _hoisted_16$b = { class: "meta-line" };
const _hoisted_17$b = {
  key: 2,
  class: "meta-line"
};
const _hoisted_18$b = {
  key: 1,
  class: "empty"
};
const _hoisted_19$a = {
  key: 6,
  class: "block",
  "data-testid": "inspector-help"
};
const _hoisted_20$8 = { class: "help-list" };
const _hoisted_21$3 = {
  key: 7,
  "data-testid": "inspector-json"
};
const _hoisted_22$3 = {
  key: 1,
  "data-testid": "inspector-empty"
};
const _sfc_main$1o = /* @__PURE__ */ defineComponent({
  __name: "PanelInspector",
  props: {
    open: { type: Boolean },
    panel: {},
    data: {},
    initialTab: {}
  },
  emits: ["update:open"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const tab = ref(
      "data"
    );
    const wasOpen = ref(false);
    function setTab(next) {
      tab.value = next;
    }
    function pickInitialTab() {
      const allowed = ["data", "stats", "json", "query", "meta", "transform", "error", "help"];
      if (props.initialTab && allowed.includes(props.initialTab)) {
        tab.value = props.initialTab;
        return;
      }
      const d = props.data;
      if (d?.error || Array.isArray(d?.errors) && d.errors.length) {
        tab.value = "error";
        return;
      }
      tab.value = "data";
    }
    watch(
      () => props.open,
      (open) => {
        if (open && !wasOpen.value) {
          pickInitialTab();
        }
        wasOpen.value = Boolean(open);
      },
      { immediate: true }
    );
    watch(
      () => props.initialTab,
      (next) => {
        if (!props.open || !next) return;
        const allowed = [
          "data",
          "stats",
          "json",
          "query",
          "meta",
          "transform",
          "error",
          "help"
        ];
        if (allowed.includes(next)) {
          tab.value = next;
        }
      }
    );
    const errorText = computed(() => {
      const d = props.data;
      if (!d) return "无错误";
      if (d.error) return typeof d.error === "string" ? d.error : JSON.stringify(d.error, null, 2);
      if (Array.isArray(d.errors) && d.errors.length) return JSON.stringify(d.errors, null, 2);
      return "当前无错误";
    });
    const snap = computed(() => props.panel ? buildInspectorSnapshot(props.panel, props.data) : null);
    const frameStats = computed(() => {
      const series = props.data?.series ?? [];
      return series.map((f, i) => ({
        refId: f.refId ?? String(i),
        name: f.name ?? `frame-${i}`,
        length: f.length,
        fields: f.fields.map((field) => ({
          name: field.name,
          type: field.type,
          nonNull: field.values.filter((v) => v != null && v !== "").length
        }))
      }));
    });
    const requestMeta = computed(() => {
      const d = props.data;
      return {
        state: d?.state,
        timeRange: d?.timeRange ? {
          from: d.timeRange.from?.toISOString?.() ?? d.timeRange.from,
          to: d.timeRange.to?.toISOString?.() ?? d.timeRange.to
        } : null,
        requestId: d?.requestId ?? d?.request?.requestId,
        errors: d?.errors ?? (d?.error ? [d.error] : []),
        seriesCount: d?.series?.length ?? 0
      };
    });
    const queryJson = computed(() => {
      const targets = props.panel?.targets ?? [];
      const uid = props.panel?.datasource?.uid || targets[0]?.datasource?.uid;
      const httpLog2 = getDatasourceHttpLog(uid).slice(-10);
      const payload = {
        targets,
        lastHttpRequests: httpLog2,
        note: "lastHttpRequests 已脱敏（auth/token/Authorization 已 REDACTED）"
      };
      return sanitizeErrorText(JSON.stringify(payload, null, 2));
    });
    const optionsJson = computed(
      () => JSON.stringify(
        {
          id: props.panel?.id,
          type: props.panel?.type,
          title: props.panel?.title,
          options: props.panel?.options,
          fieldConfig: props.panel?.fieldConfig,
          transformations: props.panel?.transformations
        },
        null,
        2
      )
    );
    const dataJson = computed(
      () => JSON.stringify(
        (props.data?.series ?? []).map((f) => ({
          refId: f.refId,
          name: f.name,
          length: f.length,
          fields: f.fields.map((field) => ({
            name: field.name,
            type: field.type,
            values: field.values.slice(0, 20)
          }))
        })),
        null,
        2
      )
    );
    function framesToCsv2() {
      const frames = props.data?.series ?? [];
      const lines = [];
      frames.forEach((frame, fi) => {
        if (fi > 0) lines.push("");
        lines.push(`# frame ${fi} refId=${frame.refId || ""} name=${frame.name || ""}`);
        const fields = frame.fields ?? [];
        lines.push(fields.map((f) => f.name).join(","));
        const rows = frame.length ?? 0;
        for (let r = 0; r < rows; r++) {
          lines.push(
            fields.map((f) => {
              const v = f.values?.[r];
              if (v == null) return "";
              const s = String(v);
              return s.includes(",") || s.includes('"') ? `"${s.replaceAll('"', '""')}"` : s;
            }).join(",")
          );
        }
      });
      return lines.join("\n");
    }
    function downloadCsv() {
      const csv = framesToCsv2();
      try {
        const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
        const url = URL.createObjectURL(blob);
        const a = document.createElement("a");
        a.href = url;
        a.download = `panel-${props.panel?.id ?? "data"}.csv`;
        a.dataset.testid = "inspect-download-csv-link";
        document.body.appendChild(a);
        a.click();
        a.remove();
        URL.revokeObjectURL(url);
      } catch {
        void copy(csv);
      }
    }
    async function copy(text) {
      try {
        await globalThis.navigator?.clipboard?.writeText(text);
      } catch {
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(GDrawer), {
        open: __props.open,
        title: __props.panel?.title ? `检查: ${__props.panel.title}` : "检查面板",
        size: "md",
        "test-id": "panel-inspector",
        "onUpdate:open": _cache[9] || (_cache[9] = ($event) => emit("update:open", $event))
      }, {
        default: withCtx(() => [
          snap.value || __props.panel ? (openBlock(), createElementBlock("div", _hoisted_1$1k, [
            createElementVNode("div", _hoisted_2$15, [
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-data",
                  class: normalizeClass({ active: tab.value === "data" }),
                  onClick: _cache[0] || (_cache[0] = ($event) => setTab("data"))
                },
                " 数据 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-stats",
                  class: normalizeClass({ active: tab.value === "stats" }),
                  onClick: _cache[1] || (_cache[1] = ($event) => setTab("stats"))
                },
                " 统计 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-query",
                  class: normalizeClass({ active: tab.value === "query" }),
                  onClick: _cache[2] || (_cache[2] = ($event) => setTab("query"))
                },
                " 查询 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-json",
                  class: normalizeClass({ active: tab.value === "json" }),
                  onClick: _cache[3] || (_cache[3] = ($event) => setTab("json"))
                },
                " JSON ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-meta",
                  class: normalizeClass({ active: tab.value === "meta" }),
                  onClick: _cache[4] || (_cache[4] = ($event) => setTab("meta"))
                },
                " 元数据 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-transform",
                  class: normalizeClass({ active: tab.value === "transform" }),
                  onClick: _cache[5] || (_cache[5] = ($event) => setTab("transform"))
                },
                " 转换 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-error",
                  class: normalizeClass({ active: tab.value === "error" }),
                  onClick: _cache[6] || (_cache[6] = ($event) => setTab("error"))
                },
                " 错误 ",
                2
                /* CLASS */
              ),
              createElementVNode(
                "button",
                {
                  type: "button",
                  "data-testid": "inspect-tab-help",
                  class: normalizeClass({ active: tab.value === "help" }),
                  onClick: _cache[7] || (_cache[7] = ($event) => setTab("help"))
                },
                " 帮助 ",
                2
                /* CLASS */
              )
            ]),
            createElementVNode("div", _hoisted_3$W, [
              tab.value === "data" ? (openBlock(), createBlock(unref(GButton), {
                key: 0,
                "test-id": "inspect-download-csv",
                size: "md",
                variant: "toolbar",
                onClick: downloadCsv
              }, {
                default: withCtx(() => [..._cache[10] || (_cache[10] = [
                  createTextVNode(
                    " 下载 CSV ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })) : createCommentVNode("v-if", true),
              createVNode(unref(GButton), {
                "test-id": "inspect-copy",
                size: "md",
                variant: "toolbar",
                onClick: _cache[8] || (_cache[8] = ($event) => copy(
                  tab.value === "data" ? dataJson.value : tab.value === "stats" ? JSON.stringify(frameStats.value, null, 2) : tab.value === "query" ? queryJson.value : tab.value === "meta" ? JSON.stringify(requestMeta.value, null, 2) : optionsJson.value
                ))
              }, {
                default: withCtx(() => [..._cache[11] || (_cache[11] = [
                  createTextVNode(
                    " 复制 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ]),
            tab.value === "data" ? (openBlock(), createElementBlock(
              "pre",
              _hoisted_4$K,
              toDisplayString(dataJson.value),
              1
              /* TEXT */
            )) : tab.value === "stats" ? (openBlock(), createElementBlock(
              "pre",
              _hoisted_5$D,
              toDisplayString(JSON.stringify(frameStats.value, null, 2)),
              1
              /* TEXT */
            )) : tab.value === "query" ? (openBlock(), createElementBlock(
              "pre",
              _hoisted_6$z,
              toDisplayString(queryJson.value),
              1
              /* TEXT */
            )) : tab.value === "error" ? (openBlock(), createElementBlock(
              "pre",
              _hoisted_7$u,
              toDisplayString(errorText.value),
              1
              /* TEXT */
            )) : tab.value === "meta" ? (openBlock(), createElementBlock(
              "pre",
              _hoisted_8$p,
              toDisplayString(JSON.stringify(requestMeta.value, null, 2)),
              1
              /* TEXT */
            )) : tab.value === "transform" ? (openBlock(), createElementBlock("div", _hoisted_9$o, [
              _cache[12] || (_cache[12] = createElementVNode(
                "p",
                { class: "hint" },
                "查询 → 每步 Transformation → 最终 frame（不含密钥）",
                -1
                /* CACHED */
              )),
              snap.value?.requestSummary ? (openBlock(), createElementBlock("div", _hoisted_10$j, [
                createElementVNode(
                  "div",
                  null,
                  "requestId: " + toDisplayString(snap.value.requestSummary.requestId || "—"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "div",
                  null,
                  "targets: " + toDisplayString((snap.value.requestSummary.refIds || []).join(", ") || "—"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "div",
                  null,
                  "raw frames: " + toDisplayString(snap.value.seriesBeforeTransformCount ?? "—"),
                  1
                  /* TEXT */
                )
              ])) : createCommentVNode("v-if", true),
              createElementVNode("ol", _hoisted_11$j, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(snap.value?.transformSteps || [], (s, i) => {
                    return openBlock(), createElementBlock("li", {
                      key: i,
                      class: "step",
                      "data-testid": `inspect-transform-step-${i}`
                    }, [
                      createElementVNode(
                        "strong",
                        null,
                        toDisplayString(s.id),
                        1
                        /* TEXT */
                      ),
                      s.disabled ? (openBlock(), createElementBlock("span", _hoisted_13$i, "disabled")) : createCommentVNode("v-if", true),
                      s.error ? (openBlock(), createElementBlock(
                        "span",
                        _hoisted_14$g,
                        toDisplayString(s.error),
                        1
                        /* TEXT */
                      )) : createCommentVNode("v-if", true),
                      createElementVNode(
                        "div",
                        _hoisted_15$e,
                        " frames=" + toDisplayString(s.frameCount) + " · rows=[" + toDisplayString((s.rowCounts || []).join(",")) + "] ",
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "div",
                        _hoisted_16$b,
                        "fields: " + toDisplayString((s.fieldNames || []).join(", ") || "—"),
                        1
                        /* TEXT */
                      ),
                      s.optionKeys?.length ? (openBlock(), createElementBlock(
                        "div",
                        _hoisted_17$b,
                        " options: " + toDisplayString(s.optionKeys.join(", ")),
                        1
                        /* TEXT */
                      )) : createCommentVNode("v-if", true)
                    ], 8, _hoisted_12$i);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ]),
              !(snap.value?.transformSteps || []).length ? (openBlock(), createElementBlock("p", _hoisted_18$b, "无 Transformation 步骤")) : createCommentVNode("v-if", true)
            ])) : tab.value === "help" ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
              _cache[13] || (_cache[13] = createElementVNode(
                "p",
                { class: "hint" },
                "Grafana Inspect → Help：排查与支持信息（不含密钥）",
                -1
                /* CACHED */
              )),
              createElementVNode("ul", _hoisted_20$8, [
                createElementVNode(
                  "li",
                  null,
                  "面板 ID：" + toDisplayString(__props.panel?.id) + " · 类型：" + toDisplayString(__props.panel?.type),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "标题：" + toDisplayString(__props.panel?.title || "—"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "查询数：" + toDisplayString((__props.panel?.targets || []).length),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "转换数：" + toDisplayString((__props.panel?.transformations || []).length),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "数据帧：" + toDisplayString((__props.data?.series || []).length) + " · 状态：" + toDisplayString(__props.data?.state || "—"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "错误：" + toDisplayString(__props.data?.error?.message || "无"),
                  1
                  /* TEXT */
                )
              ]),
              _cache[14] || (_cache[14] = createElementVNode(
                "p",
                { class: "hint" },
                "复制「JSON」或「查询」Tab 内容可提供给支持；密钥已脱敏。",
                -1
                /* CACHED */
              ))
            ])) : (openBlock(), createElementBlock(
              "pre",
              _hoisted_21$3,
              toDisplayString(optionsJson.value),
              1
              /* TEXT */
            ))
          ])) : (openBlock(), createElementBlock("p", _hoisted_22$3, "未选择面板"))
        ]),
        _: 1
        /* STABLE */
      }, 8, ["open", "title"]);
    };
  }
});
const PanelInspector = /* @__PURE__ */ _export_sfc$1(_sfc_main$1o, [["__scopeId", "data-v-135513fe"]]);
const TRANSFORM_LABELS = {
  filterByName: "按名称过滤字段",
  filterByRefId: "按查询过滤",
  filterByValue: "按值过滤",
  organize: "整理字段",
  sortBy: "排序",
  limit: "限制行数",
  reduce: "归约",
  groupBy: "分组",
  labelsToFields: "标签转字段",
  merge: "合并",
  concatenate: "串联",
  calculateField: "计算字段",
  formatString: "格式化字符串",
  seriesToRows: "系列转行",
  renameByRegex: "正则重命名",
  convertFieldType: "转换字段类型",
  joinByField: "按字段连接",
  groupingToMatrix: "分组矩阵",
  histogram: "直方图",
  transpose: "转置",
  formatTime: "格式化时间",
  extractFields: "提取字段",
  prepareTimeSeries: "准备时序",
  order: "字段排序",
  rename: "重命名",
  noop: "无操作",
  partitionByValues: "按值分区",
  rowsToFields: "行转字段",
  ensureColumns: "确保列",
  convertFrameType: "转换帧类型",
  joinByLabels: "按标签连接",
  groupToNestedTable: "嵌套表",
  configFromData: "从数据配置",
  fieldLookup: "字段查找",
  heatmap: "热图转换",
  spatial: "空间",
  regression: "回归",
  smoothing: "平滑",
  timeSeriesTable: "时序表",
  append: "追加",
  filterFields: "过滤字段",
  filterFieldsByName: "按名称过滤字段",
  filterFrames: "过滤帧",
  seriesToColumns: "系列转列"
};
function transformLabel(id) {
  return TRANSFORM_LABELS[id] ?? id;
}
const FALLBACK_TRANSFORMER_IDS = [
  "filterByName",
  "filterFieldsByName",
  "organize",
  "sortBy",
  "limit",
  "reduce",
  "groupBy",
  "labelsToFields",
  "merge",
  "concatenate",
  "seriesToRows",
  "filterByValue",
  "renameByRegex",
  "convertFieldType",
  "joinByField",
  "groupingToMatrix",
  "calculateField"
];
function clonePanel(panel2) {
  return JSON.parse(JSON.stringify(panel2));
}
function nextRefId$1(used) {
  for (let code = 65; code < 90; code++) {
    const id = String.fromCharCode(code);
    if (!used.has(id)) return id;
  }
  return `Q${used.size + 1}`;
}
function ensurePanelQuery(panel2) {
  if (panel2.targets?.length) return panel2;
  const explicitType = panel2.datasource?.type;
  if (explicitType) {
    return {
      ...panel2,
      targets: [defaultQueryForType(explicitType, "A")]
    };
  }
  const effective = getEffectiveDefaultDataSource(listRuntimeDataSourceSettings());
  if (!effective) {
    return panel2;
  }
  return {
    ...panel2,
    datasource: { uid: effective.uid, type: effective.type },
    targets: [defaultQueryForType(effective.type, "A")]
  };
}
function withTargets(panel2, targets) {
  return { ...panel2, targets };
}
function listOverrides(panel2) {
  return panel2.fieldConfig?.overrides ?? [];
}
function withOverrides(panel2, overrides) {
  return {
    ...panel2,
    fieldConfig: {
      defaults: panel2.fieldConfig?.defaults ?? {},
      overrides
    }
  };
}
function listTransforms(panel2) {
  return panel2.transformations ?? [];
}
function withTransforms(panel2, transformations) {
  return {
    ...panel2,
    transformations
  };
}
function refParts(dsRef2) {
  if (dsRef2 == null) return {};
  if (typeof dsRef2 === "string") return { uid: dsRef2 };
  return {
    uid: dsRef2.uid ? String(dsRef2.uid) : void 0,
    type: dsRef2.type ? String(dsRef2.type) : void 0,
    name: dsRef2.name ? String(dsRef2.name) : void 0
  };
}
function resolveInstanceSettings(dsRef2) {
  const parts = refParts(dsRef2);
  const type = normalizeDsType(parts.type) || parts.type || "";
  const uid = parts.uid || type;
  if (uid) {
    const byUid2 = getRuntimeDataSourceSettings(uid);
    if (byUid2) {
      return {
        ...byUid2,
        name: parts.name || byUid2.name
      };
    }
  }
  if (type) {
    const matches = listRuntimeDataSourceSettings().filter(
      (s) => (normalizeDsType(s.type) || s.type) === type
    );
    const hit = matches.find((s) => s.isDefault) || matches[0];
    if (hit) {
      return {
        ...hit,
        name: parts.name || hit.name
      };
    }
  }
  return {
    uid: String(uid || type || "unknown"),
    type: String(type || uid || "unknown"),
    name: parts.name || String(uid || type || "unknown"),
    url: "",
    jsonData: {},
    meta: {
      id: String(type || uid || "unknown"),
      name: parts.name || String(type || uid || "unknown")
    }
  };
}
function resolveEditorDataSource(dsRef2) {
  const catalog = getDataSourceCatalog();
  const direct = catalog.tryResolve(dsRef2);
  if (direct) return direct;
  const settings = resolveInstanceSettings(dsRef2);
  const viaSettings = catalog.tryResolve({
    uid: settings.uid,
    type: settings.type
  });
  if (viaSettings) return viaSettings;
  const typeKey = normalizeDsType(settings.type) || settings.type;
  const plugin2 = getDataSourcePlugin(typeKey) || getDataSourcePlugin(settings.type);
  if (!plugin2?.createDataSource) {
    return {
      uid: settings.uid,
      type: settings.type,
      name: settings.name || settings.uid,
      query: async () => ({ data: [] })
    };
  }
  return plugin2.createDataSource({
    ...settings,
    meta: plugin2.meta ?? settings.meta ?? {
      id: settings.type,
      name: settings.name
    }
  });
}
function previewQuerySignature(draft, range) {
  const targets = (draft.targets ?? []).filter((x) => !x.hide);
  return JSON.stringify({
    targets,
    datasource: draft.datasource,
    type: draft.type,
    maxDataPoints: draft.maxDataPoints ?? null,
    interval: draft.interval ?? null,
    queryCachingTTL: draft.queryCachingTTL ?? null,
    cacheTimeout: draft.cacheTimeout ?? null,
    from: range?.from?.valueOf?.() ?? range?.from,
    to: range?.to?.valueOf?.() ?? range?.to,
    rev: draft.__queryRev
  });
}
function previewPresentationSignature(draft) {
  return JSON.stringify({
    transformations: draft.transformations ?? [],
    fieldConfig: draft.fieldConfig ?? {},
    options: draft.options ?? {},
    title: draft.title
  });
}
function usePanelPreview(opts) {
  const previewData = ref(opts.parentData.value);
  const previewLoading = ref(false);
  let previewTimer = null;
  let previewSeq = 0;
  let previewAbort = null;
  let lastRawSeries = [];
  let lastQuerySig = "";
  let lastPresentationSig = "";
  function resolvePreviewDataSource(dsRef2) {
    const panelDs = opts.draft.value.datasource;
    if (dsRef2 == null || dsRef2 === "") {
      return resolveEditorDataSource(panelDs);
    }
    if (typeof dsRef2 === "string") {
      return resolveEditorDataSource({
        uid: dsRef2,
        type: panelDs?.type,
        name: panelDs?.name
      });
    }
    const ref2 = dsRef2;
    return resolveEditorDataSource({
      uid: ref2.uid || panelDs?.uid,
      type: ref2.type || panelDs?.type,
      name: ref2.name || panelDs?.name
    });
  }
  const previewScheduler = new QueryScheduler({
    concurrency: 2,
    resolveDataSource: (dsRef2) => resolvePreviewDataSource(dsRef2)
  });
  const previewEngine = createPanelQueryEngine({
    scheduler: previewScheduler,
    resolveDataSource: (dsRef2) => resolvePreviewDataSource(dsRef2),
    // Network path returns raw frames; presentation applied separately.
    postProcess: (data) => data
  });
  function applyPresentation(raw, range) {
    const panel2 = opts.draft.value;
    const pipeline = runPanelDataPipeline({
      series: raw,
      transformations: panel2.transformations ?? [],
      fieldConfigDefaults: panel2.fieldConfig?.defaults ?? {},
      fieldConfigOverrides: panel2.fieldConfig?.overrides ?? [],
      state: LoadingStateEnum.Done,
      timeRange: range,
      withTrace: false
    });
    return {
      state: LoadingStateEnum.Done,
      series: pipeline.series,
      timeRange: range,
      request: { requestId: `editor-preview-${panel2.id ?? 0}` }
    };
  }
  async function runPreviewQuery() {
    const seq2 = ++previewSeq;
    const range = opts.parentData.value?.timeRange ?? rangeUtil_parse({ from: "now-6h", to: "now" });
    const draft = opts.draft.value;
    const qSig = previewQuerySignature(draft, range);
    const pSig = previewPresentationSignature(draft);
    if (qSig === lastQuerySig && pSig !== lastPresentationSig && lastRawSeries.length >= 0 && lastQuerySig !== "") {
      lastPresentationSig = pSig;
      previewData.value = applyPresentation(lastRawSeries, range);
      return;
    }
    if (qSig === lastQuerySig && pSig === lastPresentationSig && lastQuerySig) {
      return;
    }
    previewLoading.value = true;
    const targets = (draft.targets ?? []).filter((x) => !x.hide);
    previewAbort?.abort();
    const ac = new AbortController();
    previewAbort = ac;
    try {
      const result = await previewEngine.execute(
        {
          id: draft.id,
          targets: targets.length ? targets : [{ refId: "A" }],
          datasource: draft.datasource,
          // raw path: no transforms in engine
          transformations: [],
          fieldConfig: void 0,
          options: draft.options,
          title: draft.title,
          type: draft.type
        },
        {
          timeRange: range,
          requestId: `editor-preview-${draft.id ?? 0}`,
          maxDataPoints: resolvePanelMaxDataPoints(draft),
          intervalMs: resolvePanelIntervalMs(draft) ?? 15e3,
          queryCachingTTL: resolvePanelQueryCachingTTL(draft),
          cacheTimeout: resolvePanelCacheTimeout(draft),
          visible: true
        },
        ac.signal
      );
      if (seq2 !== previewSeq || ac.signal.aborted) return;
      lastRawSeries = result.series ?? [];
      lastQuerySig = qSig;
      lastPresentationSig = pSig;
      previewData.value = applyPresentation(lastRawSeries, range);
    } catch (error) {
      if (seq2 !== previewSeq || ac.signal.aborted) return;
      previewData.value = {
        state: LoadingStateEnum.Error,
        series: opts.parentData.value?.series ?? [],
        timeRange: range,
        error: {
          message: error instanceof Error ? error.message : String(error)
        },
        request: { requestId: `editor-preview-err` }
      };
    } finally {
      if (seq2 === previewSeq) previewLoading.value = false;
    }
  }
  function schedulePreviewQuery() {
    if (previewTimer) clearTimeout(previewTimer);
    previewTimer = setTimeout(() => {
      previewTimer = null;
      void runPreviewQuery();
    }, 350);
  }
  watch(
    () => [
      opts.draft.value.targets,
      opts.draft.value.transformations,
      opts.draft.value.fieldConfig,
      opts.draft.value.options,
      opts.draft.value.__queryRev,
      opts.parentData.value?.timeRange?.from?.valueOf?.() ?? opts.parentData.value?.timeRange?.from,
      opts.parentData.value?.timeRange?.to?.valueOf?.() ?? opts.parentData.value?.timeRange?.to
    ],
    () => schedulePreviewQuery()
  );
  watch(
    () => opts.parentData.value,
    (d) => {
      if (!previewData.value || previewData.value === d) previewData.value = d;
    }
  );
  onMounted(() => schedulePreviewQuery());
  onBeforeUnmount(() => {
    if (previewTimer) clearTimeout(previewTimer);
    previewAbort?.abort();
    previewScheduler.cancelAll();
  });
  return {
    previewData,
    previewLoading,
    runPreviewQuery,
    schedulePreviewQuery
  };
}
const UI_KEY = "grafana.dashboard.editor.ui";
function usePanelEditorLayout(draft) {
  const ui = ref({
    isPanelOptionsVisible: true,
    rightPaneSize: 400,
    topPaneSize: 0.45,
    mode: 0,
    tableViewEnabled: false
  });
  function loadUi() {
    try {
      const raw = localStorage.getItem(UI_KEY);
      if (!raw) return;
      const parsed = JSON.parse(raw);
      ui.value = { ...ui.value, ...parsed };
      if (typeof parsed.topPaneSize === "string") {
        ui.value.topPaneSize = Number.parseFloat(parsed.topPaneSize) / 100;
      }
    } catch {
    }
  }
  function saveUi() {
    try {
      localStorage.setItem(UI_KEY, JSON.stringify(ui.value));
    } catch {
    }
  }
  loadUi();
  try {
    const w = typeof window !== "undefined" ? Number(window.innerWidth || 0) : 0;
    if (w > 0 && w <= 1100) {
      ui.value.rightPaneSize = Math.min(
        Number(ui.value.rightPaneSize) || 360,
        w <= 768 ? Math.min(360, Math.floor(w * 0.92)) : 360
      );
    }
  } catch {
  }
  try {
    if (globalThis.process?.env?.VITEST) {
      ui.value.tableViewEnabled = true;
    }
  } catch {
  }
  const previewHostRef = ref(null);
  const previewBox = ref({ w: 0, h: 0 });
  const exactPreviewPx = computed(() => {
    const gp = draft.value?.gridPos ?? { w: 12, h: 8 };
    const colWidth = 48;
    const rowHeight = 30;
    const margin = 8;
    const w = Math.max(120, Number(gp.w || 12) * colWidth);
    const h2 = Math.max(80, Number(gp.h || 8) * (rowHeight + margin) - margin);
    return { w, h: h2 };
  });
  const previewPanelSize = computed(() => {
    const mode2 = ui.value.mode;
    const hostW = Math.max(1, previewBox.value.w || 600);
    const hostH = Math.max(1, previewBox.value.h || 280);
    const { w: exactW, h: exactH } = exactPreviewPx.value;
    if (mode2 === 2) return { width: exactW, height: exactH };
    if (mode2 === 1) {
      const scale = Math.min(1, hostW / exactW, hostH / exactH);
      return {
        width: Math.max(80, Math.floor(exactW * scale)),
        height: Math.max(60, Math.floor(exactH * scale))
      };
    }
    return { width: hostW, height: hostH };
  });
  const previewStyle = computed(() => {
    const mode2 = ui.value.mode;
    const size = previewPanelSize.value;
    if (mode2 === 0) return { width: "100%", height: "100%" };
    if (mode2 === 1) {
      return {
        width: `${size.width}px`,
        height: `${size.height}px`,
        maxWidth: "100%",
        maxHeight: "100%",
        margin: "auto",
        flex: "0 0 auto"
      };
    }
    return {
      width: `${size.width}px`,
      height: `${size.height}px`,
      margin: "auto",
      flex: "0 0 auto"
    };
  });
  function measurePreviewHost() {
    const el = previewHostRef.value;
    if (!el) return;
    const rect = el.getBoundingClientRect();
    const w = Math.max(0, Math.floor(rect.width - 16));
    const h2 = Math.max(0, Math.floor(rect.height - 16));
    if (w !== previewBox.value.w || h2 !== previewBox.value.h) {
      previewBox.value = { w, h: h2 };
    }
  }
  function setDisplayMode(m) {
    ui.value.mode = m;
    saveUi();
    requestAnimationFrame(() => measurePreviewHost());
  }
  function toggleOptionsPane() {
    ui.value.isPanelOptionsVisible = !ui.value.isPanelOptionsVisible;
    saveUi();
    void nextTick(() => {
      requestAnimationFrame(() => measurePreviewHost());
    });
  }
  function toggleTableView() {
    ui.value.tableViewEnabled = !ui.value.tableViewEnabled;
    saveUi();
  }
  let previewRo;
  const dragging = ref(null);
  let splitRect = null;
  let pendingClientX = 0;
  let pendingClientY = 0;
  let splitRaf = null;
  let activePointerId = null;
  let captureEl = null;
  function applySplitFromPointer() {
    splitRaf = null;
    if (!dragging.value || !splitRect) return;
    if (dragging.value === "v") {
      const y = pendingClientY - splitRect.top;
      const ratio = Math.min(0.75, Math.max(0.2, y / splitRect.height));
      ui.value.topPaneSize = ratio;
    } else {
      const x = splitRect.right - pendingClientX;
      const maxRight = typeof window !== "undefined" && window.innerWidth <= 1100 ? Math.min(360, Math.floor((window.innerWidth || 1100) * 0.42)) : 640;
      ui.value.rightPaneSize = Math.min(maxRight, Math.max(240, x));
    }
  }
  function onSplitStart(which, e) {
    dragging.value = which;
    e.preventDefault();
    const root = document.querySelector('[data-testid="panel-editor"]');
    splitRect = root?.getBoundingClientRect() ?? null;
    pendingClientX = e.clientX;
    pendingClientY = e.clientY;
    if ("pointerId" in e && typeof e.target?.setPointerCapture === "function") {
      activePointerId = e.pointerId;
      captureEl = e.target;
      try {
        captureEl.setPointerCapture(e.pointerId);
      } catch {
      }
    }
  }
  function onSplitMove(e) {
    if (!dragging.value) return;
    pendingClientX = e.clientX;
    pendingClientY = e.clientY;
    if (splitRaf != null) return;
    if (typeof requestAnimationFrame === "function") {
      splitRaf = requestAnimationFrame(applySplitFromPointer);
    } else {
      applySplitFromPointer();
    }
  }
  function onSplitEnd() {
    if (!dragging.value) return;
    dragging.value = null;
    splitRect = null;
    if (splitRaf != null && typeof cancelAnimationFrame === "function") {
      cancelAnimationFrame(splitRaf);
      splitRaf = null;
    }
    if (activePointerId != null && captureEl && typeof captureEl.releasePointerCapture === "function") {
      try {
        captureEl.releasePointerCapture(activePointerId);
      } catch {
      }
    }
    activePointerId = null;
    captureEl = null;
    saveUi();
  }
  onMounted(() => {
    measurePreviewHost();
    if (typeof ResizeObserver !== "undefined" && previewHostRef.value) {
      previewRo = new ResizeObserver(() => measurePreviewHost());
      previewRo.observe(previewHostRef.value);
    }
    window.addEventListener("pointermove", onSplitMove);
    window.addEventListener("pointerup", onSplitEnd);
    window.addEventListener("pointercancel", onSplitEnd);
    window.addEventListener("mousemove", onSplitMove);
    window.addEventListener("mouseup", onSplitEnd);
  });
  onBeforeUnmount(() => {
    previewRo?.disconnect();
    previewRo = void 0;
    if (splitRaf != null && typeof cancelAnimationFrame === "function") {
      cancelAnimationFrame(splitRaf);
      splitRaf = null;
    }
    window.removeEventListener("pointermove", onSplitMove);
    window.removeEventListener("pointerup", onSplitEnd);
    window.removeEventListener("pointercancel", onSplitEnd);
    window.removeEventListener("mousemove", onSplitMove);
    window.removeEventListener("mouseup", onSplitEnd);
  });
  return {
    ui,
    saveUi,
    previewHostRef,
    previewStyle,
    previewPanelSize,
    setDisplayMode,
    toggleOptionsPane,
    toggleTableView,
    onSplitStart,
    dragging
  };
}
function applyType(panel2, type) {
  return applyPanelTypeChange(panel2, type);
}
function applyOptionPath(panel2, path, value) {
  return { ...panel2, options: setOptionPath(panel2.options ?? {}, path, value) };
}
function applyFieldPath(panel2, path, value) {
  const fc = panel2.fieldConfig ?? { defaults: {}, overrides: [] };
  return {
    ...panel2,
    fieldConfig: {
      ...fc,
      defaults: setOptionPath({ ...fc.defaults ?? {} }, path, value)
    }
  };
}
function applyQueryAt(panel2, targets, index2, q) {
  const next = [...targets];
  next[index2] = q;
  return withTargets(panel2, next);
}
function addQueryTarget(panel2, targets, type, ds2) {
  const used = new Set(targets.map((t2) => t2.refId));
  const refId = nextRefId$1(used);
  const q = {
    ...defaultQueryForType(type, refId),
    datasource: { type, uid: ds2.uid, name: ds2.name }
  };
  return withTargets(panel2, [...targets, q]);
}
function changeQueryDatasource(panel2, targets, activeIndex, ds2) {
  const cur = targets[activeIndex];
  if (!cur) return panel2;
  const nextQ = switchQueryDatasource(cur, ds2);
  const next = [...targets];
  next[activeIndex] = nextQ;
  const allSame = next.every(
    (q) => normalizeDsType(q.datasource?.type) === normalizeDsType(ds2.type)
  );
  const panelDs = next.length === 1 || allSame || !panel2.datasource?.type ? { type: normalizeDsType(ds2.type) || ds2.type, uid: ds2.uid } : panel2.datasource?.type === "mixed" ? panel2.datasource : next.length > 1 && !allSame ? { type: "mixed", uid: "mixed" } : panel2.datasource;
  return { ...withTargets(panel2, next), datasource: panelDs };
}
function bumpQueryRev(panel2) {
  const rev = Number(panel2.__queryRev ?? 0) + 1;
  return { ...panel2, __queryRev: rev };
}
function duplicateQueryAt(panel2, targets, i) {
  const t2 = targets[i];
  if (!t2) return panel2;
  const used = new Set(targets.map((x) => x.refId));
  const copy = { ...t2, refId: nextRefId$1(used) };
  const next = [...targets];
  next.splice(i + 1, 0, copy);
  return withTargets(panel2, next);
}
function removeQueryAt(panel2, targets, i, activeIndex) {
  if (targets.length <= 1) return { panel: panel2, activeIndex };
  const next = targets.filter((_, idx) => idx !== i);
  const ai = Math.min(activeIndex, next.length - 1);
  return { panel: withTargets(panel2, next), activeIndex: ai };
}
function toggleQueryHide(panel2, targets, i) {
  const next = targets.map((t2, idx) => idx === i ? { ...t2, hide: !t2.hide } : t2);
  return withTargets(panel2, next);
}
function moveQueryAt(panel2, targets, i, dir) {
  const j = i + dir;
  if (j < 0 || j >= targets.length) return { panel: panel2, activeIndex: i };
  const next = [...targets];
  const tmp = next[i];
  next[i] = next[j];
  next[j] = tmp;
  return { panel: withTargets(panel2, next), activeIndex: j };
}
function addTransform(panel2, transforms, id) {
  const options = id === "reduce" ? { reducers: ["lastNotNull"] } : id === "limit" ? { limitValue: 10 } : {};
  return withTransforms(panel2, [...transforms, { id, options }]);
}
function updateTransformAt(panel2, transforms, i, patch) {
  const next = transforms.map((t2, idx) => {
    if (idx !== i) return t2;
    const merged = {
      ...t2,
      ...patch,
      options: patch.options ?? t2.options
    };
    if ("filter" in patch) merged.filter = patch.filter;
    if ("topic" in patch) merged.topic = patch.topic;
    return merged;
  });
  return withTransforms(panel2, next);
}
function clearTransforms(panel2) {
  return withTransforms(panel2, []);
}
function removeTransformAt(panel2, transforms, i) {
  return withTransforms(
    panel2,
    transforms.filter((_, idx) => idx !== i)
  );
}
function toggleTransformAt(panel2, transforms, i) {
  return withTransforms(
    panel2,
    transforms.map((t2, idx) => idx === i ? { ...t2, disabled: !t2.disabled } : t2)
  );
}
function moveTransformAt(panel2, transforms, i, dir) {
  const j = i + dir;
  if (j < 0 || j >= transforms.length) return panel2;
  const next = [...transforms];
  const tmp = next[i];
  next[i] = next[j];
  next[j] = tmp;
  return withTransforms(panel2, next);
}
function addFieldOverride(panel2, overrides) {
  return withOverrides(panel2, [
    ...overrides,
    {
      matcher: { id: "byName", options: "" },
      properties: [{ id: "unit", value: "short" }]
    }
  ]);
}
function updateOverrideMatcherAt(panel2, overrides, i, id, options) {
  return withOverrides(
    panel2,
    overrides.map((o, idx) => idx === i ? { ...o, matcher: { id, options } } : o)
  );
}
function addOverridePropAt(panel2, overrides, i) {
  return withOverrides(
    panel2,
    overrides.map(
      (o, idx) => idx === i ? {
        ...o,
        properties: [...o.properties ?? [], { id: "displayName", value: "" }]
      } : o
    )
  );
}
function removeOverridePropAt(panel2, overrides, i, pi) {
  return withOverrides(
    panel2,
    overrides.map(
      (o, idx) => idx === i ? { ...o, properties: (o.properties ?? []).filter((_, j) => j !== pi) } : o
    )
  );
}
function setOverridePropIdAt(panel2, overrides, i, pi, id) {
  return withOverrides(
    panel2,
    overrides.map((o, idx) => {
      if (idx !== i) return o;
      const properties = [...o.properties ?? []];
      properties[pi] = { ...properties[pi], id };
      return { ...o, properties };
    })
  );
}
function setOverridePropValueAt(panel2, overrides, i, pi, raw) {
  let value = raw;
  try {
    if (raw.trim().startsWith("{") || raw.trim().startsWith("[")) value = JSON.parse(raw);
    else if (raw === "true" || raw === "false") value = raw === "true";
    else if (raw !== "" && !Number.isNaN(Number(raw))) value = Number(raw);
  } catch {
    value = raw;
  }
  return withOverrides(
    panel2,
    overrides.map((o, idx) => {
      if (idx !== i) return o;
      const properties = [...o.properties ?? []];
      properties[pi] = { ...properties[pi], value };
      return { ...o, properties };
    })
  );
}
function removeOverrideAt(panel2, overrides, i) {
  return withOverrides(
    panel2,
    overrides.filter((_, idx) => idx !== i)
  );
}
const FRAME_CAT = ["面板选项"];
const LINKS_CAT = ["面板链接"];
const REPEAT_CAT = ["重复选项"];
const TIME_CAT = ["面板时间"];
const LIBRARY_CAT = ["库面板"];
const MAX_PER_ROW_OPTIONS = [2, 3, 4, 6, 8, 12].map((value) => ({
  label: String(value),
  value
}));
function getPanelFrameDescriptors(panel2 = {}) {
  const hasRepeat = Boolean(panel2.repeat);
  const isHorizontal = hasRepeat && String(panel2.repeatDirection || "h") === "h";
  const isLibrary = Boolean(panel2.libraryPanel);
  const items = [
    {
      id: "panel-frame-title",
      path: "title",
      name: "标题",
      category: FRAME_CAT,
      editor: "text",
      editorKey: "text",
      defaultValue: "",
      order: 1
    },
    {
      id: "panel-frame-description",
      path: "description",
      name: "描述",
      category: FRAME_CAT,
      editor: "textarea",
      editorKey: "textarea",
      defaultValue: "",
      order: 2
    },
    {
      id: "panel-frame-transparent-bg",
      path: "transparent",
      name: "透明背景",
      category: FRAME_CAT,
      editor: "boolean",
      editorKey: "boolean",
      defaultValue: false,
      order: 3
    },
    {
      id: "panel-frame-links",
      path: "links",
      name: "面板链接",
      category: LINKS_CAT,
      editor: "links",
      editorKey: "links",
      defaultValue: [],
      order: 10,
      getItemsCount: (v) => Array.isArray(v) ? v.length : 0
    },
    {
      id: "panel-frame-repeat-by-variable",
      path: "repeat",
      name: "按变量重复",
      description: "按所选变量的每个值重复此面板。编辑模式下不可见；需返回仪表盘并更新变量或重新加载后生效。",
      category: REPEAT_CAT,
      editor: "select",
      editorKey: "select",
      order: 20
    },
    {
      id: "panel-frame-repeat-direction",
      path: "repeatDirection",
      name: "重复方向",
      category: REPEAT_CAT,
      editor: "radio",
      editorKey: "radio",
      defaultValue: "h",
      order: 21,
      showIf: () => hasRepeat,
      settings: {
        options: [
          { label: "水平", value: "h" },
          { label: "垂直", value: "v" }
        ]
      }
    },
    {
      id: "panel-frame-repeat-max-per-row",
      path: "maxPerRow",
      name: "每行最大",
      category: REPEAT_CAT,
      editor: "select",
      editorKey: "select",
      defaultValue: 4,
      order: 22,
      showIf: () => isHorizontal,
      settings: {
        options: MAX_PER_ROW_OPTIONS
      }
    },
    {
      id: "panel-frame-time-from",
      path: "timeFrom",
      name: "时间范围覆盖",
      description: "相对或绝对时间范围（例如 now-1h / now）",
      category: TIME_CAT,
      editor: "text",
      editorKey: "text",
      order: 30
    },
    {
      id: "panel-frame-time-shift",
      path: "timeShift",
      name: "时间偏移",
      description: "相对时间偏移（例如 1h）",
      category: TIME_CAT,
      editor: "text",
      editorKey: "text",
      order: 31
    },
    {
      id: "panel-frame-hide-time-override",
      path: "hideTimeOverride",
      name: "隐藏时间覆盖",
      category: TIME_CAT,
      editor: "boolean",
      editorKey: "boolean",
      defaultValue: false,
      order: 32
    },
    {
      id: "panel-frame-max-data-points",
      path: "maxDataPoints",
      name: "最大数据点数",
      description: "覆盖面板查询的 maxDataPoints",
      category: TIME_CAT,
      editor: "number",
      editorKey: "number",
      order: 33
    },
    {
      id: "panel-frame-interval",
      path: "interval",
      name: "最小间隔",
      description: "覆盖查询间隔，例如 1m",
      category: TIME_CAT,
      editor: "text",
      editorKey: "text",
      order: 34
    },
    {
      id: "panel-frame-cache-timeout",
      path: "cacheTimeout",
      name: "缓存超时",
      description: "查询缓存超时",
      category: TIME_CAT,
      editor: "text",
      editorKey: "text",
      order: 35
    },
    {
      id: "panel-frame-query-caching-ttl",
      path: "queryCachingTTL",
      name: "查询缓存 TTL",
      description: "查询缓存 TTL（毫秒）",
      category: TIME_CAT,
      editor: "number",
      editorKey: "number",
      order: 36
    }
  ];
  if (isLibrary) {
    items.push({
      id: "panel-frame-library",
      path: "libraryPanel",
      name: "库面板",
      description: "此面板绑定到库面板定义",
      category: LIBRARY_CAT,
      editor: "text",
      editorKey: "text",
      order: 40,
      // host metadata — read-only in UI via disableIf
      disableIf: () => true
    });
  }
  return items;
}
const PANEL_FRAME_CATEGORY_DEFAULT_OPEN = {
  面板选项: true,
  面板链接: false,
  重复选项: false,
  面板时间: false,
  库面板: false
};
const _hoisted_1$1j = {
  class: "panel-frame-options",
  "data-testid": "panel-frame-options-fields"
};
const _hoisted_2$14 = ["data-testid", "data-category"];
const _hoisted_3$V = ["aria-expanded", "data-testid", "onClick"];
const _hoisted_4$J = { class: "caret" };
const _hoisted_5$C = { class: "cat-title" };
const _hoisted_6$y = {
  class: "cat-count",
  "data-testid": "panel-frame-cat-count"
};
const _hoisted_7$t = { class: "cat-body" };
const _hoisted_8$o = ["data-testid", "data-path", "data-editor"];
const _hoisted_9$n = { class: "frame-label" };
const _hoisted_10$i = { class: "name" };
const _hoisted_11$i = {
  key: 0,
  class: "desc"
};
const _hoisted_12$h = ["value", "onChange"];
const _hoisted_13$h = {
  key: 5,
  class: "radio-row",
  "data-testid": "panel-repeat-direction"
};
const _hoisted_14$f = ["value", "checked", "onChange"];
const _hoisted_15$d = {
  key: 9,
  class: "readonly",
  "data-testid": "panel-library-readonly"
};
const _sfc_main$1n = /* @__PURE__ */ defineComponent({
  __name: "PanelFrameOptions",
  props: {
    panel: {},
    repeatVariableOptions: {},
    templateVars: {},
    templateVarProperties: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const collapsed = ref({});
    const descriptors = computed(() => getPanelFrameDescriptors(props.panel));
    const byCategory = computed(() => {
      const map = /* @__PURE__ */ new Map();
      for (const d of descriptors.value) {
        const showIf = d.showIf;
        if (showIf && showIf(props.panel) === false) continue;
        const cat = d.category?.[0] ?? "面板选项";
        if (!map.has(cat)) map.set(cat, []);
        map.get(cat).push(d);
      }
      return [...map.entries()];
    });
    function isOpen(cat) {
      if (cat in collapsed.value) return !collapsed.value[cat];
      return PANEL_FRAME_CATEGORY_DEFAULT_OPEN[cat] ?? true;
    }
    function toggle(cat) {
      const open = isOpen(cat);
      collapsed.value = { ...collapsed.value, [cat]: open };
    }
    function val(path) {
      return props.panel[path];
    }
    function set(path, value) {
      emit("change", path, value);
    }
    const repeatOptions = computed(() => {
      const base = props.repeatVariableOptions ?? [];
      return [{ label: "禁用", value: "" }, ...base];
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1j, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(byCategory.value, ([cat, items]) => {
            return openBlock(), createElementBlock("div", {
              key: cat,
              class: normalizeClass(["frame-cat", { "is-open": isOpen(cat) }]),
              "data-testid": `panel-frame-cat-${cat}`,
              "data-category": cat
            }, [
              createElementVNode("button", {
                type: "button",
                class: "cat-head",
                "aria-expanded": isOpen(cat),
                "data-testid": `panel-frame-cat-toggle-${cat}`,
                onClick: ($event) => toggle(cat)
              }, [
                createElementVNode(
                  "span",
                  _hoisted_4$J,
                  toDisplayString(isOpen(cat) ? "▾" : "▸"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "span",
                  _hoisted_5$C,
                  toDisplayString(cat),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "span",
                  _hoisted_6$y,
                  toDisplayString(items.length),
                  1
                  /* TEXT */
                )
              ], 8, _hoisted_3$V),
              withDirectives(createElementVNode(
                "div",
                _hoisted_7$t,
                [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(items, (d) => {
                      return openBlock(), createElementBlock("div", {
                        key: d.id,
                        class: "frame-row",
                        "data-testid": `panel-frame-${d.path}`,
                        "data-path": d.path,
                        "data-editor": d.editor
                      }, [
                        createElementVNode("label", _hoisted_9$n, [
                          createElementVNode(
                            "span",
                            _hoisted_10$i,
                            toDisplayString(d.name),
                            1
                            /* TEXT */
                          ),
                          d.description ? (openBlock(), createElementBlock(
                            "span",
                            _hoisted_11$i,
                            toDisplayString(d.description),
                            1
                            /* TEXT */
                          )) : createCommentVNode("v-if", true)
                        ]),
                        d.editor === "boolean" ? (openBlock(), createBlock(unref(GSwitch), {
                          key: 0,
                          checked: !!val(d.path),
                          disabled: d.disableIf?.(props.panel) === true,
                          "onUpdate:checked": ($event) => set(d.path, $event)
                        }, null, 8, ["checked", "disabled", "onUpdate:checked"])) : d.editor === "text" && d.path !== "libraryPanel" ? (openBlock(), createBlock(unref(GInput), {
                          key: 1,
                          "test-id": d.path === "title" ? "panel-title-input" : void 0,
                          value: String(val(d.path) ?? ""),
                          disabled: d.disableIf?.(props.panel) === true,
                          "onUpdate:value": ($event) => set(d.path, $event === "" ? void 0 : $event)
                        }, null, 8, ["test-id", "value", "disabled", "onUpdate:value"])) : d.editor === "textarea" ? (openBlock(), createElementBlock("textarea", {
                          key: 2,
                          rows: "2",
                          class: "frame-textarea",
                          "data-testid": "panel-frame-description-input",
                          value: String(val(d.path) ?? ""),
                          onChange: ($event) => set(d.path, $event.target.value)
                        }, null, 40, _hoisted_12$h)) : d.editor === "links" ? (openBlock(), createBlock(unref(DataLinksEditor), {
                          key: 3,
                          "model-value": val(d.path) ?? [],
                          "template-vars": __props.templateVars,
                          "template-var-properties": __props.templateVarProperties,
                          "onUpdate:modelValue": ($event) => set(d.path, $event)
                        }, null, 8, ["model-value", "template-vars", "template-var-properties", "onUpdate:modelValue"])) : d.path === "repeat" ? (openBlock(), createBlock(unref(GSelect), {
                          key: 4,
                          "test-id": "panel-repeat",
                          value: String(val("repeat") ?? ""),
                          options: repeatOptions.value,
                          placeholder: "选择变量",
                          onChange: _cache[0] || (_cache[0] = ($event) => set("repeat", $event ? String($event) : void 0))
                        }, null, 8, ["value", "options"])) : d.path === "repeatDirection" ? (openBlock(), createElementBlock("div", _hoisted_13$h, [
                          (openBlock(true), createElementBlock(
                            Fragment,
                            null,
                            renderList(d.settings?.options ?? [], (opt) => {
                              return openBlock(), createElementBlock("label", {
                                key: String(opt.value),
                                class: "radio"
                              }, [
                                createElementVNode("input", {
                                  type: "radio",
                                  name: "repeatDirection",
                                  value: opt.value,
                                  checked: String(val("repeatDirection") || "h") === String(opt.value),
                                  onChange: ($event) => set("repeatDirection", opt.value)
                                }, null, 40, _hoisted_14$f),
                                createTextVNode(
                                  " " + toDisplayString(opt.label),
                                  1
                                  /* TEXT */
                                )
                              ]);
                            }),
                            128
                            /* KEYED_FRAGMENT */
                          ))
                        ])) : d.path === "maxPerRow" ? (openBlock(), createBlock(unref(GSelect), {
                          key: 6,
                          "test-id": "panel-max-per-row",
                          value: Number(val("maxPerRow") ?? 4),
                          options: unref(MAX_PER_ROW_OPTIONS),
                          onChange: _cache[1] || (_cache[1] = ($event) => set("maxPerRow", Number($event ?? 4)))
                        }, null, 8, ["value", "options"])) : d.path === "timeFrom" ? (openBlock(), createBlock(unref(GInput), {
                          key: 7,
                          "test-id": "panel-time-from",
                          value: String(val("timeFrom") ?? ""),
                          "onUpdate:value": _cache[2] || (_cache[2] = ($event) => set("timeFrom", $event === "" ? void 0 : $event))
                        }, null, 8, ["value"])) : d.path === "timeShift" ? (openBlock(), createBlock(unref(GInput), {
                          key: 8,
                          "test-id": "panel-time-shift",
                          value: String(val("timeShift") ?? ""),
                          "onUpdate:value": _cache[3] || (_cache[3] = ($event) => set("timeShift", $event === "" ? void 0 : $event))
                        }, null, 8, ["value"])) : d.path === "libraryPanel" ? (openBlock(), createElementBlock("span", _hoisted_15$d, " 库面板（只读） ")) : createCommentVNode("v-if", true)
                      ], 8, _hoisted_8$o);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ],
                512
                /* NEED_PATCH */
              ), [
                [vShow, isOpen(cat)]
              ])
            ], 10, _hoisted_2$14);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const PanelFrameOptions = /* @__PURE__ */ _export_sfc$1(_sfc_main$1n, [["__scopeId", "data-v-c39f84ad"]]);
const _hoisted_1$1i = ["data-testid"];
const _hoisted_2$13 = ["data-testid", "aria-expanded"];
const _hoisted_3$U = { class: "qr-id" };
const _hoisted_4$I = { class: "qr-dstype" };
const _hoisted_5$B = ["data-testid"];
const _hoisted_6$x = ["data-testid"];
const _sfc_main$1m = /* @__PURE__ */ defineComponent({
  __name: "QueryEditorRow",
  props: {
    index: {},
    refId: {},
    target: {},
    dsType: {},
    hide: { type: Boolean },
    collapsed: { type: Boolean },
    queryEditor: {},
    dsInstance: {},
    dsApi: {},
    dsOptions: {},
    total: {}
  },
  emits: ["toggle-collapse", "activate", "duplicate", "toggle-hide", "move", "remove", "change", "change-datasource", "run-query"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["query-row", { hidden: __props.hide }]),
        "data-testid": `query-row-${__props.refId}`
      }, [
        createElementVNode("header", {
          class: "qr-head",
          onClick: _cache[10] || (_cache[10] = ($event) => emit("activate"))
        }, [
          createElementVNode("button", {
            type: "button",
            class: "qr-collapse",
            "data-testid": `query-row-toggle-${__props.refId}`,
            "aria-expanded": !__props.collapsed,
            onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("toggle-collapse"), ["stop"]))
          }, toDisplayString(__props.collapsed ? "▸" : "▾"), 9, _hoisted_2$13),
          createElementVNode(
            "span",
            _hoisted_3$U,
            toDisplayString(__props.refId),
            1
            /* TEXT */
          ),
          createElementVNode("label", {
            class: "qr-ds",
            onClick: _cache[2] || (_cache[2] = withModifiers(() => {
            }, ["stop"]))
          }, [
            createVNode(unref(GSelect), {
              value: __props.dsInstance.uid,
              options: __props.dsOptions,
              "test-id": `query-row-ds-${__props.refId}`,
              "aria-label": "选择数据源",
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => emit("change-datasource", String($event ?? "")))
            }, null, 8, ["value", "options", "test-id"])
          ]),
          createElementVNode(
            "span",
            _hoisted_4$I,
            toDisplayString(unref(dsTypeLabel)(__props.dsType)),
            1
            /* TEXT */
          ),
          _cache[16] || (_cache[16] = createElementVNode(
            "span",
            { class: "qr-spacer" },
            null,
            -1
            /* CACHED */
          )),
          createElementVNode("div", {
            class: "qr-actions",
            onClick: _cache[9] || (_cache[9] = withModifiers(() => {
            }, ["stop"]))
          }, [
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": `query-row-dup-${__props.refId}`,
              onClick: _cache[3] || (_cache[3] = ($event) => emit("duplicate"))
            }, {
              default: withCtx(() => [..._cache[11] || (_cache[11] = [
                createTextVNode(
                  " 复制 ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            }, 8, ["test-id"]),
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": `query-row-hide-${__props.refId}`,
              onClick: _cache[4] || (_cache[4] = ($event) => emit("toggle-hide"))
            }, {
              default: withCtx(() => [
                createTextVNode(
                  toDisplayString(__props.hide ? "显示" : "隐藏"),
                  1
                  /* TEXT */
                )
              ]),
              _: 1
              /* STABLE */
            }, 8, ["test-id"]),
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": `query-row-up-${__props.refId}`,
              disabled: __props.index === 0,
              onClick: _cache[5] || (_cache[5] = ($event) => emit("move", -1))
            }, {
              default: withCtx(() => [..._cache[12] || (_cache[12] = [
                createTextVNode(
                  " ↑ ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            }, 8, ["test-id", "disabled"]),
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": `query-row-down-${__props.refId}`,
              disabled: __props.index >= __props.total - 1,
              onClick: _cache[6] || (_cache[6] = ($event) => emit("move", 1))
            }, {
              default: withCtx(() => [..._cache[13] || (_cache[13] = [
                createTextVNode(
                  " ↓ ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            }, 8, ["test-id", "disabled"]),
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": `query-row-remove-${__props.refId}`,
              disabled: __props.total <= 1,
              onClick: _cache[7] || (_cache[7] = ($event) => emit("remove"))
            }, {
              default: withCtx(() => [..._cache[14] || (_cache[14] = [
                createTextVNode(
                  " 删除 ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            }, 8, ["test-id", "disabled"]),
            createVNode(unref(GButton), {
              size: "md",
              variant: "primary",
              "test-id": `query-row-run-${__props.refId}`,
              onClick: _cache[8] || (_cache[8] = ($event) => emit("run-query"))
            }, {
              default: withCtx(() => [..._cache[15] || (_cache[15] = [
                createTextVNode(
                  " 运行 ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            }, 8, ["test-id"])
          ])
        ]),
        !__props.collapsed ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: "qr-body",
          "data-testid": `query-row-body-${__props.refId}`
        }, [
          __props.queryEditor ? (openBlock(), createBlock(resolveDynamicComponent(__props.queryEditor), {
            key: 0,
            query: __props.target,
            datasource: __props.dsInstance,
            "datasource-api": __props.dsApi,
            "on-change": (q) => emit("change", q),
            "on-run-query": () => emit("run-query")
          }, null, 40, ["query", "datasource", "datasource-api", "on-change", "on-run-query"])) : (openBlock(), createElementBlock("div", {
            key: 1,
            class: "qr-empty",
            "data-testid": `query-row-empty-${__props.refId}`
          }, " 暂无查询编辑器：" + toDisplayString(unref(dsTypeLabel)(__props.dsType) || __props.dsType || "未选择"), 9, _hoisted_6$x))
        ], 8, _hoisted_5$B)) : createCommentVNode("v-if", true)
      ], 10, _hoisted_1$1i);
    };
  }
});
const QueryEditorRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$1m, [["__scopeId", "data-v-26a0d15b"]]);
const _hoisted_1$1h = {
  class: "section query-section",
  "data-testid": "query-section"
};
const _hoisted_2$12 = {
  class: "query-rows",
  "data-testid": "query-rows"
};
const _hoisted_3$T = { class: "query-add-row" };
const _sfc_main$1l = /* @__PURE__ */ defineComponent({
  __name: "QueryEditorTab",
  props: {
    targets: {},
    activeQuery: {},
    rows: {},
    activeTarget: {},
    queryEditor: {},
    dsType: {},
    dsInstance: {},
    dsApi: {}
  },
  emits: ["update:activeQuery", "activate", "add", "duplicate", "toggle-hide", "move", "remove", "change", "change-at", "change-datasource", "change-datasource-at", "run-query"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const catalog = ref([]);
    const loadingDs = ref(false);
    const collapsedMap = reactive({});
    const rowVmCache = /* @__PURE__ */ new Map();
    const VISIBLE_DS_TYPES = /* @__PURE__ */ new Set(["alexanderzobnin-zabbix-datasource", "signoz"]);
    function pluginsAsCatalog() {
      return listDataSourcePlugins().filter((p) => VISIBLE_DS_TYPES.has(p.meta.id)).map((p) => ({
        uid: p.meta.id,
        name: p.meta.name,
        type: p.meta.id
      }));
    }
    function mergeDsCatalog(listed) {
      const byUid2 = /* @__PURE__ */ new Map();
      const byType = /* @__PURE__ */ new Set();
      for (const d of listed) {
        if (!d?.uid) continue;
        byUid2.set(d.uid, d);
        if (d.type) byType.add(d.type);
      }
      for (const p of pluginsAsCatalog()) {
        if (byUid2.has(p.uid)) continue;
        if (p.type && byType.has(p.type)) continue;
        byUid2.set(p.uid, p);
        if (p.type) byType.add(p.type);
      }
      return [...byUid2.values()];
    }
    onMounted(async () => {
      loadingDs.value = true;
      try {
        const listed = await listDataSources();
        catalog.value = mergeDsCatalog(listed);
      } catch {
        catalog.value = mergeDsCatalog([]);
      } finally {
        loadingDs.value = false;
      }
    });
    const dsOptions = computed(() => {
      const opts = catalog.value.map((d) => ({
        label: `${d.name} · ${dsTypeLabel(d.type)}`,
        value: d.uid
      }));
      for (const r of props.rows ?? []) {
        const curUid = r.dsInstance?.uid;
        if (curUid && !opts.some((o) => o.value === curUid)) {
          opts.unshift({
            label: `${r.dsInstance.name || curUid} · ${dsTypeLabel(r.dsType)}`,
            value: curUid
          });
        }
      }
      const legacyUid = props.dsInstance?.uid;
      if (legacyUid && !opts.some((o) => o.value === legacyUid)) {
        opts.unshift({
          label: `${props.dsInstance.name || legacyUid} · ${dsTypeLabel(props.dsType)}`,
          value: legacyUid
        });
      }
      return opts;
    });
    function toggleCollapse2(refId) {
      collapsedMap[refId] = !collapsedMap[refId];
    }
    function idxOf(refId) {
      if (props.rows?.length) {
        return props.rows.findIndex((t2) => t2.refId === refId);
      }
      return props.targets.findIndex((t2) => t2.refId === refId);
    }
    function onRowChangeDs(refId, uid) {
      const id = String(uid ?? "");
      const i = idxOf(refId);
      if (i < 0) return;
      const found = catalog.value.find((d) => d.uid === id);
      if (found) {
        emit("change-datasource-at", i, {
          type: found.type,
          uid: found.uid,
          name: found.name
        });
        return;
      }
      const plugin2 = listDataSourcePlugins().find((p) => p.meta.id === id);
      if (plugin2) {
        emit("change-datasource-at", i, {
          type: plugin2.meta.id,
          uid: plugin2.meta.id,
          name: plugin2.meta.name
        });
      }
    }
    const resolvedRows = computed(() => {
      let source;
      if (props.rows?.length) {
        source = props.rows;
      } else {
        source = (props.targets ?? []).map((t2, i) => {
          const q = t2;
          const type = normalizeDsType(q?.datasource?.type) || normalizeDsType(props.dsType) || "grafana-testdata-datasource";
          const active = i === props.activeQuery;
          return {
            refId: t2.refId,
            target: t2,
            dsType: type,
            hide: !!q?.hide,
            queryEditor: active ? props.queryEditor : null,
            dsInstance: active ? props.dsInstance : {
              uid: q?.datasource?.uid ?? type,
              type,
              name: q?.datasource?.name ?? type,
              jsonData: {},
              meta: { id: type, name: type }
            },
            dsApi: active ? props.dsApi : null
          };
        });
      }
      const nextIds = new Set(source.map((r) => r.refId));
      for (const id of [...rowVmCache.keys()]) {
        if (!nextIds.has(id)) rowVmCache.delete(id);
      }
      return source.map((r) => {
        const prev = rowVmCache.get(r.refId);
        if (prev && prev.target === r.target && prev.dsType === r.dsType && prev.hide === r.hide && prev.queryEditor === r.queryEditor && prev.dsInstance === r.dsInstance && prev.dsApi === r.dsApi) {
          return prev;
        }
        rowVmCache.set(r.refId, r);
        return r;
      });
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("section", _hoisted_1$1h, [
        createElementVNode("div", _hoisted_2$12, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(resolvedRows.value, (r, i) => {
              return openBlock(), createBlock(QueryEditorRow, {
                key: r.refId,
                index: i,
                "ref-id": r.refId,
                target: r.target,
                "ds-type": r.dsType,
                hide: r.hide,
                collapsed: !!collapsedMap[r.refId],
                "query-editor": r.queryEditor,
                "ds-instance": r.dsInstance,
                "ds-api": r.dsApi,
                "ds-options": dsOptions.value,
                total: resolvedRows.value.length,
                onToggleCollapse: ($event) => toggleCollapse2(r.refId),
                onActivate: ($event) => {
                  emit("activate", i);
                  emit("update:activeQuery", i);
                },
                onDuplicate: ($event) => emit("duplicate", i),
                onToggleHide: ($event) => emit("toggle-hide", i),
                onMove: (dir) => emit("move", i, dir),
                onRemove: ($event) => emit("remove", i),
                onChange: (q) => emit("change-at", i, q),
                onChangeDatasource: (uid) => onRowChangeDs(r.refId, uid),
                onRunQuery: _cache[0] || (_cache[0] = ($event) => emit("run-query"))
              }, null, 8, ["index", "ref-id", "target", "ds-type", "hide", "collapsed", "query-editor", "ds-instance", "ds-api", "ds-options", "total", "onToggleCollapse", "onActivate", "onDuplicate", "onToggleHide", "onMove", "onRemove", "onChange", "onChangeDatasource"]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ]),
        createElementVNode("div", _hoisted_3$T, [
          createCommentVNode(" Grafana QueryGroup: secondary solid Button + plus, not full-width dashed "),
          createVNode(unref(GButton), {
            variant: "secondary",
            size: "md",
            "test-id": "add-query-btn",
            disabled: loadingDs.value,
            onClick: _cache[1] || (_cache[1] = ($event) => emit("add"))
          }, {
            default: withCtx(() => [
              createVNode(unref(GIcon), {
                name: "plus",
                size: 14
              }),
              _cache[2] || (_cache[2] = createTextVNode(
                " 添加查询 ",
                -1
                /* CACHED */
              ))
            ]),
            _: 1
            /* STABLE */
          }, 8, ["disabled"])
        ])
      ]);
    };
  }
});
const QueryEditorTab = /* @__PURE__ */ _export_sfc$1(_sfc_main$1l, [["__scopeId", "data-v-fa2aa537"]]);
const _hoisted_1$1g = {
  "data-testid": "field-config-editor",
  class: "field-config-editor"
};
const _hoisted_2$11 = ["data-testid"];
const _hoisted_3$S = { key: 0 };
const _hoisted_4$H = { key: 1 };
const _hoisted_5$A = {
  class: "override-props",
  "data-testid": "override-props"
};
const _hoisted_6$w = ["data-testid", "data-prop-id", "data-prop-editor"];
const _sfc_main$1k = /* @__PURE__ */ defineComponent({
  __name: "FieldOverridesEditor",
  props: {
    overrides: {}
  },
  emits: ["add", "remove", "update-matcher", "add-prop", "remove-prop", "set-prop-id", "set-prop-value", "set-prop-value-typed"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const __ovId = /* @__PURE__ */ new WeakMap();
    let __ovSeq = 0;
    function keyOf(obj) {
      if (obj && typeof obj === "object") {
        let id = __ovId.get(obj);
        if (id == null) {
          id = ++__ovSeq;
          __ovId.set(obj, id);
        }
        return id;
      }
      return -1;
    }
    const matcherOptions = computed(
      () => listOverridePickerMatchers().map((m) => ({ value: m.id, label: m.name }))
    );
    const GRAPH_CUSTOM_PROPS = [
      { value: "custom.drawStyle", label: "绘制样式" },
      { value: "custom.lineInterpolation", label: "线插值" },
      { value: "custom.lineWidth", label: "线宽" },
      { value: "custom.fillOpacity", label: "填充透明度" },
      { value: "custom.gradientMode", label: "渐变模式" },
      { value: "custom.spanNulls", label: "跨越空值" },
      { value: "custom.insertNulls", label: "插入空值" },
      { value: "custom.showPoints", label: "显示点" },
      { value: "custom.pointSize", label: "点大小" },
      { value: "custom.stacking", label: "堆叠" },
      { value: "custom.axisPlacement", label: "轴位置" },
      { value: "custom.axisLabel", label: "轴标签" },
      { value: "custom.axisSoftMin", label: "软最小值" },
      { value: "custom.axisSoftMax", label: "软最大值" },
      { value: "custom.scaleDistribution", label: "刻度分布" },
      { value: "custom.hideFrom", label: "隐藏" },
      { value: "custom.thresholdsStyle", label: "阈值样式" },
      { value: "custom.barAlignment", label: "柱对齐" },
      { value: "custom.barWidthFactor", label: "柱宽系数" },
      { value: "custom.lineStyle", label: "线型" }
    ];
    const propOptions = computed(() => [
      ...listStandardOverridePropertyOptions(),
      ...GRAPH_CUSTOM_PROPS
    ]);
    const FIELD_TYPES = [
      { value: "number", label: "number" },
      { value: "string", label: "string" },
      { value: "time", label: "time" },
      { value: "boolean", label: "boolean" },
      { value: "other", label: "other" }
    ];
    function propEditorKind(id) {
      if (id === "unit") return "unit";
      if (id === "color") return "fieldColor";
      if (id === "thresholds") return "thresholds";
      if (id === "mappings") return "mappings";
      if (id === "links") return "links";
      if (id === "filterable" || id === "fieldMinMax") return "boolean";
      if (id === "min" || id === "max" || id === "decimals" || id === "custom.lineWidth" || id === "custom.fillOpacity" || id === "custom.pointSize" || id === "custom.barWidthFactor" || id === "custom.axisSoftMin" || id === "custom.axisSoftMax") {
        return "number";
      }
      if (id.startsWith("custom.")) return "text";
      return "text";
    }
    function matcherOptionString(options) {
      if (options == null) return "";
      if (typeof options === "string" || typeof options === "number" || typeof options === "boolean") {
        return String(options);
      }
      if (typeof options === "object" && options && "names" in options) {
        const names = options.names;
        return Array.isArray(names) ? names.join(", ") : String(names ?? "");
      }
      try {
        return JSON.stringify(options);
      } catch {
        return String(options);
      }
    }
    function emitMatcherOptions(i, id, raw) {
      if (id === "byNames") {
        const names = raw.split(",").map((s) => s.trim()).filter(Boolean);
        emit("update-matcher", i, id, { names, mode: "include" });
        return;
      }
      emit("update-matcher", i, id, raw);
    }
    function emitTyped(i, pi, value) {
      emit("set-prop-value-typed", i, pi, value);
      const raw = value == null ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);
      emit("set-prop-value", i, pi, raw);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1g, [
        _cache[8] || (_cache[8] = createElementVNode(
          "h4",
          { class: "subhead" },
          "覆盖规则",
          -1
          /* CACHED */
        )),
        createVNode(unref(GButton), {
          size: "md",
          variant: "secondary",
          "test-id": "add-override-btn",
          onClick: _cache[0] || (_cache[0] = ($event) => emit("add"))
        }, {
          default: withCtx(() => [..._cache[1] || (_cache[1] = [
            createTextVNode(
              " + 添加字段覆盖 ",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        }),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.overrides, (o, i) => {
            return openBlock(), createElementBlock("div", {
              key: keyOf(o),
              class: "transform-card",
              "data-testid": `override-${i}`
            }, [
              createElementVNode("header", null, [
                createElementVNode(
                  "strong",
                  null,
                  "规则 " + toDisplayString(i + 1),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "destructive",
                  onClick: ($event) => emit("remove", i)
                }, {
                  default: withCtx(() => [..._cache[2] || (_cache[2] = [
                    createTextVNode(
                      " 删除 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["onClick"])
              ]),
              createElementVNode("label", null, [
                _cache[3] || (_cache[3] = createTextVNode(
                  "匹配器 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: o.matcher?.id ?? "byName",
                  options: matcherOptions.value,
                  "show-search": false,
                  onChange: ($event) => emit("update-matcher", i, String($event), o.matcher?.options)
                }, null, 8, ["value", "options", "onChange"])
              ]),
              (o.matcher?.id ?? "byName") === "byType" ? (openBlock(), createElementBlock("label", _hoisted_3$S, [
                _cache[4] || (_cache[4] = createTextVNode(
                  "字段类型 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: String(o.matcher?.options ?? "number"),
                  options: FIELD_TYPES,
                  onChange: ($event) => emit("update-matcher", i, "byType", String($event))
                }, null, 8, ["value", "onChange"])
              ])) : (openBlock(), createElementBlock("label", _hoisted_4$H, [
                _cache[5] || (_cache[5] = createTextVNode(
                  "匹配值 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: matcherOptionString(o.matcher?.options),
                  "onUpdate:value": ($event) => emitMatcherOptions(i, o.matcher?.id ?? "byName", String($event ?? ""))
                }, null, 8, ["value", "onUpdate:value"])
              ])),
              createElementVNode("div", _hoisted_5$A, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(o.properties ?? [], (prop, pi) => {
                    return openBlock(), createElementBlock("div", {
                      key: keyOf(prop),
                      class: "override-prop-row",
                      "data-testid": `override-prop-${pi}`,
                      "data-prop-id": prop.id,
                      "data-prop-editor": propEditorKind(prop.id)
                    }, [
                      createVNode(unref(GSelect), {
                        value: prop.id,
                        options: propOptions.value,
                        "show-search": true,
                        onChange: ($event) => emit("set-prop-id", i, Number(pi), String($event))
                      }, null, 8, ["value", "options", "onChange"]),
                      propEditorKind(prop.id) === "unit" ? (openBlock(), createBlock(unref(UnitPicker), {
                        key: 0,
                        "data-testid": "override-unit",
                        "model-value": String(prop.value ?? ""),
                        "onUpdate:modelValue": ($event) => emitTyped(i, Number(pi), $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : propEditorKind(prop.id) === "fieldColor" ? (openBlock(), createBlock(unref(FieldColorEditor), {
                        key: 1,
                        "data-testid": "override-color",
                        "model-value": prop.value,
                        "onUpdate:modelValue": ($event) => emitTyped(i, Number(pi), $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : propEditorKind(prop.id) === "thresholds" ? (openBlock(), createBlock(unref(ThresholdsEditor), {
                        key: 2,
                        "data-testid": "override-thresholds",
                        "model-value": prop.value,
                        "onUpdate:modelValue": ($event) => emitTyped(i, Number(pi), $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : propEditorKind(prop.id) === "mappings" ? (openBlock(), createBlock(unref(ValueMappingsEditor), {
                        key: 3,
                        "data-testid": "override-mappings",
                        "model-value": prop.value,
                        "onUpdate:modelValue": ($event) => emitTyped(i, Number(pi), $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : propEditorKind(prop.id) === "links" ? (openBlock(), createBlock(unref(DataLinksEditor), {
                        key: 4,
                        "data-testid": "override-links",
                        "model-value": prop.value ?? [],
                        "onUpdate:modelValue": ($event) => emitTyped(i, Number(pi), $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : propEditorKind(prop.id) === "boolean" ? (openBlock(), createBlock(unref(GSwitch), {
                        key: 5,
                        "data-testid": "override-boolean",
                        checked: Boolean(prop.value),
                        "onUpdate:checked": ($event) => emitTyped(i, Number(pi), $event)
                      }, null, 8, ["checked", "onUpdate:checked"])) : propEditorKind(prop.id) === "number" ? (openBlock(), createBlock(unref(GInput), {
                        key: 6,
                        "data-testid": "override-number",
                        type: "number",
                        value: prop.value == null ? "" : String(prop.value),
                        "onUpdate:value": ($event) => emitTyped(i, Number(pi), $event === "" ? void 0 : Number($event))
                      }, null, 8, ["value", "onUpdate:value"])) : (openBlock(), createBlock(unref(GInput), {
                        key: 7,
                        "data-testid": "override-text",
                        value: prop.value == null ? "" : typeof prop.value === "object" ? JSON.stringify(prop.value) : String(prop.value),
                        "onUpdate:value": ($event) => emit("set-prop-value", i, Number(pi), String($event ?? ""))
                      }, null, 8, ["value", "onUpdate:value"])),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "destructive",
                        onClick: ($event) => emit("remove-prop", i, Number(pi))
                      }, {
                        default: withCtx(() => [..._cache[6] || (_cache[6] = [
                          createTextVNode(
                            " × ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["onClick"])
                    ], 8, _hoisted_6$w);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                )),
                createVNode(unref(GButton), {
                  size: "md",
                  "test-id": "add-override-prop",
                  onClick: ($event) => emit("add-prop", i)
                }, {
                  default: withCtx(() => [..._cache[7] || (_cache[7] = [
                    createTextVNode(
                      "+ 属性",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["onClick"])
              ])
            ], 8, _hoisted_2$11);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const FieldOverridesEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1k, [["__scopeId", "data-v-e7e2c27d"]]);
const commonMatchers = [
  {
    path: "include",
    label: "包含",
    type: "string",
    description: "正则或名称"
  },
  {
    path: "include.names",
    label: "包含名称（每行）",
    type: "string[]"
  },
  { path: "include.pattern", label: "包含正则", type: "string" },
  { path: "exclude", label: "排除", type: "string" },
  {
    path: "exclude.names",
    label: "排除名称（每行）",
    type: "string[]"
  },
  { path: "exclude.pattern", label: "排除正则", type: "string" }
];
const reducerOpts = [
  { label: "最后非空", value: "lastNotNull" },
  { label: "最后", value: "last" },
  { label: "第一个非空", value: "firstNotNull" },
  { label: "第一个", value: "first" },
  { label: "平均", value: "mean" },
  { label: "合计", value: "sum" },
  { label: "最小", value: "min" },
  { label: "最大", value: "max" },
  { label: "计数", value: "count" },
  { label: "方差", value: "variance" },
  { label: "标准差", value: "stdDev" }
];
const transformerRegistry = [
  {
    id: "limit",
    image: "limit",
    name: "限制",
    description: "限制行数",
    defaultOptions: { limitField: 10 },
    fields: [{ path: "limitField", label: "行数", type: "number" }],
    dedicatedEditor: true,
    categories: ["filter"],
    tags: ["限制", "行数"]
  },
  {
    id: "sortBy",
    image: "sortBy",
    name: "排序",
    description: "按字段排序",
    defaultOptions: { sort: [{ field: "", desc: false }] },
    fields: [
      { path: "sort.0.field", label: "字段", type: "string" },
      { path: "sort.0.desc", label: "降序", type: "boolean" }
    ],
    dedicatedEditor: true,
    categories: ["reorderAndRename"],
    tags: ["排序", "sort"]
  },
  {
    id: "filterFieldsByName",
    name: "按名称过滤字段",
    description: "include/exclude 字段",
    defaultOptions: {},
    fields: commonMatchers,
    dedicatedEditor: true,
    categories: ["filter"],
    tags: ["字段", "过滤", "名称"]
  },
  {
    id: "filterByName",
    name: "按名称过滤字段(别名)",
    description: "内部别名",
    defaultOptions: {},
    fields: commonMatchers,
    hidden: true,
    aliasOf: "filterFieldsByName"
  },
  {
    id: "filterByRefId",
    image: "filterByRefId",
    name: "按查询过滤",
    description: "按 refId",
    defaultOptions: { include: ".*" },
    fields: [
      { path: "include", label: "包含 refId", type: "string" },
      { path: "exclude", label: "排除 refId", type: "string" }
    ],
    dedicatedEditor: true
  },
  {
    id: "organize",
    image: "organize",
    name: "组织字段",
    description: "排除/重命名/排序",
    defaultOptions: {
      excludeByName: {},
      includeByName: {},
      renameByName: {},
      indexByName: {}
    },
    fields: [
      { path: "renameByName", label: "重命名映射（name=显示名）", type: "map" },
      { path: "excludeByName", label: "排除字段（name=true）", type: "map" },
      { path: "includeByName", label: "包含字段（name=true）", type: "map" },
      { path: "indexByName", label: "顺序映射（name=index）", type: "map" }
    ],
    dedicatedEditor: true,
    categories: ["reorderAndRename"],
    tags: ["整理", "列", "排序", "rename", "organize"]
  },
  {
    id: "reduce",
    name: "归约",
    description: "计算 reducer",
    defaultOptions: { reducers: ["lastNotNull"], mode: "seriesToRows" },
    fields: [
      {
        path: "reducers",
        label: "计算方式",
        type: "multi-select",
        options: reducerOpts
      },
      {
        path: "mode",
        label: "模式",
        type: "select",
        options: [
          { label: "序列到行", value: "seriesToRows" },
          { label: "归约字段", value: "reduceFields" }
        ]
      },
      {
        path: "labelsToFields",
        label: "标签转字段",
        type: "boolean"
      },
      {
        path: "includeTimeField",
        label: "包含时间字段",
        type: "boolean"
      }
    ],
    categories: ["calculateNewFields"],
    tags: ["归约", "reduce"],
    dedicatedEditor: true
  },
  {
    id: "groupBy",
    image: "groupBy",
    name: "分组",
    description: "分组聚合",
    defaultOptions: { fields: {} },
    fields: [{ path: "fields", label: "字段操作（name=op）", type: "map" }],
    dedicatedEditor: true,
    categories: ["combine"],
    tags: ["分组", "聚合", "group"]
  },
  {
    id: "joinByField",
    image: "joinByField",
    name: "按字段连接",
    description: "join frames",
    defaultOptions: { byField: "Time", mode: "outer" },
    fields: [
      { path: "byField", label: "连接字段", type: "string" },
      {
        path: "mode",
        label: "模式",
        type: "select",
        options: [
          { label: "outer", value: "outer" },
          { label: "inner", value: "inner" },
          { label: "outerTabular", value: "outerTabular" }
        ]
      }
    ],
    categories: ["combine"],
    tags: ["连接", "join"],
    dedicatedEditor: true
  },
  {
    id: "seriesToColumns",
    name: "序列转列",
    description: "joinByField 别名",
    defaultOptions: {},
    fields: [],
    aliasOf: "joinByField"
  },
  {
    id: "seriesToRows",
    name: "序列转行",
    description: "Time/Metric/Value",
    defaultOptions: {},
    fields: [],
    dedicatedEditor: true,
    categories: ["reformat"],
    tags: ["行"]
  },
  {
    id: "labelsToFields",
    image: "labelsToFields",
    name: "标签转字段",
    description: "labels → fields",
    defaultOptions: { mode: "columns" },
    fields: [
      {
        path: "mode",
        label: "模式",
        type: "select",
        options: [
          { label: "columns", value: "columns" },
          { label: "rows", value: "rows" }
        ]
      },
      { path: "keepLabels", label: "保留标签（每行）", type: "string[]" }
    ],
    categories: ["reformat"],
    tags: ["标签"],
    dedicatedEditor: true
  },
  {
    id: "renameByRegex",
    name: "正则重命名",
    description: "regex rename",
    defaultOptions: { regex: "(.*)", renamePattern: "$1" },
    fields: [
      { path: "regex", label: "正则", type: "string" },
      { path: "renamePattern", label: "替换", type: "string" }
    ],
    dedicatedEditor: true,
    categories: ["reorderAndRename"],
    tags: ["重命名", "regex"]
  },
  {
    id: "calculateField",
    image: "calculateField",
    name: "计算字段",
    description: "binary/reduce/index/unary",
    defaultOptions: { mode: "binary", alias: "计算" },
    fields: [
      {
        path: "mode",
        label: "模式",
        type: "select",
        options: [
          { label: "binary", value: "binary" },
          { label: "reduceRow", value: "reduceRow" },
          { label: "index", value: "index" },
          { label: "unary", value: "unary" }
        ]
      },
      { path: "alias", label: "别名", type: "string" },
      { path: "binary.left", label: "左操作数", type: "string" },
      { path: "binary.operator", label: "运算符", type: "string" },
      { path: "binary.right", label: "右操作数", type: "string" },
      { path: "index.asPercentile", label: "索引为百分位", type: "boolean" },
      { path: "replaceFields", label: "替换字段", type: "boolean" }
    ],
    categories: ["calculateNewFields"],
    tags: ["计算", "字段", "calculate"],
    dedicatedEditor: true
  },
  {
    id: "histogram",
    name: "直方图",
    description: "value buckets",
    defaultOptions: { bucketCount: 10 },
    fields: [
      { path: "bucketCount", label: "桶数", type: "number" },
      { path: "bucketSize", label: "桶大小", type: "number" },
      { path: "bucketOffset", label: "偏移", type: "number" },
      { path: "combine", label: "合并序列", type: "boolean" }
    ],
    dedicatedEditor: true,
    categories: ["createNewVisualization"],
    tags: ["直方"]
  },
  {
    id: "heatmap",
    image: "heatmap",
    name: "热力图",
    description: "x/y buckets",
    defaultOptions: { xBuckets: { value: 10 }, yBuckets: { value: 8 } },
    fields: [
      { path: "xBuckets.value", label: "X 桶", type: "number" },
      { path: "yBuckets.value", label: "Y 桶", type: "number" }
    ],
    dedicatedEditor: true,
    categories: ["createNewVisualization"],
    tags: ["热力"]
  },
  {
    id: "spatial",
    image: "spatial",
    name: "空间",
    description: "距离/坐标",
    defaultOptions: {
      action: "prepare",
      source: {},
      calculate: { calc: "heading" }
    },
    fields: [
      {
        path: "action",
        label: "动作",
        type: "select",
        options: [
          { label: "prepare", value: "prepare" },
          { label: "calculate", value: "calculate" }
        ]
      },
      {
        path: "calculate.calc",
        label: "计算",
        type: "select",
        options: [
          { label: "heading", value: "heading" },
          { label: "distance", value: "distance" },
          { label: "area", value: "area" }
        ]
      },
      { path: "source.latField", label: "纬度字段", type: "string" },
      { path: "source.lngField", label: "经度字段", type: "string" }
    ],
    categories: ["performSpatialOperations"],
    tags: ["空间", "geo"],
    dedicatedEditor: true
  },
  {
    id: "timeSeriesTable",
    name: "时间序列表格",
    description: "Metric/Trend 表",
    defaultOptions: {},
    fields: [{ path: "refIdToStat", label: "refId→stat 映射", type: "map" }],
    dedicatedEditor: true
  },
  {
    id: "merge",
    name: "合并",
    description: "merge frames",
    defaultOptions: {},
    fields: [],
    dedicatedEditor: true,
    categories: ["combine"],
    tags: ["合并"]
  },
  {
    id: "concatenate",
    image: "concatenate",
    name: "串接",
    description: "concat fields",
    defaultOptions: { frameNameMode: "label" },
    fields: [
      {
        path: "frameNameMode",
        label: "帧名模式",
        type: "select",
        options: [
          { label: "label", value: "label" },
          { label: "drop", value: "drop" }
        ]
      },
      { path: "frameNameLabel", label: "帧名标签", type: "string" }
    ],
    categories: ["combine"],
    tags: ["拼接"],
    dedicatedEditor: true
  },
  {
    id: "noop",
    name: "空操作",
    description: "no-op",
    defaultOptions: {},
    fields: [],
    hidden: true
  },
  {
    id: "prepareTimeSeries",
    name: "准备时间序列",
    description: "wide/long/multi",
    defaultOptions: { format: "multi" },
    fields: [
      {
        path: "format",
        label: "格式",
        type: "select",
        options: [
          { label: "multi", value: "multi" },
          { label: "wide", value: "wide" },
          { label: "long", value: "long" }
        ]
      }
    ],
    categories: ["reformat"],
    tags: ["时序"],
    dedicatedEditor: true
  },
  {
    id: "convertFieldType",
    image: "convertFieldType",
    name: "转换字段类型",
    description: "type cast",
    defaultOptions: { conversions: [] },
    fields: [
      { path: "conversions.0.targetField", label: "目标字段", type: "string" },
      {
        path: "conversions.0.destinationType",
        label: "目标类型",
        type: "select",
        options: [
          { label: "number", value: "number" },
          { label: "string", value: "string" },
          { label: "time", value: "time" },
          { label: "boolean", value: "boolean" },
          { label: "enum", value: "enum" },
          { label: "other", value: "other" }
        ]
      }
    ],
    categories: ["reformat"],
    tags: ["类型", "转换"],
    dedicatedEditor: true
  },
  {
    id: "formatTime",
    image: "formatTime",
    name: "格式化时间",
    description: "time → string",
    defaultOptions: {
      outputFormat: "YYYY-MM-DD HH:mm:ss",
      timezone: "browser",
      useTimezone: true
    },
    fields: [
      { path: "timeField", label: "时间字段", type: "string" },
      { path: "outputFormat", label: "输出格式", type: "string" },
      { path: "timezone", label: "时区", type: "string" },
      { path: "useTimezone", label: "使用时区", type: "boolean" }
    ],
    dedicatedEditor: true
  },
  {
    id: "formatString",
    name: "格式化字符串",
    description: "string ops",
    // Grafana paths: stringField + outputFormat (+ substringStart/End).
    // Keep legacy `substring` select values as accepted aliases in impl.
    defaultOptions: { outputFormat: "Upper Case" },
    fields: [
      { path: "stringField", label: "字符串字段", type: "string" },
      {
        path: "outputFormat",
        label: "输出格式",
        type: "select",
        options: [
          { label: "大写", value: "Upper Case" },
          { label: "小写", value: "Lower Case" },
          { label: "句首大写", value: "Sentence Case" },
          { label: "标题大小写", value: "Title Case" },
          { label: "PascalCase", value: "Pascal Case" },
          { label: "camelCase", value: "Camel Case" },
          { label: "snake_case", value: "Snake Case" },
          { label: "kebab-case", value: "Kebab Case" },
          { label: "Trim", value: "Trim" },
          { label: "Substring", value: "Substring" }
        ]
      },
      { path: "substringStart", label: "子串起点", type: "number" },
      { path: "substringEnd", label: "子串终点", type: "number" },
      { path: "alias", label: "别名", type: "string" }
    ],
    dedicatedEditor: true
  },
  {
    id: "filterByValue",
    image: "filterByValue",
    name: "按值过滤",
    description: "row filter",
    defaultOptions: { type: "include", match: "any", filters: [] },
    fields: [
      {
        path: "type",
        label: "类型",
        type: "select",
        options: [
          { label: "include", value: "include" },
          { label: "exclude", value: "exclude" }
        ]
      },
      {
        path: "match",
        label: "匹配",
        type: "select",
        options: [
          { label: "any", value: "any" },
          { label: "all", value: "all" }
        ]
      },
      { path: "filters.0.fieldName", label: "字段", type: "string" },
      {
        path: "filters.0.config.id",
        label: "比较",
        type: "select",
        options: [
          { label: "equal", value: "equal" },
          { label: "notEqual", value: "notEqual" },
          { label: "greater", value: "greater" },
          { label: "lower", value: "lower" },
          { label: "regex", value: "regex" },
          { label: "isNull", value: "isNull" },
          { label: "isNotNull", value: "isNotNull" }
        ]
      },
      { path: "filters.0.config.options.value", label: "值", type: "string" }
    ],
    categories: ["filter"],
    tags: ["值", "过滤", "filter"],
    dedicatedEditor: true
  },
  {
    id: "partitionByValues",
    image: "partitionByValues",
    name: "按值分区",
    description: "split frames",
    defaultOptions: { fields: [], keepFields: false },
    fields: [
      { path: "fields", label: "字段（每行）", type: "string[]" },
      { path: "keepFields", label: "保留字段", type: "boolean" }
    ],
    dedicatedEditor: true,
    categories: ["reformat"],
    tags: ["分区", "partition"]
  },
  {
    id: "groupToNestedTable",
    name: "分组嵌套表",
    description: "nested table",
    defaultOptions: {
      fields: {},
      showSubframeHeaders: true,
      expandAllRows: false
    },
    fields: [
      { path: "fields", label: "字段操作（name=op）", type: "map" },
      { path: "rules", label: "匹配规则（V2）", type: "string[]" },
      { path: "showSubframeHeaders", label: "显示子表头", type: "boolean" },
      { path: "expandAllRows", label: "默认展开全部", type: "boolean" }
    ],
    dedicatedEditor: true,
    categories: ["createNewVisualization"],
    tags: ["嵌套", "表格"]
  },
  {
    id: "groupingToMatrix",
    name: "分组矩阵",
    description: "matrix",
    defaultOptions: { emptyValue: "empty" },
    fields: [
      { path: "columnField", label: "列字段", type: "string" },
      { path: "rowField", label: "行字段", type: "string" },
      { path: "valueField", label: "值字段", type: "string" },
      {
        path: "emptyValue",
        label: "空值填充",
        type: "select",
        options: [
          { label: "空字符串", value: "empty" },
          { label: "null", value: "null" },
          { label: "0", value: "zero" },
          { label: "true", value: "true" },
          { label: "false", value: "false" }
        ]
      }
    ],
    dedicatedEditor: true,
    categories: ["createNewVisualization"],
    tags: ["矩阵", "分组"]
  },
  {
    id: "extractFields",
    image: "extractFields",
    name: "提取字段",
    description: "json/regex extract",
    defaultOptions: { format: "auto", replace: true, delimiter: "," },
    fields: [
      { path: "source", label: "源字段", type: "string" },
      {
        path: "format",
        label: "格式",
        type: "select",
        options: [
          { label: "auto", value: "auto" },
          { label: "json", value: "json" },
          { label: "kvp", value: "kvp" },
          { label: "regexp", value: "regexp" }
        ]
      },
      { path: "jsonPaths", label: "JSON 路径列表 [{path,alias}]", type: "map" },
      { path: "regExp", label: "正则", type: "string" },
      { path: "delimiter", label: "KVP 分隔符", type: "string" },
      { path: "replace", label: "替换", type: "boolean" },
      { path: "keepTime", label: "保留时间", type: "boolean" }
    ],
    categories: ["reformat"],
    tags: ["提取", "json", "regexp"],
    dedicatedEditor: true
  },
  {
    id: "joinByLabels",
    name: "按标签连接",
    description: "join labels",
    defaultOptions: {},
    fields: [
      { path: "value", label: "值字段", type: "string" },
      { path: "join", label: "连接标签（每行）", type: "string[]" }
    ],
    dedicatedEditor: true,
    categories: ["combine"],
    tags: ["标签", "join"]
  },
  {
    id: "rowsToFields",
    name: "行转字段",
    description: "rows → fields",
    defaultOptions: { mappings: [] },
    fields: [
      { path: "nameField", label: "名称字段", type: "string" },
      { path: "valueField", label: "值字段", type: "string" },
      { path: "mappings", label: "映射列表", type: "string[]" }
    ],
    dedicatedEditor: true,
    categories: ["reformat"],
    tags: ["字段"]
  },
  {
    id: "configFromData",
    image: "configFromData",
    name: "从数据配置",
    description: "config frame",
    defaultOptions: { configRefId: "config", mappings: [] },
    fields: [
      { path: "configRefId", label: "配置 refId", type: "string" },
      {
        path: "applyTo",
        label: "应用到",
        type: "select",
        options: [
          { label: "all fields", value: "field" },
          { label: "frame", value: "frame" }
        ]
      },
      { path: "mappings", label: "映射列表", type: "string[]" }
    ],
    dedicatedEditor: true
  },
  {
    id: "fieldLookup",
    image: "fieldLookup",
    name: "字段查找",
    description: "gazetteer lookup",
    defaultOptions: {},
    fields: [
      { path: "lookupField", label: "查找字段", type: "string" },
      { path: "gazetteer", label: "地名表", type: "string" }
    ],
    dedicatedEditor: true
  },
  {
    id: "convertFrameType",
    name: "转换 Frame 类型",
    description: "frame type",
    defaultOptions: {},
    fields: [
      {
        path: "targetType",
        label: "目标类型",
        type: "select",
        options: [
          { label: "timeseries-multi", value: "timeseries-multi" },
          { label: "timeseries-wide", value: "timeseries-wide" },
          { label: "timeseries-long", value: "timeseries-long" }
        ]
      }
    ],
    dedicatedEditor: true
  },
  {
    id: "order",
    name: "字段排序",
    description: "order fields",
    defaultOptions: { indexByName: {}, orderByMode: "manual" },
    fields: [
      { path: "indexByName", label: "字段顺序（name=index）", type: "map" },
      { path: "orderByMode", label: "排序模式", type: "string" },
      { path: "orderBy", label: "自动排序规则", type: "string[]" }
    ],
    hidden: true
  },
  {
    id: "rename",
    name: "重命名",
    description: "rename fields",
    defaultOptions: { renameByName: {} },
    fields: [{ path: "renameByName", label: "重命名映射（name=显示名）", type: "map" }],
    hidden: true
  },
  {
    id: "append",
    name: "追加",
    description: "append frames",
    defaultOptions: {},
    fields: [],
    hidden: true
  },
  {
    id: "filterFields",
    name: "过滤字段",
    description: "matcher filter fields",
    defaultOptions: {},
    fields: [{ path: "include.names", label: "包含名称（每行）", type: "string[]" }],
    hidden: true
  },
  {
    id: "filterFrames",
    name: "过滤 Frame",
    description: "matcher filter frames",
    defaultOptions: {},
    fields: [{ path: "include.pattern", label: "包含模式", type: "string" }],
    hidden: true
  },
  {
    id: "ensureColumns",
    name: "确保列式",
    description: "wide normalize",
    defaultOptions: {},
    fields: [],
    dedicatedEditor: true
  },
  {
    id: "regression",
    image: "regression",
    name: "回归",
    description: "linear/polynomial regression",
    defaultOptions: { modelType: "linear", predictionCount: 0 },
    fields: [
      {
        path: "modelType",
        label: "模型",
        type: "select",
        options: [
          { label: "linear", value: "linear" },
          { label: "polynomial", value: "polynomial" }
        ]
      },
      { path: "xFieldName", label: "X 字段", type: "string" },
      { path: "yFieldName", label: "Y 字段", type: "string" },
      { path: "predictionCount", label: "预测点数", type: "number" }
    ],
    dedicatedEditor: true
  },
  {
    id: "smoothing",
    image: "smoothing",
    name: "平滑",
    description: "moving average",
    defaultOptions: { windowSize: 3 },
    fields: [
      { path: "windowSize", label: "窗口", type: "number" },
      { path: "field", label: "字段", type: "string" }
    ],
    dedicatedEditor: true
  },
  {
    id: "transpose",
    image: "transpose",
    name: "转置",
    description: "transpose",
    defaultOptions: {
      firstFieldName: "Field",
      restFieldsName: "Value",
      emptyValue: "empty"
    },
    fields: [
      { path: "firstFieldName", label: "首列名称", type: "string" },
      { path: "restFieldsName", label: "其余列名称", type: "string" },
      {
        path: "emptyValue",
        label: "空值填充",
        type: "select",
        options: [
          { label: "空字符串", value: "empty" },
          { label: "null", value: "null" },
          { label: "0", value: "zero" },
          { label: "true", value: "true" },
          { label: "false", value: "false" }
        ]
      }
    ],
    dedicatedEditor: true
  }
];
function getTransformerMeta(id) {
  return transformerRegistry.find((t2) => t2.id === id);
}
const TRANSFORMER_CATEGORY_LABELS = {
  all: "查看全部",
  combine: "组合",
  calculateNewFields: "计算新字段",
  createNewVisualization: "生成新可视化",
  filter: "过滤",
  performSpatialOperations: "空间操作",
  reformat: "重整格式",
  reorderAndRename: "重排与重命名"
};
function filterTransformers(opts) {
  const q = (opts.query || "").trim().toLowerCase();
  const cat = opts.category || "all";
  return transformerRegistry.filter((t2) => {
    if (!opts.includeHidden && (t2.hidden || t2.aliasOf)) return false;
    if (cat !== "all" && !(t2.categories || []).includes(cat)) return false;
    if (!q) return true;
    const hay = [t2.id, t2.name, t2.description, ...t2.tags || []].join(" ").toLowerCase();
    return hay.includes(q);
  });
}
const _hoisted_1$1f = {
  class: "registry-fields",
  "data-testid": "transform-registry-fields",
  "data-editor-mode": "registry"
};
const _hoisted_2$10 = {
  key: 0,
  class: "no-opts",
  "data-testid": "transform-no-options"
};
const _hoisted_3$R = ["data-field-path", "data-field-type"];
const _hoisted_4$G = {
  key: 0,
  class: "desc"
};
const _hoisted_5$z = ["value", "onChange"];
const _hoisted_6$v = ["value", "onChange"];
const _sfc_main$1j = /* @__PURE__ */ defineComponent({
  __name: "RegistryFieldsEditor",
  props: {
    fields: {},
    options: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function optionVal(path) {
      const parts = path.split(".");
      let cur = props.options ?? {};
      for (const p of parts) {
        if (cur == null) return void 0;
        cur = cur[p];
      }
      return cur;
    }
    function mapToLines(v) {
      if (!v || typeof v !== "object" || Array.isArray(v)) return "";
      return Object.entries(v).map(([k, val]) => `${k}=${val}`).join("\n");
    }
    function linesToMap(raw) {
      const out = {};
      for (const line of raw.split("\n")) {
        const s = line.trim();
        if (!s) continue;
        const eq = s.indexOf("=");
        if (eq < 0) out[s] = "";
        else out[s.slice(0, eq).trim()] = s.slice(eq + 1).trim();
      }
      return out;
    }
    function listToLines(v) {
      if (Array.isArray(v)) return v.map(String).join("\n");
      if (typeof v === "string") return v;
      return "";
    }
    function linesToList(raw) {
      return raw.split("\n").map((s) => s.trim()).filter(Boolean);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1f, [
        !__props.fields.length ? (openBlock(), createElementBlock("p", _hoisted_2$10, " 此转换无需额外选项 ")) : createCommentVNode("v-if", true),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.fields, (f) => {
            return openBlock(), createElementBlock("label", {
              key: f.path,
              "data-field-path": f.path,
              "data-field-type": f.type
            }, [
              createTextVNode(
                toDisplayString(f.label) + " ",
                1
                /* TEXT */
              ),
              f.description ? (openBlock(), createElementBlock(
                "small",
                _hoisted_4$G,
                toDisplayString(f.description),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true),
              f.type === "boolean" ? (openBlock(), createBlock(unref(GSwitch), {
                key: 1,
                checked: Boolean(optionVal(f.path)),
                "onUpdate:checked": ($event) => emit("change", f.path, $event)
              }, null, 8, ["checked", "onUpdate:checked"])) : f.type === "select" ? (openBlock(), createBlock(unref(GSelect), {
                key: 2,
                value: optionVal(f.path),
                options: f.options ?? [],
                onChange: ($event) => emit("change", f.path, $event)
              }, null, 8, ["value", "options", "onChange"])) : f.type === "multi-select" ? (openBlock(), createBlock(unref(GSelect), {
                key: 3,
                mode: "multiple",
                value: Array.isArray(optionVal(f.path)) ? optionVal(f.path) : optionVal(f.path) != null ? [optionVal(f.path)] : [],
                options: f.options ?? [],
                onChange: ($event) => emit("change", f.path, $event)
              }, null, 8, ["value", "options", "onChange"])) : f.type === "number" ? (openBlock(), createBlock(unref(GInput), {
                key: 4,
                type: "number",
                value: optionVal(f.path) == null ? "" : String(optionVal(f.path)),
                "onUpdate:value": ($event) => emit("change", f.path, $event === "" ? void 0 : Number($event))
              }, null, 8, ["value", "onUpdate:value"])) : f.type === "string[]" ? (openBlock(), createElementBlock("textarea", {
                key: 5,
                class: "map-lines",
                rows: "3",
                value: listToLines(optionVal(f.path)),
                onChange: ($event) => emit("change", f.path, linesToList($event.target.value))
              }, null, 40, _hoisted_5$z)) : f.type === "map" ? (openBlock(), createElementBlock("textarea", {
                key: 6,
                class: "map-lines",
                rows: "4",
                "data-testid": "transform-map-field",
                value: mapToLines(optionVal(f.path)),
                onChange: ($event) => emit("change", f.path, linesToMap($event.target.value))
              }, null, 40, _hoisted_6$v)) : (openBlock(), createBlock(unref(GInput), {
                key: 7,
                value: optionVal(f.path) == null ? "" : String(optionVal(f.path)),
                "onUpdate:value": ($event) => emit("change", f.path, $event)
              }, null, 8, ["value", "onUpdate:value"]))
            ], 8, _hoisted_3$R);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const RegistryFieldsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1j, [["__scopeId", "data-v-1429f852"]]);
const _hoisted_1$1e = {
  class: "organize-editor",
  "data-testid": "transform-editor-organize",
  "data-dedicated": "true"
};
const _hoisted_2$$ = { class: "ex" };
const _sfc_main$1i = /* @__PURE__ */ defineComponent({
  __name: "OrganizeFieldsEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const rows = ref([]);
    function syncFromOptions() {
      const rename = props.options?.renameByName || {};
      const exclude = props.options?.excludeByName || {};
      const index2 = props.options?.indexByName || {};
      const names = /* @__PURE__ */ new Set([...Object.keys(rename), ...Object.keys(exclude), ...Object.keys(index2)]);
      if (!names.size) names.add("");
      const list = [...names].map((n) => ({
        name: n,
        rename: rename[n] || "",
        exclude: !!exclude[n]
      }));
      list.sort((a, b) => (index2[a.name] ?? 999) - (index2[b.name] ?? 999));
      rows.value = list;
    }
    watch(() => props.options, syncFromOptions, { immediate: true, deep: true });
    function emitAll() {
      const renameByName = {};
      const excludeByName = {};
      const indexByName = {};
      rows.value.forEach((r, i) => {
        if (!r.name) return;
        if (r.rename) renameByName[r.name] = r.rename;
        if (r.exclude) excludeByName[r.name] = true;
        indexByName[r.name] = i;
      });
      emit("change", "renameByName", renameByName);
      emit("change", "excludeByName", excludeByName);
      emit("change", "indexByName", indexByName);
    }
    function addRow() {
      rows.value.push({ name: "", rename: "", exclude: false });
    }
    function removeRow(i) {
      rows.value.splice(i, 1);
      emitAll();
    }
    function move(i, dir) {
      const j = i + dir;
      if (j < 0 || j >= rows.value.length) return;
      const tmp = rows.value[i];
      rows.value[i] = rows.value[j];
      rows.value[j] = tmp;
      emitAll();
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1e, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (r, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row"
            }, [
              createVNode(unref(GInput), {
                value: r.name,
                placeholder: "字段名",
                "onUpdate:value": (v) => {
                  r.name = String(v);
                  emitAll();
                }
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GInput), {
                value: r.rename,
                placeholder: "重命名",
                "onUpdate:value": (v) => {
                  r.rename = String(v);
                  emitAll();
                }
              }, null, 8, ["value", "onUpdate:value"]),
              createElementVNode("label", _hoisted_2$$, [
                createVNode(unref(GSwitch), {
                  checked: r.exclude,
                  "onUpdate:checked": (v) => {
                    r.exclude = v;
                    emitAll();
                  }
                }, null, 8, ["checked", "onUpdate:checked"]),
                _cache[0] || (_cache[0] = createTextVNode(
                  " 隐藏",
                  -1
                  /* CACHED */
                ))
              ]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "toolbar",
                disabled: i === 0,
                onClick: ($event) => move(i, -1)
              }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    "↑",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["disabled", "onClick"]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "toolbar",
                disabled: i === rows.value.length - 1,
                onClick: ($event) => move(i, 1)
              }, {
                default: withCtx(() => [..._cache[2] || (_cache[2] = [
                  createTextVNode(
                    " ↓ ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["disabled", "onClick"]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "destructive",
                onClick: ($event) => removeRow(i)
              }, {
                default: withCtx(() => [..._cache[3] || (_cache[3] = [
                  createTextVNode(
                    " 删 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(unref(GButton), {
          size: "md",
          variant: "secondary",
          onClick: addRow
        }, {
          default: withCtx(() => [..._cache[4] || (_cache[4] = [
            createTextVNode(
              "添加字段",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const OrganizeFieldsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1i, [["__scopeId", "data-v-344766e9"]]);
const _hoisted_1$1d = {
  class: "fbv-editor",
  "data-testid": "transform-editor-filterByValue",
  "data-dedicated": "true"
};
const _hoisted_2$_ = { class: "row" };
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
  __name: "FilterByValueEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const typeOpts = [
      { label: "包含", value: "include" },
      { label: "排除", value: "exclude" }
    ];
    const matchOpts = [
      { label: "任一", value: "any" },
      { label: "全部", value: "all" }
    ];
    const cmpOpts = [
      { label: "等于", value: "equal" },
      { label: "不等于", value: "notEqual" },
      { label: "大于", value: "greater" },
      { label: "小于", value: "lower" },
      { label: "正则", value: "regex" },
      { label: "为空", value: "isNull" },
      { label: "非空", value: "isNotNull" }
    ];
    const filters = computed(() => {
      const f = props.options?.filters;
      return Array.isArray(f) ? f : [];
    });
    function setType(v) {
      emit("change", "type", v);
    }
    function setMatch(v) {
      emit("change", "match", v);
    }
    function updateFilter(i, patch) {
      const next = filters.value.map((x, idx) => idx === i ? { ...x, ...patch } : { ...x });
      if (patch.config) {
        next[i] = {
          ...next[i],
          config: {
            ...filters.value[i]?.config || {},
            ...patch.config
          }
        };
      }
      emit("change", "filters", next);
    }
    function addFilter() {
      emit("change", "filters", [
        ...filters.value,
        { fieldName: "", config: { id: "equal", options: { value: "" } } }
      ]);
    }
    function removeFilter(i) {
      emit(
        "change",
        "filters",
        filters.value.filter((_, idx) => idx !== i)
      );
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1d, [
        createElementVNode("div", _hoisted_2$_, [
          createElementVNode("label", null, [
            _cache[0] || (_cache[0] = createTextVNode(
              "类型 ",
              -1
              /* CACHED */
            )),
            createVNode(unref(GSelect), {
              value: __props.options.type || "include",
              options: typeOpts,
              onChange: setType
            }, null, 8, ["value"])
          ]),
          createElementVNode("label", null, [
            _cache[1] || (_cache[1] = createTextVNode(
              "匹配 ",
              -1
              /* CACHED */
            )),
            createVNode(unref(GSelect), {
              value: __props.options.match || "any",
              options: matchOpts,
              onChange: setMatch
            }, null, 8, ["value"])
          ])
        ]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(filters.value, (f, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "filter"
            }, [
              createVNode(unref(GInput), {
                value: f.fieldName || "",
                placeholder: "字段",
                "onUpdate:value": (v) => updateFilter(i, { fieldName: String(v) })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GSelect), {
                value: f.config?.id || "equal",
                options: cmpOpts,
                onChange: (v) => updateFilter(i, {
                  config: { id: v, options: f.config?.options || {} }
                })
              }, null, 8, ["value", "onChange"]),
              createVNode(unref(GInput), {
                value: f.config?.options?.value ?? "",
                placeholder: "值",
                "onUpdate:value": (v) => updateFilter(i, {
                  config: { id: f.config?.id || "equal", options: { value: v } }
                })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "destructive",
                onClick: ($event) => removeFilter(i)
              }, {
                default: withCtx(() => [..._cache[2] || (_cache[2] = [
                  createTextVNode(
                    " 删 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(unref(GButton), {
          size: "md",
          variant: "secondary",
          onClick: addFilter
        }, {
          default: withCtx(() => [..._cache[3] || (_cache[3] = [
            createTextVNode(
              "添加条件",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const FilterByValueEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1h, [["__scopeId", "data-v-60fd5739"]]);
const _hoisted_1$1c = {
  class: "calc-editor",
  "data-testid": "transform-editor-calculateField",
  "data-dedicated": "true"
};
const _hoisted_2$Z = { class: "row" };
const _hoisted_3$Q = { key: 2 };
const _hoisted_4$F = { key: 4 };
const _hoisted_5$y = {
  key: 5,
  class: "hint"
};
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
  __name: "CalculateFieldEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const modes = [
      { label: "两字段运算", value: "binary" },
      { label: "一元运算", value: "unary" },
      { label: "行归约", value: "reduceRow" },
      { label: "累计", value: "cumulative" },
      { label: "窗口", value: "window" },
      { label: "行索引", value: "index" }
    ];
    const ops = [
      { label: "+", value: "+" },
      { label: "-", value: "-" },
      { label: "*", value: "*" },
      { label: "/", value: "/" }
    ];
    const unaryOps = [
      { label: "abs", value: "abs" },
      { label: "exp", value: "exp" },
      { label: "ln", value: "ln" },
      { label: "floor", value: "floor" },
      { label: "ceil", value: "ceil" }
    ];
    const mode2 = computed(() => String(props.options.mode || "binary"));
    const binary = computed(() => props.options.binary || {});
    const unary = computed(() => props.options.unary || {});
    function set(path, v) {
      emit("change", path, v);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1c, [
        createElementVNode("label", null, [
          _cache[12] || (_cache[12] = createTextVNode(
            "模式 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: mode2.value,
            options: modes,
            onChange: _cache[0] || (_cache[0] = (v) => set("mode", v))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", null, [
          _cache[13] || (_cache[13] = createTextVNode(
            "别名 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.options.alias ?? ""),
            "onUpdate:value": _cache[1] || (_cache[1] = (v) => set("alias", v))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_2$Z, [
          createVNode(unref(GSwitch), {
            checked: !!__props.options.replaceFields,
            "onUpdate:checked": _cache[2] || (_cache[2] = (v) => set("replaceFields", v))
          }, null, 8, ["checked"]),
          _cache[14] || (_cache[14] = createTextVNode(
            " 替换所有字段",
            -1
            /* CACHED */
          ))
        ]),
        mode2.value === "binary" ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("label", null, [
              _cache[15] || (_cache[15] = createTextVNode(
                "左 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                value: String(binary.value.left ?? ""),
                "onUpdate:value": _cache[3] || (_cache[3] = (v) => set("binary.left", v))
              }, null, 8, ["value"])
            ]),
            createElementVNode("label", null, [
              _cache[16] || (_cache[16] = createTextVNode(
                "运算符 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                value: String(binary.value.operator ?? "+"),
                options: ops,
                onChange: _cache[4] || (_cache[4] = (v) => set("binary.operator", v))
              }, null, 8, ["value"])
            ]),
            createElementVNode("label", null, [
              _cache[17] || (_cache[17] = createTextVNode(
                "右 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                value: String(binary.value.right ?? ""),
                "onUpdate:value": _cache[5] || (_cache[5] = (v) => set("binary.right", v))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : mode2.value === "unary" ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode("label", null, [
              _cache[18] || (_cache[18] = createTextVNode(
                "字段 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                value: String(unary.value.fieldName ?? ""),
                "onUpdate:value": _cache[6] || (_cache[6] = (v) => set("unary.fieldName", v))
              }, null, 8, ["value"])
            ]),
            createElementVNode("label", null, [
              _cache[19] || (_cache[19] = createTextVNode(
                "运算符 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                value: String(unary.value.operator ?? "abs"),
                options: unaryOps,
                onChange: _cache[7] || (_cache[7] = (v) => set("unary.operator", v))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : mode2.value === "reduceRow" ? (openBlock(), createElementBlock("label", _hoisted_3$Q, [
          _cache[20] || (_cache[20] = createTextVNode(
            "归约器 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.options.reduce?.reducer ?? "sum"),
            "onUpdate:value": _cache[8] || (_cache[8] = (v) => set("reduce.reducer", v))
          }, null, 8, ["value"])
        ])) : mode2.value === "cumulative" ? (openBlock(), createElementBlock(
          Fragment,
          { key: 3 },
          [
            createElementVNode("label", null, [
              _cache[21] || (_cache[21] = createTextVNode(
                "字段 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GInput), {
                value: String(__props.options.cumulative?.fieldName ?? ""),
                "onUpdate:value": _cache[9] || (_cache[9] = (v) => set("cumulative.fieldName", v))
              }, null, 8, ["value"])
            ]),
            createElementVNode("label", null, [
              _cache[22] || (_cache[22] = createTextVNode(
                "归约器 ",
                -1
                /* CACHED */
              )),
              createVNode(unref(GSelect), {
                value: String(__props.options.cumulative?.reducer ?? "sum"),
                options: [
                  { label: "sum", value: "sum" },
                  { label: "mean", value: "mean" },
                  { label: "max", value: "max" },
                  { label: "min", value: "min" }
                ],
                onChange: _cache[10] || (_cache[10] = (v) => set("cumulative.reducer", v))
              }, null, 8, ["value"])
            ])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : mode2.value === "window" ? (openBlock(), createElementBlock("label", _hoisted_4$F, [
          _cache[23] || (_cache[23] = createTextVNode(
            "窗口大小 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            type: "number",
            value: Number(__props.options.window?.windowSize ?? 10),
            "onUpdate:value": _cache[11] || (_cache[11] = (v) => set("window.windowSize", Number(v)))
          }, null, 8, ["value"])
        ])) : mode2.value === "index" ? (openBlock(), createElementBlock("p", _hoisted_5$y, "生成从 0 开始的行索引列")) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const CalculateFieldEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1g, [["__scopeId", "data-v-c5b63227"]]);
const _hoisted_1$1b = {
  class: "groupby-editor",
  "data-testid": "transform-editor-groupBy",
  "data-dedicated": "true"
};
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
  __name: "GroupByEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const calcOpts = [
      { label: "最后非空", value: "lastNotNull" },
      { label: "平均", value: "mean" },
      { label: "合计", value: "sum" },
      { label: "最小", value: "min" },
      { label: "最大", value: "max" },
      { label: "计数", value: "count" }
    ];
    const opOpts = [
      { label: "分组依据", value: "groupby" },
      { label: "计算", value: "aggregate" },
      { label: "忽略", value: "ignore" }
    ];
    const rows = ref([]);
    function sync() {
      const fields = props.options.fields || {};
      const keys = Object.keys(fields);
      rows.value = keys.length ? keys.map((n) => ({
        name: n,
        op: fields[n]?.operation || fields[n] || "ignore",
        calcs: Array.isArray(fields[n]?.aggregations) ? fields[n].aggregations : []
      })) : [{ name: "", op: "groupby", calcs: [] }];
    }
    watch(() => props.options, sync, { immediate: true, deep: true });
    function emitAll() {
      const fields = {};
      for (const r of rows.value) {
        if (!r.name) continue;
        if (r.op === "aggregate") fields[r.name] = { operation: "aggregate", aggregations: r.calcs };
        else fields[r.name] = { operation: r.op };
      }
      emit("change", "fields", fields);
    }
    function add() {
      rows.value.push({ name: "", op: "ignore", calcs: [] });
    }
    function remove(i) {
      rows.value.splice(i, 1);
      emitAll();
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1b, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (r, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row"
            }, [
              createVNode(unref(GInput), {
                value: r.name,
                placeholder: "字段名",
                "onUpdate:value": (v) => {
                  r.name = String(v);
                  emitAll();
                }
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GSelect), {
                value: r.op,
                options: opOpts,
                onChange: (v) => {
                  r.op = v;
                  emitAll();
                }
              }, null, 8, ["value", "onChange"]),
              r.op === "aggregate" ? (openBlock(), createBlock(unref(GSelect), {
                key: 0,
                mode: "multiple",
                value: r.calcs,
                options: calcOpts,
                onChange: (v) => {
                  r.calcs = (Array.isArray(v) ? v : [v]).map(String);
                  emitAll();
                }
              }, null, 8, ["value", "onChange"])) : createCommentVNode("v-if", true),
              createVNode(unref(GButton), {
                size: "md",
                variant: "destructive",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[0] || (_cache[0] = [
                  createTextVNode(
                    "删",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(unref(GButton), {
          size: "md",
          variant: "secondary",
          onClick: add
        }, {
          default: withCtx(() => [..._cache[1] || (_cache[1] = [
            createTextVNode(
              "添加字段",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const GroupByEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1f, [["__scopeId", "data-v-a874e325"]]);
const _hoisted_1$1a = {
  class: "join-editor",
  "data-testid": "transform-editor-joinByField",
  "data-dedicated": "true"
};
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
  __name: "JoinByFieldEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const modes = [
      { label: "outer", value: "outer" },
      { label: "outerTabular", value: "outerTabular" },
      { label: "inner", value: "inner" }
    ];
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1a, [
        createElementVNode("label", null, [
          _cache[2] || (_cache[2] = createTextVNode(
            "连接字段 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.options.byField ?? "Time"),
            "onUpdate:value": _cache[0] || (_cache[0] = (v) => emit("change", "byField", v))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", null, [
          _cache[3] || (_cache[3] = createTextVNode(
            "模式 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.options.mode ?? "outer"),
            options: modes,
            onChange: _cache[1] || (_cache[1] = (v) => emit("change", "mode", v))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const JoinByFieldEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1e, [["__scopeId", "data-v-a0fea3a6"]]);
const _hoisted_1$19 = {
  class: "extract-editor",
  "data-testid": "transform-editor-extractFields",
  "data-dedicated": "true"
};
const _hoisted_2$Y = { key: 0 };
const _hoisted_3$P = { class: "row" };
const _hoisted_4$E = { class: "row" };
const _sfc_main$1d = /* @__PURE__ */ defineComponent({
  __name: "ExtractFieldsEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const formats = [
      { label: "auto", value: "auto" },
      { label: "json", value: "json" },
      { label: "kvp", value: "kvp" },
      { label: "regexp", value: "regexp" }
    ];
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$19, [
        createElementVNode("label", null, [
          _cache[5] || (_cache[5] = createTextVNode(
            "源字段 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.options.source ?? ""),
            "onUpdate:value": _cache[0] || (_cache[0] = (v) => emit("change", "source", v))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", null, [
          _cache[6] || (_cache[6] = createTextVNode(
            "格式 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.options.format ?? "auto"),
            options: formats,
            onChange: _cache[1] || (_cache[1] = (v) => emit("change", "format", v))
          }, null, 8, ["value"])
        ]),
        String(__props.options.format) === "regexp" ? (openBlock(), createElementBlock("label", _hoisted_2$Y, [
          _cache[7] || (_cache[7] = createTextVNode(
            "正则 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.options.regExp ?? __props.options.regexp ?? ""),
            "onUpdate:value": _cache[2] || (_cache[2] = (v) => emit("change", "regExp", v))
          }, null, 8, ["value"])
        ])) : createCommentVNode("v-if", true),
        createElementVNode("label", _hoisted_3$P, [
          createVNode(unref(GSwitch), {
            checked: __props.options.replace !== false,
            "onUpdate:checked": _cache[3] || (_cache[3] = (v) => emit("change", "replace", v))
          }, null, 8, ["checked"]),
          _cache[8] || (_cache[8] = createTextVNode(
            " 替换",
            -1
            /* CACHED */
          ))
        ]),
        createElementVNode("label", _hoisted_4$E, [
          createVNode(unref(GSwitch), {
            checked: !!__props.options.keepTime,
            "onUpdate:checked": _cache[4] || (_cache[4] = (v) => emit("change", "keepTime", v))
          }, null, 8, ["checked"]),
          _cache[9] || (_cache[9] = createTextVNode(
            " 保留时间",
            -1
            /* CACHED */
          ))
        ])
      ]);
    };
  }
});
const ExtractFieldsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1d, [["__scopeId", "data-v-598f5846"]]);
const _hoisted_1$18 = {
  class: "cft-editor",
  "data-testid": "transform-editor-convertFieldType",
  "data-dedicated": "true"
};
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
  __name: "ConvertFieldTypeEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const typeOpts = [
      { label: "number", value: "number" },
      { label: "string", value: "string" },
      { label: "time", value: "time" },
      { label: "boolean", value: "boolean" },
      { label: "enum", value: "enum" },
      { label: "other", value: "other" }
    ];
    const rows = ref([]);
    function sync() {
      const c = props.options.conversions;
      rows.value = Array.isArray(c) && c.length ? c.map((x) => ({ ...x })) : [{ targetField: "", destinationType: "string" }];
    }
    watch(() => props.options, sync, { immediate: true, deep: true });
    function emitAll() {
      emit(
        "change",
        "conversions",
        rows.value.map((r) => ({ ...r }))
      );
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$18, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (r, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "row"
            }, [
              createVNode(unref(GInput), {
                value: r.targetField,
                placeholder: "字段",
                "onUpdate:value": (v) => {
                  r.targetField = String(v);
                  emitAll();
                }
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GSelect), {
                value: r.destinationType,
                options: typeOpts,
                onChange: (v) => {
                  r.destinationType = String(v);
                  emitAll();
                }
              }, null, 8, ["value", "onChange"]),
              r.destinationType === "time" ? (openBlock(), createBlock(unref(GInput), {
                key: 0,
                value: r.dateFormat || "",
                placeholder: "时间格式",
                "onUpdate:value": (v) => {
                  r.dateFormat = String(v);
                  emitAll();
                }
              }, null, 8, ["value", "onUpdate:value"])) : createCommentVNode("v-if", true),
              createVNode(unref(GButton), {
                size: "md",
                variant: "destructive",
                onClick: ($event) => {
                  rows.value.splice(i, 1);
                  emitAll();
                }
              }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    " 删 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(unref(GButton), {
          size: "md",
          onClick: _cache[0] || (_cache[0] = ($event) => rows.value.push({ targetField: "", destinationType: "string" }))
        }, {
          default: withCtx(() => [..._cache[2] || (_cache[2] = [
            createTextVNode(
              " 添加转换 ",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ConvertFieldTypeEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1c, [["__scopeId", "data-v-b5d92b01"]]);
const _hoisted_1$17 = {
  class: "part-editor",
  "data-testid": "transform-editor-partitionByValues",
  "data-dedicated": "true"
};
const _hoisted_2$X = { class: "row" };
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
  __name: "PartitionByValuesEditor",
  props: {
    options: {},
    fields: {},
    transformId: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const fieldsStr = computed(() => {
      const f = props.options.fields;
      return Array.isArray(f) ? f.join(", ") : String(f ?? "");
    });
    const naming = [
      { label: "asLabels", value: "asLabels" },
      { label: "frameName", value: "frameName" }
    ];
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$17, [
        createElementVNode("label", null, [
          _cache[3] || (_cache[3] = createTextVNode(
            "字段（逗号分隔） ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: fieldsStr.value,
            placeholder: "fieldA, fieldB",
            "onUpdate:value": _cache[0] || (_cache[0] = (v) => emit(
              "change",
              "fields",
              String(v).split(",").map((s) => s.trim()).filter(Boolean)
            ))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", null, [
          _cache[4] || (_cache[4] = createTextVNode(
            "命名方式 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.options.naming?.asLabels !== false ? "asLabels" : "frameName"),
            options: naming,
            onChange: _cache[1] || (_cache[1] = (v) => emit("change", "naming", { asLabels: v === "asLabels" }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_2$X, [
          createVNode(unref(GSwitch), {
            checked: !!__props.options.keepFields,
            "onUpdate:checked": _cache[2] || (_cache[2] = (v) => emit("change", "keepFields", v))
          }, null, 8, ["checked"]),
          _cache[5] || (_cache[5] = createTextVNode(
            " 保留字段 ",
            -1
            /* CACHED */
          ))
        ])
      ]);
    };
  }
});
const PartitionByValuesEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1b, [["__scopeId", "data-v-153c5e51"]]);
function makeDedicated(id) {
  return defineComponent({
    name: `TransformEditor_${id}`,
    props: {
      options: { type: Object, required: true },
      fields: { type: Array, required: true },
      transformId: { type: String, required: true }
    },
    emits: ["change"],
    setup(props, { emit }) {
      return () => h(
        "div",
        {
          "class": "dedicated-transform-editor",
          "data-testid": `transform-editor-${id}`,
          "data-dedicated": "true",
          "data-transform-id": id
        },
        [
          h(RegistryFieldsEditor, {
            fields: props.fields,
            options: props.options,
            onChange: (path, value) => emit("change", path, value)
          })
        ]
      );
    }
  });
}
const cache = /* @__PURE__ */ new Map();
const SPECIAL = {
  organize: OrganizeFieldsEditor,
  filterByValue: FilterByValueEditor,
  calculateField: CalculateFieldEditor,
  groupBy: GroupByEditor,
  joinByField: JoinByFieldEditor,
  extractFields: ExtractFieldsEditor,
  convertFieldType: ConvertFieldTypeEditor,
  partitionByValues: PartitionByValuesEditor
};
function loadTransformEditor(id) {
  const meta2 = getTransformerMeta(id);
  const resolved = meta2?.aliasOf || id;
  if (cache.has(resolved)) return cache.get(resolved);
  const comp = SPECIAL[resolved] || makeDedicated(resolved);
  cache.set(resolved, comp);
  cache.set(id, comp);
  return comp;
}
const __vite_glob_0_0 = "data:image/svg+xml,%3csvg%20width='101'%20height='48'%20viewBox='0%200%20101%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H31V0H1.29545C0.951872%200%200.62237%200.109659%200.379427%200.304853C0.136484%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162225)'/%3e%3cpath%20d='M31%2017H0V48H31V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M17%2029.5H15.0954L13%2030.7266V32.3984L14.9004%2031.3047H14.9502V37.5H17V29.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M66%200H35V13H66V0Z'%20fill='url(%23paint1_linear_1144_162225)'/%3e%3cpath%20d='M66%2017H35V48H66V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48.1164%2037.5H54V35.9624H50.7788V35.9123L51.7296%2035.0414C53.4528%2033.5501%2053.903%2032.7909%2053.903%2031.8854C53.903%2030.4634%2052.7348%2029.5%2050.9301%2029.5C49.1721%2029.5%2047.9961%2030.5058%2048%2032.1127H49.8202C49.8202%2031.3998%2050.2626%2030.9875%2050.9224%2030.9875C51.5705%2030.9875%2052.0401%2031.3844%2052.0401%2032.0356C52.0401%2032.6252%2051.6675%2033.026%2051.0155%2033.6079L48.1164%2036.1281V37.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M70%2013H101V1.04083C101%200.764787%20100.864%200.500047%20100.621%200.304853C100.378%200.109659%20100.048%200%2099.7046%200L70%200V13Z'%20fill='url(%23paint2_linear_1144_162225)'/%3e%3cpath%20d='M101%2017H70V48H101V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M78%2029H76.0954L74%2030.2266V31.8984L75.9004%2030.8047H75.9502V37H78V29Z'%20fill='%2324292E'/%3e%3cpath%20d='M90.1164%2037H96V35.4624H92.7788V35.4123L93.7296%2034.5414C95.4528%2033.0501%2095.903%2032.2909%2095.903%2031.3854C95.903%2029.9634%2094.7348%2029%2092.9301%2029C91.1721%2029%2089.9961%2030.0058%2090%2031.6127H91.8202C91.8202%2030.8998%2092.2626%2030.4875%2092.9224%2030.4875C93.5705%2030.4875%2094.0401%2030.8844%2094.0401%2031.5356C94.0401%2032.1252%2093.6675%2032.526%2093.0155%2033.1079L90.1164%2035.6281V37Z'%20fill='%2324292E'/%3e%3cpath%20d='M83.7432%2036H85.2568V34.2568H87V32.7432H85.2568V31H83.7432V32.7432H82V34.2568H83.7432V36Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162225'%20x1='0'%20y1='6.5052'%20x2='31'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162225'%20x1='35'%20y1='6.5052'%20x2='66.013'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162225'%20x1='70'%20y1='6.5052'%20x2='101'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_1 = "data:image/svg+xml,%3csvg%20width='158'%20height='48'%20viewBox='0%200%20158%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_161721)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200%200%200%200C0%200%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_161721)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M27.3343%2030H30.674V25.674H35V22.3343H30.674V18H27.3343V22.3343H23V25.674H27.3343V30Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1144_161721)'%3e%3cpath%20d='M58%2026.5H43V39.5H58V26.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M43%2010.0408V22H58V9H43.6268C43.4606%209%2043.3011%209.10966%2043.1836%209.30485C43.066%209.50005%2043%209.76479%2043%2010.0408Z'%20fill='url(%23paint1_linear_1144_161721)'/%3e%3cpath%20d='M51.5%2030H50.0716L48.5%2030.9199V32.1738L49.9253%2031.3535H49.9627V36H51.5V30Z'%20fill='white'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1144_161721)'%3e%3cpath%20d='M77%2026.5H62V39.5H77V26.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%2022H77V10.0408C77%209.76479%2076.934%209.50005%2076.8164%209.30485C76.6989%209.10966%2076.5394%209%2076.3732%209H62V22Z'%20fill='url(%23paint2_linear_1144_161721)'/%3e%3cpath%20d='M67.3373%2036H71.75V34.8468H69.3341V34.8092L70.0472%2034.1561C71.3396%2033.0376%2071.6772%2032.4682%2071.6772%2031.789C71.6772%2030.7225%2070.8011%2030%2069.4476%2030C68.129%2030%2067.2471%2030.7543%2067.25%2031.9595H68.6151C68.6151%2031.4249%2068.947%2031.1156%2069.4418%2031.1156C69.9279%2031.1156%2070.2801%2031.4133%2070.2801%2031.9017C70.2801%2032.3439%2070.0006%2032.6445%2069.5116%2033.0809L67.3373%2034.9711V36Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M85%2028.566H97V25.2034H85V28.566ZM85%2022.7966H97V19.434H85V22.7966Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip3_1144_161721)'%3e%3cpath%20d='M105%201.04083V13H120V0H105.627C105.461%200%20105.301%200.109659%20105.184%200.304853C105.066%200.500047%20105%200.764787%20105%201.04083Z'%20fill='url(%23paint3_linear_1144_161721)'/%3e%3cpath%20d='M120%2017.5H105V30.5H120V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M120%2035H105V48H120V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110.337%2044.5H114.75V43.3468H112.334V43.3092L113.047%2042.6561C114.34%2041.5376%20114.677%2040.9682%20114.677%2040.289C114.677%2039.2225%20113.801%2038.5%20112.448%2038.5C111.129%2038.5%20110.247%2039.2543%20110.25%2040.4595H111.615C111.615%2039.9249%20111.947%2039.6156%20112.442%2039.6156C112.928%2039.6156%20113.28%2039.9133%20113.28%2040.4017C113.28%2040.8439%20113.001%2041.1445%20112.512%2041.5809L110.337%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2021H112.072L110.5%2021.9199V23.1738L111.925%2022.3535H111.963V27H113.5V21Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1144_161721)'%3e%3cpath%20d='M139%2035H124V48H139V35Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M124.5%2035.5H138.5V47.5H124.5V35.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M124%201.04083V13H139V0H124.627C124.461%200%20124%200%20124%200C124%200%20124%200.764787%20124%201.04083Z'%20fill='url(%23paint4_linear_1144_161721)'/%3e%3cpath%20d='M139%2017.5H124V30.5H139V17.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M132.5%2021H131.072L129.5%2021.9199V23.1738L130.925%2022.3535H130.963V27H132.5V21Z'%20fill='white'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip5_1144_161721)'%3e%3cpath%20d='M158%2017.5H143V30.5H158V17.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M143%2013H158V1.04083C158%200.764787%20157.934%200.500047%20157.816%200.304853C157.699%200.109659%20157.539%200%20157.373%200L143%200V13Z'%20fill='url(%23paint5_linear_1144_161721)'/%3e%3cpath%20d='M148.337%2027H152.75V25.8468H150.334V25.8092L151.047%2025.1561C152.34%2024.0376%20152.677%2023.4682%20152.677%2022.789C152.677%2021.7225%20151.801%2021%20150.448%2021C149.129%2021%20148.247%2021.7543%20148.25%2022.9595H149.615C149.615%2022.4249%20149.947%2022.1156%20150.442%2022.1156C150.928%2022.1156%20151.28%2022.4133%20151.28%2022.9017C151.28%2023.3439%20151.001%2023.6445%20150.512%2024.0809L148.337%2025.9711V27Z'%20fill='white'/%3e%3cpath%20d='M158%2035H143V48H158V35Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M143.5%2035.5H157.5V47.5H143.5V35.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161721'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161721'%20x1='43'%20y1='15.5052'%20x2='58'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161721'%20x1='62'%20y1='15.5052'%20x2='77'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161721'%20x1='105'%20y1='6.5052'%20x2='120'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_161721'%20x1='124'%20y1='6.5052'%20x2='139'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1144_161721'%20x1='143'%20y1='6.5052'%20x2='158'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161721'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161721'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(43%209)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_161721'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%209)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_161721'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(105)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1144_161721'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(124)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip5_1144_161721'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(143)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_2 = "data:image/svg+xml,%3csvg%20width='129'%20height='50'%20viewBox='0%200%20129%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162522)'%3e%3cpath%20d='M0%202.04083V14H24V1H1.00293C0.736933%201%200%201%200%201C0%201%200%201.76479%200%202.04083Z'%20fill='url(%23paint0_linear_1144_162522)'/%3e%3cpath%20d='M24%2018.5H0V31.5H24V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2036H0V49H24V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M3%2027.3182H4.56818V24.7727C4.56818%2024.392%204.76705%2024.1591%205.09091%2024.1591C5.41477%2024.1591%205.625%2024.392%205.625%2024.7727V27.3182H7.125V24.7727C7.125%2024.392%207.32386%2024.1591%207.64773%2024.1591C7.97159%2024.1591%208.18182%2024.392%208.18182%2024.7727V27.3182H9.75V24.375C9.75%2023.4801%209.17614%2022.8977%208.34091%2022.8977C7.69318%2022.8977%207.17045%2023.25%207.02273%2023.7841H6.97727C6.88636%2023.25%206.39773%2022.8977%205.78409%2022.8977C5.17898%2022.8977%204.71591%2023.2386%204.53409%2023.7841H4.48864V22.9545H3V27.3182Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.5234%2028.9545H12.0916V26.6023H12.1143C12.2962%2027.0455%2012.7166%2027.375%2013.3303%2027.375C14.2621%2027.375%2015.0462%2026.6477%2015.0462%2025.1364C15.0462%2023.5568%2014.2053%2022.8977%2013.3416%2022.8977C12.6939%2022.8977%2012.2848%2023.2727%2012.1143%2023.7159H12.0803V22.9545H10.5234V28.9545ZM12.0575%2025.1364C12.0575%2024.4886%2012.3189%2024.1023%2012.7507%2024.1023C13.1825%2024.1023%2013.4325%2024.4886%2013.4325%2025.1364C13.4325%2025.7841%2013.1825%2026.1705%2012.7507%2026.1705C12.3189%2026.1705%2012.0575%2025.7727%2012.0575%2025.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M17.2713%2024.8636C17.2741%2024.4318%2017.5241%2024.1705%2017.9077%2024.1705C18.3082%2024.1705%2018.5355%2024.4318%2018.5327%2024.8636V27.3182H20.1009V24.5341C20.1037%2023.5795%2019.5014%2022.8977%2018.5781%2022.8977C17.9332%2022.8977%2017.456%2023.2273%2017.2599%2023.7841H17.2145V21.5H15.7031V27.3182H17.2713V24.8636Z'%20fill='%2324292E'/%3e%3cpath%20d='M3%2044.8182H4.56818V42.2727C4.56818%2041.892%204.76705%2041.6591%205.09091%2041.6591C5.41477%2041.6591%205.625%2041.892%205.625%2042.2727V44.8182H7.125V42.2727C7.125%2041.892%207.32386%2041.6591%207.64773%2041.6591C7.97159%2041.6591%208.18182%2041.892%208.18182%2042.2727V44.8182H9.75V41.875C9.75%2040.9801%209.17614%2040.3977%208.34091%2040.3977C7.69318%2040.3977%207.17045%2040.75%207.02273%2041.2841H6.97727C6.88636%2040.75%206.39773%2040.3977%205.78409%2040.3977C5.17898%2040.3977%204.71591%2040.7386%204.53409%2041.2841H4.48864V40.4545H3V44.8182Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.5234%2046.4545H12.0916V44.1023H12.1143C12.2962%2044.5455%2012.7166%2044.875%2013.3303%2044.875C14.2621%2044.875%2015.0462%2044.1477%2015.0462%2042.6364C15.0462%2041.0568%2014.2053%2040.3977%2013.3416%2040.3977C12.6939%2040.3977%2012.2848%2040.7727%2012.1143%2041.2159H12.0803V40.4545H10.5234V46.4545ZM12.0575%2042.6364C12.0575%2041.9886%2012.3189%2041.6023%2012.7507%2041.6023C13.1825%2041.6023%2013.4325%2041.9886%2013.4325%2042.6364C13.4325%2043.2841%2013.1825%2043.6705%2012.7507%2043.6705C12.3189%2043.6705%2012.0575%2043.2727%2012.0575%2042.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M17.2713%2042.3636C17.2741%2041.9318%2017.5241%2041.6705%2017.9077%2041.6705C18.3082%2041.6705%2018.5355%2041.9318%2018.5327%2042.3636V44.8182H20.1009V42.0341C20.1037%2041.0795%2019.5014%2040.3977%2018.5781%2040.3977C17.9332%2040.3977%2017.456%2040.7273%2017.2599%2041.2841H17.2145V39H15.7031V44.8182H17.2713V42.3636Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162522)'%3e%3cpath%20d='M28%202.04083V14H43V1H28.6268C28.4606%201%2028%201%2028%201C28%201%2028%201.76479%2028%202.04083Z'%20fill='url(%23paint1_linear_1144_162522)'/%3e%3cpath%20d='M43%2018.5H28V31.5H43V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M43%2036H28V49H43V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M36.5%2022H35.0716L33.5%2022.9199V24.1738L34.9253%2023.3535H34.9627V28H36.5V22Z'%20fill='%2324292E'/%3e%3cpath%20d='M33.0873%2045.5H37.5V44.3468H35.0841V44.3092L35.7972%2043.6561C37.0896%2042.5376%2037.4272%2041.9682%2037.4272%2041.289C37.4272%2040.2225%2036.5511%2039.5%2035.1976%2039.5C33.879%2039.5%2032.9971%2040.2543%2033%2041.4595H34.3651C34.3651%2040.9249%2034.697%2040.6156%2035.1918%2040.6156C35.6779%2040.6156%2036.0301%2040.9133%2036.0301%2041.4017C36.0301%2041.8439%2035.7506%2042.1445%2035.2616%2042.5809L33.0873%2044.4711V45.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3crect%20x='27.5'%20y='0.5'%20width='16'%20height='49'%20stroke='white'/%3e%3cpath%20d='M56.9067%2031C57.6011%2031%2062.9327%2027%2062.9327%2025C62.9327%2023%2057.7357%2019%2056.9067%2019C56.0777%2019%2055.4023%2019.5%2055.4023%2020.4756C55.4023%2021.4512%2058.9067%2023.9206%2058.9067%2023.9206C58.9067%2023.9206%2051.2539%2023.25%2051%2023.9206C50.7461%2024.5911%2050.7461%2025.4089%2051%2026.0794C51.2539%2026.75%2058.9067%2026.0794%2058.9067%2026.0794C58.9067%2026.0794%2055.4023%2028.75%2055.4023%2029.5301C55.4023%2030.3103%2056.2123%2031%2056.9067%2031Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip2_1144_162522)'%3e%3cpath%20d='M71%202.04083V14H95V1H72.0029C71.7369%201%2071%201%2071%201C71%201%2071%201.76479%2071%202.04083Z'%20fill='url(%23paint2_linear_1144_162522)'/%3e%3cpath%20d='M95%2018.5H71V31.5H95V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M95%2036H71V49H95V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M75%2027.3182H76.5682V24.7727C76.5682%2024.392%2076.767%2024.1591%2077.0909%2024.1591C77.4148%2024.1591%2077.625%2024.392%2077.625%2024.7727V27.3182H79.125V24.7727C79.125%2024.392%2079.3239%2024.1591%2079.6477%2024.1591C79.9716%2024.1591%2080.1818%2024.392%2080.1818%2024.7727V27.3182H81.75V24.375C81.75%2023.4801%2081.1761%2022.8977%2080.3409%2022.8977C79.6932%2022.8977%2079.1705%2023.25%2079.0227%2023.7841H78.9773C78.8864%2023.25%2078.3977%2022.8977%2077.7841%2022.8977C77.179%2022.8977%2076.7159%2023.2386%2076.5341%2023.7841H76.4886V22.9545H75V27.3182Z'%20fill='%2324292E'/%3e%3cpath%20d='M82.5234%2028.9545H84.0916V26.6023H84.1143C84.2962%2027.0455%2084.7166%2027.375%2085.3303%2027.375C86.2621%2027.375%2087.0462%2026.6477%2087.0462%2025.1364C87.0462%2023.5568%2086.2053%2022.8977%2085.3416%2022.8977C84.6939%2022.8977%2084.2848%2023.2727%2084.1143%2023.7159H84.0803V22.9545H82.5234V28.9545ZM84.0575%2025.1364C84.0575%2024.4886%2084.3189%2024.1023%2084.7507%2024.1023C85.1825%2024.1023%2085.4325%2024.4886%2085.4325%2025.1364C85.4325%2025.7841%2085.1825%2026.1705%2084.7507%2026.1705C84.3189%2026.1705%2084.0575%2025.7727%2084.0575%2025.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M89.2713%2024.8636C89.2741%2024.4318%2089.5241%2024.1705%2089.9077%2024.1705C90.3082%2024.1705%2090.5355%2024.4318%2090.5327%2024.8636V27.3182H92.1009V24.5341C92.1037%2023.5795%2091.5014%2022.8977%2090.5781%2022.8977C89.9332%2022.8977%2089.456%2023.2273%2089.2599%2023.7841H89.2145V21.5H87.7031V27.3182H89.2713V24.8636Z'%20fill='%2324292E'/%3e%3cpath%20d='M74%2044.8182H75.5682V42.2727C75.5682%2041.892%2075.767%2041.6591%2076.0909%2041.6591C76.4148%2041.6591%2076.625%2041.892%2076.625%2042.2727V44.8182H78.125V42.2727C78.125%2041.892%2078.3239%2041.6591%2078.6477%2041.6591C78.9716%2041.6591%2079.1818%2041.892%2079.1818%2042.2727V44.8182H80.75V41.875C80.75%2040.9801%2080.1761%2040.3977%2079.3409%2040.3977C78.6932%2040.3977%2078.1705%2040.75%2078.0227%2041.2841H77.9773C77.8864%2040.75%2077.3977%2040.3977%2076.7841%2040.3977C76.179%2040.3977%2075.7159%2040.7386%2075.5341%2041.2841H75.4886V40.4545H74V44.8182Z'%20fill='%2324292E'/%3e%3cpath%20d='M81.5234%2046.4545H83.0916V44.1023H83.1143C83.2962%2044.5455%2083.7166%2044.875%2084.3303%2044.875C85.2621%2044.875%2086.0462%2044.1477%2086.0462%2042.6364C86.0462%2041.0568%2085.2053%2040.3977%2084.3416%2040.3977C83.6939%2040.3977%2083.2848%2040.7727%2083.1143%2041.2159H83.0803V40.4545H81.5234V46.4545ZM83.0575%2042.6364C83.0575%2041.9886%2083.3189%2041.6023%2083.7507%2041.6023C84.1825%2041.6023%2084.4325%2041.9886%2084.4325%2042.6364C84.4325%2043.2841%2084.1825%2043.6705%2083.7507%2043.6705C83.3189%2043.6705%2083.0575%2043.2727%2083.0575%2042.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M88.2713%2042.3636C88.2741%2041.9318%2088.5241%2041.6705%2088.9077%2041.6705C89.3082%2041.6705%2089.5355%2041.9318%2089.5327%2042.3636V44.8182H91.1009V42.0341C91.1037%2041.0795%2090.5014%2040.3977%2089.5781%2040.3977C88.9332%2040.3977%2088.456%2040.7273%2088.2599%2041.2841H88.2145V39H86.7031V44.8182H88.2713V42.3636Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_162522)'%3e%3cpath%20d='M99%202.04083V14H129V1H100.254C99.9212%201%2099%201%2099%201C99%201%2099%201.76479%2099%202.04083Z'%20fill='url(%23paint3_linear_1144_162522)'/%3e%3cpath%20d='M129%2018.5H99V31.5H129V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M129%2036H99V49H129V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M109%2027.3182H110.568V24.7727C110.568%2024.392%20110.767%2024.1591%20111.091%2024.1591C111.415%2024.1591%20111.625%2024.392%20111.625%2024.7727V27.3182H113.125V24.7727C113.125%2024.392%20113.324%2024.1591%20113.648%2024.1591C113.972%2024.1591%20114.182%2024.392%20114.182%2024.7727V27.3182H115.75V24.375C115.75%2023.4801%20115.176%2022.8977%20114.341%2022.8977C113.693%2022.8977%20113.17%2023.25%20113.023%2023.7841H112.977C112.886%2023.25%20112.398%2022.8977%20111.784%2022.8977C111.179%2022.8977%20110.716%2023.2386%20110.534%2023.7841H110.489V22.9545H109V27.3182Z'%20fill='%2324292E'/%3e%3cpath%20d='M116.523%2028.9545H118.092V26.6023H118.114C118.296%2027.0455%20118.717%2027.375%20119.33%2027.375C120.262%2027.375%20121.046%2026.6477%20121.046%2025.1364C121.046%2023.5568%20120.205%2022.8977%20119.342%2022.8977C118.694%2022.8977%20118.285%2023.2727%20118.114%2023.7159H118.08V22.9545H116.523V28.9545ZM118.058%2025.1364C118.058%2024.4886%20118.319%2024.1023%20118.751%2024.1023C119.183%2024.1023%20119.433%2024.4886%20119.433%2025.1364C119.433%2025.7841%20119.183%2026.1705%20118.751%2026.1705C118.319%2026.1705%20118.058%2025.7727%20118.058%2025.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M123.271%2024.8636C123.274%2024.4318%20123.524%2024.1705%20123.908%2024.1705C124.308%2024.1705%20124.536%2024.4318%20124.533%2024.8636V27.3182H126.101V24.5341C126.104%2023.5795%20125.501%2022.8977%20124.578%2022.8977C123.933%2022.8977%20123.456%2023.2273%20123.26%2023.7841H123.214V21.5H121.703V27.3182H123.271V24.8636Z'%20fill='%2324292E'/%3e%3cpath%20d='M109%2044.8182H110.568V42.2727C110.568%2041.892%20110.767%2041.6591%20111.091%2041.6591C111.415%2041.6591%20111.625%2041.892%20111.625%2042.2727V44.8182H113.125V42.2727C113.125%2041.892%20113.324%2041.6591%20113.648%2041.6591C113.972%2041.6591%20114.182%2041.892%20114.182%2042.2727V44.8182H115.75V41.875C115.75%2040.9801%20115.176%2040.3977%20114.341%2040.3977C113.693%2040.3977%20113.17%2040.75%20113.023%2041.2841H112.977C112.886%2040.75%20112.398%2040.3977%20111.784%2040.3977C111.179%2040.3977%20110.716%2040.7386%20110.534%2041.2841H110.489V40.4545H109V44.8182Z'%20fill='%2324292E'/%3e%3cpath%20d='M116.523%2046.4545H118.092V44.1023H118.114C118.296%2044.5455%20118.717%2044.875%20119.33%2044.875C120.262%2044.875%20121.046%2044.1477%20121.046%2042.6364C121.046%2041.0568%20120.205%2040.3977%20119.342%2040.3977C118.694%2040.3977%20118.285%2040.7727%20118.114%2041.2159H118.08V40.4545H116.523V46.4545ZM118.058%2042.6364C118.058%2041.9886%20118.319%2041.6023%20118.751%2041.6023C119.183%2041.6023%20119.433%2041.9886%20119.433%2042.6364C119.433%2043.2841%20119.183%2043.6705%20118.751%2043.6705C118.319%2043.6705%20118.058%2043.2727%20118.058%2042.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M123.271%2042.3636C123.274%2041.9318%20123.524%2041.6705%20123.908%2041.6705C124.308%2041.6705%20124.536%2041.9318%20124.533%2042.3636V44.8182H126.101V42.0341C126.104%2041.0795%20125.501%2040.3977%20124.578%2040.3977C123.933%2040.3977%20123.456%2040.7273%20123.26%2041.2841H123.214V39H121.703V44.8182H123.271V42.3636Z'%20fill='%2324292E'/%3e%3cpath%20d='M106%2021.5H104.572L103%2022.4199V23.6738L104.425%2022.8535H104.463V27.5H106V21.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M102.087%2045H106.5V43.8468H104.084V43.8092L104.797%2043.1561C106.09%2042.0376%20106.427%2041.4682%20106.427%2040.789C106.427%2039.7225%20105.551%2039%20104.198%2039C102.879%2039%20101.997%2039.7543%20102%2040.9595H103.365C103.365%2040.4249%20103.697%2040.1156%20104.192%2040.1156C104.678%2040.1156%20105.03%2040.4133%20105.03%2040.9017C105.03%2041.3439%20104.751%2041.6445%20104.262%2042.0809L102.087%2043.9711V45Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162522'%20x1='0'%20y1='7.5052'%20x2='24'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162522'%20x1='28'%20y1='7.5052'%20x2='43'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162522'%20x1='71'%20y1='7.5052'%20x2='95'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162522'%20x1='99'%20y1='7.5052'%20x2='129'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162522'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(0%201)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162522'%3e%3crect%20x='28'%20y='1'%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162522'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(71%201)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_162522'%3e%3crect%20width='30'%20height='48'%20fill='white'%20transform='translate(99%201)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_3 = "data:image/svg+xml,%3csvg%20width='140'%20height='48'%20viewBox='0%200%20140%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162561)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.65%209.3H9.3V3.35C9.3%203.25717%209.26313%203.16815%209.19749%203.10251C9.13185%203.03687%209.04283%203%208.95%203H7.725C7.66392%203.00037%207.604%203.01672%207.5512%203.04742C7.49839%203.07812%207.45454%203.1221%207.424%203.175L3.8505%209.3H3.35C3.25717%209.3%203.16815%209.33687%203.10251%209.40251C3.03687%209.46815%203%209.55717%203%209.65C3%209.74283%203.03687%209.83185%203.10251%209.89749C3.16815%209.96313%203.25717%2010%203.35%2010H4.75C4.84283%2010%204.93185%209.96313%204.99749%209.89749C5.06313%209.83185%205.1%209.74283%205.1%209.65C5.1%209.55717%205.06313%209.46815%204.99749%209.40251C4.93185%209.33687%204.84283%209.3%204.75%209.3H4.659L5.884%207.2H8.6V9.3H8.25C8.15717%209.3%208.06815%209.33687%208.00251%209.40251C7.93687%209.46815%207.9%209.55717%207.9%209.65C7.9%209.74283%207.93687%209.83185%208.00251%209.89749C8.06815%209.96313%208.15717%2010%208.25%2010H9.65C9.74283%2010%209.83185%209.96313%209.89749%209.89749C9.96313%209.83185%2010%209.74283%2010%209.65C10%209.55717%209.96313%209.46815%209.89749%209.40251C9.83185%209.33687%209.74283%209.3%209.65%209.3ZM8.6%206.5H6.2935L7.9245%203.7H8.6V6.5Z'%20fill='white'/%3e%3cpath%20d='M23%2015.5H22.5V16V32V32.5H23H50H50.5V32V16V15.5H50H23Z'%20stroke='%23CCCCDC'/%3e%3cpath%20d='M30.3747%2024.4872C30.3426%2023.7927%2029.7236%2023.3761%2028.7057%2023.3761C27.6992%2023.3761%2027.0779%2023.7607%2027.0825%2024.4444C27.0779%2024.9615%2027.4379%2025.2927%2028.1555%2025.4103L28.7791%2025.5128C29.0542%2025.5598%2029.178%2025.6282%2029.1826%2025.7521C29.178%2025.8889%2029.0106%2025.9658%2028.7791%2025.9658C28.4925%2025.9658%2028.2907%2025.8504%2028.2564%2025.641H27C27.0688%2026.3141%2027.6924%2026.7607%2028.7699%2026.7607C29.7443%2026.7607%2030.4618%2026.3184%2030.4664%2025.6154C30.4618%2025.1303%2030.1134%2024.8483%2029.3935%2024.7265L28.6782%2024.6068C28.41%2024.562%2028.3343%2024.4722%2028.3389%2024.3761C28.3343%2024.2393%2028.5154%2024.1624%2028.7332%2024.1624C28.9831%2024.1624%2029.1917%2024.2863%2029.2101%2024.4872H30.3747Z'%20fill='white'/%3e%3cpath%20d='M33.0513%2023.4188H32.4461V22.6325H31.1806V23.4188H30.7312V24.2735H31.1806V25.7564C31.1714%2026.4444%2031.6276%2026.7927%2032.5011%2026.7479C32.7877%2026.7329%2033.0009%2026.6773%2033.1155%2026.6453L32.9321%2025.8162C32.884%2025.8269%2032.7602%2025.8504%2032.6845%2025.8504C32.5195%2025.8504%2032.4461%2025.7821%2032.4461%2025.6453V24.2735H33.0513V23.4188Z'%20fill='white'/%3e%3cpath%20d='M33.5678%2026.7009H34.8333V24.9915C34.8333%2024.6154%2035.1107%2024.3675%2035.4844%2024.3675C35.6151%2024.3675%2035.826%2024.3868%2035.9521%2024.4274V23.4209C35.8512%2023.3932%2035.7411%2023.3761%2035.6311%2023.3761C35.2551%2023.3761%2034.9617%2023.5812%2034.8333%2024.0427H34.7966V23.4188H33.5678V26.7009Z'%20fill='white'/%3e%3cpath%20d='M36.367%2026.7009H37.6326V23.4188H36.367V26.7009ZM36.9998%2023.0769C37.3437%2023.0769%2037.6234%2022.8355%2037.6234%2022.5385C37.6234%2022.2415%2037.3437%2022%2036.9998%2022C36.6559%2022%2036.3762%2022.2415%2036.3762%2022.5385C36.3762%2022.8355%2036.6559%2023.0769%2036.9998%2023.0769Z'%20fill='white'/%3e%3cpath%20d='M39.5429%2024.8547C39.5452%2024.5299%2039.7423%2024.3333%2040.0564%2024.3333C40.3751%2024.3333%2040.5631%2024.5299%2040.5608%2024.8547V26.7009H41.8263V24.6068C41.8286%2023.8932%2041.3449%2023.3761%2040.5975%2023.3761C40.0793%2023.3761%2039.669%2023.6282%2039.5154%2024.0427H39.4787V23.4188H38.2773V26.7009H39.5429V24.8547Z'%20fill='white'/%3e%3cpath%20d='M44.1476%2028C45.2618%2028%2046%2027.5256%2046%2026.6923V23.4188H44.7345V23.9915H44.707C44.5694%2023.6581%2044.2393%2023.3761%2043.7166%2023.3761C43.0196%2023.3761%2042.341%2023.8718%2042.341%2025.0598C42.341%2026.1966%2042.9738%2026.6581%2043.7257%2026.6581C44.2026%2026.6581%2044.5786%2026.4701%2044.7161%2026.1368H44.7528V26.6923C44.7528%2027.0791%2044.5121%2027.2051%2044.1843%2027.2051C43.8931%2027.2051%2043.6799%2027.1239%2043.6432%2026.9145H42.4235C42.4717%2027.547%2043.0884%2028%2044.1476%2028ZM44.1934%2025.8205C43.8449%2025.8205%2043.6432%2025.547%2043.6432%2025.0598C43.6432%2024.5726%2043.8449%2024.2821%2044.1934%2024.2821C44.5419%2024.2821%2044.7528%2024.5726%2044.7528%2025.0598C44.7528%2025.5385%2044.5419%2025.8205%2044.1934%2025.8205Z'%20fill='white'/%3e%3cpath%20d='M63.9067%2030C64.6011%2030%2069.9327%2026%2069.9327%2024C69.9327%2022%2064.7357%2018%2063.9067%2018C63.0777%2018%2062.4023%2018.5%2062.4023%2019.4756C62.4023%2020.4512%2065.9067%2022.9206%2065.9067%2022.9206C65.9067%2022.9206%2058.2539%2022.25%2058%2022.9206C57.7461%2023.5911%2057.7461%2024.4089%2058%2025.0794C58.2539%2025.75%2065.9067%2025.0794%2065.9067%2025.0794C65.9067%2025.0794%2062.4023%2027.75%2062.4023%2028.5301C62.4023%2029.3103%2063.2123%2030%2063.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M78%201.04083V13H93V0H78.6268C78.4606%200%2078.3011%200.109659%2078.1836%200.304853C78.066%200.500047%2078%200.764787%2078%201.04083Z'%20fill='url(%23paint1_linear_1144_162561)'/%3e%3cpath%20d='M93%2017.5H78V30.5H93V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M93%2035H78V48H93V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M86.5%2021H85.0716L83.5%2021.9199V23.1738L84.9253%2022.3535H84.9627V27H86.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M83.3373%2044.5H87.75V43.3468H85.3341V43.3092L86.0472%2042.6561C87.3396%2041.5376%2087.6772%2040.9682%2087.6772%2040.289C87.6772%2039.2225%2086.8011%2038.5%2085.4476%2038.5C84.129%2038.5%2083.2471%2039.2543%2083.25%2040.4595H84.6151C84.6151%2039.9249%2084.947%2039.6156%2085.4418%2039.6156C85.9279%2039.6156%2086.2801%2039.9133%2086.2801%2040.4017C86.2801%2040.8439%2086.0006%2041.1445%2085.5116%2041.5809L83.3373%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1144_162561)'%3e%3cpath%20d='M83.1733%205.06818H83.3523V5.24716C83.3523%205.3421%2083.39%205.43314%2083.4571%205.50027C83.5242%205.5674%2083.6153%205.60511%2083.7102%205.60511C83.8052%205.60511%2083.8962%205.5674%2083.9633%205.50027C84.0305%205.43314%2084.0682%205.3421%2084.0682%205.24716V5.06818H84.2472C84.3421%205.06818%2084.4331%205.03047%2084.5003%204.96334C84.5674%204.89621%2084.6051%204.80516%2084.6051%204.71023C84.6051%204.61529%2084.5674%204.52425%2084.5003%204.45712C84.4331%204.38999%2084.3421%204.35227%2084.2472%204.35227H84.0682V4.1733C84.0682%204.07836%2084.0305%203.98731%2083.9633%203.92018C83.8962%203.85305%2083.8052%203.81534%2083.7102%203.81534C83.6153%203.81534%2083.5242%203.85305%2083.4571%203.92018C83.39%203.98731%2083.3523%204.07836%2083.3523%204.1733V4.35227H83.1733C83.0784%204.35227%2082.9873%204.38999%2082.9202%204.45712C82.8531%204.52425%2082.8153%204.61529%2082.8153%204.71023C82.8153%204.80516%2082.8531%204.89621%2082.9202%204.96334C82.9873%205.03047%2083.0784%205.06818%2083.1733%205.06818ZM82.9514%209.04864C83.0184%209.11531%2083.1092%209.15273%2083.2037%209.15273C83.2983%209.15273%2083.389%209.11531%2083.4561%209.04864L83.7102%208.79449L83.9644%209.04864C84.0314%209.11531%2084.1222%209.15273%2084.2167%209.15273C84.3113%209.15273%2084.402%209.11531%2084.4691%209.04864C84.5358%208.98157%2084.5732%208.89085%2084.5732%208.79628C84.5732%208.70171%2084.5358%208.61099%2084.4691%208.54392L84.2149%208.28977L84.4691%208.03563C84.5277%207.96715%2084.5584%207.87906%2084.5549%207.78898C84.5514%207.69889%2084.5141%207.61343%2084.4503%207.54968C84.3866%207.48593%2084.3011%207.44858%2084.211%207.4451C84.1209%207.44162%2084.0329%207.47227%2083.9644%207.53091L83.7102%207.78506L83.4561%207.53091C83.3876%207.47227%2083.2995%207.44162%2083.2094%207.4451C83.1193%207.44858%2083.0339%207.48593%2082.9701%207.54968C82.9064%207.61343%2082.869%207.69889%2082.8656%207.78898C82.8621%207.87906%2082.8927%207.96715%2082.9514%208.03563L83.2055%208.28977L82.9514%208.54392C82.8847%208.61099%2082.8473%208.70171%2082.8473%208.79628C82.8473%208.89085%2082.8847%208.98157%2082.9514%209.04864V9.04864ZM88.3636%202.5625H82.6364C82.3516%202.5625%2082.0784%202.67564%2081.877%202.87703C81.6756%203.07842%2081.5625%203.35156%2081.5625%203.63636V9.36364C81.5625%209.64844%2081.6756%209.92159%2081.877%2010.123C82.0784%2010.3244%2082.3516%2010.4375%2082.6364%2010.4375H88.3636C88.6484%2010.4375%2088.9216%2010.3244%2089.123%2010.123C89.3244%209.92159%2089.4375%209.64844%2089.4375%209.36364V3.63636C89.4375%203.35156%2089.3244%203.07842%2089.123%202.87703C88.9216%202.67564%2088.6484%202.5625%2088.3636%202.5625V2.5625ZM85.142%209.72159H82.6364C82.5414%209.72159%2082.4504%209.68388%2082.3833%209.61675C82.3161%209.54962%2082.2784%209.45857%2082.2784%209.36364V6.85796H85.142V9.72159ZM85.142%206.14205H82.2784V3.63636C82.2784%203.54143%2082.3161%203.45038%2082.3833%203.38325C82.4504%203.31612%2082.5414%203.27841%2082.6364%203.27841H85.142V6.14205ZM88.7216%209.36364C88.7216%209.45857%2088.6839%209.54962%2088.6167%209.61675C88.5496%209.68388%2088.4586%209.72159%2088.3636%209.72159H85.858V6.85796H88.7216V9.36364ZM88.7216%206.14205H85.858V3.27841H88.3636C88.4586%203.27841%2088.5496%203.31612%2088.6167%203.38325C88.6839%203.45038%2088.7216%203.54143%2088.7216%203.63636V6.14205ZM86.7528%208.1108H87.8267C87.9216%208.1108%2088.0127%208.07308%2088.0798%208.00595C88.1469%207.93882%2088.1847%207.84778%2088.1847%207.75284C88.1847%207.65791%2088.1469%207.56686%2088.0798%207.49973C88.0127%207.4326%2087.9216%207.39489%2087.8267%207.39489H86.7528C86.6579%207.39489%2086.5669%207.4326%2086.4997%207.49973C86.4326%207.56686%2086.3949%207.65791%2086.3949%207.75284C86.3949%207.84778%2086.4326%207.93882%2086.4997%208.00595C86.5669%208.07308%2086.6579%208.1108%2086.7528%208.1108V8.1108ZM87.8267%204.35227H86.7528C86.6579%204.35227%2086.5669%204.38999%2086.4997%204.45712C86.4326%204.52425%2086.3949%204.61529%2086.3949%204.71023C86.3949%204.80516%2086.4326%204.89621%2086.4997%204.96334C86.5669%205.03047%2086.6579%205.06818%2086.7528%205.06818H87.8267C87.9216%205.06818%2088.0127%205.03047%2088.0798%204.96334C88.1469%204.89621%2088.1847%204.80516%2088.1847%204.71023C88.1847%204.61529%2088.1469%204.52425%2088.0798%204.45712C88.0127%204.38999%2087.9216%204.35227%2087.8267%204.35227ZM86.7528%209.18466H87.8267C87.9216%209.18466%2088.0127%209.14695%2088.0798%209.07982C88.1469%209.01269%2088.1847%208.92164%2088.1847%208.82671C88.1847%208.73177%2088.1469%208.64072%2088.0798%208.57359C88.0127%208.50646%2087.9216%208.46875%2087.8267%208.46875H86.7528C86.6579%208.46875%2086.5669%208.50646%2086.4997%208.57359C86.4326%208.64072%2086.3949%208.73177%2086.3949%208.82671C86.3949%208.92164%2086.4326%209.01269%2086.4997%209.07982C86.5669%209.14695%2086.6579%209.18466%2086.7528%209.18466V9.18466Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M101%2015.5H100.5V16V32V32.5H101H137H137.5V32V16V15.5H137H101Z'%20stroke='%23CCCCDC'/%3e%3cpath%20d='M106.339%2024.4629C106.341%2024.1258%20106.55%2023.9218%20106.882%2023.9218C107.219%2023.9218%20107.418%2024.1258%20107.416%2024.4629V26.3791H108.754V24.2057C108.757%2023.4649%20108.245%2022.9282%20107.454%2022.9282C106.906%2022.9282%20106.472%2023.1899%20106.31%2023.6202H106.271V22.9726H105V26.3791H106.339V24.4629Z'%20fill='white'/%3e%3cpath%20d='M111.831%2024.8887C111.833%2025.2258%20111.62%2025.4299%20111.288%2025.4299C110.95%2025.4299%20110.756%2025.2258%20110.754%2024.8887V22.9726H109.415V25.146C109.418%2025.8912%20109.932%2026.4234%20110.715%2026.4234C111.271%2026.4234%20111.697%2026.1662%20111.86%2025.7315H111.899V26.3791H113.17V22.9726H111.831V24.8887Z'%20fill='white'/%3e%3cpath%20d='M113.85%2026.3791H115.189V24.392C115.189%2024.0948%20115.359%2023.9129%20115.636%2023.9129C115.912%2023.9129%20116.091%2024.0948%20116.091%2024.392V26.3791H117.372V24.392C117.372%2024.0948%20117.542%2023.9129%20117.818%2023.9129C118.095%2023.9129%20118.274%2024.0948%20118.274%2024.392V26.3791H119.613V24.0815C119.613%2023.3829%20119.123%2022.9282%20118.41%2022.9282C117.857%2022.9282%20117.411%2023.2032%20117.285%2023.6202H117.246C117.168%2023.2032%20116.751%2022.9282%20116.227%2022.9282C115.711%2022.9282%20115.315%2023.1944%20115.16%2023.6202H115.121V22.9726H113.85V26.3791Z'%20fill='white'/%3e%3cpath%20d='M122.058%2026.4412C123.091%2026.4412%20123.756%2025.9888%20123.882%2025.2791H122.66C122.582%2025.472%20122.361%2025.5807%20122.087%2025.5807C121.69%2025.5807%20121.457%2025.3412%20121.457%2025.0129V24.9597H123.882V24.6758C123.882%2023.5914%20123.155%2022.9282%20122.029%2022.9282C120.875%2022.9282%20120.137%2023.6291%20120.137%2024.6847C120.137%2025.7869%20120.865%2026.4412%20122.058%2026.4412ZM121.457%2024.2855C121.464%2023.9905%20121.731%2023.7887%20122.058%2023.7887C122.391%2023.7887%20122.643%2023.9928%20122.65%2024.2855H121.457Z'%20fill='white'/%3e%3cpath%20d='M124.428%2026.3791H125.767V24.6049C125.767%2024.2145%20126.061%2023.9573%20126.456%2023.9573C126.594%2023.9573%20126.817%2023.9772%20126.951%2024.0194V22.9748C126.844%2022.946%20126.728%2022.9282%20126.611%2022.9282C126.213%2022.9282%20125.903%2023.1411%20125.767%2023.6202H125.728V22.9726H124.428V26.3791Z'%20fill='white'/%3e%3cpath%20d='M127.39%2026.3791H128.728V22.9726H127.39V26.3791ZM128.059%2022.6178C128.423%2022.6178%20128.719%2022.3671%20128.719%2022.0589C128.719%2021.7506%20128.423%2021.5%20128.059%2021.5C127.695%2021.5%20127.399%2021.7506%20127.399%2022.0589C127.399%2022.3671%20127.695%2022.6178%20128.059%2022.6178Z'%20fill='white'/%3e%3cpath%20d='M131.205%2026.4412C132.309%2026.4412%20132.985%2025.8623%20133%2024.9597H131.758C131.729%2025.3168%20131.518%2025.5097%20131.225%2025.5097C130.873%2025.5097%20130.643%2025.2347%20130.643%2024.6758C130.643%2024.117%20130.873%2023.842%20131.225%2023.842C131.521%2023.842%20131.722%2024.0349%20131.758%2024.392H133C132.993%2023.5049%20132.302%2022.9282%20131.205%2022.9282C129.993%2022.9282%20129.275%2023.6379%20129.275%2024.6847C129.275%2025.7315%20129.993%2026.4412%20131.205%2026.4412Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162561'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162561'%20x1='78'%20y1='6.5052'%20x2='93'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162561'%3e%3crect%20width='9'%20height='9'%20fill='white'%20transform='translate(81%202)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_4 = "data:image/svg+xml,%3csvg%20width='102'%20height='48'%20viewBox='0%200%20102%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162492)'%3e%3cpath%20d='M0%201.04083V13H40V0H1.67154C1.22822%200%200%200%200%200C0%200%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162492)'/%3e%3cpath%20d='M40%2017.5H0V30.5H40V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M40%2035H0V48H40V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13.75%205.45455H12.1023L11.3977%208.34091H11.3523L10.6477%205.45455H9L10.4659%209.81818H12.2841L13.75%205.45455Z'%20fill='%2324292E'/%3e%3cpath%20d='M15.2947%209.88636C15.8629%209.88636%2016.2919%209.69318%2016.5561%209.20455H16.5902V9.81818H18.0561V6.82955C18.0561%206.02273%2017.2919%205.39773%2016.0447%205.39773C14.7408%205.39773%2014.0987%206.07955%2014.0447%206.875H15.4879C15.5249%206.60511%2015.7237%206.47727%2016.022%206.47727C16.2947%206.47727%2016.4879%206.60227%2016.4879%206.82955V6.84091C16.4879%207.09375%2016.2095%207.1733%2015.4766%207.22727C14.576%207.29261%2013.8743%207.65625%2013.8743%208.61364C13.8743%209.48295%2014.4595%209.88636%2015.2947%209.88636ZM15.8061%208.89773C15.5391%208.89773%2015.3516%208.76705%2015.3516%208.52273C15.3516%208.2983%2015.5107%208.125%2015.8743%208.06818C16.1243%208.02841%2016.3345%207.97727%2016.4993%207.90909V8.27273C16.4993%208.67045%2016.1612%208.89773%2015.8061%208.89773Z'%20fill='%2324292E'/%3e%3cpath%20d='M20.3736%204H18.8054V9.81818H20.3736V4Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.0021%207.90909C24.005%208.34091%2023.755%208.60227%2023.3658%208.60227C22.9709%208.60227%2022.7436%208.34091%2022.7408%207.90909V5.45455H21.1726V8.23864C21.1754%209.19318%2021.7777%209.875%2022.6953%209.875C23.3459%209.875%2023.8459%209.54545%2024.0362%208.98864H24.0817V9.81818H25.5703V5.45455H24.0021V7.90909Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.4588%209.89773C29.669%209.89773%2030.4474%209.31818%2030.5952%208.40909H29.1634C29.0724%208.65625%2028.8139%208.79545%2028.4929%208.79545C28.027%208.79545%2027.7543%208.48864%2027.7543%208.06818V8H30.5952V7.63636C30.5952%206.24716%2029.7429%205.39773%2028.4247%205.39773C27.0724%205.39773%2026.2088%206.29545%2026.2088%207.64773C26.2088%209.05966%2027.0611%209.89773%2028.4588%209.89773ZM27.7543%207.13636C27.7628%206.75852%2028.0753%206.5%2028.4588%206.5C28.848%206.5%2029.1435%206.76136%2029.152%207.13636H27.7543Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.18182%2027.7955V26.6591C5.5%2026.6591%205.40909%2026.429%205.40909%2025.9545V25.3295C5.40909%2024.9063%205.19318%2024.483%204.25%2024.2955V24.1591C5.19318%2023.9716%205.40909%2023.5483%205.40909%2023.125V22.5C5.40909%2022.0256%205.5%2021.7955%206.18182%2021.7955V20.6591C5.01136%2020.6591%203.88636%2020.6591%203.88636%2022.2955V22.7386C3.88636%2023.2955%203.66477%2023.5455%203%2023.5455V24.9091C3.66477%2024.9091%203.88636%2025.1591%203.88636%2025.7159V26.1591C3.88636%2027.7955%205.01136%2027.7955%206.18182%2027.7955Z'%20fill='%2324292E'/%3e%3cpath%20d='M7.92116%2026.5455C8.48935%2026.5455%208.91832%2026.3523%209.18253%2025.8636H9.21662V26.4773H10.6825V23.4886C10.6825%2022.6818%209.91832%2022.0568%208.67116%2022.0568C7.36719%2022.0568%206.72514%2022.7386%206.67116%2023.5341H8.11435C8.15128%2023.2642%208.35014%2023.1364%208.64844%2023.1364C8.92116%2023.1364%209.11435%2023.2614%209.11435%2023.4886V23.5C9.11435%2023.7528%208.83594%2023.8324%208.10298%2023.8864C7.20241%2023.9517%206.50071%2024.3153%206.50071%2025.2727C6.50071%2026.142%207.08594%2026.5455%207.92116%2026.5455ZM8.43253%2025.5568C8.16548%2025.5568%207.97798%2025.4261%207.97798%2025.1818C7.97798%2024.9574%208.13707%2024.7841%208.50071%2024.7273C8.75071%2024.6875%208.96094%2024.6364%209.12571%2024.5682V24.9318C9.12571%2025.3295%208.78764%2025.5568%208.43253%2025.5568Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.2841%2026.5682C12.7017%2026.5682%2013.0739%2026.2159%2013.0795%2025.7727C13.0739%2025.3409%2012.7017%2024.9886%2012.2841%2024.9886C11.8438%2024.9886%2011.483%2025.3409%2011.4886%2025.7727C11.483%2026.2159%2011.8438%2026.5682%2012.2841%2026.5682ZM12.2841%2023.6364C12.7017%2023.6364%2013.0739%2023.2841%2013.0795%2022.8409C13.0739%2022.4091%2012.7017%2022.0568%2012.2841%2022.0568C11.8438%2022.0568%2011.483%2022.4091%2011.4886%2022.8409C11.483%2023.2841%2011.8438%2023.6364%2012.2841%2023.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M16.7727%2020.6591H15.3182L13.8864%2021.5341V22.875L15.1591%2022.1136H15.1932V26.4773H16.7727V20.6591Z'%20fill='%2324292E'/%3e%3cpath%20d='M19.2202%2025.6818H18.0384V26C18.0384%2026.7727%2017.777%2027.5824%2017.6861%2027.8977H18.652C18.7884%2027.5824%2019.1378%2026.821%2019.1974%2026L19.2202%2025.6818Z'%20fill='%2324292E'/%3e%3cpath%20d='M21.3622%2026.4773H22.919V25.7614H22.9531C23.1349%2026.2045%2023.5554%2026.5341%2024.169%2026.5341C25.1009%2026.5341%2025.8849%2025.8068%2025.8849%2024.2955C25.8849%2022.7159%2025.044%2022.0568%2024.1804%2022.0568C23.5327%2022.0568%2023.1236%2022.4318%2022.9531%2022.875H22.9304V20.6591H21.3622V26.4773ZM22.8963%2024.2955C22.8963%2023.6477%2023.1577%2023.2614%2023.5895%2023.2614C24.0213%2023.2614%2024.2713%2023.6477%2024.2713%2024.2955C24.2713%2024.9432%2024.0213%2025.3295%2023.5895%2025.3295C23.1577%2025.3295%2022.8963%2024.9318%2022.8963%2024.2955Z'%20fill='%2324292E'/%3e%3cpath%20d='M27.3935%2026.5682C27.8111%2026.5682%2028.1832%2026.2159%2028.1889%2025.7727C28.1832%2025.3409%2027.8111%2024.9886%2027.3935%2024.9886C26.9531%2024.9886%2026.5923%2025.3409%2026.598%2025.7727C26.5923%2026.2159%2026.9531%2026.5682%2027.3935%2026.5682ZM27.3935%2023.6364C27.8111%2023.6364%2028.1832%2023.2841%2028.1889%2022.8409C28.1832%2022.4091%2027.8111%2022.0568%2027.3935%2022.0568C26.9531%2022.0568%2026.5923%2022.4091%2026.598%2022.8409C26.5923%2023.2841%2026.9531%2023.6364%2027.3935%2023.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M29.0298%2026.4773H33.4957V25.2159H31.223V25.1818L31.7685%2024.7273C33.0952%2023.6222%2033.4332%2023.0483%2033.4332%2022.375C33.4332%2021.2898%2032.544%2020.5795%2031.1491%2020.5795C29.794%2020.5795%2028.9134%2021.3324%2028.9162%2022.5568H30.4162C30.4134%2022.0682%2030.7116%2021.7955%2031.1491%2021.7955C31.5838%2021.7955%2031.8935%2022.0653%2031.8935%2022.5114C31.8935%2022.9233%2031.6293%2023.1903%2031.2003%2023.5455L29.0298%2025.3409V26.4773Z'%20fill='%2324292E'/%3e%3cpath%20d='M33.9403%2020V21.1364C34.6222%2021.1364%2034.7131%2021.3665%2034.7131%2021.8409V22.4659C34.7131%2022.8892%2034.929%2023.3125%2035.8722%2023.5V23.6364C34.929%2023.8239%2034.7131%2024.2472%2034.7131%2024.6705V25.2955C34.7131%2025.7699%2034.6222%2026%2033.9403%2026V27.1364C35.1108%2027.1364%2036.2358%2027.1364%2036.2358%2025.5V25.0568C36.2358%2024.5%2036.4574%2024.25%2037.1222%2024.25V22.8864C36.4574%2022.8864%2036.2358%2022.6364%2036.2358%2022.0795V21.6364C36.2358%2020%2035.1108%2020%2033.9403%2020Z'%20fill='%2324292E'/%3e%3cpath%20d='M13.1818%2045.1364V44C12.5%2044%2012.4091%2043.7699%2012.4091%2043.2955V42.6705C12.4091%2042.2472%2012.1932%2041.8239%2011.25%2041.6364V41.5C12.1932%2041.3125%2012.4091%2040.8892%2012.4091%2040.4659V39.8409C12.4091%2039.3665%2012.5%2039.1364%2013.1818%2039.1364V38C12.0114%2038%2010.8864%2038%2010.8864%2039.6364V40.0795C10.8864%2040.6364%2010.6648%2040.8864%2010%2040.8864V42.25C10.6648%2042.25%2010.8864%2042.5%2010.8864%2043.0568V43.5C10.8864%2045.1364%2012.0114%2045.1364%2013.1818%2045.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M14.9212%2044.0117C15.4893%2044.0117%2015.9183%2043.8185%2016.1825%2043.3298H16.2166V43.9435H17.6825V40.9548C17.6825%2040.148%2016.9183%2039.523%2015.6712%2039.523C14.3672%2039.523%2013.7251%2040.2048%2013.6712%2041.0003H15.1143C15.1513%2040.7304%2015.3501%2040.6026%2015.6484%2040.6026C15.9212%2040.6026%2016.1143%2040.7276%2016.1143%2040.9548V40.9662C16.1143%2041.219%2015.8359%2041.2986%2015.103%2041.3526C14.2024%2041.4179%2013.5007%2041.7815%2013.5007%2042.7389C13.5007%2043.6082%2014.0859%2044.0117%2014.9212%2044.0117ZM15.4325%2043.023C15.1655%2043.023%2014.978%2042.8923%2014.978%2042.648C14.978%2042.4236%2015.1371%2042.2503%2015.5007%2042.1935C15.7507%2042.1537%2015.9609%2042.1026%2016.1257%2042.0344V42.398C16.1257%2042.7957%2015.7876%2043.023%2015.4325%2043.023Z'%20fill='%2324292E'/%3e%3cpath%20d='M19.2955%2043.9321C19.7131%2043.9321%2020.0852%2043.5798%2020.0909%2043.1367C20.0852%2042.7048%2019.7131%2042.3526%2019.2955%2042.3526C18.8551%2042.3526%2018.4943%2042.7048%2018.5%2043.1367C18.4943%2043.5798%2018.8551%2043.9321%2019.2955%2043.9321ZM19.2955%2041.0003C19.7131%2041.0003%2020.0852%2040.648%2020.0909%2040.2048C20.0852%2039.773%2019.7131%2039.4207%2019.2955%2039.4207C18.8551%2039.4207%2018.4943%2039.773%2018.5%2040.2048C18.4943%2040.648%2018.8551%2041.0003%2019.2955%2041.0003Z'%20fill='%2324292E'/%3e%3cpath%20d='M23.1932%2044.6139C24.6165%2044.6139%2025.6193%2043.8895%2025.6136%2042.8639C25.6193%2042.1509%2025.142%2041.648%2024.2045%2041.5457V41.5003C24.8977%2041.4264%2025.4034%2040.9804%2025.3977%2040.3298C25.4034%2039.3497%2024.4943%2038.6367%2023.2045%2038.6367C21.8864%2038.6367%2020.9489%2039.3895%2020.9432%2040.4548H22.4545C22.4602%2040.1026%2022.7699%2039.8526%2023.2045%2039.8526C23.6023%2039.8526%2023.8807%2040.094%2023.875%2040.4321C23.8807%2040.7844%2023.5511%2041.0344%2023.0795%2041.0344H22.4886V42.1253H23.0795C23.5909%2042.1253%2023.9489%2042.3753%2023.9432%2042.7276C23.9489%2043.0884%2023.642%2043.3412%2023.2045%2043.3412C22.75%2043.3412%2022.4261%2043.0997%2022.4205%2042.7617H20.8295C20.8352%2043.8469%2021.8153%2044.6139%2023.1932%2044.6139Z'%20fill='%2324292E'/%3e%3cpath%20d='M26%2038.0003V39.1366C26.6818%2039.1366%2026.7727%2039.3667%2026.7727%2039.8412V40.4662C26.7727%2040.8895%2026.9886%2041.3128%2027.9318%2041.5003V41.6366C26.9886%2041.8241%2026.7727%2042.2474%2026.7727%2042.6707V43.2957C26.7727%2043.7702%2026.6818%2044.0003%2026%2044.0003V45.1366C27.1705%2045.1366%2028.2955%2045.1366%2028.2955%2043.5003V43.0571C28.2955%2042.5003%2028.517%2042.2503%2029.1818%2042.2503V40.8866C28.517%2040.8866%2028.2955%2040.6366%2028.2955%2040.0798V39.6366C28.2955%2038.0003%2027.1705%2038.0003%2026%2038.0003Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M53.9067%2030C54.6011%2030%2059.9327%2026%2059.9327%2024C59.9327%2022%2054.7357%2018%2053.9067%2018C53.0777%2018%2052.4023%2018.5%2052.4023%2019.4756C52.4023%2020.4512%2055.9067%2022.9206%2055.9067%2022.9206C55.9067%2022.9206%2048.2539%2022.25%2048%2022.9206C47.7461%2023.5911%2047.7461%2024.4089%2048%2025.0794C48.2539%2025.75%2055.9067%2025.0794%2055.9067%2025.0794C55.9067%2025.0794%2052.4023%2027.75%2052.4023%2028.5301C52.4023%2029.3103%2053.2123%2030%2053.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M68%201.04083V13H83V0H68.6268C68.4606%200%2068.3011%200.109659%2068.1836%200.304853C68.066%200.500047%2068%200.764787%2068%201.04083Z'%20fill='url(%23paint1_linear_1144_162492)'/%3e%3cpath%20d='M83%2017.5H68V30.5H83V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M83%2035H68V48H83V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M76.5%2021H75.0716L73.5%2021.9199V23.1738L74.9253%2022.3535H74.9627V27H76.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M74.7744%209.5C75.5264%209.5%2076.0464%209.23767%2076.3415%208.74147H76.3837V9.41783H78V6.1182C78%205.09102%2076.9845%204.5%2075.6107%204.5C74.1595%204.5%2073.3373%205.1574%2073.2003%206.04235L74.785%206.09292C74.8587%205.78319%2075.1434%205.59355%2075.5966%205.59355C76.0183%205.59355%2076.2853%205.77686%2076.2853%206.1024V6.1182C76.2853%206.4153%2075.9269%206.47851%2075.0063%206.5512C73.9136%206.63338%2073%206.99684%2073%208.07143C73%209.03224%2073.7414%209.5%2074.7744%209.5ZM75.305%208.48862C74.9079%208.48862%2074.6268%208.31795%2074.6268%207.99558C74.6268%207.68268%2074.9009%207.49305%2075.3893%207.42668C75.7091%207.38559%2076.1026%207.32238%2076.2959%207.23072V7.69216C76.2959%208.16625%2075.8531%208.48862%2075.305%208.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M75.4792%2044.5C76.8085%2044.5%2077.7528%2043.7757%2077.75%2042.7605C77.7528%2042.0418%2077.2958%2041.5285%2076.4208%2041.423V41.3774C77.0771%2041.2804%2077.5423%2040.827%2077.5395%2040.1711C77.5423%2039.2186%2076.706%2038.5%2075.4903%2038.5C74.2663%2038.5%2073.3746%2039.23%2073.3635%2040.2681H74.6734C74.6845%2039.8688%2075.0334%2039.6008%2075.4903%2039.6008C75.9251%2039.6008%2076.2214%2039.8717%2076.2186%2040.2624C76.2214%2040.6673%2075.8725%2040.9468%2075.3685%2040.9468H74.8174V41.9506H75.3685C75.9417%2041.9506%2076.3155%2042.2414%2076.31%2042.6521C76.3155%2043.0656%2075.9721%2043.3536%2075.4848%2043.3536C75.0001%2043.3536%2074.6429%2043.0884%2074.6291%2042.7034H73.25C73.2611%2043.7586%2074.1832%2044.5%2075.4792%2044.5Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1144_162492)'%3e%3cpath%20d='M87%2013H102V1.04083C102%200.764787%20101.934%200.500047%20101.816%200.304853C101.699%200.109659%20101.539%200%20101.373%200L87%200V13Z'%20fill='url(%23paint2_linear_1144_162492)'/%3e%3cpath%20d='M102%2017.5H87V30.5H102V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M102%2035H87V48H102V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M92%209.68623H93.5663V8.96449H93.6149C93.8155%209.37609%2094.2621%209.75%2095.0129%209.75C96.1133%209.75%2097%208.97898%2097%207.46304C97%205.89203%2096.0615%205.17609%2095.0227%205.17609C94.2362%205.17609%2093.8058%205.58768%2093.6149%205.99638H93.5825V3.75H92V9.68623ZM93.5502%207.46015C93.5502%206.73261%2093.8867%206.28333%2094.466%206.28333C95.0518%206.28333%2095.3754%206.7442%2095.3754%207.46015C95.3754%208.17899%2095.0518%208.64565%2094.466%208.64565C93.8867%208.64565%2093.5502%208.18188%2093.5502%207.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M92%2043.4453V42.4463L94.5893%2038.5H96.2308V42.4287H97V43.4453H96.2308V44.5H94.977V43.4453H92ZM95.0012%2042.4287V39.8828H94.9528L93.3204%2042.3818V42.4287H95.0012Z'%20fill='%2324292E'/%3e%3cpath%20d='M92.3373%2027H96.75V25.8468H94.3341V25.8092L95.0472%2025.1561C96.3396%2024.0376%2096.6772%2023.4682%2096.6772%2022.789C96.6772%2021.7225%2095.8011%2021%2094.4476%2021C93.129%2021%2092.2471%2021.7543%2092.25%2022.9595H93.6151C93.6151%2022.4249%2093.947%2022.1156%2094.4418%2022.1156C94.9279%2022.1156%2095.2801%2022.4133%2095.2801%2022.9017C95.2801%2023.3439%2095.0006%2023.6445%2094.5116%2024.0809L92.3373%2025.9711V27Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162492'%20x1='0'%20y1='6.5052'%20x2='40'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162492'%20x1='68'%20y1='6.5052'%20x2='83'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162492'%20x1='87'%20y1='6.5052'%20x2='102'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162492'%3e%3crect%20width='40'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162492'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(87)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_5 = "data:image/svg+xml,%3csvg%20width='50'%20height='48'%20viewBox='0%200%2050%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%200.611699V7.64012H14V0H0.58504C0.429878%200%200.28107%200.0644467%200.171354%200.179162C0.0616379%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1144_162206)'/%3e%3cpath%20d='M14%2010.0869H0V17.727H14V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14%2020.1799H0V27.8262H14V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14%2030.2668H0V37.907H14V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14%2048V40.3721H0V47.3883C0%2047.5505%200.0616379%2047.7061%200.171354%2047.8209C0.28107%2047.9356%200.429878%2048%200.58504%2048H14Z'%20fill='%233865AB'/%3e%3cpath%20d='M47.5651%2035.5782L42.3742%2030.4293C44.3891%2027.9169%2045.3649%2024.7281%2045.1009%2021.5184C44.8369%2018.3087%2043.3531%2015.3222%2040.9548%2013.1728C38.5564%2011.0235%2035.4256%209.87482%2032.2063%209.96291C28.987%2010.051%2025.9238%2011.3692%2023.6465%2013.6465C21.3693%2015.9237%2020.0511%2018.9869%2019.963%2022.2063C19.8749%2025.4256%2021.0236%2028.5563%2023.1729%2030.9547C25.3222%2033.3531%2028.3088%2034.8368%2031.5185%2035.1008C34.7281%2035.3649%2037.917%2034.3891%2040.4293%2032.3741L45.5783%2037.5231C45.7084%2037.6542%2045.8631%2037.7583%2046.0336%2037.8293C46.2041%2037.9004%2046.387%2037.9369%2046.5717%2037.9369C46.7564%2037.9369%2046.9393%2037.9004%2047.1098%2037.8293C47.2803%2037.7583%2047.435%2037.6542%2047.5651%2037.5231C47.8173%2037.2622%2047.9583%2036.9135%2047.9583%2036.5506C47.9583%2036.1878%2047.8173%2035.8391%2047.5651%2035.5782V35.5782ZM32.58%2032.3741C30.6429%2032.3741%2028.7493%2031.7997%2027.1387%2030.7235C25.528%2029.6473%2024.2727%2028.1177%2023.5314%2026.328C22.7901%2024.5384%2022.5961%2022.5691%2022.974%2020.6692C23.3519%2018.7693%2024.2847%2017.0242%2025.6545%2015.6544C27.0242%2014.2847%2028.7694%2013.3519%2030.6693%2012.974C32.5691%2012.5961%2034.5384%2012.79%2036.3281%2013.5313C38.1177%2014.2726%2039.6474%2015.528%2040.7236%2017.1386C41.7998%2018.7492%2042.3742%2020.6428%2042.3742%2022.5799C42.3742%2025.1775%2041.3423%2027.6687%2039.5055%2029.5055C37.6688%2031.3422%2035.1776%2032.3741%2032.58%2032.3741V32.3741Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M32.5%2016C31.0413%2016%2029.6424%2016.5479%2028.6109%2017.523C27.5795%2018.4982%2027%2019.8209%2027%2021.2C27%2024.71%2031.8469%2028.675%2032.0531%2028.844C32.1777%2028.9447%2032.3361%2029%2032.5%2029C32.6639%2029%2032.8223%2028.9447%2032.9469%2028.844C33.1875%2028.675%2038%2024.71%2038%2021.2C38%2019.8209%2037.4205%2018.4982%2036.3891%2017.523C35.3576%2016.5479%2033.9587%2016%2032.5%2016Z'%20fill='%23FF0000'/%3e%3cpath%20d='M35%2021.5C35%2022.8807%2033.8807%2024%2032.5%2024C31.1193%2024%2030%2022.8807%2030%2021.5C30%2020.1193%2031.1193%2019%2032.5%2019C33.8807%2019%2035%2020.1193%2035%2021.5Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162206'%20x1='0'%20y1='3.82312'%20x2='14'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_6 = "data:image/svg+xml,%3csvg%20width='158'%20height='49'%20viewBox='0%200%20158%2049'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M19%2014H34V2.04083C34%201.76479%2033.934%201.50005%2033.8164%201.30485C33.6989%201.10966%2033.5394%201%2033.3732%201H19V14Z'%20fill='url(%23paint0_linear_1144_161961)'/%3e%3cpath%20d='M34%2018.5H19V31.5H34V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2036H19V49H34V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M0%202.03583V13.995H15V0.994995H0.626828C0.460583%200.994995%200.301147%201.10465%200.183594%201.29985C0.0660407%201.49504%200%201.75978%200%202.03583Z'%20fill='url(%23paint1_linear_1144_161961)'/%3e%3cpath%20d='M15%2018.495H0V31.495H15V18.495Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035.995H0V48.995H15V35.995Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M46.3343%2031H49.674V26.674H54V23.3343H49.674V19H46.3343V23.3343H42V26.674H46.3343V31Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M82.675%202.5H75.325C74.9073%202.5%2074.5067%202.66594%2074.2113%202.96131C73.9159%203.25668%2073.75%203.65728%2073.75%204.075V4.68925C73.7499%204.90604%2073.7946%205.12052%2073.8813%205.31925V5.35075C73.9554%205.51926%2074.0605%205.6724%2074.191%205.80225L77.425%209.01525V12.475C77.4248%2012.5642%2077.4474%2012.652%2077.4906%2012.7301C77.5337%2012.8082%2077.5961%2012.874%2077.6717%2012.9212C77.7553%2012.973%2077.8517%2013.0003%2077.95%2013C78.0322%2012.9995%2078.1131%2012.9797%2078.1862%2012.9422L80.2862%2011.8922C80.3728%2011.8486%2080.4456%2011.7819%2080.4966%2011.6994C80.5476%2011.6169%2080.5747%2011.5219%2080.575%2011.425V9.01525L83.788%205.80225C83.9185%205.6724%2084.0236%205.51926%2084.0977%205.35075V5.31925C84.1916%205.12208%2084.2435%204.90753%2084.25%204.68925V4.075C84.25%203.65728%2084.0841%203.25668%2083.7887%202.96131C83.4933%202.66594%2083.0927%202.5%2082.675%202.5ZM79.6772%208.42725C79.6286%208.47631%2079.5901%208.53448%2079.564%208.59845C79.5378%208.66241%2079.5246%208.73091%2079.525%208.8V11.0995L78.475%2011.6245V8.8C78.4754%208.73091%2078.4622%208.66241%2078.436%208.59845C78.4099%208.53448%2078.3714%208.47631%2078.3227%208.42725L75.5402%205.65H82.4597L79.6772%208.42725ZM83.2%204.6H74.8V4.075C74.8%203.93576%2074.8553%203.80223%2074.9538%203.70377C75.0522%203.60531%2075.1858%203.55%2075.325%203.55H82.675C82.8142%203.55%2082.9478%203.60531%2083.0462%203.70377C83.1447%203.80223%2083.2%203.93576%2083.2%204.075V4.6Z'%20fill='%23CCCCDC'%20fill-opacity='0.65'/%3e%3cg%20clip-path='url(%23clip0_1144_161961)'%3e%3cpath%20d='M62%2018.7908V30.75H76.9563V17.75H62.625C62.4592%2017.75%2062.3003%2017.8597%2062.1831%2018.0549C62.0658%2018.25%2062%2018.5148%2062%2018.7908Z'%20fill='url(%23paint2_linear_1144_161961)'/%3e%3cpath%20d='M77%2035.25H62V48.25H77V35.25Z'%20fill='%233865AB'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_161961)'%3e%3cpath%20d='M81%2030.75H96V18.7908C96%2018.5148%2095.934%2018.25%2095.8164%2018.0549C95.6989%2017.8597%2095.5394%2017.75%2095.3732%2017.75H81V30.75Z'%20fill='url(%23paint3_linear_1144_161961)'/%3e%3cpath%20d='M96%2035.25H81V48.25H96V35.25Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M109.907%2031C110.601%2031%20115.933%2027%20115.933%2025C115.933%2023%20110.736%2019%20109.907%2019C109.078%2019%20108.402%2019.5%20108.402%2020.4756C108.402%2021.4512%20111.907%2023.9206%20111.907%2023.9206C111.907%2023.9206%20104.254%2023.25%20104%2023.9206C103.746%2024.5911%20103.746%2025.4089%20104%2026.0794C104.254%2026.75%20111.907%2026.0794%20111.907%2026.0794C111.907%2026.0794%20108.402%2028.75%20108.402%2029.5301C108.402%2030.3103%20109.212%2031%20109.907%2031Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M143%2014H158V2.04083C158%201.76479%20157.934%201.50005%20157.816%201.30485C157.699%201.10966%20157.539%201%20157.373%201H143V14Z'%20fill='url(%23paint4_linear_1144_161961)'/%3e%3cpath%20d='M158%2018.5H143V31.5H158V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2036H143V49H158V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%202.03583V13.995H139V0.994995H124.627C124.461%200.994995%20124.301%201.10465%20124.184%201.29985C124.066%201.49504%20124%201.75978%20124%202.03583Z'%20fill='url(%23paint5_linear_1144_161961)'/%3e%3cpath%20d='M139%2018.495H124V31.495H139V18.495Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2035.995H124V48.995H139V35.995Z'%20fill='%2384AFF1'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161961'%20x1='19'%20y1='7.5052'%20x2='34'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161961'%20x1='0'%20y1='7.5002'%20x2='15'%20y2='7.5002'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161961'%20x1='62'%20y1='24.2552'%20x2='76.9563'%20y2='24.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161961'%20x1='81'%20y1='24.2552'%20x2='96'%20y2='24.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_161961'%20x1='143'%20y1='7.5052'%20x2='158'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1144_161961'%20x1='124'%20y1='7.5002'%20x2='139'%20y2='7.5002'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161961'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%2017.75)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161961'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%2017.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_7 = "data:image/svg+xml,%3csvg%20width='140'%20height='48'%20viewBox='0%200%20140%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162032)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1144_162032)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1144_162032)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M26.4792%2027C27.8085%2027%2028.7528%2026.2757%2028.75%2025.2605C28.7528%2024.5418%2028.2958%2024.0285%2027.4208%2023.923V23.8774C28.0771%2023.7804%2028.5423%2023.327%2028.5395%2022.6711C28.5423%2021.7186%2027.706%2021%2026.4903%2021C25.2663%2021%2024.3746%2021.73%2024.3635%2022.7681H25.6734C25.6845%2022.3688%2026.0334%2022.1008%2026.4903%2022.1008C26.9251%2022.1008%2027.2214%2022.3717%2027.2186%2022.7624C27.2214%2023.1673%2026.8725%2023.4468%2026.3685%2023.4468H25.8174V24.4506H26.3685C26.9417%2024.4506%2027.3155%2024.7414%2027.31%2025.1521C27.3155%2025.5656%2026.9721%2025.8536%2026.4848%2025.8536C26.0001%2025.8536%2025.6429%2025.5884%2025.6291%2025.2034H24.25C24.2611%2026.2586%2025.1832%2027%2026.4792%2027Z'%20fill='%2324292E'/%3e%3cpath%20d='M24%2043.4453V42.4463L26.5893%2038.5H28.2308V42.4287H29V43.4453H28.2308V44.5H26.977V43.4453H24ZM27.0012%2042.4287V39.8828H26.9528L25.3204%2042.3818V42.4287H27.0012Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162032)'%3e%3cpath%20d='M51.675%2018.75H44.325C43.9073%2018.75%2043.5067%2018.9159%2043.2113%2019.2113C42.9159%2019.5067%2042.75%2019.9073%2042.75%2020.325V20.9392C42.7499%2021.156%2042.7946%2021.3705%2042.8813%2021.5692V21.6007C42.9554%2021.7693%2043.0605%2021.9224%2043.191%2022.0522L46.425%2025.2652V28.725C46.4248%2028.8142%2046.4474%2028.902%2046.4906%2028.9801C46.5337%2029.0582%2046.5961%2029.124%2046.6717%2029.1712C46.7553%2029.223%2046.8517%2029.2503%2046.95%2029.25C47.0322%2029.2495%2047.1131%2029.2297%2047.1862%2029.1922L49.2862%2028.1422C49.3728%2028.0986%2049.4456%2028.0319%2049.4966%2027.9494C49.5476%2027.8669%2049.5747%2027.7719%2049.575%2027.675V25.2652L52.788%2022.0522C52.9185%2021.9224%2053.0236%2021.7693%2053.0977%2021.6007V21.5692C53.1916%2021.3721%2053.2435%2021.1575%2053.25%2020.9392V20.325C53.25%2019.9073%2053.0841%2019.5067%2052.7887%2019.2113C52.4933%2018.9159%2052.0927%2018.75%2051.675%2018.75ZM48.6772%2024.6772C48.6286%2024.7263%2048.5901%2024.7845%2048.564%2024.8484C48.5378%2024.9124%2048.5246%2024.9809%2048.525%2025.05V27.3495L47.475%2027.8745V25.05C47.4754%2024.9809%2047.4622%2024.9124%2047.436%2024.8484C47.4099%2024.7845%2047.3714%2024.7263%2047.3227%2024.6772L44.5402%2021.9H51.4597L48.6772%2024.6772ZM52.2%2020.85H43.8V20.325C43.8%2020.1858%2043.8553%2020.0522%2043.9538%2019.9538C44.0522%2019.8553%2044.1858%2019.8%2044.325%2019.8H51.675C51.8142%2019.8%2051.9478%2019.8553%2052.0462%2019.9538C52.1447%2020.0522%2052.2%2020.1858%2052.2%2020.325V20.85Z'%20fill='%23CCCCDC'%20fill-opacity='0.65'/%3e%3c/g%3e%3cpath%20d='M56.8087%2027C55.7696%2027%2055%2026.4879%2055%2025.477C55%2024.3364%2055.9682%2023.9972%2057.0463%2023.9041C57.9932%2023.8176%2058.3656%2023.7744%2058.3656%2023.4452V23.4252C58.3656%2023.0062%2058.0712%2022.7635%2057.557%2022.7635C57.0144%2022.7635%2056.6917%2023.0129%2056.5888%2023.3521L55.1915%2023.2456C55.4007%2022.3145%2056.259%2021.7292%2057.5641%2021.7292C58.777%2021.7292%2059.8764%2022.2414%2059.8764%2023.4585V26.9036H58.4436V26.1953H58.401C58.1351%2026.6708%2057.6137%2027%2056.8087%2027ZM57.2414%2026.0224C57.9045%2026.0224%2058.3762%2025.6133%2058.3762%2025.0779V24.5359C58.1954%2024.649%2057.6563%2024.7221%2057.3265%2024.7654C56.7945%2024.8352%2056.4434%2025.0314%2056.4434%2025.4304C56.4434%2025.8195%2056.7768%2026.0224%2057.2414%2026.0224Z'%20fill='%23CCCCDC'%20fill-opacity='0.65'/%3e%3cpath%20d='M61.3889%2026.3727V25.1922H66.2866V26.3727H61.3889ZM61.3889%2024.1646V22.9841H66.2866V24.1646H61.3889Z'%20fill='%23CCCCDC'%20fill-opacity='0.65'/%3e%3cpath%20d='M67.0676%2027V26.0983L69.5304%2024.1474C70.1588%2023.6301%2070.4966%2023.3064%2070.4966%2022.8353C70.4966%2022.315%2070.0439%2021.9913%2069.4358%2021.9913C68.8041%2021.9913%2068.3851%2022.3381%2068.3885%2022.9046H67C66.9966%2021.7428%2067.9933%2021%2069.446%2021C70.9291%2021%2071.9088%2021.7254%2071.9088%2022.7514C71.9088%2023.4249%2071.527%2023.9798%2070.1047%2025.0896L69.0946%2025.9364V25.9769H72V27H67.0676Z'%20fill='%23CCCCDC'%20fill-opacity='0.65'/%3e%3cpath%20d='M87.9067%2030C88.6011%2030%2093.9327%2026%2093.9327%2024C93.9327%2022%2088.7357%2018%2087.9067%2018C87.0777%2018%2086.4023%2018.5%2086.4023%2019.4756C86.4023%2020.4512%2089.9067%2022.9206%2089.9067%2022.9206C89.9067%2022.9206%2082.2539%2022.25%2082%2022.9206C81.7461%2023.5911%2081.7461%2024.4089%2082%2025.0794C82.2539%2025.75%2089.9067%2025.0794%2089.9067%2025.0794C89.9067%2025.0794%2086.4023%2027.75%2086.4023%2028.5301C86.4023%2029.3103%2087.2123%2030%2087.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M102%209.79083V21.75H117V8.75H102.627C102.461%208.75%20102.301%208.85966%20102.184%209.05485C102.066%209.25005%20102%209.51479%20102%209.79083Z'%20fill='url(%23paint2_linear_1144_162032)'/%3e%3cpath%20d='M117%2026.25H102V39.25H117V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110.5%2029.75H109.072L107.5%2030.6699V31.9238L108.925%2031.1035H108.963V35.75H110.5V29.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M108.774%2018.25C109.526%2018.25%20110.046%2017.9877%20110.342%2017.4915H110.384V18.1678H112V14.8682C112%2013.841%20110.985%2013.25%20109.611%2013.25C108.16%2013.25%20107.337%2013.9074%20107.2%2014.7924L108.785%2014.8429C108.859%2014.5332%20109.143%2014.3436%20109.597%2014.3436C110.018%2014.3436%20110.285%2014.5269%20110.285%2014.8524V14.8682C110.285%2015.1653%20109.927%2015.2285%20109.006%2015.3012C107.914%2015.3834%20107%2015.7468%20107%2016.8214C107%2017.7822%20107.741%2018.25%20108.774%2018.25ZM109.305%2017.2386C108.908%2017.2386%20108.627%2017.068%20108.627%2016.7456C108.627%2016.4327%20108.901%2016.243%20109.389%2016.1767C109.709%2016.1356%20110.103%2016.0724%20110.296%2015.9807V16.4422C110.296%2016.9162%20109.853%2017.2386%20109.305%2017.2386Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1144_162032)'%3e%3cpath%20d='M121%2021.75H136V9.79083C136%209.51479%20135.934%209.25005%20135.816%209.05485C135.699%208.85966%20135.539%208.75%20135.373%208.75H121V21.75Z'%20fill='url(%23paint3_linear_1144_162032)'/%3e%3cpath%20d='M136%2026.25H121V39.25H136V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M126%2018.4362H127.566V17.7145H127.615C127.816%2018.1261%20128.262%2018.5%20129.013%2018.5C130.113%2018.5%20131%2017.729%20131%2016.213C131%2014.642%20130.061%2013.9261%20129.023%2013.9261C128.236%2013.9261%20127.806%2014.3377%20127.615%2014.7464H127.583V12.5H126V18.4362ZM127.55%2016.2101C127.55%2015.4826%20127.887%2015.0333%20128.466%2015.0333C129.052%2015.0333%20129.375%2015.4942%20129.375%2016.2101C129.375%2016.929%20129.052%2017.3957%20128.466%2017.3957C127.887%2017.3957%20127.55%2016.9319%20127.55%2016.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M128.479%2035.75C129.808%2035.75%20130.753%2035.0257%20130.75%2034.0105C130.753%2033.2918%20130.296%2032.7785%20129.421%2032.673V32.6274C130.077%2032.5304%20130.542%2032.077%20130.54%2031.4211C130.542%2030.4686%20129.706%2029.75%20128.49%2029.75C127.266%2029.75%20126.375%2030.48%20126.364%2031.5181H127.673C127.684%2031.1188%20128.033%2030.8508%20128.49%2030.8508C128.925%2030.8508%20129.221%2031.1217%20129.219%2031.5124C129.221%2031.9173%20128.872%2032.1968%20128.368%2032.1968H127.817V33.2006H128.368C128.942%2033.2006%20129.316%2033.4914%20129.31%2033.9021C129.316%2034.3156%20128.972%2034.6036%20128.485%2034.6036C128%2034.6036%20127.643%2034.3384%20127.629%2033.9534H126.25C126.261%2035.0086%20127.183%2035.75%20128.479%2035.75Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162032'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162032'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162032'%20x1='102'%20y1='15.2552'%20x2='117'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162032'%20x1='121'%20y1='15.2552'%20x2='136'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162032'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162032'%3e%3crect%20width='12'%20height='12'%20fill='white'%20transform='translate(42%2018)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162032'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(121%208.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_8 = "data:image/svg+xml,%3csvg%20width='77'%20height='48'%20viewBox='0%200%2077%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162003)'%3e%3cpath%20d='M19%2023H34V13.8006C34%2013.5883%2033.934%2013.3847%2033.8164%2013.2345C33.6989%2013.0844%2033.5394%2013%2033.3732%2013H19V23Z'%20fill='url(%23paint0_linear_1144_162003)'/%3e%3cpath%20d='M43%2026H19V35.5H43V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2026H19V35.5H34V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2039H19V48.5H34V39Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2020.9362H25.5663V20.2145H25.6149C25.8155%2020.6261%2026.2621%2021%2027.0129%2021C28.1133%2021%2029%2020.229%2029%2018.713C29%2017.142%2028.0615%2016.4261%2027.0227%2016.4261C26.2362%2016.4261%2025.8058%2016.8377%2025.6149%2017.2464H25.5825V15H24V20.9362ZM25.5502%2018.7101C25.5502%2017.9826%2025.8867%2017.5333%2026.466%2017.5333C27.0518%2017.5333%2027.3754%2017.9942%2027.3754%2018.7101C27.3754%2019.429%2027.0518%2019.8957%2026.466%2019.8957C25.8867%2019.8957%2025.5502%2019.4319%2025.5502%2018.7101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162003)'%3e%3cpath%20d='M0%2013.8006V23H15V13H0.626828C0.460583%2013%200.301147%2013.0844%200.183594%2013.2345C0.0660407%2013.3847%200%2013.5883%200%2013.8006Z'%20fill='url(%23paint1_linear_1144_162003)'/%3e%3cpath%20d='M24%2026H0V35.5H24V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2026H0V35.5H15V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2039H0V48.5H15V39Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2028H7.07158L5.5%2028.9199V30.1738L6.92531%2029.3535H6.96266V34H8.5V28Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2046.5H9.75V45.3468H7.33409V45.3092L8.04722%2044.6561C9.33959%2043.5376%209.67723%2042.9682%209.67723%2042.289C9.67723%2041.2225%208.8011%2040.5%207.44761%2040.5C6.12905%2040.5%205.2471%2041.2543%205.25001%2042.4595H6.61514C6.61514%2041.9249%206.94696%2041.6156%207.44179%2041.6156C7.92788%2041.6156%208.28008%2041.9133%208.28008%2042.4017C8.28008%2042.8439%208.00065%2043.1445%207.51165%2043.5809L5.33733%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%2020.5C7.52635%2020.5%208.04638%2020.2377%208.34153%2019.7415H8.3837V20.4178H10V17.1182C10%2016.091%208.98454%2015.5%207.61068%2015.5C6.15952%2015.5%205.33732%2016.1574%205.20028%2017.0424L6.78496%2017.0929C6.85875%2016.7832%207.14336%2016.5936%207.59663%2016.5936C8.01827%2016.5936%208.28531%2016.7769%208.28531%2017.1024V17.1182C8.28531%2017.4153%207.92692%2017.4785%207.00633%2017.5512C5.91356%2017.6334%205%2017.9968%205%2019.0714C5%2020.0322%205.74139%2020.5%206.77442%2020.5ZM7.30499%2019.4886C6.90794%2019.4886%206.62684%2019.318%206.62684%2018.9956C6.62684%2018.6827%206.90091%2018.493%207.38932%2018.4267C7.70907%2018.3856%208.1026%2018.3224%208.29585%2018.2307V18.6922C8.29585%2019.1662%207.85313%2019.4886%207.30499%2019.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2036.5C48.6011%2036.5%2053.9327%2032.5%2053.9327%2030.5C53.9327%2028.5%2048.7357%2024.5%2047.9067%2024.5C47.0777%2024.5%2046.4023%2025%2046.4023%2025.9756C46.4023%2026.9512%2049.9067%2029.4206%2049.9067%2029.4206C49.9067%2029.4206%2042.2539%2028.75%2042%2029.4206C41.7461%2030.0911%2041.7461%2030.9089%2042%2031.5794C42.2539%2032.25%2049.9067%2031.5794%2049.9067%2031.5794C49.9067%2031.5794%2046.4023%2034.25%2046.4023%2035.0301C46.4023%2035.8103%2047.2123%2036.5%2047.9067%2036.5Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip2_1144_162003)'%3e%3cpath%20d='M62%2013.8006V23H77V13H62.6268C62.4606%2013%2062.3011%2013.0844%2062.1836%2013.2345C62.066%2013.3847%2062%2013.5883%2062%2013.8006Z'%20fill='url(%23paint2_linear_1144_162003)'/%3e%3cpath%20d='M86%2026H62V35.5H86V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2026H62V35.5H77V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2039H62V48.5H77V39Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M70.5%2028H69.0716L67.5%2028.9199V30.1738L68.9253%2029.3535H68.9627V34H70.5V28Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.3373%2046.5H71.75V45.3468H69.3341V45.3092L70.0472%2044.6561C71.3396%2043.5376%2071.6772%2042.9682%2071.6772%2042.289C71.6772%2041.2225%2070.8011%2040.5%2069.4476%2040.5C68.129%2040.5%2067.2471%2041.2543%2067.25%2042.4595H68.6151C68.6151%2041.9249%2068.947%2041.6156%2069.4418%2041.6156C69.9279%2041.6156%2070.2801%2041.9133%2070.2801%2042.4017C70.2801%2042.8439%2070.0006%2043.1445%2069.5116%2043.5809L67.3373%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7744%2020.5C69.5264%2020.5%2070.0464%2020.2377%2070.3415%2019.7415H70.3837V20.4178H72V17.1182C72%2016.091%2070.9845%2015.5%2069.6107%2015.5C68.1595%2015.5%2067.3373%2016.1574%2067.2003%2017.0424L68.785%2017.0929C68.8587%2016.7832%2069.1434%2016.5936%2069.5966%2016.5936C70.0183%2016.5936%2070.2853%2016.7769%2070.2853%2017.1024V17.1182C70.2853%2017.4153%2069.9269%2017.4785%2069.0063%2017.5512C67.9136%2017.6334%2067%2017.9968%2067%2019.0714C67%2020.0322%2067.7414%2020.5%2068.7744%2020.5ZM69.305%2019.4886C68.9079%2019.4886%2068.6268%2019.318%2068.6268%2018.9956C68.6268%2018.6827%2068.9009%2018.493%2069.3893%2018.4267C69.7091%2018.3856%2070.1026%2018.3224%2070.2959%2018.2307V18.6922C70.2959%2019.1662%2069.8531%2019.4886%2069.305%2019.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_162003)'%3e%3cpath%20d='M29.675%200.75H22.325C21.9073%200.75%2021.5067%200.915937%2021.2113%201.21131C20.9159%201.50668%2020.75%201.90728%2020.75%202.325V2.93925C20.7499%203.15604%2020.7946%203.37052%2020.8813%203.56925V3.60075C20.9554%203.76926%2021.0605%203.9224%2021.191%204.05225L24.425%207.26525V10.725C24.4248%2010.8142%2024.4474%2010.902%2024.4906%2010.9801C24.5337%2011.0582%2024.5961%2011.124%2024.6717%2011.1712C24.7553%2011.223%2024.8517%2011.2503%2024.95%2011.25C25.0322%2011.2495%2025.1131%2011.2297%2025.1862%2011.1922L27.2862%2010.1422C27.3728%2010.0986%2027.4456%2010.0319%2027.4966%209.9494C27.5476%209.86693%2027.5747%209.77195%2027.575%209.675V7.26525L30.788%204.05225C30.9185%203.9224%2031.0236%203.76926%2031.0977%203.60075V3.56925C31.1916%203.37208%2031.2435%203.15753%2031.25%202.93925V2.325C31.25%201.90728%2031.0841%201.50668%2030.7887%201.21131C30.4933%200.915937%2030.0927%200.75%2029.675%200.75ZM26.6772%206.67725C26.6286%206.72631%2026.5901%206.78448%2026.564%206.84845C26.5378%206.91241%2026.5246%206.98091%2026.525%207.05V9.3495L25.475%209.8745V7.05C25.4754%206.98091%2025.4622%206.91241%2025.436%206.84845C25.4099%206.78448%2025.3714%206.72631%2025.3227%206.67725L22.5402%203.9H29.4597L26.6772%206.67725ZM30.2%202.85H21.8V2.325C21.8%202.18576%2021.8553%202.05223%2021.9538%201.95377C22.0522%201.85531%2022.1858%201.8%2022.325%201.8H29.675C29.8142%201.8%2029.9478%201.85531%2030.0462%201.95377C30.1447%202.05223%2030.2%202.18576%2030.2%202.325V2.85Z'%20fill='%23CCCCDC'%20fill-opacity='0.65'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162003'%20x1='19'%20y1='18.004'%20x2='34'%20y2='18.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162003'%20x1='0'%20y1='18.004'%20x2='15'%20y2='18.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162003'%20x1='62'%20y1='18.004'%20x2='77'%20y2='18.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162003'%3e%3crect%20width='15'%20height='35'%20fill='white'%20transform='translate(19%2013)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162003'%3e%3crect%20width='15'%20height='35'%20fill='white'%20transform='translate(0%2013)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162003'%3e%3crect%20width='15'%20height='35'%20fill='white'%20transform='translate(62%2013)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_162003'%3e%3crect%20width='12'%20height='12'%20fill='white'%20transform='translate(20)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_9 = "data:image/svg+xml,%3csvg%20width='58'%20height='48'%20viewBox='0%200%2058%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1810_47693)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M9.65%209.3H9.3V3.35C9.3%203.25717%209.26313%203.16815%209.19749%203.10251C9.13185%203.03687%209.04283%203%208.95%203H7.725C7.66392%203.00037%207.604%203.01672%207.5512%203.04742C7.49839%203.07812%207.45454%203.1221%207.424%203.175L3.8505%209.3H3.35C3.25717%209.3%203.16815%209.33687%203.10251%209.40251C3.03687%209.46815%203%209.55717%203%209.65C3%209.74283%203.03687%209.83185%203.10251%209.89749C3.16815%209.96313%203.25717%2010%203.35%2010H4.75C4.84283%2010%204.93185%209.96313%204.99749%209.89749C5.06313%209.83185%205.1%209.74283%205.1%209.65C5.1%209.55717%205.06313%209.46815%204.99749%209.40251C4.93185%209.33687%204.84283%209.3%204.75%209.3H4.659L5.884%207.2H8.6V9.3H8.25C8.15717%209.3%208.06815%209.33687%208.00251%209.40251C7.93687%209.46815%207.9%209.55717%207.9%209.65C7.9%209.74283%207.93687%209.83185%208.00251%209.89749C8.06815%209.96313%208.15717%2010%208.25%2010H9.65C9.74283%2010%209.83185%209.96313%209.89749%209.89749C9.96313%209.83185%2010%209.74283%2010%209.65C10%209.55717%209.96313%209.46815%209.89749%209.40251C9.83185%209.33687%209.74283%209.3%209.65%209.3ZM8.6%206.5H6.2935L7.9245%203.7H8.6V6.5Z'%20fill='white'/%3e%3cpath%20d='M6.84608%2027C7.52244%2027%207.9902%2026.7377%208.25569%2026.2415H8.29362V26.9178H9.74747V23.6182C9.74747%2022.591%208.83407%2022%207.59829%2022C6.29298%2022%205.55341%2022.6574%205.43015%2023.5424L6.85556%2023.5929C6.92193%2023.2832%207.17794%2023.0936%207.58565%2023.0936C7.96492%2023.0936%208.20512%2023.2769%208.20512%2023.6024V23.6182C8.20512%2023.9153%207.88274%2023.9785%207.05468%2024.0512C6.07174%2024.1334%205.25%2024.4968%205.25%2025.5714C5.25%2026.5322%205.91688%2027%206.84608%2027ZM7.32333%2025.9886C6.96618%2025.9886%206.71334%2025.818%206.71334%2025.4956C6.71334%2025.1827%206.95986%2024.993%207.39918%2024.9267C7.68679%2024.8856%208.04077%2024.8224%208.2146%2024.7307V25.1922C8.2146%2025.6662%207.81637%2025.9886%207.32333%2025.9886Z'%20fill='%2324292E'/%3e%3cpath%20d='M5%2044.4362H6.56634V43.7145H6.61489C6.81553%2044.1261%207.26214%2044.5%208.01294%2044.5C9.11327%2044.5%2010%2043.729%2010%2042.213C10%2040.642%209.06149%2039.9261%208.02265%2039.9261C7.23625%2039.9261%206.80583%2040.3377%206.61489%2040.7464H6.58252V38.5H5V44.4362ZM6.55016%2042.2101C6.55016%2041.4826%206.88673%2041.0333%207.46602%2041.0333C8.05178%2041.0333%208.3754%2041.4942%208.3754%2042.2101C8.3754%2042.929%208.05178%2043.3957%207.46602%2043.3957C6.88673%2043.3957%206.55016%2042.9319%206.55016%2042.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.9067%2030C29.6011%2030%2034.9327%2026%2034.9327%2024C34.9327%2022%2029.7357%2018%2028.9067%2018C28.0777%2018%2027.4023%2018.5%2027.4023%2019.4756C27.4023%2020.4512%2030.9067%2022.9206%2030.9067%2022.9206C30.9067%2022.9206%2023.2539%2022.25%2023%2022.9206C22.7461%2023.5911%2022.7461%2024.4089%2023%2025.0794C23.2539%2025.75%2030.9067%2025.0794%2030.9067%2025.0794C30.9067%2025.0794%2027.4023%2027.75%2027.4023%2028.5301C27.4023%2029.3103%2028.2123%2030%2028.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M43%201.04083V13H58V0H43.6268C43.4606%200%2043.3011%200.109659%2043.1836%200.304853C43.066%200.500047%2043%200.764787%2043%201.04083Z'%20fill='url(%23paint1_linear_1810_47693)'/%3e%3cpath%20d='M58%2017.5H43V30.5H58V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M58%2035H43V48H58V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52.65%209.3H52.3V3.35C52.3%203.25717%2052.2631%203.16815%2052.1975%203.10251C52.1318%203.03687%2052.0428%203%2051.95%203H50.725C50.6639%203.00037%2050.604%203.01672%2050.5512%203.04742C50.4984%203.07812%2050.4545%203.1221%2050.424%203.175L46.8505%209.3H46.35C46.2572%209.3%2046.1682%209.33687%2046.1025%209.40251C46.0369%209.46815%2046%209.55717%2046%209.65C46%209.74283%2046.0369%209.83185%2046.1025%209.89749C46.1682%209.96313%2046.2572%2010%2046.35%2010H47.75C47.8428%2010%2047.9318%209.96313%2047.9975%209.89749C48.0631%209.83185%2048.1%209.74283%2048.1%209.65C48.1%209.55717%2048.0631%209.46815%2047.9975%209.40251C47.9318%209.33687%2047.8428%209.3%2047.75%209.3H47.659L48.884%207.2H51.6V9.3H51.25C51.1572%209.3%2051.0682%209.33687%2051.0025%209.40251C50.9369%209.46815%2050.9%209.55717%2050.9%209.65C50.9%209.74283%2050.9369%209.83185%2051.0025%209.89749C51.0682%209.96313%2051.1572%2010%2051.25%2010H52.65C52.7428%2010%2052.8318%209.96313%2052.8975%209.89749C52.9631%209.83185%2053%209.74283%2053%209.65C53%209.55717%2052.9631%209.46815%2052.8975%209.40251C52.8318%209.33687%2052.7428%209.3%2052.65%209.3ZM51.6%206.5H49.2935L50.9245%203.7H51.6V6.5Z'%20fill='white'/%3e%3cpath%20d='M49.0114%2026.8182H47.5L49.4631%2021H51.3352L53.2983%2026.8182H51.7869L51.4034%2025.5966H49.3949L49.0114%2026.8182ZM49.7301%2024.5284H51.0682L50.4205%2022.4659H50.375L49.7301%2024.5284Z'%20fill='black'/%3e%3cpath%20d='M48.5%2044.8182V39H50.9261C52.233%2039%2052.9091%2039.5938%2052.9091%2040.4716C52.9091%2041.1364%2052.4602%2041.5994%2051.821%2041.733V41.7898C52.5256%2041.821%2053.1364%2042.3494%2053.1364%2043.1903C53.1364%2044.1307%2052.3977%2044.8182%2051.1108%2044.8182H48.5ZM49.9062%2043.6847H50.7756C51.3835%2043.6847%2051.6676%2043.4403%2051.6676%2043.0284C51.6676%2042.5824%2051.3381%2042.2983%2050.8011%2042.2983H49.9062V43.6847ZM49.9062%2041.392H50.6847C51.1449%2041.392%2051.4744%2041.1534%2051.4744%2040.7443C51.4744%2040.358%2051.1761%2040.1165%2050.7074%2040.1165H49.9062V41.392Z'%20fill='black'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1810_47693'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1810_47693'%20x1='43'%20y1='6.5052'%20x2='58'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_10 = "data:image/svg+xml,%3csvg%20width='122'%20height='48'%20viewBox='0%200%20122%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1702_26101)'%3e%3cpath%20d='M0%201.04083V13H54V0H2.25658C1.6581%200%200%200%200%200C0%200%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1702_26101)'/%3e%3cpath%20d='M54%2018H0V31H54V18Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M4.28977%2028.6364C3.95739%2028.6364%203.64773%2028.5824%203.4375%2028.4972L3.74432%2027.4886C4.15341%2027.6222%204.45455%2027.6165%204.58807%2027.2898L4.64205%2027.1591L3.09091%2022.6364H4.54545L5.34943%2025.75H5.39489L6.21023%2022.6364H7.6733L6.02841%2027.4176C5.78693%2028.1307%205.28977%2028.6364%204.28977%2028.6364ZM9.0554%2028.6364C8.72301%2028.6364%208.41335%2028.5824%208.20312%2028.4972L8.50994%2027.4886C8.91903%2027.6222%209.22017%2027.6165%209.35369%2027.2898L9.40767%2027.1591L7.85653%2022.6364H9.31108L10.1151%2025.75H10.1605L10.9759%2022.6364H12.4389L10.794%2027.4176C10.5526%2028.1307%2010.0554%2028.6364%209.0554%2028.6364ZM13.821%2028.6364C13.4886%2028.6364%2013.179%2028.5824%2012.9688%2028.4972L13.2756%2027.4886C13.6847%2027.6222%2013.9858%2027.6165%2014.1193%2027.2898L14.1733%2027.1591L12.6222%2022.6364H14.0767L14.8807%2025.75H14.9261L15.7415%2022.6364H17.2045L15.5597%2027.4176C15.3182%2028.1307%2014.821%2028.6364%2013.821%2028.6364ZM18.5866%2028.6364C18.2543%2028.6364%2017.9446%2028.5824%2017.7344%2028.4972L18.0412%2027.4886C18.4503%2027.6222%2018.7514%2027.6165%2018.8849%2027.2898L18.9389%2027.1591L17.3878%2022.6364H18.8423L19.6463%2025.75H19.6918L20.5071%2022.6364H21.9702L20.3253%2027.4176C20.0838%2028.1307%2019.5866%2028.6364%2018.5866%2028.6364ZM25.2955%2024.1108V25.1818H22.6023V24.1108H25.2955ZM26.2763%2027V22.6364H27.5973V23.4375H27.6456C27.8274%2022.9062%2028.282%2022.5795%2028.8786%2022.5795C29.4837%2022.5795%2029.9524%2022.9148%2030.0689%2023.4375H30.1143C30.2763%2022.9176%2030.7848%2022.5795%2031.4297%2022.5795C32.2536%2022.5795%2032.8217%2023.1392%2032.8217%2024.0625V27H31.4325V24.3807C31.4325%2023.946%2031.1825%2023.7102%2030.8303%2023.7102C30.4467%2023.7102%2030.2166%2023.9773%2030.2166%2024.3949V27H28.8814V24.3665C28.8814%2023.9631%2028.6428%2023.7102%2028.282%2023.7102C27.9183%2023.7102%2027.6655%2023.9858%2027.6655%2024.4176V27H26.2763ZM33.6825%2027V22.6364H35.0036V23.4375H35.0518C35.2337%2022.9062%2035.6882%2022.5795%2036.2848%2022.5795C36.8899%2022.5795%2037.3587%2022.9148%2037.4751%2023.4375H37.5206C37.6825%2022.9176%2038.1911%2022.5795%2038.8359%2022.5795C39.6598%2022.5795%2040.228%2023.1392%2040.228%2024.0625V27H38.8388V24.3807C38.8388%2023.946%2038.5888%2023.7102%2038.2365%2023.7102C37.853%2023.7102%2037.6229%2023.9773%2037.6229%2024.3949V27H36.2876V24.3665C36.2876%2023.9631%2036.049%2023.7102%2035.6882%2023.7102C35.3246%2023.7102%2035.0717%2023.9858%2035.0717%2024.4176V27H33.6825ZM43.8814%2024.1108V25.1818H41.1882V24.1108H43.8814ZM46.456%2027.0625C45.4929%2027.0625%2044.7116%2026.3068%2044.7116%2024.821C44.7116%2023.2812%2045.5384%2022.5795%2046.4503%2022.5795C47.1378%2022.5795%2047.5185%2022.983%2047.6832%2023.3835H47.7116V21.1818H49.1009V27H47.7259V26.2926H47.6832C47.5071%2026.696%2047.1151%2027.0625%2046.456%2027.0625ZM46.9389%2025.9801C47.4446%2025.9801%2047.7429%2025.5256%2047.7429%2024.8182C47.7429%2024.1051%2047.4474%2023.6648%2046.9389%2023.6648C46.4219%2023.6648%2046.1378%2024.1165%2046.1378%2024.8182C46.1378%2025.5227%2046.4247%2025.9801%2046.9389%2025.9801Z'%20fill='%2324292E'/%3e%3cpath%20d='M54%2035H0V48H54V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M5.28977%2045.6364C4.95739%2045.6364%204.64773%2045.5824%204.4375%2045.4972L4.74432%2044.4886C5.15341%2044.6222%205.45455%2044.6165%205.58807%2044.2898L5.64205%2044.1591L4.09091%2039.6364H5.54545L6.34943%2042.75H6.39489L7.21023%2039.6364H8.6733L7.02841%2044.4176C6.78693%2045.1307%206.28977%2045.6364%205.28977%2045.6364ZM10.0554%2045.6364C9.72301%2045.6364%209.41335%2045.5824%209.20312%2045.4972L9.50994%2044.4886C9.91903%2044.6222%2010.2202%2044.6165%2010.3537%2044.2898L10.4077%2044.1591L8.85653%2039.6364H10.3111L11.1151%2042.75H11.1605L11.9759%2039.6364H13.4389L11.794%2044.4176C11.5526%2045.1307%2011.0554%2045.6364%2010.0554%2045.6364ZM14.821%2045.6364C14.4886%2045.6364%2014.179%2045.5824%2013.9688%2045.4972L14.2756%2044.4886C14.6847%2044.6222%2014.9858%2044.6165%2015.1193%2044.2898L15.1733%2044.1591L13.6222%2039.6364H15.0767L15.8807%2042.75H15.9261L16.7415%2039.6364H18.2045L16.5597%2044.4176C16.3182%2045.1307%2015.821%2045.6364%2014.821%2045.6364ZM19.5866%2045.6364C19.2543%2045.6364%2018.9446%2045.5824%2018.7344%2045.4972L19.0412%2044.4886C19.4503%2044.6222%2019.7514%2044.6165%2019.8849%2044.2898L19.9389%2044.1591L18.3878%2039.6364H19.8423L20.6463%2042.75H20.6918L21.5071%2039.6364H22.9702L21.3253%2044.4176C21.0838%2045.1307%2020.5866%2045.6364%2019.5866%2045.6364ZM26.2955%2041.1108V42.1818H23.6023V41.1108H26.2955ZM27.2763%2044V39.6364H28.5973V40.4375H28.6456C28.8274%2039.9062%2029.282%2039.5795%2029.8786%2039.5795C30.4837%2039.5795%2030.9524%2039.9148%2031.0689%2040.4375H31.1143C31.2763%2039.9176%2031.7848%2039.5795%2032.4297%2039.5795C33.2536%2039.5795%2033.8217%2040.1392%2033.8217%2041.0625V44H32.4325V41.3807C32.4325%2040.946%2032.1825%2040.7102%2031.8303%2040.7102C31.4467%2040.7102%2031.2166%2040.9773%2031.2166%2041.3949V44H29.8814V41.3665C29.8814%2040.9631%2029.6428%2040.7102%2029.282%2040.7102C28.9183%2040.7102%2028.6655%2040.9858%2028.6655%2041.4176V44H27.2763ZM34.6825%2044V39.6364H36.0036V40.4375H36.0518C36.2337%2039.9062%2036.6882%2039.5795%2037.2848%2039.5795C37.8899%2039.5795%2038.3587%2039.9148%2038.4751%2040.4375H38.5206C38.6825%2039.9176%2039.1911%2039.5795%2039.8359%2039.5795C40.6598%2039.5795%2041.228%2040.1392%2041.228%2041.0625V44H39.8388V41.3807C39.8388%2040.946%2039.5888%2040.7102%2039.2365%2040.7102C38.853%2040.7102%2038.6229%2040.9773%2038.6229%2041.3949V44H37.2876V41.3665C37.2876%2040.9631%2037.049%2040.7102%2036.6882%2040.7102C36.3246%2040.7102%2036.0717%2040.9858%2036.0717%2041.4176V44H34.6825ZM44.8814%2041.1108V42.1818H42.1882V41.1108H44.8814ZM47.456%2044.0625C46.4929%2044.0625%2045.7116%2043.3068%2045.7116%2041.821C45.7116%2040.2812%2046.5384%2039.5795%2047.4503%2039.5795C48.1378%2039.5795%2048.5185%2039.983%2048.6832%2040.3835H48.7116V38.1818H50.1009V44H48.7259V43.2926H48.6832C48.5071%2043.696%2048.1151%2044.0625%2047.456%2044.0625ZM47.9389%2042.9801C48.4446%2042.9801%2048.7429%2042.5256%2048.7429%2041.8182C48.7429%2041.1051%2048.4474%2040.6648%2047.9389%2040.6648C47.4219%2040.6648%2047.1378%2041.1165%2047.1378%2041.8182C47.1378%2042.5227%2047.4247%2042.9801%2047.9389%2042.9801Z'%20fill='%2324292E'/%3e%3cpath%20d='M27%203C26.3078%203%2025.6311%203.20527%2025.0555%203.58986C24.4799%203.97444%2024.0313%204.52107%2023.7664%205.16061C23.5015%205.80015%2023.4322%206.50388%2023.5673%207.18282C23.7023%207.86175%2024.0356%208.48539%2024.5251%208.97487C25.0146%209.46436%2025.6383%209.7977%2026.3172%209.93275C26.9961%2010.0678%2027.6999%209.99848%2028.3394%209.73358C28.9789%209.46867%2029.5256%209.02007%2029.9101%208.44449C30.2947%207.86892%2030.5%207.19223%2030.5%206.5C30.5%206.04037%2030.4095%205.58525%2030.2336%205.16061C30.0577%204.73597%2029.7999%204.35013%2029.4749%204.02513C29.1499%203.70012%2028.764%203.44231%2028.3394%203.26642C27.9148%203.09053%2027.4596%203%2027%203V3ZM27%209.3C26.4462%209.3%2025.9049%209.13578%2025.4444%208.82811C24.9839%208.52045%2024.6251%208.08315%2024.4131%207.57151C24.2012%207.05988%2024.1458%206.49689%2024.2538%205.95375C24.3618%205.4106%2024.6285%204.91169%2025.0201%204.5201C25.4117%204.12851%2025.9106%203.86184%2026.4537%203.7538C26.9969%203.64576%2027.5599%203.70121%2028.0715%203.91314C28.5831%204.12506%2029.0204%204.48395%2029.3281%204.9444C29.6358%205.40486%2029.8%205.94621%2029.8%206.5C29.8%207.24261%2029.505%207.9548%2028.9799%208.4799C28.4548%209.005%2027.7426%209.3%2027%209.3V9.3ZM27%204.4C26.9072%204.4%2026.8182%204.43687%2026.7525%204.50251C26.6869%204.56815%2026.65%204.65717%2026.65%204.75V6.15H25.95C25.8572%206.15%2025.7682%206.18687%2025.7025%206.25251C25.6369%206.31815%2025.6%206.40717%2025.6%206.5C25.6%206.59283%2025.6369%206.68185%2025.7025%206.74749C25.7682%206.81312%2025.8572%206.85%2025.95%206.85H27C27.0928%206.85%2027.1819%206.81312%2027.2475%206.74749C27.3131%206.68185%2027.35%206.59283%2027.35%206.5V4.75C27.35%204.65717%2027.3131%204.56815%2027.2475%204.50251C27.1819%204.43687%2027.0928%204.4%2027%204.4Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M67.9067%2030C68.6011%2030%2073.9327%2026%2073.9327%2024C73.9327%2022%2068.7357%2018%2067.9067%2018C67.0777%2018%2066.4023%2018.5%2066.4023%2019.4756C66.4023%2020.4512%2069.9067%2022.9206%2069.9067%2022.9206C69.9067%2022.9206%2062.2539%2022.25%2062%2022.9206C61.7461%2023.5911%2061.7461%2024.4089%2062%2025.0794C62.2539%2025.75%2069.9067%2025.0794%2069.9067%2025.0794C69.9067%2025.0794%2066.4023%2027.75%2066.4023%2028.5301C66.4023%2029.3103%2067.2123%2030%2067.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M82%201.04083V13H122V0H83.6715H82V1.04083Z'%20fill='url(%23paint1_linear_1702_26101)'/%3e%3cpath%20d='M122%2018H82V31H122V18Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M88.4403%2027.5V23.1364H89.7614V23.9375H89.8097C89.9915%2023.4062%2090.446%2023.0795%2091.0426%2023.0795C91.6477%2023.0795%2092.1165%2023.4148%2092.233%2023.9375H92.2784C92.4403%2023.4176%2092.9489%2023.0795%2093.5938%2023.0795C94.4176%2023.0795%2094.9858%2023.6392%2094.9858%2024.5625V27.5H93.5966V24.8807C93.5966%2024.446%2093.3466%2024.2102%2092.9943%2024.2102C92.6108%2024.2102%2092.3807%2024.4773%2092.3807%2024.8949V27.5H91.0455V24.8665C91.0455%2024.4631%2090.8068%2024.2102%2090.446%2024.2102C90.0824%2024.2102%2089.8295%2024.4858%2089.8295%2024.9176V27.5H88.4403ZM95.8466%2027.5V23.1364H97.1676V23.9375H97.2159C97.3977%2023.4062%2097.8523%2023.0795%2098.4489%2023.0795C99.054%2023.0795%2099.5227%2023.4148%2099.6392%2023.9375H99.6847C99.8466%2023.4176%20100.355%2023.0795%20101%2023.0795C101.824%2023.0795%20102.392%2023.6392%20102.392%2024.5625V27.5H101.003V24.8807C101.003%2024.446%20100.753%2024.2102%20100.401%2024.2102C100.017%2024.2102%2099.7869%2024.4773%2099.7869%2024.8949V27.5H98.4517V24.8665C98.4517%2024.4631%2098.2131%2024.2102%2097.8523%2024.2102C97.4886%2024.2102%2097.2358%2024.4858%2097.2358%2024.9176V27.5H95.8466ZM106.045%2024.6108V25.6818H103.352V24.6108H106.045ZM108.62%2027.5625C107.657%2027.5625%20106.876%2026.8068%20106.876%2025.321C106.876%2023.7812%20107.702%2023.0795%20108.614%2023.0795C109.302%2023.0795%20109.683%2023.483%20109.847%2023.8835H109.876V21.6818H111.265V27.5H109.89V26.7926H109.847C109.671%2027.196%20109.279%2027.5625%20108.62%2027.5625ZM109.103%2026.4801C109.609%2026.4801%20109.907%2026.0256%20109.907%2025.3182C109.907%2024.6051%20109.612%2024.1648%20109.103%2024.1648C108.586%2024.1648%20108.302%2024.6165%20108.302%2025.3182C108.302%2026.0227%20108.589%2026.4801%20109.103%2026.4801ZM113.737%2027.5625C112.774%2027.5625%20111.993%2026.8068%20111.993%2025.321C111.993%2023.7812%20112.82%2023.0795%20113.732%2023.0795C114.419%2023.0795%20114.8%2023.483%20114.964%2023.8835H114.993V21.6818H116.382V27.5H115.007V26.7926H114.964C114.788%2027.196%20114.396%2027.5625%20113.737%2027.5625ZM114.22%2026.4801C114.726%2026.4801%20115.024%2026.0256%20115.024%2025.3182C115.024%2024.6051%20114.729%2024.1648%20114.22%2024.1648C113.703%2024.1648%20113.419%2024.6165%20113.419%2025.3182C113.419%2026.0227%20113.706%2026.4801%20114.22%2026.4801Z'%20fill='%2324292E'/%3e%3cpath%20d='M122%2035H82V48H122V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M102%203C101.308%203%20100.631%203.20527%20100.056%203.58986C99.4799%203.97444%2099.0313%204.52107%2098.7664%205.16061C98.5015%205.80015%2098.4322%206.50388%2098.5673%207.18282C98.7023%207.86175%2099.0356%208.48539%2099.5251%208.97487C100.015%209.46436%20100.638%209.7977%20101.317%209.93275C101.996%2010.0678%20102.7%209.99848%20103.339%209.73358C103.979%209.46867%20104.526%209.02007%20104.91%208.44449C105.295%207.86892%20105.5%207.19223%20105.5%206.5C105.5%206.04037%20105.409%205.58525%20105.234%205.16061C105.058%204.73597%20104.8%204.35013%20104.475%204.02513C104.15%203.70012%20103.764%203.44231%20103.339%203.26642C102.915%203.09053%20102.46%203%20102%203V3ZM102%209.3C101.446%209.3%20100.905%209.13578%20100.444%208.82811C99.9839%208.52045%2099.6251%208.08315%2099.4131%207.57151C99.2012%207.05988%2099.1458%206.49689%2099.2538%205.95375C99.3618%205.4106%2099.6285%204.91169%20100.02%204.5201C100.412%204.12851%20100.911%203.86184%20101.454%203.7538C101.997%203.64576%20102.56%203.70121%20103.072%203.91314C103.583%204.12506%20104.02%204.48395%20104.328%204.9444C104.636%205.40486%20104.8%205.94621%20104.8%206.5C104.8%207.24261%20104.505%207.9548%20103.98%208.4799C103.455%209.005%20102.743%209.3%20102%209.3V9.3ZM102%204.4C101.907%204.4%20101.818%204.43687%20101.753%204.50251C101.687%204.56815%20101.65%204.65717%20101.65%204.75V6.15H100.95C100.857%206.15%20100.768%206.18687%20100.703%206.25251C100.637%206.31815%20100.6%206.40717%20100.6%206.5C100.6%206.59283%20100.637%206.68185%20100.703%206.74749C100.768%206.81312%20100.857%206.85%20100.95%206.85H102C102.093%206.85%20102.182%206.81312%20102.247%206.74749C102.313%206.68185%20102.35%206.59283%20102.35%206.5V4.75C102.35%204.65717%20102.313%204.56815%20102.247%204.50251C102.182%204.43687%20102.093%204.4%20102%204.4Z'%20fill='white'/%3e%3cpath%20d='M93.2898%2045.6364C92.9574%2045.6364%2092.6477%2045.5824%2092.4375%2045.4972L92.7443%2044.4886C93.1534%2044.6222%2093.4545%2044.6165%2093.5881%2044.2898L93.642%2044.1591L92.0909%2039.6364H93.5455L94.3494%2042.75H94.3949L95.2102%2039.6364H96.6733L95.0284%2044.4176C94.7869%2045.1307%2094.2898%2045.6364%2093.2898%2045.6364ZM98.0554%2045.6364C97.723%2045.6364%2097.4134%2045.5824%2097.2031%2045.4972L97.5099%2044.4886C97.919%2044.6222%2098.2202%2044.6165%2098.3537%2044.2898L98.4077%2044.1591L96.8565%2039.6364H98.3111L99.1151%2042.75H99.1605L99.9759%2039.6364H101.439L99.794%2044.4176C99.5526%2045.1307%2099.0554%2045.6364%2098.0554%2045.6364ZM102.821%2045.6364C102.489%2045.6364%20102.179%2045.5824%20101.969%2045.4972L102.276%2044.4886C102.685%2044.6222%20102.986%2044.6165%20103.119%2044.2898L103.173%2044.1591L101.622%2039.6364H103.077L103.881%2042.75H103.926L104.741%2039.6364H106.205L104.56%2044.4176C104.318%2045.1307%20103.821%2045.6364%20102.821%2045.6364ZM107.587%2045.6364C107.254%2045.6364%20106.945%2045.5824%20106.734%2045.4972L107.041%2044.4886C107.45%2044.6222%20107.751%2044.6165%20107.885%2044.2898L107.939%2044.1591L106.388%2039.6364H107.842L108.646%2042.75H108.692L109.507%2039.6364H110.97L109.325%2044.4176C109.084%2045.1307%20108.587%2045.6364%20107.587%2045.6364Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1702_26101'%20x1='0'%20y1='6.5052'%20x2='54'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1702_26101'%20x1='82'%20y1='6.5052'%20x2='122'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1702_26101'%3e%3crect%20width='54'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_11 = "data:image/svg+xml,%3csvg%20width='78'%20height='51'%20viewBox='0%200%2078%2051'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162243)'%3e%3cpath%20d='M2%200.800642V10H26V1.05456e-06H3.00292L2.0002%200L2%200.800642Z'%20fill='url(%23paint0_linear_1144_162243)'/%3e%3cpath%20d='M26%2013H2V22.5H26V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2025.75H2V35.25H26V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2038.5H2V48H26V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15.5%2014.75H14.0716L12.5%2015.6699V16.9238L13.9253%2016.1035H13.9627V20.75H15.5V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2033.5H16.5V32.3468H14.0841V32.3092L14.7972%2031.6561C16.0896%2030.5376%2016.4272%2029.9682%2016.4272%2029.289C16.4272%2028.2225%2015.5511%2027.5%2014.1976%2027.5C12.879%2027.5%2011.9971%2028.2543%2012%2029.4595H13.3651C13.3651%2028.9249%2013.697%2028.6156%2014.1918%2028.6156C14.6779%2028.6156%2015.0301%2028.9133%2015.0301%2029.4017C15.0301%2029.8439%2014.7506%2030.1445%2014.2616%2030.5809L12.0873%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2046.5H16.5V45.3468H14.0841V45.3092L14.7972%2044.6561C16.0896%2043.5376%2016.4272%2042.9682%2016.4272%2042.289C16.4272%2041.2225%2015.5511%2040.5%2014.1976%2040.5C12.879%2040.5%2011.9971%2041.2543%2012%2042.4595H13.3651C13.3651%2041.9249%2013.697%2041.6156%2014.1918%2041.6156C14.6779%2041.6156%2015.0301%2041.9133%2015.0301%2042.4017C15.0301%2042.8439%2014.7506%2043.1445%2014.2616%2043.5809L12.0873%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M39.9067%2030C40.6011%2030%2045.9327%2026%2045.9327%2024C45.9327%2022%2040.7357%2018%2039.9067%2018C39.0777%2018%2038.4023%2018.5%2038.4023%2019.4756C38.4023%2020.4512%2041.9067%2022.9206%2041.9067%2022.9206C41.9067%2022.9206%2034.2539%2022.25%2034%2022.9206C33.7461%2023.5911%2033.7461%2024.4089%2034%2025.0794C34.2539%2025.75%2041.9067%2025.0794%2041.9067%2025.0794C41.9067%2025.0794%2038.4023%2027.75%2038.4023%2028.5301C38.4023%2029.3103%2039.2123%2030%2039.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1144_162243)'%3e%3cpath%20d='M54%200.800642V10H78V1.13097e-06H55.0029C54.7369%201.13097e-06%2054.0001%200%2054.0001%200C54.0001%200%2054%200.588299%2054%200.800642Z'%20fill='url(%23paint1_linear_1144_162243)'/%3e%3cpath%20d='M78%2013H54V29H78V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M78%2032H54V48H78V32Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M67.5%2018H66.0716L64.5%2018.9199V20.1738L65.9253%2019.3535H65.9627V24H67.5V18Z'%20fill='%2324292E'/%3e%3cpath%20d='M64.0873%2043H68.5V41.8468H66.0841V41.8092L66.7972%2041.1561C68.0896%2040.0376%2068.4272%2039.4682%2068.4272%2038.789C68.4272%2037.7225%2067.5511%2037%2066.1976%2037C64.879%2037%2063.9971%2037.7543%2064%2038.9595H65.3651C65.3651%2038.4249%2065.697%2038.1156%2066.1918%2038.1156C66.6779%2038.1156%2067.0301%2038.4133%2067.0301%2038.9017C67.0301%2039.3439%2066.7506%2039.6445%2066.2616%2040.0809L64.0873%2041.9711V43Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26%2025.7421H2V48H26V25.7421ZM0%2023.6179V50H28V23.6179L0%2023.6179Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162243'%20x1='2.00781'%20y1='5.004'%20x2='26.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162243'%20x1='54.001'%20y1='5.004'%20x2='78.001'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162243'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(2)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162243'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(54)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_12 = "data:image/svg+xml,%3csvg%20width='77'%20height='50'%20viewBox='0%200%2077%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162268)'%3e%3cpath%20d='M2%200.800642V10H26V1.05456e-06H3.00292L2.0002%200L2%200.800642Z'%20fill='url(%23paint0_linear_1144_162268)'/%3e%3cpath%20d='M26%2013H2V22.5H26V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2025.75H2V35.25H26V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2038.5H2V48H26V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15.5%2014.75H14.0716L12.5%2015.6699V16.9238L13.9253%2016.1035H13.9627V20.75H15.5V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2033.5H16.5V32.3468H14.0841V32.3092L14.7972%2031.6561C16.0896%2030.5376%2016.4272%2029.9682%2016.4272%2029.289C16.4272%2028.2225%2015.5511%2027.5%2014.1976%2027.5C12.879%2027.5%2011.9971%2028.2543%2012%2029.4595H13.3651C13.3651%2028.9249%2013.697%2028.6156%2014.1918%2028.6156C14.6779%2028.6156%2015.0301%2028.9133%2015.0301%2029.4017C15.0301%2029.8439%2014.7506%2030.1445%2014.2616%2030.5809L12.0873%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2046.5H16.5V45.3468H14.0841V45.3092L14.7972%2044.6561C16.0896%2043.5376%2016.4272%2042.9682%2016.4272%2042.289C16.4272%2041.2225%2015.5511%2040.5%2014.1976%2040.5C12.879%2040.5%2011.9971%2041.2543%2012%2042.4595H13.3651C13.3651%2041.9249%2013.697%2041.6156%2014.1918%2041.6156C14.6779%2041.6156%2015.0301%2041.9133%2015.0301%2042.4017C15.0301%2042.8439%2014.7506%2043.1445%2014.2616%2043.5809L12.0873%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M38.9067%2030C39.6011%2030%2044.9327%2026%2044.9327%2024C44.9327%2022%2039.7357%2018%2038.9067%2018C38.0777%2018%2037.4023%2018.5%2037.4023%2019.4756C37.4023%2020.4512%2040.9067%2022.9206%2040.9067%2022.9206C40.9067%2022.9206%2033.2539%2022.25%2033%2022.9206C32.7461%2023.5911%2032.7461%2024.4089%2033%2025.0794C33.2539%2025.75%2040.9067%2025.0794%2040.9067%2025.0794C40.9067%2025.0794%2037.4023%2027.75%2037.4023%2028.5301C37.4023%2029.3103%2038.2123%2030%2038.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1144_162268)'%3e%3cpath%20d='M63.7933%207.6179C64.5533%207.6179%2065.0788%207.32315%2065.3771%206.76562H65.4197V7.52557H67.0533V3.81818C67.0533%202.66406%2066.027%202%2064.6385%202C63.1719%202%2062.3409%202.73864%2062.2024%203.73295L63.804%203.78977C63.8786%203.44176%2064.1662%203.22869%2064.6243%203.22869C65.0504%203.22869%2065.3203%203.43466%2065.3203%203.80043V3.81818C65.3203%204.15199%2064.9581%204.22301%2064.0277%204.30469C62.9233%204.39702%2062%204.8054%2062%206.01278C62%207.09233%2062.7493%207.6179%2063.7933%207.6179ZM64.3295%206.48153C63.9283%206.48153%2063.6442%206.28977%2063.6442%205.92756C63.6442%205.57599%2063.9212%205.36293%2064.4148%205.28835C64.7379%205.24219%2065.1357%205.17116%2065.331%205.06818V5.58665C65.331%206.11932%2064.8835%206.48153%2064.3295%206.48153Z'%20fill='%2324292E'/%3e%3cpath%20d='M53%200.800642V10H77V1.13097e-06H54.0029C53.7369%201.13097e-06%2053.0001%200%2053.0001%200C53.0001%200%2053%200.588299%2053%200.800642Z'%20fill='url(%23paint1_linear_1144_162268)'/%3e%3cpath%20d='M77%2013H53V29H77V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2032H53V48H77V32Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M67%2017H65.0954L63%2018.2266V19.8984L64.9004%2018.8047H64.9502V25H67V17Z'%20fill='%2324292E'/%3e%3cpath%20d='M61.6524%2038.202H61.2683C61.0645%2038.202%2060.8691%2038.1207%2060.725%2037.9759C60.5809%2037.8311%2060.5%2037.6347%2060.5%2037.43C60.5%2037.2253%2060.5809%2037.0289%2060.725%2036.8841C60.8691%2036.7393%2061.0645%2036.658%2061.2683%2036.658H61.6524V36.272C61.6524%2036.0673%2061.7334%2035.8709%2061.8775%2035.7261C62.0216%2035.5813%2062.217%2035.5%2062.4207%2035.5C62.6245%2035.5%2062.8199%2035.5813%2062.964%2035.7261C63.1081%2035.8709%2063.189%2036.0673%2063.189%2036.272V36.658H63.5732C63.7769%2036.658%2063.9724%2036.7393%2064.1164%2036.8841C64.2605%2037.0289%2064.3415%2037.2253%2064.3415%2037.43C64.3415%2037.6347%2064.2605%2037.8311%2064.1164%2037.9759C63.9724%2038.1207%2063.7769%2038.202%2063.5732%2038.202H63.189V38.588C63.189%2038.7927%2063.1081%2038.9891%2062.964%2039.1339C62.8199%2039.2787%2062.6245%2039.36%2062.4207%2039.36C62.217%2039.36%2062.0216%2039.2787%2061.8775%2039.1339C61.7334%2038.9891%2061.6524%2038.7927%2061.6524%2038.588V38.202Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7317%2042.184H66.4268C66.2231%2042.184%2066.0276%2042.1027%2065.8836%2041.9579C65.7395%2041.8131%2065.6585%2041.6167%2065.6585%2041.412C65.6585%2041.2073%2065.7395%2041.0109%2065.8836%2040.8661C66.0276%2040.7213%2066.2231%2040.64%2066.4268%2040.64H68.7317C68.9355%2040.64%2069.1309%2040.7213%2069.275%2040.8661C69.4191%2041.0109%2069.5%2041.2073%2069.5%2041.412C69.5%2041.6167%2069.4191%2041.8131%2069.275%2041.9579C69.1309%2042.1027%2068.9355%2042.184%2068.7317%2042.184Z'%20fill='%2324292E'/%3e%3cpath%20d='M66.4268%2036.658H68.7317C68.9355%2036.658%2069.1309%2036.7393%2069.275%2036.8841C69.4191%2037.0289%2069.5%2037.2253%2069.5%2037.43C69.5%2037.6347%2069.4191%2037.8311%2069.275%2037.9759C69.1309%2038.1207%2068.9355%2038.202%2068.7317%2038.202H66.4268C66.2231%2038.202%2066.0276%2038.1207%2065.8836%2037.9759C65.7395%2037.8311%2065.6585%2037.6347%2065.6585%2037.43C65.6585%2037.2253%2065.7395%2037.0289%2065.8836%2036.8841C66.0276%2036.7393%2066.2231%2036.658%2066.4268%2036.658Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7317%2044.5H66.4268C66.2231%2044.5%2066.0276%2044.4187%2065.8836%2044.2739C65.7395%2044.1291%2065.6585%2043.9328%2065.6585%2043.728C65.6585%2043.5233%2065.7395%2043.3269%2065.8836%2043.1821C66.0276%2043.0373%2066.2231%2042.956%2066.4268%2042.956H68.7317C68.9355%2042.956%2069.1309%2043.0373%2069.275%2043.1821C69.4191%2043.3269%2069.5%2043.5233%2069.5%2043.728C69.5%2043.9328%2069.4191%2044.1291%2069.275%2044.2739C69.1309%2044.4187%2068.9355%2044.5%2068.7317%2044.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M61.2651%2044.5C61.0621%2044.5%2060.8674%2044.4193%2060.7234%2044.2755C60.5803%2044.1309%2060.5%2043.9352%2060.5%2043.7312C60.5%2043.5273%2060.5803%2043.3316%2060.7234%2043.187L61.2689%2042.6389L60.7234%2042.0907C60.5975%2041.9431%2060.5318%2041.7531%2060.5392%2041.5588C60.5467%2041.3645%2060.6269%2041.1802%2060.7637%2041.0427C60.9005%2040.9052%2061.084%2040.8247%2061.2773%2040.8172C61.4707%2040.8097%2061.6597%2040.8758%2061.8067%2041.0022L62.3522%2041.5503L62.8977%2041.0022C63.0447%2040.8758%2063.2337%2040.8097%2063.4271%2040.8172C63.6204%2040.8247%2063.8039%2040.9052%2063.9407%2041.0427C64.0775%2041.1802%2064.1577%2041.3645%2064.1652%2041.5588C64.1726%2041.7531%2064.1069%2041.9431%2063.981%2042.0907L63.4355%2042.6389L63.981%2043.187C64.1241%2043.3316%2064.2044%2043.5273%2064.2044%2043.7312C64.2044%2043.9352%2064.1241%2044.1309%2063.981%2044.2755C63.837%2044.4193%2063.6423%2044.5%2063.4393%2044.5C63.2364%2044.5%2063.0416%2044.4193%2062.8977%2044.2755L62.3522%2043.7274L61.8067%2044.2755C61.6628%2044.4193%2061.468%2044.5%2061.2651%2044.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26%2025.75H2V47.9532H26V25.75ZM0%2023.7887V50H28V23.7887L0%2023.7887Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162268'%20x1='2.00781'%20y1='5.004'%20x2='26.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162268'%20x1='53.001'%20y1='5.004'%20x2='77.001'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162268'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(2)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162268'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(53)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_13 = "data:image/svg+xml,%3csvg%20width='106'%20height='50'%20viewBox='0%200%20106%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1899_468)'%3e%3cpath%20d='M0%200.800641V10H24V1.05456e-06H1.00292L0.000198677%200L0%200.800641Z'%20fill='url(%23paint0_linear_1899_468)'/%3e%3cpath%20d='M24%2013H0V22.5H24V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2025.75H0V35.25H24V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2038.5H0V48H24V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13%2014.6179H11.5716L10%2015.5378V16.7917L11.4253%2015.9714H11.4627V20.6179H13V14.6179Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2033.5H14.25V32.3468H11.8341V32.3092L12.5472%2031.6561C13.8396%2030.5376%2014.1772%2029.9682%2014.1772%2029.289C14.1772%2028.2225%2013.3011%2027.5%2011.9476%2027.5C10.629%2027.5%209.7471%2028.2543%209.75001%2029.4595H11.1151C11.1151%2028.9249%2011.447%2028.6156%2011.9418%2028.6156C12.4279%2028.6156%2012.7801%2028.9133%2012.7801%2029.4017C12.7801%2029.8439%2012.5006%2030.1445%2012.0116%2030.5809L9.83733%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2046.25H14.25V45.0968H11.8341V45.0592L12.5472%2044.4061C13.8396%2043.2876%2014.1772%2042.7182%2014.1772%2042.039C14.1772%2040.9725%2013.3011%2040.25%2011.9476%2040.25C10.629%2040.25%209.7471%2041.0043%209.75001%2042.2095H11.1151C11.1151%2041.6749%2011.447%2041.3656%2011.9418%2041.3656C12.4279%2041.3656%2012.7801%2041.6633%2012.7801%2042.1517C12.7801%2042.5939%2012.5006%2042.8945%2012.0116%2043.3309L9.83733%2045.2211V46.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1899_468)'%3e%3cpath%20d='M28%200.800641V10H52V1.05456e-06H29.0029L28.0002%200L28%200.800641Z'%20fill='url(%23paint1_linear_1899_468)'/%3e%3cpath%20d='M52%2013H28V22.5H52V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2025.75H28V35.25H52V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2038.5H28V48H52V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M39.9792%2020.875C41.3085%2020.875%2042.2528%2020.1507%2042.25%2019.1355C42.2528%2018.4168%2041.7958%2017.9035%2040.9208%2017.798V17.7524C41.5771%2017.6554%2042.0423%2017.202%2042.0395%2016.5461C42.0423%2015.5936%2041.206%2014.875%2039.9903%2014.875C38.7663%2014.875%2037.8746%2015.605%2037.8635%2016.6431H39.1734C39.1845%2016.2438%2039.5334%2015.9758%2039.9903%2015.9758C40.4251%2015.9758%2040.7214%2016.2467%2040.7186%2016.6374C40.7214%2017.0423%2040.3725%2017.3218%2039.8685%2017.3218H39.3174V18.3256H39.8685C40.4417%2018.3256%2040.8155%2018.6164%2040.81%2019.0271C40.8155%2019.4406%2040.4721%2019.7286%2039.9848%2019.7286C39.5001%2019.7286%2039.1429%2019.4634%2039.1291%2019.0784H37.75C37.7611%2020.1336%2038.6832%2020.875%2039.9792%2020.875Z'%20fill='%2324292E'/%3e%3cpath%20d='M37.5%2032.4453V31.4463L40.0893%2027.5H41.7308V31.4287H42.5V32.4453H41.7308V33.5H40.477V32.4453H37.5ZM40.5012%2031.4287V28.8828H40.4528L38.8204%2031.3818V31.4287H40.5012Z'%20fill='%2324292E'/%3e%3cpath%20d='M40.2102%2046.25C38.8025%2046.25%2037.7766%2045.5188%2037.75%2044.4957H39.1444C39.1776%2044.9552%2039.6391%2045.2673%2040.2102%2045.2673C40.8841%2045.2673%2041.3655%2044.8425%2041.3655%2044.2269C41.3655%2043.6055%2040.8742%2043.1749%2040.1902%2043.172C39.7885%2043.172%2039.3835%2043.3251%2039.1743%2043.5708L37.8961%2043.3714L38.2181%2040.25H42.3748V41.2731H39.4034L39.2274%2042.7558H39.2673C39.5063%2042.4639%2040.0209%2042.2471%2040.6185%2042.2471C41.8436%2042.2471%2042.7533%2043.0621%2042.75%2044.1951C42.7533%2045.3916%2041.7241%2046.25%2040.2102%2046.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M80%200.800641V10H104V1.05456e-06H81.0029L80.0002%200L80%200.800641Z'%20fill='url(%23paint2_linear_1899_468)'/%3e%3cpath%20d='M104%2017H80V24H104V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M104%2033H80V40H104V33Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M104%2041H80V48H104V41Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M91.8577%2023C92.9654%2023%2093.7523%2022.3964%2093.75%2021.5504C93.7523%2020.9515%2093.3715%2020.5238%2092.6423%2020.4358V20.3978C93.1892%2020.317%2093.5769%2019.9392%2093.5746%2019.3926C93.5769%2018.5989%2092.88%2018%2091.8669%2018C90.8469%2018%2090.1038%2018.6084%2090.0946%2019.4734H91.1862C91.1954%2019.1407%2091.4861%2018.9173%2091.8669%2018.9173C92.2292%2018.9173%2092.4761%2019.1431%2092.4738%2019.4686C92.4761%2019.8061%2092.1854%2020.039%2091.7654%2020.039H91.3062V20.8755H91.7654C92.2431%2020.8755%2092.5546%2021.1179%2092.55%2021.4601C92.5546%2021.8047%2092.2685%2022.0447%2091.8623%2022.0447C91.4585%2022.0447%2091.1608%2021.8237%2091.1492%2021.5029H90C90.0092%2022.3821%2090.7777%2023%2091.8577%2023Z'%20fill='%2324292E'/%3e%3cpath%20d='M90%2038.1211V37.2886L92.1578%2034H93.5256V37.2739H94.1667V38.1211H93.5256V39H92.4808V38.1211H90ZM92.501%2037.2739V35.1523H92.4606L91.1003%2037.2349V37.2739H92.501Z'%20fill='%2324292E'/%3e%3cpath%20d='M92.0501%2047C90.877%2047%2090.0221%2046.3907%2090%2045.5381H91.162C91.1897%2045.921%2091.5743%2046.1811%2092.0501%2046.1811C92.6118%2046.1811%2093.0129%2045.8271%2093.0129%2045.3141C93.0129%2044.7962%2092.6035%2044.4374%2092.0335%2044.435C91.6988%2044.435%2091.3612%2044.5626%2091.1869%2044.7673L90.1217%2044.6012L90.3901%2042H93.854V42.8526H91.3778L91.2312%2044.0881H91.2644C91.4636%2043.8449%2091.8924%2043.6643%2092.3904%2043.6643C93.4113%2043.6643%2094.1694%2044.3434%2094.1667%2045.2876C94.1694%2046.2847%2093.3117%2047%2092.0501%2047Z'%20fill='%2324292E'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M104%2033H80V47.579H104V33ZM78%2028V50H106V28L78%2028Z'%20fill='%23CCCCDC'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M104%2017H80V24H104V17ZM78%2012V26H106V12H78Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M65.9067%2031.75C66.6011%2031.75%2071.9327%2027.75%2071.9327%2025.75C71.9327%2023.75%2066.7357%2019.75%2065.9067%2019.75C65.0777%2019.75%2064.4023%2020.25%2064.4023%2021.2256C64.4023%2022.2012%2067.9067%2024.6706%2067.9067%2024.6706C67.9067%2024.6706%2060.2539%2024%2060%2024.6706C59.7461%2025.3411%2059.7461%2026.1589%2060%2026.8294C60.2539%2027.5%2067.9067%2026.8294%2067.9067%2026.8294C67.9067%2026.8294%2064.4023%2029.5%2064.4023%2030.2801C64.4023%2031.0603%2065.2123%2031.75%2065.9067%2031.75Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M81.25%2013H80.1787L79%2013.6899V14.6304L80.069%2014.0151H80.097V17.5H81.25V13Z'%20fill='%2324292E'/%3e%3cpath%20d='M79.0655%2033.5H82.375V32.6351H80.5631V32.6069L81.0979%2032.1171C82.0672%2031.2782%2082.3204%2030.8512%2082.3204%2030.3418C82.3204%2029.5419%2081.6633%2029%2080.6482%2029C79.6593%2029%2078.9978%2029.5658%2079%2030.4697H80.0239C80.0239%2030.0686%2080.2727%2029.8367%2080.6438%2029.8367C81.0084%2029.8367%2081.2726%2030.06%2081.2726%2030.4263C81.2726%2030.7579%2081.063%2030.9834%2080.6962%2031.3107L79.0655%2032.7283V33.5Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1899_468'%20x1='0.00781255'%20y1='5.004'%20x2='24.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1899_468'%20x1='28.0078'%20y1='5.004'%20x2='52.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1899_468'%20x1='80.0078'%20y1='5.004'%20x2='104.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1899_468'%3e%3crect%20width='24'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1899_468'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(28)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_14 = "data:image/svg+xml,%3csvg%20width='188'%20height='48'%20viewBox='0%200%20188%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_161826)'%3e%3cpath%20d='M0%200.800641V10H24V1.05456e-06H1.00292L0.000198677%200L0%200.800641Z'%20fill='url(%23paint0_linear_1144_161826)'/%3e%3cpath%20d='M24%2013H0V22.5H24V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2025.75H0V35.25H24V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2038.5H0V48H24V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13%2014.6179H11.5716L10%2015.5378V16.7917L11.4253%2015.9714H11.4627V20.6179H13V14.6179Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2033.5H14.25V32.3468H11.8341V32.3092L12.5472%2031.6561C13.8396%2030.5376%2014.1772%2029.9682%2014.1772%2029.289C14.1772%2028.2225%2013.3011%2027.5%2011.9476%2027.5C10.629%2027.5%209.7471%2028.2543%209.75001%2029.4595H11.1151C11.1151%2028.9249%2011.447%2028.6156%2011.9418%2028.6156C12.4279%2028.6156%2012.7801%2028.9133%2012.7801%2029.4017C12.7801%2029.8439%2012.5006%2030.1445%2012.0116%2030.5809L9.83733%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2046.25H14.25V45.0968H11.8341V45.0592L12.5472%2044.4061C13.8396%2043.2876%2014.1772%2042.7182%2014.1772%2042.039C14.1772%2040.9725%2013.3011%2040.25%2011.9476%2040.25C10.629%2040.25%209.7471%2041.0043%209.75001%2042.2095H11.1151C11.1151%2041.6749%2011.447%2041.3656%2011.9418%2041.3656C12.4279%2041.3656%2012.7801%2041.6633%2012.7801%2042.1517C12.7801%2042.5939%2012.5006%2042.8945%2012.0116%2043.3309L9.83733%2045.2211V46.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_161826)'%3e%3cpath%20d='M28%200.800641V10H52V1.05456e-06H29.0029L28.0002%200L28%200.800641Z'%20fill='url(%23paint1_linear_1144_161826)'/%3e%3cpath%20d='M52%2013H28V22.5H52V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2025.75H28V35.25H52V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2038.5H28V48H52V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M40.1058%2046.25C41.5564%2046.25%2042.4563%2045.4582%2042.5%2044.2595H40.9654C40.905%2044.7737%2040.5759%2045.0544%2040.1259%2045.0544C39.5484%2045.0544%2039.1723%2044.597%2039.1723%2043.7358C39.1723%2042.8809%2039.5517%2042.4235%2040.1259%2042.4235C40.596%2042.4235%2040.9016%2042.7232%2040.9654%2043.2185H42.5C42.4631%2042.026%2041.5363%2041.25%2040.1024%2041.25C38.4805%2041.25%2037.5%2042.2658%2037.5%2043.7516C37.5%2045.2311%2038.4738%2046.25%2040.1058%2046.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1144_161826)'%3e%3cpath%20d='M56%200.800641V10H80V1.05456e-06H57.0029L56.0002%200L56%200.800641Z'%20fill='url(%23paint2_linear_1144_161826)'/%3e%3cpath%20d='M80%2013H56V22.5H80V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M80%2025.75H56V35.25H80V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M80%2038.5H56V48H80V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M67.5383%2020.75C68.2141%2020.75%2068.616%2020.3761%2068.7966%2019.9645H68.8403V20.6862H70.25V14.75H68.8257V16.9964H68.7966C68.6277%2016.5877%2068.2374%2016.1761%2067.5325%2016.1761C66.5976%2016.1761%2065.75%2016.892%2065.75%2018.463C65.75%2019.979%2066.551%2020.75%2067.5383%2020.75ZM68.0335%2019.6457C67.5063%2019.6457%2067.2121%2019.179%2067.2121%2018.4601C67.2121%2017.7442%2067.5034%2017.2833%2068.0335%2017.2833C68.5549%2017.2833%2068.8578%2017.7326%2068.8578%2018.4601C68.8578%2019.1819%2068.5519%2019.6457%2068.0335%2019.6457Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.0797%2033C69.4177%2033%2070.2975%2032.3849%2070.4834%2031.4322L68.9927%2031.3912C68.8665%2031.7129%2068.5345%2031.8864%2068.1096%2031.8864C67.4854%2031.8864%2067.1003%2031.4921%2067.1003%2030.8991V30.858H70.5V30.4732C70.5%2028.877%2069.4774%2028%2068.0299%2028C66.4894%2028%2065.5%2029.0032%2065.5%2030.5047C65.5%2032.0568%2066.4761%2033%2068.0797%2033ZM67.1003%2029.9621C67.1235%2029.4795%2067.5252%2029.1136%2068.0631%2029.1136C68.5976%2029.1136%2068.9827%2029.4669%2068.9894%2029.9621H67.1003Z'%20fill='%2324292E'/%3e%3cpath%20d='M69.2936%2041.9515H68.4651V41.7108C68.4651%2041.4646%2068.5669%2041.3134%2068.8893%2041.3134C69.0193%2041.3134%2069.1777%2041.3414%2069.2795%2041.3722L69.5%2040.3703C69.336%2040.3256%2068.9599%2040.25%2068.5782%2040.25C67.6932%2040.25%2067.0853%2040.7369%2067.0853%2041.7332V41.9515H66.5V42.959H67.0853V46.25H68.4651V42.959H69.2936V41.9515Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M93.9067%2030C94.6011%2030%2099.9327%2026%2099.9327%2024C99.9327%2022%2094.7357%2018%2093.9067%2018C93.0777%2018%2092.4023%2018.5%2092.4023%2019.4756C92.4023%2020.4512%2095.9067%2022.9206%2095.9067%2022.9206C95.9067%2022.9206%2088.2539%2022.25%2088%2022.9206C87.7461%2023.5911%2087.7461%2024.4089%2088%2025.0794C88.2539%2025.75%2095.9067%2025.0794%2095.9067%2025.0794C95.9067%2025.0794%2092.4023%2027.75%2092.4023%2028.5301C92.4023%2029.3103%2093.2123%2030%2093.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip3_1144_161826)'%3e%3cpath%20d='M108%200.800641V10H132V1.05456e-06H109.003L108%200L108%200.800641Z'%20fill='url(%23paint3_linear_1144_161826)'/%3e%3cpath%20d='M132%2013H108V22.5H132V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M132%2025.75H108V35.25H132V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M132%2038.5H108V48H132V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M120.106%2046.25C121.556%2046.25%20122.456%2045.4582%20122.5%2044.2595H120.965C120.905%2044.7737%20120.576%2045.0544%20120.126%2045.0544C119.548%2045.0544%20119.172%2044.597%20119.172%2043.7358C119.172%2042.8809%20119.552%2042.4235%20120.126%2042.4235C120.596%2042.4235%20120.902%2042.7232%20120.965%2043.2185H122.5C122.463%2042.026%20121.536%2041.25%20120.102%2041.25C118.481%2041.25%20117.5%2042.2658%20117.5%2043.7516C117.5%2045.2311%20118.474%2046.25%20120.106%2046.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M117.75%2033.4362H119.16V32.7145H119.203C119.384%2033.1261%20119.786%2033.5%20120.462%2033.5C121.452%2033.5%20122.25%2032.729%20122.25%2031.213C122.25%2029.642%20121.405%2028.9261%20120.47%2028.9261C119.763%2028.9261%20119.375%2029.3377%20119.203%2029.7464H119.174V27.5H117.75V33.4362ZM119.145%2031.2101C119.145%2030.4826%20119.448%2030.0333%20119.969%2030.0333C120.497%2030.0333%20120.788%2030.4942%20120.788%2031.2101C120.788%2031.929%20120.497%2032.3957%20119.969%2032.3957C119.448%2032.3957%20119.145%2031.9319%20119.145%2031.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M119.346%2020.25C120.022%2020.25%20120.49%2019.9877%20120.756%2019.4915H120.794V20.1678H122.247V16.8682C122.247%2015.841%20121.334%2015.25%20120.098%2015.25C118.793%2015.25%20118.053%2015.9074%20117.93%2016.7924L119.356%2016.8429C119.422%2016.5332%20119.678%2016.3436%20120.086%2016.3436C120.465%2016.3436%20120.705%2016.5269%20120.705%2016.8524V16.8682C120.705%2017.1653%20120.383%2017.2285%20119.555%2017.3012C118.572%2017.3834%20117.75%2017.7468%20117.75%2018.8214C117.75%2019.7822%20118.417%2020.25%20119.346%2020.25ZM119.823%2019.2386C119.466%2019.2386%20119.213%2019.068%20119.213%2018.7456C119.213%2018.4327%20119.46%2018.243%20119.899%2018.1767C120.187%2018.1356%20120.541%2018.0724%20120.715%2017.9807V18.4422C120.715%2018.9162%20120.316%2019.2386%20119.823%2019.2386Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1144_161826)'%3e%3cpath%20d='M136%200.800641V10H160V1.05456e-06H137.003L136%200L136%200.800641Z'%20fill='url(%23paint4_linear_1144_161826)'/%3e%3cpath%20d='M160%2013H136V22.5H160V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M160%2025.75H136V35.25H160V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M160%2038.5H136V48H160V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M149.5%202H148.072L146.5%202.91992V4.17383L147.925%203.35352H147.963V8H149.5V2Z'%20fill='%2324292E'/%3e%3cpath%20d='M147.538%2021C148.214%2021%20148.616%2020.6261%20148.797%2020.2145H148.84V20.9362H150.25V15H148.826V17.2464H148.797C148.628%2016.8377%20148.237%2016.4261%20147.533%2016.4261C146.598%2016.4261%20145.75%2017.142%20145.75%2018.713C145.75%2020.229%20146.551%2021%20147.538%2021ZM148.033%2019.8957C147.506%2019.8957%20147.212%2019.429%20147.212%2018.7101C147.212%2017.9942%20147.503%2017.5333%20148.033%2017.5333C148.555%2017.5333%20148.858%2017.9826%20148.858%2018.7101C148.858%2019.4319%20148.552%2019.8957%20148.033%2019.8957Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip5_1144_161826)'%3e%3cpath%20d='M164%200.800641V10H188V1.05456e-06H165.003L164%200L164%200.800641Z'%20fill='url(%23paint5_linear_1144_161826)'/%3e%3cpath%20d='M188%2013H164V22.5H188V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M188%2025.75H164V35.25H188V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M188%2038.5H164V48H188V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M173.837%208H178.25V6.84682H175.834V6.80925L176.547%206.15607C177.84%205.03757%20178.177%204.46821%20178.177%203.78902C178.177%202.72254%20177.301%202%20175.948%202C174.629%202%20173.747%202.75434%20173.75%203.95954H175.115C175.115%203.42486%20175.447%203.11561%20175.942%203.11561C176.428%203.11561%20176.78%203.41329%20176.78%203.90173C176.78%204.34393%20176.501%204.64451%20176.012%205.08093L173.837%206.9711V8Z'%20fill='%2324292E'/%3e%3cpath%20d='M176.08%2033C177.418%2033%20178.297%2032.3849%20178.483%2031.4322L176.993%2031.3912C176.867%2031.7129%20176.535%2031.8864%20176.11%2031.8864C175.485%2031.8864%20175.1%2031.4921%20175.1%2030.8991V30.858H178.5V30.4732C178.5%2028.877%20177.477%2028%20176.03%2028C174.489%2028%20173.5%2029.0032%20173.5%2030.5047C173.5%2032.0568%20174.476%2033%20176.08%2033ZM175.1%2029.9621C175.124%2029.4795%20175.525%2029.1136%20176.063%2029.1136C176.598%2029.1136%20176.983%2029.4669%20176.989%2029.9621H175.1Z'%20fill='%2324292E'/%3e%3cpath%20d='M177.294%2041.7015H176.465V41.4608C176.465%2041.2146%20176.567%2041.0634%20176.889%2041.0634C177.019%2041.0634%20177.178%2041.0914%20177.279%2041.1222L177.5%2040.1203C177.336%2040.0756%20176.96%2040%20176.578%2040C175.693%2040%20175.085%2040.4869%20175.085%2041.4832V41.7015H174.5V42.709H175.085V46H176.465V42.709H177.294V41.7015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161826'%20x1='0.00781255'%20y1='5.004'%20x2='24.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161826'%20x1='28.0078'%20y1='5.004'%20x2='52.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161826'%20x1='56.0078'%20y1='5.004'%20x2='80.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161826'%20x1='108.008'%20y1='5.004'%20x2='132.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_161826'%20x1='136.008'%20y1='5.004'%20x2='160.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1144_161826'%20x1='164.008'%20y1='5.004'%20x2='188.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161826'%3e%3crect%20width='24'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161826'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(28)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_161826'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(56)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_161826'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(108)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1144_161826'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(136)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip5_1144_161826'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(164)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_15 = "data:image/svg+xml,%3csvg%20width='124'%20height='48'%20viewBox='0%200%20124%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_161649)'%3e%3cpath%20d='M0%200.611699V7.64012H14.394V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1144_161649)'/%3e%3cpath%20d='M33.606%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200L33.606%200V7.64012Z'%20fill='url(%23paint1_linear_1144_161649)'/%3e%3cpath%20d='M31.194%200H16.8V7.64012H31.194V0Z'%20fill='url(%23paint2_linear_1144_161649)'/%3e%3cpath%20d='M31.194%2010.0869H16.8V17.727H31.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2010.0869H0V17.727H14.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2010.0869H33.606V17.727H48V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2020.1799H33.606V27.8262H48V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2020.1799H16.8V27.8262H31.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2020.1799H0V27.8262H14.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2030.2668H16.8V37.907H31.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2030.2668H33.606V37.907H48V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2030.2668H0V37.907H14.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M31.194%2040.3599H16.8V48H31.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M48%2047.3883V40.3721H33.606V48H47.3985C47.558%2048%2047.711%2047.9356%2047.8238%2047.8209C47.9366%2047.7061%2048%2047.5505%2048%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2048V40.3721H0V47.3883C0%2047.5505%200.0633725%2047.7061%200.176176%2047.8209C0.28898%2047.9356%200.441975%2048%200.601504%2048H14.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030.4C62.6011%2030.4%2067.9327%2026.1333%2067.9327%2024C67.9327%2021.8666%2062.7357%2017.6%2061.9067%2017.6C61.0777%2017.6%2060.4023%2018.1333%2060.4023%2019.1739C60.4023%2020.2146%2063.9067%2022.8486%2063.9067%2022.8486C63.9067%2022.8486%2056.2539%2022.1333%2056%2022.8486C55.7461%2023.5639%2055.7461%2024.4361%2056%2025.1514C56.2539%2025.8666%2063.9067%2025.1514%2063.9067%2025.1514C63.9067%2025.1514%2060.4023%2028%2060.4023%2028.8321C60.4023%2029.6643%2061.2123%2030.4%2061.9067%2030.4Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1144_161649)'%3e%3cpath%20d='M81.4059%200H76.5993C76.2683%200%2076%200.268327%2076%200.599326V5.40592C76%205.73692%2076.2683%206.00524%2076.5993%206.00524H81.4059C81.7369%206.00524%2082.0052%205.73692%2082.0052%205.40592V0.599326C82.0052%200.268327%2081.7369%200%2081.4059%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%200H93.3984C93.0674%200%2092.7991%200.268327%2092.7991%200.599326V5.40592C92.7991%205.73692%2093.0674%206.00524%2093.3984%206.00524H98.205C98.536%206.00524%2098.8043%205.73692%2098.8043%205.40592V0.599326C98.8043%200.268327%2098.536%200%2098.205%200Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.608%200H101.801C101.47%200%20101.202%200.268327%20101.202%200.599326V5.40592C101.202%205.73692%20101.47%206.00524%20101.801%206.00524H106.608C106.939%206.00524%20107.207%205.73692%20107.207%205.40592V0.599326C107.207%200.268327%20106.939%200%20106.608%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M115.004%200H110.198C109.867%200%20109.598%200.268327%20109.598%200.599326V5.40592C109.598%205.73692%20109.867%206.00524%20110.198%206.00524H115.004C115.335%206.00524%20115.603%205.73692%20115.603%205.40592V0.599326C115.603%200.268327%20115.335%200%20115.004%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M123.407%208.40253H118.6C118.269%208.40253%20118.001%208.67085%20118.001%209.00185V13.8084C118.001%2014.1394%20118.269%2014.4078%20118.6%2014.4078H123.407C123.738%2014.4078%20124.006%2014.1394%20124.006%2013.8084V9.00185C124.006%208.67085%20123.738%208.40253%20123.407%208.40253Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%2016.7991H93.3984C93.0674%2016.7991%2092.7991%2017.0674%2092.7991%2017.3984V22.205C92.7991%2022.536%2093.0674%2022.8043%2093.3984%2022.8043H98.205C98.536%2022.8043%2098.8043%2022.536%2098.8043%2022.205V17.3984C98.8043%2017.0674%2098.536%2016.7991%2098.205%2016.7991Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.608%2016.7991H101.801C101.47%2016.7991%20101.202%2017.0674%20101.202%2017.3984V22.205C101.202%2022.536%20101.47%2022.8043%20101.801%2022.8043H106.608C106.939%2022.8043%20107.207%2022.536%20107.207%2022.205V17.3984C107.207%2017.0674%20106.939%2016.7991%20106.608%2016.7991Z'%20fill='%233865AB'/%3e%3cpath%20d='M115.004%2016.7991H110.198C109.867%2016.7991%20109.598%2017.0674%20109.598%2017.3984V22.205C109.598%2022.536%20109.867%2022.8043%20110.198%2022.8043H115.004C115.335%2022.8043%20115.603%2022.536%20115.603%2022.205V17.3984C115.603%2017.0674%20115.335%2016.7991%20115.004%2016.7991Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M123.407%2016.7991H118.6C118.269%2016.7991%20118.001%2017.0674%20118.001%2017.3984V22.205C118.001%2022.536%20118.269%2022.8043%20118.6%2022.8043H123.407C123.738%2022.8043%20124.006%2022.536%20124.006%2022.205V17.3984C124.006%2017.0674%20123.738%2016.7991%20123.407%2016.7991Z'%20fill='%233865AB'/%3e%3cpath%20d='M81.4059%2025.2017H76.5993C76.2683%2025.2017%2076%2025.47%2076%2025.801V30.6076C76%2030.9386%2076.2683%2031.2069%2076.5993%2031.2069H81.4059C81.7369%2031.2069%2082.0052%2030.9386%2082.0052%2030.6076V25.801C82.0052%2025.47%2081.7369%2025.2017%2081.4059%2025.2017Z'%20fill='%233865AB'/%3e%3cpath%20d='M106.608%2025.2017H101.801C101.47%2025.2017%20101.202%2025.47%20101.202%2025.801V30.6076C101.202%2030.9386%20101.47%2031.2069%20101.801%2031.2069H106.608C106.939%2031.2069%20107.207%2030.9386%20107.207%2030.6076V25.801C107.207%2025.47%20106.939%2025.2017%20106.608%2025.2017Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M115.004%2025.2017H110.198C109.867%2025.2017%20109.598%2025.47%20109.598%2025.801V30.6076C109.598%2030.9386%20109.867%2031.2069%20110.198%2031.2069H115.004C115.335%2031.2069%20115.603%2030.9386%20115.603%2030.6076V25.801C115.603%2025.47%20115.335%2025.2017%20115.004%2025.2017Z'%20fill='%233865AB'/%3e%3cpath%20d='M123.407%2025.2017H118.6C118.269%2025.2017%20118.001%2025.47%20118.001%2025.801V30.6076C118.001%2030.9386%20118.269%2031.2069%20118.6%2031.2069H123.407C123.738%2031.2069%20124.006%2030.9386%20124.006%2030.6076V25.801C124.006%2025.47%20123.738%2025.2017%20123.407%2025.2017Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M89.8084%2033.5982H85.0019C84.6709%2033.5982%2084.4025%2033.8665%2084.4025%2034.1975V39.0041C84.4025%2039.3351%2084.6709%2039.6035%2085.0019%2039.6035H89.8084C90.1394%2039.6035%2090.4078%2039.3351%2090.4078%2039.0041V34.1975C90.4078%2033.8665%2090.1394%2033.5982%2089.8084%2033.5982Z'%20fill='%233865AB'/%3e%3cpath%20d='M89.8084%2042.0007H85.0019C84.6709%2042.0007%2084.4025%2042.2691%2084.4025%2042.6001V47.4066C84.4025%2047.7376%2084.6709%2048.006%2085.0019%2048.006H89.8084C90.1394%2048.006%2090.4078%2047.7376%2090.4078%2047.4066V42.6001C90.4078%2042.2691%2090.1394%2042.0007%2089.8084%2042.0007Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%2042.0007H93.3984C93.0674%2042.0007%2092.7991%2042.2691%2092.7991%2042.6001V47.4066C92.7991%2047.7376%2093.0674%2048.006%2093.3984%2048.006H98.205C98.536%2048.006%2098.8043%2047.7376%2098.8043%2047.4066V42.6001C98.8043%2042.2691%2098.536%2042.0007%2098.205%2042.0007Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.608%2042.0007H101.801C101.47%2042.0007%20101.202%2042.2691%20101.202%2042.6001V47.4066C101.202%2047.7376%20101.47%2048.006%20101.801%2048.006H106.608C106.939%2048.006%20107.207%2047.7376%20107.207%2047.4066V42.6001C107.207%2042.2691%20106.939%2042.0007%20106.608%2042.0007Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M89.8084%200H85.0019C84.6709%200%2084.4025%200.268327%2084.4025%200.599326V5.40592C84.4025%205.73692%2084.6709%206.00524%2085.0019%206.00524H89.8084C90.1394%206.00524%2090.4078%205.73692%2090.4078%205.40592V0.599326C90.4078%200.268327%2090.1394%200%2089.8084%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M82.0052%2022.205V17.3984C82.0052%2017.0674%2081.7369%2016.7991%2081.4059%2016.7991H76.5993C76.2683%2016.7991%2076%2017.0674%2076%2017.3984V22.205C76%2022.536%2076.2683%2022.8043%2076.5993%2022.8043H81.4059C81.7369%2022.8043%2082.0052%2022.536%2082.0052%2022.205Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124.006%2039.0041V34.1975C124.006%2033.8665%20123.738%2033.5982%20123.407%2033.5982H118.6C118.269%2033.5982%20118.001%2033.8665%20118.001%2034.1975V39.0041C118.001%2039.3351%20118.269%2039.6034%20118.6%2039.6034H123.407C123.738%2039.6034%20124.006%2039.3351%20124.006%2039.0041Z'%20fill='%233865AB'/%3e%3cpath%20d='M124%205.40592V0.599326C124%200.268327%20123.732%200%20123.401%200L118.594%200C118.263%200%20117.995%200.268327%20117.995%200.599326V5.40592C117.995%205.73692%20118.263%206.00524%20118.594%206.00524H123.401C123.732%206.00524%20124%205.73692%20124%205.40592Z'%20fill='%233865AB'/%3e%3cpath%20d='M81.3939%2014.3838H76.5993C76.4404%2014.3838%2076.2879%2014.3207%2076.1755%2014.2083C76.0631%2014.0959%2076%2013.9434%2076%2013.7845V8.98989C76%208.83094%2076.0631%208.6785%2076.1755%208.5661C76.2879%208.45371%2076.4404%208.39056%2076.5993%208.39056H81.3939C81.5529%208.39056%2081.7053%208.45371%2081.8177%208.5661C81.9301%208.6785%2081.9933%208.83094%2081.9933%208.98989V13.7845C81.9933%2013.9434%2081.9301%2014.0959%2081.8177%2014.2083C81.7053%2014.3207%2081.5529%2014.3838%2081.3939%2014.3838ZM90.3838%2013.7845V8.98989C90.3838%208.83094%2090.3207%208.6785%2090.2083%208.5661C90.0959%208.45371%2089.9434%208.39056%2089.7845%208.39056H84.9899C84.8309%208.39056%2084.6785%208.45371%2084.5661%208.5661C84.4537%208.6785%2084.3906%208.83094%2084.3906%208.98989V13.7845C84.3906%2013.9434%2084.4537%2014.0959%2084.5661%2014.2083C84.6785%2014.3207%2084.8309%2014.3838%2084.9899%2014.3838H89.7845C89.9434%2014.3838%2090.0959%2014.3207%2090.2083%2014.2083C90.3207%2014.0959%2090.3838%2013.9434%2090.3838%2013.7845ZM98.7744%2013.7845V8.98989C98.7744%208.83094%2098.7112%208.6785%2098.5988%208.5661C98.4864%208.45371%2098.334%208.39056%2098.1751%208.39056H93.3804C93.2215%208.39056%2093.0691%208.45371%2092.9567%208.5661C92.8443%208.6785%2092.7811%208.83094%2092.7811%208.98989V13.7845C92.7811%2013.9434%2092.8443%2014.0959%2092.9567%2014.2083C93.0691%2014.3207%2093.2215%2014.3838%2093.3804%2014.3838H98.1751C98.2562%2014.3879%2098.3374%2014.3754%2098.4136%2014.3471C98.4898%2014.3188%2098.5595%2014.2753%2098.6183%2014.2192C98.6772%2014.1632%2098.7241%2014.0957%2098.756%2014.021C98.788%2013.9462%2098.8044%2013.8658%2098.8043%2013.7845H98.7744ZM115.556%2013.7845V8.98989C115.556%208.83094%20115.492%208.6785%20115.38%208.5661C115.268%208.45371%20115.115%208.39056%20114.956%208.39056H110.162C110.003%208.39056%20109.85%208.45371%20109.738%208.5661C109.625%208.6785%20109.562%208.83094%20109.562%208.98989V13.7845C109.562%2013.9434%20109.625%2014.0959%20109.738%2014.2083C109.85%2014.3207%20110.003%2014.3838%20110.162%2014.3838H114.956C115.039%2014.3905%20115.122%2014.3799%20115.2%2014.3527C115.279%2014.3256%20115.35%2014.2825%20115.411%2014.2262C115.472%2014.1699%20115.521%2014.1015%20115.554%2014.0255C115.587%2013.9495%20115.604%2013.8674%20115.603%2013.7845H115.556ZM106.566%2014.3838H101.771C101.612%2014.3838%20101.46%2014.3207%20101.347%2014.2083C101.235%2014.0959%20101.172%2013.9434%20101.172%2013.7845V8.98989C101.172%208.83094%20101.235%208.6785%20101.347%208.5661C101.46%208.45371%20101.612%208.39056%20101.771%208.39056H106.566C106.725%208.39056%20106.877%208.45371%20106.989%208.5661C107.102%208.6785%20107.165%208.83094%20107.165%208.98989V13.7845C107.165%2013.9374%20107.107%2014.0846%20107.002%2014.1961C106.898%2014.3075%20106.754%2014.3746%20106.602%2014.3838H106.566Z'%20fill='url(%23paint3_linear_1144_161649)'/%3e%3cpath%20d='M89.8084%2016.7991H85.0019C84.6709%2016.7991%2084.4025%2017.0674%2084.4025%2017.3984V22.205C84.4025%2022.536%2084.6709%2022.8043%2085.0019%2022.8043H89.8084C90.1394%2022.8043%2090.4078%2022.536%2090.4078%2022.205V17.3984C90.4078%2017.0674%2090.1394%2016.7991%2089.8084%2016.7991Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%2033.5982H93.3984C93.0674%2033.5982%2092.7991%2033.8665%2092.7991%2034.1975V39.0041C92.7991%2039.3351%2093.0674%2039.6035%2093.3984%2039.6035H98.205C98.536%2039.6035%2098.8043%2039.3351%2098.8043%2039.0041V34.1975C98.8043%2033.8665%2098.536%2033.5982%2098.205%2033.5982Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M98.205%2031.2009H93.3804C93.2215%2031.2009%2093.0691%2031.1378%2092.9567%2031.0254C92.8443%2030.913%2092.7811%2030.7605%2092.7811%2030.6016V25.807C92.7811%2025.648%2092.8443%2025.4956%2092.9567%2025.3832C93.0691%2025.2708%2093.2215%2025.2076%2093.3804%2025.2076H98.1751C98.334%2025.2076%2098.4864%2025.2708%2098.5988%2025.3832C98.7112%2025.4956%2098.7744%2025.648%2098.7744%2025.807V30.6016C98.7746%2030.7555%2098.7156%2030.9035%2098.6096%2031.0151C98.5036%2031.1267%2098.3587%2031.1932%2098.205%2031.2009ZM89.8145%2031.2009H84.9899C84.8309%2031.2009%2084.6785%2031.1378%2084.5661%2031.0254C84.4537%2030.913%2084.3906%2030.7605%2084.3906%2030.6016V25.807C84.3906%2025.648%2084.4537%2025.4956%2084.5661%2025.3832C84.6785%2025.2708%2084.8309%2025.2076%2084.9899%2025.2076H89.7845C89.9434%2025.2076%2090.0959%2025.2708%2090.2083%2025.3832C90.3207%2025.4956%2090.3838%2025.648%2090.3838%2025.807V30.6016C90.3838%2030.7605%2090.3207%2030.913%2090.2083%2031.0254C90.0959%2031.1378%2089.9434%2031.2009%2089.7845%2031.2009H89.8145ZM82.0232%2038.9921V34.1975C82.0232%2034.0386%2081.9601%2033.8861%2081.8477%2033.7737C81.7353%2033.6613%2081.5829%2033.5982%2081.4239%2033.5982H76.5993C76.4404%2033.5982%2076.2879%2033.6613%2076.1755%2033.7737C76.0631%2033.8861%2076%2034.0386%2076%2034.1975V38.9921C76%2039.1511%2076.0631%2039.3035%2076.1755%2039.4159C76.2879%2039.5283%2076.4404%2039.5915%2076.5993%2039.5915H81.3939C81.5508%2039.5915%2081.7015%2039.53%2081.8135%2039.4202C81.9256%2039.3104%2081.9901%2039.161%2081.9933%2039.0041L82.0232%2038.9921ZM107.195%2038.9921V34.1975C107.195%2034.0386%20107.132%2033.8861%20107.019%2033.7737C106.907%2033.6613%20106.755%2033.5982%20106.596%2033.5982H101.801C101.642%2033.5982%20101.49%2033.6613%20101.377%2033.7737C101.265%2033.8861%20101.202%2034.0386%20101.202%2034.1975V38.9921C101.202%2039.1511%20101.265%2039.3035%20101.377%2039.4159C101.49%2039.5283%20101.642%2039.5915%20101.801%2039.5915H106.596C106.754%2039.5931%20106.906%2039.5323%20107.019%2039.4223C107.132%2039.3123%20107.198%2039.162%20107.201%2039.0041L107.195%2038.9921ZM115.585%2038.9921V34.1975C115.585%2034.0386%20115.522%2033.8861%20115.41%2033.7737C115.298%2033.6613%20115.145%2033.5982%20114.986%2033.5982H110.192C110.033%2033.5982%20109.88%2033.6613%20109.768%2033.7737C109.655%2033.8861%20109.592%2034.0386%20109.592%2034.1975V38.9921C109.592%2039.1511%20109.655%2039.3035%20109.768%2039.4159C109.88%2039.5283%20110.033%2039.5915%20110.192%2039.5915H114.986C115.065%2039.5939%20115.144%2039.5805%20115.218%2039.5522C115.292%2039.5239%20115.36%2039.4812%20115.417%2039.4266C115.475%2039.372%20115.521%2039.3065%20115.553%2039.234C115.585%2039.1615%20115.602%2039.0833%20115.603%2039.0041L115.585%2038.9921Z'%20fill='url(%23paint4_linear_1144_161649)'/%3e%3cpath%20d='M81.4059%2042.0007H76.5993C76.2683%2042.0007%2076%2042.2691%2076%2042.6001V47.4066C76%2047.7376%2076.2683%2048.006%2076.5993%2048.006H81.4059C81.7369%2048.006%2082.0052%2047.7376%2082.0052%2047.4066V42.6001C82.0052%2042.2691%2081.7369%2042.0007%2081.4059%2042.0007Z'%20fill='%233865AB'/%3e%3cpath%20d='M115.004%2042.0007H110.198C109.867%2042.0007%20109.598%2042.2691%20109.598%2042.6001V47.4066C109.598%2047.7376%20109.867%2048.006%20110.198%2048.006H115.004C115.335%2048.006%20115.603%2047.7376%20115.603%2047.4066V42.6001C115.603%2042.2691%20115.335%2042.0007%20115.004%2042.0007Z'%20fill='%233865AB'/%3e%3cpath%20d='M123.407%2042.0007H118.6C118.269%2042.0007%20118.001%2042.2691%20118.001%2042.6001V47.4066C118.001%2047.7376%20118.269%2048.006%20118.6%2048.006H123.407C123.738%2048.006%20124.006%2047.7376%20124.006%2047.4066V42.6001C124.006%2042.2691%20123.738%2042.0007%20123.407%2042.0007Z'%20fill='%2384AFF1'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161649'%20x1='0'%20y1='3.82312'%20x2='14.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161649'%20x1='33.606'%20y1='3.82312'%20x2='48'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161649'%20x1='16.8'%20y1='3.82312'%20x2='31.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161649'%20x1='76'%20y1='11.3992'%20x2='115.603'%20y2='11.3992'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_161649'%20x1='76'%20y1='32.3996'%20x2='115.603'%20y2='32.3996'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161649'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161649'%3e%3crect%20width='48'%20height='48'%20fill='white'%20transform='translate(76)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_16 = "data:image/svg+xml,%3csvg%20width='121'%20height='48'%20viewBox='0%200%20121%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_161622)'%3e%3cpath%20d='M0%200.611699V7.64012H14.394V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1144_161622)'/%3e%3cpath%20d='M33.606%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200L33.606%200V7.64012Z'%20fill='url(%23paint1_linear_1144_161622)'/%3e%3cpath%20d='M31.194%200H16.8V7.64012H31.194V0Z'%20fill='url(%23paint2_linear_1144_161622)'/%3e%3cpath%20d='M31.194%2010.0869H16.8V17.727H31.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2010.0869H0V17.727H14.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2010.0869H33.606V17.727H48V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2020.1799H33.606V27.8262H48V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2020.1799H16.8V27.8262H31.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2020.1799H0V27.8262H14.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2030.2668H16.8V37.907H31.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2030.2668H33.606V37.907H48V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2030.2668H0V37.907H14.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M31.194%2040.3599H16.8V48H31.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M48%2047.3883V40.3721H33.606V48H47.3985C47.558%2048%2047.711%2047.9356%2047.8238%2047.8209C47.9366%2047.7061%2048%2047.5505%2048%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2048V40.3721H0V47.3883C0%2047.5505%200.0633725%2047.7061%200.176176%2047.8209C0.28898%2047.9356%200.441975%2048%200.601504%2048H14.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030C62.6011%2030%2067.9327%2026%2067.9327%2024C67.9327%2022%2062.7357%2018%2061.9067%2018C61.0777%2018%2060.4023%2018.5%2060.4023%2019.4756C60.4023%2020.4512%2063.9067%2022.9206%2063.9067%2022.9206C63.9067%2022.9206%2056.2539%2022.25%2056%2022.9206C55.7461%2023.5911%2055.7461%2024.4089%2056%2025.0794C56.2539%2025.75%2063.9067%2025.0794%2063.9067%2025.0794C63.9067%2025.0794%2060.4023%2027.75%2060.4023%2028.5301C60.4023%2029.3103%2061.2123%2030%2061.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1144_161622)'%3e%3cpath%20d='M87.833%2048H85.4439C85.2855%2048%2085.1336%2047.9371%2085.0216%2047.825C84.9095%2047.7129%2084.8466%2047.5609%2084.8466%2047.4023V28.8144C84.8466%2028.6559%2084.9095%2028.5038%2085.0216%2028.3917C85.1336%2028.2797%2085.2855%2028.2167%2085.4439%2028.2167H87.833C87.9914%2028.2167%2088.1433%2028.2797%2088.2554%2028.3917C88.3674%2028.5038%2088.4303%2028.6559%2088.4303%2028.8144V47.4023C88.4303%2047.5609%2088.3674%2047.7129%2088.2554%2047.825C88.1433%2047.9371%2087.9914%2048%2087.833%2048ZM82.4157%2040.8278H80.0266C79.8682%2040.8278%2079.7162%2040.8908%2079.6042%2041.0029C79.4922%2041.115%2079.4293%2041.267%2079.4293%2041.4255V47.4023C79.4293%2047.5609%2079.4922%2047.7129%2079.6042%2047.825C79.7162%2047.9371%2079.8682%2048%2080.0266%2048H82.4157C82.5741%2048%2082.726%2047.9371%2082.838%2047.825C82.95%2047.7129%2083.013%2047.5609%2083.013%2047.4023V41.4255C83.0114%2041.268%2082.9478%2041.1175%2082.8359%2041.0067C82.7241%2040.8959%2082.5731%2040.8338%2082.4157%2040.8338V40.8278ZM93.2503%209.92756H90.8612C90.7028%209.92756%2090.5509%209.99053%2090.4389%2010.1026C90.3269%2010.2147%2090.2639%2010.3667%2090.2639%2010.5252V47.4023C90.2639%2047.5609%2090.3269%2047.7129%2090.4389%2047.825C90.5509%2047.9371%2090.7028%2048%2090.8612%2048H93.2503C93.4088%2048%2093.5607%2047.9371%2093.6727%2047.825C93.7847%2047.7129%2093.8476%2047.5609%2093.8476%2047.4023V10.5252C93.8476%2010.3667%2093.7847%2010.2147%2093.6727%2010.1026C93.5607%209.99053%2093.4088%209.92756%2093.2503%209.92756ZM98.6677%204.07623H96.2786C96.1202%204.07623%2095.9682%204.1392%2095.8562%204.25129C95.7442%204.36338%2095.6813%204.5154%2095.6813%204.67392V47.4023C95.6813%2047.5609%2095.7442%2047.7129%2095.8562%2047.825C95.9682%2047.9371%2096.1202%2048%2096.2786%2048H98.6677C98.8261%2048%2098.978%2047.9371%2099.09%2047.825C99.202%2047.7129%2099.265%2047.5609%2099.265%2047.4023V4.67392C99.265%204.5154%2099.202%204.36338%2099.09%204.25129C98.978%204.1392%2098.8261%204.07623%2098.6677%204.07623ZM104.085%209.92756H101.696C101.537%209.92756%20101.386%209.99053%20101.274%2010.1026C101.162%2010.2147%20101.099%2010.3667%20101.099%2010.5252V47.4023C101.099%2047.5609%20101.162%2047.7129%20101.274%2047.825C101.386%2047.9371%20101.537%2048%20101.696%2048H104.085C104.243%2048%20104.395%2047.9371%20104.507%2047.825C104.619%2047.7129%20104.682%2047.5609%20104.682%2047.4023V10.5252C104.682%2010.3667%20104.619%2010.2147%20104.507%2010.1026C104.395%209.99053%20104.243%209.92756%20104.085%209.92756ZM109.502%2028.2167H107.113C106.955%2028.2167%20106.803%2028.2797%20106.691%2028.3917C106.579%2028.5038%20106.516%2028.6559%20106.516%2028.8144V47.4023C106.516%2047.5609%20106.579%2047.7129%20106.691%2047.825C106.803%2047.9371%20106.955%2048%20107.113%2048H109.502C109.661%2048%20109.813%2047.9371%20109.925%2047.825C110.037%2047.7129%20110.1%2047.5609%20110.1%2047.4023V28.8144C110.1%2028.6559%20110.037%2028.5038%20109.925%2028.3917C109.813%2028.2797%20109.661%2028.2167%20109.502%2028.2167ZM114.92%2040.8338H112.531C112.372%2040.8338%20112.22%2040.8968%20112.108%2041.0089C111.996%2041.1209%20111.933%2041.273%20111.933%2041.4315V47.4083C111.933%2047.5668%20111.996%2047.7189%20112.108%2047.831C112.22%2047.943%20112.372%2048.006%20112.531%2048.006H114.92C115.078%2048.006%20115.23%2047.943%20115.342%2047.831C115.454%2047.7189%20115.517%2047.5668%20115.517%2047.4083V41.4315C115.517%2041.273%20115.454%2041.1209%20115.342%2041.0089C115.23%2040.8968%20115.078%2040.8338%20114.92%2040.8338ZM120.403%2043.7087H118.014C117.855%2043.7087%20117.703%2043.7716%20117.591%2043.8837C117.479%2043.9958%20117.416%2044.1478%20117.416%2044.3063V47.4023C117.416%2047.5609%20117.479%2047.7129%20117.591%2047.825C117.703%2047.9371%20117.855%2048%20118.014%2048H120.403C120.561%2048%20120.713%2047.9371%20120.825%2047.825C120.937%2047.7129%20121%2047.5609%20121%2047.4023V44.3063C121%2044.1478%20120.937%2043.9958%20120.825%2043.8837C120.713%2043.7716%20120.561%2043.7087%20120.403%2043.7087ZM76.9864%2043.7087H74.5973C74.4389%2043.7087%2074.287%2043.7716%2074.1749%2043.8837C74.0629%2043.9958%2074%2044.1478%2074%2044.3063V47.4023C74%2047.5609%2074.0629%2047.7129%2074.1749%2047.825C74.287%2047.9371%2074.4389%2048%2074.5973%2048H76.9864C77.1448%2048%2077.2967%2047.9371%2077.4087%2047.825C77.5208%2047.7129%2077.5837%2047.5609%2077.5837%2047.4023V44.3063C77.5837%2044.1478%2077.5208%2043.9958%2077.4087%2043.8837C77.2967%2043.7716%2077.1448%2043.7087%2076.9864%2043.7087Z'%20fill='url(%23paint3_linear_1144_161622)'/%3e%3cpath%20d='M74%2042.0231V39.6324C74.4652%2039.6368%2074.9277%2039.562%2075.3678%2039.4113L76.1502%2041.6705C75.4581%2041.907%2074.7314%2042.0262%2074%2042.0231Z'%20fill='%233865AB'/%3e%3cpath%20d='M79.1008%2039.6563L77.309%2038.0486C78.0263%2037.2234%2078.6217%2036.2995%2079.0769%2035.3052L81.2331%2036.3332C80.6874%2037.5387%2079.9691%2038.6582%2079.1008%2039.6563ZM115.863%2039.6145C115.001%2038.6141%20114.287%2037.495%20113.743%2036.2914L115.905%2035.2634C116.349%2036.2573%20116.933%2037.183%20117.637%2038.0127L115.863%2039.6145ZM82.4157%2033.4046L80.1401%2032.6335C80.4805%2031.6414%2080.809%2030.5357%2081.1495%2029.2447L83.4609%2029.8424C83.1026%2031.1991%2082.7621%2032.3646%2082.4038%2033.4046H82.4157ZM112.59%2033.3627C112.238%2032.3227%20111.891%2031.1573%20111.539%2029.8125L113.851%2029.2148C114.191%2030.5058%20114.52%2031.6055%20114.854%2032.6037L112.59%2033.3627ZM84.1896%2026.8958L81.8662%2026.3519C82.135%2025.1984%2082.3918%2024.0209%2082.6546%2022.8315L84.99%2023.3515C84.7511%2024.5469%2084.4584%2025.7363%2084.1896%2026.8958ZM110.798%2026.848C110.53%2025.7004%20110.267%2024.505%20109.998%2023.3097L112.333%2022.7897C112.596%2023.9851%20112.859%2025.1804%20113.122%2026.31L110.798%2026.848ZM85.647%2020.4109L83.3176%2019.879C83.6282%2018.5043%2083.9149%2017.3747%2084.1657%2016.3287L86.4832%2016.9264C86.2204%2017.9305%2085.9456%2019.0542%2085.647%2020.4109ZM109.341%2020.3631C109.025%2018.9765%20108.744%2017.8708%20108.505%2016.8726L110.822%2016.2749C111.079%2017.291%20111.354%2018.4206%20111.671%2019.8252L109.341%2020.3631ZM87.2417%2014.0575L84.9541%2013.3762C85.3424%2012.0672%2085.7306%2010.9197%2086.1487%209.85581L88.3766%2010.7165C88.0063%2011.7206%2087.6359%2012.8143%2087.2656%2014.0575H87.2417ZM107.693%2014.0037C107.322%2012.7665%20106.958%2011.6787%20106.564%2010.6687L108.792%209.80202C109.204%2010.8719%20109.598%2012.0254%20109.986%2013.3224L107.693%2014.0037ZM89.5652%208.08069L87.4388%206.98693C88.0182%205.83371%2088.719%204.74572%2089.5293%203.7415L91.3809%205.27157C90.6776%206.1407%2090.0689%207.08239%2089.5652%208.08069ZM105.411%208.03885C104.905%207.04259%20104.294%206.10294%20103.589%205.23571L105.417%203.69966C106.238%204.69703%20106.947%205.78131%20107.531%206.93313L105.411%208.03885ZM93.328%203.4845L92.008%201.49421C93.1468%200.726757%2094.439%200.216857%2095.7948%200L96.1711%202.39074C95.154%202.53977%2094.1829%202.91339%2093.328%203.4845ZM101.63%203.4845C100.775%202.91445%2099.8039%202.54094%2098.7872%202.39074L99.1455%200C100.502%200.204683%20101.799%200.702305%20102.944%201.45835L101.63%203.4845Z'%20fill='%233865AB'/%3e%3cpath%20d='M121%2042.0231C120.269%2042.0262%20119.542%2041.907%20118.85%2041.6705L119.626%2039.4113C120.069%2039.5586%20120.533%2039.6333%20121%2039.6324V42.0231Z'%20fill='%233865AB'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161622'%20x1='0'%20y1='3.82312'%20x2='14.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161622'%20x1='33.606'%20y1='3.82312'%20x2='48'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161622'%20x1='16.8'%20y1='3.82312'%20x2='31.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161622'%20x1='74'%20y1='26.0411'%20x2='121'%20y2='26.0411'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161622'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161622'%3e%3crect%20width='47'%20height='48'%20fill='white'%20transform='translate(74)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_17 = "data:image/svg+xml,%3csvg%20width='177'%20height='52'%20viewBox='0%200%20177%2052'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_161769)'%3e%3cpath%20d='M0%203.04083V15H15V2H0.626828C0.460583%202%200.301147%202.10966%200.183594%202.30485C0.0660407%202.50005%200%202.76479%200%203.04083Z'%20fill='url(%23paint0_linear_1144_161769)'/%3e%3cpath%20d='M15%2019.5H0V32.5H15V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2037H0V50H15V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M6.77442%2011.5C7.52635%2011.5%208.04638%2011.2377%208.34153%2010.7415H8.3837V11.4178H10V8.1182C10%207.09102%208.98454%206.5%207.61068%206.5C6.15952%206.5%205.33732%207.1574%205.20028%208.04235L6.78496%208.09292C6.85875%207.78319%207.14336%207.59355%207.59663%207.59355C8.01827%207.59355%208.28531%207.77686%208.28531%208.1024V8.1182C8.28531%208.4153%207.92692%208.47851%207.00633%208.5512C5.91356%208.63338%205%208.99684%205%2010.0714C5%2011.0322%205.74139%2011.5%206.77442%2011.5ZM7.30499%2010.4886C6.90794%2010.4886%206.62684%2010.318%206.62684%209.99558C6.62684%209.68268%206.90091%209.49305%207.38932%209.42668C7.70907%209.38559%208.1026%209.32238%208.29585%209.23072V9.69216C8.29585%2010.1662%207.85313%2010.4886%207.30499%2010.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_161769)'%3e%3cpath%20d='M19%2015H34V3.04083C34%202.76479%2033.934%202.50005%2033.8164%202.30485C33.6989%202.10966%2033.5394%202%2033.3732%202H19V15Z'%20fill='url(%23paint1_linear_1144_161769)'/%3e%3cpath%20d='M34%2019.5H19V32.5H34V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2037H19V50H34V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M27.5%2023H26.0716L24.5%2023.9199V25.1738L25.9253%2024.3535H25.9627V29H27.5V23Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.3373%2046.5H28.75V45.3468H26.3341V45.3092L27.0472%2044.6561C28.3396%2043.5376%2028.6772%2042.9682%2028.6772%2042.289C28.6772%2041.2225%2027.8011%2040.5%2026.4476%2040.5C25.129%2040.5%2024.2471%2041.2543%2024.25%2042.4595H25.6151C25.6151%2041.9249%2025.947%2041.6156%2026.4418%2041.6156C26.9279%2041.6156%2027.2801%2041.9133%2027.2801%2042.4017C27.2801%2042.8439%2027.0006%2043.1445%2026.5116%2043.5809L24.3373%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M24%2011.6862H25.5663V10.9645H25.6149C25.8155%2011.3761%2026.2621%2011.75%2027.0129%2011.75C28.1133%2011.75%2029%2010.979%2029%209.46304C29%207.89203%2028.0615%207.17609%2027.0227%207.17609C26.2362%207.17609%2025.8058%207.58768%2025.6149%207.99638H25.5825V5.75H24V11.6862ZM25.5502%209.46015C25.5502%208.73261%2025.8867%208.28333%2026.466%208.28333C27.0518%208.28333%2027.3754%208.7442%2027.3754%209.46015C27.3754%2010.179%2027.0518%2010.6457%2026.466%2010.6457C25.8867%2010.6457%2025.5502%2010.1819%2025.5502%209.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M46.3343%2030H49.674V25.3135H54V21.6954H49.674V17H46.3343V21.6954H42V25.3135H46.3343V30Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip2_1144_161769)'%3e%3cpath%20d='M77%2025.5H62V38.5H77V25.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%209.04083V21H77V8H62.6268C62.4606%208%2062.3011%208.10966%2062.1836%208.30485C62.066%208.50005%2062%208.76479%2062%209.04083Z'%20fill='url(%23paint2_linear_1144_161769)'/%3e%3cpath%20d='M70.5%2029H69.0716L67.5%2029.9199V31.1738L68.9253%2030.3535H68.9627V35H70.5V29Z'%20fill='white'/%3e%3cpath%20d='M67%2017.6862H68.5663V16.9645H68.6149C68.8155%2017.3761%2069.2621%2017.75%2070.0129%2017.75C71.1133%2017.75%2072%2016.979%2072%2015.463C72%2013.892%2071.0615%2013.1761%2070.0227%2013.1761C69.2362%2013.1761%2068.8058%2013.5877%2068.6149%2013.9964H68.5825V11.75H67V17.6862ZM68.5502%2015.4601C68.5502%2014.7326%2068.8867%2014.2833%2069.466%2014.2833C70.0518%2014.2833%2070.3754%2014.7442%2070.3754%2015.4601C70.3754%2016.179%2070.0518%2016.6457%2069.466%2016.6457C68.8867%2016.6457%2068.5502%2016.1819%2068.5502%2015.4601Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_161769)'%3e%3cpath%20d='M96%2025.5H81V38.5H96V25.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M81%2021H96V9.04083C96%208.76479%2095.934%208.50005%2095.8164%208.30485C95.6989%208.10966%2095.5394%208%2095.3732%208H81V21Z'%20fill='url(%23paint3_linear_1144_161769)'/%3e%3cpath%20d='M88.6058%2017.5C90.0564%2017.5%2090.9563%2016.7082%2091%2015.5095H89.4654C89.405%2016.0237%2089.0759%2016.3044%2088.6259%2016.3044C88.0484%2016.3044%2087.6723%2015.847%2087.6723%2014.9858C87.6723%2014.1309%2088.0517%2013.6735%2088.6259%2013.6735C89.096%2013.6735%2089.4016%2013.9732%2089.4654%2014.4685H91C90.9631%2013.276%2090.0363%2012.5%2088.6024%2012.5C86.9805%2012.5%2086%2013.5158%2086%2015.0016C86%2016.4811%2086.9738%2017.5%2088.6058%2017.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M104%2028H116V24.686H104V28ZM104%2022.314H116V19H104V22.314Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M124%203.04083V15H139V2H124.627C124.461%202%20124.301%202.10966%20124.184%202.30485C124.066%202.50005%20124%202.76479%20124%203.04083Z'%20fill='url(%23paint4_linear_1144_161769)'/%3e%3cpath%20d='M139%2019.5H124V32.5H139V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2037H124V50H139V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2032.5V19.5L124%2032.5H139Z'%20fill='%233865AB'/%3e%3cpath%20d='M129.337%2046.5H133.75V45.3468H131.334V45.3092L132.047%2044.6561C133.34%2043.5376%20133.677%2042.9682%20133.677%2042.289C133.677%2041.2225%20132.801%2040.5%20131.448%2040.5C130.129%2040.5%20129.247%2041.2543%20129.25%2042.4595H130.615C130.615%2041.9249%20130.947%2041.6156%20131.442%2041.6156C131.928%2041.6156%20132.28%2041.9133%20132.28%2042.4017C132.28%2042.8439%20132.001%2043.1445%20131.512%2043.5809L129.337%2045.4711V46.5Z'%20fill='white'/%3e%3cpath%20d='M132.5%2023H131.072L129.5%2023.9199V25.1738L130.925%2024.3535H130.963V29H132.5V23Z'%20fill='white'/%3e%3cpath%20d='M129%2011.6862H130.566V10.9645H130.615C130.816%2011.3761%20131.262%2011.75%20132.013%2011.75C133.113%2011.75%20134%2010.979%20134%209.46304C134%207.89203%20133.061%207.17609%20132.023%207.17609C131.236%207.17609%20130.806%207.58768%20130.615%207.99638H130.583V5.75H129V11.6862ZM130.55%209.46015C130.55%208.73261%20130.887%208.28333%20131.466%208.28333C132.052%208.28333%20132.375%208.7442%20132.375%209.46015C132.375%2010.179%20132.052%2010.6457%20131.466%2010.6457C130.887%2010.6457%20130.55%2010.1819%20130.55%209.46015Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip4_1144_161769)'%3e%3cpath%20d='M143%203.04083V15H158V2H143.627C143.461%202%20143%202%20143%202C143%202%20143%202.76479%20143%203.04083Z'%20fill='url(%23paint5_linear_1144_161769)'/%3e%3cpath%20d='M158%2019.5H143V32.5H158V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2037H143V50H158V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M149.774%2011.5C150.526%2011.5%20151.046%2011.2377%20151.342%2010.7415H151.384V11.4178H153V8.1182C153%207.09102%20151.985%206.5%20150.611%206.5C149.16%206.5%20148.337%207.1574%20148.2%208.04235L149.785%208.09292C149.859%207.78319%20150.143%207.59355%20150.597%207.59355C151.018%207.59355%20151.285%207.77686%20151.285%208.1024V8.1182C151.285%208.4153%20150.927%208.47851%20150.006%208.5512C148.914%208.63338%20148%208.99684%20148%2010.0714C148%2011.0322%20148.741%2011.5%20149.774%2011.5ZM150.305%2010.4886C149.908%2010.4886%20149.627%2010.318%20149.627%209.99558C149.627%209.68268%20149.901%209.49305%20150.389%209.42668C150.709%209.38559%20151.103%209.32238%20151.296%209.23072V9.69216C151.296%2010.1662%20150.853%2010.4886%20150.305%2010.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip5_1144_161769)'%3e%3cpath%20d='M162%2015.005H177V3.04584C177%202.76979%20176.934%202.50505%20176.816%202.30986C176.699%202.11466%20176.539%202.005%20176.373%202.005H162V15.005Z'%20fill='url(%23paint6_linear_1144_161769)'/%3e%3cpath%20d='M177%2019.505H162V32.505H177V19.505Z'%20fill='%233865AB'/%3e%3cpath%20d='M177%2037.005H162V50.005H177V37.005Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M162.5%2037.505H176.5V49.505H162.5V37.505Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M169.606%2011.5C171.056%2011.5%20171.956%2010.7082%20172%209.50946H170.465C170.405%2010.0237%20170.076%2010.3044%20169.626%2010.3044C169.048%2010.3044%20168.672%209.847%20168.672%208.9858C168.672%208.13092%20169.052%207.6735%20169.626%207.6735C170.096%207.6735%20170.402%207.97319%20170.465%208.46845H172C171.963%207.27602%20171.036%206.5%20169.602%206.5C167.981%206.5%20167%207.51577%20167%209.00158C167%2010.4811%20167.974%2011.5%20169.606%2011.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3crect%20x='18'%20y='1'%20width='17'%20height='50'%20stroke='white'%20stroke-width='2'/%3e%3crect%20x='18'%20y='1'%20width='17'%20height='50'%20stroke='white'%20stroke-width='2'/%3e%3crect%20x='18'%20y='1'%20width='17'%20height='50'%20stroke='white'%20stroke-width='2'/%3e%3crect%20x='61'%20y='7'%20width='17'%20height='32.5'%20stroke='white'%20stroke-width='2'/%3e%3crect%20x='61'%20y='7'%20width='17'%20height='32.5'%20stroke='white'%20stroke-width='2'/%3e%3crect%20x='61'%20y='7'%20width='17'%20height='32.5'%20stroke='white'%20stroke-width='2'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161769'%20x1='0'%20y1='8.5052'%20x2='15'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161769'%20x1='19'%20y1='8.5052'%20x2='34'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161769'%20x1='62'%20y1='14.5052'%20x2='77'%20y2='14.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161769'%20x1='81'%20y1='14.5052'%20x2='96'%20y2='14.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_161769'%20x1='124'%20y1='8.5052'%20x2='139'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1144_161769'%20x1='143'%20y1='8.5052'%20x2='158'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_1144_161769'%20x1='162'%20y1='8.51021'%20x2='177'%20y2='8.51021'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161769'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(0%202)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161769'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19%202)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_161769'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%208)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_161769'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%208)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1144_161769'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(143%202)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip5_1144_161769'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(162%202)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_18 = "data:image/svg+xml,%3csvg%20width='148'%20height='58'%20viewBox='0%200%20148%2058'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162294)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162294)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162294)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1144_162294)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M6.18549%2052H5V56.9302H6.18549V52Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M7.98978%2056.9928C8.50858%2056.9928%208.86737%2056.793%209.07102%2056.415H9.10011V56.9302H10.2153V54.4169C10.2153%2053.6346%209.51466%2053.1844%208.56676%2053.1844C7.56552%2053.1844%206.99823%2053.6851%206.90369%2054.3592L7.99705%2054.3977C8.04796%2054.1618%208.24433%2054.0173%208.55706%2054.0173C8.84798%2054.0173%209.03223%2054.157%209.03223%2054.4049V54.4169C9.03223%2054.6432%208.78495%2054.6914%208.14978%2054.7468C7.39582%2054.8093%206.7655%2055.0862%206.7655%2055.9047C6.7655%2056.6365%207.27703%2056.9928%207.98978%2056.9928ZM8.35585%2056.2224C8.0819%2056.2224%207.88795%2056.0924%207.88795%2055.8469C7.88795%2055.6086%208.07705%2055.4641%208.41403%2055.4136C8.63464%2055.3823%208.90616%2055.3341%209.0395%2055.2643V55.6158C9.0395%2055.9769%208.73404%2056.2224%208.35585%2056.2224Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M10.9402%2056.9302H12.1135V56.3308H12.1499C12.3002%2056.6726%2012.6347%2056.9831%2013.1972%2056.9831C14.0214%2056.9831%2014.6857%2056.3428%2014.6857%2055.0838C14.6857%2053.779%2013.9827%2053.1844%2013.2045%2053.1844C12.6153%2053.1844%2012.2929%2053.5262%2012.1499%2053.8657H12.1256V52H10.9402V56.9302ZM12.1014%2055.0814C12.1014%2054.4771%2012.3535%2054.104%2012.7875%2054.104C13.2263%2054.104%2013.4687%2054.4868%2013.4687%2055.0814C13.4687%2055.6784%2013.2263%2056.066%2012.7875%2056.066C12.3535%2056.066%2012.1014%2055.6808%2012.1014%2055.0814Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M17.0476%2057C18.0246%2057%2018.667%2056.5306%2018.8028%2055.8036L17.7143%2055.7723C17.6221%2056.0178%2017.3797%2056.1502%2017.0694%2056.1502C16.6136%2056.1502%2016.3324%2055.8493%2016.3324%2055.3967V55.3654H18.8149V55.0717C18.8149%2053.8536%2018.0682%2053.1844%2017.0112%2053.1844C15.8863%2053.1844%2015.1639%2053.9499%2015.1639%2055.0958C15.1639%2056.2802%2015.8766%2057%2017.0476%2057ZM16.3324%2054.6818C16.3494%2054.3134%2016.6427%2054.0342%2017.0355%2054.0342C17.4258%2054.0342%2017.707%2054.3038%2017.7118%2054.6818H16.3324Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M20.6059%2052H19.4204V56.9302H20.6059V52Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M21.5932%2056.2537H25.0623V55.2884H21.5932V56.2537ZM21.5932%2054.5975H25.0623V53.6322H21.5932V54.5975Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M28.3333%2052H27.2206L25.9963%2052.7559V53.7862L27.1066%2053.1122H27.1357V56.9302H28.3333V52Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M46.3343%2035H49.674V30.674H54V27.3343H49.674V23H46.3343V27.3343H42V30.674H46.3343V35Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip2_1144_162294)'%3e%3cpath%20d='M77%2027H62V40H77V27Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%2010.5408V22.5H77V9.5H62.6268C62.4606%209.5%2062.3011%209.60966%2062.1836%209.80485C62.066%2010%2062%2010.2648%2062%2010.5408Z'%20fill='url(%23paint2_linear_1144_162294)'/%3e%3cpath%20d='M69.4792%2036.5C70.8085%2036.5%2071.7528%2035.7757%2071.75%2034.7605C71.7528%2034.0418%2071.2958%2033.5285%2070.4208%2033.423V33.3774C71.0771%2033.2804%2071.5423%2032.827%2071.5395%2032.1711C71.5423%2031.2186%2070.706%2030.5%2069.4903%2030.5C68.2663%2030.5%2067.3746%2031.23%2067.3635%2032.2681H68.6734C68.6845%2031.8688%2069.0334%2031.6008%2069.4903%2031.6008C69.9251%2031.6008%2070.2214%2031.8717%2070.2186%2032.2624C70.2214%2032.6673%2069.8725%2032.9468%2069.3685%2032.9468H68.8174V33.9506H69.3685C69.9417%2033.9506%2070.3155%2034.2414%2070.31%2034.6521C70.3155%2035.0656%2069.9721%2035.3536%2069.4848%2035.3536C69.0001%2035.3536%2068.6429%2035.0884%2068.6291%2034.7034H67.25C67.2611%2035.7586%2068.1832%2036.5%2069.4792%2036.5Z'%20fill='white'/%3e%3cpath%20d='M67%2019.4362H68.5663V18.7145H68.6149C68.8155%2019.1261%2069.2621%2019.5%2070.0129%2019.5C71.1133%2019.5%2072%2018.729%2072%2017.213C72%2015.642%2071.0615%2014.9261%2070.0227%2014.9261C69.2362%2014.9261%2068.8058%2015.3377%2068.6149%2015.7464H68.5825V13.5H67V19.4362ZM68.5502%2017.2101C68.5502%2016.4826%2068.8867%2016.0333%2069.466%2016.0333C70.0518%2016.0333%2070.3754%2016.4942%2070.3754%2017.2101C70.3754%2017.929%2070.0518%2018.3957%2069.466%2018.3957C68.8867%2018.3957%2068.5502%2017.9319%2068.5502%2017.2101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_162294)'%3e%3cpath%20d='M96%2027H81V40H96V27Z'%20fill='%233865AB'/%3e%3cpath%20d='M81%2022.5H96V10.5408C96%2010.2648%2095.934%2010%2095.8164%209.80485C95.6989%209.60966%2095.5394%209.5%2095.3732%209.5H81V22.5Z'%20fill='url(%23paint3_linear_1144_162294)'/%3e%3cpath%20d='M88.6058%2019.5C90.0564%2019.5%2090.9563%2018.7082%2091%2017.5095H89.4654C89.405%2018.0237%2089.0759%2018.3044%2088.6259%2018.3044C88.0484%2018.3044%2087.6723%2017.847%2087.6723%2016.9858C87.6723%2016.1309%2088.0517%2015.6735%2088.6259%2015.6735C89.096%2015.6735%2089.4016%2015.9732%2089.4654%2016.4685H91C90.9631%2015.276%2090.0363%2014.5%2088.6024%2014.5C86.9805%2014.5%2086%2015.5158%2086%2017.0016C86%2018.4811%2086.9738%2019.5%2088.6058%2019.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M68.1855%2043.75H67V48.6802H68.1855V43.75Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M69.9898%2048.7428C70.5086%2048.7428%2070.8674%2048.543%2071.071%2048.165H71.1001V48.6802H72.2153V46.1669C72.2153%2045.3846%2071.5147%2044.9344%2070.5668%2044.9344C69.5655%2044.9344%2068.9982%2045.4351%2068.9037%2046.1092L69.997%2046.1477C70.048%2045.9118%2070.2443%2045.7673%2070.5571%2045.7673C70.848%2045.7673%2071.0322%2045.907%2071.0322%2046.1549V46.1669C71.0322%2046.3932%2070.7849%2046.4414%2070.1498%2046.4968C69.3958%2046.5593%2068.7655%2046.8362%2068.7655%2047.6547C68.7655%2048.3865%2069.277%2048.7428%2069.9898%2048.7428ZM70.3558%2047.9724C70.0819%2047.9724%2069.888%2047.8424%2069.888%2047.5969C69.888%2047.3586%2070.077%2047.2141%2070.414%2047.1636C70.6346%2047.1323%2070.9062%2047.0841%2071.0395%2047.0143V47.3658C71.0395%2047.7269%2070.734%2047.9724%2070.3558%2047.9724Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M72.9402%2048.6802H74.1135V48.0808H74.1499C74.3002%2048.4226%2074.6347%2048.7331%2075.1972%2048.7331C76.0214%2048.7331%2076.6857%2048.0928%2076.6857%2046.8338C76.6857%2045.529%2075.9827%2044.9344%2075.2045%2044.9344C74.6153%2044.9344%2074.2929%2045.2762%2074.1499%2045.6157H74.1256V43.75H72.9402V48.6802ZM74.1014%2046.8314C74.1014%2046.2271%2074.3535%2045.854%2074.7875%2045.854C75.2263%2045.854%2075.4687%2046.2368%2075.4687%2046.8314C75.4687%2047.4284%2075.2263%2047.816%2074.7875%2047.816C74.3535%2047.816%2074.1014%2047.4308%2074.1014%2046.8314Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M79.0476%2048.75C80.0246%2048.75%2080.667%2048.2806%2080.8028%2047.5536L79.7143%2047.5223C79.6221%2047.7678%2079.3797%2047.9002%2079.0694%2047.9002C78.6136%2047.9002%2078.3324%2047.5993%2078.3324%2047.1467V47.1154H80.8149V46.8217C80.8149%2045.6036%2080.0682%2044.9344%2079.0112%2044.9344C77.8863%2044.9344%2077.1639%2045.6999%2077.1639%2046.8458C77.1639%2048.0302%2077.8766%2048.75%2079.0476%2048.75ZM78.3324%2046.4318C78.3494%2046.0634%2078.6427%2045.7842%2079.0355%2045.7842C79.4258%2045.7842%2079.707%2046.0538%2079.7118%2046.4318H78.3324Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M82.6059%2043.75H81.4204V48.6802H82.6059V43.75Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M83.5932%2048.0037H87.0623V47.0384H83.5932V48.0037ZM83.5932%2046.3475H87.0623V45.3822H83.5932V46.3475Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M90.3333%2043.75H89.2206L87.9963%2044.5059V45.5362L89.1066%2044.8622H89.1357V48.6802H90.3333V43.75Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M109.907%2035C110.601%2035%20115.933%2031%20115.933%2029C115.933%2027%20110.736%2023%20109.907%2023C109.078%2023%20108.402%2023.5%20108.402%2024.4756C108.402%2025.4512%20111.907%2027.9206%20111.907%2027.9206C111.907%2027.9206%20104.254%2027.25%20104%2027.9206C103.746%2028.5911%20103.746%2029.4089%20104%2030.0794C104.254%2030.75%20111.907%2030.0794%20111.907%2030.0794C111.907%2030.0794%20108.402%2032.75%20108.402%2033.5301C108.402%2034.3103%20109.212%2035%20109.907%2035Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip4_1144_162294)'%3e%3cpath%20d='M124%205.80064V15H148V5H125.003L124%205L124%205.80064Z'%20fill='url(%23paint4_linear_1144_162294)'/%3e%3cpath%20d='M134.774%2012.5C135.526%2012.5%20136.046%2012.2377%20136.342%2011.7415H136.384V12.4178H138V9.1182C138%208.09102%20136.985%207.5%20135.611%207.5C134.16%207.5%20133.337%208.1574%20133.2%209.04235L134.785%209.09292C134.859%208.78319%20135.143%208.59355%20135.597%208.59355C136.018%208.59355%20136.285%208.77686%20136.285%209.1024V9.1182C136.285%209.4153%20135.927%209.47851%20135.006%209.5512C133.914%209.63338%20133%209.99684%20133%2011.0714C133%2012.0322%20133.741%2012.5%20134.774%2012.5ZM135.305%2011.4886C134.908%2011.4886%20134.627%2011.318%20134.627%2010.9956C134.627%2010.6827%20134.901%2010.493%20135.389%2010.4267C135.709%2010.3856%20136.103%2010.3224%20136.296%2010.2307V10.6922C136.296%2011.1662%20135.853%2011.4886%20135.305%2011.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M148%2018H124V27.5H148V18Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M148%2030.75H124V40.25H148V30.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M148%2043.5H124V53H148V43.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M137%2019.75H135.572L134%2020.6699V21.9238L135.425%2021.1035H135.463V25.75H137V19.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M134.087%2038.5H138.5V37.3468H136.084V37.3092L136.797%2036.6561C138.09%2035.5376%20138.427%2034.9682%20138.427%2034.289C138.427%2033.2225%20137.551%2032.5%20136.198%2032.5C134.879%2032.5%20133.997%2033.2543%20134%2034.4595H135.365C135.365%2033.9249%20135.697%2033.6156%20136.192%2033.6156C136.678%2033.6156%20137.03%2033.9133%20137.03%2034.4017C137.03%2034.8439%20136.751%2035.1445%20136.262%2035.5809L134.087%2037.4711V38.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M135.979%2051.25C137.308%2051.25%20138.253%2050.5257%20138.25%2049.5105C138.253%2048.7918%20137.796%2048.2785%20136.921%2048.173V48.1274C137.577%2048.0304%20138.042%2047.577%20138.04%2046.9211C138.042%2045.9686%20137.206%2045.25%20135.99%2045.25C134.766%2045.25%20133.875%2045.98%20133.864%2047.0181H135.173C135.184%2046.6188%20135.533%2046.3508%20135.99%2046.3508C136.425%2046.3508%20136.721%2046.6217%20136.719%2047.0124C136.721%2047.4173%20136.372%2047.6968%20135.868%2047.6968H135.317V48.7006H135.868C136.442%2048.7006%20136.816%2048.9914%20136.81%2049.4021C136.816%2049.8156%20136.472%2050.1036%20135.985%2050.1036C135.5%2050.1036%20135.143%2049.8384%20135.129%2049.4534H133.75C133.761%2050.5086%20134.683%2051.25%20135.979%2051.25Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162294'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162294'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162294'%20x1='62'%20y1='16.0052'%20x2='77'%20y2='16.0052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162294'%20x1='81'%20y1='16.0052'%20x2='96'%20y2='16.0052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_162294'%20x1='124.008'%20y1='10.004'%20x2='148.008'%20y2='10.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162294'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162294'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162294'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%209.5)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_162294'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%209.5)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1144_162294'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(124%205)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_19 = "data:image/svg+xml,%3csvg%20width='125'%20height='58'%20viewBox='0%200%20125%2058'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162685)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162685)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162685)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1144_162685)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0777%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2123%2030%2047.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip2_1144_162685)'%3e%3cpath%20d='M62%201.04083V13H77V0H62.6268C62.4606%200%2062.3011%200.109659%2062.1836%200.304853C62.066%200.500047%2062%200.764787%2062%201.04083Z'%20fill='url(%23paint2_linear_1144_162685)'/%3e%3cpath%20d='M77%2017.5H62V30.5H77V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2035H62V48H77V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M70.5%2021H69.0716L67.5%2021.9199V23.1738L68.9253%2022.3535H68.9627V27H70.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.3373%2044.5H71.75V43.3468H69.3341V43.3092L70.0472%2042.6561C71.3396%2041.5376%2071.6772%2040.9682%2071.6772%2040.289C71.6772%2039.2225%2070.8011%2038.5%2069.4476%2038.5C68.129%2038.5%2067.2471%2039.2543%2067.25%2040.4595H68.6151C68.6151%2039.9249%2068.947%2039.6156%2069.4418%2039.6156C69.9279%2039.6156%2070.2801%2039.9133%2070.2801%2040.4017C70.2801%2040.8439%2070.0006%2041.1445%2069.5116%2041.5809L67.3373%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7744%209.5C69.5264%209.5%2070.0464%209.23767%2070.3415%208.74147H70.3837V9.41783H72V6.1182C72%205.09102%2070.9845%204.5%2069.6107%204.5C68.1595%204.5%2067.3373%205.1574%2067.2003%206.04235L68.785%206.09292C68.8587%205.78319%2069.1434%205.59355%2069.5966%205.59355C70.0183%205.59355%2070.2853%205.77686%2070.2853%206.1024V6.1182C70.2853%206.4153%2069.9269%206.47851%2069.0063%206.5512C67.9136%206.63338%2067%206.99684%2067%208.07143C67%209.03224%2067.7414%209.5%2068.7744%209.5ZM69.305%208.48862C68.9079%208.48862%2068.6268%208.31795%2068.6268%207.99558C68.6268%207.68268%2068.9009%207.49305%2069.3893%207.42668C69.7091%207.38559%2070.1026%207.32238%2070.2959%207.23072V7.69216C70.2959%208.16625%2069.8531%208.48862%2069.305%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_162685)'%3e%3cpath%20d='M96%2017.5H81V30.5H96V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M96%2035H81V48H96V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M81%201.04083V13H96V0H81.6268C81.4606%200%2081%200%2081%200C81%200%2081%200.764787%2081%201.04083Z'%20fill='url(%23paint3_linear_1144_162685)'/%3e%3cpath%20d='M86%209.68623H87.5663V8.96449H87.6149C87.8155%209.37609%2088.2621%209.75%2089.0129%209.75C90.1133%209.75%2091%208.97898%2091%207.46304C91%205.89203%2090.0615%205.17609%2089.0227%205.17609C88.2362%205.17609%2087.8058%205.58768%2087.6149%205.99638H87.5825V3.75H86V9.68623ZM87.5502%207.46015C87.5502%206.73261%2087.8867%206.28333%2088.466%206.28333C89.0518%206.28333%2089.3754%206.7442%2089.3754%207.46015C89.3754%208.17899%2089.0518%208.64565%2088.466%208.64565C87.8867%208.64565%2087.5502%208.18188%2087.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1144_162685)'%3e%3cpath%20d='M100%2013H124V1.04083C124%200.764787%20123.894%200.500047%20123.706%200.304853C123.518%200.109659%20123.263%200%20122.997%200L100%200V13Z'%20fill='url(%23paint4_linear_1144_162685)'/%3e%3cpath%20d='M105.185%204H104V8.93019H105.185V4Z'%20fill='%2324292E'/%3e%3cpath%20d='M106.99%208.99278C107.509%208.99278%20107.867%208.79297%20108.071%208.41502H108.1V8.93019H109.215V6.41695C109.215%205.63457%20108.515%205.1844%20107.567%205.1844C106.566%205.1844%20105.998%205.68512%20105.904%206.35917L106.997%206.39769C107.048%206.16177%20107.244%206.01733%20107.557%206.01733C107.848%206.01733%20108.032%206.15696%20108.032%206.40491V6.41695C108.032%206.64324%20107.785%206.69138%20107.15%206.74675C106.396%206.80934%20105.766%207.08618%20105.766%207.90467C105.766%208.63649%20106.277%208.99278%20106.99%208.99278ZM107.356%208.22244C107.082%208.22244%20106.888%208.09244%20106.888%207.84689C106.888%207.60857%20107.077%207.46413%20107.414%207.41358C107.635%207.38228%20107.906%207.33414%20108.039%207.26432V7.61579C108.039%207.97689%20107.734%208.22244%20107.356%208.22244Z'%20fill='%2324292E'/%3e%3cpath%20d='M109.94%208.93019H111.114V8.33077H111.15C111.3%208.6726%20111.635%208.98315%20112.197%208.98315C113.021%208.98315%20113.686%208.3428%20113.686%207.08377C113.686%205.77901%20112.983%205.1844%20112.204%205.1844C111.615%205.1844%20111.293%205.52624%20111.15%205.86567H111.126V4H109.94V8.93019ZM111.101%207.08137C111.101%206.47713%20111.354%206.104%20111.787%206.104C112.226%206.104%20112.469%206.48676%20112.469%207.08137C112.469%207.67838%20112.226%208.06596%20111.787%208.06596C111.354%208.06596%20111.101%207.68079%20111.101%207.08137Z'%20fill='%2324292E'/%3e%3cpath%20d='M116.048%209C117.025%209%20117.667%208.53057%20117.803%207.80356L116.714%207.77227C116.622%208.01781%20116.38%208.15022%20116.069%208.15022C115.614%208.15022%20115.332%207.8493%20115.332%207.39673V7.36543H117.815V7.07174C117.815%205.85363%20117.068%205.1844%20116.011%205.1844C114.886%205.1844%20114.164%205.94993%20114.164%207.09581C114.164%208.28021%20114.877%209%20116.048%209ZM115.332%206.68175C115.349%206.31343%20115.643%206.03418%20116.035%206.03418C116.426%206.03418%20116.707%206.3038%20116.712%206.68175H115.332Z'%20fill='%2324292E'/%3e%3cpath%20d='M119.606%204H118.42V8.93019H119.606V4Z'%20fill='%2324292E'/%3e%3cpath%20d='M124%2017.5H100V30.5H124V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2035H100V48H124V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M113.5%2021H112.072L110.5%2021.9199V23.1738L111.925%2022.3535H111.963V27H113.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2039H112.072L110.5%2039.9199V41.1738L111.925%2040.3535H111.963V45H113.5V39Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M9.18549%2051H8V55.9302H9.18549V51Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M10.9898%2055.9928C11.5086%2055.9928%2011.8674%2055.793%2012.071%2055.415H12.1001V55.9302H13.2153V53.4169C13.2153%2052.6346%2012.5147%2052.1844%2011.5668%2052.1844C10.5655%2052.1844%209.99823%2052.6851%209.90369%2053.3592L10.997%2053.3977C11.048%2053.1618%2011.2443%2053.0173%2011.5571%2053.0173C11.848%2053.0173%2012.0322%2053.157%2012.0322%2053.4049V53.4169C12.0322%2053.6432%2011.7849%2053.6914%2011.1498%2053.7468C10.3958%2053.8093%209.7655%2054.0862%209.7655%2054.9047C9.7655%2055.6365%2010.277%2055.9928%2010.9898%2055.9928ZM11.3558%2055.2224C11.0819%2055.2224%2010.888%2055.0924%2010.888%2054.8469C10.888%2054.6086%2011.077%2054.4641%2011.414%2054.4136C11.6346%2054.3823%2011.9062%2054.3341%2012.0395%2054.2643V54.6158C12.0395%2054.9769%2011.734%2055.2224%2011.3558%2055.2224Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M13.9402%2055.9302H15.1135V55.3308H15.1499C15.3002%2055.6726%2015.6347%2055.9831%2016.1972%2055.9831C17.0214%2055.9831%2017.6857%2055.3428%2017.6857%2054.0838C17.6857%2052.779%2016.9827%2052.1844%2016.2045%2052.1844C15.6153%2052.1844%2015.2929%2052.5262%2015.1499%2052.8657H15.1256V51H13.9402V55.9302ZM15.1014%2054.0814C15.1014%2053.4771%2015.3535%2053.104%2015.7875%2053.104C16.2263%2053.104%2016.4687%2053.4868%2016.4687%2054.0814C16.4687%2054.6784%2016.2263%2055.066%2015.7875%2055.066C15.3535%2055.066%2015.1014%2054.6808%2015.1014%2054.0814Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M20.0476%2056C21.0246%2056%2021.667%2055.5306%2021.8028%2054.8036L20.7143%2054.7723C20.6221%2055.0178%2020.3797%2055.1502%2020.0694%2055.1502C19.6136%2055.1502%2019.3324%2054.8493%2019.3324%2054.3967V54.3654H21.8149V54.0717C21.8149%2052.8536%2021.0682%2052.1844%2020.0112%2052.1844C18.8863%2052.1844%2018.1639%2052.9499%2018.1639%2054.0958C18.1639%2055.2802%2018.8766%2056%2020.0476%2056ZM19.3324%2053.6818C19.3494%2053.3134%2019.6427%2053.0342%2020.0355%2053.0342C20.4258%2053.0342%2020.707%2053.3038%2020.7118%2053.6818H19.3324Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M23.6059%2051H22.4204V55.9302H23.6059V51Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M24.5932%2055.2537H28.0623V54.2884H24.5932V55.2537ZM24.5932%2053.5975H28.0623V52.6322H24.5932V53.5975Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M31.3333%2051H30.2206L28.9963%2051.7559V52.7862L30.1066%2052.1122H30.1357V55.9302H31.3333V51Z'%20fill='%23CCCCDC'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162685'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162685'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162685'%20x1='62'%20y1='6.5052'%20x2='77'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162685'%20x1='81'%20y1='6.5052'%20x2='96'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_162685'%20x1='100'%20y1='6.5052'%20x2='124'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162685'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162685'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162685'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(62)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_162685'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(81)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1144_162685'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(100)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_20 = "data:image/svg+xml,%3csvg%20width='108'%20height='48'%20viewBox='0%200%20108%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_162397)'%3e%3cpath%20d='M0%200.800642V10H24V1.05456e-06H1.00292L0.000198677%200L0%200.800642Z'%20fill='url(%23paint0_linear_1144_162397)'/%3e%3cpath%20d='M24%2013H0V22.5H24V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2025.75H0V35.25H24V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2038.5H0V48H24V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13%2014.75H11.5716L10%2015.6699V16.9238L11.4253%2016.1035H11.4627V20.75H13V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2033.5H14.25V32.3468H11.8341V32.3092L12.5472%2031.6561C13.8396%2030.5376%2014.1772%2029.9682%2014.1772%2029.289C14.1772%2028.2225%2013.3011%2027.5%2011.9476%2027.5C10.629%2027.5%209.7471%2028.2543%209.75001%2029.4595H11.1151C11.1151%2028.9249%2011.447%2028.6156%2011.9418%2028.6156C12.4279%2028.6156%2012.7801%2028.9133%2012.7801%2029.4017C12.7801%2029.8439%2012.5006%2030.1445%2012.0116%2030.5809L9.83733%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M11.9792%2046.25C13.3085%2046.25%2014.2528%2045.5257%2014.25%2044.5105C14.2528%2043.7918%2013.7958%2043.2785%2012.9208%2043.173V43.1274C13.5771%2043.0304%2014.0423%2042.577%2014.0395%2041.9211C14.0423%2040.9686%2013.206%2040.25%2011.9903%2040.25C10.7663%2040.25%209.87462%2040.98%209.86354%2042.0181H11.1734C11.1845%2041.6188%2011.5334%2041.3508%2011.9903%2041.3508C12.4251%2041.3508%2012.7214%2041.6217%2012.7186%2042.0124C12.7214%2042.4173%2012.3725%2042.6968%2011.8685%2042.6968H11.3174V43.7006H11.8685C12.4417%2043.7006%2012.8155%2043.9914%2012.81%2044.4021C12.8155%2044.8156%2012.4721%2045.1036%2011.9848%2045.1036C11.5001%2045.1036%2011.1429%2044.8384%2011.1291%2044.4534H9.75C9.76108%2045.5086%2010.6832%2046.25%2011.9792%2046.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.7744%207.5C11.5264%207.5%2012.0464%207.23767%2012.3415%206.74147H12.3837V7.41783H14V4.1182C14%203.09102%2012.9845%202.5%2011.6107%202.5C10.1595%202.5%209.33732%203.1574%209.20028%204.04235L10.785%204.09292C10.8587%203.78319%2011.1434%203.59355%2011.5966%203.59355C12.0183%203.59355%2012.2853%203.77686%2012.2853%204.1024V4.1182C12.2853%204.4153%2011.9269%204.47851%2011.0063%204.5512C9.91356%204.63338%209%204.99684%209%206.07143C9%207.03224%209.74139%207.5%2010.7744%207.5ZM11.305%206.48862C10.9079%206.48862%2010.6268%206.31795%2010.6268%205.99558C10.6268%205.68268%2010.9009%205.49305%2011.3893%205.42668C11.7091%205.38559%2012.1026%205.32238%2012.2959%205.23072V5.69216C12.2959%206.16625%2011.8531%206.48862%2011.305%206.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M32.5%2019H55.5V29H32.5V19Z'%20stroke='%23CCCCDC'/%3e%3cpath%20d='M36.0776%2026.5H40V25.539H37.8525V25.5077L38.4864%2024.9634C39.6352%2024.0313%2039.9353%2023.5568%2039.9353%2022.9908C39.9353%2022.1021%2039.1565%2021.5%2037.9534%2021.5C36.7814%2021.5%2035.9974%2022.1286%2036%2023.1329H37.2135C37.2135%2022.6874%2037.5084%2022.4297%2037.9483%2022.4297C38.3803%2022.4297%2038.6934%2022.6777%2038.6934%2023.0848C38.6934%2023.4533%2038.445%2023.7038%2038.0104%2024.0674L36.0776%2025.6426V26.5Z'%20fill='white'/%3e%3cpath%20d='M37.3525%2025.539V26H36.5776V25.8801L38.026%2024.6997L37.5268%2025.1284L37.3525%2025.278V25.5077V25.539ZM39.4353%2022.9908C39.4353%2023.2453%2039.359%2023.5204%2038.6951%2024.1273C38.9687%2023.8557%2039.1934%2023.5298%2039.1934%2023.0848C39.1934%2022.7428%2039.0569%2022.4371%2038.8075%2022.2243C38.7381%2022.1651%2038.6631%2022.1156%2038.5841%2022.0751C38.7959%2022.1308%2038.9657%2022.2137%2039.0935%2022.3106C39.3183%2022.481%2039.4353%2022.7084%2039.4353%2022.9908ZM36.8547%2022.3253C36.9643%2022.2347%2037.1045%2022.1569%2037.275%2022.1C37.2042%2022.1413%2037.137%2022.1906%2037.0748%2022.2487C36.9565%2022.3591%2036.8684%2022.4896%2036.8089%2022.6329H36.6079C36.6683%2022.512%2036.7522%2022.41%2036.8547%2022.3253Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cmask%20id='path-12-inside-1_1144_162397'%20fill='white'%3e%3cpath%20d='M51.8597%2022.6397C51.7708%2022.5502%2051.6506%2022.5%2051.5253%2022.5C51.4%2022.5%2051.2798%2022.5502%2051.1909%2022.6397L49.4881%2024.3398L47.8091%2022.6397C47.7202%2022.5502%2047.6%2022.5%2047.4747%2022.5C47.3494%2022.5%2047.2292%2022.5502%2047.1403%2022.6397C47.0958%2022.6843%2047.0606%2022.7374%2047.0365%2022.7959C47.0124%2022.8545%2047%2022.9172%2047%2022.9806C47%2023.044%2047.0124%2023.1068%2047.0365%2023.1653C47.0606%2023.2239%2047.0958%2023.277%2047.1403%2023.3216L49.1514%2025.3579C49.1955%2025.403%2049.2479%2025.4387%2049.3057%2025.4631C49.3635%2025.4874%2049.4255%2025.5%2049.4881%2025.5C49.5508%2025.5%2049.6128%2025.4874%2049.6706%2025.4631C49.7284%2025.4387%2049.7808%2025.403%2049.8249%2025.3579L51.8597%2023.3216C51.9042%2023.277%2051.9394%2023.2239%2051.9635%2023.1653C51.9876%2023.1068%2052%2023.044%2052%2022.9806C52%2022.9172%2051.9876%2022.8545%2051.9635%2022.7959C51.9394%2022.7374%2051.9042%2022.6843%2051.8597%2022.6397Z'/%3e%3c/mask%3e%3cpath%20d='M51.8597%2022.6397C51.7708%2022.5502%2051.6506%2022.5%2051.5253%2022.5C51.4%2022.5%2051.2798%2022.5502%2051.1909%2022.6397L49.4881%2024.3398L47.8091%2022.6397C47.7202%2022.5502%2047.6%2022.5%2047.4747%2022.5C47.3494%2022.5%2047.2292%2022.5502%2047.1403%2022.6397C47.0958%2022.6843%2047.0606%2022.7374%2047.0365%2022.7959C47.0124%2022.8545%2047%2022.9172%2047%2022.9806C47%2023.044%2047.0124%2023.1068%2047.0365%2023.1653C47.0606%2023.2239%2047.0958%2023.277%2047.1403%2023.3216L49.1514%2025.3579C49.1955%2025.403%2049.2479%2025.4387%2049.3057%2025.4631C49.3635%2025.4874%2049.4255%2025.5%2049.4881%2025.5C49.5508%2025.5%2049.6128%2025.4874%2049.6706%2025.4631C49.7284%2025.4387%2049.7808%2025.403%2049.8249%2025.3579L51.8597%2023.3216C51.9042%2023.277%2051.9394%2023.2239%2051.9635%2023.1653C51.9876%2023.1068%2052%2023.044%2052%2022.9806C52%2022.9172%2051.9876%2022.8545%2051.9635%2022.7959C51.9394%2022.7374%2051.9042%2022.6843%2051.8597%2022.6397Z'%20fill='white'/%3e%3cpath%20d='M51.8597%2022.6397L51.1503%2023.3445L51.1511%2023.3453L51.8597%2022.6397ZM51.5253%2022.5V21.5V22.5ZM51.1909%2022.6397L51.8975%2023.3473L51.9003%2023.3445L51.1909%2022.6397ZM49.4881%2024.3398L48.7766%2025.0425L49.4832%2025.7579L50.1947%2025.0474L49.4881%2024.3398ZM47.8091%2022.6397L48.5206%2021.937L48.5185%2021.9349L47.8091%2022.6397ZM47.1403%2022.6397L47.8489%2023.3453L47.8497%2023.3445L47.1403%2022.6397ZM47.1403%2023.3216L47.8518%2022.6189L47.8489%2022.616L47.1403%2023.3216ZM49.1514%2025.3579L49.8658%2024.6582L49.8629%2024.6553L49.1514%2025.3579ZM49.8249%2025.3579L49.1175%2024.6511L49.1105%2024.6582L49.8249%2025.3579ZM51.8597%2023.3216L52.5671%2024.0285L52.5683%2024.0272L51.8597%2023.3216ZM52.5691%2021.9349C52.2938%2021.6578%2051.9188%2021.5%2051.5253%2021.5V23.5C51.3824%2023.5%2051.2478%2023.4426%2051.1503%2023.3445L52.5691%2021.9349ZM51.5253%2021.5C51.1318%2021.5%2050.7568%2021.6578%2050.4815%2021.9349L51.9003%2023.3445C51.8028%2023.4426%2051.6682%2023.5%2051.5253%2023.5V21.5ZM50.4844%2021.932L48.7816%2023.6321L50.1947%2025.0474L51.8975%2023.3473L50.4844%2021.932ZM50.1996%2023.6371L48.5206%2021.937L47.0976%2023.3423L48.7766%2025.0425L50.1996%2023.6371ZM48.5185%2021.9349C48.2432%2021.6578%2047.8682%2021.5%2047.4747%2021.5V23.5C47.3318%2023.5%2047.1972%2023.4426%2047.0997%2023.3445L48.5185%2021.9349ZM47.4747%2021.5C47.0812%2021.5%2046.7062%2021.6578%2046.4309%2021.9349L47.8497%2023.3445C47.7522%2023.4426%2047.6176%2023.5%2047.4747%2023.5V21.5ZM46.4317%2021.9341C46.2941%2022.0722%2046.1855%2022.236%2046.1117%2022.4154L47.9613%2023.1765C47.9356%2023.2389%2047.8976%2023.2964%2047.8489%2023.3453L46.4317%2021.9341ZM46.1117%2022.4154C46.0379%2022.5949%2046%2022.787%2046%2022.9806H48C48%2023.0475%2047.9869%2023.114%2047.9613%2023.1765L46.1117%2022.4154ZM46%2022.9806C46%2023.1743%2046.0379%2023.3664%2046.1117%2023.5458L47.9613%2022.7848C47.9869%2022.8472%2048%2022.9138%2048%2022.9806H46ZM46.1117%2023.5458C46.1855%2023.7253%2046.2941%2023.889%2046.4317%2024.0272L47.8489%2022.616C47.8976%2022.6649%2047.9356%2022.7224%2047.9613%2022.7848L46.1117%2023.5458ZM46.4288%2024.0243L48.4399%2026.0606L49.8629%2024.6553L47.8518%2022.6189L46.4288%2024.0243ZM48.437%2026.0577C48.5735%2026.197%2048.7365%2026.3083%2048.9171%2026.3844L49.6944%2024.5417C49.7594%2024.5691%2049.8175%2024.6089%2049.8658%2024.6582L48.437%2026.0577ZM48.9171%2026.3844C49.0976%2026.4606%2049.2918%2026.5%2049.4881%2026.5V24.5C49.5593%2024.5%2049.6294%2024.5143%2049.6944%2024.5417L48.9171%2026.3844ZM49.4881%2026.5C49.6845%2026.5%2049.8787%2026.4606%2050.0592%2026.3844L49.2819%2024.5417C49.3468%2024.5143%2049.417%2024.5%2049.4881%2024.5V26.5ZM50.0592%2026.3844C50.2398%2026.3083%2050.4028%2026.197%2050.5393%2026.0577L49.1105%2024.6582C49.1588%2024.6089%2049.2169%2024.5691%2049.2819%2024.5417L50.0592%2026.3844ZM50.5323%2026.0648L52.5671%2024.0285L51.1523%2022.6148L49.1175%2024.6511L50.5323%2026.0648ZM52.5683%2024.0272C52.7059%2023.889%2052.8145%2023.7253%2052.8883%2023.5458L51.0387%2022.7848C51.0644%2022.7224%2051.1024%2022.6649%2051.1511%2022.616L52.5683%2024.0272ZM52.8883%2023.5458C52.9621%2023.3664%2053%2023.1743%2053%2022.9806H51C51%2022.9138%2051.0131%2022.8472%2051.0387%2022.7848L52.8883%2023.5458ZM53%2022.9806C53%2022.787%2052.9621%2022.5949%2052.8883%2022.4154L51.0387%2023.1765C51.0131%2023.114%2051%2023.0475%2051%2022.9806H53ZM52.8883%2022.4154C52.8145%2022.236%2052.7059%2022.0722%2052.5683%2021.9341L51.1511%2023.3453C51.1024%2023.2964%2051.0644%2023.2389%2051.0387%2023.1765L52.8883%2022.4154Z'%20fill='%23CCCCDC'%20fill-opacity='0.25'%20mask='url(%23path-12-inside-1_1144_162397)'/%3e%3cpath%20d='M69.9067%2030C70.6011%2030%2075.9327%2026%2075.9327%2024C75.9327%2022%2070.7357%2018%2069.9067%2018C69.0777%2018%2068.4023%2018.5%2068.4023%2019.4756C68.4023%2020.4512%2071.9067%2022.9206%2071.9067%2022.9206C71.9067%2022.9206%2064.2539%2022.25%2064%2022.9206C63.7461%2023.5911%2063.7461%2024.4089%2064%2025.0794C64.2539%2025.75%2071.9067%2025.0794%2071.9067%2025.0794C71.9067%2025.0794%2068.4023%2027.75%2068.4023%2028.5301C68.4023%2029.3103%2069.2123%2030%2069.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1144_162397)'%3e%3cpath%20d='M84%206.80064V16H108V6H85.0029L84.0002%206L84%206.80064Z'%20fill='url(%23paint1_linear_1144_162397)'/%3e%3cpath%20d='M108%2019H84V28.5H108V19Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M108%2019H84V28.5H108V19Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M108%2031.75H84V41.25H108V31.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M97%2020.75H95.5716L94%2021.6699V22.9238L95.4253%2022.1035H95.4627V26.75H97V20.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M93.8373%2039.5H98.25V38.3468H95.8341V38.3092L96.5472%2037.6561C97.8396%2036.5376%2098.1772%2035.9682%2098.1772%2035.289C98.1772%2034.2225%2097.3011%2033.5%2095.9476%2033.5C94.629%2033.5%2093.7471%2034.2543%2093.75%2035.4595H95.1151C95.1151%2034.9249%2095.447%2034.6156%2095.9418%2034.6156C96.4279%2034.6156%2096.7801%2034.9133%2096.7801%2035.4017C96.7801%2035.8439%2096.5006%2036.1445%2096.0116%2036.5809L93.8373%2038.4711V39.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M94.7744%2013.5C95.5264%2013.5%2096.0464%2013.2377%2096.3415%2012.7415H96.3837V13.4178H98V10.1182C98%209.09102%2096.9845%208.5%2095.6107%208.5C94.1595%208.5%2093.3373%209.1574%2093.2003%2010.0424L94.785%2010.0929C94.8587%209.78319%2095.1434%209.59355%2095.5966%209.59355C96.0183%209.59355%2096.2853%209.77686%2096.2853%2010.1024V10.1182C96.2853%2010.4153%2095.9269%2010.4785%2095.0063%2010.5512C93.9136%2010.6334%2093%2010.9968%2093%2012.0714C93%2013.0322%2093.7414%2013.5%2094.7744%2013.5ZM95.305%2012.4886C94.9079%2012.4886%2094.6268%2012.318%2094.6268%2011.9956C94.6268%2011.6827%2094.9009%2011.493%2095.3893%2011.4267C95.7091%2011.3856%2096.1026%2011.3224%2096.2959%2011.2307V11.6922C96.2959%2012.1662%2095.8531%2012.4886%2095.305%2012.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162397'%20x1='0.00781255'%20y1='5.004'%20x2='24.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162397'%20x1='84.0078'%20y1='11.004'%20x2='108.008'%20y2='11.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162397'%3e%3crect%20width='24'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162397'%3e%3crect%20width='24'%20height='36'%20fill='white'%20transform='translate(84%206)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_21 = "data:image/svg+xml,%3csvg%20width='177'%20height='48'%20viewBox='0%200%20177%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1144_161898)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_161898)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_161898)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1144_161898)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M46.3343%2030H49.674V25.674H54V22.3343H49.674V18H46.3343V22.3343H42V25.674H46.3343V30Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip2_1144_161898)'%3e%3cpath%20d='M77%2026.25H62V39.25H77V26.25Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%209.79083V21.75H77V8.75H62.6268C62.4606%208.75%2062.3011%208.85966%2062.1836%209.05485C62.066%209.25005%2062%209.51479%2062%209.79083Z'%20fill='url(%23paint2_linear_1144_161898)'/%3e%3cpath%20d='M69.4792%2035.75C70.8085%2035.75%2071.7528%2035.0257%2071.75%2034.0105C71.7528%2033.2918%2071.2958%2032.7785%2070.4208%2032.673V32.6274C71.0771%2032.5304%2071.5423%2032.077%2071.5395%2031.4211C71.5423%2030.4686%2070.706%2029.75%2069.4903%2029.75C68.2663%2029.75%2067.3746%2030.48%2067.3635%2031.5181H68.6734C68.6845%2031.1188%2069.0334%2030.8508%2069.4903%2030.8508C69.9251%2030.8508%2070.2214%2031.1217%2070.2186%2031.5124C70.2214%2031.9173%2069.8725%2032.1968%2069.3685%2032.1968H68.8174V33.2006H69.3685C69.9417%2033.2006%2070.3155%2033.4914%2070.31%2033.9021C70.3155%2034.3156%2069.9721%2034.6036%2069.4848%2034.6036C69.0001%2034.6036%2068.6429%2034.3384%2068.6291%2033.9534H67.25C67.2611%2035.0086%2068.1832%2035.75%2069.4792%2035.75Z'%20fill='white'/%3e%3cpath%20d='M67%2018.4362H68.5663V17.7145H68.6149C68.8155%2018.1261%2069.2621%2018.5%2070.0129%2018.5C71.1133%2018.5%2072%2017.729%2072%2016.213C72%2014.642%2071.0615%2013.9261%2070.0227%2013.9261C69.2362%2013.9261%2068.8058%2014.3377%2068.6149%2014.7464H68.5825V12.5H67V18.4362ZM68.5502%2016.2101C68.5502%2015.4826%2068.8867%2015.0333%2069.466%2015.0333C70.0518%2015.0333%2070.3754%2015.4942%2070.3754%2016.2101C70.3754%2016.929%2070.0518%2017.3957%2069.466%2017.3957C68.8867%2017.3957%2068.5502%2016.9319%2068.5502%2016.2101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_161898)'%3e%3cpath%20d='M96%2026.25H81V39.25H96V26.25Z'%20fill='%233865AB'/%3e%3cpath%20d='M81%2021.75H96V9.79083C96%209.51479%2095.934%209.25005%2095.8164%209.05485C95.6989%208.85966%2095.5394%208.75%2095.3732%208.75H81V21.75Z'%20fill='url(%23paint3_linear_1144_161898)'/%3e%3cpath%20d='M88.6058%2018.5C90.0564%2018.5%2090.9563%2017.7082%2091%2016.5095H89.4654C89.405%2017.0237%2089.0759%2017.3044%2088.6259%2017.3044C88.0484%2017.3044%2087.6723%2016.847%2087.6723%2015.9858C87.6723%2015.1309%2088.0517%2014.6735%2088.6259%2014.6735C89.096%2014.6735%2089.4016%2014.9732%2089.4654%2015.4685H91C90.9631%2014.276%2090.0363%2013.5%2088.6024%2013.5C86.9805%2013.5%2086%2014.5158%2086%2016.0016C86%2017.4811%2086.9738%2018.5%2088.6058%2018.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M109.907%2030C110.601%2030%20115.933%2026%20115.933%2024C115.933%2022%20110.736%2018%20109.907%2018C109.078%2018%20108.402%2018.5%20108.402%2019.4756C108.402%2020.4512%20111.907%2022.9206%20111.907%2022.9206C111.907%2022.9206%20104.254%2022.25%20104%2022.9206C103.746%2023.5911%20103.746%2024.4089%20104%2025.0794C104.254%2025.75%20111.907%2025.0794%20111.907%2025.0794C111.907%2025.0794%20108.402%2027.75%20108.402%2028.5301C108.402%2029.3103%20109.212%2030%20109.907%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M124%200.720576V9H139V0H124.627C124.461%200%20124.301%200.0759177%20124.184%200.211052C124.066%200.346186%20124%200.529468%20124%200.720576Z'%20fill='url(%23paint4_linear_1144_161898)'/%3e%3cpath%20d='M139%2013H124V22H139V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2026H124V35H139V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2039H124V48H139V39Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M124.5%2039.5H138.5V47.5H124.5V39.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M132.5%2015H131.31L130%2015.7666V16.8115L131.188%2016.1279H131.219V20H132.5V15Z'%20fill='%2324292E'/%3e%3cpath%20d='M130.072%2033H133.724V32.039H131.724V32.0077L132.315%2031.4634C133.384%2030.5313%20133.663%2030.0568%20133.663%2029.4908C133.663%2028.6021%20132.938%2028%20131.818%2028C130.727%2028%20129.998%2028.6286%20130%2029.6329H131.13C131.13%2029.1874%20131.404%2028.9297%20131.814%2028.9297C132.216%2028.9297%20132.507%2029.1777%20132.507%2029.5848C132.507%2029.9533%20132.276%2030.2038%20131.871%2030.5674L130.072%2032.1426V33Z'%20fill='%2324292E'/%3e%3cpath%20d='M129%207.68623H130.566V6.96449H130.615C130.816%207.37609%20131.262%207.75%20132.013%207.75C133.113%207.75%20134%206.97898%20134%205.46304C134%203.89203%20133.061%203.17609%20132.023%203.17609C131.236%203.17609%20130.806%203.58768%20130.615%203.99638H130.583V1.75H129V7.68623ZM130.55%205.46015C130.55%204.73261%20130.887%204.28333%20131.466%204.28333C132.052%204.28333%20132.375%204.7442%20132.375%205.46015C132.375%206.17899%20132.052%206.64565%20131.466%206.64565C130.887%206.64565%20130.55%206.18188%20130.55%205.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M143%200.720576V9H158V0H143.627C143.461%200%20143.301%200.0759177%20143.184%200.211052C143.066%200.346186%20143%200.529468%20143%200.720576Z'%20fill='url(%23paint5_linear_1144_161898)'/%3e%3cpath%20d='M158%2013H143V22H158V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2026H143V35H158V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2039H143V48H158V39Z'%20fill='%233865AB'/%3e%3cpath%20d='M150.913%2046C152.054%2046%20152.864%2045.3964%20152.862%2044.5504C152.864%2043.9515%20152.472%2043.5238%20151.721%2043.4358V43.3978C152.284%2043.317%20152.683%2042.9392%20152.681%2042.3926C152.683%2041.5989%20151.966%2041%20150.923%2041C149.872%2041%20149.107%2041.6084%20149.097%2042.4734H150.221C150.231%2042.1407%20150.53%2041.9173%20150.923%2041.9173C151.296%2041.9173%20151.55%2042.1431%20151.548%2042.4686C151.55%2042.8061%20151.25%2043.039%20150.818%2043.039H150.345V43.8755H150.818C151.31%2043.8755%20151.631%2044.1179%20151.626%2044.4601C151.631%2044.8047%20151.336%2045.0447%20150.918%2045.0447C150.502%2045.0447%20150.195%2044.8237%20150.183%2044.5029H149C149.01%2045.3821%20149.801%2046%20150.913%2046Z'%20fill='white'/%3e%3cpath%20d='M149.774%207.5C150.526%207.5%20151.046%207.23767%20151.342%206.74147H151.384V7.41783H153V4.1182C153%203.09102%20151.985%202.5%20150.611%202.5C149.16%202.5%20148.337%203.1574%20148.2%204.04235L149.785%204.09292C149.859%203.78319%20150.143%203.59355%20150.597%203.59355C151.018%203.59355%20151.285%203.77686%20151.285%204.1024V4.1182C151.285%204.4153%20150.927%204.47851%20150.006%204.5512C148.914%204.63338%20148%204.99684%20148%206.07143C148%207.03224%20148.741%207.5%20149.774%207.5ZM150.305%206.48862C149.908%206.48862%20149.627%206.31795%20149.627%205.99558C149.627%205.68268%20149.901%205.49305%20150.389%205.42668C150.709%205.38559%20151.103%205.32238%20151.296%205.23072V5.69216C151.296%206.16625%20150.853%206.48862%20150.305%206.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M162%209H177V0.720576C177%200.529468%20176.934%200.346186%20176.816%200.211052C176.699%200.0759177%20176.539%200%20176.373%200L162%200V9Z'%20fill='url(%23paint6_linear_1144_161898)'/%3e%3cpath%20d='M177%2039H162V48H177V39Z'%20fill='%233865AB'/%3e%3cpath%20d='M177%2026H162V35H177V26Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M162.5%2026.5H176.5V34.5H162.5V26.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M177%2013H162V22H177V13Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M162.5%2013.5H176.5V21.5H162.5V13.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M169.606%207.5C171.056%207.5%20171.956%206.7082%20172%205.50946H170.465C170.405%206.02366%20170.076%206.30442%20169.626%206.30442C169.048%206.30442%20168.672%205.847%20168.672%204.9858C168.672%204.13092%20169.052%203.6735%20169.626%203.6735C170.096%203.6735%20170.402%203.97319%20170.465%204.46845H172C171.963%203.27602%20171.036%202.5%20169.602%202.5C167.981%202.5%20167%203.51577%20167%205.00158C167%206.48107%20167.974%207.5%20169.606%207.5Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161898'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161898'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_161898'%20x1='62'%20y1='15.2552'%20x2='77'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_161898'%20x1='81'%20y1='15.2552'%20x2='96'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_161898'%20x1='124'%20y1='4.5036'%20x2='139'%20y2='4.5036'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1144_161898'%20x1='143'%20y1='4.5036'%20x2='158'%20y2='4.5036'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_1144_161898'%20x1='162'%20y1='4.5036'%20x2='177'%20y2='4.5036'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161898'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161898'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_161898'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%208.75)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_161898'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%208.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_22 = "data:image/svg+xml,%3csvg%20width='154'%20height='48'%20viewBox='0%200%20154%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%202.57189C15.0002%202.53241%2014.9927%202.49327%2014.9777%202.45672C14.9628%202.42018%2014.9408%202.38693%2014.913%202.3589L13.641%201.087C13.613%201.0592%2013.5797%201.0372%2013.5432%201.02227C13.5066%201.00734%2013.4675%200.999777%2013.428%201.00001C13.3885%200.999777%2013.3494%201.00734%2013.3128%201.02227C13.2763%201.0372%2013.243%201.0592%2013.215%201.087L12.366%201.93594L9.087%205.21469C9.0592%205.24272%209.0372%205.27596%209.02227%205.31251C9.00734%205.34906%208.99978%205.3882%209.00001%205.42767V6.69958C9.00001%206.77914%209.03161%206.85544%209.08787%206.9117C9.14413%206.96795%209.22044%206.99956%209.3%206.99956H10.572C10.614%207.00184%2010.656%206.99528%2010.6952%206.98029C10.7345%206.9653%2010.7702%206.94223%2010.8%206.91256L14.061%203.63381L14.913%202.79987C14.9404%202.7708%2014.9627%202.73733%2014.979%202.70088C14.9819%202.67697%2014.9819%202.65279%2014.979%202.62888C14.9804%202.61492%2014.9804%202.60085%2014.979%202.58689L15%202.57189ZM10.449%206.3996H9.6V5.55067L12.579%202.57189L13.428%203.42082L10.449%206.3996ZM13.851%202.99786L13.002%202.14892L13.428%201.72595L14.274%202.57189L13.851%202.99786Z'%20fill='white'/%3e%3cg%20clip-path='url(%23clip0_1144_162154)'%3e%3cpath%20d='M0%2011.3611V27H24V10H1.00293C0.736933%2010%200.481835%2010.1434%200.29375%2010.3987C0.105665%2010.6539%200%2011.0001%200%2011.3611Z'%20fill='url(%23paint0_linear_1144_162154)'/%3e%3cpath%20d='M24%2031H0V48H24V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M10.7744%2021.5C11.5264%2021.5%2012.0464%2021.2377%2012.3415%2020.7415H12.3837V21.4178H14V18.1182C14%2017.091%2012.9845%2016.5%2011.6107%2016.5C10.1595%2016.5%209.33732%2017.1574%209.20028%2018.0424L10.785%2018.0929C10.8587%2017.7832%2011.1434%2017.5936%2011.5966%2017.5936C12.0183%2017.5936%2012.2853%2017.7769%2012.2853%2018.1024V18.1182C12.2853%2018.4153%2011.9269%2018.4785%2011.0063%2018.5512C9.91356%2018.6334%209%2018.9968%209%2020.0714C9%2021.0322%209.74139%2021.5%2010.7744%2021.5ZM11.305%2020.4886C10.9079%2020.4886%2010.6268%2020.318%2010.6268%2019.9956C10.6268%2019.6827%2010.9009%2019.493%2011.3893%2019.4267C11.7091%2019.3856%2012.1026%2019.3224%2012.2959%2019.2307V19.6922C12.2959%2020.1662%2011.8531%2020.4886%2011.305%2020.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M13%2036.5H11.5716L10%2037.4199V38.6738L11.4253%2037.8535H11.4627V42.5H13V36.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M35.7975%202.10148C35.7643%202.06962%2035.725%202.04465%2035.6821%202.02799C35.5969%201.993%2035.5013%201.993%2035.4161%202.02799C35.3732%202.04465%2035.3339%202.06962%2035.3006%202.10148L34.6008%202.80134C34.5349%202.86723%2034.4979%202.9566%2034.4979%203.04979C34.4979%203.14297%2034.5349%203.23234%2034.6008%203.29823C34.6667%203.36413%2034.756%203.40115%2034.8492%203.40115C34.9424%203.40115%2035.0318%203.36413%2035.0977%203.29823L35.1992%203.19326V5.84921C35.1992%205.94202%2035.236%206.03103%2035.3016%206.09665C35.3673%206.16227%2035.4563%206.19914%2035.5491%206.19914C35.6419%206.19914%2035.7309%206.16227%2035.7965%206.09665C35.8621%206.03103%2035.899%205.94202%2035.899%205.84921V3.19326L36.0005%203.29823C36.033%203.33103%2036.0717%203.35707%2036.1144%203.37483C36.157%203.3926%2036.2027%203.40174%2036.2489%203.40174C36.2951%203.40174%2036.3409%203.3926%2036.3835%203.37483C36.4262%203.35707%2036.4649%203.33103%2036.4974%203.29823C36.5302%203.2657%2036.5562%203.227%2036.574%203.18436C36.5917%203.14172%2036.6009%203.09598%2036.6009%203.04979C36.6009%203.00359%2036.5917%202.95785%2036.574%202.91521C36.5562%202.87257%2036.5302%202.83387%2036.4974%202.80134L35.7975%202.10148ZM37.6487%202.69986H41.1479C41.2407%202.69986%2041.3297%202.66299%2041.3954%202.59737C41.461%202.53174%2041.4979%202.44274%2041.4979%202.34993C41.4979%202.25712%2041.461%202.16812%2041.3954%202.10249C41.3297%202.03687%2041.2407%202%2041.1479%202H37.6487C37.5558%202%2037.4668%202.03687%2037.4012%202.10249C37.3356%202.16812%2037.2987%202.25712%2037.2987%202.34993C37.2987%202.44274%2037.3356%202.53174%2037.4012%202.59737C37.4668%202.66299%2037.5558%202.69986%2037.6487%202.69986V2.69986ZM41.1479%205.49928H37.6487C37.5558%205.49928%2037.4668%205.53615%2037.4012%205.60178C37.3356%205.6674%2037.2987%205.75641%2037.2987%205.84921C37.2987%205.94202%2037.3356%206.03103%2037.4012%206.09665C37.4668%206.16227%2037.5558%206.19914%2037.6487%206.19914H41.1479C41.2407%206.19914%2041.3297%206.16227%2041.3954%206.09665C41.461%206.03103%2041.4979%205.94202%2041.4979%205.84921C41.4979%205.75641%2041.461%205.6674%2041.3954%205.60178C41.3297%205.53615%2041.2407%205.49928%2041.1479%205.49928ZM41.1479%203.74964H37.6487C37.5558%203.74964%2037.4668%203.78651%2037.4012%203.85213C37.3356%203.91776%2037.2987%204.00676%2037.2987%204.09957C37.2987%204.19238%2037.3356%204.28138%2037.4012%204.34701C37.4668%204.41263%2037.5558%204.4495%2037.6487%204.4495H41.1479C41.2407%204.4495%2041.3297%204.41263%2041.3954%204.34701C41.461%204.28138%2041.4979%204.19238%2041.4979%204.09957C41.4979%204.00676%2041.461%203.91776%2041.3954%203.85213C41.3297%203.78651%2041.2407%203.74964%2041.1479%203.74964Z'%20fill='white'/%3e%3cg%20clip-path='url(%23clip1_1144_162154)'%3e%3cpath%20d='M26%2027H50V11.3611V10H48.9971H26V27Z'%20fill='url(%23paint1_linear_1144_162154)'/%3e%3cpath%20d='M50%2031H26V48H50V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M35.5%2021.4362H37.0663V20.7145H37.1149C37.3155%2021.1261%2037.7621%2021.5%2038.5129%2021.5C39.6133%2021.5%2040.5%2020.729%2040.5%2019.213C40.5%2017.642%2039.5615%2016.9261%2038.5227%2016.9261C37.7362%2016.9261%2037.3058%2017.3377%2037.1149%2017.7464H37.0825V15.5H35.5V21.4362ZM37.0502%2019.2101C37.0502%2018.4826%2037.3867%2018.0333%2037.966%2018.0333C38.5518%2018.0333%2038.8754%2018.4942%2038.8754%2019.2101C38.8754%2019.929%2038.5518%2020.3957%2037.966%2020.3957C37.3867%2020.3957%2037.0502%2019.9319%2037.0502%2019.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M35.5873%2042.5H40V41.3468H37.5841V41.3092L38.2972%2040.6561C39.5896%2039.5376%2039.9272%2038.9682%2039.9272%2038.289C39.9272%2037.2225%2039.0511%2036.5%2037.6976%2036.5C36.379%2036.5%2035.4971%2037.2543%2035.5%2038.4595H36.8651C36.8651%2037.9249%2037.197%2037.6156%2037.6918%2037.6156C38.1779%2037.6156%2038.5301%2037.9133%2038.5301%2038.4017C38.5301%2038.8439%2038.2506%2039.1445%2037.7616%2039.5809L35.5873%2041.4711V42.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M63.6798%202.22255C63.7849%202.20642%2063.8912%202.19841%2063.9976%202.19856C64.9511%202.19856%2065.8477%202.88522%2066.3694%203.99767C66.2896%204.16696%2066.1995%204.33119%2066.0996%204.48943C66.0678%204.53854%2066.0512%204.59587%2066.0516%204.65434C66.0523%204.71978%2066.0743%204.78321%2066.1144%204.83494C66.1545%204.88667%2066.2104%204.92387%2066.2736%204.94086C66.3368%204.95784%2066.4038%204.95369%2066.4644%204.92903C66.525%204.90437%2066.5759%204.86055%2066.6093%204.80427C66.749%204.58476%2066.8704%204.35409%2066.9721%204.11461C66.9882%204.0772%2066.9965%204.0369%2066.9965%203.99617C66.9965%203.95544%2066.9882%203.91514%2066.9721%203.87773C66.3664%202.47142%2065.227%201.59886%2063.9976%201.59886C63.8569%201.59815%2063.7164%201.61019%2063.5778%201.63484C63.5384%201.64153%2063.5008%201.65592%2063.4669%201.67717C63.4331%201.69842%2063.4038%201.72613%2063.3807%201.75871C63.3576%201.79128%2063.3411%201.82809%2063.3323%201.86704C63.3234%201.90598%2063.3222%201.94629%2063.3289%201.98566C63.3356%202.02504%2063.35%202.06271%2063.3713%202.09653C63.3925%202.13035%2063.4202%202.15965%2063.4528%202.18276C63.4854%202.20587%2063.5222%202.22234%2063.5611%202.23122C63.6001%202.24011%2063.6404%202.24123%2063.6798%202.23454V2.22255ZM61.5118%201.08611C61.4839%201.05815%2061.4507%201.03597%2061.4142%201.02084C61.3776%201.00571%2061.3385%200.997925%2061.2989%200.997925C61.2594%200.997925%2061.2203%201.00571%2061.1837%201.02084C61.1472%201.03597%2061.114%201.05815%2061.086%201.08611C61.0296%201.14257%2060.9979%201.21915%2060.9979%201.299C60.9979%201.37885%2061.0296%201.45543%2061.086%201.5119L62.0156%202.43844C61.5915%202.8467%2061.2539%203.33619%2061.0231%203.87773C61.0066%203.91556%2060.998%203.95639%2060.998%203.99767C60.998%204.03895%2061.0066%204.07978%2061.0231%204.11761C61.6288%205.52391%2062.7682%206.39648%2063.9976%206.39648C64.5365%206.39276%2065.0626%206.23231%2065.5119%205.93471L66.4834%206.90923C66.5113%206.93733%2066.5444%206.95964%2066.581%206.97486C66.6175%206.99009%2066.6567%206.99792%2066.6963%206.99792C66.7359%206.99792%2066.775%206.99009%2066.8116%206.97486C66.8481%206.95964%2066.8813%206.93733%2066.9092%206.90923C66.9373%206.88135%2066.9596%206.84819%2066.9748%206.81165C66.99%206.77511%2066.9979%206.73592%2066.9979%206.69633C66.9979%206.65675%2066.99%206.61756%2066.9748%206.58102C66.9596%206.54448%2066.9373%206.51131%2066.9092%206.48344L61.5118%201.08611ZM63.4189%203.84175L64.1535%204.57638C64.1029%204.59092%2064.0503%204.59799%2063.9976%204.59737C63.8386%204.59737%2063.686%204.53419%2063.5736%204.42172C63.4611%204.30926%2063.3979%204.15672%2063.3979%203.99767C63.3973%203.94495%2063.4044%203.89242%2063.4189%203.84175ZM63.9976%205.79678C63.0441%205.79678%2062.1475%205.11012%2061.6288%203.99767C61.8225%203.57%2062.0975%203.18404%2062.4384%202.86123L62.9691%203.39797C62.8445%203.62549%2062.7969%203.88731%2062.8337%204.14413C62.8704%204.40096%2062.9894%204.63895%2063.1729%204.8224C63.3563%205.00586%2063.5943%205.12488%2063.8511%205.16162C64.108%205.19835%2064.3698%205.15082%2064.5973%205.02616L65.0741%205.49693C64.7476%205.6891%2064.3764%205.79247%2063.9976%205.79678Z'%20fill='white'/%3e%3cg%20clip-path='url(%23clip2_1144_162154)'%3e%3cpath%20d='M52%2027H76V11.3611C76%2011.0001%2075.8943%2010.6539%2075.7063%2010.3987C75.5182%2010.1434%2075.2631%2010%2074.9971%2010H52V27Z'%20fill='url(%23paint2_linear_1144_162154)'/%3e%3cpath%20d='M76%2031H52V48H76V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M64.1058%2021.5C65.5564%2021.5%2066.4563%2020.7082%2066.5%2019.5095H64.9654C64.905%2020.0237%2064.5759%2020.3044%2064.1259%2020.3044C63.5484%2020.3044%2063.1723%2019.847%2063.1723%2018.9858C63.1723%2018.1309%2063.5517%2017.6735%2064.1259%2017.6735C64.596%2017.6735%2064.9016%2017.9732%2064.9654%2018.4685H66.5C66.4631%2017.276%2065.5363%2016.5%2064.1024%2016.5C62.4805%2016.5%2061.5%2017.5158%2061.5%2019.0016C61.5%2020.4811%2062.4738%2021.5%2064.1058%2021.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M63.9769%2042.5C65.4538%2042.5%2066.5031%2041.7757%2066.5%2040.7605C66.5031%2040.0418%2065.9954%2039.5285%2065.0231%2039.423V39.3774C65.7523%2039.2804%2066.2692%2038.827%2066.2661%2038.1711C66.2692%2037.2186%2065.34%2036.5%2063.9892%2036.5C62.6292%2036.5%2061.6385%2037.23%2061.6262%2038.2681H63.0815C63.0938%2037.8688%2063.4815%2037.6008%2063.9892%2037.6008C64.4723%2037.6008%2064.8015%2037.8717%2064.7985%2038.2624C64.8015%2038.6673%2064.4138%2038.9468%2063.8538%2038.9468H63.2415V39.9506H63.8538C64.4908%2039.9506%2064.9061%2040.2414%2064.9%2040.6521C64.9061%2041.0656%2064.5246%2041.3536%2063.9831%2041.3536C63.4446%2041.3536%2063.0477%2041.0884%2063.0323%2040.7034H61.5C61.5123%2041.7586%2062.5369%2042.5%2063.9769%2042.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M89.9067%2030C90.6011%2030%2095.9327%2026%2095.9327%2024C95.9327%2022%2090.7357%2018%2089.9067%2018C89.0777%2018%2088.4023%2018.5%2088.4023%2019.4756C88.4023%2020.4512%2091.9067%2022.9206%2091.9067%2022.9206C91.9067%2022.9206%2084.2539%2022.25%2084%2022.9206C83.7461%2023.5911%2083.7461%2024.4089%2084%2025.0794C84.2539%2025.75%2091.9067%2025.0794%2091.9067%2025.0794C91.9067%2025.0794%2088.4023%2027.75%2088.4023%2028.5301C88.4023%2029.3103%2089.2123%2030%2089.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip3_1144_162154)'%3e%3cpath%20d='M130%2027H154V11.3611C154%2011.0001%20153.894%2010.6539%20153.706%2010.3987C153.518%2010.1434%20153.263%2010%20152.997%2010H130V27Z'%20fill='url(%23paint3_linear_1144_162154)'/%3e%3cpath%20d='M154%2031H130V48H154V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M143%2036.5H141.572L140%2037.4199V38.6738L141.425%2037.8535H141.463V42.5H143V36.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M140.987%2021.5C141.738%2021.5%20142.184%2021.1261%20142.385%2020.7145H142.434V21.4362H144V15.5H142.417V17.7464H142.385C142.197%2017.3377%20141.764%2016.9261%20140.981%2016.9261C139.942%2016.9261%20139%2017.642%20139%2019.213C139%2020.729%20139.89%2021.5%20140.987%2021.5ZM141.537%2020.3957C140.951%2020.3957%20140.625%2019.929%20140.625%2019.2101C140.625%2018.4942%20140.948%2018.0333%20141.537%2018.0333C142.117%2018.0333%20142.453%2018.4826%20142.453%2019.2101C142.453%2019.9319%20142.113%2020.3957%20141.537%2020.3957Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1144_162154)'%3e%3cpath%20d='M128%2031H104V48H128V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M104%2011.3611V27H128V10H105.003C104.737%2010%20104.482%2010.1434%20104.294%2010.3987C104.106%2010.6539%20104%2011.0001%20104%2011.3611Z'%20fill='url(%23paint4_linear_1144_162154)'/%3e%3cpath%20d='M113.5%2021.4362H115.066V20.7145H115.115C115.316%2021.1261%20115.762%2021.5%20116.513%2021.5C117.613%2021.5%20118.5%2020.729%20118.5%2019.213C118.5%2017.642%20117.561%2016.9261%20116.523%2016.9261C115.736%2016.9261%20115.306%2017.3377%20115.115%2017.7464H115.083V15.5H113.5V21.4362ZM115.05%2019.2101C115.05%2018.4826%20115.387%2018.0333%20115.966%2018.0333C116.552%2018.0333%20116.875%2018.4942%20116.875%2019.2101C116.875%2019.929%20116.552%2020.3957%20115.966%2020.3957C115.387%2020.3957%20115.05%2019.9319%20115.05%2019.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.587%2042.5H118V41.3468H115.584V41.3092L116.297%2040.6561C117.59%2039.5376%20117.927%2038.9682%20117.927%2038.289C117.927%2037.2225%20117.051%2036.5%20115.698%2036.5C114.379%2036.5%20113.497%2037.2543%20113.5%2038.4595H114.865C114.865%2037.9249%20115.197%2037.6156%20115.692%2037.6156C116.178%2037.6156%20116.53%2037.9133%20116.53%2038.4017C116.53%2038.8439%20116.251%2039.1445%20115.762%2039.5809L113.587%2041.4711V42.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162154'%20x1='0'%20y1='18.5068'%20x2='24'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162154'%20x1='26'%20y1='18.5068'%20x2='50'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162154'%20x1='52'%20y1='18.5068'%20x2='76'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162154'%20x1='130'%20y1='18.5068'%20x2='154'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_162154'%20x1='104'%20y1='18.5068'%20x2='128'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162154'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(0%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162154'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(26%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162154'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(52%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_162154'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(130%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1144_162154'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(104%2010)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_23 = "data:image/svg+xml,%3csvg%20width='101'%20height='48'%20viewBox='0%200%20101%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162587)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.9067%2030C29.6011%2030%2034.9327%2026%2034.9327%2024C34.9327%2022%2029.7357%2018%2028.9067%2018C28.0777%2018%2027.4023%2018.5%2027.4023%2019.4756C27.4023%2020.4512%2030.9067%2022.9206%2030.9067%2022.9206C30.9067%2022.9206%2023.2539%2022.25%2023%2022.9206C22.7461%2023.5911%2022.7461%2024.4089%2023%2025.0794C23.2539%2025.75%2030.9067%2025.0794%2030.9067%2025.0794C30.9067%2025.0794%2027.4023%2027.75%2027.4023%2028.5301C27.4023%2029.3103%2028.2123%2030%2028.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M43%2010.0408V22H58V9H43.6268C43.4606%209%2043.3011%209.10966%2043.1836%209.30485C43.066%209.50005%2043%209.76479%2043%2010.0408Z'%20fill='url(%23paint1_linear_1144_162587)'/%3e%3cpath%20d='M58%2026.5H43V39.5H58V26.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M51.5%2030H50.0716L48.5%2030.9199V32.1738L49.9253%2031.3535H49.9627V36H51.5V30Z'%20fill='%2324292E'/%3e%3cpath%20d='M49.7744%2018.5C50.5264%2018.5%2051.0464%2018.2377%2051.3415%2017.7415H51.3837V18.4178H53V15.1182C53%2014.091%2051.9845%2013.5%2050.6107%2013.5C49.1595%2013.5%2048.3373%2014.1574%2048.2003%2015.0424L49.785%2015.0929C49.8587%2014.7832%2050.1434%2014.5936%2050.5966%2014.5936C51.0183%2014.5936%2051.2853%2014.7769%2051.2853%2015.1024V15.1182C51.2853%2015.4153%2050.9269%2015.4785%2050.0063%2015.5512C48.9136%2015.6334%2048%2015.9968%2048%2017.0714C48%2018.0322%2048.7414%2018.5%2049.7744%2018.5ZM50.305%2017.4886C49.9079%2017.4886%2049.6268%2017.318%2049.6268%2016.9956C49.6268%2016.6827%2049.9009%2016.493%2050.3893%2016.4267C50.7091%2016.3856%2051.1026%2016.3224%2051.2959%2016.2307V16.6922C51.2959%2017.1662%2050.8531%2017.4886%2050.305%2017.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M70.3343%2030H73.674V25.674H78V22.3343H73.674V18H70.3343V22.3343H66V25.674H70.3343V30Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M86%2010.0408V22H101V9H86.6268C86.4606%209%2086.3011%209.10966%2086.1836%209.30485C86.066%209.50005%2086%209.76479%2086%2010.0408Z'%20fill='url(%23paint2_linear_1144_162587)'/%3e%3cpath%20d='M101%2026.5H86V39.5H101V26.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M92.7744%2018.5C93.5264%2018.5%2094.0464%2018.2377%2094.3415%2017.7415H94.3837V18.4178H96V15.1182C96%2014.091%2094.9845%2013.5%2093.6107%2013.5C92.1595%2013.5%2091.3373%2014.1574%2091.2003%2015.0424L92.785%2015.0929C92.8587%2014.7832%2093.1434%2014.5936%2093.5966%2014.5936C94.0183%2014.5936%2094.2853%2014.7769%2094.2853%2015.1024V15.1182C94.2853%2015.4153%2093.9269%2015.4785%2093.0063%2015.5512C91.9136%2015.6334%2091%2015.9968%2091%2017.0714C91%2018.0322%2091.7414%2018.5%2092.7744%2018.5ZM93.305%2017.4886C92.9079%2017.4886%2092.6268%2017.318%2092.6268%2016.9956C92.6268%2016.6827%2092.9009%2016.493%2093.3893%2016.4267C93.7091%2016.3856%2094.1026%2016.3224%2094.2959%2016.2307V16.6922C94.2959%2017.1662%2093.8531%2017.4886%2093.305%2017.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M91.0873%2036H95.5V34.8468H93.0841V34.8092L93.7972%2034.1561C95.0896%2033.0376%2095.4272%2032.4682%2095.4272%2031.789C95.4272%2030.7225%2094.5511%2030%2093.1976%2030C91.879%2030%2090.9971%2030.7543%2091%2031.9595H92.3651C92.3651%2031.4249%2092.697%2031.1156%2093.1918%2031.1156C93.6779%2031.1156%2094.0301%2031.4133%2094.0301%2031.9017C94.0301%2032.3439%2093.7506%2032.6445%2093.2616%2033.0809L91.0873%2034.9711V36Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162587'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162587'%20x1='43'%20y1='15.5052'%20x2='58'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162587'%20x1='86'%20y1='15.5052'%20x2='101'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_24 = "data:image/svg+xml,%3csvg%20width='180'%20height='48'%20viewBox='0%200%20180%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%209.79071V21.7499H15V8.74988H0.626828C0.460583%208.74988%200.301147%208.85954%200.183594%209.05473C0.0660407%209.24992%200%209.51466%200%209.79071Z'%20fill='url(%23paint0_linear_1144_162613)'/%3e%3cpath%20d='M15%2026.2499H0V39.2499H15V26.2499Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2030H7.07158L5.5%2030.9199V32.1738L6.92531%2031.3535H6.96266V36H8.5V30Z'%20fill='%2324292E'/%3e%3cpath%20d='M19%209.79083V21.75H34V8.75H19.6268C19.4606%208.75%2019%208.75%2019%208.75C19%208.75%2019%209.51479%2019%209.79083Z'%20fill='url(%23paint1_linear_1144_162613)'/%3e%3cpath%20d='M34%2026.25H19V39.25H34V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26.5739%2018.25C25.3778%2018.2443%2024.2472%2017.5199%2024.25%2015.3812C24.2557%2013.4192%2025.179%2012.25%2026.6165%2012.25C27.7784%2012.25%2028.5739%2013%2028.6903%2013.961H27.4773C27.3835%2013.5532%2027.0625%2013.308%2026.6165%2013.308C25.858%2013.308%2025.4602%2014.0152%2025.4545%2015.153H25.4943C25.7557%2014.6369%2026.321%2014.3289%2026.9602%2014.3289C27.9915%2014.3289%2028.7528%2015.1188%2028.75%2016.2139C28.7528%2017.403%2027.8693%2018.2557%2026.5739%2018.25ZM26.5682%2017.2804C27.1364%2017.2804%2027.5597%2016.8327%2027.5568%2016.2481C27.5597%2015.6692%2027.1449%2015.2215%2026.5767%2015.2215C26.0114%2015.2215%2025.5824%2015.6834%2025.5795%2016.2509C25.5795%2016.8213%2026%2017.2804%2026.5682%2017.2804Z'%20fill='%2324292E'/%3e%3cpath%20d='M26.2292%2035.75C27.5585%2035.75%2028.5028%2035.0257%2028.5%2034.0105C28.5028%2033.2918%2028.0458%2032.7785%2027.1708%2032.673V32.6274C27.8271%2032.5304%2028.2923%2032.077%2028.2895%2031.4211C28.2923%2030.4686%2027.456%2029.75%2026.2403%2029.75C25.0163%2029.75%2024.1246%2030.48%2024.1135%2031.5181H25.4234C25.4345%2031.1188%2025.7834%2030.8508%2026.2403%2030.8508C26.6751%2030.8508%2026.9714%2031.1217%2026.9686%2031.5124C26.9714%2031.9173%2026.6225%2032.1968%2026.1185%2032.1968H25.5674V33.2006H26.1185C26.6917%2033.2006%2027.0655%2033.4914%2027.06%2033.9021C27.0655%2034.3156%2026.7221%2034.6036%2026.2348%2034.6036C25.7501%2034.6036%2025.3929%2034.3384%2025.3791%2033.9534H24C24.0111%2035.0086%2024.9332%2035.75%2026.2292%2035.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M38%209.79083V21.75H53V8.75H38.6268C38.4606%208.75%2038%208.75%2038%208.75C38%208.75%2038%209.51479%2038%209.79083Z'%20fill='url(%23paint2_linear_1144_162613)'/%3e%3cpath%20d='M53%2026.25H38V39.25H53V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M43.6884%2018.25L46.3471%2013.3281V13.2871H43.25V12.25H47.75V13.3018L45.0882%2018.25H43.6884Z'%20fill='%2324292E'/%3e%3cpath%20d='M43%2034.6953V33.6963L45.5893%2029.75H47.2308V33.6787H48V34.6953H47.2308V35.75H45.977V34.6953H43ZM46.0012%2033.6787V31.1328H45.9528L44.3204%2033.6318V33.6787H46.0012Z'%20fill='%2324292E'/%3e%3cpath%20d='M57%2021.7499H72V9.79071C72%209.51466%2071.934%209.24992%2071.8164%209.05473C71.6989%208.85954%2071.5394%208.74988%2071.3732%208.74988H57V21.7499Z'%20fill='url(%23paint3_linear_1144_162613)'/%3e%3cpath%20d='M72%2026.2499H57V39.2499H72V26.2499Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M64.4602%2035.75C63.0525%2035.75%2062.0266%2035.0188%2062%2033.9957H63.3944C63.4276%2034.4552%2063.8891%2034.7673%2064.4602%2034.7673C65.1341%2034.7673%2065.6155%2034.3425%2065.6155%2033.7269C65.6155%2033.1055%2065.1242%2032.6749%2064.4402%2032.672C64.0385%2032.672%2063.6335%2032.8251%2063.4243%2033.0708L62.1461%2032.8714L62.4681%2029.75H66.6248V30.7731H63.6534L63.4774%2032.2558H63.5173C63.7563%2031.9639%2064.2709%2031.7471%2064.8685%2031.7471C66.0936%2031.7471%2067.0033%2032.5621%2067%2033.6951C67.0033%2034.8916%2065.9741%2035.75%2064.4602%2035.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M64.4986%2018.25C63.1902%2018.25%2062.2472%2017.5456%2062.25%2016.5989C62.2472%2015.8688%2062.7994%2015.2728%2063.5074%2015.1559V15.116C62.89%2014.9905%2062.4624%2014.4601%2062.4652%2013.8213C62.4624%2012.9173%2063.3233%2012.25%2064.4986%2012.25C65.671%2012.25%2066.5319%2012.9173%2066.5348%2013.8213C66.5319%2014.4629%2066.0986%2014.9905%2065.4926%2015.116V15.1559C66.1893%2015.2728%2066.7472%2015.8688%2066.75%2016.5989C66.7472%2017.5456%2065.807%2018.25%2064.4986%2018.25ZM64.4986%2017.3432C65.0791%2017.3432%2065.4728%2016.9981%2065.4728%2016.5019C65.4728%2015.9971%2065.0593%2015.6321%2064.4986%2015.6321C63.935%2015.6321%2063.5244%2015.9971%2063.5244%2016.5019C63.5244%2016.9952%2063.9152%2017.3432%2064.4986%2017.3432ZM64.4986%2014.7338C64.9857%2014.7338%2065.3369%2014.4116%2065.3369%2013.9496C65.3369%2013.4962%2064.9914%2013.1797%2064.4986%2013.1797C64.003%2013.1797%2063.6603%2013.4933%2063.6603%2013.9496C63.6603%2014.4116%2064.0087%2014.7338%2064.4986%2014.7338Z'%20fill='%2324292E'/%3e%3cpath%20d='M85.9067%2030C86.6011%2030%2091.9327%2026%2091.9327%2024C91.9327%2022%2086.7357%2018%2085.9067%2018C85.0777%2018%2084.4023%2018.5%2084.4023%2019.4756C84.4023%2020.4512%2087.9067%2022.9206%2087.9067%2022.9206C87.9067%2022.9206%2080.2539%2022.25%2080%2022.9206C79.7461%2023.5911%2079.7461%2024.4089%2080%2025.0794C80.2539%2025.75%2087.9067%2025.0794%2087.9067%2025.0794C87.9067%2025.0794%2084.4023%2027.75%2084.4023%2028.5301C84.4023%2029.3103%2085.2123%2030%2085.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip0_1144_162613)'%3e%3cpath%20d='M100%200.800641V10H124V0H101.003C100.737%200%20100.482%200.084353%20100.294%200.234502C100.106%200.384651%20100%200.588297%20100%200.800641Z'%20fill='url(%23paint4_linear_1144_162613)'/%3e%3cpath%20d='M124%2013H100V22.5H124V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2025.75H100V35.25H124V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2038.5H100V48H112H124V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M113.5%2040.25H112.072L110.5%2041.1699V42.4238L111.925%2041.6035H111.963V46.25H113.5V40.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2014.75H112.072L110.5%2015.6699V16.9238L111.925%2016.1035H111.963V20.75H113.5V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2027.5H112.072L110.5%2028.4199V29.6738L111.925%2028.8535H111.963V33.5H113.5V27.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162613)'%3e%3cpath%20d='M152%2013H128V22.5H152V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M152%2025.75H128V35.25H152V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M152%2038.5H128V48H140H152V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M128%200.800641V10H152V1.05456e-06H129.003L128%200L128%200.800641Z'%20fill='url(%23paint5_linear_1144_162613)'/%3e%3cpath%20d='M139.979%2020.75C141.308%2020.75%20142.253%2020.0257%20142.25%2019.0105C142.253%2018.2918%20141.796%2017.7785%20140.921%2017.673V17.6274C141.577%2017.5304%20142.042%2017.077%20142.04%2016.4211C142.042%2015.4686%20141.206%2014.75%20139.99%2014.75C138.766%2014.75%20137.875%2015.48%20137.864%2016.5181H139.173C139.184%2016.1188%20139.533%2015.8508%20139.99%2015.8508C140.425%2015.8508%20140.721%2016.1217%20140.719%2016.5124C140.721%2016.9173%20140.372%2017.1968%20139.868%2017.1968H139.317V18.2006H139.868C140.442%2018.2006%20140.816%2018.4914%20140.81%2018.9021C140.816%2019.3156%20140.472%2019.6036%20139.985%2019.6036C139.5%2019.6036%20139.143%2019.3384%20139.129%2018.9534H137.75C137.761%2020.0086%20138.683%2020.75%20139.979%2020.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M137.75%2032.4453V31.4463L140.339%2027.5H141.981V31.4287H142.75V32.4453H141.981V33.5H140.727V32.4453H137.75ZM140.751%2031.4287V28.8828H140.703L139.07%2031.3818V31.4287H140.751Z'%20fill='%2324292E'/%3e%3cpath%20d='M140.21%2046.25C138.802%2046.25%20137.777%2045.5188%20137.75%2044.4957H139.144C139.178%2044.9552%20139.639%2045.2673%20140.21%2045.2673C140.884%2045.2673%20141.366%2044.8425%20141.366%2044.2269C141.366%2043.6055%20140.874%2043.1749%20140.19%2043.172C139.789%2043.172%20139.383%2043.3251%20139.174%2043.5708L137.896%2043.3714L138.218%2040.25H142.375V41.2731H139.403L139.227%2042.7558H139.267C139.506%2042.4639%20140.021%2042.2471%20140.619%2042.2471C141.844%2042.2471%20142.753%2043.0621%20142.75%2044.1951C142.753%2045.3916%20141.724%2046.25%20140.21%2046.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1144_162613)'%3e%3cpath%20d='M180%2013H156V22.5H180V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M180%2025.75H156V35.25H180V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M180%2038.5H156V48H168H180V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M156%2010H180V0.800641C180%200.588297%20179.894%200.384651%20179.706%200.234502C179.518%200.084353%20179.263%200%20178.997%200L156%200V10Z'%20fill='url(%23paint6_linear_1144_162613)'/%3e%3cpath%20d='M167.999%2046.25C166.69%2046.25%20165.747%2045.5456%20165.75%2044.5989C165.747%2043.8688%20166.299%2043.2728%20167.007%2043.1559V43.116C166.39%2042.9905%20165.962%2042.4601%20165.965%2041.8213C165.962%2040.9173%20166.823%2040.25%20167.999%2040.25C169.171%2040.25%20170.032%2040.9173%20170.035%2041.8213C170.032%2042.4629%20169.599%2042.9905%20168.993%2043.116V43.1559C169.689%2043.2728%20170.247%2043.8688%20170.25%2044.5989C170.247%2045.5456%20169.307%2046.25%20167.999%2046.25ZM167.999%2045.3432C168.579%2045.3432%20168.973%2044.9981%20168.973%2044.5019C168.973%2043.9971%20168.559%2043.6321%20167.999%2043.6321C167.435%2043.6321%20167.024%2043.9971%20167.024%2044.5019C167.024%2044.9952%20167.415%2045.3432%20167.999%2045.3432ZM167.999%2042.7338C168.486%2042.7338%20168.837%2042.4116%20168.837%2041.9496C168.837%2041.4962%20168.491%2041.1797%20167.999%2041.1797C167.503%2041.1797%20167.16%2041.4933%20167.16%2041.9496C167.16%2042.4116%20167.509%2042.7338%20167.999%2042.7338Z'%20fill='%2324292E'/%3e%3cpath%20d='M166.188%2033.5L168.847%2028.5781V28.5371H165.75V27.5H170.25V28.5518L167.588%2033.5H166.188Z'%20fill='%2324292E'/%3e%3cpath%20d='M168.074%2020.75C166.878%2020.7443%20165.747%2020.0199%20165.75%2017.8812C165.756%2015.9192%20166.679%2014.75%20168.116%2014.75C169.278%2014.75%20170.074%2015.5%20170.19%2016.461H168.977C168.884%2016.0532%20168.562%2015.808%20168.116%2015.808C167.358%2015.808%20166.96%2016.5152%20166.955%2017.653H166.994C167.256%2017.1369%20167.821%2016.8289%20168.46%2016.8289C169.491%2016.8289%20170.253%2017.6188%20170.25%2018.7139C170.253%2019.903%20169.369%2020.7557%20168.074%2020.75ZM168.068%2019.7804C168.636%2019.7804%20169.06%2019.3327%20169.057%2018.7481C169.06%2018.1692%20168.645%2017.7215%20168.077%2017.7215C167.511%2017.7215%20167.082%2018.1834%20167.08%2018.7509C167.08%2019.3213%20167.5%2019.7804%20168.068%2019.7804Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162613'%20x1='0'%20y1='15.2551'%20x2='15'%20y2='15.2551'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162613'%20x1='19'%20y1='15.2552'%20x2='34'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162613'%20x1='38'%20y1='15.2552'%20x2='53'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162613'%20x1='57'%20y1='15.2551'%20x2='72'%20y2='15.2551'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_162613'%20x1='100'%20y1='5.004'%20x2='124'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1144_162613'%20x1='128.008'%20y1='5.004'%20x2='152.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_1144_162613'%20x1='156'%20y1='5.004'%20x2='180'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162613'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(100)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162613'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(128)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162613'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(156)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_25 = "data:image/svg+xml,%3csvg%20width='105'%20height='48'%20viewBox='0%200%20105%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162425)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1144_162425)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1144_162425)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M26.4792%2027C27.8085%2027%2028.7528%2026.2757%2028.75%2025.2605C28.7528%2024.5418%2028.2958%2024.0285%2027.4208%2023.923V23.8774C28.0771%2023.7804%2028.5423%2023.327%2028.5395%2022.6711C28.5423%2021.7186%2027.706%2021%2026.4903%2021C25.2663%2021%2024.3746%2021.73%2024.3635%2022.7681H25.6734C25.6845%2022.3688%2026.0334%2022.1008%2026.4903%2022.1008C26.9251%2022.1008%2027.2214%2022.3717%2027.2186%2022.7624C27.2214%2023.1673%2026.8725%2023.4468%2026.3685%2023.4468H25.8174V24.4506H26.3685C26.9417%2024.4506%2027.3155%2024.7414%2027.31%2025.1521C27.3155%2025.5656%2026.9721%2025.8536%2026.4848%2025.8536C26.0001%2025.8536%2025.6429%2025.5884%2025.6291%2025.2034H24.25C24.2611%2026.2586%2025.1832%2027%2026.4792%2027Z'%20fill='%2324292E'/%3e%3cpath%20d='M24%2043.4453V42.4463L26.5893%2038.5H28.2308V42.4287H29V43.4453H28.2308V44.5H26.977V43.4453H24ZM27.0012%2042.4287V39.8828H26.9528L25.3204%2042.3818V42.4287H27.0012Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0777%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2123%2030%2047.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M67.7955%2020.1818H68.2727V20.6591C68.2727%2020.9123%2068.3733%2021.155%2068.5523%2021.3341C68.7313%2021.5131%2068.9741%2021.6136%2069.2273%2021.6136C69.4804%2021.6136%2069.7232%2021.5131%2069.9022%2021.3341C70.0812%2021.155%2070.1818%2020.9123%2070.1818%2020.6591V20.1818H70.6591C70.9123%2020.1818%2071.155%2020.0813%2071.3341%2019.9022C71.5131%2019.7232%2071.6136%2019.4804%2071.6136%2019.2273C71.6136%2018.9741%2071.5131%2018.7313%2071.3341%2018.5523C71.155%2018.3733%2070.9123%2018.2727%2070.6591%2018.2727H70.1818V17.7955C70.1818%2017.5423%2070.0812%2017.2995%2069.9022%2017.1205C69.7232%2016.9415%2069.4804%2016.8409%2069.2273%2016.8409C68.9741%2016.8409%2068.7313%2016.9415%2068.5523%2017.1205C68.3733%2017.2995%2068.2727%2017.5423%2068.2727%2017.7955V18.2727H67.7955C67.5423%2018.2727%2067.2995%2018.3733%2067.1205%2018.5523C66.9415%2018.7313%2066.8409%2018.9741%2066.8409%2019.2273C66.8409%2019.4804%2066.9415%2019.7232%2067.1205%2019.9022C67.2995%2020.0813%2067.5423%2020.1818%2067.7955%2020.1818ZM67.2036%2030.7964C67.3825%2030.9742%2067.6244%2031.0739%2067.8766%2031.0739C68.1288%2031.0739%2068.3707%2030.9742%2068.5495%2030.7964L69.2273%2030.1186L69.905%2030.7964C70.0838%2030.9742%2070.3258%2031.0739%2070.578%2031.0739C70.8301%2031.0739%2071.0721%2030.9742%2071.2509%2030.7964C71.4287%2030.6175%2071.5285%2030.3756%2071.5285%2030.1234C71.5285%2029.8712%2071.4287%2029.6293%2071.2509%2029.4505L70.5732%2028.7727L71.2509%2028.095C71.4073%2027.9124%2071.489%2027.6775%2071.4797%2027.4373C71.4704%2027.197%2071.3709%2026.9691%2071.2009%2026.7991C71.0309%2026.6291%2070.803%2026.5296%2070.5627%2026.5203C70.3225%2026.511%2070.0876%2026.5927%2069.905%2026.7491L69.2273%2027.4268L68.5495%2026.7491C68.3669%2026.5927%2068.132%2026.511%2067.8918%2026.5203C67.6516%2026.5296%2067.4237%2026.6291%2067.2537%2026.7991C67.0837%2026.9691%2066.9841%2027.197%2066.9748%2027.4373C66.9655%2027.6775%2067.0473%2027.9124%2067.2036%2028.095L67.8814%2028.7727L67.2036%2029.4505C67.0259%2029.6293%2066.9261%2029.8712%2066.9261%2030.1234C66.9261%2030.3756%2067.0259%2030.6175%2067.2036%2030.7964V30.7964ZM81.6364%2013.5H66.3636C65.6042%2013.5%2064.8758%2013.8017%2064.3387%2014.3387C63.8017%2014.8758%2063.5%2015.6042%2063.5%2016.3636V31.6364C63.5%2032.3959%2063.8017%2033.1242%2064.3387%2033.6613C64.8758%2034.1983%2065.6042%2034.5%2066.3636%2034.5H81.6364C82.3958%2034.5%2083.1242%2034.1983%2083.6613%2033.6613C84.1983%2033.1242%2084.5%2032.3959%2084.5%2031.6364V16.3636C84.5%2015.6042%2084.1983%2014.8758%2083.6613%2014.3387C83.1242%2013.8017%2082.3958%2013.5%2081.6364%2013.5V13.5ZM73.0455%2032.5909H66.3636C66.1105%2032.5909%2065.8677%2032.4903%2065.6887%2032.3113C65.5097%2032.1323%2065.4091%2031.8895%2065.4091%2031.6364V24.9545H73.0455V32.5909ZM73.0455%2023.0455H65.4091V16.3636C65.4091%2016.1105%2065.5097%2015.8677%2065.6887%2015.6887C65.8677%2015.5097%2066.1105%2015.4091%2066.3636%2015.4091H73.0455V23.0455ZM82.5909%2031.6364C82.5909%2031.8895%2082.4903%2032.1323%2082.3113%2032.3113C82.1323%2032.4903%2081.8895%2032.5909%2081.6364%2032.5909H74.9545V24.9545H82.5909V31.6364ZM82.5909%2023.0455H74.9545V15.4091H81.6364C81.8895%2015.4091%2082.1323%2015.5097%2082.3113%2015.6887C82.4903%2015.8677%2082.5909%2016.1105%2082.5909%2016.3636V23.0455ZM77.3409%2028.2955H80.2045C80.4577%2028.2955%2080.7005%2028.1949%2080.8795%2028.0159C81.0585%2027.8369%2081.1591%2027.5941%2081.1591%2027.3409C81.1591%2027.0878%2081.0585%2026.845%2080.8795%2026.6659C80.7005%2026.4869%2080.4577%2026.3864%2080.2045%2026.3864H77.3409C77.0877%2026.3864%2076.845%2026.4869%2076.6659%2026.6659C76.4869%2026.845%2076.3864%2027.0878%2076.3864%2027.3409C76.3864%2027.5941%2076.4869%2027.8369%2076.6659%2028.0159C76.845%2028.1949%2077.0877%2028.2955%2077.3409%2028.2955V28.2955ZM80.2045%2018.2727H77.3409C77.0877%2018.2727%2076.845%2018.3733%2076.6659%2018.5523C76.4869%2018.7313%2076.3864%2018.9741%2076.3864%2019.2273C76.3864%2019.4804%2076.4869%2019.7232%2076.6659%2019.9022C76.845%2020.0813%2077.0877%2020.1818%2077.3409%2020.1818H80.2045C80.4577%2020.1818%2080.7005%2020.0813%2080.8795%2019.9022C81.0585%2019.7232%2081.1591%2019.4804%2081.1591%2019.2273C81.1591%2018.9741%2081.0585%2018.7313%2080.8795%2018.5523C80.7005%2018.3733%2080.4577%2018.2727%2080.2045%2018.2727ZM77.3409%2031.1591H80.2045C80.4577%2031.1591%2080.7005%2031.0585%2080.8795%2030.8795C81.0585%2030.7005%2081.1591%2030.4577%2081.1591%2030.2045C81.1591%2029.9514%2081.0585%2029.7086%2080.8795%2029.5296C80.7005%2029.3506%2080.4577%2029.25%2080.2045%2029.25H77.3409C77.0877%2029.25%2076.845%2029.3506%2076.6659%2029.5296C76.4869%2029.7086%2076.3864%2029.9514%2076.3864%2030.2045C76.3864%2030.4577%2076.4869%2030.7005%2076.6659%2030.8795C76.845%2031.0585%2077.0877%2031.1591%2077.3409%2031.1591V31.1591Z'%20fill='white'/%3e%3cpath%20d='M90%209.79083V21.75H105V8.75H90.6268C90.4606%208.75%2090.3011%208.85966%2090.1836%209.05485C90.066%209.25005%2090%209.51479%2090%209.79083Z'%20fill='url(%23paint2_linear_1144_162425)'/%3e%3cpath%20d='M105%2026.25H90V39.25H105V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M98.5%2029.75H97.0716L95.5%2030.6699V31.9238L96.9253%2031.1035H96.9627V35.75H98.5V29.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M96.7744%2018.25C97.5264%2018.25%2098.0464%2017.9877%2098.3415%2017.4915H98.3837V18.1678H100V14.8682C100%2013.841%2098.9845%2013.25%2097.6107%2013.25C96.1595%2013.25%2095.3373%2013.9074%2095.2003%2014.7924L96.785%2014.8429C96.8587%2014.5332%2097.1434%2014.3436%2097.5966%2014.3436C98.0183%2014.3436%2098.2853%2014.5269%2098.2853%2014.8524V14.8682C98.2853%2015.1653%2097.9269%2015.2285%2097.0063%2015.3012C95.9136%2015.3834%2095%2015.7468%2095%2016.8214C95%2017.7822%2095.7414%2018.25%2096.7744%2018.25ZM97.305%2017.2386C96.9079%2017.2386%2096.6268%2017.068%2096.6268%2016.7456C96.6268%2016.4327%2096.9009%2016.243%2097.3893%2016.1767C97.7091%2016.1356%2098.1026%2016.0724%2098.2959%2015.9807V16.4422C98.2959%2016.9162%2097.8531%2017.2386%2097.305%2017.2386Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162425'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162425'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162425'%20x1='90'%20y1='15.2552'%20x2='105'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162425'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_26 = "data:image/svg+xml,%3csvg%20width='95'%20height='48'%20viewBox='0%200%2095%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1834_14939)'%3e%3cpath%20d='M0%200.611699V7.64012H14.394V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1834_14939)'/%3e%3cpath%20d='M33.606%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200L33.606%200V7.64012Z'%20fill='url(%23paint1_linear_1834_14939)'/%3e%3cpath%20d='M31.194%200H16.8V7.64012H31.194V0Z'%20fill='url(%23paint2_linear_1834_14939)'/%3e%3cpath%20d='M31.194%2010.0869H16.8V17.727H31.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2010.0869H0V17.727H14.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2010.0869H33.606V17.727H48V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2020.1799H33.606V27.8262H48V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2020.1799H16.8V27.8262H31.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2020.1799H0V27.8262H14.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2030.2668H16.8V37.907H31.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2030.2668H33.606V37.907H48V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2030.2668H0V37.907H14.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M31.194%2040.3599H16.8V48H31.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M48%2047.3883V40.3721H33.606V48H47.3985C47.558%2048%2047.711%2047.9355%2047.8238%2047.8208C47.9366%2047.7061%2048%2047.5505%2048%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2048V40.3721H0V47.3883C0%2047.5505%200.0633725%2047.7061%200.176176%2047.8208C0.28898%2047.9355%200.441975%2048%200.601504%2048H14.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030.4001C62.6011%2030.4001%2067.9327%2026.1334%2067.9327%2024.0001C67.9327%2021.8668%2062.7357%2017.6001%2061.9067%2017.6001C61.0777%2017.6001%2060.4023%2018.1334%2060.4023%2019.1741C60.4023%2020.2147%2063.9067%2022.8487%2063.9067%2022.8487C63.9067%2022.8487%2056.2539%2022.1334%2056%2022.8487C55.7461%2023.564%2055.7461%2024.4362%2056%2025.1515C56.2539%2025.8668%2063.9067%2025.1515%2063.9067%2025.1515C63.9067%2025.1515%2060.4023%2028.0001%2060.4023%2028.8323C60.4023%2029.6644%2061.2123%2030.4001%2061.9067%2030.4001Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M93.9457%2025.1875C93.9457%2026.9347%2093.4911%2028.3835%2092.4542%2029.6477H90.5366C91.3178%2028.7102%2091.9002%2026.8637%2091.9002%2025.1875C91.9002%2023.5114%2091.3178%2021.6648%2090.5366%2020.7273H92.4542C93.4911%2021.9915%2093.9457%2023.4404%2093.9457%2025.1875Z'%20fill='white'/%3e%3cpath%20d='M86.6153%2022.5457L87.4107%2024.236L88.2488%2022.5457H90.1948L88.7317%2025.2729L90.2658%2028.0002H88.334L87.4107%2026.2672L86.5158%2028.0002H84.5556L86.1039%2025.2729L84.655%2022.5457H86.6153Z'%20fill='white'/%3e%3cpath%20d='M80.8757%2025.1875C80.8757%2023.4404%2081.3303%2021.9915%2082.3672%2020.7273H84.2848C83.5036%2021.6648%2082.9212%2023.5114%2082.9212%2025.1875C82.9212%2026.8637%2083.5036%2028.7102%2084.2848%2029.6477H82.3672C81.3303%2028.3835%2080.8757%2026.9347%2080.8757%2025.1875Z'%20fill='white'/%3e%3cpath%20d='M79.7642%2022.5456V23.966H78.7699V28.0001H76.8097V23.966H76.1136V22.5456H76.8097V22.3893C76.8097%2021.0399%2077.5767%2020.3865%2078.7699%2020.3865C79.2671%2020.3865%2079.7926%2020.4859%2080.0199%2020.5427L79.7358%2021.949C79.5938%2021.9064%2079.3807%2021.878%2079.2386%2021.878C78.8693%2021.878%2078.7699%2022.0484%2078.7699%2022.3041V22.5456H79.7642Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1834_14939'%20x1='0'%20y1='3.82312'%20x2='14.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1834_14939'%20x1='33.606'%20y1='3.82312'%20x2='48'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1834_14939'%20x1='16.8'%20y1='3.82312'%20x2='31.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1834_14939'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_27 = "data:image/svg+xml,%3csvg%20width='119'%20height='48'%20viewBox='0%200%20119%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.3704%2020.6776C42.308%2020.6218%2042.2344%2020.5781%2042.1539%2020.549C41.9941%2020.4877%2041.815%2020.4877%2041.6552%2020.549C41.5747%2020.5781%2041.5011%2020.6218%2041.4387%2020.6776L40.1265%2021.9023C40.0029%2022.0177%2039.9335%2022.174%2039.9335%2022.3371C39.9335%2022.5002%2040.0029%2022.6566%2040.1265%2022.7719C40.25%2022.8872%2040.4176%2022.952%2040.5923%2022.952C40.7671%2022.952%2040.9346%2022.8872%2041.0582%2022.7719L41.2484%2022.5882V27.2361C41.2484%2027.3985%2041.3176%2027.5543%2041.4406%2027.6691C41.5637%2027.784%2041.7306%2027.8485%2041.9046%2027.8485C42.0786%2027.8485%2042.2455%2027.784%2042.3685%2027.6691C42.4916%2027.5543%2042.5607%2027.3985%2042.5607%2027.2361V22.5882L42.751%2022.7719C42.8119%2022.8293%2042.8845%2022.8749%2042.9645%2022.906C43.0444%2022.937%2043.1302%2022.953%2043.2168%2022.953C43.3034%2022.953%2043.3892%2022.937%2043.4691%2022.906C43.5491%2022.8749%2043.6216%2022.8293%2043.6826%2022.7719C43.7441%2022.715%2043.7929%2022.6473%2043.8263%2022.5726C43.8596%2022.498%2043.8767%2022.418%2043.8767%2022.3371C43.8767%2022.2563%2043.8596%2022.1762%2043.8263%2022.1016C43.7929%2022.027%2043.7441%2021.9593%2043.6826%2021.9023L42.3704%2020.6776ZM45.8413%2021.7247H52.4024C52.5764%2021.7247%2052.7433%2021.6602%2052.8664%2021.5454C52.9894%2021.4305%2053.0585%2021.2748%2053.0585%2021.1124C53.0585%2020.95%2052.9894%2020.7942%2052.8664%2020.6794C52.7433%2020.5645%2052.5764%2020.5%2052.4024%2020.5H45.8413C45.6672%2020.5%2045.5004%2020.5645%2045.3773%2020.6794C45.2543%2020.7942%2045.1851%2020.95%2045.1851%2021.1124C45.1851%2021.2748%2045.2543%2021.4305%2045.3773%2021.5454C45.5004%2021.6602%2045.6672%2021.7247%2045.8413%2021.7247V21.7247ZM52.4024%2026.6237H45.8413C45.6672%2026.6237%2045.5004%2026.6883%2045.3773%2026.8031C45.2543%2026.9179%2045.1851%2027.0737%2045.1851%2027.2361C45.1851%2027.3985%2045.2543%2027.5543%2045.3773%2027.6691C45.5004%2027.784%2045.6672%2027.8485%2045.8413%2027.8485H52.4024C52.5764%2027.8485%2052.7433%2027.784%2052.8664%2027.6691C52.9894%2027.5543%2053.0585%2027.3985%2053.0585%2027.2361C53.0585%2027.0737%2052.9894%2026.9179%2052.8664%2026.8031C52.7433%2026.6883%2052.5764%2026.6237%2052.4024%2026.6237ZM52.4024%2023.5619H45.8413C45.6672%2023.5619%2045.5004%2023.6264%2045.3773%2023.7412C45.2543%2023.8561%2045.1851%2024.0118%2045.1851%2024.1742C45.1851%2024.3367%2045.2543%2024.4924%2045.3773%2024.6073C45.5004%2024.7221%2045.6672%2024.7866%2045.8413%2024.7866H52.4024C52.5764%2024.7866%2052.7433%2024.7221%2052.8664%2024.6073C52.9894%2024.4924%2053.0585%2024.3367%2053.0585%2024.1742C53.0585%2024.0118%2052.9894%2023.8561%2052.8664%2023.7412C52.7433%2023.6264%2052.5764%2023.5619%2052.4024%2023.5619Z'%20fill='white'/%3e%3cpath%20d='M66.9067%2030C67.6011%2030%2072.9327%2026%2072.9327%2024C72.9327%2022%2067.7357%2018%2066.9067%2018C66.0777%2018%2065.4023%2018.5%2065.4023%2019.4756C65.4023%2020.4512%2068.9067%2022.9206%2068.9067%2022.9206C68.9067%2022.9206%2061.2539%2022.25%2061%2022.9206C60.7461%2023.5911%2060.7461%2024.4089%2061%2025.0794C61.2539%2025.75%2068.9067%2025.0794%2068.9067%2025.0794C68.9067%2025.0794%2065.4023%2027.75%2065.4023%2028.5301C65.4023%2029.3103%2066.2123%2030%2066.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip0_1144_162073)'%3e%3cpath%20d='M81%201.05495V13.1763H95.9563V0H81.625C81.4592%200%2081.3003%200.111146%2081.1831%200.308988C81.0658%200.506829%2081%200.77516%2081%201.05495Z'%20fill='url(%23paint0_linear_1144_162073)'/%3e%3cpath%20d='M95.9563%2017.3962H81V30.5725H95.9563V17.3962Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M95.9563%2034.8132H81V48.0001H95.9563V34.8132Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M81%201.04083V13H96V0H81.6268C81.4606%200%2081.3011%200.109659%2081.1836%200.304853C81.066%200.500047%2081%200.764787%2081%201.04083Z'%20fill='url(%23paint1_linear_1144_162073)'/%3e%3cpath%20d='M96%2017.5H81V30.5H96V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M96%2035H81V48H96V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M88.58%2010.25H89.0225V9.63828C90.2662%209.57764%2090.9946%208.9791%2091%208.00879C90.9946%207.14658%2090.3984%206.61924%2089.3085%206.38457L89.0225%206.32129V5.19541C89.4056%205.25078%2089.616%205.46699%2089.6457%205.79395H90.9245C90.9137%204.84209%2090.1826%204.18027%2089.0225%204.10908V3.5H88.58V4.10908C87.4362%204.18555%2086.6349%204.83418%2086.643%205.77813C86.6403%206.59814%2087.2284%207.05957%2088.1835%207.27314L88.58%207.36279V8.55195C88.1079%208.49658%2087.8058%208.23291%2087.7788%207.77676H86.5C86.5162%208.97119%2087.3174%209.575%2088.58%209.63828V10.25ZM89.0225%208.54932V7.4709C89.446%207.59746%2089.6403%207.75039%2089.6457%208.00615C89.6403%208.28565%2089.4164%208.49131%2089.0225%208.54932ZM88.58%206.21582C88.2266%206.11035%2088.0162%205.95215%2088.0243%205.68848C88.027%205.44063%2088.2104%205.24814%2088.58%205.19541V6.21582Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162073)'%3e%3cpath%20d='M114.956%2017.3962H100V30.5725H114.956V17.3962Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M114.956%2034.8132H100V48.0001H114.956V34.8132Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M115%2017.5001H100V30.5001H115V17.5001Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M115%2035.0001H100V48.0001H115V35.0001Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M100%2013.0001H115V1.04089C115%200.764848%20114.934%200.500108%20114.816%200.304914C114.699%200.10972%20114.539%206.10352e-05%20114.373%206.10352e-05L100%206.10352e-05V13.0001Z'%20fill='url(%23paint2_linear_1144_162073)'/%3e%3cpath%20d='M107.58%2010.25H108.022V9.63828C109.266%209.57764%20109.995%208.9791%20110%208.00879C109.995%207.14658%20109.398%206.61924%20108.308%206.38457L108.022%206.32129V5.19541C108.406%205.25078%20108.616%205.46699%20108.646%205.79395H109.924C109.914%204.84209%20109.183%204.18027%20108.022%204.10908V3.5H107.58V4.10908C106.436%204.18555%20105.635%204.83418%20105.643%205.77813C105.64%206.59814%20106.228%207.05957%20107.183%207.27314L107.58%207.36279V8.55195C107.108%208.49658%20106.806%208.23291%20106.779%207.77676H105.5C105.516%208.97119%20106.317%209.575%20107.58%209.63828V10.25ZM108.022%208.54932V7.4709C108.446%207.59746%20108.64%207.75039%20108.646%208.00615C108.64%208.28565%20108.416%208.49131%20108.022%208.54932ZM107.58%206.21582C107.227%206.11035%20107.016%205.95215%20107.024%205.68848C107.027%205.44063%20107.21%205.24814%20107.58%205.19541V6.21582Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1144_162073)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint3_linear_1144_162073)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1144_162073)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint4_linear_1144_162073)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24.5%209.43623H26.0663V8.71449H26.1149C26.3155%209.12609%2026.7621%209.5%2027.5129%209.5C28.6133%209.5%2029.5%208.72898%2029.5%207.21304C29.5%205.64203%2028.5615%204.92609%2027.5227%204.92609C26.7362%204.92609%2026.3058%205.33768%2026.1149%205.74638H26.0825V3.5H24.5V9.43623ZM26.0502%207.21015C26.0502%206.48261%2026.3867%206.03333%2026.966%206.03333C27.5518%206.03333%2027.8754%206.4942%2027.8754%207.21015C27.8754%207.92899%2027.5518%208.39565%2026.966%208.39565C26.3867%208.39565%2026.0502%207.93188%2026.0502%207.21015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162073'%20x1='81'%20y1='6.59344'%20x2='95.9563'%20y2='6.59344'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162073'%20x1='81'%20y1='6.5052'%20x2='96'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162073'%20x1='100'%20y1='6.50527'%20x2='115'%20y2='6.50527'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162073'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1144_162073'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162073'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(81)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162073'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(100)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1144_162073'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1144_162073'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_28 = "data:image/svg+xml,%3csvg%20width='96'%20height='48'%20viewBox='0%200%2096%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162454)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M6.84608%2027C7.52244%2027%207.9902%2026.7377%208.25569%2026.2415H8.29362V26.9178H9.74747V23.6182C9.74747%2022.591%208.83407%2022%207.59829%2022C6.29298%2022%205.55341%2022.6574%205.43015%2023.5424L6.85556%2023.5929C6.92193%2023.2832%207.17794%2023.0936%207.58565%2023.0936C7.96492%2023.0936%208.20512%2023.2769%208.20512%2023.6024V23.6182C8.20512%2023.9153%207.88274%2023.9785%207.05468%2024.0512C6.07174%2024.1334%205.25%2024.4968%205.25%2025.5714C5.25%2026.5322%205.91688%2027%206.84608%2027ZM7.32333%2025.9886C6.96618%2025.9886%206.71334%2025.818%206.71334%2025.4956C6.71334%2025.1827%206.95986%2024.993%207.39918%2024.9267C7.68679%2024.8856%208.04077%2024.8224%208.2146%2024.7307V25.1922C8.2146%2025.6662%207.81637%2025.9886%207.32333%2025.9886Z'%20fill='%2324292E'/%3e%3cpath%20d='M5%2044.4362H6.56634V43.7145H6.61489C6.81553%2044.1261%207.26214%2044.5%208.01294%2044.5C9.11327%2044.5%2010%2043.729%2010%2042.213C10%2040.642%209.06149%2039.9261%208.02265%2039.9261C7.23625%2039.9261%206.80583%2040.3377%206.61489%2040.7464H6.58252V38.5H5V44.4362ZM6.55016%2042.2101C6.55016%2041.4826%206.88673%2041.0333%207.46602%2041.0333C8.05178%2041.0333%208.3754%2041.4942%208.3754%2042.2101C8.3754%2042.929%208.05178%2043.3957%207.46602%2043.3957C6.88673%2043.3957%206.55016%2042.9319%206.55016%2042.2101Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1144_162454)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1144_162454)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M27.5%2021H26.0716L24.5%2021.9199V23.1738L25.9253%2022.3535H25.9627V27H27.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.3373%2044.5H28.75V43.3468H26.3341V43.3092L27.0472%2042.6561C28.3396%2041.5376%2028.6772%2040.9682%2028.6772%2040.289C28.6772%2039.2225%2027.8011%2038.5%2026.4476%2038.5C25.129%2038.5%2024.2471%2039.2543%2024.25%2040.4595H25.6151C25.6151%2039.9249%2025.947%2039.6156%2026.4418%2039.6156C26.9279%2039.6156%2027.2801%2039.9133%2027.2801%2040.4017C27.2801%2040.8439%2027.0006%2041.1445%2026.5116%2041.5809L24.3373%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0777%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2123%2030%2047.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M62%209.79083V21.75H77V8.75H62.6268C62.4606%208.75%2062.3011%208.85966%2062.1836%209.05485C62.066%209.25005%2062%209.51479%2062%209.79083Z'%20fill='url(%23paint2_linear_1144_162454)'/%3e%3cpath%20d='M77%2026.25H62V39.25H77V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M70.5%2029.75H69.0716L67.5%2030.6699V31.9238L68.9253%2031.1035H68.9627V35.75H70.5V29.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7744%2018.25C69.5264%2018.25%2070.0464%2017.9877%2070.3415%2017.4915H70.3837V18.1678H72V14.8682C72%2013.841%2070.9845%2013.25%2069.6107%2013.25C68.1595%2013.25%2067.3373%2013.9074%2067.2003%2014.7924L68.785%2014.8429C68.8587%2014.5332%2069.1434%2014.3436%2069.5966%2014.3436C70.0183%2014.3436%2070.2853%2014.5269%2070.2853%2014.8524V14.8682C70.2853%2015.1653%2069.9269%2015.2285%2069.0063%2015.3012C67.9136%2015.3834%2067%2015.7468%2067%2016.8214C67%2017.7822%2067.7414%2018.25%2068.7744%2018.25ZM69.305%2017.2386C68.9079%2017.2386%2068.6268%2017.068%2068.6268%2016.7456C68.6268%2016.4327%2068.9009%2016.243%2069.3893%2016.1767C69.7091%2016.1356%2070.1026%2016.0724%2070.2959%2015.9807V16.4422C70.2959%2016.9162%2069.8531%2017.2386%2069.305%2017.2386Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1144_162454)'%3e%3cpath%20d='M81%2021.75H96V9.79083C96%209.51479%2095.934%209.25005%2095.8164%209.05485C95.6989%208.85966%2095.5394%208.75%2095.3732%208.75H81V21.75Z'%20fill='url(%23paint3_linear_1144_162454)'/%3e%3cpath%20d='M96%2026.25H81V39.25H96V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M86.3373%2035.75H90.75V34.5968H88.3341V34.5592L89.0472%2033.9061C90.3396%2032.7876%2090.6772%2032.2182%2090.6772%2031.539C90.6772%2030.4725%2089.8011%2029.75%2088.4476%2029.75C87.129%2029.75%2086.2471%2030.5043%2086.25%2031.7095H87.6151C87.6151%2031.1749%2087.947%2030.8656%2088.4418%2030.8656C88.9279%2030.8656%2089.2801%2031.1633%2089.2801%2031.6517C89.2801%2032.0939%2089.0006%2032.3945%2088.5116%2032.8309L86.3373%2034.7211V35.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M86%2018.4362H87.5663V17.7145H87.6149C87.8155%2018.1261%2088.2621%2018.5%2089.0129%2018.5C90.1133%2018.5%2091%2017.729%2091%2016.213C91%2014.642%2090.0615%2013.9261%2089.0227%2013.9261C88.2362%2013.9261%2087.8058%2014.3377%2087.6149%2014.7464H87.5825V12.5H86V18.4362ZM87.5502%2016.2101C87.5502%2015.4826%2087.8867%2015.0333%2088.466%2015.0333C89.0518%2015.0333%2089.3754%2015.4942%2089.3754%2016.2101C89.3754%2016.929%2089.0518%2017.3957%2088.466%2017.3957C87.8867%2017.3957%2087.5502%2016.9319%2087.5502%2016.2101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162454'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162454'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162454'%20x1='62'%20y1='15.2552'%20x2='77'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162454'%20x1='81'%20y1='15.2552'%20x2='96'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162454'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162454'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%208.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_29 = "data:image/svg+xml,%3csvg%20width='138'%20height='59'%20viewBox='0%200%20138%2059'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_162345)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.68848%2053.3679H7.69842C7.6899%2052.5518%207.04004%2052%206.02583%2052C5.02868%2052%204.31064%2052.5433%204.31703%2053.3551C4.3149%2054.0178%204.77939%2054.3906%205.53365%2054.5632L5.98961%2054.6697C6.46902%2054.7805%206.68422%2054.9105%206.68848%2055.1555C6.68422%2055.4219%206.43493%2055.6072%206.01092%2055.6072C5.5443%2055.6072%205.23748%2055.3899%205.21404%2054.9702H4.2041C4.21689%2055.9908%204.9264%2056.4787%206.0237%2056.4787C7.11035%2056.4787%207.75382%2055.9865%207.75808%2055.1577C7.75382%2054.4609%207.28294%2054.0348%206.42214%2053.8452L6.04714%2053.7599C5.65083%2053.6747%205.39941%2053.5426%205.40794%2053.2827C5.41007%2053.044%205.61461%2052.8714%206.0237%2052.8714C6.43493%2052.8714%206.66078%2053.0568%206.68848%2053.3679Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M10.3%2052.0597H9.322L8.24601%2052.7287V53.6406L9.22186%2053.044H9.24743V56.4233H10.3V52.0597Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M27.3343%2035.5H30.674V31.174H35V27.8343H30.674V23.5H27.3343V27.8343H23V31.174H27.3343V35.5Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M58%2027H43V40H58V27Z'%20fill='%233865AB'/%3e%3cpath%20d='M43%2010.5408V22.5H58V9.5H43.6268L43%209.50004L43%2010.5408Z'%20fill='url(%23paint1_linear_1144_162345)'/%3e%3cpath%20d='M50.4792%2036.5C51.8085%2036.5%2052.7528%2035.7757%2052.75%2034.7605C52.7528%2034.0418%2052.2958%2033.5285%2051.4208%2033.423V33.3774C52.0771%2033.2804%2052.5423%2032.827%2052.5395%2032.1711C52.5423%2031.2186%2051.706%2030.5%2050.4903%2030.5C49.2663%2030.5%2048.3746%2031.23%2048.3635%2032.2681H49.6734C49.6845%2031.8688%2050.0334%2031.6008%2050.4903%2031.6008C50.9251%2031.6008%2051.2214%2031.8717%2051.2186%2032.2624C51.2214%2032.6673%2050.8725%2032.9468%2050.3685%2032.9468H49.8174V33.9506H50.3685C50.9417%2033.9506%2051.3155%2034.2414%2051.31%2034.6521C51.3155%2035.0656%2050.9721%2035.3536%2050.4848%2035.3536C50.0001%2035.3536%2049.6429%2035.0884%2049.6291%2034.7034H48.25C48.2611%2035.7586%2049.1832%2036.5%2050.4792%2036.5Z'%20fill='white'/%3e%3cpath%20d='M49.4844%2045.3679H50.4943C50.4858%2044.5518%2049.8359%2044%2048.8217%2044C47.8246%2044%2047.1065%2044.5433%2047.1129%2045.3551C47.1108%2046.0178%2047.5753%2046.3906%2048.3295%2046.5632L48.7855%2046.6697C49.2649%2046.7805%2049.4801%2046.9105%2049.4844%2047.1555C49.4801%2047.4219%2049.2308%2047.6072%2048.8068%2047.6072C48.3402%2047.6072%2048.0334%2047.3899%2048.0099%2046.9702H47C47.0128%2047.9908%2047.7223%2048.4787%2048.8196%2048.4787C49.9062%2048.4787%2050.5497%2047.9865%2050.554%2047.1577C50.5497%2046.4609%2050.0788%2046.0348%2049.218%2045.8452L48.843%2045.7599C48.4467%2045.6747%2048.1953%2045.5426%2048.2038%2045.2827C48.206%2045.044%2048.4105%2044.8714%2048.8196%2044.8714C49.2308%2044.8714%2049.4567%2045.0568%2049.4844%2045.3679Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M51.0781%2048.4233H54.3082V47.5732H52.5398V47.5455L53.0618%2047.0639C54.0078%2046.2393%2054.255%2045.8196%2054.255%2045.3189C54.255%2044.5327%2053.6136%2044%2052.6229%2044C51.6577%2044%2051.0121%2044.5561%2051.0142%2045.4446H52.0135C52.0135%2045.0504%2052.2564%2044.8224%2052.6186%2044.8224C52.9744%2044.8224%2053.2322%2045.0419%2053.2322%2045.402C53.2322%2045.728%2053.0277%2045.9496%2052.6697%2046.2713L51.0781%2047.6648V48.4233Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M49.7744%2018.5C50.5264%2018.5%2051.0464%2018.2377%2051.3415%2017.7415H51.3837V18.4178H53V15.1182C53%2014.091%2051.9845%2013.5%2050.6107%2013.5C49.1595%2013.5%2048.3373%2014.1574%2048.2003%2015.0424L49.785%2015.0929C49.8587%2014.7832%2050.1434%2014.5936%2050.5966%2014.5936C51.0183%2014.5936%2051.2853%2014.7769%2051.2853%2015.1024V15.1182C51.2853%2015.4153%2050.9269%2015.4785%2050.0063%2015.5512C48.9136%2015.6334%2048%2015.9968%2048%2017.0714C48%2018.0322%2048.7414%2018.5%2049.7744%2018.5ZM50.305%2017.4886C49.9079%2017.4886%2049.6268%2017.318%2049.6268%2016.9956C49.6268%2016.6827%2049.9009%2016.493%2050.3893%2016.4267C50.7091%2016.3856%2051.1026%2016.3224%2051.2959%2016.2307V16.6922C51.2959%2017.1662%2050.8531%2017.4886%2050.305%2017.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M71.9067%2035.5C72.6011%2035.5%2077.9327%2031.5%2077.9327%2029.5C77.9327%2027.5%2072.7357%2023.5%2071.9067%2023.5C71.0777%2023.5%2070.4023%2024%2070.4023%2024.9756C70.4023%2025.9512%2073.9067%2028.4206%2073.9067%2028.4206C73.9067%2028.4206%2066.2539%2027.75%2066%2028.4206C65.7461%2029.0911%2065.7461%2029.9089%2066%2030.5794C66.2539%2031.25%2073.9067%2030.5794%2073.9067%2030.5794C73.9067%2030.5794%2070.4023%2033.25%2070.4023%2034.0301C70.4023%2034.8103%2071.2123%2035.5%2071.9067%2035.5Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip0_1144_162345)'%3e%3cpath%20d='M110%2018.5H86V28H110V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110%2031.25H86V40.75H110V31.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110%2044H86V53.5H110V44Z'%20fill='%233865AB'/%3e%3cpath%20d='M86%206.30064V15.5H110V5.5H87.0029C86.7369%205.5%2086.4818%205.58435%2086.2937%205.7345C86.1057%205.88465%2086%206.0883%2086%206.30064Z'%20fill='url(%23paint2_linear_1144_162345)'/%3e%3cpath%20d='M97.4453%2022.3744H98.4394C98.431%2021.5545%2097.7913%2021%2096.7931%2021C95.8116%2021%2095.1049%2021.5459%2095.1111%2022.3616C95.1091%2023.0274%2095.5662%2023.402%2096.3086%2023.5754L96.7574%2023.6824C97.2293%2023.7938%2097.4411%2023.9244%2097.4453%2024.1706C97.4411%2024.4382%2097.1957%2024.6244%2096.7784%2024.6244C96.3191%2024.6244%2096.0171%2024.406%2095.9941%2023.9843H95C95.0126%2025.0098%2095.7109%2025.5%2096.791%2025.5C97.8605%2025.5%2098.4939%2025.0055%2098.4981%2024.1727C98.4939%2023.4726%2098.0304%2023.0445%2097.1832%2022.8539L96.8141%2022.7683C96.424%2022.6827%2096.1765%2022.55%2096.1849%2022.2888C96.187%2022.049%2096.3883%2021.8756%2096.791%2021.8756C97.1957%2021.8756%2097.418%2022.0618%2097.4453%2022.3744Z'%20fill='%2324292E'/%3e%3cpath%20d='M101%2021.0599H100.037L98.9783%2021.7322V22.6484L99.9388%2022.049H99.964V25.4443H101V21.0599Z'%20fill='%2324292E'/%3e%3cpath%20d='M97.4453%2035.1244H98.4394C98.431%2034.3045%2097.7913%2033.75%2096.7931%2033.75C95.8116%2033.75%2095.1049%2034.2959%2095.1111%2035.1116C95.1091%2035.7774%2095.5662%2036.152%2096.3086%2036.3254L96.7574%2036.4324C97.2293%2036.5438%2097.4411%2036.6744%2097.4453%2036.9206C97.4411%2037.1882%2097.1957%2037.3744%2096.7784%2037.3744C96.3191%2037.3744%2096.0171%2037.156%2095.9941%2036.7343H95C95.0126%2037.7598%2095.7109%2038.25%2096.791%2038.25C97.8605%2038.25%2098.4939%2037.7555%2098.4981%2036.9227C98.4939%2036.2226%2098.0304%2035.7945%2097.1832%2035.6039L96.8141%2035.5183C96.424%2035.4327%2096.1765%2035.3%2096.1849%2035.0388C96.187%2034.799%2096.3883%2034.6256%2096.791%2034.6256C97.1957%2034.6256%2097.418%2034.8118%2097.4453%2035.1244Z'%20fill='%2324292E'/%3e%3cpath%20d='M101%2033.8099H100.037L98.9783%2034.4822V35.3984L99.9388%2034.799H99.964V38.1943H101V33.8099Z'%20fill='%2324292E'/%3e%3cpath%20d='M96.9962%2047.8744H98.0109C98.0024%2047.0545%2097.3494%2046.5%2096.3304%2046.5C95.3285%2046.5%2094.607%2047.0459%2094.6135%2047.8616C94.6113%2048.5274%2095.078%2048.902%2095.8359%2049.0754L96.294%2049.1824C96.7757%2049.2938%2096.9919%2049.4244%2096.9962%2049.6706C96.9919%2049.9382%2096.7414%2050.1244%2096.3154%2050.1244C95.8466%2050.1244%2095.5383%2049.906%2095.5147%2049.4843H94.5C94.5128%2050.5098%2095.2257%2051%2096.3283%2051C97.4201%2051%2098.0666%2050.5055%2098.0709%2049.6727C98.0666%2048.9726%2097.5935%2048.5445%2096.7286%2048.3539L96.3518%2048.2683C95.9536%2048.1827%2095.701%2048.05%2095.7096%2047.7888C95.7117%2047.549%2095.9172%2047.3756%2096.3283%2047.3756C96.7414%2047.3756%2096.9684%2047.5618%2096.9962%2047.8744Z'%20fill='white'/%3e%3cpath%20d='M98.5975%2050.9443H101.843V50.0902H100.066V50.0623L100.591%2049.5785C101.541%2048.75%20101.789%2048.3283%20101.789%2047.8252C101.789%2047.0352%20101.145%2046.5%20100.15%2046.5C99.1798%2046.5%2098.5312%2047.0588%2098.5333%2047.9515H99.5373C99.5373%2047.5554%2099.7814%2047.3264%20100.145%2047.3264C100.503%2047.3264%20100.762%2047.5469%20100.762%2047.9087C100.762%2048.2362%20100.556%2048.4588%20100.197%2048.7821L98.5975%2050.1822V50.9443Z'%20fill='white'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_162345)'%3e%3cpath%20d='M114%2015.5H138V6.30064C138%206.0883%20137.894%205.88465%20137.706%205.7345C137.518%205.58435%20137.263%205.5%20136.997%205.5H114V15.5Z'%20fill='url(%23paint3_linear_1144_162345)'/%3e%3cpath%20d='M138%2018.5H114V28H138V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M138%2031.25H114V40.75H138V31.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M138%2044H114V53.5H138V44Z'%20fill='%233865AB'/%3e%3cpath%20d='M127%2020.25H125.572L124%2021.1699V22.4238L125.425%2021.6035H125.463V26.25H127V20.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M123.837%2039H128.25V37.8468H125.834V37.8092L126.547%2037.1561C127.84%2036.0376%20128.177%2035.4682%20128.177%2034.789C128.177%2033.7225%20127.301%2033%20125.948%2033C124.629%2033%20123.747%2033.7543%20123.75%2034.9595H125.115C125.115%2034.4249%20125.447%2034.1156%20125.942%2034.1156C126.428%2034.1156%20126.78%2034.4133%20126.78%2034.9017C126.78%2035.3439%20126.501%2035.6445%20126.012%2036.0809L123.837%2037.9711V39Z'%20fill='%2324292E'/%3e%3cpath%20d='M125.979%2051.75C127.308%2051.75%20128.253%2051.0257%20128.25%2050.0105C128.253%2049.2918%20127.796%2048.7785%20126.921%2048.673V48.6274C127.577%2048.5304%20128.042%2048.077%20128.04%2047.4211C128.042%2046.4686%20127.206%2045.75%20125.99%2045.75C124.766%2045.75%20123.875%2046.48%20123.864%2047.5181H125.173C125.184%2047.1188%20125.533%2046.8508%20125.99%2046.8508C126.425%2046.8508%20126.721%2047.1217%20126.719%2047.5124C126.721%2047.9173%20126.372%2048.1968%20125.868%2048.1968H125.317V49.2006H125.868C126.442%2049.2006%20126.816%2049.4914%20126.81%2049.9021C126.816%2050.3156%20126.472%2050.6036%20125.985%2050.6036C125.5%2050.6036%20125.143%2050.3384%20125.129%2049.9534H123.75C123.761%2051.0086%20124.683%2051.75%20125.979%2051.75Z'%20fill='white'/%3e%3cpath%20d='M124.774%2013C125.526%2013%20126.046%2012.7377%20126.342%2012.2415H126.384V12.9178H128V9.6182C128%208.59102%20126.985%208%20125.611%208C124.16%208%20123.337%208.6574%20123.2%209.54235L124.785%209.59292C124.859%209.28319%20125.143%209.09355%20125.597%209.09355C126.018%209.09355%20126.285%209.27686%20126.285%209.6024V9.6182C126.285%209.9153%20125.927%209.97851%20125.006%2010.0512C123.914%2010.1334%20123%2010.4968%20123%2011.5714C123%2012.5322%20123.741%2013%20124.774%2013ZM125.305%2011.9886C124.908%2011.9886%20124.627%2011.818%20124.627%2011.4956C124.627%2011.1827%20124.901%2010.993%20125.389%2010.9267C125.709%2010.8856%20126.103%2010.8224%20126.296%2010.7307V11.1922C126.296%2011.6662%20125.853%2011.9886%20125.305%2011.9886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162345'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_162345'%20x1='43'%20y1='16.0052'%20x2='58'%20y2='16.0052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1144_162345'%20x1='86'%20y1='10.504'%20x2='110'%20y2='10.504'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1144_162345'%20x1='114'%20y1='10.504'%20x2='138'%20y2='10.504'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_162345'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(86%205.5)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_162345'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(114%205.5)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_30 = "data:image/svg+xml,%3csvg%20width='114'%20height='48'%20viewBox='0%200%20114%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_smoothing_dark)'%3e%3cpath%20d='M0%200.611699V7.64012H7V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_smoothing_dark)'/%3e%3cpath%20d='M8%200H15V7.64012H8V0Z'%20fill='url(%23paint1_linear_smoothing_dark)'/%3e%3cpath%20d='M16%200H23V7.64012H16V0Z'%20fill='url(%23paint2_linear_smoothing_dark)'/%3e%3cpath%20d='M24%200H31V7.64012H24V0Z'%20fill='url(%23paint3_linear_smoothing_dark)'/%3e%3cpath%20d='M32%200H39V7.64012H32V0Z'%20fill='url(%23paint4_linear_smoothing_dark)'/%3e%3cpath%20d='M40%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200H40V7.64012Z'%20fill='url(%23paint5_linear_smoothing_dark)'/%3e%3cpath%20d='M2%2038L5%2028L8%2035L11%2025L14%2032L17%2022L20%2030L23%2020L26%2028L29%2024L32%2031L35%2026L38%2033L41%2029L44%2036L46%2032'%20stroke='%2384AFF1'%20stroke-width='2'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2%2038L5%2028L8%2035L11%2025L14%2032L17%2022L20%2030L23%2020L26%2028L29%2024L32%2031L35%2026L38%2033L41%2029L44%2036L46%2032L46%2048L2%2048Z'%20fill='url(%23paint6_linear_smoothing_dark)'%20opacity='0.3'/%3e%3c/g%3e%3cpath%20d='M57.91%2030C58.6%2030%2064%2026%2064%2024C64%2022%2058.7%2018%2057.91%2018C57.08%2018%2056.4%2018.5%2056.4%2019.48C56.4%2020.45%2059.91%2022.92%2059.91%2022.92C59.91%2022.92%2052.25%2022.25%2052%2022.92C51.75%2023.59%2051.75%2024.41%2052%2025.08C52.25%2025.75%2059.91%2025.08%2059.91%2025.08C59.91%2025.08%2056.4%2027.75%2056.4%2028.53C56.4%2029.31%2057.21%2030%2057.91%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_smoothing_dark)'%3e%3cpath%20d='M66%200.611699V7.64012H81V0H66.6015C66.442%200%2066.289%200.0644467%2066.1762%200.179162C66.0634%200.293878%2066%200.449466%2066%200.611699Z'%20fill='url(%23paint7_linear_smoothing_dark)'/%3e%3cpath%20d='M82%200H97V7.64012H82V0Z'%20fill='url(%23paint8_linear_smoothing_dark)'/%3e%3cpath%20d='M98%207.64012H114V0.611699C114%200.449466%20113.937%200.293878%20113.824%200.179162C113.711%200.0644467%20113.558%200%20113.399%200H98V7.64012Z'%20fill='url(%23paint9_linear_smoothing_dark)'/%3e%3cpath%20d='M68%2036Q77%2028%2086%2024Q95%2021%20112%2025'%20stroke='%2384AFF1'%20stroke-width='2.5'%20fill='none'%20stroke-linecap='round'/%3e%3cpath%20d='M68%2036Q77%2028%2086%2024Q95%2021%20112%2025L112%2048L68%2048Z'%20fill='url(%23paint10_linear_smoothing_dark)'%20opacity='0.3'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_smoothing_dark'%20x1='0'%20y1='3.82'%20x2='7'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_smoothing_dark'%20x1='8'%20y1='3.82'%20x2='15'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_smoothing_dark'%20x1='16'%20y1='3.82'%20x2='23'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_smoothing_dark'%20x1='24'%20y1='3.82'%20x2='31'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_smoothing_dark'%20x1='32'%20y1='3.82'%20x2='39'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_smoothing_dark'%20x1='40'%20y1='3.82'%20x2='48'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_smoothing_dark'%20x1='24'%20y1='48'%20x2='24'%20y2='20'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F60C4'%20stop-opacity='0'/%3e%3cstop%20offset='1'%20stop-color='%233865AB'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint7_linear_smoothing_dark'%20x1='66'%20y1='3.82'%20x2='81'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint8_linear_smoothing_dark'%20x1='82'%20y1='3.82'%20x2='97'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint9_linear_smoothing_dark'%20x1='98'%20y1='3.82'%20x2='114'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint10_linear_smoothing_dark'%20x1='90'%20y1='48'%20x2='90'%20y2='21'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F60C4'%20stop-opacity='0'/%3e%3cstop%20offset='1'%20stop-color='%233865AB'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_smoothing_dark'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_smoothing_dark'%3e%3crect%20width='48'%20height='48'%20fill='white'%20transform='translate(66)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_31 = "data:image/svg+xml,%3csvg%20width='77'%20height='48'%20viewBox='0%200%2077%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M23.3704%2020.6776C23.308%2020.6218%2023.2344%2020.5781%2023.1539%2020.549C22.9941%2020.4877%2022.815%2020.4877%2022.6552%2020.549C22.5747%2020.5781%2022.5011%2020.6218%2022.4387%2020.6776L21.1265%2021.9023C21.0029%2022.0177%2020.9335%2022.174%2020.9335%2022.3371C20.9335%2022.5002%2021.0029%2022.6566%2021.1265%2022.7719C21.25%2022.8872%2021.4176%2022.952%2021.5923%2022.952C21.7671%2022.952%2021.9346%2022.8872%2022.0582%2022.7719L22.2484%2022.5882V27.2361C22.2484%2027.3985%2022.3176%2027.5543%2022.4406%2027.6691C22.5637%2027.784%2022.7306%2027.8485%2022.9046%2027.8485C23.0786%2027.8485%2023.2455%2027.784%2023.3685%2027.6691C23.4916%2027.5543%2023.5607%2027.3985%2023.5607%2027.2361V22.5882L23.751%2022.7719C23.8119%2022.8293%2023.8845%2022.8749%2023.9645%2022.906C24.0444%2022.937%2024.1302%2022.953%2024.2168%2022.953C24.3034%2022.953%2024.3892%2022.937%2024.4691%2022.906C24.5491%2022.8749%2024.6216%2022.8293%2024.6826%2022.7719C24.7441%2022.715%2024.7929%2022.6473%2024.8263%2022.5726C24.8596%2022.498%2024.8767%2022.418%2024.8767%2022.3371C24.8767%2022.2563%2024.8596%2022.1762%2024.8263%2022.1016C24.7929%2022.027%2024.7441%2021.9593%2024.6826%2021.9023L23.3704%2020.6776ZM26.8413%2021.7247H33.4024C33.5764%2021.7247%2033.7433%2021.6602%2033.8664%2021.5454C33.9894%2021.4305%2034.0585%2021.2748%2034.0585%2021.1124C34.0585%2020.95%2033.9894%2020.7942%2033.8664%2020.6794C33.7433%2020.5645%2033.5764%2020.5%2033.4024%2020.5H26.8413C26.6672%2020.5%2026.5004%2020.5645%2026.3773%2020.6794C26.2543%2020.7942%2026.1851%2020.95%2026.1851%2021.1124C26.1851%2021.2748%2026.2543%2021.4305%2026.3773%2021.5454C26.5004%2021.6602%2026.6672%2021.7247%2026.8413%2021.7247ZM33.4024%2026.6237H26.8413C26.6672%2026.6237%2026.5004%2026.6883%2026.3773%2026.8031C26.2543%2026.918%2026.1851%2027.0737%2026.1851%2027.2361C26.1851%2027.3985%2026.2543%2027.5543%2026.3773%2027.6691C26.5004%2027.784%2026.6672%2027.8485%2026.8413%2027.8485H33.4024C33.5764%2027.8485%2033.7433%2027.784%2033.8664%2027.6691C33.9894%2027.5543%2034.0585%2027.3985%2034.0585%2027.2361C34.0585%2027.0737%2033.9894%2026.918%2033.8664%2026.8031C33.7433%2026.6883%2033.5764%2026.6237%2033.4024%2026.6237ZM33.4024%2023.5619H26.8413C26.6672%2023.5619%2026.5004%2023.6264%2026.3773%2023.7412C26.2543%2023.8561%2026.1851%2024.0118%2026.1851%2024.1742C26.1851%2024.3367%2026.2543%2024.4924%2026.3773%2024.6073C26.5004%2024.7221%2026.6672%2024.7866%2026.8413%2024.7866H33.4024C33.5764%2024.7866%2033.7433%2024.7221%2033.8664%2024.6073C33.9894%2024.4924%2034.0585%2024.3367%2034.0585%2024.1742C34.0585%2024.0118%2033.9894%2023.8561%2033.8664%2023.7412C33.7433%2023.6264%2033.5764%2023.5619%2033.4024%2023.5619Z'%20fill='white'/%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0777%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2123%2030%2047.9067%2030Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip0_1144_161700)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1144_161700)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1144_161700)'%3e%3cpath%20d='M77%2017.5H62V30.5H77V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2035H62V48H77V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M62%2013H77V1.04083C77%200.764787%2076.934%200.500047%2076.8164%200.304853C76.6989%200.109659%2076.5394%200%2076.3732%200L62%200V13Z'%20fill='url(%23paint1_linear_1144_161700)'/%3e%3cpath%20d='M70.5%2038.5H69.0716L67.5%2039.4199V40.6738L68.9253%2039.8535H68.9627V44.5H70.5V38.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.3373%2027H71.75V25.8468H69.3341V25.8092L70.0472%2025.1561C71.3396%2024.0376%2071.6772%2023.4682%2071.6772%2022.789C71.6772%2021.7225%2070.8011%2021%2069.4476%2021C68.129%2021%2067.2471%2021.7543%2067.25%2022.9595H68.6151C68.6151%2022.4249%2068.947%2022.1156%2069.4418%2022.1156C69.9279%2022.1156%2070.2801%2022.4133%2070.2801%2022.9017C70.2801%2023.3439%2070.0006%2023.6445%2069.5116%2024.0809L67.3373%2025.9711V27Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_161700'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1144_161700'%20x1='62'%20y1='6.5052'%20x2='77'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1144_161700'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1144_161700'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(62)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_32 = "data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.7436%2030.2214C10.4012%2030.2214%2010.0827%2030.3965%209.89924%2030.6856L1.15566%2044.4642C0.96022%2044.7722%200.947975%2045.1622%201.1237%2045.4818C1.29943%2045.8014%201.63525%2046%202%2046H24H46C46.3648%2046%2046.7006%2045.8014%2046.8763%2045.4818C47.052%2045.1622%2047.0398%2044.7722%2046.8443%2044.4642L38.1008%2030.6856C37.9173%2030.3965%2037.5988%2030.2214%2037.2564%2030.2214H24H10.7436Z'%20fill='url(%23paint0_linear_1144_162218)'%20stroke='%23CCCCDC'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M17.25%2026.7682C17.25%2030.6622%2021.6037%2035.6872%2024%2038.0189C26.3962%2035.6988%2030.75%2030.6622%2030.75%2026.7682C30.75%2024.9129%2030.0388%2023.1336%2028.773%2021.8218C27.5071%2020.5099%2025.7902%2019.7729%2024%2019.7729C22.2098%2019.7729%2020.4929%2020.5099%2019.227%2021.8218C17.9612%2023.1336%2017.25%2024.9129%2017.25%2026.7682ZM22.7501%2028.7068C23.1201%2028.963%2023.5551%2029.0997%2024.0001%2029.0997C24.5969%2029.0997%2025.1692%2028.8541%2025.5911%2028.4168C26.0131%2027.9795%2026.2501%2027.3864%2026.2501%2026.768C26.2501%2026.3068%2026.1182%2025.856%2025.8709%2025.4725C25.6237%2025.0891%2025.2723%2024.7902%2024.8612%2024.6137C24.45%2024.4372%2023.9976%2024.3911%2023.5612%2024.481C23.1247%2024.571%2022.7238%2024.7931%2022.4091%2025.1192C22.0945%2025.4453%2021.8802%2025.8608%2021.7934%2026.3131C21.7065%2026.7654%2021.7511%2027.2342%2021.9214%2027.6603C22.0917%2028.0864%2022.3801%2028.4506%2022.7501%2028.7068Z'%20fill='%23E02F44'/%3e%3cpath%20d='M24%2017.4426C21.6131%2017.4426%2019.3239%2018.4252%2017.636%2020.1744C15.9482%2021.9236%2015%2024.2959%2015%2026.7696C15%2033.0654%2022.9313%2040.1773%2023.2688%2040.4804C23.4725%2040.661%2023.7319%2040.7603%2024%2040.7603C24.2681%2040.7603%2024.5275%2040.661%2024.7312%2040.4804C25.125%2040.1773%2033%2033.0654%2033%2026.7696C33%2024.2959%2032.0518%2021.9236%2030.364%2020.1744C28.6761%2018.4252%2026.3869%2017.4426%2024%2017.4426ZM24%2038.0204C21.6037%2035.6886%2017.25%2030.6637%2017.25%2026.7696C17.25%2024.9144%2017.9612%2023.1351%2019.227%2021.8232C20.4929%2020.5113%2022.2098%2019.7743%2024%2019.7743C25.7902%2019.7743%2027.5071%2020.5113%2028.773%2021.8232C30.0388%2023.1351%2030.75%2024.9144%2030.75%2026.7696C30.75%2030.6637%2026.3963%2035.7003%2024%2038.0204Z'%20fill='%2322252B'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1144_162218'%20x1='46'%20y1='38.2709'%20x2='3.41025'%20y2='38.2709'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9830'/%3e%3cstop%20offset='1'%20stop-color='%23F2CC0C'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_33 = "data:image/svg+xml,%3csvg%20width='124'%20height='48'%20viewBox='0%200%20124%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1648_105791)'%3e%3cpath%20d='M76%200.611699V7.64012H90.394V0H76.6015C76.442%200%2076.289%200.0644467%2076.1762%200.179162C76.0634%200.293878%2076%200.449466%2076%200.611699Z'%20fill='url(%23paint0_linear_1648_105791)'/%3e%3cpath%20d='M109.606%207.64012H124V0.611699C124%200.449466%20123.937%200.293878%20123.824%200.179162C123.711%200.0644467%20123.558%200%20123.399%200L109.606%200V7.64012Z'%20fill='url(%23paint1_linear_1648_105791)'/%3e%3cpath%20d='M107.194%200H92.8V7.64012H107.194V0Z'%20fill='url(%23paint2_linear_1648_105791)'/%3e%3cpath%20d='M107.194%2010.0869H92.8V17.727H107.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M90.394%2010.0869H76V17.727H90.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2010.0869H109.606V17.727H124V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2020.1799H109.606V27.8262H124V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M107.194%2020.1799H92.8V27.8262H107.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M90.394%2020.1799H76V27.8262H90.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M107.194%2030.2668H92.8V37.907H107.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2030.2668H109.606V37.907H124V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M90.394%2030.2668H76V37.907H90.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M107.194%2040.3599H92.8V48H107.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M124%2047.3883V40.3721H109.606V48H123.399C123.558%2048%20123.711%2047.9355%20123.824%2047.8208C123.937%2047.7061%20124%2047.5505%20124%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M90.394%2048V40.3721H76V47.3883C76%2047.5505%2076.0634%2047.7061%2076.1762%2047.8208C76.289%2047.9355%2076.442%2048%2076.6015%2048H90.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030.4001C62.6011%2030.4001%2067.9327%2026.1334%2067.9327%2024.0001C67.9327%2021.8668%2062.7357%2017.6001%2061.9067%2017.6001C61.0777%2017.6001%2060.4023%2018.1334%2060.4023%2019.1741C60.4023%2020.2147%2063.9067%2022.8487%2063.9067%2022.8487C63.9067%2022.8487%2056.2539%2022.1334%2056%2022.8487C55.7461%2023.564%2055.7461%2024.4362%2056%2025.1515C56.2539%2025.8668%2063.9067%2025.1515%2063.9067%2025.1515C63.9067%2025.1515%2060.4023%2028.0001%2060.4023%2028.8323C60.4023%2029.6644%2061.2123%2030.4001%2061.9067%2030.4001Z'%20fill='%23CCCCDC'/%3e%3cg%20clip-path='url(%23clip1_1648_105791)'%3e%3cpath%20d='M20.5658%2014.8473C20.3887%2014.8474%2020.2137%2014.8094%2020.0526%2014.736L10.9631%2010.6159L1.6881%2014.1483C1.38144%2014.2648%201.04108%2014.2546%200.741903%2014.12C0.442727%2013.9854%200.20924%2013.7375%200.092806%2013.4307C-0.0236282%2013.1238%20-0.0134715%2012.7833%200.121042%2012.484C0.255555%2012.1847%200.503406%2011.9511%200.810071%2011.8346L10.5797%208.12275C10.8826%207.9973%2011.2229%207.9973%2011.5258%208.12275L20.2813%2012.0882L29.5563%202.19003C29.734%202.01998%2029.9583%201.90678%2030.2006%201.86491C30.4429%201.82304%2030.6922%201.85438%2030.9166%201.95495L40.2844%206.01939L49.0832%200.204206C49.2188%200.111618%2049.3714%200.0469507%2049.5322%200.0139747C49.693%20-0.0190012%2049.8587%20-0.0196266%2050.0197%200.0121352C50.1807%200.043897%2050.3338%200.10741%2050.4701%200.198973C50.6063%200.290536%2050.723%200.408317%2050.8133%200.545449C50.9036%200.682581%2050.9656%200.836322%2050.9959%200.997709C51.0262%201.1591%2051.0241%201.3249%2050.9897%201.48546C50.9553%201.64602%2050.8893%201.79812%2050.7955%201.93289C50.7017%202.06766%2050.5821%202.18241%2050.4436%202.27045L41.0882%208.45682C40.9161%208.56985%2040.7185%208.63811%2040.5133%208.6554C40.3082%208.67268%2040.1019%208.63845%2039.9134%208.5558L30.7435%204.57178L21.4685%2014.47C21.3516%2014.591%2021.2113%2014.6869%2021.056%2014.7518C20.9008%2014.8167%2020.734%2014.8492%2020.5658%2014.8473Z'%20fill='url(%23paint3_linear_1648_105791)'/%3e%3cpath%20d='M49.7634%2010.9624L40.408%2020.8606L30.4343%2013.4369L20.5657%2020.8606L11.0063%2019.0047L1.23669%2027.047H1.30471V47.994H49.8932L49.7634%2010.9624Z'%20fill='url(%23paint4_linear_1648_105791)'/%3e%3cpath%20d='M1.30471%2028.2841H1.23669C0.982572%2028.2834%200.734861%2028.2043%200.527257%2028.0577C0.319654%2027.911%200.162238%2027.704%200.0764263%2027.4647C-0.00938568%2027.2254%20-0.0194273%2026.9654%200.0476675%2026.7202C0.114762%2026.475%200.255736%2026.2564%200.451409%2026.0942L10.2211%2018.0519C10.3615%2017.9361%2010.5258%2017.8528%2010.7022%2017.8079C10.8785%2017.763%2011.0626%2017.7576%2011.2413%2017.7921L20.2628%2019.5428L29.6799%2012.447C29.894%2012.2864%2030.1544%2012.1996%2030.4219%2012.1996C30.6895%2012.1996%2030.9499%2012.2864%2031.1639%2012.447L40.2534%2019.2149L48.8482%2010.1148C48.9578%209.9891%2049.0917%209.88688%2049.2418%209.81428C49.3919%209.74167%2049.5551%209.70018%2049.7217%209.6923C49.8882%209.68442%2050.0546%209.7103%2050.2109%209.76841C50.3671%209.82651%2050.5101%209.91562%2050.631%2010.0304C50.752%2010.1452%2050.8485%2010.2832%2050.9148%2010.4363C50.9811%2010.5893%2051.0158%2010.7542%2051.0167%2010.921C51.0177%2011.0878%2050.985%2011.2531%2050.9205%2011.4069C50.856%2011.5607%2050.761%2011.6999%2050.6414%2011.816L41.3046%2021.7142C41.0967%2021.9331%2040.816%2022.0685%2040.5153%2022.0947C40.2146%2022.1209%2039.9148%2022.0362%2039.6722%2021.8565L30.4405%2014.9835L21.3077%2021.8503C21.1699%2021.9547%2021.0118%2022.0289%2020.8435%2022.0684C20.6752%2022.1078%2020.5006%2022.1115%2020.3308%2022.0792L11.3402%2020.3347L2.31259%2027.7583C2.19886%2027.9202%202.04798%2028.0524%201.87261%2028.1439C1.69724%2028.2354%201.50249%2028.2835%201.30471%2028.2841Z'%20fill='%2384AFF1'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1648_105791'%20x1='76'%20y1='3.82312'%20x2='90.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1648_105791'%20x1='109.606'%20y1='3.82312'%20x2='124'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1648_105791'%20x1='92.8'%20y1='3.82312'%20x2='107.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1648_105791'%20x1='5.62111e-05'%20y1='7.42369'%20x2='51.0001'%20y2='7.42369'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1648_105791'%20x1='25.4382'%20y1='48.2414'%20x2='25.9148'%20y2='8.49405'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F60C4'%20stop-opacity='0'/%3e%3cstop%20offset='1'%20stop-color='%233865AB'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1648_105791'%3e%3crect%20width='48'%20height='48'%20fill='white'%20transform='translate(76)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1648_105791'%3e%3crect%20width='51'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_34 = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='206'%20zoomAndPan='magnify'%20viewBox='0%200%20154.5%2041.25'%20height='55'%20preserveAspectRatio='xMidYMid%20meet'%20version='1.0'%3e%3cdefs%3e%3cg/%3e%3cclipPath%20id='0cc78e9abe'%3e%3cpath%20d='M%202.78125%202.292969%20L%2019.722656%202.292969%20L%2019.722656%202.871094%20L%202.78125%202.871094%20Z%20M%202.78125%202.871094%20L%2019.722656%202.871094%20L%2019.722656%209.503906%20L%202.78125%209.503906%20Z%20M%202.78125%202.871094%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%202.292546)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='78f737bf82'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='59741fc677'%3e%3cpath%20d='M%202.78125%2012.085938%20L%2019.722656%2012.085938%20L%2019.722656%2012.664062%20L%202.78125%2012.664062%20Z%20M%202.78125%2012.664062%20L%2019.722656%2012.664062%20L%2019.722656%2019.300781%20L%202.78125%2019.300781%20Z%20M%202.78125%2012.664062%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%2012.086858)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='8b36d8a32c'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='4f935a79b9'%3e%3cpath%20d='M%202.78125%2021.726562%20L%2019.722656%2021.726562%20L%2019.722656%2022.304688%20L%202.78125%2022.304688%20Z%20M%202.78125%2022.304688%20L%2019.722656%2022.304688%20L%2019.722656%2028.941406%20L%202.78125%2028.941406%20Z%20M%202.78125%2022.304688%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%2021.72763)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='f2c0bb83c0'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='8400dc1f64'%3e%3cpath%20d='M%202.78125%2031.367188%20L%2019.722656%2031.367188%20L%2019.722656%2031.945312%20L%202.78125%2031.945312%20Z%20M%202.78125%2031.945312%20L%2019.722656%2031.945312%20L%2019.722656%2038.582031%20L%202.78125%2038.582031%20Z%20M%202.78125%2031.945312%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%2031.368404)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='e73fefaf04'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='f01163ac74'%3e%3cpath%20d='M%2023.167969%202.292969%20L%2040.109375%202.292969%20L%2040.109375%202.871094%20L%2023.167969%202.871094%20Z%20M%2023.167969%202.871094%20L%2040.109375%202.871094%20L%2040.109375%209.503906%20L%2023.167969%209.503906%20Z%20M%2023.167969%202.871094%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038809'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%202.844588,%202.292546)'%20y1='5.004'%20x2='51.411943'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='b1fb89d5c4'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='5b0ecc485e'%3e%3cpath%20d='M%2043.5625%202.292969%20L%2060.503906%202.292969%20L%2060.503906%202.871094%20L%2043.5625%202.871094%20Z%20M%2043.5625%202.871094%20L%2060.503906%202.871094%20L%2060.503906%209.503906%20L%2043.5625%209.503906%20Z%20M%2043.5625%202.871094%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038809'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2023.236872,%202.292546)'%20y1='5.004'%20x2='51.411941'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='c5b211b06c'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='7286542c60'%3e%3cpath%20d='M%2023.128906%2012.273438%20L%2040.046875%2012.273438%20L%2040.046875%2018.902344%20L%2023.128906%2018.902344%20Z%20M%2023.128906%2012.273438%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='1fa2f29718'%3e%3cpath%20d='M%2043.523438%2012.273438%20L%2060.441406%2012.273438%20L%2060.441406%2018.902344%20L%2043.523438%2018.902344%20Z%20M%2043.523438%2012.273438%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='c94678cc51'%3e%3cpath%20d='M%2023.191406%2022.042969%20L%2040.109375%2022.042969%20L%2040.109375%2028.671875%20L%2023.191406%2028.671875%20Z%20M%2023.191406%2022.042969%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='e9a287e80a'%3e%3cpath%20d='M%2043.648438%2022.042969%20L%2060.566406%2022.042969%20L%2060.566406%2028.671875%20L%2043.648438%2028.671875%20Z%20M%2043.648438%2022.042969%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='a7d27cb965'%3e%3cpath%20d='M%2023.191406%2031.367188%20L%2040.109375%2031.367188%20L%2040.109375%2037.996094%20L%2023.191406%2037.996094%20Z%20M%2023.191406%2031.367188%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='c25dc36c8d'%3e%3cpath%20d='M%2043.585938%2031.367188%20L%2060.503906%2031.367188%20L%2060.503906%2037.996094%20L%2043.585938%2037.996094%20Z%20M%2043.585938%2031.367188%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='6ef4945aae'%3e%3cpath%20d='M%2072.824219%208.578125%20L%2089.765625%208.578125%20L%2089.765625%209.152344%20L%2072.824219%209.152344%20Z%20M%2072.824219%209.152344%20L%2089.765625%209.152344%20L%2089.765625%2015.789062%20L%2072.824219%2015.789062%20Z%20M%2072.824219%209.152344%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038818'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2052.501412,%208.576231)'%20y1='5.004'%20x2='51.41195'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='24823a5bb5'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='db6204473f'%3e%3cpath%20d='M%2072.824219%2018.371094%20L%2089.765625%2018.371094%20L%2089.765625%2018.949219%20L%2072.824219%2018.949219%20Z%20M%2072.824219%2018.949219%20L%2089.765625%2018.949219%20L%2089.765625%2025.582031%20L%2072.824219%2025.582031%20Z%20M%2072.824219%2018.949219%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038818'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2052.501412,%2018.370546)'%20y1='5.004'%20x2='51.41195'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='7605862bc7'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='e41efe86cc'%3e%3cpath%20d='M%2072.824219%2028.011719%20L%2089.765625%2028.011719%20L%2089.765625%2028.589844%20L%2072.824219%2028.589844%20Z%20M%2072.824219%2028.589844%20L%2089.765625%2028.589844%20L%2089.765625%2035.222656%20L%2072.824219%2035.222656%20Z%20M%2072.824219%2028.589844%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038818'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2052.501412,%2028.011317)'%20y1='5.004'%20x2='51.41195'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='a429b1d81f'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='8a3f75015e'%3e%3cpath%20d='M%2093.214844%208.578125%20L%20110.15625%208.578125%20L%20110.15625%209.152344%20L%2093.214844%209.152344%20Z%20M%2093.214844%209.152344%20L%20110.15625%209.152344%20L%20110.15625%2015.789062%20L%2093.214844%2015.789062%20Z%20M%2093.214844%209.152344%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038816'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2072.889193,%208.576231)'%20y1='5.004'%20x2='51.411949'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='882d133e25'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='2e0372461c'%3e%3cpath%20d='M%20113.605469%208.578125%20L%20130.546875%208.578125%20L%20130.546875%209.152344%20L%20113.605469%209.152344%20Z%20M%20113.605469%209.152344%20L%20130.546875%209.152344%20L%20130.546875%2015.789062%20L%20113.605469%2015.789062%20Z%20M%20113.605469%209.152344%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038807'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2093.281478,%208.576231)'%20y1='5.004'%20x2='51.411939'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='764db36b54'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='1b2cca72e2'%3e%3cpath%20d='M%2093.175781%2018.558594%20L%20110.09375%2018.558594%20L%20110.09375%2025.1875%20L%2093.175781%2025.1875%20Z%20M%2093.175781%2018.558594%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='50535c8f61'%3e%3cpath%20d='M%2093.304688%2028.328125%20L%20110.222656%2028.328125%20L%20110.222656%2034.957031%20L%2093.304688%2034.957031%20Z%20M%2093.304688%2028.328125%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='458f625111'%3e%3cpath%20d='M%20113.660156%2018.558594%20L%20130.578125%2018.558594%20L%20130.578125%2025.1875%20L%20113.660156%2025.1875%20Z%20M%20113.660156%2018.558594%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='ed8e03dbc0'%3e%3cpath%20d='M%20113.761719%2028.03125%20L%20130.679688%2028.03125%20L%20130.679688%2034.664062%20L%20113.761719%2034.664062%20Z%20M%20113.761719%2028.03125%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='a887c078d4'%3e%3cpath%20d='M%20133.894531%2018.625%20L%20150.8125%2018.625%20L%20150.8125%2025.253906%20L%20133.894531%2025.253906%20Z%20M%20133.894531%2018.625%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='2e1313b8e1'%3e%3cpath%20d='M%20134.023438%2027.792969%20L%20150.941406%2027.792969%20L%20150.941406%2034.421875%20L%20134.023438%2034.421875%20Z%20M%20134.023438%2027.792969%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='21653efc97'%3e%3cpath%20d='M%20133.839844%208.570312%20L%20150.78125%208.570312%20L%20150.78125%209.148438%20L%20133.839844%209.148438%20Z%20M%20133.839844%209.148438%20L%20150.78125%209.148438%20L%20150.78125%2015.78125%20L%20133.839844%2015.78125%20Z%20M%20133.839844%209.148438%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038803'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20113.515935,%208.570574)'%20y1='5.004'%20x2='51.411935'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='f20bcca9a3'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.955627%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20clip-path='url(%230cc78e9abe)'%3e%3cpath%20fill='url(%2378f737bf82)'%20d='M%202.78125%202.292969%20L%202.78125%209.503906%20L%2019.722656%209.503906%20L%2019.722656%202.292969%20Z%20M%202.78125%202.292969%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2359741fc677)'%3e%3cpath%20fill='url(%238b36d8a32c)'%20d='M%202.78125%2012.085938%20L%202.78125%2019.300781%20L%2019.722656%2019.300781%20L%2019.722656%2012.085938%20Z%20M%202.78125%2012.085938%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%234f935a79b9)'%3e%3cpath%20fill='url(%23f2c0bb83c0)'%20d='M%202.78125%2021.726562%20L%202.78125%2028.941406%20L%2019.722656%2028.941406%20L%2019.722656%2021.726562%20Z%20M%202.78125%2021.726562%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%238400dc1f64)'%3e%3cpath%20fill='url(%23e73fefaf04)'%20d='M%202.78125%2031.367188%20L%202.78125%2038.582031%20L%2019.722656%2038.582031%20L%2019.722656%2031.367188%20Z%20M%202.78125%2031.367188%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23f01163ac74)'%3e%3cpath%20fill='url(%23b1fb89d5c4)'%20d='M%2023.167969%202.292969%20L%2023.167969%209.503906%20L%2040.109375%209.503906%20L%2040.109375%202.292969%20Z%20M%2023.167969%202.292969%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%235b0ecc485e)'%3e%3cpath%20fill='url(%23c5b211b06c)'%20d='M%2043.5625%202.292969%20L%2043.5625%209.503906%20L%2060.503906%209.503906%20L%2060.503906%202.292969%20Z%20M%2043.5625%202.292969%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%237286542c60)'%3e%3cpath%20fill='%2384aff1'%20d='M%2040.523438%2012.222656%20L%2023.128906%2012.222656%20L%2023.128906%2019.078125%20L%2040.523438%2019.078125%20Z%20M%2040.523438%2012.222656%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%231fa2f29718)'%3e%3cpath%20fill='%2384aff1'%20d='M%2060.917969%2012.222656%20L%2043.523438%2012.222656%20L%2043.523438%2019.078125%20L%2060.917969%2019.078125%20Z%20M%2060.917969%2012.222656%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23c94678cc51)'%3e%3cpath%20fill='%2384aff1'%20d='M%2040.585938%2021.992188%20L%2023.191406%2021.992188%20L%2023.191406%2028.847656%20L%2040.585938%2028.847656%20Z%20M%2040.585938%2021.992188%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23e9a287e80a)'%3e%3cpath%20fill='%2384aff1'%20d='M%2061.042969%2021.992188%20L%2043.648438%2021.992188%20L%2043.648438%2028.847656%20L%2061.042969%2028.847656%20Z%20M%2061.042969%2021.992188%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23a7d27cb965)'%3e%3cpath%20fill='%2384aff1'%20d='M%2040.585938%2031.320312%20L%2023.191406%2031.320312%20L%2023.191406%2038.171875%20L%2040.585938%2038.171875%20Z%20M%2040.585938%2031.320312%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23c25dc36c8d)'%3e%3cpath%20fill='%2384aff1'%20d='M%2060.980469%2031.320312%20L%2043.585938%2031.320312%20L%2043.585938%2038.171875%20L%2060.980469%2038.171875%20Z%20M%2060.980469%2031.320312%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%236ef4945aae)'%3e%3cpath%20fill='url(%2324823a5bb5)'%20d='M%2072.824219%208.578125%20L%2072.824219%2015.789062%20L%2089.765625%2015.789062%20L%2089.765625%208.578125%20Z%20M%2072.824219%208.578125%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23db6204473f)'%3e%3cpath%20fill='url(%237605862bc7)'%20d='M%2072.824219%2018.371094%20L%2072.824219%2025.582031%20L%2089.765625%2025.582031%20L%2089.765625%2018.371094%20Z%20M%2072.824219%2018.371094%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23e41efe86cc)'%3e%3cpath%20fill='url(%23a429b1d81f)'%20d='M%2072.824219%2028.011719%20L%2072.824219%2035.222656%20L%2089.765625%2035.222656%20L%2089.765625%2028.011719%20Z%20M%2072.824219%2028.011719%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%238a3f75015e)'%3e%3cpath%20fill='url(%23882d133e25)'%20d='M%2093.214844%208.578125%20L%2093.214844%2015.789062%20L%20110.15625%2015.789062%20L%20110.15625%208.578125%20Z%20M%2093.214844%208.578125%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%232e0372461c)'%3e%3cpath%20fill='url(%23764db36b54)'%20d='M%20113.605469%208.578125%20L%20113.605469%2015.789062%20L%20130.546875%2015.789062%20L%20130.546875%208.578125%20Z%20M%20113.605469%208.578125%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%231b2cca72e2)'%3e%3cpath%20fill='%2384aff1'%20d='M%20110.570312%2018.507812%20L%2093.175781%2018.507812%20L%2093.175781%2025.359375%20L%20110.570312%2025.359375%20Z%20M%20110.570312%2018.507812%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2350535c8f61)'%3e%3cpath%20fill='%2384aff1'%20d='M%20110.699219%2028.277344%20L%2093.304688%2028.277344%20L%2093.304688%2035.128906%20L%20110.699219%2035.128906%20Z%20M%20110.699219%2028.277344%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23458f625111)'%3e%3cpath%20fill='%2384aff1'%20d='M%20131.054688%2018.507812%20L%20113.660156%2018.507812%20L%20113.660156%2025.359375%20L%20131.054688%2025.359375%20Z%20M%20131.054688%2018.507812%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23ed8e03dbc0)'%3e%3cpath%20fill='%2384aff1'%20d='M%20131.15625%2027.984375%20L%20113.761719%2027.984375%20L%20113.761719%2034.835938%20L%20131.15625%2034.835938%20Z%20M%20131.15625%2027.984375%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23a887c078d4)'%3e%3cpath%20fill='%2384aff1'%20d='M%20151.289062%2018.574219%20L%20133.894531%2018.574219%20L%20133.894531%2025.429688%20L%20151.289062%2025.429688%20Z%20M%20151.289062%2018.574219%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%232e1313b8e1)'%3e%3cpath%20fill='%2384aff1'%20d='M%20151.417969%2027.742188%20L%20134.023438%2027.742188%20L%20134.023438%2034.59375%20L%20151.417969%2034.59375%20Z%20M%20151.417969%2027.742188%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2321653efc97)'%3e%3cpath%20fill='url(%23f20bcca9a3)'%20d='M%20133.839844%208.570312%20L%20133.839844%2015.78125%20L%20150.78125%2015.78125%20L%20150.78125%208.570312%20Z%20M%20133.839844%208.570312%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(7.407211,%2017.93532)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(11.901125,%2017.93532)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(7.303632,%2027.306779)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(11.797546,%2027.306779)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(7.190188,%2036.692702)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(11.684102,%2036.692702)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(27.560215,%208.212119)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(32.274384,%208.212119)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(47.972226,%208.217777)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(52.686396,%208.217777)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(9.753033,%207.918055)'%3e%3cg%3e%3cpath%20d='M%203.859375%20-4.8125%20L%203.859375%20-4.015625%20L%202.46875%20-4.015625%20L%202.46875%200%20L%201.515625%200%20L%201.515625%20-4.015625%20L%200.125%20-4.015625%20L%200.125%20-4.8125%20Z%20M%203.859375%20-4.8125%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(30.04217,%2017.666008)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(51.130956,%2017.93532)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(29.701344,%2027.306779)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(50.911466,%2027.435567)'%3e%3cg%3e%3cpath%20d='M%203.265625%200%20L%202.359375%200%20L%202.359375%20-1.046875%20L%200.171875%20-1.046875%20L%200.171875%20-1.8125%20L%202.046875%20-4.8125%20L%203.265625%20-4.8125%20L%203.265625%20-1.8125%20L%204%20-1.8125%20L%204%20-1.046875%20L%203.265625%20-1.046875%20Z%20M%201.140625%20-1.875%20L%201.171875%20-1.8125%20L%202.359375%20-1.8125%20L%202.359375%20-3.671875%20L%202.28125%20-3.6875%20Z%20M%201.140625%20-1.875%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(29.891734,%2036.692702)'%3e%3cg%3e%3cpath%20d='M%202%200.0625%20C%201.519531%200.0625%201.140625%20-0.0351562%200.859375%20-0.234375%20C%200.578125%20-0.429688%200.394531%20-0.710938%200.3125%20-1.078125%20L%201.03125%20-1.390625%20L%201.109375%20-1.390625%20C%201.171875%20-1.171875%201.269531%20-1.007812%201.40625%20-0.90625%20C%201.550781%20-0.800781%201.75%20-0.75%202%20-0.75%20C%202.25%20-0.75%202.441406%20-0.816406%202.578125%20-0.953125%20C%202.710938%20-1.097656%202.78125%20-1.3125%202.78125%20-1.59375%20C%202.78125%20-1.875%202.710938%20-2.085938%202.578125%20-2.234375%20C%202.441406%20-2.378906%202.253906%20-2.453125%202.015625%20-2.453125%20C%201.835938%20-2.453125%201.6875%20-2.410156%201.5625%20-2.328125%20C%201.445312%20-2.253906%201.347656%20-2.144531%201.265625%20-2%20L%200.484375%20-2.046875%20L%200.578125%20-4.8125%20L%203.453125%20-4.8125%20L%203.453125%20-4.015625%20L%201.390625%20-4.015625%20L%201.34375%20-2.78125%20L%201.40625%20-2.765625%20C%201.519531%20-2.910156%201.65625%20-3.019531%201.8125%20-3.09375%20C%201.96875%20-3.175781%202.15625%20-3.21875%202.375%20-3.21875%20C%202.644531%20-3.21875%202.878906%20-3.15625%203.078125%20-3.03125%20C%203.285156%20-2.90625%203.445312%20-2.722656%203.5625%20-2.484375%20C%203.675781%20-2.242188%203.734375%20-1.953125%203.734375%20-1.609375%20C%203.734375%20-1.253906%203.664062%20-0.953125%203.53125%20-0.703125%20C%203.394531%20-0.453125%203.195312%20-0.257812%202.9375%20-0.125%20C%202.675781%200%202.363281%200.0625%202%200.0625%20Z%20M%202%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(50.672254,%2036.760669)'%3e%3cg%3e%3cpath%20d='M%202.296875%200.0625%20C%201.929688%200.0625%201.609375%20-0.0195312%201.328125%20-0.1875%20C%201.046875%20-0.351562%200.820312%20-0.613281%200.65625%20-0.96875%20C%200.488281%20-1.332031%200.40625%20-1.796875%200.40625%20-2.359375%20C%200.40625%20-2.929688%200.492188%20-3.40625%200.671875%20-3.78125%20C%200.847656%20-4.15625%201.085938%20-4.429688%201.390625%20-4.609375%20C%201.691406%20-4.785156%202.039062%20-4.875%202.4375%20-4.875%20C%202.757812%20-4.875%203.035156%20-4.828125%203.265625%20-4.734375%20C%203.503906%20-4.640625%203.691406%20-4.5%203.828125%20-4.3125%20L%203.359375%20-3.71875%20L%203.28125%20-3.71875%20C%203.070312%20-3.957031%202.789062%20-4.078125%202.4375%20-4.078125%20C%201.75%20-4.078125%201.394531%20-3.578125%201.375%20-2.578125%20L%201.453125%20-2.546875%20C%201.566406%20-2.753906%201.710938%20-2.910156%201.890625%20-3.015625%20C%202.078125%20-3.128906%202.304688%20-3.1875%202.578125%20-3.1875%20C%202.878906%20-3.1875%203.140625%20-3.125%203.359375%20-3%20C%203.578125%20-2.875%203.742188%20-2.691406%203.859375%20-2.453125%20C%203.972656%20-2.222656%204.03125%20-1.945312%204.03125%20-1.625%20C%204.03125%20-1.269531%203.957031%20-0.960938%203.8125%20-0.703125%20C%203.675781%20-0.453125%203.476562%20-0.257812%203.21875%20-0.125%20C%202.957031%200%202.648438%200.0625%202.296875%200.0625%20Z%20M%202.28125%20-0.75%20C%202.53125%20-0.75%202.722656%20-0.820312%202.859375%20-0.96875%20C%203.003906%20-1.113281%203.078125%20-1.316406%203.078125%20-1.578125%20C%203.078125%20-1.835938%203.003906%20-2.039062%202.859375%20-2.1875%20C%202.722656%20-2.332031%202.53125%20-2.40625%202.28125%20-2.40625%20C%202.113281%20-2.40625%201.96875%20-2.367188%201.84375%20-2.296875%20C%201.726562%20-2.234375%201.632812%20-2.140625%201.5625%20-2.015625%20C%201.5%20-1.890625%201.46875%20-1.742188%201.46875%20-1.578125%20C%201.46875%20-1.316406%201.539062%20-1.113281%201.6875%20-0.96875%20C%201.832031%20-0.820312%202.03125%20-0.75%202.28125%20-0.75%20Z%20M%202.28125%20-0.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(77.343314,%2024.219007)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(82.057484,%2024.219007)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(77.239735,%2033.590469)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(81.953905,%2033.590469)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(97.713335,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(102.207249,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(118.130283,%2014.501465)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(122.624198,%2014.501465)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(79.797647,%2014.201743)'%3e%3cg%3e%3cpath%20d='M%203.859375%20-4.8125%20L%203.859375%20-4.015625%20L%202.46875%20-4.015625%20L%202.46875%200%20L%201.515625%200%20L%201.515625%20-4.015625%20L%200.125%20-4.015625%20L%200.125%20-4.8125%20Z%20M%203.859375%20-4.8125%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(100.086779,%2023.949696)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(100.914058,%2033.988566)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(120.169809,%2023.820908)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(121.023713,%2033.425191)'%3e%3cg%3e%3cpath%20d='M%203.265625%200%20L%202.359375%200%20L%202.359375%20-1.046875%20L%200.171875%20-1.046875%20L%200.171875%20-1.8125%20L%202.046875%20-4.8125%20L%203.265625%20-4.8125%20L%203.265625%20-1.8125%20L%204%20-1.8125%20L%204%20-1.046875%20L%203.265625%20-1.046875%20Z%20M%201.140625%20-1.875%20L%201.171875%20-1.8125%20L%202.359375%20-1.8125%20L%202.359375%20-3.671875%20L%202.28125%20-3.6875%20Z%20M%201.140625%20-1.875%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(140.594644,%2023.949696)'%3e%3cg%3e%3cpath%20d='M%202%200.0625%20C%201.519531%200.0625%201.140625%20-0.0351562%200.859375%20-0.234375%20C%200.578125%20-0.429688%200.394531%20-0.710938%200.3125%20-1.078125%20L%201.03125%20-1.390625%20L%201.109375%20-1.390625%20C%201.171875%20-1.171875%201.269531%20-1.007812%201.40625%20-0.90625%20C%201.550781%20-0.800781%201.75%20-0.75%202%20-0.75%20C%202.25%20-0.75%202.441406%20-0.816406%202.578125%20-0.953125%20C%202.710938%20-1.097656%202.78125%20-1.3125%202.78125%20-1.59375%20C%202.78125%20-1.875%202.710938%20-2.085938%202.578125%20-2.234375%20C%202.441406%20-2.378906%202.253906%20-2.453125%202.015625%20-2.453125%20C%201.835938%20-2.453125%201.6875%20-2.410156%201.5625%20-2.328125%20C%201.445312%20-2.253906%201.347656%20-2.144531%201.265625%20-2%20L%200.484375%20-2.046875%20L%200.578125%20-4.8125%20L%203.453125%20-4.8125%20L%203.453125%20-4.015625%20L%201.390625%20-4.015625%20L%201.34375%20-2.78125%20L%201.40625%20-2.765625%20C%201.519531%20-2.910156%201.65625%20-3.019531%201.8125%20-3.09375%20C%201.96875%20-3.175781%202.15625%20-3.21875%202.375%20-3.21875%20C%202.644531%20-3.21875%202.878906%20-3.15625%203.078125%20-3.03125%20C%203.285156%20-2.90625%203.445312%20-2.722656%203.5625%20-2.484375%20C%203.675781%20-2.242188%203.734375%20-1.953125%203.734375%20-1.609375%20C%203.734375%20-1.253906%203.664062%20-0.953125%203.53125%20-0.703125%20C%203.394531%20-0.453125%203.195312%20-0.257812%202.9375%20-0.125%20C%202.675781%200%202.363281%200.0625%202%200.0625%20Z%20M%202%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(141.109147,%2033.184927)'%3e%3cg%3e%3cpath%20d='M%202.296875%200.0625%20C%201.929688%200.0625%201.609375%20-0.0195312%201.328125%20-0.1875%20C%201.046875%20-0.351562%200.820312%20-0.613281%200.65625%20-0.96875%20C%200.488281%20-1.332031%200.40625%20-1.796875%200.40625%20-2.359375%20C%200.40625%20-2.929688%200.492188%20-3.40625%200.671875%20-3.78125%20C%200.847656%20-4.15625%201.085938%20-4.429688%201.390625%20-4.609375%20C%201.691406%20-4.785156%202.039062%20-4.875%202.4375%20-4.875%20C%202.757812%20-4.875%203.035156%20-4.828125%203.265625%20-4.734375%20C%203.503906%20-4.640625%203.691406%20-4.5%203.828125%20-4.3125%20L%203.359375%20-3.71875%20L%203.28125%20-3.71875%20C%203.070312%20-3.957031%202.789062%20-4.078125%202.4375%20-4.078125%20C%201.75%20-4.078125%201.394531%20-3.578125%201.375%20-2.578125%20L%201.453125%20-2.546875%20C%201.566406%20-2.753906%201.710938%20-2.910156%201.890625%20-3.015625%20C%202.078125%20-3.128906%202.304688%20-3.1875%202.578125%20-3.1875%20C%202.878906%20-3.1875%203.140625%20-3.125%203.359375%20-3%20C%203.578125%20-2.875%203.742188%20-2.691406%203.859375%20-2.453125%20C%203.972656%20-2.222656%204.03125%20-1.945312%204.03125%20-1.625%20C%204.03125%20-1.269531%203.957031%20-0.960938%203.8125%20-0.703125%20C%203.675781%20-0.453125%203.476562%20-0.257812%203.21875%20-0.125%20C%202.957031%200%202.648438%200.0625%202.296875%200.0625%20Z%20M%202.28125%20-0.75%20C%202.53125%20-0.75%202.722656%20-0.820312%202.859375%20-0.96875%20C%203.003906%20-1.113281%203.078125%20-1.316406%203.078125%20-1.578125%20C%203.078125%20-1.835938%203.003906%20-2.039062%202.859375%20-2.1875%20C%202.722656%20-2.332031%202.53125%20-2.40625%202.28125%20-2.40625%20C%202.113281%20-2.40625%201.96875%20-2.367188%201.84375%20-2.296875%20C%201.726562%20-2.234375%201.632812%20-2.140625%201.5625%20-2.015625%20C%201.5%20-1.890625%201.46875%20-1.742188%201.46875%20-1.578125%20C%201.46875%20-1.316406%201.539062%20-1.113281%201.6875%20-0.96875%20C%201.832031%20-0.820312%202.03125%20-0.75%202.28125%20-0.75%20Z%20M%202.28125%20-0.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(138.251285,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(142.7452,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cpath%20fill='%23ccccdc'%20d='M%2065.773438%2025.683594%20C%2066.277344%2025.683594%2070.136719%2022.800781%2070.136719%2021.359375%20C%2070.136719%2019.914062%2066.375%2017.03125%2065.773438%2017.03125%20C%2065.175781%2017.03125%2064.6875%2017.390625%2064.6875%2018.09375%20C%2064.6875%2018.796875%2067.222656%2020.578125%2067.222656%2020.578125%20C%2067.222656%2020.578125%2061.683594%2020.09375%2061.5%2020.578125%20C%2061.316406%2021.0625%2061.316406%2021.652344%2061.5%2022.136719%20C%2061.683594%2022.621094%2067.222656%2022.136719%2067.222656%2022.136719%20C%2067.222656%2022.136719%2064.6875%2024.0625%2064.6875%2024.625%20C%2064.6875%2025.1875%2065.273438%2025.683594%2065.773438%2025.683594%20Z%20M%2065.773438%2025.683594%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/svg%3e";
const __vite_glob_0_35 = "data:image/svg+xml,%3csvg%20width='101'%20height='48'%20viewBox='0%200%20101%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H31V0H1.29545C0.951872%200%200.62237%200.109659%200.379427%200.304853C0.136484%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126353)'/%3e%3cpath%20d='M31%2017H0V48H31V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M17%2029.5H15.0954L13%2030.7266V32.3984L14.9004%2031.3047H14.9502V37.5H17V29.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M66%200H35V13H66V0Z'%20fill='url(%23paint1_linear_1248_126353)'/%3e%3cpath%20d='M66%2017H35V48H66V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48.1164%2037.5H54V35.9624H50.7788V35.9123L51.7296%2035.0414C53.4528%2033.5501%2053.903%2032.7909%2053.903%2031.8854C53.903%2030.4634%2052.7348%2029.5%2050.9301%2029.5C49.1721%2029.5%2047.9961%2030.5058%2048%2032.1127H49.8202C49.8202%2031.3998%2050.2626%2030.9875%2050.9224%2030.9875C51.5705%2030.9875%2052.0401%2031.3844%2052.0401%2032.0356C52.0401%2032.6252%2051.6675%2033.026%2051.0155%2033.6079L48.1164%2036.1281V37.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M70%2013H101V1.04083C101%200.764787%20100.864%200.500047%20100.621%200.304853C100.378%200.109659%20100.048%200%2099.7046%200L70%200V13Z'%20fill='url(%23paint2_linear_1248_126353)'/%3e%3cpath%20d='M101%2017H70V48H101V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M78%2029H76.0954L74%2030.2266V31.8984L75.9004%2030.8047H75.9502V37H78V29Z'%20fill='%2324292E'/%3e%3cpath%20d='M90.1164%2037H96V35.4624H92.7788V35.4123L93.7296%2034.5414C95.4528%2033.0501%2095.903%2032.2909%2095.903%2031.3854C95.903%2029.9634%2094.7348%2029%2092.9301%2029C91.1721%2029%2089.9961%2030.0058%2090%2031.6127H91.8202C91.8202%2030.8998%2092.2626%2030.4875%2092.9224%2030.4875C93.5705%2030.4875%2094.0401%2030.8844%2094.0401%2031.5356C94.0401%2032.1252%2093.6675%2032.526%2093.0155%2033.1079L90.1164%2035.6281V37Z'%20fill='%2324292E'/%3e%3cpath%20d='M83.7432%2036H85.2568V34.2568H87V32.7432H85.2568V31H83.7432V32.7432H82V34.2568H83.7432V36Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126353'%20x1='0'%20y1='6.5052'%20x2='31'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126353'%20x1='35'%20y1='6.5052'%20x2='66.013'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126353'%20x1='70'%20y1='6.5052'%20x2='101'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_36 = "data:image/svg+xml,%3csvg%20width='158'%20height='48'%20viewBox='0%200%20158%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_125975)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200%200%200%200C0%200%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_125975)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M27.3343%2030H30.674V25.674H35V22.3343H30.674V18H27.3343V22.3343H23V25.674H27.3343V30Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_125975)'%3e%3cpath%20d='M58%2026.5H43V39.5H58V26.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M43%2010.0408V22H58V9H43.6268C43.4606%209%2043.3011%209.10966%2043.1836%209.30485C43.066%209.50005%2043%209.76479%2043%2010.0408Z'%20fill='url(%23paint1_linear_1248_125975)'/%3e%3cpath%20d='M51.5%2030H50.0716L48.5%2030.9199V32.1738L49.9253%2031.3535H49.9627V36H51.5V30Z'%20fill='white'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1248_125975)'%3e%3cpath%20d='M77%2026.5H62V39.5H77V26.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%2022H77V10.0408C77%209.76479%2076.934%209.50005%2076.8164%209.30485C76.6989%209.10966%2076.5394%209%2076.3732%209H62V22Z'%20fill='url(%23paint2_linear_1248_125975)'/%3e%3cpath%20d='M67.3373%2036H71.75V34.8468H69.3341V34.8092L70.0472%2034.1561C71.3396%2033.0376%2071.6772%2032.4682%2071.6772%2031.789C71.6772%2030.7225%2070.8011%2030%2069.4476%2030C68.129%2030%2067.2471%2030.7543%2067.25%2031.9595H68.6151C68.6151%2031.4249%2068.947%2031.1156%2069.4418%2031.1156C69.9279%2031.1156%2070.2801%2031.4133%2070.2801%2031.9017C70.2801%2032.3439%2070.0006%2032.6445%2069.5116%2033.0809L67.3373%2034.9711V36Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M85%2028.566H97V25.2034H85V28.566ZM85%2022.7966H97V19.434H85V22.7966Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip3_1248_125975)'%3e%3cpath%20d='M105%201.04083V13H120V0H105.627C105.461%200%20105.301%200.109659%20105.184%200.304853C105.066%200.500047%20105%200.764787%20105%201.04083Z'%20fill='url(%23paint3_linear_1248_125975)'/%3e%3cpath%20d='M120%2017.5H105V30.5H120V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M120%2035H105V48H120V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110.337%2044.5H114.75V43.3468H112.334V43.3092L113.047%2042.6561C114.34%2041.5376%20114.677%2040.9682%20114.677%2040.289C114.677%2039.2225%20113.801%2038.5%20112.448%2038.5C111.129%2038.5%20110.247%2039.2543%20110.25%2040.4595H111.615C111.615%2039.9249%20111.947%2039.6156%20112.442%2039.6156C112.928%2039.6156%20113.28%2039.9133%20113.28%2040.4017C113.28%2040.8439%20113.001%2041.1445%20112.512%2041.5809L110.337%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2021H112.072L110.5%2021.9199V23.1738L111.925%2022.3535H111.963V27H113.5V21Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1248_125975)'%3e%3cpath%20d='M139%2035H124V48H139V35Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M124.5%2035.5H138.5V47.5H124.5V35.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M124%201.04083V13H139V0H124.627C124.461%200%20124%200%20124%200C124%200%20124%200.764787%20124%201.04083Z'%20fill='url(%23paint4_linear_1248_125975)'/%3e%3cpath%20d='M139%2017.5H124V30.5H139V17.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M132.5%2021H131.072L129.5%2021.9199V23.1738L130.925%2022.3535H130.963V27H132.5V21Z'%20fill='white'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip5_1248_125975)'%3e%3cpath%20d='M158%2017.5H143V30.5H158V17.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M143%2013H158V1.04083C158%200.764787%20157.934%200.500047%20157.816%200.304853C157.699%200.109659%20157.539%200%20157.373%200L143%200V13Z'%20fill='url(%23paint5_linear_1248_125975)'/%3e%3cpath%20d='M148.337%2027H152.75V25.8468H150.334V25.8092L151.047%2025.1561C152.34%2024.0376%20152.677%2023.4682%20152.677%2022.789C152.677%2021.7225%20151.801%2021%20150.448%2021C149.129%2021%20148.247%2021.7543%20148.25%2022.9595H149.615C149.615%2022.4249%20149.947%2022.1156%20150.442%2022.1156C150.928%2022.1156%20151.28%2022.4133%20151.28%2022.9017C151.28%2023.3439%20151.001%2023.6445%20150.512%2024.0809L148.337%2025.9711V27Z'%20fill='white'/%3e%3cpath%20d='M158%2035H143V48H158V35Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M143.5%2035.5H157.5V47.5H143.5V35.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_125975'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_125975'%20x1='43'%20y1='15.5052'%20x2='58'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_125975'%20x1='62'%20y1='15.5052'%20x2='77'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_125975'%20x1='105'%20y1='6.5052'%20x2='120'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_125975'%20x1='124'%20y1='6.5052'%20x2='139'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1248_125975'%20x1='143'%20y1='6.5052'%20x2='158'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_125975'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_125975'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(43%209)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_125975'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%209)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_125975'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(105)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1248_125975'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(124)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip5_1248_125975'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(143)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_37 = "data:image/svg+xml,%3csvg%20width='129'%20height='50'%20viewBox='0%200%20129%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126588)'%3e%3cpath%20d='M0%202.04083V14H24V1H1.00293C0.736933%201%200%201%200%201C0%201%200%201.76479%200%202.04083Z'%20fill='url(%23paint0_linear_1248_126588)'/%3e%3cpath%20d='M24%2018.5H0V31.5H24V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2036H0V49H24V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M3%2027.3182H4.56818V24.7727C4.56818%2024.392%204.76705%2024.1591%205.09091%2024.1591C5.41477%2024.1591%205.625%2024.392%205.625%2024.7727V27.3182H7.125V24.7727C7.125%2024.392%207.32386%2024.1591%207.64773%2024.1591C7.97159%2024.1591%208.18182%2024.392%208.18182%2024.7727V27.3182H9.75V24.375C9.75%2023.4801%209.17614%2022.8977%208.34091%2022.8977C7.69318%2022.8977%207.17045%2023.25%207.02273%2023.7841H6.97727C6.88636%2023.25%206.39773%2022.8977%205.78409%2022.8977C5.17898%2022.8977%204.71591%2023.2386%204.53409%2023.7841H4.48864V22.9545H3V27.3182Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.5234%2028.9545H12.0916V26.6023H12.1143C12.2962%2027.0455%2012.7166%2027.375%2013.3303%2027.375C14.2621%2027.375%2015.0462%2026.6477%2015.0462%2025.1364C15.0462%2023.5568%2014.2053%2022.8977%2013.3416%2022.8977C12.6939%2022.8977%2012.2848%2023.2727%2012.1143%2023.7159H12.0803V22.9545H10.5234V28.9545ZM12.0575%2025.1364C12.0575%2024.4886%2012.3189%2024.1023%2012.7507%2024.1023C13.1825%2024.1023%2013.4325%2024.4886%2013.4325%2025.1364C13.4325%2025.7841%2013.1825%2026.1705%2012.7507%2026.1705C12.3189%2026.1705%2012.0575%2025.7727%2012.0575%2025.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M17.2713%2024.8636C17.2741%2024.4318%2017.5241%2024.1705%2017.9077%2024.1705C18.3082%2024.1705%2018.5355%2024.4318%2018.5327%2024.8636V27.3182H20.1009V24.5341C20.1037%2023.5795%2019.5014%2022.8977%2018.5781%2022.8977C17.9332%2022.8977%2017.456%2023.2273%2017.2599%2023.7841H17.2145V21.5H15.7031V27.3182H17.2713V24.8636Z'%20fill='%2324292E'/%3e%3cpath%20d='M3%2044.8182H4.56818V42.2727C4.56818%2041.892%204.76705%2041.6591%205.09091%2041.6591C5.41477%2041.6591%205.625%2041.892%205.625%2042.2727V44.8182H7.125V42.2727C7.125%2041.892%207.32386%2041.6591%207.64773%2041.6591C7.97159%2041.6591%208.18182%2041.892%208.18182%2042.2727V44.8182H9.75V41.875C9.75%2040.9801%209.17614%2040.3977%208.34091%2040.3977C7.69318%2040.3977%207.17045%2040.75%207.02273%2041.2841H6.97727C6.88636%2040.75%206.39773%2040.3977%205.78409%2040.3977C5.17898%2040.3977%204.71591%2040.7386%204.53409%2041.2841H4.48864V40.4545H3V44.8182Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.5234%2046.4545H12.0916V44.1023H12.1143C12.2962%2044.5455%2012.7166%2044.875%2013.3303%2044.875C14.2621%2044.875%2015.0462%2044.1477%2015.0462%2042.6364C15.0462%2041.0568%2014.2053%2040.3977%2013.3416%2040.3977C12.6939%2040.3977%2012.2848%2040.7727%2012.1143%2041.2159H12.0803V40.4545H10.5234V46.4545ZM12.0575%2042.6364C12.0575%2041.9886%2012.3189%2041.6023%2012.7507%2041.6023C13.1825%2041.6023%2013.4325%2041.9886%2013.4325%2042.6364C13.4325%2043.2841%2013.1825%2043.6705%2012.7507%2043.6705C12.3189%2043.6705%2012.0575%2043.2727%2012.0575%2042.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M17.2713%2042.3636C17.2741%2041.9318%2017.5241%2041.6705%2017.9077%2041.6705C18.3082%2041.6705%2018.5355%2041.9318%2018.5327%2042.3636V44.8182H20.1009V42.0341C20.1037%2041.0795%2019.5014%2040.3977%2018.5781%2040.3977C17.9332%2040.3977%2017.456%2040.7273%2017.2599%2041.2841H17.2145V39H15.7031V44.8182H17.2713V42.3636Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126588)'%3e%3cpath%20d='M28%202.04083V14H43V1H28.6268C28.4606%201%2028%201%2028%201C28%201%2028%201.76479%2028%202.04083Z'%20fill='url(%23paint1_linear_1248_126588)'/%3e%3cpath%20d='M43%2018.5H28V31.5H43V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M43%2036H28V49H43V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M36.5%2022H35.0716L33.5%2022.9199V24.1738L34.9253%2023.3535H34.9627V28H36.5V22Z'%20fill='%2324292E'/%3e%3cpath%20d='M33.0873%2045.5H37.5V44.3468H35.0841V44.3092L35.7972%2043.6561C37.0896%2042.5376%2037.4272%2041.9682%2037.4272%2041.289C37.4272%2040.2225%2036.5511%2039.5%2035.1976%2039.5C33.879%2039.5%2032.9971%2040.2543%2033%2041.4595H34.3651C34.3651%2040.9249%2034.697%2040.6156%2035.1918%2040.6156C35.6779%2040.6156%2036.0301%2040.9133%2036.0301%2041.4017C36.0301%2041.8439%2035.7506%2042.1445%2035.2616%2042.5809L33.0873%2044.4711V45.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3crect%20x='27.5'%20y='0.5'%20width='16'%20height='49'%20stroke='white'/%3e%3cpath%20d='M56.9067%2031C57.6011%2031%2062.9327%2027%2062.9327%2025C62.9327%2023%2057.7357%2019%2056.9067%2019C56.0778%2019%2055.4023%2019.5%2055.4023%2020.4756C55.4023%2021.4512%2058.9067%2023.9206%2058.9067%2023.9206C58.9067%2023.9206%2051.2539%2023.25%2051%2023.9206C50.7461%2024.5911%2050.7461%2025.4089%2051%2026.0794C51.2539%2026.75%2058.9067%2026.0794%2058.9067%2026.0794C58.9067%2026.0794%2055.4023%2028.75%2055.4023%2029.5301C55.4023%2030.3103%2056.2124%2031%2056.9067%2031Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126588)'%3e%3cpath%20d='M71%202.04083V14H95V1H72.0029C71.7369%201%2071%201%2071%201C71%201%2071%201.76479%2071%202.04083Z'%20fill='url(%23paint2_linear_1248_126588)'/%3e%3cpath%20d='M95%2018.5H71V31.5H95V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M95%2036H71V49H95V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M75%2027.3182H76.5682V24.7727C76.5682%2024.392%2076.767%2024.1591%2077.0909%2024.1591C77.4148%2024.1591%2077.625%2024.392%2077.625%2024.7727V27.3182H79.125V24.7727C79.125%2024.392%2079.3239%2024.1591%2079.6477%2024.1591C79.9716%2024.1591%2080.1818%2024.392%2080.1818%2024.7727V27.3182H81.75V24.375C81.75%2023.4801%2081.1761%2022.8977%2080.3409%2022.8977C79.6932%2022.8977%2079.1705%2023.25%2079.0227%2023.7841H78.9773C78.8864%2023.25%2078.3977%2022.8977%2077.7841%2022.8977C77.179%2022.8977%2076.7159%2023.2386%2076.5341%2023.7841H76.4886V22.9545H75V27.3182Z'%20fill='%2324292E'/%3e%3cpath%20d='M82.5234%2028.9545H84.0916V26.6023H84.1143C84.2962%2027.0455%2084.7166%2027.375%2085.3303%2027.375C86.2621%2027.375%2087.0462%2026.6477%2087.0462%2025.1364C87.0462%2023.5568%2086.2053%2022.8977%2085.3416%2022.8977C84.6939%2022.8977%2084.2848%2023.2727%2084.1143%2023.7159H84.0803V22.9545H82.5234V28.9545ZM84.0575%2025.1364C84.0575%2024.4886%2084.3189%2024.1023%2084.7507%2024.1023C85.1825%2024.1023%2085.4325%2024.4886%2085.4325%2025.1364C85.4325%2025.7841%2085.1825%2026.1705%2084.7507%2026.1705C84.3189%2026.1705%2084.0575%2025.7727%2084.0575%2025.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M89.2713%2024.8636C89.2741%2024.4318%2089.5241%2024.1705%2089.9077%2024.1705C90.3082%2024.1705%2090.5355%2024.4318%2090.5327%2024.8636V27.3182H92.1009V24.5341C92.1037%2023.5795%2091.5014%2022.8977%2090.5781%2022.8977C89.9332%2022.8977%2089.456%2023.2273%2089.2599%2023.7841H89.2145V21.5H87.7031V27.3182H89.2713V24.8636Z'%20fill='%2324292E'/%3e%3cpath%20d='M74%2044.8182H75.5682V42.2727C75.5682%2041.892%2075.767%2041.6591%2076.0909%2041.6591C76.4148%2041.6591%2076.625%2041.892%2076.625%2042.2727V44.8182H78.125V42.2727C78.125%2041.892%2078.3239%2041.6591%2078.6477%2041.6591C78.9716%2041.6591%2079.1818%2041.892%2079.1818%2042.2727V44.8182H80.75V41.875C80.75%2040.9801%2080.1761%2040.3977%2079.3409%2040.3977C78.6932%2040.3977%2078.1705%2040.75%2078.0227%2041.2841H77.9773C77.8864%2040.75%2077.3977%2040.3977%2076.7841%2040.3977C76.179%2040.3977%2075.7159%2040.7386%2075.5341%2041.2841H75.4886V40.4545H74V44.8182Z'%20fill='%2324292E'/%3e%3cpath%20d='M81.5234%2046.4545H83.0916V44.1023H83.1143C83.2962%2044.5455%2083.7166%2044.875%2084.3303%2044.875C85.2621%2044.875%2086.0462%2044.1477%2086.0462%2042.6364C86.0462%2041.0568%2085.2053%2040.3977%2084.3416%2040.3977C83.6939%2040.3977%2083.2848%2040.7727%2083.1143%2041.2159H83.0803V40.4545H81.5234V46.4545ZM83.0575%2042.6364C83.0575%2041.9886%2083.3189%2041.6023%2083.7507%2041.6023C84.1825%2041.6023%2084.4325%2041.9886%2084.4325%2042.6364C84.4325%2043.2841%2084.1825%2043.6705%2083.7507%2043.6705C83.3189%2043.6705%2083.0575%2043.2727%2083.0575%2042.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M88.2713%2042.3636C88.2741%2041.9318%2088.5241%2041.6705%2088.9077%2041.6705C89.3082%2041.6705%2089.5355%2041.9318%2089.5327%2042.3636V44.8182H91.1009V42.0341C91.1037%2041.0795%2090.5014%2040.3977%2089.5781%2040.3977C88.9332%2040.3977%2088.456%2040.7273%2088.2599%2041.2841H88.2145V39H86.7031V44.8182H88.2713V42.3636Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126588)'%3e%3cpath%20d='M99%202.04083V14H129V1H100.254C99.9212%201%2099%201%2099%201C99%201%2099%201.76479%2099%202.04083Z'%20fill='url(%23paint3_linear_1248_126588)'/%3e%3cpath%20d='M129%2018.5H99V31.5H129V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M129%2036H99V49H129V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M109%2027.3182H110.568V24.7727C110.568%2024.392%20110.767%2024.1591%20111.091%2024.1591C111.415%2024.1591%20111.625%2024.392%20111.625%2024.7727V27.3182H113.125V24.7727C113.125%2024.392%20113.324%2024.1591%20113.648%2024.1591C113.972%2024.1591%20114.182%2024.392%20114.182%2024.7727V27.3182H115.75V24.375C115.75%2023.4801%20115.176%2022.8977%20114.341%2022.8977C113.693%2022.8977%20113.17%2023.25%20113.023%2023.7841H112.977C112.886%2023.25%20112.398%2022.8977%20111.784%2022.8977C111.179%2022.8977%20110.716%2023.2386%20110.534%2023.7841H110.489V22.9545H109V27.3182Z'%20fill='%2324292E'/%3e%3cpath%20d='M116.523%2028.9545H118.092V26.6023H118.114C118.296%2027.0455%20118.717%2027.375%20119.33%2027.375C120.262%2027.375%20121.046%2026.6477%20121.046%2025.1364C121.046%2023.5568%20120.205%2022.8977%20119.342%2022.8977C118.694%2022.8977%20118.285%2023.2727%20118.114%2023.7159H118.08V22.9545H116.523V28.9545ZM118.058%2025.1364C118.058%2024.4886%20118.319%2024.1023%20118.751%2024.1023C119.183%2024.1023%20119.433%2024.4886%20119.433%2025.1364C119.433%2025.7841%20119.183%2026.1705%20118.751%2026.1705C118.319%2026.1705%20118.058%2025.7727%20118.058%2025.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M123.271%2024.8636C123.274%2024.4318%20123.524%2024.1705%20123.908%2024.1705C124.308%2024.1705%20124.536%2024.4318%20124.533%2024.8636V27.3182H126.101V24.5341C126.104%2023.5795%20125.501%2022.8977%20124.578%2022.8977C123.933%2022.8977%20123.456%2023.2273%20123.26%2023.7841H123.214V21.5H121.703V27.3182H123.271V24.8636Z'%20fill='%2324292E'/%3e%3cpath%20d='M109%2044.8182H110.568V42.2727C110.568%2041.892%20110.767%2041.6591%20111.091%2041.6591C111.415%2041.6591%20111.625%2041.892%20111.625%2042.2727V44.8182H113.125V42.2727C113.125%2041.892%20113.324%2041.6591%20113.648%2041.6591C113.972%2041.6591%20114.182%2041.892%20114.182%2042.2727V44.8182H115.75V41.875C115.75%2040.9801%20115.176%2040.3977%20114.341%2040.3977C113.693%2040.3977%20113.17%2040.75%20113.023%2041.2841H112.977C112.886%2040.75%20112.398%2040.3977%20111.784%2040.3977C111.179%2040.3977%20110.716%2040.7386%20110.534%2041.2841H110.489V40.4545H109V44.8182Z'%20fill='%2324292E'/%3e%3cpath%20d='M116.523%2046.4545H118.092V44.1023H118.114C118.296%2044.5455%20118.717%2044.875%20119.33%2044.875C120.262%2044.875%20121.046%2044.1477%20121.046%2042.6364C121.046%2041.0568%20120.205%2040.3977%20119.342%2040.3977C118.694%2040.3977%20118.285%2040.7727%20118.114%2041.2159H118.08V40.4545H116.523V46.4545ZM118.058%2042.6364C118.058%2041.9886%20118.319%2041.6023%20118.751%2041.6023C119.183%2041.6023%20119.433%2041.9886%20119.433%2042.6364C119.433%2043.2841%20119.183%2043.6705%20118.751%2043.6705C118.319%2043.6705%20118.058%2043.2727%20118.058%2042.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M123.271%2042.3636C123.274%2041.9318%20123.524%2041.6705%20123.908%2041.6705C124.308%2041.6705%20124.536%2041.9318%20124.533%2042.3636V44.8182H126.101V42.0341C126.104%2041.0795%20125.501%2040.3977%20124.578%2040.3977C123.933%2040.3977%20123.456%2040.7273%20123.26%2041.2841H123.214V39H121.703V44.8182H123.271V42.3636Z'%20fill='%2324292E'/%3e%3cpath%20d='M106%2021.5H104.572L103%2022.4199V23.6738L104.425%2022.8535H104.463V27.5H106V21.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M102.087%2045H106.5V43.8468H104.084V43.8092L104.797%2043.1561C106.09%2042.0376%20106.427%2041.4682%20106.427%2040.789C106.427%2039.7225%20105.551%2039%20104.198%2039C102.879%2039%20101.997%2039.7543%20102%2040.9595H103.365C103.365%2040.4249%20103.697%2040.1156%20104.192%2040.1156C104.678%2040.1156%20105.03%2040.4133%20105.03%2040.9017C105.03%2041.3439%20104.751%2041.6445%20104.262%2042.0809L102.087%2043.9711V45Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126588'%20x1='0'%20y1='7.5052'%20x2='24'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126588'%20x1='28'%20y1='7.5052'%20x2='43'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126588'%20x1='71'%20y1='7.5052'%20x2='95'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126588'%20x1='99'%20y1='7.5052'%20x2='129'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126588'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(0%201)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126588'%3e%3crect%20x='28'%20y='1'%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126588'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(71%201)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126588'%3e%3crect%20width='30'%20height='48'%20fill='white'%20transform='translate(99%201)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_38 = "data:image/svg+xml,%3csvg%20width='140'%20height='48'%20viewBox='0%200%20140%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126620)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.65%209.3H9.3V3.35C9.3%203.25717%209.26313%203.16815%209.19749%203.10251C9.13185%203.03687%209.04283%203%208.95%203H7.725C7.66392%203.00037%207.604%203.01672%207.5512%203.04742C7.49839%203.07812%207.45454%203.1221%207.424%203.175L3.8505%209.3H3.35C3.25717%209.3%203.16815%209.33687%203.10251%209.40251C3.03687%209.46815%203%209.55717%203%209.65C3%209.74283%203.03687%209.83185%203.10251%209.89749C3.16815%209.96313%203.25717%2010%203.35%2010H4.75C4.84283%2010%204.93185%209.96313%204.99749%209.89749C5.06313%209.83185%205.1%209.74283%205.1%209.65C5.1%209.55717%205.06313%209.46815%204.99749%209.40251C4.93185%209.33687%204.84283%209.3%204.75%209.3H4.659L5.884%207.2H8.6V9.3H8.25C8.15717%209.3%208.06815%209.33687%208.00251%209.40251C7.93687%209.46815%207.9%209.55717%207.9%209.65C7.9%209.74283%207.93687%209.83185%208.00251%209.89749C8.06815%209.96313%208.15717%2010%208.25%2010H9.65C9.74283%2010%209.83185%209.96313%209.89749%209.89749C9.96313%209.83185%2010%209.74283%2010%209.65C10%209.55717%209.96313%209.46815%209.89749%209.40251C9.83185%209.33687%209.74283%209.3%209.65%209.3ZM8.6%206.5H6.2935L7.9245%203.7H8.6V6.5Z'%20fill='white'/%3e%3cpath%20d='M23%2015.5H22.5V16V32V32.5H23H50H50.5V32V16V15.5H50H23Z'%20stroke='%2324292E'/%3e%3cpath%20d='M30.3747%2024.4872C30.3426%2023.7927%2029.7236%2023.3761%2028.7057%2023.3761C27.6992%2023.3761%2027.0779%2023.7607%2027.0825%2024.4444C27.0779%2024.9615%2027.4379%2025.2927%2028.1555%2025.4103L28.7791%2025.5128C29.0542%2025.5598%2029.178%2025.6282%2029.1826%2025.7521C29.178%2025.8889%2029.0106%2025.9658%2028.7791%2025.9658C28.4925%2025.9658%2028.2907%2025.8504%2028.2564%2025.641H27C27.0688%2026.3141%2027.6924%2026.7607%2028.7699%2026.7607C29.7443%2026.7607%2030.4618%2026.3184%2030.4664%2025.6154C30.4618%2025.1303%2030.1134%2024.8483%2029.3935%2024.7265L28.6782%2024.6068C28.41%2024.562%2028.3343%2024.4722%2028.3389%2024.3761C28.3343%2024.2393%2028.5154%2024.1624%2028.7332%2024.1624C28.9831%2024.1624%2029.1917%2024.2863%2029.2101%2024.4872H30.3747Z'%20fill='%2326262A'/%3e%3cpath%20d='M33.0513%2023.4188H32.4461V22.6325H31.1806V23.4188H30.7312V24.2735H31.1806V25.7564C31.1714%2026.4444%2031.6276%2026.7927%2032.5011%2026.7479C32.7877%2026.7329%2033.0009%2026.6773%2033.1155%2026.6453L32.9321%2025.8162C32.884%2025.8269%2032.7602%2025.8504%2032.6845%2025.8504C32.5195%2025.8504%2032.4461%2025.7821%2032.4461%2025.6453V24.2735H33.0513V23.4188Z'%20fill='%2326262A'/%3e%3cpath%20d='M33.5678%2026.7009H34.8333V24.9915C34.8333%2024.6154%2035.1107%2024.3675%2035.4844%2024.3675C35.6151%2024.3675%2035.826%2024.3868%2035.9521%2024.4274V23.4209C35.8512%2023.3932%2035.7411%2023.3761%2035.6311%2023.3761C35.2551%2023.3761%2034.9617%2023.5812%2034.8333%2024.0427H34.7966V23.4188H33.5678V26.7009Z'%20fill='%2326262A'/%3e%3cpath%20d='M36.367%2026.7009H37.6326V23.4188H36.367V26.7009ZM36.9998%2023.0769C37.3437%2023.0769%2037.6234%2022.8355%2037.6234%2022.5385C37.6234%2022.2415%2037.3437%2022%2036.9998%2022C36.6559%2022%2036.3762%2022.2415%2036.3762%2022.5385C36.3762%2022.8355%2036.6559%2023.0769%2036.9998%2023.0769Z'%20fill='%2326262A'/%3e%3cpath%20d='M39.5429%2024.8547C39.5452%2024.5299%2039.7423%2024.3333%2040.0564%2024.3333C40.3751%2024.3333%2040.5631%2024.5299%2040.5608%2024.8547V26.7009H41.8263V24.6068C41.8286%2023.8932%2041.3449%2023.3761%2040.5975%2023.3761C40.0793%2023.3761%2039.669%2023.6282%2039.5154%2024.0427H39.4787V23.4188H38.2773V26.7009H39.5429V24.8547Z'%20fill='%2326262A'/%3e%3cpath%20d='M44.1476%2028C45.2618%2028%2046%2027.5256%2046%2026.6923V23.4188H44.7345V23.9915H44.707C44.5694%2023.6581%2044.2393%2023.3761%2043.7166%2023.3761C43.0196%2023.3761%2042.341%2023.8718%2042.341%2025.0598C42.341%2026.1966%2042.9738%2026.6581%2043.7257%2026.6581C44.2026%2026.6581%2044.5786%2026.4701%2044.7161%2026.1368H44.7528V26.6923C44.7528%2027.0791%2044.5121%2027.2051%2044.1843%2027.2051C43.8931%2027.2051%2043.6799%2027.1239%2043.6432%2026.9145H42.4235C42.4717%2027.547%2043.0884%2028%2044.1476%2028ZM44.1934%2025.8205C43.8449%2025.8205%2043.6432%2025.547%2043.6432%2025.0598C43.6432%2024.5726%2043.8449%2024.2821%2044.1934%2024.2821C44.5419%2024.2821%2044.7528%2024.5726%2044.7528%2025.0598C44.7528%2025.5385%2044.5419%2025.8205%2044.1934%2025.8205Z'%20fill='%2326262A'/%3e%3cpath%20d='M63.9067%2030C64.6011%2030%2069.9327%2026%2069.9327%2024C69.9327%2022%2064.7357%2018%2063.9067%2018C63.0778%2018%2062.4023%2018.5%2062.4023%2019.4756C62.4023%2020.4512%2065.9067%2022.9206%2065.9067%2022.9206C65.9067%2022.9206%2058.2539%2022.25%2058%2022.9206C57.7461%2023.5911%2057.7461%2024.4089%2058%2025.0794C58.2539%2025.75%2065.9067%2025.0794%2065.9067%2025.0794C65.9067%2025.0794%2062.4023%2027.75%2062.4023%2028.5301C62.4023%2029.3103%2063.2124%2030%2063.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M78%201.04083V13H93V0H78.6268C78.4606%200%2078.3011%200.109659%2078.1836%200.304853C78.066%200.500047%2078%200.764787%2078%201.04083Z'%20fill='url(%23paint1_linear_1248_126620)'/%3e%3cpath%20d='M93%2017.5H78V30.5H93V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M93%2035H78V48H93V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M86.5%2021H85.0716L83.5%2021.9199V23.1738L84.9253%2022.3535H84.9627V27H86.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M83.3373%2044.5H87.75V43.3468H85.3341V43.3092L86.0472%2042.6561C87.3396%2041.5376%2087.6772%2040.9682%2087.6772%2040.289C87.6772%2039.2225%2086.8011%2038.5%2085.4476%2038.5C84.129%2038.5%2083.2471%2039.2543%2083.25%2040.4595H84.6151C84.6151%2039.9249%2084.947%2039.6156%2085.4418%2039.6156C85.9279%2039.6156%2086.2801%2039.9133%2086.2801%2040.4017C86.2801%2040.8439%2086.0006%2041.1445%2085.5116%2041.5809L83.3373%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126620)'%3e%3cpath%20d='M83.1733%205.06818H83.3523V5.24716C83.3523%205.3421%2083.39%205.43314%2083.4571%205.50027C83.5242%205.5674%2083.6153%205.60511%2083.7102%205.60511C83.8052%205.60511%2083.8962%205.5674%2083.9633%205.50027C84.0305%205.43314%2084.0682%205.3421%2084.0682%205.24716V5.06818H84.2472C84.3421%205.06818%2084.4331%205.03047%2084.5003%204.96334C84.5674%204.89621%2084.6051%204.80516%2084.6051%204.71023C84.6051%204.61529%2084.5674%204.52425%2084.5003%204.45712C84.4331%204.38999%2084.3421%204.35227%2084.2472%204.35227H84.0682V4.1733C84.0682%204.07836%2084.0305%203.98731%2083.9633%203.92018C83.8962%203.85305%2083.8052%203.81534%2083.7102%203.81534C83.6153%203.81534%2083.5242%203.85305%2083.4571%203.92018C83.39%203.98731%2083.3523%204.07836%2083.3523%204.1733V4.35227H83.1733C83.0784%204.35227%2082.9873%204.38999%2082.9202%204.45712C82.8531%204.52425%2082.8153%204.61529%2082.8153%204.71023C82.8153%204.80516%2082.8531%204.89621%2082.9202%204.96334C82.9873%205.03047%2083.0784%205.06818%2083.1733%205.06818ZM82.9514%209.04864C83.0184%209.11531%2083.1092%209.15273%2083.2037%209.15273C83.2983%209.15273%2083.389%209.11531%2083.4561%209.04864L83.7102%208.79449L83.9644%209.04864C84.0314%209.11531%2084.1222%209.15273%2084.2167%209.15273C84.3113%209.15273%2084.402%209.11531%2084.4691%209.04864C84.5358%208.98157%2084.5732%208.89085%2084.5732%208.79628C84.5732%208.70171%2084.5358%208.61099%2084.4691%208.54392L84.2149%208.28977L84.4691%208.03563C84.5277%207.96715%2084.5584%207.87906%2084.5549%207.78898C84.5514%207.69889%2084.5141%207.61343%2084.4503%207.54968C84.3866%207.48593%2084.3011%207.44858%2084.211%207.4451C84.1209%207.44162%2084.0329%207.47227%2083.9644%207.53091L83.7102%207.78506L83.4561%207.53091C83.3876%207.47227%2083.2995%207.44162%2083.2094%207.4451C83.1193%207.44858%2083.0339%207.48593%2082.9701%207.54968C82.9064%207.61343%2082.869%207.69889%2082.8656%207.78898C82.8621%207.87906%2082.8927%207.96715%2082.9514%208.03563L83.2055%208.28977L82.9514%208.54392C82.8847%208.61099%2082.8473%208.70171%2082.8473%208.79628C82.8473%208.89085%2082.8847%208.98157%2082.9514%209.04864V9.04864ZM88.3636%202.5625H82.6364C82.3516%202.5625%2082.0784%202.67564%2081.877%202.87703C81.6756%203.07842%2081.5625%203.35156%2081.5625%203.63636V9.36364C81.5625%209.64844%2081.6756%209.92159%2081.877%2010.123C82.0784%2010.3244%2082.3516%2010.4375%2082.6364%2010.4375H88.3636C88.6484%2010.4375%2088.9216%2010.3244%2089.123%2010.123C89.3244%209.92159%2089.4375%209.64844%2089.4375%209.36364V3.63636C89.4375%203.35156%2089.3244%203.07842%2089.123%202.87703C88.9216%202.67564%2088.6484%202.5625%2088.3636%202.5625V2.5625ZM85.142%209.72159H82.6364C82.5414%209.72159%2082.4504%209.68388%2082.3833%209.61675C82.3161%209.54962%2082.2784%209.45857%2082.2784%209.36364V6.85796H85.142V9.72159ZM85.142%206.14205H82.2784V3.63636C82.2784%203.54143%2082.3161%203.45038%2082.3833%203.38325C82.4504%203.31612%2082.5414%203.27841%2082.6364%203.27841H85.142V6.14205ZM88.7216%209.36364C88.7216%209.45857%2088.6839%209.54962%2088.6167%209.61675C88.5496%209.68388%2088.4586%209.72159%2088.3636%209.72159H85.858V6.85796H88.7216V9.36364ZM88.7216%206.14205H85.858V3.27841H88.3636C88.4586%203.27841%2088.5496%203.31612%2088.6167%203.38325C88.6839%203.45038%2088.7216%203.54143%2088.7216%203.63636V6.14205ZM86.7528%208.1108H87.8267C87.9216%208.1108%2088.0127%208.07308%2088.0798%208.00595C88.1469%207.93882%2088.1847%207.84778%2088.1847%207.75284C88.1847%207.65791%2088.1469%207.56686%2088.0798%207.49973C88.0127%207.4326%2087.9216%207.39489%2087.8267%207.39489H86.7528C86.6579%207.39489%2086.5669%207.4326%2086.4997%207.49973C86.4326%207.56686%2086.3949%207.65791%2086.3949%207.75284C86.3949%207.84778%2086.4326%207.93882%2086.4997%208.00595C86.5669%208.07308%2086.6579%208.1108%2086.7528%208.1108V8.1108ZM87.8267%204.35227H86.7528C86.6579%204.35227%2086.5669%204.38999%2086.4997%204.45712C86.4326%204.52425%2086.3949%204.61529%2086.3949%204.71023C86.3949%204.80516%2086.4326%204.89621%2086.4997%204.96334C86.5669%205.03047%2086.6579%205.06818%2086.7528%205.06818H87.8267C87.9216%205.06818%2088.0127%205.03047%2088.0798%204.96334C88.1469%204.89621%2088.1847%204.80516%2088.1847%204.71023C88.1847%204.61529%2088.1469%204.52425%2088.0798%204.45712C88.0127%204.38999%2087.9216%204.35227%2087.8267%204.35227ZM86.7528%209.18466H87.8267C87.9216%209.18466%2088.0127%209.14695%2088.0798%209.07982C88.1469%209.01269%2088.1847%208.92164%2088.1847%208.82671C88.1847%208.73177%2088.1469%208.64072%2088.0798%208.57359C88.0127%208.50646%2087.9216%208.46875%2087.8267%208.46875H86.7528C86.6579%208.46875%2086.5669%208.50646%2086.4997%208.57359C86.4326%208.64072%2086.3949%208.73177%2086.3949%208.82671C86.3949%208.92164%2086.4326%209.01269%2086.4997%209.07982C86.5669%209.14695%2086.6579%209.18466%2086.7528%209.18466V9.18466Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M101%2015.5H100.5V16V32V32.5H101H137H137.5V32V16V15.5H137H101Z'%20stroke='%2324292E'/%3e%3cpath%20d='M106.339%2024.4629C106.341%2024.1258%20106.55%2023.9218%20106.882%2023.9218C107.219%2023.9218%20107.418%2024.1258%20107.416%2024.4629V26.3791H108.754V24.2057C108.757%2023.4649%20108.245%2022.9282%20107.454%2022.9282C106.906%2022.9282%20106.472%2023.1899%20106.31%2023.6202H106.271V22.9726H105V26.3791H106.339V24.4629Z'%20fill='%2326262A'/%3e%3cpath%20d='M111.831%2024.8887C111.833%2025.2258%20111.62%2025.4299%20111.288%2025.4299C110.95%2025.4299%20110.756%2025.2258%20110.754%2024.8887V22.9726H109.415V25.146C109.418%2025.8912%20109.932%2026.4234%20110.715%2026.4234C111.271%2026.4234%20111.697%2026.1662%20111.86%2025.7315H111.899V26.3791H113.17V22.9726H111.831V24.8887Z'%20fill='%2326262A'/%3e%3cpath%20d='M113.85%2026.3791H115.189V24.392C115.189%2024.0948%20115.359%2023.9129%20115.636%2023.9129C115.912%2023.9129%20116.091%2024.0948%20116.091%2024.392V26.3791H117.372V24.392C117.372%2024.0948%20117.542%2023.9129%20117.818%2023.9129C118.095%2023.9129%20118.274%2024.0948%20118.274%2024.392V26.3791H119.613V24.0815C119.613%2023.3829%20119.123%2022.9282%20118.41%2022.9282C117.857%2022.9282%20117.411%2023.2032%20117.285%2023.6202H117.246C117.168%2023.2032%20116.751%2022.9282%20116.227%2022.9282C115.711%2022.9282%20115.315%2023.1944%20115.16%2023.6202H115.121V22.9726H113.85V26.3791Z'%20fill='%2326262A'/%3e%3cpath%20d='M122.058%2026.4412C123.091%2026.4412%20123.756%2025.9888%20123.882%2025.2791H122.66C122.582%2025.472%20122.361%2025.5807%20122.087%2025.5807C121.69%2025.5807%20121.457%2025.3412%20121.457%2025.0129V24.9597H123.882V24.6758C123.882%2023.5914%20123.155%2022.9282%20122.029%2022.9282C120.875%2022.9282%20120.137%2023.6291%20120.137%2024.6847C120.137%2025.7869%20120.865%2026.4412%20122.058%2026.4412ZM121.457%2024.2855C121.464%2023.9905%20121.731%2023.7887%20122.058%2023.7887C122.391%2023.7887%20122.643%2023.9928%20122.65%2024.2855H121.457Z'%20fill='%2326262A'/%3e%3cpath%20d='M124.428%2026.3791H125.767V24.6049C125.767%2024.2145%20126.061%2023.9573%20126.456%2023.9573C126.594%2023.9573%20126.817%2023.9772%20126.951%2024.0194V22.9748C126.844%2022.946%20126.728%2022.9282%20126.611%2022.9282C126.213%2022.9282%20125.903%2023.1411%20125.767%2023.6202H125.728V22.9726H124.428V26.3791Z'%20fill='%2326262A'/%3e%3cpath%20d='M127.39%2026.3791H128.728V22.9726H127.39V26.3791ZM128.059%2022.6178C128.423%2022.6178%20128.719%2022.3671%20128.719%2022.0589C128.719%2021.7506%20128.423%2021.5%20128.059%2021.5C127.695%2021.5%20127.399%2021.7506%20127.399%2022.0589C127.399%2022.3671%20127.695%2022.6178%20128.059%2022.6178Z'%20fill='%2326262A'/%3e%3cpath%20d='M131.205%2026.4412C132.309%2026.4412%20132.985%2025.8623%20133%2024.9597H131.758C131.729%2025.3168%20131.518%2025.5097%20131.225%2025.5097C130.873%2025.5097%20130.643%2025.2347%20130.643%2024.6758C130.643%2024.117%20130.873%2023.842%20131.225%2023.842C131.521%2023.842%20131.722%2024.0349%20131.758%2024.392H133C132.993%2023.5049%20132.302%2022.9282%20131.205%2022.9282C129.993%2022.9282%20129.275%2023.6379%20129.275%2024.6847C129.275%2025.7315%20129.993%2026.4412%20131.205%2026.4412Z'%20fill='%2326262A'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126620'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126620'%20x1='78'%20y1='6.5052'%20x2='93'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126620'%3e%3crect%20width='9'%20height='9'%20fill='white'%20transform='translate(81%202)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_39 = "data:image/svg+xml,%3csvg%20width='102'%20height='48'%20viewBox='0%200%20102%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126563)'%3e%3cpath%20d='M0%201.04083V13H40V0H1.67154C1.22822%200%200%200%200%200C0%200%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126563)'/%3e%3cpath%20d='M40%2017.5H0V30.5H40V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M40%2035H0V48H40V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13.75%205.45455H12.1023L11.3977%208.34091H11.3523L10.6477%205.45455H9L10.4659%209.81818H12.2841L13.75%205.45455Z'%20fill='%2324292E'/%3e%3cpath%20d='M15.2947%209.88636C15.8629%209.88636%2016.2919%209.69318%2016.5561%209.20455H16.5902V9.81818H18.0561V6.82955C18.0561%206.02273%2017.2919%205.39773%2016.0447%205.39773C14.7408%205.39773%2014.0987%206.07955%2014.0447%206.875H15.4879C15.5249%206.60511%2015.7237%206.47727%2016.022%206.47727C16.2947%206.47727%2016.4879%206.60227%2016.4879%206.82955V6.84091C16.4879%207.09375%2016.2095%207.1733%2015.4766%207.22727C14.576%207.29261%2013.8743%207.65625%2013.8743%208.61364C13.8743%209.48295%2014.4595%209.88636%2015.2947%209.88636ZM15.8061%208.89773C15.5391%208.89773%2015.3516%208.76705%2015.3516%208.52273C15.3516%208.2983%2015.5107%208.125%2015.8743%208.06818C16.1243%208.02841%2016.3345%207.97727%2016.4993%207.90909V8.27273C16.4993%208.67045%2016.1612%208.89773%2015.8061%208.89773Z'%20fill='%2324292E'/%3e%3cpath%20d='M20.3736%204H18.8054V9.81818H20.3736V4Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.0021%207.90909C24.005%208.34091%2023.755%208.60227%2023.3658%208.60227C22.9709%208.60227%2022.7436%208.34091%2022.7408%207.90909V5.45455H21.1726V8.23864C21.1754%209.19318%2021.7777%209.875%2022.6953%209.875C23.3459%209.875%2023.8459%209.54545%2024.0362%208.98864H24.0817V9.81818H25.5703V5.45455H24.0021V7.90909Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.4588%209.89773C29.669%209.89773%2030.4474%209.31818%2030.5952%208.40909H29.1634C29.0724%208.65625%2028.8139%208.79545%2028.4929%208.79545C28.027%208.79545%2027.7543%208.48864%2027.7543%208.06818V8H30.5952V7.63636C30.5952%206.24716%2029.7429%205.39773%2028.4247%205.39773C27.0724%205.39773%2026.2088%206.29545%2026.2088%207.64773C26.2088%209.05966%2027.0611%209.89773%2028.4588%209.89773ZM27.7543%207.13636C27.7628%206.75852%2028.0753%206.5%2028.4588%206.5C28.848%206.5%2029.1435%206.76136%2029.152%207.13636H27.7543Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.18182%2027.7955V26.6591C5.5%2026.6591%205.40909%2026.429%205.40909%2025.9545V25.3295C5.40909%2024.9063%205.19318%2024.483%204.25%2024.2955V24.1591C5.19318%2023.9716%205.40909%2023.5483%205.40909%2023.125V22.5C5.40909%2022.0256%205.5%2021.7955%206.18182%2021.7955V20.6591C5.01136%2020.6591%203.88636%2020.6591%203.88636%2022.2955V22.7386C3.88636%2023.2955%203.66477%2023.5455%203%2023.5455V24.9091C3.66477%2024.9091%203.88636%2025.1591%203.88636%2025.7159V26.1591C3.88636%2027.7955%205.01136%2027.7955%206.18182%2027.7955Z'%20fill='%2324292E'/%3e%3cpath%20d='M7.92116%2026.5455C8.48935%2026.5455%208.91832%2026.3523%209.18253%2025.8636H9.21662V26.4773H10.6825V23.4886C10.6825%2022.6818%209.91832%2022.0568%208.67116%2022.0568C7.36719%2022.0568%206.72514%2022.7386%206.67116%2023.5341H8.11435C8.15128%2023.2642%208.35014%2023.1364%208.64844%2023.1364C8.92116%2023.1364%209.11435%2023.2614%209.11435%2023.4886V23.5C9.11435%2023.7528%208.83594%2023.8324%208.10298%2023.8864C7.20241%2023.9517%206.50071%2024.3153%206.50071%2025.2727C6.50071%2026.142%207.08594%2026.5455%207.92116%2026.5455ZM8.43253%2025.5568C8.16548%2025.5568%207.97798%2025.4261%207.97798%2025.1818C7.97798%2024.9574%208.13707%2024.7841%208.50071%2024.7273C8.75071%2024.6875%208.96094%2024.6364%209.12571%2024.5682V24.9318C9.12571%2025.3295%208.78764%2025.5568%208.43253%2025.5568Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.2841%2026.5682C12.7017%2026.5682%2013.0739%2026.2159%2013.0795%2025.7727C13.0739%2025.3409%2012.7017%2024.9886%2012.2841%2024.9886C11.8438%2024.9886%2011.483%2025.3409%2011.4886%2025.7727C11.483%2026.2159%2011.8438%2026.5682%2012.2841%2026.5682ZM12.2841%2023.6364C12.7017%2023.6364%2013.0739%2023.2841%2013.0795%2022.8409C13.0739%2022.4091%2012.7017%2022.0568%2012.2841%2022.0568C11.8438%2022.0568%2011.483%2022.4091%2011.4886%2022.8409C11.483%2023.2841%2011.8438%2023.6364%2012.2841%2023.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M16.7727%2020.6591H15.3182L13.8864%2021.5341V22.875L15.1591%2022.1136H15.1932V26.4773H16.7727V20.6591Z'%20fill='%2324292E'/%3e%3cpath%20d='M19.2202%2025.6818H18.0384V26C18.0384%2026.7727%2017.777%2027.5824%2017.6861%2027.8977H18.652C18.7884%2027.5824%2019.1378%2026.821%2019.1974%2026L19.2202%2025.6818Z'%20fill='%2324292E'/%3e%3cpath%20d='M21.3622%2026.4773H22.919V25.7614H22.9531C23.1349%2026.2045%2023.5554%2026.5341%2024.169%2026.5341C25.1009%2026.5341%2025.8849%2025.8068%2025.8849%2024.2955C25.8849%2022.7159%2025.044%2022.0568%2024.1804%2022.0568C23.5327%2022.0568%2023.1236%2022.4318%2022.9531%2022.875H22.9304V20.6591H21.3622V26.4773ZM22.8963%2024.2955C22.8963%2023.6477%2023.1577%2023.2614%2023.5895%2023.2614C24.0213%2023.2614%2024.2713%2023.6477%2024.2713%2024.2955C24.2713%2024.9432%2024.0213%2025.3295%2023.5895%2025.3295C23.1577%2025.3295%2022.8963%2024.9318%2022.8963%2024.2955Z'%20fill='%2324292E'/%3e%3cpath%20d='M27.3935%2026.5682C27.8111%2026.5682%2028.1832%2026.2159%2028.1889%2025.7727C28.1832%2025.3409%2027.8111%2024.9886%2027.3935%2024.9886C26.9531%2024.9886%2026.5923%2025.3409%2026.598%2025.7727C26.5923%2026.2159%2026.9531%2026.5682%2027.3935%2026.5682ZM27.3935%2023.6364C27.8111%2023.6364%2028.1832%2023.2841%2028.1889%2022.8409C28.1832%2022.4091%2027.8111%2022.0568%2027.3935%2022.0568C26.9531%2022.0568%2026.5923%2022.4091%2026.598%2022.8409C26.5923%2023.2841%2026.9531%2023.6364%2027.3935%2023.6364Z'%20fill='%2324292E'/%3e%3cpath%20d='M29.0298%2026.4773H33.4957V25.2159H31.223V25.1818L31.7685%2024.7273C33.0952%2023.6222%2033.4332%2023.0483%2033.4332%2022.375C33.4332%2021.2898%2032.544%2020.5795%2031.1491%2020.5795C29.794%2020.5795%2028.9134%2021.3324%2028.9162%2022.5568H30.4162C30.4134%2022.0682%2030.7116%2021.7955%2031.1491%2021.7955C31.5838%2021.7955%2031.8935%2022.0653%2031.8935%2022.5114C31.8935%2022.9233%2031.6293%2023.1903%2031.2003%2023.5455L29.0298%2025.3409V26.4773Z'%20fill='%2324292E'/%3e%3cpath%20d='M33.9403%2020V21.1364C34.6222%2021.1364%2034.7131%2021.3665%2034.7131%2021.8409V22.4659C34.7131%2022.8892%2034.929%2023.3125%2035.8722%2023.5V23.6364C34.929%2023.8239%2034.7131%2024.2472%2034.7131%2024.6705V25.2955C34.7131%2025.7699%2034.6222%2026%2033.9403%2026V27.1364C35.1108%2027.1364%2036.2358%2027.1364%2036.2358%2025.5V25.0568C36.2358%2024.5%2036.4574%2024.25%2037.1222%2024.25V22.8864C36.4574%2022.8864%2036.2358%2022.6364%2036.2358%2022.0795V21.6364C36.2358%2020%2035.1108%2020%2033.9403%2020Z'%20fill='%2324292E'/%3e%3cpath%20d='M13.1818%2045.1364V44C12.5%2044%2012.4091%2043.7699%2012.4091%2043.2955V42.6705C12.4091%2042.2472%2012.1932%2041.8239%2011.25%2041.6364V41.5C12.1932%2041.3125%2012.4091%2040.8892%2012.4091%2040.4659V39.8409C12.4091%2039.3665%2012.5%2039.1364%2013.1818%2039.1364V38C12.0114%2038%2010.8864%2038%2010.8864%2039.6364V40.0795C10.8864%2040.6364%2010.6648%2040.8864%2010%2040.8864V42.25C10.6648%2042.25%2010.8864%2042.5%2010.8864%2043.0568V43.5C10.8864%2045.1364%2012.0114%2045.1364%2013.1818%2045.1364Z'%20fill='%2324292E'/%3e%3cpath%20d='M14.9212%2044.0117C15.4893%2044.0117%2015.9183%2043.8185%2016.1825%2043.3298H16.2166V43.9435H17.6825V40.9548C17.6825%2040.148%2016.9183%2039.523%2015.6712%2039.523C14.3672%2039.523%2013.7251%2040.2048%2013.6712%2041.0003H15.1143C15.1513%2040.7304%2015.3501%2040.6026%2015.6484%2040.6026C15.9212%2040.6026%2016.1143%2040.7276%2016.1143%2040.9548V40.9662C16.1143%2041.219%2015.8359%2041.2986%2015.103%2041.3526C14.2024%2041.4179%2013.5007%2041.7815%2013.5007%2042.7389C13.5007%2043.6082%2014.0859%2044.0117%2014.9212%2044.0117ZM15.4325%2043.023C15.1655%2043.023%2014.978%2042.8923%2014.978%2042.648C14.978%2042.4236%2015.1371%2042.2503%2015.5007%2042.1935C15.7507%2042.1537%2015.9609%2042.1026%2016.1257%2042.0344V42.398C16.1257%2042.7957%2015.7876%2043.023%2015.4325%2043.023Z'%20fill='%2324292E'/%3e%3cpath%20d='M19.2955%2043.9321C19.7131%2043.9321%2020.0852%2043.5798%2020.0909%2043.1367C20.0852%2042.7048%2019.7131%2042.3526%2019.2955%2042.3526C18.8551%2042.3526%2018.4943%2042.7048%2018.5%2043.1367C18.4943%2043.5798%2018.8551%2043.9321%2019.2955%2043.9321ZM19.2955%2041.0003C19.7131%2041.0003%2020.0852%2040.648%2020.0909%2040.2048C20.0852%2039.773%2019.7131%2039.4207%2019.2955%2039.4207C18.8551%2039.4207%2018.4943%2039.773%2018.5%2040.2048C18.4943%2040.648%2018.8551%2041.0003%2019.2955%2041.0003Z'%20fill='%2324292E'/%3e%3cpath%20d='M23.1932%2044.6139C24.6165%2044.6139%2025.6193%2043.8895%2025.6136%2042.8639C25.6193%2042.1509%2025.142%2041.648%2024.2045%2041.5457V41.5003C24.8977%2041.4264%2025.4034%2040.9804%2025.3977%2040.3298C25.4034%2039.3497%2024.4943%2038.6367%2023.2045%2038.6367C21.8864%2038.6367%2020.9489%2039.3895%2020.9432%2040.4548H22.4545C22.4602%2040.1026%2022.7699%2039.8526%2023.2045%2039.8526C23.6023%2039.8526%2023.8807%2040.094%2023.875%2040.4321C23.8807%2040.7844%2023.5511%2041.0344%2023.0795%2041.0344H22.4886V42.1253H23.0795C23.5909%2042.1253%2023.9489%2042.3753%2023.9432%2042.7276C23.9489%2043.0884%2023.642%2043.3412%2023.2045%2043.3412C22.75%2043.3412%2022.4261%2043.0997%2022.4205%2042.7617H20.8295C20.8352%2043.8469%2021.8153%2044.6139%2023.1932%2044.6139Z'%20fill='%2324292E'/%3e%3cpath%20d='M26%2038.0003V39.1366C26.6818%2039.1366%2026.7727%2039.3667%2026.7727%2039.8412V40.4662C26.7727%2040.8895%2026.9886%2041.3128%2027.9318%2041.5003V41.6366C26.9886%2041.8241%2026.7727%2042.2474%2026.7727%2042.6707V43.2957C26.7727%2043.7702%2026.6818%2044.0003%2026%2044.0003V45.1366C27.1705%2045.1366%2028.2955%2045.1366%2028.2955%2043.5003V43.0571C28.2955%2042.5003%2028.517%2042.2503%2029.1818%2042.2503V40.8866C28.517%2040.8866%2028.2955%2040.6366%2028.2955%2040.0798V39.6366C28.2955%2038.0003%2027.1705%2038.0003%2026%2038.0003Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M53.9067%2030C54.6011%2030%2059.9327%2026%2059.9327%2024C59.9327%2022%2054.7357%2018%2053.9067%2018C53.0778%2018%2052.4023%2018.5%2052.4023%2019.4756C52.4023%2020.4512%2055.9067%2022.9206%2055.9067%2022.9206C55.9067%2022.9206%2048.2539%2022.25%2048%2022.9206C47.7461%2023.5911%2047.7461%2024.4089%2048%2025.0794C48.2539%2025.75%2055.9067%2025.0794%2055.9067%2025.0794C55.9067%2025.0794%2052.4023%2027.75%2052.4023%2028.5301C52.4023%2029.3103%2053.2124%2030%2053.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M68%201.04083V13H83V0H68.6268C68.4606%200%2068.3011%200.109659%2068.1836%200.304853C68.066%200.500047%2068%200.764787%2068%201.04083Z'%20fill='url(%23paint1_linear_1248_126563)'/%3e%3cpath%20d='M83%2017.5H68V30.5H83V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M83%2035H68V48H83V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M76.5%2021H75.0716L73.5%2021.9199V23.1738L74.9253%2022.3535H74.9627V27H76.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M74.7744%209.5C75.5264%209.5%2076.0464%209.23767%2076.3415%208.74147H76.3837V9.41783H78V6.1182C78%205.09102%2076.9845%204.5%2075.6107%204.5C74.1595%204.5%2073.3373%205.1574%2073.2003%206.04235L74.785%206.09292C74.8587%205.78319%2075.1434%205.59355%2075.5966%205.59355C76.0183%205.59355%2076.2853%205.77686%2076.2853%206.1024V6.1182C76.2853%206.4153%2075.9269%206.47851%2075.0063%206.5512C73.9136%206.63338%2073%206.99684%2073%208.07143C73%209.03224%2073.7414%209.5%2074.7744%209.5ZM75.305%208.48862C74.9079%208.48862%2074.6268%208.31795%2074.6268%207.99558C74.6268%207.68268%2074.9009%207.49305%2075.3893%207.42668C75.7091%207.38559%2076.1026%207.32238%2076.2959%207.23072V7.69216C76.2959%208.16625%2075.8531%208.48862%2075.305%208.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M75.4792%2044.5C76.8085%2044.5%2077.7528%2043.7757%2077.75%2042.7605C77.7528%2042.0418%2077.2958%2041.5285%2076.4208%2041.423V41.3774C77.0771%2041.2804%2077.5423%2040.827%2077.5395%2040.1711C77.5423%2039.2186%2076.706%2038.5%2075.4903%2038.5C74.2663%2038.5%2073.3746%2039.23%2073.3635%2040.2681H74.6734C74.6845%2039.8688%2075.0334%2039.6008%2075.4903%2039.6008C75.9251%2039.6008%2076.2214%2039.8717%2076.2186%2040.2624C76.2214%2040.6673%2075.8725%2040.9468%2075.3685%2040.9468H74.8174V41.9506H75.3685C75.9417%2041.9506%2076.3155%2042.2414%2076.31%2042.6521C76.3155%2043.0656%2075.9721%2043.3536%2075.4848%2043.3536C75.0001%2043.3536%2074.6429%2043.0884%2074.6291%2042.7034H73.25C73.2611%2043.7586%2074.1832%2044.5%2075.4792%2044.5Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_126563)'%3e%3cpath%20d='M87%2013H102V1.04083C102%200.764787%20101.934%200.500047%20101.816%200.304853C101.699%200.109659%20101.539%200%20101.373%200L87%200V13Z'%20fill='url(%23paint2_linear_1248_126563)'/%3e%3cpath%20d='M102%2017.5H87V30.5H102V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M102%2035H87V48H102V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M92%209.68623H93.5663V8.96449H93.6149C93.8155%209.37609%2094.2621%209.75%2095.0129%209.75C96.1133%209.75%2097%208.97898%2097%207.46304C97%205.89203%2096.0615%205.17609%2095.0227%205.17609C94.2362%205.17609%2093.8058%205.58768%2093.6149%205.99638H93.5825V3.75H92V9.68623ZM93.5502%207.46015C93.5502%206.73261%2093.8867%206.28333%2094.466%206.28333C95.0518%206.28333%2095.3754%206.7442%2095.3754%207.46015C95.3754%208.17899%2095.0518%208.64565%2094.466%208.64565C93.8867%208.64565%2093.5502%208.18188%2093.5502%207.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M92%2043.4453V42.4463L94.5893%2038.5H96.2308V42.4287H97V43.4453H96.2308V44.5H94.977V43.4453H92ZM95.0012%2042.4287V39.8828H94.9528L93.3204%2042.3818V42.4287H95.0012Z'%20fill='%2324292E'/%3e%3cpath%20d='M92.3373%2027H96.75V25.8468H94.3341V25.8092L95.0472%2025.1561C96.3396%2024.0376%2096.6772%2023.4682%2096.6772%2022.789C96.6772%2021.7225%2095.8011%2021%2094.4476%2021C93.129%2021%2092.2471%2021.7543%2092.25%2022.9595H93.6151C93.6151%2022.4249%2093.947%2022.1156%2094.4418%2022.1156C94.9279%2022.1156%2095.2801%2022.4133%2095.2801%2022.9017C95.2801%2023.3439%2095.0006%2023.6445%2094.5116%2024.0809L92.3373%2025.9711V27Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126563'%20x1='0'%20y1='6.5052'%20x2='40'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126563'%20x1='68'%20y1='6.5052'%20x2='83'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126563'%20x1='87'%20y1='6.5052'%20x2='102'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126563'%3e%3crect%20width='40'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126563'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(87)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_40 = "data:image/svg+xml,%3csvg%20width='50'%20height='48'%20viewBox='0%200%2050%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%200.611699V7.64012H14V0H0.58504C0.429878%200%200.28107%200.0644467%200.171354%200.179162C0.0616379%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1248_126334)'/%3e%3cpath%20d='M14%2010.0869H0V17.727H14V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14%2020.1799H0V27.8262H14V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14%2030.2668H0V37.907H14V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14%2048V40.3721H0V47.3883C0%2047.5505%200.0616379%2047.7061%200.171354%2047.8209C0.28107%2047.9356%200.429878%2048%200.58504%2048H14Z'%20fill='%233865AB'/%3e%3cpath%20d='M47.5651%2035.5782L42.3742%2030.4293C44.3891%2027.9169%2045.3649%2024.7281%2045.1009%2021.5184C44.8369%2018.3087%2043.3532%2015.3222%2040.9548%2013.1728C38.5564%2011.0235%2035.4257%209.87482%2032.2063%209.96291C28.987%2010.051%2025.9238%2011.3692%2023.6465%2013.6465C21.3693%2015.9237%2020.0511%2018.9869%2019.963%2022.2063C19.8749%2025.4256%2021.0236%2028.5563%2023.1729%2030.9547C25.3222%2033.3531%2028.3088%2034.8368%2031.5185%2035.1008C34.7282%2035.3649%2037.917%2034.3891%2040.4294%2032.3741L45.5783%2037.5231C45.7084%2037.6542%2045.8631%2037.7583%2046.0336%2037.8293C46.2041%2037.9004%2046.387%2037.9369%2046.5717%2037.9369C46.7564%2037.9369%2046.9393%2037.9004%2047.1098%2037.8293C47.2803%2037.7583%2047.435%2037.6542%2047.5651%2037.5231C47.8173%2037.2622%2047.9583%2036.9135%2047.9583%2036.5506C47.9583%2036.1878%2047.8173%2035.8391%2047.5651%2035.5782V35.5782ZM32.58%2032.3741C30.6429%2032.3741%2028.7493%2031.7997%2027.1387%2030.7235C25.528%2029.6473%2024.2727%2028.1177%2023.5314%2026.328C22.7901%2024.5384%2022.5961%2022.5691%2022.974%2020.6692C23.3519%2018.7693%2024.2848%2017.0242%2025.6545%2015.6544C27.0242%2014.2847%2028.7694%2013.3519%2030.6693%2012.974C32.5692%2012.5961%2034.5384%2012.79%2036.3281%2013.5313C38.1177%2014.2726%2039.6474%2015.528%2040.7236%2017.1386C41.7998%2018.7492%2042.3742%2020.6428%2042.3742%2022.5799C42.3742%2025.1775%2041.3423%2027.6687%2039.5056%2029.5055C37.6688%2031.3422%2035.1776%2032.3741%2032.58%2032.3741V32.3741Z'%20fill='%2324292E'/%3e%3cpath%20d='M32.5%2016C31.0413%2016%2029.6424%2016.5479%2028.6109%2017.523C27.5795%2018.4982%2027%2019.8209%2027%2021.2C27%2024.71%2031.8469%2028.675%2032.0531%2028.844C32.1777%2028.9447%2032.3361%2029%2032.5%2029C32.6639%2029%2032.8223%2028.9447%2032.9469%2028.844C33.1875%2028.675%2038%2024.71%2038%2021.2C38%2019.8209%2037.4205%2018.4982%2036.3891%2017.523C35.3576%2016.5479%2033.9587%2016%2032.5%2016Z'%20fill='%23FF0000'/%3e%3cpath%20d='M35%2021.5C35%2022.8807%2033.8807%2024%2032.5%2024C31.1193%2024%2030%2022.8807%2030%2021.5C30%2020.1193%2031.1193%2019%2032.5%2019C33.8807%2019%2035%2020.1193%2035%2021.5Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126334'%20x1='0'%20y1='3.82312'%20x2='14'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_41 = "data:image/svg+xml,%3csvg%20width='158'%20height='49'%20viewBox='0%200%20158%2049'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M19%2014H34V2.04083C34%201.76479%2033.934%201.50005%2033.8164%201.30485C33.6989%201.10966%2033.5394%201%2033.3732%201H19V14Z'%20fill='url(%23paint0_linear_1248_126159)'/%3e%3cpath%20d='M34%2018.5H19V31.5H34V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2036H19V49H34V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M0%202.03583V13.995H15V0.994995H0.626828C0.460583%200.994995%200.301147%201.10465%200.183594%201.29985C0.0660407%201.49504%200%201.75978%200%202.03583Z'%20fill='url(%23paint1_linear_1248_126159)'/%3e%3cpath%20d='M15%2018.495H0V31.495H15V18.495Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035.995H0V48.995H15V35.995Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M46.3343%2031H49.674V26.674H54V23.3343H49.674V19H46.3343V23.3343H42V26.674H46.3343V31Z'%20fill='%2324292E'/%3e%3cpath%20d='M82.675%202.5H75.325C74.9073%202.5%2074.5067%202.66594%2074.2113%202.96131C73.9159%203.25668%2073.75%203.65728%2073.75%204.075V4.68925C73.7499%204.90604%2073.7946%205.12052%2073.8813%205.31925V5.35075C73.9554%205.51926%2074.0605%205.6724%2074.191%205.80225L77.425%209.01525V12.475C77.4248%2012.5642%2077.4474%2012.652%2077.4906%2012.7301C77.5337%2012.8082%2077.5961%2012.874%2077.6717%2012.9212C77.7553%2012.973%2077.8517%2013.0003%2077.95%2013C78.0322%2012.9995%2078.1131%2012.9797%2078.1862%2012.9422L80.2862%2011.8922C80.3728%2011.8486%2080.4456%2011.7819%2080.4966%2011.6994C80.5476%2011.6169%2080.5747%2011.5219%2080.575%2011.425V9.01525L83.788%205.80225C83.9185%205.6724%2084.0236%205.51926%2084.0977%205.35075V5.31925C84.1916%205.12208%2084.2435%204.90753%2084.25%204.68925V4.075C84.25%203.65728%2084.0841%203.25668%2083.7887%202.96131C83.4933%202.66594%2083.0927%202.5%2082.675%202.5ZM79.6772%208.42725C79.6286%208.47631%2079.5901%208.53448%2079.564%208.59845C79.5378%208.66241%2079.5246%208.73091%2079.525%208.8V11.0995L78.475%2011.6245V8.8C78.4754%208.73091%2078.4622%208.66241%2078.436%208.59845C78.4099%208.53448%2078.3714%208.47631%2078.3227%208.42725L75.5402%205.65H82.4597L79.6772%208.42725ZM83.2%204.6H74.8V4.075C74.8%203.93576%2074.8553%203.80223%2074.9538%203.70377C75.0522%203.60531%2075.1858%203.55%2075.325%203.55H82.675C82.8142%203.55%2082.9478%203.60531%2083.0462%203.70377C83.1447%203.80223%2083.2%203.93576%2083.2%204.075V4.6Z'%20fill='%2324292E'%20fill-opacity='0.75'/%3e%3cg%20clip-path='url(%23clip0_1248_126159)'%3e%3cpath%20d='M62%2018.7908V30.75H76.9563V17.75H62.625C62.4592%2017.75%2062.3003%2017.8597%2062.1831%2018.0549C62.0658%2018.25%2062%2018.5148%2062%2018.7908Z'%20fill='url(%23paint2_linear_1248_126159)'/%3e%3cpath%20d='M77%2035.25H62V48.25H77V35.25Z'%20fill='%233865AB'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126159)'%3e%3cpath%20d='M81%2030.75H96V18.7908C96%2018.5148%2095.934%2018.25%2095.8164%2018.0549C95.6989%2017.8597%2095.5394%2017.75%2095.3732%2017.75H81V30.75Z'%20fill='url(%23paint3_linear_1248_126159)'/%3e%3cpath%20d='M96%2035.25H81V48.25H96V35.25Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M109.907%2031C110.601%2031%20115.933%2027%20115.933%2025C115.933%2023%20110.736%2019%20109.907%2019C109.078%2019%20108.402%2019.5%20108.402%2020.4756C108.402%2021.4512%20111.907%2023.9206%20111.907%2023.9206C111.907%2023.9206%20104.254%2023.25%20104%2023.9206C103.746%2024.5911%20103.746%2025.4089%20104%2026.0794C104.254%2026.75%20111.907%2026.0794%20111.907%2026.0794C111.907%2026.0794%20108.402%2028.75%20108.402%2029.5301C108.402%2030.3103%20109.212%2031%20109.907%2031Z'%20fill='%2324292E'/%3e%3cpath%20d='M143%2014H158V2.04083C158%201.76479%20157.934%201.50005%20157.816%201.30485C157.699%201.10966%20157.539%201%20157.373%201H143V14Z'%20fill='url(%23paint4_linear_1248_126159)'/%3e%3cpath%20d='M158%2018.5H143V31.5H158V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2036H143V49H158V36Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%202.03583V13.995H139V0.994995H124.627C124.461%200.994995%20124.301%201.10465%20124.184%201.29985C124.066%201.49504%20124%201.75978%20124%202.03583Z'%20fill='url(%23paint5_linear_1248_126159)'/%3e%3cpath%20d='M139%2018.495H124V31.495H139V18.495Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2035.995H124V48.995H139V35.995Z'%20fill='%2384AFF1'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126159'%20x1='19'%20y1='7.5052'%20x2='34'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126159'%20x1='0'%20y1='7.5002'%20x2='15'%20y2='7.5002'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126159'%20x1='62'%20y1='24.2552'%20x2='76.9563'%20y2='24.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126159'%20x1='81'%20y1='24.2552'%20x2='96'%20y2='24.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126159'%20x1='143'%20y1='7.5052'%20x2='158'%20y2='7.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1248_126159'%20x1='124'%20y1='7.5002'%20x2='139'%20y2='7.5002'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126159'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%2017.75)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126159'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%2017.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_42 = "data:image/svg+xml,%3csvg%20width='136'%20height='48'%20viewBox='0%200%20136%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126213)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126213)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1248_126213)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M26.4792%2027C27.8085%2027%2028.7528%2026.2757%2028.75%2025.2605C28.7528%2024.5418%2028.2958%2024.0285%2027.4208%2023.923V23.8774C28.0771%2023.7804%2028.5423%2023.327%2028.5395%2022.6711C28.5423%2021.7186%2027.706%2021%2026.4903%2021C25.2663%2021%2024.3746%2021.73%2024.3635%2022.7681H25.6734C25.6845%2022.3688%2026.0334%2022.1008%2026.4903%2022.1008C26.9251%2022.1008%2027.2214%2022.3717%2027.2186%2022.7624C27.2214%2023.1673%2026.8725%2023.4468%2026.3685%2023.4468H25.8174V24.4506H26.3685C26.9417%2024.4506%2027.3155%2024.7414%2027.31%2025.1521C27.3155%2025.5656%2026.9721%2025.8536%2026.4848%2025.8536C26.0001%2025.8536%2025.6429%2025.5884%2025.6291%2025.2034H24.25C24.2611%2026.2586%2025.1832%2027%2026.4792%2027Z'%20fill='%2324292E'/%3e%3cpath%20d='M24%2043.4453V42.4463L26.5893%2038.5H28.2308V42.4287H29V43.4453H28.2308V44.5H26.977V43.4453H24ZM27.0012%2042.4287V39.8828H26.9528L25.3204%2042.3818V42.4287H27.0012Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126213)'%3e%3cpath%20d='M47.675%2018.75H40.325C39.9073%2018.75%2039.5067%2018.9159%2039.2113%2019.2113C38.9159%2019.5067%2038.75%2019.9073%2038.75%2020.325V20.9392C38.7499%2021.156%2038.7946%2021.3705%2038.8813%2021.5692V21.6007C38.9554%2021.7693%2039.0605%2021.9224%2039.191%2022.0522L42.425%2025.2652V28.725C42.4248%2028.8142%2042.4474%2028.902%2042.4906%2028.9801C42.5337%2029.0582%2042.5961%2029.124%2042.6717%2029.1712C42.7553%2029.223%2042.8517%2029.2503%2042.95%2029.25C43.0322%2029.2495%2043.1131%2029.2297%2043.1862%2029.1922L45.2862%2028.1422C45.3728%2028.0986%2045.4456%2028.0319%2045.4966%2027.9494C45.5476%2027.8669%2045.5747%2027.7719%2045.575%2027.675V25.2652L48.788%2022.0522C48.9185%2021.9224%2049.0236%2021.7693%2049.0977%2021.6007V21.5692C49.1916%2021.3721%2049.2435%2021.1575%2049.25%2020.9392V20.325C49.25%2019.9073%2049.0841%2019.5067%2048.7887%2019.2113C48.4933%2018.9159%2048.0927%2018.75%2047.675%2018.75ZM44.6772%2024.6772C44.6286%2024.7263%2044.5901%2024.7845%2044.564%2024.8484C44.5378%2024.9124%2044.5246%2024.9809%2044.525%2025.05V27.3495L43.475%2027.8745V25.05C43.4754%2024.9809%2043.4622%2024.9124%2043.436%2024.8484C43.4099%2024.7845%2043.3714%2024.7263%2043.3227%2024.6772L40.5402%2021.9H47.4597L44.6772%2024.6772ZM48.2%2020.85H39.8V20.325C39.8%2020.1858%2039.8553%2020.0522%2039.9538%2019.9538C40.0522%2019.8553%2040.1858%2019.8%2040.325%2019.8H47.675C47.8142%2019.8%2047.9478%2019.8553%2048.0462%2019.9538C48.1447%2020.0522%2048.2%2020.1858%2048.2%2020.325V20.85Z'%20fill='%2324292E'%20fill-opacity='0.75'/%3e%3c/g%3e%3cpath%20d='M52.8087%2027C51.7696%2027%2051%2026.4879%2051%2025.477C51%2024.3364%2051.9682%2023.9972%2053.0463%2023.9041C53.9932%2023.8176%2054.3656%2023.7744%2054.3656%2023.4452V23.4252C54.3656%2023.0062%2054.0712%2022.7635%2053.557%2022.7635C53.0144%2022.7635%2052.6917%2023.0129%2052.5888%2023.3521L51.1915%2023.2456C51.4007%2022.3145%2052.259%2021.7292%2053.5641%2021.7292C54.777%2021.7292%2055.8764%2022.2414%2055.8764%2023.4585V26.9036H54.4436V26.1953H54.401C54.1351%2026.6708%2053.6137%2027%2052.8087%2027ZM53.2414%2026.0224C53.9045%2026.0224%2054.3762%2025.6133%2054.3762%2025.0779V24.5359C54.1954%2024.649%2053.6563%2024.7221%2053.3265%2024.7654C52.7945%2024.8352%2052.4434%2025.0314%2052.4434%2025.4304C52.4434%2025.8195%2052.7768%2026.0224%2053.2414%2026.0224Z'%20fill='%2324292E'%20fill-opacity='0.75'/%3e%3cpath%20d='M57.3889%2026.3727V25.1922H62.2866V26.3727H57.3889ZM57.3889%2024.1646V22.9841H62.2866V24.1646H57.3889Z'%20fill='%2324292E'%20fill-opacity='0.75'/%3e%3cpath%20d='M63.0676%2027V26.0983L65.5304%2024.1474C66.1588%2023.6301%2066.4966%2023.3064%2066.4966%2022.8353C66.4966%2022.315%2066.0439%2021.9913%2065.4358%2021.9913C64.8041%2021.9913%2064.3851%2022.3381%2064.3885%2022.9046H63C62.9966%2021.7428%2063.9933%2021%2065.446%2021C66.9291%2021%2067.9088%2021.7254%2067.9088%2022.7514C67.9088%2023.4249%2067.527%2023.9798%2066.1047%2025.0896L65.0946%2025.9364V25.9769H68V27H63.0676Z'%20fill='%2324292E'%20fill-opacity='0.75'/%3e%3cpath%20d='M83.9067%2030C84.6011%2030%2089.9327%2026%2089.9327%2024C89.9327%2022%2084.7357%2018%2083.9067%2018C83.0778%2018%2082.4023%2018.5%2082.4023%2019.4756C82.4023%2020.4512%2085.9067%2022.9206%2085.9067%2022.9206C85.9067%2022.9206%2078.2539%2022.25%2078%2022.9206C77.7461%2023.5911%2077.7461%2024.4089%2078%2025.0794C78.2539%2025.75%2085.9067%2025.0794%2085.9067%2025.0794C85.9067%2025.0794%2082.4023%2027.75%2082.4023%2028.5301C82.4023%2029.3103%2083.2124%2030%2083.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M98%209.79083V21.75H113V8.75H98.6268C98.4606%208.75%2098.3011%208.85966%2098.1836%209.05485C98.066%209.25005%2098%209.51479%2098%209.79083Z'%20fill='url(%23paint2_linear_1248_126213)'/%3e%3cpath%20d='M113%2026.25H98V39.25H113V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.5%2029.75H105.072L103.5%2030.6699V31.9238L104.925%2031.1035H104.963V35.75H106.5V29.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M104.774%2018.25C105.526%2018.25%20106.046%2017.9877%20106.342%2017.4915H106.384V18.1678H108V14.8682C108%2013.841%20106.985%2013.25%20105.611%2013.25C104.16%2013.25%20103.337%2013.9074%20103.2%2014.7924L104.785%2014.8429C104.859%2014.5332%20105.143%2014.3436%20105.597%2014.3436C106.018%2014.3436%20106.285%2014.5269%20106.285%2014.8524V14.8682C106.285%2015.1653%20105.927%2015.2285%20105.006%2015.3012C103.914%2015.3834%20103%2015.7468%20103%2016.8214C103%2017.7822%20103.741%2018.25%20104.774%2018.25ZM105.305%2017.2386C104.908%2017.2386%20104.627%2017.068%20104.627%2016.7456C104.627%2016.4327%20104.901%2016.243%20105.389%2016.1767C105.709%2016.1356%20106.103%2016.0724%20106.296%2015.9807V16.4422C106.296%2016.9162%20105.853%2017.2386%20105.305%2017.2386Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126213)'%3e%3cpath%20d='M117%2021.75H132V9.79083C132%209.51479%20131.934%209.25005%20131.816%209.05485C131.699%208.85966%20131.539%208.75%20131.373%208.75H117V21.75Z'%20fill='url(%23paint3_linear_1248_126213)'/%3e%3cpath%20d='M132%2026.25H117V39.25H132V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M122%2018.4362H123.566V17.7145H123.615C123.816%2018.1261%20124.262%2018.5%20125.013%2018.5C126.113%2018.5%20127%2017.729%20127%2016.213C127%2014.642%20126.061%2013.9261%20125.023%2013.9261C124.236%2013.9261%20123.806%2014.3377%20123.615%2014.7464H123.583V12.5H122V18.4362ZM123.55%2016.2101C123.55%2015.4826%20123.887%2015.0333%20124.466%2015.0333C125.052%2015.0333%20125.375%2015.4942%20125.375%2016.2101C125.375%2016.929%20125.052%2017.3957%20124.466%2017.3957C123.887%2017.3957%20123.55%2016.9319%20123.55%2016.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M124.479%2035.75C125.808%2035.75%20126.753%2035.0257%20126.75%2034.0105C126.753%2033.2918%20126.296%2032.7785%20125.421%2032.673V32.6274C126.077%2032.5304%20126.542%2032.077%20126.54%2031.4211C126.542%2030.4686%20125.706%2029.75%20124.49%2029.75C123.266%2029.75%20122.375%2030.48%20122.364%2031.5181H123.673C123.684%2031.1188%20124.033%2030.8508%20124.49%2030.8508C124.925%2030.8508%20125.221%2031.1217%20125.219%2031.5124C125.221%2031.9173%20124.872%2032.1968%20124.368%2032.1968H123.817V33.2006H124.368C124.942%2033.2006%20125.316%2033.4914%20125.31%2033.9021C125.316%2034.3156%20124.972%2034.6036%20124.485%2034.6036C124%2034.6036%20123.643%2034.3384%20123.629%2033.9534H122.25C122.261%2035.0086%20123.183%2035.75%20124.479%2035.75Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126213'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126213'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126213'%20x1='98'%20y1='15.2552'%20x2='113'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126213'%20x1='117'%20y1='15.2552'%20x2='132'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126213'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126213'%3e%3crect%20width='12'%20height='12'%20fill='white'%20transform='translate(38%2018)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126213'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(117%208.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_43 = "data:image/svg+xml,%3csvg%20width='77'%20height='48'%20viewBox='0%200%2077%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126187)'%3e%3cpath%20d='M19%2023H34V13.8006C34%2013.5883%2033.934%2013.3847%2033.8164%2013.2345C33.6989%2013.0844%2033.5394%2013%2033.3732%2013H19V23Z'%20fill='url(%23paint0_linear_1248_126187)'/%3e%3cpath%20d='M43%2026H19V35.5H43V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2026H19V35.5H34V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2039H19V48.5H34V39Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2020.9362H25.5663V20.2145H25.6149C25.8155%2020.6261%2026.2621%2021%2027.0129%2021C28.1133%2021%2029%2020.229%2029%2018.713C29%2017.142%2028.0615%2016.4261%2027.0227%2016.4261C26.2362%2016.4261%2025.8058%2016.8377%2025.6149%2017.2464H25.5825V15H24V20.9362ZM25.5502%2018.7101C25.5502%2017.9826%2025.8867%2017.5333%2026.466%2017.5333C27.0518%2017.5333%2027.3754%2017.9942%2027.3754%2018.7101C27.3754%2019.429%2027.0518%2019.8957%2026.466%2019.8957C25.8867%2019.8957%2025.5502%2019.4319%2025.5502%2018.7101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126187)'%3e%3cpath%20d='M0%2013.8006V23H15V13H0.626828C0.460583%2013%200.301147%2013.0844%200.183594%2013.2345C0.0660407%2013.3847%200%2013.5883%200%2013.8006Z'%20fill='url(%23paint1_linear_1248_126187)'/%3e%3cpath%20d='M24%2026H0V35.5H24V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2026H0V35.5H15V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2039H0V48.5H15V39Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2028H7.07158L5.5%2028.9199V30.1738L6.92531%2029.3535H6.96266V34H8.5V28Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2046.5H9.75V45.3468H7.33409V45.3092L8.04722%2044.6561C9.33959%2043.5376%209.67723%2042.9682%209.67723%2042.289C9.67723%2041.2225%208.8011%2040.5%207.44761%2040.5C6.12905%2040.5%205.2471%2041.2543%205.25001%2042.4595H6.61514C6.61514%2041.9249%206.94696%2041.6156%207.44179%2041.6156C7.92788%2041.6156%208.28008%2041.9133%208.28008%2042.4017C8.28008%2042.8439%208.00065%2043.1445%207.51165%2043.5809L5.33733%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%2020.5C7.52635%2020.5%208.04638%2020.2377%208.34153%2019.7415H8.3837V20.4178H10V17.1182C10%2016.091%208.98454%2015.5%207.61068%2015.5C6.15952%2015.5%205.33732%2016.1574%205.20028%2017.0424L6.78496%2017.0929C6.85875%2016.7832%207.14336%2016.5936%207.59663%2016.5936C8.01827%2016.5936%208.28531%2016.7769%208.28531%2017.1024V17.1182C8.28531%2017.4153%207.92692%2017.4785%207.00633%2017.5512C5.91356%2017.6334%205%2017.9968%205%2019.0714C5%2020.0322%205.74139%2020.5%206.77442%2020.5ZM7.30499%2019.4886C6.90794%2019.4886%206.62684%2019.318%206.62684%2018.9956C6.62684%2018.6827%206.90091%2018.493%207.38932%2018.4267C7.70907%2018.3856%208.1026%2018.3224%208.29585%2018.2307V18.6922C8.29585%2019.1662%207.85313%2019.4886%207.30499%2019.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2036.5C48.6011%2036.5%2053.9327%2032.5%2053.9327%2030.5C53.9327%2028.5%2048.7357%2024.5%2047.9067%2024.5C47.0778%2024.5%2046.4023%2025%2046.4023%2025.9756C46.4023%2026.9512%2049.9067%2029.4206%2049.9067%2029.4206C49.9067%2029.4206%2042.2539%2028.75%2042%2029.4206C41.7461%2030.0911%2041.7461%2030.9089%2042%2031.5794C42.2539%2032.25%2049.9067%2031.5794%2049.9067%2031.5794C49.9067%2031.5794%2046.4023%2034.25%2046.4023%2035.0301C46.4023%2035.8103%2047.2124%2036.5%2047.9067%2036.5Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126187)'%3e%3cpath%20d='M62%2013.8006V23H77V13H62.6268C62.4606%2013%2062.3011%2013.0844%2062.1836%2013.2345C62.066%2013.3847%2062%2013.5883%2062%2013.8006Z'%20fill='url(%23paint2_linear_1248_126187)'/%3e%3cpath%20d='M86%2026H62V35.5H86V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2026H62V35.5H77V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2039H62V48.5H77V39Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M70.5%2028H69.0716L67.5%2028.9199V30.1738L68.9253%2029.3535H68.9627V34H70.5V28Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.3373%2046.5H71.75V45.3468H69.3341V45.3092L70.0472%2044.6561C71.3396%2043.5376%2071.6772%2042.9682%2071.6772%2042.289C71.6772%2041.2225%2070.8011%2040.5%2069.4476%2040.5C68.129%2040.5%2067.2471%2041.2543%2067.25%2042.4595H68.6151C68.6151%2041.9249%2068.947%2041.6156%2069.4418%2041.6156C69.9279%2041.6156%2070.2801%2041.9133%2070.2801%2042.4017C70.2801%2042.8439%2070.0006%2043.1445%2069.5116%2043.5809L67.3373%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7744%2020.5C69.5264%2020.5%2070.0464%2020.2377%2070.3415%2019.7415H70.3837V20.4178H72V17.1182C72%2016.091%2070.9845%2015.5%2069.6107%2015.5C68.1595%2015.5%2067.3373%2016.1574%2067.2003%2017.0424L68.785%2017.0929C68.8587%2016.7832%2069.1434%2016.5936%2069.5966%2016.5936C70.0183%2016.5936%2070.2853%2016.7769%2070.2853%2017.1024V17.1182C70.2853%2017.4153%2069.9269%2017.4785%2069.0063%2017.5512C67.9136%2017.6334%2067%2017.9968%2067%2019.0714C67%2020.0322%2067.7414%2020.5%2068.7744%2020.5ZM69.305%2019.4886C68.9079%2019.4886%2068.6268%2019.318%2068.6268%2018.9956C68.6268%2018.6827%2068.9009%2018.493%2069.3893%2018.4267C69.7091%2018.3856%2070.1026%2018.3224%2070.2959%2018.2307V18.6922C70.2959%2019.1662%2069.8531%2019.4886%2069.305%2019.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126187)'%3e%3cpath%20d='M29.675%200.75H22.325C21.9073%200.75%2021.5067%200.915937%2021.2113%201.21131C20.9159%201.50668%2020.75%201.90728%2020.75%202.325V2.93925C20.7499%203.15604%2020.7946%203.37052%2020.8813%203.56925V3.60075C20.9554%203.76926%2021.0605%203.9224%2021.191%204.05225L24.425%207.26525V10.725C24.4248%2010.8142%2024.4474%2010.902%2024.4906%2010.9801C24.5337%2011.0582%2024.5961%2011.124%2024.6717%2011.1712C24.7553%2011.223%2024.8517%2011.2503%2024.95%2011.25C25.0322%2011.2495%2025.1131%2011.2297%2025.1862%2011.1922L27.2862%2010.1422C27.3728%2010.0986%2027.4456%2010.0319%2027.4966%209.9494C27.5476%209.86693%2027.5747%209.77195%2027.575%209.675V7.26525L30.788%204.05225C30.9185%203.9224%2031.0236%203.76926%2031.0977%203.60075V3.56925C31.1916%203.37208%2031.2435%203.15753%2031.25%202.93925V2.325C31.25%201.90728%2031.0841%201.50668%2030.7887%201.21131C30.4933%200.915937%2030.0927%200.75%2029.675%200.75ZM26.6772%206.67725C26.6286%206.72631%2026.5901%206.78448%2026.564%206.84845C26.5378%206.91241%2026.5246%206.98091%2026.525%207.05V9.3495L25.475%209.8745V7.05C25.4754%206.98091%2025.4622%206.91241%2025.436%206.84845C25.4099%206.78448%2025.3714%206.72631%2025.3227%206.67725L22.5402%203.9H29.4597L26.6772%206.67725ZM30.2%202.85H21.8V2.325C21.8%202.18576%2021.8553%202.05223%2021.9538%201.95377C22.0522%201.85531%2022.1858%201.8%2022.325%201.8H29.675C29.8142%201.8%2029.9478%201.85531%2030.0462%201.95377C30.1447%202.05223%2030.2%202.18576%2030.2%202.325V2.85Z'%20fill='%2324292E'%20fill-opacity='0.75'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126187'%20x1='19'%20y1='18.004'%20x2='34'%20y2='18.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126187'%20x1='0'%20y1='18.004'%20x2='15'%20y2='18.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126187'%20x1='62'%20y1='18.004'%20x2='77'%20y2='18.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126187'%3e%3crect%20width='15'%20height='35'%20fill='white'%20transform='translate(19%2013)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126187'%3e%3crect%20width='15'%20height='35'%20fill='white'%20transform='translate(0%2013)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126187'%3e%3crect%20width='15'%20height='35'%20fill='white'%20transform='translate(62%2013)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126187'%3e%3crect%20width='12'%20height='12'%20fill='white'%20transform='translate(20)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_44 = "data:image/svg+xml,%3csvg%20width='58'%20height='48'%20viewBox='0%200%2058%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1811_57031)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M9.65%209.3H9.3V3.35C9.3%203.25717%209.26313%203.16815%209.19749%203.10251C9.13185%203.03687%209.04283%203%208.95%203H7.725C7.66392%203.00037%207.604%203.01672%207.5512%203.04742C7.49839%203.07812%207.45454%203.1221%207.424%203.175L3.8505%209.3H3.35C3.25717%209.3%203.16815%209.33687%203.10251%209.40251C3.03687%209.46815%203%209.55717%203%209.65C3%209.74283%203.03687%209.83185%203.10251%209.89749C3.16815%209.96313%203.25717%2010%203.35%2010H4.75C4.84283%2010%204.93185%209.96313%204.99749%209.89749C5.06313%209.83185%205.1%209.74283%205.1%209.65C5.1%209.55717%205.06313%209.46815%204.99749%209.40251C4.93185%209.33687%204.84283%209.3%204.75%209.3H4.659L5.884%207.2H8.6V9.3H8.25C8.15717%209.3%208.06815%209.33687%208.00251%209.40251C7.93687%209.46815%207.9%209.55717%207.9%209.65C7.9%209.74283%207.93687%209.83185%208.00251%209.89749C8.06815%209.96313%208.15717%2010%208.25%2010H9.65C9.74283%2010%209.83185%209.96313%209.89749%209.89749C9.96313%209.83185%2010%209.74283%2010%209.65C10%209.55717%209.96313%209.46815%209.89749%209.40251C9.83185%209.33687%209.74283%209.3%209.65%209.3ZM8.6%206.5H6.2935L7.9245%203.7H8.6V6.5Z'%20fill='white'/%3e%3cpath%20d='M6.84608%2027C7.52244%2027%207.9902%2026.7377%208.25569%2026.2415H8.29362V26.9178H9.74747V23.6182C9.74747%2022.591%208.83407%2022%207.59829%2022C6.29298%2022%205.55341%2022.6574%205.43015%2023.5424L6.85556%2023.5929C6.92193%2023.2832%207.17794%2023.0936%207.58565%2023.0936C7.96492%2023.0936%208.20512%2023.2769%208.20512%2023.6024V23.6182C8.20512%2023.9153%207.88274%2023.9785%207.05468%2024.0512C6.07174%2024.1334%205.25%2024.4968%205.25%2025.5714C5.25%2026.5322%205.91688%2027%206.84608%2027ZM7.32333%2025.9886C6.96618%2025.9886%206.71334%2025.818%206.71334%2025.4956C6.71334%2025.1827%206.95986%2024.993%207.39918%2024.9267C7.68679%2024.8856%208.04077%2024.8224%208.2146%2024.7307V25.1922C8.2146%2025.6662%207.81637%2025.9886%207.32333%2025.9886Z'%20fill='%2324292E'/%3e%3cpath%20d='M5%2044.4362H6.56634V43.7145H6.61489C6.81553%2044.1261%207.26214%2044.5%208.01294%2044.5C9.11327%2044.5%2010%2043.729%2010%2042.213C10%2040.642%209.06149%2039.9261%208.02265%2039.9261C7.23625%2039.9261%206.80583%2040.3377%206.61489%2040.7464H6.58252V38.5H5V44.4362ZM6.55016%2042.2101C6.55016%2041.4826%206.88673%2041.0333%207.46602%2041.0333C8.05178%2041.0333%208.3754%2041.4942%208.3754%2042.2101C8.3754%2042.929%208.05178%2043.3957%207.46602%2043.3957C6.88673%2043.3957%206.55016%2042.9319%206.55016%2042.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.9067%2030C29.6011%2030%2034.9327%2026%2034.9327%2024C34.9327%2022%2029.7357%2018%2028.9067%2018C28.0778%2018%2027.4023%2018.5%2027.4023%2019.4756C27.4023%2020.4512%2030.9067%2022.9206%2030.9067%2022.9206C30.9067%2022.9206%2023.2539%2022.25%2023%2022.9206C22.7461%2023.5911%2022.7461%2024.4089%2023%2025.0794C23.2539%2025.75%2030.9067%2025.0794%2030.9067%2025.0794C30.9067%2025.0794%2027.4023%2027.75%2027.4023%2028.5301C27.4023%2029.3103%2028.2124%2030%2028.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M43%201.04083V13H58V0H43.6268C43.4606%200%2043.3011%200.109659%2043.1836%200.304853C43.066%200.500047%2043%200.764787%2043%201.04083Z'%20fill='url(%23paint1_linear_1811_57031)'/%3e%3cpath%20d='M58%2017.5H43V30.5H58V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M58%2035H43V48H58V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52.65%209.3H52.3V3.35C52.3%203.25717%2052.2631%203.16815%2052.1975%203.10251C52.1318%203.03687%2052.0428%203%2051.95%203H50.725C50.6639%203.00037%2050.604%203.01672%2050.5512%203.04742C50.4984%203.07812%2050.4545%203.1221%2050.424%203.175L46.8505%209.3H46.35C46.2572%209.3%2046.1682%209.33687%2046.1025%209.40251C46.0369%209.46815%2046%209.55717%2046%209.65C46%209.74283%2046.0369%209.83185%2046.1025%209.89749C46.1682%209.96313%2046.2572%2010%2046.35%2010H47.75C47.8428%2010%2047.9318%209.96313%2047.9975%209.89749C48.0631%209.83185%2048.1%209.74283%2048.1%209.65C48.1%209.55717%2048.0631%209.46815%2047.9975%209.40251C47.9318%209.33687%2047.8428%209.3%2047.75%209.3H47.659L48.884%207.2H51.6V9.3H51.25C51.1572%209.3%2051.0682%209.33687%2051.0025%209.40251C50.9369%209.46815%2050.9%209.55717%2050.9%209.65C50.9%209.74283%2050.9369%209.83185%2051.0025%209.89749C51.0682%209.96313%2051.1572%2010%2051.25%2010H52.65C52.7428%2010%2052.8318%209.96313%2052.8975%209.89749C52.9631%209.83185%2053%209.74283%2053%209.65C53%209.55717%2052.9631%209.46815%2052.8975%209.40251C52.8318%209.33687%2052.7428%209.3%2052.65%209.3ZM51.6%206.5H49.2935L50.9245%203.7H51.6V6.5Z'%20fill='white'/%3e%3cpath%20d='M49.0114%2026.8182H47.5L49.4631%2021H51.3352L53.2983%2026.8182H51.7869L51.4034%2025.5966H49.3949L49.0114%2026.8182ZM49.7301%2024.5284H51.0682L50.4205%2022.4659H50.375L49.7301%2024.5284Z'%20fill='black'/%3e%3cpath%20d='M48.5%2044.8182V39H50.9261C52.233%2039%2052.9091%2039.5938%2052.9091%2040.4716C52.9091%2041.1364%2052.4602%2041.5994%2051.821%2041.733V41.7898C52.5256%2041.821%2053.1364%2042.3494%2053.1364%2043.1903C53.1364%2044.1307%2052.3977%2044.8182%2051.1108%2044.8182H48.5ZM49.9062%2043.6847H50.7756C51.3835%2043.6847%2051.6676%2043.4403%2051.6676%2043.0284C51.6676%2042.5824%2051.3381%2042.2983%2050.8011%2042.2983H49.9062V43.6847ZM49.9062%2041.392H50.6847C51.1449%2041.392%2051.4744%2041.1534%2051.4744%2040.7443C51.4744%2040.358%2051.1761%2040.1165%2050.7074%2040.1165H49.9062V41.392Z'%20fill='black'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1811_57031'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1811_57031'%20x1='43'%20y1='6.5052'%20x2='58'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_45 = "data:image/svg+xml,%3csvg%20width='122'%20height='48'%20viewBox='0%200%20122%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1706_105947)'%3e%3cpath%20d='M0%201.04083V13H54V0H2.25658C1.6581%200%200%200%200%200C0%200%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1706_105947)'/%3e%3cpath%20d='M54%2018H0V31H54V18Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M4.28977%2028.6364C3.95739%2028.6364%203.64773%2028.5824%203.4375%2028.4972L3.74432%2027.4886C4.15341%2027.6222%204.45455%2027.6165%204.58807%2027.2898L4.64205%2027.1591L3.09091%2022.6364H4.54545L5.34943%2025.75H5.39489L6.21023%2022.6364H7.6733L6.02841%2027.4176C5.78693%2028.1307%205.28977%2028.6364%204.28977%2028.6364ZM9.0554%2028.6364C8.72301%2028.6364%208.41335%2028.5824%208.20312%2028.4972L8.50994%2027.4886C8.91903%2027.6222%209.22017%2027.6165%209.35369%2027.2898L9.40767%2027.1591L7.85653%2022.6364H9.31108L10.1151%2025.75H10.1605L10.9759%2022.6364H12.4389L10.794%2027.4176C10.5526%2028.1307%2010.0554%2028.6364%209.0554%2028.6364ZM13.821%2028.6364C13.4886%2028.6364%2013.179%2028.5824%2012.9688%2028.4972L13.2756%2027.4886C13.6847%2027.6222%2013.9858%2027.6165%2014.1193%2027.2898L14.1733%2027.1591L12.6222%2022.6364H14.0767L14.8807%2025.75H14.9261L15.7415%2022.6364H17.2045L15.5597%2027.4176C15.3182%2028.1307%2014.821%2028.6364%2013.821%2028.6364ZM18.5866%2028.6364C18.2543%2028.6364%2017.9446%2028.5824%2017.7344%2028.4972L18.0412%2027.4886C18.4503%2027.6222%2018.7514%2027.6165%2018.8849%2027.2898L18.9389%2027.1591L17.3878%2022.6364H18.8423L19.6463%2025.75H19.6918L20.5071%2022.6364H21.9702L20.3253%2027.4176C20.0838%2028.1307%2019.5866%2028.6364%2018.5866%2028.6364ZM25.2955%2024.1108V25.1818H22.6023V24.1108H25.2955ZM26.2763%2027V22.6364H27.5973V23.4375H27.6456C27.8274%2022.9062%2028.282%2022.5795%2028.8786%2022.5795C29.4837%2022.5795%2029.9524%2022.9148%2030.0689%2023.4375H30.1143C30.2763%2022.9176%2030.7848%2022.5795%2031.4297%2022.5795C32.2536%2022.5795%2032.8217%2023.1392%2032.8217%2024.0625V27H31.4325V24.3807C31.4325%2023.946%2031.1825%2023.7102%2030.8303%2023.7102C30.4467%2023.7102%2030.2166%2023.9773%2030.2166%2024.3949V27H28.8814V24.3665C28.8814%2023.9631%2028.6428%2023.7102%2028.282%2023.7102C27.9183%2023.7102%2027.6655%2023.9858%2027.6655%2024.4176V27H26.2763ZM33.6825%2027V22.6364H35.0036V23.4375H35.0518C35.2337%2022.9062%2035.6882%2022.5795%2036.2848%2022.5795C36.8899%2022.5795%2037.3587%2022.9148%2037.4751%2023.4375H37.5206C37.6825%2022.9176%2038.1911%2022.5795%2038.8359%2022.5795C39.6598%2022.5795%2040.228%2023.1392%2040.228%2024.0625V27H38.8388V24.3807C38.8388%2023.946%2038.5888%2023.7102%2038.2365%2023.7102C37.853%2023.7102%2037.6229%2023.9773%2037.6229%2024.3949V27H36.2876V24.3665C36.2876%2023.9631%2036.049%2023.7102%2035.6882%2023.7102C35.3246%2023.7102%2035.0717%2023.9858%2035.0717%2024.4176V27H33.6825ZM43.8814%2024.1108V25.1818H41.1882V24.1108H43.8814ZM46.456%2027.0625C45.4929%2027.0625%2044.7116%2026.3068%2044.7116%2024.821C44.7116%2023.2812%2045.5384%2022.5795%2046.4503%2022.5795C47.1378%2022.5795%2047.5185%2022.983%2047.6832%2023.3835H47.7116V21.1818H49.1009V27H47.7259V26.2926H47.6832C47.5071%2026.696%2047.1151%2027.0625%2046.456%2027.0625ZM46.9389%2025.9801C47.4446%2025.9801%2047.7429%2025.5256%2047.7429%2024.8182C47.7429%2024.1051%2047.4474%2023.6648%2046.9389%2023.6648C46.4219%2023.6648%2046.1378%2024.1165%2046.1378%2024.8182C46.1378%2025.5227%2046.4247%2025.9801%2046.9389%2025.9801Z'%20fill='%2324292E'/%3e%3cpath%20d='M54%2035H0V48H54V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M5.28977%2045.6364C4.95739%2045.6364%204.64773%2045.5824%204.4375%2045.4972L4.74432%2044.4886C5.15341%2044.6222%205.45455%2044.6165%205.58807%2044.2898L5.64205%2044.1591L4.09091%2039.6364H5.54545L6.34943%2042.75H6.39489L7.21023%2039.6364H8.6733L7.02841%2044.4176C6.78693%2045.1307%206.28977%2045.6364%205.28977%2045.6364ZM10.0554%2045.6364C9.72301%2045.6364%209.41335%2045.5824%209.20312%2045.4972L9.50994%2044.4886C9.91903%2044.6222%2010.2202%2044.6165%2010.3537%2044.2898L10.4077%2044.1591L8.85653%2039.6364H10.3111L11.1151%2042.75H11.1605L11.9759%2039.6364H13.4389L11.794%2044.4176C11.5526%2045.1307%2011.0554%2045.6364%2010.0554%2045.6364ZM14.821%2045.6364C14.4886%2045.6364%2014.179%2045.5824%2013.9688%2045.4972L14.2756%2044.4886C14.6847%2044.6222%2014.9858%2044.6165%2015.1193%2044.2898L15.1733%2044.1591L13.6222%2039.6364H15.0767L15.8807%2042.75H15.9261L16.7415%2039.6364H18.2045L16.5597%2044.4176C16.3182%2045.1307%2015.821%2045.6364%2014.821%2045.6364ZM19.5866%2045.6364C19.2543%2045.6364%2018.9446%2045.5824%2018.7344%2045.4972L19.0412%2044.4886C19.4503%2044.6222%2019.7514%2044.6165%2019.8849%2044.2898L19.9389%2044.1591L18.3878%2039.6364H19.8423L20.6463%2042.75H20.6918L21.5071%2039.6364H22.9702L21.3253%2044.4176C21.0838%2045.1307%2020.5866%2045.6364%2019.5866%2045.6364ZM26.2955%2041.1108V42.1818H23.6023V41.1108H26.2955ZM27.2763%2044V39.6364H28.5973V40.4375H28.6456C28.8274%2039.9062%2029.282%2039.5795%2029.8786%2039.5795C30.4837%2039.5795%2030.9524%2039.9148%2031.0689%2040.4375H31.1143C31.2763%2039.9176%2031.7848%2039.5795%2032.4297%2039.5795C33.2536%2039.5795%2033.8217%2040.1392%2033.8217%2041.0625V44H32.4325V41.3807C32.4325%2040.946%2032.1825%2040.7102%2031.8303%2040.7102C31.4467%2040.7102%2031.2166%2040.9773%2031.2166%2041.3949V44H29.8814V41.3665C29.8814%2040.9631%2029.6428%2040.7102%2029.282%2040.7102C28.9183%2040.7102%2028.6655%2040.9858%2028.6655%2041.4176V44H27.2763ZM34.6825%2044V39.6364H36.0036V40.4375H36.0518C36.2337%2039.9062%2036.6882%2039.5795%2037.2848%2039.5795C37.8899%2039.5795%2038.3587%2039.9148%2038.4751%2040.4375H38.5206C38.6825%2039.9176%2039.1911%2039.5795%2039.8359%2039.5795C40.6598%2039.5795%2041.228%2040.1392%2041.228%2041.0625V44H39.8388V41.3807C39.8388%2040.946%2039.5888%2040.7102%2039.2365%2040.7102C38.853%2040.7102%2038.6229%2040.9773%2038.6229%2041.3949V44H37.2876V41.3665C37.2876%2040.9631%2037.049%2040.7102%2036.6882%2040.7102C36.3246%2040.7102%2036.0717%2040.9858%2036.0717%2041.4176V44H34.6825ZM44.8814%2041.1108V42.1818H42.1882V41.1108H44.8814ZM47.456%2044.0625C46.4929%2044.0625%2045.7116%2043.3068%2045.7116%2041.821C45.7116%2040.2812%2046.5384%2039.5795%2047.4503%2039.5795C48.1378%2039.5795%2048.5185%2039.983%2048.6832%2040.3835H48.7116V38.1818H50.1009V44H48.7259V43.2926H48.6832C48.5071%2043.696%2048.1151%2044.0625%2047.456%2044.0625ZM47.9389%2042.9801C48.4446%2042.9801%2048.7429%2042.5256%2048.7429%2041.8182C48.7429%2041.1051%2048.4474%2040.6648%2047.9389%2040.6648C47.4219%2040.6648%2047.1378%2041.1165%2047.1378%2041.8182C47.1378%2042.5227%2047.4247%2042.9801%2047.9389%2042.9801Z'%20fill='%2324292E'/%3e%3cpath%20d='M27%203C26.3078%203%2025.6311%203.20527%2025.0555%203.58986C24.4799%203.97444%2024.0313%204.52107%2023.7664%205.16061C23.5015%205.80015%2023.4322%206.50388%2023.5673%207.18282C23.7023%207.86175%2024.0356%208.48539%2024.5251%208.97487C25.0146%209.46436%2025.6383%209.7977%2026.3172%209.93275C26.9961%2010.0678%2027.6999%209.99848%2028.3394%209.73358C28.9789%209.46867%2029.5256%209.02007%2029.9101%208.44449C30.2947%207.86892%2030.5%207.19223%2030.5%206.5C30.5%206.04037%2030.4095%205.58525%2030.2336%205.16061C30.0577%204.73597%2029.7999%204.35013%2029.4749%204.02513C29.1499%203.70012%2028.764%203.44231%2028.3394%203.26642C27.9148%203.09053%2027.4596%203%2027%203V3ZM27%209.3C26.4462%209.3%2025.9049%209.13578%2025.4444%208.82811C24.9839%208.52045%2024.6251%208.08315%2024.4131%207.57151C24.2012%207.05988%2024.1458%206.49689%2024.2538%205.95375C24.3618%205.4106%2024.6285%204.91169%2025.0201%204.5201C25.4117%204.12851%2025.9106%203.86184%2026.4537%203.7538C26.9969%203.64576%2027.5599%203.70121%2028.0715%203.91314C28.5831%204.12506%2029.0204%204.48395%2029.3281%204.9444C29.6358%205.40486%2029.8%205.94621%2029.8%206.5C29.8%207.24261%2029.505%207.9548%2028.9799%208.4799C28.4548%209.005%2027.7426%209.3%2027%209.3V9.3ZM27%204.4C26.9072%204.4%2026.8182%204.43687%2026.7525%204.50251C26.6869%204.56815%2026.65%204.65717%2026.65%204.75V6.15H25.95C25.8572%206.15%2025.7682%206.18687%2025.7025%206.25251C25.6369%206.31815%2025.6%206.40717%2025.6%206.5C25.6%206.59283%2025.6369%206.68185%2025.7025%206.74749C25.7682%206.81312%2025.8572%206.85%2025.95%206.85H27C27.0928%206.85%2027.1819%206.81312%2027.2475%206.74749C27.3131%206.68185%2027.35%206.59283%2027.35%206.5V4.75C27.35%204.65717%2027.3131%204.56815%2027.2475%204.50251C27.1819%204.43687%2027.0928%204.4%2027%204.4Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M67.9067%2030C68.6011%2030%2073.9327%2026%2073.9327%2024C73.9327%2022%2068.7357%2018%2067.9067%2018C67.0778%2018%2066.4023%2018.5%2066.4023%2019.4756C66.4023%2020.4512%2069.9067%2022.9206%2069.9067%2022.9206C69.9067%2022.9206%2062.2539%2022.25%2062%2022.9206C61.7461%2023.5911%2061.7461%2024.4089%2062%2025.0794C62.2539%2025.75%2069.9067%2025.0794%2069.9067%2025.0794C69.9067%2025.0794%2066.4023%2027.75%2066.4023%2028.5301C66.4023%2029.3103%2067.2124%2030%2067.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M82%201.04083V13H122V0H83.6715H82V1.04083Z'%20fill='url(%23paint1_linear_1706_105947)'/%3e%3cpath%20d='M122%2018H82V31H122V18Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M88.4403%2027.5V23.1364H89.7614V23.9375H89.8097C89.9915%2023.4062%2090.446%2023.0795%2091.0426%2023.0795C91.6477%2023.0795%2092.1165%2023.4148%2092.233%2023.9375H92.2784C92.4403%2023.4176%2092.9489%2023.0795%2093.5938%2023.0795C94.4176%2023.0795%2094.9858%2023.6392%2094.9858%2024.5625V27.5H93.5966V24.8807C93.5966%2024.446%2093.3466%2024.2102%2092.9943%2024.2102C92.6108%2024.2102%2092.3807%2024.4773%2092.3807%2024.8949V27.5H91.0455V24.8665C91.0455%2024.4631%2090.8068%2024.2102%2090.446%2024.2102C90.0824%2024.2102%2089.8295%2024.4858%2089.8295%2024.9176V27.5H88.4403ZM95.8466%2027.5V23.1364H97.1676V23.9375H97.2159C97.3977%2023.4062%2097.8523%2023.0795%2098.4489%2023.0795C99.054%2023.0795%2099.5227%2023.4148%2099.6392%2023.9375H99.6847C99.8466%2023.4176%20100.355%2023.0795%20101%2023.0795C101.824%2023.0795%20102.392%2023.6392%20102.392%2024.5625V27.5H101.003V24.8807C101.003%2024.446%20100.753%2024.2102%20100.401%2024.2102C100.017%2024.2102%2099.7869%2024.4773%2099.7869%2024.8949V27.5H98.4517V24.8665C98.4517%2024.4631%2098.2131%2024.2102%2097.8523%2024.2102C97.4886%2024.2102%2097.2358%2024.4858%2097.2358%2024.9176V27.5H95.8466ZM106.045%2024.6108V25.6818H103.352V24.6108H106.045ZM108.62%2027.5625C107.657%2027.5625%20106.876%2026.8068%20106.876%2025.321C106.876%2023.7812%20107.702%2023.0795%20108.614%2023.0795C109.302%2023.0795%20109.683%2023.483%20109.847%2023.8835H109.876V21.6818H111.265V27.5H109.89V26.7926H109.847C109.671%2027.196%20109.279%2027.5625%20108.62%2027.5625ZM109.103%2026.4801C109.609%2026.4801%20109.907%2026.0256%20109.907%2025.3182C109.907%2024.6051%20109.612%2024.1648%20109.103%2024.1648C108.586%2024.1648%20108.302%2024.6165%20108.302%2025.3182C108.302%2026.0227%20108.589%2026.4801%20109.103%2026.4801ZM113.737%2027.5625C112.774%2027.5625%20111.993%2026.8068%20111.993%2025.321C111.993%2023.7812%20112.82%2023.0795%20113.732%2023.0795C114.419%2023.0795%20114.8%2023.483%20114.964%2023.8835H114.993V21.6818H116.382V27.5H115.007V26.7926H114.964C114.788%2027.196%20114.396%2027.5625%20113.737%2027.5625ZM114.22%2026.4801C114.726%2026.4801%20115.024%2026.0256%20115.024%2025.3182C115.024%2024.6051%20114.729%2024.1648%20114.22%2024.1648C113.703%2024.1648%20113.419%2024.6165%20113.419%2025.3182C113.419%2026.0227%20113.706%2026.4801%20114.22%2026.4801Z'%20fill='%2324292E'/%3e%3cpath%20d='M122%2035H82V48H122V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M102%203C101.308%203%20100.631%203.20527%20100.056%203.58986C99.4799%203.97444%2099.0313%204.52107%2098.7664%205.16061C98.5015%205.80015%2098.4322%206.50388%2098.5673%207.18282C98.7023%207.86175%2099.0356%208.48539%2099.5251%208.97487C100.015%209.46436%20100.638%209.7977%20101.317%209.93275C101.996%2010.0678%20102.7%209.99848%20103.339%209.73358C103.979%209.46867%20104.526%209.02007%20104.91%208.44449C105.295%207.86892%20105.5%207.19223%20105.5%206.5C105.5%206.04037%20105.409%205.58525%20105.234%205.16061C105.058%204.73597%20104.8%204.35013%20104.475%204.02513C104.15%203.70012%20103.764%203.44231%20103.339%203.26642C102.915%203.09053%20102.46%203%20102%203V3ZM102%209.3C101.446%209.3%20100.905%209.13578%20100.444%208.82811C99.9839%208.52045%2099.6251%208.08315%2099.4131%207.57151C99.2012%207.05988%2099.1458%206.49689%2099.2538%205.95375C99.3618%205.4106%2099.6285%204.91169%20100.02%204.5201C100.412%204.12851%20100.911%203.86184%20101.454%203.7538C101.997%203.64576%20102.56%203.70121%20103.072%203.91314C103.583%204.12506%20104.02%204.48395%20104.328%204.9444C104.636%205.40486%20104.8%205.94621%20104.8%206.5C104.8%207.24261%20104.505%207.9548%20103.98%208.4799C103.455%209.005%20102.743%209.3%20102%209.3V9.3ZM102%204.4C101.907%204.4%20101.818%204.43687%20101.753%204.50251C101.687%204.56815%20101.65%204.65717%20101.65%204.75V6.15H100.95C100.857%206.15%20100.768%206.18687%20100.703%206.25251C100.637%206.31815%20100.6%206.40717%20100.6%206.5C100.6%206.59283%20100.637%206.68185%20100.703%206.74749C100.768%206.81312%20100.857%206.85%20100.95%206.85H102C102.093%206.85%20102.182%206.81312%20102.247%206.74749C102.313%206.68185%20102.35%206.59283%20102.35%206.5V4.75C102.35%204.65717%20102.313%204.56815%20102.247%204.50251C102.182%204.43687%20102.093%204.4%20102%204.4Z'%20fill='white'/%3e%3cpath%20d='M93.2898%2045.6364C92.9574%2045.6364%2092.6477%2045.5824%2092.4375%2045.4972L92.7443%2044.4886C93.1534%2044.6222%2093.4545%2044.6165%2093.5881%2044.2898L93.642%2044.1591L92.0909%2039.6364H93.5455L94.3494%2042.75H94.3949L95.2102%2039.6364H96.6733L95.0284%2044.4176C94.7869%2045.1307%2094.2898%2045.6364%2093.2898%2045.6364ZM98.0554%2045.6364C97.723%2045.6364%2097.4134%2045.5824%2097.2031%2045.4972L97.5099%2044.4886C97.919%2044.6222%2098.2202%2044.6165%2098.3537%2044.2898L98.4077%2044.1591L96.8565%2039.6364H98.3111L99.1151%2042.75H99.1605L99.9759%2039.6364H101.439L99.794%2044.4176C99.5526%2045.1307%2099.0554%2045.6364%2098.0554%2045.6364ZM102.821%2045.6364C102.489%2045.6364%20102.179%2045.5824%20101.969%2045.4972L102.276%2044.4886C102.685%2044.6222%20102.986%2044.6165%20103.119%2044.2898L103.173%2044.1591L101.622%2039.6364H103.077L103.881%2042.75H103.926L104.741%2039.6364H106.205L104.56%2044.4176C104.318%2045.1307%20103.821%2045.6364%20102.821%2045.6364ZM107.587%2045.6364C107.254%2045.6364%20106.945%2045.5824%20106.734%2045.4972L107.041%2044.4886C107.45%2044.6222%20107.751%2044.6165%20107.885%2044.2898L107.939%2044.1591L106.388%2039.6364H107.842L108.646%2042.75H108.692L109.507%2039.6364H110.97L109.325%2044.4176C109.084%2045.1307%20108.587%2045.6364%20107.587%2045.6364Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1706_105947'%20x1='0'%20y1='6.5052'%20x2='54'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1706_105947'%20x1='82'%20y1='6.5052'%20x2='122'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1706_105947'%3e%3crect%20width='54'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_46 = "data:image/svg+xml,%3csvg%20width='78'%20height='51'%20viewBox='0%200%2078%2051'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126371)'%3e%3cpath%20d='M2%200.800642V10H26V1.05456e-06H3.00292L2.0002%200L2%200.800642Z'%20fill='url(%23paint0_linear_1248_126371)'/%3e%3cpath%20d='M26%2013H2V22.5H26V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2025.75H2V35.25H26V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2038.5H2V48H26V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15.5%2014.75H14.0716L12.5%2015.6699V16.9238L13.9253%2016.1035H13.9627V20.75H15.5V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2033.5H16.5V32.3468H14.0841V32.3092L14.7972%2031.6561C16.0896%2030.5376%2016.4272%2029.9682%2016.4272%2029.289C16.4272%2028.2225%2015.5511%2027.5%2014.1976%2027.5C12.879%2027.5%2011.9971%2028.2543%2012%2029.4595H13.3651C13.3651%2028.9249%2013.697%2028.6156%2014.1918%2028.6156C14.6779%2028.6156%2015.0301%2028.9133%2015.0301%2029.4017C15.0301%2029.8439%2014.7506%2030.1445%2014.2616%2030.5809L12.0873%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2046.5H16.5V45.3468H14.0841V45.3092L14.7972%2044.6561C16.0896%2043.5376%2016.4272%2042.9682%2016.4272%2042.289C16.4272%2041.2225%2015.5511%2040.5%2014.1976%2040.5C12.879%2040.5%2011.9971%2041.2543%2012%2042.4595H13.3651C13.3651%2041.9249%2013.697%2041.6156%2014.1918%2041.6156C14.6779%2041.6156%2015.0301%2041.9133%2015.0301%2042.4017C15.0301%2042.8439%2014.7506%2043.1445%2014.2616%2043.5809L12.0873%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M39.9067%2030C40.6011%2030%2045.9327%2026%2045.9327%2024C45.9327%2022%2040.7357%2018%2039.9067%2018C39.0778%2018%2038.4023%2018.5%2038.4023%2019.4756C38.4023%2020.4512%2041.9067%2022.9206%2041.9067%2022.9206C41.9067%2022.9206%2034.2539%2022.25%2034%2022.9206C33.7461%2023.5911%2033.7461%2024.4089%2034%2025.0794C34.2539%2025.75%2041.9067%2025.0794%2041.9067%2025.0794C41.9067%2025.0794%2038.4023%2027.75%2038.4023%2028.5301C38.4023%2029.3103%2039.2124%2030%2039.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_126371)'%3e%3cpath%20d='M54%200.800642V10H78V1.13097e-06H55.0029C54.7369%201.13097e-06%2054.0001%200%2054.0001%200C54.0001%200%2054%200.588299%2054%200.800642Z'%20fill='url(%23paint1_linear_1248_126371)'/%3e%3cpath%20d='M78%2013H54V29H78V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M78%2032H54V48H78V32Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M67.5%2018H66.0716L64.5%2018.9199V20.1738L65.9253%2019.3535H65.9627V24H67.5V18Z'%20fill='%2324292E'/%3e%3cpath%20d='M64.0873%2043H68.5V41.8468H66.0841V41.8092L66.7972%2041.1561C68.0896%2040.0376%2068.4272%2039.4682%2068.4272%2038.789C68.4272%2037.7225%2067.5511%2037%2066.1976%2037C64.879%2037%2063.9971%2037.7543%2064%2038.9595H65.3651C65.3651%2038.4249%2065.697%2038.1156%2066.1918%2038.1156C66.6779%2038.1156%2067.0301%2038.4133%2067.0301%2038.9017C67.0301%2039.3439%2066.7506%2039.6445%2066.2616%2040.0809L64.0873%2041.9711V43Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26%2025.7421H2V48H26V25.7421ZM0%2023.6179V50H28V23.6179L0%2023.6179Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126371'%20x1='2.00781'%20y1='5.004'%20x2='26.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126371'%20x1='54.001'%20y1='5.004'%20x2='78.001'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126371'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(2)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126371'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(54)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_47 = "data:image/svg+xml,%3csvg%20width='77'%20height='50'%20viewBox='0%200%2077%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126389)'%3e%3cpath%20d='M2%200.800642V10H26V1.05456e-06H3.00292L2.0002%200L2%200.800642Z'%20fill='url(%23paint0_linear_1248_126389)'/%3e%3cpath%20d='M26%2013H2V22.5H26V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2025.75H2V35.25H26V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26%2038.5H2V48H26V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15.5%2014.75H14.0716L12.5%2015.6699V16.9238L13.9253%2016.1035H13.9627V20.75H15.5V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2033.5H16.5V32.3468H14.0841V32.3092L14.7972%2031.6561C16.0896%2030.5376%2016.4272%2029.9682%2016.4272%2029.289C16.4272%2028.2225%2015.5511%2027.5%2014.1976%2027.5C12.879%2027.5%2011.9971%2028.2543%2012%2029.4595H13.3651C13.3651%2028.9249%2013.697%2028.6156%2014.1918%2028.6156C14.6779%2028.6156%2015.0301%2028.9133%2015.0301%2029.4017C15.0301%2029.8439%2014.7506%2030.1445%2014.2616%2030.5809L12.0873%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M12.0873%2046.5H16.5V45.3468H14.0841V45.3092L14.7972%2044.6561C16.0896%2043.5376%2016.4272%2042.9682%2016.4272%2042.289C16.4272%2041.2225%2015.5511%2040.5%2014.1976%2040.5C12.879%2040.5%2011.9971%2041.2543%2012%2042.4595H13.3651C13.3651%2041.9249%2013.697%2041.6156%2014.1918%2041.6156C14.6779%2041.6156%2015.0301%2041.9133%2015.0301%2042.4017C15.0301%2042.8439%2014.7506%2043.1445%2014.2616%2043.5809L12.0873%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M38.9067%2030C39.6011%2030%2044.9327%2026%2044.9327%2024C44.9327%2022%2039.7357%2018%2038.9067%2018C38.0778%2018%2037.4023%2018.5%2037.4023%2019.4756C37.4023%2020.4512%2040.9067%2022.9206%2040.9067%2022.9206C40.9067%2022.9206%2033.2539%2022.25%2033%2022.9206C32.7461%2023.5911%2032.7461%2024.4089%2033%2025.0794C33.2539%2025.75%2040.9067%2025.0794%2040.9067%2025.0794C40.9067%2025.0794%2037.4023%2027.75%2037.4023%2028.5301C37.4023%2029.3103%2038.2124%2030%2038.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_126389)'%3e%3cpath%20d='M63.7933%207.6179C64.5533%207.6179%2065.0788%207.32315%2065.3771%206.76562H65.4197V7.52557H67.0533V3.81818C67.0533%202.66406%2066.027%202%2064.6385%202C63.1719%202%2062.3409%202.73864%2062.2024%203.73295L63.804%203.78977C63.8786%203.44176%2064.1662%203.22869%2064.6243%203.22869C65.0504%203.22869%2065.3203%203.43466%2065.3203%203.80043V3.81818C65.3203%204.15199%2064.9581%204.22301%2064.0277%204.30469C62.9233%204.39702%2062%204.8054%2062%206.01278C62%207.09233%2062.7493%207.6179%2063.7933%207.6179ZM64.3295%206.48153C63.9283%206.48153%2063.6442%206.28977%2063.6442%205.92756C63.6442%205.57599%2063.9212%205.36293%2064.4148%205.28835C64.7379%205.24219%2065.1357%205.17116%2065.331%205.06818V5.58665C65.331%206.11932%2064.8835%206.48153%2064.3295%206.48153Z'%20fill='%2324292E'/%3e%3cpath%20d='M53%200.800642V10H77V1.13097e-06H54.0029C53.7369%201.13097e-06%2053.0001%200%2053.0001%200C53.0001%200%2053%200.588299%2053%200.800642Z'%20fill='url(%23paint1_linear_1248_126389)'/%3e%3cpath%20d='M77%2013H53V29H77V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2032H53V48H77V32Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M67%2017H65.0954L63%2018.2266V19.8984L64.9004%2018.8047H64.9502V25H67V17Z'%20fill='%2324292E'/%3e%3cpath%20d='M61.6524%2038.202H61.2683C61.0645%2038.202%2060.8691%2038.1207%2060.725%2037.9759C60.5809%2037.8311%2060.5%2037.6347%2060.5%2037.43C60.5%2037.2253%2060.5809%2037.0289%2060.725%2036.8841C60.8691%2036.7393%2061.0645%2036.658%2061.2683%2036.658H61.6524V36.272C61.6524%2036.0673%2061.7334%2035.8709%2061.8775%2035.7261C62.0216%2035.5813%2062.217%2035.5%2062.4207%2035.5C62.6245%2035.5%2062.8199%2035.5813%2062.964%2035.7261C63.1081%2035.8709%2063.189%2036.0673%2063.189%2036.272V36.658H63.5732C63.7769%2036.658%2063.9724%2036.7393%2064.1164%2036.8841C64.2605%2037.0289%2064.3415%2037.2253%2064.3415%2037.43C64.3415%2037.6347%2064.2605%2037.8311%2064.1164%2037.9759C63.9724%2038.1207%2063.7769%2038.202%2063.5732%2038.202H63.189V38.588C63.189%2038.7927%2063.1081%2038.9891%2062.964%2039.1339C62.8199%2039.2787%2062.6245%2039.36%2062.4207%2039.36C62.217%2039.36%2062.0216%2039.2787%2061.8775%2039.1339C61.7334%2038.9891%2061.6524%2038.7927%2061.6524%2038.588V38.202Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7317%2042.184H66.4268C66.2231%2042.184%2066.0276%2042.1027%2065.8836%2041.9579C65.7395%2041.8131%2065.6585%2041.6167%2065.6585%2041.412C65.6585%2041.2073%2065.7395%2041.0109%2065.8836%2040.8661C66.0276%2040.7213%2066.2231%2040.64%2066.4268%2040.64H68.7317C68.9355%2040.64%2069.1309%2040.7213%2069.275%2040.8661C69.4191%2041.0109%2069.5%2041.2073%2069.5%2041.412C69.5%2041.6167%2069.4191%2041.8131%2069.275%2041.9579C69.1309%2042.1027%2068.9355%2042.184%2068.7317%2042.184Z'%20fill='%2324292E'/%3e%3cpath%20d='M66.4268%2036.658H68.7317C68.9355%2036.658%2069.1309%2036.7393%2069.275%2036.8841C69.4191%2037.0289%2069.5%2037.2253%2069.5%2037.43C69.5%2037.6347%2069.4191%2037.8311%2069.275%2037.9759C69.1309%2038.1207%2068.9355%2038.202%2068.7317%2038.202H66.4268C66.2231%2038.202%2066.0276%2038.1207%2065.8836%2037.9759C65.7395%2037.8311%2065.6585%2037.6347%2065.6585%2037.43C65.6585%2037.2253%2065.7395%2037.0289%2065.8836%2036.8841C66.0276%2036.7393%2066.2231%2036.658%2066.4268%2036.658Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7317%2044.5H66.4268C66.2231%2044.5%2066.0276%2044.4187%2065.8836%2044.2739C65.7395%2044.1291%2065.6585%2043.9328%2065.6585%2043.728C65.6585%2043.5233%2065.7395%2043.3269%2065.8836%2043.1821C66.0276%2043.0373%2066.2231%2042.956%2066.4268%2042.956H68.7317C68.9355%2042.956%2069.1309%2043.0373%2069.275%2043.1821C69.4191%2043.3269%2069.5%2043.5233%2069.5%2043.728C69.5%2043.9328%2069.4191%2044.1291%2069.275%2044.2739C69.1309%2044.4187%2068.9355%2044.5%2068.7317%2044.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M61.2651%2044.5C61.0621%2044.5%2060.8674%2044.4193%2060.7234%2044.2755C60.5803%2044.1309%2060.5%2043.9352%2060.5%2043.7312C60.5%2043.5273%2060.5803%2043.3316%2060.7234%2043.187L61.2689%2042.6389L60.7234%2042.0907C60.5975%2041.9431%2060.5318%2041.7531%2060.5392%2041.5588C60.5467%2041.3645%2060.6269%2041.1802%2060.7637%2041.0427C60.9005%2040.9052%2061.084%2040.8247%2061.2773%2040.8172C61.4707%2040.8097%2061.6597%2040.8758%2061.8067%2041.0022L62.3522%2041.5503L62.8977%2041.0022C63.0447%2040.8758%2063.2337%2040.8097%2063.4271%2040.8172C63.6204%2040.8247%2063.8039%2040.9052%2063.9407%2041.0427C64.0775%2041.1802%2064.1577%2041.3645%2064.1652%2041.5588C64.1726%2041.7531%2064.1069%2041.9431%2063.981%2042.0907L63.4355%2042.6389L63.981%2043.187C64.1241%2043.3316%2064.2044%2043.5273%2064.2044%2043.7312C64.2044%2043.9352%2064.1241%2044.1309%2063.981%2044.2755C63.837%2044.4193%2063.6423%2044.5%2063.4393%2044.5C63.2364%2044.5%2063.0416%2044.4193%2062.8977%2044.2755L62.3522%2043.7274L61.8067%2044.2755C61.6628%2044.4193%2061.468%2044.5%2061.2651%2044.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26%2025.75H2V47.9532H26V25.75ZM0%2023.7887V50H28V23.7887L0%2023.7887Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126389'%20x1='2.00781'%20y1='5.004'%20x2='26.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126389'%20x1='53.001'%20y1='5.004'%20x2='77.001'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126389'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(2)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126389'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(53)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_48 = "data:image/svg+xml,%3csvg%20width='106'%20height='50'%20viewBox='0%200%20106%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1899_521)'%3e%3cpath%20d='M0%200.800641V10H24V1.05456e-06H1.00292L0.000198677%200L0%200.800641Z'%20fill='url(%23paint0_linear_1899_521)'/%3e%3cpath%20d='M24%2013H0V22.5H24V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2025.75H0V35.25H24V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2038.5H0V48H24V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13%2014.6179H11.5716L10%2015.5378V16.7917L11.4253%2015.9714H11.4627V20.6179H13V14.6179Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2033.5H14.25V32.3468H11.8341V32.3092L12.5472%2031.6561C13.8396%2030.5376%2014.1772%2029.9682%2014.1772%2029.289C14.1772%2028.2225%2013.3011%2027.5%2011.9476%2027.5C10.629%2027.5%209.7471%2028.2543%209.75001%2029.4595H11.1151C11.1151%2028.9249%2011.447%2028.6156%2011.9418%2028.6156C12.4279%2028.6156%2012.7801%2028.9133%2012.7801%2029.4017C12.7801%2029.8439%2012.5006%2030.1445%2012.0116%2030.5809L9.83733%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2046.25H14.25V45.0968H11.8341V45.0592L12.5472%2044.4061C13.8396%2043.2876%2014.1772%2042.7182%2014.1772%2042.039C14.1772%2040.9725%2013.3011%2040.25%2011.9476%2040.25C10.629%2040.25%209.7471%2041.0043%209.75001%2042.2095H11.1151C11.1151%2041.6749%2011.447%2041.3656%2011.9418%2041.3656C12.4279%2041.3656%2012.7801%2041.6633%2012.7801%2042.1517C12.7801%2042.5939%2012.5006%2042.8945%2012.0116%2043.3309L9.83733%2045.2211V46.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1899_521)'%3e%3cpath%20d='M28%200.800641V10H52V1.05456e-06H29.0029L28.0002%200L28%200.800641Z'%20fill='url(%23paint1_linear_1899_521)'/%3e%3cpath%20d='M52%2013H28V22.5H52V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2025.75H28V35.25H52V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2038.5H28V48H52V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M39.9792%2020.875C41.3085%2020.875%2042.2528%2020.1507%2042.25%2019.1355C42.2528%2018.4168%2041.7958%2017.9035%2040.9208%2017.798V17.7524C41.5771%2017.6554%2042.0423%2017.202%2042.0395%2016.5461C42.0423%2015.5936%2041.206%2014.875%2039.9903%2014.875C38.7663%2014.875%2037.8746%2015.605%2037.8635%2016.6431H39.1734C39.1845%2016.2438%2039.5334%2015.9758%2039.9903%2015.9758C40.4251%2015.9758%2040.7214%2016.2467%2040.7186%2016.6374C40.7214%2017.0423%2040.3725%2017.3218%2039.8685%2017.3218H39.3174V18.3256H39.8685C40.4417%2018.3256%2040.8155%2018.6164%2040.81%2019.0271C40.8155%2019.4406%2040.4721%2019.7286%2039.9848%2019.7286C39.5001%2019.7286%2039.1429%2019.4634%2039.1291%2019.0784H37.75C37.7611%2020.1336%2038.6832%2020.875%2039.9792%2020.875Z'%20fill='%2324292E'/%3e%3cpath%20d='M37.5%2032.4453V31.4463L40.0893%2027.5H41.7308V31.4287H42.5V32.4453H41.7308V33.5H40.477V32.4453H37.5ZM40.5012%2031.4287V28.8828H40.4528L38.8204%2031.3818V31.4287H40.5012Z'%20fill='%2324292E'/%3e%3cpath%20d='M40.2102%2046.25C38.8025%2046.25%2037.7766%2045.5188%2037.75%2044.4957H39.1444C39.1776%2044.9552%2039.6391%2045.2673%2040.2102%2045.2673C40.8841%2045.2673%2041.3655%2044.8425%2041.3655%2044.2269C41.3655%2043.6055%2040.8742%2043.1749%2040.1902%2043.172C39.7885%2043.172%2039.3835%2043.3251%2039.1743%2043.5708L37.8961%2043.3714L38.2181%2040.25H42.3748V41.2731H39.4034L39.2274%2042.7558H39.2673C39.5063%2042.4639%2040.0209%2042.2471%2040.6185%2042.2471C41.8436%2042.2471%2042.7533%2043.0621%2042.75%2044.1951C42.7533%2045.3916%2041.7241%2046.25%2040.2102%2046.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M80%200.800641V10H104V1.05456e-06H81.0029L80.0002%200L80%200.800641Z'%20fill='url(%23paint2_linear_1899_521)'/%3e%3cpath%20d='M104%2017H80V24H104V17Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M104%2033H80V40H104V33Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M104%2041H80V48H104V41Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M91.8577%2023C92.9654%2023%2093.7523%2022.3964%2093.75%2021.5504C93.7523%2020.9515%2093.3715%2020.5238%2092.6423%2020.4358V20.3978C93.1892%2020.317%2093.5769%2019.9392%2093.5746%2019.3926C93.5769%2018.5989%2092.88%2018%2091.8669%2018C90.8469%2018%2090.1038%2018.6084%2090.0946%2019.4734H91.1862C91.1954%2019.1407%2091.4861%2018.9173%2091.8669%2018.9173C92.2292%2018.9173%2092.4761%2019.1431%2092.4738%2019.4686C92.4761%2019.8061%2092.1854%2020.039%2091.7654%2020.039H91.3062V20.8755H91.7654C92.2431%2020.8755%2092.5546%2021.1179%2092.55%2021.4601C92.5546%2021.8047%2092.2685%2022.0447%2091.8623%2022.0447C91.4585%2022.0447%2091.1608%2021.8237%2091.1492%2021.5029H90C90.0092%2022.3821%2090.7777%2023%2091.8577%2023Z'%20fill='%2324292E'/%3e%3cpath%20d='M90%2038.1211V37.2886L92.1578%2034H93.5256V37.2739H94.1667V38.1211H93.5256V39H92.4808V38.1211H90ZM92.501%2037.2739V35.1523H92.4606L91.1003%2037.2349V37.2739H92.501Z'%20fill='%2324292E'/%3e%3cpath%20d='M92.0501%2047C90.877%2047%2090.0221%2046.3907%2090%2045.5381H91.162C91.1897%2045.921%2091.5743%2046.1811%2092.0501%2046.1811C92.6118%2046.1811%2093.0129%2045.8271%2093.0129%2045.3141C93.0129%2044.7962%2092.6035%2044.4374%2092.0335%2044.435C91.6988%2044.435%2091.3612%2044.5626%2091.1869%2044.7673L90.1217%2044.6012L90.3901%2042H93.854V42.8526H91.3778L91.2312%2044.0881H91.2644C91.4636%2043.8449%2091.8924%2043.6643%2092.3904%2043.6643C93.4113%2043.6643%2094.1694%2044.3434%2094.1667%2045.2876C94.1694%2046.2847%2093.3117%2047%2092.0501%2047Z'%20fill='%2324292E'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M104%2033H80V47.579H104V33ZM78%2028V50H106V28L78%2028Z'%20fill='%2324292E'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M104%2017H80V24H104V17ZM78%2012V26H106V12H78Z'%20fill='%2324292E'/%3e%3cpath%20d='M65.9067%2031.75C66.6011%2031.75%2071.9327%2027.75%2071.9327%2025.75C71.9327%2023.75%2066.7357%2019.75%2065.9067%2019.75C65.0777%2019.75%2064.4023%2020.25%2064.4023%2021.2256C64.4023%2022.2012%2067.9067%2024.6706%2067.9067%2024.6706C67.9067%2024.6706%2060.2539%2024%2060%2024.6706C59.7461%2025.3411%2059.7461%2026.1589%2060%2026.8294C60.2539%2027.5%2067.9067%2026.8294%2067.9067%2026.8294C67.9067%2026.8294%2064.4023%2029.5%2064.4023%2030.2801C64.4023%2031.0603%2065.2123%2031.75%2065.9067%2031.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M81.25%2013H80.1787L79%2013.6899V14.6304L80.069%2014.0151H80.097V17.5H81.25V13Z'%20fill='white'/%3e%3cpath%20d='M79.0655%2033.5H82.375V32.6351H80.5631V32.6069L81.0979%2032.1171C82.0672%2031.2782%2082.3204%2030.8512%2082.3204%2030.3418C82.3204%2029.5419%2081.6633%2029%2080.6482%2029C79.6593%2029%2078.9978%2029.5658%2079%2030.4697H80.0239C80.0239%2030.0686%2080.2727%2029.8367%2080.6438%2029.8367C81.0084%2029.8367%2081.2726%2030.06%2081.2726%2030.4263C81.2726%2030.7579%2081.063%2030.9834%2080.6962%2031.3107L79.0655%2032.7283V33.5Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1899_521'%20x1='0.00781255'%20y1='5.004'%20x2='24.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1899_521'%20x1='28.0078'%20y1='5.004'%20x2='52.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1899_521'%20x1='80.0078'%20y1='5.004'%20x2='104.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1899_521'%3e%3crect%20width='24'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1899_521'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(28)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_49 = "data:image/svg+xml,%3csvg%20width='188'%20height='48'%20viewBox='0%200%20188%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126059)'%3e%3cpath%20d='M0%200.800641V10H24V1.05456e-06H1.00292L0.000198677%200L0%200.800641Z'%20fill='url(%23paint0_linear_1248_126059)'/%3e%3cpath%20d='M24%2013H0V22.5H24V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2025.75H0V35.25H24V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2038.5H0V48H24V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13%2014.6179H11.5716L10%2015.5378V16.7917L11.4253%2015.9714H11.4627V20.6179H13V14.6179Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2033.5H14.25V32.3468H11.8341V32.3092L12.5472%2031.6561C13.8396%2030.5376%2014.1772%2029.9682%2014.1772%2029.289C14.1772%2028.2225%2013.3011%2027.5%2011.9476%2027.5C10.629%2027.5%209.7471%2028.2543%209.75001%2029.4595H11.1151C11.1151%2028.9249%2011.447%2028.6156%2011.9418%2028.6156C12.4279%2028.6156%2012.7801%2028.9133%2012.7801%2029.4017C12.7801%2029.8439%2012.5006%2030.1445%2012.0116%2030.5809L9.83733%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2046.25H14.25V45.0968H11.8341V45.0592L12.5472%2044.4061C13.8396%2043.2876%2014.1772%2042.7182%2014.1772%2042.039C14.1772%2040.9725%2013.3011%2040.25%2011.9476%2040.25C10.629%2040.25%209.7471%2041.0043%209.75001%2042.2095H11.1151C11.1151%2041.6749%2011.447%2041.3656%2011.9418%2041.3656C12.4279%2041.3656%2012.7801%2041.6633%2012.7801%2042.1517C12.7801%2042.5939%2012.5006%2042.8945%2012.0116%2043.3309L9.83733%2045.2211V46.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126059)'%3e%3cpath%20d='M28%200.800641V10H52V1.05456e-06H29.0029L28.0002%200L28%200.800641Z'%20fill='url(%23paint1_linear_1248_126059)'/%3e%3cpath%20d='M52%2013H28V22.5H52V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2025.75H28V35.25H52V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M52%2038.5H28V48H52V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M40.1058%2046.25C41.5564%2046.25%2042.4563%2045.4582%2042.5%2044.2595H40.9654C40.905%2044.7737%2040.5759%2045.0544%2040.1259%2045.0544C39.5484%2045.0544%2039.1723%2044.597%2039.1723%2043.7358C39.1723%2042.8809%2039.5517%2042.4235%2040.1259%2042.4235C40.596%2042.4235%2040.9016%2042.7232%2040.9654%2043.2185H42.5C42.4631%2042.026%2041.5363%2041.25%2040.1024%2041.25C38.4805%2041.25%2037.5%2042.2658%2037.5%2043.7516C37.5%2045.2311%2038.4738%2046.25%2040.1058%2046.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1248_126059)'%3e%3cpath%20d='M56%200.800641V10H80V1.05456e-06H57.0029L56.0002%200L56%200.800641Z'%20fill='url(%23paint2_linear_1248_126059)'/%3e%3cpath%20d='M80%2013H56V22.5H80V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M80%2025.75H56V35.25H80V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M80%2038.5H56V48H80V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M67.5383%2020.75C68.2141%2020.75%2068.616%2020.3761%2068.7966%2019.9645H68.8403V20.6862H70.25V14.75H68.8257V16.9964H68.7966C68.6277%2016.5877%2068.2374%2016.1761%2067.5325%2016.1761C66.5976%2016.1761%2065.75%2016.892%2065.75%2018.463C65.75%2019.979%2066.551%2020.75%2067.5383%2020.75ZM68.0335%2019.6457C67.5063%2019.6457%2067.2121%2019.179%2067.2121%2018.4601C67.2121%2017.7442%2067.5034%2017.2833%2068.0335%2017.2833C68.5549%2017.2833%2068.8578%2017.7326%2068.8578%2018.4601C68.8578%2019.1819%2068.5519%2019.6457%2068.0335%2019.6457Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.0797%2033C69.4177%2033%2070.2975%2032.3849%2070.4834%2031.4322L68.9927%2031.3912C68.8665%2031.7129%2068.5345%2031.8864%2068.1096%2031.8864C67.4854%2031.8864%2067.1003%2031.4921%2067.1003%2030.8991V30.858H70.5V30.4732C70.5%2028.877%2069.4774%2028%2068.0299%2028C66.4894%2028%2065.5%2029.0032%2065.5%2030.5047C65.5%2032.0568%2066.4761%2033%2068.0797%2033ZM67.1003%2029.9621C67.1235%2029.4795%2067.5252%2029.1136%2068.0631%2029.1136C68.5976%2029.1136%2068.9827%2029.4669%2068.9894%2029.9621H67.1003Z'%20fill='%2324292E'/%3e%3cpath%20d='M69.2936%2041.9515H68.4651V41.7108C68.4651%2041.4646%2068.5669%2041.3134%2068.8893%2041.3134C69.0193%2041.3134%2069.1777%2041.3414%2069.2795%2041.3722L69.5%2040.3703C69.336%2040.3256%2068.9599%2040.25%2068.5782%2040.25C67.6932%2040.25%2067.0853%2040.7369%2067.0853%2041.7332V41.9515H66.5V42.959H67.0853V46.25H68.4651V42.959H69.2936V41.9515Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M93.9067%2030C94.6011%2030%2099.9327%2026%2099.9327%2024C99.9327%2022%2094.7357%2018%2093.9067%2018C93.0778%2018%2092.4023%2018.5%2092.4023%2019.4756C92.4023%2020.4512%2095.9067%2022.9206%2095.9067%2022.9206C95.9067%2022.9206%2088.2539%2022.25%2088%2022.9206C87.7461%2023.5911%2087.7461%2024.4089%2088%2025.0794C88.2539%2025.75%2095.9067%2025.0794%2095.9067%2025.0794C95.9067%2025.0794%2092.4023%2027.75%2092.4023%2028.5301C92.4023%2029.3103%2093.2124%2030%2093.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip3_1248_126059)'%3e%3cpath%20d='M108%200.800641V10H132V1.05456e-06H109.003L108%200L108%200.800641Z'%20fill='url(%23paint3_linear_1248_126059)'/%3e%3cpath%20d='M132%2013H108V22.5H132V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M132%2025.75H108V35.25H132V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M132%2038.5H108V48H132V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M120.106%2046.25C121.556%2046.25%20122.456%2045.4582%20122.5%2044.2595H120.965C120.905%2044.7737%20120.576%2045.0544%20120.126%2045.0544C119.548%2045.0544%20119.172%2044.597%20119.172%2043.7358C119.172%2042.8809%20119.552%2042.4235%20120.126%2042.4235C120.596%2042.4235%20120.902%2042.7232%20120.965%2043.2185H122.5C122.463%2042.026%20121.536%2041.25%20120.102%2041.25C118.481%2041.25%20117.5%2042.2658%20117.5%2043.7516C117.5%2045.2311%20118.474%2046.25%20120.106%2046.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M117.75%2033.4362H119.16V32.7145H119.203C119.384%2033.1261%20119.786%2033.5%20120.462%2033.5C121.452%2033.5%20122.25%2032.729%20122.25%2031.213C122.25%2029.642%20121.405%2028.9261%20120.47%2028.9261C119.763%2028.9261%20119.375%2029.3377%20119.203%2029.7464H119.174V27.5H117.75V33.4362ZM119.145%2031.2101C119.145%2030.4826%20119.448%2030.0333%20119.969%2030.0333C120.497%2030.0333%20120.788%2030.4942%20120.788%2031.2101C120.788%2031.929%20120.497%2032.3957%20119.969%2032.3957C119.448%2032.3957%20119.145%2031.9319%20119.145%2031.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M119.346%2020.25C120.022%2020.25%20120.49%2019.9877%20120.756%2019.4915H120.794V20.1678H122.247V16.8682C122.247%2015.841%20121.334%2015.25%20120.098%2015.25C118.793%2015.25%20118.053%2015.9074%20117.93%2016.7924L119.356%2016.8429C119.422%2016.5332%20119.678%2016.3436%20120.086%2016.3436C120.465%2016.3436%20120.705%2016.5269%20120.705%2016.8524V16.8682C120.705%2017.1653%20120.383%2017.2285%20119.555%2017.3012C118.572%2017.3834%20117.75%2017.7468%20117.75%2018.8214C117.75%2019.7822%20118.417%2020.25%20119.346%2020.25ZM119.823%2019.2386C119.466%2019.2386%20119.213%2019.068%20119.213%2018.7456C119.213%2018.4327%20119.46%2018.243%20119.899%2018.1767C120.187%2018.1356%20120.541%2018.0724%20120.715%2017.9807V18.4422C120.715%2018.9162%20120.316%2019.2386%20119.823%2019.2386Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1248_126059)'%3e%3cpath%20d='M136%200.800641V10H160V1.05456e-06H137.003L136%200L136%200.800641Z'%20fill='url(%23paint4_linear_1248_126059)'/%3e%3cpath%20d='M160%2013H136V22.5H160V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M160%2025.75H136V35.25H160V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M160%2038.5H136V48H160V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M149.5%202H148.072L146.5%202.91992V4.17383L147.925%203.35352H147.963V8H149.5V2Z'%20fill='%2324292E'/%3e%3cpath%20d='M147.538%2021C148.214%2021%20148.616%2020.6261%20148.797%2020.2145H148.84V20.9362H150.25V15H148.826V17.2464H148.797C148.628%2016.8377%20148.237%2016.4261%20147.533%2016.4261C146.598%2016.4261%20145.75%2017.142%20145.75%2018.713C145.75%2020.229%20146.551%2021%20147.538%2021ZM148.033%2019.8957C147.506%2019.8957%20147.212%2019.429%20147.212%2018.7101C147.212%2017.9942%20147.503%2017.5333%20148.033%2017.5333C148.555%2017.5333%20148.858%2017.9826%20148.858%2018.7101C148.858%2019.4319%20148.552%2019.8957%20148.033%2019.8957Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip5_1248_126059)'%3e%3cpath%20d='M164%200.800641V10H188V1.05456e-06H165.003L164%200L164%200.800641Z'%20fill='url(%23paint5_linear_1248_126059)'/%3e%3cpath%20d='M188%2013H164V22.5H188V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M188%2025.75H164V35.25H188V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M188%2038.5H164V48H188V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M173.837%208H178.25V6.84682H175.834V6.80925L176.547%206.15607C177.84%205.03757%20178.177%204.46821%20178.177%203.78902C178.177%202.72254%20177.301%202%20175.948%202C174.629%202%20173.747%202.75434%20173.75%203.95954H175.115C175.115%203.42486%20175.447%203.11561%20175.942%203.11561C176.428%203.11561%20176.78%203.41329%20176.78%203.90173C176.78%204.34393%20176.501%204.64451%20176.012%205.08093L173.837%206.9711V8Z'%20fill='%2324292E'/%3e%3cpath%20d='M176.08%2033C177.418%2033%20178.297%2032.3849%20178.483%2031.4322L176.993%2031.3912C176.867%2031.7129%20176.535%2031.8864%20176.11%2031.8864C175.485%2031.8864%20175.1%2031.4921%20175.1%2030.8991V30.858H178.5V30.4732C178.5%2028.877%20177.477%2028%20176.03%2028C174.489%2028%20173.5%2029.0032%20173.5%2030.5047C173.5%2032.0568%20174.476%2033%20176.08%2033ZM175.1%2029.9621C175.124%2029.4795%20175.525%2029.1136%20176.063%2029.1136C176.598%2029.1136%20176.983%2029.4669%20176.989%2029.9621H175.1Z'%20fill='%2324292E'/%3e%3cpath%20d='M177.294%2041.7015H176.465V41.4608C176.465%2041.2146%20176.567%2041.0634%20176.889%2041.0634C177.019%2041.0634%20177.178%2041.0914%20177.279%2041.1222L177.5%2040.1203C177.336%2040.0756%20176.96%2040%20176.578%2040C175.693%2040%20175.085%2040.4869%20175.085%2041.4832V41.7015H174.5V42.709H175.085V46H176.465V42.709H177.294V41.7015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126059'%20x1='0.00781255'%20y1='5.004'%20x2='24.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126059'%20x1='28.0078'%20y1='5.004'%20x2='52.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126059'%20x1='56.0078'%20y1='5.004'%20x2='80.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126059'%20x1='108.008'%20y1='5.004'%20x2='132.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126059'%20x1='136.008'%20y1='5.004'%20x2='160.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1248_126059'%20x1='164.008'%20y1='5.004'%20x2='188.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126059'%3e%3crect%20width='24'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126059'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(28)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126059'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(56)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126059'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(108)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1248_126059'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(136)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip5_1248_126059'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(164)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_50 = "data:image/svg+xml,%3csvg%20width='124'%20height='48'%20viewBox='0%200%20124%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_125902)'%3e%3cpath%20d='M0%200.611699V7.64012H14.394V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1248_125902)'/%3e%3cpath%20d='M33.606%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200L33.606%200V7.64012Z'%20fill='url(%23paint1_linear_1248_125902)'/%3e%3cpath%20d='M31.194%200H16.8V7.64012H31.194V0Z'%20fill='url(%23paint2_linear_1248_125902)'/%3e%3cpath%20d='M31.194%2010.0869H16.8V17.727H31.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2010.0869H0V17.727H14.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2010.0869H33.606V17.727H48V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2020.1799H33.606V27.8262H48V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2020.1799H16.8V27.8262H31.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2020.1799H0V27.8262H14.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2030.2668H16.8V37.907H31.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2030.2668H33.606V37.907H48V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2030.2668H0V37.907H14.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M31.194%2040.3599H16.8V48H31.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M48%2047.3883V40.3721H33.606V48H47.3985C47.558%2048%2047.711%2047.9356%2047.8238%2047.8209C47.9366%2047.7061%2048%2047.5505%2048%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2048V40.3721H0V47.3883C0%2047.5505%200.0633725%2047.7061%200.176176%2047.8209C0.28898%2047.9356%200.441975%2048%200.601504%2048H14.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030.4C62.6011%2030.4%2067.9327%2026.1333%2067.9327%2024C67.9327%2021.8666%2062.7357%2017.6%2061.9067%2017.6C61.0778%2017.6%2060.4023%2018.1333%2060.4023%2019.1739C60.4023%2020.2146%2063.9067%2022.8486%2063.9067%2022.8486C63.9067%2022.8486%2056.2539%2022.1333%2056%2022.8486C55.7461%2023.5639%2055.7461%2024.4361%2056%2025.1514C56.2539%2025.8666%2063.9067%2025.1514%2063.9067%2025.1514C63.9067%2025.1514%2060.4023%2028%2060.4023%2028.8321C60.4023%2029.6643%2061.2124%2030.4%2061.9067%2030.4Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_125902)'%3e%3cpath%20d='M81.4059%200H76.5993C76.2683%200%2076%200.268327%2076%200.599326V5.40592C76%205.73692%2076.2683%206.00524%2076.5993%206.00524H81.4059C81.7369%206.00524%2082.0052%205.73692%2082.0052%205.40592V0.599326C82.0052%200.268327%2081.7369%200%2081.4059%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%200H93.3984C93.0674%200%2092.7991%200.268327%2092.7991%200.599326V5.40592C92.7991%205.73692%2093.0674%206.00524%2093.3984%206.00524H98.205C98.536%206.00524%2098.8043%205.73692%2098.8043%205.40592V0.599326C98.8043%200.268327%2098.536%200%2098.205%200Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.608%200H101.801C101.47%200%20101.202%200.268327%20101.202%200.599326V5.40592C101.202%205.73692%20101.47%206.00524%20101.801%206.00524H106.608C106.939%206.00524%20107.207%205.73692%20107.207%205.40592V0.599326C107.207%200.268327%20106.939%200%20106.608%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M115.004%200H110.198C109.867%200%20109.598%200.268327%20109.598%200.599326V5.40592C109.598%205.73692%20109.867%206.00524%20110.198%206.00524H115.004C115.335%206.00524%20115.603%205.73692%20115.603%205.40592V0.599326C115.603%200.268327%20115.335%200%20115.004%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M123.407%208.40253H118.6C118.269%208.40253%20118.001%208.67085%20118.001%209.00185V13.8084C118.001%2014.1394%20118.269%2014.4078%20118.6%2014.4078H123.407C123.738%2014.4078%20124.006%2014.1394%20124.006%2013.8084V9.00185C124.006%208.67085%20123.738%208.40253%20123.407%208.40253Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%2016.7991H93.3984C93.0674%2016.7991%2092.7991%2017.0674%2092.7991%2017.3984V22.205C92.7991%2022.536%2093.0674%2022.8043%2093.3984%2022.8043H98.205C98.536%2022.8043%2098.8043%2022.536%2098.8043%2022.205V17.3984C98.8043%2017.0674%2098.536%2016.7991%2098.205%2016.7991Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.608%2016.7991H101.801C101.47%2016.7991%20101.202%2017.0674%20101.202%2017.3984V22.205C101.202%2022.536%20101.47%2022.8043%20101.801%2022.8043H106.608C106.939%2022.8043%20107.207%2022.536%20107.207%2022.205V17.3984C107.207%2017.0674%20106.939%2016.7991%20106.608%2016.7991Z'%20fill='%233865AB'/%3e%3cpath%20d='M115.004%2016.7991H110.198C109.867%2016.7991%20109.598%2017.0674%20109.598%2017.3984V22.205C109.598%2022.536%20109.867%2022.8043%20110.198%2022.8043H115.004C115.335%2022.8043%20115.603%2022.536%20115.603%2022.205V17.3984C115.603%2017.0674%20115.335%2016.7991%20115.004%2016.7991Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M123.407%2016.7991H118.6C118.269%2016.7991%20118.001%2017.0674%20118.001%2017.3984V22.205C118.001%2022.536%20118.269%2022.8043%20118.6%2022.8043H123.407C123.738%2022.8043%20124.006%2022.536%20124.006%2022.205V17.3984C124.006%2017.0674%20123.738%2016.7991%20123.407%2016.7991Z'%20fill='%233865AB'/%3e%3cpath%20d='M81.4059%2025.2017H76.5993C76.2683%2025.2017%2076%2025.47%2076%2025.801V30.6076C76%2030.9386%2076.2683%2031.2069%2076.5993%2031.2069H81.4059C81.7369%2031.2069%2082.0052%2030.9386%2082.0052%2030.6076V25.801C82.0052%2025.47%2081.7369%2025.2017%2081.4059%2025.2017Z'%20fill='%233865AB'/%3e%3cpath%20d='M106.608%2025.2017H101.801C101.47%2025.2017%20101.202%2025.47%20101.202%2025.801V30.6076C101.202%2030.9386%20101.47%2031.2069%20101.801%2031.2069H106.608C106.939%2031.2069%20107.207%2030.9386%20107.207%2030.6076V25.801C107.207%2025.47%20106.939%2025.2017%20106.608%2025.2017Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M115.004%2025.2017H110.198C109.867%2025.2017%20109.598%2025.47%20109.598%2025.801V30.6076C109.598%2030.9386%20109.867%2031.2069%20110.198%2031.2069H115.004C115.335%2031.2069%20115.603%2030.9386%20115.603%2030.6076V25.801C115.603%2025.47%20115.335%2025.2017%20115.004%2025.2017Z'%20fill='%233865AB'/%3e%3cpath%20d='M123.407%2025.2017H118.6C118.269%2025.2017%20118.001%2025.47%20118.001%2025.801V30.6076C118.001%2030.9386%20118.269%2031.2069%20118.6%2031.2069H123.407C123.738%2031.2069%20124.006%2030.9386%20124.006%2030.6076V25.801C124.006%2025.47%20123.738%2025.2017%20123.407%2025.2017Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M89.8085%2033.5982H85.0019C84.6709%2033.5982%2084.4026%2033.8665%2084.4026%2034.1975V39.0041C84.4026%2039.3351%2084.6709%2039.6035%2085.0019%2039.6035H89.8085C90.1395%2039.6035%2090.4078%2039.3351%2090.4078%2039.0041V34.1975C90.4078%2033.8665%2090.1395%2033.5982%2089.8085%2033.5982Z'%20fill='%233865AB'/%3e%3cpath%20d='M89.8085%2042.0007H85.0019C84.6709%2042.0007%2084.4026%2042.2691%2084.4026%2042.6001V47.4066C84.4026%2047.7376%2084.6709%2048.006%2085.0019%2048.006H89.8085C90.1395%2048.006%2090.4078%2047.7376%2090.4078%2047.4066V42.6001C90.4078%2042.2691%2090.1395%2042.0007%2089.8085%2042.0007Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%2042.0007H93.3984C93.0674%2042.0007%2092.7991%2042.2691%2092.7991%2042.6001V47.4066C92.7991%2047.7376%2093.0674%2048.006%2093.3984%2048.006H98.205C98.536%2048.006%2098.8043%2047.7376%2098.8043%2047.4066V42.6001C98.8043%2042.2691%2098.536%2042.0007%2098.205%2042.0007Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M106.608%2042.0007H101.801C101.47%2042.0007%20101.202%2042.2691%20101.202%2042.6001V47.4066C101.202%2047.7376%20101.47%2048.006%20101.801%2048.006H106.608C106.939%2048.006%20107.207%2047.7376%20107.207%2047.4066V42.6001C107.207%2042.2691%20106.939%2042.0007%20106.608%2042.0007Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M89.8085%200H85.0019C84.6709%200%2084.4026%200.268327%2084.4026%200.599326V5.40592C84.4026%205.73692%2084.6709%206.00524%2085.0019%206.00524H89.8085C90.1395%206.00524%2090.4078%205.73692%2090.4078%205.40592V0.599326C90.4078%200.268327%2090.1395%200%2089.8085%200Z'%20fill='%233865AB'/%3e%3cpath%20d='M82.0052%2022.205V17.3984C82.0052%2017.0674%2081.7369%2016.7991%2081.4059%2016.7991H76.5993C76.2683%2016.7991%2076%2017.0674%2076%2017.3984V22.205C76%2022.536%2076.2683%2022.8043%2076.5993%2022.8043H81.4059C81.7369%2022.8043%2082.0052%2022.536%2082.0052%2022.205Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124.006%2039.0041V34.1975C124.006%2033.8665%20123.738%2033.5982%20123.407%2033.5982H118.6C118.269%2033.5982%20118.001%2033.8665%20118.001%2034.1975V39.0041C118.001%2039.3351%20118.269%2039.6034%20118.6%2039.6034H123.407C123.738%2039.6034%20124.006%2039.3351%20124.006%2039.0041Z'%20fill='%233865AB'/%3e%3cpath%20d='M124%205.40592V0.599326C124%200.268327%20123.732%200%20123.401%200L118.594%200C118.263%200%20117.995%200.268327%20117.995%200.599326V5.40592C117.995%205.73692%20118.263%206.00524%20118.594%206.00524H123.401C123.732%206.00524%20124%205.73692%20124%205.40592Z'%20fill='%233865AB'/%3e%3cpath%20d='M81.3939%2014.3838H76.5993C76.4404%2014.3838%2076.2879%2014.3207%2076.1755%2014.2083C76.0631%2014.0959%2076%2013.9434%2076%2013.7845V8.98989C76%208.83094%2076.0631%208.6785%2076.1755%208.5661C76.2879%208.45371%2076.4404%208.39056%2076.5993%208.39056H81.3939C81.5529%208.39056%2081.7053%208.45371%2081.8177%208.5661C81.9301%208.6785%2081.9933%208.83094%2081.9933%208.98989V13.7845C81.9933%2013.9434%2081.9301%2014.0959%2081.8177%2014.2083C81.7053%2014.3207%2081.5529%2014.3838%2081.3939%2014.3838ZM90.3838%2013.7845V8.98989C90.3838%208.83094%2090.3207%208.6785%2090.2083%208.5661C90.0959%208.45371%2089.9434%208.39056%2089.7845%208.39056H84.9899C84.8309%208.39056%2084.6785%208.45371%2084.5661%208.5661C84.4537%208.6785%2084.3906%208.83094%2084.3906%208.98989V13.7845C84.3906%2013.9434%2084.4537%2014.0959%2084.5661%2014.2083C84.6785%2014.3207%2084.8309%2014.3838%2084.9899%2014.3838H89.7845C89.9434%2014.3838%2090.0959%2014.3207%2090.2083%2014.2083C90.3207%2014.0959%2090.3838%2013.9434%2090.3838%2013.7845ZM98.7744%2013.7845V8.98989C98.7744%208.83094%2098.7112%208.6785%2098.5988%208.5661C98.4864%208.45371%2098.334%208.39056%2098.1751%208.39056H93.3804C93.2215%208.39056%2093.0691%208.45371%2092.9567%208.5661C92.8443%208.6785%2092.7811%208.83094%2092.7811%208.98989V13.7845C92.7811%2013.9434%2092.8443%2014.0959%2092.9567%2014.2083C93.0691%2014.3207%2093.2215%2014.3838%2093.3804%2014.3838H98.1751C98.2562%2014.3879%2098.3374%2014.3754%2098.4136%2014.3471C98.4898%2014.3188%2098.5595%2014.2753%2098.6183%2014.2192C98.6772%2014.1632%2098.7241%2014.0957%2098.756%2014.021C98.788%2013.9462%2098.8044%2013.8658%2098.8043%2013.7845H98.7744ZM115.556%2013.7845V8.98989C115.556%208.83094%20115.492%208.6785%20115.38%208.5661C115.268%208.45371%20115.115%208.39056%20114.956%208.39056H110.162C110.003%208.39056%20109.85%208.45371%20109.738%208.5661C109.625%208.6785%20109.562%208.83094%20109.562%208.98989V13.7845C109.562%2013.9434%20109.625%2014.0959%20109.738%2014.2083C109.85%2014.3207%20110.003%2014.3838%20110.162%2014.3838H114.956C115.039%2014.3905%20115.122%2014.3799%20115.2%2014.3527C115.279%2014.3256%20115.35%2014.2825%20115.411%2014.2262C115.472%2014.1699%20115.521%2014.1015%20115.554%2014.0255C115.587%2013.9495%20115.604%2013.8674%20115.603%2013.7845H115.556ZM106.566%2014.3838H101.771C101.612%2014.3838%20101.46%2014.3207%20101.347%2014.2083C101.235%2014.0959%20101.172%2013.9434%20101.172%2013.7845V8.98989C101.172%208.83094%20101.235%208.6785%20101.347%208.5661C101.46%208.45371%20101.612%208.39056%20101.771%208.39056H106.566C106.725%208.39056%20106.877%208.45371%20106.989%208.5661C107.102%208.6785%20107.165%208.83094%20107.165%208.98989V13.7845C107.165%2013.9374%20107.107%2014.0846%20107.002%2014.1961C106.898%2014.3075%20106.754%2014.3746%20106.602%2014.3838H106.566Z'%20fill='url(%23paint3_linear_1248_125902)'/%3e%3cpath%20d='M89.8085%2016.7991H85.0019C84.6709%2016.7991%2084.4026%2017.0674%2084.4026%2017.3984V22.205C84.4026%2022.536%2084.6709%2022.8043%2085.0019%2022.8043H89.8085C90.1395%2022.8043%2090.4078%2022.536%2090.4078%2022.205V17.3984C90.4078%2017.0674%2090.1395%2016.7991%2089.8085%2016.7991Z'%20fill='%233865AB'/%3e%3cpath%20d='M98.205%2033.5982H93.3984C93.0674%2033.5982%2092.7991%2033.8665%2092.7991%2034.1975V39.0041C92.7991%2039.3351%2093.0674%2039.6035%2093.3984%2039.6035H98.205C98.536%2039.6035%2098.8043%2039.3351%2098.8043%2039.0041V34.1975C98.8043%2033.8665%2098.536%2033.5982%2098.205%2033.5982Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M98.205%2031.2009H93.3804C93.2215%2031.2009%2093.0691%2031.1378%2092.9567%2031.0254C92.8443%2030.913%2092.7811%2030.7605%2092.7811%2030.6016V25.807C92.7811%2025.648%2092.8443%2025.4956%2092.9567%2025.3832C93.0691%2025.2708%2093.2215%2025.2076%2093.3804%2025.2076H98.1751C98.334%2025.2076%2098.4864%2025.2708%2098.5988%2025.3832C98.7112%2025.4956%2098.7744%2025.648%2098.7744%2025.807V30.6016C98.7746%2030.7555%2098.7156%2030.9035%2098.6096%2031.0151C98.5036%2031.1267%2098.3587%2031.1932%2098.205%2031.2009ZM89.8145%2031.2009H84.9899C84.8309%2031.2009%2084.6785%2031.1378%2084.5661%2031.0254C84.4537%2030.913%2084.3906%2030.7605%2084.3906%2030.6016V25.807C84.3906%2025.648%2084.4537%2025.4956%2084.5661%2025.3832C84.6785%2025.2708%2084.8309%2025.2076%2084.9899%2025.2076H89.7845C89.9434%2025.2076%2090.0959%2025.2708%2090.2083%2025.3832C90.3207%2025.4956%2090.3838%2025.648%2090.3838%2025.807V30.6016C90.3838%2030.7605%2090.3207%2030.913%2090.2083%2031.0254C90.0959%2031.1378%2089.9434%2031.2009%2089.7845%2031.2009H89.8145ZM82.0232%2038.9921V34.1975C82.0232%2034.0386%2081.9601%2033.8861%2081.8477%2033.7737C81.7353%2033.6613%2081.5829%2033.5982%2081.4239%2033.5982H76.5993C76.4404%2033.5982%2076.2879%2033.6613%2076.1755%2033.7737C76.0631%2033.8861%2076%2034.0386%2076%2034.1975V38.9921C76%2039.1511%2076.0631%2039.3035%2076.1755%2039.4159C76.2879%2039.5283%2076.4404%2039.5915%2076.5993%2039.5915H81.3939C81.5508%2039.5915%2081.7015%2039.53%2081.8135%2039.4202C81.9256%2039.3104%2081.9901%2039.161%2081.9933%2039.0041L82.0232%2038.9921ZM107.195%2038.9921V34.1975C107.195%2034.0386%20107.132%2033.8861%20107.019%2033.7737C106.907%2033.6613%20106.755%2033.5982%20106.596%2033.5982H101.801C101.642%2033.5982%20101.49%2033.6613%20101.377%2033.7737C101.265%2033.8861%20101.202%2034.0386%20101.202%2034.1975V38.9921C101.202%2039.1511%20101.265%2039.3035%20101.377%2039.4159C101.49%2039.5283%20101.642%2039.5915%20101.801%2039.5915H106.596C106.754%2039.5931%20106.906%2039.5323%20107.019%2039.4223C107.132%2039.3123%20107.198%2039.162%20107.201%2039.0041L107.195%2038.9921ZM115.585%2038.9921V34.1975C115.585%2034.0386%20115.522%2033.8861%20115.41%2033.7737C115.298%2033.6613%20115.145%2033.5982%20114.986%2033.5982H110.192C110.033%2033.5982%20109.88%2033.6613%20109.768%2033.7737C109.655%2033.8861%20109.592%2034.0386%20109.592%2034.1975V38.9921C109.592%2039.1511%20109.655%2039.3035%20109.768%2039.4159C109.88%2039.5283%20110.033%2039.5915%20110.192%2039.5915H114.986C115.065%2039.5939%20115.144%2039.5805%20115.218%2039.5522C115.292%2039.5239%20115.36%2039.4812%20115.417%2039.4266C115.475%2039.372%20115.521%2039.3065%20115.553%2039.234C115.585%2039.1615%20115.602%2039.0833%20115.603%2039.0041L115.585%2038.9921Z'%20fill='url(%23paint4_linear_1248_125902)'/%3e%3cpath%20d='M81.4059%2042.0007H76.5993C76.2683%2042.0007%2076%2042.2691%2076%2042.6001V47.4066C76%2047.7376%2076.2683%2048.006%2076.5993%2048.006H81.4059C81.7369%2048.006%2082.0052%2047.7376%2082.0052%2047.4066V42.6001C82.0052%2042.2691%2081.7369%2042.0007%2081.4059%2042.0007Z'%20fill='%233865AB'/%3e%3cpath%20d='M115.004%2042.0007H110.198C109.867%2042.0007%20109.598%2042.2691%20109.598%2042.6001V47.4066C109.598%2047.7376%20109.867%2048.006%20110.198%2048.006H115.004C115.335%2048.006%20115.603%2047.7376%20115.603%2047.4066V42.6001C115.603%2042.2691%20115.335%2042.0007%20115.004%2042.0007Z'%20fill='%233865AB'/%3e%3cpath%20d='M123.407%2042.0007H118.6C118.269%2042.0007%20118.001%2042.2691%20118.001%2042.6001V47.4066C118.001%2047.7376%20118.269%2048.006%20118.6%2048.006H123.407C123.738%2048.006%20124.006%2047.7376%20124.006%2047.4066V42.6001C124.006%2042.2691%20123.738%2042.0007%20123.407%2042.0007Z'%20fill='%2384AFF1'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_125902'%20x1='0'%20y1='3.82312'%20x2='14.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_125902'%20x1='33.606'%20y1='3.82312'%20x2='48'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_125902'%20x1='16.8'%20y1='3.82312'%20x2='31.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_125902'%20x1='76'%20y1='11.3992'%20x2='115.603'%20y2='11.3992'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_125902'%20x1='76'%20y1='32.3996'%20x2='115.603'%20y2='32.3996'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_125902'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_125902'%3e%3crect%20width='48'%20height='48'%20fill='white'%20transform='translate(76)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_51 = "data:image/svg+xml,%3csvg%20width='121'%20height='48'%20viewBox='0%200%20121%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_125874)'%3e%3cpath%20d='M0%200.611699V7.64012H14.394V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1248_125874)'/%3e%3cpath%20d='M33.606%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200L33.606%200V7.64012Z'%20fill='url(%23paint1_linear_1248_125874)'/%3e%3cpath%20d='M31.194%200H16.8V7.64012H31.194V0Z'%20fill='url(%23paint2_linear_1248_125874)'/%3e%3cpath%20d='M31.194%2010.0869H16.8V17.727H31.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2010.0869H0V17.727H14.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2010.0869H33.606V17.727H48V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2020.1799H33.606V27.8262H48V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2020.1799H16.8V27.8262H31.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2020.1799H0V27.8262H14.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2030.2668H16.8V37.907H31.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2030.2668H33.606V37.907H48V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2030.2668H0V37.907H14.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M31.194%2040.3599H16.8V48H31.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M48%2047.3883V40.3721H33.606V48H47.3985C47.558%2048%2047.711%2047.9356%2047.8238%2047.8209C47.9366%2047.7061%2048%2047.5505%2048%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2048V40.3721H0V47.3883C0%2047.5505%200.0633725%2047.7061%200.176176%2047.8209C0.28898%2047.9356%200.441975%2048%200.601504%2048H14.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030C62.6011%2030%2067.9327%2026%2067.9327%2024C67.9327%2022%2062.7357%2018%2061.9067%2018C61.0778%2018%2060.4023%2018.5%2060.4023%2019.4756C60.4023%2020.4512%2063.9067%2022.9206%2063.9067%2022.9206C63.9067%2022.9206%2056.2539%2022.25%2056%2022.9206C55.7461%2023.5911%2055.7461%2024.4089%2056%2025.0794C56.2539%2025.75%2063.9067%2025.0794%2063.9067%2025.0794C63.9067%2025.0794%2060.4023%2027.75%2060.4023%2028.5301C60.4023%2029.3103%2061.2124%2030%2061.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_125874)'%3e%3cpath%20d='M87.833%2048H85.4439C85.2855%2048%2085.1336%2047.9371%2085.0216%2047.825C84.9095%2047.7129%2084.8466%2047.5609%2084.8466%2047.4023V28.8144C84.8466%2028.6559%2084.9095%2028.5038%2085.0216%2028.3917C85.1336%2028.2797%2085.2855%2028.2167%2085.4439%2028.2167H87.833C87.9914%2028.2167%2088.1433%2028.2797%2088.2554%2028.3917C88.3674%2028.5038%2088.4303%2028.6559%2088.4303%2028.8144V47.4023C88.4303%2047.5609%2088.3674%2047.7129%2088.2554%2047.825C88.1433%2047.9371%2087.9914%2048%2087.833%2048ZM82.4157%2040.8278H80.0266C79.8682%2040.8278%2079.7162%2040.8908%2079.6042%2041.0029C79.4922%2041.115%2079.4293%2041.267%2079.4293%2041.4255V47.4023C79.4293%2047.5609%2079.4922%2047.7129%2079.6042%2047.825C79.7162%2047.9371%2079.8682%2048%2080.0266%2048H82.4157C82.5741%2048%2082.726%2047.9371%2082.838%2047.825C82.95%2047.7129%2083.013%2047.5609%2083.013%2047.4023V41.4255C83.0114%2041.268%2082.9478%2041.1175%2082.8359%2041.0067C82.7241%2040.8959%2082.5731%2040.8338%2082.4157%2040.8338V40.8278ZM93.2503%209.92756H90.8612C90.7028%209.92756%2090.5509%209.99053%2090.4389%2010.1026C90.3269%2010.2147%2090.2639%2010.3667%2090.2639%2010.5252V47.4023C90.2639%2047.5609%2090.3269%2047.7129%2090.4389%2047.825C90.5509%2047.9371%2090.7028%2048%2090.8612%2048H93.2503C93.4088%2048%2093.5607%2047.9371%2093.6727%2047.825C93.7847%2047.7129%2093.8476%2047.5609%2093.8476%2047.4023V10.5252C93.8476%2010.3667%2093.7847%2010.2147%2093.6727%2010.1026C93.5607%209.99053%2093.4088%209.92756%2093.2503%209.92756ZM98.6677%204.07623H96.2786C96.1202%204.07623%2095.9682%204.1392%2095.8562%204.25129C95.7442%204.36338%2095.6813%204.5154%2095.6813%204.67392V47.4023C95.6813%2047.5609%2095.7442%2047.7129%2095.8562%2047.825C95.9682%2047.9371%2096.1202%2048%2096.2786%2048H98.6677C98.8261%2048%2098.978%2047.9371%2099.09%2047.825C99.202%2047.7129%2099.265%2047.5609%2099.265%2047.4023V4.67392C99.265%204.5154%2099.202%204.36338%2099.09%204.25129C98.978%204.1392%2098.8261%204.07623%2098.6677%204.07623ZM104.085%209.92756H101.696C101.537%209.92756%20101.386%209.99053%20101.274%2010.1026C101.162%2010.2147%20101.099%2010.3667%20101.099%2010.5252V47.4023C101.099%2047.5609%20101.162%2047.7129%20101.274%2047.825C101.386%2047.9371%20101.537%2048%20101.696%2048H104.085C104.243%2048%20104.395%2047.9371%20104.507%2047.825C104.619%2047.7129%20104.682%2047.5609%20104.682%2047.4023V10.5252C104.682%2010.3667%20104.619%2010.2147%20104.507%2010.1026C104.395%209.99053%20104.243%209.92756%20104.085%209.92756ZM109.502%2028.2167H107.113C106.955%2028.2167%20106.803%2028.2797%20106.691%2028.3917C106.579%2028.5038%20106.516%2028.6559%20106.516%2028.8144V47.4023C106.516%2047.5609%20106.579%2047.7129%20106.691%2047.825C106.803%2047.9371%20106.955%2048%20107.113%2048H109.502C109.661%2048%20109.813%2047.9371%20109.925%2047.825C110.037%2047.7129%20110.1%2047.5609%20110.1%2047.4023V28.8144C110.1%2028.6559%20110.037%2028.5038%20109.925%2028.3917C109.813%2028.2797%20109.661%2028.2167%20109.502%2028.2167ZM114.92%2040.8338H112.531C112.372%2040.8338%20112.22%2040.8968%20112.108%2041.0089C111.996%2041.1209%20111.933%2041.273%20111.933%2041.4315V47.4083C111.933%2047.5668%20111.996%2047.7189%20112.108%2047.831C112.22%2047.943%20112.372%2048.006%20112.531%2048.006H114.92C115.078%2048.006%20115.23%2047.943%20115.342%2047.831C115.454%2047.7189%20115.517%2047.5668%20115.517%2047.4083V41.4315C115.517%2041.273%20115.454%2041.1209%20115.342%2041.0089C115.23%2040.8968%20115.078%2040.8338%20114.92%2040.8338ZM120.403%2043.7087H118.014C117.855%2043.7087%20117.703%2043.7716%20117.591%2043.8837C117.479%2043.9958%20117.416%2044.1478%20117.416%2044.3063V47.4023C117.416%2047.5609%20117.479%2047.7129%20117.591%2047.825C117.703%2047.9371%20117.855%2048%20118.014%2048H120.403C120.561%2048%20120.713%2047.9371%20120.825%2047.825C120.937%2047.7129%20121%2047.5609%20121%2047.4023V44.3063C121%2044.1478%20120.937%2043.9958%20120.825%2043.8837C120.713%2043.7716%20120.561%2043.7087%20120.403%2043.7087ZM76.9864%2043.7087H74.5973C74.4389%2043.7087%2074.287%2043.7716%2074.1749%2043.8837C74.0629%2043.9958%2074%2044.1478%2074%2044.3063V47.4023C74%2047.5609%2074.0629%2047.7129%2074.1749%2047.825C74.287%2047.9371%2074.4389%2048%2074.5973%2048H76.9864C77.1448%2048%2077.2967%2047.9371%2077.4087%2047.825C77.5208%2047.7129%2077.5837%2047.5609%2077.5837%2047.4023V44.3063C77.5837%2044.1478%2077.5208%2043.9958%2077.4087%2043.8837C77.2967%2043.7716%2077.1448%2043.7087%2076.9864%2043.7087Z'%20fill='url(%23paint3_linear_1248_125874)'/%3e%3cpath%20d='M74%2042.0231V39.6324C74.4652%2039.6368%2074.9277%2039.562%2075.3678%2039.4113L76.1502%2041.6705C75.4581%2041.907%2074.7314%2042.0262%2074%2042.0231Z'%20fill='%233865AB'/%3e%3cpath%20d='M79.1008%2039.6563L77.3089%2038.0486C78.0263%2037.2234%2078.6216%2036.2995%2079.0769%2035.3052L81.2331%2036.3332C80.6874%2037.5387%2079.9691%2038.6582%2079.1008%2039.6563ZM115.863%2039.6145C115.001%2038.6141%20114.287%2037.495%20113.743%2036.2914L115.905%2035.2634C116.349%2036.2573%20116.933%2037.183%20117.637%2038.0127L115.863%2039.6145ZM82.4157%2033.4046L80.14%2032.6335C80.4805%2031.6414%2080.809%2030.5357%2081.1494%2029.2447L83.4609%2029.8424C83.1025%2031.1991%2082.7621%2032.3646%2082.4037%2033.4046H82.4157ZM112.59%2033.3627C112.238%2032.3227%20111.891%2031.1573%20111.539%2029.8125L113.851%2029.2148C114.191%2030.5058%20114.52%2031.6055%20114.854%2032.6037L112.59%2033.3627ZM84.1896%2026.8958L81.8662%2026.3519C82.135%2025.1984%2082.3918%2024.0209%2082.6546%2022.8315L84.99%2023.3515C84.751%2024.5469%2084.4584%2025.7363%2084.1896%2026.8958ZM110.798%2026.848C110.53%2025.7004%20110.267%2024.505%20109.998%2023.3097L112.333%2022.7897C112.596%2023.9851%20112.859%2025.1804%20113.122%2026.31L110.798%2026.848ZM85.647%2020.4109L83.3176%2019.879C83.6282%2018.5043%2083.9149%2017.3747%2084.1657%2016.3287L86.4832%2016.9264C86.2204%2017.9305%2085.9456%2019.0542%2085.647%2020.4109ZM109.341%2020.3631C109.025%2018.9765%20108.744%2017.8708%20108.505%2016.8726L110.822%2016.2749C111.079%2017.291%20111.354%2018.4206%20111.67%2019.8252L109.341%2020.3631ZM87.2417%2014.0575L84.9541%2013.3762C85.3424%2012.0672%2085.7306%2010.9197%2086.1487%209.85581L88.3765%2010.7165C88.0062%2011.7206%2087.6359%2012.8143%2087.2656%2014.0575H87.2417ZM107.693%2014.0037C107.322%2012.7665%20106.958%2011.6787%20106.564%2010.6687L108.792%209.80202C109.204%2010.8719%20109.598%2012.0254%20109.986%2013.3224L107.693%2014.0037ZM89.5651%208.08069L87.4388%206.98693C88.0181%205.83371%2088.7189%204.74572%2089.5293%203.7415L91.3809%205.27157C90.6775%206.1407%2090.0689%207.08239%2089.5651%208.08069ZM105.411%208.03885C104.905%207.04259%20104.294%206.10294%20103.589%205.23571L105.417%203.69966C106.238%204.69703%20106.947%205.78131%20107.531%206.93313L105.411%208.03885ZM93.328%203.4845L92.008%201.49421C93.1468%200.726757%2094.439%200.216857%2095.7948%200L96.171%202.39074C95.154%202.53977%2094.1829%202.91339%2093.328%203.4845ZM101.63%203.4845C100.775%202.91445%2099.8039%202.54094%2098.7871%202.39074L99.1455%200C100.502%200.204683%20101.799%200.702305%20102.944%201.45835L101.63%203.4845Z'%20fill='%233865AB'/%3e%3cpath%20d='M121%2042.0231C120.269%2042.0262%20119.542%2041.907%20118.85%2041.6705L119.626%2039.4113C120.069%2039.5586%20120.533%2039.6333%20121%2039.6324V42.0231Z'%20fill='%233865AB'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_125874'%20x1='0'%20y1='3.82312'%20x2='14.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_125874'%20x1='33.606'%20y1='3.82312'%20x2='48'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_125874'%20x1='16.8'%20y1='3.82312'%20x2='31.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_125874'%20x1='74'%20y1='26.0411'%20x2='121'%20y2='26.0411'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_125874'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_125874'%3e%3crect%20width='47'%20height='48'%20fill='white'%20transform='translate(74)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_52 = "data:image/svg+xml,%3csvg%20width='177'%20height='52'%20viewBox='0%200%20177%2052'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126012)'%3e%3cpath%20d='M0%203.04083V15H15V2H0.626828C0.460583%202%200.301147%202.10966%200.183594%202.30485C0.0660407%202.50005%200%202.76479%200%203.04083Z'%20fill='url(%23paint0_linear_1248_126012)'/%3e%3cpath%20d='M15%2019.5H0V32.5H15V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2037H0V50H15V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M6.77442%2011.5C7.52635%2011.5%208.04638%2011.2377%208.34153%2010.7415H8.3837V11.4178H10V8.1182C10%207.09102%208.98454%206.5%207.61068%206.5C6.15952%206.5%205.33732%207.1574%205.20028%208.04235L6.78496%208.09292C6.85875%207.78319%207.14336%207.59355%207.59663%207.59355C8.01827%207.59355%208.28531%207.77686%208.28531%208.1024V8.1182C8.28531%208.4153%207.92692%208.47851%207.00633%208.5512C5.91356%208.63338%205%208.99684%205%2010.0714C5%2011.0322%205.74139%2011.5%206.77442%2011.5ZM7.30499%2010.4886C6.90794%2010.4886%206.62684%2010.318%206.62684%209.99558C6.62684%209.68268%206.90091%209.49305%207.38932%209.42668C7.70907%209.38559%208.1026%209.32238%208.29585%209.23072V9.69216C8.29585%2010.1662%207.85313%2010.4886%207.30499%2010.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126012)'%3e%3cpath%20d='M19%2015H34V3.04083C34%202.76479%2033.934%202.50005%2033.8164%202.30485C33.6989%202.10966%2033.5394%202%2033.3732%202H19V15Z'%20fill='url(%23paint1_linear_1248_126012)'/%3e%3cpath%20d='M34%2019.5H19V32.5H34V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2037H19V50H34V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M27.5%2023H26.0716L24.5%2023.9199V25.1738L25.9253%2024.3535H25.9627V29H27.5V23Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.3373%2046.5H28.75V45.3468H26.3341V45.3092L27.0472%2044.6561C28.3396%2043.5376%2028.6772%2042.9682%2028.6772%2042.289C28.6772%2041.2225%2027.8011%2040.5%2026.4476%2040.5C25.129%2040.5%2024.2471%2041.2543%2024.25%2042.4595H25.6151C25.6151%2041.9249%2025.947%2041.6156%2026.4418%2041.6156C26.9279%2041.6156%2027.2801%2041.9133%2027.2801%2042.4017C27.2801%2042.8439%2027.0006%2043.1445%2026.5116%2043.5809L24.3373%2045.4711V46.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M24%2011.6862H25.5663V10.9645H25.6149C25.8155%2011.3761%2026.2621%2011.75%2027.0129%2011.75C28.1133%2011.75%2029%2010.979%2029%209.46304C29%207.89203%2028.0615%207.17609%2027.0227%207.17609C26.2362%207.17609%2025.8058%207.58768%2025.6149%207.99638H25.5825V5.75H24V11.6862ZM25.5502%209.46015C25.5502%208.73261%2025.8867%208.28333%2026.466%208.28333C27.0518%208.28333%2027.3754%208.7442%2027.3754%209.46015C27.3754%2010.179%2027.0518%2010.6457%2026.466%2010.6457C25.8867%2010.6457%2025.5502%2010.1819%2025.5502%209.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M46.3343%2030H49.674V25.3135H54V21.6954H49.674V17H46.3343V21.6954H42V25.3135H46.3343V30Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126012)'%3e%3cpath%20d='M77%2025.5H62V38.5H77V25.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%209.04083V21H77V8H62.6268C62.4606%208%2062.3011%208.10966%2062.1836%208.30485C62.066%208.50005%2062%208.76479%2062%209.04083Z'%20fill='url(%23paint2_linear_1248_126012)'/%3e%3cpath%20d='M70.5%2029H69.0716L67.5%2029.9199V31.1738L68.9253%2030.3535H68.9627V35H70.5V29Z'%20fill='white'/%3e%3cpath%20d='M67%2017.6862H68.5663V16.9645H68.6149C68.8155%2017.3761%2069.2621%2017.75%2070.0129%2017.75C71.1133%2017.75%2072%2016.979%2072%2015.463C72%2013.892%2071.0615%2013.1761%2070.0227%2013.1761C69.2362%2013.1761%2068.8058%2013.5877%2068.6149%2013.9964H68.5825V11.75H67V17.6862ZM68.5502%2015.4601C68.5502%2014.7326%2068.8867%2014.2833%2069.466%2014.2833C70.0518%2014.2833%2070.3754%2014.7442%2070.3754%2015.4601C70.3754%2016.179%2070.0518%2016.6457%2069.466%2016.6457C68.8867%2016.6457%2068.5502%2016.1819%2068.5502%2015.4601Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126012)'%3e%3cpath%20d='M96%2025.5H81V38.5H96V25.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M81%2021H96V9.04083C96%208.76479%2095.934%208.50005%2095.8164%208.30485C95.6989%208.10966%2095.5394%208%2095.3732%208H81V21Z'%20fill='url(%23paint3_linear_1248_126012)'/%3e%3cpath%20d='M88.6058%2017.5C90.0564%2017.5%2090.9563%2016.7082%2091%2015.5095H89.4654C89.405%2016.0237%2089.0759%2016.3044%2088.6259%2016.3044C88.0484%2016.3044%2087.6723%2015.847%2087.6723%2014.9858C87.6723%2014.1309%2088.0517%2013.6735%2088.6259%2013.6735C89.096%2013.6735%2089.4016%2013.9732%2089.4654%2014.4685H91C90.9631%2013.276%2090.0363%2012.5%2088.6024%2012.5C86.9805%2012.5%2086%2013.5158%2086%2015.0016C86%2016.4811%2086.9738%2017.5%2088.6058%2017.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M104%2028H116V24.686H104V28ZM104%2022.314H116V19H104V22.314Z'%20fill='%2324292E'/%3e%3cpath%20d='M124%203.04083V15H139V2H124.627C124.461%202%20124.301%202.10966%20124.184%202.30485C124.066%202.50005%20124%202.76479%20124%203.04083Z'%20fill='url(%23paint4_linear_1248_126012)'/%3e%3cpath%20d='M139%2019.5H124V32.5H139V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2037H124V50H139V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2032.5V19.5L124%2032.5H139Z'%20fill='%233865AB'/%3e%3cpath%20d='M129.337%2046.5H133.75V45.3468H131.334V45.3092L132.047%2044.6561C133.34%2043.5376%20133.677%2042.9682%20133.677%2042.289C133.677%2041.2225%20132.801%2040.5%20131.448%2040.5C130.129%2040.5%20129.247%2041.2543%20129.25%2042.4595H130.615C130.615%2041.9249%20130.947%2041.6156%20131.442%2041.6156C131.928%2041.6156%20132.28%2041.9133%20132.28%2042.4017C132.28%2042.8439%20132.001%2043.1445%20131.512%2043.5809L129.337%2045.4711V46.5Z'%20fill='white'/%3e%3cpath%20d='M132.5%2023H131.072L129.5%2023.9199V25.1738L130.925%2024.3535H130.963V29H132.5V23Z'%20fill='white'/%3e%3cpath%20d='M129%2011.6862H130.566V10.9645H130.615C130.816%2011.3761%20131.262%2011.75%20132.013%2011.75C133.113%2011.75%20134%2010.979%20134%209.46304C134%207.89203%20133.061%207.17609%20132.023%207.17609C131.236%207.17609%20130.806%207.58768%20130.615%207.99638H130.583V5.75H129V11.6862ZM130.55%209.46015C130.55%208.73261%20130.887%208.28333%20131.466%208.28333C132.052%208.28333%20132.375%208.7442%20132.375%209.46015C132.375%2010.179%20132.052%2010.6457%20131.466%2010.6457C130.887%2010.6457%20130.55%2010.1819%20130.55%209.46015Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip4_1248_126012)'%3e%3cpath%20d='M143%203.04083V15H158V2H143.627C143.461%202%20143%202%20143%202C143%202%20143%202.76479%20143%203.04083Z'%20fill='url(%23paint5_linear_1248_126012)'/%3e%3cpath%20d='M158%2019.5H143V32.5H158V19.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2037H143V50H158V37Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M149.774%2011.5C150.526%2011.5%20151.046%2011.2377%20151.342%2010.7415H151.384V11.4178H153V8.1182C153%207.09102%20151.985%206.5%20150.611%206.5C149.16%206.5%20148.337%207.1574%20148.2%208.04235L149.785%208.09292C149.859%207.78319%20150.143%207.59355%20150.597%207.59355C151.018%207.59355%20151.285%207.77686%20151.285%208.1024V8.1182C151.285%208.4153%20150.927%208.47851%20150.006%208.5512C148.914%208.63338%20148%208.99684%20148%2010.0714C148%2011.0322%20148.741%2011.5%20149.774%2011.5ZM150.305%2010.4886C149.908%2010.4886%20149.627%2010.318%20149.627%209.99558C149.627%209.68268%20149.901%209.49305%20150.389%209.42668C150.709%209.38559%20151.103%209.32238%20151.296%209.23072V9.69216C151.296%2010.1662%20150.853%2010.4886%20150.305%2010.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip5_1248_126012)'%3e%3cpath%20d='M162%2015.005H177V3.04584C177%202.76979%20176.934%202.50505%20176.816%202.30986C176.699%202.11466%20176.539%202.005%20176.373%202.005H162V15.005Z'%20fill='url(%23paint6_linear_1248_126012)'/%3e%3cpath%20d='M177%2019.505H162V32.505H177V19.505Z'%20fill='%233865AB'/%3e%3cpath%20d='M177%2037.005H162V50.005H177V37.005Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M162.5%2037.505H176.5V49.505H162.5V37.505Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M169.606%2011.5C171.056%2011.5%20171.956%2010.7082%20172%209.50946H170.465C170.405%2010.0237%20170.076%2010.3044%20169.626%2010.3044C169.048%2010.3044%20168.672%209.847%20168.672%208.9858C168.672%208.13092%20169.052%207.6735%20169.626%207.6735C170.096%207.6735%20170.402%207.97319%20170.465%208.46845H172C171.963%207.27602%20171.036%206.5%20169.602%206.5C167.981%206.5%20167%207.51577%20167%209.00158C167%2010.4811%20167.974%2011.5%20169.606%2011.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3crect%20x='18'%20y='1'%20width='17'%20height='50'%20stroke='%2326262A'%20stroke-width='2'/%3e%3crect%20x='61'%20y='7'%20width='17'%20height='32.5'%20stroke='%2326262A'%20stroke-width='2'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126012'%20x1='0'%20y1='8.5052'%20x2='15'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126012'%20x1='19'%20y1='8.5052'%20x2='34'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126012'%20x1='62'%20y1='14.5052'%20x2='77'%20y2='14.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126012'%20x1='81'%20y1='14.5052'%20x2='96'%20y2='14.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126012'%20x1='124'%20y1='8.5052'%20x2='139'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1248_126012'%20x1='143'%20y1='8.5052'%20x2='158'%20y2='8.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_1248_126012'%20x1='162'%20y1='8.51021'%20x2='177'%20y2='8.51021'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126012'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(0%202)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126012'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19%202)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126012'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%208)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126012'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%208)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1248_126012'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(143%202)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip5_1248_126012'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(162%202)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_53 = "data:image/svg+xml,%3csvg%20width='148'%20height='58'%20viewBox='0%200%20148%2058'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126408)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126408)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126408)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1248_126408)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M6.18549%2052H5V56.9302H6.18549V52Z'%20fill='%2324292E'/%3e%3cpath%20d='M7.98978%2056.9928C8.50858%2056.9928%208.86737%2056.793%209.07102%2056.415H9.10011V56.9302H10.2153V54.4169C10.2153%2053.6346%209.51466%2053.1844%208.56676%2053.1844C7.56552%2053.1844%206.99823%2053.6851%206.90369%2054.3592L7.99705%2054.3977C8.04796%2054.1618%208.24433%2054.0173%208.55706%2054.0173C8.84798%2054.0173%209.03223%2054.157%209.03223%2054.4049V54.4169C9.03223%2054.6432%208.78495%2054.6914%208.14978%2054.7468C7.39582%2054.8093%206.7655%2055.0862%206.7655%2055.9047C6.7655%2056.6365%207.27703%2056.9928%207.98978%2056.9928ZM8.35585%2056.2224C8.0819%2056.2224%207.88795%2056.0924%207.88795%2055.8469C7.88795%2055.6086%208.07705%2055.4641%208.41403%2055.4136C8.63464%2055.3823%208.90616%2055.3341%209.0395%2055.2643V55.6158C9.0395%2055.9769%208.73404%2056.2224%208.35585%2056.2224Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.9402%2056.9302H12.1135V56.3308H12.1499C12.3002%2056.6726%2012.6347%2056.9831%2013.1972%2056.9831C14.0214%2056.9831%2014.6857%2056.3428%2014.6857%2055.0838C14.6857%2053.779%2013.9827%2053.1844%2013.2045%2053.1844C12.6153%2053.1844%2012.2929%2053.5262%2012.1499%2053.8657H12.1256V52H10.9402V56.9302ZM12.1014%2055.0814C12.1014%2054.4771%2012.3535%2054.104%2012.7875%2054.104C13.2263%2054.104%2013.4687%2054.4868%2013.4687%2055.0814C13.4687%2055.6784%2013.2263%2056.066%2012.7875%2056.066C12.3535%2056.066%2012.1014%2055.6808%2012.1014%2055.0814Z'%20fill='%2324292E'/%3e%3cpath%20d='M17.0476%2057C18.0246%2057%2018.667%2056.5306%2018.8028%2055.8036L17.7143%2055.7723C17.6221%2056.0178%2017.3797%2056.1502%2017.0694%2056.1502C16.6136%2056.1502%2016.3324%2055.8493%2016.3324%2055.3967V55.3654H18.8149V55.0717C18.8149%2053.8536%2018.0682%2053.1844%2017.0112%2053.1844C15.8863%2053.1844%2015.1639%2053.9499%2015.1639%2055.0958C15.1639%2056.2802%2015.8766%2057%2017.0476%2057ZM16.3324%2054.6818C16.3494%2054.3134%2016.6427%2054.0342%2017.0355%2054.0342C17.4258%2054.0342%2017.707%2054.3038%2017.7118%2054.6818H16.3324Z'%20fill='%2324292E'/%3e%3cpath%20d='M20.6059%2052H19.4204V56.9302H20.6059V52Z'%20fill='%2324292E'/%3e%3cpath%20d='M21.5932%2056.2537H25.0623V55.2884H21.5932V56.2537ZM21.5932%2054.5975H25.0623V53.6322H21.5932V54.5975Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.3333%2052H27.2206L25.9963%2052.7559V53.7862L27.1066%2053.1122H27.1357V56.9302H28.3333V52Z'%20fill='%2324292E'/%3e%3cpath%20d='M46.3343%2035H49.674V30.674H54V27.3343H49.674V23H46.3343V27.3343H42V30.674H46.3343V35Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126408)'%3e%3cpath%20d='M77%2027H62V40H77V27Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%2010.5408V22.5H77V9.5H62.6268C62.4606%209.5%2062.3011%209.60966%2062.1836%209.80485C62.066%2010%2062%2010.2648%2062%2010.5408Z'%20fill='url(%23paint2_linear_1248_126408)'/%3e%3cpath%20d='M69.4792%2036.5C70.8085%2036.5%2071.7528%2035.7757%2071.75%2034.7605C71.7528%2034.0418%2071.2958%2033.5285%2070.4208%2033.423V33.3774C71.0771%2033.2804%2071.5423%2032.827%2071.5395%2032.1711C71.5423%2031.2186%2070.706%2030.5%2069.4903%2030.5C68.2663%2030.5%2067.3746%2031.23%2067.3635%2032.2681H68.6734C68.6845%2031.8688%2069.0334%2031.6008%2069.4903%2031.6008C69.9251%2031.6008%2070.2214%2031.8717%2070.2186%2032.2624C70.2214%2032.6673%2069.8725%2032.9468%2069.3685%2032.9468H68.8174V33.9506H69.3685C69.9417%2033.9506%2070.3155%2034.2414%2070.31%2034.6521C70.3155%2035.0656%2069.9721%2035.3536%2069.4848%2035.3536C69.0001%2035.3536%2068.6429%2035.0884%2068.6291%2034.7034H67.25C67.2611%2035.7586%2068.1832%2036.5%2069.4792%2036.5Z'%20fill='white'/%3e%3cpath%20d='M67%2019.4362H68.5663V18.7145H68.6149C68.8155%2019.1261%2069.2621%2019.5%2070.0129%2019.5C71.1133%2019.5%2072%2018.729%2072%2017.213C72%2015.642%2071.0615%2014.9261%2070.0227%2014.9261C69.2362%2014.9261%2068.8058%2015.3377%2068.6149%2015.7464H68.5825V13.5H67V19.4362ZM68.5502%2017.2101C68.5502%2016.4826%2068.8867%2016.0333%2069.466%2016.0333C70.0518%2016.0333%2070.3754%2016.4942%2070.3754%2017.2101C70.3754%2017.929%2070.0518%2018.3957%2069.466%2018.3957C68.8867%2018.3957%2068.5502%2017.9319%2068.5502%2017.2101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126408)'%3e%3cpath%20d='M96%2027H81V40H96V27Z'%20fill='%233865AB'/%3e%3cpath%20d='M81%2022.5H96V10.5408C96%2010.2648%2095.934%2010%2095.8164%209.80485C95.6989%209.60966%2095.5394%209.5%2095.3732%209.5H81V22.5Z'%20fill='url(%23paint3_linear_1248_126408)'/%3e%3cpath%20d='M88.6058%2019.5C90.0564%2019.5%2090.9563%2018.7082%2091%2017.5095H89.4654C89.405%2018.0237%2089.0759%2018.3044%2088.6259%2018.3044C88.0484%2018.3044%2087.6723%2017.847%2087.6723%2016.9858C87.6723%2016.1309%2088.0517%2015.6735%2088.6259%2015.6735C89.096%2015.6735%2089.4016%2015.9732%2089.4654%2016.4685H91C90.9631%2015.276%2090.0363%2014.5%2088.6024%2014.5C86.9805%2014.5%2086%2015.5158%2086%2017.0016C86%2018.4811%2086.9738%2019.5%2088.6058%2019.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M68.1855%2043.75H67V48.6802H68.1855V43.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M69.9898%2048.7428C70.5086%2048.7428%2070.8674%2048.543%2071.071%2048.165H71.1001V48.6802H72.2153V46.1669C72.2153%2045.3846%2071.5147%2044.9344%2070.5668%2044.9344C69.5655%2044.9344%2068.9982%2045.4351%2068.9037%2046.1092L69.997%2046.1477C70.048%2045.9118%2070.2443%2045.7673%2070.5571%2045.7673C70.848%2045.7673%2071.0322%2045.907%2071.0322%2046.1549V46.1669C71.0322%2046.3932%2070.7849%2046.4414%2070.1498%2046.4968C69.3958%2046.5593%2068.7655%2046.8362%2068.7655%2047.6547C68.7655%2048.3865%2069.277%2048.7428%2069.9898%2048.7428ZM70.3558%2047.9724C70.0819%2047.9724%2069.888%2047.8424%2069.888%2047.5969C69.888%2047.3586%2070.077%2047.2141%2070.414%2047.1636C70.6346%2047.1323%2070.9062%2047.0841%2071.0395%2047.0143V47.3658C71.0395%2047.7269%2070.734%2047.9724%2070.3558%2047.9724Z'%20fill='%2324292E'/%3e%3cpath%20d='M72.9402%2048.6802H74.1135V48.0808H74.1499C74.3002%2048.4226%2074.6347%2048.7331%2075.1972%2048.7331C76.0214%2048.7331%2076.6857%2048.0928%2076.6857%2046.8338C76.6857%2045.529%2075.9827%2044.9344%2075.2045%2044.9344C74.6153%2044.9344%2074.2929%2045.2762%2074.1499%2045.6157H74.1256V43.75H72.9402V48.6802ZM74.1014%2046.8314C74.1014%2046.2271%2074.3535%2045.854%2074.7875%2045.854C75.2263%2045.854%2075.4687%2046.2368%2075.4687%2046.8314C75.4687%2047.4284%2075.2263%2047.816%2074.7875%2047.816C74.3535%2047.816%2074.1014%2047.4308%2074.1014%2046.8314Z'%20fill='%2324292E'/%3e%3cpath%20d='M79.0476%2048.75C80.0246%2048.75%2080.667%2048.2806%2080.8028%2047.5536L79.7143%2047.5223C79.6221%2047.7678%2079.3797%2047.9002%2079.0694%2047.9002C78.6136%2047.9002%2078.3324%2047.5993%2078.3324%2047.1467V47.1154H80.8149V46.8217C80.8149%2045.6036%2080.0682%2044.9344%2079.0112%2044.9344C77.8863%2044.9344%2077.1639%2045.6999%2077.1639%2046.8458C77.1639%2048.0302%2077.8766%2048.75%2079.0476%2048.75ZM78.3324%2046.4318C78.3494%2046.0634%2078.6427%2045.7842%2079.0355%2045.7842C79.4258%2045.7842%2079.707%2046.0538%2079.7118%2046.4318H78.3324Z'%20fill='%2324292E'/%3e%3cpath%20d='M82.6059%2043.75H81.4204V48.6802H82.6059V43.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M83.5932%2048.0037H87.0623V47.0384H83.5932V48.0037ZM83.5932%2046.3475H87.0623V45.3822H83.5932V46.3475Z'%20fill='%2324292E'/%3e%3cpath%20d='M90.3333%2043.75H89.2206L87.9963%2044.5059V45.5362L89.1066%2044.8622H89.1357V48.6802H90.3333V43.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M109.907%2035C110.601%2035%20115.933%2031%20115.933%2029C115.933%2027%20110.736%2023%20109.907%2023C109.078%2023%20108.402%2023.5%20108.402%2024.4756C108.402%2025.4512%20111.907%2027.9206%20111.907%2027.9206C111.907%2027.9206%20104.254%2027.25%20104%2027.9206C103.746%2028.5911%20103.746%2029.4089%20104%2030.0794C104.254%2030.75%20111.907%2030.0794%20111.907%2030.0794C111.907%2030.0794%20108.402%2032.75%20108.402%2033.5301C108.402%2034.3103%20109.212%2035%20109.907%2035Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip4_1248_126408)'%3e%3cpath%20d='M124%205.80064V15H148V5H125.003L124%205L124%205.80064Z'%20fill='url(%23paint4_linear_1248_126408)'/%3e%3cpath%20d='M134.774%2012.5C135.526%2012.5%20136.046%2012.2377%20136.342%2011.7415H136.384V12.4178H138V9.1182C138%208.09102%20136.985%207.5%20135.611%207.5C134.16%207.5%20133.337%208.1574%20133.2%209.04235L134.785%209.09292C134.859%208.78319%20135.143%208.59355%20135.597%208.59355C136.018%208.59355%20136.285%208.77686%20136.285%209.1024V9.1182C136.285%209.4153%20135.927%209.47851%20135.006%209.5512C133.914%209.63338%20133%209.99684%20133%2011.0714C133%2012.0322%20133.741%2012.5%20134.774%2012.5ZM135.305%2011.4886C134.908%2011.4886%20134.627%2011.318%20134.627%2010.9956C134.627%2010.6827%20134.901%2010.493%20135.389%2010.4267C135.709%2010.3856%20136.103%2010.3224%20136.296%2010.2307V10.6922C136.296%2011.1662%20135.853%2011.4886%20135.305%2011.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M148%2018H124V27.5H148V18Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M148%2030.75H124V40.25H148V30.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M148%2043.5H124V53H148V43.5Z'%20fill='%233865AB'/%3e%3cpath%20d='M137%2019.75H135.572L134%2020.6699V21.9238L135.425%2021.1035H135.463V25.75H137V19.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M134.087%2038.5H138.5V37.3468H136.084V37.3092L136.797%2036.6561C138.09%2035.5376%20138.427%2034.9682%20138.427%2034.289C138.427%2033.2225%20137.551%2032.5%20136.198%2032.5C134.879%2032.5%20133.997%2033.2543%20134%2034.4595H135.365C135.365%2033.9249%20135.697%2033.6156%20136.192%2033.6156C136.678%2033.6156%20137.03%2033.9133%20137.03%2034.4017C137.03%2034.8439%20136.751%2035.1445%20136.262%2035.5809L134.087%2037.4711V38.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M135.979%2051.25C137.308%2051.25%20138.253%2050.5257%20138.25%2049.5105C138.253%2048.7918%20137.796%2048.2785%20136.921%2048.173V48.1274C137.577%2048.0304%20138.042%2047.577%20138.04%2046.9211C138.042%2045.9686%20137.206%2045.25%20135.99%2045.25C134.766%2045.25%20133.875%2045.98%20133.864%2047.0181H135.173C135.184%2046.6188%20135.533%2046.3508%20135.99%2046.3508C136.425%2046.3508%20136.721%2046.6217%20136.719%2047.0124C136.721%2047.4173%20136.372%2047.6968%20135.868%2047.6968H135.317V48.7006H135.868C136.442%2048.7006%20136.816%2048.9914%20136.81%2049.4021C136.816%2049.8156%20136.472%2050.1036%20135.985%2050.1036C135.5%2050.1036%20135.143%2049.8384%20135.129%2049.4534H133.75C133.761%2050.5086%20134.683%2051.25%20135.979%2051.25Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126408'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126408'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126408'%20x1='62'%20y1='16.0052'%20x2='77'%20y2='16.0052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126408'%20x1='81'%20y1='16.0052'%20x2='96'%20y2='16.0052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126408'%20x1='124.008'%20y1='10.004'%20x2='148.008'%20y2='10.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126408'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126408'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126408'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%209.5)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126408'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%209.5)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1248_126408'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(124%205)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_54 = "data:image/svg+xml,%3csvg%20width='125'%20height='58'%20viewBox='0%200%20125%2058'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126711)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126711)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126711)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1248_126711)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0778%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2124%2030%2047.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126711)'%3e%3cpath%20d='M62%201.04083V13H77V0H62.6268C62.4606%200%2062.3011%200.109659%2062.1836%200.304853C62.066%200.500047%2062%200.764787%2062%201.04083Z'%20fill='url(%23paint2_linear_1248_126711)'/%3e%3cpath%20d='M77%2017.5H62V30.5H77V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2035H62V48H77V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M70.5%2021H69.0716L67.5%2021.9199V23.1738L68.9253%2022.3535H68.9627V27H70.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.3373%2044.5H71.75V43.3468H69.3341V43.3092L70.0472%2042.6561C71.3396%2041.5376%2071.6772%2040.9682%2071.6772%2040.289C71.6772%2039.2225%2070.8011%2038.5%2069.4476%2038.5C68.129%2038.5%2067.2471%2039.2543%2067.25%2040.4595H68.6151C68.6151%2039.9249%2068.947%2039.6156%2069.4418%2039.6156C69.9279%2039.6156%2070.2801%2039.9133%2070.2801%2040.4017C70.2801%2040.8439%2070.0006%2041.1445%2069.5116%2041.5809L67.3373%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7744%209.5C69.5264%209.5%2070.0464%209.23767%2070.3415%208.74147H70.3837V9.41783H72V6.1182C72%205.09102%2070.9845%204.5%2069.6107%204.5C68.1595%204.5%2067.3373%205.1574%2067.2003%206.04235L68.785%206.09292C68.8587%205.78319%2069.1434%205.59355%2069.5966%205.59355C70.0183%205.59355%2070.2853%205.77686%2070.2853%206.1024V6.1182C70.2853%206.4153%2069.9269%206.47851%2069.0063%206.5512C67.9136%206.63338%2067%206.99684%2067%208.07143C67%209.03224%2067.7414%209.5%2068.7744%209.5ZM69.305%208.48862C68.9079%208.48862%2068.6268%208.31795%2068.6268%207.99558C68.6268%207.68268%2068.9009%207.49305%2069.3893%207.42668C69.7091%207.38559%2070.1026%207.32238%2070.2959%207.23072V7.69216C70.2959%208.16625%2069.8531%208.48862%2069.305%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126711)'%3e%3cpath%20d='M96%2017.5H81V30.5H96V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M96%2035H81V48H96V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M81%201.04083V13H96V0H81.6268C81.4606%200%2081%200%2081%200C81%200%2081%200.764787%2081%201.04083Z'%20fill='url(%23paint3_linear_1248_126711)'/%3e%3cpath%20d='M86%209.68623H87.5663V8.96449H87.6149C87.8155%209.37609%2088.2621%209.75%2089.0129%209.75C90.1133%209.75%2091%208.97898%2091%207.46304C91%205.89203%2090.0615%205.17609%2089.0227%205.17609C88.2362%205.17609%2087.8058%205.58768%2087.6149%205.99638H87.5825V3.75H86V9.68623ZM87.5502%207.46015C87.5502%206.73261%2087.8867%206.28333%2088.466%206.28333C89.0518%206.28333%2089.3754%206.7442%2089.3754%207.46015C89.3754%208.17899%2089.0518%208.64565%2088.466%208.64565C87.8867%208.64565%2087.5502%208.18188%2087.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1248_126711)'%3e%3cpath%20d='M100%2013H124V1.04083C124%200.764787%20123.894%200.500047%20123.706%200.304853C123.518%200.109659%20123.263%200%20122.997%200L100%200V13Z'%20fill='url(%23paint4_linear_1248_126711)'/%3e%3cpath%20d='M105.185%204H104V8.93019H105.185V4Z'%20fill='%2324292E'/%3e%3cpath%20d='M106.99%208.99278C107.509%208.99278%20107.867%208.79297%20108.071%208.41502H108.1V8.93019H109.215V6.41695C109.215%205.63457%20108.515%205.1844%20107.567%205.1844C106.566%205.1844%20105.998%205.68512%20105.904%206.35917L106.997%206.39769C107.048%206.16177%20107.244%206.01733%20107.557%206.01733C107.848%206.01733%20108.032%206.15696%20108.032%206.40491V6.41695C108.032%206.64324%20107.785%206.69138%20107.15%206.74675C106.396%206.80934%20105.766%207.08618%20105.766%207.90467C105.766%208.63649%20106.277%208.99278%20106.99%208.99278ZM107.356%208.22244C107.082%208.22244%20106.888%208.09244%20106.888%207.84689C106.888%207.60857%20107.077%207.46413%20107.414%207.41358C107.635%207.38228%20107.906%207.33414%20108.039%207.26432V7.61579C108.039%207.97689%20107.734%208.22244%20107.356%208.22244Z'%20fill='%2324292E'/%3e%3cpath%20d='M109.94%208.93019H111.114V8.33077H111.15C111.3%208.6726%20111.635%208.98315%20112.197%208.98315C113.021%208.98315%20113.686%208.3428%20113.686%207.08377C113.686%205.77901%20112.983%205.1844%20112.204%205.1844C111.615%205.1844%20111.293%205.52624%20111.15%205.86567H111.126V4H109.94V8.93019ZM111.101%207.08137C111.101%206.47713%20111.354%206.104%20111.787%206.104C112.226%206.104%20112.469%206.48676%20112.469%207.08137C112.469%207.67838%20112.226%208.06596%20111.787%208.06596C111.354%208.06596%20111.101%207.68079%20111.101%207.08137Z'%20fill='%2324292E'/%3e%3cpath%20d='M116.048%209C117.025%209%20117.667%208.53057%20117.803%207.80356L116.714%207.77227C116.622%208.01781%20116.38%208.15022%20116.069%208.15022C115.614%208.15022%20115.332%207.8493%20115.332%207.39673V7.36543H117.815V7.07174C117.815%205.85363%20117.068%205.1844%20116.011%205.1844C114.886%205.1844%20114.164%205.94993%20114.164%207.09581C114.164%208.28021%20114.877%209%20116.048%209ZM115.332%206.68175C115.349%206.31343%20115.643%206.03418%20116.035%206.03418C116.426%206.03418%20116.707%206.3038%20116.712%206.68175H115.332Z'%20fill='%2324292E'/%3e%3cpath%20d='M119.606%204H118.42V8.93019H119.606V4Z'%20fill='%2324292E'/%3e%3cpath%20d='M124%2017.5H100V30.5H124V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2035H100V48H124V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M113.5%2021H112.072L110.5%2021.9199V23.1738L111.925%2022.3535H111.963V27H113.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2039H112.072L110.5%2039.9199V41.1738L111.925%2040.3535H111.963V45H113.5V39Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M9.18549%2051H8V55.9302H9.18549V51Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.9898%2055.9928C11.5086%2055.9928%2011.8674%2055.793%2012.071%2055.415H12.1001V55.9302H13.2153V53.4169C13.2153%2052.6346%2012.5147%2052.1844%2011.5668%2052.1844C10.5655%2052.1844%209.99823%2052.6851%209.90369%2053.3592L10.997%2053.3977C11.048%2053.1618%2011.2443%2053.0173%2011.5571%2053.0173C11.848%2053.0173%2012.0322%2053.157%2012.0322%2053.4049V53.4169C12.0322%2053.6432%2011.7849%2053.6914%2011.1498%2053.7468C10.3958%2053.8093%209.7655%2054.0862%209.7655%2054.9047C9.7655%2055.6365%2010.277%2055.9928%2010.9898%2055.9928ZM11.3558%2055.2224C11.0819%2055.2224%2010.888%2055.0924%2010.888%2054.8469C10.888%2054.6086%2011.077%2054.4641%2011.414%2054.4136C11.6346%2054.3823%2011.9062%2054.3341%2012.0395%2054.2643V54.6158C12.0395%2054.9769%2011.734%2055.2224%2011.3558%2055.2224Z'%20fill='%2324292E'/%3e%3cpath%20d='M13.9402%2055.9302H15.1135V55.3308H15.1499C15.3002%2055.6726%2015.6347%2055.9831%2016.1972%2055.9831C17.0214%2055.9831%2017.6857%2055.3428%2017.6857%2054.0838C17.6857%2052.779%2016.9827%2052.1844%2016.2045%2052.1844C15.6153%2052.1844%2015.2929%2052.5262%2015.1499%2052.8657H15.1256V51H13.9402V55.9302ZM15.1014%2054.0814C15.1014%2053.4771%2015.3535%2053.104%2015.7875%2053.104C16.2263%2053.104%2016.4687%2053.4868%2016.4687%2054.0814C16.4687%2054.6784%2016.2263%2055.066%2015.7875%2055.066C15.3535%2055.066%2015.1014%2054.6808%2015.1014%2054.0814Z'%20fill='%2324292E'/%3e%3cpath%20d='M20.0476%2056C21.0246%2056%2021.667%2055.5306%2021.8028%2054.8036L20.7143%2054.7723C20.6221%2055.0178%2020.3797%2055.1502%2020.0694%2055.1502C19.6136%2055.1502%2019.3324%2054.8493%2019.3324%2054.3967V54.3654H21.8149V54.0717C21.8149%2052.8536%2021.0682%2052.1844%2020.0112%2052.1844C18.8863%2052.1844%2018.1639%2052.9499%2018.1639%2054.0958C18.1639%2055.2802%2018.8766%2056%2020.0476%2056ZM19.3324%2053.6818C19.3494%2053.3134%2019.6427%2053.0342%2020.0355%2053.0342C20.4258%2053.0342%2020.707%2053.3038%2020.7118%2053.6818H19.3324Z'%20fill='%2324292E'/%3e%3cpath%20d='M23.6059%2051H22.4204V55.9302H23.6059V51Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.5932%2055.2537H28.0623V54.2884H24.5932V55.2537ZM24.5932%2053.5975H28.0623V52.6322H24.5932V53.5975Z'%20fill='%2324292E'/%3e%3cpath%20d='M31.3333%2051H30.2206L28.9963%2051.7559V52.7862L30.1066%2052.1122H30.1357V55.9302H31.3333V51Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126711'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126711'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126711'%20x1='62'%20y1='6.5052'%20x2='77'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126711'%20x1='81'%20y1='6.5052'%20x2='96'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126711'%20x1='100'%20y1='6.5052'%20x2='124'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126711'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126711'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126711'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(62)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126711'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(81)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1248_126711'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(100)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_55 = "data:image/svg+xml,%3csvg%20width='108'%20height='48'%20viewBox='0%200%20108%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126481)'%3e%3cpath%20d='M0%200.800642V10H24V1.05456e-06H1.00292L0.000198677%200L0%200.800642Z'%20fill='url(%23paint0_linear_1248_126481)'/%3e%3cpath%20d='M24%2013H0V22.5H24V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2025.75H0V35.25H24V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%2038.5H0V48H24V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M13%2014.75H11.5716L10%2015.6699V16.9238L11.4253%2016.1035H11.4627V20.75H13V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M9.83733%2033.5H14.25V32.3468H11.8341V32.3092L12.5472%2031.6561C13.8396%2030.5376%2014.1772%2029.9682%2014.1772%2029.289C14.1772%2028.2225%2013.3011%2027.5%2011.9476%2027.5C10.629%2027.5%209.7471%2028.2543%209.75001%2029.4595H11.1151C11.1151%2028.9249%2011.447%2028.6156%2011.9418%2028.6156C12.4279%2028.6156%2012.7801%2028.9133%2012.7801%2029.4017C12.7801%2029.8439%2012.5006%2030.1445%2012.0116%2030.5809L9.83733%2032.4711V33.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M11.9792%2046.25C13.3085%2046.25%2014.2528%2045.5257%2014.25%2044.5105C14.2528%2043.7918%2013.7958%2043.2785%2012.9208%2043.173V43.1274C13.5771%2043.0304%2014.0423%2042.577%2014.0395%2041.9211C14.0423%2040.9686%2013.206%2040.25%2011.9903%2040.25C10.7663%2040.25%209.87462%2040.98%209.86354%2042.0181H11.1734C11.1845%2041.6188%2011.5334%2041.3508%2011.9903%2041.3508C12.4251%2041.3508%2012.7214%2041.6217%2012.7186%2042.0124C12.7214%2042.4173%2012.3725%2042.6968%2011.8685%2042.6968H11.3174V43.7006H11.8685C12.4417%2043.7006%2012.8155%2043.9914%2012.81%2044.4021C12.8155%2044.8156%2012.4721%2045.1036%2011.9848%2045.1036C11.5001%2045.1036%2011.1429%2044.8384%2011.1291%2044.4534H9.75C9.76108%2045.5086%2010.6832%2046.25%2011.9792%2046.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.7744%207.5C11.5264%207.5%2012.0464%207.23767%2012.3415%206.74147H12.3837V7.41783H14V4.1182C14%203.09102%2012.9845%202.5%2011.6107%202.5C10.1595%202.5%209.33732%203.1574%209.20028%204.04235L10.785%204.09292C10.8587%203.78319%2011.1434%203.59355%2011.5966%203.59355C12.0183%203.59355%2012.2853%203.77686%2012.2853%204.1024V4.1182C12.2853%204.4153%2011.9269%204.47851%2011.0063%204.5512C9.91356%204.63338%209%204.99684%209%206.07143C9%207.03224%209.74139%207.5%2010.7744%207.5ZM11.305%206.48862C10.9079%206.48862%2010.6268%206.31795%2010.6268%205.99558C10.6268%205.68268%2010.9009%205.49305%2011.3893%205.42668C11.7091%205.38559%2012.1026%205.32238%2012.2959%205.23072V5.69216C12.2959%206.16625%2011.8531%206.48862%2011.305%206.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M32.5%2019H55.5V29H32.5V19Z'%20stroke='%2324292E'/%3e%3cpath%20d='M36.0776%2026.5H40V25.539H37.8525V25.5077L38.4864%2024.9634C39.6352%2024.0313%2039.9353%2023.5568%2039.9353%2022.9908C39.9353%2022.1021%2039.1565%2021.5%2037.9534%2021.5C36.7814%2021.5%2035.9974%2022.1286%2036%2023.1329H37.2135C37.2135%2022.6874%2037.5084%2022.4297%2037.9483%2022.4297C38.3803%2022.4297%2038.6934%2022.6777%2038.6934%2023.0848C38.6934%2023.4533%2038.445%2023.7038%2038.0104%2024.0674L36.0776%2025.6426V26.5Z'%20fill='%2326262A'/%3e%3cpath%20d='M37.3525%2025.539V26H36.5776V25.8801L38.026%2024.6997L37.5268%2025.1284L37.3525%2025.278V25.5077V25.539ZM39.4353%2022.9908C39.4353%2023.2453%2039.359%2023.5204%2038.6951%2024.1273C38.9687%2023.8557%2039.1934%2023.5298%2039.1934%2023.0848C39.1934%2022.7428%2039.0569%2022.4371%2038.8075%2022.2243C38.7381%2022.1651%2038.6631%2022.1156%2038.5841%2022.0751C38.7959%2022.1308%2038.9657%2022.2137%2039.0935%2022.3106C39.3183%2022.481%2039.4353%2022.7084%2039.4353%2022.9908ZM36.8547%2022.3253C36.9643%2022.2347%2037.1045%2022.1569%2037.275%2022.1C37.2042%2022.1413%2037.137%2022.1906%2037.0748%2022.2487C36.9565%2022.3591%2036.8684%2022.4896%2036.8089%2022.6329H36.6079C36.6683%2022.512%2036.7522%2022.41%2036.8547%2022.3253Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cmask%20id='path-12-inside-1_1248_126481'%20fill='white'%3e%3cpath%20d='M51.8597%2022.6397C51.7708%2022.5502%2051.6506%2022.5%2051.5253%2022.5C51.4%2022.5%2051.2798%2022.5502%2051.1909%2022.6397L49.4881%2024.3398L47.8091%2022.6397C47.7202%2022.5502%2047.6%2022.5%2047.4747%2022.5C47.3494%2022.5%2047.2292%2022.5502%2047.1403%2022.6397C47.0958%2022.6843%2047.0606%2022.7374%2047.0365%2022.7959C47.0124%2022.8545%2047%2022.9172%2047%2022.9806C47%2023.044%2047.0124%2023.1068%2047.0365%2023.1653C47.0606%2023.2239%2047.0958%2023.277%2047.1403%2023.3216L49.1514%2025.3579C49.1955%2025.403%2049.2479%2025.4387%2049.3057%2025.4631C49.3635%2025.4874%2049.4255%2025.5%2049.4881%2025.5C49.5508%2025.5%2049.6128%2025.4874%2049.6706%2025.4631C49.7284%2025.4387%2049.7808%2025.403%2049.8249%2025.3579L51.8597%2023.3216C51.9042%2023.277%2051.9394%2023.2239%2051.9635%2023.1653C51.9876%2023.1068%2052%2023.044%2052%2022.9806C52%2022.9172%2051.9876%2022.8545%2051.9635%2022.7959C51.9394%2022.7374%2051.9042%2022.6843%2051.8597%2022.6397Z'/%3e%3c/mask%3e%3cpath%20d='M51.8597%2022.6397C51.7708%2022.5502%2051.6506%2022.5%2051.5253%2022.5C51.4%2022.5%2051.2798%2022.5502%2051.1909%2022.6397L49.4881%2024.3398L47.8091%2022.6397C47.7202%2022.5502%2047.6%2022.5%2047.4747%2022.5C47.3494%2022.5%2047.2292%2022.5502%2047.1403%2022.6397C47.0958%2022.6843%2047.0606%2022.7374%2047.0365%2022.7959C47.0124%2022.8545%2047%2022.9172%2047%2022.9806C47%2023.044%2047.0124%2023.1068%2047.0365%2023.1653C47.0606%2023.2239%2047.0958%2023.277%2047.1403%2023.3216L49.1514%2025.3579C49.1955%2025.403%2049.2479%2025.4387%2049.3057%2025.4631C49.3635%2025.4874%2049.4255%2025.5%2049.4881%2025.5C49.5508%2025.5%2049.6128%2025.4874%2049.6706%2025.4631C49.7284%2025.4387%2049.7808%2025.403%2049.8249%2025.3579L51.8597%2023.3216C51.9042%2023.277%2051.9394%2023.2239%2051.9635%2023.1653C51.9876%2023.1068%2052%2023.044%2052%2022.9806C52%2022.9172%2051.9876%2022.8545%2051.9635%2022.7959C51.9394%2022.7374%2051.9042%2022.6843%2051.8597%2022.6397Z'%20fill='%2326262A'/%3e%3cpath%20d='M51.8597%2022.6397L51.1503%2023.3445L51.1511%2023.3453L51.8597%2022.6397ZM51.5253%2022.5V21.5V22.5ZM51.1909%2022.6397L51.8975%2023.3473L51.9003%2023.3445L51.1909%2022.6397ZM49.4881%2024.3398L48.7766%2025.0425L49.4832%2025.7579L50.1947%2025.0474L49.4881%2024.3398ZM47.8091%2022.6397L48.5206%2021.937L48.5185%2021.9349L47.8091%2022.6397ZM47.1403%2022.6397L47.8489%2023.3453L47.8497%2023.3445L47.1403%2022.6397ZM47.1403%2023.3216L47.8518%2022.6189L47.8489%2022.616L47.1403%2023.3216ZM49.1514%2025.3579L49.8658%2024.6582L49.8629%2024.6553L49.1514%2025.3579ZM49.8249%2025.3579L49.1175%2024.6511L49.1105%2024.6582L49.8249%2025.3579ZM51.8597%2023.3216L52.5671%2024.0285L52.5683%2024.0272L51.8597%2023.3216ZM52.5691%2021.9349C52.2938%2021.6578%2051.9188%2021.5%2051.5253%2021.5V23.5C51.3824%2023.5%2051.2478%2023.4426%2051.1503%2023.3445L52.5691%2021.9349ZM51.5253%2021.5C51.1318%2021.5%2050.7568%2021.6578%2050.4815%2021.9349L51.9003%2023.3445C51.8028%2023.4426%2051.6682%2023.5%2051.5253%2023.5V21.5ZM50.4844%2021.932L48.7816%2023.6321L50.1947%2025.0474L51.8975%2023.3473L50.4844%2021.932ZM50.1996%2023.6371L48.5206%2021.937L47.0976%2023.3423L48.7766%2025.0425L50.1996%2023.6371ZM48.5185%2021.9349C48.2432%2021.6578%2047.8682%2021.5%2047.4747%2021.5V23.5C47.3318%2023.5%2047.1972%2023.4426%2047.0997%2023.3445L48.5185%2021.9349ZM47.4747%2021.5C47.0812%2021.5%2046.7062%2021.6578%2046.4309%2021.9349L47.8497%2023.3445C47.7522%2023.4426%2047.6176%2023.5%2047.4747%2023.5V21.5ZM46.4317%2021.9341C46.2941%2022.0722%2046.1855%2022.236%2046.1117%2022.4154L47.9613%2023.1765C47.9356%2023.2389%2047.8976%2023.2964%2047.8489%2023.3453L46.4317%2021.9341ZM46.1117%2022.4154C46.0379%2022.5949%2046%2022.787%2046%2022.9806H48C48%2023.0475%2047.9869%2023.114%2047.9613%2023.1765L46.1117%2022.4154ZM46%2022.9806C46%2023.1743%2046.0379%2023.3664%2046.1117%2023.5458L47.9613%2022.7848C47.9869%2022.8472%2048%2022.9138%2048%2022.9806H46ZM46.1117%2023.5458C46.1855%2023.7253%2046.2941%2023.889%2046.4317%2024.0272L47.8489%2022.616C47.8976%2022.6649%2047.9356%2022.7224%2047.9613%2022.7848L46.1117%2023.5458ZM46.4288%2024.0243L48.4399%2026.0606L49.8629%2024.6553L47.8518%2022.6189L46.4288%2024.0243ZM48.437%2026.0577C48.5735%2026.197%2048.7365%2026.3083%2048.9171%2026.3844L49.6944%2024.5417C49.7594%2024.5691%2049.8175%2024.6089%2049.8658%2024.6582L48.437%2026.0577ZM48.9171%2026.3844C49.0976%2026.4606%2049.2918%2026.5%2049.4881%2026.5V24.5C49.5593%2024.5%2049.6294%2024.5143%2049.6944%2024.5417L48.9171%2026.3844ZM49.4881%2026.5C49.6845%2026.5%2049.8787%2026.4606%2050.0592%2026.3844L49.2819%2024.5417C49.3468%2024.5143%2049.417%2024.5%2049.4881%2024.5V26.5ZM50.0592%2026.3844C50.2398%2026.3083%2050.4028%2026.197%2050.5393%2026.0577L49.1105%2024.6582C49.1588%2024.6089%2049.2169%2024.5691%2049.2819%2024.5417L50.0592%2026.3844ZM50.5323%2026.0648L52.5671%2024.0285L51.1523%2022.6148L49.1175%2024.6511L50.5323%2026.0648ZM52.5683%2024.0272C52.7059%2023.889%2052.8145%2023.7253%2052.8883%2023.5458L51.0387%2022.7848C51.0644%2022.7224%2051.1024%2022.6649%2051.1511%2022.616L52.5683%2024.0272ZM52.8883%2023.5458C52.9621%2023.3664%2053%2023.1743%2053%2022.9806H51C51%2022.9138%2051.0131%2022.8472%2051.0387%2022.7848L52.8883%2023.5458ZM53%2022.9806C53%2022.787%2052.9621%2022.5949%2052.8883%2022.4154L51.0387%2023.1765C51.0131%2023.114%2051%2023.0475%2051%2022.9806H53ZM52.8883%2022.4154C52.8145%2022.236%2052.7059%2022.0722%2052.5683%2021.9341L51.1511%2023.3453C51.1024%2023.2964%2051.0644%2023.2389%2051.0387%2023.1765L52.8883%2022.4154Z'%20fill='%23CCCCDC'%20fill-opacity='0.25'%20mask='url(%23path-12-inside-1_1248_126481)'/%3e%3cpath%20d='M69.9067%2030C70.6011%2030%2075.9327%2026%2075.9327%2024C75.9327%2022%2070.7357%2018%2069.9067%2018C69.0778%2018%2068.4023%2018.5%2068.4023%2019.4756C68.4023%2020.4512%2071.9067%2022.9206%2071.9067%2022.9206C71.9067%2022.9206%2064.2539%2022.25%2064%2022.9206C63.7461%2023.5911%2063.7461%2024.4089%2064%2025.0794C64.2539%2025.75%2071.9067%2025.0794%2071.9067%2025.0794C71.9067%2025.0794%2068.4023%2027.75%2068.4023%2028.5301C68.4023%2029.3103%2069.2124%2030%2069.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_126481)'%3e%3cpath%20d='M84%206.80064V16H108V6H85.0029L84.0002%206L84%206.80064Z'%20fill='url(%23paint1_linear_1248_126481)'/%3e%3cpath%20d='M108%2019H84V28.5H108V19Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M108%2019H84V28.5H108V19Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M108%2031.75H84V41.25H108V31.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M97%2020.75H95.5716L94%2021.6699V22.9238L95.4253%2022.1035H95.4627V26.75H97V20.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M93.8373%2039.5H98.25V38.3468H95.8341V38.3092L96.5472%2037.6561C97.8396%2036.5376%2098.1772%2035.9682%2098.1772%2035.289C98.1772%2034.2225%2097.3011%2033.5%2095.9476%2033.5C94.629%2033.5%2093.7471%2034.2543%2093.75%2035.4595H95.1151C95.1151%2034.9249%2095.447%2034.6156%2095.9418%2034.6156C96.4279%2034.6156%2096.7801%2034.9133%2096.7801%2035.4017C96.7801%2035.8439%2096.5006%2036.1445%2096.0116%2036.5809L93.8373%2038.4711V39.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M94.7744%2013.5C95.5264%2013.5%2096.0464%2013.2377%2096.3415%2012.7415H96.3837V13.4178H98V10.1182C98%209.09102%2096.9845%208.5%2095.6107%208.5C94.1595%208.5%2093.3373%209.1574%2093.2003%2010.0424L94.785%2010.0929C94.8587%209.78319%2095.1434%209.59355%2095.5966%209.59355C96.0183%209.59355%2096.2853%209.77686%2096.2853%2010.1024V10.1182C96.2853%2010.4153%2095.9269%2010.4785%2095.0063%2010.5512C93.9136%2010.6334%2093%2010.9968%2093%2012.0714C93%2013.0322%2093.7414%2013.5%2094.7744%2013.5ZM95.305%2012.4886C94.9079%2012.4886%2094.6268%2012.318%2094.6268%2011.9956C94.6268%2011.6827%2094.9009%2011.493%2095.3893%2011.4267C95.7091%2011.3856%2096.1026%2011.3224%2096.2959%2011.2307V11.6922C96.2959%2012.1662%2095.8531%2012.4886%2095.305%2012.4886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126481'%20x1='0.00781255'%20y1='5.004'%20x2='24.0078'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126481'%20x1='84.0078'%20y1='11.004'%20x2='108.008'%20y2='11.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126481'%3e%3crect%20width='24'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126481'%3e%3crect%20width='24'%20height='36'%20fill='white'%20transform='translate(84%206)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_56 = "data:image/svg+xml,%3csvg%20width='177'%20height='48'%20viewBox='0%200%20177%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1248_126108)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126108)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126108)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1248_126108)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M46.3343%2030H49.674V25.674H54V22.3343H49.674V18H46.3343V22.3343H42V25.674H46.3343V30Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip2_1248_126108)'%3e%3cpath%20d='M77%2026.25H62V39.25H77V26.25Z'%20fill='%233865AB'/%3e%3cpath%20d='M62%209.79083V21.75H77V8.75H62.6268C62.4606%208.75%2062.3011%208.85966%2062.1836%209.05485C62.066%209.25005%2062%209.51479%2062%209.79083Z'%20fill='url(%23paint2_linear_1248_126108)'/%3e%3cpath%20d='M69.4792%2035.75C70.8085%2035.75%2071.7528%2035.0257%2071.75%2034.0105C71.7528%2033.2918%2071.2958%2032.7785%2070.4208%2032.673V32.6274C71.0771%2032.5304%2071.5423%2032.077%2071.5395%2031.4211C71.5423%2030.4686%2070.706%2029.75%2069.4903%2029.75C68.2663%2029.75%2067.3746%2030.48%2067.3635%2031.5181H68.6734C68.6845%2031.1188%2069.0334%2030.8508%2069.4903%2030.8508C69.9251%2030.8508%2070.2214%2031.1217%2070.2186%2031.5124C70.2214%2031.9173%2069.8725%2032.1968%2069.3685%2032.1968H68.8174V33.2006H69.3685C69.9417%2033.2006%2070.3155%2033.4914%2070.31%2033.9021C70.3155%2034.3156%2069.9721%2034.6036%2069.4848%2034.6036C69.0001%2034.6036%2068.6429%2034.3384%2068.6291%2033.9534H67.25C67.2611%2035.0086%2068.1832%2035.75%2069.4792%2035.75Z'%20fill='white'/%3e%3cpath%20d='M67%2018.4362H68.5663V17.7145H68.6149C68.8155%2018.1261%2069.2621%2018.5%2070.0129%2018.5C71.1133%2018.5%2072%2017.729%2072%2016.213C72%2014.642%2071.0615%2013.9261%2070.0227%2013.9261C69.2362%2013.9261%2068.8058%2014.3377%2068.6149%2014.7464H68.5825V12.5H67V18.4362ZM68.5502%2016.2101C68.5502%2015.4826%2068.8867%2015.0333%2069.466%2015.0333C70.0518%2015.0333%2070.3754%2015.4942%2070.3754%2016.2101C70.3754%2016.929%2070.0518%2017.3957%2069.466%2017.3957C68.8867%2017.3957%2068.5502%2016.9319%2068.5502%2016.2101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126108)'%3e%3cpath%20d='M96%2026.25H81V39.25H96V26.25Z'%20fill='%233865AB'/%3e%3cpath%20d='M81%2021.75H96V9.79083C96%209.51479%2095.934%209.25005%2095.8164%209.05485C95.6989%208.85966%2095.5394%208.75%2095.3732%208.75H81V21.75Z'%20fill='url(%23paint3_linear_1248_126108)'/%3e%3cpath%20d='M88.6058%2018.5C90.0564%2018.5%2090.9563%2017.7082%2091%2016.5095H89.4654C89.405%2017.0237%2089.0759%2017.3044%2088.6259%2017.3044C88.0484%2017.3044%2087.6723%2016.847%2087.6723%2015.9858C87.6723%2015.1309%2088.0517%2014.6735%2088.6259%2014.6735C89.096%2014.6735%2089.4016%2014.9732%2089.4654%2015.4685H91C90.9631%2014.276%2090.0363%2013.5%2088.6024%2013.5C86.9805%2013.5%2086%2014.5158%2086%2016.0016C86%2017.4811%2086.9738%2018.5%2088.6058%2018.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M109.907%2030C110.601%2030%20115.933%2026%20115.933%2024C115.933%2022%20110.736%2018%20109.907%2018C109.078%2018%20108.402%2018.5%20108.402%2019.4756C108.402%2020.4512%20111.907%2022.9206%20111.907%2022.9206C111.907%2022.9206%20104.254%2022.25%20104%2022.9206C103.746%2023.5911%20103.746%2024.4089%20104%2025.0794C104.254%2025.75%20111.907%2025.0794%20111.907%2025.0794C111.907%2025.0794%20108.402%2027.75%20108.402%2028.5301C108.402%2029.3103%20109.212%2030%20109.907%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M124%200.720576V9H139V0H124.627C124.461%200%20124.301%200.0759177%20124.184%200.211052C124.066%200.346186%20124%200.529468%20124%200.720576Z'%20fill='url(%23paint4_linear_1248_126108)'/%3e%3cpath%20d='M139%2013H124V22H139V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2026H124V35H139V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M139%2039H124V48H139V39Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M124.5%2039.5H138.5V47.5H124.5V39.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M132.5%2015H131.31L130%2015.7666V16.8115L131.188%2016.1279H131.219V20H132.5V15Z'%20fill='%2324292E'/%3e%3cpath%20d='M130.072%2033H133.724V32.039H131.724V32.0077L132.315%2031.4634C133.384%2030.5313%20133.663%2030.0568%20133.663%2029.4908C133.663%2028.6021%20132.938%2028%20131.818%2028C130.727%2028%20129.998%2028.6286%20130%2029.6329H131.13C131.13%2029.1874%20131.404%2028.9297%20131.814%2028.9297C132.216%2028.9297%20132.507%2029.1777%20132.507%2029.5848C132.507%2029.9533%20132.276%2030.2038%20131.871%2030.5674L130.072%2032.1426V33Z'%20fill='%2324292E'/%3e%3cpath%20d='M129%207.68623H130.566V6.96449H130.615C130.816%207.37609%20131.262%207.75%20132.013%207.75C133.113%207.75%20134%206.97898%20134%205.46304C134%203.89203%20133.061%203.17609%20132.023%203.17609C131.236%203.17609%20130.806%203.58768%20130.615%203.99638H130.583V1.75H129V7.68623ZM130.55%205.46015C130.55%204.73261%20130.887%204.28333%20131.466%204.28333C132.052%204.28333%20132.375%204.7442%20132.375%205.46015C132.375%206.17899%20132.052%206.64565%20131.466%206.64565C130.887%206.64565%20130.55%206.18188%20130.55%205.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M143%200.720576V9H158V0H143.627C143.461%200%20143.301%200.0759177%20143.184%200.211052C143.066%200.346186%20143%200.529468%20143%200.720576Z'%20fill='url(%23paint5_linear_1248_126108)'/%3e%3cpath%20d='M158%2013H143V22H158V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2026H143V35H158V26Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M158%2039H143V48H158V39Z'%20fill='%233865AB'/%3e%3cpath%20d='M150.913%2046C152.054%2046%20152.864%2045.3964%20152.862%2044.5504C152.864%2043.9515%20152.472%2043.5238%20151.721%2043.4358V43.3978C152.284%2043.317%20152.683%2042.9392%20152.681%2042.3926C152.683%2041.5989%20151.966%2041%20150.923%2041C149.872%2041%20149.107%2041.6084%20149.097%2042.4734H150.221C150.231%2042.1407%20150.53%2041.9173%20150.923%2041.9173C151.296%2041.9173%20151.55%2042.1431%20151.548%2042.4686C151.55%2042.8061%20151.25%2043.039%20150.818%2043.039H150.345V43.8755H150.818C151.31%2043.8755%20151.631%2044.1179%20151.626%2044.4601C151.631%2044.8047%20151.336%2045.0447%20150.918%2045.0447C150.502%2045.0447%20150.195%2044.8237%20150.183%2044.5029H149C149.01%2045.3821%20149.801%2046%20150.913%2046Z'%20fill='white'/%3e%3cpath%20d='M149.774%207.5C150.526%207.5%20151.046%207.23767%20151.342%206.74147H151.384V7.41783H153V4.1182C153%203.09102%20151.985%202.5%20150.611%202.5C149.16%202.5%20148.337%203.1574%20148.2%204.04235L149.785%204.09292C149.859%203.78319%20150.143%203.59355%20150.597%203.59355C151.018%203.59355%20151.285%203.77686%20151.285%204.1024V4.1182C151.285%204.4153%20150.927%204.47851%20150.006%204.5512C148.914%204.63338%20148%204.99684%20148%206.07143C148%207.03224%20148.741%207.5%20149.774%207.5ZM150.305%206.48862C149.908%206.48862%20149.627%206.31795%20149.627%205.99558C149.627%205.68268%20149.901%205.49305%20150.389%205.42668C150.709%205.38559%20151.103%205.32238%20151.296%205.23072V5.69216C151.296%206.16625%20150.853%206.48862%20150.305%206.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M162%209H177V0.720576C177%200.529468%20176.934%200.346186%20176.816%200.211052C176.699%200.0759177%20176.539%200%20176.373%200L162%200V9Z'%20fill='url(%23paint6_linear_1248_126108)'/%3e%3cpath%20d='M177%2039H162V48H177V39Z'%20fill='%233865AB'/%3e%3cpath%20d='M177%2026H162V35H177V26Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M162.5%2026.5H176.5V34.5H162.5V26.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M177%2013H162V22H177V13Z'%20fill='%23CCCCDC'%20fill-opacity='0.4'/%3e%3cpath%20d='M162.5%2013.5H176.5V21.5H162.5V13.5Z'%20stroke='%23CCCCDC'%20stroke-opacity='0.25'/%3e%3cpath%20d='M169.606%207.5C171.056%207.5%20171.956%206.7082%20172%205.50946H170.465C170.405%206.02366%20170.076%206.30442%20169.626%206.30442C169.048%206.30442%20168.672%205.847%20168.672%204.9858C168.672%204.13092%20169.052%203.6735%20169.626%203.6735C170.096%203.6735%20170.402%203.97319%20170.465%204.46845H172C171.963%203.27602%20171.036%202.5%20169.602%202.5C167.981%202.5%20167%203.51577%20167%205.00158C167%206.48107%20167.974%207.5%20169.606%207.5Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126108'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126108'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126108'%20x1='62'%20y1='15.2552'%20x2='77'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126108'%20x1='81'%20y1='15.2552'%20x2='96'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126108'%20x1='124'%20y1='4.5036'%20x2='139'%20y2='4.5036'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1248_126108'%20x1='143'%20y1='4.5036'%20x2='158'%20y2='4.5036'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_1248_126108'%20x1='162'%20y1='4.5036'%20x2='177'%20y2='4.5036'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126108'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126108'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126108'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(62%208.75)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126108'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%208.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_57 = "data:image/svg+xml,%3csvg%20width='154'%20height='48'%20viewBox='0%200%20154%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%202.57189C15.0002%202.53241%2014.9927%202.49327%2014.9777%202.45672C14.9628%202.42018%2014.9408%202.38693%2014.913%202.3589L13.641%201.087C13.613%201.0592%2013.5797%201.0372%2013.5432%201.02227C13.5066%201.00734%2013.4675%200.999777%2013.428%201.00001C13.3885%200.999777%2013.3494%201.00734%2013.3128%201.02227C13.2763%201.0372%2013.243%201.0592%2013.215%201.087L12.366%201.93594L9.087%205.21469C9.0592%205.24272%209.0372%205.27596%209.02227%205.31251C9.00734%205.34906%208.99978%205.3882%209.00001%205.42767V6.69958C9.00001%206.77914%209.03161%206.85544%209.08787%206.9117C9.14413%206.96795%209.22044%206.99956%209.3%206.99956H10.572C10.614%207.00184%2010.656%206.99528%2010.6952%206.98029C10.7345%206.9653%2010.7702%206.94223%2010.8%206.91256L14.061%203.63381L14.913%202.79987C14.9404%202.7708%2014.9627%202.73733%2014.979%202.70088C14.9819%202.67697%2014.9819%202.65279%2014.979%202.62888C14.9804%202.61492%2014.9804%202.60085%2014.979%202.58689L15%202.57189ZM10.449%206.3996H9.6V5.55067L12.579%202.57189L13.428%203.42082L10.449%206.3996ZM13.851%202.99786L13.002%202.14892L13.428%201.72595L14.274%202.57189L13.851%202.99786Z'%20fill='white'/%3e%3cg%20clip-path='url(%23clip0_1248_126295)'%3e%3cpath%20d='M0%2011.3611V27H24V10H1.00293C0.736933%2010%200.481835%2010.1434%200.29375%2010.3987C0.105665%2010.6539%200%2011.0001%200%2011.3611Z'%20fill='url(%23paint0_linear_1248_126295)'/%3e%3cpath%20d='M24%2031H0V48H24V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M10.7744%2021.5C11.5264%2021.5%2012.0464%2021.2377%2012.3415%2020.7415H12.3837V21.4178H14V18.1182C14%2017.091%2012.9845%2016.5%2011.6107%2016.5C10.1595%2016.5%209.33732%2017.1574%209.20028%2018.0424L10.785%2018.0929C10.8587%2017.7832%2011.1434%2017.5936%2011.5966%2017.5936C12.0183%2017.5936%2012.2853%2017.7769%2012.2853%2018.1024V18.1182C12.2853%2018.4153%2011.9269%2018.4785%2011.0063%2018.5512C9.91356%2018.6334%209%2018.9968%209%2020.0714C9%2021.0322%209.74139%2021.5%2010.7744%2021.5ZM11.305%2020.4886C10.9079%2020.4886%2010.6268%2020.318%2010.6268%2019.9956C10.6268%2019.6827%2010.9009%2019.493%2011.3893%2019.4267C11.7091%2019.3856%2012.1026%2019.3224%2012.2959%2019.2307V19.6922C12.2959%2020.1662%2011.8531%2020.4886%2011.305%2020.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M13%2036.5H11.5716L10%2037.4199V38.6738L11.4253%2037.8535H11.4627V42.5H13V36.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M35.7976%202.10148C35.7643%202.06962%2035.725%202.04465%2035.6821%202.02799C35.5969%201.993%2035.5013%201.993%2035.4161%202.02799C35.3732%202.04465%2035.3339%202.06962%2035.3007%202.10148L34.6008%202.80134C34.5349%202.86723%2034.4979%202.9566%2034.4979%203.04979C34.4979%203.14297%2034.5349%203.23234%2034.6008%203.29823C34.6667%203.36413%2034.7561%203.40115%2034.8493%203.40115C34.9424%203.40115%2035.0318%203.36413%2035.0977%203.29823L35.1992%203.19326V5.84921C35.1992%205.94202%2035.2361%206.03103%2035.3017%206.09665C35.3673%206.16227%2035.4563%206.19914%2035.5491%206.19914C35.6419%206.19914%2035.7309%206.16227%2035.7965%206.09665C35.8622%206.03103%2035.899%205.94202%2035.899%205.84921V3.19326L36.0005%203.29823C36.033%203.33103%2036.0718%203.35707%2036.1144%203.37483C36.157%203.3926%2036.2028%203.40174%2036.249%203.40174C36.2952%203.40174%2036.3409%203.3926%2036.3835%203.37483C36.4262%203.35707%2036.4649%203.33103%2036.4974%203.29823C36.5302%203.2657%2036.5562%203.227%2036.574%203.18436C36.5918%203.14172%2036.6009%203.09598%2036.6009%203.04979C36.6009%203.00359%2036.5918%202.95785%2036.574%202.91521C36.5562%202.87257%2036.5302%202.83387%2036.4974%202.80134L35.7976%202.10148ZM37.6487%202.69986H41.148C41.2408%202.69986%2041.3298%202.66299%2041.3954%202.59737C41.461%202.53174%2041.4979%202.44274%2041.4979%202.34993C41.4979%202.25712%2041.461%202.16812%2041.3954%202.10249C41.3298%202.03687%2041.2408%202%2041.148%202H37.6487C37.5559%202%2037.4669%202.03687%2037.4012%202.10249C37.3356%202.16812%2037.2988%202.25712%2037.2988%202.34993C37.2988%202.44274%2037.3356%202.53174%2037.4012%202.59737C37.4669%202.66299%2037.5559%202.69986%2037.6487%202.69986V2.69986ZM41.148%205.49928H37.6487C37.5559%205.49928%2037.4669%205.53615%2037.4012%205.60178C37.3356%205.6674%2037.2988%205.75641%2037.2988%205.84921C37.2988%205.94202%2037.3356%206.03103%2037.4012%206.09665C37.4669%206.16227%2037.5559%206.19914%2037.6487%206.19914H41.148C41.2408%206.19914%2041.3298%206.16227%2041.3954%206.09665C41.461%206.03103%2041.4979%205.94202%2041.4979%205.84921C41.4979%205.75641%2041.461%205.6674%2041.3954%205.60178C41.3298%205.53615%2041.2408%205.49928%2041.148%205.49928ZM41.148%203.74964H37.6487C37.5559%203.74964%2037.4669%203.78651%2037.4012%203.85213C37.3356%203.91776%2037.2988%204.00676%2037.2988%204.09957C37.2988%204.19238%2037.3356%204.28138%2037.4012%204.34701C37.4669%204.41263%2037.5559%204.4495%2037.6487%204.4495H41.148C41.2408%204.4495%2041.3298%204.41263%2041.3954%204.34701C41.461%204.28138%2041.4979%204.19238%2041.4979%204.09957C41.4979%204.00676%2041.461%203.91776%2041.3954%203.85213C41.3298%203.78651%2041.2408%203.74964%2041.148%203.74964Z'%20fill='white'/%3e%3cg%20clip-path='url(%23clip1_1248_126295)'%3e%3cpath%20d='M26%2027H50V11.3611V10H48.9971H26V27Z'%20fill='url(%23paint1_linear_1248_126295)'/%3e%3cpath%20d='M50%2031H26V48H50V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M35.5%2021.4362H37.0663V20.7145H37.1149C37.3155%2021.1261%2037.7621%2021.5%2038.5129%2021.5C39.6133%2021.5%2040.5%2020.729%2040.5%2019.213C40.5%2017.642%2039.5615%2016.9261%2038.5227%2016.9261C37.7362%2016.9261%2037.3058%2017.3377%2037.1149%2017.7464H37.0825V15.5H35.5V21.4362ZM37.0502%2019.2101C37.0502%2018.4826%2037.3867%2018.0333%2037.966%2018.0333C38.5518%2018.0333%2038.8754%2018.4942%2038.8754%2019.2101C38.8754%2019.929%2038.5518%2020.3957%2037.966%2020.3957C37.3867%2020.3957%2037.0502%2019.9319%2037.0502%2019.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M35.5873%2042.5H40V41.3468H37.5841V41.3092L38.2972%2040.6561C39.5896%2039.5376%2039.9272%2038.9682%2039.9272%2038.289C39.9272%2037.2225%2039.0511%2036.5%2037.6976%2036.5C36.379%2036.5%2035.4971%2037.2543%2035.5%2038.4595H36.8651C36.8651%2037.9249%2037.197%2037.6156%2037.6918%2037.6156C38.1779%2037.6156%2038.5301%2037.9133%2038.5301%2038.4017C38.5301%2038.8439%2038.2506%2039.1445%2037.7616%2039.5809L35.5873%2041.4711V42.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M63.6798%202.22255C63.785%202.20642%2063.8912%202.19841%2063.9976%202.19856C64.9512%202.19856%2065.8477%202.88522%2066.3695%203.99767C66.2897%204.16696%2066.1995%204.33119%2066.0996%204.48943C66.0679%204.53854%2066.0512%204.59587%2066.0516%204.65434C66.0523%204.71978%2066.0743%204.78321%2066.1144%204.83494C66.1545%204.88667%2066.2104%204.92387%2066.2736%204.94086C66.3368%204.95784%2066.4038%204.95369%2066.4645%204.92903C66.5251%204.90437%2066.576%204.86055%2066.6093%204.80427C66.7491%204.58476%2066.8704%204.35409%2066.9722%204.11461C66.9883%204.0772%2066.9966%204.0369%2066.9966%203.99617C66.9966%203.95544%2066.9883%203.91514%2066.9722%203.87773C66.3665%202.47142%2065.227%201.59886%2063.9976%201.59886C63.8569%201.59815%2063.7164%201.61019%2063.5778%201.63484C63.5385%201.64153%2063.5008%201.65592%2063.467%201.67717C63.4332%201.69842%2063.4039%201.72613%2063.3807%201.75871C63.3576%201.79128%2063.3412%201.82809%2063.3323%201.86704C63.3234%201.90598%2063.3223%201.94629%2063.329%201.98566C63.3357%202.02504%2063.35%202.06271%2063.3713%202.09653C63.3926%202.13035%2063.4203%202.15965%2063.4528%202.18276C63.4854%202.20587%2063.5222%202.22234%2063.5612%202.23122C63.6001%202.24011%2063.6404%202.24123%2063.6798%202.23454V2.22255ZM61.5119%201.08611C61.4839%201.05815%2061.4507%201.03597%2061.4142%201.02084C61.3777%201.00571%2061.3385%200.997925%2061.299%200.997925C61.2594%200.997925%2061.2203%201.00571%2061.1838%201.02084C61.1472%201.03597%2061.114%201.05815%2061.0861%201.08611C61.0296%201.14257%2060.9979%201.21915%2060.9979%201.299C60.9979%201.37885%2061.0296%201.45543%2061.0861%201.5119L62.0156%202.43844C61.5915%202.8467%2061.254%203.33619%2061.0231%203.87773C61.0066%203.91556%2060.9981%203.95639%2060.9981%203.99767C60.9981%204.03895%2061.0066%204.07978%2061.0231%204.11761C61.6288%205.52391%2062.7682%206.39648%2063.9976%206.39648C64.5365%206.39276%2065.0626%206.23231%2065.5119%205.93471L66.4834%206.90923C66.5113%206.93733%2066.5444%206.95964%2066.581%206.97486C66.6175%206.99009%2066.6567%206.99792%2066.6963%206.99792C66.7359%206.99792%2066.7751%206.99009%2066.8116%206.97486C66.8482%206.95964%2066.8813%206.93733%2066.9092%206.90923C66.9373%206.88135%2066.9596%206.84819%2066.9748%206.81165C66.9901%206.77511%2066.9979%206.73592%2066.9979%206.69633C66.9979%206.65675%2066.9901%206.61756%2066.9748%206.58102C66.9596%206.54448%2066.9373%206.51131%2066.9092%206.48344L61.5119%201.08611ZM63.4189%203.84175L64.1536%204.57638C64.1029%204.59092%2064.0504%204.59799%2063.9976%204.59737C63.8386%204.59737%2063.6861%204.53419%2063.5736%204.42172C63.4611%204.30926%2063.3979%204.15672%2063.3979%203.99767C63.3973%203.94495%2063.4044%203.89242%2063.4189%203.84175ZM63.9976%205.79678C63.0441%205.79678%2062.1476%205.11012%2061.6288%203.99767C61.8225%203.57%2062.0975%203.18404%2062.4384%202.86123L62.9691%203.39797C62.8445%203.62549%2062.797%203.88731%2062.8337%204.14413C62.8704%204.40096%2062.9895%204.63895%2063.1729%204.8224C63.3564%205.00586%2063.5943%205.12488%2063.8512%205.16162C64.108%205.19835%2064.3698%205.15082%2064.5973%205.02616L65.0741%205.49693C64.7476%205.6891%2064.3765%205.79247%2063.9976%205.79678Z'%20fill='white'/%3e%3cg%20clip-path='url(%23clip2_1248_126295)'%3e%3cpath%20d='M52%2027H76V11.3611C76%2011.0001%2075.8943%2010.6539%2075.7063%2010.3987C75.5182%2010.1434%2075.2631%2010%2074.9971%2010H52V27Z'%20fill='url(%23paint2_linear_1248_126295)'/%3e%3cpath%20d='M76%2031H52V48H76V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M64.1058%2021.5C65.5564%2021.5%2066.4563%2020.7082%2066.5%2019.5095H64.9654C64.905%2020.0237%2064.5759%2020.3044%2064.1259%2020.3044C63.5484%2020.3044%2063.1723%2019.847%2063.1723%2018.9858C63.1723%2018.1309%2063.5517%2017.6735%2064.1259%2017.6735C64.596%2017.6735%2064.9016%2017.9732%2064.9654%2018.4685H66.5C66.4631%2017.276%2065.5363%2016.5%2064.1024%2016.5C62.4805%2016.5%2061.5%2017.5158%2061.5%2019.0016C61.5%2020.4811%2062.4738%2021.5%2064.1058%2021.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M63.9769%2042.5C65.4538%2042.5%2066.5031%2041.7757%2066.5%2040.7605C66.5031%2040.0418%2065.9954%2039.5285%2065.0231%2039.423V39.3774C65.7523%2039.2804%2066.2692%2038.827%2066.2661%2038.1711C66.2692%2037.2186%2065.34%2036.5%2063.9892%2036.5C62.6292%2036.5%2061.6385%2037.23%2061.6262%2038.2681H63.0815C63.0938%2037.8688%2063.4815%2037.6008%2063.9892%2037.6008C64.4723%2037.6008%2064.8015%2037.8717%2064.7985%2038.2624C64.8015%2038.6673%2064.4138%2038.9468%2063.8538%2038.9468H63.2415V39.9506H63.8538C64.4908%2039.9506%2064.9061%2040.2414%2064.9%2040.6521C64.9061%2041.0656%2064.5246%2041.3536%2063.9831%2041.3536C63.4446%2041.3536%2063.0477%2041.0884%2063.0323%2040.7034H61.5C61.5123%2041.7586%2062.5369%2042.5%2063.9769%2042.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M89.9067%2030C90.6011%2030%2095.9327%2026%2095.9327%2024C95.9327%2022%2090.7357%2018%2089.9067%2018C89.0778%2018%2088.4023%2018.5%2088.4023%2019.4756C88.4023%2020.4512%2091.9067%2022.9206%2091.9067%2022.9206C91.9067%2022.9206%2084.2539%2022.25%2084%2022.9206C83.7461%2023.5911%2083.7461%2024.4089%2084%2025.0794C84.2539%2025.75%2091.9067%2025.0794%2091.9067%2025.0794C91.9067%2025.0794%2088.4023%2027.75%2088.4023%2028.5301C88.4023%2029.3103%2089.2124%2030%2089.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip3_1248_126295)'%3e%3cpath%20d='M130%2027H154V11.3611C154%2011.0001%20153.894%2010.6539%20153.706%2010.3987C153.518%2010.1434%20153.263%2010%20152.997%2010H130V27Z'%20fill='url(%23paint3_linear_1248_126295)'/%3e%3cpath%20d='M154%2031H130V48H154V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M143%2036.5H141.572L140%2037.4199V38.6738L141.425%2037.8535H141.463V42.5H143V36.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M140.987%2021.5C141.738%2021.5%20142.184%2021.1261%20142.385%2020.7145H142.434V21.4362H144V15.5H142.417V17.7464H142.385C142.197%2017.3377%20141.764%2016.9261%20140.981%2016.9261C139.942%2016.9261%20139%2017.642%20139%2019.213C139%2020.729%20139.89%2021.5%20140.987%2021.5ZM141.537%2020.3957C140.951%2020.3957%20140.625%2019.929%20140.625%2019.2101C140.625%2018.4942%20140.948%2018.0333%20141.537%2018.0333C142.117%2018.0333%20142.453%2018.4826%20142.453%2019.2101C142.453%2019.9319%20142.113%2020.3957%20141.537%2020.3957Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip4_1248_126295)'%3e%3cpath%20d='M128%2031H104V48H128V31Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M104%2011.3611V27H128V10H105.003C104.737%2010%20104.482%2010.1434%20104.294%2010.3987C104.106%2010.6539%20104%2011.0001%20104%2011.3611Z'%20fill='url(%23paint4_linear_1248_126295)'/%3e%3cpath%20d='M113.5%2021.4362H115.066V20.7145H115.115C115.316%2021.1261%20115.762%2021.5%20116.513%2021.5C117.613%2021.5%20118.5%2020.729%20118.5%2019.213C118.5%2017.642%20117.561%2016.9261%20116.523%2016.9261C115.736%2016.9261%20115.306%2017.3377%20115.115%2017.7464H115.083V15.5H113.5V21.4362ZM115.05%2019.2101C115.05%2018.4826%20115.387%2018.0333%20115.966%2018.0333C116.552%2018.0333%20116.875%2018.4942%20116.875%2019.2101C116.875%2019.929%20116.552%2020.3957%20115.966%2020.3957C115.387%2020.3957%20115.05%2019.9319%20115.05%2019.2101Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.587%2042.5H118V41.3468H115.584V41.3092L116.297%2040.6561C117.59%2039.5376%20117.927%2038.9682%20117.927%2038.289C117.927%2037.2225%20117.051%2036.5%20115.698%2036.5C114.379%2036.5%20113.497%2037.2543%20113.5%2038.4595H114.865C114.865%2037.9249%20115.197%2037.6156%20115.692%2037.6156C116.178%2037.6156%20116.53%2037.9133%20116.53%2038.4017C116.53%2038.8439%20116.251%2039.1445%20115.762%2039.5809L113.587%2041.4711V42.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126295'%20x1='0'%20y1='18.5068'%20x2='24'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126295'%20x1='26'%20y1='18.5068'%20x2='50'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126295'%20x1='52'%20y1='18.5068'%20x2='76'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126295'%20x1='130'%20y1='18.5068'%20x2='154'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126295'%20x1='104'%20y1='18.5068'%20x2='128'%20y2='18.5068'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126295'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(0%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126295'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(26%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126295'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(52%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126295'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(130%2010)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip4_1248_126295'%3e%3crect%20width='24'%20height='38'%20fill='white'%20transform='translate(104%2010)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_58 = "data:image/svg+xml,%3csvg%20width='101'%20height='48'%20viewBox='0%200%20101%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126643)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M28.9067%2030C29.6011%2030%2034.9327%2026%2034.9327%2024C34.9327%2022%2029.7357%2018%2028.9067%2018C28.0778%2018%2027.4023%2018.5%2027.4023%2019.4756C27.4023%2020.4512%2030.9067%2022.9206%2030.9067%2022.9206C30.9067%2022.9206%2023.2539%2022.25%2023%2022.9206C22.7461%2023.5911%2022.7461%2024.4089%2023%2025.0794C23.2539%2025.75%2030.9067%2025.0794%2030.9067%2025.0794C30.9067%2025.0794%2027.4023%2027.75%2027.4023%2028.5301C27.4023%2029.3103%2028.2124%2030%2028.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M43%2010.0408V22H58V9H43.6268C43.4606%209%2043.3011%209.10966%2043.1836%209.30485C43.066%209.50005%2043%209.76479%2043%2010.0408Z'%20fill='url(%23paint1_linear_1248_126643)'/%3e%3cpath%20d='M58%2026.5H43V39.5H58V26.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M51.5%2030H50.0716L48.5%2030.9199V32.1738L49.9253%2031.3535H49.9627V36H51.5V30Z'%20fill='%2324292E'/%3e%3cpath%20d='M49.7744%2018.5C50.5264%2018.5%2051.0464%2018.2377%2051.3415%2017.7415H51.3837V18.4178H53V15.1182C53%2014.091%2051.9845%2013.5%2050.6107%2013.5C49.1595%2013.5%2048.3373%2014.1574%2048.2003%2015.0424L49.785%2015.0929C49.8587%2014.7832%2050.1434%2014.5936%2050.5966%2014.5936C51.0183%2014.5936%2051.2853%2014.7769%2051.2853%2015.1024V15.1182C51.2853%2015.4153%2050.9269%2015.4785%2050.0063%2015.5512C48.9136%2015.6334%2048%2015.9968%2048%2017.0714C48%2018.0322%2048.7414%2018.5%2049.7744%2018.5ZM50.305%2017.4886C49.9079%2017.4886%2049.6268%2017.318%2049.6268%2016.9956C49.6268%2016.6827%2049.9009%2016.493%2050.3893%2016.4267C50.7091%2016.3856%2051.1026%2016.3224%2051.2959%2016.2307V16.6922C51.2959%2017.1662%2050.8531%2017.4886%2050.305%2017.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M70.3343%2030H73.674V25.674H78V22.3343H73.674V18H70.3343V22.3343H66V25.674H70.3343V30Z'%20fill='%2324292E'/%3e%3cpath%20d='M86%2010.0408V22H101V9H86.6268C86.4606%209%2086.3011%209.10966%2086.1836%209.30485C86.066%209.50005%2086%209.76479%2086%2010.0408Z'%20fill='url(%23paint2_linear_1248_126643)'/%3e%3cpath%20d='M101%2026.5H86V39.5H101V26.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M92.7744%2018.5C93.5264%2018.5%2094.0464%2018.2377%2094.3415%2017.7415H94.3837V18.4178H96V15.1182C96%2014.091%2094.9845%2013.5%2093.6107%2013.5C92.1595%2013.5%2091.3373%2014.1574%2091.2003%2015.0424L92.785%2015.0929C92.8587%2014.7832%2093.1434%2014.5936%2093.5966%2014.5936C94.0183%2014.5936%2094.2853%2014.7769%2094.2853%2015.1024V15.1182C94.2853%2015.4153%2093.9269%2015.4785%2093.0063%2015.5512C91.9136%2015.6334%2091%2015.9968%2091%2017.0714C91%2018.0322%2091.7414%2018.5%2092.7744%2018.5ZM93.305%2017.4886C92.9079%2017.4886%2092.6268%2017.318%2092.6268%2016.9956C92.6268%2016.6827%2092.9009%2016.493%2093.3893%2016.4267C93.7091%2016.3856%2094.1026%2016.3224%2094.2959%2016.2307V16.6922C94.2959%2017.1662%2093.8531%2017.4886%2093.305%2017.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M91.0873%2036H95.5V34.8468H93.0841V34.8092L93.7972%2034.1561C95.0896%2033.0376%2095.4272%2032.4682%2095.4272%2031.789C95.4272%2030.7225%2094.5511%2030%2093.1976%2030C91.879%2030%2090.9971%2030.7543%2091%2031.9595H92.3651C92.3651%2031.4249%2092.697%2031.1156%2093.1918%2031.1156C93.6779%2031.1156%2094.0301%2031.4133%2094.0301%2031.9017C94.0301%2032.3439%2093.7506%2032.6445%2093.2616%2033.0809L91.0873%2034.9711V36Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126643'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126643'%20x1='43'%20y1='15.5052'%20x2='58'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126643'%20x1='86'%20y1='15.5052'%20x2='101'%20y2='15.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_59 = "data:image/svg+xml,%3csvg%20width='180'%20height='48'%20viewBox='0%200%20180%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%209.79071V21.7499H15V8.74988H0.626828C0.460583%208.74988%200.301147%208.85954%200.183594%209.05473C0.0660407%209.24992%200%209.51466%200%209.79071Z'%20fill='url(%23paint0_linear_1248_126664)'/%3e%3cpath%20d='M15%2026.2499H0V39.2499H15V26.2499Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2030H7.07158L5.5%2030.9199V32.1738L6.92531%2031.3535H6.96266V36H8.5V30Z'%20fill='%2324292E'/%3e%3cpath%20d='M19%209.79083V21.75H34V8.75H19.6268C19.4606%208.75%2019%208.75%2019%208.75C19%208.75%2019%209.51479%2019%209.79083Z'%20fill='url(%23paint1_linear_1248_126664)'/%3e%3cpath%20d='M34%2026.25H19V39.25H34V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M26.5739%2018.25C25.3778%2018.2443%2024.2472%2017.5199%2024.25%2015.3812C24.2557%2013.4192%2025.179%2012.25%2026.6165%2012.25C27.7784%2012.25%2028.5739%2013%2028.6903%2013.961H27.4773C27.3835%2013.5532%2027.0625%2013.308%2026.6165%2013.308C25.858%2013.308%2025.4602%2014.0152%2025.4545%2015.153H25.4943C25.7557%2014.6369%2026.321%2014.3289%2026.9602%2014.3289C27.9915%2014.3289%2028.7528%2015.1188%2028.75%2016.2139C28.7528%2017.403%2027.8693%2018.2557%2026.5739%2018.25ZM26.5682%2017.2804C27.1364%2017.2804%2027.5597%2016.8327%2027.5568%2016.2481C27.5597%2015.6692%2027.1449%2015.2215%2026.5767%2015.2215C26.0114%2015.2215%2025.5824%2015.6834%2025.5795%2016.2509C25.5795%2016.8213%2026%2017.2804%2026.5682%2017.2804Z'%20fill='%2324292E'/%3e%3cpath%20d='M26.2292%2035.75C27.5585%2035.75%2028.5028%2035.0257%2028.5%2034.0105C28.5028%2033.2918%2028.0458%2032.7785%2027.1708%2032.673V32.6274C27.8271%2032.5304%2028.2923%2032.077%2028.2895%2031.4211C28.2923%2030.4686%2027.456%2029.75%2026.2403%2029.75C25.0163%2029.75%2024.1246%2030.48%2024.1135%2031.5181H25.4234C25.4345%2031.1188%2025.7834%2030.8508%2026.2403%2030.8508C26.6751%2030.8508%2026.9714%2031.1217%2026.9686%2031.5124C26.9714%2031.9173%2026.6225%2032.1968%2026.1185%2032.1968H25.5674V33.2006H26.1185C26.6917%2033.2006%2027.0655%2033.4914%2027.06%2033.9021C27.0655%2034.3156%2026.7221%2034.6036%2026.2348%2034.6036C25.7501%2034.6036%2025.3929%2034.3384%2025.3791%2033.9534H24C24.0111%2035.0086%2024.9332%2035.75%2026.2292%2035.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M38%209.79083V21.75H53V8.75H38.6268C38.4606%208.75%2038%208.75%2038%208.75C38%208.75%2038%209.51479%2038%209.79083Z'%20fill='url(%23paint2_linear_1248_126664)'/%3e%3cpath%20d='M53%2026.25H38V39.25H53V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M43.6884%2018.25L46.3471%2013.3281V13.2871H43.25V12.25H47.75V13.3018L45.0882%2018.25H43.6884Z'%20fill='%2324292E'/%3e%3cpath%20d='M43%2034.6953V33.6963L45.5893%2029.75H47.2308V33.6787H48V34.6953H47.2308V35.75H45.977V34.6953H43ZM46.0012%2033.6787V31.1328H45.9528L44.3204%2033.6318V33.6787H46.0012Z'%20fill='%2324292E'/%3e%3cpath%20d='M57%2021.7499H72V9.79071C72%209.51466%2071.934%209.24992%2071.8164%209.05473C71.6989%208.85954%2071.5394%208.74988%2071.3732%208.74988H57V21.7499Z'%20fill='url(%23paint3_linear_1248_126664)'/%3e%3cpath%20d='M72%2026.2499H57V39.2499H72V26.2499Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M64.4602%2035.75C63.0525%2035.75%2062.0266%2035.0188%2062%2033.9957H63.3944C63.4276%2034.4552%2063.8891%2034.7673%2064.4602%2034.7673C65.1341%2034.7673%2065.6155%2034.3425%2065.6155%2033.7269C65.6155%2033.1055%2065.1242%2032.6749%2064.4402%2032.672C64.0385%2032.672%2063.6335%2032.8251%2063.4243%2033.0708L62.1461%2032.8714L62.4681%2029.75H66.6248V30.7731H63.6534L63.4774%2032.2558H63.5173C63.7563%2031.9639%2064.2709%2031.7471%2064.8685%2031.7471C66.0936%2031.7471%2067.0033%2032.5621%2067%2033.6951C67.0033%2034.8916%2065.9741%2035.75%2064.4602%2035.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M64.4986%2018.25C63.1902%2018.25%2062.2472%2017.5456%2062.25%2016.5989C62.2472%2015.8688%2062.7994%2015.2728%2063.5074%2015.1559V15.116C62.89%2014.9905%2062.4624%2014.4601%2062.4652%2013.8213C62.4624%2012.9173%2063.3233%2012.25%2064.4986%2012.25C65.671%2012.25%2066.5319%2012.9173%2066.5348%2013.8213C66.5319%2014.4629%2066.0986%2014.9905%2065.4926%2015.116V15.1559C66.1893%2015.2728%2066.7472%2015.8688%2066.75%2016.5989C66.7472%2017.5456%2065.807%2018.25%2064.4986%2018.25ZM64.4986%2017.3432C65.0791%2017.3432%2065.4728%2016.9981%2065.4728%2016.5019C65.4728%2015.9971%2065.0593%2015.6321%2064.4986%2015.6321C63.935%2015.6321%2063.5244%2015.9971%2063.5244%2016.5019C63.5244%2016.9952%2063.9152%2017.3432%2064.4986%2017.3432ZM64.4986%2014.7338C64.9857%2014.7338%2065.3369%2014.4116%2065.3369%2013.9496C65.3369%2013.4962%2064.9914%2013.1797%2064.4986%2013.1797C64.003%2013.1797%2063.6603%2013.4933%2063.6603%2013.9496C63.6603%2014.4116%2064.0087%2014.7338%2064.4986%2014.7338Z'%20fill='%2324292E'/%3e%3cpath%20d='M85.9067%2030C86.6011%2030%2091.9327%2026%2091.9327%2024C91.9327%2022%2086.7357%2018%2085.9067%2018C85.0778%2018%2084.4023%2018.5%2084.4023%2019.4756C84.4023%2020.4512%2087.9067%2022.9206%2087.9067%2022.9206C87.9067%2022.9206%2080.2539%2022.25%2080%2022.9206C79.7461%2023.5911%2079.7461%2024.4089%2080%2025.0794C80.2539%2025.75%2087.9067%2025.0794%2087.9067%2025.0794C87.9067%2025.0794%2084.4023%2027.75%2084.4023%2028.5301C84.4023%2029.3103%2085.2124%2030%2085.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126664)'%3e%3cpath%20d='M100%200.800641V10H124V0H101.003C100.737%200%20100.482%200.084353%20100.294%200.234502C100.106%200.384651%20100%200.588297%20100%200.800641Z'%20fill='url(%23paint4_linear_1248_126664)'/%3e%3cpath%20d='M124%2013H100V22.5H124V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2025.75H100V35.25H124V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2038.5H100V48H112H124V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M113.5%2040.25H112.072L110.5%2041.1699V42.4238L111.925%2041.6035H111.963V46.25H113.5V40.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2014.75H112.072L110.5%2015.6699V16.9238L111.925%2016.1035H111.963V20.75H113.5V14.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M113.5%2027.5H112.072L110.5%2028.4199V29.6738L111.925%2028.8535H111.963V33.5H113.5V27.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126664)'%3e%3cpath%20d='M152%2013H128V22.5H152V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M152%2025.75H128V35.25H152V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M152%2038.5H128V48H140H152V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M128%200.800641V10H152V1.05456e-06H129.003L128%200L128%200.800641Z'%20fill='url(%23paint5_linear_1248_126664)'/%3e%3cpath%20d='M139.979%2020.75C141.308%2020.75%20142.253%2020.0257%20142.25%2019.0105C142.253%2018.2918%20141.796%2017.7785%20140.921%2017.673V17.6274C141.577%2017.5304%20142.042%2017.077%20142.04%2016.4211C142.042%2015.4686%20141.206%2014.75%20139.99%2014.75C138.766%2014.75%20137.875%2015.48%20137.864%2016.5181H139.173C139.184%2016.1188%20139.533%2015.8508%20139.99%2015.8508C140.425%2015.8508%20140.721%2016.1217%20140.719%2016.5124C140.721%2016.9173%20140.372%2017.1968%20139.868%2017.1968H139.317V18.2006H139.868C140.442%2018.2006%20140.816%2018.4914%20140.81%2018.9021C140.816%2019.3156%20140.472%2019.6036%20139.985%2019.6036C139.5%2019.6036%20139.143%2019.3384%20139.129%2018.9534H137.75C137.761%2020.0086%20138.683%2020.75%20139.979%2020.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M137.75%2032.4453V31.4463L140.339%2027.5H141.981V31.4287H142.75V32.4453H141.981V33.5H140.727V32.4453H137.75ZM140.751%2031.4287V28.8828H140.703L139.07%2031.3818V31.4287H140.751Z'%20fill='%2324292E'/%3e%3cpath%20d='M140.21%2046.25C138.802%2046.25%20137.777%2045.5188%20137.75%2044.4957H139.144C139.178%2044.9552%20139.639%2045.2673%20140.21%2045.2673C140.884%2045.2673%20141.366%2044.8425%20141.366%2044.2269C141.366%2043.6055%20140.874%2043.1749%20140.19%2043.172C139.789%2043.172%20139.383%2043.3251%20139.174%2043.5708L137.896%2043.3714L138.218%2040.25H142.375V41.2731H139.403L139.227%2042.7558H139.267C139.506%2042.4639%20140.021%2042.2471%20140.619%2042.2471C141.844%2042.2471%20142.753%2043.0621%20142.75%2044.1951C142.753%2045.3916%20141.724%2046.25%20140.21%2046.25Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1248_126664)'%3e%3cpath%20d='M180%2013H156V22.5H180V13Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M180%2025.75H156V35.25H180V25.75Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M180%2038.5H156V48H168H180V38.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M156%2010H180V0.800641C180%200.588297%20179.894%200.384651%20179.706%200.234502C179.518%200.084353%20179.263%200%20178.997%200L156%200V10Z'%20fill='url(%23paint6_linear_1248_126664)'/%3e%3cpath%20d='M167.999%2046.25C166.69%2046.25%20165.747%2045.5456%20165.75%2044.5989C165.747%2043.8688%20166.299%2043.2728%20167.007%2043.1559V43.116C166.39%2042.9905%20165.962%2042.4601%20165.965%2041.8213C165.962%2040.9173%20166.823%2040.25%20167.999%2040.25C169.171%2040.25%20170.032%2040.9173%20170.035%2041.8213C170.032%2042.4629%20169.599%2042.9905%20168.993%2043.116V43.1559C169.689%2043.2728%20170.247%2043.8688%20170.25%2044.5989C170.247%2045.5456%20169.307%2046.25%20167.999%2046.25ZM167.999%2045.3432C168.579%2045.3432%20168.973%2044.9981%20168.973%2044.5019C168.973%2043.9971%20168.559%2043.6321%20167.999%2043.6321C167.435%2043.6321%20167.024%2043.9971%20167.024%2044.5019C167.024%2044.9952%20167.415%2045.3432%20167.999%2045.3432ZM167.999%2042.7338C168.486%2042.7338%20168.837%2042.4116%20168.837%2041.9496C168.837%2041.4962%20168.491%2041.1797%20167.999%2041.1797C167.503%2041.1797%20167.16%2041.4933%20167.16%2041.9496C167.16%2042.4116%20167.509%2042.7338%20167.999%2042.7338Z'%20fill='%2324292E'/%3e%3cpath%20d='M166.188%2033.5L168.847%2028.5781V28.5371H165.75V27.5H170.25V28.5518L167.588%2033.5H166.188Z'%20fill='%2324292E'/%3e%3cpath%20d='M168.074%2020.75C166.878%2020.7443%20165.747%2020.0199%20165.75%2017.8812C165.756%2015.9192%20166.679%2014.75%20168.116%2014.75C169.278%2014.75%20170.074%2015.5%20170.19%2016.461H168.977C168.884%2016.0532%20168.562%2015.808%20168.116%2015.808C167.358%2015.808%20166.96%2016.5152%20166.955%2017.653H166.994C167.256%2017.1369%20167.821%2016.8289%20168.46%2016.8289C169.491%2016.8289%20170.253%2017.6188%20170.25%2018.7139C170.253%2019.903%20169.369%2020.7557%20168.074%2020.75ZM168.068%2019.7804C168.636%2019.7804%20169.06%2019.3327%20169.057%2018.7481C169.06%2018.1692%20168.645%2017.7215%20168.077%2017.7215C167.511%2017.7215%20167.082%2018.1834%20167.08%2018.7509C167.08%2019.3213%20167.5%2019.7804%20168.068%2019.7804Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126664'%20x1='0'%20y1='15.2551'%20x2='15'%20y2='15.2551'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126664'%20x1='19'%20y1='15.2552'%20x2='34'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126664'%20x1='38'%20y1='15.2552'%20x2='53'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126664'%20x1='57'%20y1='15.2551'%20x2='72'%20y2='15.2551'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126664'%20x1='100'%20y1='5.004'%20x2='124'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_1248_126664'%20x1='128.008'%20y1='5.004'%20x2='152.008'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_1248_126664'%20x1='156'%20y1='5.004'%20x2='180'%20y2='5.004'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126664'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(100)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126664'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(128)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126664'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(156)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_60 = "data:image/svg+xml,%3csvg%20width='105'%20height='48'%20viewBox='0%200%20105%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126508)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126508)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1248_126508)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24%209.68623H25.5663V8.96449H25.6149C25.8155%209.37609%2026.2621%209.75%2027.0129%209.75C28.1133%209.75%2029%208.97898%2029%207.46304C29%205.89203%2028.0615%205.17609%2027.0227%205.17609C26.2362%205.17609%2025.8058%205.58768%2025.6149%205.99638H25.5825V3.75H24V9.68623ZM25.5502%207.46015C25.5502%206.73261%2025.8867%206.28333%2026.466%206.28333C27.0518%206.28333%2027.3754%206.7442%2027.3754%207.46015C27.3754%208.17899%2027.0518%208.64565%2026.466%208.64565C25.8867%208.64565%2025.5502%208.18188%2025.5502%207.46015Z'%20fill='%2324292E'/%3e%3cpath%20d='M26.4792%2027C27.8085%2027%2028.7528%2026.2757%2028.75%2025.2605C28.7528%2024.5418%2028.2958%2024.0285%2027.4208%2023.923V23.8774C28.0771%2023.7804%2028.5423%2023.327%2028.5395%2022.6711C28.5423%2021.7186%2027.706%2021%2026.4903%2021C25.2663%2021%2024.3746%2021.73%2024.3635%2022.7681H25.6734C25.6845%2022.3688%2026.0334%2022.1008%2026.4903%2022.1008C26.9251%2022.1008%2027.2214%2022.3717%2027.2186%2022.7624C27.2214%2023.1673%2026.8725%2023.4468%2026.3685%2023.4468H25.8174V24.4506H26.3685C26.9417%2024.4506%2027.3155%2024.7414%2027.31%2025.1521C27.3155%2025.5656%2026.9721%2025.8536%2026.4848%2025.8536C26.0001%2025.8536%2025.6429%2025.5884%2025.6291%2025.2034H24.25C24.2611%2026.2586%2025.1832%2027%2026.4792%2027Z'%20fill='%2324292E'/%3e%3cpath%20d='M24%2043.4453V42.4463L26.5893%2038.5H28.2308V42.4287H29V43.4453H28.2308V44.5H26.977V43.4453H24ZM27.0012%2042.4287V39.8828H26.9528L25.3204%2042.3818V42.4287H27.0012Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0778%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2124%2030%2047.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.7955%2020.1818H68.2727V20.6591C68.2727%2020.9123%2068.3733%2021.155%2068.5523%2021.3341C68.7313%2021.5131%2068.9741%2021.6136%2069.2273%2021.6136C69.4804%2021.6136%2069.7232%2021.5131%2069.9022%2021.3341C70.0812%2021.155%2070.1818%2020.9123%2070.1818%2020.6591V20.1818H70.6591C70.9123%2020.1818%2071.155%2020.0813%2071.3341%2019.9022C71.5131%2019.7232%2071.6136%2019.4804%2071.6136%2019.2273C71.6136%2018.9741%2071.5131%2018.7313%2071.3341%2018.5523C71.155%2018.3733%2070.9123%2018.2727%2070.6591%2018.2727H70.1818V17.7955C70.1818%2017.5423%2070.0812%2017.2995%2069.9022%2017.1205C69.7232%2016.9415%2069.4804%2016.8409%2069.2273%2016.8409C68.9741%2016.8409%2068.7313%2016.9415%2068.5523%2017.1205C68.3733%2017.2995%2068.2727%2017.5423%2068.2727%2017.7955V18.2727H67.7955C67.5423%2018.2727%2067.2995%2018.3733%2067.1205%2018.5523C66.9415%2018.7313%2066.8409%2018.9741%2066.8409%2019.2273C66.8409%2019.4804%2066.9415%2019.7232%2067.1205%2019.9022C67.2995%2020.0813%2067.5423%2020.1818%2067.7955%2020.1818ZM67.2036%2030.7964C67.3825%2030.9742%2067.6244%2031.0739%2067.8766%2031.0739C68.1288%2031.0739%2068.3707%2030.9742%2068.5495%2030.7964L69.2273%2030.1186L69.905%2030.7964C70.0838%2030.9742%2070.3258%2031.0739%2070.578%2031.0739C70.8301%2031.0739%2071.0721%2030.9742%2071.2509%2030.7964C71.4287%2030.6175%2071.5285%2030.3756%2071.5285%2030.1234C71.5285%2029.8712%2071.4287%2029.6293%2071.2509%2029.4505L70.5732%2028.7727L71.2509%2028.095C71.4073%2027.9124%2071.489%2027.6775%2071.4797%2027.4373C71.4704%2027.197%2071.3709%2026.9691%2071.2009%2026.7991C71.0309%2026.6291%2070.803%2026.5296%2070.5627%2026.5203C70.3225%2026.511%2070.0876%2026.5927%2069.905%2026.7491L69.2273%2027.4268L68.5495%2026.7491C68.3669%2026.5927%2068.132%2026.511%2067.8918%2026.5203C67.6516%2026.5296%2067.4237%2026.6291%2067.2537%2026.7991C67.0837%2026.9691%2066.9841%2027.197%2066.9748%2027.4373C66.9655%2027.6775%2067.0473%2027.9124%2067.2036%2028.095L67.8814%2028.7727L67.2036%2029.4505C67.0259%2029.6293%2066.9261%2029.8712%2066.9261%2030.1234C66.9261%2030.3756%2067.0259%2030.6175%2067.2036%2030.7964V30.7964ZM81.6364%2013.5H66.3636C65.6042%2013.5%2064.8758%2013.8017%2064.3387%2014.3387C63.8017%2014.8758%2063.5%2015.6042%2063.5%2016.3636V31.6364C63.5%2032.3959%2063.8017%2033.1242%2064.3387%2033.6613C64.8758%2034.1983%2065.6042%2034.5%2066.3636%2034.5H81.6364C82.3958%2034.5%2083.1242%2034.1983%2083.6613%2033.6613C84.1983%2033.1242%2084.5%2032.3959%2084.5%2031.6364V16.3636C84.5%2015.6042%2084.1983%2014.8758%2083.6613%2014.3387C83.1242%2013.8017%2082.3958%2013.5%2081.6364%2013.5V13.5ZM73.0455%2032.5909H66.3636C66.1105%2032.5909%2065.8677%2032.4903%2065.6887%2032.3113C65.5097%2032.1323%2065.4091%2031.8895%2065.4091%2031.6364V24.9545H73.0455V32.5909ZM73.0455%2023.0455H65.4091V16.3636C65.4091%2016.1105%2065.5097%2015.8677%2065.6887%2015.6887C65.8677%2015.5097%2066.1105%2015.4091%2066.3636%2015.4091H73.0455V23.0455ZM82.5909%2031.6364C82.5909%2031.8895%2082.4903%2032.1323%2082.3113%2032.3113C82.1323%2032.4903%2081.8895%2032.5909%2081.6364%2032.5909H74.9545V24.9545H82.5909V31.6364ZM82.5909%2023.0455H74.9545V15.4091H81.6364C81.8895%2015.4091%2082.1323%2015.5097%2082.3113%2015.6887C82.4903%2015.8677%2082.5909%2016.1105%2082.5909%2016.3636V23.0455ZM77.3409%2028.2955H80.2045C80.4577%2028.2955%2080.7005%2028.1949%2080.8795%2028.0159C81.0585%2027.8369%2081.1591%2027.5941%2081.1591%2027.3409C81.1591%2027.0878%2081.0585%2026.845%2080.8795%2026.6659C80.7005%2026.4869%2080.4577%2026.3864%2080.2045%2026.3864H77.3409C77.0877%2026.3864%2076.845%2026.4869%2076.6659%2026.6659C76.4869%2026.845%2076.3864%2027.0878%2076.3864%2027.3409C76.3864%2027.5941%2076.4869%2027.8369%2076.6659%2028.0159C76.845%2028.1949%2077.0877%2028.2955%2077.3409%2028.2955V28.2955ZM80.2045%2018.2727H77.3409C77.0877%2018.2727%2076.845%2018.3733%2076.6659%2018.5523C76.4869%2018.7313%2076.3864%2018.9741%2076.3864%2019.2273C76.3864%2019.4804%2076.4869%2019.7232%2076.6659%2019.9022C76.845%2020.0813%2077.0877%2020.1818%2077.3409%2020.1818H80.2045C80.4577%2020.1818%2080.7005%2020.0813%2080.8795%2019.9022C81.0585%2019.7232%2081.1591%2019.4804%2081.1591%2019.2273C81.1591%2018.9741%2081.0585%2018.7313%2080.8795%2018.5523C80.7005%2018.3733%2080.4577%2018.2727%2080.2045%2018.2727ZM77.3409%2031.1591H80.2045C80.4577%2031.1591%2080.7005%2031.0585%2080.8795%2030.8795C81.0585%2030.7005%2081.1591%2030.4577%2081.1591%2030.2045C81.1591%2029.9514%2081.0585%2029.7086%2080.8795%2029.5296C80.7005%2029.3506%2080.4577%2029.25%2080.2045%2029.25H77.3409C77.0877%2029.25%2076.845%2029.3506%2076.6659%2029.5296C76.4869%2029.7086%2076.3864%2029.9514%2076.3864%2030.2045C76.3864%2030.4577%2076.4869%2030.7005%2076.6659%2030.8795C76.845%2031.0585%2077.0877%2031.1591%2077.3409%2031.1591V31.1591Z'%20fill='%2326262A'/%3e%3cpath%20d='M90%209.79083V21.75H105V8.75H90.6268C90.4606%208.75%2090.3011%208.85966%2090.1836%209.05485C90.066%209.25005%2090%209.51479%2090%209.79083Z'%20fill='url(%23paint2_linear_1248_126508)'/%3e%3cpath%20d='M105%2026.25H90V39.25H105V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M98.5%2029.75H97.0716L95.5%2030.6699V31.9238L96.9253%2031.1035H96.9627V35.75H98.5V29.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M96.7744%2018.25C97.5264%2018.25%2098.0464%2017.9877%2098.3415%2017.4915H98.3837V18.1678H100V14.8682C100%2013.841%2098.9845%2013.25%2097.6107%2013.25C96.1595%2013.25%2095.3373%2013.9074%2095.2003%2014.7924L96.785%2014.8429C96.8587%2014.5332%2097.1434%2014.3436%2097.5966%2014.3436C98.0183%2014.3436%2098.2853%2014.5269%2098.2853%2014.8524V14.8682C98.2853%2015.1653%2097.9269%2015.2285%2097.0063%2015.3012C95.9136%2015.3834%2095%2015.7468%2095%2016.8214C95%2017.7822%2095.7414%2018.25%2096.7744%2018.25ZM97.305%2017.2386C96.9079%2017.2386%2096.6268%2017.068%2096.6268%2016.7456C96.6268%2016.4327%2096.9009%2016.243%2097.3893%2016.1767C97.7091%2016.1356%2098.1026%2016.0724%2098.2959%2015.9807V16.4422C98.2959%2016.9162%2097.8531%2017.2386%2097.305%2017.2386Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126508'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126508'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126508'%20x1='90'%20y1='15.2552'%20x2='105'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126508'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_61 = "data:image/svg+xml,%3csvg%20width='95'%20height='48'%20viewBox='0%200%2095%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1834_45844)'%3e%3cpath%20d='M0%200.611699V7.64012H14.394V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_1834_45844)'/%3e%3cpath%20d='M33.606%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200L33.606%200V7.64012Z'%20fill='url(%23paint1_linear_1834_45844)'/%3e%3cpath%20d='M31.194%200H16.8V7.64012H31.194V0Z'%20fill='url(%23paint2_linear_1834_45844)'/%3e%3cpath%20d='M31.194%2010.0869H16.8V17.727H31.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2010.0869H0V17.727H14.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2010.0869H33.606V17.727H48V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2020.1799H33.606V27.8262H48V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2020.1799H16.8V27.8262H31.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2020.1799H0V27.8262H14.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M31.194%2030.2668H16.8V37.907H31.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M48%2030.2668H33.606V37.907H48V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M14.394%2030.2668H0V37.907H14.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M31.194%2040.3599H16.8V48H31.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M48%2047.3883V40.3721H33.606V48H47.3985C47.558%2048%2047.711%2047.9355%2047.8238%2047.8208C47.9366%2047.7061%2048%2047.5505%2048%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M14.394%2048V40.3721H0V47.3883C0%2047.5505%200.0633725%2047.7061%200.176176%2047.8208C0.28898%2047.9355%200.441975%2048%200.601504%2048H14.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030.4001C62.6011%2030.4001%2067.9327%2026.1334%2067.9327%2024.0001C67.9327%2021.8668%2062.7357%2017.6001%2061.9067%2017.6001C61.0778%2017.6001%2060.4023%2018.1334%2060.4023%2019.1741C60.4023%2020.2147%2063.9067%2022.8487%2063.9067%2022.8487C63.9067%2022.8487%2056.2539%2022.1334%2056%2022.8487C55.7461%2023.564%2055.7461%2024.4362%2056%2025.1515C56.2539%2025.8668%2063.9067%2025.1515%2063.9067%2025.1515C63.9067%2025.1515%2060.4023%2028.0001%2060.4023%2028.8323C60.4023%2029.6644%2061.2124%2030.4001%2061.9067%2030.4001Z'%20fill='%23CCCCDC'/%3e%3cpath%20d='M93.832%2024.801C93.832%2026.5482%2093.3775%2027.9971%2092.3406%2029.2613H90.4229C91.2042%2028.3238%2091.7866%2026.4772%2091.7866%2024.801C91.7866%2023.1249%2091.2042%2021.2783%2090.4229%2020.3408H92.3406C93.3775%2021.605%2093.832%2023.0539%2093.832%2024.801Z'%20fill='%2324292E'/%3e%3cpath%20d='M86.5016%2022.1592L87.297%2023.8495L88.1351%2022.1592H90.0811L88.6181%2024.8865L90.1522%2027.6137H88.2203L87.297%2025.8808L86.4022%2027.6137H84.4419L85.9902%2024.8865L84.5414%2022.1592H86.5016Z'%20fill='%2324292E'/%3e%3cpath%20d='M80.7621%2024.801C80.7621%2023.0539%2081.2166%2021.605%2082.2536%2020.3408H84.1712C83.3899%2021.2783%2082.8075%2023.1249%2082.8075%2024.801C82.8075%2026.4772%2083.3899%2028.3238%2084.1712%2029.2613H82.2536C81.2166%2027.9971%2080.7621%2026.5482%2080.7621%2024.801Z'%20fill='%2324292E'/%3e%3cpath%20d='M79.6506%2022.1591V23.5795H78.6563V27.6136H76.696V23.5795H76V22.1591H76.696V22.0028C76.696%2020.6534%2077.4631%2020%2078.6563%2020C79.1534%2020%2079.679%2020.0994%2079.9063%2020.1562L79.6222%2021.5625C79.4801%2021.5199%2079.267%2021.4915%2079.125%2021.4915C78.7557%2021.4915%2078.6563%2021.6619%2078.6563%2021.9176V22.1591H79.6506Z'%20fill='%2324292E'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1834_45844'%20x1='0'%20y1='3.82312'%20x2='14.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1834_45844'%20x1='33.606'%20y1='3.82312'%20x2='48'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1834_45844'%20x1='16.8'%20y1='3.82312'%20x2='31.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1834_45844'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_62 = "data:image/svg+xml,%3csvg%20width='119'%20height='48'%20viewBox='0%200%20119%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.3704%2020.6776C42.308%2020.6218%2042.2344%2020.5781%2042.1539%2020.549C41.9941%2020.4877%2041.815%2020.4877%2041.6552%2020.549C41.5747%2020.5781%2041.5011%2020.6218%2041.4387%2020.6776L40.1265%2021.9023C40.0029%2022.0177%2039.9335%2022.174%2039.9335%2022.3371C39.9335%2022.5002%2040.0029%2022.6566%2040.1265%2022.7719C40.25%2022.8872%2040.4176%2022.952%2040.5923%2022.952C40.7671%2022.952%2040.9346%2022.8872%2041.0582%2022.7719L41.2484%2022.5882V27.2361C41.2484%2027.3985%2041.3176%2027.5543%2041.4406%2027.6691C41.5637%2027.784%2041.7306%2027.8485%2041.9046%2027.8485C42.0786%2027.8485%2042.2455%2027.784%2042.3685%2027.6691C42.4916%2027.5543%2042.5607%2027.3985%2042.5607%2027.2361V22.5882L42.751%2022.7719C42.8119%2022.8293%2042.8845%2022.8749%2042.9645%2022.906C43.0444%2022.937%2043.1302%2022.953%2043.2168%2022.953C43.3034%2022.953%2043.3892%2022.937%2043.4691%2022.906C43.5491%2022.8749%2043.6216%2022.8293%2043.6826%2022.7719C43.7441%2022.715%2043.7929%2022.6473%2043.8263%2022.5726C43.8596%2022.498%2043.8767%2022.418%2043.8767%2022.3371C43.8767%2022.2563%2043.8596%2022.1762%2043.8263%2022.1016C43.7929%2022.027%2043.7441%2021.9593%2043.6826%2021.9023L42.3704%2020.6776ZM45.8413%2021.7247H52.4024C52.5764%2021.7247%2052.7433%2021.6602%2052.8664%2021.5454C52.9894%2021.4305%2053.0585%2021.2748%2053.0585%2021.1124C53.0585%2020.95%2052.9894%2020.7942%2052.8664%2020.6794C52.7433%2020.5645%2052.5764%2020.5%2052.4024%2020.5H45.8413C45.6672%2020.5%2045.5004%2020.5645%2045.3773%2020.6794C45.2543%2020.7942%2045.1851%2020.95%2045.1851%2021.1124C45.1851%2021.2748%2045.2543%2021.4305%2045.3773%2021.5454C45.5004%2021.6602%2045.6672%2021.7247%2045.8413%2021.7247V21.7247ZM52.4024%2026.6237H45.8413C45.6672%2026.6237%2045.5004%2026.6883%2045.3773%2026.8031C45.2543%2026.9179%2045.1851%2027.0737%2045.1851%2027.2361C45.1851%2027.3985%2045.2543%2027.5543%2045.3773%2027.6691C45.5004%2027.784%2045.6672%2027.8485%2045.8413%2027.8485H52.4024C52.5764%2027.8485%2052.7433%2027.784%2052.8664%2027.6691C52.9894%2027.5543%2053.0585%2027.3985%2053.0585%2027.2361C53.0585%2027.0737%2052.9894%2026.9179%2052.8664%2026.8031C52.7433%2026.6883%2052.5764%2026.6237%2052.4024%2026.6237ZM52.4024%2023.5619H45.8413C45.6672%2023.5619%2045.5004%2023.6264%2045.3773%2023.7412C45.2543%2023.8561%2045.1851%2024.0118%2045.1851%2024.1742C45.1851%2024.3367%2045.2543%2024.4924%2045.3773%2024.6073C45.5004%2024.7221%2045.6672%2024.7866%2045.8413%2024.7866H52.4024C52.5764%2024.7866%2052.7433%2024.7221%2052.8664%2024.6073C52.9894%2024.4924%2053.0585%2024.3367%2053.0585%2024.1742C53.0585%2024.0118%2052.9894%2023.8561%2052.8664%2023.7412C52.7433%2023.6264%2052.5764%2023.5619%2052.4024%2023.5619Z'%20fill='%2326262A'/%3e%3cpath%20d='M66.9067%2030C67.6011%2030%2072.9327%2026%2072.9327%2024C72.9327%2022%2067.7357%2018%2066.9067%2018C66.0778%2018%2065.4023%2018.5%2065.4023%2019.4756C65.4023%2020.4512%2068.9067%2022.9206%2068.9067%2022.9206C68.9067%2022.9206%2061.2539%2022.25%2061%2022.9206C60.7461%2023.5911%2060.7461%2024.4089%2061%2025.0794C61.2539%2025.75%2068.9067%2025.0794%2068.9067%2025.0794C68.9067%2025.0794%2065.4023%2027.75%2065.4023%2028.5301C65.4023%2029.3103%2066.2124%2030%2066.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126251)'%3e%3cpath%20d='M81%201.05495V13.1763H95.9563V0H81.625C81.4592%200%2081.3003%200.111146%2081.1831%200.308988C81.0658%200.506829%2081%200.77516%2081%201.05495Z'%20fill='url(%23paint0_linear_1248_126251)'/%3e%3cpath%20d='M95.9563%2017.3962H81V30.5725H95.9563V17.3962Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M95.9563%2034.8132H81V48.0001H95.9563V34.8132Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M81%201.04083V13H96V0H81.6268C81.4606%200%2081.3011%200.109659%2081.1836%200.304853C81.066%200.500047%2081%200.764787%2081%201.04083Z'%20fill='url(%23paint1_linear_1248_126251)'/%3e%3cpath%20d='M96%2017.5H81V30.5H96V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M96%2035H81V48H96V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M88.58%2010.25H89.0225V9.63828C90.2662%209.57764%2090.9946%208.9791%2091%208.00879C90.9946%207.14658%2090.3984%206.61924%2089.3085%206.38457L89.0225%206.32129V5.19541C89.4056%205.25078%2089.616%205.46699%2089.6457%205.79395H90.9245C90.9137%204.84209%2090.1826%204.18027%2089.0225%204.10908V3.5H88.58V4.10908C87.4362%204.18555%2086.6349%204.83418%2086.643%205.77813C86.6403%206.59814%2087.2284%207.05957%2088.1835%207.27314L88.58%207.36279V8.55195C88.1079%208.49658%2087.8058%208.23291%2087.7788%207.77676H86.5C86.5162%208.97119%2087.3174%209.575%2088.58%209.63828V10.25ZM89.0225%208.54932V7.4709C89.446%207.59746%2089.6403%207.75039%2089.6457%208.00615C89.6403%208.28565%2089.4164%208.49131%2089.0225%208.54932ZM88.58%206.21582C88.2266%206.11035%2088.0162%205.95215%2088.0243%205.68848C88.027%205.44063%2088.2104%205.24814%2088.58%205.19541V6.21582Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126251)'%3e%3cpath%20d='M114.956%2017.3962H100V30.5725H114.956V17.3962Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M114.956%2034.8132H100V48.0001H114.956V34.8132Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M115%2017.5001H100V30.5001H115V17.5001Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M115%2035.0001H100V48.0001H115V35.0001Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M100%2013.0001H115V1.04089C115%200.764848%20114.934%200.500108%20114.816%200.304914C114.699%200.10972%20114.539%206.10352e-05%20114.373%206.10352e-05L100%206.10352e-05V13.0001Z'%20fill='url(%23paint2_linear_1248_126251)'/%3e%3cpath%20d='M107.58%2010.25H108.022V9.63828C109.266%209.57764%20109.995%208.9791%20110%208.00879C109.995%207.14658%20109.398%206.61924%20108.308%206.38457L108.022%206.32129V5.19541C108.406%205.25078%20108.616%205.46699%20108.646%205.79395H109.924C109.914%204.84209%20109.183%204.18027%20108.022%204.10908V3.5H107.58V4.10908C106.436%204.18555%20105.635%204.83418%20105.643%205.77813C105.64%206.59814%20106.228%207.05957%20107.183%207.27314L107.58%207.36279V8.55195C107.108%208.49658%20106.806%208.23291%20106.779%207.77676H105.5C105.516%208.97119%20106.317%209.575%20107.58%209.63828V10.25ZM108.022%208.54932V7.4709C108.446%207.59746%20108.64%207.75039%20108.646%208.00615C108.64%208.28565%20108.416%208.49131%20108.022%208.54932ZM107.58%206.21582C107.227%206.11035%20107.016%205.95215%20107.024%205.68848C107.027%205.44063%20107.21%205.24814%20107.58%205.19541V6.21582Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip2_1248_126251)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint3_linear_1248_126251)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip3_1248_126251)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint4_linear_1248_126251)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M24.5%209.43623H26.0663V8.71449H26.1149C26.3155%209.12609%2026.7621%209.5%2027.5129%209.5C28.6133%209.5%2029.5%208.72898%2029.5%207.21304C29.5%205.64203%2028.5615%204.92609%2027.5227%204.92609C26.7362%204.92609%2026.3058%205.33768%2026.1149%205.74638H26.0825V3.5H24.5V9.43623ZM26.0502%207.21015C26.0502%206.48261%2026.3867%206.03333%2026.966%206.03333C27.5518%206.03333%2027.8754%206.4942%2027.8754%207.21015C27.8754%207.92899%2027.5518%208.39565%2026.966%208.39565C26.3867%208.39565%2026.0502%207.93188%2026.0502%207.21015Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126251'%20x1='81'%20y1='6.59344'%20x2='95.9563'%20y2='6.59344'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126251'%20x1='81'%20y1='6.5052'%20x2='96'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126251'%20x1='100'%20y1='6.50527'%20x2='115'%20y2='6.50527'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126251'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1248_126251'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126251'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(81)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126251'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(100)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip2_1248_126251'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip3_1248_126251'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_63 = "data:image/svg+xml,%3csvg%20width='96'%20height='48'%20viewBox='0%200%2096%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126533)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M6.84608%2027C7.52244%2027%207.9902%2026.7377%208.25569%2026.2415H8.29362V26.9178H9.74747V23.6182C9.74747%2022.591%208.83407%2022%207.59829%2022C6.29298%2022%205.55341%2022.6574%205.43015%2023.5424L6.85556%2023.5929C6.92193%2023.2832%207.17794%2023.0936%207.58565%2023.0936C7.96492%2023.0936%208.20512%2023.2769%208.20512%2023.6024V23.6182C8.20512%2023.9153%207.88274%2023.9785%207.05468%2024.0512C6.07174%2024.1334%205.25%2024.4968%205.25%2025.5714C5.25%2026.5322%205.91688%2027%206.84608%2027ZM7.32333%2025.9886C6.96618%2025.9886%206.71334%2025.818%206.71334%2025.4956C6.71334%2025.1827%206.95986%2024.993%207.39918%2024.9267C7.68679%2024.8856%208.04077%2024.8224%208.2146%2024.7307V25.1922C8.2146%2025.6662%207.81637%2025.9886%207.32333%2025.9886Z'%20fill='%2324292E'/%3e%3cpath%20d='M5%2044.4362H6.56634V43.7145H6.61489C6.81553%2044.1261%207.26214%2044.5%208.01294%2044.5C9.11327%2044.5%2010%2043.729%2010%2042.213C10%2040.642%209.06149%2039.9261%208.02265%2039.9261C7.23625%2039.9261%206.80583%2040.3377%206.61489%2040.7464H6.58252V38.5H5V44.4362ZM6.55016%2042.2101C6.55016%2041.4826%206.88673%2041.0333%207.46602%2041.0333C8.05178%2041.0333%208.3754%2041.4942%208.3754%2042.2101C8.3754%2042.929%208.05178%2043.3957%207.46602%2043.3957C6.88673%2043.3957%206.55016%2042.9319%206.55016%2042.2101Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126533)'%3e%3cpath%20d='M19%2013H34V1.04083C34%200.764787%2033.934%200.500047%2033.8164%200.304853C33.6989%200.109659%2033.5394%200%2033.3732%200L19%200V13Z'%20fill='url(%23paint1_linear_1248_126533)'/%3e%3cpath%20d='M34%2017.5H19V30.5H34V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M34%2035H19V48H34V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M27.5%2021H26.0716L24.5%2021.9199V23.1738L25.9253%2022.3535H25.9627V27H27.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M24.3373%2044.5H28.75V43.3468H26.3341V43.3092L27.0472%2042.6561C28.3396%2041.5376%2028.6772%2040.9682%2028.6772%2040.289C28.6772%2039.2225%2027.8011%2038.5%2026.4476%2038.5C25.129%2038.5%2024.2471%2039.2543%2024.25%2040.4595H25.6151C25.6151%2039.9249%2025.947%2039.6156%2026.4418%2039.6156C26.9279%2039.6156%2027.2801%2039.9133%2027.2801%2040.4017C27.2801%2040.8439%2027.0006%2041.1445%2026.5116%2041.5809L24.3373%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0778%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2124%2030%2047.9067%2030Z'%20fill='%2324292E'/%3e%3cpath%20d='M62%209.79083V21.75H77V8.75H62.6268C62.4606%208.75%2062.3011%208.85966%2062.1836%209.05485C62.066%209.25005%2062%209.51479%2062%209.79083Z'%20fill='url(%23paint2_linear_1248_126533)'/%3e%3cpath%20d='M77%2026.25H62V39.25H77V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M70.5%2029.75H69.0716L67.5%2030.6699V31.9238L68.9253%2031.1035H68.9627V35.75H70.5V29.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M68.7744%2018.25C69.5264%2018.25%2070.0464%2017.9877%2070.3415%2017.4915H70.3837V18.1678H72V14.8682C72%2013.841%2070.9845%2013.25%2069.6107%2013.25C68.1595%2013.25%2067.3373%2013.9074%2067.2003%2014.7924L68.785%2014.8429C68.8587%2014.5332%2069.1434%2014.3436%2069.5966%2014.3436C70.0183%2014.3436%2070.2853%2014.5269%2070.2853%2014.8524V14.8682C70.2853%2015.1653%2069.9269%2015.2285%2069.0063%2015.3012C67.9136%2015.3834%2067%2015.7468%2067%2016.8214C67%2017.7822%2067.7414%2018.25%2068.7744%2018.25ZM69.305%2017.2386C68.9079%2017.2386%2068.6268%2017.068%2068.6268%2016.7456C68.6268%2016.4327%2068.9009%2016.243%2069.3893%2016.1767C69.7091%2016.1356%2070.1026%2016.0724%2070.2959%2015.9807V16.4422C70.2959%2016.9162%2069.8531%2017.2386%2069.305%2017.2386Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1248_126533)'%3e%3cpath%20d='M81%2021.75H96V9.79083C96%209.51479%2095.934%209.25005%2095.8164%209.05485C95.6989%208.85966%2095.5394%208.75%2095.3732%208.75H81V21.75Z'%20fill='url(%23paint3_linear_1248_126533)'/%3e%3cpath%20d='M96%2026.25H81V39.25H96V26.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M86.3373%2035.75H90.75V34.5968H88.3341V34.5592L89.0472%2033.9061C90.3396%2032.7876%2090.6772%2032.2182%2090.6772%2031.539C90.6772%2030.4725%2089.8011%2029.75%2088.4476%2029.75C87.129%2029.75%2086.2471%2030.5043%2086.25%2031.7095H87.6151C87.6151%2031.1749%2087.947%2030.8656%2088.4418%2030.8656C88.9279%2030.8656%2089.2801%2031.1633%2089.2801%2031.6517C89.2801%2032.0939%2089.0006%2032.3945%2088.5116%2032.8309L86.3373%2034.7211V35.75Z'%20fill='%2324292E'/%3e%3cpath%20d='M86%2018.4362H87.5663V17.7145H87.6149C87.8155%2018.1261%2088.2621%2018.5%2089.0129%2018.5C90.1133%2018.5%2091%2017.729%2091%2016.213C91%2014.642%2090.0615%2013.9261%2089.0227%2013.9261C88.2362%2013.9261%2087.8058%2014.3377%2087.6149%2014.7464H87.5825V12.5H86V18.4362ZM87.5502%2016.2101C87.5502%2015.4826%2087.8867%2015.0333%2088.466%2015.0333C89.0518%2015.0333%2089.3754%2015.4942%2089.3754%2016.2101C89.3754%2016.929%2089.0518%2017.3957%2088.466%2017.3957C87.8867%2017.3957%2087.5502%2016.9319%2087.5502%2016.2101Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126533'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126533'%20x1='19'%20y1='6.5052'%20x2='34'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126533'%20x1='62'%20y1='15.2552'%20x2='77'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126533'%20x1='81'%20y1='15.2552'%20x2='96'%20y2='15.2552'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126533'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(19)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126533'%3e%3crect%20width='15'%20height='30.5'%20fill='white'%20transform='translate(81%208.75)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_64 = "data:image/svg+xml,%3csvg%20width='138'%20height='59'%20viewBox='0%200%20138%2059'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_126445)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.68848%2053.3679H7.69842C7.6899%2052.5518%207.04004%2052%206.02583%2052C5.02868%2052%204.31064%2052.5433%204.31703%2053.3551C4.3149%2054.0178%204.77939%2054.3906%205.53365%2054.5632L5.98961%2054.6697C6.46902%2054.7805%206.68422%2054.9105%206.68848%2055.1555C6.68422%2055.4219%206.43493%2055.6072%206.01092%2055.6072C5.5443%2055.6072%205.23748%2055.3899%205.21404%2054.9702H4.2041C4.21689%2055.9908%204.9264%2056.4787%206.0237%2056.4787C7.11035%2056.4787%207.75382%2055.9865%207.75808%2055.1577C7.75382%2054.4609%207.28294%2054.0348%206.42214%2053.8452L6.04714%2053.7599C5.65083%2053.6747%205.39941%2053.5426%205.40794%2053.2827C5.41007%2053.044%205.61461%2052.8714%206.0237%2052.8714C6.43493%2052.8714%206.66078%2053.0568%206.68848%2053.3679Z'%20fill='%2324292E'/%3e%3cpath%20d='M10.3%2052.0597H9.322L8.24601%2052.7287V53.6406L9.22186%2053.044H9.24743V56.4233H10.3V52.0597Z'%20fill='%2324292E'/%3e%3cpath%20d='M6.77442%209.5C7.52635%209.5%208.04638%209.23767%208.34153%208.74147H8.3837V9.41783H10V6.1182C10%205.09102%208.98454%204.5%207.61068%204.5C6.15952%204.5%205.33732%205.1574%205.20028%206.04235L6.78496%206.09292C6.85875%205.78319%207.14336%205.59355%207.59663%205.59355C8.01827%205.59355%208.28531%205.77686%208.28531%206.1024V6.1182C8.28531%206.4153%207.92692%206.47851%207.00633%206.5512C5.91356%206.63338%205%206.99684%205%208.07143C5%209.03224%205.74139%209.5%206.77442%209.5ZM7.30499%208.48862C6.90794%208.48862%206.62684%208.31795%206.62684%207.99558C6.62684%207.68268%206.90091%207.49305%207.38932%207.42668C7.70907%207.38559%208.1026%207.32238%208.29585%207.23072V7.69216C8.29585%208.16625%207.85313%208.48862%207.30499%208.48862Z'%20fill='%2324292E'/%3e%3cpath%20d='M27.3343%2035.5H30.674V31.174H35V27.8343H30.674V23.5H27.3343V27.8343H23V31.174H27.3343V35.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M58%2027H43V40H58V27Z'%20fill='%233865AB'/%3e%3cpath%20d='M43%2010.5408V22.5H58V9.5H43.6268L43%209.50004L43%2010.5408Z'%20fill='url(%23paint1_linear_1248_126445)'/%3e%3cpath%20d='M50.4792%2036.5C51.8085%2036.5%2052.7528%2035.7757%2052.75%2034.7605C52.7528%2034.0418%2052.2958%2033.5285%2051.4208%2033.423V33.3774C52.0771%2033.2804%2052.5423%2032.827%2052.5395%2032.1711C52.5423%2031.2186%2051.706%2030.5%2050.4903%2030.5C49.2663%2030.5%2048.3746%2031.23%2048.3635%2032.2681H49.6734C49.6845%2031.8688%2050.0334%2031.6008%2050.4903%2031.6008C50.9251%2031.6008%2051.2214%2031.8717%2051.2186%2032.2624C51.2214%2032.6673%2050.8725%2032.9468%2050.3685%2032.9468H49.8174V33.9506H50.3685C50.9417%2033.9506%2051.3155%2034.2414%2051.31%2034.6521C51.3155%2035.0656%2050.9721%2035.3536%2050.4848%2035.3536C50.0001%2035.3536%2049.6429%2035.0884%2049.6291%2034.7034H48.25C48.2611%2035.7586%2049.1832%2036.5%2050.4792%2036.5Z'%20fill='white'/%3e%3cpath%20d='M49.4844%2045.3679H50.4943C50.4858%2044.5518%2049.8359%2044%2048.8217%2044C47.8246%2044%2047.1065%2044.5433%2047.1129%2045.3551C47.1108%2046.0178%2047.5753%2046.3906%2048.3295%2046.5632L48.7855%2046.6697C49.2649%2046.7805%2049.4801%2046.9105%2049.4844%2047.1555C49.4801%2047.4219%2049.2308%2047.6072%2048.8068%2047.6072C48.3402%2047.6072%2048.0334%2047.3899%2048.0099%2046.9702H47C47.0128%2047.9908%2047.7223%2048.4787%2048.8196%2048.4787C49.9062%2048.4787%2050.5497%2047.9865%2050.554%2047.1577C50.5497%2046.4609%2050.0788%2046.0348%2049.218%2045.8452L48.843%2045.7599C48.4467%2045.6747%2048.1953%2045.5426%2048.2038%2045.2827C48.206%2045.044%2048.4105%2044.8714%2048.8196%2044.8714C49.2308%2044.8714%2049.4567%2045.0568%2049.4844%2045.3679Z'%20fill='%2324292E'/%3e%3cpath%20d='M51.0781%2048.4233H54.3082V47.5732H52.5398V47.5455L53.0618%2047.0639C54.0078%2046.2393%2054.255%2045.8196%2054.255%2045.3189C54.255%2044.5327%2053.6136%2044%2052.6229%2044C51.6577%2044%2051.0121%2044.5561%2051.0142%2045.4446H52.0135C52.0135%2045.0504%2052.2564%2044.8224%2052.6186%2044.8224C52.9744%2044.8224%2053.2322%2045.0419%2053.2322%2045.402C53.2322%2045.728%2053.0277%2045.9496%2052.6697%2046.2713L51.0781%2047.6648V48.4233Z'%20fill='%2324292E'/%3e%3cpath%20d='M49.7744%2018.5C50.5264%2018.5%2051.0464%2018.2377%2051.3415%2017.7415H51.3837V18.4178H53V15.1182C53%2014.091%2051.9845%2013.5%2050.6107%2013.5C49.1595%2013.5%2048.3373%2014.1574%2048.2003%2015.0424L49.785%2015.0929C49.8587%2014.7832%2050.1434%2014.5936%2050.5966%2014.5936C51.0183%2014.5936%2051.2853%2014.7769%2051.2853%2015.1024V15.1182C51.2853%2015.4153%2050.9269%2015.4785%2050.0063%2015.5512C48.9136%2015.6334%2048%2015.9968%2048%2017.0714C48%2018.0322%2048.7414%2018.5%2049.7744%2018.5ZM50.305%2017.4886C49.9079%2017.4886%2049.6268%2017.318%2049.6268%2016.9956C49.6268%2016.6827%2049.9009%2016.493%2050.3893%2016.4267C50.7091%2016.3856%2051.1026%2016.3224%2051.2959%2016.2307V16.6922C51.2959%2017.1662%2050.8531%2017.4886%2050.305%2017.4886Z'%20fill='%2324292E'/%3e%3cpath%20d='M71.9067%2035.5C72.6011%2035.5%2077.9327%2031.5%2077.9327%2029.5C77.9327%2027.5%2072.7357%2023.5%2071.9067%2023.5C71.0778%2023.5%2070.4023%2024%2070.4023%2024.9756C70.4023%2025.9512%2073.9067%2028.4206%2073.9067%2028.4206C73.9067%2028.4206%2066.2539%2027.75%2066%2028.4206C65.7461%2029.0911%2065.7461%2029.9089%2066%2030.5794C66.2539%2031.25%2073.9067%2030.5794%2073.9067%2030.5794C73.9067%2030.5794%2070.4023%2033.25%2070.4023%2034.0301C70.4023%2034.8103%2071.2124%2035.5%2071.9067%2035.5Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_126445)'%3e%3cpath%20d='M110%2018.5H86V28H110V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110%2031.25H86V40.75H110V31.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M110%2044H86V53.5H110V44Z'%20fill='%233865AB'/%3e%3cpath%20d='M86%206.30064V15.5H110V5.5H87.0029C86.7369%205.5%2086.4818%205.58435%2086.2937%205.7345C86.1057%205.88465%2086%206.0883%2086%206.30064Z'%20fill='url(%23paint2_linear_1248_126445)'/%3e%3cpath%20d='M97.4453%2022.3744H98.4394C98.431%2021.5545%2097.7913%2021%2096.7931%2021C95.8116%2021%2095.1049%2021.5459%2095.1111%2022.3616C95.1091%2023.0274%2095.5662%2023.402%2096.3086%2023.5754L96.7574%2023.6824C97.2293%2023.7938%2097.4411%2023.9244%2097.4453%2024.1706C97.4411%2024.4382%2097.1957%2024.6244%2096.7784%2024.6244C96.3191%2024.6244%2096.0171%2024.406%2095.9941%2023.9843H95C95.0126%2025.0098%2095.7109%2025.5%2096.791%2025.5C97.8605%2025.5%2098.4939%2025.0055%2098.4981%2024.1727C98.4939%2023.4726%2098.0304%2023.0445%2097.1832%2022.8539L96.8141%2022.7683C96.424%2022.6827%2096.1765%2022.55%2096.1849%2022.2888C96.187%2022.049%2096.3883%2021.8756%2096.791%2021.8756C97.1957%2021.8756%2097.418%2022.0618%2097.4453%2022.3744Z'%20fill='%2324292E'/%3e%3cpath%20d='M101%2021.0599H100.037L98.9783%2021.7322V22.6484L99.9388%2022.049H99.964V25.4443H101V21.0599Z'%20fill='%2324292E'/%3e%3cpath%20d='M97.4453%2035.1244H98.4394C98.431%2034.3045%2097.7913%2033.75%2096.7931%2033.75C95.8116%2033.75%2095.1049%2034.2959%2095.1111%2035.1116C95.1091%2035.7774%2095.5662%2036.152%2096.3086%2036.3254L96.7574%2036.4324C97.2293%2036.5438%2097.4411%2036.6744%2097.4453%2036.9206C97.4411%2037.1882%2097.1957%2037.3744%2096.7784%2037.3744C96.3191%2037.3744%2096.0171%2037.156%2095.9941%2036.7343H95C95.0126%2037.7598%2095.7109%2038.25%2096.791%2038.25C97.8605%2038.25%2098.4939%2037.7555%2098.4981%2036.9227C98.4939%2036.2226%2098.0304%2035.7945%2097.1832%2035.6039L96.8141%2035.5183C96.424%2035.4327%2096.1765%2035.3%2096.1849%2035.0388C96.187%2034.799%2096.3883%2034.6256%2096.791%2034.6256C97.1957%2034.6256%2097.418%2034.8118%2097.4453%2035.1244Z'%20fill='%2324292E'/%3e%3cpath%20d='M101%2033.8099H100.037L98.9783%2034.4822V35.3984L99.9388%2034.799H99.964V38.1943H101V33.8099Z'%20fill='%2324292E'/%3e%3cpath%20d='M96.9962%2047.8744H98.0109C98.0024%2047.0545%2097.3494%2046.5%2096.3304%2046.5C95.3285%2046.5%2094.607%2047.0459%2094.6135%2047.8616C94.6113%2048.5274%2095.078%2048.902%2095.8359%2049.0754L96.294%2049.1824C96.7757%2049.2938%2096.9919%2049.4244%2096.9962%2049.6706C96.9919%2049.9382%2096.7414%2050.1244%2096.3154%2050.1244C95.8466%2050.1244%2095.5383%2049.906%2095.5147%2049.4843H94.5C94.5128%2050.5098%2095.2257%2051%2096.3283%2051C97.4201%2051%2098.0666%2050.5055%2098.0709%2049.6727C98.0666%2048.9726%2097.5935%2048.5445%2096.7286%2048.3539L96.3518%2048.2683C95.9536%2048.1827%2095.701%2048.05%2095.7096%2047.7888C95.7117%2047.549%2095.9172%2047.3756%2096.3283%2047.3756C96.7414%2047.3756%2096.9684%2047.5618%2096.9962%2047.8744Z'%20fill='white'/%3e%3cpath%20d='M98.5975%2050.9443H101.843V50.0902H100.066V50.0623L100.591%2049.5785C101.541%2048.75%20101.789%2048.3283%20101.789%2047.8252C101.789%2047.0352%20101.145%2046.5%20100.15%2046.5C99.1798%2046.5%2098.5312%2047.0588%2098.5333%2047.9515H99.5373C99.5373%2047.5554%2099.7814%2047.3264%20100.145%2047.3264C100.503%2047.3264%20100.762%2047.5469%20100.762%2047.9087C100.762%2048.2362%20100.556%2048.4588%20100.197%2048.7821L98.5975%2050.1822V50.9443Z'%20fill='white'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_126445)'%3e%3cpath%20d='M114%2015.5H138V6.30064C138%206.0883%20137.894%205.88465%20137.706%205.7345C137.518%205.58435%20137.263%205.5%20136.997%205.5H114V15.5Z'%20fill='url(%23paint3_linear_1248_126445)'/%3e%3cpath%20d='M138%2018.5H114V28H138V18.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M138%2031.25H114V40.75H138V31.25Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M138%2044H114V53.5H138V44Z'%20fill='%233865AB'/%3e%3cpath%20d='M127%2020.25H125.572L124%2021.1699V22.4238L125.425%2021.6035H125.463V26.25H127V20.25Z'%20fill='%2324292E'/%3e%3cpath%20d='M123.837%2039H128.25V37.8468H125.834V37.8092L126.547%2037.1561C127.84%2036.0376%20128.177%2035.4682%20128.177%2034.789C128.177%2033.7225%20127.301%2033%20125.948%2033C124.629%2033%20123.747%2033.7543%20123.75%2034.9595H125.115C125.115%2034.4249%20125.447%2034.1156%20125.942%2034.1156C126.428%2034.1156%20126.78%2034.4133%20126.78%2034.9017C126.78%2035.3439%20126.501%2035.6445%20126.012%2036.0809L123.837%2037.9711V39Z'%20fill='%2324292E'/%3e%3cpath%20d='M125.979%2051.75C127.308%2051.75%20128.253%2051.0257%20128.25%2050.0105C128.253%2049.2918%20127.796%2048.7785%20126.921%2048.673V48.6274C127.577%2048.5304%20128.042%2048.077%20128.04%2047.4211C128.042%2046.4686%20127.206%2045.75%20125.99%2045.75C124.766%2045.75%20123.875%2046.48%20123.864%2047.5181H125.173C125.184%2047.1188%20125.533%2046.8508%20125.99%2046.8508C126.425%2046.8508%20126.721%2047.1217%20126.719%2047.5124C126.721%2047.9173%20126.372%2048.1968%20125.868%2048.1968H125.317V49.2006H125.868C126.442%2049.2006%20126.816%2049.4914%20126.81%2049.9021C126.816%2050.3156%20126.472%2050.6036%20125.985%2050.6036C125.5%2050.6036%20125.143%2050.3384%20125.129%2049.9534H123.75C123.761%2051.0086%20124.683%2051.75%20125.979%2051.75Z'%20fill='white'/%3e%3cpath%20d='M124.774%2013C125.526%2013%20126.046%2012.7377%20126.342%2012.2415H126.384V12.9178H128V9.6182C128%208.59102%20126.985%208%20125.611%208C124.16%208%20123.337%208.6574%20123.2%209.54235L124.785%209.59292C124.859%209.28319%20125.143%209.09355%20125.597%209.09355C126.018%209.09355%20126.285%209.27686%20126.285%209.6024V9.6182C126.285%209.9153%20125.927%209.97851%20125.006%2010.0512C123.914%2010.1334%20123%2010.4968%20123%2011.5714C123%2012.5322%20123.741%2013%20124.774%2013ZM125.305%2011.9886C124.908%2011.9886%20124.627%2011.818%20124.627%2011.4956C124.627%2011.1827%20124.901%2010.993%20125.389%2010.9267C125.709%2010.8856%20126.103%2010.8224%20126.296%2010.7307V11.1922C126.296%2011.6662%20125.853%2011.9886%20125.305%2011.9886Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126445'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_126445'%20x1='43'%20y1='16.0052'%20x2='58'%20y2='16.0052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1248_126445'%20x1='86'%20y1='10.504'%20x2='110'%20y2='10.504'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1248_126445'%20x1='114'%20y1='10.504'%20x2='138'%20y2='10.504'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_126445'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(86%205.5)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_126445'%3e%3crect%20width='24'%20height='48'%20fill='white'%20transform='translate(114%205.5)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_65 = "data:image/svg+xml,%3csvg%20width='114'%20height='48'%20viewBox='0%200%20114%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_smoothing_light)'%3e%3cpath%20d='M0%200.611699V7.64012H7V0H0.601504C0.441975%200%200.28898%200.0644467%200.176176%200.179162C0.0633725%200.293878%200%200.449466%200%200.611699Z'%20fill='url(%23paint0_linear_smoothing_light)'/%3e%3cpath%20d='M8%200H15V7.64012H8V0Z'%20fill='url(%23paint1_linear_smoothing_light)'/%3e%3cpath%20d='M16%200H23V7.64012H16V0Z'%20fill='url(%23paint2_linear_smoothing_light)'/%3e%3cpath%20d='M24%200H31V7.64012H24V0Z'%20fill='url(%23paint3_linear_smoothing_light)'/%3e%3cpath%20d='M32%200H39V7.64012H32V0Z'%20fill='url(%23paint4_linear_smoothing_light)'/%3e%3cpath%20d='M40%207.64012H48V0.611699C48%200.449466%2047.9366%200.293878%2047.8238%200.179162C47.711%200.0644467%2047.558%200%2047.3985%200H40V7.64012Z'%20fill='url(%23paint5_linear_smoothing_light)'/%3e%3cpath%20d='M2%2038L5%2028L8%2035L11%2025L14%2032L17%2022L20%2030L23%2020L26%2028L29%2024L32%2031L35%2026L38%2033L41%2029L44%2036L46%2032'%20stroke='%2384AFF1'%20stroke-width='2'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2%2038L5%2028L8%2035L11%2025L14%2032L17%2022L20%2030L23%2020L26%2028L29%2024L32%2031L35%2026L38%2033L41%2029L44%2036L46%2032L46%2048L2%2048Z'%20fill='url(%23paint6_linear_smoothing_light)'%20opacity='0.3'/%3e%3c/g%3e%3cpath%20d='M57.91%2030C58.6%2030%2064%2026%2064%2024C64%2022%2058.7%2018%2057.91%2018C57.08%2018%2056.4%2018.5%2056.4%2019.48C56.4%2020.45%2059.91%2022.92%2059.91%2022.92C59.91%2022.92%2052.25%2022.25%2052%2022.92C51.75%2023.59%2051.75%2024.41%2052%2025.08C52.25%2025.75%2059.91%2025.08%2059.91%2025.08C59.91%2025.08%2056.4%2027.75%2056.4%2028.53C56.4%2029.31%2057.21%2030%2057.91%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_smoothing_light)'%3e%3cpath%20d='M66%200.611699V7.64012H81V0H66.6015C66.442%200%2066.289%200.0644467%2066.1762%200.179162C66.0634%200.293878%2066%200.449466%2066%200.611699Z'%20fill='url(%23paint7_linear_smoothing_light)'/%3e%3cpath%20d='M82%200H97V7.64012H82V0Z'%20fill='url(%23paint8_linear_smoothing_light)'/%3e%3cpath%20d='M98%207.64012H114V0.611699C114%200.449466%20113.937%200.293878%20113.824%200.179162C113.711%200.0644467%20113.558%200%20113.399%200H98V7.64012Z'%20fill='url(%23paint9_linear_smoothing_light)'/%3e%3cpath%20d='M68%2036Q77%2028%2086%2024Q95%2021%20112%2025'%20stroke='%2384AFF1'%20stroke-width='2.5'%20fill='none'%20stroke-linecap='round'/%3e%3cpath%20d='M68%2036Q77%2028%2086%2024Q95%2021%20112%2025L112%2048L68%2048Z'%20fill='url(%23paint10_linear_smoothing_light)'%20opacity='0.3'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_smoothing_light'%20x1='0'%20y1='3.82'%20x2='7'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_smoothing_light'%20x1='8'%20y1='3.82'%20x2='15'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_smoothing_light'%20x1='16'%20y1='3.82'%20x2='23'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_smoothing_light'%20x1='24'%20y1='3.82'%20x2='31'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_smoothing_light'%20x1='32'%20y1='3.82'%20x2='39'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_smoothing_light'%20x1='40'%20y1='3.82'%20x2='48'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_smoothing_light'%20x1='24'%20y1='48'%20x2='24'%20y2='20'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F60C4'%20stop-opacity='0'/%3e%3cstop%20offset='1'%20stop-color='%233865AB'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint7_linear_smoothing_light'%20x1='66'%20y1='3.82'%20x2='81'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint8_linear_smoothing_light'%20x1='82'%20y1='3.82'%20x2='97'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint9_linear_smoothing_light'%20x1='98'%20y1='3.82'%20x2='114'%20y2='3.82'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint10_linear_smoothing_light'%20x1='90'%20y1='48'%20x2='90'%20y2='21'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F60C4'%20stop-opacity='0'/%3e%3cstop%20offset='1'%20stop-color='%233865AB'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_smoothing_light'%3e%3crect%20width='48'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_smoothing_light'%3e%3crect%20width='48'%20height='48'%20fill='white'%20transform='translate(66)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_66 = "data:image/svg+xml,%3csvg%20width='77'%20height='48'%20viewBox='0%200%2077%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M23.3704%2020.6776C23.308%2020.6218%2023.2344%2020.5781%2023.1539%2020.549C22.9941%2020.4877%2022.815%2020.4877%2022.6552%2020.549C22.5747%2020.5781%2022.5011%2020.6218%2022.4387%2020.6776L21.1265%2021.9023C21.0029%2022.0177%2020.9335%2022.174%2020.9335%2022.3371C20.9335%2022.5002%2021.0029%2022.6566%2021.1265%2022.7719C21.25%2022.8872%2021.4176%2022.952%2021.5923%2022.952C21.7671%2022.952%2021.9346%2022.8872%2022.0582%2022.7719L22.2484%2022.5882V27.2361C22.2484%2027.3985%2022.3176%2027.5543%2022.4406%2027.6691C22.5637%2027.784%2022.7306%2027.8485%2022.9046%2027.8485C23.0786%2027.8485%2023.2455%2027.784%2023.3685%2027.6691C23.4916%2027.5543%2023.5607%2027.3985%2023.5607%2027.2361V22.5882L23.751%2022.7719C23.8119%2022.8293%2023.8845%2022.8749%2023.9645%2022.906C24.0444%2022.937%2024.1302%2022.953%2024.2168%2022.953C24.3034%2022.953%2024.3892%2022.937%2024.4691%2022.906C24.5491%2022.8749%2024.6216%2022.8293%2024.6826%2022.7719C24.7441%2022.715%2024.7929%2022.6473%2024.8263%2022.5726C24.8596%2022.498%2024.8767%2022.418%2024.8767%2022.3371C24.8767%2022.2563%2024.8596%2022.1762%2024.8263%2022.1016C24.7929%2022.027%2024.7441%2021.9593%2024.6826%2021.9023L23.3704%2020.6776ZM26.8413%2021.7247H33.4024C33.5764%2021.7247%2033.7433%2021.6602%2033.8664%2021.5454C33.9894%2021.4305%2034.0585%2021.2748%2034.0585%2021.1124C34.0585%2020.95%2033.9894%2020.7942%2033.8664%2020.6794C33.7433%2020.5645%2033.5764%2020.5%2033.4024%2020.5H26.8413C26.6672%2020.5%2026.5004%2020.5645%2026.3773%2020.6794C26.2543%2020.7942%2026.1851%2020.95%2026.1851%2021.1124C26.1851%2021.2748%2026.2543%2021.4305%2026.3773%2021.5454C26.5004%2021.6602%2026.6672%2021.7247%2026.8413%2021.7247ZM33.4024%2026.6237H26.8413C26.6672%2026.6237%2026.5004%2026.6883%2026.3773%2026.8031C26.2543%2026.918%2026.1851%2027.0737%2026.1851%2027.2361C26.1851%2027.3985%2026.2543%2027.5543%2026.3773%2027.6691C26.5004%2027.784%2026.6672%2027.8485%2026.8413%2027.8485H33.4024C33.5764%2027.8485%2033.7433%2027.784%2033.8664%2027.6691C33.9894%2027.5543%2034.0585%2027.3985%2034.0585%2027.2361C34.0585%2027.0737%2033.9894%2026.918%2033.8664%2026.8031C33.7433%2026.6883%2033.5764%2026.6237%2033.4024%2026.6237ZM33.4024%2023.5619H26.8413C26.6672%2023.5619%2026.5004%2023.6264%2026.3773%2023.7412C26.2543%2023.8561%2026.1851%2024.0118%2026.1851%2024.1742C26.1851%2024.3367%2026.2543%2024.4924%2026.3773%2024.6073C26.5004%2024.7221%2026.6672%2024.7866%2026.8413%2024.7866H33.4024C33.5764%2024.7866%2033.7433%2024.7221%2033.8664%2024.6073C33.9894%2024.4924%2034.0585%2024.3367%2034.0585%2024.1742C34.0585%2024.0118%2033.9894%2023.8561%2033.8664%2023.7412C33.7433%2023.6264%2033.5764%2023.5619%2033.4024%2023.5619Z'%20fill='%2326262A'/%3e%3cpath%20d='M47.9067%2030C48.6011%2030%2053.9327%2026%2053.9327%2024C53.9327%2022%2048.7357%2018%2047.9067%2018C47.0778%2018%2046.4023%2018.5%2046.4023%2019.4756C46.4023%2020.4512%2049.9067%2022.9206%2049.9067%2022.9206C49.9067%2022.9206%2042.2539%2022.25%2042%2022.9206C41.7461%2023.5911%2041.7461%2024.4089%2042%2025.0794C42.2539%2025.75%2049.9067%2025.0794%2049.9067%2025.0794C49.9067%2025.0794%2046.4023%2027.75%2046.4023%2028.5301C46.4023%2029.3103%2047.2124%2030%2047.9067%2030Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip0_1248_125954)'%3e%3cpath%20d='M0%201.04083V13H15V0H0.626828C0.460583%200%200.301147%200.109659%200.183594%200.304853C0.0660407%200.500047%200%200.764787%200%201.04083Z'%20fill='url(%23paint0_linear_1248_125954)'/%3e%3cpath%20d='M15%2017.5H0V30.5H15V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M15%2035H0V48H15V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M8.5%2021H7.07158L5.5%2021.9199V23.1738L6.92531%2022.3535H6.96266V27H8.5V21Z'%20fill='%2324292E'/%3e%3cpath%20d='M5.33733%2044.5H9.75V43.3468H7.33409V43.3092L8.04722%2042.6561C9.33959%2041.5376%209.67723%2040.9682%209.67723%2040.289C9.67723%2039.2225%208.8011%2038.5%207.44761%2038.5C6.12905%2038.5%205.2471%2039.2543%205.25001%2040.4595H6.61514C6.61514%2039.9249%206.94696%2039.6156%207.44179%2039.6156C7.92788%2039.6156%208.28008%2039.9133%208.28008%2040.4017C8.28008%2040.8439%208.00065%2041.1445%207.51165%2041.5809L5.33733%2043.4711V44.5Z'%20fill='%2324292E'/%3e%3c/g%3e%3cg%20clip-path='url(%23clip1_1248_125954)'%3e%3cpath%20d='M77%2017.5H62V30.5H77V17.5Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M77%2035H62V48H77V35Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M62%2013H77V1.04083C77%200.764787%2076.934%200.500047%2076.8164%200.304853C76.6989%200.109659%2076.5394%200%2076.3732%200L62%200V13Z'%20fill='url(%23paint1_linear_1248_125954)'/%3e%3cpath%20d='M70.5%2038.5H69.0716L67.5%2039.4199V40.6738L68.9253%2039.8535H68.9627V44.5H70.5V38.5Z'%20fill='%2324292E'/%3e%3cpath%20d='M67.3373%2027H71.75V25.8468H69.3341V25.8092L70.0472%2025.1561C71.3396%2024.0376%2071.6772%2023.4682%2071.6772%2022.789C71.6772%2021.7225%2070.8011%2021%2069.4476%2021C68.129%2021%2067.2471%2021.7543%2067.25%2022.9595H68.6151C68.6151%2022.4249%2068.947%2022.1156%2069.4418%2022.1156C69.9279%2022.1156%2070.2801%2022.4133%2070.2801%2022.9017C70.2801%2023.3439%2070.0006%2023.6445%2069.5116%2024.0809L67.3373%2025.9711V27Z'%20fill='%2324292E'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_125954'%20x1='0'%20y1='6.5052'%20x2='15'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1248_125954'%20x1='62'%20y1='6.5052'%20x2='77'%20y2='6.5052'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1248_125954'%3e%3crect%20width='15'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1248_125954'%3e%3crect%20width='15'%20height='48'%20fill='white'%20transform='translate(62)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_67 = "data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.7436%2030.2214C10.4012%2030.2214%2010.0827%2030.3965%209.89924%2030.6856L1.15566%2044.4642C0.96022%2044.7722%200.947975%2045.1622%201.1237%2045.4818C1.29943%2045.8014%201.63525%2046%202%2046H24H46C46.3648%2046%2046.7006%2045.8014%2046.8763%2045.4818C47.052%2045.1622%2047.0398%2044.7722%2046.8443%2044.4642L38.1008%2030.6856C37.9173%2030.3965%2037.5988%2030.2214%2037.2564%2030.2214H24H10.7436Z'%20fill='url(%23paint0_linear_1248_126346)'%20stroke='%23CCCCDC'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M17.25%2026.7682C17.25%2030.6622%2021.6037%2035.6872%2024%2038.0189C26.3962%2035.6988%2030.75%2030.6622%2030.75%2026.7682C30.75%2024.9129%2030.0388%2023.1336%2028.773%2021.8218C27.5071%2020.5099%2025.7902%2019.7729%2024%2019.7729C22.2098%2019.7729%2020.4929%2020.5099%2019.227%2021.8218C17.9612%2023.1336%2017.25%2024.9129%2017.25%2026.7682ZM22.7501%2028.7068C23.1201%2028.963%2023.5551%2029.0997%2024.0001%2029.0997C24.5969%2029.0997%2025.1692%2028.8541%2025.5911%2028.4168C26.0131%2027.9795%2026.2501%2027.3864%2026.2501%2026.768C26.2501%2026.3068%2026.1182%2025.856%2025.8709%2025.4725C25.6237%2025.0891%2025.2723%2024.7902%2024.8612%2024.6137C24.45%2024.4372%2023.9976%2024.3911%2023.5612%2024.481C23.1247%2024.571%2022.7238%2024.7931%2022.4091%2025.1192C22.0945%2025.4453%2021.8802%2025.8608%2021.7934%2026.3131C21.7065%2026.7654%2021.7511%2027.2342%2021.9214%2027.6603C22.0917%2028.0864%2022.3801%2028.4506%2022.7501%2028.7068Z'%20fill='%23E02F44'/%3e%3cpath%20d='M24%2017.4426C21.6131%2017.4426%2019.3239%2018.4252%2017.636%2020.1744C15.9482%2021.9236%2015%2024.2959%2015%2026.7696C15%2033.0654%2022.9313%2040.1773%2023.2688%2040.4804C23.4725%2040.661%2023.7319%2040.7603%2024%2040.7603C24.2681%2040.7603%2024.5275%2040.661%2024.7312%2040.4804C25.125%2040.1773%2033%2033.0654%2033%2026.7696C33%2024.2959%2032.0518%2021.9236%2030.364%2020.1744C28.6761%2018.4252%2026.3869%2017.4426%2024%2017.4426ZM24%2038.0204C21.6037%2035.6886%2017.25%2030.6637%2017.25%2026.7696C17.25%2024.9144%2017.9612%2023.1351%2019.227%2021.8232C20.4929%2020.5113%2022.2098%2019.7743%2024%2019.7743C25.7902%2019.7743%2027.5071%2020.5113%2028.773%2021.8232C30.0388%2023.1351%2030.75%2024.9144%2030.75%2026.7696C30.75%2030.6637%2026.3963%2035.7003%2024%2038.0204Z'%20fill='%2322252B'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1248_126346'%20x1='46'%20y1='38.2709'%20x2='3.41025'%20y2='38.2709'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9830'/%3e%3cstop%20offset='1'%20stop-color='%23F2CC0C'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_68 = "data:image/svg+xml,%3csvg%20width='124'%20height='48'%20viewBox='0%200%20124%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1648_105907)'%3e%3cpath%20d='M76%200.611699V7.64012H90.394V0H76.6015C76.442%200%2076.289%200.0644467%2076.1762%200.179162C76.0634%200.293878%2076%200.449466%2076%200.611699Z'%20fill='url(%23paint0_linear_1648_105907)'/%3e%3cpath%20d='M109.606%207.64012H124V0.611699C124%200.449466%20123.937%200.293878%20123.824%200.179162C123.711%200.0644467%20123.558%200%20123.399%200L109.606%200V7.64012Z'%20fill='url(%23paint1_linear_1648_105907)'/%3e%3cpath%20d='M107.194%200H92.8V7.64012H107.194V0Z'%20fill='url(%23paint2_linear_1648_105907)'/%3e%3cpath%20d='M107.194%2010.0869H92.8V17.727H107.194V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M90.394%2010.0869H76V17.727H90.394V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2010.0869H109.606V17.727H124V10.0869Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2020.1799H109.606V27.8262H124V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M107.194%2020.1799H92.8V27.8262H107.194V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M90.394%2020.1799H76V27.8262H90.394V20.1799Z'%20fill='%233865AB'/%3e%3cpath%20d='M107.194%2030.2668H92.8V37.907H107.194V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M124%2030.2668H109.606V37.907H124V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M90.394%2030.2668H76V37.907H90.394V30.2668Z'%20fill='%2384AFF1'/%3e%3cpath%20d='M107.194%2040.3599H92.8V48H107.194V40.3599Z'%20fill='%233865AB'/%3e%3cpath%20d='M124%2047.3883V40.3721H109.606V48H123.399C123.558%2048%20123.711%2047.9355%20123.824%2047.8208C123.937%2047.7061%20124%2047.5505%20124%2047.3883Z'%20fill='%233865AB'/%3e%3cpath%20d='M90.394%2048V40.3721H76V47.3883C76%2047.5505%2076.0634%2047.7061%2076.1762%2047.8208C76.289%2047.9355%2076.442%2048%2076.6015%2048H90.394Z'%20fill='%233865AB'/%3e%3c/g%3e%3cpath%20d='M61.9067%2030.4001C62.6011%2030.4001%2067.9327%2026.1334%2067.9327%2024.0001C67.9327%2021.8668%2062.7357%2017.6001%2061.9067%2017.6001C61.0778%2017.6001%2060.4023%2018.1334%2060.4023%2019.1741C60.4023%2020.2147%2063.9067%2022.8487%2063.9067%2022.8487C63.9067%2022.8487%2056.2539%2022.1334%2056%2022.8487C55.7461%2023.564%2055.7461%2024.4362%2056%2025.1515C56.2539%2025.8668%2063.9067%2025.1515%2063.9067%2025.1515C63.9067%2025.1515%2060.4023%2028.0001%2060.4023%2028.8323C60.4023%2029.6644%2061.2124%2030.4001%2061.9067%2030.4001Z'%20fill='%2324292E'/%3e%3cg%20clip-path='url(%23clip1_1648_105907)'%3e%3cpath%20d='M20.5657%2014.8473C20.3886%2014.8474%2020.2136%2014.8094%2020.0525%2014.736L10.963%2010.6159L1.68804%2014.1483C1.38138%2014.2648%201.04102%2014.2546%200.741842%2014.12C0.442666%2013.9854%200.209179%2013.7375%200.0927449%2013.4307C-0.0236892%2013.1238%20-0.0135325%2012.7833%200.120981%2012.484C0.255494%2012.1847%200.503345%2011.9511%200.81001%2011.8346L10.5796%208.12275C10.8825%207.9973%2011.2228%207.9973%2011.5257%208.12275L20.2813%2012.0882L29.5562%202.19003C29.7339%202.01998%2029.9583%201.90678%2030.2006%201.86491C30.4429%201.82304%2030.6922%201.85438%2030.9166%201.95495L40.2843%206.01939L49.0832%200.204206C49.2187%200.111618%2049.3713%200.0469507%2049.5321%200.0139747C49.6929%20-0.0190012%2049.8586%20-0.0196266%2050.0197%200.0121352C50.1807%200.043897%2050.3338%200.10741%2050.47%200.198973C50.6063%200.290536%2050.7229%200.408317%2050.8132%200.545449C50.9035%200.682581%2050.9656%200.836322%2050.9959%200.997709C51.0262%201.1591%2051.024%201.3249%2050.9896%201.48546C50.9552%201.64602%2050.8892%201.79812%2050.7954%201.93289C50.7017%202.06766%2050.582%202.18241%2050.4435%202.27045L41.0881%208.45682C40.916%208.56985%2040.7184%208.63811%2040.5133%208.6554C40.3081%208.67268%2040.1019%208.63845%2039.9133%208.5558L30.7434%204.57178L21.4685%2014.47C21.3516%2014.591%2021.2112%2014.6869%2021.056%2014.7518C20.9008%2014.8167%2020.7339%2014.8492%2020.5657%2014.8473Z'%20fill='url(%23paint3_linear_1648_105907)'/%3e%3cpath%20d='M49.7633%2010.9624L40.408%2020.8606L30.4343%2013.4369L20.5657%2020.8606L11.0063%2019.0047L1.23666%2027.047H1.30468V47.994H49.8932L49.7633%2010.9624Z'%20fill='url(%23paint4_linear_1648_105907)'/%3e%3cpath%20d='M1.30468%2028.2841H1.23666C0.982542%2028.2834%200.73483%2028.2043%200.527227%2028.0577C0.319623%2027.911%200.162208%2027.704%200.0763958%2027.4647C-0.00941619%2027.2254%20-0.0194578%2026.9654%200.047637%2026.7202C0.114732%2026.475%200.255705%2026.2564%200.451379%2026.0942L10.221%2018.0519C10.3615%2017.9361%2010.5258%2017.8528%2010.7021%2017.8079C10.8785%2017.763%2011.0626%2017.7576%2011.2413%2017.7921L20.2627%2019.5428L29.6799%2012.447C29.894%2012.2864%2030.1543%2012.1996%2030.4219%2012.1996C30.6895%2012.1996%2030.9499%2012.2864%2031.1639%2012.447L40.2534%2019.2149L48.8482%2010.1148C48.9578%209.9891%2049.0917%209.88688%2049.2418%209.81428C49.3919%209.74167%2049.5551%209.70018%2049.7216%209.6923C49.8882%209.68442%2050.0546%209.7103%2050.2108%209.76841C50.3671%209.82651%2050.51%209.91562%2050.631%2010.0304C50.752%2010.1452%2050.8485%2010.2832%2050.9148%2010.4363C50.9811%2010.5893%2051.0157%2010.7542%2051.0167%2010.921C51.0177%2011.0878%2050.9849%2011.2531%2050.9204%2011.4069C50.8559%2011.5607%2050.761%2011.6999%2050.6414%2011.816L41.3046%2021.7142C41.0967%2021.9331%2040.816%2022.0685%2040.5153%2022.0947C40.2146%2022.1209%2039.9147%2022.0362%2039.6722%2021.8565L30.4405%2014.9835L21.3077%2021.8503C21.1699%2021.9547%2021.0117%2022.0289%2020.8435%2022.0684C20.6752%2022.1078%2020.5005%2022.1115%2020.3307%2022.0792L11.3402%2020.3347L2.31256%2027.7583C2.19883%2027.9202%202.04795%2028.0524%201.87258%2028.1439C1.69721%2028.2354%201.50246%2028.2835%201.30468%2028.2841Z'%20fill='%2384AFF1'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1648_105907'%20x1='76'%20y1='3.82312'%20x2='90.394'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1648_105907'%20x1='109.606'%20y1='3.82312'%20x2='124'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1648_105907'%20x1='92.8'%20y1='3.82312'%20x2='107.2'%20y2='3.82312'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1648_105907'%20x1='-4.82403e-06'%20y1='7.42369'%20x2='51'%20y2='7.42369'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2CC0C'/%3e%3cstop%20offset='1'%20stop-color='%23FF9830'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1648_105907'%20x1='25.4382'%20y1='48.2414'%20x2='25.9148'%20y2='8.49405'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F60C4'%20stop-opacity='0'/%3e%3cstop%20offset='1'%20stop-color='%233865AB'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1648_105907'%3e%3crect%20width='48'%20height='48'%20fill='white'%20transform='translate(76)'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_1648_105907'%3e%3crect%20width='51'%20height='48'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
const __vite_glob_0_69 = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='206'%20zoomAndPan='magnify'%20viewBox='0%200%20154.5%2041.25'%20height='55'%20preserveAspectRatio='xMidYMid%20meet'%20version='1.0'%3e%3cdefs%3e%3cg/%3e%3cclipPath%20id='9c77b18430'%3e%3cpath%20d='M%202.78125%202.292969%20L%2019.722656%202.292969%20L%2019.722656%202.871094%20L%202.78125%202.871094%20Z%20M%202.78125%202.871094%20L%2019.722656%202.871094%20L%2019.722656%209.503906%20L%202.78125%209.503906%20Z%20M%202.78125%202.871094%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%202.292546)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='586e4e0aaf'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='85a7b304f5'%3e%3cpath%20d='M%202.78125%2012.085938%20L%2019.722656%2012.085938%20L%2019.722656%2012.664062%20L%202.78125%2012.664062%20Z%20M%202.78125%2012.664062%20L%2019.722656%2012.664062%20L%2019.722656%2019.300781%20L%202.78125%2019.300781%20Z%20M%202.78125%2012.664062%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%2012.086858)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='d62f7bd1f9'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='5fd514023d'%3e%3cpath%20d='M%202.78125%2021.726562%20L%2019.722656%2021.726562%20L%2019.722656%2022.304688%20L%202.78125%2022.304688%20Z%20M%202.78125%2022.304688%20L%2019.722656%2022.304688%20L%2019.722656%2028.941406%20L%202.78125%2028.941406%20Z%20M%202.78125%2022.304688%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%2021.72763)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='a1cdb846f2'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='533432af0f'%3e%3cpath%20d='M%202.78125%2031.367188%20L%2019.722656%2031.367188%20L%2019.722656%2031.945312%20L%202.78125%2031.945312%20Z%20M%202.78125%2031.945312%20L%2019.722656%2031.945312%20L%2019.722656%2038.582031%20L%202.78125%2038.582031%20Z%20M%202.78125%2031.945312%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038808'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20-17.543196,%2031.368404)'%20y1='5.004'%20x2='51.41194'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='2f4d7a7d59'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='32844660bb'%3e%3cpath%20d='M%2023.167969%202.292969%20L%2040.109375%202.292969%20L%2040.109375%202.871094%20L%2023.167969%202.871094%20Z%20M%2023.167969%202.871094%20L%2040.109375%202.871094%20L%2040.109375%209.503906%20L%2023.167969%209.503906%20Z%20M%2023.167969%202.871094%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038809'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%202.844588,%202.292546)'%20y1='5.004'%20x2='51.411943'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='3fd4eaccda'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='f8ded3fd83'%3e%3cpath%20d='M%2043.5625%202.292969%20L%2060.503906%202.292969%20L%2060.503906%202.871094%20L%2043.5625%202.871094%20Z%20M%2043.5625%202.871094%20L%2060.503906%202.871094%20L%2060.503906%209.503906%20L%2043.5625%209.503906%20Z%20M%2043.5625%202.871094%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038809'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2023.236872,%202.292546)'%20y1='5.004'%20x2='51.411941'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='e28c8340a7'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='807e5e3a31'%3e%3cpath%20d='M%2023.128906%2012.273438%20L%2040.046875%2012.273438%20L%2040.046875%2018.902344%20L%2023.128906%2018.902344%20Z%20M%2023.128906%2012.273438%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='1a9efdd965'%3e%3cpath%20d='M%2043.523438%2012.273438%20L%2060.441406%2012.273438%20L%2060.441406%2018.902344%20L%2043.523438%2018.902344%20Z%20M%2043.523438%2012.273438%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='eb15d22d78'%3e%3cpath%20d='M%2023.191406%2022.042969%20L%2040.109375%2022.042969%20L%2040.109375%2028.671875%20L%2023.191406%2028.671875%20Z%20M%2023.191406%2022.042969%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='6ed351094f'%3e%3cpath%20d='M%2043.648438%2022.042969%20L%2060.566406%2022.042969%20L%2060.566406%2028.671875%20L%2043.648438%2028.671875%20Z%20M%2043.648438%2022.042969%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='7b2bb54ce0'%3e%3cpath%20d='M%2023.191406%2031.367188%20L%2040.109375%2031.367188%20L%2040.109375%2037.996094%20L%2023.191406%2037.996094%20Z%20M%2023.191406%2031.367188%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='4cdf6db877'%3e%3cpath%20d='M%2043.585938%2031.367188%20L%2060.503906%2031.367188%20L%2060.503906%2037.996094%20L%2043.585938%2037.996094%20Z%20M%2043.585938%2031.367188%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='c7b3e253da'%3e%3cpath%20d='M%2072.824219%208.578125%20L%2089.765625%208.578125%20L%2089.765625%209.152344%20L%2072.824219%209.152344%20Z%20M%2072.824219%209.152344%20L%2089.765625%209.152344%20L%2089.765625%2015.789062%20L%2072.824219%2015.789062%20Z%20M%2072.824219%209.152344%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038818'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2052.501412,%208.576231)'%20y1='5.004'%20x2='51.41195'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='a98ad63194'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='59bc7dc508'%3e%3cpath%20d='M%2072.824219%2018.371094%20L%2089.765625%2018.371094%20L%2089.765625%2018.949219%20L%2072.824219%2018.949219%20Z%20M%2072.824219%2018.949219%20L%2089.765625%2018.949219%20L%2089.765625%2025.582031%20L%2072.824219%2025.582031%20Z%20M%2072.824219%2018.949219%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038818'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2052.501412,%2018.370546)'%20y1='5.004'%20x2='51.41195'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='7aa9c63f84'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='3374980bc7'%3e%3cpath%20d='M%2072.824219%2028.011719%20L%2089.765625%2028.011719%20L%2089.765625%2028.589844%20L%2072.824219%2028.589844%20Z%20M%2072.824219%2028.589844%20L%2089.765625%2028.589844%20L%2089.765625%2035.222656%20L%2072.824219%2035.222656%20Z%20M%2072.824219%2028.589844%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038818'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2052.501412,%2028.011317)'%20y1='5.004'%20x2='51.41195'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='f0b776da89'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='9de7fff919'%3e%3cpath%20d='M%2093.214844%208.578125%20L%20110.15625%208.578125%20L%20110.15625%209.152344%20L%2093.214844%209.152344%20Z%20M%2093.214844%209.152344%20L%20110.15625%209.152344%20L%20110.15625%2015.789062%20L%2093.214844%2015.789062%20Z%20M%2093.214844%209.152344%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038816'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2072.889193,%208.576231)'%20y1='5.004'%20x2='51.411949'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='076aceffe8'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='e9901ed91b'%3e%3cpath%20d='M%20113.605469%208.578125%20L%20130.546875%208.578125%20L%20130.546875%209.152344%20L%20113.605469%209.152344%20Z%20M%20113.605469%209.152344%20L%20130.546875%209.152344%20L%20130.546875%2015.789062%20L%20113.605469%2015.789062%20Z%20M%20113.605469%209.152344%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038807'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%2093.281478,%208.576231)'%20y1='5.004'%20x2='51.411939'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='d4c57477a4'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.954102%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3cclipPath%20id='eb792ed027'%3e%3cpath%20d='M%2093.175781%2018.558594%20L%20110.09375%2018.558594%20L%20110.09375%2025.1875%20L%2093.175781%2025.1875%20Z%20M%2093.175781%2018.558594%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='96a42728f2'%3e%3cpath%20d='M%2093.304688%2028.328125%20L%20110.222656%2028.328125%20L%20110.222656%2034.957031%20L%2093.304688%2034.957031%20Z%20M%2093.304688%2028.328125%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='fe8633168e'%3e%3cpath%20d='M%20113.660156%2018.558594%20L%20130.578125%2018.558594%20L%20130.578125%2025.1875%20L%20113.660156%2025.1875%20Z%20M%20113.660156%2018.558594%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='61c7415809'%3e%3cpath%20d='M%20113.761719%2028.03125%20L%20130.679688%2028.03125%20L%20130.679688%2034.664062%20L%20113.761719%2034.664062%20Z%20M%20113.761719%2028.03125%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='acf50263c6'%3e%3cpath%20d='M%20133.894531%2018.625%20L%20150.8125%2018.625%20L%20150.8125%2025.253906%20L%20133.894531%2025.253906%20Z%20M%20133.894531%2018.625%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='eba48b04ac'%3e%3cpath%20d='M%20134.023438%2027.792969%20L%20150.941406%2027.792969%20L%20150.941406%2034.421875%20L%20134.023438%2034.421875%20Z%20M%20134.023438%2027.792969%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3cclipPath%20id='a073bb6f5a'%3e%3cpath%20d='M%20133.839844%208.570312%20L%20150.78125%208.570312%20L%20150.78125%209.148438%20L%20133.839844%209.148438%20Z%20M%20133.839844%209.148438%20L%20150.78125%209.148438%20L%20150.78125%2015.78125%20L%20133.839844%2015.78125%20Z%20M%20133.839844%209.148438%20'%20clip-rule='nonzero'/%3e%3c/clipPath%3e%3clinearGradient%20x1='28.038803'%20gradientTransform='matrix(0.724848,%200,%200,%200.721261,%20113.515935,%208.570574)'%20y1='5.004'%20x2='51.411935'%20gradientUnits='userSpaceOnUse'%20y2='5.004'%20id='61512084a3'%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.90509%25,%2079.972839%25,%204.718018%25)'%20offset='0'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(94.943237%25,%2079.8172%25,%204.824829%25)'%20offset='0.015625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.021057%25,%2079.507446%25,%205.038452%25)'%20offset='0.03125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.098877%25,%2079.196167%25,%205.253601%25)'%20offset='0.046875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.176697%25,%2078.886414%25,%205.467224%25)'%20offset='0.0625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.254517%25,%2078.575134%25,%205.682373%25)'%20offset='0.078125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.332336%25,%2078.265381%25,%205.897522%25)'%20offset='0.09375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.410156%25,%2077.955627%25,%206.111145%25)'%20offset='0.109375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.48645%25,%2077.644348%25,%206.326294%25)'%20offset='0.125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.56427%25,%2077.334595%25,%206.539917%25)'%20offset='0.140625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.64209%25,%2077.023315%25,%206.755066%25)'%20offset='0.15625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.71991%25,%2076.713562%25,%206.970215%25)'%20offset='0.171875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.797729%25,%2076.402283%25,%207.183838%25)'%20offset='0.1875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.875549%25,%2076.092529%25,%207.398987%25)'%20offset='0.203125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(95.953369%25,%2075.78125%25,%207.614136%25)'%20offset='0.21875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.029663%25,%2075.471497%25,%207.827759%25)'%20offset='0.234375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.107483%25,%2075.161743%25,%208.042908%25)'%20offset='0.25'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.185303%25,%2074.850464%25,%208.256531%25)'%20offset='0.265625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.263123%25,%2074.54071%25,%208.47168%25)'%20offset='0.28125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.340942%25,%2074.229431%25,%208.686829%25)'%20offset='0.296875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.418762%25,%2073.919678%25,%208.900452%25)'%20offset='0.3125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.496582%25,%2073.608398%25,%209.115601%25)'%20offset='0.328125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.574402%25,%2073.298645%25,%209.329224%25)'%20offset='0.34375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.650696%25,%2072.987366%25,%209.544373%25)'%20offset='0.359375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.728516%25,%2072.677612%25,%209.759521%25)'%20offset='0.375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.806335%25,%2072.367859%25,%209.973145%25)'%20offset='0.390625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.884155%25,%2072.05658%25,%2010.188293%25)'%20offset='0.40625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(96.961975%25,%2071.746826%25,%2010.401917%25)'%20offset='0.421875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.039795%25,%2071.435547%25,%2010.617065%25)'%20offset='0.4375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.117615%25,%2071.125793%25,%2010.832214%25)'%20offset='0.453125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.193909%25,%2070.814514%25,%2011.045837%25)'%20offset='0.46875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.271729%25,%2070.504761%25,%2011.260986%25)'%20offset='0.484375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.349548%25,%2070.195007%25,%2011.476135%25)'%20offset='0.5'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.427368%25,%2069.883728%25,%2011.689758%25)'%20offset='0.515625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.505188%25,%2069.573975%25,%2011.904907%25)'%20offset='0.53125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.583008%25,%2069.262695%25,%2012.11853%25)'%20offset='0.546875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.660828%25,%2068.952942%25,%2012.333679%25)'%20offset='0.5625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.737122%25,%2068.641663%25,%2012.548828%25)'%20offset='0.578125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.814941%25,%2068.331909%25,%2012.762451%25)'%20offset='0.59375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.892761%25,%2068.02063%25,%2012.9776%25)'%20offset='0.609375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(97.970581%25,%2067.710876%25,%2013.191223%25)'%20offset='0.625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.048401%25,%2067.401123%25,%2013.406372%25)'%20offset='0.640625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.126221%25,%2067.089844%25,%2013.621521%25)'%20offset='0.65625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.204041%25,%2066.78009%25,%2013.835144%25)'%20offset='0.671875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.280334%25,%2066.468811%25,%2014.050293%25)'%20offset='0.6875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.358154%25,%2066.159058%25,%2014.265442%25)'%20offset='0.703125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.435974%25,%2065.847778%25,%2014.479065%25)'%20offset='0.71875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.513794%25,%2065.538025%25,%2014.694214%25)'%20offset='0.734375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.591614%25,%2065.226746%25,%2014.907837%25)'%20offset='0.75'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.669434%25,%2064.916992%25,%2015.122986%25)'%20offset='0.765625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.747253%25,%2064.607239%25,%2015.338135%25)'%20offset='0.78125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.823547%25,%2064.295959%25,%2015.551758%25)'%20offset='0.796875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.901367%25,%2063.986206%25,%2015.766907%25)'%20offset='0.8125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(98.979187%25,%2063.674927%25,%2015.98053%25)'%20offset='0.828125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.057007%25,%2063.365173%25,%2016.195679%25)'%20offset='0.84375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.134827%25,%2063.053894%25,%2016.410828%25)'%20offset='0.859375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.212646%25,%2062.744141%25,%2016.624451%25)'%20offset='0.875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.290466%25,%2062.434387%25,%2016.8396%25)'%20offset='0.890625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.36676%25,%2062.123108%25,%2017.053223%25)'%20offset='0.90625'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.44458%25,%2061.813354%25,%2017.268372%25)'%20offset='0.921875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.5224%25,%2061.502075%25,%2017.483521%25)'%20offset='0.9375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.60022%25,%2061.192322%25,%2017.697144%25)'%20offset='0.953125'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.67804%25,%2060.881042%25,%2017.912292%25)'%20offset='0.96875'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.755859%25,%2060.571289%25,%2018.127441%25)'%20offset='0.984375'/%3e%3cstop%20stop-opacity='1'%20stop-color='rgb(99.833679%25,%2060.26001%25,%2018.341064%25)'%20offset='1'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20fill='%2324292e'%20d='M%2066.765625%2024.945312%20C%2067.269531%2024.945312%2071.136719%2022.0625%2071.136719%2020.617188%20C%2071.136719%2019.175781%2067.367188%2016.292969%2066.765625%2016.292969%20C%2066.167969%2016.292969%2065.675781%2016.652344%2065.675781%2017.355469%20C%2065.675781%2018.058594%2068.214844%2019.839844%2068.214844%2019.839844%20C%2068.214844%2019.839844%2062.667969%2019.355469%2062.484375%2019.839844%20C%2062.300781%2020.324219%2062.300781%2020.914062%2062.484375%2021.398438%20C%2062.667969%2021.882812%2068.214844%2021.398438%2068.214844%2021.398438%20C%2068.214844%2021.398438%2065.675781%2023.324219%2065.675781%2023.886719%20C%2065.675781%2024.449219%2066.261719%2024.945312%2066.765625%2024.945312%20Z%20M%2066.765625%2024.945312%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3cg%20clip-path='url(%239c77b18430)'%3e%3cpath%20fill='url(%23586e4e0aaf)'%20d='M%202.78125%202.292969%20L%202.78125%209.503906%20L%2019.722656%209.503906%20L%2019.722656%202.292969%20Z%20M%202.78125%202.292969%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2385a7b304f5)'%3e%3cpath%20fill='url(%23d62f7bd1f9)'%20d='M%202.78125%2012.085938%20L%202.78125%2019.300781%20L%2019.722656%2019.300781%20L%2019.722656%2012.085938%20Z%20M%202.78125%2012.085938%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%235fd514023d)'%3e%3cpath%20fill='url(%23a1cdb846f2)'%20d='M%202.78125%2021.726562%20L%202.78125%2028.941406%20L%2019.722656%2028.941406%20L%2019.722656%2021.726562%20Z%20M%202.78125%2021.726562%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23533432af0f)'%3e%3cpath%20fill='url(%232f4d7a7d59)'%20d='M%202.78125%2031.367188%20L%202.78125%2038.582031%20L%2019.722656%2038.582031%20L%2019.722656%2031.367188%20Z%20M%202.78125%2031.367188%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2332844660bb)'%3e%3cpath%20fill='url(%233fd4eaccda)'%20d='M%2023.167969%202.292969%20L%2023.167969%209.503906%20L%2040.109375%209.503906%20L%2040.109375%202.292969%20Z%20M%2023.167969%202.292969%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23f8ded3fd83)'%3e%3cpath%20fill='url(%23e28c8340a7)'%20d='M%2043.5625%202.292969%20L%2043.5625%209.503906%20L%2060.503906%209.503906%20L%2060.503906%202.292969%20Z%20M%2043.5625%202.292969%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23807e5e3a31)'%3e%3cpath%20fill='%2384aff1'%20d='M%2040.523438%2012.222656%20L%2023.128906%2012.222656%20L%2023.128906%2019.078125%20L%2040.523438%2019.078125%20Z%20M%2040.523438%2012.222656%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%231a9efdd965)'%3e%3cpath%20fill='%2384aff1'%20d='M%2060.917969%2012.222656%20L%2043.523438%2012.222656%20L%2043.523438%2019.078125%20L%2060.917969%2019.078125%20Z%20M%2060.917969%2012.222656%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23eb15d22d78)'%3e%3cpath%20fill='%2384aff1'%20d='M%2040.585938%2021.992188%20L%2023.191406%2021.992188%20L%2023.191406%2028.847656%20L%2040.585938%2028.847656%20Z%20M%2040.585938%2021.992188%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%236ed351094f)'%3e%3cpath%20fill='%2384aff1'%20d='M%2061.042969%2021.992188%20L%2043.648438%2021.992188%20L%2043.648438%2028.847656%20L%2061.042969%2028.847656%20Z%20M%2061.042969%2021.992188%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%237b2bb54ce0)'%3e%3cpath%20fill='%2384aff1'%20d='M%2040.585938%2031.320312%20L%2023.191406%2031.320312%20L%2023.191406%2038.171875%20L%2040.585938%2038.171875%20Z%20M%2040.585938%2031.320312%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%234cdf6db877)'%3e%3cpath%20fill='%2384aff1'%20d='M%2060.980469%2031.320312%20L%2043.585938%2031.320312%20L%2043.585938%2038.171875%20L%2060.980469%2038.171875%20Z%20M%2060.980469%2031.320312%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23c7b3e253da)'%3e%3cpath%20fill='url(%23a98ad63194)'%20d='M%2072.824219%208.578125%20L%2072.824219%2015.789062%20L%2089.765625%2015.789062%20L%2089.765625%208.578125%20Z%20M%2072.824219%208.578125%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2359bc7dc508)'%3e%3cpath%20fill='url(%237aa9c63f84)'%20d='M%2072.824219%2018.371094%20L%2072.824219%2025.582031%20L%2089.765625%2025.582031%20L%2089.765625%2018.371094%20Z%20M%2072.824219%2018.371094%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%233374980bc7)'%3e%3cpath%20fill='url(%23f0b776da89)'%20d='M%2072.824219%2028.011719%20L%2072.824219%2035.222656%20L%2089.765625%2035.222656%20L%2089.765625%2028.011719%20Z%20M%2072.824219%2028.011719%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%239de7fff919)'%3e%3cpath%20fill='url(%23076aceffe8)'%20d='M%2093.214844%208.578125%20L%2093.214844%2015.789062%20L%20110.15625%2015.789062%20L%20110.15625%208.578125%20Z%20M%2093.214844%208.578125%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23e9901ed91b)'%3e%3cpath%20fill='url(%23d4c57477a4)'%20d='M%20113.605469%208.578125%20L%20113.605469%2015.789062%20L%20130.546875%2015.789062%20L%20130.546875%208.578125%20Z%20M%20113.605469%208.578125%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23eb792ed027)'%3e%3cpath%20fill='%2384aff1'%20d='M%20110.570312%2018.507812%20L%2093.175781%2018.507812%20L%2093.175781%2025.359375%20L%20110.570312%2025.359375%20Z%20M%20110.570312%2018.507812%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2396a42728f2)'%3e%3cpath%20fill='%2384aff1'%20d='M%20110.699219%2028.277344%20L%2093.304688%2028.277344%20L%2093.304688%2035.128906%20L%20110.699219%2035.128906%20Z%20M%20110.699219%2028.277344%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23fe8633168e)'%3e%3cpath%20fill='%2384aff1'%20d='M%20131.054688%2018.507812%20L%20113.660156%2018.507812%20L%20113.660156%2025.359375%20L%20131.054688%2025.359375%20Z%20M%20131.054688%2018.507812%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%2361c7415809)'%3e%3cpath%20fill='%2384aff1'%20d='M%20131.15625%2027.984375%20L%20113.761719%2027.984375%20L%20113.761719%2034.835938%20L%20131.15625%2034.835938%20Z%20M%20131.15625%2027.984375%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23acf50263c6)'%3e%3cpath%20fill='%2384aff1'%20d='M%20151.289062%2018.574219%20L%20133.894531%2018.574219%20L%20133.894531%2025.429688%20L%20151.289062%2025.429688%20Z%20M%20151.289062%2018.574219%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23eba48b04ac)'%3e%3cpath%20fill='%2384aff1'%20d='M%20151.417969%2027.742188%20L%20134.023438%2027.742188%20L%20134.023438%2034.59375%20L%20151.417969%2034.59375%20Z%20M%20151.417969%2027.742188%20'%20fill-opacity='1'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20clip-path='url(%23a073bb6f5a)'%3e%3cpath%20fill='url(%2361512084a3)'%20d='M%20133.839844%208.570312%20L%20133.839844%2015.78125%20L%20150.78125%2015.78125%20L%20150.78125%208.570312%20Z%20M%20133.839844%208.570312%20'%20fill-rule='nonzero'/%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(7.407211,%2017.93532)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(11.901125,%2017.93532)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(7.303632,%2027.306779)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(11.797546,%2027.306779)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(7.190188,%2036.692702)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(11.684102,%2036.692702)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(27.560215,%208.212119)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(32.274384,%208.212119)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(47.972226,%208.217777)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(52.686396,%208.217777)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(9.753033,%207.918055)'%3e%3cg%3e%3cpath%20d='M%203.859375%20-4.8125%20L%203.859375%20-4.015625%20L%202.46875%20-4.015625%20L%202.46875%200%20L%201.515625%200%20L%201.515625%20-4.015625%20L%200.125%20-4.015625%20L%200.125%20-4.8125%20Z%20M%203.859375%20-4.8125%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(30.04217,%2017.666008)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(51.130956,%2017.93532)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(29.701344,%2027.306779)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(50.911466,%2027.435567)'%3e%3cg%3e%3cpath%20d='M%203.265625%200%20L%202.359375%200%20L%202.359375%20-1.046875%20L%200.171875%20-1.046875%20L%200.171875%20-1.8125%20L%202.046875%20-4.8125%20L%203.265625%20-4.8125%20L%203.265625%20-1.8125%20L%204%20-1.8125%20L%204%20-1.046875%20L%203.265625%20-1.046875%20Z%20M%201.140625%20-1.875%20L%201.171875%20-1.8125%20L%202.359375%20-1.8125%20L%202.359375%20-3.671875%20L%202.28125%20-3.6875%20Z%20M%201.140625%20-1.875%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(29.891734,%2036.692702)'%3e%3cg%3e%3cpath%20d='M%202%200.0625%20C%201.519531%200.0625%201.140625%20-0.0351562%200.859375%20-0.234375%20C%200.578125%20-0.429688%200.394531%20-0.710938%200.3125%20-1.078125%20L%201.03125%20-1.390625%20L%201.109375%20-1.390625%20C%201.171875%20-1.171875%201.269531%20-1.007812%201.40625%20-0.90625%20C%201.550781%20-0.800781%201.75%20-0.75%202%20-0.75%20C%202.25%20-0.75%202.441406%20-0.816406%202.578125%20-0.953125%20C%202.710938%20-1.097656%202.78125%20-1.3125%202.78125%20-1.59375%20C%202.78125%20-1.875%202.710938%20-2.085938%202.578125%20-2.234375%20C%202.441406%20-2.378906%202.253906%20-2.453125%202.015625%20-2.453125%20C%201.835938%20-2.453125%201.6875%20-2.410156%201.5625%20-2.328125%20C%201.445312%20-2.253906%201.347656%20-2.144531%201.265625%20-2%20L%200.484375%20-2.046875%20L%200.578125%20-4.8125%20L%203.453125%20-4.8125%20L%203.453125%20-4.015625%20L%201.390625%20-4.015625%20L%201.34375%20-2.78125%20L%201.40625%20-2.765625%20C%201.519531%20-2.910156%201.65625%20-3.019531%201.8125%20-3.09375%20C%201.96875%20-3.175781%202.15625%20-3.21875%202.375%20-3.21875%20C%202.644531%20-3.21875%202.878906%20-3.15625%203.078125%20-3.03125%20C%203.285156%20-2.90625%203.445312%20-2.722656%203.5625%20-2.484375%20C%203.675781%20-2.242188%203.734375%20-1.953125%203.734375%20-1.609375%20C%203.734375%20-1.253906%203.664062%20-0.953125%203.53125%20-0.703125%20C%203.394531%20-0.453125%203.195312%20-0.257812%202.9375%20-0.125%20C%202.675781%200%202.363281%200.0625%202%200.0625%20Z%20M%202%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(50.672254,%2036.760669)'%3e%3cg%3e%3cpath%20d='M%202.296875%200.0625%20C%201.929688%200.0625%201.609375%20-0.0195312%201.328125%20-0.1875%20C%201.046875%20-0.351562%200.820312%20-0.613281%200.65625%20-0.96875%20C%200.488281%20-1.332031%200.40625%20-1.796875%200.40625%20-2.359375%20C%200.40625%20-2.929688%200.492188%20-3.40625%200.671875%20-3.78125%20C%200.847656%20-4.15625%201.085938%20-4.429688%201.390625%20-4.609375%20C%201.691406%20-4.785156%202.039062%20-4.875%202.4375%20-4.875%20C%202.757812%20-4.875%203.035156%20-4.828125%203.265625%20-4.734375%20C%203.503906%20-4.640625%203.691406%20-4.5%203.828125%20-4.3125%20L%203.359375%20-3.71875%20L%203.28125%20-3.71875%20C%203.070312%20-3.957031%202.789062%20-4.078125%202.4375%20-4.078125%20C%201.75%20-4.078125%201.394531%20-3.578125%201.375%20-2.578125%20L%201.453125%20-2.546875%20C%201.566406%20-2.753906%201.710938%20-2.910156%201.890625%20-3.015625%20C%202.078125%20-3.128906%202.304688%20-3.1875%202.578125%20-3.1875%20C%202.878906%20-3.1875%203.140625%20-3.125%203.359375%20-3%20C%203.578125%20-2.875%203.742188%20-2.691406%203.859375%20-2.453125%20C%203.972656%20-2.222656%204.03125%20-1.945312%204.03125%20-1.625%20C%204.03125%20-1.269531%203.957031%20-0.960938%203.8125%20-0.703125%20C%203.675781%20-0.453125%203.476562%20-0.257812%203.21875%20-0.125%20C%202.957031%200%202.648438%200.0625%202.296875%200.0625%20Z%20M%202.28125%20-0.75%20C%202.53125%20-0.75%202.722656%20-0.820312%202.859375%20-0.96875%20C%203.003906%20-1.113281%203.078125%20-1.316406%203.078125%20-1.578125%20C%203.078125%20-1.835938%203.003906%20-2.039062%202.859375%20-2.1875%20C%202.722656%20-2.332031%202.53125%20-2.40625%202.28125%20-2.40625%20C%202.113281%20-2.40625%201.96875%20-2.367188%201.84375%20-2.296875%20C%201.726562%20-2.234375%201.632812%20-2.140625%201.5625%20-2.015625%20C%201.5%20-1.890625%201.46875%20-1.742188%201.46875%20-1.578125%20C%201.46875%20-1.316406%201.539062%20-1.113281%201.6875%20-0.96875%20C%201.832031%20-0.820312%202.03125%20-0.75%202.28125%20-0.75%20Z%20M%202.28125%20-0.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(77.343314,%2024.219007)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(82.057484,%2024.219007)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(77.239735,%2033.590469)'%3e%3cg%3e%3cpath%20d='M%202.625%200.0625%20C%202.1875%200.0625%201.796875%20-0.0234375%201.453125%20-0.203125%20C%201.117188%20-0.390625%200.851562%20-0.664062%200.65625%20-1.03125%20C%200.46875%20-1.40625%200.375%20-1.863281%200.375%20-2.40625%20C%200.375%20-2.945312%200.46875%20-3.398438%200.65625%20-3.765625%20C%200.851562%20-4.140625%201.117188%20-4.414062%201.453125%20-4.59375%20C%201.796875%20-4.78125%202.1875%20-4.875%202.625%20-4.875%20C%203.09375%20-4.875%203.488281%20-4.78125%203.8125%20-4.59375%20C%204.132812%20-4.414062%204.363281%20-4.144531%204.5%20-3.78125%20L%203.796875%20-3.359375%20L%203.71875%20-3.359375%20C%203.613281%20-3.609375%203.472656%20-3.785156%203.296875%20-3.890625%20C%203.117188%20-4.003906%202.894531%20-4.0625%202.625%20-4.0625%20C%202.226562%20-4.0625%201.914062%20-3.925781%201.6875%20-3.65625%20C%201.46875%20-3.394531%201.359375%20-2.976562%201.359375%20-2.40625%20C%201.359375%20-1.832031%201.46875%20-1.410156%201.6875%20-1.140625%20C%201.914062%20-0.878906%202.226562%20-0.75%202.625%20-0.75%20C%203.25%20-0.75%203.632812%20-1.050781%203.78125%20-1.65625%20L%203.859375%20-1.65625%20L%204.5625%20-1.296875%20C%204.425781%20-0.835938%204.195312%20-0.492188%203.875%20-0.265625%20C%203.5625%20-0.046875%203.144531%200.0625%202.625%200.0625%20Z%20M%202.625%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(81.953905,%2033.590469)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(97.713335,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(102.207249,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(118.130283,%2014.501465)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(122.624198,%2014.501465)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(79.797647,%2014.201743)'%3e%3cg%3e%3cpath%20d='M%203.859375%20-4.8125%20L%203.859375%20-4.015625%20L%202.46875%20-4.015625%20L%202.46875%200%20L%201.515625%200%20L%201.515625%20-4.015625%20L%200.125%20-4.015625%20L%200.125%20-4.8125%20Z%20M%203.859375%20-4.8125%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(100.086779,%2023.949696)'%3e%3cg%3e%3cpath%20d='M%200.25%200%20L%200.25%20-0.78125%20L%201.40625%20-0.78125%20L%201.40625%20-3.78125%20L%201.34375%20-3.796875%20C%201.175781%20-3.710938%201.007812%20-3.648438%200.84375%20-3.609375%20C%200.6875%20-3.566406%200.507812%20-3.53125%200.3125%20-3.5%20L%200.3125%20-4.3125%20C%200.84375%20-4.425781%201.269531%20-4.59375%201.59375%20-4.8125%20L%202.359375%20-4.8125%20L%202.359375%20-0.78125%20L%203.390625%20-0.78125%20L%203.390625%200%20Z%20M%200.25%200%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(100.914058,%2033.988566)'%3e%3cg%3e%3cpath%20d='M%200.234375%20-0.375%20C%200.234375%20-0.644531%200.257812%20-0.867188%200.3125%20-1.046875%20C%200.375%20-1.234375%200.46875%20-1.398438%200.59375%20-1.546875%20C%200.726562%20-1.703125%200.914062%20-1.863281%201.15625%20-2.03125%20L%201.8125%20-2.5%20C%201.976562%20-2.625%202.109375%20-2.734375%202.203125%20-2.828125%20C%202.304688%20-2.921875%202.382812%20-3.015625%202.4375%20-3.109375%20C%202.488281%20-3.210938%202.515625%20-3.328125%202.515625%20-3.453125%20C%202.515625%20-3.648438%202.453125%20-3.800781%202.328125%20-3.90625%20C%202.210938%20-4.019531%202.035156%20-4.078125%201.796875%20-4.078125%20C%201.566406%20-4.078125%201.363281%20-4.019531%201.1875%20-3.90625%20C%201.007812%20-3.800781%200.863281%20-3.65625%200.75%20-3.46875%20L%200.6875%20-3.453125%20L%200.171875%20-4.03125%20C%200.335938%20-4.28125%200.554688%20-4.484375%200.828125%20-4.640625%20C%201.109375%20-4.796875%201.441406%20-4.875%201.828125%20-4.875%20C%202.191406%20-4.875%202.492188%20-4.8125%202.734375%20-4.6875%20C%202.972656%20-4.570312%203.148438%20-4.410156%203.265625%20-4.203125%20C%203.390625%20-4.003906%203.453125%20-3.773438%203.453125%20-3.515625%20C%203.453125%20-3.285156%203.40625%20-3.070312%203.3125%20-2.875%20C%203.21875%20-2.6875%203.082031%20-2.515625%202.90625%20-2.359375%20C%202.738281%20-2.203125%202.523438%20-2.03125%202.265625%20-1.84375%20L%201.703125%20-1.453125%20C%201.523438%20-1.328125%201.398438%20-1.21875%201.328125%20-1.125%20C%201.265625%20-1.03125%201.234375%20-0.921875%201.234375%20-0.796875%20L%203.40625%20-0.796875%20L%203.40625%200%20L%200.234375%200%20Z%20M%200.234375%20-0.375%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(120.169809,%2023.820908)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(121.023713,%2033.425191)'%3e%3cg%3e%3cpath%20d='M%203.265625%200%20L%202.359375%200%20L%202.359375%20-1.046875%20L%200.171875%20-1.046875%20L%200.171875%20-1.8125%20L%202.046875%20-4.8125%20L%203.265625%20-4.8125%20L%203.265625%20-1.8125%20L%204%20-1.8125%20L%204%20-1.046875%20L%203.265625%20-1.046875%20Z%20M%201.140625%20-1.875%20L%201.171875%20-1.8125%20L%202.359375%20-1.8125%20L%202.359375%20-3.671875%20L%202.28125%20-3.6875%20Z%20M%201.140625%20-1.875%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(140.594644,%2023.949696)'%3e%3cg%3e%3cpath%20d='M%202%200.0625%20C%201.519531%200.0625%201.140625%20-0.0351562%200.859375%20-0.234375%20C%200.578125%20-0.429688%200.394531%20-0.710938%200.3125%20-1.078125%20L%201.03125%20-1.390625%20L%201.109375%20-1.390625%20C%201.171875%20-1.171875%201.269531%20-1.007812%201.40625%20-0.90625%20C%201.550781%20-0.800781%201.75%20-0.75%202%20-0.75%20C%202.25%20-0.75%202.441406%20-0.816406%202.578125%20-0.953125%20C%202.710938%20-1.097656%202.78125%20-1.3125%202.78125%20-1.59375%20C%202.78125%20-1.875%202.710938%20-2.085938%202.578125%20-2.234375%20C%202.441406%20-2.378906%202.253906%20-2.453125%202.015625%20-2.453125%20C%201.835938%20-2.453125%201.6875%20-2.410156%201.5625%20-2.328125%20C%201.445312%20-2.253906%201.347656%20-2.144531%201.265625%20-2%20L%200.484375%20-2.046875%20L%200.578125%20-4.8125%20L%203.453125%20-4.8125%20L%203.453125%20-4.015625%20L%201.390625%20-4.015625%20L%201.34375%20-2.78125%20L%201.40625%20-2.765625%20C%201.519531%20-2.910156%201.65625%20-3.019531%201.8125%20-3.09375%20C%201.96875%20-3.175781%202.15625%20-3.21875%202.375%20-3.21875%20C%202.644531%20-3.21875%202.878906%20-3.15625%203.078125%20-3.03125%20C%203.285156%20-2.90625%203.445312%20-2.722656%203.5625%20-2.484375%20C%203.675781%20-2.242188%203.734375%20-1.953125%203.734375%20-1.609375%20C%203.734375%20-1.253906%203.664062%20-0.953125%203.53125%20-0.703125%20C%203.394531%20-0.453125%203.195312%20-0.257812%202.9375%20-0.125%20C%202.675781%200%202.363281%200.0625%202%200.0625%20Z%20M%202%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(141.109147,%2033.184927)'%3e%3cg%3e%3cpath%20d='M%202.296875%200.0625%20C%201.929688%200.0625%201.609375%20-0.0195312%201.328125%20-0.1875%20C%201.046875%20-0.351562%200.820312%20-0.613281%200.65625%20-0.96875%20C%200.488281%20-1.332031%200.40625%20-1.796875%200.40625%20-2.359375%20C%200.40625%20-2.929688%200.492188%20-3.40625%200.671875%20-3.78125%20C%200.847656%20-4.15625%201.085938%20-4.429688%201.390625%20-4.609375%20C%201.691406%20-4.785156%202.039062%20-4.875%202.4375%20-4.875%20C%202.757812%20-4.875%203.035156%20-4.828125%203.265625%20-4.734375%20C%203.503906%20-4.640625%203.691406%20-4.5%203.828125%20-4.3125%20L%203.359375%20-3.71875%20L%203.28125%20-3.71875%20C%203.070312%20-3.957031%202.789062%20-4.078125%202.4375%20-4.078125%20C%201.75%20-4.078125%201.394531%20-3.578125%201.375%20-2.578125%20L%201.453125%20-2.546875%20C%201.566406%20-2.753906%201.710938%20-2.910156%201.890625%20-3.015625%20C%202.078125%20-3.128906%202.304688%20-3.1875%202.578125%20-3.1875%20C%202.878906%20-3.1875%203.140625%20-3.125%203.359375%20-3%20C%203.578125%20-2.875%203.742188%20-2.691406%203.859375%20-2.453125%20C%203.972656%20-2.222656%204.03125%20-1.945312%204.03125%20-1.625%20C%204.03125%20-1.269531%203.957031%20-0.960938%203.8125%20-0.703125%20C%203.675781%20-0.453125%203.476562%20-0.257812%203.21875%20-0.125%20C%202.957031%200%202.648438%200.0625%202.296875%200.0625%20Z%20M%202.28125%20-0.75%20C%202.53125%20-0.75%202.722656%20-0.820312%202.859375%20-0.96875%20C%203.003906%20-1.113281%203.078125%20-1.316406%203.078125%20-1.578125%20C%203.078125%20-1.835938%203.003906%20-2.039062%202.859375%20-2.1875%20C%202.722656%20-2.332031%202.53125%20-2.40625%202.28125%20-2.40625%20C%202.113281%20-2.40625%201.96875%20-2.367188%201.84375%20-2.296875%20C%201.726562%20-2.234375%201.632812%20-2.140625%201.5625%20-2.015625%20C%201.5%20-1.890625%201.46875%20-1.742188%201.46875%20-1.578125%20C%201.46875%20-1.316406%201.539062%20-1.113281%201.6875%20-0.96875%20C%201.832031%20-0.820312%202.03125%20-0.75%202.28125%20-0.75%20Z%20M%202.28125%20-0.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(138.251285,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%200.625%200%20L%200.625%20-4.8125%20L%202.5625%20-4.8125%20C%203.050781%20-4.8125%203.421875%20-4.695312%203.671875%20-4.46875%20C%203.929688%20-4.238281%204.0625%20-3.921875%204.0625%20-3.515625%20C%204.0625%20-3.222656%203.984375%20-2.984375%203.828125%20-2.796875%20C%203.679688%20-2.609375%203.460938%20-2.46875%203.171875%20-2.375%20L%203.171875%20-2.296875%20C%203.328125%20-2.234375%203.453125%20-2.132812%203.546875%20-2%20C%203.640625%20-1.875%203.726562%20-1.6875%203.8125%20-1.4375%20L%204.28125%200%20L%203.3125%200%20L%202.84375%20-1.4375%20C%202.789062%20-1.582031%202.734375%20-1.691406%202.671875%20-1.765625%20C%202.617188%20-1.847656%202.546875%20-1.90625%202.453125%20-1.9375%20C%202.359375%20-1.976562%202.234375%20-2%202.078125%20-2%20L%201.578125%20-2%20L%201.578125%200%20Z%20M%202.4375%20-2.75%20C%202.894531%20-2.75%203.125%20-2.96875%203.125%20-3.40625%20C%203.125%20-3.832031%202.894531%20-4.046875%202.4375%20-4.046875%20L%201.578125%20-4.046875%20L%201.578125%20-2.75%20Z%20M%202.4375%20-2.75%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20fill='%23000000'%20fill-opacity='1'%3e%3cg%20transform='translate(142.7452,%2014.495807)'%3e%3cg%3e%3cpath%20d='M%201.953125%200.0625%20C%201.441406%200.0625%201.035156%20-0.0390625%200.734375%20-0.25%20C%200.429688%20-0.46875%200.238281%20-0.78125%200.15625%20-1.1875%20L%200.875%20-1.515625%20L%200.953125%20-1.5%20C%201.035156%20-1.238281%201.148438%20-1.046875%201.296875%20-0.921875%20C%201.453125%20-0.804688%201.660156%20-0.75%201.921875%20-0.75%20C%202.179688%20-0.75%202.378906%20-0.804688%202.515625%20-0.921875%20C%202.648438%20-1.046875%202.71875%20-1.222656%202.71875%20-1.453125%20C%202.71875%20-1.671875%202.648438%20-1.84375%202.515625%20-1.96875%20C%202.378906%20-2.09375%202.179688%20-2.15625%201.921875%20-2.15625%20L%201.203125%20-2.15625%20L%201.203125%20-2.890625%20L%201.828125%20-2.890625%20C%202.046875%20-2.890625%202.21875%20-2.941406%202.34375%20-3.046875%20C%202.46875%20-3.160156%202.53125%20-3.316406%202.53125%20-3.515625%20C%202.53125%20-3.710938%202.472656%20-3.859375%202.359375%20-3.953125%20C%202.242188%20-4.054688%202.078125%20-4.109375%201.859375%20-4.109375%20C%201.648438%20-4.109375%201.460938%20-4.054688%201.296875%20-3.953125%20C%201.128906%20-3.847656%200.992188%20-3.710938%200.890625%20-3.546875%20L%200.8125%20-3.53125%20L%200.3125%20-4.109375%20C%200.488281%20-4.335938%200.707031%20-4.519531%200.96875%20-4.65625%20C%201.238281%20-4.800781%201.554688%20-4.875%201.921875%20-4.875%20C%202.421875%20-4.875%202.800781%20-4.769531%203.0625%20-4.5625%20C%203.332031%20-4.351562%203.46875%20-4.054688%203.46875%20-3.671875%20C%203.46875%20-3.441406%203.410156%20-3.242188%203.296875%20-3.078125%20C%203.191406%20-2.921875%203.039062%20-2.78125%202.84375%20-2.65625%20L%202.84375%20-2.59375%20C%203.394531%20-2.394531%203.671875%20-2%203.671875%20-1.40625%20C%203.671875%20-1.101562%203.609375%20-0.84375%203.484375%20-0.625%20C%203.359375%20-0.40625%203.164062%20-0.234375%202.90625%20-0.109375%20C%202.65625%200.00390625%202.335938%200.0625%201.953125%200.0625%20Z%20M%201.953125%200.0625%20'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
const _hoisted_1$16 = {
  class: "tpd",
  "data-testid": "transform-picker-drawer"
};
const _hoisted_2$W = { class: "tpd-search" };
const _hoisted_3$O = {
  class: "tpd-count",
  "data-testid": "transform-picker-count"
};
const _hoisted_4$D = { class: "tpd-cats" };
const _hoisted_5$x = ["data-testid", "onClick"];
const _hoisted_6$u = { class: "tpd-images" };
const _hoisted_7$s = { class: "tpd-switch" };
const _hoisted_8$n = { class: "tpd-grid" };
const _hoisted_9$m = ["data-testid", "onClick"];
const _hoisted_10$h = ["src", "alt"];
const _hoisted_11$h = { class: "tpd-name" };
const _hoisted_12$g = { class: "tpd-desc" };
const _hoisted_13$g = {
  key: 1,
  class: "tpd-tags"
};
const _hoisted_14$e = {
  key: 0,
  class: "tpd-empty"
};
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
  __name: "TransformationPickerDrawer",
  props: {
    open: { type: Boolean }
  },
  emits: ["update:open", "add"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const { resolved } = useTheme();
    const query = ref("");
    const category = ref("all");
    const showImages = ref(true);
    const categories = computed(() => {
      return Object.keys(TRANSFORMER_CATEGORY_LABELS).map(
        (k) => ({
          id: k,
          label: TRANSFORMER_CATEGORY_LABELS[k]
        })
      );
    });
    const all = computed(() => filterTransformers({ category: "all" }));
    const filtered = computed(
      () => filterTransformers({ query: query.value, category: category.value })
    );
    const IMAGE_ALIAS = {
      organize: "organize",
      filterByValue: "filterByValue",
      filterFieldsByName: "filterFieldsByName",
      filterByRefId: "filterByRefId",
      calculateField: "calculateField",
      groupBy: "groupBy",
      joinByField: "joinByField",
      extractFields: "extractFields",
      convertFieldType: "convertFieldType",
      partitionByValues: "partitionByValues",
      reduce: "reduce",
      sortBy: "sortBy",
      limit: "limit",
      histogram: "histogram",
      heatmap: "heatmap",
      merge: "merge",
      concatenate: "concatenate",
      seriesToRows: "seriesToRows",
      labelsToFields: "labelsToFields",
      prepareTimeSeries: "prepareTimeSeries",
      renameByRegex: "renameByRegex",
      groupToNestedTable: "groupToNestedTable",
      groupingToMatrix: "groupingToMatrix",
      joinByLabels: "joinByLabels",
      rowsToFields: "rowsToFields",
      configFromData: "configFromData",
      fieldLookup: "fieldLookup",
      formatTime: "formatTime",
      formatString: "formatString",
      spatial: "spatial"
    };
    function illustrationUrl(t2) {
      const theme = resolved.value === "light" ? "light" : "dark";
      const base = t2.image || IMAGE_ALIAS[t2.id] || t2.id;
      try {
        return new URL((/* @__PURE__ */ Object.assign({ "./images/dark/calculateField.svg": __vite_glob_0_0, "./images/dark/concatenate.svg": __vite_glob_0_1, "./images/dark/configFromData.svg": __vite_glob_0_2, "./images/dark/convertFieldType.svg": __vite_glob_0_3, "./images/dark/extractFields.svg": __vite_glob_0_4, "./images/dark/fieldLookup.svg": __vite_glob_0_5, "./images/dark/filterByRefId.svg": __vite_glob_0_6, "./images/dark/filterByValue.svg": __vite_glob_0_7, "./images/dark/filterFieldsByName.svg": __vite_glob_0_8, "./images/dark/formatString.svg": __vite_glob_0_9, "./images/dark/formatTime.svg": __vite_glob_0_10, "./images/dark/groupBy.svg": __vite_glob_0_11, "./images/dark/groupByCalculation.svg": __vite_glob_0_12, "./images/dark/groupToNestedTable.svg": __vite_glob_0_13, "./images/dark/groupingToMatrix.svg": __vite_glob_0_14, "./images/dark/heatmap.svg": __vite_glob_0_15, "./images/dark/histogram.svg": __vite_glob_0_16, "./images/dark/joinByField.svg": __vite_glob_0_17, "./images/dark/joinByLabels.svg": __vite_glob_0_18, "./images/dark/labelsToFields.svg": __vite_glob_0_19, "./images/dark/limit.svg": __vite_glob_0_20, "./images/dark/merge.svg": __vite_glob_0_21, "./images/dark/organize.svg": __vite_glob_0_22, "./images/dark/partitionByValues.svg": __vite_glob_0_23, "./images/dark/prepareTimeSeries.svg": __vite_glob_0_24, "./images/dark/reduce.svg": __vite_glob_0_25, "./images/dark/regression.svg": __vite_glob_0_26, "./images/dark/renameByRegex.svg": __vite_glob_0_27, "./images/dark/rowsToFields.svg": __vite_glob_0_28, "./images/dark/seriesToRows.svg": __vite_glob_0_29, "./images/dark/smoothing.svg": __vite_glob_0_30, "./images/dark/sortBy.svg": __vite_glob_0_31, "./images/dark/spatial.svg": __vite_glob_0_32, "./images/dark/timeSeriesTable.svg": __vite_glob_0_33, "./images/dark/transpose.svg": __vite_glob_0_34, "./images/light/calculateField.svg": __vite_glob_0_35, "./images/light/concatenate.svg": __vite_glob_0_36, "./images/light/configFromData.svg": __vite_glob_0_37, "./images/light/convertFieldType.svg": __vite_glob_0_38, "./images/light/extractFields.svg": __vite_glob_0_39, "./images/light/fieldLookup.svg": __vite_glob_0_40, "./images/light/filterByRefId.svg": __vite_glob_0_41, "./images/light/filterByValue.svg": __vite_glob_0_42, "./images/light/filterFieldsByName.svg": __vite_glob_0_43, "./images/light/formatString.svg": __vite_glob_0_44, "./images/light/formatTime.svg": __vite_glob_0_45, "./images/light/groupBy.svg": __vite_glob_0_46, "./images/light/groupByCalculation.svg": __vite_glob_0_47, "./images/light/groupToNestedTable.svg": __vite_glob_0_48, "./images/light/groupingToMatrix.svg": __vite_glob_0_49, "./images/light/heatmap.svg": __vite_glob_0_50, "./images/light/histogram.svg": __vite_glob_0_51, "./images/light/joinByField.svg": __vite_glob_0_52, "./images/light/joinByLabels.svg": __vite_glob_0_53, "./images/light/labelsToFields.svg": __vite_glob_0_54, "./images/light/limit.svg": __vite_glob_0_55, "./images/light/merge.svg": __vite_glob_0_56, "./images/light/organize.svg": __vite_glob_0_57, "./images/light/partitionByValues.svg": __vite_glob_0_58, "./images/light/prepareTimeSeries.svg": __vite_glob_0_59, "./images/light/reduce.svg": __vite_glob_0_60, "./images/light/regression.svg": __vite_glob_0_61, "./images/light/renameByRegex.svg": __vite_glob_0_62, "./images/light/rowsToFields.svg": __vite_glob_0_63, "./images/light/seriesToRows.svg": __vite_glob_0_64, "./images/light/smoothing.svg": __vite_glob_0_65, "./images/light/sortBy.svg": __vite_glob_0_66, "./images/light/spatial.svg": __vite_glob_0_67, "./images/light/timeSeriesTable.svg": __vite_glob_0_68, "./images/light/transpose.svg": __vite_glob_0_69 }))[`./images/${theme}/${base}.svg`], import.meta.url).href;
      } catch {
        return "";
      }
    }
    function onPick(t2) {
      emit("add", t2.id);
      emit("update:open", false);
      query.value = "";
    }
    watch(
      () => props.open,
      (v) => {
        if (v) {
          query.value = "";
          category.value = "all";
        }
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(GDrawer), {
        open: __props.open,
        title: "添加转换",
        width: "600px",
        "onUpdate:open": _cache[3] || (_cache[3] = ($event) => emit("update:open", $event))
      }, {
        default: withCtx(() => [
          createElementVNode("div", _hoisted_1$16, [
            createElementVNode("div", _hoisted_2$W, [
              createVNode(unref(GInput), {
                modelValue: query.value,
                "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => query.value = $event),
                placeholder: "搜索名称 / 描述 / 标签…",
                "test-id": "transform-picker-search"
              }, null, 8, ["modelValue"]),
              createElementVNode(
                "span",
                _hoisted_3$O,
                toDisplayString(filtered.value.length) + " / " + toDisplayString(all.value.length),
                1
                /* TEXT */
              )
            ]),
            createElementVNode("div", _hoisted_4$D, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(categories.value, (c) => {
                  return openBlock(), createElementBlock("button", {
                    key: c.id,
                    type: "button",
                    class: normalizeClass(["tpd-cat", { active: category.value === c.id }]),
                    "data-testid": `transform-cat-${c.id}`,
                    onClick: ($event) => category.value = c.id
                  }, toDisplayString(c.label), 11, _hoisted_5$x);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            createElementVNode("div", _hoisted_6$u, [
              createElementVNode("label", _hoisted_7$s, [
                createVNode(unref(GSwitch), {
                  checked: showImages.value,
                  "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => showImages.value = $event)
                }, null, 8, ["checked"]),
                _cache[4] || (_cache[4] = createTextVNode(
                  " 显示插图",
                  -1
                  /* CACHED */
                ))
              ])
            ]),
            createElementVNode("div", _hoisted_8$n, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(filtered.value, (t2) => {
                  return openBlock(), createElementBlock("button", {
                    key: t2.id,
                    type: "button",
                    class: "tpd-card",
                    "data-testid": `transform-pick-${t2.id}`,
                    onClick: ($event) => onPick(t2)
                  }, [
                    showImages.value ? (openBlock(), createElementBlock("img", {
                      key: 0,
                      class: "tpd-illu",
                      src: illustrationUrl(t2),
                      alt: t2.name,
                      loading: "lazy",
                      onError: _cache[2] || (_cache[2] = ($event) => $event.target.style.display = "none")
                    }, null, 40, _hoisted_10$h)) : createCommentVNode("v-if", true),
                    createElementVNode(
                      "div",
                      _hoisted_11$h,
                      toDisplayString(t2.name),
                      1
                      /* TEXT */
                    ),
                    createElementVNode(
                      "div",
                      _hoisted_12$g,
                      toDisplayString(t2.description),
                      1
                      /* TEXT */
                    ),
                    t2.tags?.length ? (openBlock(), createElementBlock("div", _hoisted_13$g, [
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(t2.tags.slice(0, 4), (tag) => {
                          return openBlock(), createElementBlock(
                            "span",
                            { key: tag },
                            toDisplayString(tag),
                            1
                            /* TEXT */
                          );
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ])) : createCommentVNode("v-if", true)
                  ], 8, _hoisted_9$m);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              !filtered.value.length ? (openBlock(), createElementBlock("div", _hoisted_14$e, "无匹配的转换")) : createCommentVNode("v-if", true)
            ])
          ])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["open"]);
    };
  }
});
const TransformationPickerDrawer = /* @__PURE__ */ _export_sfc$1(_sfc_main$1a, [["__scopeId", "data-v-66a2945e"]]);
const _hoisted_1$15 = {
  class: "section",
  "data-testid": "transform-section"
};
const _hoisted_2$V = {
  key: 0,
  class: "empty",
  "data-testid": "transform-empty"
};
const _hoisted_3$N = { class: "transform-toolbar" };
const _hoisted_4$C = ["data-testid", "data-transform-id", "onDragstart", "onDrop"];
const _hoisted_5$w = { class: "id" };
const _hoisted_6$t = { class: "card-actions" };
const _hoisted_7$r = ["data-testid"];
const _hoisted_8$m = ["data-testid"];
const _hoisted_9$l = ["data-testid"];
const _hoisted_10$g = {
  class: "debug-col",
  "data-testid": "transform-debug-input"
};
const _hoisted_11$g = {
  key: 0,
  class: "debug-empty"
};
const _hoisted_12$f = { class: "debug-frame-name" };
const _hoisted_13$f = { key: 0 };
const _hoisted_14$d = {
  class: "debug-col",
  "data-testid": "transform-debug-output"
};
const _hoisted_15$c = {
  key: 0,
  class: "debug-note"
};
const _hoisted_16$a = {
  key: 1,
  class: "debug-empty"
};
const _hoisted_17$a = { class: "debug-frame-name" };
const _hoisted_18$a = { key: 0 };
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
  __name: "TransformEditorTab",
  props: {
    transforms: {},
    transformerIds: {},
    refIds: {},
    frames: {}
  },
  emits: ["add", "update", "remove", "toggle", "move", "clear"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const drawerOpen = ref(false);
    const confirmClear = ref(false);
    const expandedFilter = ref({});
    const expandedDebug = ref({});
    const expandedHelp = ref({});
    const dragFrom = ref(null);
    function toggleFilter(i) {
      expandedFilter.value = {
        ...expandedFilter.value,
        [i]: !expandedFilter.value[i]
      };
    }
    function toggleDebug(i) {
      expandedDebug.value = {
        ...expandedDebug.value,
        [i]: !expandedDebug.value[i]
      };
    }
    function toggleHelp(i) {
      expandedHelp.value = { ...expandedHelp.value, [i]: !expandedHelp.value[i] };
    }
    const isEmpty = computed(() => !props.transforms.length);
    const refIdOptions = computed(() => {
      const ids = props.refIds?.length ? props.refIds : ["A", "B", "C"];
      return [{ value: "", label: "全部查询" }, ...ids.map((id) => ({ value: id, label: id }))];
    });
    function onAdd(id) {
      if (id) emit("add", id);
    }
    function editorFor(id) {
      return loadTransformEditor(id);
    }
    function fieldsFor(id) {
      return getTransformerMeta(id)?.fields ?? [];
    }
    function helpFor(id) {
      const m = getTransformerMeta(id);
      return m?.help || m?.description || "";
    }
    function setOptionPath2(i, t2, path, value) {
      const next = { ...t2.options || {} };
      const parts = path.split(".");
      if (parts.length === 1) {
        next[path] = value;
      } else {
        let cur = next;
        for (let k = 0; k < parts.length - 1; k++) {
          const key = parts[k];
          if (/^\d+$/.test(parts[k + 1] ?? "")) {
            if (!Array.isArray(cur[key])) cur[key] = Array.isArray(cur[key]) ? [...cur[key]] : [];
          } else {
            cur[key] = cur[key] && typeof cur[key] === "object" ? { ...cur[key] } : {};
          }
          cur = cur[key];
        }
        const last = parts[parts.length - 1];
        if (/^\d+$/.test(last) && Array.isArray(cur)) {
          cur[Number(last)] = value;
        } else {
          cur[last] = value;
        }
      }
      emit("update", i, { options: next });
    }
    function setFilterRefId(i, _t, refId) {
      const v = String(refId ?? "");
      if (!v) {
        emit("update", i, { filter: void 0 });
        return;
      }
      emit("update", i, { filter: { id: "byRefId", options: { value: v } } });
    }
    function setTopic(i, topic) {
      const v = String(topic ?? "");
      emit("update", i, {
        topic: v === "annotations" ? "annotations" : v === "series" ? "series" : void 0
      });
    }
    function currentFilterRef(t2) {
      const f = t2.filter;
      if (!f || f.id !== "byRefId") return "";
      const opts = f.options || {};
      return String(opts.value ?? opts.refId ?? "");
    }
    function maxRows(frame) {
      let m = 0;
      for (const f of frame.fields || [])
        m = Math.max(m, Array.isArray(f.values) ? f.values.length : 0);
      return m;
    }
    function cell(f, ri) {
      const v = Array.isArray(f.values) ? f.values[ri] : void 0;
      if (v == null) return "";
      return String(v);
    }
    function asDataFrames(raw) {
      if (!raw?.length) return [];
      return raw.map((f, idx) => {
        if (f?.fields && typeof f.length === "number") {
          return createDataFrame({
            name: f.name,
            refId: f.refId,
            fields: (f.fields || []).map((field) => ({
              name: field.name || "field",
              type: field.type || "other",
              values: Array.isArray(field.values) ? [...field.values] : [],
              config: field.config ? { ...field.config } : {}
            }))
          });
        }
        return createDataFrame({
          name: f?.name || `Frame ${idx}`,
          fields: (f?.fields || []).map((field) => ({
            name: field.name || "field",
            type: field.type || "other",
            values: Array.isArray(field.values) ? [...field.values] : []
          }))
        });
      });
    }
    function toDebugFrames(frames) {
      return frames.map((f, i) => ({
        name: f.name || `Frame ${i}`,
        fields: (f.fields || []).map((field) => ({
          name: field.name,
          type: String(field.type ?? "other"),
          values: Array.isArray(field.values) ? field.values : []
        }))
      }));
    }
    function allStepConfigs() {
      return props.transforms.map((t2) => ({
        id: t2.id,
        options: t2.options || {},
        disabled: !!t2.disabled,
        filter: t2.filter
      }));
    }
    const anyDebugExpanded = computed(() => Object.values(expandedDebug.value).some(Boolean));
    const framesRevision = computed(() => {
      const frames = props.frames ?? [];
      let rev = frames.length;
      for (const f of frames) {
        const fields = f.fields ?? [];
        rev = rev * 33 + fields.length | 0;
        for (const field of fields) {
          rev = rev * 33 + (field.values?.length ?? 0) | 0;
          rev = rev * 33 + String(field.name || "").length | 0;
        }
      }
      return rev;
    });
    const transformsRevision = computed(() => {
      return props.transforms.map(
        (t2) => `${t2.id}:${t2.disabled ? 1 : 0}:${JSON.stringify(t2.options ?? null)}:${JSON.stringify(t2.filter ?? null)}`
      ).join("|");
    });
    let debugMemoKey = "";
    let debugMemoValue = { steps: [], framesByStep: [] };
    const debugPipeline = computed(() => {
      if (!anyDebugExpanded.value) {
        return { steps: [], framesByStep: [] };
      }
      const key = `${framesRevision.value}::${transformsRevision.value}`;
      if (key === debugMemoKey) return debugMemoValue;
      const base = asDataFrames(props.frames);
      if (!base.length) {
        debugMemoKey = key;
        debugMemoValue = { steps: [], framesByStep: [] };
        return debugMemoValue;
      }
      try {
        const result = applyTransformationsWithTrace(base, allStepConfigs(), {
          includeFrameSnapshots: true
        });
        const snaps = result.frameSnapshots ?? [];
        const framesByStep = snaps.length ? snaps.map((fs) => toDebugFrames(fs)) : [toDebugFrames(result.frames)];
        debugMemoKey = key;
        debugMemoValue = { steps: result.steps, framesByStep };
        return debugMemoValue;
      } catch {
        debugMemoKey = key;
        debugMemoValue = { steps: [], framesByStep: [toDebugFrames(base)] };
        return debugMemoValue;
      }
    });
    const debugFramesByStep = computed(() => {
      const pipe = debugPipeline.value.framesByStep;
      return props.transforms.map((_, i) => ({
        input: pipe.length ? pipe[Math.max(0, Math.min(i, pipe.length - 1))] || [] : [],
        output: pipe.length ? pipe[Math.max(0, Math.min(i + 1, pipe.length - 1))] || [] : []
      }));
    });
    function debugInputFrames(stepIndex) {
      return debugFramesByStep.value[stepIndex]?.input ?? [];
    }
    function debugOutputFrames(stepIndex) {
      return debugFramesByStep.value[stepIndex]?.output ?? [];
    }
    function onDragStart(i, e) {
      dragFrom.value = i;
      e.dataTransfer?.setData("text/plain", String(i));
      if (e.dataTransfer) e.dataTransfer.effectAllowed = "move";
    }
    function onDrop(i, e) {
      e.preventDefault();
      const from = dragFrom.value;
      dragFrom.value = null;
      if (from == null || from === i) return;
      const dir = from < i ? 1 : -1;
      let cur = from;
      while (cur !== i) {
        emit("move", cur, dir);
        cur += dir;
      }
    }
    function onDragOver(e) {
      e.preventDefault();
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("section", _hoisted_1$15, [
        isEmpty.value ? (openBlock(), createElementBlock("div", _hoisted_2$V, [
          _cache[7] || (_cache[7] = createElementVNode(
            "h3",
            { class: "empty-title" },
            "开始转换数据",
            -1
            /* CACHED */
          )),
          _cache[8] || (_cache[8] = createElementVNode(
            "p",
            { class: "empty-body" },
            " 转换可在可视化显示前以多种方式修改数据，包括合并、重命名字段、计算、格式化显示等。 ",
            -1
            /* CACHED */
          )),
          createVNode(unref(GButton), {
            variant: "primary",
            size: "md",
            "test-id": "transform-add-empty",
            onClick: _cache[0] || (_cache[0] = ($event) => drawerOpen.value = true)
          }, {
            default: withCtx(() => [
              createVNode(unref(GIcon), {
                name: "plus",
                size: 14
              }),
              _cache[6] || (_cache[6] = createTextVNode(
                " 添加转换 ",
                -1
                /* CACHED */
              ))
            ]),
            _: 1
            /* STABLE */
          })
        ])) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode("div", _hoisted_3$N, [
              createVNode(unref(GButton), {
                size: "md",
                variant: "primary",
                "test-id": "transform-add",
                onClick: _cache[1] || (_cache[1] = ($event) => drawerOpen.value = true)
              }, {
                default: withCtx(() => [..._cache[9] || (_cache[9] = [
                  createTextVNode(
                    " 添加转换 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }),
              createVNode(unref(GButton), {
                size: "md",
                variant: "destructive",
                "test-id": "transform-clear-all",
                onClick: _cache[2] || (_cache[2] = ($event) => confirmClear.value = true)
              }, {
                default: withCtx(() => [..._cache[10] || (_cache[10] = [
                  createTextVNode(
                    " 删除全部 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ]),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.transforms, (t2, i) => {
                return openBlock(), createElementBlock("div", {
                  key: i,
                  class: normalizeClass(["transform-card field-config-block", { disabled: t2.disabled }]),
                  "data-testid": `transform-${i}`,
                  "data-transform-id": t2.id,
                  draggable: "true",
                  onDragstart: ($event) => onDragStart(i, $event),
                  onDragover: onDragOver,
                  onDrop: ($event) => onDrop(i, $event)
                }, [
                  createElementVNode("header", null, [
                    _cache[17] || (_cache[17] = createElementVNode(
                      "span",
                      {
                        class: "drag",
                        title: "拖拽排序"
                      },
                      "⠿",
                      -1
                      /* CACHED */
                    )),
                    createElementVNode("strong", null, [
                      createTextVNode(
                        toDisplayString(i + 1) + ". " + toDisplayString(unref(transformLabel)(t2.id)) + " ",
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "span",
                        _hoisted_5$w,
                        "(" + toDisplayString(t2.id) + ")",
                        1
                        /* TEXT */
                      )
                    ]),
                    createElementVNode("div", _hoisted_6$t, [
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "toolbar",
                        "test-id": `transform-filter-${i}`,
                        title: "过滤",
                        onClick: ($event) => toggleFilter(i)
                      }, {
                        default: withCtx(() => [..._cache[11] || (_cache[11] = [
                          createTextVNode(
                            " 漏斗 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["test-id", "onClick"]),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "toolbar",
                        "test-id": `transform-debug-${i}`,
                        title: "调试",
                        onClick: ($event) => toggleDebug(i)
                      }, {
                        default: withCtx(() => [..._cache[12] || (_cache[12] = [
                          createTextVNode(
                            " 调试 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["test-id", "onClick"]),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "toolbar",
                        "test-id": `transform-help-${i}`,
                        title: "帮助",
                        onClick: ($event) => toggleHelp(i)
                      }, {
                        default: withCtx(() => [..._cache[13] || (_cache[13] = [
                          createTextVNode(
                            " ? ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["test-id", "onClick"]),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "toolbar",
                        "test-id": "transform-move-up",
                        disabled: i === 0,
                        onClick: ($event) => emit("move", i, -1)
                      }, {
                        default: withCtx(() => [..._cache[14] || (_cache[14] = [
                          createTextVNode(
                            " 上移 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["disabled", "onClick"]),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "toolbar",
                        "test-id": "transform-move-down",
                        disabled: i === __props.transforms.length - 1,
                        onClick: ($event) => emit("move", i, 1)
                      }, {
                        default: withCtx(() => [..._cache[15] || (_cache[15] = [
                          createTextVNode(
                            " 下移 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["disabled", "onClick"]),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "toolbar",
                        "test-id": `transform-toggle-${i}`,
                        onClick: ($event) => emit("toggle", i)
                      }, {
                        default: withCtx(() => [
                          createTextVNode(
                            toDisplayString(t2.disabled ? "启用" : "禁用"),
                            1
                            /* TEXT */
                          )
                        ]),
                        _: 2
                        /* DYNAMIC */
                      }, 1032, ["test-id", "onClick"]),
                      createVNode(unref(GButton), {
                        size: "md",
                        variant: "destructive",
                        onClick: ($event) => emit("remove", i)
                      }, {
                        default: withCtx(() => [..._cache[16] || (_cache[16] = [
                          createTextVNode(
                            " 删除 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["onClick"])
                    ])
                  ]),
                  expandedFilter.value[i] ? (openBlock(), createElementBlock("div", {
                    key: 0,
                    class: "filter-row",
                    "data-testid": `transform-filter-row-${i}`
                  }, [
                    createElementVNode("label", null, [
                      _cache[18] || (_cache[18] = createTextVNode(
                        " 应用于查询 ",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GSelect), {
                        value: currentFilterRef(t2),
                        options: refIdOptions.value,
                        onChange: (v) => setFilterRefId(i, t2, v)
                      }, null, 8, ["value", "options", "onChange"])
                    ]),
                    createElementVNode("label", null, [
                      _cache[19] || (_cache[19] = createTextVNode(
                        " 主题 ",
                        -1
                        /* CACHED */
                      )),
                      createVNode(unref(GSelect), {
                        value: t2.topic || "series",
                        options: [
                          { value: "series", label: "series" },
                          { value: "annotations", label: "annotations" }
                        ],
                        onChange: (v) => setTopic(i, v)
                      }, null, 8, ["value", "onChange"])
                    ])
                  ], 8, _hoisted_7$r)) : createCommentVNode("v-if", true),
                  expandedHelp.value[i] ? (openBlock(), createElementBlock("div", {
                    key: 1,
                    class: "help",
                    "data-testid": `transform-help-body-${i}`
                  }, toDisplayString(helpFor(t2.id)), 9, _hoisted_8$m)) : createCommentVNode("v-if", true),
                  expandedDebug.value[i] ? (openBlock(), createElementBlock("div", {
                    key: 2,
                    class: "debug",
                    "data-testid": `transform-debug-body-${i}`
                  }, [
                    createElementVNode("div", _hoisted_10$g, [
                      _cache[20] || (_cache[20] = createElementVNode(
                        "h4",
                        null,
                        "输入帧",
                        -1
                        /* CACHED */
                      )),
                      !debugInputFrames(i).length ? (openBlock(), createElementBlock("div", _hoisted_11$g, "无预览数据")) : createCommentVNode("v-if", true),
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(debugInputFrames(i), (frame, fi) => {
                          return openBlock(), createElementBlock("div", {
                            key: `in-${fi}`,
                            class: "debug-frame",
                            "data-testid": "transform-debug-input-frame"
                          }, [
                            createElementVNode(
                              "div",
                              _hoisted_12$f,
                              toDisplayString(frame.name || `Frame ${fi}`) + " (" + toDisplayString((frame.fields || []).length) + " fields) ",
                              1
                              /* TEXT */
                            ),
                            frame.fields?.length ? (openBlock(), createElementBlock("table", _hoisted_13$f, [
                              createElementVNode("thead", null, [
                                createElementVNode("tr", null, [
                                  (openBlock(true), createElementBlock(
                                    Fragment,
                                    null,
                                    renderList(frame.fields, (f) => {
                                      return openBlock(), createElementBlock("th", {
                                        key: f.name
                                      }, [
                                        createTextVNode(
                                          toDisplayString(f.name) + " ",
                                          1
                                          /* TEXT */
                                        ),
                                        createElementVNode(
                                          "small",
                                          null,
                                          toDisplayString(f.type),
                                          1
                                          /* TEXT */
                                        )
                                      ]);
                                    }),
                                    128
                                    /* KEYED_FRAGMENT */
                                  ))
                                ])
                              ]),
                              createElementVNode("tbody", null, [
                                (openBlock(true), createElementBlock(
                                  Fragment,
                                  null,
                                  renderList(Math.min(5, maxRows(frame)), (ri) => {
                                    return openBlock(), createElementBlock("tr", { key: ri }, [
                                      (openBlock(true), createElementBlock(
                                        Fragment,
                                        null,
                                        renderList(frame.fields, (f) => {
                                          return openBlock(), createElementBlock(
                                            "td",
                                            {
                                              key: `${f.name || ""}-${ri}`
                                            },
                                            toDisplayString(cell(f, ri)),
                                            1
                                            /* TEXT */
                                          );
                                        }),
                                        128
                                        /* KEYED_FRAGMENT */
                                      ))
                                    ]);
                                  }),
                                  128
                                  /* KEYED_FRAGMENT */
                                ))
                              ])
                            ])) : createCommentVNode("v-if", true)
                          ]);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ]),
                    createElementVNode("div", _hoisted_14$d, [
                      _cache[21] || (_cache[21] = createElementVNode(
                        "h4",
                        null,
                        "输出帧",
                        -1
                        /* CACHED */
                      )),
                      t2.disabled ? (openBlock(), createElementBlock("p", _hoisted_15$c, "已禁用 — 透传输入")) : createCommentVNode("v-if", true),
                      !debugOutputFrames(i).length ? (openBlock(), createElementBlock("div", _hoisted_16$a, "无输出帧")) : createCommentVNode("v-if", true),
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(debugOutputFrames(i), (frame, fi) => {
                          return openBlock(), createElementBlock("div", {
                            key: `out-${fi}`,
                            class: "debug-frame",
                            "data-testid": "transform-debug-output-frame"
                          }, [
                            createElementVNode(
                              "div",
                              _hoisted_17$a,
                              toDisplayString(frame.name || `Frame ${fi}`) + " (" + toDisplayString((frame.fields || []).length) + " fields) ",
                              1
                              /* TEXT */
                            ),
                            frame.fields?.length ? (openBlock(), createElementBlock("table", _hoisted_18$a, [
                              createElementVNode("thead", null, [
                                createElementVNode("tr", null, [
                                  (openBlock(true), createElementBlock(
                                    Fragment,
                                    null,
                                    renderList(frame.fields, (f) => {
                                      return openBlock(), createElementBlock("th", {
                                        key: f.name
                                      }, [
                                        createTextVNode(
                                          toDisplayString(f.name) + " ",
                                          1
                                          /* TEXT */
                                        ),
                                        createElementVNode(
                                          "small",
                                          null,
                                          toDisplayString(f.type),
                                          1
                                          /* TEXT */
                                        )
                                      ]);
                                    }),
                                    128
                                    /* KEYED_FRAGMENT */
                                  ))
                                ])
                              ]),
                              createElementVNode("tbody", null, [
                                (openBlock(true), createElementBlock(
                                  Fragment,
                                  null,
                                  renderList(Math.min(5, maxRows(frame)), (ri) => {
                                    return openBlock(), createElementBlock("tr", { key: ri }, [
                                      (openBlock(true), createElementBlock(
                                        Fragment,
                                        null,
                                        renderList(frame.fields, (f) => {
                                          return openBlock(), createElementBlock(
                                            "td",
                                            {
                                              key: `${f.name || ""}-${ri}`
                                            },
                                            toDisplayString(cell(f, ri)),
                                            1
                                            /* TEXT */
                                          );
                                        }),
                                        128
                                        /* KEYED_FRAGMENT */
                                      ))
                                    ]);
                                  }),
                                  128
                                  /* KEYED_FRAGMENT */
                                ))
                              ])
                            ])) : createCommentVNode("v-if", true)
                          ]);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ])
                  ], 8, _hoisted_9$l)) : createCommentVNode("v-if", true),
                  withDirectives((openBlock(), createBlock(resolveDynamicComponent(editorFor(t2.id)), {
                    options: t2.options || {},
                    fields: fieldsFor(t2.id),
                    "transform-id": t2.id,
                    onChange: (path, value) => setOptionPath2(i, t2, path, value)
                  }, null, 40, ["options", "fields", "transform-id", "onChange"])), [
                    [vShow, !t2.disabled]
                  ])
                ], 42, _hoisted_4$C);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ],
          64
          /* STABLE_FRAGMENT */
        )),
        createVNode(TransformationPickerDrawer, {
          open: drawerOpen.value,
          "onUpdate:open": _cache[3] || (_cache[3] = ($event) => drawerOpen.value = $event),
          onAdd
        }, null, 8, ["open"]),
        createVNode(unref(GConfirmModal), {
          open: confirmClear.value,
          "onUpdate:open": _cache[4] || (_cache[4] = ($event) => confirmClear.value = $event),
          title: "删除全部转换",
          body: "确定删除此面板上的全部转换？此操作不可撤销。",
          "confirm-text": "删除全部",
          danger: "",
          onConfirm: _cache[5] || (_cache[5] = ($event) => emit("clear"))
        }, null, 8, ["open"])
      ]);
    };
  }
});
const TransformEditorTab = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["__scopeId", "data-v-cd3e1b21"]]);
const _hoisted_1$14 = { class: "panel-editor__header" };
const _hoisted_2$U = { class: "title-row" };
const _hoisted_3$M = ["title"];
const _hoisted_4$B = {
  key: 0,
  class: "draft-dirty",
  "data-testid": "panel-editor-dirty",
  title: "未应用的更改"
};
const _hoisted_5$v = { class: "header-tools" };
const _hoisted_6$s = {
  class: "mode-group",
  "data-testid": "display-mode",
  role: "group",
  "aria-label": "显示模式"
};
const _hoisted_7$q = ["aria-pressed"];
const _hoisted_8$l = ["aria-pressed"];
const _hoisted_9$k = ["aria-pressed"];
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
  __name: "PanelEditorHeader",
  props: {
    title: {},
    dirty: { type: Boolean },
    mode: {},
    tableViewEnabled: { type: Boolean },
    optionsVisible: { type: Boolean }
  },
  emits: ["back", "set-mode", "toggle-table", "toggle-options"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("header", _hoisted_1$14, [
        createElementVNode("div", _hoisted_2$U, [
          renderSlot(_ctx.$slots, "back", {}, () => [
            createElementVNode("button", {
              type: "button",
              "data-testid": "panel-editor-back",
              class: "back-btn",
              onClick: _cache[0] || (_cache[0] = ($event) => emit("back"))
            }, " ← 返回仪表盘 ")
          ], true),
          createElementVNode("span", {
            class: "title-display",
            "data-testid": "panel-title-display",
            title: __props.title || "面板标题"
          }, toDisplayString(__props.title || "未命名面板"), 9, _hoisted_3$M),
          __props.dirty ? (openBlock(), createElementBlock("span", _hoisted_4$B, "●")) : createCommentVNode("v-if", true),
          createElementVNode("div", _hoisted_5$v, [
            createElementVNode("div", _hoisted_6$s, [
              createElementVNode("button", {
                type: "button",
                class: normalizeClass({ active: __props.mode === 0 }),
                "data-testid": "display-fill",
                title: "Fill",
                "aria-pressed": __props.mode === 0,
                onClick: _cache[1] || (_cache[1] = ($event) => emit("set-mode", 0))
              }, " 填充 ", 10, _hoisted_7$q),
              createElementVNode("button", {
                type: "button",
                class: normalizeClass({ active: __props.mode === 1 }),
                "data-testid": "display-fit",
                title: "Fit",
                "aria-pressed": __props.mode === 1,
                onClick: _cache[2] || (_cache[2] = ($event) => emit("set-mode", 1))
              }, " 适应 ", 10, _hoisted_8$l),
              createElementVNode("button", {
                type: "button",
                class: normalizeClass({ active: __props.mode === 2 }),
                "data-testid": "display-exact",
                title: "Exact",
                "aria-pressed": __props.mode === 2,
                onClick: _cache[3] || (_cache[3] = ($event) => emit("set-mode", 2))
              }, " 原始 ", 10, _hoisted_9$k)
            ]),
            renderSlot(_ctx.$slots, "tools", {
              tableViewEnabled: __props.tableViewEnabled,
              optionsVisible: __props.optionsVisible
            }, void 0, true)
          ])
        ])
      ]);
    };
  }
});
const PanelEditorHeader = /* @__PURE__ */ _export_sfc$1(_sfc_main$18, [["__scopeId", "data-v-722cc152"]]);
const POPULAR_BY_NAME = {
  "unit": 2,
  "单位": 2,
  "min": 3,
  "最小值": 3,
  "max": 4,
  "最大值": 4,
  "display name": 5,
  "显示名称": 5,
  "displayname": 5,
  "show legend": 6,
  "显示图例": 6,
  "thresholds": 7,
  "阈值": 7,
  "color": 8,
  "颜色": 8
};
function popularRank(d) {
  const name = String(d.name || "").toLowerCase().trim();
  const path = String(d.path || "").toLowerCase();
  if (POPULAR_BY_NAME[name] != null) return POPULAR_BY_NAME[name];
  if (path === "unit" || path.endsWith(".unit")) return 2;
  if (path === "min" || path.endsWith(".min")) return 3;
  if (path === "max" || path.endsWith(".max")) return 4;
  if (path === "displayname" || path.endsWith("displayname") || path === "displayName") return 5;
  if (path.includes("legend.showlegend") || path.endsWith("showlegend")) return 6;
  if (path === "thresholds" || path.endsWith("thresholds")) return 7;
  if (path === "color" || path.endsWith(".color") || path === "color.mode") return 8;
  return void 0;
}
function getRecentOptions(descriptors) {
  const ranked = descriptors.map((d) => ({ d, rank: popularRank(d) })).filter((x) => x.rank != null).sort((a, b) => a.rank - b.rank);
  const seen = /* @__PURE__ */ new Set();
  const out = [];
  for (const { d } of ranked) {
    if (seen.has(d.path)) continue;
    seen.add(d.path);
    out.push(d);
  }
  return out;
}
function categoryTitle(d) {
  return (d.category ?? [])[0] ?? "";
}
function compareHit(left, right) {
  return left.rank - right.rank;
}
class OptionSearchEngine {
  constructor(descriptors) {
    this.descriptors = descriptors;
  }
  descriptors;
  search(query) {
    const q = query.trim();
    if (!q) {
      return {
        optionHits: [...this.descriptors],
        totalCount: this.descriptors.length
      };
    }
    let searchRegex;
    try {
      searchRegex = new RegExp(q, "i");
    } catch {
      searchRegex = new RegExp(q.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i");
    }
    const hits = [];
    for (const item of this.descriptors) {
      const title = item.name ?? "";
      const description = String(item.description ?? "");
      const cat = categoryTitle(item);
      const path = item.path ?? "";
      const id = String(item.id ?? "");
      if (searchRegex.test(title)) {
        hits.push({ item, rank: 1 });
        continue;
      }
      if (description && searchRegex.test(description)) {
        hits.push({ item, rank: 2 });
        continue;
      }
      if (cat && searchRegex.test(cat)) {
        hits.push({ item, rank: 3 });
        continue;
      }
      if (searchRegex.test(path) || searchRegex.test(id)) {
        hits.push({ item, rank: 3 });
      }
    }
    const sorted = hits.sort(compareHit).map((h2) => h2.item);
    return { optionHits: sorted, totalCount: this.descriptors.length };
  }
  getAllOptionsCount() {
    return this.descriptors.length;
  }
}
const _hoisted_1$13 = {
  class: "options-pane",
  "data-testid": "options-pane"
};
const _hoisted_2$T = { class: "search-row" };
const _hoisted_3$L = {
  key: 0,
  class: "search-count",
  "data-testid": "options-search-count"
};
const _hoisted_4$A = {
  key: 0,
  class: "list-mode",
  "data-testid": "options-list-mode",
  role: "radiogroup",
  "aria-label": "选项列表模式"
};
const _hoisted_5$u = {
  key: 1,
  class: "recent-banner",
  "data-testid": "options-recent-banner"
};
const _hoisted_6$r = ["data-category"];
const _hoisted_7$p = ["aria-expanded", "onClick"];
const _hoisted_8$k = {
  class: "cat-caret",
  "aria-hidden": "true"
};
const _hoisted_9$j = { class: "count" };
const _hoisted_10$f = {
  key: 0,
  class: "cat-body"
};
const _hoisted_11$f = ["data-testid", "data-editor", "data-path", "data-unknown-editor", "data-disabled"];
const _hoisted_12$e = { class: "label" };
const _hoisted_13$e = {
  key: 0,
  class: "desc"
};
const _hoisted_14$c = {
  key: 4,
  class: "slider-row",
  "data-testid": "opt-slider"
};
const _hoisted_15$b = { class: "slider-val" };
const _hoisted_16$9 = ["value", "onInput"];
const _hoisted_17$9 = {
  key: 19,
  class: "unknown-editor",
  "data-testid": "unknown-editor"
};
const _hoisted_18$9 = { class: "unknown-label" };
const _hoisted_19$9 = {
  key: 2,
  class: "empty",
  "data-testid": "options-empty"
};
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
  __name: "OptionsPane",
  props: {
    options: {},
    descriptors: {},
    mode: {},
    fieldMode: { type: Boolean },
    fieldNames: {},
    fieldNameOptions: {},
    dataFrames: {},
    templateVars: {},
    templateVarProperties: {}
  },
  emits: ["change", "replace"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const search = ref("");
    const listMode = ref("all");
    const collapsed = ref({});
    let searchEngineList = null;
    let searchEngine = null;
    const baseDescriptors = computed(() => {
      let list = props.descriptors ?? [];
      if (props.mode === "overrides" || listMode.value === "overrides") {
        list = list.filter(
          (d) => d.allowOverride || d.override
        );
      }
      if (listMode.value === "recent" && !search.value.trim()) {
        list = getRecentOptions(list);
      }
      return list;
    });
    const filtered = computed(() => {
      const list = baseDescriptors.value.filter((d) => {
        if (props.mode === "overrides" && !d.allowOverride && !d.override) {
          return false;
        }
        const od = d;
        if (od.hideFromDefaults && props.mode !== "overrides" && listMode.value !== "overrides")
          return false;
        if (od.hideFromOverrides && (props.mode === "overrides" || listMode.value === "overrides"))
          return false;
        const showIf = od.showIf;
        if (showIf && showIf(props.options, props.dataFrames, void 0) === false) return false;
        od.disableIf;
        return true;
      });
      const q = search.value.trim();
      if (!q) return list;
      if (searchEngineList !== list || !searchEngine) {
        searchEngineList = list;
        searchEngine = new OptionSearchEngine(list);
      }
      return searchEngine.search(q).optionHits;
    });
    const searchMatchCount = computed(() => filtered.value.length);
    const searchActive = computed(() => search.value.trim().length > 0);
    const showListMode = computed(() => !searchActive.value && !(props.mode === "overrides"));
    const byCategory = computed(() => {
      const map = /* @__PURE__ */ new Map();
      for (const d of filtered.value) {
        const cat = d.category?.[0] ?? (props.fieldMode ? "标准选项" : "选项");
        if (!map.has(cat)) map.set(cat, []);
        map.get(cat).push(d);
      }
      return [...map.entries()];
    });
    function val(d) {
      return getOptionPath(props.options, d.path);
    }
    function set(d, value) {
      const prev = getOptionPath(props.options, d.path);
      const next = coerceFieldConfigEditorValue(d.path, value, prev);
      emit("change", d.path, next);
    }
    function isKnownEditor(editor) {
      return isKnownEditorKey(String(editor ?? ""));
    }
    function isDisabled2(d) {
      const od = d;
      const disableIf = od.disableIf;
      return disableIf?.(props.options, props.dataFrames) === true;
    }
    function onNative(d, ev) {
      const el = ev.target;
      let value = el.value;
      if (d.editor === "number" || d.editor === "slider")
        value = el.value === "" ? void 0 : Number(el.value);
      set(d, value);
    }
    function toggle(cat) {
      collapsed.value = { ...collapsed.value, [cat]: !collapsed.value[cat] };
    }
    function opts(d) {
      return d.settings?.options ?? [];
    }
    function selectOptions(d) {
      return opts(d).map((o) => ({
        label: String(o.label),
        value: o.value
      }));
    }
    function onSelectValue(d, value) {
      if (d.editor === "multi-select") {
        const arr = Array.isArray(value) ? value : value != null && value !== "" ? [value] : [];
        set(d, arr);
        return;
      }
      set(d, value);
    }
    function fieldNamePickerOptions() {
      if (props.fieldNameOptions?.length) return props.fieldNameOptions;
      return (props.fieldNames ?? []).map((n) => ({ label: n, value: n }));
    }
    function fieldNameFilterFn(d) {
      const filter2 = d.settings?.filter;
      if (typeof filter2 !== "function") return void 0;
      return (opt) => {
        try {
          return !!filter2({
            name: opt.rawName || opt.value,
            type: opt.type,
            config: {}
          });
        } catch {
          return true;
        }
      };
    }
    function selectValue(d) {
      const v = val(d);
      if (d.editor === "multi-select" && v && typeof v === "object" && !Array.isArray(v)) {
        if (d.path === "custom.hideFrom" || d.path.endsWith(".hideFrom")) {
          return Object.entries(v).filter(([, on]) => !!on).map(([k]) => k);
        }
      }
      if (d.editor === "select") {
        return radioDisplayValue(d.path, v);
      }
      return v;
    }
    function radioValue(d) {
      const v = val(d);
      if (v === void 0 || v === null) return void 0;
      return radioDisplayValue(d.path, v);
    }
    function sliderMin(d) {
      return Number(d.settings?.min ?? 0);
    }
    function sliderMax(d) {
      return Number(d.settings?.max ?? 100);
    }
    function sliderStep(d) {
      return Number(d.settings?.step ?? 1);
    }
    function sliderValue(d) {
      return Number(val(d) ?? d.defaultValue ?? sliderMin(d));
    }
    const CATEGORY_ZH = {
      "Options": "选项",
      "Standard options": "标准选项",
      "Value mappings": "值映射",
      "Data links": "数据链接",
      "Data links and actions": "数据链接与动作",
      "Graph styles": "图形样式",
      "图形样式": "图形样式",
      "Thresholds": "阈值",
      "Legend": "图例",
      "Tooltip": "提示",
      "Graph": "图形",
      "Axis": "坐标轴",
      "Axes": "坐标轴",
      "Display": "显示",
      "Gauge": "仪表",
      "Stat": "统计",
      "Table": "表格",
      "Text": "文本",
      "Logs": "日志",
      "Heatmap": "热图",
      "Canvas": "画布",
      "Geomap": "地理地图",
      "Histogram": "直方图",
      "BarChart": "柱状图",
      "Bar chart": "柱状图",
      "PieChart": "饼图",
      "Pie chart": "饼图",
      "Timeseries": "时序",
      "Time series": "时序",
      "Candlestick": "K线",
      "NodeGraph": "节点图",
      "Node graph": "节点图",
      "Traces": "链路",
      "Debug": "调试",
      "News": "新闻",
      "Links": "链接",
      "Markers": "标记",
      "Style": "样式",
      "Layout": "布局",
      "Behavior": "行为",
      "Field config": "字段配置",
      "Overrides": "覆盖",
      "Panel": "面板",
      "Visualization": "可视化",
      "Reduce options": "归约选项",
      "Stacking and nulls": "堆叠与空值",
      "Connect null values": "连接空值",
      "数值选项": "数值选项",
      "Series": "序列"
    };
    function categoryLabel(cat) {
      return CATEGORY_ZH[cat] || cat;
    }
    __expose({
      filtered,
      byCategory,
      listMode,
      getRecentOptions,
      isKnownEditor
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$13, [
        createElementVNode("div", _hoisted_2$T, [
          createVNode(unref(GInput), {
            value: search.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => search.value = $event),
            "test-id": "options-search",
            class: "search",
            placeholder: "搜索选项…"
          }, null, 8, ["value"]),
          searchActive.value ? (openBlock(), createElementBlock(
            "span",
            _hoisted_3$L,
            toDisplayString(searchMatchCount.value) + " 项",
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true)
        ]),
        showListMode.value ? (openBlock(), createElementBlock("div", _hoisted_4$A, [
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: listMode.value === "all" }),
              "data-testid": "options-mode-all",
              onClick: _cache[1] || (_cache[1] = ($event) => listMode.value = "all")
            },
            " 全部 ",
            2
            /* CLASS */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: listMode.value === "overrides" }),
              "data-testid": "options-mode-overrides",
              onClick: _cache[2] || (_cache[2] = ($event) => listMode.value = "overrides")
            },
            " 覆盖 ",
            2
            /* CLASS */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              class: normalizeClass({ active: listMode.value === "recent" }),
              "data-testid": "options-mode-recent",
              onClick: _cache[3] || (_cache[3] = ($event) => listMode.value = "recent")
            },
            " 最近 ",
            2
            /* CLASS */
          )
        ])) : createCommentVNode("v-if", true),
        listMode.value === "recent" && !searchActive.value ? (openBlock(), createElementBlock("div", _hoisted_5$u, " 最近常用选项（Unit / Min / Max / Display name…） ")) : createCommentVNode("v-if", true),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(byCategory.value, ([cat, items]) => {
            return openBlock(), createElementBlock("section", {
              key: cat,
              class: normalizeClass(["cat", { "is-open": !collapsed.value[cat] }]),
              "data-category": cat
            }, [
              createElementVNode("button", {
                type: "button",
                class: "cat-head",
                "aria-expanded": !collapsed.value[cat],
                onClick: ($event) => toggle(cat)
              }, [
                createElementVNode(
                  "span",
                  _hoisted_8$k,
                  toDisplayString(collapsed.value[cat] ? "▸" : "▾"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "h4",
                  null,
                  toDisplayString(categoryLabel(cat)),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "span",
                  _hoisted_9$j,
                  toDisplayString(items.length),
                  1
                  /* TEXT */
                )
              ], 8, _hoisted_7$p),
              !collapsed.value[cat] ? (openBlock(), createElementBlock("div", _hoisted_10$f, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(items, (d) => {
                    return openBlock(), createElementBlock("div", {
                      key: d.id,
                      class: "field",
                      "data-testid": `option-${d.id}`,
                      "data-editor": d.editor,
                      "data-path": d.path,
                      "data-unknown-editor": isKnownEditor(d.editor) ? void 0 : "true",
                      "data-disabled": isDisabled2(d) ? "true" : void 0
                    }, [
                      createElementVNode("span", _hoisted_12$e, [
                        createTextVNode(
                          toDisplayString(d.name) + " ",
                          1
                          /* TEXT */
                        ),
                        d.description ? (openBlock(), createElementBlock(
                          "small",
                          _hoisted_13$e,
                          toDisplayString(d.description),
                          1
                          /* TEXT */
                        )) : createCommentVNode("v-if", true)
                      ]),
                      d.editor === "boolean" ? (openBlock(), createBlock(unref(GSwitch), {
                        key: 0,
                        checked: Boolean(val(d)),
                        "test-id": "opt-boolean",
                        "onUpdate:checked": ($event) => set(d, $event)
                      }, null, 8, ["checked", "onUpdate:checked"])) : d.editor === "radio" ? (openBlock(), createBlock(unref(GRadioButtonGroup), {
                        key: 1,
                        class: "radio-group",
                        value: radioValue(d),
                        options: opts(d).map((o) => ({
                          label: o.label,
                          value: o.value
                        })),
                        "data-testid": "opt-radio",
                        "onUpdate:value": ($event) => set(d, $event)
                      }, null, 8, ["value", "options", "onUpdate:value"])) : d.editor === "select" ? (openBlock(), createBlock(unref(GSelect), {
                        key: 2,
                        class: "ctrl",
                        "data-testid": "opt-select",
                        value: selectValue(d),
                        options: selectOptions(d),
                        "allow-clear": "",
                        onChange: ($event) => onSelectValue(d, $event)
                      }, null, 8, ["value", "options", "onChange"])) : d.editor === "multi-select" ? (openBlock(), createBlock(unref(GSelect), {
                        key: 3,
                        class: "ctrl",
                        mode: "multiple",
                        "data-testid": "opt-multi-select",
                        value: Array.isArray(selectValue(d)) ? selectValue(d) : [],
                        options: selectOptions(d),
                        onChange: ($event) => onSelectValue(d, $event)
                      }, null, 8, ["value", "options", "onChange"])) : d.editor === "slider" ? (openBlock(), createElementBlock("div", _hoisted_14$c, [
                        createVNode(unref(_sfc_main$D$1), {
                          class: "slider",
                          min: sliderMin(d),
                          max: sliderMax(d),
                          step: sliderStep(d),
                          value: sliderValue(d),
                          "onUpdate:value": ($event) => set(d, $event)
                        }, null, 8, ["min", "max", "step", "value", "onUpdate:value"]),
                        createElementVNode(
                          "span",
                          _hoisted_15$b,
                          toDisplayString(sliderValue(d)),
                          1
                          /* TEXT */
                        )
                      ])) : d.editor === "unit" ? (openBlock(), createBlock(unref(UnitPicker), {
                        key: 5,
                        "data-testid": "opt-unit",
                        "model-value": String(val(d) ?? ""),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "color" ? (openBlock(), createBlock(unref(ColorPicker), {
                        key: 6,
                        "data-testid": "opt-color",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "thresholds" ? (openBlock(), createBlock(unref(ThresholdsEditor), {
                        key: 7,
                        "data-testid": "opt-thresholds",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "mappings" ? (openBlock(), createBlock(unref(ValueMappingsEditor), {
                        key: 8,
                        "data-testid": "opt-mappings",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "fieldColor" ? (openBlock(), createBlock(unref(FieldColorEditor), {
                        key: 9,
                        "data-testid": "opt-field-color",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "links" ? (openBlock(), createBlock(unref(DataLinksEditor), {
                        key: 10,
                        "data-testid": "opt-links",
                        "model-value": val(d),
                        "data-frames": __props.dataFrames,
                        "template-vars": __props.templateVars,
                        "template-var-properties": __props.templateVarProperties,
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "data-frames", "template-vars", "template-var-properties", "onUpdate:modelValue"])) : d.editor === "actions" ? (openBlock(), createBlock(unref(ActionsEditor), {
                        key: 11,
                        "data-testid": "opt-actions",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "stats-picker" ? (openBlock(), createBlock(unref(StatsPicker), {
                        key: 12,
                        "data-testid": "opt-stats-picker",
                        "model-value": val(d),
                        "allow-multiple": d.settings?.allowMultiple !== false,
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "allow-multiple", "onUpdate:modelValue"])) : d.editor === "strings" ? (openBlock(), createBlock(unref(StringArrayEditor), {
                        key: 13,
                        "data-testid": "opt-strings",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "timezone" ? (openBlock(), createBlock(unref(_sfc_main$m$1), {
                        key: 14,
                        "data-testid": "opt-timezone",
                        "model-value": val(d),
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "onUpdate:modelValue"])) : d.editor === "dashboard-uid" ? (openBlock(), createBlock(unref(GSelect), {
                        key: 15,
                        class: "ctrl",
                        "data-testid": "opt-dashboard-uid",
                        value: val(d),
                        options: d.settings?.options ?? [],
                        "allow-clear": "",
                        "show-search": "",
                        placeholder: "选择仪表盘",
                        onChange: ($event) => set(d, $event)
                      }, null, 8, ["value", "options", "onChange"])) : d.editor === "field-name" ? (openBlock(), createBlock(unref(_sfc_main$p$1), {
                        key: 16,
                        class: "ctrl",
                        "data-testid": "opt-field-name",
                        "model-value": val(d) ?? void 0,
                        options: fieldNamePickerOptions(),
                        "filter-types": d.settings?.filterTypes,
                        "filter-fn": fieldNameFilterFn(d),
                        placeholder: d.settings?.placeholderText || "选择字段",
                        "onUpdate:modelValue": ($event) => set(d, $event)
                      }, null, 8, ["model-value", "options", "filter-types", "filter-fn", "placeholder", "onUpdate:modelValue"])) : d.editor === "textarea" ? (openBlock(), createElementBlock("textarea", {
                        key: 17,
                        class: "ctrl",
                        "data-testid": "opt-textarea",
                        rows: "4",
                        value: String(val(d) ?? ""),
                        onInput: ($event) => onNative(d, $event)
                      }, null, 40, _hoisted_16$9)) : d.editor === "number" ? (openBlock(), createBlock(unref(GInput), {
                        key: 18,
                        class: "ctrl",
                        "data-testid": "opt-number",
                        type: "number",
                        value: val(d) == null ? "" : String(val(d)),
                        "onUpdate:value": ($event) => set(d, $event === "" ? void 0 : Number($event))
                      }, null, 8, ["value", "onUpdate:value"])) : !isKnownEditor(d.editor) ? (openBlock(), createElementBlock("div", _hoisted_17$9, [
                        createElementVNode(
                          "span",
                          _hoisted_18$9,
                          "未知编辑器: " + toDisplayString(d.editor),
                          1
                          /* TEXT */
                        ),
                        createVNode(unref(GInput), {
                          class: "ctrl",
                          "data-testid": "opt-text",
                          type: "text",
                          value: val(d) == null ? "" : typeof val(d) === "object" ? JSON.stringify(val(d)) : String(val(d)),
                          "onUpdate:value": ($event) => set(d, $event)
                        }, null, 8, ["value", "onUpdate:value"])
                      ])) : (openBlock(), createBlock(unref(GInput), {
                        key: 20,
                        class: "ctrl",
                        "data-testid": "opt-text",
                        type: "text",
                        disabled: isDisabled2(d),
                        value: val(d) == null ? "" : typeof val(d) === "object" ? JSON.stringify(val(d)) : String(val(d)),
                        "onUpdate:value": ($event) => set(d, $event)
                      }, null, 8, ["disabled", "value", "onUpdate:value"]))
                    ], 8, _hoisted_11$f);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])) : createCommentVNode("v-if", true)
            ], 10, _hoisted_6$r);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        !filtered.value.length ? (openBlock(), createElementBlock("p", _hoisted_19$9, "无匹配的选项")) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const OptionsPane = /* @__PURE__ */ _export_sfc$1(_sfc_main$17, [["__scopeId", "data-v-a408d3fd"]]);
const _hoisted_1$12 = ["data-options-visible", "data-display-mode", "data-table-view"];
const _hoisted_2$S = { class: "panel-editor__body" };
const _hoisted_3$K = ["data-display-mode"];
const _hoisted_4$z = {
  key: 0,
  class: "table-view",
  "data-testid": "panel-editor-table-view"
};
const _hoisted_5$t = { class: "tv-frame-meta" };
const _hoisted_6$q = {
  class: "tv-table",
  "data-testid": "panel-editor-table-grid"
};
const _hoisted_7$o = { class: "tv-type" };
const _hoisted_8$j = {
  key: 0,
  class: "tv-more"
};
const _hoisted_9$i = {
  key: 0,
  class: "tv-empty"
};
const _hoisted_10$e = {
  class: "panel-editor__data",
  "data-testid": "panel-editor-data"
};
const _hoisted_11$e = {
  class: "tabs",
  role: "tablist"
};
const _hoisted_12$d = {
  key: 2,
  class: "section alert-empty",
  "data-testid": "panel-alert-unsupported"
};
const _hoisted_13$d = { class: "options-tabs" };
const _hoisted_14$b = {
  key: 0,
  class: "section",
  "data-testid": "options-section"
};
const _hoisted_15$a = {
  class: "panel-frame-options",
  "data-testid": "panel-frame-options"
};
const _hoisted_16$8 = { class: "frame" };
const _hoisted_17$8 = {
  key: 4,
  class: "hint"
};
const _hoisted_18$8 = {
  key: 1,
  class: "section field-section",
  "data-testid": "field-section",
  "data-field-config": "true"
};
const _hoisted_19$8 = {
  key: 1,
  class: "hint"
};
const _hoisted_20$7 = { class: "panel-editor__footer" };
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
  ...{ inheritAttrs: false },
  __name: "PanelEditor",
  props: {
    panel: {},
    data: {},
    variables: {},
    session: {}
  },
  emits: ["back", "discard"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const CanvasEditor2 = defineAsyncComponent(
      () => Promise.resolve().then(() => index$1).then((m) => m.CanvasEditor)
    );
    const XYSeriesEditor2 = defineAsyncComponent(
      () => Promise.resolve().then(() => index$1).then((m) => m.XYSeriesEditor)
    );
    const GeomapLayersEditor2 = defineAsyncComponent(
      () => Promise.resolve().then(() => index$1).then((m) => m.GeomapLayersEditor)
    );
    const props = __props;
    const emit = __emit;
    const localSession = props.session ? null : createPanelEditSession({
      panel: ensurePanelQuery(clonePanel(props.panel))
    });
    const activeSession = computed(() => props.session ?? localSession);
    if (activeSession.value.workingPanel) {
      const ensured = ensurePanelQuery(activeSession.value.workingPanel);
      if (ensured !== activeSession.value.workingPanel) {
        Object.assign(activeSession.value.workingPanel, ensured);
      }
    }
    const draft = computed({
      get() {
        return activeSession.value.workingPanel;
      },
      set(next) {
        const panel2 = ensurePanelQuery(next);
        const wp = activeSession.value.workingPanel;
        for (const key of Object.keys(wp)) {
          if (!(key in panel2)) {
            delete wp[key];
          }
        }
        Object.assign(wp, panel2);
        activeSession.value.touch();
        __recomputeDirty();
      }
    });
    const originalSnapshot = ref(activeSession.value.savedBaselineJson);
    let __dirtyValue = false;
    let __dirtyInited = false;
    let __dirtyTimer = null;
    const __dirtyTick = ref(0);
    const draftDirty = computed(() => {
      void __dirtyTick.value;
      if (!__dirtyInited) {
        __dirtyInited = true;
        __dirtyValue = activeSession.value.isDirty;
      }
      return __dirtyValue;
    });
    function __recomputeDirty() {
      if (__dirtyTimer) clearTimeout(__dirtyTimer);
      __dirtyTimer = setTimeout(() => {
        __dirtyTimer = null;
        __dirtyValue = activeSession.value.isDirty;
        __dirtyInited = true;
        __dirtyTick.value++;
      }, 150);
    }
    function __setDirtyFromSession() {
      __dirtyValue = activeSession.value.isDirty;
      __dirtyInited = true;
      __dirtyTick.value++;
    }
    onBeforeUnmount(() => {
      if (__dirtyTimer) {
        clearTimeout(__dirtyTimer);
        __dirtyTimer = null;
      }
    });
    const tab = ref("query");
    const optionsMode = ref("options");
    const activeQuery = ref(0);
    const parentDataRef = computed(() => props.data);
    const {
      previewData,
      previewLoading
    } = usePanelPreview({
      draft,
      parentData: parentDataRef
    });
    const {
      ui,
      saveUi,
      previewHostRef,
      previewStyle,
      previewPanelSize,
      setDisplayMode,
      toggleOptionsPane,
      toggleTableView,
      onSplitStart
    } = usePanelEditorLayout(draft);
    watch(
      () => props.panel,
      (p) => {
        if (props.session) return;
        draft.value = ensurePanelQuery(clonePanel(p));
        originalSnapshot.value = activeSession.value.savedBaselineJson;
      }
    );
    const plugin2 = computed(() => getPanelPlugin(draft.value.type));
    const fieldNamesFromData = computed(() => {
      const names = /* @__PURE__ */ new Set();
      for (const frame of props.data?.series ?? []) {
        for (const f of frame.fields ?? []) {
          if (f?.name) names.add(String(f.name));
        }
      }
      return [...names];
    });
    const fieldNameOptionsFromData = computed(
      () => getFieldNameOptions(previewData.value?.series ?? props.data?.series ?? [])
    );
    const dataFramesFromData = computed(() => previewData.value?.series ?? props.data?.series ?? []);
    const repeatVariableOptions = computed(() => {
      const names = (props.variables ?? []).map((v) => String(v.name || "")).filter(Boolean);
      return [{ label: "禁用", value: "" }, ...names.map((n) => ({ label: n, value: n }))];
    });
    const templateVarNames = computed(() => {
      if (!Array.isArray(props.variables)) return [];
      return props.variables.map((v) => String(v.name || "")).filter(Boolean);
    });
    const templateVarProperties = computed(() => {
      const out = {};
      for (const v of props.variables ?? []) {
        const name = String(v?.name || "");
        if (!name) continue;
        out[name] = [name, `${name}.text`, `${name}.value`];
      }
      return out;
    });
    const optionDescriptors = computed(() => plugin2.value?.optionDescriptors ?? []);
    const fieldDescriptors = computed(() => plugin2.value?.fieldConfigDescriptors ?? []);
    const visualizations = computed(
      () => listPanelPlugins().map((p) => ({ id: p.meta.id, name: p.meta.name }))
    );
    const vizSelectOptions = computed(
      () => visualizations.value.map((v) => ({ label: v.name, value: v.id }))
    );
    const targets = computed(() => draft.value.targets ?? []);
    const activeTarget = computed(() => targets.value[activeQuery.value] ?? targets.value[0]);
    function targetDsType(t2) {
      const q = t2;
      return normalizeDsType(q?.datasource?.type) || normalizeDsType(draft.value.datasource?.type) || "grafana-testdata-datasource";
    }
    const heavyPluginsEpoch = ref(0);
    const __dsApiCache = /* @__PURE__ */ new Map();
    function dsApiCacheKey(uid, url, dataMode) {
      return `${uid}|${url}|${String(dataMode ?? "")}`;
    }
    function isIncompleteEditorApi(api) {
      if (!api || typeof api !== "object") return true;
      const a = api;
      if (typeof a.query !== "function") return true;
      return typeof a.getMetadata !== "function" && typeof a.metricFindQuery !== "function" && typeof a.testDatasource !== "function";
    }
    let heavyEnsureGen = 0;
    async function ensureHeavyQueryEditors() {
      const gen = ++heavyEnsureGen;
      const types = new Set(targets.value.map((t2) => normalizeDsType(targetDsType(t2))).filter(Boolean));
      const needs = {
        zabbix: [...types].some(
          (ty) => ty === "alexanderzobnin-zabbix-datasource" || ty === "zabbix" || String(ty).includes("zabbix")
        ),
        signoz: [...types].some((ty) => ty === "signoz" || String(ty).startsWith("signoz")),
        geomap: false
      };
      if (!needs.zabbix && !needs.signoz) return;
      try {
        await registerHeavyPlugins(needs);
      } catch (error) {
        if (typeof console !== "undefined") {
          console.error("[PanelEditor] heavy plugin ensure failed", error);
        }
      }
      if (gen !== heavyEnsureGen) return;
      __dsApiCache.clear();
      heavyPluginsEpoch.value += 1;
    }
    watch(
      () => targets.value.map((t2) => targetDsType(t2)).join("|"),
      () => {
        void ensureHeavyQueryEditors();
      },
      { immediate: true }
    );
    const QueryEditor2 = computed(() => {
      void heavyPluginsEpoch.value;
      return getDataSourcePlugin(targetDsType(activeTarget.value))?.QueryEditor;
    });
    const dsType = computed(() => targetDsType(activeTarget.value));
    const dsInstance = computed(() => {
      const q = activeTarget.value;
      const type = dsType.value;
      const uid = q?.datasource?.uid ?? draft.value.datasource?.uid ?? type;
      const name = q?.datasource?.name ?? draft.value.datasource?.name ?? type;
      const settings = resolveInstanceSettings({ uid, type, name });
      return {
        uid: settings.uid || uid,
        type: settings.type || type,
        name: settings.name || name,
        url: settings.url || "",
        jsonData: { ...settings.jsonData || {} },
        meta: { id: settings.type || type, name: settings.name || name }
      };
    });
    const dsApi = computed(() => {
      try {
        return resolveEditorDataSource({
          uid: dsInstance.value.uid,
          type: dsInstance.value.type,
          name: dsInstance.value.name
        });
      } catch {
        return null;
      }
    });
    const queryRows = computed(() => {
      void heavyPluginsEpoch.value;
      return targets.value.map((t2) => {
        const q = t2;
        const type = targetDsType(t2);
        const plugin22 = getDataSourcePlugin(type);
        const uid = q?.datasource?.uid ?? draft.value.datasource?.uid ?? type;
        const name = q?.datasource?.name ?? draft.value.datasource?.name ?? type;
        const settings = resolveInstanceSettings({ uid, type, name });
        const instance = {
          uid: settings.uid || uid,
          type: settings.type || type,
          name: settings.name || name,
          url: settings.url || "",
          jsonData: { ...settings.jsonData || {} },
          meta: { id: settings.type || type, name: settings.name || name }
        };
        const key = dsApiCacheKey(instance.uid, instance.url || "", instance.jsonData?.dataMode);
        let api = __dsApiCache.get(key) ?? null;
        if (!api || plugin22?.createDataSource && isIncompleteEditorApi(api)) {
          try {
            api = resolveEditorDataSource({
              uid: instance.uid,
              type: instance.type,
              name: instance.name
            });
            if (api && !isIncompleteEditorApi(api)) {
              __dsApiCache.set(key, api);
            } else if (api && plugin22?.createDataSource) {
              __dsApiCache.delete(key);
            } else if (api) {
              __dsApiCache.set(key, api);
            }
          } catch {
            api = null;
          }
        }
        return {
          refId: t2.refId,
          target: t2,
          dsType: type,
          hide: !!q?.hide,
          queryEditor: plugin22?.QueryEditor ?? null,
          dsInstance: instance,
          dsApi: api
        };
      });
    });
    const transformerIds = computed(() => {
      try {
        return listTransformerIds();
      } catch {
        return [...FALLBACK_TRANSFORMER_IDS];
      }
    });
    const transforms = computed(() => listTransforms(draft.value));
    const overrides = computed(() => listOverrides(draft.value));
    function setType(type) {
      draft.value = applyType(draft.value, type);
      ui.value.isPanelOptionsVisible = true;
      optionsMode.value = "options";
      saveUi();
    }
    function onGeomapLayers(next) {
      draft.value = { ...draft.value, options: next };
    }
    function onOptionPath(path, value) {
      draft.value = applyOptionPath(draft.value, path, value);
    }
    function onFramePath(path, value) {
      draft.value = { ...draft.value, [path]: value };
    }
    function onFieldPath(path, value) {
      draft.value = applyFieldPath(draft.value, path, value);
    }
    function onQueryChange(q) {
      draft.value = applyQueryAt(draft.value, targets.value, activeQuery.value, q);
    }
    function onQueryChangeAt(i, q) {
      draft.value = applyQueryAt(draft.value, targets.value, i, q);
    }
    function addQuery2() {
      draft.value = addQueryTarget(draft.value, targets.value, dsType.value, {
        uid: dsInstance.value.uid,
        name: dsInstance.value.name
      });
      const newIdx = (draft.value.targets?.length ?? 1) - 1;
      activeQuery.value = newIdx;
      const refId = draft.value.targets?.[newIdx]?.refId;
      if (refId) {
        nextTick(() => {
          document.querySelector(`[data-testid="query-row-${refId}"]`)?.scrollIntoView({ behavior: "smooth", block: "start" });
        });
      }
    }
    function changeActiveDatasource(ds2) {
      draft.value = changeQueryDatasource(draft.value, targets.value, activeQuery.value, ds2);
    }
    function changeDatasourceAt(i, ds2) {
      draft.value = changeQueryDatasource(draft.value, targets.value, i, ds2);
    }
    function runActiveQuery() {
      draft.value = bumpQueryRev(draft.value);
    }
    function duplicateQuery(i) {
      draft.value = duplicateQueryAt(draft.value, targets.value, i);
    }
    function removeQuery2(i) {
      const r = removeQueryAt(draft.value, targets.value, i, activeQuery.value);
      draft.value = r.panel;
      activeQuery.value = r.activeIndex;
    }
    function toggleHide(i) {
      draft.value = toggleQueryHide(draft.value, targets.value, i);
    }
    function moveQuery(i, dir) {
      const r = moveQueryAt(draft.value, targets.value, i, dir);
      draft.value = r.panel;
      activeQuery.value = r.activeIndex;
    }
    function addTransform$1(id) {
      draft.value = addTransform(draft.value, transforms.value, id);
    }
    function updateTransform(i, patch) {
      draft.value = updateTransformAt(draft.value, transforms.value, i, patch);
    }
    function clearTransforms$1() {
      draft.value = clearTransforms(draft.value);
    }
    function removeTransform(i) {
      draft.value = removeTransformAt(draft.value, transforms.value, i);
    }
    function toggleTransform(i) {
      draft.value = toggleTransformAt(draft.value, transforms.value, i);
    }
    function moveTransform(i, dir) {
      draft.value = moveTransformAt(draft.value, transforms.value, i, dir);
    }
    function onXySeriesChange(patch) {
      draft.value = {
        ...draft.value,
        options: { ...draft.value.options ?? {}, ...patch }
      };
    }
    function setCanvasOptions(opts) {
      draft.value = { ...draft.value, options: opts };
    }
    function onCanvasOptions(opts) {
      setCanvasOptions(opts);
    }
    function addOverride() {
      draft.value = addFieldOverride(draft.value, overrides.value);
    }
    function updateOverrideMatcher(i, id, options) {
      draft.value = updateOverrideMatcherAt(draft.value, overrides.value, i, id, options);
    }
    function addOverrideProp(i) {
      draft.value = addOverridePropAt(draft.value, overrides.value, i);
    }
    function removeOverrideProp(i, pi) {
      draft.value = removeOverridePropAt(draft.value, overrides.value, i, pi);
    }
    function setOverridePropId(i, pi, id) {
      draft.value = setOverridePropIdAt(draft.value, overrides.value, i, pi, id);
    }
    function setOverridePropValue(i, pi, raw) {
      draft.value = setOverridePropValueAt(draft.value, overrides.value, i, pi, raw);
    }
    function removeOverride(i) {
      draft.value = removeOverrideAt(draft.value, overrides.value, i);
    }
    function backToDashboard2() {
      const panel2 = clonePanel(draft.value);
      emit("back", panel2, previewData.value);
    }
    function discardChanges() {
      emit("discard");
    }
    function getDraft() {
      return clonePanel(draft.value);
    }
    function markSaved(panel2) {
      if (panel2) {
        const panelNext = ensurePanelQuery(panel2);
        const wp = activeSession.value.workingPanel;
        for (const key of Object.keys(wp)) {
          if (!(key in panelNext)) {
            delete wp[key];
          }
        }
        Object.assign(wp, panelNext);
      }
      activeSession.value.savedRevision = activeSession.value.mutationRevision;
      originalSnapshot.value = activeSession.value.savedBaselineJson;
      __setDirtyFromSession();
    }
    __expose({ getDraft, markSaved, draftDirty });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "panel-editor",
        "data-testid": "panel-editor",
        "data-grafana-layout": "panel-editor-3pane",
        "data-options-visible": unref(ui).isPanelOptionsVisible ? "1" : "0",
        "data-display-mode": unref(ui).mode,
        "data-table-view": unref(ui).tableViewEnabled ? "1" : "0"
      }, [
        createVNode(PanelEditorHeader, {
          title: draft.value.title || "",
          dirty: draftDirty.value,
          mode: unref(ui).mode,
          "table-view-enabled": unref(ui).tableViewEnabled,
          "options-visible": unref(ui).isPanelOptionsVisible,
          onBack: backToDashboard2,
          onSetMode: unref(setDisplayMode)
        }, {
          back: withCtx(() => [
            createVNode(unref(GButton), {
              "test-id": "panel-editor-back",
              size: "md",
              variant: "canvas",
              title: "返回仪表盘（保留更改）",
              onClick: backToDashboard2
            }, {
              default: withCtx(() => [..._cache[10] || (_cache[10] = [
                createTextVNode(
                  " ← 返回仪表盘 ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            })
          ]),
          tools: withCtx(() => [
            createVNode(unref(GButton), {
              "test-id": "toggle-table-view",
              size: "md",
              variant: "toolbar",
              onClick: unref(toggleTableView)
            }, {
              default: withCtx(() => [
                createTextVNode(
                  toDisplayString(unref(ui).tableViewEnabled ? "图表预览" : "表格预览"),
                  1
                  /* TEXT */
                )
              ]),
              _: 1
              /* STABLE */
            }, 8, ["onClick"]),
            createVNode(unref(GButton), {
              "test-id": "toggle-options-pane",
              size: "md",
              variant: "toolbar",
              onClick: unref(toggleOptionsPane)
            }, {
              default: withCtx(() => [
                createTextVNode(
                  toDisplayString(unref(ui).isPanelOptionsVisible ? "隐藏选项" : "显示选项"),
                  1
                  /* TEXT */
                )
              ]),
              _: 1
              /* STABLE */
            }, 8, ["onClick"])
          ]),
          _: 1
          /* STABLE */
        }, 8, ["title", "dirty", "mode", "table-view-enabled", "options-visible", "onSetMode"]),
        createElementVNode("div", _hoisted_2$S, [
          createElementVNode(
            "div",
            {
              class: "panel-editor__main",
              style: normalizeStyle({
                marginRight: unref(ui).isPanelOptionsVisible ? `${unref(ui).rightPaneSize}px` : "0"
              })
            },
            [
              createCommentVNode(" Top: visualization preview "),
              createElementVNode("div", {
                ref_key: "previewHostRef",
                ref: previewHostRef,
                class: "panel-editor__preview",
                "data-testid": "panel-editor-preview",
                "data-display-mode": unref(ui).mode,
                style: normalizeStyle({ flex: `0 0 ${unref(ui).topPaneSize * 100}%` })
              }, [
                createElementVNode(
                  "div",
                  {
                    class: "preview-inner",
                    "data-testid": "panel-editor-preview-inner",
                    style: normalizeStyle(unref(previewStyle))
                  },
                  [
                    createVNode(PanelHost, {
                      title: draft.value.title || "预览",
                      transparent: !!draft.value.transparent,
                      links: draft.value.links ?? [],
                      "panel-type": draft.value.type,
                      "panel-id": draft.value.id,
                      loading: unref(previewLoading) || unref(previewData)?.state === "Loading",
                      error: unref(previewData)?.error?.message,
                      data: unref(previewData),
                      options: draft.value.options || {},
                      "field-config": draft.value.fieldConfig || { defaults: {}, overrides: [] },
                      width: unref(previewPanelSize).width,
                      height: unref(previewPanelSize).height,
                      "time-range": unref(previewData)?.timeRange,
                      editable: false,
                      "can-edit": false,
                      "is-editing": true
                    }, {
                      default: withCtx(() => [
                        unref(ui).tableViewEnabled ? (openBlock(), createElementBlock("div", _hoisted_4$z, [
                          (openBlock(true), createElementBlock(
                            Fragment,
                            null,
                            renderList(unref(previewData)?.series ?? [], (frame, fi) => {
                              return openBlock(), createElementBlock("div", {
                                key: fi,
                                class: "tv-frame"
                              }, [
                                createElementVNode(
                                  "div",
                                  _hoisted_5$t,
                                  " frame " + toDisplayString(fi) + " · refId=" + toDisplayString(frame.refId || "—") + " · rows=" + toDisplayString(frame.length),
                                  1
                                  /* TEXT */
                                ),
                                createElementVNode("table", _hoisted_6$q, [
                                  createElementVNode("thead", null, [
                                    createElementVNode("tr", null, [
                                      (openBlock(true), createElementBlock(
                                        Fragment,
                                        null,
                                        renderList(frame.fields, (f) => {
                                          return openBlock(), createElementBlock("th", {
                                            key: f.name
                                          }, [
                                            createTextVNode(
                                              toDisplayString(f.name) + " ",
                                              1
                                              /* TEXT */
                                            ),
                                            createElementVNode(
                                              "span",
                                              _hoisted_7$o,
                                              toDisplayString(f.type),
                                              1
                                              /* TEXT */
                                            )
                                          ]);
                                        }),
                                        128
                                        /* KEYED_FRAGMENT */
                                      ))
                                    ])
                                  ]),
                                  createElementVNode("tbody", null, [
                                    (openBlock(true), createElementBlock(
                                      Fragment,
                                      null,
                                      renderList(Math.min(frame.length, 50), (ri) => {
                                        return openBlock(), createElementBlock("tr", { key: ri }, [
                                          (openBlock(true), createElementBlock(
                                            Fragment,
                                            null,
                                            renderList(frame.fields, (f) => {
                                              return openBlock(), createElementBlock(
                                                "td",
                                                {
                                                  key: `${f.name}-${ri}`
                                                },
                                                toDisplayString(f.values[ri - 1]),
                                                1
                                                /* TEXT */
                                              );
                                            }),
                                            128
                                            /* KEYED_FRAGMENT */
                                          ))
                                        ]);
                                      }),
                                      128
                                      /* KEYED_FRAGMENT */
                                    ))
                                  ])
                                ]),
                                frame.length > 50 ? (openBlock(), createElementBlock(
                                  "p",
                                  _hoisted_8$j,
                                  " … 仅显示前 50 行 / 共 " + toDisplayString(frame.length),
                                  1
                                  /* TEXT */
                                )) : createCommentVNode("v-if", true)
                              ]);
                            }),
                            128
                            /* KEYED_FRAGMENT */
                          )),
                          !unref(previewData)?.series?.length ? (openBlock(), createElementBlock("p", _hoisted_9$i, "无数据帧")) : createCommentVNode("v-if", true)
                        ])) : createCommentVNode("v-if", true)
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["title", "transparent", "links", "panel-type", "panel-id", "loading", "error", "data", "options", "field-config", "width", "height", "time-range"])
                  ],
                  4
                  /* STYLE */
                )
              ], 12, _hoisted_3$K),
              createElementVNode(
                "div",
                {
                  class: "split-v",
                  "data-testid": "split-vertical",
                  title: "拖拽调整预览高度",
                  onPointerdown: _cache[0] || (_cache[0] = ($event) => unref(onSplitStart)("v", $event))
                },
                null,
                32
                /* NEED_HYDRATION */
              ),
              createCommentVNode(" Bottom: data tabs "),
              createElementVNode("div", _hoisted_10$e, [
                createElementVNode("div", _hoisted_11$e, [
                  createElementVNode(
                    "button",
                    {
                      type: "button",
                      role: "tab",
                      class: normalizeClass({ active: tab.value === "query" }),
                      "data-testid": "tab-query",
                      onClick: _cache[1] || (_cache[1] = ($event) => tab.value = "query")
                    },
                    " 查询 ",
                    2
                    /* CLASS */
                  ),
                  createElementVNode(
                    "button",
                    {
                      type: "button",
                      role: "tab",
                      class: normalizeClass({ active: tab.value === "transform" }),
                      "data-testid": "tab-transform",
                      onClick: _cache[2] || (_cache[2] = ($event) => tab.value = "transform")
                    },
                    " 转换 ",
                    2
                    /* CLASS */
                  ),
                  createElementVNode(
                    "button",
                    {
                      type: "button",
                      role: "tab",
                      class: normalizeClass({ active: tab.value === "alert" }),
                      "data-testid": "tab-alert",
                      onClick: _cache[3] || (_cache[3] = ($event) => tab.value = "alert")
                    },
                    " 告警 ",
                    2
                    /* CLASS */
                  )
                ]),
                tab.value === "query" ? (openBlock(), createBlock(QueryEditorTab, {
                  key: 0,
                  targets: targets.value,
                  rows: queryRows.value,
                  "active-query": activeQuery.value,
                  "active-target": activeTarget.value,
                  "query-editor": QueryEditor2.value,
                  "ds-type": dsType.value,
                  "ds-instance": dsInstance.value,
                  "ds-api": dsApi.value,
                  "onUpdate:activeQuery": _cache[4] || (_cache[4] = ($event) => activeQuery.value = $event),
                  onActivate: _cache[5] || (_cache[5] = ($event) => activeQuery.value = $event),
                  onAdd: addQuery2,
                  onDuplicate: duplicateQuery,
                  onToggleHide: toggleHide,
                  onMove: moveQuery,
                  onRemove: removeQuery2,
                  onChange: onQueryChange,
                  onChangeAt: onQueryChangeAt,
                  onChangeDatasource: changeActiveDatasource,
                  onChangeDatasourceAt: changeDatasourceAt,
                  onRunQuery: runActiveQuery
                }, null, 8, ["targets", "rows", "active-query", "active-target", "query-editor", "ds-type", "ds-instance", "ds-api"])) : tab.value === "transform" ? (openBlock(), createBlock(TransformEditorTab, {
                  key: 1,
                  transforms: transforms.value,
                  "transformer-ids": transformerIds.value,
                  "ref-ids": (draft.value.targets || []).map((q) => q.refId).filter(Boolean),
                  frames: unref(previewData)?.series ?? __props.data?.series ?? [],
                  onAdd: addTransform$1,
                  onUpdate: updateTransform,
                  onRemove: removeTransform,
                  onToggle: toggleTransform,
                  onMove: moveTransform,
                  onClear: clearTransforms$1
                }, null, 8, ["transforms", "transformer-ids", "ref-ids", "frames"])) : tab.value === "alert" ? (openBlock(), createElementBlock("section", _hoisted_12$d, [..._cache[11] || (_cache[11] = [
                  createElementVNode(
                    "h3",
                    null,
                    "告警",
                    -1
                    /* CACHED */
                  ),
                  createElementVNode(
                    "p",
                    null,
                    " 此面板编辑器对齐 Grafana PanelEditor 的 Alert 页。当前构建未启用统一告警（Unified Alerting）后端时， 不提供伪规则编辑器。可在仪表盘层接入 Alertmanager 数据源查看告警列表。 ",
                    -1
                    /* CACHED */
                  ),
                  createElementVNode(
                    "p",
                    { class: "hint" },
                    "对照：grafana-main PanelEditorTabId.Alert / PanelNotSupported",
                    -1
                    /* CACHED */
                  )
                ])])) : createCommentVNode("v-if", true)
              ])
            ],
            4
            /* STYLE */
          ),
          createCommentVNode(" Right: options pane "),
          unref(ui).isPanelOptionsVisible ? (openBlock(), createElementBlock(
            "aside",
            {
              key: 0,
              class: "panel-editor__options",
              "data-testid": "panel-editor-options",
              style: normalizeStyle({ width: `${unref(ui).rightPaneSize}px` })
            },
            [
              createElementVNode(
                "div",
                {
                  class: "split-h",
                  "data-testid": "split-horizontal",
                  title: "拖拽调整选项宽度",
                  onPointerdown: _cache[6] || (_cache[6] = ($event) => unref(onSplitStart)("h", $event))
                },
                null,
                32
                /* NEED_HYDRATION */
              ),
              createElementVNode("div", _hoisted_13$d, [
                createElementVNode(
                  "button",
                  {
                    type: "button",
                    class: normalizeClass({ active: optionsMode.value === "options" }),
                    "data-testid": "tab-options",
                    onClick: _cache[7] || (_cache[7] = ($event) => optionsMode.value = "options")
                  },
                  " 面板选项 ",
                  2
                  /* CLASS */
                ),
                createElementVNode(
                  "button",
                  {
                    type: "button",
                    class: normalizeClass({ active: optionsMode.value === "field" }),
                    "data-testid": "tab-field",
                    onClick: _cache[8] || (_cache[8] = ($event) => optionsMode.value = "field")
                  },
                  " 字段 ",
                  2
                  /* CLASS */
                )
              ]),
              optionsMode.value === "options" ? (openBlock(), createElementBlock("section", _hoisted_14$b, [
                createElementVNode("div", _hoisted_15$a, [
                  createElementVNode("label", _hoisted_16$8, [
                    _cache[12] || (_cache[12] = createTextVNode(
                      " 可视化 ",
                      -1
                      /* CACHED */
                    )),
                    createVNode(unref(GSelect), {
                      "test-id": "viz-select",
                      value: draft.value.type,
                      options: vizSelectOptions.value,
                      virtual: false,
                      onChange: _cache[9] || (_cache[9] = ($event) => setType(String($event ?? "")))
                    }, null, 8, ["value", "options"])
                  ]),
                  createVNode(PanelFrameOptions, {
                    panel: draft.value,
                    "repeat-variable-options": repeatVariableOptions.value,
                    "template-vars": templateVarNames.value,
                    "template-var-properties": templateVarProperties.value,
                    onChange: onFramePath
                  }, null, 8, ["panel", "repeat-variable-options", "template-vars", "template-var-properties"])
                ]),
                optionDescriptors.value.length ? (openBlock(), createBlock(OptionsPane, {
                  key: 0,
                  options: draft.value.options || {},
                  descriptors: optionDescriptors.value,
                  "field-names": fieldNamesFromData.value,
                  "field-name-options": fieldNameOptionsFromData.value,
                  "data-frames": dataFramesFromData.value,
                  "template-vars": templateVarNames.value,
                  "template-var-properties": templateVarProperties.value,
                  onChange: onOptionPath
                }, null, 8, ["options", "descriptors", "field-names", "field-name-options", "data-frames", "template-vars", "template-var-properties"])) : createCommentVNode("v-if", true),
                draft.value.type === "canvas" ? (openBlock(), createBlock(unref(CanvasEditor2), {
                  key: 1,
                  options: draft.value.options || {},
                  onChange: onCanvasOptions
                }, null, 8, ["options"])) : createCommentVNode("v-if", true),
                draft.value.type === "xychart" ? (openBlock(), createBlock(unref(XYSeriesEditor2), {
                  key: 2,
                  series: draft.value.options?.series,
                  dims: draft.value.options?.dims,
                  frames: props.data?.series ?? [],
                  onChange: onXySeriesChange
                }, null, 8, ["series", "dims", "frames"])) : createCommentVNode("v-if", true),
                draft.value.type === "geomap" ? (openBlock(), createBlock(unref(GeomapLayersEditor2), {
                  key: 3,
                  options: draft.value.options || {},
                  onChange: onGeomapLayers
                }, null, 8, ["options"])) : createCommentVNode("v-if", true),
                !optionDescriptors.value.length && draft.value.type !== "canvas" && draft.value.type !== "geomap" ? (openBlock(), createElementBlock(
                  "p",
                  _hoisted_17$8,
                  " 此可视化暂无注册选项：" + toDisplayString(draft.value.type),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ])) : (openBlock(), createElementBlock("section", _hoisted_18$8, [
                fieldDescriptors.value.length ? (openBlock(), createBlock(OptionsPane, {
                  key: 0,
                  "field-mode": "",
                  options: draft.value.fieldConfig?.defaults ?? {},
                  descriptors: fieldDescriptors.value,
                  "field-names": fieldNamesFromData.value,
                  "field-name-options": fieldNameOptionsFromData.value,
                  "data-frames": dataFramesFromData.value,
                  "template-vars": templateVarNames.value,
                  "template-var-properties": templateVarProperties.value,
                  onChange: onFieldPath
                }, null, 8, ["options", "descriptors", "field-names", "field-name-options", "data-frames", "template-vars", "template-var-properties"])) : (openBlock(), createElementBlock("p", _hoisted_19$8, "此可视化无字段配置")),
                createVNode(FieldOverridesEditor, {
                  overrides: overrides.value,
                  onAdd: addOverride,
                  onRemove: removeOverride,
                  onUpdateMatcher: updateOverrideMatcher,
                  onAddProp: addOverrideProp,
                  onRemoveProp: removeOverrideProp,
                  onSetPropId: setOverridePropId,
                  onSetPropValue: setOverridePropValue
                }, null, 8, ["overrides"])
              ]))
            ],
            4
            /* STYLE */
          )) : createCommentVNode("v-if", true)
        ]),
        createElementVNode("footer", _hoisted_20$7, [
          createVNode(unref(GButton), {
            "test-id": "panel-editor-cancel",
            size: "md",
            variant: "toolbar",
            onClick: discardChanges
          }, {
            default: withCtx(() => [..._cache[13] || (_cache[13] = [
              createTextVNode(
                " 丢弃 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }),
          createCommentVNode(" Grafana alias: L-VE / Playwright also look for panel-editor-discard "),
          createElementVNode("button", {
            type: "button",
            class: "sr-only",
            "data-testid": "panel-editor-discard",
            tabindex: "-1",
            "aria-hidden": "true",
            onClick: discardChanges
          }, " 丢弃 "),
          createVNode(unref(GButton), {
            "test-id": "panel-editor-apply",
            size: "md",
            variant: "primary",
            onClick: backToDashboard2
          }, {
            default: withCtx(() => [..._cache[14] || (_cache[14] = [
              createTextVNode(
                " 应用 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ])
      ], 8, _hoisted_1$12);
    };
  }
});
const PanelEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$16, [["__scopeId", "data-v-cb9829c8"]]);
const _hoisted_1$11 = {
  key: 0,
  class: "variables-bar",
  "data-testid": "variables-bar",
  role: "toolbar",
  "aria-label": "模板变量"
};
const _hoisted_2$R = ["data-var-type"];
const _hoisted_3$J = ["for"];
const _hoisted_4$y = ["data-testid"];
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
  __name: "VariablesBar",
  props: {
    variables: {}
  },
  emits: ["change", "adhoc-change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const visible = computed(() => props.variables.filter((v) => v.hide !== 2));
    const ADHOC_OPS = [
      { label: "=", value: "=" },
      { label: "!=", value: "!=" },
      { label: "=~", value: "=~" },
      { label: "!~", value: "!~" },
      { label: ">", value: ">" },
      { label: "<", value: "<" }
    ];
    function currentValue(v) {
      const val = v.current?.value;
      if (v.multi) {
        return Array.isArray(val) ? val.map(String) : val != null && val !== "" ? [String(val)] : [];
      }
      return Array.isArray(val) ? String(val[0] ?? "") : String(val ?? "");
    }
    function optionList(v) {
      const opts = (v.options ?? []).map((o) => ({
        label: String(o.text ?? o.value ?? ""),
        value: String(o.value ?? "")
      }));
      if (v.includeAll) {
        const allVal = v.allValue != null && String(v.allValue) !== "" ? String(v.allValue) : "/.*/";
        return [{ label: "全部", value: allVal }, ...opts];
      }
      return opts;
    }
    function onSelect(name, value, multi) {
      if (multi) {
        const arr = Array.isArray(value) ? value.map(String) : value != null && value !== "" ? [String(value)] : [];
        emit("change", name, arr);
      } else {
        emit("change", name, String(value ?? ""));
      }
    }
    function filtersOf(v) {
      const f = v.filters;
      return Array.isArray(f) ? f.map((x) => ({
        key: String(x.key ?? ""),
        operator: String(x.operator ?? "="),
        value: String(x.value ?? "")
      })) : [];
    }
    function updateFilter(v, index2, patch) {
      const next = filtersOf(v).map((f, i) => i === index2 ? { ...f, ...patch } : f);
      emit("adhoc-change", v.name, next);
    }
    function addFilter(v) {
      emit("adhoc-change", v.name, [...filtersOf(v), { key: "", operator: "=", value: "" }]);
    }
    function removeFilter(v, index2) {
      emit(
        "adhoc-change",
        v.name,
        filtersOf(v).filter((_, i) => i !== index2)
      );
    }
    const ADHOC_KEY_SUGGESTIONS = {
      prometheus: ["job", "instance", "namespace", "pod", "service", "container", "__name__"],
      loki: ["job", "filename", "namespace", "pod", "app", "level", "service_name"],
      default: ["job", "instance", "namespace", "pod", "service"]
    };
    function adhocKeySuggestions(v) {
      const dsType = String(v.datasource?.type ?? v.datasource?.uid ?? "");
      let keys = ADHOC_KEY_SUGGESTIONS.default;
      if (dsType.includes("prometheus") || dsType === "prometheus")
        keys = ADHOC_KEY_SUGGESTIONS.prometheus;
      else if (dsType.includes("loki")) keys = ADHOC_KEY_SUGGESTIONS.loki;
      return keys.map((k) => ({ label: k, value: k }));
    }
    return (_ctx, _cache) => {
      return visible.value.length ? (openBlock(), createElementBlock("div", _hoisted_1$11, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(visible.value, (v) => {
            return openBlock(), createElementBlock("div", {
              key: v.name,
              class: normalizeClass(["var-item", { "is-label-hidden": v.hide === 1 }]),
              "data-var-type": v.type
            }, [
              createCommentVNode(" Grafana ControlsLabel: label/name only — no type badge on dashboard bar "),
              v.hide !== 1 ? (openBlock(), createElementBlock("label", {
                key: 0,
                for: `var-${v.name}`
              }, toDisplayString(v.label || v.name), 9, _hoisted_3$J)) : createCommentVNode("v-if", true),
              v.type === "adhoc" ? (openBlock(), createElementBlock("div", {
                key: 1,
                class: "adhoc",
                "data-testid": `var-adhoc-${v.name}`
              }, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(filtersOf(v), (f, i) => {
                    return openBlock(), createElementBlock("div", {
                      key: i,
                      class: "adhoc-row",
                      "data-testid": "adhoc-filter-row"
                    }, [
                      createVNode(unref(GSelect), {
                        value: f.key,
                        options: adhocKeySuggestions(v),
                        placeholder: "键",
                        size: "small",
                        "show-search": "",
                        class: "adhoc-key",
                        "data-testid": "adhoc-key",
                        "onUpdate:value": ($event) => updateFilter(v, i, { key: String($event ?? "") })
                      }, null, 8, ["value", "options", "onUpdate:value"]),
                      createVNode(unref(GSelect), {
                        value: f.operator,
                        options: ADHOC_OPS,
                        "show-search": false,
                        size: "small",
                        "test-id": "adhoc-op",
                        class: "adhoc-op",
                        onChange: ($event) => updateFilter(v, i, { operator: String($event ?? "=") })
                      }, null, 8, ["value", "onChange"]),
                      createVNode(unref(GInput), {
                        value: f.value,
                        placeholder: "值",
                        "test-id": "adhoc-value",
                        class: "adhoc-value",
                        "onUpdate:value": ($event) => updateFilter(v, i, { value: String($event ?? "") })
                      }, null, 8, ["value", "onUpdate:value"]),
                      createVNode(unref(GButton), {
                        size: "sm",
                        "test-id": "adhoc-remove",
                        onClick: ($event) => removeFilter(v, i)
                      }, {
                        default: withCtx(() => [..._cache[0] || (_cache[0] = [
                          createTextVNode(
                            " × ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["onClick"])
                    ]);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                )),
                createVNode(unref(GButton), {
                  size: "sm",
                  variant: "text",
                  class: "adhoc-add",
                  "test-id": "adhoc-add",
                  onClick: ($event) => addFilter(v)
                }, {
                  default: withCtx(() => [..._cache[1] || (_cache[1] = [
                    createTextVNode(
                      " + 过滤条件 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }, 8, ["onClick"])
              ], 8, _hoisted_4$y)) : v.type === "textbox" || v.type === "constant" ? (openBlock(), createBlock(unref(GInput), {
                key: 2,
                id: `var-${v.name}`,
                class: "var-control",
                value: currentValue(v),
                disabled: v.type === "constant",
                "test-id": `var-${v.name}`,
                placeholder: v.label || v.name,
                "onUpdate:value": ($event) => emit("change", v.name, String($event ?? ""))
              }, null, 8, ["id", "value", "disabled", "test-id", "placeholder", "onUpdate:value"])) : (openBlock(), createBlock(unref(GSelect), {
                key: 3,
                id: `var-${v.name}`,
                class: "var-control",
                value: currentValue(v),
                options: optionList(v),
                virtual: (optionList(v)?.length ?? 0) > 50,
                mode: v.multi ? "multiple" : void 0,
                "test-id": `var-${v.name}`,
                "aria-label": v.label || v.name,
                placeholder: v.label || v.name,
                onChange: ($event) => onSelect(v.name, $event, !!v.multi)
              }, null, 8, ["id", "value", "options", "virtual", "mode", "test-id", "aria-label", "placeholder", "onChange"]))
            ], 10, _hoisted_2$R);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ])) : createCommentVNode("v-if", true);
    };
  }
});
const VariablesBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__scopeId", "data-v-59e10bf6"]]);
const _hoisted_1$10 = { class: "actions" };
const _hoisted_2$Q = { class: "body" };
const _hoisted_3$I = {
  class: "list",
  "data-testid": "var-list"
};
const _hoisted_4$x = {
  key: 0,
  class: "empty"
};
const _hoisted_5$s = ["data-testid", "onClick"];
const _hoisted_6$p = {
  key: 0,
  class: "editor",
  "data-testid": "var-editor"
};
const _hoisted_7$n = { key: 0 };
const _hoisted_8$i = {
  key: 1,
  class: "adhoc-editor",
  "data-testid": "adhoc-filters-editor"
};
const _hoisted_9$h = { key: 2 };
const _hoisted_10$d = {
  key: 3,
  class: "refresh-row"
};
const _hoisted_11$d = {
  key: 0,
  class: "err",
  "data-testid": "var-refresh-error"
};
const _hoisted_12$c = {
  class: "meta",
  "data-testid": "var-option-count"
};
const _hoisted_13$c = {
  key: 4,
  class: "options-preview",
  "data-testid": "var-options-preview"
};
const _hoisted_14$a = { class: "check" };
const _hoisted_15$9 = { class: "check" };
const _hoisted_16$7 = {
  key: 5,
  class: "field"
};
const _hoisted_17$7 = { class: "field" };
const _hoisted_18$7 = { class: "field" };
const _hoisted_19$7 = { class: "field" };
const _hoisted_20$6 = { class: "check" };
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
  __name: "VariablesSettings",
  props: {
    variables: {},
    embedded: { type: Boolean }
  },
  emits: ["change", "close"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const selected = ref(0);
    const refreshing = ref(false);
    const refreshError = ref("");
    const datasourceList = ref([]);
    const current = computed(() => props.variables[selected.value] ?? null);
    const typeOptions = [
      { value: "query", label: "查询" },
      { value: "custom", label: "自定义" },
      { value: "constant", label: "常量" },
      { value: "textbox", label: "文本框" },
      { value: "interval", label: "间隔" },
      { value: "datasource", label: "数据源" },
      { value: "adhoc", label: "Ad hoc 过滤" }
    ];
    const hideOptions = [
      { value: 0, label: "显示" },
      { value: 1, label: "仅隐藏标签" },
      { value: 2, label: "隐藏变量" }
    ];
    const sortOptions = [
      { value: 0, label: "禁用" },
      { value: 1, label: "按字母升序" },
      { value: 2, label: "按字母降序" },
      { value: 3, label: "按数字升序" },
      { value: 4, label: "按数字降序" },
      { value: 5, label: "按字母升序（忽略大小写）" },
      { value: 6, label: "按字母降序（忽略大小写）" },
      { value: 7, label: "自然升序" },
      { value: 8, label: "自然降序" }
    ];
    const refreshModeOptions = [
      { value: 1, label: "仪表盘加载时" },
      { value: 2, label: "时间范围变化时" }
    ];
    const datasourceOptions = computed(() => [
      { value: "", label: "默认" },
      ...datasourceList.value.map((d) => ({
        value: d.uid,
        label: `${d.name} (${d.type})`
      }))
    ]);
    onMounted(async () => {
      const list = await listDataSources();
      datasourceList.value = list.length ? list.map((d) => ({ uid: d.uid, name: d.name, type: d.type })) : [
        { uid: "prometheus", name: "Prometheus", type: "prometheus" },
        {
          uid: "testdata",
          name: "TestData",
          type: "grafana-testdata-datasource"
        }
      ];
    });
    function patch(partial) {
      if (!current.value) return;
      const next = props.variables.map((v, i) => i === selected.value ? { ...v, ...partial } : v);
      emit("change", next);
    }
    function addVariable() {
      const name = `var${props.variables.length + 1}`;
      emit("change", [
        ...props.variables,
        {
          name,
          type: "custom",
          label: name,
          hide: 0,
          multi: false,
          includeAll: false,
          skipUrlSync: false,
          current: { text: "A", value: "A" },
          options: [
            { text: "A", value: "A", selected: true },
            { text: "B", value: "B", selected: false },
            { text: "C", value: "C", selected: false }
          ],
          query: "A,B,C"
        }
      ]);
      selected.value = props.variables.length;
    }
    function removeSelected() {
      if (selected.value < 0) return;
      const next = props.variables.filter((_, i) => i !== selected.value);
      emit("change", next);
      selected.value = Math.max(0, selected.value - 1);
    }
    function onQueryOptions(text) {
      if (current.value?.type === "query") {
        patch({ query: text, definition: text });
        return;
      }
      const options = text.split(",").map((s) => s.trim()).filter(Boolean).map((v) => ({ text: v, value: v, selected: false }));
      patch({
        query: text,
        options,
        current: options[0] ? { text: options[0].text, value: options[0].value } : { text: "", value: "" }
      });
    }
    function resolveDs(ref2) {
      const list = datasourceList.value;
      const hit = list.find(
        (d) => ref2?.uid && d.uid === ref2.uid || ref2?.type && d.type === ref2.type
      ) || list[0] || { uid: "prometheus", name: "Prometheus", type: "prometheus" };
      const plugin2 = getDataSourcePlugin(hit.type);
      if (!plugin2?.createDataSource) return void 0;
      return plugin2.createDataSource({
        id: 1,
        uid: hit.uid,
        name: hit.name,
        type: hit.type,
        access: "proxy",
        jsonData: {},
        meta: plugin2.meta
      });
    }
    async function refreshAll() {
      refreshing.value = true;
      refreshError.value = "";
      try {
        let order;
        try {
          order = variableRefreshOrder(props.variables);
        } catch (error) {
          refreshError.value = error instanceof Error ? error.message : String(error);
          order = props.variables.map((v) => v.name);
        }
        const list = [...props.variables];
        for (const name of order) {
          const idx = list.findIndex((v) => v.name === name);
          if (idx < 0) continue;
          list[idx] = await refreshVariableOptions(list[idx], (ref2) => resolveDs(ref2));
        }
        emit("change", list);
      } catch (error) {
        refreshError.value = error instanceof Error ? error.message : String(error);
      } finally {
        refreshing.value = false;
      }
    }
    async function refreshCurrent() {
      if (!current.value) return;
      refreshing.value = true;
      refreshError.value = "";
      try {
        const updated = await refreshVariableOptions(
          current.value,
          (ref2) => resolveDs(ref2)
        );
        if ((current.value.type === "query" || current.value.type === "custom") && !updated.options?.length && current.value.query) {
          const fallback = String(current.value.query).split(",").map((s) => s.trim()).filter(Boolean).map((v) => ({ text: v, value: v, selected: false }));
          if (fallback.length) {
            patch({
              options: fallback,
              current: { text: fallback[0].text, value: fallback[0].value }
            });
            return;
          }
        }
        const next = props.variables.map((v, i) => i === selected.value ? updated : v);
        emit("change", next);
      } catch (error) {
        refreshError.value = error instanceof Error ? error.message : String(error);
      } finally {
        refreshing.value = false;
      }
    }
    function setDatasource(uid) {
      const hit = datasourceList.value.find((d) => d.uid === uid || d.name === uid);
      patch({
        datasource: hit ? { type: hit.type, uid: hit.uid } : { uid }
      });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["var-settings", { "var-settings--embedded": __props.embedded }]),
          "data-testid": "variables-settings"
        },
        [
          createElementVNode("header", null, [
            _cache[18] || (_cache[18] = createElementVNode(
              "strong",
              null,
              "变量",
              -1
              /* CACHED */
            )),
            createElementVNode("div", _hoisted_1$10, [
              createVNode(unref(GButton), {
                size: "md",
                variant: "primary",
                "test-id": "var-add",
                onClick: addVariable
              }, {
                default: withCtx(() => [..._cache[15] || (_cache[15] = [
                  createTextVNode(
                    " 添加变量 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }),
              createVNode(unref(GButton), {
                size: "md",
                variant: "secondary",
                "test-id": "var-refresh-all",
                loading: refreshing.value,
                onClick: refreshAll
              }, {
                default: withCtx(() => [..._cache[16] || (_cache[16] = [
                  createTextVNode(
                    " 刷新全部 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["loading"]),
              !__props.embedded ? (openBlock(), createBlock(unref(GButton), {
                key: 0,
                size: "md",
                variant: "toolbar",
                "test-id": "var-close",
                onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
              }, {
                default: withCtx(() => [..._cache[17] || (_cache[17] = [
                  createTextVNode(
                    " 关闭 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })) : createCommentVNode("v-if", true)
            ])
          ]),
          createElementVNode("div", _hoisted_2$Q, [
            createElementVNode("ul", _hoisted_3$I, [
              !__props.variables.length ? (openBlock(), createElementBlock("li", _hoisted_4$x, "暂无变量")) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(__props.variables, (v, i) => {
                  return openBlock(), createElementBlock("li", {
                    key: v.name + i,
                    class: normalizeClass({ active: i === selected.value }),
                    "data-testid": `var-list-item-${v.name}`,
                    onClick: ($event) => selected.value = i
                  }, [
                    createElementVNode(
                      "span",
                      null,
                      toDisplayString(v.label || v.name),
                      1
                      /* TEXT */
                    ),
                    createElementVNode(
                      "small",
                      null,
                      toDisplayString(v.type),
                      1
                      /* TEXT */
                    )
                  ], 10, _hoisted_5$s);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            current.value ? (openBlock(), createElementBlock("div", _hoisted_6$p, [
              createElementVNode("label", null, [
                _cache[19] || (_cache[19] = createTextVNode(
                  " 名称 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: current.value.name,
                  "test-id": "var-name",
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ name: String($event ?? "") }))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", null, [
                _cache[20] || (_cache[20] = createTextVNode(
                  " 标签 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: current.value.label || "",
                  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ label: String($event ?? "") }))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", null, [
                _cache[21] || (_cache[21] = createTextVNode(
                  " 类型 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: current.value.type,
                  options: typeOptions,
                  "test-id": "var-type",
                  "show-search": false,
                  onChange: _cache[3] || (_cache[3] = ($event) => patch({ type: String($event) }))
                }, null, 8, ["value"])
              ]),
              current.value.type === "query" ? (openBlock(), createElementBlock("label", _hoisted_7$n, [
                _cache[22] || (_cache[22] = createTextVNode(
                  " 数据源 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  "test-id": "var-datasource",
                  value: current.value.datasource?.uid || "",
                  options: datasourceOptions.value,
                  onChange: _cache[4] || (_cache[4] = ($event) => setDatasource(String($event ?? "")))
                }, null, 8, ["value", "options"])
              ])) : createCommentVNode("v-if", true),
              current.value.type === "adhoc" ? (openBlock(), createElementBlock("div", _hoisted_8$i, [
                _cache[24] || (_cache[24] = createElementVNode(
                  "header",
                  null,
                  "Ad hoc 过滤条件",
                  -1
                  /* CACHED */
                )),
                _cache[25] || (_cache[25] = createElementVNode(
                  "p",
                  { class: "hint" },
                  "在仪表盘顶部变量栏中编辑键/运算符/值；此处配置数据源。",
                  -1
                  /* CACHED */
                )),
                createElementVNode("label", null, [
                  _cache[23] || (_cache[23] = createTextVNode(
                    " 数据源 ",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GSelect), {
                    value: current.value.datasource?.uid || current.value.datasource?.type || "",
                    options: datasourceOptions.value,
                    "test-id": "adhoc-ds",
                    onChange: _cache[5] || (_cache[5] = ($event) => patch({ datasource: { uid: String($event ?? "") } }))
                  }, null, 8, ["value", "options"])
                ])
              ])) : createCommentVNode("v-if", true),
              current.value.type === "custom" || current.value.type === "query" || current.value.type === "interval" || current.value.type === "constant" ? (openBlock(), createElementBlock("label", _hoisted_9$h, [
                createTextVNode(
                  toDisplayString(current.value.type === "query" ? "查询" : "选项 / 查询") + " ",
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  value: String(current.value.query ?? current.value.definition ?? ""),
                  "test-id": "var-query",
                  "onUpdate:value": _cache[6] || (_cache[6] = ($event) => onQueryOptions(String($event ?? "")))
                }, null, 8, ["value"])
              ])) : createCommentVNode("v-if", true),
              current.value.type === "query" || current.value.type === "custom" || current.value.type === "interval" ? (openBlock(), createElementBlock("div", _hoisted_10$d, [
                createVNode(unref(GButton), {
                  size: "md",
                  "test-id": "var-refresh",
                  loading: refreshing.value,
                  onClick: refreshCurrent
                }, {
                  default: withCtx(() => [
                    createTextVNode(
                      toDisplayString(refreshing.value ? "刷新中…" : "刷新选项"),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["loading"]),
                refreshError.value ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_11$d,
                  toDisplayString(refreshError.value),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createElementVNode(
                  "span",
                  _hoisted_12$c,
                  toDisplayString((current.value.options || []).length) + " 个选项",
                  1
                  /* TEXT */
                )
              ])) : createCommentVNode("v-if", true),
              current.value.options?.length ? (openBlock(), createElementBlock("ul", _hoisted_13$c, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(current.value.options.slice(0, 20), (o) => {
                    return openBlock(), createElementBlock(
                      "li",
                      {
                        key: String(o.value)
                      },
                      toDisplayString(o.text),
                      1
                      /* TEXT */
                    );
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])) : createCommentVNode("v-if", true),
              createElementVNode("label", _hoisted_14$a, [
                createVNode(unref(GCheckbox), {
                  checked: !!current.value.multi,
                  "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => patch({ multi: $event }))
                }, null, 8, ["checked"]),
                _cache[26] || (_cache[26] = createTextVNode(
                  " 多选 ",
                  -1
                  /* CACHED */
                ))
              ]),
              createElementVNode("label", _hoisted_15$9, [
                createVNode(unref(GCheckbox), {
                  checked: !!current.value.includeAll,
                  "onUpdate:checked": _cache[8] || (_cache[8] = ($event) => patch({ includeAll: $event }))
                }, null, 8, ["checked"]),
                _cache[27] || (_cache[27] = createTextVNode(
                  " 包含全部 ",
                  -1
                  /* CACHED */
                ))
              ]),
              current.value.includeAll ? (openBlock(), createElementBlock("label", _hoisted_16$7, [
                _cache[28] || (_cache[28] = createTextVNode(
                  " 自定义全部值（allValue） ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: String(current.value.allValue ?? ""),
                  placeholder: "/.*/",
                  "test-id": "var-all-value",
                  "onUpdate:value": _cache[9] || (_cache[9] = ($event) => patch({ allValue: String($event ?? "") }))
                }, null, 8, ["value"])
              ])) : createCommentVNode("v-if", true),
              createElementVNode("label", _hoisted_17$7, [
                _cache[29] || (_cache[29] = createTextVNode(
                  " 正则过滤（regex） ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: String(current.value.regex ?? ""),
                  placeholder: "/prod|dev/",
                  "test-id": "var-regex",
                  "onUpdate:value": _cache[10] || (_cache[10] = ($event) => patch({ regex: String($event ?? "") }))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", _hoisted_18$7, [
                _cache[30] || (_cache[30] = createTextVNode(
                  " 排序（sort） ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: Number(current.value.sort ?? 0),
                  options: sortOptions,
                  "show-search": false,
                  "test-id": "var-sort",
                  onChange: _cache[11] || (_cache[11] = ($event) => patch({ sort: Number($event ?? 0) }))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", _hoisted_19$7, [
                _cache[31] || (_cache[31] = createTextVNode(
                  " 刷新（refresh） ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: Number(current.value.refresh ?? 0),
                  options: refreshModeOptions,
                  "show-search": false,
                  "test-id": "var-refresh-mode",
                  onChange: _cache[12] || (_cache[12] = ($event) => patch({ refresh: Number($event ?? 0) }))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", _hoisted_20$6, [
                createVNode(unref(GCheckbox), {
                  checked: !!current.value.skipUrlSync,
                  "test-id": "var-skip-url-sync",
                  "onUpdate:checked": _cache[13] || (_cache[13] = ($event) => patch({ skipUrlSync: $event }))
                }, null, 8, ["checked"]),
                _cache[32] || (_cache[32] = createTextVNode(
                  " 不同步到 URL（skipUrlSync） ",
                  -1
                  /* CACHED */
                ))
              ]),
              createElementVNode("label", null, [
                _cache[33] || (_cache[33] = createTextVNode(
                  " 隐藏 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: Number(current.value.hide ?? 0),
                  options: hideOptions,
                  "show-search": false,
                  onChange: _cache[14] || (_cache[14] = ($event) => patch({ hide: Number($event) }))
                }, null, 8, ["value"])
              ]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "destructive",
                "test-id": "var-remove",
                onClick: removeSelected
              }, {
                default: withCtx(() => [..._cache[34] || (_cache[34] = [
                  createTextVNode(
                    " 删除变量 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ])) : createCommentVNode("v-if", true)
          ])
        ],
        2
        /* CLASS */
      );
    };
  }
});
const VariablesSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["__scopeId", "data-v-e9626567"]]);
const _hoisted_1$$ = {
  class: "settings-pane",
  "data-testid": "settings-general"
};
const _hoisted_2$P = { class: "field" };
const _hoisted_3$H = { class: "field" };
const _hoisted_4$w = { class: "field" };
const _hoisted_5$r = { class: "field row" };
const _hoisted_6$o = { class: "field row" };
const _hoisted_7$m = { class: "field" };
const _hoisted_8$h = { class: "field" };
const _hoisted_9$g = { class: "field" };
const _hoisted_10$c = { class: "field" };
const _hoisted_11$c = { class: "field" };
const _hoisted_12$b = { class: "field row" };
const _hoisted_13$b = { class: "field" };
const _hoisted_14$9 = { class: "field" };
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
  __name: "GeneralSettings",
  props: {
    model: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function set(key, value) {
      emit("change", { [key]: value });
    }
    const tagsText = computed(
      () => Array.isArray(props.model.tags) ? props.model.tags.join(", ") : ""
    );
    const graphTooltipOptions = [
      { label: "默认", value: 0 },
      { label: "共享十字线", value: 1 },
      { label: "共享提示", value: 2 }
    ];
    const weekStartOptions = [
      { label: "默认", value: "" },
      { label: "周一", value: "monday" },
      { label: "周六", value: "saturday" },
      { label: "周日", value: "sunday" }
    ];
    const fiscalMonthOptions = [
      { label: "1月", value: "0" },
      { label: "2月", value: "1" },
      { label: "3月", value: "2" },
      { label: "4月", value: "3" },
      { label: "5月", value: "4" },
      { label: "6月", value: "5" },
      { label: "7月", value: "6" },
      { label: "8月", value: "7" },
      { label: "9月", value: "8" },
      { label: "10月", value: "9" },
      { label: "11月", value: "10" },
      { label: "12月", value: "11" }
    ];
    const timepickerModel = computed(() => {
      const tp = props.model?.timepicker;
      return tp && typeof tp === "object" ? tp : {};
    });
    const quickRangesJson = computed(() => {
      const raw = timepickerModel.value?.quick_ranges;
      if (!Array.isArray(raw) || !raw.length) return "";
      try {
        return JSON.stringify(raw);
      } catch {
        return "";
      }
    });
    function onQuickRangesJson(raw) {
      const s = String(raw ?? "").trim();
      if (!s) {
        setTimepicker({ quick_ranges: [] });
        return;
      }
      try {
        const parsed = JSON.parse(s);
        if (Array.isArray(parsed)) setTimepicker({ quick_ranges: parsed });
      } catch {
      }
    }
    function setTimepicker(patch) {
      const cur = props.model?.timepicker && typeof props.model.timepicker === "object" ? { ...props.model.timepicker } : {};
      set("timepicker", { ...cur, ...patch });
    }
    const timezoneOptions = [
      { label: "浏览器时区", value: "browser" },
      { label: "UTC", value: "utc" }
    ];
    const refreshOptions = [
      { label: "关闭", value: "" },
      ...defaultRefreshIntervals.map((v) => ({ label: v, value: v }))
    ];
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$$, [
        createElementVNode("label", _hoisted_2$P, [
          _cache[13] || (_cache[13] = createElementVNode(
            "span",
            null,
            "标题",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.model.title ?? ""),
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => set("title", $event))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_3$H, [
          _cache[14] || (_cache[14] = createElementVNode(
            "span",
            null,
            "描述",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(__props.model.description ?? ""),
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => set("description", $event))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_4$w, [
          _cache[15] || (_cache[15] = createElementVNode(
            "span",
            null,
            "标签（逗号分隔）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: tagsText.value,
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => set(
              "tags",
              String($event ?? "").split(",").map((s) => s.trim()).filter(Boolean)
            ))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_5$r, [
          createVNode(unref(GCheckbox), {
            checked: __props.model.editable !== false,
            "test-id": "settings-editable",
            "onUpdate:checked": _cache[3] || (_cache[3] = ($event) => set("editable", $event))
          }, {
            default: withCtx(() => [..._cache[16] || (_cache[16] = [
              createTextVNode(
                " 可编辑 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }, 8, ["checked"])
        ]),
        createElementVNode("div", _hoisted_6$o, [
          createVNode(unref(GCheckbox), {
            checked: __props.model.liveNow === true,
            "test-id": "settings-live-now",
            "onUpdate:checked": _cache[4] || (_cache[4] = ($event) => set("liveNow", $event === true))
          }, {
            default: withCtx(() => [..._cache[17] || (_cache[17] = [
              createTextVNode(
                " 实时「现在」（相对时间连续刷新） ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }, 8, ["checked"])
        ]),
        createElementVNode("label", _hoisted_7$m, [
          _cache[18] || (_cache[18] = createElementVNode(
            "span",
            null,
            "Tooltip 共享",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: Number(__props.model.graphTooltip ?? 0),
            options: graphTooltipOptions,
            "show-search": false,
            onChange: _cache[5] || (_cache[5] = ($event) => set("graphTooltip", Number($event ?? 0)))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_8$h, [
          _cache[19] || (_cache[19] = createElementVNode(
            "span",
            null,
            "时区",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.model.timezone ?? "browser"),
            options: timezoneOptions,
            "show-search": false,
            onChange: _cache[6] || (_cache[6] = ($event) => set("timezone", String($event ?? "browser")))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_9$g, [
          _cache[20] || (_cache[20] = createElementVNode(
            "span",
            null,
            "周起始",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.model.weekStart ?? ""),
            options: weekStartOptions,
            "show-search": false,
            onChange: _cache[7] || (_cache[7] = ($event) => set("weekStart", String($event ?? "")))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_10$c, [
          _cache[21] || (_cache[21] = createElementVNode(
            "span",
            null,
            "财政年起始月",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.model.fiscalYearStartMonth ?? 0),
            options: fiscalMonthOptions,
            "show-search": false,
            "data-testid": "settings-fiscal-year-start",
            onChange: _cache[8] || (_cache[8] = ($event) => set("fiscalYearStartMonth", Number($event ?? 0)))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_11$c, [
          _cache[22] || (_cache[22] = createElementVNode(
            "span",
            null,
            "快捷范围（timepicker.quick_ranges，JSON）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: quickRangesJson.value,
            placeholder: '[{"display":"近7分钟","from":"now-7m","to":"now"}]',
            "test-id": "settings-quick-ranges",
            "onUpdate:value": _cache[9] || (_cache[9] = ($event) => onQuickRangesJson($event))
          }, null, 8, ["value"])
        ]),
        createElementVNode("div", _hoisted_12$b, [
          createVNode(unref(GCheckbox), {
            checked: timepickerModel.value.hidden === true,
            "test-id": "settings-timepicker-hidden",
            "onUpdate:checked": _cache[10] || (_cache[10] = ($event) => setTimepicker({ hidden: $event === true }))
          }, {
            default: withCtx(() => [..._cache[23] || (_cache[23] = [
              createTextVNode(
                " 隐藏时间选择器 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          }, 8, ["checked"])
        ]),
        createElementVNode("label", _hoisted_13$b, [
          _cache[24] || (_cache[24] = createElementVNode(
            "span",
            null,
            "now 延迟（timepicker.nowDelay）",
            -1
            /* CACHED */
          )),
          createVNode(unref(GInput), {
            value: String(timepickerModel.value.nowDelay ?? ""),
            placeholder: "例如 1m / 30s",
            "test-id": "settings-now-delay",
            "onUpdate:value": _cache[11] || (_cache[11] = ($event) => setTimepicker({ nowDelay: String($event ?? "") }))
          }, null, 8, ["value"])
        ]),
        createElementVNode("label", _hoisted_14$9, [
          _cache[25] || (_cache[25] = createElementVNode(
            "span",
            null,
            "自动刷新",
            -1
            /* CACHED */
          )),
          createVNode(unref(GSelect), {
            value: String(__props.model.refresh ?? ""),
            options: refreshOptions,
            "show-search": false,
            onChange: _cache[12] || (_cache[12] = ($event) => set("refresh", String($event ?? "")))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
});
const GeneralSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["__scopeId", "data-v-0c704a1b"]]);
const _hoisted_1$_ = {
  class: "settings-pane",
  "data-testid": "settings-annotations"
};
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
  __name: "AnnotationsSettings",
  props: {
    list: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const rows = computed(() => props.list ?? []);
    function update(i, patch) {
      const next = rows.value.map((r, idx) => idx === i ? { ...r, ...patch } : r);
      emit("change", next);
    }
    function remove(i) {
      emit(
        "change",
        rows.value.filter((_, idx) => idx !== i)
      );
    }
    function add() {
      emit("change", [
        ...rows.value,
        {
          name: `annotation-${rows.value.length + 1}`,
          enable: true,
          hide: false,
          iconColor: "super-light-blue",
          datasource: { type: "grafana", uid: "-- Grafana --" }
        }
      ]);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$_, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (a, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "anno-row"
            }, [
              createVNode(unref(GInput), {
                value: String(a.name ?? ""),
                placeholder: "名称",
                "onUpdate:value": ($event) => update(i, { name: $event })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GInput), {
                value: String(a.iconColor ?? ""),
                placeholder: "颜色",
                "onUpdate:value": ($event) => update(i, { iconColor: $event })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GCheckbox), {
                checked: a.hide === true,
                "onUpdate:checked": ($event) => update(i, { hide: $event })
              }, {
                default: withCtx(() => [..._cache[0] || (_cache[0] = [
                  createTextVNode(
                    " 隐藏 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["checked", "onUpdate:checked"]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "toolbar",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    "删除",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(unref(GButton), {
          size: "md",
          variant: "primary",
          onClick: add
        }, {
          default: withCtx(() => [..._cache[2] || (_cache[2] = [
            createTextVNode(
              "添加注释",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const AnnotationsSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["__scopeId", "data-v-0783ea89"]]);
const _hoisted_1$Z = {
  class: "settings-pane",
  "data-testid": "settings-links"
};
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
  __name: "LinksSettings",
  props: {
    links: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const rows = computed(() => props.links ?? []);
    function update(i, patch) {
      emit(
        "change",
        rows.value.map((r, idx) => idx === i ? { ...r, ...patch } : r)
      );
    }
    function remove(i) {
      emit(
        "change",
        rows.value.filter((_, idx) => idx !== i)
      );
    }
    function add() {
      emit("change", [
        ...rows.value,
        {
          title: "链接",
          url: "https://",
          tooltip: "",
          icon: "external link",
          targetBlank: true,
          type: "link"
        }
      ]);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$Z, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(rows.value, (l, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "link-row"
            }, [
              createVNode(unref(GInput), {
                value: String(l.title ?? ""),
                placeholder: "标题",
                "onUpdate:value": ($event) => update(i, { title: $event })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GInput), {
                value: String(l.url ?? ""),
                placeholder: "URL",
                "onUpdate:value": ($event) => update(i, { url: $event })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GInput), {
                value: String(l.tooltip ?? ""),
                placeholder: "提示",
                "onUpdate:value": ($event) => update(i, { tooltip: $event })
              }, null, 8, ["value", "onUpdate:value"]),
              createVNode(unref(GCheckbox), {
                checked: l.targetBlank !== false,
                "onUpdate:checked": ($event) => update(i, { targetBlank: $event })
              }, {
                default: withCtx(() => [..._cache[0] || (_cache[0] = [
                  createTextVNode(
                    " 新窗口 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["checked", "onUpdate:checked"]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "toolbar",
                onClick: ($event) => remove(i)
              }, {
                default: withCtx(() => [..._cache[1] || (_cache[1] = [
                  createTextVNode(
                    "删除",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createVNode(unref(GButton), {
          size: "md",
          variant: "primary",
          onClick: add
        }, {
          default: withCtx(() => [..._cache[2] || (_cache[2] = [
            createTextVNode(
              "添加链接",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const LinksSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["__scopeId", "data-v-488c103c"]]);
const _hoisted_1$Y = {
  class: "settings-pane",
  "data-testid": "settings-json-model"
};
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
  __name: "JsonModelSettings",
  props: {
    json: {}
  },
  emits: ["apply"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const draft = ref(props.json);
    watch(
      () => props.json,
      (v) => {
        draft.value = v;
      }
    );
    function apply() {
      try {
        const raw = JSON.parse(draft.value);
        emit("apply", raw);
      } catch (error) {
        alert(error instanceof Error ? error.message : String(error));
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$Y, [
        withDirectives(createElementVNode(
          "textarea",
          {
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => draft.value = $event),
            class: "json-editor",
            "data-testid": "settings-json-textarea",
            spellcheck: "false"
          },
          null,
          512
          /* NEED_PATCH */
        ), [
          [vModelText, draft.value]
        ]),
        createVNode(unref(GButton), {
          size: "md",
          variant: "primary",
          "test-id": "settings-json-apply",
          onClick: apply
        }, {
          default: withCtx(() => [..._cache[1] || (_cache[1] = [
            createTextVNode(
              " 应用 JSON ",
              -1
              /* CACHED */
            )
          ])]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const JsonModelSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__scopeId", "data-v-70181354"]]);
const _hoisted_1$X = { class: "ds-modal" };
const _hoisted_2$O = { class: "ds-modal__toolbar" };
const _hoisted_3$G = {
  class: "ds-table",
  "data-testid": "ds-modal-table"
};
const _hoisted_4$v = { key: 0 };
const _hoisted_5$q = { class: "mono" };
const _hoisted_6$n = { class: "mono" };
const _hoisted_7$l = ["data-testid", "onClick"];
const _hoisted_8$g = { class: "actions" };
const _hoisted_9$f = {
  key: 0,
  class: "ds-form",
  "data-testid": "ds-modal-form"
};
const _hoisted_10$b = { class: "field" };
const _hoisted_11$b = { class: "field" };
const _hoisted_12$a = { class: "field" };
const _hoisted_13$a = { class: "field" };
const _hoisted_14$8 = { class: "field row" };
const _hoisted_15$8 = ["checked"];
const _hoisted_16$6 = {
  key: 0,
  class: "field"
};
const _hoisted_17$6 = { class: "field row" };
const _hoisted_18$6 = ["checked"];
const _hoisted_19$6 = {
  key: 1,
  class: "error",
  "data-testid": "ds-form-error"
};
const _hoisted_20$5 = { class: "form-actions" };
const _sfc_main$$ = /* @__PURE__ */ defineComponent({
  __name: "DatasourceConfigModal",
  props: {
    open: { type: Boolean },
    list: {}
  },
  emits: ["update:open", "save"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const draft = ref([]);
    const editingUid = ref(null);
    const form = ref(newEmbeddedDatasourceDraft());
    const formError = ref("");
    const typeOptions = computed(() => {
      const plugins = listDataSourcePlugins();
      const opts = plugins.map((p) => ({
        value: p.meta.id,
        label: `${p.meta.name || dsTypeLabel(p.meta.id)} (${p.meta.id})`
      }));
      if (!opts.length) {
        return [
          { value: "grafana-testdata-datasource", label: "TestData" },
          { value: "prometheus", label: "Prometheus" },
          { value: "signoz", label: "SigNoz" },
          {
            value: "alexanderzobnin-zabbix-datasource",
            label: "Zabbix"
          }
        ];
      }
      return opts;
    });
    const isEditing = computed(() => editingUid.value != null);
    watch(
      () => props.open,
      (open) => {
        if (!open) return;
        draft.value = sanitizeEmbeddedDatasources(props.list).map((d) => ({
          ...d
        }));
        editingUid.value = null;
        formError.value = "";
      }
    );
    function close() {
      emit("update:open", false);
    }
    function startAdd() {
      editingUid.value = "__new__";
      form.value = newEmbeddedDatasourceDraft(
        String(typeOptions.value[0]?.value ?? "grafana-testdata-datasource")
      );
      formError.value = "";
    }
    function startEdit(ds2) {
      editingUid.value = ds2.uid;
      form.value = { ...ds2, jsonData: { ...ds2.jsonData ?? {} } };
      formError.value = "";
    }
    function cancelForm() {
      editingUid.value = null;
      formError.value = "";
    }
    function removeAt(uid) {
      draft.value = draft.value.filter((d) => d.uid !== uid);
      if (editingUid.value === uid) cancelForm();
    }
    function setDefault(uid) {
      draft.value = draft.value.map((d) => ({
        ...d,
        isDefault: d.uid === uid
      }));
    }
    function saveForm() {
      const next = sanitizeEmbeddedDatasource(form.value);
      if (!next.uid) {
        formError.value = "UID 不能为空";
        return;
      }
      if (!next.type) {
        formError.value = "请选择类型";
        return;
      }
      if (!next.name) {
        formError.value = "名称不能为空";
        return;
      }
      const clash = draft.value.find((d) => d.uid === next.uid && d.uid !== editingUid.value);
      if (clash || editingUid.value === "__new__" && draft.value.some((d) => d.uid === next.uid)) {
        formError.value = `UID 已存在: ${next.uid}`;
        return;
      }
      if (editingUid.value === "__new__") {
        if (next.isDefault) {
          draft.value = draft.value.map((d) => ({ ...d, isDefault: false }));
        }
        draft.value = [...draft.value, next];
      } else {
        draft.value = draft.value.map((d) => {
          if (d.uid !== editingUid.value) {
            return next.isDefault ? { ...d, isDefault: false } : d;
          }
          return next;
        });
      }
      editingUid.value = null;
      formError.value = "";
    }
    function onOk() {
      if (editingUid.value != null) {
        saveForm();
        if (editingUid.value != null) return;
      }
      emit("save", sanitizeEmbeddedDatasources(draft.value));
      emit("update:open", false);
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(GModal), {
        open: __props.open,
        title: "配置数据源",
        width: 720,
        "ok-text": "应用",
        "cancel-text": "取消",
        "test-id": "datasource-config-modal",
        "onUpdate:open": _cache[7] || (_cache[7] = ($event) => emit("update:open", $event)),
        onOk,
        onCancel: close
      }, {
        default: withCtx(() => [
          createElementVNode("div", _hoisted_1$X, [
            createElementVNode("div", _hoisted_2$O, [
              _cache[9] || (_cache[9] = createElementVNode(
                "p",
                { class: "hint" },
                "数据源随仪表盘配置一起保存（不含密钥）。密钥请走运行时凭据 / 环境变量。",
                -1
                /* CACHED */
              )),
              createVNode(unref(GButton), {
                size: "md",
                variant: "primary",
                "test-id": "ds-modal-add",
                disabled: editingUid.value != null,
                onClick: startAdd
              }, {
                default: withCtx(() => [..._cache[8] || (_cache[8] = [
                  createTextVNode(
                    " 新增 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["disabled"])
            ]),
            createElementVNode("table", _hoisted_3$G, [
              _cache[13] || (_cache[13] = createElementVNode(
                "thead",
                null,
                [
                  createElementVNode("tr", null, [
                    createElementVNode("th", null, "名称"),
                    createElementVNode("th", null, "UID"),
                    createElementVNode("th", null, "类型"),
                    createElementVNode("th", null, "URL"),
                    createElementVNode("th", null, "默认"),
                    createElementVNode("th")
                  ])
                ],
                -1
                /* CACHED */
              )),
              createElementVNode("tbody", null, [
                !draft.value.length ? (openBlock(), createElementBlock("tr", _hoisted_4$v, [..._cache[10] || (_cache[10] = [
                  createElementVNode(
                    "td",
                    {
                      colspan: "6",
                      class: "empty"
                    },
                    "暂无数据源，点击「新增」添加",
                    -1
                    /* CACHED */
                  )
                ])])) : createCommentVNode("v-if", true),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(draft.value, (ds2) => {
                    return openBlock(), createElementBlock("tr", {
                      key: ds2.uid,
                      "data-testid": "ds-modal-row"
                    }, [
                      createElementVNode(
                        "td",
                        null,
                        toDisplayString(ds2.name),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "td",
                        _hoisted_5$q,
                        toDisplayString(ds2.uid),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "td",
                        null,
                        toDisplayString(unref(dsTypeLabel)(ds2.type) || ds2.type),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "td",
                        _hoisted_6$n,
                        toDisplayString(ds2.url || "—"),
                        1
                        /* TEXT */
                      ),
                      createElementVNode("td", null, [
                        createElementVNode("button", {
                          type: "button",
                          class: normalizeClass(["linkish", { on: ds2.isDefault }]),
                          "data-testid": `ds-default-${ds2.uid}`,
                          onClick: ($event) => setDefault(ds2.uid)
                        }, toDisplayString(ds2.isDefault ? "默认" : "设为默认"), 11, _hoisted_7$l)
                      ]),
                      createElementVNode("td", _hoisted_8$g, [
                        createVNode(unref(GButton), {
                          size: "md",
                          variant: "toolbar",
                          "test-id": "ds-modal-edit",
                          onClick: ($event) => startEdit(ds2)
                        }, {
                          default: withCtx(() => [..._cache[11] || (_cache[11] = [
                            createTextVNode(
                              " 编辑 ",
                              -1
                              /* CACHED */
                            )
                          ])]),
                          _: 1
                          /* STABLE */
                        }, 8, ["onClick"]),
                        createVNode(unref(GButton), {
                          size: "md",
                          variant: "destructive",
                          "test-id": "ds-modal-delete",
                          onClick: ($event) => removeAt(ds2.uid)
                        }, {
                          default: withCtx(() => [..._cache[12] || (_cache[12] = [
                            createTextVNode(
                              " 删除 ",
                              -1
                              /* CACHED */
                            )
                          ])]),
                          _: 1
                          /* STABLE */
                        }, 8, ["onClick"])
                      ])
                    ]);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])
            ]),
            isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_9$f, [
              createElementVNode(
                "h4",
                null,
                toDisplayString(editingUid.value === "__new__" ? "新增数据源" : "编辑数据源"),
                1
                /* TEXT */
              ),
              createElementVNode("label", _hoisted_10$b, [
                _cache[14] || (_cache[14] = createElementVNode(
                  "span",
                  null,
                  "名称",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: form.value.name,
                  "test-id": "ds-form-name",
                  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => form.value.name = String($event ?? ""))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", _hoisted_11$b, [
                _cache[15] || (_cache[15] = createElementVNode(
                  "span",
                  null,
                  "UID",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: form.value.uid,
                  disabled: editingUid.value !== "__new__",
                  "test-id": "ds-form-uid",
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => form.value.uid = String($event ?? ""))
                }, null, 8, ["value", "disabled"])
              ]),
              createElementVNode("label", _hoisted_12$a, [
                _cache[16] || (_cache[16] = createElementVNode(
                  "span",
                  null,
                  "类型",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GSelect), {
                  value: form.value.type,
                  options: typeOptions.value,
                  "show-search": true,
                  "test-id": "ds-form-type",
                  onChange: _cache[2] || (_cache[2] = ($event) => form.value.type = String($event ?? form.value.type))
                }, null, 8, ["value", "options"])
              ]),
              createElementVNode("label", _hoisted_13$a, [
                _cache[17] || (_cache[17] = createElementVNode(
                  "span",
                  null,
                  "URL",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: form.value.url,
                  "test-id": "ds-form-url",
                  placeholder: "https://… 或 /proxy/path",
                  "onUpdate:value": _cache[3] || (_cache[3] = ($event) => form.value.url = String($event ?? ""))
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", _hoisted_14$8, [
                createElementVNode("input", {
                  type: "checkbox",
                  checked: !!form.value.basicAuth,
                  "data-testid": "ds-form-basic-auth",
                  onChange: _cache[4] || (_cache[4] = ($event) => form.value.basicAuth = $event.target.checked)
                }, null, 40, _hoisted_15$8),
                _cache[18] || (_cache[18] = createElementVNode(
                  "span",
                  null,
                  "Basic Auth",
                  -1
                  /* CACHED */
                ))
              ]),
              form.value.basicAuth ? (openBlock(), createElementBlock("label", _hoisted_16$6, [
                _cache[19] || (_cache[19] = createElementVNode(
                  "span",
                  null,
                  "用户名",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: form.value.basicAuthUser || "",
                  "test-id": "ds-form-basic-user",
                  "onUpdate:value": _cache[5] || (_cache[5] = ($event) => form.value.basicAuthUser = String($event ?? ""))
                }, null, 8, ["value"])
              ])) : createCommentVNode("v-if", true),
              createElementVNode("label", _hoisted_17$6, [
                createElementVNode("input", {
                  type: "checkbox",
                  checked: !!form.value.isDefault,
                  "data-testid": "ds-form-default",
                  onChange: _cache[6] || (_cache[6] = ($event) => form.value.isDefault = $event.target.checked)
                }, null, 40, _hoisted_18$6),
                _cache[20] || (_cache[20] = createElementVNode(
                  "span",
                  null,
                  "设为默认数据源",
                  -1
                  /* CACHED */
                ))
              ]),
              formError.value ? (openBlock(), createElementBlock(
                "p",
                _hoisted_19$6,
                toDisplayString(formError.value),
                1
                /* TEXT */
              )) : createCommentVNode("v-if", true),
              createElementVNode("div", _hoisted_20$5, [
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "toolbar",
                  onClick: cancelForm
                }, {
                  default: withCtx(() => [..._cache[21] || (_cache[21] = [
                    createTextVNode(
                      " 取消 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }),
                createVNode(unref(GButton), {
                  size: "md",
                  variant: "primary",
                  "test-id": "ds-form-save",
                  onClick: saveForm
                }, {
                  default: withCtx(() => [..._cache[22] || (_cache[22] = [
                    createTextVNode(
                      " 保存到列表 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ])
            ])) : createCommentVNode("v-if", true)
          ])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["open"]);
    };
  }
});
const DatasourceConfigModal = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__scopeId", "data-v-2ccc6a7b"]]);
const _hoisted_1$W = {
  class: "settings-pane",
  "data-testid": "settings-datasources"
};
const _hoisted_2$N = { class: "head" };
const _hoisted_3$F = {
  key: 0,
  class: "list",
  "data-testid": "settings-ds-list"
};
const _hoisted_4$u = { class: "main" };
const _hoisted_5$p = {
  key: 0,
  class: "badge"
};
const _hoisted_6$m = { class: "meta" };
const _hoisted_7$k = { class: "mono" };
const _hoisted_8$f = { class: "mono" };
const _hoisted_9$e = {
  key: 1,
  class: "empty",
  "data-testid": "settings-ds-empty"
};
const _sfc_main$_ = /* @__PURE__ */ defineComponent({
  __name: "DatasourcesSettings",
  props: {
    list: {}
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const modalOpen = ref(false);
    function onSave(list) {
      emit("change", list);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$W, [
        createElementVNode("div", _hoisted_2$N, [
          _cache[3] || (_cache[3] = createElementVNode(
            "div",
            null,
            [
              createElementVNode("h3", null, "数据源"),
              createElementVNode("p", { class: "sub" }, "与仪表盘配置一并保存。查询编辑器从此列表选择实例。")
            ],
            -1
            /* CACHED */
          )),
          createVNode(unref(GButton), {
            variant: "primary",
            size: "md",
            "test-id": "configure-datasources-btn",
            onClick: _cache[0] || (_cache[0] = ($event) => modalOpen.value = true)
          }, {
            default: withCtx(() => [..._cache[2] || (_cache[2] = [
              createTextVNode(
                " 配置数据源 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ]),
        __props.list.length ? (openBlock(), createElementBlock("ul", _hoisted_3$F, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(__props.list, (ds2) => {
              return openBlock(), createElementBlock("li", {
                key: ds2.uid,
                "data-testid": "settings-ds-item"
              }, [
                createElementVNode("div", _hoisted_4$u, [
                  createElementVNode(
                    "strong",
                    null,
                    toDisplayString(ds2.name),
                    1
                    /* TEXT */
                  ),
                  ds2.isDefault ? (openBlock(), createElementBlock("span", _hoisted_5$p, "默认")) : createCommentVNode("v-if", true)
                ]),
                createElementVNode("div", _hoisted_6$m, [
                  createElementVNode(
                    "span",
                    null,
                    toDisplayString(unref(dsTypeLabel)(ds2.type) || ds2.type),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_7$k,
                    toDisplayString(ds2.uid),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_8$f,
                    toDisplayString(ds2.url || "无 URL"),
                    1
                    /* TEXT */
                  )
                ])
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : (openBlock(), createElementBlock("p", _hoisted_9$e, " 尚未绑定数据源。点击「配置数据源」新增。 ")),
        createVNode(DatasourceConfigModal, {
          open: modalOpen.value,
          "onUpdate:open": _cache[1] || (_cache[1] = ($event) => modalOpen.value = $event),
          list: __props.list,
          onSave
        }, null, 8, ["open", "list"])
      ]);
    };
  }
});
const DatasourcesSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__scopeId", "data-v-f1499b1c"]]);
const _hoisted_1$V = {
  class: "dashboard-settings",
  "data-testid": "dashboard-settings"
};
const _hoisted_2$M = { class: "dashboard-settings__header" };
const _hoisted_3$E = { class: "dashboard-settings__title" };
const _hoisted_4$t = { class: "dashboard-settings__body" };
const _hoisted_5$o = { class: "dashboard-settings__nav" };
const _hoisted_6$l = { class: "dashboard-settings__content" };
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
  __name: "DashboardSettings",
  props: {
    document: {},
    json: {}
  },
  emits: ["close", "patch", "variables", "annotations", "links", "applyJson", "datasources"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const tab = ref(
      "general"
    );
    const generalModel = computed(() => props.document ?? {});
    const annotationList = computed(() => props.document?.annotations?.list ?? []);
    const linkList = computed(() => props.document?.links ?? []);
    const variableList = computed(() => props.document?.templating?.list ?? []);
    const datasourceList = computed(() => readEmbeddedDatasources(props.document));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$V, [
        createElementVNode("header", _hoisted_2$M, [
          createElementVNode("div", _hoisted_3$E, [
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": "settings-back",
              title: "返回仪表盘",
              "aria-label": "返回仪表盘",
              onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
            }, {
              default: withCtx(() => [..._cache[15] || (_cache[15] = [
                createTextVNode(
                  " ← ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            }),
            _cache[16] || (_cache[16] = createElementVNode(
              "h2",
              null,
              "设置",
              -1
              /* CACHED */
            ))
          ]),
          createVNode(unref(GButton), {
            size: "md",
            variant: "toolbar",
            "test-id": "settings-close",
            onClick: _cache[1] || (_cache[1] = ($event) => emit("close"))
          }, {
            default: withCtx(() => [..._cache[17] || (_cache[17] = [
              createTextVNode(
                " 关闭 ",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ]),
        createElementVNode("div", _hoisted_4$t, [
          createElementVNode("nav", _hoisted_5$o, [
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ active: tab.value === "general" }),
                "data-testid": "settings-tab-general",
                onClick: _cache[2] || (_cache[2] = ($event) => tab.value = "general")
              },
              " 常规 ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ active: tab.value === "annotations" }),
                "data-testid": "settings-tab-annotations",
                onClick: _cache[3] || (_cache[3] = ($event) => tab.value = "annotations")
              },
              " 注释 ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ active: tab.value === "variables" }),
                "data-testid": "settings-tab-variables",
                onClick: _cache[4] || (_cache[4] = ($event) => tab.value = "variables")
              },
              " 变量 ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ active: tab.value === "links" }),
                "data-testid": "settings-tab-links",
                onClick: _cache[5] || (_cache[5] = ($event) => tab.value = "links")
              },
              " 链接 ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ active: tab.value === "datasources" }),
                "data-testid": "settings-tab-datasources",
                onClick: _cache[6] || (_cache[6] = ($event) => tab.value = "datasources")
              },
              " 数据源 ",
              2
              /* CLASS */
            ),
            createElementVNode(
              "button",
              {
                type: "button",
                class: normalizeClass({ active: tab.value === "json" }),
                "data-testid": "settings-tab-json",
                onClick: _cache[7] || (_cache[7] = ($event) => tab.value = "json")
              },
              " JSON 模型 ",
              2
              /* CLASS */
            )
          ]),
          createElementVNode("div", _hoisted_6$l, [
            tab.value === "general" ? (openBlock(), createBlock(GeneralSettings, {
              key: 0,
              model: generalModel.value,
              onChange: _cache[8] || (_cache[8] = ($event) => emit("patch", $event))
            }, null, 8, ["model"])) : tab.value === "annotations" ? (openBlock(), createBlock(AnnotationsSettings, {
              key: 1,
              list: annotationList.value,
              onChange: _cache[9] || (_cache[9] = ($event) => emit("annotations", $event))
            }, null, 8, ["list"])) : tab.value === "variables" ? (openBlock(), createBlock(VariablesSettings, {
              key: 2,
              embedded: "",
              variables: variableList.value,
              onClose: _cache[10] || (_cache[10] = ($event) => tab.value = "general"),
              onChange: _cache[11] || (_cache[11] = ($event) => emit("variables", $event))
            }, null, 8, ["variables"])) : tab.value === "links" ? (openBlock(), createBlock(LinksSettings, {
              key: 3,
              links: linkList.value,
              onChange: _cache[12] || (_cache[12] = ($event) => emit("links", $event))
            }, null, 8, ["links"])) : tab.value === "datasources" ? (openBlock(), createBlock(DatasourcesSettings, {
              key: 4,
              list: datasourceList.value,
              onChange: _cache[13] || (_cache[13] = ($event) => emit("datasources", $event))
            }, null, 8, ["list"])) : (openBlock(), createBlock(JsonModelSettings, {
              key: 5,
              json: __props.json,
              onApply: _cache[14] || (_cache[14] = ($event) => emit("applyJson", $event))
            }, null, 8, ["json"]))
          ])
        ])
      ]);
    };
  }
});
const DashboardSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__scopeId", "data-v-62f9f4b9"]]);
const _hoisted_1$U = {
  class: "import-modal",
  "data-testid": "dashboard-import"
};
const _hoisted_2$L = {
  class: "steps",
  "data-testid": "import-steps"
};
const _hoisted_3$D = ["disabled"];
const _hoisted_4$s = ["disabled"];
const _hoisted_5$n = ["disabled"];
const _hoisted_6$k = { class: "upload-toolbar" };
const _hoisted_7$j = { class: "file-upload" };
const _hoisted_8$e = ["title"];
const _hoisted_9$d = {
  key: 1,
  class: "file-hint"
};
const _hoisted_10$a = {
  class: "dropzone",
  "data-testid": "import-dropzone"
};
const _hoisted_11$a = { class: "workspace-actions" };
const _hoisted_12$9 = {
  key: 0,
  class: "meta",
  "data-testid": "import-parse-pos"
};
const _hoisted_13$9 = {
  key: 1,
  class: "section",
  "data-testid": "import-options"
};
const _hoisted_14$7 = { class: "row" };
const _hoisted_15$7 = { class: "meta" };
const _hoisted_16$5 = {
  key: 2,
  class: "section",
  "data-testid": "import-datasources"
};
const _hoisted_17$5 = {
  key: 0,
  class: "meta"
};
const _hoisted_18$5 = {
  key: 3,
  class: "section",
  "data-testid": "import-preview"
};
const _hoisted_19$5 = {
  key: 0,
  class: "err",
  "data-testid": "import-unresolved"
};
const _hoisted_20$4 = {
  key: 4,
  class: "err",
  "data-testid": "import-error"
};
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
  __name: "DashboardImportModal",
  props: {
    open: { type: Boolean }
  },
  emits: ["update:open", "imported"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const state2 = ref(createImportWizardState());
    const error = computed(() => state2.value.error);
    const parsing = ref(false);
    const fileName = ref("");
    const dsOptions = ref([]);
    watch(
      () => props.open,
      async (open) => {
        if (!open) return;
        state2.value = createImportWizardState();
        fileName.value = "";
        parsing.value = false;
        try {
          const list = await listDataSources();
          dsOptions.value = list.map((d) => ({
            label: `${d.name} (${d.uid})`,
            value: d.uid,
            type: d.type
          }));
          const typeByUid = { ...state2.value.typeByUid };
          for (const d of list) typeByUid[d.uid] = d.type;
          state2.value = { ...state2.value, typeByUid };
        } catch {
          dsOptions.value = [];
        }
      },
      { immediate: true }
    );
    function close() {
      emit("update:open", false);
    }
    async function onText() {
      parsing.value = true;
      try {
        state2.value = await parseWizardPayloadAsync(state2.value, state2.value.rawText);
      } finally {
        parsing.value = false;
      }
    }
    function clearText() {
      fileName.value = "";
      state2.value = {
        ...state2.value,
        rawText: "",
        error: void 0,
        parseLine: void 0,
        parseColumn: void 0
      };
    }
    function reformatJson() {
      try {
        const v = JSON.parse(state2.value.rawText);
        state2.value = {
          ...state2.value,
          rawText: JSON.stringify(v, null, 2),
          error: void 0
        };
      } catch (error_) {
        state2.value = {
          ...state2.value,
          error: error_ instanceof Error ? error_.message : String(error_)
        };
      }
    }
    function onDrop(ev) {
      ev.preventDefault();
      const file = ev.dataTransfer?.files?.[0];
      if (!file) return;
      fileName.value = file.name || "";
      const reader = new FileReader();
      reader.addEventListener("load", () => {
        state2.value = {
          ...state2.value,
          rawText: String(reader.result ?? ""),
          error: void 0
        };
      });
      reader.readAsText(file);
    }
    function setMapping(name, uid) {
      const opt = dsOptions.value.find((d) => d.value === uid);
      const typeByUid = { ...state2.value.typeByUid };
      if (opt) typeByUid[uid] = opt.type;
      state2.value = {
        ...state2.value,
        typeByUid,
        mappings: {
          ...state2.value.mappings,
          [name]: uid,
          [`\${${name}}`]: uid
        }
      };
    }
    function goPreview() {
      state2.value = refreshImportPreview({
        ...state2.value,
        step: "preview",
        error: void 0
      });
    }
    function go(step) {
      if (step === "preview") {
        goPreview();
        return;
      }
      state2.value = { ...state2.value, step, error: void 0 };
    }
    function onFile(ev) {
      const input = ev.target;
      const file = input.files?.[0];
      if (!file) return;
      fileName.value = file.name || "";
      const reader = new FileReader();
      reader.addEventListener("load", async () => {
        state2.value.rawText = String(reader.result || "");
        parsing.value = true;
        try {
          state2.value = await parseWizardPayloadAsync(state2.value, state2.value.rawText);
        } finally {
          parsing.value = false;
        }
      });
      reader.onerror = () => {
        state2.value = { ...state2.value, error: "读取文件失败" };
      };
      reader.readAsText(file);
    }
    function finish() {
      try {
        state2.value = refreshImportPreview(state2.value);
        const rec = commitImport(state2.value);
        emit("imported", rec);
        close();
      } catch (error_) {
        state2.value = {
          ...state2.value,
          error: error_ instanceof Error ? error_.message : String(error_)
        };
      }
    }
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(GModal), {
        open: __props.open,
        title: "导入仪表盘",
        width: 760,
        "hide-footer": "",
        "test-id": "dashboard-import-modal",
        "onUpdate:open": _cache[10] || (_cache[10] = ($event) => emit("update:open", $event))
      }, {
        default: withCtx(() => [
          createElementVNode("div", _hoisted_1$U, [
            _cache[22] || (_cache[22] = createElementVNode(
              "p",
              { class: "hint" },
              [
                createTextVNode(" 兼容 Grafana 导出 JSON：v1 schema 1–42、"),
                createElementVNode("code", null, "dashboard"),
                createTextVNode(" 包装 / "),
                createElementVNode("code", null, "__inputs"),
                createTextVNode("，以及 "),
                createElementVNode("code", null, "dashboard.grafana.app/v2"),
                createTextVNode(" 资源（elements + layout + kind 变量）。 ")
              ],
              -1
              /* CACHED */
            )),
            createElementVNode("nav", _hoisted_2$L, [
              createElementVNode(
                "button",
                {
                  type: "button",
                  class: normalizeClass({ active: state2.value.step === "upload" }),
                  onClick: _cache[0] || (_cache[0] = ($event) => go("upload"))
                },
                " 1. 上传 ",
                2
                /* CLASS */
              ),
              createElementVNode("button", {
                type: "button",
                class: normalizeClass({ active: state2.value.step === "options" }),
                disabled: !state2.value.envelope,
                onClick: _cache[1] || (_cache[1] = ($event) => go("options"))
              }, " 2. 选项 ", 10, _hoisted_3$D),
              createElementVNode("button", {
                type: "button",
                class: normalizeClass({ active: state2.value.step === "datasources" }),
                disabled: !state2.value.envelope,
                onClick: _cache[2] || (_cache[2] = ($event) => go("datasources"))
              }, " 3. 数据源 ", 10, _hoisted_4$s),
              createElementVNode("button", {
                type: "button",
                class: normalizeClass({ active: state2.value.step === "preview" }),
                disabled: !state2.value.envelope,
                onClick: _cache[3] || (_cache[3] = ($event) => go("preview"))
              }, " 4. 预览 ", 10, _hoisted_5$n)
            ]),
            state2.value.step === "upload" ? (openBlock(), createElementBlock(
              "section",
              {
                key: 0,
                class: "section upload-workspace",
                "data-testid": "import-upload",
                onDragover: _cache[5] || (_cache[5] = withModifiers(() => {
                }, ["prevent"])),
                onDrop
              },
              [
                createElementVNode("div", _hoisted_6$k, [
                  createElementVNode("label", _hoisted_7$j, [
                    createElementVNode(
                      "input",
                      {
                        "data-testid": "import-file",
                        class: "file-upload__input",
                        type: "file",
                        accept: "application/json,.json",
                        onChange: onFile
                      },
                      null,
                      32
                      /* NEED_HYDRATION */
                    ),
                    _cache[11] || (_cache[11] = createElementVNode(
                      "span",
                      {
                        class: "file-upload__btn",
                        "aria-hidden": "true"
                      },
                      "上传 JSON 文件",
                      -1
                      /* CACHED */
                    ))
                  ]),
                  fileName.value ? (openBlock(), createElementBlock("span", {
                    key: 0,
                    class: "file-name",
                    "data-testid": "import-file-name",
                    title: fileName.value
                  }, toDisplayString(fileName.value), 9, _hoisted_8$e)) : (openBlock(), createElementBlock("span", _hoisted_9$d, "或将 .json 拖入下方工作区 / 直接粘贴"))
                ]),
                createElementVNode("div", _hoisted_10$a, [
                  withDirectives(createElementVNode(
                    "textarea",
                    {
                      "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => state2.value.rawText = $event),
                      "data-testid": "import-json",
                      class: "json-workspace",
                      spellcheck: "false",
                      placeholder: "在此粘贴仪表盘 JSON…（输入不会自动解析）"
                    },
                    null,
                    512
                    /* NEED_PATCH */
                  ), [
                    [vModelText, state2.value.rawText]
                  ])
                ]),
                createElementVNode("div", _hoisted_11$a, [
                  createVNode(unref(GButton), {
                    "test-id": "import-parse",
                    size: "md",
                    variant: "primary",
                    disabled: parsing.value,
                    onClick: onText
                  }, {
                    default: withCtx(() => [
                      createTextVNode(
                        toDisplayString(parsing.value ? "解析中…" : "解析 JSON"),
                        1
                        /* TEXT */
                      )
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["disabled"]),
                  createVNode(unref(GButton), {
                    "test-id": "import-reformat",
                    size: "md",
                    variant: "toolbar",
                    onClick: reformatJson
                  }, {
                    default: withCtx(() => [..._cache[12] || (_cache[12] = [
                      createTextVNode(
                        " 重新格式化 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  }),
                  createVNode(unref(GButton), {
                    "test-id": "import-clear",
                    size: "md",
                    variant: "toolbar",
                    onClick: clearText
                  }, {
                    default: withCtx(() => [..._cache[13] || (_cache[13] = [
                      createTextVNode(
                        " 清空 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  })
                ]),
                state2.value.parseLine ? (openBlock(), createElementBlock(
                  "p",
                  _hoisted_12$9,
                  " 解析位置：行 " + toDisplayString(state2.value.parseLine) + "，列 " + toDisplayString(state2.value.parseColumn),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ],
              32
              /* NEED_HYDRATION */
            )) : state2.value.step === "options" ? (openBlock(), createElementBlock("section", _hoisted_13$9, [
              createElementVNode("label", null, [
                _cache[14] || (_cache[14] = createTextVNode(
                  "标题 ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: state2.value.title,
                  "onUpdate:value": _cache[6] || (_cache[6] = ($event) => state2.value.title = $event),
                  "test-id": "import-title"
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", null, [
                _cache[15] || (_cache[15] = createTextVNode(
                  "UID ",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GInput), {
                  value: state2.value.uid,
                  "onUpdate:value": _cache[7] || (_cache[7] = ($event) => state2.value.uid = $event),
                  "test-id": "import-uid"
                }, null, 8, ["value"])
              ]),
              createElementVNode("label", _hoisted_14$7, [
                createVNode(unref(GCheckbox), {
                  checked: state2.value.overwrite,
                  "onUpdate:checked": _cache[8] || (_cache[8] = ($event) => state2.value.overwrite = $event)
                }, null, 8, ["checked"]),
                _cache[16] || (_cache[16] = createTextVNode(
                  " 覆盖同 UID ",
                  -1
                  /* CACHED */
                ))
              ]),
              createElementVNode("p", _hoisted_15$7, [
                createTextVNode(
                  " 来源 " + toDisplayString(state2.value.envelope?.sourceKind) + " · schema → " + toDisplayString(state2.value.envelope?.dashboard.schemaVersion) + " · 迁移 " + toDisplayString(state2.value.envelope?.migrations?.length ?? 0) + " 步 ",
                  1
                  /* TEXT */
                ),
                state2.value.envelope?.sourceKind === "v2" ? (openBlock(), createElementBlock(
                  Fragment,
                  { key: 0 },
                  [
                    createTextVNode(" · v2→v1 兼容转换已应用")
                  ],
                  64
                  /* STABLE_FRAGMENT */
                )) : createCommentVNode("v-if", true)
              ]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "primary",
                onClick: _cache[9] || (_cache[9] = ($event) => go("datasources"))
              }, {
                default: withCtx(() => [..._cache[17] || (_cache[17] = [
                  createTextVNode(
                    " 下一步 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ])) : state2.value.step === "datasources" ? (openBlock(), createElementBlock("section", _hoisted_16$5, [
              !state2.value.inputs.length ? (openBlock(), createElementBlock("p", _hoisted_17$5, "未检测到 __inputs，可直接预览。")) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(state2.value.inputs, (inp) => {
                  return openBlock(), createElementBlock("label", {
                    key: inp.name,
                    class: "map-row"
                  }, [
                    createTextVNode(
                      toDisplayString(inp.name) + " (" + toDisplayString(inp.type) + toDisplayString(inp.pluginId ? ` / ${inp.pluginId}` : "") + ") ",
                      1
                      /* TEXT */
                    ),
                    createVNode(unref(GSelect), {
                      "test-id": `import-map-${inp.name}`,
                      value: state2.value.mappings[inp.name] || state2.value.mappings[`\${${inp.name}}`] || "",
                      options: dsOptions.value,
                      placeholder: "选择目标数据源",
                      "allow-clear": "",
                      "onUpdate:value": ($event) => setMapping(inp.name, String($event ?? ""))
                    }, null, 8, ["test-id", "value", "options", "onUpdate:value"])
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              createVNode(unref(GButton), {
                size: "md",
                variant: "primary",
                onClick: goPreview
              }, {
                default: withCtx(() => [..._cache[18] || (_cache[18] = [
                  createTextVNode(
                    "下一步",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ])) : (openBlock(), createElementBlock("section", _hoisted_18$5, [
              _cache[21] || (_cache[21] = createElementVNode(
                "p",
                null,
                [
                  createTextVNode("将以"),
                  createElementVNode("strong", null, "仅本浏览器预览"),
                  createTextVNode("模式导入：")
                ],
                -1
                /* CACHED */
              )),
              createElementVNode("ul", null, [
                createElementVNode(
                  "li",
                  null,
                  "标题：" + toDisplayString(state2.value.title),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "UID：" + toDisplayString(state2.value.uid),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "来源：" + toDisplayString(state2.value.envelope?.sourceKind ?? "unknown"),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "li",
                  null,
                  "面板数：" + toDisplayString(state2.value.envelope?.dashboard.panels?.length ?? 0),
                  1
                  /* TEXT */
                )
              ]),
              state2.value.preview?.unresolved?.length ? (openBlock(), createElementBlock("div", _hoisted_19$5, [
                _cache[19] || (_cache[19] = createTextVNode(
                  " 未解析数据源路径： ",
                  -1
                  /* CACHED */
                )),
                createElementVNode("ul", null, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(state2.value.preview.unresolved, (p) => {
                      return openBlock(), createElementBlock(
                        "li",
                        { key: p },
                        toDisplayString(p),
                        1
                        /* TEXT */
                      );
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])
              ])) : createCommentVNode("v-if", true),
              createVNode(unref(GButton), {
                "test-id": "import-btn",
                size: "md",
                variant: "primary",
                disabled: !!state2.value.preview?.unresolved?.length,
                onClick: finish
              }, {
                default: withCtx(() => [..._cache[20] || (_cache[20] = [
                  createTextVNode(
                    " 导入并打开 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["disabled"])
            ])),
            error.value ? (openBlock(), createElementBlock(
              "p",
              _hoisted_20$4,
              toDisplayString(error.value),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true)
          ])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["open"]);
    };
  }
});
const DashboardImportModal = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["__scopeId", "data-v-678ff2ff"]]);
const _hoisted_1$T = {
  key: 0,
  class: "lib-root",
  "data-testid": "library-panels-root"
};
const _hoisted_2$K = {
  class: "lib-panel",
  "data-testid": "library-panels-drawer",
  role: "dialog",
  "aria-label": "面板库"
};
const _hoisted_3$C = { class: "lib-header" };
const _hoisted_4$r = {
  class: "lib",
  "data-testid": "library-panels"
};
const _hoisted_5$m = { class: "row" };
const _hoisted_6$j = {
  key: 0,
  class: "list"
};
const _hoisted_7$i = ["data-testid"];
const _hoisted_8$d = { class: "meta" };
const _hoisted_9$c = {
  key: 1,
  class: "lib-empty",
  "data-testid": "library-empty"
};
const _sfc_main$X = /* @__PURE__ */ defineComponent({
  __name: "LibraryPanelsDrawer",
  props: {
    open: { type: Boolean }
  },
  emits: ["update:open", "add"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const items = ref([]);
    const filter2 = ref("");
    watch(
      () => props.open,
      (open) => {
        if (open) items.value = listLibraryPanels();
      },
      { immediate: true }
    );
    const filtered = computed(() => {
      const q = filter2.value.trim().toLowerCase();
      if (!q) return items.value;
      return items.value.filter(
        (i) => i.name.toLowerCase().includes(q) || i.uid.toLowerCase().includes(q)
      );
    });
    function refresh() {
      items.value = listLibraryPanels();
    }
    function close() {
      emit("update:open", false);
    }
    return (_ctx, _cache) => {
      return __props.open ? (openBlock(), createElementBlock("div", _hoisted_1$T, [
        createElementVNode("div", {
          class: "lib-backdrop",
          onClick: close
        }),
        createElementVNode("div", _hoisted_2$K, [
          createElementVNode("header", _hoisted_3$C, [
            _cache[2] || (_cache[2] = createElementVNode(
              "strong",
              null,
              "面板库",
              -1
              /* CACHED */
            )),
            createVNode(unref(GButton), {
              size: "md",
              variant: "toolbar",
              "test-id": "library-close",
              onClick: close
            }, {
              default: withCtx(() => [..._cache[1] || (_cache[1] = [
                createTextVNode(
                  " 关闭 ",
                  -1
                  /* CACHED */
                )
              ])]),
              _: 1
              /* STABLE */
            })
          ]),
          createElementVNode("div", _hoisted_4$r, [
            createElementVNode("div", _hoisted_5$m, [
              createVNode(unref(GInput), {
                value: filter2.value,
                "onUpdate:value": _cache[0] || (_cache[0] = ($event) => filter2.value = $event),
                "test-id": "library-filter",
                placeholder: "筛选面板库…"
              }, null, 8, ["value"]),
              createVNode(unref(GButton), {
                size: "md",
                variant: "toolbar",
                "test-id": "library-refresh",
                onClick: refresh
              }, {
                default: withCtx(() => [..._cache[3] || (_cache[3] = [
                  createTextVNode(
                    " 刷新 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })
            ]),
            filtered.value.length ? (openBlock(), createElementBlock("ul", _hoisted_6$j, [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(filtered.value, (item) => {
                  return openBlock(), createElementBlock("li", {
                    key: item.uid,
                    class: "item",
                    "data-testid": `library-item-${item.uid}`
                  }, [
                    createElementVNode("div", null, [
                      createElementVNode(
                        "strong",
                        null,
                        toDisplayString(item.name),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "div",
                        _hoisted_8$d,
                        toDisplayString(item.model.type) + " · v" + toDisplayString(item.version) + " · " + toDisplayString(item.uid),
                        1
                        /* TEXT */
                      )
                    ]),
                    createVNode(unref(GButton), {
                      size: "md",
                      variant: "primary",
                      "test-id": "library-add-btn",
                      onClick: ($event) => emit("add", item.uid)
                    }, {
                      default: withCtx(() => [..._cache[4] || (_cache[4] = [
                        createTextVNode(
                          " 添加到仪表盘 ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["onClick"])
                  ], 8, _hoisted_7$i);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ])) : (openBlock(), createElementBlock("p", _hoisted_9$c, " 暂无库面板。在编辑模式中保存面板到库后会显示在这里。 "))
          ])
        ])
      ])) : createCommentVNode("v-if", true);
    };
  }
});
const LibraryPanelsDrawer = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["__scopeId", "data-v-76dee789"]]);
const _hoisted_1$S = ["data-testid", "data-panel-editing"];
const _hoisted_2$J = {
  key: 1,
  class: "menu-notice",
  "data-testid": "panel-menu-notice"
};
const _hoisted_3$B = {
  key: 2,
  "data-testid": "dashboard-loading"
};
const _hoisted_4$q = {
  key: 3,
  class: "dashboard-error",
  "data-testid": "dashboard-error",
  role: "alert"
};
const _hoisted_5$l = ["data-mode"];
const _hoisted_6$i = {
  class: "dashboard-page__body",
  "data-testid": "dashboard-body"
};
const _hoisted_7$h = {
  key: 0,
  class: "dashboard-empty",
  "data-testid": "dashboard-empty"
};
const _hoisted_8$c = { class: "dashboard-empty__hero" };
const _hoisted_9$b = { class: "dashboard-empty__row" };
const _hoisted_10$9 = { class: "dashboard-empty__card" };
const _hoisted_11$9 = { class: "dashboard-empty__card" };
const _hoisted_12$8 = {
  key: 0,
  class: "view-panel-bar",
  "data-testid": "view-panel-bar"
};
const _hoisted_13$8 = {
  class: "view-panel-label",
  "data-testid": "view-panel-title"
};
const _hoisted_14$6 = {
  class: "library-inline",
  "data-testid": "library-inline"
};
const _hoisted_15$6 = ["data-testid"];
const _hoisted_16$4 = {
  key: 0,
  "data-testid": "library-inline-empty"
};
const _hoisted_17$4 = {
  key: 1,
  class: "dashboard-settings-host",
  "data-testid": "dashboard-settings-host"
};
const _hoisted_18$4 = {
  key: 5,
  class: "shot",
  "data-testid": "screenshot-preview"
};
const _hoisted_19$4 = ["src"];
const _sfc_main$W = /* @__PURE__ */ defineComponent({
  __name: "DashboardPage",
  props: {
    uid: {},
    solo: { type: Boolean },
    embedded: { type: Boolean },
    editPanelId: {},
    viewPanelId: {},
    inspectPanelId: {},
    inspectTab: {},
    locale: {}
  },
  emits: ["back", "request-mode", "saved", "save-error", "cancel"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const router = useRouter();
    const store2 = useDashboardStore();
    useDashboardPageLocale(toRef(props, "locale"));
    const {
      document: document2,
      dirty,
      neverSaved,
      editMode,
      loading,
      error,
      panelData,
      time,
      timezone,
      weekStart,
      panels: panels2,
      title,
      canUndo,
      canRedo,
      refresh,
      isRefreshing
    } = storeToRefs(store2);
    const isSolo = computed(() => !!props.solo);
    const isViewPanel = computed(() => props.viewPanelId != null);
    const canMutateDashboard = computed(() => {
      if (store2.canEditDashboard && !store2.canEditDashboard()) return false;
      if (store2.document?.editable === false) return false;
      return !props.embedded || editMode.value;
    });
    const displayPanels = computed(() => buildDisplayPanels(panels2.value, props.viewPanelId));
    const refreshIntervals = computed(() => store2.getRefreshIntervals?.() ?? []);
    const timepickerHidden = computed(() => !!store2.isTimepickerHidden?.());
    const quickRanges = computed(() => store2.getQuickRanges?.() ?? void 0);
    const dashboardLinks = computed(() => store2.document?.links ?? []);
    const linkVariables = computed(() => {
      const list = store2.document?.templating?.list ?? [];
      const out = {};
      for (const v of list) {
        if (!v?.name) continue;
        const val = v.current?.value;
        if (val == null) continue;
        out[String(v.name)] = val;
      }
      return out;
    });
    const pageUi = useDashboardPageController();
    const {
      shareOpen,
      inspectorOpen: inspectOpen,
      libraryOpen,
      settingsOpen: dashboardSettingsOpen,
      anyOverlayOpen,
      openShare: openShareOverlay,
      openInspector: openInspectOverlay,
      openSettings: openSettingsOverlay,
      openLibrary,
      closeLibrary,
      closeSettings,
      closeTopOverlay,
      selectPanel: selectPanelId
    } = pageUi;
    const shareView = ref("link");
    const inspectTabOverride = ref();
    const menuNotice = ref("");
    const variablesSettingsOpen = ref(false);
    const importOpen = ref(false);
    const libraryItems = ref([]);
    const screenshotUrl = ref(null);
    const panelEditSession = ref(null);
    const panelEditorRef = ref(null);
    const editingPanelId = ref(null);
    const selectedPanel = ref(null);
    const editingPanel = computed(() => {
      const id = editingPanelId.value;
      if (id == null) return null;
      return panels2.value.find((p) => Number(p.id) === Number(id)) ?? null;
    });
    const variables = computed(() => document2.value?.templating?.list ?? []);
    const replaceVars = (value) => {
      const scoped = buildScopedVars(variables.value);
      return replaceVariables(value, scoped);
    };
    function refreshLibraryItems() {
      libraryItems.value = listLibraryPanels();
    }
    async function onImported(rec) {
      const doc = loadDashboardDocument(rec.raw);
      store2.loadLocal(doc);
      menuNotice.value = `已导入「${rec.title}」（${rec.uid}）— 仅本浏览器预览`;
      try {
        await router.push(
          `/d/${rec.uid}/${encodeURIComponent(rec.title.toLowerCase().replaceAll(/\s+/g, "-"))}`
        );
      } catch {
      }
    }
    watch(libraryOpen, (open) => {
      if (open) refreshLibraryItems();
    });
    const openedEditPanelIds = /* @__PURE__ */ new Set();
    const chrome = createDashboardPageChromeActions({
      store: {
        updatePanel: (p) => store2.updatePanel(p),
        save: () => store2.save(),
        serializeDocument: () => store2.serializeDocument(),
        setEditMode: (v) => store2.setEditMode(v),
        restoreSaved: () => store2.restoreSaved()
      },
      getPanels: () => panels2.value,
      getSelectedPanel: () => selectedPanel.value,
      setSelectedPanel: (p) => {
        selectedPanel.value = p;
      },
      getEditingPanelId: () => editingPanelId.value,
      setEditingPanelId: (id) => {
        editingPanelId.value = id;
      },
      getPanelEditSession: () => panelEditSession.value,
      setPanelEditSession: (s) => {
        panelEditSession.value = s;
      },
      getPanelEditorRef: () => panelEditorRef.value,
      setShareView: (m) => {
        shareView.value = m;
      },
      setInspectTabOverride: (tab) => {
        inspectTabOverride.value = tab;
      },
      openShareOverlay,
      openInspectOverlay,
      selectPanelId,
      isEmbedded: () => Boolean(props.embedded),
      getEditMode: () => editMode.value,
      requestMode: (mode2) => emit("request-mode", mode2),
      emitSaved: (d) => emit("saved", d),
      emitSaveError: (m) => emit("save-error", m),
      emitCancel: () => emit("cancel"),
      setScreenshotUrl: (url) => {
        screenshotUrl.value = url;
      },
      getEditPanelIdProp: () => props.editPanelId,
      getInspectPanelIdProp: () => props.inspectPanelId,
      openedEditPanelIds
    });
    const {
      saveDashboardFromPage,
      openShare,
      openInspect,
      toggleEditMode,
      takeScreenshot,
      cancelEmbeddedEdit,
      openInspectFromProp,
      openEditPanelFromProp
    } = chrome;
    const editActions = createDashboardPageEditActions(
      {
        setEditMode: (v) => store2.setEditMode(v),
        updatePanel: (p) => store2.updatePanel(p),
        deletePanel: (id) => store2.deletePanel(id),
        pushHistory: () => store2.pushHistory(),
        seedPanelData: (id, data) => store2.seedPanelData(id, data),
        refreshPanel: (p) => store2.refreshPanel(p),
        addPanel: (type) => store2.addPanel(type)
      },
      {
        currentQuery: () => ({ ...router.currentRoute.value.query }),
        replaceQuery: (q) => {
          try {
            router.replace({ query: q });
          } catch {
          }
        }
      },
      {
        getPanels: () => panels2.value,
        getSelectedPanel: () => selectedPanel.value,
        setSelectedPanel: (p) => {
          selectedPanel.value = p;
        },
        getEditingPanelId: () => editingPanelId.value,
        setEditingPanelId: (id) => {
          editingPanelId.value = id;
        },
        getPanelEditSession: () => panelEditSession.value,
        setPanelEditSession: (s) => {
          panelEditSession.value = s;
        },
        canMutate: () => canMutateDashboard.value,
        requestEditMode: () => emit("request-mode", "edit"),
        isEmbedded: () => Boolean(props.embedded),
        getViewPanelId: () => props.viewPanelId,
        getDocumentPanels: () => document2.value?.panels ?? []
      }
    );
    const {
      onPanelEdit,
      onPanelView,
      exitViewPanel,
      onPanelClick,
      applyPanel,
      cancelPanelEdit,
      addPanelAndEdit
    } = editActions;
    const panelActions = createPanelActionHandlers({
      getPanels: () => panels2.value,
      setSelectedPanel: (panel2) => {
        selectedPanel.value = panel2;
      },
      canMutate: () => canMutateDashboard.value,
      store: {
        copySelectedPanel: (id) => store2.copySelectedPanel(id),
        updatePanel: (panel2) => store2.updatePanel(panel2),
        duplicateSelectedPanel: (id) => store2.duplicateSelectedPanel(id),
        deletePanel: (id) => store2.deletePanel(id),
        saveSelectedAsLibraryPanel: (id, name) => store2.saveSelectedAsLibraryPanel(id, name),
        unlinkLibraryPanel: (id) => store2.unlinkLibraryPanel(id),
        refreshPanel: (panel2) => store2.refreshPanel?.(panel2)
      },
      setMenuNotice: (msg) => {
        menuNotice.value = msg;
      },
      openShare,
      openInspect,
      onPanelEdit: (id) => onPanelEdit(id),
      onPanelView: (id) => onPanelView(id),
      requestEditMode: () => emit("request-mode", "edit"),
      setLibraryItems: (items) => {
        libraryItems.value = items;
      },
      setInspectTabOverride: (tab) => {
        inspectTabOverride.value = tab;
      }
    });
    const { onPanelExplore, onPanelToggleLegend, onPanelAction } = panelActions;
    const settingsActions = createDashboardPageSettingsActions(
      {
        get document() {
          return document2.value;
        },
        updateVariables: (list) => store2.updateVariables(list),
        refreshVariables: () => store2.refreshVariables?.(),
        updateLayout: (next) => store2.updateLayout(next),
        loadLocal: (raw) => store2.loadLocal(raw),
        setEmbeddedDatasources: (list) => store2.setEmbeddedDatasources(list),
        applyDocumentEmbeddedDatasources: () => store2.applyDocumentEmbeddedDatasources(),
        unlinkLibraryPanel: (id) => store2.unlinkLibraryPanel(id),
        addLibraryPanelToDashboard: (uid) => store2.addLibraryPanelToDashboard(uid)
      },
      {
        canMutate: () => canMutateDashboard.value,
        getSelectedPanel: () => selectedPanel.value,
        setSelectedPanel: (p) => {
          selectedPanel.value = p;
        },
        getPanels: () => panels2.value,
        closeLibrary: () => closeLibrary(),
        closeSettings: () => closeSettings()
      }
    );
    const {
      onAdhocChange,
      onVariablesChange,
      addFromLibrary,
      applyEmbeddedDatasources,
      onDashboardSettingsPatch,
      onDatasourcesChange,
      onAnnotationsChange,
      onLinksChange,
      onSettingsJsonApply,
      onLayoutUpdated
    } = settingsActions;
    const onKeyDown = createDashboardPageKeydownHandler({
      anyOverlayOpen: () => anyOverlayOpen.value,
      closeTopOverlay,
      isVariablesSettingsOpen: () => variablesSettingsOpen.value,
      closeVariablesSettings: () => {
        variablesSettingsOpen.value = false;
      },
      getSelectedPanelId: () => selectedPanel.value?.id ?? null,
      isEditMode: () => editMode.value,
      isEditingPanel: () => editingPanelId.value != null,
      isViewingPanel: () => isViewPanel.value,
      onAction: (action) => {
        switch (action.type) {
          case "view":
            onPanelView(action.panelId);
            break;
          case "edit":
            onPanelEdit(action.panelId);
            break;
          case "inspect":
            openInspect(action.panelId);
            break;
          case "escapeEdit":
            cancelPanelEdit();
            break;
          case "escapeView":
            exitViewPanel();
            break;
          case "duplicate":
            store2.duplicateSelectedPanel(action.panelId);
            break;
          case "remove":
            store2.deletePanel(action.panelId);
            break;
          case "share":
            openShare(action.panelId, action.mode ?? "link");
            break;
          case "toggleLegend":
            onPanelToggleLegend(action.panelId);
            break;
          case "refresh":
            void store2.refreshAllPanels();
            break;
          case "save":
            void saveDashboardFromPage();
            break;
          case "explore":
            onPanelExplore(action.panelId);
            break;
        }
      }
    });
    watch(
      () => document2.value?.datasources,
      () => {
        applyEmbeddedDatasources();
      },
      { deep: true }
    );
    let unbindPanelHostEvents = null;
    onMounted(async () => {
      if (props.uid) await store2.loadByUid(props.uid);
      openEditPanelFromProp();
      openInspectFromProp();
      window.addEventListener("keydown", onKeyDown);
      unbindPanelHostEvents = bindPanelHostEvents({
        setTime: (from, to) => store2.setTime(from, to),
        setVariable: (name, value) => store2.setVariable(name, value),
        getTime: () => store2.time
      });
    });
    onBeforeUnmount(() => {
      window.removeEventListener("keydown", onKeyDown);
      unbindPanelHostEvents?.();
      unbindPanelHostEvents = null;
      if (!props.embedded) store2.dispose();
    });
    watch(
      () => panels2.value.map((p) => p.id).join(","),
      () => {
        const id = props.editPanelId;
        if (id == null) return;
        if (openedEditPanelIds.has(Number(id))) return;
        if (editingPanelId.value != null) return;
        if (!panels2.value.some((p) => Number(p.id) === Number(id))) return;
        openEditPanelFromProp();
      }
    );
    watch(
      () => props.editPanelId,
      (id, prev) => {
        if (prev != null && Number(prev) !== Number(id)) {
          openedEditPanelIds.delete(Number(prev));
        }
        if (id == null) {
          openedEditPanelIds.clear();
        }
      }
    );
    watch(
      () => props.inspectPanelId,
      () => openInspectFromProp()
    );
    watch(
      () => panels2.value.map((p) => p.id).join(","),
      () => {
        if (props.inspectPanelId == null) return;
        if (inspectOpen.value) return;
        if (!panels2.value.some((p) => Number(p.id) === Number(props.inspectPanelId))) {
          return;
        }
        openInspectFromProp();
      }
    );
    watch(
      () => props.uid,
      async (uid) => {
        if (uid) await store2.loadByUid(uid);
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["dashboard-page", {
          "dashboard-page--panel-editing": !!editingPanel.value,
          "dashboard-page--view-panel": isViewPanel.value
        }]),
        "data-testid": isSolo.value ? "dashboard-solo" : "dashboard-page",
        "data-panel-editing": editingPanel.value ? "1" : "0"
      }, [
        !isSolo.value ? (openBlock(), createBlock(DashboardPageHeader, {
          key: 0,
          embedded: __props.embedded,
          "edit-mode": unref(editMode),
          "can-edit-dashboard": unref(store2).canEditDashboard ? unref(store2).canEditDashboard() : unref(store2).document?.editable !== false,
          "panel-editing": !!editingPanel.value,
          title: unref(title),
          dirty: unref(dirty),
          "can-undo": unref(canUndo),
          "can-redo": unref(canRedo),
          "time-from": unref(time).from,
          "time-to": unref(time).to,
          timezone: unref(timezone),
          "week-start": unref(weekStart),
          refresh: unref(refresh),
          "refresh-intervals": refreshIntervals.value,
          "timepicker-hidden": timepickerHidden.value,
          "quick-ranges": quickRanges.value ?? void 0,
          links: dashboardLinks.value,
          "link-variables": linkVariables.value,
          "is-refreshing": unref(isRefreshing),
          "selected-panel-id": selectedPanel.value?.id ?? null,
          "library-open": unref(libraryOpen),
          saving: unref(store2).saving,
          "can-save": !!(unref(dirty) || unref(neverSaved) || panelEditSession.value),
          onBack: _cache[0] || (_cache[0] = ($event) => emit("back")),
          onImportJson: _cache[1] || (_cache[1] = ($event) => importOpen.value = true),
          onUndo: _cache[2] || (_cache[2] = ($event) => unref(store2).undo()),
          onRedo: _cache[3] || (_cache[3] = ($event) => unref(store2).redo()),
          onOpenVariables: _cache[4] || (_cache[4] = ($event) => variablesSettingsOpen.value = true),
          onOpenSettings: _cache[5] || (_cache[5] = ($event) => unref(openSettingsOverlay)()),
          onShare: _cache[6] || (_cache[6] = ($event) => unref(openShare)(null, "link")),
          onInspect: _cache[7] || (_cache[7] = ($event) => unref(openInspect)()),
          onToggleEdit: _cache[8] || (_cache[8] = ($event) => unref(toggleEditMode)()),
          onCancel: _cache[9] || (_cache[9] = ($event) => unref(cancelEmbeddedEdit)()),
          onAddPanel: _cache[10] || (_cache[10] = ($event) => unref(addPanelAndEdit)()),
          onCopyPanel: _cache[11] || (_cache[11] = ($event) => selectedPanel.value && unref(store2).copySelectedPanel(selectedPanel.value.id)),
          onDupPanel: _cache[12] || (_cache[12] = ($event) => selectedPanel.value && unref(store2).duplicateSelectedPanel(selectedPanel.value.id)),
          onPastePanel: _cache[13] || (_cache[13] = ($event) => unref(store2).pasteClipboardPanel()),
          onScreenshot: _cache[14] || (_cache[14] = ($event) => unref(takeScreenshot)()),
          onSave: _cache[15] || (_cache[15] = ($event) => unref(saveDashboardFromPage)()),
          onSetTime: _cache[16] || (_cache[16] = (f, t2) => unref(store2).setTime(f, t2)),
          onUpdateFrom: _cache[17] || (_cache[17] = (f) => unref(store2).setTime(f, unref(time).to)),
          onUpdateTo: _cache[18] || (_cache[18] = (t2) => unref(store2).setTime(unref(time).from, t2)),
          onUpdateTimezone: unref(store2).setTimezone,
          onSetRefresh: unref(store2).setRefresh,
          onDoRefresh: _cache[19] || (_cache[19] = ($event) => unref(store2).refreshAllPanels())
        }, null, 8, ["embedded", "edit-mode", "can-edit-dashboard", "panel-editing", "title", "dirty", "can-undo", "can-redo", "time-from", "time-to", "timezone", "week-start", "refresh", "refresh-intervals", "timepicker-hidden", "quick-ranges", "links", "link-variables", "is-refreshing", "selected-panel-id", "library-open", "saving", "can-save", "onUpdateTimezone", "onSetRefresh"])) : createCommentVNode("v-if", true),
        menuNotice.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_2$J,
          toDisplayString(menuNotice.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_3$B, [
          createVNode(DashboardSkeleton, {
            panels: unref(document2)?.panels
          }, null, 8, ["panels"])
        ])) : unref(error) ? (openBlock(), createElementBlock(
          "div",
          _hoisted_4$q,
          toDisplayString(unref(error)),
          1
          /* TEXT */
        )) : unref(document2) ? (openBlock(), createElementBlock("div", {
          key: 4,
          class: normalizeClass(["dashboard-page__shell", {
            "dashboard-page__shell--edit": unref(editMode) && !isSolo.value && !isViewPanel.value,
            "dashboard-page__shell--view": !unref(editMode) || isSolo.value || isViewPanel.value,
            "dashboard-page__shell--solo": isSolo.value,
            "dashboard-page__shell--view-panel": isViewPanel.value
          }]),
          "data-testid": "dashboard-shell",
          "data-mode": unref(editMode) && !isSolo.value && !isViewPanel.value ? "edit" : isViewPanel.value ? "view-panel" : isSolo.value ? "preview" : "view"
        }, [
          !isSolo.value && !editingPanel.value ? (openBlock(), createBlock(VariablesBar, {
            key: 0,
            class: "dashboard-page__variables",
            variables: variables.value,
            onChange: _cache[20] || (_cache[20] = (name, value) => unref(store2).setVariable(name, value)),
            onAdhocChange: unref(onAdhocChange)
          }, null, 8, ["variables", "onAdhocChange"])) : createCommentVNode("v-if", true),
          createElementVNode("div", _hoisted_6$i, [
            !unref(panels2).length ? (openBlock(), createElementBlock("div", _hoisted_7$h, [
              createCommentVNode(" Grafana DashboardEmpty OldLayout: dashed strong cards + CTAs "),
              createElementVNode("div", _hoisted_8$c, [
                _cache[38] || (_cache[38] = createElementVNode(
                  "h2",
                  null,
                  "通过添加可视化开始新仪表盘",
                  -1
                  /* CACHED */
                )),
                _cache[39] || (_cache[39] = createElementVNode(
                  "p",
                  null,
                  " 选择数据源，然后用图表、统计与表格查询并可视化数据，或创建列表、Markdown 等部件。 ",
                  -1
                  /* CACHED */
                )),
                unref(editMode) ? (openBlock(), createBlock(unref(GButton), {
                  key: 0,
                  "test-id": "empty-add-panel-btn",
                  variant: "primary",
                  size: "lg",
                  onClick: _cache[21] || (_cache[21] = ($event) => unref(addPanelAndEdit)())
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GIcon), {
                      name: "plus",
                      size: 16
                    }),
                    _cache[36] || (_cache[36] = createTextVNode(
                      " 添加可视化 ",
                      -1
                      /* CACHED */
                    ))
                  ]),
                  _: 1
                  /* STABLE */
                })) : (openBlock(), createBlock(unref(GButton), {
                  key: 1,
                  "test-id": "empty-enter-edit-btn",
                  variant: "primary",
                  size: "lg",
                  onClick: _cache[22] || (_cache[22] = ($event) => unref(toggleEditMode)())
                }, {
                  default: withCtx(() => [..._cache[37] || (_cache[37] = [
                    createTextVNode(
                      " 进入编辑 ",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                }))
              ]),
              createElementVNode("div", _hoisted_9$b, [
                createElementVNode("div", _hoisted_10$9, [
                  _cache[41] || (_cache[41] = createElementVNode(
                    "h3",
                    null,
                    "导入面板",
                    -1
                    /* CACHED */
                  )),
                  _cache[42] || (_cache[42] = createElementVNode(
                    "p",
                    null,
                    "从面板库添加已保存的可视化。",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GButton), {
                    variant: "secondary",
                    size: "md",
                    "test-id": "empty-library-btn",
                    disabled: !unref(editMode),
                    onClick: _cache[23] || (_cache[23] = ($event) => unref(openLibrary)())
                  }, {
                    default: withCtx(() => [..._cache[40] || (_cache[40] = [
                      createTextVNode(
                        " 添加库面板 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  }, 8, ["disabled"])
                ]),
                createElementVNode("div", _hoisted_11$9, [
                  _cache[44] || (_cache[44] = createElementVNode(
                    "h3",
                    null,
                    "导入仪表盘",
                    -1
                    /* CACHED */
                  )),
                  _cache[45] || (_cache[45] = createElementVNode(
                    "p",
                    null,
                    "从 JSON 文件导入仪表盘。",
                    -1
                    /* CACHED */
                  )),
                  createVNode(unref(GButton), {
                    variant: "secondary",
                    size: "md",
                    "test-id": "empty-import-btn",
                    onClick: _cache[24] || (_cache[24] = ($event) => importOpen.value = true)
                  }, {
                    default: withCtx(() => [
                      createVNode(unref(GIcon), {
                        name: "copy",
                        size: 14
                      }),
                      _cache[43] || (_cache[43] = createTextVNode(
                        " 导入仪表盘 ",
                        -1
                        /* CACHED */
                      ))
                    ]),
                    _: 1
                    /* STABLE */
                  })
                ])
              ])
            ])) : (openBlock(), createBlock(DashboardCanvas, { key: 1 }, {
              grid: withCtx(() => [
                isViewPanel.value ? (openBlock(), createElementBlock("div", _hoisted_12$8, [
                  createVNode(unref(GButton), {
                    "test-id": "exit-view-panel-btn",
                    size: "sm",
                    onClick: _cache[25] || (_cache[25] = ($event) => unref(exitViewPanel)())
                  }, {
                    default: withCtx(() => [..._cache[46] || (_cache[46] = [
                      createTextVNode(
                        " ← 返回仪表盘 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  }),
                  createElementVNode(
                    "span",
                    _hoisted_13$8,
                    " 查看：" + toDisplayString(unref(panels2).find((p) => p.id === __props.viewPanelId)?.title || "面板"),
                    1
                    /* TEXT */
                  ),
                  __props.viewPanelId != null ? (openBlock(), createBlock(unref(GButton), {
                    key: 0,
                    "test-id": "view-panel-inspect-btn",
                    size: "sm",
                    onClick: _cache[26] || (_cache[26] = ($event) => unref(openInspect)(__props.viewPanelId))
                  }, {
                    default: withCtx(() => [..._cache[47] || (_cache[47] = [
                      createTextVNode(
                        " 检查 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  })) : createCommentVNode("v-if", true),
                  __props.viewPanelId != null ? (openBlock(), createBlock(unref(GButton), {
                    key: 1,
                    "test-id": "view-panel-edit-btn",
                    size: "sm",
                    onClick: _cache[27] || (_cache[27] = ($event) => unref(onPanelEdit)(__props.viewPanelId))
                  }, {
                    default: withCtx(() => [..._cache[48] || (_cache[48] = [
                      createTextVNode(
                        " 编辑 ",
                        -1
                        /* CACHED */
                      )
                    ])]),
                    _: 1
                    /* STABLE */
                  })) : createCommentVNode("v-if", true)
                ])) : createCommentVNode("v-if", true),
                createCommentVNode(" Shared grid for edit / preview / view — mode only toggles interaction chrome "),
                withDirectives(createVNode(DashboardGrid, {
                  class: "dashboard-canvas__grid",
                  panels: displayPanels.value,
                  "panel-data": unref(panelData),
                  editable: unref(editMode) && !isSolo.value && !isViewPanel.value,
                  "is-viewing": isViewPanel.value,
                  "selected-panel-id": selectedPanel.value?.id ?? null,
                  "replace-variables": replaceVars,
                  "graph-tooltip": Number(unref(document2)?.graphTooltip ?? 0),
                  onLayoutUpdated: unref(onLayoutUpdated),
                  onPanelAction: unref(onPanelAction),
                  onPanelClick: unref(onPanelClick)
                }, null, 8, ["panels", "panel-data", "editable", "is-viewing", "selected-panel-id", "graph-tooltip", "onLayoutUpdated", "onPanelAction", "onPanelClick"]), [
                  [vShow, !editingPanel.value]
                ])
              ]),
              editor: withCtx(() => [
                unref(editMode) && editingPanel.value ? (openBlock(), createBlock(PanelEditor, {
                  key: 0,
                  ref_key: "panelEditorRef",
                  ref: panelEditorRef,
                  class: "dashboard-canvas__editor",
                  panel: editingPanel.value,
                  session: panelEditSession.value,
                  data: editingPanel.value ? unref(panelData)[editingPanel.value.id] : void 0,
                  variables: variables.value,
                  "data-panel-editor-host": "1",
                  onBack: unref(applyPanel),
                  onDiscard: unref(cancelPanelEdit)
                }, null, 8, ["panel", "session", "data", "variables", "onBack", "onDiscard"])) : createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            }))
          ])
        ], 10, _hoisted_5$l)) : createCommentVNode("v-if", true),
        createVNode(DashboardOverlays, {
          "share-open": unref(shareOpen),
          "inspector-open": unref(inspectOpen),
          "library-open": unref(libraryOpen),
          "settings-open": unref(dashboardSettingsOpen) || variablesSettingsOpen.value
        }, {
          library: withCtx(() => [
            createCommentVNode(" Inline library first so Ant Modal failures cannot abort this UI "),
            createElementVNode("aside", _hoisted_14$6, [
              createElementVNode("header", null, [
                _cache[50] || (_cache[50] = createElementVNode(
                  "strong",
                  null,
                  "面板库",
                  -1
                  /* CACHED */
                )),
                createVNode(unref(GButton), {
                  "test-id": "library-inline-close",
                  size: "sm",
                  onClick: _cache[28] || (_cache[28] = ($event) => unref(closeLibrary)())
                }, {
                  default: withCtx(() => [..._cache[49] || (_cache[49] = [
                    createTextVNode(
                      "关闭",
                      -1
                      /* CACHED */
                    )
                  ])]),
                  _: 1
                  /* STABLE */
                })
              ]),
              createElementVNode("ul", null, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(libraryItems.value, (item) => {
                    return openBlock(), createElementBlock("li", {
                      key: item.uid,
                      "data-testid": `library-inline-item-${item.uid}`
                    }, [
                      createTextVNode(
                        toDisplayString(item.name) + " (" + toDisplayString(item.model.type) + ") ",
                        1
                        /* TEXT */
                      ),
                      createVNode(unref(GButton), {
                        size: "sm",
                        onClick: ($event) => unref(addFromLibrary)(item.uid)
                      }, {
                        default: withCtx(() => [..._cache[51] || (_cache[51] = [
                          createTextVNode(
                            " 添加 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }, 8, ["onClick"])
                    ], 8, _hoisted_15$6);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ]),
              !libraryItems.value.length ? (openBlock(), createElementBlock("p", _hoisted_16$4, "暂无面板")) : createCommentVNode("v-if", true)
            ]),
            createVNode(LibraryPanelsDrawer, {
              open: unref(libraryOpen),
              "onUpdate:open": _cache[29] || (_cache[29] = ($event) => isRef(libraryOpen) ? libraryOpen.value = $event : null),
              onAdd: unref(addFromLibrary)
            }, null, 8, ["open", "onAdd"])
          ]),
          share: withCtx(() => [
            unref(document2) ? (openBlock(), createBlock(ShareDrawer, {
              key: 0,
              open: unref(shareOpen),
              "onUpdate:open": _cache[30] || (_cache[30] = ($event) => isRef(shareOpen) ? shareOpen.value = $event : null),
              uid: unref(document2).uid || __props.uid || "local",
              from: unref(time).from,
              to: unref(time).to,
              "panel-id": selectedPanel.value?.id ?? void 0,
              "share-view": shareView.value
            }, null, 8, ["open", "uid", "from", "to", "panel-id", "share-view"])) : createCommentVNode("v-if", true)
          ]),
          inspector: withCtx(() => [
            createVNode(PanelInspector, {
              open: unref(inspectOpen),
              "onUpdate:open": _cache[31] || (_cache[31] = ($event) => isRef(inspectOpen) ? inspectOpen.value = $event : null),
              "initial-tab": inspectTabOverride.value || props.inspectTab,
              panel: selectedPanel.value,
              data: selectedPanel.value ? unref(panelData)[selectedPanel.value.id] : void 0
            }, null, 8, ["open", "initial-tab", "panel", "data"])
          ]),
          settings: withCtx(() => [
            variablesSettingsOpen.value && unref(document2) ? (openBlock(), createBlock(VariablesSettings, {
              key: 0,
              variables: unref(document2).templating?.list ?? [],
              "data-testid": "variables-settings-host",
              onClose: _cache[32] || (_cache[32] = ($event) => variablesSettingsOpen.value = false),
              onChange: unref(onVariablesChange)
            }, null, 8, ["variables", "onChange"])) : createCommentVNode("v-if", true),
            unref(dashboardSettingsOpen) && unref(document2) ? (openBlock(), createElementBlock("div", _hoisted_17$4, [
              createVNode(DashboardSettings, {
                document: unref(document2),
                json: unref(store2).serializeDocument?.() ?? JSON.stringify(unref(document2), null, 2),
                onClose: _cache[33] || (_cache[33] = ($event) => unref(closeSettings)()),
                onPatch: unref(onDashboardSettingsPatch),
                onVariables: unref(onVariablesChange),
                onAnnotations: unref(onAnnotationsChange),
                onLinks: unref(onLinksChange),
                onDatasources: unref(onDatasourcesChange),
                onApplyJson: unref(onSettingsJsonApply)
              }, null, 8, ["document", "json", "onPatch", "onVariables", "onAnnotations", "onLinks", "onDatasources", "onApplyJson"])
            ])) : createCommentVNode("v-if", true)
          ]),
          _: 1
          /* STABLE */
        }, 8, ["share-open", "inspector-open", "library-open", "settings-open"]),
        createVNode(DashboardImportModal, {
          open: importOpen.value,
          "onUpdate:open": _cache[34] || (_cache[34] = ($event) => importOpen.value = $event),
          onImported
        }, null, 8, ["open"]),
        screenshotUrl.value ? (openBlock(), createElementBlock("div", _hoisted_18$4, [
          createElementVNode("img", {
            src: screenshotUrl.value,
            alt: "仪表盘截图"
          }, null, 8, _hoisted_19$4),
          createVNode(unref(GButton), {
            onClick: _cache[35] || (_cache[35] = ($event) => screenshotUrl.value = null)
          }, {
            default: withCtx(() => [..._cache[52] || (_cache[52] = [
              createTextVNode(
                "关闭",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ])) : createCommentVNode("v-if", true)
      ], 10, _hoisted_1$S);
    };
  }
});
const DashboardPage = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["__scopeId", "data-v-c2a3eaa2"]]);
const _hoisted_1$R = {
  class: "dashboard-viewer",
  "data-testid": "dashboard-viewer"
};
const _hoisted_2$I = {
  key: 0,
  class: "dashboard-viewer-toolbar"
};
const _hoisted_3$A = {
  key: 2,
  class: "dashboard-viewer__error",
  "data-testid": "dashboard-viewer-error"
};
const _sfc_main$V = /* @__PURE__ */ defineComponent({
  __name: "DashboardViewer",
  props: {
    dashboard: {},
    datasources: { default: () => [] },
    theme: {},
    readonly: { type: Boolean, default: true }
  },
  emits: ["ready", "error", "submit"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    let _piniaInjectKey;
    function provideLocalPinia(pinia2) {
      const shim = {
        provide(key, _value) {
          if (typeof key === "symbol") _piniaInjectKey = key;
        },
        config: { globalProperties: {} },
        mixin() {
        },
        use() {
          return this;
        }
      };
      pinia2.install(shim);
      if (_piniaInjectKey) provide(_piniaInjectKey, pinia2);
      setActivePinia(pinia2);
    }
    const pinia = createPinia();
    provideLocalPinia(pinia);
    setActivePinia(pinia);
    const store2 = useDashboardStore(pinia);
    const { document: document2, panelData, panels: panels2, time, timezone, error } = storeToRefs(store2);
    const mounted = ref(false);
    function registerViewerDatasource(ds2) {
      const runtime = getRuntimeDataSourceSettings(ds2.uid);
      const url = String(ds2.url || runtime?.url || "").trim();
      const jsonData = {
        ...runtime?.jsonData ?? {},
        ...ds2.jsonData ?? {}
      };
      const plugin2 = getDataSourcePlugin(ds2.type);
      if (!plugin2?.createDataSource) {
        store2.registerDataSource({
          id: 0,
          uid: ds2.uid,
          type: ds2.type,
          name: ds2.name,
          url,
          jsonData,
          query: async () => ({ data: [] })
        });
        return;
      }
      const api = plugin2.createDataSource({
        uid: ds2.uid,
        type: ds2.type,
        name: ds2.name,
        url,
        access: "proxy",
        basicAuth: ds2.basicAuth,
        basicAuthUser: ds2.basicAuthUser,
        jsonData: {
          ...jsonData,
          ...ds2.secureJsonData ?? {}
        },
        meta: plugin2.meta ?? {}
      });
      store2.registerDataSource({
        uid: ds2.uid,
        type: ds2.type,
        name: ds2.name,
        url,
        ...api
      });
    }
    async function loadDashboard(raw) {
      for (const ds2 of props.datasources ?? []) {
        try {
          registerViewerDatasource(ds2);
        } catch (error_) {
          if (typeof console !== "undefined") {
            console.warn("[DashboardViewer] register datasource failed", error_);
          }
        }
      }
      await store2.loadLocal(raw);
    }
    let unbindPanelHostEvents = null;
    onMounted(async () => {
      setActivePinia(pinia);
      try {
        if (props.theme) {
          try {
            initTheme({ preference: props.theme });
          } catch {
          }
        }
        await loadDashboard(props.dashboard);
        mounted.value = true;
        unbindPanelHostEvents = bindPanelHostEvents({
          setTime: (from, to) => {
            setActivePinia(pinia);
            store2.setTime?.(from, to);
          },
          setVariable: (name, value) => {
            setActivePinia(pinia);
            store2.setVariable?.(name, value);
          },
          getTime: () => {
            setActivePinia(pinia);
            return store2.time;
          }
        });
        emit("ready");
      } catch (error_) {
        emit("error", error_ instanceof Error ? error_.message : String(error_));
      } finally {
      }
    });
    watch(
      () => props.dashboard,
      async (next) => {
        if (!next) return;
        setActivePinia(pinia);
        try {
          await store2.loadLocal(next);
        } catch (error_) {
          emit("error", error_ instanceof Error ? error_.message : String(error_));
        } finally {
        }
      },
      { deep: false }
    );
    watch(
      () => props.datasources,
      (next) => {
        setActivePinia(pinia);
        for (const ds2 of next ?? []) registerViewerDatasource(ds2);
      },
      { deep: false }
    );
    onBeforeUnmount(() => {
      unbindPanelHostEvents?.();
      unbindPanelHostEvents = null;
      setActivePinia(pinia);
      store2.dispose?.();
      store2.$dispose();
      pinia._e?.stop?.();
    });
    const varList = computed(() => document2.value?.templating?.list ?? []);
    const replaceVars = (value) => replaceVariables(value, buildScopedVars(varList.value));
    function getJson() {
      setActivePinia(pinia);
      try {
        if (!store2.document) return {};
        const raw = store2.serializeDocument?.() ?? "{}";
        return JSON.parse(raw);
      } finally {
      }
    }
    function getJsonString() {
      setActivePinia(pinia);
      try {
        return store2.serializeDocument?.() ?? "{}";
      } finally {
      }
    }
    function handleSave() {
      emit("submit", getJson());
    }
    function onVariableChange(name, value) {
      setActivePinia(pinia);
      store2.setVariable?.(name, value);
    }
    function onTimeChange(from, to) {
      setActivePinia(pinia);
      store2.setTime?.(from, to);
    }
    __expose({ getJson, getJsonString });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$R, [
        !__props.readonly ? (openBlock(), createElementBlock("div", _hoisted_2$I, [
          createVNode(unref(GButton), {
            variant: "primary",
            "test-id": "dashboard-viewer-save",
            onClick: handleSave
          }, {
            default: withCtx(() => [..._cache[0] || (_cache[0] = [
              createTextVNode(
                "保存",
                -1
                /* CACHED */
              )
            ])]),
            _: 1
            /* STABLE */
          })
        ])) : createCommentVNode("v-if", true),
        varList.value.length ? (openBlock(), createBlock(VariablesBar, {
          key: 1,
          variables: varList.value,
          onChange: onVariableChange
        }, null, 8, ["variables"])) : createCommentVNode("v-if", true),
        createVNode(TimeRangePicker, {
          from: unref(time).from,
          to: unref(time).to,
          timezone: unref(timezone),
          onChange: onTimeChange
        }, null, 8, ["from", "to", "timezone"]),
        createVNode(DashboardGrid, {
          panels: unref(panels2),
          "panel-data": unref(panelData),
          editable: !__props.readonly,
          "replace-variables": replaceVars
        }, null, 8, ["panels", "panel-data", "editable"]),
        unref(error) ? (openBlock(), createElementBlock(
          "div",
          _hoisted_3$A,
          toDisplayString(unref(error)),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const DashboardViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["__scopeId", "data-v-7b7cbff3"]]);
const _hoisted_1$Q = {
  class: "grafana-dashboard",
  "data-testid": "grafana-dashboard"
};
const _hoisted_2$H = {
  key: 0,
  class: "grafana-dashboard__error",
  "data-testid": "grafana-dashboard-error"
};
const _hoisted_3$z = {
  key: 2,
  "data-testid": "grafana-dashboard-loading"
};
const _sfc_main$U = /* @__PURE__ */ defineComponent({
  __name: "GrafanaDashboard",
  props: {
    dashboard: {},
    mode: {},
    persist: { type: Function },
    datasources: {},
    theme: {},
    locale: {}
  },
  emits: ["ready", "error", "saved", "cancel", "back", "update:mode"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    let piniaInjectKey;
    function provideLocalPinia(pinia2) {
      const shim = {
        provide(key) {
          if (typeof key === "symbol") piniaInjectKey = key;
        },
        config: { globalProperties: {} },
        mixin() {
        },
        use() {
          return this;
        }
      };
      pinia2.install(shim);
      if (piniaInjectKey) provide(piniaInjectKey, pinia2);
    }
    const pinia = createPinia();
    const hostPinia = getActivePinia();
    provideLocalPinia(pinia);
    const store2 = useDashboardStore(pinia);
    if (hostPinia) setActivePinia(hostPinia);
    async function withLocalPinia(task) {
      const previous = getActivePinia();
      setActivePinia(pinia);
      try {
        return await task();
      } finally {
        setActivePinia(previous);
      }
    }
    const mounted = ref(false);
    const loadError = ref("");
    let loadedDashboard = null;
    function registerDatasource(ds2) {
      const runtime = getRuntimeDataSourceSettings(ds2.uid);
      const url = String(ds2.url || runtime?.url || "").trim();
      const jsonData = {
        ...runtime?.jsonData ?? {},
        ...ds2.jsonData ?? {}
      };
      const plugin2 = getDataSourcePlugin(ds2.type);
      if (!plugin2?.createDataSource) {
        store2.registerDataSource({
          id: 0,
          uid: ds2.uid,
          type: ds2.type,
          name: ds2.name,
          url,
          jsonData,
          query: async () => ({ data: [] })
        });
        return;
      }
      const api = plugin2.createDataSource({
        uid: ds2.uid,
        type: ds2.type,
        name: ds2.name,
        url,
        access: "proxy",
        basicAuth: ds2.basicAuth,
        basicAuthUser: ds2.basicAuthUser,
        jsonData,
        secureJsonData: ds2.secureJsonData ?? {},
        meta: plugin2.meta ?? {}
      });
      store2.registerDataSource({
        uid: ds2.uid,
        type: ds2.type,
        name: ds2.name,
        url,
        ...api
      });
    }
    function applyTheme(theme) {
      if (!theme) return;
      try {
        initTheme({ preference: theme });
      } catch {
      }
    }
    async function loadDashboard(raw) {
      await withLocalPinia(async () => {
        try {
          await registerHeavyPlugins();
        } catch (error) {
          if (typeof console !== "undefined") {
            console.error("[GrafanaDashboard] heavy plugin registration failed", error);
          }
        }
        for (const datasource of props.datasources ?? []) {
          registerDatasource(datasource);
        }
        const embedded = readEmbeddedDatasources(raw);
        if (embedded.length) {
          registerEmbeddedDatasources(embedded, (api) => store2.registerDataSource(api));
        }
        await store2.loadLocal(raw);
        store2.setEditMode(props.mode === "edit");
        loadedDashboard = raw;
      });
    }
    onMounted(async () => {
      store2.setPersistenceHandler((dashboard) => props.persist(dashboard));
      applyTheme(props.theme);
      try {
        await loadDashboard(props.dashboard);
        mounted.value = true;
        emit("ready");
      } catch (error) {
        loadError.value = error instanceof Error ? error.message : String(error);
        emit("error", { phase: "load", message: loadError.value });
      } finally {
        if (hostPinia) setActivePinia(hostPinia);
      }
    });
    watch(
      () => props.mode,
      (mode2) => {
        if (!mounted.value) return;
        void withLocalPinia(() => store2.setEditMode(mode2 === "edit"));
      }
    );
    watch(
      () => props.dashboard,
      async (dashboard) => {
        if (!mounted.value || dashboard === loadedDashboard) return;
        if (store2.dirty) {
          emit("error", {
            phase: "replace",
            message: "仪表盘存在未保存修改，已忽略外部数据替换"
          });
          return;
        }
        try {
          await loadDashboard(dashboard);
        } catch (error) {
          emit("error", {
            phase: "load",
            message: error instanceof Error ? error.message : String(error)
          });
        }
      }
    );
    watch(
      () => props.theme,
      (theme) => {
        if (mounted.value) applyTheme(theme);
      }
    );
    watch(
      () => props.datasources,
      (datasources2) => {
        if (!mounted.value) return;
        void withLocalPinia(() => {
          for (const datasource of datasources2 ?? []) registerDatasource(datasource);
        });
      },
      { deep: false }
    );
    function queryNumber(value) {
      const raw = Array.isArray(value) ? value[0] : value;
      if (raw == null || raw === "") return void 0;
      const number = Number(raw);
      return Number.isFinite(number) ? number : void 0;
    }
    const route = useRoute() || {};
    const editPanelId = computed(() => queryNumber(route.query?.editPanel));
    const viewPanelId = computed(() => queryNumber(route.query?.viewPanel));
    const inspectPanelId = computed(() => queryNumber(route.query?.inspect));
    const inspectTab = computed(() => {
      const value = Array.isArray(route.query?.inspectTab) ? route.query?.inspectTab[0] : route.query?.inspectTab;
      return value == null || value === "" ? void 0 : String(value);
    });
    function getJson() {
      const previous = getActivePinia();
      setActivePinia(pinia);
      try {
        return JSON.parse(store2.serializeDocument());
      } finally {
        setActivePinia(previous);
      }
    }
    function getJsonString() {
      const previous = getActivePinia();
      setActivePinia(pinia);
      try {
        return store2.serializeDocument();
      } finally {
        setActivePinia(previous);
      }
    }
    async function discard2() {
      await withLocalPinia(() => store2.restoreSaved());
    }
    function handleSaved(dashboard) {
      emit("saved", dashboard);
    }
    function handleSaveError(message2) {
      emit("error", { phase: "save", message: message2 });
    }
    __expose({ getJson, getJsonString, discard: discard2 });
    onBeforeUnmount(() => {
      const previous = getActivePinia();
      setActivePinia(pinia);
      store2.setPersistenceHandler(null);
      store2.dispose();
      store2.$dispose();
      pinia._e?.stop?.();
      setActivePinia(previous);
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$Q, [
        loadError.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_2$H,
          toDisplayString(loadError.value),
          1
          /* TEXT */
        )) : mounted.value ? (openBlock(), createBlock(DashboardPage, {
          key: 1,
          embedded: "",
          "edit-panel-id": editPanelId.value,
          "view-panel-id": viewPanelId.value,
          "inspect-panel-id": inspectPanelId.value,
          "inspect-tab": inspectTab.value,
          locale: __props.locale,
          onBack: _cache[0] || (_cache[0] = ($event) => emit("back")),
          onRequestMode: _cache[1] || (_cache[1] = ($event) => emit("update:mode", $event)),
          onSaved: handleSaved,
          onSaveError: handleSaveError,
          onCancel: _cache[2] || (_cache[2] = ($event) => emit("cancel"))
        }, null, 8, ["edit-panel-id", "view-panel-id", "inspect-panel-id", "inspect-tab", "locale"])) : (openBlock(), createElementBlock("div", _hoisted_3$z, "加载中…"))
      ]);
    };
  }
});
const GrafanaDashboard = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__scopeId", "data-v-d237aef4"]]);
const ZABBIX_I18N_ZH_HANS = {
  "zabbix.common.group": "主机组",
  "zabbix.common.host": "主机",
  "zabbix.common.application": "应用集",
  "zabbix.common.item": "监控项",
  "zabbix.common.itemId": "监控项 ID",
  "zabbix.common.itemTag": "监控项标签",
  "zabbix.common.hostTag": "主机标签",
  "zabbix.common.proxy": "代理",
  "zabbix.common.trigger": "触发器",
  "zabbix.common.problem": "问题",
  "zabbix.common.problems": "问题",
  "zabbix.common.severity": "严重性",
  "zabbix.common.minSeverity": "最低严重性",
  "zabbix.common.tags": "标签",
  "zabbix.common.macro": "宏",
  "zabbix.common.service": "服务",
  "zabbix.common.sla": "SLA",
  "zabbix.common.property": "属性",
  "zabbix.common.interval": "间隔",
  "zabbix.common.functions": "函数",
  "zabbix.common.legend": "图例",
  "zabbix.common.options": "选项",
  "zabbix.common.default": "默认",
  "zabbix.common.all": "全部",
  "zabbix.common.true": "是",
  "zabbix.common.false": "否",
  "zabbix.common.loading": "加载中…",
  "zabbix.common.retry": "重试",
  "zabbix.common.cancel": "取消",
  "zabbix.common.confirm": "确认",
  "zabbix.common.close": "关闭",
  "zabbix.common.execute": "执行",
  "zabbix.common.remove": "删除",
  "zabbix.common.previous": "上一页",
  "zabbix.common.next": "下一页",
  "zabbix.common.unknown": "未知",
  "zabbix.common.none": "无",
  "zabbix.common.yes": "是",
  "zabbix.common.no": "否",
  "zabbix.common.notClassified": "未分类",
  "zabbix.common.information": "信息",
  "zabbix.common.warning": "警告",
  "zabbix.common.average": "一般",
  "zabbix.common.high": "严重",
  "zabbix.common.disaster": "灾难",
  "zabbix.query.queryType": "查询类型",
  "zabbix.query.metric": "指标",
  "zabbix.query.itService": "IT 服务",
  "zabbix.query.text": "文本",
  "zabbix.query.run": "运行查询",
  "zabbix.query.runAria": "运行查询",
  "zabbix.query.legendPlaceholder": "{{item}}",
  "zabbix.query.textFilter": "文本过滤",
  "zabbix.query.useCaptureGroups": "使用捕获组",
  "zabbix.query.countBy": "统计方式",
  "zabbix.query.allTriggers": "所有触发器",
  "zabbix.query.items": "监控项",
  "zabbix.query.onlyCount": "仅返回数量",
  "zabbix.query.lastValue": "最后值",
  "zabbix.query.serviceStatus": "服务状态",
  "zabbix.query.countFrame": "计数 {refId}",
  "zabbix.query.triggersFrame": "触发器 {refId}",
  "zabbix.duration.days": "{count} 天",
  "zabbix.duration.years": "{count} 年",
  "zabbix.duration.yearsDays": "{years} 年 {days} 天",
  "zabbix.query.problemFilter": "问题过滤",
  "zabbix.query.problemNameFilter": "问题名称过滤",
  "zabbix.query.show": "显示",
  "zabbix.query.recentProblems": "最近问题",
  "zabbix.query.history": "历史记录",
  "zabbix.query.hostTags": "主机标签",
  "zabbix.query.tagsEval": "标签匹配",
  "zabbix.query.andOr": "且/或",
  "zabbix.query.or": "或",
  "zabbix.query.allSeverity": "全部级别",
  "zabbix.query.addHostTag": "主机标签",
  "zabbix.query.addHostTagAria": "添加主机标签过滤器",
  "zabbix.query.removeHostTagAria": "删除主机标签过滤器",
  "zabbix.query.hostTagEvalAria": "主机标签匹配方式",
  "zabbix.query.operatorContains": "包含",
  "zabbix.query.operatorEquals": "等于",
  "zabbix.query.operatorNotContains": "不包含",
  "zabbix.query.operatorNotLike": "不匹配",
  "zabbix.query.operatorNotEquals": "不等于",
  "zabbix.query.operatorExists": "存在",
  "zabbix.query.operatorNotExists": "不存在",
  "zabbix.query.tagPlaceholder": "标签",
  "zabbix.query.valuePlaceholder": "值",
  "zabbix.query.itemIds": "监控项 ID（逗号分隔）",
  "zabbix.query.functionsAdd": "添加函数",
  "zabbix.query.functionUnknown": "未知函数",
  "zabbix.query.functionMoveLeft": "左移",
  "zabbix.query.functionMoveRight": "右移",
  "zabbix.query.functionDelete": "删除",
  "zabbix.query.functionCategoryTransform": "转换",
  "zabbix.query.functionCategoryAggregate": "聚合",
  "zabbix.query.functionCategoryFilter": "过滤",
  "zabbix.query.functionCategoryTrends": "趋势",
  "zabbix.query.functionCategoryTime": "时间",
  "zabbix.query.functionCategoryAlias": "别名",
  "zabbix.query.functionCategorySpecial": "特殊",
  "zabbix.query.lldRule": "发现规则 (LLD)",
  "zabbix.query.lldRulePlaceholder": "选择发现规则",
  "zabbix.query.lldPrototype": "监控项原型",
  "zabbix.query.lldPrototypePlaceholder": "选择监控项原型",
  "zabbix.query.lldEmpty": "无发现规则",
  "zabbix.query.filterPlaceholder": "选择或输入过滤条件",
  "zabbix.query.metricPlaceholder": "选择或输入",
  "zabbix.query.regexAllError": "请使用 /.*/ 匹配全部",
  "zabbix.query.regexError": "正则必须以 / 结尾",
  "zabbix.query.acknowledgeProblem": "确认问题",
  "zabbix.query.executeScript": "执行脚本",
  "zabbix.query.explore": "探索",
  "zabbix.query.tagFilterHint": "单击添加标签过滤器，按住 Ctrl/Shift 单击可移除",
  "zabbix.query.noExtraOptions": "无额外选项",
  "zabbix.query.optionTrends": "趋势",
  "zabbix.query.optionShowDisabled": "显示已禁用监控项",
  "zabbix.query.optionValueMapping": "使用 Zabbix 值映射",
  "zabbix.query.optionAlignment": "禁用数据对齐",
  "zabbix.query.optionSkipEmpty": "跳过空值",
  "zabbix.query.optionSortProblems": "排序问题",
  "zabbix.query.optionAcknowledged": "已确认状态",
  "zabbix.query.optionMaintenance": "维护中的主机",
  "zabbix.query.optionShowProxy": "显示代理",
  "zabbix.query.optionLimit": "上限",
  "zabbix.query.optionTimeRange": "使用时间范围",
  "zabbix.query.optionHistorical": "获取历史监控项值",
  "zabbix.query.optionCount": "仅统计数量",
  "zabbix.query.optionLastChange": "最后变更",
  "zabbix.query.optionSeverity": "严重性",
  "zabbix.query.optionUnacknowledged": "未确认",
  "zabbix.annotation.minSeverity": "最低严重性",
  "zabbix.annotation.showOk": "显示 OK 事件",
  "zabbix.annotation.hideAcknowledged": "隐藏已确认",
  "zabbix.annotation.showHostname": "显示主机名",
  "zabbix.variable.type": "变量类型",
  "zabbix.variable.legacyReadonly": "旧版查询（只读）",
  "zabbix.variable.legacyDescription": "旧版点路径 / 花括号语法已解析为只读回显，请新建变量迁移到结构化类型。",
  "zabbix.variable.showDisabled": "显示已禁用",
  "zabbix.services.slaStatus": "状态",
  "zabbix.services.sli": "SLI",
  "zabbix.services.uptime": "正常时长",
  "zabbix.services.downtime": "故障时长",
  "zabbix.services.errorBudget": "错误预算",
  "zabbix.services.noInterval": "无间隔",
  "zabbix.services.auto": "自动",
  "zabbix.services.oneHour": "1 小时",
  "zabbix.services.twelveHours": "12 小时",
  "zabbix.services.oneDay": "24 小时",
  "zabbix.services.oneWeek": "1 周",
  "zabbix.services.oneMonth": "1 月",
  "zabbix.panel.noProblems": "未找到问题",
  "zabbix.panel.empty": "当前筛选条件下没有 Zabbix 问题",
  "zabbix.panel.count": "问题 {count}",
  "zabbix.panel.actionNote": "动作备注",
  "zabbix.panel.submitted": "已提交",
  "zabbix.panel.maintenance": "维护中",
  "zabbix.panel.externalLink": "外链",
  "zabbix.panel.ackCount": "确认 {count}",
  "zabbix.panel.details": "问题详情",
  "zabbix.panel.viewMetrics": "查看指标",
  "zabbix.panel.event": "事件",
  "zabbix.panel.hostLabel": "主机",
  "zabbix.panel.groupsLabel": "主机组",
  "zabbix.panel.tagsLabel": "标签",
  "zabbix.panel.opdataLabel": "运维数据",
  "zabbix.panel.timeCol": "时间",
  "zabbix.panel.statusCol": "状态",
  "zabbix.panel.statusIconCol": "图标",
  "zabbix.panel.techNameCol": "技术名",
  "zabbix.panel.ageCol": "年龄",
  "zabbix.panel.ackCol": "确认",
  "zabbix.panel.datasourceCol": "数据源",
  "zabbix.panel.actionsCol": "动作",
  "zabbix.panel.expressionLabel": "表达式",
  "zabbix.panel.historyValueLabel": "历史值",
  "zabbix.panel.manualCloseLabel": "手动关闭",
  "zabbix.panel.suppressedLabel": "抑制",
  "zabbix.panel.allowed": "允许",
  "zabbix.panel.itemsCount": "监控项 ({count})",
  "zabbix.panel.alertsCount": "告警 ({count})",
  "zabbix.panel.eventsCount": "事件 ({count})",
  "zabbix.panel.suppressionCount": "抑制明细 ({count})",
  "zabbix.panel.acknowledgesCount": "确认记录 ({count})",
  "zabbix.panel.noItems": "无关联监控项",
  "zabbix.panel.noAlerts": "无告警记录",
  "zabbix.panel.noEvents": "无额外事件列表",
  "zabbix.panel.noSuppression": "无抑制记录",
  "zabbix.panel.until": "直到",
  "zabbix.panel.forever": "无限期",
  "zabbix.panel.noAcknowledgements": "无确认记录",
  "zabbix.panel.resetColumns": "重置列宽",
  "zabbix.panel.customColumns": "已自定义 {count} 列",
  "zabbix.panel.severityColor": "严重性颜色",
  "zabbix.panel.name": "Zabbix 问题",
  "zabbix.panel.category.display": "显示",
  "zabbix.panel.category.field": "字段",
  "zabbix.panel.category.severity": "严重级别",
  "zabbix.panel.category.security": "安全",
  "zabbix.panel.category.action": "动作",
  "zabbix.panel.category.layout": "布局",
  "zabbix.panel.option.layout": "布局",
  "zabbix.panel.option.table": "表格",
  "zabbix.panel.option.list": "列表",
  "zabbix.panel.option.sortProblems": "排序",
  "zabbix.panel.option.lastchange": "最后变更",
  "zabbix.panel.option.fontSize": "字号",
  "zabbix.panel.option.pageSize": "每页条数",
  "zabbix.panel.option.problemTimeline": "问题时间线",
  "zabbix.panel.option.highlightBackground": "高亮背景",
  "zabbix.panel.option.highlightNewEvents": "高亮新事件",
  "zabbix.panel.option.highlightNewerThan": "新事件阈值",
  "zabbix.panel.option.customLastChangeFormat": "自定义时间格式",
  "zabbix.panel.option.lastChangeFormat": "时间格式",
  "zabbix.panel.option.markAckEvents": "标记已确认事件",
  "zabbix.panel.option.hostField": "主机",
  "zabbix.panel.option.hostTechNameField": "主机技术名",
  "zabbix.panel.option.hostGroups": "主机组",
  "zabbix.panel.option.hostProxy": "代理",
  "zabbix.panel.option.showTags": "标签",
  "zabbix.panel.option.statusField": "状态",
  "zabbix.panel.option.statusIcon": "状态图标",
  "zabbix.panel.option.severityField": "严重性",
  "zabbix.panel.option.ackField": "确认",
  "zabbix.panel.option.ageField": "年龄",
  "zabbix.panel.option.opdataField": "运行数据",
  "zabbix.panel.option.descriptionField": "描述",
  "zabbix.panel.option.descriptionAtNewLine": "描述换行",
  "zabbix.panel.option.showDatasourceName": "数据源名",
  "zabbix.panel.option.customTagColumns": "标签列",
  "zabbix.panel.option.triggerSeverity": "严重性颜色",
  "zabbix.panel.option.resizedColumns": "列宽",
  "zabbix.panel.option.allowDangerousHTML": "允许危险 HTML",
  "zabbix.panel.option.allowAcknowledge": "允许确认",
  "zabbix.panel.option.allowUnacknowledge": "允许取消确认",
  "zabbix.panel.option.allowClose": "允许关闭",
  "zabbix.panel.option.allowChangeSeverity": "允许改严重级别",
  "zabbix.panel.option.allowSuppress": "允许抑制",
  "zabbix.panel.option.allowUnsuppress": "允许取消抑制",
  "zabbix.panel.option.allowExecuteScripts": "允许执行脚本",
  "zabbix.panel.option.showDetails": "显示详情",
  "zabbix.panel.option.okEventColor": "OK 颜色",
  "zabbix.panel.option.ackEventColor": "确认颜色",
  "zabbix.panel.timeline": "问题时间线",
  "zabbix.panel.timelineEmpty": "无事件时间线",
  "zabbix.panel.problemState": "问题",
  "zabbix.panel.okState": "正常",
  "zabbix.panel.resolvedState": "已恢复",
  "zabbix.panel.acknowledgedState": "已确认",
  "zabbix.panel.hostMaintenance": "主机处于维护",
  "zabbix.panel.triggerUrl": "触发器 URL",
  "zabbix.panel.multiTrigger": "多事件触发器",
  "zabbix.panel.correlationClosed": "关联关闭标签: {tag}",
  "zabbix.panel.alertActions": "告警动作 {count}",
  "zabbix.panel.unknownState": "状态未知",
  "zabbix.panel.triggerError": "触发器错误: {error}",
  "zabbix.panel.manualCloseAllowed": "允许手动关闭",
  "zabbix.panel.previous": "上一页",
  "zabbix.panel.next": "下一页",
  "zabbix.panel.acknowledge": "确认",
  "zabbix.panel.unacknowledge": "取消确认",
  "zabbix.panel.close": "关闭",
  "zabbix.panel.changeSeverity": "严重性",
  "zabbix.panel.suppress": "抑制",
  "zabbix.panel.unsuppress": "取消抑制",
  "zabbix.panel.script": "脚本",
  "zabbix.panel.acknowledgeQuestion": "{action}问题 {eventid}？",
  "zabbix.panel.ackMessage": "动作备注",
  "zabbix.panel.ackProblem": "确认问题",
  "zabbix.panel.closeProblem": "关闭问题",
  "zabbix.panel.closeBlocked": "当前触发器不允许手动关闭",
  "zabbix.panel.actionMask": "动作掩码 = {mask}",
  "zabbix.panel.suppressUntil": "抑制至 (Unix，0=无限期)",
  "zabbix.panel.suppressDeadline": "抑制截止时间",
  "zabbix.panel.scriptRun": "对 {host} 执行脚本",
  "zabbix.panel.scriptLoading": "正在加载 script.get…",
  "zabbix.panel.scriptLoadError": "当前数据源无法加载脚本列表",
  "zabbix.panel.scriptLoadFailed": "加载脚本失败",
  "zabbix.panel.chooseScript": "选择脚本",
  "zabbix.panel.chooseScriptOption": "请选择脚本",
  "zabbix.panel.noScripts": "无可用脚本",
  "zabbix.panel.scriptConfirmation": "确认",
  "zabbix.panel.scriptScope": "范围",
  "zabbix.panel.scriptAccess": "访问",
  "zabbix.panel.scriptDescription": "说明",
  "zabbix.config.connection": "Zabbix 连接",
  "zabbix.config.url": "URL",
  "zabbix.config.authType": "认证方式",
  "zabbix.config.apiToken": "API Token",
  "zabbix.config.username": "用户名",
  "zabbix.config.password": "密码",
  "zabbix.config.credentialTip": "凭据仅保存在运行时内存，不会写入 jsonData、URL 或日志",
  "zabbix.config.credentialConfigured": "已配置凭据",
  "zabbix.config.credentialMissing": "未配置凭据",
  "zabbix.config.clearCredentials": "清除凭据",
  "zabbix.config.additional": "附加设置",
  "zabbix.config.apiQueryTrends": "Zabbix API / 查询 / 趋势",
  "zabbix.config.enableTrends": "启用趋势",
  "zabbix.config.trendsFrom": "趋势起始",
  "zabbix.config.trendsRange": "趋势范围",
  "zabbix.config.cacheTtl": "缓存 TTL",
  "zabbix.config.timeout": "连接超时（秒）",
  "zabbix.config.queryTimeout": "查询超时（秒）",
  "zabbix.config.millisecondsHint": "{path}，内部以毫秒存储",
  "zabbix.config.directDb": "Direct DB",
  "zabbix.config.enableDirectDb": "启用 Direct DB",
  "zabbix.config.databaseDatasource": "数据库数据源",
  "zabbix.config.databasePlaceholder": "选择 PostgreSQL / MySQL / InfluxDB",
  "zabbix.config.directDbCandidates": "Direct DB 候选项",
  "zabbix.config.retentionPolicy": "Retention Policy",
  "zabbix.config.permissionsWrites": "权限与写操作",
  "zabbix.config.disableReadonlyAck": "禁止只读用户确认问题",
  "zabbix.config.disableAlignment": "禁用数据对齐",
  "zabbix.config.enableWrites": "启用写操作（确认/关闭/脚本）",
  "zabbix.config.writeRisk": "写操作风险",
  "zabbix.config.writeRiskDetail": "写操作需服务端另配 ZABBIX_LIVE_WRITES=1，且账号具备对应权限。请谨慎开启。",
  "zabbix.config.rpcTuning": "高级 RPC 调优",
  "zabbix.config.authPlacement": "认证位置",
  "zabbix.config.autoDetect": "自动探测",
  "zabbix.config.requestBody": "请求体",
  "zabbix.config.requestHeader": "请求头",
  "zabbix.config.historyPageLimit": "历史分页大小",
  "zabbix.config.historyBatchSize": "历史批大小",
  "zabbix.config.historyConcurrency": "历史并发数",
  "zabbix.config.metadataPageLimit": "元数据分页大小",
  "zabbix.capability.connection": "连接",
  "zabbix.capability.authentication": "认证",
  "zabbix.capability.cacheTrends": "缓存与趋势",
  "zabbix.capability.limits": "限制",
  "zabbix.capability.writes": "写操作",
  "zabbix.capability.defaultProfile": "默认",
  "zabbix.capability.metrics": "指标",
  "zabbix.capability.metricsNotes": "含 LLD：queryType 0 + executionMode lld",
  "zabbix.capability.textMetrics": "文本指标",
  "zabbix.capability.userMacros": "用户宏",
  "zabbix.capability.lld": "低级发现 (LLD)",
  "zabbix.capability.lldNotes": "queryType 0 + executionMode lld，非独立 queryType",
  "zabbix.capability.annotation": "注解",
  "zabbix.capability.variable": "变量",
  "zabbix.capability.numericHistory": "数值历史",
  "zabbix.capability.trendAggregation": "趋势聚合",
  "zabbix.capability.latestScalar": "最新标量",
  "zabbix.capability.statusSamples": "状态采样",
  "zabbix.capability.logText": "日志/文本",
  "zabbix.capability.problemEvents": "问题/触发器事件",
  "zabbix.capability.serviceSla": "服务/SLA",
  "zabbix.capability.lowLevelDiscovery": "低级发现",
  "zabbix.error.requiredUrl": "请填写 Zabbix URL",
  "zabbix.error.directDbUid": "Direct DB 已启用，请选择数据源 UID",
  "zabbix.error.directDbNotFound": "找不到 Direct DB 数据源 {uid}",
  "zabbix.error.directDbIdNotFound": "找不到 id 为 {id} 的 Direct DB 数据源",
  "zabbix.error.directDbUnsupported": "数据源类型 {type} 不支持作为 Direct DB",
  "zabbix.error.cacheTtl": "缓存 TTL 必须是合法 duration，例如 1h / 5m / 30s",
  "zabbix.error.timeout": "超时必须为正整数（秒）",
  "zabbix.error.queryTimeout": "查询超时必须为正整数（秒）",
  "zabbix.error.itemCount": "监控项数量过多",
  "zabbix.error.itemCountDetail": "此查询匹配 {count} 个监控项，可能返回大量数据，请缩小筛选范围。",
  "zabbix.error.timeRange": "时间范围过大",
  "zabbix.error.timeRangeDetail": "当前选择的时间范围为 {duration}。该查询可能返回大量数据并耗时较长。",
  "zabbix.error.regexAll": "请使用 /.*/ 匹配全部",
  "zabbix.error.regexEnd": "正则必须以 / 结尾",
  "zabbix.error.actionNotSupported": "当前数据源不支持动作",
  "zabbix.error.actionFailed": "动作失败",
  "zabbix.error.scriptRequired": "scriptid 必填",
  "zabbix.error.panelActionDisabled": "面板未启用动作 {action}",
  "zabbix.error.writesDisabled": "数据源未开启 enableWrites",
  "zabbix.error.liveWritesDisabled": "未设置 ZABBIX_LIVE_WRITES=1",
  "zabbix.error.userReadonly": "当前用户只读或无写权限",
  "zabbix.error.manualCloseUnsupported": "事件/触发器不允许 manual_close",
  "zabbix.error.scriptNotSelected": "未选择脚本（禁止默认 scriptid=1）",
  "zabbix.error.scriptRequiredNoDefault": "scriptid 必填（禁止默认 scriptid=1）",
  "zabbix.error.requestTimeout": "数据源请求在 {timeout}ms 后超时",
  "zabbix.error.unknownMetadata": "未知 metadata 请求: {request}",
  "zabbix.error.unsupportedAction": "不支持的动作: {action}",
  "zabbix.error.invalidInterval": "非法 interval: {value}",
  "zabbix.error.invalidAliasRegex": "{function} 正则无效",
  "zabbix.error.unknownTransform": "未知 transform 函数: {name}",
  "zabbix.error.unsupportedQueryType": "不支持的 Zabbix queryType: {queryType}",
  "zabbix.error.unknownQueryType": "未知 queryType: {queryType}",
  "zabbix.error.lldRuleRequired": "LLD 模式必须提供 ruleId",
  "zabbix.error.lldPrototypeRequired": "LLD 模式必须提供监控项原型 ID 或键",
  "zabbix.error.lldSelectionRequired": "LLD 模式必须提供 prototype ID、prototype key 或 discovered item ID",
  "zabbix.error.lldParentMissing": "发现的监控项缺少 itemDiscovery.parent_itemid，无法匹配原型",
  "zabbix.error.itemIdsEmpty": "itemids 不能为空",
  "zabbix.error.itemIdNumeric": "itemid 必须为数字",
  "zabbix.error.itemCountLimit": "监控项数量不能超过 500",
  "zabbix.error.directDbItemIdNumeric": "Direct DB itemid 必须为数字",
  "zabbix.error.directDbUidRequired": "Direct DB 数据源 UID 必填",
  "zabbix.error.directDbGatewayMissing": "uid={uid} 缺少 Direct DB 网关",
  "zabbix.error.directDbUidNotUnique": "Direct DB 数据源 UID 不唯一: {uid}",
  "zabbix.error.directDbQueryMissing": "Direct DB 网关不支持查询: {uid}",
  "zabbix.error.directDbOfflineRefused": "Direct DB 拒绝离线/种子数据源类型: {type}",
  "zabbix.error.directDbFixtureRefused": "Direct DB 拒绝 fixture 模式 SQL 数据源",
  "zabbix.error.directDbTypeUnsupported": "不支持的 Direct DB 类型: {type}",
  "zabbix.error.directDbNumericOnly": "Direct DB 仅支持数值 value_type 0/3；监控项 {itemid} 的类型为 {valueType}",
  "zabbix.error.directDbTrendsNumericOnly": "趋势仅支持 value_type 0/3",
  "zabbix.error.directDbEnabledUidMissing": "Direct DB 已启用但数据源 UID 缺失",
  "zabbix.error.directDbTrendsUnsupported": "Direct DB 趋势不支持 value_type {valueType}",
  "zabbix.error.trendsUnsupported": "趋势（trend）不支持 value_type {valueType}（{name}）",
  "zabbix.error.historyTruncated": "历史结果已截断：达到分页上限或最大行数",
  "zabbix.error.itemValueTypeMissing": "监控项 value_type 缺失",
  "zabbix.error.unsupportedValueType": "不支持的 Zabbix value_type: {valueType}",
  "zabbix.error.unsignedParseFailed": "无符号整数解析失败，Value 保持为空",
  "zabbix.error.apiTokenUnsupported": "当前 Zabbix 版本不支持 API token",
  "zabbix.error.authPlacementUnknown": "无法确定 API token 认证位置",
  "zabbix.error.runtimeCredentialRequired": "Zabbix 需要运行时凭据（token 或用户名密码）",
  "zabbix.error.apiTokenEmpty": "Zabbix API token 为空",
  "zabbix.error.credentialInvalid": "Zabbix 凭据类型不受支持或字段不完整",
  "zabbix.error.invalidRpcResponse": "Zabbix 返回无效 JSON-RPC 响应",
  "zabbix.error.rpcIdMismatch": "Zabbix JSON-RPC id 不匹配",
  "zabbix.error.rpcResultMissing": "Zabbix JSON-RPC 缺少 result",
  "zabbix.error.rpcError": "Zabbix RPC 错误",
  "zabbix.health.fixtureAvailable": "Zabbix fixture 模式可用",
  "zabbix.health.authenticated": "Zabbix {version} 认证成功",
  "zabbix.action.acknowledged": "已确认",
  "zabbix.action.scriptExecuted": "脚本已执行",
  "zabbix.action.fixturePreview": "fixture 预览",
  "zabbix.panel.filteredMissingEventId": "已过滤缺少 eventid 的问题行"
};
const ZABBIX_I18N_EN_US = {
  "zabbix.common.group": "Host group",
  "zabbix.common.host": "Host",
  "zabbix.common.application": "Application",
  "zabbix.common.item": "Item",
  "zabbix.common.itemId": "Item ID",
  "zabbix.common.itemTag": "Item tag",
  "zabbix.common.hostTag": "Host tag",
  "zabbix.common.proxy": "Proxy",
  "zabbix.common.trigger": "Trigger",
  "zabbix.common.problem": "Problem",
  "zabbix.common.problems": "Problems",
  "zabbix.common.severity": "Severity",
  "zabbix.common.minSeverity": "Min severity",
  "zabbix.common.tags": "Tags",
  "zabbix.common.macro": "Macro",
  "zabbix.common.service": "Service",
  "zabbix.common.sla": "SLA",
  "zabbix.common.property": "Property",
  "zabbix.common.interval": "Interval",
  "zabbix.common.functions": "Functions",
  "zabbix.common.legend": "Legend",
  "zabbix.common.options": "Options",
  "zabbix.common.default": "Default",
  "zabbix.common.all": "All",
  "zabbix.common.true": "True",
  "zabbix.common.false": "False",
  "zabbix.common.loading": "Loading…",
  "zabbix.common.retry": "Retry",
  "zabbix.common.cancel": "Cancel",
  "zabbix.common.confirm": "Confirm",
  "zabbix.common.close": "Close",
  "zabbix.common.execute": "Execute",
  "zabbix.common.remove": "Remove",
  "zabbix.common.previous": "Previous",
  "zabbix.common.next": "Next",
  "zabbix.common.unknown": "Unknown",
  "zabbix.common.none": "None",
  "zabbix.common.yes": "Yes",
  "zabbix.common.no": "No",
  "zabbix.common.notClassified": "Not classified",
  "zabbix.common.information": "Information",
  "zabbix.common.warning": "Warning",
  "zabbix.common.average": "Average",
  "zabbix.common.high": "High",
  "zabbix.common.disaster": "Disaster",
  "zabbix.query.queryType": "Query type",
  "zabbix.query.metric": "Metrics",
  "zabbix.query.itService": "IT services",
  "zabbix.query.text": "Text",
  "zabbix.query.run": "Run query",
  "zabbix.query.runAria": "Run query",
  "zabbix.query.legendPlaceholder": "{{item}}",
  "zabbix.query.textFilter": "Text filter",
  "zabbix.query.useCaptureGroups": "Use capture groups",
  "zabbix.query.countBy": "Count by",
  "zabbix.query.allTriggers": "All triggers",
  "zabbix.query.items": "Items",
  "zabbix.query.onlyCount": "Count only",
  "zabbix.query.lastValue": "Last value",
  "zabbix.query.serviceStatus": "Service status",
  "zabbix.query.countFrame": "Count {refId}",
  "zabbix.query.triggersFrame": "Triggers {refId}",
  "zabbix.duration.days": "{count} days",
  "zabbix.duration.years": "{count} years",
  "zabbix.duration.yearsDays": "{years} years {days} days",
  "zabbix.query.problemFilter": "Problem filter",
  "zabbix.query.problemNameFilter": "Problem name filter",
  "zabbix.query.show": "Show",
  "zabbix.query.recentProblems": "Recent problems",
  "zabbix.query.history": "History",
  "zabbix.query.hostTags": "Host tags",
  "zabbix.query.tagsEval": "Tags eval",
  "zabbix.query.andOr": "AND/OR",
  "zabbix.query.or": "OR",
  "zabbix.query.allSeverity": "All severities",
  "zabbix.query.addHostTag": "Host tag",
  "zabbix.query.addHostTagAria": "Add new host tag filter",
  "zabbix.query.removeHostTagAria": "Remove host tag filter",
  "zabbix.query.hostTagEvalAria": "Host tag evaluation type",
  "zabbix.query.operatorContains": "Contains",
  "zabbix.query.operatorEquals": "Equals",
  "zabbix.query.operatorNotContains": "Does not contain",
  "zabbix.query.operatorNotLike": "Not like",
  "zabbix.query.operatorNotEquals": "Does not equal",
  "zabbix.query.operatorExists": "Exists",
  "zabbix.query.operatorNotExists": "Does not exist",
  "zabbix.query.tagPlaceholder": "tag",
  "zabbix.query.valuePlaceholder": "value",
  "zabbix.query.itemIds": "Item IDs (comma separated)",
  "zabbix.query.functionsAdd": "Add function",
  "zabbix.query.functionUnknown": "Unknown function",
  "zabbix.query.functionMoveLeft": "Move left",
  "zabbix.query.functionMoveRight": "Move right",
  "zabbix.query.functionDelete": "Delete",
  "zabbix.query.functionCategoryTransform": "Transform",
  "zabbix.query.functionCategoryAggregate": "Aggregate",
  "zabbix.query.functionCategoryFilter": "Filter",
  "zabbix.query.functionCategoryTrends": "Trends",
  "zabbix.query.functionCategoryTime": "Time",
  "zabbix.query.functionCategoryAlias": "Alias",
  "zabbix.query.functionCategorySpecial": "Special",
  "zabbix.query.lldRule": "Discovery rule (LLD)",
  "zabbix.query.lldRulePlaceholder": "Select discovery rule",
  "zabbix.query.lldPrototype": "Item prototypes",
  "zabbix.query.lldPrototypePlaceholder": "Select item prototypes",
  "zabbix.query.lldEmpty": "No discovery rules",
  "zabbix.query.filterPlaceholder": "Select or enter a filter",
  "zabbix.query.metricPlaceholder": "Select or enter",
  "zabbix.query.regexAllError": "Use /.*/ to match all",
  "zabbix.query.regexError": "Regex must end with /",
  "zabbix.query.acknowledgeProblem": "Acknowledge problem",
  "zabbix.query.executeScript": "Execute script",
  "zabbix.query.explore": "Explore",
  "zabbix.query.tagFilterHint": "Click to add tag filter; Ctrl/Shift+click to remove",
  "zabbix.query.noExtraOptions": "No extra options",
  "zabbix.query.optionTrends": "Trends",
  "zabbix.query.optionShowDisabled": "Show disabled items",
  "zabbix.query.optionValueMapping": "Use Zabbix value mapping",
  "zabbix.query.optionAlignment": "Disable data alignment",
  "zabbix.query.optionSkipEmpty": "Skip empty values",
  "zabbix.query.optionSortProblems": "Sort problems",
  "zabbix.query.optionAcknowledged": "Acknowledged",
  "zabbix.query.optionMaintenance": "Hosts in maintenance",
  "zabbix.query.optionShowProxy": "Show proxy",
  "zabbix.query.optionLimit": "Limit",
  "zabbix.query.optionTimeRange": "Use time range",
  "zabbix.query.optionHistorical": "Historical item value",
  "zabbix.query.optionCount": "Count only",
  "zabbix.query.optionLastChange": "Last change",
  "zabbix.query.optionSeverity": "Severity",
  "zabbix.query.optionUnacknowledged": "Unacknowledged",
  "zabbix.annotation.minSeverity": "Min severity",
  "zabbix.annotation.showOk": "Show OK events",
  "zabbix.annotation.hideAcknowledged": "Hide acknowledged",
  "zabbix.annotation.showHostname": "Show hostname",
  "zabbix.variable.type": "Variable type",
  "zabbix.variable.legacyReadonly": "Legacy query (read-only)",
  "zabbix.variable.legacyDescription": "The legacy dot-path / brace syntax was parsed as a read-only preview. Create a new variable using a structured type.",
  "zabbix.variable.showDisabled": "Show disabled",
  "zabbix.services.slaStatus": "Status",
  "zabbix.services.sli": "SLI",
  "zabbix.services.uptime": "Uptime",
  "zabbix.services.downtime": "Downtime",
  "zabbix.services.errorBudget": "Error budget",
  "zabbix.services.noInterval": "No interval",
  "zabbix.services.auto": "Auto",
  "zabbix.services.oneHour": "1 hour",
  "zabbix.services.twelveHours": "12 hours",
  "zabbix.services.oneDay": "24 hours",
  "zabbix.services.oneWeek": "1 week",
  "zabbix.services.oneMonth": "1 month",
  "zabbix.panel.noProblems": "No problems found",
  "zabbix.panel.empty": "No Zabbix problems match the current filters",
  "zabbix.panel.count": "Problems {count}",
  "zabbix.panel.actionNote": "Action note",
  "zabbix.panel.submitted": "Submitted",
  "zabbix.panel.maintenance": "In maintenance",
  "zabbix.panel.externalLink": "External link",
  "zabbix.panel.ackCount": "Acknowledged {count}",
  "zabbix.panel.details": "Problem details",
  "zabbix.panel.viewMetrics": "View metrics",
  "zabbix.panel.event": "Event",
  "zabbix.panel.hostLabel": "Host",
  "zabbix.panel.groupsLabel": "Host groups",
  "zabbix.panel.tagsLabel": "Tags",
  "zabbix.panel.opdataLabel": "Operational data",
  "zabbix.panel.timeCol": "Time",
  "zabbix.panel.statusCol": "Status",
  "zabbix.panel.statusIconCol": "Icon",
  "zabbix.panel.techNameCol": "Tech name",
  "zabbix.panel.ageCol": "Age",
  "zabbix.panel.ackCol": "Ack",
  "zabbix.panel.datasourceCol": "Datasource",
  "zabbix.panel.actionsCol": "Actions",
  "zabbix.panel.expressionLabel": "Expression",
  "zabbix.panel.historyValueLabel": "Historical value",
  "zabbix.panel.manualCloseLabel": "Manual close",
  "zabbix.panel.suppressedLabel": "Suppressed",
  "zabbix.panel.allowed": "Allowed",
  "zabbix.panel.itemsCount": "Items ({count})",
  "zabbix.panel.alertsCount": "Alerts ({count})",
  "zabbix.panel.eventsCount": "Events ({count})",
  "zabbix.panel.suppressionCount": "Suppression details ({count})",
  "zabbix.panel.acknowledgesCount": "Acknowledgements ({count})",
  "zabbix.panel.noItems": "No related items",
  "zabbix.panel.noAlerts": "No alert records",
  "zabbix.panel.noEvents": "No additional events",
  "zabbix.panel.noSuppression": "No suppression records",
  "zabbix.panel.until": "until",
  "zabbix.panel.forever": "indefinitely",
  "zabbix.panel.noAcknowledgements": "No acknowledgements",
  "zabbix.panel.resetColumns": "Reset column widths",
  "zabbix.panel.customColumns": "{count} customized columns",
  "zabbix.panel.severityColor": "Severity color",
  "zabbix.panel.name": "Zabbix Problems",
  "zabbix.panel.category.display": "Display",
  "zabbix.panel.category.field": "Fields",
  "zabbix.panel.category.severity": "Severity",
  "zabbix.panel.category.security": "Security",
  "zabbix.panel.category.action": "Actions",
  "zabbix.panel.category.layout": "Layout",
  "zabbix.panel.option.layout": "Layout",
  "zabbix.panel.option.table": "Table",
  "zabbix.panel.option.list": "List",
  "zabbix.panel.option.sortProblems": "Sort",
  "zabbix.panel.option.lastchange": "Last change",
  "zabbix.panel.option.fontSize": "Font size",
  "zabbix.panel.option.pageSize": "Page size",
  "zabbix.panel.option.problemTimeline": "Problem timeline",
  "zabbix.panel.option.highlightBackground": "Highlight background",
  "zabbix.panel.option.highlightNewEvents": "Highlight new events",
  "zabbix.panel.option.highlightNewerThan": "New event threshold",
  "zabbix.panel.option.customLastChangeFormat": "Custom time format",
  "zabbix.panel.option.lastChangeFormat": "Time format",
  "zabbix.panel.option.markAckEvents": "Mark acknowledged events",
  "zabbix.panel.option.hostField": "Host",
  "zabbix.panel.option.hostTechNameField": "Host technical name",
  "zabbix.panel.option.hostGroups": "Host groups",
  "zabbix.panel.option.hostProxy": "Proxy",
  "zabbix.panel.option.showTags": "Tags",
  "zabbix.panel.option.statusField": "Status",
  "zabbix.panel.option.statusIcon": "Status icon",
  "zabbix.panel.option.severityField": "Severity",
  "zabbix.panel.option.ackField": "Acknowledgement",
  "zabbix.panel.option.ageField": "Age",
  "zabbix.panel.option.opdataField": "Operational data",
  "zabbix.panel.option.descriptionField": "Description",
  "zabbix.panel.option.descriptionAtNewLine": "Description on new line",
  "zabbix.panel.option.showDatasourceName": "Data source name",
  "zabbix.panel.option.customTagColumns": "Tag columns",
  "zabbix.panel.option.triggerSeverity": "Severity colors",
  "zabbix.panel.option.resizedColumns": "Column widths",
  "zabbix.panel.option.allowDangerousHTML": "Allow dangerous HTML",
  "zabbix.panel.option.allowAcknowledge": "Allow acknowledge",
  "zabbix.panel.option.allowUnacknowledge": "Allow unacknowledge",
  "zabbix.panel.option.allowClose": "Allow close",
  "zabbix.panel.option.allowChangeSeverity": "Allow severity change",
  "zabbix.panel.option.allowSuppress": "Allow suppress",
  "zabbix.panel.option.allowUnsuppress": "Allow unsuppress",
  "zabbix.panel.option.allowExecuteScripts": "Allow script execution",
  "zabbix.panel.option.showDetails": "Show details",
  "zabbix.panel.option.okEventColor": "OK color",
  "zabbix.panel.option.ackEventColor": "Acknowledgement color",
  "zabbix.panel.timeline": "Problem timeline",
  "zabbix.panel.timelineEmpty": "No event timeline",
  "zabbix.panel.problemState": "Problem",
  "zabbix.panel.okState": "OK",
  "zabbix.panel.resolvedState": "Resolved",
  "zabbix.panel.acknowledgedState": "Acknowledged",
  "zabbix.panel.hostMaintenance": "Host in maintenance",
  "zabbix.panel.triggerUrl": "Trigger URL",
  "zabbix.panel.multiTrigger": "Multiple-event trigger",
  "zabbix.panel.correlationClosed": "Correlation close tag: {tag}",
  "zabbix.panel.alertActions": "Alert actions {count}",
  "zabbix.panel.unknownState": "Unknown state",
  "zabbix.panel.triggerError": "Trigger error: {error}",
  "zabbix.panel.manualCloseAllowed": "Manual close allowed",
  "zabbix.panel.previous": "Previous",
  "zabbix.panel.next": "Next",
  "zabbix.panel.acknowledge": "Acknowledge",
  "zabbix.panel.unacknowledge": "Unacknowledge",
  "zabbix.panel.close": "Close",
  "zabbix.panel.changeSeverity": "Severity",
  "zabbix.panel.suppress": "Suppress",
  "zabbix.panel.unsuppress": "Unsuppress",
  "zabbix.panel.script": "Script",
  "zabbix.panel.acknowledgeQuestion": "{action} problem {eventid}?",
  "zabbix.panel.ackMessage": "Action note",
  "zabbix.panel.ackProblem": "Acknowledge problem",
  "zabbix.panel.closeProblem": "Close problem",
  "zabbix.panel.closeBlocked": "This trigger does not allow manual close",
  "zabbix.panel.actionMask": "Action mask = {mask}",
  "zabbix.panel.suppressUntil": "Suppress until (Unix, 0 = indefinitely)",
  "zabbix.panel.suppressDeadline": "Suppression deadline",
  "zabbix.panel.scriptRun": "Run script on {host}",
  "zabbix.panel.scriptLoading": "Loading script.get…",
  "zabbix.panel.scriptLoadError": "The current data source cannot load scripts",
  "zabbix.panel.scriptLoadFailed": "Failed to load scripts",
  "zabbix.panel.chooseScript": "Select script",
  "zabbix.panel.chooseScriptOption": "Select a script",
  "zabbix.panel.noScripts": "No scripts available",
  "zabbix.panel.scriptConfirmation": "Confirmation",
  "zabbix.panel.scriptScope": "Scope",
  "zabbix.panel.scriptAccess": "Access",
  "zabbix.panel.scriptDescription": "Description",
  "zabbix.config.connection": "Zabbix connection",
  "zabbix.config.url": "URL",
  "zabbix.config.authType": "Authentication",
  "zabbix.config.apiToken": "API token",
  "zabbix.config.username": "Username",
  "zabbix.config.password": "Password",
  "zabbix.config.credentialTip": "Credentials stay in runtime memory and are never written to jsonData, the URL, or logs",
  "zabbix.config.credentialConfigured": "Credentials configured",
  "zabbix.config.credentialMissing": "No credentials configured",
  "zabbix.config.clearCredentials": "Clear credentials",
  "zabbix.config.additional": "Additional settings",
  "zabbix.config.apiQueryTrends": "Zabbix API / query / trends",
  "zabbix.config.enableTrends": "Enable trends",
  "zabbix.config.trendsFrom": "Trends start",
  "zabbix.config.trendsRange": "Trends range",
  "zabbix.config.cacheTtl": "Cache TTL",
  "zabbix.config.timeout": "Connection timeout (seconds)",
  "zabbix.config.queryTimeout": "Query timeout (seconds)",
  "zabbix.config.millisecondsHint": "{path}; stored internally in milliseconds",
  "zabbix.config.directDb": "Direct DB",
  "zabbix.config.enableDirectDb": "Enable Direct DB",
  "zabbix.config.databaseDatasource": "Database data source",
  "zabbix.config.databasePlaceholder": "Select PostgreSQL / MySQL / InfluxDB",
  "zabbix.config.directDbCandidates": "Direct DB candidates",
  "zabbix.config.retentionPolicy": "Retention policy",
  "zabbix.config.permissionsWrites": "Permissions and writes",
  "zabbix.config.disableReadonlyAck": "Prevent read-only users from acknowledging problems",
  "zabbix.config.disableAlignment": "Disable data alignment",
  "zabbix.config.enableWrites": "Enable writes (acknowledge/close/script)",
  "zabbix.config.writeRisk": "Write operation risk",
  "zabbix.config.writeRiskDetail": "Writes require ZABBIX_LIVE_WRITES=1 on the server and the account must have the required permissions. Enable with care.",
  "zabbix.config.rpcTuning": "Advanced RPC tuning",
  "zabbix.config.authPlacement": "Authentication placement",
  "zabbix.config.autoDetect": "Auto-detect",
  "zabbix.config.requestBody": "Request body",
  "zabbix.config.requestHeader": "Request header",
  "zabbix.config.historyPageLimit": "History page size",
  "zabbix.config.historyBatchSize": "History batch size",
  "zabbix.config.historyConcurrency": "History concurrency",
  "zabbix.config.metadataPageLimit": "Metadata page size",
  "zabbix.capability.connection": "Connection",
  "zabbix.capability.authentication": "Authentication",
  "zabbix.capability.cacheTrends": "Cache and trends",
  "zabbix.capability.limits": "Limits",
  "zabbix.capability.writes": "Writes",
  "zabbix.capability.defaultProfile": "Default",
  "zabbix.capability.metrics": "Metrics",
  "zabbix.capability.metricsNotes": "Includes LLD: queryType 0 + executionMode lld",
  "zabbix.capability.textMetrics": "Text metrics",
  "zabbix.capability.userMacros": "User macros",
  "zabbix.capability.lld": "Low-level discovery (LLD)",
  "zabbix.capability.lldNotes": "queryType 0 + executionMode lld; not a separate queryType",
  "zabbix.capability.annotation": "Annotation",
  "zabbix.capability.variable": "Variable",
  "zabbix.capability.numericHistory": "Numeric history",
  "zabbix.capability.trendAggregation": "Trend aggregation",
  "zabbix.capability.latestScalar": "Latest scalar",
  "zabbix.capability.statusSamples": "Status samples",
  "zabbix.capability.logText": "Log/text",
  "zabbix.capability.problemEvents": "Problem/trigger events",
  "zabbix.capability.serviceSla": "Service/SLA",
  "zabbix.capability.lowLevelDiscovery": "Low-level discovery",
  "zabbix.error.requiredUrl": "Enter a Zabbix URL",
  "zabbix.error.directDbUid": "Direct DB is enabled; select a data source UID",
  "zabbix.error.directDbNotFound": "Direct DB data source {uid} was not found",
  "zabbix.error.directDbIdNotFound": "Direct DB data source with id {id} was not found",
  "zabbix.error.directDbUnsupported": "Data source type {type} cannot be used as Direct DB",
  "zabbix.error.cacheTtl": "Cache TTL must be a valid duration, for example 1h / 5m / 30s",
  "zabbix.error.timeout": "Timeout must be a positive integer (seconds)",
  "zabbix.error.queryTimeout": "Query timeout must be a positive integer (seconds)",
  "zabbix.error.itemCount": "Too many items",
  "zabbix.error.itemCountDetail": "This query matches {count} items and may return a large response. Narrow the filter.",
  "zabbix.error.timeRange": "Time range is too large",
  "zabbix.error.timeRangeDetail": "The selected time range is {duration}. This query may return a large response and take longer.",
  "zabbix.error.regexAll": "Use /.*/ to match all",
  "zabbix.error.regexEnd": "Regex must end with /",
  "zabbix.error.actionNotSupported": "The current data source does not support this action",
  "zabbix.error.actionFailed": "Action failed",
  "zabbix.error.scriptRequired": "scriptid is required",
  "zabbix.error.panelActionDisabled": "Panel action {action} is not enabled",
  "zabbix.error.writesDisabled": "The data source has not enabled enableWrites",
  "zabbix.error.liveWritesDisabled": "ZABBIX_LIVE_WRITES=1 is not set",
  "zabbix.error.userReadonly": "The current user is read-only or lacks write permission",
  "zabbix.error.manualCloseUnsupported": "The event/trigger does not allow manual_close",
  "zabbix.error.scriptNotSelected": "No script selected (default scriptid=1 is forbidden)",
  "zabbix.error.scriptRequiredNoDefault": "scriptid is required (default scriptid=1 is forbidden)",
  "zabbix.error.requestTimeout": "Data source request timed out after {timeout}ms",
  "zabbix.error.unknownMetadata": "Unknown metadata request: {request}",
  "zabbix.error.unsupportedAction": "Unsupported action: {action}",
  "zabbix.error.invalidInterval": "Invalid interval: {value}",
  "zabbix.error.invalidAliasRegex": "Invalid regex for {function}",
  "zabbix.error.unknownTransform": "Unknown transform function: {name}",
  "zabbix.error.unsupportedQueryType": "Unsupported Zabbix queryType: {queryType}",
  "zabbix.error.unknownQueryType": "Unknown queryType: {queryType}",
  "zabbix.error.lldRuleRequired": "ruleId is required when executionMode is lld",
  "zabbix.error.lldPrototypeRequired": "At least one item prototype ID or key is required in LLD mode",
  "zabbix.error.lldSelectionRequired": "LLD requires prototype IDs, prototype keys, or discovered item IDs",
  "zabbix.error.lldParentMissing": "Discovered items are missing itemDiscovery.parent_itemid and cannot be matched to prototypes",
  "zabbix.error.itemIdsEmpty": "itemids cannot be empty",
  "zabbix.error.itemIdNumeric": "itemid must be numeric",
  "zabbix.error.itemCountLimit": "Item count exceeds 500",
  "zabbix.error.directDbItemIdNumeric": "Direct DB itemid must be numeric",
  "zabbix.error.directDbUidRequired": "Direct DB data source UID is required",
  "zabbix.error.directDbGatewayMissing": "Direct DB gateway is missing for uid={uid}",
  "zabbix.error.directDbUidNotUnique": "Direct DB data source UID is not unique: {uid}",
  "zabbix.error.directDbQueryMissing": "Direct DB gateway has no query capability: {uid}",
  "zabbix.error.directDbOfflineRefused": "Direct DB refuses offline/seed data source type: {type}",
  "zabbix.error.directDbFixtureRefused": "Direct DB refuses fixture-mode SQL data sources",
  "zabbix.error.directDbTypeUnsupported": "Unsupported Direct DB type: {type}",
  "zabbix.error.directDbNumericOnly": "Direct DB only supports numeric value_type 0/3; item {itemid} has {valueType}",
  "zabbix.error.directDbTrendsNumericOnly": "Trends are only supported for value_type 0/3",
  "zabbix.error.directDbEnabledUidMissing": "Direct DB is enabled but the data source UID is missing",
  "zabbix.error.directDbTrendsUnsupported": "Direct DB trends do not support value_type {valueType}",
  "zabbix.error.trendsUnsupported": "Trends are not supported for value_type {valueType} ({name})",
  "zabbix.error.historyTruncated": "History result truncated: page limit or max rows reached",
  "zabbix.error.itemValueTypeMissing": "Item value_type is missing",
  "zabbix.error.unsupportedValueType": "Unsupported Zabbix value_type: {valueType}",
  "zabbix.error.unsignedParseFailed": "Failed to parse unsigned integer; Value remains null",
  "zabbix.error.apiTokenUnsupported": "This Zabbix version does not support API tokens",
  "zabbix.error.authPlacementUnknown": "Unable to determine API token authentication placement",
  "zabbix.error.runtimeCredentialRequired": "Zabbix requires a runtime credential (token or username/password)",
  "zabbix.error.apiTokenEmpty": "Zabbix API token is empty",
  "zabbix.error.credentialInvalid": "The Zabbix credential type is unsupported or incomplete",
  "zabbix.error.invalidRpcResponse": "Zabbix returned an invalid JSON-RPC response",
  "zabbix.error.rpcIdMismatch": "Zabbix JSON-RPC id does not match",
  "zabbix.error.rpcResultMissing": "Zabbix JSON-RPC response is missing result",
  "zabbix.error.rpcError": "Zabbix RPC error",
  "zabbix.health.fixtureAvailable": "Zabbix fixture mode is available",
  "zabbix.health.authenticated": "Zabbix {version} authentication succeeded",
  "zabbix.action.acknowledged": "Acknowledged",
  "zabbix.action.scriptExecuted": "Script executed",
  "zabbix.action.fixturePreview": "Fixture preview",
  "zabbix.panel.filteredMissingEventId": "Filtered a problem row missing eventid"
};
Object.freeze(
  Object.keys(ZABBIX_I18N_ZH_HANS).sort()
);
let registered$1 = false;
function registerZabbixI18nCatalogs() {
  if (registered$1) return;
  registerI18nCatalog("zh-Hans", ZABBIX_I18N_ZH_HANS);
  registerI18nCatalog("en-US", ZABBIX_I18N_EN_US);
  registered$1 = true;
}
function zabbixT(key, vars) {
  if (!registered$1) registerZabbixI18nCatalogs();
  let value = t(key);
  if (vars) {
    value = value.replaceAll(
      /\{([A-Z]\w*)\}/gi,
      (_, name) => String(vars[name] ?? `{${name}}`)
    );
  }
  return value;
}
function zabbixSeverityLabel(priority, fallback) {
  const builtInZh = ["未分类", "信息", "警告", "一般严重", "严重", "灾难"];
  if (fallback && !builtInZh.includes(fallback)) return fallback;
  const keys = [
    "zabbix.common.notClassified",
    "zabbix.common.information",
    "zabbix.common.warning",
    "zabbix.common.average",
    "zabbix.common.high",
    "zabbix.common.disaster"
  ];
  return zabbixT(keys[priority] || "zabbix.common.unknown") || fallback || String(priority);
}
registerZabbixI18nCatalogs();
async function registerZabbixPlugin() {
  registerZabbixI18nCatalogs();
  const [panelMod, dsMod] = await Promise.all([
    Promise.resolve().then(() => module$4),
    Promise.resolve().then(() => module$3)
  ]);
  if (dsMod.plugin) {
    registerDataSourcePlugin(dsMod.plugin);
  }
  if (panelMod.plugin) {
    registerPanelPlugin(panelMod.plugin);
  }
}
const register$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  registerZabbixPlugin
}, Symbol.toStringTag, { value: "Module" }));
const MAX_ENTRIES$1 = 500;
function stableSerialize$1(value) {
  if (value === void 0) return "undefined";
  if (value === null || typeof value !== "object") return JSON.stringify(value);
  if (Array.isArray(value)) return `[${value.map(stableSerialize$1).join(",")}]`;
  const obj = value;
  const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
  return `{${keys.map((k) => `${JSON.stringify(k)}:${stableSerialize$1(obj[k])}`).join(",")}}`;
}
function serializeZabbixCacheKey(key) {
  return stableSerialize$1({
    uid: key.uid,
    majorVersion: key.majorVersion,
    method: key.method,
    params: key.params || {}
  });
}
class ZabbixMetadataCache {
  entries = /* @__PURE__ */ new Map();
  inflight = /* @__PURE__ */ new Map();
  load(key, ttlMs2, consumerSignal, loader) {
    const serialized = serializeZabbixCacheKey(key);
    const now2 = Date.now();
    const hit = this.entries.get(serialized);
    if (hit && hit.expiresAt > now2) {
      hit.lastAccess = now2;
      return Promise.resolve(hit.value);
    }
    const existing = this.inflight.get(serialized);
    if (existing) {
      existing.consumers += 1;
      return this.bindConsumer(existing, consumerSignal);
    }
    const controller = new AbortController();
    const inflight2 = {
      key: serialized,
      controller,
      consumers: 1,
      promise: Promise.resolve().then(() => {
        if (controller.signal.aborted) {
          throw new DOMException("Aborted", "AbortError");
        }
        return loader(controller.signal);
      }).then((value) => {
        if (controller.signal.aborted) {
          throw new DOMException("Aborted", "AbortError");
        }
        this.entries.set(serialized, {
          key: serialized,
          uid: key.uid,
          method: key.method,
          expiresAt: Date.now() + Math.max(0, ttlMs2),
          lastAccess: Date.now(),
          value
        });
        this.evictIfNeeded();
        return value;
      }).finally(() => {
        this.inflight.delete(serialized);
      })
    };
    this.inflight.set(serialized, inflight2);
    if (consumerSignal?.aborted) {
      inflight2.consumers -= 1;
      if (inflight2.consumers <= 0) inflight2.controller.abort();
      return Promise.reject(new DOMException("Aborted", "AbortError"));
    }
    return this.bindConsumer(inflight2, consumerSignal);
  }
  bindConsumer(inflight2, signal) {
    return new Promise((resolve, reject) => {
      let settled = false;
      const onAbort = () => {
        if (settled) return;
        settled = true;
        inflight2.consumers -= 1;
        if (inflight2.consumers <= 0) inflight2.controller.abort();
        reject(new DOMException("Aborted", "AbortError"));
      };
      if (signal) {
        if (signal.aborted) {
          onAbort();
          return;
        }
        signal.addEventListener("abort", onAbort, { once: true });
      }
      inflight2.promise.then(
        (v) => {
          if (settled) return;
          settled = true;
          signal?.removeEventListener("abort", onAbort);
          resolve(v);
        },
        (error) => {
          if (settled) return;
          settled = true;
          signal?.removeEventListener("abort", onAbort);
          reject(error);
        }
      );
    });
  }
  invalidate(uid, methods) {
    const set = new Set(methods);
    for (const [k, entry] of this.entries) {
      if (entry.uid === uid && set.has(entry.method)) this.entries.delete(k);
    }
  }
  clearUid(uid) {
    for (const [k, entry] of this.entries) {
      if (entry.uid === uid) this.entries.delete(k);
    }
    for (const [k, flight] of this.inflight) {
      if (k.includes(`"uid":${JSON.stringify(uid)}`) || k.includes(`"uid":"${uid}"`)) {
        flight.controller.abort();
        this.inflight.delete(k);
      }
    }
  }
  clear() {
    this.entries.clear();
    for (const flight of this.inflight.values()) flight.controller.abort();
    this.inflight.clear();
  }
  evictIfNeeded() {
    while (this.entries.size > MAX_ENTRIES$1) {
      let oldestKey = "";
      let oldest = Infinity;
      for (const [k, v] of this.entries) {
        if (v.lastAccess < oldest) {
          oldest = v.lastAccess;
          oldestKey = k;
        }
      }
      if (!oldestKey) break;
      this.entries.delete(oldestKey);
    }
  }
}
const READ_METHOD_LIST = [
  "alert.get",
  "apiinfo.version",
  "application.get",
  "discoveryrule.get",
  "event.get",
  "history.get",
  "host.get",
  "hostgroup.get",
  "item.get",
  "itemprototype.get",
  "problem.get",
  "proxy.get",
  "script.get",
  "service.get",
  "service.getsla",
  "sla.get",
  "sla.getsli",
  "trend.get",
  "trigger.get",
  "user.get",
  "usermacro.get",
  "valuemap.get"
];
const WRITE_METHOD_LIST = ["event.acknowledge", "script.execute"];
const READ_METHODS = new Set(READ_METHOD_LIST);
const WRITE_METHODS = new Set(WRITE_METHOD_LIST);
function assertAllowedZabbixMethod(method) {
  if (!READ_METHODS.has(method) && !WRITE_METHODS.has(method)) {
    throw new Error(`Zabbix API method is not allowed: ${method}`);
  }
}
function parseZabbixVersion(version) {
  const parts = String(version || "0").split(".").map((x) => Number(x) || 0);
  return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0 };
}
function getZabbixVersionCapabilities(version, overrides) {
  const { major, minor } = parseZabbixVersion(version);
  const ge = (maj, min = 0) => major > maj || major === maj && minor >= min;
  const supportsApiToken = ge(5, 4);
  const loginUserField = ge(5, 4) ? "username" : "user";
  const authCandidates = supportsApiToken ? ge(7, 0) ? ["body", "header"] : ["body"] : [];
  const triggerHostGroupsField = ge(7, 0) ? "selectHostGroups" : "selectGroups";
  const acknowledgesField = ge(7, 0) ? "selectAcknowledges" : "select_acknowledges";
  const proxyNameField = ge(7, 0) ? "name" : "host";
  const hostProxyIdField = ge(7, 0) ? "proxyid" : "proxy_hostid";
  const hostgroupRealHostsField = ge(6, 0) ? "with_hosts" : "real_hosts";
  const supportsApplications = !ge(5, 4);
  const supportsItemTags = ge(5, 4);
  const slaApi = ge(6, 0) ? "sla" : "legacy";
  return {
    version: String(version),
    major,
    minor,
    supportsApiToken,
    loginUserField,
    authCandidates,
    selectedAuthPlacement: overrides?.selectedAuthPlacement,
    triggerHostGroupsField,
    acknowledgesField,
    proxyNameField,
    hostProxyIdField,
    hostgroupRealHostsField,
    supportsApplications,
    supportsItemTags,
    slaApi
  };
}
function buildVersionedAuthRequest(caps2, method, params, token, id = 1, placementOverride) {
  const body = { jsonrpc: "2.0", id, method, params };
  const headers = {};
  if (!token) return { body, headers, placement: void 0 };
  if (!caps2.supportsApiToken) {
    return {
      body,
      headers,
      placement: void 0,
      rejected: true
    };
  }
  const placement = placementOverride || caps2.selectedAuthPlacement || caps2.authCandidates[0] || "body";
  if (placement === "header") {
    headers.Authorization = `Bearer ${token}`;
  } else {
    body.auth = token;
  }
  return { body, headers, placement };
}
function normalizeZabbixUrl(url) {
  const baseUrl2 = String(url || "").replace(/\/$/, "");
  const proxied = baseUrl2.startsWith("/zabbix-api") || baseUrl2.includes("api_jsonrpc.php");
  return { baseUrl: baseUrl2, path: proxied ? "" : "/api_jsonrpc.php" };
}
function buildAuthenticatedRequest(version, method, params, token, id = 1, placement) {
  const caps2 = getZabbixVersionCapabilities(
    version,
    placement ? { selectedAuthPlacement: placement } : void 0
  );
  const built = buildVersionedAuthRequest(caps2, method, params, token, id, placement);
  return { body: built.body, headers: built.headers };
}
class ZabbixRpcClient {
  url;
  uid;
  timeoutMs;
  maxBodyBytes;
  cacheTimeout;
  versionCache = null;
  tokenCache = null;
  nextId = 1;
  credential;
  forceNetwork;
  authPlacement = null;
  capsCache = null;
  authPlacementOverride = "auto";
  authPlacementPromise = null;
  constructor(opts) {
    this.url = opts.url;
    this.uid = opts.uid;
    this.timeoutMs = opts.timeoutMs ?? 3e4;
    this.maxBodyBytes = opts.maxBodyBytes ?? 1e7;
    this.credential = opts.credential;
    this.forceNetwork = opts.forceNetwork ?? true;
    const ct = opts.cacheTimeout != null && String(opts.cacheTimeout).trim() !== "" ? String(opts.cacheTimeout).trim() : void 0;
    this.cacheTimeout = ct;
  }
  /** Per-query panel.cacheTimeout (Grafana). Empty clears. */
  setCacheTimeout(v) {
    this.cacheTimeout = v != null && String(v).trim() !== "" ? String(v).trim() : void 0;
  }
  async getVersion(signal) {
    if (this.versionCache) return this.versionCache;
    const version = await this.rawCall("apiinfo.version", {}, null, signal);
    const vs = typeof version === "string" ? version : Array.isArray(version) ? "" : String(version ?? "");
    this.versionCache = vs && /^\d+/.test(vs) ? vs : "6.0.0";
    this.capsCache = getZabbixVersionCapabilities(this.versionCache, {
      selectedAuthPlacement: this.authPlacement || void 0
    });
    return this.versionCache;
  }
  getCapabilities() {
    return this.capsCache;
  }
  setAuthPlacementOverride(placement) {
    this.authPlacementOverride = placement;
    this.authPlacement = placement === "auto" ? null : placement;
    this.authPlacementPromise = null;
  }
  /** Probe hostgroup.get limit=1 to choose body vs header auth for the current token. */
  async resolveAuthPlacement(token, signal) {
    if (this.authPlacementOverride !== "auto" && this.authPlacement) return this.authPlacement;
    if (this.authPlacement) return this.authPlacement;
    if (this.authPlacementPromise) return this.authPlacementPromise;
    this.authPlacementPromise = this.doResolveAuthPlacement(token, signal).catch((error) => {
      this.authPlacementPromise = null;
      throw error;
    });
    return this.authPlacementPromise;
  }
  async doResolveAuthPlacement(token, signal) {
    if (this.authPlacementOverride !== "auto" && this.authPlacement) return this.authPlacement;
    if (this.authPlacement) return this.authPlacement;
    const version = await this.getVersion(signal);
    const caps2 = getZabbixVersionCapabilities(version);
    if (!caps2.supportsApiToken) {
      throw new DataSourceError("AUTH_REQUIRED", zabbixT("zabbix.error.apiTokenUnsupported"));
    }
    const candidates = caps2.authCandidates.length ? caps2.authCandidates : ["body"];
    let lastErr;
    for (const placement of candidates) {
      try {
        await this.rawCall(
          "hostgroup.get",
          { limit: 1, output: ["groupid"] },
          token,
          signal,
          version,
          placement
        );
        this.authPlacement = placement;
        this.capsCache = getZabbixVersionCapabilities(version, {
          selectedAuthPlacement: placement
        });
        return placement;
      } catch (error) {
        lastErr = error;
      }
    }
    throw lastErr instanceof DataSourceError ? lastErr : new DataSourceError("AUTH_REQUIRED", zabbixT("zabbix.error.authPlacementUnknown"));
  }
  async call(method, params = {}, signal) {
    assertAllowedZabbixMethod(method);
    if (method !== "apiinfo.version") {
      await this.ensureToken("6.0.0", signal);
    }
    const version = method === "apiinfo.version" ? "6.0.0" : await this.getVersion(signal);
    const token = method === "apiinfo.version" ? null : await this.ensureToken(version, signal);
    let placement;
    if (token) {
      const cred = this.credential === void 0 ? await getRuntimeCredential(this.uid) : this.credential;
      if (cred && (cred.kind === "bearer" || cred.kind === "apiKey")) {
        placement = await this.resolveAuthPlacement(token, signal);
      }
    }
    return this.rawCall(method, params, token, signal, version, placement);
  }
  async callWithFallback(method, params, fallback, timeoutMs, signal) {
    const ac = new AbortController();
    const timer = setTimeout(() => ac.abort(), Math.max(1, timeoutMs));
    const onOuterAbort = () => ac.abort();
    signal?.addEventListener("abort", onOuterAbort);
    try {
      return await this.call(method, params, ac.signal);
    } catch (error) {
      const isAbort = error?.name === "AbortError" || error?.code === "ERR_CANCELED";
      if (isAbort) return fallback;
      throw error;
    } finally {
      clearTimeout(timer);
      signal?.removeEventListener("abort", onOuterAbort);
    }
  }
  async ensureToken(version, signal) {
    if (this.tokenCache) return this.tokenCache;
    const cred = this.credential === void 0 ? await getRuntimeCredential(this.uid) : this.credential;
    if (!cred) {
      throw new DataSourceError("AUTH_REQUIRED", zabbixT("zabbix.error.runtimeCredentialRequired"));
    }
    if (cred.kind === "bearer" || cred.kind === "apiKey") {
      this.tokenCache = cred.value || null;
      if (!this.tokenCache) {
        throw new DataSourceError("AUTH_REQUIRED", zabbixT("zabbix.error.apiTokenEmpty"));
      }
      return this.tokenCache;
    }
    if (cred.kind === "basic" && cred.username && cred.password) {
      this.tokenCache = await this.login(version, cred.username, cred.password, signal);
      return this.tokenCache;
    }
    throw new DataSourceError("AUTH_REQUIRED", zabbixT("zabbix.error.credentialInvalid"));
  }
  async login(version, username, password, signal) {
    const caps2 = getZabbixVersionCapabilities(version);
    const primaryField = caps2.loginUserField;
    const primary = primaryField === "username" ? { username, password } : { user: username, password };
    try {
      return await this.rawCall("user.login", primary, null, signal, version);
    } catch (error) {
      const msg = error instanceof Error ? error.message : String(error);
      const details = error instanceof DataSourceError ? JSON.stringify(error.details ?? {}) : "";
      if (/unexpected parameter|invalid parameter|unknown parameter|deprecated/i.test(
        `${msg} ${details}`
      )) {
        const alt = primaryField === "username" ? { user: username, password } : { username, password };
        return this.rawCall("user.login", alt, null, signal, version);
      }
      throw error;
    }
  }
  async rawCall(method, params, token, signal, version = "6.0.0", placement) {
    if (method !== "user.login" && method !== "apiinfo.version") {
      assertAllowedZabbixMethod(method);
    }
    const id = this.nextId++;
    const { baseUrl: baseUrl2, path } = normalizeZabbixUrl(this.url);
    const { body, headers } = buildAuthenticatedRequest(
      version,
      method,
      params,
      token,
      id,
      placement
    );
    try {
      const res = await datasourceHttp({
        baseUrl: baseUrl2,
        path,
        method: "POST",
        body,
        headers,
        uid: this.uid,
        signal,
        timeoutMs: this.timeoutMs,
        maxBodyBytes: this.maxBodyBytes,
        credential: null,
        forceNetwork: this.forceNetwork,
        isWrite: false,
        idempotent: method === "apiinfo.version" || method.endsWith(".get"),
        // Grafana panel.cacheTimeout: appear on wire for BFF/proxy dual-run
        query: this.cacheTimeout != null && String(this.cacheTimeout).trim() !== "" ? { cacheTimeout: this.cacheTimeout } : void 0
      });
      const data = res.data;
      if (!data || typeof data !== "object") {
        throw new DataSourceError("INVALID_RESPONSE", zabbixT("zabbix.error.invalidRpcResponse"));
      }
      if (data.error) {
        const message2 = [data.error.message, data.error.data].filter(Boolean).join(" — ") || zabbixT("zabbix.error.rpcError");
        throw withDataSourceContext(
          new DataSourceError("UPSTREAM_ERROR", message2, {
            upstreamCode: data.error.code
          }),
          {
            uid: this.uid,
            endpoint: `${baseUrl2}${path}`,
            upstreamCode: data.error.code
          }
        );
      }
      if (data.id != null && data.id !== id) {
        throw new DataSourceError("INVALID_RESPONSE", zabbixT("zabbix.error.rpcIdMismatch"));
      }
      if (!("result" in data)) {
        throw new DataSourceError("INVALID_RESPONSE", zabbixT("zabbix.error.rpcResultMissing"));
      }
      return data.result;
    } catch (error) {
      if (error instanceof DataSourceError) {
        throw withDataSourceContext(error, {
          uid: this.uid,
          endpoint: `${baseUrl2}${path}`
        });
      }
      throw withDataSourceContext(error, {
        uid: this.uid,
        endpoint: `${baseUrl2}${path}`
      });
    }
  }
}
function splitKeyParams(key) {
  const s = String(key || "");
  const open = s.indexOf("[");
  const close = s.lastIndexOf("]");
  if (open < 0 || close <= open) return [];
  const body = s.slice(open + 1, close);
  const parts = [];
  let cur = "";
  let depth = 0;
  let quote = null;
  for (const ch of body) {
    if (quote) {
      if (ch === quote) quote = null;
      cur += ch;
      continue;
    }
    if (ch === '"' || ch === "'") {
      quote = ch;
      cur += ch;
      continue;
    }
    if (ch === "[") {
      depth++;
      cur += ch;
      continue;
    }
    if (ch === "]") {
      depth = Math.max(0, depth - 1);
      cur += ch;
      continue;
    }
    if (ch === "," && depth === 0) {
      parts.push(stripQuotes(cur.trim()));
      cur = "";
      continue;
    }
    cur += ch;
  }
  if (cur.length || body.endsWith(",")) parts.push(stripQuotes(cur.trim()));
  return parts;
}
function stripQuotes(v) {
  if (v.startsWith('"') && v.endsWith('"') || v.startsWith("'") && v.endsWith("'")) {
    return v.slice(1, -1);
  }
  return v;
}
function expandItemName(name, key) {
  const params = splitKeyParams(key);
  return String(name || "").replaceAll(/\$([1-9])/g, (_, d) => {
    const idx = Number(d) - 1;
    return params[idx] != null ? params[idx] : `$${d}`;
  });
}
function expandItems(items) {
  return (items || []).map((it) => ({
    ...it,
    name: expandItemName(String(it.name || ""), String(it.key_ || ""))
  }));
}
function scopedValue(raw) {
  if (Array.isArray(raw)) return raw.map(String).join("|");
  if (raw && typeof raw === "object" && "value" in raw) {
    return scopedValue(raw.value);
  }
  return raw == null ? "" : String(raw);
}
function interpolateZabbixValue(value, vars) {
  return String(value || "").replaceAll(
    /\$\{([A-Z_]\w*)\}|\$([A-Z_]\w*)|\[\[([A-Z_]\w*)\]\]/gi,
    (token, a, b, c) => {
      const name = a || b || c;
      return name in vars ? scopedValue(vars[name]) : token;
    }
  );
}
function isMatchAllZabbixFilter(filter2) {
  const source = String(filter2 || "").trim();
  if (!source || source === "*" || source === "$__all" || source === "/.*/" || source === "/^.*$/")
    return true;
  const m = source.match(/^\/(.*)\/([gimsuy]*)$/);
  if (!m) return false;
  const body = m[1];
  return body === ".*" || body === "^.*$" || body === ".+" || body === "";
}
function toApiSearchString(filter2) {
  const source = String(filter2 || "").trim();
  if (!source || isMatchAllZabbixFilter(source)) return void 0;
  if (/^\/.*\/[gimsuy]*$/.test(source)) return void 0;
  return source;
}
function zabbixFilterToApiSearch(filter2) {
  const source = String(filter2 || "").trim();
  if (!source || isMatchAllZabbixFilter(source)) return void 0;
  const plain2 = toApiSearchString(source);
  if (plain2) return plain2;
  const match = source.match(/^\/(.*)\/([gimsuy]*)$/);
  if (!match) return void 0;
  const body = match[1];
  const alts = body.split("|").map((part) => {
    let s = "";
    for (let i = 0; i < part.length; i++) {
      const ch = part[i];
      if (ch === "\\" && i + 1 < part.length) {
        s += part[i + 1];
        i += 1;
        continue;
      }
      if (/[\w.:-]/.test(ch)) s += ch;
    }
    return s.trim();
  });
  const tokens = alts.filter((t2) => t2.length >= 2);
  if (!tokens.length) return void 0;
  tokens.sort((a, b) => b.length - a.length);
  return tokens[0];
}
function matchesZabbixFilter(value, filter2) {
  const source = String(filter2 || "").trim();
  if (isMatchAllZabbixFilter(source)) return true;
  const match = source.match(/^\/(.*)\/([gimsuy]*)$/);
  if (match) {
    try {
      return new RegExp(match[1], match[2].replace("g", "")).test(value);
    } catch {
      return false;
    }
  }
  return value.toLocaleLowerCase().includes(source.toLocaleLowerCase());
}
function interpolateFilter(filter2, vars) {
  return {
    filter: interpolateZabbixValue(String(filter2?.filter ?? ""), vars),
    ...filter2?.ids ? { ids: filter2.ids.map(String) } : {}
  };
}
function majorOf(version) {
  return Number(String(version).split(".")[0] || 6);
}
function minorOf(version) {
  return Number(String(version).split(".")[1] || 0);
}
function pageResult(rows, limit) {
  const list = Array.isArray(rows) ? rows : [];
  const truncated = limit > 0 && list.length >= limit;
  return {
    rows: list,
    complete: !truncated,
    truncated,
    limit
  };
}
function normalizeTriggerHostGroups(rows) {
  let list = [];
  if (Array.isArray(rows)) {
    list = rows;
  } else if (rows && typeof rows === "object") {
    list = Object.values(rows);
  }
  return list.map((row) => {
    if (row && row.hostgroups != null) {
      return { ...row, groups: row.hostgroups };
    }
    return row;
  });
}
const ITEM_OUTPUT = [
  "itemid",
  "name",
  "key_",
  "hostid",
  "value_type",
  "units",
  "delay",
  "status",
  "state",
  "valuemapid",
  "lastvalue",
  "lastclock"
];
class ZabbixApi {
  versionPromise = null;
  transport;
  uid;
  cache;
  metadataTtlMs;
  metadataPageLimit;
  /** Short in-flight/result cache so duplicate panels share trend/history RPCs. */
  trendHistoryCache = /* @__PURE__ */ new Map();
  static TREND_HISTORY_TTL_MS = 15e3;
  cachedTrendHistory(key, run) {
    const now2 = Date.now();
    const hit = this.trendHistoryCache.get(key);
    if (hit && now2 - hit.at < ZabbixApi.TREND_HISTORY_TTL_MS) {
      return hit.promise;
    }
    const promise = run().catch((error) => {
      this.trendHistoryCache.delete(key);
      throw error;
    });
    this.trendHistoryCache.set(key, { at: now2, promise });
    return promise;
  }
  constructor(transportOrOpts) {
    if (typeof transportOrOpts.transport !== "undefined" && !transportOrOpts.call) {
      const opts = transportOrOpts;
      this.transport = opts.transport;
      this.uid = opts.uid || "";
      this.cache = opts.cache;
      this.metadataTtlMs = opts.metadataTtlMs ?? 36e5;
      this.metadataPageLimit = opts.metadataPageLimit ?? 1e3;
    } else {
      this.transport = transportOrOpts;
      this.uid = "";
      this.metadataTtlMs = 36e5;
      this.metadataPageLimit = 1e3;
    }
  }
  get pageLimit() {
    return this.metadataPageLimit;
  }
  get metaTimeoutMs() {
    return Math.max(5e3, Math.floor(this.metadataTtlMs / 3));
  }
  cachedCall(method, params, signal, fallback) {
    const run = (sharedSignal) => {
      const sig = sharedSignal ?? signal;
      if (fallback !== void 0) {
        return this.transport.callWithFallback(method, params, fallback, this.metaTimeoutMs, sig);
      }
      return this.transport.call(method, params, sig);
    };
    if (!this.cache || !this.uid) {
      return run(signal);
    }
    return this.version(signal).then((version) => {
      const majorVersion = Number(String(version).split(".")[0] || 6);
      return this.cache.load(
        { uid: this.uid, majorVersion, method, params },
        this.metadataTtlMs,
        signal,
        (sharedSignal) => run(sharedSignal)
      );
    });
  }
  version(signal) {
    if (!this.versionPromise) {
      this.versionPromise = this.transport.getVersion(signal).catch((error) => {
        this.versionPromise = null;
        throw error;
      });
    }
    return this.versionPromise;
  }
  async ver(signal) {
    return this.version(signal);
  }
  async getGroups(filter2, signal) {
    const params = {
      output: ["groupid", "name"],
      sortfield: "name",
      limit: this.metadataPageLimit
    };
    const search = toApiSearchString(filter2);
    if (search) params.search = { name: search };
    const rows = await this.cachedCall(
      "hostgroup.get",
      params,
      signal,
      []
    );
    return pageResult(rows, this.metadataPageLimit);
  }
  async getHosts(groupids, filter2, hostTags = [], signal, evaltype = 0) {
    const version = await this.ver(signal);
    const caps2 = getZabbixVersionCapabilities(version);
    const params = {
      // Keep host list light — selectInventory/Interfaces extend freezes UI on large fleets
      output: ["hostid", "name", "host", "status", "maintenance_status", caps2.hostProxyIdField],
      sortfield: "name",
      limit: this.metadataPageLimit
    };
    if (groupids?.length) params.groupids = groupids;
    const search = toApiSearchString(filter2);
    if (search) params.search = { name: search };
    if (hostTags?.length) {
      params.tags = hostTags.map((t2) => ({
        tag: t2.tag,
        value: t2.value,
        operator: t2.operator
      }));
      params.evaltype = evaltype === 2 ? 2 : 0;
    }
    const rows = await this.cachedCall("host.get", params, signal, []);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getApplications(hostids, filter2, signal) {
    const version = await this.ver(signal);
    const caps2 = getZabbixVersionCapabilities(version);
    if (!caps2.supportsApplications) {
      return pageResult([], this.metadataPageLimit);
    }
    const params = {
      output: "extend",
      sortfield: "name",
      limit: this.metadataPageLimit
    };
    if (hostids?.length) params.hostids = hostids;
    const search = toApiSearchString(filter2);
    if (search) params.search = { name: search };
    const rows = await this.cachedCall("application.get", params, signal, []);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getDiscoveryRules(hostids, signal) {
    const params = {
      output: ["itemid", "name", "key_"],
      limit: this.metadataPageLimit
    };
    if (hostids?.length) params.hostids = hostids;
    const rows = await this.cachedCall("discoveryrule.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getItemPrototypes(discoveryRuleId, signal) {
    const params = {
      output: ["itemid", "name", "key_"],
      limit: this.metadataPageLimit
    };
    if (discoveryRuleId) params.discoveryids = [discoveryRuleId];
    const rows = await this.cachedCall("itemprototype.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  /**
   * Discovered items for LLD: always request selectItemDiscovery:'extend'.
   * Matching uses itemDiscovery.parent_itemid against selected prototype itemids
   * when provided; otherwise prototypeKeys match exact key_ of prototypes only when
   * parent relation is missing (INVALID_RESPONSE if relation required).
   */
  async getDiscoveredItems(hostids, discoveryRuleId, keyPrefixes, signal, opts) {
    const params = {
      output: "extend",
      selectTags: "extend",
      selectHosts: ["hostid", "name", "host"],
      selectItemDiscovery: "extend",
      limit: this.metadataPageLimit
    };
    if (hostids?.length) params.hostids = hostids;
    if (discoveryRuleId) params.discoveryids = [discoveryRuleId];
    const items = await this.transport.call("item.get", params, signal) || [];
    const prototypeIds = (opts?.prototypeIds || []).map(String).filter(Boolean);
    if (prototypeIds.length) {
      const matched = items.filter((it) => {
        const parent = String(it.itemDiscovery?.parent_itemid ?? "");
        return parent && prototypeIds.includes(parent);
      });
      const missingRelation = items.length > 0 && matched.length === 0 && items.every((it) => !it.itemDiscovery?.parent_itemid);
      if (missingRelation || opts?.requireParentRelation && items.some((it) => !it.itemDiscovery?.parent_itemid)) {
        throw new DataSourceError("INVALID_RESPONSE", zabbixT("zabbix.error.lldParentMissing"));
      }
      return matched;
    }
    if (!keyPrefixes?.length) return items;
    return items.filter((it) => keyPrefixes.some((p) => String(it.key_ || "").startsWith(p)));
  }
  async getDiscoveryRulesFull(hostids, signal) {
    const params = {
      output: "extend",
      limit: this.metadataPageLimit
    };
    if (hostids?.length) params.hostids = hostids;
    const rows = await this.cachedCall("discoveryrule.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getItemPrototypesFull(discoveryRuleId, signal) {
    const params = {
      output: "extend",
      limit: this.metadataPageLimit
    };
    if (discoveryRuleId) params.discoveryids = [discoveryRuleId];
    const rows = await this.cachedCall("itemprototype.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getItems(params, signal) {
    const version = await this.ver(signal);
    const body = {
      output: [...ITEM_OUTPUT],
      selectTags: "extend",
      selectHosts: ["hostid", "name", "host"],
      sortfield: "name",
      webitems: true,
      limit: this.metadataPageLimit
    };
    if (params.hostids?.length) body.hostids = params.hostids;
    if (params.groupids?.length) body.groupids = params.groupids;
    if (params.applicationids?.length && (majorOf(version) < 5 || majorOf(version) === 5 && minorOf(version) < 4)) {
      body.applicationids = params.applicationids;
    }
    const rawFilter = String(params.filter || "").trim();
    const searchToken = zabbixFilterToApiSearch(rawFilter);
    if (searchToken) {
      body.search = { name: searchToken, key_: searchToken };
      body.searchByAny = true;
      if (/[*%]/.test(searchToken)) {
        body.searchWildcardsEnabled = true;
      }
    }
    if (!params.showDisabled) body.filter = { ...body.filter, status: 0 };
    if (params.valueTypes?.length)
      body.filter = {
        ...body.filter,
        value_type: params.valueTypes
      };
    if (params.itemTag) {
      const [tag, ...rest] = params.itemTag.split(":");
      body.tags = [{ tag: tag.trim(), value: rest.join(":").trim(), operator: 0 }];
    }
    const cacheKey = `item.get|${JSON.stringify(body)}`;
    const rows = await this.cachedTrendHistory(
      cacheKey,
      () => this.cachedCall("item.get", body, signal, [])
    );
    return pageResult(expandItems(rows), this.metadataPageLimit);
  }
  async getItemsByIds(itemids, signal) {
    if (!itemids?.length) return [];
    const rows = await this.transport.call(
      "item.get",
      {
        itemids,
        output: [...ITEM_OUTPUT],
        selectTags: "extend",
        selectHosts: ["hostid", "name", "host"]
      },
      signal
    );
    return expandItems(rows || []);
  }
  async getHistory(itemids, history2, from, to, signal, limit) {
    if (!itemids?.length) return [];
    const ids = [...itemids].map(String).sort();
    const key = `h|${ids.join(",")}|${history2}|${from}|${to}|${limit ?? ""}`;
    return this.cachedTrendHistory(key, async () => {
      const params = {
        itemids: ids,
        history: history2,
        time_from: from,
        time_till: to,
        output: ["itemid", "clock", "value", "ns"],
        sortfield: "clock",
        sortorder: "ASC"
      };
      if (limit != null && limit > 0) params.limit = limit;
      return this.transport.call("history.get", params, signal);
    });
  }
  async getTrends(itemids, from, to, signal) {
    if (!itemids?.length) return [];
    const ids = [...itemids].map(String).sort();
    const key = `t|${ids.join(",")}|${from}|${to}`;
    return this.cachedTrendHistory(
      key,
      async () => this.transport.call(
        "trend.get",
        {
          itemids: ids,
          time_from: from,
          time_till: to,
          // Slim columns — extend freezes the browser on multi-item 7d windows.
          output: ["itemid", "clock", "value_min", "value_avg", "value_max", "num"],
          sortfield: "clock",
          sortorder: "ASC",
          // Soft cap; loadHistory downsamples further per series.
          limit: 2e3
        },
        signal
      )
    );
  }
  async getTriggers(params, signal) {
    const version = await this.ver(signal);
    const caps2 = getZabbixVersionCapabilities(version);
    const body = { ...params };
    const groupSelect = body.selectHostGroups ?? body.selectGroups;
    if (groupSelect !== void 0) {
      delete body.selectGroups;
      delete body.selectHostGroups;
      body[caps2.triggerHostGroupsField] = groupSelect;
    }
    if (!body.limit && !body.countOutput) body.limit = this.metadataPageLimit;
    const raw = await this.transport.call("trigger.get", body, signal);
    if (body.countOutput) {
      if (typeof raw === "number") return raw;
      if (typeof raw === "string") return Number(raw) || 0;
      if (Array.isArray(raw)) return raw.length;
      return Number(raw) || 0;
    }
    const normalized = normalizeTriggerHostGroups(raw);
    return pageResult(normalized, Number(body.limit) || this.metadataPageLimit);
  }
  async getProblems(params, signal) {
    const version = await this.ver(signal);
    const body = {
      output: "extend",
      selectTags: "extend",
      sortfield: ["eventid"],
      sortorder: "DESC",
      ...params
    };
    delete body.selectHosts;
    const caps2 = getZabbixVersionCapabilities(version);
    delete body.selectAcknowledges;
    delete body.select_acknowledges;
    body[caps2.acknowledgesField] = "extend";
    return this.transport.call("problem.get", body, signal);
  }
  async getEvents(params, signal) {
    return this.transport.call("event.get", params, signal);
  }
  async getProxies(filter2, signal) {
    const version = await this.ver(signal);
    const caps2 = getZabbixVersionCapabilities(version);
    const nameField = caps2.proxyNameField;
    const params = {
      output: ["proxyid", nameField, "status"],
      limit: this.metadataPageLimit
    };
    if (filter2) params.search = { [nameField]: filter2 };
    const rows = await this.cachedCall("proxy.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getServices(signal) {
    const rows = await this.cachedCall(
      "service.get",
      { output: "extend", limit: this.metadataPageLimit },
      signal
    );
    return pageResult(rows, this.metadataPageLimit);
  }
  async getSlas(serviceids, filter2, signal) {
    const version = await this.ver(signal);
    if (majorOf(version) >= 6) {
      const params2 = {
        output: "extend",
        limit: this.metadataPageLimit
      };
      if (serviceids?.length) params2.serviceids = serviceids;
      if (filter2) params2.search = { name: filter2 };
      const rows2 = await this.cachedCall("sla.get", params2, signal);
      return pageResult(rows2, this.metadataPageLimit);
    }
    const params = {};
    if (serviceids?.length) params.serviceids = serviceids;
    const rows = await this.transport.call("service.getsla", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getSli(params, signal) {
    const version = await this.ver(signal);
    if (majorOf(version) >= 6) {
      return this.transport.call("sla.getsli", params, signal);
    }
    return this.transport.call("service.getsla", params, signal);
  }
  async getMacros(hostids, filter2, signal) {
    const params = {
      output: "extend",
      limit: this.metadataPageLimit,
      selectHosts: ["hostid", "name"]
    };
    if (hostids?.length) params.hostids = hostids;
    if (filter2) params.search = { macro: filter2 };
    const rows = await this.cachedCall("usermacro.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  /**
   * Global (server-wide) user macros. Zabbix distinguishes these from host
   * macros via `globalmacro: true` on usermacro.get — mirrors grafana-zabbix
   * ZabbixAPIConnector.getGlobalMacros, used as the fallback when a host macro
   * is not defined during {$MACRO} expansion in problem text.
   */
  async getGlobalMacros(signal) {
    return await this.cachedCall(
      "usermacro.get",
      { output: "extend", globalmacro: true },
      signal
    ) || [];
  }
  async getValueMaps(signal) {
    const rows = await this.cachedCall(
      "valuemap.get",
      {
        output: "extend",
        selectMappings: "extend",
        limit: this.metadataPageLimit
      },
      signal
    );
    return pageResult(rows, this.metadataPageLimit);
  }
  async getCurrentUser(signal) {
    const rows = await this.transport.call("user.get", { output: ["userid", "type", "roleid"] }, signal);
    return rows?.[0] ?? { userid: "" };
  }
  /**
   * Resolve acknowledge authors. Zabbix selectAcknowledges only returns userid,
   * so the panel joins these rows to show the person who acknowledged — mirrors
   * grafana-zabbix getUsers() + formatAcknowledges.
   */
  async getUsers(signal) {
    const rows = await this.transport.call(
      "user.get",
      { output: ["userid", "username", "name", "surname"] },
      signal
    );
    return Array.isArray(rows) ? rows : [];
  }
  async getScripts(hostid, eventid, signal) {
    const params = {
      output: "extend",
      limit: this.metadataPageLimit
    };
    if (hostid) params.hostids = [hostid];
    const rows = await this.cachedCall("script.get", params, signal);
    return pageResult(rows, this.metadataPageLimit);
  }
  async getProblemDetail(eventid, signal) {
    if (!eventid) return null;
    const problems = await this.getProblems({ eventids: [eventid] }, signal);
    const problem = problems?.[0];
    if (!problem) return null;
    const triggerids = problem.objectid ? [String(problem.objectid)] : [];
    const version = await this.ver(signal);
    const caps2 = getZabbixVersionCapabilities(version);
    const triggersPage = triggerids.length ? await this.getTriggers(
      {
        triggerids,
        output: "extend",
        selectHosts: "extend",
        [caps2.triggerHostGroupsField]: "extend",
        selectItems: "extend",
        expandDescription: true,
        expandExpression: true
      },
      signal
    ) : pageResult([], this.metadataPageLimit);
    const triggerRows = typeof triggersPage === "number" ? [] : triggersPage.rows;
    const trigger = triggerRows[0] || {};
    const events = await this.getEvents(
      {
        eventids: [eventid],
        output: "extend",
        [caps2.acknowledgesField]: "extend",
        selectTags: "extend"
      },
      signal
    );
    const alerts = await this.transport.call(
      "alert.get",
      { eventids: [eventid], output: "extend" },
      signal
    );
    const groups = trigger.groups || trigger.hostgroups || [];
    return {
      ...problem,
      description: String(trigger.description ?? problem.name ?? ""),
      expression: String(trigger.expression ?? ""),
      opdata: String(trigger.opdata ?? ""),
      manual_close: trigger.manual_close != null ? String(trigger.manual_close) : problem.manual_close,
      hosts: trigger.hosts || problem.hosts || [],
      groups,
      items: trigger.items || [],
      tags: problem.tags || [],
      acknowledges: events?.[0]?.acknowledges || problem.acknowledges || [],
      events: events || [],
      alerts: alerts || []
    };
  }
  async acknowledgeEvent(payload, signal) {
    return this.transport.call("event.acknowledge", payload, signal);
  }
  async executeScript(payload, signal) {
    return this.transport.call("script.execute", payload, signal);
  }
}
function throwIfAborted(signal) {
  if (signal?.aborted) {
    throw new DataSourceError("CANCELLED", "数据源请求已取消");
  }
}
function historyPoints(itemid, from, to, count = 12) {
  const start = Number(from) || 0;
  const end = Number(to) || start + 3600;
  const step = Math.max(1, Math.floor((end - start) / Math.max(1, count - 1)));
  const points = [];
  for (let i = 0; i < count; i++) {
    const clock2 = String(start + i * step);
    points.push({ itemid, clock: clock2, ns: "0", value: String(10 + i) });
  }
  return points;
}
class OfflineZabbixTransport {
  constructor(scenario = "default") {
    this.scenario = scenario;
  }
  scenario;
  async getVersion(signal) {
    throwIfAborted(signal);
    if (this.scenario === "version-5") return "5.0.0";
    if (this.scenario === "version-6") return "6.0.0";
    if (this.scenario === "version-7") return "7.2.0";
    return "7.2.0";
  }
  async callWithFallback(method, params, fallback, _timeoutMs, signal) {
    try {
      return await this.call(method, params, signal);
    } catch (e) {
      const isAbort = e?.name === "AbortError" || e?.code === "ERR_CANCELED";
      if (isAbort) return fallback;
      throw e;
    }
  }
  async call(method, params = {}, signal) {
    throwIfAborted(signal);
    assertAllowedZabbixMethod(method);
    if (this.scenario === "error") {
      throw new DataSourceError(
        "UPSTREAM_ERROR",
        "offline fixture upstream error",
        { upstreamCode: 500 }
      );
    }
    if (this.scenario === "empty") {
      if (method === "apiinfo.version")
        return await this.getVersion(signal);
      return [];
    }
    switch (method) {
      case "apiinfo.version":
        return await this.getVersion(signal);
      case "hostgroup.get":
        return [
          { groupid: "g1", name: "Linux servers" },
          { groupid: "g2", name: "Windows servers" }
        ];
      case "host.get":
        return [
          { hostid: "h1", name: "web-01", host: "web-01", status: "0" },
          { hostid: "h2", name: "db-01", host: "db-01", status: "0" }
        ];
      case "application.get":
        return [{ applicationid: "a1", name: "CPU", hostid: "h1" }];
      case "item.get": {
        if (this.scenario === "partial") {
          return [
            {
              itemid: "i1",
              name: "CPU util",
              key_: "system.cpu.util",
              hostid: "h1",
              value_type: "0",
              units: "%",
              status: "0"
            }
          ];
        }
        return [
          {
            itemid: "i1",
            name: "CPU util",
            key_: "system.cpu.util",
            hostid: "h1",
            value_type: "0",
            units: "%",
            status: "0",
            tags: [{ tag: "env", value: "prod" }],
            hosts: [{ hostid: "h1", name: "web-01" }]
          },
          {
            itemid: "i2",
            name: "Agent version",
            key_: "agent.version",
            hostid: "h1",
            value_type: "1",
            status: "0"
          },
          {
            itemid: "i3",
            name: "System log",
            key_: "log[/var/log/syslog]",
            hostid: "h1",
            value_type: "2",
            status: "0"
          },
          {
            itemid: "i4",
            name: "Discovered FS",
            key_: "vfs.fs.size[/,pused]",
            hostid: "h1",
            value_type: "0",
            status: "0"
          }
        ];
      }
      case "discoveryrule.get":
        return [
          {
            itemid: "d1",
            name: "Mounted filesystem discovery",
            key_: "vfs.fs.discovery"
          }
        ];
      case "itemprototype.get":
        return [
          {
            itemid: "p1",
            ruleid: "d1",
            name: "Free disk space on {#FSNAME}",
            key_: "vfs.fs.size[{#FSNAME},pfree]"
          }
        ];
      case "history.get": {
        const itemids = params.itemids || ["i1"];
        const from = Number(params.time_from ?? 0);
        const to = Number(params.time_till ?? from + 3600);
        return itemids.flatMap((id) => historyPoints(id, from, to));
      }
      case "trend.get": {
        const itemids = params.itemids || ["i1"];
        const from = Number(params.time_from ?? 0);
        return itemids.map((itemid) => ({
          itemid,
          clock: String(from),
          num: "12",
          value_min: "1",
          value_avg: "5",
          value_max: "9"
        }));
      }
      case "problem.get":
        return [
          {
            eventid: "e1",
            objectid: "t1",
            name: "High CPU",
            severity: "3",
            clock: "1700000000",
            acknowledged: "0",
            hosts: [{ hostid: "h1", name: "web-01" }],
            tags: [{ tag: "scope", value: "availability" }]
          },
          {
            eventid: "e2",
            objectid: "t2",
            name: "Disk full",
            severity: "4",
            clock: "1700001000",
            acknowledged: "1",
            hosts: [{ hostid: "h2", name: "db-01" }],
            tags: []
          }
        ];
      case "event.get":
        return [
          {
            eventid: String(params.eventids?.[0] || "e1"),
            acknowledges: [{ acknowledgeid: "a1", message: "looking" }]
          }
        ];
      case "trigger.get":
        return [
          {
            triggerid: "t1",
            description: "High CPU",
            expression: "{web-01:system.cpu.util.last()}>90",
            opdata: "95%",
            hosts: [{ hostid: "h1", name: "web-01" }],
            groups: [{ groupid: "g1", name: "Linux servers" }],
            items: [
              {
                itemid: "i1",
                name: "CPU util",
                key_: "system.cpu.util",
                hostid: "h1",
                value_type: "0"
              }
            ]
          }
        ];
      case "alert.get":
        return [{ alertid: "al1", subject: "alert" }];
      case "service.get":
        return [{ serviceid: "s1", name: "Web SLA" }];
      case "sla.get":
      case "service.getsla":
        return [{ slaid: "sla1", name: "Availability", serviceid: "s1" }];
      case "sla.getsli":
        return [{ period: "1h", sli: 99.9 }];
      case "usermacro.get":
        return [{ hostmacroid: "m1", macro: "{$CPU.MAX}", value: "90" }];
      case "valuemap.get":
        return [
          {
            valuemapid: "vm1",
            name: "Service state",
            mappings: [{ value: "0", newvalue: "Down" }]
          }
        ];
      case "script.get":
        return [
          { scriptid: "sc1", name: "Ping", type: "0", execute_on: "0" }
        ];
      case "user.get":
        return [{ userid: "u1", type: "3", roleid: "r1" }];
      case "proxy.get":
        return [{ proxyid: "px1", host: "proxy-01", status: "5" }];
      case "event.acknowledge":
        return {
          eventids: params.eventids || [],
          preview: true
        };
      case "script.execute":
        return { response: "offline preview", preview: true };
      default:
        return [];
    }
  }
}
const DS_QUERY_SCHEMA = 12;
const DS_CONFIG_SCHEMA = 4;
const TYPE_MAP = {
  "0": "0",
  "metrics": "0",
  "1": "1",
  "services": "1",
  "2": "2",
  "text": "2",
  "3": "3",
  "itemid": "3",
  "4": "4",
  "triggers": "4",
  "5": "5",
  "problems": "5",
  "6": "6",
  "macros": "6"
};
function normalizeZabbixQueryType(value) {
  const key = String(value ?? "0").toLowerCase();
  if (TYPE_MAP[key]) return TYPE_MAP[key];
  return key;
}
const filter = () => ({ filter: "" });
const DEFAULT_ZABBIX_QUERY = {
  refId: "A",
  schema: DS_QUERY_SCHEMA,
  queryType: "0",
  group: filter(),
  host: filter(),
  application: filter(),
  itemTag: filter(),
  item: filter(),
  proxy: filter(),
  trigger: filter(),
  tags: filter(),
  macro: filter(),
  itemids: "",
  textFilter: "",
  useCaptureGroups: false,
  itServiceFilter: "",
  slaFilter: "",
  slaProperty: "sli",
  slaInterval: "none",
  showProblems: "problems",
  countTriggersBy: "",
  functions: [],
  options: {
    useTrends: "default",
    acknowledged: 2,
    sortProblems: "default",
    limit: 1001
  }
};
const DEFAULT_ZABBIX_OPTIONS = {
  dataMode: "live",
  authPlacement: "auto",
  enableWrites: false,
  authType: "token",
  trends: true,
  trendsFrom: "7d",
  trendsRange: "4d",
  cacheTTL: "1h",
  metadataPageLimit: 1e3,
  historyPageLimit: 1e4,
  historyBatchSize: 100,
  historyConcurrency: 4,
  timeout: 3e4,
  queryTimeout: 6e4,
  dbConnectionEnable: false,
  disableReadOnlyUsersAck: false,
  disableDataAlignment: false,
  schema: DS_CONFIG_SCHEMA
};
const LEGACY_SLA_INTERVAL = {
  day: "1d",
  week: "1w",
  month: "1M",
  hour: "1h"
};
function mapLegacySLAInterval(value) {
  const s = String(value ?? "none");
  return LEGACY_SLA_INTERVAL[s] ?? s;
}
function deepClone$4(v) {
  try {
    return structuredClone(v);
  } catch {
    return JSON.parse(JSON.stringify(v));
  }
}
function asFilter(value) {
  if (value && typeof value === "object" && !Array.isArray(value)) {
    const o = value;
    return {
      filter: String(o.filter ?? ""),
      ...o.name != null ? { name: String(o.name) } : {},
      ...Array.isArray(o.ids) ? { ids: o.ids.map(String) } : {}
    };
  }
  return { filter: "" };
}
function convertToRegex(str) {
  if (str) return `/${str}/`;
  return "/.*/";
}
function normalizeZabbixFunction(input) {
  const o = input && typeof input === "object" ? input : {};
  const def = o.def && typeof o.def === "object" ? o.def : {};
  let name = String(o.name ?? def.name ?? "unknown");
  if (name === "percentil") name = "percentile";
  const params = Array.isArray(o.params) ? o.params : [];
  const out = { name, params };
  if (o.text != null) out.text = String(o.text);
  if (o.added != null) out.added = Boolean(o.added);
  return out;
}
function fixTargetGroup(target) {
  if (Array.isArray(target.group)) {
    target.group = { filter: "" };
  }
}
function isGrafana2target(target) {
  const mode2 = target.mode;
  if (mode2 == null || mode2 === 0 || mode2 === 2) {
    const item = target.item;
    const host = target.host;
    if ((target.hostFilter || target.itemFilter || target.downsampleFunction || host && host.host) && item?.filter === void 0 && host?.filter === void 0) {
      return true;
    }
  }
  return false;
}
function migrateFrom2To3version(target) {
  const group = target.group && typeof target.group === "object" ? target.group : {};
  const host = target.host && typeof target.host === "object" ? target.host : {};
  const application = target.application && typeof target.application === "object" ? target.application : {};
  const item = target.item && typeof target.item === "object" ? target.item : {};
  const macro = target.macro && typeof target.macro === "object" ? target.macro : {};
  target.group = {
    filter: group.name === "*" ? "/.*/" : String(group.name ?? group.filter ?? "")
  };
  target.host = {
    filter: host.name === "*" ? convertToRegex(target.hostFilter) : String(host.name ?? host.filter ?? "")
  };
  target.application = {
    filter: application.name === "*" ? "" : String(application.name ?? application.filter ?? "")
  };
  target.item = {
    filter: item.name === "All" ? convertToRegex(target.itemFilter) : String(item.name ?? item.filter ?? "")
  };
  target.macro = {
    filter: macro.macro === "*" ? convertToRegex(target.macroFilter) : String(macro.macro ?? macro.filter ?? "")
  };
}
function migrateFunctions(target) {
  if (!Array.isArray(target.functions)) {
    target.functions = [];
    return;
  }
  target.functions = target.functions.map((f) => normalizeZabbixFunction(f));
}
function migrateQueryType(target) {
  if (target.queryType === void 0) {
    if (target.mode === "Metrics") {
      target.queryType = "0";
    } else if (target.mode !== void 0) {
      target.queryType = target.mode;
      delete target.mode;
    }
  }
  if (typeof target.queryType === "number") {
    target.queryType = String(target.queryType);
  }
  if (target.queryType != null) {
    target.queryType = normalizeZabbixQueryType(target.queryType);
  }
}
function migrateSLA(target) {
  if (normalizeZabbixQueryType(target.queryType) === "1" && !target.slaInterval) {
    target.slaInterval = "none";
  }
}
function migrateProblemSort(target) {
  const options = target.options && typeof target.options === "object" ? target.options : null;
  if (options?.sortProblems === "priority") {
    options.sortProblems = "severity";
  }
}
function migrateApplications(target) {
  if (!target.itemTag) {
    const application = target.application && typeof target.application === "object" ? target.application : {};
    const appFilter = String(application.filter ?? "");
    target.itemTag = { filter: appFilter ? `Application: ${appFilter}` : "" };
  }
}
function migrateSLAProperty(target) {
  if (target.slaProperty && typeof target.slaProperty === "object") {
    const prop = target.slaProperty.property;
    if (prop != null) target.slaProperty = String(prop);
  }
  if (target.slaInterval != null) {
    target.slaInterval = mapLegacySLAInterval(target.slaInterval);
  }
}
function migrateTriggersMode(target) {
  const triggers = target.triggers && typeof target.triggers === "object" ? target.triggers : null;
  if (!triggers) return;
  const options = {
    ...target.options && typeof target.options === "object" ? target.options : {}
  };
  if (triggers.minSeverity != null) {
    options.minSeverity = triggers.minSeverity;
    delete triggers.minSeverity;
  }
  if (triggers.count != null) {
    options.count = triggers.count;
    delete triggers.count;
  }
  target.options = options;
}
function migrateNewTriggersCountModes(target) {
  const schema = Number(target.schema ?? 0);
  if (schema >= 11) return;
  const qt = String(target.queryType ?? "");
  if (qt === "6") {
    target.queryType = "4";
    target.countTriggersBy = "items";
  } else if (qt === "7") {
    target.queryType = "4";
    target.countTriggersBy = "problems";
  } else if (qt === "8") {
    target.queryType = "6";
  }
}
function migrateProblemsSeverity(target) {
  const schema = Number(target.schema ?? 0);
  if (schema >= 12) return;
  const options = target.options && typeof target.options === "object" ? target.options : null;
  if (!options || options.minSeverity == null) return;
  const min = Number(options.minSeverity);
  options.severities = [0, 1, 2, 3, 4, 5].filter((v) => v >= min);
}
function migrateLld(target) {
  const hasNew = target.lld && typeof target.lld === "object" && String(target.lld.ruleId || "");
  const legacyRule = String(target.lldRuleId || "");
  const legacyKeys = Array.isArray(target.lldItemKeys) ? target.lldItemKeys.map(String) : [];
  const legacyName = target.lldRuleName != null ? String(target.lldRuleName) : void 0;
  const qtRaw = String(target.queryType || "").toLowerCase();
  const wasLldQueryType = qtRaw === "lld" || qtRaw === "7" || qtRaw === "8" && Boolean(hasNew || legacyRule || legacyKeys.length);
  if (hasNew) {
    const lld = target.lld;
    target.executionMode = target.executionMode || "lld";
    target.lld = {
      ruleId: String(lld.ruleId || ""),
      ruleName: lld.ruleName != null ? String(lld.ruleName) : void 0,
      prototypeIds: Array.isArray(lld.prototypeIds) ? lld.prototypeIds.map(String) : [],
      prototypeKeys: Array.isArray(lld.prototypeKeys) ? lld.prototypeKeys.map(String) : [],
      discoveredItemIds: Array.isArray(lld.discoveredItemIds) ? lld.discoveredItemIds.map(String) : void 0
    };
    if (wasLldQueryType) target.queryType = "0";
    return;
  }
  if (legacyRule || legacyKeys.length || wasLldQueryType) {
    target.executionMode = "lld";
    target.lld = {
      ruleId: legacyRule,
      ruleName: legacyName,
      prototypeIds: [],
      prototypeKeys: legacyKeys
    };
    if (wasLldQueryType) target.queryType = "0";
  } else if (!target.executionMode) {
    target.executionMode = "standard";
  }
}
function migrateZabbixQuery(input) {
  const hasSlaFilter = Object.prototype.hasOwnProperty.call(input, "slaFilter");
  const target = deepClone$4(input);
  target.resultFormat = target.resultFormat || "time_series";
  fixTargetGroup(target);
  if (isGrafana2target(target)) {
    migrateFrom2To3version(target);
  }
  migrateFunctions(target);
  migrateQueryType(target);
  migrateSLA(target);
  migrateProblemSort(target);
  migrateApplications(target);
  migrateSLAProperty(target);
  migrateTriggersMode(target);
  migrateNewTriggersCountModes(target);
  migrateProblemsSeverity(target);
  migrateLld(target);
  target.schema = DS_QUERY_SCHEMA;
  const base = deepClone$4(DEFAULT_ZABBIX_QUERY);
  const qtCode = String(target.queryType ?? "0");
  if (!/^[0-6]$/.test(qtCode)) {
    throw new DataSourceError(
      "INVALID_QUERY",
      zabbixT("zabbix.error.unsupportedQueryType", { queryType: qtCode })
    );
  }
  return {
    ...base,
    ...target,
    group: asFilter(target.group ?? base.group),
    host: asFilter(target.host ?? base.host),
    application: asFilter(target.application ?? base.application),
    itemTag: asFilter(target.itemTag ?? base.itemTag),
    item: asFilter(target.item ?? base.item),
    proxy: asFilter(target.proxy ?? base.proxy),
    trigger: asFilter(target.trigger ?? base.trigger),
    tags: asFilter(target.tags ?? base.tags),
    macro: asFilter(target.macro ?? base.macro),
    itemids: String(target.itemids ?? base.itemids ?? ""),
    textFilter: String(target.textFilter ?? base.textFilter ?? ""),
    useCaptureGroups: Boolean(target.useCaptureGroups ?? base.useCaptureGroups),
    itServiceFilter: String(target.itServiceFilter ?? base.itServiceFilter ?? ""),
    slaFilter: hasSlaFilter ? String(target.slaFilter ?? "") : void 0,
    slaProperty: String(target.slaProperty ?? base.slaProperty ?? "sli"),
    slaInterval: String(target.slaInterval ?? base.slaInterval ?? "none"),
    showProblems: target.showProblems ?? base.showProblems,
    functions: Array.isArray(target.functions) ? target.functions : [],
    options: {
      ...base.options,
      ...target.options && typeof target.options === "object" ? target.options : {}
    },
    queryType: normalizeZabbixQueryType(target.queryType ?? base.queryType),
    schema: DS_QUERY_SCHEMA,
    refId: String(target.refId ?? base.refId),
    executionMode: target.executionMode || "standard",
    lld: target.lld,
    lldRuleId: target.lldRuleId,
    lldRuleName: target.lldRuleName,
    lldItemKeys: target.lldItemKeys
  };
}
function migrateZabbixConfig(input, resolveUid) {
  const jsonData = deepClone$4(input);
  let error;
  if (jsonData.dbConnection && typeof jsonData.dbConnection === "object") {
    const db = jsonData.dbConnection;
    jsonData.dbConnectionEnable = Boolean(db.enable);
    if (!jsonData.dbConnectionDatasourceUID && Number(db.datasourceId) > 0) {
      const uid = resolveUid?.(Number(db.datasourceId));
      if (uid) jsonData.dbConnectionDatasourceUID = uid;
      else {
        error = {
          code: "DIRECT_DB_DATASOURCE_NOT_FOUND",
          message: zabbixT("zabbix.error.directDbIdNotFound", {
            id: db.datasourceId
          })
        };
      }
    }
    delete jsonData.dbConnection;
  }
  if (typeof jsonData.timeout === "string") {
    jsonData.timeout = jsonData.timeout === "" ? 0 : Number(jsonData.timeout);
  }
  if (!jsonData.dbConnectionDatasourceUID && Number(jsonData.dbConnectionDatasourceId) > 0) {
    const id = Number(jsonData.dbConnectionDatasourceId);
    const uid = resolveUid?.(id);
    if (!uid) {
      error = {
        code: "DIRECT_DB_DATASOURCE_NOT_FOUND",
        message: zabbixT("zabbix.error.directDbIdNotFound", { id })
      };
      delete jsonData.dbConnectionDatasourceUID;
    } else {
      jsonData.dbConnectionDatasourceUID = uid;
    }
  }
  delete jsonData.dbConnectionDatasourceId;
  jsonData.schema = DS_CONFIG_SCHEMA;
  const options = {
    ...DEFAULT_ZABBIX_OPTIONS,
    ...jsonData,
    schema: DS_CONFIG_SCHEMA
  };
  return error ? { options, error } : { options };
}
function prepareZabbixAnnotation(input) {
  const json = deepClone$4(input);
  const existing = json.target && typeof json.target === "object" ? json.target : {};
  const defaultTarget = {
    group: { filter: String(json.group ?? "") },
    host: { filter: String(json.host ?? "") },
    application: { filter: String(json.application ?? "") },
    trigger: { filter: String(json.trigger ?? "") },
    options: {
      minSeverity: json.minseverity ?? 0,
      showOkEvents: json.showOkEvents ?? false,
      hideAcknowledged: json.hideAcknowledged ?? false,
      showHostname: json.showHostname ?? false
    }
  };
  const existingOptions = existing.options && typeof existing.options === "object" ? existing.options : {};
  json.target = {
    ...defaultTarget,
    ...existing,
    fromAnnotations: true,
    options: {
      ...defaultTarget.options,
      ...existingOptions
    }
  };
  return json;
}
const MAX_RESOLVED_HOSTS = 20;
const MAX_RESOLVED_ITEMS = 24;
const MAX_RESOLVED_GROUPS = 80;
function assertBoundedHostScope(_query, _vars) {
}
function rowsOf$2(page) {
  if (Array.isArray(page)) return page;
  return page?.rows ?? [];
}
async function resolveGroups(api, query, vars, signal) {
  const f = interpolateFilter(query.group, vars);
  if (f.ids?.length) return f.ids.map((id) => ({ groupid: id, name: id }));
  const hostF = interpolateFilter(query.host, vars);
  if (isMatchAllZabbixFilter(f.filter) && !isMatchAllZabbixFilter(hostF.filter)) {
    return [];
  }
  const page = await api.getGroups(f.filter, signal);
  let rows = rowsOf$2(page).filter((r) => matchesZabbixFilter(String(r.name || ""), f.filter));
  if (rows.length > MAX_RESOLVED_GROUPS) {
    rows = rows.slice(0, MAX_RESOLVED_GROUPS);
  }
  return rows;
}
async function resolveHosts(api, query, vars, groupids, signal) {
  const f = interpolateFilter(query.host, vars);
  if (f.ids?.length) return f.ids.map((id) => ({ hostid: id, name: id, host: id }));
  const hostTags = (query.hostTags || []).map((t2) => ({
    ...t2,
    tag: interpolateZabbixValue(t2.tag, vars),
    value: interpolateZabbixValue(t2.value, vars)
  }));
  const page = await api.getHosts(groupids, f.filter, hostTags, signal);
  let rows = rowsOf$2(page).filter(
    (r) => matchesZabbixFilter(String(r.name || r.host || ""), f.filter)
  );
  if (rows.length > MAX_RESOLVED_HOSTS) {
    rows = rows.slice(0, MAX_RESOLVED_HOSTS);
  }
  return rows;
}
async function resolveApplications(api, query, vars, hostids, signal) {
  const f = interpolateFilter(query.application, vars);
  if (f.ids?.length) return f.ids.map((id) => ({ applicationid: id, name: id }));
  if (!f.filter) return [];
  const page = await api.getApplications(hostids, f.filter, signal);
  return rowsOf$2(page).filter((r) => matchesZabbixFilter(String(r.name || ""), f.filter));
}
async function resolveItems(api, query, vars, hostids, applicationids, signal, groupids) {
  if (query.executionMode === "lld" || query.lldRuleId || query.lld?.ruleId) {
    const ruleId = String(query.lld?.ruleId || query.lldRuleId || "");
    const keys = (query.lld?.prototypeKeys || query.lldItemKeys || []).map(
      (k) => interpolateZabbixValue(k, vars)
    );
    const prototypeIds = (query.lld?.prototypeIds || []).map(String);
    return api.getDiscoveredItems(hostids, ruleId, keys, signal, {
      prototypeIds
    });
  }
  const itemFilter = interpolateFilter(query.item, vars);
  const itemTag = interpolateZabbixValue(String(query.itemTag?.filter ?? ""), vars);
  if (itemFilter.ids?.length) {
    return api.getItemsByIds(itemFilter.ids, signal);
  }
  const page = await api.getItems(
    {
      hostids,
      applicationids,
      filter: itemFilter.filter,
      itemTag,
      showDisabled: Boolean(query.options?.showDisabledItems),
      ...groupids?.length && !hostids.length ? { groupids } : {}
    },
    signal
  );
  let rows = rowsOf$2(page).filter(
    (r) => matchesZabbixFilter(String(r.name || ""), itemFilter.filter) || matchesZabbixFilter(String(r.key_ || ""), itemFilter.filter)
  );
  rows.sort((a, b) => Number(b.lastclock || 0) - Number(a.lastclock || 0));
  if (rows.length > MAX_RESOLVED_ITEMS) {
    rows = rows.slice(0, MAX_RESOLVED_ITEMS);
  }
  return rows;
}
const USER_MACRO_PATTERN = /\{\$[A-Z0-9_.]+\}/g;
function hasUserMacro(text) {
  if (!text) {
    return false;
  }
  return /\{\$[A-Z0-9_.]+\}/.test(text);
}
function expandItemMacros(text, items) {
  if (!text || !items.length) {
    return text;
  }
  let result = text;
  const first = items[0];
  result = result.replaceAll(
    "{ITEM.VALUE}",
    first.historicalValue ?? first.originalLastvalue ?? ""
  );
  result = result.replaceAll("{ITEM.LASTVALUE}", first.originalLastvalue ?? "");
  items.forEach(({ historicalValue, originalLastvalue }, index2) => {
    const n = index2 + 1;
    result = result.replaceAll(
      new RegExp(`\\{ITEM${n}\\.VALUE\\}`, "g"),
      historicalValue ?? originalLastvalue ?? ""
    );
    result = result.replaceAll(
      new RegExp(`\\{ITEM${n}\\.LASTVALUE\\}`, "g"),
      originalLastvalue ?? ""
    );
  });
  return result;
}
function expandUserMacros(text, hostMacros, globalMacros, hostids) {
  if (!text) {
    return text;
  }
  return text.replaceAll(USER_MACRO_PATTERN, (macroName) => {
    const hostMacro = hostMacros.find(
      (m) => m.macro === macroName && m.hostid !== void 0 && hostids.includes(m.hostid)
    );
    if (hostMacro && hostMacro.value != null) {
      return hostMacro.value;
    }
    const globalMacro = globalMacros.find((m) => m.macro === macroName);
    if (globalMacro && globalMacro.value != null) {
      return globalMacro.value;
    }
    return macroName;
  });
}
function toUserMacro(raw) {
  return {
    macro: String(raw.macro ?? ""),
    value: raw.value != null ? String(raw.value) : void 0,
    hostid: raw.hostid != null ? String(raw.hostid) : void 0
  };
}
function pad2$1(n) {
  return n < 10 ? `0${n}` : String(n);
}
function formatAckTime(clock2) {
  const ts = Number(clock2) * 1e3;
  if (!Number.isFinite(ts) || ts <= 0) {
    return "";
  }
  const d = new Date(ts);
  return `${d.getFullYear()}-${pad2$1(d.getMonth() + 1)}-${pad2$1(d.getDate())} ${pad2$1(d.getHours())}:${pad2$1(d.getMinutes())}:${pad2$1(d.getSeconds())}`;
}
function formatAcknowledges(acknowledges, usersById) {
  if (!Array.isArray(acknowledges)) {
    return [];
  }
  return acknowledges.map((ack) => {
    const userid = String(ack?.userid ?? "");
    let userData = usersById[userid];
    if (!userData && userid === "1") {
      userData = { userid: "1", username: "Admin" };
    }
    return {
      ...ack,
      user: userData?.username || ack?.user || "",
      name: userData?.name || "",
      surname: userData?.surname || "",
      time: formatAckTime(ack?.clock)
    };
  });
}
function clampLimit(n) {
  const v = Number(n ?? 100);
  if (!Number.isFinite(v)) return 100;
  return Math.min(1001, Math.max(1, Math.floor(v)));
}
function buildProblemsRequest(ctx, groupids, hostids, proxyids, applicationids) {
  const opts = ctx.query.options || {};
  const show = ctx.query.showProblems || "problems";
  const params = {
    limit: clampLimit(opts.limit),
    output: "extend",
    selectAcknowledges: "extend",
    selectSuppressionData: "extend",
    selectTags: "extend",
    source: 0,
    object: 0
  };
  if (groupids.length) params.groupids = groupids;
  if (hostids.length) params.hostids = hostids;
  if (proxyids?.length) params.proxyids = proxyids;
  if (applicationids?.length) params.applicationids = applicationids;
  if (opts.severities?.length) params.severities = opts.severities;
  else if (opts.minSeverity != null) {
    params.severities = [0, 1, 2, 3, 4, 5].filter((s) => s >= Number(opts.minSeverity));
  }
  if (opts.acknowledged === 0 || opts.acknowledged === 1) {
    params.acknowledged = Boolean(opts.acknowledged);
  }
  if (opts.hostsInMaintenance === false) params.maintenance = false;
  if (opts.hideAcknowledged) params.acknowledged = false;
  const tagsFilter = interpolateZabbixValue(String(ctx.query.tags?.filter || ""), ctx.scopedVars);
  if (tagsFilter) {
    params.tags = tagsFilter.split(",").map((part) => {
      const [tag, ...rest] = part.split(":");
      return { tag: tag.trim(), value: rest.join(":").trim(), operator: 0 };
    });
    params.evaltype = ctx.query.evaltype === "2" ? 2 : 0;
  }
  const triggerFilter = interpolateFilter(ctx.query.trigger, ctx.scopedVars);
  if (triggerFilter.filter) {
    params.search = { name: triggerFilter.filter };
    if (/[*%]/.test(triggerFilter.filter)) {
      params.searchWildcardsEnabled = true;
    }
  }
  if (opts.useTimeRange || show === "history") {
    params.time_from = Math.floor(
      (ctx.range.from instanceof Date ? ctx.range.from.getTime() : Number(ctx.range.from)) / 1e3
    );
    params.time_till = Math.floor(
      (ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to)) / 1e3
    );
  }
  if (opts.sortProblems === "lastchange") {
    params.sortfield = ["eventid"];
  } else if (opts.sortProblems === "priority" || opts.sortProblems === "severity") {
    params.sortfield = ["severity", "eventid"];
    params.sortorder = "DESC";
  } else {
    params.sortfield = ["eventid"];
    params.sortorder = "DESC";
  }
  if (show === "history") {
    return {
      method: "event.get",
      params: {
        ...params,
        // event.get supports selectHosts; keep slim fields for table display.
        selectHosts: ["hostid", "name", "host"],
        object: 0,
        source: 0,
        value: opts.showOkEvents ? [0, 1] : 1
      }
    };
  }
  return {
    method: "problem.get",
    params: {
      ...params,
      recent: show === "recent"
      // never send selectHosts on problem.get
    }
  };
}
function sortProblems(rows, sortProblems2) {
  const list = [...rows];
  const mode2 = sortProblems2 || "default";
  if (mode2 === "default") return list;
  list.sort((a, b) => {
    if (mode2 === "lastchange") {
      const c = Number(b.timestamp ?? b.clock ?? 0) - Number(a.timestamp ?? a.clock ?? 0);
      if (c !== 0) return c;
    } else if (mode2 === "priority" || mode2 === "severity") {
      const c = Number(b.severity || 0) - Number(a.severity || 0);
      if (c !== 0) return c;
    } else {
      const c = Number(b.severity || 0) - Number(a.severity || 0);
      if (c !== 0) return c;
      const t2 = Number(b.timestamp ?? b.clock ?? 0) - Number(a.timestamp ?? a.clock ?? 0);
      if (t2 !== 0) return t2;
    }
    return String(b.eventid || "").localeCompare(String(a.eventid || ""));
  });
  return list;
}
async function enrichProblemItemHistory(ctx, rows) {
  if (!rows.length) return { rows, values: [] };
  const allItems = [
    ...new Map(
      rows.flatMap((row) => Array.isArray(row.items) ? row.items : []).filter((item) => item?.itemid && item.value_type !== void 0).map((item) => [String(item.itemid), item])
    ).values()
  ];
  if (!allItems.length) return { rows, values: rows.map(() => null) };
  const timestamps = rows.map((row) => Number(row.timestamp ?? 0));
  const minTimestamp = Math.min(...timestamps);
  const maxTimestamp = Math.max(...timestamps);
  const timeFrom = Math.max(minTimestamp - 3600, maxTimestamp - 4 * 3600);
  const timeTill = maxTimestamp + 60;
  const byType = /* @__PURE__ */ new Map();
  for (const item of allItems) {
    const type = Number(item.value_type);
    byType.set(type, [...byType.get(type) || [], String(item.itemid)]);
  }
  const historyPages = await Promise.all(
    [...byType.entries()].map(
      ([type, itemids]) => ctx.api.getHistory(itemids, type, timeFrom, timeTill, ctx.signal, 5e4)
    )
  );
  const historyByItem = /* @__PURE__ */ new Map();
  for (const page of historyPages) {
    for (const point of page || []) {
      const key = String(point.itemid);
      historyByItem.set(key, [...historyByItem.get(key) || [], point]);
    }
  }
  const values = [];
  const enriched = rows.map((row) => {
    const clock2 = Number(row.timestamp ?? 0);
    const updatedItems = (Array.isArray(row.items) ? row.items : []).map((item) => {
      const history2 = historyByItem.get(String(item.itemid)) || [];
      const atTime = [...history2].filter((point) => Number(point.clock) <= clock2).sort((a, b) => Number(a.clock) - Number(b.clock)).at(-1);
      return atTime ? { ...item, lastvalue: atTime.value } : item;
    });
    const firstItem = updatedItems[0];
    const firstHistory = firstItem ? (historyByItem.get(String(firstItem.itemid)) || []).filter((point) => Number(point.clock) <= clock2).sort((a, b) => Number(a.clock) - Number(b.clock)).at(-1) : void 0;
    values.push(firstHistory?.value == null ? null : String(firstHistory.value));
    return { ...row, items: updatedItems };
  });
  return { rows: enriched, values };
}
async function enrichProblemsWithTriggers(ctx, rows) {
  if (!rows.length) return rows;
  const triggerids = [
    ...new Set(rows.map((r) => String(r.objectid || "")).filter((id) => id && id !== "0"))
  ];
  if (!triggerids.length) return rows;
  const page = await ctx.api.getTriggers(
    {
      triggerids,
      output: "extend",
      selectHosts: [
        "hostid",
        "name",
        "host",
        "maintenance_status",
        "description",
        "proxyid",
        "proxy_hostid"
      ],
      selectHostGroups: ["groupid", "name"],
      selectItems: ["itemid", "name", "key_", "lastvalue", "value_type"],
      expandDescription: true,
      expandData: true,
      expandExpression: true,
      monitored: true,
      skipDependent: true,
      preservekeys: true,
      limit: Math.min(1e3, Math.max(triggerids.length, 50))
    },
    ctx.signal
  );
  const list = Array.isArray(page) ? page : page?.rows || [];
  const byId2 = new Map(list.map((trigger) => [String(trigger.triggerid), trigger]));
  const history2 = ctx.query.showProblems === "history" || Boolean(ctx.query.options?.useTimeRange);
  const valueFromEvent = Boolean(ctx.query.options?.valueFromEvent);
  return rows.flatMap((source) => {
    const trigger = byId2.get(String(source.objectid));
    if (!trigger) return [];
    const problem = {
      ...history2 ? { value: valueFromEvent ? source.value : trigger.value } : {},
      timestamp: Number(source.clock),
      triggerid: source.objectid,
      eventid: source.eventid,
      name: source.name,
      severity: source.severity,
      acknowledged: source.acknowledged,
      acknowledges: source.acknowledges,
      tags: source.tags,
      suppressed: source.suppressed,
      ...!history2 ? { suppression_data: source.suppression_data } : {},
      description: history2 ? trigger.description : source.name || trigger.description,
      comments: trigger.comments,
      ...!history2 ? { value: trigger.value, opdata: source.opdata } : {},
      groups: trigger.groups || trigger.hostgroups,
      hosts: trigger.hosts,
      items: trigger.items,
      alerts: trigger.alerts,
      url: trigger.url,
      expression: trigger.expression,
      correlation_mode: trigger.correlation_mode,
      correlation_tag: trigger.correlation_tag,
      manual_close: trigger.manual_close,
      state: trigger.state,
      error: trigger.error
    };
    const hosts = Array.isArray(problem.hosts) ? problem.hosts : [];
    return [
      {
        ...problem,
        hostInMaintenance: hosts.some((host) => String(host?.maintenance_status) === "1"),
        maintenance: String(problem.suppressed) === "1",
        showAckButton: true,
        datasource: ctx.query.datasource
      }
    ];
  });
}
async function executeProblemsQuery(ctx) {
  assertBoundedHostScope(ctx.query, ctx.scopedVars);
  const opts = ctx.query.options || {};
  let groupids = [];
  let hostids = [];
  let proxyids = [];
  let applicationids = [];
  let sourceProxies = [];
  const needsMeta = Boolean(ctx.query.group?.filter) || Boolean(ctx.query.host?.filter) || Boolean(ctx.query.group?.ids?.length) || Boolean(ctx.query.host?.ids?.length) || Boolean(ctx.query.proxy?.filter) || Boolean(ctx.query.tags?.filter) || Boolean(ctx.query.application?.filter) || Boolean(ctx.query.item?.filter) || Boolean(ctx.query.itemTag?.filter) || Boolean(ctx.query.trigger?.filter);
  if (needsMeta) {
    const hostF = interpolateFilter(ctx.query.host, ctx.scopedVars);
    const groupF = interpolateFilter(ctx.query.group, ctx.scopedVars);
    const groupAll = isMatchAllZabbixFilter(groupF.filter) && !groupF.ids?.length;
    const hostAll = isMatchAllZabbixFilter(hostF.filter) && !hostF.ids?.length;
    const groups = groupAll ? [] : await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
    if (!hostAll) {
      const hosts = await resolveHosts(
        ctx.api,
        ctx.query,
        ctx.scopedVars,
        groups.map((g) => g.groupid),
        ctx.signal
      );
      hostids = hosts.map((h2) => String(h2.hostid));
    }
    groupids = groups.map((g) => g.groupid);
    if (ctx.query.application?.filter) {
      const applications = await resolveApplications(
        ctx.api,
        ctx.query,
        ctx.scopedVars,
        hostids,
        ctx.signal
      );
      applicationids = applications.map((application) => String(application.applicationid));
    }
  }
  if (opts.hostProxy || ctx.query.proxy?.filter) {
    const proxyFilter = interpolateFilter(ctx.query.proxy, ctx.scopedVars);
    const proxies = await ctx.api.getProxies(proxyFilter.filter || "", ctx.signal);
    sourceProxies = Array.isArray(proxies) ? proxies : proxies.rows || [];
    if (proxyFilter.filter || proxyFilter.ids?.length) {
      proxyids = sourceProxies.map((proxy) => String(proxy.proxyid));
      if (proxyFilter.ids?.length) proxyids = proxyFilter.ids.map(String);
    }
  }
  const built = buildProblemsRequest(ctx, groupids, hostids, proxyids, applicationids);
  let rows = [];
  if (built.method === "event.get") {
    rows = await ctx.api.getEvents(built.params, ctx.signal) || [];
  } else {
    rows = await ctx.api.getProblems(built.params, ctx.signal) || [];
  }
  rows = await enrichProblemsWithTriggers(ctx, rows);
  if (opts.hostProxy && sourceProxies.length) {
    const proxyById = new Map(
      sourceProxies.map((proxy) => [String(proxy.proxyid), proxy])
    );
    rows = rows.map((row) => {
      const hosts = Array.isArray(row.hosts) ? [...row.hosts] : [];
      const host = hosts[0];
      const proxyId = String(host?.proxyid || host?.proxy_hostid || "0");
      if (host && proxyId !== "0") {
        const proxy = proxyById.get(proxyId);
        hosts[0] = {
          ...host,
          proxy: proxy ? String(proxy.host || proxy.name || "") : ""
        };
      }
      return { ...row, hosts };
    });
  }
  rows = sortProblems(rows, opts.sortProblems);
  const limit = clampLimit(opts.limit);
  if (rows.length >= limit) rows = rows.slice(0, limit);
  const ackUserids = [
    ...new Set(
      rows.flatMap(
        (r) => (Array.isArray(r.acknowledges) ? r.acknowledges : []).map(
          (a) => String(a?.userid ?? "")
        )
      ).filter(Boolean)
    )
  ];
  if (ackUserids.length) {
    const users = await ctx.api.getUsers(ctx.signal);
    const usersById = Object.fromEntries(
      users.map((u) => [String(u.userid), u])
    );
    rows = rows.map(
      (r) => Array.isArray(r.acknowledges) && r.acknowledges.length ? { ...r, acknowledges: formatAcknowledges(r.acknowledges, usersById) } : r
    );
  }
  let historicalValues = rows.map(() => null);
  if (opts.fetchHistoricalItemValue) {
    const hist = await enrichProblemItemHistory(ctx, rows);
    rows = hist.rows;
    historicalValues = hist.values;
    const needsUserMacros = rows.some(
      (r) => hasUserMacro(r.description) || hasUserMacro(r.comments) || hasUserMacro(r.opdata)
    );
    const macroHostids = needsUserMacros ? [
      ...new Set(
        rows.flatMap(
          (r) => (Array.isArray(r.hosts) ? r.hosts : []).map((h2) => String(h2?.hostid ?? ""))
        ).filter(Boolean)
      )
    ] : [];
    let hostMacros = [];
    let globalMacros = [];
    if (needsUserMacros) {
      const [hostPage, globalPage] = await Promise.all([
        macroHostids.length ? ctx.api.getMacros(macroHostids, "", ctx.signal) : Promise.resolve({ rows: [] }),
        ctx.api.getGlobalMacros(ctx.signal)
      ]);
      hostMacros = (hostPage.rows || []).map(toUserMacro);
      globalMacros = (Array.isArray(globalPage) ? globalPage : []).map(toUserMacro);
    }
    rows = rows.map((r, index2) => {
      const items = Array.isArray(r.items) ? r.items : [];
      const itemResolutions = items.map((it, itemIdx) => ({
        originalLastvalue: it?.lastvalue ?? null,
        // only the first item's value-at-problem-time is known
        historicalValue: itemIdx === 0 ? historicalValues[index2] ?? null : null
      }));
      const problemHostids = (Array.isArray(r.hosts) ? r.hosts : []).map((h2) => String(h2?.hostid ?? "")).filter(Boolean);
      const host = (Array.isArray(r.hosts) ? r.hosts : [])[0];
      const expand2 = (text) => {
        let out = String(text ?? "");
        if (!out) return out;
        if (host) {
          out = out.replaceAll("{HOST.NAME}", host.name || "");
          out = out.replaceAll("{HOST.HOST}", host.host || "");
        }
        out = expandItemMacros(out, itemResolutions);
        out = expandUserMacros(out, hostMacros, globalMacros, problemHostids);
        return out;
      };
      return {
        ...r,
        description: expand2(r.description),
        comments: expand2(r.comments),
        opdata: expand2(r.opdata)
      };
    });
  }
  return [
    createDataFrame({
      name: "problems",
      refId: ctx.query.refId,
      meta: {
        source: "live",
        datasourceUid: ctx.instance.uid
      },
      fields: [
        {
          name: "Problems",
          type: "other",
          values: rows,
          config: { custom: { type: "problems" } }
        }
      ]
    })
  ];
}
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
function pad2(value) {
  return String(value).padStart(2, "0");
}
function formatAcknowledgeTime(clock2) {
  const value = new Date(Number(clock2) * 1e3);
  return `${pad2(value.getDate())} ${MONTHS[value.getMonth()]} ${value.getFullYear()} ${pad2(value.getHours())}:${pad2(value.getMinutes())}:${pad2(value.getSeconds())}`;
}
function formatAnnotationAcknowledges(acknowledges) {
  if (!Array.isArray(acknowledges) || !acknowledges.length) return "";
  let output = "<br><br>Acknowledges:<br><table><tr><td><b>Time</b></td><td><b>User</b></td><td><b>Comments</b></td></tr>";
  for (const acknowledge of acknowledges) {
    output += `<tr><td><i>${formatAcknowledgeTime(acknowledge.clock)}</i></td><td>${String(acknowledge.alias)} (${String(acknowledge.name)} ${String(acknowledge.surname)})</td><td>${String(acknowledge.message)}</td></tr>`;
  }
  return `${output}</table>`;
}
async function executeAnnotationQuery(args) {
  const wrapper = args.annotation || {};
  const ann = wrapper.target && typeof wrapper.target === "object" ? wrapper.target : wrapper;
  const annOptions = ann.options && typeof ann.options === "object" ? ann.options : {};
  const filterValue = (value) => value && typeof value === "object" && "filter" in value ? String(value.filter ?? "") : String(value ?? "");
  const triggerFilter = filterValue(ann.trigger);
  const showOkEvents = Boolean(annOptions.showOkEvents);
  const query = {
    ...DEFAULT_ZABBIX_QUERY,
    refId: "Anno",
    queryType: "5",
    group: { filter: filterValue(ann.group || ann.groupFilter) },
    host: { filter: filterValue(ann.host || ann.hostFilter) },
    application: { filter: filterValue(ann.application) },
    trigger: { filter: "" },
    showProblems: "history",
    options: {
      ...DEFAULT_ZABBIX_QUERY.options,
      useTimeRange: true,
      showOkEvents,
      valueFromEvent: true,
      showHostname: (annOptions.showHostname ?? ann.showHostname ?? true) !== false,
      minSeverity: annOptions.minSeverity != null ? Number(annOptions.minSeverity) : void 0,
      limit: Number(annOptions.limit ?? ann.limit) || 100
    }
  };
  const ctx = {
    api: args.api,
    instance: args.instance,
    query,
    range: args.range,
    scopedVars: {},
    signal: args.signal
  };
  const frames = await executeProblemsQuery(ctx);
  const src = frames[0];
  if (!src) return [];
  let problemValues = src.fields.find((field) => field.name === "Problems")?.values;
  if (triggerFilter) {
    const regex = triggerFilter.match(/^\/(.*)\/([gimsuy]*)$/);
    problemValues = (problemValues || []).filter((problem) => {
      const description = String(problem.description ?? "");
      return regex ? new RegExp(regex[1], regex[2].replace("g", "")).test(description) : description === triggerFilter;
    });
  }
  if (annOptions.hideAcknowledged ?? ann.hideAcknowledged) {
    problemValues = (problemValues || []).filter(
      (problem) => !Array.isArray(problem.acknowledges) || !problem.acknowledges.length
    );
  }
  const n = problemValues?.length || 0;
  const titles = [];
  const times = [];
  const annotations = [];
  const texts = [];
  const tags = [];
  for (let i = 0; i < n; i++) {
    const problem = problemValues[i];
    titles.push(String(problem.value) === "1" ? "Problem" : "OK");
    times.push(Number(problem.timestamp ?? problem.clock ?? 0) * 1e3);
    annotations.push(ann);
    texts.push(
      `${String(problem.name ?? "")}${formatAnnotationAcknowledges(problem.acknowledges)}`
    );
    tags.push(
      (annOptions.showHostname ?? ann.showHostname ?? true) !== false ? (Array.isArray(problem.hosts) ? problem.hosts : []).map(
        (host) => String(host?.name || "")
      ) : []
    );
  }
  return [
    createDataFrame({
      fields: [
        { name: "title", type: "string", values: titles },
        { name: "time", type: "time", values: times },
        { name: "annotation", type: "other", values: annotations },
        { name: "text", type: "string", values: texts },
        { name: "tags", type: "other", values: tags }
      ]
    })
  ];
}
const ZABBIX_VALUE_TYPES = {
  0: {
    valueType: 0,
    history: 0,
    name: "float",
    fieldType: "number",
    supportsTrends: true
  },
  1: {
    valueType: 1,
    history: 1,
    name: "character",
    fieldType: "string",
    supportsTrends: false
  },
  2: {
    valueType: 2,
    history: 2,
    name: "log",
    fieldType: "string",
    supportsTrends: false
  },
  3: {
    valueType: 3,
    history: 3,
    name: "unsigned",
    fieldType: "number",
    supportsTrends: true
  },
  4: {
    valueType: 4,
    history: 4,
    name: "text",
    fieldType: "string",
    supportsTrends: false
  },
  5: {
    valueType: 5,
    history: 5,
    name: "binary",
    fieldType: "string",
    supportsTrends: false
  }
};
const NAME_TO_CODE = {
  "float": 0,
  "character": 1,
  "log": 2,
  "unsigned": 3,
  "text": 4,
  "binary": 5,
  "0": 0,
  "1": 1,
  "2": 2,
  "3": 3,
  "4": 4,
  "5": 5
};
function resolveValueTypeSpec(input, opts) {
  if (input == null || input === "") {
    if (opts?.allowUnknownAsFloat) return ZABBIX_VALUE_TYPES[0];
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.itemValueTypeMissing")
    );
  }
  if (typeof input === "number" && ZABBIX_VALUE_TYPES[input]) return ZABBIX_VALUE_TYPES[input];
  const key = String(input).toLowerCase().trim();
  const code = NAME_TO_CODE[key];
  if (code != null && ZABBIX_VALUE_TYPES[code]) return ZABBIX_VALUE_TYPES[code];
  const n = Number(input);
  if (Number.isFinite(n) && ZABBIX_VALUE_TYPES[n]) return ZABBIX_VALUE_TYPES[n];
  if (opts?.allowUnknownAsFloat) return ZABBIX_VALUE_TYPES[0];
  throw new DataSourceError(
    "UNSUPPORTED_CAPABILITY",
    zabbixT("zabbix.error.unsupportedValueType", { valueType: String(input) })
  );
}
function mapHistoryRawValue(raw, spec) {
  if (raw == null || raw === "") return { value: null, valueRaw: raw == null ? null : "" };
  if (spec.name === "binary") {
    const s2 = String(raw);
    return { value: s2, valueRaw: s2, byteLength: s2.length };
  }
  if (spec.fieldType === "string") {
    const s2 = String(raw);
    return { value: s2, valueRaw: s2 };
  }
  if (typeof raw === "number") {
    if (!Number.isFinite(raw)) return { value: null, valueRaw: String(raw) };
    if (spec.name === "unsigned") {
      const s2 = String(Math.trunc(raw));
      return { value: raw, valueRaw: s2 };
    }
    return { value: raw, valueRaw: String(raw) };
  }
  const s = String(raw).trim();
  if (!s) return { value: null, valueRaw: s };
  if (spec.name === "unsigned") {
    if (/^\d+$/.test(s)) {
      try {
        const n2 = Number(s);
        if (!Number.isFinite(n2)) throw new Error("unsigned overflow");
        return { value: n2, valueRaw: s };
      } catch {
        return {
          value: null,
          valueRaw: s,
          notice: zabbixT("zabbix.error.unsignedParseFailed")
        };
      }
    }
    return {
      value: null,
      valueRaw: s,
      notice: zabbixT("zabbix.error.unsignedParseFailed")
    };
  }
  const n = Number(s);
  if (!Number.isFinite(n)) return { value: null, valueRaw: s };
  return { value: n, valueRaw: s };
}
function mapHistoryPoints(pts, spec) {
  const times = [];
  const values = [];
  const valueRaw = [];
  const ns = [];
  const timestamp = [];
  const source = [];
  const severity = [];
  const logeventid = [];
  const notices = [];
  for (const p of pts) {
    times.push(Number(p.clock) * 1e3 + Math.floor(Number(p.ns || 0) / 1e6));
    ns.push(p.ns == null ? null : String(p.ns));
    const raw = p.value_avg ?? p.value;
    const mapped = mapHistoryRawValue(raw, spec);
    if (mapped.notice) notices.push(mapped.notice);
    values.push(mapped.value);
    valueRaw.push(mapped.valueRaw);
    if (spec.name === "log") {
      timestamp.push(p.timestamp == null ? null : String(p.timestamp));
      source.push(p.source == null ? null : String(p.source));
      severity.push(p.severity == null ? null : String(p.severity));
      logeventid.push(p.logeventid == null ? null : String(p.logeventid));
    } else {
      timestamp.push(null);
      source.push(null);
      severity.push(null);
      logeventid.push(null);
    }
  }
  return {
    times,
    values,
    valueRaw,
    ns,
    log: { timestamp, source, severity, logeventid },
    notices,
    fieldType: spec.fieldType
  };
}
function parseIntervalMs(value, now2 = /* @__PURE__ */ new Date()) {
  const interval = String(value || "");
  const calendar = interval.match(/^(\d+)([dwMy])$/);
  if (calendar) {
    const count = Number(calendar[1]);
    const previous = new Date(now2.getTime());
    switch (calendar[2]) {
      case "d":
        previous.setDate(previous.getDate() - count);
        break;
      case "w":
        previous.setDate(previous.getDate() - count * 7);
        break;
      case "M":
        previous.setMonth(previous.getMonth() - count);
        break;
      case "y":
        previous.setFullYear(previous.getFullYear() - count);
        break;
    }
    return now2.getTime() - previous.getTime();
  }
  if (/^[+-]?0$/.test(interval)) return 0;
  const duration = interval.match(
    /^([+-])?((?:(?:\d+(?:\.\d*)?|\.\d+)(?:ns|us|µs|μs|ms|[smh]))+)$/
  );
  if (!duration) {
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.invalidInterval", { value }));
  }
  const nanosecondsPerUnit = {
    ns: 1n,
    us: 1000n,
    µs: 1000n,
    μs: 1000n,
    ms: 1000000n,
    s: 1000000000n,
    m: 60000000000n,
    h: 3600000000000n
  };
  const maxMagnitude = 1n << 63n;
  let totalNanoseconds = 0n;
  for (const part of duration[2].matchAll(/(\d+(?:\.\d*)?|\.\d+)(ns|us|µs|μs|ms|[smh])/g)) {
    const [whole = "", fraction = ""] = part[1].split(".");
    const unit = nanosecondsPerUnit[part[2]];
    let component = BigInt(whole || "0") * unit;
    if (fraction) {
      let fractionValue = 0n;
      let scale = 1;
      let overflow = false;
      for (const digit of fraction) {
        if (overflow) continue;
        if (fractionValue > (maxMagnitude - 1n) / 10n) {
          overflow = true;
          continue;
        }
        const next = fractionValue * 10n + BigInt(digit);
        if (next > maxMagnitude) {
          overflow = true;
          continue;
        }
        fractionValue = next;
        scale *= 10;
      }
      component += BigInt(Math.trunc(Number(fractionValue) * (Number(unit) / scale)));
    }
    totalNanoseconds += component;
    if (totalNanoseconds > maxMagnitude) {
      throw new DataSourceError(
        "INVALID_QUERY",
        zabbixT("zabbix.error.invalidInterval", { value })
      );
    }
  }
  const negative = duration[1] === "-";
  const limit = negative ? maxMagnitude : maxMagnitude - 1n;
  if (totalNanoseconds > limit) {
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.invalidInterval", { value }));
  }
  if (totalNanoseconds === 0n) return 0;
  const milliseconds = Number(totalNanoseconds) / 1e6;
  return negative ? -milliseconds : milliseconds;
}
function finiteNumbers(values) {
  const out = [];
  for (const v of values) {
    if (v == null || v === "") continue;
    const n = typeof v === "number" ? v : Number(v);
    if (Number.isFinite(n)) out.push(n);
  }
  return out;
}
function finiteValue(value) {
  if (value == null || value === "") return null;
  const n = typeof value === "number" ? value : Number(value);
  return Number.isFinite(n) ? n : null;
}
function percentileValue(values, p) {
  const nums = finiteNumbers(values).sort((a, b) => a - b);
  if (!nums.length) return null;
  const idx = Math.floor(nums.length * p / 100);
  return nums[Math.min(idx, nums.length - 1)];
}
function aggregateValues(values, fn, percentile = 95) {
  if (fn === "percentile") return percentileValue(values, percentile);
  if (fn === "count") return values.length;
  if (fn === "first") return finiteValue(values[0]);
  if (fn === "last") return finiteValue(values[values.length - 1]);
  const nums = finiteNumbers(values);
  if (!nums.length) return null;
  switch (fn) {
    case "avg":
      return nums.reduce((a, b) => a + b, 0) / nums.length;
    case "min":
      return Math.min(...nums);
    case "max":
      return Math.max(...nums);
    case "sum":
      return nums.reduce((a, b) => a + b, 0);
    case "median":
      return percentileValue(nums, 50);
    default:
      return null;
  }
}
const FUNCTION_STAGES = {
  timeShift: "request",
  trendValue: "request",
  consolidateBy: "request",
  scale: "point",
  offset: "point",
  delta: "point",
  rate: "point",
  movingAverage: "point",
  exponentialMovingAverage: "point",
  percentile: "point",
  removeAboveValue: "point",
  removeBelowValue: "point",
  transformNull: "point",
  groupBy: "series",
  aggregateBy: "series",
  sumSeries: "series",
  percentileAgg: "series",
  top: "series",
  bottom: "series",
  sortSeries: "series",
  minSeries: "series",
  maxSeries: "series",
  avgSeries: "series",
  setAlias: "alias",
  setAliasByRegex: "alias",
  replaceAlias: "alias"
};
function parseTimeShiftMs(raw) {
  const s = String(raw || "0").trim();
  if (!s) return 0;
  if (s.startsWith("+")) return parseIntervalMs(s.slice(1));
  if (s.startsWith("-")) return -parseIntervalMs(s.slice(1));
  return -parseIntervalMs(s);
}
function planQueryFunctions(functions = []) {
  let timeShiftMs = 0;
  let trendValue = "avg";
  let consolidateBy = "";
  const postFetch = [];
  const stageByName = {};
  for (const fn of functions) {
    const stage = FUNCTION_STAGES[fn.name];
    if (!stage) {
      throw new Error(`function not supported: ${fn.name}`);
    }
    stageByName[fn.name] = stage;
    if (fn.name === "timeShift") {
      const shiftMs = parseTimeShiftMs(String(fn.params?.[0] ?? "0"));
      if (shiftMs === 0) {
        throw new Error("interval should be non-null value");
      }
      timeShiftMs += shiftMs;
      postFetch.push({
        name: "timeShift",
        params: [`${-shiftMs}ms`]
      });
      continue;
    }
    if (fn.name === "trendValue") {
      const v = String(fn.params?.[0] ?? "avg");
      trendValue = ["avg", "min", "max", "sum", "count"].includes(v) ? v : "avg";
      continue;
    }
    if (fn.name === "consolidateBy") {
      consolidateBy = String(fn.params?.[0] ?? "avg");
      continue;
    }
    postFetch.push(fn);
  }
  return {
    timeShiftMs,
    displayShiftMs: -timeShiftMs,
    trendValue,
    consolidateBy,
    postFetchFunctions: postFetch,
    stageByName
  };
}
function applyPlanToRange(fromMs, toMs2, plan) {
  return {
    fromMs: fromMs + plan.timeShiftMs,
    toMs: toMs2 + plan.timeShiftMs
  };
}
function sanitizeTagName(name) {
  return name.replaceAll(/\W/g, "_");
}
function aliasContext(series) {
  const host = series.item.hosts?.[0];
  const ctx = {
    __zbx_host: String(host?.name || host?.host || ""),
    __zbx_host_name: String(host?.name || host?.host || ""),
    __zbx_host_id: String(host?.hostid || series.item.hostid || ""),
    __zbx_item: String(series.item.name || ""),
    __zbx_item_name: String(series.item.name || ""),
    __zbx_item_id: String(series.item.itemid || ""),
    __zbx_item_key: String(series.item.key_ || "")
  };
  const tagMap = /* @__PURE__ */ new Map();
  for (const t2 of series.item.tags || []) {
    if (!t2.tag) continue;
    const key = sanitizeTagName(t2.tag);
    const list = tagMap.get(key) || [];
    list.push(String(t2.value ?? ""));
    tagMap.set(key, list);
  }
  for (const [k, vals] of tagMap) {
    ctx[`__zbx_item_tag_${k}`] = vals.sort().join(", ");
  }
  return ctx;
}
function expand(template, ctx) {
  return String(template || "").replaceAll(
    /\$([A-Z_]\w*)/gi,
    (token, name) => name in ctx ? ctx[name] : token
  );
}
function applyAliasFunction(series, name, params) {
  const ctx = aliasContext(series);
  const current = series.name || series.item.name || series.item.key_;
  if (name === "setAlias") {
    return { ...series, name: expand(String(params[0] ?? ""), ctx) };
  }
  if (name === "setAliasByRegex") {
    try {
      const re = new RegExp(String(params[0] ?? ""));
      return { ...series, name: re.exec(current)?.[0] ?? current };
    } catch {
      throw new DataSourceError(
        "INVALID_QUERY",
        zabbixT("zabbix.error.invalidAliasRegex", {
          function: "setAliasByRegex"
        })
      );
    }
  }
  if (name === "replaceAlias") {
    try {
      const raw = String(params[0] ?? "");
      const slash = raw.match(/^\/(.*)\/([a-z]*)$/i);
      const re = slash ? new RegExp(slash[1], slash[2]) : raw;
      return {
        ...series,
        name: expand(current.replace(re, String(params[1] ?? "")), ctx)
      };
    } catch {
      throw new DataSourceError(
        "INVALID_QUERY",
        zabbixT("zabbix.error.invalidAliasRegex", { function: "replaceAlias" })
      );
    }
  }
  return series;
}
function bucketSeries(series, intervalMs, fn) {
  if (intervalMs <= 0) return series;
  const buckets = /* @__PURE__ */ new Map();
  for (const p of series.points) {
    const key = Math.floor(p.time / intervalMs) * intervalMs;
    const list = buckets.get(key) || [];
    list.push(typeof p.value === "number" ? p.value : p.value == null ? null : Number(p.value));
    buckets.set(key, list);
  }
  const points = [...buckets.entries()].sort((a, b) => a[0] - b[0]).flatMap(([time, values], index2, entries) => {
    const result = [{ time, value: aggregateValues(values, fn) }];
    const nextTime = entries[index2 + 1]?.[0];
    for (let gap = time + intervalMs; nextTime != null && gap < nextTime; gap += intervalMs) {
      result.push({ time: gap, value: null });
    }
    return result;
  });
  return { ...series, points };
}
function alignSeries(series, fromMs, toMs2, intervalMs) {
  if (intervalMs <= 0 || series.points.length < 2) return series;
  const points = [];
  let frameTime = Math.floor(series.points[0].time / intervalMs) * intervalMs;
  for (let index2 = 0; index2 < series.points.length; index2++) {
    const point = series.points[index2];
    const pointTime = Math.floor(point.time / intervalMs) * intervalMs;
    if (pointTime > frameTime) {
      const missing = [];
      while (frameTime < pointTime) {
        missing.push({ time: frameTime, value: null });
        frameTime += intervalMs;
      }
      if (missing.length > 1) points.push(...missing);
      else if (missing.length === 1 && index2 < series.points.length - 1) {
        const left = points[points.length - 1];
        const leftValue = Number(left.value);
        const rightValue = Number(point.value);
        const ratio = (missing[0].time - left.time) / (pointTime - left.time);
        missing[0].value = leftValue + (rightValue - leftValue) * ratio;
        points.push(missing[0]);
      }
    }
    const aligned = { ...point, time: pointTime };
    if (points.at(-1)?.time === pointTime) points[points.length - 1] = aligned;
    else points.push(aligned);
    frameTime += intervalMs;
  }
  return { ...series, points };
}
function fillTrendWithNulls(series) {
  if (series.points.length < 2) return series;
  const intervalMs = 60 * 60 * 1e3;
  const points = [];
  let frameTime = Math.floor(series.points[0].time / intervalMs) * intervalMs;
  for (const point of series.points) {
    const pointTime = Math.floor(point.time / intervalMs) * intervalMs;
    while (frameTime < pointTime) {
      points.push({ time: frameTime, value: null });
      frameTime += intervalMs;
    }
    points.push({ ...point });
    frameTime += intervalMs;
  }
  return { ...series, points };
}
function prepareForStack(series) {
  if (!series.length) return series;
  const timestamps = [
    ...new Set(series.flatMap((entry) => entry.points.map((point) => point.time)))
  ].sort((a, b) => a - b);
  return series.map((entry) => {
    if (entry.points.length < 2) return entry;
    const points = [];
    let timestampIndex = 0;
    while (timestampIndex < timestamps.length && timestamps[timestampIndex] < entry.points[0].time) {
      points.push({ time: timestamps[timestampIndex], value: null });
      timestampIndex++;
    }
    for (let pointIndex = 0; pointIndex < entry.points.length - 1; pointIndex++) {
      const point = entry.points[pointIndex];
      const next = entry.points[pointIndex + 1];
      points.push({ ...point });
      while (timestampIndex < timestamps.length && timestamps[timestampIndex] < next.time) {
        const time = timestamps[timestampIndex];
        if (time === point.time) {
          timestampIndex++;
          continue;
        }
        const value = point.value != null && next.value != null ? Number(point.value) + (Number(next.value) - Number(point.value)) * (time - point.time) / (next.time - point.time) : null;
        points.push({ time, value });
        timestampIndex++;
      }
    }
    points.push({ ...entry.points[entry.points.length - 1] });
    return { ...entry, points };
  });
}
const ZABBIX_UNIT_MAP = {
  "%": "percent",
  "b": "decbits",
  // bits(SI)
  "bps": "bps",
  // bits/sec(SI)
  "B": "bytes",
  // bytes(IEC)
  "Bps": "binBps",
  // bytes/sec(IEC)
  // 'unixtime': 'dateTimeAsSystem', // matches React: left commented out upstream
  "uptime": "dtdhms",
  "qps": "qps",
  // requests/sec (rps)
  "iops": "iops",
  // I/O ops/sec (iops)
  "Hz": "hertz",
  // Hertz (1/s)
  "V": "volt",
  // Volt (V)
  "C": "celsius",
  // Celsius (°C)
  "RPM": "rotrpm",
  // Revolutions per minute (rpm)
  "dBm": "dBm"
  // Decibel-milliwatt (dBm)
};
let knownUnitIds = null;
function getKnownGrafanaUnitIds() {
  if (!knownUnitIds) knownUnitIds = new Set(listValueFormatIds());
  return knownUnitIds;
}
function convertZabbixUnit(zabbixUnit) {
  if (!zabbixUnit) return void 0;
  const mapped = ZABBIX_UNIT_MAP[zabbixUnit];
  if (mapped) return mapped;
  if (getKnownGrafanaUnitIds().has(zabbixUnit)) return zabbixUnit;
  return void 0;
}
function itemLabel(item) {
  const host = item.hosts?.[0]?.name || item.hosts?.[0]?.host || "";
  return host ? `${host}: ${item.name}` : item.name || item.key_;
}
function seriesToDataFrame(series, refId, datasourceUid, valueMaps) {
  const times = series.points.map((p) => p.time);
  const values = series.points.map((p) => p.value);
  const display = series.name || itemLabel(series.item);
  const host = series.item.hosts?.[0];
  const tagValues = /* @__PURE__ */ new Map();
  for (const tag of series.item.tags || []) {
    const key = tag.tag.replaceAll(/\W/g, "_");
    if (!key) continue;
    tagValues.set(key, [...tagValues.get(key) || [], String(tag.value ?? "")]);
  }
  const scopedVars = {
    __zbx_item: { value: series.item.name },
    __zbx_item_name: { value: series.item.name },
    __zbx_item_key: { value: series.item.key_ },
    __zbx_item_interval: { value: String(series.item.delay || "") }
  };
  if (host) {
    scopedVars.__zbx_host = { value: host.name || host.host || "" };
    scopedVars.__zbx_host_id = { value: host.hostid };
    scopedVars.__zbx_host_name = { value: host.name || host.host || "" };
  }
  for (const [key, entries] of tagValues) {
    scopedVars[`__zbx_item_tag_${key}`] = { value: entries.sort().join(", ") };
  }
  const unit = convertZabbixUnit(series.item.units);
  const mappings = valueMaps && series.item.valuemapid ? valueMaps.get(String(series.item.valuemapid)) : void 0;
  const fields = [
    {
      name: "Time",
      type: "time",
      values: times,
      config: { custom: { itemInterval: series.item.delay } }
    },
    {
      name: "Value",
      type: "number",
      values: values.map((v) => v == null || v === "" ? null : Number(v)),
      labels: {
        ...host ? { host: host.name || host.host || "" } : {},
        item: series.item.name,
        item_key: series.item.key_
      },
      config: {
        displayNameFromDS: display,
        custom: { scopedVars, itemInterval: series.item.delay },
        ...unit ? { unit } : {},
        ...unit === "percent" ? { min: 0, max: 100 } : {},
        ...Array.isArray(mappings) && mappings.length ? {
          mappings: mappings.map((mapping) => ({
            type: "value",
            options: {
              [String(mapping.value)]: { text: mapping.newvalue }
            }
          }))
        } : {}
      }
    }
  ];
  const frame = createDataFrame({
    refId,
    name: display,
    fields
  });
  frame.meta = {
    source: "live",
    datasourceUid,
    ...series.points.some((point) => point.valueRaw != null) ? {
      custom: {
        valueRaw: series.points.map(
          (point) => point.valueRaw == null ? null : String(point.valueRaw)
        )
      }
    } : {}
  };
  return frame;
}
function seriesListToFrames(series, refId, datasourceUid, valueMaps) {
  return series.map((s) => seriesToDataFrame(s, refId, datasourceUid, valueMaps));
}
function seriesToFrames(series, refId) {
  return seriesListToFrames(series, refId, "");
}
function emptyItem(name) {
  return { itemid: "", name, key_: "", hostid: "", value_type: "0" };
}
function seriesScore(s, fn) {
  const v = aggregateValues(
    s.points.map((p) => p.value),
    fn
  );
  return v == null ? Number.NEGATIVE_INFINITY : v;
}
function sumSeries(list) {
  if (!list.length) return [];
  const times = /* @__PURE__ */ new Set();
  for (const s of list) for (const p of s.points) times.add(p.time);
  const sorted = [...times].sort((a, b) => a - b);
  const interpolated = list.filter((series) => series.points.length).map((series) => {
    const existing = new Map(series.points.map((point) => [point.time, point.value]));
    const aligned = sorted.map((time) => ({
      time,
      value: existing.get(time) ?? null
    }));
    return aligned.map((point, pointIndex) => {
      if (point.value != null) return Number(point.value);
      let left;
      for (let index2 = pointIndex; index2 > 0; index2--) {
        if (aligned[index2].value != null) {
          left = aligned[index2];
          break;
        }
      }
      let right;
      for (let index2 = pointIndex; index2 < aligned.length; index2++) {
        if (aligned[index2].value != null) {
          right = aligned[index2];
          break;
        }
      }
      const start = left ?? right;
      const end = right ?? left;
      if (!start || !end) return null;
      if (start.time === end.time) return Number(start.value);
      return Number(start.value) + (Number(end.value) - Number(start.value)) * (point.time - start.time) / (end.time - start.time);
    });
  });
  const points = sorted.map((time, index2) => ({
    time,
    value: interpolated.reduce((sum, values) => sum + (values[index2] ?? 0), 0)
  }));
  const name = "sumSeries()";
  return [
    {
      item: emptyItem(name),
      name,
      points,
      meta: { derived: true, sources: list.map((s) => s.item.itemid) }
    }
  ];
}
function aggregateAcrossSeries(list, interval, fn, percent) {
  if (!list.length) return [];
  const name = fn === "percentile" ? `percentileAgg(${interval}, ${percent})` : `aggregateBy(${interval}, ${fn})`;
  if (interval === "range_series") {
    const sourcePoints = list.flatMap((series) => series.points);
    const value = fn === "percentile" ? aggregateValues(
      sourcePoints.map((point) => point.value),
      "percentile",
      percent ?? 95
    ) : aggregateValues(
      sourcePoints.map((point) => point.value),
      fn
    );
    return [
      {
        item: emptyItem(name),
        name,
        points: sourcePoints.length ? [
          { time: sourcePoints[0].time, value },
          { time: sourcePoints[sourcePoints.length - 1].time, value }
        ] : [],
        meta: {
          derived: true,
          acrossSeries: true,
          sources: list.map((series) => series.item.itemid)
        }
      }
    ];
  }
  const intervalMs = parseIntervalMs(interval || "1m");
  const buckets = /* @__PURE__ */ new Map();
  for (const s of list) {
    for (const p of s.points) {
      const key = Math.floor(p.time / intervalMs) * intervalMs;
      const arr = buckets.get(key) || [];
      arr.push(p.value == null || p.value === "" ? null : Number(p.value));
      buckets.set(key, arr);
    }
  }
  const entries = [...buckets.entries()].sort((a, b) => a[0] - b[0]);
  const points = entries.flatMap(([time, values], index2) => {
    const points2 = [
      {
        time,
        value: fn === "percentile" ? aggregateValues(values, "percentile", percent ?? 95) : aggregateValues(values, fn)
      }
    ];
    const nextTime = entries[index2 + 1]?.[0];
    for (let gap = time + intervalMs; nextTime != null && gap < nextTime; gap += intervalMs) {
      points2.push({ time: gap, value: null });
    }
    return points2;
  });
  return [
    {
      item: emptyItem(name),
      name,
      points,
      meta: {
        derived: true,
        acrossSeries: true,
        sources: list.map((s) => s.item.itemid)
      }
    }
  ];
}
function percentileAgg(list, interval, percent) {
  return aggregateAcrossSeries(list, interval, "percentile", percent);
}
function aggregateByAcross(list, interval, fn) {
  return aggregateAcrossSeries(list, interval, fn);
}
function topSeries(list, n, by = "avg") {
  const scored = [...list].sort((a, b) => seriesScore(b, by) - seriesScore(a, by));
  return scored.slice(0, Math.max(0, Math.floor(n)));
}
function bottomSeries(list, n, by = "avg") {
  const scored = [...list].sort((a, b) => seriesScore(a, by) - seriesScore(b, by));
  return scored.slice(0, Math.max(0, Math.floor(n)));
}
function sortSeriesList(list, direction = "asc") {
  const dir = direction === "desc" ? -1 : 1;
  return [...list].sort((a, b) => {
    const na = (a.name || a.item.name || "").localeCompare(b.name || b.item.name || "");
    if (na !== 0) return na * dir;
    return String(a.item.itemid).localeCompare(String(b.item.itemid)) * dir;
  });
}
function timeShift(list, offsetMs) {
  return list.map((s) => ({
    ...s,
    points: s.points.map((p) => ({
      ...p,
      time: p.time + offsetMs,
      value: p.value
    }))
  }));
}
function clone(series, points = series.points) {
  return { ...series, points: points.map((p) => ({ ...p })) };
}
function transformGroupBy(series, interval, fn) {
  if (interval === "range_series") {
    if (!series.points.length) return series;
    const value = aggregateValues(
      series.points.map((point) => point.value),
      fn
    );
    return clone(series, [
      { time: series.points[0].time, value },
      { time: series.points[series.points.length - 1].time, value }
    ]);
  }
  return bucketSeries(series, parseIntervalMs(interval), fn);
}
function transformScale(series, factor) {
  return clone(
    series,
    series.points.map((p) => ({
      time: p.time,
      value: p.value == null || p.value === "" ? null : Number(p.value) * factor
    }))
  );
}
function transformOffset(series, offset) {
  return clone(
    series,
    series.points.map((p) => ({
      time: p.time,
      value: p.value == null || p.value === "" ? null : Number(p.value) + offset
    }))
  );
}
function transformDelta(series) {
  const points = series.points.slice(1).map((p, index2) => {
    const previous = series.points[index2];
    if (p.value == null || previous.value == null) {
      return { time: p.time, value: null };
    }
    return {
      time: p.time,
      value: Number(p.value) - Number(previous.value)
    };
  });
  return clone(series, points);
}
function transformRate(series) {
  let lastRate = 0;
  const points = series.points.slice(1).map((p, index2) => {
    const previous = series.points[index2];
    const curr = Number(p.value);
    const prev = Number(previous.value);
    if (p.value != null && previous.value != null && curr >= prev) {
      const elapsedSeconds = (p.time - previous.time) / 1e3;
      lastRate = (curr - prev) / elapsedSeconds;
    }
    return { time: p.time, value: lastRate };
  });
  return clone(series, points);
}
function transformMovingAverage(series, window2) {
  const pts = series.points;
  if (!pts.length) return clone(series, []);
  const n = Math.min(pts.length, Math.floor(window2));
  const numOf = (v) => v == null || v === "" ? null : Number(v);
  const out = new Array(pts.length);
  let windowCount = 0;
  let windowSum = 0;
  for (let i = 0; i < n; i++) {
    const v = numOf(pts[i].value);
    if (v != null) {
      windowSum += v;
      windowCount++;
    }
  }
  out[0] = {
    time: pts[0].time,
    value: windowCount > 0 ? windowSum / windowCount : numOf(pts[0].value)
  };
  for (let i = 1; i < pts.length; i++) {
    const leftEdge = Math.max(0, i - n);
    const leftVal = numOf(pts[leftEdge].value);
    if (leftVal != null && windowCount > 0) {
      if (i < n) {
        windowSum -= windowSum / windowCount;
      } else {
        windowSum -= leftVal;
      }
      windowCount--;
    }
    const v = numOf(pts[i].value);
    if (v != null) {
      windowSum += v;
      windowCount++;
      out[i] = { time: pts[i].time, value: windowSum / windowCount };
    } else {
      out[i] = { time: pts[i].time, value: null };
    }
  }
  return clone(series, out);
}
function transformExponentialMovingAverage(series, window2) {
  const pts = series.points;
  if (!pts.length) return clone(series, []);
  const numOf = (v) => v == null || v === "" ? null : Number(v);
  const an = Math.min(pts.length, window2);
  const out = new Array(pts.length);
  let alpha2;
  let start = 1;
  let emaPrev = numOf(pts[0].value) ?? 0;
  if (an > 1) {
    alpha2 = 2 / (an + 1);
    const n = Math.floor(an);
    let windowCount = 0;
    let windowSum = 0;
    for (let i = 0; i < n; i++) {
      const v = numOf(pts[i].value);
      if (v != null) {
        windowSum += v;
        windowCount++;
      }
    }
    if (windowCount > 0) {
      const windowAvg = windowSum / windowCount;
      out[0] = { time: pts[0].time, value: windowAvg };
      emaPrev = windowAvg;
    } else {
      out[0] = { time: pts[0].time, value: null };
      start = n;
    }
    if (windowCount > 0) start = 1;
  } else {
    alpha2 = an;
    out[0] = { time: pts[0].time, value: numOf(pts[0].value) };
    start = 1;
  }
  for (let i = start; i < pts.length; i++) {
    const v = numOf(pts[i].value);
    if (v != null) {
      emaPrev = alpha2 * v + (1 - alpha2) * emaPrev;
      out[i] = { time: pts[i].time, value: emaPrev };
    } else {
      out[i] = { time: pts[i].time, value: null };
    }
  }
  return clone(
    series,
    out.filter((point) => point !== void 0)
  );
}
function transformPercentile(series, interval, p) {
  if (interval === "range_series") {
    if (!series.points.length) return series;
    const value = aggregateValues(
      series.points.map((point) => point.value),
      "percentile",
      p
    );
    return clone(series, [
      { time: series.points[0].time, value },
      { time: series.points[series.points.length - 1].time, value }
    ]);
  }
  return bucketSeries(series, parseIntervalMs(interval), "avg").points ? (() => {
    const intervalMs = parseIntervalMs(interval);
    const buckets = /* @__PURE__ */ new Map();
    for (const pt of series.points) {
      const key = Math.floor(pt.time / intervalMs) * intervalMs;
      const list = buckets.get(key) || [];
      list.push(pt.value == null ? null : Number(pt.value));
      buckets.set(key, list);
    }
    const entries = [...buckets.entries()].sort((a, b) => a[0] - b[0]);
    const points = entries.flatMap(([time, values], index2) => {
      const points2 = [
        {
          time,
          value: aggregateValues(values, "percentile", p)
        }
      ];
      const nextTime = entries[index2 + 1]?.[0];
      for (let gap = time + intervalMs; nextTime != null && gap < nextTime; gap += intervalMs) {
        points2.push({ time: gap, value: null });
      }
      return points2;
    });
    return clone(series, points);
  })() : series;
}
function transformRemoveAboveValue(series, threshold) {
  return clone(
    series,
    series.points.map((p) => ({
      time: p.time,
      value: p.value != null && Number(p.value) > threshold ? null : p.value
    }))
  );
}
function transformRemoveBelowValue(series, threshold) {
  return clone(
    series,
    series.points.map((p) => ({
      time: p.time,
      value: p.value != null && Number(p.value) < threshold ? null : p.value
    }))
  );
}
function transformNull(series, fill) {
  return {
    ...series,
    points: series.points.map((p) => ({
      ...p,
      value: p.value == null || p.value === "" ? fill : p.value
    }))
  };
}
function applyTransformFunction(series, name, params) {
  switch (name) {
    case "groupBy":
      return transformGroupBy(
        series,
        String(params[0] || "1m"),
        String(params[1] || "avg")
      );
    case "scale":
      return transformScale(series, Number(params[0] ?? 1));
    case "offset":
      return transformOffset(series, Number(params[0] ?? 0));
    case "delta":
      return transformDelta(series);
    case "rate":
      return transformRate(series);
    case "movingAverage":
      return transformMovingAverage(series, Number(params[0] ?? 1));
    case "exponentialMovingAverage":
      return transformExponentialMovingAverage(series, Number(params[0] ?? 1));
    case "percentile":
      return transformPercentile(series, String(params[0] || "1m"), Number(params[1] ?? 95));
    case "removeAboveValue":
      return transformRemoveAboveValue(series, Number(params[0]));
    case "removeBelowValue":
      return transformRemoveBelowValue(series, Number(params[0]));
    case "transformNull":
      return transformNull(series, Number(params[0] ?? 0));
    default:
      throw new DataSourceError(
        "INVALID_QUERY",
        zabbixT("zabbix.error.unknownTransform", { name })
      );
  }
}
function buildValueMapLookup(valueMaps) {
  const map = /* @__PURE__ */ new Map();
  for (const vm of valueMaps || []) {
    const id = String(vm.valuemapid || "");
    if (!id) continue;
    map.set(id, [...vm.mappings || []]);
  }
  return map;
}
const POINT_FNS = /* @__PURE__ */ new Set([
  "scale",
  "offset",
  "delta",
  "rate",
  "movingAverage",
  "exponentialMovingAverage",
  "percentile",
  "removeAboveValue",
  "removeBelowValue",
  "transformNull"
]);
function runProcessingPipeline(seriesList, opts) {
  let list = seriesList.map((s) => ({
    ...s,
    item: { ...s.item },
    name: s.name || s.item.name,
    notices: [...s.notices || []],
    meta: { ...s.meta || {} }
  }));
  const plan = planQueryFunctions(opts.query.functions || []);
  const functions = opts.functionsOverride || (opts.requestPlanApplied ? plan.postFetchFunctions : (opts.query.functions || []).filter(
    (f) => f.name !== "trendValue" && f.name !== "consolidateBy"
  ));
  const disableAlign = opts.disableDataAlignment || opts.query.options?.disableDataAlignment || false;
  if (!disableAlign) {
    const useTrends = opts.useTrends ?? list.some((series) => series.meta?.source === "trend");
    if (useTrends) {
      list = list.map((series) => ({
        ...series,
        points: [...series.points].sort((a, b) => a.time - b.time)
      }));
      if (!opts.databasePostProcessing) {
        list = list.map(fillTrendWithNulls);
      }
    } else {
      list = list.map((series) => {
        const delay = String(series.item.delay || "");
        let delayMs = 0;
        try {
          delayMs = /^\d+$/.test(delay) ? Number(delay) * 1e3 : parseIntervalMs(delay);
        } catch {
          return series;
        }
        return delayMs > 0 && delayMs * 2 > (opts.intervalMs || 0) ? alignSeries(series, opts.rangeFromMs, opts.rangeToMs, delayMs) : series;
      });
    }
    if (list.length > 1) {
      list = prepareForStack(list);
    }
  }
  const nonAlias = functions.filter(
    (f) => !["setAlias", "setAliasByRegex", "replaceAlias"].includes(f.name)
  );
  const aliasFns = functions.filter(
    (f) => ["setAlias", "setAliasByRegex", "replaceAlias"].includes(f.name)
  );
  const ordered = [...nonAlias, ...aliasFns];
  for (const fn of ordered) {
    if (POINT_FNS.has(fn.name)) {
      if (opts.allowNumericOnly === false) {
        throw new Error(`function not supported for non-numeric query: ${fn.name}`);
      }
      list = list.map((s) => applyTransformFunction(s, fn.name, fn.params));
      continue;
    }
    if (fn.name === "groupBy") {
      list = list.map((s) => applyTransformFunction(s, "groupBy", fn.params));
      continue;
    }
    if (fn.name === "aggregateBy") {
      list = aggregateByAcross(
        list,
        String(fn.params[0] || "1m"),
        String(fn.params[1] || "avg")
      );
      continue;
    }
    if (fn.name === "sumSeries") {
      list = sumSeries(list);
      continue;
    }
    if (fn.name === "percentileAgg") {
      list = percentileAgg(list, String(fn.params[0] || "1m"), Number(fn.params[1] ?? 95));
      continue;
    }
    if (fn.name === "top") {
      list = topSeries(
        list,
        Number(fn.params[0] ?? 5),
        String(fn.params[1] || "avg")
      );
      continue;
    }
    if (fn.name === "bottom") {
      list = bottomSeries(
        list,
        Number(fn.params[0] ?? 5),
        String(fn.params[1] || "avg")
      );
      continue;
    }
    if (fn.name === "sortSeries") {
      list = sortSeriesList(list, String(fn.params[0] || "asc") || "asc");
      continue;
    }
    if (fn.name === "timeShift") {
      const raw = String(fn.params[0] || "0s");
      let signed;
      if (opts.requestPlanApplied && /^-?\d+(\.\d+)?ms$/i.test(raw)) {
        signed = Number(raw.replace(/ms$/i, ""));
      } else if (raw.startsWith("+")) {
        signed = -parseIntervalMs(raw.slice(1));
      } else if (raw.startsWith("-")) {
        signed = parseIntervalMs(raw.slice(1));
      } else {
        signed = parseIntervalMs(raw);
      }
      list = timeShift(list, signed);
      continue;
    }
    if (fn.name === "setAlias" || fn.name === "setAliasByRegex" || fn.name === "replaceAlias") {
      list = list.map(
        (s) => applyAliasFunction(
          s,
          fn.name,
          fn.params
        )
      );
      continue;
    }
    if (fn.name === "trendValue" || fn.name === "consolidateBy") {
      continue;
    }
    throw new Error(`function not supported: ${fn.name}`);
  }
  const consolidateFn = plan.consolidateBy || "avg";
  list = list.map(
    (series) => series.points.length > opts.maxDataPoints && (opts.intervalMs || 0) > 0 ? bucketSeries(series, opts.intervalMs, consolidateFn) : series
  );
  const useMap = Boolean(opts.query.options?.useZabbixValueMapping);
  const referenced = new Set(list.map((s) => String(s.item.valuemapid || "")).filter(Boolean));
  const filteredMaps = (opts.valueMaps || []).filter(
    (vm) => referenced.has(String(vm.valuemapid || ""))
  );
  const lookup = useMap ? buildValueMapLookup(filteredMaps) : void 0;
  const frames = seriesListToFrames(list, opts.query.refId, opts.datasourceUid, lookup);
  return frames;
}
async function runProcessingPipelineAsync(seriesList, opts, signal) {
  if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
  return runProcessingPipeline(seriesList, opts);
}
const DURATION_RE = /^(\d+(?:\.\d+)?)(ms|[smhdw])$/i;
const DURATION_SCALE = {
  ms: 1,
  s: 1e3,
  m: 6e4,
  h: 36e5,
  d: 864e5,
  w: 6048e5
};
function isValidDurationString(value) {
  return DURATION_RE.test(String(value || "").trim());
}
function parseDurationMs(value, fallback) {
  const m = String(value || "").trim().match(DURATION_RE);
  if (!m) return fallback;
  return Number(m[1]) * DURATION_SCALE[m[2].toLowerCase()];
}
function parseCacheTtlMs$1(raw, fallback = 36e5) {
  if (typeof raw === "number" && Number.isFinite(raw)) return Math.max(0, Math.floor(raw));
  const s = String(raw ?? "").trim();
  if (!s) return fallback;
  if (!isValidDurationString(s)) return fallback;
  return parseDurationMs(s, fallback);
}
function shouldUseTrends(args) {
  if (args.query === "false") return false;
  if (!args.enabled && args.query !== "true") return false;
  if (args.query === "true") return args.enabled !== false;
  if (!args.enabled) return false;
  const oldEnough = args.fromMs < args.nowMs - parseDurationMs(args.trendsFrom, 7 * 864e5);
  const wideEnough = args.toMs - args.fromMs > parseDurationMs(args.trendsRange, 4 * 864e5);
  return oldEnough || wideEnough;
}
function pickTrendValue(point, mode2) {
  switch (mode2) {
    case "min":
      return Number(point.value_min);
    case "max":
      return Number(point.value_max);
    case "sum":
      return Number(point.value_avg) * Number(point.num || 0);
    case "count":
      return Number(point.num || 0);
    case "avg":
    default:
      return Number(point.value_avg);
  }
}
const RP_RE = /^[\w.:-]+$/;
function assertRetentionPolicy(rp) {
  const v = String(rp || "").trim();
  if (!v) return "";
  if (!RP_RE.test(v)) {
    throw new Error(`invalid Influx retention policy for Direct DB: ${v}`);
  }
  return v;
}
function buildInfluxHistoryQuery(args) {
  for (const id of args.itemids) {
    if (!/^\d+$/.test(id)) throw new Error(`invalid itemid for Direct DB: ${id}`);
  }
  const rp = assertRetentionPolicy(args.retentionPolicy);
  const prefix = rp ? `"${rp}".` : "";
  const measurement = args.measurement === "history_uint" ? "history_uint" : "history";
  const agg = args.consolidateBy === "min" ? "min" : args.consolidateBy === "max" ? "max" : args.consolidateBy === "sum" ? "sum" : args.consolidateBy === "count" ? "count" : "mean";
  return `SELECT ${agg}("value") FROM ${prefix}"${measurement}" WHERE "itemid" =~ /^${args.itemids.join("|")}$/ AND time >= ${Number(args.fromSec)}s AND time <= ${Number(args.toSec)}s GROUP BY "itemid", time(1m) fill(none)`;
}
function rowsToSeries(rows, items, opts) {
  const byId2 = new Map(items.map((i) => [String(i.itemid), i]));
  const buckets = /* @__PURE__ */ new Map();
  for (const row of rows) {
    const id = String(row.itemid ?? "");
    if (!id) continue;
    const item = byId2.get(id);
    const spec = resolveValueTypeSpec(item?.value_type ?? 0, {
      allowUnknownAsFloat: !item
    });
    const t2 = Number(row.time);
    const time = !Number.isFinite(t2) ? 0 : t2 < 1e12 ? t2 * 1e3 : t2;
    const mapped = mapHistoryRawValue(row.value, spec);
    const point = {
      time,
      value: mapped.value,
      valueRaw: mapped.valueRaw
    };
    if (row.value_min != null) point.value_min = String(row.value_min);
    if (row.value_avg != null) point.value_avg = String(row.value_avg);
    if (row.value_max != null) point.value_max = String(row.value_max);
    if (row.num != null) point.num = String(row.num);
    const list = buckets.get(id) || [];
    list.push(point);
    buckets.set(id, list);
  }
  return [...buckets.entries()].map(([itemid, points]) => {
    const item = byId2.get(itemid) || {
      itemid,
      name: itemid,
      key_: itemid,
      hostid: "",
      value_type: "0"
    };
    points.sort((a, b) => a.time - b.time);
    return {
      item,
      name: item.name || item.key_ || itemid,
      points,
      meta: { source: opts?.source, itemid },
      notices: []
    };
  });
}
function quoteIds$1(itemids) {
  return itemids.map((id) => {
    if (!/^\d+$/.test(id)) throw new Error(`invalid itemid for Direct DB: ${id}`);
    return `'${id}'`;
  }).join(",");
}
function aggFn$1(consolidateBy) {
  switch (String(consolidateBy || "avg").toLowerCase()) {
    case "min":
      return "MIN";
    case "max":
      return "MAX";
    case "sum":
      return "SUM";
    case "count":
      return "COUNT";
    case "avg":
    default:
      return "AVG";
  }
}
function historyTable$1(history2) {
  return history2 === 3 ? "history_uint" : "history";
}
function trendsTable$1(history2) {
  return history2 === 3 ? "trends_uint" : "trends";
}
function buildMysqlHistorySQL(args) {
  const ids = quoteIds$1(args.itemids);
  const bucket = Math.max(
    1,
    Math.floor((args.toSec - args.fromSec) / Math.max(1, args.maxDataPoints))
  );
  const agg = aggFn$1(args.consolidateBy);
  const table = historyTable$1(args.history);
  return [
    `SELECT CAST(itemid AS CHAR) AS itemid,`,
    `       (clock DIV ${bucket}) * ${bucket} AS time,`,
    `       CAST(${agg}(value) AS CHAR) AS value`,
    `FROM ${table}`,
    `WHERE itemid IN (${ids})`,
    `  AND clock >= ${Number(args.fromSec)}`,
    `  AND clock <= ${Number(args.toSec)}`,
    `GROUP BY itemid, time`,
    `ORDER BY time ASC`
  ].join("\n");
}
function buildMysqlTrendSQL(args) {
  const ids = quoteIds$1(args.itemids);
  const table = trendsTable$1(args.history);
  const col2 = args.trendValue === "min" ? "value_min" : args.trendValue === "max" ? "value_max" : args.trendValue === "count" ? "num" : args.trendValue === "sum" ? "(value_avg * num)" : "value_avg";
  return [
    `SELECT CAST(itemid AS CHAR) AS itemid,`,
    `       clock AS time,`,
    `       CAST(${col2} AS CHAR) AS value,`,
    `       CAST(value_min AS CHAR) AS value_min,`,
    `       CAST(value_avg AS CHAR) AS value_avg,`,
    `       CAST(value_max AS CHAR) AS value_max,`,
    `       CAST(num AS CHAR) AS num`,
    `FROM ${table}`,
    `WHERE itemid IN (${ids})`,
    `  AND clock >= ${Number(args.fromSec)}`,
    `  AND clock <= ${Number(args.toSec)}`,
    `ORDER BY time ASC`
  ].join("\n");
}
function quoteIds(itemids) {
  return itemids.map((id) => {
    if (!/^\d+$/.test(id)) throw new Error(`invalid itemid for Direct DB: ${id}`);
    return `'${id}'`;
  }).join(",");
}
function aggFn(consolidateBy) {
  switch (String(consolidateBy || "avg").toLowerCase()) {
    case "min":
      return "MIN";
    case "max":
      return "MAX";
    case "sum":
      return "SUM";
    case "count":
      return "COUNT";
    case "avg":
    default:
      return "AVG";
  }
}
function historyTable(history2) {
  return history2 === 3 ? "history_uint" : "history";
}
function trendsTable(history2) {
  return history2 === 3 ? "trends_uint" : "trends";
}
function buildPostgresHistorySQL(args) {
  const ids = quoteIds(args.itemids);
  const bucket = Math.max(
    1,
    Math.floor((args.toSec - args.fromSec) / Math.max(1, args.maxDataPoints))
  );
  const agg = aggFn(args.consolidateBy);
  const table = historyTable(args.history);
  return [
    `SELECT itemid::text AS itemid,`,
    `       (clock / ${bucket}) * ${bucket} AS time,`,
    `       ${agg}(value)::text AS value`,
    `FROM ${table}`,
    `WHERE itemid IN (${ids})`,
    `  AND clock >= ${Number(args.fromSec)}`,
    `  AND clock <= ${Number(args.toSec)}`,
    `GROUP BY itemid, time`,
    `ORDER BY time ASC`
  ].join("\n");
}
function buildPostgresTrendSQL(args) {
  const ids = quoteIds(args.itemids);
  const table = trendsTable(args.history === 3 ? 3 : 0);
  const col2 = args.trendValue === "min" ? "value_min" : args.trendValue === "max" ? "value_max" : args.trendValue === "count" ? "num" : args.trendValue === "sum" ? "(value_avg * num)" : "value_avg";
  return [
    `SELECT itemid::text AS itemid,`,
    `       clock AS time,`,
    `       ${col2}::text AS value,`,
    `       value_min::text AS value_min,`,
    `       value_avg::text AS value_avg,`,
    `       value_max::text AS value_max,`,
    `       num::text AS num`,
    `FROM ${table}`,
    `WHERE itemid IN (${ids})`,
    `  AND clock >= ${Number(args.fromSec)}`,
    `  AND clock <= ${Number(args.toSec)}`,
    `ORDER BY time ASC`
  ].join("\n");
}
const DIRECT_DB_TYPE_RE = /(postgres|mysql|influx)/i;
const OFFLINE_OR_SEED_TYPE_RE = /(testdata|testData|grafana-testdata|datasource-test|offline|builtin|mock)/i;
function detectDirectDbDialect(type) {
  const t2 = String(type || "").toLowerCase();
  if (t2.includes("postgres")) return "postgres";
  if (t2.includes("mysql")) return "mysql";
  if (t2.includes("influx")) return "influx";
  return null;
}
function assertSafeIds(ids) {
  if (ids.some((id) => !/^\d+$/.test(id))) {
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.directDbItemIdNumeric"));
  }
}
function resolveDirectDbGateway(uid) {
  const key = String(uid || "").trim();
  if (!key) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbUidRequired")
    );
  }
  const matches = listRuntimeDataSources().filter((d) => String(d?.uid || "") === key);
  if (matches.length > 1) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbUidNotUnique", { uid: key })
    );
  }
  const ds2 = matches[0] || getRuntimeDataSource(key);
  if (!ds2) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbGatewayMissing", { uid: key })
    );
  }
  if (typeof ds2.query !== "function") {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbQueryMissing", { uid: key })
    );
  }
  const type = String(ds2.type || "");
  if (OFFLINE_OR_SEED_TYPE_RE.test(type) || ds2.offline === true || ds2.builtin === true) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbOfflineRefused", {
        type: type || "unknown"
      })
    );
  }
  if (ds2.dataMode === "fixture" || ds2.useFixture === true) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbFixtureRefused")
    );
  }
  const dialect = detectDirectDbDialect(type);
  if (!dialect || !DIRECT_DB_TYPE_RE.test(type)) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbTypeUnsupported", {
        type: type || "unknown"
      })
    );
  }
  return { ds: ds2, dialect };
}
function rangeMs$2(ctx) {
  const from = ctx.range.from instanceof Date ? ctx.range.from.getTime() : Number(ctx.range.from);
  const to = ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to);
  return { from, to };
}
function numericItemsOnly(items) {
  const out = [];
  for (const item of items) {
    const spec = resolveValueTypeSpec(item.value_type);
    if (spec.valueType !== 0 && spec.valueType !== 3) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        zabbixT("zabbix.error.directDbNumericOnly", {
          valueType: spec.valueType,
          itemid: item.itemid
        })
      );
    }
    out.push(item);
  }
  return out;
}
function buildDirectDbQueryText(args) {
  assertSafeIds(args.itemids);
  if (args.useTrends && args.history !== 0 && args.history !== 3) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbTrendsNumericOnly")
    );
  }
  if (args.dialect === "postgres") {
    return args.useTrends ? buildPostgresTrendSQL({
      itemids: args.itemids,
      fromSec: args.fromSec,
      toSec: args.toSec,
      history: args.history,
      trendValue: args.trendValue
    }) : buildPostgresHistorySQL({
      itemids: args.itemids,
      fromSec: args.fromSec,
      toSec: args.toSec,
      history: args.history,
      consolidateBy: args.consolidateBy,
      maxDataPoints: args.maxDataPoints
    });
  }
  if (args.dialect === "mysql") {
    return args.useTrends ? buildMysqlTrendSQL({
      itemids: args.itemids,
      fromSec: args.fromSec,
      toSec: args.toSec,
      history: args.history,
      trendValue: args.trendValue
    }) : buildMysqlHistorySQL({
      itemids: args.itemids,
      fromSec: args.fromSec,
      toSec: args.toSec,
      history: args.history,
      consolidateBy: args.consolidateBy,
      maxDataPoints: args.maxDataPoints
    });
  }
  return buildInfluxHistoryQuery({
    itemids: args.itemids,
    fromSec: args.fromSec,
    toSec: args.toSec,
    retentionPolicy: args.retentionPolicy,
    measurement: args.history === 3 ? "history_uint" : "history",
    consolidateBy: args.consolidateBy
  });
}
function framesToRows(frames) {
  const rows = [];
  for (const frame of frames || []) {
    const fields = frame.fields || [];
    const itemField = fields.find((f) => /itemid/i.test(f.name));
    const timeField2 = fields.find((f) => f.name === "Time" || /^(time|clock)$/i.test(f.name)) || fields.find((f) => f.type === "time");
    const valueField2 = fields.find((f) => f.name === "Value" || /^value$/i.test(f.name)) || fields.find((f) => /value/i.test(f.name) && !/itemid|min|max|avg|num/i.test(f.name));
    const minF = fields.find((f) => /value_min/i.test(f.name));
    const avgF = fields.find((f) => /value_avg/i.test(f.name));
    const maxF = fields.find((f) => /value_max/i.test(f.name));
    const numF = fields.find((f) => /^num$/i.test(f.name));
    const n = Math.max(
      timeField2?.values?.length || 0,
      valueField2?.values?.length || 0,
      itemField?.values?.length || 0
    );
    const labelItemid = frame.name || valueField2?.labels?.itemid;
    for (let i = 0; i < n; i++) {
      rows.push({
        itemid: String(itemField?.values?.[i] ?? labelItemid ?? ""),
        time: timeField2?.values?.[i],
        value: valueField2?.values?.[i],
        value_min: minF?.values?.[i],
        value_avg: avgF?.values?.[i],
        value_max: maxF?.values?.[i],
        num: numF?.values?.[i]
      });
    }
  }
  return rows;
}
async function resolveDirectDbItems(ctx) {
  if (String(ctx.query.queryType) === "3" || ctx.query.itemids) {
    const ids = String(ctx.query.itemids || "").split(",").map((s) => s.trim()).filter(Boolean);
    assertSafeIds(ids);
    if (!ids.length) return [];
    const items2 = await ctx.api.getItemsByIds(ids, ctx.signal);
    return numericItemsOnly(items2);
  }
  const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
  const hosts = await resolveHosts(
    ctx.api,
    ctx.query,
    ctx.scopedVars,
    groups.map((g) => String(g.groupid)),
    ctx.signal
  );
  const apps = await resolveApplications(
    ctx.api,
    ctx.query,
    ctx.scopedVars,
    hosts.map((h2) => String(h2.hostid)),
    ctx.signal
  );
  const items = await resolveItems(
    ctx.api,
    ctx.query,
    ctx.scopedVars,
    hosts.map((h2) => String(h2.hostid)),
    apps.map((a) => String(a.applicationid || a)),
    ctx.signal
  );
  return numericItemsOnly(items);
}
async function executeDirectDbQuery(ctx) {
  if (!ctx.settings.dbConnectionEnable) return null;
  if (!ctx.settings.dbConnectionDatasourceUID) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      zabbixT("zabbix.error.directDbEnabledUidMissing")
    );
  }
  const { ds: ds2, dialect } = resolveDirectDbGateway(ctx.settings.dbConnectionDatasourceUID);
  const plan = planQueryFunctions(ctx.query.functions || []);
  const { from, to } = rangeMs$2(ctx);
  const shifted = applyPlanToRange(from, to, plan);
  const fromSec = Math.floor(shifted.fromMs / 1e3);
  const toSec = Math.floor(shifted.toMs / 1e3);
  const items = await resolveDirectDbItems(ctx);
  if (!items.length) return [];
  const useTrends = shouldUseTrends({
    fromMs: shifted.fromMs,
    toMs: shifted.toMs,
    nowMs: Date.now(),
    query: ctx.query.options?.useTrends || "default",
    enabled: ctx.settings.trends !== false,
    trendsFrom: ctx.settings.trendsFrom || "7d",
    trendsRange: ctx.settings.trendsRange || "4d"
  });
  const groups = /* @__PURE__ */ new Map();
  for (const item of items) {
    const spec = resolveValueTypeSpec(item.value_type);
    const hist = spec.history === 3 ? 3 : 0;
    if (useTrends && !spec.supportsTrends) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        zabbixT("zabbix.error.directDbTrendsUnsupported", {
          valueType: spec.valueType
        })
      );
    }
    const list = groups.get(hist) || [];
    list.push(item);
    groups.set(hist, list);
  }
  const maxDataPoints = Math.min(1e4, ctx.maxDataPoints || 1e3);
  const allRows = [];
  const lastQueryTexts = [];
  for (const [history2, group] of groups) {
    const itemids = group.map((i) => String(i.itemid));
    const rawQuery = buildDirectDbQueryText({
      dialect,
      itemids,
      history: history2,
      fromSec,
      toSec,
      useTrends,
      trendValue: plan.trendValue,
      consolidateBy: plan.consolidateBy || void 0,
      maxDataPoints,
      retentionPolicy: ctx.settings.dbConnectionRetentionPolicy
    });
    lastQueryTexts.push(rawQuery);
    const result = await ds2.query(
      {
        requestId: `zabbix-direct-${ctx.query.refId}-${history2}`,
        targets: [
          {
            refId: ctx.query.refId,
            rawSql: rawQuery,
            format: "table",
            query: rawQuery
          }
        ],
        range: {
          from: new Date(shifted.fromMs),
          to: new Date(shifted.toMs),
          raw: ctx.range.raw
        },
        maxDataPoints
      },
      ctx.signal
    );
    allRows.push(...framesToRows(result?.data || []));
  }
  const series = rowsToSeries(allRows, items, {
    source: "direct-db"
  }).map((s) => ({
    ...s,
    meta: {
      ...s.meta || {},
      dialect,
      lineage: "direct-db",
      requestPlan: {
        timeShiftMs: plan.timeShiftMs,
        trendValue: plan.trendValue,
        consolidateBy: plan.consolidateBy
      },
      queryTexts: lastQueryTexts
    }
  }));
  return runProcessingPipeline(series, {
    query: ctx.query,
    rangeFromMs: from,
    rangeToMs: to,
    maxDataPoints,
    intervalMs: ctx.intervalMs,
    datasourceUid: ctx.instance.uid,
    disableDataAlignment: ctx.settings.disableDataAlignment,
    databasePostProcessing: useTrends,
    useTrends,
    requestPlanApplied: true,
    functionsOverride: plan.postFetchFunctions
  });
}
let _worker = null;
let _workerFailed = false;
const pending = /* @__PURE__ */ new Map();
let seq = 0;
function getWorker() {
  if (_workerFailed) return null;
  if (typeof Worker === "undefined") return null;
  if (!_worker) {
    try {
      _worker = new Worker(new URL(
        /* @vite-ignore */
        "" + new URL("assets/frameWorker-ByKFKdrz.js", import.meta.url).href,
        import.meta.url
      ), {
        type: "module"
      });
      _worker.addEventListener("message", (e) => {
        const id = e.data?.id;
        if (!id) return;
        const slot = pending.get(id);
        if (!slot) return;
        pending.delete(id);
        if (e.data.ok) slot.resolve(e.data.frames);
        else slot.reject(new Error(String(e.data.error || "frame worker failed")));
      });
    } catch {
      _workerFailed = true;
      return null;
    }
  }
  return _worker;
}
function syncBuild(payload) {
  return seriesListToFrames(payload.series, payload.refId, payload.datasourceUid);
}
async function chunkedBuild(payload, signal) {
  const series = payload.series || [];
  if (series.length <= 1) {
    if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
    return syncBuild(payload);
  }
  const out = [];
  const chunkSize = 4;
  for (let i = 0; i < series.length; i += chunkSize) {
    if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
    const slice = series.slice(i, i + chunkSize);
    out.push(...seriesListToFrames(slice, payload.refId, payload.datasourceUid));
    await new Promise((r) => setTimeout(r, 0));
  }
  return out;
}
function buildFramesAsync(payload, signal) {
  if (signal?.aborted) {
    return Promise.reject(new DOMException("Aborted", "AbortError"));
  }
  const worker2 = getWorker();
  if (!worker2) {
    return chunkedBuild(payload, signal);
  }
  const id = `${payload.requestId || "req"}-${++seq}`;
  return new Promise((resolve, reject) => {
    const onAbort = () => {
      pending.delete(id);
      try {
        worker2.postMessage({ type: "cancel", id });
      } catch {
      }
      reject(new DOMException("Aborted", "AbortError"));
    };
    if (signal) {
      if (signal.aborted) {
        onAbort();
        return;
      }
      signal.addEventListener("abort", onAbort, { once: true });
    }
    pending.set(id, {
      resolve: (frames) => {
        signal?.removeEventListener("abort", onAbort);
        resolve(frames);
      },
      reject: (err) => {
        signal?.removeEventListener("abort", onAbort);
        reject(err);
      }
    });
    try {
      worker2.postMessage({ id, ...payload });
    } catch {
      pending.delete(id);
      signal?.removeEventListener("abort", onAbort);
      void chunkedBuild(payload, signal).then(resolve, reject);
    }
  });
}
function pointKey(p) {
  return `${p.itemid}|${p.clock}|${p.ns ?? "0"}`;
}
function sortAndDedupeHistory(points) {
  const seen = /* @__PURE__ */ new Set();
  const out = [];
  const sorted = [...points].sort((a, b) => {
    if (a.itemid !== b.itemid) return String(a.itemid).localeCompare(String(b.itemid));
    const c = Number(a.clock) - Number(b.clock);
    if (c !== 0) return c;
    return Number(a.ns || 0) - Number(b.ns || 0);
  });
  for (const p of sorted) {
    const k = pointKey(p);
    if (seen.has(k)) continue;
    seen.add(k);
    out.push(p);
  }
  return out;
}
async function fetchHistoryRange(opts) {
  const pageLimit = Math.max(1, Math.floor(opts.pageLimit || 1e4));
  const maxRows = Math.max(1, Math.floor(opts.maxRows || pageLimit));
  const minSliceSec = Math.max(1, Math.floor(opts.minSliceSec ?? 1));
  let requests = 0;
  let truncated = false;
  async function loadSlice(fromSec, toSec) {
    if (opts.signal?.aborted) {
      const err = new Error("Aborted");
      err.name = "AbortError";
      throw err;
    }
    if (fromSec > toSec) return [];
    requests += 1;
    const rows = await opts.getHistory(opts.itemids, opts.history, fromSec, toSec, opts.signal, pageLimit) || [];
    if (rows.length < pageLimit) {
      return rows;
    }
    const span = toSec - fromSec;
    if (span <= minSliceSec) {
      truncated = true;
      return rows.slice(0, pageLimit);
    }
    const mid = fromSec + Math.floor(span / 2);
    const left = await loadSlice(fromSec, mid);
    const right = await loadSlice(mid + 1, toSec);
    return left.concat(right);
  }
  const merged = sortAndDedupeHistory(await loadSlice(opts.fromSec, opts.toSec));
  if (merged.length > maxRows) {
    truncated = true;
    return { points: merged.slice(0, maxRows), truncated: true, requests };
  }
  return { points: merged, truncated, requests };
}
async function* fetchHistoryStream(opts) {
  const batchSize = Math.max(1, Math.floor(opts.batchSize || 25));
  const ids = opts.itemids.map(String);
  const accumulated = [];
  for (let i = 0; i < ids.length; i += batchSize) {
    if (opts.signal?.aborted) {
      const err = new Error("Aborted");
      err.name = "AbortError";
      throw err;
    }
    const batch = ids.slice(i, i + batchSize);
    const page = await opts.fetchBatch(batch) || [];
    accumulated.push(...page);
    const isLast = i + batchSize >= ids.length;
    yield {
      points: accumulated.slice(),
      partial: !isLast,
      batch
    };
  }
}
function resolveLldSelection(query) {
  if (query.executionMode === "lld" && query.lld?.ruleId) {
    return {
      ruleId: String(query.lld.ruleId),
      ruleName: query.lld.ruleName,
      prototypeIds: [...query.lld.prototypeIds || []].map(String),
      prototypeKeys: [...query.lld.prototypeKeys || []].map(String),
      discoveredItemIds: query.lld.discoveredItemIds?.map(String)
    };
  }
  if (query.lldRuleId) {
    return {
      ruleId: String(query.lldRuleId),
      ruleName: query.lldRuleName,
      prototypeIds: [],
      prototypeKeys: [...query.lldItemKeys || []].map(String)
    };
  }
  if (query.executionMode === "lld") {
    return {
      ruleId: "",
      prototypeIds: [],
      prototypeKeys: []
    };
  }
  return null;
}
function assertLldSelection(sel) {
  if (!sel.ruleId) {
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.lldRuleRequired"));
  }
  if (!sel.prototypeIds.length && !sel.prototypeKeys.length && !sel.discoveredItemIds?.length) {
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.lldSelectionRequired"));
  }
}
async function resolveLldDiscoveredItems(ctx, sel) {
  assertLldSelection(sel);
  const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
  const hosts = await resolveHosts(
    ctx.api,
    ctx.query,
    ctx.scopedVars,
    groups.map((g) => g.groupid),
    ctx.signal
  );
  const hostids = hosts.map((h2) => String(h2.hostid));
  let prototypeIds = [...sel.prototypeIds];
  if (!prototypeIds.length && sel.prototypeKeys.length) {
    const protos = await ctx.api.getItemPrototypesFull(sel.ruleId, ctx.signal);
    const rows = Array.isArray(protos) ? protos : protos.rows || [];
    const keySet = new Set(sel.prototypeKeys);
    prototypeIds = rows.filter((p) => keySet.has(String(p.key_))).map((p) => String(p.itemid));
  }
  if (sel.discoveredItemIds?.length) {
    const items2 = await ctx.api.getItemsByIds(sel.discoveredItemIds, ctx.signal);
    return { items: items2, ruleId: sel.ruleId, prototypeIds };
  }
  const items = await ctx.api.getDiscoveredItems(
    hostids,
    sel.ruleId,
    sel.prototypeKeys,
    ctx.signal,
    { prototypeIds, requireParentRelation: prototypeIds.length > 0 }
  );
  for (const it of items) {
    it.__lld = {
      ruleId: sel.ruleId,
      prototypeId: it.itemDiscovery?.parent_itemid,
      discoveredItemId: it.itemid,
      hostId: it.hostid,
      matchingBasis: "itemDiscovery.parent_itemid"
    };
  }
  return { items, ruleId: sel.ruleId, prototypeIds };
}
function rangeMs$1(ctx) {
  const from = ctx.range.from instanceof Date ? ctx.range.from.getTime() : Number(ctx.range.from);
  const to = ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to);
  return { from, to };
}
function historyPageLimit(ctx) {
  const n = Number(ctx.settings.historyPageLimit);
  return Number.isFinite(n) && n > 0 ? Math.floor(n) : 1e4;
}
function historyBatchSize(ctx) {
  const n = Number(ctx.settings.historyBatchSize);
  return Number.isFinite(n) && n > 0 ? Math.floor(n) : 100;
}
const MIN_INT64 = -(1n << 63n);
const MAX_INT64 = (1n << 63n) - 1n;
function parseGoInt(value) {
  if (!/^[+-]?\d+$/.test(value)) return null;
  const parsed = BigInt(value);
  return parsed >= MIN_INT64 && parsed <= MAX_INT64 ? parsed : null;
}
const MAX_HISTORY_SERIES = 8;
const MAX_HISTORY_SERIES_UNSCOPED = 3;
async function loadHistoryForItems(ctx, items, opts) {
  if (!items.length) return [];
  const itemList = items;
  const plan = planQueryFunctions(ctx.query.functions || []);
  const { from, to } = rangeMs$1(ctx);
  const shifted = applyPlanToRange(from, to, plan);
  const fromSec = Math.floor(shifted.fromMs / 1e3);
  const toSec = Math.floor(shifted.toMs / 1e3);
  const trendsQuery = ctx.query.options?.useTrends || "default";
  const useTrends = shouldUseTrends({
    fromMs: shifted.fromMs,
    toMs: shifted.toMs,
    nowMs: Date.now(),
    query: trendsQuery,
    enabled: ctx.settings.trends !== false,
    trendsFrom: ctx.settings.trendsFrom || "7d",
    trendsRange: ctx.settings.trendsRange || "4d"
  });
  const trendMode = opts?.trendValue || plan.trendValue || "avg";
  const pageLimit = Math.min(historyPageLimit(ctx), 2e3);
  const batchSize = Math.min(historyBatchSize(ctx), 25);
  const maxRows = Number.MAX_SAFE_INTEGER;
  const hostCount = new Set(
    itemList.flatMap((item) => item.hosts?.map((host) => host.hostid) || [])
  ).size;
  const seriesName2 = (item) => hostCount > 1 && item.hosts?.[0] ? `${item.hosts[0].name}: ${item.name}` : item.name;
  const byType = /* @__PURE__ */ new Map();
  for (const item of itemList) {
    const spec = resolveValueTypeSpec(item.value_type);
    const list = byType.get(spec.history) || [];
    list.push(item);
    byType.set(spec.history, list);
  }
  const series = [];
  for (const [history2, group] of byType) {
    const spec = resolveValueTypeSpec(history2);
    const ids = group.map((i) => i.itemid);
    const appendResult = (result) => {
      for (const item of group.filter((g) => result.batch.includes(g.itemid))) {
        if (result.kind === "trend") {
          const rows = (result.trends || []).filter(
            (t2) => String(t2.itemid) === String(item.itemid)
          );
          if (!rows.length) continue;
          const points = rows.map((t2) => ({
            time: Number(t2.clock) * 1e3,
            value: pickTrendValue(t2, trendMode),
            valueRaw: String(t2.value_avg ?? t2.value_min ?? ""),
            value_min: t2.value_min,
            value_avg: t2.value_avg,
            value_max: t2.value_max,
            num: t2.num
          })).sort((a, b) => a.time - b.time);
          series.push({
            item,
            name: seriesName2(item),
            points,
            meta: {
              source: "trend",
              trendValue: trendMode,
              value_types: ["min", "avg", "max", "num"]
            }
          });
        } else {
          const hist = result.page.points.filter(
            (h2) => String(h2.itemid) === String(item.itemid)
          );
          const mapped = mapHistoryPoints(hist, spec);
          if (!mapped.times.length) continue;
          const points = mapped.times.map((time, idx) => ({
            time,
            value: mapped.values[idx] ?? null,
            valueRaw: mapped.valueRaw[idx] ?? null,
            ns: mapped.ns[idx] ?? void 0,
            timestamp: mapped.log.timestamp[idx] ?? void 0,
            source: mapped.log.source[idx] ?? void 0,
            severity: mapped.log.severity[idx] ?? void 0,
            logeventid: mapped.log.logeventid[idx] ?? void 0
          }));
          series.push({
            item,
            name: seriesName2(item),
            points,
            notices: [
              ...mapped.notices || [],
              ...result.page.truncated ? [zabbixT("zabbix.error.historyTruncated")] : []
            ],
            meta: {
              source: "history",
              truncated: result.page.truncated,
              history: history2
            }
          });
        }
      }
      opts?.onPartial?.(series.slice());
    };
    for await (const _chunk of fetchHistoryStream({
      itemids: ids,
      batchSize,
      signal: ctx.signal,
      fetchBatch: async (batch) => {
        if (useTrends && !spec.supportsTrends) {
          if (trendsQuery === "true") {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              zabbixT("zabbix.error.trendsUnsupported", {
                valueType: spec.valueType,
                name: spec.name
              })
            );
          }
        }
        let result;
        if (useTrends && spec.supportsTrends) {
          const trends = await ctx.api.getTrends(batch, fromSec, toSec, ctx.signal);
          result = {
            kind: "trend",
            batch,
            trends: Array.isArray(trends) ? trends : []
          };
        }
        if (!result) {
          const page = await fetchHistoryRange({
            itemids: batch,
            history: history2,
            fromSec,
            toSec,
            pageLimit,
            maxRows,
            signal: ctx.signal,
            getHistory: (itemids, h2, f, t2, signal, limit) => ctx.api.getHistory(itemids, h2, f, t2, signal, limit)
          });
          result = { kind: "history", batch, page };
        }
        appendResult(result);
        return result.kind === "history" ? result.page.points : [];
      }
    })) {
    }
  }
  return series;
}
async function executeMetricsQuery(ctx) {
  const directIds = (ctx.query.item?.ids || []).map(String).filter(Boolean);
  let items;
  const lldSel = resolveLldSelection(ctx.query);
  if (!directIds.length && !lldSel) {
    assertBoundedHostScope(ctx.query, ctx.scopedVars);
  }
  if (lldSel) {
    const resolved = await resolveLldDiscoveredItems(ctx, lldSel);
    items = resolved.items;
    if (!items.length) {
      return [];
    }
  } else if (directIds.length) {
    items = await ctx.api.getItemsByIds(directIds, ctx.signal);
    if (!items.length) {
      return [];
    }
  } else {
    const hostF2 = interpolateFilter(ctx.query.host, ctx.scopedVars);
    const groupF2 = interpolateFilter(ctx.query.group, ctx.scopedVars);
    const hostAll = isMatchAllZabbixFilter(hostF2.filter) && !hostF2.ids?.length;
    const groupAll = isMatchAllZabbixFilter(groupF2.filter) && !groupF2.ids?.length;
    let hostids = [];
    let itemGroupids;
    if (!hostAll) {
      const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
      const hosts = await resolveHosts(
        ctx.api,
        ctx.query,
        ctx.scopedVars,
        groups.map((g) => String(g.groupid)),
        ctx.signal
      );
      hostids = hosts.map((h2) => String(h2.hostid));
    } else if (!groupAll) {
      const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
      if (groups.length) {
        itemGroupids = groups.map((g) => String(g.groupid));
      }
    }
    const apps = await resolveApplications(ctx.api, ctx.query, ctx.scopedVars, hostids, ctx.signal);
    items = await resolveItems(
      ctx.api,
      ctx.query,
      ctx.scopedVars,
      hostids,
      apps.map((a) => String(a.applicationid || a)),
      ctx.signal,
      itemGroupids
    );
  }
  if (!items.length) {
    return [];
  }
  const plan = planQueryFunctions(ctx.query.functions || []);
  const hostF = interpolateFilter(ctx.query.host, ctx.scopedVars);
  const groupF = interpolateFilter(ctx.query.group, ctx.scopedVars);
  const unscoped = isMatchAllZabbixFilter(hostF.filter) && !hostF.ids?.length || isMatchAllZabbixFilter(groupF.filter) && !groupF.ids?.length;
  const series = await loadHistoryForItems(ctx, items, {
    trendValue: plan.consolidateBy || plan.trendValue,
    maxSeries: unscoped ? MAX_HISTORY_SERIES_UNSCOPED : MAX_HISTORY_SERIES,
    onPartial: ctx.onPartialData ? (partialSeries) => {
      try {
        void buildFramesAsync(
          {
            series: partialSeries,
            refId: ctx.query.refId,
            datasourceUid: ctx.instance.uid,
            requestId: `partial-${ctx.query.refId}`
          },
          ctx.signal
        ).then((partialFrames) => {
          if (!ctx.signal?.aborted) ctx.onPartialData?.(partialFrames);
        }).catch(() => {
        });
      } catch {
      }
    } : void 0
  });
  const { from, to } = rangeMs$1(ctx);
  series.sort((left, right) => {
    const leftId = parseGoInt(String(left.item.itemid));
    const rightId = parseGoInt(String(right.item.itemid));
    if (leftId == null || rightId == null || leftId === rightId) return 0;
    return leftId < rightId ? -1 : 1;
  });
  const pipelineOpts = {
    query: {
      ...ctx.query,
      functions: ctx.query.functions || []
    },
    rangeFromMs: from,
    rangeToMs: to,
    maxDataPoints: ctx.maxDataPoints,
    intervalMs: ctx.intervalMs,
    datasourceUid: ctx.instance.uid,
    disableDataAlignment: ctx.settings.disableDataAlignment || ctx.query.options?.disableDataAlignment,
    useTrends: series.some((entry) => entry.meta?.source === "trend"),
    functionsOverride: plan.postFetchFunctions,
    requestPlanApplied: true
  };
  let frames;
  try {
    frames = await runProcessingPipelineAsync(series, pipelineOpts, ctx.signal);
  } catch (error) {
    if (error?.name === "AbortError") throw error;
    frames = runProcessingPipeline(series, pipelineOpts);
  }
  return frames;
}
function partialOpts(ctx) {
  if (!ctx.onPartialData) return void 0;
  return {
    onPartial: (partialSeries) => {
      try {
        ctx.onPartialData?.(seriesToFrames(partialSeries, ctx.query.refId));
      } catch {
      }
    }
  };
}
function parseItemIds(raw) {
  const ids = String(raw || "").split(",").map((v) => v.trim()).filter(Boolean);
  if (!ids.length) throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.itemIdsEmpty"));
  if (ids.some((id) => !/^\d+$/.test(id)))
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.itemIdNumeric"));
  if (ids.length > 500)
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.itemCountLimit"));
  return [...new Set(ids)];
}
async function executeItemIdQuery(ctx) {
  const rawIds = String(ctx.query.itemids || "").trim();
  if (rawIds) {
    const ids = parseItemIds(rawIds);
    const items2 = await ctx.api.getItemsByIds(ids, ctx.signal);
    const series2 = await loadHistoryForItems(ctx, items2, partialOpts(ctx));
    return seriesToFrames(series2, ctx.query.refId);
  }
  const itemF = interpolateFilter(ctx.query.item, ctx.scopedVars);
  if (itemF.ids?.length) {
    const items2 = await ctx.api.getItemsByIds(itemF.ids, ctx.signal);
    const series2 = await loadHistoryForItems(ctx, items2, partialOpts(ctx));
    return seriesToFrames(series2, ctx.query.refId);
  }
  if (!itemF.filter) {
    throw new DataSourceError("INVALID_QUERY", zabbixT("zabbix.error.itemIdsEmpty"));
  }
  const hostF = interpolateFilter(ctx.query.host, ctx.scopedVars);
  const groupF = interpolateFilter(ctx.query.group, ctx.scopedVars);
  const hostAll = isMatchAllZabbixFilter(hostF.filter) && !hostF.ids?.length;
  const groupAll = isMatchAllZabbixFilter(groupF.filter) && !groupF.ids?.length;
  let hostids = [];
  let itemGroupids;
  if (!hostAll) {
    const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
    const hosts = await resolveHosts(
      ctx.api,
      ctx.query,
      ctx.scopedVars,
      groups.map((g) => String(g.groupid)),
      ctx.signal
    );
    hostids = hosts.map((h2) => String(h2.hostid));
  } else if (!groupAll) {
    const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
    if (groups.length) itemGroupids = groups.map((g) => String(g.groupid));
  }
  const items = await resolveItems(
    ctx.api,
    ctx.query,
    ctx.scopedVars,
    hostids,
    [],
    ctx.signal,
    itemGroupids
  );
  const series = await loadHistoryForItems(ctx, items, partialOpts(ctx));
  return seriesToFrames(series, ctx.query.refId);
}
function isSecretMacro(row) {
  const t2 = String(row.type ?? "0");
  if (t2 === "1" || t2 === "2") return true;
  if ((row.value == null || row.value === "") && String(row.macro || "").includes("SECRET"))
    return true;
  return false;
}
function maskMacroValue(row) {
  if (isSecretMacro(row)) {
    return { value: "******", masked: true, secret: true };
  }
  return { value: String(row.value ?? ""), masked: false, secret: false };
}
async function executeMacrosQuery(ctx) {
  assertBoundedHostScope(ctx.query, ctx.scopedVars);
  const hostF = interpolateFilter(ctx.query.host, ctx.scopedVars);
  const groupF = interpolateFilter(ctx.query.group, ctx.scopedVars);
  const groupAll = isMatchAllZabbixFilter(groupF.filter) && !groupF.ids?.length;
  const hostAll = isMatchAllZabbixFilter(hostF.filter) && !hostF.ids?.length;
  const groups = groupAll ? [] : await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
  let hosts = [];
  if (!hostAll) {
    hosts = await resolveHosts(
      ctx.api,
      ctx.query,
      ctx.scopedVars,
      groups.map((g) => String(g.groupid)),
      ctx.signal
    );
  }
  const macroFilter = interpolateFilter(ctx.query.macro, ctx.scopedVars);
  const page = await ctx.api.getMacros(
    hosts.map((h2) => String(h2.hostid)),
    macroFilter.filter,
    ctx.signal
  );
  const rows = Array.isArray(page) ? page : page.rows || [];
  const hostMap = new Map(hosts.map((h2) => [String(h2.hostid), h2]));
  rows.map((r) => {
    const m = maskMacroValue(r);
    return { macro: r.macro, type: r.type, masked: m.masked };
  });
  return [
    createDataFrame({
      name: "macros",
      refId: ctx.query.refId,
      fields: [
        {
          name: "Host",
          type: "string",
          values: rows.map(
            (r) => String(
              (Array.isArray(r.hosts) ? r.hosts[0]?.name : void 0) || hostMap.get(String(r.hostid))?.name || r.hostid || (r.hostid ? "" : "Global")
            )
          )
        },
        {
          name: "Macros",
          type: "string",
          values: rows.map((r) => String(r.macro ?? ""))
        },
        {
          name: "Value",
          type: "string",
          values: rows.map((r) => maskMacroValue(r).value)
        }
      ]
    })
  ];
}
function resolveSlaPeriodSeconds(slaInterval, rangeFromSec, rangeToSec) {
  const span = Math.max(1, rangeToSec - rangeFromSec);
  const key = String(slaInterval).toLowerCase();
  const map = {
    none: span,
    hour: 3600,
    day: 86400,
    week: 604800,
    month: 2592e3,
    quarter: 7776e3,
    year: 31536e3
  };
  let periodSeconds = map[key];
  if (periodSeconds == null) {
    const ms = parseDurationMs(key, Number.NaN);
    periodSeconds = Number.isFinite(ms) ? Math.max(1, Math.floor(ms / 1e3)) : span;
  }
  const periods = Math.max(1, Math.ceil(span / periodSeconds));
  return {
    periodFrom: rangeFromSec,
    periodTo: rangeToSec,
    periods,
    periodSeconds
  };
}
function buildSlaIntervals(fromSec, toSec, slaInterval, intervalMs) {
  const key = String(slaInterval).toLowerCase();
  if (key === "none") return [{ from: fromSec, to: toSec }];
  let step = 3600;
  if (key === "auto") {
    const base = Math.max(3600, Math.floor((intervalMs || 6e4) * 100 / 1e3));
    step = base;
  } else {
    const map = {
      "1h": 3600,
      "hour": 3600,
      "12h": 43200,
      "1d": 86400,
      "day": 86400,
      "1w": 604800,
      "week": 604800,
      "1m": 2592e3,
      "month": 2592e3
    };
    step = map[key] || 3600;
  }
  const out = [];
  for (let t0 = fromSec; t0 < toSec; t0 += step) {
    out.push({ from: t0, to: Math.min(toSec, t0 + step) });
  }
  return out.length ? out : [{ from: fromSec, to: toSec }];
}
function mapLegacySlaProperty(property) {
  if (property === "sla") return "sli";
  if (property === "okTime") return "uptime";
  if (property === "downtimeTime") return "downtime";
  return property;
}
function rowsOf$1(page) {
  if (Array.isArray(page)) return page;
  return page?.rows || [];
}
function legacySlaProperty(property) {
  if (property === "sli") return "sla";
  if (property === "uptime") return "okTime";
  if (property === "downtime") return "downtimeTime";
  return property;
}
function aliasPattern(value) {
  const source = String(value ?? "");
  const match = source.match(/^\/(.*)\/([gimsuy]*)$/);
  return match ? new RegExp(match[1], match[2]) : source;
}
function applyServiceAliases(frame, functions) {
  for (const fn of functions) {
    if (fn.name === "setAlias") {
      const alias = String(fn.params[0] ?? "");
      if (frame.fields.length <= 2) {
        const value = frame.fields.find((field) => field.type !== "time");
        if (value) value.config.displayNameFromDS = alias;
        frame.name = alias;
      } else {
        for (const field of frame.fields) {
          if (field.type !== "time") field.config.displayNameFromDS = alias;
        }
      }
    } else if (fn.name === "replaceAlias") {
      const pattern = aliasPattern(fn.params[0]);
      const replacement = String(fn.params[1] ?? "");
      if (frame.fields.length <= 2) {
        const alias = String(frame.name ?? "").replace(pattern, replacement);
        const value = frame.fields.find((field) => field.type !== "time");
        if (value) value.config.displayNameFromDS = alias;
        frame.name = alias;
      } else {
        for (const field of frame.fields) {
          if (field.type === "time") continue;
          const displayName = field.config.displayNameFromDS;
          if (typeof displayName !== "string") continue;
          const alias = displayName.replace(pattern, replacement);
          if (alias) field.name = alias;
        }
      }
    } else if (fn.name === "setAliasByRegex") {
      try {
        const pattern = new RegExp(String(fn.params[0] ?? ""));
        if (frame.fields.length <= 2) {
          const value = frame.fields.find((field) => field.type !== "time");
          const displayName = value?.config.displayNameFromDS;
          const display = typeof displayName === "string" ? displayName.match(pattern)?.[0] : void 0;
          if (value && display != null) value.config.displayNameFromDS = display;
          const name = String(frame.name ?? "").match(pattern)?.[0];
          if (name != null) frame.name = name;
        } else {
          for (const field of frame.fields) {
            if (field.type === "time") continue;
            const displayName = field.config.displayNameFromDS;
            const display = typeof displayName === "string" ? displayName.match(pattern)?.[0] : void 0;
            if (display != null) field.config.displayNameFromDS = display;
          }
        }
      } catch {
      }
    }
  }
  return frame;
}
async function executeLegacyServicesQuery(ctx, services, from, to) {
  const serviceids = services.map((service) => String(service.serviceid));
  const intervals = buildSlaIntervals(from, to, ctx.query.slaInterval || "none", ctx.intervalMs);
  const version = typeof ctx.api.version === "function" ? await ctx.api.version(ctx.signal) : "5.0.0";
  let response;
  if (Number(String(version).split(".")[0]) >= 6) {
    const slas = rowsOf$1(await ctx.api.getSlas(serviceids, "", ctx.signal));
    if (!slas.length) return [];
    const sli = await ctx.api.getSli(
      {
        slaid: slas[0].slaid,
        serviceids,
        period_from: from,
        period_to: to,
        periods: Math.min(intervals.length, 100)
      },
      ctx.signal
    );
    response = Object.fromEntries(
      (sli?.serviceids || []).map((serviceid) => [
        String(serviceid),
        { sla: [] }
      ])
    );
    for (let periodIndex = 0; periodIndex < (sli?.sli || []).length; periodIndex++) {
      const period = sli.periods[periodIndex];
      sli.sli[periodIndex].forEach((value, serviceIndex) => {
        const serviceid = String(sli.serviceids[serviceIndex]);
        response[serviceid]?.sla.push({
          downtimeTime: value.downtime,
          okTime: value.uptime,
          sla: value.sli,
          from: period.period_from,
          to: period.period_to
        });
      });
    }
  } else {
    response = await ctx.api.getSli({ serviceids, intervals }, ctx.signal);
  }
  const property = String(ctx.query.slaProperty || "sli");
  const sourceProperty = legacySlaProperty(property);
  const series = [];
  for (const service of services) {
    const slaObject = response?.[String(service.serviceid)];
    const entries = Array.isArray(slaObject?.sla) ? slaObject.sla : [];
    if (!entries.length) continue;
    const name = `${String(service.name)} ${property}`;
    const points = property === "status" ? [
      {
        time: Number(entries[0].to) * 1e3,
        value: Number(slaObject.status)
      }
    ] : [
      {
        time: Number(entries[0].from) * 1e3,
        value: Number(entries[0][sourceProperty])
      },
      ...entries.map((entry) => ({
        time: Number(entry.to) * 1e3,
        value: Number(entry[sourceProperty])
      }))
    ];
    series.push({
      item: {
        itemid: "",
        name,
        key_: "",
        hostid: "",
        value_type: "0"
      },
      name,
      points
    });
  }
  return runProcessingPipeline(series, {
    query: ctx.query,
    rangeFromMs: from * 1e3,
    rangeToMs: to * 1e3,
    maxDataPoints: ctx.maxDataPoints,
    intervalMs: ctx.intervalMs,
    datasourceUid: ctx.instance.uid,
    disableDataAlignment: true,
    useTrends: false
  });
}
async function executeServicesQuery(ctx) {
  const serviceFilter2 = interpolateZabbixValue(ctx.query.itServiceFilter || "", ctx.scopedVars);
  const hasSlaFilter = ctx.query.slaFilter !== void 0;
  const slaFilter = interpolateZabbixValue(ctx.query.slaFilter || "", ctx.scopedVars);
  const property = String(ctx.query.slaProperty || "sli");
  const servicesPage = await ctx.api.getServices(ctx.signal);
  const services = rowsOf$1(servicesPage);
  const filtered = services.filter(
    (s) => !serviceFilter2 || String(s.name || "").includes(serviceFilter2)
  );
  const from = Math.floor(
    (ctx.range.from instanceof Date ? ctx.range.from.getTime() : Number(ctx.range.from)) / 1e3
  );
  const to = Math.floor(
    (ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to)) / 1e3
  );
  if (!hasSlaFilter) {
    return executeLegacyServicesQuery(ctx, filtered, from, to);
  }
  if (property === "status") {
    return [
      applyServiceAliases(
        createDataFrame({
          name: "Service status",
          refId: ctx.query.refId,
          fields: [
            {
              name: "Time",
              type: "time",
              config: { custom: {} },
              values: [Date.now()]
            },
            ...filtered.map((service) => ({
              name: String(service.name),
              type: "number",
              config: {},
              values: [Number(service.status)]
            }))
          ]
        }),
        ctx.query.functions || []
      )
    ];
  }
  const serviceids = filtered.map((s) => String(s.serviceid));
  const slasPage = await ctx.api.getSlas(serviceids, slaFilter, ctx.signal);
  const slas = rowsOf$1(slasPage).filter(
    (sla) => !slaFilter || String(sla.name || "").includes(slaFilter)
  );
  if (!slas.length) return [];
  const period = resolveSlaPeriodSeconds(ctx.query.slaInterval || "none", from, to);
  const responses = await Promise.all(
    slas.map(
      (sla) => ctx.api.getSli(
        {
          slaid: sla.slaid,
          serviceids,
          period_from: period.periodFrom,
          period_to: period.periodTo,
          periods: Math.min(period.periods, 100)
        },
        ctx.signal
      )
    )
  );
  const firstResponse = responses[0];
  const timestamps = (firstResponse?.periods || []).map(
    (entry) => Number(entry.period_from) * 1e3
  );
  const slaProperty = mapLegacySlaProperty(property);
  const valueFields = [];
  responses.forEach((rawResponse, responseIndex) => {
    const response = rawResponse;
    const values = [];
    for (const periodValues of response?.sli || []) {
      periodValues.forEach((sli, serviceIndex) => {
        (values[serviceIndex] ||= []).push(sli[slaProperty]);
      });
    }
    (response?.serviceids || []).forEach((serviceIdValue, serviceIndex) => {
      const serviceId = String(serviceIdValue);
      const service = filtered.find((entry) => String(entry.serviceid) === serviceId);
      const baseName = String(service?.name || serviceId);
      valueFields.push({
        name: responses.length > 1 ? `${baseName}: ${String(slas[responseIndex]?.name || "")}` : baseName,
        type: "number",
        config: {},
        values: values[serviceIndex]
      });
    });
  });
  return [
    applyServiceAliases(
      createDataFrame({
        name: "SLI",
        refId: ctx.query.refId,
        fields: [
          {
            name: "Time",
            type: "time",
            config: { custom: {} },
            values: timestamps
          },
          ...valueFields
        ]
      }),
      ctx.query.functions || []
    )
  ];
}
function extractText(value, textFilter, useCaptureGroups) {
  const source = String(textFilter || "");
  const raw = String(value ?? "");
  if (!source) return raw;
  const match = new RegExp(source).exec(raw);
  if (!match) return "";
  return useCaptureGroups ? match[1] : match[0];
}
async function executeTextQuery(ctx) {
  assertBoundedHostScope(ctx.query, ctx.scopedVars);
  const hostF = interpolateFilter(ctx.query.host, ctx.scopedVars);
  const groupF = interpolateFilter(ctx.query.group, ctx.scopedVars);
  const hostAll = isMatchAllZabbixFilter(hostF.filter) && !hostF.ids?.length;
  const groupAll = isMatchAllZabbixFilter(groupF.filter) && !groupF.ids?.length;
  let hostids = [];
  let itemGroupids;
  if (!hostAll) {
    const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
    const hosts = await resolveHosts(
      ctx.api,
      ctx.query,
      ctx.scopedVars,
      groups.map((g) => String(g.groupid)),
      ctx.signal
    );
    hostids = hosts.map((h2) => String(h2.hostid));
  } else if (!groupAll) {
    const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
    if (groups.length) itemGroupids = groups.map((g) => String(g.groupid));
  }
  const apps = await resolveApplications(ctx.api, ctx.query, ctx.scopedVars, hostids, ctx.signal);
  let items = await resolveItems(
    ctx.api,
    ctx.query,
    ctx.scopedVars,
    hostids,
    apps.map((a) => String(a.applicationid || a)),
    ctx.signal,
    itemGroupids
  );
  items = items.filter((i) => ["1", "2", "4"].includes(String(i.value_type)));
  const from = Math.floor(
    (ctx.range.from instanceof Date ? ctx.range.from.getTime() : Number(ctx.range.from)) / 1e3
  );
  const to = Math.floor(
    (ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to)) / 1e3
  );
  const textFilter = String(ctx.query.textFilter || "");
  const skipEmpty = Boolean(ctx.query.options?.skipEmptyValues);
  const byItem = /* @__PURE__ */ new Map();
  const tableRows = [];
  for (const item of items) {
    const history2 = Number(item.value_type);
    const rows = await ctx.api.getHistory([item.itemid], history2, from, to, ctx.signal);
    if (ctx.query.resultFormat === "table") {
      const lastPoint = rows.at(-1);
      let lastValue = lastPoint?.value == null ? null : String(lastPoint.value);
      if (skipEmpty && (!lastValue || lastValue === "")) continue;
      if (textFilter) {
        lastValue = extractText(
          String(lastValue ?? ""),
          textFilter,
          Boolean(ctx.query.useCaptureGroups)
        );
      }
      tableRows.push({
        host: item.hosts?.[0]?.name || item.hosts?.[0]?.host || "",
        item: item.name,
        key: item.key_,
        value: lastValue
      });
      continue;
    }
    for (const row of rows) {
      const rawValue = row.value == null ? "" : String(row.value);
      const value = extractText(rawValue, textFilter, Boolean(ctx.query.useCaptureGroups));
      const nsNum = Number(row.ns || 0);
      const time = Number(row.clock) * 1e3 + Math.round(nsNum / 1e6);
      const grouped = byItem.get(item.itemid) || {
        item,
        times: [],
        values: []
      };
      grouped.times.push(time);
      grouped.values.push(value);
      byItem.set(item.itemid, grouped);
    }
  }
  if (ctx.query.resultFormat === "table") {
    return [
      createDataFrame({
        refId: ctx.query.refId,
        fields: [
          {
            name: "Host",
            type: "string",
            values: tableRows.map((row) => row.host)
          },
          {
            name: "Item",
            type: "string",
            values: tableRows.map((row) => row.item)
          },
          {
            name: "Key",
            type: "string",
            values: tableRows.map((row) => row.key)
          },
          {
            name: "Last value",
            type: "string",
            values: tableRows.map((row) => row.value)
          }
        ]
      })
    ];
  }
  const hostCount = new Set(items.flatMap((item) => item.hosts?.map((host) => host.hostid) || [])).size;
  return [...byItem.values()].map(({ item, times: itemTimes, values: itemValues }) => {
    const host = item.hosts?.[0];
    const name = hostCount > 1 && host ? `${host.name}: ${item.name}` : item.name;
    const scopedVars = {
      __zbx_item: { value: item.name },
      __zbx_item_name: { value: item.name },
      __zbx_item_key: { value: item.key_ },
      __zbx_item_interval: { value: String(item.delay || "") }
    };
    if (host) {
      scopedVars.__zbx_host = { value: host.host || host.name || "" };
      scopedVars.__zbx_host_id = { value: host.id };
      scopedVars.__zbx_host_name = { value: host.name || host.host || "" };
    }
    const tagValues = /* @__PURE__ */ new Map();
    for (const tag of item.tags || []) {
      const key = tag.tag.replaceAll(/\W/g, "_");
      if (!key) continue;
      tagValues.set(key, [...tagValues.get(key) || [], String(tag.value ?? "")]);
    }
    for (const [key, values] of tagValues) {
      scopedVars[`__zbx_item_tag_${key}`] = {
        value: values.sort().join(", ")
      };
    }
    return createDataFrame({
      name,
      refId: ctx.query.refId,
      fields: [
        {
          name: "Time",
          type: "time",
          config: { custom: { itemInterval: item.delay } },
          values: itemTimes
        },
        {
          name: "Value",
          type: "string",
          values: itemValues,
          labels: {
            ...host ? { host: host.name } : {},
            item: item.name,
            item_key: item.key_
          },
          config: {
            displayNameFromDS: name,
            custom: { itemInterval: item.delay, scopedVars }
          }
        }
      ]
    });
  });
}
function buildTriggerGetParams(ctx, groupids, hostids) {
  const opts = ctx.query.options || {};
  const nested = ctx.query.triggers || {
    minSeverity: 0,
    acknowledged: 2,
    count: false
  };
  const params = {
    // Slim payload: full selectHosts/Items/LastEvent extend freezes table panels on large fleets
    output: [
      "triggerid",
      "description",
      "priority",
      "lastchange",
      "value",
      "status",
      "state",
      "comments",
      "expression",
      "manual_close"
    ],
    selectHosts: ["hostid", "name"],
    selectTags: "extend",
    expandDescription: true,
    monitored: true,
    skipDependent: true,
    limit: 200
  };
  if (groupids.length) params.groupids = groupids;
  if (hostids.length) params.hostids = hostids;
  const show = ctx.query.showProblems || "problems";
  if (show === "problems") params.filter = { ...params.filter, value: 1 };
  else if (show === "recent" || show === "history")
    params.filter = { ...params.filter, value: [0, 1] };
  const minSeverity = opts.minSeverity ?? nested.minSeverity;
  if (minSeverity != null && Number(minSeverity) > 0) {
    params.min_severity = Number(minSeverity);
  }
  const ack = opts.acknowledged ?? nested.acknowledged;
  if (ack === 0 || ack === 1) {
    params.withLastEventUnacknowledged = ack === 0;
    params.only_true = true;
  }
  if (opts.hostsInMaintenance === false) params.maintenance = false;
  if (opts.useTimeRange) {
    params.lastChangeSince = Math.floor(
      (ctx.range.from instanceof Date ? ctx.range.from.getTime() : Number(ctx.range.from)) / 1e3
    );
    params.lastChangeTill = Math.floor(
      (ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to)) / 1e3
    );
  }
  const triggerFilter = interpolateFilter(ctx.query.trigger, ctx.scopedVars);
  if (triggerFilter.filter) params.search = { description: triggerFilter.filter };
  if (triggerFilter.ids?.length) params.triggerids = triggerFilter.ids;
  const tagsFilter = interpolateZabbixValue(String(ctx.query.tags?.filter || ""), ctx.scopedVars);
  if (tagsFilter) {
    params.tags = tagsFilter.split(",").map((part) => {
      const [tag, ...rest] = part.split(":");
      return { tag: tag.trim(), value: rest.join(":").trim(), operator: 0 };
    });
    params.evaltype = ctx.query.evaltype === "2" ? 2 : 0;
  }
  const limit = Number(opts.limit ?? 100);
  if (Number.isFinite(limit) && limit > 0) params.limit = Math.min(1001, Math.floor(limit));
  let countMode = "";
  if (ctx.query.countTriggersBy === "items" || ctx.query.countTriggersBy === "problems") {
    countMode = ctx.query.countTriggersBy;
    params.countOutput = true;
  } else if (opts.count || nested.count) {
    countMode = "problems";
    params.countOutput = true;
  }
  return { params, countMode };
}
async function executeTriggersQuery(ctx) {
  assertBoundedHostScope(ctx.query, ctx.scopedVars);
  const hostF = interpolateFilter(ctx.query.host, ctx.scopedVars);
  const groupF = interpolateFilter(ctx.query.group, ctx.scopedVars);
  const groupAll = isMatchAllZabbixFilter(groupF.filter) && !groupF.ids?.length;
  const hostAll = isMatchAllZabbixFilter(hostF.filter) && !hostF.ids?.length;
  const groups = await resolveGroups(ctx.api, ctx.query, ctx.scopedVars, ctx.signal);
  let hostids = [];
  if (!hostAll) {
    const hosts = await resolveHosts(
      ctx.api,
      ctx.query,
      ctx.scopedVars,
      groups.map((g) => g.groupid),
      ctx.signal
    );
    hostids = hosts.map((h2) => String(h2.hostid));
  }
  const { params, countMode } = buildTriggerGetParams(
    ctx,
    groups.map((g) => g.groupid),
    hostids
  );
  if (countMode === "items" || ctx.query.countTriggersBy === "items") {
    try {
      const itemGroupids = hostAll && !groupAll && groups.length ? groups.map((g) => String(g.groupid)) : void 0;
      const items = await resolveItems(
        ctx.api,
        ctx.query,
        ctx.scopedVars,
        hostids,
        [],
        ctx.signal,
        itemGroupids
      );
      const itemids = items.map((i) => String(i.itemid)).filter(Boolean);
      if (itemids.length) params.itemids = itemids;
    } catch {
    }
  }
  const result = await ctx.api.getTriggers(params, ctx.signal);
  if (countMode) {
    const count = typeof result === "number" || typeof result === "string" ? Number(result) : Array.isArray(result) ? result.length : Number(result?.rows?.length ?? 0);
    return [
      createDataFrame({
        name: `Count ${ctx.query.refId}`,
        refId: ctx.query.refId,
        fields: [
          {
            name: "Time",
            type: "time",
            values: [ctx.range.to instanceof Date ? ctx.range.to.getTime() : Number(ctx.range.to)]
          },
          {
            name: "Value",
            type: "number",
            values: [count]
          }
        ]
      })
    ];
  }
  const list = Array.isArray(result) ? result : result?.rows || [];
  const names = ["Disaster", "High", "Average", "Warning", "Information", "Not classified"];
  const groupNames = groups.map((group) => String(group.name));
  const counts = groupNames.map(() => [0, 0, 0, 0, 0, 0]);
  for (const trigger of list) {
    for (const group of Array.isArray(trigger.groups) ? trigger.groups : []) {
      const index2 = groupNames.indexOf(String(group.name));
      const priority = Number(trigger.priority);
      if (index2 >= 0 && priority >= 0 && priority <= 5) counts[index2][priority]++;
    }
  }
  return [
    createDataFrame({
      name: `Triggers ${ctx.query.refId}`,
      refId: ctx.query.refId,
      fields: [
        { name: "Host group", type: "string", values: groupNames },
        ...names.map((name, reverseIndex) => ({
          name,
          type: "number",
          config: { unit: "none", decimals: 0 },
          values: counts.map((row) => row[5 - reverseIndex])
        }))
      ]
    })
  ];
}
async function executeZabbixQuery(ctx) {
  const queryType = normalizeZabbixQueryType(ctx.query.queryType);
  if ((queryType === "0" || queryType === "3") && ctx.settings.dbConnectionEnable) {
    try {
      const direct = await executeDirectDbQuery(ctx);
      if (direct) return direct;
    } catch (error) {
      throw error instanceof DataSourceError ? error : new DataSourceError(
        "INVALID_QUERY",
        error instanceof Error ? error.message : String(error)
      );
    }
  }
  switch (queryType) {
    case "0":
      return executeMetricsQuery(ctx);
    case "1":
      return executeServicesQuery(ctx);
    case "2":
      return executeTextQuery(ctx);
    case "3":
      return executeItemIdQuery(ctx);
    case "4":
      return executeTriggersQuery(ctx);
    case "5":
      return executeProblemsQuery(ctx);
    case "6":
      return executeMacrosQuery(ctx);
    default: {
      const _exhaustive = queryType;
      throw new DataSourceError(
        "INVALID_QUERY",
        zabbixT("zabbix.error.unknownQueryType", {
          queryType: String(_exhaustive)
        })
      );
    }
  }
}
async function runTargetPool(tasks, options) {
  const concurrency = Math.max(1, Math.floor(options.concurrency || 1));
  const results = /* @__PURE__ */ new Map();
  let next = 0;
  let running = 0;
  let rejected = null;
  if (options.signal?.aborted) {
    throw new DOMException("Aborted", "AbortError");
  }
  return new Promise((resolve, reject) => {
    const onAbort = () => {
      rejected = new DOMException("Aborted", "AbortError");
      finishIfDone();
    };
    options.signal?.addEventListener("abort", onAbort, { once: true });
    function finishIfDone() {
      if (rejected) {
        options.signal?.removeEventListener("abort", onAbort);
        reject(rejected);
        return;
      }
      if (running === 0 && next >= tasks.length) {
        options.signal?.removeEventListener("abort", onAbort);
        resolve(
          tasks.map((t2) => ({
            refId: t2.refId,
            value: results.get(t2.refId)
          }))
        );
      }
    }
    function pump() {
      if (rejected) {
        finishIfDone();
        return;
      }
      while (running < concurrency && next < tasks.length) {
        const idx = next++;
        const task = tasks[idx];
        running += 1;
        void task.run().then((value) => {
          if (rejected) return;
          results.set(task.refId, value);
          try {
            options.onPartial?.(task.refId, value);
          } catch {
          }
        }).catch((error) => {
          if (!rejected) rejected = error;
        }).finally(() => {
          running -= 1;
          if (rejected) {
            finishIfDone();
          } else {
            pump();
            finishIfDone();
          }
        });
      }
      finishIfDone();
    }
    if (!tasks.length) {
      resolve([]);
      return;
    }
    pump();
  });
}
function parseZabbixVariableQuery(query) {
  const t2 = String(query || "").trim();
  if (/^hostgroup(\.get)?$/i.test(t2)) return { queryType: "group" };
  if (/^host(\.get)?$/i.test(t2) && !/^hostgroup/i.test(t2)) return { queryType: "host" };
  if (/^item(\.get)?$/i.test(t2)) return { queryType: "item" };
  if (/^application(\.get)?$/i.test(t2)) return { queryType: "application" };
  if (/^proxy(\.get)?$/i.test(t2)) return { queryType: "proxy" };
  if (/^service(\.get)?$/i.test(t2)) return { queryType: "service" };
  if (/^sla(\.get)?$/i.test(t2)) return { queryType: "sla" };
  if (/^trigger(\.get)?$/i.test(t2)) return { queryType: "trigger" };
  if (/^usermacro(\.get)?$/i.test(t2) || /^macro$/i.test(t2)) return { queryType: "macro" };
  if (t2.startsWith("{") && t2.endsWith("}")) {
    try {
      return JSON.parse(t2);
    } catch {
    }
  }
  const [kind2, ...rest] = t2.split(":");
  if (kind2 === "group") return { queryType: "group", filter: rest.join(":") };
  if (kind2 === "host")
    return {
      queryType: "host",
      group: rest[0],
      filter: rest.slice(1).join(":")
    };
  if (kind2 === "application")
    return {
      queryType: "application",
      group: rest[0],
      host: rest[1],
      filter: rest.slice(2).join(":")
    };
  if (kind2 === "item")
    return {
      queryType: "item",
      group: rest[0],
      host: rest[1],
      filter: rest.slice(2).join(":")
    };
  if (kind2 === "itemTag") return { queryType: "itemTag", filter: rest.join(":") };
  if (kind2 === "macro") return { queryType: "macro", filter: rest.join(":") };
  if (kind2 === "proxy") return { queryType: "proxy", filter: rest.join(":") };
  if (kind2 === "service") return { queryType: "service", filter: rest.join(":") };
  if (kind2 === "sla") return { queryType: "sla", filter: rest.join(":") };
  if (kind2 === "trigger") return { queryType: "trigger", filter: rest.join(":") };
  if (kind2 === "itemValues")
    return {
      queryType: "itemValues",
      item: rest[0],
      filter: rest.slice(1).join(":")
    };
  if (kind2 === "lldRule" || kind2 === "discoveryRule")
    return {
      queryType: "lldRule",
      host: rest[0],
      filter: rest.slice(1).join(":")
    };
  if (kind2 === "itemPrototype" || kind2 === "prototype")
    return {
      queryType: "itemPrototype",
      item: rest[0],
      filter: rest.slice(1).join(":")
    };
  return { queryType: "group", filter: t2 };
}
function splitTemplateQuery(query) {
  const t2 = String(query || "").trim();
  if (!t2) return [];
  const braced = t2.match(/\{[^}]*\}/g);
  if (braced?.length) return braced.map((s) => s.slice(1, -1));
  if (t2.includes(".") && !t2.includes(":") && !t2.startsWith("/")) {
    return t2.split(".");
  }
  return [t2];
}
function parseLegacyVariableQuery(query) {
  const raw = String(query || "").trim();
  if (!raw) return { queryType: "group", filter: "" };
  if (raw.startsWith("{") && raw.endsWith("}") && raw.includes("queryType")) {
    try {
      return JSON.parse(raw);
    } catch {
    }
  }
  const isBrace = /\{[^}]+\}/.test(raw);
  const isDotted = !isBrace && raw.includes(".") && !raw.includes(":") && !/^hostgroup|^host\.|^item/i.test(raw);
  if (!isBrace && !isDotted) {
    return parseZabbixVariableQuery(raw);
  }
  const parts = splitTemplateQuery(raw).map((p) => p === "*" ? "/.*/" : p);
  if (parts.length >= 4) {
    return {
      queryType: "item",
      group: parts[0] || "/.*/",
      host: parts[1] || "/.*/",
      application: parts[2] || "/.*/",
      filter: parts[3] || "/.*/",
      legacy: true,
      legacyRaw: raw
    };
  }
  if (parts.length === 3) {
    return {
      queryType: "application",
      group: parts[0] || "/.*/",
      host: parts[1] || "/.*/",
      filter: parts[2] || "/.*/",
      legacy: true,
      legacyRaw: raw
    };
  }
  if (parts.length === 2) {
    return {
      queryType: "host",
      group: parts[0] || "/.*/",
      filter: parts[1] || "/.*/",
      legacy: true,
      legacyRaw: raw
    };
  }
  return {
    queryType: "group",
    filter: parts[0] || "/.*/",
    legacy: true,
    legacyRaw: raw
  };
}
function rowsOf(page) {
  if (Array.isArray(page)) return page;
  return page?.rows || [];
}
async function executeVariableQueryInternal(api, query, scopedVars = {}, signal) {
  const classicMethod = typeof query === "string" && /\.get$/i.test(String(query).trim());
  const q = typeof query === "string" ? parseZabbixVariableQuery(query) : query;
  const preferId = classicMethod || Boolean(q.preferId);
  const base = { ...DEFAULT_ZABBIX_QUERY };
  const filter2 = interpolateZabbixValue(q.filter || "", scopedVars);
  if (q.queryType === "group") {
    base.group = { filter: filter2 };
    const rows = await resolveGroups(api, base, scopedVars, signal);
    return rows.map((r) => ({
      text: r.name,
      value: preferId ? String(r.groupid ?? r.name) : String(r.name),
      id: r.groupid
    }));
  }
  if (q.queryType === "host") {
    base.group = { filter: interpolateZabbixValue(q.group || "", scopedVars) };
    base.host = { filter: filter2 };
    const groups = await resolveGroups(api, base, scopedVars, signal);
    const hosts = await resolveHosts(
      api,
      base,
      scopedVars,
      groups.map((g) => g.groupid),
      signal
    );
    return hosts.map((h2) => ({
      text: String(h2.name || h2.host),
      value: preferId ? String(h2.hostid ?? h2.name ?? h2.host) : String(h2.name || h2.host),
      id: String(h2.hostid)
    }));
  }
  if (q.queryType === "application") {
    base.group = { filter: interpolateZabbixValue(q.group || "", scopedVars) };
    base.host = { filter: interpolateZabbixValue(q.host || "", scopedVars) };
    base.application = { filter: filter2 };
    const groups = await resolveGroups(api, base, scopedVars, signal);
    const hosts = await resolveHosts(
      api,
      base,
      scopedVars,
      groups.map((g) => g.groupid),
      signal
    );
    const appsPage = await api.getApplications(
      hosts.map((h2) => String(h2.hostid)),
      base.application.filter,
      signal
    );
    return rowsOf(appsPage).filter((a) => matchesZabbixFilter(String(a.name || ""), base.application.filter)).map((a) => ({
      text: String(a.name),
      value: String(a.name),
      id: String(a.applicationid)
    }));
  }
  if (q.queryType === "item" || q.queryType === "itemTag" || q.queryType === "hostTag") {
    base.group = { filter: interpolateZabbixValue(q.group || "", scopedVars) };
    base.host = { filter: interpolateZabbixValue(q.host || "", scopedVars) };
    base.application = {
      filter: interpolateZabbixValue(q.application || "", scopedVars)
    };
    base.item = { filter: q.queryType === "item" ? filter2 : "" };
    if (q.showDisabled) base.options = { ...base.options, showDisabledItems: true };
    const groups = await resolveGroups(api, base, scopedVars, signal);
    const hosts = await resolveHosts(
      api,
      base,
      scopedVars,
      groups.map((g) => g.groupid),
      signal
    );
    const items = await resolveItems(
      api,
      base,
      scopedVars,
      hosts.map((h2) => String(h2.hostid)),
      [],
      signal
    );
    if (q.queryType === "itemTag" || q.queryType === "hostTag") {
      const seen = /* @__PURE__ */ new Set();
      const out = [];
      for (const it of items) {
        for (const tag of it.tags || []) {
          const pair = `${tag.tag}:${tag.value ?? ""}`;
          if (seen.has(pair)) continue;
          if (filter2 && !matchesZabbixFilter(pair, filter2) && !matchesZabbixFilter(tag.tag, filter2))
            continue;
          seen.add(pair);
          out.push({ text: pair, value: pair, id: pair });
        }
      }
      return out;
    }
    return items.map((i) => ({
      text: String(i.name),
      value: preferId ? String(i.itemid) : String(i.name),
      id: String(i.itemid)
    }));
  }
  if (q.queryType === "macro") {
    base.group = { filter: interpolateZabbixValue(q.group || "", scopedVars) };
    base.host = { filter: interpolateZabbixValue(q.host || "", scopedVars) };
    const groups = await resolveGroups(api, base, scopedVars, signal);
    const hosts = await resolveHosts(
      api,
      base,
      scopedVars,
      groups.map((g) => g.groupid),
      signal
    );
    const page = await api.getMacros(
      hosts.map((h2) => String(h2.hostid)),
      filter2,
      signal
    );
    return rowsOf(page).filter((m) => !filter2 || matchesZabbixFilter(String(m.macro || ""), filter2)).map((m) => {
      const masked = maskMacroValue(m);
      return {
        text: String(m.macro),
        // never expose secret values as selectable value
        value: masked.secret ? String(m.macro) : String(m.macro),
        id: String(m.hostmacroid || m.globalmacroid || m.macro)
      };
    });
  }
  if (q.queryType === "proxy") {
    const page = await api.getProxies(filter2, signal);
    return rowsOf(page).filter((p) => !filter2 || matchesZabbixFilter(String(p.name || p.host || ""), filter2)).map((p) => {
      const name = String(p.name || p.host || p.proxyid);
      return {
        text: name,
        value: preferId ? String(p.proxyid) : name,
        id: String(p.proxyid)
      };
    });
  }
  if (q.queryType === "service") {
    const page = await api.getServices(signal);
    return rowsOf(page).filter((s) => !filter2 || matchesZabbixFilter(String(s.name || ""), filter2)).map((s) => ({
      text: String(s.name),
      value: preferId ? String(s.serviceid) : String(s.name),
      id: String(s.serviceid)
    }));
  }
  if (q.queryType === "sla") {
    const page = await api.getSlas(q.serviceids || [], filter2, signal);
    return rowsOf(page).filter((s) => !filter2 || matchesZabbixFilter(String(s.name || s.slaid || ""), filter2)).map((s) => ({
      text: String(s.name || s.slaid),
      value: preferId ? String(s.slaid) : String(s.name || s.slaid),
      id: String(s.slaid)
    }));
  }
  if (q.queryType === "trigger") {
    base.group = { filter: interpolateZabbixValue(q.group || "", scopedVars) };
    base.host = { filter: interpolateZabbixValue(q.host || "", scopedVars) };
    const groups = await resolveGroups(api, base, scopedVars, signal);
    const hosts = await resolveHosts(
      api,
      base,
      scopedVars,
      groups.map((g) => g.groupid),
      signal
    );
    const result = await api.getTriggers(
      {
        hostids: hosts.map((h2) => String(h2.hostid)),
        groupids: groups.map((g) => g.groupid),
        search: filter2 ? { description: filter2 } : void 0,
        output: ["triggerid", "description"]
      },
      signal
    );
    const rows = typeof result === "number" ? [] : Array.isArray(result) ? result : result.rows || [];
    return rows.map((t2) => ({
      text: String(t2.description || t2.triggerid),
      value: preferId ? String(t2.triggerid) : String(t2.description || t2.triggerid),
      id: String(t2.triggerid)
    }));
  }
  if (q.queryType === "itemValues") {
    const itemids = String(q.item || "").split(",").map((s) => s.trim()).filter(Boolean);
    if (!itemids.length) return [];
    const items = await api.getItemsByIds(itemids, signal);
    const limit = Math.min(1e3, Math.max(1, Number(q.limit) || 100));
    const to = Number(q.to) || Math.floor(Date.now() / 1e3);
    const from = Number(q.from) || to - 3600;
    const out = [];
    const seen = /* @__PURE__ */ new Set();
    for (const item of items) {
      const hist = await api.getHistory(
        [item.itemid],
        Number(item.value_type || 0),
        from,
        to,
        signal,
        limit
      );
      for (const p of hist || []) {
        const raw = p.value == null ? "" : String(p.value);
        const key = `${item.itemid}:${p.clock}:${p.ns ?? "0"}`;
        if (seen.has(raw) && raw !== "0") {
          continue;
        }
        if (seen.has(raw) && raw === "0") {
          if (out.some((o) => o.value === "0")) continue;
        }
        if (raw !== "0") seen.add(raw);
        else seen.add("0");
        if (filter2 && !matchesZabbixFilter(raw, filter2)) continue;
        out.push({
          text: raw,
          value: raw,
          id: key
        });
        if (out.length >= limit) break;
      }
      if (out.length >= limit) break;
    }
    return out;
  }
  if (q.queryType === "lldRule") {
    base.group = { filter: interpolateZabbixValue(q.group || "", scopedVars) };
    base.host = { filter: interpolateZabbixValue(q.host || "", scopedVars) };
    const groups = await resolveGroups(api, base, scopedVars, signal);
    const hosts = await resolveHosts(
      api,
      base,
      scopedVars,
      groups.map((g) => g.groupid),
      signal
    );
    const page = await api.getDiscoveryRules(
      hosts.map((h2) => String(h2.hostid)),
      signal
    );
    return rowsOf(page).filter((r) => !filter2 || matchesZabbixFilter(String(r.name || r.key_ || ""), filter2)).map((r) => ({
      text: String(r.name || r.key_),
      value: preferId ? String(r.itemid) : String(r.name || r.key_),
      id: String(r.itemid)
    }));
  }
  if (q.queryType === "itemPrototype") {
    const ruleId = interpolateZabbixValue(q.item || q.ruleId || "", scopedVars);
    if (!ruleId) return [];
    const page = await api.getItemPrototypes(ruleId, signal);
    return rowsOf(page).filter((r) => !filter2 || matchesZabbixFilter(String(r.name || r.key_ || ""), filter2)).map((r) => ({
      text: String(r.name || r.key_),
      value: preferId ? String(r.itemid) : String(r.key_ || r.name),
      id: String(r.itemid)
    }));
  }
  return [];
}
async function executeZabbixVariableQuery(api, query, scopedVars = {}, signal) {
  const options = await executeVariableQueryInternal(api, query, scopedVars, signal);
  return options.map((option) => ({
    text: option.text,
    ...option.value != null ? { value: option.value } : {},
    expandable: false
  }));
}
function timeField(frame) {
  return frame.fields.find((field) => field.type === "time");
}
function convertFramesToWide(frames) {
  if (frames.length < 2) return frames;
  const firstTime = timeField(frames[0]);
  if (!firstTime) return frames;
  for (let frameIndex = 1; frameIndex < frames.length; frameIndex++) {
    const candidate = timeField(frames[frameIndex]);
    if (!candidate) return frames;
    for (let valueIndex = 0; valueIndex < Math.min(frames.length, 2); valueIndex++) {
      if (candidate.values[valueIndex] !== firstTime.values[valueIndex]) {
        return frames;
      }
    }
  }
  let longestIndex = 0;
  for (let index2 = 1; index2 < frames.length; index2++) {
    if ((timeField(frames[index2])?.values.length || 0) > (timeField(frames[longestIndex])?.values.length || 0)) {
      longestIndex = index2;
    }
  }
  const longestTime = timeField(frames[longestIndex]);
  if (!longestTime) return [];
  const fields = [{ ...longestTime, values: [...longestTime.values] }];
  for (const frame of frames) {
    const source = frame.fields.find((field) => field.name === "Value") || (frame.name === "SLI" ? frame.fields.find((field) => field.type === "number") : void 0);
    if (!source) continue;
    const values = [...source.values];
    if (longestTime.values.length - values.length === 1) values.push(null);
    fields.push({ ...source, name: frame.name ?? source.name, values });
  }
  return [
    {
      refId: frames[longestIndex].refId,
      name: "wide",
      fields,
      length: longestTime.values.length
    }
  ];
}
function mergeTargetFramePlanes(entries) {
  const backend = entries.filter((entry) => entry.plane === "backend").flatMap((entry) => entry.frames);
  const direct = entries.filter((entry) => entry.plane === "direct").flatMap((entry) => convertFramesToWide(entry.frames));
  const frontend = entries.filter((entry) => entry.plane === "frontend").flatMap((entry) => entry.frames);
  return [...convertFramesToWide(backend), ...direct, ...convertFramesToWide(frontend)];
}
const ZABBIX_CAPABILITIES = {
  signals: ["metrics"],
  query: true,
  health: true,
  metadata: true,
  variables: true,
  annotations: true,
  exemplars: false,
  streaming: false,
  queryLanguages: ["zabbix-json-rpc"]
};
const metadataCache = new ZabbixMetadataCache();
function mergeSignals(a, b) {
  if (!a) return b;
  if (!b) return a;
  if (typeof AbortSignal !== "undefined" && "any" in AbortSignal && typeof AbortSignal.any === "function") {
    return AbortSignal.any([a, b]);
  }
  const c = new AbortController();
  const abort = () => c.abort();
  a.addEventListener("abort", abort);
  b.addEventListener("abort", abort);
  return c.signal;
}
function createZabbixDataSource(instance, meta2) {
  const settingsResult = migrateZabbixConfig(instance.jsonData || {});
  const settings = settingsResult.options;
  const url = String(instance.url || getRuntimeDataSourceSettings(instance.uid)?.url || "").replace(
    /\/$/,
    ""
  );
  const dataMode = settings.dataMode === "fixture" ? "fixture" : "live";
  const useFixture = dataMode === "fixture";
  const transport = useFixture ? new OfflineZabbixTransport("default") : new ZabbixRpcClient({
    url,
    uid: instance.uid,
    timeoutMs: settings.timeout || 3e4,
    // allow network even when dashboard CRUD is offline
    forceNetwork: true
  });
  if (!useFixture && transport instanceof ZabbixRpcClient) {
    transport.setAuthPlacementOverride(settings.authPlacement || "auto");
  }
  const api = new ZabbixApi({
    transport,
    uid: instance.uid,
    cache: metadataCache,
    metadataTtlMs: parseCacheTtlMs$1(settings.cacheTTL),
    metadataPageLimit: Number(settings.metadataPageLimit) || 1e3
  });
  function buildContext(query2, range, request, signal) {
    return {
      api,
      instance,
      settings,
      query: query2,
      range,
      maxDataPoints: request.maxDataPoints || 1e3,
      intervalMs: request.intervalMs || 1e3,
      scopedVars: request.scopedVars || {},
      signal,
      onPartialData: request.onPartialData
    };
  }
  async function query(request, signal) {
    if (!useFixture && transport instanceof ZabbixRpcClient) {
      transport.setCacheTimeout(request.cacheTimeout);
    }
    const timeoutMs = settings.queryTimeout || 6e4;
    const timeoutCtrl = new AbortController();
    let timedOut = false;
    const timer = setTimeout(() => {
      timedOut = true;
      timeoutCtrl.abort();
    }, timeoutMs);
    const merged = mergeSignals(signal, timeoutCtrl.signal);
    try {
      const tasks = (request.targets || []).filter((target) => !target.hide).map((target) => {
        const migrated = migrateZabbixQuery(target);
        if (target.useTrends != null && migrated.options) {
          migrated.options.useTrends = String(target.useTrends);
        }
        const queryType = String(migrated.queryType || "0");
        const numeric = queryType === "0" || queryType === "3";
        const plane = numeric ? settings.dbConnectionEnable ? "direct" : "backend" : "frontend";
        return {
          refId: String(migrated.refId || "A"),
          plane,
          run: async () => {
            try {
              const part = await executeZabbixQuery(
                buildContext(migrated, request.range, request, merged)
              );
              return normalizeDataFrames(part, {
                refId: migrated.refId,
                source: "zabbix",
                datasourceUid: instance.uid,
                signal: "metrics",
                requestId: request.requestId
              });
            } catch (error) {
              if (timedOut) {
                throw new DataSourceError(
                  "TIMEOUT",
                  zabbixT("zabbix.error.requestTimeout", {
                    timeout: timeoutMs
                  })
                );
              }
              throw withDataSourceContext(error, {
                uid: instance.uid,
                refId: migrated.refId
              });
            }
          }
        };
      });
      const concurrency = Math.min(
        4,
        Math.max(1, Number(settings.historyConcurrency ?? 2) || 2)
      );
      const settled = await runTargetPool(tasks, {
        concurrency,
        signal: merged,
        onPartial: (refId, value) => {
          try {
            request.onPartialData?.(value);
          } catch {
          }
          void refId;
        }
      });
      const frames = mergeTargetFramePlanes(
        settled.map((item, index2) => ({
          plane: tasks[index2].plane,
          frames: item.value || []
        }))
      );
      return { data: frames };
    } catch (error) {
      if (timedOut)
        throw new DataSourceError(
          "TIMEOUT",
          zabbixT("zabbix.error.requestTimeout", { timeout: timeoutMs })
        );
      if (error instanceof DataSourceError) throw error;
      throw withDataSourceContext(error, { uid: instance.uid });
    } finally {
      clearTimeout(timer);
    }
  }
  async function listHostGroups(filter2 = "") {
    const groups = await resolveGroups(
      api,
      migrateZabbixQuery({ group: { filter: filter2 } }),
      {},
      void 0
    );
    return groups.map((g) => ({ text: g.name, value: g.name, id: g.groupid }));
  }
  async function listHosts(groupFilter = "") {
    const q = migrateZabbixQuery({
      group: { filter: groupFilter },
      host: { filter: "" }
    });
    const groups = await resolveGroups(api, q, {});
    const hosts = await resolveHosts(
      api,
      q,
      {},
      groups.map((g) => g.groupid)
    );
    return hosts.map((h2) => ({
      text: String(h2.name || h2.host),
      value: String(h2.name || h2.host),
      id: String(h2.hostid)
    }));
  }
  async function listItems(hostFilter = "") {
    const q = migrateZabbixQuery({
      host: { filter: hostFilter },
      item: { filter: "" }
    });
    const hosts = await resolveHosts(api, q, {}, []);
    const hostids = hosts.map((h2) => String(h2.hostid));
    const items = await resolveItems(api, q, {}, hostids, []);
    return items.map((i) => ({ text: i.name, value: i.name, id: i.itemid }));
  }
  async function testDatasource(signal) {
    if (useFixture) {
      return {
        status: "success",
        message: zabbixT("zabbix.health.fixtureAvailable")
      };
    }
    try {
      const version = await api.version(signal);
      await api.getGroups("", signal);
      const caps2 = api.transport?.getCapabilities?.() || null;
      return {
        status: "success",
        message: zabbixT("zabbix.health.authenticated", { version }),
        details: {
          version,
          authMode: caps2?.selectedAuthPlacement || caps2?.authCandidates?.[0],
          capabilities: caps2 ? {
            supportsApiToken: caps2.supportsApiToken,
            loginUserField: caps2.loginUserField,
            slaApi: caps2.slaApi,
            triggerHostGroupsField: caps2.triggerHostGroupsField
          } : void 0
        }
      };
    } catch (error) {
      return {
        status: "error",
        message: error?.message || String(error)
      };
    }
  }
  async function metricFindQuery(query2, signal, context) {
    return executeZabbixVariableQuery(api, query2, context?.scopedVars || {}, signal);
  }
  async function annotationQuery(request, signal) {
    return executeAnnotationQuery({
      api,
      range: request.range,
      annotation: request.annotation,
      instance,
      signal
    });
  }
  async function getMetadata(request, signal) {
    const withPage = (base, page) => ({
      ...base,
      complete: page.complete,
      truncated: page.truncated
    });
    switch (request.type) {
      case "groups": {
        const page = await api.getGroups(request.filter, signal);
        return withPage(
          {
            type: "groups",
            values: page.rows.map((g) => ({
              text: String(g.name),
              value: String(g.name),
              id: String(g.groupid)
            }))
          },
          page
        );
      }
      case "hosts": {
        const page = await api.getHosts(request.groupids, request.filter, request.hostTags, signal);
        return withPage(
          {
            type: "hosts",
            values: page.rows.map((h2) => ({
              text: String(h2.name || h2.host),
              value: String(h2.name || h2.host),
              id: String(h2.hostid)
            }))
          },
          page
        );
      }
      case "applications": {
        const page = await api.getApplications(request.hostids, request.filter, signal);
        return withPage(
          {
            type: "applications",
            values: page.rows.map((a) => ({
              text: String(a.name),
              value: String(a.name),
              id: String(a.applicationid)
            }))
          },
          page
        );
      }
      case "items": {
        const page = await api.getItems(
          {
            hostids: request.hostids,
            applicationids: request.applicationids,
            filter: request.filter,
            itemTag: request.itemTag,
            showDisabled: request.showDisabled
          },
          signal
        );
        return withPage(
          {
            type: "items",
            values: page.rows.map((i) => ({
              text: i.name,
              value: i.name,
              id: i.itemid
            }))
          },
          page
        );
      }
      case "discoveryRules": {
        const page = await api.getDiscoveryRules(request.hostids, signal);
        return withPage(
          {
            type: "discoveryRules",
            values: page.rows.map((r) => ({
              text: r.name,
              value: r.itemid,
              id: r.itemid
            }))
          },
          page
        );
      }
      case "itemPrototypes": {
        const page = await api.getItemPrototypes(request.discoveryRuleId, signal);
        return withPage(
          {
            type: "itemPrototypes",
            values: page.rows.map((r) => ({
              text: r.name,
              value: r.key_,
              id: r.itemid
            }))
          },
          page
        );
      }
      case "triggers": {
        const pageOrCount = await api.getTriggers(
          {
            hostids: request.hostids,
            search: request.filter ? { description: request.filter } : void 0,
            output: "extend",
            selectGroups: "extend"
          },
          signal
        );
        const page = typeof pageOrCount === "number" ? { rows: [], complete: true, truncated: false } : pageOrCount;
        return withPage(
          {
            type: "triggers",
            values: page.rows.map((t2) => ({
              text: String(t2.description || t2.triggerid),
              value: String(t2.description || t2.triggerid),
              id: String(t2.triggerid)
            }))
          },
          page
        );
      }
      case "proxies": {
        const page = await api.getProxies(request.filter, signal);
        return withPage(
          {
            type: "proxies",
            values: page.rows.map((p) => {
              const name = String(p.name || p.host || p.proxyid);
              return { text: name, value: name, id: String(p.proxyid) };
            })
          },
          page
        );
      }
      case "services": {
        const page = await api.getServices(signal);
        return withPage(
          {
            type: "services",
            values: page.rows.map((s) => ({
              text: String(s.name),
              value: String(s.name),
              id: String(s.serviceid)
            }))
          },
          page
        );
      }
      case "slas": {
        const page = await api.getSlas(request.serviceids, request.filter, signal);
        return withPage(
          {
            type: "slas",
            values: page.rows.map((s) => ({
              text: String(s.name || s.slaid),
              value: String(s.name || s.slaid),
              id: String(s.slaid)
            }))
          },
          page
        );
      }
      case "macros": {
        const page = await api.getMacros(request.hostids, request.filter, signal);
        return withPage(
          {
            type: "macros",
            values: page.rows.map((m) => ({
              text: String(m.macro),
              value: String(m.macro),
              id: String(m.hostmacroid || m.macro)
            }))
          },
          page
        );
      }
      case "scripts": {
        const page = await api.getScripts(request.hostid, request.eventid, signal);
        return withPage({ type: "scripts", values: page.rows }, page);
      }
      case "problemDetail": {
        const value = await api.getProblemDetail(request.eventid, signal);
        return { type: "problemDetail", value };
      }
      case "actionCapabilities": {
        const user = useFixture ? { type: "3" } : await api.getCurrentUser(signal);
        const readOnly = settings.disableReadOnlyUsersAck && String(user.type) === "1";
        return {
          type: "actionCapabilities",
          value: {
            canAcknowledge: !readOnly,
            canClose: !readOnly,
            canChangeSeverity: !readOnly,
            canExecuteScripts: !readOnly,
            readOnly,
            reason: useFixture ? zabbixT("zabbix.action.fixturePreview") : void 0
          }
        };
      }
      default: {
        const _never = request;
        throw new DataSourceError(
          "INVALID_QUERY",
          zabbixT("zabbix.error.unknownMetadata", {
            request: JSON.stringify(_never)
          })
        );
      }
    }
  }
  function liveWritesAllowed() {
    if (typeof process !== "undefined" && process.env && process.env.ZABBIX_LIVE_WRITES === "1") {
      return true;
    }
    return false;
  }
  async function mutate(request) {
    if (!settings.enableWrites) {
      return {
        status: "blocked",
        message: zabbixT("zabbix.error.writesDisabled")
      };
    }
    if (!useFixture && !liveWritesAllowed()) {
      return {
        status: "blocked",
        message: zabbixT("zabbix.error.liveWritesDisabled")
      };
    }
    if (request.action === "zabbix.acknowledge") {
      if (useFixture) {
        return {
          status: "success",
          message: zabbixT("zabbix.action.fixturePreview"),
          data: { eventids: request.payload?.eventids || [], preview: true }
        };
      }
      const data = await api.acknowledgeEvent(request.payload || {}, request.signal);
      metadataCache.invalidate(instance.uid, [
        "problem.get",
        "event.get",
        "user.get"
      ]);
      return {
        status: "success",
        message: zabbixT("zabbix.action.acknowledged"),
        data
      };
    }
    if (request.action === "zabbix.executeScript") {
      const scriptid = String(request.payload?.scriptid ?? "").trim();
      if (!scriptid) {
        return {
          status: "blocked",
          message: zabbixT("zabbix.error.scriptRequiredNoDefault")
        };
      }
      if (useFixture) {
        return {
          status: "success",
          message: zabbixT("zabbix.action.fixturePreview"),
          data: {
            response: zabbixT("zabbix.action.fixturePreview"),
            preview: true,
            scriptid
          }
        };
      }
      const data = await api.executeScript(request.payload || {}, request.signal);
      return {
        status: "success",
        message: zabbixT("zabbix.action.scriptExecuted"),
        data
      };
    }
    throw new DataSourceError(
      "INVALID_QUERY",
      zabbixT("zabbix.error.unsupportedAction", { action: request.action })
    );
  }
  function dispose() {
    metadataCache.clearUid(instance.uid);
  }
  return {
    id: instance.id,
    uid: instance.uid,
    type: instance.type || meta2.id,
    name: instance.name,
    capabilities: ZABBIX_CAPABILITIES,
    /** Surface write flag for panel four-way gate. */
    enableWrites: Boolean(settings.enableWrites),
    query,
    testDatasource,
    metricFindQuery,
    annotationQuery,
    getMetadata,
    mutate,
    dispose,
    // legacy helpers used by editors/tests
    listHostGroups,
    listHosts,
    listItems,
    api
  };
}
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
  "b",
  "i",
  "em",
  "strong",
  "br",
  "p",
  "span",
  "code",
  "pre",
  "ul",
  "ol",
  "li"
]);
function sanitizeProblemHtml(input, allowDangerousHTML) {
  const raw = String(input || "");
  if (!raw) return "";
  let s = raw.replaceAll(/<\s*(script|style)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replaceAll(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "").replaceAll(/javascript:/gi, "");
  if (allowDangerousHTML) return s;
  s = s.replaceAll(/<\/?([a-z0-9]+)(\s[^>]*)?>/gi, (full, tag) => {
    const t2 = String(tag).toLowerCase();
    if (!ALLOWED_TAGS.has(t2)) return "";
    if (full.startsWith("</")) return `</${t2}>`;
    if (t2 === "br") return "<br/>";
    return `<${t2}>`;
  });
  return s;
}
const CURRENT_SCHEMA_VERSION = 8;
const DEFAULT_SEVERITY = [
  { priority: 0, severity: "未分类", color: "rgb(108, 108, 108)", show: true },
  { priority: 1, severity: "信息", color: "rgb(120, 158, 183)", show: true },
  { priority: 2, severity: "警告", color: "rgb(175, 180, 36)", show: true },
  { priority: 3, severity: "一般严重", color: "rgb(255, 137, 30)", show: true },
  { priority: 4, severity: "严重", color: "rgb(255, 101, 72)", show: true },
  { priority: 5, severity: "灾难", color: "rgb(215, 0, 0)", show: true }
];
const DEFAULT_PROBLEMS_OPTIONS = {
  schemaVersion: 8,
  layout: "table",
  hostField: true,
  hostTechNameField: false,
  hostGroups: false,
  hostProxy: false,
  showTags: true,
  statusField: true,
  statusIcon: false,
  severityField: true,
  ackField: true,
  ageField: false,
  opdataField: false,
  descriptionField: true,
  descriptionAtNewLine: false,
  showDatasourceName: false,
  hostsInMaintenance: true,
  showTriggers: "all triggers",
  sortProblems: "lastchange",
  fontSize: "100%",
  pageSize: 10,
  problemTimeline: true,
  highlightBackground: false,
  highlightNewEvents: false,
  highlightNewerThan: "1h",
  customLastChangeFormat: false,
  lastChangeFormat: "",
  resizedColumns: [],
  allowDangerousHTML: false,
  triggerSeverity: DEFAULT_SEVERITY.map((s) => ({ ...s })),
  okEventColor: "rgb(56, 189, 113)",
  ackEventColor: "rgb(56, 219, 156)",
  markAckEvents: false,
  customTagColumns: "",
  allowAcknowledge: false,
  allowUnacknowledge: false,
  allowClose: false,
  allowChangeSeverity: false,
  allowSuppress: false,
  allowUnsuppress: false,
  allowExecuteScripts: false,
  showDetails: true
};
const ZABBIX_PANEL_ID = "alexanderzobnin-zabbix-triggers-panel";
const ZABBIX_DATASOURCE_ID = "alexanderzobnin-zabbix-datasource";
const SIGNOZ_I18N_ZH_HANS = {
  "signoz.metrics.selectMetricPlaceholder": "请选择指标",
  "signoz.raw.format": "格式化",
  "signoz.raw.formatTitle": "仅在校验通过时格式化",
  "signoz.function.add": "添加函数",
  "signoz.function.argsPlaceholder": "参数（逗号分隔）",
  "signoz.function.unsupported": "已保存但不支持的函数：{functions}（未删除，请调整或恢复相应能力）",
  "signoz.queryBuilder.addFormula": "添加公式",
  "signoz.queryBuilder.addFunction": "添加函数",
  "signoz.queryBuilder.addOnGroupBy": "分组",
  "signoz.queryBuilder.addOnGroupByDesc": "按一个或多个标签值对结果进行分组",
  "signoz.queryBuilder.addOnHaving": "Having",
  "signoz.queryBuilder.addOnHavingDesc": "按聚合条件过滤结果（例如 sum(metric) >= 100）",
  "signoz.queryBuilder.addOnLegend": "图例",
  "signoz.queryBuilder.addOnLegendDesc": "使用 \\{\\{key\\}\\} 模板占位符自定义图例标签",
  "signoz.queryBuilder.addOnLimit": "限制",
  "signoz.queryBuilder.addOnLimitDesc": "限制返回的最大结果序列数",
  "signoz.queryBuilder.addOnOrderBy": "排序",
  "signoz.queryBuilder.addOnOrderByDesc": "按时间戳或聚合值升序或降序排列结果",
  "signoz.queryBuilder.agg": "聚合",
  "signoz.queryBuilder.attributePlaceholder": "属性...",
  "signoz.queryBuilder.clickhousePlaceholder": "输入 ClickHouse SQL 查询，例如 SELECT toStartOfInterval(...) ...",
  "signoz.queryBuilder.cloneQuery": "克隆查询",
  "signoz.queryBuilder.collapse": "收起",
  "signoz.queryBuilder.expand": "展开",
  "signoz.queryBuilder.formulaExpr": "表达式",
  "signoz.queryBuilder.formulaExprPlaceholder": "例如 A / B * 100",
  "signoz.queryBuilder.functionArg": "函数参数",
  "signoz.queryBuilder.functions": "函数",
  "signoz.queryBuilder.groupBy": "分组",
  "signoz.queryBuilder.having": "Having",
  "signoz.queryBuilder.havingPlaceholder": "例如 COUNT() > 10",
  "signoz.queryBuilder.keyDataType": "数据类型",
  "signoz.queryBuilder.keyType": "类型",
  "signoz.queryBuilder.legend": "图例",
  "signoz.queryBuilder.metricType": "指标类型",
  "signoz.queryBuilder.metricTypeExpHistogram": "ExponentialHistogram",
  "signoz.queryBuilder.metricTypeGauge": "Gauge",
  "signoz.queryBuilder.metricTypeHistogram": "Histogram",
  "signoz.queryBuilder.metricTypeSum": "Sum",
  "signoz.queryBuilder.legendPlaceholder": "\\｛\\｛service.name\\｝\\｝-\\｛\\｛endpoint\\｝\\｝",
  "signoz.queryBuilder.limit": "限制",
  "signoz.queryBuilder.of": "字段",
  "signoz.queryBuilder.orderBy": "排序",
  "signoz.queryBuilder.orderTimestampAsc": "时间 ↑",
  "signoz.queryBuilder.orderTimestampDesc": "时间 ↓",
  "signoz.queryBuilder.orderValueAsc": "值 ↑",
  "signoz.queryBuilder.orderValueDesc": "值 ↓",
  "signoz.queryBuilder.placeholderAll": "一切（无故障）",
  "signoz.queryBuilder.promqlPlaceholder": "输入 PromQL 查询，例如 sum(rate(http_requests_total[5m])) by (service)",
  "signoz.queryBuilder.signal.api_monitoring": "API 监控",
  "signoz.queryBuilder.signal.exceptions": "异常",
  "signoz.queryBuilder.signal.logs": "日志",
  "signoz.queryBuilder.signal.metrics": "指标",
  "signoz.queryBuilder.signal.traces": "链路追踪",
  "signoz.queryBuilder.spaceAgg": "空间聚合",
  "signoz.queryBuilder.step": "步长",
  "signoz.queryBuilder.stepAuto": "自动",
  "signoz.queryBuilder.tabBuilder": "查询构建器",
  "signoz.queryBuilder.tabClickhouse": "ClickHouse 查询",
  "signoz.queryBuilder.tabPromql": "PromQL",
  "signoz.queryBuilder.tagPlaceholder": "标签...",
  "signoz.queryBuilder.timeAgg": "时间聚合",
  "signoz.querySearch.docLinkText": "查看官方文档",
  "signoz.querySearch.error": "加载建议时出错",
  "signoz.querySearch.help": "需要帮助了解搜索语法吗？",
  "signoz.querySearch.loading": "正在加载建议...",
  "signoz.querySearch.noSuggestions": "无可用建议",
  "signoz.querySearch.placeholder": "输入过滤条件查询 (例如 service.name = 'frontend' AND body CONTAINS 'error')",
  "signoz.traces.addQuery": "添加查询",
  "signoz.traces.disableQuery": "禁用",
  "signoz.traces.enableQuery": "启用",
  "signoz.traces.orderBy": "排序方式",
  "signoz.traces.removeQuery": "删除查询",
  "signoz.common.ok": "成功",
  "signoz.common.failed": "失败",
  "signoz.common.cancel": "取消",
  "signoz.common.confirm": "确认",
  "signoz.common.close": "关闭",
  "signoz.common.loading": "加载中…",
  "signoz.common.select": "选择",
  "signoz.config.baseUrl": "基础 URL",
  "signoz.config.connection": "连接",
  "signoz.config.authentication": "认证",
  "signoz.config.requiredBaseUrl": "请填写基础 URL",
  "signoz.config.customHealthRequired": "自定义配置档案必须先通过健康检查",
  "signoz.config.loginMissingCredentials": "请填写邮箱和密码",
  "signoz.config.loginSuccess": "登录成功，access/refresh 已写入运行时内存",
  "signoz.config.loginFailed": "登录失败",
  "signoz.config.healthChecking": "检测中…",
  "signoz.config.session": "邮箱密码会话",
  "signoz.config.headerPlaceholder": "X-API-Key / Authorization",
  "signoz.profile.prometheusCompatible": "Prometheus 兼容",
  "signoz.profile.signozV5": "SigNoz v5（原生）",
  "signoz.profile.signozV3": "SigNoz v3",
  "signoz.profile.signozV4": "SigNoz v4",
  "signoz.profile.custom": "自定义",
  "signoz.config.apiProfile": "API 配置档案",
  "signoz.config.organizationId": "组织 ID",
  "signoz.config.defaultEnvironment": "默认环境",
  "signoz.config.timeout": "超时（毫秒）",
  "signoz.config.cacheTtl": "元数据缓存 TTL",
  "signoz.config.credentialKind": "凭据类型",
  "signoz.config.bearerToken": "Bearer / API 令牌",
  "signoz.config.apiKey": "API 密钥",
  "signoz.config.headers": "自定义请求头",
  "signoz.config.headerName": "请求头名称",
  "signoz.config.tokenSecret": "令牌 / 密钥（仅运行时）",
  "signoz.config.refreshToken": "刷新令牌（仅运行时，用于 /sessions/rotate）",
  "signoz.config.email": "邮箱",
  "signoz.config.password": "密码（仅运行时内存）",
  "signoz.config.rememberPassword": "记住密码用于自动续期",
  "signoz.config.login": "邮箱密码登录并获取令牌",
  "signoz.config.loggingIn": "登录中…",
  "signoz.config.customEndpoints": "自定义端点",
  "signoz.config.health": "健康检查",
  "signoz.config.metrics": "指标",
  "signoz.config.logs": "日志",
  "signoz.config.traces": "链路追踪",
  "signoz.config.alerts": "告警",
  "signoz.config.traceById": "按 ID 查询链路",
  "signoz.config.metadata": "元数据",
  "signoz.config.acknowledge": "确认",
  "signoz.config.resolve": "解决",
  "signoz.config.healthPassed": "已通过",
  "signoz.config.healthFailed": "未通过",
  "signoz.config.saveBlocked": "无法保存：自定义配置未通过健康检查",
  "signoz.config.testHealth": "测试连接 / 健康检查",
  "signoz.annotation.errorLogs": "错误日志",
  "signoz.annotation.errorSpans": "错误链路片段",
  "signoz.annotation.firingAlerts": "触发中的告警",
  "signoz.annotation.source": "来源",
  "signoz.annotation.service": "服务",
  "signoz.annotation.environment": "环境",
  "signoz.annotation.alertsUnavailable": "触发中的告警已隐藏（当前配置档案缺少 alertsQuery 能力）",
  "signoz.variable.type": "变量类型",
  "signoz.variable.environment": "环境",
  "signoz.variable.service": "服务",
  "signoz.variable.operation": "操作",
  "signoz.variable.metric": "指标",
  "signoz.variable.attributeKey": "属性键",
  "signoz.variable.attributeValue": "属性值",
  "signoz.variable.dynamic": "动态（字段 + 来源）",
  "signoz.variable.clickhouse": "ClickHouse 查询",
  "signoz.variable.search": "搜索",
  "signoz.variable.keyMetric": "键 / 指标",
  "signoz.variable.field": "字段",
  "signoz.variable.source": "来源",
  "signoz.variable.sql": "SQL",
  "signoz.variable.unsupportedType": "当前 API 配置档案不支持变量类型「{type}」",
  "signoz.variable.clickhouseUnsupported": "当前配置档案未启用 ClickHouse SQL 变量",
  "signoz.queryBuilder.signalLabel": "信号类型",
  "signoz.queryBuilder.signal": "信号类型",
  "signoz.queryBuilder.functionLabel": "函数",
  "signoz.queryBuilder.function": "函数",
  "signoz.queryBuilder.requestType": "请求类型",
  "signoz.queryBuilder.legacyMixed": "检测到旧版混合查询模式。请选择全局模式以升级；未确认前仍使用原 schema 序列化。",
  "signoz.queryBuilder.externalTimeRange": "时间范围使用页面顶部时间选择器",
  "signoz.queryBuilder.run": "运行查询",
  "signoz.queryBuilder.traceOperator": "链路运算符",
  "signoz.queryBuilder.join": "关联查询",
  "signoz.requestType.time_series": "时间序列",
  "signoz.requestType.scalar": "标量",
  "signoz.requestType.raw": "原始数据",
  "signoz.requestType.raw_stream": "原始数据流",
  "signoz.requestType.trace": "链路",
  "signoz.requestType.distribution": "分布",
  "signoz.queryBuilder.unknownType": "未知类型",
  "signoz.queryBuilder.capabilityUnavailable": "{mode} 当前能力不可用",
  "signoz.queryBuilder.havingLabel": "Having 条件",
  "signoz.queryBuilder.filter": "过滤条件",
  "signoz.queryBuilder.validationError": "表达式校验错误",
  "signoz.queryBuilder.aggregationHelp": "聚合函数：count / sum / avg / min / max / pXX / rate / count_distinct",
  "signoz.querySearch.metaError": "元数据加载失败",
  "signoz.querySearch.unbalanced": "表达式无效",
  "signoz.querySearch.validationError": "表达式校验错误",
  "signoz.querySearch.metadataError": "元数据错误",
  "signoz.panel.issues": "问题",
  "signoz.panel.noIssues": "当前筛选条件下没有问题",
  "signoz.panel.previous": "上一页",
  "signoz.panel.next": "下一页",
  "signoz.panel.success": "操作成功",
  "signoz.panel.actionFailed": "动作失败",
  "signoz.panel.confirmAction": "确认对告警 {id} 执行{action}操作？",
  "signoz.panel.acknowledge": "确认",
  "signoz.panel.resolve": "解决",
  "signoz.panel.traceId": "链路 ID",
  "signoz.panel.open": "打开",
  "signoz.panel.spans": "链路片段（{count}）",
  "signoz.panel.events": "事件",
  "signoz.panel.attributes": "属性",
  "signoz.panel.relatedLogs": "相关日志（{count}）",
  "signoz.panel.pluginName": "SigNoz 可观测性问题",
  "signoz.panel.pageSize": "每页条数",
  "signoz.panel.showTraceDetail": "显示链路详情",
  "signoz.panel.showAttributes": "显示属性",
  "signoz.panel.showTraceLink": "显示链路链接",
  "signoz.panel.showDatasource": "显示数据源",
  "signoz.panel.time": "时间",
  "signoz.panel.source": "来源",
  "signoz.panel.service": "服务",
  "signoz.panel.title": "标题",
  "signoz.panel.severity": "严重性",
  "signoz.panel.status": "状态",
  "signoz.panel.datasource": "数据源",
  "signoz.panel.action": "动作",
  "signoz.panel.readOnly": "只读",
  "signoz.issue.source.log": "日志",
  "signoz.issue.source.trace": "链路",
  "signoz.issue.source.alert": "告警",
  "signoz.issue.source.unknown": "未知来源",
  "signoz.issue.severity.critical": "严重",
  "signoz.issue.severity.error": "错误",
  "signoz.issue.severity.warning": "警告",
  "signoz.issue.severity.info": "信息",
  "signoz.issue.severity.unknown": "未知",
  "signoz.issue.status.firing": "触发中",
  "signoz.issue.status.pending": "待处理",
  "signoz.issue.status.open": "开放",
  "signoz.issue.status.acknowledged": "已确认",
  "signoz.issue.status.resolved": "已解决",
  "signoz.issue.status.closed": "已关闭",
  "signoz.issue.status.unknown": "未知",
  "signoz.signal.metrics": "指标",
  "signoz.signal.logs": "日志",
  "signoz.signal.traces": "链路",
  "signoz.signal.exceptions": "异常",
  "signoz.signal.apiMonitoring": "API 监控",
  "signoz.signal.unknown": "未知信号",
  "signoz.message.success": "操作成功",
  "signoz.message.offline": "离线预览",
  "signoz.message.actionSource": "仅告警来源支持操作",
  "signoz.message.actionFailed": "操作响应表示失败",
  "signoz.message.urlEmpty": "数据源 URL 为空",
  "signoz.message.offlineOk": "SigNoz 离线模式正常",
  "signoz.message.querySyntax": "查询语法错误",
  "signoz.message.queryEmpty": "查询为空",
  "signoz.message.queryValid": "查询有效",
  "signoz.message.invalidQuery": "无效的查询语法",
  "signoz.message.requestFailed": "请求失败",
  "signoz.message.unsupportedAction": "不支持的操作：{action}",
  "signoz.message.auth": "认证：{message}",
  "signoz.message.healthFailed": "健康检查失败：{message}",
  "signoz.message.authProbeFailed": "认证探针失败：{message}",
  "signoz.time.custom": "自定义时间范围",
  "signoz.time.range": "时间范围",
  "signoz.time.apply": "应用",
  "signoz.time.relativeTitle": "相对时间",
  "signoz.time.recent": "最近使用",
  "signoz.time.autoRefresh": "自动刷新",
  "signoz.time.refreshInterval": "刷新间隔",
  "signoz.time.views": "视图",
  "signoz.time.noSavedViews": "暂无已保存视图",
  "signoz.time.saveView": "保存当前视图",
  "signoz.time.preset.5m": "最近 5 分钟",
  "signoz.time.preset.15m": "最近 15 分钟",
  "signoz.time.preset.30m": "最近 30 分钟",
  "signoz.time.preset.1h": "最近 1 小时",
  "signoz.time.preset.6h": "最近 6 小时",
  "signoz.time.preset.1d": "最近 1 天",
  "signoz.time.preset.3d": "最近 3 天",
  "signoz.time.preset.1w": "最近 1 周",
  "signoz.time.preset.1month": "最近 1 个月",
  "signoz.time.relative.3h": "最近 3 小时",
  "signoz.time.relative.4d": "最近 4 天",
  "signoz.time.relative.6w": "最近 6 周",
  "signoz.time.relative.12h": "最近 12 小时",
  "signoz.time.relative.10d": "最近 10 天",
  "signoz.time.relative.2w": "最近 2 周",
  "signoz.time.relative.2months": "最近 2 个月",
  "signoz.time.relative.today": "今天",
  "signoz.time.interval.5s": "5 秒",
  "signoz.time.interval.10s": "10 秒",
  "signoz.time.interval.30s": "30 秒",
  "signoz.time.interval.1m": "1 分钟",
  "signoz.time.interval.5m": "5 分钟",
  "signoz.time.interval.10m": "10 分钟",
  "signoz.time.interval.30m": "30 分钟",
  "signoz.time.interval.1h": "1 小时",
  "signoz.time.interval.2h": "2 小时",
  "signoz.time.interval.1d": "1 天",
  "signoz.time.lastRefresh.days": "{count} 天前刷新",
  "signoz.time.lastRefresh.hours": "{count} 小时前刷新",
  "signoz.time.lastRefresh.minutes": "{count} 分钟前刷新",
  "signoz.time.lastRefresh.seconds": "{count} 秒前刷新"
};
const SIGNOZ_I18N_EN_US = {
  "signoz.metrics.selectMetricPlaceholder": "Select metric",
  "signoz.raw.format": "Format",
  "signoz.raw.formatTitle": "Format after validation succeeds",
  "signoz.function.add": "Add function",
  "signoz.function.argsPlaceholder": "Arguments (comma-separated)",
  "signoz.function.unsupported": "Saved but unsupported functions: {functions} (kept; adjust or restore the capability)",
  "signoz.queryBuilder.addFormula": "Add Formula",
  "signoz.queryBuilder.addFunction": "Add Function",
  "signoz.queryBuilder.addOnGroupBy": "Group By",
  "signoz.queryBuilder.addOnGroupByDesc": "Group results by one or more tag values",
  "signoz.queryBuilder.addOnHaving": "Having",
  "signoz.queryBuilder.addOnHavingDesc": "Filter aggregated results by a condition (e.g. sum(metric) >= 100)",
  "signoz.queryBuilder.addOnLegend": "Legend",
  "signoz.queryBuilder.addOnLegendDesc": "Customize legend labels using \\{\\{key\\}\\} template placeholders",
  "signoz.queryBuilder.addOnLimit": "Limit",
  "signoz.queryBuilder.addOnLimitDesc": "Restrict the maximum number of result series returned",
  "signoz.queryBuilder.addOnOrderBy": "Order By",
  "signoz.queryBuilder.addOnOrderByDesc": "Sort results by timestamp or aggregated value in ascending or descending order",
  "signoz.queryBuilder.agg": "AGG",
  "signoz.queryBuilder.attributePlaceholder": "attribute...",
  "signoz.queryBuilder.clickhousePlaceholder": "Enter ClickHouse SQL query, e.g. SELECT toStartOfInterval(...) ...",
  "signoz.queryBuilder.cloneQuery": "Clone Query",
  "signoz.queryBuilder.collapse": "Collapse",
  "signoz.queryBuilder.expand": "Expand",
  "signoz.queryBuilder.formulaExpr": "Expression",
  "signoz.queryBuilder.formulaExprPlaceholder": "e.g. A / B * 100",
  "signoz.queryBuilder.functionArg": "Function arg",
  "signoz.queryBuilder.functions": "Functions",
  "signoz.queryBuilder.groupBy": "GROUP BY",
  "signoz.queryBuilder.having": "HAVING",
  "signoz.queryBuilder.havingPlaceholder": "e.g. COUNT() > 10",
  "signoz.queryBuilder.keyDataType": "Data type",
  "signoz.queryBuilder.keyType": "Type",
  "signoz.queryBuilder.legend": "LEGEND",
  "signoz.queryBuilder.metricType": "Metric type",
  "signoz.queryBuilder.metricTypeExpHistogram": "ExponentialHistogram",
  "signoz.queryBuilder.metricTypeGauge": "Gauge",
  "signoz.queryBuilder.metricTypeHistogram": "Histogram",
  "signoz.queryBuilder.metricTypeSum": "Sum",
  "signoz.queryBuilder.legendPlaceholder": "\\｛\\｛service.name\\｝\\｝-\\｛\\｛endpoint\\｝\\｝",
  "signoz.queryBuilder.limit": "LIMIT",
  "signoz.queryBuilder.of": "OF",
  "signoz.queryBuilder.orderBy": "ORDER BY",
  "signoz.queryBuilder.orderTimestampAsc": "Timestamp ↑",
  "signoz.queryBuilder.orderTimestampDesc": "Timestamp ↓",
  "signoz.queryBuilder.orderValueAsc": "Value ↑",
  "signoz.queryBuilder.orderValueDesc": "Value ↓",
  "signoz.queryBuilder.placeholderAll": "All (no fault)",
  "signoz.queryBuilder.promqlPlaceholder": "Enter PromQL query, e.g. sum(rate(http_requests_total[5m])) by (service)",
  "signoz.queryBuilder.signal.api_monitoring": "API Monitoring",
  "signoz.queryBuilder.signal.exceptions": "Exceptions",
  "signoz.queryBuilder.signal.logs": "Logs",
  "signoz.queryBuilder.signal.metrics": "Metrics",
  "signoz.queryBuilder.signal.traces": "Traces",
  "signoz.queryBuilder.spaceAgg": "SPACE AGG",
  "signoz.queryBuilder.step": "STEP",
  "signoz.queryBuilder.stepAuto": "Auto",
  "signoz.queryBuilder.tabBuilder": "Query Builder",
  "signoz.queryBuilder.tabClickhouse": "ClickHouse Query",
  "signoz.queryBuilder.tabPromql": "PromQL",
  "signoz.queryBuilder.tagPlaceholder": "tag...",
  "signoz.queryBuilder.timeAgg": "TIME AGG",
  "signoz.querySearch.docLinkText": "View documentation",
  "signoz.querySearch.error": "Error loading suggestions",
  "signoz.querySearch.help": "Need help with search syntax?",
  "signoz.querySearch.loading": "Loading suggestions...",
  "signoz.querySearch.noSuggestions": "No suggestions available",
  "signoz.querySearch.placeholder": "Enter your filter query (e.g., service.name = 'frontend' AND body CONTAINS 'error')",
  "signoz.traces.addQuery": "Add Query",
  "signoz.traces.disableQuery": "Disable",
  "signoz.traces.enableQuery": "Enable",
  "signoz.traces.orderBy": "Order by",
  "signoz.traces.removeQuery": "Remove query",
  "signoz.common.ok": "OK",
  "signoz.common.failed": "Failed",
  "signoz.common.cancel": "Cancel",
  "signoz.common.confirm": "Confirm",
  "signoz.common.close": "Close",
  "signoz.common.loading": "Loading…",
  "signoz.common.select": "Select",
  "signoz.config.baseUrl": "Base URL",
  "signoz.config.connection": "Connection",
  "signoz.config.authentication": "Authentication",
  "signoz.config.requiredBaseUrl": "Please enter a Base URL",
  "signoz.config.customHealthRequired": "The custom profile must pass a health check first",
  "signoz.config.loginMissingCredentials": "Please enter email and password",
  "signoz.config.loginSuccess": "Login succeeded; access/refresh tokens are stored in runtime memory",
  "signoz.config.loginFailed": "Login failed",
  "signoz.config.healthChecking": "Checking…",
  "signoz.config.session": "Email/password session",
  "signoz.config.headerPlaceholder": "X-API-Key / Authorization",
  "signoz.profile.prometheusCompatible": "Prometheus compatible",
  "signoz.profile.signozV5": "SigNoz v5 (Native)",
  "signoz.profile.signozV3": "SigNoz v3",
  "signoz.profile.signozV4": "SigNoz v4",
  "signoz.profile.custom": "Custom",
  "signoz.config.apiProfile": "API Profile",
  "signoz.config.organizationId": "Organization ID",
  "signoz.config.defaultEnvironment": "Default environment",
  "signoz.config.timeout": "Timeout (milliseconds)",
  "signoz.config.cacheTtl": "Metadata cache TTL",
  "signoz.config.credentialKind": "Credential kind",
  "signoz.config.bearerToken": "Bearer / API token",
  "signoz.config.apiKey": "API key",
  "signoz.config.headers": "Custom headers",
  "signoz.config.headerName": "Header name",
  "signoz.config.tokenSecret": "Token / secret (runtime only)",
  "signoz.config.refreshToken": "Refresh token (runtime only, for /sessions/rotate)",
  "signoz.config.email": "Email",
  "signoz.config.password": "Password (runtime memory only)",
  "signoz.config.rememberPassword": "Remember password for automatic renewal",
  "signoz.config.login": "Log in with email and password to obtain a token",
  "signoz.config.loggingIn": "Logging in…",
  "signoz.config.customEndpoints": "Custom endpoints",
  "signoz.config.health": "Health",
  "signoz.config.metrics": "Metrics",
  "signoz.config.logs": "Logs",
  "signoz.config.traces": "Traces",
  "signoz.config.alerts": "Alerts",
  "signoz.config.traceById": "Trace by ID",
  "signoz.config.metadata": "Metadata",
  "signoz.config.acknowledge": "Acknowledge",
  "signoz.config.resolve": "Resolve",
  "signoz.config.healthPassed": "Passed",
  "signoz.config.healthFailed": "Failed",
  "signoz.config.saveBlocked": "Cannot save: custom configuration has not passed health checks",
  "signoz.config.testHealth": "Test connection / health check",
  "signoz.annotation.errorLogs": "Error logs",
  "signoz.annotation.errorSpans": "Error spans",
  "signoz.annotation.firingAlerts": "Firing alerts",
  "signoz.annotation.source": "Source",
  "signoz.annotation.service": "Service",
  "signoz.annotation.environment": "Environment",
  "signoz.annotation.alertsUnavailable": "Firing alerts are hidden because this profile lacks alertsQuery capability",
  "signoz.variable.type": "Variable type",
  "signoz.variable.environment": "Environment",
  "signoz.variable.service": "Service",
  "signoz.variable.operation": "Operation",
  "signoz.variable.metric": "Metric",
  "signoz.variable.attributeKey": "Attribute key",
  "signoz.variable.attributeValue": "Attribute value",
  "signoz.variable.dynamic": "Dynamic (field + source)",
  "signoz.variable.clickhouse": "ClickHouse query",
  "signoz.variable.search": "Search",
  "signoz.variable.keyMetric": "Key / metric",
  "signoz.variable.field": "Field",
  "signoz.variable.source": "Source",
  "signoz.variable.sql": "SQL",
  "signoz.variable.unsupportedType": 'Current API profile does not support variable type "{type}"',
  "signoz.variable.clickhouseUnsupported": "ClickHouse SQL variables are not enabled for the current profile",
  "signoz.queryBuilder.signalLabel": "Signal type",
  "signoz.queryBuilder.signal": "Signal type",
  "signoz.queryBuilder.functionLabel": "Function",
  "signoz.queryBuilder.function": "Function",
  "signoz.queryBuilder.requestType": "Request type",
  "signoz.queryBuilder.legacyMixed": "A legacy mixed-query mode was detected. Select a global mode to upgrade; the original schema remains active until then.",
  "signoz.queryBuilder.externalTimeRange": "The time range comes from the page-level time picker",
  "signoz.queryBuilder.run": "Run query",
  "signoz.queryBuilder.traceOperator": "Trace operator",
  "signoz.queryBuilder.join": "Join",
  "signoz.requestType.time_series": "Time series",
  "signoz.requestType.scalar": "Scalar",
  "signoz.requestType.raw": "Raw data",
  "signoz.requestType.raw_stream": "Raw stream",
  "signoz.requestType.trace": "Trace",
  "signoz.requestType.distribution": "Distribution",
  "signoz.queryBuilder.unknownType": "Unknown type",
  "signoz.queryBuilder.capabilityUnavailable": "{mode} capability is unavailable",
  "signoz.queryBuilder.havingLabel": "Having condition",
  "signoz.queryBuilder.filter": "Filter",
  "signoz.queryBuilder.validationError": "Expression validation error",
  "signoz.queryBuilder.aggregationHelp": "Aggregation functions: count / sum / avg / min / max / pXX / rate / count_distinct",
  "signoz.querySearch.metaError": "Metadata loading failed",
  "signoz.querySearch.unbalanced": "Invalid expression",
  "signoz.querySearch.validationError": "Expression validation error",
  "signoz.querySearch.metadataError": "Metadata error",
  "signoz.panel.issues": "Issues",
  "signoz.panel.noIssues": "No issues match the current filters",
  "signoz.panel.previous": "Previous",
  "signoz.panel.next": "Next",
  "signoz.panel.success": "Action succeeded",
  "signoz.panel.actionFailed": "Action failed",
  "signoz.panel.confirmAction": "Confirm {action} for alert {id}?",
  "signoz.panel.acknowledge": "Acknowledge",
  "signoz.panel.resolve": "Resolve",
  "signoz.panel.traceId": "Trace ID",
  "signoz.panel.open": "Open",
  "signoz.panel.spans": "Spans ({count})",
  "signoz.panel.events": "Events",
  "signoz.panel.attributes": "Attributes",
  "signoz.panel.relatedLogs": "Related logs ({count})",
  "signoz.panel.pluginName": "SigNoz observability issues",
  "signoz.panel.pageSize": "Page size",
  "signoz.panel.showTraceDetail": "Show trace details",
  "signoz.panel.showAttributes": "Show attributes",
  "signoz.panel.showTraceLink": "Show trace link",
  "signoz.panel.showDatasource": "Show data source",
  "signoz.panel.time": "Time",
  "signoz.panel.source": "Source",
  "signoz.panel.service": "Service",
  "signoz.panel.title": "Title",
  "signoz.panel.severity": "Severity",
  "signoz.panel.status": "Status",
  "signoz.panel.datasource": "Data source",
  "signoz.panel.action": "Action",
  "signoz.panel.readOnly": "Read-only",
  "signoz.issue.source.log": "Logs",
  "signoz.issue.source.trace": "Traces",
  "signoz.issue.source.alert": "Alerts",
  "signoz.issue.source.unknown": "Unknown source",
  "signoz.issue.severity.critical": "Critical",
  "signoz.issue.severity.error": "Error",
  "signoz.issue.severity.warning": "Warning",
  "signoz.issue.severity.info": "Info",
  "signoz.issue.severity.unknown": "Unknown",
  "signoz.issue.status.firing": "Firing",
  "signoz.issue.status.pending": "Pending",
  "signoz.issue.status.open": "Open",
  "signoz.issue.status.acknowledged": "Acknowledged",
  "signoz.issue.status.resolved": "Resolved",
  "signoz.issue.status.closed": "Closed",
  "signoz.issue.status.unknown": "Unknown",
  "signoz.signal.metrics": "Metrics",
  "signoz.signal.logs": "Logs",
  "signoz.signal.traces": "Traces",
  "signoz.signal.exceptions": "Exceptions",
  "signoz.signal.apiMonitoring": "API monitoring",
  "signoz.signal.unknown": "Unknown signal",
  "signoz.message.success": "Action succeeded",
  "signoz.message.offline": "Offline preview",
  "signoz.message.actionSource": "Only alert sources support actions",
  "signoz.message.actionFailed": "The action response indicates failure",
  "signoz.message.urlEmpty": "Datasource URL is empty",
  "signoz.message.offlineOk": "SigNoz offline OK",
  "signoz.message.querySyntax": "Query syntax error",
  "signoz.message.queryEmpty": "Query is empty",
  "signoz.message.queryValid": "Query is valid!",
  "signoz.message.invalidQuery": "Invalid query syntax",
  "signoz.message.requestFailed": "Request failed",
  "signoz.message.unsupportedAction": "Unsupported action: {action}",
  "signoz.message.auth": "AUTH: {message}",
  "signoz.message.healthFailed": "Health check failed: {message}",
  "signoz.message.authProbeFailed": "Authenticated probe failed: {message}",
  "signoz.time.custom": "Custom time range",
  "signoz.time.range": "Time range",
  "signoz.time.apply": "Apply",
  "signoz.time.relativeTitle": "Relative time",
  "signoz.time.recent": "Recently used",
  "signoz.time.autoRefresh": "Auto refresh",
  "signoz.time.refreshInterval": "Refresh interval",
  "signoz.time.views": "Views",
  "signoz.time.noSavedViews": "No saved views",
  "signoz.time.saveView": "Save current view",
  "signoz.time.preset.5m": "Last 5 minutes",
  "signoz.time.preset.15m": "Last 15 minutes",
  "signoz.time.preset.30m": "Last 30 minutes",
  "signoz.time.preset.1h": "Last 1 hour",
  "signoz.time.preset.6h": "Last 6 hours",
  "signoz.time.preset.1d": "Last 1 day",
  "signoz.time.preset.3d": "Last 3 days",
  "signoz.time.preset.1w": "Last 1 week",
  "signoz.time.preset.1month": "Last 1 month",
  "signoz.time.relative.3h": "Last 3 hours",
  "signoz.time.relative.4d": "Last 4 days",
  "signoz.time.relative.6w": "Last 6 weeks",
  "signoz.time.relative.12h": "Last 12 hours",
  "signoz.time.relative.10d": "Last 10 days",
  "signoz.time.relative.2w": "Last 2 weeks",
  "signoz.time.relative.2months": "Last 2 months",
  "signoz.time.relative.today": "Today",
  "signoz.time.interval.5s": "5 seconds",
  "signoz.time.interval.10s": "10 seconds",
  "signoz.time.interval.30s": "30 seconds",
  "signoz.time.interval.1m": "1 minute",
  "signoz.time.interval.5m": "5 minutes",
  "signoz.time.interval.10m": "10 minutes",
  "signoz.time.interval.30m": "30 minutes",
  "signoz.time.interval.1h": "1 hour",
  "signoz.time.interval.2h": "2 hours",
  "signoz.time.interval.1d": "1 day",
  "signoz.time.lastRefresh.days": "Refreshed {count} days ago",
  "signoz.time.lastRefresh.hours": "Refreshed {count} hours ago",
  "signoz.time.lastRefresh.minutes": "Refreshed {count} minutes ago",
  "signoz.time.lastRefresh.seconds": "Refreshed {count} seconds ago"
};
Object.freeze(
  Object.keys(SIGNOZ_I18N_ZH_HANS).sort()
);
let registered = false;
function registerSigNozI18nCatalogs() {
  registerI18nCatalog("zh-Hans", SIGNOZ_I18N_ZH_HANS);
  registerI18nCatalog("en-US", SIGNOZ_I18N_EN_US);
  registered = true;
}
function signozT(key, fallback) {
  if (!registered) registerSigNozI18nCatalogs();
  return t(key, fallback);
}
registerSigNozI18nCatalogs();
async function registerSigNozPlugin() {
  registerSigNozI18nCatalogs();
  const [panelMod, dsMod] = await Promise.all([
    Promise.resolve().then(() => module$2),
    Promise.resolve().then(() => module$1)
  ]);
  if (dsMod.plugin) {
    registerDataSourcePlugin(dsMod.plugin);
  }
  if (panelMod.plugin) {
    registerPanelPlugin(panelMod.plugin);
  }
}
const register = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  registerSigNozPlugin
}, Symbol.toStringTag, { value: "Module" }));
function message(key, fallback, vars) {
  let value = signozT(key, fallback);
  for (const [name, replacement] of Object.entries(vars ?? {})) {
    value = value.replaceAll(`{${name}}`, String(replacement));
  }
  return value;
}
function issueSourceLabel(source) {
  switch (String(source ?? "").toLowerCase()) {
    case "log":
    case "logs":
      return message("signoz.issue.source.log", "日志");
    case "trace":
    case "traces":
      return message("signoz.issue.source.trace", "链路");
    case "alert":
    case "alerts":
      return message("signoz.issue.source.alert", "告警");
    default:
      return message("signoz.issue.source.unknown", "未知来源");
  }
}
function issueSeverityLabel(severity) {
  switch (String(severity ?? "").toLowerCase()) {
    case "critical":
    case "fatal":
      return message("signoz.issue.severity.critical", "严重");
    case "error":
      return message("signoz.issue.severity.error", "错误");
    case "warning":
    case "warn":
      return message("signoz.issue.severity.warning", "警告");
    case "info":
      return message("signoz.issue.severity.info", "信息");
    default:
      return message("signoz.issue.severity.unknown", "未知");
  }
}
function issueStatusLabel(status) {
  switch (String(status ?? "").toLowerCase()) {
    case "firing":
      return message("signoz.issue.status.firing", "触发中");
    case "pending":
      return message("signoz.issue.status.pending", "待处理");
    case "open":
      return message("signoz.issue.status.open", "开放");
    case "acknowledged":
    case "acked":
      return message("signoz.issue.status.acknowledged", "已确认");
    case "resolved":
    case "ok":
      return message("signoz.issue.status.resolved", "已解决");
    case "closed":
      return message("signoz.issue.status.closed", "已关闭");
    default:
      return message("signoz.issue.status.unknown", "未知");
  }
}
function fallbackMessage(fallback) {
  const keyByChinese = {
    请求失败: "signoz.message.requestFailed",
    动作失败: "signoz.panel.actionFailed",
    操作成功: "signoz.panel.success"
  };
  const key = keyByChinese[fallback];
  return key ? signozT(key, fallback) : fallback;
}
function chineseMessage(rawMessage, fallback = "请求失败") {
  const text = typeof rawMessage === "string" ? rawMessage : "";
  if (!text) return fallbackMessage(fallback);
  const exact = {
    "ok": message("signoz.message.success", "操作成功"),
    "offline preview": message("signoz.message.offline", "离线预览"),
    "only alert source supports actions": message(
      "signoz.message.actionSource",
      "仅告警来源支持操作"
    ),
    "action response indicates failure": message("signoz.message.actionFailed", "操作响应表示失败"),
    "Datasource URL is empty": message("signoz.message.urlEmpty", "数据源 URL 为空"),
    "SigNoz offline OK": message("signoz.message.offlineOk", "SigNoz 离线模式正常"),
    "Query syntax error": message("signoz.message.querySyntax", "查询语法错误"),
    "Query is empty": message("signoz.message.queryEmpty", "查询为空"),
    "Query is valid!": message("signoz.message.queryValid", "查询有效"),
    "Invalid query syntax": message("signoz.message.invalidQuery", "无效的查询语法")
  };
  if (exact[text]) return exact[text];
  const unsupported = text.match(/^Unsupported action:\s*(.*)$/);
  if (unsupported)
    return message("signoz.message.unsupportedAction", "不支持的操作：{action}", {
      action: unsupported[1]
    });
  const auth = text.match(/^AUTH:\s*(.*)$/);
  if (auth)
    return message("signoz.message.auth", "认证：{message}", {
      message: auth[1]
    });
  const health = text.match(/^health failed\s*(.*)$/);
  if (health)
    return message("signoz.message.healthFailed", "健康检查失败：{message}", {
      message: health[1]
    });
  const probe = text.match(/^authenticated probe failed:\s*(.*)$/);
  if (probe)
    return message("signoz.message.authProbeFailed", "认证探针失败：{message}", {
      message: probe[1]
    });
  return text;
}
const refreshInflight = /* @__PURE__ */ new Map();
function jwtExpiry(token) {
  if (!token) return null;
  try {
    const part = token.split(".")[1];
    if (!part) return null;
    const b64 = part.replaceAll("-", "+").replaceAll("_", "/");
    const padded = b64 + "=".repeat((4 - b64.length % 4) % 4);
    const json = typeof atob === "function" ? atob(padded) : Buffer.from(padded, "base64").toString("utf8");
    const payload = JSON.parse(json);
    return typeof payload.exp === "number" ? payload.exp * 1e3 : null;
  } catch {
    return null;
  }
}
function isHttp401(err) {
  if (!err) return false;
  const e = err;
  if (e?.status === 401 || e?.statusCode === 401) return true;
  if (e?.code === "AUTH_REQUIRED" || e?.code === "AUTH_REJECTED") return true;
  const msg = String(e?.message || e || "");
  return /\b401\b|unauthorized|AUTH_REQUIRED|session expired/i.test(msg);
}
function unwrapData(body) {
  if (!body || typeof body !== "object") return body;
  if (body.data && typeof body.data === "object") return body.data;
  return body;
}
function assertJsonObject(data, label) {
  if (!data || typeof data !== "object" || Array.isArray(data)) {
    throw new DataSourceError("AUTH_REJECTED", `${label} 返回的不是 JSON 对象（可能是 SPA HTML）`);
  }
  const s = JSON.stringify(data).slice(0, 200).toLowerCase();
  if (s.includes("<!doctype") || s.includes("<html")) {
    throw new DataSourceError("AUTH_REJECTED", `${label} 返回 HTML，而不是 JSON`);
  }
  return data;
}
async function loadLatestSessionCredential(uid, fallback) {
  try {
    const latest = asSessionCredential(await getRuntimeCredential(uid));
    if (latest) {
      return {
        ...fallback,
        ...latest,
        kind: "session",
        // Keep password only if rememberPassword (or latest still has it)
        password: latest.password ?? fallback.password,
        email: latest.email ?? fallback.email,
        orgID: latest.orgID ?? fallback.orgID,
        rememberPassword: latest.rememberPassword ?? fallback.rememberPassword
      };
    }
  } catch {
  }
  return fallback;
}
async function refreshSession(ctx, http = datasourceHttp) {
  const existing = refreshInflight.get(ctx.uid);
  if (existing) return existing;
  const promise = doRefreshSession(ctx, http).finally(() => {
    if (refreshInflight.get(ctx.uid) === promise) {
      refreshInflight.delete(ctx.uid);
    }
  });
  refreshInflight.set(ctx.uid, promise);
  return promise;
}
async function doRefreshSession(ctx, http) {
  const c = await loadLatestSessionCredential(ctx.uid, ctx.credential);
  const base = {
    uid: ctx.uid,
    baseUrl: ctx.baseUrl,
    forceNetwork: true,
    signal: ctx.signal
  };
  if (c.refreshToken && c.value) {
    try {
      const r = await http({
        ...base,
        path: "/api/v2/sessions/rotate",
        method: "POST",
        headers: { Authorization: `Bearer ${c.value}` },
        body: { refreshToken: c.refreshToken },
        credential: null
      });
      const body = assertJsonObject(unwrapData(r.data), "sessions/rotate");
      const accessToken2 = String(body.accessToken || body.accessJwt || "");
      const refreshToken2 = String(body.refreshToken || body.refreshJwt || c.refreshToken || "");
      if (!accessToken2) {
        throw new DataSourceError("AUTH_REJECTED", "sessions/rotate 缺少 accessToken");
      }
      const next2 = {
        ...c,
        kind: "session",
        value: accessToken2,
        refreshToken: refreshToken2
      };
      setRuntimeCredential(ctx.uid, next2);
      return next2;
    } catch {
    }
  }
  if (!c.email || !c.password) {
    throw new DataSourceError("AUTH_REQUIRED", "SigNoz 会话已过期,请重新登录");
  }
  let orgID = c.orgID;
  try {
    const ctxResp = await http({
      ...base,
      method: "GET",
      path: "/api/v2/sessions/context",
      query: { email: c.email, ref: `${ctx.baseUrl.replace(/\/$/, "")}/login` },
      credential: null
    });
    const body = assertJsonObject(unwrapData(ctxResp.data), "sessions/context");
    const orgs = body.orgs || body.organizations || [];
    if (!orgID && orgs[0]) {
      orgID = String(orgs[0].id || orgs[0].orgId || orgs[0].orgID || "");
    }
  } catch {
  }
  if (!orgID) {
    throw new DataSourceError(
      "AUTH_REQUIRED",
      "SigNoz 登录需要 orgID，请在配置中填写组织 ID 或重新登录"
    );
  }
  const login = await http({
    ...base,
    path: "/api/v2/sessions/email_password",
    method: "POST",
    body: { email: c.email, password: c.password, orgID },
    credential: null
  });
  const loginBody = assertJsonObject(unwrapData(login.data), "sessions/email_password");
  const accessToken = String(loginBody.accessToken || loginBody.accessJwt || "");
  const refreshToken = String(loginBody.refreshToken || loginBody.refreshJwt || "");
  if (!accessToken) {
    throw new DataSourceError("AUTH_REJECTED", "email_password 登录缺少 accessToken");
  }
  const next = {
    kind: "session",
    value: accessToken,
    refreshToken: refreshToken || void 0,
    orgID,
    email: c.email,
    password: c.rememberPassword ? c.password : void 0,
    rememberPassword: c.rememberPassword
  };
  setRuntimeCredential(ctx.uid, next);
  return next;
}
async function withAuthRetry(fn, ctx, http = datasourceHttp) {
  let cred = await loadLatestSessionCredential(ctx.uid, ctx.credential);
  const exp = jwtExpiry(cred.value);
  if (exp && exp - Date.now() < 5 * 6e4) {
    cred = await refreshSession({ ...ctx, credential: cred }, http);
  }
  try {
    return await fn();
  } catch (error) {
    if (!isHttp401(error)) throw error;
    cred = await refreshSession(
      {
        ...ctx,
        credential: await loadLatestSessionCredential(ctx.uid, cred)
      },
      http
    );
    return await fn();
  }
}
function asSessionCredential(cred) {
  if (!cred) return null;
  if (cred.kind === "session") return cred;
  if (cred.kind === "bearer" && cred.refreshToken) {
    return { ...cred, kind: "session" };
  }
  return null;
}
function labelKey(labels) {
  if (!labels || !Object.keys(labels).length) return "";
  const entries = Object.entries(labels).filter(([k]) => k !== "__name__").sort(([a], [b]) => a.localeCompare(b));
  return JSON.stringify(Object.fromEntries(entries));
}
function fieldLabels(field) {
  const raw = field?.labels;
  if (!raw || typeof raw !== "object") return {};
  const out = {};
  for (const [k, v] of Object.entries(raw)) {
    if (k === "__name__") continue;
    out[k] = String(v);
  }
  return out;
}
function frameMetaLabels(frame) {
  const metaLabels = frame.meta?.custom?.labels || frame.meta?.labels;
  if (metaLabels && typeof metaLabels === "object" && !Array.isArray(metaLabels)) {
    const out = {};
    for (const [k, v] of Object.entries(metaLabels)) {
      if (k === "__name__") continue;
      out[k] = String(v);
    }
    return out;
  }
  return {};
}
function seriesFromFrames(input) {
  if (!input) return [];
  const frames = Array.isArray(input) ? input : [input];
  const series = [];
  for (const fr of frames) {
    const times = fr.fields.find((f) => f.type === "time" || f.name === "Time")?.values || [];
    const valueFields = fr.fields.filter(
      (f) => f.type === "number" || f.name !== "Time" && f.type !== "time" && f.type !== "string"
    );
    if (!valueFields.length) continue;
    for (const vf of valueFields) {
      const labels = { ...frameMetaLabels(fr), ...fieldLabels(vf) };
      series.push({
        labels,
        times,
        values: vf.values || []
      });
    }
  }
  return series;
}
function emptyErrorFrame(name, text, code = "FORMULA_ERROR") {
  return createDataFrame({
    refId: name,
    name,
    fields: [
      { name: "Time", type: "time", values: [] },
      { name: "Value", type: "number", values: [] }
    ],
    meta: {
      notices: [{ severity: "error", text: `[${code}] ${text}` }],
      custom: { formulaError: code }
    }
  });
}
function evaluateLocalFormula(expression, framesByName, name) {
  const deps = expression.match(/\b[A-Z][A-Z0-9_]*\b/g) ?? [];
  const uniqueDeps = Array.from(new Set(deps));
  for (const d of uniqueDeps) {
    if (!framesByName.has(d)) {
      return emptyErrorFrame(name, `公式 ${name} 依赖 ${d} 失败`, "FORMULA_MISSING_DEP");
    }
  }
  const byDep = /* @__PURE__ */ new Map();
  let multi = false;
  const firstKeys = [];
  for (const d of uniqueDeps) {
    const series = seriesFromFrames(framesByName.get(d));
    if (!series.length) {
      return emptyErrorFrame(name, `公式 ${name} 依赖 ${d} 无序列`, "FORMULA_EMPTY_SERIES");
    }
    if (series.length > 1) multi = true;
    const keys = series.map((s) => labelKey(s.labels));
    if (!firstKeys.length) firstKeys.push(...keys);
    else if (keys.join("|") !== firstKeys.join("|")) multi = true;
    if (series.some((s) => Object.keys(s.labels).length) && series.length > 1) multi = true;
    byDep.set(d, series);
  }
  const allSingle = uniqueDeps.every((d) => (byDep.get(d) || []).length === 1);
  const singleKeys = uniqueDeps.map((d) => labelKey((byDep.get(d) || [])[0]?.labels));
  const sameOrEmpty = new Set(singleKeys).size <= 1;
  if (allSingle && sameOrEmpty && !multi) {
    return evaluateSingleSeries(expression, uniqueDeps, byDep, name);
  }
  if (allSingle && !sameOrEmpty) {
    return emptyErrorFrame(name, "公式依赖的序列标签不一致，无法配对", "FORMULA_LABEL_MISMATCH");
  }
  const keySets = uniqueDeps.map(
    (d) => new Set((byDep.get(d) || []).map((s) => labelKey(s.labels)))
  );
  let intersection = new Set(keySets[0] || []);
  for (let i = 1; i < keySets.length; i++) {
    intersection = new Set([...intersection].filter((k) => keySets[i].has(k)));
  }
  const union = /* @__PURE__ */ new Set();
  for (const s of keySets) for (const k of s) union.add(k);
  const missing = [];
  for (const k of union) {
    if (!intersection.has(k)) missing.push(k || "(empty)");
  }
  if (!intersection.size) {
    return emptyErrorFrame(name, "公式依赖的序列标签不一致，无法配对", "FORMULA_LABEL_MISMATCH");
  }
  const firstDep = uniqueDeps[0];
  const firstSeries = byDep.get(firstDep) || [];
  const matched = [...intersection].sort();
  const fields = [];
  let times = [];
  const notices = [];
  if (missing.length) {
    notices.push({
      severity: "error",
      text: `[FORMULA_LABEL_MISMATCH] 部分标签未在全部依赖中出现: ${missing.slice(0, 5).join(", ")}`
    });
  }
  for (const key of matched) {
    const envSeries = {};
    for (const d of uniqueDeps) {
      const hit = (byDep.get(d) || []).find((s) => labelKey(s.labels) === key);
      if (!hit) {
        return emptyErrorFrame(
          name,
          `标签 ${key || "(empty)"} 缺少依赖 ${d}`,
          "FORMULA_LABEL_MISMATCH"
        );
      }
      envSeries[d] = hit;
    }
    const base = envSeries[firstDep];
    if (!times.length) times = base.times;
    const evalExpr = compileArithmetic(expression);
    const values = [];
    for (let i = 0; i < times.length; i++) {
      const env = {};
      let ok2 = true;
      for (const d of uniqueDeps) {
        const v = Number(envSeries[d].values[i]);
        if (!Number.isFinite(v)) {
          ok2 = false;
          break;
        }
        env[d] = v;
      }
      if (!ok2) {
        values.push(null);
        continue;
      }
      try {
        values.push(evalExpr(env));
      } catch {
        values.push(null);
      }
    }
    const labels = firstSeries.find((s) => labelKey(s.labels) === key)?.labels || {};
    const display = Object.keys(labels).length ? Object.entries(labels).map(([k, v]) => `${k}=${v}`).join(", ") : name;
    fields.push({
      name: matched.length === 1 ? name : display,
      type: "number",
      values,
      labels,
      config: { displayNameFromDS: display }
    });
  }
  return createDataFrame({
    refId: name,
    name,
    fields: [{ name: "Time", type: "time", values: times }, ...fields],
    meta: notices.length ? { notices } : void 0
  });
}
function evaluateSingleSeries(expression, deps, byDep, name) {
  const first = (byDep.get(deps[0] || "") || [])[0];
  const times = first?.times || [];
  const evalExpr = compileArithmetic(expression);
  const values = [];
  for (let i = 0; i < times.length; i++) {
    const env = {};
    let ok2 = true;
    for (const d of deps) {
      const s = (byDep.get(d) || [])[0];
      const v = Number(s?.values[i]);
      if (!Number.isFinite(v)) {
        ok2 = false;
        break;
      }
      env[d] = v;
    }
    if (!ok2) {
      values.push(null);
      continue;
    }
    try {
      values.push(evalExpr(env));
    } catch {
      values.push(null);
    }
  }
  const labels = first?.labels || {};
  return createDataFrame({
    refId: name,
    name,
    fields: [
      { name: "Time", type: "time", values: times },
      {
        name,
        type: "number",
        values,
        labels: Object.keys(labels).length ? labels : void 0
      }
    ]
  });
}
const FORMULA_COMPILE_CACHE = /* @__PURE__ */ new Map();
const FORMULA_COMPILE_CACHE_MAX = 64;
function compileArithmetic(expr) {
  const hit = FORMULA_COMPILE_CACHE.get(expr);
  if (hit) return hit;
  const tokens = expr.match(/[A-Z][A-Z0-9_]*|\d+(\.\d+)?|<=|>=|==|!=|[<>+\-*/()]/g);
  if (!tokens) throw new Error("empty");
  const compiled = (env) => {
    let i = 0;
    function peek() {
      return tokens[i];
    }
    function next() {
      return tokens[i++];
    }
    function parseComparison() {
      let v2 = parseExpr();
      while (peek() === "<" || peek() === ">" || peek() === "<=" || peek() === ">=" || peek() === "==" || peek() === "!=") {
        const op = next();
        const r = parseExpr();
        let ok2 = false;
        if (op === "<") ok2 = v2 < r;
        else if (op === ">") ok2 = v2 > r;
        else if (op === "<=") ok2 = v2 <= r;
        else if (op === ">=") ok2 = v2 >= r;
        else if (op === "==") ok2 = v2 === r;
        else if (op === "!=") ok2 = v2 !== r;
        v2 = ok2 ? 1 : 0;
      }
      return v2;
    }
    function parseExpr() {
      let v2 = parseTerm();
      while (peek() === "+" || peek() === "-") {
        const op = next();
        const r = parseTerm();
        v2 = op === "+" ? v2 + r : v2 - r;
      }
      return v2;
    }
    function parseTerm() {
      let v2 = parseFactor();
      while (peek() === "*" || peek() === "/") {
        const op = next();
        const r = parseFactor();
        v2 = op === "*" ? v2 * r : v2 / r;
      }
      return v2;
    }
    function parseFactor() {
      const t2 = next();
      if (t2 === "(") {
        const v2 = parseComparison();
        if (next() !== ")") throw new Error("paren");
        return v2;
      }
      if (t2 === "-") return -parseFactor();
      if (/^\d/.test(t2)) return Number(t2);
      if (env[t2] == null) throw new Error(`unknown ${t2}`);
      return env[t2];
    }
    const v = parseComparison();
    if (i !== tokens.length) throw new Error("trailing");
    return v;
  };
  if (FORMULA_COMPILE_CACHE.size >= FORMULA_COMPILE_CACHE_MAX) {
    const first = FORMULA_COMPILE_CACHE.keys().next().value;
    if (first != null) FORMULA_COMPILE_CACHE.delete(first);
  }
  FORMULA_COMPILE_CACHE.set(expr, compiled);
  return compiled;
}
function schemaSummaryOf(value, depth = 0) {
  if (depth > 4) return "...";
  if (value == null) return String(value);
  if (Array.isArray(value)) return `array(${value.length})`;
  if (typeof value !== "object") return typeof value;
  const keys = Object.keys(value).slice(0, 20);
  return `{${keys.map((k) => `${k}:${schemaSummaryOf(value[k], depth + 1)}`).join(",")}}`;
}
function asWarnings(v) {
  if (v == null) return void 0;
  if (Array.isArray(v)) return v.map(String);
  return [String(v)];
}
function normalizeType(t2) {
  const s = t2.toLowerCase();
  if (s.includes("matrix") || s.includes("time_series") || s === "series") return "time_series";
  if (s.includes("vector") || s.includes("scalar")) return "scalar";
  if (s.includes("raw_stream") || s === "stream") return "raw_stream";
  if (s.includes("raw")) return "raw";
  if (s.includes("trace")) return "trace";
  if (s.includes("distribution") || s.includes("histogram")) return "distribution";
  return "unknown";
}
function inferType(data, list) {
  const explicit = String(data.resultType ?? data.type ?? data.requestType ?? "").toLowerCase();
  if (explicit) {
    const n = normalizeType(explicit);
    if (n !== "unknown") return n;
    if (!["", "matrix", "vector", "success"].includes(explicit)) return "unknown";
  }
  const first = list[0];
  if (!first) return "unknown";
  if (first.aggregations || first.series || first.values || first.timestamps) return "time_series";
  if (first.spans || first.traceID || first.traceId || first.list) return "trace";
  if (first.columns && first.data) return "scalar";
  if (first.rows || first.nextCursor != null) return "raw";
  return list.length ? "time_series" : "unknown";
}
function extractSignozEnvelope(body, profile = "native", opts) {
  if (body == null || typeof body !== "object") {
    throw new DataSourceError("INVALID_RESPONSE", "SigNoz 响应不是对象");
  }
  const root = body;
  if (profile === "argus" || profile === "flat") {
    const status2 = root.status != null ? String(root.status) : root.code != null ? String(root.code) : void 0;
    if (status2 && /error|fail/i.test(status2) && status2 !== "200") {
      throw new DataSourceError("INVALID_RESPONSE", `SigNoz status=${status2}`);
    }
    const outer = root.data && typeof root.data === "object" ? root.data : root;
    const nested2 = outer.data && typeof outer.data === "object" ? outer.data : null;
    const data = nested2 || outer;
    const results = data.results ?? data.result ?? outer.results ?? outer.result ?? [];
    const list2 = Array.isArray(results) ? results : results != null ? [results] : [];
    return {
      status: status2,
      type: inferType(outer, list2) || inferType(data, list2),
      results: list2,
      warning: asWarnings(root.warning ?? outer.warning ?? data.warning),
      meta: {
        ...typeof outer.meta === "object" && outer.meta ? outer.meta : {},
        ...typeof data.meta === "object" && data.meta ? data.meta : {}
      },
      raw: body,
      schemaSummary: schemaSummaryOf(body)
    };
  }
  if (!("data" in root) && !("result" in root)) {
    throw new DataSourceError(
      "UNSUPPORTED_RESPONSE_SHAPE",
      `缺少 data 包络；schema=${schemaSummaryOf(body)}`
    );
  }
  const dataLayer = root.data && typeof root.data === "object" ? root.data : null;
  if (!dataLayer) {
    throw new DataSourceError(
      "UNSUPPORTED_RESPONSE_SHAPE",
      `缺少 data 对象；schema=${schemaSummaryOf(body)}`
    );
  }
  const status = root.status != null ? String(root.status) : dataLayer.status != null ? String(dataLayer.status) : void 0;
  if (status && /error|fail/i.test(status) && status.toLowerCase() !== "success") {
    throw new DataSourceError("INVALID_RESPONSE", `SigNoz status=${status}`, {
      upstreamCode: status
    });
  }
  const nested = dataLayer.data && typeof dataLayer.data === "object" ? dataLayer.data : null;
  let resultsRaw;
  let typeSource = dataLayer;
  if (nested && (nested.results != null || nested.result != null)) {
    resultsRaw = nested.results ?? nested.result;
    typeSource = { ...dataLayer, ...nested };
  } else if (opts?.strictV5) {
    if (dataLayer.results != null && nested == null) {
      throw new DataSourceError(
        "UNSUPPORTED_RESPONSE_SHAPE",
        `Native V5 必须使用 data.data.results，不能使用 data.results；schema=${schemaSummaryOf(body)}`
      );
    }
    resultsRaw = dataLayer.result;
    if (resultsRaw == null) {
      throw new DataSourceError(
        "UNSUPPORTED_RESPONSE_SHAPE",
        `缺少 data.data.results；schema=${schemaSummaryOf(body)}`
      );
    }
  } else {
    resultsRaw = dataLayer.result ?? dataLayer.results;
  }
  if (resultsRaw == null) {
    throw new DataSourceError(
      "UNSUPPORTED_RESPONSE_SHAPE",
      `缺少 results；schema=${schemaSummaryOf(body)}`
    );
  }
  const list = Array.isArray(resultsRaw) ? resultsRaw : [resultsRaw];
  const type = inferType(typeSource, list);
  const known = /* @__PURE__ */ new Set([
    "status",
    "data",
    "type",
    "resultType",
    "result",
    "results",
    "meta",
    "warning",
    "error"
  ]);
  const extras = {};
  for (const [k, v] of Object.entries(dataLayer)) {
    if (!known.has(k)) extras[k] = v;
  }
  return {
    status,
    type,
    results: list,
    warning: asWarnings(root.warning ?? dataLayer.warning ?? nested?.warning),
    meta: {
      ...typeof dataLayer.meta === "object" && dataLayer.meta ? dataLayer.meta : {},
      ...nested && typeof nested.meta === "object" && nested.meta ? nested.meta : {},
      resultType: dataLayer.resultType ?? dataLayer.type
    },
    extras: Object.keys(extras).length ? extras : void 0,
    raw: body,
    schemaSummary: schemaSummaryOf(body)
  };
}
function schemaSummary(value) {
  return schemaSummaryOf(value);
}
function liveMeta$3(extra = {}) {
  return { source: "live", preferredVisualisationType: "table", ...extra };
}
function labelsToRecord$1(labels) {
  const out = {};
  if (Array.isArray(labels)) {
    for (const l of labels) {
      const name = String(l?.key?.name ?? l?.name ?? "").trim();
      if (name) out[name] = String(l?.value ?? "");
    }
  } else if (labels && typeof labels === "object") {
    for (const [k, v] of Object.entries(labels)) out[k] = String(v);
  }
  return out;
}
function emptyScalarFrame(opts, extraMeta = {}) {
  return createDataFrame({
    refId: opts.refId,
    name: String(extraMeta.queryName || "scalar"),
    meta: liveMeta$3({
      requestType: "scalar",
      empty: true,
      warnings: opts.warnings,
      ...extraMeta
    }),
    fields: [{ name: "Value", type: "number", values: [] }]
  });
}
function asArray$1(v) {
  return Array.isArray(v) ? v : [];
}
function isColumnsDataShape(r) {
  if (!r || typeof r !== "object") return false;
  if ("columns" in r || "data" in r) return true;
  if (r.table && typeof r.table === "object") return true;
  return false;
}
function isAggSeriesShape(r) {
  if (!r || typeof r !== "object") return false;
  if ("aggregations" in r) return true;
  if (Array.isArray(r.series)) return true;
  return false;
}
function isPromVectorShape(r) {
  if (!r || typeof r !== "object") return false;
  return Array.isArray(r.value) && r.value.length >= 2 && (r.metric != null || r.labels != null);
}
function isSafeNumeric(v) {
  if (v == null || v === "") return true;
  if (typeof v === "number") return Number.isFinite(v);
  if (typeof v !== "string") return false;
  if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(v.trim())) return false;
  if (/^[+-]?\d+$/.test(v.trim())) {
    const abs = v.trim().replace(/^[+-]/, "");
    if (abs.length > 15) return false;
    const n2 = Number(v);
    return Number.isSafeInteger(n2);
  }
  const n = Number(v);
  return Number.isFinite(n);
}
function coerceScalarValue(rawVal) {
  if (rawVal == null || rawVal === "") return null;
  if (typeof rawVal === "number") return Number.isFinite(rawVal) ? rawVal : null;
  const s = String(rawVal);
  if (/^[+-]?\d+$/.test(s.trim())) {
    const abs = s.trim().replace(/^[+-]/, "");
    if (abs.length > 15 || !Number.isSafeInteger(Number(s))) return s;
  }
  const n = Number(s);
  return Number.isFinite(n) ? n : s;
}
function fieldFromValues(name, values) {
  const forceString = /(?:^|_)(id|Id|ID)$/.test(name) || /trace|span/i.test(name) || name === "traceId" || name === "spanId";
  const isNum = !forceString && values.every((v) => isSafeNumeric(v));
  return {
    name,
    type: isNum ? "number" : "string",
    values: isNum ? values.map((v) => v == null || v === "" ? null : Number(v)) : values.map((v) => v == null ? null : String(v))
  };
}
function mapColumnsDataResult(r, qi, opts) {
  const table = r?.table && typeof r.table === "object" ? r.table : r;
  const cols = asArray$1(table.columns);
  const rows = asArray$1(table.data ?? table.rows);
  const isObjectRows = rows.length > 0 && rows.every((row) => row != null && typeof row === "object" && !Array.isArray(row));
  if (isObjectRows) {
    const fieldNames = cols.length > 0 ? cols.map(
      (c, ci) => typeof c === "string" ? c : String(c?.name || c?.title || c?.id || `col${ci}`)
    ) : Array.from(
      new Set(
        rows.flatMap(
          (row) => Object.keys(row?.data && typeof row.data === "object" ? row.data : row)
        )
      )
    );
    const fields2 = fieldNames.map((name) => {
      const values = rows.map((row) => {
        const obj = row?.data && typeof row.data === "object" ? row.data : row;
        return obj?.[name] ?? null;
      });
      return fieldFromValues(name, values);
    });
    return createDataFrame({
      refId: opts.refId,
      name: String(r.queryName || r.name || `scalar-${qi}`),
      meta: liveMeta$3({
        requestType: "scalar",
        shape: "columns",
        queryName: r.queryName,
        empty: !fields2.length || fields2.every((f) => !Array.isArray(f.values) || f.values.length === 0) || void 0,
        warnings: opts.warnings
      }),
      fields: fields2.length ? fields2 : [{ name: "Value", type: "number", values: [] }]
    });
  }
  const matrixRows = rows.map((row) => Array.isArray(row) ? row : []);
  const fields = cols.map((c, ci) => {
    const name = typeof c === "string" ? c : String(c?.name || c?.title || `col${ci}`);
    const values = matrixRows.map((row) => ci < row.length ? row[ci] : null);
    return fieldFromValues(name, values);
  });
  return createDataFrame({
    refId: opts.refId,
    name: String(r.queryName || r.name || `scalar-${qi}`),
    meta: liveMeta$3({
      requestType: "scalar",
      shape: "columns",
      queryName: r.queryName,
      empty: !fields.length || fields.every((f) => !Array.isArray(f.values) || f.values.length === 0) || void 0,
      warnings: opts.warnings
    }),
    fields: fields.length ? fields : [{ name: "Value", type: "number", values: [] }]
  });
}
function mapAggSeriesResult(result, ri, opts) {
  const frames = [];
  const aggs = Array.isArray(result.aggregations) ? result.aggregations : result.series ? [{ series: result.series }] : [];
  aggs.forEach((agg, ai) => {
    const seriesList = asArray$1(agg?.series);
    seriesList.forEach((s, si) => {
      const labels = labelsToRecord$1(s.labels);
      const rawVal = s.values?.[0]?.value ?? s.value ?? s.values?.[0] ?? null;
      const n = coerceScalarValue(rawVal);
      const name = String(agg.alias || result.queryName || labels.__name__ || `A${ri}_${ai}_${si}`);
      frames.push(
        createDataFrame({
          refId: opts.refId,
          name,
          meta: liveMeta$3({
            requestType: "scalar",
            shape: "aggregations",
            aggregationIndex: ai,
            alias: agg.alias,
            queryName: result.queryName,
            labels,
            unit: agg.unit || agg.meta?.unit || s.unit,
            warnings: opts.warnings
          }),
          fields: [
            {
              name: "Value",
              type: "number",
              values: [Number.isFinite(n) ? n : null],
              labels,
              config: { displayNameFromDS: name }
            },
            {
              name: "ValueRaw",
              type: "string",
              values: [rawVal == null ? null : String(rawVal)]
            }
          ]
        })
      );
    });
  });
  return frames;
}
function mapPromVectorResult(r, i, opts) {
  const labels = labelsToRecord$1(r.metric ?? r.labels);
  const rawVal = Array.isArray(r.value) ? r.value[1] : r.value;
  const n = coerceScalarValue(rawVal);
  const name = String(labels.__name__ || r.queryName || opts.refId || `vector-${i}`);
  return createDataFrame({
    refId: opts.refId,
    name,
    meta: liveMeta$3({
      requestType: "scalar",
      shape: "prom_vector",
      labels,
      warnings: opts.warnings
    }),
    fields: [
      {
        name: "Value",
        type: "number",
        values: [Number.isFinite(n) ? n : null],
        labels,
        config: { displayNameFromDS: name }
      },
      {
        name: "ValueRaw",
        type: "string",
        values: [rawVal == null ? null : String(rawVal)]
      }
    ]
  });
}
function mapScalarResponse(results, opts) {
  if (!results.length) {
    return [emptyScalarFrame(opts)];
  }
  const frames = [];
  results.forEach((raw, qi) => {
    const r = raw;
    if (r == null || typeof r !== "object") {
      frames.push(emptyScalarFrame(opts, { index: qi }));
      return;
    }
    if (isColumnsDataShape(r)) {
      frames.push(mapColumnsDataResult(r, qi, opts));
      return;
    }
    if (isAggSeriesShape(r)) {
      const mapped = mapAggSeriesResult(r, qi, opts);
      if (mapped.length) frames.push(...mapped);
      else
        frames.push(
          emptyScalarFrame(opts, {
            shape: "aggregations",
            queryName: r.queryName
          })
        );
      return;
    }
    if (isPromVectorShape(r)) {
      frames.push(mapPromVectorResult(r, qi, opts));
      return;
    }
    if (r.queryName != null || r.name != null) {
      frames.push(
        emptyScalarFrame(opts, {
          shape: "empty",
          queryName: r.queryName ?? r.name,
          index: qi
        })
      );
      return;
    }
    throw new DataSourceError(
      "UNSUPPORTED_RESPONSE_SHAPE",
      `scalar results match neither aggregations.series nor columns/data shape; keys=${JSON.stringify(
        Object.keys(r).slice(0, 12)
      )}`
    );
  });
  return frames.length ? frames : [emptyScalarFrame(opts)];
}
function liveMeta$2(extra = {}) {
  return { source: "live", preferredVisualisationType: "logs", ...extra };
}
function toMs$2(v) {
  const n = Number(v ?? 0);
  if (!Number.isFinite(n) || n <= 0) return 0;
  return n < 1e12 ? n * 1e3 : n;
}
function mapRawRows(results, opts) {
  const frames = [];
  for (const result of results) {
    const r = result;
    const rows = Array.isArray(r?.rows) ? r.rows : Array.isArray(r?.data) ? r.data : Array.isArray(r) ? r : [];
    const keySet = /* @__PURE__ */ new Set([
      "timestamp",
      "body",
      "severity",
      "trace_id",
      "span_id",
      "service",
      "resources_string",
      "attributes_string"
    ]);
    for (const row of rows) {
      if (row && typeof row === "object") {
        for (const k of Object.keys(row)) keySet.add(k);
        if (row.data && typeof row.data === "object") {
          for (const k of Object.keys(row.data)) keySet.add(`data.${k}`);
        }
      }
    }
    const keys = [...keySet];
    const n = rows.length;
    const colValues = {};
    for (const k of keys) colValues[k] = new Array(n);
    for (let ri = 0; ri < n; ri++) {
      const row = rows[ri];
      const o = row && typeof row === "object" ? row : {};
      for (const k of keys) {
        const arr = colValues[k];
        if (k.startsWith("data.")) {
          arr[ri] = o.data ? o.data[k.slice(5)] : null;
        } else {
          arr[ri] = o[k] ?? null;
        }
      }
    }
    const times = rows.map((row) => toMs$2(row?.timestamp ?? row?.time ?? row?.ts));
    const lines = rows.map(
      (row) => String(
        row?.body ?? row?.message ?? row?.line ?? (typeof row === "string" ? row : JSON.stringify(row ?? ""))
      )
    );
    const fields = [
      { name: "Time", type: "time", values: times },
      { name: "Line", type: "string", values: lines },
      {
        name: "severity",
        type: "string",
        values: rows.map((row) => String(row?.severity ?? row?.level ?? ""))
      },
      {
        name: "traceId",
        type: "string",
        values: rows.map((row) => String(row?.trace_id ?? row?.traceId ?? ""))
      },
      {
        name: "spanId",
        type: "string",
        values: rows.map((row) => String(row?.span_id ?? row?.spanId ?? ""))
      },
      {
        name: "service",
        type: "string",
        values: rows.map(
          (row) => String(
            row?.service ?? row?.resources_string?.["service.name"] ?? row?.["service.name"] ?? ""
          )
        )
      }
    ];
    for (const k of keys) {
      if ([
        "timestamp",
        "body",
        "message",
        "line",
        "severity",
        "level",
        "trace_id",
        "traceId",
        "span_id",
        "spanId",
        "service"
      ].includes(k)) {
        continue;
      }
      fields.push({
        name: k,
        type: "string",
        values: colValues[k].map(
          (v) => v == null ? null : typeof v === "string" ? v : JSON.stringify(v)
        )
      });
    }
    frames.push(
      createDataFrame({
        refId: opts.refId,
        name: String(r?.queryName || (opts.stream ? "raw_stream" : "raw")),
        meta: liveMeta$2({
          requestType: opts.stream ? "raw_stream" : "raw",
          queryName: r?.queryName,
          nextCursor: r?.nextCursor ?? r?.cursor ?? null,
          selectFields: r?.selectFields,
          rowCount: rows.length,
          warnings: opts.warnings
        }),
        fields
      })
    );
  }
  if (!frames.length) {
    frames.push(
      createDataFrame({
        refId: opts.refId,
        name: opts.stream ? "raw_stream" : "raw",
        meta: liveMeta$2({
          requestType: opts.stream ? "raw_stream" : "raw",
          empty: true
        }),
        fields: [
          { name: "Time", type: "time", values: [] },
          { name: "Line", type: "string", values: [] }
        ]
      })
    );
  }
  return frames;
}
function mapRawResponse(body, opts) {
  const b = body;
  const results = b?.data?.data?.results ?? b?.data?.results ?? b?.results;
  if (Array.isArray(results)) return mapRawRows(results, opts);
  if (Array.isArray(b?.data?.result)) return mapRawRows(b.data.result, opts);
  if (Array.isArray(b?.logs)) {
    return mapRawRows([{ rows: b.logs }], { ...opts, stream: false });
  }
  if (Array.isArray(b?.traces)) {
    return mapRawRows([{ rows: b.traces }], { ...opts, stream: false });
  }
  if (Array.isArray(b?.rows)) {
    return mapRawRows([{ rows: b.rows }], { ...opts, stream: false });
  }
  return [
    createDataFrame({
      refId: opts.refId,
      name: "raw",
      meta: {
        source: "live",
        preferredVisualisationType: opts.signal === "logs" ? "logs" : void 0,
        notices: [
          {
            severity: "warning",
            text: "raw mapper: unstructured payload retained as JSON column"
          }
        ]
      },
      fields: [
        {
          name: "raw",
          type: "string",
          values: [typeof body === "string" ? body : JSON.stringify(body ?? null)]
        }
      ]
    })
  ];
}
function mapRawStreamResponse(results, opts) {
  return mapRawRows(results, { ...opts, stream: true });
}
function liveMeta$1(extra = {}) {
  return { source: "live", preferredVisualisationType: "histogram", ...extra };
}
function mapDistributionResponse(results, opts) {
  if (!opts.experimentalDistribution) {
    throw new DataSourceError(
      "UNSUPPORTED_CAPABILITY",
      "distribution 仅实验能力，需要 experimentalDistribution=VERIFIED"
    );
  }
  const list = Array.isArray(results) ? results : results != null ? [results] : [];
  const frames = [];
  for (const result of list) {
    const r = result;
    const bucketsDirect = r?.buckets || r?.data?.buckets;
    const aggs = r?.aggregations || r?.data?.aggregations || [];
    const seriesBuckets = [];
    if (Array.isArray(bucketsDirect)) {
      seriesBuckets.push({ labels: {}, buckets: bucketsDirect });
    }
    for (const agg of aggs) {
      for (const s of agg?.series || []) {
        if (Array.isArray(s?.buckets) || Array.isArray(s?.values)) {
          seriesBuckets.push({
            labels: labelsOf(s?.labels),
            buckets: s.buckets || s.values
          });
        }
      }
    }
    for (const s of r?.series || []) {
      if (Array.isArray(s?.buckets) || Array.isArray(s?.values)) {
        seriesBuckets.push({
          labels: labelsOf(s?.labels),
          buckets: s.buckets || s.values
        });
      }
    }
    for (const series of seriesBuckets) {
      const bounds = [];
      const counts = [];
      for (const b of series.buckets || []) {
        const le = Number(b?.le ?? b?.upperBound ?? b?.bound ?? b?.[0]);
        const count = Number(b?.count ?? b?.value ?? b?.[1]);
        if (!Number.isFinite(le) || !Number.isFinite(count)) continue;
        bounds.push(le);
        counts.push(count);
      }
      if (!bounds.length) continue;
      const labelStr = Object.entries(series.labels || {}).map(([k, v]) => `${k}=${v}`).join(", ");
      frames.push(
        createDataFrame({
          refId: opts.refId,
          name: labelStr || "histogram",
          meta: liveMeta$1({
            preferredVisualisationType: "histogram",
            requestType: "distribution",
            labels: series.labels
          }),
          fields: [
            {
              name: "le",
              type: "number",
              values: bounds,
              config: { displayNameFromDS: "le" }
            },
            {
              name: "count",
              type: "number",
              values: counts,
              labels: series.labels,
              config: { displayNameFromDS: "count" }
            }
          ]
        })
      );
    }
  }
  if (frames.length) return frames;
  return [
    createDataFrame({
      refId: opts.refId,
      name: "distribution",
      meta: liveMeta$1({
        preferredVisualisationType: "histogram",
        requestType: "distribution",
        empty: true,
        notices: [{ severity: "warning", text: "distribution response had no buckets" }]
      }),
      fields: [
        { name: "le", type: "number", values: [] },
        { name: "count", type: "number", values: [] }
      ]
    })
  ];
}
function labelsOf(raw) {
  if (!raw) return {};
  if (Array.isArray(raw)) {
    const out = {};
    for (const l of raw) {
      const k = l?.key?.name || l?.key || l?.name;
      if (k) out[String(k)] = String(l?.value ?? "");
    }
    return out;
  }
  if (typeof raw === "object") {
    const out = {};
    for (const [k, v] of Object.entries(raw)) {
      if (k === "__name__") continue;
      out[k] = String(v);
    }
    return out;
  }
  return {};
}
const ALL_MODES = ["builder", "promql", "clickhouse_sql"];
const BUILDER_ONLY = ["builder"];
const PROMQL_ONLY = ["promql"];
const EMPTY_MODES = {
  metrics: [],
  logs: [],
  traces: []
};
function defaultIsHealthy(status, data) {
  if (status < 200 || status >= 300) return false;
  if (data == null || typeof data !== "object") return true;
  const o = data;
  if ("success" in o && o.success === false) return false;
  if ("ok" in o && o.ok === false) return false;
  if ("status" in o) {
    const s = String(o.status).toLowerCase();
    if (s === "error" || s === "failed") return false;
  }
  if ("error" in o && o.error != null && String(o.error).trim() !== "") return false;
  return true;
}
const SIGNOZ_PROFILES = {
  "prometheus-compatible": {
    id: "prometheus-compatible",
    signals: ["metrics"],
    formulaServerSide: false,
    supportsServerFormula: false,
    queryModesBySignal: { metrics: PROMQL_ONLY, logs: [], traces: [] },
    isHealthy: defaultIsHealthy,
    endpoints: {
      metricsQuery: { path: "/api/v1/query_range", method: "GET" },
      health: { path: "/api/v1/status/buildinfo", method: "GET" }
    }
  },
  "signoz-v3": {
    id: "signoz-v3",
    signals: ["metrics", "logs", "traces"],
    formulaServerSide: true,
    supportsServerFormula: true,
    queryModesBySignal: {
      metrics: ALL_MODES,
      logs: BUILDER_ONLY,
      traces: BUILDER_ONLY
    },
    isHealthy: defaultIsHealthy,
    endpoints: {
      metricsQuery: { path: "/api/v3/query_range", method: "POST" },
      logsQuery: { path: "/api/v3/query_range", method: "POST" },
      tracesQuery: { path: "/api/v3/query_range", method: "POST" },
      traceById: { path: "/api/v1/traces/{id}", method: "GET" },
      metadata: { path: "/api/v1/services", method: "POST" },
      services: { path: "/api/v1/services", method: "POST" },
      health: { path: "/api/v1/health", method: "GET" },
      liveTail: { path: "/api/v3/logs/livetail", method: "GET" },
      liveTailLegacy: { path: "/api/v1/logs/tail", method: "GET" },
      exportRaw: { path: "/api/v1/export_raw_data", method: "POST" }
    }
  },
  "signoz-v5": {
    id: "signoz-v5",
    signals: ["metrics", "logs", "traces"],
    formulaServerSide: true,
    supportsServerFormula: true,
    // Argus host rewrites SigNoz under /api/apm/* and uses Bearer session token.
    credentialModes: ["bearer", "proxy", "headers", "signozApiKey", "session"],
    defaultCredentialHeader: "Authorization",
    queryModesBySignal: {
      metrics: ALL_MODES,
      logs: ALL_MODES,
      traces: BUILDER_ONLY
    },
    isHealthy: defaultIsHealthy,
    endpoints: {
      metricsQuery: { path: "/api/apm/v5/query_range", method: "POST" },
      logsQuery: { path: "/api/apm/v5/query_range", method: "POST" },
      tracesQuery: { path: "/api/apm/v5/query_range", method: "POST" },
      health: { path: "/api/apm/v1/health", method: "GET" },
      healthCandidates: [
        { path: "/api/apm/v1/health", method: "GET" },
        { path: "/api/apm/v2/healthz", method: "GET" }
      ],
      version: { path: "/api/apm/v1/version", method: "GET" },
      metricsList: { path: "/api/apm/v2/metrics", method: "GET" },
      metadata: { path: "/api/apm/v2/metrics", method: "GET" },
      fieldsKeys: { path: "/api/apm/v1/fields/keys", method: "GET" },
      fieldsValues: { path: "/api/apm/v1/fields/values", method: "GET" },
      attributeKeys: { path: "/api/apm/v1/fields/keys", method: "GET" },
      attributeValues: { path: "/api/apm/v1/fields/values", method: "GET" },
      services: { path: "/api/apm/v2/services", method: "POST" },
      alertsQuery: { path: "/api/apm/v1/rules", method: "GET" },
      variablesQuery: { path: "/api/apm/v2/variables/query", method: "POST" },
      traceById: { path: "/api/apm/v4/traces/{id}", method: "GET" },
      liveTail: { path: "/api/apm/v3/logs/livetail", method: "GET" },
      liveTailLegacy: { path: "/api/apm/v1/logs/tail", method: "GET" },
      exportRaw: { path: "/api/apm/v1/export_raw_data", method: "POST" }
    }
  },
  "signoz-v4": {
    id: "signoz-v4",
    signals: ["metrics", "logs", "traces"],
    formulaServerSide: true,
    supportsServerFormula: true,
    queryModesBySignal: {
      metrics: ALL_MODES,
      logs: BUILDER_ONLY,
      traces: BUILDER_ONLY
    },
    isHealthy: defaultIsHealthy,
    endpoints: {
      metricsQuery: { path: "/api/v4/query_range", method: "POST" },
      logsQuery: { path: "/api/v4/query_range", method: "POST" },
      tracesQuery: { path: "/api/v4/query_range", method: "POST" },
      health: { path: "/api/v1/health", method: "GET" }
    }
  },
  "custom": {
    id: "custom",
    signals: [],
    formulaServerSide: false,
    supportsServerFormula: false,
    queryModesBySignal: { ...EMPTY_MODES },
    isHealthy: defaultIsHealthy,
    endpoints: {}
  }
};
function isV5WireProfile(id) {
  const p = String(id || "");
  return p === "signoz-v5";
}
function resolveSigNozProfile(options) {
  const id = String(options?.apiProfile || "signoz-v5");
  const base = SIGNOZ_PROFILES[id] || SIGNOZ_PROFILES["signoz-v3"];
  if (id !== "custom") {
    return {
      ...base,
      endpoints: { ...base.endpoints },
      queryModesBySignal: { ...base.queryModesBySignal },
      isHealthy: base.isHealthy || defaultIsHealthy
    };
  }
  const endpoints = {};
  if (options?.customMetricsPath)
    endpoints.metricsQuery = {
      path: options.customMetricsPath,
      method: "POST"
    };
  if (options?.customLogsPath)
    endpoints.logsQuery = { path: options.customLogsPath, method: "POST" };
  if (options?.customTracesPath)
    endpoints.tracesQuery = { path: options.customTracesPath, method: "POST" };
  if (options?.customAlertsPath)
    endpoints.alertsQuery = { path: options.customAlertsPath, method: "POST" };
  if (options?.customTraceByIdPath)
    endpoints.traceById = { path: options.customTraceByIdPath, method: "GET" };
  if (options?.customMetadataPath)
    endpoints.metadata = { path: options.customMetadataPath, method: "GET" };
  if (options?.customHealthPath)
    endpoints.health = { path: options.customHealthPath, method: "GET" };
  if (options?.customAcknowledgePath)
    endpoints.acknowledge = {
      path: options.customAcknowledgePath,
      method: "POST"
    };
  if (options?.customResolvePath)
    endpoints.resolve = { path: options.customResolvePath, method: "POST" };
  const signals = [];
  const queryModesBySignal = {
    metrics: [],
    logs: [],
    traces: []
  };
  if (endpoints.metricsQuery) {
    signals.push("metrics");
    queryModesBySignal.metrics = ALL_MODES;
  }
  if (endpoints.logsQuery) {
    signals.push("logs");
    queryModesBySignal.logs = BUILDER_ONLY;
  }
  if (endpoints.tracesQuery) {
    signals.push("traces");
    queryModesBySignal.traces = BUILDER_ONLY;
  }
  return {
    id: "custom",
    signals,
    formulaServerSide: false,
    supportsServerFormula: false,
    queryModesBySignal,
    isHealthy: defaultIsHealthy,
    endpoints
  };
}
function buildCustomHealthSignature(url, options) {
  const payload = {
    url: String(url || "").replace(/\/+$/, ""),
    apiProfile: options.apiProfile || "custom",
    credentialKind: options.credentialKind || "",
    credentialHeaderName: options.credentialHeaderName || "",
    fetchCredentials: options.fetchCredentials || "",
    customHealthPath: options.customHealthPath || "",
    customMetricsPath: options.customMetricsPath || "",
    customLogsPath: options.customLogsPath || "",
    customTracesPath: options.customTracesPath || "",
    customAlertsPath: options.customAlertsPath || "",
    customTraceByIdPath: options.customTraceByIdPath || "",
    customMetadataPath: options.customMetadataPath || "",
    customMetricsListPath: options.customMetricsListPath || "",
    customFieldsKeysPath: options.customFieldsKeysPath || "",
    customFieldsValuesPath: options.customFieldsValuesPath || "",
    customAcknowledgePath: options.customAcknowledgePath || "",
    customResolvePath: options.customResolvePath || ""
  };
  return JSON.stringify(payload);
}
function isSuccessfulActionResponse(status, data) {
  return defaultIsHealthy(status, data);
}
function normalizeStatus(raw) {
  if (raw == null || raw === "") return "unset";
  const s = String(raw).toLowerCase().trim();
  if (s === "ok" || s === "success" || s === "unset" || s === "0" || s === "status_code_unset" || s === "status_ok" || s === "statuscode.ok" || s === "status_code_ok") {
    if (s === "unset" || s === "0" || s === "status_code_unset") return "unset";
    return "ok";
  }
  if (s === "error" || s === "err" || s === "failed" || s === "1" || s === "2" || s === "status_code_error" || s === "status_error" || s === "statuscode.error") {
    return "error";
  }
  if (typeof raw === "number") {
    if (raw === 0) return "unset";
    if (raw === 1) return "ok";
    if (raw === 2) return "error";
  }
  return "unset";
}
function statusFor(t2) {
  if (t2.status != null && String(t2.status).trim() !== "") {
    return normalizeStatus(t2.status);
  }
  const errCount = Number(t2.errorCount ?? 0);
  if (Number.isFinite(errCount) && errCount > 0) return "error";
  if (t2.hasError === true || t2.hasError === 1 || t2.hasError === "true") {
    return "error";
  }
  return "ok";
}
function asRecord(v) {
  if (v == null) return {};
  if (typeof v === "object" && !Array.isArray(v)) {
    return { ...v };
  }
  if (typeof v === "string" && v.trim()) {
    try {
      const parsed = JSON.parse(v);
      if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
        return parsed;
      }
    } catch {
    }
  }
  return {};
}
function asObjectArray(v) {
  if (Array.isArray(v)) {
    return v.map((item) => {
      if (item && typeof item === "object" && !Array.isArray(item)) {
        return { ...item };
      }
      if (typeof item === "string") {
        try {
          const parsed = JSON.parse(item);
          if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
            return parsed;
          }
        } catch {
          return { value: item };
        }
      }
      return { value: item };
    });
  }
  if (typeof v === "string" && v.trim()) {
    try {
      const parsed = JSON.parse(v);
      if (Array.isArray(parsed)) return asObjectArray(parsed);
      if (parsed && typeof parsed === "object") {
        return [parsed];
      }
    } catch {
      return [];
    }
  }
  return [];
}
function pickString(...vals) {
  for (const v of vals) {
    if (v == null || v === "") continue;
    return String(v);
  }
  return "";
}
function toDurationNs(span) {
  const nano = span.durationNs ?? span.duration_nano ?? span.durationNano ?? span.duration_nanos;
  if (nano != null && nano !== "") {
    if (typeof nano === "bigint") return nano.toString();
    if (typeof nano === "number" && Number.isFinite(nano)) {
      return String(Math.trunc(nano));
    }
    const s = String(nano).trim();
    if (/^\d+$/.test(s)) return s;
  }
  const ms = span.durationMs ?? span.duration_ms ?? span.duration ?? span.latency;
  if (ms != null && ms !== "") {
    const n = Number(ms);
    if (Number.isFinite(n)) {
      if (n > 1e12) return String(Math.trunc(n));
      return String(Math.round(n * 1e6));
    }
  }
  return "0";
}
function coerceEpochMs(raw, unitHint) {
  if (raw == null || raw === "") return 0;
  if (typeof raw === "string" && /^\d+$/.test(raw)) {
    if (unitHint === "ms" || raw.length >= 12 && raw.length <= 13) {
      const n3 = Number(raw);
      return Number.isFinite(n3) ? n3 : 0;
    }
    if (unitHint === "ns" || raw.length >= 16) {
      const ms = Number(raw.slice(0, -6));
      return Number.isFinite(ms) ? ms : 0;
    }
    if (unitHint === "us" || raw.length === 14 || raw.length === 15) {
      const n3 = Number(raw);
      return Number.isFinite(n3) ? Math.floor(n3 / 1e3) : 0;
    }
    const n2 = Number(raw);
    if (!Number.isFinite(n2)) return 0;
    if (unitHint === "s" || n2 > 0 && n2 < 1e11) return Math.floor(n2 * 1e3);
    return n2;
  }
  const n = Number(raw);
  if (!Number.isFinite(n)) return 0;
  if (unitHint === "ms") return n;
  if (unitHint === "ns" || n > 1e16) return Math.floor(n / 1e6);
  if (unitHint === "us" || n > 1e14) return Math.floor(n / 1e3);
  if (unitHint === "s" || n > 0 && n < 1e11) return Math.floor(n * 1e3);
  return n;
}
function toStartTimeMs(span) {
  if (span.startTimeMs != null && span.startTimeMs !== "") {
    return coerceEpochMs(span.startTimeMs, "ms");
  }
  if (span.startTimeUnixNano != null || span.startTimeUnixNanoStr != null || span.startTimeNano != null) {
    return coerceEpochMs(
      span.startTimeUnixNano ?? span.startTimeUnixNanoStr ?? span.startTimeNano,
      "ns"
    );
  }
  const raw = span.startTime ?? span.start_time ?? span.timestamp ?? span.time_unix;
  return coerceEpochMs(raw);
}
function toDurationMsFromNs(durationNs) {
  if (!durationNs || !/^\d+$/.test(durationNs)) return 0;
  if (durationNs.length <= 6) return Number(durationNs) / 1e6;
  const whole = Number(durationNs.slice(0, -6));
  const frac = Number(durationNs.slice(-6)) / 1e6;
  return (Number.isFinite(whole) ? whole : 0) + (Number.isFinite(frac) ? frac : 0);
}
function normalizeSpan(raw) {
  const span = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
  const durationNs = toDurationNs(span);
  const tagsOrAttrs = span.attributes ?? span.tags ?? span.spanAttributes;
  const resource = span.resource ?? span.process ?? (span.process && typeof span.process === "object" ? span.process.tags : void 0);
  return {
    traceId: pickString(span.traceId, span.traceID, span.trace_id),
    spanId: pickString(span.spanId, span.span_id, span.id, span.spanID),
    parentSpanId: pickString(span.parentSpanId, span.parent_span_id, span.parentId, span.parent_id) || void 0,
    startTimeMs: toStartTimeMs(span),
    durationNs,
    durationMs: toDurationMsFromNs(durationNs),
    serviceName: pickString(
      span.serviceName,
      span.service,
      span.service_name,
      span.resource?.service?.name,
      span.resource?.["service.name"]
    ),
    operationName: pickString(span.operationName, span.name, span.operation, span.spanName),
    status: statusFor({
      status: span.status ?? (typeof span.statusCode !== "undefined" ? span.statusCode : span.status?.code),
      errorCount: span.errorCount ?? span.error_count,
      hasError: span.hasError ?? span.has_error
    }),
    resource: asRecord(resource),
    attributes: asRecord(tagsOrAttrs),
    events: asObjectArray(span.events ?? span.logs),
    links: asObjectArray(span.links),
    references: asObjectArray(span.references)
  };
}
function baseMeta(opts, semanticKind, extra = {}) {
  return {
    source: "signoz",
    preferredVisualisationType: semanticKind === "trace.detail" ? "trace" : "table",
    signal: "traces",
    requestType: "trace",
    ...opts.datasourceUid ? { datasourceUid: opts.datasourceUid } : {},
    ...opts.profile ? { profile: opts.profile } : {},
    ...opts.requestId ? { requestId: opts.requestId } : {},
    custom: {
      source: "signoz",
      signal: "traces",
      semanticKind,
      complete: true,
      truncated: false,
      ...opts.datasourceUid ? { datasourceUid: opts.datasourceUid } : {},
      ...opts.profile ? { profile: opts.profile } : {},
      ...opts.requestId ? { requestId: opts.requestId } : {}
    },
    ...opts.warnings?.length ? { warnings: opts.warnings } : {},
    ...extra
  };
}
function spansToDetailFrame(spans, opts, extraMeta = {}) {
  return createDataFrame({
    refId: opts.refId,
    name: "trace",
    meta: baseMeta(opts, "trace.detail", extraMeta),
    fields: [
      { name: "traceId", type: "string", values: spans.map((s) => s.traceId) },
      { name: "spanId", type: "string", values: spans.map((s) => s.spanId) },
      {
        name: "parentSpanId",
        type: "string",
        values: spans.map((s) => s.parentSpanId ?? "")
      },
      {
        name: "operationName",
        type: "string",
        values: spans.map((s) => s.operationName)
      },
      // Grafana TraceView also reads `name`
      {
        name: "name",
        type: "string",
        values: spans.map((s) => s.operationName)
      },
      {
        name: "serviceName",
        type: "string",
        values: spans.map((s) => s.serviceName)
      },
      {
        name: "service",
        type: "string",
        values: spans.map((s) => s.serviceName)
      },
      {
        name: "startTimeMs",
        type: "number",
        values: spans.map((s) => s.startTimeMs)
      },
      {
        name: "startTime",
        type: "number",
        values: spans.map((s) => s.startTimeMs)
      },
      {
        name: "durationNs",
        type: "string",
        values: spans.map((s) => s.durationNs)
      },
      {
        name: "durationMs",
        type: "number",
        values: spans.map((s) => s.durationMs)
      },
      {
        name: "duration",
        type: "number",
        values: spans.map((s) => s.durationMs)
      },
      {
        name: "status",
        type: "string",
        values: spans.map((s) => s.status)
      },
      {
        name: "resource",
        type: "other",
        values: spans.map((s) => s.resource)
      },
      {
        name: "attributes",
        type: "other",
        values: spans.map((s) => s.attributes)
      },
      {
        name: "events",
        type: "other",
        values: spans.map((s) => s.events)
      },
      {
        name: "links",
        type: "other",
        values: spans.map((s) => s.links)
      },
      {
        name: "references",
        type: "other",
        values: spans.map((s) => s.references)
      }
    ]
  });
}
function unwrapSearchRow(raw) {
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
  const obj = raw;
  if (obj.data && typeof obj.data === "object" && !Array.isArray(obj.data)) {
    const data = obj.data;
    const { data: _drop, ...rest } = obj;
    return { ...data, ...rest };
  }
  return { ...obj };
}
function normalizeSearchRow(raw) {
  const t2 = unwrapSearchRow(raw);
  const durationNs = toDurationNs({
    durationNano: t2.durationNano,
    duration_nano: t2.duration_nano,
    durationNs: t2.durationNs,
    durationMs: t2.durationMs ?? t2.duration,
    duration: t2.durationNano ?? t2.duration_nano ?? t2.duration
  });
  let ns = durationNs;
  if (t2.durationNano != null || t2.duration_nano != null) {
    const v = t2.durationNano ?? t2.duration_nano;
    ns = typeof v === "bigint" ? v.toString() : String(v);
  }
  return {
    traceId: pickString(t2.traceId, t2.traceID, t2.trace_id),
    serviceName: pickString(
      t2.rootServiceName,
      t2.serviceName,
      t2.service,
      t2.rootService,
      t2["service.name"],
      t2.resource?.["service.name"],
      t2.resource?.service?.name
    ),
    operationName: pickString(t2.rootTraceName, t2.name, t2.operationName, t2.operation),
    durationNs: ns,
    durationMs: toDurationMsFromNs(ns),
    spanCount: Number(t2.spanCount ?? t2.span_count ?? 0) || 0,
    status: statusFor({
      status: t2.status,
      errorCount: t2.errorCount ?? t2.error_count,
      hasError: t2.hasError
    }),
    startTimeMs: toStartTimeMs(t2)
  };
}
function searchRowsToFrame(rows, opts) {
  return createDataFrame({
    refId: opts.refId,
    name: "traces",
    meta: baseMeta(opts, "trace.search", {
      ...opts.nextCursor != null ? { nextCursor: opts.nextCursor } : {}
    }),
    fields: [
      { name: "traceId", type: "string", values: rows.map((r) => r.traceId) },
      {
        name: "service",
        type: "string",
        values: rows.map((r) => r.serviceName)
      },
      {
        name: "serviceName",
        type: "string",
        values: rows.map((r) => r.serviceName)
      },
      {
        name: "operation",
        type: "string",
        values: rows.map((r) => r.operationName)
      },
      {
        name: "operationName",
        type: "string",
        values: rows.map((r) => r.operationName)
      },
      {
        name: "durationNs",
        type: "string",
        values: rows.map((r) => r.durationNs)
      },
      {
        name: "duration",
        type: "number",
        values: rows.map((r) => r.durationMs)
      },
      {
        name: "durationMs",
        type: "number",
        values: rows.map((r) => r.durationMs)
      },
      {
        name: "spanCount",
        type: "number",
        values: rows.map((r) => r.spanCount)
      },
      { name: "status", type: "string", values: rows.map((r) => r.status) },
      {
        name: "startTimeMs",
        type: "number",
        values: rows.map((r) => r.startTimeMs)
      }
    ]
  });
}
function extractSpanList(body) {
  if (body == null) return [];
  if (Array.isArray(body)) return body;
  if (typeof body !== "object") return [];
  const b = body;
  const data = b.data && typeof b.data === "object" ? b.data : void 0;
  const candidates = [
    b.spans,
    data?.spans,
    data?.data?.spans,
    b.list,
    data?.list,
    b.results
  ];
  for (const c of candidates) {
    if (Array.isArray(c) && c.length) {
      if (c[0] && typeof c[0] === "object" && !Array.isArray(c[0])) {
        const first = c[0];
        if (Array.isArray(first.spans)) {
          const all = [];
          for (const r of c) {
            const spans = r?.spans;
            if (Array.isArray(spans)) all.push(...spans);
          }
          if (all.length) return all;
        }
        if (Array.isArray(first.list) || Array.isArray(first.traces)) {
          return [];
        }
        if (first.spanId || first.span_id || first.traceId || first.traceID) {
          return c;
        }
      } else {
        return c;
      }
    }
  }
  return [];
}
function extractSearchRows(results) {
  const rows = [];
  for (const r of results) {
    if (r == null) continue;
    if (Array.isArray(r)) {
      for (const item of r) rows.push(unwrapSearchRow(item));
      continue;
    }
    if (typeof r !== "object") continue;
    const obj = r;
    const list = obj.list ?? obj.traces ?? obj.rows;
    if (Array.isArray(list)) {
      for (const item of list) rows.push(unwrapSearchRow(item));
    } else if (obj.traceId || obj.traceID || obj.trace_id || obj.data && typeof obj.data === "object" && (obj.data.traceId || obj.data.traceID || obj.data.trace_id)) {
      rows.push(unwrapSearchRow(obj));
    }
  }
  return rows;
}
function isTraceSearchResult(result) {
  if (result == null) return false;
  if (Array.isArray(result)) {
    return result.some((item) => isTraceSearchResult(item));
  }
  if (typeof result !== "object") return false;
  const obj = result;
  if (Array.isArray(obj.list) || Array.isArray(obj.traces)) return true;
  if (Array.isArray(obj.spans) && obj.spans.length) return false;
  if (Array.isArray(obj.rows)) {
    if (!obj.rows.length) return true;
    const sample = unwrapSearchRow(obj.rows[0]);
    return Boolean(
      sample.traceId || sample.traceID || sample.trace_id || sample.spanCount != null || sample.span_count != null || sample["service.name"] != null || sample.rootServiceName != null || sample.rootTraceName != null
    );
  }
  return Boolean(obj.traceId || obj.traceID || obj.trace_id);
}
function mapTraceDetailBody(body, opts, options) {
  const list = extractSpanList(body);
  if (!list.length) {
    if (body != null && typeof body === "object") {
      const keys = Object.keys(body);
      if (keys.length === 0) {
        return [spansToDetailFrame([], opts, { empty: true })];
      }
      const b = body;
      if (Array.isArray(b.spans) || Array.isArray(b?.data?.spans) || Array.isArray(b?.data?.data?.spans)) {
        return [spansToDetailFrame([], opts, { empty: true })];
      }
      throw new DataSourceError("INVALID_RESPONSE", "无法解析 trace detail 响应：缺少 spans", {
        bodyKeys: keys
      });
    }
    throw new DataSourceError("INVALID_RESPONSE", "无法解析 trace detail 响应：payload 为空");
  }
  const spans = list.map((s) => normalizeSpan(s));
  if (!spans.some((s) => s.spanId || s.traceId)) {
    throw new DataSourceError(
      "INVALID_RESPONSE",
      "无法解析 trace detail 响应：span 缺少 traceId/spanId"
    );
  }
  const payload = body && typeof body === "object" ? body.data && typeof body.data === "object" ? body.data : body : {};
  return [
    spansToDetailFrame(spans, opts, {
      rootService: opts.rootService ?? payload?.rootService,
      entryPoint: opts.entryPoint ?? payload?.entryPoint,
      totalCount: opts.totalCount ?? payload?.totalCount ?? spans.length,
      errorCount: opts.errorCount ?? payload?.errorCount,
      hasMore: opts.hasMore ?? payload?.hasMore
    })
  ];
}
function mapTraceSearchResults(results, opts) {
  const rawRows = extractSearchRows(results);
  const rows = rawRows.map((r) => normalizeSearchRow(r));
  return [searchRowsToFrame(rows, opts)];
}
function normalizeTraceFrames(frames) {
  return (frames ?? []).map((frame) => {
    const meta2 = { ...frame.meta || {} };
    const custom = {
      ...meta2.custom && typeof meta2.custom === "object" ? meta2.custom : {}
    };
    const name = String(frame.name || "").toLowerCase();
    const viz = String(meta2.preferredVisualisationType || "").toLowerCase();
    let semanticKind = custom.semanticKind || meta2.semanticKind;
    if (!semanticKind) {
      if (viz === "trace" || name === "trace") semanticKind = "trace.detail";
      else semanticKind = "trace.search";
    }
    custom.semanticKind = semanticKind;
    custom.signal = custom.signal ?? "traces";
    custom.source = custom.source ?? "signoz";
    meta2.custom = custom;
    meta2.signal = meta2.signal ?? "traces";
    if (semanticKind === "trace.detail" && !meta2.preferredVisualisationType) {
      meta2.preferredVisualisationType = "trace";
    }
    const fields = frame.fields.map((f) => {
      if (f.name === "events" || f.name === "links" || f.name === "references" || f.name === "attributes" || f.name === "resource") {
        const values = f.values.map((v) => {
          if (typeof v === "string") {
            if (f.name === "events" || f.name === "links" || f.name === "references") {
              return asObjectArray(v);
            }
            return asRecord(v);
          }
          return v;
        });
        return { ...f, type: "other", values };
      }
      return f;
    });
    return {
      ...frame,
      meta: meta2,
      fields,
      length: fields.reduce((m, f) => Math.max(m, f.values?.length ?? 0), 0)
    };
  });
}
function liveMeta(extra = {}, datasourceUid) {
  return {
    source: "live",
    ...{},
    ...extra
  };
}
function labelsToRecord(labels) {
  const out = {};
  if (!Array.isArray(labels)) return out;
  for (const l of labels) {
    const name = String(l?.key?.name ?? l?.name ?? "").trim();
    if (!name) continue;
    out[name] = String(l?.value ?? "");
  }
  return out;
}
function seriesName(labels, legend, fallback = "Value") {
  if (legend && legend.includes("{{")) {
    return legend.replaceAll(/\{\{\s*([\w.-]+)\s*\}\}/g, (_, k) => labels[k] ?? "");
  }
  if (legend) return legend;
  const pairs = Object.entries(labels);
  if (!pairs.length) return fallback;
  return pairs.map(([k, v]) => `${k}=${v}`).join(", ");
}
function mapSignozV5AggResponse(body, opts) {
  const results = body?.data?.results ?? body?.results ?? [];
  if (!Array.isArray(results) || !results.length) {
    return [
      createDataFrame({
        refId: opts.refId,
        name: opts.signal || "metrics",
        meta: liveMeta({
          preferredVisualisationType: "graph",
          apiProfile: "signoz-v5"
        }),
        fields: [
          { name: "Time", type: "time", values: [] },
          { name: "Value", type: "number", values: [] }
        ]
      })
    ];
  }
  const frames = [];
  for (const result of results) {
    const aggs = result?.aggregations ?? [];
    for (const bucket of aggs) {
      const seriesList2 = bucket?.series ?? [];
      for (const s of seriesList2) {
        const labels = labelsToRecord(s?.labels);
        const pts = Array.isArray(s?.values) ? s.values : [];
        const times = pts.map((p) => {
          const t2 = Number(p?.timestamp ?? p?.[0] ?? 0);
          return t2 > 0 && t2 < 1e12 ? t2 * 1e3 : t2;
        });
        const values = pts.map((p) => {
          const raw = p?.value ?? p?.[1];
          if (raw == null || raw === "NaN") return null;
          const n = Number(raw);
          return Number.isFinite(n) ? n : null;
        });
        const name = seriesName(
          labels,
          opts.legendFormat,
          String(bucket?.alias || result?.queryName || "Value")
        );
        frames.push(
          createDataFrame({
            refId: opts.refId,
            name,
            meta: liveMeta({
              preferredVisualisationType: "graph",
              apiProfile: "signoz-v5",
              labels
            }),
            fields: [
              { name: "Time", type: "time", values: times },
              {
                name: "Value",
                type: "number",
                values,
                labels,
                config: { displayNameFromDS: name }
              }
            ]
          })
        );
      }
    }
    let seriesList = result?.series ?? [];
    if (!Array.isArray(seriesList)) seriesList = [];
    for (const s of seriesList) {
      const labels = labelsToRecord(s?.labels);
      const pts = Array.isArray(s?.values) ? s.values : [];
      const times = pts.map((p) => {
        const t2 = Number(p?.timestamp ?? p?.[0] ?? 0);
        return t2 > 0 && t2 < 1e12 ? t2 * 1e3 : t2;
      });
      const values = pts.map((p) => {
        const raw = p?.value ?? p?.[1];
        if (raw == null || raw === "NaN") return null;
        const n = Number(raw);
        return Number.isFinite(n) ? n : null;
      });
      const name = seriesName(labels, opts.legendFormat, String(result?.queryName || "Value"));
      frames.push(
        createDataFrame({
          refId: opts.refId,
          name,
          meta: liveMeta({
            preferredVisualisationType: "graph",
            apiProfile: "signoz-v5",
            labels
          }),
          fields: [
            { name: "Time", type: "time", values: times },
            {
              name: "Value",
              type: "number",
              values,
              labels,
              config: { displayNameFromDS: name }
            }
          ]
        })
      );
    }
  }
  if (frames.length) return frames;
  return [
    createDataFrame({
      refId: opts.refId,
      name: opts.signal || "metrics",
      meta: liveMeta({
        preferredVisualisationType: "table",
        apiProfile: "signoz-v5",
        empty: true,
        notices: [
          {
            severity: "warning",
            text: "signoz response produced no series; full body not truncated-inlined"
          }
        ]
      }),
      fields: [
        { name: "Time", type: "time", values: [] },
        { name: "Value", type: "number", values: [] }
      ]
    })
  ];
}
function parsePointTime(p) {
  if (Array.isArray(p)) {
    const t22 = Number(p[0]);
    return t22 > 0 && t22 < 1e12 ? t22 * 1e3 : t22;
  }
  const t2 = Number(p?.timestamp ?? p?.ts ?? p?.time ?? 0);
  return t2 > 0 && t2 < 1e12 ? t2 * 1e3 : t2;
}
function parsePointValue(p) {
  const raw = Array.isArray(p) ? p[1] : p?.value ?? p?.v;
  if (raw == null || raw === "NaN") return null;
  const n = Number(raw);
  return Number.isFinite(n) ? n : null;
}
function labelsFromUnknown(raw) {
  const labels = {};
  if (!raw) return labels;
  if (Array.isArray(raw)) {
    for (const item of raw) {
      const key = item?.key?.name ?? item?.key ?? item?.name;
      if (key == null) continue;
      if (String(key) === "__name__") continue;
      labels[String(key)] = String(item?.value ?? "");
    }
    return labels;
  }
  if (typeof raw === "object") {
    for (const [k, v] of Object.entries(raw)) {
      if (k === "__name__") continue;
      labels[k] = String(v);
    }
  }
  return labels;
}
function mapSignozV3Response(body, opts) {
  const resultList = body?.data?.result ?? body?.data?.results ?? body?.result;
  if (Array.isArray(resultList) && resultList.length === 0) {
    return [
      createDataFrame({
        refId: opts.refId,
        name: opts.signal || "metrics",
        meta: liveMeta({
          preferredVisualisationType: "graph",
          apiProfile: "signoz-v3",
          empty: true
        }),
        fields: [
          { name: "Time", type: "time", values: [] },
          { name: "Value", type: "number", values: [] }
        ]
      })
    ];
  }
  const result = body?.data?.result ?? body?.data?.data?.result ?? body?.result;
  if (Array.isArray(result) && result.length) {
    const frames = [];
    for (const [idx, entry] of result.entries()) {
      if (Array.isArray(entry?.series)) {
        for (const s of entry.series) {
          const labels2 = labelsFromUnknown(s?.labels ?? s?.labelsArray ?? entry?.metric);
          const pts = Array.isArray(s?.values) ? s.values : [];
          const times2 = pts.map(parsePointTime);
          const values2 = pts.map(parsePointValue);
          const baseName = entry.queryName && String(entry.queryName) || labels2.__name__ || `series ${idx}`;
          const name2 = seriesName(labels2, opts.legendFormat, baseName);
          frames.push(
            createDataFrame({
              refId: opts.refId,
              name: name2,
              meta: liveMeta({
                preferredVisualisationType: "graph",
                apiProfile: "signoz-v3",
                labels: labels2
              }),
              fields: [
                { name: "Time", type: "time", values: times2 },
                {
                  name: "Value",
                  type: "number",
                  values: values2,
                  labels: labels2,
                  config: { displayNameFromDS: name2 }
                }
              ]
            })
          );
        }
        continue;
      }
      const metric = entry.metric || entry.labels || {};
      const labels = labelsFromUnknown(metric);
      const name = seriesName(labels, opts.legendFormat, metric.__name__ || `series ${idx}`);
      let times = [];
      let values = [];
      if (entry.values) {
        times = entry.values.map(parsePointTime);
        values = entry.values.map(parsePointValue);
      } else if (entry.value) {
        times = [parsePointTime(entry.value)];
        values = [parsePointValue(entry.value)];
      }
      frames.push(
        createDataFrame({
          refId: opts.refId,
          name,
          meta: liveMeta({
            preferredVisualisationType: "graph",
            apiProfile: "signoz-v3",
            labels
          }),
          fields: [
            { name: "Time", type: "time", values: times },
            {
              name: "Value",
              type: "number",
              values,
              labels,
              config: { displayNameFromDS: name }
            }
          ]
        })
      );
    }
    if (frames.length) return frames;
  }
  throw new DataSourceError(
    "UNSUPPORTED_RESPONSE_SHAPE",
    `无法映射 time_series/legacy body; schema=${schemaSummary(body)}`
  );
}
function mapSignozResponse(body, profileId, opts) {
  const isNative = profileId.startsWith("signoz") || profileId === "prometheus-compatible";
  const profileShape = isNative ? "native" : "custom";
  if (profileId === "custom" && body == null) {
    throw new DataSourceError("UNSUPPORTED_RESPONSE_SHAPE", "custom profile empty body");
  }
  const strictV5 = isV5WireProfile(profileId);
  let envelope;
  try {
    envelope = extractSignozEnvelope(body, profileShape === "custom" ? "native" : profileShape, {
      strictV5: strictV5 && !body?.data?.resultType
    });
  } catch (error) {
    if (body?.data?.resultType || body?.data?.result) {
      return mapSignozV3Response(body, opts);
    }
    const signal = String(opts.signal || "").toLowerCase();
    if (signal === "logs" || signal === "traces" || body && typeof body === "object" && (Array.isArray(body.logs) || Array.isArray(body.traces) || Array.isArray(body.rows))) {
      return mapRawResponse(body, opts);
    }
    throw error;
  }
  const type = (opts.requestType || envelope.type || "").toLowerCase() || envelope.type;
  const warnings = envelope.warning;
  if (type === "distribution" || envelope.type === "distribution") {
    return mapDistributionResponse(envelope.results, {
      ...opts,
      experimentalDistribution: opts.experimentalDistribution
    });
  }
  if (type === "scalar" || envelope.type === "scalar") {
    return mapScalarResponse(envelope.results, { ...opts, warnings });
  }
  if (type === "raw_stream" || envelope.type === "raw_stream") {
    return mapRawStreamResponse(envelope.results, { ...opts, warnings });
  }
  if (type === "raw" || envelope.type === "raw" || opts.signal === "logs") {
    if (envelope.type === "raw" || type === "raw") {
      return mapRawRows(envelope.results, { ...opts, warnings });
    }
  }
  const envelopeIsAggregation = envelope.type === "time_series";
  if ((type === "trace" || envelope.type === "trace" || opts.signal === "traces") && !envelopeIsAggregation) {
    const looksLikeSearch = !envelope.results.length || envelope.results.some(
      (r) => isTraceSearchResult(r) || Array.isArray(r?.list) || Array.isArray(r?.traces) || Array.isArray(r?.rows)
    );
    const looksLikeDetail = envelope.results.some(
      (r) => Array.isArray(r?.spans) && r.spans.length
    );
    if (looksLikeSearch && !looksLikeDetail) {
      return mapTraceList(envelope.results, opts, warnings);
    }
    return mapTraceDetail(body, opts);
  }
  const hasAggSeries = (envelope.results || []).some(
    (r) => Array.isArray(r?.aggregations) || Array.isArray(r?.series)
  );
  if (hasAggSeries && (envelope.type === "time_series" || type === "time_series")) {
    return mapSignozV5AggResponse(
      {
        status: envelope.status || "success",
        data: { results: envelope.results }
      },
      { ...opts, signal: opts.signal || "metrics" }
    );
  }
  if (body?.data?.resultType || body?.data?.result) return mapSignozV3Response(body, opts);
  if (envelope.type === "time_series" || type === "time_series") {
    const asV3 = {
      status: envelope.status || "success",
      data: {
        resultType: "matrix",
        result: envelope.results
      }
    };
    return mapSignozV3Response(asV3, opts);
  }
  if (envelope.type === "unknown" && !envelope.results.length) {
    return [
      createDataFrame({
        refId: opts.refId,
        name: opts.signal || "empty",
        meta: liveMeta({ source: "live", empty: true, warnings }),
        fields: [
          { name: "Time", type: "time", values: [] },
          { name: "Value", type: "number", values: [] }
        ]
      })
    ];
  }
  throw new DataSourceError(
    "UNSUPPORTED_RESPONSE_SHAPE",
    `unknown result type=${envelope.type}; schema=${envelope.schemaSummary || schemaSummary(body)}`
  );
}
function mapTraceDetail(body, opts) {
  return normalizeTraceFrames(
    mapTraceDetailBody(body, {
      refId: opts.refId,
      datasourceUid: opts.datasourceUid,
      profile: opts.profile,
      requestId: opts.requestId
    })
  );
}
function mapTraceList(results, opts, warnings) {
  return normalizeTraceFrames(
    mapTraceSearchResults(results, {
      refId: opts.refId,
      datasourceUid: opts.datasourceUid,
      profile: opts.profile,
      requestId: opts.requestId,
      warnings,
      nextCursor: results[0]?.nextCursor
    })
  );
}
function mapAndNormalizeSignozResponse(body, profileIdOrOpts = {}, maybeOpts = {}) {
  let profileId = "signoz-v5";
  let opts = {};
  if (typeof profileIdOrOpts === "string") {
    profileId = profileIdOrOpts;
    opts = maybeOpts ?? {};
  } else {
    opts = profileIdOrOpts ?? {};
    profileId = opts.profileId || opts.profile || "signoz-v5";
  }
  const frames = mapSignozResponse(body, profileId, {
    refId: opts.refId || "A",
    legendFormat: opts.legendFormat,
    signal: opts.signal,
    requestType: opts.requestType,
    datasourceUid: opts.datasourceUid,
    profile: opts.profile || profileId,
    requestId: opts.requestId,
    experimentalDistribution: opts.experimentalDistribution
  });
  return normalizeDataFrames(frames, {
    refId: opts.refId,
    source: "signoz",
    datasourceUid: opts.datasourceUid,
    profile: opts.profile || profileId,
    signal: opts.signal,
    requestId: opts.requestId
  });
}
function defaultBuilderSpec(name = "A", signal = "traces", opts) {
  const forceMetrics = opts?.forceMetricsHost || signal === "metrics";
  const effective = forceMetrics ? "metrics" : signal;
  const aggregations = effective === "metrics" ? [
    {
      kind: "metric",
      metricName: "",
      timeAggregation: "rate",
      spaceAggregation: "sum"
    }
  ] : [{ kind: "expression", expression: "count()" }];
  return {
    name,
    signal: effective,
    source: void 0,
    stepInterval: 60,
    tags: [],
    disabled: false,
    filter: { expression: "" },
    having: { expression: "" },
    groupBy: [],
    // Aggregation requestTypes (default time_series) reject order-by timestamp.
    // List/raw panels set order via add-ons; wire also re-adds defaults when needed.
    order: [],
    limit: 100,
    legend: "",
    functions: [],
    aggregations
  };
}
function defaultAggregationsForSignal(signal) {
  if (signal === "metrics") {
    return [
      {
        kind: "metric",
        metricName: "",
        timeAggregation: "rate",
        spaceAggregation: "sum"
      }
    ];
  }
  return [{ kind: "expression", expression: "count()" }];
}
function defaultPromItem(name = "A", expr = "") {
  return {
    type: "builder_query",
    queryType: "promql",
    spec: defaultBuilderSpec(name, "metrics"),
    rawQuery: expr,
    rawLegend: ""
  };
}
const DEFAULT_SIGNOZ_QUERY = {
  refId: "A",
  schema: 1,
  apiProfile: "signoz-v5",
  requestType: "time_series",
  queries: [
    {
      type: "builder_query",
      queryType: "builder",
      spec: defaultBuilderSpec("A", "traces")
    }
  ],
  signal: "traces",
  expr: "",
  legendFormat: "",
  limit: 100,
  formatOptions: { fillGaps: false, formatTableResultForUI: false }
};
const DEFAULT_SIGNOZ_OPTIONS = {
  schema: 1,
  apiProfile: "signoz-v5",
  timeout: 3e4,
  metadataCacheTTL: "5m",
  rawPageSize: 100,
  liveTailIntervalMs: 2e3,
  maxConcurrentRequests: 4,
  credentialKind: "signozApiKey",
  credentialHeaderName: "SIGNOZ-API-KEY",
  fetchCredentials: "omit",
  customHealthOk: false,
  customHealthSignature: "",
  dataMode: "live"
};
const STABLE_FUNCTIONS = [
  "cutOffMin",
  "cutOffMax",
  "clampMin",
  "clampMax",
  "absolute",
  "runningDiff",
  "log2",
  "log10",
  "cumulativeSum",
  "ewma3",
  "ewma5",
  "ewma7",
  "median3",
  "median5",
  "median7",
  "timeShift",
  "fillZero"
];
const FUNCTION_ARG_NAMES = {
  cutOffMin: ["threshold"],
  cutOffMax: ["threshold"],
  clampMin: ["threshold"],
  clampMax: ["threshold"],
  timeShift: ["shift"],
  absolute: [],
  runningDiff: [],
  log2: [],
  log10: [],
  cumulativeSum: [],
  ewma3: [],
  ewma5: [],
  ewma7: [],
  median3: [],
  median5: [],
  median7: [],
  fillZero: [],
  anomaly: []
};
function normalizeFunctionArgs(name, args) {
  const names = FUNCTION_ARG_NAMES[name] || [];
  const list = Array.isArray(args) ? args : [];
  return list.map((a, i) => {
    if (a != null && typeof a === "object" && "value" in a) {
      const val = String(a.value ?? "");
      const n = a.name != null && String(a.name) !== "" ? String(a.name) : names[i] || (names.length === 1 ? names[0] : `arg${i}`);
      return { name: n, value: val };
    }
    return {
      name: names[i] || (names.length === 1 ? names[0] : `arg${i}`),
      value: String(a ?? "")
    };
  });
}
function resolveEditorCapabilities(args) {
  const id = String(args.profile.id);
  const exp = args.options?.experimentalCapabilities || {};
  const product = id === "signoz-v5" || id === "signoz-v4" || id === "signoz-v3";
  return {
    builder: product || id === "custom",
    formula: product || id === "custom",
    promql: true,
    clickhouseSql: product || id === "custom",
    traceOperator: product,
    subQuery: Boolean(exp.builderSubQuery),
    join: Boolean(exp.builderJoin),
    anomaly: Boolean(exp.anomaly),
    distribution: Boolean(exp.distribution),
    alerts: Boolean(args.profile.endpoints.alertsQuery?.path) || product
  };
}
function allowedRequestTypes(caps2) {
  const list = ["time_series", "scalar", "raw", "raw_stream", "trace"];
  if (caps2.distribution) list.push("distribution");
  return list;
}
function validateSavedItem(item, caps2) {
  if (item.type === "builder_sub_query" && !caps2.subQuery) {
    return {
      ok: false,
      message: "builder_sub_query 当前不可用（缺少 capability VERIFIED）"
    };
  }
  if (item.type === "builder_join" && !caps2.join) {
    return {
      ok: false,
      message: "builder_join 当前不可用（缺少 capability VERIFIED）"
    };
  }
  if (item.type === "builder_trace_operator" && !caps2.traceOperator) {
    return { ok: false, message: "builder_trace_operator 当前 profile 不支持" };
  }
  if (item.type === "builder_query" && item.spec.functions?.length) {
    for (const fn of item.spec.functions) {
      if (fn.name === "anomaly" && !caps2.anomaly) {
        return {
          ok: false,
          message: "anomaly 函数当前不可用（缺少 capability VERIFIED）"
        };
      }
      if (fn.name !== "anomaly" && !STABLE_FUNCTIONS.includes(fn.name)) {
        return { ok: false, message: `函数 ${fn.name} 当前 profile 不支持` };
      }
    }
  }
  return { ok: true };
}
function deepClone$3(v) {
  try {
    return structuredClone(v);
  } catch {
    return JSON.parse(JSON.stringify(v));
  }
}
function migrateLimitBy(raw, fallbackLimit) {
  if (raw == null) return void 0;
  if (Array.isArray(raw)) {
    const keys = raw.map((x) => typeof x === "string" ? x : x?.key).filter((k) => Boolean(k));
    if (!keys.length) return void 0;
    const firstVal = raw[0] && typeof raw[0] === "object" ? raw[0].value : void 0;
    const value = firstVal != null && firstVal !== "" ? Number(firstVal) : fallbackLimit != null ? Number(fallbackLimit) : 10;
    return { keys, value: Number.isFinite(value) ? value : 10 };
  }
  if (typeof raw === "object" && Array.isArray(raw.keys)) {
    const keys = raw.keys.map(String).filter(Boolean);
    if (!keys.length) return void 0;
    const value = raw.value != null ? Number(raw.value) : fallbackLimit != null ? Number(fallbackLimit) : void 0;
    return {
      keys,
      value: value != null && Number.isFinite(value) ? value : void 0
    };
  }
  return void 0;
}
function migrateJoinOn(raw) {
  if (raw == null) return "";
  if (typeof raw === "string") return raw;
  if (Array.isArray(raw)) {
    return raw.map((p) => {
      const l = p?.left ?? p?.l ?? "";
      const r = p?.right ?? p?.r ?? l;
      if (!l && !r) return "";
      return `${l} = ${r}`;
    }).filter(Boolean).join(" AND ");
  }
  return String(raw);
}
function migrateBuilderSpec(spec) {
  if (!spec || typeof spec !== "object") return spec;
  const next = { ...spec };
  if (next.functions) {
    next.functions = next.functions.map((f) => ({
      name: f.name,
      args: normalizeFunctionArgs(String(f.name || ""), f.args)
    }));
  }
  if (next.limitBy != null) {
    next.limitBy = migrateLimitBy(next.limitBy, next.limit);
  }
  return next;
}
function migrateQueryItem(item) {
  if (!item || typeof item !== "object") return item;
  if (item.type === "builder_query" && item.spec) {
    return { ...item, spec: migrateBuilderSpec(item.spec) };
  }
  if (item.type === "builder_join" && item.spec) {
    return {
      ...item,
      spec: {
        ...item.spec,
        on: migrateJoinOn(item.spec.on)
      }
    };
  }
  return item;
}
function migrateSigNozQuery(input) {
  const src = deepClone$3(input);
  if (Array.isArray(src.queries) && src.queries.length) {
    const queries2 = src.queries.map(migrateQueryItem);
    return {
      ...DEFAULT_SIGNOZ_QUERY,
      ...src,
      schema: 1,
      queries: queries2
    };
  }
  const signal = String(src.signal || "metrics");
  const expr = String(src.expr || src.query || "");
  const formula = String(src.formula || "");
  const name = String(src.refId || "A");
  const queries = [];
  if (formula) {
    queries.push({
      type: "builder_formula",
      spec: {
        name: "F1",
        expression: formula,
        disabled: false,
        legend: "",
        order: []
      }
    });
  }
  if (signal === "metrics" || !signal) {
    queries.unshift(defaultPromItem(name, expr));
  } else {
    const spec = defaultBuilderSpec(
      name,
      signal === "logs" || signal === "traces" ? signal : "metrics"
    );
    spec.service = src.service != null ? String(src.service) : void 0;
    spec.operation = src.operation != null ? String(src.operation) : void 0;
    spec.limit = src.limit != null ? Number(src.limit) : void 0;
    spec.legend = String(src.legendFormat || "");
    queries.unshift({
      type: "builder_query",
      queryType: "builder",
      spec,
      rawQuery: expr,
      rawLegend: String(src.legendFormat || "")
    });
  }
  return {
    refId: String(src.refId || "A"),
    hide: Boolean(src.hide),
    datasource: src.datasource,
    schema: 1,
    apiProfile: src.apiProfile || DEFAULT_SIGNOZ_QUERY.apiProfile,
    queries: queries.map(migrateQueryItem),
    signal,
    expr,
    service: src.service != null ? String(src.service) : void 0,
    operation: src.operation != null ? String(src.operation) : void 0,
    formula: formula || void 0,
    legendFormat: src.legendFormat != null ? String(src.legendFormat) : "",
    limit: src.limit != null ? Number(src.limit) : 100
  };
}
function migrateSigNozConfig(input) {
  const src = deepClone$3(input);
  let profile = String(src.apiProfile || DEFAULT_SIGNOZ_OPTIONS.apiProfile);
  if (!SIGNOZ_PROFILES[profile]) profile = "signoz-v5";
  let timeout = Number(src.timeout ?? DEFAULT_SIGNOZ_OPTIONS.timeout);
  if (!Number.isFinite(timeout) || timeout <= 0) timeout = DEFAULT_SIGNOZ_OPTIONS.timeout;
  if (typeof src.timeout === "string")
    timeout = Number(src.timeout) || DEFAULT_SIGNOZ_OPTIONS.timeout;
  const cacheTTL = String(
    src.metadataCacheTTL || src.cacheTTL || DEFAULT_SIGNOZ_OPTIONS.metadataCacheTTL
  );
  const options = {
    ...DEFAULT_SIGNOZ_OPTIONS,
    ...src,
    schema: 1,
    apiProfile: profile,
    timeout,
    metadataCacheTTL: cacheTTL,
    credentialKind: src.credentialKind || "bearer",
    customHealthOk: Boolean(src.customHealthOk),
    customHealthSignature: String(src.customHealthSignature || "")
  };
  if (options.apiProfile === "custom") {
    const url = String(src.url || "");
    const sig = buildCustomHealthSignature(url, options);
    if (options.customHealthOk && options.customHealthSignature !== sig) {
      options.customHealthOk = false;
    }
    const resolved = resolveSigNozProfile(options);
    if (!resolved.signals.length) {
      options.customHealthOk = false;
    }
  }
  return options;
}
function stableSerialize(value) {
  if (value === void 0) return "undefined";
  if (value === null || typeof value !== "object") return JSON.stringify(value);
  if (Array.isArray(value)) return `[${value.map(stableSerialize).join(",")}]`;
  const obj = value;
  const keys = Object.keys(obj).filter((k) => obj[k] !== void 0).sort();
  return `{${keys.map((k) => `${JSON.stringify(k)}:${stableSerialize(obj[k])}`).join(",")}}`;
}
function hashParams(params) {
  return stableSerialize(params || {});
}
function serializeCacheKey(key) {
  return stableSerialize({
    uid: key.uid,
    profile: key.profile,
    normalizedBaseUrl: key.normalizedBaseUrl,
    organizationId: key.organizationId || "",
    authMode: key.authMode || "",
    credentialRevision: key.credentialRevision || "",
    observedVersion: key.observedVersion || "",
    deploymentFingerprint: key.deploymentFingerprint || "",
    endpointContractHash: key.endpointContractHash || "",
    method: key.method,
    path: key.path,
    paramsHash: key.paramsHash
  });
}
function identityPrefix(id) {
  return stableSerialize({
    uid: id.uid,
    profile: id.profile,
    normalizedBaseUrl: id.normalizedBaseUrl,
    organizationId: id.organizationId || "",
    authMode: id.authMode || "",
    credentialRevision: id.credentialRevision || "",
    observedVersion: id.observedVersion || "",
    deploymentFingerprint: id.deploymentFingerprint || "",
    endpointContractHash: id.endpointContractHash || ""
  });
}
const MAX_ENTRIES = 500;
class SigNozMetadataCache {
  entries = /* @__PURE__ */ new Map();
  /** In-flight loaders keyed by serializeCacheKey — shared across consumers. */
  inflight = /* @__PURE__ */ new Map();
  get(key) {
    const s = serializeCacheKey(key);
    const hit = this.entries.get(s);
    if (!hit) return void 0;
    if (hit.expiresAt <= Date.now()) {
      this.entries.delete(s);
      return void 0;
    }
    hit.lastAccess = Date.now();
    return hit.value;
  }
  set(key, value, ttlMs2) {
    if (ttlMs2 <= 0) return;
    if (value == null) return;
    if (this.entries.size >= MAX_ENTRIES) this.evict();
    this.entries.set(serializeCacheKey(key), {
      value,
      expiresAt: Date.now() + ttlMs2,
      lastAccess: Date.now()
    });
  }
  /**
   * Cache hit or single-flight load.
   * - error/abort: do not write cache; remove inflight so next call retries
   * - one consumer abort must NOT cancel shared promise (loader owns its signal policy)
   */
  async getOrLoad(key, ttlMs2, loader) {
    const hit = this.get(key);
    if (hit !== void 0) return hit;
    const s = serializeCacheKey(key);
    const existing = this.inflight.get(s);
    if (existing) return existing;
    const pending2 = (async () => {
      try {
        const value = await loader();
        this.set(key, value, ttlMs2);
        return value;
      } finally {
        this.inflight.delete(s);
      }
    })();
    this.inflight.set(s, pending2);
    return pending2;
  }
  inflightSize() {
    return this.inflight.size;
  }
  /** Clear all entries for a UID (identity change / auth failure). */
  clearUid(uid) {
    for (const k of [...this.entries.keys()]) {
      if (k.includes(`"uid":${JSON.stringify(uid)}`) || k.includes(`"uid":"${uid}"`)) {
        this.entries.delete(k);
      }
    }
  }
  clearIdentity(id) {
    const prefix = identityPrefix(id);
    for (const k of [...this.entries.keys()]) {
      if (k.startsWith(prefix.slice(0, 20)) || k.includes(`"uid":${JSON.stringify(id.uid)}`)) {
        if (k.includes(JSON.stringify(id.uid)) && k.includes(JSON.stringify(id.profile))) {
          this.entries.delete(k);
        }
      }
    }
  }
  clearAll() {
    this.entries.clear();
    this.inflight.clear();
  }
  size() {
    return this.entries.size;
  }
  evict() {
    let oldestKey = null;
    let oldest = Infinity;
    for (const [k, v] of this.entries) {
      if (v.lastAccess < oldest) {
        oldest = v.lastAccess;
        oldestKey = k;
      }
    }
    if (oldestKey) this.entries.delete(oldestKey);
  }
}
const sharedSigNozMetadataCache = new SigNozMetadataCache();
function validateHealthV1(status, data) {
  if (status < 200 || status >= 300) {
    throw new DataSourceError("UPSTREAM_ERROR", `健康检查 v1 HTTP ${status}`, {
      status
    });
  }
  if (data == null || typeof data !== "object") {
    throw new DataSourceError("INVALID_RESPONSE", "健康检查 v1 响应体缺失或不是对象");
  }
  const st = String(data.status ?? "").toLowerCase();
  if (st !== "ok") {
    throw new DataSourceError(
      "INVALID_RESPONSE",
      `健康检查 v1 状态必须为 ok，实际为 ${st || "空值"}`
    );
  }
}
function validateHealthV2(status, data) {
  if (status === 503) {
    throw new DataSourceError("UPSTREAM_ERROR", "健康检查 v2 报告服务不健康（503）", {
      status: 503
    });
  }
  if (status < 200 || status >= 300) {
    throw new DataSourceError("UPSTREAM_ERROR", `健康检查 v2 HTTP ${status}`, {
      status
    });
  }
  if (data == null || typeof data !== "object") {
    throw new DataSourceError("INVALID_RESPONSE", "健康检查 v2 响应体缺失或不是对象");
  }
  const o = data;
  const st = String(o.status ?? "").toLowerCase();
  if (st !== "success") {
    throw new DataSourceError(
      "INVALID_RESPONSE",
      `健康检查 v2 状态必须为 success，实际为 ${st || "空值"}`
    );
  }
  const d = o.data;
  if (d == null || typeof d !== "object") {
    throw new DataSourceError("INVALID_RESPONSE", "健康检查 v2 缺少 data.healthy");
  }
  if (d.healthy !== true) {
    throw new DataSourceError("INVALID_RESPONSE", "健康检查 v2 的 data.healthy 必须为 true");
  }
}
function isFallbackStatus(status) {
  return status === 404 || status === 405 || status === 501;
}
function parseVersionPayload(data) {
  if (data == null || typeof data !== "object") return {};
  const o = data;
  const nested = o.data && typeof o.data === "object" ? o.data : o;
  return {
    version: nested.version != null ? String(nested.version) : o.version != null ? String(o.version) : void 0,
    ee: nested.ee != null ? Boolean(nested.ee) : o.ee != null ? Boolean(o.ee) : void 0,
    setupCompleted: nested.setupCompleted != null ? Boolean(nested.setupCompleted) : o.setupCompleted != null ? Boolean(o.setupCompleted) : void 0
  };
}
function healthCandidatesFor(profile, opts) {
  const list = profile.endpoints.healthCandidates?.length ? profile.endpoints.healthCandidates : profile.endpoints.health ? [profile.endpoints.health] : [];
  let ordered = list.map((h2) => {
    const path = h2.path;
    const kind2 = path.includes("healthz") || path.includes("v2") ? "v2" : path.includes("v1") ? "v1" : "other";
    return { path, method: h2.method, kind: kind2 };
  });
  if (opts?.preferV1First) {
    ordered = [...ordered].sort((a, b) => a.kind === "v1" ? -1 : b.kind === "v1" ? 1 : 0);
  }
  return ordered;
}
async function probeHealth(http, profile, opts) {
  const candidates = healthCandidatesFor(profile, opts);
  if (!candidates.length) {
    return {
      ok: false,
      path: "",
      fatal: true,
      reason: "no health endpoint",
      reasonCode: "NO_HEALTH"
    };
  }
  let last = {
    ok: false,
    path: candidates[0].path,
    fatal: true,
    reason: "no candidate succeeded"
  };
  for (const c of candidates) {
    try {
      const res = await http({
        path: c.path,
        method: c.method || "GET",
        signal: opts?.signal
      });
      const status = Number(res.status || 0);
      if (status === 401 || status === 403) {
        return {
          ok: false,
          path: c.path,
          fatal: true,
          status,
          reason: "authentication failed",
          reasonCode: "AUTH"
        };
      }
      if (status === 429) {
        return {
          ok: false,
          path: c.path,
          fatal: true,
          status,
          reason: "rate limited",
          reasonCode: "RATE_LIMITED"
        };
      }
      if (status >= 500 && status !== 503) {
        return {
          ok: false,
          path: c.path,
          fatal: true,
          status,
          reason: `server error ${status}`,
          reasonCode: "UPSTREAM_ERROR"
        };
      }
      if (isFallbackStatus(status)) {
        last = {
          ok: false,
          path: c.path,
          fatal: false,
          status,
          reason: `fallback status ${status}`
        };
        continue;
      }
      try {
        if (c.kind === "v2") validateHealthV2(status, res.data);
        else if (c.kind === "v1") validateHealthV1(status, res.data);
        else if (status < 200 || status >= 300) {
          throw new DataSourceError("UPSTREAM_ERROR", `健康检查 HTTP ${status}`);
        }
        return { ok: true, path: c.path, details: { status, kind: c.kind } };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        if (error instanceof DataSourceError && error.code === "INVALID_RESPONSE") {
          last = { ok: false, path: c.path, fatal: false, status, reason: msg };
          continue;
        }
        return {
          ok: false,
          path: c.path,
          fatal: true,
          status,
          reason: msg,
          reasonCode: error instanceof DataSourceError ? error.code : "UPSTREAM_ERROR"
        };
      }
    } catch (error) {
      const msg = error instanceof Error ? error.message : String(error);
      const code = error instanceof DataSourceError ? error.code : void 0;
      if (code === "AUTH_REQUIRED" || code === "AUTH_REJECTED" || /401|403|AUTH/i.test(msg)) {
        return {
          ok: false,
          path: c.path,
          fatal: true,
          reason: msg,
          reasonCode: "AUTH"
        };
      }
      last = { ok: false, path: c.path, fatal: false, reason: msg };
    }
  }
  return last;
}
function buildCapabilityIdentity(args) {
  return {
    uid: args.uid,
    profile: String(args.options.apiProfile || ""),
    normalizedBaseUrl: String(args.baseUrl || "").replace(/\/+$/, ""),
    organizationId: args.options.organizationId || "",
    authMode: args.options.credentialKind || "",
    credentialRevision: args.credentialRevision || "",
    observedVersion: args.observedVersion || "",
    deploymentFingerprint: args.deploymentFingerprint || "",
    endpointContractHash: args.endpointContractHash || ""
  };
}
function capabilityIdentityKey(id) {
  return identityPrefix(id);
}
function parseCacheTtlMs(raw, fallback = 3e5) {
  if (typeof raw === "number" && Number.isFinite(raw)) return Math.max(0, Math.floor(raw));
  const s = String(raw ?? "").trim();
  if (!s) return fallback;
  const m = s.match(/^(\d+(?:\.\d+)?)(ms|[smhd])$/i);
  if (!m) return fallback;
  const n = Number(m[1]);
  const scale = {
    ms: 1,
    s: 1e3,
    m: 6e4,
    h: 36e5,
    d: 864e5
  };
  return Math.floor(n * scale[m[2].toLowerCase()]);
}
function parseTimeoutMs(raw, fallback = 3e4) {
  const n = Number(raw);
  if (!Number.isFinite(n) || n <= 0) return fallback;
  return Math.floor(n);
}
function resolveLiveExportCapabilities(args) {
  const exp = args.options?.experimentalCapabilities || {};
  const ep = args.profile.endpoints;
  return {
    sseVerified: Boolean(exp.liveTailSse && ep.liveTail?.path),
    legacySseEnabled: Boolean(exp.liveTailLegacy && ep.liveTailLegacy?.path),
    // cursor poll available when logs query_range exists (raw/raw_stream)
    cursorPoll: Boolean(ep.logsQuery?.path || ep.metricsQuery?.path),
    exportRawVerified: Boolean(exp.exportRaw && ep.exportRaw?.path),
    liveTailPath: ep.liveTail?.path,
    legacyLiveTailPath: ep.liveTailLegacy?.path,
    exportRawPath: ep.exportRaw?.path
  };
}
const WATERFALL_ENDPOINT_SPECS = {
  "v3-waterfall": {
    id: "v3-waterfall",
    method: "POST",
    path: "/api/v3/traces/{traceId}/waterfall",
    buildBody: (state2) => ({
      selectedSpanId: state2.selectedSpanId ?? "",
      uncollapsedSpans: sortUnique(state2.uncollapsedSpans ?? []),
      aggregations: canonicalizeAggregations(state2.aggregations).slice(0, 10),
      limit: Math.min(state2.limit ?? 1e4, 1e4)
    })
  },
  "v4-waterfall": {
    id: "v4-waterfall",
    method: "POST",
    path: "/api/v4/traces/{traceId}/waterfall",
    buildBody: (state2) => ({
      selectedSpanId: state2.selectedSpanId ?? "",
      uncollapsedSpans: sortUnique(state2.uncollapsedSpans ?? [])
    })
  }
};
const ALLOWED_AGG = /* @__PURE__ */ new Set([
  "span_count",
  "execution_time_percentage",
  "duration"
]);
function sortUnique(ids) {
  return [...new Set(ids.map(String).filter(Boolean))].sort();
}
function canonicalizeAggregations(aggs) {
  if (!aggs?.length) return [];
  const out = [];
  for (const a of aggs) {
    const t2 = typeof a === "string" ? a : a?.type;
    if (ALLOWED_AGG.has(t2)) out.push({ type: t2 });
  }
  return out;
}
function waterfallCandidateIds(hasObservedV3Evidence) {
  return hasObservedV3Evidence ? ["v3-waterfall", "v4-waterfall"] : ["v4-waterfall", "v3-waterfall"];
}
function buildWaterfallPath(spec, traceId) {
  return spec.path.replace("{traceId}", encodeURIComponent(traceId));
}
function isRouteUnsupportedStatus(status) {
  return status === 404 || status === 405 || status === 501;
}
function shouldTryNextWaterfallCandidate(status, err) {
  if (isRouteUnsupportedStatus(status)) return true;
  const msg = String(err?.message || "");
  if (/unsupported|not found|no route|schema/i.test(msg) && !/401|403|429|5\d\d/.test(msg))
    return true;
  if (status === 401 || status === 403 || status === 429 || status >= 500) return false;
  return false;
}
function waterfallCapabilityKey(identity2) {
  return capabilityIdentityKey(identity2);
}
function waterfallResponseCacheKey(args) {
  const v4 = args.normalizeForV4 || args.resolvedEndpointId === "v4-waterfall";
  return hashParams({
    capabilityKey: args.capabilityKey,
    resolvedEndpoint: args.resolvedEndpointId,
    traceId: args.traceId,
    selectedSpanId: args.state.selectedSpanId ?? "",
    uncollapsedSpans: sortUnique(args.state.uncollapsedSpans ?? []),
    limit: v4 ? "" : Math.min(args.state.limit ?? 1e4, 1e4),
    aggregations: v4 ? [] : canonicalizeAggregations(args.state.aggregations)
  });
}
const WATERFALL_CACHE_MAX_ENTRIES = 128;
const WATERFALL_CACHE_MAX_BYTES = 32 * 1024 * 1024;
const WATERFALL_CACHE_TTL_MS = 5 * 60 * 1e3;
function estimateDetailBytes(v) {
  try {
    return JSON.stringify(v).length * 2;
  } catch {
    return 1024;
  }
}
function createMemoryWaterfallCache(opts) {
  const maxEntries2 = WATERFALL_CACHE_MAX_ENTRIES;
  const maxBytes2 = WATERFALL_CACHE_MAX_BYTES;
  const ttlMs2 = WATERFALL_CACHE_TTL_MS;
  const resolved = /* @__PURE__ */ new Map();
  const details = /* @__PURE__ */ new Map();
  let detailBytes = 0;
  const touchResolved = (k, v) => {
    resolved.delete(k);
    resolved.set(k, v);
  };
  const touchDetail = (k, v) => {
    details.delete(k);
    details.set(k, v);
  };
  const evictDetails = () => {
    while (details.size > maxEntries2 || detailBytes > maxBytes2) {
      const first = details.keys().next().value;
      if (first == null) break;
      const ent = details.get(first);
      details.delete(first);
      if (ent) detailBytes = Math.max(0, detailBytes - ent.bytes);
    }
    while (resolved.size > maxEntries2) {
      const first = resolved.keys().next().value;
      if (first == null) break;
      resolved.delete(first);
    }
  };
  return {
    getResolved: (k) => {
      const v = resolved.get(k);
      if (!v) return void 0;
      if (v.expiresAt <= Date.now()) {
        resolved.delete(k);
        return void 0;
      }
      touchResolved(k, v);
      return {
        id: v.id,
        path: v.path,
        method: v.method,
        observedAt: v.observedAt
      };
    },
    setResolved: (k, v) => {
      touchResolved(k, {
        ...v,
        expiresAt: Date.now() + ttlMs2
      });
      evictDetails();
    },
    getDetail: (k) => {
      const ent = details.get(k);
      if (!ent) return void 0;
      if (ent.expiresAt <= Date.now()) {
        details.delete(k);
        detailBytes = Math.max(0, detailBytes - ent.bytes);
        return void 0;
      }
      touchDetail(k, ent);
      return ent.value;
    },
    setDetail: (k, v) => {
      const prev = details.get(k);
      if (prev) detailBytes = Math.max(0, detailBytes - prev.bytes);
      const bytes = estimateDetailBytes(v);
      touchDetail(k, {
        value: v,
        expiresAt: Date.now() + ttlMs2,
        bytes
      });
      detailBytes += bytes;
      evictDetails();
    },
    clearIdentity: (prefix) => {
      for (const k of [...resolved.keys()])
        if (k.includes(prefix) || k === prefix) resolved.delete(k);
      for (const k of [...details.keys()]) {
        if (k.includes(prefix) || k.startsWith(prefix)) {
          const ent = details.get(k);
          details.delete(k);
          if (ent) detailBytes = Math.max(0, detailBytes - ent.bytes);
        }
      }
    }
  };
}
function mapWaterfallPayload(data, candidateId, path, status) {
  const root = data && typeof data === "object" ? data : {};
  const payload = root.data && typeof root.data === "object" ? root.data : root;
  const spansRaw = payload.spans || payload.spanList || payload.events || [];
  const list = Array.isArray(spansRaw) ? spansRaw : [];
  const spans = list.map((s) => {
    const durationNano = s.duration_nano != null ? String(s.duration_nano) : s.durationNano != null ? String(s.durationNano) : s.duration != null && Number(s.duration) > 1e6 ? String(s.duration) : String(Math.round(Number(s.durationMs || s.duration || 0) * 1e6));
    const timeUnixMs = (() => {
      const t2 = s.time_unix ?? s.timeUnix ?? s.startTimeUnixNano ?? s.startTime ?? s.timestamp;
      if (t2 == null) return 0;
      const n = Number(t2);
      if (!Number.isFinite(n)) return 0;
      if (n > 1e15) return Math.floor(n / 1e6);
      if (n > 1e12) return Math.floor(n / 1e3);
      return Math.floor(n);
    })();
    const durationMs = Number(durationNano) / 1e6;
    return {
      spanId: String(s.spanId ?? s.span_id ?? s.id ?? ""),
      parentSpanId: String(s.parentSpanId ?? s.parent_span_id ?? s.parentId ?? ""),
      name: String(s.name ?? s.operationName ?? s.operation_name ?? ""),
      service: String(
        s.serviceName ?? s.service_name ?? s.service ?? s.resource?.["service.name"] ?? ""
      ),
      timeUnixMs,
      durationNano,
      durationMs: Number.isFinite(durationMs) ? durationMs : Number(s.durationMs || s.duration || 0),
      statusCode: s.statusCode != null ? String(s.statusCode) : s.status?.code != null ? String(s.status.code) : void 0,
      hasError: Boolean(s.hasError ?? s.error ?? (s.statusCode === 2 || s.status?.code === 2)),
      resource: s.resource && typeof s.resource === "object" ? s.resource : void 0,
      attributes: s.attributes || s.tags || void 0,
      events: Array.isArray(s.events) ? s.events : void 0,
      links: Array.isArray(s.links) ? s.links : void 0,
      references: Array.isArray(s.references) ? s.references : void 0,
      raw: s
    };
  });
  return {
    candidateId,
    path,
    status,
    startMs: payload.start != null ? Number(payload.start) : spans[0]?.timeUnixMs,
    endMs: payload.end != null ? Number(payload.end) : spans.length ? Math.max(...spans.map((x) => x.timeUnixMs + x.durationMs)) : void 0,
    rootService: payload.rootService || payload.root_service || spans.find((s) => !s.parentSpanId)?.service,
    entryPoint: payload.entryPoint || payload.entry_point || spans.find((s) => !s.parentSpanId)?.name,
    missingCount: payload.missingCount ?? payload.missing_count,
    totalCount: payload.totalCount ?? payload.total_count ?? spans.length,
    errorCount: payload.errorCount ?? payload.error_count ?? spans.filter((s) => s.hasError).length,
    uncollapsed: Array.isArray(payload.uncollapsedSpans) ? payload.uncollapsedSpans.map(String) : void 0,
    hasMore: Boolean(payload.hasMore ?? payload.has_more),
    spans,
    raw: data
  };
}
function waterfallDetailToFrames(detail, refId = "Trace") {
  const spans = detail.spans;
  return [
    createDataFrame({
      refId,
      name: "waterfall",
      meta: {
        source: "live",
        preferredVisualisationType: "trace",
        signal: "traces",
        waterfall: {
          candidateId: detail.candidateId,
          path: detail.path,
          status: detail.status,
          rootService: detail.rootService,
          entryPoint: detail.entryPoint,
          missingCount: detail.missingCount,
          totalCount: detail.totalCount,
          errorCount: detail.errorCount,
          hasMore: detail.hasMore
        }
      },
      fields: [
        { name: "spanId", type: "string", values: spans.map((s) => s.spanId) },
        {
          name: "parentSpanId",
          type: "string",
          values: spans.map((s) => s.parentSpanId)
        },
        { name: "name", type: "string", values: spans.map((s) => s.name) },
        {
          name: "serviceName",
          type: "string",
          values: spans.map((s) => s.service)
        },
        {
          name: "service",
          type: "string",
          values: spans.map((s) => s.service)
        },
        {
          name: "startTime",
          type: "number",
          values: spans.map((s) => s.timeUnixMs)
        },
        {
          name: "duration",
          type: "number",
          values: spans.map((s) => s.durationMs)
        },
        {
          name: "duration_nano",
          type: "string",
          values: spans.map((s) => s.durationNano)
        },
        {
          name: "statusCode",
          type: "string",
          values: spans.map((s) => s.statusCode ?? "")
        },
        {
          name: "attributes",
          type: "string",
          values: spans.map((s) => s.attributes ? JSON.stringify(s.attributes) : "")
        },
        {
          name: "events",
          type: "string",
          values: spans.map((s) => s.events ? JSON.stringify(s.events) : "")
        },
        {
          name: "links",
          type: "string",
          values: spans.map((s) => s.links ? JSON.stringify(s.links) : "")
        },
        {
          name: "references",
          type: "string",
          values: spans.map((s) => s.references ? JSON.stringify(s.references) : "")
        }
      ]
    })
  ];
}
async function fetchWaterfall(args) {
  const traceId = String(args.traceId || "").trim();
  if (!traceId) throw new DataSourceError("INVALID_QUERY", "traceId 为必填项");
  const cache2 = args.cache || createMemoryWaterfallCache();
  const capKey = waterfallCapabilityKey(args.identity);
  const state2 = args.state || {};
  const resolved = cache2.getResolved(capKey);
  const preferred = args.preferredCandidateId || resolved?.id;
  let candidates = waterfallCandidateIds(Boolean(args.hasObservedV3Evidence));
  if (preferred && candidates.includes(preferred)) {
    candidates = [preferred, ...candidates.filter((c) => c !== preferred)];
  }
  let lastErr = null;
  for (const id of candidates) {
    const spec = WATERFALL_ENDPOINT_SPECS[id];
    const path = buildWaterfallPath(spec, traceId);
    const body = spec.buildBody(state2);
    const respKey = waterfallResponseCacheKey({
      capabilityKey: capKey,
      resolvedEndpointId: id,
      traceId,
      state: state2,
      normalizeForV4: id === "v4-waterfall"
    });
    const cached = cache2.getDetail(respKey);
    if (cached) return cached;
    try {
      const res = await args.http({
        path,
        method: spec.method,
        body,
        signal: args.signal
      });
      const status = Number(res.status || 0);
      if (status === 401 || status === 403) {
        throw new DataSourceError("AUTH", `链路突发图 HTTP ${status}`, {
          status
        });
      }
      if (status === 429 || status >= 500) {
        throw new DataSourceError("UPSTREAM_ERROR", `链路突发图 HTTP ${status}`, { status });
      }
      if (isRouteUnsupportedStatus(status)) {
        lastErr = new DataSourceError("UNSUPPORTED_CAPABILITY", `链路突发图 ${id} HTTP ${status}`, {
          status
        });
        continue;
      }
      if (status < 200 || status >= 300) {
        if (shouldTryNextWaterfallCandidate(status)) {
          lastErr = new DataSourceError(
            "UNSUPPORTED_CAPABILITY",
            `链路突发图 ${id} HTTP ${status}`,
            { status }
          );
          continue;
        }
        throw new DataSourceError("UPSTREAM_ERROR", `链路突发图 HTTP ${status}`, { status });
      }
      const detail = mapWaterfallPayload(res.data, id, path, status);
      cache2.setResolved(capKey, {
        id,
        path: spec.path,
        method: spec.method,
        observedAt: (/* @__PURE__ */ new Date()).toISOString()
      });
      cache2.setDetail(respKey, detail);
      return detail;
    } catch (error) {
      if (error instanceof DataSourceError && (error.code === "AUTH" || error.code === "UPSTREAM_ERROR"))
        throw error;
      if (error?.name === "AbortError" || error?.code === "CANCELLED") throw error;
      const status = Number(error?.status || error?.meta?.status || 0);
      if (shouldTryNextWaterfallCandidate(status, error)) {
        lastErr = error instanceof Error ? error : new Error(String(error));
        continue;
      }
      throw error;
    }
  }
  throw lastErr || new DataSourceError("UNSUPPORTED_CAPABILITY", "没有可用的链路突发图接口");
}
async function fetchRelatedLogs(args) {
  const traceId = String(args.traceId || "").trim();
  if (!traceId) throw new DataSourceError("INVALID_QUERY", "traceId 为关联日志查询必填");
  if (!args.logsQueryPath) {
    throw new DataSourceError("UNSUPPORTED_CAPABILITY", "关联日志需要 logs query_range 接口");
  }
  const margin = args.safetyMarginMs ?? 6e4;
  const start = Math.max(0, args.fromMs - margin);
  const end = args.toMs + margin;
  const filter2 = `trace_id = '${traceId.replaceAll("'", "\\'")}' OR traceId = '${traceId.replaceAll("'", "\\'")}'`;
  let cursor = null;
  const allRows = [];
  const maxPages = args.maxPages ?? 50;
  for (let page = 0; page < maxPages; page++) {
    const body = {
      start,
      end,
      requestType: "raw",
      compositeQuery: {
        queries: [
          {
            type: "builder_query",
            queryType: "builder",
            spec: {
              name: "A",
              signal: "logs",
              filter: { expression: filter2 },
              disabled: false,
              cursor: cursor || void 0,
              limit: 100
            }
          }
        ]
      }
    };
    const res = await args.http({
      path: args.logsQueryPath,
      method: "POST",
      body,
      signal: args.signal
    });
    const status = Number(res.status || 200);
    if (status === 401 || status === 403) {
      throw new DataSourceError("AUTH", `关联日志 HTTP ${status}`, {
        status
      });
    }
    if (status < 200 || status >= 300) {
      throw new DataSourceError("UPSTREAM_ERROR", `关联日志 HTTP ${status}`, {
        status
      });
    }
    const data = res.data;
    const results = data?.data?.data?.results ?? data?.data?.results ?? data?.results ?? [];
    const first = Array.isArray(results) ? results[0] : null;
    const rows = first?.rows || first?.data || [];
    if (Array.isArray(rows)) allRows.push(...rows);
    const next = first?.nextCursor ?? first?.cursor ?? null;
    if (!next || next === cursor) break;
    cursor = next;
  }
  const times = allRows.map((r) => Number(r.timestamp ?? r.time ?? r.ts ?? start));
  const lines = allRows.map(
    (r) => String(r.body ?? r.message ?? r.line ?? (typeof r === "string" ? r : JSON.stringify(r)))
  );
  const services = allRows.map(
    (r) => String(r.service ?? r.resources_string?.["service.name"] ?? r["service.name"] ?? "")
  );
  const severities = allRows.map((r) => String(r.severity ?? r.level ?? ""));
  const spanIds = allRows.map((r) => String(r.span_id ?? r.spanId ?? ""));
  return [
    createDataFrame({
      name: "related_logs",
      meta: {
        source: "live",
        signal: "logs",
        relatedTraceId: traceId,
        rowCount: allRows.length
      },
      fields: [
        { name: "Time", type: "time", values: times },
        { name: "Line", type: "string", values: lines },
        { name: "service", type: "string", values: services },
        { name: "severity", type: "string", values: severities },
        { name: "traceId", type: "string", values: allRows.map(() => traceId) },
        { name: "spanId", type: "string", values: spanIds }
      ]
    })
  ];
}
function issuesWriteEnabled(args) {
  const id = String(args.profileId);
  if (id === "signoz-v3" || id === "signoz-v4" || id === "signoz-v5" || id === "prometheus-compatible") {
    return { acknowledge: false, resolve: false };
  }
  const base = Boolean(args.enableWrites) && Boolean(args.envGate) && Boolean(args.actionCapabilityVerified);
  return {
    acknowledge: base && Boolean(args.hasAcknowledgeEndpoint),
    resolve: base && Boolean(args.hasResolveEndpoint)
  };
}
function mapAlertsResponse(body, opts) {
  const rows = body?.data || body?.alerts || body || [];
  const list = Array.isArray(rows) ? rows : [];
  return [
    createDataFrame({
      refId: opts.refId,
      name: "alerts",
      meta: { preferredVisualisationType: "table", signal: "alerts" },
      fields: [
        {
          name: "id",
          type: "string",
          values: list.map((r, i) => String(r.id || r.alertId || i))
        },
        {
          name: "title",
          type: "string",
          values: list.map((r) => String(r.title || r.name || r.alertname || ""))
        },
        {
          name: "service",
          type: "string",
          values: list.map((r) => String(r.service || r.labels?.service || ""))
        },
        {
          name: "severity",
          type: "string",
          values: list.map((r) => String(r.severity || r.labels?.severity || ""))
        },
        {
          name: "status",
          type: "string",
          values: list.map((r) => String(r.status || r.state || "firing"))
        },
        {
          name: "Time",
          type: "time",
          values: list.map((r) => Number(r.startsAt || r.time || Date.now()))
        },
        {
          name: "alertId",
          type: "string",
          values: list.map((r, i) => String(r.alertId || r.id || i))
        }
      ]
    })
  ];
}
const OFFLINE_METRICS = [
  {
    metricName: "up",
    description: "离线示例",
    type: "gauge",
    unit: "",
    temporality: "",
    isMonotonic: false
  },
  {
    metricName: "http_requests_total",
    description: "离线示例",
    type: "counter",
    unit: "",
    temporality: "Cumulative",
    isMonotonic: true
  }
];
const OFFLINE_SERVICES = ["frontend", "api", "checkout"];
function asArray(data) {
  if (Array.isArray(data)) return data;
  if (data && typeof data === "object") {
    const o = data;
    if (Array.isArray(o.data)) return o.data;
    if (Array.isArray(o.result)) return o.result;
    if (Array.isArray(o.metrics)) return o.metrics;
    if (Array.isArray(o.keys)) return o.keys;
    if (Array.isArray(o.values)) return o.values;
    if (o.data && typeof o.data === "object") {
      if (Array.isArray(o.data.metrics)) return o.data.metrics;
      if (Array.isArray(o.data.keys)) return o.data.keys;
      if (Array.isArray(o.data.values)) return o.data.values;
      if (o.data.keys && typeof o.data.keys === "object" && !Array.isArray(o.data.keys)) {
        return flattenKeysDict(o.data.keys);
      }
    }
    if (o.keys && typeof o.keys === "object" && !Array.isArray(o.keys)) {
      return flattenKeysDict(o.keys);
    }
  }
  return [];
}
function flattenKeysDict(dict) {
  const out = [];
  for (const [k, v] of Object.entries(dict || {})) {
    if (Array.isArray(v)) {
      for (const item of v) {
        if (item && typeof item === "object") out.push({ name: k, ...item });
        else out.push({ name: k });
      }
    } else if (v && typeof v === "object") {
      out.push({ name: k, ...v });
    } else {
      out.push({ name: k });
    }
  }
  return out;
}
function mapMetric(row) {
  return {
    metricName: String(row.metricName || row.name || row.metric || ""),
    description: String(row.description || row.desc || ""),
    type: String(row.type || row.metricType || ""),
    unit: String(row.unit || ""),
    temporality: String(row.temporality || ""),
    isMonotonic: Boolean(row.isMonotonic)
  };
}
function mapField(row) {
  return {
    name: String(row.name || row.key || row.attributeKey || ""),
    fieldDataType: String(row.fieldDataType || row.dataType || "string").toLowerCase() || "string",
    fieldContext: String(row.fieldContext || row.type || "tag").toLowerCase() || "tag"
  };
}
function mapStringValues(rows) {
  return rows.map(
    (r) => typeof r === "string" || typeof r === "number" ? String(r) : String(r?.value ?? r?.name ?? r?.serviceName ?? "")
  ).filter(Boolean);
}
function createSigNozMetadataApi(opts) {
  const cache2 = opts.cache || sharedSigNozMetadataCache;
  const ttlMs2 = opts.ttlMs ?? 3e5;
  const profile = opts.profile;
  const profileId = String(profile.id);
  async function liveHttp(req) {
    if (!opts.http) {
      throw new DataSourceError("UNSUPPORTED_CAPABILITY", "SigNoz metadata http 未注入");
    }
    try {
      return await opts.http(req);
    } catch (error) {
      const msg = error instanceof Error ? error.message : String(error);
      const code = error instanceof DataSourceError ? error.code : void 0;
      if (code === "AUTH_REQUIRED" || code === "AUTH_REJECTED" || /401|403/.test(msg)) {
        cache2.clearUid(opts.identity.uid);
      }
      throw error;
    }
  }
  async function cachedGet(method, path, params, signal, loader) {
    const key = {
      ...opts.identity,
      method,
      path,
      paramsHash: hashParams(params)
    };
    const value = await cache2.getOrLoad(key, ttlMs2, loader);
    if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
    return value;
  }
  function endpointOrThrow(kind2, label) {
    const ep = profile.endpoints[kind2] || (kind2 === "metricsList" ? profile.endpoints.metadata : void 0) || (kind2 === "fieldsKeys" ? profile.endpoints.attributeKeys : void 0) || (kind2 === "fieldsValues" ? profile.endpoints.attributeValues : void 0);
    if (!ep?.path) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        `profile ${profileId} 未定义 ${label} endpoint（禁止假空列表）`
      );
    }
    return ep;
  }
  return {
    async getMetadata(request, signal) {
      if (opts.offline) return offlineMetadata(request);
      switch (request.type) {
        case "metrics": {
          const ep = endpointOrThrow("metricsList", "metrics");
          const values = await cachedGet(
            "GET",
            ep.path,
            { search: request.search || "" },
            signal,
            async () => {
              const res = await liveHttp({
                path: ep.path,
                method: ep.method || "GET",
                query: request.search ? { search: request.search } : void 0,
                signal
              });
              return asArray(res.data).map(mapMetric).filter((m) => m.metricName);
            }
          );
          const filtered = request.search ? values.filter((m) => m.metricName.includes(request.search)) : values;
          return { type: "metrics", values: filtered };
        }
        case "attributeKeys": {
          const ep = profile.endpoints.fieldsKeys || profile.endpoints.attributeKeys || endpointOrThrow("fieldsKeys", "fields/keys");
          const path = ep.path;
          const useMetricAttrs = request.metricName && profileId.startsWith("signoz") ? { path: "/api/v2/metrics/attributes", method: "GET" } : { path, method: ep.method || "GET" };
          const values = await cachedGet(
            useMetricAttrs.method,
            useMetricAttrs.path,
            {
              signal: request.signal,
              metricName: request.metricName || "",
              search: request.search || ""
            },
            signal,
            async () => {
              const res = await liveHttp({
                path: useMetricAttrs.path,
                method: useMetricAttrs.method,
                query: {
                  ...request.signal ? { dataSource: request.signal } : {},
                  ...request.metricName ? { metricName: request.metricName } : {},
                  ...request.search ? { search: request.search } : {}
                },
                signal
              });
              return asArray(res.data).map(mapField).filter((f) => f.name);
            }
          );
          return { type: "attributeKeys", values };
        }
        case "attributeValues": {
          const ep = profile.endpoints.fieldsValues || profile.endpoints.attributeValues;
          if (!ep?.path) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              `profile ${profileId} 未定义 fields/values endpoint`
            );
          }
          const values = await cachedGet(
            ep.method || "GET",
            ep.path,
            {
              key: request.key,
              signal: request.signal,
              search: request.search || ""
            },
            signal,
            async () => {
              const res = await liveHttp({
                path: ep.path,
                method: ep.method || "GET",
                query: {
                  fieldName: request.key,
                  name: request.key,
                  ...request.signal ? { dataSource: request.signal } : {},
                  ...request.search ? { search: request.search } : {}
                },
                signal
              });
              return mapStringValues(asArray(res.data));
            }
          );
          return { type: "attributeValues", values };
        }
        case "services": {
          const ep = profile.endpoints.services || profile.endpoints.fieldsValues || profile.endpoints.attributeValues;
          if (!ep?.path) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              `profile ${profileId} 未定义 services endpoint`
            );
          }
          const values = await cachedGet(
            ep.method || "GET",
            ep.path,
            { kind: "services", search: request.search || "", path: ep.path },
            signal,
            async () => {
              const isPost = (ep.method || "GET").toUpperCase() === "POST" || ep.path.includes("/v2/services");
              try {
                const endNs = `${String(Date.now())}000000`;
                const startNs = `${String(Date.now() - 36e5)}000000`;
                const res = await liveHttp({
                  path: ep.path,
                  method: isPost ? "POST" : ep.method || "GET",
                  ...isPost ? {
                    body: {
                      start: startNs,
                      end: endNs,
                      tags: [],
                      ...request.search ? { search: request.search } : {}
                    }
                  } : {
                    query: {
                      fieldName: "service.name",
                      name: "service.name",
                      dataSource: "traces",
                      ...request.search ? { search: request.search } : {}
                    }
                  },
                  signal
                });
                return mapStringValues(asArray(res.data));
              } catch (error) {
                if (isPost && profile.endpoints.fieldsValues?.path) {
                  const fb = profile.endpoints.fieldsValues;
                  const res = await liveHttp({
                    path: fb.path,
                    method: fb.method || "GET",
                    query: {
                      fieldName: "service.name",
                      name: "service.name",
                      dataSource: "traces",
                      ...request.search ? { search: request.search } : {}
                    },
                    signal
                  });
                  return mapStringValues(asArray(res.data));
                }
                throw error;
              }
            }
          );
          const filtered = request.search ? values.filter((s) => s.includes(String(request.search))) : values;
          return { type: "services", values: filtered };
        }
        case "operations": {
          const ep = profile.endpoints.fieldsValues || profile.endpoints.attributeValues;
          if (!ep?.path) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              `profile ${profileId} 未定义 operations endpoint`
            );
          }
          if (!request.service) {
            throw new DataSourceError("INVALID_QUERY", "operations 需要 service filter");
          }
          const values = await cachedGet(
            ep.method || "GET",
            ep.path,
            {
              key: "name",
              service: request.service,
              search: request.search || ""
            },
            signal,
            async () => {
              const res = await liveHttp({
                path: ep.path,
                method: ep.method || "GET",
                query: {
                  "fieldName": "name",
                  "name": "name",
                  "dataSource": "traces",
                  "service": request.service,
                  "service.name": request.service,
                  ...request.search ? { search: request.search } : {}
                },
                signal
              });
              return mapStringValues(asArray(res.data));
            }
          );
          return { type: "operations", values };
        }
        case "traceById": {
          const ep = profile.endpoints.traceById;
          if (!ep?.path) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              `profile ${profileId} 未定义 traceById`
            );
          }
          const path = ep.path.replace("{id}", encodeURIComponent(request.traceId));
          const res = await liveHttp({
            path,
            method: ep.method || "GET",
            signal
          });
          return {
            type: "traceById",
            frames: [
              createDataFrame({
                fields: [
                  {
                    name: "payload",
                    type: "string",
                    values: [JSON.stringify(res.data)]
                  }
                ],
                meta: { signal: "traces" }
              })
            ]
          };
        }
        case "relatedLogs": {
          const logsPath = profile.endpoints.logsQuery?.path || profile.endpoints.metricsQuery?.path;
          if (!logsPath) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              "related logs 需要 logs query_range"
            );
          }
          const frames = await fetchRelatedLogs({
            traceId: request.traceId,
            fromMs: request.fromMs,
            toMs: request.toMs,
            http: async (req) => {
              const res = await liveHttp({
                path: req.path,
                method: req.method,
                body: req.body,
                signal: req.signal
              });
              return { status: Number(res.status ?? 200), data: res.data };
            },
            logsQueryPath: logsPath,
            signal
          });
          return { type: "relatedLogs", frames };
        }
        case "alerts": {
          const ep = profile.endpoints.alertsQuery;
          if (!ep?.path) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              `alerts 需要 alertsQuery capability 证据，当前不返回假空`
            );
          }
          const res = await liveHttp({
            path: ep.path,
            method: ep.method || "GET",
            query: (ep.method || "GET").toUpperCase() === "GET" ? {
              ...request.service ? { service: request.service } : {},
              ...request.environment ? { environment: request.environment } : {}
            } : void 0,
            body: (ep.method || "GET").toUpperCase() === "POST" ? {
              start: request.fromMs,
              end: request.toMs,
              service: request.service,
              environment: request.environment,
              severities: request.severities
            } : void 0,
            signal
          });
          const rows = asArray(res.data);
          const frames = mapAlertsResponse(
            { data: rows.length ? rows : res.data },
            { refId: "alerts" }
          );
          return { type: "alerts", frames };
        }
        default:
          throw new DataSourceError("INVALID_QUERY", `未知 metadata 请求`);
      }
    }
  };
}
function offlineMetadata(request) {
  switch (request.type) {
    case "metrics":
      return {
        type: "metrics",
        values: OFFLINE_METRICS.filter(
          (m) => !request.search || m.metricName.includes(request.search)
        )
      };
    case "services":
      return {
        type: "services",
        values: OFFLINE_SERVICES.filter(
          (s) => !request.search || s.includes(String(request.search))
        )
      };
    case "operations":
      return { type: "operations", values: ["HTTP GET", "HTTP POST", "gRPC"] };
    case "attributeKeys":
      return {
        type: "attributeKeys",
        values: [
          {
            name: "service.name",
            fieldDataType: "string",
            fieldContext: "resource"
          },
          {
            name: "http.status_code",
            fieldDataType: "int64",
            fieldContext: "tag"
          }
        ]
      };
    case "attributeValues":
      return { type: "attributeValues", values: ["prod", "staging"] };
    case "traceById": {
      const frames = [
        createDataFrame({
          fields: [
            { name: "spanId", values: ["root"] },
            { name: "name", values: ["GET /"] },
            { name: "service", values: ["frontend"] }
          ],
          meta: { signal: "traces" }
        })
      ];
      return { type: "traceById", frames };
    }
    case "relatedLogs":
      return {
        type: "relatedLogs",
        frames: [
          createDataFrame({
            fields: [
              { name: "Time", type: "time", values: [request.fromMs] },
              {
                name: "Line",
                type: "string",
                values: ["offline error log line"]
              },
              { name: "service", type: "string", values: ["frontend"] },
              { name: "severity", type: "string", values: ["error"] },
              { name: "traceId", type: "string", values: [request.traceId] },
              { name: "spanId", type: "string", values: ["span-offline"] }
            ],
            meta: {
              signal: "logs",
              source: "fixture",
              relatedTraceId: request.traceId
            }
          })
        ]
      };
    case "alerts":
      return {
        type: "alerts",
        frames: [
          createDataFrame({
            fields: [
              { name: "id", values: ["al-1"] },
              { name: "title", values: ["High error rate"] },
              { name: "service", values: [request.service || "api"] },
              { name: "severity", values: ["critical"] },
              { name: "status", values: ["firing"] },
              { name: "Time", values: [request.fromMs] },
              { name: "alertId", values: ["al-1"] }
            ],
            meta: { signal: "alerts" }
          })
        ]
      };
    default:
      throw new DataSourceError("INVALID_QUERY", "未知的离线元数据请求");
  }
}
const REQUEST_TO_PANEL = {
  time_series: "graph",
  scalar: "value",
  raw: "list",
  raw_stream: "list",
  trace: "trace",
  distribution: "histogram"
};
const V3_OP_MAP = {
  "=": "=",
  "!=": "!=",
  "in": "in",
  "nin": "nin",
  "contains": "contains",
  "ncontains": "ncontains",
  "regex": "regex",
  "nregex": "nregex",
  "like": "like",
  "nlike": "nlike",
  "exists": "exists",
  "nexists": "nexists",
  "has": "has",
  "nhas": "nhas",
  ">": ">",
  ">=": ">=",
  "<": "<",
  "<=": "<=",
  "=~": "regex",
  "!~": "nregex"
};
function exprToV3Filters(expression) {
  const expr = String(expression || "").trim();
  if (!expr) return { items: [], op: "AND" };
  if (/\(|\)/.test(expr)) return { error: "complex_parens" };
  if (/\bOR\b/i.test(expr) && /\bAND\b/i.test(expr)) return { error: "mixed_and_or" };
  const op = /\bOR\b/i.test(expr) ? "OR" : "AND";
  const parts = expr.split(/\bAND\b|\bOR\b/i).map((s) => s.trim()).filter(Boolean);
  const items = [];
  for (const part of parts) {
    const m = part.match(
      /^([\w./-]+)\s*(!=|=~|!~|>=|<=|[=><]|contains|ncontains|in|nin|regex|nregex|like|nlike|exists|nexists|has|nhas)\s*(.*)$/i
    );
    if (!m) return { error: `unsupported_clause:${part}` };
    const key = m[1];
    const rawOp = m[2];
    let valueRaw = m[3].trim();
    const mapped = V3_OP_MAP[rawOp] || V3_OP_MAP[rawOp.toLowerCase()] || rawOp;
    if (mapped === "exists" || mapped === "nexists") {
      items.push({
        key: { key, type: "tag", dataType: "string" },
        op: mapped,
        value: true
      });
      continue;
    }
    if (valueRaw.startsWith("'") && valueRaw.endsWith("'") || valueRaw.startsWith('"') && valueRaw.endsWith('"')) {
      valueRaw = valueRaw.slice(1, -1);
    }
    let value = valueRaw;
    if (mapped === "in" || mapped === "nin") {
      value = valueRaw.split(",").map((s) => s.trim().replaceAll(/^['"]|['"]$/g, ""));
    }
    items.push({
      key: { key, type: "tag", dataType: "string" },
      op: mapped,
      value
    });
  }
  return { items, op };
}
function fieldToAttr(f) {
  return {
    key: f.name,
    type: f.fieldContext === "resource" ? "resource" : "tag",
    dataType: f.fieldDataType === "float64" || f.fieldDataType === "int64" ? f.fieldDataType : "string"
  };
}
function primaryAgg(spec) {
  return spec.aggregations && spec.aggregations[0] || {};
}
function specToV3Builder(spec, version = "v3") {
  const agg = primaryAgg(spec);
  const metricName = agg.metricName || "";
  const aggregateOperator = (agg.spaceAggregation || agg.timeAggregation || "count").toLowerCase();
  const filterParsed = exprToV3Filters(spec.filter?.expression || "");
  const filters = "error" in filterParsed ? {
    items: [],
    op: "AND",
    _conversionError: filterParsed.error
  } : { items: filterParsed.items, op: filterParsed.op };
  const groupBy = (spec.groupBy || []).map(fieldToAttr);
  const orderBy = (spec.order || []).map((o) => ({
    columnName: o.key?.name || "",
    order: o.direction || "asc"
  }));
  const having = [];
  const havingExpr = String(spec.having?.expression || "").trim();
  if (havingExpr) {
    const hm = havingExpr.match(/^(.+?)\s*(>=|<=|!=|[=><])\s*(.+)$/);
    if (hm) {
      having.push({
        columnName: hm[1].trim(),
        op: hm[2],
        value: hm[3].trim().replaceAll(/^['"]|['"]$/g, "")
      });
    }
  }
  const out = {
    dataSource: spec.signal,
    aggregateOperator,
    aggregateAttribute: {
      key: metricName,
      type: agg.metricType || "",
      dataType: "float64"
    },
    filters: {
      items: filters.items,
      op: filters.op
    },
    groupBy,
    orderBy,
    having,
    legend: spec.legend || "",
    disabled: Boolean(spec.disabled),
    reduceTo: agg.reduceTo || "avg",
    limit: spec.limit,
    stepInterval: spec.stepInterval
  };
  if (version === "v4") {
    out.timeAggregation = agg.timeAggregation || "rate";
    out.spaceAggregation = agg.spaceAggregation || "sum";
  }
  if (spec.functions?.length) {
    out.functions = spec.functions.map((f) => ({
      name: f.name,
      args: normalizeFunctionArgs(String(f.name || ""), f.args)
    }));
  }
  const lb = spec.limitBy;
  if (lb) {
    if (Array.isArray(lb) && lb.length) {
      const keys = lb.map((x) => x?.key || x).filter(Boolean);
      const value = lb[0]?.value != null ? Number(lb[0].value) : void 0;
      out.limitBy = { keys, value };
    } else if (typeof lb === "object" && Array.isArray(lb.keys) && lb.keys.length) {
      out.limitBy = {
        keys: lb.keys.map(String),
        value: lb.value != null ? Number(lb.value) : void 0
      };
    }
  }
  if ("error" in filterParsed) {
    out._filterConversionError = filterParsed.error;
  }
  return out;
}
function requestTypeToPanelType(requestType, signal, opts) {
  if (requestType === "scalar") {
    return opts?.formatTable ? "table" : "value";
  }
  if (requestType === "trace" || signal === "traces") return "trace";
  return REQUEST_TO_PANEL[requestType] || "graph";
}
function toWireSignal(signal) {
  const s = String(signal ?? "").trim().toLowerCase();
  if (s === "logs") return "logs";
  if (s === "metrics" || s === "") return "metrics";
  return "traces";
}
function isBareMetricsOp(expr) {
  const e = expr.trim().toLowerCase();
  return Boolean(e) && !e.includes("(") && /^(avg|sum|min|max|count|rate|increase|last|p\d+)$/.test(e);
}
function optString(v) {
  if (v == null) return void 0;
  const s = String(v);
  return s === "" ? void 0 : s;
}
function toV5MetricAggregation(a, metricMetadata) {
  const metricName = String(a.metricName || "");
  const expr = a.expression != null ? String(a.expression) : "";
  const simple = expr && !expr.includes("(");
  const timeAggregation = String(a.timeAggregation || (simple ? expr : "") || "avg");
  const temporality = String(a.temporality || metricMetadata?.get(metricName)?.temporality || "Unspecified") || "Unspecified";
  const out = {
    metricName,
    temporality,
    timeAggregation,
    spaceAggregation: String(a.spaceAggregation || "avg")
  };
  const reduceTo = optString(a.reduceTo);
  const alias = optString(a.alias);
  if (reduceTo) out.reduceTo = reduceTo;
  if (alias) out.alias = alias;
  if (expr && expr.includes("(")) out.expression = expr;
  return out;
}
function toV5ExpressionAggregation(a) {
  let expression = a.expression != null && String(a.expression).trim() ? String(a.expression).trim() : "";
  if (!expression && a.timeAggregation && String(a.timeAggregation).includes("(")) {
    expression = String(a.timeAggregation).trim();
  }
  if (!expression || isBareMetricsOp(expression)) {
    expression = "count()";
  }
  const out = { expression };
  const alias = optString(a.alias);
  const reduceTo = optString(a.reduceTo);
  if (alias) out.alias = alias;
  if (reduceTo) out.reduceTo = reduceTo;
  return out;
}
function normalizeFilterExpression(expression) {
  if (expression == null) return "";
  let s = String(expression).trim();
  if (!s) return "";
  const vacuousEq = /(?:^|\s+)([A-Z_][\w./-]*)\s*(?:=|!=|LIKE|NOT_LIKE|ILIKE)\s*(?:''|"")(?=\s|$|\))/gi;
  s = s.replaceAll(vacuousEq, " ").replaceAll(/\(\s*\)/g, " ").replaceAll(/\s+(AND|OR)\s+(AND|OR)\s+/gi, " $1 ").replace(/^\s*(?:AND|OR)\s+/i, "").replace(/\s+(?:AND|OR)\s*$/i, "").replaceAll(/\s+/g, " ").trim();
  return s;
}
const LIST_ONLY_ORDER_KEYS = /* @__PURE__ */ new Set(["timestamp", "id"]);
function isAggregationRequestType(requestType) {
  if (requestType === "raw" || requestType === "trace" || requestType === "raw_stream") {
    return false;
  }
  return true;
}
function orderKeyName(entry) {
  if (entry == null) return "";
  if (typeof entry === "string") return entry.trim();
  const o = entry;
  const key = o.key;
  if (key && typeof key === "object") {
    return String(key.name ?? key.key ?? "").trim();
  }
  return String(o.columnName ?? o.name ?? o.key ?? "").trim();
}
function groupByName(entry) {
  if (entry == null) return "";
  if (typeof entry === "string") return entry.trim();
  const o = entry;
  return String(o.name ?? o.key?.name ?? o.key ?? "").trim();
}
function sanitizeV5Order(order, opts) {
  if (!Array.isArray(order) || order.length === 0) return void 0;
  if (!isAggregationRequestType(opts.requestType)) {
    return order;
  }
  const groupByNames = new Set((opts.groupBy || []).map(groupByName).filter(Boolean));
  const aggKeys = /* @__PURE__ */ new Set();
  (opts.aggregations || []).forEach((a, i) => {
    aggKeys.add(String(i));
    if (a?.alias != null && String(a.alias).trim()) {
      aggKeys.add(String(a.alias).trim());
    }
    if (a?.expression != null && String(a.expression).trim()) {
      aggKeys.add(String(a.expression).trim());
    }
  });
  const filtered = order.filter((entry) => {
    const name = orderKeyName(entry);
    if (!name) return false;
    if (LIST_ONLY_ORDER_KEYS.has(name)) return false;
    if (groupByNames.has(name)) return true;
    if (aggKeys.has(name)) return true;
    if (/^\d+$/.test(name)) return true;
    if (name.includes("(")) return true;
    return false;
  });
  return filtered.length ? filtered : void 0;
}
function toV5BuilderSpec(spec, opts) {
  const signal = toWireSignal(spec.signal);
  const requestType = opts?.requestType;
  const rawAggs = Array.isArray(spec.aggregations) ? spec.aggregations : [];
  const aggregations = rawAggs.map((a) => {
    if (signal === "metrics" && a?.metricName) {
      return toV5MetricAggregation(a, opts?.metricMetadata);
    }
    if (signal === "metrics") {
      if (a?.timeAggregation || a?.spaceAggregation) {
        return {
          ...optString(a?.expression) ? { expression: String(a.expression) } : {},
          ...a?.timeAggregation ? { timeAggregation: String(a.timeAggregation) } : {},
          ...a?.spaceAggregation ? { spaceAggregation: String(a.spaceAggregation) } : {},
          ...optString(a?.reduceTo) ? { reduceTo: String(a.reduceTo) } : {},
          ...optString(a?.alias) ? { alias: String(a.alias) } : {}
        };
      }
      return toV5ExpressionAggregation(a || {});
    }
    return toV5ExpressionAggregation(a || {});
  });
  const filterObj = spec.filter && typeof spec.filter === "object" ? spec.filter : {};
  const havingObj = spec.having && typeof spec.having === "object" ? spec.having : {};
  const groupBy = Array.isArray(spec.groupBy) && spec.groupBy.length ? spec.groupBy : void 0;
  const out = {
    name: String(spec.name || "A"),
    signal,
    // null means auto step — must be preserved
    stepInterval: spec.stepInterval === void 0 ? null : spec.stepInterval,
    filter: {
      expression: normalizeFilterExpression(filterObj.expression)
    },
    having: {
      expression: normalizeFilterExpression(havingObj.expression)
    },
    aggregations
  };
  if (spec.disabled) out.disabled = true;
  if (groupBy) out.groupBy = groupBy;
  const sanitizedOrder = sanitizeV5Order(
    Array.isArray(spec.order) ? spec.order : void 0,
    {
      requestType,
      groupBy,
      aggregations
    }
  );
  if (sanitizedOrder) {
    out.order = sanitizedOrder;
  } else if (requestType === "raw" || requestType === "trace" || requestType === "raw_stream") {
    out.order = [{ key: { name: "timestamp" }, direction: "desc" }];
  }
  if (spec.limit != null && spec.limit !== "") out.limit = Number(spec.limit);
  if (spec.offset != null && spec.offset !== "") out.offset = Number(spec.offset);
  if (optString(spec.legend)) out.legend = String(spec.legend);
  if (Array.isArray(spec.functions) && spec.functions.length) out.functions = spec.functions;
  if (optString(spec.source)) out.source = String(spec.source);
  if (Array.isArray(spec.selectColumns) && spec.selectColumns.length)
    out.selectColumns = spec.selectColumns;
  if (Array.isArray(spec.selectFields) && spec.selectFields.length) {
    out.selectFields = spec.selectFields;
  }
  return out;
}
function toV5PromqlSpec(name, query, legend) {
  const out = {
    name,
    query,
    disabled: false
  };
  if (legend) out.legend = legend;
  return out;
}
function toV5ClickHouseSpec(name, query) {
  return {
    name,
    query,
    disabled: false
  };
}
function isDisabled(item) {
  if (item.type === "builder_formula") return Boolean(item.spec.disabled);
  if (item.type === "builder_query") return Boolean(item.spec.disabled);
  if (item.type === "builder_trace_operator") return Boolean(item.spec.disabled);
  if (item.type === "builder_sub_query") return Boolean(item.spec.disabled);
  if (item.type === "builder_join") return Boolean(item.spec.disabled);
  return false;
}
function parseFormulaDeps(expression) {
  const names = expression.match(/\b[A-Z][A-Z0-9_]*\b/g) || [];
  return [...new Set(names)];
}
function endpointFor(profile, signal) {
  if (signal === "logs") return profile.endpoints.logsQuery;
  if (signal === "traces") return profile.endpoints.tracesQuery;
  return profile.endpoints.metricsQuery;
}
function stripEmpty(obj) {
  if (Array.isArray(obj)) return obj.map(stripEmpty).filter((v) => v !== void 0);
  if (obj && typeof obj === "object") {
    const out = {};
    for (const [k, v] of Object.entries(obj)) {
      if (v == null) continue;
      if (typeof v === "string" && v === "") continue;
      if (Array.isArray(v) && v.length === 0) continue;
      if (k === "metricType") continue;
      out[k] = stripEmpty(v);
    }
    return out;
  }
  return obj;
}
function normalizeBuilderAggregation(a, signal, metricMetadata) {
  if (!a || typeof a !== "object") return a;
  if (signal === "metrics") {
    if (a.metricName) {
      return toV5MetricAggregation(a, metricMetadata);
    }
    const out = {};
    if (a.expression != null && String(a.expression) !== "") out.expression = a.expression;
    if (a.timeAggregation != null) out.timeAggregation = a.timeAggregation;
    if (a.spaceAggregation != null) out.spaceAggregation = a.spaceAggregation;
    if (a.reduceTo != null && a.reduceTo !== "") out.reduceTo = a.reduceTo;
    if (a.alias != null && a.alias !== "") out.alias = a.alias;
    return out;
  }
  return toV5ExpressionAggregation(a);
}
function resolveRequestType(query, caps2) {
  const rt = query.requestType || "time_series";
  if (rt === "distribution") {
    if (!caps2?.distribution && !query.apiProfile) ;
  }
  return rt;
}
function assertRequestTypeAllowed(rt, options, caps2) {
  if (rt === "distribution") {
    const ok2 = Boolean(caps2?.distribution || options.experimentalCapabilities?.distribution);
    if (!ok2) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        "distribution requestType 需要 experimentalDistribution capability"
      );
    }
  }
}
function assertGatedItems(items, options, caps2) {
  for (const item of items) {
    if (item.type === "builder_sub_query") {
      const ok2 = Boolean(
        caps2?.builderSubQuery || options.experimentalCapabilities?.builderSubQuery
      );
      if (!ok2) {
        throw new DataSourceError(
          "UNSUPPORTED_CAPABILITY",
          "builder_sub_query 默认禁用，需当前 deployment capability"
        );
      }
    }
    if (item.type === "builder_join") {
      const ok2 = Boolean(caps2?.builderJoin || options.experimentalCapabilities?.builderJoin);
      if (!ok2) {
        throw new DataSourceError(
          "UNSUPPORTED_CAPABILITY",
          "builder_join 默认禁用，需当前 deployment capability"
        );
      }
    }
  }
}
function toTypeSpecItem(item, metricMetadata, requestType) {
  if (item.type === "builder_query") {
    if (item.queryType === "promql") {
      const queryText = String(item.rawQuery ?? "").trim();
      if (!queryText) {
        throw new DataSourceError(
          "INVALID_QUERY",
          `PromQL 查询表达式不能为空（${item.spec.name}）。请填写如 up 的表达式，或切回 Builder。`
        );
      }
      const spec2 = toV5PromqlSpec(item.spec.name, queryText, item.rawLegend || item.spec.legend);
      spec2.disabled = Boolean(item.spec.disabled);
      if (item.step) spec2.step = item.step;
      if (item.stats != null) spec2.stats = item.stats;
      return { type: "promql", spec: spec2 };
    }
    if (item.queryType === "clickhouse_sql") {
      const queryText = String(item.rawQuery ?? "").trim();
      if (!queryText) {
        throw new DataSourceError("INVALID_QUERY", `ClickHouse SQL 不能为空（${item.spec.name}）`);
      }
      const spec2 = toV5ClickHouseSpec(item.spec.name, queryText);
      spec2.disabled = Boolean(item.spec.disabled);
      if (item.rawLegend || item.spec.legend) {
        spec2.legend = item.rawLegend || item.spec.legend;
      }
      return { type: "clickhouse_sql", spec: spec2 };
    }
    const signal = toWireSignal(item.spec.signal);
    const withAggs = {
      ...item.spec,
      signal,
      aggregations: item.spec.aggregations?.length ? item.spec.aggregations : defaultAggregationsForSignal(signal)
    };
    const spec = toV5BuilderSpec(withAggs, {
      metricMetadata,
      requestType
    });
    spec.aggregations = withAggs.aggregations.map(
      (a) => normalizeBuilderAggregation(a, signal, metricMetadata)
    );
    spec.disabled = Boolean(item.spec.disabled);
    if (signal !== "metrics") {
      delete spec.source;
    }
    return {
      type: "builder_query",
      spec
    };
  }
  if (item.type === "builder_formula") {
    const formulaSpec = {
      name: item.spec.name,
      expression: item.spec.expression,
      disabled: Boolean(item.spec.disabled)
    };
    if (item.spec.limit != null) formulaSpec.limit = item.spec.limit;
    if (item.spec.legend) formulaSpec.legend = item.spec.legend;
    if (item.spec.order) formulaSpec.order = item.spec.order;
    return {
      type: "builder_formula",
      spec: formulaSpec
    };
  }
  if (item.type === "builder_trace_operator") {
    return {
      type: "builder_trace_operator",
      spec: toV5BuilderSpec(item.spec, { requestType })
    };
  }
  if (item.type === "builder_sub_query") {
    return {
      type: "builder_sub_query",
      spec: toV5BuilderSpec(
        {
          ...item.spec,
          signal: item.spec.signal || "traces"
        },
        { requestType }
      )
    };
  }
  if (item.type === "builder_join") {
    return {
      type: "builder_join",
      spec: {
        ...toV5BuilderSpec(
          {
            ...item.spec,
            signal: item.spec.signal || "traces"
          },
          { requestType }
        ),
        // join-specific whitelist
        ...item.spec.on != null ? { on: item.spec.on } : {},
        ...item.spec.joinType != null ? { joinType: item.spec.joinType } : {},
        ...item.spec.left != null ? { left: item.spec.left } : {},
        ...item.spec.right != null ? { right: item.spec.right } : {}
      }
    };
  }
  throw new DataSourceError("INVALID_QUERY", `未知 query item type`);
}
function primarySignal(items) {
  for (const item of items) {
    if (item.type === "builder_query") return item.spec.signal;
  }
  return "metrics";
}
function buildSigNozRequests(input) {
  const { profile, options, query, fromMs, toMs: toMs2, intervalMs, metricMetadata, capabilities } = input;
  const stepSec = Math.max(1, Math.round((intervalMs || 6e4) / 1e3));
  const items = (query.queries || []).filter((q) => !isDisabled(q));
  const caps2 = {
    builderSubQuery: capabilities?.builderSubQuery ?? options.experimentalCapabilities?.builderSubQuery,
    builderJoin: capabilities?.builderJoin ?? options.experimentalCapabilities?.builderJoin,
    distribution: capabilities?.distribution ?? options.experimentalCapabilities?.distribution
  };
  assertGatedItems(items, options, caps2);
  const formulas = items.filter((i) => i.type === "builder_formula");
  const queries = items.filter((i) => i.type === "builder_query");
  const out = [];
  if (profile.id === "prometheus-compatible") {
    for (const q of queries) {
      if (q.queryType !== "promql") {
        throw new DataSourceError(
          "UNSUPPORTED_QUERY_API",
          `prometheus-compatible 不支持 ${q.queryType}`
        );
      }
      const expr = String(q.rawQuery || "");
      if (!profile.endpoints.metricsQuery) {
        throw new DataSourceError("UNSUPPORTED_QUERY_API", "缺少 metrics endpoint");
      }
      out.push({
        requestKey: `prom:${q.spec.name}`,
        queryNames: [q.spec.name],
        signal: "metrics",
        path: profile.endpoints.metricsQuery.path,
        method: profile.endpoints.metricsQuery.method || "GET",
        query: {
          query: expr,
          start: Math.floor(fromMs / 1e3),
          end: Math.floor(toMs2 / 1e3),
          step: stepSec,
          ...q.stats ? { stats: true } : {}
        }
      });
    }
    for (const f of formulas) {
      out.push({
        requestKey: `formula:${f.spec.name}`,
        queryNames: [f.spec.name],
        signal: "metrics",
        path: "",
        method: "GET",
        localFormula: {
          name: f.spec.name,
          expression: f.spec.expression,
          dependsOn: parseFormulaDeps(f.spec.expression)
        }
      });
    }
    return out;
  }
  if (isV5WireProfile(profile.id)) {
    if (!items.length) return out;
    const signal = primarySignal(items);
    const ep = endpointFor(profile, signal) || profile.endpoints.metricsQuery;
    if (!ep?.path) {
      throw new DataSourceError("UNSUPPORTED_QUERY_API", `${profile.id} 缺少 query_range`);
    }
    const requestType = resolveRequestType(query, caps2);
    assertRequestTypeAllowed(requestType, options, caps2);
    const compositeQueries = items.map((item) => toTypeSpecItem(item, metricMetadata, requestType));
    const variables = {
      SIGNOZ_START: { value: String(fromMs) },
      SIGNOZ_END: { value: String(toMs2) }
    };
    if (options.organizationId)
      variables.SIGNOZ_ORGANIZATION_ID = { value: options.organizationId };
    if (options.defaultEnvironment)
      variables.SIGNOZ_ENVIRONMENT = { value: options.defaultEnvironment };
    const formatOptions = {
      formatTableResultForUI: Boolean(query.formatOptions?.formatTableResultForUI),
      fillGaps: query.formatOptions?.fillGaps === true
      // default false
    };
    const body = {
      schemaVersion: "v1",
      start: fromMs,
      end: toMs2,
      requestType,
      compositeQuery: { queries: compositeQueries },
      formatOptions,
      variables
    };
    if (query.noCache) body.noCache = true;
    out.push({
      requestKey: `${profile.id}:composite`,
      queryNames: items.map((i) => i.spec?.name || i.type),
      signal,
      path: ep.path,
      method: ep.method || "POST",
      body
    });
    return out;
  }
  const groups = /* @__PURE__ */ new Map();
  for (const q of queries) {
    const key = `${q.spec.signal}:${q.queryType}`;
    const arr = groups.get(key) || [];
    arr.push(q);
    groups.set(key, arr);
  }
  for (const [key, group] of groups) {
    const signal = group[0].spec.signal;
    const mode2 = group[0].queryType;
    const ep = endpointFor(profile, signal);
    if (!ep?.path) {
      throw new DataSourceError(
        "UNSUPPORTED_QUERY_API",
        `profile ${profile.id} 未配置 ${signal} endpoint`
      );
    }
    const builderQueries = {};
    const promQueries = {};
    const chQueries = {};
    for (const q of group) {
      if (mode2 === "promql") {
        promQueries[q.spec.name] = {
          query: q.rawQuery || "",
          disabled: false,
          legend: q.rawLegend || q.spec.legend || ""
        };
      } else if (mode2 === "clickhouse_sql") {
        chQueries[q.spec.name] = {
          query: q.rawQuery || "",
          disabled: false,
          legend: q.rawLegend || ""
        };
      } else {
        const version = profile.id === "signoz-v4" ? "v4" : "v3";
        builderQueries[q.spec.name] = stripEmpty(
          specToV3Builder(q.spec, version)
        );
      }
    }
    const requestType = resolveRequestType(query, caps2);
    const compositeQuery = {
      queryType: mode2 === "promql" ? "promql" : mode2 === "clickhouse_sql" ? "clickhouse_sql" : "builder",
      panelType: requestTypeToPanelType(requestType, signal, {
        formatTable: Boolean(query.formatOptions?.formatTableResultForUI)
      })
    };
    if (Object.keys(builderQueries).length) compositeQuery.builderQueries = builderQueries;
    if (Object.keys(promQueries).length) compositeQuery.promQueries = promQueries;
    if (Object.keys(chQueries).length) compositeQuery.chQueries = chQueries;
    const body = {
      start: fromMs,
      end: toMs2,
      step: stepSec,
      compositeQuery
    };
    if (options.organizationId) body.organizationId = options.organizationId;
    if (options.defaultEnvironment) body.environment = options.defaultEnvironment;
    out.push({
      requestKey: `${profile.id}:${key}`,
      queryNames: group.map((g) => g.spec.name),
      signal,
      path: ep.path,
      method: ep.method || "POST",
      body: profile.id === "custom" ? {
        start: fromMs,
        end: toMs2,
        signal,
        // Whitelist only — never spread editor/queryBuilder bags onto wire.
        queries: group.map((g) => toTypeSpecItem(g, metricMetadata, requestType))
      } : body
    });
  }
  for (const f of formulas) {
    out.push({
      requestKey: `formula:${f.spec.name}`,
      queryNames: [f.spec.name],
      signal: "metrics",
      path: "",
      method: "GET",
      localFormula: {
        name: f.spec.name,
        expression: f.spec.expression,
        dependsOn: parseFormulaDeps(f.spec.expression)
      }
    });
  }
  return out;
}
function buildRequestNodes(built) {
  const nodes = built.map((req, index2) => {
    if (req.localFormula) {
      return {
        index: index2,
        kind: "formula",
        req,
        produces: [req.localFormula.name, ...req.queryNames],
        dependsOn: [...req.localFormula.dependsOn || []]
      };
    }
    return {
      index: index2,
      kind: "network",
      req,
      produces: [...req.queryNames],
      dependsOn: []
    };
  });
  const produced = /* @__PURE__ */ new Set();
  for (const n of nodes) for (const p of n.produces) produced.add(p);
  const diagnostics = { cycles: [], missingDeps: [] };
  for (const n of nodes) {
    if (n.kind !== "formula") continue;
    const missing = n.dependsOn.filter((d) => !produced.has(d));
    if (missing.length) {
      diagnostics.missingDeps.push({
        formula: n.req.localFormula?.name || n.req.requestKey,
        missing
      });
    }
  }
  const byName = /* @__PURE__ */ new Map();
  for (const n of nodes) {
    for (const p of n.produces) byName.set(p, n);
  }
  const visiting = /* @__PURE__ */ new Set();
  const visited = /* @__PURE__ */ new Set();
  function dfs(name, stack) {
    if (visiting.has(name)) {
      diagnostics.cycles.push([...stack, name].join("→"));
      return;
    }
    if (visited.has(name)) return;
    visiting.add(name);
    const node = byName.get(name);
    if (node) {
      for (const d of node.dependsOn) dfs(d, [...stack, name]);
    }
    visiting.delete(name);
    visited.add(name);
  }
  for (const n of nodes) {
    for (const p of n.produces) dfs(p, []);
  }
  return { nodes, diagnostics };
}
function assertScheduleValid(diagnostics) {
  if (diagnostics.cycles.length) {
    throw new DataSourceError("INVALID_QUERY", `formula 依赖成环: ${diagnostics.cycles[0]}`);
  }
  if (diagnostics.missingDeps.length) {
    const m = diagnostics.missingDeps[0];
    throw new DataSourceError(
      "INVALID_QUERY",
      `formula ${m.formula} 缺少依赖: ${m.missing.join(", ")}`
    );
  }
}
async function runRequestNodes(opts) {
  const { nodes, maxConcurrent, signal, runNode, onPartialOrdered } = opts;
  const n = nodes.length;
  const results = new Array(n);
  const done = new Array(n).fill(false);
  const completedNames = /* @__PURE__ */ new Set();
  let inFlight = 0;
  let finished = 0;
  function depsReady(node) {
    return node.dependsOn.every((d) => completedNames.has(d));
  }
  function emitPartial() {
    if (!onPartialOrdered) return;
    const ordered = [];
    for (let i = 0; i < n; i++) {
      if (!done[i] || results[i] === void 0) continue;
      ordered.push({ index: i, value: results[i] });
    }
    onPartialOrdered(ordered);
  }
  return new Promise((resolve, reject) => {
    let settled = false;
    const fail = (err) => {
      if (settled) return;
      settled = true;
      reject(err);
    };
    const succeed = () => {
      if (settled) return;
      settled = true;
      resolve(results);
    };
    const onAbort = () => {
      fail(new DOMException("Aborted", "AbortError"));
    };
    if (signal?.aborted) {
      onAbort();
      return;
    }
    signal?.addEventListener("abort", onAbort, { once: true });
    function pump() {
      if (settled) return;
      if (signal?.aborted) {
        onAbort();
        return;
      }
      let progressed = true;
      while (progressed) {
        progressed = false;
        for (let i = 0; i < n; i++) {
          if (done[i] || results[i] !== void 0) continue;
        }
        for (let i = 0; i < n; i++) {
          const node = nodes[i];
          if (done[i] || running.has(i)) continue;
          if (!depsReady(node)) continue;
          if (inFlight >= Math.max(1, maxConcurrent)) break;
          running.add(i);
          inFlight += 1;
          progressed = true;
          void Promise.resolve().then(() => runNode(node, signal)).then((value) => {
            if (settled || signal?.aborted) {
              inFlight -= 1;
              running.delete(i);
              if (signal?.aborted) onAbort();
              return;
            }
            results[i] = value;
            done[i] = true;
            finished += 1;
            for (const p of node.produces) completedNames.add(p);
            inFlight -= 1;
            running.delete(i);
            emitPartial();
            if (finished >= n) {
              signal?.removeEventListener("abort", onAbort);
              succeed();
              return;
            }
            pump();
          }).catch((error) => {
            inFlight -= 1;
            running.delete(i);
            signal?.removeEventListener("abort", onAbort);
            fail(error);
          });
        }
      }
      if (!settled && inFlight === 0 && finished < n) {
        const pending2 = nodes.filter((_, i) => !done[i]);
        fail(
          new DataSourceError(
            "INVALID_QUERY",
            `无法调度剩余查询节点: ${pending2.map((p) => p.req.requestKey).join(", ")}`
          )
        );
      }
    }
    const running = /* @__PURE__ */ new Set();
    if (n === 0) {
      succeed();
      return;
    }
    pump();
  });
}
function asMetricFind(values) {
  return values.map((v) => ({ text: v, value: v }));
}
function withAllOption(values, includeAll) {
  if (!includeAll) return values;
  return ["__all__", ...values.filter((v) => v !== "__all__")];
}
async function runSigNozVariableQuery(api, query, opts = {}) {
  let q;
  if (typeof query === "string") {
    try {
      q = JSON.parse(query);
    } catch {
      q = { type: "service", search: query };
    }
  } else {
    q = query || { type: "service" };
  }
  const type = String(q.type || "service");
  const search = q.search != null ? String(q.search) : void 0;
  const includeAll = Boolean(q.includeAll || q.allValue === "__all__");
  switch (type) {
    case "environment": {
      const res = await api.getMetadata(
        {
          type: "attributeValues",
          key: "deployment.environment",
          signal: "traces",
          search
        },
        opts.signal
      );
      const values = res.type === "attributeValues" ? res.values : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "service": {
      const res = await api.getMetadata({ type: "services", search }, opts.signal);
      const values = res.type === "services" ? res.values : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "operation": {
      const service = String(q.service || "");
      if (!service) return [];
      const res = await api.getMetadata({ type: "operations", service, search }, opts.signal);
      const values = res.type === "operations" ? res.values : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "metric": {
      const res = await api.getMetadata({ type: "metrics", search }, opts.signal);
      const values = res.type === "metrics" ? res.values.map((m) => m.metricName) : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "attributeKey": {
      const signal = q.signal || "metrics";
      const res = await api.getMetadata(
        {
          type: "attributeKeys",
          signal,
          metricName: q.metricName,
          search
        },
        opts.signal
      );
      const values = res.type === "attributeKeys" ? res.values.map((f) => f.name) : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "attributeValue": {
      const key = String(q.key || "");
      if (!key) return [];
      const signal = q.signal || "metrics";
      const res = await api.getMetadata(
        { type: "attributeValues", key, signal, search },
        opts.signal
      );
      const values = res.type === "attributeValues" ? res.values : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "dynamic": {
      const key = String(q.field || q.key || "");
      const signal = q.source || q.signal || "metrics";
      if (!key) return [];
      const res = await api.getMetadata(
        { type: "attributeValues", key, signal, search },
        opts.signal
      );
      const values = res.type === "attributeValues" ? res.values : [];
      return asMetricFind(withAllOption(values, includeAll));
    }
    case "clickhouse_query": {
      const sql = String(q.query || q.sql || "").trim();
      if (!sql) return [];
      if (!opts.runClickHouseVariable) {
        throw new DataSourceError(
          "UNSUPPORTED_CAPABILITY",
          "ClickHouse 变量需要 variablesQuery endpoint（/api/v2/variables/query）"
        );
      }
      const values = await opts.runClickHouseVariable(sql, opts.signal);
      return asMetricFind(withAllOption(values, includeAll));
    }
    default:
      throw new DataSourceError("INVALID_QUERY", `未知变量类型 ${type}`);
  }
}
function emptyTypedFrame(signal, _uid) {
  return createDataFrame({
    fields: [
      { name: "Time", type: "time", values: [] },
      { name: "TimeEnd", type: "time", values: [] },
      { name: "Text", type: "string", values: [] },
      { name: "Tags", type: "string", values: [] },
      { name: "signal", type: "string", values: [] },
      { name: "traceId", type: "string", values: [] },
      { name: "spanId", type: "string", values: [] },
      { name: "alertId", type: "string", values: [] },
      { name: "DatasourceUid", type: "string", values: [] }
    ],
    meta: { signal, source: "annotation" }
  });
}
function fieldValues(frame, names) {
  for (const n of names) {
    const f = frame.fields.find((x) => x.name === n || x.name.toLowerCase() === n.toLowerCase());
    if (f?.values?.length) return f.values;
  }
  return [];
}
function normalizeToAnnotationFrames(frames, signal, uid, fallbackText) {
  if (!frames.length) return [emptyTypedFrame(signal)];
  const times = [];
  const ends = [];
  const texts = [];
  const tags = [];
  const signals = [];
  const traceIds = [];
  const spanIds = [];
  const alertIds = [];
  const uids = [];
  for (const fr of frames) {
    const n = Math.max(...fr.fields.map((f) => f.values?.length || 0), 0);
    const t2 = fieldValues(fr, ["Time", "time", "timestamp", "startTime"]);
    const te = fieldValues(fr, ["TimeEnd", "timeEnd", "endTime"]);
    const tx = fieldValues(fr, ["Text", "text", "title", "Line", "message", "name", "body"]);
    const tg = fieldValues(fr, ["Tags", "tags", "service", "severity", "service.name"]);
    const tr = fieldValues(fr, ["traceId", "trace_id", "TraceId"]);
    const sp = fieldValues(fr, ["spanId", "span_id", "SpanId"]);
    const al = fieldValues(fr, ["alertId", "id", "AlertId"]);
    for (let i = 0; i < n; i++) {
      times.push(Number(t2[i] ?? Date.now()));
      ends.push(te[i] != null ? Number(te[i]) : null);
      texts.push(String(tx[i] ?? fallbackText));
      tags.push(String(tg[i] ?? ""));
      signals.push(signal);
      traceIds.push(String(tr[i] ?? ""));
      spanIds.push(String(sp[i] ?? ""));
      alertIds.push(String(al[i] ?? ""));
      uids.push(uid);
    }
  }
  if (!times.length) return [emptyTypedFrame(signal)];
  return [
    createDataFrame({
      fields: [
        { name: "Time", type: "time", values: times },
        { name: "TimeEnd", type: "time", values: ends },
        { name: "Text", type: "string", values: texts },
        { name: "Tags", type: "string", values: tags },
        { name: "signal", type: "string", values: signals },
        { name: "traceId", type: "string", values: traceIds },
        { name: "spanId", type: "string", values: spanIds },
        { name: "alertId", type: "string", values: alertIds },
        { name: "DatasourceUid", type: "string", values: uids }
      ],
      meta: { signal, source: "annotation" }
    })
  ];
}
function serviceFilter(service) {
  if (!service) return "";
  return `service.name = '${service.replaceAll("'", "\\'")}'`;
}
function andExpr(...parts) {
  return parts.filter(Boolean).join(" AND ");
}
async function querySigNozAnnotations(api, target, range, options) {
  const uid = options?.datasourceUid || "";
  const signal = options?.signal;
  const svc = target.service || "";
  if (target.source === "firingAlerts") {
    if (!options?.alertsCapable) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        "firing alerts 需要 alertsQuery capability（不生成占位 marker）"
      );
    }
    const res = await api.getMetadata(
      {
        type: "alerts",
        fromMs: range.fromMs,
        toMs: range.toMs,
        service: target.service,
        environment: target.environment
      },
      signal
    );
    return normalizeToAnnotationFrames(res.frames || [], "alerts", uid, "firing alert");
  }
  if (target.source === "errorSpans") {
    const filter22 = andExpr("hasError = true", serviceFilter(svc));
    if (options?.runRawQuery) {
      const frames = await options.runRawQuery({
        signal: "traces",
        filterExpression: filter22 || "hasError = true",
        fromMs: range.fromMs,
        toMs: range.toMs,
        abort: signal
      });
      return normalizeToAnnotationFrames(frames, "traces", uid, "error span");
    }
    return [
      createDataFrame({
        fields: [
          { name: "Time", type: "time", values: [range.fromMs] },
          { name: "TimeEnd", type: "time", values: [range.toMs] },
          {
            name: "Text",
            type: "string",
            values: [svc ? `error span service=${svc}` : "error span"]
          },
          { name: "Tags", type: "string", values: [svc || "error"] },
          { name: "signal", type: "string", values: ["traces"] },
          { name: "traceId", type: "string", values: [""] },
          { name: "spanId", type: "string", values: [""] },
          { name: "alertId", type: "string", values: [""] },
          { name: "DatasourceUid", type: "string", values: [uid] }
        ],
        meta: {
          signal: "traces",
          source: "annotation",
          filter: {
            expression: filter22 || "hasError = true",
            service: svc || void 0
          },
          fromMs: range.fromMs,
          toMs: range.toMs,
          offline: true
        }
      })
    ];
  }
  const filter2 = andExpr(
    "(severity_text = 'ERROR' OR severity = 'ERROR' OR level = 'error')",
    serviceFilter(svc)
  );
  if (options?.runRawQuery) {
    const frames = await options.runRawQuery({
      signal: "logs",
      filterExpression: filter2,
      fromMs: range.fromMs,
      toMs: range.toMs,
      abort: signal
    });
    return normalizeToAnnotationFrames(frames, "logs", uid, "error log");
  }
  return [
    createDataFrame({
      fields: [
        { name: "Time", type: "time", values: [range.fromMs] },
        { name: "TimeEnd", type: "time", values: [range.toMs] },
        {
          name: "Text",
          type: "string",
          values: [svc ? `error log service=${svc}` : "error log"]
        },
        { name: "Tags", type: "string", values: [svc || "error"] },
        { name: "signal", type: "string", values: ["logs"] },
        { name: "traceId", type: "string", values: [""] },
        { name: "spanId", type: "string", values: [""] },
        { name: "alertId", type: "string", values: [""] },
        { name: "DatasourceUid", type: "string", values: [uid] }
      ],
      meta: {
        signal: "logs",
        source: "annotation",
        filter: { expression: filter2, service: svc || void 0 },
        fromMs: range.fromMs,
        toMs: range.toMs,
        offline: true
      }
    })
  ];
}
let sessionSeq = 1;
function parseSseChunk(buffer, onEvent) {
  const normalized = buffer.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
  const parts = normalized.split("\n\n");
  const incomplete = parts.pop() ?? "";
  for (const block of parts) {
    if (!block.trim()) continue;
    let event = "message";
    let id;
    const dataLines = [];
    for (const line of block.split("\n")) {
      if (!line || line.startsWith(":")) continue;
      if (line.startsWith("event:")) {
        event = line.slice(6).trim();
      } else if (line.startsWith("data:")) {
        dataLines.push(line.slice(5).replace(/^\s/, ""));
      } else if (line.startsWith("id:")) {
        id = line.slice(3).trim();
      }
    }
    if (dataLines.length || event === "error") {
      onEvent({ event, data: dataLines.join("\n"), id });
    }
  }
  return incomplete;
}
function parseLiveTailDataPayload(data) {
  if (!data) return null;
  try {
    const parsed = JSON.parse(data);
    const ts = Number(
      parsed.timestamp ?? parsed.time ?? parsed.ts ?? (parsed.data && parsed.data.timestamp) ?? Date.now()
    );
    const body = parsed.data !== void 0 ? parsed.data : parsed;
    const rowId = stableRowId(ts, body, parsed.id);
    return { timestamp: ts, data: body, rowId };
  } catch {
    const ts = Date.now();
    return { timestamp: ts, data, rowId: stableRowId(ts, data) };
  }
}
function stableRowId(timestamp, data, hint) {
  if (hint) return `${timestamp}:${hint}`;
  if (data && typeof data === "object") {
    const o = data;
    const id = o.id ?? o.uuid ?? o.log_id ?? o.span_id ?? o.spanId;
    if (id != null) return `${timestamp}:${String(id)}`;
    const line = o.body ?? o.message ?? o.line;
    if (line != null) return `${timestamp}:${hashShort(String(line))}`;
  }
  return `${timestamp}:${hashShort(JSON.stringify(data))}`;
}
function hashShort(s) {
  let h2 = 0;
  for (let i = 0; i < s.length; i++) h2 = Math.imul(31, h2) + s.charCodeAt(i) | 0;
  return (h2 >>> 0).toString(16);
}
function defaultSleep(ms, signal) {
  return new Promise((resolve, reject) => {
    if (signal.aborted) {
      reject(new DataSourceError("CANCELLED", "实时日志已取消"));
      return;
    }
    const t2 = setTimeout(() => {
      signal.removeEventListener("abort", onAbort);
      resolve();
    }, ms);
    const onAbort = () => {
      clearTimeout(t2);
      reject(new DataSourceError("CANCELLED", "实时日志已取消"));
    };
    signal.addEventListener("abort", onAbort, { once: true });
  });
}
function resolveLiveTailTransport(caps2) {
  if (caps2.sseVerified && caps2.liveTailPath) return "sse";
  if (caps2.legacySseEnabled && caps2.legacyLiveTailPath) return "sse";
  if (caps2.cursorPoll) return "cursor_poll";
  return "none";
}
function createLiveTailSession(config2) {
  const sessionId = sessionSeq++;
  const maxRows = Math.max(100, config2.maxRows ?? 5e3);
  const pollIntervalMs = Math.max(200, config2.pollIntervalMs ?? 2e3);
  const maxRetries = config2.maxRetries ?? 8;
  const sleep2 = config2.sleep || defaultSleep;
  let state2 = "idle";
  let transport = resolveLiveTailTransport(config2.capabilities);
  let controller = null;
  let rows = new Array(maxRows);
  let rowStart = 0;
  let rowCount = 0;
  const seen = /* @__PURE__ */ new Set();
  const materializeRows = () => {
    if (rowCount === 0) return [];
    const out = new Array(rowCount);
    for (let i = 0; i < rowCount; i++) {
      out[i] = rows[(rowStart + i) % maxRows];
    }
    return out;
  };
  let lastTimestamp = config2.startMs;
  let nextCursor = null;
  let retryCount = 0;
  let paused = false;
  let runToken = 0;
  const setState2 = (s, detail) => {
    state2 = s;
    config2.onState?.(s, detail);
  };
  const isCurrent = (token) => token === runToken && controller != null && !controller.signal.aborted;
  const pushRows = (incoming) => {
    if (!incoming.length) return;
    const fresh = [];
    for (const r of incoming) {
      if (seen.has(r.rowId)) continue;
      seen.add(r.rowId);
      fresh.push(r);
      if (r.timestamp > lastTimestamp) lastTimestamp = r.timestamp;
    }
    if (!fresh.length) return;
    for (const r of fresh) {
      if (rowCount === maxRows) {
        const old = rows[rowStart];
        seen.delete(old.rowId);
        rowStart = (rowStart + 1) % maxRows;
        rowCount -= 1;
      }
      rows[(rowStart + rowCount) % maxRows] = r;
      rowCount += 1;
    }
    config2.onRows?.(fresh, { sessionId, transport });
  };
  const cancelActive = () => {
    runToken += 1;
    if (controller) {
      controller.abort();
      controller = null;
    }
  };
  async function runSse(token) {
    if (!config2.fetchStream) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        "SSE 实时日志需要 fetchStream（API 密钥或 Bearer 凭据不能使用 EventSource）"
      );
    }
    const path = config2.capabilities.sseVerified && config2.capabilities.liveTailPath ? config2.capabilities.liveTailPath : config2.capabilities.legacyLiveTailPath;
    const query = {
      start: String(lastTimestamp || config2.startMs),
      filter: config2.filterExpression || ""
    };
    setState2("connecting");
    const res = await config2.fetchStream({
      path,
      query,
      signal: controller.signal
    });
    if (!isCurrent(token)) return;
    const ct = String(
      res.headers?.get?.("content-type") || res.headers?.get?.("Content-Type") || ""
    );
    if (!ct.includes("text/event-stream")) {
      throw new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        `实时日志的 Content-Type 必须为 text/event-stream，实际为 ${ct || "空值"}`
      );
    }
    if (!res.body || typeof res.body.getReader !== "function") {
      throw new DataSourceError("INVALID_RESPONSE", "SSE 响应体不可读");
    }
    setState2("live");
    retryCount = 0;
    const reader = res.body.getReader();
    const decoder = new TextDecoder();
    let buf = "";
    while (isCurrent(token)) {
      if (paused) {
        setState2("paused");
        await sleep2(100, controller.signal);
        continue;
      }
      if (state2 === "paused") setState2("live");
      const { done, value } = await reader.read();
      if (!isCurrent(token)) return;
      if (done) break;
      buf += decoder.decode(value, { stream: true });
      buf = parseSseChunk(buf, (ev) => {
        if (!isCurrent(token)) return;
        if (ev.event === "error") {
          throw new DataSourceError("UPSTREAM_ERROR", ev.data || "SSE 事件返回错误");
        }
        const row = parseLiveTailDataPayload(ev.data);
        if (row) pushRows([row]);
      });
    }
  }
  async function runCursorPoll(token) {
    if (!config2.fetchCursorPage) {
      throw new DataSourceError("UNSUPPORTED_CAPABILITY", "游标轮询需要 fetchCursorPage");
    }
    setState2("connecting");
    setState2("live");
    retryCount = 0;
    let firstPageDone = false;
    while (isCurrent(token)) {
      if (paused) {
        setState2("paused");
        await sleep2(100, controller.signal);
        continue;
      }
      if (state2 === "paused") setState2("live");
      const page = await config2.fetchCursorPage({
        cursor: nextCursor,
        startMs: lastTimestamp || config2.startMs,
        signal: controller.signal
      });
      if (!isCurrent(token) || controller.signal.aborted) return;
      pushRows(page.rows || []);
      if (page.nextCursor) {
        nextCursor = page.nextCursor;
        firstPageDone = true;
      } else if (!firstPageDone) {
        firstPageDone = true;
        if (!page.rows?.length) {
          throw new DataSourceError(
            "UNSUPPORTED_CAPABILITY",
            "无 SSE 且无 nextCursor，不能循环重拉第一页"
          );
        }
      } else if (!page.nextCursor && !page.rows?.length) ;
      await sleep2(pollIntervalMs, controller.signal);
      if (!nextCursor && firstPageDone && !page.rows?.length) ;
    }
  }
  async function loop() {
    const token = runToken;
    transport = resolveLiveTailTransport(config2.capabilities);
    if (transport === "none") {
      setState2("error", "UNSUPPORTED_CAPABILITY");
      const err = new DataSourceError(
        "UNSUPPORTED_CAPABILITY",
        "实时日志需要已验证的 SSE 或游标轮询能力"
      );
      config2.onError?.(err, sessionId);
      return;
    }
    while (isCurrent(token) && state2 !== "stopped") {
      try {
        if (transport === "sse") await runSse(token);
        else await runCursorPoll(token);
        if (isCurrent(token) && !paused) {
          setState2("retrying");
          retryCount += 1;
          if (retryCount > maxRetries) {
            setState2("error", "已达最大重试次数");
            config2.onError?.(
              new DataSourceError("UPSTREAM_ERROR", "实时日志已达最大重试次数"),
              sessionId
            );
            return;
          }
          const backoff = Math.min(3e4, 500 * 2 ** Math.min(retryCount, 6));
          await sleep2(backoff, controller.signal);
        }
      } catch (error) {
        if (!isCurrent(token)) return;
        if (error?.code === "CANCELLED" || /abort/i.test(String(error?.message || ""))) return;
        retryCount += 1;
        if (retryCount > maxRetries) {
          setState2("error", error?.message || "实时日志出错");
          config2.onError?.(error instanceof Error ? error : new Error(String(error)), sessionId);
          return;
        }
        setState2("retrying", error?.message);
        const backoff = Math.min(3e4, 500 * 2 ** Math.min(retryCount, 6));
        try {
          await sleep2(backoff, controller.signal);
        } catch {
          return;
        }
      }
    }
  }
  return {
    get sessionId() {
      return sessionId;
    },
    get state() {
      return state2;
    },
    get transport() {
      return transport;
    },
    get rows() {
      return materializeRows();
    },
    async start() {
      cancelActive();
      paused = false;
      controller = new AbortController();
      void loop();
    },
    pause() {
      paused = true;
      if (state2 === "live" || state2 === "connecting") setState2("paused");
    },
    resume() {
      if (state2 === "stopped" || state2 === "idle") return;
      paused = false;
      if (state2 === "paused") setState2("live");
    },
    stop() {
      paused = false;
      cancelActive();
      setState2("stopped");
    },
    dispose() {
      paused = false;
      cancelActive();
      setState2("stopped");
      rows = [];
      seen.clear();
    }
  };
}
const MAX_EXPORT_BYTES = 50 * 1024 * 1024;
const MAX_PAGES = 1e4;
function isHtmlContentType(ct) {
  return /text\/html/i.test(ct);
}
function isJsonContentType(ct) {
  return /application\/json|text\/json|\+json/i.test(ct);
}
function looksLikeErrorJson(text) {
  try {
    const o = JSON.parse(text);
    if (o && typeof o === "object") {
      if (o.error || o.errors || o.status === "error" || o.success === false) return true;
    }
  } catch {
  }
  return false;
}
function redactSecrets(value, depth = 0) {
  if (depth > 12) return "[MaxDepth]";
  if (value == null) return value;
  if (Array.isArray(value)) return value.map((v) => redactSecrets(v, depth + 1));
  if (typeof value !== "object") return value;
  const out = {};
  for (const [k, v] of Object.entries(value)) {
    if (/token|password|secret|authorization|api[_-]?key|credential/i.test(k)) {
      out[k] = "[REDACTED]";
    } else {
      out[k] = redactSecrets(v, depth + 1);
    }
  }
  return out;
}
function framesToCsv(frames) {
  const lines = [];
  for (const fr of frames) {
    const names = fr.fields.map((f) => f.name);
    lines.push(names.map(csvEscape).join(","));
    const n = fr.fields[0]?.values?.length || 0;
    for (let i = 0; i < n; i++) {
      lines.push(
        fr.fields.map((f) => {
          const v = f.values?.[i];
          if (v == null) return "";
          if (typeof v === "object") return csvEscape(stableJson(v));
          return csvEscape(String(v));
        }).join(",")
      );
    }
    lines.push("");
  }
  return lines.join("\n");
}
function csvEscape(s) {
  if (/[",\n\r]/.test(s)) return `"${s.replaceAll('"', '""')}"`;
  return s;
}
function stableJson(value) {
  return JSON.stringify(redactSecrets(value), (_k, v) => {
    if (v && typeof v === "object" && !Array.isArray(v)) {
      const o = v;
      const sorted = {};
      for (const k of Object.keys(o).sort()) sorted[k] = o[k];
      return sorted;
    }
    return v;
  });
}
async function exportUpstreamRaw(args) {
  const res = await args.http({
    path: args.path,
    method: "POST",
    body: args.body,
    signal: args.signal
  });
  const status = Number(res.status || 0);
  if (status < 200 || status >= 300) {
    throw new DataSourceError("UPSTREAM_ERROR", `export_raw_data HTTP ${status} 导出请求失败`, {
      status
    });
  }
  const headers = res.headers;
  const getHeader = (name) => {
    if (!headers) return "";
    if (typeof headers.get === "function")
      return String(headers.get(name) || "");
    const h2 = headers;
    return String(h2[name] || h2[name.toLowerCase()] || "");
  };
  const ct = getHeader("content-type") || getHeader("Content-Type");
  if (isHtmlContentType(ct)) {
    throw new DataSourceError("INVALID_RESPONSE", "export 返回 HTML，不能当作导出成功");
  }
  let body;
  let size;
  if (typeof res.data === "string") {
    if (isJsonContentType(ct) && looksLikeErrorJson(res.data)) {
      throw new DataSourceError("UPSTREAM_ERROR", "导出返回错误 JSON");
    }
    body = res.data;
    size = new TextEncoder().encode(res.data).byteLength;
  } else if (res.data instanceof Uint8Array) {
    body = res.data;
    size = res.data.byteLength;
  } else if (res.data && typeof res.data === "object") {
    if (res.data.error || res.data.success === false) {
      throw new DataSourceError("UPSTREAM_ERROR", "导出返回错误 JSON 对象");
    }
    body = stableJson(res.data);
    size = new TextEncoder().encode(body).byteLength;
  } else {
    body = String(res.data ?? "");
    size = body.length;
  }
  if (size > MAX_EXPORT_BYTES) {
    throw new DataSourceError("INVALID_RESPONSE", `export 超过 size limit ${MAX_EXPORT_BYTES}`);
  }
  const cd = getHeader("content-disposition") || getHeader("Content-Disposition");
  const filename = /filename\*?=(?:UTF-8''|")?([^";]+)/i.exec(cd)?.[1] || args.filenameHint || `signoz-export-${Date.now()}.raw`;
  return {
    mode: "upstream",
    filename: decodeURIComponent(filename.replaceAll('"', "")),
    contentType: ct || "application/octet-stream",
    body,
    size
  };
}
async function exportViaCursorPages(args) {
  const maxPages = Math.min(MAX_PAGES, args.maxPages ?? MAX_PAGES);
  const enc2 = new TextEncoder();
  let cursor = null;
  let pages = 0;
  let rows = 0;
  let complete = false;
  let truncatedByUpstream = false;
  let bytes = 0;
  let body = "";
  let csvHeaderWritten = false;
  let csvCols = null;
  let jsonStarted = false;
  let jsonFirstRow = true;
  let envelopeCount = 0;
  const appendChunk = (chunk) => {
    if (!chunk) return;
    body += chunk;
    bytes += enc2.encode(chunk).byteLength;
    if (bytes > MAX_EXPORT_BYTES) {
      throw new DataSourceError("INVALID_RESPONSE", `export 超过 size limit ${MAX_EXPORT_BYTES}`);
    }
  };
  const ensureJsonHeader = () => {
    if (jsonStarted) return;
    appendChunk(`{"exportMode":"cursor_pages","format":"json","data":[`);
    jsonStarted = true;
  };
  const appendJsonRows = (pageRows) => {
    ensureJsonHeader();
    for (const r of pageRows) {
      const piece = (jsonFirstRow ? "" : ",") + stableJson(redactSecrets(r));
      jsonFirstRow = false;
      appendChunk(piece);
    }
  };
  const appendCsvRowsFromObjects = (pageRows) => {
    if (!pageRows.length) return;
    if (!csvCols) {
      const keys = /* @__PURE__ */ new Set();
      for (const r of pageRows) {
        if (r && typeof r === "object") Object.keys(r).forEach((k) => keys.add(k));
      }
      csvCols = [...keys].sort();
      if (!csvCols.length) csvCols = ["value"];
      appendChunk(`${csvCols.map(csvEscape).join(",")}
`);
      csvHeaderWritten = true;
    }
    for (const r of pageRows) {
      const o = r && typeof r === "object" ? r : { value: r };
      const line = csvCols.map((c) => {
        const v = o[c];
        if (v == null) return "";
        if (typeof v === "object") return csvEscape(stableJson(v));
        return csvEscape(String(v));
      }).join(",");
      appendChunk(`${line}
`);
    }
  };
  const appendCsvFromFrames = (frames) => {
    for (const fr of frames) {
      const fields = fr.fields || [];
      if (!fields.length) continue;
      if (!csvHeaderWritten) {
        appendChunk(`${fields.map((f) => csvEscape(f.name)).join(",")}
`);
        csvHeaderWritten = true;
        csvCols = fields.map((f) => f.name);
      }
      const n = fields[0]?.values?.length ?? fr.length ?? 0;
      for (let i = 0; i < n; i++) {
        const line = fields.map((f) => {
          const v = f.values?.[i];
          if (v == null) return "";
          if (typeof v === "object") return csvEscape(stableJson(v));
          return csvEscape(String(v));
        }).join(",");
        appendChunk(`${line}
`);
      }
    }
  };
  while (pages < maxPages) {
    if (args.signal?.aborted) {
      args.onProgress?.({
        mode: "cursor_pages",
        pages,
        rows,
        bytes,
        complete: false,
        truncatedByUpstream: false,
        cancelled: true
      });
      throw new DataSourceError("CANCELLED", "导出已取消");
    }
    const page = await args.fetchPage(cursor, args.signal);
    pages += 1;
    const pageRows = page.rows || [];
    rows += pageRows.length;
    if (page.envelope !== void 0) envelopeCount += 1;
    if (args.format === "csv") {
      if (page.frames?.length) appendCsvFromFrames(page.frames);
      else appendCsvRowsFromObjects(pageRows);
    } else {
      appendJsonRows(pageRows);
    }
    args.onProgress?.({
      mode: "cursor_pages",
      pages,
      rows,
      bytes,
      complete: false,
      truncatedByUpstream: false,
      cancelled: false
    });
    if (!page.nextCursor) {
      complete = true;
      break;
    }
    if (page.nextCursor === cursor) {
      truncatedByUpstream = true;
      break;
    }
    cursor = page.nextCursor;
  }
  if (!complete && pages >= maxPages) truncatedByUpstream = true;
  if (args.format === "json") {
    ensureJsonHeader();
    appendChunk(
      `],"pages":${pages},"rowCount":${rows},"complete":${complete},"truncatedByUpstream":${truncatedByUpstream},"envelopeCount":${envelopeCount}}`
    );
  } else if (!csvHeaderWritten) {
    appendChunk("");
  }
  args.onProgress?.({
    mode: "cursor_pages",
    pages,
    rows,
    bytes,
    complete,
    truncatedByUpstream,
    cancelled: false
  });
  return {
    mode: "cursor_pages",
    format: args.format,
    filename: args.filenameHint || `signoz-export-pages-${Date.now()}.${args.format}`,
    body,
    pages,
    rows,
    complete,
    truncatedByUpstream
  };
}
function exportLoadedOnly(args) {
  const rows = args.rows || [];
  let body;
  if (args.format === "csv") {
    body = args.frames?.length ? framesToCsv(args.frames) : framesToCsv([]);
    if (!args.frames?.length && rows.length) {
      const keys = /* @__PURE__ */ new Set();
      for (const r of rows) {
        if (r && typeof r === "object") Object.keys(r).forEach((k) => keys.add(k));
      }
      const cols = [...keys].sort();
      const lines = [cols.map(csvEscape).join(",")];
      for (const r of rows) {
        const o = r && typeof r === "object" ? r : { value: r };
        lines.push(cols.map((c) => csvEscape(String(o[c] ?? ""))).join(","));
      }
      body = lines.join("\n");
    }
  } else {
    body = stableJson({
      exportMode: "loaded_only",
      disclaimer: "EXPORT_LOADED_ONLY",
      rows: redactSecrets(rows),
      frames: args.frames ? redactSecrets(
        args.frames.map((f) => ({
          name: f.name,
          fields: f.fields.map((x) => x.name)
        }))
      ) : void 0
    });
  }
  return {
    mode: "loaded_only",
    format: args.format,
    filename: args.filenameHint || `signoz-loaded-${Date.now()}.${args.format}`,
    body,
    rows: rows.length || args.frames?.reduce((n, f) => n + (f.fields[0]?.values?.length || 0), 0) || 0,
    disclaimer: "EXPORT_LOADED_ONLY"
  };
}
async function exportSigNozRaw(args) {
  const format = args.format || "json";
  if (args.preferLoadedOnly) {
    return exportLoadedOnly({
      format,
      frames: args.loadedFrames,
      rows: args.loadedRows
    });
  }
  if (args.capabilities.exportRawVerified && args.capabilities.exportRawPath && args.http) {
    return exportUpstreamRaw({
      path: args.capabilities.exportRawPath,
      body: args.upstreamBody,
      signal: args.signal,
      http: args.http
    });
  }
  if (args.capabilities.cursorPaging && args.fetchPage) {
    return exportViaCursorPages({
      format,
      signal: args.signal,
      fetchPage: args.fetchPage,
      onProgress: args.onProgress
    });
  }
  if (args.loadedFrames?.length || args.loadedRows?.length) {
    return exportLoadedOnly({
      format,
      frames: args.loadedFrames,
      rows: args.loadedRows
    });
  }
  throw new DataSourceError(
    "UNSUPPORTED_CAPABILITY",
    "export 需要已验证 export_raw_data 或 cursor paging（禁止用屏幕前 N 行冒充全部）"
  );
}
const SIGNOZ_CAPABILITIES = {
  signals: ["metrics", "logs", "traces"],
  query: true,
  health: true,
  metadata: true,
  variables: true,
  annotations: true,
  exemplars: false,
  streaming: false,
  queryLanguages: ["promql", "signoz-builder", "clickhouse_sql"]
};
function rangeMs(range) {
  const from = range.from instanceof Date ? range.from.getTime() : Number(range.from?.valueOf?.() ?? range.from);
  const to = range.to instanceof Date ? range.to.getTime() : Number(range.to?.valueOf?.() ?? range.to);
  return { fromMs: from, toMs: to };
}
function createSignozDataSource(instance, meta2) {
  const dataMode = instance.jsonData?.dataMode === "fixture" ? "fixture" : "live";
  const useFixture = dataMode === "fixture";
  const fallback = createBuiltinDataSourceApi(instance, meta2);
  const options = migrateSigNozConfig(instance.jsonData || {});
  const profile = resolveSigNozProfile(options);
  const profileId = String(options.apiProfile || profile.id);
  const base = String(
    instance.url || getRuntimeDataSourceSettings(instance.uid)?.url || ""
  ).replace(/\/$/, "");
  const timeoutMs = parseTimeoutMs(options.timeout, 3e4);
  const cacheTtlMs = parseCacheTtlMs(options.metadataCacheTTL, 3e5);
  let observedVersion = "";
  let credentialRevision = "";
  async function resolveCredential() {
    const cred = await getRuntimeCredential(instance.uid);
    if (cred && options.credentialKind === "signozApiKey" && cred.kind === "apiKey") {
      return {
        ...cred,
        headerName: options.credentialHeaderName || profile.defaultCredentialHeader || "SIGNOZ-API-KEY"
      };
    }
    if (cred && options.credentialKind === "signozApiKey" && cred.kind === "bearer" && cred.value) {
      return {
        kind: "apiKey",
        value: cred.value,
        headerName: options.credentialHeaderName || profile.defaultCredentialHeader || "SIGNOZ-API-KEY"
      };
    }
    credentialRevision = cred ? `${cred.kind}:${cred.headerName || ""}` : "none";
    return cred;
  }
  function cacheIdentity() {
    return buildCapabilityIdentity({
      uid: instance.uid,
      options,
      baseUrl: base,
      credentialRevision,
      observedVersion
    });
  }
  async function signozHttp(req) {
    const run = async () => {
      const cred2 = await resolveCredential();
      const mode2 = String(
        options.credentialMode || instance.jsonData?.credentialMode || ""
      );
      if (!useFixture && !cred2 && mode2 !== "proxy" && mode2 !== "none") {
        throw new DataSourceError(
          "AUTH",
          "SigNoz live 请求缺少运行时凭证（Authorization 不会被自动发明）。请在 public/app/defaultObservabilityDataSources.json 配置 token/refreshToken，或 bootstrapGrafanaVue({ datasources }) / setRuntimeCredential，或使用 credentialMode=proxy 并由 Vite/BFF 注入。"
        );
      }
      return datasourceHttp({
        forceNetwork: !useFixture,
        baseUrl: base,
        path: req.path,
        method: req.method || "GET",
        body: req.body,
        query: req.query,
        uid: instance.uid,
        credential: cred2,
        signal: req.signal,
        timeoutMs
      });
    };
    const cred = await resolveCredential();
    const session = asSessionCredential(cred);
    if (session && !String(req.path || "").includes("/sessions/")) {
      return withAuthRetry(run, {
        uid: instance.uid,
        baseUrl: base,
        credential: session,
        signal: req.signal
      });
    }
    return run();
  }
  const metadataApi = createSigNozMetadataApi({
    offline: useFixture,
    profile,
    http: useFixture ? void 0 : signozHttp,
    identity: cacheIdentity(),
    cache: sharedSigNozMetadataCache,
    ttlMs: cacheTtlMs
  });
  const activeLiveTails = /* @__PURE__ */ new Map();
  const waterfallCache = createMemoryWaterfallCache();
  function liveExportCaps() {
    return resolveLiveExportCapabilities({ profile, options });
  }
  async function listServices(signal) {
    if (useFixture) {
      return [
        { text: "frontend", value: "frontend" },
        { text: "api", value: "api" },
        { text: "checkout", value: "checkout" }
      ];
    }
    try {
      const meta22 = await metadataApi.getMetadata({ type: "services" }, signal);
      if (meta22.type === "services") {
        return meta22.values.map((v) => ({ text: v, value: v }));
      }
    } catch {
    }
    return [];
  }
  async function mutate(request) {
    if (useFixture) {
      return {
        status: "success",
        message: "离线预览",
        data: {
          action: request.action,
          payload: request.payload,
          preview: true
        }
      };
    }
    const action = String(request.action || "");
    if (action !== "signoz.acknowledge" && action !== "signoz.resolve") {
      return {
        status: "error",
        message: `不支持的操作：${action}`
      };
    }
    const payload = request.payload || {};
    if (payload.source && payload.source !== "alert") {
      return {
        status: "error",
        message: "仅告警来源支持操作"
      };
    }
    const endpoints = profile.endpoints;
    const path = action === "signoz.acknowledge" ? options.customAcknowledgePath || endpoints.acknowledge?.path : options.customResolvePath || endpoints.resolve?.path;
    if (!path) {
      return {
        status: "error",
        message: `不支持的操作：${action}`
      };
    }
    const body = {
      alertId: payload.alertId || payload.issueId,
      source: "alert",
      message: payload.message
    };
    const cred = await getRuntimeCredential(instance.uid);
    const res = await datasourceHttp({
      forceNetwork: !useFixture,
      baseUrl: base,
      path,
      method: "POST",
      body,
      uid: instance.uid,
      credential: cred,
      signal: request.signal
    });
    const status = Number(res?.status ?? 200);
    if (!isSuccessfulActionResponse(status, res?.data)) {
      return {
        status: "error",
        message: "操作响应表示失败"
      };
    }
    return {
      status: "success",
      message: "操作成功",
      data: res?.data
    };
  }
  return {
    ...fallback,
    uid: instance.uid,
    name: instance.name,
    type: instance.type,
    meta: meta2,
    capabilities: { ...SIGNOZ_CAPABILITIES },
    async query(request, signal) {
      if (signal?.aborted) {
        throw new DOMException("Aborted", "AbortError");
      }
      const { fromMs, toMs: toMs2 } = rangeMs(request.range);
      const intervalMs = request.intervalMs || 6e4;
      const cacheTimeout = request.cacheTimeout != null && String(request.cacheTimeout).trim() !== "" ? String(request.cacheTimeout).trim() : void 0;
      const frames = [];
      const framesByName = /* @__PURE__ */ new Map();
      const pushNamed = (key, fr) => {
        const arr = framesByName.get(key) || [];
        arr.push(fr);
        framesByName.set(key, arr);
      };
      for (const rawTarget of request.targets || []) {
        if (rawTarget.hide) continue;
        const query = migrateSigNozQuery(rawTarget);
        if (useFixture) {
          try {
            buildSigNozRequests({
              profile,
              options,
              query,
              fromMs,
              toMs: toMs2,
              intervalMs
            });
          } catch (error) {
            if (error instanceof DataSourceError) throw error;
            throw new DataSourceError(
              "INVALID_QUERY",
              error instanceof Error ? error.message : String(error)
            );
          }
          const signalName = String(
            query.signal || query.queries?.[0]?.spec?.signal || "metrics"
          );
          if (signalName === "alerts") {
            const fr = createDataFrame({
              refId: query.refId,
              name: "issues",
              fields: [
                {
                  name: "Time",
                  type: "time",
                  values: [fromMs, fromMs + intervalMs, toMs2]
                },
                {
                  name: "id",
                  type: "string",
                  values: ["iss-1", "iss-2", "iss-3"]
                },
                {
                  name: "title",
                  type: "string",
                  values: ["High latency", "Error rate", "DB timeout"]
                },
                {
                  name: "service",
                  type: "string",
                  values: ["frontend", "api", "checkout"]
                },
                {
                  name: "severity",
                  type: "string",
                  values: ["critical", "warning", "error"]
                },
                {
                  name: "status",
                  type: "string",
                  values: ["firing", "firing", "acknowledged"]
                },
                { name: "traceId", type: "string", values: ["t1", "t2", "t3"] }
              ],
              meta: {
                preferredVisualisationType: "table",
                offline: useFixture,
                signal: "alerts"
              }
            });
            frames.push(fr);
            pushNamed("issues", fr);
            continue;
          }
          for (const item of query.queries || []) {
            if (item.type === "builder_formula") continue;
            if (item.spec?.disabled) continue;
            const name = item.spec.name || query.refId;
            const times = [fromMs, fromMs + intervalMs, toMs2];
            const fr = createDataFrame({
              refId: query.refId,
              name,
              fields: [
                { name: "Time", type: "time", values: times },
                { name, type: "number", values: [1, 2, 3] }
              ],
              meta: {
                preferredVisualisationType: "graph",
                offline: useFixture
              }
            });
            frames.push(fr);
            pushNamed(name, fr);
          }
          for (const item of query.queries || []) {
            if (item.type !== "builder_formula" || item.spec.disabled) continue;
            const f = evaluateLocalFormula(item.spec.expression, framesByName, item.spec.name);
            frames.push(f);
            pushNamed(item.spec.name, f);
          }
          continue;
        }
        if (profileId === "prometheus-compatible") {
          const onlyProm = (query.queries || []).every(
            (q) => q.type === "builder_formula" || q.type === "builder_query" && q.queryType === "promql"
          );
          if (onlyProm) {
            const prom = createPrometheusDataSource(
              {
                ...instance,
                jsonData: { ...instance.jsonData, httpMethod: "GET" }
              },
              meta2
            );
            const promTargets = (query.queries || []).filter((q) => q.type === "builder_query").map((q) => ({
              refId: q.spec.name || query.refId,
              expr: q.rawQuery || "",
              legendFormat: q.rawLegend || q.spec.legend || ""
            }));
            const res = await prom.query({ ...request, targets: promTargets }, signal);
            for (const fr of res.data || []) {
              frames.push(fr);
              pushNamed(String(fr.refId || fr.name), fr);
            }
            for (const item of query.queries || []) {
              if (item.type !== "builder_formula" || item.spec.disabled) continue;
              const f = evaluateLocalFormula(item.spec.expression, framesByName, item.spec.name);
              frames.push(f);
            }
            continue;
          }
        }
        let built;
        try {
          built = buildSigNozRequests({
            profile,
            options,
            query,
            fromMs,
            toMs: toMs2,
            intervalMs
          });
        } catch (error) {
          if (error instanceof DataSourceError) throw error;
          throw new DataSourceError(
            "UNSUPPORTED_QUERY_API",
            error instanceof Error ? error.message : String(error)
          );
        }
        const cred = await getRuntimeCredential(instance.uid);
        const { nodes, diagnostics } = buildRequestNodes(built);
        assertScheduleValid(diagnostics);
        const maxConcurrent = Math.max(1, Number(options.maxConcurrentRequests ?? 4) || 4);
        const registerFrames = (req, mapped) => {
          for (const fr of mapped) {
            const key = String(fr.name || fr.refId || req.queryNames[0] || query.refId);
            pushNamed(key, fr);
            for (const n of req.queryNames) pushNamed(n, fr);
            if (req.localFormula) pushNamed(req.localFormula.name, fr);
          }
        };
        const runOne = async (node) => {
          const req = node.req;
          if (req.localFormula) {
            if (signal?.aborted) {
              throw new DOMException("Aborted", "AbortError");
            }
            const f = evaluateLocalFormula(
              req.localFormula.expression,
              framesByName,
              req.localFormula.name
            );
            registerFrames(req, [f]);
            return { frames: [f], req };
          }
          if (!req.path) return { frames: [], req };
          if (signal?.aborted) {
            throw new DOMException("Aborted", "AbortError");
          }
          const res = await datasourceHttp({
            forceNetwork: !useFixture,
            baseUrl: base,
            path: req.path,
            method: req.method,
            body: req.body,
            // Grafana panel.cacheTimeout on wire (Prom/Loki/Tempo/builtin parity)
            query: {
              ...req.query || {},
              ...cacheTimeout ? { cacheTimeout } : {}
            },
            uid: instance.uid,
            credential: cred,
            signal
          });
          if (signal?.aborted) {
            throw new DOMException("Aborted", "AbortError");
          }
          const isPromEnvelope = typeof res.data?.data?.resultType === "string" && Array.isArray(res.data?.data?.result);
          let mapped = [];
          if (isPromEnvelope) {
            mapped = normalizeDataFrames(
              mapPrometheusResponse(res.data, {
                refId: query.refId,
                legendFormat: "",
                expr: String(req.query?.query || "")
              }),
              {
                refId: query.refId,
                source: "signoz",
                datasourceUid: instance.uid,
                profile: profileId,
                signal: "metrics",
                requestId: request.requestId
              }
            );
          } else {
            mapped = mapAndNormalizeSignozResponse(res.data, profileId, {
              refId: query.refId,
              signal: req.signal,
              requestType: String(
                query.requestType || req.body?.requestType || ""
              ),
              datasourceUid: instance.uid,
              experimentalDistribution: Boolean(
                options.experimentalCapabilities?.distribution
              ),
              profile: profileId,
              requestId: request.requestId
            });
          }
          registerFrames(req, mapped);
          return { frames: mapped, req };
        };
        const orderedResults = await runRequestNodes({
          nodes,
          maxConcurrent,
          signal,
          runNode: runOne,
          onPartialOrdered: (completed) => {
            if (signal?.aborted) return;
            const partialFrames = [];
            for (const item of completed) {
              for (const fr of item.value.frames) partialFrames.push(fr);
            }
            if (partialFrames.length) {
              request.onPartialData?.(partialFrames);
            }
          }
        });
        for (const item of orderedResults) {
          if (!item) continue;
          for (const fr of item.frames) frames.push(fr);
        }
      }
      return { data: frames };
    },
    async testDatasource(signal) {
      if (useFixture) return { status: "success", message: "SigNoz 离线模式正常" };
      if (!base) return { status: "error", message: "数据源 URL 为空" };
      try {
        const healthRes = await probeHealth(
          async (req) => {
            const r = await signozHttp({
              ...req,
              signal: req.signal || signal
            });
            return { status: Number(r.status ?? 200), data: r.data };
          },
          profile,
          { signal }
        );
        if (!healthRes.ok) {
          if (healthRes.reasonCode === "AUTH") {
            sharedSigNozMetadataCache.clearUid(instance.uid);
            return {
              status: "error",
              message: `认证：${healthRes.reason} @ ${healthRes.path}`
            };
          }
          return {
            status: "error",
            message: `健康检查失败（${healthRes.reasonCode || "ERROR"}）：${healthRes.reason} @ ${healthRes.path || "n/a"}`
          };
        }
        const versionEp = profile.endpoints.version;
        let versionInfo = "";
        if (versionEp?.path) {
          try {
            const vres = await signozHttp({
              path: versionEp.path,
              method: "GET",
              signal
            });
            const parsed = parseVersionPayload(vres.data);
            if (parsed.version) {
              observedVersion = parsed.version;
              versionInfo = ` version=${parsed.version}`;
              if (parsed.ee != null) versionInfo += ` ee=${parsed.ee}`;
              if (parsed.setupCompleted != null)
                versionInfo += ` setupCompleted=${parsed.setupCompleted}`;
            }
          } catch {
          }
        }
        try {
          if (isV5WireProfile(profileId)) {
            await metadataApi.getMetadata({ type: "metrics" }, signal);
          } else if (profile.endpoints.metricsList || profile.endpoints.metadata || profile.endpoints.fieldsKeys) {
            try {
              await metadataApi.getMetadata({ type: "metrics" }, signal);
            } catch {
              await metadataApi.getMetadata({ type: "attributeKeys", signal: "metrics" }, signal);
            }
          }
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          if (/401|403|AUTH/i.test(msg)) {
            sharedSigNozMetadataCache.clearUid(instance.uid);
            return {
              status: "error",
              message: `认证：认证探针失败：${msg}`
            };
          }
          return {
            status: "error",
            message: `认证探针失败：${msg}`
          };
        }
        return {
          status: "success",
          message: `SigNoz 配置档案 ${profileId} 通过 ${healthRes.path}${versionInfo}`
        };
      } catch (error) {
        return {
          status: "error",
          message: chineseMessage(error instanceof Error ? error.message : String(error))
        };
      }
    },
    listServices,
    async metricFindQuery(query, signal) {
      const caps2 = resolveEditorCapabilities({
        profile,
        options
      });
      return await runSigNozVariableQuery(metadataApi, query, {
        signal,
        profileId,
        capabilities: caps2,
        runClickHouseVariable: useFixture ? async () => ["offline-ch-1", "offline-ch-2"] : profile.endpoints.variablesQuery?.path ? async (sql, abort) => {
          const cred = await getRuntimeCredential(instance.uid);
          const res = await datasourceHttp({
            forceNetwork: true,
            baseUrl: base,
            path: profile.endpoints.variablesQuery.path,
            method: profile.endpoints.variablesQuery.method || "POST",
            body: { query: sql },
            uid: instance.uid,
            credential: cred,
            signal: abort
          });
          const rows = Array.isArray(res.data) ? res.data : Array.isArray(res.data?.data) ? res.data.data : Array.isArray(res.data?.values) ? res.data.values : [];
          return rows.map(
            (r) => typeof r === "string" || typeof r === "number" ? String(r) : String(r?.value ?? r?.name ?? "")
          ).filter(Boolean);
        } : void 0
      });
    },
    async annotationQuery(request, signal) {
      const { fromMs, toMs: toMs2 } = rangeMs(request.range);
      const ann = request.annotation || {};
      const target = ann.target || ann;
      const caps2 = resolveEditorCapabilities({
        profile,
        options
      });
      const alertsCapable = caps2.alerts || Boolean(options.customAlertsPath || profile.endpoints.alertsQuery?.path);
      const frames = await querySigNozAnnotations(
        metadataApi,
        {
          source: target.source || "errorLogs",
          service: target.service,
          environment: target.environment
        },
        { fromMs, toMs: toMs2 },
        {
          signal,
          datasourceUid: instance.uid,
          alertsCapable,
          runRawQuery: useFixture ? void 0 : async ({ signal: sig, filterExpression, fromMs: f, toMs: t2, abort }) => {
            const ep = sig === "logs" ? profile.endpoints.logsQuery || profile.endpoints.metricsQuery : profile.endpoints.tracesQuery || profile.endpoints.metricsQuery;
            if (!ep?.path) {
              throw new DataSourceError(
                "UNSUPPORTED_CAPABILITY",
                `annotation raw ${sig} 需要 query_range endpoint`
              );
            }
            const cred = await getRuntimeCredential(instance.uid);
            const body = {
              start: f,
              end: t2,
              requestType: "raw",
              compositeQuery: {
                queries: [
                  {
                    type: "builder_query",
                    spec: {
                      name: "A",
                      signal: sig,
                      disabled: false,
                      filter: { expression: filterExpression },
                      limit: 100
                    }
                  }
                ]
              }
            };
            if (String(profile.id).includes("v3") || String(profile.id).includes("v4")) {
              body.compositeQuery = {
                queryType: "builder",
                panelType: sig === "traces" ? "trace" : "list",
                builderQueries: {
                  A: {
                    dataSource: sig,
                    filters: { items: [], op: "AND" },
                    filter: filterExpression,
                    aggregateOperator: "noop",
                    limit: 100
                  }
                }
              };
              delete body.requestType;
              body.start = f;
              body.end = t2;
            }
            const res = await datasourceHttp({
              forceNetwork: true,
              baseUrl: base,
              path: ep.path,
              method: ep.method || "POST",
              body,
              uid: instance.uid,
              credential: cred,
              signal: abort
            });
            return mapAndNormalizeSignozResponse(res.data, profileId, {
              refId: "annotation",
              signal: String(sig || "logs"),
              requestType: "raw",
              datasourceUid: instance.uid,
              profile: profileId,
              requestId: "annotation"
            });
          }
        }
      );
      return frames;
    },
    async getMetadata(request, signal) {
      const api = createSigNozMetadataApi({
        offline: useFixture,
        profile,
        http: useFixture ? void 0 : signozHttp,
        identity: cacheIdentity(),
        cache: sharedSigNozMetadataCache,
        ttlMs: cacheTtlMs
      });
      return api.getMetadata(request, signal);
    },
    /** Capability-gated live tail session. Switching UID/query should dispose prior session. */
    startLiveTail(args = {}) {
      const key = args.sessionKey || "default";
      const prev = activeLiveTails.get(key);
      if (prev) prev.dispose();
      const caps2 = liveExportCaps();
      const session = createLiveTailSession({
        uid: instance.uid,
        profileId,
        filterExpression: args.filterExpression || "",
        startMs: args.startMs ?? Date.now() - 6e4,
        pollIntervalMs: Number(options.liveTailIntervalMs) || 2e3,
        maxRows: 5e3,
        capabilities: {
          sseVerified: caps2.sseVerified,
          legacySseEnabled: caps2.legacySseEnabled,
          cursorPoll: caps2.cursorPoll || useFixture,
          liveTailPath: caps2.liveTailPath,
          legacyLiveTailPath: caps2.legacyLiveTailPath
        },
        fetchStream: useFixture ? void 0 : async ({ path, query, signal }) => {
          const qs = new URLSearchParams(query).toString();
          const fullPath = qs ? `${path}?${qs}` : path;
          const cred = await resolveCredential();
          if (typeof fetch !== "function") {
            throw new DataSourceError("UNSUPPORTED_CAPABILITY", "fetch unavailable for SSE");
          }
          const headers = {
            Accept: "text/event-stream"
          };
          if (cred?.kind === "bearer" && cred.value)
            headers.Authorization = `Bearer ${cred.value}`;
          if (cred?.kind === "apiKey" && cred.value) {
            headers[cred.headerName || options.credentialHeaderName || "SIGNOZ-API-KEY"] = cred.value;
          }
          const url = `${base}${fullPath.startsWith("/") ? "" : "/"}${fullPath}`;
          return fetch(url, {
            method: "GET",
            headers,
            credentials: options.fetchCredentials || "omit",
            signal
          });
        },
        fetchCursorPage: async ({ cursor, startMs, signal }) => {
          if (useFixture) {
            if (cursor) return { rows: [], nextCursor: null };
            return {
              rows: [
                {
                  timestamp: startMs + 1,
                  data: { body: "offline live tail row", service: "frontend" },
                  rowId: stableRowId(startMs + 1, {
                    body: "offline live tail row"
                  })
                }
              ],
              nextCursor: null
            };
          }
          const path = profile.endpoints.logsQuery?.path || profile.endpoints.metricsQuery?.path;
          if (!path) {
            throw new DataSourceError(
              "UNSUPPORTED_CAPABILITY",
              "no logs query_range for cursor poll"
            );
          }
          const body = {
            start: startMs,
            end: Date.now(),
            requestType: "raw",
            compositeQuery: {
              queries: [
                {
                  type: "builder_query",
                  spec: {
                    name: "A",
                    signal: "logs",
                    filter: { expression: args.filterExpression || "" },
                    cursor: cursor || void 0
                  }
                }
              ]
            }
          };
          if (cursor) body.cursor = cursor;
          const res = await signozHttp({ path, method: "POST", body, signal });
          const data = res?.data;
          const results = data?.data?.data?.results ?? data?.data?.results ?? data?.results ?? [];
          const first = Array.isArray(results) ? results[0] : null;
          const rawRows = first?.rows || first?.data || [];
          const nextCursor = first?.nextCursor ?? first?.cursor ?? null;
          const rows = (Array.isArray(rawRows) ? rawRows : []).map((r) => {
            const ts = Number(r?.timestamp ?? r?.time ?? startMs);
            return { timestamp: ts, data: r, rowId: stableRowId(ts, r, r?.id) };
          });
          return { rows, nextCursor };
        },
        onState: args.onState,
        onRows: args.onRows,
        onError: args.onError
      });
      activeLiveTails.set(key, session);
      void session.start();
      return session;
    },
    stopLiveTail(sessionKey = "default") {
      const s = activeLiveTails.get(sessionKey);
      if (s) {
        s.dispose();
        activeLiveTails.delete(sessionKey);
      }
    },
    async exportRawData(args = {}) {
      const caps2 = liveExportCaps();
      return exportSigNozRaw({
        capabilities: {
          exportRawVerified: caps2.exportRawVerified && !useFixture,
          exportRawPath: caps2.exportRawPath,
          cursorPaging: caps2.cursorPoll || useFixture
        },
        format: args.format || "json",
        signal: args.signal,
        preferLoadedOnly: args.preferLoadedOnly,
        loadedRows: args.loadedRows,
        loadedFrames: args.loadedFrames,
        upstreamBody: args.upstreamBody,
        onProgress: args.onProgress,
        http: useFixture ? void 0 : async (req) => {
          const res = await signozHttp({
            path: req.path,
            method: req.method,
            body: req.body,
            signal: req.signal
          });
          return {
            status: Number(res?.status ?? 200),
            data: res?.data,
            headers: res?.headers
          };
        },
        fetchPage: async (cursor, signal) => {
          if (useFixture) {
            if (cursor) return { rows: [], nextCursor: null };
            return { rows: [{ body: "offline export row" }], nextCursor: null };
          }
          const path = profile.endpoints.logsQuery?.path || profile.endpoints.metricsQuery?.path;
          if (!path) return { rows: [], nextCursor: null };
          const body = {
            start: Date.now() - 36e5,
            end: Date.now(),
            requestType: "raw",
            compositeQuery: {
              queries: [
                {
                  type: "builder_query",
                  spec: {
                    name: "A",
                    signal: "logs",
                    cursor: cursor || void 0
                  }
                }
              ]
            }
          };
          const res = await signozHttp({ path, method: "POST", body, signal });
          const data = res?.data;
          const results = data?.data?.data?.results ?? data?.data?.results ?? data?.results ?? [];
          const first = Array.isArray(results) ? results[0] : null;
          return {
            rows: first?.rows || [],
            nextCursor: first?.nextCursor ?? first?.cursor ?? null,
            envelope: redactExportEnvelope(data)
          };
        }
      });
    },
    async getTraceWaterfall(args, signal) {
      if (useFixture) {
        const detail2 = {
          candidateId: "v4-waterfall",
          path: `/api/v4/traces/${args.traceId}/waterfall`,
          status: 200,
          rootService: "frontend",
          entryPoint: "GET /",
          spans: [
            {
              spanId: "root",
              parentSpanId: "",
              name: "GET /",
              service: "frontend",
              timeUnixMs: Date.now() - 1e3,
              durationNano: "2000000",
              durationMs: 2,
              attributes: { "http.method": "GET" },
              events: []
            }
          ],
          raw: { offline: true }
        };
        return { frames: waterfallDetailToFrames(detail2), detail: detail2 };
      }
      const detail = await fetchWaterfall({
        traceId: args.traceId,
        state: {
          selectedSpanId: args.selectedSpanId,
          uncollapsedSpans: args.uncollapsedSpans,
          limit: args.limit
        },
        http: async (req) => {
          const res = await signozHttp({
            path: req.path,
            method: req.method,
            body: req.body,
            signal: req.signal
          });
          return {
            status: Number(res?.status ?? 200),
            data: res?.data
          };
        },
        identity: cacheIdentity(),
        cache: waterfallCache,
        hasObservedV3Evidence: Boolean(
          options.experimentalCapabilities?.waterfallV3Observed
        ),
        signal
      });
      return { frames: waterfallDetailToFrames(detail), detail };
    },
    getIssuesWriteCapabilities() {
      return issuesWriteEnabled({
        profileId,
        enableWrites: Boolean(options.enableWrites),
        envGate: Boolean(options.enableWrites),
        hasAcknowledgeEndpoint: Boolean(
          profile.endpoints.acknowledge?.path || options.customAcknowledgePath
        ),
        hasResolveEndpoint: Boolean(profile.endpoints.resolve?.path || options.customResolvePath),
        actionCapabilityVerified: Boolean(
          options.experimentalCapabilities?.actionsVerified
        )
      });
    },
    mutate
  };
}
function redactExportEnvelope(data) {
  if (data == null || typeof data !== "object") return data;
  const o = { ...data };
  for (const k of Object.keys(o)) {
    if (/token|password|secret|authorization|api[_-]?key/i.test(k)) o[k] = "[REDACTED]";
  }
  return o;
}
const SIGNOZ_PANEL_ID = "signoz-issues";
const SIGNOZ_DATASOURCE_ID = "signoz";
const __vite_import_meta_env__$1 = { "BASE_URL": "./", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
function defaultObservabilityDataSources(_env = {}) {
  return [];
}
function nonEmpty(v) {
  if (v == null) return void 0;
  const s = String(v).trim();
  return s.length ? s : void 0;
}
function readEnv() {
  try {
    return { ...__vite_import_meta_env__$1 || {} };
  } catch {
    return {};
  }
}
function readWindowInjection() {
  if (typeof window === "undefined") return null;
  const w = window;
  const inj = w.__GRAFANA_VUE_DATASOURCES__;
  if (!Array.isArray(inj) || !inj.length) return null;
  return inj;
}
function mergeObservabilityDataSourceInput(prev, next) {
  if (!prev) {
    return {
      ...next,
      jsonData: next.jsonData ? { ...next.jsonData } : void 0
    };
  }
  const merged = {
    ...prev,
    ...Object.fromEntries(
      Object.entries(next).filter(([key, v]) => key !== "jsonData" && v !== void 0 && v !== "")
    ),
    uid: next.uid || prev.uid,
    jsonData: {
      ...prev.jsonData || {},
      ...next.jsonData || {}
    }
  };
  if (!Object.keys(merged.jsonData || {}).length && !prev.jsonData && !next.jsonData) {
    delete merged.jsonData;
  }
  return merged;
}
function mergeObservabilityDataSourceInputsByUid(...layers) {
  const byUid2 = /* @__PURE__ */ new Map();
  for (const layer of layers) {
    if (!layer?.length) continue;
    for (const row of layer) {
      if (!row?.uid) {
        throw new Error("datasource uid is required");
      }
      byUid2.set(row.uid, mergeObservabilityDataSourceInput(byUid2.get(row.uid), row));
    }
  }
  return [...byUid2.values()];
}
function resolveObservabilityDataSources(opts = {}) {
  opts.env ?? readEnv();
  const defaults2 = opts.defaults ?? defaultObservabilityDataSources({});
  const datasources2 = opts.datasources ?? [];
  const windowInjection = opts.windowInjection !== void 0 ? opts.windowInjection : readWindowInjection();
  if (windowInjection?.length) {
    const seen = /* @__PURE__ */ new Set();
    for (const row of windowInjection) {
      if (!row?.uid) {
        throw new Error("datasource uid is required in window injection");
      }
      if (seen.has(row.uid)) {
        throw new Error(`duplicate uid in window injection: ${row.uid}`);
      }
      seen.add(row.uid);
    }
  }
  const inputs = mergeObservabilityDataSourceInputsByUid(defaults2, datasources2, windowInjection);
  const defaultsMarked = inputs.filter((i) => i.default || i.isDefault);
  if (defaultsMarked.length > 1) {
    throw new Error(`DATASOURCE_DEFAULT_CONFLICT: ${defaultsMarked.map((d) => d.uid).join(",")}`);
  }
  const settings = [];
  const credentials = [];
  for (const input of inputs) {
    const jsonData = { ...input.jsonData || {} };
    if (input.profile) {
      jsonData.apiProfile = input.profile;
    }
    if (input.credentialMode) {
      jsonData.credentialMode = input.credentialMode;
    }
    const explicitMode = jsonData.dataMode;
    if (explicitMode === "fixture" || explicitMode === "live") {
      jsonData.dataMode = explicitMode;
    } else if (input.token || input.password || input.refreshToken || nonEmpty(input.url)) {
      jsonData.dataMode = "live";
    } else {
      jsonData.dataMode = "fixture";
    }
    for (const k of Object.keys(jsonData)) {
      if (/token|password|secret|apiKey|authorization/i.test(k)) {
        delete jsonData[k];
      }
    }
    settings.push({
      uid: input.uid,
      name: input.name,
      type: input.type,
      url: input.url,
      access: "proxy",
      isDefault: !!(input.default || input.isDefault),
      jsonData,
      source: "runtime"
    });
    const mode2 = input.credentialMode || (input.token ? "apiKey" : "none");
    if (mode2 === "proxy" || mode2 === "none") {
      continue;
    }
    if (input.token) {
      const canSession = Boolean(input.refreshToken) || Boolean(input.email && input.password);
      if (canSession) {
        credentials.push({
          uid: input.uid,
          credential: {
            kind: "session",
            value: input.token,
            refreshToken: input.refreshToken,
            email: input.email,
            password: input.password,
            orgID: input.orgID,
            rememberPassword: Boolean(input.password)
          }
        });
      } else if (mode2 === "bearer" || mode2 === "token") {
        credentials.push({
          uid: input.uid,
          credential: { kind: "bearer", value: input.token }
        });
      } else if (mode2 === "apiKey") {
        credentials.push({
          uid: input.uid,
          credential: {
            kind: "apiKey",
            value: input.token,
            headerName: input.apiKeyHeader
          }
        });
      } else {
        credentials.push({
          uid: input.uid,
          credential: { kind: "apiKey", value: input.token }
        });
      }
    } else if (input.username || input.password) {
      credentials.push({
        uid: input.uid,
        credential: {
          kind: "basic",
          username: input.username || "",
          password: input.password || ""
        }
      });
    }
  }
  return { settings, credentials };
}
function bootstrapObservabilityDataSources(resolved) {
  const r = resolved ?? resolveObservabilityDataSources();
  configureRuntimeDataSourceSettings(r.settings);
  for (const { uid, credential } of r.credentials) {
    setRuntimeCredential(uid, credential);
    if (uid === "zabbix-3") setRuntimeCredential("zabbix", credential);
    if (uid === "signoz" || uid === "signoz-native" || uid === "signoz-argus") {
      setRuntimeCredential("signoz", credential);
      setRuntimeCredential("signoz-native", credential);
      setRuntimeCredential("signoz-argus", credential);
    }
  }
  if (typeof console !== "undefined") {
    const signoz = r.settings.find((s) => s.uid === "signoz");
    const z3 = r.settings.find((s) => s.uid === "zabbix-3");
    console.info(
      `[grafana-vue] observability datasources: ${r.settings.length}${z3?.url ? ` zabbix=${z3.url}` : ""}${signoz?.url ? ` signoz=${signoz.url}` : ""}${r.credentials.length ? ` credentials=${r.credentials.length}` : ""}`
    );
  }
  return r;
}
const __vite_import_meta_env__ = { "BASE_URL": "./", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
function resolveBackendBootSelection(input) {
  const params = new URLSearchParams(input.search ?? "");
  const env = input.env ?? {};
  const g = input.globals ?? {};
  const envMode = env.VITE_BACKEND_MODE || g.__GRAFANA_VUE_BACKEND_MODE__;
  const grafanaUrl = env.VITE_GRAFANA_URL || env.VITE_GRAFANA_API_URL || g.__GRAFANA_VUE_GRAFANA_URL__;
  const hasToken = !!(env.VITE_GRAFANA_TOKEN || env.VITE_GRAFANA_API_TOKEN || g.__GRAFANA_VUE_AUTH_TOKEN__);
  const wantLive = params.get("backend") === "live" || envMode === "live" || !!grafanaUrl || hasToken;
  if (!wantLive) {
    return { mode: "offline" };
  }
  const requireAuth = params.get("requireAuth") === "0" || params.get("requireAuth") === "false" ? false : !!(grafanaUrl || hasToken || params.get("requireAuth") === "1");
  return {
    mode: "live",
    baseUrl: grafanaUrl || "",
    requireAuth
  };
}
function bootstrapGrafanaVue(options = {}) {
  registerBuiltinPlugins();
  const injected = typeof window !== "undefined" ? window.grafanaBootData : void 0;
  setBootData(injected ?? createDefaultBootData());
  initTheme();
  initPerfFlags();
  bootBackendMode();
  bootObservabilityDataSources(options);
}
function bootObservabilityDataSources(options) {
  try {
    const hasCallerDatasources = (options.datasources?.length ?? 0) > 0;
    if (!hasCallerDatasources && listRuntimeDataSourceSettings().length > 0) {
      return;
    }
    bootstrapObservabilityDataSources(
      resolveObservabilityDataSources({
        datasources: options.datasources,
        env: options.env,
        windowInjection: options.windowInjection
      })
    );
  } catch (error) {
    if (typeof console !== "undefined") {
      console.error("[grafana-vue] observability datasource bootstrap failed", error);
    }
  }
}
function bootBackendMode() {
  const env = __vite_import_meta_env__ ?? {};
  const globals = typeof globalThis !== "undefined" ? globalThis : {};
  const selection = resolveBackendBootSelection({
    search: typeof location !== "undefined" ? location.search : "",
    env,
    globals
  });
  if (selection.mode === "live") {
    configureBackendSrv({
      mode: "live",
      baseUrl: selection.baseUrl,
      requireAuth: selection.requireAuth
    });
  }
  if (typeof console !== "undefined") {
    console.info(
      `[grafana-vue] backend mode: ${getBackendMode()}${selection.mode === "live" && selection.baseUrl ? ` grafana=${selection.baseUrl}` : ""}`
    );
  }
}
function formatGeomapHoverLabel(props) {
  if (!props || props.label == null) return null;
  const label = String(props.label);
  const layerName = props.layerName != null && String(props.layerName).length ? String(props.layerName) : "";
  const val = props.value;
  if (layerName) {
    return `${layerName}: ${label}${val != null ? ` (${val})` : ""}`;
  }
  return label;
}
function formatGeomapFeatureHover(feature) {
  if (!feature) return null;
  return formatGeomapHoverLabel({
    label: feature.get("label"),
    layerName: feature.get("layerName"),
    value: feature.get("value")
  });
}
function compareValues(left, op, right) {
  let l = left;
  let r = right;
  let operation = String(op || "eq").toLowerCase();
  if (l == null || r == null) {
    if (l == null) l = "null";
    if (r == null) r = "null";
    if (operation === "gte" || operation === "lte") operation = "eq";
  }
  switch (operation) {
    case "eq":
    case "==":
    case "equal":
      return `${l}` === `${r}`;
    case "neq":
    case "!=":
    case "<>":
      return `${l}` !== `${r}`;
    case "gt":
    case ">":
      return l > r;
    case "gte":
    case ">=":
      return l >= r;
    case "lt":
    case "<":
      return l < r;
    case "lte":
    case "<=":
      return l <= r;
    default:
      return false;
  }
}
function checkFeatureMatchesStyleRule(rule, featureProps) {
  if (!rule?.property) return false;
  const val = featureProps[rule.property];
  return compareValues(val, rule.operation, rule.value);
}
function fixedColor(style, fallback) {
  if (!style) return fallback;
  const c = style.color;
  if (typeof c === "string" && c) {
    return resolveVizColor(c) || c;
  }
  if (c && typeof c === "object" && c.fixed) {
    return resolveVizColor(String(c.fixed)) || String(c.fixed);
  }
  return fallback;
}
function fixedSize(style, fallback) {
  if (!style) return fallback;
  if (typeof style.radius === "number" && Number.isFinite(style.radius)) {
    return Number(style.radius);
  }
  const s = style.size;
  if (typeof s === "number" && Number.isFinite(s)) return s;
  if (s && typeof s === "object" && s.fixed != null && Number.isFinite(Number(s.fixed))) {
    return Number(s.fixed);
  }
  return fallback;
}
function fixedWeight(style, fallback) {
  if (!style) return fallback;
  if (typeof style.lineWidth === "number" && Number.isFinite(style.lineWidth)) {
    return Number(style.lineWidth);
  }
  if (typeof style.weight === "number" && Number.isFinite(style.weight)) {
    return Number(style.weight);
  }
  return fallback;
}
function fixedOpacity(style, fallback) {
  if (style?.opacity == null) return fallback;
  const n = Number(style.opacity);
  if (!Number.isFinite(n)) return fallback;
  return n > 1 ? Math.max(0, Math.min(1, n / 100)) : Math.max(0, Math.min(1, n));
}
function parseRules(raw) {
  if (!raw) return [];
  if (typeof raw === "string") {
    try {
      const parsed = JSON.parse(raw);
      return Array.isArray(parsed) ? parsed : [];
    } catch {
      return [];
    }
  }
  return Array.isArray(raw) ? raw : [];
}
function asStyle(raw) {
  if (!raw) return void 0;
  if (typeof raw === "string") {
    if (raw.trim().startsWith("{")) {
      try {
        return JSON.parse(raw);
      } catch {
        return { color: raw };
      }
    }
    return { color: raw };
  }
  if (typeof raw === "object") return raw;
  return void 0;
}
function resolveGeoJsonFeatureStyle(opts) {
  const cfg = { ...opts.panelConfig ?? {}, ...opts.layerConfig ?? {} };
  const fallback = opts.fallbackColor || "var(--grafana-primary)";
  const defaultStyle = asStyle(cfg.style) ?? {
    color: cfg.color,
    radius: cfg.radius,
    weight: cfg.weight,
    lineWidth: cfg.lineWidth,
    opacity: cfg.opacity,
    border: cfg.border
  };
  const rules = parseRules(cfg.rules);
  let matchedRuleIndex = -1;
  let chosen = defaultStyle;
  for (const [i, r] of rules.entries()) {
    if (!r?.style) continue;
    if (r.check && !checkFeatureMatchesStyleRule(r.check, opts.featureProps)) {
      continue;
    }
    matchedRuleIndex = i;
    chosen = asStyle(r.style) ?? r.style;
    break;
  }
  let color = fixedColor(chosen, fallback);
  let radius = fixedSize(chosen, Number(cfg.radius ?? 5) || 5);
  let weight = fixedWeight(chosen, Number(cfg.weight ?? cfg.lineWidth ?? 2) || 2);
  let opacity = fixedOpacity(chosen, 1);
  let border = String(chosen?.border ?? cfg.border ?? color);
  if (opts.rowIndex != null && Number.isFinite(opts.rowIndex)) {
    const dataStyle = asStyle(cfg.dataStyle);
    if (dataStyle) {
      color = fixedColor(dataStyle, color);
      radius = fixedSize(dataStyle, radius);
      weight = fixedWeight(dataStyle, weight);
      opacity = fixedOpacity(dataStyle, opacity);
      if (dataStyle.border) border = String(dataStyle.border);
    }
    const field = dataStyle && typeof dataStyle.color === "object" && dataStyle.color?.field ? String(dataStyle.color.field) : "";
    if (field && opts.featureProps[field] != null) {
      const raw = String(opts.featureProps[field]);
      color = resolveVizColor(raw) || raw || color;
    }
    const sizeField = dataStyle && typeof dataStyle.size === "object" && dataStyle.size?.field ? String(dataStyle.size.field) : "";
    if (sizeField && opts.featureProps[sizeField] != null) {
      const n = Number(opts.featureProps[sizeField]);
      if (Number.isFinite(n)) radius = n;
    }
  }
  return {
    color,
    border,
    radius,
    weight,
    opacity,
    matchedRuleIndex,
    rowIndex: opts.rowIndex
  };
}
function buildIdToRowIndex(frame, idField) {
  const map = /* @__PURE__ */ new Map();
  if (!frame || !idField) return map;
  const field = (frame.fields ?? []).find((f) => String(f.name) === String(idField));
  if (!field?.values) return map;
  field.values.forEach((v, i) => {
    if (v != null && v !== "") map.set(String(v), i);
  });
  return map;
}
function rowPropsFromFrame(frame, rowIndex) {
  const out = {};
  if (!frame?.fields || rowIndex < 0) return out;
  for (const f of frame.fields) {
    const name = String(f.name ?? "");
    if (!name) continue;
    out[name] = f.values?.[rowIndex];
  }
  return out;
}
function featureIdOf(feature, props) {
  const id = feature.getId?.();
  if (id != null && id !== "") return String(id);
  for (const k of ["id", "ID", "Id", "name", "ISO", "iso_a2", "iso_a3"]) {
    if (props[k] != null && props[k] !== "") return String(props[k]);
  }
  return void 0;
}
function resolveMarkerKind(input) {
  const fromSymbol = normalizeSymbolId(input.symbol);
  if (fromSymbol) return fromSymbol;
  const kind2 = String(input.kind ?? input.style ?? input.fallback ?? "circle").toLowerCase();
  return kind2 || "circle";
}
function normalizeSymbolId(symbol) {
  if (symbol == null || symbol === "") return null;
  if (typeof symbol === "object") {
    const fixed = String(symbol.fixed ?? "").trim();
    if (!fixed) return null;
    return stripSymbolPath(fixed);
  }
  return stripSymbolPath(String(symbol));
}
function stripSymbolPath(raw) {
  let s = raw.trim().toLowerCase();
  const base = s.split("/").pop() || s;
  s = base.replace(/\.svg$/i, "").replace(/\.png$/i, "");
  if (s === "circle" || s === "dot") return "circle";
  if (s === "square" || s === "rect" || s === "box") return "square";
  if (s === "triangle" || s === "tri") return "triangle";
  if (s === "star") return "star";
  if (s === "cross" || s === "plus") return "cross";
  if (s === "x" || s === "xmark") return "x";
  if (s === "diamond" || s === "rhombus") return "diamond";
  if (s === "marker" || s === "pin") return "marker";
  if (s === "pentagon") return "pentagon";
  return s;
}
function resolveRotationDeg(rotation) {
  if (rotation == null || rotation === "") return 0;
  if (typeof rotation === "object") {
    const n2 = Number(rotation.fixed ?? 0);
    return Number.isFinite(n2) ? n2 : 0;
  }
  const n = Number(rotation);
  return Number.isFinite(n) ? n : 0;
}
function buildMarkerStyles(ol, input) {
  const kind2 = resolveMarkerKind({
    kind: input.kind,
    symbol: input.symbol
  });
  const rotationDeg = resolveRotationDeg(input.rotation);
  const rotationRad = rotationDeg * Math.PI / 180;
  const r = Math.max(1, Number(input.radius) || 5);
  const fill = new ol.Fill({ color: input.fillColor });
  const stroke = new ol.Stroke({
    color: input.borderColor,
    width: Math.max(0, Number(input.weight) || 1)
  });
  let image;
  if (kind2 === "square" || kind2 === "rect" || kind2 === "box") {
    image = new ol.RegularShape({
      points: 4,
      radius: r,
      angle: Math.PI / 4 + rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "triangle") {
    image = new ol.RegularShape({
      points: 3,
      radius: r,
      rotation: rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "star") {
    image = new ol.RegularShape({
      points: 5,
      radius: r,
      radius2: r / 2,
      rotation: rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "cross" || kind2 === "plus") {
    image = new ol.RegularShape({
      points: 4,
      radius: r,
      radius2: 0,
      rotation: rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "x" || kind2 === "xmark") {
    image = new ol.RegularShape({
      points: 4,
      radius: r,
      radius2: 0,
      angle: Math.PI / 4,
      rotation: rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "diamond" || kind2 === "rhombus") {
    image = new ol.RegularShape({
      points: 4,
      radius: r,
      rotation: rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "pentagon") {
    image = new ol.RegularShape({
      points: 5,
      radius: r,
      rotation: rotationRad,
      fill,
      stroke
    });
  } else if (kind2 === "marker" || kind2 === "pin") {
    image = new ol.RegularShape({
      points: 3,
      radius: r,
      rotation: Math.PI + rotationRad,
      fill,
      stroke
    });
  } else {
    image = new ol.CircleStyle({
      radius: r,
      fill,
      stroke
    });
  }
  const styles = [];
  if (input.shadow === true) {
    styles.push(
      new ol.Style({
        image: new ol.CircleStyle({
          radius: r + 3,
          fill: new ol.Fill({ color: "rgba(0,0,0,0.35)" })
        })
      })
    );
  }
  styles.push(new ol.Style({ image }));
  const arrowOn = input.arrow === true || input.arrow === "true" || input.arrow === "forward" || input.arrow === "both";
  if (arrowOn) {
    styles.push(
      new ol.Style({
        text: new ol.TextStyle({
          text: "➤",
          font: "12px sans-serif",
          fill: new ol.Fill({ color: input.borderColor }),
          rotation: rotationRad
        })
      })
    );
  }
  const labelsOn = input.showLabels !== false;
  const label = String(input.label ?? "").trim();
  if (labelsOn && label) {
    const fontSize = Number(input.fontSize ?? 11) || 11;
    styles.push(
      new ol.Style({
        text: new ol.TextStyle({
          text: label,
          offsetX: Number(input.offsetX ?? 0) || 0,
          offsetY: Number(input.offsetY ?? -(r + 8)) || -(r + 8),
          fill: new ol.Fill({ color: "var(--grafana-bg-secondary)" }),
          stroke: new ol.Stroke({ color: "var(--grafana-text)", width: 2 }),
          font: `${fontSize}px sans-serif`,
          rotation: rotationRad
        })
      })
    );
  }
  const mainIdx = input.shadow === true ? 1 : 0;
  const mainStyle = styles[Math.min(mainIdx, styles.length - 1)];
  if (mainStyle) {
    mainStyle.__markerMeta = {
      kind: kind2,
      rotationDeg,
      radius: r,
      shadow: input.shadow === true,
      arrow: input.arrow === true || input.arrow === "true" || input.arrow === "forward" || input.arrow === "both"
    };
  }
  return styles;
}
function looksLikeInlineGeoJson(raw) {
  const s = raw.trim();
  return s.startsWith("{") || s.startsWith("[");
}
function isHttpUrl(raw) {
  const s = raw.trim().toLowerCase();
  return s.startsWith("http://") || s.startsWith("https://") || s.startsWith("//");
}
function resolveGeoJsonSource(src, opts) {
  if (src == null || src === "") return { kind: "empty" };
  if (typeof src === "object") {
    return { kind: "inline", inline: src };
  }
  let raw = String(src);
  if (opts?.replaceVariables) {
    try {
      raw = opts.replaceVariables(raw);
    } catch {
    }
  }
  raw = raw.trim();
  if (!raw) return { kind: "empty" };
  if (looksLikeInlineGeoJson(raw)) {
    try {
      return { kind: "inline", inline: JSON.parse(raw), raw };
    } catch {
      return { kind: "empty", raw };
    }
  }
  if (isHttpUrl(raw)) {
    const url = raw.startsWith("//") ? `https:${raw}` : raw;
    return { kind: "url", url, raw };
  }
  if (raw.startsWith("data:")) {
    return { kind: "url", url: raw, raw };
  }
  const stripped = raw.replace(/^(public\/)/, "");
  if (opts?.publicPath) {
    const base = opts.publicPath.endsWith("/") ? opts.publicPath : `${opts.publicPath}/`;
    return { kind: "url", url: base + stripped.replace(/^\//, ""), raw };
  }
  const path = raw.startsWith("public/") ? `/${raw}` : raw.startsWith("/") ? raw : `/${raw}`;
  return { kind: "url", url: path, raw };
}
function pickGeoJsonSrc(layerConfig, panelConfig) {
  const cfg = layerConfig ?? {};
  const panel2 = panelConfig ?? {};
  if (cfg.geojson != null && cfg.geojson !== "") return cfg.geojson;
  if (cfg.src != null && cfg.src !== "") return cfg.src;
  if (cfg.url != null && cfg.url !== "") return cfg.url;
  if (cfg.data != null && cfg.data !== "") return cfg.data;
  if (panel2.geojson != null && panel2.geojson !== "") return panel2.geojson;
  if (panel2.src != null && panel2.src !== "") return panel2.src;
  if (panel2.url != null && panel2.url !== "") return panel2.url;
  return void 0;
}
let shared = null;
const listeners = /* @__PURE__ */ new Set();
function getSharedMapView() {
  return shared ? { ...shared } : null;
}
function setSharedMapView(patch) {
  const next = {
    lat: Number(patch.lat ?? shared?.lat ?? 20),
    lon: Number(patch.lon ?? shared?.lon ?? 0),
    zoom: Number(patch.zoom ?? shared?.zoom ?? 2),
    updatedAt: Date.now()
  };
  shared = next;
  for (const l of listeners) l({ ...next });
  return next;
}
function subscribeSharedMapView(fn) {
  listeners.add(fn);
  return () => listeners.delete(fn);
}
const DEG2RAD = Math.PI / 180;
const RAD2DEG = 180 / Math.PI;
function sunEclipticPosition(julianDay) {
  const n = julianDay - 2451545;
  let L = 280.46 + 0.9856474 * n;
  L %= 360;
  let g = 357.528 + 0.9856003 * n;
  g %= 360;
  const lambda = L + 1.915 * Math.sin(g * DEG2RAD) + 0.02 * Math.sin(2 * g * DEG2RAD);
  const R = 1.00014 - 0.01671 * Math.cos(g * DEG2RAD) - 14e-4 * Math.cos(2 * g * DEG2RAD);
  return { lambda, R };
}
function eclipticObliquity(julianDay) {
  const n = julianDay - 2451545;
  const T = n / 36525;
  return 23.43929111 - T * (46.836769 / 3600 - T * (1831e-7 / 3600 + T * (20034e-7 / 3600 - T * (576e-9 / 3600 - T * 434e-10 / 3600))));
}
function sunEquatorialPosition(sunEclLon, eclObliq) {
  let alpha2 = Math.atan(Math.cos(eclObliq * DEG2RAD) * Math.tan(sunEclLon * DEG2RAD)) * RAD2DEG;
  const delta = Math.asin(Math.sin(eclObliq * DEG2RAD) * Math.sin(sunEclLon * DEG2RAD)) * RAD2DEG;
  const lQuadrant = Math.floor(sunEclLon / 90) * 90;
  const raQuadrant = Math.floor(alpha2 / 90) * 90;
  alpha2 = alpha2 + (lQuadrant - raQuadrant);
  return { alpha: alpha2, delta };
}
function julianDayOf(date) {
  return date.getTime() / 864e5 + 24405875e-1;
}
function gstHours(julianDay) {
  return (18.697374558 + 24.06570982441908 * (julianDay - 2451545)) % 24;
}
function getSunPosition(time = /* @__PURE__ */ new Date()) {
  const date = time instanceof Date ? time : new Date(time);
  const julianDay = julianDayOf(date);
  const gst = gstHours(julianDay);
  const sunEclPos = sunEclipticPosition(julianDay);
  const eclObliq = eclipticObliquity(julianDay);
  const sunEqPos = sunEquatorialPosition(sunEclPos.lambda, eclObliq);
  return [sunEqPos.alpha - gst * 15, sunEqPos.delta];
}
function getNightPolygonRing(time = /* @__PURE__ */ new Date(), step = 2) {
  const date = time instanceof Date ? time : new Date(time);
  const julianDay = julianDayOf(date);
  const gst = gstHours(julianDay);
  const sunEclPos = sunEclipticPosition(julianDay);
  const eclObliq = eclipticObliquity(julianDay);
  const sunEqPos = sunEquatorialPosition(sunEclPos.lambda, eclObliq);
  const lonlat = [];
  const s = Math.max(0.5, Number(step) || 2);
  for (let lon = -180; lon <= 180; lon += s) {
    const ha = gst * 15 + lon - sunEqPos.alpha;
    const lat = Math.atan(-Math.cos(ha * DEG2RAD) / Math.tan(sunEqPos.delta * DEG2RAD)) * RAD2DEG;
    lonlat.push([lon, Number.isFinite(lat) ? lat : 0]);
  }
  const poleLat = sunEqPos.delta < 0 ? 90 : -90;
  for (let tlon = 180; tlon >= -180; tlon -= s) {
    lonlat.push([tlon, poleLat]);
  }
  if (lonlat.length) {
    const first = lonlat[0];
    const last = lonlat[lonlat.length - 1];
    if (first[0] !== last[0] || first[1] !== last[1]) {
      lonlat.push([first[0], first[1]]);
    }
  }
  return lonlat;
}
function nightRingFingerprint(ring2) {
  if (!ring2.length) return "";
  const mid = ring2[Math.floor(ring2.length / 4)] ?? ring2[0];
  const mid2 = ring2[Math.floor(ring2.length / 2)] ?? ring2[0];
  return [mid[0], mid[1], mid2[0], mid2[1], ring2.length].map((n) => typeof n === "number" ? n.toFixed(4) : String(n)).join(",");
}
const _hoisted_1$P = ["data-zoom", "data-lat", "data-lon", "data-view-shared", "data-view-dashboard-variable", "data-view-dashboard-variable-name", "data-view-dashboard-variable-enabled", "data-view-extent", "data-view-variable-written", "data-mouse-wheel-zoom", "data-mouse-wheel-active", "data-show-scale", "data-show-debug", "data-show-zoom", "data-show-measure", "data-show-attribution", "data-measure-mode", "data-measure-active", "data-marker-radius", "data-marker-color", "data-show-labels", "data-opacity", "data-basemap", "data-tiles-ready", "data-tooltip-mode", "data-layer-count", "data-data-layer-type", "data-data-layer-count", "data-geojson-layers", "data-heatmap-layers", "data-location-modes", "data-layer-names", "data-point-count", "data-demo", "data-config-show-legend", "data-config-crop", "data-config-shadow", "data-config-sun", "data-config-show", "data-day-night-time", "data-day-night-active", "data-day-night-features", "data-day-night-fingerprint", "data-day-night-sun-lon", "data-day-night-sun-lat", "data-config-arrow", "data-config-access-token", "data-access-token-applied", "data-tile-url-has-token", "data-config-night-color", "data-config-id-field", "data-config-data-style", "data-config-edge-style", "data-config-kind", "data-config-rotation", "data-config-symbol", "data-config-rules", "data-geojson-matched-rules", "data-geojson-joined-rows", "data-geojson-src-url", "data-geojson-load-error", "data-geojson-remote-features", "data-config-server", "data-config-blur", "data-config-min-zoom", "data-config-max-zoom", "data-config-style", "data-config-theme", "data-config-url", "data-config-src", "data-config-border", "data-config-weight", "data-config-color", "data-config-attribution", "data-type", "data-filter-data", "data-layer-tooltip", "data-view-id", "data-view-no-repeat", "data-wrap-x", "data-basemap-tile-url"];
const _hoisted_2$G = ["data-show", "data-time-ms", "data-fingerprint", "data-features", "title"];
const _hoisted_3$y = {
  key: 1,
  class: "geomap__legend",
  "data-testid": "geomap-legend"
};
const _hoisted_4$p = {
  key: 2,
  class: "geomap__fallback",
  "data-testid": "geomap-fallback"
};
const _hoisted_5$k = {
  viewBox: "0 0 100 90",
  class: "map",
  preserveAspectRatio: "none",
  role: "img",
  "aria-label": "地理地图回退"
};
const _hoisted_6$h = {
  stroke: "var(--grafana-border-weak)",
  "stroke-width": "0.3",
  opacity: "0.55"
};
const _hoisted_7$g = ["y1", "y2"];
const _hoisted_8$b = ["x1", "x2"];
const _hoisted_9$a = ["cx", "cy", "r", "fill"];
const _hoisted_10$8 = ["x", "y"];
const _hoisted_11$8 = {
  key: 3,
  class: "geomap__tooltip",
  "data-testid": "geomap-tooltip"
};
const _hoisted_12$7 = {
  key: 4,
  class: "geomap__debug",
  "data-testid": "geomap-debug"
};
const _hoisted_13$7 = {
  key: 5,
  class: "geomap__measure",
  "data-testid": "geomap-measure"
};
const _hoisted_14$5 = {
  key: 0,
  "data-testid": "geomap-measure-value"
};
const _hoisted_15$5 = {
  key: 6,
  class: "geomap__demo-badge",
  "data-testid": "geomap-demo-badge"
};
const _sfc_main$T = /* @__PURE__ */ defineComponent({
  __name: "GeomapRenderer",
  props: {
    data: {},
    width: {},
    height: {},
    options: {},
    timeRange: {},
    replaceVariables: { type: Function }
  },
  setup(__props, { expose: __expose }) {
    let ol = null;
    async function ensureOl() {
      if (!ol) {
        ol = await Promise.resolve().then(() => olApi);
      }
      return ol;
    }
    const props = __props;
    const opts = computed(() => props.options ?? {});
    const layers = computed(() => normalizeGeomapLayers(props.options ?? {}));
    const dataLayerList = computed(() => dataLayers(layers.value));
    const geoJsonLayerCount = computed(
      () => dataLayerList.value.filter((l) => String(l.type) === "geojson").length
    );
    const heatmapLayerCount = computed(
      () => dataLayerList.value.filter((l) => String(l.type) === "heatmap").length
    );
    const baseLayerCfg = computed(() => basemapLayer(layers.value));
    const host = ref(null);
    const tilesReady = ref(false);
    const fallback = ref(false);
    const hoverLabel = ref(null);
    const measureActive = ref(false);
    const mouseWheelActive = ref(true);
    const measureMode = ref("length");
    const measureText = ref(null);
    let map = null;
    let baseLayer = null;
    const dataVectorLayers = [];
    let dayNightNightLayer = null;
    let dayNightSunLayer = null;
    const dayNightFeatureCount = ref(0);
    const dayNightGeomFingerprint = ref("");
    const dayNightSunLon = ref(null);
    const dayNightSunLat = ref(null);
    let measureSource = null;
    let measureLayer = null;
    let drawInteraction = null;
    let unsubShared = null;
    const basemapType = computed(() => {
      const base = baseLayerCfg.value;
      if (base?.config?.basemapType) {
        const t2 = String(base.config.basemapType);
        return t2 === "default" ? "carto" : t2;
      }
      const b = opts.value.basemap;
      if (typeof b === "string" && b) return b === "default" ? "carto" : b;
      if (b && typeof b === "object" && b.type) {
        const t2 = String(b.type);
        return t2 === "default" || !t2 ? "carto" : t2;
      }
      return "carto";
    });
    const dataLayerType = computed(
      () => String(dataLayerList.value[0]?.type ?? opts.value.type ?? "markers")
    );
    const markerRadius = computed(
      () => Number(dataLayerList.value[0]?.config?.radius ?? opts.value.config?.radius ?? 6)
    );
    const markerColor = computed(
      () => String(
        dataLayerList.value[0]?.config?.color ?? opts.value.config?.color ?? "var(--grafana-primary)"
      )
    );
    const markerBorder = computed(() => String(opts.value.config?.border ?? "var(--grafana-primary)"));
    const layerOpacity = computed(() => {
      const o = dataLayerList.value[0]?.opacity ?? opts.value.opacity;
      return o == null || o === "" ? 1 : Math.max(0, Math.min(1, Number(o)));
    });
    const showLabels = computed(
      () => Boolean(opts.value.config?.showLabels ?? dataLayerList.value[0]?.config?.showLabels)
    );
    const tooltipMode = computed(() => String(opts.value.tooltip?.mode ?? "details"));
    const showMeasure = computed(() => Boolean(opts.value.controls?.showMeasure));
    const panelConfig = computed(() => opts.value.config ?? {});
    const legendEnabled = computed(() => panelConfig.value.showLegend === true);
    const configCrop = computed(() => panelConfig.value.crop === true);
    const configShadow = computed(() => panelConfig.value.shadow === true);
    const configSun = computed(() => panelConfig.value.sun === true);
    const dayNightShow = computed(() => {
      const raw = String(panelConfig.value.show ?? "to").toLowerCase();
      if (raw === "from" || raw === "to") return raw;
      return "to";
    });
    const dayNightTimeMs = computed(() => {
      const tr = props.timeRange ?? props.data?.timeRange;
      const fromRaw = tr?.from;
      const toRaw2 = tr?.to;
      const fromMs = fromRaw?.valueOf?.() ?? (typeof fromRaw === "number" ? fromRaw : Date.now() - 36e5);
      const toMs2 = toRaw2?.valueOf?.() ?? (typeof toRaw2 === "number" ? toRaw2 : Date.now());
      return dayNightShow.value === "from" ? Number(fromMs) : Number(toMs2);
    });
    const configArrow = computed(() => {
      const a = panelConfig.value.arrow;
      if (a === true || a === "true") return true;
      if (typeof a === "string" && a && a !== "false") return true;
      return a === true;
    });
    const accessToken = computed(
      () => String(panelConfig.value.accessToken ?? opts.value.accessToken ?? "")
    );
    const nightColor = computed(() => String(panelConfig.value.nightColor ?? "rgba(0,0,40,0.35)"));
    const dayNightActive = computed(() => {
      if (configSun.value) return true;
      return layers.value.some((l) => String(l.type) === "dayNight");
    });
    const idField = computed(
      () => String(panelConfig.value.idField ?? dataLayerList.value[0]?.config?.idField ?? "")
    );
    const dataStyle = computed(
      () => String(panelConfig.value.dataStyle ?? dataLayerList.value[0]?.config?.dataStyle ?? "")
    );
    const edgeStyle = computed(
      () => String(panelConfig.value.edgeStyle ?? dataLayerList.value[0]?.config?.edgeStyle ?? "")
    );
    const layerKind = computed(
      () => resolveMarkerKind({
        kind: panelConfig.value.kind ?? dataLayerList.value[0]?.config?.kind,
        symbol: panelConfig.value.symbol ?? dataLayerList.value[0]?.config?.symbol,
        style: panelConfig.value.style ?? dataLayerList.value[0]?.config?.style,
        fallback: String(dataLayerType.value || "circle")
      })
    );
    const resolvedSymbol = computed(
      () => resolveMarkerKind({
        kind: panelConfig.value.kind ?? dataLayerList.value[0]?.config?.kind,
        symbol: panelConfig.value.symbol ?? dataLayerList.value[0]?.config?.symbol,
        style: panelConfig.value.style ?? dataLayerList.value[0]?.config?.style,
        fallback: "circle"
      })
    );
    const resolvedRotation = computed(
      () => resolveRotationDeg(panelConfig.value.rotation ?? dataLayerList.value[0]?.config?.rotation ?? 0)
    );
    const layerTooltip = computed(
      () => String(opts.value["layer-tooltip"] ?? opts.value.layerTooltip ?? tooltipMode.value)
    );
    const rulesCount = computed(() => {
      const r = panelConfig.value.rules ?? dataLayerList.value[0]?.config?.rules;
      return Array.isArray(r) ? r.length : r ? 1 : 0;
    });
    const configServer = computed(
      () => String(panelConfig.value.server ?? dataLayerList.value[0]?.config?.server ?? "")
    );
    const configBlur = computed(
      () => Number(panelConfig.value.blur ?? dataLayerList.value[0]?.config?.blur ?? 0)
    );
    const configMinZoom = computed(
      () => String(panelConfig.value.minZoom ?? opts.value.view?.minZoom ?? "")
    );
    const configMaxZoom = computed(
      () => String(panelConfig.value.maxZoom ?? opts.value.view?.maxZoom ?? "")
    );
    const configStyle = computed(
      () => String(panelConfig.value.style ?? dataLayerList.value[0]?.config?.style ?? "")
    );
    const configTheme = computed(
      () => String(
        panelConfig.value.theme ?? baseLayerCfg.value?.config?.theme ?? opts.value.basemap?.config?.theme ?? ""
      )
    );
    const configUrl = computed(
      () => String(
        panelConfig.value.url ?? baseLayerCfg.value?.config?.url ?? opts.value.basemap?.config?.url ?? ""
      )
    );
    const configSrc = computed(() => {
      const s = panelConfig.value.src ?? panelConfig.value.geojson ?? dataLayerList.value[0]?.config?.src ?? dataLayerList.value[0]?.config?.geojson;
      return s == null || s === "" ? "" : "set";
    });
    const configWeight = computed(
      () => Number(panelConfig.value.weight ?? dataLayerList.value[0]?.config?.weight ?? 1)
    );
    const configAttribution = computed(
      () => String(
        panelConfig.value.attribution ?? opts.value.basemap?.config?.attribution ?? baseLayerCfg.value?.config?.attribution ?? ""
      )
    );
    const viewNoRepeat = computed(() => Boolean(opts.value.view?.noRepeat));
    const viewDashboardVariable = computed(() => String(opts.value.view?.dashboardVariable ?? ""));
    const viewDashboardVariableName = computed(
      () => String(opts.value.view?.dashboardVariableName ?? "")
    );
    const viewDashboardVariableEnabled = computed(() => {
      const v = opts.value.view?.dashboardVariable;
      if (v === true || v === "true" || v === 1 || v === "1") return true;
      if (typeof v === "string") {
        const s = v.trim().toLowerCase();
        return s !== "" && s !== "false" && s !== "0" && s !== "no";
      }
      return false;
    });
    const viewExtentAttr = ref("");
    const viewVariableWritten = ref("");
    let geoVarTimer = null;
    let unsubViewVar = null;
    function resolveDashboardVariableName() {
      const named = String(opts.value.view?.dashboardVariableName ?? "").trim();
      if (named) return named;
      const v = opts.value.view?.dashboardVariable;
      if (typeof v === "string") {
        const s = v.trim();
        if (s && s !== "true" && s !== "false") return s;
      }
      return "";
    }
    function publishDashboardVariableFromView(immediate = false) {
      if (!map || !ol) return;
      if (!viewDashboardVariableEnabled.value) {
        viewExtentAttr.value = "";
        viewVariableWritten.value = "";
        return;
      }
      const name = resolveDashboardVariableName();
      if (!name) {
        viewVariableWritten.value = "";
        return;
      }
      const run = () => {
        if (!map || !ol) return;
        try {
          const view = map.getView();
          const size = map.getSize?.() ?? null;
          const extent = typeof view.calculateExtent === "function" ? view.calculateExtent(size ?? void 0) : null;
          if (!extent || extent.length < 4) return;
          const b = ol.transformExtent(extent, "EPSG:3857", "EPSG:4326");
          const value = `${b[0]},${b[1]},${b[2]},${b[3]}`;
          viewExtentAttr.value = value;
          viewVariableWritten.value = name;
          try {
            const url = new URL(window.location.href);
            url.searchParams.set(`var-${name}`, value);
            window.history.replaceState({}, "", url.toString());
          } catch {
          }
          try {
            window.dispatchEvent(
              new CustomEvent("grafana-vue:set-variable", {
                detail: { name, value, source: "geomap" }
              })
            );
          } catch {
          }
        } catch {
        }
      };
      if (geoVarTimer) clearTimeout(geoVarTimer);
      if (immediate) run();
      else geoVarTimer = setTimeout(run, 50);
    }
    function wireDashboardVariableSync() {
      if (unsubViewVar) {
        unsubViewVar();
        unsubViewVar = null;
      }
      if (!map) return;
      const handler = () => publishDashboardVariableFromView(false);
      map.on("moveend", handler);
      unsubViewVar = () => {
        try {
          map?.un?.("moveend", handler);
        } catch {
        }
      };
      if (viewDashboardVariableEnabled.value) {
        publishDashboardVariableFromView(true);
      }
    }
    const panelLayerType = computed(() => String(opts.value.type ?? dataLayerType.value ?? ""));
    const filterDataKey = computed(() => {
      const fd = opts.value.filterData ?? dataLayerList.value[0]?.filterData ?? null;
      if (fd == null || fd === "") return "";
      if (typeof fd === "string") return fd;
      if (typeof fd === "object") {
        const o = fd;
        return String(o.options ?? o.id ?? "set");
      }
      return String(fd);
    });
    const usingDemoData = computed(() => false);
    const layerPoints = computed(() => {
      const series = props.data?.series ?? [];
      return resolveAllLayerPoints(series, layers.value, opts.value.filterData);
    });
    const geoPoints = computed(() => layerPoints.value.flatMap((lp) => lp.points));
    const locationModes = computed(
      () => dataLayerList.value.map((l) => String(l.location?.mode ?? "auto")).join(",")
    );
    function resolveAccessTokenUrl(url, token) {
      if (!url) return url;
      const tok = String(token ?? "").trim();
      if (!tok) return url;
      let out = url.replaceAll(/\{access_token\}/gi, encodeURIComponent(tok)).replaceAll("{accessToken}", encodeURIComponent(tok));
      if (/mapbox\.com|mapbox:\/\//i.test(out) && !/[?&]access_token=/i.test(out)) {
        out += `${out.includes("?") ? "&" : "?"}access_token=${encodeURIComponent(tok)}`;
      }
      return out;
    }
    const tileUrlResolved = computed(() => {
      const cfg = {
        ...opts.value.config ?? {},
        ...opts.value.basemap?.config ?? {},
        ...baseLayerCfg.value?.config ?? {}
      };
      const raw = String(cfg.url || opts.value.config?.url || "");
      return resolveAccessTokenUrl(raw, accessToken.value);
    });
    const ESRI_SERVER_SLUGS = {
      "streets": "World_Street_Map",
      "world-street": "World_Street_Map",
      "world-imagery": "World_Imagery",
      "satellite": "World_Imagery",
      "imagery": "World_Imagery",
      "world-physical": "World_Physical_Map",
      "physical": "World_Physical_Map",
      "topo": "World_Topo_Map",
      "usa-topo": "USA_Topo_Maps",
      "ocean": "Ocean/World_Ocean_Base"
    };
    function resolveEsriServerUrl(server, customUrl) {
      const key = String(server || "streets").trim().toLowerCase();
      if (key === "custom") {
        return String(customUrl || "").trim();
      }
      const slug = ESRI_SERVER_SLUGS[key] || ESRI_SERVER_SLUGS.streets;
      return `https://services.arcgisonline.com/ArcGIS/rest/services/${slug}/MapServer/tile/{z}/{y}/{x}`;
    }
    const basemapTileUrl = ref("");
    const geojsonMatchedRules = ref(0);
    const geojsonJoinedRows = ref(0);
    const geojsonSrcUrl = ref("");
    const geojsonLoadError = ref("");
    const geojsonFeatureCountRemote = ref(0);
    const basemapWrapX = ref(true);
    function createBaseSource(type) {
      if (!ol) throw new Error("OpenLayers not loaded");
      if (type === "none") {
        basemapTileUrl.value = "";
        basemapWrapX.value = !viewNoRepeat.value;
        return null;
      }
      const wrapX = !viewNoRepeat.value;
      basemapWrapX.value = wrapX;
      if (type === "osm") {
        basemapTileUrl.value = "osm";
        return new ol.OSM({ wrapX });
      }
      const cfg = {
        ...opts.value.config ?? {},
        ...opts.value.basemap?.config ?? {},
        ...baseLayerCfg.value?.config ?? {}
      };
      const serverRaw = String(cfg.server ?? "").trim();
      const serverKey = serverRaw.toLowerCase();
      const knownEsri = !!serverKey && (serverKey in ESRI_SERVER_SLUGS || serverKey === "custom");
      const explicitEsri = type === "esri" || type === "esri-xyz" || type === "arcgis";
      if (explicitEsri || knownEsri) {
        const isUrlLike = /^https?:\/\//i.test(serverRaw);
        const server = !serverRaw ? "streets" : isUrlLike ? "custom" : serverRaw;
        const url = resolveEsriServerUrl(server, isUrlLike ? serverRaw : String(cfg.url || ""));
        if (url) {
          basemapTileUrl.value = url;
          return new ol.XYZ({
            url,
            attributions: cfg.attribution || `Tiles © <a href="https://services.arcgisonline.com/ArcGIS/rest/services/">ArcGIS</a>`,
            wrapX
          });
        }
      }
      if (type === "xyz" || type === "xyztiles") {
        const rawUrl = String(
          cfg.url || opts.value.config?.url || "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
        );
        const url = resolveAccessTokenUrl(rawUrl, accessToken.value);
        basemapTileUrl.value = url;
        return new ol.XYZ({
          url,
          attributions: cfg.attribution || void 0,
          wrapX
        });
      }
      let theme = String(cfg.theme ?? "auto");
      if (!theme || theme === "auto") theme = "dark";
      const showLabels2 = cfg.showLabels !== false;
      const style = `${theme}${showLabels2 ? "_all" : "_nolabels"}`;
      const scale = typeof window !== "undefined" && window.devicePixelRatio > 1 ? "@2x" : "";
      const cartoUrl = `https://{1-4}.basemaps.cartocdn.com/${style}/{z}/{x}/{y}${scale}.png`;
      basemapTileUrl.value = cartoUrl;
      return new ol.XYZ({
        url: cartoUrl,
        wrapX,
        attributions: configAttribution.value || '<a href="https://carto.com/attribution/">©CARTO</a> <a href="https://www.openstreetmap.org/copyright">©OpenStreetMap</a> contributors'
      });
    }
    const LAYER_PALETTE = [
      "var(--grafana-primary)",
      "rgba(220, 80, 80, 0.75)",
      "rgba(70, 180, 100, 0.75)",
      "rgba(240, 180, 40, 0.75)",
      "rgba(160, 90, 200, 0.75)"
    ];
    function styleForLayer(layer, value, label, index2) {
      const cfg = layer.config ?? {};
      const panel2 = panelConfig.value;
      const baseR = Number(cfg.radius ?? markerRadius.value);
      const color = String(cfg.color ?? LAYER_PALETTE[index2 % LAYER_PALETTE.length]);
      const border = String(cfg.border ?? markerBorder.value);
      const blur = Number(cfg.blur ?? (layer.type === "heatmap" ? 8 : 0));
      const weight = Number(cfg.weight ?? opts.value.config?.weight ?? 1);
      const radius = baseR + Math.min(10, Math.abs(value) / 20);
      layer.opacity == null ? 1 : Math.max(0, Math.min(1, Number(layer.opacity)));
      const fillColor = color.includes("rgba") ? color : color;
      const shadowOn = cfg.shadow === true || cfg.shadow == null && panel2.shadow === true;
      const images = [];
      const kind2 = resolveMarkerKind({
        kind: cfg.kind ?? panel2.kind,
        symbol: cfg.symbol ?? panel2.symbol,
        style: cfg.style ?? panel2.style,
        fallback: "circle"
      });
      const rotation = cfg.rotation ?? panel2.rotation ?? 0;
      let textLabel = label;
      const textCfg = cfg.text ?? panel2.text;
      if (textCfg && typeof textCfg === "object" && textCfg.fixed != null) {
        textLabel = String(textCfg.fixed);
      } else if (typeof textCfg === "string" && textCfg.trim()) {
        const key = textCfg.trim();
        if (key.startsWith("fixed:") || key !== "label" && key !== "name" && key !== "value" && !/^[a-z_][\w.]*$/i.test(key)) {
          textLabel = key.replace(/^fixed:/, "");
        } else if (key.startsWith("fixed:")) {
          textLabel = key.slice(6);
        } else if (!label) {
          textLabel = key;
        }
        if (key.startsWith("fixed:")) textLabel = key.slice(6);
      }
      const textConfig = cfg.textConfig ?? panel2.textConfig ?? {};
      const arrowRaw = cfg.arrow ?? panel2.arrow ?? false;
      const markerStyles = buildMarkerStyles(
        {
          Style: ol.Style,
          CircleStyle: ol.CircleStyle,
          RegularShape: ol.RegularShape,
          Fill: ol.Fill,
          Stroke: ol.Stroke,
          TextStyle: ol.TextStyle
        },
        {
          kind: kind2,
          symbol: cfg.symbol ?? panel2.symbol,
          rotation,
          radius: radius + blur,
          fillColor,
          borderColor: border,
          weight,
          label: textLabel,
          showLabels: Boolean(cfg.showLabels ?? showLabels.value),
          fontSize: Number(textConfig.fontSize ?? cfg.fontSize ?? 11) || 11,
          offsetX: Number(textConfig.offsetX ?? cfg.textOffsetX ?? 0) || 0,
          offsetY: textConfig.offsetY != null ? Number(textConfig.offsetY) : cfg.textOffsetY != null ? Number(cfg.textOffsetY) : void 0,
          arrow: arrowRaw,
          shadow: shadowOn
        }
      );
      images.push(...markerStyles);
      return images;
    }
    function clearDataLayers() {
      if (!map) return;
      for (const vl of dataVectorLayers) {
        map.removeLayer(vl);
      }
      dataVectorLayers.length = 0;
    }
    function clearDayNightLayers() {
      if (!map) return;
      if (dayNightNightLayer) {
        map.removeLayer(dayNightNightLayer);
        dayNightNightLayer = null;
      }
      if (dayNightSunLayer) {
        map.removeLayer(dayNightSunLayer);
        dayNightSunLayer = null;
      }
      dayNightFeatureCount.value = 0;
      dayNightGeomFingerprint.value = "";
      dayNightSunLon.value = null;
      dayNightSunLat.value = null;
    }
    function syncDayNightLayer() {
      if (!map || !ol) return;
      if (!dayNightActive.value) {
        clearDayNightLayers();
        return;
      }
      const time = new Date(Number(dayNightTimeMs.value) || Date.now());
      const ring2 = getNightPolygonRing(time, 2);
      const fp = nightRingFingerprint(ring2);
      const coords = ring2.map(([lon, lat]) => ol.fromLonLat([lon, lat]));
      const poly = new ol.Polygon([coords]);
      const nightFeat = new ol.Feature({
        geometry: poly,
        kind: "dayNight-night"
      });
      nightFeat.set("dayNightTimeMs", Number(dayNightTimeMs.value));
      nightFeat.set("dayNightShow", dayNightShow.value);
      nightFeat.set("nightColor", nightColor.value);
      nightFeat.set("fingerprint", fp);
      const nightSrc = new ol.VectorSource({ features: [nightFeat] });
      const nightStyle = new ol.Style({
        fill: new ol.Fill({ color: nightColor.value })
      });
      if (!dayNightNightLayer) {
        dayNightNightLayer = new ol.VectorLayer({
          source: nightSrc,
          style: nightStyle,
          properties: { name: "dayNight", type: "dayNight", role: "night" },
          zIndex: 5
        });
        map.addLayer(dayNightNightLayer);
      } else {
        dayNightNightLayer.setSource(nightSrc);
        dayNightNightLayer.setStyle(nightStyle);
      }
      dayNightFeatureCount.value = 1;
      dayNightGeomFingerprint.value = fp;
      if (configSun.value || dayNightActive.value) {
        const [slon, slat] = getSunPosition(time);
        dayNightSunLon.value = slon;
        dayNightSunLat.value = slat;
        const sunFeat = new ol.Feature({
          geometry: new ol.Point(ol.fromLonLat([slon, slat])),
          kind: "dayNight-sun"
        });
        sunFeat.set("sunLon", slon);
        sunFeat.set("sunLat", slat);
        const sunSrc = new ol.VectorSource({ features: [sunFeat] });
        const sunStyle = new ol.Style({
          image: new ol.CircleStyle({
            radius: 13,
            fill: new ol.Fill({ color: "rgb(253,184,19)" })
          })
        });
        if (configSun.value) {
          if (!dayNightSunLayer) {
            dayNightSunLayer = new ol.VectorLayer({
              source: sunSrc,
              style: sunStyle,
              properties: { name: "dayNight-sun", type: "dayNight", role: "sun" },
              zIndex: 6
            });
            map.addLayer(dayNightSunLayer);
          } else {
            dayNightSunLayer.setSource(sunSrc);
            dayNightSunLayer.setStyle(sunStyle);
          }
        } else if (dayNightSunLayer) {
          map.removeLayer(dayNightSunLayer);
          dayNightSunLayer = null;
        }
      }
    }
    function loadGeoJsonFeatures(layer) {
      const cfg = layer.config ?? {};
      const resolved = resolveGeoJsonSource(
        pickGeoJsonSrc(cfg, panelConfig.value),
        { replaceVariables: props.replaceVariables }
      );
      if (resolved.kind !== "inline" || !resolved.inline) return [];
      try {
        const format = new ol.GeoJSON();
        return format.readFeatures(resolved.inline, {
          dataProjection: "EPSG:4326",
          featureProjection: "EPSG:3857"
        });
      } catch {
        return [];
      }
    }
    function resolveLayerGeoJsonUrl(layer) {
      const cfg = layer.config ?? {};
      const resolved = resolveGeoJsonSource(
        pickGeoJsonSrc(cfg, panelConfig.value),
        { replaceVariables: props.replaceVariables }
      );
      return resolved.kind === "url" ? resolved.url : void 0;
    }
    function styleGeoJsonFeatures(feats, layer, index2, source) {
      const fallbackColor = String(layer.config?.color ?? LAYER_PALETTE[index2 % LAYER_PALETTE.length]);
      const idFieldName = String(layer.config?.idField ?? panelConfig.value.idField ?? "");
      const frame0 = (props.data?.series ?? [])[0];
      const idToRow = buildIdToRowIndex(frame0, idFieldName || void 0);
      let matchedRules = 0;
      let joinedRows = 0;
      for (const f of feats) {
        const propsMap = {
          ...f.getProperties?.() ?? {}
        };
        const fid = featureIdOf(f, propsMap);
        let rowIndex;
        if (fid != null && idToRow.has(fid)) {
          rowIndex = idToRow.get(fid);
          joinedRows++;
          const row = rowPropsFromFrame(frame0, rowIndex);
          Object.assign(propsMap, row);
          f.set("frame", frame0);
          f.set("rowIndex", rowIndex);
          for (const [k, v] of Object.entries(row)) {
            if (f.get(k) == null) f.set(k, v);
          }
        }
        const resolved = resolveGeoJsonFeatureStyle({
          featureProps: propsMap,
          layerConfig: layer.config ?? {},
          panelConfig: panelConfig.value,
          fallbackColor,
          rowIndex
        });
        if (resolved.matchedRuleIndex >= 0) matchedRules++;
        const fillColor = resolved.color.includes("rgba") ? resolved.color : resolved.color.length === 7 ? `${resolved.color}55` : resolved.color;
        f.set("resolvedColor", resolved.color);
        f.set("matchedRuleIndex", resolved.matchedRuleIndex);
        f.setStyle(
          new ol.Style({
            stroke: new ol.Stroke({
              color: resolved.border || resolved.color,
              width: resolved.weight
            }),
            fill: new ol.Fill({
              color: fillColor
            }),
            image: new ol.CircleStyle({
              radius: resolved.radius,
              fill: new ol.Fill({ color: resolved.color }),
              stroke: new ol.Stroke({
                color: resolved.border || resolved.color,
                width: Math.max(1, resolved.weight / 2)
              })
            })
          })
        );
        f.set("resolvedOpacity", resolved.opacity);
      }
      source.set?.("geojsonMatchedRules", matchedRules);
      source.set?.("geojsonJoinedRows", joinedRows);
      source.set?.("geojsonIdField", idFieldName);
      source.set?.("geojsonSrcUrl", resolveLayerGeoJsonUrl(layer) ?? "");
      geojsonMatchedRules.value = matchedRules;
      geojsonJoinedRows.value = joinedRows;
      return { matchedRules, joinedRows, count: feats.length };
    }
    function syncMultiLayerFeatures() {
      if (!map) return;
      clearDataLayers();
      layerPoints.value.forEach(({ layer, points }, index2) => {
        if (String(layer.type) === "dayNight") return;
        const source = new ol.VectorSource();
        const isRoute = layer.type === "route";
        const isGeoJson = layer.type === "geojson";
        const coords = [];
        let geoJsonFeatureCount = 0;
        if (isGeoJson) {
          const remoteUrl = resolveLayerGeoJsonUrl(layer);
          if (remoteUrl) {
            const urlSource = new ol.VectorSource({
              url: remoteUrl,
              format: new ol.GeoJSON()
            });
            urlSource.set?.("geojsonSrcUrl", remoteUrl);
            geojsonSrcUrl.value = remoteUrl;
            geojsonLoadError.value = "";
            const key = urlSource.on("change", () => {
              const state2 = urlSource.getState();
              if (state2 === "ready") {
                try {
                  if (ol && "unByKey" in ol) ol.unByKey(key);
                } catch {
                }
                const feats = urlSource.getFeatures();
                geoJsonFeatureCount = feats.length;
                styleGeoJsonFeatures(feats, layer, index2, urlSource);
                geojsonFeatureCountRemote.value = feats.length;
              } else if (state2 === "error") {
                geojsonLoadError.value = `GeoJSON load failed: ${remoteUrl}`;
              }
            });
            layer.__geojsonRemoteUrl = remoteUrl;
            source.__replaceWith = urlSource;
            source.set?.("geojsonSrcUrl", remoteUrl);
            geoJsonFeatureCount = 0;
          } else {
            const feats = loadGeoJsonFeatures(layer);
            geoJsonFeatureCount = feats.length;
            for (const f of feats) source.addFeature(f);
            styleGeoJsonFeatures(feats, layer, index2, source);
            geojsonSrcUrl.value = "";
            geojsonLoadError.value = "";
            geojsonFeatureCountRemote.value = 0;
          }
        }
        for (const p of points) {
          if (isGeoJson && (geoJsonFeatureCount || layer.__geojsonRemoteUrl)) break;
          if (!Number.isFinite(p.lon) || !Number.isFinite(p.lat)) continue;
          const c = ol.fromLonLat([p.lon, p.lat]);
          coords.push(c);
          const feature = new ol.Feature({
            geometry: new ol.Point(c),
            label: p.label,
            value: p.value,
            layerName: layer.name
          });
          feature.setStyle(styleForLayer(layer, p.value, p.label, index2));
          source.addFeature(feature);
        }
        if (isRoute && coords.length >= 2) {
          const line = new ol.Feature({
            geometry: new ol.LineString(coords)
          });
          const color = String(layer.config?.color ?? LAYER_PALETTE[index2 % LAYER_PALETTE.length]);
          const edge = String(
            layer.config?.edgeStyle ?? panelConfig.value.edgeStyle ?? ""
          ).toLowerCase();
          const dash = edge === "dash" || edge === "dashed" ? [8, 6] : edge === "dot" || edge === "dotted" ? [2, 6] : void 0;
          line.setStyle(
            new ol.Style({
              stroke: new ol.Stroke({
                color,
                width: Number(layer.config?.weight ?? 3),
                lineDash: dash
              })
            })
          );
          source.addFeature(line);
        }
        const opacity = layer.opacity == null ? 1 : Math.max(0, Math.min(1, Number(layer.opacity)));
        let vl;
        if (layer.type === "heatmap") {
          vl = new ol.HeatmapLayer({
            source,
            blur: Number(layer.config?.blur ?? 15),
            radius: Number(layer.config?.radius ?? 8),
            opacity,
            weight: (feature) => {
              const v = Number(feature.get("value") ?? 1);
              return Number.isFinite(v) ? Math.max(0.05, Math.min(1, Math.abs(v) / 100)) : 0.5;
            },
            properties: {
              name: layer.name,
              type: layer.type,
              tooltip: layer.tooltip !== false
            }
          });
        } else {
          const srcFinal = source.__replaceWith ?? source;
          vl = new ol.VectorLayer({
            source: srcFinal,
            opacity,
            properties: {
              name: layer.name,
              type: layer.type,
              tooltip: layer.tooltip !== false,
              geoJsonFeatures: geoJsonFeatureCount,
              geojsonSrcUrl: srcFinal.get?.("geojsonSrcUrl") ?? layer.__geojsonRemoteUrl ?? ""
            }
          });
        }
        map.addLayer(vl);
        dataVectorLayers.push(vl);
      });
      syncDayNightLayer();
      applyView();
    }
    function resolveViewNum(raw, fallback2) {
      if (raw == null || raw === "") return fallback2;
      let s = String(raw);
      if (props.replaceVariables) {
        try {
          s = props.replaceVariables(s);
        } catch {
        }
      }
      const n = Number(s);
      return Number.isFinite(n) ? n : fallback2;
    }
    function wireSharedView() {
      if (unsubShared) {
        unsubShared();
        unsubShared = null;
      }
      if (!map) return;
      if (!opts.value.view?.shared) return;
      unsubShared = subscribeSharedMapView((sv) => {
        if (!map) return;
        const view = map.getView();
        const cur = view.getCenter();
        const curZoom = view.getZoom() ?? 2;
        const [lon, lat] = cur ? ol.toLonLat(cur) : [sv.lon, sv.lat];
        if (Math.abs(lat - sv.lat) < 1e-6 && Math.abs(lon - sv.lon) < 1e-6 && Math.abs(curZoom - sv.zoom) < 1e-6) {
          return;
        }
        view.setCenter(ol.fromLonLat([sv.lon, sv.lat]));
        view.setZoom(sv.zoom);
      });
      map.on("moveend", () => {
        if (!opts.value.view?.shared || !map) return;
        const view = map.getView();
        const c = view.getCenter();
        if (!c) return;
        const [lon, lat] = ol.toLonLat(c);
        setSharedMapView({ lat, lon, zoom: view.getZoom() ?? 2 });
      });
    }
    const MAP_CENTER_PRESETS = {
      "zero": { lat: 0, lon: 0, zoom: 1 },
      "coords": {},
      // use view.lat/lon/zoom
      "fit": { fit: true, zoom: 15 },
      "north-america": { lat: 40, lon: -100, zoom: 4 },
      "south-america": { lat: -20, lon: -60, zoom: 3 },
      "europe": { lat: 46, lon: 14, zoom: 4 },
      "africa": { lat: 0, lon: 30, zoom: 3 },
      "west-asia": { lat: 26, lon: 53, zoom: 4 },
      "s-asia": { lat: 19.5, lon: 80, zoom: 4 },
      "se-asia": { lat: 10, lon: 106, zoom: 4 },
      "e-asia": { lat: 33, lon: 120, zoom: 4 },
      "australia": { lat: -25, lon: 135, zoom: 4 },
      "oceania": { lat: -10, lon: -140, zoom: 3 }
    };
    const resolvedMapView = computed(() => {
      const rawId = opts.value.view?.id;
      const hasCoords = opts.value.view?.lat != null || opts.value.view?.lon != null || opts.value.view?.center != null;
      const viewId = String(rawId ?? (hasCoords ? "coords" : "zero"));
      const preset = MAP_CENTER_PRESETS[viewId] ?? MAP_CENTER_PRESETS.coords;
      let zoom = resolveViewNum(opts.value.view?.zoom ?? preset?.zoom, preset?.zoom ?? 1);
      let lat = resolveViewNum(
        opts.value.view?.lat ?? opts.value.view?.center?.[1] ?? preset?.lat,
        preset?.lat ?? 0
      );
      let lon = resolveViewNum(
        opts.value.view?.lon ?? opts.value.view?.center?.[0] ?? preset?.lon,
        preset?.lon ?? 0
      );
      if (preset && preset.lat != null && viewId !== "coords" && viewId !== "fit" && viewId !== "zero") {
        lat = preset.lat;
        lon = preset.lon ?? 0;
        if (preset.zoom != null && opts.value.view?.zoom == null) zoom = preset.zoom;
      }
      if (viewId === "zero") {
        lat = 0;
        lon = 0;
        zoom = resolveViewNum(opts.value.view?.zoom, preset?.zoom ?? 1);
      }
      return { id: viewId, lat, lon, zoom, fit: viewId === "fit" || !!preset?.fit };
    });
    function fitViewToData(view, maxZoom) {
      const coords = geoPoints.value.filter((p) => Number.isFinite(p.lon) && Number.isFinite(p.lat)).map((p) => ol.fromLonLat([p.lon, p.lat]));
      if (!coords.length) {
        view.setCenter(ol.fromLonLat([0, 0]));
        view.setZoom(1);
        return;
      }
      if (coords.length === 1) {
        view.setCenter(coords[0]);
        view.setZoom(Math.min(maxZoom, 8));
        return;
      }
      let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
      for (const c of coords) {
        minX = Math.min(minX, c[0]);
        minY = Math.min(minY, c[1]);
        maxX = Math.max(maxX, c[0]);
        maxY = Math.max(maxY, c[1]);
      }
      const extent = [minX, minY, maxX, maxY];
      try {
        view.fit(extent, { padding: [40, 40, 40, 40], maxZoom, duration: 0 });
      } catch {
        const cx = (minX + maxX) / 2;
        const cy = (minY + maxY) / 2;
        view.setCenter([cx, cy]);
        view.setZoom(Math.min(maxZoom, 4));
      }
    }
    function applyView() {
      if (!map) return;
      const view = map.getView();
      const rv = resolvedMapView.value;
      const viewId = rv.id;
      const preset = MAP_CENTER_PRESETS[viewId] ?? MAP_CENTER_PRESETS.coords;
      let zoom = rv.zoom;
      let lat = rv.lat;
      let lon = rv.lon;
      const shared2 = Boolean(opts.value.view?.shared);
      if (shared2 && viewId !== "fit") {
        const sv = getSharedMapView();
        if (sv) {
          lat = sv.lat;
          lon = sv.lon;
          zoom = sv.zoom;
        } else {
          setSharedMapView({ lat, lon, zoom });
        }
      }
      if (viewId === "fit" || preset?.fit) {
        fitViewToData(view, zoom || 15);
      } else if (Number.isFinite(lat) && Number.isFinite(lon)) {
        view.setCenter(ol.fromLonLat([lon, lat]));
        view.setZoom(zoom);
        if (shared2) setSharedMapView({ lat, lon, zoom });
      } else if (geoPoints.value.length) {
        fitViewToData(view, Math.max(zoom, 4));
      }
      const minZ = opts.value.config?.minZoom;
      const maxZ = opts.value.config?.maxZoom;
      if (minZ != null && minZ !== "") view.setMinZoom(Number(minZ));
      if (maxZ != null && maxZ !== "") view.setMaxZoom(Number(maxZ));
    }
    function applyControls() {
      if (!map) return;
      const c = opts.value.controls ?? {};
      const controls = map.getControls();
      controls.clear();
      if (c.showZoom !== false) controls.push(new ol.Zoom());
      if (c.showScale) controls.push(new ol.ScaleLine());
      if (c.showAttribution !== false)
        controls.push(new ol.Attribution({ collapsible: true, collapsed: true }));
      const wantWheel = c.mouseWheelZoom !== false;
      let foundWheel = false;
      try {
        const interactions = map.getInteractions().getArray();
        for (const it of interactions) {
          if (String(it.constructor.name).toLowerCase().includes("mousewheel")) {
            it.setActive(wantWheel);
            foundWheel = true;
          }
        }
      } catch {
      }
      mouseWheelActive.value = wantWheel;
      if (!c.showMeasure) {
        stopMeasure();
      }
    }
    function applyBasemap() {
      if (!map) return;
      const type = basemapType.value;
      const src = createBaseSource(type);
      if (baseLayer) {
        map.removeLayer(baseLayer);
        baseLayer = null;
      }
      if (src) {
        baseLayer = new ol.TileLayer({ source: src });
        map.getLayers().insertAt(0, baseLayer);
      }
    }
    function formatLength(line) {
      const len = ol.getLength(line);
      if (len > 1e3) return `${(len / 1e3).toFixed(2)} km`;
      return `${len.toFixed(0)} m`;
    }
    function formatArea(poly) {
      const area = ol.getArea(poly);
      if (area > 1e6) return `${(area / 1e6).toFixed(2)} km²`;
      return `${area.toFixed(0)} m²`;
    }
    function stopMeasure() {
      measureActive.value = false;
      measureText.value = null;
      if (map && drawInteraction) {
        map.removeInteraction(drawInteraction);
        drawInteraction = null;
      }
      if (map && measureLayer) {
        map.removeLayer(measureLayer);
        measureLayer = null;
      }
      measureSource = null;
    }
    function startMeasure(mode2 = measureMode.value) {
      if (!map) return;
      stopMeasure();
      measureMode.value = mode2;
      measureActive.value = true;
      measureSource = new ol.VectorSource();
      measureLayer = new ol.VectorLayer({
        source: measureSource,
        style: new ol.Style({
          stroke: new ol.Stroke({
            color: "var(--grafana-warning)",
            width: 2,
            lineDash: [6, 4]
          }),
          fill: new ol.Fill({ color: "rgba(245, 166, 35, 0.15)" }),
          image: new ol.CircleStyle({
            radius: 4,
            fill: new ol.Fill({ color: "var(--grafana-warning)" })
          })
        })
      });
      map.addLayer(measureLayer);
      drawInteraction = new ol.Draw({
        source: measureSource,
        type: mode2 === "area" ? "Polygon" : "LineString"
      });
      drawInteraction.on("drawend", (evt) => {
        const geom = evt.feature.getGeometry();
        if (mode2 === "area" && geom instanceof ol.Polygon) {
          measureText.value = formatArea(geom);
        } else if (geom instanceof ol.LineString) {
          measureText.value = formatLength(geom);
        }
      });
      map.addInteraction(drawInteraction);
    }
    function toggleMeasure(mode2 = "length") {
      if (measureActive.value && measureMode.value === mode2) stopMeasure();
      else startMeasure(mode2);
    }
    function buildMap() {
      if (!host.value) return;
      try {
        const c = opts.value.controls ?? {};
        const controls = ol.defaultControls({
          zoom: c.showZoom !== false,
          attribution: false,
          // add Attribution manually collapsed
          rotate: false
        });
        if (c.showAttribution !== false) {
          controls.push(new ol.Attribution({ collapsible: true, collapsed: true }));
        }
        if (c.showScale) controls.push(new ol.ScaleLine());
        baseLayer = null;
        const src = createBaseSource(basemapType.value);
        const mapLayers = [];
        if (src) {
          baseLayer = new ol.TileLayer({ source: src });
          mapLayers.push(baseLayer);
        }
        map = new ol.Map({
          target: host.value,
          layers: mapLayers,
          view: new ol.View({
            center: ol.fromLonLat([
              Number(opts.value.view?.lon ?? opts.value.view?.center?.[0] ?? 0),
              Number(opts.value.view?.lat ?? opts.value.view?.center?.[1] ?? 0)
            ]),
            zoom: Number(opts.value.view?.zoom ?? 1)
          }),
          controls
        });
        map.on("pointermove", (evt) => {
          const layerTip = layerTooltip.value.toLowerCase();
          if (tooltipMode.value === "none" || layerTip === "none" || layerTip === "false" || measureActive.value) {
            hoverLabel.value = null;
            return;
          }
          const feature = map.forEachFeatureAtPixel(
            evt.pixel,
            (f, ly) => ly?.get?.("tooltip") === false ? void 0 : f
          );
          hoverLabel.value = formatGeomapFeatureHover(feature);
        });
        syncMultiLayerFeatures();
        wireSharedView();
        wireDashboardVariableSync();
        applyControls();
        fallback.value = false;
        requestAnimationFrame(() => {
          map?.updateSize();
          applyView();
        });
        setTimeout(() => {
          map?.updateSize();
          applyView();
        }, 50);
        tilesReady.value = false;
        if (baseLayer) {
          const src2 = baseLayer.getSource?.();
          if (src2 && typeof src2.on === "function") {
            let pending2 = 0;
            const mark = () => {
              if (pending2 <= 0) tilesReady.value = true;
            };
            src2.on("tileloadstart", () => {
              pending2 += 1;
              tilesReady.value = false;
            });
            src2.on("tileloadend", () => {
              pending2 = Math.max(0, pending2 - 1);
              mark();
            });
            src2.on("tileloaderror", () => {
              pending2 = Math.max(0, pending2 - 1);
              mark();
            });
            setTimeout(() => {
              if (pending2 === 0) tilesReady.value = true;
            }, 1500);
            setTimeout(() => {
              tilesReady.value = true;
            }, 2500);
          } else {
            tilesReady.value = true;
          }
        } else {
          tilesReady.value = true;
        }
      } catch {
        fallback.value = true;
        map = null;
        tilesReady.value = true;
      }
    }
    function resize() {
      map?.updateSize();
    }
    function destroyMap() {
      stopMeasure();
      clearDataLayers();
      clearDayNightLayers();
      if (map) {
        map.setTarget(void 0);
        map = null;
      }
      baseLayer = null;
    }
    watch(
      () => [opts.value.view?.dashboardVariable, opts.value.view?.dashboardVariableName],
      () => {
        if (!map) return;
        wireDashboardVariableSync();
      }
    );
    onMounted(() => {
      void (async () => {
        try {
          await ensureOl();
          buildMap();
          resize();
        } catch (error) {
          fallback.value = true;
          if (typeof console !== "undefined") console.error("[geomap] OpenLayers load failed", error);
        }
      })();
    });
    onBeforeUnmount(() => {
      if (geoVarTimer) clearTimeout(geoVarTimer);
      unsubViewVar?.();
      unsubViewVar = null;
      if (unsubShared) {
        unsubShared();
        unsubShared = null;
      }
      destroyMap();
    });
    watch(
      () => [props.width, props.height],
      () => resize()
    );
    watch(
      () => props.options,
      () => {
        void (async () => {
          await ensureOl();
          if (!map) {
            buildMap();
            return;
          }
          applyBasemap();
          applyControls();
          syncMultiLayerFeatures();
          wireSharedView();
          applyView();
        })();
      },
      { deep: true }
    );
    watch(
      () => props.data,
      () => {
        if (!ol || !map) return;
        syncMultiLayerFeatures();
      },
      { deep: true }
    );
    watch(
      () => [
        dayNightActive.value,
        dayNightShow.value,
        dayNightTimeMs.value,
        nightColor.value,
        configSun.value
      ],
      () => {
        if (!ol || !map) return;
        syncDayNightLayer();
      }
    );
    function getMap() {
      return map;
    }
    function getDataLayers() {
      return dataVectorLayers.slice();
    }
    function getDayNightLayer() {
      return dayNightNightLayer;
    }
    function getDayNightSunLayer() {
      return dayNightSunLayer;
    }
    __expose({ getMap, getDataLayers, getDayNightLayer, getDayNightSunLayer });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["geomap", { "geomap--crop": configCrop.value, "geomap--sun": configSun.value }]),
        "data-testid": "panel-geomap",
        "data-zoom": String(resolvedMapView.value.zoom),
        "data-lat": String(resolvedMapView.value.lat),
        "data-lon": String(resolvedMapView.value.lon),
        "data-view-shared": String(Boolean(opts.value.view?.shared)),
        "data-view-dashboard-variable": viewDashboardVariable.value || viewDashboardVariableName.value,
        "data-view-dashboard-variable-name": viewDashboardVariableName.value || resolveDashboardVariableName(),
        "data-view-dashboard-variable-enabled": String(viewDashboardVariableEnabled.value),
        "data-view-extent": viewExtentAttr.value,
        "data-view-variable-written": viewVariableWritten.value,
        "data-mouse-wheel-zoom": String(opts.value.controls?.mouseWheelZoom !== false),
        "data-mouse-wheel-active": String(mouseWheelActive.value),
        "data-show-scale": String(Boolean(opts.value.controls?.showScale)),
        "data-show-debug": String(Boolean(opts.value.controls?.showDebug)),
        "data-show-zoom": String(opts.value.controls?.showZoom !== false),
        "data-show-measure": String(Boolean(opts.value.controls?.showMeasure)),
        "data-show-attribution": String(opts.value.controls?.showAttribution !== false),
        "data-measure-mode": measureMode.value,
        "data-measure-active": String(measureActive.value),
        "data-marker-radius": String(markerRadius.value),
        "data-marker-color": String(markerColor.value),
        "data-show-labels": String(showLabels.value),
        "data-opacity": String(layerOpacity.value),
        "data-basemap": basemapType.value,
        "data-tiles-ready": tilesReady.value ? "1" : "0",
        "data-tooltip-mode": tooltipMode.value,
        "data-layer-count": String(layers.value.length),
        "data-data-layer-type": dataLayerType.value,
        "data-data-layer-count": String(dataLayerList.value.length),
        "data-geojson-layers": String(geoJsonLayerCount.value),
        "data-heatmap-layers": String(heatmapLayerCount.value),
        "data-location-modes": locationModes.value,
        "data-layer-names": layers.value.map((l) => l.name || l.type).join(","),
        "data-point-count": String(geoPoints.value.length),
        "data-demo": String(usingDemoData.value),
        "data-config-show-legend": String(legendEnabled.value),
        "data-config-crop": String(configCrop.value),
        "data-config-shadow": String(configShadow.value),
        "data-config-sun": String(configSun.value),
        "data-config-show": dayNightShow.value,
        "data-day-night-time": String(dayNightTimeMs.value),
        "data-day-night-active": String(dayNightActive.value),
        "data-day-night-features": String(dayNightFeatureCount.value),
        "data-day-night-fingerprint": dayNightGeomFingerprint.value,
        "data-day-night-sun-lon": dayNightSunLon.value == null ? "" : String(dayNightSunLon.value),
        "data-day-night-sun-lat": dayNightSunLat.value == null ? "" : String(dayNightSunLat.value),
        "data-config-arrow": String(configArrow.value),
        "data-config-access-token": accessToken.value ? "set" : "",
        "data-access-token-applied": accessToken.value && tileUrlResolved.value.includes(encodeURIComponent(accessToken.value)) ? "1" : accessToken.value && tileUrlResolved.value.includes(accessToken.value) ? "1" : "",
        "data-tile-url-has-token": tileUrlResolved.value && (tileUrlResolved.value.includes("access_token") || !!accessToken.value && tileUrlResolved.value.includes(encodeURIComponent(accessToken.value))) ? "1" : "",
        "data-config-night-color": nightColor.value,
        "data-config-id-field": idField.value,
        "data-config-data-style": dataStyle.value,
        "data-config-edge-style": edgeStyle.value,
        "data-config-kind": layerKind.value,
        "data-config-rotation": String(resolvedRotation.value),
        "data-config-symbol": resolvedSymbol.value,
        "data-config-rules": String(rulesCount.value),
        "data-geojson-matched-rules": String(geojsonMatchedRules.value),
        "data-geojson-joined-rows": String(geojsonJoinedRows.value),
        "data-geojson-src-url": geojsonSrcUrl.value,
        "data-geojson-load-error": geojsonLoadError.value,
        "data-geojson-remote-features": String(geojsonFeatureCountRemote.value),
        "data-config-server": configServer.value,
        "data-config-blur": String(configBlur.value),
        "data-config-min-zoom": configMinZoom.value,
        "data-config-max-zoom": configMaxZoom.value,
        "data-config-style": configStyle.value,
        "data-config-theme": configTheme.value,
        "data-config-url": configUrl.value ? "set" : "",
        "data-config-src": configSrc.value,
        "data-config-border": markerBorder.value,
        "data-config-weight": String(configWeight.value),
        "data-config-color": markerColor.value,
        "data-config-attribution": configAttribution.value,
        "data-type": panelLayerType.value,
        "data-filter-data": filterDataKey.value,
        "data-layer-tooltip": layerTooltip.value,
        "data-view-id": String(resolvedMapView.value.id),
        "data-view-no-repeat": String(viewNoRepeat.value),
        "data-wrap-x": String(basemapWrapX.value),
        "data-basemap-tile-url": basemapTileUrl.value
      }, [
        withDirectives(createElementVNode(
          "div",
          {
            ref_key: "host",
            ref: host,
            class: "geomap__map",
            role: "img",
            "aria-label": "地理地图"
          },
          null,
          512
          /* NEED_PATCH */
        ), [
          [vShow, !fallback.value]
        ]),
        createCommentVNode(" Chrome badge mirrors nightColor/show for dual-run; real terminator is OL layer. "),
        dayNightActive.value && !fallback.value ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: "geomap__sun",
          "data-testid": "geomap-sun",
          "data-ol-day-night": "true",
          "data-show": dayNightShow.value,
          "data-time-ms": String(dayNightTimeMs.value),
          "data-fingerprint": dayNightGeomFingerprint.value,
          "data-features": String(dayNightFeatureCount.value),
          title: `dayNight ${dayNightShow.value} @ ${dayNightTimeMs.value}`,
          style: normalizeStyle({
            background: nightColor.value,
            opacity: dayNightShow.value === "from" ? 0.55 : 0.85
          })
        }, null, 12, _hoisted_2$G)) : createCommentVNode("v-if", true),
        legendEnabled.value && dataLayerList.value.length ? (openBlock(), createElementBlock("ul", _hoisted_3$y, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(dataLayerList.value, (l, i) => {
              return openBlock(), createElementBlock("li", { key: i }, [
                createElementVNode(
                  "i",
                  {
                    style: normalizeStyle({
                      background: String(l.config?.color || LAYER_PALETTE[i % LAYER_PALETTE.length])
                    })
                  },
                  null,
                  4
                  /* STYLE */
                ),
                createTextVNode(
                  " " + toDisplayString(l.name || l.type || `图层 ${i + 1}`),
                  1
                  /* TEXT */
                )
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : createCommentVNode("v-if", true),
        fallback.value ? (openBlock(), createElementBlock("div", _hoisted_4$p, [
          (openBlock(), createElementBlock("svg", _hoisted_5$k, [
            _cache[2] || (_cache[2] = createElementVNode(
              "defs",
              null,
              [
                createElementVNode("linearGradient", {
                  id: "ocean",
                  x1: "0",
                  y1: "0",
                  x2: "0",
                  y2: "1"
                }, [
                  createElementVNode("stop", {
                    offset: "0%",
                    "stop-color": "var(--grafana-bg-canvas)"
                  }),
                  createElementVNode("stop", {
                    offset: "100%",
                    "stop-color": "var(--grafana-bg-secondary)"
                  })
                ])
              ],
              -1
              /* CACHED */
            )),
            _cache[3] || (_cache[3] = createElementVNode(
              "rect",
              {
                x: "0",
                y: "0",
                width: "100",
                height: "90",
                fill: "url(#ocean)"
              },
              null,
              -1
              /* CACHED */
            )),
            createCommentVNode(" simple lat/lon grid "),
            createElementVNode("g", _hoisted_6$h, [
              (openBlock(), createElementBlock(
                Fragment,
                null,
                renderList(5, (g) => {
                  return createElementVNode("line", {
                    key: `h${g}`,
                    x1: "0",
                    y1: g * 15,
                    x2: "100",
                    y2: g * 15
                  }, null, 8, _hoisted_7$g);
                }),
                64
                /* STABLE_FRAGMENT */
              )),
              (openBlock(), createElementBlock(
                Fragment,
                null,
                renderList(6, (g) => {
                  return createElementVNode("line", {
                    key: `v${g}`,
                    x1: g * 14.28,
                    y1: "0",
                    x2: g * 14.28,
                    y2: "90"
                  }, null, 8, _hoisted_8$b);
                }),
                64
                /* STABLE_FRAGMENT */
              ))
            ]),
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(geoPoints.value, (p, i) => {
                return openBlock(), createElementBlock("g", { key: i }, [
                  createElementVNode("circle", {
                    cx: (p.lon + 180) / 360 * 100,
                    cy: (90 - p.lat) / 180 * 90,
                    r: Math.max(1.2, markerRadius.value / 2),
                    fill: markerColor.value,
                    stroke: "var(--grafana-bg-primary)",
                    "stroke-width": "0.3",
                    opacity: "0.85"
                  }, null, 8, _hoisted_9$a),
                  showLabels.value && p.label ? (openBlock(), createElementBlock("text", {
                    key: 0,
                    x: (p.lon + 180) / 360 * 100,
                    y: (90 - p.lat) / 180 * 90 - (markerRadius.value / 2 + 1.5),
                    "text-anchor": "middle",
                    "font-size": "2.8",
                    fill: "var(--grafana-text)"
                  }, toDisplayString(p.label), 9, _hoisted_10$8)) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])),
          _cache[4] || (_cache[4] = createElementVNode(
            "div",
            { class: "geomap__fallback-hint" },
            "地图引擎不可用 · 使用 SVG 回退",
            -1
            /* CACHED */
          ))
        ])) : createCommentVNode("v-if", true),
        hoverLabel.value && tooltipMode.value !== "none" ? (openBlock(), createElementBlock(
          "div",
          _hoisted_11$8,
          toDisplayString(hoverLabel.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        opts.value.controls?.showDebug ? (openBlock(), createElementBlock(
          "div",
          _hoisted_12$7,
          " z=" + toDisplayString(opts.value.view?.zoom ?? 2) + " · " + toDisplayString(basemapType.value) + " · " + toDisplayString(geoPoints.value.length) + " pts · 层 " + toDisplayString(dataLayerList.value.length),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        showMeasure.value ? (openBlock(), createElementBlock("div", _hoisted_13$7, [
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "geomap-measure-toggle",
              onClick: _cache[0] || (_cache[0] = ($event) => toggleMeasure("length"))
            },
            toDisplayString(measureActive.value && measureMode.value === "length" ? "结束测距" : "测距"),
            1
            /* TEXT */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "geomap-measure-area",
              onClick: _cache[1] || (_cache[1] = ($event) => toggleMeasure("area"))
            },
            toDisplayString(measureActive.value && measureMode.value === "area" ? "结束测面" : "测面积"),
            1
            /* TEXT */
          ),
          measureText.value ? (openBlock(), createElementBlock(
            "span",
            _hoisted_14$5,
            toDisplayString(measureText.value),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true)
        ])) : createCommentVNode("v-if", true),
        usingDemoData.value ? (openBlock(), createElementBlock("div", _hoisted_15$5, " 演示数据 ")) : createCommentVNode("v-if", true),
        createCommentVNode(" Grafana has no footer meta strip; keep data attrs on root for tests ")
      ], 10, _hoisted_1$P);
    };
  }
});
const GeomapRenderer = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["__scopeId", "data-v-f4589a2a"]]);
const _sfc_main$S = /* @__PURE__ */ defineComponent({
  __name: "Panel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean },
    editable: { type: Boolean }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(GeomapRenderer, {
        data: __props.data,
        options: __props.options,
        "field-config": __props.fieldConfig,
        "replace-variables": __props.replaceVariables,
        "time-range": __props.timeRange,
        width: __props.width,
        height: __props.height
      }, null, 8, ["data", "options", "field-config", "replace-variables", "time-range", "width", "height"]);
    };
  }
});
const plugin$4 = new VuePanelPlugin(
  {
    id: "geomap",
    name: "地理地图",
    description: "OpenLayers 地理可视化",
    state: "stable",
    skipDataQuery: false
  },
  _sfc_main$S
).setNoPadding().setPanelOptions((builder) => {
  const catMap = ["地图视图"];
  const catCtrl = ["地图控件"];
  const catTip = ["提示"];
  const catLayer = ["图层"];
  const catStyle = ["图层 / 样式"];
  builder.addCustom(
    {
      id: "view",
      path: "view",
      name: "初始视图",
      category: catMap,
      description: "面板首次加载时显示的位置",
      editor: "custom",
      // UI is the expanded view.id/lat/lon/zoom editors; hide composite shell
      showIf: () => false
    },
    {
      id: "zero",
      lat: 0,
      lon: 0,
      zoom: 1,
      allLayers: true,
      noRepeat: false
    }
  ).addSelect(
    {
      id: "view.id",
      path: "view.id",
      name: "视图中心",
      category: catMap,
      description: "面板首次加载时的地图中心",
      settings: {
        options: [
          { label: "零点 (0,0)", value: "zero" },
          { label: "坐标", value: "coords" },
          { label: "适应数据", value: "fit" }
        ]
      }
    },
    "zero"
  ).addNumber(
    {
      id: "view.lat",
      path: "view.lat",
      name: "纬度",
      category: catMap,
      settings: { min: -90, max: 90, step: 1e-6 },
      showIf: (c) => (c.view?.id ?? "zero") === "coords"
    },
    0
  ).addNumber(
    {
      id: "view.lon",
      path: "view.lon",
      name: "经度",
      category: catMap,
      settings: { min: -180, max: 180, step: 1e-6 },
      showIf: (c) => (c.view?.id ?? "zero") === "coords"
    },
    0
  ).addNumber(
    {
      id: "view.zoom",
      path: "view.zoom",
      name: "缩放",
      category: catMap,
      settings: { min: 1, max: 18, step: 0.01 }
    },
    1
  ).addSelect(
    {
      id: "basemap.type",
      path: "basemap.type",
      name: "底图类型",
      category: ["底图图层"],
      settings: {
        options: [
          { label: "OpenStreetMap", value: "osm" },
          { label: "XYZ 瓦片", value: "xyz" },
          { label: "Carto", value: "carto" },
          { label: "无底图", value: "none" }
        ]
      }
    },
    "carto"
  ).addBoolean(
    {
      id: "view.shared",
      path: "view.shared",
      name: "共享视图",
      category: catMap
    },
    false
  ).addBoolean(
    {
      id: "view.noRepeat",
      path: "view.noRepeat",
      name: "不重复地图",
      category: catMap
    },
    false
  ).addBoolean(
    {
      id: "view.dashboardVariable",
      path: "view.dashboardVariable",
      name: "同步到仪表盘变量",
      category: catMap
    },
    false
  ).addBoolean(
    {
      id: "controls.showZoom",
      path: "controls.showZoom",
      name: "显示缩放",
      category: catCtrl
    },
    true
  ).addBoolean(
    {
      id: "controls.mouseWheelZoom",
      path: "controls.mouseWheelZoom",
      name: "鼠标滚轮缩放",
      category: catCtrl
    },
    true
  ).addBoolean(
    {
      id: "controls.showAttribution",
      path: "controls.showAttribution",
      name: "显示归属",
      category: catCtrl
    },
    true
  ).addBoolean(
    {
      id: "controls.showScale",
      path: "controls.showScale",
      name: "显示比例尺",
      category: catCtrl
    },
    false
  ).addBoolean(
    {
      id: "controls.showMeasure",
      path: "controls.showMeasure",
      name: "显示测量",
      category: catCtrl
    },
    false
  ).addBoolean(
    {
      id: "controls.showDebug",
      path: "controls.showDebug",
      name: "显示调试",
      category: catCtrl
    },
    false
  ).addBoolean(
    {
      id: "config.showLabels",
      path: "config.showLabels",
      name: "显示标签",
      category: catStyle
    },
    false
  ).addBoolean(
    {
      id: "config.showLegend",
      path: "config.showLegend",
      name: "显示图例",
      category: catStyle
    },
    false
  ).addBoolean(
    {
      id: "config.crop",
      path: "config.crop",
      name: "裁剪",
      category: catStyle
    },
    true
  ).addBoolean(
    {
      id: "config.shadow",
      path: "config.shadow",
      name: "阴影",
      category: catStyle
    },
    false
  ).addBoolean(
    {
      id: "config.sun",
      path: "config.sun",
      name: "太阳",
      category: catStyle
    },
    false
  ).addText(
    {
      id: "view.dashboardVariableName",
      path: "view.dashboardVariableName",
      name: "变量名",
      category: catMap,
      showIf: (c) => !!c.view?.dashboardVariable
    },
    void 0
  ).addRadio(
    {
      id: "tooltip.mode",
      path: "tooltip.mode",
      name: "提示",
      category: catTip,
      settings: {
        options: [
          { label: "无", value: "none", description: "点击显示" },
          { label: "详情", value: "details", description: "悬停显示" }
        ]
      }
    },
    "details"
  ).addSelect(
    {
      id: "type",
      path: "type",
      name: "图层类型",
      category: catLayer,
      settings: {
        options: [
          { label: "标记", value: "markers" },
          { label: "热力", value: "heatmap" },
          { label: "GeoJSON", value: "geojson" },
          { label: "路径", value: "route" },
          { label: "照片", value: "photos" },
          { label: "网络", value: "network" },
          { label: "昼夜", value: "dayNight" },
          { label: "底图", value: "basemap" }
        ]
      }
    },
    "markers"
  ).addNumber(
    {
      id: "opacity",
      path: "opacity",
      name: "不透明度",
      category: catLayer,
      settings: { min: 0, max: 1, step: 0.05 }
    },
    1
  ).addText(
    {
      id: "filterData",
      path: "filterData",
      name: "数据过滤",
      category: catLayer
    },
    void 0
  ).addCustom({
    id: "layer-tooltip",
    path: "layer-tooltip",
    name: "图层提示",
    category: catLayer,
    editor: "text"
  }).addText(
    {
      id: "config.accessToken",
      path: "config.accessToken",
      name: "访问令牌",
      category: catStyle
    },
    void 0
  ).addSelect(
    {
      id: "config.arrow",
      path: "config.arrow",
      name: "箭头",
      category: catStyle,
      settings: {
        options: [
          { label: "无", value: "none" },
          { label: "正向", value: "forward" },
          { label: "反向", value: "reverse" },
          { label: "双向", value: "both" }
        ]
      }
    },
    void 0
  ).addText(
    {
      id: "config.attribution",
      path: "config.attribution",
      name: "版权归属",
      category: catStyle
    },
    void 0
  ).addNumber(
    {
      id: "config.blur",
      path: "config.blur",
      name: "模糊",
      category: catStyle
    },
    void 0
  ).addText(
    {
      id: "config.border",
      path: "config.border",
      name: "边框色",
      category: catStyle
    },
    void 0
  ).addColor(
    {
      id: "config.color",
      path: "config.color",
      name: "颜色",
      category: catStyle
    },
    void 0
  ).addText(
    {
      id: "config.dataStyle",
      path: "config.dataStyle",
      name: "数据样式",
      category: catStyle
    },
    void 0
  ).addText(
    {
      id: "config.edgeStyle",
      path: "config.edgeStyle",
      name: "边样式",
      category: catStyle
    },
    void 0
  ).addText(
    {
      id: "config.idField",
      path: "config.idField",
      name: "ID 字段",
      category: catStyle
    },
    void 0
  ).addSelect(
    {
      id: "config.kind",
      path: "config.kind",
      name: "形状",
      category: catStyle,
      settings: {
        options: [
          { label: "方", value: "square" },
          { label: "圆", value: "circle" },
          { label: "三角", value: "triangle" },
          { label: "星", value: "star" },
          { label: "十字", value: "cross" },
          { label: "X", value: "x" },
          { label: "菱形", value: "diamond" },
          { label: "标记", value: "marker" }
        ]
      }
    },
    void 0
  ).addNumber(
    {
      id: "config.maxZoom",
      path: "config.maxZoom",
      name: "最大缩放",
      category: catStyle
    },
    void 0
  ).addNumber(
    {
      id: "config.minZoom",
      path: "config.minZoom",
      name: "最小缩放",
      category: catStyle
    },
    void 0
  ).addColor(
    {
      id: "config.nightColor",
      path: "config.nightColor",
      name: "夜间颜色",
      category: catStyle
    },
    void 0
  ).addNumber(
    {
      id: "config.radius",
      path: "config.radius",
      name: "半径",
      category: catStyle
    },
    void 0
  ).addText(
    {
      id: "config.rules",
      path: "config.rules",
      name: "规则",
      category: catStyle
    },
    void 0
  ).addSelect(
    {
      id: "config.server",
      path: "config.server",
      name: "底图服务",
      category: catStyle,
      settings: {
        options: [
          { label: "街道", value: "streets" },
          { label: "卫星影像", value: "world-imagery" },
          { label: "卫星", value: "satellite" },
          { label: "地形", value: "topo" },
          { label: "美国地形", value: "usa-topo" },
          { label: "海洋", value: "ocean" },
          { label: "物理", value: "world-physical" },
          { label: "自定义", value: "custom" }
        ]
      }
    },
    void 0
  ).addSelect(
    {
      id: "config.show",
      path: "config.show",
      name: "显示",
      category: catStyle,
      settings: {
        // Grafana dayNightLayer ShowTime: from | to (timeRange endpoint for terminator)
        options: [
          { label: "起始时间", value: "from" },
          { label: "结束时间", value: "to" }
        ]
      }
    },
    "to"
  ).addText(
    {
      id: "config.src",
      path: "config.src",
      name: "图片源",
      category: catStyle
    },
    void 0
  ).addText(
    {
      id: "config.style",
      path: "config.style",
      name: "样式",
      category: catStyle
    },
    void 0
  ).addSelect(
    {
      id: "config.theme",
      path: "config.theme",
      name: "主题",
      category: catStyle,
      settings: {
        options: [
          { label: "自动", value: "auto" },
          { label: "亮", value: "light" },
          { label: "暗", value: "dark" }
        ]
      }
    },
    void 0
  ).addText(
    {
      id: "config.url",
      path: "config.url",
      name: "URL",
      category: catStyle
    },
    void 0
  ).addNumber(
    {
      id: "config.weight",
      path: "config.weight",
      name: "权重",
      category: catStyle
    },
    void 0
  ).addSelect(
    {
      id: "config.symbol",
      path: "config.symbol",
      name: "符号",
      category: catStyle,
      settings: {
        options: [
          { label: "圆", value: "circle" },
          { label: "方", value: "square" },
          { label: "三角", value: "triangle" },
          { label: "星", value: "star" },
          { label: "十字", value: "cross" },
          { label: "X", value: "x" },
          { label: "菱形", value: "diamond" },
          { label: "标记", value: "marker" }
        ]
      }
    },
    void 0
  ).addNumber(
    {
      id: "config.rotation",
      path: "config.rotation",
      name: "旋转(度)",
      category: catStyle,
      settings: { min: -360, max: 360, step: 1 }
    },
    0
  ).addText(
    {
      id: "config.text",
      path: "config.text",
      name: "文本",
      category: catStyle
    },
    void 0
  ).addNumber(
    {
      id: "config.fontSize",
      path: "config.fontSize",
      name: "字号",
      category: catStyle,
      settings: { min: 8, max: 48, step: 1 }
    },
    11
  );
}).setRuntimeConsumedPaths([
  "view.id",
  "view.lat",
  "view.lon",
  "view.zoom",
  "view.shared",
  "view.noRepeat",
  "view.dashboardVariable",
  "view.dashboardVariableName",
  "basemap.type",
  "config.accessToken",
  "config.arrow",
  "config.attribution",
  "config.blur",
  "config.border",
  "config.color",
  "config.crop",
  "config.dataStyle",
  "config.edgeStyle",
  "config.idField",
  "config.kind",
  "config.symbol",
  "config.rotation",
  "config.text",
  "config.fontSize",
  "config.maxZoom",
  "config.minZoom",
  "config.nightColor",
  "config.radius",
  "config.rules",
  "config.server",
  "config.shadow",
  "config.show",
  "config.showLabels",
  "config.showLegend",
  "config.src",
  "config.style",
  "config.sun",
  "config.theme",
  "config.url",
  "config.weight",
  "controls.mouseWheelZoom",
  "controls.showAttribution",
  "controls.showDebug",
  "controls.showMeasure",
  "controls.showScale",
  "controls.showZoom",
  "filterData",
  "layer-tooltip",
  "opacity",
  "tooltip.mode",
  "type",
  "view",
  "view.dashboardVariable",
  "view.dashboardVariableName",
  "view.noRepeat",
  "view.shared"
]).setOptionsEditor(GeomapLayersEditor).register();
const module$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  plugin: plugin$4
}, Symbol.toStringTag, { value: "Module" }));
function deepClone$2(v) {
  try {
    return structuredClone(v);
  } catch {
    return JSON.parse(JSON.stringify(v));
  }
}
function nextRefId(targets) {
  const used = new Set(targets.map((t2) => t2.refId).filter(Boolean));
  for (let i = 0; i < 26; i++) {
    const id = String.fromCharCode(65 + i);
    if (!used.has(id)) return id;
  }
  return `Q${targets.length + 1}`;
}
function getDefaultTarget(targets = []) {
  return {
    group: { filter: "" },
    host: { filter: "" },
    application: { filter: "" },
    trigger: { filter: "" },
    tags: { filter: "" },
    proxy: { filter: "" },
    refId: nextRefId(targets)
  };
}
function isEmptyTarget(target) {
  return !target || !(target.group && target.host && target.application && target.trigger);
}
function isInvalidTarget(target, targetKey) {
  return Boolean(target && target.refId === "A" && targetKey === "0");
}
function isDefaultTarget(target) {
  return !target?.group?.filter && !target?.host?.filter && !target?.application?.filter && !target?.trigger?.filter && !target?.queryType;
}
function isEmptyTargets(targets) {
  if (!targets) return true;
  if (Array.isArray(targets)) {
    return targets.length === 0 || targets.length === 1 && (!targets[0] || Object.keys(targets[0]).length === 0);
  }
  return false;
}
function datasourceKey(ds2) {
  if (ds2 == null || ds2 === "") return "default";
  if (typeof ds2 === "string") {
    if (ds2 === "[object Object]") return "default";
    return ds2;
  }
  if (typeof ds2 === "object") {
    const o = ds2;
    if (typeof o.uid === "string" && o.uid && o.uid !== "[object Object]") return o.uid;
    if (typeof o.type === "string" && o.type) return o.type;
  }
  return "default";
}
function isEmptyPanel(panel2) {
  return !panel2.datasource && !panel2.datasources && !panel2.triggers && isEmptyTargets(panel2.targets);
}
function isDefaultPanel(panel2) {
  return Array.isArray(panel2.targets) && panel2.targets.length === 1 && isDefaultTarget(panel2.targets[0]);
}
function migrateShowEvents(panel2) {
  if (panel2.showEvents?.value === 1) return "problems";
  if (panel2.showEvents?.value === 0 || Array.isArray(panel2.showEvents?.value) && panel2.showEvents.value.length > 1) {
    return "history";
  }
  return "problems";
}
function migrateTargetOptions(panel2) {
  let acknowledged = 2;
  if (panel2.showTriggers === "acknowledged") acknowledged = 1;
  else if (panel2.showTriggers === "unacknowledged") acknowledged = 0;
  let limit = 1001;
  if (panel2.limit && panel2.limit !== 100) limit = panel2.limit;
  return {
    hostsInMaintenance: panel2.hostsInMaintenance,
    sortProblems: panel2.sortTriggersBy?.value === "priority" ? "priority" : "default",
    minSeverity: 0,
    acknowledged,
    limit
  };
}
function migrateProblemsPanelOptions(input = {}) {
  const src = { ...input };
  if (src.schema != null && src.schemaVersion == null) src.schemaVersion = src.schema;
  if (src.showTimeline != null && src.problemTimeline == null)
    src.problemTimeline = src.showTimeline;
  const next = {
    ...DEFAULT_PROBLEMS_OPTIONS,
    ...src,
    triggerSeverity: Array.isArray(src.triggerSeverity) && src.triggerSeverity.length ? src.triggerSeverity : DEFAULT_PROBLEMS_OPTIONS.triggerSeverity.map((s) => ({ ...s })),
    resizedColumns: Array.isArray(src.resizedColumns) ? src.resizedColumns : []
  };
  next.schemaVersion = 8;
  if (next.layout !== "list") next.layout = "table";
  if (!["default", "lastchange", "priority"].includes(next.sortProblems))
    next.sortProblems = "lastchange";
  if (!Number.isFinite(Number(next.pageSize)) || Number(next.pageSize) <= 0) next.pageSize = 10;
  return next;
}
function migrateProblemsPanel(input) {
  const panel2 = deepClone$2(input);
  if (isDefaultPanel(panel2)) {
    panel2.options = migrateProblemsPanelOptions(
      panel2.options || {}
    );
    return panel2;
  }
  if (isEmptyPanel(panel2)) {
    delete panel2.targets;
    panel2.options = migrateProblemsPanelOptions(
      panel2.options || {}
    );
    return panel2;
  }
  const schemaVersion = Number(panel2.schemaVersion || 1);
  if (schemaVersion < 2) {
    const hasModernArrayTargets = Array.isArray(panel2.targets);
    if (!hasModernArrayTargets) {
      const triggers = panel2.triggers;
      const dsList = Array.isArray(panel2.datasources) ? panel2.datasources : panel2.datasource != null ? [panel2.datasource] : [];
      panel2.datasources = dsList;
      panel2.targets = {};
      const key = datasourceKey(dsList[0]);
      panel2.targets[key] = triggers;
      delete panel2.triggers;
      delete panel2.datasource;
    } else {
      delete panel2.triggers;
    }
  }
  if (schemaVersion < 3) {
    delete panel2.lastChangeField;
    delete panel2.infoField;
    delete panel2.scroll;
    delete panel2.hideHostsInMaintenance;
  }
  if (schemaVersion < 5) {
    if (panel2.targets && typeof panel2.targets === "object" && !Array.isArray(panel2.targets)) {
      for (const key of Object.keys(panel2.targets)) {
        const t2 = panel2.targets[key];
        panel2.targets[key] = { ...getDefaultTarget(), ...t2 };
      }
    } else if (Array.isArray(panel2.targets)) {
      panel2.targets = panel2.targets.map((t2) => ({
        ...getDefaultTarget(panel2.targets),
        ...t2
      }));
    }
  }
  if (schemaVersion < 6) {
    if (panel2.showEvents?.value === "1") {
      panel2.showEvents.value = 1;
    }
  }
  if (schemaVersion < 7) {
    const updated = [];
    if (panel2.targets && typeof panel2.targets === "object" && !Array.isArray(panel2.targets)) {
      for (const targetKey of Object.keys(panel2.targets)) {
        const target = panel2.targets[targetKey];
        if (!isEmptyTarget(target) && !isInvalidTarget(target, targetKey)) {
          const dsRef2 = target.datasource ?? (targetKey === "[object Object]" ? void 0 : targetKey);
          updated.push({
            ...target,
            datasource: dsRef2 ?? datasourceKey(targetKey)
          });
        }
      }
    } else if (Array.isArray(panel2.targets)) {
      updated.push(...panel2.targets);
    }
    for (const target of updated) {
      if (!target.refId) target.refId = nextRefId(updated);
    }
    panel2.targets = updated;
    delete panel2.datasources;
  }
  if (schemaVersion < 8) {
    const targets = Array.isArray(panel2.targets) ? panel2.targets : [];
    if (targets.length === 1) {
      if (targets[0].datasource) {
        panel2.datasource = targets[0].datasource;
        delete targets[0].datasource;
      }
    } else if (targets.length > 1) {
      panel2.datasource = "-- Mixed --";
    }
    for (const target of targets) {
      target.queryType = 5;
      target.showProblems = migrateShowEvents(panel2);
      target.options = {
        ...target.options || {},
        ...migrateTargetOptions(panel2)
      };
      if (!target.tags) target.tags = { filter: "" };
    }
    panel2.targets = targets;
    panel2.sortProblems = panel2.sortTriggersBy?.value === "priority" ? "priority" : "lastchange";
    delete panel2.showEvents;
    delete panel2.showTriggers;
    delete panel2.hostsInMaintenance;
    delete panel2.sortTriggersBy;
  }
  if (panel2.datasource === "[object Object]" || panel2.datasource && typeof panel2.datasource === "object" && typeof panel2.datasource.uid === "object") {
    const fromTarget = Array.isArray(panel2.targets) ? panel2.targets[0]?.datasource : void 0;
    const key = datasourceKey(fromTarget ?? panel2.datasource);
    panel2.datasource = {
      uid: key === "default" ? "zabbix" : key,
      type: "alexanderzobnin-zabbix-datasource"
    };
  }
  panel2.schemaVersion = CURRENT_SCHEMA_VERSION;
  const optionsInput = {
    ...panel2.options || {},
    sortProblems: panel2.sortProblems ?? panel2.options?.sortProblems
  };
  panel2.options = migrateProblemsPanelOptions(optionsInput);
  return panel2;
}
function col$1(frame, name) {
  return frame.fields.find((f) => f.name === name)?.values || [];
}
function parseJsonArray(raw) {
  if (Array.isArray(raw)) return raw;
  if (typeof raw === "string") {
    try {
      const v = JSON.parse(raw || "[]");
      return Array.isArray(v) ? v : [];
    } catch {
      return [];
    }
  }
  if (raw && typeof raw === "object") return [raw];
  return [];
}
function toMs$1(v) {
  const n = Number(v ?? 0);
  if (!Number.isFinite(n) || n <= 0) return 0;
  return n < 1e12 ? n * 1e3 : n;
}
function hostsOf(raw) {
  return parseJsonArray(raw).map((h2) => ({
    hostid: String(h2.hostid ?? h2.id ?? ""),
    name: String(h2.name ?? h2.host ?? ""),
    host: String(h2.host ?? h2.name ?? "")
  }));
}
function groupsOf(raw) {
  return parseJsonArray(raw).map(
    (g) => typeof g === "string" ? g : String(g.name ?? g.groupid ?? "")
  );
}
function acksOf(raw) {
  return parseJsonArray(raw).map((a) => ({
    acknowledgeid: String(a.acknowledgeid ?? ""),
    clock: toMs$1(a.clock),
    user: String(a.user ?? a.username ?? a.alias ?? ""),
    name: a.name != null ? String(a.name) : void 0,
    surname: a.surname != null ? String(a.surname) : void 0,
    message: String(a.message ?? ""),
    action: Number(a.action ?? 0)
  }));
}
function itemsOf(raw) {
  return parseJsonArray(raw).map((i) => ({
    itemid: String(i.itemid ?? ""),
    name: String(i.name ?? ""),
    key_: String(i.key_ ?? i.key ?? ""),
    lastvalue: i.lastvalue != null ? String(i.lastvalue) : void 0,
    value_type: i.value_type != null ? String(i.value_type) : void 0
  }));
}
function metaOf(frame) {
  const meta2 = frame.meta || {};
  return {
    uid: String(meta2.datasourceUid || meta2.uid || ""),
    name: String(meta2.datasourceName || meta2.name || "")
  };
}
function framesToProblemViewModels(frames = [], options) {
  const notices = [];
  const problems = [];
  for (const frame of frames) {
    const meta2 = metaOf(frame);
    const n = frame.length || col$1(frame, "eventid").length || 0;
    for (let i = 0; i < n; i++) {
      const get = (name) => col$1(frame, name)[i];
      const eventid = String(get("eventid") ?? "");
      if (!eventid) {
        notices.push(zabbixT("zabbix.panel.filteredMissingEventId"));
        continue;
      }
      const ackRaw = get("acknowledged");
      const acknowledged = ackRaw === true || ackRaw === 1 || String(ackRaw) === "1";
      problems.push({
        eventid,
        objectid: String(get("objectid") ?? ""),
        name: String(get("name") ?? ""),
        severity: Number(get("severity") ?? 0),
        clock: toMs$1(get("clock")),
        acknowledged,
        status: String(get("status") ?? "problem"),
        hosts: hostsOf(get("hosts")),
        groups: groupsOf(get("groups")),
        tags: parseJsonArray(get("tags")).map(
          (t2) => typeof t2 === "string" ? { tag: t2, value: "" } : { tag: String(t2.tag ?? ""), value: String(t2.value ?? "") }
        ),
        acknowledges: acksOf(get("acknowledges")),
        alerts: parseJsonArray(get("alerts")),
        events: parseJsonArray(get("events")),
        items: itemsOf(get("items")),
        description: String(get("description") ?? ""),
        opdata: String(get("opdata") ?? ""),
        expression: String(get("expression") ?? ""),
        datasourceUid: meta2.uid,
        datasourceName: meta2.name,
        manual_close: (() => {
          const v = get("manual_close");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        suppressed: (() => {
          const v = get("suppressed");
          return v === true || v === 1 || String(v) === "1";
        })(),
        suppression: parseJsonArray(get("suppression_data") ?? get("suppression")),
        historicalItemValue: (() => {
          const v = get("historicalItemValue");
          return v == null || v === "" ? null : String(v);
        })(),
        hostInMaintenance: (() => {
          const v = get("hostInMaintenance") ?? get("maintenance_status");
          return v === true || v === 1 || String(v) === "1";
        })(),
        url: (() => {
          const v = get("url");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        type: (() => {
          const v = get("type");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        correlation_mode: (() => {
          const v = get("correlation_mode");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        correlation_tag: (() => {
          const v = get("correlation_tag");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        state: (() => {
          const v = get("state");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        error: (() => {
          const v = get("error");
          return v == null || v === "" ? void 0 : String(v);
        })(),
        proxy: (() => {
          const v = get("proxy") ?? get("proxy_host") ?? get("proxy_name");
          return v == null || v === "" ? void 0 : String(v);
        })()
      });
    }
  }
  const sort = options?.sortProblems || "lastchange";
  if (sort === "priority") {
    problems.sort(
      (a, b) => b.severity - a.severity || b.clock - a.clock || a.eventid.localeCompare(b.eventid)
    );
  } else if (sort === "lastchange") {
    problems.sort((a, b) => b.clock - a.clock || a.eventid.localeCompare(b.eventid));
  } else {
    problems.sort((a, b) => a.eventid.localeCompare(b.eventid));
  }
  return { problems, notices: [...new Set(notices)] };
}
function problemsFromPanelData(data, options) {
  return framesToProblemViewModels(data?.series || [], options);
}
const TAG_COLORS = [
  "#E24D42",
  "#1F78C1",
  "#BA43A9",
  "#705DA0",
  "#466803",
  "#508642",
  "#447EBC",
  "#C15C17",
  "#890F02",
  "#757575",
  "#0A437C",
  "#6D1F62",
  "#584477",
  "#629E51",
  "#2F4F4F",
  "#BF1B00",
  "#806EB7",
  "#8a2eb8",
  "#699e00",
  "#000000",
  "#3F6833",
  "#2F575E",
  "#99440A",
  "#E0752D",
  "#0E4AB4",
  "#58140C",
  "#052B51",
  "#511749",
  "#3F2B5B"
];
const TAG_BORDER_COLORS = [
  "#FF7368",
  "#459EE7",
  "#E069CF",
  "#9683C6",
  "#6C8E29",
  "#76AC68",
  "#6AA4E2",
  "#E7823D",
  "#AF3528",
  "#9B9B9B",
  "#3069A2",
  "#934588",
  "#7E6A9D",
  "#88C477",
  "#557575",
  "#E54126",
  "#A694DD",
  "#B054DE",
  "#8FC426",
  "#262626",
  "#658E59",
  "#557D84",
  "#BF6A30",
  "#FF9B53",
  "#3470DA",
  "#7E3A32",
  "#2B5177",
  "#773D6F",
  "#655181"
];
function djb2(str) {
  let hash2 = 5381;
  for (let i = 0; i < str.length; i++) {
    hash2 = (hash2 << 5) + hash2 + str.charCodeAt(i);
  }
  return hash2;
}
function getTagColorsFromName(name) {
  const hash2 = djb2((name || "").toLowerCase());
  const color = TAG_COLORS[Math.abs(hash2 % TAG_COLORS.length)];
  const borderColor = TAG_BORDER_COLORS[Math.abs(hash2 % TAG_BORDER_COLORS.length)];
  return { color, borderColor };
}
const _hoisted_1$O = ["href", "title"];
const _hoisted_2$F = ["title"];
const _sfc_main$R = /* @__PURE__ */ defineComponent({
  __name: "EventTag",
  props: {
    tag: {},
    highlight: { type: Boolean }
  },
  emits: ["tagClick"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const URL_PATTERN = /^https?:\/\/.+/;
    const colors = computed(() => getTagColorsFromName(props.tag.tag));
    const isUrl = computed(() => URL_PATTERN.test(props.tag.value || ""));
    const label = computed(
      () => props.tag.value ? `${props.tag.tag}: ${props.tag.value}` : `${props.tag.tag}`
    );
    function onClick(event) {
      emit("tagClick", props.tag, event.ctrlKey, event.shiftKey);
    }
    return (_ctx, _cache) => {
      return isUrl.value ? (openBlock(), createElementBlock("a", {
        key: 0,
        class: normalizeClass(["label label-tag zbx-tag", { highlighted: __props.highlight }]),
        style: normalizeStyle({ background: colors.value.color, borderColor: colors.value.borderColor }),
        href: __props.tag.value,
        target: "_blank",
        rel: "noreferrer",
        title: __props.tag.value
      }, [
        _cache[0] || (_cache[0] = createElementVNode(
          "svg",
          {
            class: "link-icon",
            viewBox: "0 0 24 24",
            width: "11",
            height: "11"
          },
          [
            createElementVNode("path", {
              fill: "currentColor",
              d: "M10.59 13.41a1 1 0 0 1 0-1.41l3-3a1 1 0 0 1 1.41 1.41l-3 3a1 1 0 0 1-1.41 0Zm-1.18-2.82L7 13a2 2 0 1 0 2.83 2.83l2-2a1 1 0 0 0-1.42-1.42l-2 2a.99.99 0 0 1-1.41-1.41l2.41-2.41a1 1 0 1 0-1.41-1.41ZM17 7a2 2 0 0 0-2.83 0l-2 2a1 1 0 0 0 1.42 1.42l2-2A.99.99 0 0 1 17 9.83Z"
            })
          ],
          -1
          /* CACHED */
        )),
        createTextVNode(
          " " + toDisplayString(__props.tag.tag),
          1
          /* TEXT */
        )
      ], 14, _hoisted_1$O)) : (openBlock(), createElementBlock("span", {
        key: 1,
        class: normalizeClass(["label label-tag zbx-tag", { highlighted: __props.highlight }]),
        style: normalizeStyle({ background: colors.value.color, borderColor: colors.value.borderColor }),
        role: "button",
        title: unref(zabbixT)("zabbix.query.tagFilterHint"),
        onClick
      }, toDisplayString(label.value), 15, _hoisted_2$F));
    };
  }
});
const EventTag = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["__scopeId", "data-v-353c2ae6"]]);
const _hoisted_1$N = ["aria-label"];
const _hoisted_2$E = ["fill"];
const _hoisted_3$x = ["fill"];
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
  __name: "GFHeartIcon",
  props: {
    status: {},
    color: {}
  },
  setup(__props) {
    const props = __props;
    const isProblem = computed(
      () => props.status === "critical" || props.status === "problem" || props.status === "warning"
    );
    const fill = computed(() => props.color || (isProblem.value ? "#e02f44" : "#299c46"));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("svg", {
        class: normalizeClass(["gf-heart", isProblem.value ? "is-problem" : "is-ok"]),
        viewBox: "0 0 24 24",
        width: "16",
        height: "16",
        role: "img",
        "aria-label": isProblem.value ? unref(zabbixT)("zabbix.panel.problemState") : unref(zabbixT)("zabbix.panel.okState")
      }, [
        createCommentVNode(" broken heart for problem "),
        isProblem.value ? (openBlock(), createElementBlock("path", {
          key: 0,
          fill: fill.value,
          d: "M12 21.35 4.55 13.9a5.4 5.4 0 0 1 0-7.65 5.4 5.4 0 0 1 7.45-.2l-1.6 4.2 3 1.5-2 4.2 1.15 1.15 3-3.3a5.4 5.4 0 0 0-.55-8.75 5.4 5.4 0 0 0-3.4-1.2c-1.5 0-2.9.55-4 1.5-1.1-.95-2.5-1.5-4-1.5A5.5 5.5 0 0 0 2 8.5c0 1.9.9 3.6 2.3 4.7L12 21.35Z"
        }, null, 8, _hoisted_2$E)) : (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createCommentVNode(" whole heart for ok "),
            createElementVNode("path", {
              fill: fill.value,
              d: "M12 21.35 4.55 13.9a5.4 5.4 0 0 1 0-7.65 5.4 5.4 0 0 1 7.45-.2 5.4 5.4 0 0 1 7.45.2 5.4 5.4 0 0 1 0 7.65L12 21.35Z"
            }, null, 8, _hoisted_3$x)
          ],
          2112
          /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
        ))
      ], 10, _hoisted_1$N);
    };
  }
});
const GFHeartIcon = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["__scopeId", "data-v-bc00eb9f"]]);
const _hoisted_1$M = ["width", "height", "aria-label", "data-icon-name"];
const _hoisted_2$D = ["d"];
const _sfc_main$P = /* @__PURE__ */ defineComponent({
  __name: "FAIcon",
  props: {
    icon: {},
    size: {}
  },
  setup(__props) {
    const props = __props;
    const px = computed(
      () => typeof props.size === "number" ? `${props.size}px` : props.size || "14px"
    );
    const PATHS = {
      "clock-o": "M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8 8 8 0 0 1-8 8Zm.5-13H11v6l5.2 3.1.8-1.3-4.5-2.7Z",
      "cloud": "M19.35 10.04A7.49 7.49 0 0 0 12 4a7.5 7.5 0 0 0-7.19 5.32A5.5 5.5 0 0 0 6.5 20H19a4.5 4.5 0 0 0 .35-9Z",
      "comments": "M20 2H4a2 2 0 0 0-2 2v14l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2Z",
      "comments-o": "M20 2H4a2 2 0 0 0-2 2v14l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2Zm0 12H5.17L4 15.17V4h16Z",
      "database": "M12 2C7.58 2 4 3.34 4 5v14c0 1.66 3.58 3 8 3s8-1.34 8-3V5c0-1.66-3.58-3-8-3Zm0 2c3.87 0 6 1.07 6 1.5S15.87 7 12 7 6 5.93 6 5.5 8.13 4 12 4Zm-6 4.71C7.16 9.32 9.42 10 12 10s4.84-.68 6-1.29v3.08C16.84 12.4 14.58 13 12 13s-4.84-.6-6-1.21Zm0 5C7.16 14.32 9.42 15 12 15s4.84-.68 6-1.29v3.08C16.84 17.4 14.58 18 12 18s-4.84-.6-6-1.21Z",
      "external-link": "M14 3v2h3.59L9 13.59 10.41 15 19 6.41V10h2V3ZM5 5h5V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2v5H5Z",
      "folder": "M10 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8Z",
      "info-circle": "M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Zm1 15h-2v-6h2Zm0-8h-2V7h2Z",
      "plus": "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6Z",
      "question-circle": "M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Zm.5 15h-2v-2h2Zm2.07-6.75c-.42.53-1.13 1.02-1.57 1.5-.24.27-.5.68-.5 1.25h-2c0-.98.42-1.63.87-2.15.42-.5 1.1-.94 1.5-1.4.32-.36.5-.67.5-1.15a1.5 1.5 0 0 0-1.5-1.5 1.5 1.5 0 0 0-1.5 1.5h-2A3.5 3.5 0 0 1 12 5a3.5 3.5 0 0 1 3.5 3.5c0 .98-.5 1.62-.93 2.75Z",
      "reply-all": "M11 8V4l-8 8 8 8v-4.1c4-.4 6.7 1.1 8.6 4.1-.7-4-3.1-8-8.6-8.9Zm-4.5.5L10 5v3.5l1.5.19c3.14.4 5.2 1.9 6.4 4.3-1.9-.9-4.2-1.3-6.9-1v3l-4-4Z",
      "server": "M4 2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm0 10h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2Zm2 2v2h2v-2Zm0-10v2h2V4Z",
      "terminal": "M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Zm-8.41 11.41-1.42-1.41L12.59 12 10.17 9.59l1.42-1.41L15.41 12ZM17 15h-4v-1.5h4Z",
      "thermometer-three-quarters": "M15 13.35V4a3 3 0 0 0-6 0v9.35a4 4 0 1 0 6 0ZM12 3a1 1 0 0 1 1 1v2h-2V4a1 1 0 0 1 1-1Zm0 16a2 2 0 0 1-1-3.73V8h2v7.27A2 2 0 0 1 12 19Z",
      "wrench": "M22.7 19 13.6 9.9c.9-2.3.5-5-1.4-6.9a7 7 0 0 0-8.2-1.3 1 1 0 0 0-.3 1.6l3.7 3.7-2.1 2.1-3.7-3.7a1 1 0 0 0-1.6.3 7 7 0 0 0 1.3 8.2c1.9 1.9 4.6 2.3 6.9 1.4L17.9 22a1 1 0 0 0 1.4 0l3.4-3.4a1 1 0 0 0 0-1.4Z"
    };
    const path = computed(() => PATHS[props.icon] || "");
    return (_ctx, _cache) => {
      return path.value ? (openBlock(), createElementBlock("svg", {
        key: 0,
        class: "fa-icon",
        viewBox: "0 0 24 24",
        width: px.value,
        height: px.value,
        role: "img",
        "aria-label": __props.icon,
        "data-icon-name": __props.icon
      }, [
        createElementVNode("path", {
          d: path.value,
          fill: "currentColor"
        }, null, 8, _hoisted_2$D)
      ], 8, _hoisted_1$M)) : createCommentVNode("v-if", true);
    };
  }
});
const FAIcon = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["__scopeId", "data-v-46a32fff"]]);
const _hoisted_1$L = ["data-status", "data-ack"];
const _sfc_main$O = /* @__PURE__ */ defineComponent({
  __name: "ProblemStatus",
  props: {
    status: {},
    acknowledged: { type: Boolean },
    markAck: { type: Boolean },
    ackColor: {},
    okColor: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("span", {
        class: "status",
        "data-status": __props.status,
        "data-ack": String(__props.acknowledged),
        "data-testid": "problem-status",
        style: normalizeStyle(
          __props.acknowledged && __props.markAck ? { color: __props.ackColor } : __props.status === "resolved" ? { color: __props.okColor } : void 0
        )
      }, toDisplayString(__props.status === "resolved" ? unref(zabbixT)("zabbix.panel.resolvedState") : __props.acknowledged ? unref(zabbixT)("zabbix.panel.acknowledgedState") : unref(zabbixT)("zabbix.panel.problemState")), 13, _hoisted_1$L);
    };
  }
});
const ProblemStatus = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["__scopeId", "data-v-d74c7f7c"]]);
function useColumnResize(getColumns, onChange) {
  const dragging = ref(null);
  let startX = 0;
  let startW = 0;
  let colId = "";
  function onMove(e) {
    if (!dragging.value) return;
    const dx = e.clientX - startX;
    const width2 = Math.max(48, startW + dx);
    const prev = getColumns().filter((c) => c.id !== colId);
    onChange([...prev, { id: colId, value: width2 }]);
  }
  function onUp() {
    dragging.value = null;
    window.removeEventListener("mousemove", onMove);
    window.removeEventListener("mouseup", onUp);
  }
  function startResize(id, currentWidth, e) {
    e.preventDefault();
    e.stopPropagation();
    colId = id;
    startX = e.clientX;
    startW = currentWidth;
    dragging.value = id;
    window.addEventListener("mousemove", onMove);
    window.addEventListener("mouseup", onUp);
  }
  onBeforeUnmount(() => {
    window.removeEventListener("mousemove", onMove);
    window.removeEventListener("mouseup", onUp);
  });
  return { dragging, startResize };
}
function widthFor(id, resized, fallback = 120) {
  const hit = (resized || []).find((c) => c.id === id);
  return hit?.value ?? fallback;
}
function buildColumns(o) {
  const cols = [
    {
      key: "time",
      title: zabbixT("zabbix.panel.timeCol"),
      sortable: true,
      width: 140
    }
  ];
  if (o.severityField)
    cols.push({
      key: "severity",
      title: zabbixT("zabbix.common.severity"),
      sortable: true,
      width: 90
    });
  if (o.statusField)
    cols.push({
      key: "status",
      title: zabbixT("zabbix.panel.statusCol"),
      sortable: true,
      width: 80
    });
  if (o.statusIcon)
    cols.push({
      key: "statusIcon",
      title: zabbixT("zabbix.panel.statusIconCol"),
      width: 96
    });
  if (o.hostField)
    cols.push({
      key: "host",
      title: zabbixT("zabbix.common.host"),
      sortable: true,
      width: 120
    });
  if (o.hostTechNameField)
    cols.push({
      key: "hostTechName",
      title: zabbixT("zabbix.panel.techNameCol"),
      width: 120
    });
  if (o.hostGroups)
    cols.push({
      key: "hostGroups",
      title: zabbixT("zabbix.common.group"),
      width: 120
    });
  if (o.hostProxy)
    cols.push({
      key: "proxy",
      title: zabbixT("zabbix.common.proxy"),
      width: 100
    });
  cols.push({
    key: "problem",
    title: zabbixT("zabbix.common.problem"),
    sortable: true,
    width: 220
  });
  if (o.ageField)
    cols.push({
      key: "age",
      title: zabbixT("zabbix.panel.ageCol"),
      sortable: true,
      width: 72
    });
  if (o.opdataField)
    cols.push({
      key: "opdata",
      title: zabbixT("zabbix.panel.opdataLabel"),
      width: 120
    });
  if (o.ackField) cols.push({ key: "ack", title: zabbixT("zabbix.panel.ackCol"), width: 80 });
  if (o.showTags)
    cols.push({
      key: "tags",
      title: zabbixT("zabbix.common.tags"),
      width: 140
    });
  if (o.showDatasourceName)
    cols.push({
      key: "datasource",
      title: zabbixT("zabbix.panel.datasourceCol"),
      width: 100
    });
  const custom = String(o.customTagColumns || "").split(",").map((s) => s.trim()).filter(Boolean);
  for (const tag of custom) cols.push({ key: `tag:${tag}`, title: tag, width: 100 });
  if (o.allowAcknowledge || o.allowUnacknowledge || o.allowClose || o.allowChangeSeverity || o.allowSuppress || o.allowUnsuppress || o.allowExecuteScripts) {
    cols.push({
      key: "actions",
      title: zabbixT("zabbix.panel.actionsCol"),
      width: 180
    });
  }
  return cols;
}
const _hoisted_1$K = {
  class: "tbl",
  "data-testid": "problems-table"
};
const _hoisted_2$C = ["data-col", "onClick"];
const _hoisted_3$w = ["onMousedown"];
const _hoisted_4$o = {
  key: 0,
  class: "no-data",
  "data-testid": "problems-no-data"
};
const _hoisted_5$j = ["colspan"];
const _hoisted_6$g = ["data-testid", "onClick"];
const _hoisted_7$f = {
  key: 0,
  class: "sub"
};
const _hoisted_8$a = ["title"];
const _hoisted_9$9 = ["onClick"];
const _hoisted_10$7 = ["onClick"];
const _hoisted_11$7 = ["onClick"];
const _hoisted_12$6 = ["onClick"];
const _hoisted_13$6 = ["onClick"];
const _hoisted_14$4 = ["onClick"];
const _hoisted_15$4 = ["onClick"];
const _hoisted_16$3 = {
  class: "pager",
  "data-testid": "problems-pager"
};
const _hoisted_17$3 = ["disabled"];
const _hoisted_18$3 = ["disabled"];
const _hoisted_19$3 = ["value"];
const _hoisted_20$3 = ["value"];
const _sfc_main$N = /* @__PURE__ */ defineComponent({
  __name: "ProblemsTable",
  props: {
    items: {},
    options: {}
  },
  emits: ["select", "acknowledge", "unacknowledge", "close", "severity", "suppress", "unsuppress", "script", "update:options", "tag-click"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const sortKey = ref("time");
    const sortDir = ref("desc");
    const page = ref(0);
    const severityMap = computed(() => {
      const m = /* @__PURE__ */ new Map();
      for (const s of props.options.triggerSeverity || []) m.set(s.priority, s);
      return m;
    });
    const columns = computed(() => buildColumns(props.options));
    const { startResize } = useColumnResize(
      () => props.options.resizedColumns || [],
      (next) => emit("update:options", { ...props.options, resizedColumns: next })
    );
    function colWidth(c) {
      return widthFor(String(c.key), props.options.resizedColumns, c.width || 120);
    }
    function sevStyle(n) {
      const background = severityMap.value.get(n)?.color || "#999999";
      return {
        background,
        color: getContrastText(background)
      };
    }
    function hostLabel(p) {
      return p.hosts.map((h2) => h2.name || h2.host).join(", ");
    }
    function hostTech(p) {
      return p.hosts.map((h2) => h2.host || h2.name).join(", ");
    }
    function age(p) {
      if (!p.clock) return "";
      const sec = Math.max(0, Math.floor((Date.now() - p.clock) / 1e3));
      if (sec < 60) return `${sec}s`;
      if (sec < 3600) return `${Math.floor(sec / 60)}m`;
      if (sec < 86400) return `${Math.floor(sec / 3600)}h`;
      return `${Math.floor(sec / 86400)}d`;
    }
    function formatTime2(p) {
      if (!p.clock) return "";
      if (props.options.customLastChangeFormat && props.options.lastChangeFormat) {
        const d = new Date(p.clock);
        const pad = (n) => String(n).padStart(2, "0");
        return props.options.lastChangeFormat.replaceAll("YYYY", String(d.getFullYear())).replaceAll("MM", pad(d.getMonth() + 1)).replaceAll("DD", pad(d.getDate())).replaceAll("HH", pad(d.getHours())).replaceAll("mm", pad(d.getMinutes())).replaceAll("ss", pad(d.getSeconds()));
      }
      return new Date(p.clock).toLocaleString();
    }
    function tagValue(p, tag) {
      return p.tags.find((t2) => t2.tag === tag)?.value || "";
    }
    function isNew(p) {
      if (!props.options.highlightNewEvents) return false;
      const thr = parseDurationMs2(props.options.highlightNewerThan || "1h");
      return Date.now() - p.clock <= thr;
    }
    function parseDurationMs2(s) {
      const m = String(s).trim().match(/^(\d+(?:\.\d+)?)(ms|[smhd])?$/i);
      if (!m) return 36e5;
      const n = Number(m[1]);
      const u = (m[2] || "s").toLowerCase();
      if (u === "ms") return n;
      if (u === "s") return n * 1e3;
      if (u === "m") return n * 6e4;
      if (u === "h") return n * 36e5;
      if (u === "d") return n * 864e5;
      return n * 1e3;
    }
    const sorted = computed(() => {
      const list = [...props.items].filter((p) => severityMap.value.get(p.severity)?.show !== false);
      const dir = sortDir.value === "asc" ? 1 : -1;
      const key = sortKey.value;
      list.sort((a, b) => {
        let cmp = 0;
        if (key === "severity") cmp = a.severity - b.severity;
        else if (key === "status") cmp = String(a.status).localeCompare(String(b.status));
        else if (key === "host") cmp = hostLabel(a).localeCompare(hostLabel(b));
        else if (key === "problem") cmp = a.name.localeCompare(b.name);
        else if (key === "age") cmp = a.clock - b.clock;
        else cmp = a.clock - b.clock;
        return cmp * dir || a.eventid.localeCompare(b.eventid);
      });
      return list;
    });
    const pageSize = computed(() => {
      const allowed = [5, 10, 20, 25, 50, 100];
      const n = Number(props.options.pageSize || 10);
      return allowed.includes(n) ? n : 10;
    });
    const pageCount = computed(() => Math.max(1, Math.ceil(sorted.value.length / pageSize.value)));
    const pageItems = computed(() => {
      const start = page.value * pageSize.value;
      return sorted.value.slice(start, start + pageSize.value);
    });
    function toggleSort(key, sortable) {
      if (!sortable) return;
      if (sortKey.value === key) sortDir.value = sortDir.value === "asc" ? "desc" : "asc";
      else {
        sortKey.value = key;
        sortDir.value = key === "time" || key === "severity" ? "desc" : "asc";
      }
    }
    const anyAction = computed(
      () => props.options.allowAcknowledge || props.options.allowUnacknowledge || props.options.allowClose || props.options.allowChangeSeverity || props.options.allowSuppress || props.options.allowUnsuppress || props.options.allowExecuteScripts
    );
    const fontSize = computed(() => props.options.fontSize || "100%");
    __expose({ buildColumns, columns, pageItems, sorted, toggleSort });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: "wrap",
          style: normalizeStyle({ fontSize: fontSize.value }),
          "data-testid": "problems-table-wrap"
        },
        [
          createElementVNode("table", _hoisted_1$K, [
            createElementVNode("thead", null, [
              createElementVNode("tr", null, [
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(columns.value, (c) => {
                    return openBlock(), createElementBlock("th", {
                      key: c.key,
                      "data-col": c.key,
                      style: normalizeStyle({ width: `${colWidth(c)}px` }),
                      class: normalizeClass({ sortable: c.sortable }),
                      onClick: ($event) => toggleSort(String(c.key), c.sortable)
                    }, [
                      createElementVNode(
                        "span",
                        null,
                        toDisplayString(c.title),
                        1
                        /* TEXT */
                      ),
                      createElementVNode("span", {
                        class: "resizer",
                        "data-testid": "col-resizer",
                        onMousedown: withModifiers(($event) => unref(startResize)(String(c.key), colWidth(c), $event), ["stop"])
                      }, null, 40, _hoisted_3$w)
                    ], 14, _hoisted_2$C);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ])
            ]),
            createElementVNode("tbody", null, [
              !sorted.value.length ? (openBlock(), createElementBlock("tr", _hoisted_4$o, [
                createElementVNode("td", {
                  colspan: columns.value.length
                }, toDisplayString(unref(zabbixT)("zabbix.panel.noProblems")), 9, _hoisted_5$j)
              ])) : createCommentVNode("v-if", true),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(pageItems.value, (p) => {
                  return openBlock(), createElementBlock("tr", {
                    key: p.eventid,
                    "data-testid": `problem-row-${p.eventid}`,
                    class: normalizeClass({
                      "ack": p.acknowledged && __props.options.markAckEvents,
                      "is-new": isNew(p),
                      "hl-bg": __props.options.highlightBackground
                    }),
                    style: normalizeStyle(
                      __props.options.highlightBackground ? { background: `${sevStyle(p.severity).background}22` } : void 0
                    ),
                    onClick: ($event) => emit("select", p)
                  }, [
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(columns.value, (c) => {
                        return openBlock(), createElementBlock(
                          "td",
                          {
                            key: c.key,
                            style: normalizeStyle({ width: `${colWidth(c)}px` })
                          },
                          [
                            c.key === "time" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 0 },
                              [
                                createTextVNode(
                                  toDisplayString(formatTime2(p)),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "severity" ? (openBlock(), createElementBlock(
                              "span",
                              {
                                key: 1,
                                class: "sev",
                                style: normalizeStyle(sevStyle(p.severity))
                              },
                              toDisplayString(unref(zabbixSeverityLabel)(
                                p.severity,
                                severityMap.value.get(p.severity)?.severity || String(p.severity)
                              )),
                              5
                              /* TEXT, STYLE */
                            )) : c.key === "status" ? (openBlock(), createBlock(ProblemStatus, {
                              key: 2,
                              status: p.status,
                              acknowledged: p.acknowledged,
                              "mark-ack": __props.options.markAckEvents,
                              "ack-color": __props.options.ackEventColor,
                              "ok-color": __props.options.okEventColor
                            }, null, 8, ["status", "acknowledged", "mark-ack", "ack-color", "ok-color"])) : c.key === "statusIcon" ? (openBlock(), createBlock(GFHeartIcon, {
                              key: 3,
                              status: p.status === "resolved" ? "ok" : "problem",
                              "ok-color": __props.options.okEventColor,
                              "problem-color": severityMap.value.get(p.severity)?.color
                            }, null, 8, ["status", "ok-color", "problem-color"])) : c.key === "host" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 4 },
                              [
                                p.hostInMaintenance ? (openBlock(), createBlock(FAIcon, {
                                  key: 0,
                                  icon: "wrench",
                                  title: unref(zabbixT)("zabbix.panel.hostMaintenance"),
                                  class: "maint-icon"
                                }, null, 8, ["title"])) : createCommentVNode("v-if", true),
                                createTextVNode(
                                  toDisplayString(hostLabel(p)),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "hostTechName" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 5 },
                              [
                                createTextVNode(
                                  toDisplayString(hostTech(p)),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "hostGroups" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 6 },
                              [
                                createTextVNode(
                                  toDisplayString(p.groups.join(", ")),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "proxy" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 7 },
                              [
                                createTextVNode(
                                  toDisplayString(p.proxy || "—"),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "problem" ? (openBlock(), createElementBlock(
                              "div",
                              {
                                key: 8,
                                class: normalizeClass({ "desc-nl": __props.options.descriptionAtNewLine })
                              },
                              [
                                createElementVNode(
                                  "div",
                                  null,
                                  toDisplayString(p.name),
                                  1
                                  /* TEXT */
                                ),
                                __props.options.descriptionAtNewLine && p.description ? (openBlock(), createElementBlock(
                                  "div",
                                  _hoisted_7$f,
                                  toDisplayString(p.description),
                                  1
                                  /* TEXT */
                                )) : createCommentVNode("v-if", true)
                              ],
                              2
                              /* CLASS */
                            )) : c.key === "age" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 9 },
                              [
                                createTextVNode(
                                  toDisplayString(age(p)),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "opdata" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 10 },
                              [
                                createTextVNode(
                                  toDisplayString(p.opdata || p.historicalItemValue || "—"),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "ack" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 11 },
                              [
                                p.acknowledges.length ? (openBlock(), createElementBlock("span", {
                                  key: 0,
                                  class: "ack-count",
                                  title: p.acknowledges.map((a) => `${a.user}: ${a.message}`).join("\n"),
                                  "data-testid": "ack-count"
                                }, [
                                  createVNode(FAIcon, { icon: "comments" }),
                                  createTextVNode(
                                    toDisplayString(p.acknowledges.length),
                                    1
                                    /* TEXT */
                                  )
                                ], 8, _hoisted_8$a)) : createCommentVNode("v-if", true)
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "tags" ? (openBlock(true), createElementBlock(
                              Fragment,
                              { key: 12 },
                              renderList(p.tags, (t2) => {
                                return openBlock(), createBlock(EventTag, {
                                  key: t2.tag + t2.value,
                                  tag: t2,
                                  onTagClick: (tag, ctrl) => emit("tag-click", {
                                    tag: tag.tag,
                                    value: tag.value || "",
                                    ctrl,
                                    problem: p
                                  })
                                }, null, 8, ["tag", "onTagClick"]);
                              }),
                              128
                              /* KEYED_FRAGMENT */
                            )) : c.key === "datasource" ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 13 },
                              [
                                createTextVNode(
                                  toDisplayString(p.datasourceName),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : String(c.key).startsWith("tag:") ? (openBlock(), createElementBlock(
                              Fragment,
                              { key: 14 },
                              [
                                createTextVNode(
                                  toDisplayString(tagValue(p, String(c.key).slice(4))),
                                  1
                                  /* TEXT */
                                )
                              ],
                              64
                              /* STABLE_FRAGMENT */
                            )) : c.key === "actions" && anyAction.value ? (openBlock(), createElementBlock("div", {
                              key: 15,
                              class: "actions",
                              onClick: _cache[0] || (_cache[0] = withModifiers(() => {
                              }, ["stop"]))
                            }, [
                              __props.options.allowAcknowledge ? (openBlock(), createElementBlock("button", {
                                key: 0,
                                type: "button",
                                "data-testid": "action-ack",
                                onClick: ($event) => emit("acknowledge", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.acknowledge")), 9, _hoisted_9$9)) : createCommentVNode("v-if", true),
                              __props.options.allowUnacknowledge ? (openBlock(), createElementBlock("button", {
                                key: 1,
                                type: "button",
                                "data-testid": "action-unack",
                                onClick: ($event) => emit("unacknowledge", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.unacknowledge")), 9, _hoisted_10$7)) : createCommentVNode("v-if", true),
                              __props.options.allowClose ? (openBlock(), createElementBlock("button", {
                                key: 2,
                                type: "button",
                                "data-testid": "action-close",
                                onClick: ($event) => emit("close", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.close")), 9, _hoisted_11$7)) : createCommentVNode("v-if", true),
                              __props.options.allowChangeSeverity ? (openBlock(), createElementBlock("button", {
                                key: 3,
                                type: "button",
                                "data-testid": "action-sev",
                                onClick: ($event) => emit("severity", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.changeSeverity")), 9, _hoisted_12$6)) : createCommentVNode("v-if", true),
                              __props.options.allowSuppress ? (openBlock(), createElementBlock("button", {
                                key: 4,
                                type: "button",
                                "data-testid": "action-suppress",
                                onClick: ($event) => emit("suppress", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.suppress")), 9, _hoisted_13$6)) : createCommentVNode("v-if", true),
                              __props.options.allowUnsuppress ? (openBlock(), createElementBlock("button", {
                                key: 5,
                                type: "button",
                                "data-testid": "action-unsuppress",
                                onClick: ($event) => emit("unsuppress", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.unsuppress")), 9, _hoisted_14$4)) : createCommentVNode("v-if", true),
                              __props.options.allowExecuteScripts ? (openBlock(), createElementBlock("button", {
                                key: 6,
                                type: "button",
                                "data-testid": "action-script",
                                onClick: ($event) => emit("script", p)
                              }, toDisplayString(unref(zabbixT)("zabbix.panel.script")), 9, _hoisted_15$4)) : createCommentVNode("v-if", true)
                            ])) : createCommentVNode("v-if", true)
                          ],
                          4
                          /* STYLE */
                        );
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ], 14, _hoisted_6$g);
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ])
          ]),
          createElementVNode("div", _hoisted_16$3, [
            createElementVNode("button", {
              type: "button",
              disabled: page.value <= 0,
              onClick: _cache[1] || (_cache[1] = ($event) => page.value = Math.max(0, page.value - 1))
            }, toDisplayString(unref(zabbixT)("zabbix.panel.previous")), 9, _hoisted_17$3),
            createElementVNode(
              "span",
              null,
              toDisplayString(page.value + 1) + " / " + toDisplayString(pageCount.value),
              1
              /* TEXT */
            ),
            createElementVNode("button", {
              type: "button",
              disabled: page.value + 1 >= pageCount.value,
              onClick: _cache[2] || (_cache[2] = ($event) => page.value = Math.min(pageCount.value - 1, page.value + 1))
            }, toDisplayString(unref(zabbixT)("zabbix.panel.next")), 9, _hoisted_18$3),
            createElementVNode("select", {
              value: pageSize.value,
              "data-testid": "problems-page-size",
              onChange: _cache[3] || (_cache[3] = ($event) => {
                emit("update:options", {
                  ...__props.options,
                  pageSize: Number($event.target.value)
                });
                page.value = 0;
              })
            }, [
              (openBlock(), createElementBlock(
                Fragment,
                null,
                renderList([5, 10, 20, 25, 50, 100], (n) => {
                  return createElementVNode("option", {
                    key: n,
                    value: n
                  }, toDisplayString(n), 9, _hoisted_20$3);
                }),
                64
                /* STABLE_FRAGMENT */
              ))
            ], 40, _hoisted_19$3)
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
});
const ProblemsTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["__scopeId", "data-v-8ad09a51"]]);
const _sfc_main$M = /* @__PURE__ */ defineComponent({
  __name: "SeverityBadge",
  props: {
    severity: {},
    label: {},
    color: {}
  },
  setup(__props) {
    const props = __props;
    const style = computed(() => {
      const background = props.color || "var(--grafana-text-secondary)";
      const color = typeof background === "string" && background.startsWith("#") ? getContrastText(background) : "var(--grafana-text-max-contrast)";
      return { background, color };
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "span",
        {
          class: "sev",
          "data-testid": "severity-badge",
          style: normalizeStyle(style.value)
        },
        toDisplayString(__props.label ?? __props.severity),
        5
        /* TEXT, STYLE */
      );
    };
  }
});
const SeverityBadge = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["__scopeId", "data-v-bc1ee631"]]);
const _hoisted_1$J = ["data-testid", "onClick"];
const _hoisted_2$B = { class: "name" };
const _hoisted_3$v = { class: "meta" };
const _hoisted_4$n = ["title"];
const _hoisted_5$i = ["href"];
const _hoisted_6$f = {
  key: 2,
  class: "acks"
};
const _sfc_main$L = /* @__PURE__ */ defineComponent({
  __name: "ProblemsList",
  props: {
    items: {},
    options: {}
  },
  emits: ["select"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function colorFor(sev) {
      return props.options.triggerSeverity?.find((s) => s.priority === sev)?.color || "#999";
    }
    function labelFor(sev) {
      return zabbixSeverityLabel(
        sev,
        props.options.triggerSeverity?.find((s) => s.priority === sev)?.severity || String(sev)
      );
    }
    function isNew(p) {
      if (!props.options.highlightNewEvents) return false;
      const thr = parseDurationMs2(props.options.highlightNewerThan || "1h");
      return Date.now() - p.clock <= thr;
    }
    function parseDurationMs2(s) {
      const m = String(s).trim().match(/^(\d+(?:\.\d+)?)(ms|[smhd])?$/i);
      if (!m) return 36e5;
      const n = Number(m[1]);
      const u = (m[2] || "s").toLowerCase();
      if (u === "ms") return n;
      if (u === "s") return n * 1e3;
      if (u === "m") return n * 6e4;
      if (u === "h") return n * 36e5;
      if (u === "d") return n * 864e5;
      return n * 1e3;
    }
    function cardStyle(p) {
      if (!props.options.highlightBackground) return void 0;
      return {
        background: `${colorFor(p.severity)}22`,
        borderColor: colorFor(p.severity)
      };
    }
    const fontSize = computed(() => props.options.fontSize || "100%");
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "ul",
        {
          class: "list",
          "data-testid": "problems-list",
          style: normalizeStyle({ fontSize: fontSize.value })
        },
        [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(__props.items, (p) => {
              return openBlock(), createElementBlock("li", {
                key: p.eventid,
                class: normalizeClass(["card", { "blink": isNew(p), "hl-bg": __props.options.highlightBackground }]),
                style: normalizeStyle(cardStyle(p)),
                "data-testid": `problem-row-${p.eventid}`,
                onClick: ($event) => emit("select", p)
              }, [
                createElementVNode(
                  "span",
                  {
                    class: "sev-bar",
                    style: normalizeStyle({ background: colorFor(p.severity) }),
                    "aria-hidden": "true"
                  },
                  null,
                  4
                  /* STYLE */
                ),
                createVNode(SeverityBadge, {
                  severity: p.severity,
                  label: labelFor(p.severity),
                  color: colorFor(p.severity)
                }, null, 8, ["severity", "label", "color"]),
                createElementVNode(
                  "span",
                  _hoisted_2$B,
                  toDisplayString(p.name),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "span",
                  _hoisted_3$v,
                  toDisplayString(p.hosts.map((h2) => h2.name || h2.host).join(", ")),
                  1
                  /* TEXT */
                ),
                p.hostInMaintenance ? (openBlock(), createElementBlock("span", {
                  key: 0,
                  class: "maint",
                  title: unref(zabbixT)("zabbix.panel.maintenance"),
                  "data-testid": "maintenance-icon"
                }, "🔧", 8, _hoisted_4$n)) : createCommentVNode("v-if", true),
                p.url ? (openBlock(), createElementBlock("a", {
                  key: 1,
                  class: "url",
                  href: p.url,
                  target: "_blank",
                  rel: "noopener noreferrer",
                  "data-testid": "problem-url",
                  onClick: _cache[0] || (_cache[0] = withModifiers(() => {
                  }, ["stop"]))
                }, toDisplayString(unref(zabbixT)("zabbix.panel.externalLink")), 9, _hoisted_5$i)) : createCommentVNode("v-if", true),
                p.acknowledges.length ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_6$f,
                  toDisplayString(unref(zabbixT)("zabbix.panel.ackCount", { count: p.acknowledges.length })),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ], 14, _hoisted_1$J);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ],
        4
        /* STYLE */
      );
    };
  }
});
const ProblemsList = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["__scopeId", "data-v-0725637a"]]);
const _hoisted_1$I = ["aria-label"];
const _hoisted_2$A = ["viewBox"];
const _hoisted_3$u = ["x", "width", "fill", "data-testid"];
const _hoisted_4$m = ["cx", "fill"];
const _hoisted_5$h = {
  key: 1,
  class: "empty",
  "data-testid": "timeline-empty"
};
const width = 480;
const height = 36;
const _sfc_main$K = /* @__PURE__ */ defineComponent({
  __name: "ProblemTimeline",
  props: {
    problem: {},
    timeRange: {},
    okColor: {},
    problemColor: {}
  },
  setup(__props, { expose: __expose }) {
    const props = __props;
    const ok2 = computed(() => props.okColor || "rgb(56,189,113)");
    const bad = computed(() => props.problemColor || "rgb(215,0,0)");
    const range = computed(() => {
      const from = props.timeRange?.from ?? props.problem.clock - 36e5;
      const to = props.timeRange?.to ?? Date.now();
      return { from, to: Math.max(to, from + 1) };
    });
    const points = computed(() => {
      const list = [...props.problem.events || []];
      if (!list.length) {
        list.push({
          clock: props.problem.clock / 1e3,
          value: 1,
          name: props.problem.name
        });
      }
      return list.map((e) => {
        const raw = Number(e.clock || 0);
        const clock2 = raw < 1e12 ? raw * 1e3 : raw;
        const value = Number(e.value ?? 1);
        return {
          clock: clock2,
          value,
          name: String(e.name || e.value_str || ""),
          isProblem: value === 1 || String(e.value) === "1"
        };
      }).filter((e) => Number.isFinite(e.clock)).sort((a, b) => a.clock - b.clock);
    });
    const segments = computed(() => {
      const { from, to } = range.value;
      const span = to - from;
      const pts = points.value;
      if (!pts.length) return [];
      const segs = [];
      for (let i = 0; i < pts.length; i++) {
        const start = Math.max(from, pts[i].clock);
        const end = i + 1 < pts.length ? Math.min(to, pts[i + 1].clock) : to;
        if (end <= start) continue;
        const x = (start - from) / span * width;
        const w = Math.max(2, (end - start) / span * width);
        const kind2 = pts[i].isProblem ? "problem" : "ok";
        const durMs = end - start;
        const dur = durMs < 6e4 ? `${Math.round(durMs / 1e3)}s` : durMs < 36e5 ? `${Math.round(durMs / 6e4)}m` : `${(durMs / 36e5).toFixed(1)}h`;
        segs.push({
          x,
          w,
          kind: kind2,
          title: `${kind2 === "problem" ? zabbixT("zabbix.panel.problemState") : zabbixT("zabbix.panel.okState")} · ${dur} · ${pts[i].name || ""}`.trim()
        });
      }
      return segs;
    });
    const dots = computed(() => {
      const { from, to } = range.value;
      const span = to - from;
      return points.value.map((p) => ({
        x: (Math.min(to, Math.max(from, p.clock)) - from) / span * width,
        fill: p.isProblem ? bad.value : ok2.value,
        title: `${new Date(p.clock).toLocaleString()} · ${p.name || (p.isProblem ? zabbixT("zabbix.panel.problemState") : zabbixT("zabbix.panel.okState"))}`
      }));
    });
    __expose({ segments, dots, points });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "tl-wrap",
        "data-testid": "problem-timeline",
        "aria-label": unref(zabbixT)("zabbix.panel.timeline")
      }, [
        segments.value.length ? (openBlock(), createElementBlock("svg", {
          key: 0,
          viewBox: `0 0 ${width} ${height}`,
          width: "100%",
          height,
          role: "img"
        }, [
          createElementVNode("rect", {
            x: "0",
            y: "10",
            width,
            height: "10",
            fill: "var(--grafana-bg-secondary)",
            rx: "2"
          }),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(segments.value, (s, i) => {
              return openBlock(), createElementBlock("rect", {
                key: `s${i}`,
                x: s.x,
                y: "10",
                width: s.w,
                height: "10",
                fill: s.kind === "problem" ? bad.value : ok2.value,
                "data-testid": `timeline-seg-${s.kind}`
              }, [
                createElementVNode(
                  "title",
                  null,
                  toDisplayString(s.title),
                  1
                  /* TEXT */
                )
              ], 8, _hoisted_3$u);
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(dots.value, (d, i) => {
              return openBlock(), createElementBlock("circle", {
                key: `d${i}`,
                cx: d.x,
                cy: "15",
                r: "3.5",
                fill: d.fill,
                stroke: "#111",
                "stroke-width": "1",
                "data-testid": "timeline-dot"
              }, [
                createElementVNode(
                  "title",
                  null,
                  toDisplayString(d.title),
                  1
                  /* TEXT */
                )
              ], 8, _hoisted_4$m);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 8, _hoisted_2$A)) : (openBlock(), createElementBlock(
          "p",
          _hoisted_5$h,
          toDisplayString(unref(zabbixT)("zabbix.panel.timelineEmpty")),
          1
          /* TEXT */
        ))
      ], 8, _hoisted_1$I);
    };
  }
});
const ProblemTimeline = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["__scopeId", "data-v-120b6a9a"]]);
const _hoisted_1$H = {
  key: 0,
  class: "acks",
  "data-testid": "problem-acks"
};
const _hoisted_2$z = {
  key: 1,
  class: "empty",
  "data-testid": "problem-acks-empty"
};
const _sfc_main$J = /* @__PURE__ */ defineComponent({
  __name: "ProblemAcknowledges",
  props: {
    items: {}
  },
  setup(__props) {
    function displayName(a) {
      const full = `${a.name || ""} ${a.surname || ""}`.trim();
      return full || a.user || "";
    }
    return (_ctx, _cache) => {
      return __props.items?.length ? (openBlock(), createElementBlock("ul", _hoisted_1$H, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.items, (a) => {
            return openBlock(), createElementBlock("li", {
              key: a.acknowledgeid || a.clock + a.user
            }, [
              createElementVNode(
                "time",
                null,
                toDisplayString(a.clock ? new Date(a.clock).toLocaleString() : ""),
                1
                /* TEXT */
              ),
              createElementVNode(
                "strong",
                null,
                toDisplayString(displayName(a)),
                1
                /* TEXT */
              ),
              createElementVNode(
                "span",
                null,
                toDisplayString(a.message),
                1
                /* TEXT */
              )
            ]);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ])) : (openBlock(), createElementBlock(
        "p",
        _hoisted_2$z,
        toDisplayString(unref(zabbixT)("zabbix.panel.noAcknowledgements")),
        1
        /* TEXT */
      ));
    };
  }
});
const ProblemAcknowledges = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["__scopeId", "data-v-6a94d86c"]]);
const _hoisted_1$G = ["data-testid"];
const _hoisted_2$y = ["href"];
const _hoisted_3$t = { key: 1 };
const _sfc_main$I = /* @__PURE__ */ defineComponent({
  __name: "ProblemStatusBar",
  props: {
    problem: {},
    compact: { type: Boolean, default: false },
    markAck: { type: Boolean },
    ackColor: {},
    okColor: {}
  },
  setup(__props) {
    const props = __props;
    const icons = computed(() => {
      const p = props.problem;
      const out = [];
      if (p.hostInMaintenance)
        out.push({
          key: "maintenance",
          icon: "exclamation-triangle",
          title: zabbixT("zabbix.panel.hostMaintenance")
        });
      if (p.url)
        out.push({
          key: "url",
          icon: "share-alt",
          title: zabbixT("zabbix.panel.triggerUrl"),
          href: p.url
        });
      if (String(p.type) === "1")
        out.push({
          key: "multi",
          icon: "copy",
          title: zabbixT("zabbix.panel.multiTrigger")
        });
      if (String(p.correlation_mode) === "1") {
        out.push({
          key: "correlation",
          icon: "link",
          title: zabbixT("zabbix.panel.correlationClosed", {
            tag: p.correlation_tag || "—"
          })
        });
      }
      if ((p.alerts || []).length)
        out.push({
          key: "alerts",
          icon: "bell",
          title: zabbixT("zabbix.panel.alertActions", { count: p.alerts.length })
        });
      if (String(p.state) === "1")
        out.push({
          key: "unknown",
          icon: "question",
          title: zabbixT("zabbix.panel.unknownState")
        });
      if (p.error)
        out.push({
          key: "error",
          icon: "times",
          title: zabbixT("zabbix.panel.triggerError", { error: p.error })
        });
      if (String(p.manual_close) === "1" || p.manual_close === true) {
        out.push({
          key: "manual",
          icon: "check",
          title: zabbixT("zabbix.panel.manualCloseAllowed")
        });
      }
      return out;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["status-bar", { compact: __props.compact }]),
          "data-testid": "problem-status-bar"
        },
        [
          !__props.compact ? (openBlock(), createBlock(ProblemStatus, {
            key: 0,
            status: __props.problem.status,
            acknowledged: __props.problem.acknowledged,
            "mark-ack": __props.markAck,
            "ack-color": __props.ackColor || "",
            "ok-color": __props.okColor || ""
          }, null, 8, ["status", "acknowledged", "mark-ack", "ack-color", "ok-color"])) : createCommentVNode("v-if", true),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(icons.value, (ic) => {
              return openBlock(), createElementBlock("span", {
                key: ic.key,
                class: "ic",
                "data-testid": `status-icon-${ic.key}`
              }, [
                createVNode(unref(_sfc_main$y$1), {
                  title: ic.title
                }, {
                  default: withCtx(() => [
                    ic.href ? (openBlock(), createElementBlock("a", {
                      key: 0,
                      href: ic.href,
                      target: "_blank",
                      rel: "noopener noreferrer",
                      onClick: _cache[0] || (_cache[0] = withModifiers(() => {
                      }, ["stop"]))
                    }, [
                      createVNode(unref(GIcon), {
                        name: ic.icon
                      }, null, 8, ["name"])
                    ], 8, _hoisted_2$y)) : (openBlock(), createElementBlock("span", _hoisted_3$t, [
                      createVNode(unref(GIcon), {
                        name: ic.icon
                      }, null, 8, ["name"])
                    ]))
                  ]),
                  _: 2
                  /* DYNAMIC */
                }, 1032, ["title"])
              ], 8, _hoisted_1$G);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ],
        2
        /* CLASS */
      );
    };
  }
});
const ProblemStatusBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["__scopeId", "data-v-ca47bb1b"]]);
const _hoisted_1$F = {
  class: "tags",
  "data-testid": "tag-list"
};
const _sfc_main$H = /* @__PURE__ */ defineComponent({
  __name: "TagList",
  props: {
    tags: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("span", _hoisted_1$F, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.tags, (t2) => {
            return openBlock(), createBlock(EventTag, {
              key: t2.tag + t2.value,
              tag: t2
            }, null, 8, ["tag"]);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const TagList = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["__scopeId", "data-v-71b80eb7"]]);
const _hoisted_1$E = ["aria-label"];
const _hoisted_2$x = { "data-testid": "problem-eventid" };
const _hoisted_3$s = {
  key: 1,
  "data-testid": "problem-hosts"
};
const _hoisted_4$l = {
  key: 2,
  "data-testid": "problem-groups"
};
const _hoisted_5$g = {
  key: 3,
  "data-testid": "problem-tags"
};
const _hoisted_6$e = ["innerHTML"];
const _hoisted_7$e = {
  key: 5,
  "data-testid": "problem-opdata"
};
const _hoisted_8$9 = { "data-testid": "problem-expression" };
const _hoisted_9$8 = {
  key: 6,
  "data-testid": "problem-hist-value"
};
const _hoisted_10$6 = { "data-testid": "problem-manual-close" };
const _hoisted_11$6 = { "data-testid": "problem-suppressed" };
const _hoisted_12$5 = {
  "data-testid": "problem-items",
  class: "block"
};
const _hoisted_13$5 = {
  key: 0,
  class: "plain"
};
const _hoisted_14$3 = { key: 0 };
const _hoisted_15$3 = {
  key: 1,
  class: "empty"
};
const _hoisted_16$2 = {
  "data-testid": "problem-alerts",
  class: "block"
};
const _hoisted_17$2 = {
  key: 0,
  class: "plain"
};
const _hoisted_18$2 = {
  key: 1,
  class: "empty"
};
const _hoisted_19$2 = {
  "data-testid": "problem-events",
  class: "block"
};
const _hoisted_20$2 = {
  key: 0,
  class: "plain"
};
const _hoisted_21$2 = {
  key: 1,
  class: "empty"
};
const _hoisted_22$2 = {
  "data-testid": "problem-suppression",
  class: "block"
};
const _hoisted_23$2 = {
  key: 0,
  class: "plain"
};
const _hoisted_24$2 = { key: 0 };
const _hoisted_25$1 = {
  key: 1,
  class: "empty"
};
const _hoisted_26$1 = {
  class: "block",
  "data-testid": "problem-acks-section"
};
const _sfc_main$G = /* @__PURE__ */ defineComponent({
  __name: "ProblemDetails",
  props: {
    problem: {},
    options: {}
  },
  emits: ["close", "view-metrics"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function onViewMetrics() {
      emit("view-metrics", props.problem);
    }
    const descHtml = computed(
      () => sanitizeProblemHtml(
        props.problem.description || props.problem.name,
        props.options.allowDangerousHTML
      )
    );
    const hostLabel = computed(
      () => props.problem.hosts.map((h2) => h2.name || h2.host).filter(Boolean).join(", ")
    );
    const suppressionRows = computed(() => props.problem.suppression || []);
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("aside", {
        class: "details",
        "data-testid": "problem-details",
        role: "dialog",
        "aria-label": unref(zabbixT)("zabbix.panel.details")
      }, [
        createElementVNode("header", null, [
          createElementVNode(
            "h4",
            null,
            toDisplayString(__props.problem.name),
            1
            /* TEXT */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "problem-details-close",
              onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
            },
            toDisplayString(unref(zabbixT)("zabbix.common.close")),
            1
            /* TEXT */
          )
        ]),
        createVNode(ProblemStatusBar, {
          problem: __props.problem,
          "mark-ack": __props.options.markAckEvents,
          "ack-color": __props.options.ackEventColor,
          "ok-color": __props.options.okEventColor
        }, null, 8, ["problem", "mark-ack", "ack-color", "ok-color"]),
        __props.problem.items.length ? (openBlock(), createElementBlock(
          "button",
          {
            key: 0,
            type: "button",
            "data-testid": "problem-view-metrics",
            onClick: onViewMetrics
          },
          toDisplayString(unref(zabbixT)("zabbix.panel.viewMetrics")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createElementVNode(
          "p",
          _hoisted_2$x,
          toDisplayString(unref(zabbixT)("zabbix.panel.event")) + ": " + toDisplayString(__props.problem.eventid),
          1
          /* TEXT */
        ),
        __props.options.hostField ? (openBlock(), createElementBlock(
          "p",
          _hoisted_3$s,
          toDisplayString(unref(zabbixT)("zabbix.panel.hostLabel")) + ": " + toDisplayString(hostLabel.value || "—"),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        __props.options.hostGroups || __props.problem.groups.length ? (openBlock(), createElementBlock(
          "p",
          _hoisted_4$l,
          toDisplayString(unref(zabbixT)("zabbix.panel.groupsLabel")) + ": " + toDisplayString(__props.problem.groups.length ? __props.problem.groups.join(", ") : "—"),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        __props.options.showTags || __props.problem.tags.length ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
          createTextVNode(
            toDisplayString(unref(zabbixT)("zabbix.panel.tagsLabel")) + ": ",
            1
            /* TEXT */
          ),
          createVNode(TagList, {
            tags: __props.problem.tags
          }, null, 8, ["tags"])
        ])) : createCommentVNode("v-if", true),
        __props.options.descriptionField ? (openBlock(), createElementBlock("div", {
          key: 4,
          class: "desc",
          "data-testid": "problem-description",
          innerHTML: descHtml.value
        }, null, 8, _hoisted_6$e)) : createCommentVNode("v-if", true),
        __props.options.opdataField || __props.problem.opdata ? (openBlock(), createElementBlock(
          "p",
          _hoisted_7$e,
          toDisplayString(unref(zabbixT)("zabbix.panel.opdataLabel")) + ": " + toDisplayString(__props.problem.opdata || "—"),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createElementVNode(
          "p",
          _hoisted_8$9,
          toDisplayString(unref(zabbixT)("zabbix.panel.expressionLabel")) + ": " + toDisplayString(__props.problem.expression || "—"),
          1
          /* TEXT */
        ),
        __props.problem.historicalItemValue != null ? (openBlock(), createElementBlock(
          "p",
          _hoisted_9$8,
          toDisplayString(unref(zabbixT)("zabbix.panel.historyValueLabel")) + ": " + toDisplayString(__props.problem.historicalItemValue),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createElementVNode(
          "p",
          _hoisted_10$6,
          toDisplayString(unref(zabbixT)("zabbix.panel.manualCloseLabel")) + ": " + toDisplayString(__props.problem.manual_close === "1" || __props.problem.manual_close === true ? unref(zabbixT)("zabbix.panel.allowed") : unref(zabbixT)("zabbix.common.no")),
          1
          /* TEXT */
        ),
        createElementVNode(
          "p",
          _hoisted_11$6,
          toDisplayString(unref(zabbixT)("zabbix.panel.suppressedLabel")) + ": " + toDisplayString(__props.problem.suppressed ? unref(zabbixT)("zabbix.common.yes") : unref(zabbixT)("zabbix.common.no")),
          1
          /* TEXT */
        ),
        createElementVNode("section", _hoisted_12$5, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(zabbixT)("zabbix.panel.itemsCount", { count: __props.problem.items.length })),
            1
            /* TEXT */
          ),
          __props.problem.items.length ? (openBlock(), createElementBlock("ul", _hoisted_13$5, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.problem.items, (it) => {
                return openBlock(), createElementBlock("li", {
                  key: it.itemid
                }, [
                  createElementVNode(
                    "strong",
                    null,
                    toDisplayString(it.name || it.key_),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "code",
                    null,
                    toDisplayString(it.key_),
                    1
                    /* TEXT */
                  ),
                  it.lastvalue != null ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_14$3,
                    "= " + toDisplayString(it.lastvalue),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])) : (openBlock(), createElementBlock(
            "p",
            _hoisted_15$3,
            toDisplayString(unref(zabbixT)("zabbix.panel.noItems")),
            1
            /* TEXT */
          ))
        ]),
        createElementVNode("section", _hoisted_16$2, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(zabbixT)("zabbix.panel.alertsCount", { count: __props.problem.alerts.length })),
            1
            /* TEXT */
          ),
          __props.problem.alerts.length ? (openBlock(), createElementBlock("ul", _hoisted_17$2, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.problem.alerts, (a, i) => {
                return openBlock(), createElementBlock(
                  "li",
                  { key: i },
                  toDisplayString(String(
                    a.alertid || a.subject || a.message || JSON.stringify(a)
                  )),
                  1
                  /* TEXT */
                );
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])) : (openBlock(), createElementBlock(
            "p",
            _hoisted_18$2,
            toDisplayString(unref(zabbixT)("zabbix.panel.noAlerts")),
            1
            /* TEXT */
          ))
        ]),
        createElementVNode("section", _hoisted_19$2, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(zabbixT)("zabbix.panel.eventsCount", { count: __props.problem.events.length })),
            1
            /* TEXT */
          ),
          __props.problem.events.length ? (openBlock(), createElementBlock("ul", _hoisted_20$2, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.problem.events, (e, i) => {
                return openBlock(), createElementBlock("li", { key: i }, [
                  createElementVNode(
                    "time",
                    null,
                    toDisplayString(e.clock ? new Date(
                      Number(e.clock) < 1e12 ? Number(e.clock) * 1e3 : Number(e.clock)
                    ).toLocaleString() : ""),
                    1
                    /* TEXT */
                  ),
                  createTextVNode(
                    " " + toDisplayString(String(e.name || e.value_str || e.eventid || "")),
                    1
                    /* TEXT */
                  )
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])) : (openBlock(), createElementBlock(
            "p",
            _hoisted_21$2,
            toDisplayString(unref(zabbixT)("zabbix.panel.noEvents")),
            1
            /* TEXT */
          ))
        ]),
        createElementVNode("section", _hoisted_22$2, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(zabbixT)("zabbix.panel.suppressionCount", {
              count: suppressionRows.value.length
            })),
            1
            /* TEXT */
          ),
          suppressionRows.value.length ? (openBlock(), createElementBlock("ul", _hoisted_23$2, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(suppressionRows.value, (s, i) => {
                return openBlock(), createElementBlock("li", { key: i }, [
                  createTextVNode(
                    toDisplayString(String(s.maintenanceid || s.userid || JSON.stringify(s))) + " ",
                    1
                    /* TEXT */
                  ),
                  s.suppress_until != null ? (openBlock(), createElementBlock(
                    "span",
                    _hoisted_24$2,
                    toDisplayString(unref(zabbixT)("zabbix.panel.until")) + " " + toDisplayString(s.suppress_until === 0 || s.suppress_until === "0" ? unref(zabbixT)("zabbix.panel.forever") : s.suppress_until),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])) : (openBlock(), createElementBlock(
            "p",
            _hoisted_25$1,
            toDisplayString(unref(zabbixT)("zabbix.panel.noSuppression")),
            1
            /* TEXT */
          ))
        ]),
        __props.options.problemTimeline ? (openBlock(), createBlock(ProblemTimeline, {
          key: 7,
          problem: __props.problem
        }, null, 8, ["problem"])) : createCommentVNode("v-if", true),
        createElementVNode("section", _hoisted_26$1, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(zabbixT)("zabbix.panel.acknowledgesCount", {
              count: __props.problem.acknowledges.length
            })),
            1
            /* TEXT */
          ),
          createVNode(ProblemAcknowledges, {
            items: __props.problem.acknowledges
          }, null, 8, ["items"])
        ])
      ], 8, _hoisted_1$E);
    };
  }
});
const ProblemDetails = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["__scopeId", "data-v-fa15de28"]]);
const ACK_ACTION = {
  CLOSE: 1,
  ACKNOWLEDGE: 2,
  ADD_MESSAGE: 4,
  CHANGE_SEVERITY: 8,
  UNACKNOWLEDGE: 16,
  SUPPRESS: 32,
  UNSUPPRESS: 64
};
function envLiveWrites(raw) {
  if (typeof raw === "boolean") return raw;
  if (raw != null) return String(raw) === "1" || String(raw).toLowerCase() === "true";
  if (typeof process !== "undefined" && process.env) {
    return process.env.ZABBIX_LIVE_WRITES === "1";
  }
  return false;
}
function panelAllows(action, panel2) {
  if (!panel2) return false;
  switch (action) {
    case "acknowledge":
    case "message":
      return Boolean(panel2.allowAcknowledge);
    case "unacknowledge":
      return Boolean(panel2.allowUnacknowledge);
    case "close":
      return Boolean(panel2.allowClose);
    case "changeSeverity":
      return Boolean(panel2.allowChangeSeverity);
    case "suppress":
      return Boolean(panel2.allowSuppress);
    case "unsuppress":
      return Boolean(panel2.allowUnsuppress);
    case "executeScript":
      return Boolean(panel2.allowExecuteScripts);
    default:
      return false;
  }
}
function evaluateWriteGate(action, gate = {}) {
  if (!panelAllows(action, gate.panel)) {
    return {
      allowed: false,
      reason: zabbixT("zabbix.error.panelActionDisabled", { action })
    };
  }
  if (!gate.datasourceEnableWrites) {
    return { allowed: false, reason: zabbixT("zabbix.error.writesDisabled") };
  }
  if (!envLiveWrites(gate.liveWritesEnv)) {
    return {
      allowed: false,
      reason: zabbixT("zabbix.error.liveWritesDisabled")
    };
  }
  if (gate.userCanWrite === false) {
    return { allowed: false, reason: zabbixT("zabbix.error.userReadonly") };
  }
  if (action === "close" && gate.eventManualClose === false) {
    return {
      allowed: false,
      reason: zabbixT("zabbix.error.manualCloseUnsupported")
    };
  }
  if (action === "executeScript") {
    if (!gate.hasScript && !gate.scriptid) {
      return {
        allowed: false,
        reason: zabbixT("zabbix.error.scriptNotSelected")
      };
    }
  }
  return { allowed: true };
}
function buildAcknowledgeMask(action, opts = {}) {
  let mask = 0;
  const payload = {};
  switch (action) {
    case "acknowledge":
      mask = ACK_ACTION.ACKNOWLEDGE;
      if (opts.message) mask |= ACK_ACTION.ADD_MESSAGE;
      break;
    case "message":
      mask = ACK_ACTION.ADD_MESSAGE;
      break;
    case "unacknowledge":
      mask = ACK_ACTION.UNACKNOWLEDGE;
      if (opts.message) mask |= ACK_ACTION.ADD_MESSAGE;
      break;
    case "close":
      mask = ACK_ACTION.CLOSE;
      if (opts.message) mask |= ACK_ACTION.ADD_MESSAGE;
      break;
    case "changeSeverity":
      mask = ACK_ACTION.CHANGE_SEVERITY;
      if (opts.message) mask |= ACK_ACTION.ADD_MESSAGE;
      payload.severity = Math.min(5, Math.max(0, Number(opts.severity ?? 0)));
      break;
    case "suppress":
      mask = ACK_ACTION.SUPPRESS;
      if (opts.message) mask |= ACK_ACTION.ADD_MESSAGE;
      payload.suppress_until = opts.suppressUntil != null ? Number(opts.suppressUntil) : 0;
      break;
    case "unsuppress":
      mask = ACK_ACTION.UNSUPPRESS;
      if (opts.message) mask |= ACK_ACTION.ADD_MESSAGE;
      break;
    default:
      throw new Error(`buildAcknowledgeMask does not support ${action}`);
  }
  if (action === "unacknowledge" && mask & ACK_ACTION.ACKNOWLEDGE) {
    throw new Error("unacknowledge must not include ACK bit");
  }
  if (action === "acknowledge" && mask & ACK_ACTION.CLOSE) {
    throw new Error("acknowledge must not include CLOSE bit");
  }
  if (action === "suppress" && payload.suppress_until === void 0) {
    throw new Error("suppress requires suppress_until");
  }
  if (action !== "suppress" && "suppress_until" in payload) {
    throw new Error("suppress_until only valid for suppress");
  }
  if (opts.message) payload.message = opts.message;
  payload.action = mask;
  return { action: mask, payload };
}
function resolveApi$1(preferredUid) {
  if (preferredUid) {
    const byUid2 = getRuntimeDataSource(String(preferredUid));
    if (byUid2?.mutate) return byUid2;
  }
  const all = listRuntimeDataSources();
  return all.find((ds2) => ds2?.mutate && String(ds2.type || "").includes("zabbix")) || all.find((ds2) => ds2?.mutate);
}
async function runProblemAction(problem, action, opts = {}) {
  const gate = evaluateWriteGate(action, {
    panel: opts.gate?.panel,
    datasourceEnableWrites: opts.gate?.datasourceEnableWrites,
    liveWritesEnv: opts.gate?.liveWritesEnv,
    userCanWrite: opts.gate?.userCanWrite,
    eventManualClose: opts.gate?.eventManualClose ?? (problem.manual_close === "1" || problem.manual_close === true || void 0),
    hasScript: opts.gate?.hasScript,
    scriptid: opts.scriptid
  });
  if (!gate.allowed) {
    return { status: "blocked", message: gate.reason, reason: gate.reason };
  }
  const api = resolveApi$1(problem.datasourceUid);
  if (!api?.mutate)
    return {
      status: "error",
      message: zabbixT("zabbix.error.actionNotSupported")
    };
  if (action === "executeScript") {
    const scriptid = String(opts.scriptid || "").trim();
    if (!scriptid) {
      return {
        status: "blocked",
        reason: zabbixT("zabbix.error.scriptRequired"),
        message: zabbixT("zabbix.error.scriptRequired")
      };
    }
    const hostid = problem.hosts[0]?.hostid;
    const scope = String(opts.scriptScope || "");
    let scriptPayload;
    if (scope === "4") {
      scriptPayload = { scriptid, eventid: problem.eventid };
    } else if (scope === "2") {
      scriptPayload = { scriptid, hostid };
    } else {
      scriptPayload = { scriptid };
    }
    const res2 = await api.mutate({
      action: "zabbix.executeScript",
      payload: scriptPayload
    });
    if (res2?.status === "success" && opts.reread) {
      try {
        await opts.reread(problem.eventid);
      } catch {
      }
    }
    return res2?.status === "success" ? { status: "success", message: res2.message, data: res2.data } : {
      status: "error",
      message: res2?.message || zabbixT("zabbix.error.actionFailed")
    };
  }
  const built = buildAcknowledgeMask(action, {
    message: opts.message,
    severity: opts.severity ?? problem.severity,
    suppressUntil: opts.suppressUntil
  });
  const payload = {
    eventids: [problem.eventid],
    ...built.payload
  };
  if (!payload.message && opts.message) payload.message = opts.message;
  const res = await api.mutate({ action: "zabbix.acknowledge", payload });
  if (res?.status === "success" && opts.reread) {
    try {
      await opts.reread(problem.eventid);
    } catch {
    }
  }
  return res?.status === "success" ? { status: "success", message: res.message, data: res.data } : {
    status: "error",
    message: res?.message || zabbixT("zabbix.error.actionFailed")
  };
}
const _hoisted_1$D = {
  key: 0,
  class: "modal",
  "data-testid": "ack-modal",
  role: "dialog"
};
const _hoisted_2$w = ["aria-label"];
const _hoisted_3$r = { class: "row" };
const _hoisted_4$k = { class: "row" };
const _hoisted_5$f = {
  key: 0,
  class: "sev-radios",
  "data-testid": "ack-modal-sev-radios"
};
const _hoisted_6$d = ["value", "data-testid"];
const _hoisted_7$d = {
  key: 1,
  class: "row"
};
const _hoisted_8$8 = {
  key: 2,
  class: "hint",
  "data-testid": "ack-modal-close-blocked"
};
const _hoisted_9$7 = {
  class: "hint",
  "data-testid": "ack-modal-mask"
};
const _hoisted_10$5 = { key: 1 };
const _hoisted_11$5 = ["aria-label"];
const _hoisted_12$4 = { key: 2 };
const _hoisted_13$4 = ["aria-label"];
const _sfc_main$F = /* @__PURE__ */ defineComponent({
  __name: "AcknowledgeModal",
  props: {
    problem: {},
    open: { type: Boolean },
    mode: {}
  },
  emits: ["confirm", "cancel"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const message2 = ref(zabbixT("zabbix.panel.acknowledgedState"));
    const severity = ref(3);
    const suppressUntil = ref(0);
    const doAck = ref(true);
    const doClose = ref(false);
    const doSev = ref(false);
    const canManualClose = computed(() => {
      const v = props.problem?.manual_close;
      return v === true || String(v) === "1";
    });
    const isComposite = computed(
      () => !props.mode || props.mode === "acknowledge" || props.mode === "composite"
    );
    const actionLabel = computed(() => {
      const keys = {
        close: "zabbix.panel.close",
        suppress: "zabbix.panel.suppress",
        unacknowledge: "zabbix.panel.unacknowledge",
        changeSeverity: "zabbix.panel.changeSeverity",
        unsuppress: "zabbix.panel.unsuppress",
        acknowledge: "zabbix.panel.acknowledge",
        composite: "zabbix.panel.acknowledge",
        message: "zabbix.panel.acknowledge"
      };
      return zabbixT(keys[props.mode || "acknowledge"] || "zabbix.panel.acknowledge");
    });
    watch(
      () => [props.open, props.problem?.eventid, props.mode],
      ([open]) => {
        if (!open) return;
        message2.value = props.mode === "close" || props.mode === "suppress" || props.mode === "unacknowledge" ? actionLabel.value : zabbixT("zabbix.panel.acknowledgedState");
        severity.value = props.problem?.severity ?? 3;
        suppressUntil.value = 0;
        doAck.value = true;
        doClose.value = props.mode === "close";
        doSev.value = props.mode === "changeSeverity";
      }
    );
    function compositeMask() {
      let mask = ACK_ACTION.ADD_MESSAGE;
      if (doAck.value) mask |= ACK_ACTION.ACKNOWLEDGE;
      if (doClose.value && canManualClose.value) mask |= ACK_ACTION.CLOSE;
      if (doSev.value) mask |= ACK_ACTION.CHANGE_SEVERITY;
      return mask;
    }
    function onOk() {
      if (isComposite.value) {
        emit("confirm", {
          message: message2.value,
          severity: doSev.value ? severity.value : void 0,
          actionMask: compositeMask(),
          acknowledge: doAck.value,
          close: doClose.value && canManualClose.value,
          changeSeverity: doSev.value
        });
        return;
      }
      emit("confirm", {
        message: message2.value,
        severity: props.mode === "changeSeverity" ? severity.value : void 0,
        suppressUntil: props.mode === "suppress" ? suppressUntil.value : void 0
      });
    }
    __expose({ compositeMask, canManualClose });
    return (_ctx, _cache) => {
      return __props.open && __props.problem ? (openBlock(), createElementBlock("div", _hoisted_1$D, [
        createElementVNode(
          "p",
          null,
          toDisplayString(unref(zabbixT)("zabbix.panel.acknowledgeQuestion", {
            action: actionLabel.value,
            eventid: __props.problem.eventid
          })),
          1
          /* TEXT */
        ),
        withDirectives(createElementVNode("input", {
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => message2.value = $event),
          "data-testid": "ack-modal-message",
          "aria-label": unref(zabbixT)("zabbix.panel.ackMessage")
        }, null, 8, _hoisted_2$w), [
          [vModelText, message2.value]
        ]),
        isComposite.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("label", _hoisted_3$r, [
              withDirectives(createElementVNode(
                "input",
                {
                  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => doAck.value = $event),
                  type: "checkbox",
                  "data-testid": "ack-modal-do-ack"
                },
                null,
                512
                /* NEED_PATCH */
              ), [
                [vModelCheckbox, doAck.value]
              ]),
              createTextVNode(
                " " + toDisplayString(unref(zabbixT)("zabbix.panel.ackProblem")),
                1
                /* TEXT */
              )
            ]),
            createElementVNode("label", _hoisted_4$k, [
              withDirectives(createElementVNode(
                "input",
                {
                  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => doSev.value = $event),
                  type: "checkbox",
                  "data-testid": "ack-modal-do-sev"
                },
                null,
                512
                /* NEED_PATCH */
              ), [
                [vModelCheckbox, doSev.value]
              ]),
              createTextVNode(
                " " + toDisplayString(unref(zabbixT)("zabbix.panel.changeSeverity")),
                1
                /* TEXT */
              )
            ]),
            doSev.value ? (openBlock(), createElementBlock("div", _hoisted_5$f, [
              (openBlock(), createElementBlock(
                Fragment,
                null,
                renderList([0, 1, 2, 3, 4, 5], (n) => {
                  return createElementVNode("label", {
                    key: n,
                    class: "row"
                  }, [
                    withDirectives(createElementVNode("input", {
                      "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => severity.value = $event),
                      type: "radio",
                      value: n,
                      "data-testid": `ack-modal-sev-${n}`
                    }, null, 8, _hoisted_6$d), [
                      [
                        vModelRadio,
                        severity.value,
                        void 0,
                        { number: true }
                      ]
                    ]),
                    createTextVNode(
                      " " + toDisplayString(n),
                      1
                      /* TEXT */
                    )
                  ]);
                }),
                64
                /* STABLE_FRAGMENT */
              ))
            ])) : createCommentVNode("v-if", true),
            canManualClose.value ? (openBlock(), createElementBlock("label", _hoisted_7$d, [
              withDirectives(createElementVNode(
                "input",
                {
                  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => doClose.value = $event),
                  type: "checkbox",
                  "data-testid": "ack-modal-do-close"
                },
                null,
                512
                /* NEED_PATCH */
              ), [
                [vModelCheckbox, doClose.value]
              ]),
              createTextVNode(
                " " + toDisplayString(unref(zabbixT)("zabbix.panel.closeProblem")),
                1
                /* TEXT */
              )
            ])) : (openBlock(), createElementBlock(
              "p",
              _hoisted_8$8,
              toDisplayString(unref(zabbixT)("zabbix.panel.closeBlocked")),
              1
              /* TEXT */
            )),
            createElementVNode(
              "p",
              _hoisted_9$7,
              toDisplayString(unref(zabbixT)("zabbix.panel.actionMask", { mask: compositeMask() })),
              1
              /* TEXT */
            )
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        __props.mode === "changeSeverity" && !isComposite.value ? (openBlock(), createElementBlock("label", _hoisted_10$5, [
          createTextVNode(
            toDisplayString(unref(zabbixT)("zabbix.common.severity")) + " ",
            1
            /* TEXT */
          ),
          withDirectives(createElementVNode("input", {
            "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => severity.value = $event),
            type: "number",
            min: "0",
            max: "5",
            "data-testid": "ack-modal-severity",
            "aria-label": unref(zabbixT)("zabbix.common.severity")
          }, null, 8, _hoisted_11$5), [
            [
              vModelText,
              severity.value,
              void 0,
              { number: true }
            ]
          ])
        ])) : createCommentVNode("v-if", true),
        __props.mode === "suppress" ? (openBlock(), createElementBlock("label", _hoisted_12$4, [
          createTextVNode(
            toDisplayString(unref(zabbixT)("zabbix.panel.suppressUntil")) + " ",
            1
            /* TEXT */
          ),
          withDirectives(createElementVNode("input", {
            "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => suppressUntil.value = $event),
            type: "number",
            min: "0",
            "data-testid": "ack-modal-suppress-until",
            "aria-label": unref(zabbixT)("zabbix.panel.suppressDeadline")
          }, null, 8, _hoisted_13$4), [
            [
              vModelText,
              suppressUntil.value,
              void 0,
              { number: true }
            ]
          ])
        ])) : createCommentVNode("v-if", true),
        createElementVNode(
          "button",
          {
            type: "button",
            "data-testid": "ack-modal-ok",
            onClick: onOk
          },
          toDisplayString(unref(zabbixT)("zabbix.common.confirm")),
          1
          /* TEXT */
        ),
        createElementVNode(
          "button",
          {
            type: "button",
            "data-testid": "ack-modal-cancel",
            onClick: _cache[7] || (_cache[7] = ($event) => emit("cancel"))
          },
          toDisplayString(unref(zabbixT)("zabbix.common.cancel")),
          1
          /* TEXT */
        )
      ])) : createCommentVNode("v-if", true);
    };
  }
});
const AcknowledgeModal = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["__scopeId", "data-v-50495e66"]]);
const _hoisted_1$C = {
  key: 0,
  class: "modal",
  "data-testid": "script-modal",
  role: "dialog"
};
const _hoisted_2$v = {
  key: 0,
  "data-testid": "script-modal-loading"
};
const _hoisted_3$q = {
  key: 1,
  class: "err",
  "data-testid": "script-modal-error"
};
const _hoisted_4$j = ["aria-label"];
const _hoisted_5$e = { value: "" };
const _hoisted_6$c = ["value"];
const _hoisted_7$c = {
  key: 0,
  class: "empty",
  "data-testid": "script-modal-empty"
};
const _hoisted_8$7 = {
  key: 1,
  class: "meta",
  "data-testid": "script-modal-meta"
};
const _hoisted_9$6 = { key: 0 };
const _hoisted_10$4 = { class: "actions" };
const _hoisted_11$4 = ["disabled"];
const _sfc_main$E = /* @__PURE__ */ defineComponent({
  __name: "ExecuteScriptModal",
  props: {
    problem: {},
    open: { type: Boolean }
  },
  emits: ["confirm", "cancel"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const scripts = ref([]);
    const selectedId = ref("");
    const loading = ref(false);
    const loadError = ref("");
    const selected = computed(() => scripts.value.find((s) => s.scriptid === selectedId.value) || null);
    async function loadScripts() {
      scripts.value = [];
      selectedId.value = "";
      loadError.value = "";
      if (!props.problem) return;
      const api = getRuntimeDataSource(props.problem.datasourceUid);
      if (!api?.getMetadata) {
        loadError.value = zabbixT("zabbix.panel.scriptLoadError");
        return;
      }
      loading.value = true;
      try {
        const hostid = props.problem.hosts[0]?.hostid || "";
        const res = await api.getMetadata({
          type: "scripts",
          hostid,
          eventid: props.problem.eventid
        });
        const values = res?.values || [];
        scripts.value = values.map((s) => ({
          ...s,
          scriptid: String(s.scriptid ?? ""),
          name: String(s.name ?? s.scriptid ?? "")
        }));
        selectedId.value = "";
      } catch (error) {
        loadError.value = error?.message || zabbixT("zabbix.panel.scriptLoadFailed");
      } finally {
        loading.value = false;
      }
    }
    watch(
      () => [props.open, props.problem?.eventid],
      ([open]) => {
        if (open && props.problem) void loadScripts();
      },
      { immediate: true }
    );
    function onConfirm() {
      const id = String(selectedId.value || "").trim();
      if (!id) return;
      emit("confirm", id, String(selected.value?.scope ?? ""));
    }
    return (_ctx, _cache) => {
      return __props.open && __props.problem ? (openBlock(), createElementBlock("div", _hoisted_1$C, [
        createElementVNode(
          "p",
          null,
          toDisplayString(unref(zabbixT)("zabbix.panel.scriptRun", {
            host: __props.problem.hosts[0]?.name || __props.problem.eventid
          })),
          1
          /* TEXT */
        ),
        loading.value ? (openBlock(), createElementBlock(
          "p",
          _hoisted_2$v,
          toDisplayString(unref(zabbixT)("zabbix.panel.scriptLoading")),
          1
          /* TEXT */
        )) : loadError.value ? (openBlock(), createElementBlock(
          "p",
          _hoisted_3$q,
          toDisplayString(loadError.value),
          1
          /* TEXT */
        )) : (openBlock(), createElementBlock(
          Fragment,
          { key: 2 },
          [
            createElementVNode("label", null, [
              createTextVNode(
                toDisplayString(unref(zabbixT)("zabbix.panel.script")) + " ",
                1
                /* TEXT */
              ),
              withDirectives(createElementVNode("select", {
                "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedId.value = $event),
                "data-testid": "script-modal-select",
                "aria-label": unref(zabbixT)("zabbix.panel.chooseScript")
              }, [
                createElementVNode(
                  "option",
                  _hoisted_5$e,
                  toDisplayString(unref(zabbixT)("zabbix.panel.chooseScriptOption")),
                  1
                  /* TEXT */
                ),
                (openBlock(true), createElementBlock(
                  Fragment,
                  null,
                  renderList(scripts.value, (s) => {
                    return openBlock(), createElementBlock("option", {
                      key: s.scriptid,
                      value: s.scriptid
                    }, toDisplayString(s.name) + " (" + toDisplayString(s.scriptid) + ") ", 9, _hoisted_6$c);
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ], 8, _hoisted_4$j), [
                [vModelSelect, selectedId.value]
              ])
            ]),
            !scripts.value.length ? (openBlock(), createElementBlock(
              "p",
              _hoisted_7$c,
              toDisplayString(unref(zabbixT)("zabbix.panel.noScripts")),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true),
            selected.value ? (openBlock(), createElementBlock("dl", _hoisted_8$7, [
              createElementVNode("div", null, [
                createElementVNode(
                  "dt",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.panel.scriptConfirmation")),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "dd",
                  null,
                  toDisplayString(selected.value.confirmation || "—"),
                  1
                  /* TEXT */
                )
              ]),
              createElementVNode("div", null, [
                createElementVNode(
                  "dt",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.panel.scriptScope")),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "dd",
                  null,
                  toDisplayString(selected.value.scope || "—"),
                  1
                  /* TEXT */
                )
              ]),
              createElementVNode("div", null, [
                createElementVNode(
                  "dt",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.panel.scriptAccess")),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "dd",
                  null,
                  toDisplayString(selected.value.host_access || "—"),
                  1
                  /* TEXT */
                )
              ]),
              selected.value.description ? (openBlock(), createElementBlock("div", _hoisted_9$6, [
                createElementVNode(
                  "dt",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.panel.scriptDescription")),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "dd",
                  null,
                  toDisplayString(selected.value.description),
                  1
                  /* TEXT */
                )
              ])) : createCommentVNode("v-if", true)
            ])) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        )),
        createElementVNode("div", _hoisted_10$4, [
          createElementVNode("button", {
            type: "button",
            "data-testid": "script-modal-ok",
            disabled: !selectedId.value,
            onClick: onConfirm
          }, toDisplayString(unref(zabbixT)("zabbix.common.execute")), 9, _hoisted_11$4),
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "script-modal-cancel",
              onClick: _cache[1] || (_cache[1] = ($event) => emit("cancel"))
            },
            toDisplayString(unref(zabbixT)("zabbix.common.cancel")),
            1
            /* TEXT */
          )
        ])
      ])) : createCommentVNode("v-if", true);
    };
  }
});
const ExecuteScriptModal = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["__scopeId", "data-v-01e96d3c"]]);
const _hoisted_1$B = { class: "toolbar" };
const _hoisted_2$u = ["placeholder", "aria-label"];
const _hoisted_3$p = {
  key: 0,
  class: "error",
  role: "alert"
};
const _hoisted_4$i = {
  key: 1,
  class: "ok",
  role: "status"
};
const _hoisted_5$d = {
  key: 2,
  class: "empty",
  "data-testid": "problems-empty"
};
const _hoisted_6$b = {
  key: 5,
  class: "pager"
};
const _hoisted_7$b = ["disabled"];
const _hoisted_8$6 = ["disabled"];
const _sfc_main$D = /* @__PURE__ */ defineComponent({
  __name: "ProblemsPanel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => migrateProblemsPanelOptions(props.options || {}));
    const model = computed(() => problemsFromPanelData(props.data, options.value));
    const problems = computed(() => model.value.problems);
    const notices = computed(() => model.value.notices);
    const page = ref(0);
    const selected = ref(null);
    const message2 = ref("");
    const actionError = ref("");
    const actionOk = ref("");
    const ackOpen = ref(false);
    const ackMode = ref("acknowledge");
    const ackTarget = ref(null);
    const scriptOpen = ref(false);
    const scriptTarget = ref(null);
    const pageSize = computed(() => options.value.pageSize || 10);
    const pageItems = computed(() => {
      const start = page.value * pageSize.value;
      return problems.value.slice(start, start + pageSize.value);
    });
    function dsEnableWrites(uid) {
      const ds2 = getRuntimeDataSource(uid);
      return Boolean(ds2?.enableWrites);
    }
    async function reread(eventid, uid) {
      const ds2 = getRuntimeDataSource(uid);
      if (!ds2?.getMetadata) return;
      await ds2.getMetadata({ type: "problemDetail", eventid });
    }
    function openAck(p, mode2) {
      ackTarget.value = p;
      ackMode.value = mode2;
      ackOpen.value = true;
    }
    function openScript(p) {
      if (!options.value.allowExecuteScripts) return;
      scriptTarget.value = p;
      scriptOpen.value = true;
    }
    async function execute(p, action, opts = {}) {
      actionError.value = "";
      actionOk.value = "";
      const res = await runProblemAction(p, action, {
        message: opts.message ?? message2.value,
        severity: opts.severity,
        suppressUntil: opts.suppressUntil,
        scriptid: opts.scriptid,
        scriptScope: opts.scriptScope,
        gate: {
          panel: options.value,
          datasourceEnableWrites: dsEnableWrites(p.datasourceUid),
          liveWritesEnv: typeof process !== "undefined" ? process.env.ZABBIX_LIVE_WRITES : void 0,
          userCanWrite: true,
          eventManualClose: p.manual_close === "1" || p.manual_close === true,
          hasScript: Boolean(opts.scriptid),
          scriptid: opts.scriptid
        },
        reread: (eventid) => reread(eventid, p.datasourceUid)
      });
      if (res.status !== "success")
        actionError.value = res.message || res.reason || zabbixT("zabbix.error.actionFailed");
      else actionOk.value = res.message || zabbixT("zabbix.panel.submitted");
    }
    async function onAckConfirm(payload) {
      const p = ackTarget.value;
      ackOpen.value = false;
      if (!p) return;
      await execute(p, ackMode.value === "message" ? "message" : ackMode.value, payload);
      ackTarget.value = null;
    }
    async function onScriptConfirm(scriptid, scope) {
      const p = scriptTarget.value;
      scriptOpen.value = false;
      if (!p) return;
      await execute(p, "executeScript", { scriptid, scriptScope: scope });
      scriptTarget.value = null;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: "zbx-problems",
          "data-testid": "zabbix-problems-panel",
          style: normalizeStyle({
            width: `${__props.width}px`,
            height: `${__props.height}px`,
            fontSize: options.value.fontSize
          })
        },
        [
          createElementVNode("div", _hoisted_1$B, [
            createElementVNode(
              "span",
              null,
              toDisplayString(unref(zabbixT)("zabbix.panel.count", { count: problems.value.length })),
              1
              /* TEXT */
            ),
            withDirectives(createElementVNode("input", {
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => message2.value = $event),
              placeholder: unref(zabbixT)("zabbix.panel.actionNote"),
              "data-testid": "ack-message",
              "aria-label": unref(zabbixT)("zabbix.panel.actionNote")
            }, null, 8, _hoisted_2$u), [
              [vModelText, message2.value]
            ])
          ]),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(notices.value, (n) => {
              return openBlock(), createElementBlock(
                "div",
                {
                  key: n,
                  class: "notice",
                  role: "status"
                },
                toDisplayString(n),
                1
                /* TEXT */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          actionError.value ? (openBlock(), createElementBlock(
            "div",
            _hoisted_3$p,
            toDisplayString(actionError.value),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          actionOk.value ? (openBlock(), createElementBlock(
            "div",
            _hoisted_4$i,
            toDisplayString(actionOk.value),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          !problems.value.length ? (openBlock(), createElementBlock(
            "div",
            _hoisted_5$d,
            toDisplayString(unref(zabbixT)("zabbix.panel.empty")),
            1
            /* TEXT */
          )) : options.value.layout === "table" ? (openBlock(), createBlock(ProblemsTable, {
            key: 3,
            items: problems.value,
            options: options.value,
            onSelect: _cache[1] || (_cache[1] = ($event) => selected.value = $event),
            onAcknowledge: _cache[2] || (_cache[2] = ($event) => openAck($event, "acknowledge")),
            onUnacknowledge: _cache[3] || (_cache[3] = ($event) => openAck($event, "unacknowledge")),
            onClose: _cache[4] || (_cache[4] = ($event) => openAck($event, "close")),
            onSeverity: _cache[5] || (_cache[5] = ($event) => openAck($event, "changeSeverity")),
            onSuppress: _cache[6] || (_cache[6] = ($event) => openAck($event, "suppress")),
            onUnsuppress: _cache[7] || (_cache[7] = ($event) => openAck($event, "unsuppress")),
            onScript: openScript,
            "onUpdate:options": _cache[8] || (_cache[8] = (o) => props.onOptionsChange?.(o))
          }, null, 8, ["items", "options"])) : (openBlock(), createBlock(ProblemsList, {
            key: 4,
            items: pageItems.value,
            options: options.value,
            onSelect: _cache[9] || (_cache[9] = ($event) => selected.value = $event)
          }, null, 8, ["items", "options"])),
          options.value.layout === "list" && problems.value.length > pageSize.value ? (openBlock(), createElementBlock("div", _hoisted_6$b, [
            createElementVNode("button", {
              type: "button",
              disabled: page.value === 0,
              "data-testid": "problems-prev",
              onClick: _cache[10] || (_cache[10] = ($event) => page.value--)
            }, toDisplayString(unref(zabbixT)("zabbix.panel.previous")), 9, _hoisted_7$b),
            createElementVNode(
              "span",
              null,
              toDisplayString(page.value + 1) + " / " + toDisplayString(Math.max(1, Math.ceil(problems.value.length / pageSize.value))),
              1
              /* TEXT */
            ),
            createElementVNode("button", {
              type: "button",
              disabled: (page.value + 1) * pageSize.value >= problems.value.length,
              "data-testid": "problems-next",
              onClick: _cache[11] || (_cache[11] = ($event) => page.value++)
            }, toDisplayString(unref(zabbixT)("zabbix.panel.next")), 9, _hoisted_8$6)
          ])) : createCommentVNode("v-if", true),
          selected.value && options.value.showDetails ? (openBlock(), createBlock(ProblemDetails, {
            key: 6,
            problem: selected.value,
            options: options.value,
            onClose: _cache[12] || (_cache[12] = ($event) => selected.value = null)
          }, null, 8, ["problem", "options"])) : createCommentVNode("v-if", true),
          createVNode(AcknowledgeModal, {
            problem: ackTarget.value,
            open: ackOpen.value,
            mode: ackMode.value,
            onConfirm: onAckConfirm,
            onCancel: _cache[13] || (_cache[13] = ($event) => {
              ackOpen.value = false;
              ackTarget.value = null;
            })
          }, null, 8, ["problem", "open", "mode"]),
          createVNode(ExecuteScriptModal, {
            problem: scriptTarget.value,
            open: scriptOpen.value,
            onConfirm: onScriptConfirm,
            onCancel: _cache[14] || (_cache[14] = ($event) => {
              scriptOpen.value = false;
              scriptTarget.value = null;
            })
          }, null, 8, ["problem", "open"])
        ],
        4
        /* STYLE */
      );
    };
  }
});
const ProblemsPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["__scopeId", "data-v-2c4c88d4"]]);
const _hoisted_1$A = {
  class: "sev-editor",
  "data-testid": "severity-color-editor"
};
const _hoisted_2$t = ["data-testid"];
const _hoisted_3$o = { class: "name" };
const _sfc_main$C = /* @__PURE__ */ defineComponent({
  __name: "SeverityColorEditor",
  props: {
    value: {},
    context: {}
  },
  emits: ["update:value"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function list() {
      const v = props.value?.length ? props.value : DEFAULT_SEVERITY;
      return v.map((s) => ({ ...s }));
    }
    function patch(i, partial) {
      const next = list().map((s, idx) => idx === i ? { ...s, ...partial } : s);
      emit("update:value", next);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$A, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(list(), (s, i) => {
            return openBlock(), createElementBlock("div", {
              key: s.priority,
              class: "row",
              "data-testid": `severity-row-${s.priority}`
            }, [
              createElementVNode(
                "span",
                _hoisted_3$o,
                toDisplayString(unref(zabbixSeverityLabel)(s.priority, s.severity)),
                1
                /* TEXT */
              ),
              createVNode(unref(GInput), {
                "model-value": s.color,
                "test-id": `severity-color-${s.priority}`,
                "aria-label": unref(zabbixT)("zabbix.panel.severityColor"),
                "onUpdate:modelValue": ($event) => patch(i, { color: String($event) })
              }, null, 8, ["model-value", "test-id", "aria-label", "onUpdate:modelValue"]),
              createElementVNode(
                "span",
                {
                  class: "swatch",
                  style: normalizeStyle({ background: s.color }),
                  "aria-hidden": "true"
                },
                null,
                4
                /* STYLE */
              ),
              createVNode(unref(GSwitch), {
                checked: s.show !== false,
                "test-id": `severity-show-${s.priority}`,
                "onUpdate:checked": ($event) => patch(i, { show: $event })
              }, null, 8, ["checked", "test-id", "onUpdate:checked"])
            ], 8, _hoisted_2$t);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const SeverityColorEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["__scopeId", "data-v-0ce01e95"]]);
const _hoisted_1$z = {
  class: "reset-cols",
  "data-testid": "reset-columns-editor"
};
const _hoisted_2$s = {
  key: 0,
  class: "hint"
};
const _sfc_main$B = /* @__PURE__ */ defineComponent({
  __name: "ResetColumnsEditor",
  props: {
    value: {}
  },
  emits: ["update:value"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$z, [
        createVNode(unref(GButton), {
          size: "sm",
          variant: "secondary",
          "test-id": "reset-columns-btn",
          onClick: _cache[0] || (_cache[0] = ($event) => emit("update:value", []))
        }, {
          default: withCtx(() => [
            createTextVNode(
              toDisplayString(unref(zabbixT)("zabbix.panel.resetColumns")),
              1
              /* TEXT */
            )
          ]),
          _: 1
          /* STABLE */
        }),
        (__props.value || []).length ? (openBlock(), createElementBlock(
          "span",
          _hoisted_2$s,
          toDisplayString(unref(zabbixT)("zabbix.panel.customColumns", { count: __props.value.length })),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const ResetColumnsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__scopeId", "data-v-b96f4ee3"]]);
const FONT_SIZES = [
  "80%",
  "90%",
  "100%",
  "110%",
  "120%",
  "130%",
  "150%",
  "160%",
  "180%",
  "200%",
  "220%",
  "250%"
];
const plugin$3 = new VuePanelPlugin(
  {
    id: "alexanderzobnin-zabbix-triggers-panel",
    name: zabbixT("zabbix.panel.name"),
    state: "stable"
  },
  ProblemsPanel
).setPanelOptions((builder) => {
  builder.addRadio(
    {
      id: "layout",
      path: "layout",
      name: zabbixT("zabbix.panel.option.layout"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "radio",
      settings: {
        options: [
          { label: zabbixT("zabbix.panel.option.table"), value: "table" },
          { label: zabbixT("zabbix.panel.option.list"), value: "list" }
        ]
      }
    },
    "table"
  ).addRadio(
    {
      id: "sortProblems",
      path: "sortProblems",
      name: zabbixT("zabbix.panel.option.sortProblems"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "radio",
      settings: {
        options: [
          { label: zabbixT("zabbix.common.default"), value: "default" },
          {
            label: zabbixT("zabbix.panel.option.lastchange"),
            value: "lastchange"
          },
          { label: zabbixT("zabbix.common.severity"), value: "priority" }
        ]
      }
    },
    "lastchange"
  ).addSelect(
    {
      id: "fontSize",
      path: "fontSize",
      name: zabbixT("zabbix.panel.option.fontSize"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "select",
      settings: {
        options: FONT_SIZES.map((v) => ({ label: v, value: v }))
      }
    },
    "100%"
  ).addSelect(
    {
      id: "pageSize",
      path: "pageSize",
      name: zabbixT("zabbix.panel.option.pageSize"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "select",
      settings: {
        options: [5, 10, 20, 25, 50, 100].map((n) => ({
          label: String(n),
          value: n
        }))
      }
    },
    10
  ).addBoolean(
    {
      id: "problemTimeline",
      path: "problemTimeline",
      name: zabbixT("zabbix.panel.option.problemTimeline"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "highlightBackground",
      path: "highlightBackground",
      name: zabbixT("zabbix.panel.option.highlightBackground"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "highlightNewEvents",
      path: "highlightNewEvents",
      name: zabbixT("zabbix.panel.option.highlightNewEvents"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "boolean"
    },
    false
  ).addText(
    {
      id: "highlightNewerThan",
      path: "highlightNewerThan",
      name: zabbixT("zabbix.panel.option.highlightNewerThan"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "text"
    },
    "1h"
  ).addBoolean(
    {
      id: "customLastChangeFormat",
      path: "customLastChangeFormat",
      name: zabbixT("zabbix.panel.option.customLastChangeFormat"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "boolean"
    },
    false
  ).addText(
    {
      id: "lastChangeFormat",
      path: "lastChangeFormat",
      name: zabbixT("zabbix.panel.option.lastChangeFormat"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "text"
    },
    ""
  ).addBoolean(
    {
      id: "markAckEvents",
      path: "markAckEvents",
      name: zabbixT("zabbix.panel.option.markAckEvents"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "hostField",
      path: "hostField",
      name: zabbixT("zabbix.panel.option.hostField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "hostTechNameField",
      path: "hostTechNameField",
      name: zabbixT("zabbix.panel.option.hostTechNameField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "hostGroups",
      path: "hostGroups",
      name: zabbixT("zabbix.panel.option.hostGroups"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "hostProxy",
      path: "hostProxy",
      name: zabbixT("zabbix.panel.option.hostProxy"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showTags",
      path: "showTags",
      name: zabbixT("zabbix.panel.option.showTags"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "statusField",
      path: "statusField",
      name: zabbixT("zabbix.panel.option.statusField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "statusIcon",
      path: "statusIcon",
      name: zabbixT("zabbix.panel.option.statusIcon"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "severityField",
      path: "severityField",
      name: zabbixT("zabbix.panel.option.severityField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "ackField",
      path: "ackField",
      name: zabbixT("zabbix.panel.option.ackField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "ageField",
      path: "ageField",
      name: zabbixT("zabbix.panel.option.ageField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "opdataField",
      path: "opdataField",
      name: zabbixT("zabbix.panel.option.opdataField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "descriptionField",
      path: "descriptionField",
      name: zabbixT("zabbix.panel.option.descriptionField"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "descriptionAtNewLine",
      path: "descriptionAtNewLine",
      name: zabbixT("zabbix.panel.option.descriptionAtNewLine"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showDatasourceName",
      path: "showDatasourceName",
      name: zabbixT("zabbix.panel.option.showDatasourceName"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "boolean"
    },
    false
  ).addText(
    {
      id: "customTagColumns",
      path: "customTagColumns",
      name: zabbixT("zabbix.panel.option.customTagColumns"),
      category: [zabbixT("zabbix.panel.category.field")],
      editor: "text"
    },
    ""
  ).addCustomEditor(
    {
      id: "triggerSeverity",
      path: "triggerSeverity",
      name: zabbixT("zabbix.panel.option.triggerSeverity"),
      category: [zabbixT("zabbix.panel.category.severity")],
      editor: "custom",
      customEditor: SeverityColorEditor
    },
    DEFAULT_SEVERITY.map((s) => ({ ...s }))
  ).addCustomEditor(
    {
      id: "resizedColumns",
      path: "resizedColumns",
      name: zabbixT("zabbix.panel.option.resizedColumns"),
      category: [zabbixT("zabbix.panel.category.display")],
      editor: "custom",
      customEditor: ResetColumnsEditor
    },
    []
  ).addBoolean(
    {
      id: "allowDangerousHTML",
      path: "allowDangerousHTML",
      name: zabbixT("zabbix.panel.option.allowDangerousHTML"),
      category: [zabbixT("zabbix.panel.category.security")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowAcknowledge",
      path: "allowAcknowledge",
      name: zabbixT("zabbix.panel.option.allowAcknowledge"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowUnacknowledge",
      path: "allowUnacknowledge",
      name: zabbixT("zabbix.panel.option.allowUnacknowledge"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowClose",
      path: "allowClose",
      name: zabbixT("zabbix.panel.option.allowClose"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowChangeSeverity",
      path: "allowChangeSeverity",
      name: zabbixT("zabbix.panel.option.allowChangeSeverity"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowSuppress",
      path: "allowSuppress",
      name: zabbixT("zabbix.panel.option.allowSuppress"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowUnsuppress",
      path: "allowUnsuppress",
      name: zabbixT("zabbix.panel.option.allowUnsuppress"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "allowExecuteScripts",
      path: "allowExecuteScripts",
      name: zabbixT("zabbix.panel.option.allowExecuteScripts"),
      category: [zabbixT("zabbix.panel.category.action")],
      editor: "boolean"
    },
    false
  ).addBoolean(
    {
      id: "showDetails",
      path: "showDetails",
      name: zabbixT("zabbix.panel.option.showDetails"),
      category: [zabbixT("zabbix.panel.category.layout")],
      editor: "boolean"
    },
    true
  ).addColor(
    {
      id: "okEventColor",
      path: "okEventColor",
      name: zabbixT("zabbix.panel.option.okEventColor"),
      category: [zabbixT("zabbix.panel.category.severity")],
      editor: "color"
    },
    "rgb(56, 189, 113)"
  ).addColor(
    {
      id: "ackEventColor",
      path: "ackEventColor",
      name: zabbixT("zabbix.panel.option.ackEventColor"),
      category: [zabbixT("zabbix.panel.category.severity")],
      editor: "color"
    },
    "rgb(56, 219, 156)"
  );
}).setPanelMigrationHandler(migrateProblemsPanel).setMigrationHandler((options) => ({
  options: migrateProblemsPanelOptions({
    ...DEFAULT_PROBLEMS_OPTIONS,
    ...options
  })
})).setRuntimeConsumedPaths(Object.keys(DEFAULT_PROBLEMS_OPTIONS)).register();
const module$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: plugin$3
}, Symbol.toStringTag, { value: "Module" }));
const DESCENDANTS = {
  group: ["host", "application", "item", "trigger", "macro"],
  host: ["application", "item", "trigger", "macro"],
  application: ["item"],
  item: [],
  trigger: [],
  macro: [],
  proxy: []
};
function canRunWithoutParentScope(owner, parents) {
  if (parents.scope === "all") return true;
  if (owner === "group" || owner === "proxy") return true;
  if (owner === "host") return (parents.groupIds?.length ?? 0) > 0;
  if (owner === "application" || owner === "item" || owner === "trigger" || owner === "macro") {
    return (parents.hostIds?.length ?? 0) > 0 || (parents.groupIds?.length ?? 0) > 0;
  }
  return true;
}
class ZabbixMetadataScheduler {
  maxConcurrent;
  running = 0;
  queue = [];
  active = /* @__PURE__ */ new Map();
  revisions = /* @__PURE__ */ new Map();
  inflightByKey = /* @__PURE__ */ new Map();
  constructor(opts) {
    this.maxConcurrent = Math.max(1, opts?.maxConcurrent ?? 4);
  }
  getRevision(owner) {
    return this.revisions.get(owner) ?? 0;
  }
  /**
   * Bump revision for owner and abort owner + descendants.
   * Returns the new revision.
   */
  invalidateFrom(owner, revision) {
    const next = revision ?? this.getRevision(owner) + 1;
    this.revisions.set(owner, next);
    const victims = /* @__PURE__ */ new Set([owner, ...DESCENDANTS[owner]]);
    for (const o of victims) {
      if (o !== owner) this.revisions.set(o, next);
    }
    for (const [key, active] of this.active) {
      if (victims.has(active.owner)) {
        active.controller.abort();
        this.active.delete(key);
      }
    }
    for (let i = this.queue.length - 1; i >= 0; i--) {
      if (victims.has(this.queue[i].request.owner)) {
        const t2 = this.queue.splice(i, 1)[0];
        t2.controller.abort();
        t2.resolve(void 0);
      }
    }
    for (const [key, _p] of this.inflightByKey) {
      const ownerKey = key.split(":")[0];
      if (victims.has(ownerKey)) this.inflightByKey.delete(key);
    }
    return next;
  }
  cancel(owner) {
    if (!owner) {
      for (const active of this.active.values()) active.controller.abort();
      this.active.clear();
      for (const t2 of this.queue) {
        t2.controller.abort();
        t2.resolve(void 0);
      }
      this.queue.length = 0;
      this.inflightByKey.clear();
      return;
    }
    this.invalidateFrom(owner);
  }
  async request(request, loader) {
    if (!canRunWithoutParentScope(request.owner, request.parents)) {
      return void 0;
    }
    const latest = this.getRevision(request.owner);
    if (request.revision < latest) {
      return void 0;
    }
    const inflightKey = `${request.owner}:${request.key}:r${request.revision}`;
    const existing = this.inflightByKey.get(inflightKey);
    if (existing) return existing;
    const promise = new Promise((resolve, reject) => {
      const controller = new AbortController();
      const task = {
        request,
        loader,
        resolve,
        reject,
        controller
      };
      if (request.priority === "interactive") {
        this.queue.unshift(task);
      } else {
        this.queue.push(task);
      }
      this.pump();
    });
    this.inflightByKey.set(inflightKey, promise);
    promise.finally(() => {
      if (this.inflightByKey.get(inflightKey) === promise) {
        this.inflightByKey.delete(inflightKey);
      }
    });
    return promise;
  }
  pump() {
    while (this.running < this.maxConcurrent && this.queue.length > 0) {
      const task = this.queue.shift();
      const latest = this.getRevision(task.request.owner);
      if (task.request.revision < latest) {
        task.resolve(void 0);
        continue;
      }
      this.running += 1;
      const key = `${task.request.owner}:${task.request.key}`;
      this.active.set(key, {
        controller: task.controller,
        revision: task.request.revision,
        owner: task.request.owner
      });
      void (async () => {
        try {
          if (task.controller.signal.aborted) {
            task.resolve(void 0);
            return;
          }
          const value = await task.loader(task.controller.signal);
          const stillLatest = this.getRevision(task.request.owner);
          if (task.request.revision < stillLatest || task.controller.signal.aborted) {
            task.resolve(void 0);
            return;
          }
          task.resolve(value);
        } catch (error) {
          if (error?.name === "AbortError") {
            task.resolve(void 0);
          } else {
            task.reject(error);
          }
        } finally {
          this.active.delete(key);
          this.running -= 1;
          this.pump();
        }
      })();
    }
  }
}
const byUid = /* @__PURE__ */ new Map();
function getZabbixMetadataScheduler(uid, opts) {
  const key = String(uid || "__default__");
  let s = byUid.get(key);
  if (!s) {
    s = new ZabbixMetadataScheduler(opts);
    byUid.set(key, s);
  }
  return s;
}
function useZabbixMetadata(load, opts = {}) {
  const options = shallowRef([]);
  const loading = ref(false);
  const error = ref("");
  const stale = ref(false);
  let sequence = 0;
  let controller = null;
  let debounceTimer = null;
  let staleRetryTimer = null;
  let staleRetries = 0;
  let alive = true;
  const debounceMs = opts.debounceMs ?? 0;
  let localRevision = 0;
  const MAX_STALE_RETRIES = Math.max(0, opts.maxStaleRetries ?? 5);
  function resolveScheduler() {
    const s = opts.scheduler;
    if (!s) return void 0;
    return typeof s === "function" ? s() : s;
  }
  function clearStaleRetry() {
    if (staleRetryTimer) {
      clearTimeout(staleRetryTimer);
      staleRetryTimer = null;
    }
  }
  function scheduleStaleRetry(fromSequence) {
    if (!alive) return;
    if (staleRetries >= MAX_STALE_RETRIES) return;
    if (opts.canLoad && !opts.canLoad()) return;
    clearStaleRetry();
    staleRetries += 1;
    staleRetryTimer = setTimeout(() => {
      staleRetryTimer = null;
      if (!alive || fromSequence !== sequence) return;
      if (opts.canLoad && !opts.canLoad()) return;
      void runLoad("refresh");
    }, 50);
  }
  async function runLoad(priority = "refresh") {
    if (opts.canLoad && !opts.canLoad()) {
      options.value = [];
      loading.value = false;
      error.value = "";
      stale.value = false;
      staleRetries = 0;
      clearStaleRetry();
      return;
    }
    const current = ++sequence;
    loading.value = true;
    error.value = "";
    stale.value = false;
    clearStaleRetry();
    try {
      let rows;
      const scheduler = resolveScheduler();
      if (scheduler && opts.owner) {
        localRevision += 1;
        const revision = localRevision;
        const result = await scheduler.request(
          {
            owner: opts.owner,
            revision,
            parents: opts.parents?.() ?? {},
            key: opts.requestKey?.() ?? `${opts.owner}:${revision}`,
            priority: opts.priority ?? priority
          },
          (signal) => load(signal)
        );
        if (current !== sequence) return;
        if (result === void 0) {
          if (opts.canLoad && !opts.canLoad()) {
            options.value = [];
            stale.value = true;
            return;
          }
          stale.value = true;
          scheduleStaleRetry(current);
          return;
        }
        rows = result;
      } else {
        controller?.abort();
        controller = new AbortController();
        rows = await load(controller.signal);
      }
      if (current === sequence) {
        options.value = Array.isArray(rows) ? markRaw(rows) : [];
        staleRetries = 0;
      }
    } catch (error_) {
      if (current === sequence) {
        const err = error_;
        if (err?.name !== "AbortError") {
          error.value = err instanceof Error ? err.message : String(error_);
        } else if (!opts.canLoad || opts.canLoad()) {
          stale.value = true;
          scheduleStaleRetry(current);
        }
      }
    } finally {
      if (current === sequence) loading.value = false;
    }
  }
  function refresh(meta2) {
    if (meta2?.revision != null) localRevision = Math.max(localRevision, meta2.revision);
    const priority = meta2?.priority ?? "refresh";
    staleRetries = 0;
    clearStaleRetry();
    if (debounceMs > 0) {
      if (debounceTimer) clearTimeout(debounceTimer);
      debounceTimer = setTimeout(() => {
        debounceTimer = null;
        void runLoad(priority);
      }, debounceMs);
      return;
    }
    void runLoad(priority);
  }
  function retry() {
    if (debounceTimer) {
      clearTimeout(debounceTimer);
      debounceTimer = null;
    }
    staleRetries = 0;
    clearStaleRetry();
    void runLoad("interactive");
  }
  function cancel() {
    if (debounceTimer) {
      clearTimeout(debounceTimer);
      debounceTimer = null;
    }
    clearStaleRetry();
    controller?.abort();
    const scheduler = resolveScheduler();
    if (scheduler && opts.owner) scheduler.cancel(opts.owner);
  }
  onBeforeUnmount(() => {
    alive = false;
    cancel();
  });
  return {
    options,
    loading,
    error,
    stale,
    refresh,
    retry,
    cancel,
    /** @internal */
    getController: () => controller
  };
}
function resolveZabbixMetadataApi(datasourceUid, fallback) {
  const uid = String(datasourceUid || "").trim();
  if (uid) {
    const registered2 = getRuntimeDataSource(uid);
    if (registered2 && typeof registered2.getMetadata === "function") {
      return registered2;
    }
  }
  if (fallback && typeof fallback.getMetadata === "function") return fallback;
  return null;
}
function isFreeformFilter(value) {
  const v = value.trim();
  if (!v) return false;
  if (v.startsWith("/") && v.lastIndexOf("/") > 0) return true;
  if (v.startsWith("$") || v.includes("${") || v.startsWith("[[") && v.endsWith("]]"))
    return true;
  return false;
}
function optionToFilter(opt) {
  const text = String(opt.text ?? opt.value ?? "");
  const id = opt.id != null ? String(opt.id) : void 0;
  return id ? { filter: text, name: text, ids: [id] } : { filter: text, name: text, ids: [] };
}
function freeformToFilter(raw) {
  return { filter: raw };
}
const RAW = [
  {
    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]
  },
  {
    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]
  },
  {
    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"]
  },
  {
    name: "trendValue",
    category: "Trends",
    params: [
      {
        name: "type",
        type: "string",
        options: ["avg", "min", "max", "sum", "count"]
      }
    ],
    defaultParams: ["avg"]
  },
  {
    name: "timeShift",
    category: "Time",
    params: [
      {
        name: "interval",
        type: "string",
        options: ["24h", "7d", "1M", "+24h", "-24h"]
      }
    ],
    defaultParams: ["24h"]
  },
  {
    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"]
  },
  {
    name: "consolidateBy",
    category: "Special",
    params: [
      {
        name: "type",
        type: "string",
        options: ["avg", "min", "max", "sum", "count"]
      }
    ],
    defaultParams: ["avg"]
  }
];
const CATEGORY_ORDER = [
  "Transform",
  "Aggregate",
  "Filter",
  "Trends",
  "Time",
  "Alias",
  "Special"
];
function sortDefs(defs) {
  return [...defs].sort((a, b) => {
    const ca = CATEGORY_ORDER.indexOf(a.category);
    const cb = CATEGORY_ORDER.indexOf(b.category);
    if (ca !== cb) return ca - cb;
    return a.name.localeCompare(b.name);
  });
}
const FUNCTION_DEFINITIONS = sortDefs(RAW);
FUNCTION_DEFINITIONS.map((d) => ({
  name: d.name,
  category: d.category,
  params: d.params.map((p) => ({
    name: p.name,
    type: p.type === "string" ? "string" : p.type === "int" || p.type === "float" ? "number" : "string",
    options: p.options?.map(String),
    defaultValue: d.defaultParams[d.params.indexOf(p)]
  })),
  description: d.name
}));
function getFunctionDef(name) {
  return FUNCTION_DEFINITIONS.find((d) => d.name === name);
}
function createFunctionInstance(name) {
  const def = getFunctionDef(name);
  const params = def ? [...def.defaultParams] : [];
  return {
    name,
    params,
    text: formatFunctionText(name, params),
    added: true
  };
}
function formatFunctionText(name, params) {
  if (!params.length) return `${name}()`;
  return `${name}(${params.map(String).join(", ")})`;
}
const ALIAS_FUNCTIONS = /* @__PURE__ */ new Set(["setAlias", "setAliasByRegex", "replaceAlias"]);
function isAliasFunction(name) {
  const def = getFunctionDef(name);
  return def?.category === "Alias" || ALIAS_FUNCTIONS.has(name);
}
function moveAliasFuncLast(fns) {
  const nonAlias = [];
  const alias = [];
  for (const f of fns || []) {
    if (isAliasFunction(f.name)) alias.push(f);
    else nonAlias.push(f);
  }
  return [...nonAlias, ...alias];
}
const _hoisted_1$y = {
  class: "zbx-fn",
  "data-testid": "zabbix-functions"
};
const _hoisted_2$r = { class: "row add-row" };
const _hoisted_3$n = ["data-testid"];
const _hoisted_4$h = { class: "fn-main" };
const _hoisted_5$c = ["title"];
const _hoisted_6$a = {
  class: "unknown-hint",
  role: "status"
};
const _hoisted_7$a = {
  class: "fn-toolbar",
  "data-testid": "fn-toolbar"
};
const _sfc_main$A = /* @__PURE__ */ defineComponent({
  __name: "FunctionEditor",
  props: {
    modelValue: { default: void 0 },
    functions: { default: void 0 }
  },
  emits: ["update:modelValue", "update:functions"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const list = computed(() => props.functions ?? props.modelValue ?? []);
    function commit(next) {
      const ordered = moveAliasFuncLast(next);
      emit("update:modelValue", ordered);
      emit("update:functions", ordered);
    }
    const addOptions = computed(() => {
      const groups = /* @__PURE__ */ new Map();
      for (const d of FUNCTION_DEFINITIONS) {
        const arr = groups.get(d.category) || [];
        arr.push({ label: d.name, value: d.name });
        groups.set(d.category, arr);
      }
      const categoryKeys = {
        Transform: "zabbix.query.functionCategoryTransform",
        Aggregate: "zabbix.query.functionCategoryAggregate",
        Filter: "zabbix.query.functionCategoryFilter",
        Trends: "zabbix.query.functionCategoryTrends",
        Time: "zabbix.query.functionCategoryTime",
        Alias: "zabbix.query.functionCategoryAlias",
        Special: "zabbix.query.functionCategorySpecial"
      };
      return [...groups.entries()].map(([label, options]) => ({
        label: zabbixT(categoryKeys[label] || "zabbix.common.unknown"),
        options
      }));
    });
    function add(name) {
      const n = String(name || "");
      if (!n) return;
      const inst = createFunctionInstance(n);
      commit([...list.value, inst]);
    }
    function remove(idx) {
      commit(list.value.filter((_, i) => i !== idx));
    }
    function move(idx, dir) {
      const next = [...list.value];
      const j = idx + dir;
      if (j < 0 || j >= next.length) return;
      const a = next[idx];
      const b = next[j];
      if (isAliasFunction(a.name) !== isAliasFunction(b.name)) return;
      const tmp = next[idx];
      next[idx] = next[j];
      next[j] = tmp;
      commit(next);
    }
    function setParam(idx, pidx, value) {
      const next = list.value.map((f, i) => {
        if (i !== idx) return f;
        const def = getFunctionDef(f.name);
        const params = [...f.params || []];
        while (params.length <= pidx) params.push("");
        const pdef = def?.params[pidx];
        let v = value;
        if (pdef?.type === "int") v = Number.parseInt(String(value), 10);
        else if (pdef?.type === "float") v = Number(value);
        params[pidx] = v;
        const cleaned = def && def.defaultParams.length === 0 && params.every((p) => p === "" || p == null) ? [] : params;
        return { ...f, params: cleaned, text: formatFunctionText(f.name, cleaned) };
      });
      commit(next);
    }
    function paramValue(fn, pidx) {
      const v = fn.params?.[pidx];
      return v == null ? "" : String(v);
    }
    function unknownDef(name) {
      return !getFunctionDef(name);
    }
    __expose({ add, remove, move, setParam, moveAliasFuncLast });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$y, [
        _cache[3] || (_cache[3] = createElementVNode(
          "span",
          {
            hidden: "",
            "data-testid": "zabbix-function-editor"
          },
          null,
          -1
          /* CACHED */
        )),
        createElementVNode("div", _hoisted_2$r, [
          createVNode(unref(GSelect), {
            options: addOptions.value,
            placeholder: unref(zabbixT)("zabbix.query.functionsAdd"),
            "test-id": "zabbix-function-add",
            "onUpdate:value": add
          }, null, 8, ["options", "placeholder"])
        ]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(list.value, (fn, idx) => {
            return openBlock(), createElementBlock("div", {
              key: `${fn.name}-${idx}`,
              class: normalizeClass(["fn-row", {
                "fn-row--unknown": unknownDef(fn.name),
                "fn-row--alias": unref(isAliasFunction)(fn.name)
              }]),
              "data-testid": `fn-${fn.name}`
            }, [
              createElementVNode("div", _hoisted_4$h, [
                createElementVNode("strong", {
                  title: fn.text || fn.name,
                  class: normalizeClass({ "fn-name--error": unknownDef(fn.name) })
                }, toDisplayString(fn.name), 11, _hoisted_5$c),
                unref(getFunctionDef)(fn.name) ? (openBlock(true), createElementBlock(
                  Fragment,
                  { key: 0 },
                  renderList(unref(getFunctionDef)(fn.name).params, (p, pidx) => {
                    return openBlock(), createElementBlock(
                      Fragment,
                      { key: pidx },
                      [
                        p.options?.length ? (openBlock(), createBlock(unref(GSelect), {
                          key: 0,
                          value: paramValue(fn, pidx),
                          options: p.options.map((o) => ({ label: String(o), value: String(o) })),
                          "test-id": `fn-${fn.name}-p${pidx}`,
                          "aria-label": `${fn.name} ${p.name}`,
                          "onUpdate:value": ($event) => setParam(idx, pidx, $event)
                        }, null, 8, ["value", "options", "test-id", "aria-label", "onUpdate:value"])) : (openBlock(), createBlock(unref(GInput), {
                          key: 1,
                          "model-value": paramValue(fn, pidx),
                          type: p.type === "string" ? "text" : "number",
                          "test-id": `fn-${fn.name}-p${pidx}`,
                          placeholder: p.name,
                          "onUpdate:modelValue": ($event) => setParam(idx, pidx, p.type === "string" ? String($event) : Number($event))
                        }, null, 8, ["model-value", "type", "test-id", "placeholder", "onUpdate:modelValue"]))
                      ],
                      64
                      /* STABLE_FRAGMENT */
                    );
                  }),
                  128
                  /* KEYED_FRAGMENT */
                )) : (openBlock(), createElementBlock(
                  Fragment,
                  { key: 1 },
                  [
                    (openBlock(true), createElementBlock(
                      Fragment,
                      null,
                      renderList(fn.params || [], (pv, pidx) => {
                        return openBlock(), createBlock(unref(GInput), {
                          key: `legacy-${pidx}`,
                          "model-value": String(pv),
                          "test-id": `fn-${fn.name}-p${pidx}`,
                          "onUpdate:modelValue": ($event) => setParam(idx, pidx, String($event))
                        }, null, 8, ["model-value", "test-id", "onUpdate:modelValue"]);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    )),
                    createElementVNode(
                      "span",
                      _hoisted_6$a,
                      toDisplayString(unref(zabbixT)("zabbix.query.functionUnknown")),
                      1
                      /* TEXT */
                    )
                  ],
                  64
                  /* STABLE_FRAGMENT */
                ))
              ]),
              createElementVNode("div", _hoisted_7$a, [
                createVNode(unref(_sfc_main$y$1), {
                  title: unref(zabbixT)("zabbix.query.functionMoveLeft")
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GButton), {
                      size: "sm",
                      variant: "text",
                      "test-id": `fn-up-${idx}`,
                      "aria-label": unref(zabbixT)("zabbix.query.functionMoveLeft"),
                      onClick: ($event) => move(idx, -1)
                    }, {
                      default: withCtx(() => [..._cache[0] || (_cache[0] = [
                        createTextVNode(
                          " ← ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["test-id", "aria-label", "onClick"])
                  ]),
                  _: 2
                  /* DYNAMIC */
                }, 1032, ["title"]),
                createVNode(unref(_sfc_main$y$1), {
                  title: unref(zabbixT)("zabbix.query.functionMoveRight")
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GButton), {
                      size: "sm",
                      variant: "text",
                      "test-id": `fn-down-${idx}`,
                      "aria-label": unref(zabbixT)("zabbix.query.functionMoveRight"),
                      onClick: ($event) => move(idx, 1)
                    }, {
                      default: withCtx(() => [..._cache[1] || (_cache[1] = [
                        createTextVNode(
                          " → ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["test-id", "aria-label", "onClick"])
                  ]),
                  _: 2
                  /* DYNAMIC */
                }, 1032, ["title"]),
                createVNode(unref(_sfc_main$y$1), {
                  title: unref(zabbixT)("zabbix.query.functionDelete")
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GButton), {
                      size: "sm",
                      variant: "destructive",
                      "test-id": `fn-del-${idx}`,
                      "aria-label": unref(zabbixT)("zabbix.query.functionDelete"),
                      onClick: ($event) => remove(idx)
                    }, {
                      default: withCtx(() => [..._cache[2] || (_cache[2] = [
                        createTextVNode(
                          " × ",
                          -1
                          /* CACHED */
                        )
                      ])]),
                      _: 1
                      /* STABLE */
                    }, 8, ["test-id", "aria-label", "onClick"])
                  ]),
                  _: 2
                  /* DYNAMIC */
                }, 1032, ["title"])
              ])
            ], 10, _hoisted_3$n);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const FunctionEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__scopeId", "data-v-bf2420a8"]]);
const _hoisted_1$x = {
  class: "host-tag-editor",
  "data-testid": "zabbix-host-tag-editor"
};
const _hoisted_2$q = { class: "toolbar" };
const _hoisted_3$m = ["data-testid"];
const _sfc_main$z = /* @__PURE__ */ defineComponent({
  __name: "HostTagQueryEditor",
  props: {
    tags: { default: () => [] },
    evaltype: { default: "0" },
    tagOptions: { default: () => [] },
    zabbixMajor: { default: 6 }
  },
  emits: ["change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const operators = computed(() => {
      const major = props.zabbixMajor ?? 6;
      return [
        { label: zabbixT("zabbix.query.operatorContains"), value: 0 },
        { label: zabbixT("zabbix.query.operatorEquals"), value: 1 },
        {
          label: zabbixT(
            major >= 7 ? "zabbix.query.operatorNotContains" : "zabbix.query.operatorNotLike"
          ),
          value: 2
        },
        { label: zabbixT("zabbix.query.operatorNotEquals"), value: 3 },
        { label: zabbixT("zabbix.query.operatorExists"), value: 4 },
        { label: zabbixT("zabbix.query.operatorNotExists"), value: 5 }
      ];
    });
    const evalOptions = computed(() => [
      { label: zabbixT("zabbix.query.andOr"), value: "0" },
      { label: zabbixT("zabbix.query.or"), value: "2" }
    ]);
    function addRow() {
      emit(
        "change",
        [...props.tags || [], { tag: "", value: "", operator: 0 }],
        props.evaltype || "0"
      );
    }
    function patchRow(i, partial) {
      const next = (props.tags || []).map((t2, j) => j === i ? { ...t2, ...partial } : t2);
      emit("change", next, props.evaltype || "0");
    }
    function removeRow(i) {
      emit(
        "change",
        (props.tags || []).filter((_, j) => j !== i),
        props.evaltype || "0"
      );
    }
    function setEvaltype(v) {
      const e = String(v) === "2" ? "2" : "0";
      emit("change", props.tags || [], e);
    }
    function needsValue(op) {
      return op !== 4 && op !== 5;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$x, [
        createElementVNode("div", _hoisted_2$q, [
          createVNode(unref(GButton), {
            size: "sm",
            variant: "secondary",
            "test-id": "zabbix-host-tag-add",
            "aria-label": unref(zabbixT)("zabbix.query.addHostTagAria"),
            onClick: addRow
          }, {
            default: withCtx(() => [
              createVNode(unref(GIcon), { name: "plus" }),
              createTextVNode(
                " " + toDisplayString(unref(zabbixT)("zabbix.query.addHostTag")),
                1
                /* TEXT */
              )
            ]),
            _: 1
            /* STABLE */
          }, 8, ["aria-label"]),
          (__props.tags || []).length > 1 ? (openBlock(), createBlock(unref(GSelect), {
            key: 0,
            value: __props.evaltype || "0",
            options: evalOptions.value,
            "test-id": "zabbix-host-tag-evaltype",
            "aria-label": unref(zabbixT)("zabbix.query.hostTagEvalAria"),
            "onUpdate:value": setEvaltype
          }, null, 8, ["value", "options", "aria-label"])) : createCommentVNode("v-if", true)
        ]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.tags || [], (t2, i) => {
            return openBlock(), createElementBlock("div", {
              key: i,
              class: "host-tag-row",
              "data-testid": `zabbix-host-tag-row-${i}`
            }, [
              createVNode(unref(GSelect), {
                value: t2.tag ? [t2.tag] : [],
                options: __props.tagOptions,
                "show-search": "",
                mode: "tags",
                placeholder: unref(zabbixT)("zabbix.query.tagPlaceholder"),
                "test-id": `zabbix-host-tag-name-${i}`,
                "onUpdate:value": (v) => {
                  const arr = Array.isArray(v) ? v.map(String) : [String(v ?? "")];
                  patchRow(i, { tag: arr[arr.length - 1] || "" });
                }
              }, null, 8, ["value", "options", "placeholder", "test-id", "onUpdate:value"]),
              createVNode(unref(GSelect), {
                value: t2.operator,
                options: operators.value,
                "test-id": `zabbix-host-tag-op-${i}`,
                "onUpdate:value": ($event) => patchRow(i, { operator: Number($event) })
              }, null, 8, ["value", "options", "test-id", "onUpdate:value"]),
              needsValue(Number(t2.operator)) ? (openBlock(), createBlock(unref(GInput), {
                key: 0,
                "model-value": t2.value,
                placeholder: unref(zabbixT)("zabbix.query.valuePlaceholder"),
                "test-id": `zabbix-host-tag-value-${i}`,
                "onUpdate:modelValue": ($event) => patchRow(i, { value: String($event) })
              }, null, 8, ["model-value", "placeholder", "test-id", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
              createVNode(unref(GButton), {
                size: "sm",
                variant: "text",
                "test-id": `zabbix-host-tag-remove-${i}`,
                "aria-label": unref(zabbixT)("zabbix.query.removeHostTagAria"),
                onClick: ($event) => removeRow(i)
              }, {
                default: withCtx(() => [..._cache[0] || (_cache[0] = [
                  createTextVNode(
                    " × ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["test-id", "aria-label", "onClick"])
            ], 8, _hoisted_3$m);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const HostTagQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__scopeId", "data-v-2d0599c1"]]);
const _hoisted_1$w = ["for"];
const _hoisted_2$p = { class: "inline-field__text" };
const _hoisted_3$l = {
  class: "inline-field__tip",
  "aria-hidden": "true"
};
const _hoisted_4$g = { class: "inline-field__control" };
const _sfc_main$y = /* @__PURE__ */ defineComponent({
  __name: "InlineField",
  props: {
    label: {},
    labelWidth: { default: 12 },
    tooltip: {},
    htmlFor: {},
    grow: { type: Boolean, default: false }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(["inline-field", { "inline-field--grow": __props.grow }]),
          "data-testid": "zabbix-inline-field"
        },
        [
          createElementVNode("label", {
            class: "inline-field__label",
            for: __props.htmlFor,
            style: normalizeStyle({ width: `${(__props.labelWidth ?? 12) * 8}px` })
          }, [
            createElementVNode(
              "span",
              _hoisted_2$p,
              toDisplayString(__props.label),
              1
              /* TEXT */
            ),
            __props.tooltip ? (openBlock(), createBlock(unref(_sfc_main$y$1), {
              key: 0,
              title: __props.tooltip
            }, {
              default: withCtx(() => [
                createElementVNode("span", _hoisted_3$l, [
                  createVNode(unref(GIcon), { name: "info-circle" })
                ])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["title"])) : createCommentVNode("v-if", true)
          ], 12, _hoisted_1$w),
          createElementVNode("div", _hoisted_4$g, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true)
          ])
        ],
        2
        /* CLASS */
      );
    };
  }
});
const InlineField = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__scopeId", "data-v-d8544181"]]);
const _hoisted_1$v = {
  class: "inline-field-row",
  "data-testid": "zabbix-inline-field-row"
};
const _hoisted_2$o = {
  key: 0,
  class: "inline-field-row__filler",
  "aria-hidden": "true"
};
const _sfc_main$x = /* @__PURE__ */ defineComponent({
  __name: "InlineFieldRow",
  props: {
    filler: { type: Boolean, default: true }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$v, [
        renderSlot(_ctx.$slots, "default", {}, void 0, true),
        __props.filler ? (openBlock(), createElementBlock("label", _hoisted_2$o)) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const InlineFieldRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__scopeId", "data-v-da3a72d8"]]);
const _hoisted_1$u = {
  class: "lld",
  "data-testid": "zabbix-lld-selector"
};
const _hoisted_2$n = {
  key: 0,
  class: "hint",
  "data-testid": "zabbix-lld-loading"
};
const _hoisted_3$k = {
  key: 1,
  class: "hint",
  "data-testid": "zabbix-lld-empty"
};
const _hoisted_4$f = {
  key: 2,
  class: "err",
  "data-testid": "zabbix-lld-error"
};
const _sfc_main$w = /* @__PURE__ */ defineComponent({
  __name: "LldSelector",
  props: {
    query: {},
    datasourceApi: {},
    hostids: {}
  },
  emits: ["update:query", "item-count-change"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const rulesMeta = useZabbixMetadata(async (signal) => {
      if (!props.datasourceApi || !props.hostids.length) return [];
      const res = await props.datasourceApi.getMetadata(
        { type: "discoveryRules", hostids: props.hostids },
        signal
      );
      if (res.type !== "discoveryRules") return [];
      return res.values;
    });
    const ruleId = computed(() => String(props.query.lld?.ruleId || props.query.lldRuleId || ""));
    const prototypesMeta = useZabbixMetadata(async (signal) => {
      const id = ruleId.value;
      if (!props.datasourceApi || !id) return [];
      const res = await props.datasourceApi.getMetadata(
        { type: "itemPrototypes", discoveryRuleId: id },
        signal
      );
      if (res.type !== "itemPrototypes") return [];
      return res.values;
    });
    const rulesError = computed(() => rulesMeta.error.value);
    const protosError = computed(() => prototypesMeta.error.value);
    const ruleOptions = computed(
      () => rulesMeta.options.value.map((o) => ({
        label: o.text || o.value,
        value: String(o.id || o.value)
      }))
    );
    const prototypeOptions = computed(
      () => prototypesMeta.options.value.map((o) => ({
        label: `${o.text || o.value}${o.id ? ` (${o.id})` : ""}`,
        // value encodes id|key for multi-select recovery
        value: `${o.id || ""}::${o.value || o.text || ""}`
      }))
    );
    const ruleValue = computed(() => ruleId.value);
    const prototypeValue = computed(() => {
      const ids = props.query.lld?.prototypeIds || [];
      const keys = props.query.lld?.prototypeKeys || props.query.lldItemKeys || [];
      if (ids.length) {
        return ids.map((id, i) => `${id}::${keys[i] || ""}`);
      }
      return keys.map((k) => `::${k}`);
    });
    function patch(partial) {
      emit("update:query", { ...props.query, ...partial });
    }
    function onRule(v) {
      const id = String(v || "");
      const opt = rulesMeta.options.value.find((o) => String(o.id || o.value) === id);
      const name = opt ? String(opt.text || opt.value) : void 0;
      patch({
        executionMode: id ? "lld" : "standard",
        lld: id ? { ruleId: id, ruleName: name, prototypeIds: [], prototypeKeys: [] } : void 0,
        // legacy mirrors
        lldRuleId: id || void 0,
        lldRuleName: name,
        lldItemKeys: []
      });
      emit("item-count-change", 0);
    }
    function onPrototypes(v) {
      const arr = Array.isArray(v) ? v.map(String) : v ? [String(v)] : [];
      const seen = /* @__PURE__ */ new Set();
      const prototypeIds = [];
      const prototypeKeys = [];
      for (const raw of arr) {
        if (seen.has(raw)) continue;
        seen.add(raw);
        const [id, ...rest] = raw.split("::");
        const key = rest.join("::");
        if (id) prototypeIds.push(id);
        if (key) prototypeKeys.push(key);
      }
      const rid = ruleId.value;
      patch({
        executionMode: "lld",
        lld: {
          ruleId: rid,
          ruleName: props.query.lld?.ruleName || props.query.lldRuleName,
          prototypeIds,
          prototypeKeys
        },
        lldRuleId: rid || void 0,
        lldItemKeys: prototypeKeys
      });
      emit("item-count-change", Math.max(prototypeIds.length, prototypeKeys.length));
    }
    watch(
      () => props.hostids.join(","),
      async () => {
        if (props.query.lld?.ruleId || props.query.lldRuleId || (props.query.lldItemKeys || []).length) {
          patch({
            executionMode: "standard",
            lld: void 0,
            lldRuleId: void 0,
            lldRuleName: void 0,
            lldItemKeys: []
          });
        }
        await rulesMeta.refresh();
        prototypesMeta.options.value = [];
      },
      { immediate: true }
    );
    watch(
      () => ruleId.value,
      async () => {
        await prototypesMeta.refresh();
      }
    );
    __expose({ onRule, onPrototypes });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$u, [
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(zabbixT)("zabbix.query.lldRule")),
          1
          /* TEXT */
        ),
        createVNode(unref(GSelect), {
          value: ruleValue.value || void 0,
          options: ruleOptions.value,
          "allow-clear": "",
          placeholder: unref(zabbixT)("zabbix.query.lldRulePlaceholder"),
          "test-id": "zabbix-lld-rule",
          "onUpdate:value": onRule
        }, null, 8, ["value", "options", "placeholder"]),
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(zabbixT)("zabbix.query.lldPrototype")),
          1
          /* TEXT */
        ),
        createVNode(unref(GSelect), {
          mode: "multiple",
          value: prototypeValue.value,
          options: prototypeOptions.value,
          "allow-clear": "",
          placeholder: unref(zabbixT)("zabbix.query.lldPrototypePlaceholder"),
          "test-id": "zabbix-lld-prototypes",
          "onUpdate:value": onPrototypes
        }, null, 8, ["value", "options", "placeholder"]),
        unref(rulesMeta).loading.value || unref(prototypesMeta).loading.value ? (openBlock(), createElementBlock(
          "p",
          _hoisted_2$n,
          toDisplayString(unref(zabbixT)("zabbix.common.loading")),
          1
          /* TEXT */
        )) : !unref(rulesMeta).loading.value && __props.hostids.length && !ruleOptions.value.length ? (openBlock(), createElementBlock(
          "p",
          _hoisted_3$k,
          toDisplayString(unref(zabbixT)("zabbix.query.lldEmpty")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        rulesError.value || protosError.value ? (openBlock(), createElementBlock("p", _hoisted_4$f, [
          createTextVNode(
            toDisplayString(rulesError.value || protosError.value) + " ",
            1
            /* TEXT */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "zabbix-lld-retry",
              onClick: _cache[0] || (_cache[0] = ($event) => {
                unref(rulesMeta).retry();
                unref(prototypesMeta).retry();
              })
            },
            toDisplayString(unref(zabbixT)("zabbix.common.retry")),
            1
            /* TEXT */
          )
        ])) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const LldSelector = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__scopeId", "data-v-280e4e49"]]);
const _hoisted_1$t = ["data-testid"];
const _hoisted_2$m = {
  key: 0,
  class: "lbl"
};
const _hoisted_3$j = {
  key: 1,
  class: "hint",
  role: "status"
};
const _hoisted_4$e = ["data-testid"];
const VIRTUAL_THRESHOLD = 200;
const _sfc_main$v = /* @__PURE__ */ defineComponent({
  __name: "MetricPicker",
  props: {
    value: { default: "" },
    options: { default: () => [] },
    loading: { type: Boolean, default: false },
    placeholder: { default: "" },
    variables: { default: () => [] },
    disabled: { type: Boolean, default: false },
    testId: { default: "zabbix-metric-picker" },
    label: { default: "" },
    single: { type: Boolean, default: true },
    width: { default: 340 }
  },
  emits: ["update:value", "search"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const resolvedPlaceholder = computed(
      () => props.placeholder || zabbixT("zabbix.query.metricPlaceholder")
    );
    const mergedOptions = computed(() => {
      const vars = (props.variables || []).map((v) => {
        const name = String(v).replace(/^\$/, "");
        return { label: `$${name}`, value: `$${name}` };
      });
      const seen = /* @__PURE__ */ new Set();
      const out = [];
      for (const o of [...vars, { label: "/.*/", value: "/.*/" }, ...props.options || []]) {
        const val = String(o.value ?? "");
        if (!val || seen.has(val)) continue;
        seen.add(val);
        out.push({ label: o.label || val, value: val });
      }
      return out;
    });
    const useVirtual = computed(() => (props.options?.length ?? 0) >= VIRTUAL_THRESHOLD);
    const selectValue = computed(() => {
      const v = String(props.value || "").trim();
      return v ? [v] : [];
    });
    const error = computed(() => {
      const v = String(props.value || "").trim();
      if (!v) return "";
      if (v === "*") return zabbixT("zabbix.error.regexAll");
      if (v.startsWith("/") && !/^\/.*\/[gmius]*$/.test(v)) return zabbixT("zabbix.error.regexEnd");
      return "";
    });
    function onChange(raw) {
      const arr = Array.isArray(raw) ? raw.map(String) : raw == null || raw === "" ? [] : [String(raw)];
      if (!arr.length) {
        emit("update:value", "");
        return;
      }
      const token = props.single ? arr[arr.length - 1] : arr.join(",");
      emit("update:value", token);
    }
    __expose({ error, mergedOptions, onChange, useVirtual });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["metric-picker", { "has-error": !!error.value }]),
        "data-testid": __props.testId
      }, [
        __props.label ? (openBlock(), createElementBlock(
          "label",
          _hoisted_2$m,
          toDisplayString(__props.label),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createVNode(unref(GSelect), {
          mode: "tags",
          value: selectValue.value,
          options: mergedOptions.value,
          disabled: __props.disabled,
          placeholder: resolvedPlaceholder.value,
          "allow-clear": "",
          width: __props.width,
          "test-id": `${__props.testId}-select`,
          "aria-label": __props.label || resolvedPlaceholder.value,
          "onUpdate:value": onChange
        }, null, 8, ["value", "options", "disabled", "placeholder", "width", "test-id", "aria-label"]),
        __props.loading ? (openBlock(), createElementBlock(
          "p",
          _hoisted_3$j,
          toDisplayString(unref(zabbixT)("zabbix.common.loading")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        error.value ? (openBlock(), createElementBlock("p", {
          key: 2,
          class: "picker-error",
          role: "status",
          "data-testid": `${__props.testId}-error`
        }, toDisplayString(error.value), 9, _hoisted_4$e)) : createCommentVNode("v-if", true)
      ], 10, _hoisted_1$t);
    };
  }
});
const MetricPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__scopeId", "data-v-090c76d8"]]);
const _hoisted_1$s = {
  class: "fields",
  "data-testid": "zabbix-fields-metrics"
};
const _sfc_main$u = /* @__PURE__ */ defineComponent({
  __name: "MetricsQueryEditor",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {},
    variables: {},
    zabbixMajor: {},
    supportsApplications: { type: Boolean }
  },
  emits: ["update:query", "item-count-change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const api = computed(
      () => resolveZabbixMetadataApi(props.datasourceUid, props.datasourceApi || null)
    );
    const useApplications = computed(() => props.supportsApplications !== false);
    const hostTagOptions = ref([]);
    const itemTagOptions = ref([]);
    const groupRevision = ref(0);
    function schedulerForUid() {
      return getZabbixMetadataScheduler(String(props.datasourceUid || "default"));
    }
    function hasGroupScope() {
      return (props.query.group?.ids?.length ?? 0) > 0 || Boolean(String(props.query.group?.filter || "").trim());
    }
    const groups = useZabbixMetadata(
      async (signal) => {
        if (!api.value) return [];
        const res = await api.value.getMetadata({ type: "groups", filter: "" }, signal);
        return res.type === "groups" ? res.values : [];
      },
      {
        scheduler: schedulerForUid,
        owner: "group",
        canLoad: () => Boolean(api.value),
        parents: () => ({}),
        requestKey: () => "groups"
      }
    );
    const hosts = useZabbixMetadata(
      async (signal) => {
        if (!api.value) return [];
        const groupids = props.query.group?.ids || [];
        const res = await api.value.getMetadata(
          {
            type: "hosts",
            groupids,
            filter: "",
            hostTags: props.query.hostTags || []
          },
          signal
        );
        return res.type === "hosts" ? res.values : [];
      },
      {
        scheduler: schedulerForUid,
        owner: "host",
        // Freeform / variable group filters (/.*/, $Group) must arm host.get without group ids.
        // Require api so a null-api empty success does not permanently skip host.get.
        canLoad: () => Boolean(api.value) && hasGroupScope(),
        parents: () => ({
          groupIds: props.query.group?.ids || [],
          scope: (props.query.group?.ids?.length ?? 0) > 0 ? "scoped" : hasGroupScope() ? "all" : "scoped"
        }),
        requestKey: () => `hosts:${(props.query.group?.ids || []).join(",")}|${props.query.group?.filter || ""}`,
        // Slow host.get + suite load: allow more abort retries than the default 5.
        maxStaleRetries: 20
      }
    );
    const applications = useZabbixMetadata(
      async (signal) => {
        if (!api.value || !useApplications.value) return [];
        const hostids2 = props.query.host?.ids || [];
        const res = await api.value.getMetadata({ type: "applications", hostids: hostids2, filter: "" }, signal);
        return res.type === "applications" ? res.values : [];
      },
      {
        scheduler: schedulerForUid,
        owner: "application",
        canLoad: () => (props.query.host?.ids?.length ?? 0) > 0,
        parents: () => ({ hostIds: props.query.host?.ids || [] }),
        requestKey: () => `apps:${(props.query.host?.ids || []).join(",")}`
      }
    );
    const items = useZabbixMetadata(
      async (signal) => {
        if (!api.value) return [];
        const hostids2 = props.query.host?.ids || [];
        const applicationids = props.query.application?.ids || [];
        const res = await api.value.getMetadata(
          {
            type: "items",
            hostids: hostids2,
            applicationids,
            filter: "",
            itemTag: props.query.itemTag?.filter || "",
            showDisabled: Boolean(props.query.options?.showDisabledItems)
          },
          signal
        );
        if (res.type === "items") {
          emit("item-count-change", res.values.length);
          const tags = /* @__PURE__ */ new Map();
          for (const it of res.values) {
            const rawTags = it.tags;
            if (Array.isArray(rawTags)) {
              for (const t2 of rawTags) {
                const key = `${t2.tag}: ${t2.value}`;
                tags.set(key, key);
              }
            }
          }
          if (tags.size)
            itemTagOptions.value = [...tags.values()].map((v) => ({
              label: v,
              value: v
            }));
          return res.values;
        }
        return [];
      },
      {
        scheduler: schedulerForUid,
        owner: "item",
        canLoad: () => (props.query.host?.ids?.length ?? 0) > 0,
        parents: () => ({
          hostIds: props.query.host?.ids || [],
          applicationIds: props.query.application?.ids || []
        }),
        requestKey: () => `items:${(props.query.host?.ids || []).join(",")}|${props.query.itemTag?.filter || ""}`
      }
    );
    watch(
      () => [
        props.query.group?.filter,
        props.query.group?.ids?.join(","),
        // hostTags signature without full JSON.stringify of query
        (props.query.hostTags || []).map((t2) => `${t2.tag ?? t2.key ?? ""}=${t2.value ?? ""}`).join("|")
      ],
      () => {
        const sched = schedulerForUid();
        groupRevision.value = sched.invalidateFrom("group", groupRevision.value + 1);
        groups.refresh({ revision: groupRevision.value });
        hosts.refresh({
          revision: groupRevision.value,
          priority: "interactive"
        });
      }
    );
    function kickMetadata(priority = "refresh") {
      if (!api.value) return;
      const sched = schedulerForUid();
      groupRevision.value = sched.invalidateFrom("group", groupRevision.value + 1);
      groups.refresh({ revision: groupRevision.value, priority });
      hosts.refresh({
        revision: groupRevision.value,
        priority: hasGroupScope() ? "interactive" : priority
      });
    }
    function kickHostsOnly(priority = "interactive") {
      if (!api.value) return;
      if (!hasGroupScope()) return;
      hosts.refresh({ priority });
    }
    onMounted(() => {
      nextTick(() => {
        requestAnimationFrame(() => {
          requestAnimationFrame(() => {
            const ric = globalThis.requestIdleCallback;
            if (typeof ric === "function") ric(() => kickMetadata("refresh"), { timeout: 400 });
            else setTimeout(() => kickMetadata("refresh"), 0);
            const rearm = () => kickHostsOnly("interactive");
            setTimeout(rearm, 400);
            setTimeout(rearm, 900);
            setTimeout(rearm, 1800);
            setTimeout(rearm, 3200);
          });
        });
      });
    });
    watch(
      () => [props.datasourceUid, props.datasourceApi, Boolean(api.value)],
      ([, , ready], prev) => {
        const wasReady = Boolean(prev?.[2]);
        if (!ready || wasReady) return;
        kickMetadata("interactive");
      }
    );
    watch(
      () => hasGroupScope(),
      (ok2) => {
        if (ok2) kickHostsOnly("interactive");
      },
      { immediate: true }
    );
    watch(
      () => [props.query.host?.filter, props.query.host?.ids?.join(",")],
      () => {
        const rev = schedulerForUid().invalidateFrom("host");
        hosts.refresh({ revision: rev });
        applications.refresh({ revision: rev });
        items.refresh({ revision: rev });
      }
    );
    watch(
      () => [
        props.query.application?.filter,
        props.query.itemTag?.filter,
        props.query.options?.showDisabledItems
      ],
      () => items.refresh({ priority: "refresh" })
    );
    const hostids = computed(() => props.query.host?.ids || []);
    const functions = computed({
      get: () => props.query.functions || [],
      set: (v) => emit("update:query", { ...props.query, functions: v })
    });
    function toOptions(list) {
      return (list || []).map((o) => ({
        label: o.text || o.value,
        value: String(o.value ?? o.text ?? "")
      }));
    }
    const groupPickerOptions = computed(() => toOptions(groups.options.value));
    const hostPickerOptions = computed(() => toOptions(hosts.options.value));
    const applicationPickerOptions = computed(() => toOptions(applications.options.value));
    const itemPickerOptions = computed(() => toOptions(items.options.value));
    function findOption(list, token) {
      return list.find(
        (o) => String(o.value) === token || String(o.text) === token || String(o.id) === token
      );
    }
    function filterFromToken(list, token) {
      const t2 = String(token || "").trim();
      if (!t2) return { filter: "" };
      if (t2.startsWith("/") || t2.startsWith("$") || t2 === "/.*/") return freeformToFilter(t2);
      const opt = findOption(list, t2);
      if (opt) {
        const next = optionToFilter(opt);
        return next.ids?.length ? next : { filter: next.filter, name: next.name };
      }
      return freeformToFilter(t2);
    }
    function filterDisplay(f) {
      if (!f) return "";
      if (f.filter) return f.filter;
      if (f.name) return f.name;
      if (f.ids?.length) return f.ids[0];
      return "";
    }
    function patchFilter(key, token) {
      const list = key === "group" ? groups.options.value : key === "host" ? hosts.options.value : key === "application" ? applications.options.value : key === "item" ? items.options.value : [];
      const value = key === "itemTag" ? freeformToFilter(token) : filterFromToken(list, token);
      emit("update:query", { ...props.query, [key]: value });
    }
    function onHostTags(tags, evaltype) {
      emit("update:query", { ...props.query, hostTags: tags, evaltype });
    }
    function onUpdate(q) {
      emit("update:query", q);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$s, [
        _cache[7] || (_cache[7] = createStaticVNode('<span hidden data-testid="zabbix-functions" data-v-fefb9864></span><span hidden data-testid="zabbix-cascade-filters" data-v-fefb9864></span><span hidden data-testid="zabbix-group" data-v-fefb9864></span><span hidden data-testid="zabbix-host" data-v-fefb9864></span><span hidden data-testid="zabbix-application" data-v-fefb9864></span><span hidden data-testid="zabbix-itemTag" data-v-fefb9864></span><span hidden data-testid="zabbix-item" data-v-fefb9864></span>', 7)),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.group"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterDisplay(__props.query.group),
                  options: groupPickerOptions.value,
                  loading: unref(groups).loading.value,
                  variables: __props.variables,
                  "test-id": "zabbix-group",
                  placeholder: unref(zabbixT)("zabbix.common.group"),
                  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchFilter("group", $event))
                }, null, 8, ["value", "options", "loading", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.hostTag"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(HostTagQueryEditor, {
                  tags: __props.query.hostTags || [],
                  evaltype: __props.query.evaltype || "0",
                  "tag-options": hostTagOptions.value,
                  "zabbix-major": __props.zabbixMajor ?? 6,
                  onChange: onHostTags
                }, null, 8, ["tags", "evaltype", "tag-options", "zabbix-major"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.host"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterDisplay(__props.query.host),
                  options: hostPickerOptions.value,
                  loading: unref(hosts).loading.value,
                  variables: __props.variables,
                  "test-id": "zabbix-host",
                  placeholder: unref(zabbixT)("zabbix.common.host"),
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchFilter("host", $event))
                }, null, 8, ["value", "options", "loading", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            useApplications.value ? (openBlock(), createBlock(InlineField, {
              key: 0,
              label: unref(zabbixT)("zabbix.common.application"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterDisplay(__props.query.application),
                  options: applicationPickerOptions.value,
                  loading: unref(applications).loading.value,
                  variables: __props.variables,
                  "test-id": "zabbix-application",
                  placeholder: unref(zabbixT)("zabbix.common.application"),
                  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patchFilter("application", $event))
                }, null, 8, ["value", "options", "loading", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])) : (openBlock(), createBlock(InlineField, {
              key: 1,
              label: unref(zabbixT)("zabbix.common.itemTag"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterDisplay(__props.query.itemTag),
                  options: itemTagOptions.value,
                  variables: __props.variables,
                  "test-id": "zabbix-itemTag",
                  placeholder: `${unref(zabbixT)("zabbix.query.tagPlaceholder")}: ${unref(zabbixT)("zabbix.query.valuePlaceholder")}`,
                  "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patchFilter("itemTag", $event))
                }, null, 8, ["value", "options", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.item"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterDisplay(__props.query.item),
                  options: itemPickerOptions.value,
                  loading: unref(items).loading.value,
                  variables: __props.variables,
                  "test-id": "zabbix-item",
                  placeholder: unref(zabbixT)("zabbix.common.item"),
                  "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patchFilter("item", $event))
                }, null, 8, ["value", "options", "loading", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(LldSelector, {
          query: __props.query,
          "datasource-api": __props.datasourceApi || null,
          hostids: hostids.value,
          "onUpdate:query": onUpdate,
          onItemCountChange: _cache[5] || (_cache[5] = ($event) => emit("item-count-change", $event))
        }, null, 8, ["query", "datasource-api", "hostids"]),
        createVNode(InlineFieldRow, { filler: false }, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.functions"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(FunctionEditor, {
                  modelValue: functions.value,
                  "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => functions.value = $event)
                }, null, 8, ["modelValue"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const MetricsQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__scopeId", "data-v-fefb9864"]]);
const _hoisted_1$r = ["data-testid"];
const _hoisted_2$l = {
  key: 0,
  class: "lbl"
};
const _hoisted_3$i = {
  key: 1,
  class: "hint",
  role: "status"
};
const _sfc_main$t = /* @__PURE__ */ defineComponent({
  __name: "FilterPicker",
  props: {
    modelValue: { default: () => ({ filter: "" }) },
    options: { default: () => [] },
    loading: { type: Boolean, default: false },
    label: { default: "" },
    testId: { default: "zabbix-filter" },
    disabled: { type: Boolean, default: false },
    placeholder: { default: "" }
  },
  emits: ["update:modelValue", "search"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const resolvedPlaceholder = computed(
      () => props.placeholder || zabbixT("zabbix.query.filterPlaceholder")
    );
    const selectOptions = computed(
      () => (props.options || []).map((o) => ({
        label: o.text || o.value,
        value: String(o.value ?? o.text ?? "")
      }))
    );
    const selectValue = computed(() => {
      const f = String(props.modelValue?.filter || "").trim();
      return f ? [f] : [];
    });
    function findOption(token) {
      return (props.options || []).find(
        (o) => String(o.value) === token || String(o.text) === token || String(o.id) === token
      );
    }
    function onChange(raw) {
      const arr = Array.isArray(raw) ? raw.map(String) : raw == null || raw === "" ? [] : [String(raw)];
      if (!arr.length) {
        emit("update:modelValue", { filter: "" });
        return;
      }
      const token = arr[arr.length - 1];
      if (isFreeformFilter(token)) {
        emit("update:modelValue", freeformToFilter(token));
        return;
      }
      const opt = findOption(token);
      if (opt) {
        const next = optionToFilter(opt);
        emit("update:modelValue", next.ids.length ? next : { filter: next.filter, name: next.name });
        return;
      }
      emit("update:modelValue", freeformToFilter(token));
    }
    __expose({ onChange });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "filter-picker",
        "data-testid": __props.testId
      }, [
        __props.label ? (openBlock(), createElementBlock(
          "label",
          _hoisted_2$l,
          toDisplayString(__props.label),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createVNode(unref(GSelect), {
          mode: "tags",
          value: selectValue.value,
          options: selectOptions.value,
          disabled: __props.disabled,
          placeholder: resolvedPlaceholder.value,
          "allow-clear": "",
          "test-id": `${__props.testId}-select`,
          "aria-label": __props.label || resolvedPlaceholder.value,
          "onUpdate:value": onChange
        }, null, 8, ["value", "options", "disabled", "placeholder", "test-id", "aria-label"]),
        __props.loading ? (openBlock(), createElementBlock(
          "p",
          _hoisted_3$i,
          toDisplayString(unref(zabbixT)("zabbix.common.loading")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$r);
    };
  }
});
const FilterPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__scopeId", "data-v-55c4ba80"]]);
const _hoisted_1$q = {
  class: "cascade",
  "data-testid": "zabbix-cascade-filters"
};
const _sfc_main$s = /* @__PURE__ */ defineComponent({
  __name: "CascadeFilters",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {},
    fields: {}
  },
  emits: ["update:query", "item-count-change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const api = computed(
      () => resolveZabbixMetadataApi(props.datasourceUid, props.datasourceApi || null)
    );
    function patchFilter(key, value) {
      emit("update:query", { ...props.query, [key]: value });
    }
    const groups = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const res = await api.value.getMetadata({ type: "groups", filter: "" }, signal);
      return res.type === "groups" ? res.values : [];
    });
    const hosts = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const groupids = props.query.group?.ids || [];
      if (!groupids.length && !String(props.query.group?.filter || "").trim()) {
        return [];
      }
      const res = await api.value.getMetadata(
        {
          type: "hosts",
          groupids,
          filter: "",
          hostTags: props.query.hostTags || []
        },
        signal
      );
      return res.type === "hosts" ? res.values : [];
    });
    const applications = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const hostids = props.query.host?.ids || [];
      const res = await api.value.getMetadata({ type: "applications", hostids, filter: "" }, signal);
      return res.type === "applications" ? res.values : [];
    });
    const items = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const hostids = props.query.host?.ids || [];
      const applicationids = props.query.application?.ids || [];
      if (!hostids.length) return [];
      const res = await api.value.getMetadata(
        {
          type: "items",
          hostids,
          applicationids,
          filter: "",
          itemTag: props.query.itemTag?.filter || "",
          showDisabled: Boolean(props.query.options?.showDisabledItems)
        },
        signal
      );
      if (res.type === "items") {
        emit("item-count-change", res.values.length);
        return res.values;
      }
      return [];
    });
    const triggers = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const hostids = props.query.host?.ids || [];
      const res = await api.value.getMetadata({ type: "triggers", hostids, filter: "" }, signal);
      return res.type === "triggers" ? res.values : [];
    });
    const proxies = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const res = await api.value.getMetadata({ type: "proxies", filter: "" }, signal);
      return res.type === "proxies" ? res.values : [];
    });
    const macros = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const hostids = props.query.host?.ids || [];
      const res = await api.value.getMetadata({ type: "macros", hostids, filter: "" }, signal);
      return res.type === "macros" ? res.values : [];
    });
    const labels = computed(() => ({
      group: zabbixT("zabbix.common.group"),
      host: zabbixT("zabbix.common.host"),
      application: zabbixT("zabbix.common.application"),
      itemTag: zabbixT("zabbix.common.itemTag"),
      item: zabbixT("zabbix.common.item"),
      proxy: zabbixT("zabbix.common.proxy"),
      trigger: zabbixT("zabbix.common.trigger"),
      tags: zabbixT("zabbix.common.tags"),
      macro: zabbixT("zabbix.common.macro")
    }));
    watch(
      () => [props.query.group?.filter, props.query.group?.ids?.join(",")],
      () => {
        groups.refresh();
        hosts.refresh();
      }
    );
    onMounted(() => {
      nextTick(() => {
        groups.refresh();
        hosts.refresh();
      });
    });
    watch(
      () => [props.query.host?.filter, props.query.host?.ids?.join(",")],
      () => {
        hosts.refresh();
        applications.refresh();
        items.refresh();
        triggers.refresh();
        macros.refresh();
      }
    );
    watch(
      () => [props.query.application?.filter, props.query.itemTag?.filter],
      () => items.refresh()
    );
    function optsFor(field) {
      switch (field) {
        case "group":
          return groups.options.value;
        case "host":
          return hosts.options.value;
        case "application":
          return applications.options.value;
        case "item":
          return items.options.value;
        case "trigger":
          return triggers.options.value;
        case "proxy":
          return proxies.options.value;
        case "macro":
          return macros.options.value;
        default:
          return [];
      }
    }
    function loadingFor(field) {
      switch (field) {
        case "group":
          return groups.loading.value;
        case "host":
          return hosts.loading.value;
        case "application":
          return applications.loading.value;
        case "item":
          return items.loading.value;
        case "trigger":
          return triggers.loading.value;
        case "proxy":
          return proxies.loading.value;
        case "macro":
          return macros.loading.value;
        default:
          return false;
      }
    }
    function valueFor(field) {
      const q = props.query;
      return q[field] || { filter: "" };
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$q, [
        createCommentVNode(" static registry for field-matrix extraction "),
        _cache[0] || (_cache[0] = createStaticVNode('<span hidden data-testid="zabbix-group" data-v-643407e9></span><span hidden data-testid="zabbix-host" data-v-643407e9></span><span hidden data-testid="zabbix-application" data-v-643407e9></span><span hidden data-testid="zabbix-itemTag" data-v-643407e9></span><span hidden data-testid="zabbix-item" data-v-643407e9></span><span hidden data-testid="zabbix-proxy" data-v-643407e9></span><span hidden data-testid="zabbix-trigger" data-v-643407e9></span><span hidden data-testid="zabbix-tags" data-v-643407e9></span><span hidden data-testid="zabbix-macro" data-v-643407e9></span>', 9)),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.fields, (field) => {
            return openBlock(), createBlock(FilterPicker, {
              key: field,
              "model-value": valueFor(field),
              options: optsFor(field),
              loading: loadingFor(field),
              label: labels.value[field],
              "test-id": `zabbix-${field}`,
              "onUpdate:modelValue": ($event) => patchFilter(field, $event)
            }, null, 8, ["model-value", "options", "loading", "label", "test-id", "onUpdate:modelValue"]);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const CascadeFilters = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__scopeId", "data-v-643407e9"]]);
const _hoisted_1$p = {
  class: "fields",
  "data-testid": "zabbix-fields-text"
};
const _hoisted_2$k = { class: "row" };
const _sfc_main$r = /* @__PURE__ */ defineComponent({
  __name: "TextQueryEditor",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {}
  },
  emits: ["update:query"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    function patch(partial) {
      emit("update:query", { ...props.query, ...partial });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$p, [
        createVNode(CascadeFilters, {
          query: __props.query,
          "datasource-uid": __props.datasourceUid,
          "datasource-api": __props.datasourceApi,
          fields: ["group", "host", "application", "item"],
          "onUpdate:query": _cache[0] || (_cache[0] = ($event) => emit("update:query", $event))
        }, null, 8, ["query", "datasource-uid", "datasource-api"]),
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(zabbixT)("zabbix.query.textFilter")),
          1
          /* TEXT */
        ),
        createVNode(unref(GInput), {
          "model-value": __props.query.textFilter,
          "test-id": "zabbix-text-filter",
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => patch({ textFilter: String($event) }))
        }, null, 8, ["model-value"]),
        createElementVNode("label", _hoisted_2$k, [
          createVNode(unref(GSwitch), {
            checked: __props.query.useCaptureGroups,
            "test-id": "zabbix-use-capture-groups",
            "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => patch({ useCaptureGroups: $event }))
          }, null, 8, ["checked"]),
          createTextVNode(
            " " + toDisplayString(unref(zabbixT)("zabbix.query.useCaptureGroups")),
            1
            /* TEXT */
          )
        ])
      ]);
    };
  }
});
const TextQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__scopeId", "data-v-7c15c701"]]);
const _hoisted_1$o = {
  class: "fields",
  "data-testid": "zabbix-fields-itemid"
};
const _sfc_main$q = /* @__PURE__ */ defineComponent({
  __name: "ItemIdQueryEditor",
  props: {
    query: {}
  },
  emits: ["update:query"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$o, [
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(zabbixT)("zabbix.query.itemIds")),
          1
          /* TEXT */
        ),
        createVNode(unref(GInput), {
          "model-value": __props.query.itemids,
          "test-id": "zabbix-itemids",
          placeholder: "10001,10002",
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:query", { ...__props.query, itemids: String($event) }))
        }, null, 8, ["model-value"])
      ]);
    };
  }
});
const ItemIdQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["__scopeId", "data-v-0c6c7ceb"]]);
const _hoisted_1$n = {
  class: "fields",
  "data-testid": "zabbix-fields-problems"
};
const _sfc_main$p = /* @__PURE__ */ defineComponent({
  __name: "ProblemsQueryEditor",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {},
    variables: {}
  },
  emits: ["update:query"],
  setup(__props, { emit: __emit }) {
    const severitiesOptions = computed(() => [
      { label: zabbixT("zabbix.common.notClassified"), value: 0 },
      { label: zabbixT("zabbix.common.information"), value: 1 },
      { label: zabbixT("zabbix.common.warning"), value: 2 },
      { label: zabbixT("zabbix.common.average"), value: 3 },
      { label: zabbixT("zabbix.common.high"), value: 4 },
      { label: zabbixT("zabbix.common.disaster"), value: 5 }
    ]);
    const props = __props;
    const emit = __emit;
    function patch(partial) {
      emit("update:query", { ...props.query, ...partial });
    }
    const severities = computed(() => props.query.options?.severities ?? []);
    function setSeverities(raw) {
      const arr = Array.isArray(raw) ? raw.map(Number).filter((n) => Number.isFinite(n)) : [];
      patch({ options: { ...props.query.options, severities: arr } });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$n, [
        createVNode(CascadeFilters, {
          query: __props.query,
          "datasource-uid": __props.datasourceUid,
          "datasource-api": __props.datasourceApi,
          fields: ["group", "host", "application", "proxy", "trigger", "tags"],
          "onUpdate:query": _cache[0] || (_cache[0] = ($event) => emit("update:query", $event))
        }, null, 8, ["query", "datasource-uid", "datasource-api"]),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.query.hostTags"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(HostTagQueryEditor, {
                  tags: __props.query.hostTags || [],
                  evaltype: __props.query.evaltype || "0",
                  onChange: _cache[1] || (_cache[1] = (tags, evaltype) => patch({ hostTags: tags, evaltype }))
                }, null, 8, ["tags", "evaltype"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.severity"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  mode: "multiple",
                  value: severities.value,
                  options: severitiesOptions.value,
                  "test-id": "zabbix-problem-severities",
                  placeholder: unref(zabbixT)("zabbix.query.allSeverity"),
                  "onUpdate:value": setSeverities
                }, null, 8, ["value", "options", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.query.tagsEval"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: __props.query.evaltype || "0",
                  options: [
                    { label: unref(zabbixT)("zabbix.query.andOr"), value: "0" },
                    { label: unref(zabbixT)("zabbix.query.or"), value: "2" }
                  ],
                  "test-id": "zabbix-problem-evaltype",
                  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ evaltype: String($event) === "2" ? "2" : "0" }))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.problem"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  "model-value": String(__props.query.trigger?.filter || ""),
                  "test-id": "zabbix-problem-text",
                  placeholder: unref(zabbixT)("zabbix.query.problemNameFilter"),
                  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => patch({
                    trigger: {
                      ...__props.query.trigger || { filter: "" },
                      filter: String($event)
                    }
                  }))
                }, null, 8, ["model-value", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.query.show"),
              "label-width": 10
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: __props.query.showProblems || "problems",
                  options: [
                    { label: unref(zabbixT)("zabbix.common.problems"), value: "problems" },
                    { label: unref(zabbixT)("zabbix.query.recentProblems"), value: "recent" },
                    { label: unref(zabbixT)("zabbix.query.history"), value: "history" }
                  ],
                  "test-id": "zabbix-show-problems",
                  "onUpdate:value": _cache[4] || (_cache[4] = ($event) => patch({ showProblems: $event }))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ProblemsQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__scopeId", "data-v-5a57fbbd"]]);
const _hoisted_1$m = {
  class: "fields",
  "data-testid": "zabbix-fields-triggers"
};
const _hoisted_2$j = { class: "row" };
const _sfc_main$o = /* @__PURE__ */ defineComponent({
  __name: "TriggersQueryEditor",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {}
  },
  emits: ["update:query"],
  setup(__props, { emit: __emit }) {
    const severityLabels = computed(() => [
      { label: zabbixT("zabbix.common.notClassified"), value: 0 },
      { label: zabbixT("zabbix.common.information"), value: 1 },
      { label: zabbixT("zabbix.common.warning"), value: 2 },
      { label: zabbixT("zabbix.common.average"), value: 3 },
      { label: zabbixT("zabbix.common.high"), value: 4 },
      { label: zabbixT("zabbix.common.disaster"), value: 5 }
    ]);
    const props = __props;
    const emit = __emit;
    const countBy = computed(() => props.query.countTriggersBy || "");
    function patch(partial) {
      emit("update:query", { ...props.query, ...partial });
    }
    const cascadeFields = computed(() => {
      if (countBy.value === "problems")
        return ["group", "host", "application", "proxy", "tags"];
      if (countBy.value === "items")
        return ["group", "host", "application", "itemTag", "item", "tags"];
      return ["group", "host", "application", "itemTag", "item", "trigger", "tags"];
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$m, [
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.query.countBy"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: countBy.value,
                  options: [
                    { label: unref(zabbixT)("zabbix.query.allTriggers"), value: "" },
                    { label: unref(zabbixT)("zabbix.common.problems"), value: "problems" },
                    { label: unref(zabbixT)("zabbix.query.items"), value: "items" }
                  ],
                  "test-id": "zabbix-count-by",
                  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ countTriggersBy: $event || "" }))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.minSeverity"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: __props.query.options?.minSeverity ?? 0,
                  options: severityLabels.value,
                  "test-id": "zabbix-opt-min-severity",
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({
                    options: { ...__props.query.options, minSeverity: Number($event) }
                  }))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(CascadeFilters, {
          query: __props.query,
          "datasource-uid": __props.datasourceUid,
          "datasource-api": __props.datasourceApi,
          fields: [...cascadeFields.value],
          "onUpdate:query": _cache[2] || (_cache[2] = ($event) => emit("update:query", $event))
        }, null, 8, ["query", "datasource-uid", "datasource-api", "fields"]),
        countBy.value === "problems" ? (openBlock(), createBlock(InlineFieldRow, { key: 0 }, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.problem"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  "model-value": String(__props.query.trigger?.filter || ""),
                  "test-id": "zabbix-trigger-problem",
                  placeholder: unref(zabbixT)("zabbix.query.problemFilter"),
                  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => patch({
                    trigger: {
                      ...__props.query.trigger || { filter: "" },
                      filter: String($event)
                    }
                  }))
                }, null, 8, ["model-value", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        })) : createCommentVNode("v-if", true),
        createElementVNode("label", _hoisted_2$j, [
          createVNode(unref(GSwitch), {
            checked: Boolean(__props.query.options?.count),
            "test-id": "zabbix-count-triggers",
            "onUpdate:checked": _cache[4] || (_cache[4] = ($event) => patch({ options: { ...__props.query.options, count: $event } }))
          }, null, 8, ["checked"]),
          createTextVNode(
            " " + toDisplayString(unref(zabbixT)("zabbix.query.onlyCount")),
            1
            /* TEXT */
          )
        ])
      ]);
    };
  }
});
const TriggersQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__scopeId", "data-v-baf2245d"]]);
const _hoisted_1$l = {
  class: "fields",
  "data-testid": "zabbix-fields-services"
};
const _sfc_main$n = /* @__PURE__ */ defineComponent({
  __name: "ServicesQueryEditor",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {},
    variables: {},
    supportsSla: { type: Boolean }
  },
  emits: ["update:query"],
  setup(__props, { emit: __emit }) {
    const slaPropertyOptions = computed(() => [
      { label: zabbixT("zabbix.services.slaStatus"), value: "status" },
      { label: zabbixT("zabbix.services.sli"), value: "sli" },
      { label: zabbixT("zabbix.services.uptime"), value: "uptime" },
      { label: zabbixT("zabbix.services.downtime"), value: "downtime" },
      { label: zabbixT("zabbix.services.errorBudget"), value: "error_budget" }
    ]);
    const slaIntervalOptions = computed(() => [
      { label: zabbixT("zabbix.services.noInterval"), value: "none" },
      { label: zabbixT("zabbix.services.auto"), value: "auto" },
      { label: zabbixT("zabbix.services.oneHour"), value: "1h" },
      { label: zabbixT("zabbix.services.twelveHours"), value: "12h" },
      { label: zabbixT("zabbix.services.oneDay"), value: "1d" },
      { label: zabbixT("zabbix.services.oneWeek"), value: "1w" },
      { label: zabbixT("zabbix.services.oneMonth"), value: "1M" }
    ]);
    const props = __props;
    const emit = __emit;
    const api = computed(
      () => resolveZabbixMetadataApi(props.datasourceUid, props.datasourceApi || null)
    );
    const services = useZabbixMetadata(async (signal) => {
      if (!api.value) return [];
      const res = await api.value.getMetadata(
        { type: "services", filter: props.query.itServiceFilter || "" },
        signal
      );
      return res.type === "services" ? res.values : [];
    });
    const slas = useZabbixMetadata(async (signal) => {
      if (!api.value || props.supportsSla === false) return [];
      const serviceids = services.options.value.map((s) => String(s.id || s.value)).filter(Boolean);
      const res = await api.value.getMetadata(
        { type: "slas", serviceids, filter: props.query.slaFilter || "" },
        signal
      );
      return res.type === "slas" ? res.values : [];
    });
    watch(
      () => props.query.itServiceFilter,
      () => services.refresh()
    );
    onMounted(() => {
      nextTick(() => services.refresh());
    });
    watch(
      () => [props.query.slaFilter, services.options.value.length],
      () => slas.refresh()
    );
    function patch(partial) {
      emit("update:query", { ...props.query, ...partial });
    }
    function serviceOptions() {
      return services.options.value.map((s) => ({
        label: s.text || s.value,
        value: String(s.value ?? s.text ?? "")
      }));
    }
    function slaOptions() {
      return slas.options.value.map((s) => ({
        label: s.text || s.value,
        value: String(s.value ?? s.text ?? "")
      }));
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$l, [
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.service"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: __props.query.itServiceFilter,
                  options: serviceOptions(),
                  loading: unref(services).loading.value,
                  variables: __props.variables,
                  "test-id": "zabbix-service-filter",
                  placeholder: unref(zabbixT)("zabbix.query.itService"),
                  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ itServiceFilter: $event }))
                }, null, 8, ["value", "options", "loading", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            __props.supportsSla !== false ? (openBlock(), createBlock(InlineField, {
              key: 0,
              label: unref(zabbixT)("zabbix.common.sla"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: __props.query.slaFilter,
                  options: slaOptions(),
                  loading: unref(slas).loading.value,
                  variables: __props.variables,
                  "test-id": "zabbix-sla-filter",
                  placeholder: unref(zabbixT)("zabbix.common.sla"),
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patch({ slaFilter: $event }))
                }, null, 8, ["value", "options", "loading", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])) : createCommentVNode("v-if", true)
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.property"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: __props.query.slaProperty || "sli",
                  options: slaPropertyOptions.value,
                  "test-id": "zabbix-sla-property",
                  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => patch({ slaProperty: String($event) }))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.interval"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: __props.query.slaInterval || "none",
                  options: slaIntervalOptions.value,
                  "test-id": "zabbix-sla-interval",
                  "onUpdate:value": _cache[3] || (_cache[3] = ($event) => patch({ slaInterval: String($event) }))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ServicesQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__scopeId", "data-v-071a5d5d"]]);
const _hoisted_1$k = {
  class: "fields",
  "data-testid": "zabbix-fields-macros"
};
const _sfc_main$m = /* @__PURE__ */ defineComponent({
  __name: "MacrosQueryEditor",
  props: {
    query: {},
    datasourceUid: {},
    datasourceApi: {}
  },
  emits: ["update:query"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$k, [
        createVNode(CascadeFilters, {
          query: __props.query,
          "datasource-uid": __props.datasourceUid,
          "datasource-api": __props.datasourceApi,
          fields: ["group", "host", "macro"],
          "onUpdate:query": _cache[0] || (_cache[0] = ($event) => emit("update:query", $event))
        }, null, 8, ["query", "datasource-uid", "datasource-api"])
      ]);
    };
  }
});
const MacrosQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__scopeId", "data-v-a0491966"]]);
const ITEM_COUNT_WARNING_THRESHOLD = 500;
const TIME_RANGE_WARNING_THRESHOLD_DAYS = 365;
function getTimeRangeDurationDays(range) {
  const from = range?.from?.valueOf?.() ?? Number.NaN;
  const to = range?.to?.valueOf?.() ?? Number.NaN;
  if (!Number.isFinite(from) || !Number.isFinite(to) || to < from) return 0;
  return (to - from) / (1e3 * 60 * 60 * 24);
}
function isTimeRangeLarge(range, thresholdDays = TIME_RANGE_WARNING_THRESHOLD_DAYS) {
  const days = getTimeRangeDurationDays(range);
  return days >= thresholdDays;
}
function formatDurationDays(days) {
  const whole = Math.floor(days);
  if (whole < 365) return zabbixT("zabbix.duration.days", { count: whole });
  const years = Math.floor(whole / 365);
  const rem = whole % 365;
  if (rem === 0) return zabbixT("zabbix.duration.years", { count: years });
  return zabbixT("zabbix.duration.yearsDays", { years, days: rem });
}
function shouldWarnItemCount(count, threshold = ITEM_COUNT_WARNING_THRESHOLD) {
  return Number.isFinite(count) && count >= threshold;
}
const _hoisted_1$j = ["data-testid"];
const _hoisted_2$i = {
  class: "editor-alert__icon",
  "aria-hidden": "true"
};
const _hoisted_3$h = { class: "editor-alert__body" };
const _hoisted_4$d = { class: "editor-alert__title" };
const _hoisted_5$b = {
  key: 0,
  class: "editor-alert__msg"
};
const _sfc_main$l = /* @__PURE__ */ defineComponent({
  __name: "EditorAlert",
  props: {
    title: {},
    message: { default: "" },
    testId: { default: "zabbix-editor-alert" },
    severity: { default: "warning" }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(["editor-alert", `editor-alert--${__props.severity}`]),
        role: "status",
        "aria-live": "polite",
        "data-testid": __props.testId
      }, [
        createElementVNode("span", _hoisted_2$i, [
          createVNode(unref(GIcon), { name: "exclamation-triangle" })
        ]),
        createElementVNode("div", _hoisted_3$h, [
          createElementVNode(
            "strong",
            _hoisted_4$d,
            toDisplayString(__props.title),
            1
            /* TEXT */
          ),
          __props.message ? (openBlock(), createElementBlock(
            "p",
            _hoisted_5$b,
            toDisplayString(__props.message),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          renderSlot(_ctx.$slots, "default", {}, void 0, true)
        ])
      ], 10, _hoisted_1$j);
    };
  }
});
const EditorAlert = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__scopeId", "data-v-79603b82"]]);
const _sfc_main$k = /* @__PURE__ */ defineComponent({
  __name: "ItemCountWarning",
  props: {
    itemCount: {},
    threshold: { default: ITEM_COUNT_WARNING_THRESHOLD }
  },
  setup(__props) {
    const props = __props;
    const visible = computed(() => shouldWarnItemCount(props.itemCount, props.threshold));
    return (_ctx, _cache) => {
      return visible.value ? (openBlock(), createBlock(EditorAlert, {
        key: 0,
        title: unref(zabbixT)("zabbix.error.itemCount"),
        message: unref(zabbixT)("zabbix.error.itemCountDetail", { count: __props.itemCount }),
        "test-id": "zabbix-item-count-warning"
      }, null, 8, ["title", "message"])) : createCommentVNode("v-if", true);
    };
  }
});
const _sfc_main$j = /* @__PURE__ */ defineComponent({
  __name: "TimeRangeWarning",
  props: {
    range: {}
  },
  setup(__props) {
    const props = __props;
    const visible = computed(() => props.range ? isTimeRangeLarge(props.range) : false);
    const duration = computed(
      () => props.range ? formatDurationDays(getTimeRangeDurationDays(props.range)) : ""
    );
    return (_ctx, _cache) => {
      return visible.value ? (openBlock(), createBlock(EditorAlert, {
        key: 0,
        title: unref(zabbixT)("zabbix.error.timeRange"),
        message: unref(zabbixT)("zabbix.error.timeRangeDetail", { duration: duration.value }),
        "test-id": "zabbix-time-range-warning"
      }, null, 8, ["title", "message"])) : createCommentVNode("v-if", true);
    };
  }
});
const _hoisted_1$i = {
  key: 0,
  class: "opts",
  "data-testid": "zabbix-query-options"
};
const _hoisted_2$h = ["aria-expanded"];
const _hoisted_3$g = { class: "chev" };
const _hoisted_4$c = {
  key: 0,
  class: "summary",
  "data-testid": "zabbix-query-options-summary"
};
const _hoisted_5$a = {
  key: 1,
  class: "summary muted"
};
const _hoisted_6$9 = {
  class: "opts-body",
  "data-testid": "zabbix-query-options-body"
};
const _hoisted_7$9 = {
  key: 1,
  "data-testid": "zabbix-query-options-empty",
  class: "empty"
};
const _sfc_main$i = /* @__PURE__ */ defineComponent({
  __name: "QueryOptionsEditor",
  props: {
    options: {},
    queryType: {}
  },
  emits: ["update:options"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const expanded = ref(false);
    const code = computed(() => normalizeZabbixQueryType(props.queryType));
    const show = computed(() => {
      const c = code.value;
      return {
        showDisabled: c === "0" || c === "3",
        skipEmpty: c === "0" || c === "2" || c === "3",
        alignment: c === "0" || c === "1" || c === "3",
        valueMapping: c === "0" || c === "3",
        trends: c === "0" || c === "1" || c === "3",
        severity: c === "4" || c === "5",
        sort: c === "5",
        ack: c === "4" || c === "5",
        maintenance: c === "5",
        proxy: c === "5",
        limit: c === "5",
        timeRange: c === "4" || c === "5",
        fetchHistorical: c === "5",
        count: c === "4",
        any: c !== "6"
      };
    });
    const summary = computed(() => {
      const o = props.options || {};
      const parts = [];
      if (show.value.trends && o.useTrends && o.useTrends !== "default")
        parts.push(
          `${zabbixT("zabbix.query.optionTrends")} = ${o.useTrends === "true" ? zabbixT("zabbix.common.true") : zabbixT("zabbix.common.false")}`
        );
      if (show.value.showDisabled && o.showDisabledItems)
        parts.push(`${zabbixT("zabbix.query.optionShowDisabled")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.valueMapping && o.useZabbixValueMapping)
        parts.push(`${zabbixT("zabbix.query.optionValueMapping")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.alignment && o.disableDataAlignment)
        parts.push(`${zabbixT("zabbix.query.optionAlignment")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.skipEmpty && o.skipEmptyValues)
        parts.push(`${zabbixT("zabbix.query.optionSkipEmpty")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.severity && o.minSeverity != null && o.minSeverity > 0)
        parts.push(`${zabbixT("zabbix.common.minSeverity")} = ${o.minSeverity}`);
      if (show.value.sort && o.sortProblems && o.sortProblems !== "default")
        parts.push(`${zabbixT("zabbix.query.optionSortProblems")} = ${o.sortProblems}`);
      if (show.value.ack && o.acknowledged != null && o.acknowledged !== 2)
        parts.push(`${zabbixT("zabbix.query.optionAcknowledged")} = ${o.acknowledged}`);
      if (show.value.maintenance && o.hostsInMaintenance)
        parts.push(`${zabbixT("zabbix.query.optionMaintenance")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.proxy && o.hostProxy)
        parts.push(`${zabbixT("zabbix.query.optionShowProxy")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.limit && o.limit != null && o.limit !== 1001)
        parts.push(`${zabbixT("zabbix.query.optionLimit")} = ${o.limit}`);
      if (show.value.timeRange && o.useTimeRange)
        parts.push(`${zabbixT("zabbix.query.optionTimeRange")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.fetchHistorical && o.fetchHistoricalItemValue)
        parts.push(`${zabbixT("zabbix.query.optionHistorical")} = ${zabbixT("zabbix.common.true")}`);
      if (show.value.count && o.count)
        parts.push(`${zabbixT("zabbix.query.optionCount")} = ${zabbixT("zabbix.common.true")}`);
      return parts.join(", ");
    });
    function patchOptions(partial) {
      emit("update:options", { ...props.options, ...partial });
    }
    function clampLimit2(v) {
      return Math.min(1001, Math.max(1, Math.floor(v)));
    }
    function clampSeverity(v) {
      return Math.min(5, Math.max(0, Math.floor(v)));
    }
    __expose({ expanded, summary, clampLimit: clampLimit2, clampSeverity });
    return (_ctx, _cache) => {
      return show.value.any ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
        createElementVNode("button", {
          type: "button",
          class: "opts-toggle",
          "data-testid": "zabbix-query-options-toggle",
          "aria-expanded": expanded.value,
          onClick: _cache[0] || (_cache[0] = ($event) => expanded.value = !expanded.value)
        }, [
          createElementVNode(
            "span",
            _hoisted_3$g,
            toDisplayString(expanded.value ? "▾" : "▸"),
            1
            /* TEXT */
          ),
          createElementVNode(
            "strong",
            null,
            toDisplayString(unref(zabbixT)("zabbix.common.options")),
            1
            /* TEXT */
          ),
          !expanded.value && summary.value ? (openBlock(), createElementBlock(
            "span",
            _hoisted_4$c,
            toDisplayString(summary.value),
            1
            /* TEXT */
          )) : !expanded.value ? (openBlock(), createElementBlock(
            "span",
            _hoisted_5$a,
            toDisplayString(unref(zabbixT)("zabbix.query.noExtraOptions")),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true)
        ], 8, _hoisted_2$h),
        withDirectives(createElementVNode(
          "div",
          _hoisted_6$9,
          [
            show.value.trends || show.value.showDisabled || show.value.valueMapping || show.value.alignment ? (openBlock(), createBlock(InlineFieldRow, { key: 0 }, {
              default: withCtx(() => [
                show.value.trends ? (openBlock(), createBlock(InlineField, {
                  key: 0,
                  label: unref(zabbixT)("zabbix.query.optionTrends"),
                  "label-width": 10
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSelect), {
                      value: __props.options.useTrends || "default",
                      options: [
                        { label: unref(zabbixT)("zabbix.common.default"), value: "default" },
                        { label: unref(zabbixT)("zabbix.common.true"), value: "true" },
                        { label: unref(zabbixT)("zabbix.common.false"), value: "false" }
                      ],
                      "test-id": "zabbix-opt-trends",
                      "onUpdate:value": _cache[1] || (_cache[1] = ($event) => patchOptions({ useTrends: $event }))
                    }, null, 8, ["value", "options"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.showDisabled ? (openBlock(), createBlock(InlineField, {
                  key: 1,
                  label: unref(zabbixT)("zabbix.query.optionShowDisabled"),
                  "label-width": 18
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.showDisabledItems),
                      "test-id": "zabbix-opt-show-disabled",
                      "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => patchOptions({ showDisabledItems: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.valueMapping ? (openBlock(), createBlock(InlineField, {
                  key: 2,
                  label: unref(zabbixT)("zabbix.query.optionValueMapping"),
                  "label-width": 20
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.useZabbixValueMapping),
                      "test-id": "zabbix-opt-value-mapping",
                      "onUpdate:checked": _cache[3] || (_cache[3] = ($event) => patchOptions({ useZabbixValueMapping: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.alignment ? (openBlock(), createBlock(InlineField, {
                  key: 3,
                  label: unref(zabbixT)("zabbix.query.optionAlignment"),
                  "label-width": 18
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.disableDataAlignment),
                      "test-id": "zabbix-opt-disable-alignment",
                      "onUpdate:checked": _cache[4] || (_cache[4] = ($event) => patchOptions({ disableDataAlignment: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            })) : createCommentVNode("v-if", true),
            show.value.skipEmpty ? (openBlock(), createBlock(InlineFieldRow, { key: 1 }, {
              default: withCtx(() => [
                createVNode(InlineField, {
                  label: unref(zabbixT)("zabbix.query.optionSkipEmpty"),
                  "label-width": 16
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.skipEmptyValues),
                      "test-id": "zabbix-opt-skip-empty",
                      "onUpdate:checked": _cache[5] || (_cache[5] = ($event) => patchOptions({ skipEmptyValues: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])
              ]),
              _: 1
              /* STABLE */
            })) : createCommentVNode("v-if", true),
            show.value.severity || show.value.sort || show.value.ack ? (openBlock(), createBlock(InlineFieldRow, { key: 2 }, {
              default: withCtx(() => [
                show.value.severity ? (openBlock(), createBlock(InlineField, {
                  key: 0,
                  label: unref(zabbixT)("zabbix.common.minSeverity"),
                  "label-width": 12
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      "model-value": __props.options.minSeverity ?? 0,
                      type: "number",
                      "test-id": "zabbix-opt-min-severity",
                      "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => patchOptions({ minSeverity: clampSeverity(Number($event)) }))
                    }, null, 8, ["model-value"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.sort ? (openBlock(), createBlock(InlineField, {
                  key: 1,
                  label: unref(zabbixT)("zabbix.query.optionSortProblems"),
                  "label-width": 12
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSelect), {
                      value: __props.options.sortProblems || "default",
                      options: [
                        { label: unref(zabbixT)("zabbix.common.default"), value: "default" },
                        {
                          label: unref(zabbixT)("zabbix.query.optionLastChange"),
                          value: "lastchange"
                        },
                        {
                          label: unref(zabbixT)("zabbix.query.optionSeverity"),
                          value: "severity"
                        }
                      ],
                      "test-id": "zabbix-opt-sort",
                      "onUpdate:value": _cache[7] || (_cache[7] = ($event) => patchOptions({ sortProblems: $event }))
                    }, null, 8, ["value", "options"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.ack ? (openBlock(), createBlock(InlineField, {
                  key: 2,
                  label: unref(zabbixT)("zabbix.query.optionAcknowledged"),
                  "label-width": 12
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSelect), {
                      value: __props.options.acknowledged ?? 2,
                      options: [
                        { label: unref(zabbixT)("zabbix.common.all"), value: 2 },
                        { label: unref(zabbixT)("zabbix.query.optionUnacknowledged"), value: 0 },
                        { label: unref(zabbixT)("zabbix.panel.acknowledgedState"), value: 1 }
                      ],
                      "test-id": "zabbix-opt-ack",
                      "onUpdate:value": _cache[8] || (_cache[8] = ($event) => patchOptions({ acknowledged: Number($event) }))
                    }, null, 8, ["value", "options"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            })) : createCommentVNode("v-if", true),
            show.value.maintenance || show.value.proxy || show.value.limit || show.value.timeRange || show.value.fetchHistorical || show.value.count ? (openBlock(), createBlock(InlineFieldRow, { key: 3 }, {
              default: withCtx(() => [
                show.value.maintenance ? (openBlock(), createBlock(InlineField, {
                  key: 0,
                  label: unref(zabbixT)("zabbix.query.optionMaintenance"),
                  "label-width": 18
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.hostsInMaintenance),
                      "test-id": "zabbix-opt-maintenance",
                      "onUpdate:checked": _cache[9] || (_cache[9] = ($event) => patchOptions({ hostsInMaintenance: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.proxy ? (openBlock(), createBlock(InlineField, {
                  key: 1,
                  label: unref(zabbixT)("zabbix.query.optionShowProxy"),
                  "label-width": 12
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.hostProxy),
                      "test-id": "zabbix-opt-proxy",
                      "onUpdate:checked": _cache[10] || (_cache[10] = ($event) => patchOptions({ hostProxy: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.limit ? (openBlock(), createBlock(InlineField, {
                  key: 2,
                  label: unref(zabbixT)("zabbix.query.optionLimit"),
                  "label-width": 8
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      "model-value": __props.options.limit ?? 1001,
                      type: "number",
                      "test-id": "zabbix-opt-limit",
                      "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => patchOptions({ limit: clampLimit2(Number($event)) }))
                    }, null, 8, ["model-value"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.timeRange ? (openBlock(), createBlock(InlineField, {
                  key: 3,
                  label: unref(zabbixT)("zabbix.query.optionTimeRange"),
                  "label-width": 14
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.useTimeRange),
                      "test-id": "zabbix-opt-time-range",
                      "onUpdate:checked": _cache[12] || (_cache[12] = ($event) => patchOptions({ useTimeRange: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.fetchHistorical ? (openBlock(), createBlock(InlineField, {
                  key: 4,
                  label: unref(zabbixT)("zabbix.query.optionHistorical"),
                  "label-width": 18
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.fetchHistoricalItemValue),
                      "test-id": "zabbix-opt-historical",
                      "onUpdate:checked": _cache[13] || (_cache[13] = ($event) => patchOptions({ fetchHistoricalItemValue: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true),
                show.value.count ? (openBlock(), createBlock(InlineField, {
                  key: 5,
                  label: unref(zabbixT)("zabbix.query.optionCount"),
                  "label-width": 10
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSwitch), {
                      checked: Boolean(__props.options.count),
                      "test-id": "zabbix-opt-count",
                      "onUpdate:checked": _cache[14] || (_cache[14] = ($event) => patchOptions({ count: $event }))
                    }, null, 8, ["checked"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])) : createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            })) : createCommentVNode("v-if", true)
          ],
          512
          /* NEED_PATCH */
        ), [
          [vShow, expanded.value]
        ])
      ])) : (openBlock(), createElementBlock("div", _hoisted_7$9));
    };
  }
});
const QueryOptionsEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-23ea5b6d"]]);
const _hoisted_1$h = {
  class: "zbx-qe",
  "data-testid": "query-editor-zabbix"
};
const _sfc_main$h = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {},
    datasourceApi: {},
    variables: {}
  },
  setup(__props, { expose: __expose }) {
    const typeOptions = computed(() => [
      { label: zabbixT("zabbix.query.metric"), value: "0" },
      { label: zabbixT("zabbix.query.itService"), value: "1" },
      { label: zabbixT("zabbix.query.text"), value: "2" },
      { label: zabbixT("zabbix.common.itemId"), value: "3" },
      { label: zabbixT("zabbix.common.trigger"), value: "4" },
      { label: zabbixT("zabbix.common.problem"), value: "5" },
      { label: zabbixT("zabbix.common.macro"), value: "6" }
    ]);
    const props = __props;
    const itemCount = ref(0);
    const query = computed(() => migrateZabbixQuery(props.query || {}));
    const queryType = computed(() => normalizeZabbixQueryType(query.value.queryType));
    const datasourceUid = computed(
      () => String(props.datasource?.uid || props.query?.datasource?.uid || "")
    );
    const metaApi = computed(
      () => resolveZabbixMetadataApi(
        datasourceUid.value,
        props.datasourceApi || props.datasource || null
      )
    );
    function update(next) {
      const base = props.query;
      props.onChange({
        ...base,
        ...next,
        refId: next.refId ?? base?.refId,
        datasource: next.datasource ?? base?.datasource,
        hide: next.hide ?? base?.hide
      });
    }
    function setQueryType(v) {
      const code = normalizeZabbixQueryType(v);
      update({ ...query.value, queryType: code });
    }
    const legendFormat = computed({
      get: () => String(query.value.legendFormat || ""),
      set: (v) => update({ ...query.value, legendFormat: v })
    });
    const vars = computed(() => props.variables || []);
    __expose({ setQueryType, update, queryType });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$h, [
        createVNode(_sfc_main$j, {
          range: props.range
        }, null, 8, ["range"]),
        queryType.value === "0" ? (openBlock(), createBlock(_sfc_main$k, {
          key: 0,
          "item-count": itemCount.value
        }, null, 8, ["item-count"])) : createCommentVNode("v-if", true),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.query.queryType"),
              "label-width": 12,
              "html-for": "zabbix-query-type"
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  id: "zabbix-query-type",
                  value: queryType.value,
                  options: typeOptions.value,
                  "test-id": "zabbix-query-type",
                  "onUpdate:value": setQueryType
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        queryType.value === "0" ? (openBlock(), createBlock(MetricsQueryEditor, {
          key: 1,
          query: query.value,
          "datasource-uid": datasourceUid.value,
          "datasource-api": metaApi.value,
          variables: vars.value,
          "onUpdate:query": update,
          onItemCountChange: _cache[0] || (_cache[0] = ($event) => itemCount.value = $event)
        }, null, 8, ["query", "datasource-uid", "datasource-api", "variables"])) : queryType.value === "1" ? (openBlock(), createBlock(ServicesQueryEditor, {
          key: 2,
          query: query.value,
          "datasource-uid": datasourceUid.value,
          "datasource-api": metaApi.value,
          variables: vars.value,
          "onUpdate:query": update
        }, null, 8, ["query", "datasource-uid", "datasource-api", "variables"])) : queryType.value === "2" ? (openBlock(), createBlock(TextQueryEditor, {
          key: 3,
          query: query.value,
          "datasource-uid": datasourceUid.value,
          "datasource-api": metaApi.value,
          "onUpdate:query": update
        }, null, 8, ["query", "datasource-uid", "datasource-api"])) : queryType.value === "3" ? (openBlock(), createBlock(ItemIdQueryEditor, {
          key: 4,
          query: query.value,
          "onUpdate:query": update
        }, null, 8, ["query"])) : queryType.value === "4" ? (openBlock(), createBlock(TriggersQueryEditor, {
          key: 5,
          query: query.value,
          "datasource-uid": datasourceUid.value,
          "datasource-api": metaApi.value,
          "onUpdate:query": update
        }, null, 8, ["query", "datasource-uid", "datasource-api"])) : queryType.value === "5" ? (openBlock(), createBlock(ProblemsQueryEditor, {
          key: 6,
          query: query.value,
          "datasource-uid": datasourceUid.value,
          "datasource-api": metaApi.value,
          variables: vars.value,
          "onUpdate:query": update
        }, null, 8, ["query", "datasource-uid", "datasource-api", "variables"])) : queryType.value === "6" ? (openBlock(), createBlock(MacrosQueryEditor, {
          key: 7,
          query: query.value,
          "datasource-uid": datasourceUid.value,
          "datasource-api": metaApi.value,
          "onUpdate:query": update
        }, null, 8, ["query", "datasource-uid", "datasource-api"])) : createCommentVNode("v-if", true),
        createVNode(QueryOptionsEditor, {
          "query-type": queryType.value,
          options: query.value.options || {},
          "onUpdate:options": _cache[1] || (_cache[1] = ($event) => update({ ...query.value, options: $event }))
        }, null, 8, ["query-type", "options"]),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.legend"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(unref(GInput), {
                  modelValue: legendFormat.value,
                  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => legendFormat.value = $event),
                  placeholder: unref(zabbixT)("zabbix.query.legendPlaceholder"),
                  "test-id": "zabbix-legend"
                }, null, 8, ["modelValue", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(unref(GButton), {
          size: "sm",
          variant: "primary",
          "test-id": "zabbix-run-query",
          "aria-label": unref(zabbixT)("zabbix.query.runAria"),
          onClick: _cache[3] || (_cache[3] = ($event) => props.onRunQuery?.())
        }, {
          default: withCtx(() => [
            createTextVNode(
              toDisplayString(unref(zabbixT)("zabbix.query.run")),
              1
              /* TEXT */
            )
          ]),
          _: 1
          /* STABLE */
        }, 8, ["aria-label"])
      ]);
    };
  }
});
const QueryEditor$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__scopeId", "data-v-d24cd865"]]);
const _hoisted_1$g = {
  class: "zbx-cfg",
  "data-testid": "config-editor-zabbix"
};
const _hoisted_2$g = {
  class: "section",
  "aria-labelledby": "zbx-conn"
};
const _hoisted_3$f = { id: "zbx-conn" };
const _hoisted_4$b = { class: "cred-field" };
const _hoisted_5$9 = {
  class: "tip-wrap",
  "data-testid": "zabbix-token-tip",
  tabindex: "0"
};
const _hoisted_6$8 = {
  class: "cred-status",
  "data-testid": "zabbix-credential-status"
};
const _hoisted_7$8 = {
  key: 0,
  class: "configured"
};
const _hoisted_8$5 = {
  key: 1,
  class: "not-configured"
};
const _hoisted_9$5 = {
  class: "section section-collapsible",
  "data-testid": "zabbix-additional-settings"
};
const _hoisted_10$3 = ["aria-expanded"];
const _hoisted_11$3 = { id: "zbx-extra" };
const _hoisted_12$3 = {
  key: 0,
  class: "adv-body",
  role: "region",
  "aria-labelledby": "zbx-extra",
  "data-testid": "zabbix-additional-body"
};
const _hoisted_13$3 = { class: "row" };
const _hoisted_14$2 = {
  key: 1,
  class: "err",
  "data-testid": "zabbix-cache-ttl-error",
  role: "alert"
};
const _hoisted_15$2 = {
  key: 2,
  class: "err",
  "data-testid": "zabbix-timeout-error",
  role: "alert"
};
const _hoisted_16$1 = {
  key: 3,
  class: "err",
  "data-testid": "zabbix-query-timeout-error",
  role: "alert"
};
const _hoisted_17$1 = { class: "row" };
const _hoisted_18$1 = ["aria-label"];
const _hoisted_19$1 = ["data-uid", "data-type"];
const _hoisted_20$1 = {
  key: 1,
  class: "err"
};
const _hoisted_21$1 = { class: "row" };
const _hoisted_22$1 = { class: "row" };
const _hoisted_23$1 = { class: "row" };
const _hoisted_24$1 = {
  key: 5,
  "data-testid": "zabbix-enable-writes-warn"
};
const _sfc_main$g = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const DIRECT_DB_TYPES = /* @__PURE__ */ new Set([
      "mysql",
      "postgres",
      "postgresql",
      "grafana-postgresql-datasource",
      "influxdb"
    ]);
    const props = __props;
    const tokenLocal = ref("");
    const usernameLocal = ref("");
    const passwordLocal = ref("");
    const fieldErrors = ref({});
    const directDbCandidates = ref([]);
    const listLoaded = ref(false);
    const credentialConfigured = ref(false);
    const additionalOpen = ref(false);
    const legacyIdMigrated = ref(false);
    const dsUid = computed(() => String(props.options?.uid || "zabbix"));
    const configMigration = computed(
      () => migrateZabbixConfig(
        {
          ...DEFAULT_ZABBIX_OPTIONS,
          ...props.options.jsonData ?? {}
        },
        (numericId) => directDbCandidates.value.find((s) => s.id === numericId)?.uid
      )
    );
    const jsonData = computed(() => configMigration.value.options);
    function emitValidation() {
      const urlValue = String(props.options?.url || "").trim();
      let isValid = Boolean(urlValue) && !configMigration.value.error;
      let message2 = configMigration.value.error?.message;
      if (!urlValue) {
        isValid = false;
        message2 = zabbixT("zabbix.error.requiredUrl");
      }
      if (jsonData.value.dbConnectionEnable) {
        const uid = String(jsonData.value.dbConnectionDatasourceUID || "").trim();
        if (!uid) {
          isValid = false;
          message2 = zabbixT("zabbix.error.directDbUid");
        } else {
          const found = directDbCandidates.value.find((s) => s.uid === uid);
          if (!found) {
            if (directDbCandidates.value.length > 0 || listLoaded.value) {
              isValid = false;
              message2 = zabbixT("zabbix.error.directDbNotFound", { uid });
            }
          } else if (!DIRECT_DB_TYPES.has(found.type)) {
            isValid = false;
            message2 = zabbixT("zabbix.error.directDbUnsupported", {
              type: found.type
            });
          }
        }
      }
      for (const err of Object.values(fieldErrors.value)) {
        if (err) {
          isValid = false;
          message2 = err;
          break;
        }
      }
      props.onValidationChange?.({ isValid, message: message2 });
    }
    function patchJson(patch, url2) {
      const options = props.options;
      const next = {
        ...options,
        ...url2 != null ? { url: url2 } : {},
        jsonData: { ...jsonData.value, ...patch }
      };
      props.onOptionsChange(next);
    }
    async function refreshCredentialStatus() {
      const cred = await getRuntimeCredential(dsUid.value);
      credentialConfigured.value = Boolean(
        cred && (cred.value || cred.username || cred.password || cred.headers && Object.keys(cred.headers).length)
      );
    }
    function setToken(value) {
      tokenLocal.value = value;
      setRuntimeCredential(dsUid.value, value ? { kind: "apiKey", value } : null);
      void refreshCredentialStatus();
    }
    function setBasic(username, password) {
      usernameLocal.value = username;
      passwordLocal.value = password;
      setRuntimeCredential(
        dsUid.value,
        username || password ? { kind: "basic", username, password } : null
      );
      void refreshCredentialStatus();
    }
    function clearCredentials() {
      tokenLocal.value = "";
      usernameLocal.value = "";
      passwordLocal.value = "";
      setRuntimeCredential(dsUid.value, null);
      credentialConfigured.value = false;
    }
    const url = computed({
      get: () => String(props.options?.url || ""),
      set: (v) => patchJson({}, v)
    });
    const authType = computed({
      get: () => jsonData.value.authType === "userLogin" ? "userLogin" : "token",
      set: (v) => {
        const next = v === "userLogin" ? "userLogin" : "token";
        tokenLocal.value = "";
        usernameLocal.value = "";
        passwordLocal.value = "";
        setRuntimeCredential(dsUid.value, null);
        credentialConfigured.value = false;
        patchJson({ authType: next });
      }
    });
    const trends = computed({
      get: () => Boolean(jsonData.value.trends),
      set: (v) => patchJson({ trends: v })
    });
    const trendsFrom = computed({
      get: () => String(jsonData.value.trendsFrom || "7d"),
      set: (v) => patchJson({ trendsFrom: v })
    });
    const trendsRange = computed({
      get: () => String(jsonData.value.trendsRange || "4d"),
      set: (v) => patchJson({ trendsRange: v })
    });
    const cacheTTL = computed({
      get: () => String(jsonData.value.cacheTTL || "1h"),
      set: (v) => {
        const s = String(v || "").trim();
        if (!s || !isValidDurationString(s)) {
          fieldErrors.value = {
            ...fieldErrors.value,
            cacheTTL: zabbixT("zabbix.error.cacheTtl")
          };
        } else {
          const { cacheTTL: _drop, ...rest } = fieldErrors.value;
          fieldErrors.value = rest;
        }
        patchJson({ cacheTTL: s });
      }
    });
    const timeoutSeconds = computed({
      get: () => Math.max(1, Math.round(Number(jsonData.value.timeout || 3e4) / 1e3)),
      set: (v) => {
        const sec = Number(v);
        if (!Number.isFinite(sec) || sec <= 0 || !Number.isInteger(sec)) {
          fieldErrors.value = {
            ...fieldErrors.value,
            timeout: zabbixT("zabbix.error.timeout")
          };
          return;
        }
        const { timeout: _t, ...rest } = fieldErrors.value;
        fieldErrors.value = rest;
        patchJson({ timeout: Math.round(sec) * 1e3 });
      }
    });
    const queryTimeoutSeconds = computed({
      get: () => Math.max(1, Math.round(Number(jsonData.value.queryTimeout || 6e4) / 1e3)),
      set: (v) => {
        const sec = Number(v);
        if (!Number.isFinite(sec) || sec <= 0 || !Number.isInteger(sec)) {
          fieldErrors.value = {
            ...fieldErrors.value,
            queryTimeout: zabbixT("zabbix.error.queryTimeout")
          };
          return;
        }
        const { queryTimeout: _q, ...rest } = fieldErrors.value;
        fieldErrors.value = rest;
        patchJson({ queryTimeout: Math.round(sec) * 1e3 });
      }
    });
    const dbConnectionEnable = computed({
      get: () => Boolean(jsonData.value.dbConnectionEnable),
      set: (v) => patchJson({ dbConnectionEnable: v })
    });
    function setDbUid(uid) {
      const candidate = directDbCandidates.value.find((s) => s.uid === uid);
      patchJson({
        dbConnectionDatasourceUID: uid || void 0,
        dbConnectionDatasourceName: candidate?.name
      });
    }
    const dbConnectionDatasourceUID = computed({
      get: () => String(jsonData.value.dbConnectionDatasourceUID || ""),
      set: (v) => setDbUid(v)
    });
    const selectedDbType = computed(() => {
      const uid = String(jsonData.value.dbConnectionDatasourceUID || "");
      return directDbCandidates.value.find((s) => s.uid === uid)?.type || "";
    });
    const showRetentionPolicy = computed(
      () => Boolean(jsonData.value.dbConnectionEnable) && selectedDbType.value === "influxdb"
    );
    const retentionPolicy = computed({
      get: () => String(jsonData.value.dbConnectionRetentionPolicy || ""),
      set: (v) => patchJson({ dbConnectionRetentionPolicy: v })
    });
    const disableReadOnlyUsersAck = computed({
      get: () => Boolean(jsonData.value.disableReadOnlyUsersAck),
      set: (v) => patchJson({ disableReadOnlyUsersAck: v })
    });
    const disableDataAlignment = computed({
      get: () => Boolean(jsonData.value.disableDataAlignment),
      set: (v) => patchJson({ disableDataAlignment: v })
    });
    const authPlacement = computed({
      get: () => jsonData.value.authPlacement || "auto",
      set: (v) => patchJson({ authPlacement: v })
    });
    const historyPageLimit2 = computed({
      get: () => Number(jsonData.value.historyPageLimit ?? 1e4),
      set: (v) => patchJson({ historyPageLimit: Math.max(1, Number(v) || 1e4) })
    });
    const historyBatchSize2 = computed({
      get: () => Number(jsonData.value.historyBatchSize ?? 100),
      set: (v) => patchJson({ historyBatchSize: Math.max(1, Number(v) || 100) })
    });
    const historyConcurrency = computed({
      get: () => Number(jsonData.value.historyConcurrency ?? 4),
      set: (v) => patchJson({ historyConcurrency: Math.max(1, Number(v) || 4) })
    });
    const metadataPageLimit = computed({
      get: () => Number(jsonData.value.metadataPageLimit ?? 1e3),
      set: (v) => patchJson({ metadataPageLimit: Math.max(1, Number(v) || 1e3) })
    });
    const enableWrites = computed({
      get: () => Boolean(jsonData.value.enableWrites),
      set: (v) => patchJson({ enableWrites: v })
    });
    const dbOptions = computed(
      () => directDbCandidates.value.map((s) => ({
        label: `${s.name} (${s.type})`,
        value: s.uid
      }))
    );
    async function loadCandidates() {
      try {
        const list = await listDataSources();
        directDbCandidates.value = (list || []).filter(
          (s) => DIRECT_DB_TYPES.has(String(s.type || ""))
        );
      } catch {
        directDbCandidates.value = [];
      } finally {
        listLoaded.value = true;
        if (!legacyIdMigrated.value) {
          const raw = props.options?.jsonData ?? {};
          const hasLegacyId = Number(raw.dbConnectionDatasourceId) > 0 || raw.dbConnection && typeof raw.dbConnection === "object" && Number(raw.dbConnection.datasourceId) > 0;
          const migUid = configMigration.value.options.dbConnectionDatasourceUID;
          if (hasLegacyId && migUid) {
            const candidate = directDbCandidates.value.find((s) => s.uid === migUid);
            patchJson({
              dbConnectionDatasourceUID: migUid,
              dbConnectionDatasourceName: candidate?.name ?? configMigration.value.options.dbConnectionDatasourceName
            });
          }
          legacyIdMigrated.value = true;
        }
        emitValidation();
      }
    }
    onMounted(async () => {
      await loadCandidates();
      await refreshCredentialStatus();
      emitValidation();
    });
    onUnmounted(() => {
      tokenLocal.value = "";
      usernameLocal.value = "";
      passwordLocal.value = "";
    });
    watch(
      () => [props.options, directDbCandidates.value, fieldErrors.value, listLoaded.value],
      () => emitValidation(),
      { deep: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$g, [
        createVNode(unref(_sfc_main$H$1), {
          layout: "vertical",
          "test-id": "zabbix-config-form"
        }, {
          default: withCtx(() => [
            createElementVNode("section", _hoisted_2$g, [
              createElementVNode(
                "h4",
                _hoisted_3$f,
                toDisplayString(unref(zabbixT)("zabbix.config.connection")),
                1
                /* TEXT */
              ),
              createVNode(unref(GInlineField), {
                label: unref(zabbixT)("zabbix.config.url"),
                required: true,
                grow: ""
              }, {
                default: withCtx(() => [
                  createVNode(unref(GInput), {
                    id: "zabbix-url",
                    modelValue: url.value,
                    "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => url.value = $event),
                    placeholder: "https://zabbix.example/api_jsonrpc.php",
                    "test-id": "zabbix-url"
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
                /* STABLE */
              }, 8, ["label"]),
              createVNode(unref(GInlineField), {
                label: unref(zabbixT)("zabbix.config.authType"),
                grow: ""
              }, {
                default: withCtx(() => [
                  createVNode(unref(GSelect), {
                    id: "zabbix-auth-type",
                    value: authType.value,
                    options: [
                      { label: unref(zabbixT)("zabbix.config.apiToken"), value: "token" },
                      {
                        label: `${unref(zabbixT)("zabbix.config.username")}/${unref(zabbixT)("zabbix.config.password")}`,
                        value: "userLogin"
                      }
                    ],
                    "test-id": "zabbix-auth-type",
                    "onUpdate:value": _cache[1] || (_cache[1] = ($event) => authType.value = $event === "userLogin" ? "userLogin" : "token")
                  }, null, 8, ["value", "options"])
                ]),
                _: 1
                /* STABLE */
              }, 8, ["label"]),
              authType.value === "token" ? (openBlock(), createBlock(unref(GInlineField), {
                key: 0,
                label: unref(zabbixT)("zabbix.config.apiToken"),
                grow: ""
              }, {
                default: withCtx(() => [
                  createElementVNode("div", _hoisted_4$b, [
                    createVNode(unref(GInput), {
                      id: "zabbix-token",
                      "model-value": tokenLocal.value,
                      type: "password",
                      autocomplete: "off",
                      "test-id": "zabbix-token",
                      "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => setToken(String($event)))
                    }, null, 8, ["model-value"]),
                    createVNode(unref(_sfc_main$y$1), {
                      title: unref(zabbixT)("zabbix.config.credentialTip")
                    }, {
                      default: withCtx(() => [
                        createElementVNode("span", _hoisted_5$9, [
                          createVNode(unref(GIcon), {
                            name: "info",
                            size: 14
                          })
                        ])
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["title"])
                  ])
                ]),
                _: 1
                /* STABLE */
              }, 8, ["label"])) : (openBlock(), createElementBlock(
                Fragment,
                { key: 1 },
                [
                  createVNode(unref(GInlineField), {
                    label: unref(zabbixT)("zabbix.config.username"),
                    grow: ""
                  }, {
                    default: withCtx(() => [
                      createVNode(unref(GInput), {
                        id: "zabbix-username",
                        "model-value": usernameLocal.value,
                        "test-id": "zabbix-username",
                        autocomplete: "off",
                        "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => setBasic(String($event), passwordLocal.value))
                      }, null, 8, ["model-value"])
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["label"]),
                  createVNode(unref(GInlineField), {
                    label: unref(zabbixT)("zabbix.config.password"),
                    grow: ""
                  }, {
                    default: withCtx(() => [
                      createVNode(unref(GInput), {
                        id: "zabbix-password",
                        "model-value": passwordLocal.value,
                        type: "password",
                        autocomplete: "off",
                        "test-id": "zabbix-password",
                        "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => setBasic(usernameLocal.value, String($event)))
                      }, null, 8, ["model-value"])
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["label"])
                ],
                64
                /* STABLE_FRAGMENT */
              )),
              createElementVNode("div", _hoisted_6$8, [
                credentialConfigured.value ? (openBlock(), createElementBlock(
                  "span",
                  _hoisted_7$8,
                  toDisplayString(unref(zabbixT)("zabbix.config.credentialConfigured")),
                  1
                  /* TEXT */
                )) : (openBlock(), createElementBlock(
                  "span",
                  _hoisted_8$5,
                  toDisplayString(unref(zabbixT)("zabbix.config.credentialMissing")),
                  1
                  /* TEXT */
                )),
                credentialConfigured.value || tokenLocal.value || usernameLocal.value || passwordLocal.value ? (openBlock(), createBlock(unref(GButton), {
                  key: 2,
                  variant: "secondary",
                  size: "sm",
                  "test-id": "zabbix-clear-credentials",
                  onClick: clearCredentials
                }, {
                  default: withCtx(() => [
                    createTextVNode(
                      toDisplayString(unref(zabbixT)("zabbix.config.clearCredentials")),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                })) : createCommentVNode("v-if", true)
              ])
            ]),
            createElementVNode("section", _hoisted_9$5, [
              createElementVNode("button", {
                type: "button",
                class: "adv-toggle",
                "data-testid": "zabbix-additional-toggle",
                "aria-expanded": additionalOpen.value,
                onClick: _cache[5] || (_cache[5] = ($event) => additionalOpen.value = !additionalOpen.value),
                onKeydown: [
                  _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => additionalOpen.value = !additionalOpen.value, ["prevent"]), ["enter"])),
                  _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => additionalOpen.value = !additionalOpen.value, ["prevent"]), ["space"]))
                ]
              }, [
                createVNode(unref(GIcon), {
                  name: additionalOpen.value ? "angle-right" : "angle-right",
                  size: 14,
                  class: normalizeClass([{ "is-open": additionalOpen.value }, "chevron"])
                }, null, 8, ["name", "class"]),
                createElementVNode(
                  "h4",
                  _hoisted_11$3,
                  toDisplayString(unref(zabbixT)("zabbix.config.additional")),
                  1
                  /* TEXT */
                )
              ], 40, _hoisted_10$3),
              additionalOpen.value ? (openBlock(), createElementBlock("div", _hoisted_12$3, [
                createElementVNode(
                  "h5",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.config.apiQueryTrends")),
                  1
                  /* TEXT */
                ),
                createElementVNode("label", _hoisted_13$3, [
                  createVNode(unref(GSwitch), {
                    checked: trends.value,
                    "test-id": "zabbix-trends",
                    "onUpdate:checked": _cache[8] || (_cache[8] = ($event) => trends.value = $event)
                  }, null, 8, ["checked"]),
                  createTextVNode(
                    " " + toDisplayString(unref(zabbixT)("zabbix.config.enableTrends")),
                    1
                    /* TEXT */
                  )
                ]),
                trends.value ? (openBlock(), createElementBlock(
                  Fragment,
                  { key: 0 },
                  [
                    createVNode(unref(GInlineField), {
                      label: unref(zabbixT)("zabbix.config.trendsFrom"),
                      grow: ""
                    }, {
                      default: withCtx(() => [
                        createVNode(unref(GInput), {
                          id: "zabbix-trends-from",
                          modelValue: trendsFrom.value,
                          "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => trendsFrom.value = $event),
                          "test-id": "zabbix-trends-from"
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["label"]),
                    createVNode(unref(GInlineField), {
                      label: unref(zabbixT)("zabbix.config.trendsRange"),
                      grow: ""
                    }, {
                      default: withCtx(() => [
                        createVNode(unref(GInput), {
                          id: "zabbix-trends-range",
                          modelValue: trendsRange.value,
                          "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => trendsRange.value = $event),
                          "test-id": "zabbix-trends-range"
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["label"])
                  ],
                  64
                  /* STABLE_FRAGMENT */
                )) : createCommentVNode("v-if", true),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.cacheTtl"),
                  grow: ""
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-cache-ttl",
                      modelValue: cacheTTL.value,
                      "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => cacheTTL.value = $event),
                      "test-id": "zabbix-cache-ttl"
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"]),
                fieldErrors.value.cacheTTL ? (openBlock(), createElementBlock(
                  "p",
                  _hoisted_14$2,
                  toDisplayString(fieldErrors.value.cacheTTL),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.timeout"),
                  grow: "",
                  tooltip: unref(zabbixT)("zabbix.config.millisecondsHint", {
                    path: "jsonData.timeout"
                  })
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-timeout",
                      "model-value": timeoutSeconds.value,
                      type: "number",
                      "test-id": "zabbix-timeout",
                      "aria-invalid": Boolean(fieldErrors.value.timeout) || void 0,
                      "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => timeoutSeconds.value = Number($event))
                    }, null, 8, ["model-value", "aria-invalid"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label", "tooltip"]),
                fieldErrors.value.timeout ? (openBlock(), createElementBlock(
                  "p",
                  _hoisted_15$2,
                  toDisplayString(fieldErrors.value.timeout),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.queryTimeout"),
                  grow: "",
                  tooltip: unref(zabbixT)("zabbix.config.millisecondsHint", {
                    path: "jsonData.queryTimeout"
                  })
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-query-timeout",
                      "model-value": queryTimeoutSeconds.value,
                      type: "number",
                      "test-id": "zabbix-query-timeout",
                      "aria-invalid": Boolean(fieldErrors.value.queryTimeout) || void 0,
                      "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => queryTimeoutSeconds.value = Number($event))
                    }, null, 8, ["model-value", "aria-invalid"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label", "tooltip"]),
                fieldErrors.value.queryTimeout ? (openBlock(), createElementBlock(
                  "p",
                  _hoisted_16$1,
                  toDisplayString(fieldErrors.value.queryTimeout),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createElementVNode(
                  "h5",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.config.directDb")),
                  1
                  /* TEXT */
                ),
                createElementVNode("label", _hoisted_17$1, [
                  createVNode(unref(GSwitch), {
                    checked: dbConnectionEnable.value,
                    "test-id": "zabbix-direct-db",
                    "onUpdate:checked": _cache[14] || (_cache[14] = ($event) => dbConnectionEnable.value = $event)
                  }, null, 8, ["checked"]),
                  createTextVNode(
                    " " + toDisplayString(unref(zabbixT)("zabbix.config.enableDirectDb")),
                    1
                    /* TEXT */
                  )
                ]),
                dbConnectionEnable.value ? (openBlock(), createElementBlock(
                  Fragment,
                  { key: 4 },
                  [
                    createVNode(unref(GInlineField), {
                      label: unref(zabbixT)("zabbix.config.databaseDatasource"),
                      grow: ""
                    }, {
                      default: withCtx(() => [
                        createVNode(unref(GSelect), {
                          id: "zabbix-db-uid",
                          value: dbConnectionDatasourceUID.value,
                          options: dbOptions.value,
                          "allow-clear": "",
                          placeholder: unref(zabbixT)("zabbix.config.databasePlaceholder"),
                          "test-id": "zabbix-db-uid",
                          "onUpdate:value": _cache[15] || (_cache[15] = ($event) => dbConnectionDatasourceUID.value = String($event || ""))
                        }, null, 8, ["value", "options", "placeholder"])
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["label"]),
                    createElementVNode("ul", {
                      class: "sr-only",
                      "data-testid": "zabbix-db-candidates",
                      "aria-label": unref(zabbixT)("zabbix.config.directDbCandidates")
                    }, [
                      (openBlock(true), createElementBlock(
                        Fragment,
                        null,
                        renderList(directDbCandidates.value, (c) => {
                          return openBlock(), createElementBlock("li", {
                            key: c.uid,
                            "data-uid": c.uid,
                            "data-type": c.type
                          }, toDisplayString(c.name), 9, _hoisted_19$1);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ], 8, _hoisted_18$1),
                    showRetentionPolicy.value ? (openBlock(), createBlock(unref(GInlineField), {
                      key: 0,
                      label: unref(zabbixT)("zabbix.config.retentionPolicy"),
                      grow: ""
                    }, {
                      default: withCtx(() => [
                        createVNode(unref(GInput), {
                          id: "zabbix-retention-policy",
                          modelValue: retentionPolicy.value,
                          "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => retentionPolicy.value = $event),
                          "test-id": "zabbix-retention-policy"
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["label"])) : createCommentVNode("v-if", true),
                    configMigration.value.error ? (openBlock(), createElementBlock(
                      "p",
                      _hoisted_20$1,
                      toDisplayString(configMigration.value.error.message),
                      1
                      /* TEXT */
                    )) : createCommentVNode("v-if", true)
                  ],
                  64
                  /* STABLE_FRAGMENT */
                )) : createCommentVNode("v-if", true),
                createElementVNode(
                  "h5",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.config.permissionsWrites")),
                  1
                  /* TEXT */
                ),
                createElementVNode("label", _hoisted_21$1, [
                  createVNode(unref(GSwitch), {
                    checked: disableReadOnlyUsersAck.value,
                    "test-id": "zabbix-disable-readonly-ack",
                    "onUpdate:checked": _cache[17] || (_cache[17] = ($event) => disableReadOnlyUsersAck.value = $event)
                  }, null, 8, ["checked"]),
                  createTextVNode(
                    " " + toDisplayString(unref(zabbixT)("zabbix.config.disableReadonlyAck")),
                    1
                    /* TEXT */
                  )
                ]),
                createElementVNode("label", _hoisted_22$1, [
                  createVNode(unref(GSwitch), {
                    checked: disableDataAlignment.value,
                    "test-id": "zabbix-disable-alignment",
                    "onUpdate:checked": _cache[18] || (_cache[18] = ($event) => disableDataAlignment.value = $event)
                  }, null, 8, ["checked"]),
                  createTextVNode(
                    " " + toDisplayString(unref(zabbixT)("zabbix.config.disableAlignment")),
                    1
                    /* TEXT */
                  )
                ]),
                createElementVNode("label", _hoisted_23$1, [
                  createVNode(unref(GSwitch), {
                    checked: enableWrites.value,
                    "test-id": "zabbix-enable-writes",
                    "onUpdate:checked": _cache[19] || (_cache[19] = ($event) => enableWrites.value = $event)
                  }, null, 8, ["checked"]),
                  createTextVNode(
                    " " + toDisplayString(unref(zabbixT)("zabbix.config.enableWrites")),
                    1
                    /* TEXT */
                  )
                ]),
                enableWrites.value ? (openBlock(), createElementBlock("div", _hoisted_24$1, [
                  createVNode(unref(GAlert), {
                    severity: "warning",
                    title: unref(zabbixT)("zabbix.config.writeRisk")
                  }, {
                    default: withCtx(() => [
                      createTextVNode(
                        toDisplayString(unref(zabbixT)("zabbix.config.writeRiskDetail")),
                        1
                        /* TEXT */
                      )
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["title"])
                ])) : createCommentVNode("v-if", true),
                createElementVNode(
                  "h5",
                  null,
                  toDisplayString(unref(zabbixT)("zabbix.config.rpcTuning")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.authPlacement"),
                  grow: ""
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GSelect), {
                      id: "zabbix-auth-placement",
                      value: authPlacement.value,
                      options: [
                        { label: unref(zabbixT)("zabbix.config.autoDetect"), value: "auto" },
                        { label: unref(zabbixT)("zabbix.config.requestBody"), value: "body" },
                        {
                          label: unref(zabbixT)("zabbix.config.requestHeader"),
                          value: "header"
                        }
                      ],
                      "test-id": "zabbix-auth-placement",
                      "onUpdate:value": _cache[20] || (_cache[20] = ($event) => authPlacement.value = $event)
                    }, null, 8, ["value", "options"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"]),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.historyPageLimit"),
                  grow: "",
                  tooltip: "jsonData.historyPageLimit"
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-history-page-limit",
                      modelValue: historyPageLimit2.value,
                      "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => historyPageLimit2.value = $event),
                      type: "number",
                      "test-id": "zabbix-history-page-limit"
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"]),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.historyBatchSize"),
                  grow: "",
                  tooltip: "jsonData.historyBatchSize"
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-history-batch-size",
                      modelValue: historyBatchSize2.value,
                      "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => historyBatchSize2.value = $event),
                      type: "number",
                      "test-id": "zabbix-history-batch-size"
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"]),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.historyConcurrency"),
                  grow: "",
                  tooltip: "jsonData.historyConcurrency"
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-history-concurrency",
                      modelValue: historyConcurrency.value,
                      "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => historyConcurrency.value = $event),
                      type: "number",
                      "test-id": "zabbix-history-concurrency"
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"]),
                createVNode(unref(GInlineField), {
                  label: unref(zabbixT)("zabbix.config.metadataPageLimit"),
                  grow: "",
                  tooltip: "jsonData.metadataPageLimit"
                }, {
                  default: withCtx(() => [
                    createVNode(unref(GInput), {
                      id: "zabbix-metadata-page-limit",
                      modelValue: metadataPageLimit.value,
                      "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => metadataPageLimit.value = $event),
                      type: "number",
                      "test-id": "zabbix-metadata-page-limit"
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["label"])
              ])) : createCommentVNode("v-if", true)
            ])
          ]),
          _: 1
          /* STABLE */
        })
      ]);
    };
  }
});
const ConfigEditor$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__scopeId", "data-v-9f412cb8"]]);
const _hoisted_1$f = {
  class: "var-qe",
  "data-testid": "zabbix-variable-query-editor"
};
const _hoisted_2$f = {
  key: 0,
  class: "legacy",
  "data-testid": "zabbix-var-legacy",
  role: "status"
};
const _hoisted_3$e = {
  key: 0,
  class: "row"
};
const _sfc_main$f = /* @__PURE__ */ defineComponent({
  __name: "VariableQueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    datasource: {}
  },
  setup(__props) {
    const props = __props;
    const isLegacyString = computed(
      () => typeof props.query === "string" && isLegacyRaw(String(props.query))
    );
    function isLegacyRaw(t2) {
      const s = t2.trim();
      if (!s) return false;
      if (/\{[^}]+\}/.test(s)) return true;
      if (s.includes(".") && !s.includes(":") && !s.startsWith("{")) return true;
      return false;
    }
    function asObject() {
      if (typeof props.query === "string") {
        if (isLegacyRaw(props.query)) return parseLegacyVariableQuery(props.query);
        return parseZabbixVariableQuery(props.query);
      }
      if (props.query && typeof props.query === "object") {
        const q = props.query;
        if (q.queryType) return { ...q };
        if (typeof q.query === "string") {
          if (isLegacyRaw(q.query)) return parseLegacyVariableQuery(q.query);
          return parseZabbixVariableQuery(q.query);
        }
      }
      return { queryType: "group", filter: "" };
    }
    const model = computed(() => asObject());
    const queryType = computed(() => String(model.value.queryType || "group"));
    const legacyReadonly = computed(() => Boolean(model.value.legacy || isLegacyString.value));
    function emitPatch(partial) {
      if (legacyReadonly.value) return;
      props.onChange({
        ...model.value,
        ...partial,
        legacy: void 0,
        legacyRaw: void 0
      });
    }
    const typeOptions = computed(() => [
      { label: zabbixT("zabbix.common.group"), value: "group" },
      { label: zabbixT("zabbix.common.host"), value: "host" },
      { label: zabbixT("zabbix.common.application"), value: "application" },
      { label: zabbixT("zabbix.common.itemTag"), value: "itemTag" },
      { label: zabbixT("zabbix.common.item"), value: "item" },
      { label: zabbixT("zabbix.query.items"), value: "itemValues" },
      { label: zabbixT("zabbix.common.hostTag"), value: "hostTag" },
      { label: zabbixT("zabbix.common.proxy"), value: "proxy" },
      { label: zabbixT("zabbix.common.service"), value: "service" },
      { label: zabbixT("zabbix.common.sla"), value: "sla" },
      { label: zabbixT("zabbix.common.trigger"), value: "trigger" }
    ]);
    const showGroup = computed(
      () => ["group", "host", "application", "item", "itemTag", "hostTag", "itemValues", "trigger"].includes(
        queryType.value
      )
    );
    const showHost = computed(
      () => ["host", "application", "item", "itemTag", "hostTag", "itemValues", "trigger"].includes(
        queryType.value
      )
    );
    const showApplication = computed(
      () => ["application", "item", "itemValues"].includes(queryType.value)
    );
    const showItemTag = computed(() => queryType.value === "itemTag" || queryType.value === "item");
    const showItem = computed(() => queryType.value === "item" || queryType.value === "itemValues");
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$f, [
        legacyReadonly.value ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
          createElementVNode(
            "strong",
            null,
            toDisplayString(unref(zabbixT)("zabbix.variable.legacyReadonly")),
            1
            /* TEXT */
          ),
          createElementVNode(
            "code",
            null,
            toDisplayString(model.value.legacyRaw || (typeof __props.query === "string" ? __props.query : "")),
            1
            /* TEXT */
          ),
          createElementVNode(
            "p",
            null,
            toDisplayString(unref(zabbixT)("zabbix.variable.legacyDescription")),
            1
            /* TEXT */
          )
        ])) : createCommentVNode("v-if", true),
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(zabbixT)("zabbix.variable.type")),
          1
          /* TEXT */
        ),
        createVNode(unref(GSelect), {
          value: queryType.value,
          options: typeOptions.value,
          disabled: legacyReadonly.value,
          "test-id": "zabbix-var-type",
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => emitPatch({ queryType: String($event) }))
        }, null, 8, ["value", "options", "disabled"]),
        showGroup.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 1 },
          [
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(zabbixT)("zabbix.common.group")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": String(model.value.group ?? (queryType.value === "group" ? model.value.filter : "") ?? ""),
              disabled: legacyReadonly.value,
              "test-id": "zabbix-var-group",
              "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => queryType.value === "group" ? emitPatch({ filter: String($event) }) : emitPatch({ group: String($event) }))
            }, null, 8, ["model-value", "disabled"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        showHost.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 2 },
          [
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(zabbixT)("zabbix.common.host")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": String(model.value.host ?? (queryType.value === "host" ? model.value.filter : "") ?? ""),
              disabled: legacyReadonly.value,
              "test-id": "zabbix-var-host",
              "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => queryType.value === "host" ? emitPatch({ filter: String($event) }) : emitPatch({ host: String($event) }))
            }, null, 8, ["model-value", "disabled"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        showApplication.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 3 },
          [
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(zabbixT)("zabbix.common.application")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": String(model.value.application ?? (queryType.value === "application" ? model.value.filter : "") ?? ""),
              disabled: legacyReadonly.value,
              "test-id": "zabbix-var-application",
              "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => queryType.value === "application" ? emitPatch({ filter: String($event) }) : emitPatch({ application: String($event) }))
            }, null, 8, ["model-value", "disabled"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        showItemTag.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 4 },
          [
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(zabbixT)("zabbix.common.itemTag")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": String(model.value.itemTag ?? (queryType.value === "itemTag" ? model.value.filter : "") ?? ""),
              disabled: legacyReadonly.value,
              "test-id": "zabbix-var-item-tag",
              "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => queryType.value === "itemTag" ? emitPatch({ filter: String($event) }) : emitPatch({ itemTag: String($event) }))
            }, null, 8, ["model-value", "disabled"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true),
        showItem.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 5 },
          [
            createElementVNode(
              "label",
              null,
              toDisplayString(queryType.value === "itemValues" ? `${unref(zabbixT)("zabbix.common.item")} / ${unref(zabbixT)("zabbix.common.itemId")}` : unref(zabbixT)("zabbix.common.item")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": String(
                queryType.value === "itemValues" ? model.value.item ?? model.value.filter ?? "" : model.value.filter ?? ""
              ),
              disabled: legacyReadonly.value,
              "test-id": "zabbix-var-item",
              "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => queryType.value === "itemValues" ? emitPatch({ item: String($event) }) : emitPatch({ filter: String($event) }))
            }, null, 8, ["model-value", "disabled"]),
            queryType.value === "item" ? (openBlock(), createElementBlock("label", _hoisted_3$e, [
              createVNode(unref(GSwitch), {
                checked: Boolean(model.value.showDisabled),
                disabled: legacyReadonly.value,
                "test-id": "zabbix-var-show-disabled",
                "onUpdate:checked": _cache[6] || (_cache[6] = ($event) => emitPatch({ showDisabled: $event }))
              }, null, 8, ["checked", "disabled"]),
              createTextVNode(
                " " + toDisplayString(unref(zabbixT)("zabbix.variable.showDisabled")),
                1
                /* TEXT */
              )
            ])) : createCommentVNode("v-if", true)
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const VariableQueryEditor$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__scopeId", "data-v-232dd41e"]]);
const _hoisted_1$e = {
  class: "anno-qe",
  "data-testid": "zabbix-annotation-query-editor"
};
const _hoisted_2$e = { class: "row" };
const _hoisted_3$d = { class: "row" };
const _hoisted_4$a = { class: "row" };
const _sfc_main$e = /* @__PURE__ */ defineComponent({
  __name: "AnnotationQueryEditor",
  props: {
    annotation: {},
    onChange: { type: Function },
    datasource: {},
    variables: {}
  },
  setup(__props) {
    const severityLabels = computed(() => [
      { label: zabbixT("zabbix.common.notClassified"), value: 0 },
      { label: zabbixT("zabbix.common.information"), value: 1 },
      { label: zabbixT("zabbix.common.warning"), value: 2 },
      { label: zabbixT("zabbix.common.average"), value: 3 },
      { label: zabbixT("zabbix.common.high"), value: 4 },
      { label: zabbixT("zabbix.common.disaster"), value: 5 }
    ]);
    const props = __props;
    const prepared = computed(() => prepareZabbixAnnotation(props.annotation || {}));
    const target = computed(() => prepared.value.target || {});
    const options = computed(() => target.value.options || {});
    function patchTarget(partial) {
      const nextTarget = {
        ...target.value,
        ...partial,
        options: {
          ...options.value,
          ...partial.options || {}
        }
      };
      props.onChange({
        ...props.annotation,
        name: props.annotation.name,
        enable: props.annotation.enable,
        iconColor: props.annotation.iconColor,
        target: nextTarget
      });
    }
    function filterOf(key) {
      const f = target.value[key];
      if (f && typeof f === "object") return String(f.filter || "");
      return String(f || "");
    }
    function setFilter(key, value) {
      patchTarget({ [key]: { filter: value } });
    }
    function setOption(key, value) {
      patchTarget({ options: { ...options.value, [key]: value } });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$e, [
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.group"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterOf("group"),
                  variables: __props.variables,
                  "test-id": "zabbix-anno-group",
                  placeholder: unref(zabbixT)("zabbix.common.group"),
                  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => setFilter("group", $event))
                }, null, 8, ["value", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.host"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterOf("host"),
                  variables: __props.variables,
                  "test-id": "zabbix-anno-host",
                  placeholder: unref(zabbixT)("zabbix.common.host"),
                  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => setFilter("host", $event))
                }, null, 8, ["value", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.application"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterOf("application"),
                  variables: __props.variables,
                  "test-id": "zabbix-anno-application",
                  placeholder: unref(zabbixT)("zabbix.common.application"),
                  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => setFilter("application", $event))
                }, null, 8, ["value", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.common.trigger"),
              "label-width": 12,
              grow: ""
            }, {
              default: withCtx(() => [
                createVNode(MetricPicker, {
                  value: filterOf("trigger"),
                  variables: __props.variables,
                  "test-id": "zabbix-anno-trigger",
                  placeholder: unref(zabbixT)("zabbix.common.trigger"),
                  "onUpdate:value": _cache[3] || (_cache[3] = ($event) => setFilter("trigger", $event))
                }, null, 8, ["value", "variables", "placeholder"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(InlineFieldRow, null, {
          default: withCtx(() => [
            createVNode(InlineField, {
              label: unref(zabbixT)("zabbix.annotation.minSeverity"),
              "label-width": 12
            }, {
              default: withCtx(() => [
                createVNode(unref(GSelect), {
                  value: options.value.minSeverity ?? 0,
                  options: severityLabels.value,
                  "test-id": "zabbix-anno-min-severity",
                  "onUpdate:value": _cache[4] || (_cache[4] = ($event) => setOption("minSeverity", Number($event)))
                }, null, 8, ["value", "options"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createElementVNode("label", _hoisted_2$e, [
          createVNode(unref(GSwitch), {
            checked: Boolean(options.value.showOkEvents),
            "test-id": "zabbix-anno-show-ok",
            "onUpdate:checked": _cache[5] || (_cache[5] = ($event) => setOption("showOkEvents", $event))
          }, null, 8, ["checked"]),
          createTextVNode(
            " " + toDisplayString(unref(zabbixT)("zabbix.annotation.showOk")),
            1
            /* TEXT */
          )
        ]),
        createElementVNode("label", _hoisted_3$d, [
          createVNode(unref(GSwitch), {
            checked: Boolean(options.value.hideAcknowledged),
            "test-id": "zabbix-anno-hide-ack",
            "onUpdate:checked": _cache[6] || (_cache[6] = ($event) => setOption("hideAcknowledged", $event))
          }, null, 8, ["checked"]),
          createTextVNode(
            " " + toDisplayString(unref(zabbixT)("zabbix.annotation.hideAcknowledged")),
            1
            /* TEXT */
          )
        ]),
        createElementVNode("label", _hoisted_4$a, [
          createVNode(unref(GSwitch), {
            checked: Boolean(options.value.showHostname),
            "test-id": "zabbix-anno-show-hostname",
            "onUpdate:checked": _cache[7] || (_cache[7] = ($event) => setOption("showHostname", $event))
          }, null, 8, ["checked"]),
          createTextVNode(
            " " + toDisplayString(unref(zabbixT)("zabbix.annotation.showHostname")),
            1
            /* TEXT */
          )
        ])
      ]);
    };
  }
});
const AnnotationQueryEditor$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__scopeId", "data-v-14a7fee8"]]);
const meta$1 = {
  id: "alexanderzobnin-zabbix-datasource",
  name: "Zabbix",
  metrics: true,
  backend: true,
  capabilities: ZABBIX_CAPABILITIES
};
const plugin$2 = createDataSourcePlugin({
  meta: meta$1,
  QueryEditor: QueryEditor$1,
  ConfigEditor: ConfigEditor$1,
  VariableQueryEditor: VariableQueryEditor$1,
  AnnotationQueryEditor: AnnotationQueryEditor$1,
  createDataSource: (instance) => createZabbixDataSource(instance, meta$1)
});
const module$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: plugin$2,
  plugin: plugin$2
}, Symbol.toStringTag, { value: "Module" }));
const DEFAULT_ISSUES_OPTIONS = {
  layout: "table",
  pageSize: 50,
  showTraceDetail: true,
  sources: { logs: true, traces: true, alerts: true },
  attributeFilters: [],
  severities: [],
  sort: "time",
  highlightNew: true,
  highlightWindowMs: 5 * 60 * 1e3,
  showAttributes: true,
  showTraceLink: true,
  showDatasource: false
};
function col(frame, name) {
  const field = frame.fields.find((f) => f.name.toLowerCase() === name.toLowerCase());
  return field?.values || [];
}
function getAt(frame, names, i) {
  for (const n of names) {
    const v = col(frame, n)[i];
    if (v != null && v !== "") return v;
  }
  return void 0;
}
function toMs(v) {
  const n = Number(v ?? 0);
  if (!Number.isFinite(n) || n <= 0) return 0;
  if (n >= 1e9 && n < 1e12) return n * 1e3;
  return n;
}
function severityRank(s) {
  const k = String(s || "").toLowerCase();
  if (k === "critical" || k === "fatal") return 5;
  if (k === "error") return 4;
  if (k === "warning" || k === "warn") return 3;
  if (k === "info") return 2;
  if (k === "ok" || k === "resolved") return 1;
  return 0;
}
function inferSource(frame, row) {
  const meta2 = frame.meta || {};
  const hint = String(
    meta2.signal || meta2.preferredVisualisationType || meta2.custom?.signal || ""
  ).toLowerCase();
  if (hint.includes("alert") || row.status === "firing" || row.status === "pending") return "alert";
  if (hint.includes("trace") || row.traceId) return "trace";
  if (hint.includes("log")) return "log";
  if (row.alertId) return "alert";
  if (row.traceId) return "trace";
  return "log";
}
function parseAttributes(raw) {
  if (!raw) return {};
  if (typeof raw === "object" && !Array.isArray(raw)) {
    const out = {};
    for (const [k, v] of Object.entries(raw)) out[k] = String(v);
    return out;
  }
  if (typeof raw === "string") {
    try {
      return parseAttributes(JSON.parse(raw));
    } catch {
      return {};
    }
  }
  return {};
}
function matchAttr(filters, attrs, optionErrors) {
  for (const f of filters || []) {
    const val = attrs[f.key] ?? "";
    if (f.operator === "=") {
      if (val !== f.value) return false;
    } else if (f.operator === "!=") {
      if (val === f.value) return false;
    } else if (f.operator === "=~" || f.operator === "!~") {
      try {
        const re = new RegExp(f.value);
        const ok2 = re.test(val);
        if (f.operator === "=~" ? !ok2 : ok2) return false;
      } catch {
        optionErrors.push(`无效属性正则: ${f.key} ${f.operator} ${f.value}`);
        return true;
      }
    }
  }
  return true;
}
function isDefaultIncluded(issue) {
  const sev = String(issue.severity || "").toLowerCase();
  const status = String(issue.status || "").toLowerCase();
  if (issue.source === "log") {
    return sev === "error" || sev === "fatal" || sev === "critical";
  }
  if (issue.source === "trace") {
    return sev === "error" || status === "error" || status === "fault";
  }
  if (issue.source === "alert") {
    return status === "firing" || status === "pending";
  }
  return true;
}
function framesToIssues(frames = [], options = {}) {
  const opts = {
    ...DEFAULT_ISSUES_OPTIONS,
    ...options,
    sources: { ...DEFAULT_ISSUES_OPTIONS.sources, ...options.sources || {} }
  };
  const notices = [];
  const optionErrors = [];
  const byId2 = /* @__PURE__ */ new Map();
  for (const frame of frames) {
    const n = frame.length || frame.fields[0]?.values?.length || 0;
    if (!n) continue;
    const dsUid = String(frame.meta?.datasourceUid || "");
    const dsName = String(frame.meta?.datasourceName || "");
    for (let i = 0; i < n; i++) {
      const id = String(
        getAt(frame, ["id", "alertId", "alert_id", "eventId"], i) ?? `${dsUid}-${i}`
      );
      const title = String(getAt(frame, ["title", "name", "message", "body", "summary"], i) ?? "");
      const service = String(getAt(frame, ["service", "serviceName", "service_name"], i) ?? "");
      const severity = String(getAt(frame, ["severity", "priority", "level"], i) ?? "");
      const status = String(getAt(frame, ["status", "state"], i) ?? "");
      const traceId = getAt(frame, ["traceId", "trace_id", "traceID"], i);
      const time = toMs(getAt(frame, ["Time", "time", "timestamp", "ts"], i) || Date.now());
      const durationMs = Number(
        getAt(frame, ["duration", "durationMs", "duration_ms"], i) ?? Number.NaN
      );
      const environment = getAt(frame, ["environment", "env"], i);
      const operation = getAt(frame, ["operation", "operationName", "name"], i);
      const alertId = getAt(frame, ["alertId", "alert_id"], i);
      const attributes = parseAttributes(getAt(frame, ["attributes", "labels", "tags"], i));
      const draft = {
        id,
        title,
        service,
        severity,
        status,
        source: "log",
        traceId: traceId != null ? String(traceId) : void 0,
        time: time || Date.now(),
        durationMs: Number.isFinite(durationMs) ? durationMs : void 0,
        attributes,
        datasourceUid: dsUid || void 0,
        datasourceName: dsName || void 0,
        environment: environment != null ? String(environment) : void 0,
        operation: operation != null ? String(operation) : void 0,
        alertId: alertId != null ? String(alertId) : void 0
      };
      draft.source = inferSource(frame, draft);
      if (draft.source === "log" && !opts.sources.logs) continue;
      if (draft.source === "trace" && !opts.sources.traces) continue;
      if (draft.source === "alert" && !opts.sources.alerts) continue;
      if (!isDefaultIncluded(draft) && !(opts.severities || []).length) {
        if (["info", "ok", "resolved", "debug"].includes(
          String(draft.severity || draft.status).toLowerCase()
        )) {
          continue;
        }
        if (!isDefaultIncluded(draft)) continue;
      }
      if (opts.service && draft.service && draft.service !== opts.service) continue;
      if (opts.environment && draft.environment && draft.environment !== opts.environment) continue;
      if (opts.operation && draft.operation && draft.operation !== opts.operation) continue;
      if (opts.minDurationMs != null && (draft.durationMs ?? 0) < opts.minDurationMs) continue;
      if (opts.maxDurationMs != null && (draft.durationMs ?? Infinity) > opts.maxDurationMs)
        continue;
      if ((opts.severities || []).length) {
        const sev = String(draft.severity || "").toLowerCase();
        if (!opts.severities.map((s) => s.toLowerCase()).includes(sev)) continue;
      }
      if (!matchAttr(opts.attributeFilters || [], draft.attributes || {}, optionErrors)) continue;
      const prev = byId2.get(draft.id);
      if (!prev || draft.time >= prev.time) byId2.set(draft.id, draft);
    }
  }
  if (!frames.length) notices.push("无数据帧");
  let issues = Array.from(byId2.values());
  if (opts.sort === "severity") {
    issues.sort((a, b) => severityRank(b.severity) - severityRank(a.severity) || b.time - a.time);
  } else if (opts.sort === "duration") {
    issues.sort((a, b) => (b.durationMs || 0) - (a.durationMs || 0) || b.time - a.time);
  } else {
    issues.sort((a, b) => b.time - a.time);
  }
  if (opts.limit && opts.limit > 0) issues = issues.slice(0, opts.limit);
  return { issues, notices, optionErrors: Array.from(new Set(optionErrors)) };
}
function issuesFromPanelData(data, options) {
  return framesToIssues(data?.series || [], options);
}
function resolveApi(preferredUid) {
  if (preferredUid) {
    const byUid2 = getRuntimeDataSource(String(preferredUid));
    if (byUid2?.mutate) return byUid2;
  }
  const all = listRuntimeDataSources();
  return all.find(
    (ds2) => ds2?.mutate && (ds2.type === "signoz" || String(ds2.uid || "").includes("signoz"))
  ) || all.find((ds2) => ds2?.mutate);
}
async function runIssueAction(issue, action, message2, gate) {
  if (issue.source !== "alert") {
    return {
      status: "error",
      message: "仅 alert 来源支持动作（trace/log issue 只读）"
    };
  }
  const api = resolveApi(issue.datasourceUid);
  if (!api?.mutate) {
    return { status: "error", message: "当前数据源不支持动作" };
  }
  const alertId = issue.alertId || issue.id;
  const res = await api.mutate({
    action,
    payload: { alertId, source: "alert", message: message2 }
  });
  if (res?.status !== "success") {
    return {
      status: "error",
      message: chineseMessage(res?.message, "动作失败")
    };
  }
  return {
    status: "success",
    message: chineseMessage(res.message, "操作成功"),
    data: res.data
  };
}
const _hoisted_1$d = {
  class: "tbl",
  "data-testid": "issues-table"
};
const _hoisted_2$d = { key: 0 };
const _hoisted_3$c = ["data-testid", "onClick"];
const _hoisted_4$9 = { key: 0 };
const _hoisted_5$8 = ["onClick"];
const _hoisted_6$7 = ["onClick"];
const _hoisted_7$7 = {
  key: 1,
  class: "ro"
};
const _sfc_main$d = /* @__PURE__ */ defineComponent({
  __name: "IssuesTable",
  props: {
    items: {},
    options: {}
  },
  emits: ["select", "acknowledge", "resolve"],
  setup(__props, { emit: __emit }) {
    const { locale: locale2 } = useI18n();
    function displaySeverity(severity) {
      return severity ? issueSeverityLabel(severity) : "—";
    }
    const emit = __emit;
    function sevColor(sev) {
      const s = String(sev || "").toLowerCase();
      if (s === "critical" || s === "fatal") return "var(--grafana-error)";
      if (s === "error") return "var(--grafana-error)";
      if (s === "warning" || s === "warn") return "var(--grafana-warning)";
      if (s === "info") return "var(--grafana-info-main, var(--grafana-primary))";
      return "var(--grafana-text-secondary)";
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("table", _hoisted_1$d, [
        createElementVNode("thead", null, [
          createElementVNode("tr", null, [
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.time")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.source")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.service")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.title")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.severity")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.status")),
              1
              /* TEXT */
            ),
            __props.options.showDatasource ? (openBlock(), createElementBlock(
              "th",
              _hoisted_2$d,
              toDisplayString(unref(signozT)("signoz.panel.datasource")),
              1
              /* TEXT */
            )) : createCommentVNode("v-if", true),
            createElementVNode(
              "th",
              null,
              toDisplayString(unref(signozT)("signoz.panel.action")),
              1
              /* TEXT */
            )
          ])
        ]),
        createElementVNode("tbody", null, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(__props.items, (issue) => {
              return openBlock(), createElementBlock("tr", {
                key: issue.id,
                "data-testid": `issue-${issue.id}`,
                onClick: ($event) => emit("select", issue)
              }, [
                createElementVNode(
                  "td",
                  null,
                  toDisplayString(new Date(issue.time).toLocaleString(unref(locale2) === "en-US" ? "en-US" : "zh-CN")),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "td",
                  null,
                  toDisplayString(unref(issueSourceLabel)(issue.source)),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "td",
                  null,
                  toDisplayString(issue.service),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "td",
                  null,
                  toDisplayString(issue.title),
                  1
                  /* TEXT */
                ),
                createElementVNode("td", null, [
                  createElementVNode(
                    "span",
                    {
                      class: "sev",
                      style: normalizeStyle({ background: sevColor(issue.severity) })
                    },
                    toDisplayString(displaySeverity(issue.severity)),
                    5
                    /* TEXT, STYLE */
                  )
                ]),
                createElementVNode(
                  "td",
                  null,
                  toDisplayString(unref(issueStatusLabel)(issue.status)),
                  1
                  /* TEXT */
                ),
                __props.options.showDatasource ? (openBlock(), createElementBlock(
                  "td",
                  _hoisted_4$9,
                  toDisplayString(issue.datasourceName || issue.datasourceUid),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true),
                createElementVNode("td", {
                  onClick: _cache[0] || (_cache[0] = withModifiers(() => {
                  }, ["stop"]))
                }, [
                  issue.source === "alert" ? (openBlock(), createElementBlock(
                    Fragment,
                    { key: 0 },
                    [
                      createElementVNode("button", {
                        type: "button",
                        "data-testid": "issue-ack",
                        onClick: ($event) => emit("acknowledge", issue)
                      }, toDisplayString(unref(signozT)("signoz.panel.acknowledge")), 9, _hoisted_5$8),
                      createElementVNode("button", {
                        type: "button",
                        "data-testid": "issue-resolve",
                        onClick: ($event) => emit("resolve", issue)
                      }, toDisplayString(unref(signozT)("signoz.panel.resolve")), 9, _hoisted_6$7)
                    ],
                    64
                    /* STABLE_FRAGMENT */
                  )) : (openBlock(), createElementBlock(
                    "span",
                    _hoisted_7$7,
                    toDisplayString(unref(signozT)("signoz.panel.readOnly")),
                    1
                    /* TEXT */
                  ))
                ])
              ], 8, _hoisted_3$c);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])
      ]);
    };
  }
});
const IssuesTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__scopeId", "data-v-a766f7d4"]]);
const _hoisted_1$c = {
  class: "list",
  "data-testid": "issues-list"
};
const _hoisted_2$c = ["data-testid", "onClick"];
const _hoisted_3$b = { class: "title" };
const _hoisted_4$8 = { class: "meta" };
const _sfc_main$c = /* @__PURE__ */ defineComponent({
  __name: "IssuesList",
  props: {
    items: {},
    options: {}
  },
  emits: ["select"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const { locale: locale2 } = useI18n();
    function displaySeverity(severity, source) {
      return severity ? issueSeverityLabel(severity) : issueSourceLabel(source);
    }
    function sevColor(sev) {
      const s = String(sev || "").toLowerCase();
      if (s === "critical" || s === "fatal") return "var(--grafana-error)";
      if (s === "error") return "var(--grafana-error)";
      if (s === "warning" || s === "warn") return "var(--grafana-warning)";
      return "var(--grafana-text-secondary)";
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("ul", _hoisted_1$c, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(__props.items, (issue) => {
            return openBlock(), createElementBlock("li", {
              key: issue.id,
              "data-testid": `issue-${issue.id}`,
              onClick: ($event) => emit("select", issue)
            }, [
              createElementVNode(
                "span",
                {
                  class: "sev",
                  style: normalizeStyle({ background: sevColor(issue.severity) })
                },
                toDisplayString(displaySeverity(issue.severity, issue.source)),
                5
                /* TEXT, STYLE */
              ),
              createElementVNode(
                "span",
                _hoisted_3$b,
                toDisplayString(issue.title),
                1
                /* TEXT */
              ),
              createElementVNode(
                "span",
                _hoisted_4$8,
                toDisplayString(issue.service) + " · " + toDisplayString(new Date(issue.time).toLocaleString(unref(locale2) === "en-US" ? "en-US" : "zh-CN")),
                1
                /* TEXT */
              )
            ], 8, _hoisted_2$c);
          }),
          128
          /* KEYED_FRAGMENT */
        ))
      ]);
    };
  }
});
const IssuesList = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__scopeId", "data-v-a4b14a1d"]]);
const _hoisted_1$b = {
  class: "detail",
  "data-testid": "issue-detail"
};
const _hoisted_2$b = { key: 0 };
const _hoisted_3$a = { "data-testid": "issue-trace-id" };
const _hoisted_4$7 = ["href"];
const _hoisted_5$7 = {
  key: 1,
  "data-testid": "issue-attributes"
};
const _hoisted_6$6 = {
  key: 2,
  "data-testid": "issue-detail-loading"
};
const _hoisted_7$6 = {
  key: 3,
  class: "err",
  role: "alert"
};
const _hoisted_8$4 = {
  key: 4,
  "data-testid": "issue-spans",
  class: "block"
};
const _hoisted_9$4 = { class: "span-tree" };
const _hoisted_10$2 = ["data-span-id"];
const _hoisted_11$2 = { class: "muted" };
const _hoisted_12$2 = {
  key: 0,
  class: "sub",
  "data-testid": "issue-span-events"
};
const _hoisted_13$2 = {
  key: 1,
  class: "sub",
  "data-testid": "issue-span-attrs"
};
const _hoisted_14$1 = {
  key: 5,
  "data-testid": "issue-related-logs",
  class: "block"
};
const _hoisted_15$1 = { class: "muted" };
const _sfc_main$b = /* @__PURE__ */ defineComponent({
  __name: "IssueDetails",
  props: {
    issue: {},
    options: {},
    range: {}
  },
  setup(__props) {
    const props = __props;
    const spans = ref([]);
    const logs = ref([]);
    const loading = ref(false);
    const error = ref("");
    let controller = null;
    let seq2 = 0;
    const dataLink = computed(() => {
      if (!props.issue.traceId) return "";
      const tid = encodeURIComponent(props.issue.traceId);
      return `/d/signoz-traces/signoz-traces?var-traceId=${tid}`;
    });
    function fieldCol(frame, name) {
      const f = (frame?.fields || []).find(
        (x) => String(x.name).toLowerCase() === name.toLowerCase()
      );
      return f?.values || [];
    }
    function framesToSpanRows(frames) {
      const out = [];
      for (const fr of frames || []) {
        const n = fr.fields?.[0]?.values?.length || 0;
        const spanId = fieldCol(fr, "spanId");
        const parent = fieldCol(fr, "parentSpanId");
        const name = fieldCol(fr, "name");
        const service = fieldCol(fr, "serviceName").length ? fieldCol(fr, "serviceName") : fieldCol(fr, "service");
        const duration = fieldCol(fr, "duration");
        const attributes = fieldCol(fr, "attributes");
        const events = fieldCol(fr, "events");
        for (let i = 0; i < n; i++) {
          out.push({
            spanId: String(spanId[i] ?? ""),
            parentSpanId: String(parent[i] ?? ""),
            name: String(name[i] ?? ""),
            service: String(service[i] ?? ""),
            duration: Number(duration[i] ?? 0),
            attributes: attributes[i] != null ? String(attributes[i]) : void 0,
            events: events[i] != null ? String(events[i]) : void 0
          });
        }
      }
      return out;
    }
    function framesToLogRows(frames) {
      const out = [];
      for (const fr of frames || []) {
        const n = fr.fields?.[0]?.values?.length || 0;
        const time = fieldCol(fr, "Time").length ? fieldCol(fr, "Time") : fieldCol(fr, "time");
        const line = fieldCol(fr, "Line").length ? fieldCol(fr, "Line") : fieldCol(fr, "line");
        const service = fieldCol(fr, "service");
        const severity = fieldCol(fr, "severity");
        const spanId = fieldCol(fr, "spanId");
        for (let i = 0; i < n; i++) {
          out.push({
            time: Number(time[i] ?? 0),
            line: String(line[i] ?? ""),
            service: String(service[i] ?? ""),
            severity: String(severity[i] ?? ""),
            spanId: String(spanId[i] ?? "")
          });
        }
      }
      return out;
    }
    async function loadDetail() {
      if (!props.options.showTraceDetail) return;
      if (!props.issue.traceId || !props.issue.datasourceUid) {
        spans.value = [];
        logs.value = [];
        return;
      }
      controller?.abort();
      controller = new AbortController();
      const my = ++seq2;
      loading.value = true;
      error.value = "";
      try {
        const api = getRuntimeDataSource(String(props.issue.datasourceUid));
        if (!api?.getMetadata) {
          loading.value = false;
          return;
        }
        const fromMs = props.range?.fromMs ?? Date.now() - 36e5;
        const toMs2 = props.range?.toMs ?? Date.now();
        let spanFrames = [];
        if (typeof api.getTraceWaterfall === "function") {
          const wf = await api.getTraceWaterfall(
            { traceId: props.issue.traceId, selectedSpanId: "" },
            controller.signal
          );
          spanFrames = wf?.frames || (Array.isArray(wf) ? wf : []);
        } else {
          const traceRes = await api.getMetadata(
            { type: "traceById", traceId: props.issue.traceId },
            controller.signal
          );
          spanFrames = traceRes?.frames || [];
        }
        const logRes = await api.getMetadata(
          { type: "relatedLogs", traceId: props.issue.traceId, fromMs, toMs: toMs2 },
          controller.signal
        );
        if (my !== seq2) return;
        spans.value = framesToSpanRows(spanFrames);
        logs.value = framesToLogRows(logRes?.frames || []);
      } catch (error_) {
        if (error_?.name === "AbortError") return;
        if (my === seq2)
          error.value = chineseMessage(error_ instanceof Error ? error_.message : String(error_));
      } finally {
        if (my === seq2) loading.value = false;
      }
    }
    watch(
      () => [props.issue.id, props.issue.traceId, props.range?.fromMs, props.range?.toMs],
      () => void loadDetail(),
      { immediate: true }
    );
    onBeforeUnmount(() => {
      controller?.abort();
      seq2 += 1;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("aside", _hoisted_1$b, [
        createElementVNode(
          "h4",
          null,
          toDisplayString(__props.issue.title),
          1
          /* TEXT */
        ),
        createElementVNode(
          "p",
          null,
          toDisplayString(unref(signozT)("signoz.panel.service")) + ": " + toDisplayString(__props.issue.service),
          1
          /* TEXT */
        ),
        createElementVNode(
          "p",
          null,
          toDisplayString(unref(signozT)("signoz.panel.source")) + ": " + toDisplayString(unref(issueSourceLabel)(__props.issue.source)) + " · " + toDisplayString(unref(signozT)("signoz.panel.severity")) + ": " + toDisplayString(unref(issueSeverityLabel)(__props.issue.severity)) + " · " + toDisplayString(unref(signozT)("signoz.panel.status")) + ": " + toDisplayString(unref(issueStatusLabel)(__props.issue.status)),
          1
          /* TEXT */
        ),
        __props.issue.traceId ? (openBlock(), createElementBlock("p", _hoisted_2$b, [
          createTextVNode(
            toDisplayString(unref(signozT)("signoz.panel.traceId")) + ": ",
            1
            /* TEXT */
          ),
          createElementVNode(
            "span",
            _hoisted_3$a,
            toDisplayString(__props.issue.traceId),
            1
            /* TEXT */
          ),
          __props.options.showTraceLink && dataLink.value ? (openBlock(), createElementBlock("a", {
            key: 0,
            href: dataLink.value,
            "data-testid": "issue-trace-link",
            onClick: _cache[0] || (_cache[0] = withModifiers(() => {
            }, ["stop"]))
          }, toDisplayString(unref(signozT)("signoz.panel.open")), 9, _hoisted_4$7)) : createCommentVNode("v-if", true)
        ])) : createCommentVNode("v-if", true),
        __props.options.showAttributes && __props.issue.attributes ? (openBlock(), createElementBlock("div", _hoisted_5$7, [
          createElementVNode("table", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(__props.issue.attributes, (v, k) => {
                return openBlock(), createElementBlock("tr", { key: k }, [
                  createElementVNode(
                    "td",
                    null,
                    toDisplayString(k),
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "td",
                    null,
                    toDisplayString(v),
                    1
                    /* TEXT */
                  )
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true),
        loading.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_6$6,
          toDisplayString(unref(signozT)("signoz.common.loading")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        error.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_7$6,
          toDisplayString(error.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        spans.value.length ? (openBlock(), createElementBlock("div", _hoisted_8$4, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(signozT)("signoz.panel.spans").replace("{count}", String(spans.value.length))),
            1
            /* TEXT */
          ),
          createElementVNode("ul", _hoisted_9$4, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(spans.value, (s) => {
                return openBlock(), createElementBlock("li", {
                  key: s.spanId,
                  "data-span-id": s.spanId
                }, [
                  createElementVNode(
                    "strong",
                    null,
                    toDisplayString(s.service),
                    1
                    /* TEXT */
                  ),
                  createTextVNode(
                    " · " + toDisplayString(s.name) + " ",
                    1
                    /* TEXT */
                  ),
                  createElementVNode(
                    "span",
                    _hoisted_11$2,
                    toDisplayString(s.duration.toFixed?.(2) ?? s.duration) + "ms",
                    1
                    /* TEXT */
                  ),
                  s.events ? (openBlock(), createElementBlock(
                    "div",
                    _hoisted_12$2,
                    toDisplayString(unref(signozT)("signoz.panel.events")) + ": " + toDisplayString(s.events),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true),
                  s.attributes ? (openBlock(), createElementBlock(
                    "div",
                    _hoisted_13$2,
                    toDisplayString(unref(signozT)("signoz.panel.attributes")) + ": " + toDisplayString(s.attributes),
                    1
                    /* TEXT */
                  )) : createCommentVNode("v-if", true)
                ], 8, _hoisted_10$2);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true),
        logs.value.length ? (openBlock(), createElementBlock("div", _hoisted_14$1, [
          createElementVNode(
            "h5",
            null,
            toDisplayString(unref(signozT)("signoz.panel.relatedLogs").replace("{count}", String(logs.value.length))),
            1
            /* TEXT */
          ),
          createElementVNode("ul", null, [
            (openBlock(true), createElementBlock(
              Fragment,
              null,
              renderList(logs.value, (l, i) => {
                return openBlock(), createElementBlock("li", {
                  key: i,
                  "data-testid": "issue-log-row"
                }, [
                  createElementVNode(
                    "span",
                    _hoisted_15$1,
                    toDisplayString(l.severity ? unref(issueSeverityLabel)(l.severity) : "—"),
                    1
                    /* TEXT */
                  ),
                  createTextVNode(
                    " " + toDisplayString(l.line),
                    1
                    /* TEXT */
                  )
                ]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ])
        ])) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const IssueDetails = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__scopeId", "data-v-1be37a6f"]]);
const _hoisted_1$a = {
  class: "signoz-issues",
  "data-testid": "signoz-issues-panel"
};
const _hoisted_2$a = { class: "toolbar" };
const _hoisted_3$9 = {
  key: 0,
  "data-testid": "issue-action-msg"
};
const _hoisted_4$6 = {
  key: 1,
  class: "err",
  "data-testid": "issue-action-error",
  role: "alert"
};
const _hoisted_5$6 = {
  key: 0,
  "data-testid": "issues-empty"
};
const _hoisted_6$5 = {
  key: 3,
  class: "pager"
};
const _hoisted_7$5 = ["disabled"];
const _hoisted_8$3 = ["disabled"];
const _hoisted_9$3 = {
  key: 5,
  class: "confirm",
  "data-testid": "issue-action-confirm",
  role: "dialog"
};
const _sfc_main$a = /* @__PURE__ */ defineComponent({
  __name: "IssuesPanel",
  props: {
    id: {},
    data: {},
    options: {},
    fieldConfig: {},
    width: {},
    height: {},
    timeRange: {},
    replaceVariables: { type: Function },
    title: {},
    transparent: { type: Boolean }
  },
  setup(__props) {
    const props = __props;
    const options = computed(() => ({
      ...DEFAULT_ISSUES_OPTIONS,
      ...props.options || {},
      sources: {
        ...DEFAULT_ISSUES_OPTIONS.sources,
        ...props.options?.sources || {}
      }
    }));
    const alertFrames = ref([]);
    const actionMsg = ref("");
    const actionError = ref("");
    const selected = ref(null);
    const page = ref(0);
    const confirmIssue = ref(null);
    const confirmAction = ref(null);
    let alertsController = null;
    let alertsSeq = 0;
    const baseModel = computed(() => issuesFromPanelData(props.data, options.value));
    const mergedFrames = computed(() => [...props.data?.series || [], ...alertFrames.value]);
    const model = computed(() => {
      if (!alertFrames.value.length) return baseModel.value;
      return framesToIssues(mergedFrames.value, options.value);
    });
    const issues = computed(() => model.value.issues);
    const notices = computed(() => [...model.value.notices, ...model.value.optionErrors]);
    const pageSize = computed(() => options.value.pageSize || 50);
    const pageItems = computed(() => {
      const start = page.value * pageSize.value;
      return issues.value.slice(start, start + pageSize.value);
    });
    const range = computed(() => {
      const r = props.data?.timeRange || props.timeRange;
      return {
        fromMs: r?.from?.valueOf?.() ?? Date.now() - 36e5,
        toMs: r?.to?.valueOf?.() ?? Date.now()
      };
    });
    function collectSigNozUids() {
      const uids = /* @__PURE__ */ new Set();
      for (const fr of props.data?.series || []) {
        const u = fr.meta?.datasourceUid;
        if (u) uids.add(String(u));
      }
      const dsRef2 = props.data?.request?.targets?.[0]?.datasource || props.datasource;
      const uid = typeof dsRef2 === "string" ? dsRef2 : dsRef2?.uid;
      if (uid) uids.add(String(uid));
      if (!uids.size) {
        for (const ds2 of listRuntimeDataSources()) {
          if (ds2?.type === "signoz" || String(ds2?.uid || "").includes("signoz"))
            uids.add(String(ds2.uid));
        }
      }
      return Array.from(uids);
    }
    async function loadAlertsMetadata() {
      if (!options.value.sources?.alerts) {
        alertFrames.value = [];
        return;
      }
      alertsController?.abort();
      alertsController = new AbortController();
      const my = ++alertsSeq;
      const frames = [];
      for (const uid of collectSigNozUids()) {
        const api = getRuntimeDataSource(uid);
        if (!api?.getMetadata) continue;
        try {
          const res = await api.getMetadata(
            {
              type: "alerts",
              fromMs: range.value.fromMs,
              toMs: range.value.toMs,
              service: options.value.service,
              environment: options.value.environment,
              severities: options.value.severities
            },
            alertsController.signal
          );
          if (my !== alertsSeq) return;
          for (const fr of res?.frames || []) {
            frames.push({
              ...fr,
              meta: { ...fr.meta || {}, datasourceUid: uid, signal: "alerts" }
            });
          }
        } catch (error) {
          if (error?.name === "AbortError") return;
        }
      }
      if (my === alertsSeq) alertFrames.value = frames;
    }
    watch(
      () => [
        options.value.sources?.alerts,
        options.value.service,
        options.value.environment,
        range.value.fromMs,
        range.value.toMs,
        props.data?.series?.length
      ],
      () => void loadAlertsMetadata(),
      { immediate: true }
    );
    onBeforeUnmount(() => {
      alertsController?.abort();
      alertsSeq += 1;
    });
    function requestAction(issue, action) {
      confirmIssue.value = issue;
      confirmAction.value = action;
    }
    async function confirmRun() {
      if (!confirmIssue.value || !confirmAction.value) return;
      actionMsg.value = "";
      actionError.value = "";
      const res = await runIssueAction(confirmIssue.value, confirmAction.value);
      if (res.status === "success") {
        actionMsg.value = res.message || signozT("signoz.panel.success");
        await loadAlertsMetadata();
      } else {
        actionError.value = res.message || signozT("signoz.panel.actionFailed");
      }
      confirmIssue.value = null;
      confirmAction.value = null;
    }
    function cancelConfirm() {
      confirmIssue.value = null;
      confirmAction.value = null;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$a, [
        createElementVNode("div", _hoisted_2$a, [
          createElementVNode(
            "span",
            null,
            toDisplayString(unref(signozT)("signoz.panel.issues")) + " " + toDisplayString(issues.value.length),
            1
            /* TEXT */
          ),
          actionMsg.value ? (openBlock(), createElementBlock(
            "span",
            _hoisted_3$9,
            toDisplayString(actionMsg.value),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          actionError.value ? (openBlock(), createElementBlock(
            "span",
            _hoisted_4$6,
            toDisplayString(actionError.value),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true)
        ]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(notices.value, (n) => {
            return openBlock(), createElementBlock(
              "div",
              {
                key: n,
                class: "notice",
                role: "status"
              },
              toDisplayString(n),
              1
              /* TEXT */
            );
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        !issues.value.length ? (openBlock(), createElementBlock(
          "div",
          _hoisted_5$6,
          toDisplayString(unref(signozT)("signoz.panel.noIssues")),
          1
          /* TEXT */
        )) : options.value.layout === "table" ? (openBlock(), createBlock(IssuesTable, {
          key: 1,
          items: pageItems.value,
          options: options.value,
          onSelect: _cache[0] || (_cache[0] = ($event) => selected.value = $event),
          onAcknowledge: _cache[1] || (_cache[1] = ($event) => requestAction($event, "signoz.acknowledge")),
          onResolve: _cache[2] || (_cache[2] = ($event) => requestAction($event, "signoz.resolve"))
        }, null, 8, ["items", "options"])) : (openBlock(), createBlock(IssuesList, {
          key: 2,
          items: pageItems.value,
          options: options.value,
          onSelect: _cache[3] || (_cache[3] = ($event) => selected.value = $event)
        }, null, 8, ["items", "options"])),
        issues.value.length > pageSize.value ? (openBlock(), createElementBlock("div", _hoisted_6$5, [
          createElementVNode("button", {
            type: "button",
            disabled: page.value === 0,
            "data-testid": "issues-prev",
            onClick: _cache[4] || (_cache[4] = ($event) => page.value--)
          }, toDisplayString(unref(signozT)("signoz.panel.previous")), 9, _hoisted_7$5),
          createElementVNode(
            "span",
            null,
            toDisplayString(page.value + 1) + " / " + toDisplayString(Math.max(1, Math.ceil(issues.value.length / pageSize.value))),
            1
            /* TEXT */
          ),
          createElementVNode("button", {
            type: "button",
            disabled: (page.value + 1) * pageSize.value >= issues.value.length,
            "data-testid": "issues-next",
            onClick: _cache[5] || (_cache[5] = ($event) => page.value++)
          }, toDisplayString(unref(signozT)("signoz.panel.next")), 9, _hoisted_8$3)
        ])) : createCommentVNode("v-if", true),
        selected.value && options.value.showTraceDetail ? (openBlock(), createBlock(IssueDetails, {
          key: 4,
          issue: selected.value,
          options: options.value,
          range: range.value
        }, null, 8, ["issue", "options", "range"])) : createCommentVNode("v-if", true),
        confirmIssue.value && confirmAction.value ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
          createElementVNode(
            "p",
            null,
            toDisplayString(unref(signozT)("signoz.panel.confirmAction").replace("{id}", String(confirmIssue.value.alertId || confirmIssue.value.id)).replace(
              "{action}",
              confirmAction.value === "signoz.acknowledge" ? unref(signozT)("signoz.panel.acknowledge") : unref(signozT)("signoz.panel.resolve")
            )),
            1
            /* TEXT */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "issue-confirm-ok",
              onClick: confirmRun
            },
            toDisplayString(unref(signozT)("signoz.common.confirm")),
            1
            /* TEXT */
          ),
          createElementVNode(
            "button",
            {
              type: "button",
              "data-testid": "issue-confirm-cancel",
              onClick: cancelConfirm
            },
            toDisplayString(unref(signozT)("signoz.common.cancel")),
            1
            /* TEXT */
          )
        ])) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const IssuesPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__scopeId", "data-v-1d4b366c"]]);
const plugin$1 = new VuePanelPlugin(
  { id: "signoz-issues", name: signozT("signoz.panel.pluginName"), state: "stable" },
  IssuesPanel
).setPanelOptions((builder) => {
  builder.addNumber(
    {
      id: "pageSize",
      path: "pageSize",
      name: signozT("signoz.panel.pageSize"),
      editor: "number"
    },
    50
  ).addBoolean(
    {
      id: "showTraceDetail",
      path: "showTraceDetail",
      name: signozT("signoz.panel.showTraceDetail"),
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "showAttributes",
      path: "showAttributes",
      name: signozT("signoz.panel.showAttributes"),
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "showTraceLink",
      path: "showTraceLink",
      name: signozT("signoz.panel.showTraceLink"),
      editor: "boolean"
    },
    true
  ).addBoolean(
    {
      id: "showDatasource",
      path: "showDatasource",
      name: signozT("signoz.panel.showDatasource"),
      editor: "boolean"
    },
    false
  );
}).setRuntimeConsumedPaths([
  "layout",
  "pageSize",
  "showTraceDetail",
  "sources",
  "service",
  "environment",
  "operation",
  "attributeFilters",
  "severities",
  "minDurationMs",
  "maxDurationMs",
  "sort",
  "limit",
  "highlightNew",
  "highlightWindowMs",
  "showAttributes",
  "showTraceLink",
  "showDatasource"
]).register();
const module$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: plugin$1
}, Symbol.toStringTag, { value: "Module" }));
function nextQueryName(items) {
  const used = new Set(items.map((item) => item.spec.name));
  for (const name of "ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
    if (!used.has(name)) return name;
  }
  let index2 = 1;
  while (used.has(`Q${index2}`)) index2 += 1;
  return `Q${index2}`;
}
const QUERY_NAMES = "ABCDEFGHIJ";
function nextQueryNameByLength(length) {
  return QUERY_NAMES[length] ?? `Q${length + 1}`;
}
function nextFormulaNameByLength(length) {
  return `F${length + 1}`;
}
function deepClone$1(v) {
  return JSON.parse(JSON.stringify(v));
}
function cloneBuilderSpec(spec) {
  return deepClone$1(spec);
}
function emptyState(mode2 = "builder") {
  return {
    activeQueryType: mode2,
    builder: {
      queries: [defaultBuilderSpec("A", "traces")],
      formulas: [],
      traceOperators: []
    },
    promql: [],
    clickhouseSql: []
  };
}
function toEditorState(query) {
  const q = query || {};
  if (q.editor && typeof q.editor === "object") {
    return deepClone$1(q.editor);
  }
  const items = Array.isArray(q.queries) ? q.queries : [];
  if (!items.length) return emptyState();
  const modes = /* @__PURE__ */ new Set();
  const state2 = emptyState();
  state2.builder.queries = [];
  for (const item of items) {
    if (item.type === "builder_formula") {
      const f = item.spec;
      state2.builder.formulas.push(
        deepClone$1({
          name: f?.name || "F1",
          expression: f?.expression || "",
          disabled: Boolean(f?.disabled),
          legend: f?.legend || "",
          order: Array.isArray(f?.order) ? f.order : [],
          limit: f?.limit
        })
      );
      modes.add("builder");
      continue;
    }
    if (item.type === "builder_trace_operator") {
      state2.builder.traceOperators.push(deepClone$1(item.spec));
      modes.add("builder");
      continue;
    }
    if (item.type !== "builder_query") continue;
    const qt = item.queryType || "builder";
    modes.add(qt);
    if (qt === "promql") {
      state2.promql.push({
        name: item.spec?.name || "A",
        query: String(item.rawQuery || ""),
        legend: item.rawLegend || item.spec?.legend,
        disabled: item.spec?.disabled
      });
    } else if (qt === "clickhouse_sql") {
      state2.clickhouseSql.push({
        name: item.spec?.name || "A",
        query: String(item.rawQuery || ""),
        legend: item.rawLegend || item.spec?.legend,
        disabled: item.spec?.disabled
      });
    } else {
      state2.builder.queries.push(cloneBuilderSpec(item.spec));
    }
  }
  if (!state2.builder.queries.length) {
    state2.builder.queries = [defaultBuilderSpec("A", "traces")];
  }
  const modeList = [...modes].filter(
    (m) => m === "builder" || m === "promql" || m === "clickhouse_sql"
  );
  if (modeList.length > 1) {
    state2.legacyMixed = true;
    state2.legacySchema1 = deepClone$1(items);
    state2.activeQueryType = modeList[0] || "builder";
  } else {
    state2.activeQueryType = modeList[0] || "builder";
  }
  return state2;
}
function fromEditorState(state2, base = {}) {
  if (state2.legacyMixed && state2.legacySchema1?.length) {
    return {
      refId: base.refId || "A",
      schema: 1,
      ...base,
      queries: deepClone$1(state2.legacySchema1),
      editor: deepClone$1(state2)
    };
  }
  const queries = [];
  if (state2.activeQueryType === "builder") {
    for (const spec of state2.builder.queries) {
      queries.push({
        type: "builder_query",
        queryType: "builder",
        spec: cloneBuilderSpec(spec)
      });
    }
    for (const f of state2.builder.formulas) {
      queries.push({ type: "builder_formula", spec: deepClone$1(f) });
    }
    for (const t2 of state2.builder.traceOperators) {
      queries.push({ type: "builder_trace_operator", spec: deepClone$1(t2) });
    }
  } else if (state2.activeQueryType === "promql") {
    for (const r of state2.promql.length ? state2.promql : [{ name: "A", query: "" }]) {
      queries.push({
        type: "builder_query",
        queryType: "promql",
        rawQuery: r.query,
        rawLegend: r.legend,
        spec: {
          ...defaultBuilderSpec(r.name, "metrics"),
          disabled: r.disabled,
          legend: r.legend
        }
      });
    }
  } else {
    for (const r of state2.clickhouseSql.length ? state2.clickhouseSql : [{ name: "A", query: "" }]) {
      queries.push({
        type: "builder_query",
        queryType: "clickhouse_sql",
        rawQuery: r.query,
        rawLegend: r.legend,
        spec: {
          ...defaultBuilderSpec(r.name, "logs"),
          disabled: r.disabled,
          legend: r.legend
        }
      });
    }
  }
  return {
    refId: base.refId || "A",
    schema: 2,
    apiProfile: base.apiProfile || "signoz-v5",
    requestType: base.requestType || "time_series",
    ...base,
    queries,
    editor: deepClone$1(state2)
  };
}
function commitGlobalMode(state2, mode2) {
  const next = deepClone$1(state2);
  next.activeQueryType = mode2;
  next.legacyMixed = false;
  next.legacySchema1 = void 0;
  return next;
}
const QUERY_TYPE_TABS_DEFAULT_SHOW_AGG = true;
const QUERY_ADD_ON_KEYS = [
  "group_by",
  "having",
  "order_by",
  "limit",
  "legend_format"
];
const METRIC_FUNCTIONS = [
  {
    value: "cutOffMin",
    label: "最小截断",
    showArg: true,
    argPlaceholder: "阈值"
  },
  {
    value: "cutOffMax",
    label: "最大截断",
    showArg: true,
    argPlaceholder: "阈值"
  },
  {
    value: "clampMin",
    label: "最小限制",
    showArg: true,
    argPlaceholder: "阈值"
  },
  {
    value: "clampMax",
    label: "最大限制",
    showArg: true,
    argPlaceholder: "阈值"
  },
  { value: "absolute", label: "绝对值", showArg: false },
  { value: "runningDiff", label: "运行差值", showArg: false },
  { value: "log2", label: "以 2 为底的对数", showArg: false },
  { value: "log10", label: "以 10 为底的对数", showArg: false },
  { value: "cumulativeSum", label: "累计求和", showArg: false },
  {
    value: "ewma3",
    label: "指数移动平均 3",
    showArg: true,
    argPlaceholder: "平滑系数"
  },
  {
    value: "ewma5",
    label: "指数移动平均 5",
    showArg: true,
    argPlaceholder: "平滑系数"
  },
  {
    value: "ewma7",
    label: "指数移动平均 7",
    showArg: true,
    argPlaceholder: "平滑系数"
  },
  { value: "median3", label: "中位数 3", showArg: false },
  { value: "median5", label: "中位数 5", showArg: false },
  { value: "median7", label: "中位数 7", showArg: false },
  {
    value: "timeShift",
    label: "时间偏移",
    showArg: true,
    argPlaceholder: "秒数"
  },
  { value: "fillZero", label: "填充零值", showArg: false }
];
const LOG_FUNCTIONS = [
  {
    value: "timeShift",
    label: "时间偏移",
    showArg: true,
    argPlaceholder: "秒数"
  }
];
const METRIC_TIME_AGG_BY_TYPE = {
  Sum: [
    { label: "速率", value: "rate" },
    { label: "增长量", value: "increase" }
  ],
  Gauge: [
    { label: "最新值", value: "latest" },
    { label: "求和", value: "sum" },
    { label: "平均值", value: "avg" },
    { label: "最小值", value: "min" },
    { label: "最大值", value: "max" },
    { label: "计数", value: "count" },
    { label: "去重计数", value: "count_distinct" }
  ]
};
const METRIC_SPACE_AGG_BY_TYPE = {
  Sum: [
    { label: "求和", value: "sum" },
    { label: "平均值", value: "avg" },
    { label: "最小值", value: "min" },
    { label: "最大值", value: "max" }
  ],
  Gauge: [
    { label: "求和", value: "sum" },
    { label: "平均值", value: "avg" },
    { label: "最小值", value: "min" },
    { label: "最大值", value: "max" }
  ],
  Histogram: [
    { label: "P50 分位数", value: "p50" },
    { label: "P75 分位数", value: "p75" },
    { label: "P90 分位数", value: "p90" },
    { label: "P95 分位数", value: "p95" },
    { label: "P99 分位数", value: "p99" }
  ],
  ExponentialHistogram: [
    { label: "P50 分位数", value: "p50" },
    { label: "P75 分位数", value: "p75" },
    { label: "P90 分位数", value: "p90" },
    { label: "P95 分位数", value: "p95" },
    { label: "P99 分位数", value: "p99" }
  ]
};
const METRIC_TIME_AGG_DEFAULT = [
  { label: "速率", value: "rate" },
  { label: "增长量", value: "increase" },
  { label: "求和", value: "sum" },
  { label: "平均值", value: "avg" },
  { label: "最小值", value: "min" },
  { label: "最大值", value: "max" },
  { label: "计数", value: "count" }
];
const METRIC_SPACE_AGG_DEFAULT = [
  { label: "求和", value: "sum" },
  { label: "平均值", value: "avg" },
  { label: "最小值", value: "min" },
  { label: "最大值", value: "max" }
];
function deepClone(value) {
  return JSON.parse(JSON.stringify(value));
}
function clock(opts) {
  return opts?.now?.() ?? Date.now();
}
function resolveDisplayFlags(input) {
  return {
    showAgg: Boolean(input?.showAgg),
    simple: Boolean(input?.simple),
    queryTypeTabsShowAggDefault: QUERY_TYPE_TABS_DEFAULT_SHOW_AGG
  };
}
function currentSignal(query, mode2) {
  return mode2 ?? query.signal;
}
function timeAggOps(metricType) {
  return METRIC_TIME_AGG_BY_TYPE[metricType] ?? METRIC_TIME_AGG_DEFAULT;
}
function spaceAggOps(metricType) {
  return METRIC_SPACE_AGG_BY_TYPE[metricType] ?? METRIC_SPACE_AGG_DEFAULT;
}
function functionOptionsForSignal(signal) {
  return signal === "logs" ? LOG_FUNCTIONS : METRIC_FUNCTIONS;
}
function visibleAddOnKeys(signal, mode2) {
  const s = mode2 ?? signal;
  return QUERY_ADD_ON_KEYS.filter((key) => {
    if (key === "group_by") return s !== "metrics";
    return true;
  });
}
function makeQuery(name, opts) {
  const ts = clock(opts);
  return {
    id: `${name}-${ts}`,
    name,
    signal: opts?.mode ?? "traces",
    where: "",
    aggregations: "count()",
    aggOp: "count",
    aggAttr: "",
    metricName: "",
    metricType: "",
    timeAggregation: "rate",
    spaceAggregation: "sum",
    groupBy: [],
    having: "",
    orderBy: "timestamp:desc",
    limit: 100,
    legend: "",
    step: 60,
    disabled: false,
    spanScope: "all_spans",
    expression: "",
    functions: [],
    _addOns: [],
    _collapsed: false,
    _keyOpts: [],
    _keysLoading: false,
    _metricOpts: [],
    _metricLoading: false
  };
}
function makeFormula(name, opts) {
  const ts = clock(opts);
  return {
    id: `f-${name}-${ts}`,
    name,
    expression: "",
    legend: "",
    having: "",
    orderBy: "",
    limit: 100,
    disabled: false,
    _addOns: [],
    _collapsed: false
  };
}
function createInitialState(opts) {
  return {
    queries: [makeQuery("A", opts)],
    formulas: []
  };
}
function addQuery(state2, opts) {
  const name = nextQueryNameByLength(state2.queries.length);
  return {
    queries: [...state2.queries.map(deepClone), makeQuery(name, opts)],
    formulas: state2.formulas.map(deepClone)
  };
}
function removeQuery(state2, index2) {
  if (index2 < 0 || index2 >= state2.queries.length) {
    return {
      queries: state2.queries.map(deepClone),
      formulas: state2.formulas.map(deepClone)
    };
  }
  return {
    queries: state2.queries.filter((_, i) => i !== index2).map(deepClone),
    formulas: state2.formulas.map(deepClone)
  };
}
function cloneQuery(state2, index2, opts) {
  if (index2 < 0 || index2 >= state2.queries.length) {
    return {
      queries: state2.queries.map(deepClone),
      formulas: state2.formulas.map(deepClone)
    };
  }
  const src = state2.queries[index2];
  const name = nextQueryNameByLength(state2.queries.length);
  const ts = clock(opts);
  const cloned = {
    ...deepClone(src),
    id: `${name}-${ts}`,
    name,
    disabled: false,
    _keyOpts: [],
    _keysLoading: false,
    _metricOpts: [],
    _metricLoading: false
  };
  return {
    queries: [...state2.queries.map(deepClone), cloned],
    formulas: state2.formulas.map(deepClone)
  };
}
function toggleDisabled(state2, index2) {
  return {
    queries: state2.queries.map(
      (q, i) => i === index2 ? { ...deepClone(q), disabled: !q.disabled } : deepClone(q)
    ),
    formulas: state2.formulas.map(deepClone)
  };
}
function toggleCollapse(state2, index2) {
  return {
    queries: state2.queries.map(
      (q, i) => i === index2 ? { ...deepClone(q), _collapsed: !q._collapsed } : deepClone(q)
    ),
    formulas: state2.formulas.map(deepClone)
  };
}
function addFormula(state2, opts) {
  const name = nextFormulaNameByLength(state2.formulas.length);
  return {
    queries: state2.queries.map(deepClone),
    formulas: [...state2.formulas.map(deepClone), makeFormula(name, opts)]
  };
}
function removeFormula(state2, index2) {
  if (index2 < 0 || index2 >= state2.formulas.length) {
    return {
      queries: state2.queries.map(deepClone),
      formulas: state2.formulas.map(deepClone)
    };
  }
  return {
    queries: state2.queries.map(deepClone),
    formulas: state2.formulas.filter((_, i) => i !== index2).map(deepClone)
  };
}
function toggleFormulaDisabled(state2, index2) {
  return {
    queries: state2.queries.map(deepClone),
    formulas: state2.formulas.map(
      (f, i) => i === index2 ? { ...deepClone(f), disabled: !f.disabled } : deepClone(f)
    )
  };
}
function toggleFormulaCollapse(state2, index2) {
  return {
    queries: state2.queries.map(deepClone),
    formulas: state2.formulas.map(
      (f, i) => i === index2 ? { ...deepClone(f), _collapsed: !f._collapsed } : deepClone(f)
    )
  };
}
function seedLegendFromGroupBy(query) {
  if (query.legend || !query.groupBy.length) return query.legend;
  return query.groupBy.map((g) => `{{${g}}}`).join("-");
}
function toggleAddOn(state2, queryIndex, key) {
  return {
    queries: state2.queries.map((q, i) => {
      if (i !== queryIndex) return deepClone(q);
      const next = deepClone(q);
      const idx = next._addOns.indexOf(key);
      if (idx === -1) {
        next._addOns = [...next._addOns, key];
        if (key === "legend_format") {
          next.legend = seedLegendFromGroupBy(next);
        }
      } else {
        next._addOns = next._addOns.filter((k) => k !== key);
      }
      return next;
    }),
    formulas: state2.formulas.map(deepClone)
  };
}
function toggleFormulaAddOn(state2, formulaIndex, key) {
  return {
    queries: state2.queries.map(deepClone),
    formulas: state2.formulas.map((f, i) => {
      if (i !== formulaIndex) return deepClone(f);
      const next = deepClone(f);
      const idx = next._addOns.indexOf(key);
      if (idx === -1) next._addOns = [...next._addOns, key];
      else next._addOns = next._addOns.filter((k) => k !== key);
      return next;
    })
  };
}
function setState(nextQueries, nextFormulas, opts) {
  const qIn = nextQueries && nextQueries.length ? deepClone(nextQueries) : null;
  const fIn = nextFormulas && nextFormulas.length ? deepClone(nextFormulas) : deepClone([]);
  const queries = qIn ? qIn.map((q) => {
    const name = q.name || "A";
    const base = makeQuery(name, opts);
    return {
      ...base,
      ...q,
      name: q.name || name
    };
  }) : [makeQuery("A", opts)];
  const formulas = (fIn ?? []).map((f) => {
    const name = f.name || "F1";
    const base = makeFormula(name, opts);
    return {
      ...base,
      ...f,
      name: f.name || name
    };
  });
  return {
    queries: queries.map(deepClone),
    formulas: formulas.map(deepClone)
  };
}
function applyMutation(state2, mutation) {
  let next;
  let shouldEmit = true;
  switch (mutation.type) {
    case "addQuery":
      next = addQuery(state2, mutation.opts);
      break;
    case "removeQuery":
      next = removeQuery(state2, mutation.index);
      break;
    case "cloneQuery":
      next = cloneQuery(state2, mutation.index, mutation.opts);
      break;
    case "toggleDisabled":
      next = toggleDisabled(state2, mutation.index);
      break;
    case "toggleCollapse":
      next = toggleCollapse(state2, mutation.index);
      shouldEmit = false;
      break;
    case "addFormula":
      next = addFormula(state2, mutation.opts);
      break;
    case "removeFormula":
      next = removeFormula(state2, mutation.index);
      break;
    case "toggleFormulaDisabled":
      next = toggleFormulaDisabled(state2, mutation.index);
      break;
    case "toggleFormulaCollapse":
      next = toggleFormulaCollapse(state2, mutation.index);
      shouldEmit = false;
      break;
    case "toggleAddOn":
      next = toggleAddOn(state2, mutation.queryIndex, mutation.key);
      break;
    case "toggleFormulaAddOn":
      next = toggleFormulaAddOn(state2, mutation.formulaIndex, mutation.key);
      break;
    case "setState":
      next = setState(mutation.queries, mutation.formulas, mutation.opts);
      shouldEmit = false;
      break;
    default: {
      next = {
        queries: state2.queries.map(deepClone),
        formulas: state2.formulas.map(deepClone)
      };
      shouldEmit = false;
    }
  }
  return {
    state: next,
    shouldEmit,
    event: shouldEmit ? { type: "change", queries: next.queries, formulas: next.formulas } : void 0
  };
}
function clampAggregationsForMetricType(query, metricType) {
  const next = deepClone(query);
  next.metricType = metricType;
  const timeOpts = timeAggOps(metricType);
  const spaceOpts = spaceAggOps(metricType);
  if (!timeOpts.some((o) => o.value === next.timeAggregation)) {
    next.timeAggregation = timeOpts[0]?.value ?? "rate";
  }
  if (!spaceOpts.some((o) => o.value === next.spaceAggregation)) {
    next.spaceAggregation = spaceOpts[0]?.value ?? "sum";
  }
  return next;
}
function addFunction(state2, queryIndex, mode2) {
  return {
    queries: state2.queries.map((q, i) => {
      if (i !== queryIndex) return deepClone(q);
      const next = deepClone(q);
      if (next.functions.length >= 3) return next;
      const opts = functionOptionsForSignal(currentSignal(next, mode2));
      next.functions = [...next.functions, { name: opts[0]?.value ?? "cutOffMin", arg: "" }];
      return next;
    }),
    formulas: state2.formulas.map(deepClone)
  };
}
function removeFunction(state2, queryIndex, functionIndex) {
  return {
    queries: state2.queries.map((q, i) => {
      if (i !== queryIndex) return deepClone(q);
      const next = deepClone(q);
      next.functions = next.functions.filter((_, fi) => fi !== functionIndex);
      return next;
    }),
    formulas: state2.formulas.map(deepClone)
  };
}
const AGG_OPS = [
  { value: "count", label: "计数", acceptsArgs: false, multiple: false },
  {
    value: "count_distinct",
    label: "去重计数",
    acceptsArgs: true,
    multiple: true
  },
  { value: "sum", label: "求和", acceptsArgs: true, multiple: false },
  { value: "avg", label: "平均值", acceptsArgs: true, multiple: false },
  { value: "max", label: "最大值", acceptsArgs: true, multiple: false },
  { value: "min", label: "最小值", acceptsArgs: true, multiple: false },
  { value: "p05", label: "P05 分位数", acceptsArgs: true, multiple: false },
  { value: "p10", label: "P10 分位数", acceptsArgs: true, multiple: false },
  { value: "p20", label: "P20 分位数", acceptsArgs: true, multiple: false },
  { value: "p25", label: "P25 分位数", acceptsArgs: true, multiple: false },
  { value: "p50", label: "P50 分位数", acceptsArgs: true, multiple: false },
  { value: "p75", label: "P75 分位数", acceptsArgs: true, multiple: false },
  { value: "p90", label: "P90 分位数", acceptsArgs: true, multiple: false },
  { value: "p95", label: "P95 分位数", acceptsArgs: true, multiple: false },
  { value: "p99", label: "P99 分位数", acceptsArgs: true, multiple: false },
  { value: "rate", label: "速率", acceptsArgs: false, multiple: false },
  { value: "rate_sum", label: "速率求和", acceptsArgs: true, multiple: false },
  {
    value: "rate_avg",
    label: "速率平均值",
    acceptsArgs: true,
    multiple: false
  },
  {
    value: "rate_min",
    label: "速率最小值",
    acceptsArgs: true,
    multiple: false
  },
  {
    value: "rate_max",
    label: "速率最大值",
    acceptsArgs: true,
    multiple: false
  },
  { value: "noop", label: "不操作", acceptsArgs: false, multiple: false }
];
const VALID_FUNCS = new Set(AGG_OPS.map((o) => o.value));
const ANY_TYPE_OPS = /* @__PURE__ */ new Set(["count", "count_distinct", "rate", "noop"]);
const NUMERIC_ONLY_OPS = new Set(
  AGG_OPS.map((o) => o.value).filter((v) => !ANY_TYPE_OPS.has(v))
);
function opMeta(name) {
  return AGG_OPS.find((o) => o.value === name.toLowerCase());
}
function getFunctionContextAtCursor(text, cursorPos) {
  let openParenIndex = -1;
  let funcName = null;
  let parenStack = 0;
  for (let i = cursorPos - 1; i >= 0; i--) {
    if (text[i] === ")") parenStack++;
    else if (text[i] === "(") {
      if (parenStack === 0) {
        openParenIndex = i;
        const before = text.slice(0, i);
        const match = before.match(/(\w+)\s*$/);
        if (match) funcName = match[1].toLowerCase();
        break;
      }
      parenStack--;
    }
  }
  if (openParenIndex === -1 || !funcName) return null;
  let closeParenIndex = -1;
  let depth = 1;
  for (let j = openParenIndex + 1; j < text.length; j++) {
    if (text[j] === "(") depth++;
    else if (text[j] === ")") depth--;
    if (depth === 0) {
      closeParenIndex = j;
      break;
    }
  }
  if (cursorPos > openParenIndex && (closeParenIndex === -1 || cursorPos <= closeParenIndex)) {
    return funcName;
  }
  return null;
}
function validateAggregations(text) {
  if (!text.trim()) return null;
  if (/([a-z_]\w*)\s*\([^)]*$/i.test(text)) {
    return "函数调用不完整：缺少右括号";
  }
  const re = /([a-z_]\w*)\s*\(([^)]*)\)/gi;
  let m;
  let sawCount = false;
  while ((m = re.exec(text)) !== null) {
    const fn = m[1].toLowerCase();
    if (!VALID_FUNCS.has(fn)) return `未知函数：${fn}`;
    const meta2 = opMeta(fn);
    if (meta2?.acceptsArgs && m[2].trim() === "") {
      return `函数 ${fn}() 需要参数`;
    }
    if (fn === "count") {
      if (sawCount) return "count() 只能出现一次";
      sawCount = true;
    }
  }
  return null;
}
function requiresNumericFieldKeys(funcName) {
  return NUMERIC_ONLY_OPS.has(funcName.toLowerCase());
}
const _hoisted_1$9 = ["data-testid"];
const _hoisted_2$9 = ["aria-label"];
const _hoisted_3$8 = {
  key: 0,
  class: "qae-interval"
};
const _hoisted_4$5 = { class: "qae-interval-label" };
const _hoisted_5$5 = { class: "qae-step-box" };
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  __name: "QueryAggregationEditor",
  props: {
    modelValue: {},
    signal: { default: "traces" },
    showInterval: { type: Boolean, default: false },
    stepInterval: { default: null },
    loadKeys: {},
    testId: {}
  },
  emits: ["update:modelValue", "update:stepInterval", "run"],
  setup(__props, { emit: __emit }) {
    const CHIP_PATTERN = /\b([a-z_]\w*)\s*\(([^)]*)\)/gi;
    function chipValidate(_matched, groups) {
      return VALID_FUNCS.has((groups[0] || "").toLowerCase());
    }
    const props = __props;
    const emit = __emit;
    const validationError = computed(() => validateAggregations(props.modelValue || ""));
    const stepLocal = ref(props.stepInterval == null ? "" : String(props.stepInterval));
    watch(
      () => props.stepInterval,
      (v) => {
        stepLocal.value = v == null ? "" : String(v);
      }
    );
    function onStepInput(v) {
      stepLocal.value = v;
      if (v.trim() === "") {
        emit("update:stepInterval", null);
        return;
      }
      const n = Number(v);
      if (Number.isFinite(n) && n >= 1) emit("update:stepInterval", Math.floor(n));
    }
    async function completionSource(context) {
      const text = context.state.doc.toString();
      const pos = context.pos;
      const func = getFunctionContextAtCursor(text, pos);
      if (func && props.loadKeys) {
        const word2 = context.matchBefore(/[\w./-]*$/);
        const from2 = word2?.from ?? pos;
        const search = word2?.text ?? "";
        const keys = await props.loadKeys({
          signal: props.signal || "traces",
          searchText: search,
          fieldDataType: requiresNumericFieldKeys(func) ? "number" : void 0
        });
        return {
          from: from2,
          options: keys.map((k) => ({
            label: k.name,
            type: "variable",
            detail: k.dataType || "",
            apply: k.name
          }))
        };
      }
      const word = context.matchBefore(/[a-z_]\w*/i);
      if (!word && !context.explicit) return null;
      const from = word?.from ?? pos;
      const prefix = (word?.text || "").toLowerCase();
      const options = AGG_OPS.filter((o) => o.value.startsWith(prefix) || !prefix).map((o) => ({
        label: o.value,
        type: "keyword",
        detail: o.label,
        apply: o.acceptsArgs ? `${o.value}(` : `${o.value}()`
      }));
      return options.length ? { from, options } : null;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "qae",
        "data-testid": __props.testId || "query-aggregation-editor"
      }, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["qae-editor-wrap", { "qae-editor-wrap--error": Boolean(validationError.value) }])
          },
          [
            createVNode(unref(GQueryExpressionEditor), {
              "model-value": __props.modelValue,
              "completion-source": completionSource,
              invalid: Boolean(validationError.value),
              placeholder: "count()",
              "aria-label": unref(signozT)("signoz.queryBuilder.agg", "聚合"),
              "chip-pattern": CHIP_PATTERN,
              "chip-validate": chipValidate,
              embedded: true,
              "font-size": 13,
              "test-id": "query-aggregation-cm",
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event)),
              onRun: _cache[1] || (_cache[1] = ($event) => emit("run"))
            }, null, 8, ["model-value", "completion-source", "invalid", "aria-label"]),
            validationError.value ? (openBlock(), createBlock(unref(_sfc_main$y$1), {
              key: 0,
              title: validationError.value
            }, {
              default: withCtx(() => [
                createElementVNode("span", {
                  class: "qae-error",
                  "aria-label": unref(signozT)("signoz.queryBuilder.validationError")
                }, "!", 8, _hoisted_2$9)
              ]),
              _: 1
              /* STABLE */
            }, 8, ["title"])) : (openBlock(), createBlock(unref(_sfc_main$y$1), {
              key: 1,
              title: unref(signozT)("signoz.queryBuilder.aggregationHelp")
            }, {
              default: withCtx(() => [
                createVNode(unref(GIcon), {
                  name: "info",
                  size: 14,
                  class: "qae-info-icon"
                })
              ]),
              _: 1
              /* STABLE */
            }, 8, ["title"]))
          ],
          2
          /* CLASS */
        ),
        __props.showInterval ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
          createElementVNode(
            "span",
            _hoisted_4$5,
            toDisplayString(unref(signozT)("signoz.queryBuilder.step")),
            1
            /* TEXT */
          ),
          createElementVNode("div", _hoisted_5$5, [
            createVNode(unref(GInput), {
              class: "qae-step-input",
              "model-value": stepLocal.value,
              type: "number",
              placeholder: unref(signozT)("signoz.queryBuilder.stepAuto"),
              "data-testid": "query-aggregation-step",
              "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => onStepInput(String($event ?? "")))
            }, null, 8, ["model-value", "placeholder"]),
            _cache[3] || (_cache[3] = createElementVNode(
              "div",
              {
                class: "qae-step-controls",
                "aria-hidden": "true"
              },
              [
                createElementVNode("span", { class: "qae-step-btn qae-step-btn--up" }),
                createElementVNode("span", { class: "qae-step-btn qae-step-btn--down" })
              ],
              -1
              /* CACHED */
            ))
          ]),
          _cache[4] || (_cache[4] = createElementVNode(
            "span",
            { class: "qae-interval-unit" },
            "s",
            -1
            /* CACHED */
          ))
        ])) : createCommentVNode("v-if", true)
      ], 8, _hoisted_1$9);
    };
  }
});
const QueryAggregationEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-afa1950c"]]);
const OPERATORS = {
  "EXISTS": "EXISTS",
  "NOT": "NOT"
};
const NON_VALUE_OPERATORS = [OPERATORS.EXISTS];
class FilterQueryLexer extends Lexer {
  static LPAREN = 1;
  static RPAREN = 2;
  static LBRACK = 3;
  static RBRACK = 4;
  static COMMA = 5;
  static EQUALS = 6;
  static NOT_EQUALS = 7;
  static NEQ = 8;
  static LT = 9;
  static LE = 10;
  static GT = 11;
  static GE = 12;
  static LIKE = 13;
  static ILIKE = 14;
  static BETWEEN = 15;
  static EXISTS = 16;
  static REGEXP = 17;
  static CONTAINS = 18;
  static IN = 19;
  static NOT = 20;
  static AND = 21;
  static OR = 22;
  static HASTOKEN = 23;
  static HAS = 24;
  static HASANY = 25;
  static HASALL = 26;
  static BOOL = 27;
  static NUMBER = 28;
  static QUOTED_TEXT = 29;
  static KEY = 30;
  static WS = 31;
  static FREETEXT = 32;
  static EOF = Token.EOF;
  static channelNames = ["DEFAULT_TOKEN_CHANNEL", "HIDDEN"];
  static literalNames = [
    null,
    "'('",
    "')'",
    "'['",
    "']'",
    "','",
    null,
    "'!='",
    "'<>'",
    "'<'",
    "'<='",
    "'>'",
    "'>='"
  ];
  static symbolicNames = [
    null,
    "LPAREN",
    "RPAREN",
    "LBRACK",
    "RBRACK",
    "COMMA",
    "EQUALS",
    "NOT_EQUALS",
    "NEQ",
    "LT",
    "LE",
    "GT",
    "GE",
    "LIKE",
    "ILIKE",
    "BETWEEN",
    "EXISTS",
    "REGEXP",
    "CONTAINS",
    "IN",
    "NOT",
    "AND",
    "OR",
    "HASTOKEN",
    "HAS",
    "HASANY",
    "HASALL",
    "BOOL",
    "NUMBER",
    "QUOTED_TEXT",
    "KEY",
    "WS",
    "FREETEXT"
  ];
  static modeNames = ["DEFAULT_MODE"];
  static ruleNames = [
    "LPAREN",
    "RPAREN",
    "LBRACK",
    "RBRACK",
    "COMMA",
    "EQUALS",
    "NOT_EQUALS",
    "NEQ",
    "LT",
    "LE",
    "GT",
    "GE",
    "LIKE",
    "ILIKE",
    "BETWEEN",
    "EXISTS",
    "REGEXP",
    "CONTAINS",
    "IN",
    "NOT",
    "AND",
    "OR",
    "HASTOKEN",
    "HAS",
    "HASANY",
    "HASALL",
    "BOOL",
    "SIGN",
    "NUMBER",
    "QUOTED_TEXT",
    "SEGMENT",
    "EMPTY_BRACKS",
    "OLD_JSON_BRACKS",
    "KEY",
    "WS",
    "DIGIT",
    "FREETEXT"
  ];
  constructor(input) {
    super(input);
    this._interp = new LexerATNSimulator(
      this,
      FilterQueryLexer._ATN,
      FilterQueryLexer.DecisionsToDFA,
      new PredictionContextCache()
    );
  }
  get grammarFileName() {
    return "FilterQuery.g4";
  }
  get literalNames() {
    return FilterQueryLexer.literalNames;
  }
  get symbolicNames() {
    return FilterQueryLexer.symbolicNames;
  }
  get ruleNames() {
    return FilterQueryLexer.ruleNames;
  }
  get serializedATN() {
    return FilterQueryLexer._serializedATN;
  }
  get channelNames() {
    return FilterQueryLexer.channelNames;
  }
  get modeNames() {
    return FilterQueryLexer.modeNames;
  }
  static _serializedATN = [
    4,
    0,
    32,
    320,
    6,
    -1,
    2,
    0,
    7,
    0,
    2,
    1,
    7,
    1,
    2,
    2,
    7,
    2,
    2,
    3,
    7,
    3,
    2,
    4,
    7,
    4,
    2,
    5,
    7,
    5,
    2,
    6,
    7,
    6,
    2,
    7,
    7,
    7,
    2,
    8,
    7,
    8,
    2,
    9,
    7,
    9,
    2,
    10,
    7,
    10,
    2,
    11,
    7,
    11,
    2,
    12,
    7,
    12,
    2,
    13,
    7,
    13,
    2,
    14,
    7,
    14,
    2,
    15,
    7,
    15,
    2,
    16,
    7,
    16,
    2,
    17,
    7,
    17,
    2,
    18,
    7,
    18,
    2,
    19,
    7,
    19,
    2,
    20,
    7,
    20,
    2,
    21,
    7,
    21,
    2,
    22,
    7,
    22,
    2,
    23,
    7,
    23,
    2,
    24,
    7,
    24,
    2,
    25,
    7,
    25,
    2,
    26,
    7,
    26,
    2,
    27,
    7,
    27,
    2,
    28,
    7,
    28,
    2,
    29,
    7,
    29,
    2,
    30,
    7,
    30,
    2,
    31,
    7,
    31,
    2,
    32,
    7,
    32,
    2,
    33,
    7,
    33,
    2,
    34,
    7,
    34,
    2,
    35,
    7,
    35,
    2,
    36,
    7,
    36,
    1,
    0,
    1,
    0,
    1,
    1,
    1,
    1,
    1,
    2,
    1,
    2,
    1,
    3,
    1,
    3,
    1,
    4,
    1,
    4,
    1,
    5,
    1,
    5,
    1,
    5,
    3,
    5,
    89,
    8,
    5,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    8,
    1,
    8,
    1,
    9,
    1,
    9,
    1,
    9,
    1,
    10,
    1,
    10,
    1,
    11,
    1,
    11,
    1,
    11,
    1,
    12,
    1,
    12,
    1,
    12,
    1,
    12,
    1,
    12,
    1,
    13,
    1,
    13,
    1,
    13,
    1,
    13,
    1,
    13,
    1,
    13,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    15,
    1,
    15,
    1,
    15,
    1,
    15,
    1,
    15,
    1,
    15,
    3,
    15,
    132,
    8,
    15,
    1,
    16,
    1,
    16,
    1,
    16,
    1,
    16,
    1,
    16,
    1,
    16,
    1,
    16,
    1,
    17,
    1,
    17,
    1,
    17,
    1,
    17,
    1,
    17,
    1,
    17,
    1,
    17,
    1,
    17,
    3,
    17,
    149,
    8,
    17,
    1,
    18,
    1,
    18,
    1,
    18,
    1,
    19,
    1,
    19,
    1,
    19,
    1,
    19,
    1,
    20,
    1,
    20,
    1,
    20,
    1,
    20,
    1,
    21,
    1,
    21,
    1,
    21,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    22,
    1,
    23,
    1,
    23,
    1,
    23,
    1,
    23,
    1,
    24,
    1,
    24,
    1,
    24,
    1,
    24,
    1,
    24,
    1,
    24,
    1,
    24,
    1,
    25,
    1,
    25,
    1,
    25,
    1,
    25,
    1,
    25,
    1,
    25,
    1,
    25,
    1,
    26,
    1,
    26,
    1,
    26,
    1,
    26,
    1,
    26,
    1,
    26,
    1,
    26,
    1,
    26,
    1,
    26,
    3,
    26,
    201,
    8,
    26,
    1,
    27,
    1,
    27,
    1,
    28,
    3,
    28,
    206,
    8,
    28,
    1,
    28,
    4,
    28,
    209,
    8,
    28,
    11,
    28,
    12,
    28,
    210,
    1,
    28,
    1,
    28,
    5,
    28,
    215,
    8,
    28,
    10,
    28,
    12,
    28,
    218,
    9,
    28,
    3,
    28,
    220,
    8,
    28,
    1,
    28,
    1,
    28,
    3,
    28,
    224,
    8,
    28,
    1,
    28,
    4,
    28,
    227,
    8,
    28,
    11,
    28,
    12,
    28,
    228,
    3,
    28,
    231,
    8,
    28,
    1,
    28,
    3,
    28,
    234,
    8,
    28,
    1,
    28,
    1,
    28,
    4,
    28,
    238,
    8,
    28,
    11,
    28,
    12,
    28,
    239,
    1,
    28,
    1,
    28,
    3,
    28,
    244,
    8,
    28,
    1,
    28,
    4,
    28,
    247,
    8,
    28,
    11,
    28,
    12,
    28,
    248,
    3,
    28,
    251,
    8,
    28,
    3,
    28,
    253,
    8,
    28,
    1,
    29,
    1,
    29,
    1,
    29,
    1,
    29,
    5,
    29,
    259,
    8,
    29,
    10,
    29,
    12,
    29,
    262,
    9,
    29,
    1,
    29,
    1,
    29,
    1,
    29,
    1,
    29,
    1,
    29,
    5,
    29,
    269,
    8,
    29,
    10,
    29,
    12,
    29,
    272,
    9,
    29,
    1,
    29,
    3,
    29,
    275,
    8,
    29,
    1,
    30,
    1,
    30,
    5,
    30,
    279,
    8,
    30,
    10,
    30,
    12,
    30,
    282,
    9,
    30,
    1,
    31,
    1,
    31,
    1,
    31,
    1,
    32,
    1,
    32,
    1,
    32,
    1,
    32,
    1,
    33,
    1,
    33,
    1,
    33,
    1,
    33,
    1,
    33,
    1,
    33,
    1,
    33,
    4,
    33,
    298,
    8,
    33,
    11,
    33,
    12,
    33,
    299,
    5,
    33,
    302,
    8,
    33,
    10,
    33,
    12,
    33,
    305,
    9,
    33,
    1,
    34,
    4,
    34,
    308,
    8,
    34,
    11,
    34,
    12,
    34,
    309,
    1,
    34,
    1,
    34,
    1,
    35,
    1,
    35,
    1,
    36,
    4,
    36,
    317,
    8,
    36,
    11,
    36,
    12,
    36,
    318,
    0,
    0,
    37,
    1,
    1,
    3,
    2,
    5,
    3,
    7,
    4,
    9,
    5,
    11,
    6,
    13,
    7,
    15,
    8,
    17,
    9,
    19,
    10,
    21,
    11,
    23,
    12,
    25,
    13,
    27,
    14,
    29,
    15,
    31,
    16,
    33,
    17,
    35,
    18,
    37,
    19,
    39,
    20,
    41,
    21,
    43,
    22,
    45,
    23,
    47,
    24,
    49,
    25,
    51,
    26,
    53,
    27,
    55,
    0,
    57,
    28,
    59,
    29,
    61,
    0,
    63,
    0,
    65,
    0,
    67,
    30,
    69,
    31,
    71,
    0,
    73,
    32,
    1,
    0,
    29,
    2,
    0,
    76,
    76,
    108,
    108,
    2,
    0,
    73,
    73,
    105,
    105,
    2,
    0,
    75,
    75,
    107,
    107,
    2,
    0,
    69,
    69,
    101,
    101,
    2,
    0,
    66,
    66,
    98,
    98,
    2,
    0,
    84,
    84,
    116,
    116,
    2,
    0,
    87,
    87,
    119,
    119,
    2,
    0,
    78,
    78,
    110,
    110,
    2,
    0,
    88,
    88,
    120,
    120,
    2,
    0,
    83,
    83,
    115,
    115,
    2,
    0,
    82,
    82,
    114,
    114,
    2,
    0,
    71,
    71,
    103,
    103,
    2,
    0,
    80,
    80,
    112,
    112,
    2,
    0,
    67,
    67,
    99,
    99,
    2,
    0,
    79,
    79,
    111,
    111,
    2,
    0,
    65,
    65,
    97,
    97,
    2,
    0,
    68,
    68,
    100,
    100,
    2,
    0,
    72,
    72,
    104,
    104,
    2,
    0,
    89,
    89,
    121,
    121,
    2,
    0,
    85,
    85,
    117,
    117,
    2,
    0,
    70,
    70,
    102,
    102,
    2,
    0,
    43,
    43,
    45,
    45,
    2,
    0,
    34,
    34,
    92,
    92,
    2,
    0,
    39,
    39,
    92,
    92,
    4,
    0,
    35,
    36,
    64,
    90,
    95,
    95,
    97,
    123,
    7,
    0,
    35,
    36,
    45,
    45,
    47,
    58,
    64,
    90,
    95,
    95,
    97,
    123,
    125,
    125,
    3,
    0,
    9,
    10,
    13,
    13,
    32,
    32,
    1,
    0,
    48,
    57,
    8,
    0,
    9,
    10,
    13,
    13,
    32,
    34,
    39,
    41,
    44,
    44,
    60,
    62,
    91,
    91,
    93,
    93,
    344,
    0,
    1,
    1,
    0,
    0,
    0,
    0,
    3,
    1,
    0,
    0,
    0,
    0,
    5,
    1,
    0,
    0,
    0,
    0,
    7,
    1,
    0,
    0,
    0,
    0,
    9,
    1,
    0,
    0,
    0,
    0,
    11,
    1,
    0,
    0,
    0,
    0,
    13,
    1,
    0,
    0,
    0,
    0,
    15,
    1,
    0,
    0,
    0,
    0,
    17,
    1,
    0,
    0,
    0,
    0,
    19,
    1,
    0,
    0,
    0,
    0,
    21,
    1,
    0,
    0,
    0,
    0,
    23,
    1,
    0,
    0,
    0,
    0,
    25,
    1,
    0,
    0,
    0,
    0,
    27,
    1,
    0,
    0,
    0,
    0,
    29,
    1,
    0,
    0,
    0,
    0,
    31,
    1,
    0,
    0,
    0,
    0,
    33,
    1,
    0,
    0,
    0,
    0,
    35,
    1,
    0,
    0,
    0,
    0,
    37,
    1,
    0,
    0,
    0,
    0,
    39,
    1,
    0,
    0,
    0,
    0,
    41,
    1,
    0,
    0,
    0,
    0,
    43,
    1,
    0,
    0,
    0,
    0,
    45,
    1,
    0,
    0,
    0,
    0,
    47,
    1,
    0,
    0,
    0,
    0,
    49,
    1,
    0,
    0,
    0,
    0,
    51,
    1,
    0,
    0,
    0,
    0,
    53,
    1,
    0,
    0,
    0,
    0,
    57,
    1,
    0,
    0,
    0,
    0,
    59,
    1,
    0,
    0,
    0,
    0,
    67,
    1,
    0,
    0,
    0,
    0,
    69,
    1,
    0,
    0,
    0,
    0,
    73,
    1,
    0,
    0,
    0,
    1,
    75,
    1,
    0,
    0,
    0,
    3,
    77,
    1,
    0,
    0,
    0,
    5,
    79,
    1,
    0,
    0,
    0,
    7,
    81,
    1,
    0,
    0,
    0,
    9,
    83,
    1,
    0,
    0,
    0,
    11,
    88,
    1,
    0,
    0,
    0,
    13,
    90,
    1,
    0,
    0,
    0,
    15,
    93,
    1,
    0,
    0,
    0,
    17,
    96,
    1,
    0,
    0,
    0,
    19,
    98,
    1,
    0,
    0,
    0,
    21,
    101,
    1,
    0,
    0,
    0,
    23,
    103,
    1,
    0,
    0,
    0,
    25,
    106,
    1,
    0,
    0,
    0,
    27,
    111,
    1,
    0,
    0,
    0,
    29,
    117,
    1,
    0,
    0,
    0,
    31,
    125,
    1,
    0,
    0,
    0,
    33,
    133,
    1,
    0,
    0,
    0,
    35,
    140,
    1,
    0,
    0,
    0,
    37,
    150,
    1,
    0,
    0,
    0,
    39,
    153,
    1,
    0,
    0,
    0,
    41,
    157,
    1,
    0,
    0,
    0,
    43,
    161,
    1,
    0,
    0,
    0,
    45,
    164,
    1,
    0,
    0,
    0,
    47,
    173,
    1,
    0,
    0,
    0,
    49,
    177,
    1,
    0,
    0,
    0,
    51,
    184,
    1,
    0,
    0,
    0,
    53,
    200,
    1,
    0,
    0,
    0,
    55,
    202,
    1,
    0,
    0,
    0,
    57,
    252,
    1,
    0,
    0,
    0,
    59,
    274,
    1,
    0,
    0,
    0,
    61,
    276,
    1,
    0,
    0,
    0,
    63,
    283,
    1,
    0,
    0,
    0,
    65,
    286,
    1,
    0,
    0,
    0,
    67,
    290,
    1,
    0,
    0,
    0,
    69,
    307,
    1,
    0,
    0,
    0,
    71,
    313,
    1,
    0,
    0,
    0,
    73,
    316,
    1,
    0,
    0,
    0,
    75,
    76,
    5,
    40,
    0,
    0,
    76,
    2,
    1,
    0,
    0,
    0,
    77,
    78,
    5,
    41,
    0,
    0,
    78,
    4,
    1,
    0,
    0,
    0,
    79,
    80,
    5,
    91,
    0,
    0,
    80,
    6,
    1,
    0,
    0,
    0,
    81,
    82,
    5,
    93,
    0,
    0,
    82,
    8,
    1,
    0,
    0,
    0,
    83,
    84,
    5,
    44,
    0,
    0,
    84,
    10,
    1,
    0,
    0,
    0,
    85,
    89,
    5,
    61,
    0,
    0,
    86,
    87,
    5,
    61,
    0,
    0,
    87,
    89,
    5,
    61,
    0,
    0,
    88,
    85,
    1,
    0,
    0,
    0,
    88,
    86,
    1,
    0,
    0,
    0,
    89,
    12,
    1,
    0,
    0,
    0,
    90,
    91,
    5,
    33,
    0,
    0,
    91,
    92,
    5,
    61,
    0,
    0,
    92,
    14,
    1,
    0,
    0,
    0,
    93,
    94,
    5,
    60,
    0,
    0,
    94,
    95,
    5,
    62,
    0,
    0,
    95,
    16,
    1,
    0,
    0,
    0,
    96,
    97,
    5,
    60,
    0,
    0,
    97,
    18,
    1,
    0,
    0,
    0,
    98,
    99,
    5,
    60,
    0,
    0,
    99,
    100,
    5,
    61,
    0,
    0,
    100,
    20,
    1,
    0,
    0,
    0,
    101,
    102,
    5,
    62,
    0,
    0,
    102,
    22,
    1,
    0,
    0,
    0,
    103,
    104,
    5,
    62,
    0,
    0,
    104,
    105,
    5,
    61,
    0,
    0,
    105,
    24,
    1,
    0,
    0,
    0,
    106,
    107,
    7,
    0,
    0,
    0,
    107,
    108,
    7,
    1,
    0,
    0,
    108,
    109,
    7,
    2,
    0,
    0,
    109,
    110,
    7,
    3,
    0,
    0,
    110,
    26,
    1,
    0,
    0,
    0,
    111,
    112,
    7,
    1,
    0,
    0,
    112,
    113,
    7,
    0,
    0,
    0,
    113,
    114,
    7,
    1,
    0,
    0,
    114,
    115,
    7,
    2,
    0,
    0,
    115,
    116,
    7,
    3,
    0,
    0,
    116,
    28,
    1,
    0,
    0,
    0,
    117,
    118,
    7,
    4,
    0,
    0,
    118,
    119,
    7,
    3,
    0,
    0,
    119,
    120,
    7,
    5,
    0,
    0,
    120,
    121,
    7,
    6,
    0,
    0,
    121,
    122,
    7,
    3,
    0,
    0,
    122,
    123,
    7,
    3,
    0,
    0,
    123,
    124,
    7,
    7,
    0,
    0,
    124,
    30,
    1,
    0,
    0,
    0,
    125,
    126,
    7,
    3,
    0,
    0,
    126,
    127,
    7,
    8,
    0,
    0,
    127,
    128,
    7,
    1,
    0,
    0,
    128,
    129,
    7,
    9,
    0,
    0,
    129,
    131,
    7,
    5,
    0,
    0,
    130,
    132,
    7,
    9,
    0,
    0,
    131,
    130,
    1,
    0,
    0,
    0,
    131,
    132,
    1,
    0,
    0,
    0,
    132,
    32,
    1,
    0,
    0,
    0,
    133,
    134,
    7,
    10,
    0,
    0,
    134,
    135,
    7,
    3,
    0,
    0,
    135,
    136,
    7,
    11,
    0,
    0,
    136,
    137,
    7,
    3,
    0,
    0,
    137,
    138,
    7,
    8,
    0,
    0,
    138,
    139,
    7,
    12,
    0,
    0,
    139,
    34,
    1,
    0,
    0,
    0,
    140,
    141,
    7,
    13,
    0,
    0,
    141,
    142,
    7,
    14,
    0,
    0,
    142,
    143,
    7,
    7,
    0,
    0,
    143,
    144,
    7,
    5,
    0,
    0,
    144,
    145,
    7,
    15,
    0,
    0,
    145,
    146,
    7,
    1,
    0,
    0,
    146,
    148,
    7,
    7,
    0,
    0,
    147,
    149,
    7,
    9,
    0,
    0,
    148,
    147,
    1,
    0,
    0,
    0,
    148,
    149,
    1,
    0,
    0,
    0,
    149,
    36,
    1,
    0,
    0,
    0,
    150,
    151,
    7,
    1,
    0,
    0,
    151,
    152,
    7,
    7,
    0,
    0,
    152,
    38,
    1,
    0,
    0,
    0,
    153,
    154,
    7,
    7,
    0,
    0,
    154,
    155,
    7,
    14,
    0,
    0,
    155,
    156,
    7,
    5,
    0,
    0,
    156,
    40,
    1,
    0,
    0,
    0,
    157,
    158,
    7,
    15,
    0,
    0,
    158,
    159,
    7,
    7,
    0,
    0,
    159,
    160,
    7,
    16,
    0,
    0,
    160,
    42,
    1,
    0,
    0,
    0,
    161,
    162,
    7,
    14,
    0,
    0,
    162,
    163,
    7,
    10,
    0,
    0,
    163,
    44,
    1,
    0,
    0,
    0,
    164,
    165,
    7,
    17,
    0,
    0,
    165,
    166,
    7,
    15,
    0,
    0,
    166,
    167,
    7,
    9,
    0,
    0,
    167,
    168,
    7,
    5,
    0,
    0,
    168,
    169,
    7,
    14,
    0,
    0,
    169,
    170,
    7,
    2,
    0,
    0,
    170,
    171,
    7,
    3,
    0,
    0,
    171,
    172,
    7,
    7,
    0,
    0,
    172,
    46,
    1,
    0,
    0,
    0,
    173,
    174,
    7,
    17,
    0,
    0,
    174,
    175,
    7,
    15,
    0,
    0,
    175,
    176,
    7,
    9,
    0,
    0,
    176,
    48,
    1,
    0,
    0,
    0,
    177,
    178,
    7,
    17,
    0,
    0,
    178,
    179,
    7,
    15,
    0,
    0,
    179,
    180,
    7,
    9,
    0,
    0,
    180,
    181,
    7,
    15,
    0,
    0,
    181,
    182,
    7,
    7,
    0,
    0,
    182,
    183,
    7,
    18,
    0,
    0,
    183,
    50,
    1,
    0,
    0,
    0,
    184,
    185,
    7,
    17,
    0,
    0,
    185,
    186,
    7,
    15,
    0,
    0,
    186,
    187,
    7,
    9,
    0,
    0,
    187,
    188,
    7,
    15,
    0,
    0,
    188,
    189,
    7,
    0,
    0,
    0,
    189,
    190,
    7,
    0,
    0,
    0,
    190,
    52,
    1,
    0,
    0,
    0,
    191,
    192,
    7,
    5,
    0,
    0,
    192,
    193,
    7,
    10,
    0,
    0,
    193,
    194,
    7,
    19,
    0,
    0,
    194,
    201,
    7,
    3,
    0,
    0,
    195,
    196,
    7,
    20,
    0,
    0,
    196,
    197,
    7,
    15,
    0,
    0,
    197,
    198,
    7,
    0,
    0,
    0,
    198,
    199,
    7,
    9,
    0,
    0,
    199,
    201,
    7,
    3,
    0,
    0,
    200,
    191,
    1,
    0,
    0,
    0,
    200,
    195,
    1,
    0,
    0,
    0,
    201,
    54,
    1,
    0,
    0,
    0,
    202,
    203,
    7,
    21,
    0,
    0,
    203,
    56,
    1,
    0,
    0,
    0,
    204,
    206,
    3,
    55,
    27,
    0,
    205,
    204,
    1,
    0,
    0,
    0,
    205,
    206,
    1,
    0,
    0,
    0,
    206,
    208,
    1,
    0,
    0,
    0,
    207,
    209,
    3,
    71,
    35,
    0,
    208,
    207,
    1,
    0,
    0,
    0,
    209,
    210,
    1,
    0,
    0,
    0,
    210,
    208,
    1,
    0,
    0,
    0,
    210,
    211,
    1,
    0,
    0,
    0,
    211,
    219,
    1,
    0,
    0,
    0,
    212,
    216,
    5,
    46,
    0,
    0,
    213,
    215,
    3,
    71,
    35,
    0,
    214,
    213,
    1,
    0,
    0,
    0,
    215,
    218,
    1,
    0,
    0,
    0,
    216,
    214,
    1,
    0,
    0,
    0,
    216,
    217,
    1,
    0,
    0,
    0,
    217,
    220,
    1,
    0,
    0,
    0,
    218,
    216,
    1,
    0,
    0,
    0,
    219,
    212,
    1,
    0,
    0,
    0,
    219,
    220,
    1,
    0,
    0,
    0,
    220,
    230,
    1,
    0,
    0,
    0,
    221,
    223,
    7,
    3,
    0,
    0,
    222,
    224,
    3,
    55,
    27,
    0,
    223,
    222,
    1,
    0,
    0,
    0,
    223,
    224,
    1,
    0,
    0,
    0,
    224,
    226,
    1,
    0,
    0,
    0,
    225,
    227,
    3,
    71,
    35,
    0,
    226,
    225,
    1,
    0,
    0,
    0,
    227,
    228,
    1,
    0,
    0,
    0,
    228,
    226,
    1,
    0,
    0,
    0,
    228,
    229,
    1,
    0,
    0,
    0,
    229,
    231,
    1,
    0,
    0,
    0,
    230,
    221,
    1,
    0,
    0,
    0,
    230,
    231,
    1,
    0,
    0,
    0,
    231,
    253,
    1,
    0,
    0,
    0,
    232,
    234,
    3,
    55,
    27,
    0,
    233,
    232,
    1,
    0,
    0,
    0,
    233,
    234,
    1,
    0,
    0,
    0,
    234,
    235,
    1,
    0,
    0,
    0,
    235,
    237,
    5,
    46,
    0,
    0,
    236,
    238,
    3,
    71,
    35,
    0,
    237,
    236,
    1,
    0,
    0,
    0,
    238,
    239,
    1,
    0,
    0,
    0,
    239,
    237,
    1,
    0,
    0,
    0,
    239,
    240,
    1,
    0,
    0,
    0,
    240,
    250,
    1,
    0,
    0,
    0,
    241,
    243,
    7,
    3,
    0,
    0,
    242,
    244,
    3,
    55,
    27,
    0,
    243,
    242,
    1,
    0,
    0,
    0,
    243,
    244,
    1,
    0,
    0,
    0,
    244,
    246,
    1,
    0,
    0,
    0,
    245,
    247,
    3,
    71,
    35,
    0,
    246,
    245,
    1,
    0,
    0,
    0,
    247,
    248,
    1,
    0,
    0,
    0,
    248,
    246,
    1,
    0,
    0,
    0,
    248,
    249,
    1,
    0,
    0,
    0,
    249,
    251,
    1,
    0,
    0,
    0,
    250,
    241,
    1,
    0,
    0,
    0,
    250,
    251,
    1,
    0,
    0,
    0,
    251,
    253,
    1,
    0,
    0,
    0,
    252,
    205,
    1,
    0,
    0,
    0,
    252,
    233,
    1,
    0,
    0,
    0,
    253,
    58,
    1,
    0,
    0,
    0,
    254,
    260,
    5,
    34,
    0,
    0,
    255,
    259,
    8,
    22,
    0,
    0,
    256,
    257,
    5,
    92,
    0,
    0,
    257,
    259,
    9,
    0,
    0,
    0,
    258,
    255,
    1,
    0,
    0,
    0,
    258,
    256,
    1,
    0,
    0,
    0,
    259,
    262,
    1,
    0,
    0,
    0,
    260,
    258,
    1,
    0,
    0,
    0,
    260,
    261,
    1,
    0,
    0,
    0,
    261,
    263,
    1,
    0,
    0,
    0,
    262,
    260,
    1,
    0,
    0,
    0,
    263,
    275,
    5,
    34,
    0,
    0,
    264,
    270,
    5,
    39,
    0,
    0,
    265,
    269,
    8,
    23,
    0,
    0,
    266,
    267,
    5,
    92,
    0,
    0,
    267,
    269,
    9,
    0,
    0,
    0,
    268,
    265,
    1,
    0,
    0,
    0,
    268,
    266,
    1,
    0,
    0,
    0,
    269,
    272,
    1,
    0,
    0,
    0,
    270,
    268,
    1,
    0,
    0,
    0,
    270,
    271,
    1,
    0,
    0,
    0,
    271,
    273,
    1,
    0,
    0,
    0,
    272,
    270,
    1,
    0,
    0,
    0,
    273,
    275,
    5,
    39,
    0,
    0,
    274,
    254,
    1,
    0,
    0,
    0,
    274,
    264,
    1,
    0,
    0,
    0,
    275,
    60,
    1,
    0,
    0,
    0,
    276,
    280,
    7,
    24,
    0,
    0,
    277,
    279,
    7,
    25,
    0,
    0,
    278,
    277,
    1,
    0,
    0,
    0,
    279,
    282,
    1,
    0,
    0,
    0,
    280,
    278,
    1,
    0,
    0,
    0,
    280,
    281,
    1,
    0,
    0,
    0,
    281,
    62,
    1,
    0,
    0,
    0,
    282,
    280,
    1,
    0,
    0,
    0,
    283,
    284,
    5,
    91,
    0,
    0,
    284,
    285,
    5,
    93,
    0,
    0,
    285,
    64,
    1,
    0,
    0,
    0,
    286,
    287,
    5,
    91,
    0,
    0,
    287,
    288,
    5,
    42,
    0,
    0,
    288,
    289,
    5,
    93,
    0,
    0,
    289,
    66,
    1,
    0,
    0,
    0,
    290,
    303,
    3,
    61,
    30,
    0,
    291,
    292,
    5,
    46,
    0,
    0,
    292,
    302,
    3,
    61,
    30,
    0,
    293,
    302,
    3,
    63,
    31,
    0,
    294,
    302,
    3,
    65,
    32,
    0,
    295,
    297,
    5,
    46,
    0,
    0,
    296,
    298,
    3,
    71,
    35,
    0,
    297,
    296,
    1,
    0,
    0,
    0,
    298,
    299,
    1,
    0,
    0,
    0,
    299,
    297,
    1,
    0,
    0,
    0,
    299,
    300,
    1,
    0,
    0,
    0,
    300,
    302,
    1,
    0,
    0,
    0,
    301,
    291,
    1,
    0,
    0,
    0,
    301,
    293,
    1,
    0,
    0,
    0,
    301,
    294,
    1,
    0,
    0,
    0,
    301,
    295,
    1,
    0,
    0,
    0,
    302,
    305,
    1,
    0,
    0,
    0,
    303,
    301,
    1,
    0,
    0,
    0,
    303,
    304,
    1,
    0,
    0,
    0,
    304,
    68,
    1,
    0,
    0,
    0,
    305,
    303,
    1,
    0,
    0,
    0,
    306,
    308,
    7,
    26,
    0,
    0,
    307,
    306,
    1,
    0,
    0,
    0,
    308,
    309,
    1,
    0,
    0,
    0,
    309,
    307,
    1,
    0,
    0,
    0,
    309,
    310,
    1,
    0,
    0,
    0,
    310,
    311,
    1,
    0,
    0,
    0,
    311,
    312,
    6,
    34,
    0,
    0,
    312,
    70,
    1,
    0,
    0,
    0,
    313,
    314,
    7,
    27,
    0,
    0,
    314,
    72,
    1,
    0,
    0,
    0,
    315,
    317,
    8,
    28,
    0,
    0,
    316,
    315,
    1,
    0,
    0,
    0,
    317,
    318,
    1,
    0,
    0,
    0,
    318,
    316,
    1,
    0,
    0,
    0,
    318,
    319,
    1,
    0,
    0,
    0,
    319,
    74,
    1,
    0,
    0,
    0,
    29,
    0,
    88,
    131,
    148,
    200,
    205,
    210,
    216,
    219,
    223,
    228,
    230,
    233,
    239,
    243,
    248,
    250,
    252,
    258,
    260,
    268,
    270,
    274,
    280,
    299,
    301,
    303,
    309,
    318,
    1,
    6,
    0,
    0
  ];
  static __ATN;
  static get _ATN() {
    if (!FilterQueryLexer.__ATN) {
      FilterQueryLexer.__ATN = new ATNDeserializer().deserialize(FilterQueryLexer._serializedATN);
    }
    return FilterQueryLexer.__ATN;
  }
  static DecisionsToDFA = FilterQueryLexer._ATN.decisionToState.map(
    (ds2, index2) => new DFA(ds2, index2)
  );
}
function isKeyToken(tokenType) {
  return tokenType === FilterQueryLexer.KEY;
}
function isOperatorToken(tokenType) {
  return [
    FilterQueryLexer.EQUALS,
    FilterQueryLexer.NOT_EQUALS,
    FilterQueryLexer.NEQ,
    FilterQueryLexer.LT,
    FilterQueryLexer.LE,
    FilterQueryLexer.GT,
    FilterQueryLexer.GE,
    FilterQueryLexer.LIKE,
    FilterQueryLexer.ILIKE,
    FilterQueryLexer.BETWEEN,
    FilterQueryLexer.EXISTS,
    FilterQueryLexer.REGEXP,
    FilterQueryLexer.CONTAINS,
    FilterQueryLexer.IN,
    FilterQueryLexer.NOT
  ].includes(tokenType);
}
function isNonValueOperatorToken(tokenType) {
  return [FilterQueryLexer.EXISTS].includes(tokenType);
}
function isValueToken(tokenType) {
  return [
    FilterQueryLexer.QUOTED_TEXT,
    FilterQueryLexer.NUMBER,
    FilterQueryLexer.BOOL,
    FilterQueryLexer.KEY
  ].includes(tokenType);
}
function isConjunctionToken(tokenType) {
  return [FilterQueryLexer.AND, FilterQueryLexer.OR].includes(tokenType);
}
function isBracketToken(tokenType) {
  return [
    FilterQueryLexer.LPAREN,
    FilterQueryLexer.RPAREN,
    FilterQueryLexer.LBRACK,
    FilterQueryLexer.RBRACK
  ].includes(tokenType);
}
function isMultiValueOperator(operatorToken) {
  if (!operatorToken) {
    return false;
  }
  const upperOp = operatorToken.toUpperCase();
  return upperOp === "IN";
}
function isFunctionToken(tokenType) {
  return [
    FilterQueryLexer.HAS,
    FilterQueryLexer.HASANY,
    FilterQueryLexer.HASALL,
    FilterQueryLexer.HASTOKEN
  ].includes(tokenType);
}
function isNonValueOperator(operator) {
  const upperOperator = operator.toUpperCase();
  if (NON_VALUE_OPERATORS.includes(upperOperator)) {
    return true;
  }
  if (upperOperator.startsWith(OPERATORS.NOT)) {
    const operatorWithoutNot = upperOperator.slice(4).trim();
    return NON_VALUE_OPERATORS.includes(operatorWithoutNot);
  }
  return false;
}
class FilterQueryParser extends Parser {
  static LPAREN = 1;
  static RPAREN = 2;
  static LBRACK = 3;
  static RBRACK = 4;
  static COMMA = 5;
  static EQUALS = 6;
  static NOT_EQUALS = 7;
  static NEQ = 8;
  static LT = 9;
  static LE = 10;
  static GT = 11;
  static GE = 12;
  static LIKE = 13;
  static ILIKE = 14;
  static BETWEEN = 15;
  static EXISTS = 16;
  static REGEXP = 17;
  static CONTAINS = 18;
  static IN = 19;
  static NOT = 20;
  static AND = 21;
  static OR = 22;
  static HASTOKEN = 23;
  static HAS = 24;
  static HASANY = 25;
  static HASALL = 26;
  static BOOL = 27;
  static NUMBER = 28;
  static QUOTED_TEXT = 29;
  static KEY = 30;
  static WS = 31;
  static FREETEXT = 32;
  static EOF = Token.EOF;
  static RULE_query = 0;
  static RULE_expression = 1;
  static RULE_orExpression = 2;
  static RULE_andExpression = 3;
  static RULE_unaryExpression = 4;
  static RULE_primary = 5;
  static RULE_comparison = 6;
  static RULE_inClause = 7;
  static RULE_notInClause = 8;
  static RULE_valueList = 9;
  static RULE_fullText = 10;
  static RULE_functionCall = 11;
  static RULE_functionParamList = 12;
  static RULE_functionParam = 13;
  static RULE_array = 14;
  static RULE_value = 15;
  static RULE_key = 16;
  static literalNames = [
    null,
    "'('",
    "')'",
    "'['",
    "']'",
    "','",
    null,
    "'!='",
    "'<>'",
    "'<'",
    "'<='",
    "'>'",
    "'>='"
  ];
  static symbolicNames = [
    null,
    "LPAREN",
    "RPAREN",
    "LBRACK",
    "RBRACK",
    "COMMA",
    "EQUALS",
    "NOT_EQUALS",
    "NEQ",
    "LT",
    "LE",
    "GT",
    "GE",
    "LIKE",
    "ILIKE",
    "BETWEEN",
    "EXISTS",
    "REGEXP",
    "CONTAINS",
    "IN",
    "NOT",
    "AND",
    "OR",
    "HASTOKEN",
    "HAS",
    "HASANY",
    "HASALL",
    "BOOL",
    "NUMBER",
    "QUOTED_TEXT",
    "KEY",
    "WS",
    "FREETEXT"
  ];
  // tslint:disable:no-trailing-whitespace
  static ruleNames = [
    "query",
    "expression",
    "orExpression",
    "andExpression",
    "unaryExpression",
    "primary",
    "comparison",
    "inClause",
    "notInClause",
    "valueList",
    "fullText",
    "functionCall",
    "functionParamList",
    "functionParam",
    "array",
    "value",
    "key"
  ];
  get grammarFileName() {
    return "FilterQuery.g4";
  }
  get literalNames() {
    return FilterQueryParser.literalNames;
  }
  get symbolicNames() {
    return FilterQueryParser.symbolicNames;
  }
  get ruleNames() {
    return FilterQueryParser.ruleNames;
  }
  get serializedATN() {
    return FilterQueryParser._serializedATN;
  }
  createFailedPredicateException(predicate, message2) {
    return new FailedPredicateException(this, predicate, message2);
  }
  constructor(input) {
    super(input);
    this._interp = new ParserATNSimulator(
      this,
      FilterQueryParser._ATN,
      FilterQueryParser.DecisionsToDFA,
      new PredictionContextCache()
    );
  }
  // @RuleVersion(0)
  query() {
    const localctx = new QueryContext(this, this._ctx, this.state);
    this.enterRule(localctx, 0, FilterQueryParser.RULE_query);
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 34;
        this.expression();
        this.state = 35;
        this.match(FilterQueryParser.EOF);
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  expression() {
    const localctx = new ExpressionContext(this, this._ctx, this.state);
    this.enterRule(localctx, 2, FilterQueryParser.RULE_expression);
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 37;
        this.orExpression();
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  orExpression() {
    const localctx = new OrExpressionContext(this, this._ctx, this.state);
    this.enterRule(localctx, 4, FilterQueryParser.RULE_orExpression);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 39;
        this.andExpression();
        this.state = 44;
        this._errHandler.sync(this);
        _la = this._input.LA(1);
        while (_la === 22) {
          {
            {
              this.state = 40;
              this.match(FilterQueryParser.OR);
              this.state = 41;
              this.andExpression();
            }
          }
          this.state = 46;
          this._errHandler.sync(this);
          _la = this._input.LA(1);
        }
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  andExpression() {
    const localctx = new AndExpressionContext(this, this._ctx, this.state);
    this.enterRule(localctx, 6, FilterQueryParser.RULE_andExpression);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 47;
        this.unaryExpression();
        this.state = 53;
        this._errHandler.sync(this);
        _la = this._input.LA(1);
        while ((_la - 1 & ~31) === 0 && (1 << _la - 1 & 3218604033) !== 0) {
          {
            this.state = 51;
            this._errHandler.sync(this);
            switch (this._input.LA(1)) {
              case 21:
                {
                  this.state = 48;
                  this.match(FilterQueryParser.AND);
                  this.state = 49;
                  this.unaryExpression();
                }
                break;
              case 1:
              case 20:
              case 23:
              case 24:
              case 25:
              case 26:
              case 27:
              case 28:
              case 29:
              case 30:
              case 32:
                {
                  this.state = 50;
                  this.unaryExpression();
                }
                break;
              default:
                throw new NoViableAltException(this);
            }
          }
          this.state = 55;
          this._errHandler.sync(this);
          _la = this._input.LA(1);
        }
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  unaryExpression() {
    const localctx = new UnaryExpressionContext(
      this,
      this._ctx,
      this.state
    );
    this.enterRule(localctx, 8, FilterQueryParser.RULE_unaryExpression);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 57;
        this._errHandler.sync(this);
        _la = this._input.LA(1);
        if (_la === 20) {
          {
            this.state = 56;
            this.match(FilterQueryParser.NOT);
          }
        }
        this.state = 59;
        this.primary();
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  primary() {
    const localctx = new PrimaryContext(this, this._ctx, this.state);
    this.enterRule(localctx, 10, FilterQueryParser.RULE_primary);
    try {
      this.state = 70;
      this._errHandler.sync(this);
      switch (this._interp.adaptivePredict(this._input, 4, this._ctx)) {
        case 1:
          this.enterOuterAlt(localctx, 1);
          {
            this.state = 61;
            this.match(FilterQueryParser.LPAREN);
            this.state = 62;
            this.orExpression();
            this.state = 63;
            this.match(FilterQueryParser.RPAREN);
          }
          break;
        case 2:
          this.enterOuterAlt(localctx, 2);
          {
            this.state = 65;
            this.comparison();
          }
          break;
        case 3:
          this.enterOuterAlt(localctx, 3);
          {
            this.state = 66;
            this.functionCall();
          }
          break;
        case 4:
          this.enterOuterAlt(localctx, 4);
          {
            this.state = 67;
            this.fullText();
          }
          break;
        case 5:
          this.enterOuterAlt(localctx, 5);
          {
            this.state = 68;
            this.key();
          }
          break;
        case 6:
          this.enterOuterAlt(localctx, 6);
          {
            this.state = 69;
            this.value();
          }
          break;
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  comparison() {
    const localctx = new ComparisonContext(this, this._ctx, this.state);
    this.enterRule(localctx, 12, FilterQueryParser.RULE_comparison);
    let _la;
    try {
      this.state = 149;
      this._errHandler.sync(this);
      switch (this._interp.adaptivePredict(this._input, 5, this._ctx)) {
        case 1:
          this.enterOuterAlt(localctx, 1);
          {
            this.state = 72;
            this.key();
            this.state = 73;
            this.match(FilterQueryParser.EQUALS);
            this.state = 74;
            this.value();
          }
          break;
        case 2:
          this.enterOuterAlt(localctx, 2);
          {
            this.state = 76;
            this.key();
            this.state = 77;
            _la = this._input.LA(1);
            if (!(_la === 7 || _la === 8)) {
              this._errHandler.recoverInline(this);
            } else {
              this._errHandler.reportMatch(this);
              this.consume();
            }
            this.state = 78;
            this.value();
          }
          break;
        case 3:
          this.enterOuterAlt(localctx, 3);
          {
            this.state = 80;
            this.key();
            this.state = 81;
            this.match(FilterQueryParser.LT);
            this.state = 82;
            this.value();
          }
          break;
        case 4:
          this.enterOuterAlt(localctx, 4);
          {
            this.state = 84;
            this.key();
            this.state = 85;
            this.match(FilterQueryParser.LE);
            this.state = 86;
            this.value();
          }
          break;
        case 5:
          this.enterOuterAlt(localctx, 5);
          {
            this.state = 88;
            this.key();
            this.state = 89;
            this.match(FilterQueryParser.GT);
            this.state = 90;
            this.value();
          }
          break;
        case 6:
          this.enterOuterAlt(localctx, 6);
          {
            this.state = 92;
            this.key();
            this.state = 93;
            this.match(FilterQueryParser.GE);
            this.state = 94;
            this.value();
          }
          break;
        case 7:
          this.enterOuterAlt(localctx, 7);
          {
            this.state = 96;
            this.key();
            this.state = 97;
            _la = this._input.LA(1);
            if (!(_la === 13 || _la === 14)) {
              this._errHandler.recoverInline(this);
            } else {
              this._errHandler.reportMatch(this);
              this.consume();
            }
            this.state = 98;
            this.value();
          }
          break;
        case 8:
          this.enterOuterAlt(localctx, 8);
          {
            this.state = 100;
            this.key();
            this.state = 101;
            this.match(FilterQueryParser.NOT);
            this.state = 102;
            _la = this._input.LA(1);
            if (!(_la === 13 || _la === 14)) {
              this._errHandler.recoverInline(this);
            } else {
              this._errHandler.reportMatch(this);
              this.consume();
            }
            this.state = 103;
            this.value();
          }
          break;
        case 9:
          this.enterOuterAlt(localctx, 9);
          {
            this.state = 105;
            this.key();
            this.state = 106;
            this.match(FilterQueryParser.BETWEEN);
            this.state = 107;
            this.value();
            this.state = 108;
            this.match(FilterQueryParser.AND);
            this.state = 109;
            this.value();
          }
          break;
        case 10:
          this.enterOuterAlt(localctx, 10);
          {
            this.state = 111;
            this.key();
            this.state = 112;
            this.match(FilterQueryParser.NOT);
            this.state = 113;
            this.match(FilterQueryParser.BETWEEN);
            this.state = 114;
            this.value();
            this.state = 115;
            this.match(FilterQueryParser.AND);
            this.state = 116;
            this.value();
          }
          break;
        case 11:
          this.enterOuterAlt(localctx, 11);
          {
            this.state = 118;
            this.key();
            this.state = 119;
            this.inClause();
          }
          break;
        case 12:
          this.enterOuterAlt(localctx, 12);
          {
            this.state = 121;
            this.key();
            this.state = 122;
            this.notInClause();
          }
          break;
        case 13:
          this.enterOuterAlt(localctx, 13);
          {
            this.state = 124;
            this.key();
            this.state = 125;
            this.match(FilterQueryParser.EXISTS);
          }
          break;
        case 14:
          this.enterOuterAlt(localctx, 14);
          {
            this.state = 127;
            this.key();
            this.state = 128;
            this.match(FilterQueryParser.NOT);
            this.state = 129;
            this.match(FilterQueryParser.EXISTS);
          }
          break;
        case 15:
          this.enterOuterAlt(localctx, 15);
          {
            this.state = 131;
            this.key();
            this.state = 132;
            this.match(FilterQueryParser.REGEXP);
            this.state = 133;
            this.value();
          }
          break;
        case 16:
          this.enterOuterAlt(localctx, 16);
          {
            this.state = 135;
            this.key();
            this.state = 136;
            this.match(FilterQueryParser.NOT);
            this.state = 137;
            this.match(FilterQueryParser.REGEXP);
            this.state = 138;
            this.value();
          }
          break;
        case 17:
          this.enterOuterAlt(localctx, 17);
          {
            this.state = 140;
            this.key();
            this.state = 141;
            this.match(FilterQueryParser.CONTAINS);
            this.state = 142;
            this.value();
          }
          break;
        case 18:
          this.enterOuterAlt(localctx, 18);
          {
            this.state = 144;
            this.key();
            this.state = 145;
            this.match(FilterQueryParser.NOT);
            this.state = 146;
            this.match(FilterQueryParser.CONTAINS);
            this.state = 147;
            this.value();
          }
          break;
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  inClause() {
    const localctx = new InClauseContext(this, this._ctx, this.state);
    this.enterRule(localctx, 14, FilterQueryParser.RULE_inClause);
    try {
      this.state = 163;
      this._errHandler.sync(this);
      switch (this._interp.adaptivePredict(this._input, 6, this._ctx)) {
        case 1:
          this.enterOuterAlt(localctx, 1);
          {
            this.state = 151;
            this.match(FilterQueryParser.IN);
            this.state = 152;
            this.match(FilterQueryParser.LPAREN);
            this.state = 153;
            this.valueList();
            this.state = 154;
            this.match(FilterQueryParser.RPAREN);
          }
          break;
        case 2:
          this.enterOuterAlt(localctx, 2);
          {
            this.state = 156;
            this.match(FilterQueryParser.IN);
            this.state = 157;
            this.match(FilterQueryParser.LBRACK);
            this.state = 158;
            this.valueList();
            this.state = 159;
            this.match(FilterQueryParser.RBRACK);
          }
          break;
        case 3:
          this.enterOuterAlt(localctx, 3);
          {
            this.state = 161;
            this.match(FilterQueryParser.IN);
            this.state = 162;
            this.value();
          }
          break;
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  notInClause() {
    const localctx = new NotInClauseContext(this, this._ctx, this.state);
    this.enterRule(localctx, 16, FilterQueryParser.RULE_notInClause);
    try {
      this.state = 180;
      this._errHandler.sync(this);
      switch (this._interp.adaptivePredict(this._input, 7, this._ctx)) {
        case 1:
          this.enterOuterAlt(localctx, 1);
          {
            this.state = 165;
            this.match(FilterQueryParser.NOT);
            this.state = 166;
            this.match(FilterQueryParser.IN);
            this.state = 167;
            this.match(FilterQueryParser.LPAREN);
            this.state = 168;
            this.valueList();
            this.state = 169;
            this.match(FilterQueryParser.RPAREN);
          }
          break;
        case 2:
          this.enterOuterAlt(localctx, 2);
          {
            this.state = 171;
            this.match(FilterQueryParser.NOT);
            this.state = 172;
            this.match(FilterQueryParser.IN);
            this.state = 173;
            this.match(FilterQueryParser.LBRACK);
            this.state = 174;
            this.valueList();
            this.state = 175;
            this.match(FilterQueryParser.RBRACK);
          }
          break;
        case 3:
          this.enterOuterAlt(localctx, 3);
          {
            this.state = 177;
            this.match(FilterQueryParser.NOT);
            this.state = 178;
            this.match(FilterQueryParser.IN);
            this.state = 179;
            this.value();
          }
          break;
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  valueList() {
    const localctx = new ValueListContext(this, this._ctx, this.state);
    this.enterRule(localctx, 18, FilterQueryParser.RULE_valueList);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 182;
        this.value();
        this.state = 187;
        this._errHandler.sync(this);
        _la = this._input.LA(1);
        while (_la === 5) {
          {
            {
              this.state = 183;
              this.match(FilterQueryParser.COMMA);
              this.state = 184;
              this.value();
            }
          }
          this.state = 189;
          this._errHandler.sync(this);
          _la = this._input.LA(1);
        }
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  fullText() {
    const localctx = new FullTextContext(this, this._ctx, this.state);
    this.enterRule(localctx, 20, FilterQueryParser.RULE_fullText);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 190;
        _la = this._input.LA(1);
        if (!(_la === 29 || _la === 32)) {
          this._errHandler.recoverInline(this);
        } else {
          this._errHandler.reportMatch(this);
          this.consume();
        }
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  functionCall() {
    const localctx = new FunctionCallContext(this, this._ctx, this.state);
    this.enterRule(localctx, 22, FilterQueryParser.RULE_functionCall);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 192;
        _la = this._input.LA(1);
        if (!((_la & ~31) === 0 && (1 << _la & 125829120) !== 0)) {
          this._errHandler.recoverInline(this);
        } else {
          this._errHandler.reportMatch(this);
          this.consume();
        }
        this.state = 193;
        this.match(FilterQueryParser.LPAREN);
        this.state = 194;
        this.functionParamList();
        this.state = 195;
        this.match(FilterQueryParser.RPAREN);
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  functionParamList() {
    const localctx = new FunctionParamListContext(
      this,
      this._ctx,
      this.state
    );
    this.enterRule(localctx, 24, FilterQueryParser.RULE_functionParamList);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 197;
        this.functionParam();
        this.state = 202;
        this._errHandler.sync(this);
        _la = this._input.LA(1);
        while (_la === 5) {
          {
            {
              this.state = 198;
              this.match(FilterQueryParser.COMMA);
              this.state = 199;
              this.functionParam();
            }
          }
          this.state = 204;
          this._errHandler.sync(this);
          _la = this._input.LA(1);
        }
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  functionParam() {
    const localctx = new FunctionParamContext(this, this._ctx, this.state);
    this.enterRule(localctx, 26, FilterQueryParser.RULE_functionParam);
    try {
      this.state = 208;
      this._errHandler.sync(this);
      switch (this._interp.adaptivePredict(this._input, 10, this._ctx)) {
        case 1:
          this.enterOuterAlt(localctx, 1);
          {
            this.state = 205;
            this.key();
          }
          break;
        case 2:
          this.enterOuterAlt(localctx, 2);
          {
            this.state = 206;
            this.value();
          }
          break;
        case 3:
          this.enterOuterAlt(localctx, 3);
          {
            this.state = 207;
            this.array();
          }
          break;
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  array() {
    const localctx = new ArrayContext(this, this._ctx, this.state);
    this.enterRule(localctx, 28, FilterQueryParser.RULE_array);
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 210;
        this.match(FilterQueryParser.LBRACK);
        this.state = 211;
        this.valueList();
        this.state = 212;
        this.match(FilterQueryParser.RBRACK);
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  value() {
    const localctx = new ValueContext(this, this._ctx, this.state);
    this.enterRule(localctx, 30, FilterQueryParser.RULE_value);
    let _la;
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 214;
        _la = this._input.LA(1);
        if (!((_la & ~31) === 0 && (1 << _la & 2013265920) !== 0)) {
          this._errHandler.recoverInline(this);
        } else {
          this._errHandler.reportMatch(this);
          this.consume();
        }
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  // @RuleVersion(0)
  key() {
    const localctx = new KeyContext(this, this._ctx, this.state);
    this.enterRule(localctx, 32, FilterQueryParser.RULE_key);
    try {
      this.enterOuterAlt(localctx, 1);
      {
        this.state = 216;
        this.match(FilterQueryParser.KEY);
      }
    } catch (error) {
      if (error instanceof RecognitionException) {
        localctx.exception = error;
        this._errHandler.reportError(this, error);
        this._errHandler.recover(this, error);
      } else {
        throw error;
      }
    } finally {
      this.exitRule();
    }
    return localctx;
  }
  static _serializedATN = [
    4,
    1,
    32,
    219,
    2,
    0,
    7,
    0,
    2,
    1,
    7,
    1,
    2,
    2,
    7,
    2,
    2,
    3,
    7,
    3,
    2,
    4,
    7,
    4,
    2,
    5,
    7,
    5,
    2,
    6,
    7,
    6,
    2,
    7,
    7,
    7,
    2,
    8,
    7,
    8,
    2,
    9,
    7,
    9,
    2,
    10,
    7,
    10,
    2,
    11,
    7,
    11,
    2,
    12,
    7,
    12,
    2,
    13,
    7,
    13,
    2,
    14,
    7,
    14,
    2,
    15,
    7,
    15,
    2,
    16,
    7,
    16,
    1,
    0,
    1,
    0,
    1,
    0,
    1,
    1,
    1,
    1,
    1,
    2,
    1,
    2,
    1,
    2,
    5,
    2,
    43,
    8,
    2,
    10,
    2,
    12,
    2,
    46,
    9,
    2,
    1,
    3,
    1,
    3,
    1,
    3,
    1,
    3,
    5,
    3,
    52,
    8,
    3,
    10,
    3,
    12,
    3,
    55,
    9,
    3,
    1,
    4,
    3,
    4,
    58,
    8,
    4,
    1,
    4,
    1,
    4,
    1,
    5,
    1,
    5,
    1,
    5,
    1,
    5,
    1,
    5,
    1,
    5,
    1,
    5,
    1,
    5,
    1,
    5,
    3,
    5,
    71,
    8,
    5,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    1,
    6,
    3,
    6,
    150,
    8,
    6,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    1,
    7,
    3,
    7,
    164,
    8,
    7,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    1,
    8,
    3,
    8,
    181,
    8,
    8,
    1,
    9,
    1,
    9,
    1,
    9,
    5,
    9,
    186,
    8,
    9,
    10,
    9,
    12,
    9,
    189,
    9,
    9,
    1,
    10,
    1,
    10,
    1,
    11,
    1,
    11,
    1,
    11,
    1,
    11,
    1,
    11,
    1,
    12,
    1,
    12,
    1,
    12,
    5,
    12,
    201,
    8,
    12,
    10,
    12,
    12,
    12,
    204,
    9,
    12,
    1,
    13,
    1,
    13,
    1,
    13,
    3,
    13,
    209,
    8,
    13,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    14,
    1,
    15,
    1,
    15,
    1,
    16,
    1,
    16,
    1,
    16,
    0,
    0,
    17,
    0,
    2,
    4,
    6,
    8,
    10,
    12,
    14,
    16,
    18,
    20,
    22,
    24,
    26,
    28,
    30,
    32,
    0,
    5,
    1,
    0,
    7,
    8,
    1,
    0,
    13,
    14,
    2,
    0,
    29,
    29,
    32,
    32,
    1,
    0,
    23,
    26,
    1,
    0,
    27,
    30,
    235,
    0,
    34,
    1,
    0,
    0,
    0,
    2,
    37,
    1,
    0,
    0,
    0,
    4,
    39,
    1,
    0,
    0,
    0,
    6,
    47,
    1,
    0,
    0,
    0,
    8,
    57,
    1,
    0,
    0,
    0,
    10,
    70,
    1,
    0,
    0,
    0,
    12,
    149,
    1,
    0,
    0,
    0,
    14,
    163,
    1,
    0,
    0,
    0,
    16,
    180,
    1,
    0,
    0,
    0,
    18,
    182,
    1,
    0,
    0,
    0,
    20,
    190,
    1,
    0,
    0,
    0,
    22,
    192,
    1,
    0,
    0,
    0,
    24,
    197,
    1,
    0,
    0,
    0,
    26,
    208,
    1,
    0,
    0,
    0,
    28,
    210,
    1,
    0,
    0,
    0,
    30,
    214,
    1,
    0,
    0,
    0,
    32,
    216,
    1,
    0,
    0,
    0,
    34,
    35,
    3,
    2,
    1,
    0,
    35,
    36,
    5,
    0,
    0,
    1,
    36,
    1,
    1,
    0,
    0,
    0,
    37,
    38,
    3,
    4,
    2,
    0,
    38,
    3,
    1,
    0,
    0,
    0,
    39,
    44,
    3,
    6,
    3,
    0,
    40,
    41,
    5,
    22,
    0,
    0,
    41,
    43,
    3,
    6,
    3,
    0,
    42,
    40,
    1,
    0,
    0,
    0,
    43,
    46,
    1,
    0,
    0,
    0,
    44,
    42,
    1,
    0,
    0,
    0,
    44,
    45,
    1,
    0,
    0,
    0,
    45,
    5,
    1,
    0,
    0,
    0,
    46,
    44,
    1,
    0,
    0,
    0,
    47,
    53,
    3,
    8,
    4,
    0,
    48,
    49,
    5,
    21,
    0,
    0,
    49,
    52,
    3,
    8,
    4,
    0,
    50,
    52,
    3,
    8,
    4,
    0,
    51,
    48,
    1,
    0,
    0,
    0,
    51,
    50,
    1,
    0,
    0,
    0,
    52,
    55,
    1,
    0,
    0,
    0,
    53,
    51,
    1,
    0,
    0,
    0,
    53,
    54,
    1,
    0,
    0,
    0,
    54,
    7,
    1,
    0,
    0,
    0,
    55,
    53,
    1,
    0,
    0,
    0,
    56,
    58,
    5,
    20,
    0,
    0,
    57,
    56,
    1,
    0,
    0,
    0,
    57,
    58,
    1,
    0,
    0,
    0,
    58,
    59,
    1,
    0,
    0,
    0,
    59,
    60,
    3,
    10,
    5,
    0,
    60,
    9,
    1,
    0,
    0,
    0,
    61,
    62,
    5,
    1,
    0,
    0,
    62,
    63,
    3,
    4,
    2,
    0,
    63,
    64,
    5,
    2,
    0,
    0,
    64,
    71,
    1,
    0,
    0,
    0,
    65,
    71,
    3,
    12,
    6,
    0,
    66,
    71,
    3,
    22,
    11,
    0,
    67,
    71,
    3,
    20,
    10,
    0,
    68,
    71,
    3,
    32,
    16,
    0,
    69,
    71,
    3,
    30,
    15,
    0,
    70,
    61,
    1,
    0,
    0,
    0,
    70,
    65,
    1,
    0,
    0,
    0,
    70,
    66,
    1,
    0,
    0,
    0,
    70,
    67,
    1,
    0,
    0,
    0,
    70,
    68,
    1,
    0,
    0,
    0,
    70,
    69,
    1,
    0,
    0,
    0,
    71,
    11,
    1,
    0,
    0,
    0,
    72,
    73,
    3,
    32,
    16,
    0,
    73,
    74,
    5,
    6,
    0,
    0,
    74,
    75,
    3,
    30,
    15,
    0,
    75,
    150,
    1,
    0,
    0,
    0,
    76,
    77,
    3,
    32,
    16,
    0,
    77,
    78,
    7,
    0,
    0,
    0,
    78,
    79,
    3,
    30,
    15,
    0,
    79,
    150,
    1,
    0,
    0,
    0,
    80,
    81,
    3,
    32,
    16,
    0,
    81,
    82,
    5,
    9,
    0,
    0,
    82,
    83,
    3,
    30,
    15,
    0,
    83,
    150,
    1,
    0,
    0,
    0,
    84,
    85,
    3,
    32,
    16,
    0,
    85,
    86,
    5,
    10,
    0,
    0,
    86,
    87,
    3,
    30,
    15,
    0,
    87,
    150,
    1,
    0,
    0,
    0,
    88,
    89,
    3,
    32,
    16,
    0,
    89,
    90,
    5,
    11,
    0,
    0,
    90,
    91,
    3,
    30,
    15,
    0,
    91,
    150,
    1,
    0,
    0,
    0,
    92,
    93,
    3,
    32,
    16,
    0,
    93,
    94,
    5,
    12,
    0,
    0,
    94,
    95,
    3,
    30,
    15,
    0,
    95,
    150,
    1,
    0,
    0,
    0,
    96,
    97,
    3,
    32,
    16,
    0,
    97,
    98,
    7,
    1,
    0,
    0,
    98,
    99,
    3,
    30,
    15,
    0,
    99,
    150,
    1,
    0,
    0,
    0,
    100,
    101,
    3,
    32,
    16,
    0,
    101,
    102,
    5,
    20,
    0,
    0,
    102,
    103,
    7,
    1,
    0,
    0,
    103,
    104,
    3,
    30,
    15,
    0,
    104,
    150,
    1,
    0,
    0,
    0,
    105,
    106,
    3,
    32,
    16,
    0,
    106,
    107,
    5,
    15,
    0,
    0,
    107,
    108,
    3,
    30,
    15,
    0,
    108,
    109,
    5,
    21,
    0,
    0,
    109,
    110,
    3,
    30,
    15,
    0,
    110,
    150,
    1,
    0,
    0,
    0,
    111,
    112,
    3,
    32,
    16,
    0,
    112,
    113,
    5,
    20,
    0,
    0,
    113,
    114,
    5,
    15,
    0,
    0,
    114,
    115,
    3,
    30,
    15,
    0,
    115,
    116,
    5,
    21,
    0,
    0,
    116,
    117,
    3,
    30,
    15,
    0,
    117,
    150,
    1,
    0,
    0,
    0,
    118,
    119,
    3,
    32,
    16,
    0,
    119,
    120,
    3,
    14,
    7,
    0,
    120,
    150,
    1,
    0,
    0,
    0,
    121,
    122,
    3,
    32,
    16,
    0,
    122,
    123,
    3,
    16,
    8,
    0,
    123,
    150,
    1,
    0,
    0,
    0,
    124,
    125,
    3,
    32,
    16,
    0,
    125,
    126,
    5,
    16,
    0,
    0,
    126,
    150,
    1,
    0,
    0,
    0,
    127,
    128,
    3,
    32,
    16,
    0,
    128,
    129,
    5,
    20,
    0,
    0,
    129,
    130,
    5,
    16,
    0,
    0,
    130,
    150,
    1,
    0,
    0,
    0,
    131,
    132,
    3,
    32,
    16,
    0,
    132,
    133,
    5,
    17,
    0,
    0,
    133,
    134,
    3,
    30,
    15,
    0,
    134,
    150,
    1,
    0,
    0,
    0,
    135,
    136,
    3,
    32,
    16,
    0,
    136,
    137,
    5,
    20,
    0,
    0,
    137,
    138,
    5,
    17,
    0,
    0,
    138,
    139,
    3,
    30,
    15,
    0,
    139,
    150,
    1,
    0,
    0,
    0,
    140,
    141,
    3,
    32,
    16,
    0,
    141,
    142,
    5,
    18,
    0,
    0,
    142,
    143,
    3,
    30,
    15,
    0,
    143,
    150,
    1,
    0,
    0,
    0,
    144,
    145,
    3,
    32,
    16,
    0,
    145,
    146,
    5,
    20,
    0,
    0,
    146,
    147,
    5,
    18,
    0,
    0,
    147,
    148,
    3,
    30,
    15,
    0,
    148,
    150,
    1,
    0,
    0,
    0,
    149,
    72,
    1,
    0,
    0,
    0,
    149,
    76,
    1,
    0,
    0,
    0,
    149,
    80,
    1,
    0,
    0,
    0,
    149,
    84,
    1,
    0,
    0,
    0,
    149,
    88,
    1,
    0,
    0,
    0,
    149,
    92,
    1,
    0,
    0,
    0,
    149,
    96,
    1,
    0,
    0,
    0,
    149,
    100,
    1,
    0,
    0,
    0,
    149,
    105,
    1,
    0,
    0,
    0,
    149,
    111,
    1,
    0,
    0,
    0,
    149,
    118,
    1,
    0,
    0,
    0,
    149,
    121,
    1,
    0,
    0,
    0,
    149,
    124,
    1,
    0,
    0,
    0,
    149,
    127,
    1,
    0,
    0,
    0,
    149,
    131,
    1,
    0,
    0,
    0,
    149,
    135,
    1,
    0,
    0,
    0,
    149,
    140,
    1,
    0,
    0,
    0,
    149,
    144,
    1,
    0,
    0,
    0,
    150,
    13,
    1,
    0,
    0,
    0,
    151,
    152,
    5,
    19,
    0,
    0,
    152,
    153,
    5,
    1,
    0,
    0,
    153,
    154,
    3,
    18,
    9,
    0,
    154,
    155,
    5,
    2,
    0,
    0,
    155,
    164,
    1,
    0,
    0,
    0,
    156,
    157,
    5,
    19,
    0,
    0,
    157,
    158,
    5,
    3,
    0,
    0,
    158,
    159,
    3,
    18,
    9,
    0,
    159,
    160,
    5,
    4,
    0,
    0,
    160,
    164,
    1,
    0,
    0,
    0,
    161,
    162,
    5,
    19,
    0,
    0,
    162,
    164,
    3,
    30,
    15,
    0,
    163,
    151,
    1,
    0,
    0,
    0,
    163,
    156,
    1,
    0,
    0,
    0,
    163,
    161,
    1,
    0,
    0,
    0,
    164,
    15,
    1,
    0,
    0,
    0,
    165,
    166,
    5,
    20,
    0,
    0,
    166,
    167,
    5,
    19,
    0,
    0,
    167,
    168,
    5,
    1,
    0,
    0,
    168,
    169,
    3,
    18,
    9,
    0,
    169,
    170,
    5,
    2,
    0,
    0,
    170,
    181,
    1,
    0,
    0,
    0,
    171,
    172,
    5,
    20,
    0,
    0,
    172,
    173,
    5,
    19,
    0,
    0,
    173,
    174,
    5,
    3,
    0,
    0,
    174,
    175,
    3,
    18,
    9,
    0,
    175,
    176,
    5,
    4,
    0,
    0,
    176,
    181,
    1,
    0,
    0,
    0,
    177,
    178,
    5,
    20,
    0,
    0,
    178,
    179,
    5,
    19,
    0,
    0,
    179,
    181,
    3,
    30,
    15,
    0,
    180,
    165,
    1,
    0,
    0,
    0,
    180,
    171,
    1,
    0,
    0,
    0,
    180,
    177,
    1,
    0,
    0,
    0,
    181,
    17,
    1,
    0,
    0,
    0,
    182,
    187,
    3,
    30,
    15,
    0,
    183,
    184,
    5,
    5,
    0,
    0,
    184,
    186,
    3,
    30,
    15,
    0,
    185,
    183,
    1,
    0,
    0,
    0,
    186,
    189,
    1,
    0,
    0,
    0,
    187,
    185,
    1,
    0,
    0,
    0,
    187,
    188,
    1,
    0,
    0,
    0,
    188,
    19,
    1,
    0,
    0,
    0,
    189,
    187,
    1,
    0,
    0,
    0,
    190,
    191,
    7,
    2,
    0,
    0,
    191,
    21,
    1,
    0,
    0,
    0,
    192,
    193,
    7,
    3,
    0,
    0,
    193,
    194,
    5,
    1,
    0,
    0,
    194,
    195,
    3,
    24,
    12,
    0,
    195,
    196,
    5,
    2,
    0,
    0,
    196,
    23,
    1,
    0,
    0,
    0,
    197,
    202,
    3,
    26,
    13,
    0,
    198,
    199,
    5,
    5,
    0,
    0,
    199,
    201,
    3,
    26,
    13,
    0,
    200,
    198,
    1,
    0,
    0,
    0,
    201,
    204,
    1,
    0,
    0,
    0,
    202,
    200,
    1,
    0,
    0,
    0,
    202,
    203,
    1,
    0,
    0,
    0,
    203,
    25,
    1,
    0,
    0,
    0,
    204,
    202,
    1,
    0,
    0,
    0,
    205,
    209,
    3,
    32,
    16,
    0,
    206,
    209,
    3,
    30,
    15,
    0,
    207,
    209,
    3,
    28,
    14,
    0,
    208,
    205,
    1,
    0,
    0,
    0,
    208,
    206,
    1,
    0,
    0,
    0,
    208,
    207,
    1,
    0,
    0,
    0,
    209,
    27,
    1,
    0,
    0,
    0,
    210,
    211,
    5,
    3,
    0,
    0,
    211,
    212,
    3,
    18,
    9,
    0,
    212,
    213,
    5,
    4,
    0,
    0,
    213,
    29,
    1,
    0,
    0,
    0,
    214,
    215,
    7,
    4,
    0,
    0,
    215,
    31,
    1,
    0,
    0,
    0,
    216,
    217,
    5,
    30,
    0,
    0,
    217,
    33,
    1,
    0,
    0,
    0,
    11,
    44,
    51,
    53,
    57,
    70,
    149,
    163,
    180,
    187,
    202,
    208
  ];
  static __ATN;
  static get _ATN() {
    if (!FilterQueryParser.__ATN) {
      FilterQueryParser.__ATN = new ATNDeserializer().deserialize(FilterQueryParser._serializedATN);
    }
    return FilterQueryParser.__ATN;
  }
  static DecisionsToDFA = FilterQueryParser._ATN.decisionToState.map(
    (ds2, index2) => new DFA(ds2, index2)
  );
}
class QueryContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  expression() {
    return this.getTypedRuleContext(ExpressionContext, 0);
  }
  EOF() {
    return this.getToken(FilterQueryParser.EOF, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_query;
  }
  enterRule(listener) {
    if (listener.enterQuery) {
      listener.enterQuery(this);
    }
  }
  exitRule(listener) {
    if (listener.exitQuery) {
      listener.exitQuery(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitQuery) {
      return visitor.visitQuery(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class ExpressionContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  orExpression() {
    return this.getTypedRuleContext(OrExpressionContext, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_expression;
  }
  enterRule(listener) {
    if (listener.enterExpression) {
      listener.enterExpression(this);
    }
  }
  exitRule(listener) {
    if (listener.exitExpression) {
      listener.exitExpression(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitExpression) {
      return visitor.visitExpression(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class OrExpressionContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  andExpression_list() {
    return this.getTypedRuleContexts(AndExpressionContext);
  }
  andExpression(i) {
    return this.getTypedRuleContext(AndExpressionContext, i);
  }
  OR_list() {
    return this.getTokens(FilterQueryParser.OR);
  }
  OR(i) {
    return this.getToken(FilterQueryParser.OR, i);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_orExpression;
  }
  enterRule(listener) {
    if (listener.enterOrExpression) {
      listener.enterOrExpression(this);
    }
  }
  exitRule(listener) {
    if (listener.exitOrExpression) {
      listener.exitOrExpression(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitOrExpression) {
      return visitor.visitOrExpression(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class AndExpressionContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  unaryExpression_list() {
    return this.getTypedRuleContexts(UnaryExpressionContext);
  }
  unaryExpression(i) {
    return this.getTypedRuleContext(UnaryExpressionContext, i);
  }
  AND_list() {
    return this.getTokens(FilterQueryParser.AND);
  }
  AND(i) {
    return this.getToken(FilterQueryParser.AND, i);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_andExpression;
  }
  enterRule(listener) {
    if (listener.enterAndExpression) {
      listener.enterAndExpression(this);
    }
  }
  exitRule(listener) {
    if (listener.exitAndExpression) {
      listener.exitAndExpression(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitAndExpression) {
      return visitor.visitAndExpression(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class UnaryExpressionContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  primary() {
    return this.getTypedRuleContext(PrimaryContext, 0);
  }
  NOT() {
    return this.getToken(FilterQueryParser.NOT, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_unaryExpression;
  }
  enterRule(listener) {
    if (listener.enterUnaryExpression) {
      listener.enterUnaryExpression(this);
    }
  }
  exitRule(listener) {
    if (listener.exitUnaryExpression) {
      listener.exitUnaryExpression(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitUnaryExpression) {
      return visitor.visitUnaryExpression(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class PrimaryContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  LPAREN() {
    return this.getToken(FilterQueryParser.LPAREN, 0);
  }
  orExpression() {
    return this.getTypedRuleContext(OrExpressionContext, 0);
  }
  RPAREN() {
    return this.getToken(FilterQueryParser.RPAREN, 0);
  }
  comparison() {
    return this.getTypedRuleContext(ComparisonContext, 0);
  }
  functionCall() {
    return this.getTypedRuleContext(FunctionCallContext, 0);
  }
  fullText() {
    return this.getTypedRuleContext(FullTextContext, 0);
  }
  key() {
    return this.getTypedRuleContext(KeyContext, 0);
  }
  value() {
    return this.getTypedRuleContext(ValueContext, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_primary;
  }
  enterRule(listener) {
    if (listener.enterPrimary) {
      listener.enterPrimary(this);
    }
  }
  exitRule(listener) {
    if (listener.exitPrimary) {
      listener.exitPrimary(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitPrimary) {
      return visitor.visitPrimary(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class ComparisonContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  key() {
    return this.getTypedRuleContext(KeyContext, 0);
  }
  EQUALS() {
    return this.getToken(FilterQueryParser.EQUALS, 0);
  }
  value_list() {
    return this.getTypedRuleContexts(ValueContext);
  }
  value(i) {
    return this.getTypedRuleContext(ValueContext, i);
  }
  NOT_EQUALS() {
    return this.getToken(FilterQueryParser.NOT_EQUALS, 0);
  }
  NEQ() {
    return this.getToken(FilterQueryParser.NEQ, 0);
  }
  LT() {
    return this.getToken(FilterQueryParser.LT, 0);
  }
  LE() {
    return this.getToken(FilterQueryParser.LE, 0);
  }
  GT() {
    return this.getToken(FilterQueryParser.GT, 0);
  }
  GE() {
    return this.getToken(FilterQueryParser.GE, 0);
  }
  LIKE() {
    return this.getToken(FilterQueryParser.LIKE, 0);
  }
  ILIKE() {
    return this.getToken(FilterQueryParser.ILIKE, 0);
  }
  NOT() {
    return this.getToken(FilterQueryParser.NOT, 0);
  }
  BETWEEN() {
    return this.getToken(FilterQueryParser.BETWEEN, 0);
  }
  AND() {
    return this.getToken(FilterQueryParser.AND, 0);
  }
  inClause() {
    return this.getTypedRuleContext(InClauseContext, 0);
  }
  notInClause() {
    return this.getTypedRuleContext(NotInClauseContext, 0);
  }
  EXISTS() {
    return this.getToken(FilterQueryParser.EXISTS, 0);
  }
  REGEXP() {
    return this.getToken(FilterQueryParser.REGEXP, 0);
  }
  CONTAINS() {
    return this.getToken(FilterQueryParser.CONTAINS, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_comparison;
  }
  enterRule(listener) {
    if (listener.enterComparison) {
      listener.enterComparison(this);
    }
  }
  exitRule(listener) {
    if (listener.exitComparison) {
      listener.exitComparison(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitComparison) {
      return visitor.visitComparison(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class InClauseContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  IN() {
    return this.getToken(FilterQueryParser.IN, 0);
  }
  LPAREN() {
    return this.getToken(FilterQueryParser.LPAREN, 0);
  }
  valueList() {
    return this.getTypedRuleContext(ValueListContext, 0);
  }
  RPAREN() {
    return this.getToken(FilterQueryParser.RPAREN, 0);
  }
  LBRACK() {
    return this.getToken(FilterQueryParser.LBRACK, 0);
  }
  RBRACK() {
    return this.getToken(FilterQueryParser.RBRACK, 0);
  }
  value() {
    return this.getTypedRuleContext(ValueContext, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_inClause;
  }
  enterRule(listener) {
    if (listener.enterInClause) {
      listener.enterInClause(this);
    }
  }
  exitRule(listener) {
    if (listener.exitInClause) {
      listener.exitInClause(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitInClause) {
      return visitor.visitInClause(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class NotInClauseContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  NOT() {
    return this.getToken(FilterQueryParser.NOT, 0);
  }
  IN() {
    return this.getToken(FilterQueryParser.IN, 0);
  }
  LPAREN() {
    return this.getToken(FilterQueryParser.LPAREN, 0);
  }
  valueList() {
    return this.getTypedRuleContext(ValueListContext, 0);
  }
  RPAREN() {
    return this.getToken(FilterQueryParser.RPAREN, 0);
  }
  LBRACK() {
    return this.getToken(FilterQueryParser.LBRACK, 0);
  }
  RBRACK() {
    return this.getToken(FilterQueryParser.RBRACK, 0);
  }
  value() {
    return this.getTypedRuleContext(ValueContext, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_notInClause;
  }
  enterRule(listener) {
    if (listener.enterNotInClause) {
      listener.enterNotInClause(this);
    }
  }
  exitRule(listener) {
    if (listener.exitNotInClause) {
      listener.exitNotInClause(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitNotInClause) {
      return visitor.visitNotInClause(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class ValueListContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  value_list() {
    return this.getTypedRuleContexts(ValueContext);
  }
  value(i) {
    return this.getTypedRuleContext(ValueContext, i);
  }
  COMMA_list() {
    return this.getTokens(FilterQueryParser.COMMA);
  }
  COMMA(i) {
    return this.getToken(FilterQueryParser.COMMA, i);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_valueList;
  }
  enterRule(listener) {
    if (listener.enterValueList) {
      listener.enterValueList(this);
    }
  }
  exitRule(listener) {
    if (listener.exitValueList) {
      listener.exitValueList(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitValueList) {
      return visitor.visitValueList(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class FullTextContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  QUOTED_TEXT() {
    return this.getToken(FilterQueryParser.QUOTED_TEXT, 0);
  }
  FREETEXT() {
    return this.getToken(FilterQueryParser.FREETEXT, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_fullText;
  }
  enterRule(listener) {
    if (listener.enterFullText) {
      listener.enterFullText(this);
    }
  }
  exitRule(listener) {
    if (listener.exitFullText) {
      listener.exitFullText(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitFullText) {
      return visitor.visitFullText(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class FunctionCallContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  LPAREN() {
    return this.getToken(FilterQueryParser.LPAREN, 0);
  }
  functionParamList() {
    return this.getTypedRuleContext(FunctionParamListContext, 0);
  }
  RPAREN() {
    return this.getToken(FilterQueryParser.RPAREN, 0);
  }
  HASTOKEN() {
    return this.getToken(FilterQueryParser.HASTOKEN, 0);
  }
  HAS() {
    return this.getToken(FilterQueryParser.HAS, 0);
  }
  HASANY() {
    return this.getToken(FilterQueryParser.HASANY, 0);
  }
  HASALL() {
    return this.getToken(FilterQueryParser.HASALL, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_functionCall;
  }
  enterRule(listener) {
    if (listener.enterFunctionCall) {
      listener.enterFunctionCall(this);
    }
  }
  exitRule(listener) {
    if (listener.exitFunctionCall) {
      listener.exitFunctionCall(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitFunctionCall) {
      return visitor.visitFunctionCall(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class FunctionParamListContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  functionParam_list() {
    return this.getTypedRuleContexts(FunctionParamContext);
  }
  functionParam(i) {
    return this.getTypedRuleContext(FunctionParamContext, i);
  }
  COMMA_list() {
    return this.getTokens(FilterQueryParser.COMMA);
  }
  COMMA(i) {
    return this.getToken(FilterQueryParser.COMMA, i);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_functionParamList;
  }
  enterRule(listener) {
    if (listener.enterFunctionParamList) {
      listener.enterFunctionParamList(this);
    }
  }
  exitRule(listener) {
    if (listener.exitFunctionParamList) {
      listener.exitFunctionParamList(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitFunctionParamList) {
      return visitor.visitFunctionParamList(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class FunctionParamContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  key() {
    return this.getTypedRuleContext(KeyContext, 0);
  }
  value() {
    return this.getTypedRuleContext(ValueContext, 0);
  }
  array() {
    return this.getTypedRuleContext(ArrayContext, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_functionParam;
  }
  enterRule(listener) {
    if (listener.enterFunctionParam) {
      listener.enterFunctionParam(this);
    }
  }
  exitRule(listener) {
    if (listener.exitFunctionParam) {
      listener.exitFunctionParam(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitFunctionParam) {
      return visitor.visitFunctionParam(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class ArrayContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  LBRACK() {
    return this.getToken(FilterQueryParser.LBRACK, 0);
  }
  valueList() {
    return this.getTypedRuleContext(ValueListContext, 0);
  }
  RBRACK() {
    return this.getToken(FilterQueryParser.RBRACK, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_array;
  }
  enterRule(listener) {
    if (listener.enterArray) {
      listener.enterArray(this);
    }
  }
  exitRule(listener) {
    if (listener.exitArray) {
      listener.exitArray(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitArray) {
      return visitor.visitArray(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class ValueContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  QUOTED_TEXT() {
    return this.getToken(FilterQueryParser.QUOTED_TEXT, 0);
  }
  NUMBER() {
    return this.getToken(FilterQueryParser.NUMBER, 0);
  }
  BOOL() {
    return this.getToken(FilterQueryParser.BOOL, 0);
  }
  KEY() {
    return this.getToken(FilterQueryParser.KEY, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_value;
  }
  enterRule(listener) {
    if (listener.enterValue) {
      listener.enterValue(this);
    }
  }
  exitRule(listener) {
    if (listener.exitValue) {
      listener.exitValue(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitValue) {
      return visitor.visitValue(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class KeyContext extends ParserRuleContext {
  constructor(parser2, parent, invokingState) {
    super(parent, invokingState);
    this.parser = parser2;
  }
  KEY() {
    return this.getToken(FilterQueryParser.KEY, 0);
  }
  get ruleIndex() {
    return FilterQueryParser.RULE_key;
  }
  enterRule(listener) {
    if (listener.enterKey) {
      listener.enterKey(this);
    }
  }
  exitRule(listener) {
    if (listener.exitKey) {
      listener.exitKey(this);
    }
  }
  // @Override
  accept(visitor) {
    if (visitor.visitKey) {
      return visitor.visitKey(this);
    } else {
      return visitor.visitChildren(this);
    }
  }
}
class SilentErrorListener extends ErrorListener {
  // Truly silent — incomplete typing must not pollute console or fail harness.
  syntaxError() {
  }
}
class TypeTrackingListener {
  tokens = [];
  enterKey(ctx) {
    const token = ctx.KEY().symbol;
    this.tokens.push({
      text: token.text,
      startIndex: token.start,
      stopIndex: token.stop,
      type: "Key"
    });
  }
  enterValue(ctx) {
    const token = ctx.start;
    this.tokens.push({
      text: token.text,
      startIndex: token.start,
      stopIndex: token.stop,
      type: "Value"
    });
  }
  enterComparison(ctx) {
    const children = ctx.children || [];
    for (const child of children) {
      const token = child.symbol;
      if (token && isOperatorToken(token.type)) {
        this.tokens.push({
          text: token.text,
          startIndex: token.start,
          stopIndex: token.stop,
          type: "Operator"
        });
      }
    }
  }
  // Required no-op stubs
  enterEveryRule() {
  }
  exitEveryRule() {
  }
  exitKey() {
  }
  exitValue() {
  }
  exitComparison() {
  }
  visitTerminal() {
  }
  visitErrorNode() {
  }
}
function analyzeQuery(input, lastToken) {
  input = input.trim();
  const chars = CharStreams.fromString(input);
  const lexer = new FilterQueryLexer(chars);
  lexer.removeErrorListeners();
  lexer.addErrorListener(new SilentErrorListener());
  const tokens = new CommonTokenStream(lexer);
  const parser2 = new FilterQueryParser(tokens);
  parser2.removeErrorListeners();
  parser2.addErrorListener(new SilentErrorListener());
  const tree = parser2.query();
  const listener = new TypeTrackingListener();
  ParseTreeWalker.DEFAULT.walk(listener, tree);
  const currentToken = listener.tokens.find(
    (token) => token.text === lastToken.text && token.startIndex === lastToken.start && token.stopIndex === lastToken.stop
  );
  return currentToken;
}
class SilentAntlrErrorListener extends ErrorListener {
  syntaxError() {
  }
  reportAmbiguity() {
  }
  reportAttemptingFullContext() {
  }
  reportContextSensitivity() {
  }
}
function createLexer(input) {
  const chars = CharStreams.fromString(input);
  const lexer = new FilterQueryLexer(chars);
  lexer.removeErrorListeners();
  lexer.addErrorListener(new SilentAntlrErrorListener());
  return lexer;
}
function determineTokenContext(token, query) {
  let isInKey = false;
  let isInNegation = false;
  let isInOperator = false;
  let isInValue = false;
  let isInFunction = false;
  let isInConjunction = false;
  let isInParenthesis = false;
  const tokenType = token.type;
  const currentTokenContext = analyzeQuery(query, token);
  if (!currentTokenContext) {
    isInKey = isKeyToken(tokenType);
    isInOperator = isOperatorToken(tokenType);
    isInValue = isValueToken(tokenType);
  } else {
    switch (currentTokenContext.type) {
      case "Operator":
        isInOperator = true;
        break;
      case "Value":
        isInValue = true;
        break;
      case "Key":
        isInKey = true;
        break;
    }
  }
  isInNegation = tokenType === FilterQueryLexer.NOT;
  isInFunction = isFunctionToken(tokenType);
  isInConjunction = isConjunctionToken(tokenType);
  isInParenthesis = isBracketToken(tokenType);
  return {
    isInKey,
    isInNegation,
    isInOperator,
    isInValue,
    isInFunction,
    isInConjunction,
    isInParenthesis
  };
}
function determineContextBoundaries(query, cursorIndex, tokens, queryPairs) {
  let currentPair = null;
  if (queryPairs.length > 0) {
    currentPair = getCurrentQueryPair(queryPairs, query, cursorIndex);
  }
  let bracketContext = null;
  const openBrackets = [];
  for (let i = 0; i < tokens.length; i++) {
    const token = tokens[i];
    if (token.channel !== 0) {
      continue;
    }
    if (token.type === FilterQueryLexer.LBRACK || token.type === FilterQueryLexer.LPAREN) {
      let isForList = false;
      if (i > 0) {
        for (let j = i - 1; j >= 0; j--) {
          const prevToken = tokens[j];
          if (prevToken.channel !== 0) {
            continue;
          }
          if (prevToken.type === FilterQueryLexer.IN || prevToken.type === FilterQueryLexer.NOT && j + 1 < tokens.length && tokens[j + 1].type === FilterQueryLexer.IN) {
            isForList = true;
            break;
          } else if (prevToken.channel === 0 && !isValueToken(prevToken.type)) {
            break;
          }
        }
      }
      openBrackets.push({ token, isForList });
    } else if ((token.type === FilterQueryLexer.RBRACK || token.type === FilterQueryLexer.RPAREN) && openBrackets.length > 0) {
      const matchingOpen = openBrackets.pop();
      if (matchingOpen && matchingOpen.token.start <= cursorIndex && cursorIndex <= token.stop + 1) {
        bracketContext = {
          start: matchingOpen.token.start,
          end: token.stop,
          isForList: matchingOpen.isForList
        };
        break;
      }
      if (matchingOpen && token.stop + 1 < cursorIndex && cursorIndex <= token.stop + 2 && query[token.stop + 1] === " ") {
        bracketContext = {
          start: matchingOpen.token.start,
          end: token.stop,
          isForList: matchingOpen.isForList
        };
        break;
      }
    }
    if (token.start <= cursorIndex && cursorIndex <= token.stop + 1) {
      if (token.type === FilterQueryLexer.LBRACK || token.type === FilterQueryLexer.LPAREN) {
        let isForList = false;
        for (let j = i - 1; j >= 0; j--) {
          const prevToken = tokens[j];
          if (prevToken.channel !== 0) {
            continue;
          }
          if (prevToken.type === FilterQueryLexer.IN || prevToken.type === FilterQueryLexer.NOT && j + 1 < tokens.length && tokens[j + 1].type === FilterQueryLexer.IN) {
            isForList = true;
            break;
          } else if (prevToken.channel === 0) {
            break;
          }
        }
        bracketContext = {
          start: token.start,
          end: token.stop,
          isForList
        };
        break;
      }
      if (token.type === FilterQueryLexer.RBRACK || token.type === FilterQueryLexer.RPAREN) {
        if (openBrackets.length > 0) {
          const matchingOpen = openBrackets[openBrackets.length - 1];
          bracketContext = {
            start: matchingOpen.token.start,
            end: token.stop,
            isForList: matchingOpen.isForList
          };
        } else {
          bracketContext = {
            start: token.start,
            end: token.stop,
            isForList: false
            // We don't know, assume not list
          };
        }
        break;
      }
    }
  }
  if (currentPair) {
    const { position } = currentPair;
    const negationContext = {
      start: position.negationStart ?? 0,
      end: position.negationEnd ?? 0
    };
    const keyContext = {
      start: position.keyStart,
      end: position.keyEnd
    };
    let operatorStart = position.keyEnd + 1;
    while (operatorStart < query.length && query[operatorStart] === " ") {
      operatorStart++;
    }
    const operatorContext = {
      start: operatorStart,
      end: position.operatorEnd
    };
    let valueStart = position.operatorEnd + 1;
    while (valueStart < query.length && query[valueStart] === " ") {
      valueStart++;
    }
    const isInOperator = isMultiValueOperator(currentPair.operator);
    let valueContext = null;
    if (isInOperator && bracketContext && bracketContext.isForList) {
      valueContext = {
        start: bracketContext.start,
        end: bracketContext.end
      };
    } else if (position.valueEnd) {
      valueContext = {
        start: valueStart,
        end: position.valueEnd
      };
    }
    let conjunctionContext = null;
    if (position.valueEnd) {
      let conjunctionStart = position.valueEnd + 1;
      while (conjunctionStart < query.length && query[conjunctionStart] === " ") {
        conjunctionStart++;
      }
      for (const token of tokens) {
        if (token.start === conjunctionStart && (token.type === FilterQueryLexer.AND || token.type === FilterQueryLexer.OR)) {
          conjunctionContext = {
            start: conjunctionStart,
            end: token.stop
          };
          break;
        }
      }
    }
    return {
      keyContext,
      negationContext,
      operatorContext,
      valueContext,
      conjunctionContext,
      bracketContext
    };
  }
  const tokenAtCursor2 = tokens.find(
    (token) => token.channel === 0 && token.start <= cursorIndex && cursorIndex <= token.stop + 1
  );
  if (tokenAtCursor2) {
    if (tokenAtCursor2.type === FilterQueryLexer.KEY) {
      return {
        keyContext: { start: tokenAtCursor2.start, end: tokenAtCursor2.stop },
        negationContext: null,
        operatorContext: null,
        valueContext: null,
        conjunctionContext: null,
        bracketContext
      };
    }
    if (tokenAtCursor2.type === FilterQueryLexer.NOT) {
      return {
        keyContext: null,
        negationContext: {
          start: tokenAtCursor2.start,
          end: tokenAtCursor2.stop
        },
        operatorContext: null,
        valueContext: null,
        conjunctionContext: null,
        bracketContext
      };
    }
    if (isOperatorToken(tokenAtCursor2.type)) {
      return {
        keyContext: null,
        negationContext: null,
        operatorContext: {
          start: tokenAtCursor2.start,
          end: tokenAtCursor2.stop
        },
        valueContext: null,
        conjunctionContext: null,
        bracketContext
      };
    }
    if (isValueToken(tokenAtCursor2.type)) {
      return {
        keyContext: null,
        negationContext: null,
        operatorContext: null,
        valueContext: { start: tokenAtCursor2.start, end: tokenAtCursor2.stop },
        conjunctionContext: null,
        bracketContext
      };
    }
    if (isConjunctionToken(tokenAtCursor2.type)) {
      return {
        keyContext: null,
        negationContext: null,
        operatorContext: null,
        valueContext: null,
        conjunctionContext: {
          start: tokenAtCursor2.start,
          end: tokenAtCursor2.stop
        },
        bracketContext
      };
    }
  }
  return {
    keyContext: null,
    negationContext: null,
    operatorContext: null,
    valueContext: null,
    conjunctionContext: null,
    bracketContext
  };
}
function getQueryContextAtCursor(query, cursorIndex) {
  try {
    const stackTrace = new Error("recursion-guard").stack || "";
    const callCount = (stackTrace.match(/getQueryContextAtCursor/g) || []).length;
    if (callCount > 3) {
      return {
        tokenType: -1,
        text: "",
        start: cursorIndex,
        stop: cursorIndex,
        currentToken: "",
        isInKey: true,
        isInNegation: false,
        isInOperator: false,
        isInValue: false,
        isInFunction: false,
        isInConjunction: false,
        isInParenthesis: false,
        isInBracketList: false,
        queryPairs: [],
        currentPair: null
      };
    }
    const isAtSpace = cursorIndex < query.length && query[cursorIndex] === " ";
    const isAfterSpace = cursorIndex > 0 && query[cursorIndex - 1] === " ";
    const isAfterToken = cursorIndex > 0 && query[cursorIndex - 1] !== " ";
    const isTransitionPoint = isAtSpace && isAfterToken || cursorIndex === query.length && isAfterToken;
    const input = query || "";
    const lexer = createLexer(input);
    const tokenStream = new CommonTokenStream(lexer);
    tokenStream.fill();
    const allTokens = tokenStream.tokens;
    let exactToken = null;
    let previousToken = null;
    let nextToken = null;
    let lastTokenBeforeCursor = null;
    for (const token of allTokens) {
      if (token.type === FilterQueryLexer.EOF) {
        continue;
      }
      if (token.stop < cursorIndex || token.stop + 1 === cursorIndex) {
        lastTokenBeforeCursor = token;
      }
      if (token.start > cursorIndex) {
        break;
      }
    }
    const queryPairs = extractQueryPairs(query);
    let currentPair = null;
    if (queryPairs.length > 0) {
      currentPair = getCurrentQueryPair(queryPairs, query, cursorIndex);
    }
    const contextBoundaries = determineContextBoundaries(query, cursorIndex, allTokens, queryPairs);
    const isInKeyBoundary = contextBoundaries.keyContext && (cursorIndex >= contextBoundaries.keyContext.start && cursorIndex <= contextBoundaries.keyContext.end || cursorIndex === contextBoundaries.keyContext.end + 1);
    const isInNegationBoundary = contextBoundaries.negationContext && (cursorIndex >= contextBoundaries.negationContext.start && cursorIndex <= contextBoundaries.negationContext.end || cursorIndex === contextBoundaries.negationContext.end + 1);
    const isInOperatorBoundary = contextBoundaries.operatorContext && (cursorIndex >= contextBoundaries.operatorContext.start && cursorIndex <= contextBoundaries.operatorContext.end || cursorIndex === contextBoundaries.operatorContext.end + 1);
    const isInValueBoundary = contextBoundaries.valueContext && (cursorIndex >= contextBoundaries.valueContext.start && cursorIndex <= contextBoundaries.valueContext.end || cursorIndex === contextBoundaries.valueContext.end + 1);
    const isInConjunctionBoundary = contextBoundaries.conjunctionContext && (cursorIndex >= contextBoundaries.conjunctionContext.start && cursorIndex <= contextBoundaries.conjunctionContext.end || cursorIndex === contextBoundaries.conjunctionContext.end + 1);
    const isInBracketListBoundary = contextBoundaries.bracketContext && contextBoundaries.bracketContext.isForList && cursorIndex >= contextBoundaries.bracketContext.start && cursorIndex <= contextBoundaries.bracketContext.end + 1;
    const isInParenthesisBoundary = contextBoundaries.bracketContext && !contextBoundaries.bracketContext.isForList && cursorIndex >= contextBoundaries.bracketContext.start && cursorIndex <= contextBoundaries.bracketContext.end + 1;
    const isAfterClosingBracketList = contextBoundaries.bracketContext && contextBoundaries.bracketContext.isForList && cursorIndex === contextBoundaries.bracketContext.end + 2 && query[contextBoundaries.bracketContext.end + 1] === " ";
    if (isInKeyBoundary || isInNegationBoundary || isInOperatorBoundary || isInValueBoundary || isInConjunctionBoundary || isInBracketListBoundary || isAfterClosingBracketList) {
      const keyToken = currentPair?.key || "";
      const operatorToken = currentPair?.operator || "";
      const valueToken = currentPair?.value || "";
      const isForMultiValueOperator = isMultiValueOperator(operatorToken);
      const finalIsInValue = isInValueBoundary || isInBracketListBoundary && isForMultiValueOperator;
      const finalIsInConjunction = isInConjunctionBoundary || isAfterClosingBracketList;
      return {
        tokenType: -1,
        text: "",
        start: cursorIndex,
        stop: cursorIndex,
        currentToken: "",
        isInKey: isInKeyBoundary || false,
        isInNegation: isInNegationBoundary || false,
        isInOperator: isInOperatorBoundary || false,
        isInValue: finalIsInValue || false,
        isInConjunction: finalIsInConjunction || false,
        isInFunction: false,
        isInParenthesis: isInParenthesisBoundary || false,
        isInBracketList: isInBracketListBoundary || false,
        keyToken: isInKeyBoundary ? keyToken : isInOperatorBoundary || finalIsInValue ? keyToken : void 0,
        operatorToken: isInOperatorBoundary ? operatorToken : finalIsInValue ? operatorToken : void 0,
        valueToken: finalIsInValue ? valueToken : void 0,
        queryPairs,
        currentPair
      };
    }
    if (cursorIndex >= input.length && allTokens.length > 0) {
      let lastRealToken;
      for (let i = allTokens.length - 1; i >= 0; i--) {
        if (allTokens[i].type !== FilterQueryLexer.EOF) {
          lastRealToken = allTokens[i];
          break;
        }
      }
      if (lastRealToken) {
        exactToken = lastRealToken;
        previousToken = null;
        for (let i = allTokens.length - 1; i >= 0; i--) {
          if (allTokens[i].stop < lastRealToken.start) {
            previousToken = allTokens[i];
            break;
          }
        }
      }
    } else {
      for (let i = 0; i < allTokens.length; i++) {
        const token = allTokens[i];
        if (token.type === FilterQueryLexer.EOF) {
          continue;
        }
        if (token.start <= cursorIndex && cursorIndex <= token.stop + 1) {
          exactToken = token;
          previousToken = i > 0 ? allTokens[i - 1] : null;
          nextToken = i < allTokens.length - 1 ? allTokens[i + 1] : null;
          break;
        }
      }
      if (!exactToken) {
        for (let i = 0; i < allTokens.length - 1; i++) {
          const current = allTokens[i];
          const next = allTokens[i + 1];
          if (current.type === FilterQueryLexer.EOF || next.type === FilterQueryLexer.EOF) {
            continue;
          }
          if (current.stop + 1 < cursorIndex && cursorIndex < next.start) {
            previousToken = current;
            nextToken = next;
            break;
          }
        }
      }
    }
    if (!previousToken && !nextToken && !exactToken && !lastTokenBeforeCursor) {
      return {
        tokenType: -1,
        text: "",
        start: cursorIndex,
        stop: cursorIndex,
        currentToken: "",
        isInKey: true,
        // Default to key context when input is empty
        isInNegation: false,
        isInOperator: false,
        isInValue: false,
        isInFunction: false,
        isInConjunction: false,
        isInParenthesis: false,
        isInBracketList: false,
        queryPairs,
        // Add all query pairs to the context
        currentPair: null
        // No current pair when query is empty
      };
    }
    if (lastTokenBeforeCursor && (isAtSpace || isAfterSpace || isTransitionPoint)) {
      const lastTokenContext = determineTokenContext(lastTokenBeforeCursor, input);
      if (lastTokenContext.isInKey) {
        return {
          tokenType: lastTokenBeforeCursor.type,
          text: lastTokenBeforeCursor.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: lastTokenBeforeCursor.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: true,
          // After key + space, should be operator context
          isInValue: false,
          isInFunction: false,
          isInConjunction: false,
          isInParenthesis: false,
          isInBracketList: false,
          keyToken: lastTokenBeforeCursor.text,
          queryPairs,
          currentPair
        };
      }
      if (lastTokenContext.isInNegation) {
        return {
          tokenType: lastTokenBeforeCursor.type,
          text: lastTokenBeforeCursor.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: lastTokenBeforeCursor.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: true,
          // After key + space + NOT, should be operator context
          isInValue: false,
          isInFunction: false,
          isInConjunction: false,
          isInParenthesis: false,
          isInBracketList: false,
          keyToken: lastTokenBeforeCursor.text,
          queryPairs,
          currentPair
        };
      }
      if (lastTokenContext.isInOperator) {
        const keyFromPair = currentPair?.key || "";
        const isNonValueToken = isNonValueOperatorToken(lastTokenBeforeCursor.type);
        return {
          tokenType: lastTokenBeforeCursor.type,
          text: lastTokenBeforeCursor.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: lastTokenBeforeCursor.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: false,
          isInValue: !isNonValueToken,
          // After operator + space, should be value context
          isInFunction: false,
          isInConjunction: isNonValueToken,
          isInParenthesis: false,
          isInBracketList: false,
          operatorToken: lastTokenBeforeCursor.text,
          keyToken: keyFromPair,
          // Include key from current pair
          queryPairs,
          currentPair
        };
      }
      if (lastTokenContext.isInValue) {
        const keyFromPair = currentPair?.key || "";
        const operatorFromPair = currentPair?.operator || "";
        return {
          tokenType: lastTokenBeforeCursor.type,
          text: lastTokenBeforeCursor.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: lastTokenBeforeCursor.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: false,
          isInValue: false,
          isInFunction: false,
          isInConjunction: true,
          // After value + space, should be conjunction context
          isInParenthesis: false,
          isInBracketList: false,
          valueToken: lastTokenBeforeCursor.text,
          keyToken: keyFromPair,
          // Include key from current pair
          operatorToken: operatorFromPair,
          // Include operator from current pair
          queryPairs,
          currentPair
        };
      }
      if (lastTokenContext.isInConjunction) {
        return {
          tokenType: lastTokenBeforeCursor.type,
          text: lastTokenBeforeCursor.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: lastTokenBeforeCursor.text,
          isInKey: true,
          // After conjunction + space, should be key context
          isInNegation: false,
          isInOperator: false,
          isInValue: false,
          isInFunction: false,
          isInConjunction: false,
          isInParenthesis: false,
          isInBracketList: false,
          queryPairs,
          currentPair
        };
      }
      if (lastTokenContext.isInParenthesis && lastTokenBeforeCursor.type === FilterQueryLexer.RPAREN) {
        return {
          tokenType: lastTokenBeforeCursor.type,
          text: lastTokenBeforeCursor.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: lastTokenBeforeCursor.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: false,
          isInValue: false,
          isInFunction: false,
          isInConjunction: true,
          // After RPARAN + space, should be conjunction context
          isInParenthesis: false,
          isInBracketList: false,
          queryPairs,
          currentPair
        };
      }
    }
    if (exactToken && cursorIndex === exactToken.stop + 1) {
      const tokenContext = determineTokenContext(exactToken, input);
      return {
        tokenType: exactToken.type,
        text: exactToken.text,
        start: exactToken.start,
        stop: exactToken.stop,
        currentToken: exactToken.text,
        ...tokenContext,
        isInBracketList: false,
        keyToken: tokenContext.isInKey ? exactToken.text : currentPair?.key || void 0,
        operatorToken: tokenContext.isInOperator ? exactToken.text : currentPair?.operator || void 0,
        valueToken: tokenContext.isInValue ? exactToken.text : currentPair?.value || void 0,
        queryPairs,
        currentPair
      };
    }
    if (exactToken?.channel === 0) {
      const tokenContext = determineTokenContext(exactToken, input);
      const keyFromPair = currentPair?.key || "";
      const operatorFromPair = currentPair?.operator || "";
      return {
        tokenType: exactToken.type,
        text: exactToken.text,
        start: exactToken.start,
        stop: exactToken.stop,
        currentToken: exactToken.text,
        ...tokenContext,
        isInBracketList: false,
        keyToken: tokenContext.isInKey ? exactToken.text : tokenContext.isInOperator || tokenContext.isInValue ? keyFromPair : void 0,
        operatorToken: tokenContext.isInOperator ? exactToken.text : tokenContext.isInValue ? operatorFromPair : void 0,
        valueToken: tokenContext.isInValue ? exactToken.text : void 0,
        queryPairs,
        currentPair
      };
    }
    if (previousToken?.channel === 0) {
      const prevContext = determineTokenContext(previousToken, input);
      const keyFromPair = currentPair?.key || "";
      const operatorFromPair = currentPair?.operator || "";
      if (prevContext.isInOperator) {
        return {
          tokenType: previousToken.type,
          text: previousToken.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: previousToken.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: false,
          isInValue: true,
          // Always in value context after operator
          isInFunction: false,
          isInConjunction: false,
          isInParenthesis: false,
          isInBracketList: false,
          operatorToken: previousToken.text,
          keyToken: keyFromPair,
          // Include key from current pair
          queryPairs,
          currentPair
        };
      }
      if (prevContext.isInKey) {
        return {
          tokenType: previousToken.type,
          text: previousToken.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: previousToken.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: true,
          // After key, progress to operator context
          isInValue: false,
          isInFunction: false,
          isInConjunction: false,
          isInParenthesis: false,
          isInBracketList: false,
          keyToken: previousToken.text,
          queryPairs,
          currentPair
        };
      }
      if (prevContext.isInValue) {
        return {
          tokenType: previousToken.type,
          text: previousToken.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: previousToken.text,
          isInKey: false,
          isInNegation: false,
          isInOperator: false,
          isInValue: false,
          isInFunction: false,
          isInConjunction: true,
          // After value, progress to conjunction context
          isInParenthesis: false,
          isInBracketList: false,
          valueToken: previousToken.text,
          keyToken: keyFromPair,
          // Include key from current pair
          operatorToken: operatorFromPair,
          // Include operator from current pair
          queryPairs,
          currentPair
        };
      }
      if (prevContext.isInConjunction) {
        return {
          tokenType: previousToken.type,
          text: previousToken.text,
          start: cursorIndex,
          stop: cursorIndex,
          currentToken: previousToken.text,
          isInKey: true,
          // After conjunction, progress back to key context
          isInNegation: false,
          isInOperator: false,
          isInValue: false,
          isInFunction: false,
          isInConjunction: false,
          isInParenthesis: false,
          isInBracketList: false,
          queryPairs,
          currentPair
        };
      }
    }
    return {
      tokenType: -1,
      text: "",
      start: cursorIndex,
      stop: cursorIndex,
      currentToken: "",
      isInKey: true,
      isInNegation: false,
      isInOperator: false,
      isInValue: false,
      isInFunction: false,
      isInConjunction: false,
      isInParenthesis: false,
      isInBracketList: false,
      queryPairs,
      currentPair
    };
  } catch {
    return {
      tokenType: -1,
      text: "",
      start: cursorIndex,
      stop: cursorIndex,
      currentToken: "",
      isInValue: false,
      isInKey: true,
      // Default to key context on error
      isInNegation: false,
      isInOperator: false,
      isInFunction: false,
      isInConjunction: false,
      isInParenthesis: false,
      isInBracketList: false,
      queryPairs: [],
      currentPair: null
    };
  }
}
function extractQueryPairs(query) {
  try {
    const stackTrace = new Error("recursion-guard").stack || "";
    const callCount = (stackTrace.match(/extractQueryPairs/g) || []).length;
    if (callCount > 3) {
      return [];
    }
    const input = query || "";
    const lexer = createLexer(input);
    const tokenStream = new CommonTokenStream(lexer);
    tokenStream.fill();
    const allTokens = tokenStream.tokens;
    const queryPairs = [];
    let currentPair = null;
    let iterator = 0;
    while (iterator < allTokens.length) {
      const token = allTokens[iterator];
      iterator += 1;
      if (token.type === FilterQueryLexer.EOF || token.channel !== 0) {
        continue;
      }
      if (token.type === FilterQueryLexer.KEY && !(currentPair && currentPair.key)) {
        if (currentPair && currentPair.key) {
          queryPairs.push({
            key: currentPair.key,
            operator: currentPair.operator || "",
            value: currentPair.value,
            valueList: currentPair.valueList || [],
            valuesPosition: currentPair.valuesPosition || [],
            hasNegation: currentPair.hasNegation || false,
            isMultiValue: currentPair.isMultiValue || false,
            position: {
              keyStart: currentPair.position?.keyStart || 0,
              keyEnd: currentPair.position?.keyEnd || 0,
              operatorStart: currentPair.position?.operatorStart || 0,
              operatorEnd: currentPair.position?.operatorEnd || 0,
              valueStart: currentPair.position?.valueStart,
              valueEnd: currentPair.position?.valueEnd,
              negationStart: currentPair.position?.negationStart || 0,
              negationEnd: currentPair.position?.negationEnd || 0
            },
            isComplete: !!(currentPair.key && currentPair.operator && (currentPair.value || isNonValueOperator(currentPair.operator)))
          });
        }
        currentPair = {
          key: token.text,
          position: {
            keyStart: token.start,
            keyEnd: token.stop,
            operatorStart: 0,
            // Initialize with default values
            operatorEnd: 0
            // Initialize with default values
          }
        };
      } else if (token.type === FilterQueryLexer.NOT && currentPair) {
        currentPair.hasNegation = true;
        currentPair.position = {
          keyStart: currentPair.position?.keyStart || 0,
          keyEnd: currentPair.position?.keyEnd || 0,
          operatorStart: currentPair.position?.operatorStart || 0,
          operatorEnd: currentPair.position?.operatorEnd || 0,
          valueStart: currentPair.position?.valueStart,
          valueEnd: currentPair.position?.valueEnd,
          negationStart: token.start,
          negationEnd: token.stop
        };
      } else if (isOperatorToken(token.type) && currentPair && currentPair.key && !currentPair.operator) {
        let multiValueStart;
        let multiValueEnd;
        if (isMultiValueOperator(token.text)) {
          currentPair.isMultiValue = true;
          const valueList = [];
          const valuesPosition = [];
          if ([FilterQueryLexer.LPAREN, FilterQueryLexer.LBRACK].includes(allTokens[iterator].type)) {
            const openingTokenType = allTokens[iterator].type;
            multiValueStart = allTokens[iterator].start;
            iterator += 1;
            const closingToken = openingTokenType === FilterQueryLexer.LPAREN ? FilterQueryLexer.RPAREN : FilterQueryLexer.RBRACK;
            while (allTokens[iterator].type !== closingToken && iterator < allTokens.length) {
              if (isValueToken(allTokens[iterator].type)) {
                valueList.push(allTokens[iterator].text);
                valuesPosition.push({
                  start: allTokens[iterator].start,
                  end: allTokens[iterator].stop
                });
              }
              iterator += 1;
            }
            if (allTokens[iterator].type === closingToken) {
              multiValueEnd = allTokens[iterator].stop;
            }
          } else if (isValueToken(allTokens[iterator].type)) {
            valueList.push(allTokens[iterator].text);
            valuesPosition.push({
              start: allTokens[iterator].start,
              end: allTokens[iterator].stop
            });
            multiValueStart = allTokens[iterator].start;
            multiValueEnd = allTokens[iterator].stop;
            iterator += 1;
          }
          currentPair.valuesPosition = valuesPosition;
          currentPair.valueList = valueList;
          if (multiValueStart && multiValueEnd) {
            currentPair.value = query.slice(multiValueStart, multiValueEnd + 1);
          }
        }
        currentPair.operator = token.text;
        currentPair.position = {
          keyStart: currentPair.position?.keyStart || 0,
          keyEnd: currentPair.position?.keyEnd || 0,
          operatorStart: token.start,
          operatorEnd: token.stop,
          valueStart: multiValueStart || currentPair.position?.valueStart,
          valueEnd: multiValueEnd || currentPair.position?.valueEnd,
          negationStart: currentPair.position?.negationStart || 0,
          negationEnd: currentPair.position?.negationEnd || 0
        };
      } else if (isValueToken(token.type) && currentPair && currentPair.key && currentPair.operator && !isNonValueOperator(currentPair.operator) && !currentPair.value) {
        currentPair.value = token.text;
        currentPair.position = {
          keyStart: currentPair.position?.keyStart || 0,
          keyEnd: currentPair.position?.keyEnd || 0,
          operatorStart: currentPair.position?.operatorStart || 0,
          operatorEnd: currentPair.position?.operatorEnd || 0,
          valueStart: token.start,
          valueEnd: token.stop,
          negationStart: currentPair.position?.negationStart || 0,
          negationEnd: currentPair.position?.negationEnd || 0
        };
      } else if (currentPair && currentPair.key && (isConjunctionToken(token.type) || token.type === FilterQueryLexer.KEY)) {
        queryPairs.push({
          key: currentPair.key,
          operator: currentPair.operator || "",
          value: currentPair.value,
          valueList: currentPair.valueList || [],
          valuesPosition: currentPair.valuesPosition || [],
          hasNegation: currentPair.hasNegation || false,
          isMultiValue: currentPair.isMultiValue || false,
          position: {
            keyStart: currentPair.position?.keyStart || 0,
            keyEnd: currentPair.position?.keyEnd || 0,
            operatorStart: currentPair.position?.operatorStart || 0,
            operatorEnd: currentPair.position?.operatorEnd || 0,
            valueStart: currentPair.position?.valueStart,
            valueEnd: currentPair.position?.valueEnd,
            negationStart: currentPair.position?.negationStart || 0,
            negationEnd: currentPair.position?.negationEnd || 0
          },
          isComplete: !!(currentPair.key && currentPair.operator && (currentPair.value || isNonValueOperator(currentPair.operator)))
        });
        currentPair = null;
        if (token.type === FilterQueryLexer.KEY) {
          currentPair = {
            key: token.text,
            position: {
              keyStart: token.start,
              keyEnd: token.stop,
              operatorStart: 0,
              // Initialize with default values
              operatorEnd: 0
              // Initialize with default values
            }
          };
        }
      }
    }
    if (currentPair && currentPair.key) {
      queryPairs.push({
        key: currentPair.key,
        operator: currentPair.operator || "",
        value: currentPair.value,
        valueList: currentPair.valueList || [],
        valuesPosition: currentPair.valuesPosition || [],
        hasNegation: currentPair.hasNegation || false,
        isMultiValue: currentPair.isMultiValue || false,
        position: {
          keyStart: currentPair.position?.keyStart || 0,
          keyEnd: currentPair.position?.keyEnd || 0,
          operatorStart: currentPair.position?.operatorStart || 0,
          operatorEnd: currentPair.position?.operatorEnd || 0,
          valueStart: currentPair.position?.valueStart,
          valueEnd: currentPair.position?.valueEnd,
          negationStart: currentPair.position?.negationStart || 0,
          negationEnd: currentPair.position?.negationEnd || 0
        },
        isComplete: !!(currentPair.key && currentPair.operator && (currentPair.value || isNonValueOperator(currentPair.operator)))
      });
    }
    return queryPairs;
  } catch {
    return [];
  }
}
function getEndIndexAfterSpaces(pair, query) {
  const { position } = pair;
  let pairEnd = position.valueEnd || position.operatorEnd || position.keyEnd;
  pairEnd += 1;
  while (pairEnd < query.length && query.charAt(pairEnd) === " ") {
    pairEnd += 1;
  }
  return pairEnd;
}
function getCurrentQueryPair(queryPairs, query, cursorIndex) {
  try {
    if (queryPairs.length > 0) {
      let bestMatch = null;
      for (const pair of queryPairs) {
        const { position } = pair;
        const pairEnd = position.valueEnd || position.operatorEnd || position.keyEnd;
        const pairStart = position.keyStart ?? (position.operatorStart || position.valueStart || 0);
        if ((pairEnd >= cursorIndex && pairStart <= cursorIndex || !pair.isComplete && pairStart <= cursorIndex && getEndIndexAfterSpaces(pair, query) >= cursorIndex) && (!bestMatch || pairEnd > (bestMatch.position.valueEnd || bestMatch.position.operatorEnd || bestMatch.position.keyEnd))) {
          bestMatch = pair;
        }
      }
      if (bestMatch) {
        return bestMatch;
      }
      if (cursorIndex === 0) {
        return null;
      }
      if (cursorIndex >= query.length && queryPairs.length > 0) {
        return queryPairs[queryPairs.length - 1];
      }
    }
    return null;
  } catch {
    return null;
  }
}
function normalizeOp(op) {
  if (!op) return void 0;
  return op.replaceAll(/\s+/g, " ").trim();
}
function tokenAtCursor(text, cursorPos) {
  const q = String(text ?? "");
  const pos = Math.max(0, Math.min(cursorPos, q.length));
  if (!q.trim()) return { prefix: "", mode: "key" };
  const ctx = getQueryContextAtCursor(q, pos);
  let mode2 = "key";
  if (ctx.isInConjunction) mode2 = "conj";
  else if (ctx.isInValue || ctx.isInBracketList) mode2 = "value";
  else if (ctx.isInOperator || ctx.isInNegation) mode2 = "op";
  else if (ctx.isInKey) mode2 = "key";
  else {
    const left = q.slice(0, pos);
    if (/\s+$/.test(left) && /(?:['"\]]|EXISTS)\s+$/i.test(left)) mode2 = "conj";
    else if (/=\s*$|\s(?:IN|LIKE|ILIKE|CONTAINS|REGEXP|BETWEEN)\s*$/i.test(left)) mode2 = "value";
    else if (/[\w.[\]/-]+\s+$/.test(left)) mode2 = "op";
    else mode2 = "key";
  }
  let prefix = "";
  if (mode2 === "key") {
    const left = q.slice(0, pos);
    const m = left.match(/(?:^|[\s(])([\w.[\]/-]*)$/);
    prefix = m?.[1] ?? "";
  } else if (mode2 === "op") {
    const left = q.slice(0, pos);
    const m = left.match(/\s+((?:NOT\s*)?[A-Za-z!<>=]*)$/);
    prefix = m?.[1] ?? "";
  } else if (mode2 === "value") {
    const left = q.slice(0, pos);
    const m = left.match(
      /(?:!=|>=|<=|[=><]|IN|NOT IN|LIKE|ILIKE|CONTAINS|NOT CONTAINS|REGEXP|BETWEEN)\s+(.*)$/i
    );
    if (m) {
      prefix = m[1].trim().replaceAll(/^['"]|['"]$/g, "").replaceAll(/^\[|\]$/g, "");
    } else {
      prefix = String(ctx.valueToken || ctx.currentToken || "").trim().replaceAll(/^['"]|['"]$/g, "");
    }
  } else if (mode2 === "conj") {
    const left = q.slice(0, pos);
    const m = left.match(/\s+([A-Z]*)$/i);
    prefix = m?.[1] ?? "";
  }
  return {
    prefix,
    mode: mode2,
    key: ctx.keyToken || void 0,
    op: normalizeOp(ctx.operatorToken),
    antlr: ctx
  };
}
function metadataSuggestDelayMs(prefix) {
  return String(prefix || "").trim() === "" ? 0 : 300;
}
function operatorsForFieldType(fieldType) {
  const t2 = String(fieldType || "string").toLowerCase();
  if (t2 === "bool" || t2 === "boolean") {
    return [
      { value: "=", meta: "equal" },
      { value: "!=", meta: "not equal" },
      { value: "EXISTS", meta: "present" },
      { value: "NOT EXISTS", meta: "absent" }
    ];
  }
  if (t2 === "int" || t2 === "integer" || t2 === "long" || t2 === "float" || t2 === "double" || t2 === "number") {
    return [
      { value: "=", meta: "equal" },
      { value: "!=", meta: "not equal" },
      { value: ">", meta: "gt" },
      { value: ">=", meta: "gte" },
      { value: "<", meta: "lt" },
      { value: "<=", meta: "lte" },
      { value: "IN", meta: "list" },
      { value: "NOT IN", meta: "not list" },
      { value: "EXISTS", meta: "present" },
      { value: "NOT EXISTS", meta: "absent" }
    ];
  }
  return [
    { value: "=", meta: "equal" },
    { value: "!=", meta: "not equal" },
    { value: "IN", meta: "list" },
    { value: "NOT IN", meta: "not list" },
    { value: "LIKE", meta: "like" },
    { value: "ILIKE", meta: "ilike" },
    { value: "CONTAINS", meta: "contains" },
    { value: "NOT CONTAINS", meta: "not contains" },
    { value: "EXISTS", meta: "present" },
    { value: "NOT EXISTS", meta: "absent" },
    { value: "REGEXP", meta: "regex" }
  ];
}
function quoteFilterValue(value, op) {
  const v = String(value ?? "");
  const o = String(op || "").toUpperCase();
  const isNum = /^-?\d+(?:\.\d+)?$/.test(v);
  const isBool = v === "true" || v === "false";
  const lit = isNum || isBool ? v : `'${v.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
  if (o === "IN" || o === "NOT IN") return `[${lit}]`;
  return lit;
}
function chineseParserMessage(message2) {
  return message2.replaceAll(/mismatched input/gi, "输入不匹配").replaceAll(/no viable alternative at input/gi, "无法解析该输入").replaceAll(/extraneous input/gi, "多余输入").replaceAll(/token recognition error at/gi, "无法识别字符").replaceAll(/expecting/gi, "应为").replaceAll(/missing/gi, "缺少").replaceAll(/at input/gi, "于输入");
}
class QueryErrorListener {
  errors = [];
  syntaxError(_recognizer, offendingSymbol, line, column, msg) {
    if (this.hasUnterminatedQuoteError() && msg.includes("expecting")) {
      return;
    }
    const error = {
      message: chineseParserMessage(msg),
      line,
      column,
      offendingSymbol: offendingSymbol?.text || String(offendingSymbol)
    };
    if (msg.includes("expecting")) {
      const expectedTokens = msg.split("expecting")[1].trim().split(",").map((token) => token.trim());
      error.expectedTokens = expectedTokens;
    }
    const isDuplicate = this.errors.some(
      (e) => e.line === line && e.column === column && this.isSimilarError(e.message, msg)
    );
    if (!isDuplicate) {
      this.errors.push(error);
    }
  }
  hasUnterminatedQuoteError() {
    return this.errors.some(
      (error) => error.message.includes("unterminated") || error.message.includes("missing") && error.message.includes("'")
    );
  }
  isSimilarError = (msg1, msg2) => {
    const normalize = (msg) => msg.toLowerCase().replaceAll(/['"`]/g, "quote").replaceAll(/\s+/g, " ").trim();
    return normalize(msg1) === normalize(msg2);
  };
  reportAmbiguity = () => {
  };
  reportAttemptingFullContext = () => {
  };
  reportContextSensitivity = () => {
  };
  getErrors() {
    return this.errors;
  }
  hasErrors() {
    return this.errors.length > 0;
  }
  getFormattedErrors() {
    return this.errors.map((error) => {
      const { offendingSymbol, expectedTokens, message: errorMessage, line, column } = error;
      let message2 = `第 ${line} 行、第 ${column} 列：${chineseParserMessage(errorMessage)}`;
      if (offendingSymbol && offendingSymbol !== "undefined") {
        message2 += `
 符号：'${offendingSymbol}'`;
      }
      if (expectedTokens && expectedTokens.length > 0) {
        message2 += `
 预期：${expectedTokens.join(", ")}`;
      }
      return message2;
    });
  }
}
const validateQuery = (query) => {
  if (!query.trim()) {
    return {
      isValid: true,
      message: "查询为空",
      errors: []
    };
  }
  try {
    const errorListener = new QueryErrorListener();
    const inputStream = CharStreams.fromString(query);
    const lexer = new FilterQueryLexer(inputStream);
    lexer.removeErrorListeners();
    lexer.addErrorListener(errorListener);
    const tokenStream = new CommonTokenStream(lexer);
    const parser2 = new FilterQueryParser(tokenStream);
    parser2.removeErrorListeners();
    parser2.addErrorListener(errorListener);
    parser2.query();
    if (errorListener.hasErrors()) {
      return {
        isValid: false,
        message: "查询语法错误",
        errors: errorListener.getErrors()
      };
    }
    return {
      isValid: true,
      message: "查询有效",
      errors: []
    };
  } catch (error) {
    const errorMessage = error instanceof Error ? chineseParserMessage(error.message) : "无效的查询语法";
    const detailedError = {
      message: errorMessage,
      line: 0,
      column: 0,
      offendingSymbol: "",
      expectedTokens: []
    };
    return {
      isValid: false,
      message: "无效的查询语法",
      errors: [detailedError]
    };
  }
};
function validateFilterExpression(expr) {
  const s = String(expr || "");
  if (!s.trim()) return { ok: true };
  const result = validateQuery(s);
  if (result.isValid) return { ok: true };
  const first = result.errors[0];
  return {
    ok: false,
    message: first?.message || result.message || "Query syntax error",
    column: typeof first?.column === "number" ? first.column + 1 : void 0,
    line: first?.line,
    errors: result.errors.map((e) => ({
      message: e.message,
      line: e.line,
      column: e.column
    }))
  };
}
const _hoisted_1$8 = {
  class: "lqs",
  "data-testid": "signoz-log-query-search"
};
const _hoisted_2$8 = ["aria-label"];
const _hoisted_3$7 = ["aria-label"];
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  ...{ name: "LogQuerySearch" },
  __name: "LogQuerySearch",
  props: {
    modelValue: {},
    placeholder: {},
    signal: { default: "logs" },
    metricName: {},
    datasourceApi: {},
    testId: {}
  },
  emits: ["update:modelValue", "run"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const resolvedPlaceholder = computed(
      () => props.placeholder ?? signozT("signoz.querySearch.placeholder")
    );
    const emit = __emit;
    const keyTypeMap = ref({});
    const metaError = ref("");
    let abort = null;
    let debounceTimer = null;
    let debounceSeq = 0;
    const validation = computed(() => validateFilterExpression(props.modelValue || ""));
    const showValidation = computed(() => !validation.value.ok);
    function clearDebounce() {
      if (debounceTimer) {
        clearTimeout(debounceTimer);
        debounceTimer = null;
      }
    }
    function waitMs(ms, seq2) {
      if (ms <= 0) return Promise.resolve();
      return new Promise((resolve) => {
        clearDebounce();
        debounceTimer = setTimeout(() => {
          debounceTimer = null;
          if (seq2 === debounceSeq) resolve();
        }, ms);
      });
    }
    async function fetchKeys(prefix, signal) {
      if (!props.datasourceApi?.getMetadata) return [];
      const res = await props.datasourceApi.getMetadata(
        {
          type: "attributeKeys",
          signal: props.signal || "logs",
          metricName: props.metricName,
          search: prefix || void 0
        },
        signal
      );
      const vals = Array.isArray(res?.values) ? res.values : [];
      const nextMap = { ...keyTypeMap.value };
      const out = [];
      for (const v of vals) {
        const name = String(v?.name ?? v?.key ?? v ?? "").trim();
        if (!name) continue;
        const ft = String(
          v?.fieldDataType || v?.dataType || v?.type || "string"
        );
        nextMap[name] = ft;
        out.push({ name, fieldType: ft });
      }
      keyTypeMap.value = nextMap;
      if (prefix) {
        const p = prefix.toLowerCase();
        return out.filter((o) => o.name.toLowerCase().includes(p));
      }
      return out;
    }
    async function fetchValues(key, prefix, signal) {
      if (!props.datasourceApi?.getMetadata || !key) return [];
      const res = await props.datasourceApi.getMetadata(
        {
          type: "attributeValues",
          signal: props.signal || "logs",
          metricName: props.metricName,
          attributeKey: key,
          search: prefix || void 0
        },
        signal
      );
      const vals = Array.isArray(res?.values) ? res.values : [];
      let out = vals.map((v) => {
        if (v == null) return "";
        if (typeof v === "object") return String(v.value ?? v.name ?? "");
        return String(v);
      }).filter(Boolean);
      if (prefix) {
        const p = prefix.toLowerCase();
        out = out.filter((s) => s.toLowerCase().includes(p));
      }
      return out;
    }
    async function completionSource(context) {
      const text = context.state.doc.toString();
      const pos = context.pos;
      const ctx = tokenAtCursor(text, pos);
      const word = context.matchBefore(/\S*/);
      const from = word?.from ?? pos;
      if (ctx.mode === "op") {
        const ops = operatorsForFieldType(ctx.key ? keyTypeMap.value[ctx.key] : "string");
        const q = (ctx.prefix || "").toUpperCase();
        const options = ops.filter((o) => !q || o.value.toUpperCase().includes(q)).map((o) => ({
          label: o.value,
          type: "keyword",
          detail: o.meta,
          apply: `${o.value} `
        }));
        return options.length ? { from, options } : null;
      }
      if (ctx.mode === "conj") {
        return {
          from,
          options: [
            { label: "AND", type: "keyword", apply: "AND " },
            { label: "OR", type: "keyword", apply: "OR " }
          ]
        };
      }
      const delay = metadataSuggestDelayMs(ctx.prefix || "");
      const seq2 = ++debounceSeq;
      await waitMs(delay, seq2);
      if (seq2 !== debounceSeq) return null;
      abort?.abort();
      abort = new AbortController();
      const signal = abort.signal;
      metaError.value = "";
      try {
        if (ctx.mode === "key") {
          const keys = await fetchKeys(ctx.prefix || "", signal);
          if (signal.aborted) return null;
          return {
            from,
            options: keys.map((k) => ({
              label: k.name,
              type: "variable",
              detail: k.fieldType,
              apply: `${k.name} `
            }))
          };
        }
        const key = ctx.key || "";
        if (!key) return null;
        const values = await fetchValues(key, ctx.prefix || "", signal);
        if (signal.aborted) return null;
        return {
          from,
          options: values.map((v) => {
            const lit = quoteFilterValue(v, ctx.op);
            return {
              label: v,
              type: "text",
              detail: "value",
              apply: `${lit} `
            };
          })
        };
      } catch (error) {
        if (error?.name === "AbortError") return null;
        metaError.value = error?.message || String(error);
        return {
          from,
          options: [
            {
              label: signozT("signoz.querySearch.metaError", "元数据加载失败"),
              type: "text",
              detail: metaError.value,
              boost: -99,
              apply: () => false
            }
          ]
        };
      }
    }
    onBeforeUnmount(() => {
      abort?.abort();
      clearDebounce();
      debounceSeq += 1;
    });
    watch(
      () => [props.signal, props.metricName],
      () => {
        abort?.abort();
        clearDebounce();
        debounceSeq += 1;
        metaError.value = "";
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$8, [
        createElementVNode(
          "div",
          {
            class: normalizeClass(["lqs-editor-wrap", {
              "lqs-editor-wrap--error": showValidation.value || Boolean(metaError.value)
            }])
          },
          [
            createVNode(unref(GIcon), {
              name: "search",
              size: 14,
              class: "lqs-lead"
            }),
            createVNode(unref(GQueryExpressionEditor), {
              class: "lqs-cm",
              embedded: true,
              "font-size": 13,
              "model-value": __props.modelValue,
              placeholder: resolvedPlaceholder.value,
              "aria-label": resolvedPlaceholder.value || unref(signozT)("signoz.queryBuilder.filter", "过滤条件"),
              "completion-source": completionSource,
              "run-on-enter": true,
              invalid: showValidation.value,
              "test-id": __props.testId || "signoz-filter",
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event)),
              onRun: _cache[1] || (_cache[1] = ($event) => emit("run", __props.modelValue || ""))
            }, null, 8, ["model-value", "placeholder", "aria-label", "completion-source", "invalid", "test-id"]),
            showValidation.value ? (openBlock(), createBlock(unref(_sfc_main$y$1), {
              key: 0,
              title: validation.value.message ? `${validation.value.column != null ? `${validation.value.column}: ` : ""}${validation.value.message}` : unref(signozT)("signoz.querySearch.unbalanced", "表达式无效")
            }, {
              default: withCtx(() => [
                createElementVNode("span", {
                  class: "lqs-status lqs-status--error",
                  "data-testid": "signoz-lqs-validation",
                  "aria-label": unref(signozT)("signoz.querySearch.validationError")
                }, "!", 8, _hoisted_2$8)
              ]),
              _: 1
              /* STABLE */
            }, 8, ["title"])) : metaError.value ? (openBlock(), createBlock(unref(_sfc_main$y$1), {
              key: 1,
              title: metaError.value
            }, {
              default: withCtx(() => [
                createElementVNode("span", {
                  class: "lqs-status lqs-status--error",
                  "data-testid": "signoz-lqs-meta-error",
                  "aria-label": unref(signozT)("signoz.querySearch.metadataError")
                }, "!", 8, _hoisted_3$7)
              ]),
              _: 1
              /* STABLE */
            }, 8, ["title"])) : createCommentVNode("v-if", true)
          ],
          2
          /* CLASS */
        )
      ]);
    };
  }
});
const LogQuerySearch = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__scopeId", "data-v-82df9baf"]]);
const METRIC_AGG_CATALOG = {
  Sum: {
    time: ["rate", "increase"],
    space: ["sum", "avg", "min", "max", "count"],
    hideTimeAggregation: false
  },
  Gauge: {
    time: ["latest", "sum", "avg", "min", "max", "count", "count_distinct"],
    space: ["sum", "avg", "min", "max", "count"],
    hideTimeAggregation: false
  },
  Histogram: {
    time: [],
    space: ["p50", "p75", "p90", "p95", "p99"],
    hideTimeAggregation: true
  },
  ExponentialHistogram: {
    time: [],
    space: ["p50", "p75", "p90", "p95", "p99"],
    hideTimeAggregation: true
  },
  unknown: {
    time: ["latest", "sum", "avg", "min", "max", "count", "count_distinct", "rate", "increase"],
    space: ["sum", "avg", "min", "max", "count", "p50", "p75", "p90", "p95", "p99"],
    hideTimeAggregation: false
  }
};
function normalizeCatalogKind(type) {
  const t2 = String(type || "").toLowerCase();
  if (t2.includes("exp") && t2.includes("hist")) return "ExponentialHistogram";
  if (t2.includes("hist")) return "Histogram";
  if (t2 === "sum" || t2.startsWith("sum")) return "Sum";
  if (t2.includes("gauge")) return "Gauge";
  if (t2.includes("counter")) return "Sum";
  return "unknown";
}
function timeAggregationOptions(type) {
  const kind2 = normalizeCatalogKind(type);
  return METRIC_AGG_CATALOG[kind2].time.map((v) => ({ label: v, value: v }));
}
function spaceAggregationOptions(type) {
  const kind2 = normalizeCatalogKind(type);
  return METRIC_AGG_CATALOG[kind2].space.map((v) => ({ label: v, value: v }));
}
function shouldHideTimeAggregation(type) {
  return METRIC_AGG_CATALOG[normalizeCatalogKind(type)].hideTimeAggregation;
}
function coerceAggregationsForMetricType(type, current) {
  const timeOpts = timeAggregationOptions(type).map((o) => o.value);
  const spaceOpts = spaceAggregationOptions(type).map((o) => o.value);
  const hideTime = shouldHideTimeAggregation(type);
  const timeAggregation = hideTime ? void 0 : timeOpts.includes(String(current.timeAggregation || "")) ? current.timeAggregation : timeOpts[0];
  const spaceAggregation = spaceOpts.includes(String(current.spaceAggregation || "")) ? current.spaceAggregation : spaceOpts[0];
  return { timeAggregation, spaceAggregation, hideTime };
}
const _hoisted_1$7 = {
  key: 0,
  class: "qb-metrics-hist-row",
  "data-testid": "signoz-metric-aggregation-fields"
};
const _hoisted_2$7 = { class: "qb-label" };
const _hoisted_3$6 = { class: "qb-label qb-label--gap" };
const _hoisted_4$4 = { class: "qb-label qb-label--gap" };
const _hoisted_5$4 = {
  class: "qb-metrics-agg-grid",
  "data-testid": "signoz-metric-aggregation-fields"
};
const _hoisted_6$4 = { class: "qb-metrics-agg-cell" };
const _hoisted_7$4 = { class: "qb-label" };
const _hoisted_8$2 = { class: "qb-metrics-agg-cell" };
const _hoisted_9$2 = { class: "qb-label" };
const _hoisted_10$1 = { class: "qb-metrics-agg-cell" };
const _hoisted_11$1 = { class: "qb-label" };
const _hoisted_12$1 = { class: "qb-metrics-agg-cell" };
const _hoisted_13$1 = { class: "qb-label" };
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
  __name: "MetricAggregationFields",
  props: {
    metricType: {},
    timeAggregation: {},
    spaceAggregation: {},
    stepInterval: {},
    groupBy: {},
    testIdPrefix: {}
  },
  emits: ["update:metricType", "update:timeAggregation", "update:spaceAggregation", "update:stepInterval", "update:groupBy"],
  setup(__props, { emit: __emit }) {
    const STEP_OPTS = [
      { label: "60s", value: 60 },
      { label: "300s", value: 300 },
      { label: "600s", value: 600 },
      { label: "1800s", value: 1800 },
      { label: "3600s", value: 3600 }
    ];
    const props = __props;
    const emit = __emit;
    const tid = (base) => props.testIdPrefix ? `${base}-${props.testIdPrefix}` : base;
    function titleCase(v) {
      if (!v) return v;
      if (v.startsWith("p") && /^p\d+$/.test(v)) return v;
      if (v.includes("_")) {
        return v.split("_").map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
      }
      return v.charAt(0).toUpperCase() + v.slice(1);
    }
    const timeOpts = computed(
      () => timeAggregationOptions(props.metricType).map((o) => ({
        label: titleCase(o.value),
        value: o.value
      }))
    );
    const spaceOpts = computed(
      () => spaceAggregationOptions(props.metricType).map((o) => ({
        label: titleCase(o.value),
        value: o.value
      }))
    );
    const hideTime = computed(() => shouldHideTimeAggregation(props.metricType));
    const groupByText = computed(() => (props.groupBy || []).join(", "));
    watch(
      () => props.metricType,
      (mt) => {
        const c = coerceAggregationsForMetricType(mt, {
          timeAggregation: props.timeAggregation,
          spaceAggregation: props.spaceAggregation
        });
        if (!c.hideTime && c.timeAggregation != null && c.timeAggregation !== props.timeAggregation) {
          emit("update:timeAggregation", c.timeAggregation);
        }
        if (c.spaceAggregation != null && c.spaceAggregation !== props.spaceAggregation) {
          emit("update:spaceAggregation", c.spaceAggregation);
        }
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode(" Argus histogram: single horizontal row space | groupBy | step "),
          hideTime.value ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
            createElementVNode(
              "span",
              _hoisted_2$7,
              toDisplayString(unref(signozT)("signoz.queryBuilder.spaceAgg")),
              1
              /* TEXT */
            ),
            createVNode(unref(GSelect), {
              value: __props.spaceAggregation || void 0,
              options: spaceOpts.value,
              "show-search": false,
              "test-id": tid("signoz-space-agg"),
              class: "qb-sel-sm",
              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => emit("update:spaceAggregation", String($event || "")))
            }, null, 8, ["value", "options", "test-id"]),
            createElementVNode(
              "span",
              _hoisted_3$6,
              toDisplayString(unref(signozT)("signoz.queryBuilder.groupBy")),
              1
              /* TEXT */
            ),
            createVNode(unref(GSelect), {
              value: groupByText.value || void 0,
              options: [],
              "allow-clear": "",
              "show-search": false,
              placeholder: unref(signozT)("signoz.queryBuilder.placeholderAll"),
              "test-id": tid("signoz-group-by"),
              class: "qb-sel-lg qb-sel-groupby",
              "onUpdate:value": _cache[1] || (_cache[1] = ($event) => emit(
                "update:groupBy",
                String($event || "").split(",").map((s) => s.trim()).filter(Boolean)
              ))
            }, null, 8, ["value", "placeholder", "test-id"]),
            createElementVNode(
              "span",
              _hoisted_4$4,
              toDisplayString(unref(signozT)("signoz.queryBuilder.step")),
              1
              /* TEXT */
            ),
            createVNode(unref(GSelect), {
              value: __props.stepInterval ?? 60,
              options: STEP_OPTS,
              "show-search": false,
              "test-id": tid("signoz-offset"),
              class: "qb-sel-xs",
              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => emit("update:stepInterval", $event == null || $event === "" ? 60 : Number($event)))
            }, null, 8, ["value", "test-id"])
          ])) : (openBlock(), createElementBlock(
            Fragment,
            { key: 1 },
            [
              createCommentVNode(" Argus gauge/sum/etc: 2×2 grid [time|step] / [space|group] "),
              createElementVNode("div", _hoisted_5$4, [
                createElementVNode("div", _hoisted_6$4, [
                  createElementVNode(
                    "span",
                    _hoisted_7$4,
                    toDisplayString(unref(signozT)("signoz.queryBuilder.timeAgg")),
                    1
                    /* TEXT */
                  ),
                  createVNode(unref(GSelect), {
                    value: __props.timeAggregation || void 0,
                    options: timeOpts.value,
                    "show-search": false,
                    "test-id": tid("signoz-aggregation"),
                    class: "qb-flex",
                    "onUpdate:value": _cache[3] || (_cache[3] = ($event) => emit("update:timeAggregation", String($event || "")))
                  }, null, 8, ["value", "options", "test-id"])
                ]),
                createElementVNode("div", _hoisted_8$2, [
                  createElementVNode(
                    "span",
                    _hoisted_9$2,
                    toDisplayString(unref(signozT)("signoz.queryBuilder.step")),
                    1
                    /* TEXT */
                  ),
                  createVNode(unref(GSelect), {
                    value: __props.stepInterval ?? 60,
                    options: STEP_OPTS,
                    "show-search": false,
                    "test-id": tid("signoz-offset"),
                    class: "qb-flex",
                    "onUpdate:value": _cache[4] || (_cache[4] = ($event) => emit("update:stepInterval", $event == null || $event === "" ? 60 : Number($event)))
                  }, null, 8, ["value", "test-id"])
                ]),
                createElementVNode("div", _hoisted_10$1, [
                  createElementVNode(
                    "span",
                    _hoisted_11$1,
                    toDisplayString(unref(signozT)("signoz.queryBuilder.spaceAgg")),
                    1
                    /* TEXT */
                  ),
                  createVNode(unref(GSelect), {
                    value: __props.spaceAggregation || void 0,
                    options: spaceOpts.value,
                    "show-search": false,
                    "test-id": tid("signoz-space-agg"),
                    class: "qb-flex",
                    "onUpdate:value": _cache[5] || (_cache[5] = ($event) => emit("update:spaceAggregation", String($event || "")))
                  }, null, 8, ["value", "options", "test-id"])
                ]),
                createElementVNode("div", _hoisted_12$1, [
                  createElementVNode(
                    "span",
                    _hoisted_13$1,
                    toDisplayString(unref(signozT)("signoz.queryBuilder.groupBy")),
                    1
                    /* TEXT */
                  ),
                  createVNode(unref(GSelect), {
                    value: groupByText.value || void 0,
                    options: [],
                    "allow-clear": "",
                    "show-search": false,
                    placeholder: unref(signozT)("signoz.queryBuilder.placeholderAll"),
                    "test-id": tid("signoz-group-by"),
                    class: "qb-flex qb-sel-groupby",
                    "onUpdate:value": _cache[6] || (_cache[6] = ($event) => emit(
                      "update:groupBy",
                      String($event || "").split(",").map((s) => s.trim()).filter(Boolean)
                    ))
                  }, null, 8, ["value", "placeholder", "test-id"])
                ])
              ])
            ],
            2112
            /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
          ))
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});
const MetricAggregationFields = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-53af6e24"]]);
const _hoisted_1$6 = {
  class: "qb",
  "data-testid": "signoz-query-builder"
};
const _hoisted_2$6 = {
  class: "qb-content",
  "data-testid": "signoz-qb-content"
};
const _hoisted_3$5 = ["data-testid", "data-query-name"];
const _hoisted_4$3 = {
  class: "qb-row qb-row--where",
  "data-testid": "signoz-qb-query-chrome"
};
const _hoisted_5$3 = ["data-testid", "title", "aria-expanded", "onClick"];
const _hoisted_6$3 = {
  class: "qb-chip",
  "data-testid": "signoz-qb-query-name",
  "data-matrix-id": "signoz-row-name"
};
const _hoisted_7$3 = {
  hidden: "",
  "data-testid": "signoz-row-name"
};
const _hoisted_8$1 = {
  key: 1,
  class: "qb-row qb-row--functions",
  "data-testid": "signoz-qb-functions-row"
};
const _hoisted_9$1 = ["data-testid", "onClick"];
const _hoisted_10 = ["data-testid", "onClick"];
const _hoisted_11 = { class: "qb-ico-label" };
const _hoisted_12 = { class: "qb-row-actions" };
const _hoisted_13 = ["data-testid", "title", "onClick"];
const _hoisted_14 = {
  key: 0,
  hidden: "",
  "data-testid": "signoz-row-copy"
};
const _hoisted_15 = ["data-testid", "title", "onClick"];
const _hoisted_16 = ["data-testid", "title", "onClick"];
const _hoisted_17 = {
  key: 0,
  class: "qb-elements",
  "data-testid": "signoz-qb-query-body"
};
const _hoisted_18 = {
  class: "qb-row qb-row--filter",
  "data-testid": "signoz-qb-filter-row"
};
const _hoisted_19 = {
  key: 0,
  class: "qb-row qb-row--agg",
  "data-testid": "signoz-qb-agg"
};
const _hoisted_20 = { class: "qb-label" };
const _hoisted_21 = {
  key: 1,
  class: "qb-addons-content",
  "data-testid": "signoz-qb-addons-content"
};
const _hoisted_22 = {
  key: 0,
  class: "qb-addon-cell qb-addon-cell--full"
};
const _hoisted_23 = { class: "qb-label" };
const _hoisted_24 = {
  key: 1,
  class: "qb-addon-cell"
};
const _hoisted_25 = { class: "qb-label" };
const _hoisted_26 = {
  key: 2,
  class: "qb-addon-cell"
};
const _hoisted_27 = { class: "qb-label" };
const _hoisted_28 = {
  key: 3,
  class: "qb-addon-cell"
};
const _hoisted_29 = { class: "qb-label" };
const _hoisted_30 = {
  key: 4,
  class: "qb-addon-cell qb-addon-cell--full"
};
const _hoisted_31 = { class: "qb-label" };
const _hoisted_32 = {
  key: 2,
  class: "qb-addons-bar",
  "data-testid": "signoz-qb-addons-bar"
};
const _hoisted_33 = ["data-testid", "onClick"];
const _hoisted_34 = { class: "qb-ico-label" };
const _hoisted_35 = ["data-testid"];
const _hoisted_36 = { class: "qb-row qb-row--where" };
const _hoisted_37 = ["data-testid", "title", "aria-expanded", "onClick"];
const _hoisted_38 = { class: "qb-chip qb-chip--formula" };
const _hoisted_39 = { class: "qb-row-actions" };
const _hoisted_40 = ["data-testid", "title", "onClick"];
const _hoisted_41 = ["data-testid", "title", "onClick"];
const _hoisted_42 = { class: "qb-row qb-row--formula-body" };
const _hoisted_43 = { class: "qb-formula-expr-wrap" };
const _hoisted_44 = { class: "qb-label" };
const _hoisted_45 = { class: "qb-formula-legend-wrap" };
const _hoisted_46 = { class: "qb-label" };
const _hoisted_47 = {
  key: 0,
  class: "qb-addons-content"
};
const _hoisted_48 = {
  key: 0,
  class: "qb-addon-cell"
};
const _hoisted_49 = { class: "qb-label" };
const _hoisted_50 = {
  key: 1,
  class: "qb-addon-cell"
};
const _hoisted_51 = { class: "qb-label" };
const _hoisted_52 = { class: "qb-addons-bar" };
const _hoisted_53 = ["onClick"];
const _hoisted_54 = { class: "qb-ico-label" };
const _hoisted_55 = ["onClick"];
const _hoisted_56 = { class: "qb-ico-label" };
const _hoisted_57 = {
  class: "qb-footer",
  "data-testid": "signoz-qb-footer"
};
const _hoisted_58 = { "data-testid": "signoz-add-query" };
const _hoisted_59 = { class: "qb-ico-label" };
const _hoisted_60 = { "data-testid": "signoz-add-formula" };
const _hoisted_61 = { class: "qb-ico-label" };
const _hoisted_62 = {
  key: 0,
  class: "qb-nav",
  "data-testid": "signoz-qb-navigator",
  "aria-hidden": "true"
};
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  __name: "QueryBuilder",
  props: {
    modelValue: {},
    mode: {},
    showAgg: { type: Boolean, default: false },
    simple: { type: Boolean, default: false },
    datasourceApi: {}
  },
  emits: ["change", "update:modelValue", "run"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const clock2 = {
      mode: props.mode,
      now: () => Date.now()
    };
    const state2 = ref(
      props.modelValue ? {
        queries: props.modelValue.queries.map((q) => ({ ...q })),
        formulas: props.modelValue.formulas.map((f) => ({ ...f }))
      } : createInitialState(clock2)
    );
    watch(
      () => props.modelValue,
      (v) => {
        if (!v) return;
        state2.value = {
          queries: v.queries.map((q) => ({ ...q })),
          formulas: v.formulas.map((f) => ({ ...f }))
        };
      },
      { deep: true }
    );
    const display = computed(
      () => resolveDisplayFlags({ showAgg: props.showAgg, simple: props.simple })
    );
    const forcedMode = computed(() => props.mode);
    const signalOptions = computed(() => [
      {
        label: signozT("signoz.queryBuilder.signal.traces"),
        value: "traces"
      },
      {
        label: signozT("signoz.queryBuilder.signal.logs"),
        value: "logs"
      },
      {
        label: signozT("signoz.queryBuilder.signal.metrics"),
        value: "metrics"
      },
      {
        label: signozT("signoz.queryBuilder.signal.exceptions"),
        value: "exceptions"
      }
    ]);
    function commit(mutation, mutateLocal) {
      const result = applyMutation(state2.value, mutation);
      state2.value = result.state;
      emit("update:modelValue", state2.value);
      if (result.shouldEmit) {
        emit("change", state2.value.queries, state2.value.formulas);
      }
    }
    function updateQueryField(index2, key, value) {
      const next = {
        queries: state2.value.queries.map((q, i) => i === index2 ? { ...q, [key]: value } : q),
        formulas: state2.value.formulas.map((f) => ({ ...f }))
      };
      state2.value = next;
      emit("update:modelValue", next);
      emit("change", next.queries, next.formulas);
    }
    function updateFormulaField(index2, key, value) {
      const next = {
        queries: state2.value.queries.map((q) => ({ ...q })),
        formulas: state2.value.formulas.map((f, i) => i === index2 ? { ...f, [key]: value } : f)
      };
      state2.value = next;
      emit("update:modelValue", next);
      emit("change", next.queries, next.formulas);
    }
    function currentSignal2(q) {
      return forcedMode.value ?? q.signal;
    }
    function showSignalSelector() {
      return !forcedMode.value;
    }
    function canDeleteQuery() {
      return state2.value.queries.length > 1;
    }
    function showNavigator() {
      return state2.value.queries.length > 1 || state2.value.formulas.length > 0;
    }
    function addonIconName(key) {
      switch (key) {
        case "group_by":
          return "apps";
        case "having":
          return "filter";
        case "order_by":
          return "sort";
        case "limit":
          return "compress";
        case "legend_format":
          return "tag";
        default:
          return "info";
      }
    }
    function onToggleAddOn(qi, key) {
      commit({ type: "toggleAddOn", queryIndex: qi, key });
    }
    function onToggleFormulaAddOn(fi, key) {
      commit({ type: "toggleFormulaAddOn", formulaIndex: fi, key });
    }
    function onAddFunction(qi) {
      const next = addFunction(state2.value, qi, forcedMode.value);
      state2.value = next;
      emit("update:modelValue", next);
      emit("change", next.queries, next.formulas);
    }
    function onRemoveFunction(qi, fi) {
      const next = removeFunction(state2.value, qi, fi);
      state2.value = next;
      emit("update:modelValue", next);
      emit("change", next.queries, next.formulas);
    }
    function updateFunctionField(qi, fi, patch) {
      const next = {
        queries: state2.value.queries.map((q, i) => {
          if (i !== qi) return { ...q };
          const functions = q.functions.map((fn, j) => {
            if (j !== fi) return { ...fn };
            const name = patch.name ?? fn.name;
            const arg = patch.name != null && patch.name !== fn.name ? "" : patch.arg ?? fn.arg;
            return { name, arg };
          });
          return { ...q, functions };
        }),
        formulas: state2.value.formulas.map((f) => ({ ...f }))
      };
      state2.value = next;
      emit("update:modelValue", next);
      emit("change", next.queries, next.formulas);
    }
    function onMetricTypeChange(qi, metricType) {
      const q = state2.value.queries[qi];
      if (!q) return;
      const clamped = clampAggregationsForMetricType(q, metricType);
      updateQueryField(qi, "metricType", clamped.metricType);
      const next = {
        queries: state2.value.queries.map((item, i) => i === qi ? { ...clamped } : item),
        formulas: state2.value.formulas.map((f) => ({ ...f }))
      };
      state2.value = next;
      emit("update:modelValue", next);
      emit("change", next.queries, next.formulas);
    }
    function fnOptions(q) {
      return functionOptionsForSignal(currentSignal2(q)).map((o) => ({
        label: o.label,
        value: o.value
      }));
    }
    function fnNeedsArg(q, name) {
      const def = functionOptionsForSignal(currentSignal2(q)).find((o) => o.value === name);
      return Boolean(def && def.showArg);
    }
    function patchSelectA11y(root = document) {
      root.querySelectorAll(".ant-select-selection-search-input").forEach((el) => {
        const select = el.closest(".ant-select");
        const labelled = select?.getAttribute("aria-label") || select?.querySelector(".ant-select-selection-item")?.textContent?.trim() || select?.querySelector(".ant-select-selection-placeholder")?.textContent?.trim() || signozT("signoz.common.select", "Select");
        if (!el.getAttribute("aria-label")) el.setAttribute("aria-label", labelled);
        if (!el.hasAttribute("aria-expanded")) el.setAttribute("aria-expanded", "false");
        el.removeAttribute("aria-owns");
        el.removeAttribute("aria-activedescendant");
      });
    }
    let selectA11yObserver = null;
    onMounted(() => {
      nextTick(() => patchSelectA11y());
      selectA11yObserver = new MutationObserver(() => patchSelectA11y());
      selectA11yObserver.observe(document.body, { childList: true, subtree: true });
    });
    onUnmounted(() => {
      selectA11yObserver?.disconnect();
      selectA11yObserver = null;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$6, [
        createElementVNode("div", _hoisted_2$6, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(state2.value.queries, (query, qi) => {
              return openBlock(), createElementBlock("div", {
                key: query.id || `${query.name}-${qi}`,
                class: "qb-query",
                "data-testid": `signoz-qb-query-${query.name}`,
                "data-query-name": query.name
              }, [
                createElementVNode(
                  "div",
                  {
                    class: normalizeClass(["qb-body pb-2 shadow-sm", { "qb-body--disabled": query.disabled }])
                  },
                  [
                    createCommentVNode(" WHERE chrome: collapse + chip + signal + functions + actions "),
                    createElementVNode("div", _hoisted_4$3, [
                      createElementVNode("button", {
                        type: "button",
                        class: "qb-btn-icon qb-collapse-btn",
                        "data-testid": `signoz-qb-collapse-${qi}`,
                        title: query._collapsed ? unref(signozT)("signoz.queryBuilder.expand") : unref(signozT)("signoz.queryBuilder.collapse"),
                        "aria-expanded": !query._collapsed,
                        onClick: ($event) => commit({ type: "toggleCollapse", index: qi })
                      }, [
                        createVNode(unref(GIcon), {
                          name: query._collapsed ? "angle-right" : "angle-down",
                          size: 14
                        }, null, 8, ["name"])
                      ], 8, _hoisted_5$3),
                      createElementVNode(
                        "span",
                        _hoisted_6$3,
                        toDisplayString(query.name),
                        1
                        /* TEXT */
                      ),
                      createElementVNode(
                        "span",
                        _hoisted_7$3,
                        toDisplayString(query.name),
                        1
                        /* TEXT */
                      ),
                      showSignalSelector() ? (openBlock(), createBlock(unref(GSelect), {
                        key: 0,
                        class: "qb-sel-signal",
                        value: query.signal,
                        options: signalOptions.value,
                        "show-search": false,
                        "aria-label": unref(signozT)("signoz.queryBuilder.signal", "信号类型"),
                        "test-id": "signoz-qb-signal",
                        "onUpdate:value": ($event) => updateQueryField(qi, "signal", $event)
                      }, null, 8, ["value", "options", "aria-label", "onUpdate:value"])) : createCommentVNode("v-if", true),
                      query.functions.length ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
                        (openBlock(true), createElementBlock(
                          Fragment,
                          null,
                          renderList(query.functions, (fn, fi) => {
                            return openBlock(), createElementBlock("div", {
                              key: fi,
                              class: "qb-fn-item"
                            }, [
                              createVNode(unref(GSelect), {
                                value: fn.name,
                                options: fnOptions(query),
                                "show-search": false,
                                "aria-label": unref(signozT)("signoz.queryBuilder.function", "函数"),
                                "test-id": `signoz-qb-fn-name-${qi}-${fi}`,
                                "onUpdate:value": ($event) => updateFunctionField(qi, fi, { name: String($event) })
                              }, null, 8, ["value", "options", "aria-label", "test-id", "onUpdate:value"]),
                              fnNeedsArg(query, fn.name) ? (openBlock(), createBlock(unref(GInput), {
                                key: 0,
                                class: "qb-fn-arg",
                                "model-value": fn.arg,
                                placeholder: unref(signozT)("signoz.queryBuilder.functionArg"),
                                "data-testid": `signoz-qb-fn-arg-${qi}-${fi}`,
                                "onUpdate:modelValue": ($event) => updateFunctionField(qi, fi, { arg: String($event ?? "") })
                              }, null, 8, ["model-value", "placeholder", "data-testid", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
                              createElementVNode("button", {
                                type: "button",
                                class: "qb-btn-icon",
                                "data-testid": `signoz-qb-fn-remove-${qi}-${fi}`,
                                onClick: ($event) => onRemoveFunction(qi, fi)
                              }, [..._cache[4] || (_cache[4] = [
                                createElementVNode(
                                  "span",
                                  {
                                    class: "qb-ico qb-ico--14",
                                    "aria-hidden": "true"
                                  },
                                  "×",
                                  -1
                                  /* CACHED */
                                )
                              ])], 8, _hoisted_9$1)
                            ]);
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ])) : createCommentVNode("v-if", true),
                      query.functions.length < 3 ? (openBlock(), createElementBlock("button", {
                        key: 2,
                        type: "button",
                        class: "qb-fn-add-btn",
                        "data-testid": `signoz-qb-functions-${qi}`,
                        onClick: ($event) => onAddFunction(qi)
                      }, [
                        createElementVNode("span", null, [
                          createVNode(unref(GIcon), {
                            name: "plus",
                            size: 12
                          }),
                          createElementVNode(
                            "span",
                            _hoisted_11,
                            toDisplayString(unref(signozT)("signoz.queryBuilder.addFunction")),
                            1
                            /* TEXT */
                          )
                        ])
                      ], 8, _hoisted_10)) : createCommentVNode("v-if", true),
                      _cache[5] || (_cache[5] = createElementVNode(
                        "div",
                        { class: "flex-1" },
                        null,
                        -1
                        /* CACHED */
                      )),
                      createElementVNode("div", _hoisted_12, [
                        createElementVNode("button", {
                          type: "button",
                          class: "qb-btn-icon",
                          "data-testid": `signoz-qb-clone-${qi}`,
                          "data-matrix-id": "signoz-row-copy",
                          title: unref(signozT)("signoz.queryBuilder.cloneQuery"),
                          onClick: ($event) => commit({ type: "cloneQuery", index: qi, opts: clock2 })
                        }, [
                          qi === 0 ? (openBlock(), createElementBlock("span", _hoisted_14)) : createCommentVNode("v-if", true),
                          createVNode(unref(GIcon), {
                            name: "copy",
                            size: 14
                          })
                        ], 8, _hoisted_13),
                        createElementVNode("button", {
                          type: "button",
                          class: "qb-btn-icon",
                          "data-testid": `signoz-qb-disable-${qi}`,
                          title: query.disabled ? unref(signozT)("signoz.traces.enableQuery") : unref(signozT)("signoz.traces.disableQuery"),
                          onClick: ($event) => commit({ type: "toggleDisabled", index: qi })
                        }, [
                          createVNode(unref(GIcon), {
                            name: query.disabled ? "eye-slash" : "eye",
                            size: 14
                          }, null, 8, ["name"])
                        ], 8, _hoisted_15),
                        canDeleteQuery() ? (openBlock(), createElementBlock("button", {
                          key: 0,
                          type: "button",
                          class: "qb-btn-icon qb-btn-icon--danger",
                          "data-testid": `signoz-qb-remove-${qi}`,
                          title: unref(signozT)("signoz.traces.removeQuery"),
                          onClick: ($event) => commit({ type: "removeQuery", index: qi })
                        }, [
                          createVNode(unref(GIcon), {
                            name: "trash",
                            size: 14
                          })
                        ], 8, _hoisted_16)) : createCommentVNode("v-if", true)
                      ])
                    ]),
                    createCommentVNode(" Collapsible body: filter / agg / add-ons — indented tree "),
                    !query._collapsed ? (openBlock(), createElementBlock("div", _hoisted_17, [
                      createElementVNode("div", _hoisted_18, [
                        currentSignal2(query) === "metrics" ? (openBlock(), createBlock(unref(GSelect), {
                          key: 0,
                          class: "qb-sel-metric",
                          "show-search": true,
                          value: query.metricName || void 0,
                          options: (query._metricOpts || []).map((m) => ({
                            label: typeof m === "string" ? m : m.name || m.label || String(m),
                            value: typeof m === "string" ? m : m.name || m.value || String(m)
                          })),
                          placeholder: unref(signozT)("signoz.metrics.selectMetricPlaceholder"),
                          "allow-clear": "",
                          "test-id": "signoz-qb-metric-name",
                          "onUpdate:value": ($event) => updateQueryField(qi, "metricName", String($event ?? ""))
                        }, null, 8, ["value", "options", "placeholder", "onUpdate:value"])) : createCommentVNode("v-if", true),
                        createVNode(LogQuerySearch, {
                          class: "flex-1",
                          "model-value": query.where,
                          signal: currentSignal2(query) === "metrics" ? "metrics" : currentSignal2(query) === "logs" ? "logs" : "traces",
                          "datasource-api": __props.datasourceApi,
                          "data-testid": "signoz-qb-where",
                          "onUpdate:modelValue": ($event) => updateQueryField(qi, "where", $event),
                          onRun: _cache[0] || (_cache[0] = ($event) => emit("run"))
                        }, null, 8, ["model-value", "signal", "datasource-api", "onUpdate:modelValue"])
                      ]),
                      display.value.showAgg ? (openBlock(), createElementBlock("div", _hoisted_19, [
                        currentSignal2(query) === "metrics" ? (openBlock(), createBlock(MetricAggregationFields, {
                          key: 0,
                          "metric-type": query.metricType,
                          "time-aggregation": query.timeAggregation,
                          "space-aggregation": query.spaceAggregation,
                          "step-interval": query.step === null || query.step === void 0 ? null : query.step,
                          "group-by": query.groupBy,
                          "test-id-prefix": String(qi),
                          "onUpdate:metricType": ($event) => onMetricTypeChange(qi, $event),
                          "onUpdate:timeAggregation": ($event) => updateQueryField(qi, "timeAggregation", $event),
                          "onUpdate:spaceAggregation": ($event) => updateQueryField(qi, "spaceAggregation", $event),
                          "onUpdate:stepInterval": ($event) => updateQueryField(qi, "step", $event ?? 60),
                          "onUpdate:groupBy": ($event) => updateQueryField(qi, "groupBy", $event)
                        }, null, 8, ["metric-type", "time-aggregation", "space-aggregation", "step-interval", "group-by", "test-id-prefix", "onUpdate:metricType", "onUpdate:timeAggregation", "onUpdate:spaceAggregation", "onUpdate:stepInterval", "onUpdate:groupBy"])) : (openBlock(), createElementBlock(
                          Fragment,
                          { key: 1 },
                          [
                            createElementVNode(
                              "span",
                              _hoisted_20,
                              toDisplayString(unref(signozT)("signoz.queryBuilder.agg")),
                              1
                              /* TEXT */
                            ),
                            createVNode(QueryAggregationEditor, {
                              class: "flex-1",
                              "model-value": query.aggregations,
                              signal: currentSignal2(query) === "logs" ? "logs" : "traces",
                              "show-interval": true,
                              "step-interval": query.step === null || query.step === void 0 ? null : query.step,
                              "data-testid": "signoz-qb-expression-agg",
                              "onUpdate:modelValue": ($event) => updateQueryField(qi, "aggregations", $event),
                              "onUpdate:stepInterval": ($event) => updateQueryField(qi, "step", $event ?? 60),
                              onRun: _cache[1] || (_cache[1] = ($event) => emit("run"))
                            }, null, 8, ["model-value", "signal", "step-interval", "onUpdate:modelValue", "onUpdate:stepInterval"])
                          ],
                          64
                          /* STABLE_FRAGMENT */
                        ))
                      ])) : createCommentVNode("v-if", true),
                      display.value.showAgg && query._addOns.length ? (openBlock(), createElementBlock("div", _hoisted_21, [
                        query._addOns.includes("group_by") && currentSignal2(query) !== "metrics" ? (openBlock(), createElementBlock("div", _hoisted_22, [
                          createElementVNode(
                            "span",
                            _hoisted_23,
                            toDisplayString(unref(signozT)("signoz.queryBuilder.groupBy")),
                            1
                            /* TEXT */
                          ),
                          createVNode(unref(GSelect), {
                            class: "flex-1",
                            mode: "multiple",
                            value: query.groupBy,
                            options: [],
                            "allow-clear": "",
                            placeholder: unref(signozT)("signoz.queryBuilder.placeholderAll"),
                            "show-search": true,
                            "test-id": "signoz-qb-groupby",
                            "onUpdate:value": ($event) => updateQueryField(
                              qi,
                              "groupBy",
                              Array.isArray($event) ? $event : String($event ?? "").split(",").map((s) => s.trim()).filter(Boolean)
                            )
                          }, null, 8, ["value", "placeholder", "onUpdate:value"])
                        ])) : createCommentVNode("v-if", true),
                        query._addOns.includes("having") ? (openBlock(), createElementBlock("div", _hoisted_24, [
                          createElementVNode(
                            "span",
                            _hoisted_25,
                            toDisplayString(unref(signozT)("signoz.queryBuilder.having")),
                            1
                            /* TEXT */
                          ),
                          createVNode(unref(GInput), {
                            class: "flex-1 having-input",
                            "model-value": query.having,
                            placeholder: unref(signozT)("signoz.queryBuilder.havingPlaceholder"),
                            "data-testid": "signoz-qb-having",
                            "onUpdate:modelValue": ($event) => updateQueryField(qi, "having", String($event ?? ""))
                          }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
                        ])) : createCommentVNode("v-if", true),
                        query._addOns.includes("order_by") ? (openBlock(), createElementBlock("div", _hoisted_26, [
                          createElementVNode(
                            "span",
                            _hoisted_27,
                            toDisplayString(unref(signozT)("signoz.queryBuilder.orderBy")),
                            1
                            /* TEXT */
                          ),
                          createVNode(unref(GInput), {
                            class: "flex-1",
                            "model-value": query.orderBy,
                            "data-testid": "signoz-qb-orderby",
                            "onUpdate:modelValue": ($event) => updateQueryField(qi, "orderBy", String($event ?? ""))
                          }, null, 8, ["model-value", "onUpdate:modelValue"])
                        ])) : createCommentVNode("v-if", true),
                        query._addOns.includes("limit") ? (openBlock(), createElementBlock("div", _hoisted_28, [
                          createElementVNode(
                            "span",
                            _hoisted_29,
                            toDisplayString(unref(signozT)("signoz.queryBuilder.limit")),
                            1
                            /* TEXT */
                          ),
                          createVNode(unref(GInput), {
                            class: "flex-1",
                            "model-value": String(query.limit),
                            type: "number",
                            "data-testid": "signoz-qb-limit",
                            "onUpdate:modelValue": ($event) => updateQueryField(qi, "limit", Number($event) || 0)
                          }, null, 8, ["model-value", "onUpdate:modelValue"])
                        ])) : createCommentVNode("v-if", true),
                        query._addOns.includes("legend_format") ? (openBlock(), createElementBlock("div", _hoisted_30, [
                          createElementVNode(
                            "span",
                            _hoisted_31,
                            toDisplayString(unref(signozT)("signoz.queryBuilder.legend")),
                            1
                            /* TEXT */
                          ),
                          createVNode(unref(GInput), {
                            class: "qb-legend-input",
                            "model-value": query.legend,
                            placeholder: unref(signozT)("signoz.queryBuilder.legendPlaceholder"),
                            "data-testid": "signoz-qb-legend",
                            "onUpdate:modelValue": ($event) => updateQueryField(qi, "legend", String($event ?? ""))
                          }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
                        ])) : createCommentVNode("v-if", true)
                      ])) : createCommentVNode("v-if", true),
                      display.value.showAgg ? (openBlock(), createElementBlock("div", _hoisted_32, [
                        (openBlock(true), createElementBlock(
                          Fragment,
                          null,
                          renderList(unref(visibleAddOnKeys)(currentSignal2(query)), (key) => {
                            return openBlock(), createElementBlock("button", {
                              key,
                              type: "button",
                              class: normalizeClass(["qb-addon-btn", {
                                "qb-addon-btn--active": query._addOns.includes(key)
                              }]),
                              "data-testid": `signoz-qb-addon-${key}`,
                              onClick: ($event) => onToggleAddOn(qi, key)
                            }, [
                              createElementVNode("span", null, [
                                createVNode(unref(GIcon), {
                                  name: addonIconName(key),
                                  size: 14
                                }, null, 8, ["name"]),
                                createElementVNode(
                                  "span",
                                  _hoisted_34,
                                  toDisplayString(key === "group_by" ? unref(signozT)("signoz.queryBuilder.addOnGroupBy") : key === "having" ? unref(signozT)("signoz.queryBuilder.addOnHaving") : key === "order_by" ? unref(signozT)("signoz.queryBuilder.addOnOrderBy") : key === "limit" ? unref(signozT)("signoz.queryBuilder.addOnLimit") : unref(signozT)("signoz.queryBuilder.addOnLegend")),
                                  1
                                  /* TEXT */
                                )
                              ])
                            ], 10, _hoisted_33);
                          }),
                          128
                          /* KEYED_FRAGMENT */
                        ))
                      ])) : createCommentVNode("v-if", true)
                    ])) : createCommentVNode("v-if", true)
                  ],
                  2
                  /* CLASS */
                )
              ], 8, _hoisted_3$5);
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          !display.value.simple ? (openBlock(true), createElementBlock(
            Fragment,
            { key: 0 },
            renderList(state2.value.formulas, (formula, fi) => {
              return openBlock(), createElementBlock("div", {
                key: formula.id || `${formula.name}-${fi}`,
                class: "qb-formula",
                "data-testid": `signoz-qb-formula-${formula.name}`
              }, [
                createElementVNode(
                  "div",
                  {
                    class: normalizeClass(["qb-body pb-2 shadow-sm", { "qb-body--disabled": formula.disabled }])
                  },
                  [
                    createElementVNode("div", _hoisted_36, [
                      createElementVNode("button", {
                        type: "button",
                        class: "qb-btn-icon qb-collapse-btn",
                        "data-testid": `signoz-qb-formula-collapse-${fi}`,
                        title: formula._collapsed ? unref(signozT)("signoz.queryBuilder.expand") : unref(signozT)("signoz.queryBuilder.collapse"),
                        "aria-expanded": !formula._collapsed,
                        onClick: ($event) => commit({ type: "toggleFormulaCollapse", index: fi })
                      }, [
                        createVNode(unref(GIcon), {
                          name: formula._collapsed ? "angle-right" : "angle-down",
                          size: 14
                        }, null, 8, ["name"])
                      ], 8, _hoisted_37),
                      createElementVNode(
                        "span",
                        _hoisted_38,
                        toDisplayString(formula.name),
                        1
                        /* TEXT */
                      ),
                      _cache[6] || (_cache[6] = createElementVNode(
                        "div",
                        { class: "flex-1" },
                        null,
                        -1
                        /* CACHED */
                      )),
                      createElementVNode("div", _hoisted_39, [
                        createElementVNode("button", {
                          type: "button",
                          class: "qb-btn-icon",
                          "data-testid": `signoz-qb-formula-disable-${fi}`,
                          title: formula.disabled ? unref(signozT)("signoz.traces.enableQuery") : unref(signozT)("signoz.traces.disableQuery"),
                          onClick: ($event) => commit({ type: "toggleFormulaDisabled", index: fi })
                        }, [
                          createVNode(unref(GIcon), {
                            name: formula.disabled ? "eye-slash" : "eye",
                            size: 14
                          }, null, 8, ["name"])
                        ], 8, _hoisted_40),
                        createElementVNode("button", {
                          type: "button",
                          class: "qb-btn-icon qb-btn-icon--danger",
                          "data-testid": `signoz-qb-formula-remove-${fi}`,
                          title: unref(signozT)("signoz.traces.removeQuery"),
                          onClick: ($event) => commit({ type: "removeFormula", index: fi })
                        }, [
                          createVNode(unref(GIcon), {
                            name: "trash",
                            size: 14
                          })
                        ], 8, _hoisted_41)
                      ])
                    ]),
                    !formula._collapsed ? (openBlock(), createElementBlock(
                      Fragment,
                      { key: 0 },
                      [
                        createElementVNode("div", _hoisted_42, [
                          createElementVNode("div", _hoisted_43, [
                            createElementVNode(
                              "span",
                              _hoisted_44,
                              toDisplayString(unref(signozT)("signoz.queryBuilder.formulaExpr")),
                              1
                              /* TEXT */
                            ),
                            createVNode(unref(GInput), {
                              class: "flex-1",
                              "model-value": formula.expression,
                              placeholder: unref(signozT)("signoz.queryBuilder.formulaExprPlaceholder"),
                              "data-testid": "signoz-qb-formula-expr",
                              "onUpdate:modelValue": ($event) => updateFormulaField(fi, "expression", String($event ?? ""))
                            }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
                          ]),
                          createElementVNode("div", _hoisted_45, [
                            createElementVNode(
                              "span",
                              _hoisted_46,
                              toDisplayString(unref(signozT)("signoz.queryBuilder.legend")),
                              1
                              /* TEXT */
                            ),
                            createVNode(unref(GInput), {
                              class: "flex-1",
                              "model-value": formula.legend,
                              placeholder: unref(signozT)("signoz.queryBuilder.legendPlaceholder"),
                              "data-testid": "signoz-qb-formula-legend",
                              "onUpdate:modelValue": ($event) => updateFormulaField(fi, "legend", String($event ?? ""))
                            }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
                          ])
                        ]),
                        formula._addOns.length ? (openBlock(), createElementBlock("div", _hoisted_47, [
                          formula._addOns.includes("limit") ? (openBlock(), createElementBlock("div", _hoisted_48, [
                            createElementVNode(
                              "span",
                              _hoisted_49,
                              toDisplayString(unref(signozT)("signoz.queryBuilder.limit")),
                              1
                              /* TEXT */
                            ),
                            createVNode(unref(GInput), {
                              class: "flex-1",
                              "model-value": String(formula.limit),
                              type: "number",
                              "data-testid": "signoz-qb-formula-limit",
                              "onUpdate:modelValue": ($event) => updateFormulaField(fi, "limit", Number($event) || 0)
                            }, null, 8, ["model-value", "onUpdate:modelValue"])
                          ])) : createCommentVNode("v-if", true),
                          formula._addOns.includes("order_by") ? (openBlock(), createElementBlock("div", _hoisted_50, [
                            createElementVNode(
                              "span",
                              _hoisted_51,
                              toDisplayString(unref(signozT)("signoz.queryBuilder.orderBy")),
                              1
                              /* TEXT */
                            ),
                            createVNode(unref(GInput), {
                              class: "flex-1",
                              "model-value": formula.orderBy,
                              "data-testid": "signoz-qb-formula-orderby",
                              "onUpdate:modelValue": ($event) => updateFormulaField(fi, "orderBy", String($event ?? ""))
                            }, null, 8, ["model-value", "onUpdate:modelValue"])
                          ])) : createCommentVNode("v-if", true)
                        ])) : createCommentVNode("v-if", true),
                        createElementVNode("div", _hoisted_52, [
                          createElementVNode("button", {
                            type: "button",
                            class: normalizeClass(["qb-addon-btn", {
                              "qb-addon-btn--active": formula._addOns.includes("order_by")
                            }]),
                            "data-testid": "signoz-qb-formula-addon-order_by",
                            onClick: ($event) => onToggleFormulaAddOn(fi, "order_by")
                          }, [
                            createElementVNode("span", null, [
                              createVNode(unref(GIcon), {
                                name: "sort",
                                size: 14
                              }),
                              createElementVNode(
                                "span",
                                _hoisted_54,
                                toDisplayString(unref(signozT)("signoz.queryBuilder.addOnOrderBy")),
                                1
                                /* TEXT */
                              )
                            ])
                          ], 10, _hoisted_53),
                          createElementVNode("button", {
                            type: "button",
                            class: normalizeClass(["qb-addon-btn", {
                              "qb-addon-btn--active": formula._addOns.includes("limit")
                            }]),
                            "data-testid": "signoz-qb-formula-addon-limit",
                            onClick: ($event) => onToggleFormulaAddOn(fi, "limit")
                          }, [
                            createElementVNode("span", null, [
                              createVNode(unref(GIcon), {
                                name: "compress",
                                size: 14
                              }),
                              createElementVNode(
                                "span",
                                _hoisted_56,
                                toDisplayString(unref(signozT)("signoz.queryBuilder.addOnLimit")),
                                1
                                /* TEXT */
                              )
                            ])
                          ], 10, _hoisted_55)
                        ])
                      ],
                      64
                      /* STABLE_FRAGMENT */
                    )) : createCommentVNode("v-if", true)
                  ],
                  2
                  /* CLASS */
                )
              ], 8, _hoisted_35);
            }),
            128
            /* KEYED_FRAGMENT */
          )) : createCommentVNode("v-if", true),
          createElementVNode("div", _hoisted_57, [
            createElementVNode("button", {
              type: "button",
              class: "qb-add-btn",
              "data-testid": "signoz-qb-add-query",
              onClick: _cache[2] || (_cache[2] = ($event) => commit({ type: "addQuery", opts: clock2 }))
            }, [
              createElementVNode("span", _hoisted_58, [
                createVNode(unref(GIcon), {
                  name: "plus",
                  size: 14
                }),
                createElementVNode(
                  "span",
                  _hoisted_59,
                  toDisplayString(unref(signozT)("signoz.traces.addQuery")),
                  1
                  /* TEXT */
                )
              ])
            ]),
            !display.value.simple ? (openBlock(), createElementBlock("button", {
              key: 0,
              type: "button",
              class: "qb-add-btn",
              "data-testid": "signoz-qb-add-formula",
              onClick: _cache[3] || (_cache[3] = ($event) => commit({ type: "addFormula", opts: clock2 }))
            }, [
              createElementVNode("span", _hoisted_60, [
                createVNode(unref(GIcon), {
                  name: "function",
                  size: 14
                }),
                createElementVNode(
                  "span",
                  _hoisted_61,
                  toDisplayString(unref(signozT)("signoz.queryBuilder.addFormula")),
                  1
                  /* TEXT */
                )
              ])
            ])) : createCommentVNode("v-if", true)
          ])
        ]),
        showNavigator() ? (openBlock(), createElementBlock("div", _hoisted_62, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(state2.value.queries, (q) => {
              return openBlock(), createElementBlock(
                "div",
                {
                  key: `nav-q-${q.id}`,
                  class: "qb-nav-item qb-nav-item--query"
                },
                toDisplayString(q.name),
                1
                /* TEXT */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          )),
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(state2.value.formulas, (f) => {
              return openBlock(), createElementBlock(
                "div",
                {
                  key: `nav-f-${f.id}`,
                  class: "qb-nav-item qb-nav-item--formula"
                },
                toDisplayString(f.name),
                1
                /* TEXT */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const QueryBuilder = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__scopeId", "data-v-b58c3947"]]);
const _hoisted_1$5 = {
  class: "signoz-query-type-tabs",
  "data-testid": "signoz-query-type-tabs",
  role: "tablist"
};
const _hoisted_2$5 = ["aria-selected", "aria-disabled", "disabled", "title", "data-testid", "onClick"];
const _hoisted_3$4 = {
  key: 0,
  class: "signoz-qtt-legacy",
  "data-testid": "signoz-legacy-mixed-warning",
  role: "status"
};
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  __name: "QueryTypeTabs",
  props: {
    mode: {},
    blocked: {},
    legacyMixed: { type: Boolean }
  },
  emits: ["update:mode"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const TABS = [
      { value: "builder", labelKey: "signoz.queryBuilder.tabBuilder" },
      { value: "promql", labelKey: "signoz.queryBuilder.tabPromql" },
      { value: "clickhouse_sql", labelKey: "signoz.queryBuilder.tabClickhouse" }
    ];
    function isBlocked(mode2) {
      return Boolean(props.blocked?.[mode2]);
    }
    function select(mode2) {
      if (isBlocked(mode2) || mode2 === props.mode) return;
      emit("update:mode", mode2);
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$5, [
        (openBlock(), createElementBlock(
          Fragment,
          null,
          renderList(TABS, (tab) => {
            return createElementVNode("button", {
              key: tab.value,
              type: "button",
              role: "tab",
              class: normalizeClass(["signoz-qtt-tab", {
                "signoz-qtt-tab--active": __props.mode === tab.value,
                "signoz-qtt-tab--disabled": isBlocked(tab.value)
              }]),
              "aria-selected": __props.mode === tab.value,
              "aria-disabled": isBlocked(tab.value) ? "true" : "false",
              disabled: isBlocked(tab.value),
              title: __props.blocked?.[tab.value] || unref(signozT)(tab.labelKey),
              "data-testid": tab.value === "builder" ? "signoz-mode" : `signoz-mode-${tab.value}`,
              onClick: ($event) => select(tab.value)
            }, toDisplayString(unref(signozT)(tab.labelKey)), 11, _hoisted_2$5);
          }),
          64
          /* STABLE_FRAGMENT */
        )),
        __props.legacyMixed ? (openBlock(), createElementBlock(
          "p",
          _hoisted_3$4,
          toDisplayString(unref(signozT)("signoz.queryBuilder.legacyMixed")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const QueryTypeTabs = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-33e69223"]]);
const FORBIDDEN_SQL_START = /^(insert|update|delete|drop|alter|truncate|create|replace|grant|revoke)\b/i;
function validateRawQuery(mode2, text) {
  const raw = String(text ?? "");
  if (mode2 === "promql") {
    if (!raw.trim()) return { ok: true, diagnostics: [] };
    const r = parsePromqlToAst(raw);
    const diagnostics = (r.diagnostics || []).filter((d) => d.severity === "error").map((d) => ({
      from: d.range?.from ?? 0,
      to: d.range?.to ?? raw.length,
      message: d.message || "PromQL 语法错误"
    }));
    return { ok: diagnostics.length === 0, diagnostics };
  }
  if (mode2 === "clickhouse_sql" || mode2 === "sql") {
    return validateSql(raw);
  }
  return { ok: true, diagnostics: [] };
}
function validateSql(raw) {
  const trimmed = raw.trim();
  if (!trimmed) return { ok: true, diagnostics: [] };
  let i = 0;
  let depth = 0;
  let inSingle = false;
  let inDouble = false;
  let inLineComment = false;
  let inBlockComment = false;
  const statements = [];
  let start = 0;
  let buf = "";
  const pushStmt = (end) => {
    const t2 = buf.trim();
    if (t2) statements.push({ from: start, text: t2 });
    buf = "";
    start = end + 1;
  };
  while (i < raw.length) {
    const c = raw[i];
    const n = raw[i + 1];
    if (inLineComment) {
      if (c === "\n") inLineComment = false;
      i += 1;
      continue;
    }
    if (inBlockComment) {
      if (c === "*" && n === "/") {
        inBlockComment = false;
        i += 2;
        continue;
      }
      i += 1;
      continue;
    }
    if (inSingle) {
      if (c === "\\") {
        buf += c + (n || "");
        i += 2;
        continue;
      }
      if (c === "'") {
        inSingle = false;
      }
      buf += c;
      i += 1;
      continue;
    }
    if (inDouble) {
      if (c === "\\") {
        buf += c + (n || "");
        i += 2;
        continue;
      }
      if (c === '"') {
        inDouble = false;
      }
      buf += c;
      i += 1;
      continue;
    }
    if (c === "-" && n === "-") {
      inLineComment = true;
      i += 2;
      continue;
    }
    if (c === "/" && n === "*") {
      inBlockComment = true;
      i += 2;
      continue;
    }
    if (c === "'") {
      inSingle = true;
      buf += c;
      i += 1;
      continue;
    }
    if (c === '"') {
      inDouble = true;
      buf += c;
      i += 1;
      continue;
    }
    if (c === "(") {
      depth += 1;
      buf += c;
      i += 1;
      continue;
    }
    if (c === ")") {
      depth = Math.max(0, depth - 1);
      buf += c;
      i += 1;
      continue;
    }
    if (c === ";" && depth === 0) {
      pushStmt(i);
      const rest = raw.slice(i + 1).trim();
      if (rest) {
        return {
          ok: false,
          diagnostics: [
            {
              from: i + 1,
              to: raw.length,
              message: "只允许单个 SELECT/WITH 语句"
            }
          ]
        };
      }
      i += 1;
      continue;
    }
    buf += c;
    i += 1;
  }
  if (buf.trim()) pushStmt(raw.length - 1);
  if (statements.length === 0) return { ok: true, diagnostics: [] };
  if (statements.length > 1) {
    return {
      ok: false,
      diagnostics: [
        {
          from: statements[1].from,
          to: raw.length,
          message: "只允许单个 SELECT/WITH 语句"
        }
      ]
    };
  }
  const stmt = statements[0].text;
  if (FORBIDDEN_SQL_START.test(stmt)) {
    return {
      ok: false,
      diagnostics: [
        {
          from: statements[0].from,
          to: statements[0].from + Math.min(12, stmt.length),
          message: "禁止 INSERT/UPDATE/DELETE/DROP 等写语句"
        }
      ]
    };
  }
  if (!/^(with|select)\b/i.test(stmt)) {
    return {
      ok: false,
      diagnostics: [
        {
          from: statements[0].from,
          to: statements[0].from + Math.min(12, stmt.length),
          message: "SQL 必须以 SELECT 或 WITH 开头"
        }
      ]
    };
  }
  return { ok: true, diagnostics: [] };
}
function formatRawQuery(mode2, text) {
  const raw = String(text ?? "");
  const v = validateRawQuery(mode2, raw);
  if (!v.ok) return raw;
  if (mode2 === "promql") {
    return raw.replaceAll(/[ \t]+/g, " ").replaceAll(/\s*\n\s*/g, "\n").trim();
  }
  if (mode2 === "clickhouse_sql" || mode2 === "sql") {
    return formatSql(raw);
  }
  return raw;
}
function formatSql(raw) {
  const clauses = ["SELECT", "FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", "HAVING", "WITH"];
  let out = "";
  let i = 0;
  let inSingle = false;
  let inDouble = false;
  while (i < raw.length) {
    const c = raw[i];
    if (inSingle) {
      out += c;
      if (c === "'" && raw[i - 1] !== "\\") inSingle = false;
      i += 1;
      continue;
    }
    if (inDouble) {
      out += c;
      if (c === '"' && raw[i - 1] !== "\\") inDouble = false;
      i += 1;
      continue;
    }
    if (c === "'") {
      inSingle = true;
      out += c;
      i += 1;
      continue;
    }
    if (c === '"') {
      inDouble = true;
      out += c;
      i += 1;
      continue;
    }
    let matched = false;
    for (const cl of clauses) {
      if (raw.slice(i, i + cl.length).toUpperCase() === cl) {
        const before = out.trimEnd();
        if (before && !before.endsWith("\n")) out = `${before}
`;
        out += cl;
        i += cl.length;
        matched = true;
        break;
      }
    }
    if (matched) continue;
    if (c === " " || c === "	" || c === "\n" || c === "\r") {
      if (!out.endsWith(" ") && !out.endsWith("\n") && out.length) out += " ";
      i += 1;
      continue;
    }
    out += c;
    i += 1;
  }
  return out.trim();
}
const _hoisted_1$4 = {
  class: "raw-qe",
  "data-testid": "signoz-raw-query-editor"
};
const _hoisted_2$4 = { class: "row" };
const _hoisted_3$3 = ["id"];
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  __name: "RawQueryEditor",
  props: {
    modelValue: {},
    mode: {},
    testId: {}
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const validation = computed(() => validateRawQuery(props.mode, props.modelValue));
    const describedBy = computed(
      () => validation.value.ok ? void 0 : `${props.testId || "signoz-raw"}-diag`
    );
    const language = computed(() => {
      if (props.mode === "clickhouse_sql" || props.mode === "sql") return "sql";
      if (props.mode === "promql") return "promql";
      return "plaintext";
    });
    function format() {
      emit("update:modelValue", formatRawQuery(props.mode, props.modelValue));
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$4, [
        createElementVNode("div", _hoisted_2$4, [
          createVNode(unref(GCodeEditor), {
            value: __props.modelValue,
            language: language.value,
            height: "140",
            "test-id": __props.testId || "signoz-raw-editor",
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", String($event)))
          }, null, 8, ["value", "language", "test-id"]),
          createVNode(unref(GButton), {
            size: "sm",
            variant: "secondary",
            type: "button",
            "test-id": "signoz-raw-format",
            title: unref(signozT)("signoz.raw.formatTitle"),
            onClick: format
          }, {
            default: withCtx(() => [
              createTextVNode(
                toDisplayString(unref(signozT)("signoz.raw.format")),
                1
                /* TEXT */
              )
            ]),
            _: 1
            /* STABLE */
          }, 8, ["title"])
        ]),
        !validation.value.ok ? (openBlock(), createElementBlock("div", {
          key: 0,
          id: describedBy.value,
          class: "diag",
          role: "alert",
          "data-testid": "signoz-raw-diagnostics"
        }, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(validation.value.diagnostics, (d, i) => {
              return openBlock(), createElementBlock(
                "div",
                { key: i },
                " [" + toDisplayString(d.from) + "-" + toDisplayString(d.to) + "] " + toDisplayString(d.message),
                1
                /* TEXT */
              );
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ], 8, _hoisted_3$3)) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const RawQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__scopeId", "data-v-1e3bdf9e"]]);
const PERSISTED_QUERY_KEYS = [
  "id",
  "name",
  "signal",
  "where",
  "aggregations",
  "aggOp",
  "aggAttr",
  "metricName",
  "metricType",
  "timeAggregation",
  "spaceAggregation",
  "groupBy",
  "having",
  "orderBy",
  "limit",
  "legend",
  "step",
  "disabled",
  "spanScope",
  "expression",
  "functions",
  "_addOns"
];
const PERSISTED_FORMULA_KEYS = [
  "id",
  "name",
  "expression",
  "legend",
  "having",
  "orderBy",
  "limit",
  "disabled",
  "_addOns"
];
const RUNTIME_EPHEMERAL = /* @__PURE__ */ new Set([
  "_collapsed",
  "_keyOpts",
  "_keysLoading",
  "_metricOpts",
  "_metricLoading"
]);
function cloneValue(value) {
  if (value == null || typeof value !== "object") return value;
  if (typeof structuredClone === "function") {
    try {
      return structuredClone(value);
    } catch {
    }
  }
  if (Array.isArray(value)) {
    return value.map((v) => cloneValue(v));
  }
  const out = {};
  for (const [k, v] of Object.entries(value)) {
    out[k] = cloneValue(v);
  }
  return out;
}
function unknownSiblings(source, known) {
  const knownSet = new Set(known);
  const out = {};
  for (const [k, v] of Object.entries(source)) {
    if (knownSet.has(k)) continue;
    if (RUNTIME_EPHEMERAL.has(k)) continue;
    out[k] = cloneValue(v);
  }
  return out;
}
function parseOrderByString(orderBy) {
  const raw = String(orderBy ?? "").trim();
  if (!raw) return [];
  const space = raw.match(/^(.+?)\s+(asc|desc)$/i);
  if (space) {
    return [
      {
        key: { name: space[1].trim() },
        direction: space[2].toLowerCase()
      }
    ];
  }
  const colon = raw.indexOf(":");
  if (colon > 0) {
    const name = raw.slice(0, colon).trim();
    const dir = raw.slice(colon + 1).trim().toLowerCase();
    return [
      {
        key: { name },
        direction: dir === "asc" ? "asc" : "desc"
      }
    ];
  }
  return [{ key: { name: raw }, direction: "desc" }];
}
function formatOrderByString(order, style = "query") {
  if (!order?.length) return style === "query" ? "timestamp:desc" : "";
  const first = order[0];
  const name = String(first?.key?.name ?? "").trim();
  if (!name) return style === "query" ? "timestamp:desc" : "";
  const dir = String(first?.direction ?? "desc").toLowerCase() === "asc" ? "asc" : "desc";
  if (style === "formula") return `${name} ${dir}`;
  if (name === "timestamp" || name === "value" || name.includes(".")) {
    return `${name}:${dir}`;
  }
  if (name.includes("(") || name.includes(" ")) return `${name} ${dir}`;
  return `${name}:${dir}`;
}
function parseAggregationExpressions(aggStr) {
  if (!aggStr?.trim()) return ["count()"];
  const re = /\b([a-z_]\w*)\s*\(([^)]*)\)/gi;
  const results = [];
  let m;
  while ((m = re.exec(aggStr)) !== null) {
    results.push(m[0].trim());
  }
  return results.length ? results : ["count()"];
}
function groupByToFields(groupBy) {
  return groupBy.map((name) => ({
    name,
    fieldDataType: "string",
    fieldContext: "tag"
  }));
}
function fieldsToGroupBy(fields) {
  if (!Array.isArray(fields)) return [];
  return fields.map((f) => {
    if (typeof f === "string") return f;
    return String(f.name ?? f.key ?? "").trim();
  }).filter(Boolean);
}
function functionsToSpec(fns) {
  return fns.map((f) => {
    const name = String(f.name || "");
    const arg = f.arg != null ? String(f.arg) : "";
    const knownArgNames = normalizeFunctionArgs(name, arg ? [arg] : []);
    const base = {
      name,
      args: knownArgNames.length ? knownArgNames : arg ? [{ name: "value", value: arg }] : []
    };
    const extras = unknownSiblings(f, ["name", "arg"]);
    if (Object.keys(extras).length) {
      return { ...base, ...extras };
    }
    return base;
  });
}
function functionsFromSpec(fns) {
  if (!Array.isArray(fns)) return [];
  return fns.map((f) => {
    const name = String(f.name || "");
    const args = Array.isArray(f.args) ? f.args : [];
    const first = args[0];
    const arg = first == null ? "" : typeof first === "object" ? String(first.value ?? "") : String(first);
    const extras = unknownSiblings(f, ["name", "args"]);
    return { name, arg, ...extras };
  });
}
function isMetricsSignal(signal) {
  return String(signal).toLowerCase() === "metrics";
}
function toPersistedSignal(signal) {
  return String(signal || "traces");
}
function toStructuredSignal(signal) {
  return toWireSignal(signal);
}
function runtimeQueryToPersisted(q) {
  const src = q;
  const functions = Array.isArray(q.functions) ? q.functions.map((f) => {
    const row = {
      name: String(f.name || ""),
      arg: f.arg != null ? String(f.arg) : ""
    };
    const extras = unknownSiblings(f, ["name", "arg"]);
    return { ...row, ...extras };
  }) : [];
  const base = {
    id: q.id,
    name: q.name,
    signal: toPersistedSignal(String(q.signal || "traces")),
    where: q.where ?? "",
    aggregations: q.aggregations ?? "count()",
    aggOp: q.aggOp ?? "count",
    aggAttr: q.aggAttr ?? "",
    metricName: q.metricName ?? "",
    metricType: q.metricType ?? "",
    timeAggregation: q.timeAggregation ?? "rate",
    spaceAggregation: q.spaceAggregation ?? "sum",
    groupBy: Array.isArray(q.groupBy) ? q.groupBy.map(String) : [],
    having: q.having ?? "",
    orderBy: q.orderBy ?? "timestamp:desc",
    limit: typeof q.limit === "number" ? q.limit : 100,
    legend: q.legend ?? "",
    step: q.step === void 0 ? 60 : q.step,
    disabled: Boolean(q.disabled),
    spanScope: q.spanScope ?? "all_spans",
    expression: q.expression ?? "",
    functions,
    _addOns: Array.isArray(q._addOns) ? q._addOns.map(String) : []
  };
  return {
    ...base,
    ...unknownSiblings(src, PERSISTED_QUERY_KEYS)
  };
}
function runtimeFormulaToPersisted(f) {
  const src = f;
  const base = {
    id: f.id,
    name: f.name,
    expression: f.expression ?? "",
    legend: f.legend ?? "",
    having: f.having ?? "",
    orderBy: f.orderBy ?? "",
    limit: typeof f.limit === "number" ? f.limit : 100,
    disabled: Boolean(f.disabled),
    _addOns: Array.isArray(f._addOns) ? f._addOns.map(String) : []
  };
  return {
    ...base,
    ...unknownSiblings(src, PERSISTED_FORMULA_KEYS)
  };
}
function runtimeToPersisted(state2) {
  return {
    queries: state2.queries.map(runtimeQueryToPersisted),
    formulas: state2.formulas.map(runtimeFormulaToPersisted)
  };
}
function persistedQueryToRuntime(p, opts) {
  const name = String(p.name || "A");
  const base = makeQuery(name, opts);
  const src = p;
  const functions = Array.isArray(p.functions) ? p.functions.map((f) => ({
    name: String(f.name || ""),
    arg: f.arg != null ? String(f.arg) : "",
    ...unknownSiblings(f, ["name", "arg"])
  })) : base.functions;
  const next = {
    ...base,
    id: p.id != null ? String(p.id) : base.id,
    name,
    signal: toPersistedSignal(String(p.signal || base.signal)) || "traces",
    where: p.where != null ? String(p.where) : base.where,
    aggregations: p.aggregations != null ? String(p.aggregations) : base.aggregations,
    aggOp: p.aggOp != null ? String(p.aggOp) : base.aggOp,
    aggAttr: p.aggAttr != null ? String(p.aggAttr) : base.aggAttr,
    metricName: p.metricName != null ? String(p.metricName) : base.metricName,
    metricType: p.metricType != null ? String(p.metricType) : base.metricType,
    timeAggregation: p.timeAggregation != null ? String(p.timeAggregation) : base.timeAggregation,
    spaceAggregation: p.spaceAggregation != null ? String(p.spaceAggregation) : base.spaceAggregation,
    groupBy: Array.isArray(p.groupBy) ? p.groupBy.map(String) : base.groupBy,
    having: p.having != null ? String(p.having) : base.having,
    orderBy: p.orderBy != null ? String(p.orderBy) : base.orderBy,
    limit: typeof p.limit === "number" ? p.limit : base.limit,
    legend: p.legend != null ? String(p.legend) : base.legend,
    step: p.step === null ? null : typeof p.step === "number" ? p.step : base.step,
    disabled: p.disabled != null ? Boolean(p.disabled) : base.disabled,
    spanScope: p.spanScope != null ? String(p.spanScope) : base.spanScope,
    expression: p.expression != null ? String(p.expression) : base.expression,
    functions,
    _addOns: Array.isArray(p._addOns) ? p._addOns.map(String) : base._addOns,
    // ephemeral always reset on hydrate
    _collapsed: false,
    _keyOpts: [],
    _keysLoading: false,
    _metricOpts: [],
    _metricLoading: false,
    ...unknownSiblings(src, [
      ...PERSISTED_QUERY_KEYS,
      ...RUNTIME_EPHEMERAL
    ])
  };
  return next;
}
function persistedFormulaToRuntime(p, opts) {
  const name = String(p.name || "F1");
  const base = makeFormula(name, opts);
  const src = p;
  return {
    ...base,
    id: p.id != null ? String(p.id) : base.id,
    name,
    expression: p.expression != null ? String(p.expression) : base.expression,
    legend: p.legend != null ? String(p.legend) : base.legend,
    having: p.having != null ? String(p.having) : base.having,
    orderBy: p.orderBy != null ? String(p.orderBy) : base.orderBy,
    limit: typeof p.limit === "number" ? p.limit : base.limit,
    disabled: p.disabled != null ? Boolean(p.disabled) : base.disabled,
    _addOns: Array.isArray(p._addOns) ? p._addOns.map(String) : base._addOns,
    _collapsed: false,
    ...unknownSiblings(src, [...PERSISTED_FORMULA_KEYS, "_collapsed"])
  };
}
function persistedToRuntime(persisted, opts) {
  const queries = (persisted.queries?.length ? persisted.queries : [runtimeQueryToPersisted(makeQuery("A", opts))]).map((q) => persistedQueryToRuntime(q, opts));
  const formulas = (persisted.formulas || []).map((f) => persistedFormulaToRuntime(f, opts));
  return { queries, formulas };
}
function runtimeQueryToBuilderSpec(q) {
  const signal = toStructuredSignal(String(q.signal || "traces"));
  const stepInterval = q.step === null || q.step === null ? null : typeof q.step === "number" ? q.step : 60;
  let aggregations;
  if (isMetricsSignal(String(q.signal))) {
    aggregations = [
      {
        kind: "metric",
        metricName: q.metricName || "",
        timeAggregation: q.timeAggregation || "rate",
        spaceAggregation: q.spaceAggregation || "sum",
        ...q.metricType ? { metricType: q.metricType } : {}
      }
    ];
  } else {
    const exprs = parseAggregationExpressions(q.aggregations || "count()");
    aggregations = exprs.map((expression) => ({
      kind: "expression",
      expression
    }));
  }
  const base = defaultBuilderSpec(q.name || "A", signal);
  const spec = {
    ...base,
    name: q.name || "A",
    signal,
    stepInterval,
    disabled: Boolean(q.disabled),
    filter: { expression: q.where ?? "" },
    having: { expression: q.having ?? "" },
    groupBy: groupByToFields(Array.isArray(q.groupBy) ? q.groupBy : []),
    order: parseOrderByString(q.orderBy),
    limit: typeof q.limit === "number" ? q.limit : 100,
    legend: q.legend ?? "",
    functions: functionsToSpec(
      Array.isArray(q.functions) ? q.functions : []
    ),
    aggregations
  };
  const extras = unknownSiblings(q, [
    ...PERSISTED_QUERY_KEYS,
    ...RUNTIME_EPHEMERAL,
    "id"
  ]);
  for (const k of Object.keys(extras)) {
    if (k.startsWith("_")) delete extras[k];
  }
  return Object.keys(extras).length ? { ...spec, ...extras } : spec;
}
function runtimeFormulaToFormulaSpec(f) {
  const order = parseOrderByString(f.orderBy);
  return {
    name: f.name || "F1",
    expression: f.expression ?? "",
    disabled: Boolean(f.disabled),
    legend: f.legend ?? "",
    order: order.length ? order : [],
    ...typeof f.limit === "number" ? { limit: f.limit } : {}
  };
}
function builderSpecToRuntimeQuery(spec, opts) {
  const ui = {};
  const name = String(ui.name || spec.name || "A");
  const base = makeQuery(name, opts);
  const signalFromUi = ui.signal != null ? String(ui.signal) : "";
  const signal = signalFromUi || spec.signal || "traces";
  const aggs = Array.isArray(spec.aggregations) ? spec.aggregations : [];
  let aggregations = base.aggregations;
  let metricName = base.metricName;
  let metricType = ui.metricType != null ? String(ui.metricType) : base.metricType;
  let timeAggregation = base.timeAggregation;
  let spaceAggregation = base.spaceAggregation;
  let aggOp = base.aggOp;
  let aggAttr = base.aggAttr;
  if (isMetricsSignal(String(signal))) {
    const m = aggs.find((a) => a.kind === "metric" || a.metricName != null);
    if (m) {
      metricName = String(m.metricName ?? metricName);
      timeAggregation = String(m.timeAggregation ?? timeAggregation);
      spaceAggregation = String(m.spaceAggregation ?? spaceAggregation);
      if (m.metricType != null) metricType = String(m.metricType);
    }
  } else {
    const exprs = aggs.map((a) => {
      if (a.kind === "expression" || a.expression != null) {
        return String(a.expression || "");
      }
      return "";
    }).filter(Boolean);
    aggregations = exprs.length ? exprs.join(" ") : "count()";
  }
  if (ui.aggregations != null) aggregations = String(ui.aggregations);
  if (ui.metricName != null) metricName = String(ui.metricName);
  if (ui.timeAggregation != null) timeAggregation = String(ui.timeAggregation);
  if (ui.spaceAggregation != null) spaceAggregation = String(ui.spaceAggregation);
  if (ui.aggOp != null) aggOp = String(ui.aggOp);
  if (ui.aggAttr != null) aggAttr = String(ui.aggAttr);
  const step = ui.step !== void 0 ? ui.step : spec.stepInterval === null ? null : typeof spec.stepInterval === "number" ? spec.stepInterval : base.step;
  const next = {
    ...base,
    id: ui.id != null ? String(ui.id) : base.id,
    name,
    signal,
    where: ui.where != null ? String(ui.where) : spec.filter?.expression != null ? String(spec.filter.expression) : base.where,
    aggregations,
    aggOp,
    aggAttr,
    metricName,
    metricType,
    timeAggregation,
    spaceAggregation,
    groupBy: ui.groupBy != null ? ui.groupBy.map(String) : fieldsToGroupBy(spec.groupBy),
    having: ui.having != null ? String(ui.having) : spec.having?.expression != null ? String(spec.having.expression) : base.having,
    orderBy: ui.orderBy != null ? String(ui.orderBy) : formatOrderByString(spec.order, "query"),
    limit: typeof ui.limit === "number" ? ui.limit : typeof spec.limit === "number" ? spec.limit : base.limit,
    legend: ui.legend != null ? String(ui.legend) : spec.legend != null ? String(spec.legend) : base.legend,
    step,
    disabled: ui.disabled != null ? Boolean(ui.disabled) : Boolean(spec.disabled),
    spanScope: ui.spanScope != null ? String(ui.spanScope) : base.spanScope,
    expression: ui.expression != null ? String(ui.expression) : base.expression,
    functions: ui.functions != null ? ui.functions : functionsFromSpec(spec.functions),
    _addOns: Array.isArray(ui._addOns) ? ui._addOns.map(String) : base._addOns,
    _collapsed: false,
    _keyOpts: [],
    _keysLoading: false,
    _metricOpts: [],
    _metricLoading: false
  };
  const knownSpec = /* @__PURE__ */ new Set([
    "name",
    "signal",
    "source",
    "stepInterval",
    "tags",
    "disabled",
    "filter",
    "having",
    "groupBy",
    "order",
    "limit",
    "legend",
    "functions",
    "aggregations",
    "environment",
    "service",
    "operation",
    "duration",
    "selectFields",
    "limitBy",
    "offset",
    "cursor",
    "secondaryAggregations"
  ]);
  for (const [k, v] of Object.entries(spec)) {
    if (knownSpec.has(k)) continue;
    if (k in next) continue;
    next[k] = cloneValue(v);
  }
  return next;
}
function formulaSpecToRuntimeFormula(spec, opts) {
  const ui = {};
  const name = String(ui.name || spec.name || "F1");
  const base = makeFormula(name, opts);
  return {
    ...base,
    id: ui.id != null ? String(ui.id) : base.id,
    name,
    expression: ui.expression != null ? String(ui.expression) : String(spec.expression ?? ""),
    legend: ui.legend != null ? String(ui.legend) : String(spec.legend ?? ""),
    having: ui.having != null ? String(ui.having) : base.having,
    orderBy: ui.orderBy != null ? String(ui.orderBy) : formatOrderByString(spec.order, "formula"),
    limit: typeof ui.limit === "number" ? ui.limit : typeof spec.limit === "number" ? spec.limit : base.limit,
    disabled: ui.disabled != null ? Boolean(ui.disabled) : Boolean(spec.disabled),
    _addOns: Array.isArray(ui._addOns) ? ui._addOns.map(String) : base._addOns,
    _collapsed: false
  };
}
function runtimeToSigNozQuery(state2, base = {}) {
  const persisted = runtimeToPersisted(state2);
  const builderQueries = state2.queries.map(runtimeQueryToBuilderSpec);
  const builderFormulas = state2.formulas.map(runtimeFormulaToFormulaSpec);
  const queries = [
    ...builderQueries.map((spec, i) => {
      const item = {
        type: "builder_query",
        queryType: "builder",
        spec,
        queryBuilder: persisted.queries[i]
      };
      return item;
    }),
    ...builderFormulas.map((spec, i) => {
      const item = {
        type: "builder_formula",
        spec,
        queryBuilder: persisted.formulas[i]
      };
      return item;
    })
  ];
  const hostUnknown = unknownSiblings(base, [
    "refId",
    "schema",
    "apiProfile",
    "queries",
    "editor",
    "requestType",
    "noCache",
    "formatOptions",
    "signal",
    "expr",
    "query",
    "service",
    "operation",
    "formula",
    "legendFormat",
    "limit",
    "hide",
    "datasource",
    "key"
  ]);
  const editor = {
    activeQueryType: "builder",
    builder: {
      queries: builderQueries.map(cloneValue),
      formulas: builderFormulas.map(cloneValue),
      traceOperators: []
    },
    promql: [],
    clickhouseSql: [],
    queryBuilder: persisted
  };
  if (base.editor && typeof base.editor === "object") {
    const prev = base.editor;
    for (const [k, v] of Object.entries(prev)) {
      if (k === "queryBuilder" || k === "builder" || k === "activeQueryType") continue;
      if (k === "promql" || k === "clickhouseSql") continue;
      if (!(k in editor)) editor[k] = cloneValue(v);
    }
  }
  const out = {
    refId: base.refId || "A",
    schema: 2,
    apiProfile: base.apiProfile || "signoz-v5",
    requestType: base.requestType || "time_series",
    ...hostUnknown,
    ...base,
    queries,
    editor
  };
  return out;
}
function readPersistedFromQuery(query) {
  const editor = query?.editor;
  if (editor?.queryBuilder?.queries?.length) {
    return cloneValue(editor.queryBuilder);
  }
  return null;
}
function sigNozQueryToRuntime(query, opts) {
  const diagnostics = [];
  if (!query) {
    return { state: createInitialState(opts), diagnostics };
  }
  const bag = readPersistedFromQuery(query);
  if (bag) {
    return { state: persistedToRuntime(bag, opts), diagnostics };
  }
  const items = Array.isArray(query.queries) ? query.queries : [];
  const uiQueries = [];
  const uiFormulas = [];
  for (const item of items) {
    const qb = item.queryBuilder;
    if (item.type === "builder_formula") {
      if (qb && typeof qb === "object") {
        uiFormulas.push(qb);
      } else {
        uiFormulas.push(
          runtimeFormulaToPersisted(
            formulaSpecToRuntimeFormula(item.spec, opts)
          )
        );
      }
      continue;
    }
    if (item.type === "builder_trace_operator") {
      diagnostics.push({
        code: "TRACE_OPERATOR_AS_EXPRESSION",
        message: "链路运算符已映射为无公式的表达式字段",
        path: `queries.${item.spec?.name}`
      });
      continue;
    }
    if (item.type !== "builder_query") {
      diagnostics.push({
        code: "UNKNOWN_QUERY_ITEM",
        message: `unknown query item type ${item.type}`,
        path: `queries`
      });
      continue;
    }
    if (item.queryType && item.queryType !== "builder") {
      diagnostics.push({
        code: "NON_BUILDER_MODE",
        message: `item queryType=${item.queryType} is not QueryBuilder UI state`,
        path: `queries.${item.spec?.name}`
      });
      continue;
    }
    if (qb && typeof qb === "object") {
      uiQueries.push(qb);
    } else {
      uiQueries.push(
        runtimeQueryToPersisted(builderSpecToRuntimeQuery(item.spec, opts))
      );
    }
  }
  if (uiQueries.length || uiFormulas.length) {
    return {
      state: persistedToRuntime(
        {
          queries: uiQueries.length ? uiQueries : [runtimeQueryToPersisted(makeQuery("A", opts))],
          formulas: uiFormulas
        },
        opts
      ),
      diagnostics
    };
  }
  const editor = query.editor;
  if (editor?.builder?.queries?.length) {
    const state2 = {
      queries: editor.builder.queries.map(
        (spec) => builderSpecToRuntimeQuery(spec, opts)
      ),
      formulas: (editor.builder.formulas || []).map(
        (spec) => formulaSpecToRuntimeFormula(spec, opts)
      )
    };
    return { state: state2, diagnostics };
  }
  if (!items.length) {
    return { state: createInitialState(opts), diagnostics };
  }
  return { state: createInitialState(opts), diagnostics };
}
const _hoisted_1$3 = {
  class: "signoz-qe",
  "data-testid": "query-editor-signoz"
};
const _hoisted_2$3 = {
  key: 0,
  class: "err"
};
const _hoisted_3$2 = { class: "qe-toolbar" };
const _hoisted_4$2 = {
  class: "qe-toolbar-note",
  "data-testid": "signoz-external-time-note"
};
const _hoisted_5$2 = { class: "qe-request-type" };
const _hoisted_6$2 = { class: "qe-rt-label" };
const _hoisted_7$2 = {
  key: 2,
  class: "signoz-raw-channel",
  "data-testid": "signoz-raw-channel"
};
const _hoisted_8 = {
  class: "qb-name",
  "data-testid": "signoz-row-name"
};
const _hoisted_9 = { class: "qb-footer" };
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  __name: "QueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    onRunQuery: { type: Function },
    datasource: {},
    range: {},
    datasourceApi: {}
  },
  emits: ["type-change", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const query = computed(() => migrateSigNozQuery(props.query || {}));
    const editorState = computed(() => toEditorState(query.value));
    const builderRuntime = computed(() => {
      return sigNozQueryToRuntime(query.value).state;
    });
    function onBuilderChange(queries, formulas) {
      const base = props.query;
      const converted = runtimeToSigNozQuery(
        { queries, formulas },
        {
          ...query.value,
          refId: base?.refId ?? query.value.refId,
          datasource: base?.datasource ?? query.value.datasource,
          hide: base?.hide ?? query.value.hide,
          requestType: query.value.requestType,
          apiProfile: query.value.apiProfile || jsonData.value.apiProfile
        }
      );
      const next = {
        ...query.value,
        ...converted,
        refId: base?.refId ?? query.value.refId,
        datasource: base?.datasource ?? query.value.datasource,
        hide: base?.hide ?? query.value.hide
      };
      notifyChange(next);
    }
    const items = computed(() => {
      const q = query.value;
      if (Array.isArray(q.queries) && q.queries.length) return q.queries;
      return fromEditorState(editorState.value, q).queries;
    });
    const globalMode = computed(() => editorState.value.activeQueryType || "builder");
    const jsonData = computed(
      () => props.datasource?.jsonData || {}
    );
    const profile = computed(() => {
      const jd = jsonData.value;
      const apiProfile = jd.apiProfile || query.value.apiProfile || "signoz-v5";
      return resolveSigNozProfile({ ...jd, apiProfile });
    });
    const capabilities = computed(
      () => resolveEditorCapabilities({
        profile: profile.value,
        options: jsonData.value
      })
    );
    const requestTypeOptions = computed(
      () => allowedRequestTypes(capabilities.value).map((requestType) => ({
        label: signozT(`signoz.requestType.${requestType}`, requestType),
        value: requestType
      }))
    );
    const modeBlocked = computed(() => {
      const out = {};
      const unavailable = (mode2) => signozT("signoz.queryBuilder.capabilityUnavailable", "{mode} capability is unavailable").replace(
        "{mode}",
        mode2
      );
      if (!capabilities.value.builder) out.builder = unavailable("builder");
      if (!capabilities.value.promql) out.promql = unavailable("promql");
      if (!capabilities.value.clickhouseSql) out.clickhouse_sql = unavailable("clickhouse_sql");
      return out;
    });
    const validationErrors = computed(
      () => items.value.map((item) => {
        const v = validateSavedItem(item, capabilities.value);
        return v.ok ? null : { name: item.spec.name, message: v.message };
      }).filter(Boolean)
    );
    const metaApi = ref(null);
    const metaError = ref("");
    function resolveApi2() {
      const uid = String(props.datasource?.uid || props.query?.datasource?.uid || "");
      if (uid) {
        const registered2 = getRuntimeDataSource(uid);
        if (registered2) return registered2;
      }
      return props.datasourceApi || props.datasource || null;
    }
    onMounted(() => {
      metaApi.value = resolveApi2();
    });
    watch(
      () => [props.datasource?.uid, props.datasourceApi],
      () => {
        metaApi.value = resolveApi2();
      }
    );
    function commitQueries(nextItems, extra = {}) {
      const base = props.query;
      const first = nextItems.find((i) => i.type === "builder_query") || nextItems[0];
      const flat = {};
      if (first && first.type === "builder_query") {
        flat.signal = first.spec.signal;
        flat.expr = first.rawQuery || "";
        flat.service = first.spec.service;
        flat.operation = first.spec.operation;
        flat.legendFormat = first.rawLegend || first.spec.legend || "";
        flat.limit = first.spec.limit;
      }
      const formula = nextItems.find((i) => i.type === "builder_formula");
      if (formula && formula.type === "builder_formula") {
        flat.formula = formula.spec.expression;
      }
      const rebuilt = toEditorState({ queries: nextItems });
      rebuilt.activeQueryType = globalMode.value;
      const stillMixed = Boolean(editorState.value.legacyMixed && !extra && false);
      const next = {
        ...query.value,
        ...flat,
        ...extra,
        refId: base?.refId ?? query.value.refId,
        datasource: base?.datasource ?? query.value.datasource,
        hide: base?.hide ?? query.value.hide,
        schema: stillMixed ? 1 : 2,
        queries: nextItems,
        editor: rebuilt
      };
      if (editorState.value.legacyMixed && editorState.value.legacySchema1) {
        next.editor.legacyMixed = true;
        next.editor.legacySchema1 = editorState.value.legacySchema1;
        next.schema = 1;
      }
      notifyChange(next);
    }
    function notifyChange(next) {
      props.onChange(next);
      emit("change", next);
    }
    function commitEditor(nextState, extra = {}) {
      const base = props.query;
      const wire = fromEditorState(nextState, {
        ...query.value,
        ...extra,
        refId: base?.refId ?? query.value.refId,
        datasource: base?.datasource ?? query.value.datasource,
        hide: base?.hide ?? query.value.hide
      });
      const first = wire.queries.find((i) => i.type === "builder_query");
      if (first && first.type === "builder_query") {
        wire.signal = first.spec.signal;
        wire.expr = first.rawQuery || "";
        wire.legendFormat = first.rawLegend || first.spec.legend || "";
        wire.limit = first.spec.limit;
      }
      notifyChange(wire);
    }
    function setGlobalMode(mode2) {
      if (modeBlocked.value[mode2]) return;
      emit("type-change", mode2);
      let st = commitGlobalMode(editorState.value, mode2);
      if (mode2 === "promql" && !st.promql.length) {
        st = {
          ...st,
          promql: [{ name: "A", query: "up" }]
        };
      }
      if (mode2 === "clickhouse_sql" && !st.clickhouseSql.length) {
        st = {
          ...st,
          clickhouseSql: [{ name: "A", query: "SELECT 1" }]
        };
      }
      if (mode2 === "builder" && !st.builder.queries.length) {
        st = {
          ...st,
          builder: {
            ...st.builder,
            queries: [defaultBuilderSpec("A", "traces")]
          }
        };
      }
      commitEditor(st);
    }
    function setRequestType(v) {
      commitQueries(items.value, { requestType: String(v) });
    }
    function updateRawAt(index2, value) {
      const st = {
        ...editorState.value,
        promql: editorState.value.promql.map((r) => ({ ...r })),
        clickhouseSql: editorState.value.clickhouseSql.map((r) => ({ ...r }))
      };
      if (globalMode.value === "promql") {
        if (!st.promql[index2]) return;
        st.promql[index2] = { ...st.promql[index2], query: value };
      } else {
        if (!st.clickhouseSql[index2]) return;
        st.clickhouseSql[index2] = { ...st.clickhouseSql[index2], query: value };
      }
      commitEditor(st);
    }
    function addQuery2() {
      if (!capabilities.value.builder && !capabilities.value.promql) return;
      const name = nextQueryName(items.value);
      const signal = profile.value.signals[0] || "traces";
      const mode2 = globalMode.value;
      const item = mode2 === "promql" ? defaultPromItem(name, "") : mode2 === "clickhouse_sql" ? {
        type: "builder_query",
        queryType: "clickhouse_sql",
        spec: defaultBuilderSpec(name, signal === "metrics" ? "logs" : signal),
        rawQuery: "",
        rawLegend: ""
      } : {
        type: "builder_query",
        queryType: "builder",
        spec: defaultBuilderSpec(name, signal),
        rawQuery: "",
        rawLegend: ""
      };
      commitQueries([...items.value, item]);
    }
    function addTraceOperator() {
      if (!capabilities.value.traceOperator || globalMode.value !== "builder") return;
      const name = nextQueryName(items.value);
      const item = {
        type: "builder_trace_operator",
        spec: { name, expression: "", disabled: false, legend: "" }
      };
      commitQueries([...items.value, item]);
    }
    function addJoin() {
      if (!capabilities.value.join || globalMode.value !== "builder") return;
      const name = nextQueryName(items.value);
      const item = {
        type: "builder_join",
        spec: {
          name,
          left: "A",
          right: "B",
          type: "inner",
          on: "",
          disabled: false
        }
      };
      commitQueries([...items.value, item]);
    }
    onMounted(() => {
      if (!items.value.length) {
        commitQueries([
          {
            type: "builder_query",
            queryType: "builder",
            spec: defaultBuilderSpec("A", "traces"),
            rawQuery: "",
            rawLegend: ""
          }
        ]);
      }
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$3, [
        metaError.value ? (openBlock(), createElementBlock(
          "div",
          _hoisted_2$3,
          toDisplayString(metaError.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        createCommentVNode(" Time range comes from Grafana Explore/Dashboard external picker (no internal clock). "),
        createElementVNode("div", _hoisted_3$2, [
          createElementVNode(
            "div",
            _hoisted_4$2,
            toDisplayString(unref(signozT)("signoz.queryBuilder.externalTimeRange")),
            1
            /* TEXT */
          ),
          createElementVNode("div", _hoisted_5$2, [
            createElementVNode(
              "span",
              _hoisted_6$2,
              toDisplayString(unref(signozT)("signoz.queryBuilder.requestType")),
              1
              /* TEXT */
            ),
            createVNode(unref(GSelect), {
              value: query.value.requestType || "time_series",
              options: requestTypeOptions.value,
              "test-id": "signoz-request-type",
              "onUpdate:value": setRequestType
            }, null, 8, ["value", "options"])
          ])
        ]),
        createVNode(QueryTypeTabs, {
          mode: globalMode.value,
          blocked: modeBlocked.value,
          "legacy-mixed": Boolean(editorState.value.legacyMixed),
          "onUpdate:mode": setGlobalMode
        }, null, 8, ["mode", "blocked", "legacy-mixed"]),
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(validationErrors.value, (err) => {
            return openBlock(), createElementBlock(
              "div",
              {
                key: err.name + err.message,
                class: "warn",
                "data-testid": "signoz-capability-error",
                role: "status"
              },
              toDisplayString(err.name) + ": " + toDisplayString(err.message),
              1
              /* TEXT */
            );
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        createCommentVNode(" Builder: Argus QueryBuilder (Task 9). Raw modes keep GCodeEditor. "),
        globalMode.value === "builder" ? (openBlock(), createBlock(QueryBuilder, {
          key: 1,
          "model-value": builderRuntime.value,
          "show-agg": true,
          "datasource-api": metaApi.value,
          onChange: onBuilderChange,
          onRun: _cache[0] || (_cache[0] = ($event) => props.onRunQuery?.())
        }, null, 8, ["model-value", "datasource-api"])) : (openBlock(), createElementBlock("div", _hoisted_7$2, [
          (openBlock(true), createElementBlock(
            Fragment,
            null,
            renderList(globalMode.value === "promql" ? editorState.value.promql : editorState.value.clickhouseSql, (raw, ri) => {
              return openBlock(), createElementBlock("div", {
                key: `${raw.name}-${ri}`,
                class: "signoz-raw-row"
              }, [
                createElementVNode(
                  "span",
                  _hoisted_8,
                  toDisplayString(raw.name),
                  1
                  /* TEXT */
                ),
                createVNode(RawQueryEditor, {
                  "model-value": raw.query,
                  mode: globalMode.value,
                  "test-id": "signoz-raw-editor",
                  "onUpdate:modelValue": ($event) => updateRawAt(ri, String($event ?? ""))
                }, null, 8, ["model-value", "mode", "onUpdate:modelValue"])
              ]);
            }),
            128
            /* KEYED_FRAGMENT */
          ))
        ])),
        createElementVNode("div", _hoisted_9, [
          globalMode.value !== "builder" ? (openBlock(), createElementBlock(
            "button",
            {
              key: 0,
              type: "button",
              class: "qb-add-btn",
              "data-testid": "signoz-add-query",
              onClick: addQuery2
            },
            " + " + toDisplayString(unref(signozT)("signoz.traces.addQuery")),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          capabilities.value.traceOperator && globalMode.value === "builder" ? (openBlock(), createElementBlock(
            "button",
            {
              key: 1,
              type: "button",
              class: "qb-add-btn",
              "data-testid": "signoz-add-trace-operator",
              onClick: addTraceOperator
            },
            " + " + toDisplayString(unref(signozT)("signoz.queryBuilder.traceOperator")),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          capabilities.value.join && globalMode.value === "builder" ? (openBlock(), createElementBlock(
            "button",
            {
              key: 2,
              type: "button",
              class: "qb-add-btn",
              "data-testid": "signoz-add-join",
              onClick: addJoin
            },
            " + " + toDisplayString(unref(signozT)("signoz.queryBuilder.join")),
            1
            /* TEXT */
          )) : createCommentVNode("v-if", true),
          _cache[2] || (_cache[2] = createElementVNode(
            "div",
            { class: "qb-footer-spacer" },
            null,
            -1
            /* CACHED */
          )),
          createVNode(unref(GButton), {
            size: "sm",
            variant: "primary",
            type: "button",
            "test-id": "run-query",
            onClick: _cache[1] || (_cache[1] = ($event) => props.onRunQuery?.())
          }, {
            default: withCtx(() => [
              createTextVNode(
                toDisplayString(unref(signozT)("signoz.queryBuilder.run")),
                1
                /* TEXT */
              )
            ]),
            _: 1
            /* STABLE */
          })
        ])
      ]);
    };
  }
});
const QueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__scopeId", "data-v-efd85fcc"]]);
const _hoisted_1$2 = ["data-save-allowed"];
const _hoisted_2$2 = ["checked"];
const _hoisted_3$1 = {
  key: 0,
  "data-testid": "signoz-session-login-msg"
};
const _hoisted_4$1 = ["data-ok"];
const _hoisted_5$1 = {
  key: 0,
  class: "block",
  "data-testid": "signoz-save-blocked"
};
const _hoisted_6$1 = { "data-testid": "signoz-test-message" };
const _hoisted_7$1 = { class: "hint" };
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  __name: "ConfigEditor",
  props: {
    options: {},
    onOptionsChange: { type: Function },
    onValidationChange: { type: Function }
  },
  setup(__props) {
    const props = __props;
    const tokenLocal = ref("");
    const refreshTokenLocal = ref("");
    const sessionEmail = ref("");
    const sessionPassword = ref("");
    const rememberPassword = ref(false);
    const sessionLoginLoading = ref(false);
    const sessionLoginMessage = ref("");
    const testMessage = ref("");
    const testLoading = ref(false);
    const jsonData = computed(
      () => migrateSigNozConfig(props.options?.jsonData || {})
    );
    const profile = computed(() => resolveSigNozProfile(jsonData.value));
    function patchJson(patch, url2) {
      const options = props.options;
      const nextJson = migrateSigNozConfig({ ...jsonData.value, ...patch });
      props.onOptionsChange({
        ...options,
        ...url2 != null ? { url: url2 } : {},
        jsonData: nextJson
      });
      emitValidation(nextJson, url2 != null ? url2 : String(options?.url || ""));
    }
    function emitValidation(jd = jsonData.value, url2 = String(props.options?.url || "")) {
      let isValid = Boolean(String(url2).trim());
      let message2;
      if (!isValid) message2 = signozT("signoz.config.requiredBaseUrl", "Please enter a Base URL");
      if (jd.apiProfile === "custom") {
        const sig = buildCustomHealthSignature(url2, jd);
        if (!jd.customHealthOk || jd.customHealthSignature !== sig) {
          isValid = false;
          message2 = signozT(
            "signoz.config.customHealthRequired",
            "The custom profile must pass a health check first"
          );
        }
      }
      props.onValidationChange?.({ isValid, message: message2 });
    }
    const url = computed({
      get: () => String(props.options?.url || ""),
      set: (v) => patchJson({}, v)
    });
    const apiProfile = computed({
      get: () => jsonData.value.apiProfile,
      set: (v) => patchJson({
        apiProfile: v,
        customHealthOk: v === "custom" ? false : jsonData.value.customHealthOk,
        customHealthSignature: v === "custom" ? "" : jsonData.value.customHealthSignature
      })
    });
    const organizationId = computed({
      get: () => String(jsonData.value.organizationId || ""),
      set: (v) => patchJson({ organizationId: v })
    });
    const defaultEnvironment = computed({
      get: () => String(jsonData.value.defaultEnvironment || ""),
      set: (v) => patchJson({ defaultEnvironment: v })
    });
    const timeout = computed({
      get: () => Number(jsonData.value.timeout || 3e4),
      set: (v) => patchJson({ timeout: Number(v) || 3e4 })
    });
    const cacheTTL = computed({
      get: () => String(jsonData.value.metadataCacheTTL || "5m"),
      set: (v) => patchJson({ metadataCacheTTL: v })
    });
    const credentialKind = computed({
      get: () => jsonData.value.credentialKind || "bearer",
      set: (v) => patchJson({ credentialKind: v })
    });
    const headerName = computed({
      get: () => String(jsonData.value.credentialHeaderName || ""),
      set: (v) => patchJson({ credentialHeaderName: v })
    });
    function setToken(v) {
      tokenLocal.value = v;
      const uid = String(props.options?.uid || "signoz");
      const kind2 = credentialKind.value;
      if (!v) {
        setRuntimeCredential(uid, null);
        return;
      }
      if (kind2 === "apiKey" || kind2 === "signozApiKey") {
        setRuntimeCredential(uid, {
          kind: "apiKey",
          value: v,
          headerName: headerName.value || (kind2 === "signozApiKey" ? "SIGNOZ-API-KEY" : "X-API-Key")
        });
      } else if (kind2 === "headers") {
        const h2 = headerName.value || "Authorization";
        setRuntimeCredential(uid, { kind: "headers", headers: { [h2]: v } });
      } else if (kind2 === "session") {
        setRuntimeCredential(uid, {
          kind: "session",
          value: v || void 0,
          refreshToken: refreshTokenLocal.value || void 0,
          email: sessionEmail.value || void 0,
          password: rememberPassword.value ? sessionPassword.value || void 0 : void 0,
          orgID: organizationId.value || void 0,
          rememberPassword: rememberPassword.value
        });
      } else if (kind2 === "proxy") {
        setRuntimeCredential(uid, { kind: "headers", headers: {} });
      } else {
        setRuntimeCredential(uid, { kind: "bearer", value: v });
      }
    }
    async function loginSession() {
      const uid = String(props.options?.uid || "signoz");
      const baseUrl2 = String(props.options?.url || "").trim();
      if (!baseUrl2) {
        sessionLoginMessage.value = signozT("signoz.config.requiredBaseUrl", "Please enter a Base URL");
        return;
      }
      if (!sessionEmail.value || !sessionPassword.value) {
        sessionLoginMessage.value = signozT("signoz.config.loginMissingCredentials");
        return;
      }
      sessionLoginLoading.value = true;
      sessionLoginMessage.value = "";
      try {
        const next = await refreshSession({
          uid,
          baseUrl: baseUrl2,
          credential: {
            kind: "session",
            email: sessionEmail.value,
            password: sessionPassword.value,
            orgID: organizationId.value || void 0,
            rememberPassword: rememberPassword.value
          }
        });
        tokenLocal.value = next.value || "";
        refreshTokenLocal.value = next.refreshToken || "";
        if (next.orgID) {
          patchJson({ organizationId: next.orgID });
        }
        setToken(tokenLocal.value);
        sessionLoginMessage.value = signozT("signoz.config.loginSuccess");
      } catch (error) {
        sessionLoginMessage.value = String(error?.message || error || signozT("signoz.config.loginFailed"));
      } finally {
        sessionLoginLoading.value = false;
      }
    }
    function patchCustomPath(key, value) {
      patchJson({
        [key]: value,
        customHealthOk: false,
        customHealthSignature: ""
      });
    }
    const canSave = computed(() => {
      if (apiProfile.value !== "custom") return Boolean(url.value.trim());
      const sig = buildCustomHealthSignature(url.value, jsonData.value);
      return Boolean(
        jsonData.value.customHealthOk && jsonData.value.customHealthSignature === sig && url.value.trim()
      );
    });
    async function testHealth() {
      testLoading.value = true;
      testMessage.value = signozT("signoz.config.healthChecking");
      try {
        const ds2 = createSignozDataSource(
          {
            uid: props.options?.uid || "signoz-cfg",
            name: props.options?.name || "SigNoz",
            type: "signoz",
            url: url.value,
            jsonData: jsonData.value,
            meta: { id: "signoz", name: "SigNoz" }
          },
          { id: "signoz", name: "SigNoz" }
        );
        const res = await ds2.testDatasource();
        const ok2 = res.status === "success";
        if (apiProfile.value === "custom") {
          if (ok2) {
            const sig = buildCustomHealthSignature(url.value, jsonData.value);
            patchJson({ customHealthOk: true, customHealthSignature: sig });
          } else {
            patchJson({ customHealthOk: false, customHealthSignature: "" });
          }
        }
        testMessage.value = res.message || (ok2 ? signozT("signoz.common.ok", "OK") : signozT("signoz.common.failed", "Failed"));
      } catch (error) {
        if (apiProfile.value === "custom")
          patchJson({ customHealthOk: false, customHealthSignature: "" });
        testMessage.value = error instanceof Error ? error.message : String(error);
      } finally {
        testLoading.value = false;
      }
    }
    watch(
      () => props.options,
      () => emitValidation(),
      { deep: true, immediate: true }
    );
    onUnmounted(() => {
      tokenLocal.value = "";
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "signoz-cfg",
        "data-testid": "config-editor-signoz",
        "data-save-allowed": String(canSave.value)
      }, [
        createVNode(unref(_sfc_main$H$1), { layout: "vertical" }, {
          default: withCtx(() => [
            createElementVNode(
              "h4",
              null,
              toDisplayString(unref(signozT)("signoz.config.connection")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.baseUrl")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              modelValue: url.value,
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => url.value = $event),
              placeholder: "http://localhost:3301",
              "test-id": "signoz-url"
            }, null, 8, ["modelValue"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.apiProfile")),
              1
              /* TEXT */
            ),
            createVNode(unref(GSelect), {
              modelValue: apiProfile.value,
              "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => apiProfile.value = $event),
              options: [
                {
                  label: unref(signozT)("signoz.profile.prometheusCompatible", "Prometheus compatible"),
                  value: "prometheus-compatible"
                },
                {
                  label: unref(signozT)("signoz.profile.signozV5", "SigNoz v5 (Native)"),
                  value: "signoz-v5"
                },
                {
                  label: unref(signozT)("signoz.profile.signozV3", "SigNoz v3"),
                  value: "signoz-v3"
                },
                {
                  label: unref(signozT)("signoz.profile.signozV4", "SigNoz v4"),
                  value: "signoz-v4"
                },
                { label: unref(signozT)("signoz.profile.custom", "Custom"), value: "custom" }
              ],
              "test-id": "signoz-profile"
            }, null, 8, ["modelValue", "options"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.organizationId")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              modelValue: organizationId.value,
              "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => organizationId.value = $event),
              "test-id": "signoz-organization-id"
            }, null, 8, ["modelValue"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.defaultEnvironment")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              modelValue: defaultEnvironment.value,
              "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => defaultEnvironment.value = $event),
              "test-id": "signoz-environment"
            }, null, 8, ["modelValue"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.timeout")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": timeout.value,
              type: "number",
              "test-id": "signoz-timeout",
              "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => timeout.value = Number($event))
            }, null, 8, ["model-value"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.cacheTtl")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              modelValue: cacheTTL.value,
              "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => cacheTTL.value = $event),
              "test-id": "signoz-cache-ttl"
            }, null, 8, ["modelValue"]),
            createElementVNode(
              "h4",
              null,
              toDisplayString(unref(signozT)("signoz.config.authentication")),
              1
              /* TEXT */
            ),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.credentialKind")),
              1
              /* TEXT */
            ),
            createVNode(unref(GSelect), {
              modelValue: credentialKind.value,
              "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => credentialKind.value = $event),
              options: [
                { label: unref(signozT)("signoz.config.bearerToken"), value: "bearer" },
                { label: unref(signozT)("signoz.config.apiKey"), value: "apiKey" },
                { label: unref(signozT)("signoz.config.headers"), value: "headers" },
                { label: unref(signozT)("signoz.config.session"), value: "session" }
              ],
              "test-id": "signoz-credential-kind"
            }, null, 8, ["modelValue", "options"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.headerName")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              modelValue: headerName.value,
              "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => headerName.value = $event),
              "test-id": "signoz-header-name",
              placeholder: unref(signozT)("signoz.config.headerPlaceholder", "X-API-Key / Authorization")
            }, null, 8, ["modelValue", "placeholder"]),
            createElementVNode(
              "label",
              null,
              toDisplayString(unref(signozT)("signoz.config.tokenSecret")),
              1
              /* TEXT */
            ),
            createVNode(unref(GInput), {
              "model-value": tokenLocal.value,
              type: "password",
              autocomplete: "off",
              "test-id": "signoz-token",
              "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => setToken(String($event)))
            }, null, 8, ["model-value"]),
            credentialKind.value === "session" ? (openBlock(), createElementBlock(
              Fragment,
              { key: 0 },
              [
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.refreshToken")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": refreshTokenLocal.value,
                  type: "password",
                  autocomplete: "off",
                  "test-id": "signoz-refresh-token",
                  "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => {
                    refreshTokenLocal.value = String($event);
                    setToken(tokenLocal.value);
                  })
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.email")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": sessionEmail.value,
                  "test-id": "signoz-session-email",
                  "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => {
                    sessionEmail.value = String($event);
                    setToken(tokenLocal.value);
                  })
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.password")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": sessionPassword.value,
                  type: "password",
                  autocomplete: "off",
                  "test-id": "signoz-session-password",
                  "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => {
                    sessionPassword.value = String($event);
                    setToken(tokenLocal.value);
                  })
                }, null, 8, ["model-value"]),
                createElementVNode("label", null, [
                  createElementVNode("input", {
                    type: "checkbox",
                    "data-testid": "signoz-remember-password",
                    checked: rememberPassword.value,
                    onChange: _cache[12] || (_cache[12] = ($event) => {
                      rememberPassword.value = $event.target.checked;
                      setToken(tokenLocal.value);
                    })
                  }, null, 40, _hoisted_2$2),
                  createTextVNode(
                    " " + toDisplayString(unref(signozT)("signoz.config.rememberPassword")),
                    1
                    /* TEXT */
                  )
                ]),
                createVNode(unref(GButton), {
                  "html-type": "button",
                  "test-id": "signoz-session-login",
                  loading: sessionLoginLoading.value,
                  disabled: sessionLoginLoading.value,
                  onClick: loginSession
                }, {
                  default: withCtx(() => [
                    createTextVNode(
                      toDisplayString(sessionLoginLoading.value ? unref(signozT)("signoz.config.loggingIn") : unref(signozT)("signoz.config.login")),
                      1
                      /* TEXT */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["loading", "disabled"]),
                sessionLoginMessage.value ? (openBlock(), createElementBlock(
                  "p",
                  _hoisted_3$1,
                  toDisplayString(sessionLoginMessage.value),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ],
              64
              /* STABLE_FRAGMENT */
            )) : createCommentVNode("v-if", true),
            apiProfile.value === "custom" ? (openBlock(), createElementBlock(
              Fragment,
              { key: 1 },
              [
                createElementVNode(
                  "h4",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.customEndpoints")),
                  1
                  /* TEXT */
                ),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.health")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customHealthPath || "",
                  "test-id": "signoz-custom-health",
                  "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => patchCustomPath("customHealthPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.metrics")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customMetricsPath || "",
                  "test-id": "signoz-custom-metrics",
                  "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => patchCustomPath("customMetricsPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.logs")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customLogsPath || "",
                  "test-id": "signoz-custom-logs",
                  "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => patchCustomPath("customLogsPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.traces")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customTracesPath || "",
                  "test-id": "signoz-custom-traces",
                  "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => patchCustomPath("customTracesPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.alerts")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customAlertsPath || "",
                  "test-id": "signoz-custom-alerts",
                  "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => patchCustomPath("customAlertsPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.traceById")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customTraceByIdPath || "",
                  "test-id": "signoz-custom-trace-detail",
                  "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => patchCustomPath("customTraceByIdPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.metadata")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customMetadataPath || "",
                  "test-id": "signoz-custom-metadata",
                  "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => patchCustomPath("customMetadataPath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.acknowledge")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customAcknowledgePath || "",
                  "test-id": "signoz-custom-acknowledge",
                  "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => patchCustomPath("customAcknowledgePath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode(
                  "label",
                  null,
                  toDisplayString(unref(signozT)("signoz.config.resolve")),
                  1
                  /* TEXT */
                ),
                createVNode(unref(GInput), {
                  "model-value": jsonData.value.customResolvePath || "",
                  "test-id": "signoz-custom-resolve",
                  "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => patchCustomPath("customResolvePath", String($event)))
                }, null, 8, ["model-value"]),
                createElementVNode("div", {
                  class: "health",
                  "data-ok": String(jsonData.value.customHealthOk),
                  "data-testid": "signoz-health-status"
                }, toDisplayString(jsonData.value.customHealthOk ? unref(signozT)("signoz.config.healthPassed") : unref(signozT)("signoz.config.healthFailed")), 9, _hoisted_4$1),
                !canSave.value ? (openBlock(), createElementBlock(
                  "div",
                  _hoisted_5$1,
                  toDisplayString(unref(signozT)("signoz.config.saveBlocked")),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ],
              64
              /* STABLE_FRAGMENT */
            )) : createCommentVNode("v-if", true),
            createVNode(unref(GButton), {
              variant: "primary",
              loading: testLoading.value,
              "test-id": "signoz-health-test",
              onClick: testHealth
            }, {
              default: withCtx(() => [
                createTextVNode(
                  toDisplayString(unref(signozT)("signoz.config.testHealth")),
                  1
                  /* TEXT */
                )
              ]),
              _: 1
              /* STABLE */
            }, 8, ["loading"]),
            createElementVNode(
              "span",
              _hoisted_6$1,
              toDisplayString(testMessage.value),
              1
              /* TEXT */
            ),
            createElementVNode(
              "pre",
              _hoisted_7$1,
              toDisplayString(JSON.stringify(profile.value.endpoints, null, 2)),
              1
              /* TEXT */
            )
          ]),
          _: 1
          /* STABLE */
        })
      ], 8, _hoisted_1$2);
    };
  }
});
const ConfigEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__scopeId", "data-v-075ef1b6"]]);
const _hoisted_1$1 = { "data-testid": "signoz-variable-query-editor" };
const _hoisted_2$1 = { key: 0 };
const _hoisted_3 = { key: 2 };
const _hoisted_4 = { key: 4 };
const _hoisted_5 = { key: 6 };
const _hoisted_6 = { key: 8 };
const _hoisted_7 = {
  key: 10,
  class: "warn",
  "data-testid": "signoz-var-unsupported",
  role: "status"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  __name: "VariableQueryEditor",
  props: {
    query: {},
    onChange: { type: Function },
    datasource: {}
  },
  setup(__props) {
    const props = __props;
    function model() {
      if (typeof props.query === "string") {
        try {
          return JSON.parse(props.query);
        } catch {
          return { type: "service", search: props.query };
        }
      }
      return props.query?.type ? props.query : { type: "service", search: props.query?.query || "" };
    }
    const m = computed(() => model());
    const jsonData = computed(
      () => props.datasource?.jsonData || {}
    );
    const profile = computed(() => resolveSigNozProfile(jsonData.value));
    const caps2 = computed(
      () => resolveEditorCapabilities({
        profile: profile.value,
        options: jsonData.value
      })
    );
    function patch(p) {
      props.onChange({ ...m.value, ...p });
    }
    const unsupportedReason = computed(() => {
      const type = String(m.value.type || "service");
      const blocked = caps2.value?.unsupportedVariableTypes;
      if (blocked?.includes(type)) {
        return signozT(
          "signoz.variable.unsupportedType",
          'Current API profile does not support variable type "{type}"'
        ).replace("{type}", type);
      }
      if (type === "clickhouse_query" && caps2.value?.clickhouseSql === false) {
        return signozT(
          "signoz.variable.clickhouseUnsupported",
          "ClickHouse SQL variables are not enabled for the current profile"
        );
      }
      return "";
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1, [
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(signozT)("signoz.variable.type")),
          1
          /* TEXT */
        ),
        createVNode(unref(GSelect), {
          value: m.value.type || "service",
          options: [
            { label: unref(signozT)("signoz.variable.environment"), value: "environment" },
            { label: unref(signozT)("signoz.variable.service"), value: "service" },
            { label: unref(signozT)("signoz.variable.operation"), value: "operation" },
            { label: unref(signozT)("signoz.variable.metric"), value: "metric" },
            { label: unref(signozT)("signoz.variable.attributeKey"), value: "attributeKey" },
            { label: unref(signozT)("signoz.variable.attributeValue"), value: "attributeValue" },
            { label: unref(signozT)("signoz.variable.dynamic"), value: "dynamic" },
            { label: unref(signozT)("signoz.variable.clickhouse"), value: "clickhouse_query" }
          ],
          "test-id": "signoz-var-type",
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patch({ type: String($event) }))
        }, null, 8, ["value", "options"]),
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(signozT)("signoz.variable.search")),
          1
          /* TEXT */
        ),
        createVNode(unref(GInput), {
          "model-value": String(m.value.search || ""),
          "test-id": "signoz-var-search",
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => patch({ search: String($event) }))
        }, null, 8, ["model-value"]),
        m.value.type === "operation" ? (openBlock(), createElementBlock(
          "label",
          _hoisted_2$1,
          toDisplayString(unref(signozT)("signoz.variable.service")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        m.value.type === "operation" ? (openBlock(), createBlock(unref(GInput), {
          key: 1,
          "model-value": String(m.value.service || ""),
          "test-id": "signoz-var-service",
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => patch({ service: String($event) }))
        }, null, 8, ["model-value"])) : createCommentVNode("v-if", true),
        m.value.type === "attributeValue" || m.value.type === "attributeKey" ? (openBlock(), createElementBlock(
          "label",
          _hoisted_3,
          toDisplayString(unref(signozT)("signoz.variable.keyMetric")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        m.value.type === "attributeValue" ? (openBlock(), createBlock(unref(GInput), {
          key: 3,
          "model-value": String(m.value.key || ""),
          "test-id": "signoz-var-key",
          "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => patch({ key: String($event) }))
        }, null, 8, ["model-value"])) : createCommentVNode("v-if", true),
        m.value.type === "dynamic" ? (openBlock(), createElementBlock(
          "label",
          _hoisted_4,
          toDisplayString(unref(signozT)("signoz.variable.field")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        m.value.type === "dynamic" ? (openBlock(), createBlock(unref(GInput), {
          key: 5,
          "model-value": String(m.value.field || m.value.key || ""),
          "test-id": "signoz-var-dynamic-field",
          "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => patch({ field: String($event) }))
        }, null, 8, ["model-value"])) : createCommentVNode("v-if", true),
        m.value.type === "dynamic" ? (openBlock(), createElementBlock(
          "label",
          _hoisted_5,
          toDisplayString(unref(signozT)("signoz.variable.source")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        m.value.type === "dynamic" ? (openBlock(), createBlock(unref(GSelect), {
          key: 7,
          value: m.value.source || m.value.signal || "metrics",
          options: [
            { label: unref(signozT)("signoz.signal.metrics"), value: "metrics" },
            { label: unref(signozT)("signoz.signal.logs"), value: "logs" },
            { label: unref(signozT)("signoz.signal.traces"), value: "traces" }
          ],
          "test-id": "signoz-var-dynamic-source",
          "onUpdate:value": _cache[5] || (_cache[5] = ($event) => patch({ source: String($event) }))
        }, null, 8, ["value", "options"])) : createCommentVNode("v-if", true),
        m.value.type === "clickhouse_query" ? (openBlock(), createElementBlock(
          "label",
          _hoisted_6,
          toDisplayString(unref(signozT)("signoz.variable.sql")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true),
        m.value.type === "clickhouse_query" ? (openBlock(), createBlock(unref(GInput), {
          key: 9,
          "model-value": String(m.value.query || m.value.sql || ""),
          "test-id": "signoz-var-ch-sql",
          "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => patch({ query: String($event) }))
        }, null, 8, ["model-value"])) : createCommentVNode("v-if", true),
        unsupportedReason.value ? (openBlock(), createElementBlock(
          "p",
          _hoisted_7,
          toDisplayString(unsupportedReason.value),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const VariableQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__scopeId", "data-v-35c6749a"]]);
const _hoisted_1 = { "data-testid": "signoz-annotation-query-editor" };
const _hoisted_2 = {
  key: 0,
  class: "hint",
  "data-testid": "signoz-anno-alerts-hidden"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "AnnotationQueryEditor",
  props: {
    annotation: {},
    onChange: { type: Function },
    datasource: {}
  },
  setup(__props) {
    const props = __props;
    const target = computed(() => props.annotation.target || {});
    const jsonData = computed(
      () => props.datasource?.jsonData || {}
    );
    const profile = computed(() => {
      const jd = jsonData.value;
      const resolved = resolveSigNozProfile(jd);
      if (jd.customAlertsPath && !resolved.endpoints.alertsQuery) {
        return {
          ...resolved,
          endpoints: {
            ...resolved.endpoints,
            alertsQuery: { path: jd.customAlertsPath, method: "POST" }
          }
        };
      }
      return resolved;
    });
    const caps2 = computed(
      () => resolveEditorCapabilities({
        profile: profile.value,
        options: jsonData.value
      })
    );
    const sourceOptions = computed(() => {
      const opts = [
        { label: signozT("signoz.annotation.errorLogs"), value: "errorLogs" },
        { label: signozT("signoz.annotation.errorSpans"), value: "errorSpans" }
      ];
      if (caps2.value.alerts) {
        opts.push({
          label: signozT("signoz.annotation.firingAlerts"),
          value: "firingAlerts"
        });
      }
      return opts;
    });
    function patchTarget(partial) {
      props.onChange({
        ...props.annotation,
        name: props.annotation.name,
        enable: props.annotation.enable,
        iconColor: props.annotation.iconColor,
        target: { ...target.value, ...partial }
      });
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(signozT)("signoz.annotation.source")),
          1
          /* TEXT */
        ),
        createVNode(unref(GSelect), {
          value: target.value.source || "errorLogs",
          options: sourceOptions.value,
          "test-id": "signoz-anno-source",
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => patchTarget({ source: String($event) }))
        }, null, 8, ["value", "options"]),
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(signozT)("signoz.annotation.service")),
          1
          /* TEXT */
        ),
        createVNode(unref(GInput), {
          "model-value": String(target.value.service || ""),
          "test-id": "signoz-anno-service",
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => patchTarget({ service: String($event) }))
        }, null, 8, ["model-value"]),
        createElementVNode(
          "label",
          null,
          toDisplayString(unref(signozT)("signoz.annotation.environment")),
          1
          /* TEXT */
        ),
        createVNode(unref(GInput), {
          "model-value": String(target.value.environment || ""),
          "test-id": "signoz-anno-environment",
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => patchTarget({ environment: String($event) }))
        }, null, 8, ["model-value"]),
        !caps2.value.alerts ? (openBlock(), createElementBlock(
          "p",
          _hoisted_2,
          toDisplayString(unref(signozT)("signoz.annotation.alertsUnavailable")),
          1
          /* TEXT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});
const AnnotationQueryEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-0aa45cfa"]]);
registerSignozDataSourceFactory(createSignozDataSource);
const meta = {
  id: "signoz",
  name: "SigNoz",
  metrics: true,
  logs: true,
  tracing: true,
  capabilities: SIGNOZ_CAPABILITIES
};
const plugin = createDataSourcePlugin({
  meta,
  QueryEditor,
  ConfigEditor,
  VariableQueryEditor,
  AnnotationQueryEditor,
  createDataSource: (instance) => createSignozDataSource(instance, meta)
});
const module$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: plugin,
  plugin
}, Symbol.toStringTag, { value: "Module" }));
const olApi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Attribution,
  CircleStyle: Circle,
  Draw,
  Feature,
  Fill,
  GeoJSON,
  HeatmapLayer: Heatmap,
  LineString,
  Map: Map$1,
  MouseWheelZoom,
  OSM,
  Point,
  Polygon,
  RegularShape,
  ScaleLine,
  Stroke,
  Style,
  TextStyle: Text,
  TileLayer: Tile,
  VectorLayer: Vector,
  VectorSource: Vector$1,
  View,
  XYZ,
  Zoom,
  defaultControls: defaults,
  fromLonLat,
  getArea,
  getLength,
  toLonLat,
  transformExtent
}, Symbol.toStringTag, { value: "Module" }));
export {
  ActionsEditor,
  DATASOURCE_IDS as BUILTIN_DATASOURCE_IDS,
  BigValue,
  CLASSIC_PALETTE,
  CLASSIC_PALETTE_DARK,
  CLASSIC_PALETTE_LIGHT,
  ColorPicker,
  DATASOURCE_IDS,
  DATA_TRANSFORMER_IDS,
  DashboardGrid,
  DashboardImportModal,
  DashboardPage,
  DashboardViewer,
  DataLinkBuiltInVars,
  DataLinksEditor,
  DataSourceError,
  DataTransformerID,
  FALLBACK_COLOR,
  FieldColorEditor,
  FieldConfigBuilder,
  FieldMatcherID,
  _sfc_main$p$1 as FieldNamePicker,
  FieldNamePickerBaseNameMode,
  GAlert,
  GBadge,
  GButton,
  GCard,
  GCheckbox,
  GConfirmModal,
  GDatePicker,
  GDrawer,
  _sfc_main$H$1 as GForm,
  GIcon,
  GInlineField,
  GInlineFieldRow,
  GInput,
  GLoadingPlaceholder,
  GModal,
  _sfc_main$5$1 as GPagination,
  GPopover,
  GRadioButtonGroup,
  GSegmentInput,
  GSelect,
  GSpinner,
  GSwitch,
  GTable,
  GTabs,
  GTag,
  GToggletip,
  _sfc_main$y$1 as GTooltip,
  GrafanaAuthError,
  GrafanaDashboard,
  LibraryPanelsDrawer,
  LoadingStateEnum,
  NormalizedHeaders,
  OFFLINE_STORAGE_KEYS,
  OptionsUIBuilder as OptionsBuilder,
  OptionsPane,
  OptionsUIBuilder,
  PANEL_IDS,
  _sfc_main$j$1 as PanelContextProvider,
  PanelEditor,
  PanelHost,
  PanelInspector,
  QueryScheduler,
  ReducerID,
  RuntimeDataSourceSettingsError,
  SIGNOZ_CAPABILITIES,
  SIGNOZ_DATASOURCE_ID,
  SIGNOZ_PANEL_ID,
  SIGNOZ_PROFILES,
  STANDARD_FIELD_CONFIG,
  STANDARD_OVERRIDE_PROCESSORS,
  ShareDrawer,
  StatsPicker,
  StringArrayEditor,
  THEME_STORAGE_KEY,
  ThresholdsEditor,
  _sfc_main$m$1 as TimezonePicker,
  UNIT_CATEGORIES,
  UnitPicker,
  V1_SCHEMA_VERSION,
  VUE_PLUGIN_ABI_MAJOR,
  ValueMappingsEditor,
  VariableOrigin,
  VariableSuggestionsScope,
  VizLayout,
  VizLegend,
  VizTooltip,
  VuePanelPlugin,
  ZABBIX_CAPABILITIES,
  ZABBIX_DATASOURCE_ID,
  ZABBIX_PANEL_ID,
  alpha$1 as alpha,
  antDesignThemeTokens,
  applyCredentialHeaders,
  applyDocumentPatches,
  applyFieldOverrides,
  applyGlobalStyles,
  applyGrafanaAuthHeaders,
  applyJsonPatch,
  applyNowDelay,
  applyProcessedProperty,
  applyResolvedTheme,
  applyTextDirection,
  applyTheme2CssVars,
  applyThemeVars,
  applyTransformations,
  applyTransformationsWithTrace,
  applyValueMappings,
  asHexString,
  asRgbString,
  assertNoReactPlugins,
  assertSignalSupported,
  assertVuePluginAbi,
  assignFrameRevision,
  axiosHeadersToRecord,
  backendRequest,
  backendSrv,
  bootstrapGrafanaVue,
  bootstrapObservabilityDataSources,
  buildDataLinkUrl,
  buildDataLinkVars,
  buildPluginMeta,
  bumpFrameRevision,
  canSkipNormalize,
  clearCompiledPipelineCache,
  clearDatasourceHttpLog,
  clearFieldOverrideCompileCache,
  clearPluginRegistries,
  clearQueryInspectorStore,
  clearRuntimeCredentials,
  clearRuntimeDataSourceSettings,
  coerceFieldConfigEditorValue,
  colorManipulator,
  commitImport,
  compileOverrideRules,
  compileTransformSteps,
  compiledPipelineCacheStats,
  configureBackendSrv,
  configureCompiledPipelineCache,
  configureDatasourceHttpClient,
  configureQueryInspectorStore,
  configureRuntimeCredentials,
  configureRuntimeDataSourceSettings,
  continuousGrYlRd,
  convertV2DashboardToV1,
  createColors,
  createDashboardDocument,
  createDataFrame,
  createDataSourceCatalog,
  createDataSourcePlugin,
  createDefaultBootData,
  createDefaultPanelContext,
  createEmptyDashboardJson,
  createEmptyEditorContext,
  createGlobalStyles,
  createHttpClient,
  createImportWizardState,
  createPanelEditSession,
  createPanelEditorState,
  createPanelPlugin,
  createPanelQueryEngine,
  createPrometheusDataSource,
  createSignozDataSource,
  createTheme,
  createThemeFromPreference,
  createVisualizationColors,
  createZabbixDataSource,
  darken,
  dashboardRoundTrip,
  datasourceHttp,
  dateTime,
  decomposeColor,
  defaultObservabilityDataSources,
  defaultRefreshIntervals,
  detectSourceKind,
  detectTextDirection,
  diffJsonPaths,
  displayValueToString,
  dsTypeBadge,
  dsTypeLabel,
  emphasize,
  endOfFiscalQuarter,
  endOfFiscalYear,
  ensureDatasourceCatalogEntryRegistered,
  fieldMatchesName,
  findField$1 as findField,
  flattenUnits,
  flattenV2Layout,
  formatLabels,
  formatSuggestionToken,
  formatUnit,
  formatValue,
  formatValueWithUnit,
  formattedValueToString,
  frameContextMatches,
  frameFingerprint,
  frameHasName,
  frameSetRevisionKey,
  getActiveThreshold,
  getAppHttp,
  getAtPath,
  getBackendHttp,
  getBackendMode,
  getBootData,
  getBuiltinDatasourceCatalogEntry,
  getClassicPalette$1 as getClassicPalette,
  getCompiledPipeline,
  getContrastRatio,
  getContrastText,
  getDashboardLinkUrl,
  getDataFrameVars,
  getDataLinksVariableSuggestions,
  getDataSourceByUid,
  getDataSourceCatalog,
  getDataSourcePlugin,
  getDatasourceHttpClient,
  getDatasourceHttpLog,
  getDisplayProcessor,
  getEffectiveDefaultDataSource,
  getFieldColor,
  getFieldDisplayName,
  getFieldLinks,
  getFieldMatcher,
  getFieldMatcherInfo,
  getFieldNameOptions,
  getFieldSeriesColor,
  getFrameDisplayName,
  getFrameFieldsDisplayNames,
  getFrameRevision,
  getGrafanaAuthSnapshot,
  getGrafanaAuthToken,
  getGrafanaBaseUrl,
  getInterval,
  getLiveDashboardBuilders,
  getLuminance,
  getOptionPath,
  getOverrideProcessor,
  getPanelPlugin,
  getQueryInspectorEntry,
  getQueryInspectorStats,
  getRawDisplayProcessor,
  getResourceHttp,
  getRuntimeCredential,
  getRuntimeDataSourceSettings,
  getTemplateVariableSuggestions,
  getThresholdColor,
  getTransformer,
  getValueFormat,
  grafanaCssVars,
  groupLabelForScope,
  hasPermission,
  hexToRgb,
  hslToRgb,
  iconMap,
  initTheme,
  interpolateDataLinkString,
  intervalToMs,
  isDataSourceError,
  isFeatureEnabled,
  isFrameNormalized,
  isGrafanaLiveConfigured,
  isIanaTimezone,
  isKnownOverrideProperty,
  isUtcTimezone,
  isV2Dashboard,
  isVuePluginManifest,
  lighten,
  listBuiltinDatasourceCatalog,
  listDataSourcePlugins,
  listDataSources,
  listFieldMatchers,
  listImportedDashboards,
  listOverridePickerMatchers,
  listPanelPlugins,
  listQueryInspectorEntries,
  listReducerIds,
  listRuntimeDataSourceSettings,
  listStandardTransformers,
  listTransformerIds,
  listValueFormatIds,
  loadDashboardDocument,
  makeInspectorKey,
  markFrameNormalized,
  matchField,
  matchFieldWithRegistry,
  matchFrameFilter,
  mergeDataSourceSettings,
  mergeObservabilityDataSourceInput,
  mergeObservabilityDataSourceInputsByUid,
  migrateDashboard,
  migrateV1Dashboard,
  normalizeBaseNameMode,
  normalizeDashboard,
  normalizeDataFrames,
  normalizeDataSourceType,
  normalizeDsType,
  normalizeFiscalMonth,
  normalizeHideFrom,
  normalizeLocale,
  normalizeScaleDistribution,
  normalizeStacking,
  normalizeThresholdsStyle,
  onThemeChange,
  palette,
  panelContextKey,
  parseDashboardDocument,
  parsePath,
  parseWizardPayload,
  parseWizardPayloadAsync,
  pipelineConfigRevision,
  preProcessPanelData,
  preparePanelData,
  preserveUnknownFields,
  processOverrideValue,
  providePanelContext,
  putQueryInspectorEntry,
  radioDisplayValue,
  rangeUtil_parse,
  readUrlTheme,
  recomposeColor,
  redactToken,
  reduceField,
  reduceField$1 as reduceFieldFromRegistry,
  refreshImportPreview,
  registerDataSourcePlugin,
  registerI18nCatalog,
  registerLiveDashboardBuilders,
  registerPanelPlugin,
  registerTransformer,
  removeAtPath,
  requireGrafanaAuthToken,
  resetDataSourceCatalog,
  resetHttpClients,
  resetOfflineStorage,
  resolveBackendBootSelection,
  resolveDataLink,
  resolveIcon,
  resolveInitialPreference,
  resolveObservabilityDataSources,
  resolvePluginOptionDescriptors,
  resolveThemeMode,
  resolveThemeModeHint,
  resolveTransformerId,
  resolveV2Datasource,
  resolveVizColor,
  rgbToHex,
  roundTripDashboard,
  runCompiledPipeline,
  runMigrations,
  sanitizeErrorText,
  saveDataSource,
  serializeDashboardDocument,
  setAtPath,
  setBootData,
  setGrafanaAuthToken,
  setLocale,
  setOptionPath,
  setRTL,
  setRuntimeCredential,
  sortThresholds,
  splitOptionPath,
  standardTransformers,
  startOfFiscalQuarter,
  startOfFiscalYear,
  stringStartsAsRegEx,
  stringToJsRegex,
  stringToJsRegexSafe,
  stringToMs,
  t,
  toDataFrameDTO,
  toSerializableDashboard,
  useBootData,
  useDashboardStore,
  useI18n,
  useLocationService,
  usePanelContext,
  usePermissions,
  useTheme,
  v1Migrations,
  v2ResourceToV1,
  watchSystemTheme,
  withDataSourceContext,
  zonedWallTimeToUtc
};
//# sourceMappingURL=index.js.map
