@phosart/devtool 0.2.63 → 0.2.65

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