@nanoforge-dev/editor 0.0.1

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 (415) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -0
  3. package/dist/client/_app/immutable/assets/0.562EP7L3.css +1 -0
  4. package/dist/client/_app/immutable/assets/0.562EP7L3.css.br +0 -0
  5. package/dist/client/_app/immutable/assets/0.562EP7L3.css.gz +0 -0
  6. package/dist/client/_app/immutable/assets/2.Dl9w-_FK.css +1 -0
  7. package/dist/client/_app/immutable/assets/2.Dl9w-_FK.css.br +0 -0
  8. package/dist/client/_app/immutable/assets/2.Dl9w-_FK.css.gz +0 -0
  9. package/dist/client/_app/immutable/assets/api.CD54FDqW.css +1 -0
  10. package/dist/client/_app/immutable/assets/api.CD54FDqW.css.br +0 -0
  11. package/dist/client/_app/immutable/assets/api.CD54FDqW.css.gz +0 -0
  12. package/dist/client/_app/immutable/assets/codicon.ngg6Pgfi.ttf +0 -0
  13. package/dist/client/_app/immutable/assets/defaultProjectCover.BHxYINJa.png +0 -0
  14. package/dist/client/_app/immutable/assets/editor.BuC0XPbM.css +1 -0
  15. package/dist/client/_app/immutable/assets/editor.BuC0XPbM.css.br +0 -0
  16. package/dist/client/_app/immutable/assets/editor.BuC0XPbM.css.gz +0 -0
  17. package/dist/client/_app/immutable/assets/logo.DMAgjcse.png +0 -0
  18. package/dist/client/_app/immutable/chunks/0wEXW2Hc2.js +1 -0
  19. package/dist/client/_app/immutable/chunks/0wEXW2Hc2.js.br +0 -0
  20. package/dist/client/_app/immutable/chunks/0wEXW2Hc2.js.gz +0 -0
  21. package/dist/client/_app/immutable/chunks/1rG2eYdz2.js +1 -0
  22. package/dist/client/_app/immutable/chunks/1rG2eYdz2.js.br +0 -0
  23. package/dist/client/_app/immutable/chunks/1rG2eYdz2.js.gz +0 -0
  24. package/dist/client/_app/immutable/chunks/5CAt0tAC.js +1 -0
  25. package/dist/client/_app/immutable/chunks/5CAt0tAC.js.br +0 -0
  26. package/dist/client/_app/immutable/chunks/5CAt0tAC.js.gz +0 -0
  27. package/dist/client/_app/immutable/chunks/5TEFcS4X2.js +1 -0
  28. package/dist/client/_app/immutable/chunks/5TEFcS4X2.js.br +3 -0
  29. package/dist/client/_app/immutable/chunks/5TEFcS4X2.js.gz +0 -0
  30. package/dist/client/_app/immutable/chunks/5k3Q8YWH.js +1 -0
  31. package/dist/client/_app/immutable/chunks/5k3Q8YWH.js.br +0 -0
  32. package/dist/client/_app/immutable/chunks/5k3Q8YWH.js.gz +0 -0
  33. package/dist/client/_app/immutable/chunks/B0Q9zT_Q.js +1 -0
  34. package/dist/client/_app/immutable/chunks/B0Q9zT_Q.js.br +0 -0
  35. package/dist/client/_app/immutable/chunks/B0Q9zT_Q.js.gz +0 -0
  36. package/dist/client/_app/immutable/chunks/B1GYE4NT.js +1 -0
  37. package/dist/client/_app/immutable/chunks/B1GYE4NT.js.br +0 -0
  38. package/dist/client/_app/immutable/chunks/B1GYE4NT.js.gz +0 -0
  39. package/dist/client/_app/immutable/chunks/B1bBmRUz2.js +1 -0
  40. package/dist/client/_app/immutable/chunks/B1bBmRUz2.js.br +0 -0
  41. package/dist/client/_app/immutable/chunks/B1bBmRUz2.js.gz +0 -0
  42. package/dist/client/_app/immutable/chunks/B3IjbASq.js +1 -0
  43. package/dist/client/_app/immutable/chunks/B3IjbASq.js.br +0 -0
  44. package/dist/client/_app/immutable/chunks/B3IjbASq.js.gz +0 -0
  45. package/dist/client/_app/immutable/chunks/B3VOL0kZ.js +1 -0
  46. package/dist/client/_app/immutable/chunks/B3VOL0kZ.js.br +0 -0
  47. package/dist/client/_app/immutable/chunks/B3VOL0kZ.js.gz +0 -0
  48. package/dist/client/_app/immutable/chunks/B5crfj0i.js +1 -0
  49. package/dist/client/_app/immutable/chunks/B5crfj0i.js.br +0 -0
  50. package/dist/client/_app/immutable/chunks/B5crfj0i.js.gz +0 -0
  51. package/dist/client/_app/immutable/chunks/BAtlESPp.js +1 -0
  52. package/dist/client/_app/immutable/chunks/BAtlESPp.js.br +3 -0
  53. package/dist/client/_app/immutable/chunks/BAtlESPp.js.gz +0 -0
  54. package/dist/client/_app/immutable/chunks/BCAAnHTF2.js +1 -0
  55. package/dist/client/_app/immutable/chunks/BCAAnHTF2.js.br +0 -0
  56. package/dist/client/_app/immutable/chunks/BCAAnHTF2.js.gz +0 -0
  57. package/dist/client/_app/immutable/chunks/BEN0jOJp.js +1 -0
  58. package/dist/client/_app/immutable/chunks/BEN0jOJp.js.br +0 -0
  59. package/dist/client/_app/immutable/chunks/BEN0jOJp.js.gz +0 -0
  60. package/dist/client/_app/immutable/chunks/BHHccBgG2.js +1 -0
  61. package/dist/client/_app/immutable/chunks/BHHccBgG2.js.br +0 -0
  62. package/dist/client/_app/immutable/chunks/BHHccBgG2.js.gz +0 -0
  63. package/dist/client/_app/immutable/chunks/BHxBHC3k.js +1 -0
  64. package/dist/client/_app/immutable/chunks/BHxBHC3k.js.br +0 -0
  65. package/dist/client/_app/immutable/chunks/BHxBHC3k.js.gz +0 -0
  66. package/dist/client/_app/immutable/chunks/BK6ghPUh.js +1 -0
  67. package/dist/client/_app/immutable/chunks/BK6ghPUh.js.br +0 -0
  68. package/dist/client/_app/immutable/chunks/BK6ghPUh.js.gz +0 -0
  69. package/dist/client/_app/immutable/chunks/BL9YzxJT.js +1 -0
  70. package/dist/client/_app/immutable/chunks/BL9YzxJT.js.br +0 -0
  71. package/dist/client/_app/immutable/chunks/BL9YzxJT.js.gz +0 -0
  72. package/dist/client/_app/immutable/chunks/BNqbTcCU.js +1 -0
  73. package/dist/client/_app/immutable/chunks/BNqbTcCU.js.br +0 -0
  74. package/dist/client/_app/immutable/chunks/BNqbTcCU.js.gz +0 -0
  75. package/dist/client/_app/immutable/chunks/BSRtLNCV.js +3 -0
  76. package/dist/client/_app/immutable/chunks/BSRtLNCV.js.br +0 -0
  77. package/dist/client/_app/immutable/chunks/BSRtLNCV.js.gz +0 -0
  78. package/dist/client/_app/immutable/chunks/BSa9oWuP.js +1 -0
  79. package/dist/client/_app/immutable/chunks/BSa9oWuP.js.br +0 -0
  80. package/dist/client/_app/immutable/chunks/BSa9oWuP.js.gz +0 -0
  81. package/dist/client/_app/immutable/chunks/BTEHXt4u.js +1 -0
  82. package/dist/client/_app/immutable/chunks/BTEHXt4u.js.br +0 -0
  83. package/dist/client/_app/immutable/chunks/BTEHXt4u.js.gz +0 -0
  84. package/dist/client/_app/immutable/chunks/BUMhJFWc.js +2 -0
  85. package/dist/client/_app/immutable/chunks/BUMhJFWc.js.br +0 -0
  86. package/dist/client/_app/immutable/chunks/BUMhJFWc.js.gz +0 -0
  87. package/dist/client/_app/immutable/chunks/BXNW00E2.js +1 -0
  88. package/dist/client/_app/immutable/chunks/BXNW00E2.js.br +0 -0
  89. package/dist/client/_app/immutable/chunks/BXNW00E2.js.gz +0 -0
  90. package/dist/client/_app/immutable/chunks/B__0yjCH2.js +1 -0
  91. package/dist/client/_app/immutable/chunks/B__0yjCH2.js.br +0 -0
  92. package/dist/client/_app/immutable/chunks/B__0yjCH2.js.gz +0 -0
  93. package/dist/client/_app/immutable/chunks/B_rYXvqX.js +1 -0
  94. package/dist/client/_app/immutable/chunks/B_rYXvqX.js.br +0 -0
  95. package/dist/client/_app/immutable/chunks/B_rYXvqX.js.gz +0 -0
  96. package/dist/client/_app/immutable/chunks/BaORWDBQ.js +1 -0
  97. package/dist/client/_app/immutable/chunks/BaORWDBQ.js.br +0 -0
  98. package/dist/client/_app/immutable/chunks/BaORWDBQ.js.gz +0 -0
  99. package/dist/client/_app/immutable/chunks/BeRB61Rp.js +1 -0
  100. package/dist/client/_app/immutable/chunks/BeRB61Rp.js.br +0 -0
  101. package/dist/client/_app/immutable/chunks/BeRB61Rp.js.gz +0 -0
  102. package/dist/client/_app/immutable/chunks/Berct1R62.js +1 -0
  103. package/dist/client/_app/immutable/chunks/Berct1R62.js.br +0 -0
  104. package/dist/client/_app/immutable/chunks/Berct1R62.js.gz +0 -0
  105. package/dist/client/_app/immutable/chunks/Bi01QGTh2.js +7 -0
  106. package/dist/client/_app/immutable/chunks/Bi01QGTh2.js.br +0 -0
  107. package/dist/client/_app/immutable/chunks/Bi01QGTh2.js.gz +0 -0
  108. package/dist/client/_app/immutable/chunks/BnEty9Zf.js +3 -0
  109. package/dist/client/_app/immutable/chunks/BnEty9Zf.js.br +0 -0
  110. package/dist/client/_app/immutable/chunks/BnEty9Zf.js.gz +0 -0
  111. package/dist/client/_app/immutable/chunks/Bp42GhE_.js +1 -0
  112. package/dist/client/_app/immutable/chunks/Bp42GhE_.js.br +0 -0
  113. package/dist/client/_app/immutable/chunks/Bp42GhE_.js.gz +0 -0
  114. package/dist/client/_app/immutable/chunks/BqR20QL0.js +1 -0
  115. package/dist/client/_app/immutable/chunks/BqR20QL0.js.br +0 -0
  116. package/dist/client/_app/immutable/chunks/BqR20QL0.js.gz +0 -0
  117. package/dist/client/_app/immutable/chunks/BuvsQ_0P.js +1 -0
  118. package/dist/client/_app/immutable/chunks/BuvsQ_0P.js.br +0 -0
  119. package/dist/client/_app/immutable/chunks/BuvsQ_0P.js.gz +0 -0
  120. package/dist/client/_app/immutable/chunks/BwWFGvpp2.js +6 -0
  121. package/dist/client/_app/immutable/chunks/BwWFGvpp2.js.br +0 -0
  122. package/dist/client/_app/immutable/chunks/BwWFGvpp2.js.gz +0 -0
  123. package/dist/client/_app/immutable/chunks/BxyUv_372.js +1 -0
  124. package/dist/client/_app/immutable/chunks/BxyUv_372.js.br +0 -0
  125. package/dist/client/_app/immutable/chunks/BxyUv_372.js.gz +0 -0
  126. package/dist/client/_app/immutable/chunks/C459oz3p.js +1 -0
  127. package/dist/client/_app/immutable/chunks/C459oz3p.js.br +0 -0
  128. package/dist/client/_app/immutable/chunks/C459oz3p.js.gz +0 -0
  129. package/dist/client/_app/immutable/chunks/C4oBl-ul.js +1 -0
  130. package/dist/client/_app/immutable/chunks/C4oBl-ul.js.br +0 -0
  131. package/dist/client/_app/immutable/chunks/C4oBl-ul.js.gz +0 -0
  132. package/dist/client/_app/immutable/chunks/C5dBxjD0.js +1 -0
  133. package/dist/client/_app/immutable/chunks/C5dBxjD0.js.br +0 -0
  134. package/dist/client/_app/immutable/chunks/C5dBxjD0.js.gz +0 -0
  135. package/dist/client/_app/immutable/chunks/C7TuqZTk.js +1 -0
  136. package/dist/client/_app/immutable/chunks/C7TuqZTk.js.br +0 -0
  137. package/dist/client/_app/immutable/chunks/C7TuqZTk.js.gz +0 -0
  138. package/dist/client/_app/immutable/chunks/C84aX3eL2.js +2 -0
  139. package/dist/client/_app/immutable/chunks/C84aX3eL2.js.br +0 -0
  140. package/dist/client/_app/immutable/chunks/C84aX3eL2.js.gz +0 -0
  141. package/dist/client/_app/immutable/chunks/CGFoxiJT2.js +1 -0
  142. package/dist/client/_app/immutable/chunks/CGFoxiJT2.js.br +0 -0
  143. package/dist/client/_app/immutable/chunks/CGFoxiJT2.js.gz +0 -0
  144. package/dist/client/_app/immutable/chunks/CGdCAl_w2.js +1 -0
  145. package/dist/client/_app/immutable/chunks/CGdCAl_w2.js.br +0 -0
  146. package/dist/client/_app/immutable/chunks/CGdCAl_w2.js.gz +0 -0
  147. package/dist/client/_app/immutable/chunks/CJL4GRLV2.js +1 -0
  148. package/dist/client/_app/immutable/chunks/CJL4GRLV2.js.br +0 -0
  149. package/dist/client/_app/immutable/chunks/CJL4GRLV2.js.gz +0 -0
  150. package/dist/client/_app/immutable/chunks/CKihvhpr.js +1 -0
  151. package/dist/client/_app/immutable/chunks/CKihvhpr.js.br +0 -0
  152. package/dist/client/_app/immutable/chunks/CKihvhpr.js.gz +0 -0
  153. package/dist/client/_app/immutable/chunks/CKybJfA6.js +1 -0
  154. package/dist/client/_app/immutable/chunks/CKybJfA6.js.br +0 -0
  155. package/dist/client/_app/immutable/chunks/CKybJfA6.js.gz +0 -0
  156. package/dist/client/_app/immutable/chunks/CQai7aNJ.js +1 -0
  157. package/dist/client/_app/immutable/chunks/CQai7aNJ.js.br +0 -0
  158. package/dist/client/_app/immutable/chunks/CQai7aNJ.js.gz +0 -0
  159. package/dist/client/_app/immutable/chunks/CQghOihB.js +1 -0
  160. package/dist/client/_app/immutable/chunks/CQghOihB.js.br +0 -0
  161. package/dist/client/_app/immutable/chunks/CQghOihB.js.gz +0 -0
  162. package/dist/client/_app/immutable/chunks/CTK4WrGL2.js +1 -0
  163. package/dist/client/_app/immutable/chunks/CTK4WrGL2.js.br +0 -0
  164. package/dist/client/_app/immutable/chunks/CTK4WrGL2.js.gz +0 -0
  165. package/dist/client/_app/immutable/chunks/CUVqITEW2.js +1 -0
  166. package/dist/client/_app/immutable/chunks/CUVqITEW2.js.br +0 -0
  167. package/dist/client/_app/immutable/chunks/CUVqITEW2.js.gz +0 -0
  168. package/dist/client/_app/immutable/chunks/CVmNMiIj.js +1 -0
  169. package/dist/client/_app/immutable/chunks/CVmNMiIj.js.br +0 -0
  170. package/dist/client/_app/immutable/chunks/CVmNMiIj.js.gz +0 -0
  171. package/dist/client/_app/immutable/chunks/CW_66Q8N.js +872 -0
  172. package/dist/client/_app/immutable/chunks/CW_66Q8N.js.br +0 -0
  173. package/dist/client/_app/immutable/chunks/CW_66Q8N.js.gz +0 -0
  174. package/dist/client/_app/immutable/chunks/CXBbh9s-.js +1 -0
  175. package/dist/client/_app/immutable/chunks/CXBbh9s-.js.br +0 -0
  176. package/dist/client/_app/immutable/chunks/CXBbh9s-.js.gz +0 -0
  177. package/dist/client/_app/immutable/chunks/CXlfFz7D2.js +1 -0
  178. package/dist/client/_app/immutable/chunks/CXlfFz7D2.js.br +0 -0
  179. package/dist/client/_app/immutable/chunks/CXlfFz7D2.js.gz +0 -0
  180. package/dist/client/_app/immutable/chunks/C_QqwttH.js +1 -0
  181. package/dist/client/_app/immutable/chunks/C_QqwttH.js.br +0 -0
  182. package/dist/client/_app/immutable/chunks/C_QqwttH.js.gz +0 -0
  183. package/dist/client/_app/immutable/chunks/CbFxQFBh.js +1 -0
  184. package/dist/client/_app/immutable/chunks/CbFxQFBh.js.br +0 -0
  185. package/dist/client/_app/immutable/chunks/CbFxQFBh.js.gz +0 -0
  186. package/dist/client/_app/immutable/chunks/CmjNmBcK.js +1 -0
  187. package/dist/client/_app/immutable/chunks/CmjNmBcK.js.br +0 -0
  188. package/dist/client/_app/immutable/chunks/CmjNmBcK.js.gz +0 -0
  189. package/dist/client/_app/immutable/chunks/CntDmp6G.js +1 -0
  190. package/dist/client/_app/immutable/chunks/CntDmp6G.js.br +0 -0
  191. package/dist/client/_app/immutable/chunks/CntDmp6G.js.gz +0 -0
  192. package/dist/client/_app/immutable/chunks/CqqoQT4S.js +2 -0
  193. package/dist/client/_app/immutable/chunks/CqqoQT4S.js.br +0 -0
  194. package/dist/client/_app/immutable/chunks/CqqoQT4S.js.gz +0 -0
  195. package/dist/client/_app/immutable/chunks/CtzzCjLE2.js +1 -0
  196. package/dist/client/_app/immutable/chunks/CtzzCjLE2.js.br +0 -0
  197. package/dist/client/_app/immutable/chunks/CtzzCjLE2.js.gz +0 -0
  198. package/dist/client/_app/immutable/chunks/CziQemry2.js +1 -0
  199. package/dist/client/_app/immutable/chunks/CziQemry2.js.br +0 -0
  200. package/dist/client/_app/immutable/chunks/CziQemry2.js.gz +0 -0
  201. package/dist/client/_app/immutable/chunks/Czovc13W.js +1 -0
  202. package/dist/client/_app/immutable/chunks/Czovc13W.js.br +0 -0
  203. package/dist/client/_app/immutable/chunks/Czovc13W.js.gz +0 -0
  204. package/dist/client/_app/immutable/chunks/D38BHtSY.js +298 -0
  205. package/dist/client/_app/immutable/chunks/D38BHtSY.js.br +0 -0
  206. package/dist/client/_app/immutable/chunks/D38BHtSY.js.gz +0 -0
  207. package/dist/client/_app/immutable/chunks/DBkS_L3S.js +1 -0
  208. package/dist/client/_app/immutable/chunks/DBkS_L3S.js.br +0 -0
  209. package/dist/client/_app/immutable/chunks/DBkS_L3S.js.gz +0 -0
  210. package/dist/client/_app/immutable/chunks/DEoC-BX-.js +11 -0
  211. package/dist/client/_app/immutable/chunks/DEoC-BX-.js.br +0 -0
  212. package/dist/client/_app/immutable/chunks/DEoC-BX-.js.gz +0 -0
  213. package/dist/client/_app/immutable/chunks/DHkiqSLl.js +1 -0
  214. package/dist/client/_app/immutable/chunks/DHkiqSLl.js.br +0 -0
  215. package/dist/client/_app/immutable/chunks/DHkiqSLl.js.gz +0 -0
  216. package/dist/client/_app/immutable/chunks/DL7ZpfJd.js +1 -0
  217. package/dist/client/_app/immutable/chunks/DL7ZpfJd.js.br +0 -0
  218. package/dist/client/_app/immutable/chunks/DL7ZpfJd.js.gz +0 -0
  219. package/dist/client/_app/immutable/chunks/DUC3NMun2.js +4 -0
  220. package/dist/client/_app/immutable/chunks/DUC3NMun2.js.br +0 -0
  221. package/dist/client/_app/immutable/chunks/DUC3NMun2.js.gz +0 -0
  222. package/dist/client/_app/immutable/chunks/DWUlubL2.js +1 -0
  223. package/dist/client/_app/immutable/chunks/DWUlubL2.js.br +0 -0
  224. package/dist/client/_app/immutable/chunks/DWUlubL2.js.gz +0 -0
  225. package/dist/client/_app/immutable/chunks/D_HtEbjl.js +1 -0
  226. package/dist/client/_app/immutable/chunks/D_HtEbjl.js.br +0 -0
  227. package/dist/client/_app/immutable/chunks/D_HtEbjl.js.gz +0 -0
  228. package/dist/client/_app/immutable/chunks/DaCLQrfC.js +1 -0
  229. package/dist/client/_app/immutable/chunks/DaCLQrfC.js.br +0 -0
  230. package/dist/client/_app/immutable/chunks/DaCLQrfC.js.gz +0 -0
  231. package/dist/client/_app/immutable/chunks/DbxPn-f9.js +1 -0
  232. package/dist/client/_app/immutable/chunks/DbxPn-f9.js.br +0 -0
  233. package/dist/client/_app/immutable/chunks/DbxPn-f9.js.gz +0 -0
  234. package/dist/client/_app/immutable/chunks/DhPi0T7V2.js +1 -0
  235. package/dist/client/_app/immutable/chunks/DhPi0T7V2.js.br +0 -0
  236. package/dist/client/_app/immutable/chunks/DhPi0T7V2.js.gz +0 -0
  237. package/dist/client/_app/immutable/chunks/DkZEX-tr.js +1 -0
  238. package/dist/client/_app/immutable/chunks/DkZEX-tr.js.br +0 -0
  239. package/dist/client/_app/immutable/chunks/DkZEX-tr.js.gz +0 -0
  240. package/dist/client/_app/immutable/chunks/Dqs1VwMg2.js +1 -0
  241. package/dist/client/_app/immutable/chunks/Dqs1VwMg2.js.br +0 -0
  242. package/dist/client/_app/immutable/chunks/Dqs1VwMg2.js.gz +0 -0
  243. package/dist/client/_app/immutable/chunks/DrDIkqkr2.js +1 -0
  244. package/dist/client/_app/immutable/chunks/DrDIkqkr2.js.br +0 -0
  245. package/dist/client/_app/immutable/chunks/DrDIkqkr2.js.gz +0 -0
  246. package/dist/client/_app/immutable/chunks/DunPnEs5.js +1 -0
  247. package/dist/client/_app/immutable/chunks/DunPnEs5.js.br +0 -0
  248. package/dist/client/_app/immutable/chunks/DunPnEs5.js.gz +0 -0
  249. package/dist/client/_app/immutable/chunks/DxLN9Q9A.js +1 -0
  250. package/dist/client/_app/immutable/chunks/DxLN9Q9A.js.br +0 -0
  251. package/dist/client/_app/immutable/chunks/DxLN9Q9A.js.gz +0 -0
  252. package/dist/client/_app/immutable/chunks/GhmjqkHA.js +1 -0
  253. package/dist/client/_app/immutable/chunks/GhmjqkHA.js.br +0 -0
  254. package/dist/client/_app/immutable/chunks/GhmjqkHA.js.gz +0 -0
  255. package/dist/client/_app/immutable/chunks/H_bCfo1Z.js +1 -0
  256. package/dist/client/_app/immutable/chunks/H_bCfo1Z.js.br +1 -0
  257. package/dist/client/_app/immutable/chunks/H_bCfo1Z.js.gz +0 -0
  258. package/dist/client/_app/immutable/chunks/KoMdYtDs2.js +1 -0
  259. package/dist/client/_app/immutable/chunks/KoMdYtDs2.js.br +0 -0
  260. package/dist/client/_app/immutable/chunks/KoMdYtDs2.js.gz +0 -0
  261. package/dist/client/_app/immutable/chunks/OELm4xo1.js +1 -0
  262. package/dist/client/_app/immutable/chunks/OELm4xo1.js.br +0 -0
  263. package/dist/client/_app/immutable/chunks/OELm4xo1.js.gz +0 -0
  264. package/dist/client/_app/immutable/chunks/OdxrjoDx.js +1 -0
  265. package/dist/client/_app/immutable/chunks/OdxrjoDx.js.br +0 -0
  266. package/dist/client/_app/immutable/chunks/OdxrjoDx.js.gz +0 -0
  267. package/dist/client/_app/immutable/chunks/SlhV96tq.js +1 -0
  268. package/dist/client/_app/immutable/chunks/SlhV96tq.js.br +0 -0
  269. package/dist/client/_app/immutable/chunks/SlhV96tq.js.gz +0 -0
  270. package/dist/client/_app/immutable/chunks/X9L1iai42.js +1 -0
  271. package/dist/client/_app/immutable/chunks/X9L1iai42.js.br +0 -0
  272. package/dist/client/_app/immutable/chunks/X9L1iai42.js.gz +0 -0
  273. package/dist/client/_app/immutable/chunks/XIokwnxj2.js +11 -0
  274. package/dist/client/_app/immutable/chunks/XIokwnxj2.js.br +0 -0
  275. package/dist/client/_app/immutable/chunks/XIokwnxj2.js.gz +0 -0
  276. package/dist/client/_app/immutable/chunks/ZmwXQQ8p.js +1 -0
  277. package/dist/client/_app/immutable/chunks/ZmwXQQ8p.js.br +0 -0
  278. package/dist/client/_app/immutable/chunks/ZmwXQQ8p.js.gz +0 -0
  279. package/dist/client/_app/immutable/chunks/acVTcwNd.js +1 -0
  280. package/dist/client/_app/immutable/chunks/acVTcwNd.js.br +0 -0
  281. package/dist/client/_app/immutable/chunks/acVTcwNd.js.gz +0 -0
  282. package/dist/client/_app/immutable/chunks/bLoc39kl.js +2 -0
  283. package/dist/client/_app/immutable/chunks/bLoc39kl.js.br +0 -0
  284. package/dist/client/_app/immutable/chunks/bLoc39kl.js.gz +0 -0
  285. package/dist/client/_app/immutable/chunks/dm7qVrFn2.js +1 -0
  286. package/dist/client/_app/immutable/chunks/dm7qVrFn2.js.br +0 -0
  287. package/dist/client/_app/immutable/chunks/dm7qVrFn2.js.gz +0 -0
  288. package/dist/client/_app/immutable/chunks/if7vWS9-.js +1 -0
  289. package/dist/client/_app/immutable/chunks/if7vWS9-.js.br +0 -0
  290. package/dist/client/_app/immutable/chunks/if7vWS9-.js.gz +0 -0
  291. package/dist/client/_app/immutable/chunks/kAc38cH_.js +3 -0
  292. package/dist/client/_app/immutable/chunks/kAc38cH_.js.br +0 -0
  293. package/dist/client/_app/immutable/chunks/kAc38cH_.js.gz +0 -0
  294. package/dist/client/_app/immutable/chunks/kks0AxFY2.js +1 -0
  295. package/dist/client/_app/immutable/chunks/kks0AxFY2.js.br +0 -0
  296. package/dist/client/_app/immutable/chunks/kks0AxFY2.js.gz +0 -0
  297. package/dist/client/_app/immutable/chunks/mA7hbneB.js +3 -0
  298. package/dist/client/_app/immutable/chunks/mA7hbneB.js.br +0 -0
  299. package/dist/client/_app/immutable/chunks/mA7hbneB.js.gz +0 -0
  300. package/dist/client/_app/immutable/chunks/qWHUp0PJ2.js +1 -0
  301. package/dist/client/_app/immutable/chunks/qWHUp0PJ2.js.br +0 -0
  302. package/dist/client/_app/immutable/chunks/qWHUp0PJ2.js.gz +0 -0
  303. package/dist/client/_app/immutable/chunks/u6JPB_fg2.js +1 -0
  304. package/dist/client/_app/immutable/chunks/u6JPB_fg2.js.br +0 -0
  305. package/dist/client/_app/immutable/chunks/u6JPB_fg2.js.gz +0 -0
  306. package/dist/client/_app/immutable/chunks/v_jBEYI6.js +1 -0
  307. package/dist/client/_app/immutable/chunks/v_jBEYI6.js.br +1 -0
  308. package/dist/client/_app/immutable/chunks/v_jBEYI6.js.gz +0 -0
  309. package/dist/client/_app/immutable/chunks/x4VkYCou2.js +1 -0
  310. package/dist/client/_app/immutable/chunks/x4VkYCou2.js.br +0 -0
  311. package/dist/client/_app/immutable/chunks/x4VkYCou2.js.gz +0 -0
  312. package/dist/client/_app/immutable/entry/app.CrM2Umgq.js +2 -0
  313. package/dist/client/_app/immutable/entry/app.CrM2Umgq.js.br +0 -0
  314. package/dist/client/_app/immutable/entry/app.CrM2Umgq.js.gz +0 -0
  315. package/dist/client/_app/immutable/entry/start.25Vi3KZA.js +1 -0
  316. package/dist/client/_app/immutable/entry/start.25Vi3KZA.js.br +0 -0
  317. package/dist/client/_app/immutable/entry/start.25Vi3KZA.js.gz +0 -0
  318. package/dist/client/_app/immutable/nodes/0.Ck5XUPzX.js +1 -0
  319. package/dist/client/_app/immutable/nodes/0.Ck5XUPzX.js.br +0 -0
  320. package/dist/client/_app/immutable/nodes/0.Ck5XUPzX.js.gz +0 -0
  321. package/dist/client/_app/immutable/nodes/1.Dpx0WKl2.js +1 -0
  322. package/dist/client/_app/immutable/nodes/1.Dpx0WKl2.js.br +0 -0
  323. package/dist/client/_app/immutable/nodes/1.Dpx0WKl2.js.gz +0 -0
  324. package/dist/client/_app/immutable/nodes/2.CwofzauD.js +4 -0
  325. package/dist/client/_app/immutable/nodes/2.CwofzauD.js.br +0 -0
  326. package/dist/client/_app/immutable/nodes/2.CwofzauD.js.gz +0 -0
  327. package/dist/client/_app/immutable/nodes/3.CU9DPzka.js +1 -0
  328. package/dist/client/_app/immutable/nodes/3.CU9DPzka.js.br +0 -0
  329. package/dist/client/_app/immutable/nodes/3.CU9DPzka.js.gz +0 -0
  330. package/dist/client/_app/immutable/nodes/4.P9ayzmJ4.js +5 -0
  331. package/dist/client/_app/immutable/nodes/4.P9ayzmJ4.js.br +0 -0
  332. package/dist/client/_app/immutable/nodes/4.P9ayzmJ4.js.gz +0 -0
  333. package/dist/client/_app/immutable/nodes/5.Dcsjm3Pq.js +1 -0
  334. package/dist/client/_app/immutable/nodes/5.Dcsjm3Pq.js.br +0 -0
  335. package/dist/client/_app/immutable/nodes/5.Dcsjm3Pq.js.gz +0 -0
  336. package/dist/client/_app/immutable/workers/css.worker-DRFWP4k7.js +89 -0
  337. package/dist/client/_app/immutable/workers/css.worker-DRFWP4k7.js.br +0 -0
  338. package/dist/client/_app/immutable/workers/css.worker-DRFWP4k7.js.gz +0 -0
  339. package/dist/client/_app/immutable/workers/html.worker-CXAEVlCI.js +502 -0
  340. package/dist/client/_app/immutable/workers/html.worker-CXAEVlCI.js.br +0 -0
  341. package/dist/client/_app/immutable/workers/html.worker-CXAEVlCI.js.gz +0 -0
  342. package/dist/client/_app/immutable/workers/json.worker-Dkwen84u.js +58 -0
  343. package/dist/client/_app/immutable/workers/json.worker-Dkwen84u.js.br +0 -0
  344. package/dist/client/_app/immutable/workers/json.worker-Dkwen84u.js.gz +0 -0
  345. package/dist/client/_app/immutable/workers/ts.worker-DJwDx_mp.js +67719 -0
  346. package/dist/client/_app/immutable/workers/ts.worker-DJwDx_mp.js.br +0 -0
  347. package/dist/client/_app/immutable/workers/ts.worker-DJwDx_mp.js.gz +0 -0
  348. package/dist/client/_app/version.json +1 -0
  349. package/dist/client/_app/version.json.br +0 -0
  350. package/dist/client/_app/version.json.gz +0 -0
  351. package/dist/client/favicon.svg +1 -0
  352. package/dist/client/favicon.svg.br +0 -0
  353. package/dist/client/favicon.svg.gz +0 -0
  354. package/dist/client/robots.txt +3 -0
  355. package/dist/client/robots.txt.br +0 -0
  356. package/dist/client/robots.txt.gz +0 -0
  357. package/dist/env.js +32 -0
  358. package/dist/handler.js +744 -0
  359. package/dist/index.js +49 -0
  360. package/dist/server/chunks/0-DmwMCtOF.js +16 -0
  361. package/dist/server/chunks/0-DmwMCtOF.js.map +1 -0
  362. package/dist/server/chunks/1-BgVLfks1.js +17 -0
  363. package/dist/server/chunks/1-BgVLfks1.js.map +1 -0
  364. package/dist/server/chunks/2-CzdRJh2P.js +30 -0
  365. package/dist/server/chunks/2-CzdRJh2P.js.map +1 -0
  366. package/dist/server/chunks/3-C6uctiU1.js +185 -0
  367. package/dist/server/chunks/3-C6uctiU1.js.map +1 -0
  368. package/dist/server/chunks/4-BO3KTp14.js +390 -0
  369. package/dist/server/chunks/4-BO3KTp14.js.map +1 -0
  370. package/dist/server/chunks/5-LbaHRTVX.js +259 -0
  371. package/dist/server/chunks/5-LbaHRTVX.js.map +1 -0
  372. package/dist/server/chunks/_layout.svelte-BzcRjvYO.js +11 -0
  373. package/dist/server/chunks/_layout.svelte-BzcRjvYO.js.map +1 -0
  374. package/dist/server/chunks/_page.svelte-CB5X_URD.js +197 -0
  375. package/dist/server/chunks/_page.svelte-CB5X_URD.js.map +1 -0
  376. package/dist/server/chunks/_page.svelte-DMwjXpw4.js +13 -0
  377. package/dist/server/chunks/_page.svelte-DMwjXpw4.js.map +1 -0
  378. package/dist/server/chunks/_page.svelte-XIYDQw7d.js +14 -0
  379. package/dist/server/chunks/_page.svelte-XIYDQw7d.js.map +1 -0
  380. package/dist/server/chunks/_page.svelte-paWD_HcG.js +4302 -0
  381. package/dist/server/chunks/_page.svelte-paWD_HcG.js.map +1 -0
  382. package/dist/server/chunks/api-9BLkbfaG.js +9126 -0
  383. package/dist/server/chunks/api-9BLkbfaG.js.map +1 -0
  384. package/dist/server/chunks/app-l-cuFP__.js +13 -0
  385. package/dist/server/chunks/app-l-cuFP__.js.map +1 -0
  386. package/dist/server/chunks/chunk-9PtDFT_4.js +37 -0
  387. package/dist/server/chunks/client-Dx0O-q6m.js +115 -0
  388. package/dist/server/chunks/client-Dx0O-q6m.js.map +1 -0
  389. package/dist/server/chunks/dev-7V6fUCff.js +4429 -0
  390. package/dist/server/chunks/dev-7V6fUCff.js.map +1 -0
  391. package/dist/server/chunks/error.svelte-C5CCEI9O.js +102 -0
  392. package/dist/server/chunks/error.svelte-C5CCEI9O.js.map +1 -0
  393. package/dist/server/chunks/exports-j3HcL9It.js +158 -0
  394. package/dist/server/chunks/exports-j3HcL9It.js.map +1 -0
  395. package/dist/server/chunks/forms-CffPpDq6.js +36 -0
  396. package/dist/server/chunks/forms-CffPpDq6.js.map +1 -0
  397. package/dist/server/chunks/hooks.server-DqaQ1y1I.js +858 -0
  398. package/dist/server/chunks/hooks.server-DqaQ1y1I.js.map +1 -0
  399. package/dist/server/chunks/hooks.universal-0JHSyeLw.js +7 -0
  400. package/dist/server/chunks/hooks.universal-0JHSyeLw.js.map +1 -0
  401. package/dist/server/chunks/internal-BgFVxXcc.js +66 -0
  402. package/dist/server/chunks/internal-BgFVxXcc.js.map +1 -0
  403. package/dist/server/chunks/internal-BqoJe00m.js +1671 -0
  404. package/dist/server/chunks/internal-BqoJe00m.js.map +1 -0
  405. package/dist/server/chunks/runtime-ISoc6PNh.js +703 -0
  406. package/dist/server/chunks/runtime-ISoc6PNh.js.map +1 -0
  407. package/dist/server/chunks/server-BlOy0jJl.js +91 -0
  408. package/dist/server/chunks/server-BlOy0jJl.js.map +1 -0
  409. package/dist/server/chunks/shared-server-D--cyMsO.js +23 -0
  410. package/dist/server/chunks/shared-server-D--cyMsO.js.map +1 -0
  411. package/dist/server/index.js +4183 -0
  412. package/dist/server/index.js.map +1 -0
  413. package/dist/server/manifest.js +102 -0
  414. package/dist/server/manifest.js.map +1 -0
  415. package/package.json +119 -0
@@ -0,0 +1,4429 @@
1
+ //#region .svelte-kit/adapter-bun/chunks/dev.js
2
+ /** @type {Record<string, string>} */
3
+ var escaped = {
4
+ "<": "\\u003C",
5
+ "\\": "\\\\",
6
+ "\b": "\\b",
7
+ "\f": "\\f",
8
+ "\n": "\\n",
9
+ "\r": "\\r",
10
+ " ": "\\t",
11
+ "\u2028": "\\u2028",
12
+ "\u2029": "\\u2029"
13
+ };
14
+ var DevalueError = class extends Error {
15
+ /**
16
+ * @param {string} message
17
+ * @param {string[]} keys
18
+ * @param {any} [value] - The value that failed to be serialized
19
+ * @param {any} [root] - The root value being serialized
20
+ */
21
+ constructor(message, keys, value, root) {
22
+ super(message);
23
+ this.name = "DevalueError";
24
+ this.path = keys.join("");
25
+ this.value = value;
26
+ this.root = root;
27
+ }
28
+ };
29
+ /** @param {any} thing */
30
+ function is_primitive(thing) {
31
+ return thing === null || typeof thing !== "object" && typeof thing !== "function";
32
+ }
33
+ var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
34
+ /** @param {any} thing */
35
+ function is_plain_object(thing) {
36
+ const proto = Object.getPrototypeOf(thing);
37
+ return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
38
+ }
39
+ /** @param {any} thing */
40
+ function get_type(thing) {
41
+ return Object.prototype.toString.call(thing).slice(8, -1);
42
+ }
43
+ /** @param {string} char */
44
+ function get_escaped_char(char) {
45
+ switch (char) {
46
+ case "\"": return "\\\"";
47
+ case "<": return "\\u003C";
48
+ case "\\": return "\\\\";
49
+ case "\n": return "\\n";
50
+ case "\r": return "\\r";
51
+ case " ": return "\\t";
52
+ case "\b": return "\\b";
53
+ case "\f": return "\\f";
54
+ case "\u2028": return "\\u2028";
55
+ case "\u2029": return "\\u2029";
56
+ default: return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
57
+ }
58
+ }
59
+ /** @param {string} str */
60
+ function stringify_string(str) {
61
+ let result = "";
62
+ let last_pos = 0;
63
+ const len = str.length;
64
+ for (let i = 0; i < len; i += 1) {
65
+ const char = str[i];
66
+ const replacement = get_escaped_char(char);
67
+ if (replacement) {
68
+ result += str.slice(last_pos, i) + replacement;
69
+ last_pos = i + 1;
70
+ }
71
+ }
72
+ return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
73
+ }
74
+ /** @param {Record<string | symbol, any>} object */
75
+ function enumerable_symbols(object) {
76
+ return Object.getOwnPropertySymbols(object).filter((symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable);
77
+ }
78
+ var is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
79
+ /** @param {string} key */
80
+ function stringify_key(key) {
81
+ return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
82
+ }
83
+ /** @param {string} s */
84
+ function is_valid_array_index(s) {
85
+ if (s.length === 0) return false;
86
+ if (s.length > 1 && s.charCodeAt(0) === 48) return false;
87
+ for (let i = 0; i < s.length; i++) {
88
+ const c = s.charCodeAt(i);
89
+ if (c < 48 || c > 57) return false;
90
+ }
91
+ const n = +s;
92
+ if (n >= 2 ** 32 - 1) return false;
93
+ if (n < 0) return false;
94
+ return true;
95
+ }
96
+ /**
97
+ * Finds the populated indices of an array.
98
+ * @param {unknown[]} array
99
+ */
100
+ function valid_array_indices(array) {
101
+ const keys = Object.keys(array);
102
+ for (var i = keys.length - 1; i >= 0; i--) if (is_valid_array_index(keys[i])) break;
103
+ keys.length = i + 1;
104
+ return keys;
105
+ }
106
+ var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";
107
+ var unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
108
+ var reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
109
+ /**
110
+ * Turn a value into the JavaScript that creates an equivalent value
111
+ * @param {any} value
112
+ * @param {(value: any, uneval: (value: any) => string) => string | void} [replacer]
113
+ */
114
+ function uneval(value, replacer) {
115
+ const counts = /* @__PURE__ */ new Map();
116
+ /** @type {string[]} */
117
+ const keys = [];
118
+ const custom = /* @__PURE__ */ new Map();
119
+ /** @param {any} thing */
120
+ function walk(thing) {
121
+ if (!is_primitive(thing)) {
122
+ if (counts.has(thing)) {
123
+ counts.set(thing, counts.get(thing) + 1);
124
+ return;
125
+ }
126
+ counts.set(thing, 1);
127
+ if (replacer) {
128
+ const str = replacer(thing, (value) => uneval(value, replacer));
129
+ if (typeof str === "string") {
130
+ custom.set(thing, str);
131
+ return;
132
+ }
133
+ }
134
+ if (typeof thing === "function") throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
135
+ switch (get_type(thing)) {
136
+ case "Number":
137
+ case "BigInt":
138
+ case "String":
139
+ case "Boolean":
140
+ case "Date":
141
+ case "RegExp":
142
+ case "URL":
143
+ case "URLSearchParams": return;
144
+ case "Array":
145
+ /** @type {any[]} */ thing.forEach((value, i) => {
146
+ keys.push(`[${i}]`);
147
+ walk(value);
148
+ keys.pop();
149
+ });
150
+ break;
151
+ case "Set":
152
+ Array.from(thing).forEach(walk);
153
+ break;
154
+ case "Map":
155
+ for (const [key, value] of thing) {
156
+ keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`);
157
+ walk(value);
158
+ keys.pop();
159
+ }
160
+ break;
161
+ case "Int8Array":
162
+ case "Uint8Array":
163
+ case "Uint8ClampedArray":
164
+ case "Int16Array":
165
+ case "Uint16Array":
166
+ case "Float16Array":
167
+ case "Int32Array":
168
+ case "Uint32Array":
169
+ case "Float32Array":
170
+ case "Float64Array":
171
+ case "BigInt64Array":
172
+ case "BigUint64Array":
173
+ case "DataView":
174
+ walk(thing.buffer);
175
+ return;
176
+ case "ArrayBuffer": return;
177
+ case "Temporal.Duration":
178
+ case "Temporal.Instant":
179
+ case "Temporal.PlainDate":
180
+ case "Temporal.PlainTime":
181
+ case "Temporal.PlainDateTime":
182
+ case "Temporal.PlainMonthDay":
183
+ case "Temporal.PlainYearMonth":
184
+ case "Temporal.ZonedDateTime": return;
185
+ default:
186
+ if (!is_plain_object(thing)) throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
187
+ if (enumerable_symbols(thing).length > 0) throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
188
+ for (const key of Object.keys(thing)) {
189
+ if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value);
190
+ keys.push(stringify_key(key));
191
+ walk(thing[key]);
192
+ keys.pop();
193
+ }
194
+ }
195
+ } else if (typeof thing === "symbol") throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
196
+ }
197
+ walk(value);
198
+ const names = /* @__PURE__ */ new Map();
199
+ Array.from(counts).filter((entry) => entry[1] > 1).sort((a, b) => b[1] - a[1]).forEach((entry, i) => {
200
+ names.set(entry[0], get_name(i));
201
+ });
202
+ /**
203
+ * @param {any} thing
204
+ * @returns {string}
205
+ */
206
+ function stringify(thing) {
207
+ if (names.has(thing)) return names.get(thing);
208
+ if (is_primitive(thing)) return stringify_primitive(thing);
209
+ if (custom.has(thing)) return custom.get(thing);
210
+ const type = get_type(thing);
211
+ switch (type) {
212
+ case "Number":
213
+ case "String":
214
+ case "Boolean":
215
+ case "BigInt": return `Object(${stringify(thing.valueOf())})`;
216
+ case "RegExp":
217
+ const { source, flags } = thing;
218
+ return flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`;
219
+ case "Date": return `new Date(${thing.getTime()})`;
220
+ case "URL": return `new URL(${stringify_string(thing.toString())})`;
221
+ case "URLSearchParams": return `new URLSearchParams(${stringify_string(thing.toString())})`;
222
+ case "Array": {
223
+ let has_holes = false;
224
+ let result = "[";
225
+ for (let i = 0; i < thing.length; i += 1) {
226
+ if (i > 0) result += ",";
227
+ if (Object.hasOwn(thing, i)) result += stringify(thing[i]);
228
+ else if (!has_holes) {
229
+ const populated_keys = valid_array_indices(thing);
230
+ const population = populated_keys.length;
231
+ const d = String(thing.length).length;
232
+ if (thing.length + 2 > 25 + d + population * (d + 2)) {
233
+ const entries = populated_keys.map((k) => `${k}:${stringify(thing[k])}`).join(",");
234
+ return `Object.assign(Array(${thing.length}),{${entries}})`;
235
+ }
236
+ has_holes = true;
237
+ i -= 1;
238
+ }
239
+ }
240
+ const tail = thing.length === 0 || thing.length - 1 in thing ? "" : ",";
241
+ return result + tail + "]";
242
+ }
243
+ case "Set":
244
+ case "Map": return `new ${type}([${Array.from(thing).map(stringify).join(",")}])`;
245
+ case "Int8Array":
246
+ case "Uint8Array":
247
+ case "Uint8ClampedArray":
248
+ case "Int16Array":
249
+ case "Uint16Array":
250
+ case "Float16Array":
251
+ case "Int32Array":
252
+ case "Uint32Array":
253
+ case "Float32Array":
254
+ case "Float64Array":
255
+ case "BigInt64Array":
256
+ case "BigUint64Array": {
257
+ let str = `new ${type}`;
258
+ if (!names.has(thing.buffer)) {
259
+ const array = new thing.constructor(thing.buffer);
260
+ str += `([${array}])`;
261
+ } else str += `(${stringify(thing.buffer)})`;
262
+ if (thing.byteLength !== thing.buffer.byteLength) {
263
+ const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
264
+ const end = start + thing.length;
265
+ str += `.subarray(${start},${end})`;
266
+ }
267
+ return str;
268
+ }
269
+ case "DataView": {
270
+ let str = `new DataView`;
271
+ if (!names.has(thing.buffer)) str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
272
+ else str += `(${stringify(thing.buffer)}`;
273
+ if (thing.byteLength !== thing.buffer.byteLength) str += `,${thing.startOffset},${thing.byteLength}`;
274
+ return str + ")";
275
+ }
276
+ case "ArrayBuffer": return `new Uint8Array([${new Uint8Array(thing).toString()}]).buffer`;
277
+ case "Temporal.Duration":
278
+ case "Temporal.Instant":
279
+ case "Temporal.PlainDate":
280
+ case "Temporal.PlainTime":
281
+ case "Temporal.PlainDateTime":
282
+ case "Temporal.PlainMonthDay":
283
+ case "Temporal.PlainYearMonth":
284
+ case "Temporal.ZonedDateTime": return `${type}.from(${stringify_string(thing.toString())})`;
285
+ default:
286
+ const keys = Object.keys(thing);
287
+ const obj = keys.map((key) => `${safe_key(key)}:${stringify(thing[key])}`).join(",");
288
+ if (Object.getPrototypeOf(thing) === null) return keys.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`;
289
+ return `{${obj}}`;
290
+ }
291
+ }
292
+ const str = stringify(value);
293
+ if (names.size) {
294
+ /** @type {string[]} */
295
+ const params = [];
296
+ /** @type {string[]} */
297
+ const statements = [];
298
+ /** @type {string[]} */
299
+ const values = [];
300
+ names.forEach((name, thing) => {
301
+ params.push(name);
302
+ if (custom.has(thing)) {
303
+ values.push(custom.get(thing));
304
+ return;
305
+ }
306
+ if (is_primitive(thing)) {
307
+ values.push(stringify_primitive(thing));
308
+ return;
309
+ }
310
+ const type = get_type(thing);
311
+ switch (type) {
312
+ case "Number":
313
+ case "String":
314
+ case "Boolean":
315
+ case "BigInt":
316
+ values.push(`Object(${stringify(thing.valueOf())})`);
317
+ break;
318
+ case "RegExp":
319
+ const { source, flags } = thing;
320
+ const regexp = flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`;
321
+ values.push(regexp);
322
+ break;
323
+ case "Date":
324
+ values.push(`new Date(${thing.getTime()})`);
325
+ break;
326
+ case "URL":
327
+ values.push(`new URL(${stringify_string(thing.toString())})`);
328
+ break;
329
+ case "URLSearchParams":
330
+ values.push(`new URLSearchParams(${stringify_string(thing.toString())})`);
331
+ break;
332
+ case "Array":
333
+ values.push(`Array(${thing.length})`);
334
+ /** @type {any[]} */ thing.forEach((v, i) => {
335
+ statements.push(`${name}[${i}]=${stringify(v)}`);
336
+ });
337
+ break;
338
+ case "Set":
339
+ values.push(`new Set`);
340
+ statements.push(`${name}.${Array.from(thing).map((v) => `add(${stringify(v)})`).join(".")}`);
341
+ break;
342
+ case "Map":
343
+ values.push(`new Map`);
344
+ statements.push(`${name}.${Array.from(thing).map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`).join(".")}`);
345
+ break;
346
+ case "Int8Array":
347
+ case "Uint8Array":
348
+ case "Uint8ClampedArray":
349
+ case "Int16Array":
350
+ case "Uint16Array":
351
+ case "Float16Array":
352
+ case "Int32Array":
353
+ case "Uint32Array":
354
+ case "Float32Array":
355
+ case "Float64Array":
356
+ case "BigInt64Array":
357
+ case "BigUint64Array": {
358
+ let str = `new ${type}`;
359
+ if (!names.has(thing.buffer)) {
360
+ const array = new thing.constructor(thing.buffer);
361
+ str += `([${array}])`;
362
+ } else str += `(${stringify(thing.buffer)})`;
363
+ if (thing.byteLength !== thing.buffer.byteLength) {
364
+ const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
365
+ const end = start + thing.length;
366
+ str += `.subarray(${start},${end})`;
367
+ }
368
+ values.push(`{}`);
369
+ statements.push(`${name}=${str}`);
370
+ break;
371
+ }
372
+ case "DataView": {
373
+ let str = `new DataView`;
374
+ if (!names.has(thing.buffer)) str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
375
+ else str += `(${stringify(thing.buffer)}`;
376
+ if (thing.byteLength !== thing.buffer.byteLength) str += `,${thing.byteOffset},${thing.byteLength}`;
377
+ str += ")";
378
+ values.push(`{}`);
379
+ statements.push(`${name}=${str}`);
380
+ break;
381
+ }
382
+ case "ArrayBuffer":
383
+ values.push(`new Uint8Array([${new Uint8Array(thing)}]).buffer`);
384
+ break;
385
+ default:
386
+ values.push(Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}");
387
+ Object.keys(thing).forEach((key) => {
388
+ statements.push(`${name}${safe_prop(key)}=${stringify(thing[key])}`);
389
+ });
390
+ }
391
+ });
392
+ statements.push(`return ${str}`);
393
+ return `(function(${params.join(",")}){${statements.join(";")}}(${values.join(",")}))`;
394
+ } else return str;
395
+ }
396
+ /** @param {number} num */
397
+ function get_name(num) {
398
+ let name = "";
399
+ do {
400
+ name = chars[num % 54] + name;
401
+ num = ~~(num / 54) - 1;
402
+ } while (num >= 0);
403
+ return reserved.test(name) ? `${name}0` : name;
404
+ }
405
+ /** @param {string} c */
406
+ function escape_unsafe_char(c) {
407
+ return escaped[c] || c;
408
+ }
409
+ /** @param {string} str */
410
+ function escape_unsafe_chars(str) {
411
+ return str.replace(unsafe_chars, escape_unsafe_char);
412
+ }
413
+ /** @param {string} key */
414
+ function safe_key(key) {
415
+ return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key));
416
+ }
417
+ /** @param {string} key */
418
+ function safe_prop(key) {
419
+ return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? `.${key}` : `[${escape_unsafe_chars(JSON.stringify(key))}]`;
420
+ }
421
+ /** @param {any} thing */
422
+ function stringify_primitive(thing) {
423
+ const type = typeof thing;
424
+ if (type === "string") return stringify_string(thing);
425
+ if (thing === void 0) return "void 0";
426
+ if (thing === 0 && 1 / thing < 0) return "-0";
427
+ const str = String(thing);
428
+ if (type === "number") return str.replace(/^(-)?0\./, "$1.");
429
+ if (type === "bigint") return thing + "n";
430
+ return str;
431
+ }
432
+ /**
433
+ * Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`
434
+ * @param {string} name
435
+ * @returns {never}
436
+ */
437
+ function experimental_async_required(name) {
438
+ throw new Error(`https://svelte.dev/e/experimental_async_required`);
439
+ }
440
+ /**
441
+ * `%name%(...)` can only be used during component initialisation
442
+ * @param {string} name
443
+ * @returns {never}
444
+ */
445
+ function lifecycle_outside_component(name) {
446
+ throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
447
+ }
448
+ /**
449
+ * Context was not set in a parent component
450
+ * @returns {never}
451
+ */
452
+ function missing_context() {
453
+ throw new Error(`https://svelte.dev/e/missing_context`);
454
+ }
455
+ /**
456
+ * The node API `AsyncLocalStorage` is not available, but is required to use async server rendering.
457
+ * @returns {never}
458
+ */
459
+ function async_local_storage_unavailable() {
460
+ const error = /* @__PURE__ */ new Error(`async_local_storage_unavailable\nThe node API \`AsyncLocalStorage\` is not available, but is required to use async server rendering.\nhttps://svelte.dev/e/async_local_storage_unavailable`);
461
+ error.name = "Svelte error";
462
+ throw error;
463
+ }
464
+ /**
465
+ * Encountered asynchronous work while rendering synchronously.
466
+ * @returns {never}
467
+ */
468
+ function await_invalid() {
469
+ const error = /* @__PURE__ */ new Error(`await_invalid\nEncountered asynchronous work while rendering synchronously.\nhttps://svelte.dev/e/await_invalid`);
470
+ error.name = "Svelte error";
471
+ throw error;
472
+ }
473
+ /**
474
+ * `<svelte:element this="%tag%">` is not a valid element name — the element will not be rendered
475
+ * @param {string} tag
476
+ * @returns {never}
477
+ */
478
+ function dynamic_element_invalid_tag(tag) {
479
+ const error = /* @__PURE__ */ new Error(`dynamic_element_invalid_tag\n\`<svelte:element this="${tag}">\` is not a valid element name — the element will not be rendered\nhttps://svelte.dev/e/dynamic_element_invalid_tag`);
480
+ error.name = "Svelte error";
481
+ throw error;
482
+ }
483
+ /**
484
+ * The `html` property of server render results has been deprecated. Use `body` instead.
485
+ * @returns {never}
486
+ */
487
+ function html_deprecated() {
488
+ const error = /* @__PURE__ */ new Error(`html_deprecated\nThe \`html\` property of server render results has been deprecated. Use \`body\` instead.\nhttps://svelte.dev/e/html_deprecated`);
489
+ error.name = "Svelte error";
490
+ throw error;
491
+ }
492
+ /**
493
+ * Failed to serialize `hydratable` data for key `%key%`.
494
+ *
495
+ * `hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises.
496
+ *
497
+ * Cause:
498
+ * %stack%
499
+ * @param {string} key
500
+ * @param {string} stack
501
+ * @returns {never}
502
+ */
503
+ function hydratable_serialization_failed(key, stack) {
504
+ const error = /* @__PURE__ */ new Error(`hydratable_serialization_failed\nFailed to serialize \`hydratable\` data for key \`${key}\`.
505
+
506
+ \`hydratable\` can serialize anything [\`uneval\` from \`devalue\`](https://npmjs.com/package/uneval) can, plus Promises.
507
+
508
+ Cause:
509
+ ${stack}\nhttps://svelte.dev/e/hydratable_serialization_failed`);
510
+ error.name = "Svelte error";
511
+ throw error;
512
+ }
513
+ /**
514
+ * `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
515
+ * @returns {never}
516
+ */
517
+ function invalid_csp() {
518
+ const error = /* @__PURE__ */ new Error(`invalid_csp\n\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.\nhttps://svelte.dev/e/invalid_csp`);
519
+ error.name = "Svelte error";
520
+ throw error;
521
+ }
522
+ /**
523
+ * The `idPrefix` option cannot include `--`.
524
+ * @returns {never}
525
+ */
526
+ function invalid_id_prefix() {
527
+ const error = /* @__PURE__ */ new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`);
528
+ error.name = "Svelte error";
529
+ throw error;
530
+ }
531
+ /**
532
+ * `%name%(...)` is not available on the server
533
+ * @param {string} name
534
+ * @returns {never}
535
+ */
536
+ function lifecycle_function_unavailable(name) {
537
+ const error = /* @__PURE__ */ new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nhttps://svelte.dev/e/lifecycle_function_unavailable`);
538
+ error.name = "Svelte error";
539
+ throw error;
540
+ }
541
+ /**
542
+ * Could not resolve `render` context.
543
+ * @returns {never}
544
+ */
545
+ function server_context_required() {
546
+ const error = /* @__PURE__ */ new Error(`server_context_required\nCould not resolve \`render\` context.\nhttps://svelte.dev/e/server_context_required`);
547
+ error.name = "Svelte error";
548
+ throw error;
549
+ }
550
+ /** @import { SSRContext } from '#server' */
551
+ /** @type {SSRContext | null} */
552
+ var ssr_context = null;
553
+ /** @param {SSRContext | null} v */
554
+ function set_ssr_context(v) {
555
+ ssr_context = v;
556
+ }
557
+ /**
558
+ * @template T
559
+ * @returns {[() => T, (context: T) => T]}
560
+ * @since 5.40.0
561
+ */
562
+ function createContext() {
563
+ const key = {};
564
+ return [() => {
565
+ if (!hasContext(key)) missing_context();
566
+ return getContext(key);
567
+ }, (context) => setContext(key, context)];
568
+ }
569
+ /**
570
+ * @template T
571
+ * @param {any} key
572
+ * @returns {T}
573
+ */
574
+ function getContext(key) {
575
+ return get_or_init_context_map("getContext").get(key);
576
+ }
577
+ /**
578
+ * @template T
579
+ * @param {any} key
580
+ * @param {T} context
581
+ * @returns {T}
582
+ */
583
+ function setContext(key, context) {
584
+ get_or_init_context_map("setContext").set(key, context);
585
+ return context;
586
+ }
587
+ /**
588
+ * @param {any} key
589
+ * @returns {boolean}
590
+ */
591
+ function hasContext(key) {
592
+ return get_or_init_context_map("hasContext").has(key);
593
+ }
594
+ /** @returns {Map<any, any>} */
595
+ function getAllContexts() {
596
+ return get_or_init_context_map("getAllContexts");
597
+ }
598
+ /**
599
+ * @param {string} name
600
+ * @returns {Map<unknown, unknown>}
601
+ */
602
+ function get_or_init_context_map(name) {
603
+ if (ssr_context === null) lifecycle_outside_component(name);
604
+ return ssr_context.c ??= new Map(get_parent_context(ssr_context) || void 0);
605
+ }
606
+ /**
607
+ * @param {Function} [fn]
608
+ */
609
+ function push$1(fn) {
610
+ ssr_context = {
611
+ p: ssr_context,
612
+ c: null,
613
+ r: null
614
+ };
615
+ }
616
+ function pop$1() {
617
+ ssr_context = ssr_context.p;
618
+ }
619
+ /**
620
+ * @param {SSRContext} ssr_context
621
+ * @returns {Map<unknown, unknown> | null}
622
+ */
623
+ function get_parent_context(ssr_context) {
624
+ let parent = ssr_context.p;
625
+ while (parent !== null) {
626
+ const context_map = parent.c;
627
+ if (context_map !== null) return context_map;
628
+ parent = parent.p;
629
+ }
630
+ return null;
631
+ }
632
+ var is_array = Array.isArray;
633
+ var index_of = Array.prototype.indexOf;
634
+ var includes = Array.prototype.includes;
635
+ var array_from = Array.from;
636
+ var define_property = Object.defineProperty;
637
+ var get_descriptor = Object.getOwnPropertyDescriptor;
638
+ var object_prototype = Object.prototype;
639
+ var array_prototype = Array.prototype;
640
+ var get_prototype_of = Object.getPrototypeOf;
641
+ var is_extensible = Object.isExtensible;
642
+ var has_own_property = Object.prototype.hasOwnProperty;
643
+ var noop = () => {};
644
+ /** @param {Function} fn */
645
+ function run(fn) {
646
+ return fn();
647
+ }
648
+ /** @param {Array<() => void>} arr */
649
+ function run_all(arr) {
650
+ for (var i = 0; i < arr.length; i++) arr[i]();
651
+ }
652
+ /**
653
+ * TODO replace with Promise.withResolvers once supported widely enough
654
+ * @template [T=void]
655
+ */
656
+ function deferred() {
657
+ /** @type {(value: T) => void} */
658
+ var resolve;
659
+ /** @type {(reason: any) => void} */
660
+ var reject;
661
+ return {
662
+ promise: new Promise((res, rej) => {
663
+ resolve = res;
664
+ reject = rej;
665
+ }),
666
+ resolve,
667
+ reject
668
+ };
669
+ }
670
+ var CLEAN = 1024;
671
+ var DIRTY = 2048;
672
+ var MAYBE_DIRTY = 4096;
673
+ var INERT = 8192;
674
+ var DESTROYED = 16384;
675
+ /** Set once a reaction has run for the first time */
676
+ var REACTION_RAN = 32768;
677
+ /** Effect is in the process of getting destroyed. Can be observed in child teardown functions */
678
+ var DESTROYING = 1 << 25;
679
+ /**
680
+ * 'Transparent' effects do not create a transition boundary.
681
+ * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned
682
+ */
683
+ var EFFECT_TRANSPARENT = 65536;
684
+ var EFFECT_PRESERVED = 1 << 19;
685
+ var USER_EFFECT = 1 << 20;
686
+ /**
687
+ * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
688
+ * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
689
+ * because a derived might be checked but not executed).
690
+ */
691
+ var WAS_MARKED = 65536;
692
+ var REACTION_IS_UPDATING = 1 << 21;
693
+ var ERROR_VALUE = 1 << 23;
694
+ var STATE_SYMBOL = Symbol("$state");
695
+ var LEGACY_PROPS = Symbol("legacy props");
696
+ /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
697
+ var STALE_REACTION = new class StaleReactionError extends Error {
698
+ name = "StaleReactionError";
699
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
700
+ }();
701
+ globalThis.document?.contentType;
702
+ /** @type {AbortController | null} */
703
+ var controller = null;
704
+ function abort() {
705
+ controller?.abort(STALE_REACTION);
706
+ controller = null;
707
+ }
708
+ function getAbortSignal() {
709
+ return (controller ??= new AbortController()).signal;
710
+ }
711
+ /** True if we're not certain that we only have Svelte 5 code in the compilation */
712
+ var legacy_mode_flag = false;
713
+ /** @import { AsyncLocalStorage } from 'node:async_hooks' */
714
+ /** @import { RenderContext } from '#server' */
715
+ /** @type {Promise<void> | null} */
716
+ var current_render = null;
717
+ /** @type {RenderContext | null} */
718
+ var context = null;
719
+ /** @returns {RenderContext} */
720
+ function get_render_context() {
721
+ const store = context ?? als?.getStore();
722
+ if (!store) server_context_required();
723
+ return store;
724
+ }
725
+ /**
726
+ * @template T
727
+ * @param {() => Promise<T>} fn
728
+ * @returns {Promise<T>}
729
+ */
730
+ async function with_render_context(fn) {
731
+ context = { hydratable: {
732
+ lookup: /* @__PURE__ */ new Map(),
733
+ comparisons: [],
734
+ unresolved_promises: /* @__PURE__ */ new Map()
735
+ } };
736
+ if (in_webcontainer()) {
737
+ const { promise, resolve } = deferred();
738
+ const previous_render = current_render;
739
+ current_render = promise;
740
+ await previous_render;
741
+ return fn().finally(resolve);
742
+ }
743
+ try {
744
+ if (als === null) async_local_storage_unavailable();
745
+ return als.run(context, fn);
746
+ } finally {
747
+ context = null;
748
+ }
749
+ }
750
+ /** @type {AsyncLocalStorage<RenderContext | null> | null} */
751
+ var als = null;
752
+ /** @type {Promise<void> | null} */
753
+ var als_import = null;
754
+ /**
755
+ *
756
+ * @returns {Promise<void>}
757
+ */
758
+ function init_render_context() {
759
+ als_import ??= import("node:async_hooks").then((hooks) => {
760
+ als = new hooks.AsyncLocalStorage();
761
+ }).then(noop, noop);
762
+ return als_import;
763
+ }
764
+ function in_webcontainer() {
765
+ return !!globalThis.process?.versions?.webcontainer;
766
+ }
767
+ var HYDRATION_ERROR = {};
768
+ var UNINITIALIZED = Symbol();
769
+ /**
770
+ * A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.
771
+ *
772
+ * The `hydratable` was initialized in:
773
+ * %stack%
774
+ * @param {string} key
775
+ * @param {string} stack
776
+ */
777
+ function unresolved_hydratable(key, stack) {
778
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
779
+ }
780
+ var BLOCK_OPEN = `<!--[-->`;
781
+ var BLOCK_CLOSE = `<!--]-->`;
782
+ var EMPTY_COMMENT = `<!---->`;
783
+ var ATTR_REGEX = /[&"<]/g;
784
+ var CONTENT_REGEX = /[&<]/g;
785
+ /**
786
+ * @template V
787
+ * @param {V} value
788
+ * @param {boolean} [is_attr]
789
+ */
790
+ function escape_html(value, is_attr) {
791
+ const str = String(value ?? "");
792
+ const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
793
+ pattern.lastIndex = 0;
794
+ let escaped = "";
795
+ let last = 0;
796
+ while (pattern.test(str)) {
797
+ const i = pattern.lastIndex - 1;
798
+ const ch = str[i];
799
+ escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === "\"" ? "&quot;" : "&lt;");
800
+ last = i + 1;
801
+ }
802
+ return escaped + str.substring(last);
803
+ }
804
+ function r(e) {
805
+ var t, f, n = "";
806
+ if ("string" == typeof e || "number" == typeof e) n += e;
807
+ else if ("object" == typeof e) if (Array.isArray(e)) {
808
+ var o = e.length;
809
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
810
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
811
+ return n;
812
+ }
813
+ function clsx$1() {
814
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
815
+ return n;
816
+ }
817
+ /**
818
+ * `<div translate={false}>` should be rendered as `<div translate="no">` and _not_
819
+ * `<div translate="false">`, which is equivalent to `<div translate="yes">`. There
820
+ * may be other odd cases that need to be added to this list in future
821
+ * @type {Record<string, Map<any, string>>}
822
+ */
823
+ var replacements = { translate: new Map([[true, "yes"], [false, "no"]]) };
824
+ /**
825
+ * @template V
826
+ * @param {string} name
827
+ * @param {V} value
828
+ * @param {boolean} [is_boolean]
829
+ * @returns {string}
830
+ */
831
+ function attr(name, value, is_boolean = false) {
832
+ if (name === "hidden" && value !== "until-found") is_boolean = true;
833
+ if (value == null || !value && is_boolean) return "";
834
+ const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
835
+ return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`;
836
+ }
837
+ /**
838
+ * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.
839
+ * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)
840
+ * @param {any} value
841
+ */
842
+ function clsx(value) {
843
+ if (typeof value === "object") return clsx$1(value);
844
+ else return value ?? "";
845
+ }
846
+ var whitespace = [..." \n\r\f\xA0\v"];
847
+ /**
848
+ * @param {any} value
849
+ * @param {string | null} [hash]
850
+ * @param {Record<string, boolean>} [directives]
851
+ * @returns {string | null}
852
+ */
853
+ function to_class(value, hash, directives) {
854
+ var classname = value == null ? "" : "" + value;
855
+ if (hash) classname = classname ? classname + " " + hash : hash;
856
+ if (directives) {
857
+ for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
858
+ else if (classname.length) {
859
+ var len = key.length;
860
+ var a = 0;
861
+ while ((a = classname.indexOf(key, a)) >= 0) {
862
+ var b = a + len;
863
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
864
+ else a = b;
865
+ }
866
+ }
867
+ }
868
+ return classname === "" ? null : classname;
869
+ }
870
+ /**
871
+ *
872
+ * @param {Record<string,any>} styles
873
+ * @param {boolean} important
874
+ */
875
+ function append_styles(styles, important = false) {
876
+ var separator = important ? " !important;" : ";";
877
+ var css = "";
878
+ for (var key of Object.keys(styles)) {
879
+ var value = styles[key];
880
+ if (value != null && value !== "") css += " " + key + ": " + value + separator;
881
+ }
882
+ return css;
883
+ }
884
+ /**
885
+ * @param {string} name
886
+ * @returns {string}
887
+ */
888
+ function to_css_name(name) {
889
+ if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
890
+ return name;
891
+ }
892
+ /**
893
+ * @param {any} value
894
+ * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
895
+ * @returns {string | null}
896
+ */
897
+ function to_style(value, styles) {
898
+ if (styles) {
899
+ var new_style = "";
900
+ /** @type {Record<string,any> | undefined} */
901
+ var normal_styles;
902
+ /** @type {Record<string,any> | undefined} */
903
+ var important_styles;
904
+ if (Array.isArray(styles)) {
905
+ normal_styles = styles[0];
906
+ important_styles = styles[1];
907
+ } else normal_styles = styles;
908
+ if (value) {
909
+ value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
910
+ /** @type {boolean | '"' | "'"} */
911
+ var in_str = false;
912
+ var in_apo = 0;
913
+ var in_comment = false;
914
+ var reserved_names = [];
915
+ if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
916
+ if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
917
+ var start_index = 0;
918
+ var name_index = -1;
919
+ const len = value.length;
920
+ for (var i = 0; i < len; i++) {
921
+ var c = value[i];
922
+ if (in_comment) {
923
+ if (c === "/" && value[i - 1] === "*") in_comment = false;
924
+ } else if (in_str) {
925
+ if (in_str === c) in_str = false;
926
+ } else if (c === "/" && value[i + 1] === "*") in_comment = true;
927
+ else if (c === "\"" || c === "'") in_str = c;
928
+ else if (c === "(") in_apo++;
929
+ else if (c === ")") in_apo--;
930
+ if (!in_comment && in_str === false && in_apo === 0) {
931
+ if (c === ":" && name_index === -1) name_index = i;
932
+ else if (c === ";" || i === len - 1) {
933
+ if (name_index !== -1) {
934
+ var name = to_css_name(value.substring(start_index, name_index).trim());
935
+ if (!reserved_names.includes(name)) {
936
+ if (c !== ";") i++;
937
+ var property = value.substring(start_index, i).trim();
938
+ new_style += " " + property + ";";
939
+ }
940
+ }
941
+ start_index = i + 1;
942
+ name_index = -1;
943
+ }
944
+ }
945
+ }
946
+ }
947
+ if (normal_styles) new_style += append_styles(normal_styles);
948
+ if (important_styles) new_style += append_styles(important_styles, true);
949
+ new_style = new_style.trim();
950
+ return new_style === "" ? null : new_style;
951
+ }
952
+ return value == null ? null : String(value);
953
+ }
954
+ /**
955
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
956
+ * @returns {never}
957
+ */
958
+ function effect_update_depth_exceeded() {
959
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
960
+ }
961
+ /**
962
+ * Failed to hydrate the application
963
+ * @returns {never}
964
+ */
965
+ function hydration_failed() {
966
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
967
+ }
968
+ /**
969
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
970
+ * @returns {never}
971
+ */
972
+ function state_descriptors_fixed() {
973
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
974
+ }
975
+ /**
976
+ * Cannot set prototype of `$state` object
977
+ * @returns {never}
978
+ */
979
+ function state_prototype_fixed() {
980
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
981
+ }
982
+ /**
983
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
984
+ * @returns {never}
985
+ */
986
+ function state_unsafe_mutation() {
987
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
988
+ }
989
+ /**
990
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
991
+ * @returns {never}
992
+ */
993
+ function svelte_boundary_reset_onerror() {
994
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
995
+ }
996
+ /**
997
+ * Reading a derived belonging to a now-destroyed effect may result in stale values
998
+ */
999
+ function derived_inert() {
1000
+ console.warn(`https://svelte.dev/e/derived_inert`);
1001
+ }
1002
+ /**
1003
+ * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
1004
+ * @param {string | undefined | null} [location]
1005
+ */
1006
+ function hydration_mismatch(location) {
1007
+ console.warn(`https://svelte.dev/e/hydration_mismatch`);
1008
+ }
1009
+ /**
1010
+ * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called
1011
+ */
1012
+ function svelte_boundary_reset_noop() {
1013
+ console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
1014
+ }
1015
+ /** @import { TemplateNode } from '#client' */
1016
+ /**
1017
+ * Use this variable to guard everything related to hydration code so it can be treeshaken out
1018
+ * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.
1019
+ */
1020
+ var hydrating = false;
1021
+ /** @param {boolean} value */
1022
+ function set_hydrating(value) {
1023
+ hydrating = value;
1024
+ }
1025
+ /**
1026
+ * The node that is currently being hydrated. This starts out as the first node inside the opening
1027
+ * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.
1028
+ * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the
1029
+ * time we leave the block it is the closing comment, which serves as the block's anchor.
1030
+ * @type {TemplateNode}
1031
+ */
1032
+ var hydrate_node;
1033
+ /** @param {TemplateNode | null} node */
1034
+ function set_hydrate_node(node) {
1035
+ if (node === null) {
1036
+ hydration_mismatch();
1037
+ throw HYDRATION_ERROR;
1038
+ }
1039
+ return hydrate_node = node;
1040
+ }
1041
+ function hydrate_next() {
1042
+ return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
1043
+ }
1044
+ function next(count = 1) {
1045
+ if (hydrating) {
1046
+ var i = count;
1047
+ var node = hydrate_node;
1048
+ while (i--) node = /* @__PURE__ */ get_next_sibling(node);
1049
+ hydrate_node = node;
1050
+ }
1051
+ }
1052
+ /**
1053
+ * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment
1054
+ * @param {boolean} remove
1055
+ */
1056
+ function skip_nodes(remove = true) {
1057
+ var depth = 0;
1058
+ var node = hydrate_node;
1059
+ while (true) {
1060
+ if (node.nodeType === 8) {
1061
+ var data = node.data;
1062
+ if (data === "]") {
1063
+ if (depth === 0) return node;
1064
+ depth -= 1;
1065
+ } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
1066
+ }
1067
+ var next = /* @__PURE__ */ get_next_sibling(node);
1068
+ if (remove) node.remove();
1069
+ node = next;
1070
+ }
1071
+ }
1072
+ /** @import { Equals } from '#client' */
1073
+ /** @type {Equals} */
1074
+ function equals(value) {
1075
+ return value === this.v;
1076
+ }
1077
+ /**
1078
+ * @param {unknown} a
1079
+ * @param {unknown} b
1080
+ * @returns {boolean}
1081
+ */
1082
+ function safe_not_equal(a, b) {
1083
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
1084
+ }
1085
+ /** @type {Equals} */
1086
+ function safe_equals(value) {
1087
+ return !safe_not_equal(value, this.v);
1088
+ }
1089
+ /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
1090
+ /** @type {ComponentContext | null} */
1091
+ var component_context = null;
1092
+ /** @param {ComponentContext | null} context */
1093
+ function set_component_context(context) {
1094
+ component_context = context;
1095
+ }
1096
+ /**
1097
+ * @param {Record<string, unknown>} props
1098
+ * @param {any} runes
1099
+ * @param {Function} [fn]
1100
+ * @returns {void}
1101
+ */
1102
+ function push(props, runes = false, fn) {
1103
+ component_context = {
1104
+ p: component_context,
1105
+ i: false,
1106
+ c: null,
1107
+ e: null,
1108
+ s: props,
1109
+ x: null,
1110
+ r: active_effect,
1111
+ l: legacy_mode_flag && !runes ? {
1112
+ s: null,
1113
+ u: null,
1114
+ $: []
1115
+ } : null
1116
+ };
1117
+ }
1118
+ /**
1119
+ * @template {Record<string, any>} T
1120
+ * @param {T} [component]
1121
+ * @returns {T}
1122
+ */
1123
+ function pop(component) {
1124
+ var context = component_context;
1125
+ var effects = context.e;
1126
+ if (effects !== null) {
1127
+ context.e = null;
1128
+ for (var fn of effects) create_user_effect(fn);
1129
+ }
1130
+ if (component !== void 0) context.x = component;
1131
+ context.i = true;
1132
+ component_context = context.p;
1133
+ return component ?? {};
1134
+ }
1135
+ /** @returns {boolean} */
1136
+ function is_runes() {
1137
+ return !legacy_mode_flag || component_context !== null && component_context.l === null;
1138
+ }
1139
+ /** @type {Array<() => void>} */
1140
+ var micro_tasks = [];
1141
+ function run_micro_tasks() {
1142
+ var tasks = micro_tasks;
1143
+ micro_tasks = [];
1144
+ run_all(tasks);
1145
+ }
1146
+ /**
1147
+ * @param {() => void} fn
1148
+ */
1149
+ function queue_micro_task(fn) {
1150
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
1151
+ var tasks = micro_tasks;
1152
+ queueMicrotask(() => {
1153
+ if (tasks === micro_tasks) run_micro_tasks();
1154
+ });
1155
+ }
1156
+ micro_tasks.push(fn);
1157
+ }
1158
+ /**
1159
+ * Synchronously run any queued tasks.
1160
+ */
1161
+ function flush_tasks() {
1162
+ while (micro_tasks.length > 0) run_micro_tasks();
1163
+ }
1164
+ /**
1165
+ * @param {unknown} error
1166
+ */
1167
+ function handle_error(error) {
1168
+ var effect = active_effect;
1169
+ if (effect === null) {
1170
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
1171
+ return error;
1172
+ }
1173
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
1174
+ invoke_error_boundary(error, effect);
1175
+ }
1176
+ /**
1177
+ * @param {unknown} error
1178
+ * @param {Effect | null} effect
1179
+ */
1180
+ function invoke_error_boundary(error, effect) {
1181
+ while (effect !== null) {
1182
+ if ((effect.f & 128) !== 0) {
1183
+ if ((effect.f & 32768) === 0) throw error;
1184
+ try {
1185
+ /** @type {Boundary} */ effect.b.error(error);
1186
+ return;
1187
+ } catch (e) {
1188
+ error = e;
1189
+ }
1190
+ }
1191
+ effect = effect.parent;
1192
+ }
1193
+ throw error;
1194
+ }
1195
+ /** @import { Derived, Signal } from '#client' */
1196
+ var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
1197
+ /**
1198
+ * @param {Signal} signal
1199
+ * @param {number} status
1200
+ */
1201
+ function set_signal_status(signal, status) {
1202
+ signal.f = signal.f & STATUS_MASK | status;
1203
+ }
1204
+ /**
1205
+ * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.
1206
+ * @param {Derived} derived
1207
+ */
1208
+ function update_derived_status(derived) {
1209
+ if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
1210
+ else set_signal_status(derived, MAYBE_DIRTY);
1211
+ }
1212
+ /** @import { Derived, Effect, Value } from '#client' */
1213
+ /**
1214
+ * @param {Value[] | null} deps
1215
+ */
1216
+ function clear_marked(deps) {
1217
+ if (deps === null) return;
1218
+ for (const dep of deps) {
1219
+ if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
1220
+ dep.f ^= WAS_MARKED;
1221
+ clear_marked(
1222
+ /** @type {Derived} */
1223
+ dep.deps
1224
+ );
1225
+ }
1226
+ }
1227
+ /**
1228
+ * @param {Effect} effect
1229
+ * @param {Set<Effect>} dirty_effects
1230
+ * @param {Set<Effect>} maybe_dirty_effects
1231
+ */
1232
+ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
1233
+ if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
1234
+ else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
1235
+ clear_marked(effect.deps);
1236
+ set_signal_status(effect, CLEAN);
1237
+ }
1238
+ /** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */
1239
+ /** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */
1240
+ /**
1241
+ * @type {Array<SubscribeInvalidateTuple<any> | any>}
1242
+ */
1243
+ var subscriber_queue = [];
1244
+ /**
1245
+ * Creates a `Readable` store that allows reading by subscription.
1246
+ *
1247
+ * @template T
1248
+ * @param {T} [value] initial value
1249
+ * @param {StartStopNotifier<T>} [start]
1250
+ * @returns {Readable<T>}
1251
+ */
1252
+ function readable(value, start) {
1253
+ return { subscribe: writable(value, start).subscribe };
1254
+ }
1255
+ /**
1256
+ * Create a `Writable` store that allows both updating and reading by subscription.
1257
+ *
1258
+ * @template T
1259
+ * @param {T} [value] initial value
1260
+ * @param {StartStopNotifier<T>} [start]
1261
+ * @returns {Writable<T>}
1262
+ */
1263
+ function writable(value, start = noop) {
1264
+ /** @type {Unsubscriber | null} */
1265
+ let stop = null;
1266
+ /** @type {Set<SubscribeInvalidateTuple<T>>} */
1267
+ const subscribers = /* @__PURE__ */ new Set();
1268
+ /**
1269
+ * @param {T} new_value
1270
+ * @returns {void}
1271
+ */
1272
+ function set(new_value) {
1273
+ if (safe_not_equal(value, new_value)) {
1274
+ value = new_value;
1275
+ if (stop) {
1276
+ const run_queue = !subscriber_queue.length;
1277
+ for (const subscriber of subscribers) {
1278
+ subscriber[1]();
1279
+ subscriber_queue.push(subscriber, value);
1280
+ }
1281
+ if (run_queue) {
1282
+ for (let i = 0; i < subscriber_queue.length; i += 2) subscriber_queue[i][0](subscriber_queue[i + 1]);
1283
+ subscriber_queue.length = 0;
1284
+ }
1285
+ }
1286
+ }
1287
+ }
1288
+ /**
1289
+ * @param {Updater<T>} fn
1290
+ * @returns {void}
1291
+ */
1292
+ function update(fn) {
1293
+ set(fn(value));
1294
+ }
1295
+ /**
1296
+ * @param {Subscriber<T>} run
1297
+ * @param {() => void} [invalidate]
1298
+ * @returns {Unsubscriber}
1299
+ */
1300
+ function subscribe(run, invalidate = noop) {
1301
+ /** @type {SubscribeInvalidateTuple<T>} */
1302
+ const subscriber = [run, invalidate];
1303
+ subscribers.add(subscriber);
1304
+ if (subscribers.size === 1) stop = start(set, update) || noop;
1305
+ run(value);
1306
+ return () => {
1307
+ subscribers.delete(subscriber);
1308
+ if (subscribers.size === 0 && stop) {
1309
+ stop();
1310
+ stop = null;
1311
+ }
1312
+ };
1313
+ }
1314
+ return {
1315
+ set,
1316
+ update,
1317
+ subscribe
1318
+ };
1319
+ }
1320
+ /**
1321
+ * We set this to `true` when updating a store so that we correctly
1322
+ * schedule effects if the update takes place inside a `$:` effect
1323
+ */
1324
+ var legacy_is_updating_store = false;
1325
+ /** @import { Fork } from 'svelte' */
1326
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
1327
+ /** @type {Set<Batch>} */
1328
+ var batches = /* @__PURE__ */ new Set();
1329
+ /** @type {Batch | null} */
1330
+ var current_batch = null;
1331
+ /**
1332
+ * When time travelling (i.e. working in one batch, while other batches
1333
+ * still have ongoing work), we ignore the real values of affected
1334
+ * signals in favour of their values within the batch
1335
+ * @type {Map<Value, any> | null}
1336
+ */
1337
+ var batch_values = null;
1338
+ /** @type {Effect | null} */
1339
+ var last_scheduled_effect = null;
1340
+ var is_flushing_sync = false;
1341
+ var is_processing = false;
1342
+ /**
1343
+ * During traversal, this is an array. Newly created effects are (if not immediately
1344
+ * executed) pushed to this array, rather than going through the scheduling
1345
+ * rigamarole that would cause another turn of the flush loop.
1346
+ * @type {Effect[] | null}
1347
+ */
1348
+ var collected_effects = null;
1349
+ /**
1350
+ * An array of effects that are marked during traversal as a result of a `set`
1351
+ * (not `internal_set`) call. These will be added to the next batch and
1352
+ * trigger another `batch.process()`
1353
+ * @type {Effect[] | null}
1354
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1355
+ */
1356
+ var legacy_updates = null;
1357
+ var flush_count = 0;
1358
+ var uid = 1;
1359
+ var Batch = class Batch {
1360
+ id = uid++;
1361
+ /**
1362
+ * The current values of any signals that are updated in this batch.
1363
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
1364
+ * They keys of this map are identical to `this.#previous`
1365
+ * @type {Map<Value, [any, boolean]>}
1366
+ */
1367
+ current = /* @__PURE__ */ new Map();
1368
+ /**
1369
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
1370
+ * They keys of this map are identical to `this.#current`
1371
+ * @type {Map<Value, any>}
1372
+ */
1373
+ previous = /* @__PURE__ */ new Map();
1374
+ /**
1375
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
1376
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
1377
+ * @type {Set<(batch: Batch) => void>}
1378
+ */
1379
+ #commit_callbacks = /* @__PURE__ */ new Set();
1380
+ /**
1381
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
1382
+ * @type {Set<(batch: Batch) => void>}
1383
+ */
1384
+ #discard_callbacks = /* @__PURE__ */ new Set();
1385
+ /**
1386
+ * Callbacks that should run only when a fork is committed.
1387
+ * @type {Set<(batch: Batch) => void>}
1388
+ */
1389
+ #fork_commit_callbacks = /* @__PURE__ */ new Set();
1390
+ /**
1391
+ * Async effects that are currently in flight
1392
+ * @type {Map<Effect, number>}
1393
+ */
1394
+ #pending = /* @__PURE__ */ new Map();
1395
+ /**
1396
+ * Async effects that are currently in flight, _not_ inside a pending boundary
1397
+ * @type {Map<Effect, number>}
1398
+ */
1399
+ #blocking_pending = /* @__PURE__ */ new Map();
1400
+ /**
1401
+ * A deferred that resolves when the batch is committed, used with `settled()`
1402
+ * TODO replace with Promise.withResolvers once supported widely enough
1403
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
1404
+ */
1405
+ #deferred = null;
1406
+ /**
1407
+ * The root effects that need to be flushed
1408
+ * @type {Effect[]}
1409
+ */
1410
+ #roots = [];
1411
+ /**
1412
+ * Effects created while this batch was active.
1413
+ * @type {Effect[]}
1414
+ */
1415
+ #new_effects = [];
1416
+ /**
1417
+ * Deferred effects (which run after async work has completed) that are DIRTY
1418
+ * @type {Set<Effect>}
1419
+ */
1420
+ #dirty_effects = /* @__PURE__ */ new Set();
1421
+ /**
1422
+ * Deferred effects that are MAYBE_DIRTY
1423
+ * @type {Set<Effect>}
1424
+ */
1425
+ #maybe_dirty_effects = /* @__PURE__ */ new Set();
1426
+ /**
1427
+ * A map of branches that still exist, but will be destroyed when this batch
1428
+ * is committed — we skip over these during `process`.
1429
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
1430
+ * so they can be rescheduled if the branch survives.
1431
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
1432
+ */
1433
+ #skipped_branches = /* @__PURE__ */ new Map();
1434
+ /**
1435
+ * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
1436
+ * @type {Set<Effect>}
1437
+ */
1438
+ #unskipped_branches = /* @__PURE__ */ new Set();
1439
+ is_fork = false;
1440
+ #decrement_queued = false;
1441
+ /** @type {Set<Batch>} */
1442
+ #blockers = /* @__PURE__ */ new Set();
1443
+ #is_deferred() {
1444
+ return this.is_fork || this.#blocking_pending.size > 0;
1445
+ }
1446
+ #is_blocked() {
1447
+ for (const batch of this.#blockers) for (const effect of batch.#blocking_pending.keys()) {
1448
+ var skipped = false;
1449
+ var e = effect;
1450
+ while (e.parent !== null) {
1451
+ if (this.#skipped_branches.has(e)) {
1452
+ skipped = true;
1453
+ break;
1454
+ }
1455
+ e = e.parent;
1456
+ }
1457
+ if (!skipped) return true;
1458
+ }
1459
+ return false;
1460
+ }
1461
+ /**
1462
+ * Add an effect to the #skipped_branches map and reset its children
1463
+ * @param {Effect} effect
1464
+ */
1465
+ skip_effect(effect) {
1466
+ if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, {
1467
+ d: [],
1468
+ m: []
1469
+ });
1470
+ this.#unskipped_branches.delete(effect);
1471
+ }
1472
+ /**
1473
+ * Remove an effect from the #skipped_branches map and reschedule
1474
+ * any tracked dirty/maybe_dirty child effects
1475
+ * @param {Effect} effect
1476
+ * @param {(e: Effect) => void} callback
1477
+ */
1478
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
1479
+ var tracked = this.#skipped_branches.get(effect);
1480
+ if (tracked) {
1481
+ this.#skipped_branches.delete(effect);
1482
+ for (var e of tracked.d) {
1483
+ set_signal_status(e, DIRTY);
1484
+ callback(e);
1485
+ }
1486
+ for (e of tracked.m) {
1487
+ set_signal_status(e, MAYBE_DIRTY);
1488
+ callback(e);
1489
+ }
1490
+ }
1491
+ this.#unskipped_branches.add(effect);
1492
+ }
1493
+ #process() {
1494
+ if (flush_count++ > 1e3) {
1495
+ batches.delete(this);
1496
+ infinite_loop_guard();
1497
+ }
1498
+ if (!this.#is_deferred()) {
1499
+ for (const e of this.#dirty_effects) {
1500
+ this.#maybe_dirty_effects.delete(e);
1501
+ set_signal_status(e, DIRTY);
1502
+ this.schedule(e);
1503
+ }
1504
+ for (const e of this.#maybe_dirty_effects) {
1505
+ set_signal_status(e, MAYBE_DIRTY);
1506
+ this.schedule(e);
1507
+ }
1508
+ }
1509
+ const roots = this.#roots;
1510
+ this.#roots = [];
1511
+ this.apply();
1512
+ /** @type {Effect[]} */
1513
+ var effects = collected_effects = [];
1514
+ /** @type {Effect[]} */
1515
+ var render_effects = [];
1516
+ /**
1517
+ * @type {Effect[]}
1518
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1519
+ */
1520
+ var updates = legacy_updates = [];
1521
+ for (const root of roots) try {
1522
+ this.#traverse(root, effects, render_effects);
1523
+ } catch (e) {
1524
+ reset_all(root);
1525
+ throw e;
1526
+ }
1527
+ current_batch = null;
1528
+ if (updates.length > 0) {
1529
+ var batch = Batch.ensure();
1530
+ for (const e of updates) batch.schedule(e);
1531
+ }
1532
+ collected_effects = null;
1533
+ legacy_updates = null;
1534
+ if (this.#is_deferred() || this.#is_blocked()) {
1535
+ this.#defer_effects(render_effects);
1536
+ this.#defer_effects(effects);
1537
+ for (const [e, t] of this.#skipped_branches) reset_branch(e, t);
1538
+ } else {
1539
+ if (this.#pending.size === 0) batches.delete(this);
1540
+ this.#dirty_effects.clear();
1541
+ this.#maybe_dirty_effects.clear();
1542
+ for (const fn of this.#commit_callbacks) fn(this);
1543
+ this.#commit_callbacks.clear();
1544
+ flush_queued_effects(render_effects);
1545
+ flush_queued_effects(effects);
1546
+ this.#deferred?.resolve();
1547
+ }
1548
+ var next_batch = current_batch;
1549
+ if (this.#roots.length > 0) {
1550
+ const batch = next_batch ??= this;
1551
+ batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
1552
+ }
1553
+ if (next_batch !== null) {
1554
+ batches.add(next_batch);
1555
+ next_batch.#process();
1556
+ }
1557
+ }
1558
+ /**
1559
+ * Traverse the effect tree, executing effects or stashing
1560
+ * them for later execution as appropriate
1561
+ * @param {Effect} root
1562
+ * @param {Effect[]} effects
1563
+ * @param {Effect[]} render_effects
1564
+ */
1565
+ #traverse(root, effects, render_effects) {
1566
+ root.f ^= CLEAN;
1567
+ var effect = root.first;
1568
+ while (effect !== null) {
1569
+ var flags = effect.f;
1570
+ var is_branch = (flags & 96) !== 0;
1571
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) {
1572
+ if (is_branch) effect.f ^= CLEAN;
1573
+ else if ((flags & 4) !== 0) effects.push(effect);
1574
+ else if (is_dirty(effect)) {
1575
+ if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect);
1576
+ update_effect(effect);
1577
+ }
1578
+ var child = effect.first;
1579
+ if (child !== null) {
1580
+ effect = child;
1581
+ continue;
1582
+ }
1583
+ }
1584
+ while (effect !== null) {
1585
+ var next = effect.next;
1586
+ if (next !== null) {
1587
+ effect = next;
1588
+ break;
1589
+ }
1590
+ effect = effect.parent;
1591
+ }
1592
+ }
1593
+ }
1594
+ /**
1595
+ * @param {Effect[]} effects
1596
+ */
1597
+ #defer_effects(effects) {
1598
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
1599
+ }
1600
+ /**
1601
+ * Associate a change to a given source with the current
1602
+ * batch, noting its previous and current values
1603
+ * @param {Value} source
1604
+ * @param {any} value
1605
+ * @param {boolean} [is_derived]
1606
+ */
1607
+ capture(source, value, is_derived = false) {
1608
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
1609
+ if ((source.f & 8388608) === 0) {
1610
+ this.current.set(source, [value, is_derived]);
1611
+ batch_values?.set(source, value);
1612
+ }
1613
+ if (!this.is_fork) source.v = value;
1614
+ }
1615
+ activate() {
1616
+ current_batch = this;
1617
+ }
1618
+ deactivate() {
1619
+ current_batch = null;
1620
+ batch_values = null;
1621
+ }
1622
+ flush() {
1623
+ try {
1624
+ is_processing = true;
1625
+ current_batch = this;
1626
+ this.#process();
1627
+ } finally {
1628
+ flush_count = 0;
1629
+ last_scheduled_effect = null;
1630
+ collected_effects = null;
1631
+ legacy_updates = null;
1632
+ is_processing = false;
1633
+ current_batch = null;
1634
+ batch_values = null;
1635
+ old_values.clear();
1636
+ }
1637
+ }
1638
+ discard() {
1639
+ for (const fn of this.#discard_callbacks) fn(this);
1640
+ this.#discard_callbacks.clear();
1641
+ this.#fork_commit_callbacks.clear();
1642
+ batches.delete(this);
1643
+ }
1644
+ /**
1645
+ * @param {Effect} effect
1646
+ */
1647
+ register_created_effect(effect) {
1648
+ this.#new_effects.push(effect);
1649
+ }
1650
+ #commit() {
1651
+ for (const batch of batches) {
1652
+ var is_earlier = batch.id < this.id;
1653
+ /** @type {Source[]} */
1654
+ var sources = [];
1655
+ for (const [source, [value, is_derived]] of this.current) {
1656
+ if (batch.current.has(source)) {
1657
+ var batch_value = batch.current.get(source)[0];
1658
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1659
+ else continue;
1660
+ }
1661
+ sources.push(source);
1662
+ }
1663
+ var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
1664
+ if (others.length === 0) {
1665
+ if (is_earlier) batch.discard();
1666
+ } else if (sources.length > 0) {
1667
+ if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => {
1668
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
1669
+ else batch.#defer_effects([e]);
1670
+ });
1671
+ batch.activate();
1672
+ /** @type {Set<Value>} */
1673
+ var marked = /* @__PURE__ */ new Set();
1674
+ /** @type {Map<Reaction, boolean>} */
1675
+ var checked = /* @__PURE__ */ new Map();
1676
+ for (var source of sources) mark_effects(source, others, marked, checked);
1677
+ checked = /* @__PURE__ */ new Map();
1678
+ var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
1679
+ for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1680
+ set_signal_status(effect, DIRTY);
1681
+ batch.schedule(effect);
1682
+ } else batch.#dirty_effects.add(effect);
1683
+ if (batch.#roots.length > 0) {
1684
+ batch.apply();
1685
+ for (var root of batch.#roots) batch.#traverse(root, [], []);
1686
+ batch.#roots = [];
1687
+ }
1688
+ batch.deactivate();
1689
+ }
1690
+ }
1691
+ for (const batch of batches) if (batch.#blockers.has(this)) {
1692
+ batch.#blockers.delete(this);
1693
+ if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
1694
+ batch.activate();
1695
+ batch.#process();
1696
+ }
1697
+ }
1698
+ }
1699
+ /**
1700
+ * @param {boolean} blocking
1701
+ * @param {Effect} effect
1702
+ */
1703
+ increment(blocking, effect) {
1704
+ let pending_count = this.#pending.get(effect) ?? 0;
1705
+ this.#pending.set(effect, pending_count + 1);
1706
+ if (blocking) {
1707
+ let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
1708
+ this.#blocking_pending.set(effect, blocking_pending_count + 1);
1709
+ }
1710
+ }
1711
+ /**
1712
+ * @param {boolean} blocking
1713
+ * @param {Effect} effect
1714
+ * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
1715
+ */
1716
+ decrement(blocking, effect, skip) {
1717
+ let pending_count = this.#pending.get(effect) ?? 0;
1718
+ if (pending_count === 1) this.#pending.delete(effect);
1719
+ else this.#pending.set(effect, pending_count - 1);
1720
+ if (blocking) {
1721
+ let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
1722
+ if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
1723
+ else this.#blocking_pending.set(effect, blocking_pending_count - 1);
1724
+ }
1725
+ if (this.#decrement_queued || skip) return;
1726
+ this.#decrement_queued = true;
1727
+ queue_micro_task(() => {
1728
+ this.#decrement_queued = false;
1729
+ this.flush();
1730
+ });
1731
+ }
1732
+ /**
1733
+ * @param {Set<Effect>} dirty_effects
1734
+ * @param {Set<Effect>} maybe_dirty_effects
1735
+ */
1736
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
1737
+ for (const e of dirty_effects) this.#dirty_effects.add(e);
1738
+ for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e);
1739
+ dirty_effects.clear();
1740
+ maybe_dirty_effects.clear();
1741
+ }
1742
+ /** @param {(batch: Batch) => void} fn */
1743
+ oncommit(fn) {
1744
+ this.#commit_callbacks.add(fn);
1745
+ }
1746
+ /** @param {(batch: Batch) => void} fn */
1747
+ ondiscard(fn) {
1748
+ this.#discard_callbacks.add(fn);
1749
+ }
1750
+ /** @param {(batch: Batch) => void} fn */
1751
+ on_fork_commit(fn) {
1752
+ this.#fork_commit_callbacks.add(fn);
1753
+ }
1754
+ run_fork_commit_callbacks() {
1755
+ for (const fn of this.#fork_commit_callbacks) fn(this);
1756
+ this.#fork_commit_callbacks.clear();
1757
+ }
1758
+ settled() {
1759
+ return (this.#deferred ??= deferred()).promise;
1760
+ }
1761
+ static ensure() {
1762
+ if (current_batch === null) {
1763
+ const batch = current_batch = new Batch();
1764
+ if (!is_processing) {
1765
+ batches.add(current_batch);
1766
+ if (!is_flushing_sync) queue_micro_task(() => {
1767
+ if (current_batch !== batch) return;
1768
+ batch.flush();
1769
+ });
1770
+ }
1771
+ }
1772
+ return current_batch;
1773
+ }
1774
+ apply() {
1775
+ batch_values = null;
1776
+ return;
1777
+ var intersects, differs;
1778
+ }
1779
+ /**
1780
+ *
1781
+ * @param {Effect} effect
1782
+ */
1783
+ schedule(effect) {
1784
+ last_scheduled_effect = effect;
1785
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
1786
+ effect.b.defer_effect(effect);
1787
+ return;
1788
+ }
1789
+ var e = effect;
1790
+ while (e.parent !== null) {
1791
+ e = e.parent;
1792
+ var flags = e.f;
1793
+ if (collected_effects !== null && e === active_effect) {
1794
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
1795
+ }
1796
+ if ((flags & 96) !== 0) {
1797
+ if ((flags & 1024) === 0) return;
1798
+ e.f ^= CLEAN;
1799
+ }
1800
+ }
1801
+ this.#roots.push(e);
1802
+ }
1803
+ };
1804
+ /**
1805
+ * Synchronously flush any pending updates.
1806
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1807
+ * @template [T=void]
1808
+ * @param {(() => T) | undefined} [fn]
1809
+ * @returns {T}
1810
+ */
1811
+ function flushSync(fn) {
1812
+ var was_flushing_sync = is_flushing_sync;
1813
+ is_flushing_sync = true;
1814
+ try {
1815
+ var result;
1816
+ if (fn) {
1817
+ if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1818
+ result = fn();
1819
+ }
1820
+ while (true) {
1821
+ flush_tasks();
1822
+ if (current_batch === null) return result;
1823
+ current_batch.flush();
1824
+ }
1825
+ } finally {
1826
+ is_flushing_sync = was_flushing_sync;
1827
+ }
1828
+ }
1829
+ function infinite_loop_guard() {
1830
+ try {
1831
+ effect_update_depth_exceeded();
1832
+ } catch (error) {
1833
+ invoke_error_boundary(error, last_scheduled_effect);
1834
+ }
1835
+ }
1836
+ /** @type {Set<Effect> | null} */
1837
+ var eager_block_effects = null;
1838
+ /**
1839
+ * @param {Array<Effect>} effects
1840
+ * @returns {void}
1841
+ */
1842
+ function flush_queued_effects(effects) {
1843
+ var length = effects.length;
1844
+ if (length === 0) return;
1845
+ var i = 0;
1846
+ while (i < length) {
1847
+ var effect = effects[i++];
1848
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1849
+ eager_block_effects = /* @__PURE__ */ new Set();
1850
+ update_effect(effect);
1851
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1852
+ if (eager_block_effects?.size > 0) {
1853
+ old_values.clear();
1854
+ for (const e of eager_block_effects) {
1855
+ if ((e.f & 24576) !== 0) continue;
1856
+ /** @type {Effect[]} */
1857
+ const ordered_effects = [e];
1858
+ let ancestor = e.parent;
1859
+ while (ancestor !== null) {
1860
+ if (eager_block_effects.has(ancestor)) {
1861
+ eager_block_effects.delete(ancestor);
1862
+ ordered_effects.push(ancestor);
1863
+ }
1864
+ ancestor = ancestor.parent;
1865
+ }
1866
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1867
+ const e = ordered_effects[j];
1868
+ if ((e.f & 24576) !== 0) continue;
1869
+ update_effect(e);
1870
+ }
1871
+ }
1872
+ eager_block_effects.clear();
1873
+ }
1874
+ }
1875
+ }
1876
+ eager_block_effects = null;
1877
+ }
1878
+ /**
1879
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1880
+ * depending on `value` and at least one of the other `sources`, so that
1881
+ * these effects can re-run after another batch has been committed
1882
+ * @param {Value} value
1883
+ * @param {Source[]} sources
1884
+ * @param {Set<Value>} marked
1885
+ * @param {Map<Reaction, boolean>} checked
1886
+ */
1887
+ function mark_effects(value, sources, marked, checked) {
1888
+ if (marked.has(value)) return;
1889
+ marked.add(value);
1890
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1891
+ const flags = reaction.f;
1892
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1893
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1894
+ set_signal_status(reaction, DIRTY);
1895
+ schedule_effect(reaction);
1896
+ }
1897
+ }
1898
+ }
1899
+ /**
1900
+ * @param {Reaction} reaction
1901
+ * @param {Source[]} sources
1902
+ * @param {Map<Reaction, boolean>} checked
1903
+ */
1904
+ function depends_on(reaction, sources, checked) {
1905
+ const depends = checked.get(reaction);
1906
+ if (depends !== void 0) return depends;
1907
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1908
+ if (includes.call(sources, dep)) return true;
1909
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1910
+ checked.set(dep, true);
1911
+ return true;
1912
+ }
1913
+ }
1914
+ checked.set(reaction, false);
1915
+ return false;
1916
+ }
1917
+ /**
1918
+ * @param {Effect} effect
1919
+ * @returns {void}
1920
+ */
1921
+ function schedule_effect(effect) {
1922
+ /** @type {Batch} */ current_batch.schedule(effect);
1923
+ }
1924
+ /**
1925
+ * Mark all the effects inside a skipped branch CLEAN, so that
1926
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1927
+ * effects so they can be rescheduled if the branch survives.
1928
+ * @param {Effect} effect
1929
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1930
+ */
1931
+ function reset_branch(effect, tracked) {
1932
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1933
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1934
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1935
+ set_signal_status(effect, CLEAN);
1936
+ var e = effect.first;
1937
+ while (e !== null) {
1938
+ reset_branch(e, tracked);
1939
+ e = e.next;
1940
+ }
1941
+ }
1942
+ /**
1943
+ * Mark an entire effect tree clean following an error
1944
+ * @param {Effect} effect
1945
+ */
1946
+ function reset_all(effect) {
1947
+ set_signal_status(effect, CLEAN);
1948
+ var e = effect.first;
1949
+ while (e !== null) {
1950
+ reset_all(e);
1951
+ e = e.next;
1952
+ }
1953
+ }
1954
+ /**
1955
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1956
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1957
+ *
1958
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1959
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1960
+ *
1961
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1962
+ *
1963
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1964
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
1965
+ *
1966
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1967
+ *
1968
+ * ```js
1969
+ * import { createSubscriber } from 'svelte/reactivity';
1970
+ * import { on } from 'svelte/events';
1971
+ *
1972
+ * export class MediaQuery {
1973
+ * #query;
1974
+ * #subscribe;
1975
+ *
1976
+ * constructor(query) {
1977
+ * this.#query = window.matchMedia(`(${query})`);
1978
+ *
1979
+ * this.#subscribe = createSubscriber((update) => {
1980
+ * // when the `change` event occurs, re-run any effects that read `this.current`
1981
+ * const off = on(this.#query, 'change', update);
1982
+ *
1983
+ * // stop listening when all the effects are destroyed
1984
+ * return () => off();
1985
+ * });
1986
+ * }
1987
+ *
1988
+ * get current() {
1989
+ * // This makes the getter reactive, if read in an effect
1990
+ * this.#subscribe();
1991
+ *
1992
+ * // Return the current state of the query, whether or not we're in an effect
1993
+ * return this.#query.matches;
1994
+ * }
1995
+ * }
1996
+ * ```
1997
+ * @param {(update: () => void) => (() => void) | void} start
1998
+ * @since 5.7.0
1999
+ */
2000
+ function createSubscriber(start) {
2001
+ let subscribers = 0;
2002
+ let version = source(0);
2003
+ /** @type {(() => void) | void} */
2004
+ let stop;
2005
+ return () => {
2006
+ if (effect_tracking()) {
2007
+ get(version);
2008
+ render_effect(() => {
2009
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
2010
+ subscribers += 1;
2011
+ return () => {
2012
+ queue_micro_task(() => {
2013
+ subscribers -= 1;
2014
+ if (subscribers === 0) {
2015
+ stop?.();
2016
+ stop = void 0;
2017
+ increment(version);
2018
+ }
2019
+ });
2020
+ };
2021
+ });
2022
+ }
2023
+ };
2024
+ }
2025
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
2026
+ /**
2027
+ * @typedef {{
2028
+ * onerror?: (error: unknown, reset: () => void) => void;
2029
+ * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
2030
+ * pending?: (anchor: Node) => void;
2031
+ * }} BoundaryProps
2032
+ */
2033
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
2034
+ /**
2035
+ * @param {TemplateNode} node
2036
+ * @param {BoundaryProps} props
2037
+ * @param {((anchor: Node) => void)} children
2038
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
2039
+ * @returns {void}
2040
+ */
2041
+ function boundary(node, props, children, transform_error) {
2042
+ new Boundary(node, props, children, transform_error);
2043
+ }
2044
+ var Boundary = class {
2045
+ /** @type {Boundary | null} */
2046
+ parent;
2047
+ is_pending = false;
2048
+ /**
2049
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
2050
+ * Inherited from parent boundary, or defaults to identity.
2051
+ * @type {(error: unknown) => unknown}
2052
+ */
2053
+ transform_error;
2054
+ /** @type {TemplateNode} */
2055
+ #anchor;
2056
+ /** @type {TemplateNode | null} */
2057
+ #hydrate_open = hydrating ? hydrate_node : null;
2058
+ /** @type {BoundaryProps} */
2059
+ #props;
2060
+ /** @type {((anchor: Node) => void)} */
2061
+ #children;
2062
+ /** @type {Effect} */
2063
+ #effect;
2064
+ /** @type {Effect | null} */
2065
+ #main_effect = null;
2066
+ /** @type {Effect | null} */
2067
+ #pending_effect = null;
2068
+ /** @type {Effect | null} */
2069
+ #failed_effect = null;
2070
+ /** @type {DocumentFragment | null} */
2071
+ #offscreen_fragment = null;
2072
+ #local_pending_count = 0;
2073
+ #pending_count = 0;
2074
+ #pending_count_update_queued = false;
2075
+ /** @type {Set<Effect>} */
2076
+ #dirty_effects = /* @__PURE__ */ new Set();
2077
+ /** @type {Set<Effect>} */
2078
+ #maybe_dirty_effects = /* @__PURE__ */ new Set();
2079
+ /**
2080
+ * A source containing the number of pending async deriveds/expressions.
2081
+ * Only created if `$effect.pending()` is used inside the boundary,
2082
+ * otherwise updating the source results in needless `Batch.ensure()`
2083
+ * calls followed by no-op flushes
2084
+ * @type {Source<number> | null}
2085
+ */
2086
+ #effect_pending = null;
2087
+ #effect_pending_subscriber = createSubscriber(() => {
2088
+ this.#effect_pending = source(this.#local_pending_count);
2089
+ return () => {
2090
+ this.#effect_pending = null;
2091
+ };
2092
+ });
2093
+ /**
2094
+ * @param {TemplateNode} node
2095
+ * @param {BoundaryProps} props
2096
+ * @param {((anchor: Node) => void)} children
2097
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
2098
+ */
2099
+ constructor(node, props, children, transform_error) {
2100
+ this.#anchor = node;
2101
+ this.#props = props;
2102
+ this.#children = (anchor) => {
2103
+ var effect = active_effect;
2104
+ effect.b = this;
2105
+ effect.f |= 128;
2106
+ children(anchor);
2107
+ };
2108
+ this.parent = active_effect.b;
2109
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
2110
+ this.#effect = block(() => {
2111
+ if (hydrating) {
2112
+ const comment = this.#hydrate_open;
2113
+ hydrate_next();
2114
+ const server_rendered_pending = comment.data === "[!";
2115
+ if (comment.data.startsWith("[?")) {
2116
+ const serialized_error = JSON.parse(comment.data.slice(2));
2117
+ this.#hydrate_failed_content(serialized_error);
2118
+ } else if (server_rendered_pending) this.#hydrate_pending_content();
2119
+ else this.#hydrate_resolved_content();
2120
+ } else this.#render();
2121
+ }, flags);
2122
+ if (hydrating) this.#anchor = hydrate_node;
2123
+ }
2124
+ #hydrate_resolved_content() {
2125
+ try {
2126
+ this.#main_effect = branch(() => this.#children(this.#anchor));
2127
+ } catch (error) {
2128
+ this.error(error);
2129
+ }
2130
+ }
2131
+ /**
2132
+ * @param {unknown} error The deserialized error from the server's hydration comment
2133
+ */
2134
+ #hydrate_failed_content(error) {
2135
+ const failed = this.#props.failed;
2136
+ if (!failed) return;
2137
+ this.#failed_effect = branch(() => {
2138
+ failed(this.#anchor, () => error, () => () => {});
2139
+ });
2140
+ }
2141
+ #hydrate_pending_content() {
2142
+ const pending = this.#props.pending;
2143
+ if (!pending) return;
2144
+ this.is_pending = true;
2145
+ this.#pending_effect = branch(() => pending(this.#anchor));
2146
+ queue_micro_task(() => {
2147
+ var fragment = this.#offscreen_fragment = document.createDocumentFragment();
2148
+ var anchor = create_text();
2149
+ fragment.append(anchor);
2150
+ this.#main_effect = this.#run(() => {
2151
+ return branch(() => this.#children(anchor));
2152
+ });
2153
+ if (this.#pending_count === 0) {
2154
+ this.#anchor.before(fragment);
2155
+ this.#offscreen_fragment = null;
2156
+ pause_effect(this.#pending_effect, () => {
2157
+ this.#pending_effect = null;
2158
+ });
2159
+ this.#resolve(current_batch);
2160
+ }
2161
+ });
2162
+ }
2163
+ #render() {
2164
+ try {
2165
+ this.is_pending = this.has_pending_snippet();
2166
+ this.#pending_count = 0;
2167
+ this.#local_pending_count = 0;
2168
+ this.#main_effect = branch(() => {
2169
+ this.#children(this.#anchor);
2170
+ });
2171
+ if (this.#pending_count > 0) {
2172
+ var fragment = this.#offscreen_fragment = document.createDocumentFragment();
2173
+ move_effect(this.#main_effect, fragment);
2174
+ const pending = this.#props.pending;
2175
+ this.#pending_effect = branch(() => pending(this.#anchor));
2176
+ } else this.#resolve(current_batch);
2177
+ } catch (error) {
2178
+ this.error(error);
2179
+ }
2180
+ }
2181
+ /**
2182
+ * @param {Batch} batch
2183
+ */
2184
+ #resolve(batch) {
2185
+ this.is_pending = false;
2186
+ batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
2187
+ }
2188
+ /**
2189
+ * Defer an effect inside a pending boundary until the boundary resolves
2190
+ * @param {Effect} effect
2191
+ */
2192
+ defer_effect(effect) {
2193
+ defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
2194
+ }
2195
+ /**
2196
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
2197
+ * @returns {boolean}
2198
+ */
2199
+ is_rendered() {
2200
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
2201
+ }
2202
+ has_pending_snippet() {
2203
+ return !!this.#props.pending;
2204
+ }
2205
+ /**
2206
+ * @template T
2207
+ * @param {() => T} fn
2208
+ */
2209
+ #run(fn) {
2210
+ var previous_effect = active_effect;
2211
+ var previous_reaction = active_reaction;
2212
+ var previous_ctx = component_context;
2213
+ set_active_effect(this.#effect);
2214
+ set_active_reaction(this.#effect);
2215
+ set_component_context(this.#effect.ctx);
2216
+ try {
2217
+ Batch.ensure();
2218
+ return fn();
2219
+ } catch (e) {
2220
+ handle_error(e);
2221
+ return null;
2222
+ } finally {
2223
+ set_active_effect(previous_effect);
2224
+ set_active_reaction(previous_reaction);
2225
+ set_component_context(previous_ctx);
2226
+ }
2227
+ }
2228
+ /**
2229
+ * Updates the pending count associated with the currently visible pending snippet,
2230
+ * if any, such that we can replace the snippet with content once work is done
2231
+ * @param {1 | -1} d
2232
+ * @param {Batch} batch
2233
+ */
2234
+ #update_pending_count(d, batch) {
2235
+ if (!this.has_pending_snippet()) {
2236
+ if (this.parent) this.parent.#update_pending_count(d, batch);
2237
+ return;
2238
+ }
2239
+ this.#pending_count += d;
2240
+ if (this.#pending_count === 0) {
2241
+ this.#resolve(batch);
2242
+ if (this.#pending_effect) pause_effect(this.#pending_effect, () => {
2243
+ this.#pending_effect = null;
2244
+ });
2245
+ if (this.#offscreen_fragment) {
2246
+ this.#anchor.before(this.#offscreen_fragment);
2247
+ this.#offscreen_fragment = null;
2248
+ }
2249
+ }
2250
+ }
2251
+ /**
2252
+ * Update the source that powers `$effect.pending()` inside this boundary,
2253
+ * and controls when the current `pending` snippet (if any) is removed.
2254
+ * Do not call from inside the class
2255
+ * @param {1 | -1} d
2256
+ * @param {Batch} batch
2257
+ */
2258
+ update_pending_count(d, batch) {
2259
+ this.#update_pending_count(d, batch);
2260
+ this.#local_pending_count += d;
2261
+ if (!this.#effect_pending || this.#pending_count_update_queued) return;
2262
+ this.#pending_count_update_queued = true;
2263
+ queue_micro_task(() => {
2264
+ this.#pending_count_update_queued = false;
2265
+ if (this.#effect_pending) internal_set(this.#effect_pending, this.#local_pending_count);
2266
+ });
2267
+ }
2268
+ get_effect_pending() {
2269
+ this.#effect_pending_subscriber();
2270
+ return get(this.#effect_pending);
2271
+ }
2272
+ /** @param {unknown} error */
2273
+ error(error) {
2274
+ if (!this.#props.onerror && !this.#props.failed) throw error;
2275
+ if (current_batch?.is_fork) {
2276
+ if (this.#main_effect) current_batch.skip_effect(this.#main_effect);
2277
+ if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);
2278
+ if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);
2279
+ current_batch.on_fork_commit(() => {
2280
+ this.#handle_error(error);
2281
+ });
2282
+ } else this.#handle_error(error);
2283
+ }
2284
+ /**
2285
+ * @param {unknown} error
2286
+ */
2287
+ #handle_error(error) {
2288
+ if (this.#main_effect) {
2289
+ destroy_effect(this.#main_effect);
2290
+ this.#main_effect = null;
2291
+ }
2292
+ if (this.#pending_effect) {
2293
+ destroy_effect(this.#pending_effect);
2294
+ this.#pending_effect = null;
2295
+ }
2296
+ if (this.#failed_effect) {
2297
+ destroy_effect(this.#failed_effect);
2298
+ this.#failed_effect = null;
2299
+ }
2300
+ if (hydrating) {
2301
+ set_hydrate_node(this.#hydrate_open);
2302
+ next();
2303
+ set_hydrate_node(skip_nodes());
2304
+ }
2305
+ var onerror = this.#props.onerror;
2306
+ let failed = this.#props.failed;
2307
+ var did_reset = false;
2308
+ var calling_on_error = false;
2309
+ const reset = () => {
2310
+ if (did_reset) {
2311
+ svelte_boundary_reset_noop();
2312
+ return;
2313
+ }
2314
+ did_reset = true;
2315
+ if (calling_on_error) svelte_boundary_reset_onerror();
2316
+ if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => {
2317
+ this.#failed_effect = null;
2318
+ });
2319
+ this.#run(() => {
2320
+ this.#render();
2321
+ });
2322
+ };
2323
+ /** @param {unknown} transformed_error */
2324
+ const handle_error_result = (transformed_error) => {
2325
+ try {
2326
+ calling_on_error = true;
2327
+ onerror?.(transformed_error, reset);
2328
+ calling_on_error = false;
2329
+ } catch (error) {
2330
+ invoke_error_boundary(error, this.#effect && this.#effect.parent);
2331
+ }
2332
+ if (failed) this.#failed_effect = this.#run(() => {
2333
+ try {
2334
+ return branch(() => {
2335
+ var effect = active_effect;
2336
+ effect.b = this;
2337
+ effect.f |= 128;
2338
+ failed(this.#anchor, () => transformed_error, () => reset);
2339
+ });
2340
+ } catch (error) {
2341
+ invoke_error_boundary(error, this.#effect.parent);
2342
+ return null;
2343
+ }
2344
+ });
2345
+ };
2346
+ queue_micro_task(() => {
2347
+ /** @type {unknown} */
2348
+ var result;
2349
+ try {
2350
+ result = this.transform_error(error);
2351
+ } catch (e) {
2352
+ invoke_error_boundary(e, this.#effect && this.#effect.parent);
2353
+ return;
2354
+ }
2355
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
2356
+ /** @type {any} */ result.then(
2357
+ handle_error_result,
2358
+ /** @param {unknown} e */
2359
+ (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
2360
+ );
2361
+ else handle_error_result(result);
2362
+ });
2363
+ }
2364
+ };
2365
+ /**
2366
+ * @param {Derived} derived
2367
+ * @returns {void}
2368
+ */
2369
+ function destroy_derived_effects(derived) {
2370
+ var effects = derived.effects;
2371
+ if (effects !== null) {
2372
+ derived.effects = null;
2373
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
2374
+ }
2375
+ }
2376
+ /**
2377
+ * @template T
2378
+ * @param {Derived} derived
2379
+ * @returns {T}
2380
+ */
2381
+ function execute_derived(derived) {
2382
+ var value;
2383
+ var prev_active_effect = active_effect;
2384
+ var parent = derived.parent;
2385
+ if (!is_destroying_effect && parent !== null && (parent.f & 24576) !== 0) {
2386
+ derived_inert();
2387
+ return derived.v;
2388
+ }
2389
+ set_active_effect(parent);
2390
+ try {
2391
+ derived.f &= ~WAS_MARKED;
2392
+ destroy_derived_effects(derived);
2393
+ value = update_reaction(derived);
2394
+ } finally {
2395
+ set_active_effect(prev_active_effect);
2396
+ }
2397
+ return value;
2398
+ }
2399
+ /**
2400
+ * @param {Derived} derived
2401
+ * @returns {void}
2402
+ */
2403
+ function update_derived(derived) {
2404
+ var value = execute_derived(derived);
2405
+ if (!derived.equals(value)) {
2406
+ derived.wv = increment_write_version();
2407
+ if (!current_batch?.is_fork || derived.deps === null) {
2408
+ if (current_batch !== null) current_batch.capture(derived, value, true);
2409
+ else derived.v = value;
2410
+ if (derived.deps === null) {
2411
+ set_signal_status(derived, CLEAN);
2412
+ return;
2413
+ }
2414
+ }
2415
+ }
2416
+ if (is_destroying_effect) return;
2417
+ if (batch_values !== null) {
2418
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
2419
+ } else update_derived_status(derived);
2420
+ }
2421
+ /**
2422
+ * @param {Derived} derived
2423
+ */
2424
+ function freeze_derived_effects(derived) {
2425
+ if (derived.effects === null) return;
2426
+ for (const e of derived.effects) if (e.teardown || e.ac) {
2427
+ e.teardown?.();
2428
+ e.ac?.abort(STALE_REACTION);
2429
+ e.teardown = noop;
2430
+ e.ac = null;
2431
+ remove_reactions(e, 0);
2432
+ destroy_effect_children(e);
2433
+ }
2434
+ }
2435
+ /**
2436
+ * @param {Derived} derived
2437
+ */
2438
+ function unfreeze_derived_effects(derived) {
2439
+ if (derived.effects === null) return;
2440
+ for (const e of derived.effects) if (e.teardown) update_effect(e);
2441
+ }
2442
+ /** @import { Derived, Effect, Source, Value } from '#client' */
2443
+ /** @type {Set<any>} */
2444
+ var eager_effects = /* @__PURE__ */ new Set();
2445
+ /** @type {Map<Source, any>} */
2446
+ var old_values = /* @__PURE__ */ new Map();
2447
+ var eager_effects_deferred = false;
2448
+ /**
2449
+ * @template V
2450
+ * @param {V} v
2451
+ * @param {Error | null} [stack]
2452
+ * @returns {Source<V>}
2453
+ */
2454
+ function source(v, stack) {
2455
+ return {
2456
+ f: 0,
2457
+ v,
2458
+ reactions: null,
2459
+ equals,
2460
+ rv: 0,
2461
+ wv: 0
2462
+ };
2463
+ }
2464
+ /**
2465
+ * @template V
2466
+ * @param {V} v
2467
+ * @param {Error | null} [stack]
2468
+ */
2469
+ /* @__NO_SIDE_EFFECTS__ */
2470
+ function state(v, stack) {
2471
+ const s = source(v, stack);
2472
+ push_reaction_value(s);
2473
+ return s;
2474
+ }
2475
+ /**
2476
+ * @template V
2477
+ * @param {V} initial_value
2478
+ * @param {boolean} [immutable]
2479
+ * @returns {Source<V>}
2480
+ */
2481
+ /* @__NO_SIDE_EFFECTS__ */
2482
+ function mutable_source(initial_value, immutable = false, trackable = true) {
2483
+ const s = source(initial_value);
2484
+ if (!immutable) s.equals = safe_equals;
2485
+ if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) (component_context.l.s ??= []).push(s);
2486
+ return s;
2487
+ }
2488
+ /**
2489
+ * @template V
2490
+ * @param {Source<V>} source
2491
+ * @param {V} value
2492
+ * @param {boolean} [should_proxy]
2493
+ * @returns {V}
2494
+ */
2495
+ function set(source, value, should_proxy = false) {
2496
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
2497
+ return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
2498
+ }
2499
+ /**
2500
+ * @template V
2501
+ * @param {Source<V>} source
2502
+ * @param {V} value
2503
+ * @param {Effect[] | null} [updated_during_traversal]
2504
+ * @returns {V}
2505
+ */
2506
+ function internal_set(source, value, updated_during_traversal = null) {
2507
+ if (!source.equals(value)) {
2508
+ old_values.set(source, is_destroying_effect ? value : source.v);
2509
+ var batch = Batch.ensure();
2510
+ batch.capture(source, value);
2511
+ if ((source.f & 2) !== 0) {
2512
+ const derived = source;
2513
+ if ((source.f & 2048) !== 0) execute_derived(derived);
2514
+ if (batch_values === null) update_derived_status(derived);
2515
+ }
2516
+ source.wv = increment_write_version();
2517
+ mark_reactions(source, DIRTY, updated_during_traversal);
2518
+ if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
2519
+ else untracked_writes.push(source);
2520
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
2521
+ }
2522
+ return value;
2523
+ }
2524
+ function flush_eager_effects() {
2525
+ eager_effects_deferred = false;
2526
+ for (const effect of eager_effects) {
2527
+ if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
2528
+ if (is_dirty(effect)) update_effect(effect);
2529
+ }
2530
+ eager_effects.clear();
2531
+ }
2532
+ /**
2533
+ * Silently (without using `get`) increment a source
2534
+ * @param {Source<number>} source
2535
+ */
2536
+ function increment(source) {
2537
+ set(source, source.v + 1);
2538
+ }
2539
+ /**
2540
+ * @param {Value} signal
2541
+ * @param {number} status should be DIRTY or MAYBE_DIRTY
2542
+ * @param {Effect[] | null} updated_during_traversal
2543
+ * @returns {void}
2544
+ */
2545
+ function mark_reactions(signal, status, updated_during_traversal) {
2546
+ var reactions = signal.reactions;
2547
+ if (reactions === null) return;
2548
+ var runes = is_runes();
2549
+ var length = reactions.length;
2550
+ for (var i = 0; i < length; i++) {
2551
+ var reaction = reactions[i];
2552
+ var flags = reaction.f;
2553
+ if (!runes && reaction === active_effect) continue;
2554
+ var not_dirty = (flags & DIRTY) === 0;
2555
+ if (not_dirty) set_signal_status(reaction, status);
2556
+ if ((flags & 2) !== 0) {
2557
+ var derived = reaction;
2558
+ batch_values?.delete(derived);
2559
+ if ((flags & 65536) === 0) {
2560
+ if (flags & 512) reaction.f |= WAS_MARKED;
2561
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
2562
+ }
2563
+ } else if (not_dirty) {
2564
+ var effect = reaction;
2565
+ if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
2566
+ if (updated_during_traversal !== null) updated_during_traversal.push(effect);
2567
+ else schedule_effect(effect);
2568
+ }
2569
+ }
2570
+ }
2571
+ /**
2572
+ * @template T
2573
+ * @param {T} value
2574
+ * @returns {T}
2575
+ */
2576
+ function proxy(value) {
2577
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
2578
+ const prototype = get_prototype_of(value);
2579
+ if (prototype !== object_prototype && prototype !== array_prototype) return value;
2580
+ /** @type {Map<any, Source<any>>} */
2581
+ var sources = /* @__PURE__ */ new Map();
2582
+ var is_proxied_array = is_array(value);
2583
+ var version = /* @__PURE__ */ state(0);
2584
+ var stack = null;
2585
+ var parent_version = update_version;
2586
+ /**
2587
+ * Executes the proxy in the context of the reaction it was originally created in, if any
2588
+ * @template T
2589
+ * @param {() => T} fn
2590
+ */
2591
+ var with_parent = (fn) => {
2592
+ if (update_version === parent_version) return fn();
2593
+ var reaction = active_reaction;
2594
+ var version = update_version;
2595
+ set_active_reaction(null);
2596
+ set_update_version(parent_version);
2597
+ var result = fn();
2598
+ set_active_reaction(reaction);
2599
+ set_update_version(version);
2600
+ return result;
2601
+ };
2602
+ if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
2603
+ /** @type {any[]} */
2604
+ value.length,
2605
+ stack
2606
+ ));
2607
+ return new Proxy(value, {
2608
+ defineProperty(_, prop, descriptor) {
2609
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
2610
+ var s = sources.get(prop);
2611
+ if (s === void 0) with_parent(() => {
2612
+ var s = /* @__PURE__ */ state(descriptor.value, stack);
2613
+ sources.set(prop, s);
2614
+ return s;
2615
+ });
2616
+ else set(s, descriptor.value, true);
2617
+ return true;
2618
+ },
2619
+ deleteProperty(target, prop) {
2620
+ var s = sources.get(prop);
2621
+ if (s === void 0) {
2622
+ if (prop in target) {
2623
+ const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
2624
+ sources.set(prop, s);
2625
+ increment(version);
2626
+ }
2627
+ } else {
2628
+ set(s, UNINITIALIZED);
2629
+ increment(version);
2630
+ }
2631
+ return true;
2632
+ },
2633
+ get(target, prop, receiver) {
2634
+ if (prop === STATE_SYMBOL) return value;
2635
+ var s = sources.get(prop);
2636
+ var exists = prop in target;
2637
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
2638
+ s = with_parent(() => {
2639
+ return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
2640
+ });
2641
+ sources.set(prop, s);
2642
+ }
2643
+ if (s !== void 0) {
2644
+ var v = get(s);
2645
+ return v === UNINITIALIZED ? void 0 : v;
2646
+ }
2647
+ return Reflect.get(target, prop, receiver);
2648
+ },
2649
+ getOwnPropertyDescriptor(target, prop) {
2650
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2651
+ if (descriptor && "value" in descriptor) {
2652
+ var s = sources.get(prop);
2653
+ if (s) descriptor.value = get(s);
2654
+ } else if (descriptor === void 0) {
2655
+ var source = sources.get(prop);
2656
+ var value = source?.v;
2657
+ if (source !== void 0 && value !== UNINITIALIZED) return {
2658
+ enumerable: true,
2659
+ configurable: true,
2660
+ value,
2661
+ writable: true
2662
+ };
2663
+ }
2664
+ return descriptor;
2665
+ },
2666
+ has(target, prop) {
2667
+ if (prop === STATE_SYMBOL) return true;
2668
+ var s = sources.get(prop);
2669
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
2670
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
2671
+ if (s === void 0) {
2672
+ s = with_parent(() => {
2673
+ return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
2674
+ });
2675
+ sources.set(prop, s);
2676
+ }
2677
+ if (get(s) === UNINITIALIZED) return false;
2678
+ }
2679
+ return has;
2680
+ },
2681
+ set(target, prop, value, receiver) {
2682
+ var s = sources.get(prop);
2683
+ var has = prop in target;
2684
+ if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
2685
+ var other_s = sources.get(i + "");
2686
+ if (other_s !== void 0) set(other_s, UNINITIALIZED);
2687
+ else if (i in target) {
2688
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
2689
+ sources.set(i + "", other_s);
2690
+ }
2691
+ }
2692
+ if (s === void 0) {
2693
+ if (!has || get_descriptor(target, prop)?.writable) {
2694
+ s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
2695
+ set(s, proxy(value));
2696
+ sources.set(prop, s);
2697
+ }
2698
+ } else {
2699
+ has = s.v !== UNINITIALIZED;
2700
+ var p = with_parent(() => proxy(value));
2701
+ set(s, p);
2702
+ }
2703
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2704
+ if (descriptor?.set) descriptor.set.call(receiver, value);
2705
+ if (!has) {
2706
+ if (is_proxied_array && typeof prop === "string") {
2707
+ var ls = sources.get("length");
2708
+ var n = Number(prop);
2709
+ if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
2710
+ }
2711
+ increment(version);
2712
+ }
2713
+ return true;
2714
+ },
2715
+ ownKeys(target) {
2716
+ get(version);
2717
+ var own_keys = Reflect.ownKeys(target).filter((key) => {
2718
+ var source = sources.get(key);
2719
+ return source === void 0 || source.v !== UNINITIALIZED;
2720
+ });
2721
+ for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
2722
+ return own_keys;
2723
+ },
2724
+ setPrototypeOf() {
2725
+ state_prototype_fixed();
2726
+ }
2727
+ });
2728
+ }
2729
+ /** @type {Window} */
2730
+ var $window;
2731
+ /** @type {() => Node | null} */
2732
+ var first_child_getter;
2733
+ /** @type {() => Node | null} */
2734
+ var next_sibling_getter;
2735
+ /**
2736
+ * Initialize these lazily to avoid issues when using the runtime in a server context
2737
+ * where these globals are not available while avoiding a separate server entry point
2738
+ */
2739
+ function init_operations() {
2740
+ if ($window !== void 0) return;
2741
+ $window = window;
2742
+ /Firefox/.test(navigator.userAgent);
2743
+ var element_prototype = Element.prototype;
2744
+ var node_prototype = Node.prototype;
2745
+ var text_prototype = Text.prototype;
2746
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2747
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2748
+ if (is_extensible(element_prototype)) {
2749
+ element_prototype.__click = void 0;
2750
+ element_prototype.__className = void 0;
2751
+ element_prototype.__attributes = null;
2752
+ element_prototype.__style = void 0;
2753
+ element_prototype.__e = void 0;
2754
+ }
2755
+ if (is_extensible(text_prototype)) text_prototype.__t = void 0;
2756
+ }
2757
+ /**
2758
+ * @param {string} value
2759
+ * @returns {Text}
2760
+ */
2761
+ function create_text(value = "") {
2762
+ return document.createTextNode(value);
2763
+ }
2764
+ /**
2765
+ * @template {Node} N
2766
+ * @param {N} node
2767
+ */
2768
+ /* @__NO_SIDE_EFFECTS__ */
2769
+ function get_first_child(node) {
2770
+ return first_child_getter.call(node);
2771
+ }
2772
+ /**
2773
+ * @template {Node} N
2774
+ * @param {N} node
2775
+ */
2776
+ /* @__NO_SIDE_EFFECTS__ */
2777
+ function get_next_sibling(node) {
2778
+ return next_sibling_getter.call(node);
2779
+ }
2780
+ /**
2781
+ * @template {Node} N
2782
+ * @param {N} node
2783
+ * @returns {void}
2784
+ */
2785
+ function clear_text_content(node) {
2786
+ node.textContent = "";
2787
+ }
2788
+ /**
2789
+ * @template T
2790
+ * @param {() => T} fn
2791
+ */
2792
+ function without_reactive_context(fn) {
2793
+ var previous_reaction = active_reaction;
2794
+ var previous_effect = active_effect;
2795
+ set_active_reaction(null);
2796
+ set_active_effect(null);
2797
+ try {
2798
+ return fn();
2799
+ } finally {
2800
+ set_active_reaction(previous_reaction);
2801
+ set_active_effect(previous_effect);
2802
+ }
2803
+ }
2804
+ /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2805
+ /**
2806
+ * @param {Effect} effect
2807
+ * @param {Effect} parent_effect
2808
+ */
2809
+ function push_effect(effect, parent_effect) {
2810
+ var parent_last = parent_effect.last;
2811
+ if (parent_last === null) parent_effect.last = parent_effect.first = effect;
2812
+ else {
2813
+ parent_last.next = effect;
2814
+ effect.prev = parent_last;
2815
+ parent_effect.last = effect;
2816
+ }
2817
+ }
2818
+ /**
2819
+ * @param {number} type
2820
+ * @param {null | (() => void | (() => void))} fn
2821
+ * @returns {Effect}
2822
+ */
2823
+ function create_effect(type, fn) {
2824
+ var parent = active_effect;
2825
+ if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
2826
+ /** @type {Effect} */
2827
+ var effect = {
2828
+ ctx: component_context,
2829
+ deps: null,
2830
+ nodes: null,
2831
+ f: type | DIRTY | 512,
2832
+ first: null,
2833
+ fn,
2834
+ last: null,
2835
+ next: null,
2836
+ parent,
2837
+ b: parent && parent.b,
2838
+ prev: null,
2839
+ teardown: null,
2840
+ wv: 0,
2841
+ ac: null
2842
+ };
2843
+ current_batch?.register_created_effect(effect);
2844
+ /** @type {Effect | null} */
2845
+ var e = effect;
2846
+ if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
2847
+ else Batch.ensure().schedule(effect);
2848
+ else if (fn !== null) {
2849
+ try {
2850
+ update_effect(effect);
2851
+ } catch (e) {
2852
+ destroy_effect(effect);
2853
+ throw e;
2854
+ }
2855
+ if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
2856
+ e = e.first;
2857
+ if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
2858
+ }
2859
+ }
2860
+ if (e !== null) {
2861
+ e.parent = parent;
2862
+ if (parent !== null) push_effect(e, parent);
2863
+ if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
2864
+ var derived = active_reaction;
2865
+ (derived.effects ??= []).push(e);
2866
+ }
2867
+ }
2868
+ return effect;
2869
+ }
2870
+ /**
2871
+ * Internal representation of `$effect.tracking()`
2872
+ * @returns {boolean}
2873
+ */
2874
+ function effect_tracking() {
2875
+ return active_reaction !== null && !untracking;
2876
+ }
2877
+ /**
2878
+ * @param {() => void | (() => void)} fn
2879
+ */
2880
+ function create_user_effect(fn) {
2881
+ return create_effect(4 | USER_EFFECT, fn);
2882
+ }
2883
+ /**
2884
+ * An effect root whose children can transition out
2885
+ * @param {() => void} fn
2886
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
2887
+ */
2888
+ function component_root(fn) {
2889
+ Batch.ensure();
2890
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2891
+ return (options = {}) => {
2892
+ return new Promise((fulfil) => {
2893
+ if (options.outro) pause_effect(effect, () => {
2894
+ destroy_effect(effect);
2895
+ fulfil(void 0);
2896
+ });
2897
+ else {
2898
+ destroy_effect(effect);
2899
+ fulfil(void 0);
2900
+ }
2901
+ });
2902
+ };
2903
+ }
2904
+ /**
2905
+ * @param {() => void | (() => void)} fn
2906
+ * @returns {Effect}
2907
+ */
2908
+ function render_effect(fn, flags = 0) {
2909
+ return create_effect(8 | flags, fn);
2910
+ }
2911
+ /**
2912
+ * @param {(() => void)} fn
2913
+ * @param {number} flags
2914
+ */
2915
+ function block(fn, flags = 0) {
2916
+ return create_effect(16 | flags, fn);
2917
+ }
2918
+ /**
2919
+ * @param {(() => void)} fn
2920
+ */
2921
+ function branch(fn) {
2922
+ return create_effect(32 | EFFECT_PRESERVED, fn);
2923
+ }
2924
+ /**
2925
+ * @param {Effect} effect
2926
+ */
2927
+ function execute_effect_teardown(effect) {
2928
+ var teardown = effect.teardown;
2929
+ if (teardown !== null) {
2930
+ const previously_destroying_effect = is_destroying_effect;
2931
+ const previous_reaction = active_reaction;
2932
+ set_is_destroying_effect(true);
2933
+ set_active_reaction(null);
2934
+ try {
2935
+ teardown.call(null);
2936
+ } finally {
2937
+ set_is_destroying_effect(previously_destroying_effect);
2938
+ set_active_reaction(previous_reaction);
2939
+ }
2940
+ }
2941
+ }
2942
+ /**
2943
+ * @param {Effect} signal
2944
+ * @param {boolean} remove_dom
2945
+ * @returns {void}
2946
+ */
2947
+ function destroy_effect_children(signal, remove_dom = false) {
2948
+ var effect = signal.first;
2949
+ signal.first = signal.last = null;
2950
+ while (effect !== null) {
2951
+ const controller = effect.ac;
2952
+ if (controller !== null) without_reactive_context(() => {
2953
+ controller.abort(STALE_REACTION);
2954
+ });
2955
+ var next = effect.next;
2956
+ if ((effect.f & 64) !== 0) effect.parent = null;
2957
+ else destroy_effect(effect, remove_dom);
2958
+ effect = next;
2959
+ }
2960
+ }
2961
+ /**
2962
+ * @param {Effect} signal
2963
+ * @returns {void}
2964
+ */
2965
+ function destroy_block_effect_children(signal) {
2966
+ var effect = signal.first;
2967
+ while (effect !== null) {
2968
+ var next = effect.next;
2969
+ if ((effect.f & 32) === 0) destroy_effect(effect);
2970
+ effect = next;
2971
+ }
2972
+ }
2973
+ /**
2974
+ * @param {Effect} effect
2975
+ * @param {boolean} [remove_dom]
2976
+ * @returns {void}
2977
+ */
2978
+ function destroy_effect(effect, remove_dom = true) {
2979
+ var removed = false;
2980
+ if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
2981
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
2982
+ removed = true;
2983
+ }
2984
+ set_signal_status(effect, DESTROYING);
2985
+ destroy_effect_children(effect, remove_dom && !removed);
2986
+ remove_reactions(effect, 0);
2987
+ var transitions = effect.nodes && effect.nodes.t;
2988
+ if (transitions !== null) for (const transition of transitions) transition.stop();
2989
+ execute_effect_teardown(effect);
2990
+ effect.f ^= DESTROYING;
2991
+ effect.f |= DESTROYED;
2992
+ var parent = effect.parent;
2993
+ if (parent !== null && parent.first !== null) unlink_effect(effect);
2994
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
2995
+ }
2996
+ /**
2997
+ *
2998
+ * @param {TemplateNode | null} node
2999
+ * @param {TemplateNode} end
3000
+ */
3001
+ function remove_effect_dom(node, end) {
3002
+ while (node !== null) {
3003
+ /** @type {TemplateNode | null} */
3004
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
3005
+ node.remove();
3006
+ node = next;
3007
+ }
3008
+ }
3009
+ /**
3010
+ * Detach an effect from the effect tree, freeing up memory and
3011
+ * reducing the amount of work that happens on subsequent traversals
3012
+ * @param {Effect} effect
3013
+ */
3014
+ function unlink_effect(effect) {
3015
+ var parent = effect.parent;
3016
+ var prev = effect.prev;
3017
+ var next = effect.next;
3018
+ if (prev !== null) prev.next = next;
3019
+ if (next !== null) next.prev = prev;
3020
+ if (parent !== null) {
3021
+ if (parent.first === effect) parent.first = next;
3022
+ if (parent.last === effect) parent.last = prev;
3023
+ }
3024
+ }
3025
+ /**
3026
+ * When a block effect is removed, we don't immediately destroy it or yank it
3027
+ * out of the DOM, because it might have transitions. Instead, we 'pause' it.
3028
+ * It stays around (in memory, and in the DOM) until outro transitions have
3029
+ * completed, and if the state change is reversed then we _resume_ it.
3030
+ * A paused effect does not update, and the DOM subtree becomes inert.
3031
+ * @param {Effect} effect
3032
+ * @param {() => void} [callback]
3033
+ * @param {boolean} [destroy]
3034
+ */
3035
+ function pause_effect(effect, callback, destroy = true) {
3036
+ /** @type {TransitionManager[]} */
3037
+ var transitions = [];
3038
+ pause_children(effect, transitions, true);
3039
+ var fn = () => {
3040
+ if (destroy) destroy_effect(effect);
3041
+ if (callback) callback();
3042
+ };
3043
+ var remaining = transitions.length;
3044
+ if (remaining > 0) {
3045
+ var check = () => --remaining || fn();
3046
+ for (var transition of transitions) transition.out(check);
3047
+ } else fn();
3048
+ }
3049
+ /**
3050
+ * @param {Effect} effect
3051
+ * @param {TransitionManager[]} transitions
3052
+ * @param {boolean} local
3053
+ */
3054
+ function pause_children(effect, transitions, local) {
3055
+ if ((effect.f & 8192) !== 0) return;
3056
+ effect.f ^= INERT;
3057
+ var t = effect.nodes && effect.nodes.t;
3058
+ if (t !== null) {
3059
+ for (const transition of t) if (transition.is_global || local) transitions.push(transition);
3060
+ }
3061
+ var child = effect.first;
3062
+ while (child !== null) {
3063
+ var sibling = child.next;
3064
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
3065
+ pause_children(child, transitions, transparent ? local : false);
3066
+ child = sibling;
3067
+ }
3068
+ }
3069
+ /**
3070
+ * @param {Effect} effect
3071
+ * @param {DocumentFragment} fragment
3072
+ */
3073
+ function move_effect(effect, fragment) {
3074
+ if (!effect.nodes) return;
3075
+ /** @type {TemplateNode | null} */
3076
+ var node = effect.nodes.start;
3077
+ var end = effect.nodes.end;
3078
+ while (node !== null) {
3079
+ /** @type {TemplateNode | null} */
3080
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
3081
+ fragment.append(node);
3082
+ node = next;
3083
+ }
3084
+ }
3085
+ /**
3086
+ * @type {Set<Value> | null}
3087
+ * @deprecated
3088
+ */
3089
+ var captured_signals = null;
3090
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
3091
+ var is_updating_effect = false;
3092
+ var is_destroying_effect = false;
3093
+ /** @param {boolean} value */
3094
+ function set_is_destroying_effect(value) {
3095
+ is_destroying_effect = value;
3096
+ }
3097
+ /** @type {null | Reaction} */
3098
+ var active_reaction = null;
3099
+ var untracking = false;
3100
+ /** @param {null | Reaction} reaction */
3101
+ function set_active_reaction(reaction) {
3102
+ active_reaction = reaction;
3103
+ }
3104
+ /** @type {null | Effect} */
3105
+ var active_effect = null;
3106
+ /** @param {null | Effect} effect */
3107
+ function set_active_effect(effect) {
3108
+ active_effect = effect;
3109
+ }
3110
+ /**
3111
+ * When sources are created within a reaction, reading and writing
3112
+ * them within that reaction should not cause a re-run
3113
+ * @type {null | Source[]}
3114
+ */
3115
+ var current_sources = null;
3116
+ /** @param {Value} value */
3117
+ function push_reaction_value(value) {
3118
+ if (active_reaction !== null && true) if (current_sources === null) current_sources = [value];
3119
+ else current_sources.push(value);
3120
+ }
3121
+ /**
3122
+ * The dependencies of the reaction that is currently being executed. In many cases,
3123
+ * the dependencies are unchanged between runs, and so this will be `null` unless
3124
+ * and until a new dependency is accessed — we track this via `skipped_deps`
3125
+ * @type {null | Value[]}
3126
+ */
3127
+ var new_deps = null;
3128
+ var skipped_deps = 0;
3129
+ /**
3130
+ * Tracks writes that the effect it's executed in doesn't listen to yet,
3131
+ * so that the dependency can be added to the effect later on if it then reads it
3132
+ * @type {null | Source[]}
3133
+ */
3134
+ var untracked_writes = null;
3135
+ /** @param {null | Source[]} value */
3136
+ function set_untracked_writes(value) {
3137
+ untracked_writes = value;
3138
+ }
3139
+ /**
3140
+ * @type {number} Used by sources and deriveds for handling updates.
3141
+ * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
3142
+ **/
3143
+ var write_version = 1;
3144
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
3145
+ var read_version = 0;
3146
+ var update_version = read_version;
3147
+ /** @param {number} value */
3148
+ function set_update_version(value) {
3149
+ update_version = value;
3150
+ }
3151
+ function increment_write_version() {
3152
+ return ++write_version;
3153
+ }
3154
+ /**
3155
+ * Determines whether a derived or effect is dirty.
3156
+ * If it is MAYBE_DIRTY, will set the status to CLEAN
3157
+ * @param {Reaction} reaction
3158
+ * @returns {boolean}
3159
+ */
3160
+ function is_dirty(reaction) {
3161
+ var flags = reaction.f;
3162
+ if ((flags & 2048) !== 0) return true;
3163
+ if (flags & 2) reaction.f &= ~WAS_MARKED;
3164
+ if ((flags & 4096) !== 0) {
3165
+ var dependencies = reaction.deps;
3166
+ var length = dependencies.length;
3167
+ for (var i = 0; i < length; i++) {
3168
+ var dependency = dependencies[i];
3169
+ if (is_dirty(dependency)) update_derived(dependency);
3170
+ if (dependency.wv > reaction.wv) return true;
3171
+ }
3172
+ if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
3173
+ }
3174
+ return false;
3175
+ }
3176
+ /**
3177
+ * @param {Value} signal
3178
+ * @param {Effect} effect
3179
+ * @param {boolean} [root]
3180
+ */
3181
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
3182
+ var reactions = signal.reactions;
3183
+ if (reactions === null) return;
3184
+ if (current_sources !== null && includes.call(current_sources, signal)) return;
3185
+ for (var i = 0; i < reactions.length; i++) {
3186
+ var reaction = reactions[i];
3187
+ if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
3188
+ else if (effect === reaction) {
3189
+ if (root) set_signal_status(reaction, DIRTY);
3190
+ else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
3191
+ schedule_effect(reaction);
3192
+ }
3193
+ }
3194
+ }
3195
+ /** @param {Reaction} reaction */
3196
+ function update_reaction(reaction) {
3197
+ var previous_deps = new_deps;
3198
+ var previous_skipped_deps = skipped_deps;
3199
+ var previous_untracked_writes = untracked_writes;
3200
+ var previous_reaction = active_reaction;
3201
+ var previous_sources = current_sources;
3202
+ var previous_component_context = component_context;
3203
+ var previous_untracking = untracking;
3204
+ var previous_update_version = update_version;
3205
+ var flags = reaction.f;
3206
+ new_deps = null;
3207
+ skipped_deps = 0;
3208
+ untracked_writes = null;
3209
+ active_reaction = (flags & 96) === 0 ? reaction : null;
3210
+ current_sources = null;
3211
+ set_component_context(reaction.ctx);
3212
+ untracking = false;
3213
+ update_version = ++read_version;
3214
+ if (reaction.ac !== null) {
3215
+ without_reactive_context(() => {
3216
+ /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
3217
+ });
3218
+ reaction.ac = null;
3219
+ }
3220
+ try {
3221
+ reaction.f |= REACTION_IS_UPDATING;
3222
+ var fn = reaction.fn;
3223
+ var result = fn();
3224
+ reaction.f |= REACTION_RAN;
3225
+ var deps = reaction.deps;
3226
+ var is_fork = current_batch?.is_fork;
3227
+ if (new_deps !== null) {
3228
+ var i;
3229
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
3230
+ if (deps !== null && skipped_deps > 0) {
3231
+ deps.length = skipped_deps + new_deps.length;
3232
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
3233
+ } else reaction.deps = deps = new_deps;
3234
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction);
3235
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
3236
+ remove_reactions(reaction, skipped_deps);
3237
+ deps.length = skipped_deps;
3238
+ }
3239
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
3240
+ if (previous_reaction !== null && previous_reaction !== reaction) {
3241
+ read_version++;
3242
+ if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
3243
+ if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
3244
+ if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
3245
+ else previous_untracked_writes.push(...untracked_writes);
3246
+ }
3247
+ if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
3248
+ return result;
3249
+ } catch (error) {
3250
+ return handle_error(error);
3251
+ } finally {
3252
+ reaction.f ^= REACTION_IS_UPDATING;
3253
+ new_deps = previous_deps;
3254
+ skipped_deps = previous_skipped_deps;
3255
+ untracked_writes = previous_untracked_writes;
3256
+ active_reaction = previous_reaction;
3257
+ current_sources = previous_sources;
3258
+ set_component_context(previous_component_context);
3259
+ untracking = previous_untracking;
3260
+ update_version = previous_update_version;
3261
+ }
3262
+ }
3263
+ /**
3264
+ * @template V
3265
+ * @param {Reaction} signal
3266
+ * @param {Value<V>} dependency
3267
+ * @returns {void}
3268
+ */
3269
+ function remove_reaction(signal, dependency) {
3270
+ let reactions = dependency.reactions;
3271
+ if (reactions !== null) {
3272
+ var index = index_of.call(reactions, signal);
3273
+ if (index !== -1) {
3274
+ var new_length = reactions.length - 1;
3275
+ if (new_length === 0) reactions = dependency.reactions = null;
3276
+ else {
3277
+ reactions[index] = reactions[new_length];
3278
+ reactions.pop();
3279
+ }
3280
+ }
3281
+ }
3282
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
3283
+ var derived = dependency;
3284
+ if ((derived.f & 512) !== 0) {
3285
+ derived.f ^= 512;
3286
+ derived.f &= ~WAS_MARKED;
3287
+ }
3288
+ if (derived.v !== UNINITIALIZED) update_derived_status(derived);
3289
+ freeze_derived_effects(derived);
3290
+ remove_reactions(derived, 0);
3291
+ }
3292
+ }
3293
+ /**
3294
+ * @param {Reaction} signal
3295
+ * @param {number} start_index
3296
+ * @returns {void}
3297
+ */
3298
+ function remove_reactions(signal, start_index) {
3299
+ var dependencies = signal.deps;
3300
+ if (dependencies === null) return;
3301
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
3302
+ }
3303
+ /**
3304
+ * @param {Effect} effect
3305
+ * @returns {void}
3306
+ */
3307
+ function update_effect(effect) {
3308
+ var flags = effect.f;
3309
+ if ((flags & 16384) !== 0) return;
3310
+ set_signal_status(effect, CLEAN);
3311
+ var previous_effect = active_effect;
3312
+ var was_updating_effect = is_updating_effect;
3313
+ active_effect = effect;
3314
+ is_updating_effect = true;
3315
+ try {
3316
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
3317
+ else destroy_effect_children(effect);
3318
+ execute_effect_teardown(effect);
3319
+ var teardown = update_reaction(effect);
3320
+ effect.teardown = typeof teardown === "function" ? teardown : null;
3321
+ effect.wv = write_version;
3322
+ } finally {
3323
+ is_updating_effect = was_updating_effect;
3324
+ active_effect = previous_effect;
3325
+ }
3326
+ }
3327
+ /**
3328
+ * @template V
3329
+ * @param {Value<V>} signal
3330
+ * @returns {V}
3331
+ */
3332
+ function get(signal) {
3333
+ var is_derived = (signal.f & 2) !== 0;
3334
+ captured_signals?.add(signal);
3335
+ if (active_reaction !== null && !untracking) {
3336
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
3337
+ var deps = active_reaction.deps;
3338
+ if ((active_reaction.f & 2097152) !== 0) {
3339
+ if (signal.rv < read_version) {
3340
+ signal.rv = read_version;
3341
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
3342
+ else if (new_deps === null) new_deps = [signal];
3343
+ else new_deps.push(signal);
3344
+ }
3345
+ } else {
3346
+ (active_reaction.deps ??= []).push(signal);
3347
+ var reactions = signal.reactions;
3348
+ if (reactions === null) signal.reactions = [active_reaction];
3349
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
3350
+ }
3351
+ }
3352
+ }
3353
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
3354
+ if (is_derived) {
3355
+ var derived = signal;
3356
+ if (is_destroying_effect) {
3357
+ var value = derived.v;
3358
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
3359
+ old_values.set(derived, value);
3360
+ return value;
3361
+ }
3362
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
3363
+ var is_new = (derived.f & REACTION_RAN) === 0;
3364
+ if (is_dirty(derived)) {
3365
+ if (should_connect) derived.f |= 512;
3366
+ update_derived(derived);
3367
+ }
3368
+ if (should_connect && !is_new) {
3369
+ unfreeze_derived_effects(derived);
3370
+ reconnect(derived);
3371
+ }
3372
+ }
3373
+ if (batch_values?.has(signal)) return batch_values.get(signal);
3374
+ if ((signal.f & 8388608) !== 0) throw signal.v;
3375
+ return signal.v;
3376
+ }
3377
+ /**
3378
+ * (Re)connect a disconnected derived, so that it is notified
3379
+ * of changes in `mark_reactions`
3380
+ * @param {Derived} derived
3381
+ */
3382
+ function reconnect(derived) {
3383
+ derived.f |= 512;
3384
+ if (derived.deps === null) return;
3385
+ for (const dep of derived.deps) {
3386
+ (dep.reactions ??= []).push(derived);
3387
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
3388
+ unfreeze_derived_effects(dep);
3389
+ reconnect(dep);
3390
+ }
3391
+ }
3392
+ }
3393
+ /** @param {Derived} derived */
3394
+ function depends_on_old_values(derived) {
3395
+ if (derived.v === UNINITIALIZED) return true;
3396
+ if (derived.deps === null) return false;
3397
+ for (const dep of derived.deps) {
3398
+ if (old_values.has(dep)) return true;
3399
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
3400
+ }
3401
+ return false;
3402
+ }
3403
+ /**
3404
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
3405
+ * any state read inside `fn` will not be treated as a dependency.
3406
+ *
3407
+ * ```ts
3408
+ * $effect(() => {
3409
+ * // this will run when `data` changes, but not when `time` changes
3410
+ * save(data, {
3411
+ * timestamp: untrack(() => time)
3412
+ * });
3413
+ * });
3414
+ * ```
3415
+ * @template T
3416
+ * @param {() => T} fn
3417
+ * @returns {T}
3418
+ */
3419
+ function untrack(fn) {
3420
+ var previous_untracking = untracking;
3421
+ try {
3422
+ untracking = true;
3423
+ return fn();
3424
+ } finally {
3425
+ untracking = previous_untracking;
3426
+ }
3427
+ }
3428
+ /** @import { Readable } from './public' */
3429
+ /**
3430
+ * @template T
3431
+ * @param {Readable<T> | null | undefined} store
3432
+ * @param {(value: T) => void} run
3433
+ * @param {(value: T) => void} [invalidate]
3434
+ * @returns {() => void}
3435
+ */
3436
+ function subscribe_to_store(store, run, invalidate) {
3437
+ if (store == null) {
3438
+ run(void 0);
3439
+ if (invalidate) invalidate(void 0);
3440
+ return noop;
3441
+ }
3442
+ const unsub = untrack(() => store.subscribe(run, invalidate));
3443
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
3444
+ }
3445
+ var VOID_ELEMENT_NAMES = [
3446
+ "area",
3447
+ "base",
3448
+ "br",
3449
+ "col",
3450
+ "command",
3451
+ "embed",
3452
+ "hr",
3453
+ "img",
3454
+ "input",
3455
+ "keygen",
3456
+ "link",
3457
+ "meta",
3458
+ "param",
3459
+ "source",
3460
+ "track",
3461
+ "wbr"
3462
+ ];
3463
+ /**
3464
+ * Returns `true` if `name` is of a void element
3465
+ * @param {string} name
3466
+ */
3467
+ function is_void(name) {
3468
+ return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === "!doctype";
3469
+ }
3470
+ /**
3471
+ * Attributes that are boolean, i.e. they are present or not present.
3472
+ */
3473
+ var DOM_BOOLEAN_ATTRIBUTES = [
3474
+ "allowfullscreen",
3475
+ "async",
3476
+ "autofocus",
3477
+ "autoplay",
3478
+ "checked",
3479
+ "controls",
3480
+ "default",
3481
+ "disabled",
3482
+ "formnovalidate",
3483
+ "indeterminate",
3484
+ "inert",
3485
+ "ismap",
3486
+ "loop",
3487
+ "multiple",
3488
+ "muted",
3489
+ "nomodule",
3490
+ "novalidate",
3491
+ "open",
3492
+ "playsinline",
3493
+ "readonly",
3494
+ "required",
3495
+ "reversed",
3496
+ "seamless",
3497
+ "selected",
3498
+ "webkitdirectory",
3499
+ "defer",
3500
+ "disablepictureinpicture",
3501
+ "disableremoteplayback"
3502
+ ];
3503
+ /**
3504
+ * Returns `true` if `name` is a boolean attribute
3505
+ * @param {string} name
3506
+ */
3507
+ function is_boolean_attribute(name) {
3508
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
3509
+ }
3510
+ [...DOM_BOOLEAN_ATTRIBUTES];
3511
+ /**
3512
+ * Subset of delegated events which should be passive by default.
3513
+ * These two are already passive via browser defaults on window, document and body.
3514
+ * But since
3515
+ * - we're delegating them
3516
+ * - they happen often
3517
+ * - they apply to mobile which is generally less performant
3518
+ * we're marking them as passive by default for other elements, too.
3519
+ */
3520
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
3521
+ /**
3522
+ * Returns `true` if `name` is a passive event
3523
+ * @param {string} name
3524
+ */
3525
+ function is_passive_event(name) {
3526
+ return PASSIVE_EVENTS.includes(name);
3527
+ }
3528
+ /** List of elements that require raw contents and should not have SSR comments put in them */
3529
+ var RAW_TEXT_ELEMENTS = [
3530
+ "textarea",
3531
+ "script",
3532
+ "style",
3533
+ "title"
3534
+ ];
3535
+ /** @param {string} name */
3536
+ function is_raw_text_element(name) {
3537
+ return RAW_TEXT_ELEMENTS.includes(name);
3538
+ }
3539
+ var REGEX_VALID_TAG_NAME = /^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]+)*$/u;
3540
+ var INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
3541
+ /**
3542
+ * @param {Renderer} renderer
3543
+ * @param {string} tag
3544
+ * @param {() => void} attributes_fn
3545
+ * @param {() => void} children_fn
3546
+ * @returns {void}
3547
+ */
3548
+ function element(renderer, tag, attributes_fn = noop, children_fn = noop) {
3549
+ renderer.push("<!---->");
3550
+ if (tag) {
3551
+ if (!REGEX_VALID_TAG_NAME.test(tag)) dynamic_element_invalid_tag(tag);
3552
+ renderer.push(`<${tag}`);
3553
+ attributes_fn();
3554
+ renderer.push(`>`);
3555
+ if (!is_void(tag)) {
3556
+ children_fn();
3557
+ if (!is_raw_text_element(tag)) renderer.push(EMPTY_COMMENT);
3558
+ renderer.push(`</${tag}>`);
3559
+ }
3560
+ }
3561
+ renderer.push("<!---->");
3562
+ }
3563
+ /**
3564
+ * Only available on the server and when compiling with the `server` option.
3565
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
3566
+ * @template {Record<string, any>} Props
3567
+ * @param {Component<Props> | ComponentType<SvelteComponent<Props>>} component
3568
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} [options]
3569
+ * @returns {RenderOutput}
3570
+ */
3571
+ function render(component, options = {}) {
3572
+ if (options.csp?.hash && options.csp.nonce) invalid_csp();
3573
+ return Renderer.render(component, options);
3574
+ }
3575
+ /**
3576
+ * @param {Record<string, unknown>} attrs
3577
+ * @param {string} [css_hash]
3578
+ * @param {Record<string, boolean>} [classes]
3579
+ * @param {Record<string, string>} [styles]
3580
+ * @param {number} [flags]
3581
+ * @returns {string}
3582
+ */
3583
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
3584
+ if (styles) attrs.style = to_style(attrs.style, styles);
3585
+ if (attrs.class) attrs.class = clsx(attrs.class);
3586
+ if (css_hash || classes) attrs.class = to_class(attrs.class, css_hash, classes);
3587
+ let attr_str = "";
3588
+ let name;
3589
+ const is_html = (flags & 1) === 0;
3590
+ const lowercase = (flags & 2) === 0;
3591
+ const is_input = (flags & 4) !== 0;
3592
+ for (name of Object.keys(attrs)) {
3593
+ if (typeof attrs[name] === "function") continue;
3594
+ if (name[0] === "$" && name[1] === "$") continue;
3595
+ if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
3596
+ var value = attrs[name];
3597
+ var lower = name.toLowerCase();
3598
+ if (lowercase) name = lower;
3599
+ if (lower.length > 2 && lower.startsWith("on")) continue;
3600
+ if (is_input) {
3601
+ if (name === "defaultvalue" || name === "defaultchecked") {
3602
+ name = name === "defaultvalue" ? "value" : "checked";
3603
+ if (attrs[name]) continue;
3604
+ }
3605
+ }
3606
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
3607
+ }
3608
+ return attr_str;
3609
+ }
3610
+ /**
3611
+ * @param {Record<string, unknown>[]} props
3612
+ * @returns {Record<string, unknown>}
3613
+ */
3614
+ function spread_props(props) {
3615
+ /** @type {Record<string, unknown>} */
3616
+ const merged_props = {};
3617
+ let key;
3618
+ for (let i = 0; i < props.length; i++) {
3619
+ const obj = props[i];
3620
+ if (obj == null) continue;
3621
+ for (key of Object.keys(obj)) {
3622
+ const desc = Object.getOwnPropertyDescriptor(obj, key);
3623
+ if (desc) Object.defineProperty(merged_props, key, desc);
3624
+ else merged_props[key] = obj[key];
3625
+ }
3626
+ }
3627
+ return merged_props;
3628
+ }
3629
+ /**
3630
+ * @param {unknown} value
3631
+ * @returns {string}
3632
+ */
3633
+ function stringify(value) {
3634
+ return typeof value === "string" ? value : value == null ? "" : value + "";
3635
+ }
3636
+ /**
3637
+ * @param {any} value
3638
+ * @param {string | undefined} [hash]
3639
+ * @param {Record<string, boolean>} [directives]
3640
+ */
3641
+ function attr_class(value, hash, directives) {
3642
+ var result = to_class(value, hash, directives);
3643
+ return result ? ` class="${escape_html(result, true)}"` : "";
3644
+ }
3645
+ /**
3646
+ * @param {any} value
3647
+ * @param {Record<string,any>|[Record<string,any>,Record<string,any>]} [directives]
3648
+ */
3649
+ function attr_style(value, directives) {
3650
+ var result = to_style(value, directives);
3651
+ return result ? ` style="${escape_html(result, true)}"` : "";
3652
+ }
3653
+ /**
3654
+ * @template V
3655
+ * @param {Record<string, [any, any, any]>} store_values
3656
+ * @param {string} store_name
3657
+ * @param {Store<V> | null | undefined} store
3658
+ * @returns {V}
3659
+ */
3660
+ function store_get(store_values, store_name, store) {
3661
+ if (store_name in store_values && store_values[store_name][0] === store) return store_values[store_name][2];
3662
+ store_values[store_name]?.[1]();
3663
+ store_values[store_name] = [
3664
+ store,
3665
+ null,
3666
+ void 0
3667
+ ];
3668
+ const unsub = subscribe_to_store(
3669
+ store,
3670
+ /** @param {any} v */
3671
+ (v) => store_values[store_name][2] = v
3672
+ );
3673
+ store_values[store_name][1] = unsub;
3674
+ return store_values[store_name][2];
3675
+ }
3676
+ /** @param {Record<string, [any, any, any]>} store_values */
3677
+ function unsubscribe_stores(store_values) {
3678
+ for (const store_name of Object.keys(store_values)) store_values[store_name][1]();
3679
+ }
3680
+ /**
3681
+ * Legacy mode: If the prop has a fallback and is bound in the
3682
+ * parent component, propagate the fallback value upwards.
3683
+ * @param {Record<string, unknown>} props_parent
3684
+ * @param {Record<string, unknown>} props_now
3685
+ */
3686
+ function bind_props(props_parent, props_now) {
3687
+ for (const key of Object.keys(props_now)) {
3688
+ const initial_value = props_parent[key];
3689
+ const value = props_now[key];
3690
+ if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) props_parent[key] = value;
3691
+ }
3692
+ }
3693
+ /** @param {any} array_like_or_iterator */
3694
+ function ensure_array_like(array_like_or_iterator) {
3695
+ if (array_like_or_iterator) return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
3696
+ return [];
3697
+ }
3698
+ /**
3699
+ * @template V
3700
+ * @param {() => V} get_value
3701
+ */
3702
+ function once(get_value) {
3703
+ let value = UNINITIALIZED;
3704
+ return () => {
3705
+ if (value === UNINITIALIZED) value = get_value();
3706
+ return value;
3707
+ };
3708
+ }
3709
+ /**
3710
+ * @template T
3711
+ * @param {()=>T} fn
3712
+ * @returns {(new_value?: T) => (T | void)}
3713
+ */
3714
+ function derived(fn) {
3715
+ const get_value = ssr_context === null ? fn : once(fn);
3716
+ /** @type {T | undefined} */
3717
+ let updated_value;
3718
+ return function(new_value) {
3719
+ if (arguments.length === 0) return updated_value ?? get_value();
3720
+ updated_value = new_value;
3721
+ return updated_value;
3722
+ };
3723
+ }
3724
+ var text_encoder;
3725
+ var crypto;
3726
+ /** @param {string} module_name */
3727
+ var obfuscated_import = (module_name) => import(
3728
+ /* @vite-ignore */
3729
+ module_name
3730
+ );
3731
+ /** @param {string} data */
3732
+ async function sha256(data) {
3733
+ text_encoder ??= new TextEncoder();
3734
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (await obfuscated_import("node:crypto")).webcrypto;
3735
+ return base64_encode(await crypto.subtle.digest("SHA-256", text_encoder.encode(data)));
3736
+ }
3737
+ /**
3738
+ * @param {Uint8Array} bytes
3739
+ * @returns {string}
3740
+ */
3741
+ function base64_encode(bytes) {
3742
+ if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
3743
+ let binary = "";
3744
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
3745
+ return btoa(binary);
3746
+ }
3747
+ /** @import { Component } from 'svelte' */
3748
+ /** @import { Csp, HydratableContext, RenderOutput, SSRContext, SyncRenderOutput, Sha256Source } from './types.js' */
3749
+ /** @import { MaybePromise } from '#shared' */
3750
+ /** @typedef {'head' | 'body'} RendererType */
3751
+ /** @typedef {{ [key in RendererType]: string }} AccumulatedContent */
3752
+ /**
3753
+ * @typedef {string | Renderer} RendererItem
3754
+ */
3755
+ /**
3756
+ * Renderers are basically a tree of `string | Renderer`s, where each `Renderer` in the tree represents
3757
+ * work that may or may not have completed. A renderer can be {@link collect}ed to aggregate the
3758
+ * content from itself and all of its children, but this will throw if any of the children are
3759
+ * performing asynchronous work. To asynchronously collect a renderer, just `await` it.
3760
+ *
3761
+ * The `string` values within a renderer are always associated with the {@link type} of that renderer. To switch types,
3762
+ * call {@link child} with a different `type` argument.
3763
+ */
3764
+ var Renderer = class Renderer {
3765
+ /**
3766
+ * The contents of the renderer.
3767
+ * @type {RendererItem[]}
3768
+ */
3769
+ #out = [];
3770
+ /**
3771
+ * Any `onDestroy` callbacks registered during execution of this renderer.
3772
+ * @type {(() => void)[] | undefined}
3773
+ */
3774
+ #on_destroy = void 0;
3775
+ /**
3776
+ * Whether this renderer is a component body.
3777
+ * @type {boolean}
3778
+ */
3779
+ #is_component_body = false;
3780
+ /**
3781
+ * If set, this renderer is an error boundary. When async collection
3782
+ * of the children fails, the failed snippet is rendered instead.
3783
+ * @type {{
3784
+ * failed: (renderer: Renderer, error: unknown, reset: () => void) => void;
3785
+ * transformError: (error: unknown) => unknown;
3786
+ * context: SSRContext | null;
3787
+ * } | null}
3788
+ */
3789
+ #boundary = null;
3790
+ /**
3791
+ * The type of string content that this renderer is accumulating.
3792
+ * @type {RendererType}
3793
+ */
3794
+ type;
3795
+ /** @type {Renderer | undefined} */
3796
+ #parent;
3797
+ /**
3798
+ * Asynchronous work associated with this renderer
3799
+ * @type {Promise<void> | undefined}
3800
+ */
3801
+ promise = void 0;
3802
+ /**
3803
+ * State which is associated with the content tree as a whole.
3804
+ * It will be re-exposed, uncopied, on all children.
3805
+ * @type {SSRState}
3806
+ * @readonly
3807
+ */
3808
+ global;
3809
+ /**
3810
+ * State that is local to the branch it is declared in.
3811
+ * It will be shallow-copied to all children.
3812
+ *
3813
+ * @type {{ select_value: string | undefined }}
3814
+ */
3815
+ local;
3816
+ /**
3817
+ * @param {SSRState} global
3818
+ * @param {Renderer | undefined} [parent]
3819
+ */
3820
+ constructor(global, parent) {
3821
+ this.#parent = parent;
3822
+ this.global = global;
3823
+ this.local = parent ? { ...parent.local } : { select_value: void 0 };
3824
+ this.type = parent ? parent.type : "body";
3825
+ }
3826
+ /**
3827
+ * @param {(renderer: Renderer) => void} fn
3828
+ */
3829
+ head(fn) {
3830
+ const head = new Renderer(this.global, this);
3831
+ head.type = "head";
3832
+ this.#out.push(head);
3833
+ head.child(fn);
3834
+ }
3835
+ /**
3836
+ * @param {Array<Promise<void>>} blockers
3837
+ * @param {(renderer: Renderer) => void} fn
3838
+ */
3839
+ async_block(blockers, fn) {
3840
+ this.#out.push(BLOCK_OPEN);
3841
+ this.async(blockers, fn);
3842
+ this.#out.push(BLOCK_CLOSE);
3843
+ }
3844
+ /**
3845
+ * @param {Array<Promise<void>>} blockers
3846
+ * @param {(renderer: Renderer) => void} fn
3847
+ */
3848
+ async(blockers, fn) {
3849
+ let callback = fn;
3850
+ if (blockers.length > 0) {
3851
+ const context = ssr_context;
3852
+ callback = (renderer) => {
3853
+ return Promise.all(blockers).then(() => {
3854
+ const previous_context = ssr_context;
3855
+ try {
3856
+ set_ssr_context(context);
3857
+ return fn(renderer);
3858
+ } finally {
3859
+ set_ssr_context(previous_context);
3860
+ }
3861
+ });
3862
+ };
3863
+ }
3864
+ this.child(callback);
3865
+ }
3866
+ /**
3867
+ * @param {Array<() => void>} thunks
3868
+ */
3869
+ run(thunks) {
3870
+ const context = ssr_context;
3871
+ let promise = Promise.resolve(thunks[0]());
3872
+ const promises = [promise];
3873
+ for (const fn of thunks.slice(1)) {
3874
+ promise = promise.then(() => {
3875
+ const previous_context = ssr_context;
3876
+ set_ssr_context(context);
3877
+ try {
3878
+ return fn();
3879
+ } finally {
3880
+ set_ssr_context(previous_context);
3881
+ }
3882
+ });
3883
+ promises.push(promise);
3884
+ }
3885
+ promise.catch(noop);
3886
+ this.promise = promise;
3887
+ return promises;
3888
+ }
3889
+ /**
3890
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3891
+ */
3892
+ child_block(fn) {
3893
+ this.#out.push(BLOCK_OPEN);
3894
+ this.child(fn);
3895
+ this.#out.push(BLOCK_CLOSE);
3896
+ }
3897
+ /**
3898
+ * Create a child renderer. The child renderer inherits the state from the parent,
3899
+ * but has its own content.
3900
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3901
+ */
3902
+ child(fn) {
3903
+ const child = new Renderer(this.global, this);
3904
+ this.#out.push(child);
3905
+ const parent = ssr_context;
3906
+ set_ssr_context({
3907
+ ...ssr_context,
3908
+ p: parent,
3909
+ c: null,
3910
+ r: child
3911
+ });
3912
+ const result = fn(child);
3913
+ set_ssr_context(parent);
3914
+ if (result instanceof Promise) {
3915
+ result.catch(noop);
3916
+ result.finally(() => set_ssr_context(null)).catch(noop);
3917
+ if (child.global.mode === "sync") await_invalid();
3918
+ child.promise = result;
3919
+ }
3920
+ return child;
3921
+ }
3922
+ /**
3923
+ * Render children inside an error boundary. If the children throw and the API-level
3924
+ * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is
3925
+ * rendered instead. Otherwise the error propagates.
3926
+ *
3927
+ * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props
3928
+ * @param {(renderer: Renderer) => MaybePromise<void>} children_fn
3929
+ */
3930
+ boundary(props, children_fn) {
3931
+ const child = new Renderer(this.global, this);
3932
+ this.#out.push(child);
3933
+ const parent_context = ssr_context;
3934
+ if (props.failed) child.#boundary = {
3935
+ failed: props.failed,
3936
+ transformError: this.global.transformError,
3937
+ context: parent_context
3938
+ };
3939
+ set_ssr_context({
3940
+ ...ssr_context,
3941
+ p: parent_context,
3942
+ c: null,
3943
+ r: child
3944
+ });
3945
+ try {
3946
+ const result = children_fn(child);
3947
+ set_ssr_context(parent_context);
3948
+ if (result instanceof Promise) {
3949
+ if (child.global.mode === "sync") await_invalid();
3950
+ result.catch(noop);
3951
+ child.promise = result;
3952
+ }
3953
+ } catch (error) {
3954
+ set_ssr_context(parent_context);
3955
+ const failed_snippet = props.failed;
3956
+ if (!failed_snippet) throw error;
3957
+ const result = this.global.transformError(error);
3958
+ child.#out.length = 0;
3959
+ child.#boundary = null;
3960
+ if (result instanceof Promise) {
3961
+ if (this.global.mode === "sync") await_invalid();
3962
+ child.promise = result.then((transformed) => {
3963
+ set_ssr_context(parent_context);
3964
+ child.#out.push(Renderer.#serialize_failed_boundary(transformed));
3965
+ failed_snippet(child, transformed, noop);
3966
+ child.#out.push(BLOCK_CLOSE);
3967
+ });
3968
+ child.promise.catch(noop);
3969
+ } else {
3970
+ child.#out.push(Renderer.#serialize_failed_boundary(result));
3971
+ failed_snippet(child, result, noop);
3972
+ child.#out.push(BLOCK_CLOSE);
3973
+ }
3974
+ }
3975
+ }
3976
+ /**
3977
+ * Create a component renderer. The component renderer inherits the state from the parent,
3978
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
3979
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3980
+ * @param {Function} [component_fn]
3981
+ * @returns {void}
3982
+ */
3983
+ component(fn, component_fn) {
3984
+ push$1(component_fn);
3985
+ const child = this.child(fn);
3986
+ child.#is_component_body = true;
3987
+ pop$1();
3988
+ }
3989
+ /**
3990
+ * @param {Record<string, any>} attrs
3991
+ * @param {(renderer: Renderer) => void} fn
3992
+ * @param {string | undefined} [css_hash]
3993
+ * @param {Record<string, boolean> | undefined} [classes]
3994
+ * @param {Record<string, string> | undefined} [styles]
3995
+ * @param {number | undefined} [flags]
3996
+ * @param {boolean | undefined} [is_rich]
3997
+ * @returns {void}
3998
+ */
3999
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
4000
+ const { value, ...select_attrs } = attrs;
4001
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
4002
+ this.child((renderer) => {
4003
+ renderer.local.select_value = value;
4004
+ fn(renderer);
4005
+ });
4006
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
4007
+ }
4008
+ /**
4009
+ * @param {Record<string, any>} attrs
4010
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
4011
+ * @param {string | undefined} [css_hash]
4012
+ * @param {Record<string, boolean> | undefined} [classes]
4013
+ * @param {Record<string, string> | undefined} [styles]
4014
+ * @param {number | undefined} [flags]
4015
+ * @param {boolean | undefined} [is_rich]
4016
+ */
4017
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
4018
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
4019
+ /**
4020
+ * @param {Renderer} renderer
4021
+ * @param {any} value
4022
+ * @param {{ head?: string, body: any }} content
4023
+ */
4024
+ const close = (renderer, value, { head, body }) => {
4025
+ if (has_own_property.call(attrs, "value")) value = attrs.value;
4026
+ if (value === this.local.select_value) renderer.#out.push(" selected=\"\"");
4027
+ renderer.#out.push(`>${body}${is_rich ? "<!>" : ""}</option>`);
4028
+ if (head) renderer.head((child) => child.push(head));
4029
+ };
4030
+ if (typeof body === "function") this.child((renderer) => {
4031
+ const r = new Renderer(this.global, this);
4032
+ body(r);
4033
+ if (this.global.mode === "async") return r.#collect_content_async().then((content) => {
4034
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
4035
+ });
4036
+ else {
4037
+ const content = r.#collect_content();
4038
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
4039
+ }
4040
+ });
4041
+ else close(this, body, { body: escape_html(body) });
4042
+ }
4043
+ /**
4044
+ * @param {(renderer: Renderer) => void} fn
4045
+ */
4046
+ title(fn) {
4047
+ const path = this.get_path();
4048
+ /** @param {string} head */
4049
+ const close = (head) => {
4050
+ this.global.set_title(head, path);
4051
+ };
4052
+ this.child((renderer) => {
4053
+ const r = new Renderer(renderer.global, renderer);
4054
+ fn(r);
4055
+ if (renderer.global.mode === "async") return r.#collect_content_async().then((content) => {
4056
+ close(content.head);
4057
+ });
4058
+ else close(r.#collect_content().head);
4059
+ });
4060
+ }
4061
+ /**
4062
+ * @param {string | (() => Promise<string>)} content
4063
+ */
4064
+ push(content) {
4065
+ if (typeof content === "function") this.child(async (renderer) => renderer.push(await content()));
4066
+ else this.#out.push(content);
4067
+ }
4068
+ /**
4069
+ * @param {() => void} fn
4070
+ */
4071
+ on_destroy(fn) {
4072
+ (this.#on_destroy ??= []).push(fn);
4073
+ }
4074
+ /**
4075
+ * @returns {number[]}
4076
+ */
4077
+ get_path() {
4078
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
4079
+ }
4080
+ /**
4081
+ * @deprecated this is needed for legacy component bindings
4082
+ */
4083
+ copy() {
4084
+ const copy = new Renderer(this.global, this.#parent);
4085
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
4086
+ copy.promise = this.promise;
4087
+ return copy;
4088
+ }
4089
+ /**
4090
+ * @param {Renderer} other
4091
+ * @deprecated this is needed for legacy component bindings
4092
+ */
4093
+ subsume(other) {
4094
+ if (this.global.mode !== other.global.mode) throw new Error("invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!");
4095
+ this.local = other.local;
4096
+ this.#out = other.#out.map((item, i) => {
4097
+ const current = this.#out[i];
4098
+ if (current instanceof Renderer && item instanceof Renderer) {
4099
+ current.subsume(item);
4100
+ return current;
4101
+ }
4102
+ return item;
4103
+ });
4104
+ this.promise = other.promise;
4105
+ this.type = other.type;
4106
+ }
4107
+ get length() {
4108
+ return this.#out.length;
4109
+ }
4110
+ /**
4111
+ * Creates the hydration comment that marks the start of a failed boundary.
4112
+ * The error is JSON-serialized and embedded inside an HTML comment for the client
4113
+ * to parse during hydration. The JSON is escaped to prevent `-->` or `<!--` sequences
4114
+ * from breaking out of the comment (XSS). Uses unicode escapes which `JSON.parse()`
4115
+ * handles transparently.
4116
+ * @param {unknown} error
4117
+ * @returns {string}
4118
+ */
4119
+ static #serialize_failed_boundary(error) {
4120
+ return `<!--[?${JSON.stringify(error).replace(/>/g, "\\u003e").replace(/</g, "\\u003c")}-->`;
4121
+ }
4122
+ /**
4123
+ * Only available on the server and when compiling with the `server` option.
4124
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
4125
+ * @template {Record<string, any>} Props
4126
+ * @param {Component<Props>} component
4127
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
4128
+ * @returns {RenderOutput}
4129
+ */
4130
+ static render(component, options = {}) {
4131
+ /** @type {AccumulatedContent | undefined} */
4132
+ let sync;
4133
+ /** @type {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }> | undefined} */
4134
+ let async;
4135
+ const result = {};
4136
+ Object.defineProperties(result, {
4137
+ html: { get: () => {
4138
+ return (sync ??= Renderer.#render(component, options)).body;
4139
+ } },
4140
+ head: { get: () => {
4141
+ return (sync ??= Renderer.#render(component, options)).head;
4142
+ } },
4143
+ body: { get: () => {
4144
+ return (sync ??= Renderer.#render(component, options)).body;
4145
+ } },
4146
+ hashes: { value: { script: "" } },
4147
+ then: { value: (onfulfilled, onrejected) => {
4148
+ {
4149
+ const result = sync ??= Renderer.#render(component, options);
4150
+ const user_result = onfulfilled({
4151
+ head: result.head,
4152
+ body: result.body,
4153
+ html: result.body,
4154
+ hashes: { script: [] }
4155
+ });
4156
+ return Promise.resolve(user_result);
4157
+ }
4158
+ async ??= init_render_context().then(() => with_render_context(() => Renderer.#render_async(component, options)));
4159
+ return async.then((result) => {
4160
+ Object.defineProperty(result, "html", { get: () => {
4161
+ html_deprecated();
4162
+ } });
4163
+ return onfulfilled(result);
4164
+ }, onrejected);
4165
+ } }
4166
+ });
4167
+ return result;
4168
+ }
4169
+ /**
4170
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
4171
+ * after awaiting `collect_async`.
4172
+ *
4173
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
4174
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
4175
+ * @returns {Iterable<() => void>}
4176
+ */
4177
+ *#collect_on_destroy() {
4178
+ for (const component of this.#traverse_components()) yield* component.#collect_ondestroy();
4179
+ }
4180
+ /**
4181
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
4182
+ * @returns {Iterable<Renderer>}
4183
+ */
4184
+ *#traverse_components() {
4185
+ for (const child of this.#out) if (typeof child !== "string") yield* child.#traverse_components();
4186
+ if (this.#is_component_body) yield this;
4187
+ }
4188
+ /**
4189
+ * @returns {Iterable<() => void>}
4190
+ */
4191
+ *#collect_ondestroy() {
4192
+ if (this.#on_destroy) for (const fn of this.#on_destroy) yield fn;
4193
+ for (const child of this.#out) if (child instanceof Renderer && !child.#is_component_body) yield* child.#collect_ondestroy();
4194
+ }
4195
+ /**
4196
+ * Render a component. Throws if any of the children are performing asynchronous work.
4197
+ *
4198
+ * @template {Record<string, any>} Props
4199
+ * @param {Component<Props>} component
4200
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
4201
+ * @returns {AccumulatedContent}
4202
+ */
4203
+ static #render(component, options) {
4204
+ var previous_context = ssr_context;
4205
+ try {
4206
+ const renderer = Renderer.#open_render("sync", component, options);
4207
+ const content = renderer.#collect_content();
4208
+ return Renderer.#close_render(content, renderer);
4209
+ } finally {
4210
+ abort();
4211
+ set_ssr_context(previous_context);
4212
+ }
4213
+ }
4214
+ /**
4215
+ * Render a component.
4216
+ *
4217
+ * @template {Record<string, any>} Props
4218
+ * @param {Component<Props>} component
4219
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
4220
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
4221
+ */
4222
+ static async #render_async(component, options) {
4223
+ const previous_context = ssr_context;
4224
+ try {
4225
+ const renderer = Renderer.#open_render("async", component, options);
4226
+ const content = await renderer.#collect_content_async();
4227
+ const hydratables = await renderer.#collect_hydratables();
4228
+ if (hydratables !== null) content.head = hydratables + content.head;
4229
+ return Renderer.#close_render(content, renderer);
4230
+ } finally {
4231
+ set_ssr_context(previous_context);
4232
+ abort();
4233
+ }
4234
+ }
4235
+ /**
4236
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
4237
+ * @param {AccumulatedContent} content
4238
+ * @returns {AccumulatedContent}
4239
+ */
4240
+ #collect_content(content = {
4241
+ head: "",
4242
+ body: ""
4243
+ }) {
4244
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
4245
+ else if (item instanceof Renderer) item.#collect_content(content);
4246
+ return content;
4247
+ }
4248
+ /**
4249
+ * Collect all of the code from the `out` array and return it as a string.
4250
+ * @param {AccumulatedContent} content
4251
+ * @returns {Promise<AccumulatedContent>}
4252
+ */
4253
+ async #collect_content_async(content = {
4254
+ head: "",
4255
+ body: ""
4256
+ }) {
4257
+ await this.promise;
4258
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
4259
+ else if (item instanceof Renderer) if (item.#boundary) {
4260
+ /** @type {AccumulatedContent} */
4261
+ const boundary_content = {
4262
+ head: "",
4263
+ body: ""
4264
+ };
4265
+ try {
4266
+ await item.#collect_content_async(boundary_content);
4267
+ content.head += boundary_content.head;
4268
+ content.body += boundary_content.body;
4269
+ } catch (error) {
4270
+ const { context, failed, transformError } = item.#boundary;
4271
+ set_ssr_context(context);
4272
+ let transformed = await transformError(error);
4273
+ const failed_renderer = new Renderer(item.global, item);
4274
+ failed_renderer.type = item.type;
4275
+ failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed));
4276
+ failed(failed_renderer, transformed, noop);
4277
+ failed_renderer.#out.push(BLOCK_CLOSE);
4278
+ await failed_renderer.#collect_content_async(content);
4279
+ }
4280
+ } else await item.#collect_content_async(content);
4281
+ return content;
4282
+ }
4283
+ async #collect_hydratables() {
4284
+ const ctx = get_render_context().hydratable;
4285
+ for (const [_, key] of ctx.unresolved_promises) unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
4286
+ for (const comparison of ctx.comparisons) await comparison;
4287
+ return await this.#hydratable_block(ctx);
4288
+ }
4289
+ /**
4290
+ * @template {Record<string, any>} Props
4291
+ * @param {'sync' | 'async'} mode
4292
+ * @param {import('svelte').Component<Props>} component
4293
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
4294
+ * @returns {Renderer}
4295
+ */
4296
+ static #open_render(mode, component, options) {
4297
+ if (options.idPrefix?.includes("--")) invalid_id_prefix();
4298
+ var previous_context = ssr_context;
4299
+ try {
4300
+ const renderer = new Renderer(new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp, options.transformError));
4301
+ set_ssr_context({
4302
+ p: null,
4303
+ c: options.context ?? null,
4304
+ r: renderer
4305
+ });
4306
+ renderer.push(BLOCK_OPEN);
4307
+ component(renderer, options.props ?? {});
4308
+ renderer.push(BLOCK_CLOSE);
4309
+ return renderer;
4310
+ } finally {
4311
+ set_ssr_context(previous_context);
4312
+ }
4313
+ }
4314
+ /**
4315
+ * @param {AccumulatedContent} content
4316
+ * @param {Renderer} renderer
4317
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
4318
+ */
4319
+ static #close_render(content, renderer) {
4320
+ for (const cleanup of renderer.#collect_on_destroy()) cleanup();
4321
+ let head = content.head + renderer.global.get_title();
4322
+ let body = content.body;
4323
+ for (const { hash, code } of renderer.global.css) head += `<style id="${hash}">${code}</style>`;
4324
+ return {
4325
+ head,
4326
+ body,
4327
+ hashes: { script: renderer.global.csp.script_hashes }
4328
+ };
4329
+ }
4330
+ /**
4331
+ * @param {HydratableContext} ctx
4332
+ */
4333
+ async #hydratable_block(ctx) {
4334
+ if (ctx.lookup.size === 0) return null;
4335
+ let entries = [];
4336
+ let has_promises = false;
4337
+ for (const [k, v] of ctx.lookup) {
4338
+ if (v.promises) {
4339
+ has_promises = true;
4340
+ for (const p of v.promises) await p;
4341
+ }
4342
+ entries.push(`[${uneval(k)},${v.serialized}]`);
4343
+ }
4344
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
4345
+ if (has_promises) prelude = `const r = (v) => Promise.resolve(v);
4346
+ ${prelude}`;
4347
+ const body = `
4348
+ {
4349
+ ${prelude}
4350
+
4351
+ for (const [k, v] of [
4352
+ ${entries.join(",\n ")}
4353
+ ]) {
4354
+ h.set(k, v);
4355
+ }
4356
+ }
4357
+ `;
4358
+ let csp_attr = "";
4359
+ if (this.global.csp.nonce) csp_attr = ` nonce="${this.global.csp.nonce}"`;
4360
+ else if (this.global.csp.hash) {
4361
+ const hash = await sha256(body);
4362
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
4363
+ }
4364
+ return `\n\t\t<script${csp_attr}>${body}<\/script>`;
4365
+ }
4366
+ };
4367
+ var SSRState = class {
4368
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
4369
+ csp;
4370
+ /** @readonly @type {'sync' | 'async'} */
4371
+ mode;
4372
+ /** @readonly @type {() => string} */
4373
+ uid;
4374
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
4375
+ css = /* @__PURE__ */ new Set();
4376
+ /**
4377
+ * `transformError` passed to `render`. Called when an error boundary catches an error.
4378
+ * Throws by default if unset in `render`.
4379
+ * @type {(error: unknown) => unknown}
4380
+ */
4381
+ transformError;
4382
+ /** @type {{ path: number[], value: string }} */
4383
+ #title = {
4384
+ path: [],
4385
+ value: ""
4386
+ };
4387
+ /**
4388
+ * @param {'sync' | 'async'} mode
4389
+ * @param {string} id_prefix
4390
+ * @param {Csp} csp
4391
+ * @param {((error: unknown) => unknown) | undefined} [transformError]
4392
+ */
4393
+ constructor(mode, id_prefix = "", csp = { hash: false }, transformError) {
4394
+ this.mode = mode;
4395
+ this.csp = {
4396
+ ...csp,
4397
+ script_hashes: []
4398
+ };
4399
+ this.transformError = transformError ?? ((error) => {
4400
+ throw error;
4401
+ });
4402
+ let uid = 1;
4403
+ this.uid = () => `${id_prefix}s${uid++}`;
4404
+ }
4405
+ get_title() {
4406
+ return this.#title.value;
4407
+ }
4408
+ /**
4409
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
4410
+ * from earlier than or equal to the current value.
4411
+ * @param {string} value
4412
+ * @param {number[]} path
4413
+ */
4414
+ set_title(value, path) {
4415
+ const current = this.#title.path;
4416
+ let i = 0;
4417
+ let l = Math.min(path.length, current.length);
4418
+ while (i < l && path[i] === current[i]) i += 1;
4419
+ if (path[i] === void 0) return;
4420
+ if (current[i] === void 0 || path[i] > current[i]) {
4421
+ this.#title.path = path;
4422
+ this.#title.value = value;
4423
+ }
4424
+ }
4425
+ };
4426
+ //#endregion
4427
+ export { render_effect as $, getAllContexts as A, hydration_failed as B, ensure_array_like as C, flushSync as D, experimental_async_required as E, get_type as F, is_primitive as G, init_operations as H, hasContext as I, noop as J, lifecycle_function_unavailable as K, hydratable_serialization_failed as L, get_first_child as M, get_next_sibling as N, get as O, get_render_context as P, render as Q, hydrate_node as R, element as S, escape_html as T, is_passive_event as U, hydration_mismatch as V, is_plain_object as W, push as X, pop as Y, readable as Z, component_root as _, writable as _t, active_reaction as a, set_hydrate_node as at, define_property as b, attr_class as c, ssr_context as ct, bind_props as d, stringify as dt, run as et, boundary as f, stringify_key as ft, component_context as g, valid_array_indices as gt, clsx$1 as h, unsubscribe_stores as ht, active_effect as i, set_active_reaction as it, getContext as j, getAbortSignal as k, attr_style as l, state as lt, clsx as m, uneval as mt, HYDRATION_ERROR as n, setContext as nt, array_from as o, set_hydrating as ot, clear_text_content as p, stringify_string as pt, mutable_source as q, LEGACY_PROPS as r, set_active_effect as rt, attr as s, spread_props as st, DevalueError as t, set as tt, attributes as u, store_get as ut, createContext as v, enumerable_symbols as w, derived as x, create_text as y, hydrating as z };
4428
+
4429
+ //# sourceMappingURL=dev-7V6fUCff.js.map