hyperframes 0.8.156 → 0.8.157

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 (170) hide show
  1. package/dist/{add-U35DO2JR.js → add-XKIJJAC6.js} +14 -14
  2. package/dist/{animatedGifPrep-MRGFHBVF.js → animatedGifPrep-MTJRHJ5G.js} +9 -9
  3. package/dist/api.js +17 -17
  4. package/dist/{asset-HS4Q6LS2.js → asset-TEWIJMG5.js} +2 -2
  5. package/dist/{assetCataloger-SRTQYA6J.js → assetCataloger-DI7FC5KZ.js} +3 -3
  6. package/dist/{auth-HS6GAILF.js → auth-ERW6EOVW.js} +2 -2
  7. package/dist/{autoUpdate-MRQ4ULBI.js → autoUpdate-IHYT5BQF.js} +2 -2
  8. package/dist/{backgroundChecks-K2ZMA43S.js → backgroundChecks-DTKZTDHN.js} +3 -3
  9. package/dist/backgroundChecksWorker.js +3 -3
  10. package/dist/{batchRender-CMVCRSWP.js → batchRender-FTZ67377.js} +4 -4
  11. package/dist/{beats-JYECNCTZ.js → beats-AE4ZKJ3I.js} +15 -15
  12. package/dist/{benchmark-JGMKJSPN.js → benchmark-Q3YSQVWW.js} +11 -11
  13. package/dist/{browser-63WITJVS.js → browser-IRRLG5FG.js} +5 -5
  14. package/dist/{bundleWithLocalizedFonts-5SLYBFXL.js → bundleWithLocalizedFonts-IVO43QBQ.js} +2 -2
  15. package/dist/{capture-7MFOIE4K.js → capture-ANATPLOS.js} +12 -12
  16. package/dist/{capture-T6QSEGKM.js → capture-MVH3XNAE.js} +2 -2
  17. package/dist/{catalog-KVE5KJJT.js → catalog-5BJJW3G4.js} +14 -14
  18. package/dist/{catch-up-E3WYWSDY.js → catch-up-DU2O72RS.js} +6 -6
  19. package/dist/{check-QRP5WCP2.js → check-P5D3YU2H.js} +35 -35
  20. package/dist/{checkBrowser-5XFA6PXF.js → checkBrowser-RNIDFQZZ.js} +33 -32
  21. package/dist/{chunk-KMSS5TOQ.js → chunk-23VDPRQ3.js} +1 -1
  22. package/dist/{chunk-VCCOO2TO.js → chunk-25IXEZXH.js} +5 -5
  23. package/dist/{chunk-JKCKXGIC.js → chunk-3FRK53UC.js} +1 -1
  24. package/dist/{chunk-U3BCDVZO.js → chunk-3QATT3QF.js} +1 -1
  25. package/dist/{chunk-DDSQBREC.js → chunk-4YDQQQY6.js} +2 -2
  26. package/dist/{chunk-DSX7R5M7.js → chunk-56QTFOWH.js} +4 -4
  27. package/dist/{chunk-SCMNFRL5.js → chunk-6B6G3QMQ.js} +10 -9
  28. package/dist/{chunk-YOEGUBBY.js → chunk-7F3B5YYT.js} +82 -14
  29. package/dist/{chunk-OBXWIVYN.js → chunk-7KDQAD2W.js} +5 -11
  30. package/dist/{chunk-YZEHYWOH.js → chunk-7ZWOLEGS.js} +1 -1
  31. package/dist/{chunk-VY23BB2D.js → chunk-BB2SFTMY.js} +4 -4
  32. package/dist/{chunk-C7WALYAY.js → chunk-BPTKOTF2.js} +1 -1
  33. package/dist/{chunk-VPOEKLZL.js → chunk-CA7IDB4Z.js} +1 -1
  34. package/dist/{chunk-FSZAFCU7.js → chunk-CBNI34SD.js} +1 -1
  35. package/dist/{chunk-NV2JPSI4.js → chunk-DRT6ZQI2.js} +1 -1
  36. package/dist/{chunk-56AEM2EL.js → chunk-EEEUI3ON.js} +11 -11
  37. package/dist/{chunk-444O62RL.js → chunk-EGKIQS5J.js} +1 -1
  38. package/dist/{chunk-MBE4SEL7.js → chunk-EYNN5DJG.js} +5 -5
  39. package/dist/{chunk-2K5YII2L.js → chunk-FJT35XBA.js} +3 -3
  40. package/dist/{chunk-Q7FDYQR4.js → chunk-GPUVPZRK.js} +1 -1
  41. package/dist/{chunk-WLYSVHZE.js → chunk-HQG7B5ZE.js} +2 -2
  42. package/dist/{chunk-YUTUYCGK.js → chunk-IRRRH66M.js} +39 -31
  43. package/dist/{chunk-TLUGPEW4.js → chunk-J6SJCYAQ.js} +5 -5
  44. package/dist/{chunk-SNMMFFKZ.js → chunk-J7WFHOCW.js} +1 -1
  45. package/dist/chunk-KCF6GHJP.js +250 -0
  46. package/dist/{chunk-SCOXM5LP.js → chunk-KEGTYA7V.js} +1 -1
  47. package/dist/chunk-LPOTN5GW.js +3795 -0
  48. package/dist/{chunk-FIL6QPZT.js → chunk-LQXHRO6F.js} +2 -2
  49. package/dist/{chunk-HG6H2ICP.js → chunk-LZ7C6CXD.js} +3 -3
  50. package/dist/{chunk-IOBKVP27.js → chunk-NFX4K6OW.js} +1 -1
  51. package/dist/{chunk-7K3CHJS3.js → chunk-NIT2ZCNI.js} +10 -10
  52. package/dist/{chunk-COBIO7VC.js → chunk-O4ZB2LUC.js} +1 -1
  53. package/dist/{chunk-HVQQN4NG.js → chunk-OGJFYVRC.js} +1 -1
  54. package/dist/{chunk-OOCONATR.js → chunk-OTG5H2VM.js} +3 -3
  55. package/dist/{chunk-GVJ4LG62.js → chunk-QAWCWGQG.js} +2 -2
  56. package/dist/{chunk-YLSSI4XB.js → chunk-QRPYTJBW.js} +1 -1
  57. package/dist/{chunk-7FFGZC2X.js → chunk-QWQ6GQTI.js} +1 -1
  58. package/dist/{chunk-3THJEW7G.js → chunk-SGIZMTWO.js} +2 -2
  59. package/dist/{chunk-LZ2PZIVS.js → chunk-SLUFA6UM.js} +2 -2
  60. package/dist/{chunk-YGLM2DHX.js → chunk-SMPG26EL.js} +1 -1
  61. package/dist/{chunk-QJEHLWM4.js → chunk-SQHWDFTV.js} +1 -1
  62. package/dist/{chunk-JJERZGVE.js → chunk-SWRIMG46.js} +1 -1
  63. package/dist/{chunk-M4CRDGC4.js → chunk-T243WV6D.js} +1 -1
  64. package/dist/{chunk-LJHF4SKT.js → chunk-T76NSAXO.js} +2 -2
  65. package/dist/{chunk-VK5JRYJL.js → chunk-TQ62EMUI.js} +12 -11
  66. package/dist/{chunk-DRNTIYT3.js → chunk-UGIIDY6C.js} +3 -3
  67. package/dist/{chunk-XXTOOXZ7.js → chunk-WK375PPO.js} +2 -2
  68. package/dist/{chunk-DDK6E66K.js → chunk-WZBGU46C.js} +1 -1
  69. package/dist/{chunk-RXTEP3NB.js → chunk-XRRZZFGI.js} +2 -2
  70. package/dist/{chunk-QOP5D3UM.js → chunk-YB26LWR2.js} +2 -2
  71. package/dist/{chunk-HBKKW3NL.js → chunk-YBKIAQNU.js} +6 -6
  72. package/dist/{chunk-7U27WUMQ.js → chunk-ZFZNPLRJ.js} +2 -2
  73. package/dist/{chunk-SO44ETGW.js → chunk-ZTUZDPHE.js} +2 -2
  74. package/dist/{chunk-YNFJWJHW.js → chunk-ZY4A2R7C.js} +7 -7
  75. package/dist/{chunk-SCXATNSP.js → chunk-ZZ3ZWTOI.js} +3 -3
  76. package/dist/{clean-4HTCYML6.js → clean-4WDZ3TFN.js} +18 -18
  77. package/dist/cli.js +52 -52
  78. package/dist/{cloud-HFBG33UU.js → cloud-FL6VP6IU.js} +4 -4
  79. package/dist/{cloudrun-QK56WQY3.js → cloudrun-STLNWUBW.js} +5 -5
  80. package/dist/commands/contrast-audit.browser.js +25 -8
  81. package/dist/commands/layout-audit.browser.js +117 -12
  82. package/dist/{compare-4RYN3LLC.js → compare-MXZ7QKBN.js} +27 -27
  83. package/dist/{compiler-JPA25IUF.js → compiler-VFJVUZWR.js} +5 -5
  84. package/dist/{component-7ARXR4KZ.js → component-XKBA5ON2.js} +3 -3
  85. package/dist/{compositions-DNBHEIGP.js → compositions-2LUY6RQW.js} +14 -14
  86. package/dist/{delete-4XYV72EU.js → delete-OBAOZCXI.js} +2 -2
  87. package/dist/{deterministicFonts-EOMDR6ZF.js → deterministicFonts-LNNVHVS2.js} +2 -2
  88. package/dist/{dist-2YYJYYPY.js → dist-2VXSQLXO.js} +1 -1
  89. package/dist/{dist-SKUIM4QJ.js → dist-SVTSOG4Q.js} +3 -3
  90. package/dist/docker/Dockerfile.render +21 -1
  91. package/dist/{doctor-5PHSH7IK.js → doctor-BLXWRHAE.js} +14 -14
  92. package/dist/{events-GQCOQY5E.js → events-LSJDXTXK.js} +5 -5
  93. package/dist/{events-FOGRN2KV.js → events-V4LYF3MW.js} +4 -4
  94. package/dist/{feedback-6T6ZJOTM.js → feedback-LMDNGTYB.js} +9 -9
  95. package/dist/{ffmpeg-VJXXLKI6.js → ffmpeg-2ROTISBL.js} +2 -2
  96. package/dist/{figma-PZLGUS6C.js → figma-BXHFTYCT.js} +3 -3
  97. package/dist/fontLocalizeCli.js +12 -12
  98. package/dist/{get-XUNYSY2Z.js → get-2ZKWMYCG.js} +2 -2
  99. package/dist/{gpuPolicy-SWCZJRZR.js → gpuPolicy-VXNJ4UBN.js} +9 -9
  100. package/dist/{grade-compare-S27N2NRU.js → grade-compare-F7JNDXGF.js} +28 -28
  101. package/dist/{help-4HZ75YVH.js → help-WGANCPIE.js} +1 -1
  102. package/dist/{history-NENOG3BT.js → history-FILLGPWB.js} +8 -8
  103. package/dist/hyperframe-runtime.js +15 -15
  104. package/dist/hyperframe.manifest.json +1 -1
  105. package/dist/hyperframe.runtime.iife.js +15 -15
  106. package/dist/hyperframes-player.global.js +1 -1
  107. package/dist/{info-IDEUAYJZ.js → info-QQJ7C6SO.js} +10 -10
  108. package/dist/{init-KWGZEC7F.js → init-BQYTOLTG.js} +30 -30
  109. package/dist/{inspect-3WLT3EHZ.js → inspect-BTBKTW5W.js} +28 -28
  110. package/dist/{installer-I3SLBB7G.js → installer-HF5BXXXM.js} +5 -5
  111. package/dist/{keyframes-7HPN5DKO.js → keyframes-Y5QDNXST.js} +8 -8
  112. package/dist/{lambda-MJH6U52V.js → lambda-ZCX7KGTY.js} +6 -6
  113. package/dist/{layout-ZEW4RZRP.js → layout-HITFK2H5.js} +28 -28
  114. package/dist/{lint-3TNKI4PK.js → lint-6HH5X4NJ.js} +9 -9
  115. package/dist/{lintProject-XQWXJYSC.js → lintProject-JGHKRO5L.js} +1 -1
  116. package/dist/{list-BJR2IXU4.js → list-KBERMLPP.js} +2 -2
  117. package/dist/{login-EA27W5T2.js → login-MZNDV73I.js} +4 -4
  118. package/dist/{manager-3EUU5UX6.js → manager-JNJE54OQ.js} +3 -3
  119. package/dist/{media-treatment-3JZFCG6I.js → media-treatment-YACCPVXX.js} +14 -14
  120. package/dist/{models-IRFIJOIW.js → models-WHDUQZQZ.js} +13 -13
  121. package/dist/{motionShot-S4M7QSW3.js → motionShot-CRQTWUJB.js} +15 -15
  122. package/dist/{normalize-audio-IOY3NRHJ.js → normalize-audio-Z7UQTZ5J.js} +6 -6
  123. package/dist/{open-SCBC3NF5.js → open-GM2J5QEA.js} +6 -6
  124. package/dist/{parakeetRunner-FGTIYDG7.js → parakeetRunner-5PNBGCGH.js} +14 -14
  125. package/dist/{pipeline-JEFEWIZ3.js → pipeline-QA2422UI.js} +10 -10
  126. package/dist/{play-4TCSBDHO.js → play-JGMRZO6G.js} +21 -21
  127. package/dist/{preflight-OIHM57E7.js → preflight-BH2XUQBS.js} +4 -4
  128. package/dist/{present-S6UBG5VI.js → present-SI7ZE6IB.js} +17 -17
  129. package/dist/{preview-HBDXDJCV.js → preview-PZOQHOIO.js} +20 -20
  130. package/dist/{producer-KSAUIT6F.js → producer-PQMZ7OYH.js} +1 -1
  131. package/dist/{projectConfig-CNAK65RI.js → projectConfig-EYYDESVO.js} +7 -7
  132. package/dist/{publication-AUWZFGJI.js → publication-MJY3XYYV.js} +3 -3
  133. package/dist/{publish-EMNP3VCC.js → publish-UT3L777Q.js} +9 -9
  134. package/dist/{remove-background-GICM6TE5.js → remove-background-HT73ZUIG.js} +11 -11
  135. package/dist/{render-PHEQSRHV.js → render-6CJXA7UA.js} +11 -11
  136. package/dist/{render-DMHQZMV4.js → render-SFIX3O3B.js} +27 -27
  137. package/dist/{render-WMRNH7HO.js → render-YTJ3SMCD.js} +4 -4
  138. package/dist/{render-batch-OUTHTWN5.js → render-batch-AFB2XK3I.js} +4 -4
  139. package/dist/renderSetupWorker.js +1 -1
  140. package/dist/{resolver-NTB6HOZC.js → resolver-F2D2YCSQ.js} +5 -5
  141. package/dist/{sherpa-3YJNJ6TF.js → sherpa-IBKSF6GX.js} +13 -13
  142. package/dist/{skills-MKEJGL35.js → skills-G26XO2BY.js} +7 -7
  143. package/dist/{skillsUpdateCheck-RTLARPPP.js → skillsUpdateCheck-ZNDQSDB4.js} +3 -3
  144. package/dist/{snapshot-KMLGFZWY.js → snapshot-SN7I7O7I.js} +31 -31
  145. package/dist/{src-4HB343JW.js → src-4GCHM2LX.js} +11 -11
  146. package/dist/{src-HJ2NF55P.js → src-NDI4KNT3.js} +8 -8
  147. package/dist/{staticProjectServer-4XX72J23.js → staticProjectServer-TTC3LYHO.js} +15 -15
  148. package/dist/{status-BMXWFO4L.js → status-RGHSK3DJ.js} +2 -2
  149. package/dist/studio/assets/{hyperframes-player-u2w3bDWo.js → hyperframes-player-D3ufdOJ_.js} +1 -1
  150. package/dist/studio/assets/{index-WD9j53l5.js → index-7oKTFwYd.js} +1 -1
  151. package/dist/studio/assets/{index-BG28fXIT.js → index-CALVHgsJ.js} +1 -1
  152. package/dist/studio/assets/{index-D8B6eEBj.js → index-DYk4U8BS.js} +83 -83
  153. package/dist/studio/index.html +1 -1
  154. package/dist/{studio-api-LPHMA57T.js → studio-api-TVIDDUZG.js} +9 -9
  155. package/dist/{studioServer-P7GSE74X.js → studioServer-WBV2Q3SH.js} +45 -45
  156. package/dist/{system-QRHPVRPP.js → system-VRXC6S4A.js} +2 -2
  157. package/dist/{telemetry-576VTLGI.js → telemetry-RVFKZEOH.js} +5 -5
  158. package/dist/{timeline-BO7LJJ24.js → timeline-BUYUBI5X.js} +17 -17
  159. package/dist/{tokens-TCYANQDA.js → tokens-PUA5FQKP.js} +2 -2
  160. package/dist/{transcribe-6PTFIBO6.js → transcribe-DZ6O6EG5.js} +12 -12
  161. package/dist/{transcribe-6HLMGCL2.js → transcribe-L2QHSNHO.js} +19 -19
  162. package/dist/{updateCheck-ZLYIZPPQ.js → updateCheck-PULEO7CW.js} +2 -2
  163. package/dist/{upgrade-DZHQE2PV.js → upgrade-UJJIVNHJ.js} +2 -2
  164. package/dist/{urlDownloader-PJTOCTJA.js → urlDownloader-INLS5A6I.js} +8 -8
  165. package/dist/{validate-3I45WC7I.js → validate-DJAZMEQB.js} +22 -22
  166. package/dist/{video-AQFXGGKN.js → video-3GLT6U6Z.js} +9 -9
  167. package/package.json +1 -1
  168. package/dist/chunk-NE55C6S5.js +0 -118
  169. package/dist/chunk-OE4WEQMH.js +0 -3795
  170. /package/dist/{chunk-VYKPBRCB.js → chunk-ALLKNYC3.js} +0 -0
@@ -0,0 +1,250 @@
1
+ import { createRequire as __hf_createRequire } from "node:module";
2
+ import { fileURLToPath as __hf_fileURLToPath } from "node:url";
3
+ import { dirname as __hf_dirname } from "node:path";
4
+ var require = __hf_createRequire(import.meta.url);
5
+ var __filename = __hf_fileURLToPath(import.meta.url);
6
+ var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ parseHTML
9
+ } from "./chunk-SDYDNHEE.js";
10
+
11
+ // ../parsers/dist/hfIds.js
12
+ var EXCLUDED_TAGS = /* @__PURE__ */ new Set([
13
+ "script",
14
+ "style",
15
+ "template",
16
+ "meta",
17
+ "link",
18
+ "noscript",
19
+ "base"
20
+ ]);
21
+ function fnv1a(str) {
22
+ let h = 2166136261;
23
+ for (let i = 0; i < str.length; i++) {
24
+ h ^= str.charCodeAt(i);
25
+ h = Math.imul(h, 16777619);
26
+ }
27
+ return h >>> 0;
28
+ }
29
+ function toHfId(hash) {
30
+ const s = (hash >>> 0).toString(36);
31
+ const four = s.length >= 4 ? s.slice(-4) : s.padStart(4, "0");
32
+ return `hf-${four}`;
33
+ }
34
+ function ownText(el) {
35
+ let text = "";
36
+ el.childNodes.forEach((n) => {
37
+ if (n.nodeType === 3) text += n.nodeValue ?? "";
38
+ });
39
+ return text.trim();
40
+ }
41
+ function getContractAttribute(el, name) {
42
+ return Array.from(el.attributes).find((attr) => attr.name.toLowerCase() === name)?.value ?? null;
43
+ }
44
+ function contentKey(el) {
45
+ const attrs = Array.from(el.attributes).filter((a) => !a.name.toLowerCase().startsWith("data-hf-")).map((a) => `${a.name.toLowerCase()}\0${a.value}`).sort().join("");
46
+ return `${el.tagName.toLowerCase()}|${attrs}|${ownText(el)}`;
47
+ }
48
+ function mintHfId(el, assigned) {
49
+ const key = contentKey(el);
50
+ let id = toHfId(fnv1a(key));
51
+ let dup = 0;
52
+ while (assigned.has(id)) {
53
+ dup += 1;
54
+ if (dup > 1e4) {
55
+ id = `hf-${(fnv1a(key) >>> 0).toString(36)}-${dup}`;
56
+ break;
57
+ }
58
+ id = toHfId(fnv1a(`${key}#${dup}`));
59
+ }
60
+ assigned.add(id);
61
+ return id;
62
+ }
63
+ function getChildElements(parent) {
64
+ const directChildren = Array.from(parent.children);
65
+ if (directChildren.length || parent.tagName.toLowerCase() !== "template") return directChildren;
66
+ const content = parent.content;
67
+ if (content?.children.length) return Array.from(content.children);
68
+ return directChildren;
69
+ }
70
+ function isCompositionTemplate(el) {
71
+ if (el.tagName.toLowerCase() !== "template") return false;
72
+ if (getContractAttribute(el, "data-composition-id") !== null) return true;
73
+ for (const child of getChildElements(el)) {
74
+ if (getContractAttribute(child, "data-composition-id") !== null) return true;
75
+ }
76
+ return false;
77
+ }
78
+ function walkCompositionDescendants(root, visit) {
79
+ const rootElement = root.nodeType === 9 ? root.documentElement : root;
80
+ if (!rootElement) return;
81
+ const walk = (parent) => {
82
+ for (const child of getChildElements(parent)) {
83
+ const isTemplate = child.tagName.toLowerCase() === "template";
84
+ if (isTemplate && !isCompositionTemplate(child)) continue;
85
+ visit(child);
86
+ walk(child);
87
+ }
88
+ };
89
+ walk(rootElement);
90
+ }
91
+ function assignHfIds(body) {
92
+ const assigned = /* @__PURE__ */ new Set();
93
+ walkCompositionDescendants(body, (el) => {
94
+ const existing = getContractAttribute(el, "data-hf-id");
95
+ if (existing) assigned.add(existing);
96
+ });
97
+ walkCompositionDescendants(body, (el) => {
98
+ if (EXCLUDED_TAGS.has(el.tagName.toLowerCase())) return;
99
+ if (getContractAttribute(el, "data-hf-id")) return;
100
+ el.setAttribute("data-hf-id", mintHfId(el, assigned));
101
+ });
102
+ }
103
+ function ensureHfIds(html) {
104
+ const { document, wrapped } = parseFragmentOrDocument(html);
105
+ if (!document.body) return html;
106
+ assignHfIds(document.body);
107
+ return wrapped ? document.body.innerHTML || "" : document.toString();
108
+ }
109
+ function parseFragmentOrDocument(html) {
110
+ const wrapped = !/^(?:<!doctype|<html[\s>/])/i.test(
111
+ html.replace(/^(?:\s|<!--(?:>|->|[\s\S]*?-->))*/, "")
112
+ );
113
+ const { document } = wrapped ? parseHTML(`<!DOCTYPE html><html><head></head><body>${html}</body></html>`) : parseHTML(html);
114
+ return { document, wrapped };
115
+ }
116
+ function stampHfIdsInPlace(html) {
117
+ const { document, wrapped } = parseFragmentOrDocument(html);
118
+ if (!document.body) return html;
119
+ const elements = wrapped ? getChildElements(document.body).flatMap(inDocumentOrder) : inDocumentOrder(document.documentElement);
120
+ const existing = elements.map((el) => el.getAttribute("data-hf-id"));
121
+ const pinned = existing.map((id) => id !== null && id.length > 0);
122
+ assignHfIds(document.body);
123
+ const minted = elements.map((el, n) => pinned[n] ? null : el.getAttribute("data-hf-id"));
124
+ const tags = startTags(html);
125
+ const inserts = tags && alignInserts(html, tags, elements, minted, existing);
126
+ return inserts ? spliceIds(html, inserts) : ensureHfIds(html);
127
+ }
128
+ function inDocumentOrder(el) {
129
+ return [el, ...getChildElements(el).flatMap(inDocumentOrder)];
130
+ }
131
+ var RAW_TEXT = /* @__PURE__ */ new Set(["script", "style", "textarea", "title", "xmp", "noembed", "noframes"]);
132
+ var IMPLIED = /* @__PURE__ */ new Set(["html", "head", "body", "tbody"]);
133
+ function startTags(html) {
134
+ const lower = html.toLowerCase();
135
+ const tags = [];
136
+ let i = html.indexOf("<");
137
+ while (i >= 0) {
138
+ const name = html.startsWith("<!--", i) ? null : /^<([a-zA-Z][^\s/>]*)/.exec(html.slice(i, i + 128));
139
+ if (!name) {
140
+ i = nextTagAfter(html, i);
141
+ continue;
142
+ }
143
+ const end = closingBracket(html, i + name[0].length);
144
+ if (end < 0) return null;
145
+ const tag = name[1].toLowerCase();
146
+ tags.push({ name: tag, nameEnd: i + name[0].length, bracket: end });
147
+ const after = RAW_TEXT.has(tag) ? rawTextEnd(lower, tag, end) : end;
148
+ i = after < 0 ? -1 : html.indexOf("<", after + 1);
149
+ }
150
+ return tags;
151
+ }
152
+ function rawTextEnd(lower, tag, from) {
153
+ const marker = `</${tag}`;
154
+ for (let at = lower.indexOf(marker, from); at >= 0; at = lower.indexOf(marker, at + marker.length)) {
155
+ const next = lower[at + marker.length];
156
+ if (next !== void 0 && /[\s/>]/.test(next)) return at;
157
+ }
158
+ return -1;
159
+ }
160
+ function nextTagAfter(html, lt) {
161
+ const comment = html.startsWith("<!--", lt);
162
+ const end = comment ? html.indexOf("-->", lt + 4) : html.indexOf(">", lt);
163
+ return end < 0 ? -1 : html.indexOf("<", end + 1);
164
+ }
165
+ function closingBracket(html, from) {
166
+ let quote = "";
167
+ for (let i = from; i < html.length; i++) {
168
+ const c = html[i];
169
+ if (quote) quote = c === quote ? "" : quote;
170
+ else if (c === '"' || c === "'") quote = c;
171
+ else if (c === ">") return i;
172
+ }
173
+ return -1;
174
+ }
175
+ function alignInserts(html, tags, elements, minted, existing) {
176
+ const walked = walkAlign(html, tags, elements, minted, existing);
177
+ if (!walked) return null;
178
+ return walked.next === tags.length ? walked.inserts : null;
179
+ }
180
+ function walkAlign(html, tags, elements, minted, existing) {
181
+ const state = { inserts: [], next: 0 };
182
+ for (const [n, el] of elements.entries()) {
183
+ if (!take(state, html, tags, el, minted[n] ?? null, existing[n] === "")) return null;
184
+ }
185
+ return state;
186
+ }
187
+ function take(state, html, tags, el, id, fillEmpty) {
188
+ const step = alignOne(html, tags[state.next], el, id, fillEmpty);
189
+ if (!step) return false;
190
+ if (step.insert) state.inserts.push(step.insert);
191
+ if (step.next) state.next += 1;
192
+ return true;
193
+ }
194
+ function alignOne(html, tag, el, id, fillEmpty) {
195
+ if (tag?.name === el.tagName.toLowerCase()) return matched(html, tag, id, fillEmpty);
196
+ if (IMPLIED.has(el.tagName.toLowerCase()) && !id) return { insert: null, next: false };
197
+ return null;
198
+ }
199
+ function matched(html, tag, id, fillEmpty) {
200
+ if (!id) return { insert: null, next: true };
201
+ const placed = placeId(html, tag, id, fillEmpty);
202
+ if (!placed) return null;
203
+ return { insert: placed, next: true };
204
+ }
205
+ function placeId(html, tag, id, fillEmpty) {
206
+ if (!fillEmpty) return { at: tag.nameEnd, text: ` data-hf-id="${id}"` };
207
+ const emptyAt = emptyHfIdValue(html, tag);
208
+ if (emptyAt === null) return null;
209
+ return { at: emptyAt, text: id };
210
+ }
211
+ function emptyHfIdValue(html, tag) {
212
+ const open = outsideQuotes(html.slice(tag.nameEnd, tag.bracket));
213
+ const match = /\sdata-hf-id\s*=\s*(["'])\1/i.exec(open);
214
+ if (!match) return null;
215
+ return tag.nameEnd + match.index + match[0].length - 1;
216
+ }
217
+ function outsideQuotes(open) {
218
+ let quote = "";
219
+ let out = "";
220
+ for (const c of open) {
221
+ out += quotedChar(quote, c);
222
+ quote = quoteOf(quote, c);
223
+ }
224
+ return out;
225
+ }
226
+ function quoteOf(quote, c) {
227
+ if (quote) return c === quote ? "" : quote;
228
+ return c === '"' || c === "'" ? c : "";
229
+ }
230
+ function quotedChar(quote, c) {
231
+ if (!quote || c === quote) return c;
232
+ return " ".repeat(c.length);
233
+ }
234
+ function spliceIds(html, inserts) {
235
+ let out = "";
236
+ let from = 0;
237
+ for (const { at, text } of inserts) {
238
+ out += html.slice(from, at) + text;
239
+ from = at;
240
+ }
241
+ return out + html.slice(from);
242
+ }
243
+
244
+ export {
245
+ EXCLUDED_TAGS,
246
+ mintHfId,
247
+ walkCompositionDescendants,
248
+ ensureHfIds,
249
+ stampHfIdsInPlace
250
+ };
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  detectWsl
9
- } from "./chunk-OBXWIVYN.js";
9
+ } from "./chunk-7KDQAD2W.js";
10
10
  import {
11
11
  runCancellableProcess
12
12
  } from "./chunk-54DMWFQZ.js";