@fluentic/style 0.1.0-beta.3 → 0.1.0-beta.4

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 (281) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/atomic/className.ts +3 -9
  4. package/atomic/debug/className/className.ts +0 -15
  5. package/atomic/element.ts +1 -1
  6. package/atomic/rule.ts +2 -2
  7. package/atomic/scope.ts +19 -0
  8. package/atomic/theme.ts +41 -2
  9. package/atomic/token.ts +4 -3
  10. package/atomic/utils/{css.ts → cssIdent.ts} +0 -20
  11. package/atomic/utils/cssVar.ts +19 -0
  12. package/atomic/utils/debug.ts +1 -1
  13. package/builder/data/const.ts +1 -1
  14. package/builder/data/merge/style.ts +1 -1
  15. package/builder/extract/token.ts +30 -14
  16. package/builder/token/data.ts +30 -0
  17. package/builder/token/index.ts +3 -0
  18. package/builder/token/name.ts +54 -0
  19. package/builder/token/symbols.ts +6 -0
  20. package/compiler/transform/debug/plugin.ts +79 -1
  21. package/compiler/transform/evaluator/evaluator.ts +74 -26
  22. package/compiler/transform/extract/chain/chain.ts +1 -1
  23. package/compiler/transform/extract/utils/replacement.ts +6 -1
  24. package/compiler/transform/extract/utils/theme.ts +6 -6
  25. package/compiler/transform/syntax/static_ids.ts +1 -1
  26. package/config/build.ts +1 -8
  27. package/config/config/debug.ts +11 -0
  28. package/dialect/namedTokens.ts +22 -5
  29. package/dist/{className-CKo4TxuT.js → className-Do2Crx4b.js} +2 -3
  30. package/dist/{className-CKo4TxuT.js.map → className-Do2Crx4b.js.map} +1 -1
  31. package/dist/{style-91J0B5ef.js → combine-C9vjpKCs.js} +45 -304
  32. package/dist/combine-C9vjpKCs.js.map +1 -0
  33. package/dist/combineStyle-DwAhsOmS.js +26 -0
  34. package/dist/combineStyle-DwAhsOmS.js.map +1 -0
  35. package/dist/compiler/index.mjs +1 -1
  36. package/dist/{compiler-D5v5tJXI.mjs → compiler-CE0ZgkdH.mjs} +231 -84
  37. package/dist/compiler-CE0ZgkdH.mjs.map +1 -0
  38. package/dist/config/index.js +2 -2
  39. package/dist/config-BE5D5x2N.js +2 -0
  40. package/dist/{config-BEvP7108.js → config-BtANtGAh.js} +4 -6
  41. package/dist/config-BtANtGAh.js.map +1 -0
  42. package/dist/{config-FIfi5aJ8.js → config-CduqubI8.js} +8 -6
  43. package/dist/config-CduqubI8.js.map +1 -0
  44. package/dist/config-lJNLh7eM.js +6 -0
  45. package/dist/config-lJNLh7eM.js.map +1 -0
  46. package/dist/config-oKOjOTWi.js +7 -0
  47. package/dist/{config-OXHoDUIo.js.map → config-oKOjOTWi.js.map} +1 -1
  48. package/dist/{css-DcuJ_jSH.js → css-BewrRz3_.js} +3 -3
  49. package/dist/{css-DcuJ_jSH.js.map → css-BewrRz3_.js.map} +1 -1
  50. package/dist/{css-dPoZJDQH.js → css-CiTI58yl.js} +291 -4
  51. package/dist/css-CiTI58yl.js.map +1 -0
  52. package/dist/{global-zaCE-g1C.js → css-GtUPEO9U.js} +16 -3
  53. package/dist/css-GtUPEO9U.js.map +1 -0
  54. package/dist/{css-oOt6ZR54.js → css-Rc7ILf-3.js} +8 -9
  55. package/dist/{css-oOt6ZR54.js.map → css-Rc7ILf-3.js.map} +1 -1
  56. package/dist/css.js +1 -1
  57. package/dist/{css-CELBp6Gu.js → cssIdent-BsyUXNNk.js} +3 -23
  58. package/dist/cssIdent-BsyUXNNk.js.map +1 -0
  59. package/dist/cssVar-DGgQ2GIK.js +92 -0
  60. package/dist/cssVar-DGgQ2GIK.js.map +1 -0
  61. package/dist/{css_extra-DeTuIlcO.js → css_extra-BiG57TKN.js} +2 -2
  62. package/dist/{css_extra-DQdCrYoC.js.map → css_extra-BiG57TKN.js.map} +1 -1
  63. package/dist/{css_extra-DQdCrYoC.js → css_extra-DYtS3g6Z.js} +2 -2
  64. package/dist/{css_extra-DeTuIlcO.js.map → css_extra-DYtS3g6Z.js.map} +1 -1
  65. package/dist/{data-CeYstKMP.js → data-D7NFt4JG.js} +205 -10
  66. package/dist/data-D7NFt4JG.js.map +1 -0
  67. package/dist/{debug-D96KGgpH.js → debug-Cvpo5cVu.js} +4 -3
  68. package/dist/{debug-D96KGgpH.js.map → debug-Cvpo5cVu.js.map} +1 -1
  69. package/dist/{runtime-BKChZZ2-.js → debug-DycdGrul.js} +20 -27
  70. package/dist/debug-DycdGrul.js.map +1 -0
  71. package/dist/dev/rsc.js +9 -9
  72. package/dist/{dev-fOtWB5K3.js → dev-DdRWa6dJ.js} +7 -6
  73. package/dist/{dev-fOtWB5K3.js.map → dev-DdRWa6dJ.js.map} +1 -1
  74. package/dist/{dev-p8tW7X-A.js → dev-px0_6TNq.js} +4 -4
  75. package/dist/{dev-p8tW7X-A.js.map → dev-px0_6TNq.js.map} +1 -1
  76. package/dist/dev.js +1 -1
  77. package/dist/dialect/extracted/index.js +1 -1
  78. package/dist/dialect/index.js +1 -1
  79. package/dist/{elementMarker-CvqqIb7J.js → elementMarker-ng0y3fN0.js} +8 -8
  80. package/dist/{elementMarker-CvqqIb7J.js.map → elementMarker-ng0y3fN0.js.map} +1 -1
  81. package/dist/entry/dev/css.js +2 -2
  82. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  83. package/dist/entry/dev/jsx-runtime.js +2 -2
  84. package/dist/entry/dev.js +11 -12
  85. package/dist/entry/prod/css.js +2 -2
  86. package/dist/entry/prod/extract.js +2 -2
  87. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  88. package/dist/entry/prod/jsx-runtime.js +2 -2
  89. package/dist/entry/prod/runtime.js +5 -4
  90. package/dist/entry/prod.js +40 -11
  91. package/dist/entry/prod.js.map +1 -1
  92. package/dist/entry/rsc-dev/css.js +2 -2
  93. package/dist/entry/rsc-dev/dev.js +4 -4
  94. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  95. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  96. package/dist/entry/rsc-dev.js +274 -68
  97. package/dist/entry/rsc-dev.js.map +1 -1
  98. package/dist/entry/rsc-prod/css.js +2 -2
  99. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  100. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  101. package/dist/entry/rsc-prod/runtime.js +5 -4
  102. package/dist/entry/rsc-prod.js +16 -10
  103. package/dist/entry/rsc-prod.js.map +1 -0
  104. package/dist/extract-B-Vs88ME.js +3 -0
  105. package/dist/{extract-CzWJeQi8.js → extract-CM8Fk2eK.js} +24 -15
  106. package/dist/{extract-CzWJeQi8.js.map → extract-CM8Fk2eK.js.map} +1 -1
  107. package/dist/{getClassName-oiQ8CnkS.js → getClassName-CrNVjAoJ.js} +29 -8
  108. package/dist/getClassName-CrNVjAoJ.js.map +1 -0
  109. package/dist/{global-Cul1dX8k.js → global-CZBlA9E7.js} +3 -3
  110. package/dist/{global-Cul1dX8k.js.map → global-CZBlA9E7.js.map} +1 -1
  111. package/dist/{hash-Bycpk3MR.js → hash-BfeJDf5U.js} +13 -4
  112. package/dist/hash-BfeJDf5U.js.map +1 -0
  113. package/dist/index.js +9 -10
  114. package/dist/jsx/jsx-dev-runtime.js +2 -2
  115. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  116. package/dist/jsx/jsx-runtime.js +2 -2
  117. package/dist/jsx/jsx-runtime.server.js +1 -1
  118. package/dist/{jsx-Ba-XV33u.js → jsx-BY1iFewe.js} +3 -3
  119. package/dist/{jsx-Ba-XV33u.js.map → jsx-BY1iFewe.js.map} +1 -1
  120. package/dist/{jsx-A4cK517J.js → jsx-DL-DEAz8.js} +8 -7
  121. package/dist/{jsx-A4cK517J.js.map → jsx-DL-DEAz8.js.map} +1 -1
  122. package/dist/{jsx_dev_runtime-BQcRzl5D.js → jsx_dev_runtime-aAhNYDeS.js} +2 -2
  123. package/dist/{jsx_dev_runtime-BQcRzl5D.js.map → jsx_dev_runtime-aAhNYDeS.js.map} +1 -1
  124. package/dist/{jsx_runtime-B9KEoAQN.js → jsx_runtime-C6i1bWlu.js} +2 -2
  125. package/dist/{jsx_runtime-B9KEoAQN.js.map → jsx_runtime-C6i1bWlu.js.map} +1 -1
  126. package/dist/{jsx_runtime-BXcbW8Yp.js → jsx_runtime-D7Y5up6H.js} +2 -2
  127. package/dist/{jsx_runtime-BXcbW8Yp.js.map → jsx_runtime-D7Y5up6H.js.map} +1 -1
  128. package/dist/{layer-CbQzwZF-.js → layer-BSxAr-hy.js} +4 -4
  129. package/dist/{layer-CbQzwZF-.js.map → layer-BSxAr-hy.js.map} +1 -1
  130. package/dist/{loader-BAth2yZ1.mjs → loader-BmYS_Rju.mjs} +3 -3
  131. package/dist/{loader-BAth2yZ1.mjs.map → loader-BmYS_Rju.mjs.map} +1 -1
  132. package/dist/{misc-DFBKJGLT.mjs → misc-BIS_c7BJ.mjs} +2 -2
  133. package/dist/{misc-DFBKJGLT.mjs.map → misc-BIS_c7BJ.mjs.map} +1 -1
  134. package/dist/{namedTokens-BUa6raTb.js → namedTokens-CN_yhhik.js} +8 -6
  135. package/dist/namedTokens-CN_yhhik.js.map +1 -0
  136. package/dist/plugin/farm/index.mjs +2 -2
  137. package/dist/plugin/nextjs/index.mjs +4 -4
  138. package/dist/plugin/nextjs/loader.mjs +4 -4
  139. package/dist/plugin/parcel/optimizer.cjs +3 -2
  140. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  141. package/dist/plugin/parcel/optimizer.mjs +3 -2
  142. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  143. package/dist/plugin/parcel/resolver.cjs +1 -1
  144. package/dist/plugin/parcel/resolver.mjs +2 -2
  145. package/dist/plugin/parcel/runtime.cjs +1 -1
  146. package/dist/plugin/parcel/runtime.mjs +1 -1
  147. package/dist/plugin/parcel/transformer.cjs +1 -1
  148. package/dist/plugin/parcel/transformer.mjs +2 -2
  149. package/dist/plugin/rspack/index.mjs +1 -1
  150. package/dist/plugin/vite/index.mjs +3 -3
  151. package/dist/plugin/webpack/index.mjs +1 -1
  152. package/dist/plugin/webpack/loader.mjs +2 -2
  153. package/dist/presets/tailwind/index.js +8 -5
  154. package/dist/presets/tailwind/index.js.map +1 -1
  155. package/dist/{property-CF6JgpTq.js → property-BuLbzviK.js} +2 -2
  156. package/dist/{property-CF6JgpTq.js.map → property-BuLbzviK.js.map} +1 -1
  157. package/dist/{registry-CiwvMfx8.mjs → registry-IaXmLQzA.mjs} +2 -2
  158. package/dist/{registry-CiwvMfx8.mjs.map → registry-IaXmLQzA.mjs.map} +1 -1
  159. package/dist/{rules-DlXcch7-.js → rules-CxVzovt-.js} +60 -23
  160. package/dist/rules-CxVzovt-.js.map +1 -0
  161. package/dist/selector-A-mRmMnI.js +64 -0
  162. package/dist/selector-A-mRmMnI.js.map +1 -0
  163. package/dist/server.js +12 -13
  164. package/dist/server.js.map +1 -1
  165. package/dist/{shared-yDD0nfm1.cjs → shared-CaJuvw03.cjs} +231 -84
  166. package/dist/shared-CaJuvw03.cjs.map +1 -0
  167. package/dist/{shared-x59dI2NW.mjs → shared-DdPTZ0O3.mjs} +4 -4
  168. package/dist/{shared-x59dI2NW.mjs.map → shared-DdPTZ0O3.mjs.map} +1 -1
  169. package/dist/sheet-BWBzuy4D.js +7 -0
  170. package/dist/{sheet-B-uJfHRY.js.map → sheet-BWBzuy4D.js.map} +1 -1
  171. package/dist/{sidecar-CJ6i4wmn.mjs → sidecar-B3oCK9vC.mjs} +3 -3
  172. package/dist/{sidecar-CJ6i4wmn.mjs.map → sidecar-B3oCK9vC.mjs.map} +1 -1
  173. package/dist/{style-DFFK06Of.js → style-CGaJndOl.js} +102 -54
  174. package/dist/style-CGaJndOl.js.map +1 -0
  175. package/dist/{style-Bw5ka-Nq.js → style-DDxjKdX0.js} +356 -39
  176. package/dist/style-DDxjKdX0.js.map +1 -0
  177. package/dist/style-S7LTQbRu.js +5 -0
  178. package/dist/{styleStore-DJ0Msgkh.js → styleStore-0fARJlZV.js} +6 -6
  179. package/dist/{styleStore-DJ0Msgkh.js.map → styleStore-0fARJlZV.js.map} +1 -1
  180. package/dist/{styleStore-ydQcDBD4.js → styleStore-CajcAEPO.js} +101 -223
  181. package/dist/styleStore-CajcAEPO.js.map +1 -0
  182. package/dist/symbols-Cp4ymzKF.js +14 -0
  183. package/dist/symbols-Cp4ymzKF.js.map +1 -0
  184. package/dist/token-D-S-4_mN.js +138 -0
  185. package/dist/token-D-S-4_mN.js.map +1 -0
  186. package/dist/{trace-D8j96G57.js → trace-CFnhyCVf.js} +2 -2
  187. package/dist/{trace-D8j96G57.js.map → trace-CFnhyCVf.js.map} +1 -1
  188. package/dist/{trace-CO36aenp.js → trace-ZtgeY-8s.js} +3 -3
  189. package/dist/{trace-CO36aenp.js.map → trace-ZtgeY-8s.js.map} +1 -1
  190. package/dist/{transform-BTJOg8Hg.js → transform-BkrLIiIR.js} +2 -2
  191. package/dist/{transform-BTJOg8Hg.js.map → transform-BkrLIiIR.js.map} +1 -1
  192. package/dist/{utils-D2fygyTm.mjs → utils-B5Xqf1lV.mjs} +4 -4
  193. package/dist/{utils-D2fygyTm.mjs.map → utils-B5Xqf1lV.mjs.map} +1 -1
  194. package/dist/{utils-hoYnMiA7.js → utils-B_VhPBHH.js} +4 -4
  195. package/dist/{utils-hoYnMiA7.js.map → utils-B_VhPBHH.js.map} +1 -1
  196. package/dist/{utils-Bmw655wa.js → utils-CDUaX81o.js} +3 -3
  197. package/dist/{utils-Bmw655wa.js.map → utils-CDUaX81o.js.map} +1 -1
  198. package/dist/{utils-DTXCTUlS.mjs → utils-DaAiEEIG.mjs} +3 -3
  199. package/dist/{utils-DTXCTUlS.mjs.map → utils-DaAiEEIG.mjs.map} +1 -1
  200. package/dist/{utils-DVFxZnVC.js → utils-DzydRwYo.js} +65 -49
  201. package/dist/utils-DzydRwYo.js.map +1 -0
  202. package/dist/utils.js +3 -3
  203. package/dist/value-C0JRsyax.js +64 -0
  204. package/dist/value-C0JRsyax.js.map +1 -0
  205. package/dist/{value-DvFkGBy2.js → value-D08AocUs.js} +96 -72
  206. package/dist/value-D08AocUs.js.map +1 -0
  207. package/dist/{valueRef-CsLVJwjA.js → valueRef-M3E1oza7.js} +2 -2
  208. package/dist/{valueRef-CsLVJwjA.js.map → valueRef-M3E1oza7.js.map} +1 -1
  209. package/dist/{webpack-BOU7_xld.mjs → webpack-CHydnRXB.mjs} +5 -5
  210. package/dist/{webpack-BOU7_xld.mjs.map → webpack-CHydnRXB.mjs.map} +1 -1
  211. package/dist/{withTokens-LRidu3Vc.js → withTokens-DAzUIPvA.js} +2 -2
  212. package/dist/{withTokens-LRidu3Vc.js.map → withTokens-DAzUIPvA.js.map} +1 -1
  213. package/entry/prod/config_debug.ts +2 -0
  214. package/entry/prod/index.ts +1 -1
  215. package/entry/prod/runtime.ts +3 -1
  216. package/entry/rsc_prod/config_debug.ts +6 -0
  217. package/entry/rsc_prod/index.ts +1 -1
  218. package/entry/shared/config_debug.ts +9 -0
  219. package/entry/shared/config_dev.ts +9 -7
  220. package/package.json +1 -1
  221. package/plugin/bundler/parcel/optimizer.ts +1 -0
  222. package/presets/tailwind/style/transform.ts +9 -3
  223. package/runtime/core/cache/combine.ts +44 -25
  224. package/runtime/core/cache/combineRuntime.ts +4 -0
  225. package/runtime/core/cache/index.ts +2 -1
  226. package/runtime/core/cache/item.ts +2 -2
  227. package/runtime/core/cache/pool.ts +15 -30
  228. package/runtime/core/cache/prop.ts +3 -2
  229. package/runtime/core/cache/token.ts +20 -0
  230. package/runtime/core/cache/tokenValues.ts +19 -11
  231. package/runtime/extract/combineStyle.ts +37 -0
  232. package/runtime/extract/getClassName.ts +5 -11
  233. package/runtime/extract/index.ts +3 -1
  234. package/runtime/extract/token.ts +41 -0
  235. package/runtime/extract/tokenResolver.ts +17 -0
  236. package/runtime/style/style.ts +2 -1
  237. package/style/style.ts +1 -1
  238. package/style/theme.ts +0 -1
  239. package/style/token.ts +26 -21
  240. package/style/tokens.ts +18 -12
  241. package/style/transform.ts +1 -1
  242. package/style/value.ts +26 -11
  243. package/style/valueRef.ts +1 -1
  244. package/utils/global.ts +1 -3
  245. package/utils/symbol.ts +3 -0
  246. package/dist/className-ZJ5pBA-o.js +0 -263
  247. package/dist/className-ZJ5pBA-o.js.map +0 -1
  248. package/dist/compiler-D5v5tJXI.mjs.map +0 -1
  249. package/dist/config-BEvP7108.js.map +0 -1
  250. package/dist/config-B_cbG3S6.js +0 -1
  251. package/dist/config-FIfi5aJ8.js.map +0 -1
  252. package/dist/config-OXHoDUIo.js +0 -6
  253. package/dist/css-CELBp6Gu.js.map +0 -1
  254. package/dist/css-dPoZJDQH.js.map +0 -1
  255. package/dist/data-CeYstKMP.js.map +0 -1
  256. package/dist/extract-DeOytHKW.js +0 -2
  257. package/dist/getClassName-oiQ8CnkS.js.map +0 -1
  258. package/dist/global-zaCE-g1C.js.map +0 -1
  259. package/dist/hash-Bycpk3MR.js.map +0 -1
  260. package/dist/namedTokens-BUa6raTb.js.map +0 -1
  261. package/dist/rules-DlXcch7-.js.map +0 -1
  262. package/dist/runtime-BKChZZ2-.js.map +0 -1
  263. package/dist/shared-yDD0nfm1.cjs.map +0 -1
  264. package/dist/sheet-B-uJfHRY.js +0 -7
  265. package/dist/style-91J0B5ef.js.map +0 -1
  266. package/dist/style-Bw5ka-Nq.js.map +0 -1
  267. package/dist/style-DFFK06Of.js.map +0 -1
  268. package/dist/style-pz8e5To1.js +0 -5
  269. package/dist/styleStore-ydQcDBD4.js.map +0 -1
  270. package/dist/token-CKXUECuU.js +0 -76
  271. package/dist/token-CKXUECuU.js.map +0 -1
  272. package/dist/token-DTOyFLmp.js +0 -58
  273. package/dist/token-DTOyFLmp.js.map +0 -1
  274. package/dist/token-DT_sCPtm.js +0 -298
  275. package/dist/token-DT_sCPtm.js.map +0 -1
  276. package/dist/utils-DVFxZnVC.js.map +0 -1
  277. package/dist/value-D-ZcRzLA.js +0 -42
  278. package/dist/value-D-ZcRzLA.js.map +0 -1
  279. package/dist/value-DvFkGBy2.js.map +0 -1
  280. package/dist/value-dG9LK0Gq.js +0 -85
  281. package/dist/value-dG9LK0Gq.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"trace-D8j96G57.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\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,QACA,cACA,YACA;CACA,IAAI,iBAAiB,MAAM,GAAG,OAAO;CAErC,IAAI;EACF,IAAI,cAAc,CAAC,iBAAiB,UAAU,GAC5C,OAAO,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE;EAGzE,IAAI,YACF,OAAO,IAAI,IAAI,QAAQ,UAAU,EAAE;EAGrC,OAAO,IAAI,IAAI,QAAQ,YAAY,EAAE;CACvC,QAAQ;EACN,OAAO,aAAa,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
1
+ {"version":3,"file":"trace-CFnhyCVf.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings":";;;AAsBA,MAAM,2BAA2B;AAEjC,eAAsB,qBAAoD;CACxE,MAAM,aAAa,oBAAoB,EAAE,QAAQ,SAC/C,KAAK,iBAAiB,KAAK,cAAc,eAAe,KAAK,GAC/D;CACA,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,eAAe,OAAO,KAAK,aAAa;CACxD,MAAM,iCAAiB,IAAI,IAA2C;CACtE,MAAM,6BAAa,IAAI,IAAY;CACnC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,MAAM,WAAW,QAAQ,IAAI,KAAK,KAAK;EACrD,MAAM,OAAO,WAAW;EACxB,IAAI,UAAU;EAEd,KAAK,IAAI,IAAI,GAAG,UAAU,KAAK,MAAM,QAAQ,IAAI,SAAS,KAAK;GAC7D,MAAM,OAAO,KAAK,MAAM;GACxB,MAAM,WAAW,yBAAyB,IAAI;GAE9C,IAAI,CAAC,UAAU;GACf,IAAI,mBAAmB,SAAS,aAAa,SAAS,QAAQ,GAAG;GAEjE;GAEA,MAAM,eAAe,MAAM,uBACzB,UACA,SACA,cACF;GAEA,IAAI,cAAc;IAChB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AC;EAEpD,OAAO,eAAe,KAAK,SAAS,OAAO,MAAM,GAAG,UAAU;CAChE;AACF;AAEA,SAAS,eAAe,MAAc,SAAmB;CACvD,IAAI,QAAQ;CAEZ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,KAAK,QAAQ,MAAM;EAChC,IAAI,SAAS,OAAO,UAAU,MAAM,OAAO,QAAQ,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAS,yBAAyB;CAChC,OAAO,iBAAiB,GAAG,SAAS;AACtC;AAEA,SAAS,mBAAmB;CAC1B,OAAO,OAAO,WAAW,cAAc,OAAO;AAChD;AAEA,SAAS,yBACP,QACA,cACA,YACA;CACA,IAAI,iBAAiB,MAAM,GAAG,OAAO;CAErC,IAAI;EACF,IAAI,cAAc,CAAC,iBAAiB,UAAU,GAC5C,OAAO,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE;EAGzE,IAAI,YACF,OAAO,IAAI,IAAI,QAAQ,UAAU,EAAE;EAGrC,OAAO,IAAI,IAAI,QAAQ,YAAY,EAAE;CACvC,QAAQ;EACN,OAAO,aAAa,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
@@ -1,5 +1,5 @@
1
- import { f as normalizeCallsiteSourceUrl } from "./debug-D96KGgpH.js";
2
- import { f as getDevSourcemapTags, h as getSourcemapRuleCallsite, m as createSourceMapComment } from "./elementMarker-CvqqIb7J.js";
1
+ import { f as normalizeCallsiteSourceUrl } from "./debug-Cvpo5cVu.js";
2
+ import { f as getDevSourcemapTags, h as getSourcemapRuleCallsite, m as createSourceMapComment } from "./elementMarker-ng0y3fN0.js";
3
3
  import { TraceMap, originalPositionFor, sourceContentFor } from "@jridgewell/trace-mapping";
4
4
  //#region dev/trace.ts
5
5
  const SOURCE_MAPPING_URL_REGEX = /(?:\/\/|\/\*)[#@]\s*sourceMappingURL=([^\s*]+)(?:\s*\*\/)?/g;
@@ -242,4 +242,4 @@ function isAbsoluteSource(source) {
242
242
  //#endregion
243
243
  export { traceDevSourcemaps };
244
244
 
245
- //# sourceMappingURL=trace-CO36aenp.js.map
245
+ //# sourceMappingURL=trace-ZtgeY-8s.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-CO36aenp.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings":";;;;AAsBA,MAAM,2BAA2B;AAEjC,eAAsB,qBAAoD;CACxE,MAAM,aAAa,oBAAoB,EAAE,QAAQ,SAC/C,KAAK,iBAAiB,KAAK,cAAc,eAAe,KAAK,GAC/D;CACA,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,eAAe,OAAO,KAAK,aAAa;CACxD,MAAM,iCAAiB,IAAI,IAA2C;CACtE,MAAM,6BAAa,IAAI,IAAY;CACnC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,MAAM,WAAW,QAAQ,IAAI,KAAK,KAAK;EACrD,MAAM,OAAO,WAAW;EACxB,IAAI,UAAU;EAEd,KAAK,IAAI,IAAI,GAAG,UAAU,KAAK,MAAM,QAAQ,IAAI,SAAS,KAAK;GAC7D,MAAM,OAAO,KAAK,MAAM;GACxB,MAAM,WAAW,yBAAyB,IAAI;GAE9C,IAAI,CAAC,UAAU;GACf,IAAI,mBAAmB,SAAS,aAAa,SAAS,QAAQ,GAAG;GAEjE;GAEA,MAAM,eAAe,MAAM,uBACzB,UACA,SACA,cACF;GAEA,IAAI,cAAc;IAChB,IAAI,aAAa,cAAc,WAAW,IAAI,aAAa,YAAY;IACvE,KAAK,WAAW,aAAa;IAC7B,KAAK,QAAQ;IACb,KAAK,aAAa;IAClB;GACF,OAAO;IACL,KAAK,WAAW,sBAAsB,QAAQ;IAC9C,KAAK,QAAQ;IACb,KAAK,aAAa;IAClB;GACF;GAE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S,OAAO,UAAU,MAAM,OAAO,QAAQ,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAS,yBAAyB;CAChC,OAAO,iBAAiB,GAAG,SAAS;AACtC;AAEA,SAAS,mBAAmB;CAC1B,OAAO,OAAO,WAAW,cAAc,OAAO;AAChD;AAEA,SAAS,yBACP,QACA,cACA,YACA;CACA,IAAI,iBAAiB,MAAM,GAAG,OAAO;CAErC,IAAI;EACF,IAAI,cAAc,CAAC,iBAAiB,UAAU,GAC5C,OAAO,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE;EAGzE,IAAI,YACF,OAAO,IAAI,IAAI,QAAQ,UAAU,EAAE;EAGrC,OAAO,IAAI,IAAI,QAAQ,YAAY,EAAE;CACvC,QAAQ;EACN,OAAO,aAAa,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
1
+ {"version":3,"file":"trace-ZtgeY-8s.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings":";;;;AAsBA,MAAM,2BAA2B;AAEjC,eAAsB,qBAAoD;CACxE,MAAM,aAAa,oBAAoB,EAAE,QAAQ,SAC/C,KAAK,iBAAiB,KAAK,cAAc,eAAe,KAAK,GAC/D;CACA,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,eAAe,OAAO,KAAK,aAAa;CACxD,MAAM,iCAAiB,IAAI,IAA2C;CACtE,MAAM,6BAAa,IAAI,IAAY;CACnC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,MAAM,WAAW,QAAQ,IAAI,KAAK,KAAK;EACrD,MAAM,OAAO,WAAW;EACxB,IAAI,UAAU;EAEd,KAAK,IAAI,IAAI,GAAG,UAAU,KAAK,MAAM,QAAQ,IAAI,SAAS,KAAK;GAC7D,M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EA,OAAO;AACT;AAEA,SAAS,sBAAsB,QAAgB;CAC7C,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,MAAM;EAE1B,IAAI,SAAS;EACb,IAAI,OAAO;EAEX,OAAO,IAAI;CACb,QAAQ;EACN,MAAM,aAAa,eAAe,QAAQ,CAAC,KAAK,GAAG,CAAC;EAEpD,OAAO,eAAe,KAAK,SAAS,OAAO,MAAM,GAAG,UAAU;CAChE;AACF;AAEA,SAAS,eAAe,MAAc,SAAmB;CACvD,IAAI,QAAQ;CAEZ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,KAAK,QAAQ,MAAM;EAChC,IAAI,SAAS,OAAO,UAAU,MAAM,OAAO,QAAQ,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAS,yBAAyB;CAChC,OAAO,iBAAiB,GAAG,SAAS;AACtC;AAEA,SAAS,mBAAmB;CAC1B,OAAO,OAAO,WAAW,cAAc,OAAO;AAChD;AAEA,SAAS,yBACP,QACA,cACA,YACA;CACA,IAAI,iBAAiB,MAAM,GAAG,OAAO;CAErC,IAAI;EACF,IAAI,cAAc,CAAC,iBAAiB,UAAU,GAC5C,OAAO,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE;EAGzE,IAAI,YACF,OAAO,IAAI,IAAI,QAAQ,UAAU,EAAE;EAGrC,OAAO,IAAI,IAAI,QAAQ,YAAY,EAAE;CACvC,QAAQ;EACN,OAAO,aAAa,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
@@ -1,4 +1,4 @@
1
- import { i as symbol } from "./global-zaCE-g1C.js";
1
+ import { s as symbol } from "./css-GtUPEO9U.js";
2
2
  //#region style/transform.ts
3
3
  const CLASS_NAME_VALUE = symbol("transform.classNameValue");
4
4
  function classNameValue(value, className) {
@@ -20,4 +20,4 @@ function classNameTransform(options) {
20
20
  //#endregion
21
21
  export { styleTransform as i, classNameValue as n, isClassNameValue as r, classNameTransform as t };
22
22
 
23
- //# sourceMappingURL=transform-BTJOg8Hg.js.map
23
+ //# sourceMappingURL=transform-BkrLIiIR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-BTJOg8Hg.js","names":[],"sources":["../style/transform.ts"],"sourcesContent":["import { symbol } from '../utils/global';\nimport type { CSSProperties, StyleObject, StyleValue } from './types';\n\nconst CLASS_NAME_VALUE: unique symbol = symbol('transform.classNameValue');\n\nexport type ClassNameValue<Value = unknown> = {\n readonly [CLASS_NAME_VALUE]: true;\n readonly value: Value;\n readonly className: string;\n};\n\nexport type TransformStyleObject<Style = unknown> = {\n [P in keyof Style]: StyleValue<Style[P] | ClassNameValue<Style[P]>>;\n};\n\nexport type StyleTransform<Style = unknown> = {\n transform(style: StyleObject<Style>): TransformStyleObject<CSSProperties>;\n};\n\nexport type ClassNameTransform<ClassName extends string = string> = {\n transform(className: ClassName): TransformStyleObject<CSSProperties>;\n};\n\nexport function classNameValue<const Value>(\n value: Value,\n className: string,\n): ClassNameValue<Value> {\n return {\n [CLASS_NAME_VALUE]: true,\n value,\n className,\n };\n}\n\nexport function isClassNameValue(value: unknown): value is ClassNameValue {\n return !!value &&\n typeof value === 'object' &&\n (value as ClassNameValue)[CLASS_NAME_VALUE] === true &&\n typeof (value as ClassNameValue).className === 'string';\n}\n\nexport function styleTransform<Style>(options: StyleTransform<Style>) {\n return options;\n}\n\nexport function classNameTransform<ClassName extends string>(options: ClassNameTransform<ClassName>) {\n return options;\n}\n"],"mappings":";;AAGA,MAAM,mBAAkC,OAAO,0BAA0B;AAoBzE,SAAgB,eACd,OACA,WACuB;CACvB,OAAO;GACJ,mBAAmB;EACpB;EACA;CACF;AACF;AAEA,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,CAAC,CAAC,SACP,OAAO,UAAU,YAChB,MAAyB,sBAAsB,QAChD,OAAQ,MAAyB,cAAc;AACnD;AAEA,SAAgB,eAAsB,SAAgC;CACpE,OAAO;AACT;AAEA,SAAgB,mBAA6C,SAAwC;CACnG,OAAO;AACT"}
1
+ {"version":3,"file":"transform-BkrLIiIR.js","names":[],"sources":["../style/transform.ts"],"sourcesContent":["import { symbol } from '../utils/symbol';\nimport type { CSSProperties, StyleObject, StyleValue } from './types';\n\nconst CLASS_NAME_VALUE: unique symbol = symbol('transform.classNameValue');\n\nexport type ClassNameValue<Value = unknown> = {\n readonly [CLASS_NAME_VALUE]: true;\n readonly value: Value;\n readonly className: string;\n};\n\nexport type TransformStyleObject<Style = unknown> = {\n [P in keyof Style]: StyleValue<Style[P] | ClassNameValue<Style[P]>>;\n};\n\nexport type StyleTransform<Style = unknown> = {\n transform(style: StyleObject<Style>): TransformStyleObject<CSSProperties>;\n};\n\nexport type ClassNameTransform<ClassName extends string = string> = {\n transform(className: ClassName): TransformStyleObject<CSSProperties>;\n};\n\nexport function classNameValue<const Value>(\n value: Value,\n className: string,\n): ClassNameValue<Value> {\n return {\n [CLASS_NAME_VALUE]: true,\n value,\n className,\n };\n}\n\nexport function isClassNameValue(value: unknown): value is ClassNameValue {\n return !!value &&\n typeof value === 'object' &&\n (value as ClassNameValue)[CLASS_NAME_VALUE] === true &&\n typeof (value as ClassNameValue).className === 'string';\n}\n\nexport function styleTransform<Style>(options: StyleTransform<Style>) {\n return options;\n}\n\nexport function classNameTransform<ClassName extends string>(options: ClassNameTransform<ClassName>) {\n return options;\n}\n"],"mappings":";;AAGA,MAAM,mBAAkC,OAAO,0BAA0B;AAoBzE,SAAgB,eACd,OACA,WACuB;CACvB,OAAO;GACJ,mBAAmB;EACpB;EACA;CACF;AACF;AAEA,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,CAAC,CAAC,SACP,OAAO,UAAU,YAChB,MAAyB,sBAAsB,QAChD,OAAQ,MAAyB,cAAc;AACnD;AAEA,SAAgB,eAAsB,SAAgC;CACpE,OAAO;AACT;AAEA,SAAgB,mBAA6C,SAAwC;CACnG,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
- import { o as normalizePath } from "./compiler-D5v5tJXI.mjs";
2
- import { f as resolvePluginSourcemapOptions, h as getPluginBuildDevConfig, m as getPluginBuildConfig } from "./misc-DFBKJGLT.mjs";
3
- import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-CiwvMfx8.mjs";
1
+ import { o as normalizePath } from "./compiler-CE0ZgkdH.mjs";
2
+ import { f as resolvePluginSourcemapOptions, h as getPluginBuildDevConfig, m as getPluginBuildConfig } from "./misc-BIS_c7BJ.mjs";
3
+ import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-IaXmLQzA.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { createHash } from "node:crypto";
6
6
  import path from "node:path";
@@ -94,4 +94,4 @@ function replaceCssMarkerAsset(args) {
94
94
  //#endregion
95
95
  export { LOADER_IMPORT_PATH as _, createNextBuildDevConfig as a, getNextPrecollectCacheSubdir as c, nextRegistry as d, removeUndefinedValues as f, DEV_CSS_ROUTE as g, CSS_ENTRY_IMPORT_PATH as h, createNextBuildConfig as i, getTransformLoaderPath as l, resolveNextCompilerOptions as m, addAliases as n, createNextConfigHash as o, replaceCssMarkerAsset as p, addWebpackPlugin as r, getNextCacheDir as s, NEXT_COMPILER_IDS as t, isAppLayoutFile as u };
96
96
 
97
- //# sourceMappingURL=utils-D2fygyTm.mjs.map
97
+ //# sourceMappingURL=utils-B5Xqf1lV.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-D2fygyTm.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n) {\n const values = [\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACW5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,kBAAkB;AAClE;AAEA,SAAgB,gBA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AO,MAAM,MAAM,EAAE,KAAK,GAAG;AACtC;AAEA,SAAgB,WAAW,QAA8B,SAAiC;CACxF,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,IAAI,CAAC,OAAO,QAAQ,OAAO,OAAO,QAAQ,QAAQ,CAAC;CACnD,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAC7C;AAEA,SAAgB,iBAAiB,QAA8B,QAA+B;CAC5F,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,OAAO,QAAQ,KAAK,MAAM;AAC5B;AAEA,SAAgB,sBAAsB,MAKnC;CACD,KAAK,MAAM,SAAS,KAAK,YAAY,UAAU,GAAG;EAChD,IAAI,CAAC,MAAM,KAAK,SAAS,MAAM,GAAG;EAElC,MAAM,SAAS,MAAM,OAAO,OAAO,EAAE,SAAS;EAC9C,IAAI,CAAC,aAAa,QAAQ,KAAK,MAAM,GAAG;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"utils-B5Xqf1lV.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n) {\n const values = [\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACW5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,kBAAkB;AAClE;AAEA,SAAgB,gBAAgB,SAAiB,UAAmB;CAClE,OAAO,YAAY,KAAK,KAAK,SAAS,4BAA4B;AACpE;AAEA,SAAgB,6BAA6B,KAAc;CACzD,OAAO,MAAM,sBAAsB,MAAM,sBAAsB;AACjE;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,OAAO,qBAAqB,OAAO;AACrC;AAEA,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AQ,OAAO,OAAO;AAC7C;AAEA,SAAgB,iBAAiB,QAA8B,QAA+B;CAC5F,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,OAAO,QAAQ,KAAK,MAAM;AAC5B;AAEA,SAAgB,sBAAsB,MAKnC;CACD,KAAK,MAAM,SAAS,KAAK,YAAY,UAAU,GAAG;EAChD,IAAI,CAAC,MAAM,KAAK,SAAS,MAAM,GAAG;EAElC,MAAM,SAAS,MAAM,OAAO,OAAO,EAAE,SAAS;EAC9C,IAAI,CAAC,aAAa,QAAQ,KAAK,MAAM,GAAG;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
- import { s as hasOwn } from "./dev-p8tW7X-A.js";
2
- import { i as resolveStylePropRuntime } from "./rules-DlXcch7-.js";
3
- import { c as splitElementMarkerStyleProp, n as createElementMarkerClassName } from "./elementMarker-CvqqIb7J.js";
1
+ import { s as hasOwn } from "./dev-px0_6TNq.js";
2
+ import { i as resolveStylePropRuntime } from "./rules-CxVzovt-.js";
3
+ import { c as splitElementMarkerStyleProp, n as createElementMarkerClassName } from "./elementMarker-ng0y3fN0.js";
4
4
  //#region runtime/core/className.ts
5
5
  function mergeClassName(className) {
6
6
  if (!className) return void 0;
@@ -126,4 +126,4 @@ function createJsx(fn, transformElement) {
126
126
  //#endregion
127
127
  export { createTransformElement as a, wrapFragment as i, createJsxDEV as n, resolveClassNameRuntime as o, wrapCreateElement as r, createJsx as t };
128
128
 
129
- //# sourceMappingURL=utils-hoYnMiA7.js.map
129
+ //# sourceMappingURL=utils-B_VhPBHH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-hoYnMiA7.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/core/createTransformElement.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,gBAAgB,gBACZ,GAAG,cAAc,GAAG,SACpB;CAER;CAEA,OAAO,iBAAiB,KAAA;AAC1B;AAEA,SAAgB,WAAW,OAA6B;CACtD,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,IAAI,CAAC,MAAM,QAAQ,KAAK,G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time/core/createTransformElement.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,gBAAgB,gBACZ,GAAG,cAAc,GAAG,SACpB;CAER;CAEA,OAAO,iBAAiB,KAAA;AAC1B;AAEA,SAAgB,WAAW,OAA6B;CACtD,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,IAAI,CAAC,MAAM,QAAQ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ElementMarkerClassName, K as isElementMarkerRule, U as createElementMarkerRuleFromDebug, l as resolveStylePropRuntime, q as splitElementMarkerStyleProp, r as ELEMENT_CSS_DATA_ATTR, s as collectStylePropItemsSheetRulesWithThemes, t as addRscStyleRules } from "./styleStore-ydQcDBD4.js";
1
+ import { B as hasOwn, L as DEV_CONFIG } from "./value-D08AocUs.js";
2
+ import { J as splitElementMarkerStyleProp, U as createElementMarkerClassName, W as createElementMarkerRuleFromDebug, d as resolveStylePropRuntime, q as isElementMarkerRule, r as ELEMENT_CSS_DATA_ATTR, s as collectStylePropItemsSheetRulesWithThemes, t as addRscStyleRules } from "./styleStore-CajcAEPO.js";
3
3
  //#region runtime/core/className.ts
4
4
  function mergeClassName(className) {
5
5
  if (!className) return void 0;
@@ -167,4 +167,4 @@ function createJsx(fn, transformElement) {
167
167
  //#endregion
168
168
  export { transformElement as a, wrapFragment as i, createJsxDEV as n, getClassName as o, wrapCreateElement as r, createJsx as t };
169
169
 
170
- //# sourceMappingURL=utils-Bmw655wa.js.map
170
+ //# sourceMappingURL=utils-CDUaX81o.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-Bmw655wa.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/rsc/getClassName.ts","../runtime/core/createTransformElement.ts","../runtime/rsc/jsx.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { LayerPriority } from '../../atomic/layer';\nimport type { DebugData } from '../../builder/data/debug';\nimport { DEV_CONFIG } from '../../config/config/dev';\nimport type { SheetRule } from '../../sheet';\nimport type { StylePropItem } from '../core/cache/prop';\nimport type { ClassNameProps, ClassNameResult } from '../core/className';\nimport {\n createElementMarkerRuleFromDebug,\n isElementMarkerRule,\n splitElementMarkerStyleProp,\n} from '../core/elementMarker';\nimport { resolveClassNameRuntime } from '../core/resolveClassNameRuntime';\nimport { collectStylePropItemsSheetRulesWithThemes } from '../sheet/rules';\nimport type { StyleProp } from '../types';\nimport { ELEMENT_CSS_DATA_ATTR } from './constants';\nimport { addRscStyleRules } from './styleStore';\n\nexport type RscStylePayloadRule = {\n key?: string | null;\n css: string;\n priority?: LayerPriority | null;\n callsite?: SheetRule['callsite'];\n debug?: DebugData | null;\n debugField?: string | null;\n};\n\nexport type ClassNameResultRSC = ClassNameResult & {\n [ELEMENT_CSS_DATA_ATTR]?: string;\n};\n\nexport function getClassName(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): ClassNameResultRSC {\n const marker = splitElementMarkerStyleProp(styleProp);\n const resolved = resolveClassNameRuntime(marker.styleProp as StyleProp, props);\n\n return DEV_CONFIG.isDev\n ? getClassNameRSC(resolved.result, resolved.items, marker.debug)\n : resolved.result;\n}\n\nexport function getClassNameRSC(\n result: ClassNameResult,\n items: readonly StylePropItem[],\n markerDebug?: ReturnType<typeof splitElementMarkerStyleProp>['debug'],\n): ClassNameResultRSC {\n const rules = collectStylePropItemsSheetRulesWithThemes(items);\n const marker = createElementMarkerRuleFromDebug(markerDebug);\n\n if (!rules.length && !marker) return result;\n\n addRscStyleRules(rules);\n\n if (marker) {\n result.className = result.className\n ? `${marker.className} ${result.className}`\n : marker.className;\n }\n\n return {\n ...result,\n [ELEMENT_CSS_DATA_ATTR]: createRscStylePayload(marker ? [marker.rule, ...rules] : rules),\n };\n}\n\nexport function createRscStylePayload(rules: readonly SheetRule[]): string {\n return JSON.stringify(rules.map(createRscStylePayloadRule));\n}\n\nfunction createRscStylePayloadRule(rule: SheetRule): RscStylePayloadRule {\n return {\n key: rule.key,\n css: rule.css,\n priority: rule.priority,\n callsite: isElementMarkerRule(rule) ? rule.callsite : undefined,\n debug: rule.debug ? createRscDebugPayload(rule.debug, rule.debugField) : undefined,\n debugField: rule.debugField,\n };\n}\n\nfunction createRscDebugPayload(\n debug: DebugData,\n debugField: string | null | undefined,\n): DebugData {\n const { code: _code, fields, ...payload } = debug;\n\n if (!debugField || !fields?.[debugField]) {\n return payload;\n }\n\n return {\n ...payload,\n fields: {\n [debugField]: fields[debugField],\n },\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import { createTransformElement } from '../core/createTransformElement';\nimport { getClassName } from './getClassName';\n\nexport const transformElement = createTransformElement(getClassName);\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,gBAAgB,gBACZ,GAAG,cAAc,GAAG,SACpB;CAER;CAEA,OAAO,iBAAiB,KAAA;AAC1B;AAEA,SAAgB,WAAW,OAA6B;CACtD,IAAI,CAA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AM;EAAM;EAE1D,MAAM,EAAE,KAAK,GAAG,SAAS;EAEzB,IAAI,CAAC,KAAK,OAAO;GAAE;GAAM,OAAO;EAAK;EAErC,MAAM,SAAS,4BAA4B,GAAG;EAE9C,IAAI,OAAO,WACT,OAAO,OAAO,MAAM,aAAa,OAAO,WAAW,IAAI,CAAC;EAG1D,iBAAiB,MAAM,6BAA6B,OAAO,KAAK,CAAC;EAEjE,OAAO;GAAE;GAAM,OAAO;EAAK;CAC7B;AACF;AAEA,SAAS,iBACP,OACA,WACA;CACA,IAAI,CAAC,WAAW;CAEhB,MAAM,YAAY,MAAM,YACpB,GAAG,UAAU,GAAG,MAAM,cACtB;AACN;;;ACnCA,MAAa,mBAAmB,uBAAuB,YAAY;;;ACgBnE,SAAgB,kBACd,eACA,kBACiB;CACjB,MAAM,MAAM,MAAmB,OAAgB,GAAG,aAAiB;EACjE,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,cAAc,OAAO,MAAM,OAAO,OAAO,GAAG,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,UACA;CACA,OAAO;AACT;AAEA,SAAgB,aACd,IACA,kBACU;CACV,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,SAAS;EACnD,MAAM,SAAS,iBAAiB;GAAE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
1
+ {"version":3,"file":"utils-CDUaX81o.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/rsc/getClassName.ts","../runtime/core/createTransformElement.ts","../runtime/rsc/jsx.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { LayerPriority } from '../../atomic/layer';\nimport type { DebugData } from '../../builder/data/debug';\nimport { DEV_CONFIG } from '../../config/config/dev';\nimport type { SheetRule } from '../../sheet';\nimport type { StylePropItem } from '../core/cache/prop';\nimport type { ClassNameProps, ClassNameResult } from '../core/className';\nimport {\n createElementMarkerRuleFromDebug,\n isElementMarkerRule,\n splitElementMarkerStyleProp,\n} from '../core/elementMarker';\nimport { resolveClassNameRuntime } from '../core/resolveClassNameRuntime';\nimport { collectStylePropItemsSheetRulesWithThemes } from '../sheet/rules';\nimport type { StyleProp } from '../types';\nimport { ELEMENT_CSS_DATA_ATTR } from './constants';\nimport { addRscStyleRules } from './styleStore';\n\nexport type RscStylePayloadRule = {\n key?: string | null;\n css: string;\n priority?: LayerPriority | null;\n callsite?: SheetRule['callsite'];\n debug?: DebugData | null;\n debugField?: string | null;\n};\n\nexport type ClassNameResultRSC = ClassNameResult & {\n [ELEMENT_CSS_DATA_ATTR]?: string;\n};\n\nexport function getClassName(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): ClassNameResultRSC {\n const marker = splitElementMarkerStyleProp(styleProp);\n const resolved = resolveClassNameRuntime(marker.styleProp as StyleProp, props);\n\n return DEV_CONFIG.isDev\n ? getClassNameRSC(resolved.result, resolved.items, marker.debug)\n : resolved.result;\n}\n\nexport function getClassNameRSC(\n result: ClassNameResult,\n items: readonly StylePropItem[],\n markerDebug?: ReturnType<typeof splitElementMarkerStyleProp>['debug'],\n): ClassNameResultRSC {\n const rules = collectStylePropItemsSheetRulesWithThemes(items);\n const marker = createElementMarkerRuleFromDebug(markerDebug);\n\n if (!rules.length && !marker) return result;\n\n addRscStyleRules(rules);\n\n if (marker) {\n result.className = result.className\n ? `${marker.className} ${result.className}`\n : marker.className;\n }\n\n return {\n ...result,\n [ELEMENT_CSS_DATA_ATTR]: createRscStylePayload(marker ? [marker.rule, ...rules] : rules),\n };\n}\n\nexport function createRscStylePayload(rules: readonly SheetRule[]): string {\n return JSON.stringify(rules.map(createRscStylePayloadRule));\n}\n\nfunction createRscStylePayloadRule(rule: SheetRule): RscStylePayloadRule {\n return {\n key: rule.key,\n css: rule.css,\n priority: rule.priority,\n callsite: isElementMarkerRule(rule) ? rule.callsite : undefined,\n debug: rule.debug ? createRscDebugPayload(rule.debug, rule.debugField) : undefined,\n debugField: rule.debugField,\n };\n}\n\nfunction createRscDebugPayload(\n debug: DebugData,\n debugField: string | null | undefined,\n): DebugData {\n const { code: _code, fields, ...payload } = debug;\n\n if (!debugField || !fields?.[debugField]) {\n return payload;\n }\n\n return {\n ...payload,\n fields: {\n [debugField]: fields[debugField],\n },\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import { createTransformElement } from '../core/createTransformElement';\nimport { getClassName } from './getClassName';\n\nexport const transformElement = createTransformElement(getClassName);\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC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AE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
@@ -1,5 +1,5 @@
1
- import { o as normalizePath } from "./compiler-D5v5tJXI.mjs";
2
- import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-CiwvMfx8.mjs";
1
+ import { o as normalizePath } from "./compiler-CE0ZgkdH.mjs";
2
+ import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-IaXmLQzA.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  //#region plugin/bundler/webpack/utils.ts
@@ -46,4 +46,4 @@ function prependEntryImport(entryImport, runtimeFilePath) {
46
46
  //#endregion
47
47
  export { prependWebpackRuntimeEntry as a, hasWebpackCssMarker as i, getStylePackageDistPath as n, replaceWebpackCssMarker as o, getTransformLoaderPath as r, webpackRegistry as s, createWebpackRuntimeModuleSource as t };
48
48
 
49
- //# sourceMappingURL=utils-DTXCTUlS.mjs.map
49
+ //# sourceMappingURL=utils-DaAiEEIG.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-DTXCTUlS.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa,kBAAkB,sBAAsB,kBAAkB;AAEvE,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,cAAc,SAAS,iBAAiB;AACxF;AAEA,SAAgB,0BAA0B;CACxC,OAAO,KAAK,QAAQ,KAAK,QAAQ,uBAAuB,CAAC,GAAG,OAAO;AACrE;AAEA,SAAgB,iCACd,SACA,aACA,UAGI,CAAC,GACL;CACA,OAAO;EACL,WAAW,eAAe,UAAU,KAAK,UAAU,cAAc,WAAW,CAAC,EAAE;EAC/E,QAAQ,cAAc,QAAQ,qBAAqB,UAAU,KAAK,UAAU,QAAQ,iBAAiB,EAAE;EACvG,QAAQ,cACR,yBAAyB,KAAK,UAAA,4BAAmC,EAAE,OAAO,KAAK,UAAU,QAAQ,UAAU,EAAE;EAC7G;CACF,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI;AAC7B;AAEA,SAAgB,wBACd,QACA,QACA,KACA;CACA,OAAO,OAAO,QAAQ,QAAQ,GAAG;AACnC;AAEA,SAAgB,oBAAoB,QAAgB,QAAgB;CAClE,OAAO,OAAO,SAAS,MAAM;AAC/B;AAEA,SAAgB,2BACd,OACA,iBACiB;CACjB,IAAI,OAAO,UAAU,YACnB,OAAO,YAAY,iCAAiC,MAAM,MAAM,GAAG,eAAe;CAGpF,OAAO,iCAAiC,OAAO,eAAe;AAChE;AAEA,SAAS,iCACP,OACA,iBACoB;CACpB,MAAM,SAA6B,CAAC;CAEpC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,OAAO,OAAO,sCAAsC,OAAO,eAAe;CAG5E,OAAO;AACT;AAEA,SAAS,sCACP,OACA,iBACyB;CACzB,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,OAAO;EACL,GAAG;EACH,QAAQ,mBAAmB,MAAM,QAAQ,eAAe;CAC1D;AACF;AAEA,SAAS,mBAAmB,aAAuB,iBAAyB;CAC1E,OAAO,YAAY,SAAS,eAAe,IACvC,cACA,CAAC,iBAAiB,GAAG,WAAW;AACtC"}
1
+ {"version":3,"file":"utils-DaAiEEIG.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa,kBAAkB,sBAAsB,kBAAkB;AAEvE,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,cAAc,SAAS,iBAAiB;AACxF;AAEA,SAAgB,0BAA0B;CACxC,OAAO,KAAK,QAAQ,KAAK,QAAQ,uBAAuB,CAAC,GAAG,OAAO;AACrE;AAEA,SAAgB,iCACd,SACA,aACA,UAGI,CAAC,GACL;CACA,OAAO;EACL,WAAW,eAAe,UAAU,KAAK,UAAU,cAAc,WAAW,CAAC,EAAE;EAC/E,QAAQ,cAAc,QAAQ,qBAAqB,UAAU,KAAK,UAAU,QAAQ,iBAAiB,EAAE;EACvG,QAAQ,cACR,yBAAyB,KAAK,UAAA,4BAAmC,EAAE,OAAO,KAAK,UAAU,QAAQ,UAAU,EAAE;EAC7G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