@absolutejs/absolute 0.19.0-beta.783 → 0.19.0-beta.784

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 (252) hide show
  1. package/dist/angular/browser.js +57 -9801
  2. package/dist/angular/browser.js.map +4 -246
  3. package/dist/angular/index.js +61 -14967
  4. package/dist/angular/index.js.map +4 -282
  5. package/dist/angular/server.js +45 -5699
  6. package/dist/angular/server.js.map +3 -52
  7. package/dist/build.js +45 -18021
  8. package/dist/build.js.map +3 -100
  9. package/dist/chunk-102fp7xe.js +63 -0
  10. package/dist/chunk-102fp7xe.js.map +10 -0
  11. package/dist/chunk-11zpfqz6.js +19 -0
  12. package/dist/chunk-11zpfqz6.js.map +10 -0
  13. package/dist/chunk-1e9vsfyh.js +100 -0
  14. package/dist/chunk-1e9vsfyh.js.map +10 -0
  15. package/dist/chunk-25v9t56f.js +29 -0
  16. package/dist/chunk-25v9t56f.js.map +11 -0
  17. package/dist/chunk-2f21eenc.js +21 -0
  18. package/dist/chunk-2f21eenc.js.map +10 -0
  19. package/dist/chunk-2ga2znex.js +13 -0
  20. package/dist/chunk-2ga2znex.js.map +9 -0
  21. package/dist/chunk-30yrw0f6.js +33 -0
  22. package/dist/chunk-30yrw0f6.js.map +10 -0
  23. package/dist/chunk-3c7mpj3m.js +784 -0
  24. package/dist/chunk-3c7mpj3m.js.map +10 -0
  25. package/dist/chunk-3g91wb4f.js +358 -0
  26. package/dist/chunk-3g91wb4f.js.map +10 -0
  27. package/dist/chunk-3yjzpcne.js +34 -0
  28. package/dist/chunk-3yjzpcne.js.map +10 -0
  29. package/dist/chunk-4bq79t8v.js +136 -0
  30. package/dist/chunk-4bq79t8v.js.map +10 -0
  31. package/dist/chunk-4d39r92n.js +81 -0
  32. package/dist/chunk-4d39r92n.js.map +10 -0
  33. package/dist/chunk-4m75s5xf.js +184 -0
  34. package/dist/chunk-4m75s5xf.js.map +11 -0
  35. package/dist/chunk-5003emhv.js +17 -0
  36. package/dist/chunk-5003emhv.js.map +10 -0
  37. package/dist/chunk-5fhp1jap.js +9169 -0
  38. package/dist/chunk-5fhp1jap.js.map +236 -0
  39. package/dist/chunk-6fkgm9s5.js +569 -0
  40. package/dist/chunk-6fkgm9s5.js.map +10 -0
  41. package/dist/chunk-6pdj08z3.js +73 -0
  42. package/dist/chunk-6pdj08z3.js.map +12 -0
  43. package/dist/chunk-6qjbrt0k.js +13 -0
  44. package/dist/chunk-6qjbrt0k.js.map +9 -0
  45. package/dist/chunk-6sccb4jr.js +14 -0
  46. package/dist/chunk-6sccb4jr.js.map +9 -0
  47. package/dist/chunk-73brtyw5.js +16 -0
  48. package/dist/chunk-73brtyw5.js.map +9 -0
  49. package/dist/chunk-77cqkarb.js +25 -0
  50. package/dist/chunk-77cqkarb.js.map +9 -0
  51. package/dist/chunk-798spvzv.js +50 -0
  52. package/dist/chunk-798spvzv.js.map +10 -0
  53. package/dist/chunk-7fw6x3js.js +131 -0
  54. package/dist/chunk-7fw6x3js.js.map +11 -0
  55. package/dist/chunk-7kjj42xm.js +11 -0
  56. package/dist/chunk-7kjj42xm.js.map +10 -0
  57. package/dist/chunk-851whwc7.js +17 -0
  58. package/dist/chunk-851whwc7.js.map +10 -0
  59. package/dist/chunk-85n68sy6.js +103 -0
  60. package/dist/chunk-85n68sy6.js.map +10 -0
  61. package/dist/chunk-8feq2qek.js +17 -0
  62. package/dist/chunk-8feq2qek.js.map +9 -0
  63. package/dist/chunk-8kcfffry.js +35 -0
  64. package/dist/chunk-8kcfffry.js.map +10 -0
  65. package/dist/chunk-93sqk7be.js +139 -0
  66. package/dist/chunk-93sqk7be.js.map +12 -0
  67. package/dist/chunk-97572s32.js +262 -0
  68. package/dist/chunk-97572s32.js.map +12 -0
  69. package/dist/chunk-9a307ca6.js +1742 -0
  70. package/dist/chunk-9a307ca6.js.map +11 -0
  71. package/dist/chunk-9c5tj4k3.js +130 -0
  72. package/dist/chunk-9c5tj4k3.js.map +10 -0
  73. package/dist/chunk-9xrsjeem.js +12 -0
  74. package/dist/chunk-9xrsjeem.js.map +9 -0
  75. package/dist/chunk-a9mvyp04.js +87 -0
  76. package/dist/chunk-a9mvyp04.js.map +10 -0
  77. package/dist/chunk-b3gbnrwe.js +21 -0
  78. package/dist/chunk-b3gbnrwe.js.map +10 -0
  79. package/dist/chunk-bmgqm774.js +65 -0
  80. package/dist/chunk-bmgqm774.js.map +9 -0
  81. package/dist/chunk-bxfghpma.js +69 -0
  82. package/dist/chunk-bxfghpma.js.map +10 -0
  83. package/dist/chunk-c1jfjnka.js +74 -0
  84. package/dist/chunk-c1jfjnka.js.map +10 -0
  85. package/dist/chunk-cbkrwmvh.js +80 -0
  86. package/dist/chunk-cbkrwmvh.js.map +10 -0
  87. package/dist/chunk-cdxd7sy2.js +71 -0
  88. package/dist/chunk-cdxd7sy2.js.map +10 -0
  89. package/dist/chunk-cg95827x.js +21 -0
  90. package/dist/chunk-cg95827x.js.map +10 -0
  91. package/dist/chunk-d9c0am65.js +12 -0
  92. package/dist/chunk-d9c0am65.js.map +10 -0
  93. package/dist/chunk-daqghmg8.js +12 -0
  94. package/dist/chunk-daqghmg8.js.map +9 -0
  95. package/dist/chunk-dr9yqsdb.js +203 -0
  96. package/dist/chunk-dr9yqsdb.js.map +10 -0
  97. package/dist/chunk-e8eecyrq.js +244 -0
  98. package/dist/chunk-e8eecyrq.js.map +10 -0
  99. package/dist/chunk-ex2hxe0v.js +160 -0
  100. package/dist/chunk-ex2hxe0v.js.map +11 -0
  101. package/dist/chunk-ey5hs6x6.js +253 -0
  102. package/dist/chunk-ey5hs6x6.js.map +11 -0
  103. package/dist/chunk-fak944et.js +91 -0
  104. package/dist/chunk-fak944et.js.map +10 -0
  105. package/dist/chunk-fygx2ymm.js +118 -0
  106. package/dist/chunk-fygx2ymm.js.map +12 -0
  107. package/dist/chunk-g15qj669.js +271 -0
  108. package/dist/chunk-g15qj669.js.map +11 -0
  109. package/dist/chunk-g3j22qf6.js +51 -0
  110. package/dist/chunk-g3j22qf6.js.map +9 -0
  111. package/dist/chunk-gd6wmknh.js +121 -0
  112. package/dist/chunk-gd6wmknh.js.map +11 -0
  113. package/dist/chunk-gf0ygptk.js +85 -0
  114. package/dist/chunk-gf0ygptk.js.map +11 -0
  115. package/dist/chunk-gq0zxpm0.js +90 -0
  116. package/dist/chunk-gq0zxpm0.js.map +10 -0
  117. package/dist/chunk-gytkmthr.js +220 -0
  118. package/dist/chunk-gytkmthr.js.map +10 -0
  119. package/dist/chunk-h5bbfn3n.js +28 -0
  120. package/dist/chunk-h5bbfn3n.js.map +11 -0
  121. package/dist/chunk-h6mye9r3.js +93 -0
  122. package/dist/chunk-h6mye9r3.js.map +10 -0
  123. package/dist/chunk-hcsmxw1v.js +85 -0
  124. package/dist/chunk-hcsmxw1v.js.map +10 -0
  125. package/dist/chunk-hep68ja7.js +4444 -0
  126. package/dist/chunk-hep68ja7.js.map +29 -0
  127. package/dist/chunk-hhqh49fz.js +149 -0
  128. package/dist/chunk-hhqh49fz.js.map +10 -0
  129. package/dist/chunk-hyjs4bqs.js +8 -0
  130. package/dist/chunk-hyjs4bqs.js.map +10 -0
  131. package/dist/chunk-hza0n8qm.js +20 -0
  132. package/dist/chunk-hza0n8qm.js.map +9 -0
  133. package/dist/chunk-jn91vzkh.js +66 -0
  134. package/dist/chunk-jn91vzkh.js.map +10 -0
  135. package/dist/chunk-jwxt8gnp.js +13 -0
  136. package/dist/chunk-jwxt8gnp.js.map +9 -0
  137. package/dist/chunk-kk8w9rh5.js +195 -0
  138. package/dist/chunk-kk8w9rh5.js.map +10 -0
  139. package/dist/chunk-kndkjsya.js +261 -0
  140. package/dist/chunk-kndkjsya.js.map +10 -0
  141. package/dist/chunk-kvq01j35.js +36 -0
  142. package/dist/chunk-kvq01j35.js.map +10 -0
  143. package/dist/chunk-mbazhahf.js +60 -0
  144. package/dist/chunk-mbazhahf.js.map +10 -0
  145. package/dist/chunk-mgfwq18r.js +15 -0
  146. package/dist/chunk-mgfwq18r.js.map +9 -0
  147. package/dist/chunk-mtgf69xn.js +88 -0
  148. package/dist/chunk-mtgf69xn.js.map +10 -0
  149. package/dist/chunk-nehhtthw.js +225 -0
  150. package/dist/chunk-nehhtthw.js.map +10 -0
  151. package/dist/chunk-nhzf4az4.js +149 -0
  152. package/dist/chunk-nhzf4az4.js.map +10 -0
  153. package/dist/chunk-p5504p14.js +16 -0
  154. package/dist/chunk-p5504p14.js.map +10 -0
  155. package/dist/chunk-pnscgw95.js +90 -0
  156. package/dist/chunk-pnscgw95.js.map +10 -0
  157. package/dist/chunk-pvpp4pvs.js +17 -0
  158. package/dist/chunk-pvpp4pvs.js.map +10 -0
  159. package/dist/chunk-qh75agse.js +95 -0
  160. package/dist/chunk-qh75agse.js.map +10 -0
  161. package/dist/chunk-qk8kd3hr.js +526 -0
  162. package/dist/chunk-qk8kd3hr.js.map +12 -0
  163. package/dist/chunk-qxq2zcty.js +52 -0
  164. package/dist/chunk-qxq2zcty.js.map +10 -0
  165. package/dist/chunk-r7jmgqnw.js +114 -0
  166. package/dist/chunk-r7jmgqnw.js.map +10 -0
  167. package/dist/chunk-s6defjk2.js +116 -0
  168. package/dist/chunk-s6defjk2.js.map +10 -0
  169. package/dist/chunk-sd39p726.js +619 -0
  170. package/dist/chunk-sd39p726.js.map +10 -0
  171. package/dist/chunk-smgj0epn.js +18 -0
  172. package/dist/chunk-smgj0epn.js.map +9 -0
  173. package/dist/chunk-swrnzs4c.js +63 -0
  174. package/dist/chunk-swrnzs4c.js.map +10 -0
  175. package/dist/chunk-t81a331y.js +27 -0
  176. package/dist/chunk-t81a331y.js.map +10 -0
  177. package/dist/chunk-tfe3sb44.js +33 -0
  178. package/dist/chunk-tfe3sb44.js.map +10 -0
  179. package/dist/chunk-tx9edm1x.js +34 -0
  180. package/dist/chunk-tx9edm1x.js.map +10 -0
  181. package/dist/chunk-vkrpm7kc.js +247 -0
  182. package/dist/chunk-vkrpm7kc.js.map +12 -0
  183. package/dist/chunk-vvz7dcvq.js +434 -0
  184. package/dist/chunk-vvz7dcvq.js.map +13 -0
  185. package/dist/chunk-w3m4m5we.js +4925 -0
  186. package/dist/chunk-w3m4m5we.js.map +12 -0
  187. package/dist/chunk-wrxtn9ve.js +18 -0
  188. package/dist/chunk-wrxtn9ve.js.map +10 -0
  189. package/dist/chunk-xpkjbmd3.js +428 -0
  190. package/dist/chunk-xpkjbmd3.js.map +14 -0
  191. package/dist/chunk-xrmjy8kk.js +454 -0
  192. package/dist/chunk-xrmjy8kk.js.map +10 -0
  193. package/dist/chunk-xw0tx842.js +13 -0
  194. package/dist/chunk-xw0tx842.js.map +9 -0
  195. package/dist/chunk-xx5b6b9m.js +69 -0
  196. package/dist/chunk-xx5b6b9m.js.map +10 -0
  197. package/dist/chunk-xz1kdswj.js +21 -0
  198. package/dist/chunk-xz1kdswj.js.map +9 -0
  199. package/dist/chunk-xzvy9hr4.js +377 -0
  200. package/dist/chunk-xzvy9hr4.js.map +10 -0
  201. package/dist/chunk-yfqhr31t.js +39 -0
  202. package/dist/chunk-yfqhr31t.js.map +9 -0
  203. package/dist/chunk-ygzd5s4z.js +184 -0
  204. package/dist/chunk-ygzd5s4z.js.map +10 -0
  205. package/dist/chunk-ywjn0rad.js +14 -0
  206. package/dist/chunk-ywjn0rad.js.map +9 -0
  207. package/dist/chunk-z9nvhm6r.js +13 -0
  208. package/dist/chunk-z9nvhm6r.js.map +9 -0
  209. package/dist/chunk-zhmvdpk6.js +15 -0
  210. package/dist/chunk-zhmvdpk6.js.map +9 -0
  211. package/dist/client/index.js +32 -1112
  212. package/dist/client/index.js.map +4 -22
  213. package/dist/core/streamingSlotRegistrar.js +11 -108
  214. package/dist/core/streamingSlotRegistrar.js.map +3 -4
  215. package/dist/core/streamingSlotRegistry.js +7 -169
  216. package/dist/core/streamingSlotRegistry.js.map +3 -5
  217. package/dist/index.js +536 -19835
  218. package/dist/index.js.map +3 -117
  219. package/dist/islands/browser.js +9 -228
  220. package/dist/islands/browser.js.map +4 -9
  221. package/dist/islands/index.js +17 -1986
  222. package/dist/islands/index.js.map +3 -28
  223. package/dist/react/browser.js +12 -328
  224. package/dist/react/browser.js.map +4 -12
  225. package/dist/react/components/index.js +16 -167
  226. package/dist/react/components/index.js.map +3 -6
  227. package/dist/react/hooks/index.js +8 -183
  228. package/dist/react/hooks/index.js.map +3 -7
  229. package/dist/react/index.js +36 -3705
  230. package/dist/react/index.js.map +4 -46
  231. package/dist/react/jsxDevRuntimeCompat.js +2 -61
  232. package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
  233. package/dist/react/server.js +18 -1789
  234. package/dist/react/server.js.map +3 -21
  235. package/dist/src/core/index.d.ts +0 -2
  236. package/dist/svelte/browser.js +12 -247
  237. package/dist/svelte/browser.js.map +3 -10
  238. package/dist/svelte/index.js +37 -3810
  239. package/dist/svelte/index.js.map +4 -48
  240. package/dist/svelte/server.js +21 -2787
  241. package/dist/svelte/server.js.map +3 -27
  242. package/dist/vue/browser.js +12 -348
  243. package/dist/vue/browser.js.map +4 -12
  244. package/dist/vue/components/Image.js +7 -240
  245. package/dist/vue/components/Image.js.map +3 -6
  246. package/dist/vue/components/index.js +11 -544
  247. package/dist/vue/components/index.js.map +3 -9
  248. package/dist/vue/index.js +52 -4290
  249. package/dist/vue/index.js.map +4 -51
  250. package/dist/vue/server.js +18 -1849
  251. package/dist/vue/server.js.map +3 -21
  252. package/package.json +7 -7
@@ -0,0 +1,261 @@
1
+ // @bun
2
+ import {
3
+ compileStyleSource
4
+ } from "./chunk-6fkgm9s5.js";
5
+ import {
6
+ __require
7
+ } from "./chunk-bmgqm774.js";
8
+
9
+ // src/build/tailwindCompiler.ts
10
+ import { createHash } from "crypto";
11
+ import { existsSync, readFileSync } from "fs";
12
+ import { readFile, stat } from "fs/promises";
13
+ import { dirname, isAbsolute, resolve } from "path";
14
+ var compilerCache = new Map;
15
+ var cachedTailwindCompile = null;
16
+ var loadTailwindCompile = async () => {
17
+ if (cachedTailwindCompile)
18
+ return cachedTailwindCompile;
19
+ try {
20
+ const mod = await import("./chunk-w3m4m5we.js");
21
+ cachedTailwindCompile = mod.compile;
22
+ return mod.compile;
23
+ } catch {
24
+ throw new Error("Tailwind incremental dev compiler requires `tailwindcss` to be installed.");
25
+ }
26
+ };
27
+ var recordDependency = async (deps, path) => {
28
+ try {
29
+ const mtime = (await stat(path)).mtimeMs;
30
+ deps.set(path, mtime);
31
+ } catch {
32
+ deps.set(path, 0);
33
+ }
34
+ };
35
+ var resolveBareCssImport = (id, base) => {
36
+ const slashIndex = id.indexOf("/");
37
+ const pkgName = id.startsWith("@") ? id.split("/").slice(0, 2).join("/") : slashIndex === -1 ? id : id.slice(0, slashIndex);
38
+ const subpath = id.slice(pkgName.length);
39
+ if (subpath !== "") {
40
+ return Bun.resolveSync(id, base);
41
+ }
42
+ let pkgJsonPath;
43
+ try {
44
+ pkgJsonPath = Bun.resolveSync(`${pkgName}/package.json`, base);
45
+ } catch {
46
+ return Bun.resolveSync(id, base);
47
+ }
48
+ const pkgDir = dirname(pkgJsonPath);
49
+ let pkg = {};
50
+ try {
51
+ pkg = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
52
+ } catch {
53
+ return Bun.resolveSync(id, base);
54
+ }
55
+ const exportsField = pkg.exports;
56
+ const styleFromExports = exportsField?.["."]?.style;
57
+ const candidates = [
58
+ styleFromExports,
59
+ typeof pkg.style === "string" ? pkg.style : undefined,
60
+ "index.css",
61
+ "dist/index.css"
62
+ ].filter((entry) => typeof entry === "string");
63
+ for (const candidate of candidates) {
64
+ const candidatePath = resolve(pkgDir, candidate);
65
+ if (existsSync(candidatePath))
66
+ return candidatePath;
67
+ }
68
+ return Bun.resolveSync(id, base);
69
+ };
70
+ var createLoadStylesheet = (deps) => async (id, base) => {
71
+ const path = id.startsWith(".") || isAbsolute(id) ? resolve(base, id) : resolveBareCssImport(id, base);
72
+ const content = await readFile(path, "utf-8");
73
+ await recordDependency(deps, path);
74
+ return { base: dirname(path), content, path };
75
+ };
76
+ var loadModule = async (id, base, _kind) => {
77
+ const path = id.startsWith(".") || isAbsolute(id) ? resolve(base, id) : Bun.resolveSync(id, base);
78
+ const module = await import(path);
79
+ return { base: dirname(path), module, path };
80
+ };
81
+ var buildCompilerEntry = async (cssPath) => {
82
+ const compile = await loadTailwindCompile();
83
+ const absPath = resolve(cssPath);
84
+ const css = await readFile(absPath, "utf-8");
85
+ const cssMtimeMs = (await stat(absPath)).mtimeMs;
86
+ const cssDependencies = new Map;
87
+ cssDependencies.set(absPath, cssMtimeMs);
88
+ const compiler = await compile(css, {
89
+ base: dirname(absPath),
90
+ loadModule,
91
+ loadStylesheet: createLoadStylesheet(cssDependencies)
92
+ });
93
+ return {
94
+ candidateCounts: new Map,
95
+ compiler,
96
+ cssDependencies,
97
+ cssMtimeMs,
98
+ cssPath: absPath,
99
+ lastEmittedHash: null,
100
+ perFileCandidates: new Map,
101
+ sources: [...compiler.sources]
102
+ };
103
+ };
104
+ var CANDIDATE_PATTERN = /[A-Za-z!\-_][\w:\-/[\]().!,#%@&'"=]*[\w\])]/g;
105
+ var extractCandidates = (source) => {
106
+ const out = new Set;
107
+ for (const match of source.matchAll(CANDIDATE_PATTERN)) {
108
+ out.add(match[0]);
109
+ }
110
+ return out;
111
+ };
112
+ var hashCss = (css) => createHash("sha1").update(css).digest("hex");
113
+ var fileMatchesSources = (file, sources) => {
114
+ if (sources.length === 0)
115
+ return true;
116
+ const absFile = resolve(file);
117
+ for (const source of sources) {
118
+ if (source.negated)
119
+ continue;
120
+ const absolutePattern = resolve(source.base, source.pattern);
121
+ const glob = new Bun.Glob(absolutePattern);
122
+ if (glob.match(absFile))
123
+ return true;
124
+ }
125
+ return false;
126
+ };
127
+ var incrementCandidateCount = (entry, candidate) => {
128
+ const current = entry.candidateCounts.get(candidate) ?? 0;
129
+ entry.candidateCounts.set(candidate, current + 1);
130
+ };
131
+ var decrementCandidateCount = (entry, candidate) => {
132
+ const current = entry.candidateCounts.get(candidate) ?? 0;
133
+ const next = current - 1;
134
+ if (next <= 0) {
135
+ entry.candidateCounts.delete(candidate);
136
+ return;
137
+ }
138
+ entry.candidateCounts.set(candidate, next);
139
+ };
140
+ var replaceFileCandidates = (entry, file, freshCandidates) => {
141
+ const previous = entry.perFileCandidates.get(file);
142
+ if (previous) {
143
+ for (const candidate of previous)
144
+ decrementCandidateCount(entry, candidate);
145
+ }
146
+ entry.perFileCandidates.set(file, freshCandidates);
147
+ for (const candidate of freshCandidates)
148
+ incrementCandidateCount(entry, candidate);
149
+ };
150
+ var splitGlobAtFirstMeta = (absolutePattern) => {
151
+ const firstMetaIndex = absolutePattern.search(/[*?{[]/);
152
+ if (firstMetaIndex === -1) {
153
+ return { glob: "", root: absolutePattern };
154
+ }
155
+ const lastSlashBeforeMeta = absolutePattern.lastIndexOf("/", firstMetaIndex);
156
+ return {
157
+ glob: absolutePattern.slice(lastSlashBeforeMeta + 1),
158
+ root: absolutePattern.slice(0, lastSlashBeforeMeta) || "/"
159
+ };
160
+ };
161
+ var collectFilesForSources = async (sources) => {
162
+ const seen = new Set;
163
+ const collected = [];
164
+ const scans = sources.filter((source) => !source.negated).map(async (source) => {
165
+ const absolutePattern = resolve(source.base, source.pattern);
166
+ const { glob: relativePattern, root } = splitGlobAtFirstMeta(absolutePattern);
167
+ if (!relativePattern)
168
+ return [];
169
+ const glob = new Bun.Glob(relativePattern);
170
+ const matches = [];
171
+ for await (const relative of glob.scan({
172
+ absolute: false,
173
+ cwd: root,
174
+ onlyFiles: true
175
+ })) {
176
+ matches.push(resolve(root, relative));
177
+ }
178
+ return matches;
179
+ });
180
+ const results = await Promise.all(scans);
181
+ for (const absolute of results.flat()) {
182
+ if (seen.has(absolute))
183
+ continue;
184
+ seen.add(absolute);
185
+ collected.push(absolute);
186
+ }
187
+ return collected;
188
+ };
189
+ var ingestFile = async (entry, absolute) => {
190
+ try {
191
+ const text = await readFile(absolute, "utf-8");
192
+ replaceFileCandidates(entry, absolute, extractCandidates(text));
193
+ } catch {}
194
+ };
195
+ var populateCandidatesFromAllSources = async (entry) => {
196
+ const files = await collectFilesForSources(entry.sources);
197
+ await Promise.all(files.map((file) => ingestFile(entry, file)));
198
+ };
199
+ var isCompilerStale = async (entry) => {
200
+ const checks = [...entry.cssDependencies.entries()].map(async ([path, knownMtime]) => {
201
+ try {
202
+ const mtime = (await stat(path)).mtimeMs;
203
+ return mtime !== knownMtime;
204
+ } catch {
205
+ return true;
206
+ }
207
+ });
208
+ const results = await Promise.all(checks);
209
+ return results.some(Boolean);
210
+ };
211
+ var getCompilerEntry = async (cssPath) => {
212
+ const key = resolve(cssPath);
213
+ const cached = compilerCache.get(key);
214
+ if (cached && !await isCompilerStale(cached))
215
+ return cached;
216
+ const fresh = await buildCompilerEntry(cssPath);
217
+ await populateCandidatesFromAllSources(fresh);
218
+ compilerCache.set(key, fresh);
219
+ return fresh;
220
+ };
221
+ var disposeTailwindCompiler = (cssPath) => {
222
+ if (!cssPath) {
223
+ compilerCache.clear();
224
+ return;
225
+ }
226
+ compilerCache.delete(resolve(cssPath));
227
+ };
228
+ var incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig) => {
229
+ const startedAt = performance.now();
230
+ const entry = await getCompilerEntry(tailwind.input);
231
+ const inputAbs = entry.cssPath;
232
+ const filesToRescan = [];
233
+ for (const file of changedFiles) {
234
+ const abs = resolve(file);
235
+ if (abs === inputAbs)
236
+ continue;
237
+ if (!fileMatchesSources(abs, entry.sources))
238
+ continue;
239
+ filesToRescan.push(abs);
240
+ }
241
+ await Promise.all(filesToRescan.map((file) => ingestFile(entry, file)));
242
+ const rawCss = entry.compiler.build([...entry.candidateCounts.keys()]);
243
+ const outputPath = resolve(buildPath, tailwind.output);
244
+ const finalCss = await compileStyleSource(outputPath, rawCss, "css", styleTransformConfig);
245
+ const hash = hashCss(finalCss);
246
+ const durationMs = performance.now() - startedAt;
247
+ if (hash === entry.lastEmittedHash) {
248
+ return { cssChanged: false, durationMs };
249
+ }
250
+ await Bun.write(outputPath, finalCss);
251
+ entry.lastEmittedHash = hash;
252
+ return { cssChanged: true, durationMs };
253
+ };
254
+ var warmTailwindCompiler = async (tailwind) => {
255
+ await getCompilerEntry(tailwind.input);
256
+ };
257
+
258
+ export { extractCandidates, disposeTailwindCompiler, incrementalTailwindBuild, warmTailwindCompiler };
259
+
260
+ //# debugId=98DF22AA58613E2464756E2164756E21
261
+ //# sourceMappingURL=chunk-kndkjsya.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/build/tailwindCompiler.ts"],
4
+ "sourcesContent": [
5
+ "/* Persistent Tailwind v4 compiler for incremental dev rebuilds.\n\n The naive path (re-running bun.build with bun-plugin-tailwind) pays the\n bundler init cost on every HMR tick. For a dev workflow where most edits\n only add or remove a few utility classes, that's wasted work — Tailwind v4\n has a per-candidate cache built into its compiler, but only if you keep\n the compiler instance alive.\n\n This module mirrors the strategy used by @tailwindcss/vite: hold one\n compiled instance keyed by the input CSS path, scan only changed files\n for new candidate tokens, and call `compiler.build(allCandidates)` to\n produce CSS. Tailwind reuses its internal cache for candidates it has\n already compiled, so the marginal cost per HMR is just the file scan\n plus CSS serialization.\n\n We also content-hash the emitted CSS and skip the broadcast (and the\n disk write) when it hasn't changed — this avoids needless browser\n stylesheet refetches when an edit doesn't add/remove any utilities. */\n\nimport { createHash } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { readFile, stat } from 'node:fs/promises';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport { compileStyleSource } from './stylePreprocessor';\nimport type {\n\tStylePreprocessorConfig,\n\tTailwindConfig\n} from '../../types/build';\n\ntype TailwindCompile = typeof import('tailwindcss').compile;\ntype TailwindCompiler = Awaited<ReturnType<TailwindCompile>>;\ntype TailwindSource = TailwindCompiler['sources'][number];\n\ntype CompilerEntry = {\n\tcompiler: TailwindCompiler;\n\tcssPath: string;\n\tcssMtimeMs: number;\n\tsources: TailwindSource[];\n\t/* Every CSS file the compiler pulled in via @import (the input CSS\n\t itself plus anything it transitively loaded). If one of these changes,\n\t the parsed AST is stale and we have to rebuild the compiler — Tailwind\n\t only resolves imports once at compile() time. */\n\tcssDependencies: Map<string, number>;\n\t/* Ref-counted union of candidates across the whole source tree. We\n\t count rather than track presence so that a class still referenced by\n\t another file isn't dropped when it disappears from one. */\n\tcandidateCounts: Map<string, number>;\n\tperFileCandidates: Map<string, Set<string>>;\n\tlastEmittedHash: string | null;\n};\n\n/* Cache one compiler per absolute input-CSS path. Multiple entries are\n possible if a project ever wires more than one Tailwind input, though in\n practice there's usually just one. */\nconst compilerCache = new Map<string, CompilerEntry>();\n\nlet cachedTailwindCompile: TailwindCompile | null = null;\n\nconst loadTailwindCompile = async () => {\n\tif (cachedTailwindCompile) return cachedTailwindCompile;\n\ttry {\n\t\tconst mod = await import('tailwindcss');\n\n\t\tcachedTailwindCompile = mod.compile;\n\n\t\treturn mod.compile;\n\t} catch {\n\t\tthrow new Error(\n\t\t\t'Tailwind incremental dev compiler requires `tailwindcss` to be installed.'\n\t\t);\n\t}\n};\n\nconst recordDependency = async (deps: Map<string, number>, path: string) => {\n\ttry {\n\t\tconst mtime = (await stat(path)).mtimeMs;\n\t\tdeps.set(path, mtime);\n\t} catch {\n\t\tdeps.set(path, 0);\n\t}\n};\n\n/* Resolve a bare specifier (e.g. `tailwindcss`) to its CSS entry point.\n\n Bun's default resolver follows the `import` / `require` conditions and\n would hand back the package's JS entry (e.g. `tailwindcss/dist/lib.mjs`).\n Tailwind's `@import \"tailwindcss\"` is a *CSS* import — it needs the\n `style` exports condition (or a sensible fallback) instead.\n\n The strategy:\n 1. Resolve `<id>/package.json` to find the package directory.\n 2. Look at `exports[\".\"].style` — Tailwind v4 sets this; it's the\n modern way to expose a CSS entry from a package.\n 3. Fall back to the legacy top-level `style` field.\n 4. Fall back to common file conventions (`index.css`, `dist/index.css`).\n\n Anything not in that shape (subpath imports like `tailwindcss/preflight`)\n falls through to Bun's regular resolver, which handles `.css` subpaths\n correctly. */\nconst resolveBareCssImport = (id: string, base: string) => {\n\tconst slashIndex = id.indexOf('/');\n\tconst pkgName = id.startsWith('@')\n\t\t? id.split('/').slice(0, 2).join('/')\n\t\t: slashIndex === -1\n\t\t\t? id\n\t\t\t: id.slice(0, slashIndex);\n\tconst subpath = id.slice(pkgName.length);\n\n\tif (subpath !== '') {\n\t\treturn Bun.resolveSync(id, base);\n\t}\n\n\tlet pkgJsonPath: string;\n\ttry {\n\t\tpkgJsonPath = Bun.resolveSync(`${pkgName}/package.json`, base);\n\t} catch {\n\t\treturn Bun.resolveSync(id, base);\n\t}\n\n\tconst pkgDir = dirname(pkgJsonPath);\n\tlet pkg: Record<string, unknown> = {};\n\ttry {\n\t\tpkg = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));\n\t} catch {\n\t\treturn Bun.resolveSync(id, base);\n\t}\n\n\tconst exportsField = pkg.exports as\n\t\t| { '.'?: { style?: string } }\n\t\t| undefined;\n\tconst styleFromExports = exportsField?.['.']?.style;\n\tconst candidates = [\n\t\tstyleFromExports,\n\t\ttypeof pkg.style === 'string' ? pkg.style : undefined,\n\t\t'index.css',\n\t\t'dist/index.css'\n\t].filter((entry): entry is string => typeof entry === 'string');\n\n\tfor (const candidate of candidates) {\n\t\tconst candidatePath = resolve(pkgDir, candidate);\n\t\tif (existsSync(candidatePath)) return candidatePath;\n\t}\n\n\treturn Bun.resolveSync(id, base);\n};\n\n/* Resolve `@import` and `@source` paths relative to the importing file.\n The factory closes over the dependency map so every imported stylesheet\n is tracked for change detection. */\nconst createLoadStylesheet =\n\t(deps: Map<string, number>) => async (id: string, base: string) => {\n\t\tconst path =\n\t\t\tid.startsWith('.') || isAbsolute(id)\n\t\t\t\t? resolve(base, id)\n\t\t\t\t: resolveBareCssImport(id, base);\n\t\tconst content = await readFile(path, 'utf-8');\n\t\tawait recordDependency(deps, path);\n\n\t\treturn { base: dirname(path), content, path };\n\t};\n\nconst loadModule = async (\n\tid: string,\n\tbase: string,\n\t_kind: 'plugin' | 'config'\n) => {\n\tconst path =\n\t\tid.startsWith('.') || isAbsolute(id)\n\t\t\t? resolve(base, id)\n\t\t\t: Bun.resolveSync(id, base);\n\tconst module = await import(path);\n\n\treturn { base: dirname(path), module, path };\n};\n\nconst buildCompilerEntry = async (cssPath: string): Promise<CompilerEntry> => {\n\tconst compile = await loadTailwindCompile();\n\tconst absPath = resolve(cssPath);\n\tconst css = await readFile(absPath, 'utf-8');\n\tconst cssMtimeMs = (await stat(absPath)).mtimeMs;\n\tconst cssDependencies = new Map<string, number>();\n\tcssDependencies.set(absPath, cssMtimeMs);\n\tconst compiler = await compile(css, {\n\t\tbase: dirname(absPath),\n\t\tloadModule,\n\t\tloadStylesheet: createLoadStylesheet(cssDependencies)\n\t});\n\n\treturn {\n\t\tcandidateCounts: new Map<string, number>(),\n\t\tcompiler,\n\t\tcssDependencies,\n\t\tcssMtimeMs,\n\t\tcssPath: absPath,\n\t\tlastEmittedHash: null,\n\t\tperFileCandidates: new Map(),\n\t\tsources: [...compiler.sources]\n\t};\n};\n\n/* Permissive candidate extractor — matches anything that *could* be a\n Tailwind utility class. The compiler discards inputs that don't resolve\n to real utilities, so a superset is fine.\n\n The class character set covers v4 syntax including:\n - variants : `hover:`, `dark:`, `md:`, `data-[open]:`\n - modifiers : `text-blue/50`\n - arbitraries: `bg-[var(--c)]`, `min-h-[260px]`, `bg-[#fff]`\n - negation : `-mx-4`, `!important`\n - groups : `group-hover:opacity-50`\n\n Tokens must start with a letter / `-` / `!` (so we don't pull in pure\n numbers) and end with a word char or `]` or `)` (so we don't include\n trailing punctuation). */\nconst CANDIDATE_PATTERN = /[A-Za-z!\\-_][\\w:\\-/[\\]().!,#%@&'\"=]*[\\w\\])]/g;\n\nexport const extractCandidates = (source: string) => {\n\tconst out = new Set<string>();\n\tfor (const match of source.matchAll(CANDIDATE_PATTERN)) {\n\t\tout.add(match[0]);\n\t}\n\n\treturn out;\n};\n\nconst hashCss = (css: string) => createHash('sha1').update(css).digest('hex');\n\n// Match a file path against a Tailwind `@source` pattern.\n//\n// Tailwind hands us sources as { base, pattern, negated } where pattern\n// is interpreted relative to base and may contain `..` segments to walk\n// up the tree. `path.resolve(base, pattern)` collapses the `..` while\n// leaving the glob metacharacters intact, giving us an absolute glob\n// pattern that we can match against the absolute file path directly —\n// no prefix-and-substring dance, no glob-aware path walking.\nconst fileMatchesSources = (file: string, sources: TailwindSource[]) => {\n\tif (sources.length === 0) return true;\n\tconst absFile = resolve(file);\n\tfor (const source of sources) {\n\t\tif (source.negated) continue;\n\t\tconst absolutePattern = resolve(source.base, source.pattern);\n\t\tconst glob = new Bun.Glob(absolutePattern);\n\t\tif (glob.match(absFile)) return true;\n\t}\n\n\treturn false;\n};\n\nconst incrementCandidateCount = (entry: CompilerEntry, candidate: string) => {\n\tconst current = entry.candidateCounts.get(candidate) ?? 0;\n\tentry.candidateCounts.set(candidate, current + 1);\n};\n\nconst decrementCandidateCount = (entry: CompilerEntry, candidate: string) => {\n\tconst current = entry.candidateCounts.get(candidate) ?? 0;\n\tconst next = current - 1;\n\tif (next <= 0) {\n\t\tentry.candidateCounts.delete(candidate);\n\n\t\treturn;\n\t}\n\tentry.candidateCounts.set(candidate, next);\n};\n\nconst replaceFileCandidates = (\n\tentry: CompilerEntry,\n\tfile: string,\n\tfreshCandidates: Set<string>\n) => {\n\tconst previous = entry.perFileCandidates.get(file);\n\tif (previous) {\n\t\tfor (const candidate of previous)\n\t\t\tdecrementCandidateCount(entry, candidate);\n\t}\n\tentry.perFileCandidates.set(file, freshCandidates);\n\tfor (const candidate of freshCandidates)\n\t\tincrementCandidateCount(entry, candidate);\n};\n\n// Split an absolute glob like /abs/src/frontend/<glob> into a literal\n// scan root (/abs/src/frontend) and a relative glob portion. Bun.Glob.scan\n// needs a real directory as `cwd`; passing a glob there silently scans\n// nothing.\nconst splitGlobAtFirstMeta = (absolutePattern: string) => {\n\tconst firstMetaIndex = absolutePattern.search(/[*?{[]/);\n\tif (firstMetaIndex === -1) {\n\t\treturn { glob: '', root: absolutePattern };\n\t}\n\tconst lastSlashBeforeMeta = absolutePattern.lastIndexOf(\n\t\t'/',\n\t\tfirstMetaIndex\n\t);\n\n\treturn {\n\t\tglob: absolutePattern.slice(lastSlashBeforeMeta + 1),\n\t\troot: absolutePattern.slice(0, lastSlashBeforeMeta) || '/'\n\t};\n};\n\nconst collectFilesForSources = async (sources: TailwindSource[]) => {\n\tconst seen = new Set<string>();\n\tconst collected: string[] = [];\n\tconst scans = sources\n\t\t.filter((source) => !source.negated)\n\t\t.map(async (source) => {\n\t\t\tconst absolutePattern = resolve(source.base, source.pattern);\n\t\t\tconst { glob: relativePattern, root } =\n\t\t\t\tsplitGlobAtFirstMeta(absolutePattern);\n\t\t\tif (!relativePattern) return [];\n\t\t\tconst glob = new Bun.Glob(relativePattern);\n\t\t\tconst matches: string[] = [];\n\t\t\tfor await (const relative of glob.scan({\n\t\t\t\tabsolute: false,\n\t\t\t\tcwd: root,\n\t\t\t\tonlyFiles: true\n\t\t\t})) {\n\t\t\t\tmatches.push(resolve(root, relative));\n\t\t\t}\n\n\t\t\treturn matches;\n\t\t});\n\tconst results = await Promise.all(scans);\n\tfor (const absolute of results.flat()) {\n\t\tif (seen.has(absolute)) continue;\n\t\tseen.add(absolute);\n\t\tcollected.push(absolute);\n\t}\n\n\treturn collected;\n};\n\nconst ingestFile = async (entry: CompilerEntry, absolute: string) => {\n\ttry {\n\t\tconst text = await readFile(absolute, 'utf-8');\n\t\treplaceFileCandidates(entry, absolute, extractCandidates(text));\n\t} catch {\n\t\t// File vanished between glob and read — skip silently.\n\t}\n};\n\nconst populateCandidatesFromAllSources = async (entry: CompilerEntry) => {\n\tconst files = await collectFilesForSources(entry.sources);\n\tawait Promise.all(files.map((file) => ingestFile(entry, file)));\n};\n\nconst isCompilerStale = async (entry: CompilerEntry) => {\n\tconst checks = [...entry.cssDependencies.entries()].map(\n\t\tasync ([path, knownMtime]) => {\n\t\t\ttry {\n\t\t\t\tconst mtime = (await stat(path)).mtimeMs;\n\n\t\t\t\treturn mtime !== knownMtime;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t);\n\tconst results = await Promise.all(checks);\n\n\treturn results.some(Boolean);\n};\n\nconst getCompilerEntry = async (cssPath: string) => {\n\tconst key = resolve(cssPath);\n\tconst cached = compilerCache.get(key);\n\tif (cached && !(await isCompilerStale(cached))) return cached;\n\n\tconst fresh = await buildCompilerEntry(cssPath);\n\tawait populateCandidatesFromAllSources(fresh);\n\tcompilerCache.set(key, fresh);\n\n\treturn fresh;\n};\n\n/* Drop the cached compiler — used when the dev server stops or the\n Tailwind input CSS itself changes and needs a full re-parse. */\nexport const disposeTailwindCompiler = (cssPath?: string) => {\n\tif (!cssPath) {\n\t\tcompilerCache.clear();\n\n\t\treturn;\n\t}\n\tcompilerCache.delete(resolve(cssPath));\n};\n\n/* Run a fast incremental Tailwind build. Returns whether the emitted CSS\n actually changed — callers can use that to skip the broadcast. */\nexport const incrementalTailwindBuild = async (\n\ttailwind: TailwindConfig,\n\tbuildPath: string,\n\tchangedFiles: string[],\n\tstyleTransformConfig?: StylePreprocessorConfig\n) => {\n\tconst startedAt = performance.now();\n\tconst entry = await getCompilerEntry(tailwind.input);\n\tconst inputAbs = entry.cssPath;\n\tconst filesToRescan: string[] = [];\n\n\tfor (const file of changedFiles) {\n\t\tconst abs = resolve(file);\n\t\tif (abs === inputAbs) continue;\n\t\tif (!fileMatchesSources(abs, entry.sources)) continue;\n\t\tfilesToRescan.push(abs);\n\t}\n\n\tawait Promise.all(filesToRescan.map((file) => ingestFile(entry, file)));\n\n\tconst rawCss = entry.compiler.build([...entry.candidateCounts.keys()]);\n\tconst outputPath = resolve(buildPath, tailwind.output);\n\tconst finalCss = await compileStyleSource(\n\t\toutputPath,\n\t\trawCss,\n\t\t'css',\n\t\tstyleTransformConfig\n\t);\n\tconst hash = hashCss(finalCss);\n\tconst durationMs = performance.now() - startedAt;\n\n\tif (hash === entry.lastEmittedHash) {\n\t\treturn { cssChanged: false, durationMs };\n\t}\n\n\tawait Bun.write(outputPath, finalCss);\n\tentry.lastEmittedHash = hash;\n\n\treturn { cssChanged: true, durationMs };\n};\n\n/* Pre-build the compiler at dev startup so the first HMR tick doesn't\n pay the parse-and-scan cost. Safe to call multiple times — it's a no-op\n once cached. */\nexport const warmTailwindCompiler = async (tailwind: TailwindConfig) => {\n\tawait getCompilerEntry(tailwind.input);\n};\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;AAmBA;AACA;AACA;AACA;AAgCA,IAAM,gBAAgB,IAAI;AAE1B,IAAI,wBAAgD;AAEpD,IAAM,sBAAsB,YAAY;AAAA,EACvC,IAAI;AAAA,IAAuB,OAAO;AAAA,EAClC,IAAI;AAAA,IACH,MAAM,MAAM,MAAa;AAAA,IAEzB,wBAAwB,IAAI;AAAA,IAE5B,OAAO,IAAI;AAAA,IACV,MAAM;AAAA,IACP,MAAM,IAAI,MACT,2EACD;AAAA;AAAA;AAIF,IAAM,mBAAmB,OAAO,MAA2B,SAAiB;AAAA,EAC3E,IAAI;AAAA,IACH,MAAM,SAAS,MAAM,KAAK,IAAI,GAAG;AAAA,IACjC,KAAK,IAAI,MAAM,KAAK;AAAA,IACnB,MAAM;AAAA,IACP,KAAK,IAAI,MAAM,CAAC;AAAA;AAAA;AAqBlB,IAAM,uBAAuB,CAAC,IAAY,SAAiB;AAAA,EAC1D,MAAM,aAAa,GAAG,QAAQ,GAAG;AAAA,EACjC,MAAM,UAAU,GAAG,WAAW,GAAG,IAC9B,GAAG,MAAM,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,IAClC,eAAe,KACd,KACA,GAAG,MAAM,GAAG,UAAU;AAAA,EAC1B,MAAM,UAAU,GAAG,MAAM,QAAQ,MAAM;AAAA,EAEvC,IAAI,YAAY,IAAI;AAAA,IACnB,OAAO,IAAI,YAAY,IAAI,IAAI;AAAA,EAChC;AAAA,EAEA,IAAI;AAAA,EACJ,IAAI;AAAA,IACH,cAAc,IAAI,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C,cAAc,KAAK,GAAG;AAAA,EACvB;AAAA,EAEA,MAAM,QAAQ,IAAI,cAAc,IAAI,CAAC,SAAS,WAAW,OAAO,IAAI,CAAC,CAAC;AAAA,EAEtE,MAAM,SAAS,MAAM,SAAS,MAAM,CAAC,GAAG,MAAM,gBAAgB,KAAK,CAAC,CAAC;AAAA,EACrE,MAAM,aAAa,QAAQ,WAAW,SAAS,MAAM;AAAA,EACrD,MAAM,WAAW,MAAM,mBACtB,YACA,QACA,OACA,oBACD;AAAA,EACA,MAAM,OAAO,QAAQ,QAAQ;AAAA,EAC7B,MAAM,aAAa,YAAY,IAAI,IAAI;AAAA,EAEvC,IAAI,SAAS,MAAM,iBAAiB;AAAA,IACnC,OAAO,EAAE,YAAY,OAAO,WAAW;AAAA,EACxC;AAAA,EAEA,MAAM,IAAI,MAAM,YAAY,QAAQ;AAAA,EACpC,MAAM,kBAAkB;AAAA,EAExB,OAAO,EAAE,YAAY,MAAM,WAAW;AAAA;AAMhC,IAAM,uBAAuB,OAAO,aAA6B;AAAA,EACvE,MAAM,iBAAiB,SAAS,KAAK;AAAA;",
8
+ "debugId": "98DF22AA58613E2464756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,36 @@
1
+ // @bun
2
+ // src/angular/resolveAngularPackage.ts
3
+ import { existsSync, readFileSync } from "fs";
4
+ import { join, resolve } from "path";
5
+ var resolveAngularPackageDir = (specifier) => {
6
+ const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
7
+ if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
8
+ return fromCompiledRuntime;
9
+ }
10
+ const fromProject = resolve(process.cwd(), "node_modules", specifier);
11
+ if (existsSync(fromProject)) {
12
+ return fromProject;
13
+ }
14
+ return null;
15
+ };
16
+ var resolvePackageEntry = (packageDir) => {
17
+ try {
18
+ const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
19
+ const rootExport = pkg.exports?.["."];
20
+ const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
21
+ return join(packageDir, entry);
22
+ } catch {
23
+ return packageDir;
24
+ }
25
+ };
26
+ var resolveAngularPackage = (specifier) => {
27
+ const packageDir = resolveAngularPackageDir(specifier);
28
+ if (packageDir)
29
+ return resolvePackageEntry(packageDir);
30
+ return specifier;
31
+ };
32
+
33
+ export { resolveAngularPackageDir, resolveAngularPackage };
34
+
35
+ //# debugId=4D760CD85FA2904D64756E2164756E21
36
+ //# sourceMappingURL=chunk-kvq01j35.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/angular/resolveAngularPackage.ts"],
4
+ "sourcesContent": [
5
+ "import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\n/**\n * Resolve Angular package paths from the compiled runtime node_modules first,\n * then the app's process.cwd()/node_modules, falling back to the bare specifier.\n * This prevents Bun's baked import.meta.dir from resolving Angular packages\n * from the absolutejs source tree instead of the consumer's project when\n * running from a published npm package.\n */\nexport const resolveAngularPackageDir = (specifier: string) => {\n\tconst fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR\n\t\t? resolve(process.env.ABSOLUTE_BUILD_DIR, 'node_modules', specifier)\n\t\t: null;\n\tif (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {\n\t\treturn fromCompiledRuntime;\n\t}\n\n\tconst fromProject = resolve(process.cwd(), 'node_modules', specifier);\n\n\tif (existsSync(fromProject)) {\n\t\treturn fromProject;\n\t}\n\n\treturn null;\n};\n\nconst resolvePackageEntry = (packageDir: string) => {\n\ttry {\n\t\tconst pkg = JSON.parse(\n\t\t\treadFileSync(join(packageDir, 'package.json'), 'utf-8')\n\t\t);\n\t\tconst rootExport = pkg.exports?.['.'];\n\t\tconst entry =\n\t\t\t(typeof rootExport === 'string'\n\t\t\t\t? rootExport\n\t\t\t\t: rootExport?.default) ??\n\t\t\tpkg.module ??\n\t\t\tpkg.main ??\n\t\t\t'index.js';\n\n\t\treturn join(packageDir, entry);\n\t} catch {\n\t\treturn packageDir;\n\t}\n};\n\nexport const resolveAngularPackage = (specifier: string) => {\n\tconst packageDir = resolveAngularPackageDir(specifier);\n\tif (packageDir) return resolvePackageEntry(packageDir);\n\n\treturn specifier;\n};\n"
6
+ ],
7
+ "mappings": ";;AAAA;AACA;AASO,IAAM,2BAA2B,CAAC,cAAsB;AAAA,EAC9D,MAAM,sBAAsB,QAAQ,IAAI,qBACrC,QAAQ,QAAQ,IAAI,oBAAoB,gBAAgB,SAAS,IACjE;AAAA,EACH,IAAI,uBAAuB,WAAW,mBAAmB,GAAG;AAAA,IAC3D,OAAO;AAAA,EACR;AAAA,EAEA,MAAM,cAAc,QAAQ,QAAQ,IAAI,GAAG,gBAAgB,SAAS;AAAA,EAEpE,IAAI,WAAW,WAAW,GAAG;AAAA,IAC5B,OAAO;AAAA,EACR;AAAA,EAEA,OAAO;AAAA;AAGR,IAAM,sBAAsB,CAAC,eAAuB;AAAA,EACnD,IAAI;AAAA,IACH,MAAM,MAAM,KAAK,MAChB,aAAa,KAAK,YAAY,cAAc,GAAG,OAAO,CACvD;AAAA,IACA,MAAM,aAAa,IAAI,UAAU;AAAA,IACjC,MAAM,SACJ,OAAO,eAAe,WACpB,aACA,YAAY,YACf,IAAI,UACJ,IAAI,QACJ;AAAA,IAED,OAAO,KAAK,YAAY,KAAK;AAAA,IAC5B,MAAM;AAAA,IACP,OAAO;AAAA;AAAA;AAIF,IAAM,wBAAwB,CAAC,cAAsB;AAAA,EAC3D,MAAM,aAAa,yBAAyB,SAAS;AAAA,EACrD,IAAI;AAAA,IAAY,OAAO,oBAAoB,UAAU;AAAA,EAErD,OAAO;AAAA;",
8
+ "debugId": "4D760CD85FA2904D64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,60 @@
1
+ // @bun
2
+ // src/build/resolvePackageImport.ts
3
+ import { resolve, join } from "path";
4
+ import { existsSync, readFileSync } from "fs";
5
+ var resolveExportPath = (entry, conditions) => {
6
+ if (typeof entry === "string")
7
+ return entry;
8
+ if (!entry || typeof entry !== "object")
9
+ return null;
10
+ for (const condition of conditions) {
11
+ const target = Reflect.get(entry, condition);
12
+ if (typeof target === "string") {
13
+ return target;
14
+ }
15
+ }
16
+ return null;
17
+ };
18
+ var resolvePackageImport = (specifier, conditions = ["import"]) => {
19
+ if (specifier.startsWith(".") || specifier.startsWith("/"))
20
+ return null;
21
+ const parts = specifier.split("/");
22
+ const isScoped = specifier.startsWith("@");
23
+ const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
24
+ const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
25
+ const exportKey = subpath ? `./${subpath}` : ".";
26
+ const currentPackageJsonPath = resolve(process.cwd(), "package.json");
27
+ const currentPackageJson = existsSync(currentPackageJsonPath) ? JSON.parse(readFileSync(currentPackageJsonPath, "utf-8")) : null;
28
+ const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
29
+ const packageDir = currentPackageDir ?? resolve(process.cwd(), "node_modules", packageName ?? "");
30
+ const packageJsonPath = join(packageDir, "package.json");
31
+ if (!existsSync(packageJsonPath))
32
+ return null;
33
+ try {
34
+ const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(readFileSync(packageJsonPath, "utf-8"));
35
+ const { exports } = packageJson;
36
+ if (!exports)
37
+ return null;
38
+ const entry = exports[exportKey];
39
+ if (!entry)
40
+ return null;
41
+ const importPath = resolveExportPath(entry, conditions);
42
+ if (!importPath)
43
+ return null;
44
+ if (currentPackageDir && importPath.startsWith("./dist/")) {
45
+ const sourceCandidate = resolve(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
46
+ if (existsSync(sourceCandidate)) {
47
+ return sourceCandidate;
48
+ }
49
+ }
50
+ const resolved = resolve(packageDir, importPath);
51
+ return existsSync(resolved) ? resolved : null;
52
+ } catch {
53
+ return null;
54
+ }
55
+ };
56
+
57
+ export { resolvePackageImport };
58
+
59
+ //# debugId=A916F1CE5206C7E864756E2164756E21
60
+ //# sourceMappingURL=chunk-mbazhahf.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/build/resolvePackageImport.ts"],
4
+ "sourcesContent": [
5
+ "import { resolve, join } from 'node:path';\nimport { existsSync, readFileSync } from 'node:fs';\n\n/**\n * Resolve a bare module import (e.g. \"@absolutejs/absolute/svelte/components/Image.svelte\")\n * to an absolute file path by reading the package's exports map in package.json.\n *\n * Returns the resolved absolute path, or null if the import can't be resolved.\n */\ntype ExportConditions = 'browser' | 'import';\n\nconst resolveExportPath = (\n\tentry: unknown,\n\tconditions: ExportConditions[]\n) => {\n\tif (typeof entry === 'string') return entry;\n\tif (!entry || typeof entry !== 'object') return null;\n\n\tfor (const condition of conditions) {\n\t\tconst target = Reflect.get(entry, condition);\n\t\tif (typeof target === 'string') {\n\t\t\treturn target;\n\t\t}\n\t}\n\n\treturn null;\n};\n\nexport const resolvePackageImport = (\n\tspecifier: string,\n\tconditions: ExportConditions[] = ['import']\n) => {\n\t// Only handle bare module imports (not relative or absolute paths)\n\tif (specifier.startsWith('.') || specifier.startsWith('/')) return null;\n\n\t// Split into package name and subpath\n\tconst parts = specifier.split('/');\n\tconst isScoped = specifier.startsWith('@');\n\tconst packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];\n\tconst subpath = isScoped ? parts.slice(2).join('/') : parts.slice(1).join('/');\n\tconst exportKey = subpath ? `./${subpath}` : '.';\n\n\tconst currentPackageJsonPath = resolve(process.cwd(), 'package.json');\n\tconst currentPackageJson = existsSync(currentPackageJsonPath)\n\t\t? JSON.parse(readFileSync(currentPackageJsonPath, 'utf-8'))\n\t\t: null;\n\tconst currentPackageDir =\n\t\tcurrentPackageJson?.name === packageName ? process.cwd() : null;\n\tconst packageDir =\n\t\tcurrentPackageDir ?? resolve(process.cwd(), 'node_modules', packageName ?? '');\n\tconst packageJsonPath = join(packageDir, 'package.json');\n\n\tif (!existsSync(packageJsonPath)) return null;\n\n\ttry {\n\t\tconst packageJson =\n\t\t\tcurrentPackageDir && currentPackageJson\n\t\t\t\t? currentPackageJson\n\t\t\t\t: JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\tconst {exports} = packageJson;\n\n\t\tif (!exports) return null;\n\n\t\t// Try exact match first, then try without extension for .svelte/.vue files\n\t\tconst entry = exports[exportKey];\n\n\t\tif (!entry) return null;\n\n\t\tconst importPath = resolveExportPath(entry, conditions);\n\n\t\tif (!importPath) return null;\n\n\t\tif (currentPackageDir && importPath.startsWith('./dist/')) {\n\t\t\tconst sourceCandidate = resolve(\n\t\t\t\tpackageDir,\n\t\t\t\timportPath.replace(/^\\.\\/dist\\//, './src/')\n\t\t\t);\n\t\t\tif (existsSync(sourceCandidate)) {\n\t\t\t\treturn sourceCandidate;\n\t\t\t}\n\t\t}\n\n\t\tconst resolved = resolve(packageDir, importPath);\n\n\t\treturn existsSync(resolved) ? resolved : null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n"
6
+ ],
7
+ "mappings": ";;AAAA;AACA;AAUA,IAAM,oBAAoB,CACzB,OACA,eACI;AAAA,EACJ,IAAI,OAAO,UAAU;AAAA,IAAU,OAAO;AAAA,EACtC,IAAI,CAAC,SAAS,OAAO,UAAU;AAAA,IAAU,OAAO;AAAA,EAEhD,WAAW,aAAa,YAAY;AAAA,IACnC,MAAM,SAAS,QAAQ,IAAI,OAAO,SAAS;AAAA,IAC3C,IAAI,OAAO,WAAW,UAAU;AAAA,MAC/B,OAAO;AAAA,IACR;AAAA,EACD;AAAA,EAEA,OAAO;AAAA;AAGD,IAAM,uBAAuB,CACnC,WACA,aAAiC,CAAC,QAAQ,MACtC;AAAA,EAEJ,IAAI,UAAU,WAAW,GAAG,KAAK,UAAU,WAAW,GAAG;AAAA,IAAG,OAAO;AAAA,EAGnE,MAAM,QAAQ,UAAU,MAAM,GAAG;AAAA,E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C,OAAO,WAAW,QAAQ,IAAI,WAAW;AAAA,IACxC,MAAM;AAAA,IACP,OAAO;AAAA;AAAA;",
8
+ "debugId": "A916F1CE5206C7E864756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,15 @@
1
+ // @bun
2
+ import {
3
+ devtoolsJson,
4
+ normalizeDevtoolsWorkspaceRoot,
5
+ resolveDevtoolsUuidCachePath
6
+ } from "./chunk-xx5b6b9m.js";
7
+ import"./chunk-bmgqm774.js";
8
+ export {
9
+ resolveDevtoolsUuidCachePath,
10
+ normalizeDevtoolsWorkspaceRoot,
11
+ devtoolsJson
12
+ };
13
+
14
+ //# debugId=1D1F01D69CD9200664756E2164756E21
15
+ //# sourceMappingURL=chunk-mgfwq18r.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "1D1F01D69CD9200664756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,88 @@
1
+ // @bun
2
+ // src/core/devRouteRegistrationCallsite.ts
3
+ import { AsyncLocalStorage } from "async_hooks";
4
+ import { Elysia } from "elysia";
5
+ var ROUTE_CALLSITE_STORAGE_KEY = Symbol.for("absolutejs.devRouteRegistrationCallsiteStorage");
6
+ var ROUTE_CALLSITE_PATCHED_KEY = Symbol.for("absolutejs.devRouteRegistrationCallsitePatched");
7
+ var ROUTE_METHOD_NAMES = [
8
+ "all",
9
+ "delete",
10
+ "get",
11
+ "head",
12
+ "options",
13
+ "patch",
14
+ "post",
15
+ "put"
16
+ ];
17
+ var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
18
+ var isAsyncLocalStorage = (value) => isObjectRecord(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
19
+ var isRouteMethod = (value) => typeof value === "function";
20
+ var getRouteCallsiteStorage = () => {
21
+ const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
22
+ if (value === null || typeof value === "undefined") {
23
+ return;
24
+ }
25
+ return isAsyncLocalStorage(value) ? value : undefined;
26
+ };
27
+ var ensureRouteCallsiteStorage = () => {
28
+ const existing = getRouteCallsiteStorage();
29
+ if (existing) {
30
+ return existing;
31
+ }
32
+ const storage = new AsyncLocalStorage;
33
+ Reflect.set(globalThis, ROUTE_CALLSITE_STORAGE_KEY, storage);
34
+ return storage;
35
+ };
36
+ var normalizeCallsitePath = (value) => value.replace(`${process.cwd()}/`, "").replace(process.cwd(), "").replace(/^\.\/+/, "");
37
+ var shouldIgnoreRouteCallsiteFrame = (frame) => frame.includes("/node_modules/") || frame.includes("/dist/") || frame.includes("/src/core/devRouteRegistrationCallsite.");
38
+ var getRouteCallsiteLocation = (frame) => frame.match(/\((\/[^)]+:\d+:\d+)\)$/)?.[1] ?? frame.match(/at (\/[^ ]+:\d+:\d+)$/)?.[1];
39
+ var extractRouteRegistrationCallsite = (stack) => {
40
+ const location = stack.split(`
41
+ `).slice(1).map((line) => line.trim()).filter((frame) => !shouldIgnoreRouteCallsiteFrame(frame)).map((frame) => getRouteCallsiteLocation(frame)).find((frameLocation) => frameLocation !== undefined);
42
+ return location ? normalizeCallsitePath(location) : undefined;
43
+ };
44
+ var captureRouteRegistrationCallsite = () => {
45
+ const { stack } = new Error;
46
+ if (!stack) {
47
+ return;
48
+ }
49
+ return extractRouteRegistrationCallsite(stack);
50
+ };
51
+ var wrapRouteHandlerWithCallsite = (handler, callsite) => {
52
+ if (typeof handler !== "function" || !callsite) {
53
+ return handler;
54
+ }
55
+ const storage = ensureRouteCallsiteStorage();
56
+ const routeHandler = handler;
57
+ return function wrappedRouteHandler(...args) {
58
+ return storage.run({ callsite }, () => Reflect.apply(routeHandler, this, args));
59
+ };
60
+ };
61
+ var createPatchedRouteMethod = (originalMethod) => function patchedRouteMethod(path, handler, ...rest) {
62
+ const callsite = captureRouteRegistrationCallsite();
63
+ return Reflect.apply(originalMethod, this, [
64
+ path,
65
+ wrapRouteHandlerWithCallsite(handler, callsite),
66
+ ...rest
67
+ ]);
68
+ };
69
+ var getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite;
70
+ var patchElysiaRouteRegistrationCallsites = () => {
71
+ if (false) {}
72
+ if (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {
73
+ return;
74
+ }
75
+ const { prototype } = Elysia;
76
+ ROUTE_METHOD_NAMES.forEach((methodName) => {
77
+ const originalMethod = Reflect.get(prototype, methodName);
78
+ if (!isRouteMethod(originalMethod))
79
+ return;
80
+ Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod));
81
+ });
82
+ Reflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);
83
+ };
84
+
85
+ export { getCurrentRouteRegistrationCallsite, patchElysiaRouteRegistrationCallsites };
86
+
87
+ //# debugId=4B6B614F7C6043D164756E2164756E21
88
+ //# sourceMappingURL=chunk-mtgf69xn.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/core/devRouteRegistrationCallsite.ts"],
4
+ "sourcesContent": [
5
+ "import { AsyncLocalStorage } from 'node:async_hooks';\nimport { Elysia } from 'elysia';\n\ntype RouteCallsiteStore = { callsite?: string };\ntype RouteCallsiteStorage = AsyncLocalStorage<RouteCallsiteStore>;\ntype RouteMethod = (this: unknown, ...args: unknown[]) => unknown;\n\nconst ROUTE_CALLSITE_STORAGE_KEY = Symbol.for(\n\t'absolutejs.devRouteRegistrationCallsiteStorage'\n);\nconst ROUTE_CALLSITE_PATCHED_KEY = Symbol.for(\n\t'absolutejs.devRouteRegistrationCallsitePatched'\n);\n\nconst ROUTE_METHOD_NAMES = [\n\t'all',\n\t'delete',\n\t'get',\n\t'head',\n\t'options',\n\t'patch',\n\t'post',\n\t'put'\n] as const;\n\nconst isObjectRecord = (value: unknown): value is Record<string, unknown> =>\n\tBoolean(value) && typeof value === 'object';\n\nconst isAsyncLocalStorage = (value: unknown): value is RouteCallsiteStorage =>\n\tisObjectRecord(value) &&\n\t'getStore' in value &&\n\ttypeof value.getStore === 'function' &&\n\t'run' in value &&\n\ttypeof value.run === 'function';\n\nconst isRouteMethod = (value: unknown): value is RouteMethod =>\n\ttypeof value === 'function';\n\nconst getRouteCallsiteStorage = () => {\n\tconst value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);\n\tif (value === null || typeof value === 'undefined') {\n\t\treturn undefined;\n\t}\n\n\treturn isAsyncLocalStorage(value) ? value : undefined;\n};\n\nconst ensureRouteCallsiteStorage = () => {\n\tconst existing = getRouteCallsiteStorage();\n\tif (existing) {\n\t\treturn existing;\n\t}\n\n\tconst storage = new AsyncLocalStorage<RouteCallsiteStore>();\n\tReflect.set(globalThis, ROUTE_CALLSITE_STORAGE_KEY, storage);\n\n\treturn storage;\n};\n\nconst normalizeCallsitePath = (value: string) =>\n\tvalue\n\t\t.replace(`${process.cwd()}/`, '')\n\t\t.replace(process.cwd(), '')\n\t\t.replace(/^\\.\\/+/, '');\n\nconst shouldIgnoreRouteCallsiteFrame = (frame: string) =>\n\tframe.includes('/node_modules/') ||\n\tframe.includes('/dist/') ||\n\tframe.includes('/src/core/devRouteRegistrationCallsite.');\n\nconst getRouteCallsiteLocation = (frame: string) =>\n\tframe.match(/\\((\\/[^)]+:\\d+:\\d+)\\)$/)?.[1] ??\n\tframe.match(/at (\\/[^ ]+:\\d+:\\d+)$/)?.[1];\n\nconst extractRouteRegistrationCallsite = (stack: string) => {\n\tconst location = stack\n\t\t.split('\\n')\n\t\t.slice(1)\n\t\t.map((line) => line.trim())\n\t\t.filter((frame) => !shouldIgnoreRouteCallsiteFrame(frame))\n\t\t.map((frame) => getRouteCallsiteLocation(frame))\n\t\t.find((frameLocation) => frameLocation !== undefined);\n\n\treturn location ? normalizeCallsitePath(location) : undefined;\n};\n\nconst captureRouteRegistrationCallsite = () => {\n\tconst { stack } = new Error();\n\tif (!stack) {\n\t\treturn undefined;\n\t}\n\n\treturn extractRouteRegistrationCallsite(stack);\n};\n\nconst wrapRouteHandlerWithCallsite = (handler: unknown, callsite?: string) => {\n\tif (typeof handler !== 'function' || !callsite) {\n\t\treturn handler;\n\t}\n\n\tconst storage = ensureRouteCallsiteStorage();\n\tconst routeHandler = handler;\n\n\treturn function wrappedRouteHandler(this: unknown, ...args: unknown[]) {\n\t\treturn storage.run({ callsite }, () =>\n\t\t\tReflect.apply(routeHandler, this, args)\n\t\t);\n\t};\n};\n\nconst createPatchedRouteMethod = (originalMethod: RouteMethod) =>\n\tfunction patchedRouteMethod(\n\t\tthis: unknown,\n\t\tpath: unknown,\n\t\thandler: unknown,\n\t\t...rest: unknown[]\n\t) {\n\t\tconst callsite = captureRouteRegistrationCallsite();\n\n\t\treturn Reflect.apply(originalMethod, this, [\n\t\t\tpath,\n\t\t\twrapRouteHandlerWithCallsite(handler, callsite),\n\t\t\t...rest\n\t\t]);\n\t};\n\nexport const getCurrentRouteRegistrationCallsite = () =>\n\tgetRouteCallsiteStorage()?.getStore()?.callsite;\nexport const patchElysiaRouteRegistrationCallsites = () => {\n\tif (process.env.NODE_ENV === 'production') {\n\t\treturn;\n\t}\n\n\tif (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {\n\t\treturn;\n\t}\n\n\tconst { prototype } = Elysia;\n\tROUTE_METHOD_NAMES.forEach((methodName) => {\n\t\tconst originalMethod = Reflect.get(prototype, methodName);\n\t\tif (!isRouteMethod(originalMethod)) return;\n\t\tReflect.set(\n\t\t\tprototype,\n\t\t\tmethodName,\n\t\t\tcreatePatchedRouteMethod(originalMethod)\n\t\t);\n\t});\n\n\tReflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);\n};\n"
6
+ ],
7
+ "mappings": ";;AAAA;AACA;AAMA,IAAM,6BAA6B,OAAO,IACzC,gDACD;AACA,IAAM,6BAA6B,OAAO,IACzC,gDACD;AAEA,IAAM,qBAAqB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,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