@nostale/cli 0.1.0

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/assets/docker-compose.server.yml +70 -0
  4. package/dist/commands/config/generation.js +23 -0
  5. package/dist/commands/config/providers.js +138 -0
  6. package/dist/commands/config/sources.js +145 -0
  7. package/dist/commands/config/templates.js +117 -0
  8. package/dist/commands/config/tokens.js +83 -0
  9. package/dist/commands/config.js +43 -0
  10. package/dist/commands/doctor.js +98 -0
  11. package/dist/commands/setup.js +5 -0
  12. package/dist/commands/start.js +23 -0
  13. package/dist/commands/status.js +17 -0
  14. package/dist/commands/stop.js +16 -0
  15. package/dist/index.js +23 -0
  16. package/dist/lib/api-config.js +21 -0
  17. package/dist/lib/env-writer.js +41 -0
  18. package/dist/lib/http.js +117 -0
  19. package/dist/lib/install-root.js +75 -0
  20. package/dist/lib/paths.js +12 -0
  21. package/dist/lib/ports.js +19 -0
  22. package/dist/lib/process-manager.js +151 -0
  23. package/dist/lib/repo-root.js +34 -0
  24. package/dist/lib/wizard.js +267 -0
  25. package/dist/tui/prompts.js +54 -0
  26. package/package.json +69 -0
  27. package/services/mcp-server/index.cjs +48326 -0
  28. package/services/migrations/001_init_rag_v1.sql +128 -0
  29. package/services/migrations/002_doc_lifecycle.sql +96 -0
  30. package/services/migrations/004_mcp_tokens.sql +11 -0
  31. package/services/migrations/005_settings.sql +28 -0
  32. package/services/migrations/006_document_sources.sql +14 -0
  33. package/services/migrations/007_generation_settings.sql +9 -0
  34. package/services/migrations/008_llm_provider_configs_unique.sql +5 -0
  35. package/services/wasm/tree-sitter-c.wasm +0 -0
  36. package/services/wasm/tree-sitter-c_sharp.wasm +0 -0
  37. package/services/wasm/tree-sitter-cpp.wasm +0 -0
  38. package/services/wasm/tree-sitter-dart.wasm +0 -0
  39. package/services/wasm/tree-sitter-go.wasm +0 -0
  40. package/services/wasm/tree-sitter-java.wasm +0 -0
  41. package/services/wasm/tree-sitter-javascript.wasm +0 -0
  42. package/services/wasm/tree-sitter-kotlin.wasm +0 -0
  43. package/services/wasm/tree-sitter-php.wasm +0 -0
  44. package/services/wasm/tree-sitter-python.wasm +0 -0
  45. package/services/wasm/tree-sitter-rust.wasm +0 -0
  46. package/services/wasm/tree-sitter-tsx.wasm +0 -0
  47. package/services/wasm/tree-sitter-typescript.wasm +0 -0
  48. package/services/wasm/tree-sitter.wasm +0 -0
  49. package/services/wiki-api/index.cjs +82370 -0
  50. package/services/wiki-web/.output/nitro.json +15 -0
  51. package/services/wiki-web/.output/public/_nuxt/68caad34b1e80fa12b3a.4Cpu5VkB.woff +0 -0
  52. package/services/wiki-web/.output/public/_nuxt/6b042d50787d4a81d659.D7JGeKLp.svg +1835 -0
  53. package/services/wiki-web/.output/public/_nuxt/9065bfe481020b04b68a.CMveUrS1.woff2 +0 -0
  54. package/services/wiki-web/.output/public/_nuxt/B5j-AdCY.js +1 -0
  55. package/services/wiki-web/.output/public/_nuxt/BAgZ2ZFT.js +1 -0
  56. package/services/wiki-web/.output/public/_nuxt/BcxnhBGC.js +1 -0
  57. package/services/wiki-web/.output/public/_nuxt/BeIDAJKt.js +1 -0
  58. package/services/wiki-web/.output/public/_nuxt/BebqDWPm.js +1 -0
  59. package/services/wiki-web/.output/public/_nuxt/CFx_Wb7e.js +1 -0
  60. package/services/wiki-web/.output/public/_nuxt/CSEkmdhK.js +1 -0
  61. package/services/wiki-web/.output/public/_nuxt/CXYMfke_.js +1 -0
  62. package/services/wiki-web/.output/public/_nuxt/Cap3hpB7.js +1 -0
  63. package/services/wiki-web/.output/public/_nuxt/Ckd7UvSj.js +3 -0
  64. package/services/wiki-web/.output/public/_nuxt/D0DJQL09.js +1 -0
  65. package/services/wiki-web/.output/public/_nuxt/DRDlUXmk.js +66 -0
  66. package/services/wiki-web/.output/public/_nuxt/DW42QLqA.js +1 -0
  67. package/services/wiki-web/.output/public/_nuxt/DdDtdYim.js +1 -0
  68. package/services/wiki-web/.output/public/_nuxt/Dm1y7TW1.js +1 -0
  69. package/services/wiki-web/.output/public/_nuxt/DptiLPkM.js +4 -0
  70. package/services/wiki-web/.output/public/_nuxt/QFl-TMXl.js +1 -0
  71. package/services/wiki-web/.output/public/_nuxt/_id_.JvKV2jiN.css +1 -0
  72. package/services/wiki-web/.output/public/_nuxt/a9c9056a643325579e2a.CCNAgZDa.ttf +0 -0
  73. package/services/wiki-web/.output/public/_nuxt/bojElwT6.js +1 -0
  74. package/services/wiki-web/.output/public/_nuxt/builds/latest.json +1 -0
  75. package/services/wiki-web/.output/public/_nuxt/builds/meta/f68e5546-2919-478b-b4ad-702826e8383c.json +1 -0
  76. package/services/wiki-web/.output/public/_nuxt/d495aba62101f856c80f.DJ4Lg1TH.eot +0 -0
  77. package/services/wiki-web/.output/public/_nuxt/entry.isoIPAS3.css +1 -0
  78. package/services/wiki-web/.output/public/_nuxt/f8QtLg7g.js +1 -0
  79. package/services/wiki-web/.output/public/_nuxt/nhMvlSQm.js +1 -0
  80. package/services/wiki-web/.output/public/_nuxt/pFBugkEL.js +1 -0
  81. package/services/wiki-web/.output/public/_nuxt/plus-jakarta-sans-latin-ext-wght-normal.DmpS2jIq.woff2 +0 -0
  82. package/services/wiki-web/.output/public/_nuxt/plus-jakarta-sans-latin-wght-normal.eXO_dkmS.woff2 +0 -0
  83. package/services/wiki-web/.output/public/_nuxt/plus-jakarta-sans-vietnamese-wght-normal.qRpaaN48.woff2 +0 -0
  84. package/services/wiki-web/.output/public/favicon.svg +6 -0
  85. package/services/wiki-web/.output/public/robots.txt +2 -0
  86. package/services/wiki-web/.output/server/chunks/_/error-500.mjs +19 -0
  87. package/services/wiki-web/.output/server/chunks/_/error-500.mjs.map +1 -0
  88. package/services/wiki-web/.output/server/chunks/build/client.precomputed.mjs +4 -0
  89. package/services/wiki-web/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
  90. package/services/wiki-web/.output/server/chunks/nitro/nitro.mjs +5352 -0
  91. package/services/wiki-web/.output/server/chunks/nitro/nitro.mjs.map +1 -0
  92. package/services/wiki-web/.output/server/chunks/routes/api-proxy/_...path_.mjs +34 -0
  93. package/services/wiki-web/.output/server/chunks/routes/api-proxy/_...path_.mjs.map +1 -0
  94. package/services/wiki-web/.output/server/chunks/routes/renderer.mjs +369 -0
  95. package/services/wiki-web/.output/server/chunks/routes/renderer.mjs.map +1 -0
  96. package/services/wiki-web/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  97. package/services/wiki-web/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
  98. package/services/wiki-web/.output/server/index.mjs +10 -0
  99. package/services/wiki-web/.output/server/index.mjs.map +1 -0
  100. package/services/wiki-web/.output/server/node_modules/@babel/parser/lib/index.js +14599 -0
  101. package/services/wiki-web/.output/server/node_modules/@babel/parser/package.json +50 -0
  102. package/services/wiki-web/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6759 -0
  103. package/services/wiki-web/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  104. package/services/wiki-web/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
  105. package/services/wiki-web/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  106. package/services/wiki-web/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
  107. package/services/wiki-web/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  108. package/services/wiki-web/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1899 -0
  109. package/services/wiki-web/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  110. package/services/wiki-web/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6940 -0
  111. package/services/wiki-web/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  112. package/services/wiki-web/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1822 -0
  113. package/services/wiki-web/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  114. package/services/wiki-web/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +896 -0
  115. package/services/wiki-web/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
  116. package/services/wiki-web/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +604 -0
  117. package/services/wiki-web/.output/server/node_modules/@vue/shared/package.json +47 -0
  118. package/services/wiki-web/.output/server/node_modules/devalue/index.js +4 -0
  119. package/services/wiki-web/.output/server/node_modules/devalue/package.json +40 -0
  120. package/services/wiki-web/.output/server/node_modules/devalue/src/base64.js +60 -0
  121. package/services/wiki-web/.output/server/node_modules/devalue/src/constants.js +12 -0
  122. package/services/wiki-web/.output/server/node_modules/devalue/src/parse.js +283 -0
  123. package/services/wiki-web/.output/server/node_modules/devalue/src/stringify.js +401 -0
  124. package/services/wiki-web/.output/server/node_modules/devalue/src/uneval.js +552 -0
  125. package/services/wiki-web/.output/server/node_modules/devalue/src/utils.js +160 -0
  126. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  127. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  128. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  129. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  130. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  131. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  132. package/services/wiki-web/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  133. package/services/wiki-web/.output/server/node_modules/entities/package.json +120 -0
  134. package/services/wiki-web/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  135. package/services/wiki-web/.output/server/node_modules/estree-walker/package.json +37 -0
  136. package/services/wiki-web/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  137. package/services/wiki-web/.output/server/node_modules/hookable/package.json +53 -0
  138. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  139. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  140. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  141. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  142. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  143. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  144. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  145. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  146. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  147. package/services/wiki-web/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  148. package/services/wiki-web/.output/server/node_modules/source-map-js/package.json +71 -0
  149. package/services/wiki-web/.output/server/node_modules/source-map-js/source-map.js +8 -0
  150. package/services/wiki-web/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  151. package/services/wiki-web/.output/server/node_modules/ufo/package.json +48 -0
  152. package/services/wiki-web/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
  153. package/services/wiki-web/.output/server/node_modules/unhead/dist/plugins.mjs +101 -0
  154. package/services/wiki-web/.output/server/node_modules/unhead/dist/server.mjs +180 -0
  155. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.B3VbJo7Y.mjs +207 -0
  156. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
  157. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.CaI5ZD4O.mjs +182 -0
  158. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +71 -0
  159. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.D4vSFytZ.mjs +236 -0
  160. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
  161. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.TxTMM7cM.mjs +166 -0
  162. package/services/wiki-web/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
  163. package/services/wiki-web/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
  164. package/services/wiki-web/.output/server/node_modules/unhead/package.json +105 -0
  165. package/services/wiki-web/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  166. package/services/wiki-web/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  167. package/services/wiki-web/.output/server/node_modules/vue/index.js +7 -0
  168. package/services/wiki-web/.output/server/node_modules/vue/index.mjs +1 -0
  169. package/services/wiki-web/.output/server/node_modules/vue/package.json +112 -0
  170. package/services/wiki-web/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  171. package/services/wiki-web/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +249 -0
  172. package/services/wiki-web/.output/server/node_modules/vue-bundle-renderer/package.json +57 -0
  173. package/services/wiki-web/.output/server/package.json +26 -0
  174. package/services/wiki-worker/index.cjs +66661 -0
@@ -0,0 +1,236 @@
1
+ import { u as unpackMeta } from './unhead.DQc16pHI.mjs';
2
+
3
+ function defineHeadPlugin(plugin) {
4
+ return plugin;
5
+ }
6
+
7
+ const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({
8
+ key: "flatMeta",
9
+ hooks: {
10
+ "entries:normalize": (ctx) => {
11
+ const tagsToAdd = [];
12
+ ctx.tags = ctx.tags.map((t) => {
13
+ if (t.tag !== "_flatMeta") {
14
+ return t;
15
+ }
16
+ tagsToAdd.push(unpackMeta(t.props).map((p) => ({
17
+ ...t,
18
+ tag: "meta",
19
+ props: p
20
+ })));
21
+ return false;
22
+ }).filter(Boolean).concat(...tagsToAdd);
23
+ }
24
+ }
25
+ });
26
+
27
+ const WhitelistAttributes = {
28
+ htmlAttrs: /* @__PURE__ */ new Set(["class", "style", "lang", "dir"]),
29
+ bodyAttrs: /* @__PURE__ */ new Set(["class", "style"]),
30
+ meta: /* @__PURE__ */ new Set(["name", "property", "charset", "content", "media"]),
31
+ noscript: /* @__PURE__ */ new Set([]),
32
+ style: /* @__PURE__ */ new Set(["media", "nonce", "title", "blocking"]),
33
+ script: /* @__PURE__ */ new Set(["type", "textContent", "nonce", "blocking"]),
34
+ link: /* @__PURE__ */ new Set(["color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"])
35
+ };
36
+ const BlockedLinkRels = /* @__PURE__ */ new Set(["canonical", "modulepreload", "prerender", "preload", "prefetch", "dns-prefetch", "preconnect", "manifest", "pingback"]);
37
+ const SafeAttrName = /^[a-z][a-z0-9\-]*[a-z0-9]$/i;
38
+ const HtmlEntityHex = /&#x([0-9a-f]+);?/gi;
39
+ const HtmlEntityDec = /&#(\d+);?/g;
40
+ const HtmlEntityNamed = /&(tab|newline|colon|semi|lpar|rpar|sol|bsol|comma|period|excl|num|dollar|percnt|amp|apos|ast|plus|lt|gt|equals|quest|at|lsqb|rsqb|lcub|rcub|vert|hat|grave|tilde|nbsp);?/gi;
41
+ const ControlChars = /[\x00-\x20]+/g;
42
+ const NamedEntityMap = {
43
+ tab: " ",
44
+ newline: "\n",
45
+ colon: ":",
46
+ semi: ";",
47
+ lpar: "(",
48
+ rpar: ")",
49
+ sol: "/",
50
+ bsol: "\\",
51
+ comma: ",",
52
+ period: ".",
53
+ excl: "!",
54
+ num: "#",
55
+ dollar: "$",
56
+ percnt: "%",
57
+ amp: "&",
58
+ apos: "'",
59
+ ast: "*",
60
+ plus: "+",
61
+ lt: "<",
62
+ gt: ">",
63
+ equals: "=",
64
+ quest: "?",
65
+ at: "@",
66
+ lsqb: "[",
67
+ rsqb: "]",
68
+ lcub: "{",
69
+ rcub: "}",
70
+ vert: "|",
71
+ hat: "^",
72
+ grave: "`",
73
+ tilde: "~",
74
+ nbsp: "\xA0"
75
+ };
76
+ function safeFromCodePoint(codePoint) {
77
+ if (codePoint > 1114111 || codePoint < 0 || Number.isNaN(codePoint))
78
+ return "";
79
+ return String.fromCodePoint(codePoint);
80
+ }
81
+ function decodeHtmlEntities(str) {
82
+ return str.replace(HtmlEntityHex, (_, hex) => safeFromCodePoint(Number.parseInt(hex, 16))).replace(HtmlEntityDec, (_, dec) => safeFromCodePoint(Number(dec))).replace(HtmlEntityNamed, (_, name) => NamedEntityMap[name.toLowerCase()] || "");
83
+ }
84
+ function hasDangerousProtocol(url) {
85
+ const entityDecoded = decodeHtmlEntities(url);
86
+ const cleaned = entityDecoded.replace(ControlChars, "");
87
+ let decoded;
88
+ try {
89
+ decoded = decodeURIComponent(cleaned);
90
+ } catch {
91
+ decoded = cleaned;
92
+ }
93
+ const sanitized = decoded.replace(ControlChars, "");
94
+ const lower = sanitized.toLowerCase();
95
+ return lower.startsWith("javascript:") || lower.startsWith("data:") || lower.startsWith("vbscript:");
96
+ }
97
+ function stripProtoKeys(obj) {
98
+ if (Array.isArray(obj))
99
+ return obj.map(stripProtoKeys);
100
+ if (obj && typeof obj === "object") {
101
+ const clean = {};
102
+ for (const key of Object.keys(obj)) {
103
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
104
+ continue;
105
+ clean[key] = stripProtoKeys(obj[key]);
106
+ }
107
+ return clean;
108
+ }
109
+ return obj;
110
+ }
111
+ function acceptDataAttrs(value, allowId = true) {
112
+ return Object.fromEntries(
113
+ Object.entries(value || {}).filter(([key]) => (allowId && key === "id" || key.startsWith("data-")) && SafeAttrName.test(key))
114
+ );
115
+ }
116
+ function makeTagSafe(tag) {
117
+ let next = {};
118
+ const { tag: type, props: prev } = tag;
119
+ switch (type) {
120
+ // title: textContent is escaped in rendering (tagToString), no props needed
121
+ case "title":
122
+ break;
123
+ // virtual tags, not rendered to HTML — but sanitize to prevent injection if rendered
124
+ case "titleTemplate":
125
+ case "templateParams":
126
+ next = prev;
127
+ break;
128
+ case "htmlAttrs":
129
+ case "bodyAttrs":
130
+ WhitelistAttributes[type].forEach((attr) => {
131
+ if (prev[attr]) {
132
+ next[attr] = prev[attr];
133
+ }
134
+ });
135
+ delete tag.innerHTML;
136
+ delete tag.textContent;
137
+ tag.props = { ...acceptDataAttrs(prev, false), ...next };
138
+ return !Object.keys(tag.props).length ? false : tag;
139
+ case "style":
140
+ next = acceptDataAttrs(prev);
141
+ WhitelistAttributes.style.forEach((key) => {
142
+ if (prev[key]) {
143
+ next[key] = prev[key];
144
+ }
145
+ });
146
+ break;
147
+ // meta is safe, except for http-equiv
148
+ case "meta":
149
+ WhitelistAttributes.meta.forEach((key) => {
150
+ if (prev[key]) {
151
+ next[key] = prev[key];
152
+ }
153
+ });
154
+ break;
155
+ // link tags we block preloading, prerendering, prefetching, dns-prefetch, preconnect, manifest, etc
156
+ case "link":
157
+ WhitelistAttributes.link.forEach((key) => {
158
+ const val = prev[key];
159
+ if (!val) {
160
+ return;
161
+ }
162
+ if (key === "rel" && (typeof val !== "string" || BlockedLinkRels.has(val.toLowerCase()))) {
163
+ return;
164
+ }
165
+ if (key === "href" || key === "imagesrcset") {
166
+ if (typeof val !== "string") {
167
+ return;
168
+ }
169
+ const urls = key === "imagesrcset" ? val.split(",").map((s) => s.trim()) : [val];
170
+ if (urls.some((u) => hasDangerousProtocol(u))) {
171
+ return;
172
+ }
173
+ next[key] = val;
174
+ } else if (val) {
175
+ next[key] = val;
176
+ }
177
+ });
178
+ if (!next.href && !next.imagesrcset || !next.rel) {
179
+ return false;
180
+ }
181
+ break;
182
+ case "noscript":
183
+ WhitelistAttributes.noscript.forEach((key) => {
184
+ if (prev[key]) {
185
+ next[key] = prev[key];
186
+ }
187
+ });
188
+ break;
189
+ // we only allow JSON in scripts
190
+ case "script":
191
+ if (!tag.textContent || typeof prev.type !== "string" || !prev.type.endsWith("json")) {
192
+ return false;
193
+ }
194
+ try {
195
+ const jsonVal = typeof tag.textContent === "string" ? JSON.parse(tag.textContent) : tag.textContent;
196
+ tag.textContent = JSON.stringify(stripProtoKeys(jsonVal), null, 0);
197
+ } catch {
198
+ return false;
199
+ }
200
+ WhitelistAttributes.script.forEach((s) => {
201
+ if (s !== "textContent" && prev[s]) {
202
+ next[s] = prev[s];
203
+ }
204
+ });
205
+ break;
206
+ }
207
+ delete tag.innerHTML;
208
+ if (type !== "title" && type !== "script") {
209
+ delete tag.textContent;
210
+ }
211
+ tag.props = { ...acceptDataAttrs(prev), ...next };
212
+ if (!Object.keys(tag.props).length && !tag.tag.endsWith("Attrs") && !tag.textContent) {
213
+ return false;
214
+ }
215
+ return tag;
216
+ }
217
+ const SafeInputPlugin = (
218
+ /* @PURE */
219
+ defineHeadPlugin({
220
+ key: "safe",
221
+ hooks: {
222
+ "entries:normalize": (ctx) => {
223
+ if (ctx.entry.options?._safe) {
224
+ ctx.tags = ctx.tags.reduce((acc, tag) => {
225
+ const safeTag = makeTagSafe(tag);
226
+ if (safeTag)
227
+ acc.push(safeTag);
228
+ return acc;
229
+ }, []);
230
+ }
231
+ }
232
+ }
233
+ })
234
+ );
235
+
236
+ export { FlatMetaPlugin as F, SafeInputPlugin as S, defineHeadPlugin as d };
@@ -0,0 +1,196 @@
1
+ import { M as MetaTagsArrayable } from './unhead.yem5I2v_.mjs';
2
+
3
+ const NAMESPACES = {
4
+ META: /* @__PURE__ */ new Set(["twitter"]),
5
+ OG: /* @__PURE__ */ new Set(["og", "book", "article", "profile", "fb"]),
6
+ MEDIA: /* @__PURE__ */ new Set(["ogImage", "ogVideo", "ogAudio", "twitterImage"]),
7
+ HTTP_EQUIV: /* @__PURE__ */ new Set(["contentType", "defaultStyle", "xUaCompatible"])
8
+ };
9
+ const META_ALIASES = {
10
+ articleExpirationTime: "article:expiration_time",
11
+ articleModifiedTime: "article:modified_time",
12
+ articlePublishedTime: "article:published_time",
13
+ bookReleaseDate: "book:release_date",
14
+ fbAppId: "fb:app_id",
15
+ ogAudioSecureUrl: "og:audio:secure_url",
16
+ ogAudioUrl: "og:audio",
17
+ ogImageSecureUrl: "og:image:secure_url",
18
+ ogImageUrl: "og:image",
19
+ ogSiteName: "og:site_name",
20
+ ogVideoSecureUrl: "og:video:secure_url",
21
+ ogVideoUrl: "og:video",
22
+ profileFirstName: "profile:first_name",
23
+ profileLastName: "profile:last_name",
24
+ profileUsername: "profile:username",
25
+ msapplicationConfig: "msapplication-Config",
26
+ msapplicationTileColor: "msapplication-TileColor",
27
+ msapplicationTileImage: "msapplication-TileImage"
28
+ };
29
+ const MetaPackingSchema = {
30
+ appleItunesApp: {
31
+ unpack: {
32
+ entrySeparator: ", ",
33
+ // @ts-expect-error untyped
34
+ resolve: ({ key, value }) => `${fixKeyCase(key)}=${value}`
35
+ }
36
+ },
37
+ refresh: {
38
+ metaKey: "http-equiv",
39
+ unpack: {
40
+ entrySeparator: ";",
41
+ // @ts-expect-error untyped
42
+ resolve: ({ key, value }) => key === "seconds" ? `${value}` : void 0
43
+ }
44
+ },
45
+ robots: {
46
+ unpack: {
47
+ entrySeparator: ", ",
48
+ // @ts-expect-error untyped
49
+ resolve: ({ key, value }) => typeof value === "boolean" ? fixKeyCase(key) : `${fixKeyCase(key)}:${value}`
50
+ }
51
+ },
52
+ contentSecurityPolicy: {
53
+ metaKey: "http-equiv",
54
+ unpack: {
55
+ entrySeparator: "; ",
56
+ // @ts-expect-error untyped
57
+ resolve: ({ key, value }) => `${fixKeyCase(key)} ${value}`
58
+ }
59
+ },
60
+ charset: {}
61
+ };
62
+ function fixKeyCase(key) {
63
+ const updated = key.replace(/([A-Z])/g, "-$1").toLowerCase();
64
+ const prefixIndex = updated.indexOf("-");
65
+ return prefixIndex === -1 ? updated : NAMESPACES.META.has(updated.slice(0, prefixIndex)) || NAMESPACES.OG.has(updated.slice(0, prefixIndex)) ? key.replace(/([A-Z])/g, ":$1").toLowerCase() : updated;
66
+ }
67
+ function sanitizeObject(input) {
68
+ return Object.fromEntries(Object.entries(input).filter(([k, v]) => String(v) !== "false" && k));
69
+ }
70
+ function transformObject(obj) {
71
+ return Array.isArray(obj) ? obj.map(transformObject) : !obj || typeof obj !== "object" ? obj : Object.fromEntries(Object.entries(obj).map(([k, v]) => [fixKeyCase(k), transformObject(v)]));
72
+ }
73
+ function unpackToString(value, options = {}) {
74
+ const { entrySeparator = "", keyValueSeparator = "", wrapValue, resolve } = options;
75
+ return Object.entries(value).map(([key, val]) => {
76
+ if (resolve) {
77
+ const resolved = resolve({ key, value: val });
78
+ if (resolved !== void 0)
79
+ return resolved;
80
+ }
81
+ const processedVal = typeof val === "object" ? unpackToString(val, options) : typeof val === "number" ? val.toString() : typeof val === "string" && wrapValue ? `${wrapValue}${val.replace(new RegExp(wrapValue, "g"), `\\${wrapValue}`)}${wrapValue}` : val;
82
+ return `${key}${keyValueSeparator}${processedVal}`;
83
+ }).join(entrySeparator);
84
+ }
85
+ function handleObjectEntry(key, value) {
86
+ const sanitizedValue = sanitizeObject(value);
87
+ const fixedKey = fixKeyCase(key);
88
+ const attr = resolveMetaKeyType(fixedKey);
89
+ if (!MetaTagsArrayable.has(fixedKey)) {
90
+ return [{ [attr]: fixedKey, ...sanitizedValue }];
91
+ }
92
+ const input = Object.fromEntries(
93
+ Object.entries(sanitizedValue).map(([k, v]) => [`${key}${k === "url" ? "" : `${k[0].toUpperCase()}${k.slice(1)}`}`, v])
94
+ );
95
+ return unpackMeta(input || {}).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
96
+ }
97
+ function resolveMetaKeyType(key) {
98
+ if (MetaPackingSchema[key]?.metaKey === "http-equiv" || NAMESPACES.HTTP_EQUIV.has(key)) {
99
+ return "http-equiv";
100
+ }
101
+ const fixed = fixKeyCase(key);
102
+ const colonIndex = fixed.indexOf(":");
103
+ return colonIndex === -1 ? "name" : NAMESPACES.OG.has(fixed.slice(0, colonIndex)) ? "property" : "name";
104
+ }
105
+ function resolveMetaKeyValue(key) {
106
+ return META_ALIASES[key] || fixKeyCase(key);
107
+ }
108
+ function resolvePackedMetaObjectValue(value, key) {
109
+ if (key === "refresh")
110
+ return `${value.seconds};url=${value.url}`;
111
+ return unpackToString(transformObject(value), {
112
+ keyValueSeparator: "=",
113
+ entrySeparator: ", ",
114
+ resolve: ({ value: value2, key: key2 }) => value2 === null ? "" : typeof value2 === "boolean" ? key2 : void 0,
115
+ // @ts-expect-error untyped
116
+ ...MetaPackingSchema[key]?.unpack
117
+ });
118
+ }
119
+ function unpackMeta(input) {
120
+ const extras = [];
121
+ const primitives = {};
122
+ for (const [key, value] of Object.entries(input)) {
123
+ if (Array.isArray(value)) {
124
+ if (key === "themeColor") {
125
+ value.forEach((v) => {
126
+ if (typeof v === "object" && v !== null) {
127
+ extras.push({ name: "theme-color", ...v });
128
+ }
129
+ });
130
+ continue;
131
+ }
132
+ for (const v of value) {
133
+ if (typeof v === "object" && v !== null) {
134
+ const urlProps = [];
135
+ const otherProps = [];
136
+ for (const [propKey, propValue] of Object.entries(v)) {
137
+ const metaKey = `${key}${propKey === "url" ? "" : `:${propKey}`}`;
138
+ const meta2 = unpackMeta({ [metaKey]: propValue });
139
+ (propKey === "url" ? urlProps : otherProps).push(...meta2);
140
+ }
141
+ extras.push(...urlProps, ...otherProps);
142
+ } else {
143
+ extras.push(...typeof v === "string" ? unpackMeta({ [key]: v }) : handleObjectEntry(key, v));
144
+ }
145
+ }
146
+ continue;
147
+ }
148
+ if (typeof value === "object" && value) {
149
+ if (NAMESPACES.MEDIA.has(key)) {
150
+ const prefix = key.startsWith("twitter") ? "twitter" : "og";
151
+ const type = key.replace(/^(og|twitter)/, "").toLowerCase();
152
+ const metaKey = prefix === "twitter" ? "name" : "property";
153
+ if (value.url) {
154
+ extras.push({
155
+ [metaKey]: `${prefix}:${type}`,
156
+ content: value.url
157
+ });
158
+ }
159
+ if (value.secureUrl) {
160
+ extras.push({
161
+ [metaKey]: `${prefix}:${type}:secure_url`,
162
+ content: value.secureUrl
163
+ });
164
+ }
165
+ for (const [propKey, propValue] of Object.entries(value)) {
166
+ if (propKey !== "url" && propKey !== "secureUrl") {
167
+ extras.push({
168
+ [metaKey]: `${prefix}:${type}:${propKey}`,
169
+ // @ts-expect-error untyped
170
+ content: propValue
171
+ });
172
+ }
173
+ }
174
+ } else if (MetaTagsArrayable.has(fixKeyCase(key))) {
175
+ extras.push(...handleObjectEntry(key, value));
176
+ } else {
177
+ primitives[key] = sanitizeObject(value);
178
+ }
179
+ } else {
180
+ primitives[key] = value;
181
+ }
182
+ }
183
+ const meta = Object.entries(primitives).map(([key, value]) => {
184
+ if (key === "charset")
185
+ return { charset: value === null ? "_null" : value };
186
+ const metaKey = resolveMetaKeyType(key);
187
+ const keyValue = resolveMetaKeyValue(key);
188
+ const processedValue = value === null ? "_null" : typeof value === "object" ? resolvePackedMetaObjectValue(value, key) : typeof value === "number" ? value.toString() : value;
189
+ return metaKey === "http-equiv" ? { "http-equiv": keyValue, "content": processedValue } : { [metaKey]: keyValue, content: processedValue };
190
+ });
191
+ return [...extras, ...meta].map(
192
+ (m) => !("content" in m) ? m : m.content === "_null" ? { ...m, content: null } : m
193
+ );
194
+ }
195
+
196
+ export { resolveMetaKeyValue as a, resolvePackedMetaObjectValue as b, resolveMetaKeyType as r, unpackMeta as u };
@@ -0,0 +1,166 @@
1
+ import { d as defineHeadPlugin } from './unhead.D4vSFytZ.mjs';
2
+ import { s as sortTags } from './unhead.CbpEuj3y.mjs';
3
+ import { p as processTemplateParams } from './unhead.BYvz9V1x.mjs';
4
+
5
+ const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k;
6
+ const AliasSortingPlugin = defineHeadPlugin({
7
+ key: "aliasSorting",
8
+ hooks: {
9
+ "tags:resolve": (ctx) => {
10
+ let m = false;
11
+ for (const t of ctx.tags) {
12
+ const p = t.tagPriority;
13
+ if (!p)
14
+ continue;
15
+ const s = String(p);
16
+ if (s.startsWith("before:")) {
17
+ const k = formatKey(s.slice(7));
18
+ const l = ctx.tagMap.get(k);
19
+ if (l) {
20
+ if (typeof l.tagPriority === "number")
21
+ t.tagPriority = l.tagPriority;
22
+ t._p = l._p - 1;
23
+ m = true;
24
+ }
25
+ } else if (s.startsWith("after:")) {
26
+ const k = formatKey(s.slice(6));
27
+ const l = ctx.tagMap.get(k);
28
+ if (l) {
29
+ if (typeof l.tagPriority === "number")
30
+ t.tagPriority = l.tagPriority;
31
+ t._p = l._p + 1;
32
+ m = true;
33
+ }
34
+ }
35
+ }
36
+ if (m)
37
+ ctx.tags = ctx.tags.sort(sortTags);
38
+ }
39
+ }
40
+ });
41
+
42
+ const DeprecationsPlugin = /* @__PURE__ */ defineHeadPlugin({
43
+ key: "deprecations",
44
+ hooks: {
45
+ "entries:normalize": ({ tags }) => {
46
+ for (const tag of tags) {
47
+ if (tag.props.children) {
48
+ tag.innerHTML = tag.props.children;
49
+ delete tag.props.children;
50
+ }
51
+ if (tag.props.hid) {
52
+ tag.key = tag.props.hid;
53
+ delete tag.props.hid;
54
+ }
55
+ if (tag.props.vmid) {
56
+ tag.key = tag.props.vmid;
57
+ delete tag.props.vmid;
58
+ }
59
+ if (tag.props.body) {
60
+ tag.tagPosition = "bodyClose";
61
+ delete tag.props.body;
62
+ }
63
+ }
64
+ }
65
+ }
66
+ });
67
+
68
+ async function walkPromises(v) {
69
+ const type = typeof v;
70
+ if (type === "function") {
71
+ return v;
72
+ }
73
+ if (v instanceof Promise) {
74
+ return await v;
75
+ }
76
+ if (Array.isArray(v)) {
77
+ return await Promise.all(v.map((r) => walkPromises(r)));
78
+ }
79
+ if (v?.constructor === Object) {
80
+ const next = {};
81
+ for (const key of Object.keys(v)) {
82
+ next[key] = await walkPromises(v[key]);
83
+ }
84
+ return next;
85
+ }
86
+ return v;
87
+ }
88
+ const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({
89
+ key: "promises",
90
+ hooks: {
91
+ "entries:resolve": async (ctx) => {
92
+ const promises = [];
93
+ for (const k in ctx.entries) {
94
+ if (!ctx.entries[k]._promisesProcessed) {
95
+ promises.push(
96
+ walkPromises(ctx.entries[k].input).then((val) => {
97
+ ctx.entries[k].input = val;
98
+ ctx.entries[k]._promisesProcessed = true;
99
+ })
100
+ );
101
+ }
102
+ }
103
+ await Promise.all(promises);
104
+ }
105
+ }
106
+ });
107
+
108
+ const SupportedAttrs = {
109
+ meta: "content",
110
+ link: "href",
111
+ htmlAttrs: "lang"
112
+ };
113
+ const contentAttrs = ["innerHTML", "textContent"];
114
+ const TemplateParamsPlugin = /* @__PURE__ */ defineHeadPlugin((head) => {
115
+ return {
116
+ key: "template-params",
117
+ hooks: {
118
+ "entries:normalize": (ctx) => {
119
+ const params = ctx.tags.filter((t) => t.tag === "templateParams" && t.mode === "server")?.[0]?.props || {};
120
+ if (Object.keys(params).length) {
121
+ head._ssrPayload = {
122
+ templateParams: {
123
+ ...head._ssrPayload?.templateParams || {},
124
+ ...params
125
+ }
126
+ };
127
+ }
128
+ },
129
+ "tags:resolve": ({ tagMap, tags }) => {
130
+ const params = tagMap.get("templateParams")?.props || {};
131
+ const sep = params.separator || "|";
132
+ delete params.separator;
133
+ params.pageTitle = processTemplateParams(
134
+ // find templateParams
135
+ params.pageTitle || head._title || "",
136
+ params,
137
+ sep
138
+ );
139
+ for (const tag of tags) {
140
+ if (tag.processTemplateParams === false) {
141
+ continue;
142
+ }
143
+ const v = SupportedAttrs[tag.tag];
144
+ if (v && typeof tag.props[v] === "string") {
145
+ tag.props[v] = processTemplateParams(tag.props[v], params, sep);
146
+ } else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") {
147
+ for (const p of contentAttrs) {
148
+ if (typeof tag[p] === "string")
149
+ tag[p] = processTemplateParams(tag[p], params, sep, tag.tag === "script" && tag.props.type.endsWith("json"));
150
+ }
151
+ }
152
+ }
153
+ head._templateParams = params;
154
+ head._separator = sep;
155
+ },
156
+ "tags:afterResolve": ({ tagMap }) => {
157
+ const title = tagMap.get("title");
158
+ if (title?.textContent && title.processTemplateParams !== false) {
159
+ title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator);
160
+ }
161
+ }
162
+ }
163
+ };
164
+ });
165
+
166
+ export { AliasSortingPlugin as A, DeprecationsPlugin as D, PromisesPlugin as P, TemplateParamsPlugin as T };
@@ -0,0 +1,38 @@
1
+ const SelfClosingTags = /* @__PURE__ */ new Set(["meta", "link", "base"]);
2
+ const DupeableTags = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]);
3
+ const TagsWithInnerContent = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]);
4
+ const HasElementTags = /* @__PURE__ */ new Set([
5
+ "base",
6
+ "meta",
7
+ "link",
8
+ "style",
9
+ "script",
10
+ "noscript"
11
+ ]);
12
+ const ValidHeadTags = /* @__PURE__ */ new Set([
13
+ "title",
14
+ "base",
15
+ "htmlAttrs",
16
+ "bodyAttrs",
17
+ "meta",
18
+ "link",
19
+ "style",
20
+ "script",
21
+ "noscript"
22
+ ]);
23
+ const UniqueTags = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]);
24
+ const TagConfigKeys = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]);
25
+ const ScriptNetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror"]);
26
+ const UsesMergeStrategy = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]);
27
+ const MetaTagsArrayable = /* @__PURE__ */ new Set([
28
+ "theme-color",
29
+ "google-site-verification",
30
+ "og",
31
+ "article",
32
+ "book",
33
+ "profile",
34
+ "twitter",
35
+ "author"
36
+ ]);
37
+
38
+ export { DupeableTags as D, HasElementTags as H, MetaTagsArrayable as M, SelfClosingTags as S, TagsWithInnerContent as T, UniqueTags as U, ValidHeadTags as V, TagConfigKeys as a, ScriptNetworkEvents as b, UsesMergeStrategy as c };
@@ -0,0 +1,5 @@
1
+ export { D as DupeableTags, H as HasElementTags, M as MetaTagsArrayable, b as ScriptNetworkEvents, S as SelfClosingTags, a as TagConfigKeys, T as TagsWithInnerContent, U as UniqueTags, c as UsesMergeStrategy, V as ValidHeadTags } from './shared/unhead.yem5I2v_.mjs';
2
+ export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.B3VbJo7Y.mjs';
3
+ export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.DQc16pHI.mjs';
4
+ export { s as sortTags, t as tagWeight } from './shared/unhead.CbpEuj3y.mjs';
5
+ export { p as processTemplateParams } from './shared/unhead.BYvz9V1x.mjs';