@maizzle/framework
Version:
Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.
1,377 lines • 206 kB
JavaScript
import { At as onActivated, Bt as onUnmounted, Gn as reactive, Jn as shallowReactive, Pt as onDeactivated, St as inject, W as computed, Wt as provide, Xn as shallowRef, _n as watch, dt as getCurrentInstance, kt as nextTick, mt as h, qn as ref, rr as unref, rt as defineComponent, vn as watchEffect } from "./vue.runtime.esm-bundler-Dz9O_TVp.js";
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/vue-router/dist/useApi-s_02lHjl.js
/*!
* vue-router v5.1.0
* (c) 2026 Eduardo San Martin Morote
* @license MIT
*/
var isBrowser$1 = typeof document !== "undefined";
/**
* Allows differentiating lazy components from functional components and vue-class-component
* @internal
*
* @param component
*/
function isRouteComponent(component) {
return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component;
}
function isESModule(obj) {
return obj.__esModule || obj[Symbol.toStringTag] === "Module" || obj.default && isRouteComponent(obj.default);
}
var assign = Object.assign;
function applyToParams(fn, params) {
const newParams = {};
for (const key in params) {
const value = params[key];
newParams[key] = isArray(value) ? value.map(fn) : fn(value);
}
return newParams;
}
var noop = () => {};
/**
* Typesafe alternative to Array.isArray
* https://github.com/microsoft/TypeScript/pull/48228
*
* @internal
*/
var isArray = Array.isArray;
function mergeOptions(defaults, partialOptions) {
const options = {};
for (const key in defaults) options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
return options;
}
var NavigationFailureSymbol = Symbol("navigation failure");
/**
* Enumeration with all possible types for navigation failures. Can be passed to
* {@link isNavigationFailure} to check for specific failures.
*/
var NavigationFailureType = /* @__PURE__ */ function(NavigationFailureType) {
/**
* An aborted navigation is a navigation that failed because a navigation
* guard returned `false` or called `next(false)`
*/
NavigationFailureType[NavigationFailureType["aborted"] = 4] = "aborted";
/**
* A cancelled navigation is a navigation that failed because a more recent
* navigation finished started (not necessarily finished).
*/
NavigationFailureType[NavigationFailureType["cancelled"] = 8] = "cancelled";
/**
* A duplicated navigation is a navigation that failed because it was
* initiated while already being at the exact same location.
*/
NavigationFailureType[NavigationFailureType["duplicated"] = 16] = "duplicated";
return NavigationFailureType;
}({});
var ErrorTypeMessages = {
[1]({ location, currentLocation }) {
return `No match for\n ${JSON.stringify(location)}${currentLocation ? "\nwhile being at\n" + JSON.stringify(currentLocation) : ""}`;
},
[2]({ from, to }) {
return `Redirected from "${from.fullPath}" to "${stringifyRoute(to)}" via a navigation guard.`;
},
[4]({ from, to }) {
return `Navigation aborted from "${from.fullPath}" to "${to.fullPath}" via a navigation guard.`;
},
[8]({ from, to }) {
return `Navigation cancelled from "${from.fullPath}" to "${to.fullPath}" with a new navigation.`;
},
[16]({ from, to: _to }) {
return `Avoided redundant navigation to current location: "${from.fullPath}".`;
}
};
/**
* Creates a typed NavigationFailure object.
* @internal
* @param type - NavigationFailureType
* @param params - { from, to }
*/
function createRouterError(type, params) {
return assign(new Error(ErrorTypeMessages[type](params)), {
type,
[NavigationFailureSymbol]: true
}, params);
}
function isNavigationFailure(error, type) {
return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type));
}
var propertiesToLog = [
"params",
"query",
"hash"
];
function stringifyRoute(to) {
if (typeof to === "string") return to;
if (to.path != null) return to.path;
const location = {};
for (const key of propertiesToLog) if (key in to) location[key] = to[key];
return JSON.stringify(location, null, 2);
}
/**
* RouteRecord being rendered by the closest ancestor Router View. Used for
* `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
* Location Matched
*
* @internal
*/
var matchedRouteKey = Symbol("router view location matched");
/**
* Allows overriding the router view depth to control which component in
* `matched` is rendered. rvd stands for Router View Depth
*
* @internal
*/
var viewDepthKey = Symbol("router view depth");
/**
* Allows overriding the router instance returned by `useRouter` in tests. r
* stands for router
*
* @internal
*/
var routerKey = Symbol("router");
/**
* Allows overriding the current route returned by `useRoute` in tests. rl
* stands for route location
*
* @internal
*/
var routeLocationKey = Symbol("route location");
/**
* Allows overriding the current route used by router-view. Internally this is
* used when the `route` prop is passed.
*
* @internal
*/
var routerViewLocationKey = Symbol("router view location");
/**
* Returns the router instance. Equivalent to using `$router` inside
* templates.
*/
function useRouter() {
return inject(routerKey);
}
/**
* Returns the current route location. Equivalent to using `$route` inside
* templates.
*/
function useRoute(_name) {
return inject(routeLocationKey);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@vue/devtools-shared/dist/index.js
var __create$1 = Object.create;
var __defProp$1 = Object.defineProperty;
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames$1 = Object.getOwnPropertyNames;
var __getProtoOf$1 = Object.getPrototypeOf;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __commonJSMin$1 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __copyProps$1 = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$1(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var isBrowser = typeof navigator !== "undefined";
var target = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : {};
typeof target.chrome !== "undefined" && target.chrome.devtools;
isBrowser && (target.self, target.top);
typeof navigator !== "undefined" && navigator.userAgent?.toLowerCase().includes("electron");
typeof window !== "undefined" && window.__NUXT__;
var import_rfdc = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
module.exports = rfdc;
function copyBuffer(cur) {
if (cur instanceof Buffer) return Buffer.from(cur);
return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length);
}
function rfdc(opts) {
opts = opts || {};
if (opts.circles) return rfdcCircles(opts);
const constructorHandlers = /* @__PURE__ */ new Map();
constructorHandlers.set(Date, (o) => new Date(o));
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
if (opts.constructorHandlers) for (const handler of opts.constructorHandlers) constructorHandlers.set(handler[0], handler[1]);
let handler = null;
return opts.proto ? cloneProto : clone;
function cloneArray(a, fn) {
const keys = Object.keys(a);
const a2 = new Array(keys.length);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
const cur = a[k];
if (typeof cur !== "object" || cur === null) a2[k] = cur;
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) a2[k] = handler(cur, fn);
else if (ArrayBuffer.isView(cur)) a2[k] = copyBuffer(cur);
else a2[k] = fn(cur);
}
return a2;
}
function clone(o) {
if (typeof o !== "object" || o === null) return o;
if (Array.isArray(o)) return cloneArray(o, clone);
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, clone);
const o2 = {};
for (const k in o) {
if (Object.hasOwnProperty.call(o, k) === false) continue;
const cur = o[k];
if (typeof cur !== "object" || cur === null) o2[k] = cur;
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, clone);
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
else o2[k] = clone(cur);
}
return o2;
}
function cloneProto(o) {
if (typeof o !== "object" || o === null) return o;
if (Array.isArray(o)) return cloneArray(o, cloneProto);
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, cloneProto);
const o2 = {};
for (const k in o) {
const cur = o[k];
if (typeof cur !== "object" || cur === null) o2[k] = cur;
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, cloneProto);
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
else o2[k] = cloneProto(cur);
}
return o2;
}
}
function rfdcCircles(opts) {
const refs = [];
const refsNew = [];
const constructorHandlers = /* @__PURE__ */ new Map();
constructorHandlers.set(Date, (o) => new Date(o));
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
if (opts.constructorHandlers) for (const handler of opts.constructorHandlers) constructorHandlers.set(handler[0], handler[1]);
let handler = null;
return opts.proto ? cloneProto : clone;
function cloneArray(a, fn) {
const keys = Object.keys(a);
const a2 = new Array(keys.length);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
const cur = a[k];
if (typeof cur !== "object" || cur === null) a2[k] = cur;
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) a2[k] = handler(cur, fn);
else if (ArrayBuffer.isView(cur)) a2[k] = copyBuffer(cur);
else {
const index = refs.indexOf(cur);
if (index !== -1) a2[k] = refsNew[index];
else a2[k] = fn(cur);
}
}
return a2;
}
function clone(o) {
if (typeof o !== "object" || o === null) return o;
if (Array.isArray(o)) return cloneArray(o, clone);
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, clone);
const o2 = {};
refs.push(o);
refsNew.push(o2);
for (const k in o) {
if (Object.hasOwnProperty.call(o, k) === false) continue;
const cur = o[k];
if (typeof cur !== "object" || cur === null) o2[k] = cur;
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, clone);
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
else {
const i = refs.indexOf(cur);
if (i !== -1) o2[k] = refsNew[i];
else o2[k] = clone(cur);
}
}
refs.pop();
refsNew.pop();
return o2;
}
function cloneProto(o) {
if (typeof o !== "object" || o === null) return o;
if (Array.isArray(o)) return cloneArray(o, cloneProto);
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) return handler(o, cloneProto);
const o2 = {};
refs.push(o);
refsNew.push(o2);
for (const k in o) {
const cur = o[k];
if (typeof cur !== "object" || cur === null) o2[k] = cur;
else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) o2[k] = handler(cur, cloneProto);
else if (ArrayBuffer.isView(cur)) o2[k] = copyBuffer(cur);
else {
const i = refs.indexOf(cur);
if (i !== -1) o2[k] = refsNew[i];
else o2[k] = cloneProto(cur);
}
}
refs.pop();
refsNew.pop();
return o2;
}
}
})))(), 1);
var classifyRE = /(?:^|[-_/])(\w)/g;
function toUpper(_, c) {
return c ? c.toUpperCase() : "";
}
function classify(str) {
return str && `${str}`.replace(classifyRE, toUpper);
}
function basename(filename, ext) {
let normalizedFilename = filename.replace(/^[a-z]:/i, "").replace(/\\/g, "/");
if (normalizedFilename.endsWith(`index${ext}`)) normalizedFilename = normalizedFilename.replace(`/index${ext}`, ext);
const lastSlashIndex = normalizedFilename.lastIndexOf("/");
const baseNameWithExt = normalizedFilename.substring(lastSlashIndex + 1);
if (ext) {
const extIndex = baseNameWithExt.lastIndexOf(ext);
return baseNameWithExt.substring(0, extIndex);
}
return "";
}
/**
* @copyright [rfdc](https://github.com/davidmarkclements/rfdc)
* @description A really fast deep clone alternative
*/
var deepClone = (0, import_rfdc.default)({ circles: true });
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/perfect-debounce/dist/index.mjs
var DEBOUNCE_DEFAULTS = { trailing: true };
/**
Debounce functions
@param fn - Promise-returning/async function to debounce.
@param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
@returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
@example
```
import { debounce } from 'perfect-debounce';
const expensiveCall = async input => input;
const debouncedFn = debounce(expensiveCall, 200);
for (const number of [1, 2, 3]) {
console.log(await debouncedFn(number));
}
//=> 1
//=> 2
//=> 3
```
*/
function debounce(fn, wait = 25, options = {}) {
options = {
...DEBOUNCE_DEFAULTS,
...options
};
if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
let leadingValue;
let timeout;
let resolveList = [];
let currentPromise;
let trailingArgs;
const applyFn = (_this, args) => {
currentPromise = _applyPromised(fn, _this, args);
currentPromise.finally(() => {
currentPromise = null;
if (options.trailing && trailingArgs && !timeout) {
const promise = applyFn(_this, trailingArgs);
trailingArgs = null;
return promise;
}
});
return currentPromise;
};
const debounced = function(...args) {
if (options.trailing) trailingArgs = args;
if (currentPromise) return currentPromise;
return new Promise((resolve) => {
const shouldCallNow = !timeout && options.leading;
clearTimeout(timeout);
timeout = setTimeout(() => {
timeout = null;
const promise = options.leading ? leadingValue : applyFn(this, args);
trailingArgs = null;
for (const _resolve of resolveList) _resolve(promise);
resolveList = [];
}, wait);
if (shouldCallNow) {
leadingValue = applyFn(this, args);
resolve(leadingValue);
} else resolveList.push(resolve);
});
};
const _clearTimeout = (timer) => {
if (timer) {
clearTimeout(timer);
timeout = null;
}
};
debounced.isPending = () => !!timeout;
debounced.cancel = () => {
_clearTimeout(timeout);
resolveList = [];
trailingArgs = null;
};
debounced.flush = () => {
_clearTimeout(timeout);
if (!trailingArgs || currentPromise) return;
const args = trailingArgs;
trailingArgs = null;
return applyFn(this, args);
};
return debounced;
}
async function _applyPromised(fn, _this, args) {
return await fn.apply(_this, args);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@vue/devtools-kit/node_modules/hookable/dist/index.mjs
function flatHooks(configHooks, hooks = {}, parentName) {
for (const key in configHooks) {
const subHook = configHooks[key];
const name = parentName ? `${parentName}:${key}` : key;
if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name);
else if (typeof subHook === "function") hooks[name] = subHook;
}
return hooks;
}
var defaultTask = { run: (function_) => function_() };
var _createTask = () => defaultTask;
var createTask = typeof console.createTask !== "undefined" ? console.createTask : _createTask;
function serialTaskCaller(hooks, args) {
const task = createTask(args.shift());
return hooks.reduce((promise, hookFunction) => promise.then(() => task.run(() => hookFunction(...args))), Promise.resolve());
}
function parallelTaskCaller(hooks, args) {
const task = createTask(args.shift());
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
}
function callEachWith(callbacks, arg0) {
for (const callback of [...callbacks]) callback(arg0);
}
var Hookable = class {
constructor() {
this._hooks = {};
this._before = void 0;
this._after = void 0;
this._deprecatedMessages = void 0;
this._deprecatedHooks = {};
this.hook = this.hook.bind(this);
this.callHook = this.callHook.bind(this);
this.callHookWith = this.callHookWith.bind(this);
}
hook(name, function_, options = {}) {
if (!name || typeof function_ !== "function") return () => {};
const originalName = name;
let dep;
while (this._deprecatedHooks[name]) {
dep = this._deprecatedHooks[name];
name = dep.to;
}
if (dep && !options.allowDeprecated) {
let message = dep.message;
if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set();
if (!this._deprecatedMessages.has(message)) {
console.warn(message);
this._deprecatedMessages.add(message);
}
}
if (!function_.name) try {
Object.defineProperty(function_, "name", {
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
configurable: true
});
} catch {}
this._hooks[name] = this._hooks[name] || [];
this._hooks[name].push(function_);
return () => {
if (function_) {
this.removeHook(name, function_);
function_ = void 0;
}
};
}
hookOnce(name, function_) {
let _unreg;
let _function = (...arguments_) => {
if (typeof _unreg === "function") _unreg();
_unreg = void 0;
_function = void 0;
return function_(...arguments_);
};
_unreg = this.hook(name, _function);
return _unreg;
}
removeHook(name, function_) {
if (this._hooks[name]) {
const index = this._hooks[name].indexOf(function_);
if (index !== -1) this._hooks[name].splice(index, 1);
if (this._hooks[name].length === 0) delete this._hooks[name];
}
}
deprecateHook(name, deprecated) {
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
const _hooks = this._hooks[name] || [];
delete this._hooks[name];
for (const hook of _hooks) this.hook(name, hook);
}
deprecateHooks(deprecatedHooks) {
Object.assign(this._deprecatedHooks, deprecatedHooks);
for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]);
}
addHooks(configHooks) {
const hooks = flatHooks(configHooks);
const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key]));
return () => {
for (const unreg of removeFns.splice(0, removeFns.length)) unreg();
};
}
removeHooks(configHooks) {
const hooks = flatHooks(configHooks);
for (const key in hooks) this.removeHook(key, hooks[key]);
}
removeAllHooks() {
for (const key in this._hooks) delete this._hooks[key];
}
callHook(name, ...arguments_) {
arguments_.unshift(name);
return this.callHookWith(serialTaskCaller, name, ...arguments_);
}
callHookParallel(name, ...arguments_) {
arguments_.unshift(name);
return this.callHookWith(parallelTaskCaller, name, ...arguments_);
}
callHookWith(caller, name, ...arguments_) {
const event = this._before || this._after ? {
name,
args: arguments_,
context: {}
} : void 0;
if (this._before) callEachWith(this._before, event);
const result = caller(name in this._hooks ? [...this._hooks[name]] : [], arguments_);
if (result instanceof Promise) return result.finally(() => {
if (this._after && event) callEachWith(this._after, event);
});
if (this._after && event) callEachWith(this._after, event);
return result;
}
beforeEach(function_) {
this._before = this._before || [];
this._before.push(function_);
return () => {
if (this._before !== void 0) {
const index = this._before.indexOf(function_);
if (index !== -1) this._before.splice(index, 1);
}
};
}
afterEach(function_) {
this._after = this._after || [];
this._after.push(function_);
return () => {
if (this._after !== void 0) {
const index = this._after.indexOf(function_);
if (index !== -1) this._after.splice(index, 1);
}
};
}
};
function createHooks() {
return new Hookable();
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@vue/devtools-kit/node_modules/birpc/dist/index.mjs
var { clearTimeout: clearTimeout$1, setTimeout: setTimeout$1 } = globalThis;
Math.random.bind(Math);
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
function getComponentTypeName(options) {
if (typeof options === "function") return options.displayName || options.name || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || "";
const name = options.name || options._componentTag || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options.__name;
if (name === "index" && options.__file?.endsWith("index.vue")) return "";
return name;
}
function getComponentFileName(options) {
const file = options.__file;
if (file) return classify(basename(file, ".vue"));
}
function saveComponentGussedName(instance, name) {
instance.type.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ = name;
return name;
}
function getAppRecord(instance) {
if (instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__) return instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
else if (instance.root) return instance.appContext.app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
}
function isFragment(instance) {
const subTreeType = instance.subTree?.type;
const appRecord = getAppRecord(instance);
if (appRecord) return appRecord?.types?.Fragment === subTreeType;
return false;
}
/**
* Get the appropriate display name for an instance.
*
* @param {Vue} instance
* @return {string}
*/
function getInstanceName(instance) {
const name = getComponentTypeName(instance?.type || {});
if (name) return name;
if (instance?.root === instance) return "Root";
for (const key in instance.parent?.type?.components) if (instance.parent.type.components[key] === instance?.type) return saveComponentGussedName(instance, key);
for (const key in instance.appContext?.components) if (instance.appContext.components[key] === instance?.type) return saveComponentGussedName(instance, key);
const fileName = getComponentFileName(instance?.type || {});
if (fileName) return fileName;
return "Anonymous Component";
}
/**
* Returns a devtools unique id for instance.
* @param {Vue} instance
*/
function getUniqueComponentId(instance) {
return `${instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0}:${instance === instance?.root ? "root" : instance.uid}`;
}
function getComponentInstance(appRecord, instanceId) {
instanceId = instanceId || `${appRecord.id}:root`;
return appRecord.instanceMap.get(instanceId) || appRecord.instanceMap.get(":root");
}
function createRect() {
const rect = {
top: 0,
bottom: 0,
left: 0,
right: 0,
get width() {
return rect.right - rect.left;
},
get height() {
return rect.bottom - rect.top;
}
};
return rect;
}
var range;
function getTextRect(node) {
if (!range) range = document.createRange();
range.selectNode(node);
return range.getBoundingClientRect();
}
function getFragmentRect(vnode) {
const rect = createRect();
if (!vnode.children) return rect;
for (let i = 0, l = vnode.children.length; i < l; i++) {
const childVnode = vnode.children[i];
let childRect;
if (childVnode.component) childRect = getComponentBoundingRect(childVnode.component);
else if (childVnode.el) {
const el = childVnode.el;
if (el.nodeType === 1 || el.getBoundingClientRect) childRect = el.getBoundingClientRect();
else if (el.nodeType === 3 && el.data.trim()) childRect = getTextRect(el);
}
if (childRect) mergeRects(rect, childRect);
}
return rect;
}
function mergeRects(a, b) {
if (!a.top || b.top < a.top) a.top = b.top;
if (!a.bottom || b.bottom > a.bottom) a.bottom = b.bottom;
if (!a.left || b.left < a.left) a.left = b.left;
if (!a.right || b.right > a.right) a.right = b.right;
return a;
}
var DEFAULT_RECT = {
top: 0,
left: 0,
right: 0,
bottom: 0,
width: 0,
height: 0
};
function getComponentBoundingRect(instance) {
const el = instance.subTree.el;
if (typeof window === "undefined") return DEFAULT_RECT;
if (isFragment(instance)) return getFragmentRect(instance.subTree);
else if (el?.nodeType === 1) return el?.getBoundingClientRect();
else if (instance.subTree.component) return getComponentBoundingRect(instance.subTree.component);
else return DEFAULT_RECT;
}
function getRootElementsFromComponentInstance(instance) {
if (isFragment(instance)) return getFragmentRootElements(instance.subTree);
if (!instance.subTree) return [];
return [instance.subTree.el];
}
function getFragmentRootElements(vnode) {
if (!vnode.children) return [];
const list = [];
vnode.children.forEach((childVnode) => {
if (childVnode.component) list.push(...getRootElementsFromComponentInstance(childVnode.component));
else if (childVnode?.el) list.push(childVnode.el);
});
return list;
}
var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
var COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
var INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
var containerStyles = {
display: "block",
zIndex: 2147483640,
position: "fixed",
backgroundColor: "#42b88325",
border: "1px solid #42b88350",
borderRadius: "5px",
transition: "all 0.1s ease-in",
pointerEvents: "none"
};
var cardStyles = {
fontFamily: "Arial, Helvetica, sans-serif",
padding: "5px 8px",
borderRadius: "4px",
textAlign: "left",
position: "absolute",
left: 0,
color: "#e9e9e9",
fontSize: "14px",
fontWeight: 600,
lineHeight: "24px",
backgroundColor: "#42b883",
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
};
var indicatorStyles = {
display: "inline-block",
fontWeight: 400,
fontStyle: "normal",
fontSize: "12px",
opacity: .7
};
function getContainerElement() {
return document.getElementById(CONTAINER_ELEMENT_ID);
}
function getCardElement() {
return document.getElementById(CARD_ELEMENT_ID);
}
function getIndicatorElement() {
return document.getElementById(INDICATOR_ELEMENT_ID);
}
function getNameElement() {
return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
}
function getStyles(bounds) {
return {
left: `${Math.round(bounds.left * 100) / 100}px`,
top: `${Math.round(bounds.top * 100) / 100}px`,
width: `${Math.round(bounds.width * 100) / 100}px`,
height: `${Math.round(bounds.height * 100) / 100}px`
};
}
function create(options) {
const containerEl = document.createElement("div");
containerEl.id = options.elementId ?? CONTAINER_ELEMENT_ID;
Object.assign(containerEl.style, {
...containerStyles,
...getStyles(options.bounds),
...options.style
});
const cardEl = document.createElement("span");
cardEl.id = CARD_ELEMENT_ID;
Object.assign(cardEl.style, {
...cardStyles,
top: options.bounds.top < 35 ? 0 : "-35px"
});
const nameEl = document.createElement("span");
nameEl.id = COMPONENT_NAME_ELEMENT_ID;
nameEl.innerHTML = `<${options.name}> `;
const indicatorEl = document.createElement("i");
indicatorEl.id = INDICATOR_ELEMENT_ID;
indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
Object.assign(indicatorEl.style, indicatorStyles);
cardEl.appendChild(nameEl);
cardEl.appendChild(indicatorEl);
containerEl.appendChild(cardEl);
document.body.appendChild(containerEl);
return containerEl;
}
function update(options) {
const containerEl = getContainerElement();
const cardEl = getCardElement();
const nameEl = getNameElement();
const indicatorEl = getIndicatorElement();
if (containerEl) {
Object.assign(containerEl.style, {
...containerStyles,
...getStyles(options.bounds)
});
Object.assign(cardEl.style, { top: options.bounds.top < 35 ? 0 : "-35px" });
nameEl.innerHTML = `<${options.name}> `;
indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
}
}
function highlight(instance) {
const bounds = getComponentBoundingRect(instance);
if (!bounds.width && !bounds.height) return;
const name = getInstanceName(instance);
getContainerElement() ? update({
bounds,
name
}) : create({
bounds,
name
});
}
function unhighlight() {
const el = getContainerElement();
if (el) el.style.display = "none";
}
var inspectInstance = null;
function inspectFn(e) {
const target = e.target;
if (target) {
const instance = target.__vueParentComponent;
if (instance) {
inspectInstance = instance;
if (instance.vnode.el) {
const bounds = getComponentBoundingRect(instance);
const name = getInstanceName(instance);
getContainerElement() ? update({
bounds,
name
}) : create({
bounds,
name
});
}
}
}
}
function selectComponentFn(e, cb) {
e.preventDefault();
e.stopPropagation();
if (inspectInstance) cb(getUniqueComponentId(inspectInstance));
}
var inspectComponentHighLighterSelectFn = null;
function cancelInspectComponentHighLighter() {
unhighlight();
window.removeEventListener("mouseover", inspectFn);
window.removeEventListener("click", inspectComponentHighLighterSelectFn, true);
inspectComponentHighLighterSelectFn = null;
}
function inspectComponentHighLighter() {
window.addEventListener("mouseover", inspectFn);
return new Promise((resolve) => {
function onSelect(e) {
e.preventDefault();
e.stopPropagation();
selectComponentFn(e, (id) => {
window.removeEventListener("click", onSelect, true);
inspectComponentHighLighterSelectFn = null;
window.removeEventListener("mouseover", inspectFn);
const el = getContainerElement();
if (el) el.style.display = "none";
resolve(JSON.stringify({ id }));
});
}
inspectComponentHighLighterSelectFn = onSelect;
window.addEventListener("click", onSelect, true);
});
}
function scrollToComponent(options) {
const instance = getComponentInstance(activeAppRecord.value, options.id);
if (instance) {
const [el] = getRootElementsFromComponentInstance(instance);
if (typeof el.scrollIntoView === "function") el.scrollIntoView({ behavior: "smooth" });
else {
const bounds = getComponentBoundingRect(instance);
const scrollTarget = document.createElement("div");
const styles = {
...getStyles(bounds),
position: "absolute"
};
Object.assign(scrollTarget.style, styles);
document.body.appendChild(scrollTarget);
scrollTarget.scrollIntoView({ behavior: "smooth" });
setTimeout(() => {
document.body.removeChild(scrollTarget);
}, 2e3);
}
setTimeout(() => {
const bounds = getComponentBoundingRect(instance);
if (bounds.width || bounds.height) {
const name = getInstanceName(instance);
const el = getContainerElement();
el ? update({
...options,
name,
bounds
}) : create({
...options,
name,
bounds
});
setTimeout(() => {
if (el) el.style.display = "none";
}, 1500);
}
}, 1200);
}
}
target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ ??= true;
function waitForInspectorInit(cb) {
let total = 0;
const timer = setInterval(() => {
if (target.__VUE_INSPECTOR__) {
clearInterval(timer);
total += 30;
cb();
}
if (total >= 5e3) clearInterval(timer);
}, 30);
}
function setupInspector() {
const inspector = target.__VUE_INSPECTOR__;
const _openInEditor = inspector.openInEditor;
inspector.openInEditor = async (...params) => {
inspector.disable();
_openInEditor(...params);
};
}
function getComponentInspector() {
return new Promise((resolve) => {
function setup() {
setupInspector();
resolve(target.__VUE_INSPECTOR__);
}
if (!target.__VUE_INSPECTOR__) waitForInspectorInit(() => {
setup();
});
else setup();
});
}
/**
* To prevent include a **HUGE** vue package in the final bundle of chrome ext / electron
* we stub the necessary vue module.
* This implementation is based on the 1c3327a0fa5983aa9078e3f7bb2330f572435425 commit
*/
/**
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/constants.ts#L17-L23)
*/
var ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
ReactiveFlags["SKIP"] = "__v_skip";
ReactiveFlags["IS_REACTIVE"] = "__v_isReactive";
ReactiveFlags["IS_READONLY"] = "__v_isReadonly";
ReactiveFlags["IS_SHALLOW"] = "__v_isShallow";
ReactiveFlags["RAW"] = "__v_raw";
return ReactiveFlags;
}({});
/**
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L330-L332)
*/
function isReadonly(value) {
return !!(value && value[ReactiveFlags.IS_READONLY]);
}
/**
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L312-L317)
*/
function isReactive$1(value) {
if (isReadonly(value)) return isReactive$1(value[ReactiveFlags.RAW]);
return !!(value && value[ReactiveFlags.IS_REACTIVE]);
}
function isRef$1(r) {
return !!(r && r.__v_isRef === true);
}
/**
* @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L372-L375)
*/
function toRaw$1(observed) {
const raw = observed && observed[ReactiveFlags.RAW];
return raw ? toRaw$1(raw) : observed;
}
var StateEditor = class {
constructor() {
this.refEditor = new RefStateEditor();
}
set(object, path, value, cb) {
const sections = Array.isArray(path) ? path : path.split(".");
while (sections.length > 1) {
const section = sections.shift();
if (object instanceof Map) object = object.get(section);
else if (object instanceof Set) object = Array.from(object.values())[section];
else object = object[section];
if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
}
const field = sections[0];
const item = this.refEditor.get(object)[field];
if (cb) cb(object, field, value);
else if (this.refEditor.isRef(item)) this.refEditor.set(item, value);
else object[field] = value;
}
get(object, path) {
const sections = Array.isArray(path) ? path : path.split(".");
for (let i = 0; i < sections.length; i++) {
if (object instanceof Map) object = object.get(sections[i]);
else object = object[sections[i]];
if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
if (!object) return void 0;
}
return object;
}
has(object, path, parent = false) {
if (typeof object === "undefined") return false;
const sections = Array.isArray(path) ? path.slice() : path.split(".");
const size = !parent ? 1 : 2;
while (object && sections.length > size) {
const section = sections.shift();
object = object[section];
if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
}
return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
}
createDefaultSetCallback(state) {
return (object, field, value) => {
if (state.remove || state.newKey) if (Array.isArray(object)) object.splice(field, 1);
else if (toRaw$1(object) instanceof Map) object.delete(field);
else if (toRaw$1(object) instanceof Set) object.delete(Array.from(object.values())[field]);
else Reflect.deleteProperty(object, field);
if (!state.remove) {
const target = object[state.newKey || field];
if (this.refEditor.isRef(target)) this.refEditor.set(target, value);
else if (toRaw$1(object) instanceof Map) object.set(state.newKey || field, value);
else if (toRaw$1(object) instanceof Set) object.add(value);
else object[state.newKey || field] = value;
}
};
}
};
var RefStateEditor = class {
set(ref, value) {
if (isRef$1(ref)) ref.value = value;
else {
if (ref instanceof Set && Array.isArray(value)) {
ref.clear();
value.forEach((v) => ref.add(v));
return;
}
const currentKeys = Object.keys(value);
if (ref instanceof Map) {
const previousKeysSet = new Set(ref.keys());
currentKeys.forEach((key) => {
ref.set(key, Reflect.get(value, key));
previousKeysSet.delete(key);
});
previousKeysSet.forEach((key) => ref.delete(key));
return;
}
const previousKeysSet = new Set(Object.keys(ref));
currentKeys.forEach((key) => {
Reflect.set(ref, key, Reflect.get(value, key));
previousKeysSet.delete(key);
});
previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
}
}
get(ref) {
return isRef$1(ref) ? ref.value : ref;
}
isRef(ref) {
return isRef$1(ref) || isReactive$1(ref);
}
};
new StateEditor();
var TIMELINE_LAYERS_STATE_STORAGE_ID = "__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS_STATE__";
function getTimelineLayersStateFromStorage() {
if (typeof window === "undefined" || !isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
recordingState: false,
mouseEventEnabled: false,
keyboardEventEnabled: false,
componentEventEnabled: false,
performanceEventEnabled: false,
selected: ""
};
const state = typeof localStorage.getItem !== "undefined" ? localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID) : null;
return state ? JSON.parse(state) : {
recordingState: false,
mouseEventEnabled: false,
keyboardEventEnabled: false,
componentEventEnabled: false,
performanceEventEnabled: false,
selected: ""
};
}
target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS ??= [];
var devtoolsTimelineLayers = new Proxy(target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS, { get(target, prop, receiver) {
return Reflect.get(target, prop, receiver);
} });
function addTimelineLayer(options, descriptor) {
devtoolsState.timelineLayersState[descriptor.id] = false;
devtoolsTimelineLayers.push({
...options,
descriptorId: descriptor.id,
appRecord: getAppRecord(descriptor.app)
});
}
target.__VUE_DEVTOOLS_KIT_INSPECTOR__ ??= [];
var devtoolsInspector = new Proxy(target.__VUE_DEVTOOLS_KIT_INSPECTOR__, { get(target, prop, receiver) {
return Reflect.get(target, prop, receiver);
} });
var callInspectorUpdatedHook = debounce(() => {
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.SEND_INSPECTOR_TO_CLIENT, getActiveInspectors());
});
function addInspector(inspector, descriptor) {
devtoolsInspector.push({
options: inspector,
descriptor,
treeFilterPlaceholder: inspector.treeFilterPlaceholder ?? "Search tree...",
stateFilterPlaceholder: inspector.stateFilterPlaceholder ?? "Search state...",
treeFilter: "",
selectedNodeId: "",
appRecord: getAppRecord(descriptor.app)
});
callInspectorUpdatedHook();
}
function getActiveInspectors() {
return devtoolsInspector.filter((inspector) => inspector.descriptor.app === activeAppRecord.value.app).filter((inspector) => inspector.descriptor.id !== "components").map((inspector) => {
const descriptor = inspector.descriptor;
const options = inspector.options;
return {
id: options.id,
label: options.label,
logo: descriptor.logo,
icon: `custom-ic-baseline-${options?.icon?.replace(/_/g, "-")}`,
packageName: descriptor.packageName,
homepage: descriptor.homepage,
pluginId: descriptor.id
};
});
}
function getInspector(id, app) {
return devtoolsInspector.find((inspector) => inspector.options.id === id && (app ? inspector.descriptor.app === app : true));
}
var DevToolsV6PluginAPIHookKeys = /* @__PURE__ */ function(DevToolsV6PluginAPIHookKeys) {
DevToolsV6PluginAPIHookKeys["VISIT_COMPONENT_TREE"] = "visitComponentTree";
DevToolsV6PluginAPIHookKeys["INSPECT_COMPONENT"] = "inspectComponent";
DevToolsV6PluginAPIHookKeys["EDIT_COMPONENT_STATE"] = "editComponentState";
DevToolsV6PluginAPIHookKeys["GET_INSPECTOR_TREE"] = "getInspectorTree";
DevToolsV6PluginAPIHookKeys["GET_INSPECTOR_STATE"] = "getInspectorState";
DevToolsV6PluginAPIHookKeys["EDIT_INSPECTOR_STATE"] = "editInspectorState";
DevToolsV6PluginAPIHookKeys["INSPECT_TIMELINE_EVENT"] = "inspectTimelineEvent";
DevToolsV6PluginAPIHookKeys["TIMELINE_CLEARED"] = "timelineCleared";
DevToolsV6PluginAPIHookKeys["SET_PLUGIN_SETTINGS"] = "setPluginSettings";
return DevToolsV6PluginAPIHookKeys;
}({});
var DevToolsContextHookKeys = /* @__PURE__ */ function(DevToolsContextHookKeys) {
DevToolsContextHookKeys["ADD_INSPECTOR"] = "addInspector";
DevToolsContextHookKeys["SEND_INSPECTOR_TREE"] = "sendInspectorTree";
DevToolsContextHookKeys["SEND_INSPECTOR_STATE"] = "sendInspectorState";
DevToolsContextHookKeys["CUSTOM_INSPECTOR_SELECT_NODE"] = "customInspectorSelectNode";
DevToolsContextHookKeys["TIMELINE_LAYER_ADDED"] = "timelineLayerAdded";
DevToolsContextHookKeys["TIMELINE_EVENT_ADDED"] = "timelineEventAdded";
DevToolsContextHookKeys["GET_COMPONENT_INSTANCES"] = "getComponentInstances";
DevToolsContextHookKeys["GET_COMPONENT_BOUNDS"] = "getComponentBounds";
DevToolsContextHookKeys["GET_COMPONENT_NAME"] = "getComponentName";
DevToolsContextHookKeys["COMPONENT_HIGHLIGHT"] = "componentHighlight";
DevToolsContextHookKeys["COMPONENT_UNHIGHLIGHT"] = "componentUnhighlight";
return DevToolsContextHookKeys;
}({});
var DevToolsMessagingHookKeys = /* @__PURE__ */ function(DevToolsMessagingHookKeys) {
DevToolsMessagingHookKeys["SEND_INSPECTOR_TREE_TO_CLIENT"] = "sendInspectorTreeToClient";
DevToolsMessagingHookKeys["SEND_INSPECTOR_STATE_TO_CLIENT"] = "sendInspectorStateToClient";
DevToolsMessagingHookKeys["SEND_TIMELINE_EVENT_TO_CLIENT"] = "sendTimelineEventToClient";
DevToolsMessagingHookKeys["SEND_INSPECTOR_TO_CLIENT"] = "sendInspectorToClient";
DevToolsMessagingHookKeys["SEND_ACTIVE_APP_UNMOUNTED_TO_CLIENT"] = "sendActiveAppUpdatedToClient";
DevToolsMessagingHookKeys["DEVTOOLS_STATE_UPDATED"] = "devtoolsStateUpdated";
DevToolsMessagingHookKeys["DEVTOOLS_CONNECTED_UPDATED"] = "devtoolsConnectedUpdated";
DevToolsMessagingHookKeys["ROUTER_INFO_UPDATED"] = "routerInfoUpdated";
return DevToolsMessagingHookKeys;
}({});
function createDevToolsCtxHooks() {
const hooks = createHooks();
hooks.hook(DevToolsContextHookKeys.ADD_INSPECTOR, ({ inspector, plugin }) => {
addInspector(inspector, plugin.descriptor);
});
const debounceSendInspectorTree = debounce(async ({ inspectorId, plugin }) => {
if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
const inspector = getInspector(inspectorId, plugin.descriptor.app);
const _payload = {
app: plugin.descriptor.app,
inspectorId,
filter: inspector?.treeFilter || "",
rootNodes: []
};
await new Promise((resolve) => {
hooks.callHookWith(async (callbacks) => {
await Promise.all(callbacks.map((cb) => cb(_payload)));
resolve();
}, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
});
hooks.callHookWith(async (callbacks) => {
await Promise.all(callbacks.map((cb) => cb({
inspectorId,
rootNodes: _payload.rootNodes
})));
}, DevToolsMessagingHookKeys.SEND_INSPECTOR_TREE_TO_CLIENT);
}, 120);
hooks.hook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, debounceSendInspectorTree);
const debounceSendInspectorState = debounce(async ({ inspectorId, plugin }) => {
if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
const inspector = getInspector(inspectorId, plugin.descriptor.app);
const _payload = {
app: plugin.descriptor.app,
inspectorId,
nodeId: inspector?.selectedNodeId || "",
state: null
};
const ctx = { currentTab: `custom-inspector:${inspectorId}` };
if (_payload.nodeId) await new Promise((resolve) => {
hooks.callHookWith(async (callbacks) => {
await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
resolve();
}, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
});
hooks.callHookWith(async (callbacks) => {
await Promise.all(callbacks.map((cb) => cb({
inspectorId,
nodeId: _payload.nodeId,
state: _payload.state
})));
}, DevToolsMessagingHookKeys.SEND_INSPECTOR_STATE_TO_CLIENT);
}, 120);
hooks.hook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, debounceSendInspectorState);
hooks.hook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, ({ inspectorId, nodeId, plugin }) => {
const inspector = getInspector(inspectorId, plugin.descriptor.app);
if (!inspector) return;
inspector.selectedNodeId = nodeId;
});
hooks.hook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, ({ options, plugin }) => {
addTimelineLayer(options, plugin.descriptor);
});
hooks.hook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, ({ options, plugin }) => {
if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && ![
"performance",
"component-event",
"keyboard",
"mouse"
].includes(options.layerId)) return;
hooks.callHookWith(async (callbacks) => {
await Promise.all(callbacks.map((cb) => cb(options)));
}, DevToolsMessagingHookKeys.SEND_TIMELINE_EVENT_TO_CLIENT);
});
hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, async ({ app }) => {
const appRecord = app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
if (!appRecord) return null;
const appId = appRecord.id.toString();
return [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
});
hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, async ({ instance }) => {
return getComponentBoundingRect(instance);
});
hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_NAME, ({ instance }) => {
return getInstanceName(instance);
});
hooks.hook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, ({ uid }) => {
const instance = activeAppRecord.value.instanceMap.get(uid);
if (instance) highlight(instance);
});
hooks.hook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT, () => {
unhighlight();
});
return hooks;
}
target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ ??= [];
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ ??= {};
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ ??= "";
target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__ ??= [];
target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__ ??= [];
var STATE_KEY = "__VUE_DEVTOOLS_KIT_GLOBAL_STATE__";
function initStateFactory() {
return {
connected: false,
clientConnected: false,
vitePluginDetected: true,
appRecords: [],
activeAppRecordId: "",
tabs: [],
commands: [],
highPerfModeEnabled: true,
devtoolsClientDetected: {},
perfUniqueGroupId: 0,
timelineLayersState: getTimelineLayersStateFromStorage()
};
}
target[STATE_KEY] ??= initStateFactory();
var callStateUpdatedHook = debounce((state) => {
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_STATE_UPDATED, { state });
});
debounce((state, oldState) => {
devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, {
state,
oldState
});
});
var devtoolsAppRecords = new Proxy(target.__VUE_DEVTOOLS_KIT_APP_RECORDS__, { get(_target, prop, receiver) {
if (prop === "value") return target.__VUE_DEVTOOLS_KIT_APP_RECORDS__;
return target.__VUE_DEVTOOLS_KIT_APP_RECORDS__[prop];
} });
var activeAppRecord = new Proxy(target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__, { get(_target, prop, receiver) {
if (prop === "value") return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__;
else if (prop === "id") return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__;
return target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__[prop];
} });
function updateAllStates() {
callStateUpdatedHook({
...target[STATE_KEY],
appRecords: devtoolsAppRecords.value,
activeAppRecordId: activeAppRecord.id,
tabs: target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__,
commands: target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__
});
}
function setActiveAppRecord(app) {
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ = app;
updateAllStates();
}
function setActiveAppRecordId(id) {
target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ = id;
updateAllStates();
}
var devtoolsState = new Proxy(target[STATE_KEY], {
get(target$3, property) {
if (property === "appRecords") return devtoolsAppRecords;
else if (property === "activeAppRecordId") return activeAppRecord.id;
else if (property === "tabs") return target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
else if (property === "commands") return target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
return target[STATE_KEY][property];
},
deleteProperty(target, property) {
delete target[property];
return true;
},
set(target$4, property, value) {
target$4[property] = value;
target[STATE_KEY][property] = value;
return true;
}
});
function openInEditor(options = {}) {
const { file, host, baseUrl = window.location.origin, line = 0, column = 0 } = options;
if (file) {
if (host === "chrome-extension") {
const fileName = file.replace(/\\/g, "\\\\");
const _baseUrl = window.VUE_DEVTOOLS_CONFIG?.openInEditorHost ?? "/";
fetch(`${_baseUrl}__open-in-editor?file=${encodeURI(file)}`).then((response) => {
if (!response.ok) {
const msg = `Opening component ${fileName} failed`;
console.log(`%c${msg}`, "color:red");
}
});
} else if (devtoolsState.vitePluginDetected) {
const _baseUrl = target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ ?? baseUrl;
target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column);
}
}
}
target.__VUE_DEVTOOLS_KIT_PLUGIN_BUF