tempo-sdk 0.0.51 → 0.0.57

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 (84) hide show
  1. package/dist/assets/editor.d.ts +1 -1
  2. package/dist/assets/editor.js +1 -1
  3. package/dist/assets/index.d.ts +3 -3
  4. package/dist/assets/index.js +4 -2
  5. package/dist/assets/index.js.map +1 -1
  6. package/dist/assets/parser.d.ts +10 -4
  7. package/dist/assets/parser.js +1 -1
  8. package/dist/canvas/editor.d.ts +11 -16
  9. package/dist/canvas/editor.js +79 -49
  10. package/dist/canvas/editor.js.map +1 -1
  11. package/dist/canvas/index.d.ts +15 -11
  12. package/dist/canvas/index.js +130 -47
  13. package/dist/canvas/index.js.map +1 -1
  14. package/dist/canvas/interact-projection.js +4 -3
  15. package/dist/canvas/parser.d.ts +10 -5
  16. package/dist/canvas/parser.js +3 -1
  17. package/dist/canvas/svelte.d.ts +9 -7
  18. package/dist/canvas/svelte.js +20 -5
  19. package/dist/canvas/svelte.js.map +1 -1
  20. package/dist/chunk-2IQD2KPS.js +219 -0
  21. package/dist/chunk-2IQD2KPS.js.map +1 -0
  22. package/dist/chunk-5BHIHP25.js +410 -0
  23. package/dist/chunk-5BHIHP25.js.map +1 -0
  24. package/dist/chunk-EMYYTS6D.js +1585 -0
  25. package/dist/chunk-EMYYTS6D.js.map +1 -0
  26. package/dist/{chunk-DX6XAXCK.js → chunk-N2TYN3RB.js} +189 -420
  27. package/dist/chunk-N2TYN3RB.js.map +1 -0
  28. package/dist/{chunk-LFYKJJC5.js → chunk-QXL6GL2P.js} +18 -3
  29. package/dist/chunk-QXL6GL2P.js.map +1 -0
  30. package/dist/{chunk-QP2NTODB.js → chunk-RHHVVWAC.js} +115 -25
  31. package/dist/chunk-RHHVVWAC.js.map +1 -0
  32. package/dist/chunk-TL4MGN7E.js +2570 -0
  33. package/dist/chunk-TL4MGN7E.js.map +1 -0
  34. package/dist/{chunk-PULSTDX2.js → chunk-U3SLJNRS.js} +284 -46
  35. package/dist/chunk-U3SLJNRS.js.map +1 -0
  36. package/dist/{chunk-ZZYNOX24.js → chunk-U64AHDHZ.js} +1708 -2461
  37. package/dist/chunk-U64AHDHZ.js.map +1 -0
  38. package/dist/{chunk-O65OD3NA.js → chunk-XLEKCOB7.js} +6 -5
  39. package/dist/chunk-XLEKCOB7.js.map +1 -0
  40. package/dist/expo/plugin.cjs +1256 -16
  41. package/dist/expo/plugin.cjs.map +1 -1
  42. package/dist/expo/plugin.d.cts +0 -1
  43. package/dist/expo/plugin.d.ts +0 -1
  44. package/dist/expo/plugin.js +1 -1
  45. package/dist/expo-babel-plugin.cjs +1258 -16
  46. package/dist/expo-babel-plugin.cjs.map +1 -1
  47. package/dist/expo-babel-plugin.d.cts +8 -5
  48. package/dist/expo-babel-plugin.d.ts +8 -5
  49. package/dist/expo-babel-plugin.js +1 -1
  50. package/dist/index.d.ts +5 -1
  51. package/dist/index.js +464 -154
  52. package/dist/index.js.map +1 -1
  53. package/dist/nextjs/plugin.cjs +151 -0
  54. package/dist/nextjs/plugin.cjs.map +1 -1
  55. package/dist/nextjs/plugin.d.cts +1 -1
  56. package/dist/nextjs/plugin.d.ts +1 -1
  57. package/dist/nextjs/plugin.js +1 -1
  58. package/dist/nextjs-loader.cjs +1432 -35
  59. package/dist/nextjs-loader.cjs.map +1 -1
  60. package/dist/nextjs.cjs +17 -2
  61. package/dist/nextjs.cjs.map +1 -1
  62. package/dist/nextjs.d.cts +14 -3
  63. package/dist/nextjs.d.ts +14 -3
  64. package/dist/nextjs.js +1 -1
  65. package/dist/{page-xi1aI5a7.d.ts → page-DwLnOM5d.d.ts} +12 -6
  66. package/dist/{storyboard-CBHki7Aw.d.ts → storyboard-BtQuVGpl.d.ts} +35 -17
  67. package/dist/svelte.d.ts +3 -2
  68. package/dist/svelte.js +103 -29
  69. package/dist/svelte.js.map +1 -1
  70. package/dist/{types-C7cvcY6T.d.ts → types-C8OIU-kc.d.ts} +1 -1
  71. package/dist/v1-client-compat-qxaXEDm_.d.ts +23 -0
  72. package/package.json +5 -2
  73. package/dist/chunk-57KAYXHF.js +0 -19
  74. package/dist/chunk-57KAYXHF.js.map +0 -1
  75. package/dist/chunk-CB5NJJJT.js +0 -345
  76. package/dist/chunk-CB5NJJJT.js.map +0 -1
  77. package/dist/chunk-DX6XAXCK.js.map +0 -1
  78. package/dist/chunk-F3KJDCMU.js +0 -19
  79. package/dist/chunk-F3KJDCMU.js.map +0 -1
  80. package/dist/chunk-LFYKJJC5.js.map +0 -1
  81. package/dist/chunk-O65OD3NA.js.map +0 -1
  82. package/dist/chunk-PULSTDX2.js.map +0 -1
  83. package/dist/chunk-QP2NTODB.js.map +0 -1
  84. package/dist/chunk-ZZYNOX24.js.map +0 -1
@@ -0,0 +1,410 @@
1
+ import {
2
+ CSS_RUNTIME_MUTATION,
3
+ observeRuntimeMutations
4
+ } from "./chunk-N2TYN3RB.js";
5
+
6
+ // ../../modules/iframe-projection/html/watch-head.ts
7
+ var INCLUDE_TAGS = /* @__PURE__ */ new Set(["STYLE", "META", "BASE", "LINK"]);
8
+ var INCLUDE_LINK_RELS = /* @__PURE__ */ new Set(["stylesheet"]);
9
+ var instance = null;
10
+ function getHeadTracker() {
11
+ if (!instance) {
12
+ instance = new HeadTrackerImpl();
13
+ }
14
+ return instance;
15
+ }
16
+ var HeadSubscriptionImpl = class {
17
+ constructor(doc, callback, onUnsubscribe) {
18
+ this.hasMutations = false;
19
+ this.doc = doc;
20
+ this.callback = callback;
21
+ this.onUnsubscribe = onUnsubscribe;
22
+ }
23
+ flush(isInitial) {
24
+ if (!isInitial && !this.hasMutations) {
25
+ return void 0;
26
+ }
27
+ this.hasMutations = false;
28
+ return captureHead(this.doc);
29
+ }
30
+ unsubscribe() {
31
+ this.onUnsubscribe();
32
+ }
33
+ /** Called by tracker when relevant mutation detected */
34
+ notifyMutation(details) {
35
+ this.hasMutations = true;
36
+ this.callback(details);
37
+ }
38
+ };
39
+ var HeadTrackerImpl = class {
40
+ constructor() {
41
+ this.docObservers = /* @__PURE__ */ new Map();
42
+ this.activeSubscriptions = 0;
43
+ }
44
+ subscribe(doc, onMutation) {
45
+ let docState = this.docObservers.get(doc);
46
+ if (!docState) {
47
+ docState = this.createDocObserver(doc);
48
+ this.docObservers.set(doc, docState);
49
+ }
50
+ const subscription = new HeadSubscriptionImpl(doc, onMutation, () => {
51
+ this.unsubscribe(doc, subscription);
52
+ });
53
+ docState.subscriptions.add(subscription);
54
+ this.activeSubscriptions += 1;
55
+ return subscription;
56
+ }
57
+ createDocObserver(doc) {
58
+ const subscriptions = /* @__PURE__ */ new Set();
59
+ const notify = (details) => {
60
+ for (const sub of subscriptions) {
61
+ sub.notifyMutation(details);
62
+ }
63
+ };
64
+ const stopHooks = observeRuntimeMutations(doc);
65
+ const cssChanged = () => notify({ stylesheetPaths: [] });
66
+ doc.addEventListener(CSS_RUNTIME_MUTATION, cssChanged);
67
+ const stopRuntime = () => {
68
+ doc.removeEventListener(CSS_RUNTIME_MUTATION, cssChanged);
69
+ stopHooks();
70
+ };
71
+ const observeHead = (head) => {
72
+ const observer = new MutationObserver((mutations) => {
73
+ const details = this.readRelevantMutations(mutations, head);
74
+ if (!details) return;
75
+ notify(details);
76
+ });
77
+ observer.observe(head, {
78
+ childList: true,
79
+ subtree: true,
80
+ attributes: true,
81
+ characterData: true
82
+ });
83
+ return observer;
84
+ };
85
+ if (doc.head) {
86
+ return { observer: observeHead(doc.head), subscriptions, stopRuntime };
87
+ }
88
+ const bootstrap = new MutationObserver(() => {
89
+ const head = doc.head;
90
+ if (!head) return;
91
+ bootstrap.disconnect();
92
+ state.observer = observeHead(head);
93
+ notify({ stylesheetPaths: [] });
94
+ });
95
+ bootstrap.observe(doc, { childList: true, subtree: true });
96
+ const state = {
97
+ observer: bootstrap,
98
+ subscriptions,
99
+ stopRuntime
100
+ };
101
+ return state;
102
+ }
103
+ unsubscribe(doc, sub) {
104
+ const docState = this.docObservers.get(doc);
105
+ if (!docState) return;
106
+ if (!docState.subscriptions.delete(sub)) return;
107
+ this.activeSubscriptions = Math.max(0, this.activeSubscriptions - 1);
108
+ if (docState.subscriptions.size === 0) {
109
+ docState.observer.disconnect();
110
+ docState.stopRuntime();
111
+ this.docObservers.delete(doc);
112
+ }
113
+ }
114
+ /**
115
+ * Check if mutations contain changes to elements we care about.
116
+ * This filtering runs once per mutation batch (not once per subscription).
117
+ */
118
+ readRelevantMutations(mutations, head) {
119
+ let relevant = false;
120
+ const stylesheetPaths = /* @__PURE__ */ new Set();
121
+ const collectStylesheetPath = (node) => {
122
+ const element = node instanceof Element ? node : node?.parentElement ?? null;
123
+ if (!element) return;
124
+ const candidates = [
125
+ element,
126
+ ...element.querySelectorAll(
127
+ "style[data-vite-dev-id], link[rel~='stylesheet']"
128
+ )
129
+ ];
130
+ for (const candidate of candidates) {
131
+ if (candidate instanceof HTMLStyleElement) {
132
+ const id = candidate.getAttribute("data-vite-dev-id")?.trim();
133
+ if (id) stylesheetPaths.add(id);
134
+ } else if (candidate instanceof HTMLLinkElement && shouldIncludeLink(candidate)) {
135
+ const href = candidate.getAttribute("href")?.trim() || candidate.href;
136
+ if (href) stylesheetPaths.add(href);
137
+ }
138
+ }
139
+ };
140
+ for (const mutation of mutations) {
141
+ const target = mutation.target;
142
+ const element = target instanceof Element ? target : target.parentElement;
143
+ if (!element || !head.contains(element) && target !== head) continue;
144
+ const tagName = element.tagName;
145
+ if (INCLUDE_TAGS.has(tagName)) {
146
+ if (tagName === "LINK") {
147
+ if (!shouldIncludeLink(element)) continue;
148
+ }
149
+ relevant = true;
150
+ collectStylesheetPath(element);
151
+ }
152
+ if (mutation.type === "childList" && target === head) {
153
+ relevant = true;
154
+ }
155
+ if (mutation.type === "childList") {
156
+ for (const node of mutation.addedNodes) collectStylesheetPath(node);
157
+ for (const node of mutation.removedNodes) collectStylesheetPath(node);
158
+ }
159
+ }
160
+ return relevant ? { stylesheetPaths: [...stylesheetPaths] } : null;
161
+ }
162
+ destroy() {
163
+ for (const docState of this.docObservers.values()) {
164
+ docState.observer.disconnect();
165
+ docState.stopRuntime();
166
+ docState.subscriptions.clear();
167
+ }
168
+ this.docObservers.clear();
169
+ this.activeSubscriptions = 0;
170
+ }
171
+ readPerfSnapshot() {
172
+ return {
173
+ observers: this.docObservers.size,
174
+ subscriptions: this.activeSubscriptions
175
+ };
176
+ }
177
+ };
178
+ function serializeHeadStyle(style, resource) {
179
+ const type = style.getAttribute("type")?.trim().toLowerCase();
180
+ const href = !type || type === "text/css" ? resource?.(style.textContent ?? "") : null;
181
+ if (href) {
182
+ const link = style.ownerDocument.createElement("link");
183
+ for (const attribute of Array.from(style.attributes))
184
+ if (!["type", "href", "rel", "integrity", "crossorigin"].includes(
185
+ attribute.name
186
+ ))
187
+ link.setAttribute(attribute.name, attribute.value);
188
+ link.rel = "stylesheet";
189
+ link.href = href;
190
+ return link.outerHTML;
191
+ }
192
+ escapeStyleForHtmlSerialization(style);
193
+ return style.outerHTML;
194
+ }
195
+ function captureHead(doc, resource) {
196
+ const head = doc.head;
197
+ if (!head) return "";
198
+ const baseURI = doc.baseURI;
199
+ const fragments = [];
200
+ for (const child of Array.from(head.children)) {
201
+ const tagName = child.tagName;
202
+ if (!INCLUDE_TAGS.has(tagName)) continue;
203
+ if (tagName === "LINK") {
204
+ if (!shouldIncludeLink(child)) continue;
205
+ if (isDisabledStylesheet(child)) continue;
206
+ }
207
+ if (tagName === "META") {
208
+ const httpEquiv = child.getAttribute("http-equiv")?.toLowerCase();
209
+ const name = child.getAttribute("name")?.toLowerCase();
210
+ if (httpEquiv === "content-security-policy" || name === "content-security-policy") {
211
+ continue;
212
+ }
213
+ }
214
+ let clone = child.cloneNode(true);
215
+ materializeStyleElementCssom(child, clone);
216
+ if (tagName === "LINK") {
217
+ clone = materializeStylesheetLinkCssom(child, clone);
218
+ }
219
+ resolveUrls(clone, baseURI);
220
+ if (clone.tagName === "LINK") {
221
+ clone.removeAttribute("crossorigin");
222
+ } else if (clone.tagName === "STYLE") {
223
+ clone.textContent = absolutifyCssReferences(
224
+ clone.textContent ?? "",
225
+ baseURI
226
+ );
227
+ fragments.push(serializeHeadStyle(clone, resource));
228
+ continue;
229
+ }
230
+ fragments.push(clone.outerHTML);
231
+ }
232
+ fragments.push(...captureAdoptedStyleSheets(doc, resource));
233
+ return fragments.join("\n");
234
+ }
235
+ function materializeStylesheetLinkCssom(source, clone) {
236
+ const link = source;
237
+ const cssText = serializeCssRules(link.sheet);
238
+ if (cssText === null) {
239
+ return clone;
240
+ }
241
+ const style = source.ownerDocument.createElement("style");
242
+ for (const attribute of Array.from(source.attributes)) {
243
+ if ([
244
+ "as",
245
+ "crossorigin",
246
+ "fetchpriority",
247
+ "href",
248
+ "integrity",
249
+ "referrerpolicy",
250
+ "rel"
251
+ ].includes(attribute.name.toLowerCase())) {
252
+ continue;
253
+ }
254
+ style.setAttribute(attribute.name, attribute.value);
255
+ }
256
+ style.setAttribute("data-projection-stylesheet-href", link.href);
257
+ style.textContent = absolutifyCssReferences(cssText, link.href);
258
+ return style;
259
+ }
260
+ function retainStyleSourceEvidence(source, clone) {
261
+ clone.removeAttribute("data-projection-css-source-map");
262
+ clone.removeAttribute("data-projection-css-source-map-url");
263
+ const text = source.textContent ?? "";
264
+ if (text.length > 5 * 1024 * 1024) return;
265
+ const reference = [
266
+ ...text.matchAll(/\/\*[#@]\s*sourceMappingURL\s*=\s*(\S+?)\s*\*\//g)
267
+ ].slice(-1)[0]?.[1];
268
+ if (!reference || reference.length > 1024 * 1024) return;
269
+ const inline = /^data:application\/json(?:;charset=[\w-]+)?(;base64)?,(.*)$/is.exec(
270
+ reference
271
+ );
272
+ if (!inline) {
273
+ try {
274
+ const url = new URL(reference);
275
+ if (/^https?:$/.test(url.protocol))
276
+ clone.setAttribute("data-projection-css-source-map-url", url.href);
277
+ } catch {
278
+ }
279
+ return;
280
+ }
281
+ function compact(raw, depth) {
282
+ if (!raw || typeof raw !== "object" || depth > 16) return null;
283
+ const map = raw;
284
+ if (map.version !== 3) return null;
285
+ const sources = Array.isArray(map.sources) && map.sources.length <= 4096 && map.sources.every((source2) => typeof source2 === "string") ? map.sources : void 0;
286
+ const sections = Array.isArray(map.sections) && map.sections.length <= 256 ? map.sections.flatMap((section) => {
287
+ const nested = section && typeof section === "object" ? compact(section.map, depth + 1) : null;
288
+ return nested ? [{ map: nested }] : [];
289
+ }) : void 0;
290
+ return {
291
+ version: 3,
292
+ ...typeof map.file === "string" ? { file: map.file } : {},
293
+ ...typeof map.sourceRoot === "string" ? { sourceRoot: map.sourceRoot } : {},
294
+ ...sources ? { sources } : {},
295
+ ...sections ? { sections } : {}
296
+ };
297
+ }
298
+ try {
299
+ const json = inline[1] ? new TextDecoder().decode(
300
+ Uint8Array.from(
301
+ atob(inline[2]),
302
+ (character) => character.charCodeAt(0)
303
+ )
304
+ ) : decodeURIComponent(inline[2]);
305
+ const metadata = compact(JSON.parse(json), 0);
306
+ if (!metadata) return;
307
+ const serialized = JSON.stringify(metadata);
308
+ if (serialized.length <= 64 * 1024)
309
+ clone.setAttribute("data-projection-css-source-map", serialized);
310
+ } catch {
311
+ }
312
+ }
313
+ function materializeStyleElementCssom(source, clone) {
314
+ if (source.tagName !== "STYLE" || clone.tagName !== "STYLE") {
315
+ return;
316
+ }
317
+ const style = source;
318
+ retainStyleSourceEvidence(style, clone);
319
+ const cssText = serializeCssRules(style.sheet);
320
+ if (cssText !== null) {
321
+ clone.textContent = cssText;
322
+ }
323
+ }
324
+ function captureAdoptedStyleSheets(doc, resource) {
325
+ const sheets = Array.from(doc.adoptedStyleSheets ?? []);
326
+ if (sheets.length === 0) {
327
+ return [];
328
+ }
329
+ const fragments = [];
330
+ for (const sheet of sheets) {
331
+ const cssText = serializeCssRules(sheet);
332
+ if (!cssText) {
333
+ continue;
334
+ }
335
+ const style = doc.createElement("style");
336
+ style.setAttribute("data-projection-adopted-stylesheet", "true");
337
+ style.textContent = absolutifyCssReferences(cssText, doc.baseURI);
338
+ fragments.push(serializeHeadStyle(style, resource));
339
+ }
340
+ return fragments;
341
+ }
342
+ function escapeStyleForHtmlSerialization(style) {
343
+ style.textContent = (style.textContent ?? "").replace(/<\//gi, "<\\/");
344
+ }
345
+ function serializeCssRules(sheet) {
346
+ if (!sheet) {
347
+ return null;
348
+ }
349
+ try {
350
+ return Array.from(sheet.cssRules).map((rule) => rule.cssText).join("\n");
351
+ } catch {
352
+ return null;
353
+ }
354
+ }
355
+ function absolutifyCssReferences(cssText, baseHref) {
356
+ const resolve = (value) => {
357
+ const trimmed = value.trim();
358
+ if (!trimmed || trimmed.startsWith("#") || /^(?:data|blob|javascript):/i.test(trimmed)) {
359
+ return /^javascript:/i.test(trimmed) ? "" : trimmed;
360
+ }
361
+ try {
362
+ return new URL(trimmed, baseHref).href;
363
+ } catch {
364
+ return trimmed;
365
+ }
366
+ };
367
+ return cssText.replace(
368
+ /url\(\s*(["']?)([^"')]+)\1\s*\)/gi,
369
+ (_match, quote, value) => `url(${quote}${resolve(value)}${quote})`
370
+ ).replace(
371
+ /@import\s+(["'])([^"']+)\1/gi,
372
+ (_match, quote, value) => `@import ${quote}${resolve(value)}${quote}`
373
+ );
374
+ }
375
+ function shouldIncludeLink(element) {
376
+ const rel = element.getAttribute("rel");
377
+ if (!rel) {
378
+ return false;
379
+ }
380
+ return rel.toLowerCase().split(/\s+/).some((token) => INCLUDE_LINK_RELS.has(token));
381
+ }
382
+ function isDisabledStylesheet(element) {
383
+ const link = element;
384
+ return link.disabled || link.sheet?.disabled === true;
385
+ }
386
+ function resolveUrls(element, baseURI) {
387
+ const href = element.getAttribute("href");
388
+ if (href && !isAbsoluteUrl(href)) {
389
+ try {
390
+ element.setAttribute("href", new URL(href, baseURI).href);
391
+ } catch {
392
+ }
393
+ }
394
+ const src = element.getAttribute("src");
395
+ if (src && !isAbsoluteUrl(src)) {
396
+ try {
397
+ element.setAttribute("src", new URL(src, baseURI).href);
398
+ } catch {
399
+ }
400
+ }
401
+ }
402
+ function isAbsoluteUrl(url) {
403
+ return /^(https?:)?\/\//i.test(url) || url.startsWith("data:");
404
+ }
405
+
406
+ export {
407
+ getHeadTracker,
408
+ captureHead
409
+ };
410
+ //# sourceMappingURL=chunk-5BHIHP25.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../modules/iframe-projection/html/watch-head.ts"],"sourcesContent":["/**\n * Head Capture Utility\n *\n * Captures relevant <head> content from a document, excluding scripts\n * and resolving relative URLs to absolute.\n *\n * ## Shared Observer Pattern\n *\n * Uses a singleton HeadTracker that maintains one MutationObserver per document,\n * shared across all subscriptions. This avoids creating 50+ observers when there\n * are many watchers on the same page.\n */\n\nimport {\n CSS_RUNTIME_MUTATION,\n observeRuntimeMutations,\n} from \"./runtime-mutations\";\n\n/** Elements to include from <head> */\nconst INCLUDE_TAGS = new Set([\"STYLE\", \"META\", \"BASE\", \"LINK\"]);\n\n/** Link rel values to include (stylesheet-related) */\nconst INCLUDE_LINK_RELS = new Set([\"stylesheet\"]);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Head Tracker (Shared Observer)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * A subscription to head changes for a specific document.\n * Each subscription maintains its own hasMutations flag since they flush independently.\n */\nexport interface HeadSubscription {\n /** Whether there have been mutations since last flush */\n hasMutations: boolean;\n /** Flush and get head content. Returns content if isInitial or if mutations occurred. */\n flush(isInitial: boolean): string | undefined;\n /** Unsubscribe from head changes */\n unsubscribe(): void;\n}\n\nexport interface HeadMutationDetails {\n /** Vite stylesheet module ids whose style/link nodes changed in this batch. */\n stylesheetPaths: string[];\n}\n\n/**\n * Singleton tracker that manages shared MutationObservers for head watching.\n * One observer per document, shared across all subscriptions.\n */\nexport interface HeadTracker {\n /** Subscribe to head changes for a document */\n subscribe(\n doc: Document,\n onMutation: (details: HeadMutationDetails) => void,\n ): HeadSubscription;\n /** Clean up all observers */\n destroy(): void;\n /** Cardinality only; reads maintained collection sizes and performs no DOM\n * work. Used by the performance trace attached to an emitted capture. */\n readPerfSnapshot(): { observers: number; subscriptions: number };\n}\n\n/** Module-level singleton */\nlet instance: HeadTrackerImpl | null = null;\n\n/**\n * Get the singleton HeadTracker instance.\n */\nexport function getHeadTracker(): HeadTracker {\n if (!instance) {\n instance = new HeadTrackerImpl();\n }\n return instance;\n}\n\n/**\n * Reset the singleton. For testing only.\n * @internal\n */\nexport function _resetHeadTrackerForTesting(): void {\n instance?.destroy();\n instance = null;\n}\n\n/** Internal subscription implementation */\nclass HeadSubscriptionImpl implements HeadSubscription {\n hasMutations = false;\n private doc: Document;\n private callback: (details: HeadMutationDetails) => void;\n private onUnsubscribe: () => void;\n\n constructor(\n doc: Document,\n callback: (details: HeadMutationDetails) => void,\n onUnsubscribe: () => void,\n ) {\n this.doc = doc;\n this.callback = callback;\n this.onUnsubscribe = onUnsubscribe;\n }\n\n flush(isInitial: boolean): string | undefined {\n if (!isInitial && !this.hasMutations) {\n return undefined;\n }\n this.hasMutations = false;\n return captureHead(this.doc);\n }\n\n unsubscribe(): void {\n this.onUnsubscribe();\n }\n\n /** Called by tracker when relevant mutation detected */\n notifyMutation(details: HeadMutationDetails): void {\n this.hasMutations = true;\n this.callback(details);\n }\n}\n\n/** Per-document observer state */\ninterface DocObserverState {\n observer: MutationObserver;\n stopRuntime(): void;\n subscriptions: Set<HeadSubscriptionImpl>;\n}\n\nclass HeadTrackerImpl implements HeadTracker {\n private docObservers = new Map<Document, DocObserverState>();\n private activeSubscriptions = 0;\n\n subscribe(\n doc: Document,\n onMutation: (details: HeadMutationDetails) => void,\n ): HeadSubscription {\n let docState = this.docObservers.get(doc);\n\n // Create observer for this document if first subscription\n if (!docState) {\n docState = this.createDocObserver(doc);\n this.docObservers.set(doc, docState);\n }\n\n const subscription = new HeadSubscriptionImpl(doc, onMutation, () => {\n this.unsubscribe(doc, subscription);\n });\n docState.subscriptions.add(subscription);\n this.activeSubscriptions += 1;\n\n return subscription;\n }\n\n private createDocObserver(doc: Document): DocObserverState {\n const subscriptions = new Set<HeadSubscriptionImpl>();\n\n const notify = (details: HeadMutationDetails): void => {\n for (const sub of subscriptions) {\n sub.notifyMutation(details);\n }\n };\n const stopHooks = observeRuntimeMutations(doc);\n const cssChanged = () => notify({ stylesheetPaths: [] });\n doc.addEventListener(CSS_RUNTIME_MUTATION, cssChanged);\n const stopRuntime = () => {\n doc.removeEventListener(CSS_RUNTIME_MUTATION, cssChanged);\n stopHooks();\n };\n\n const observeHead = (head: HTMLHeadElement): MutationObserver => {\n const observer = new MutationObserver((mutations) => {\n const details = this.readRelevantMutations(mutations, head);\n if (!details) return;\n notify(details);\n });\n observer.observe(head, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n return observer;\n };\n\n if (doc.head) {\n return { observer: observeHead(doc.head), subscriptions, stopRuntime };\n }\n\n // The document has no <head> yet — subscribers can attach before parsing\n // (e.g. a producer created from a frame preload). Watch for the head to\n // appear, then swap in the real observer and report one synthetic\n // mutation so subscribers capture the head they never saw arrive.\n const bootstrap = new MutationObserver(() => {\n const head = doc.head;\n if (!head) return;\n bootstrap.disconnect();\n state.observer = observeHead(head);\n notify({ stylesheetPaths: [] });\n });\n bootstrap.observe(doc, { childList: true, subtree: true });\n const state: DocObserverState = {\n observer: bootstrap,\n subscriptions,\n stopRuntime,\n };\n return state;\n }\n\n private unsubscribe(doc: Document, sub: HeadSubscriptionImpl): void {\n const docState = this.docObservers.get(doc);\n if (!docState) return;\n\n if (!docState.subscriptions.delete(sub)) return;\n this.activeSubscriptions = Math.max(0, this.activeSubscriptions - 1);\n\n // Disconnect observer if no more subscriptions for this document\n if (docState.subscriptions.size === 0) {\n docState.observer.disconnect();\n docState.stopRuntime();\n this.docObservers.delete(doc);\n }\n }\n\n /**\n * Check if mutations contain changes to elements we care about.\n * This filtering runs once per mutation batch (not once per subscription).\n */\n private readRelevantMutations(\n mutations: MutationRecord[],\n head: HTMLHeadElement,\n ): HeadMutationDetails | null {\n let relevant = false;\n const stylesheetPaths = new Set<string>();\n const collectStylesheetPath = (node: Node | null): void => {\n const element =\n node instanceof Element ? node : (node?.parentElement ?? null);\n if (!element) return;\n const candidates = [\n element,\n ...element.querySelectorAll(\n \"style[data-vite-dev-id], link[rel~='stylesheet']\",\n ),\n ];\n for (const candidate of candidates) {\n if (candidate instanceof HTMLStyleElement) {\n const id = candidate.getAttribute(\"data-vite-dev-id\")?.trim();\n if (id) stylesheetPaths.add(id);\n } else if (\n candidate instanceof HTMLLinkElement &&\n shouldIncludeLink(candidate)\n ) {\n const href = candidate.getAttribute(\"href\")?.trim() || candidate.href;\n if (href) stylesheetPaths.add(href);\n }\n }\n };\n\n for (const mutation of mutations) {\n const target = mutation.target;\n const element = target instanceof Element ? target : target.parentElement;\n\n if (!element || (!head.contains(element) && target !== head)) continue;\n\n // Check if this is a relevant element (one we would capture)\n const tagName = element.tagName;\n if (INCLUDE_TAGS.has(tagName)) {\n // For LINK, check if it's a stylesheet\n if (tagName === \"LINK\") {\n if (!shouldIncludeLink(element)) continue;\n }\n relevant = true;\n collectStylesheetPath(element);\n }\n\n // Also trigger for childList mutations on head itself (added/removed elements)\n if (mutation.type === \"childList\" && target === head) {\n relevant = true;\n }\n if (mutation.type === \"childList\") {\n for (const node of mutation.addedNodes) collectStylesheetPath(node);\n for (const node of mutation.removedNodes) collectStylesheetPath(node);\n }\n }\n return relevant ? { stylesheetPaths: [...stylesheetPaths] } : null;\n }\n\n destroy(): void {\n for (const docState of this.docObservers.values()) {\n docState.observer.disconnect();\n docState.stopRuntime();\n docState.subscriptions.clear();\n }\n this.docObservers.clear();\n this.activeSubscriptions = 0;\n }\n\n readPerfSnapshot(): { observers: number; subscriptions: number } {\n return {\n observers: this.docObservers.size,\n subscriptions: this.activeSubscriptions,\n };\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Legacy API (Backward Compatibility)\n// These functions delegate to the shared tracker for backward compatibility\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * State for a head watcher instance.\n * @deprecated Use getHeadTracker().subscribe() instead for better performance\n */\nexport interface HeadWatcher {\n /** The document being watched */\n doc: Document;\n /** Whether there have been mutations since last flush */\n hasMutations: boolean;\n /** Stop watching */\n stop: () => void;\n}\n\n/**\n * Starts watching a document's <head> for mutations.\n * @deprecated Use getHeadTracker().subscribe() instead for better performance\n */\nexport function watchHead(doc: Document, onMutation: () => void): HeadWatcher {\n const subscription = getHeadTracker().subscribe(doc, onMutation);\n\n // Wrap subscription in legacy HeadWatcher interface\n return {\n doc,\n get hasMutations() {\n return subscription.hasMutations;\n },\n set hasMutations(value: boolean) {\n subscription.hasMutations = value;\n },\n stop: () => subscription.unsubscribe(),\n };\n}\n\n/**\n * Checks if watcher has any pending head mutations.\n * @deprecated Access subscription.hasMutations directly\n */\nexport function hasPendingHeadChanges(watcher: HeadWatcher): boolean {\n return watcher.hasMutations;\n}\n\n/**\n * Flushes the head watcher, returning captured head content if there were changes.\n * @deprecated Use subscription.flush() directly\n */\nexport function flushHeadWatcher(\n watcher: HeadWatcher,\n isInitial: boolean,\n): string | undefined {\n if (!isInitial && !watcher.hasMutations) {\n return undefined;\n }\n watcher.hasMutations = false;\n return captureHead(watcher.doc);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Head Capture\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Captures the <head> content from a document.\n *\n * - Includes: <style>, <link rel=\"stylesheet\">, <meta>, <base>\n * - Excludes: <script>, <title>, <link rel=\"icon/preload/etc\">\n * - Resolves relative URLs to absolute using document.baseURI\n *\n * @param doc - The document to capture head from\n * @returns Serialized head content (innerHTML for destination <head>)\n */\nexport type StyleResource = (css: string) => string | null;\n\nfunction serializeHeadStyle(style: Element, resource?: StyleResource): string {\n const type = style.getAttribute(\"type\")?.trim().toLowerCase();\n const href =\n !type || type === \"text/css\" ? resource?.(style.textContent ?? \"\") : null;\n if (href) {\n const link = style.ownerDocument.createElement(\"link\");\n for (const attribute of Array.from(style.attributes))\n if (\n ![\"type\", \"href\", \"rel\", \"integrity\", \"crossorigin\"].includes(\n attribute.name,\n )\n )\n link.setAttribute(attribute.name, attribute.value);\n link.rel = \"stylesheet\";\n link.href = href;\n return link.outerHTML;\n }\n escapeStyleForHtmlSerialization(style);\n return style.outerHTML;\n}\n\nexport function captureHead(doc: Document, resource?: StyleResource): string {\n const head = doc.head;\n if (!head) return \"\";\n\n const baseURI = doc.baseURI;\n const fragments: string[] = [];\n\n for (const child of Array.from(head.children)) {\n const tagName = child.tagName;\n\n // Skip non-included tags\n if (!INCLUDE_TAGS.has(tagName)) continue;\n\n // For <link>, only include stylesheets\n if (tagName === \"LINK\") {\n if (!shouldIncludeLink(child)) continue;\n if (isDisabledStylesheet(child)) continue;\n }\n\n // Exclude Content-Security-Policy meta tags (they block srcdoc assets)\n if (tagName === \"META\") {\n const httpEquiv = child.getAttribute(\"http-equiv\")?.toLowerCase();\n const name = child.getAttribute(\"name\")?.toLowerCase();\n if (\n httpEquiv === \"content-security-policy\" ||\n name === \"content-security-policy\"\n ) {\n continue;\n }\n }\n\n // Clone and resolve URLs\n let clone = child.cloneNode(true) as Element;\n materializeStyleElementCssom(child, clone);\n if (tagName === \"LINK\") {\n clone = materializeStylesheetLinkCssom(child, clone);\n }\n resolveUrls(clone, baseURI);\n\n // Strip crossorigin from stylesheet links so they load in no-cors mode\n // in srcdoc projection iframes (which have a null origin that won't\n // match any server's Access-Control-Allow-Origin header)\n if (clone.tagName === \"LINK\") {\n clone.removeAttribute(\"crossorigin\");\n } else if (clone.tagName === \"STYLE\") {\n // The destination stages this head before installing its incoming base.\n // Authored inline/CSSOM styles must not resolve assets against that old\n // document. Materialized links already carry their stylesheet's own base.\n clone.textContent = absolutifyCssReferences(\n clone.textContent ?? \"\",\n baseURI,\n );\n fragments.push(serializeHeadStyle(clone, resource));\n continue;\n }\n\n fragments.push(clone.outerHTML);\n }\n\n fragments.push(...captureAdoptedStyleSheets(doc, resource));\n\n return fragments.join(\"\\n\");\n}\n\n/**\n * Same-origin stylesheets are already readable in the source page. Preserve\n * their authored rules as an inline style before the projection crosses into\n * its null-origin document. Opaque cross-origin sheets remain links and may be\n * handled by a consumer-specific, policy-checked fallback later.\n */\nfunction materializeStylesheetLinkCssom(\n source: Element,\n clone: Element,\n): Element {\n const link = source as HTMLLinkElement;\n const cssText = serializeCssRules(link.sheet);\n if (cssText === null) {\n return clone;\n }\n\n const style = source.ownerDocument.createElement(\"style\");\n for (const attribute of Array.from(source.attributes)) {\n if (\n [\n \"as\",\n \"crossorigin\",\n \"fetchpriority\",\n \"href\",\n \"integrity\",\n \"referrerpolicy\",\n \"rel\",\n ].includes(attribute.name.toLowerCase())\n ) {\n continue;\n }\n style.setAttribute(attribute.name, attribute.value);\n }\n style.setAttribute(\"data-projection-stylesheet-href\", link.href);\n style.textContent = absolutifyCssReferences(cssText, link.href);\n return style;\n}\n\n/** Original identity metadata survives CSSOM comment removal; visual CSS stays CSSOM. */\nfunction retainStyleSourceEvidence(\n source: HTMLStyleElement,\n clone: Element,\n): void {\n clone.removeAttribute(\"data-projection-css-source-map\");\n clone.removeAttribute(\"data-projection-css-source-map-url\");\n const text = source.textContent ?? \"\";\n if (text.length > 5 * 1024 * 1024) return;\n const reference = [\n ...text.matchAll(/\\/\\*[#@]\\s*sourceMappingURL\\s*=\\s*(\\S+?)\\s*\\*\\//g),\n ].slice(-1)[0]?.[1];\n if (!reference || reference.length > 1024 * 1024) return;\n const inline =\n /^data:application\\/json(?:;charset=[\\w-]+)?(;base64)?,(.*)$/is.exec(\n reference,\n );\n if (!inline) {\n // A detached inline style has no proven relative map base. Absolute URLs\n // can be admitted later against the existing app/server source origin.\n try {\n const url = new URL(reference);\n if (/^https?:$/.test(url.protocol))\n clone.setAttribute(\"data-projection-css-source-map-url\", url.href);\n } catch {}\n return;\n }\n function compact(raw: unknown, depth: number): object | null {\n if (!raw || typeof raw !== \"object\" || depth > 16) return null;\n const map = raw as Record<string, unknown>;\n if (map.version !== 3) return null;\n const sources =\n Array.isArray(map.sources) &&\n map.sources.length <= 4096 &&\n map.sources.every((source) => typeof source === \"string\")\n ? map.sources\n : undefined;\n const sections =\n Array.isArray(map.sections) && map.sections.length <= 256\n ? map.sections.flatMap((section) => {\n const nested =\n section && typeof section === \"object\"\n ? compact(section.map, depth + 1)\n : null;\n return nested ? [{ map: nested }] : [];\n })\n : undefined;\n return {\n version: 3,\n ...(typeof map.file === \"string\" ? { file: map.file } : {}),\n ...(typeof map.sourceRoot === \"string\"\n ? { sourceRoot: map.sourceRoot }\n : {}),\n ...(sources ? { sources } : {}),\n ...(sections ? { sections } : {}),\n };\n }\n try {\n const json = inline[1]\n ? new TextDecoder().decode(\n Uint8Array.from(atob(inline[2]!), (character) =>\n character.charCodeAt(0),\n ),\n )\n : decodeURIComponent(inline[2]!);\n const metadata = compact(JSON.parse(json), 0);\n if (!metadata) return;\n const serialized = JSON.stringify(metadata);\n if (serialized.length <= 64 * 1024)\n clone.setAttribute(\"data-projection-css-source-map\", serialized);\n } catch {}\n}\n\n/**\n * CSSOM is current visual truth even when authored style text is nonempty.\n * A deleted final rule must serialize empty, not revive the original DOM text.\n */\nfunction materializeStyleElementCssom(source: Element, clone: Element): void {\n if (source.tagName !== \"STYLE\" || clone.tagName !== \"STYLE\") {\n return;\n }\n\n const style = source as HTMLStyleElement;\n retainStyleSourceEvidence(style, clone);\n const cssText = serializeCssRules(style.sheet);\n if (cssText !== null) {\n clone.textContent = cssText;\n }\n}\n\nfunction captureAdoptedStyleSheets(\n doc: Document,\n resource?: StyleResource,\n): string[] {\n const sheets = Array.from(doc.adoptedStyleSheets ?? []);\n if (sheets.length === 0) {\n return [];\n }\n\n const fragments: string[] = [];\n for (const sheet of sheets) {\n const cssText = serializeCssRules(sheet);\n if (!cssText) {\n continue;\n }\n const style = doc.createElement(\"style\");\n style.setAttribute(\"data-projection-adopted-stylesheet\", \"true\");\n style.textContent = absolutifyCssReferences(cssText, doc.baseURI);\n fragments.push(serializeHeadStyle(style, resource));\n }\n return fragments;\n}\n\nfunction escapeStyleForHtmlSerialization(style: Element): void {\n style.textContent = (style.textContent ?? \"\").replace(/<\\//gi, \"<\\\\/\");\n}\n\nfunction serializeCssRules(sheet: CSSStyleSheet | null): string | null {\n if (!sheet) {\n return null;\n }\n\n try {\n return Array.from(sheet.cssRules)\n .map((rule) => rule.cssText)\n .join(\"\\n\");\n } catch {\n // Cross-origin or otherwise unreadable stylesheet.\n return null;\n }\n}\n\nfunction absolutifyCssReferences(cssText: string, baseHref: string): string {\n const resolve = (value: string): string => {\n const trimmed = value.trim();\n if (\n !trimmed ||\n trimmed.startsWith(\"#\") ||\n /^(?:data|blob|javascript):/i.test(trimmed)\n ) {\n return /^javascript:/i.test(trimmed) ? \"\" : trimmed;\n }\n try {\n return new URL(trimmed, baseHref).href;\n } catch {\n return trimmed;\n }\n };\n\n return cssText\n .replace(\n /url\\(\\s*([\"']?)([^\"')]+)\\1\\s*\\)/gi,\n (_match, quote: string, value: string) =>\n `url(${quote}${resolve(value)}${quote})`,\n )\n .replace(\n /@import\\s+([\"'])([^\"']+)\\1/gi,\n (_match, quote: string, value: string) =>\n `@import ${quote}${resolve(value)}${quote}`,\n );\n}\n\nfunction shouldIncludeLink(element: Element): boolean {\n const rel = element.getAttribute(\"rel\");\n if (!rel) {\n return false;\n }\n return rel\n .toLowerCase()\n .split(/\\s+/)\n .some((token) => INCLUDE_LINK_RELS.has(token));\n}\n\nfunction isDisabledStylesheet(element: Element): boolean {\n const link = element as HTMLLinkElement;\n return link.disabled || link.sheet?.disabled === true;\n}\n\n/**\n * Resolves relative URLs in an element to absolute URLs.\n */\nfunction resolveUrls(element: Element, baseURI: string): void {\n // URL resolution supports retained custom-scheme documents as well as HTTP.\n // This only serializes the source's URLs; protocol authorization remains at\n // the serving boundary. Opaque bases (about:blank, data:) fall through catch.\n // Resolve href attribute (for <link>, <base>)\n const href = element.getAttribute(\"href\");\n if (href && !isAbsoluteUrl(href)) {\n try {\n element.setAttribute(\"href\", new URL(href, baseURI).href);\n } catch {\n // Keep original href if URL resolution fails\n }\n }\n\n // Resolve src attribute (for future-proofing)\n const src = element.getAttribute(\"src\");\n if (src && !isAbsoluteUrl(src)) {\n try {\n element.setAttribute(\"src\", new URL(src, baseURI).href);\n } catch {\n // Keep original src if URL resolution fails\n }\n }\n}\n\n/**\n * Checks if a URL is absolute.\n */\nfunction isAbsoluteUrl(url: string): boolean {\n return /^(https?:)?\\/\\//i.test(url) || url.startsWith(\"data:\");\n}\n"],"mappings":";;;;;;AAmBA,IAAM,eAAe,oBAAI,IAAI,CAAC,SAAS,QAAQ,QAAQ,MAAM,CAAC;AAG9D,IAAM,oBAAoB,oBAAI,IAAI,CAAC,YAAY,CAAC;AA0ChD,IAAI,WAAmC;AAKhC,SAAS,iBAA8B;AAC5C,MAAI,CAAC,UAAU;AACb,eAAW,IAAI,gBAAgB;AAAA,EACjC;AACA,SAAO;AACT;AAYA,IAAM,uBAAN,MAAuD;AAAA,EAMrD,YACE,KACA,UACA,eACA;AATF,wBAAe;AAUb,SAAK,MAAM;AACX,SAAK,WAAW;AAChB,SAAK,gBAAgB;AAAA,EACvB;AAAA,EAEA,MAAM,WAAwC;AAC5C,QAAI,CAAC,aAAa,CAAC,KAAK,cAAc;AACpC,aAAO;AAAA,IACT;AACA,SAAK,eAAe;AACpB,WAAO,YAAY,KAAK,GAAG;AAAA,EAC7B;AAAA,EAEA,cAAoB;AAClB,SAAK,cAAc;AAAA,EACrB;AAAA;AAAA,EAGA,eAAe,SAAoC;AACjD,SAAK,eAAe;AACpB,SAAK,SAAS,OAAO;AAAA,EACvB;AACF;AASA,IAAM,kBAAN,MAA6C;AAAA,EAA7C;AACE,SAAQ,eAAe,oBAAI,IAAgC;AAC3D,SAAQ,sBAAsB;AAAA;AAAA,EAE9B,UACE,KACA,YACkB;AAClB,QAAI,WAAW,KAAK,aAAa,IAAI,GAAG;AAGxC,QAAI,CAAC,UAAU;AACb,iBAAW,KAAK,kBAAkB,GAAG;AACrC,WAAK,aAAa,IAAI,KAAK,QAAQ;AAAA,IACrC;AAEA,UAAM,eAAe,IAAI,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