@nuxt/devtools-nightly 0.0.0 → 2.0.0-beta.0-28940205.5b566fb

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.
Files changed (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/cli.mjs +2 -0
  4. package/dist/chunks/analyze-build.mjs +58 -0
  5. package/dist/chunks/module-main.mjs +2044 -0
  6. package/dist/chunks/plugin-metrics.mjs +68 -0
  7. package/dist/chunks/timeline.mjs +73 -0
  8. package/dist/chunks/vite-inspect.mjs +61 -0
  9. package/dist/chunks/vscode.mjs +195 -0
  10. package/dist/chunks/vue-devtools.mjs +30 -0
  11. package/dist/chunks/vue-inspector.mjs +15 -0
  12. package/dist/client/200.html +20 -0
  13. package/dist/client/404.html +20 -0
  14. package/dist/client/_nuxt/__blank-n15vnpb5.js +1 -0
  15. package/dist/client/_nuxt/analyze-build-kcwmvlyl.js +1 -0
  16. package/dist/client/_nuxt/assets-ivvrbi3q.js +16 -0
  17. package/dist/client/_nuxt/assets.css-hmxl533k.css +1 -0
  18. package/dist/client/_nuxt/b6bfxrb8.js +17 -0
  19. package/dist/client/_nuxt/builds/latest.json +1 -0
  20. package/dist/client/_nuxt/builds/meta/b8bbfd27-5704-4be8-a606-01af93c734ef.json +1 -0
  21. package/dist/client/_nuxt/client-c9f80qsp.js +1 -0
  22. package/dist/client/_nuxt/code-diff.vue-bhijg81q.js +8 -0
  23. package/dist/client/_nuxt/code-snippets.vue-i4e657wf.js +1 -0
  24. package/dist/client/_nuxt/components-krpx1826.js +1 -0
  25. package/dist/client/_nuxt/composable-item.vue-kwpzi9u7.js +1 -0
  26. package/dist/client/_nuxt/constants-b32h69zq.js +1 -0
  27. package/dist/client/_nuxt/custom-_name_-cepykbos.js +1 -0
  28. package/dist/client/_nuxt/default-mk5axw1k.js +1 -0
  29. package/dist/client/_nuxt/duration-display.vue-kqe6a4wx.js +1 -0
  30. package/dist/client/_nuxt/entry.css-nqz5coc9.css +1 -0
  31. package/dist/client/_nuxt/error-404-lp8coab3.js +1 -0
  32. package/dist/client/_nuxt/error-404.css-b3x40x40.css +1 -0
  33. package/dist/client/_nuxt/error-500-d4b6gi3u.js +1 -0
  34. package/dist/client/_nuxt/error-500.css-hilpkhd4.css +1 -0
  35. package/dist/client/_nuxt/error-ojb7cn7v.js +9 -0
  36. package/dist/client/_nuxt/filepath-item.vue-b829sn9l.js +1 -0
  37. package/dist/client/_nuxt/full-j8mngb76.js +1 -0
  38. package/dist/client/_nuxt/help-fab.css-ms50khsu.css +1 -0
  39. package/dist/client/_nuxt/help-fab.vue-gtlaa6k2.js +1 -0
  40. package/dist/client/_nuxt/hooks-htmew7il.js +1 -0
  41. package/dist/client/_nuxt/imports-18kqq3am.js +1 -0
  42. package/dist/client/_nuxt/index-dl6nn7ct.js +2 -0
  43. package/dist/client/_nuxt/index-e7wrzeix.js +1 -0
  44. package/dist/client/_nuxt/launch-page.vue-iyi310zf.js +1 -0
  45. package/dist/client/_nuxt/modules-hdu1ikfi.js +1 -0
  46. package/dist/client/_nuxt/nbadge-fktngirm.js +1 -0
  47. package/dist/client/_nuxt/ncheckbox.vue-fs1yhvat.js +1 -0
  48. package/dist/client/_nuxt/ncode-block.css-c9cb29at.css +1 -0
  49. package/dist/client/_nuxt/ncode-block.vue-gy1ero5j.js +2 -0
  50. package/dist/client/_nuxt/ndrawer.vue-cjxfdzsk.js +1 -0
  51. package/dist/client/_nuxt/ndropdown.vue-fe8ybtb0.js +1 -0
  52. package/dist/client/_nuxt/nicon-title.vue-ouqsubn7.js +1 -0
  53. package/dist/client/_nuxt/nlink.vue-jafnipxp.js +1 -0
  54. package/dist/client/_nuxt/nmarkdown.vue-hygash5x.js +1 -0
  55. package/dist/client/_nuxt/nnavbar.vue-d5x8tq5w.js +1 -0
  56. package/dist/client/_nuxt/none-i3w61o4x.js +1 -0
  57. package/dist/client/_nuxt/nsection-block-ivkmhmn9.js +1 -0
  58. package/dist/client/_nuxt/nsection-block.css-e7kbjm7k.css +1 -0
  59. package/dist/client/_nuxt/nselect-tabs.vue-sw71szzx.js +1 -0
  60. package/dist/client/_nuxt/nselect.vue-mkp3umn0.js +1 -0
  61. package/dist/client/_nuxt/open-graph-i5rptgvl.js +3 -0
  62. package/dist/client/_nuxt/open-graph.css-e21qzmvj.css +1 -0
  63. package/dist/client/_nuxt/overview-jzek603r.js +1 -0
  64. package/dist/client/_nuxt/pages-mhjzw1eo.js +1 -0
  65. package/dist/client/_nuxt/payload-kjhui3c5.js +1 -0
  66. package/dist/client/_nuxt/pinia-jy0feqo2.js +1 -0
  67. package/dist/client/_nuxt/plugins-d2vnj57a.js +1 -0
  68. package/dist/client/_nuxt/render-tree-malxu5t7.js +1 -0
  69. package/dist/client/_nuxt/runtime-configs-c8u0cuv7.js +1 -0
  70. package/dist/client/_nuxt/server-route-inputs.vue-dfs3eezs.js +1 -0
  71. package/dist/client/_nuxt/server-routes-ea89bftg.js +9 -0
  72. package/dist/client/_nuxt/server-tasks-guw0x7eh.js +1 -0
  73. package/dist/client/_nuxt/settings-nr7x6wel.js +1 -0
  74. package/dist/client/_nuxt/stacktrace-list.vue-cfyme80n.js +1 -0
  75. package/dist/client/_nuxt/state-components-f29eyhzi.js +1 -0
  76. package/dist/client/_nuxt/state-editor.vue-nd6tb0dn.js +1 -0
  77. package/dist/client/_nuxt/state-modules-gh2s62ky.js +1 -0
  78. package/dist/client/_nuxt/storage-d1qa6fff.js +1 -0
  79. package/dist/client/_nuxt/terminals-igsxvm6w.js +1 -0
  80. package/dist/client/_nuxt/terminals.css-mejv43xm.css +1 -0
  81. package/dist/client/_nuxt/timeline-lm6kcwsd.js +31 -0
  82. package/dist/client/_nuxt/timeline.css-lhkpu01p.css +1 -0
  83. package/dist/client/_nuxt/unocss-runtime-jzfgcoxk.js +1 -0
  84. package/dist/client/_nuxt/vendor/json-editor-vue-gi2fewby.js +3818 -0
  85. package/dist/client/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css +1 -0
  86. package/dist/client/_nuxt/vendor/markdown-it-fvu08dbs.js +16 -0
  87. package/dist/client/_nuxt/vendor/shiki-bnvxb5wv.js +147 -0
  88. package/dist/client/_nuxt/vendor/unocss-3uirpnla.js +2 -0
  89. package/dist/client/_nuxt/vendor/unocss.css-mhvipxpl.css +1 -0
  90. package/dist/client/_nuxt/vendor/vis-dlwijd5n.js +98 -0
  91. package/dist/client/_nuxt/vendor/xterm-dbpzgj7s.js +9 -0
  92. package/dist/client/_nuxt/vendor/xterm.css-egmhki83.css +32 -0
  93. package/dist/client/_nuxt/virtual-files-jzsbborg.js +1 -0
  94. package/dist/client/_nuxt/virtual-files.css-gqpg2wnb.css +1 -0
  95. package/dist/client/_nuxt/vue-virtual-scroller.esm-hx1s7s1b.js +2 -0
  96. package/dist/client/index.html +20 -0
  97. package/dist/client/nuxt.svg +3 -0
  98. package/dist/dirs.d.mts +7 -0
  99. package/dist/dirs.d.ts +7 -0
  100. package/dist/dirs.mjs +28 -0
  101. package/dist/module.cjs +5 -0
  102. package/dist/module.d.mts +9 -0
  103. package/dist/module.d.ts +9 -0
  104. package/dist/module.json +9 -0
  105. package/dist/module.mjs +6 -0
  106. package/dist/runtime/auth/index.html +76 -0
  107. package/dist/runtime/function-metrics-helpers.d.ts +3 -0
  108. package/dist/runtime/function-metrics-helpers.js +69 -0
  109. package/dist/runtime/nitro/inline.d.ts +3 -0
  110. package/dist/runtime/nitro/inline.js +6 -0
  111. package/dist/runtime/plugins/devtools.client.d.ts +2 -0
  112. package/dist/runtime/plugins/devtools.client.js +56 -0
  113. package/dist/runtime/plugins/devtools.server.d.ts +2 -0
  114. package/dist/runtime/plugins/devtools.server.js +7 -0
  115. package/dist/runtime/plugins/view/FrameBox.vue +167 -0
  116. package/dist/runtime/plugins/view/Main.vue +422 -0
  117. package/dist/runtime/plugins/view/client.d.ts +12 -0
  118. package/dist/runtime/plugins/view/client.js +332 -0
  119. package/dist/runtime/plugins/view/state.d.ts +5 -0
  120. package/dist/runtime/plugins/view/state.js +17 -0
  121. package/dist/runtime/plugins/view/utils.d.ts +31 -0
  122. package/dist/runtime/plugins/view/utils.js +156 -0
  123. package/dist/runtime/settings.d.ts +4 -0
  124. package/dist/runtime/settings.js +2 -0
  125. package/dist/runtime/shared/hooks.d.ts +2 -0
  126. package/dist/runtime/shared/hooks.js +33 -0
  127. package/dist/runtime/use-nuxt-devtools.d.ts +8 -0
  128. package/dist/runtime/use-nuxt-devtools.js +23 -0
  129. package/dist/runtime/vue-devtools/overlay.d.ts +1 -0
  130. package/dist/runtime/vue-devtools/overlay.js +8 -0
  131. package/dist/shared/devtools-nightly.2a48a9e5.d.mts +62 -0
  132. package/dist/shared/devtools-nightly.2a48a9e5.d.ts +62 -0
  133. package/dist/shared/devtools-nightly.5ac54dae.mjs +121 -0
  134. package/dist/types.d.mts +42 -0
  135. package/dist/types.d.ts +42 -0
  136. package/dist/types.mjs +1 -0
  137. package/package.json +123 -2
  138. package/types.d.ts +1 -0
@@ -0,0 +1,68 @@
1
+ function setup({ nuxt }) {
2
+ if (!nuxt.options.dev || nuxt.options.test)
3
+ return;
4
+ nuxt.hook("app:templates", (app) => {
5
+ app.templates.filter((i) => i.filename?.startsWith("plugins/")).forEach((i) => {
6
+ if (!i.getContents)
7
+ return;
8
+ const original = i.getContents;
9
+ i.getContents = async (...args) => {
10
+ let content = await original(...args);
11
+ const PAYLOAD_KEY = "__NUXT_DEVTOOLS_PLUGINS_METRIC__";
12
+ const WRAPPER_KEY = "__DEVTOOLS_WRAPPER__";
13
+ if (content.includes(PAYLOAD_KEY))
14
+ return content;
15
+ const snippets = `
16
+ if (!globalThis.${PAYLOAD_KEY}) {
17
+ Object.defineProperty(globalThis, '${PAYLOAD_KEY}', {
18
+ value: [],
19
+ enumerable: false,
20
+ configurable: true,
21
+ })
22
+ }
23
+
24
+ function ${WRAPPER_KEY} (plugin, src) {
25
+ if (!plugin)
26
+ return plugin
27
+
28
+ return defineNuxtPlugin({
29
+ ...plugin,
30
+ async setup (...args) {
31
+ const start = performance.now()
32
+ const result = await plugin.apply(this, args)
33
+ const end = performance.now()
34
+ globalThis.${PAYLOAD_KEY}.push({
35
+ src,
36
+ start,
37
+ end,
38
+ duration: end - start,
39
+ })
40
+ return result
41
+ }
42
+ })
43
+ }
44
+ `;
45
+ const imports = Array.from(content.matchAll(/(?:\n|^)import (.*) from ['"](.*)['"]/g)).map(([, name, path]) => ({ name, path }));
46
+ content = content.replace(/\nexport default\s*\[([\s\S]*)\]/, (_, itemsRaw) => {
47
+ const items = itemsRaw.split(",").map((i2) => i2.trim()).map((i2) => {
48
+ const importItem = imports.find(({ name }) => name === i2);
49
+ if (!importItem)
50
+ return i2;
51
+ return `${WRAPPER_KEY}(${i2}, ${JSON.stringify(importItem.path)})`;
52
+ });
53
+ return `
54
+ ${snippets}
55
+ export default [
56
+ ${items.join(",\n")}
57
+ ]
58
+ `;
59
+ });
60
+ content = `import { defineNuxtPlugin } from "#imports"
61
+ ${content}`;
62
+ return content;
63
+ };
64
+ });
65
+ });
66
+ }
67
+
68
+ export { setup };
@@ -0,0 +1,73 @@
1
+ import { resolve } from 'pathe';
2
+ import semver from 'semver';
3
+ import { runtimeDir } from '../dirs.mjs';
4
+ import 'node:path';
5
+ import 'node:url';
6
+ import 'is-installed-globally';
7
+
8
+ function setup({ nuxt, options }) {
9
+ const helperPath = resolve(runtimeDir, "function-metrics-helpers");
10
+ const includeFrom = options.timeline?.functions?.includeFrom || [
11
+ "#app",
12
+ "@unhead/vue"
13
+ ];
14
+ const include = options.timeline?.functions?.include || [
15
+ (i) => includeFrom.includes(i.from),
16
+ (i) => i.from.includes("composables")
17
+ ];
18
+ const exclude = options.timeline?.functions?.exclude || [
19
+ /^define[A-Z]/
20
+ ];
21
+ function filter(item) {
22
+ if (item.type)
23
+ return false;
24
+ const name = item.as || item.name;
25
+ if (!include.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name)))
26
+ return false;
27
+ if (exclude.some((f) => typeof f === "function" ? f(item) : typeof f === "string" ? name === f : f.test(name)))
28
+ return false;
29
+ return true;
30
+ }
31
+ nuxt.hook("imports:context", (unimport) => {
32
+ const ctx = unimport.getInternalContext();
33
+ if (!ctx.version || !semver.gte(ctx.version, "3.1.0"))
34
+ throw new Error(`[Nuxt DevTools] The timeline feature requires \`unimport\` >= v3.1.0, but got \`${ctx.version || "(unknown)"}\`. Please upgrade using \`nuxi upgrade --force\`.`);
35
+ ctx.addons.push(
36
+ {
37
+ injectImportsResolved(imports, _code, id) {
38
+ if (id?.includes("?macro=true"))
39
+ return;
40
+ return imports.map((i) => {
41
+ if (!filter(i))
42
+ return i;
43
+ const name = i.as || i.name;
44
+ return {
45
+ ...i,
46
+ meta: {
47
+ wrapperOriginalAs: name
48
+ },
49
+ as: `_$__${name}`
50
+ };
51
+ });
52
+ },
53
+ injectImportsStringified(str, imports, s, id) {
54
+ if (id?.includes("?macro=true"))
55
+ return;
56
+ const code = s.toString();
57
+ const injected = imports.filter((i) => i.meta?.wrapperOriginalAs);
58
+ if (injected.length) {
59
+ const result = [
60
+ str,
61
+ code.includes("__nuxtTimelineWrap") ? "" : `import { __nuxtTimelineWrap } from ${JSON.stringify(helperPath)}`,
62
+ ...injected.map((i) => `const ${i.meta.wrapperOriginalAs} = __nuxtTimelineWrap(${JSON.stringify(i.name)}, ${i.as})`),
63
+ ""
64
+ ].join(";");
65
+ return result;
66
+ }
67
+ }
68
+ }
69
+ );
70
+ });
71
+ }
72
+
73
+ export { setup };
@@ -0,0 +1,61 @@
1
+ import { addCustomTab } from '@nuxt/devtools-kit';
2
+ import { addVitePlugin } from '@nuxt/kit';
3
+
4
+ async function createVitePluginInspect(options) {
5
+ return await import('vite-plugin-inspect').then((r) => r.default(options));
6
+ }
7
+ async function setup({ nuxt, rpc }) {
8
+ const plugin = await createVitePluginInspect();
9
+ addVitePlugin(plugin);
10
+ let api;
11
+ nuxt.hook("vite:serverCreated", () => {
12
+ api = plugin.api;
13
+ });
14
+ addCustomTab(() => ({
15
+ name: "builtin-vite-inspect",
16
+ title: "Inspect",
17
+ icon: "carbon-ibm-watson-discovery",
18
+ category: "advanced",
19
+ view: {
20
+ type: "iframe",
21
+ src: `${nuxt.options.app.baseURL}${nuxt.options.app.buildAssetsDir}/__inspect/`.replace(/\/\//g, "/")
22
+ }
23
+ }), nuxt);
24
+ async function getComponentsRelationships() {
25
+ const meta = await api?.rpc.getMetadata();
26
+ const modules = (meta ? await api?.rpc.getModulesList({
27
+ vite: meta?.instances[0].vite,
28
+ env: meta?.instances[0].environments[0]
29
+ }) : null) || [];
30
+ const components = await rpc.functions.getComponents() || [];
31
+ const vueModules = modules.filter((m) => {
32
+ const plainId = m.id.replace(/\?v=\w+$/, "");
33
+ if (components.some((c) => c.filePath === plainId))
34
+ return true;
35
+ return m.id.match(/\.vue($|\?v=)/);
36
+ });
37
+ const graph = vueModules.map((i) => {
38
+ function searchForVueDeps(id, seen = /* @__PURE__ */ new Set()) {
39
+ if (seen.has(id))
40
+ return [];
41
+ seen.add(id);
42
+ const module = modules.find((m) => m.id === id);
43
+ if (!module)
44
+ return [];
45
+ return module.deps.flatMap((i2) => {
46
+ if (vueModules.find((m) => m.id === i2))
47
+ return [i2];
48
+ return searchForVueDeps(i2, seen);
49
+ });
50
+ }
51
+ return {
52
+ id: i.id,
53
+ deps: searchForVueDeps(i.id)
54
+ };
55
+ });
56
+ return graph;
57
+ }
58
+ rpc.functions.getComponentsRelationships = getComponentsRelationships;
59
+ }
60
+
61
+ export { createVitePluginInspect, setup };
@@ -0,0 +1,195 @@
1
+ import { existsSync } from 'node:fs';
2
+ import fs from 'node:fs/promises';
3
+ import { hostname } from 'node:os';
4
+ import { resolve } from 'node:path';
5
+ import { startSubprocess } from '@nuxt/devtools-kit';
6
+ import { logger } from '@nuxt/kit';
7
+ import { execa } from 'execa';
8
+ import { checkPort, getPort } from 'get-port-please';
9
+ import which from 'which';
10
+ import { L as LOG_PREFIX } from './module-main.mjs';
11
+ import 'consola/utils';
12
+ import 'pathe';
13
+ import 'sirv';
14
+ import 'vite';
15
+ import '../shared/devtools-nightly.5ac54dae.mjs';
16
+ import '../dirs.mjs';
17
+ import 'node:url';
18
+ import 'is-installed-globally';
19
+ import '@antfu/utils';
20
+ import 'ohash';
21
+ import 'birpc';
22
+ import 'flatted';
23
+ import 'simple-git';
24
+ import 'tinyglobby';
25
+ import 'image-meta';
26
+ import 'perfect-debounce';
27
+ import 'destr';
28
+ import 'scule';
29
+ import 'unimport';
30
+ import '../../dist/runtime/shared/hooks.js';
31
+ import 'magicast';
32
+ import 'magicast/helpers';
33
+ import 'nypm';
34
+ import 'node:module';
35
+ import 'local-pkg';
36
+ import 'pkg-types';
37
+ import 'semver';
38
+
39
+ const codeBinaryOptions = {
40
+ "ms-code-cli": {
41
+ codeBinary: "code",
42
+ launchArg: "serve-web",
43
+ licenseTermsArg: "--accept-server-license-terms",
44
+ connectionTokenArg: "--without-connection-token"
45
+ },
46
+ "ms-code-server": {
47
+ codeBinary: "code-server",
48
+ launchArg: "serve-local",
49
+ licenseTermsArg: "--accept-server-license-terms",
50
+ connectionTokenArg: "--without-connection-token"
51
+ },
52
+ "coder-code-server": {
53
+ codeBinary: "code-server",
54
+ launchArg: "serve-local",
55
+ licenseTermsArg: "",
56
+ connectionTokenArg: ""
57
+ }
58
+ };
59
+ async function setup({ nuxt, options, openInEditorHooks, rpc }) {
60
+ const vsOptions = options?.vscode || {};
61
+ const codeServer = vsOptions?.codeServer || "ms-code-server";
62
+ const { codeBinary, launchArg, licenseTermsArg, connectionTokenArg } = codeBinaryOptions[codeServer];
63
+ const installed = !!await which(codeBinary).catch(() => null);
64
+ let port = vsOptions?.port || 3080;
65
+ let url = `http://localhost:${port}`;
66
+ const host = vsOptions?.host ? `--host=${vsOptions.host}` : "--host=127.0.0.1";
67
+ let loaded = false;
68
+ let promise = null;
69
+ const mode = vsOptions?.mode || "local-serve";
70
+ const computerHostName = vsOptions.tunnel?.name || hostname().split(".").join("");
71
+ const root = nuxt.options.rootDir;
72
+ const vscodeServerControllerFile = resolve(root, ".vscode", ".server-controller-port.log");
73
+ openInEditorHooks.push(async (file) => {
74
+ if (!existsSync(vscodeServerControllerFile))
75
+ return false;
76
+ try {
77
+ const { port: port2 } = JSON.parse(await fs.readFile(vscodeServerControllerFile, "utf-8"));
78
+ const url2 = `http://localhost:${port2}/open?path=${encodeURIComponent(`${root}/${file}`)}`;
79
+ await fetch(url2);
80
+ rpc.broadcast.navigateTo("/modules/custom-builtin-vscode");
81
+ return true;
82
+ } catch (e) {
83
+ console.debug(`Failed to open file "${file}" in VS Code Server`);
84
+ console.debug(e);
85
+ return false;
86
+ }
87
+ });
88
+ async function startCodeServer() {
89
+ if (existsSync(vscodeServerControllerFile))
90
+ await fs.rm(vscodeServerControllerFile, { force: true });
91
+ if (vsOptions?.reuseExistingServer && !await checkPort(port)) {
92
+ loaded = true;
93
+ url = `http://localhost:${port}/?folder=${encodeURIComponent(root)}`;
94
+ logger.info(LOG_PREFIX, `Existing VS Code Server found at port ${port}...`);
95
+ return;
96
+ }
97
+ port = await getPort({ port });
98
+ url = `http://localhost:${port}/?folder=${encodeURIComponent(root)}`;
99
+ logger.info(LOG_PREFIX, `Starting VS Code Server at ${url} ...`);
100
+ execa(codeBinary, [
101
+ "--install-extension",
102
+ "antfu.vscode-server-controller"
103
+ ], { stderr: "inherit", stdout: "ignore", reject: false });
104
+ startSubprocess(
105
+ {
106
+ command: codeBinary,
107
+ args: [
108
+ launchArg,
109
+ licenseTermsArg,
110
+ connectionTokenArg,
111
+ `--port=${port}`,
112
+ host
113
+ ]
114
+ },
115
+ {
116
+ id: "devtools:vscode",
117
+ name: "VS Code Server",
118
+ icon: "logos-visual-studio-code"
119
+ },
120
+ nuxt
121
+ );
122
+ for (let i = 0; i < 100; i++) {
123
+ if (await fetch(url).then((r) => r.ok).catch(() => false))
124
+ break;
125
+ await new Promise((resolve2) => setTimeout(resolve2, 500));
126
+ }
127
+ await new Promise((resolve2) => setTimeout(resolve2, 2e3));
128
+ loaded = true;
129
+ }
130
+ async function startCodeTunnel() {
131
+ const { stdout: currentDir } = await execa("pwd");
132
+ url = `https://vscode.dev/tunnel/${computerHostName}${currentDir}`;
133
+ logger.info(LOG_PREFIX, `Starting VS Code tunnel at ${url} ...`);
134
+ const command = execa("code", [
135
+ "tunnel",
136
+ "--accept-server-license-terms",
137
+ "--name",
138
+ `${computerHostName}`
139
+ ]);
140
+ command.stderr?.pipe(process.stderr);
141
+ command.stdout?.pipe(process.stdout);
142
+ nuxt.hook("close", () => {
143
+ command.kill();
144
+ });
145
+ for (let i = 0; i < 100; i++) {
146
+ if (await fetch(url).then((r) => r.ok).catch(() => false))
147
+ break;
148
+ await new Promise((resolve2) => setTimeout(resolve2, 500));
149
+ }
150
+ await new Promise((resolve2) => setTimeout(resolve2, 2e3));
151
+ loaded = true;
152
+ }
153
+ async function start() {
154
+ if (mode === "tunnel")
155
+ await startCodeTunnel();
156
+ else
157
+ await startCodeServer();
158
+ }
159
+ nuxt.hook("devtools:customTabs", (tabs) => {
160
+ tabs.push({
161
+ name: "builtin-vscode",
162
+ title: "VS Code",
163
+ icon: "bxl-visual-studio",
164
+ category: "modules",
165
+ requireAuth: true,
166
+ view: !installed && !(vsOptions?.mode === "tunnel") ? {
167
+ type: "launch",
168
+ title: "Install VS Code Server",
169
+ description: `It seems you don't have code-server installed.
170
+
171
+ Learn more about it with <a href="https://code.visualstudio.com/blogs/2022/07/07/vscode-server" target="_blank">this guide</a>.
172
+ Once installed, restart Nuxt and visit this tab again.`,
173
+ actions: []
174
+ } : !loaded ? {
175
+ type: "launch",
176
+ description: "Launch VS Code right in the devtools!",
177
+ actions: [{
178
+ label: promise ? "Starting..." : "Launch",
179
+ pending: !!promise,
180
+ handle: () => {
181
+ promise = promise || start();
182
+ return promise;
183
+ }
184
+ }]
185
+ } : {
186
+ type: "iframe",
187
+ src: url
188
+ }
189
+ });
190
+ });
191
+ if (vsOptions?.startOnBoot)
192
+ promise = promise || start();
193
+ }
194
+
195
+ export { setup };
@@ -0,0 +1,30 @@
1
+ import { addVitePlugin } from '@nuxt/kit';
2
+ import { join } from 'pathe';
3
+ import { runtimeDir } from '../dirs.mjs';
4
+ import 'node:path';
5
+ import 'node:url';
6
+ import 'is-installed-globally';
7
+
8
+ function setup({ nuxt }) {
9
+ if (!nuxt.options.dev || nuxt.options.test)
10
+ return;
11
+ addVitePlugin({
12
+ name: "vue:devtools",
13
+ async resolveId(importee) {
14
+ if (importee.startsWith("virtual:vue-devtools-path:")) {
15
+ const resolved = importee.replace("virtual:vue-devtools-path:", join(runtimeDir, "vue-devtools/"));
16
+ return resolved;
17
+ }
18
+ },
19
+ transform(code, id, options) {
20
+ const [filename] = id.split("?", 2);
21
+ const appendTo = /\/entry\.m?js$/;
22
+ if (!options?.ssr && appendTo.test(filename))
23
+ code = `import 'virtual:vue-devtools-path:overlay.js';
24
+ ${code}`;
25
+ return code;
26
+ }
27
+ });
28
+ }
29
+
30
+ export { setup };
@@ -0,0 +1,15 @@
1
+ import { addVitePlugin } from '@nuxt/kit';
2
+ import VueInspector from 'vite-plugin-vue-inspector';
3
+
4
+ function setup({ nuxt, options }) {
5
+ if (!nuxt.options.dev || nuxt.options.test)
6
+ return;
7
+ addVitePlugin(VueInspector({
8
+ toggleComboKey: "",
9
+ ...typeof options.componentInspector === "boolean" ? {} : options.componentInspector,
10
+ appendTo: /\/entry\.m?js$/,
11
+ toggleButtonVisibility: "never"
12
+ }));
13
+ }
14
+
15
+ export { setup };
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-nqz5coc9.css" crossorigin>
4
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css" crossorigin>
5
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss.css-mhvipxpl.css" crossorigin>
6
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/b6bfxrb8.js">
7
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-gi2fewby.js">
8
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-3uirpnla.js">
9
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-bnvxb5wv.js">
10
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/markdown-it-fvu08dbs.js">
11
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-mk5axw1k.js">
12
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-j8mngb76.js">
13
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-i3w61o4x.js">
14
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-jzfgcoxk.js">
15
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-b3x40x40.css">
16
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-lp8coab3.js">
17
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-hilpkhd4.css">
18
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-d4b6gi3u.js">
19
+ <script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/b6bfxrb8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1736412366356,false]</script>
20
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"b8bbfd27-5704-4be8-a606-01af93c734ef",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-nqz5coc9.css" crossorigin>
4
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css" crossorigin>
5
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss.css-mhvipxpl.css" crossorigin>
6
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/b6bfxrb8.js">
7
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-gi2fewby.js">
8
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-3uirpnla.js">
9
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-bnvxb5wv.js">
10
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/markdown-it-fvu08dbs.js">
11
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-mk5axw1k.js">
12
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-j8mngb76.js">
13
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-i3w61o4x.js">
14
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-jzfgcoxk.js">
15
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-b3x40x40.css">
16
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-lp8coab3.js">
17
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-hilpkhd4.css">
18
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-d4b6gi3u.js">
19
+ <script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/b6bfxrb8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1736412366357,false]</script>
20
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"b8bbfd27-5704-4be8-a606-01af93c734ef",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -0,0 +1 @@
1
+ import{k as e,S as n,Q as t}from"./vendor/json-editor-vue-gi2fewby.js";const c={"h-screen":"","w-screen":"","bg-black":""},r=e({__name:"__blank",setup(o){return(s,_)=>(t(),n("div",c))}});export{r as default};
@@ -0,0 +1 @@
1
+ import{f as P,g as J,r as S,h as R,e as U,j as X,k as h,l as ee,m as ne,n as te,o as le,p as ie,q as oe,s as C,v as re,w as ue,x as se,c as ae}from"./b6bfxrb8.js";import{_ as de}from"./filepath-item.vue-b829sn9l.js";import{k as E,l as V,b as F,Q as i,S as u,U as e,F as p,ab as G,Y as j,a5 as v,W as x,u as c,a0 as d,$ as a,a6 as f,a8 as A,a9 as I,M as k}from"./vendor/json-editor-vue-gi2fewby.js";import{_ as me}from"./ncode-block.vue-gy1ero5j.js";import{_ as pe}from"./ncheckbox.vue-fs1yhvat.js";import{_ as ve}from"./help-fab.vue-gtlaa6k2.js";import"./vendor/unocss-3uirpnla.js";import"./vendor/shiki-bnvxb5wv.js";import"./client-c9f80qsp.js";const fe={"h-full":"",grid:"~ rows-[max-content_1fr]"},ye={flex:"~ wrap","w-full":""},be=["onClick"],ce={key:0,flex:"~ col gap-4 items-center justify-center",p4:""},ge={grid:"~ cols-[30px_1fr] gap-x-2 gap-y-3 items-center justify-center","w-100":""},xe=E({__name:"BuildAnalyzeDetails",props:{current:{},prev:{}},setup(N){const y=N,$=`${J().app.baseURL}/__nuxt_devtools__/analyze/`.replace(/\/+/g,"/"),b=V(()=>{const l=[{name:"Overview",id:"overview"}];return y.current.features.bundleClient&&l.push({name:"Client Bundle",id:"bundle-client"}),y.current.features.bundleNitro&&l.push({name:"Nitro Bundle",id:"bundle-nitro"}),y.current.features.viteInspect&&l.push({name:"Vite Inspect",id:"vite-inspect"}),l}),o=F(b.value[0]);function z(l){return`${((l.endTime-l.startTime)/1e3).toFixed(1)}s`}function m(l){return l<1024?`${l}B`:l<1024*1024?`${(l/1024).toFixed(1)}KB`:l<1024*1024*1024?`${(l/1024/1024).toFixed(1)}MB`:`${(l/1024/1024/1024).toFixed(1)}GB`}async function T(l){return S.clearAnalyzeBuilds(await R(),[l])}return(l,n)=>{const D=de,B=U;return i(),u("div",fe,[e("div",ye,[(i(!0),u(p,null,G(b.value,(r,t)=>(i(),u("button",{key:t,px4:"",py2:"",border:"r base",hover:"bg-active",class:j(r.id===o.value.id?"":"border-b"),onClick:_=>o.value=r},[e("div",{class:j(r.id===o.value.id?"":"op30")},v(r.name),3)],10,be))),128)),n[1]||(n[1]=e("div",{border:"b base","flex-auto":""},null,-1))]),o.value.id==="overview"?(i(),u("div",ce,[n[15]||(n[15]=e("div",{"flex-auto":""},null,-1)),e("div",ge,[n[10]||(n[10]=e("div",{"i-carbon-commit":"","text-xl":""},null,-1)),e("div",null,[n[2]||(n[2]=e("div",{"text-sm":"",op50:""}," Name ",-1)),e("div",null,v(l.current.name),1)]),n[11]||(n[11]=e("div",{"i-carbon-time":"","text-xl":""},null,-1)),e("div",null,[n[3]||(n[3]=e("div",{"text-sm":"",op50:""}," Build duration ",-1)),e("div",null,v(z(l.current)),1)]),l.current.size?.clientBundle?(i(),u(p,{key:0},[n[5]||(n[5]=e("div",{"i-carbon-cics-program":"","text-xl":""},null,-1)),e("div",null,[n[4]||(n[4]=e("div",{"text-sm":"",op50:""}," Client bundle size ",-1)),e("div",null,v(m(l.current.size.clientBundle)),1)])],64)):x("",!0),l.current.size.nitroBundle?(i(),u(p,{key:1},[n[7]||(n[7]=e("div",{"i-carbon-bare-metal-server":"","text-xl":""},null,-1)),e("div",null,[n[6]||(n[6]=e("div",{"text-sm":"",op50:""}," Nitro bundle size ",-1)),e("div",null,v(m(l.current.size.nitroBundle)),1)])],64)):x("",!0),n[12]||(n[12]=e("div",{"i-carbon-edge-node":"","text-xl":""},null,-1)),e("div",null,[n[8]||(n[8]=e("div",{"text-sm":"",op50:""}," Built ",-1)),e("div",null,v(c(P)(new Date(l.current.endTime))),1)]),n[13]||(n[13]=e("div",{"i-carbon:folder-parent":"","text-xl":""},null,-1)),e("div",null,[n[9]||(n[9]=e("div",{"text-sm":"",op50:""}," Report Path ",-1)),d(D,{filepath:l.current.analyzeDir},null,8,["filepath"])])]),n[16]||(n[16]=e("div",{"flex-auto":""},null,-1)),d(B,{n:"rose",icon:"carbon-delete",onClick:n[0]||(n[0]=r=>T(l.current.name))},{default:a(()=>n[14]||(n[14]=[f(" Delete this report ")])),_:1})])):x("",!0),n._lazyshow1||o.value.id==="bundle-client"?(n._lazyshow1=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/client.html`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="bundle-client"]])],64)):x("v-show-if",!0),n._lazyshow2||o.value.id==="bundle-nitro"?(n._lazyshow2=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/nitro.html`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="bundle-nitro"]])],64)):x("v-show-if",!0),n._lazyshow3||o.value.id==="vite-inspect"?(n._lazyshow3=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/.vite-inspect/`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="vite-inspect"]])],64)):x("v-show-if",!0)])}}}),we={class:"markdown-body"},$e={__name:"analyze-build",setup(N,{expose:y}){return y({frontmatter:{}}),($,b)=>(i(),u("div",we,b[0]||(b[0]=[e("h1",null,"Build Analyze",-1),e("p",null,[f("DevTools provides a build analyze tool to help you understand the size of your app in production. Whenever you start a new build, it runs the command "),e("code",null,"nuxt build --analyze"),f(" and present the output data directly in DevTools for easy browsing and comparing.")],-1)])))}},ze={flex:"~ col"},_e=["onClick"],ke={flex:"~ gap-1 items-center wrap","w-full":"","text-sm":"",op60:""},Be={flex:"~ items-center justify-center wrap",p4:""},Ce={flex:"~ col gap-1","w-250":"",p4:""},Ne={flex:"~ gap-3",mt2:"","justify-end":""},Re=E({__name:"analyze-build",setup(N){const y=X(),w=h(),$=ee(),b=ne("analyze-build:slug",""),o=V(()=>w.value?.builds.find(r=>r.slug===b.value)??w.value?.builds[0]),z=F(!1),m=F(""),T=V(()=>w.value?.builds.some(r=>r.name===m.value.trim()));async function l(){m.value=await S.generateAnalyzeBuildName(),await y.start()&&(oe("analyze-build:start"),C.value={name:m.value,processId:await S.startAnalyzeBuild(await R(),m.value)},z.value&&B())}const n=te();function D(r){return`${((r.endTime-r.startTime)/1e3).toFixed(1)}s`}function B(){C.value?.processId&&(n.value=C.value.processId,$.push("/modules/terminals"))}return le(()=>[{id:"action:analyze-build: start",title:"Start a new analyze build",icon:"i-carbon-edge-node",action:l}]),(r,t)=>{const _=U,L=xe,M=ae,O=ie,W=re,Y=ue,q=me,H=pe,K=se,Q=$e,Z=ve;return i(),u(p,null,[d(O,{"left-size":30},{left:a(()=>[e("div",ze,[(i(!0),u(p,null,G(c(w)?.builds,s=>(i(),u(p,{key:s.slug},[e("button",{flex:"~ col gap1","hover:bg-active":"",p3:"",class:j(s.slug===o.value?.slug?"text-primary bg-active":""),onClick:g=>b.value=s.slug},[e("code",null,v(s.name),1),e("div",ke,[t[4]||(t[4]=e("div",{"i-carbon-time":""},null,-1)),e("span",null,v(D(s)),1),t[5]||(t[5]=e("div",{"flex-auto":""},null,-1)),e("span",null,v(c(P)(new Date(s.endTime))),1)])],10,_e),t[6]||(t[6]=e("div",{"x-divider":""},null,-1))],64))),128)),e("div",Be,[c(C)?(i(),k(_,{key:1,n:"primary",icon:"carbon-circle-dash animate-spin",onClick:t[1]||(t[1]=s=>B())},{default:a(()=>t[8]||(t[8]=[f(" Building... ")])),_:1})):(i(),k(_,{key:0,n:"primary",icon:"carbon-edge-node",onClick:t[0]||(t[0]=s=>l())},{default:a(()=>t[7]||(t[7]=[f(" Start a new build ")])),_:1}))])])]),right:a(()=>[o.value?(i(),k(L,{key:0,current:o.value},null,8,["current"])):(i(),k(M,{key:1}))]),_:1}),d(c(y),null,{default:a(({resolve:s})=>[d(K,{"model-value":!0,onClose:g=>s(!1)},{default:a(()=>[e("div",Ce,[t[13]||(t[13]=e("h3",{class:"text-lg font-medium leading-6",mb2:""}," Start analyze build? ",-1)),t[14]||(t[14]=e("p",{op50:""}," Enter the name of the build: ",-1)),d(W,{modelValue:m.value,"onUpdate:modelValue":t[2]||(t[2]=g=>m.value=g),placeholder:"Build name"},null,8,["modelValue"]),T.value?(i(),k(Y,{key:0,"n-orange":""},{default:a(()=>t[9]||(t[9]=[f(" A build with the same name already exists, continue would overrides the previous build result. ")])),_:1})):x("",!0),t[15]||(t[15]=e("div",{my3:"","x-divider":""},null,-1)),t[16]||(t[16]=e("p",{op50:""}," The following command will be executed in your terminal: ",-1)),d(q,{code:`npx nuxi analyze --no-serve --name=${m.value}`,lang:"bash",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),d(H,{modelValue:z.value,"onUpdate:modelValue":t[3]||(t[3]=g=>z.value=g),mt2:"",n:"primary"},{default:a(()=>t[10]||(t[10]=[f(" Navigate to terminal ")])),_:1},8,["modelValue"]),e("div",Ne,[d(_,{onClick:g=>s(!1)},{default:a(()=>t[11]||(t[11]=[f(" Cancel ")])),_:2},1032,["onClick"]),d(_,{n:"solid primary",onClick:g=>s(!0)},{default:a(()=>t[12]||(t[12]=[f(" Start ")])),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1}),d(Z,null,{default:a(()=>[d(Q)]),_:1})],64)}}});export{Re as default};
@@ -0,0 +1,16 @@
1
+ import{y as ee,z as H,A as ce,B as pe,q as me,r as W,h as X,C as M,e as te,D as ne,v as se,E as ve,F as fe,G as le,H as ge,I as he,J as xe,K as be,x as we,L as ye,M as _e,N as $e,b as ke,O as Ce}from"./b6bfxrb8.js";import{_ as Ve}from"./ncheckbox.vue-fs1yhvat.js";import{_ as Pe}from"./ndropdown.vue-fe8ybtb0.js";import{_ as Ae}from"./nnavbar.vue-d5x8tq5w.js";import{k as Z,b as T,ae as oe,S as i,a8 as K,a0 as d,U as t,a6 as D,F as L,ab as G,M as V,$ as h,W as S,Y as J,u as m,Q as o,l as U,X as ae,a5 as F,V as De,y as Fe,Z as Ne,al as Se}from"./vendor/json-editor-vue-gi2fewby.js";import{_ as Ue}from"./nsection-block-ivkmhmn9.js";import{_ as Ie}from"./filepath-item.vue-b829sn9l.js";import{_ as Te}from"./code-snippets.vue-i4e657wf.js";import{_ as je}from"./ndrawer.vue-cjxfdzsk.js";import{D as Be}from"./constants-b32h69zq.js";import"./vendor/unocss-3uirpnla.js";import"./vendor/shiki-bnvxb5wv.js";import"./nicon-title.vue-ouqsubn7.js";import"./ncode-block.vue-gy1ero5j.js";import"./client-c9f80qsp.js";const Ee={key:0,"h-full":"","w-full":"",flex:"","items-center":"","justify-center":""},ze={for:"drop-zone-input","text-3xl":"",hover:"text-green cursor-pointer","transition-all":""},Le={key:1,relative:"","h-full":"","w-full":"",grid:"~ rows-[max-content_1fr_max-content]"},Oe={grid:"~ cols-minmax-8rem gap-8","overflow-auto":"",p6:""},Me={flex:"","items-center":"","justify-center":"","of-hidden":"",rounded:"","rounded-t-lg":"","bg-active":"","object-cover":"",class:"aspect-1/1",border:"~ base"},Re=["src"],Ke={flex:"~ gap1","items-center":""},qe={flex:"~ gap-2","items-center":"","justify-center":"",p8:""},Ge=Z({__name:"AssetDropZone",props:{modelValue:{type:Boolean,required:!0},folder:{type:String,required:!0}},setup(z){const l=z,f=ee(l,"modelValue"),C=T(),n=T([]);function v(s){C.value=s.target,f.value=!0}function b(s){s.target===C.value&&(f.value=!1)}function j(s){s.preventDefault()}function P(s){s.preventDefault(),x(s.dataTransfer.files)}function x(s){const c=Array.from(s||[]);if(c.length){const g=[],y=n.value.map(u=>u.name);for(const u of c)if(y.includes(u.name)){let A=1;const[_,E]=u.name.split(".");for(;y.includes(`${_} (${A}).${E}`);)A++;const R=`${_}-${A}.${E}`,a=new Blob([u],{type:u.type}),e=new File([a],R,{lastModified:Date.now()});g.push(e),y.push(R)}else u.type===""&&M({message:"Folders are not supported yet",icon:"carbon:face-dissatisfied",classes:"text-orange"}),g.push(u);n.value=[...n.value,...g]}}async function B(){if(ce.value||pe.value)return;me("assets:upload");const s=[];for(const c of n.value){const g=new FileReader;g.readAsDataURL(c);const u=(await new Promise(A=>{g.onload=()=>A(g.result)})).split(";base64,").pop();s.push({path:c.name,encoding:"base64",content:u})}await W.writeStaticAssets(await X(),[...s],l.folder).then(()=>{p(),M({message:"Files uploaded successfully!",icon:"i-carbon:checkmark"})}).catch(c=>{p(),M({message:`Error uploading files: ${c?.message??"unknown"}`,icon:"i-carbon-warning",classes:"text-red"})}),f.value=!1}function q(s){n.value?.splice(s,1)}function O(s){return URL.createObjectURL(s)}function w(s,c){const[g,y]=s.name.split("."),u=c.replace(/\.\w+$/,""),A=`${u}.${y}`;return u.length===0?(alert("File name must be at least 1 characters long"),g):(Object.defineProperty(s,"name",{value:A,writable:!1}),n.value.splice(n.value.indexOf(s),1,s),s)}function r(){n.value=[]}function p(){f.value=!1,r()}return H("dragenter",v),H("dragleave",b),H("dragover",j),H("drop",P),(s,c)=>{const g=te,y=ne,u=se,A=oe("tooltip");return o(),i("div",{fixed:"","bottom-0":"","left-13":"","right-0":"","top-0":"","z-10":"","backdrop-blur-20":"","transition-all":"",class:J(m(f)?"opacity-100 visible":"opacity-0 invisible")},[K(d(g,{icon:"carbon-close",title:"Close",absolute:"","right-5":"","top-5":"","z-20":"","text-xl":"",border:!1,onClick:p},null,512),[[A,"Close",void 0,{"bottom-end":!0}]]),n.value?.length?(o(),i("div",Le,[c[4]||(c[4]=t("div",{px6:"",py6:""},[t("h1",{"text-2xl":""}," Upload "),t("p",{"text-sm":"",op50:""}," Drag and drop files to upload ")],-1)),t("div",Oe,[(o(!0),i(L,null,G(n.value,(_,E)=>(o(),i("div",{key:_.name,flex:"~ col gap-2",relative:"","h-50":"","w-40":"","items-center":""},[t("div",Me,[t("img",{"h-full":"","w-full":"","rounded-t-lg":"","object-cover":"",src:O(_)},null,8,Re)]),t("div",Ke,[d(u,{n:"xs","h-full":"","flex-auto":"","model-value":_.name,"onUpdate:modelValue":R=>w(_,R.target.value)},null,8,["model-value","onUpdate:modelValue"]),d(g,{n:"red",icon:"carbon-trash-can","h-full":"","flex-none":"",title:"Remove file",onClick:R=>q(E)},null,8,["onClick"])])]))),128))]),t("div",qe,[n.value.length?(o(),V(g,{key:0,n:"red",onClick:r},{default:h(()=>[d(y,{icon:"carbon-clean"}),c[2]||(c[2]=D(" Clear "))]),_:1})):S("",!0),d(g,{disabled:!n.value.length,n:"primary solid",onClick:B},{default:h(()=>[d(y,{icon:"carbon-cloud-upload"}),c[3]||(c[3]=D(" Upload "))]),_:1},8,["disabled"])])])):(o(),i("div",Ee,[t("label",ze,[d(y,{icon:"carbon-cloud-upload","mr-2":""}),c[1]||(c[1]=D(" Drop files here or click to select "))]),t("input",{id:"drop-zone-input",type:"file",multiple:"",hidden:"",onChange:c[0]||(c[0]=_=>x(_.target.files))},null,32)]))],2)}}}),Ze=Z({__name:"AssetFontPreview",props:{asset:{}},setup(z){const l=z,f=U(()=>`devtools-assets-${ve(l.asset)}`);return fe(U(()=>`
2
+ @font-face {
3
+ font-family: '${f.value}';
4
+ src: url('${l.asset.publicPath}');
5
+ }
6
+ `)),(C,n)=>(o(),i("div",{"of-hidden":"",style:ae({fontFamily:`'${f.value}'`})}," Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz ",4))}}),We={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},Xe=["src"],He={key:2,"i-carbon-document":"","text-3xl":"",op20:""},Je={key:3,"w-full":"","self-start":"",p4:""},Qe=["textContent"],Ye={key:4},et=["src","autoplay","controls"],tt={key:5},nt={key:0,"i-carbon-volume-up":"","text-3xl":"",op20:""},ot=["src"],lt={key:6,"i-carbon-help":"","text-3xl":"",op20:""},ie=Z({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(z){return(l,f)=>{const C=Ze;return o(),i("div",We,[l.asset.type==="image"?(o(),i("img",{key:0,src:l.asset.publicPath},null,8,Xe)):l.asset.type==="font"?(o(),V(C,{key:l.asset.publicPath,asset:l.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):l.asset.type==="text"&&!l.textContent?(o(),i("div",He)):l.asset.type==="text"&&l.textContent?(o(),i("div",Je,[t("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:F(l.textContent)},null,8,Qe)])):l.asset.type==="video"?(o(),i("div",Ye,[t("video",{src:l.asset.publicPath,autoplay:l.detail,controls:l.detail},null,8,et)])):l.asset.type==="audio"?(o(),i("div",tt,[l.detail?(o(),i("audio",{key:1,src:l.asset.publicPath,controls:""},null,8,ot)):(o(),i("div",nt))])):(o(),i("div",lt))])}}}),st={relative:"",flex:"~ col gap-1",hover:"bg-active","items-center":"","of-hidden":"",rounded:"",p2:""},at={"w-full":"","of-hidden":"",truncate:"","ws-nowrap":"","text-center":"","text-xs":""},it=Z({__name:"AssetGridItem",props:{asset:{},folder:{}},setup(z){const l=z,f=U(()=>l.folder&&l.asset.path.startsWith(l.folder)?l.asset.path.slice(l.folder.length):l.asset.path);return(C,n)=>{const v=ne,b=ie;return o(),i("button",st,[C.asset.layer?(o(),V(v,{key:0,icon:"i-carbon-layers",absolute:"","right-4":"","top-4":"","bg-primary":""})):S("",!0),d(b,{"h-30":"","w-30":"",rounded:"",border:"~ base",asset:C.asset},null,8,["asset"]),t("div",at,F(f.value),1)])}}}),re=Z({__name:"AssetListItem",props:{item:{},index:{default:0},modelValue:{}},setup(z,{emit:l}){const f=z,n=ee(f,"modelValue",l,{passive:!0}),v=U(()=>f.item?.children?.length),b=T(!0),j=U(()=>v.value?"i-carbon-folder":f.item.type==="image"?"i-carbon-image":f.item.type==="video"?"i-carbon-video":f.item.type==="audio"?"i-carbon-volume-up":f.item.type==="font"?"i-carbon-text-small-caps":f.item.type==="text"?"i-carbon-document":f.item.type==="json"?"i-carbon-json":"i-carbon-document-blank");return(P,x)=>{const B=ne,q=re;return o(),i("div",null,[t("button",{flex:"~ gap-2","w-full":"","items-center":"",hover:"bg-active",px4:"",py1:"",style:ae({paddingLeft:`calc(1rem + ${P.index*1.5}em)`}),class:J({"bg-active":!v.value&&m(n)?.filePath===P.item?.filePath}),border:"b base",onClick:x[0]||(x[0]=O=>v.value?b.value=!b.value:n.value=P.item)},[t("div",{class:J(j.value)},null,2),t("span",{class:J({"flex items-center":v.value}),"flex-auto":"","text-start":"","text-sm":"","font-mono":""},[D(F(P.item.path)+" ",1),P.item.layer?(o(),V(B,{key:0,icon:"i-carbon-layers","bg-primary":""})):S("",!0)],2),v.value?(o(),V(B,{key:0,icon:"carbon:chevron-right","transform-rotate":b.value?90:0,transition:""},null,8,["transform-rotate"])):S("",!0)],6),b.value?De(P.$slots,"default",{key:0},()=>[(o(!0),i(L,null,G(P.item?.children,O=>(o(),V(q,{key:O.filepath,modelValue:m(n),"onUpdate:modelValue":x[1]||(x[1]=w=>Fe(n)?n.value=w:null),item:O,index:P.index+1},null,8,["modelValue","item","index"]))),128))]):S("",!0)])}}}),rt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},ut={flex:"~","items-center":"","justify-center":""},dt={"max-w-full":"","w-full":"","table-fixed":""},ct={flex:"~ gap-1","w-full":"","items-center":""},pt={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},mt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},vt={capitalize:""},ft={key:0},gt={op70:""},ht={flex:"~ gap2 wrap"},xt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},bt={flex:"~ gap2 wrap justify-center"},wt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},yt={flex:"~ gap2 wrap justify-center"},_t={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},$t={flex:"","justify-end":"","gap-4":""},kt=Z({__name:"AssetDetails",props:{modelValue:{}},setup(z,{emit:l}){const n=ee(z,"modelValue",l,{passive:!0}),v=le(async()=>{if(n.value.type==="image")return W.getImageMeta(await X(),n.value.filePath)}),b=T(!1),j=T(),P=T(0),x=le(async()=>{if(n.value.type!=="text")return;P.value;const a=await W.getTextAssetContent(await X(),n.value.filePath);return j.value=a,a});async function B(){if(x.value!==j.value)try{await W.writeStaticAssets(await X(),[{path:n.value.path,content:j.value,override:!0}],""),b.value=!1,P.value++,M({message:"Updated",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const q=ge(),O=U(()=>(q.value?._installedModules||[]).some(e=>e.meta?.name==="@nuxt/image"||e.meta?.name==="@nuxt/image-edge"||e.meta?.name==="@nuxt/image-nightly")),w=U(()=>{const a=[];if(n.value.type==="image"){const e=v.value?.width?`
7
+ width="${v.value.width}"
8
+ height="${v.value.height}" `:" ";return a.push({lang:"vue-html",code:`<img${e}
9
+ src="${n.value.publicPath}"
10
+ />`,name:"Plain Image"}),O.value&&a.push({lang:"vue-html",code:`<NuxtImg${e}
11
+ src="${n.value.publicPath}"
12
+ />`,name:"Nuxt Img",docs:"https://image.nuxt.com/usage/nuxt-img"},{lang:"vue-html",code:`<NuxtPicture${e}
13
+ src="${n.value.publicPath}"
14
+ />`,name:"Nuxt Picture",docs:"https://image.nuxt.com/usage/nuxt-picture"}),a}return a.push({lang:"html",code:`<a download href="${n.value.publicPath}">
15
+ Download ${n.value.path.split("/").slice(-1)[0]}
16
+ </a>`,name:"Download link"}),a}),r=he(),p=xe(),s=be(()=>n.value.mtime),c=U(()=>{const a=n.value.size;return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/1024/1024).toFixed(2)} MB`}),g=U(()=>{if(!v.value?.width||!v.value?.height)return"";const a=($,I)=>I?a(I,$%I):$,e=a(v.value.width,v.value.height);return e>3?`${v.value.width/e}:${v.value.height/e}`:""}),y=U(()=>["image","text","video","audio","font"].includes(n.value.type)),u=T(!1);async function A(){try{await W.deleteStaticAsset(await X(),n.value.filePath),n.value=void 0,u.value=!1,M({message:"Asset deleted",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const _=T(!1),E=T("");async function R(){const a=n.value.filePath.split("/"),e=a.slice(-1)[0].split(".").slice(0,-1).join(".");if(!E.value||E.value===e)return M({message:"Please enter a new name",icon:"i-carbon-warning",classes:"text-orange"});try{const $=a.slice(-1)[0].split(".").slice(-1)[0],I=`${a.slice(0,-1).join("/")}/${E.value}.${$}`;await W.renameStaticAsset(await X(),n.value.filePath,I),n.value=void 0,_.value=!1,M({message:"Asset renamed",icon:"i-carbon-checkmark",classes:"text-green"})}catch($){console.error($),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}return(a,e)=>{const $=ie,I=Ie,N=te,ue=Te,Q=we,de=se,Y=oe("tooltip");return o(),i(L,null,[t("div",rt,[y.value?(o(),i(L,{key:0},[e[13]||(e[13]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Preview "),t("div",{"x-divider":""})],-1)),t("div",ut,[d($,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:m(n),"text-content":m(x)},null,8,["asset","text-content"])])],64)):S("",!0),e[25]||(e[25]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Details "),t("div",{"x-divider":""})],-1)),t("table",dt,[t("tbody",null,[t("tr",null,[e[14]||(e[14]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1)),t("td",null,[t("div",ct,[d(I,{filepath:m(n).filePath,"text-left":""},null,8,["filepath"]),K(d(N,{"flex-none":"",title:"Open in Editor",icon:"carbon-launch",border:!1,onClick:e[0]||(e[0]=k=>m(p)(m(n).filePath))},null,512),[[Y,"Open in Editor"]])])])]),t("tr",null,[e[15]||(e[15]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1)),t("td",null,[t("div",pt,[t("div",mt,F(m(n).publicPath),1),K(d(N,{"flex-none":"",title:"Copy public path",icon:"carbon-copy",border:!1,onClick:e[1]||(e[1]=k=>m(r)(m(n).publicPath,"assets-public-path"))},null,512),[[Y,"Copy public path"]]),K(d(N,{"flex-none":"",to:m(n).publicPath,icon:"carbon-launch",target:"_blank",border:!1,title:"Open in browser"},null,8,["to"]),[[Y,"Open in browser"]])])])]),t("tr",null,[e[16]||(e[16]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1)),t("td",vt,F(m(n).type),1)]),m(v)?.width?(o(),i(L,{key:0},[t("tr",null,[e[17]||(e[17]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1)),t("td",null,F(m(v).width)+" x "+F(m(v).height),1)]),g.value?(o(),i("tr",ft,[e[18]||(e[18]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1)),t("td",null,F(g.value),1)])):S("",!0)],64)):S("",!0),t("tr",null,[e[19]||(e[19]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1)),t("td",null,F(c.value),1)]),t("tr",null,[e[20]||(e[20]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1)),t("td",null,[D(F(new Date(m(n).mtime).toLocaleString())+" ",1),t("span",gt,"("+F(m(s))+")",1)])])])]),e[26]||(e[26]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Actions "),t("div",{"x-divider":""})],-1)),t("div",ht,[d(N,{to:m(n).publicPath,download:"",target:"_blank",icon:"carbon-download",n:"green"},{default:h(()=>e[21]||(e[21]=[D(" Download ")])),_:1},8,["to"]),m(n).type==="text"?(o(),V(N,{key:0,icon:"carbon-edit",n:"cyan",onClick:e[2]||(e[2]=k=>b.value=!b.value)},{default:h(()=>e[22]||(e[22]=[D(" Edit ")])),_:1})):S("",!0),d(N,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:e[3]||(e[3]=k=>_.value=!_.value)},{default:h(()=>e[23]||(e[23]=[D(" Rename ")])),_:1}),d(N,{icon:"carbon-delete",n:"red",onClick:e[4]||(e[4]=k=>u.value=!u.value)},{default:h(()=>e[24]||(e[24]=[D(" Delete ")])),_:1})]),e[27]||(e[27]=t("div",{"flex-auto":""},null,-1)),w.value.length?(o(),V(ue,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":w.value},null,8,["code-snippets"])):S("",!0)]),d(Q,{modelValue:u.value,"onUpdate:modelValue":e[6]||(e[6]=k=>u.value=k)},{default:h(()=>[t("div",xt,[e[30]||(e[30]=t("span",null," Are you sure you want to delete this asset? ",-1)),t("div",bt,[d(N,{icon:"carbon-close",onClick:e[5]||(e[5]=k=>u.value=!1)},{default:h(()=>e[28]||(e[28]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon-delete",n:"red",onClick:A},{default:h(()=>e[29]||(e[29]=[D(" Delete ")])),_:1})])])]),_:1},8,["modelValue"]),d(Q,{modelValue:_.value,"onUpdate:modelValue":e[9]||(e[9]=k=>_.value=k)},{default:h(()=>[t("div",wt,[d(de,{modelValue:E.value,"onUpdate:modelValue":e[7]||(e[7]=k=>E.value=k),placeholder:"New name",n:"blue"},null,8,["modelValue"]),t("div",yt,[d(N,{icon:"carbon-close",onClick:e[8]||(e[8]=k=>_.value=!1)},{default:h(()=>e[31]||(e[31]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:R},{default:h(()=>e[32]||(e[32]=[D(" Rename ")])),_:1})])])]),_:1},8,["modelValue"]),m(n).type==="text"?(o(),V(Q,{key:0,modelValue:b.value,"onUpdate:modelValue":e[12]||(e[12]=k=>b.value=k)},{default:h(()=>[t("div",_t,[K(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=k=>j.value=k),placeholder:"Item value...",class:"h-lg w-xl of-auto rounded-lg p-4 text-sm font-mono outline-none",onKeydown:Ne(B,["enter"])},null,544),[[Se,j.value]]),t("div",$t,[d(N,{icon:"carbon-close",onClick:e[11]||(e[11]=k=>b.value=!1)},{default:h(()=>e[33]||(e[33]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon:save",n:"primary",onClick:B},{default:h(()=>e[34]||(e[34]=[D(" save ")])),_:1})])])]),_:1},8,["modelValue"])):S("",!0)],64)}}}),Ct={"h-full":"","of-auto":""},Vt={"flex-none":"",flex:"~ gap2 items-center","text-lg":""},Pt={flex:"~ items-center justify-center",absolute:"","bottom--1":"","right--1":"","h-4":"","w-4":"","rounded-full":"","bg-primary:30":"","text-8px":""},At={flex:"~ col","w-30":"","of-auto":""},Dt={"text-xs":"",op75:""},Ft={op50:""},Nt={key:0},St={"mt--4":"",px2:"",grid:"~ cols-minmax-8rem"},Ut={key:1,p2:"",grid:"~ cols-minmax-8rem"},It={key:1},Ht=Z({__name:"assets",setup(z){const l=ye(),f=T(!1),C=T(""),n=U(()=>new _e(l.value||[],{keys:["path"]})),v=$e(()=>{const w=[];for(const r of l.value||[]){const p=r.path.split(".").pop();p&&!w.find(s=>s.name===p)&&w.push({name:p,value:!0})}return w}),b=U(()=>(C.value?n.value.search(C.value).map(r=>r.item):l.value||[]).filter(r=>{const p=r.path.split(".").pop();return!p||v.some(s=>s.name===p&&s.value)})),j=U(()=>{const w={};for(const r of b.value){const p=`${r.path.split("/").slice(0,-1).join("/")}/`;w[p]||(w[p]=[]),w[p].push(r)}return Object.entries(w).sort(([r],[p])=>r.localeCompare(p))}),P=U(()=>{const w={path:"public",children:[]},r=(p,s,c)=>{const[g,...y]=s;let u=p.children.find(A=>A.path===g);u||(u={...c,path:g,children:[]},p.children.push(u)),y.length>1?r(u,y,c):y.length===1&&u.children.push({...c,path:y[0]})};return b.value.forEach(p=>{const s=p.path.split("/").filter(c=>c!=="");r(w,s,p)}),w.children}),x=T(),{view:B}=ke("assets");function q(){B.value=B.value==="list"?"grid":"list"}Ce("Escape",()=>{x.value=void 0});const O=T();return(w,r)=>{const p=te,s=Ve,c=Pe,g=Ae,y=Ge,u=it,A=Ue,_=re,E=kt,R=je,a=oe("tooltip");return o(),i("div",Ct,[d(g,{ref_key:"navbar",ref:O,search:C.value,"onUpdate:search":r[1]||(r[1]=e=>C.value=e),pb2:""},{actions:h(()=>[t("div",Vt,[K(d(p,{icon:"carbon:cloud-upload",title:"File Upload",border:!1,onClick:r[0]||(r[0]=e=>f.value=!f.value)},null,512),[[a,"File Upload",void 0,{"bottom-end":!0}]]),m(v).length?(o(),V(c,{key:0,direction:"end",n:"sm primary"},{trigger:h(({click:e})=>[K(d(p,{icon:"carbon-filter",border:!1,title:"Filter",p3:"","text-lg":"",onClick:$=>e()},null,8,["onClick"]),[[a,"Filter",void 0,{"bottom-end":!0}]]),t("span",Pt,F(m(v).length),1)]),default:h(()=>[t("div",At,[(o(!0),i(L,null,G(m(v),e=>(o(),V(s,{key:e.name,modelValue:e.value,"onUpdate:modelValue":$=>e.value=$,flex:"~ gap-2",rounded:"",px2:"",py2:""},{default:h(()=>[t("span",Dt,F(e.name),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))])]),_:1})):S("",!0),K(d(p,{"text-lg":"",border:!1,icon:m(B)==="grid"?"i-carbon-list":"i-carbon-grid",title:"Toggle view",onClick:q},null,8,["icon"]),[[a,"Toggle View",void 0,{"bottom-end":!0}]])])]),default:h(()=>[t("div",Ft,[C.value?(o(),i("span",Nt,F(b.value.length)+" matched · ",1)):S("",!0),t("span",null,F(m(l)?.length)+" assets in total",1)])]),_:1},8,["search"]),d(y,{modelValue:f.value,"onUpdate:modelValue":r[2]||(r[2]=e=>f.value=e),folder:"/"},null,8,["modelValue"]),m(B)==="grid"?(o(),i(L,{key:0},[j.value.length>1?(o(!0),i(L,{key:0},G(j.value,([e,$])=>(o(),V(A,{key:e,text:e,description:`${$.length} items`,open:$.length<=m(Be),padding:!1},{default:h(()=>[t("div",St,[(o(!0),i(L,null,G($,I=>(o(),V(u,{key:I.path,asset:I,folder:e,onClick:N=>x.value=I},null,8,["asset","folder","onClick"]))),128))])]),_:2},1032,["text","description","open"]))),128)):(o(),i("div",Ut,[(o(!0),i(L,null,G(b.value,e=>(o(),V(u,{key:e.path,asset:e,onClick:$=>x.value=e},null,8,["asset","onClick"]))),128))]))],64)):(o(),i("div",It,[(o(!0),i(L,null,G(P.value,(e,$)=>(o(),V(_,{key:$,modelValue:x.value,"onUpdate:modelValue":r[3]||(r[3]=I=>x.value=I),item:e},null,8,["modelValue","item"]))),128))])),d(R,{"model-value":!!x.value,"auto-close":"","w-120":"",top:O.value,onClose:r[5]||(r[5]=e=>x.value=void 0)},{default:h(()=>[x.value?(o(),V(E,{key:0,modelValue:x.value,"onUpdate:modelValue":r[4]||(r[4]=e=>x.value=e)},null,8,["modelValue"])):S("",!0)]),_:1},8,["model-value","top"])])}}});export{Ht as default};
@@ -0,0 +1 @@
1
+ img{-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;user-drag:none}