@vue/devtools-kit 7.0.14 → 7.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -11,9 +11,9 @@ var __esm = (fn, res) => function __init() {
11
11
  var __commonJS = (cb, mod) => function __require() {
12
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
13
  };
14
- var __export = (target8, all) => {
14
+ var __export = (target9, all) => {
15
15
  for (var name in all)
16
- __defProp(target8, name, { get: all[name], enumerable: true });
16
+ __defProp(target9, name, { get: all[name], enumerable: true });
17
17
  };
18
18
  var __copyProps = (to, from, except, desc) => {
19
19
  if (from && typeof from === "object" || typeof from === "function") {
@@ -23,19 +23,19 @@ var __copyProps = (to, from, except, desc) => {
23
23
  }
24
24
  return to;
25
25
  };
26
- var __toESM = (mod, isNodeMode, target8) => (target8 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ var __toESM = (mod, isNodeMode, target9) => (target9 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
27
  // If the importer is in node compatibility mode or this is not an ESM
28
28
  // file that has been converted to a CommonJS file using a Babel-
29
29
  // compatible transform (i.e. "__esModule" has not been set), then set
30
30
  // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target8, "default", { value: mod, enumerable: true }) : target8,
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target9, "default", { value: mod, enumerable: true }) : target9,
32
32
  mod
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -1581,81 +1581,78 @@ var require_speakingurl2 = __commonJS({
1581
1581
  // src/index.ts
1582
1582
  var src_exports = {};
1583
1583
  __export(src_exports, {
1584
- ESC: () => ESC,
1585
- INFINITY: () => INFINITY,
1586
- MAX_ARRAY_SIZE: () => MAX_ARRAY_SIZE,
1587
- MAX_STRING_SIZE: () => MAX_STRING_SIZE,
1588
- NAN: () => NAN,
1589
- NEGATIVE_INFINITY: () => NEGATIVE_INFINITY,
1590
1584
  UNDEFINED: () => UNDEFINED,
1591
1585
  addCustomCommand: () => addCustomCommand,
1592
1586
  addCustomTab: () => addCustomTab,
1593
1587
  devtools: () => devtools,
1594
- fnTypeRE: () => fnTypeRE,
1595
1588
  formatInspectorStateValue: () => formatInspectorStateValue,
1596
1589
  getInspectorStateValueType: () => getInspectorStateValueType,
1597
- getRawValue: () => getRawValue,
1598
- now: () => now,
1590
+ getRaw: () => getRaw,
1599
1591
  onDevToolsClientConnected: () => onDevToolsClientConnected,
1600
1592
  onDevToolsConnected: () => onDevToolsConnected,
1601
1593
  parse: () => parse,
1602
- rawTypeRE: () => rawTypeRE,
1603
1594
  removeCustomCommand: () => removeCustomCommand,
1595
+ setDevToolsEnv: () => setDevToolsEnv,
1604
1596
  setupDevToolsPlugin: () => setupDevToolsPlugin,
1605
- specialTypeRE: () => specialTypeRE,
1606
1597
  stringify: () => stringify,
1607
- symbolRE: () => symbolRE,
1608
1598
  toEdit: () => toEdit,
1609
1599
  toSubmit: () => toSubmit,
1610
- toggleComponentInspectorEnabled: () => toggleComponentInspectorEnabled,
1611
- vueBuiltins: () => vueBuiltins
1600
+ toggleComponentInspectorEnabled: () => toggleComponentInspectorEnabled
1612
1601
  });
1613
1602
  module.exports = __toCommonJS(src_exports);
1614
1603
  init_cjs_shims();
1615
1604
 
1616
- // src/core/general/index.ts
1605
+ // src/core/index.ts
1617
1606
  init_cjs_shims();
1618
- var import_devtools_shared12 = require("@vue/devtools-shared");
1619
- var import_devtools_schema3 = require("@vue/devtools-schema");
1607
+ var import_devtools_shared15 = require("@vue/devtools-shared");
1620
1608
 
1621
- // src/api/index.ts
1609
+ // src/hook/index.ts
1622
1610
  init_cjs_shims();
1611
+ var import_devtools_shared = require("@vue/devtools-shared");
1612
+ var import_hookable = require("hookable");
1623
1613
 
1624
- // src/core/general/state.ts
1614
+ // src/types/index.ts
1625
1615
  init_cjs_shims();
1626
- var import_devtools_shared3 = require("@vue/devtools-shared");
1627
- var import_perfect_debounce2 = require("perfect-debounce");
1628
1616
 
1629
- // src/core/router/index.ts
1617
+ // src/types/app.ts
1630
1618
  init_cjs_shims();
1631
- var import_devtools_shared2 = require("@vue/devtools-shared");
1632
- var import_perfect_debounce = require("perfect-debounce");
1633
1619
 
1634
- // src/core/general/hook.ts
1620
+ // src/types/hook.ts
1635
1621
  init_cjs_shims();
1636
- var import_devtools_schema = require("@vue/devtools-schema");
1637
- var import_devtools_shared = require("@vue/devtools-shared");
1638
- var import_hookable = require("hookable");
1622
+
1623
+ // src/types/state.ts
1624
+ init_cjs_shims();
1625
+
1626
+ // src/types/context.ts
1627
+ init_cjs_shims();
1628
+
1629
+ // src/types/router.ts
1630
+ init_cjs_shims();
1631
+
1632
+ // src/types/env.ts
1633
+ init_cjs_shims();
1634
+
1635
+ // src/hook/index.ts
1639
1636
  var _a, _b;
1640
1637
  var devtoolsHooks = (_b = (_a = import_devtools_shared.target).__VUE_DEVTOOLS_HOOK) != null ? _b : _a.__VUE_DEVTOOLS_HOOK = (0, import_hookable.createHooks)();
1641
1638
  var on = {
1642
1639
  vueAppInit(fn) {
1643
- devtoolsHooks.hook(import_devtools_schema.DevToolsHooks.APP_INIT, fn);
1640
+ devtoolsHooks.hook("app:init" /* APP_INIT */, fn);
1644
1641
  },
1645
1642
  vueAppConnected(fn) {
1646
- devtoolsHooks.hook(import_devtools_schema.DevToolsHooks.APP_CONNECTED, fn);
1643
+ devtoolsHooks.hook("app:connected" /* APP_CONNECTED */, fn);
1647
1644
  },
1648
1645
  componentAdded(fn) {
1649
- return devtoolsHooks.hook(import_devtools_schema.DevToolsHooks.COMPONENT_ADDED, fn);
1646
+ return devtoolsHooks.hook("component:added" /* COMPONENT_ADDED */, fn);
1650
1647
  },
1651
1648
  componentUpdated(fn) {
1652
- return devtoolsHooks.hook(import_devtools_schema.DevToolsHooks.COMPONENT_UPDATED, fn);
1649
+ return devtoolsHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
1653
1650
  },
1654
1651
  componentRemoved(fn) {
1655
- return devtoolsHooks.hook(import_devtools_schema.DevToolsHooks.COMPONENT_REMOVED, fn);
1652
+ return devtoolsHooks.hook("component:removed" /* COMPONENT_REMOVED */, fn);
1656
1653
  },
1657
1654
  setupDevtoolsPlugin(fn) {
1658
- devtoolsHooks.hook(import_devtools_schema.DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, fn);
1655
+ devtoolsHooks.hook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, fn);
1659
1656
  }
1660
1657
  };
1661
1658
  function createDevToolsHook() {
@@ -1666,10 +1663,10 @@ function createDevToolsHook() {
1666
1663
  apps: {},
1667
1664
  events: /* @__PURE__ */ new Map(),
1668
1665
  on(event, fn) {
1669
- var _a9;
1666
+ var _a10;
1670
1667
  if (!this.events.has(event))
1671
1668
  this.events.set(event, []);
1672
- (_a9 = this.events.get(event)) == null ? void 0 : _a9.push(fn);
1669
+ (_a10 = this.events.get(event)) == null ? void 0 : _a10.push(fn);
1673
1670
  return () => this.off(event, fn);
1674
1671
  },
1675
1672
  once(event, fn) {
@@ -1696,295 +1693,200 @@ function createDevToolsHook() {
1696
1693
  }
1697
1694
  function subscribeDevToolsHook() {
1698
1695
  const hook2 = import_devtools_shared.target.__VUE_DEVTOOLS_GLOBAL_HOOK__;
1699
- hook2.on(import_devtools_schema.DevToolsHooks.APP_INIT, (app, version) => {
1700
- var _a9, _b9, _c;
1701
- if ((_c = (_b9 = (_a9 = app == null ? void 0 : app._instance) == null ? void 0 : _a9.type) == null ? void 0 : _b9.devtools) == null ? void 0 : _c.hide)
1696
+ hook2.on("app:init" /* APP_INIT */, (app, version) => {
1697
+ var _a10, _b10, _c;
1698
+ if ((_c = (_b10 = (_a10 = app == null ? void 0 : app._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
1702
1699
  return;
1703
- devtoolsHooks.callHook(import_devtools_schema.DevToolsHooks.APP_INIT, app, version);
1700
+ devtoolsHooks.callHook("app:init" /* APP_INIT */, app, version);
1704
1701
  });
1705
- hook2.on(import_devtools_schema.DevToolsHooks.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
1706
- var _a9, _b9, _c;
1707
- if ((_c = (_b9 = (_a9 = app == null ? void 0 : app._instance) == null ? void 0 : _a9.type) == null ? void 0 : _b9.devtools) == null ? void 0 : _c.hide)
1702
+ hook2.on("component:added" /* COMPONENT_ADDED */, async (app, uid, parentUid, component) => {
1703
+ var _a10, _b10, _c;
1704
+ if ((_c = (_b10 = (_a10 = app == null ? void 0 : app._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
1708
1705
  return;
1709
1706
  if (!app || typeof uid !== "number" && !uid || !component)
1710
1707
  return;
1711
- devtoolsHooks.callHook(import_devtools_schema.DevToolsHooks.COMPONENT_ADDED, app, uid, parentUid, component);
1708
+ devtoolsHooks.callHook("component:added" /* COMPONENT_ADDED */, app, uid, parentUid, component);
1712
1709
  });
1713
- hook2.on(import_devtools_schema.DevToolsHooks.COMPONENT_UPDATED, (app, uid, parentUid, component) => {
1710
+ hook2.on("component:updated" /* COMPONENT_UPDATED */, (app, uid, parentUid, component) => {
1714
1711
  if (!app || typeof uid !== "number" && !uid || !component)
1715
1712
  return;
1716
- devtoolsHooks.callHook(import_devtools_schema.DevToolsHooks.COMPONENT_UPDATED, app, uid, parentUid, component);
1713
+ devtoolsHooks.callHook("component:updated" /* COMPONENT_UPDATED */, app, uid, parentUid, component);
1717
1714
  });
1718
- hook2.on(import_devtools_schema.DevToolsHooks.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
1715
+ hook2.on("component:removed" /* COMPONENT_REMOVED */, async (app, uid, parentUid, component) => {
1719
1716
  if (!app || typeof uid !== "number" && !uid || !component)
1720
1717
  return;
1721
- devtoolsHooks.callHook(import_devtools_schema.DevToolsHooks.COMPONENT_REMOVED, app, uid, parentUid, component);
1718
+ devtoolsHooks.callHook("component:removed" /* COMPONENT_REMOVED */, app, uid, parentUid, component);
1722
1719
  });
1723
- hook2.on(import_devtools_schema.DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, (pluginDescriptor, setupFn) => {
1724
- devtoolsHooks.callHook(import_devtools_schema.DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
1720
+ hook2.on("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, (pluginDescriptor, setupFn) => {
1721
+ devtoolsHooks.callHook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, pluginDescriptor, setupFn);
1725
1722
  });
1726
1723
  }
1727
1724
  var hook = {
1728
- on
1725
+ on,
1726
+ setupDevToolsPlugin(pluginDescriptor, setupFn) {
1727
+ return devtoolsHooks.callHook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, pluginDescriptor, setupFn);
1728
+ }
1729
1729
  };
1730
1730
 
1731
+ // src/state/index.ts
1732
+ init_cjs_shims();
1733
+
1734
+ // src/state/state.ts
1735
+ init_cjs_shims();
1736
+ var import_devtools_shared10 = require("@vue/devtools-shared");
1737
+ var import_perfect_debounce3 = require("perfect-debounce");
1738
+
1739
+ // src/api/index.ts
1740
+ init_cjs_shims();
1741
+
1742
+ // src/api/api.ts
1743
+ init_cjs_shims();
1744
+
1745
+ // src/core/timeline/index.ts
1746
+ init_cjs_shims();
1747
+ function addTimelineLayer(payload) {
1748
+ devtoolsContext.timelineLayer.push(payload);
1749
+ }
1750
+
1751
+ // src/core/inspector/index.ts
1752
+ init_cjs_shims();
1753
+ function addInspector(payload) {
1754
+ devtoolsContext.inspector.push(payload);
1755
+ }
1756
+ function getInspector(inspectorId) {
1757
+ return devtoolsContext.inspector.find((inspector) => inspector.id === inspectorId);
1758
+ }
1759
+ function updateInspector(inspectorId, payload) {
1760
+ const inspector = getInspector(inspectorId);
1761
+ inspector && Object.assign(inspector, payload);
1762
+ }
1763
+
1764
+ // src/core/app-record/index.ts
1765
+ init_cjs_shims();
1766
+ var import_speakingurl = __toESM(require_speakingurl2(), 1);
1767
+
1768
+ // src/api/plugin.ts
1769
+ init_cjs_shims();
1770
+
1731
1771
  // src/core/router/index.ts
1732
- var RouterInfoKey = "__VUE_DEVTOOLS_ROUTER_INFO__";
1733
- var RouterKey = "__VUE_DEVTOOLS_ROUTER__";
1772
+ init_cjs_shims();
1773
+ var import_devtools_shared3 = require("@vue/devtools-shared");
1774
+ var import_perfect_debounce = require("perfect-debounce");
1775
+
1776
+ // src/api/hook.ts
1777
+ init_cjs_shims();
1778
+ var import_devtools_shared2 = require("@vue/devtools-shared");
1779
+ var import_hookable2 = require("hookable");
1734
1780
  var _a2, _b2;
1735
- (_b2 = (_a2 = import_devtools_shared2.target)[RouterInfoKey]) != null ? _b2 : _a2[RouterInfoKey] = {
1736
- currentRoute: null,
1737
- routes: [],
1738
- router: null
1739
- };
1740
- var _a3, _b3;
1741
- (_b3 = (_a3 = import_devtools_shared2.target)[RouterKey]) != null ? _b3 : _a3[RouterKey] = null;
1742
- var devtoolsRouterInfo = new Proxy(import_devtools_shared2.target[RouterInfoKey], {
1743
- get(target8, property) {
1744
- return import_devtools_shared2.target[RouterInfoKey][property];
1781
+ var apiHooks = (_b2 = (_a2 = import_devtools_shared2.target).__VUE_DEVTOOLS_API_HOOK) != null ? _b2 : _a2.__VUE_DEVTOOLS_API_HOOK = (0, import_hookable2.createHooks)();
1782
+
1783
+ // src/core/router/index.ts
1784
+ function getRoutes(router) {
1785
+ const routesMap = /* @__PURE__ */ new Map();
1786
+ return ((router == null ? void 0 : router.getRoutes()) || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
1787
+ }
1788
+ function filterRoutes(routes) {
1789
+ return routes.map((item) => {
1790
+ let { path, name, children } = item;
1791
+ if (children == null ? void 0 : children.length)
1792
+ children = filterRoutes(children);
1793
+ return {
1794
+ path,
1795
+ name,
1796
+ children
1797
+ };
1798
+ });
1799
+ }
1800
+ function filterCurrentRoute(route) {
1801
+ if (route) {
1802
+ const { fullPath, hash, href, path, name, matched, params, query } = route;
1803
+ return {
1804
+ fullPath,
1805
+ hash,
1806
+ href,
1807
+ path,
1808
+ name,
1809
+ params,
1810
+ query,
1811
+ matched: filterRoutes(matched)
1812
+ };
1745
1813
  }
1746
- });
1814
+ return route;
1815
+ }
1747
1816
  function normalizeRouterInfo(appRecord) {
1748
- const getRoutes = (router) => {
1749
- const routesMap = /* @__PURE__ */ new Map();
1750
- return ((router == null ? void 0 : router.getRoutes()) || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
1751
- };
1752
- function filterRoutes(routes) {
1753
- return routes.map((item) => {
1754
- let { path, name, children } = item;
1755
- if (children == null ? void 0 : children.length)
1756
- children = filterRoutes(children);
1757
- return {
1758
- path,
1759
- name,
1760
- children
1761
- };
1762
- });
1763
- }
1764
- function filterCurrentRoute(route) {
1765
- if (route) {
1766
- const { fullPath, hash, href, path, name, matched, params, query } = route;
1767
- return {
1768
- fullPath,
1769
- hash,
1770
- href,
1771
- path,
1772
- name,
1773
- params,
1774
- query,
1775
- matched: filterRoutes(matched)
1776
- };
1777
- }
1778
- return route;
1779
- }
1780
1817
  function init() {
1781
- var _a9;
1782
- const router = (_a9 = appRecord.app) == null ? void 0 : _a9.config.globalProperties.$router;
1818
+ var _a10;
1819
+ const router = (_a10 = appRecord.app) == null ? void 0 : _a10.config.globalProperties.$router;
1783
1820
  const currentRoute = filterCurrentRoute(router == null ? void 0 : router.currentRoute.value);
1784
1821
  const routes = filterRoutes(getRoutes(router));
1785
1822
  const c = console.warn;
1786
1823
  console.warn = () => {
1787
1824
  };
1788
- import_devtools_shared2.target[RouterInfoKey] = {
1789
- currentRoute: currentRoute ? (0, import_devtools_shared2.deepClone)(currentRoute) : {},
1790
- routes: (0, import_devtools_shared2.deepClone)(routes)
1825
+ import_devtools_shared3.target[ROUTER_INFO_KEY] = {
1826
+ currentRoute: currentRoute ? (0, import_devtools_shared3.deepClone)(currentRoute) : {},
1827
+ routes: (0, import_devtools_shared3.deepClone)(routes)
1791
1828
  };
1792
- import_devtools_shared2.target[RouterKey] = router;
1829
+ import_devtools_shared3.target[ROUTER_KEY] = router;
1793
1830
  console.warn = c;
1794
1831
  }
1795
1832
  init();
1796
1833
  hook.on.componentUpdated((0, import_perfect_debounce.debounce)(() => {
1797
1834
  init();
1798
- apiHooks.callHook("router-info:updated" /* ROUTER_INFO_UPDATED */, import_devtools_shared2.target[RouterInfoKey]);
1835
+ apiHooks.callHook("router-info:updated" /* ROUTER_INFO_UPDATED */, import_devtools_shared3.target[ROUTER_INFO_KEY]);
1799
1836
  }, 200));
1800
1837
  }
1801
1838
  function getRouterDevToolsId(id) {
1802
1839
  return id.replace(/\D/g, "") || "0";
1803
1840
  }
1804
1841
 
1805
- // src/core/general/state.ts
1806
- var StateKey = "__VUE_DEVTOOLS_GLOBAL_STATE__";
1807
- var ContextKey = "__VUE_DEVTOOLS_CONTEXT__";
1808
- var DefaultContext = {
1809
- appRecord: null,
1810
- api: null,
1811
- inspector: [],
1812
- timelineLayer: [],
1813
- routerInfo: {},
1814
- router: null,
1815
- activeInspectorTreeId: "",
1816
- componentPluginHookBuffer: []
1817
- };
1818
- var _a4, _b4;
1819
- (_b4 = (_a4 = import_devtools_shared3.target)[StateKey]) != null ? _b4 : _a4[StateKey] = {
1820
- connected: false,
1821
- clientConnected: false,
1822
- appRecords: [],
1823
- activeAppRecord: null,
1824
- selectedComponentId: null,
1825
- pluginBuffer: [],
1826
- tabs: [],
1827
- commands: [],
1828
- vitePluginDetected: false,
1829
- activeAppRecordId: null
1830
- };
1831
- var _a5, _b5;
1832
- (_b5 = (_a5 = import_devtools_shared3.target)[ContextKey]) != null ? _b5 : _a5[ContextKey] = (0, import_devtools_shared3.deepClone)(DefaultContext);
1833
- var callStateUpdatedHook = (0, import_perfect_debounce2.debounce)((state, oldState) => {
1834
- apiHooks.callHook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, state, oldState);
1835
- }, 80);
1836
- var callConnectedUpdatedHook = (0, import_perfect_debounce2.debounce)((state, oldState) => {
1837
- apiHooks.callHook("devtools:connected-updated" /* DEVTOOLS_CONNECTED_UPDATED */, state, oldState);
1838
- }, 80);
1839
- var devtoolsState = new Proxy(import_devtools_shared3.target[StateKey], {
1840
- get(target8, property) {
1841
- return import_devtools_shared3.target[StateKey][property];
1842
- },
1843
- set(target8, property, value) {
1844
- var _a9;
1845
- const oldState = { ...import_devtools_shared3.target[StateKey] };
1846
- target8[property] = value;
1847
- import_devtools_shared3.target[StateKey][property] = value;
1848
- if (property === "activeAppRecord") {
1849
- import_devtools_shared3.target[ContextKey].appRecord = value;
1850
- import_devtools_shared3.target[ContextKey].api = value.api;
1851
- import_devtools_shared3.target[ContextKey].inspector = (_a9 = value.inspector) != null ? _a9 : [];
1852
- normalizeRouterInfo(value);
1853
- import_devtools_shared3.target[ContextKey].routerInfo = devtoolsRouterInfo;
1842
+ // src/api/plugin.ts
1843
+ function collectDevToolsPlugin(pluginDescriptor, setupFn) {
1844
+ devtoolsState.pluginBuffer.push([pluginDescriptor, setupFn]);
1845
+ }
1846
+ function setupDevToolsPlugin(pluginDescriptor, setupFn) {
1847
+ return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
1848
+ }
1849
+ function registerPlugin(app, api) {
1850
+ const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app);
1851
+ plugins.forEach(async ([plugin, setupFn]) => {
1852
+ if (plugin.packageName === "vue-query") {
1853
+ return;
1854
1854
  }
1855
- callStateUpdatedHook(import_devtools_shared3.target[StateKey], oldState);
1856
- if (["connected", "clientConnected"].includes(property.toString()) && oldState[property] !== value)
1857
- callConnectedUpdatedHook(import_devtools_shared3.target[StateKey], oldState);
1858
- return true;
1859
- },
1860
- deleteProperty(target8, property) {
1861
- delete target8[property];
1862
- return true;
1863
- }
1864
- });
1865
- Object.defineProperty(devtoolsState.tabs, "push", {
1866
- configurable: true,
1867
- value(...items) {
1868
- const result = Array.prototype.push.apply(this, items);
1869
- devtoolsState.tabs = this;
1870
- apiHooks.callHook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, this);
1871
- return result;
1872
- }
1873
- });
1874
- ["push", "splice"].forEach((method) => {
1875
- Object.defineProperty(devtoolsState.commands, method, {
1876
- configurable: true,
1877
- value(...args) {
1878
- const result = Array.prototype[method].apply(this, args);
1879
- devtoolsState.commands = this;
1880
- apiHooks.callHook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, this);
1881
- return result;
1855
+ if (plugin.packageName === "vue-router") {
1856
+ const id = getRouterDevToolsId(`${plugin.id}`);
1857
+ if (plugin.app === app) {
1858
+ devtoolsAppRecords.value = devtoolsAppRecords.value.map((item) => ({
1859
+ ...item,
1860
+ routerId: id
1861
+ }));
1862
+ }
1882
1863
  }
1864
+ setupFn(api);
1865
+ });
1866
+ devtoolsAppRecords.value = devtoolsAppRecords.value.map((record) => {
1867
+ var _a10, _b10;
1868
+ const globalProperties = (_b10 = (_a10 = record.app) == null ? void 0 : _a10.config) == null ? void 0 : _b10.globalProperties;
1869
+ if (!globalProperties)
1870
+ return record;
1871
+ return {
1872
+ ...record,
1873
+ moduleDetectives: {
1874
+ vueRouter: !!globalProperties.$router,
1875
+ pinia: !!globalProperties.$pinia,
1876
+ vueI18n: !!globalProperties.$i18n
1877
+ }
1878
+ };
1883
1879
  });
1884
- });
1885
- var devtoolsContext = new Proxy(import_devtools_shared3.target[ContextKey], {
1886
- get(target8, property) {
1887
- if (property === "router")
1888
- return import_devtools_shared3.target[RouterKey];
1889
- else if (property === "clear")
1890
- return clearDevToolsContext;
1891
- return import_devtools_shared3.target[ContextKey][property];
1892
- },
1893
- set(target8, property, value) {
1894
- if (property === "componentPluginHookBuffer")
1895
- import_devtools_shared3.target[ContextKey][property] = value;
1896
- return true;
1897
- }
1898
- });
1899
- function clearDevToolsContext() {
1900
- import_devtools_shared3.target[ContextKey] = (0, import_devtools_shared3.deepClone)(DefaultContext);
1901
1880
  }
1902
1881
 
1903
- // src/shared/index.ts
1904
- init_cjs_shims();
1905
-
1906
- // src/shared/util.ts
1907
- init_cjs_shims();
1908
-
1909
- // src/core/component/state/replacer.ts
1910
- init_cjs_shims();
1911
-
1912
- // src/core/component/state/constants.ts
1882
+ // src/plugins/index.ts
1913
1883
  init_cjs_shims();
1914
- var vueBuiltins = /* @__PURE__ */ new Set([
1915
- "nextTick",
1916
- "defineComponent",
1917
- "defineAsyncComponent",
1918
- "defineCustomElement",
1919
- "ref",
1920
- "computed",
1921
- "reactive",
1922
- "readonly",
1923
- "watchEffect",
1924
- "watchPostEffect",
1925
- "watchSyncEffect",
1926
- "watch",
1927
- "isRef",
1928
- "unref",
1929
- "toRef",
1930
- "toRefs",
1931
- "isProxy",
1932
- "isReactive",
1933
- "isReadonly",
1934
- "shallowRef",
1935
- "triggerRef",
1936
- "customRef",
1937
- "shallowReactive",
1938
- "shallowReadonly",
1939
- "toRaw",
1940
- "markRaw",
1941
- "effectScope",
1942
- "getCurrentScope",
1943
- "onScopeDispose",
1944
- "onMounted",
1945
- "onUpdated",
1946
- "onUnmounted",
1947
- "onBeforeMount",
1948
- "onBeforeUpdate",
1949
- "onBeforeUnmount",
1950
- "onErrorCaptured",
1951
- "onRenderTracked",
1952
- "onRenderTriggered",
1953
- "onActivated",
1954
- "onDeactivated",
1955
- "onServerPrefetch",
1956
- "provide",
1957
- "inject",
1958
- "h",
1959
- "mergeProps",
1960
- "cloneVNode",
1961
- "isVNode",
1962
- "resolveComponent",
1963
- "resolveDirective",
1964
- "withDirectives",
1965
- "withModifiers"
1966
- ]);
1967
- var symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
1968
- var rawTypeRE = /^\[object (\w+)]$/;
1969
- var specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
1970
- var fnTypeRE = /^(?:function|class) (\w+)/;
1971
- var MAX_STRING_SIZE = 1e4;
1972
- var MAX_ARRAY_SIZE = 5e3;
1973
- var UNDEFINED = "__vue_devtool_undefined__";
1974
- var INFINITY = "__vue_devtool_infinity__";
1975
- var NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
1976
- var NAN = "__vue_devtool_nan__";
1977
- var ESC = {
1978
- "<": "&lt;",
1979
- ">": "&gt;",
1980
- '"': "&quot;",
1981
- "&": "&amp;"
1982
- };
1983
1884
 
1984
- // src/core/component/state/custom.ts
1885
+ // src/plugins/component.ts
1985
1886
  init_cjs_shims();
1887
+ var import_perfect_debounce2 = require("perfect-debounce");
1986
1888
 
1987
- // src/core/component/general/util.ts
1889
+ // src/core/component/utils/index.ts
1988
1890
  init_cjs_shims();
1989
1891
  var import_devtools_shared4 = require("@vue/devtools-shared");
1990
1892
  var import_vue = require("vue");
@@ -2026,21 +1928,21 @@ async function getComponentId(options) {
2026
1928
  }
2027
1929
  }
2028
1930
  function isFragment(instance) {
2029
- var _a9;
2030
- const subTreeType = (_a9 = instance.subTree) == null ? void 0 : _a9.type;
1931
+ var _a10;
1932
+ const subTreeType = (_a10 = instance.subTree) == null ? void 0 : _a10.type;
2031
1933
  return subTreeType === import_vue.Fragment;
2032
1934
  }
2033
1935
  function isBeingDestroyed(instance) {
2034
1936
  return instance._isBeingDestroyed || instance.isUnmounted;
2035
1937
  }
2036
1938
  function getInstanceName(instance) {
2037
- var _a9, _b9, _c;
1939
+ var _a10, _b10, _c;
2038
1940
  const name = getComponentTypeName(instance.type || {});
2039
1941
  if (name)
2040
1942
  return name;
2041
1943
  if (instance.root === instance)
2042
1944
  return "Root";
2043
- for (const key in (_b9 = (_a9 = instance.parent) == null ? void 0 : _a9.type) == null ? void 0 : _b9.components) {
1945
+ for (const key in (_b10 = (_a10 = instance.parent) == null ? void 0 : _a10.type) == null ? void 0 : _b10.components) {
2044
1946
  if (instance.parent.type.components[key] === instance.type)
2045
1947
  return saveComponentGussedName(instance, key);
2046
1948
  }
@@ -2054,8 +1956,8 @@ function getInstanceName(instance) {
2054
1956
  return "Anonymous Component";
2055
1957
  }
2056
1958
  function getUniqueComponentId(instance) {
2057
- var _a9, _b9, _c;
2058
- const appId = (_c = (_b9 = (_a9 = instance == null ? void 0 : instance.appContext) == null ? void 0 : _a9.app) == null ? void 0 : _b9.__VUE_DEVTOOLS_APP_RECORD_ID__) != null ? _c : 0;
1959
+ var _a10, _b10, _c;
1960
+ const appId = (_c = (_b10 = (_a10 = instance == null ? void 0 : instance.appContext) == null ? void 0 : _a10.app) == null ? void 0 : _b10.__VUE_DEVTOOLS_APP_RECORD_ID__) != null ? _c : 0;
2059
1961
  const instanceId = instance === instance.root ? "root" : instance.uid;
2060
1962
  return `${appId}:${instanceId}`;
2061
1963
  }
@@ -2084,990 +1986,430 @@ function getComponentInstance(appRecord, instanceId) {
2084
1986
  return instance || appRecord.instanceMap.get(":root");
2085
1987
  }
2086
1988
 
2087
- // src/core/component/state/process.ts
2088
- init_cjs_shims();
2089
- var import_devtools_shared5 = require("@vue/devtools-shared");
2090
-
2091
- // src/core/component/state/util.ts
2092
- init_cjs_shims();
2093
-
2094
- // src/core/component/state/is.ts
1989
+ // src/core/component/state/bounding-rect.ts
2095
1990
  init_cjs_shims();
2096
- function isVueInstance(value) {
2097
- return value._ && Object.keys(value._).includes("vnode");
2098
- }
2099
- function isPlainObject(obj) {
2100
- return Object.prototype.toString.call(obj) === "[object Object]";
2101
- }
2102
- function isPrimitive(data) {
2103
- if (data == null)
2104
- return true;
2105
- const type = typeof data;
2106
- return type === "string" || type === "number" || type === "boolean";
2107
- }
2108
- function isRef(raw) {
2109
- return !!raw.__v_isRef;
1991
+ function createRect() {
1992
+ const rect = {
1993
+ top: 0,
1994
+ bottom: 0,
1995
+ left: 0,
1996
+ right: 0,
1997
+ get width() {
1998
+ return rect.right - rect.left;
1999
+ },
2000
+ get height() {
2001
+ return rect.bottom - rect.top;
2002
+ }
2003
+ };
2004
+ return rect;
2110
2005
  }
2111
- function isComputed(raw) {
2112
- return isRef(raw) && !!raw.effect;
2006
+ var range;
2007
+ function getTextRect(node) {
2008
+ if (!range)
2009
+ range = document.createRange();
2010
+ range.selectNode(node);
2011
+ return range.getBoundingClientRect();
2113
2012
  }
2114
- function isReactive(raw) {
2115
- return !!raw.__v_isReactive;
2013
+ function getFragmentRect(vnode) {
2014
+ const rect = createRect();
2015
+ if (!vnode.children)
2016
+ return rect;
2017
+ for (let i = 0, l = vnode.children.length; i < l; i++) {
2018
+ const childVnode = vnode.children[i];
2019
+ let childRect;
2020
+ if (childVnode.component) {
2021
+ childRect = getComponentBoundingRect(childVnode.component);
2022
+ } else if (childVnode.el) {
2023
+ const el = childVnode.el;
2024
+ if (el.nodeType === 1 || el.getBoundingClientRect)
2025
+ childRect = el.getBoundingClientRect();
2026
+ else if (el.nodeType === 3 && el.data.trim())
2027
+ childRect = getTextRect(el);
2028
+ }
2029
+ if (childRect)
2030
+ mergeRects(rect, childRect);
2031
+ }
2032
+ return rect;
2116
2033
  }
2117
- function isReadOnly(raw) {
2118
- return !!raw.__v_isReadonly;
2034
+ function mergeRects(a, b) {
2035
+ if (!a.top || b.top < a.top)
2036
+ a.top = b.top;
2037
+ if (!a.bottom || b.bottom > a.bottom)
2038
+ a.bottom = b.bottom;
2039
+ if (!a.left || b.left < a.left)
2040
+ a.left = b.left;
2041
+ if (!a.right || b.right > a.right)
2042
+ a.right = b.right;
2043
+ return a;
2119
2044
  }
2120
-
2121
- // src/core/component/state/util.ts
2122
- var tokenMap = {
2123
- [UNDEFINED]: "undefined",
2124
- [NAN]: "NaN",
2125
- [INFINITY]: "Infinity",
2126
- [NEGATIVE_INFINITY]: "-Infinity"
2045
+ var DEFAULT_RECT = {
2046
+ top: 0,
2047
+ left: 0,
2048
+ right: 0,
2049
+ bottom: 0,
2050
+ width: 0,
2051
+ height: 0
2127
2052
  };
2128
- var reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
2129
- acc[value] = key;
2130
- return acc;
2131
- }, {});
2132
- function internalStateTokenToString(value) {
2133
- if (value === null)
2134
- return "null";
2135
- return typeof value === "string" && tokenMap[value] || false;
2136
- }
2137
- function replaceTokenToString(value) {
2138
- const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
2139
- return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
2140
- }
2141
- function replaceStringToToken(value) {
2142
- const literalValue = reversedTokenMap[value.trim()];
2143
- if (literalValue)
2144
- return `"${literalValue}"`;
2145
- const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
2146
- return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
2147
- }
2148
- function getPropType(type) {
2149
- if (Array.isArray(type))
2150
- return type.map((t) => getPropType(t)).join(" or ");
2151
- if (type == null)
2152
- return "null";
2153
- const match = type.toString().match(fnTypeRE);
2154
- return typeof type === "function" ? match && match[1] || "any" : "any";
2155
- }
2156
- function sanitize(data) {
2157
- if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2158
- return Object.prototype.toString.call(data);
2159
- } else {
2160
- return data;
2053
+ function getComponentBoundingRect(instance) {
2054
+ const el = instance.subTree.el;
2055
+ if (typeof window === "undefined") {
2056
+ return DEFAULT_RECT;
2161
2057
  }
2058
+ if (isFragment(instance))
2059
+ return getFragmentRect(instance.subTree);
2060
+ else if ((el == null ? void 0 : el.nodeType) === 1)
2061
+ return el == null ? void 0 : el.getBoundingClientRect();
2062
+ else if (instance.subTree.component)
2063
+ return getComponentBoundingRect(instance.subTree.component);
2064
+ else
2065
+ return DEFAULT_RECT;
2162
2066
  }
2163
- function getSetupStateType(raw) {
2164
- return {
2165
- ref: isRef(raw),
2166
- computed: isComputed(raw),
2167
- reactive: isReactive(raw),
2168
- readonly: isReadOnly(raw)
2169
- };
2170
- }
2171
- function toRaw(value) {
2172
- if (value == null ? void 0 : value.__v_raw)
2173
- return value.__v_raw;
2174
- return value;
2067
+
2068
+ // src/core/component/tree/walker.ts
2069
+ init_cjs_shims();
2070
+
2071
+ // src/core/component/tree/el.ts
2072
+ init_cjs_shims();
2073
+ function getRootElementsFromComponentInstance(instance) {
2074
+ if (isFragment(instance))
2075
+ return getFragmentRootElements(instance.subTree);
2076
+ if (!instance.subTree)
2077
+ return [];
2078
+ return [instance.subTree.el];
2175
2079
  }
2176
- function escape(s) {
2177
- return s.replace(/[<>"&]/g, (s2) => {
2178
- return ESC[s2] || s2;
2080
+ function getFragmentRootElements(vnode) {
2081
+ if (!vnode.children)
2082
+ return [];
2083
+ const list = [];
2084
+ vnode.children.forEach((childVnode) => {
2085
+ if (childVnode.component)
2086
+ list.push(...getRootElementsFromComponentInstance(childVnode.component));
2087
+ else if (childVnode == null ? void 0 : childVnode.el)
2088
+ list.push(childVnode.el);
2179
2089
  });
2090
+ return list;
2180
2091
  }
2181
2092
 
2182
- // src/core/component/state/process.ts
2183
- function mergeOptions(to, from, instance) {
2184
- if (typeof from === "function")
2185
- from = from.options;
2186
- if (!from)
2187
- return to;
2188
- const { mixins, extends: extendsOptions } = from;
2189
- extendsOptions && mergeOptions(to, extendsOptions, instance);
2190
- mixins && mixins.forEach(
2191
- (m) => mergeOptions(to, m, instance)
2192
- );
2193
- for (const key of ["computed", "inject"]) {
2194
- if (Object.prototype.hasOwnProperty.call(from, key)) {
2195
- if (!to[key])
2196
- to[key] = from[key];
2197
- else
2198
- Object.assign(to[key], from[key]);
2199
- }
2093
+ // src/core/component/tree/filter.ts
2094
+ init_cjs_shims();
2095
+ var import_devtools_shared5 = require("@vue/devtools-shared");
2096
+ var ComponentFilter = class {
2097
+ constructor(filter) {
2098
+ this.filter = filter || "";
2200
2099
  }
2201
- return to;
2202
- }
2203
- function resolveMergedOptions(instance) {
2204
- const raw = instance.type;
2205
- const { mixins, extends: extendsOptions } = raw;
2206
- const globalMixins = instance.appContext.mixins;
2207
- if (!globalMixins.length && !mixins && !extendsOptions)
2208
- return raw;
2209
- const options = {};
2210
- globalMixins.forEach((m) => mergeOptions(options, m, instance));
2211
- mergeOptions(options, raw, instance);
2212
- return options;
2213
- }
2214
- function processProps(instance) {
2215
- const props = [];
2216
- const propDefinitions = instance.type.props;
2217
- for (const key in instance.props) {
2218
- const propDefinition = propDefinitions ? propDefinitions[key] : null;
2219
- const camelizeKey = (0, import_devtools_shared5.camelize)(key);
2220
- props.push({
2221
- type: "props",
2222
- key: camelizeKey,
2223
- value: returnError(() => instance.props[key]),
2224
- meta: propDefinition ? {
2225
- type: propDefinition.type ? getPropType(propDefinition.type) : "any",
2226
- required: !!propDefinition.required,
2227
- ...propDefinition.default ? {
2228
- default: propDefinition.default.toString()
2229
- } : {}
2230
- } : { type: "invalid" }
2231
- });
2100
+ /**
2101
+ * Check if an instance is qualified.
2102
+ *
2103
+ * @param {Vue|Vnode} instance
2104
+ * @return {boolean}
2105
+ */
2106
+ isQualified(instance) {
2107
+ const name = getInstanceName(instance);
2108
+ return (0, import_devtools_shared5.classify)(name).toLowerCase().includes(this.filter) || (0, import_devtools_shared5.kebabize)(name).toLowerCase().includes(this.filter);
2232
2109
  }
2233
- return props;
2234
- }
2235
- function processState(instance) {
2236
- const type = instance.type;
2237
- const props = type.props;
2238
- const getters = type.vuex && type.vuex.getters;
2239
- const computedDefs = type.computed;
2240
- const data = {
2241
- ...instance.data,
2242
- ...instance.renderContext
2243
- };
2244
- return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
2245
- key,
2246
- type: "data",
2247
- value: returnError(() => data[key]),
2248
- editable: true
2249
- }));
2250
- }
2251
- function getStateTypeAndName(info) {
2252
- const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
2253
- const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
2254
- return {
2255
- stateType,
2256
- stateTypeName
2257
- };
2110
+ };
2111
+ function createComponentFilter(filterText) {
2112
+ return new ComponentFilter(filterText);
2258
2113
  }
2259
- function processSetupState(instance) {
2260
- const raw = instance.devtoolsRawSetupState || {};
2261
- return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
2262
- var _a9, _b9, _c, _d;
2263
- const value = returnError(() => toRaw(instance.setupState[key]));
2264
- const rawData = raw[key];
2265
- let result;
2266
- let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function";
2267
- if (rawData) {
2268
- const info = getSetupStateType(rawData);
2269
- const { stateType, stateTypeName } = getStateTypeAndName(info);
2270
- const isState = info.ref || info.computed || info.reactive;
2271
- const raw2 = ((_b9 = (_a9 = rawData.effect) == null ? void 0 : _a9.raw) == null ? void 0 : _b9.toString()) || ((_d = (_c = rawData.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
2272
- if (stateType)
2273
- isOtherType = false;
2274
- result = {
2275
- ...stateType ? { stateType, stateTypeName } : {},
2276
- ...raw2 ? { raw: raw2 } : {},
2277
- editable: isState && !info.readonly
2278
- };
2279
- }
2280
- const type = isOtherType ? "setup (other)" : "setup";
2281
- return {
2282
- key,
2283
- value,
2284
- type,
2285
- // @ts-expect-error ignore
2286
- ...result
2287
- };
2288
- });
2289
- }
2290
- function processComputed(instance, mergedType) {
2291
- const type = mergedType;
2292
- const computed = [];
2293
- const defs = type.computed || {};
2294
- for (const key in defs) {
2295
- const def = defs[key];
2296
- const type2 = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
2297
- computed.push({
2298
- type: type2,
2299
- key,
2300
- value: returnError(() => {
2301
- var _a9;
2302
- return (_a9 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a9[key];
2303
- }),
2304
- editable: typeof def.set === "function"
2305
- });
2114
+
2115
+ // src/core/component/tree/walker.ts
2116
+ var ComponentWalker = class {
2117
+ constructor(options) {
2118
+ // Dedupe instances (Some instances may be both on a component and on a child abstract/functional component)
2119
+ this.captureIds = /* @__PURE__ */ new Map();
2120
+ const { filterText = "", maxDepth, recursively } = options;
2121
+ this.componentFilter = createComponentFilter(filterText);
2122
+ this.maxDepth = maxDepth;
2123
+ this.recursively = recursively;
2306
2124
  }
2307
- return computed;
2308
- }
2309
- function processAttrs(instance) {
2310
- return Object.keys(instance.attrs).map((key) => ({
2311
- type: "attrs",
2312
- key,
2313
- value: returnError(() => instance.attrs[key])
2314
- }));
2315
- }
2316
- function processProvide(instance) {
2317
- return Reflect.ownKeys(instance.provides).map((key) => ({
2318
- type: "provided",
2319
- key: key.toString(),
2320
- value: returnError(() => instance.provides[key])
2321
- }));
2322
- }
2323
- function processInject(instance, mergedType) {
2324
- if (!(mergedType == null ? void 0 : mergedType.inject))
2325
- return [];
2326
- let keys = [];
2327
- let defaultValue;
2328
- if (Array.isArray(mergedType.inject)) {
2329
- keys = mergedType.inject.map((key) => ({
2330
- key,
2331
- originalKey: key
2332
- }));
2333
- } else {
2334
- keys = Reflect.ownKeys(mergedType.inject).map((key) => {
2335
- const value = mergedType.inject[key];
2336
- let originalKey;
2337
- if (typeof value === "string" || typeof value === "symbol") {
2338
- originalKey = value;
2339
- } else {
2340
- originalKey = value.from;
2341
- defaultValue = value.default;
2342
- }
2343
- return {
2344
- key,
2345
- originalKey
2346
- };
2347
- });
2125
+ getComponentTree(instance) {
2126
+ this.captureIds = /* @__PURE__ */ new Map();
2127
+ return this.findQualifiedChildren(instance, 0);
2348
2128
  }
2349
- return keys.map(({ key, originalKey }) => ({
2350
- type: "injected",
2351
- key: originalKey && key !== originalKey ? `${originalKey.toString()} \u279E ${key.toString()}` : key.toString(),
2352
- // eslint-disable-next-line no-prototype-builtins
2353
- value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
2354
- }));
2355
- }
2356
- function processRefs(instance) {
2357
- return Object.keys(instance.refs).map((key) => ({
2358
- type: "refs",
2359
- key,
2360
- value: returnError(() => instance.refs[key])
2361
- }));
2362
- }
2363
- function processEventListeners(instance) {
2364
- var _a9;
2365
- const emitsDefinition = instance.type.emits;
2366
- const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition != null ? emitsDefinition : {});
2367
- const keys = Object.keys((_a9 = instance.vnode.props) != null ? _a9 : {});
2368
- const result = [];
2369
- for (const key of keys) {
2370
- const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
2371
- if (prefix === "on") {
2372
- const eventName = eventNameParts.join("-").toLowerCase();
2373
- const isDeclared = declaredEmits.includes(eventName);
2374
- result.push({
2375
- type: "event listeners",
2376
- key: eventName,
2377
- value: {
2378
- _custom: {
2379
- displayText: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2380
- key: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2381
- value: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2382
- tooltipText: !isDeclared ? `The event <code>${eventName}</code> is not declared in the <code>emits</code> option. It will leak into the component's attributes (<code>$attrs</code>).` : null
2383
- }
2384
- }
2385
- });
2129
+ getComponentParents(instance) {
2130
+ this.captureIds = /* @__PURE__ */ new Map();
2131
+ const parents = [];
2132
+ this.captureId(instance);
2133
+ let parent = instance;
2134
+ while (parent = parent.parent) {
2135
+ this.captureId(parent);
2136
+ parents.push(parent);
2386
2137
  }
2138
+ return parents;
2387
2139
  }
2388
- return result;
2389
- }
2390
- function processInstanceState(instance) {
2391
- const mergedType = resolveMergedOptions(instance);
2392
- return processProps(instance).concat(
2393
- processState(instance),
2394
- processSetupState(instance),
2395
- processComputed(instance, mergedType),
2396
- processAttrs(instance),
2397
- processProvide(instance),
2398
- processInject(instance, mergedType),
2399
- processRefs(instance),
2400
- processEventListeners(instance)
2401
- );
2402
- }
2403
-
2404
- // src/core/component/state/custom.ts
2405
- function getFunctionDetails(func) {
2406
- let string = "";
2407
- let matches = null;
2408
- try {
2409
- string = Function.prototype.toString.call(func);
2410
- matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
2411
- } catch (e) {
2140
+ captureId(instance) {
2141
+ if (!instance)
2142
+ return null;
2143
+ const id = instance.__VUE_DEVTOOLS_UID__ != null ? instance.__VUE_DEVTOOLS_UID__ : getUniqueComponentId(instance);
2144
+ instance.__VUE_DEVTOOLS_UID__ = id;
2145
+ if (this.captureIds.has(id))
2146
+ return null;
2147
+ else
2148
+ this.captureIds.set(id, void 0);
2149
+ this.mark(instance);
2150
+ return id;
2412
2151
  }
2413
- const match = matches && matches[0];
2414
- const args = typeof match === "string" ? match : "(?)";
2415
- const name = typeof func.name === "string" ? func.name : "";
2416
- return {
2417
- _custom: {
2418
- type: "function",
2419
- displayText: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
2420
- tooltipText: string.trim() ? `<pre>${string}</pre>` : null
2421
- }
2422
- };
2423
- }
2424
- function getBigIntDetails(val) {
2425
- const stringifiedBigInt = BigInt.prototype.toString.call(val);
2426
- return {
2427
- _custom: {
2428
- type: "bigint",
2429
- displayText: `BigInt(${stringifiedBigInt})`,
2430
- value: stringifiedBigInt
2152
+ /**
2153
+ * Capture the meta information of an instance. (recursive)
2154
+ *
2155
+ * @param {Vue} instance
2156
+ * @return {object}
2157
+ */
2158
+ async capture(instance, depth) {
2159
+ var _a10;
2160
+ if (!instance)
2161
+ return null;
2162
+ const id = this.captureId(instance);
2163
+ const name = getInstanceName(instance);
2164
+ const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
2165
+ const parents = this.getComponentParents(instance) || [];
2166
+ const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
2167
+ const treeNode = {
2168
+ uid: instance.uid,
2169
+ id,
2170
+ name,
2171
+ renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
2172
+ inactive,
2173
+ children: [],
2174
+ isFragment: isFragment(instance),
2175
+ tags: typeof instance.type !== "function" ? [] : [
2176
+ {
2177
+ label: "functional",
2178
+ textColor: 5592405,
2179
+ backgroundColor: 15658734
2180
+ }
2181
+ ],
2182
+ autoOpen: this.recursively,
2183
+ file: instance.type.__file || ""
2184
+ };
2185
+ if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) {
2186
+ treeNode.children = await Promise.all(children.map((child) => this.capture(child, depth + 1)).filter(Boolean));
2431
2187
  }
2432
- };
2433
- }
2434
- function getMapDetails(val) {
2435
- const list = [];
2436
- val.forEach(
2437
- (value, key) => list.push({
2438
- key,
2439
- value
2440
- })
2441
- );
2442
- return {
2443
- _custom: {
2444
- type: "map",
2445
- displayText: "Map",
2446
- value: list,
2447
- readOnly: true,
2448
- fields: {
2449
- abstract: true
2188
+ if (this.isKeepAlive(instance)) {
2189
+ const cachedComponents = this.getKeepAliveCachedInstances(instance);
2190
+ const childrenIds = children.map((child) => child.__VUE_DEVTOOLS_UID__);
2191
+ for (const cachedChild of cachedComponents) {
2192
+ if (!childrenIds.includes(cachedChild.__VUE_DEVTOOLS_UID__)) {
2193
+ const node = await this.capture({ ...cachedChild, isDeactivated: true }, depth + 1);
2194
+ if (node)
2195
+ treeNode.children.push(node);
2196
+ }
2450
2197
  }
2451
2198
  }
2452
- };
2453
- }
2454
- function getSetDetails(val) {
2455
- const list = Array.from(val);
2456
- return {
2457
- _custom: {
2458
- type: "set",
2459
- displayText: `Set[${list.length}]`,
2460
- value: list,
2461
- readOnly: true
2462
- }
2463
- };
2464
- }
2465
- function getCatchedGetters(store) {
2466
- const getters = {};
2467
- const origGetters = store.getters || {};
2468
- const keys = Object.keys(origGetters);
2469
- for (let i = 0; i < keys.length; i++) {
2470
- const key = keys[i];
2471
- Object.defineProperty(getters, key, {
2472
- enumerable: true,
2473
- get: () => {
2474
- try {
2475
- return origGetters[key];
2476
- } catch (e) {
2477
- return e;
2478
- }
2479
- }
2199
+ const rootElements = getRootElementsFromComponentInstance(instance);
2200
+ const firstElement = rootElements[0];
2201
+ if (firstElement == null ? void 0 : firstElement.parentElement) {
2202
+ const parentInstance = instance.parent;
2203
+ const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
2204
+ let el = firstElement;
2205
+ const indexList = [];
2206
+ do {
2207
+ indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
2208
+ el = el.parentElement;
2209
+ } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
2210
+ treeNode.domOrder = indexList.reverse();
2211
+ } else {
2212
+ treeNode.domOrder = [-1];
2213
+ }
2214
+ if ((_a10 = instance.suspense) == null ? void 0 : _a10.suspenseKey) {
2215
+ treeNode.tags.push({
2216
+ label: instance.suspense.suspenseKey,
2217
+ backgroundColor: 14979812,
2218
+ textColor: 16777215
2219
+ });
2220
+ this.mark(instance, true);
2221
+ }
2222
+ devtoolsContext.api.visitComponentTree({
2223
+ treeNode,
2224
+ componentInstance: instance,
2225
+ app: instance.appContext.app,
2226
+ filter: this.componentFilter.filter
2480
2227
  });
2228
+ return treeNode;
2481
2229
  }
2482
- return getters;
2483
- }
2484
- function reduceStateList(list) {
2485
- if (!list.length)
2486
- return void 0;
2487
- return list.reduce((map, item) => {
2488
- const key = item.type || "data";
2489
- const obj = map[key] = map[key] || {};
2490
- obj[item.key] = item.value;
2491
- return map;
2492
- }, {});
2493
- }
2494
- function namedNodeMapToObject(map) {
2495
- const result = {};
2496
- const l = map.length;
2497
- for (let i = 0; i < l; i++) {
2498
- const node = map.item(i);
2499
- result[node.name] = node.value;
2500
- }
2501
- return result;
2502
- }
2503
- function getStoreDetails(store) {
2504
- return {
2505
- _custom: {
2506
- type: "store",
2507
- displayText: "Store",
2508
- value: {
2509
- state: store.state,
2510
- getters: getCatchedGetters(store)
2511
- },
2512
- fields: {
2513
- abstract: true
2514
- }
2515
- }
2516
- };
2517
- }
2518
- function getRouterDetails(router) {
2519
- return {
2520
- _custom: {
2521
- type: "router",
2522
- displayText: "VueRouter",
2523
- value: {
2524
- options: router.options,
2525
- currentRoute: router.currentRoute
2526
- },
2527
- fields: {
2528
- abstract: true
2529
- }
2230
+ /**
2231
+ * Find qualified children from a single instance.
2232
+ * If the instance itself is qualified, just return itself.
2233
+ * This is ok because [].concat works in both cases.
2234
+ *
2235
+ * @param {Vue|Vnode} instance
2236
+ * @return {Vue|Array}
2237
+ */
2238
+ async findQualifiedChildren(instance, depth) {
2239
+ var _a10;
2240
+ if (this.componentFilter.isQualified(instance) && !((_a10 = instance.type.devtools) == null ? void 0 : _a10.hide)) {
2241
+ return [await this.capture(instance, depth)];
2242
+ } else if (instance.subTree) {
2243
+ const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
2244
+ return this.findQualifiedChildrenFromList(list, depth);
2245
+ } else {
2246
+ return [];
2530
2247
  }
2531
- };
2532
- }
2533
- function getInstanceDetails(instance) {
2534
- if (instance._)
2535
- instance = instance._;
2536
- const state = processInstanceState(instance);
2537
- return {
2538
- _custom: {
2539
- type: "component",
2540
- id: instance.__VUE_DEVTOOLS_UID__,
2541
- displayText: getInstanceName(instance),
2542
- tooltipText: "Component instance",
2543
- value: reduceStateList(state),
2544
- fields: {
2545
- abstract: true
2248
+ }
2249
+ /**
2250
+ * Iterate through an array of instances and flatten it into
2251
+ * an array of qualified instances. This is a depth-first
2252
+ * traversal - e.g. if an instance is not matched, we will
2253
+ * recursively go deeper until a qualified child is found.
2254
+ *
2255
+ * @param {Array} instances
2256
+ * @return {Array}
2257
+ */
2258
+ async findQualifiedChildrenFromList(instances, depth) {
2259
+ instances = instances.filter((child) => {
2260
+ var _a10;
2261
+ return !isBeingDestroyed(child) && !((_a10 = child.type.devtools) == null ? void 0 : _a10.hide);
2262
+ });
2263
+ if (!this.componentFilter.filter)
2264
+ return Promise.all(instances.map((child) => this.capture(child, depth)));
2265
+ else
2266
+ return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
2267
+ }
2268
+ /**
2269
+ * Get children from a component instance.
2270
+ */
2271
+ getInternalInstanceChildren(subTree, suspense = null) {
2272
+ const list = [];
2273
+ if (subTree) {
2274
+ if (subTree.component) {
2275
+ !suspense ? list.push(subTree.component) : list.push({ ...subTree.component, suspense });
2276
+ } else if (subTree.suspense) {
2277
+ const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
2278
+ list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, { ...subTree.suspense, suspenseKey }));
2279
+ } else if (Array.isArray(subTree.children)) {
2280
+ subTree.children.forEach((childSubTree) => {
2281
+ if (childSubTree.component)
2282
+ !suspense ? list.push(childSubTree.component) : list.push({ ...childSubTree.component, suspense });
2283
+ else
2284
+ list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
2285
+ });
2546
2286
  }
2547
2287
  }
2548
- };
2549
- }
2550
- function getComponentDefinitionDetails(definition) {
2551
- let display = getComponentName(definition);
2552
- if (display) {
2553
- if (definition.name && definition.__file)
2554
- display += ` <span>(${definition.__file})</span>`;
2555
- } else {
2556
- display = "<i>Unknown Component</i>";
2288
+ return list.filter((child) => {
2289
+ var _a10;
2290
+ return !isBeingDestroyed(child) && !((_a10 = child.type.devtools) == null ? void 0 : _a10.hide);
2291
+ });
2557
2292
  }
2558
- return {
2559
- _custom: {
2560
- type: "component-definition",
2561
- displayText: display,
2562
- tooltipText: "Component definition",
2563
- ...definition.__file ? {
2564
- file: definition.__file
2565
- } : {}
2566
- }
2567
- };
2568
- }
2569
- function getHTMLElementDetails(value) {
2570
- try {
2571
- return {
2572
- _custom: {
2573
- type: "HTMLElement",
2574
- displayText: `<span class="opacity-30">&lt;</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">&gt;</span>`,
2575
- value: namedNodeMapToObject(value.attributes)
2576
- }
2577
- };
2578
- } catch (e) {
2579
- return {
2580
- _custom: {
2581
- type: "HTMLElement",
2582
- displayText: `<span class="text-blue-500">${String(value)}</span>`
2583
- }
2584
- };
2293
+ /**
2294
+ * Mark an instance as captured and store it in the instance map.
2295
+ *
2296
+ * @param {Vue} instance
2297
+ */
2298
+ mark(instance, force = false) {
2299
+ const instanceMap = getAppRecord(instance).instanceMap;
2300
+ if (force || !instanceMap.has(instance.__VUE_DEVTOOLS_UID__))
2301
+ instanceMap.set(instance.__VUE_DEVTOOLS_UID__, instance);
2585
2302
  }
2586
- }
2587
- function getObjectDetails(object) {
2588
- var _a9, _b9, _c, _d;
2589
- const info = getSetupStateType(object);
2590
- const isState = info.ref || info.computed || info.reactive;
2591
- if (isState) {
2592
- const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
2593
- const value = toRaw(info.reactive ? object : object._value);
2594
- const raw = ((_b9 = (_a9 = object.effect) == null ? void 0 : _a9.raw) == null ? void 0 : _b9.toString()) || ((_d = (_c = object.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
2595
- return {
2596
- _custom: {
2597
- type: stateTypeName == null ? void 0 : stateTypeName.toLowerCase(),
2598
- stateTypeName,
2599
- value,
2600
- ...raw ? { tooltipText: `<span class="font-mono">${raw}</span>` } : {}
2601
- }
2602
- };
2303
+ isKeepAlive(instance) {
2304
+ return instance.type.__isKeepAlive && instance.__v_cache;
2603
2305
  }
2604
- if (typeof object.__asyncLoader === "function") {
2605
- return {
2606
- _custom: {
2607
- type: "component-definition",
2608
- display: "Async component definition"
2609
- }
2610
- };
2306
+ getKeepAliveCachedInstances(instance) {
2307
+ return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
2611
2308
  }
2612
- }
2309
+ };
2613
2310
 
2614
- // src/core/component/state/replacer.ts
2615
- function stringifyReplacer(key) {
2616
- var _a9;
2617
- if (key === "compilerOptions")
2618
- return;
2619
- const val = this[key];
2620
- const type = typeof val;
2621
- if (Array.isArray(val)) {
2622
- const l = val.length;
2623
- if (l > MAX_ARRAY_SIZE) {
2624
- return {
2625
- _isArray: true,
2626
- length: l,
2627
- items: val.slice(0, MAX_ARRAY_SIZE)
2628
- };
2311
+ // src/core/component/state/editor.ts
2312
+ init_cjs_shims();
2313
+ var import_vue2 = require("vue");
2314
+ var StateEditor = class {
2315
+ constructor() {
2316
+ this.refEditor = new RefStateEditor();
2317
+ }
2318
+ set(object, path, value, cb) {
2319
+ const sections = Array.isArray(path) ? path : path.split(".");
2320
+ const markRef = false;
2321
+ while (sections.length > 1) {
2322
+ const section = sections.shift();
2323
+ if (object instanceof Map)
2324
+ object = object.get(section);
2325
+ else
2326
+ object = object[section];
2327
+ if (this.refEditor.isRef(object))
2328
+ object = this.refEditor.get(object);
2629
2329
  }
2630
- return val;
2631
- } else if (typeof val === "string") {
2632
- if (val.length > MAX_STRING_SIZE)
2633
- return `${val.substring(0, MAX_STRING_SIZE)}... (${val.length} total length)`;
2634
- else
2635
- return val;
2636
- } else if (type === "undefined") {
2637
- return UNDEFINED;
2638
- } else if (val === Number.POSITIVE_INFINITY) {
2639
- return INFINITY;
2640
- } else if (val === Number.NEGATIVE_INFINITY) {
2641
- return NEGATIVE_INFINITY;
2642
- } else if (typeof val === "function") {
2643
- return getFunctionDetails(val);
2644
- } else if (type === "symbol") {
2645
- return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
2646
- } else if (typeof val === "bigint") {
2647
- return getBigIntDetails(val);
2648
- } else if (val !== null && typeof val === "object") {
2649
- const proto = Object.prototype.toString.call(val);
2650
- if (proto === "[object Map]") {
2651
- return getMapDetails(val);
2652
- } else if (proto === "[object Set]") {
2653
- return getSetDetails(val);
2654
- } else if (proto === "[object RegExp]") {
2655
- return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
2656
- } else if (proto === "[object Date]") {
2657
- return `[native Date ${Date.prototype.toString.call(val)}]`;
2658
- } else if (proto === "[object Error]") {
2659
- return `[native Error ${val.message}<>${val.stack}]`;
2660
- } else if (val.state && val._vm) {
2661
- return getStoreDetails(val);
2662
- } else if (val.constructor && val.constructor.name === "VueRouter") {
2663
- return getRouterDetails(val);
2664
- } else if (isVueInstance(val)) {
2665
- return getInstanceDetails(val);
2666
- } else if (typeof val.render === "function") {
2667
- return getComponentDefinitionDetails(val);
2668
- } else if (val.constructor && val.constructor.name === "VNode") {
2669
- return `[native VNode <${val.tag}>]`;
2670
- } else if (typeof HTMLElement !== "undefined" && val instanceof HTMLElement) {
2671
- return getHTMLElementDetails(val);
2672
- } else if (((_a9 = val.constructor) == null ? void 0 : _a9.name) === "Store" && val._wrappedGetters) {
2673
- return "[object Store]";
2674
- } else if (val.currentRoute) {
2675
- return "[object Router]";
2330
+ const field = sections[0];
2331
+ const item = this.refEditor.get(object)[field];
2332
+ if (cb) {
2333
+ cb(object, field, value);
2334
+ } else {
2335
+ if (this.refEditor.isRef(item))
2336
+ this.refEditor.set(item, value);
2337
+ else if (markRef)
2338
+ object[field] = value;
2339
+ else
2340
+ object[field] = value;
2676
2341
  }
2677
- const customDetails = getObjectDetails(val);
2678
- if (customDetails != null)
2679
- return customDetails;
2680
- } else if (Number.isNaN(val)) {
2681
- return NAN;
2682
- }
2683
- return sanitize(val);
2684
- }
2685
-
2686
- // src/core/component/state/reviver.ts
2687
- init_cjs_shims();
2688
- var import_devtools_shared6 = require("@vue/devtools-shared");
2689
- function reviveSet(val) {
2690
- const result = /* @__PURE__ */ new Set();
2691
- const list = val._custom.value;
2692
- for (let i = 0; i < list.length; i++) {
2693
- const value = list[i];
2694
- result.add(revive(value));
2695
- }
2696
- return result;
2697
- }
2698
- function reviveMap(val) {
2699
- const result = /* @__PURE__ */ new Map();
2700
- const list = val._custom.value;
2701
- for (let i = 0; i < list.length; i++) {
2702
- const { key, value } = list[i];
2703
- result.set(key, revive(value));
2704
- }
2705
- return result;
2706
- }
2707
- function revive(val) {
2708
- var _a9;
2709
- if (val === UNDEFINED) {
2710
- return void 0;
2711
- } else if (val === INFINITY) {
2712
- return Number.POSITIVE_INFINITY;
2713
- } else if (val === NEGATIVE_INFINITY) {
2714
- return Number.NEGATIVE_INFINITY;
2715
- } else if (val === NAN) {
2716
- return Number.NaN;
2717
- } else if (val && val._custom) {
2718
- const { _custom: custom } = val;
2719
- if (custom.type === "component")
2720
- return (_a9 = devtoolsContext.appRecord) == null ? void 0 : _a9.instanceMap.get(custom.id);
2721
- else if (custom.type === "map")
2722
- return reviveMap(val);
2723
- else if (custom.type === "set")
2724
- return reviveSet(val);
2725
- else if (custom.type === "bigint")
2726
- return BigInt(custom.value);
2727
- else
2728
- return revive(custom.value);
2729
- } else if (symbolRE.test(val)) {
2730
- const [, string] = symbolRE.exec(val);
2731
- return Symbol.for(string);
2732
- } else if (specialTypeRE.test(val)) {
2733
- const [, type, string, , details] = specialTypeRE.exec(val);
2734
- const result = new import_devtools_shared6.target[type](string);
2735
- if (type === "Error" && details)
2736
- result.stack = details;
2737
- return result;
2738
- } else {
2739
- return val;
2740
2342
  }
2741
- }
2742
- function reviver(key, value) {
2743
- return revive(value);
2744
- }
2745
-
2746
- // src/shared/transfer.ts
2747
- init_cjs_shims();
2748
- var MAX_SERIALIZED_SIZE = 512 * 1024;
2749
- function encode(data, replacer, list, seen) {
2750
- let stored, key, value, i, l;
2751
- const seenIndex = seen.get(data);
2752
- if (seenIndex != null)
2753
- return seenIndex;
2754
- const index = list.length;
2755
- const proto = Object.prototype.toString.call(data);
2756
- if (proto === "[object Object]") {
2757
- stored = {};
2758
- seen.set(data, index);
2759
- list.push(stored);
2760
- const keys = Object.keys(data);
2761
- for (i = 0, l = keys.length; i < l; i++) {
2762
- key = keys[i];
2763
- try {
2764
- if (key === "compilerOptions")
2765
- return;
2766
- value = data[key];
2767
- if (replacer)
2768
- value = replacer.call(data, key, value);
2769
- } catch (e) {
2770
- value = e;
2771
- }
2772
- stored[key] = encode(value, replacer, list, seen);
2343
+ get(object, path) {
2344
+ const sections = Array.isArray(path) ? path : path.split(".");
2345
+ for (let i = 0; i < sections.length; i++) {
2346
+ if (object instanceof Map)
2347
+ object = object.get(sections[i]);
2348
+ else
2349
+ object = object[sections[i]];
2350
+ if (this.refEditor.isRef(object))
2351
+ object = this.refEditor.get(object);
2352
+ if (!object)
2353
+ return void 0;
2773
2354
  }
2774
- } else if (proto === "[object Array]") {
2775
- stored = [];
2776
- seen.set(data, index);
2777
- list.push(stored);
2778
- for (i = 0, l = data.length; i < l; i++) {
2779
- try {
2780
- value = data[i];
2781
- if (replacer)
2782
- value = replacer.call(data, i, value);
2783
- } catch (e) {
2784
- value = e;
2785
- }
2786
- stored[i] = encode(value, replacer, list, seen);
2355
+ return object;
2356
+ }
2357
+ has(object, path, parent = false) {
2358
+ if (typeof object === "undefined")
2359
+ return false;
2360
+ const sections = Array.isArray(path) ? path.slice() : path.split(".");
2361
+ const size = !parent ? 1 : 2;
2362
+ while (object && sections.length > size) {
2363
+ const section = sections.shift();
2364
+ object = object[section];
2365
+ if (this.refEditor.isRef(object))
2366
+ object = this.refEditor.get(object);
2787
2367
  }
2788
- } else {
2789
- list.push(data);
2368
+ return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
2790
2369
  }
2791
- return index;
2792
- }
2793
- function decode(list, reviver2 = null) {
2794
- let i = list.length;
2795
- let j, k, data, key, value, proto;
2796
- while (i--) {
2797
- data = list[i];
2798
- proto = Object.prototype.toString.call(data);
2799
- if (proto === "[object Object]") {
2800
- const keys = Object.keys(data);
2801
- for (j = 0, k = keys.length; j < k; j++) {
2802
- key = keys[j];
2803
- value = list[data[key]];
2804
- if (reviver2)
2805
- value = reviver2.call(data, key, value);
2806
- data[key] = value;
2370
+ createDefaultSetCallback(state) {
2371
+ return (object, field, value) => {
2372
+ if (state.remove || state.newKey) {
2373
+ if (Array.isArray(object))
2374
+ object.splice(field, 1);
2375
+ else if ((0, import_vue2.toRaw)(object) instanceof Map)
2376
+ object.delete(field);
2377
+ else if ((0, import_vue2.toRaw)(object) instanceof Set)
2378
+ object.delete(value);
2379
+ else
2380
+ Reflect.deleteProperty(object, field);
2807
2381
  }
2808
- } else if (proto === "[object Array]") {
2809
- for (j = 0, k = data.length; j < k; j++) {
2810
- value = list[data[j]];
2811
- if (reviver2)
2812
- value = reviver2.call(data, j, value);
2813
- data[j] = value;
2382
+ if (!state.remove) {
2383
+ const target9 = object[state.newKey || field];
2384
+ if (this.refEditor.isRef(target9))
2385
+ this.refEditor.set(target9, value);
2386
+ else if ((0, import_vue2.toRaw)(object) instanceof Map)
2387
+ object.set(state.newKey || field, value);
2388
+ else
2389
+ object[state.newKey || field] = value;
2814
2390
  }
2391
+ };
2392
+ }
2393
+ };
2394
+ var RefStateEditor = class {
2395
+ set(ref, value) {
2396
+ if ((0, import_vue2.isRef)(ref)) {
2397
+ ref.value = value;
2398
+ } else {
2399
+ const previousKeysSet = new Set(Object.keys(ref));
2400
+ const currentKeys = Object.keys(value);
2401
+ currentKeys.forEach((key) => {
2402
+ Reflect.set(ref, key, Reflect.get(value, key));
2403
+ previousKeysSet.delete(key);
2404
+ });
2405
+ previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
2815
2406
  }
2816
2407
  }
2817
- }
2818
- function stringifyCircularAutoChunks(data, replacer = null, space = null) {
2819
- let result;
2820
- try {
2821
- result = arguments.length === 1 ? JSON.stringify(data) : JSON.stringify(data, replacer, space);
2822
- } catch (e) {
2823
- result = stringifyStrictCircularAutoChunks(data, replacer, space);
2408
+ get(ref) {
2409
+ return (0, import_vue2.isRef)(ref) ? ref.value : ref;
2824
2410
  }
2825
- if (result.length > MAX_SERIALIZED_SIZE) {
2826
- const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
2827
- const chunks = [];
2828
- for (let i = 0; i < chunkCount; i++)
2829
- chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
2830
- return chunks;
2831
- }
2832
- return result;
2833
- }
2834
- function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
2835
- const list = [];
2836
- encode(data, replacer, list, /* @__PURE__ */ new Map());
2837
- return space ? ` ${JSON.stringify(list, null, space)}` : ` ${JSON.stringify(list)}`;
2838
- }
2839
- function parseCircularAutoChunks(data, reviver2 = null) {
2840
- if (Array.isArray(data))
2841
- data = data.join("");
2842
- const hasCircular = /^\s/.test(data);
2843
- if (!hasCircular) {
2844
- return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver2);
2845
- } else {
2846
- const list = JSON.parse(data);
2847
- decode(list, reviver2);
2848
- return list[0];
2849
- }
2850
- }
2851
-
2852
- // src/core/component/state/format.ts
2853
- init_cjs_shims();
2854
- function getInspectorStateValueType(value, raw = true) {
2855
- const type = typeof value;
2856
- if (value == null || value === UNDEFINED) {
2857
- return "null";
2858
- } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
2859
- return "literal";
2860
- } else if (value == null ? void 0 : value._custom) {
2861
- if (raw || value._custom.display != null || value._custom.displayText != null)
2862
- return "custom";
2863
- else
2864
- return getInspectorStateValueType(value._custom.value);
2865
- } else if (typeof value === "string") {
2866
- const typeMatch = specialTypeRE.exec(value);
2867
- if (typeMatch) {
2868
- const [, type2] = typeMatch;
2869
- return `native ${type2}`;
2870
- } else {
2871
- return "string";
2872
- }
2873
- } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
2874
- return "array";
2875
- } else if (isPlainObject(value)) {
2876
- return "plain-object";
2877
- } else {
2878
- return "unknown";
2879
- }
2880
- }
2881
- function formatInspectorStateValue(value, quotes = false) {
2882
- var _a9, _b9;
2883
- let result;
2884
- const type = getInspectorStateValueType(value, false);
2885
- if (type !== "custom" && (value == null ? void 0 : value._custom))
2886
- value = value._custom.value;
2887
- if (result = internalStateTokenToString(value)) {
2888
- return result;
2889
- } else if (type === "custom") {
2890
- const nestedName = ((_a9 = value._custom.value) == null ? void 0 : _a9._custom) && formatInspectorStateValue(value._custom.value);
2891
- return nestedName || value._custom.displayText || value._custom.display;
2892
- } else if (type === "array") {
2893
- return `Array[${value.length}]`;
2894
- } else if (type === "plain-object") {
2895
- return `Object${Object.keys(value).length ? "" : " (empty)"}`;
2896
- } else if (type == null ? void 0 : type.includes("native")) {
2897
- return escape((_b9 = specialTypeRE.exec(value)) == null ? void 0 : _b9[2]);
2898
- } else if (typeof value === "string") {
2899
- const typeMatch = value.match(rawTypeRE);
2900
- if (typeMatch)
2901
- value = escape(typeMatch[1]);
2902
- else if (quotes)
2903
- value = `<span>"</span>${escape(value)}<span>"</span>`;
2904
- else
2905
- value = escape(value);
2906
- value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
2907
- }
2908
- return value;
2909
- }
2910
- function getRawValue(value) {
2911
- var _a9, _b9;
2912
- const isCustom = getInspectorStateValueType(value) === "custom";
2913
- let inherit = {};
2914
- if (isCustom) {
2915
- const data = value;
2916
- const customValue = (_a9 = data._custom) == null ? void 0 : _a9.value;
2917
- const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRawValue(customValue) : { inherit: void 0, value: void 0 };
2918
- inherit = nestedCustom.inherit || ((_b9 = data._custom) == null ? void 0 : _b9.fields) || {};
2919
- value = nestedCustom.value || customValue;
2920
- }
2921
- if (value && value._isArray)
2922
- value = value.items;
2923
- return { value, inherit };
2924
- }
2925
- function toEdit(value) {
2926
- return replaceTokenToString(JSON.stringify(value));
2927
- }
2928
- function toSubmit(value) {
2929
- return JSON.parse(replaceStringToToken(value), reviver);
2930
- }
2931
-
2932
- // src/shared/util.ts
2933
- function stringify(data) {
2934
- return stringifyCircularAutoChunks(data, stringifyReplacer);
2935
- }
2936
- function parse(data, revive2 = false) {
2937
- if (data == void 0)
2938
- return {};
2939
- return revive2 ? parseCircularAutoChunks(data, reviver) : parseCircularAutoChunks(data);
2940
- }
2941
-
2942
- // src/shared/time.ts
2943
- init_cjs_shims();
2944
- function now() {
2945
- return Date.now();
2946
- }
2947
-
2948
- // src/shared/env.ts
2949
- init_cjs_shims();
2950
-
2951
- // src/core/general/inspector.ts
2952
- init_cjs_shims();
2953
- function addInspector(payload) {
2954
- devtoolsContext.inspector.push(payload);
2955
- }
2956
- function getInspector(inspectorId) {
2957
- return devtoolsContext.inspector.find((inspector) => inspector.id === inspectorId);
2958
- }
2959
- function updateInspector(inspectorId, payload) {
2960
- const inspector = getInspector(inspectorId);
2961
- inspector && Object.assign(inspector, payload);
2962
- }
2963
-
2964
- // src/core/timeline/index.ts
2965
- init_cjs_shims();
2966
- function addTimelineLayer(payload) {
2967
- devtoolsContext.timelineLayer.push(payload);
2968
- }
2969
-
2970
- // src/core/component/state/editor.ts
2971
- init_cjs_shims();
2972
- var import_vue2 = require("vue");
2973
-
2974
- // src/core/component/general/index.ts
2975
- init_cjs_shims();
2976
-
2977
- // src/core/component/state/editor.ts
2978
- var StateEditor = class {
2979
- constructor() {
2980
- this.refEditor = new RefStateEditor();
2981
- }
2982
- set(object, path, value, cb) {
2983
- const sections = Array.isArray(path) ? path : path.split(".");
2984
- const markRef = false;
2985
- while (sections.length > 1) {
2986
- const section = sections.shift();
2987
- object = object[section];
2988
- if (this.refEditor.isRef(object))
2989
- object = this.refEditor.get(object);
2990
- }
2991
- const field = sections[0];
2992
- const item = this.refEditor.get(object)[field];
2993
- if (cb) {
2994
- cb(object, field, value);
2995
- } else {
2996
- if (this.refEditor.isRef(item))
2997
- this.refEditor.set(item, value);
2998
- else if (markRef)
2999
- object[field] = value;
3000
- else
3001
- object[field] = value;
3002
- }
3003
- }
3004
- get(object, path) {
3005
- const sections = Array.isArray(path) ? path : path.split(".");
3006
- for (let i = 0; i < sections.length; i++) {
3007
- object = object[sections[i]];
3008
- if (this.refEditor.isRef(object))
3009
- object = this.refEditor.get(object);
3010
- if (!object)
3011
- return void 0;
3012
- }
3013
- return object;
3014
- }
3015
- has(object, path, parent = false) {
3016
- if (typeof object === "undefined")
3017
- return false;
3018
- const sections = Array.isArray(path) ? path.slice() : path.split(".");
3019
- const size = !parent ? 1 : 2;
3020
- while (object && sections.length > size) {
3021
- const section = sections.shift();
3022
- object = object[section];
3023
- if (this.refEditor.isRef(object))
3024
- object = this.refEditor.get(object);
3025
- }
3026
- return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
3027
- }
3028
- createDefaultSetCallback(state) {
3029
- return (object, field, value) => {
3030
- if (state.remove || state.newKey) {
3031
- if (Array.isArray(object))
3032
- object.splice(field, 1);
3033
- else if ((0, import_vue2.toRaw)(object) instanceof Map && typeof value === "object" && value && "key" in value)
3034
- object.delete(value.key);
3035
- else if ((0, import_vue2.toRaw)(object) instanceof Set)
3036
- object.delete(value);
3037
- else
3038
- Reflect.deleteProperty(object, field);
3039
- }
3040
- if (!state.remove) {
3041
- const target8 = object[state.newKey || field];
3042
- if (this.refEditor.isRef(target8))
3043
- this.refEditor.set(target8, value);
3044
- else
3045
- object[state.newKey || field] = value;
3046
- }
3047
- };
3048
- }
3049
- };
3050
- var RefStateEditor = class {
3051
- set(ref, value) {
3052
- if ((0, import_vue2.isRef)(ref)) {
3053
- ref.value = value;
3054
- } else {
3055
- const previousKeys = Object.keys(ref);
3056
- const currentKeys = Object.keys(value);
3057
- if (previousKeys.length > currentKeys.length) {
3058
- const diffKeys = previousKeys.filter((key) => !currentKeys.includes(key));
3059
- diffKeys.forEach((key) => Reflect.deleteProperty(ref, key));
3060
- }
3061
- currentKeys.forEach((key) => {
3062
- Reflect.set(ref, key, Reflect.get(value, key));
3063
- });
3064
- }
3065
- }
3066
- get(ref) {
3067
- return (0, import_vue2.isRef)(ref) ? ref.value : ref;
3068
- }
3069
- isRef(ref) {
3070
- return (0, import_vue2.isRef)(ref) || (0, import_vue2.isReactive)(ref);
2411
+ isRef(ref) {
2412
+ return (0, import_vue2.isRef)(ref) || (0, import_vue2.isReactive)(ref);
3071
2413
  }
3072
2414
  };
3073
2415
  async function editComponentState(payload, stateEditor2) {
@@ -3076,14 +2418,14 @@ async function editComponentState(payload, stateEditor2) {
3076
2418
  if (!instance)
3077
2419
  return;
3078
2420
  const targetPath = path.slice();
3079
- let target8;
2421
+ let target9;
3080
2422
  if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
3081
- target8 = instance.devtoolsRawSetupState;
2423
+ target9 = instance.devtoolsRawSetupState;
3082
2424
  }
3083
- if (target8 && targetPath) {
2425
+ if (target9 && targetPath) {
3084
2426
  if (state.type === "object" && type === "reactive") {
3085
2427
  }
3086
- stateEditor2.set(target8, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
2428
+ stateEditor2.set(target9, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
3087
2429
  }
3088
2430
  }
3089
2431
  var stateEditor = new StateEditor();
@@ -3091,469 +2433,418 @@ async function editState(payload) {
3091
2433
  editComponentState(payload, stateEditor);
3092
2434
  }
3093
2435
 
3094
- // src/core/open-in-editor/index.ts
3095
- init_cjs_shims();
3096
- var import_devtools_shared7 = require("@vue/devtools-shared");
3097
- function openInEditor(options = {}) {
3098
- const { file, line = 0, column = 0 } = options;
3099
- if (file) {
3100
- const baseUrl = window.location.origin;
3101
- if (import_devtools_shared7.target.__VUE_DEVTOOLS_VITE_PLUGIN_DETECTED__) {
3102
- import_devtools_shared7.target.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
3103
- } else {
3104
- }
3105
- }
3106
- }
3107
-
3108
- // src/core/general/app-record.ts
3109
- init_cjs_shims();
3110
-
3111
- // src/core/plugins/index.ts
2436
+ // src/core/component/state/index.ts
3112
2437
  init_cjs_shims();
3113
2438
 
3114
- // src/core/plugins/components.ts
2439
+ // src/core/component/state/process.ts
3115
2440
  init_cjs_shims();
3116
- var import_perfect_debounce3 = require("perfect-debounce");
2441
+ var import_devtools_shared6 = require("@vue/devtools-shared");
3117
2442
 
3118
- // src/api/plugin.ts
2443
+ // src/core/component/state/constants.ts
3119
2444
  init_cjs_shims();
3120
- var import_devtools_schema2 = require("@vue/devtools-schema");
3121
- function collectRegisteredPlugin(pluginDescriptor, setupFn) {
3122
- devtoolsState.pluginBuffer.push([pluginDescriptor, setupFn]);
3123
- }
3124
- async function registerPlugin(options) {
3125
- const { app, api } = options;
3126
- const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app);
3127
- plugins.forEach(async ([plugin, setupFn]) => {
3128
- if (plugin.packageName === "vue-query") {
3129
- return;
3130
- }
3131
- const appRecord = await getAppRecord(plugin.app);
3132
- if (plugin.packageName === "vue-router") {
3133
- const id = getRouterDevToolsId(`${plugin.id}`);
3134
- if (plugin.app === app) {
3135
- devtoolsState.appRecords = devtoolsState.appRecords.map((item) => ({
3136
- ...item,
3137
- routerId: id
3138
- }));
3139
- }
3140
- }
3141
- setupFn(api);
3142
- });
3143
- devtoolsState.appRecords = devtoolsState.appRecords.map((record) => {
3144
- var _a9, _b9;
3145
- const globalProperties = (_b9 = (_a9 = record.app) == null ? void 0 : _a9.config) == null ? void 0 : _b9.globalProperties;
3146
- if (!globalProperties)
3147
- return record;
3148
- return {
3149
- ...record,
3150
- moduleDetectives: {
3151
- vueRouter: !!globalProperties.$router,
3152
- pinia: !!globalProperties.$pinia,
3153
- vueI18n: !!globalProperties.$i18n
3154
- }
3155
- };
3156
- });
3157
- }
3158
- function setupDevToolsPlugin(pluginDescriptor, setupFn) {
3159
- return devtoolsHooks.callHook(import_devtools_schema2.DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
3160
- }
2445
+ var vueBuiltins = /* @__PURE__ */ new Set([
2446
+ "nextTick",
2447
+ "defineComponent",
2448
+ "defineAsyncComponent",
2449
+ "defineCustomElement",
2450
+ "ref",
2451
+ "computed",
2452
+ "reactive",
2453
+ "readonly",
2454
+ "watchEffect",
2455
+ "watchPostEffect",
2456
+ "watchSyncEffect",
2457
+ "watch",
2458
+ "isRef",
2459
+ "unref",
2460
+ "toRef",
2461
+ "toRefs",
2462
+ "isProxy",
2463
+ "isReactive",
2464
+ "isReadonly",
2465
+ "shallowRef",
2466
+ "triggerRef",
2467
+ "customRef",
2468
+ "shallowReactive",
2469
+ "shallowReadonly",
2470
+ "toRaw",
2471
+ "markRaw",
2472
+ "effectScope",
2473
+ "getCurrentScope",
2474
+ "onScopeDispose",
2475
+ "onMounted",
2476
+ "onUpdated",
2477
+ "onUnmounted",
2478
+ "onBeforeMount",
2479
+ "onBeforeUpdate",
2480
+ "onBeforeUnmount",
2481
+ "onErrorCaptured",
2482
+ "onRenderTracked",
2483
+ "onRenderTriggered",
2484
+ "onActivated",
2485
+ "onDeactivated",
2486
+ "onServerPrefetch",
2487
+ "provide",
2488
+ "inject",
2489
+ "h",
2490
+ "mergeProps",
2491
+ "cloneVNode",
2492
+ "isVNode",
2493
+ "resolveComponent",
2494
+ "resolveDirective",
2495
+ "withDirectives",
2496
+ "withModifiers"
2497
+ ]);
2498
+ var symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
2499
+ var rawTypeRE = /^\[object (\w+)]$/;
2500
+ var specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
2501
+ var fnTypeRE = /^(?:function|class) (\w+)/;
2502
+ var MAX_STRING_SIZE = 1e4;
2503
+ var MAX_ARRAY_SIZE = 5e3;
2504
+ var UNDEFINED = "__vue_devtool_undefined__";
2505
+ var INFINITY = "__vue_devtool_infinity__";
2506
+ var NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
2507
+ var NAN = "__vue_devtool_nan__";
2508
+ var ESC = {
2509
+ "<": "&lt;",
2510
+ ">": "&gt;",
2511
+ '"': "&quot;",
2512
+ "&": "&amp;"
2513
+ };
3161
2514
 
3162
- // src/core/component/tree/walker.ts
2515
+ // src/core/component/state/util.ts
3163
2516
  init_cjs_shims();
3164
2517
 
3165
- // src/core/component/tree/el.ts
2518
+ // src/core/component/state/is.ts
3166
2519
  init_cjs_shims();
3167
- function getRootElementsFromComponentInstance(instance) {
3168
- if (isFragment(instance))
3169
- return getFragmentRootElements(instance.subTree);
3170
- if (!instance.subTree)
3171
- return [];
3172
- return [instance.subTree.el];
2520
+ function isVueInstance(value) {
2521
+ return value._ && Object.keys(value._).includes("vnode");
3173
2522
  }
3174
- function getFragmentRootElements(vnode) {
3175
- if (!vnode.children)
3176
- return [];
3177
- const list = [];
3178
- vnode.children.forEach((childVnode) => {
3179
- if (childVnode.component)
3180
- list.push(...getRootElementsFromComponentInstance(childVnode.component));
3181
- else if (childVnode == null ? void 0 : childVnode.el)
3182
- list.push(childVnode.el);
3183
- });
3184
- return list;
2523
+ function isPlainObject(obj) {
2524
+ return Object.prototype.toString.call(obj) === "[object Object]";
2525
+ }
2526
+ function isPrimitive(data) {
2527
+ if (data == null)
2528
+ return true;
2529
+ const type = typeof data;
2530
+ return type === "string" || type === "number" || type === "boolean";
2531
+ }
2532
+ function isRef2(raw) {
2533
+ return !!raw.__v_isRef;
2534
+ }
2535
+ function isComputed(raw) {
2536
+ return isRef2(raw) && !!raw.effect;
2537
+ }
2538
+ function isReactive2(raw) {
2539
+ return !!raw.__v_isReactive;
2540
+ }
2541
+ function isReadOnly(raw) {
2542
+ return !!raw.__v_isReadonly;
3185
2543
  }
3186
2544
 
3187
- // src/core/component/tree/filter.ts
3188
- init_cjs_shims();
3189
- var import_devtools_shared8 = require("@vue/devtools-shared");
3190
- var ComponentFilter = class {
3191
- constructor(filter) {
3192
- this.filter = filter || "";
3193
- }
3194
- /**
3195
- * Check if an instance is qualified.
3196
- *
3197
- * @param {Vue|Vnode} instance
3198
- * @return {boolean}
3199
- */
3200
- isQualified(instance) {
3201
- const name = getInstanceName(instance);
3202
- return (0, import_devtools_shared8.classify)(name).toLowerCase().includes(this.filter) || (0, import_devtools_shared8.kebabize)(name).toLowerCase().includes(this.filter);
3203
- }
2545
+ // src/core/component/state/util.ts
2546
+ var tokenMap = {
2547
+ [UNDEFINED]: "undefined",
2548
+ [NAN]: "NaN",
2549
+ [INFINITY]: "Infinity",
2550
+ [NEGATIVE_INFINITY]: "-Infinity"
3204
2551
  };
3205
- function createComponentFilter(filterText) {
3206
- return new ComponentFilter(filterText);
2552
+ var reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
2553
+ acc[value] = key;
2554
+ return acc;
2555
+ }, {});
2556
+ function internalStateTokenToString(value) {
2557
+ if (value === null)
2558
+ return "null";
2559
+ return typeof value === "string" && tokenMap[value] || false;
3207
2560
  }
3208
-
3209
- // src/core/component/tree/walker.ts
3210
- var ComponentWalker = class {
3211
- constructor(options) {
3212
- // Dedupe instances (Some instances may be both on a component and on a child abstract/functional component)
3213
- this.captureIds = /* @__PURE__ */ new Map();
3214
- const { filterText = "", maxDepth, recursively } = options;
3215
- this.componentFilter = createComponentFilter(filterText);
3216
- this.maxDepth = maxDepth;
3217
- this.recursively = recursively;
3218
- }
3219
- getComponentTree(instance) {
3220
- this.captureIds = /* @__PURE__ */ new Map();
3221
- return this.findQualifiedChildren(instance, 0);
2561
+ function replaceTokenToString(value) {
2562
+ const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
2563
+ return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
2564
+ }
2565
+ function replaceStringToToken(value) {
2566
+ const literalValue = reversedTokenMap[value.trim()];
2567
+ if (literalValue)
2568
+ return `"${literalValue}"`;
2569
+ const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
2570
+ return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
2571
+ }
2572
+ function getPropType(type) {
2573
+ if (Array.isArray(type))
2574
+ return type.map((t) => getPropType(t)).join(" or ");
2575
+ if (type == null)
2576
+ return "null";
2577
+ const match = type.toString().match(fnTypeRE);
2578
+ return typeof type === "function" ? match && match[1] || "any" : "any";
2579
+ }
2580
+ function sanitize(data) {
2581
+ if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2582
+ return Object.prototype.toString.call(data);
2583
+ } else {
2584
+ return data;
3222
2585
  }
3223
- getComponentParents(instance) {
3224
- this.captureIds = /* @__PURE__ */ new Map();
3225
- const parents = [];
3226
- this.captureId(instance);
3227
- let parent = instance;
3228
- while (parent = parent.parent) {
3229
- this.captureId(parent);
3230
- parents.push(parent);
2586
+ }
2587
+ function getSetupStateType(raw) {
2588
+ return {
2589
+ ref: isRef2(raw),
2590
+ computed: isComputed(raw),
2591
+ reactive: isReactive2(raw),
2592
+ readonly: isReadOnly(raw)
2593
+ };
2594
+ }
2595
+ function toRaw2(value) {
2596
+ if (value == null ? void 0 : value.__v_raw)
2597
+ return value.__v_raw;
2598
+ return value;
2599
+ }
2600
+ function escape(s) {
2601
+ return s.replace(/[<>"&]/g, (s2) => {
2602
+ return ESC[s2] || s2;
2603
+ });
2604
+ }
2605
+
2606
+ // src/core/component/state/process.ts
2607
+ function mergeOptions(to, from, instance) {
2608
+ if (typeof from === "function")
2609
+ from = from.options;
2610
+ if (!from)
2611
+ return to;
2612
+ const { mixins, extends: extendsOptions } = from;
2613
+ extendsOptions && mergeOptions(to, extendsOptions, instance);
2614
+ mixins && mixins.forEach(
2615
+ (m) => mergeOptions(to, m, instance)
2616
+ );
2617
+ for (const key of ["computed", "inject"]) {
2618
+ if (Object.prototype.hasOwnProperty.call(from, key)) {
2619
+ if (!to[key])
2620
+ to[key] = from[key];
2621
+ else
2622
+ Object.assign(to[key], from[key]);
3231
2623
  }
3232
- return parents;
3233
- }
3234
- captureId(instance) {
3235
- if (!instance)
3236
- return null;
3237
- const id = instance.__VUE_DEVTOOLS_UID__ != null ? instance.__VUE_DEVTOOLS_UID__ : getUniqueComponentId(instance);
3238
- instance.__VUE_DEVTOOLS_UID__ = id;
3239
- if (this.captureIds.has(id))
3240
- return null;
3241
- else
3242
- this.captureIds.set(id, void 0);
3243
- this.mark(instance);
3244
- return id;
3245
2624
  }
3246
- /**
3247
- * Capture the meta information of an instance. (recursive)
3248
- *
3249
- * @param {Vue} instance
3250
- * @return {object}
3251
- */
3252
- async capture(instance, depth) {
3253
- var _a9;
3254
- if (!instance)
3255
- return null;
3256
- const id = this.captureId(instance);
3257
- const name = getInstanceName(instance);
3258
- const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
3259
- const parents = this.getComponentParents(instance) || [];
3260
- const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
3261
- const treeNode = {
3262
- uid: instance.uid,
3263
- id,
3264
- name,
3265
- renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
3266
- inactive,
3267
- children: [],
3268
- isFragment: isFragment(instance),
3269
- tags: typeof instance.type !== "function" ? [] : [
3270
- {
3271
- label: "functional",
3272
- textColor: 5592405,
3273
- backgroundColor: 15658734
3274
- }
3275
- ],
3276
- autoOpen: this.recursively,
3277
- file: instance.type.__file || ""
3278
- };
3279
- if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) {
3280
- treeNode.children = await Promise.all(children.map((child) => this.capture(child, depth + 1)).filter(Boolean));
3281
- }
3282
- if (this.isKeepAlive(instance)) {
3283
- const cachedComponents = this.getKeepAliveCachedInstances(instance);
3284
- const childrenIds = children.map((child) => child.__VUE_DEVTOOLS_UID__);
3285
- for (const cachedChild of cachedComponents) {
3286
- if (!childrenIds.includes(cachedChild.__VUE_DEVTOOLS_UID__)) {
3287
- const node = await this.capture({ ...cachedChild, isDeactivated: true }, depth + 1);
3288
- if (node)
3289
- treeNode.children.push(node);
3290
- }
3291
- }
3292
- }
3293
- const rootElements = getRootElementsFromComponentInstance(instance);
3294
- const firstElement = rootElements[0];
3295
- if (firstElement == null ? void 0 : firstElement.parentElement) {
3296
- const parentInstance = instance.parent;
3297
- const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
3298
- let el = firstElement;
3299
- const indexList = [];
3300
- do {
3301
- indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
3302
- el = el.parentElement;
3303
- } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
3304
- treeNode.domOrder = indexList.reverse();
3305
- } else {
3306
- treeNode.domOrder = [-1];
3307
- }
3308
- if ((_a9 = instance.suspense) == null ? void 0 : _a9.suspenseKey) {
3309
- treeNode.tags.push({
3310
- label: instance.suspense.suspenseKey,
3311
- backgroundColor: 14979812,
3312
- textColor: 16777215
3313
- });
3314
- this.mark(instance, true);
3315
- }
3316
- devtoolsContext.api.visitComponentTree({
3317
- treeNode,
3318
- componentInstance: instance,
3319
- app: instance.appContext.app,
3320
- filter: this.componentFilter.filter
3321
- });
3322
- return treeNode;
3323
- }
3324
- /**
3325
- * Find qualified children from a single instance.
3326
- * If the instance itself is qualified, just return itself.
3327
- * This is ok because [].concat works in both cases.
3328
- *
3329
- * @param {Vue|Vnode} instance
3330
- * @return {Vue|Array}
3331
- */
3332
- async findQualifiedChildren(instance, depth) {
3333
- var _a9;
3334
- if (this.componentFilter.isQualified(instance) && !((_a9 = instance.type.devtools) == null ? void 0 : _a9.hide)) {
3335
- return [await this.capture(instance, depth)];
3336
- } else if (instance.subTree) {
3337
- const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
3338
- return this.findQualifiedChildrenFromList(list, depth);
3339
- } else {
3340
- return [];
3341
- }
3342
- }
3343
- /**
3344
- * Iterate through an array of instances and flatten it into
3345
- * an array of qualified instances. This is a depth-first
3346
- * traversal - e.g. if an instance is not matched, we will
3347
- * recursively go deeper until a qualified child is found.
3348
- *
3349
- * @param {Array} instances
3350
- * @return {Array}
3351
- */
3352
- async findQualifiedChildrenFromList(instances, depth) {
3353
- instances = instances.filter((child) => {
3354
- var _a9;
3355
- return !isBeingDestroyed(child) && !((_a9 = child.type.devtools) == null ? void 0 : _a9.hide);
3356
- });
3357
- if (!this.componentFilter.filter)
3358
- return Promise.all(instances.map((child) => this.capture(child, depth)));
3359
- else
3360
- return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
3361
- }
3362
- /**
3363
- * Get children from a component instance.
3364
- */
3365
- getInternalInstanceChildren(subTree, suspense = null) {
3366
- const list = [];
3367
- if (subTree) {
3368
- if (subTree.component) {
3369
- !suspense ? list.push(subTree.component) : list.push({ ...subTree.component, suspense });
3370
- } else if (subTree.suspense) {
3371
- const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
3372
- list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, { ...subTree.suspense, suspenseKey }));
3373
- } else if (Array.isArray(subTree.children)) {
3374
- subTree.children.forEach((childSubTree) => {
3375
- if (childSubTree.component)
3376
- !suspense ? list.push(childSubTree.component) : list.push({ ...childSubTree.component, suspense });
3377
- else
3378
- list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
3379
- });
3380
- }
3381
- }
3382
- return list.filter((child) => {
3383
- var _a9;
3384
- return !isBeingDestroyed(child) && !((_a9 = child.type.devtools) == null ? void 0 : _a9.hide);
2625
+ return to;
2626
+ }
2627
+ function resolveMergedOptions(instance) {
2628
+ const raw = instance.type;
2629
+ const { mixins, extends: extendsOptions } = raw;
2630
+ const globalMixins = instance.appContext.mixins;
2631
+ if (!globalMixins.length && !mixins && !extendsOptions)
2632
+ return raw;
2633
+ const options = {};
2634
+ globalMixins.forEach((m) => mergeOptions(options, m, instance));
2635
+ mergeOptions(options, raw, instance);
2636
+ return options;
2637
+ }
2638
+ function processProps(instance) {
2639
+ const props = [];
2640
+ const propDefinitions = instance.type.props;
2641
+ for (const key in instance.props) {
2642
+ const propDefinition = propDefinitions ? propDefinitions[key] : null;
2643
+ const camelizeKey = (0, import_devtools_shared6.camelize)(key);
2644
+ props.push({
2645
+ type: "props",
2646
+ key: camelizeKey,
2647
+ value: returnError(() => instance.props[key]),
2648
+ meta: propDefinition ? {
2649
+ type: propDefinition.type ? getPropType(propDefinition.type) : "any",
2650
+ required: !!propDefinition.required,
2651
+ ...propDefinition.default ? {
2652
+ default: propDefinition.default.toString()
2653
+ } : {}
2654
+ } : { type: "invalid" }
3385
2655
  });
3386
2656
  }
3387
- /**
3388
- * Mark an instance as captured and store it in the instance map.
3389
- *
3390
- * @param {Vue} instance
3391
- */
3392
- mark(instance, force = false) {
3393
- const instanceMap = getAppRecord(instance).instanceMap;
3394
- if (force || !instanceMap.has(instance.__VUE_DEVTOOLS_UID__))
3395
- instanceMap.set(instance.__VUE_DEVTOOLS_UID__, instance);
3396
- }
3397
- isKeepAlive(instance) {
3398
- return instance.type.__isKeepAlive && instance.__v_cache;
3399
- }
3400
- getKeepAliveCachedInstances(instance) {
3401
- return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
3402
- }
3403
- };
3404
-
3405
- // src/core/component/state/index.ts
3406
- init_cjs_shims();
3407
- function getInstanceState(params) {
3408
- var _a9;
3409
- const instance = getComponentInstance(devtoolsContext.appRecord, params.instanceId);
3410
- const id = getUniqueComponentId(instance);
3411
- const name = getInstanceName(instance);
3412
- const file = (_a9 = instance == null ? void 0 : instance.type) == null ? void 0 : _a9.__file;
3413
- const state = processInstanceState(instance);
2657
+ return props;
2658
+ }
2659
+ function processState(instance) {
2660
+ const type = instance.type;
2661
+ const props = type.props;
2662
+ const getters = type.vuex && type.vuex.getters;
2663
+ const computedDefs = type.computed;
2664
+ const data = {
2665
+ ...instance.data,
2666
+ ...instance.renderContext
2667
+ };
2668
+ return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
2669
+ key,
2670
+ type: "data",
2671
+ value: returnError(() => data[key]),
2672
+ editable: true
2673
+ }));
2674
+ }
2675
+ function getStateTypeAndName(info) {
2676
+ const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
2677
+ const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
3414
2678
  return {
3415
- id,
3416
- name,
3417
- file,
3418
- state,
3419
- instance
2679
+ stateType,
2680
+ stateTypeName
3420
2681
  };
3421
2682
  }
3422
-
3423
- // src/core/component/state/bounding-rect.ts
3424
- init_cjs_shims();
3425
- function createRect() {
3426
- const rect = {
3427
- top: 0,
3428
- bottom: 0,
3429
- left: 0,
3430
- right: 0,
3431
- get width() {
3432
- return rect.right - rect.left;
3433
- },
3434
- get height() {
3435
- return rect.bottom - rect.top;
2683
+ function processSetupState(instance) {
2684
+ const raw = instance.devtoolsRawSetupState || {};
2685
+ return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
2686
+ var _a10, _b10, _c, _d;
2687
+ const value = returnError(() => toRaw2(instance.setupState[key]));
2688
+ const rawData = raw[key];
2689
+ let result;
2690
+ let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function";
2691
+ if (rawData) {
2692
+ const info = getSetupStateType(rawData);
2693
+ const { stateType, stateTypeName } = getStateTypeAndName(info);
2694
+ const isState = info.ref || info.computed || info.reactive;
2695
+ const raw2 = ((_b10 = (_a10 = rawData.effect) == null ? void 0 : _a10.raw) == null ? void 0 : _b10.toString()) || ((_d = (_c = rawData.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
2696
+ if (stateType)
2697
+ isOtherType = false;
2698
+ result = {
2699
+ ...stateType ? { stateType, stateTypeName } : {},
2700
+ ...raw2 ? { raw: raw2 } : {},
2701
+ editable: isState && !info.readonly
2702
+ };
3436
2703
  }
3437
- };
3438
- return rect;
2704
+ const type = isOtherType ? "setup (other)" : "setup";
2705
+ return {
2706
+ key,
2707
+ value,
2708
+ type,
2709
+ // @ts-expect-error ignore
2710
+ ...result
2711
+ };
2712
+ });
3439
2713
  }
3440
- var range;
3441
- function getTextRect(node) {
3442
- if (!range)
3443
- range = document.createRange();
3444
- range.selectNode(node);
3445
- return range.getBoundingClientRect();
2714
+ function processComputed(instance, mergedType) {
2715
+ const type = mergedType;
2716
+ const computed = [];
2717
+ const defs = type.computed || {};
2718
+ for (const key in defs) {
2719
+ const def = defs[key];
2720
+ const type2 = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
2721
+ computed.push({
2722
+ type: type2,
2723
+ key,
2724
+ value: returnError(() => {
2725
+ var _a10;
2726
+ return (_a10 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a10[key];
2727
+ }),
2728
+ editable: typeof def.set === "function"
2729
+ });
2730
+ }
2731
+ return computed;
3446
2732
  }
3447
- function getFragmentRect(vnode) {
3448
- const rect = createRect();
3449
- if (!vnode.children)
3450
- return rect;
3451
- for (let i = 0, l = vnode.children.length; i < l; i++) {
3452
- const childVnode = vnode.children[i];
3453
- let childRect;
3454
- if (childVnode.component) {
3455
- childRect = getComponentBoundingRect(childVnode.component);
3456
- } else if (childVnode.el) {
3457
- const el = childVnode.el;
3458
- if (el.nodeType === 1 || el.getBoundingClientRect)
3459
- childRect = el.getBoundingClientRect();
3460
- else if (el.nodeType === 3 && el.data.trim())
3461
- childRect = getTextRect(el);
3462
- }
3463
- if (childRect)
3464
- mergeRects(rect, childRect);
2733
+ function processAttrs(instance) {
2734
+ return Object.keys(instance.attrs).map((key) => ({
2735
+ type: "attrs",
2736
+ key,
2737
+ value: returnError(() => instance.attrs[key])
2738
+ }));
2739
+ }
2740
+ function processProvide(instance) {
2741
+ return Reflect.ownKeys(instance.provides).map((key) => ({
2742
+ type: "provided",
2743
+ key: key.toString(),
2744
+ value: returnError(() => instance.provides[key])
2745
+ }));
2746
+ }
2747
+ function processInject(instance, mergedType) {
2748
+ if (!(mergedType == null ? void 0 : mergedType.inject))
2749
+ return [];
2750
+ let keys = [];
2751
+ let defaultValue;
2752
+ if (Array.isArray(mergedType.inject)) {
2753
+ keys = mergedType.inject.map((key) => ({
2754
+ key,
2755
+ originalKey: key
2756
+ }));
2757
+ } else {
2758
+ keys = Reflect.ownKeys(mergedType.inject).map((key) => {
2759
+ const value = mergedType.inject[key];
2760
+ let originalKey;
2761
+ if (typeof value === "string" || typeof value === "symbol") {
2762
+ originalKey = value;
2763
+ } else {
2764
+ originalKey = value.from;
2765
+ defaultValue = value.default;
2766
+ }
2767
+ return {
2768
+ key,
2769
+ originalKey
2770
+ };
2771
+ });
3465
2772
  }
3466
- return rect;
2773
+ return keys.map(({ key, originalKey }) => ({
2774
+ type: "injected",
2775
+ key: originalKey && key !== originalKey ? `${originalKey.toString()} \u279E ${key.toString()}` : key.toString(),
2776
+ // eslint-disable-next-line no-prototype-builtins
2777
+ value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
2778
+ }));
3467
2779
  }
3468
- function mergeRects(a, b) {
3469
- if (!a.top || b.top < a.top)
3470
- a.top = b.top;
3471
- if (!a.bottom || b.bottom > a.bottom)
3472
- a.bottom = b.bottom;
3473
- if (!a.left || b.left < a.left)
3474
- a.left = b.left;
3475
- if (!a.right || b.right > a.right)
3476
- a.right = b.right;
3477
- return a;
2780
+ function processRefs(instance) {
2781
+ return Object.keys(instance.refs).map((key) => ({
2782
+ type: "refs",
2783
+ key,
2784
+ value: returnError(() => instance.refs[key])
2785
+ }));
3478
2786
  }
3479
- var DEFAULT_RECT = {
3480
- top: 0,
3481
- left: 0,
3482
- right: 0,
3483
- bottom: 0,
3484
- width: 0,
3485
- height: 0
3486
- };
3487
- function getComponentBoundingRect(instance) {
3488
- const el = instance.subTree.el;
3489
- if (typeof window === "undefined") {
3490
- return DEFAULT_RECT;
2787
+ function processEventListeners(instance) {
2788
+ var _a10;
2789
+ const emitsDefinition = instance.type.emits;
2790
+ const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition != null ? emitsDefinition : {});
2791
+ const keys = Object.keys((_a10 = instance.vnode.props) != null ? _a10 : {});
2792
+ const result = [];
2793
+ for (const key of keys) {
2794
+ const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
2795
+ if (prefix === "on") {
2796
+ const eventName = eventNameParts.join("-").toLowerCase();
2797
+ const isDeclared = declaredEmits.includes(eventName);
2798
+ result.push({
2799
+ type: "event listeners",
2800
+ key: eventName,
2801
+ value: {
2802
+ _custom: {
2803
+ displayText: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2804
+ key: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2805
+ value: isDeclared ? "\u2705 Declared" : "\u26A0\uFE0F Not declared",
2806
+ tooltipText: !isDeclared ? `The event <code>${eventName}</code> is not declared in the <code>emits</code> option. It will leak into the component's attributes (<code>$attrs</code>).` : null
2807
+ }
2808
+ }
2809
+ });
2810
+ }
3491
2811
  }
3492
- if (isFragment(instance))
3493
- return getFragmentRect(instance.subTree);
3494
- else if ((el == null ? void 0 : el.nodeType) === 1)
3495
- return el == null ? void 0 : el.getBoundingClientRect();
3496
- else if (instance.subTree.component)
3497
- return getComponentBoundingRect(instance.subTree.component);
3498
- else
3499
- return DEFAULT_RECT;
2812
+ return result;
2813
+ }
2814
+ function processInstanceState(instance) {
2815
+ const mergedType = resolveMergedOptions(instance);
2816
+ return processProps(instance).concat(
2817
+ processState(instance),
2818
+ processSetupState(instance),
2819
+ processComputed(instance, mergedType),
2820
+ processAttrs(instance),
2821
+ processProvide(instance),
2822
+ processInject(instance, mergedType),
2823
+ processRefs(instance),
2824
+ processEventListeners(instance)
2825
+ );
3500
2826
  }
3501
2827
 
3502
- // src/api/on.ts
3503
- init_cjs_shims();
3504
- var import_devtools_shared9 = require("@vue/devtools-shared");
3505
- var import_hookable2 = require("hookable");
3506
- var _a6, _b6;
3507
- var apiHooks = (_b6 = (_a6 = import_devtools_shared9.target).__VUE_DEVTOOLS_API_HOOK) != null ? _b6 : _a6.__VUE_DEVTOOLS_API_HOOK = (0, import_hookable2.createHooks)();
3508
- var on2 = {
3509
- devtoolsStateUpdated(fn) {
3510
- apiHooks.hook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, fn);
3511
- },
3512
- routerInfoUpdated(fn) {
3513
- apiHooks.hook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
3514
- },
3515
- getComponentBoundingRect(fn) {
3516
- apiHooks.hook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
3517
- },
3518
- // compatible
3519
- inspectComponent(fn) {
3520
- apiHooks.hook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3521
- },
3522
- visitComponentTree(fn) {
3523
- apiHooks.hook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3524
- },
3525
- getInspectorTree(fn) {
3526
- apiHooks.hook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3527
- },
3528
- getInspectorState(fn) {
3529
- apiHooks.hook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3530
- },
3531
- // private
3532
- sendInspectorTree(fn) {
3533
- apiHooks.hook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3534
- },
3535
- sendInspectorState(fn) {
3536
- apiHooks.hook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3537
- },
3538
- addTimelineEvent(fn) {
3539
- apiHooks.hook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3540
- },
3541
- editInspectorState(fn) {
3542
- apiHooks.hook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3543
- },
3544
- editComponentState() {
3545
- },
3546
- customTabsUpdated(fn) {
3547
- apiHooks.hook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
3548
- },
3549
- customCommandsUpdated(fn) {
3550
- apiHooks.hook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
3551
- }
3552
- };
2828
+ // src/core/component/state/index.ts
2829
+ function getInstanceState(params) {
2830
+ var _a10;
2831
+ const instance = getComponentInstance(devtoolsContext.appRecord, params.instanceId);
2832
+ const id = getUniqueComponentId(instance);
2833
+ const name = getInstanceName(instance);
2834
+ const file = (_a10 = instance == null ? void 0 : instance.type) == null ? void 0 : _a10.__file;
2835
+ const state = processInstanceState(instance);
2836
+ return {
2837
+ id,
2838
+ name,
2839
+ file,
2840
+ state,
2841
+ instance
2842
+ };
2843
+ }
3553
2844
 
3554
- // src/core/plugins/components.ts
2845
+ // src/plugins/component.ts
3555
2846
  var INSPECTOR_ID = "components";
3556
- function registerComponentsDevTools(app) {
2847
+ function registerComponentDevToolsPlugin(app) {
3557
2848
  setupDevToolsPlugin({
3558
2849
  id: INSPECTOR_ID,
3559
2850
  label: "Components",
@@ -3599,13 +2890,13 @@ function registerComponentsDevTools(app) {
3599
2890
  }
3600
2891
  });
3601
2892
  api.on.getInspectorState(async (payload) => {
3602
- var _a9;
2893
+ var _a10;
3603
2894
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
3604
2895
  const result = getInstanceState({
3605
2896
  instanceId: payload.nodeId
3606
2897
  });
3607
2898
  const componentInstance = result.instance;
3608
- const app2 = (_a9 = result.instance) == null ? void 0 : _a9.appContext.app;
2899
+ const app2 = (_a10 = result.instance) == null ? void 0 : _a10.appContext.app;
3609
2900
  const _payload = {
3610
2901
  componentInstance,
3611
2902
  app: app2,
@@ -3623,15 +2914,15 @@ function registerComponentsDevTools(app) {
3623
2914
  await api.sendInspectorState("components");
3624
2915
  }
3625
2916
  });
3626
- const debounceSendInspectorTree = (0, import_perfect_debounce3.debounce)(() => {
2917
+ const debounceSendInspectorTree = (0, import_perfect_debounce2.debounce)(() => {
3627
2918
  api.sendInspectorTree(INSPECTOR_ID);
3628
2919
  }, 120);
3629
- const debounceSendInspectorState = (0, import_perfect_debounce3.debounce)(() => {
2920
+ const debounceSendInspectorState = (0, import_perfect_debounce2.debounce)(() => {
3630
2921
  api.sendInspectorState(INSPECTOR_ID);
3631
2922
  }, 120);
3632
2923
  const componentAddedCleanup = hook.on.componentAdded(async (app2, uid, parentUid, component) => {
3633
- var _a9, _b9, _c;
3634
- if ((_c = (_b9 = (_a9 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a9.type) == null ? void 0 : _b9.devtools) == null ? void 0 : _c.hide)
2924
+ var _a10, _b10, _c;
2925
+ if ((_c = (_b10 = (_a10 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
3635
2926
  return;
3636
2927
  if (!app2 || typeof uid !== "number" && !uid || !component)
3637
2928
  return;
@@ -3652,8 +2943,8 @@ function registerComponentsDevTools(app) {
3652
2943
  debounceSendInspectorTree();
3653
2944
  });
3654
2945
  const componentUpdatedCleanup = hook.on.componentUpdated(async (app2, uid, parentUid, component) => {
3655
- var _a9, _b9, _c;
3656
- if ((_c = (_b9 = (_a9 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a9.type) == null ? void 0 : _b9.devtools) == null ? void 0 : _c.hide)
2946
+ var _a10, _b10, _c;
2947
+ if ((_c = (_b10 = (_a10 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
3657
2948
  return;
3658
2949
  if (!app2 || typeof uid !== "number" && !uid || !component)
3659
2950
  return;
@@ -3675,8 +2966,8 @@ function registerComponentsDevTools(app) {
3675
2966
  debounceSendInspectorState();
3676
2967
  });
3677
2968
  const componentRemovedCleanup = hook.on.componentRemoved(async (app2, uid, parentUid, component) => {
3678
- var _a9, _b9, _c;
3679
- if ((_c = (_b9 = (_a9 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a9.type) == null ? void 0 : _b9.devtools) == null ? void 0 : _c.hide)
2969
+ var _a10, _b10, _c;
2970
+ if ((_c = (_b10 = (_a10 = app2 == null ? void 0 : app2._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
3680
2971
  return;
3681
2972
  if (!app2 || typeof uid !== "number" && !uid || !component)
3682
2973
  return;
@@ -3699,33 +2990,850 @@ function registerComponentsDevTools(app) {
3699
2990
  });
3700
2991
  }
3701
2992
 
3702
- // src/core/general/app-record.ts
3703
- async function setActiveAppRecord(appRecord) {
3704
- await registerComponentsDevTools(appRecord.app);
3705
- devtoolsState.activeAppRecord = appRecord;
3706
- devtoolsState.activeAppRecordId = `${appRecord.id}`;
3707
- registerPlugin({
3708
- app: appRecord.app,
3709
- api: appRecord.api
3710
- });
2993
+ // src/core/app-record/index.ts
2994
+ function getAppRecordName(app, fallbackName) {
2995
+ var _a10;
2996
+ return ((_a10 = app == null ? void 0 : app._component) == null ? void 0 : _a10.name) || `App ${fallbackName}`;
2997
+ }
2998
+ function getAppRootInstance(app) {
2999
+ var _a10, _b10, _c, _d;
3000
+ if (app._instance)
3001
+ return app._instance;
3002
+ else if ((_b10 = (_a10 = app._container) == null ? void 0 : _a10._vnode) == null ? void 0 : _b10.component)
3003
+ return (_d = (_c = app._container) == null ? void 0 : _c._vnode) == null ? void 0 : _d.component;
3004
+ }
3005
+ function getAppRecordId(app, defaultId) {
3006
+ if (app.__VUE_DEVTOOLS_APP_RECORD_ID__ != null)
3007
+ return app.__VUE_DEVTOOLS_APP_RECORD_ID__;
3008
+ let id = defaultId != null ? defaultId : (appRecordInfo.id++).toString();
3009
+ if (defaultId && appRecordInfo.appIds.has(id)) {
3010
+ let count = 1;
3011
+ while (appRecordInfo.appIds.has(`${defaultId}_${count}`))
3012
+ count++;
3013
+ id = `${defaultId}_${count}`;
3014
+ }
3015
+ appRecordInfo.appIds.add(id);
3016
+ app.__VUE_DEVTOOLS_APP_RECORD_ID__ = id;
3017
+ return id;
3018
+ }
3019
+ function createAppRecord(app) {
3020
+ const rootInstance = getAppRootInstance(app);
3021
+ if (rootInstance) {
3022
+ appRecordInfo.id++;
3023
+ const name = getAppRecordName(app, appRecordInfo.id.toString());
3024
+ const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
3025
+ const record = {
3026
+ id,
3027
+ name,
3028
+ instanceMap: /* @__PURE__ */ new Map(),
3029
+ rootInstance
3030
+ };
3031
+ app.__VUE_DEVTOOLS_APP_RECORD__ = record;
3032
+ const rootId = `${record.id}:root`;
3033
+ record.instanceMap.set(rootId, record.rootInstance);
3034
+ record.rootInstance.__VUE_DEVTOOLS_UID__ = rootId;
3035
+ return record;
3036
+ } else {
3037
+ return {};
3038
+ }
3039
+ }
3040
+ async function setActiveAppRecord(appRecord) {
3041
+ await registerComponentDevToolsPlugin(appRecord == null ? void 0 : appRecord.app);
3042
+ devtoolsAppRecords.active = appRecord;
3043
+ devtoolsAppRecords.activeId = `${appRecord.id}`;
3044
+ registerPlugin(appRecord.app, appRecord.api);
3045
+ }
3046
+ async function toggleActiveAppRecord(id) {
3047
+ devtoolsContext.componentPluginHookBuffer.forEach((cleanup) => cleanup());
3048
+ devtoolsContext.api.clear();
3049
+ devtoolsContext.clear();
3050
+ const appRecord = devtoolsAppRecords.value.find((record) => record.id === id);
3051
+ if (appRecord) {
3052
+ devtoolsState.pluginBuffer = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.id !== "components");
3053
+ const api = new DevToolsPluginApi();
3054
+ appRecord.api = api;
3055
+ setActiveAppRecord(appRecord);
3056
+ window.postMessage({
3057
+ event: "toggle-app-record",
3058
+ target: "vue-devtools"
3059
+ });
3060
+ }
3061
+ }
3062
+
3063
+ // src/core/component-highlighter/index.ts
3064
+ init_cjs_shims();
3065
+ var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
3066
+ var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
3067
+ var COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
3068
+ var INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
3069
+ var containerStyles = {
3070
+ display: "block",
3071
+ zIndex: 2147483640,
3072
+ position: "fixed",
3073
+ backgroundColor: "#42b88325",
3074
+ border: "1px solid #42b88350",
3075
+ borderRadius: "5px",
3076
+ transition: "all 0.1s ease-in",
3077
+ pointerEvents: "none"
3078
+ };
3079
+ var cardStyles = {
3080
+ fontFamily: "Arial, Helvetica, sans-serif",
3081
+ padding: "5px 8px",
3082
+ borderRadius: "4px",
3083
+ textAlign: "left",
3084
+ position: "absolute",
3085
+ left: 0,
3086
+ color: "#e9e9e9",
3087
+ fontSize: "14px",
3088
+ fontWeight: 600,
3089
+ lineHeight: "24px",
3090
+ backgroundColor: "#42b883",
3091
+ boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
3092
+ };
3093
+ var indicatorStyles = {
3094
+ display: "inline-block",
3095
+ fontWeight: 400,
3096
+ fontStyle: "normal",
3097
+ fontSize: "12px",
3098
+ opacity: 0.7
3099
+ };
3100
+ function getContainerElement() {
3101
+ return document.getElementById(CONTAINER_ELEMENT_ID);
3102
+ }
3103
+ function getCardElement() {
3104
+ return document.getElementById(CARD_ELEMENT_ID);
3105
+ }
3106
+ function getIndicatorElement() {
3107
+ return document.getElementById(INDICATOR_ELEMENT_ID);
3108
+ }
3109
+ function getNameElement() {
3110
+ return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
3111
+ }
3112
+ function getStyles(bounds) {
3113
+ return {
3114
+ left: `${Math.round(bounds.left * 100) / 100}px`,
3115
+ top: `${Math.round(bounds.top * 100) / 100}px`,
3116
+ width: `${Math.round(bounds.width * 100) / 100}px`,
3117
+ height: `${Math.round(bounds.height * 100) / 100}px`
3118
+ };
3119
+ }
3120
+ function create(options) {
3121
+ var _a10;
3122
+ const containerEl = document.createElement("div");
3123
+ containerEl.id = (_a10 = options.elementId) != null ? _a10 : CONTAINER_ELEMENT_ID;
3124
+ Object.assign(containerEl.style, {
3125
+ ...containerStyles,
3126
+ ...getStyles(options.bounds),
3127
+ ...options.style
3128
+ });
3129
+ const cardEl = document.createElement("span");
3130
+ cardEl.id = CARD_ELEMENT_ID;
3131
+ Object.assign(cardEl.style, {
3132
+ ...cardStyles,
3133
+ top: options.bounds.top < 35 ? 0 : "-35px"
3134
+ });
3135
+ const nameEl = document.createElement("span");
3136
+ nameEl.id = COMPONENT_NAME_ELEMENT_ID;
3137
+ nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3138
+ const indicatorEl = document.createElement("i");
3139
+ indicatorEl.id = INDICATOR_ELEMENT_ID;
3140
+ indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3141
+ Object.assign(indicatorEl.style, indicatorStyles);
3142
+ cardEl.appendChild(nameEl);
3143
+ cardEl.appendChild(indicatorEl);
3144
+ containerEl.appendChild(cardEl);
3145
+ document.body.appendChild(containerEl);
3146
+ return containerEl;
3147
+ }
3148
+ function update(options) {
3149
+ const containerEl = getContainerElement();
3150
+ const cardEl = getCardElement();
3151
+ const nameEl = getNameElement();
3152
+ const indicatorEl = getIndicatorElement();
3153
+ if (containerEl) {
3154
+ Object.assign(containerEl.style, {
3155
+ ...containerStyles,
3156
+ ...getStyles(options.bounds)
3157
+ });
3158
+ Object.assign(cardEl.style, {
3159
+ top: options.bounds.top < 35 ? 0 : "-35px"
3160
+ });
3161
+ nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3162
+ indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3163
+ }
3164
+ }
3165
+ function toggleComponentHighLighter(options) {
3166
+ if (options.visible) {
3167
+ const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3168
+ if (instance && (options.bounds.width || options.bounds.height)) {
3169
+ const name = getInstanceName(instance);
3170
+ const el = getContainerElement();
3171
+ el ? update({ ...options, name }) : create({ ...options, name });
3172
+ }
3173
+ } else {
3174
+ const el = getContainerElement();
3175
+ if (el)
3176
+ el.style.display = "none";
3177
+ }
3178
+ }
3179
+ function highlight(instance) {
3180
+ const bounds = getComponentBoundingRect(instance);
3181
+ const name = getInstanceName(instance);
3182
+ const container = getContainerElement();
3183
+ container ? update({ bounds, name }) : create({ bounds, name });
3184
+ }
3185
+ function unhighlight() {
3186
+ const el = getContainerElement();
3187
+ if (el)
3188
+ el.style.display = "none";
3189
+ }
3190
+ var inspectInstance = null;
3191
+ function inspectFn(e) {
3192
+ const target9 = e.target;
3193
+ if (target9) {
3194
+ const instance = target9.__vueParentComponent;
3195
+ if (instance) {
3196
+ inspectInstance = instance;
3197
+ const el = instance.vnode.el;
3198
+ if (el) {
3199
+ const bounds = getComponentBoundingRect(instance);
3200
+ const name = getInstanceName(instance);
3201
+ const container = getContainerElement();
3202
+ container ? update({ bounds, name }) : create({ bounds, name });
3203
+ }
3204
+ }
3205
+ }
3206
+ }
3207
+ function selectComponentFn(e, cb) {
3208
+ var _a10;
3209
+ e.preventDefault();
3210
+ e.stopPropagation();
3211
+ if (inspectInstance) {
3212
+ const app = (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app;
3213
+ getComponentId({
3214
+ app,
3215
+ uid: app.uid,
3216
+ instance: inspectInstance
3217
+ }).then((id) => {
3218
+ cb(id);
3219
+ });
3220
+ }
3221
+ }
3222
+ function inspectComponentHighLighter() {
3223
+ window.addEventListener("mouseover", inspectFn);
3224
+ return new Promise((resolve) => {
3225
+ function onSelect(e) {
3226
+ e.preventDefault();
3227
+ e.stopPropagation();
3228
+ selectComponentFn(e, (id) => {
3229
+ window.removeEventListener("click", onSelect);
3230
+ window.removeEventListener("mouseover", inspectFn);
3231
+ const el = getContainerElement();
3232
+ if (el)
3233
+ el.style.display = "none";
3234
+ resolve(JSON.stringify({ id }));
3235
+ });
3236
+ }
3237
+ window.addEventListener("click", onSelect);
3238
+ });
3239
+ }
3240
+ function scrollToComponent(options) {
3241
+ const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3242
+ if (instance) {
3243
+ const [el] = getRootElementsFromComponentInstance(instance);
3244
+ if (typeof el.scrollIntoView === "function") {
3245
+ el.scrollIntoView({
3246
+ behavior: "smooth"
3247
+ });
3248
+ } else {
3249
+ const bounds = getComponentBoundingRect(instance);
3250
+ const scrollTarget = document.createElement("div");
3251
+ const styles = {
3252
+ ...getStyles(bounds),
3253
+ position: "absolute"
3254
+ };
3255
+ Object.assign(scrollTarget.style, styles);
3256
+ document.body.appendChild(scrollTarget);
3257
+ scrollTarget.scrollIntoView({
3258
+ behavior: "smooth"
3259
+ });
3260
+ setTimeout(() => {
3261
+ document.body.removeChild(scrollTarget);
3262
+ }, 2e3);
3263
+ }
3264
+ setTimeout(() => {
3265
+ const bounds = getComponentBoundingRect(instance);
3266
+ if (bounds.width || bounds.height) {
3267
+ const name = getInstanceName(instance);
3268
+ const el2 = getContainerElement();
3269
+ el2 ? update({ ...options, name, bounds }) : create({ ...options, name, bounds });
3270
+ setTimeout(() => {
3271
+ if (el2)
3272
+ el2.style.display = "none";
3273
+ }, 1500);
3274
+ }
3275
+ }, 1200);
3276
+ }
3277
+ }
3278
+
3279
+ // src/shared/index.ts
3280
+ init_cjs_shims();
3281
+
3282
+ // src/shared/util.ts
3283
+ init_cjs_shims();
3284
+
3285
+ // src/core/component/state/replacer.ts
3286
+ init_cjs_shims();
3287
+
3288
+ // src/core/component/state/custom.ts
3289
+ init_cjs_shims();
3290
+ function getFunctionDetails(func) {
3291
+ let string = "";
3292
+ let matches = null;
3293
+ try {
3294
+ string = Function.prototype.toString.call(func);
3295
+ matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
3296
+ } catch (e) {
3297
+ }
3298
+ const match = matches && matches[0];
3299
+ const args = typeof match === "string" ? match : "(?)";
3300
+ const name = typeof func.name === "string" ? func.name : "";
3301
+ return {
3302
+ _custom: {
3303
+ type: "function",
3304
+ displayText: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
3305
+ tooltipText: string.trim() ? `<pre>${string}</pre>` : null
3306
+ }
3307
+ };
3308
+ }
3309
+ function getBigIntDetails(val) {
3310
+ const stringifiedBigInt = BigInt.prototype.toString.call(val);
3311
+ return {
3312
+ _custom: {
3313
+ type: "bigint",
3314
+ displayText: `BigInt(${stringifiedBigInt})`,
3315
+ value: stringifiedBigInt
3316
+ }
3317
+ };
3318
+ }
3319
+ function getMapDetails(val) {
3320
+ const list = Object.fromEntries(val);
3321
+ return {
3322
+ _custom: {
3323
+ type: "map",
3324
+ displayText: "Map",
3325
+ value: list,
3326
+ readOnly: true,
3327
+ fields: {
3328
+ abstract: true
3329
+ }
3330
+ }
3331
+ };
3332
+ }
3333
+ function getSetDetails(val) {
3334
+ const list = Array.from(val);
3335
+ return {
3336
+ _custom: {
3337
+ type: "set",
3338
+ displayText: `Set[${list.length}]`,
3339
+ value: list,
3340
+ readOnly: true
3341
+ }
3342
+ };
3343
+ }
3344
+ function getCatchedGetters(store) {
3345
+ const getters = {};
3346
+ const origGetters = store.getters || {};
3347
+ const keys = Object.keys(origGetters);
3348
+ for (let i = 0; i < keys.length; i++) {
3349
+ const key = keys[i];
3350
+ Object.defineProperty(getters, key, {
3351
+ enumerable: true,
3352
+ get: () => {
3353
+ try {
3354
+ return origGetters[key];
3355
+ } catch (e) {
3356
+ return e;
3357
+ }
3358
+ }
3359
+ });
3360
+ }
3361
+ return getters;
3362
+ }
3363
+ function reduceStateList(list) {
3364
+ if (!list.length)
3365
+ return void 0;
3366
+ return list.reduce((map, item) => {
3367
+ const key = item.type || "data";
3368
+ const obj = map[key] = map[key] || {};
3369
+ obj[item.key] = item.value;
3370
+ return map;
3371
+ }, {});
3372
+ }
3373
+ function namedNodeMapToObject(map) {
3374
+ const result = {};
3375
+ const l = map.length;
3376
+ for (let i = 0; i < l; i++) {
3377
+ const node = map.item(i);
3378
+ result[node.name] = node.value;
3379
+ }
3380
+ return result;
3381
+ }
3382
+ function getStoreDetails(store) {
3383
+ return {
3384
+ _custom: {
3385
+ type: "store",
3386
+ displayText: "Store",
3387
+ value: {
3388
+ state: store.state,
3389
+ getters: getCatchedGetters(store)
3390
+ },
3391
+ fields: {
3392
+ abstract: true
3393
+ }
3394
+ }
3395
+ };
3396
+ }
3397
+ function getRouterDetails(router) {
3398
+ return {
3399
+ _custom: {
3400
+ type: "router",
3401
+ displayText: "VueRouter",
3402
+ value: {
3403
+ options: router.options,
3404
+ currentRoute: router.currentRoute
3405
+ },
3406
+ fields: {
3407
+ abstract: true
3408
+ }
3409
+ }
3410
+ };
3411
+ }
3412
+ function getInstanceDetails(instance) {
3413
+ if (instance._)
3414
+ instance = instance._;
3415
+ const state = processInstanceState(instance);
3416
+ return {
3417
+ _custom: {
3418
+ type: "component",
3419
+ id: instance.__VUE_DEVTOOLS_UID__,
3420
+ displayText: getInstanceName(instance),
3421
+ tooltipText: "Component instance",
3422
+ value: reduceStateList(state),
3423
+ fields: {
3424
+ abstract: true
3425
+ }
3426
+ }
3427
+ };
3428
+ }
3429
+ function getComponentDefinitionDetails(definition) {
3430
+ let display = getComponentName(definition);
3431
+ if (display) {
3432
+ if (definition.name && definition.__file)
3433
+ display += ` <span>(${definition.__file})</span>`;
3434
+ } else {
3435
+ display = "<i>Unknown Component</i>";
3436
+ }
3437
+ return {
3438
+ _custom: {
3439
+ type: "component-definition",
3440
+ displayText: display,
3441
+ tooltipText: "Component definition",
3442
+ ...definition.__file ? {
3443
+ file: definition.__file
3444
+ } : {}
3445
+ }
3446
+ };
3447
+ }
3448
+ function getHTMLElementDetails(value) {
3449
+ try {
3450
+ return {
3451
+ _custom: {
3452
+ type: "HTMLElement",
3453
+ displayText: `<span class="opacity-30">&lt;</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">&gt;</span>`,
3454
+ value: namedNodeMapToObject(value.attributes)
3455
+ }
3456
+ };
3457
+ } catch (e) {
3458
+ return {
3459
+ _custom: {
3460
+ type: "HTMLElement",
3461
+ displayText: `<span class="text-blue-500">${String(value)}</span>`
3462
+ }
3463
+ };
3464
+ }
3465
+ }
3466
+ function getObjectDetails(object) {
3467
+ var _a10, _b10, _c, _d;
3468
+ const info = getSetupStateType(object);
3469
+ const isState = info.ref || info.computed || info.reactive;
3470
+ if (isState) {
3471
+ const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
3472
+ const value = toRaw2(info.reactive ? object : object._value);
3473
+ const raw = ((_b10 = (_a10 = object.effect) == null ? void 0 : _a10.raw) == null ? void 0 : _b10.toString()) || ((_d = (_c = object.effect) == null ? void 0 : _c.fn) == null ? void 0 : _d.toString());
3474
+ return {
3475
+ _custom: {
3476
+ type: stateTypeName == null ? void 0 : stateTypeName.toLowerCase(),
3477
+ stateTypeName,
3478
+ value,
3479
+ ...raw ? { tooltipText: `<span class="font-mono">${raw}</span>` } : {}
3480
+ }
3481
+ };
3482
+ }
3483
+ if (typeof object.__asyncLoader === "function") {
3484
+ return {
3485
+ _custom: {
3486
+ type: "component-definition",
3487
+ display: "Async component definition"
3488
+ }
3489
+ };
3490
+ }
3491
+ }
3492
+
3493
+ // src/core/component/state/replacer.ts
3494
+ function stringifyReplacer(key) {
3495
+ var _a10;
3496
+ if (key === "compilerOptions")
3497
+ return;
3498
+ const val = this[key];
3499
+ const type = typeof val;
3500
+ if (Array.isArray(val)) {
3501
+ const l = val.length;
3502
+ if (l > MAX_ARRAY_SIZE) {
3503
+ return {
3504
+ _isArray: true,
3505
+ length: l,
3506
+ items: val.slice(0, MAX_ARRAY_SIZE)
3507
+ };
3508
+ }
3509
+ return val;
3510
+ } else if (typeof val === "string") {
3511
+ if (val.length > MAX_STRING_SIZE)
3512
+ return `${val.substring(0, MAX_STRING_SIZE)}... (${val.length} total length)`;
3513
+ else
3514
+ return val;
3515
+ } else if (type === "undefined") {
3516
+ return UNDEFINED;
3517
+ } else if (val === Number.POSITIVE_INFINITY) {
3518
+ return INFINITY;
3519
+ } else if (val === Number.NEGATIVE_INFINITY) {
3520
+ return NEGATIVE_INFINITY;
3521
+ } else if (typeof val === "function") {
3522
+ return getFunctionDetails(val);
3523
+ } else if (type === "symbol") {
3524
+ return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
3525
+ } else if (typeof val === "bigint") {
3526
+ return getBigIntDetails(val);
3527
+ } else if (val !== null && typeof val === "object") {
3528
+ const proto = Object.prototype.toString.call(val);
3529
+ if (proto === "[object Map]") {
3530
+ return getMapDetails(val);
3531
+ } else if (proto === "[object Set]") {
3532
+ return getSetDetails(val);
3533
+ } else if (proto === "[object RegExp]") {
3534
+ return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
3535
+ } else if (proto === "[object Date]") {
3536
+ return `[native Date ${Date.prototype.toString.call(val)}]`;
3537
+ } else if (proto === "[object Error]") {
3538
+ return `[native Error ${val.message}<>${val.stack}]`;
3539
+ } else if (val.state && val._vm) {
3540
+ return getStoreDetails(val);
3541
+ } else if (val.constructor && val.constructor.name === "VueRouter") {
3542
+ return getRouterDetails(val);
3543
+ } else if (isVueInstance(val)) {
3544
+ return getInstanceDetails(val);
3545
+ } else if (typeof val.render === "function") {
3546
+ return getComponentDefinitionDetails(val);
3547
+ } else if (val.constructor && val.constructor.name === "VNode") {
3548
+ return `[native VNode <${val.tag}>]`;
3549
+ } else if (typeof HTMLElement !== "undefined" && val instanceof HTMLElement) {
3550
+ return getHTMLElementDetails(val);
3551
+ } else if (((_a10 = val.constructor) == null ? void 0 : _a10.name) === "Store" && val._wrappedGetters) {
3552
+ return "[object Store]";
3553
+ } else if (val.currentRoute) {
3554
+ return "[object Router]";
3555
+ }
3556
+ const customDetails = getObjectDetails(val);
3557
+ if (customDetails != null)
3558
+ return customDetails;
3559
+ } else if (Number.isNaN(val)) {
3560
+ return NAN;
3561
+ }
3562
+ return sanitize(val);
3563
+ }
3564
+
3565
+ // src/core/component/state/reviver.ts
3566
+ init_cjs_shims();
3567
+ var import_devtools_shared7 = require("@vue/devtools-shared");
3568
+ function reviveSet(val) {
3569
+ const result = /* @__PURE__ */ new Set();
3570
+ const list = val._custom.value;
3571
+ for (let i = 0; i < list.length; i++) {
3572
+ const value = list[i];
3573
+ result.add(revive(value));
3574
+ }
3575
+ return result;
3576
+ }
3577
+ function reviveMap(val) {
3578
+ const result = /* @__PURE__ */ new Map();
3579
+ const list = val._custom.value;
3580
+ for (let i = 0; i < list.length; i++) {
3581
+ const { key, value } = list[i];
3582
+ result.set(key, revive(value));
3583
+ }
3584
+ return result;
3585
+ }
3586
+ function revive(val) {
3587
+ var _a10;
3588
+ if (val === UNDEFINED) {
3589
+ return void 0;
3590
+ } else if (val === INFINITY) {
3591
+ return Number.POSITIVE_INFINITY;
3592
+ } else if (val === NEGATIVE_INFINITY) {
3593
+ return Number.NEGATIVE_INFINITY;
3594
+ } else if (val === NAN) {
3595
+ return Number.NaN;
3596
+ } else if (val && val._custom) {
3597
+ const { _custom: custom } = val;
3598
+ if (custom.type === "component")
3599
+ return (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.instanceMap.get(custom.id);
3600
+ else if (custom.type === "map")
3601
+ return reviveMap(val);
3602
+ else if (custom.type === "set")
3603
+ return reviveSet(val);
3604
+ else if (custom.type === "bigint")
3605
+ return BigInt(custom.value);
3606
+ else
3607
+ return revive(custom.value);
3608
+ } else if (symbolRE.test(val)) {
3609
+ const [, string] = symbolRE.exec(val);
3610
+ return Symbol.for(string);
3611
+ } else if (specialTypeRE.test(val)) {
3612
+ const [, type, string, , details] = specialTypeRE.exec(val);
3613
+ const result = new import_devtools_shared7.target[type](string);
3614
+ if (type === "Error" && details)
3615
+ result.stack = details;
3616
+ return result;
3617
+ } else {
3618
+ return val;
3619
+ }
3620
+ }
3621
+ function reviver(key, value) {
3622
+ return revive(value);
3623
+ }
3624
+
3625
+ // src/shared/transfer.ts
3626
+ init_cjs_shims();
3627
+ var MAX_SERIALIZED_SIZE = 512 * 1024;
3628
+ function encode(data, replacer, list, seen) {
3629
+ let stored, key, value, i, l;
3630
+ const seenIndex = seen.get(data);
3631
+ if (seenIndex != null)
3632
+ return seenIndex;
3633
+ const index = list.length;
3634
+ const proto = Object.prototype.toString.call(data);
3635
+ if (proto === "[object Object]") {
3636
+ stored = {};
3637
+ seen.set(data, index);
3638
+ list.push(stored);
3639
+ const keys = Object.keys(data);
3640
+ for (i = 0, l = keys.length; i < l; i++) {
3641
+ key = keys[i];
3642
+ try {
3643
+ if (key === "compilerOptions")
3644
+ return;
3645
+ value = data[key];
3646
+ if (replacer)
3647
+ value = replacer.call(data, key, value);
3648
+ } catch (e) {
3649
+ value = e;
3650
+ }
3651
+ stored[key] = encode(value, replacer, list, seen);
3652
+ }
3653
+ } else if (proto === "[object Array]") {
3654
+ stored = [];
3655
+ seen.set(data, index);
3656
+ list.push(stored);
3657
+ for (i = 0, l = data.length; i < l; i++) {
3658
+ try {
3659
+ value = data[i];
3660
+ if (replacer)
3661
+ value = replacer.call(data, i, value);
3662
+ } catch (e) {
3663
+ value = e;
3664
+ }
3665
+ stored[i] = encode(value, replacer, list, seen);
3666
+ }
3667
+ } else {
3668
+ list.push(data);
3669
+ }
3670
+ return index;
3671
+ }
3672
+ function decode(list, reviver2 = null) {
3673
+ let i = list.length;
3674
+ let j, k, data, key, value, proto;
3675
+ while (i--) {
3676
+ data = list[i];
3677
+ proto = Object.prototype.toString.call(data);
3678
+ if (proto === "[object Object]") {
3679
+ const keys = Object.keys(data);
3680
+ for (j = 0, k = keys.length; j < k; j++) {
3681
+ key = keys[j];
3682
+ value = list[data[key]];
3683
+ if (reviver2)
3684
+ value = reviver2.call(data, key, value);
3685
+ data[key] = value;
3686
+ }
3687
+ } else if (proto === "[object Array]") {
3688
+ for (j = 0, k = data.length; j < k; j++) {
3689
+ value = list[data[j]];
3690
+ if (reviver2)
3691
+ value = reviver2.call(data, j, value);
3692
+ data[j] = value;
3693
+ }
3694
+ }
3695
+ }
3696
+ }
3697
+ function stringifyCircularAutoChunks(data, replacer = null, space = null) {
3698
+ let result;
3699
+ try {
3700
+ result = arguments.length === 1 ? JSON.stringify(data) : JSON.stringify(data, replacer, space);
3701
+ } catch (e) {
3702
+ result = stringifyStrictCircularAutoChunks(data, replacer, space);
3703
+ }
3704
+ if (result.length > MAX_SERIALIZED_SIZE) {
3705
+ const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
3706
+ const chunks = [];
3707
+ for (let i = 0; i < chunkCount; i++)
3708
+ chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
3709
+ return chunks;
3710
+ }
3711
+ return result;
3712
+ }
3713
+ function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
3714
+ const list = [];
3715
+ encode(data, replacer, list, /* @__PURE__ */ new Map());
3716
+ return space ? ` ${JSON.stringify(list, null, space)}` : ` ${JSON.stringify(list)}`;
3717
+ }
3718
+ function parseCircularAutoChunks(data, reviver2 = null) {
3719
+ if (Array.isArray(data))
3720
+ data = data.join("");
3721
+ const hasCircular = /^\s/.test(data);
3722
+ if (!hasCircular) {
3723
+ return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver2);
3724
+ } else {
3725
+ const list = JSON.parse(data);
3726
+ decode(list, reviver2);
3727
+ return list[0];
3728
+ }
3729
+ }
3730
+
3731
+ // src/core/component/state/format.ts
3732
+ init_cjs_shims();
3733
+ function getInspectorStateValueType(value, raw = true) {
3734
+ const type = typeof value;
3735
+ if (value == null || value === UNDEFINED) {
3736
+ return "null";
3737
+ } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
3738
+ return "literal";
3739
+ } else if (value == null ? void 0 : value._custom) {
3740
+ if (raw || value._custom.display != null || value._custom.displayText != null)
3741
+ return "custom";
3742
+ else
3743
+ return getInspectorStateValueType(value._custom.value);
3744
+ } else if (typeof value === "string") {
3745
+ const typeMatch = specialTypeRE.exec(value);
3746
+ if (typeMatch) {
3747
+ const [, type2] = typeMatch;
3748
+ return `native ${type2}`;
3749
+ } else {
3750
+ return "string";
3751
+ }
3752
+ } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
3753
+ return "array";
3754
+ } else if (isPlainObject(value)) {
3755
+ return "plain-object";
3756
+ } else {
3757
+ return "unknown";
3758
+ }
3759
+ }
3760
+ function formatInspectorStateValue(value, quotes = false) {
3761
+ var _a10, _b10;
3762
+ let result;
3763
+ const type = getInspectorStateValueType(value, false);
3764
+ if (type !== "custom" && (value == null ? void 0 : value._custom))
3765
+ value = value._custom.value;
3766
+ if (result = internalStateTokenToString(value)) {
3767
+ return result;
3768
+ } else if (type === "custom") {
3769
+ const nestedName = ((_a10 = value._custom.value) == null ? void 0 : _a10._custom) && formatInspectorStateValue(value._custom.value);
3770
+ return nestedName || value._custom.displayText || value._custom.display;
3771
+ } else if (type === "array") {
3772
+ return `Array[${value.length}]`;
3773
+ } else if (type === "plain-object") {
3774
+ return `Object${Object.keys(value).length ? "" : " (empty)"}`;
3775
+ } else if (type == null ? void 0 : type.includes("native")) {
3776
+ return escape((_b10 = specialTypeRE.exec(value)) == null ? void 0 : _b10[2]);
3777
+ } else if (typeof value === "string") {
3778
+ const typeMatch = value.match(rawTypeRE);
3779
+ if (typeMatch)
3780
+ value = escape(typeMatch[1]);
3781
+ else if (quotes)
3782
+ value = `<span>"</span>${escape(value)}<span>"</span>`;
3783
+ else
3784
+ value = escape(value);
3785
+ value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
3786
+ }
3787
+ return value;
3788
+ }
3789
+ function getRaw(value) {
3790
+ var _a10, _b10, _c;
3791
+ let customType;
3792
+ const isCustom = getInspectorStateValueType(value) === "custom";
3793
+ let inherit = {};
3794
+ if (isCustom) {
3795
+ const data = value;
3796
+ const customValue = (_a10 = data._custom) == null ? void 0 : _a10.value;
3797
+ const currentCustomType = (_b10 = data._custom) == null ? void 0 : _b10.type;
3798
+ const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRaw(customValue) : { inherit: void 0, value: void 0, customType: void 0 };
3799
+ inherit = nestedCustom.inherit || ((_c = data._custom) == null ? void 0 : _c.fields) || {};
3800
+ value = nestedCustom.value || customValue;
3801
+ customType = nestedCustom.customType || currentCustomType;
3802
+ }
3803
+ if (value && value._isArray)
3804
+ value = value.items;
3805
+ return { value, inherit, customType };
3806
+ }
3807
+ function toEdit(value, customType) {
3808
+ if (customType === "bigint")
3809
+ return value;
3810
+ return replaceTokenToString(JSON.stringify(value));
3811
+ }
3812
+ function toSubmit(value, customType) {
3813
+ if (customType === "bigint")
3814
+ return BigInt(value);
3815
+ return JSON.parse(replaceStringToToken(value), reviver);
3816
+ }
3817
+
3818
+ // src/shared/util.ts
3819
+ function stringify(data) {
3820
+ return stringifyCircularAutoChunks(data, stringifyReplacer);
3711
3821
  }
3712
- async function toggleAppRecord(id) {
3713
- devtoolsContext.componentPluginHookBuffer.forEach((cleanup) => cleanup());
3714
- devtoolsContext.api.clear();
3715
- devtoolsContext.clear();
3716
- const appRecord = devtoolsState.appRecords.find((record) => record.id === id);
3717
- if (appRecord) {
3718
- devtoolsState.pluginBuffer = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.id !== "components");
3719
- const api = new DevToolsPluginApi();
3720
- appRecord.api = api;
3721
- setActiveAppRecord(appRecord);
3722
- window.postMessage({
3723
- event: "toggle-app-record",
3724
- target: "vue-devtools"
3725
- });
3726
- }
3822
+ function parse(data, revive2 = false) {
3823
+ if (data == void 0)
3824
+ return {};
3825
+ return revive2 ? parseCircularAutoChunks(data, reviver) : parseCircularAutoChunks(data);
3826
+ }
3827
+
3828
+ // src/shared/time.ts
3829
+ init_cjs_shims();
3830
+ function now() {
3831
+ return Date.now();
3727
3832
  }
3728
3833
 
3834
+ // src/shared/env.ts
3835
+ init_cjs_shims();
3836
+
3729
3837
  // src/core/custom-tab/index.ts
3730
3838
  init_cjs_shims();
3731
3839
  function addCustomTab(tab) {
@@ -3748,18 +3856,18 @@ function removeCustomCommand(actionId) {
3748
3856
  devtoolsState.commands.splice(index, 1);
3749
3857
  }
3750
3858
 
3751
- // src/core/vue-inspector/index.ts
3859
+ // src/core/component-inspector/index.ts
3752
3860
  init_cjs_shims();
3753
- var import_devtools_shared10 = require("@vue/devtools-shared");
3754
- var _a7, _b7;
3755
- (_b7 = (_a7 = import_devtools_shared10.target).__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__) != null ? _b7 : _a7.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = true;
3861
+ var import_devtools_shared8 = require("@vue/devtools-shared");
3862
+ var _a3, _b3;
3863
+ (_b3 = (_a3 = import_devtools_shared8.target).__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__) != null ? _b3 : _a3.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = true;
3756
3864
  function toggleComponentInspectorEnabled(enabled) {
3757
- import_devtools_shared10.target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = enabled;
3865
+ import_devtools_shared8.target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = enabled;
3758
3866
  }
3759
3867
  function waitForInspectorInit(cb) {
3760
3868
  let total = 0;
3761
3869
  const timer = setInterval(() => {
3762
- if (import_devtools_shared10.target.__VUE_INSPECTOR__) {
3870
+ if (import_devtools_shared8.target.__VUE_INSPECTOR__) {
3763
3871
  clearInterval(timer);
3764
3872
  total += 30;
3765
3873
  cb();
@@ -3770,22 +3878,20 @@ function waitForInspectorInit(cb) {
3770
3878
  }, 30);
3771
3879
  }
3772
3880
  function setupInspector() {
3773
- const inspector = import_devtools_shared10.target.__VUE_INSPECTOR__;
3881
+ const inspector = import_devtools_shared8.target.__VUE_INSPECTOR__;
3774
3882
  const _openInEditor = inspector.openInEditor;
3775
3883
  inspector.openInEditor = async (...params) => {
3776
3884
  inspector.disable();
3777
3885
  _openInEditor(...params);
3778
3886
  };
3779
3887
  }
3780
- function getVueInspector() {
3888
+ function getComponentInspector() {
3781
3889
  return new Promise((resolve) => {
3782
- if (!import_devtools_shared10.target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__)
3783
- resolve(null);
3784
3890
  function setup() {
3785
3891
  setupInspector();
3786
- resolve(import_devtools_shared10.target.__VUE_INSPECTOR__);
3892
+ resolve(import_devtools_shared8.target.__VUE_INSPECTOR__);
3787
3893
  }
3788
- if (!import_devtools_shared10.target.__VUE_INSPECTOR__) {
3894
+ if (!import_devtools_shared8.target.__VUE_INSPECTOR__) {
3789
3895
  waitForInspectorInit(() => {
3790
3896
  setup();
3791
3897
  });
@@ -3795,271 +3901,114 @@ function getVueInspector() {
3795
3901
  });
3796
3902
  }
3797
3903
 
3798
- // src/core/component-inspector/index.ts
3904
+ // src/core/open-in-editor/index.ts
3799
3905
  init_cjs_shims();
3800
- var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
3801
- var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
3802
- var COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
3803
- var INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
3804
- var containerStyles = {
3805
- display: "block",
3806
- zIndex: 2147483640,
3807
- position: "fixed",
3808
- backgroundColor: "#42b88325",
3809
- border: "1px solid #42b88350",
3810
- borderRadius: "5px",
3811
- transition: "all 0.1s ease-in",
3812
- pointerEvents: "none"
3813
- };
3814
- var cardStyles = {
3815
- fontFamily: "Arial, Helvetica, sans-serif",
3816
- padding: "5px 8px",
3817
- borderRadius: "4px",
3818
- textAlign: "left",
3819
- position: "absolute",
3820
- left: 0,
3821
- color: "#e9e9e9",
3822
- fontSize: "14px",
3823
- fontWeight: 600,
3824
- lineHeight: "24px",
3825
- backgroundColor: "#42b883",
3826
- boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
3827
- };
3828
- var indicatorStyles = {
3829
- display: "inline-block",
3830
- fontWeight: 400,
3831
- fontStyle: "normal",
3832
- fontSize: "12px",
3833
- opacity: 0.7
3834
- };
3835
- function getContainerElement() {
3836
- return document.getElementById(CONTAINER_ELEMENT_ID);
3837
- }
3838
- function getCardElement() {
3839
- return document.getElementById(CARD_ELEMENT_ID);
3840
- }
3841
- function getIndicatorElement() {
3842
- return document.getElementById(INDICATOR_ELEMENT_ID);
3843
- }
3844
- function getNameElement() {
3845
- return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
3846
- }
3847
- function getStyles(bounds) {
3848
- return {
3849
- left: `${Math.round(bounds.left * 100) / 100}px`,
3850
- top: `${Math.round(bounds.top * 100) / 100}px`,
3851
- width: `${Math.round(bounds.width * 100) / 100}px`,
3852
- height: `${Math.round(bounds.height * 100) / 100}px`
3853
- };
3854
- }
3855
- function create(options) {
3856
- var _a9;
3857
- const containerEl = document.createElement("div");
3858
- containerEl.id = (_a9 = options.elementId) != null ? _a9 : CONTAINER_ELEMENT_ID;
3859
- Object.assign(containerEl.style, {
3860
- ...containerStyles,
3861
- ...getStyles(options.bounds),
3862
- ...options.style
3863
- });
3864
- const cardEl = document.createElement("span");
3865
- cardEl.id = CARD_ELEMENT_ID;
3866
- Object.assign(cardEl.style, {
3867
- ...cardStyles,
3868
- top: options.bounds.top < 35 ? 0 : "-35px"
3869
- });
3870
- const nameEl = document.createElement("span");
3871
- nameEl.id = COMPONENT_NAME_ELEMENT_ID;
3872
- nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3873
- const indicatorEl = document.createElement("i");
3874
- indicatorEl.id = INDICATOR_ELEMENT_ID;
3875
- indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3876
- Object.assign(indicatorEl.style, indicatorStyles);
3877
- cardEl.appendChild(nameEl);
3878
- cardEl.appendChild(indicatorEl);
3879
- containerEl.appendChild(cardEl);
3880
- document.body.appendChild(containerEl);
3881
- return containerEl;
3882
- }
3883
- function update(options) {
3884
- const containerEl = getContainerElement();
3885
- const cardEl = getCardElement();
3886
- const nameEl = getNameElement();
3887
- const indicatorEl = getIndicatorElement();
3888
- if (containerEl) {
3889
- Object.assign(containerEl.style, {
3890
- ...containerStyles,
3891
- ...getStyles(options.bounds)
3892
- });
3893
- Object.assign(cardEl.style, {
3894
- top: options.bounds.top < 35 ? 0 : "-35px"
3895
- });
3896
- nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
3897
- indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
3898
- }
3899
- }
3900
- function toggleComponentInspector(options) {
3901
- if (options.visible) {
3902
- const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3903
- if (instance && (options.bounds.width || options.bounds.height)) {
3904
- const name = getInstanceName(instance);
3905
- const el = getContainerElement();
3906
- el ? update({ ...options, name }) : create({ ...options, name });
3907
- }
3908
- } else {
3909
- const el = getContainerElement();
3910
- if (el)
3911
- el.style.display = "none";
3912
- }
3913
- }
3914
- function highlight(instance) {
3915
- const bounds = getComponentBoundingRect(instance);
3916
- const name = getInstanceName(instance);
3917
- const container = getContainerElement();
3918
- container ? update({ bounds, name }) : create({ bounds, name });
3919
- }
3920
- function unhighlight() {
3921
- const el = getContainerElement();
3922
- if (el)
3923
- el.style.display = "none";
3924
- }
3925
- var inspectInstance = null;
3926
- function inspectFn(e) {
3927
- const target8 = e.target;
3928
- if (target8) {
3929
- const instance = target8.__vueParentComponent;
3930
- if (instance) {
3931
- inspectInstance = instance;
3932
- const el = instance.vnode.el;
3933
- if (el) {
3934
- const bounds = getComponentBoundingRect(instance);
3935
- const name = getInstanceName(instance);
3936
- const container = getContainerElement();
3937
- container ? update({ bounds, name }) : create({ bounds, name });
3938
- }
3906
+ var import_devtools_shared9 = require("@vue/devtools-shared");
3907
+ function openInEditor(options = {}) {
3908
+ const { file, line = 0, column = 0 } = options;
3909
+ if (file) {
3910
+ const baseUrl = window.location.origin;
3911
+ if (devtoolsState.vitePluginDetected) {
3912
+ import_devtools_shared9.target.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
3913
+ } else {
3939
3914
  }
3940
3915
  }
3941
3916
  }
3942
- function selectComponentFn(e, cb) {
3943
- var _a9;
3944
- e.preventDefault();
3945
- e.stopPropagation();
3946
- if (inspectInstance) {
3947
- const app = (_a9 = devtoolsContext.appRecord) == null ? void 0 : _a9.app;
3948
- getComponentId({
3949
- app,
3950
- uid: app.uid,
3951
- instance: inspectInstance
3952
- }).then((id) => {
3953
- cb(id);
3954
- });
3955
- }
3956
- }
3957
- function inspectComponentInspector() {
3958
- window.addEventListener("mouseover", inspectFn);
3959
- return new Promise((resolve) => {
3960
- function onSelect(e) {
3961
- e.preventDefault();
3962
- e.stopPropagation();
3963
- selectComponentFn(e, (id) => {
3964
- window.removeEventListener("click", onSelect);
3965
- window.removeEventListener("mouseover", inspectFn);
3966
- const el = getContainerElement();
3967
- if (el)
3968
- el.style.display = "none";
3969
- resolve(JSON.stringify({ id }));
3970
- });
3971
- }
3972
- window.addEventListener("click", onSelect);
3973
- });
3974
- }
3975
- function scrollToComponent(options) {
3976
- const instance = getComponentInstance(devtoolsContext.appRecord, options.id);
3977
- if (instance) {
3978
- const [el] = getRootElementsFromComponentInstance(instance);
3979
- if (typeof el.scrollIntoView === "function") {
3980
- el.scrollIntoView({
3981
- behavior: "smooth"
3982
- });
3983
- } else {
3984
- const bounds = getComponentBoundingRect(instance);
3985
- const scrollTarget = document.createElement("div");
3986
- const styles = {
3987
- ...getStyles(bounds),
3988
- position: "absolute"
3989
- };
3990
- Object.assign(scrollTarget.style, styles);
3991
- document.body.appendChild(scrollTarget);
3992
- scrollTarget.scrollIntoView({
3993
- behavior: "smooth"
3994
- });
3995
- setTimeout(() => {
3996
- document.body.removeChild(scrollTarget);
3997
- }, 2e3);
3998
- }
3999
- setTimeout(() => {
4000
- const bounds = getComponentBoundingRect(instance);
4001
- if (bounds.width || bounds.height) {
4002
- const name = getInstanceName(instance);
4003
- const el2 = getContainerElement();
4004
- el2 ? update({ ...options, name, bounds }) : create({ ...options, name, bounds });
4005
- setTimeout(() => {
4006
- if (el2)
4007
- el2.style.display = "none";
4008
- }, 1500);
4009
- }
4010
- }, 1200);
3917
+
3918
+ // src/api/on.ts
3919
+ init_cjs_shims();
3920
+ var on2 = {
3921
+ // #region compatible with old devtools
3922
+ addTimelineEvent(fn) {
3923
+ apiHooks.hook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3924
+ },
3925
+ inspectComponent(fn) {
3926
+ apiHooks.hook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3927
+ },
3928
+ visitComponentTree(fn) {
3929
+ apiHooks.hook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3930
+ },
3931
+ getInspectorTree(fn) {
3932
+ apiHooks.hook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3933
+ },
3934
+ getInspectorState(fn) {
3935
+ apiHooks.hook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3936
+ },
3937
+ sendInspectorTree(fn) {
3938
+ apiHooks.hook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3939
+ },
3940
+ sendInspectorState(fn) {
3941
+ apiHooks.hook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3942
+ },
3943
+ editInspectorState(fn) {
3944
+ apiHooks.hook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3945
+ },
3946
+ editComponentState() {
3947
+ },
3948
+ // #endregion compatible with old devtools
3949
+ // router
3950
+ routerInfoUpdated(fn) {
3951
+ apiHooks.hook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
3952
+ },
3953
+ // component highlighter
3954
+ getComponentBoundingRect(fn) {
3955
+ apiHooks.hook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
3956
+ },
3957
+ // custom tabs
3958
+ customTabsUpdated(fn) {
3959
+ apiHooks.hook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
3960
+ },
3961
+ // custom commands
3962
+ customCommandsUpdated(fn) {
3963
+ apiHooks.hook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
3964
+ },
3965
+ devtoolsStateUpdated(fn) {
3966
+ apiHooks.hook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, fn);
4011
3967
  }
4012
- }
3968
+ };
4013
3969
 
4014
3970
  // src/api/off.ts
4015
3971
  init_cjs_shims();
4016
- function clear() {
3972
+ function remove() {
4017
3973
  apiHooks.removeAllHooks();
4018
3974
  }
4019
3975
 
4020
- // src/api/index.ts
3976
+ // src/api/api.ts
4021
3977
  var DevToolsPluginApi = class {
4022
3978
  constructor() {
3979
+ this.clear = remove;
4023
3980
  this.on = on2;
4024
- this.clear = clear;
4025
- }
4026
- toggleApp(id) {
4027
- return toggleAppRecord(id);
4028
3981
  }
4029
- addTimelineEvent(payload) {
4030
- apiHooks.callHook("timeline:add-event" /* ADD_TIMELINE_EVENT */, payload);
3982
+ // #region compatible with old devtools
3983
+ // timeline layer
3984
+ addTimelineLayer(payload) {
3985
+ addTimelineLayer(payload);
4031
3986
  }
4032
- toggleComponentInspector(payload) {
4033
- return toggleComponentInspector(payload);
3987
+ // timeline event
3988
+ addTimelineEvent(...params) {
3989
+ apiHooks.callHook("timeline:add-event" /* ADD_TIMELINE_EVENT */, ...params);
4034
3990
  }
4035
- inspectComponentInspector() {
4036
- return inspectComponentInspector();
3991
+ // add inspector
3992
+ addInspector(payload) {
3993
+ addInspector({
3994
+ id: payload.id,
3995
+ nodeId: "",
3996
+ filter: "",
3997
+ treeFilterPlaceholder: payload.treeFilterPlaceholder || ""
3998
+ });
4037
3999
  }
4038
- scrollToComponent(payload) {
4039
- return scrollToComponent(payload);
4000
+ highlightElement(instance) {
4001
+ highlight(instance);
4040
4002
  }
4041
- getComponentBoundingRect(payload) {
4042
- const { inspectorId, instanceId = "" } = payload;
4043
- const _payload = {
4044
- app: devtoolsContext.appRecord.app,
4045
- inspectorId,
4046
- instanceId,
4047
- rect: {
4048
- top: 0,
4049
- left: 0,
4050
- width: 0,
4051
- height: 0
4052
- }
4053
- };
4054
- apiHooks.callHookWith((callbacks) => {
4055
- callbacks.map((cb) => cb(_payload));
4056
- }, "component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */);
4057
- return stringify(_payload.rect);
4003
+ unhighlightElement() {
4004
+ unhighlight();
4058
4005
  }
4006
+ // inspector
4059
4007
  async getInspectorTree(payload = {}) {
4008
+ var _a10;
4060
4009
  const { inspectorId, filter = "", instanceId = "" } = payload;
4061
4010
  const _payload = {
4062
- app: devtoolsContext.appRecord.app,
4011
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4063
4012
  inspectorId,
4064
4013
  instanceId,
4065
4014
  filter,
@@ -4077,9 +4026,10 @@ var DevToolsPluginApi = class {
4077
4026
  return stringify(_payload.rootNodes);
4078
4027
  }
4079
4028
  getInspectorState(payload = {}) {
4029
+ var _a10;
4080
4030
  const { inspectorId, nodeId } = payload;
4081
4031
  const _payload = {
4082
- app: devtoolsContext.appRecord.app,
4032
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4083
4033
  inspectorId,
4084
4034
  nodeId
4085
4035
  };
@@ -4094,10 +4044,11 @@ var DevToolsPluginApi = class {
4094
4044
  return stringify(state);
4095
4045
  }
4096
4046
  async editInspectorState(payload) {
4047
+ var _a10;
4097
4048
  const stateEditor2 = new StateEditor();
4098
4049
  apiHooks.callHook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, {
4099
4050
  ...payload,
4100
- app: devtoolsContext.appRecord.app,
4051
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4101
4052
  set: (obj, path = payload.path, value = payload.state.value, cb) => {
4102
4053
  stateEditor2.set(obj, path, value, cb || stateEditor2.createDefaultSetCallback(payload.state));
4103
4054
  }
@@ -4125,48 +4076,14 @@ var DevToolsPluginApi = class {
4125
4076
  apiHooks.callHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, stringify({ ...parse(res), inspectorId }));
4126
4077
  }
4127
4078
  }
4128
- addCustomTab(tab) {
4129
- addCustomTab(tab);
4130
- }
4131
- addCustomCommand(action) {
4132
- addCustomCommand(action);
4133
- }
4134
- removeCustomCommand(actionId) {
4135
- removeCustomCommand(actionId);
4136
- }
4137
- addInspector(payload) {
4138
- var _a9;
4139
- addInspector({
4140
- id: payload.id,
4141
- nodeId: "",
4142
- filter: "",
4143
- treeFilterPlaceholder: (_a9 = payload.treeFilterPlaceholder) != null ? _a9 : ""
4144
- });
4145
- }
4146
- openInEditor(payload) {
4147
- openInEditor(payload);
4148
- }
4149
- highlightElement(instance) {
4150
- highlight(instance);
4151
- }
4152
- unhighlightElement() {
4153
- unhighlight();
4154
- }
4155
4079
  async getComponentInstances(app) {
4156
4080
  const appRecord = app.__VUE_DEVTOOLS_APP_RECORD__;
4157
4081
  const appId = appRecord.id.toString();
4158
4082
  const instances = [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
4159
4083
  return instances;
4160
4084
  }
4161
- // Vite only
4162
- getVueInspector() {
4163
- return getVueInspector();
4164
- }
4165
- visitComponentTree(payload) {
4166
- apiHooks.callHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, payload);
4167
- }
4168
- addTimelineLayer(payload) {
4169
- addTimelineLayer(payload);
4085
+ visitComponentTree(...params) {
4086
+ apiHooks.callHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, ...params);
4170
4087
  }
4171
4088
  notifyComponentUpdate() {
4172
4089
  }
@@ -4178,83 +4095,249 @@ var DevToolsPluginApi = class {
4178
4095
  logStoreChanges: null
4179
4096
  };
4180
4097
  }
4098
+ // #endregion compatible with old devtools
4099
+ // #region highlighter
4100
+ toggleComponentInspector(...params) {
4101
+ return toggleComponentHighLighter(...params);
4102
+ }
4103
+ inspectComponentInspector() {
4104
+ return inspectComponentHighLighter();
4105
+ }
4106
+ scrollToComponent(...params) {
4107
+ return scrollToComponent(...params);
4108
+ }
4109
+ getComponentBoundingRect(...params) {
4110
+ var _a10;
4111
+ const { inspectorId, instanceId = "" } = params[0];
4112
+ const _payload = {
4113
+ app: (_a10 = devtoolsContext.appRecord) == null ? void 0 : _a10.app,
4114
+ inspectorId,
4115
+ instanceId,
4116
+ rect: {
4117
+ top: 0,
4118
+ left: 0,
4119
+ width: 0,
4120
+ height: 0
4121
+ }
4122
+ };
4123
+ apiHooks.callHookWith((callbacks) => {
4124
+ callbacks.map((cb) => cb(_payload));
4125
+ }, "component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */);
4126
+ return stringify(_payload.rect);
4127
+ }
4128
+ // #endregion highlighter
4129
+ toggleApp(id) {
4130
+ return toggleActiveAppRecord(id);
4131
+ }
4132
+ addCustomTab(tab) {
4133
+ addCustomTab(tab);
4134
+ }
4135
+ addCustomCommand(action) {
4136
+ addCustomCommand(action);
4137
+ }
4138
+ removeCustomCommand(actionId) {
4139
+ removeCustomCommand(actionId);
4140
+ }
4141
+ openInEditor(payload) {
4142
+ openInEditor(payload);
4143
+ }
4144
+ getVueInspector() {
4145
+ return getComponentInspector();
4146
+ }
4181
4147
  };
4182
4148
 
4183
- // src/core/general/app.ts
4149
+ // src/state/state.ts
4150
+ var STATE_KEY = "__VUE_DEVTOOLS_GLOBAL_STATE__";
4151
+ function initStateFactory() {
4152
+ return {
4153
+ connected: false,
4154
+ clientConnected: false,
4155
+ appRecords: [],
4156
+ activeAppRecord: null,
4157
+ selectedComponentId: null,
4158
+ pluginBuffer: [],
4159
+ tabs: [],
4160
+ commands: [],
4161
+ vitePluginDetected: false,
4162
+ activeAppRecordId: null
4163
+ };
4164
+ }
4165
+ var _a4, _b4;
4166
+ (_b4 = (_a4 = import_devtools_shared10.target)[STATE_KEY]) != null ? _b4 : _a4[STATE_KEY] = initStateFactory();
4167
+ var callStateUpdatedHook = (0, import_perfect_debounce3.debounce)((state, oldState) => {
4168
+ apiHooks.callHook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, state, oldState);
4169
+ }, 80);
4170
+ var callConnectedUpdatedHook = (0, import_perfect_debounce3.debounce)((state, oldState) => {
4171
+ apiHooks.callHook("devtools:connected-updated" /* DEVTOOLS_CONNECTED_UPDATED */, state, oldState);
4172
+ }, 80);
4173
+ var devtoolsState = new Proxy(import_devtools_shared10.target[STATE_KEY], {
4174
+ get(target9, property) {
4175
+ return import_devtools_shared10.target[STATE_KEY][property];
4176
+ },
4177
+ deleteProperty(target9, property) {
4178
+ delete target9[property];
4179
+ return true;
4180
+ },
4181
+ set(target9, property, value) {
4182
+ const oldState = { ...import_devtools_shared10.target[STATE_KEY] };
4183
+ target9[property] = value;
4184
+ import_devtools_shared10.target[STATE_KEY][property] = value;
4185
+ callStateUpdatedHook(import_devtools_shared10.target[STATE_KEY], oldState);
4186
+ if (["connected", "clientConnected"].includes(property.toString()) && oldState[property] !== value)
4187
+ callConnectedUpdatedHook(import_devtools_shared10.target[STATE_KEY], oldState);
4188
+ return true;
4189
+ }
4190
+ });
4191
+ Object.defineProperty(devtoolsState.tabs, "push", {
4192
+ configurable: true,
4193
+ value(...items) {
4194
+ const result = Array.prototype.push.apply(this, items);
4195
+ devtoolsState.tabs = this;
4196
+ apiHooks.callHook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, this);
4197
+ return result;
4198
+ }
4199
+ });
4200
+ ["push", "splice"].forEach((method) => {
4201
+ Object.defineProperty(devtoolsState.commands, method, {
4202
+ configurable: true,
4203
+ value(...args) {
4204
+ const result = Array.prototype[method].apply(this, args);
4205
+ devtoolsState.commands = this;
4206
+ apiHooks.callHook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, this);
4207
+ return result;
4208
+ }
4209
+ });
4210
+ });
4211
+
4212
+ // src/state/app-record.ts
4213
+ init_cjs_shims();
4214
+ var import_devtools_shared13 = require("@vue/devtools-shared");
4215
+
4216
+ // src/state/router.ts
4184
4217
  init_cjs_shims();
4185
4218
  var import_devtools_shared11 = require("@vue/devtools-shared");
4186
- var import_speakingurl = __toESM(require_speakingurl2(), 1);
4187
- var _a8, _b8;
4188
- var appRecordInfo = (_b8 = (_a8 = import_devtools_shared11.target).__VUE_DEVTOOLS_APP_RECROD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_APP_RECROD_INFO__ = {
4189
- id: 0,
4190
- appIds: /* @__PURE__ */ new Set()
4219
+ var ROUTER_KEY = "__VUE_DEVTOOLS_ROUTER__";
4220
+ var ROUTER_INFO_KEY = "__VUE_DEVTOOLS_ROUTER_INFO__";
4221
+ var _a5, _b5;
4222
+ (_b5 = (_a5 = import_devtools_shared11.target)[ROUTER_INFO_KEY]) != null ? _b5 : _a5[ROUTER_INFO_KEY] = {
4223
+ currentRoute: null,
4224
+ routes: []
4191
4225
  };
4192
- function getAppRecordName(app, fallbackName) {
4193
- var _a9;
4194
- return ((_a9 = app == null ? void 0 : app._component) == null ? void 0 : _a9.name) || `App ${fallbackName}`;
4226
+ var _a6, _b6;
4227
+ (_b6 = (_a6 = import_devtools_shared11.target)[ROUTER_KEY]) != null ? _b6 : _a6[ROUTER_KEY] = null;
4228
+ var devtoolsRouterInfo = new Proxy(import_devtools_shared11.target[ROUTER_INFO_KEY], {
4229
+ get(target9, property) {
4230
+ return import_devtools_shared11.target[ROUTER_INFO_KEY][property];
4231
+ }
4232
+ });
4233
+
4234
+ // src/state/context.ts
4235
+ init_cjs_shims();
4236
+ var import_devtools_shared12 = require("@vue/devtools-shared");
4237
+ var CONTEXT_KEY = "__VUE_DEVTOOLS_CONTEXT__";
4238
+ function initContextFactory() {
4239
+ return {
4240
+ appRecord: null,
4241
+ api: null,
4242
+ inspector: [],
4243
+ timelineLayer: [],
4244
+ routerInfo: {},
4245
+ router: null,
4246
+ activeInspectorTreeId: "",
4247
+ componentPluginHookBuffer: []
4248
+ };
4195
4249
  }
4196
- function getAppRootInstance(app) {
4197
- var _a9, _b9, _c, _d;
4198
- if (app._instance)
4199
- return app._instance;
4200
- else if ((_b9 = (_a9 = app._container) == null ? void 0 : _a9._vnode) == null ? void 0 : _b9.component)
4201
- return (_d = (_c = app._container) == null ? void 0 : _c._vnode) == null ? void 0 : _d.component;
4250
+ var _a7, _b7;
4251
+ (_b7 = (_a7 = import_devtools_shared12.target)[CONTEXT_KEY]) != null ? _b7 : _a7[CONTEXT_KEY] = initContextFactory();
4252
+ function resetDevToolsContext() {
4253
+ import_devtools_shared12.target[CONTEXT_KEY] = initContextFactory();
4202
4254
  }
4203
- function getAppRecordId(app, defaultId) {
4204
- if (app.__VUE_DEVTOOLS_APP_RECORD_ID__ != null)
4205
- return app.__VUE_DEVTOOLS_APP_RECORD_ID__;
4206
- let id = defaultId != null ? defaultId : (appRecordInfo.id++).toString();
4207
- if (defaultId && appRecordInfo.appIds.has(id)) {
4208
- let count = 1;
4209
- while (appRecordInfo.appIds.has(`${defaultId}_${count}`))
4210
- count++;
4211
- id = `${defaultId}_${count}`;
4255
+ var devtoolsContext = new Proxy(import_devtools_shared12.target[CONTEXT_KEY], {
4256
+ get(target9, property) {
4257
+ if (property === "router")
4258
+ return import_devtools_shared12.target[ROUTER_KEY];
4259
+ else if (property === "clear")
4260
+ return resetDevToolsContext;
4261
+ return import_devtools_shared12.target[CONTEXT_KEY][property];
4262
+ },
4263
+ set(target9, property, value) {
4264
+ import_devtools_shared12.target[CONTEXT_KEY][property] = value;
4265
+ return true;
4212
4266
  }
4213
- appRecordInfo.appIds.add(id);
4214
- app.__VUE_DEVTOOLS_APP_RECORD_ID__ = id;
4215
- return id;
4216
- }
4217
- function createAppRecord(app) {
4218
- const rootInstance = getAppRootInstance(app);
4219
- if (rootInstance) {
4220
- appRecordInfo.id++;
4221
- const name = getAppRecordName(app, appRecordInfo.id.toString());
4222
- const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
4223
- const record = {
4224
- id,
4225
- name,
4226
- instanceMap: /* @__PURE__ */ new Map(),
4227
- rootInstance
4228
- };
4229
- app.__VUE_DEVTOOLS_APP_RECORD__ = record;
4230
- const rootId = `${record.id}:root`;
4231
- record.instanceMap.set(rootId, record.rootInstance);
4232
- record.rootInstance.__VUE_DEVTOOLS_UID__ = rootId;
4233
- return record;
4234
- } else {
4235
- return {};
4267
+ });
4268
+
4269
+ // src/state/app-record.ts
4270
+ var devtoolsAppRecords = new Proxy(devtoolsState.appRecords, {
4271
+ get(_, property) {
4272
+ if (property === "value")
4273
+ return devtoolsState.appRecords;
4274
+ else if (property === "active")
4275
+ return devtoolsState.activeAppRecord;
4276
+ else if (property === "activeId")
4277
+ return devtoolsState.activeAppRecordId;
4278
+ },
4279
+ set(target9, property, value) {
4280
+ var _a10;
4281
+ const oldState = { ...devtoolsState };
4282
+ if (property === "value") {
4283
+ devtoolsState.appRecords = value;
4284
+ } else if (property === "active") {
4285
+ const _value = value;
4286
+ devtoolsState.activeAppRecord = _value;
4287
+ devtoolsContext.appRecord = _value;
4288
+ devtoolsContext.api = _value.api;
4289
+ devtoolsContext.inspector = (_a10 = _value.inspector) != null ? _a10 : [];
4290
+ normalizeRouterInfo(value);
4291
+ devtoolsContext.routerInfo = devtoolsRouterInfo;
4292
+ } else if (property === "activeId") {
4293
+ devtoolsState.activeAppRecordId = value;
4294
+ }
4295
+ callStateUpdatedHook(devtoolsState, oldState);
4296
+ if (["connected", "clientConnected"].includes(property.toString()) && oldState[property] !== value)
4297
+ callConnectedUpdatedHook(devtoolsState, oldState);
4298
+ return true;
4236
4299
  }
4300
+ });
4301
+ var _a8, _b8;
4302
+ var appRecordInfo = (_b8 = (_a8 = import_devtools_shared13.target).__VUE_DEVTOOLS_APP_RECROD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_APP_RECROD_INFO__ = {
4303
+ id: 0,
4304
+ appIds: /* @__PURE__ */ new Set()
4305
+ };
4306
+
4307
+ // src/state/env.ts
4308
+ init_cjs_shims();
4309
+ var import_devtools_shared14 = require("@vue/devtools-shared");
4310
+ var _a9, _b9;
4311
+ (_b9 = (_a9 = import_devtools_shared14.target).__VUE_DEVTOOLS_ENV__) != null ? _b9 : _a9.__VUE_DEVTOOLS_ENV__ = {
4312
+ vitePluginDetected: false
4313
+ };
4314
+ function getDevToolsEnv() {
4315
+ return import_devtools_shared14.target.__VUE_DEVTOOLS_ENV__;
4316
+ }
4317
+ function setDevToolsEnv(env) {
4318
+ import_devtools_shared14.target.__VUE_DEVTOOLS_ENV__ = {
4319
+ ...import_devtools_shared14.target.__VUE_DEVTOOLS_ENV__,
4320
+ ...env
4321
+ };
4237
4322
  }
4238
4323
 
4239
- // src/core/general/index.ts
4324
+ // src/core/index.ts
4240
4325
  function initDevTools() {
4241
- var _a9, _b9, _c;
4242
- devtoolsState.vitePluginDetected = !!import_devtools_shared12.target.__VUE_DEVTOOLS_VITE_PLUGIN_DETECTED__;
4243
- const isNewDevTools = ((_a9 = import_devtools_shared12.target.__VUE_DEVTOOLS_GLOBAL_HOOK__) == null ? void 0 : _a9.id) === "vue-devtools-next";
4244
- if (import_devtools_shared12.target.__VUE_DEVTOOLS_GLOBAL_HOOK__ && isNewDevTools)
4326
+ var _a10;
4327
+ devtoolsState.vitePluginDetected = getDevToolsEnv().vitePluginDetected;
4328
+ const isDevToolsNext = ((_a10 = import_devtools_shared15.target.__VUE_DEVTOOLS_GLOBAL_HOOK__) == null ? void 0 : _a10.id) === "vue-devtools-next";
4329
+ if (import_devtools_shared15.target.__VUE_DEVTOOLS_GLOBAL_HOOK__ && isDevToolsNext)
4245
4330
  return;
4246
- if (import_devtools_shared12.target.__VUE_DEVTOOLS_GLOBAL_HOOK__)
4331
+ if (import_devtools_shared15.target.__VUE_DEVTOOLS_GLOBAL_HOOK__)
4247
4332
  Object.assign(__VUE_DEVTOOLS_GLOBAL_HOOK__, createDevToolsHook());
4248
4333
  else
4249
- import_devtools_shared12.target.__VUE_DEVTOOLS_GLOBAL_HOOK__ = createDevToolsHook();
4250
- (_c = (_b9 = import_devtools_shared12.target).__VUE_DEVTOOLS_APP_RECORDS__) != null ? _c : _b9.__VUE_DEVTOOLS_APP_RECORDS__ = [];
4251
- hook.on.setupDevtoolsPlugin(collectRegisteredPlugin);
4334
+ import_devtools_shared15.target.__VUE_DEVTOOLS_GLOBAL_HOOK__ = createDevToolsHook();
4335
+ hook.on.setupDevtoolsPlugin(collectDevToolsPlugin);
4252
4336
  hook.on.vueAppInit(async (app, version) => {
4253
- var _a10;
4254
4337
  const record = createAppRecord(app);
4255
4338
  const api = new DevToolsPluginApi();
4256
- devtoolsState.appRecords = [
4257
- ...(_a10 = devtoolsState.appRecords) != null ? _a10 : [],
4339
+ devtoolsAppRecords.value = [
4340
+ ...devtoolsAppRecords.value,
4258
4341
  {
4259
4342
  ...record,
4260
4343
  app,
@@ -4262,10 +4345,10 @@ function initDevTools() {
4262
4345
  api
4263
4346
  }
4264
4347
  ];
4265
- if (devtoolsState.appRecords.length === 1) {
4266
- await setActiveAppRecord(devtoolsState.appRecords[0]);
4348
+ if (devtoolsAppRecords.value.length === 1) {
4349
+ await setActiveAppRecord(devtoolsAppRecords.value[0]);
4267
4350
  devtoolsState.connected = true;
4268
- devtoolsHooks.callHook(import_devtools_schema3.DevToolsHooks.APP_CONNECTED);
4351
+ devtoolsHooks.callHook("app:connected" /* APP_CONNECTED */);
4269
4352
  }
4270
4353
  });
4271
4354
  subscribeDevToolsHook();
@@ -4305,40 +4388,29 @@ function onDevToolsClientConnected(fn) {
4305
4388
  var devtools = {
4306
4389
  state: devtoolsState,
4307
4390
  context: devtoolsContext,
4308
- init: initDevTools,
4309
4391
  hook,
4392
+ init: initDevTools,
4310
4393
  get api() {
4311
4394
  return devtoolsContext.api;
4312
4395
  }
4313
4396
  };
4314
4397
  // Annotate the CommonJS export names for ESM import in node:
4315
4398
  0 && (module.exports = {
4316
- ESC,
4317
- INFINITY,
4318
- MAX_ARRAY_SIZE,
4319
- MAX_STRING_SIZE,
4320
- NAN,
4321
- NEGATIVE_INFINITY,
4322
4399
  UNDEFINED,
4323
4400
  addCustomCommand,
4324
4401
  addCustomTab,
4325
4402
  devtools,
4326
- fnTypeRE,
4327
4403
  formatInspectorStateValue,
4328
4404
  getInspectorStateValueType,
4329
- getRawValue,
4330
- now,
4405
+ getRaw,
4331
4406
  onDevToolsClientConnected,
4332
4407
  onDevToolsConnected,
4333
4408
  parse,
4334
- rawTypeRE,
4335
4409
  removeCustomCommand,
4410
+ setDevToolsEnv,
4336
4411
  setupDevToolsPlugin,
4337
- specialTypeRE,
4338
4412
  stringify,
4339
- symbolRE,
4340
4413
  toEdit,
4341
4414
  toSubmit,
4342
- toggleComponentInspectorEnabled,
4343
- vueBuiltins
4415
+ toggleComponentInspectorEnabled
4344
4416
  });